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
@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
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
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:
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
... 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
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
7 matches
Mail list logo