|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #47206 Unintended API change in XSLTProcessor
Submitted: 2009-01-24 05:02 UTC Modified: 2009-11-20 10:24 UTC
Avg. Score:4.9 ± 0.3
Reproduced:17 of 17 (100.0%)
Same Version:16 (94.1%)
Same OS:13 (76.5%)
From: Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.3CVS-2009-01-24 (snap) OS: Linux
Private report: No CVE-ID:
 [2009-01-24 05:02 UTC]
In 5.3, attempting to extend XSLTProcessor in the same way as in 5.2 (with type hinting on the method parameters) yields an E_STRICT message: "Declaration of ExtendedXSLTProcessor::importStylesheet() should be compatible with that of XSLTProcessor::importStylesheet()".

Removing the type hint fixes the problem in 5.3. I am assuming this behavior is unintentional, and that the type hint should still be associated with the methods.

This applies to both ::importStylesheet() and ::transformToDoc(), and potentially other methods as well.

Reproduce code:
class ExtendedXSLTProcessor extends XSLTProcessor {
  public function importStylesheet(DOMDocument $stylesheet) {

    /* ... */

Actual result:
Strict Standards: Declaration of ExtendedXSLTProcessor::importStylesheet() should be compatible with that of XSLTProcessor::importStylesheet() in /.../test.php on line 8


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-30 15:01 UTC] david dot zuelke at bitextender dot com
Same problem here. Subclasses of XSLTProcessor can work without E_STRICT 
warning either in 5.2 or in 5.3, but not in both :(
 [2009-01-30 17:01 UTC]

any problem with a atch like 
Index: ext/xsl/xsltprocessor.c
RCS file: /repository/php-src/ext/xsl/xsltprocessor.c,v
retrieving revision
diff -u -p -r1. xsltprocessor.c
--- ext/xsl/xsltprocessor.c	31 Dec 2008 11:15:47 -0000
+++ ext/xsl/xsltprocessor.c	30 Jan 2009 16:59:15 -0000
@@ -29,7 +29,7 @@
 /* {{{ arginfo */
 ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_import_stylesheet, 0, 0, 1)
-	ZEND_ARG_INFO(0, doc)
+	ZEND_ARG_OBJ_INFO(0, doc, "DOMDocument", 0)
 ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_transform_to_doc, 0, 0, 1)

I didn't properly test it but it should work ...
 [2009-01-30 17:04 UTC] david dot zuelke at bitextender dot com
(mind you, Rob, that this applies to transformToDoc(), too)
 [2009-02-03 12:06 UTC]
dmitry changed that 8 weeks ago with the message:

MFH: fix arginfo - these also accept SimpleXMLElement

So, the removing of the typehint has a reason and I don't see a way to 
make it BC *and* accept SimpleXMLElement

 [2009-02-03 14:53 UTC]
The type hint added in 5.2.6 broke BC and wasn't detected until post 
5.2.8 where it was fixed. It shouldn't have been added in the first 
 [2009-02-05 20:08 UTC]
According to the discussion on internals (Thread "towards the next 5.3 release",, it should be documented that

- importStylesheet might take DOMDocument or SimpleXMLElement as parameter
- this was broken in 5.2.6 - 5.2.8 (inclusive) where importStylesheets only accepted DOMDocument
- when users extend XSLTProcessor they shouldn't set a typehint.
 [2009-11-20 10:24 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

 [2009-11-20 10:27 UTC]
Automatic comment from SVN on behalf of vrana
Log: Accepts SimpleXMLElement (bug #47206)
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 07:01:43 2015 UTC