Bug #75836 [Opn]: fwrite() should accept null for chunk size

From: Date: Thu, 18 Jan 2018 20:09:34 +0000
Subject: Bug #75836 [Opn]: fwrite() should accept null for chunk size
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213609@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75836&edit=1 ID: 75836 Updated by: kelunik@php.net Reported by: kelunik@php.net Summary: fwrite() should accept null for chunk size Status: Open Type: Bug Package: Streams related PHP Version: 7.2.1 Block user comment: N Private report: N New Comment: How would that be a BC break? Previous Comments: ------------------------------------------------------------------------ [2018-01-18 17:13:52] cmb@php.net > fwrite() should accept null for chunk size That would constitute a BC break, though. > for an example where this is annoying. $written = @\fwrite($stream, $data, $chunkSize ?: $length); ------------------------------------------------------------------------ [2018-01-17 18:57:25] daverandom@php.net Additional filesystem functions that have the same or similar problems: Optional $context arg emits warning when explicit NULL is passed to all of: copy(), mkdir(), rename(), rmdir(), unlink() fgetss(), fgets() - NULL passed to $length is cast to int(0), emits warning file_get_contents() - NULL passed to $maxlen results in empty string returned ------------------------------------------------------------------------ [2018-01-17 16:48:47] kelunik@php.net Description: ------------ This is a follow-up of bug #74719, which didn't address fwrite(). See https://github.com/amphp/byte-stream/blob/1b0b8daed484b070a9ee329ba78675288d291558/lib/ResourceOutputStream.php#L69-L74 for an example where this is annoying. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75836&edit=1

« previous php.bugs (#213609) next »