From: kaspersv at privat dot dk Operating system: Windows XP Professional PHP version: 5.0.0 PHP Bug Type: Filesystem function related Bug description: fopen works differently in a constructor vs. a destructor
Description: ------------ When I run the attached code on my machine, it creates a file called testing.txt in the directory where the php-file was located, containing the line "Constructor". And another file in the apache servers root directory also called testing.txt, containing the line "Destructor". Reproduce code: --------------- <? class BugTest { function __construct() { $fp = fopen("testing.txt", "a"); fwrite($fp, "Constructor\n"); fclose($fp); } function __destruct() { $fp = fopen("testing.txt", "a"); fwrite($fp, "Destructor\n"); fclose($fp); } } $bugtest = new BugTest(); ?> Expected result: ---------------- A single file containing the two lines: Constructor Destructor -- Edit bug report at http://bugs.php.net/?id=29167&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29167&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29167&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29167&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29167&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29167&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29167&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29167&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29167&r=support Expected behavior: http://bugs.php.net/fix.php?id=29167&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29167&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29167&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29167&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29167&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29167&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29167&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29167&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29167&r=float