-
Notifications
You must be signed in to change notification settings - Fork 8k
Xsl dom objects free storage upd #21533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,8 +167,7 @@ PHP_METHOD(XSLTProcessor, importStylesheet) | |
| xsltStylesheetPtr sheetp; | ||
| bool clone_docu = false; | ||
| xmlNode *nodep = NULL; | ||
| zval *cloneDocu, rv, clone_zv, owner_zv; | ||
| zend_string *member; | ||
| zval *cloneDocu, clone_zv, owner_zv; | ||
|
|
||
| id = ZEND_THIS; | ||
| if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &docp) == FAILURE) { | ||
|
|
@@ -216,15 +215,7 @@ PHP_METHOD(XSLTProcessor, importStylesheet) | |
| ZVAL_OBJ(&clone_zv, clone); | ||
| nodep = php_libxml_import_node(&clone_zv); | ||
|
|
||
| if (nodep) { | ||
| newdoc = nodep->doc; | ||
| } | ||
| if (newdoc == NULL) { | ||
| OBJ_RELEASE(clone); | ||
| zend_argument_type_error(1, "must be a valid XML node"); | ||
| RETURN_THROWS(); | ||
| } | ||
|
|
||
| newdoc = nodep->doc; | ||
| php_libxml_node_object *clone_lxml_obj = Z_LIBXML_NODE_P(&clone_zv); | ||
|
|
||
| PHP_LIBXML_SANITIZE_GLOBALS(parse); | ||
|
|
@@ -259,10 +250,8 @@ PHP_METHOD(XSLTProcessor, importStylesheet) | |
| intern->sheet_ref_obj->refcount++; | ||
| OBJ_RELEASE(clone); | ||
|
|
||
| member = ZSTR_INIT_LITERAL("cloneDocument", 0); | ||
| cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_R, NULL, &rv); | ||
| cloneDocu = xsl_prop_clone_document(Z_OBJ_P(id)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you change these?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid a zend_string allocation + property hash lookup per call. maxTemplateDepth and maxTemplateVars already use direct slot access via XSL_DEFINE_PROP_ACCESSOR — |
||
| clone_docu = zend_is_true(cloneDocu); | ||
| zend_string_release_ex(member, 0); | ||
| if (!clone_docu) { | ||
| /* Check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation. | ||
| * xsl:key elements may only occur at the top level. Furthermore, all elements at the top level must be in a | ||
|
|
@@ -302,8 +291,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl | |
| xmlNodePtr node = NULL; | ||
| xsltTransformContextPtr ctxt; | ||
| php_libxml_node_object *object; | ||
| zval *doXInclude, rv; | ||
| zend_string *member; | ||
| zval *doXInclude; | ||
| FILE *f; | ||
| int secPrefsError = 0; | ||
| xsltSecurityPrefsPtr secPrefs = NULL; | ||
|
|
@@ -359,10 +347,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl | |
| } | ||
| } | ||
|
|
||
| member = ZSTR_INIT_LITERAL("doXInclude", 0); | ||
| doXInclude = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_R, NULL, &rv); | ||
| doXInclude = xsl_prop_do_xinclude(Z_OBJ_P(id)); | ||
| ctxt->xinclude = zend_is_true(doXInclude); | ||
| zend_string_release_ex(member, 0); | ||
|
|
||
| zval *max_template_depth = xsl_prop_max_template_depth(Z_OBJ_P(id)); | ||
| ZEND_ASSERT(Z_TYPE_P(max_template_depth) == IS_LONG); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd reorder these such that they last argument goes from 0 to 1 to 2 to 3.