From: [EMAIL PROTECTED] Operating system: HP-UX 11.0 PHP version: 4.1.2 PHP Bug Type: Scripting Engine problem Bug description: when using include, __FILE__ prepends / to relative paths
Summary: when using include, __FILE__ prepends / to relative paths History: Received errors from imp3.0 saying could not find included file. Error message reported strange path names. See Horde bugs #911 and #912. Sample Code: a.php => <?php echo "Calling file ", __FILE__; echo "<br>included as lib/a.php reports "; include 'lib/a.php'; echo "<br>included as ./lib/a.php reports "; include './lib/a.php'; echo "<br>included as /www/yacc/tmp/lib/a.php reports "; include '/www/yacc/tmp/lib/a.php'; ?> lib/a.php => <?php echo __FILE__; ?> When I do this, I get Calling file /www/yacc/tmp/a.php included as lib/a.php reports /lib/a.php included as ./lib/a.php reports /lib/a.php included as /www/yacc/tmp/lib/a.php reports /www/yacc/tmp/lib/a.php Something keeps putting a leading / on relative paths! Other Tests: I created a simple C program to print out the __FILE__ value. When is compile it with HP's ANSI C compiler it works as expected i.e. the value is as specified in the include. When I compile with GNU CC compiler (gcc) the value is "sanitised". See below /home/gedl/tmp $ cc -o a a.c ./lib/b.c && echo "The output" && ./a a.c: ./lib/b.c: The output a.c ./lib/b.c /home/gedl/tmp $ gcc -o a a.c ./lib/b.c && echo "The output" && ./a The output a.c lib/b.c /home/gedl/tmp $ Essentially the same but not exactly. However both compilers give a valid answer. I will continue to work on it but if someone has an answer it would be appreciated. Cheers Ged -- Edit bug report at http://bugs.php.net/?id=16231&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16231&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16231&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16231&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16231&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16231&r=support Expected behavior: http://bugs.php.net/fix.php?id=16231&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16231&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16231&r=submittedtwice