Bug #76980 [Com]: Interface gets skipped if autoloader throws an exception

From: Date: Fri, 12 Jul 2019 14:44:59 +0000
Subject: Bug #76980 [Com]: Interface gets skipped if autoloader throws an exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221720@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76980&edit=1

 ID:                 76980
 Comment by:         pierre dot rineau at makina-corpus dot com
 Reported by:        martin at auswoeger dot com
 Summary:            Interface gets skipped if autoloader throws an
                     exception
 Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 PHP Version:        7.2.10
 Block user comment: N
 Private report:     N

 New Comment:

Is that possible that this issue resolution created some regressions ? I'm working with a
Symfony application, and since the php 7.2.19 -> 7.2.20 upgrade (on CentOS 7, using Remi
repository) Symfony cannot catch \ReflexionException anymore.

I'm trying to reproduce it with a simpler use case, I'll come back at you if I succeed in
reproducing it.


Previous Comments:
------------------------------------------------------------------------
[2019-07-09 09:07:21] nikic@php.net

Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=22ed362810c1b3a5ecb54ebd1d50d804c7fc3159
Log: Revert "Fixed bug #76980"

------------------------------------------------------------------------
[2019-05-15 10:50:27] nikic@php.net

Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=35353dc49a73a58c17c7896c4c4c3997ef2c007d
Log: Fixed bug #76980

------------------------------------------------------------------------
[2018-10-09 12:13:51] cmb@php.net

For reference: <https://3v4l.org/s8ti7>

------------------------------------------------------------------------
[2018-10-07 01:28:09] a at b dot c dot de

Allowing the creation of class Foo to go ahead even if its interface failed to autoload would also
bite users who use type declarations in function signatures.

<?php
function dowithfoo(Foointerface $foo)
{
	return;
}

dowithfoo(new Foo());
?>

------------------------------------------------------------------------
[2018-10-06 22:24:14] martin at auswoeger dot com

A partial loaded class is very confusing I think. Most developers probably wouldn’t expect that
a class can be loaded without its interfaces.

> What's the expected *behavior* here?

If you change the above test script from implements to extends it behaves
as I would expect it.

There is also a Symfony bug report that shows a real world use case where this behavior was
unexpected and causes issues: <https://github.com/symfony/symfony/issues/28748>

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=76980


--
Edit this bug report at https://bugs.php.net/bug.php?id=76980&edit=1


Thread (10 messages)

« previous php.bugs (#221720) next »