diff --git a/NEWS b/NEWS index 898f1b9e22f..e3f6d8d8c4a 100644 --- a/NEWS +++ b/NEWS @@ -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) diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 710b2f97ffb..715b10c456d 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -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; } diff --git a/ext/spl/tests/spl_autoload_unregister_without_registrations.phpt b/ext/spl/tests/spl_autoload_unregister_without_registrations.phpt new file mode 100644 index 00000000000..0a7ca5a1352 --- /dev/null +++ b/ext/spl/tests/spl_autoload_unregister_without_registrations.phpt @@ -0,0 +1,10 @@ +--TEST-- +spl_autoload_unregister("spl_autoload_call") without registrations +--FILE-- + +Done +--EXPECT-- +bool(true) +Done