]> granicus.if.org Git - php/commitdiff
Remove xsl.security_prefs ini option
authorNikita Popov <nikic@php.net>
Wed, 10 Sep 2014 16:06:21 +0000 (18:06 +0200)
committerNikita Popov <nikic@php.net>
Mon, 9 Mar 2015 10:06:18 +0000 (11:06 +0100)
Conflicts:
ext/xsl/php_xsl.c
ext/xsl/xsltprocessor.c

NEWS
UPGRADING
ext/xsl/php_xsl.c
ext/xsl/tests/bug54446_with_ini.phpt
ext/xsl/xsltprocessor.c

diff --git a/NEWS b/NEWS
index d0d16b8e91c5dc0bea8756bba1db73f531a018bd..3cf7c963145cb631e9dbffba52733b1edfa297ce 100644 (file)
--- a/NEWS
+++ b/NEWS
 
 - XSL:
   . Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
+  . Removed xsl.security_prefs ini option. (Nikita)
 
 <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
index 3e6c5501438668c5489215a0e023deab4257fbe9..3291e0cb3184a9f07796fe4800e23d564161cc18 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -395,6 +395,10 @@ Other
 - Stream:
   . Removed set_socket_blocking() in favor of its alias stream_set_blocking().
 
+- XSL:
+  . Removed xsl.security_prefs ini option. Use XsltProcessor::setSecurityPrefs()
+    instead.
+
 ========================================
 2. New Features
 ========================================
index 793c0fc6db1141d4d73cf80eb3a46ddf0926b398..d89b4cbd33f60aabbfd346832dc1a1102ad4c09f 100644 (file)
@@ -129,13 +129,6 @@ zend_object *xsl_objects_new(zend_class_entry *class_type)
 }
 /* }}} */
 
-PHP_INI_BEGIN()
-/* Default is not allowing any write operations.
-   XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_WRITE_FILE == 44
-*/
-PHP_INI_ENTRY("xsl.security_prefs", "44", PHP_INI_ALL, NULL)
-PHP_INI_END()
-
 /* {{{ PHP_MINIT_FUNCTION
  */
 PHP_MINIT_FUNCTION(xsl)
@@ -181,8 +174,6 @@ PHP_MINIT_FUNCTION(xsl)
        REGISTER_STRING_CONSTANT("LIBEXSLT_DOTTED_VERSION",  LIBEXSLT_DOTTED_VERSION,     CONST_CS | CONST_PERSISTENT);
 #endif
 
-    REGISTER_INI_ENTRIES();
-
        return SUCCESS;
 }
 /* }}} */
@@ -260,8 +251,6 @@ PHP_MSHUTDOWN_FUNCTION(xsl)
        xsltSetGenericErrorFunc(NULL, NULL);
        xsltCleanupGlobals();
 
-       UNREGISTER_INI_ENTRIES();
-
        return SUCCESS;
 }
 /* }}} */
index fbe03659d325ccf923facd139bc3df597291a3c0..9edc8b38f39a9438664e560a5f2fa1d3ed70f0e4 100644 (file)
@@ -44,9 +44,9 @@ if (file_exists($outputfile)) {
 }
 
 #SET NO SECURITY PREFS
-ini_set("xsl.security_prefs", XSL_SECPREF_NONE);
+$proc->setSecurityPrefs(XSL_SECPREF_NONE);
 
-# TRASNFORM & PRINT 
+# TRANSFORM & PRINT 
 print $proc->transformToXML( $dom ); 
 
 
