[php-src] PHP-8.3: Merge branch 'PHP-8.2' into PHP-8.3

From: Date: Wed, 13 Mar 2024 17:16:24 +0000
Subject: [php-src] PHP-8.3: Merge branch 'PHP-8.2' into PHP-8.3
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-127716@lists.php.net to get a copy of this message
Author: Niels Dossche (nielsdos) Date: 2024-03-13T17:49:31+01:00 Commit: https://github.com/php/php-src/commit/b58dc6fd1a827c2e57fe2b34a70b0c6e68802b73 Raw diff: https://github.com/php/php-src/commit/b58dc6fd1a827c2e57fe2b34a70b0c6e68802b73.diff Merge branch 'PHP-8.2' into PHP-8.3 * PHP-8.2: Fix GH-13680: Segfault with session_decode and compilation error Changed paths: A ext/session/tests/gh13680.phpt M NEWS M ext/session/session.c Diff: diff --git a/NEWS b/NEWS index 625a148549c06..004fd30e233cb 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,10 @@ PHP NEWS . Fixed bug GH-13544 (Pre-PHP 8.2 compatibility for mt_srand with unknown modes). (timwolla) +- Session: + . Fixed bug GH-13680 (Segfault with session_decode and compilation error). + (nielsdos) + - Standard: . Fixed bug GH-11808 (Live filesystem modified by tests). (nielsdos) . Fixed GH-13402 (Added validation of \n in $additional_headers of mail()). diff --git a/ext/session/session.c b/ext/session/session.c index 0c869b7e57d82..fe1095189d456 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -271,16 +271,17 @@ static zend_result php_session_decode(zend_string *data) /* {{{ */ php_error_docref(NULL, E_WARNING, "Unknown session.serialize_handler. Failed to decode session object"); return FAILURE; } + zend_result result = SUCCESS; zend_try { if (PS(serializer)->decode(ZSTR_VAL(data), ZSTR_LEN(data)) == FAILURE) { php_session_cancel_decode(); - return FAILURE; + result = FAILURE; } } zend_catch { php_session_cancel_decode(); zend_bailout(); } zend_end_try(); - return SUCCESS; + return result; } /* }}} */ diff --git a/ext/session/tests/gh13680.phpt b/ext/session/tests/gh13680.phpt new file mode 100644 index 0000000000000..a95583ee34598 --- /dev/null +++ b/ext/session/tests/gh13680.phpt @@ -0,0 +1,25 @@ +--TEST-- +GH-13680 (Segfault with session_decode and compilation error) +--EXTENSIONS-- +session +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +session.use_cookies=0 +session.use_strict_mode=0 +session.cache_limiter= +session.serialize_handler=php_serialize +session.save_handler=files +error_reporting=E_ALL +--FILE-- +<?php +session_start(); +session_decode('foo'); +class Test extends DateTime { + public static function createFromFormat($format, $datetime, $timezone = null): Wrong {} +} +?> +--EXPECTF-- +Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d + +Fatal error: Could not check compatibility between Test::createFromFormat($format, $datetime, $timezone = null): Wrong and DateTime::createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = null): DateTime|false, because class Wrong is not available in %s on line %d

« previous php.cvs (#127716) next »