Bug #76321 [Opn->Nab]: ftell(STDIN) returns 0 when no stdin is supplied
| From: | requinix@php.net | Date: | Thu, 10 May 2018 21:56:20 +0000 |
| Subject: | Bug #76321 [Opn->Nab]: ftell(STDIN) returns 0 when no stdin is supplied | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215192@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76321&edit=1
ID: 76321
Updated by: requinix@php.net
Reported by: gadelat at gmail dot com
Summary: ftell(STDIN) returns 0 when no stdin is supplied
-Status: Open
+Status: Not a bug
Type: Bug
Package: Filesystem function related
Operating System: Windows 10
PHP Version: 7.2.5
Block user comment: N
Private report: N
New Comment:
That won't prevent there from being a stdin. You aren't using it, but it's still
there.
As for Linux, stdin is a FIFO (glorified buffer) and you can't ftell on a FIFO.
Why is having stdin a problem?
Previous Comments:
------------------------------------------------------------------------
[2018-05-10 21:34:37] gadelat at gmail dot com
Running the script via
php test.php from cmd.exe, powershell or git bash. Tried both
thread safe and non-thread safe php 7.2.5 versions. I'm doing it via Virtualbox.
------------------------------------------------------------------------
[2018-05-10 16:32:35] requinix@php.net
What are you doing to not "provide" stdin?
------------------------------------------------------------------------
[2018-05-09 21:50:48] gadelat at gmail dot com
Description:
------------
I'm trying to make my application work in Windows. Important part of that is to detect if STDIN
was provided. I can't figure out how to do that in Windows.
On Linux OS, following returns bool(false), in Windows int(0)
var_dump(ftell(STDIN));
Other approaches have same problem, or indefinitely block application if no stdin was provided.
Is there no way to reliably detect STDIN in Windows?
Test script:
---------------
var_dump(ftell(STDIN));
Expected result:
----------------
FALSE
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76321&edit=1