|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-01-17 11:36 UTC] nikic@php.net
-Status: Open
+Status: Verified
[2020-01-20 04:29 UTC] laruence@php.net
[2020-01-20 04:29 UTC] laruence@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 16:00:01 2025 UTC |
Description: ------------ IF you eval a class during preload, you cannot instantiate it, but you can extend from it and class_parents shows its as parent. Test script: --------------- // index.php <?php var_dump(class_exists(Foo::class)); var_dump(class_exists(Bar::class)); ini_set('display_errors', true); var_dump(new Bar()); var_dump(class_parents('Bar')); var_dump(new Foo()); // preload.php <?php eval("class Foo {}"); class Bar extends Foo { } Expected result: ---------------- bool(false) bool(true) object(Bar)#1 (0) { } array(1) { ["Foo"]=> string(3) "Foo" } object(Foo)#2 (0) { } Actual result: -------------- bool(false) bool(true) object(Bar)#1 (0) { } array(1) { ["Foo"]=> string(3) "Foo" } Fatal error: Uncaught Error: Class 'Foo' not found in /var/www/preload/index.php:10 Stack trace: #0 /home/benny/.symfony/php/a37c6f52bd8b76a9d0374711bf78143b455254a2-router.php(29): require() #1 {main} thrown in /var/www/preload/index.php on line 10