ID:               25775
 Updated by:       [EMAIL PROTECTED]
 Reported By:      thomas dot sattler at decon-network dot de
-Status:           Open
+Status:           Feedback
 Bug Type:         DOM XML related
 Operating System: Linux
 PHP Version:      4.3.3
 New Comment:

Can you try with a more recent libxml2 version?





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

[2003-10-08 06:26:18] thomas dot sattler at decon-network dot de

The Version of libxml is: 2.4.23 (20423)
DOM/XML API Version is: 20020815 
System:
Linux <servername> 2.4.19-64GB-SMP #1 SMP Mon Aug 4 23:48:22 UTC 2003
i686

It's interesting too that there occurs no error message and the value
of the namespace register variable 
$reg_succ_p is 1 (I think this means success).

Finally: with PHP version 4.2.2 the problem didn't appear.

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

[2003-10-08 06:08:06] [EMAIL PROTECTED]

Propably should ask what libxml version is used?


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

[2003-10-08 05:14:08] [EMAIL PROTECTED]

Works for me with:

PHP 4.3.4-dev (cli) on Linux
and
PHP 4.3.2-RC3-dev (cli) on OS X

chregu

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

[2003-10-07 06:16:07] thomas dot sattler at decon-network dot de

Description:
------------
If you whrite a string like "http://..."; or 'http://...' into the
xpath_register_ns function there will occur a problem with a
stringlength between 16 and 23 characters and also between 40 and 47
characters.
Example:
$ctx->xpath_register_ns ("pre", 'http://www.xyz.de/');

The result is the same when the registered uri differs from the uri in
the XML-file: 
There is no result object if evaluate an xpath with the registered
namespace (like "/pre:foo").

If you define the uri in a variable (i.e. $uri) and write the
xpath_register_ns() function with all is fine.

Reproduce code:
---------------
<?PHP
$s = '<?xml version="1.0" ?>';
$s .= '<test:foo xmlns:test="http://www.xyz.de/abc.xyz";>';
$s .= '<test:bar>abc';
$s .= '</test:bar>';
$s .= '</test:foo>';
// namespace uri as string
$doc = domxml_open_mem($s); 
$ctx_p = xpath_new_context($doc);
$reg_succ_p = $ctx_p->xpath_register_ns ("test",
'http://www.xyz.de/abc.xyz');
$p = xpath_eval($ctx_p, '/test:foo/test:bar');

$uri="http://www.xyz.de/abc.xyz";; //namespace uri in $uri
$ctx_q = xpath_new_context($doc);
$reg_succ_q = $ctx_q->xpath_register_ns("test", $uri);
$q = xpath_eval($ctx_q, '/test:foo/test:bar');

echo '<PRE><br>$p: ';    print_r($p);
echo '<br>$q: ';    print_r($q);
echo "</PRE>";
?>

Expected result:
----------------
Both xpath_eval commands shood produce the same result:

The expected output is:

$p: XPathObject Object
(
    [type] => 1
    [nodeset] => Array
        (
            [0] => domelement Object
                (
                    [type] => 1
                    [tagname] => bar
                    [0] => 4
                    [1] => 135761016
                )

        )

)
$q: XPathObject Object
(
    [type] => 1
    [nodeset] => Array
        (
            [0] => domelement Object
                (
                    [type] => 1
                    [tagname] => bar
                    [0] => 4
                    [1] => 135761016
                )

        )

)


Actual result:
--------------
Only the second xpath evaluation where the registered uri is given as
variable ($uri) is successful.
$p: 
$q: XPathObject Object
(
    [type] => 1
    [nodeset] => Array
        (
            [0] => domelement Object
                (
                    [type] => 1
                    [tagname] => bar
                    [0] => 5
                    [1] => 136278112
                )

        )

)



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


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

Reply via email to