[php-src] Issue #22282: spl: class_* functions should ignore leading slash in class name in non-autoload mode

From: Date: Thu, 11 Jun 2026 23:22:06 +0000
Subject: [php-src] Issue #22282: spl: class_* functions should ignore leading slash in class name in non-autoload mode
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252183@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/22282 Author: jorgsowa ### Description The following code: ```php <?php interface Iface {} trait Tr {} class ParentC implements Iface {} class ChildC extends ParentC { use Tr; } var_dump(class_parents('\ChildC', false)); var_dump(class_parents('\ChildC')); var_dump(class_implements('\ParentC', false)); var_dump(class_uses('\ChildC', false)); ``` Resulted in this output: ``` Warning: class_parents(): Class \ChildC does not exist in /in/T5JUQ on line 11 bool(false) array(1) { ["ParentC"]=> string(7) "ParentC" } Warning: class_implements(): Class \ParentC does not exist in /in/T5JUQ on line 13 bool(false) Warning: class_uses(): Class \ChildC does not exist in /in/T5JUQ on line 14 bool(false) ``` But I expected this output instead: ``` array(1) { ["ParentC"]=> string(7) "ParentC" } array(1) { ["ParentC"]=> string(7) "ParentC" } array(1) { ["Iface"]=> string(5) "Iface" } array(1) { ["Tr"]=> string(2) "Tr" } ``` ### PHP Version ```plain master ``` ### Operating System _No response_

« previous php.bugs (#252183) next »