From:             Laurent dot Lyaudet at gmail dot com
Operating system: Debian Linux
PHP version:      5.4.19
Package:          CGI/CLI related
Bug Type:         Bug
Bug description:Constants from Core are not defined with inline scripts

Description:
------------
Hi,

I found a bug affecting PHP 5.3.3-7+squeeze15 and PHP 5.4.4-14+deb7u3 (cli)
(latest debian package for current stable).
The constant STDERR is not defined for inline scripts. 
I mean it isn't defined when you type #php and then you type <?php
myscriptcontent ?>, Ctrl+D.
But it works if you use php -r 'myscriptcontent'.
I join test script below.

I didn't tested it but I assume it is not specifically STDERR which is
impacted.
It is probably the same for all Core constants.

Best regards,
   Laurent Lyaudet

Test script:
---------------
php -r 'fwrite(STDERR, "stderr\n");'

works but

root@wheezyDEVLaurent:~# php
<?php
fwrite(STDERR, "stderr\n");
?>

doesn't.

Expected result:
----------------
stderr

Actual result:
--------------
PHP Notice:  Use of undefined constant STDERR - assumed 'STDERR' in - on
line 3
PHP Stack trace:
PHP   1. {main}() -:0

Notice: Use of undefined constant STDERR - assumed 'STDERR' in - on line 3

Call Stack:
   10.9477     215280   1. {main}() -:0

PHP Warning:  fwrite() expects parameter 1 to be resource, string given in
- on line 3
PHP Stack trace:
PHP   1. {main}() -:0
PHP   2. fwrite() -:3

Warning: fwrite() expects parameter 1 to be resource, string given in - on
line 3

Call Stack:
   10.9477     215280   1. {main}() -:0
   10.9479     216048   2. fwrite() -:3



-- 
Edit bug report at https://bugs.php.net/bug.php?id=65557&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65557&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65557&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65557&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65557&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65557&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65557&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65557&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65557&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65557&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65557&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65557&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65557&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65557&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65557&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65557&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65557&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65557&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65557&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65557&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65557&r=mysqlcfg

Reply via email to