php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62190 Couldn't fetch DOMProcessingInstruction�� with APC and native obj (DOMDocume
Submitted: 2012-05-30 12:09 UTC Modified: 2012-07-20 21:31 UTC
Votes:222
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: cschneid at cschneid dot com Assigned: rasmus (profile)
Status: Closed Package: APC (PECL)
PHP Version: 5.4.4RC1 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cschneid at cschneid dot com
New email:
PHP Version: OS:

 

 [2012-05-30 12:09 UTC] cschneid at cschneid dot com
Description:
------------
Problem with APC (tested 3.1.10 and trunk) with native object, in this case DOMDocument.

I suspect this is related to the bugs
https://bugs.php.net/bug.php?id=61824
https://bugs.php.net/bug.php?id=61912
https://bugs.php.net/bug.php?id=61956
but I'm not sure how to check this and those bugs have not been assigned to anyone yet.

Any hint on how to help debugging this is welcome, I'm stuck here.

Test script:
---------------
<?php
$node = new DOMDocument;
$node->loadHTML('<?foo>');
echo $node->firstChild->nextSibling->nodeType;


Expected result:
----------------
7

Actual result:
--------------
PHP:
Warning: Couldn't fetch DOMProcessingInstruction��{. Node no longer exists in /www/lib.search.ch/doc/t.php on line 5

Patches

patch-apc-interned_string.patch (last revision 2012-05-31 17:29 UTC by cschneid at cschneid dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-31 13:43 UTC] cschneid at cschneid dot com
Some progress: I tracked down the problem into apc_interned_strings_init, if I disabled the overloading of the zend interned_strings_* functions then the problem does not show up.

If anyone knows more about interned strings feel free to contact me :-)
 [2012-05-31 14:44 UTC] cschneid at cschneid dot com
Hmm, the apc_interned_strings_init relation could be a side-effect of some memory trashing as I couldn't find a problem with it yet and even though the little test script runs with disabled apc_interned_strings_init the server will crash on bigger scripts because of the missing initialization
 [2012-05-31 17:31 UTC] cschneid at cschneid dot com
The problem is that APC does not null-terminate the internalized strings while Zend seems to ensure null-termination.
The DOM extension (wrongly?) relies on the null-termination with class names (strcmp etc.) and thus triggers the problem.
I added a patch which makes sure internalized strings are again null-terminated.
 [2012-06-11 04:02 UTC] rasmus@php.net
The null-string patch has been applied, so this can be closed now.
 [2012-06-11 04:02 UTC] rasmus@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: rasmus
 [2012-06-29 17:14 UTC] rasmus@php.net
-Status: Closed +Status: Re-Opened
 [2012-06-29 17:14 UTC] rasmus@php.net
I think we are still missing a case where interned strings are not being null-
terminated. See bug #62442
 [2012-07-20 18:54 UTC] ab@php.net
Automatic comment from SVN on behalf of ab
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=326744
Log: added test for bug #62190
 [2012-07-20 21:31 UTC] ab@php.net
-Status: Re-Opened +Status: Closed
 [2012-07-20 21:31 UTC] ab@php.net
A test for this issue was supplied, this should be fixed with APC 3.1.11 now.
 [2013-04-04 01:02 UTC] mi+php at aldan dot algebra dot com
This test is among the few, that fail, when building against php-5.4.13 (RHEL-5.7, 64-bit):

FAILED TEST SUMMARY
---------------------------------------------------------------------
APC: Bug #62190 Couldn't fetch DOMProcessingInstruction with APC and native obj (php 5.4 nts) [tests/apc54_003.phpt]
APC: Bug #62456 Incorrect description of notice variation 1 (php 5.4 nts) [tests/apc54_004.phpt]
APC: Bug #61912 Memory corruption in ext/dom (php 5.4) [tests/apc54_008.phpt]
APC: Bug #61824 apc produces strange notice (php 5.4) [tests/apc54_009.phpt]
APC: Bug #59938 APCIterator fails with large user cache [tests/apc54_018.phpt]
Trying to exclude trait method multiple times (origin Zend/tests/traits/error_010.phpt) [tests/apc54_error_010.phpt]
Exclude trait method [tests/apc54_error_010_2.phpt]
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 07:02:12 2024 UTC