note 87296 added to function.eval
| From: | php at stock-consulting dot com | Date: | Fri, 28 Nov 2008 16:16:09 +0000 |
| Subject: | note 87296 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-147070@lists.php.net to get a copy of this message | ||
Magic constants like __FILE__ may not return what you expect if used inside eval()'d code.
Instead, it'll answer something like "c:\directory\filename.php(123) : eval()'d
code" (under Windows, obviously, checked with PHP5.2.6) - which can still be processed with a
function like preg_replace to receive the filename of the file containing the eval().
Example:
$filename = preg_replace('@\(.*\(.*$@', '', __FILE__);
echo $filename;
----
Server IP: 217.160.72.57
Probable Submitter: 80.134.28.80
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- https://master.php.net/note/edit/87296
Del: integrated -- https://master.php.net/note/delete/87296/integrated
Del: useless -- https://master.php.net/note/delete/87296/useless
Del: bad code -- https://master.php.net/note/delete/87296/bad+code
Del: spam -- https://master.php.net/note/delete/87296/spam
Del: non-english -- https://master.php.net/note/delete/87296/non-english
Del: in docs -- https://master.php.net/note/delete/87296/in+docs
Del: other reasons-- https://master.php.net/note/delete/87296
Reject -- https://master.php.net/note/reject/87296
Search -- https://master.php.net/manage/user-notes.php