php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40930 Different error handling on different callings with E_STRICT
Submitted: 2007-03-27 15:42 UTC Modified: 2007-03-27 15:51 UTC
From: timo@php.net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.1 OS: Linux/WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: timo@php.net
New email:
PHP Version: OS:

 

 [2007-03-27 15:42 UTC] timo@php.net
Description:
------------
Assume there a two classes. The first class is an abstract class which only defines a default protected method having no parameters. The second class (could be in same file) will extend the first class and overrides the method from the first class using a single parameter. This will run without any notices if i use error_reporting( E_ALL ^ E_STRICT ).

but if i will include the file within an other file, it will result in a "Strict Standards" notice.

It does not depend on the way i call it - apache or cli.

Reproduce code:
---------------
----- FILE 1 (file1.php)-----
<?php
error_reporting( E_ALL ^ E_STRICT );
abstract class AbstractTest {
	protected function _update() {}
}

abstract class Test extends AbstractTest {
	protected function _update( $var ) {}
}
?>


------ FILE 2 (file2.php)-----
<?php
	error_reporting( E_ALL ^ E_STRICT );
 	include 'file1.php';
?>

Expected result:
----------------
both ways should run in same way.

Actual result:
--------------
- calling the first example file (file1.php) directly will run fine.
- calling the second example file (file2.php), which will include the first file, results in the following notice:
"Strict Standards: Declaration of Test::_update() should be compatible with that of AbstractTest::_update() in \htdocs\file1.php on line 8"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-27 15:51 UTC] tony2001@php.net
>- calling the first example file (file1.php) directly will run fine.
because error_reporting() is called when compilation is done, so the error level did no include E_STRICT.

>- calling the second example file (file2.php), which will include 
>the first file, results in the following notice:
because error_reporting is set before the compilation is started, so the error level DID include E_STRICT.

This is expected behaviour.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 02 09:00:03 2025 UTC