Re: com web/qa: replaced dirname(__FILE__) with __DIR__: write-test.php
| From: | Bob Lerner | Date: | Tue, 31 Jan 2017 19:42:40 +0000 |
| Subject: | Re: com web/qa: replaced dirname(__FILE__) with __DIR__: write-test.php | ||
| References: | 1 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-67900@lists.php.net to get a copy of this message | ||
Cash me ousside, howbowdah?
On Jan 31, 2017 1:40 PM, "Maciej Sobaczewski" <sobak@php.net> wrote:
> 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--
> <?php
> - $temp_filename = dirname(__FILE__)."/fred.tmp";
> + $temp_filename = __DIR__."/fred.tmp";
> $fp = fopen($temp_filename, "w");
> fwrite ($fp, "Hello Boys!\n");
> fclose($fp);
> ?>
> --CLEAN--
> <?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
>
>
> --
> PHP Quality Assurance Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>