This was a MFH

-Hannes

On 8/5/07, Jani Taskinen <[EMAIL PROTECTED]> wrote:
> Isn't this fix necessary for HEAD?
>
> --Jani
>
> Rob Richards kirjoitti:
> > rrichards             Mon Jul 30 16:33:22 2007 UTC
> >
> >   Modified files:              (Branch: PHP_5_2)
> >     /php-src/ext/xsl  xsltprocessor.c
> >   Log:
> >   allow user specified class to be returned from transformToDoc
> >
> > http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/xsltprocessor.c?r1=1.39.2.2.2.8&r2=1.39.2.2.2.9&diff_format=u
> > Index: php-src/ext/xsl/xsltprocessor.c
> > diff -u php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.8 
> > php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.9
> > --- php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.8      Mon Jan  1 09:36:10 
> > 2007
> > +++ php-src/ext/xsl/xsltprocessor.c   Mon Jul 30 16:33:22 2007
> > @@ -17,7 +17,7 @@
> >     +----------------------------------------------------------------------+
> >  */
> >
> > -/* $Id: xsltprocessor.c,v 1.39.2.2.2.8 2007/01/01 09:36:10 sebastian Exp $ 
> > */
> > +/* $Id: xsltprocessor.c,v 1.39.2.2.2.9 2007/07/30 16:33:22 rrichards Exp $ 
> > */
> >
> >  #ifdef HAVE_CONFIG_H
> >  #include "config.h"
> > @@ -505,21 +505,49 @@
> >       zval *id, *rv = NULL, *docp = NULL;
> >       xmlDoc *newdocp;
> >       xsltStylesheetPtr sheetp;
> > -     int ret;
> > +     int ret, ret_class_len=0;
> > +     char *ret_class = NULL;
> >       xsl_object *intern;
> > -
> > +
> >       id = getThis();
> >       intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC);
> >       sheetp = (xsltStylesheetPtr) intern->ptr;
> >
> > -     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &docp) == 
> > FAILURE) {
> > +     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s!", &docp, 
> > &ret_class, &ret_class_len) == FAILURE) {
> >               RETURN_FALSE;
> >       }
> >
> >       newdocp = php_xsl_apply_stylesheet(id, intern, sheetp, docp 
> > TSRMLS_CC);
> >
> >       if (newdocp) {
> > -             DOM_RET_OBJ(rv, (xmlNodePtr) newdocp, &ret, NULL);
> > +             if (ret_class) {
> > +                     int found;
> > +                     char *curclass_name;
> > +                     zend_class_entry *curce, **ce;
> > +                     php_libxml_node_object *interndoc;
> > +
> > +                     curce = Z_OBJCE_P(docp);
> > +                     curclass_name = curce->name;
> > +                     while (curce->parent != NULL) {
> > +                             curce = curce->parent;
> > +                     }
> > +
> > +                     found = zend_lookup_class(ret_class, ret_class_len, 
> > &ce TSRMLS_CC);
> > +                     if ((found != SUCCESS) || !instanceof_function(*ce, 
> > curce TSRMLS_CC)) {
> > +                             xmlFreeDoc(newdocp);
> > +                             php_error_docref(NULL TSRMLS_CC, E_WARNING,
> > +                                     "Expecting class compatible with %s, 
> > '%s' given", curclass_name, ret_class);
> > +                             RETURN_FALSE;
> > +                     }
> > +
> > +                     object_init_ex(return_value, *ce);
> > +
> > +                     interndoc = (php_libxml_node_object 
> > *)zend_objects_get_address(return_value TSRMLS_CC);
> > +                     php_libxml_increment_doc_ref(interndoc, newdocp 
> > TSRMLS_CC);
> > +                     php_libxml_increment_node_ptr(interndoc, 
> > (xmlNodePtr)newdocp, (void *)interndoc TSRMLS_CC);
> > +             } else {
> > +                     DOM_RET_OBJ(rv, (xmlNodePtr) newdocp, &ret, NULL);
> > +             }
> >       } else {
> >               RETURN_FALSE;
> >       }
> >
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to