Re: [PHP-DEV] ext/dom/php_domxml.c patch

2001-07-11 Thread Joey Smith

Well, xmldocfile() is fixed in HEAD, and I'm closing in on some memory
leaks...Paul, if possible, I may want to collaborate with you some,
because we seem to be working in the same areas of the code, and I could
use the help.

On Wed, 11 Jul 2001, Andi Gutmans wrote the following to Paul Marquis and...:

 At 07:00 PM 7/10/2001 -0400, Paul Marquis wrote:
 Attached is a patch to ext/dom/php_domxml.c that adds the ability to
 set the context node when running xpath_eval().  xpath_eval() (and
 xpath_eval_expression()) can now accept and optional second parameter
 that is the context node.  If no argument is specified, it works as
 before.
 
 This patch is against the head of the CVS tree.  I also have a patch
 for the 4.0.6 version of this file for those who need/want it.
 
 BTW, has a decision been made about what interface to domxml will be
 in the next release of PHP?
 
 This is a good question. For 4.0.6 we rolled back DOM/XML. What do you 
 think should be done for 4.0.7? Will 4.0.6 users be able to upgrade? What 
 is the status of the module today vs. before?
 
 Andi
 
 
 


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] ext/dom/php_domxml.c patch

2001-07-11 Thread Andi Gutmans

Paul,

I suggest you work with Joey on this and have him look at the patch. It 
sounds as if he knows what's happening in DOM/XML unlike me who has never 
messed with that module :)

Andi

At 10:20 AM 7/11/2001 -0600, Joey Smith wrote:
Well, xmldocfile() is fixed in HEAD, and I'm closing in on some memory
leaks...Paul, if possible, I may want to collaborate with you some,
because we seem to be working in the same areas of the code, and I could
use the help.

On Wed, 11 Jul 2001, Andi Gutmans wrote the following to Paul Marquis and...:

  At 07:00 PM 7/10/2001 -0400, Paul Marquis wrote:
  Attached is a patch to ext/dom/php_domxml.c that adds the ability to
  set the context node when running xpath_eval().  xpath_eval() (and
  xpath_eval_expression()) can now accept and optional second parameter
  that is the context node.  If no argument is specified, it works as
  before.
  
  This patch is against the head of the CVS tree.  I also have a patch
  for the 4.0.6 version of this file for those who need/want it.
  
  BTW, has a decision been made about what interface to domxml will be
  in the next release of PHP?
 
  This is a good question. For 4.0.6 we rolled back DOM/XML. What do you
  think should be done for 4.0.7? Will 4.0.6 users be able to upgrade? What
  is the status of the module today vs. before?
 
  Andi
 
 
 


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] ext/dom/php_domxml.c patch

2001-07-10 Thread Paul Marquis

Attached is a patch to ext/dom/php_domxml.c that adds the ability to 
set the context node when running xpath_eval().  xpath_eval() (and 
xpath_eval_expression()) can now accept and optional second parameter 
that is the context node.  If no argument is specified, it works as 
before.

This patch is against the head of the CVS tree.  I also have a patch 
for the 4.0.6 version of this file for those who need/want it.

BTW, has a decision been made about what interface to domxml will be 
in the next release of PHP?

-- 
Paul Marquis
[EMAIL PROTECTED]


Index: php_domxml.c
===
RCS file: /repository/php4/ext/domxml/php_domxml.c,v
retrieving revision 1.40
diff -u -r1.40 php_domxml.c
--- php_domxml.c8 Jul 2001 00:54:25 -   1.40
+++ php_domxml.c10 Jul 2001 21:34:10 -
@@ -2456,19 +2456,37 @@
 
 static void php_xpathptr_eval(INTERNAL_FUNCTION_PARAMETERS, int mode, int expr)
 {
-   zval *id, *str, *rv;
+   zval *id, *str, *contextnode, *rv;
xmlXPathContextPtr ctxp;
xmlXPathObjectPtr xpathobjp;
+xmlNode *contextnodep;
int ret;

-   if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, str) == FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
+contextnode = NULL;
+contextnodep = NULL;
+switch (ZEND_NUM_ARGS()) {
+case 1:
+if (getParameters(ht, 1, str) == FAILURE) {
+WRONG_PARAM_COUNT;
+}
+break;
+case 2:
+if (getParameters(ht, 2, str, contextnode) == FAILURE) {
+WRONG_PARAM_COUNT;
+}
+break;
+default:
+WRONG_PARAM_COUNT;
+}
 
id = getThis();
ctxp = php_xpath_get_context(id, le_xpathctxp, 0);
convert_to_string(str);
 
+if (contextnode) {
+contextnodep = php_dom_get_object(contextnode, le_domxmlnodep, 0);
+}
+ctxp-node = contextnodep;
 #if defined(LIBXML_XPTR_ENABLED)
if(mode == PHP_XPTR) {
xpathobjp = xmlXPtrEval(BAD_CAST str-value.str.val, ctxp);
@@ -2481,7 +2499,7 @@
 #if defined(LIBXML_XPTR_ENABLED)
}
 #endif
-   
+ctxp-node = NULL;
if (!xpathobjp) {
RETURN_FALSE;
}


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP-DEV] ext/dom/php_domxml.c patch

2001-07-10 Thread Andi Gutmans

At 07:00 PM 7/10/2001 -0400, Paul Marquis wrote:
Attached is a patch to ext/dom/php_domxml.c that adds the ability to
set the context node when running xpath_eval().  xpath_eval() (and
xpath_eval_expression()) can now accept and optional second parameter
that is the context node.  If no argument is specified, it works as
before.

This patch is against the head of the CVS tree.  I also have a patch
for the 4.0.6 version of this file for those who need/want it.

BTW, has a decision been made about what interface to domxml will be
in the next release of PHP?

This is a good question. For 4.0.6 we rolled back DOM/XML. What do you 
think should be done for 4.0.7? Will 4.0.6 users be able to upgrade? What 
is the status of the module today vs. before?

Andi


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] ext/dom/php_domxml.c patch

2001-07-10 Thread Paul Marquis

On Wednesday 11 July 2001 00:54, Andi Gutmans wrote:
 At 07:00 PM 7/10/2001 -0400, Paul Marquis wrote:
 Attached is a patch to ext/dom/php_domxml.c that adds the ability
  to set the context node when running xpath_eval().  xpath_eval()
  (and xpath_eval_expression()) can now accept and optional second
  parameter that is the context node.  If no argument is specified,
  it works as before.
 
 This patch is against the head of the CVS tree.  I also have a
  patch for the 4.0.6 version of this file for those who need/want
  it.
 
 BTW, has a decision been made about what interface to domxml will
  be in the next release of PHP?

 This is a good question. For 4.0.6 we rolled back DOM/XML. What do
 you think should be done for 4.0.7? Will 4.0.6 users be able to
 upgrade? What is the status of the module today vs. before?

Well, the first thing you need to do is commit my patch.  :-P

The code at the head of the tree is a lot cleaner and fixes many 
memory leaks from the version in 4.0.6.  However, backward 
compatability is not preserved, though I think it can be added back 
with a little work while preserving the new API.  I have a few nits 
with the new API, such as not all the DOM objects set the type field 
making tree traversal semi-problematic, but I like the OO interface 
much better.

FWIW, when we upgraded to PHP 4.0.6, we opted to gut the packaged 
DOM/XML extension in favor of the version at the head of the tree 
because there were too many bugs in the packaged version.  As we were 
early in our development cycle, we didn't have much code to convert.

I'd be willing to help out in any way I can to bring this module up 
to snuff.

-- 
Paul Marquis
[EMAIL PROTECTED]

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]