delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/10/02/10:06:26

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC7973858D32
Authentication-Results: sourceware.org;
dmarc=pass (p=none dis=none) header.from=yandex.ru
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru
X-Yandex-Fwd: 1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
t=1664719502; bh=McbjAlRjcrmRGIy1a9j8go+reDKbPkn6lFewt1+GTwo=;
h=In-Reply-To:Subject:Date:References:To:Message-ID:Reply-To:From;
b=Iv4vm7v0Jy/SNAAKoFPPxe/bWwu/PfMJKjqschSVIQruyNn1b7uVvjtJGTBkrBPei
I+nx3OI4x6Zwp2LPstjO7xL7GdHbFVIPe8isPdl8fsQN5WuTeSeLQnlPiFLWacqTrI
tR2j4M+t/c9WH2r3icxc23ZfrNCU3l/E9NZpV8/s=
Authentication-Results: sas2-e7f6fb703652.qloud-c.yandex.net;
dkim=pass header.i=@yandex.ru
Date: Sun, 2 Oct 2022 16:58:31 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
X-Mailer: The Bat! (v9.3.4) Professional
Message-ID: <983132575.20221002165831@yandex.ru>
To: Ken Brown <kbrown AT cornell DOT edu>, cygwin AT cygwin DOT com
Subject: Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken
In-Reply-To: <31835bd3-21f9-8db5-bb9b-cd7e324364fc@cornell.edu>
References: <CAJmy8YH3nHd2hM43bjq=Hg2LYVeef2J46JfNfCpJV3AKEnUb8A AT mail DOT gmail DOT com>
<CAJmy8YFb_eWwQq+U5ku5Jp-1QuR6xYW9dGpsi4QEm+G8jQG=nA AT mail DOT gmail DOT com>
<31835bd3-21f9-8db5-bb9b-cd7e324364fc AT cornell DOT edu>
MIME-Version: 1.0
X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT,
NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019