Greetings, Ken Brown!

> On 10/2/2022 1:16 AM, Hans Henrik Bergan wrote:
>> ... actually i forgot that the default fopen mode is "rb"
> [...]
>> changing the code to SplFileObject("bug.txt", "rb");
>> makes the code work

> I don't think you wrote what you meant.  You're not saying that explicitly
> specifying the default value changes the behavior, are you?  Maybe you meant 
> to say that the default mode is "r"?

"b" is always assumed, unless "t" is explicitly given.

I just checked and I can't get the code to work even if I manually specify the
open mode.

While Windows PHP version displays the notice as it should:

$ php -d "error_reporting=-1" -d "display_errors=stderr" -r '(new 
SplFileObject("test.txt"))->fwrite("test");'
PHP Notice:  SplFileObject::fwrite(): write of 4 bytes failed with errno=9 Bad 
file descriptor in Command line code on line 1


-- 
With best regards,
Andrey Repin
Sunday, October 2, 2022 16:49:51

Sorry for my terrible english...


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to