Bug #60391 [NEW]: fputcsv() returns NULL if first argument is not resource
| From: | ninzya at inbox dot lv | Date: | Sat, 26 Nov 2011 08:00:46 +0000 |
| Subject: | Bug #60391 [NEW]: fputcsv() returns NULL if first argument is not resource | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-7471@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 7
PHP version: 5.4.0RC2
Package: Documentation problem
Bug Type: Bug
Bug description:fputcsv() returns NULL if first argument is not resource
Description:
------------
PHP documentation on fputcsv()
[http://www.php.net/manual/en/function.fputcsv.php]
says (quote):
"Returns the length of the written string or FALSE on failure".
This is not true if fputcsv() gets a non-resource variable as it's first
argument.
In this case it returns NULL.
Test script:
---------------
$arg =true;
//$arg =false;
//$arg =1;
//$arg =null;
//$arg =array();
//$arg =new stdClass;
var_dump( fputcsv( $arg, array( 'x', 'y', 'z')));
Expected result:
----------------
bool(false)
Actual result:
--------------
NULL
--
Edit bug report at https://bugs.php.net/bug.php?id=60391&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60391&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60391&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60391&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=60391&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60391&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=60391&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=60391&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=60391&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=60391&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=60391&r=support
Expected behavior: https://bugs.php.net/fix.php?id=60391&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=60391&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=60391&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=60391&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60391&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60391&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=60391&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=60391&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=60391&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=60391&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=60391&r=mysqlcfg