Bug #79432 [Ver->Csd]: spl_autoload_call() with non-string argument violates assertion
| From: | nikic@php.net | Date: | Mon, 27 Apr 2020 14:22:40 +0000 |
| Subject: | Bug #79432 [Ver->Csd]: spl_autoload_call() with non-string argument violates assertion | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226802@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
+Status: Closed
Type: Bug
Package: SPL related
Operating System: *
PHP Version: master-Git-2020-03-30 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=16e9d74f078c48eb62afc97a29fa30d1969cc7fd
Log: Fixed bug #79432
Previous Comments:
------------------------------------------------------------------------
[2020-04-27 14:18:26] nikic@php.net
@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.
------------------------------------------------------------------------
[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