php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14469 xpath_new_context fails to create context object
Submitted: 2001-12-12 16:03 UTC Modified: 2001-12-12 20:01 UTC
From: jwarrington at getrelevant dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.1.0 OS: Linux 2.4.16
Private report: No CVE-ID: None
 [2001-12-12 16:03 UTC] jwarrington at getrelevant dot com
The xpath_new_context function is failing to create a new context object for the XPath functions. The following code snippet works fine in php 4.0.6

xmlfile:

<?xml version="1.0" encoding="ISO-8859-1"?>

<partner id="2" type="P" active="1" simple="0" template="0" image_size="0" button_type="B">
  <timestamp>1008124281</timestamp>
  <name>MagazineOutlet.com</name>
  <bounty_cut>0.000000e+0</bounty_cut>
  <domain_name></domain_name>
</partner>

phpfile (where the above XML file is referenced
below as '2.xml'):

<?php

$xpathString = "/partner/name";
$filename = XML_FILEPATH."partner/2.xml";
$xmlDoc = xmldocfile($filename);
$xpathContextObj = xpath_new_context($xmlDoc);
var_dump($xpathContextObj);

?>

The above delivers this in PHP 4.0.6:

object(XPathContext)(1) {
  ["xpathctx"]=>
  resource(2) of type (xpath context)
}

and this in PHP 4.1.0:

bool(false)

Here are the compile settings for PHP and
Apache (compiled directly into Apache):

PHP

./configure --with-apache=../apache_1.3.22
--enable-track-vars 
--with-xml 
--with-dom 
--with-ibm-db2=/usr/IBMdb2/V6.1 
--with-zlib 
--enable-xslt 
--with-xslt-sablot 
--enable-sablot-errors-descriptive --enable-inline-optimization --with-config-file-path=/opt/gr/oas/lib/ 
--enable-sysvshm 
--with-curl=/usr/local 
--without-mysql 
--with-pgsql=/usr 
--enable-trans-sid 
--with-expat-dir=/usr

Apache

./configure \
"--with-layout=Apache" \
"--prefix=/opt/gr/oas/apache/" \
"--disable-rule=EXPAT" \
"--enable-module=rewrite" \
"--enable-module=ssl" \
"--activate-module=src/modules/php4/libphp4.a" \
"--enable-module=php4" \
"--enable-module=expires" \
"--disable-module=include" \
"$@"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-12 20:01 UTC] mfischer@php.net
This is a known missbehaviour and already fixed in CVS.

You'll have to use $xmldoc->xpath_new_context();

Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC