[php-src] Issue #13756: appending function using spl_autoload_register() is not working, it is still prepending
| From: | alfahadi | Date: | Tue, 19 Mar 2024 10:40:26 +0000 |
| Subject: | [php-src] Issue #13756: appending function using spl_autoload_register() is not working, it is still prepending | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246614@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13756
Author: alfahadi
### Description
The following code:
```php
<?php
function printClassName($className)
{
echo "{$className}" . PHP_EOL;
}
spl_autoload_register(callback: "printClassName", prepend: false);
var_dump(spl_autoload_functions());
?>
```
Resulted in this output:
```
array(2) {
[0]=>
string(14) "printClassName"
[1]=>
string(12) "spl_autoload"
}
```
But I expected this output instead:
```
array(2) {
[0]=>
string(12) "spl_autoload"
[1]=>
string(14) "printClassName"
}
```
Even when instantiating any class, i.e., $var = new A();, the order of calling back the auto-loaded
functions is still the same. The parameter "prepend" of the function
spl_autoload_register() seems to have no effect.
### PHP Version
PHP 8.3.3
### Operating System
Debian 12 (bookworm)