Skip to content

Commit 76a3edd

Browse files
authored
Field cleanups in xsl_object (#13182)
1 parent 569da8a commit 76a3edd

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

ext/xsl/php_xsl.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,13 @@ extern zend_module_entry xsl_module_entry;
4949
#define XSL_SECPREF_CREATE_DIRECTORY 8
5050
#define XSL_SECPREF_READ_NETWORK 16
5151
#define XSL_SECPREF_WRITE_NETWORK 32
52-
/* Default == disable all write access == XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE */
53-
#define XSL_SECPREF_DEFAULT 44
52+
/* Default == disable all write access */
53+
#define XSL_SECPREF_DEFAULT (XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE)
5454

5555
typedef struct _xsl_object {
5656
void *ptr;
5757
HashTable *parameter;
58-
int hasKeys;
59-
int securityPrefsSet;
58+
bool hasKeys;
6059
zend_long securityPrefs;
6160
php_dom_xpath_callbacks xpath_callbacks;
6261
php_libxml_node_object *doc;

ext/xsl/xsltprocessor.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@ PHP_METHOD(XSLTProcessor, importStylesheet)
181181
if (nodep && (nodep = nodep->children)) {
182182
while (nodep) {
183183
if (nodep->type == XML_ELEMENT_NODE && xmlStrEqual(nodep->name, (const xmlChar *) "key") && xmlStrEqual(nodep->ns->href, XSLT_NAMESPACE)) {
184-
intern->hasKeys = 1;
184+
intern->hasKeys = true;
185185
break;
186186
}
187187
nodep = nodep->next;
188188
}
189189
}
190190
} else {
191-
intern->hasKeys = clone_docu;
191+
intern->hasKeys = true;
192192
}
193193

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

260-
if (intern->hasKeys == 1) {
260+
if (intern->hasKeys) {
261261
doc = xmlCopyDoc(doc, 1);
262262
} else {
263263
object = Z_LIBXML_NODE_P(docp);
@@ -681,8 +681,6 @@ PHP_METHOD(XSLTProcessor, setSecurityPrefs)
681681
intern = Z_XSL_P(id);
682682
oldSecurityPrefs = intern->securityPrefs;
683683
intern->securityPrefs = securityPrefs;
684-
/* set this to 1 so that we know, it was set through this method. Can be removed, when we remove the ini setting */
685-
intern->securityPrefsSet = 1;
686684
RETURN_LONG(oldSecurityPrefs);
687685
}
688686
/* }}} end XSLTProcessor::setSecurityPrefs */

0 commit comments

Comments
 (0)