php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47439 Strict errors don't always appear in CLI
Submitted: 2009-02-18 16:34 UTC Modified: 2009-02-18 18:22 UTC
From: tomek at realtsp dot com Assigned:
Status: Not a bug Package: Compile Warning
PHP Version: 5.2.9RC2 OS: FreeBSD 7.0, Ubuntu
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 + 37 = ?
Subscribe to this entry?

 
 [2009-02-18 16:34 UTC] tomek at realtsp dot com
Description:
------------
When running in CLI with strict errors enabled & display_errors turned on, PHP does not produce all strict warnings reliably.

Some, like:

"Strict Standards: Non-static method b::init() should not be called statically in /usr/home/tomek/test.php on line 25"

is 100% reproducible.

Others, like:

"Strict Standards: Declaration of b::init() should be compatible with that of a::init() in /usr/home/tomek/test.php on line 8"

are not reproducible using the code attached. Swapping the class declarations, however, makes the warning appear (ie. "class b extends a" goes first, and only then define "class a").

Please note that this is the *only* change required for it to appear. 

This is very similar to bug #46851.

Reproduce code:
---------------
<?php

error_reporting(E_ALL | E_STRICT);

ini_set('display_errors', 'On');
ini_set('log_errors', 'Off');

class a
{
  public function init($v) {}
}

class b extends a
{
  public function init() {}
}

b::init();

Expected result:
----------------
Strict Standards: Declaration of b::init() should be compatible with that of a::init() in /usr/home/tomek/test.php on line 8

Strict Standards: Non-static method b::init() should not be called statically in /usr/home/tomek/test.php on line 19


Actual result:
--------------
Strict Standards: Non-static method b::init() should not be called statically in /usr/home/tomek/test.php on line 19

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-18 17:08 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The \"missing\" messages are created at compile time, but you\'Re setting your error_reporting level at run-time. Please set error reporting in php.ini to get all compile time messages
 [2009-02-18 17:16 UTC] tomek at realtsp dot com
Fair enough, changing that setting does show them in both cases.

However, what's still not clear is why is it inconsistent depending on the order of the class declarations? Surely it should just not appear at all unless the php.ini settings are changed?
 [2009-02-18 18:22 UTC] johannes@php.net
Sometimes we don'T have all information while compiling and do late binding at runtime, sometimes we have all information we need an can do early binding at compile time.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 02:01:31 2024 UTC