Skip to content

Commit 64cfbf5

Browse files
author
foobar
committed
MFH: - Fixed bug #34307 (OnUpdateStringUnempty INI options can be set empty)
1 parent 248c30d commit 64cfbf5

File tree

4 files changed

+35
-21
lines changed

4 files changed

+35
-21
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ PHP NEWS
1919
- Fixed failing queries (FALSE returned) with mysqli_query() on 64 bit systems.
2020
(Andrey)
2121
- Fixed bug #34310 (foreach($arr as $c->d => $x) crashes). (Dmitry)
22+
- Fixed bug #34307 (OnUpdateStringUnempty INI options can be set empty). (Jani)
2223
- Fixed bug #34306 (wddx_serialize_value() crashes with long array keys). (Jani)
2324
- Fixed bug #34302 (date('W') do not return leading zeros for week 1 to 9).
2425
(Derick)

main/main.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -1415,17 +1415,24 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
14151415

14161416
le_index_ptr = zend_register_list_destructors_ex(NULL, NULL, "index pointer", 0);
14171417

1418+
/* Initialize configuration_hash */
1419+
if (php_init_config_hash() == FAILURE) {
1420+
return FAILURE;
1421+
}
1422+
1423+
/* Register PHP core ini entries */
1424+
REGISTER_INI_ENTRIES();
1425+
1426+
/* Register Zend ini entries */
1427+
zend_register_standard_ini_entries(TSRMLS_C);
14181428

14191429
/* this will read in php.ini, set up the configuration parameters,
14201430
load zend extensions and register php function extensions
14211431
to be loaded later */
1422-
if (php_init_config() == FAILURE) {
1432+
if (php_init_config(TSRMLS_C) == FAILURE) {
14231433
return FAILURE;
14241434
}
14251435

1426-
REGISTER_INI_ENTRIES();
1427-
zend_register_standard_ini_entries(TSRMLS_C);
1428-
14291436
/* Disable realpath cache if safe_mode or open_basedir are set */
14301437
if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
14311438
CWDG(realpath_cache_size_limit) = 0;

main/php_ini.c

+21-16
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,6 @@ PHPAPI void display_ini_entries(zend_module_entry *module)
163163
# endif
164164
#endif
165165

166-
/* {{{ pvalue_config_destructor
167-
*/
168-
static void pvalue_config_destructor(zval *pvalue)
169-
{
170-
if (Z_TYPE_P(pvalue) == IS_STRING) {
171-
free(Z_STRVAL_P(pvalue));
172-
}
173-
}
174-
/* }}} */
175-
176166
/* {{{ php_config_ini_parser_cb
177167
*/
178168
static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg)
@@ -254,9 +244,29 @@ static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
254244
}
255245
/* }}} */
256246

247+
/* {{{ pvalue_config_destructor
248+
*/
249+
static void pvalue_config_destructor(zval *pvalue)
250+
{
251+
if (Z_TYPE_P(pvalue) == IS_STRING) {
252+
free(Z_STRVAL_P(pvalue));
253+
}
254+
}
255+
/* }}} */
256+
257+
/* {{{ php_init_config_hash
258+
*/
259+
int php_init_config_hash(void)
260+
{
261+
if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1) == FAILURE) {
262+
return FAILURE;
263+
}
264+
}
265+
/* }}} */
266+
257267
/* {{{ php_init_config
258268
*/
259-
int php_init_config()
269+
int php_init_config(TSRMLS_D)
260270
{
261271
char *php_ini_search_path = NULL;
262272
int safe_mode_state;
@@ -269,11 +279,6 @@ int php_init_config()
269279
zend_llist scanned_ini_list;
270280
int l, total_l=0;
271281
zend_llist_element *element;
272-
TSRMLS_FETCH();
273-
274-
if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1) == FAILURE) {
275-
return FAILURE;
276-
}
277282

278283
if (sapi_module.ini_defaults) {
279284
sapi_module.ini_defaults(&configuration_hash);

main/php_ini.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#include "zend_ini.h"
2525

2626
BEGIN_EXTERN_C()
27-
int php_init_config();
27+
int php_init_config_hash(void);
28+
int php_init_config(TSRMLS_D);
2829
int php_shutdown_config(void);
2930
void php_ini_register_extensions(TSRMLS_D);
3031
zval *cfg_get_entry(char *name, uint name_length);

0 commit comments

Comments
 (0)