|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 01:00:02 2025 UTC |
Description: ------------ There should be a way to check if reflected code (object, function, etc.) is from a result of eval or not. For example; <?php $o = eval('class Foo { } return new Foo;'); $r = new ReflectionObject($o); if($r->isUserDefined()) { $file = $r->getFilename(); // do something with $file } ?> We cannot assume $file will contain a valid file path as it returns something like "/file.php:(2) eval()'d code" (rather than false imho). Adding ReflectionObject::isSynthetic() or isEval() would be a nice feature. Please consider to return false in getFilename() for eval'd as well so "getFilename() !== false" indicates a true user defined object.