Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken

2022-10-08 Thread Ken Brown
On 10/3/2022 12:59 PM, Hans Henrik Bergan wrote: @Ken Brown 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"? sorry about that, i meant "ab" makes the

Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken

2022-10-03 Thread Hans Henrik Bergan
@Ken Brown >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"? sorry about that, i meant "ab" makes the code work. @Andrey Repin >php -d

Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken

2022-10-02 Thread Andrey Repin
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

Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken

2022-10-02 Thread Andrey Repin
Greetings, Hans Henrik Bergan! > ... actually i forgot that the default fopen mode is "rb" ... anyhow, here > is what's supposed to happen: > $ touch bug.txt; chmod 0777 bug.txt; php -r '$o=new > SplFileObject("bug.txt");var_dump($o->fwrite("test"));var_dump(error_get_last());' > PHP Notice:

Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken

2022-10-01 Thread 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

Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken

2022-10-01 Thread Hans Henrik Bergan
... actually i forgot that the default fopen mode is "rb" ... anyhow, here is what's supposed to happen: $ touch bug.txt; chmod 0777 bug.txt; php -r '$o=new SplFileObject("bug.txt");var_dump($o->fwrite("test"));var_dump(error_get_last());' PHP Notice: SplFileObject::fwrite(): Write of 4 bytes

Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken

2022-10-01 Thread Hans Henrik Bergan
running PHP 7.3.7 in Cygwin 3.3.6, and SplFileObject::fwrite seems completely broken. to reproduce: $ touch bug.txt; chmod 0777 bug.txt; php -r '$o=new SplFileObject("bug.txt");var_dump($o->fwrite("test"));var_dump(error_get_last());' int(0) NULL so both fwrite() and error_get_last() failed to