Edit report at https://bugs.php.net/bug.php?id=63336&edit=1

 ID:                 63336
 Updated by:         larue...@php.net
 Reported by:        tomoya-yokota at cybozu dot co dot jp
 Summary:            invalid E_NOTICE error occur
 Status:             Open
 Type:               Bug
 Package:            Compile Warning
 Operating System:   ubuntu12.04
 PHP Version:        5.4.8
-Assigned To:        
+Assigned To:        laruence
 Block user comment: N
 Private report:     N

 New Comment:

Oh, I see your point.


Previous Comments:
------------------------------------------------------------------------
[2012-10-23 06:09:04] tomoya-yokota at cybozu dot co dot jp

in PHP5.3, E_NOTICE error did not occur.
But in PHP5.4, E_NOTICE error would occur.
Is it error reporting specification?

------------------------------------------------------------------------
[2012-10-23 06:00:40] larue...@php.net

I am not sure, E_ALL & ~ E_STRICT == E_ALL without E_STRICT..
maybe you mistake your except result?

------------------------------------------------------------------------
[2012-10-23 04:27:05] tomoya-yokota at cybozu dot co dot jp

> you said "set error_reporting with error_report( E_STRICT & ~ E_STRICT )."
Sorry. It is wrong. Test script is correct

------------------------------------------------------------------------
[2012-10-23 03:39:35] larue...@php.net

you said "set error_reporting with error_report( E_STRICT & ~ E_STRICT )."

but your test script sasy: "error_reporting( E_ALL & ~ E_STRICT );" ?

------------------------------------------------------------------------
[2012-10-23 02:29:55] tomoya-yokota at cybozu dot co dot jp

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 this bug report at https://bugs.php.net/bug.php?id=63336&edit=1

Reply via email to