Bug #52339 [ReO]: SPL autoloader breaks class_exists()

From: Date: Tue, 08 Sep 2015 20:14:52 +0000
Subject: Bug #52339 [ReO]: SPL autoloader breaks class_exists()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195886@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=52339&edit=1

 ID:                 52339
 Updated by:         cmb@php.net
 Reported by:        dangerous dot ben at gmail dot com
 Summary:            SPL autoloader breaks class_exists()
 Status:             Re-Opened
 Type:               Bug
 Package:            SPL related
 Operating System:   any (debian)
 PHP Version:        5.3.3RC2
 Block user comment: N
 Private report:     N

 New Comment:

> My understanding of the underlying code is that it generates an
> error in this case. Perhaps it should generate an exception,
> which can be caught an handled.

The code already throws an exception, see <https://3v4l.org/AaURG>.


Previous Comments:
------------------------------------------------------------------------
[2014-10-13 10:33:31] aden at fraserjilani dot com

v5.5.9 - still broken.

------------------------------------------------------------------------
[2014-10-08 06:51:01] john dot fragkoulis at gmail dot com

v5.5.3 still broken

------------------------------------------------------------------------
[2014-01-13 12:34:02] matthew dot bonner at gmail dot com

Still broke in 5.4 and 5.5 3 years on!

------------------------------------------------------------------------
[2013-01-17 13:41:30] php at maisqi dot com

This is clearly a bug. We're testing if a class exists not asserting it.
There's seam to be a patch for this. Any chance it will be accepted?

------------------------------------------------------------------------
[2012-11-24 20:29:04] ciantic at oksidi dot com

Is this bug still happening in PHP5.4 and greater? I'm using 5.3.8.

If one uses class_exists it should never throw error, only true or false. It makes 
no sense otherwise. This is one of those where setting of some other application 
can totally broke functionality elsewhere. Should everyone using class_exists 
catch try LogicException too? I'd argue not.

Though the workaround (empty function for spl) is kind of nice, as dangerous dot 
ben mentioned.

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


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=52339


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


Thread (18 messages)

« previous php.bugs (#195886) next »