Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98336 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53769 invoked from network); 22 Feb 2017 12:17:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Feb 2017 12:17:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=sjaillet@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=sjaillet@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.48 as permitted sender) X-PHP-List-Original-Sender: sjaillet@gmail.com X-Host-Fingerprint: 209.85.213.48 mail-vk0-f48.google.com Received: from [209.85.213.48] ([209.85.213.48:34978] helo=mail-vk0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/E4-11648-1618DA85 for ; Wed, 22 Feb 2017 07:17:38 -0500 Received: by mail-vk0-f48.google.com with SMTP id x75so423967vke.2 for ; Wed, 22 Feb 2017 04:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=+KKA09tSv9XoQ7S6v93D+At2Q9OOiK4E9eDqYQw4cXc=; b=PrG3uxabcmwuZfYras2cnS1R86JYe7qBE+0j2MjoSMv/HPkb/GQFmm31QFxydUv1cX b6PPj76QLJol9b8DG6N8uC23nL7Uz6TSYopuV2mT3HW8r5spdlvcVcwv65twgumrXwSz N4VBb5FDWuQSKZBqcAtmuwLSBmVvs3dUin4gEZ+xliz6lMrIBfDQXfkHBCP3mCBGoKc0 FXnyPd16e1X0GV2fsPzCDRDI677bs5FXCUAau7umPFhVGUfECeoqJm7rJpgLNc1mrjAv lR40mGzfP+S7nCT8HG+N9Jyb5F8tsKBD5GwPVPlD0beQXO+RkxGylRo+mwpCOLQ/xvoN f0NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=+KKA09tSv9XoQ7S6v93D+At2Q9OOiK4E9eDqYQw4cXc=; b=SXUI1guws2aR01GdrdMI/23EZrw+qDKrE1ESkvITYsSbckJvnc/S75aJ9/9ZEqE3c/ zbC1lOOVsN9AIJ+/tGoTbh1EXFYj7TOwZTTPGUJySwwI3i7vFkbkRHN7sETPUaPcpJfS YnGEH36nGY3LNaoGlguSFlxnB2Vg6i+Pqya7TSDPdiCE56qtEaCjKvQheu+VlPcj9PDx T8VShdu4CiqMhSUmZ1ro3uRdQNMUKfDulCOa7Gagr1zGLFjrP5Fz9jMB+YgONFWnzf1m zsZWCTzUdByTcGDMw3uge9JLGA0LRLPoeBI407sxpfrTH/VdRAkyqXePnhJrLwqCbQyY oP3Q== X-Gm-Message-State: AMke39kJSAGqTH+OeCXI2Jb0ZWVzIrDkoqZMiOpuUmsc8gBJIGGSy3ZM+tzlHYuFFLaqXt/ocNPZtPgtcr/eKQ== X-Received: by 10.31.147.75 with SMTP id v72mr15642703vkd.90.1487765854469; Wed, 22 Feb 2017 04:17:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.0.184 with HTTP; Wed, 22 Feb 2017 04:17:14 -0800 (PST) Date: Wed, 22 Feb 2017 13:17:14 +0100 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Help required to solve the eof() inconsistency across file/memory stream. From: sjaillet@gmail.com (Simon JAILLET) This is a longstanding issue which is requiring some advanced skills so I'm begging for some help here. To sum up the php feof() function on memory based streams didn't work the same way as on file based streams. On a 10 bytes file eof is setted when 11 bytes is read. While on a 10 bytes memory stream it requires to 12 bytes to be read to get the correct eof value. More details on the issue can be found there: https://github.com/php/php-src/pull/1153 The source of the problem is related to the fact that the PHP core use the C read() and fread() functions indifferently. While an attempt of a PR has been made to solve this issue https://github.com/php/php-src/pull/1578, a complete refactoring of the feof behavior would probably be a better option here, so that's why I'm asking for some help/opinions. Thank you.