Bug #79432 [Ver]: spl_autoload_call() with non-string argument violates assertion

From: Date: Mon, 27 Apr 2020 14:18:26 +0000
Subject: Bug #79432 [Ver]: spl_autoload_call() with non-string argument violates assertion
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226801@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79432&edit=1 ID: 79432 Updated by: nikic@php.net Reported by: wxhusst at gmail dot com Summary: spl_autoload_call() with non-string argument violates assertion Status: Verified Type: Bug Package: SPL related Operating System: * PHP Version: master-Git-2020-03-30 (Git) Block user comment: N Private report: N New Comment: @laruence: Throwing in autoloader is fine in general, you just shouldn't throw if the class has not been found. But things like "loaded file has syntax error" or "passed argument is not a string" can still throw. Previous Comments: ------------------------------------------------------------------------ [2020-04-27 04:46:52] laruence@php.net according to PSR-4, autoload function should never throw exception, so I think the RETURN_THROW should be fixed instead. ------------------------------------------------------------------------ [2020-03-30 08:24:42] nikic@php.net We should move the string check into zpp, yes. The internal autoloading mechanism is always going to pass a string, so there seems to be no reason to silently ignore non-strings. ------------------------------------------------------------------------ [2020-03-30 08:19:28] cmb@php.net Shouldn't we throw if the argument is not a string? <https://github.com/php/php-src/blob/6b6f0d63f3d4f3bfa51ed8b1358dc013acda45cf/ext/spl/php_spl.c#L400> <https://github.com/php/php-src/blob/6b6f0d63f3d4f3bfa51ed8b1358dc013acda45cf/ext/spl/php_spl.stub.php#L11> ------------------------------------------------------------------------ [2020-03-30 07:11:08] wxhusst at gmail dot com Description: ------------ /mnt/d/work/fuzz/php-src/ext/spl/php_spl.c:401: void zif_spl_autoload_call(zend_execute_data *, zval *): Assertion `(executor_globals.exception)' failed. Test script: --------------- <?php $a = NULL; $b = spl_autoload_call($a,); ?> Expected result: ---------------- normal Actual result: -------------- assert crash ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79432&edit=1

« previous php.bugs (#226801) next »