php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60294 Strange "strict notice" for overrided simplexml class from external file
Submitted: 2011-11-14 13:14 UTC Modified: 2011-11-14 15:21 UTC
From: miracle at rpz dot name Assigned: rquadling (profile)
Status: Closed Package: SimpleXML related
PHP Version: 5.3.8 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: miracle at rpz dot name
New email:
PHP Version: OS:

 

 [2011-11-14 13:14 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-14 14:06 UTC] laruence@php.net
-Status: Open +Status: Bogus
 [2011-11-14 14:06 UTC] 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 14:32 UTC] miracle at rpz dot name
-Type: Bug +Type: Documentation Problem
 [2011-11-14 14:32 UTC] miracle at rpz dot name
Ок, it's documentation problem ?
 [2011-11-14 15:18 UTC] rquadling@php.net
Revision: http://svn.php.net/viewvc?view=revision&revision=319173

Log:
Value parameter is optional.
Fix bug#60924
 [2011-11-14 15:18 UTC] rquadling@php.net
-Status: Bogus +Status: Closed -Assigned To: +Assigned To: rquadling
 [2011-11-14 15:21 UTC] rquadling@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 09 11:01:33 2024 UTC