1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Add missing NULL checks for spl autoload table

Closes GH-12840.
This commit is contained in:
Niels Dossche
2023-11-30 20:27:07 +01:00
parent bedf1083f3
commit 9a69bb2d58
3 changed files with 15 additions and 2 deletions

1
NEWS
View File

@@ -9,6 +9,7 @@ PHP NEWS
php_message_handler_for_zend). (ilutov)
. Fixed bug GH-12758 / GH-12768 (Invalid opline in OOM handlers within
ZEND_FUNC_GET_ARGS and ZEND_BIND_STATIC). (Florian Engelhardt)
. Fix various missing NULL checks. (nielsdos, dstogov)
- Date:
. Fixed improbably integer overflow while parsing really large (or small)

View File

@@ -585,8 +585,10 @@ PHP_FUNCTION(spl_autoload_unregister)
if (fcc.function_handler && zend_string_equals_literal(
fcc.function_handler->common.function_name, "spl_autoload_call")) {
/* Don't destroy the hash table, as we might be iterating over it right now. */
zend_hash_clean(spl_autoload_functions);
if (spl_autoload_functions) {
/* Don't destroy the hash table, as we might be iterating over it right now. */
zend_hash_clean(spl_autoload_functions);
}
RETURN_TRUE;
}

View File

@@ -0,0 +1,10 @@
--TEST--
spl_autoload_unregister("spl_autoload_call") without registrations
--FILE--
<?php
var_dump(spl_autoload_unregister("spl_autoload_call"));
?>
Done
--EXPECT--
bool(true)
Done