Doc #60294 [Csd]: Strange "strict notice" for overrided simplexml class from external file

From: Date: Mon, 14 Nov 2011 15:21:26 +0000
Subject: Doc #60294 [Csd]: Strange "strict notice" for overrided simplexml class from external file
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7434@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60294&edit=1 ID: 60294 Updated by: rquadling@php.net Reported by: miracle at rpz dot name Summary: Strange "strict notice" for overrided simplexml class from external file Status: Closed Type: Documentation Problem Package: SimpleXML related Operating System: Linux PHP Version: 5.3.8 Assigned To: rquadling Block user comment: N Private report: N New Comment: As an aside, it seems that this error was first generated in V5.3.6RC1 onwards ... Strict Standards: Declaration of FailTest::addAttribute() should be compatible with that of SimpleXMLElement::addAttribute() in C:\Documents and Settings\RichardQ\Local Settings\Temp\fai145E.tmp on line 5 and from V5.4.0beta2 as ... Strict Standards: Declaration of FailTest::addAttribute() should be compatible with SimpleXMLElement::addAttribute($name, $value = NULL, $ns = NULL) in C:\Documents and Settings\RichardQ\Local Settings\Temp\fai146E.tmp on line 5 Previous Comments: ------------------------------------------------------------------------ [2011-11-14 15:18:16] rquadling@php.net Revision: http://svn.php.net/viewvc?view=revision&revision=319173 Log: Value parameter is optional. Fix bug#60924 ------------------------------------------------------------------------ [2011-11-14 14:32:26] miracle at rpz dot name Ок, it's documentation problem ? ------------------------------------------------------------------------ [2011-11-14 14:06:49] laruence@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 a new feature of such warning improvement has been introduced in 5.4, run the test script in 5.4 will find the reason: PHP Strict Standards: Declaration of FailTest::addAttribute() should be compatible with SimpleXMLElement::addAttribute($name, $value = NULL, $ns = NULL) in /tmp/failtest-hA9N4B on line 4 ------------------------------------------------------------------------ [2011-11-14 13:14:00] miracle at rpz dot name Description: ------------ Extended class compatible if declared in same file and "not compatible" if included from external script. Test script: --------------- <?php error_reporting(E_STRICT); class PassTest extends SimpleXMLElement { public function addAttribute($name, $value, $namespace = null) { } // no strict error here } $failtest = tempnam(sys_get_temp_dir(), 'failtest-'); file_put_contents($failtest,'<?php class FailTest extends SimpleXMLElement { public function addAttribute($name, $value, $namespace = null) { } } '); // save save class declaration to file include $failtest; // PHP Strict standards: Declaration of FailTest::addAttribute() should be compatible with that of SimpleXMLElement::addAttribute() in /tmp/failtest.php on line 5 Expected result: ---------------- [empty] Actual result: -------------- PHP Strict standards: Declaration of FailTest::addAttribute() should be compatible with that of SimpleXMLElement::addAttribute() in /tmp/failtest-Ma1kNH on line 4 PHP Stack trace: PHP 1. {main}() /tmp/simplexml-extend-strict-error.php:0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60294&edit=1

« previous php.doc.bugs (#7434) next »