Xsl dom objects free storage upd#21533
Merged
devnexen merged 1 commit intophp:masterfrom Mar 26, 2026
Merged
Conversation
ndossche
reviewed
Mar 26, 2026
| cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_R, NULL, &rv); | ||
| clone_docu = zend_is_true(cloneDocu); | ||
| zend_string_release_ex(member, 0); | ||
| cloneDocu = xsl_prop_clone_document(Z_OBJ_P(id)); |
Member
Author
There was a problem hiding this comment.
To avoid a zend_string allocation + property hash lookup per call. maxTemplateDepth and maxTemplateVars already use direct slot access via XSL_DEFINE_PROP_ACCESSOR —
this brings doXInclude and cloneDocument in line with the same pattern. but I put these in separate commit just in case :)
ndossche
approved these changes
Mar 26, 2026
ext/xsl/xsltprocessor.c
Outdated
| ctxt->xinclude = zend_is_true(doXInclude); | ||
| zend_string_release_ex(member, 0); | ||
| doXInclude = xsl_prop_do_xinclude(Z_OBJ_P(id)); | ||
| ctxt->xinclude = !Z_ISUNDEF_P(doXInclude) && zend_is_true(doXInclude); |
Member
There was a problem hiding this comment.
You don't need to check for Z_ISUNDEF_P, zend_is_true will do this properly.
ext/xsl/xsltprocessor.c
Outdated
| clone_docu = zend_is_true(cloneDocu); | ||
| zend_string_release_ex(member, 0); | ||
| cloneDocu = xsl_prop_clone_document(Z_OBJ_P(id)); | ||
| clone_docu = !Z_ISUNDEF_P(cloneDocu) && zend_is_true(cloneDocu); |
|
|
||
| XSL_DEFINE_PROP_ACCESSOR(max_template_depth, "maxTemplateDepth", 2) | ||
| XSL_DEFINE_PROP_ACCESSOR(max_template_vars, "maxTemplateVars", 3) | ||
| XSL_DEFINE_PROP_ACCESSOR(do_xinclude, "doXInclude", 0) |
Member
There was a problem hiding this comment.
I'd reorder these such that they last argument goes from 0 to 1 to 2 to 3.
… slot access for doXInclude and cloneDocument. The node and its document are validated before cloning, making the subsequent NULL checks on nodep and newdoc redundant. Use OBJ_PROP_NUM via XSL_DEFINE_PROP_ACCESSOR for doXInclude and cloneDocument, avoiding zend_string allocation and property hash lookup per call.
3b6d043 to
8b77a64
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.