Debian Bug report logs - #636146
php5-cli: STDIN not defined in CLI

version graph

Package: php5-cli; Maintainer for php5-cli is (unknown);

Reported by: Robert Kawecki <thewanderer@gim11.pl>

Date: Sun, 31 Jul 2011 17:54:04 UTC

Severity: normal

Found in version 5.3.3-7+squeeze3

Fixed in versions php5/5.4.4-7, 5.4.4-14

Done: Ondřej Surý <ondrej@sury.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#636146; Package php5-cli. (Sun, 31 Jul 2011 17:54:07 GMT) (full text, mbox, link).


Acknowledgement sent to Robert Kawecki <thewanderer@gim11.pl>:
New Bug report received and forwarded. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Sun, 31 Jul 2011 17:54:07 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Robert Kawecki <thewanderer@gim11.pl>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: php5-cli: STDIN not defined in CLI
Date: Sun, 31 Jul 2011 19:43:24 +0200
Package: php5-cli
Version: 5.3.3-7+squeeze3
Severity: normal

STDIN does not seem to be defined in CLI mode, despite the documentation
(http://www.php.net/manual/en/features.commandline.io-streams.php). Same goes
for STDOUT and STDERR.
"The CLI SAPI defines a few constants for I/O streams to make programming for
the command line a bit easier."

Test case:
<?php
$fd = STDIN;
?>

Expected output: none

Produced output:
PHP Notice:  Use of undefined constant STDIN - assumed 'STDIN' in - on line 2
Notice: Use of undefined constant STDIN - assumed 'STDIN' in - on line 2

PHP version string: PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun
28 2011 08:24:40)



-- System Information:
Debian Release: 6.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages php5-cli depends on:
ii  libbz2-1.0         1.0.5-6               high-quality block-sorting file co
ii  libc6              2.11.2-10             Embedded GNU C Library: Shared lib
ii  libcomerr2         1.41.12-4stable1      common error description library
ii  libdb4.8           4.8.30-2              Berkeley v4.8 Database Libraries [
ii  libgssapi-krb5-2   1.8.3+dfsg-4squeeze1  MIT Kerberos runtime libraries - k
ii  libk5crypto3       1.8.3+dfsg-4squeeze1  MIT Kerberos runtime libraries - C
ii  libkrb5-3          1.8.3+dfsg-4squeeze1  MIT Kerberos runtime libraries
ii  libmagic1          5.04-5                File type determination library us
ii  libonig2           5.9.1-1               Oniguruma regular expressions libr
ii  libpcre3           8.02-1.1              Perl 5 Compatible Regular Expressi
ii  libqdbm14          1.8.77-4              QDBM Database Libraries [runtime]
ii  libssl0.9.8        0.9.8o-4squeeze1      SSL shared libraries
ii  libxml2            2.7.8.dfsg-2+squeeze1 GNOME XML library
ii  mime-support       3.48-1                MIME files 'mime.types' & 'mailcap
ii  php5-common        5.3.3-7+squeeze3      Common files for packages built fr
ii  tzdata             2011d-0squeeze1       time zone and daylight-saving time
ii  ucf                3.0025+nmu1           Update Configuration File: preserv
ii  zlib1g             1:1.2.3.4.dfsg-3      compression library - runtime

php5-cli recommends no packages.

Versions of packages php5-cli suggests:
ii  php-pear                5.3.3-7+squeeze3 PEAR - PHP Extension and Applicati

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#636146; Package php5-cli. (Sun, 31 Jul 2011 18:54:03 GMT) (full text, mbox, link).


Acknowledgement sent to Joey Smith <joey@php.net>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Sun, 31 Jul 2011 18:54:03 GMT) (full text, mbox, link).


Message #10 received at 636146@bugs.debian.org (full text, mbox, reply):

From: Joey Smith <joey@php.net>
To: 636146@bugs.debian.org
Subject: This is not a bug
Date: Sun, 31 Jul 2011 12:51:29 -0600
[Message part 1 (text/plain, inline)]
This is by design. cli_register_file_handles is only called when behaviour
is PHP_MODE_STANDARD if the filename is not '-'. See the comment starting on
line 1068 of sapi/cli/php_cli.c

