From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward500p.mail.yandex.net (forward500p.mail.yandex.net [77.88.28.110]) by sourceware.org (Postfix) with ESMTPS id DC7973858D32 for ; Sun, 2 Oct 2022 14:05:03 +0000 (GMT) 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 Received: from sas2-e7f6fb703652.qloud-c.yandex.net (sas2-e7f6fb703652.qloud-c.yandex.net [IPv6:2a02:6b8:c14:4fa6:0:640:e7f6:fb70]) by forward500p.mail.yandex.net (Yandex) with ESMTP id 82938F01290; Sun, 2 Oct 2022 17:05:02 +0300 (MSK) Received: by sas2-e7f6fb703652.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id TobDDScRME-51h4kefb; Sun, 02 Oct 2022 17:05:02 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) 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 Received: from [192.168.1.10] (HELO daemon2.darkdragon.lan) by daemon2 (Office Mail Server 0.8.12 build 08053101) with SMTP; Sun, 02 Oct 2022 13:58:31 -0000 Date: Sun, 2 Oct 2022 16:58:31 +0300 From: Andrey Repin X-Mailer: The Bat! (v9.3.4) Professional Reply-To: cygwin@cygwin.com Message-ID: <983132575.20221002165831@yandex.ru> To: Ken Brown , cygwin@cygwin.com Subject: Re: Cygwin 3.3.6: PHP's SplFileObject::fwrite seems broken In-Reply-To: <31835bd3-21f9-8db5-bb9b-cd7e324364fc@cornell.edu> References: <31835bd3-21f9-8db5-bb9b-cd7e324364fc@cornell.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 List-Id: 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...