Bug #74879 [NEW]: Wrong path returned by ReflectionClass::getFileName

From: Date: Fri, 07 Jul 2017 23:13:57 +0000
Subject: Bug #74879 [NEW]: Wrong path returned by ReflectionClass::getFileName
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209913@lists.php.net to get a copy of this message
From: waldermort at gmail dot com Operating system: Linux PHP version: 7.1.7 Package: Reflection related Bug Type: Bug Bug description:Wrong path returned by ReflectionClass::getFileName Description: ------------ When a StreamWrapper is used in combination with the ReflectionClass API, the scheme is stripped from the path returned by getFileName(). For example: If a create an in-memory file at 'vfs:://foo/bar.php' which contains valid PHP code (something like '<?php namespace Suite { class Test {} }'). I can include or exec the file and create an instance of the class. Note, this is done as part of a test suite for a package which generates PHP classes from templates. So: include 'vfs:://foo/bar.php'; $inst = new Suite\Test(); $refl = new \ReflectionClass($inst); I would now expect $refl->getFileName() to return 'vfs:://foo/bar.php', but it actually returns '/foo/bar.php'. If this is the intended behaviour, perhaps the docs could be updated to mention it. -- Edit bug report at https://bugs.php.net/bug.php?id=74879&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74879&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74879&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74879&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74879&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74879&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74879&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74879&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74879&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74879&r=support Expected behavior: https://bugs.php.net/fix.php?id=74879&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74879&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74879&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74879&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74879&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74879&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74879&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74879&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74879&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74879&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74879&r=mysqlcfg

« previous php.bugs (#209913) next »