Bug #79114 [NEW]: Eval class during preload causes class to be only half available

From: Date: Tue, 14 Jan 2020 11:50:58 +0000
Subject: Bug #79114 [NEW]: Eval class during preload causes class to be only half available
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224896@lists.php.net to get a copy of this message
From: beberlei Operating system: Linux PHP version: 7.4.1 Package: opcache Bug Type: Bug Bug description:Eval class during preload causes class to be only half available 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 -- Edit bug report at https://bugs.php.net/bug.php?id=79114&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79114&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79114&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79114&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79114&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79114&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79114&r=support Expected behavior: https://bugs.php.net/fix.php?id=79114&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79114&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79114&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79114&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79114&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79114&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79114&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79114&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79114&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79114&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79114&r=mysqlcfg

« previous php.bugs (#224896) next »