Skip to content

Use php_error_docref() instead of zend_error() in session.c #15505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ static PHP_INI_MH(OnUpdateSidLength) /* {{{ */
SESSION_CHECK_OUTPUT_STATE;
val = ZEND_STRTOL(ZSTR_VAL(new_value), &endptr, 10);
if (val != 32) {
zend_error(E_DEPRECATED, "session.sid_length INI setting is deprecated");
php_error_docref("session.configuration", E_DEPRECATED, "session.sid_length INI setting is deprecated");
}
if (endptr && (*endptr == '\0')
&& val >= 22 && val <= PS_MAX_SID_LENGTH) {
Expand All @@ -775,7 +775,7 @@ static PHP_INI_MH(OnUpdateSidBits) /* {{{ */
SESSION_CHECK_OUTPUT_STATE;
val = ZEND_STRTOL(ZSTR_VAL(new_value), &endptr, 10);
if (val != 4) {
zend_error(E_DEPRECATED, "session.sid_bits_per_character INI setting is deprecated");
php_error_docref("session.configuration", E_DEPRECATED, "session.sid_bits_per_character INI setting is deprecated");
}
if (endptr && (*endptr == '\0')
&& val >= 4 && val <=6) {
Expand Down Expand Up @@ -2113,7 +2113,7 @@ PHP_FUNCTION(session_set_save_handler)
RETURN_TRUE;
}

zend_error(E_DEPRECATED, "Calling session_set_save_handler() with more than 2 arguments is deprecated");
php_error_docref(NULL, E_DEPRECATED, "Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated");
if (UNEXPECTED(EG(exception))) {
RETURN_THROWS();
}
Expand Down
2 changes: 1 addition & 1 deletion ext/session/tests/bug68063.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ var_dump(session_start());
var_dump(session_id());
?>
--EXPECTF--
Deprecated: session.sid_length INI setting is deprecated in Unknown on line 0
Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0
bool(true)
string(40) "%s"
6 changes: 3 additions & 3 deletions ext/session/tests/session_id_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ echo "Done";
--EXPECTF--
*** Testing session_id() : basic functionality ***

Deprecated: session.sid_bits_per_character INI setting is deprecated in %s on line %d
Deprecated: ini_set(): session.sid_bits_per_character INI setting is deprecated in %s on line %d

Deprecated: session.sid_length INI setting is deprecated in %s on line %d
Deprecated: ini_set(): session.sid_length INI setting is deprecated in %s on line %d
string(120) "%s"

Deprecated: session.sid_length INI setting is deprecated in %s on line %d
Deprecated: ini_set(): session.sid_length INI setting is deprecated in %s on line %d
string(22) "%s"
Done
2 changes: 1 addition & 1 deletion ext/session/tests/user_session_module/bug31454.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ try {
echo "Done\n";
?>
--EXPECTF--
Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
session_set_save_handler(): Argument #1 ($open) must be a valid callback, first array member is not a valid class name or object
Done
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ session_start();

?>
--EXPECTF--
Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
write: goodbye cruel world

Fatal error: Uncaught Error: Call to undefined function undefined_function() in %s:%d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ session_start();

?>
--EXPECTF--
Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
write: goodbye cruel world

Fatal error: Uncaught Exception in %s
Expand Down
2 changes: 1 addition & 1 deletion ext/session/tests/user_session_module/bug80889a.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $setHandler = ini_get('session.save_handler');
var_dump($initHandler, $setHandler);
?>
--EXPECTF--
Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in %s on line %d
string(8) "whatever"
Expand Down
2 changes: 1 addition & 1 deletion ext/session/tests/user_session_module/gh7787.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Warning: session_write_close(): Failed to write session data using user defined

Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: %S, handler: MySessionHandler::updateTimestamp) in %s on line %d

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: %S, handler: write) in %s on line %d

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bool(false)
Warning: session_module_name(): Session handler module "foo" cannot be found in %s on line %d
bool(false)

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
Read [%s,%s]
array(3) {
Expand All @@ -98,7 +98,7 @@ array(3) {
}
Starting session again..!

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
Read [%s,%s]
array(3) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ session_unset();
--EXPECTF--
*** Testing session_set_save_handler() : full handler implementation ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
string(%d) "%s"
string(4) "user"
array(1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool(false)
Warning: session_module_name(): Session handler module "foo" cannot be found in %s on line %d
bool(false)

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
Read [%s,%s]
array(3) {
Expand All @@ -85,7 +85,7 @@ array(3) {
}
Starting session again..!

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
Read [%s,%s]
array(4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ob_end_flush();
--EXPECTF--
*** Testing session_set_save_handler() : error functionality ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Fatal error: Uncaught Exception: Do something bad..! in %s:%d
Stack trace:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ ob_end_flush();
--EXPECTF--
*** Testing session_set_save_handler() : error functionality ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
session_set_save_handler(): Argument #2 ($close) must be a valid callback, function "echo" not found or invalid function name

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
session_set_save_handler(): Argument #3 ($read) must be a valid callback, function "echo" not found or invalid function name

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
session_set_save_handler(): Argument #4 ($write) must be a valid callback, function "echo" not found or invalid function name

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
session_set_save_handler(): Argument #5 ($destroy) must be a valid callback, function "echo" not found or invalid function name

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
session_set_save_handler(): Argument #6 ($gc) must be a valid callback, function "echo" not found or invalid function name

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
bool(false)
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ session_unset();
--EXPECTF--
*** Testing session_set_save_handler() function: interface ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
string(%d) "%s"
string(4) "user"
array(1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ session_start();
--EXPECTF--
*** Testing session_set_save_handler() function: interface wrong ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
bool(true)
session_set_save_handler(): Argument #1 ($open) must be of type SessionHandlerInterface, MySession2 given
good handler writing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ session_write_close();
ob_end_flush();
?>
--EXPECTF--
Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open
Create SID OLD
Read
Write
Close
New handlers:

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open
Validate ID
Read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var_dump($_SESSION);
--EXPECTF--
*** Testing session_set_save_handler() function: create_sid ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
string(32) "session_set_save_handler_sid_001"
string(4) "user"
array(1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ ob_end_flush();

?>
--EXPECTF--
Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Session callback must have a return value of type bool, array returned

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Deprecated: session_start(): Session callback must have a return value of type bool, int returned in %s on line %d

Warning: session_start(): Failed to read session data: user (%s) in %s on line %d

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Session callback must have a return value of type bool, array returned

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Deprecated: session_start(): Session callback must have a return value of type bool, int returned in %s on line %d

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ ob_end_flush();

?>
--EXPECTF--
Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Session callback must have a return value of type bool, null returned

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Session callback must have a return value of type bool, int returned
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rmdir($path);
*** Testing session_set_save_handler() : variation ***
bool(true)

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Warning: session_set_save_handler(): Session save handler cannot be changed when a session is active in %s on line %d
bool(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int(2)

Warning: session_save_path(): Session save path cannot be changed when a session is active in %s on line %d

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d

Warning: session_set_save_handler(): Session save handler cannot be changed when a session is active in %s on line %d
bool(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ rmdir($path);
--EXPECTF--
*** Testing session_set_save_handler() : variation ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
Read [%s,%s]
GC [0]
Expand All @@ -68,7 +68,7 @@ Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;]
Close [%s,PHPSESSID]
bool(true)

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
Read [%s,%s]
GC [0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ rmdir($path);
string(0) ""
*** Without lazy_write ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
bool(true)
Open [%s,PHPSESSID]
CreateID [PHPT-%d]
Expand All @@ -75,7 +75,7 @@ string(%d) "PHPT-%d"
*** With lazy_write ***
string(%d) "PHPT-%d"

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
bool(true)
Open [%s,PHPSESSID]
ValidateID [%s,PHPT-%d]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ rmdir($path);
--EXPECTF--
*** Testing session_set_save_handler() : test write short circuit ***

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
CreateID [PHPT-%s]
Read [%s,%s]
Expand All @@ -87,7 +87,7 @@ array(3) {
}
Starting session again..!

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
Read [%s,%s]
array(3) {
Expand All @@ -102,7 +102,7 @@ Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";]
Close [%s,PHPSESSID]
Starting session again..!

Deprecated: Calling session_set_save_handler() with more than 2 arguments is deprecated in %s on line %d
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
Open [%s,PHPSESSID]
Read [%s,%s]
array(4) {
Expand Down
Loading