From: php at trancer dot nl Operating system: Debian Linux PHP version: 4.3.3 PHP Bug Type: Output Control Bug description: ob_start callback function changes cwd
Description: ------------ A script that does file_get_contents or file in the callback function of ob_start wont work. The file_get_contents function cant open the file. <?php // Ob callback function ob($buffer) { return file_get_contents('open.txt'); } ob_start('ob'); ?> The behaviour is so because the callback sets its cwd to the root of the disk instead of the folder the script was called from. If I copy the file I want to open to my root it can open, otherwise it will throw me this error. Warning: file_get_contents(open.txt): failed to open stream: No such file or directory in /var/www/test.php on line 6 Specifying the full path works. Could be a possible bug in the callback, otherwise a documentation problem because I was unable to find it anywhere in the docs. Reproduce code: --------------- <?php // Ob callback function ob($buffer) { return file_get_contents('open.txt'); } ob_start('ob'); ?> Expected result: ---------------- The content of open.txt Actual result: -------------- Warning: file_get_contents(open.txt): failed to open stream: No such file or directory in /var/www/test.php on line 6 -- Edit bug report at http://bugs.php.net/?id=26073&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26073&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26073&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26073&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26073&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26073&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26073&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26073&r=support Expected behavior: http://bugs.php.net/fix.php?id=26073&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26073&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26073&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26073&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26073&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26073&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26073&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26073&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26073&r=float