> Le 10 avr. 2023 à 14:17, G. P. B. <george.bany...@gmail.com> a écrit :
> 
> Hello Internals,
> 
> Dan and I would like to propose a new core autoloading mechanism that fixes
> some minor design issues with the current class autoloading mechanism and
> introduce a brand-new function autoloading mechanism:
> https://wiki.php.net/rfc/core-autoloading
> 

Hi,

1. The proposed modification of `function_exists()` will break existing code:

<?php
namespace foo;
if (!function_exists(__NAMESPACE__.'\\bar')) {
    function bar() {
        // ....
    }
}
?>

as soon as a `bar()` function is defined in global scope, with no obvious hint 
why it suddenly broke. You should either (from my increasing order of 
preference):

* acknowledge it in the “Backward Incompatible Changes” section;

*  default the $autoload extra parameter to `false`;

* keep the current semantics, that using a namespaced or qualified function 
name, (including a function name given as string, which is implicitly fully 
qualified), doesn’t fall back to the global scope, — even when a previous use 
of the same function name did trigger the fall back, see: 
https://3v4l.org/mnVWO (Independently of any mechanism introduced to avoid to 
repeatedly trigger the function autoloader.)


2. If you add function autoloading, you ought to support constant autoloading 
as well, of course.

—Claude

Reply via email to