ID:               33299
 Updated by:       [EMAIL PROTECTED]
 Reported By:      clicknmix at gmail dot com
 Status:           Feedback
 Bug Type:         XSLT related
 Operating System: Linux
 PHP Version:      5.0.4
 New Comment:

Rob asked me to look at this...

it looks like the variables are not declared properly in
ext/dom/xml_common.h.

#define PHP_DOM_EXPORT(__type) PHPAPI __type
...
PHP_DOM_EXPORT(zend_class_entry *) dom_node_class_entry;

results in
zend_class_entry *dom_class_entry;

rather than the desired

extern zend_class_entry *dom_class_entry;

when included by xsltprocessor.c.  The former just defines a new global
variable in the BSS which is not going to work at all.  I'm testing a
patch.




Previous Comments:
------------------------------------------------------------------------

[2005-06-19 23:19:17] jon at dsvr dot co dot uk

On a hunch, I patched the .spec file from the Redhat-provided RPM to
build XSL and DOM support statically, instead of as a shared library,
and this test fragment of code works.  

I hope the debugging I've done gives someone with a bit more knowledge
of this code enough information to get this cracked.

------------------------------------------------------------------------

[2005-06-19 16:54:07] jon at dsvr dot co dot uk

In fact, something quite strange appears to be happening.

instanceof_function is called from xsltprocessor.c:281.  At this point
dom_node_class_entry is not null.

At a breakpoint in instanceof_function (zend_operators.c:1581),
instance_ce and ce are equal (we can see therefore that this test
should go on to succeed).

instanceof_function calls instanceof_function_ex.  At a breakpoint in
this function, (zend_operators.c:1560), instance_ce has apparently been
passed correctly, but ce is now null, and the function goes on to return
0.

Looks like there could be some stack breakage going on here.  Any
suggestions welcome.

------------------------------------------------------------------------

[2005-06-19 16:38:56] jon at dsvr dot co dot uk

I've done a bit more digging and poking with gdb.

It looks to be the case that when instanceof_function is called from
xsltprocessor.c:281, zend_class_entry *ce is NULL, and so the
instanceof test fails.  Something seems wrong with
dom_node_class_entry.

------------------------------------------------------------------------

[2005-06-17 17:41:46] jon at dsvr dot co dot uk

The following code:

    function myxml ($Value="default")
    {
            $dom = new domdocument();
            $dom->loadXML("<root>this is from an external    
DomDocument - $Value</root>");
            return $dom;
    }

    print debug_zval_dump(myxml(''));

yields:

    object(DOMDocument)#1 (0) refcount(1){
    }

I haven't yet managed to get gdb attached happily to this build of PHP;
having trouble with loadable modules.

It's worth noting that the stock PHP 5.0.4 that comes with Fedora Core
4 demonstrates this problem, if anyone's looking for basic install to
test with.

------------------------------------------------------------------------

[2005-06-15 17:37:56] [EMAIL PROTECTED]

Taking XSL out of the equation, what is returned directly from the
calling the myxml function? I cant reproduce this either (tested on
linux and windows). If the myxml function works, try building in debug
mode and set a breakpoint in the xsl extension to find out what type of
object it thinks is being returned there.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/33299

-- 
Edit this bug report at http://bugs.php.net/?id=33299&edit=1

Reply via email to