From: tomoya-yokota at cybozu dot co dot jp
Operating system: ubuntu12.04
PHP version: 5.4.8
Package: Compile Warning
Bug Type: Bug
Bug description:invalid E_NOTICE error occur
Description:
------------
1. set error_reporting with error_report( E_STRICT & ~ E_STRICT ).
2. call set_error_handler( callable $error_handler, E_STRICT & ~ E_STRICT
).
3. execute Bellow script(test.php)
4. E_NOTICE Error occur
( Error Message is Use of undefined constant XXX - assumed 'XXX' )
# when the script of PHP is splitted by Class, This issue does not occur.
Test script:
---------------
------
test.php
------
<?php
error_reporting( E_ALL & ~ E_STRICT );
function myErrorHandler($errno, $errstr, $errfile, $errline) {
if( $errno === E_NOTICE ) { echo "{$errstr}\n"; }
if( $errno === E_STRICT ) { echo "{$errstr}\n"; }
}
set_error_handler('myErrorHandler', E_ALL & ~ E_STRICT );
require_once("sample.php");
------
sample.php
------
<?php
define("TEST", "123");
class Hoge2 {
public function moge($var=TEST, $moge=null) { return true; }
}
class HogeChild extends Hoge2 {
public function moge($var=TEST) { return true; }
}
Expected result:
----------------
1. E_NOTICE would not be reported
2. E_STRICT wouble be reported.
Actual result:
--------------
1. E_NOTICE was reported.
----
error message
----
Use of undefined constant TEST - assumed 'TEST'
--
Edit bug report at https://bugs.php.net/bug.php?id=63336&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63336&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63336&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63336&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63336&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63336&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63336&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63336&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63336&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63336&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63336&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63336&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63336&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63336&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63336&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63336&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63336&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63336&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63336&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63336&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63336&r=mysqlcfg