Skip to content

Field cleanups in xsl_object #13182

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

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ext/xsl/php_xsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ extern zend_module_entry xsl_module_entry;
#define XSL_SECPREF_CREATE_DIRECTORY 8
#define XSL_SECPREF_READ_NETWORK 16
#define XSL_SECPREF_WRITE_NETWORK 32
/* Default == disable all write access == XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE */
#define XSL_SECPREF_DEFAULT 44
/* Default == disable all write access */
#define XSL_SECPREF_DEFAULT (XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE)

typedef struct _xsl_object {
void *ptr;
HashTable *parameter;
int hasKeys;
int securityPrefsSet;
bool hasKeys;
zend_long securityPrefs;
php_dom_xpath_callbacks xpath_callbacks;
php_libxml_node_object *doc;
Expand Down
8 changes: 3 additions & 5 deletions ext/xsl/xsltprocessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ PHP_METHOD(XSLTProcessor, importStylesheet)
if (nodep && (nodep = nodep->children)) {
while (nodep) {
if (nodep->type == XML_ELEMENT_NODE && xmlStrEqual(nodep->name, (const xmlChar *) "key") && xmlStrEqual(nodep->ns->href, XSLT_NAMESPACE)) {
intern->hasKeys = 1;
intern->hasKeys = true;
break;
}
nodep = nodep->next;
}
}
} else {
intern->hasKeys = clone_docu;
intern->hasKeys = true;
}

if ((oldsheetp = (xsltStylesheetPtr)intern->ptr)) {
Expand Down Expand Up @@ -257,7 +257,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
intern->doc = emalloc(sizeof(php_libxml_node_object));
memset(intern->doc, 0, sizeof(php_libxml_node_object));

if (intern->hasKeys == 1) {
if (intern->hasKeys) {
doc = xmlCopyDoc(doc, 1);
} else {
object = Z_LIBXML_NODE_P(docp);
Expand Down Expand Up @@ -681,8 +681,6 @@ PHP_METHOD(XSLTProcessor, setSecurityPrefs)
intern = Z_XSL_P(id);
oldSecurityPrefs = intern->securityPrefs;
intern->securityPrefs = securityPrefs;
/* set this to 1 so that we know, it was set through this method. Can be removed, when we remove the ini setting */
intern->securityPrefsSet = 1;
RETURN_LONG(oldSecurityPrefs);
}
/* }}} end XSLTProcessor::setSecurityPrefs */
Expand Down