php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46688 Return values differ from 5.3 and are also inconsistent
Submitted: 2008-11-26 17:56 UTC Modified: 2010-06-21 02:14 UTC
From: ant@php.net Assigned:
Status: Wont fix Package: Filesystem function related
PHP Version: 6CVS-2008-11-26 (snap) OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-11-26 17:56 UTC] ant@php.net
Description:
------------
The following tests were all ported from 5.3 and behave differently 
on 6.0. There are two issues with the test results. Firstly, they 
return different values from 5.3 - this may not be a problem if 6.0 
is actually making them more consistent.

However within a given function some invalid arguments return 
bool(false) and other examples return NULL. Perhaps we should be 
consistent and always return one or the other? It would make 
documenting the function easier anyway [:o)

ext/standard/tests/file/007_error.phpt
ext/standard/tests/file/fgetc_variation2.phpt
ext/standard/tests/file/fgets_error.phpt
ext/standard/tests/file/fgets_variation2.phpt
ext/standard/tests/file/fpassthru_error.phpt
ext/standard/tests/file/fpassthru_variation1.phpt
ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
ext/standard/tests/file/fseek_variation1.phpt
ext/standard/tests/file/fseek_variation2.phpt
ext/standard/tests/file/fread_error.phpt
ext/standard/tests/file/fwrite_error.phpt
ext/standard/tests/file/pclose_variation1.phpt
ext/standard/tests/file/umask_variation3





Reproduce code:
---------------
Here is an example using fopen() - notice the different return values:

*** Testing error conditions for fopen(), fclsoe() & feof() ***
	
Warning: fopen() expects at least 2 parameters, 1 given in %s on line %d
bool(false)
	
Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d
bool(false)
	
Warning: fclose(): %d is not a valid stream resource in %s on line %d
bool(false)
	
Warning: fclose() expects parameter 1 to be resource, Unicode string given in %s on line %d
NULL
	
Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d
NULL




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-26 17:57 UTC] ant@php.net
These have all been marked with an XFAIL section...
 [2010-06-21 02:14 UTC] felipe@php.net
-Status: Open +Status: Wont fix
 [2010-06-21 02:14 UTC] felipe@php.net
Old trunk related.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC