php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38276 file_exists works incorrectly with long filenames
Submitted: 2006-07-31 21:32 UTC Modified: 2006-08-05 17:15 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bjoernhaeuser at googlemail dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.2. (latest) OS: Windows
Private report: No CVE-ID: None
 [2006-07-31 21:32 UTC] bjoernhaeuser at googlemail dot com
Description:
------------
Hey Guys!

Relating to: http://bugs.php.net/bug.php?id=31347
This Bug seems to be not fixed.

Reproduce code:
---------------
D:\>php -r "var_dump(file_exists(str_repeat('a', 10000)));"
D:\>php -r "var_dump(file_exists(str_repeat('a', 255)));"


Expected result:
----------------
file_exists should return false in both cases.

Actual result:
--------------
D:\>php -r "var_dump(file_exists(str_repeat('a', 10000)));"
bool(true)

D:\>php -r "var_dump(file_exists(str_repeat('a', 255)));"
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-31 21:42 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-08-03 13:56 UTC] bjoernhaeuser at googlemail dot com
Sorry for my late answer.

I am getting this with the latest snapshot: 

D:\php5.2-win32-latest>php -v
PHP 5.2.0RC2-dev (cli) (built: Aug  3 2006 12:21:14)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

D:\php5.2-win32-latest>php -r "var_dump(file_exists(str_repeat('a', 10000)));"
bool(true)

D:\php5.2-win32-latest>php -r "var_dump(file_exists(str_repeat('a', 255)));"
bool(true)

file_exists works here totally incorrect.

Yours sincerely
 [2006-08-03 14:06 UTC] bjoernhaeuser at googlemail dot com
I have just checked some more and found this: 

D:\php5.2-win32-latest>php -r "var_dump(file_exists(str_repeat('a', 236)));"
bool(false)

D:\php5.2-win32-latest>php -r "var_dump(file_exists(str_repeat('a', 237)));"
bool(true)

file_exists works here incorrectly with filenames > 236

Yours sincerely
 [2006-08-03 14:18 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2006-08-04 13:49 UTC] bjoernhaeuser at googlemail dot com
Well I am getting this: 

D:\php5.2-cvs>php -v
PHP 5.2.0RC2-dev (cli) (built: Aug  4 2006 12:21:08)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies


D:\php5.2-cvs>php -r "var_dump(file_exists(str_repeat('a', 246)));"
bool(true)

D:\php5.2-cvs>php -r "var_dump(file_exists(str_repeat('a', 245)));"
bool(false)


So, its not fixed.
 [2006-08-04 15:05 UTC] tony2001@php.net
Does 4.4.3 work for you?
 [2006-08-04 17:20 UTC] bjoernhaeuser at googlemail dot com
D:\php4.3\cli>php -r "var_dump(file_exists(str_repeat('a', 260)));"

Warning: file_exists(): Stat failed for aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (errno=0 - No error
) in Command line code on line 1
bool(false)

D:\php4.3\cli>php -r "var_dump(file_exists(str_repeat('a', 255)));"
bool(false)

Works 'correctly' for me.
 [2006-08-05 13:19 UTC] tony2001@php.net
Please try next Win32 snapshot, it should work fine.
 [2006-08-05 17:15 UTC] bjoernhaeuser at googlemail dot com
Yes works.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC