com web/qa: replaced dirname(__FILE__) with _ _DIR__: write-test.php

From: Date: Wed, 03 Jun 2015 21:22:44 +0000
Subject: com web/qa: replaced dirname(__FILE__) with _ _DIR__: write-test.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-67899@lists.php.net to get a copy of this message
Commit: e368e2edef21508710abf42e1218e5fc49745315 Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 3 Jun 2015 23:22:44 +0200 Parents: 72f5379bac614556882982abc2ba14145f25129d Branches: master Link: http://git.php.net/?p=web/qa.git;a=commitdiff;h=e368e2edef21508710abf42e1218e5fc49745315 Log: replaced dirname(__FILE__) with __DIR__ Changed paths: M write-test.php Diff: diff --git a/write-test.php b/write-test.php index d681ac4..9d8826a 100644 --- a/write-test.php +++ b/write-test.php @@ -422,19 +422,19 @@ Will fail to clean up This will remove temporary files --FILE-- &lt;?php - $temp_filename = dirname(__FILE__)."/fred.tmp"; + $temp_filename = __DIR__."/fred.tmp"; $fp = fopen($temp_filename, "w"); fwrite ($fp, "Hello Boys!\n"); fclose($fp); ?&gt; --CLEAN-- &lt;?php - $temp_filename = dirname(__FILE__)."/fred.tmp"; + $temp_filename = __DIR__."/fred.tmp"; unlink($temp_filename); ?> --EXPECT-- </pre> -<p> Note the use of the dirname(__FILE__) construct which will ensure that the temporary file is created in the same directory as +<p> Note the use of the __DIR__ construct which will ensure that the temporary file is created in the same directory as the phpt test script. </p> <p> When creating temporary files it is a good idea to use an extension that indicates the use of the file, eg .tmp. It's also a good

« previous php.qa (#67899) next »