| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2010-02-01 10:20 UTC] frederic dot hardy at mageekbox dot net
 Description:
------------
Require() and include() are more strict than a all in one file then parse php code.
Reproduce code:
---------------
file a.php
<?php
class a { public function test($fool) {} }
?>
file b.php
<?php
class b { public function test($foo, $bar) {} }
?>
file withRequire.php
<?php
error_reporting(E_STRICT);
require('a.php');
require('b.php');
$b = new b();
?>
file allInOne.php
<?php
error_reporting(E_STRICT);
class a { public function test($foo) {} }
class b [ public function test($foo, $bar) {} }
$b = new b();
?>
Expected result:
----------------
In CLI, "php withRequire.php" must give same result than php "allInOne.php".
Actual result:
--------------
php allInOne.php => nothing
php withRequire.php => Strict standards: Declaration of b::test() should be compatible with that of a::test() in /path/to/b.php on line 8
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 15:00:01 2025 UTC | 
Not sure what's going on here, but this is the difference eventually: No E_STRICT notice: <?php error_reporting(E_STRICT); class a{function test($foo){}} class b extends a{function test($foo, $bar){}} $b = new b(); ?> E_STRICT notice <?php error_reporting(E_STRICT); class b extends a{function test($foo, $bar){}} class a{function test($foo){}} $b = new b(); ?>