Bug #70558 [Opn->Csd]: "Couldn't fetch" error in DOMDocument::registerNodeClass()

From: Date: Wed, 23 Sep 2015 14:02:20 +0000
Subject: Bug #70558 [Opn->Csd]: "Couldn't fetch" error in DOMDocument::registerNodeClass()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196185@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70558&edit=1 ID: 70558 Updated by: laruence@php.net Reported by: sebastian@php.net Summary: "Couldn't fetch" error in DOMDocument::registerNodeClass() -Status: Open +Status: Closed Type: Bug Package: DOM XML related Operating System: Irrelevant PHP Version: 7.0Git-2015-09-23 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of laruence@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=c87ef023aa404d310582e7a4c8c69c518a52f382 Log: Fixed Bug #70558 (&quot;Couldn't fetch&quot; error in DOMDocument::registerNodeClass()) Previous Comments: ------------------------------------------------------------------------ [2015-09-23 10:22:27] sebastian@php.net Thank you, Arne, for providing the minimal, self-contained, reproducing test script. ------------------------------------------------------------------------ [2015-09-23 10:20:21] theseer@php.net The problem seems to get triggered by __clone() as the following stripped down example demonstrates: ----------- <?php class X extends \DOMDocument { public function __clone() { $this->registerNodeClass('DOMDocument', 'X'); } } $dom = clone (new X()); ----------- Interesting to me, but maybe totally unimportant, is the fact that it doesn't seem to matter wether the classname is hardcoded like in the above example or get_called_class() is used like in fDOMDocument's actual implementation. For what it's worth: The re-registering of the node classes is technically pointless in PHP though of course shouldn't crash. In the fDOMDocument implementation it happens only to work around an issue in hhvm (https://github.com/facebook/hhvm/issues/5412#issuecomment-106100644) ------------------------------------------------------------------------ [2015-09-23 09:39:19] sebastian@php.net Description: ------------ I am seeing weird "DOMDocument::registerNodeClass(): Couldn't fetch TheSeer\fDOM\fDOMDocument" errors when running the fDOMDocument test suite with PHP 7 (current PHP-7.0 branch, problem also present on master). The tests in question work fine with PHP 5.6. This is a regression from PHP 5 to PHP 7. At this time I do not have a minimal, self-contained, reproducing test script but I will try to provide one. Test script: --------------- $ git clone https://github.com/theseer/fDOMDocument.git $ cd fDOMDocument $ wget https://phar.phpunit.de/phpunit.phar $ php phpunit.phar --no-coverage Expected result: ---------------- PHPUnit 4.8.9 by Sebastian Bergmann and contributors. Runtime: PHP 5.6.13 with Xdebug 2.3.3 Configuration: /home/sb/fDOMDocument/phpunit.xml.dist ............................................................... 63 / 120 ( 52%) ......................................................... Time: 153 ms, Memory: 15.25Mb OK (120 tests, 168 assertions) Actual result: -------------- PHPUnit 4.8.9 by Sebastian Bergmann and contributors. Runtime: PHP 7.0.0-dev Configuration: /home/sb/fDOMDocument/phpunit.xml.dist ............................................................... 63 / 120 ( 52%) ................EEE...................................... Time: 420 ms, Memory: 10.00Mb There were 3 errors: 1) TheSeer\fDOM\Tests\fDOMDocumentTest::testCloningTriggersCreationOfNewDOMXPathInstance DOMDocument::registerNodeClass(): Couldn't fetch TheSeer\fDOM\fDOMDocument /home/sb/fDOMDocument/src/fDOMDocument.php:605 /home/sb/fDOMDocument/src/fDOMDocument.php:99 /home/sb/fDOMDocument/tests/fDOMDocument.test.php:278 2) TheSeer\fDOM\Tests\fDOMDocumentTest::testRegisteredNamespacePrefixesGetCopiedToClonedDocument DOMDocument::registerNodeClass(): Couldn't fetch TheSeer\fDOM\fDOMDocument /home/sb/fDOMDocument/src/fDOMDocument.php:605 /home/sb/fDOMDocument/src/fDOMDocument.php:99 /home/sb/fDOMDocument/tests/fDOMDocument.test.php:290 3) TheSeer\fDOM\Tests\fDOMDocumentTest::testQueryReturnsNodeFromClonedDocument DOMDocument::registerNodeClass(): Couldn't fetch TheSeer\fDOM\fDOMDocument /home/sb/fDOMDocument/src/fDOMDocument.php:605 /home/sb/fDOMDocument/src/fDOMDocument.php:99 /home/sb/fDOMDocument/tests/fDOMDocument.test.php:301 FAILURES! Tests: 120, Assertions: 165, Errors: 3. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70558&edit=1

« previous php.bugs (#196185) next »