php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46683 fopen() file name in warning is upper cased if the arguments are invalid
Submitted: 2008-11-26 10:24 UTC Modified: 2020-10-20 15:00 UTC
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ant@php.net Assigned: cmb (profile)
Status: Not a bug Package: Filesystem function related
PHP Version: 5.3CVS-2008-11-26 (snap) OS: win32 only
Private report: No CVE-ID: None
 [2008-11-26 10:24 UTC] ant@php.net
Description:
------------
The following test was ported from 5.2.X and behaves differently on 
5.3. In particular the file name in the warning message is upper 
cased for no apparent reason?

ext/standard/tests/file/fopen_variation11-win32.phpt




Reproduce code:
---------------
See the test now checked into CVS:

ext/standard/tests/file/fopen_variation11-win32.phpt



Expected result:
----------------
Warning: fopen(\\fopen_variation11.tmp): failed to open stream: 
Invalid argument in %s on line %d




Actual result:
--------------
Warning: fopen(\\FOPEN_VARIATION11.TMP): failed to open stream: 
Invalid argument in %s on line %d




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-26 18:03 UTC] ant@php.net
These tests are also now checked into 6.0.
 [2009-03-02 20:28 UTC] pajoye@php.net
Side note:

Please (PLEASE!!) try to create tests we can read. Like having an index telling which iteration we are or other similar tricks to ease the debugging. I already asked for cleaner tests many times on php-qa, without much success :)
 [2009-03-02 21:06 UTC] pajoye@php.net
UNC path begins with \\, that's why it was necessary to upper case the path.

However, why do you expect an invalid argument in this case? Here is what I get, which makes more sense (after the fix for the correct path in the error message):

018+ Warning: fopen(\\fopen_variation11.tmp): failed to open stream: No such file or directory in ext\standard\test\file\fopen_variation11-win32.php on line 52
018- Warning: fopen(\\fopen_variation11.tmp): failed to open stream: Invalid argument in %s on line %d
025+ Warning: fopen(/\fopen_variation11.tmp): failed to open stream: No such file or directory in ext\standard\tests\file\fopen_variation11-win32.php on line 52
025- Warning: fopen(\\fopen_variation11.tmp): failed to open stream: Invalid argument in %s on line %d


 [2009-03-04 12:30 UTC] ant@php.net
Yes I agree the updated error message is better than the previous 
invalid argument message. On the subject of clear tests I don't 
actually find this test too bad. The code has logic to test a bunch 
of different conditions and so requires some eye balling to 
understand. Each iteration includes the current item (see below). 

I find this approach preferable to unrolling the loop and duplicating 
the code as I think that would make the test significantly less 
maintainable.

--c:\/--
file in root

--c:\fopen11.tmpdirTwo\/--
file in fopen11.tmpdirTwo

--c:\fopen11.tmpdirTwo\--
file in fopen11.tmpdirTwo
 [2009-03-12 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-08-14 13:10 UTC] pajoye@php.net
stupid! stupid! auto no feedback.
 [2011-09-26 23:57 UTC] tyrael@php.net
is this still an issue?
 [2017-10-24 07:30 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: pajoye +Assigned To:
 [2020-10-20 15:00 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-10-20 15:00 UTC] cmb@php.net
> UNC path begins with \\, that's why it was necessary to upper
> case the path.

Indeed.  And although the test apparently didn't intend to test
that UNC path (but rather an absolute path from the root of the
current drive), I think we can leave that now as is.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC