From ad4533fdbabcc3e545277e30023b2fdce16297a0 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Tue, 21 Jul 2015 12:59:23 +0900 Subject: [PATCH] Change E_ERROR and some E_WARNING to E_RECOVERABLE_ERROR. --- ext/session/mod_user.c | 4 +- ext/session/mod_user_class.c | 2 +- ext/session/session.c | 18 +++---- ext/session/tests/bug60860.phpt | 2 +- ext/session/tests/bug66481.phpt | 4 +- ext/session/tests/bug67972.phpt | 2 +- .../tests/session_module_name_variation3.phpt | 2 +- ext/session/tests/session_name_error.phpt | 53 ++++++++++++------- .../tests/session_name_variation1.phpt | 16 +++++- .../tests/session_save_path_variation4.phpt | 2 +- .../session_set_save_handler_class_014.phpt | 2 +- .../session_set_save_handler_error3.phpt | 2 +- .../session_set_save_handler_sid_002.phpt | 2 +- 13 files changed, 70 insertions(+), 41 deletions(-) diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 1196d867af..34a5a21346 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -191,12 +191,12 @@ PS_CREATE_SID_FUNC(user) } zval_ptr_dtor(&retval); } else { - php_error_docref(NULL, E_ERROR, "No session id returned by function"); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "No session id returned by function"); return NULL; } if (!id) { - php_error_docref(NULL, E_ERROR, "Session id must be a string"); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Session id must be a string"); return NULL; } diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index 82aea14854..d06902ce27 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -23,7 +23,7 @@ #define PS_SANITY_CHECK \ if (PS(default_mod) == NULL) { \ - php_error_docref(NULL, E_CORE_ERROR, "Cannot call default session handler"); \ + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Cannot call default session handler"); \ RETURN_FALSE; \ } diff --git a/ext/session/session.c b/ext/session/session.c index ef17b86bad..cf4af113f3 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -339,7 +339,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ case PS_HASH_FUNC_OTHER: if (!PS(hash_ops)) { efree(buf); - php_error_docref(NULL, E_ERROR, "Invalid session hash function"); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Invalid session hash function"); return NULL; } @@ -351,7 +351,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ #endif /* HAVE_HASH_EXT */ default: efree(buf); - php_error_docref(NULL, E_ERROR, "Invalid session hash function"); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Invalid session hash function"); return NULL; } efree(buf); @@ -480,7 +480,7 @@ static void php_session_initialize(void) /* {{{ */ zend_string *val = NULL; if (!PS(mod)) { - php_error_docref(NULL, E_ERROR, "No storage module chosen - failed to initialize session"); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "No storage module chosen - failed to initialize session"); return; } @@ -488,7 +488,7 @@ static void php_session_initialize(void) /* {{{ */ if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE /* || PS(mod_data) == NULL */ /* FIXME: open must set valid PS(mod_data) with success */ ) { - php_error_docref(NULL, E_ERROR, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path)); return; } @@ -496,7 +496,7 @@ static void php_session_initialize(void) /* {{{ */ if (!PS(id)) { PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); if (!PS(id)) { - php_error_docref(NULL, E_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); return; } if (PS(use_cookies)) { @@ -600,7 +600,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */ int err_type; if (stage == ZEND_INI_STAGE_RUNTIME) { - err_type = E_WARNING; + err_type = E_RECOVERABLE_ERROR; } else { err_type = E_ERROR; } @@ -630,7 +630,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */ int err_type; if (stage == ZEND_INI_STAGE_RUNTIME) { - err_type = E_WARNING; + err_type = E_RECOVERABLE_ERROR; } else { err_type = E_ERROR; } @@ -699,7 +699,7 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */ int err_type; if (stage == ZEND_INI_STAGE_RUNTIME || stage == ZEND_INI_STAGE_ACTIVATE || stage == ZEND_INI_STAGE_STARTUP) { - err_type = E_WARNING; + err_type = E_RECOVERABLE_ERROR; } else { err_type = E_ERROR; } @@ -1829,7 +1829,7 @@ static PHP_FUNCTION(session_set_save_handler) add_next_index_zval(&PS(mod_user_names).names[i], obj); add_next_index_str(&PS(mod_user_names).names[i], zend_string_copy(func_name)); } else { - php_error_docref(NULL, E_ERROR, "Session handler's function table is corrupt"); + php_error_docref(NULL, E_RECOVERABLE_ERROR, "Session handler's function table is corrupt"); RETURN_FALSE; } diff --git a/ext/session/tests/bug60860.phpt b/ext/session/tests/bug60860.phpt index 83185862f0..194239d4c1 100644 --- a/ext/session/tests/bug60860.phpt +++ b/ext/session/tests/bug60860.phpt @@ -14,4 +14,4 @@ echo "ok\n"; --EXPECTF-- Warning: session_start(): user session functions not defined in %s on line 3 -Fatal error: session_start(): Failed to initialize storage module: user (path:%s) in %s on line 3 +Catchable fatal error: session_start(): Failed to initialize storage module: user (path:%s) in %s on line 3 diff --git a/ext/session/tests/bug66481.phpt b/ext/session/tests/bug66481.phpt index 5525ae8a38..27171da8f3 100644 --- a/ext/session/tests/bug66481.phpt +++ b/ext/session/tests/bug66481.phpt @@ -11,8 +11,8 @@ session.name= var_dump(session_name("foo")); var_dump(session_name("bar")); --EXPECTF-- -PHP Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0 +PHP Catchable fatal error: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0 -Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0 +Catchable fatal error: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0 string(9) "PHPSESSID" string(3) "foo" diff --git a/ext/session/tests/bug67972.phpt b/ext/session/tests/bug67972.phpt index 63ed3a95b8..c4bcc1a086 100644 --- a/ext/session/tests/bug67972.phpt +++ b/ext/session/tests/bug67972.phpt @@ -7,4 +7,4 @@ Bug #67972: SessionHandler Invalid memory read create_sid() (new SessionHandler)->create_sid(); --EXPECTF-- -Fatal error: SessionHandler::create_sid(): Cannot call default session handler in %s on line %d +Catchable fatal error: SessionHandler::create_sid(): Cannot call default session handler in %s on line %d diff --git a/ext/session/tests/session_module_name_variation3.phpt b/ext/session/tests/session_module_name_variation3.phpt index de49195fe8..aabb8baa6f 100644 --- a/ext/session/tests/session_module_name_variation3.phpt +++ b/ext/session/tests/session_module_name_variation3.phpt @@ -48,4 +48,4 @@ Stack trace: #2 {main} thrown in %s on line %d -Fatal error: session_start(): Failed to initialize storage module: %s in %s%esession_module_name_variation3.php on line %d +Catchable fatal error: session_start(): Failed to initialize storage module: %s in %s%esession_module_name_variation3.php on line %d diff --git a/ext/session/tests/session_name_error.phpt b/ext/session/tests/session_name_error.phpt index 9f0101d98b..cd7e364882 100644 --- a/ext/session/tests/session_name_error.phpt +++ b/ext/session/tests/session_name_error.phpt @@ -8,6 +8,21 @@ session.name=PHPSESSID --FILE-- --FILE--