I am working on a patch to the PHP documentation that should make this
situation a bit more clear.
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#636146; Package php5-cli. (Mon, 01 Aug 2011 10:18:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ondřej Surý <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Mon, 01 Aug 2011 10:18:08 GMT) (full text, mbox, link).


Message #15 received at 636146@bugs.debian.org (full text, mbox, reply):

From: Ondřej Surý <ondrej@sury.org>
To: Robert Kawecki <thewanderer@gim11.pl>, "636146@bugs.debian.org" <636146@bugs.debian.org>
Subject: Re: [php-maint] Bug#636146: php5-cli: STDIN not defined in CLI
Date: Mon, 1 Aug 2011 12:14:35 +0200
The PHP documentation doesn't say anything about assignment to variables. Are you sure this is a valid use case?

Ondřej Surý

On 31.7.2011, at 19:43, Robert Kawecki <thewanderer@gim11.pl> wrote:

> Package: php5-cli
> Version: 5.3.3-7+squeeze3
> Severity: normal
> 
> STDIN does not seem to be defined in CLI mode, despite the documentation
> (http://www.php.net/manual/en/features.commandline.io-streams.php). Same goes
> for STDOUT and STDERR.
> "The CLI SAPI defines a few constants for I/O streams to make programming for
> the command line a bit easier."
> 
> Test case:
> <?php
> $fd = STDIN;
> ?>
> 
> Expected output: none
> 
> Produced output:
> PHP Notice:  Use of undefined constant STDIN - assumed 'STDIN' in - on line 2
> Notice: Use of undefined constant STDIN - assumed 'STDIN' in - on line 2
> 
> PHP version string: PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun
> 28 2011 08:24:40)
> 
> 
> 
> -- System Information:
> Debian Release: 6.0.2
>  APT prefers stable
>  APT policy: (500, 'stable')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
> Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> 
> Versions of packages php5-cli depends on:
> ii  libbz2-1.0         1.0.5-6               high-quality block-sorting file co
> ii  libc6              2.11.2-10             Embedded GNU C Library: Shared lib
> ii  libcomerr2         1.41.12-4stable1      common error description library
> ii  libdb4.8           4.8.30-2              Berkeley v4.8 Database Libraries [
> ii  libgssapi-krb5-2   1.8.3+dfsg-4squeeze1  MIT Kerberos runtime libraries - k
> ii  libk5crypto3       1.8.3+dfsg-4squeeze1  MIT Kerberos runtime libraries - C
> ii  libkrb5-3          1.8.3+dfsg-4squeeze1  MIT Kerberos runtime libraries
> ii  libmagic1          5.04-5                File type determination library us
> ii  libonig2           5.9.1-1               Oniguruma regular expressions libr
> ii  libpcre3           8.02-1.1              Perl 5 Compatible Regular Expressi
> ii  libqdbm14          1.8.77-4              QDBM Database Libraries [runtime]
> ii  libssl0.9.8        0.9.8o-4squeeze1      SSL shared libraries
> ii  libxml2            2.7.8.dfsg-2+squeeze1 GNOME XML library
> ii  mime-support       3.48-1                MIME files 'mime.types' & 'mailcap
> ii  php5-common        5.3.3-7+squeeze3      Common files for packages built fr
> ii  tzdata             2011d-0squeeze1       time zone and daylight-saving time
> ii  ucf                3.0025+nmu1           Update Configuration File: preserv
> ii  zlib1g             1:1.2.3.4.dfsg-3      compression library - runtime
> 
> php5-cli recommends no packages.
> 
> Versions of packages php5-cli suggests:
> ii  php-pear                5.3.3-7+squeeze3 PEAR - PHP Extension and Applicati
> 
> -- no debconf information
> 
> 
> 
> _______________________________________________
> pkg-php-maint mailing list
> pkg-php-maint@lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-php-maint




Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#636146; Package php5-cli. (Mon, 01 Aug 2011 13:27:03 GMT) (full text, mbox, link).


Acknowledgement sent to Robert Kawecki <thewanderer@gim11.pl>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Mon, 01 Aug 2011 13:27:03 GMT) (full text, mbox, link).


