note 49576 deleted from language.oop5.autoload by cmb
| From: | cmb@php.net | Date: | Tue, 05 Nov 2019 14:46:15 +0000 |
| Subject: | note 49576 deleted from language.oop5.autoload by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212939@lists.php.net to get a copy of this message | ||
Note Submitter: trini0
----
Be careful with using that eval() trick within __autoload().
If you use reflection in your code, the so called trick,
*can* provide ill side effects.
For example ->
$reflection = new reflectionClass('some_class');
if (FALSE === $reflection->isSubClassOf('another_class'))
{
throw new Exception('Class "some_class" must extend base class
"another_class"');
}
If the real class "another_class" doesnt exist at the time, or "some_class"
doesn't extend "another_class", with the reflection test, the so called eval() trick,
creates a dummy "another_class",
thereby making the reflection test useless...