Re: function autoloading v4 RFC

From: Date: Sat, 17 Aug 2024 21:33:03 +0000
Subject: Re: function autoloading v4 RFC
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-125032@lists.php.net to get a copy of this message
On Fri, Aug 16, 2024, at 02:22, Stephen Reay wrote: > > Sent from my iPhone > > > On 16 Aug 2024, at 04:45, Rob Landers <rob@bottled.codes> wrote: > > > > Userland functions don't throw that error, so it shouldn't be an issue. (You can > > pass as many arguments as you want to a userland function, as long as there are enough of them). > > Hi Rob, > > I didn't mean the actual internal error about too many args I meant the concept - > it's possible a userland autoloader callback has some signature other than a single string > parameter. > > I don't know if that happens in the wild or if that's considered a BC or not but > there is a hypothetical case there where old code would stop working. > > Cheers > > Stephen > I wouldn't consider it a BC break, no. But (ironically?), Symfony crashes with this change. It really shouldn't but if you take a look at https://github.com/symfony/symfony/blob/7.2/src/Symfony/Component/Config/Resource/ClassExistenceResource.php#L70 and it's definition in https://github..com/symfony/symfony/blob/7.2/src/Symfony/Component/Config/Resource/ClassExistenceResource.php#L142, you'll see that they define a function that accepts two parameters. It crashes when it receives a second parameter of int instead of it's expected exception. I've opened a drive-by PR as an attempt to fix it (https://github.com/symfony/symfony/pull/58030), but I suspect there will be other projects as well that do something silly like that. They'll just have to fix it. — Rob

« previous php.internals (#125032) next »