Message #20 received at 636146@bugs.debian.org (full text, mbox, reply):

From: Robert Kawecki <thewanderer@gim11.pl>
To: Ondřej Surý <ondrej@sury.org>
Cc: "636146@bugs.debian.org" <636146@bugs.debian.org>
Subject: Re: [php-maint] Bug#636146: php5-cli: STDIN not defined in CLI
Date: Mon, 01 Aug 2011 15:25:59 +0200
Oops. Rechecked again. Yes, there's a note :[
Okay, I missed that part in the docs. This bug can be closed now.





Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#636146; Package php5-cli. (Mon, 01 Aug 2011 13:30:03 GMT) (full text, mbox, link).


Acknowledgement sent to Robert Kawecki <thewanderer@gim11.pl>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Mon, 01 Aug 2011 13:30:03 GMT) (full text, mbox, link).


Message #25 received at 636146@bugs.debian.org (full text, mbox, reply):

From: Robert Kawecki <thewanderer@gim11.pl>
To: Ondřej Surý <ondrej@sury.org>
Cc: "636146@bugs.debian.org" <636146@bugs.debian.org>
Subject: Re: [php-maint] Bug#636146: php5-cli: STDIN not defined in CLI
Date: Mon, 01 Aug 2011 15:20:32 +0200
> The PHP documentation doesn't say anything about assignment to variables. Are you sure this is a valid use case?
> 
> Ondřej Surý

Yes, it's a valid use case, and this is reproducible with any reference
to these constants, not only an assignment.
During testing today, I've found that this only happens when the script
is piped to PHP or typed in manually. When running `php -f ./file.php`
or similar way (that is, when the input file is not "-"), STDIN, STDOUT
and STDERR are defined.
This fact is not mentioned anywhere in the documentation, but it appears
to be an explicit design decision, as the PHP source contains an "if",
preventing the constants from being defined when reading the script from
a file. See:
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/sapi/cli/php_cli.c?revision=312454&view=markup
line 1101

I only found out about that after posting the bug report.
So either the online documentation is incomplete regarding the CLI SAPI
and these constants, or the conditional statement is in the source by
mistake.





Reply sent to Ondřej Surý <ondrej@sury.org>:
You have taken responsibility. (Fri, 04 Jul 2014 12:12:26 GMT) (full text, mbox, link).


Notification sent to Robert Kawecki <thewanderer@gim11.pl>:
Bug acknowledged by developer. (Fri, 04 Jul 2014 12:12:26 GMT) (full text, mbox, link).


Message #30 received at 636146-done@bugs.debian.org (full text, mbox, reply):

From: Ondřej Surý <ondrej@sury.org>
To: 648424-done@bugs.debian.org, 636146-done@bugs.debian.org, 637212-done@bugs.debian.org, 645340-done@bugs.debian.org, 647475-done@bugs.debian.org, 668157-done@bugs.debian.org, 668928-done@bugs.debian.org, 684110-done@bugs.debian.org, 691917-done@bugs.debian.org, 703109-done@bugs.debian.org, 705350-done@bugs.debian.org, 706091-done@bugs.debian.org, 715513-done@bugs.debian.org, 724817-done@bugs.debian.org, 668597-done@bugs.debian.org, 612364-done@bugs.debian.org, 507401-done@bugs.debian.org, 674685-done@bugs.debian.org, 499031-done@bugs.debian.org, 580232-done@bugs.debian.org, 674476-done@bugs.debian.org
Subject: Closing bugs filled against php5 in oldstable
Date: Fri, 04 Jul 2014 14:09:04 +0200
Version: 5.4.4-14

Hey all,

I am closing the bugs that were filled against php5 5.3 in Debian
oldstable
(well and earlier)...

Feel free to reopen the bug in you can reproduce it with php5 from
current
stable Debian release.

Cheers,
-- 
Ondřej Surý <ondrej@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server



Marked as fixed in versions php5/5.4.4-7. Request was from Ondřej Surý <ondrej@debian.org> to control@bugs.debian.org. (Wed, 09 Jul 2014 09:03:14 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Thu, 07 Aug 2014 07:31:20 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jul 2 03:40:09 2023; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.