php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61671 ext\spl\tests\fileobject_003.phpt fails
Submitted: 2012-04-08 11:48 UTC Modified: 2012-04-19 09:47 UTC
From: ab@php.net Assigned: ab (profile)
Status: Closed Package: SPL related
PHP Version: 5.3.10 OS: Windows
Private report: No CVE-ID: None
 [2012-04-08 11:48 UTC] ab@php.net
Description:
------------
Test diff:

043+
044+ Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(C:\php-sdk\php53\vc9\x86\php-src\ext\spl\tests/): failed to open stream: No such file or directory' in C:\php-sdk\php53\vc9\x86\php-src\ext\spl\tests\fileobject_003.php:18
045+ Stack trace:
046+ #0 C:\php-sdk\php53\vc9\x86\php-src\ext\spl\tests\fileobject_003.php(18): SplFileObject->__construct('C:\php-sdk\php5...')
047+ #1 C:\php-sdk\php53\vc9\x86\php-src\ext\spl\tests\fileobject_003.php(35): test('C:\php-sdk\php5...', 's', 'l')
048+ #2 {main}
049+   thrown in C:\php-sdk\php53\vc9\x86\php-src\ext\spl\tests\fileobject_003.php on line 18
043- %s(%d) "%stests/"
044- string(%d) "%stests"
045- bool(true)
046- string(5) "tests"
047- bool(true)
048- string(%d) "%sspl"
049- bool(true)
050- string(%d) "%stests"
051- string(%d) "tests"
052- string(%d) "%sspl"
053- ===2===
054- object(SplFileInfo)#%d (2) {
055-   ["pathName":"SplFileInfo":private]=>
056-   string(%d) "%s"
057-   ["fileName":"SplFileInfo":private]=>
058-   string(%d) "%s"
059- }
060- object(SplFileInfo)#%d (2) {
061-   ["pathName":"SplFileInfo":private]=>
062-   string(%d) "%s"
063-   ["fileName":"SplFileInfo":private]=>
064-   string(%d) "%s"
065- }
066- bool(false)
067- bool(true)
068- bool(true)
069- %s(%d) "%stests"
070- string(%d) "%stests"
071- bool(true)
072- string(%d) "tests"
073- bool(true)
074- string(%d) "%sspl"
075- bool(true)
076- string(%d) "%stests"
077- string(5) "tests"
078- string(%d) "%sspl"
079- ===DONE===

Expected result:
----------------
test pass

Actual result:
--------------
test fail

Patches

61671.diff (last revision 2012-04-18 14:05 UTC by ab@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-08 11:49 UTC] ab@php.net
On windows SplFileObject doesn't work as expected with directories,
because the functionality of php_stream_open_wrapper_ex can't open
dir streams on windows. Fixing this may have long range consequences
but would be rather correct instead of just fixing the test behaviour.
 [2012-04-17 10:06 UTC] ab@php.net
A simple reproduce case for this:

C:\php-sdk\php53\vc9\x86\php-src>Debug_TS\php -r "$o = new SplFileObject('C:\\php-sdk\\');"

Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(C:\php-sdk\): failed to open stream: No such file or
directory' in Command line code:1
Stack trace:
#0 Command line code(1): SplFileObject->__construct('C:\php-sdk\')
#1 {main}
  thrown in Command line code on line 1
 [2012-04-18 14:05 UTC] ab@php.net
The following patch has been added/updated:

Patch Name: 61671.diff
Revision:   1334757906
URL:        https://bugs.php.net/patch-display.php?bug=61671&patch=61671.diff&revision=1334757906
 [2012-04-18 14:07 UTC] ab@php.net
The solution was already introduced in 5.4 by Etienne Kneuss but wasn't merged back into 5.3 . SplFileObject should not be used with directories. The patch is just putting together all the necessary pieces from 5.4
 [2012-04-18 21:30 UTC] mattficken@php.net
The patch fixes the bug for me on Windows and Linux on PHP-5.3-rf3d86b3.
 [2012-04-19 09:47 UTC] ab@php.net
This bug has been fixed in SVN.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-19 09:47 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 19:01:30 2024 UTC