@@ -59,9 +59,9 @@ if (file_exists($outputfile)) {
 unlink($outputfile);
 
 #SET SECURITY PREFS AGAIN
-ini_set("xsl.security_prefs", XSL_SECPREF_WRITE_FILE |  XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY);
+$proc->setSecurityPrefs(XSL_SECPREF_WRITE_FILE | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY);
 
-# TRASNFORM & PRINT 
+# TRANSFORM & PRINT 
 print $proc->transformToXML( $dom ); 
 
 if (file_exists($outputfile)) {
@@ -70,31 +70,7 @@ if (file_exists($outputfile)) {
     print "OK, no file created\n";
 }
 
-#SET NO SECURITY PREFS with ini, but set them with ->setSecurityPrefs
-ini_set("xsl.security_prefs", XSL_SECPREF_NONE);
-$proc->setSecurityPrefs( XSL_SECPREF_WRITE_FILE |  XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY);
-
-print $proc->transformToXML( $dom ); 
-if (file_exists($outputfile)) {
-    print "$outputfile exists, but shouldn't!\n";
-} else {
-    print "OK, no file created\n";
-}
-
-#don't throw a warning if both ini and through-the-method have the same value
-$proc->setSecurityPrefs(XSL_SECPREF_NONE);
-
-print $proc->transformToXML( $dom ); 
-
-if (file_exists($outputfile)) {
-    print "OK, file exists\n";
-} else {
-    print "$outputfile doesn't exist, but should!\n";
-}
-unlink($outputfile);
-
-
-
+?>
 --EXPECTF--
 Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %s element output in %s on line %d
 
@@ -104,8 +80,6 @@ Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d element
 
 Warning: XSLTProcessor::transformToXml(): xsltDocumentElem: write rights for %s/bug54446test.txt denied in %s on line %d
 OK, no file created
-
-Deprecated: XSLTProcessor::transformToXml(): The xsl.security_prefs php.ini option is deprecated; use XsltProcessor->setSecurityPrefs() instead in %s on line %d
 OK, file exists
 
 Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %s element output in %s on line %d
@@ -116,20 +90,6 @@ Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d element
 
 Warning: XSLTProcessor::transformToXml(): xsltDocumentElem: write rights for %s/bug54446test.txt denied in %s on line %d
 OK, no file created
-
-Deprecated: XSLTProcessor::transformToXml(): The xsl.security_prefs php.ini option is deprecated; use XsltProcessor->setSecurityPrefs() instead in %s on line %d
-
-Notice: XSLTProcessor::transformToXml(): The xsl.security_prefs php.ini was not used, since the  XsltProcessor->setSecurityPrefs() method was used in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %s element output in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): File write for %s/bug54446test.txt refused in %s on line %s
-
-Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d element output in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): xsltDocumentElem: write rights for %s/bug54446test.txt denied in %s on line %d
-OK, no file created
-OK, file exists
 --CREDITS--
 Christian Stocker, chregu@php.net
 
index 6b97dca4dc17cbc362d0c49d65c43eb42947f8f5..553836b8c5a95ec4a264c92d6d4399e229afbf68 100644 (file)
@@ -483,7 +483,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
        zend_object_handlers *std_hnd;
        FILE *f;
        int secPrefsError = 0;
-       int secPrefsValue, secPrefsIni;
+       int secPrefsValue;
        xsltSecurityPrefsPtr secPrefs = NULL;
 
        node = php_libxml_import_node(docp);
@@ -542,23 +542,6 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
 
        secPrefsValue = intern->securityPrefs;
 
-       /* This whole if block can be removed, when we remove the xsl.security_prefs php.ini option in PHP 6+ */
-       secPrefsIni= INI_INT("xsl.security_prefs");
-       /* if secPrefsIni has the same value as secPrefsValue, all is fine */
-       if (secPrefsIni != secPrefsValue) {
-               if (secPrefsIni != XSL_SECPREF_DEFAULT) {
-                       /* if the ini value is not set to the default, throw an E_DEPRECATED warning */
-                       php_error_docref(NULL, E_DEPRECATED, "The xsl.security_prefs php.ini option is deprecated; use XsltProcessor->setSecurityPrefs() instead");
-                       if (intern->securityPrefsSet == 0) {
-                               /* if securityPrefs were not set through the setSecurityPrefs method, take the ini setting */
-                               secPrefsValue = secPrefsIni;
-                       } else {
-                               /* else throw a notice, that the ini setting was not used */
-                               php_error_docref(NULL, E_NOTICE, "The xsl.security_prefs php.ini was not used, since the  XsltProcessor->setSecurityPrefs() method was used");
-                       }
-               }
-       }
-
        /* if securityPrefs is set to NONE, we don't have to do any checks, but otherwise... */
        if (secPrefsValue != XSL_SECPREF_NONE) {
                secPrefs = xsltNewSecurityPrefs();