Bug #78976 [NEW]: fputcsv and fwrite behavior changed from previous version on failure

From: Date: Tue, 17 Dec 2019 07:39:16 +0000
Subject: Bug #78976 [NEW]: fputcsv and fwrite behavior changed from previous version on failure
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224350@lists.php.net to get a copy of this message
From: nyamsprod at gmail dot com Operating system: PHP version: 7.4.0 Package: SPL related Bug Type: Bug Bug description:fputcsv and fwrite behavior changed from previous version on failure Description: ------------ The behavior of fwrite/fputcsv and SplFileObject::fwrite and SplFileObject::fputcsv have changed in PHP7.4 when used with a non writable stream. see https://3v4l.org/ifpaa Reading the changelog I fail to see where this is mention so is it the now expected behaviour from PHP7.4+ or is it a bug ? Test script: --------------- <?php $spl = new SplFileObject('php://temp', 'r'); $fh = fopen('php://temp', 'r'); var_export([ 'SplFileObject::fputcsv result on failure' => $spl->fputcsv(['foo', 'bar']), 'SplFileObject::fwrite result on failure' => $spl->fwrite('foo'), 'fputcsv result on failure' => fputcsv($fh, ['foo', 'bar']), 'fwrite result on failure' => fwrite($fh, 'foo'), ]); Expected result: ---------------- array ( 'SplFileObject::fputcsv result on failure' => 0, 'SplFileObject::fwrite result on failure' => 0, 'fputcsv result on failure' => 0, 'fwrite result on failure' => 0, ) Actual result: -------------- array ( 'SplFileObject::fputcsv result on failure' => -1, 'SplFileObject::fwrite result on failure' => false, 'fputcsv result on failure' => false, 'fwrite result on failure' => false, ) -- Edit bug report at https://bugs.php.net/bug.php?id=78976&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78976&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78976&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78976&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78976&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78976&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78976&r=support Expected behavior: https://bugs.php.net/fix.php?id=78976&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78976&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78976&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78976&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78976&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78976&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78976&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78976&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78976&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78976&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78976&r=mysqlcfg

« previous php.bugs (#224350) next »