@@ -257,7 +257,7 @@ static void php_disable_classes(TSRMLS_D)
257
257
258
258
/* {{{ php_binary_init
259
259
*/
260
- static void php_binary_init (TSRMLS_D )
260
+ static void php_binary_init (TSRMLS_D )
261
261
{
262
262
char * binary_location ;
263
263
#ifdef PHP_WIN32
@@ -845,7 +845,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
845
845
efree (docref_buf );
846
846
}
847
847
848
- if (PG (track_errors ) && module_initialized &&
848
+ if (PG (track_errors ) && module_initialized &&
849
849
(!EG (user_error_handler ) || !(EG (user_error_handler_error_reporting ) & type ))) {
850
850
if (!EG (active_symbol_table )) {
851
851
zend_rebuild_symbol_table (TSRMLS_C );
@@ -962,7 +962,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
962
962
/* store the error if it has changed */
963
963
if (display ) {
964
964
#ifdef ZEND_SIGNALS
965
- HANDLE_BLOCK_INTERRUPTIONS ();
965
+ HANDLE_BLOCK_INTERRUPTIONS ();
966
966
#endif
967
967
if (PG (last_error_message )) {
968
968
free (PG (last_error_message ));
@@ -1133,11 +1133,20 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
1133
1133
case E_PARSE :
1134
1134
case E_COMPILE_ERROR :
1135
1135
case E_USER_ERROR :
1136
- EG (exit_status ) = 255 ;
1136
+ { /* new block to allow variable definition */
1137
+ /* eval() errors do not affect exit_status or response code */
1138
+ zend_bool during_eval = (type == E_PARSE ) && (EG (current_execute_data ) &&
1139
+ EG (current_execute_data )-> opline &&
1140
+ EG (current_execute_data )-> opline -> opcode == ZEND_INCLUDE_OR_EVAL &&
1141
+ EG (current_execute_data )-> opline -> extended_value == ZEND_EVAL );
1142
+ if (!during_eval ) {
1143
+ EG (exit_status ) = 255 ;
1144
+ }
1137
1145
if (module_initialized ) {
1138
1146
if (!PG (display_errors ) &&
1139
1147
!SG (headers_sent ) &&
1140
- SG (sapi_headers ).http_response_code == 200
1148
+ SG (sapi_headers ).http_response_code == 200 &&
1149
+ !during_eval
1141
1150
) {
1142
1151
sapi_header_line ctr = {0 };
1143
1152
@@ -1158,6 +1167,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
1158
1167
}
1159
1168
}
1160
1169
break ;
1170
+ }
1161
1171
}
1162
1172
1163
1173
/* Log if necessary */
@@ -1211,7 +1221,7 @@ PHPAPI char *php_get_current_user(TSRMLS_D)
1211
1221
name [len ] = '\0' ;
1212
1222
SG (request_info ).current_user_length = len ;
1213
1223
SG (request_info ).current_user = estrndup (name , len );
1214
- return SG (request_info ).current_user ;
1224
+ return SG (request_info ).current_user ;
1215
1225
#else
1216
1226
struct passwd * pwd ;
1217
1227
#if defined(ZTS ) && defined(HAVE_GETPWUID_R ) && defined(_SC_GETPW_R_SIZE_MAX )
@@ -1239,9 +1249,9 @@ PHPAPI char *php_get_current_user(TSRMLS_D)
1239
1249
#if defined(ZTS ) && defined(HAVE_GETPWUID_R ) && defined(_SC_GETPW_R_SIZE_MAX )
1240
1250
efree (pwbuf );
1241
1251
#endif
1242
- return SG (request_info ).current_user ;
1252
+ return SG (request_info ).current_user ;
1243
1253
#endif
1244
- }
1254
+ }
1245
1255
}
1246
1256
/* }}} */
1247
1257
@@ -1256,7 +1266,7 @@ PHP_FUNCTION(set_time_limit)
1256
1266
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "l" , & new_timeout ) == FAILURE ) {
1257
1267
return ;
1258
1268
}
1259
-
1269
+
1260
1270
new_timeout_strlen = zend_spprintf (& new_timeout_str , 0 , "%ld" , new_timeout );
1261
1271
1262
1272
if (zend_alter_ini_entry_ex ("max_execution_time" , sizeof ("max_execution_time" ), new_timeout_str , new_timeout_strlen , PHP_INI_USER , PHP_INI_STAGE_RUNTIME , 0 TSRMLS_CC ) == SUCCESS ) {
@@ -1890,7 +1900,7 @@ static void core_globals_dtor(php_core_globals *core_globals TSRMLS_DC)
1890
1900
PHP_MINFO_FUNCTION (php_core ) { /* {{{ */
1891
1901
php_info_print_table_start ();
1892
1902
php_info_print_table_row (2 , "PHP Version" , PHP_VERSION );
1893
- php_info_print_table_end ();
1903
+ php_info_print_table_end ();
1894
1904
DISPLAY_INI_ENTRIES ();
1895
1905
}
1896
1906
/* }}} */
@@ -2166,7 +2176,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
2166
2176
return FAILURE ;
2167
2177
}
2168
2178
2169
- /* initialize registry for images to be used in phpinfo()
2179
+ /* initialize registry for images to be used in phpinfo()
2170
2180
(this uses configuration parameters from php.ini)
2171
2181
*/
2172
2182
if (php_init_info_logos () == FAILURE ) {
@@ -2212,7 +2222,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
2212
2222
EG (current_module ) = NULL ;
2213
2223
}
2214
2224
}
2215
-
2225
+
2216
2226
/* disable certain classes and functions as requested by php.ini */
2217
2227
php_disable_functions (TSRMLS_C );
2218
2228
php_disable_classes (TSRMLS_C );
@@ -2247,38 +2257,38 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
2247
2257
const char * directives [16 ]; /* Remember to change this if the number of directives change */
2248
2258
} directives [2 ] = {
2249
2259
{
2250
- E_DEPRECATED ,
2251
- "Directive '%s' is deprecated in PHP 5.3 and greater" ,
2260
+ E_DEPRECATED ,
2261
+ "Directive '%s' is deprecated in PHP 5.3 and greater" ,
2252
2262
{
2253
2263
NULL
2254
2264
}
2255
- },
2265
+ },
2256
2266
{
2257
- E_CORE_ERROR ,
2258
- "Directive '%s' is no longer available in PHP" ,
2267
+ E_CORE_ERROR ,
2268
+ "Directive '%s' is no longer available in PHP" ,
2259
2269
{
2260
2270
"allow_call_time_pass_reference" ,
2261
- "define_syslog_variables" ,
2262
- "highlight.bg" ,
2263
- "magic_quotes_gpc" ,
2264
- "magic_quotes_runtime" ,
2265
- "magic_quotes_sybase" ,
2266
- "register_globals" ,
2267
- "register_long_arrays" ,
2268
- "safe_mode" ,
2269
- "safe_mode_gid" ,
2270
- "safe_mode_include_dir" ,
2271
- "safe_mode_exec_dir" ,
2272
- "safe_mode_allowed_env_vars" ,
2273
- "safe_mode_protected_env_vars" ,
2274
- "zend.ze1_compatibility_mode" ,
2271
+ "define_syslog_variables" ,
2272
+ "highlight.bg" ,
2273
+ "magic_quotes_gpc" ,
2274
+ "magic_quotes_runtime" ,
2275
+ "magic_quotes_sybase" ,
2276
+ "register_globals" ,
2277
+ "register_long_arrays" ,
2278
+ "safe_mode" ,
2279
+ "safe_mode_gid" ,
2280
+ "safe_mode_include_dir" ,
2281
+ "safe_mode_exec_dir" ,
2282
+ "safe_mode_allowed_env_vars" ,
2283
+ "safe_mode_protected_env_vars" ,
2284
+ "zend.ze1_compatibility_mode" ,
2275
2285
NULL
2276
2286
}
2277
2287
}
2278
2288
};
2279
2289
2280
2290
unsigned int i ;
2281
-
2291
+
2282
2292
zend_try {
2283
2293
/* 2 = Count of deprecation structs */
2284
2294
for (i = 0 ; i < 2 ; i ++ ) {
@@ -2298,7 +2308,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
2298
2308
retval = FAILURE ;
2299
2309
} zend_end_try ();
2300
2310
}
2301
-
2311
+
2302
2312
sapi_deactivate (TSRMLS_C );
2303
2313
module_startup = 0 ;
2304
2314
@@ -2353,7 +2363,7 @@ void php_module_shutdown(TSRMLS_D)
2353
2363
sapi_flush (TSRMLS_C );
2354
2364
2355
2365
zend_shutdown (TSRMLS_C );
2356
-
2366
+
2357
2367
/* Destroys filter & transport registries too */
2358
2368
php_shutdown_stream_wrappers (module_number TSRMLS_CC );
2359
2369
@@ -2396,7 +2406,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
2396
2406
{
2397
2407
zend_file_handle * prepend_file_p , * append_file_p ;
2398
2408
zend_file_handle prepend_file = {0 }, append_file = {0 };
2399
- #if HAVE_BROKEN_GETCWD
2409
+ #if HAVE_BROKEN_GETCWD
2400
2410
int old_cwd_fd = -1 ;
2401
2411
#else
2402
2412
char * old_cwd ;
0 commit comments