Skip to content

Commit 0ab356c

Browse files
committed
Autogolobal $GLOBALS has to be pinged even if auto_globals_jit=0
1 parent 61ac64b commit 0ab356c

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

ZendAccelerator.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,18 +1154,27 @@ static int zend_accel_get_auto_globals(TSRMLS_D)
11541154
{
11551155
int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0]));
11561156
int n = 1;
1157-
zval **res;
11581157
int mask = 0;
11591158

11601159
for (i = 0; i < ag_size ; i++) {
1161-
if (zend_hash_find(&EG(symbol_table), jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, (void *)&res) == SUCCESS) {
1160+
if (zend_hash_exists(&EG(symbol_table), jit_auto_globals_info[i].name, jit_auto_globals_info[i].len)) {
11621161
mask |= n;
11631162
}
11641163
n += n;
11651164
}
11661165
return mask;
11671166
}
11681167

1168+
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
1169+
static int zend_accel_get_auto_globals_no_jit(TSRMLS_D)
1170+
{
1171+
if (zend_hash_exists(&EG(symbol_table), jit_auto_globals_info[3].name, jit_auto_globals_info[3].len)) {
1172+
return 8;
1173+
}
1174+
return 0;
1175+
}
1176+
#endif
1177+
11691178
static void zend_accel_set_auto_globals(int mask TSRMLS_DC)
11701179
{
11711180
int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0]));
@@ -1318,11 +1327,15 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
13181327
will have to ping the used auto global variables before execution */
13191328
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
13201329
if (PG(auto_globals_jit)) {
1330+
new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals(TSRMLS_C);
1331+
} else {
1332+
new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals_no_jit(TSRMLS_C);
1333+
}
13211334
#else
13221335
if ((PG(auto_globals_jit) && !PG(register_globals) && !PG(register_long_arrays))) {
1323-
#endif
13241336
new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals(TSRMLS_C);
1325-
}
1337+
}
1338+
#endif
13261339

13271340
if (ZCG(accel_directives).validate_timestamps) {
13281341
/* Obtain the file timestamps, *before* actually compiling them,

0 commit comments

Comments
 (0)