#125 error_reporting(E_ALL|E_STRICT)gives lots of warning

closed-fixed
nobody
5
2008-12-20
2007-12-19
Anonymous
No

hi,

I've the bad habit of putting error_reporting(E_ALL|E_STRICT); on top of all my scripts.

with SimpleTest it says a bunch of warnings :

---------------------------------

Strict Standards: Declaration of ReferenceExpectation::test() should be compatible with that of SimpleExpectation::test() in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 21

Strict Standards: Declaration of XmlReporter::paintSignal() should be compatible with that of SimpleScorer::paintSignal() in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\default_reporter.php on line 15

Strict Standards: Non-static method TestSuite::getBaseTestCase() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\test_case.php on line 408

Strict Standards: Non-static method SimpleTest::ignoreParentsIfIgnored() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\test_case.php on line 432

Strict Standards: Non-static method SimpleTest::_getRegistry() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\simpletest.php on line 70

Strict Standards: Non-static method SimpleTest::_getDefaults() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\simpletest.php on line 208

Strict Standards: Non-static method SimpleTest::isIgnored() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\simpletest.php on line 72

Strict Standards: Non-static method SimpleTest::_getRegistry() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\simpletest.php on line 132

Strict Standards: Non-static method SimpleTest::isIgnored() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\test_case.php on line 435

Strict Standards: Non-static method SimpleTest::_getRegistry() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\simpletest.php on line 132
All tests

Strict Standards: Non-static method SimpleTest::getContext() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\test_case.php on line 126

Strict Standards: Non-static method SimpleTestCompatibility::isA() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\test_case.php on line 182

Strict Standards: Non-static method SimpleTest::getContext() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\exceptions.php on line 39

Strict Standards: Non-static method SimpleTest::getContext() should not be called statically, assuming $this from incompatible context in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 60

Strict Standards: Non-static method SimpleErrorQueue::getSeverityAsString() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 275

Strict Standards: Non-static method SimpleTest::getContext() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 278
&Pass: encoding/stu_encoding.php->TestOfEncodingDb->testfetchAll-> with mode Zend_Db::FETCH_ASSOC at [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 26]

Strict Standards: Non-static method SimpleErrorQueue::getSeverityAsString() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 275

Strict Standards: Non-static method SimpleTest::getContext() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 278
&Pass: encoding/stu_encoding.php->TestOfEncodingDb->testfetchAll-> with mode Zend_Db::FETCH_NUM at [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 29]

Strict Standards: Non-static method SimpleErrorQueue::getSeverityAsString() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 275

Strict Standards: Non-static method SimpleTest::getContext() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 278
&Pass: encoding/stu_encoding.php->TestOfEncodingDb->testfetchAll-> with mode Zend_Db::FETCH_BOTH at [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 32]

Strict Standards: Non-static method SimpleErrorQueue::getSeverityAsString() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 275

Strict Standards: Non-static method SimpleTest::getContext() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 278
&Pass: encoding/stu_encoding.php->TestOfEncodingDb->testfetchAll-> with mode Zend_Db::FETCH_BOTH at [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 33]

Strict Standards: Non-static method SimpleErrorQueue::getSeverityAsString() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 275

Strict Standards: Non-static method SimpleTest::getContext() should not be called statically in U:\dev\simpletest\simpletest_1.0.1beta2\simpletest\errors.php on line 278
&Pass: encoding/stu_encoding.php->TestOfEncodingDb->testfetchAll-> with mode Zend_Db::FETCH_OBJ at [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 36]
Exception: encoding/stu_encoding.php -> TestOfEncodingDb -> testfetchAll -> Unexpected PHP error [Undefined variable: function] severity [E_NOTICE] in [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 26]
Exception: encoding/stu_encoding.php -> TestOfEncodingDb -> testfetchAll -> Unexpected PHP error [Undefined variable: function] severity [E_NOTICE] in [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 29]
Exception: encoding/stu_encoding.php -> TestOfEncodingDb -> testfetchAll -> Unexpected PHP error [Undefined variable: function] severity [E_NOTICE] in [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 32]
Exception: encoding/stu_encoding.php -> TestOfEncodingDb -> testfetchAll -> Unexpected PHP error [Undefined variable: function] severity [E_NOTICE] in [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 33]
Exception: encoding/stu_encoding.php -> TestOfEncodingDb -> testfetchAll -> Unexpected PHP error [Undefined variable: function] severity [E_NOTICE] in [U:\dev\work\projects\edito\test\encoding\stu_encoding.php line 36]
1/1 test cases complete: 5 passes, 0 fails and 5 exceptions.

---------------------------------

keep the good work !

Discussion

  • Logged In: YES
    user_id=2015834
    Originator: NO

    The problem is, that there are not only a large amount of errors. This recursively creates an unlimited amount of errors.

    I would love to see a PHP 5 (PHP 5.3 with Namespaces) version of SimpleTest.

    Still, you have to deal with legacy classes (lots of PEAR-classes are PHP4-code). Therefore I did a small hack you in "simpleTestErrorHandler" that filters all well known sources of PHP4ish strict errors.

    See the Patch:
    ------------8<------------8<------------8<------------
    function simpleTestErrorHandler($severity, $message, $filename, $line, $super_globals) {
    // ignore some ugly strict warnings
    if($severity==E_STRICT) {
    $dirname = dirname($filename);
    // ignore errors that come from simpletest
    if($dirname == dirname(__FILE__)) {
    return;
    }

    // ignore errors comming from include_path
    $incDirs = explode(PATH_SEPARATOR, ini_get('include_path'));
    foreach($incDirs as $id) {
    if($id == '.') {
    continue;
    }
    if(strncmp( $dirname, $id, strlen( $dirname ) ) == 0) {
    return;
    }
    }
    }

    ------------8<------------8<------------8<------------

     
  • Marcus Baker
    Marcus Baker
    2008-04-07

    • status: open --> open-postponed
     
  • Marcus Baker
    Marcus Baker
    2008-04-07

    Logged In: YES
    user_id=695819
    Originator: NO

    Hi...

    Nice hack :). In fact a PHP 5 only version is coming soon. As the last PHP 4 version is rolling out right now, we'll live consider this issue fixed when we release the PHP 5 only version. Just hang on a teenie bit longer...

    yours, Marcus

     
  • Edward Z. Yang
    Edward Z. Yang
    2008-12-20

    Latest SVN trunk doesn't seem to emit any E_STRICT errors, so this should be marked FIXED.

     
  • Edward Z. Yang
    Edward Z. Yang
    2008-12-20

    Marked appropriately.

     
  • Edward Z. Yang
    Edward Z. Yang
    2008-12-20

    • status: open-postponed --> closed-fixed