public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrey Repin <anrdaemon@yandex.ru>
To: Ken Brown <kbrown@cornell.edu>, cygwin@cygwin.com
Subject: Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken
Date: Sun, 2 Oct 2022 16:58:31 +0300	[thread overview]
Message-ID: <983132575.20221002165831@yandex.ru> (raw)
In-Reply-To: <31835bd3-21f9-8db5-bb9b-cd7e324364fc@cornell.edu>

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...


  reply	other threads:[~2022-10-02 14:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02  1:47 Hans Henrik Bergan
2022-10-02  5:16 ` Hans Henrik Bergan
2022-10-02  0:39   ` Ken Brown
2022-10-02 13:58     ` Andrey Repin [this message]
2022-10-02 13:49   ` Andrey Repin
2022-10-03 16:59     ` Hans Henrik Bergan
2022-10-08 17:21       ` Ken Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=983132575.20221002165831@yandex.ru \
    --to=anrdaemon@yandex.ru \
    --cc=cygwin@cygwin.com \
    --cc=kbrown@cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).