Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 173599 - dev-lang/php - getParent isn't implemented in tidy
Summary: dev-lang/php - getParent isn't implemented in tidy
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-06 21:21 UTC by DocZico
Modified: 2007-05-07 22:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DocZico 2007-04-06 21:21:35 UTC
the function getparrent of tidy is'nt implemented so here's just a patch to fix that for php-5.1.6




Reproducible: Always



Expected Results:  
add this patch to the ebuild ... thanks

diff -urp php-5.1.6/ext/tidy/php_tidy.h php-5.1.6-tidy/ext/tidy/php_tidy.h
--- php-5.1.6/ext/tidy/php_tidy.h       2006-01-01 13:50:16.000000000 +0100
+++ php-5.1.6-tidy/ext/tidy/php_tidy.h  2007-04-06 21:40:15.000000000 +0200
@@ -89,6 +89,7 @@ TIDY_NODE_METHOD(isText);
 TIDY_NODE_METHOD(isJste);
 TIDY_NODE_METHOD(isAsp);
 TIDY_NODE_METHOD(isPhp);
+TIDY_NODE_METHOD(getParent);

 ZEND_BEGIN_MODULE_GLOBALS(tidy)
        char *default_config;
diff -urp php-5.1.6/ext/tidy/tidy.c php-5.1.6-tidy/ext/tidy/tidy.c
--- php-5.1.6/ext/tidy/tidy.c   2006-04-19 23:47:20.000000000 +0200
+++ php-5.1.6-tidy/ext/tidy/tidy.c      2007-04-06 21:40:15.000000000 +0200
@@ -308,6 +308,7 @@ zend_function_entry tidy_funcs_node[] =
        TIDY_NODE_ME(isJste, NULL)
        TIDY_NODE_ME(isAsp, NULL)
        TIDY_NODE_ME(isPhp, NULL)
+       TIDY_NODE_ME(getParent, NULL)
        {NULL, NULL, NULL}
 };

@@ -1719,6 +1720,30 @@ TIDY_NODE_METHOD(isPhp)
 }
 /* }}} */

+/* {{{ proto booleantidyNode::getParent()
+   Returns the parent node if available or NULL */
+TIDY_NODE_METHOD(getParent)
+{
+       TidyNode parent_node;
+       PHPTidyObj *newobj;
+       TIDY_FETCH_ONLY_OBJECT;
+
+       parent_node = tidyGetParent(obj->node);
+       if(parent_node) {
+           tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
+           newobj = (PHPTidyObj *)zend_object_store_get_object(return_value TSRMLS_CC);
+           newobj->node = parent_node;
+           newobj->type = is_node;
+           newobj->ptdoc = obj->ptdoc;
+           newobj->ptdoc->ref_count++;
+           tidy_add_default_properties(newobj, is_node TSRMLS_CC);
+       } else {
+           ZVAL_NULL(return_value);
+       }
+
+}
+/* }}} */
+
 static void _php_tidy_register_nodetypes(INIT_FUNC_ARGS)
 {
        TIDY_NODE_CONST(ROOT, Root);
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-04-07 06:25:42 UTC
This needs to be submitted upstream, please do it (they'll want patch against CVS trunk, not 5.1.6)
Comment 2 Luca Longinotti (RETIRED) gentoo-dev 2007-05-07 22:00:12 UTC
Indeed, if you want this functionality please report the patch upstream (php.net) and try to get it in for new PHP releases, if it's not already in 5.2, in that case just upgrade to 5.2. ;)
Best regards, CHTEKK.