]> granicus.if.org Git - php/commitdiff
- remove magic quotes support, functions are kept (see the NEWS entry for the details...
authorPierre Joye <pajoye@php.net>
Fri, 22 Jul 2011 11:25:30 +0000 (11:25 +0000)
committerPierre Joye <pajoye@php.net>
Fri, 22 Jul 2011 11:25:30 +0000 (11:25 +0000)
36 files changed:
NEWS
Zend/zend_ini_scanner.c
Zend/zend_ini_scanner_defs.h
configure.in
ext/bz2/bz2.c
ext/dba/dba.c
ext/exif/exif.c
ext/filter/filter.c
ext/interbase/ibase_query.c
ext/mcrypt/mcrypt.c
ext/mssql/php_mssql.c
ext/mysql/php_mysql.c
ext/mysqli/mysqli.c
ext/pcre/php_pcre.c
ext/pdo/tests/pdo_test.inc
ext/pgsql/pgsql.c
ext/phar/func_interceptors.c
ext/spl/examples/dbaarray.inc
ext/spl/spl_directory.c
ext/standard/basic_functions.c
ext/standard/exec.c
ext/standard/file.c
ext/standard/php_string.h
ext/standard/streamsfuncs.c
ext/standard/string.c
ext/sybase_ct/php_sybase_ct.c
ext/zlib/zlib.c
main/main.c
main/php_globals.h
main/php_variables.c
main/rfc1867.c
php.ini-development
php.ini-production
sapi/cgi/cgi_main.c
sapi/fpm/fpm/fpm_main.c
win32/build/config.w32.h.in

diff --git a/NEWS b/NEWS
index 199019b0990dd810311922cb7d4be04d1652eade..df2fa523a0375a05f55696ba24b23766a4fd9731 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2011, PHP 5.4.0 Alpha 3
+- Removed features:
+  . Removed magic_quotes_gpc, magic_quotes_runtime and magic_quotes_sybase ini options.
+    get_magic_quotes_gpc, get_magic_quotes_runtime are kept but always return
+    false, set_magic_quotes_runtime raises an E_CORE_ERROR. (Pierrick, Pierre)
+
 - Improved PHP-FPM SAPI:
   . Added process.max to control the number of process FPM can fork. FR #55166.
     (fat)
index a7e71a5a5d1806abb9e86af4f551c502a587b754..0e0960335816296ea643a707a2663da694fd6a3a 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Mon Aug 30 19:00:33 2010 */
+/* Generated by re2c 0.13.5 on Wed Jun 29 02:53:12 2011 */
 #line 1 "Zend/zend_ini_scanner.l"
 /*
    +----------------------------------------------------------------------+
index a3e7cbca70e9407fd99a25af0dad87a47c142546..e01ce5851230d6acc6755c056dfd853afad994db 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Mon Aug 30 19:00:34 2010 */
+/* Generated by re2c 0.13.5 on Wed Jun 29 02:53:12 2011 */
 #line 3 "Zend/zend_ini_scanner_defs.h"
 
 enum YYCONDTYPE {
index 84d0ce945a00828a187e90a6d1da4b979dcc785e..a7ee3894ba0d41129e1fcc9526a86d11874c0269 100644 (file)
@@ -901,15 +901,6 @@ else
   AC_DEFINE(PHP_SIGCHILD, 0, [ ])
 fi
 
-PHP_ARG_ENABLE(magic-quotes, whether to enable magic quotes by default,
-[  --enable-magic-quotes   Enable magic quotes by default.], no, no)
-
-if test "$PHP_MAGIC_QUOTES" = "yes"; then
-  AC_DEFINE(MAGIC_QUOTES, 1, [ ])
-else
-  AC_DEFINE(MAGIC_QUOTES, 0, [ ])
-fi
-
 PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc,
 [  --enable-libgcc         Enable explicitly linking against libgcc], no, no)
 
index 1e3c7b7617e3b51053a2bf1daeafa74fd0e9c8b1..310589fc102f9bc2d5e1f661814e61aecf3637d5 100644 (file)
@@ -352,13 +352,6 @@ static PHP_FUNCTION(bzread)
        }
        
        Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
-
-       if (PG(magic_quotes_runtime)) {
-               Z_STRVAL_P(return_value) = php_addslashes(      Z_STRVAL_P(return_value),
-                                                                                                       Z_STRLEN_P(return_value),
-                                                                                                       &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
-       }
-
        Z_TYPE_P(return_value) = IS_STRING;
 }
 /* }}} */
index 97b83d45a1af6c23cd21584fed500767b048e28b..55fde324596b75608c07f10bed068fb58aeef61c 100644 (file)
@@ -560,20 +560,9 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
 
        DBA_WRITE_CHECK;
 
-       if (PG(magic_quotes_runtime)) {
-               v = estrndup(val, val_len);
-               php_stripslashes(v, &val_len TSRMLS_CC);
-               if (info->hnd->update(info, key_str, key_len, v, val_len, mode TSRMLS_CC) == SUCCESS) {
-                       efree(v);
-                       DBA_ID_DONE;
-                       RETURN_TRUE;
-               }
-               efree(v);
-       } else {
-               if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) {
-                       DBA_ID_DONE;
-                       RETURN_TRUE;
-               }
+       if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) {
+               DBA_ID_DONE;
+               RETURN_TRUE;
        }
 
        DBA_ID_DONE;
@@ -1029,9 +1018,6 @@ PHP_FUNCTION(dba_fetch)
                skip = 0; 
        }
        if((val = info->hnd->fetch(info, key_str, key_len, skip, &len TSRMLS_CC)) != NULL) {
-               if (val && PG(magic_quotes_runtime)) {
-                       val = php_addslashes(val, len, &len, 1 TSRMLS_CC);
-               }
                DBA_ID_DONE;
                RETURN_STRINGL(val, len, 0);
        } 
index f5e837484581ab6430b70850d0d78e75fed65c96..48af4d64ddfd7eedd53765904b3540ed44cb6514 100644 (file)
@@ -1697,11 +1697,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
                case TAG_FMT_STRING:
                        if (value) {
                                length = php_strnlen(value, length);
-                               if (PG(magic_quotes_runtime)) {
-                                       info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
-                               } else {
-                                       info_value->s = estrndup(value, length);
-                               }
+                               info_value->s = estrndup(value, length);
                                info_data->length = length;
                        } else {
                                info_data->length = 0;
@@ -1724,11 +1720,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
                case TAG_FMT_UNDEFINED:
                        if (value) {
                                /* do not recompute length here */
-                               if (PG(magic_quotes_runtime)) {
-                                       info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
-                               } else {
-                                       info_value->s = estrndup(value, length);
-                               }
+                               info_value->s = estrndup(value, length);
                                info_data->length = length;
                        } else {
                                info_data->length = 0;
@@ -1850,11 +1842,7 @@ static void exif_iif_add_str(image_info_type *image_info, int section_index, cha
                info_data->format = TAG_FMT_STRING;
                info_data->length = 1;
                info_data->name   = estrdup(name);
-               if (PG(magic_quotes_runtime)) {
-                       info_data->value.s = php_addslashes(value, strlen(value), NULL, 0 TSRMLS_CC);
-               } else {
-                       info_data->value.s = estrdup(value);
-               }
+               info_data->value.s = estrdup(value);
                image_info->sections_found |= 1<<section_index;
                image_info->info_list[section_index].count++;
        }
@@ -1895,17 +1883,9 @@ static void exif_iif_add_buffer(image_info_type *image_info, int section_index,
                info_data->format = TAG_FMT_UNDEFINED;
                info_data->length = length;
                info_data->name   = estrdup(name);
-               if (PG(magic_quotes_runtime)) {
-#ifdef EXIF_DEBUG
-                       exif_error_docref(NULL EXIFERR_CC, image_info, E_NOTICE, "Adding %s as buffer%s", name, exif_char_dump(value, length, 0));
-#endif
-                       info_data->value.s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
-                       info_data->length = length;
-               } else {
-                       info_data->value.s = safe_emalloc(length, 1, 1);
-                       memcpy(info_data->value.s, value, length);
-                       info_data->value.s[length] = 0;
-               }
+               info_data->value.s = safe_emalloc(length, 1, 1);
+               memcpy(info_data->value.s, value, length);
+               info_data->value.s[length] = 0;
                image_info->sections_found |= 1<<section_index;
                image_info->info_list[section_index].count++;
        }
index e67bc7546dd31c6daf84fe58488188f111a0a005..6e617190601abcd9f2220346a432201daaf644d5 100644 (file)
@@ -464,8 +464,6 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int
                        Z_STRVAL(new_var) = estrndup(*val, val_len);
                        INIT_PZVAL(tmp_new_var);
                        php_zval_filter(&tmp_new_var, IF_G(default_filter), IF_G(default_filter_flags), NULL, NULL/*charset*/, 0 TSRMLS_CC);
-               } else if (PG(magic_quotes_gpc) && !retval) { /* for PARSE_STRING php_register_variable_safe() will do the addslashes() */
-                       Z_STRVAL(new_var) = php_addslashes(*val, Z_STRLEN(new_var), &Z_STRLEN(new_var), 0 TSRMLS_CC);
                } else {
                        Z_STRVAL(new_var) = estrndup(*val, val_len);
                }
index 9eac22284bdadff7cd2cfd67a3bf9fdc4e902194..b1e1188aeb4fa52080394833a5bec5617b015dad 100644 (file)
@@ -1325,12 +1325,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, /* {{{
                        data = ((IBVARY *) data)->vary_string;
                        /* no break */
                case SQL_TEXT:
-                       if (PG(magic_quotes_runtime)) {
-                               Z_STRVAL_P(val) = php_addslashes(data, len, &Z_STRLEN_P(val), 0 TSRMLS_CC);
-                               Z_TYPE_P(val) = IS_STRING;
-                       } else {
-                               ZVAL_STRINGL(val,(char *) data,len,1);
-                       }
+                       ZVAL_STRINGL(val,(char *) data,len,1);
                        break;
                case SQL_SHORT:
                        n = *(short *) data;
index 609dac1d5fb2197bafc34f1764f6a33bcae23c1c..7fecc1cca00f8e3e8d988825c8c6cd469990b32a 100644 (file)
@@ -1387,7 +1387,7 @@ PHP_FUNCTION(mcrypt_create_iv)
        }
        
        iv = ecalloc(size + 1, 1);
-       
+
        if (source == RANDOM || source == URANDOM) {
 #if PHP_WIN32
                /* random/urandom equivalent on Windows */
index 3e001583348194cac53b3ffc341b7fabe61b999d..f3af40bc2b2a52ec57fabe460121628d18671fba 100644 (file)
@@ -1520,27 +1520,17 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
                if (Z_TYPE(result->data[result->cur_row][i]) != IS_NULL) {
                        char *data;
                        int data_len;
-                       int should_copy;
 
                        if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) {
-                               if (PG(magic_quotes_runtime)) {
-                                       data = php_addslashes(Z_STRVAL(result->data[result->cur_row][i]), Z_STRLEN(result->data[result->cur_row][i]), &data_len, 0 TSRMLS_CC);
-                                       should_copy = 0;
-                               }
-                               else
-                               {
-                                       data = Z_STRVAL(result->data[result->cur_row][i]);
-                                       data_len = Z_STRLEN(result->data[result->cur_row][i]);
-                                       should_copy = 1;
-                               }
+                               data = Z_STRVAL(result->data[result->cur_row][i]);
+                               data_len = Z_STRLEN(result->data[result->cur_row][i]);
 
                                if (result_type & MSSQL_NUM) {
-                                       add_index_stringl(return_value, i, data, data_len, should_copy);
-                                       should_copy = 1;
+                                       add_index_stringl(return_value, i, data, data_len, 1);
                                }
                                
                                if (result_type & MSSQL_ASSOC) {
-                                       add_assoc_stringl(return_value, result->fields[i].name, data, data_len, should_copy);
+                                       add_assoc_stringl(return_value, result->fields[i].name, data, data_len, 1);
                                }
                        }
                        else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) {
index df9dac549b99da954ad69c1be16ef35e4a16924c..cfce37d5d564b736036a1172a0ed17c52bfde9ac 100644 (file)
@@ -1955,12 +1955,16 @@ Q: String or long first?
        if (sql_row[field_offset]) {
                Z_TYPE_P(return_value) = IS_STRING;
 
+#if PHP_API_VERSION < 20100412         
                if (PG(magic_quotes_runtime)) {
                        Z_STRVAL_P(return_value) = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&Z_STRLEN_P(return_value), 0 TSRMLS_CC);
                } else {
+#endif                 
                        Z_STRLEN_P(return_value) = sql_row_lengths[field_offset];
                        Z_STRVAL_P(return_value) = (char *) safe_estrndup(sql_row[field_offset], Z_STRLEN_P(return_value));
+#if PHP_API_VERSION < 20100412
                }
+#endif         
        } else {
                Z_TYPE_P(return_value) = IS_NULL;
        }
@@ -2078,12 +2082,16 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
 
                        MAKE_STD_ZVAL(data);
 
+#if PHP_API_VERSION < 20100412                 
                        if (PG(magic_quotes_runtime)) {
                                Z_TYPE_P(data) = IS_STRING;
                                Z_STRVAL_P(data) = php_addslashes(mysql_row[i], mysql_row_lengths[i], &Z_STRLEN_P(data), 0 TSRMLS_CC);
                        } else {
+#endif                                 
                                ZVAL_STRINGL(data, mysql_row[i], mysql_row_lengths[i], 1);
+#if PHP_API_VERSION < 20100412                         
                        }
+#endif                 
 
                        if (result_type & MYSQL_NUM) {
                                add_index_zval(return_value, i, data);
index add2d123d8636dafe7f3c1dd5d22d20534eacb75..b784ff863f76f73a92120ff1ca28fb9da5c5d389 100644 (file)
@@ -1137,13 +1137,17 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long
 #endif
                        {
 
+#if PHP_API_VERSION < 20100412
                                /* check if we need magic quotes */
                                if (PG(magic_quotes_runtime)) {
                                        Z_TYPE_P(res) = IS_STRING;
                                        Z_STRVAL_P(res) = php_addslashes(row[i], field_len[i], &Z_STRLEN_P(res), 0 TSRMLS_CC);
                                } else {
+#endif                                 
                                        ZVAL_STRINGL(res, row[i], field_len[i], 1);
+#if PHP_API_VERSION < 20100412
                                }
+#endif                         
                        }
 
                        if (fetchtype & MYSQLI_NUM) {
index cc96fafe87793c0247f0a5ad33273b1502d122a4..5e1a75394f673798150ab516fb4c715bd8a20664 100644 (file)
@@ -898,7 +898,7 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
                                        match = subject + offsets[backref<<1];
                                        match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
                                        if (match_len) {
-                                               esc_match = php_addslashes_ex(match, match_len, &esc_match_len, 0, 1 TSRMLS_CC);
+                                               esc_match = php_addslashes(match, match_len, &esc_match_len, 0 TSRMLS_CC);
                                        } else {
                                                esc_match = match;
                                                esc_match_len = 0;
index bbaeb71af7e96e8843e15666158980db1a4ae996..f2e076793a75554088c93caeb77a8dc38c65e082 100644 (file)
@@ -11,7 +11,6 @@ if (getenv('PDOTEST_DSN') === false) {
                        $append = true;
                }
        }
-       if (ini_get('magic_quotes_runtime')) $common = stripslashes($common);
        $conf = eval($common);
        foreach($conf['ENV'] as $n=>$v) putenv("$n=$v");
 }
@@ -76,4 +75,4 @@ class PDOTest {
                return self::factory();
        }
 }
-?>
\ No newline at end of file
+?>
index 9ab1a071e6ae68fe29d0c771f83095cdf0222dfa..c2dd8b4a27f9d90e8ebf91e40a94aea3a8938577 100644 (file)
@@ -2499,12 +2499,8 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
                                int should_copy=0;
                                const uint element_len = strlen(element);
 
-                               if (PG(magic_quotes_runtime)) {
-                                       data = php_addslashes(element, element_len, &data_len, 0 TSRMLS_CC);
-                               } else {
-                                       data = safe_estrndup(element, element_len);
-                                       data_len = element_len;
-                               }
+                               data = safe_estrndup(element, element_len);
+                               data_len = element_len;
                        
                                if (result_type & PGSQL_NUM) {
                                        add_index_stringl(return_value, i, data, data_len, should_copy);
@@ -6213,12 +6209,9 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TS
                                        size_t data_len;
                                        const size_t element_len = strlen(element);
 
-                                       if (PG(magic_quotes_runtime)) {
-                                               data = php_addslashes(element, element_len, &data_len, 0 TSRMLS_CC);
-                                       } else {
-                                               data = safe_estrndup(element, element_len);
-                                               data_len = element_len;
-                                       }
+                                       data = safe_estrndup(element, element_len);
+                                       data_len = element_len;
+                                       
                                        field_name = PQfname(pg_result, i);
                                        add_assoc_stringl(row, field_name, data, data_len, 0);
                                }
index 1b3f0f461b809e17828b8f99ff813ec992ccbc90..d90aeac7ac0e5af1e6abb6afe198a34c842a526a 100644 (file)
@@ -203,7 +203,7 @@ phar_it:
 
                        /* uses mmap if possible */
                        if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) {
-#if PHP_MAJOR_VERSION < 6
+#if PHP_API_VERSION < 20100412
                                if (PG(magic_quotes_runtime)) {
                                        int newlen;
                                        contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
index fcd6bb378a3f71ae233297193166b7a0c6505bab..d448ad7299b41c3531b6bc3395fe6d350ad1915c 100755 (executable)
@@ -51,9 +51,6 @@ class DbaArray extends DbaReader implements ArrayAccess
        {
                $data = dba_fetch($name, $this->db); 
                if($data) {
-                       if (ini_get('magic_quotes_runtime')) {
-                               $data = stripslashes($data);
-                       }
                        //return unserialize($data);
                        return $data;
                }
@@ -95,4 +92,4 @@ class DbaArray extends DbaReader implements ArrayAccess
        }
 }
 
-?>
\ No newline at end of file
+?>
index f1eaffe479ef7495cacde3575835ad54f44dc5de..3c7055097541e2cff658178643fcea03f9058c90 100755 (executable)
@@ -1993,7 +1993,6 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS
 {
        char *buf;
        size_t line_len = 0;
-       int len;
        long line_add = (intern->u.file.current_line || intern->u.file.current_zval) ? 1 : 0;
 
        spl_filesystem_file_free_line(intern TSRMLS_CC);
@@ -2026,11 +2025,6 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS
                        buf[line_len] = '\0';
                }
        
-               if (PG(magic_quotes_runtime)) {
-                       buf = php_addslashes(buf, line_len, &len, 1 TSRMLS_CC);
-                       line_len = len;
-               }
-       
                intern->u.file.current_line = buf;
                intern->u.file.current_line_len = line_len;
        }
@@ -2778,7 +2772,6 @@ SPL_METHOD(SplFileObject, fwrite)
        spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
        char *str;
        int str_len;
-       int ret;
        long length = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) {
@@ -2792,14 +2785,6 @@ SPL_METHOD(SplFileObject, fwrite)
                RETURN_LONG(0);
        }
 
-       if (PG(magic_quotes_runtime)) {
-               str = estrndup(str, str_len);
-               php_stripslashes(str, &str_len TSRMLS_CC);
-               ret = php_stream_write(intern->u.file.stream, str, str_len);
-               efree(str);
-               RETURN_LONG(ret);
-       }
-
        RETURN_LONG(php_stream_write(intern->u.file.stream, str, str_len));
 } /* }}} */
 
index 6af19d6d184eb214a6dad8562ed866df531074c4..4b5b9fe2c2b7cdccefcd22861c284a526c50f17f 100644 (file)
@@ -2964,8 +2964,8 @@ const zend_function_entry basic_functions[] = { /* {{{ */
 
        PHP_DEP_FALIAS(magic_quotes_runtime,    set_magic_quotes_runtime,               arginfo_set_magic_quotes_runtime)
        PHP_DEP_FE(set_magic_quotes_runtime,                                                                    arginfo_set_magic_quotes_runtime)
-       PHP_FE(get_magic_quotes_gpc,                                                                                    arginfo_get_magic_quotes_gpc)
-       PHP_FE(get_magic_quotes_runtime,                                                                                arginfo_get_magic_quotes_runtime)
+       PHP_DEP_FE(get_magic_quotes_gpc,                                                                                arginfo_get_magic_quotes_gpc)
+       PHP_DEP_FE(get_magic_quotes_runtime,                                                                    arginfo_get_magic_quotes_runtime)
 
        PHP_FE(error_log,                                                                                                               arginfo_error_log)
        PHP_FE(error_get_last,                                                                                                  arginfo_error_get_last)
@@ -4556,7 +4556,7 @@ PHP_FUNCTION(get_cfg_var)
 /* }}} */
 
 /* {{{ proto bool set_magic_quotes_runtime(int new_setting)
-   Set the current active configuration setting of magic_quotes_runtime and return previous */
+   magic_quotes_runtime is not supported anymore */
 PHP_FUNCTION(set_magic_quotes_runtime)
 {
        zend_bool new_setting;
@@ -4564,11 +4564,11 @@ PHP_FUNCTION(set_magic_quotes_runtime)
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) {
                return;
        }
-
-       if (zend_alter_ini_entry_ex("magic_quotes_runtime", sizeof("magic_quotes_runtime"), new_setting ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
-               RETURN_FALSE;
+       
+       if (new_setting) {
+               php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore");
        }
-       RETURN_TRUE;
+       RETURN_FALSE;
 }
 /* }}} */
 
@@ -4576,7 +4576,10 @@ PHP_FUNCTION(set_magic_quotes_runtime)
    Get the current active configuration setting of magic_quotes_runtime */
 PHP_FUNCTION(get_magic_quotes_runtime)
 {
-       RETURN_LONG(PG(magic_quotes_runtime));
+       if (zend_parse_parameters_none() == FAILURE) {
+               return;
+       }
+       RETURN_FALSE;
 }
 /* }}} */
 
@@ -4584,7 +4587,10 @@ PHP_FUNCTION(get_magic_quotes_runtime)
    Get the current active configuration setting of magic_quotes_gpc */
 PHP_FUNCTION(get_magic_quotes_gpc)
 {
-       RETURN_LONG(PG(magic_quotes_gpc));
+       if (zend_parse_parameters_none() == FAILURE) {
+               return;
+       }
+       RETURN_FALSE;
 }
 /* }}} */
 
index 890f73726bc20a1d7a864cff0fd2902653fbb024..ac96fe68155ff38d9af560e66d1481897401621f 100644 (file)
@@ -60,7 +60,7 @@
 PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
 {
        FILE *fp;
-       char *buf, *tmp=NULL;
+       char *buf;
        int l = 0, pclose_return;
        char *b, *d=NULL;
        php_stream *stream;
@@ -139,14 +139,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
                        }
 
                        /* Return last line from the shell command */
-                       if (PG(magic_quotes_runtime)) {
-                               int len;
-
-                               tmp = php_addslashes(buf, bufl, &len, 0 TSRMLS_CC);
-                               RETVAL_STRINGL(tmp, len, 0);
-                       } else {
-                               RETVAL_STRINGL(buf, bufl, 1);
-                       }
+                       RETVAL_STRINGL(buf, bufl, 1);
                } else { /* should return NULL, but for BC we return "" */
                        RETVAL_EMPTY_STRING();
                }
index ddf7038840e5583304994a70d87ac475b92c1f85..ef5f215c36420195ca0393a4bc8bce1e7b7cbbf3 100644 (file)
@@ -423,13 +423,7 @@ PHP_FUNCTION(get_meta_tags)
                                        have_name = 1;
                                } else if (saw_content) {
                                        STR_FREE(value);
-                                       /* Get the CONTENT attr (Single word attr, non-quoted) */
-                                       if (PG(magic_quotes_runtime)) {
-                                               value = php_addslashes(md.token_data, 0, &md.token_len, 0 TSRMLS_CC);
-                                       } else {
-                                               value = estrndup(md.token_data, md.token_len);
-                                       }
-
+                                       value = estrndup(md.token_data, md.token_len);
                                        have_content = 1;
                                }
 
@@ -463,13 +457,7 @@ PHP_FUNCTION(get_meta_tags)
                                have_name = 1;
                        } else if (saw_content) {
                                STR_FREE(value);
-                               /* Get the CONTENT attr (Single word attr, non-quoted) */
-                               if (PG(magic_quotes_runtime)) {
-                                       value = php_addslashes(md.token_data, 0, &md.token_len, 0 TSRMLS_CC);
-                               } else {
-                                       value = estrndup(md.token_data, md.token_len);
-                               }
-
+                               value = estrndup(md.token_data, md.token_len);
                                have_content = 1;
                        }
 
@@ -561,11 +549,6 @@ PHP_FUNCTION(file_get_contents)
        }
 
        if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) {
-
-               if (PG(magic_quotes_runtime)) {
-                       contents = php_addslashes(contents, len, &len, 1 TSRMLS_CC); /* 1 = free source string */
-               }
-
                RETVAL_STRINGL(contents, len, 0);
        } else if (len == 0) {
                RETVAL_EMPTY_STRING();
@@ -724,9 +707,9 @@ PHP_FUNCTION(file)
 {
        char *filename;
        int filename_len;
-       char *slashed, *target_buf=NULL, *p, *s, *e;
+       char *target_buf=NULL, *p, *s, *e;
        register int i = 0;
-       int target_len, len;
+       int target_len;
        char eol_marker = '\n';
        long flags = 0;
        zend_bool use_include_path;
@@ -778,13 +761,7 @@ PHP_FUNCTION(file)
                        do {
                                p++;
 parse_eol:
-                               if (PG(magic_quotes_runtime)) {
-                                       /* s is in target_buf which is freed at the end of the function */
-                                       slashed = php_addslashes(s, (p-s), &len, 0 TSRMLS_CC);
-                                       add_index_stringl(return_value, i++, slashed, len, 0);
-                               } else {
-                                       add_index_stringl(return_value, i++, estrndup(s, p-s), p-s, 0);
-                               }
+                               add_index_stringl(return_value, i++, estrndup(s, p-s), p-s, 0);
                                s = p;
                        } while ((p = memchr(p, eol_marker, (e-p))));
                } else {
@@ -797,13 +774,7 @@ parse_eol:
                                        s = ++p;
                                        continue;
                                }
-                               if (PG(magic_quotes_runtime)) {
-                                       /* s is in target_buf which is freed at the end of the function */
-                                       slashed = php_addslashes(s, (p-s-windows_eol), &len, 0 TSRMLS_CC);
-                                       add_index_stringl(return_value, i++, slashed, len, 0);
-                               } else {
-                                       add_index_stringl(return_value, i++, estrndup(s, p-s-windows_eol), p-s-windows_eol, 0);
-                               }
+                               add_index_stringl(return_value, i++, estrndup(s, p-s-windows_eol), p-s-windows_eol, 0);
                                s = ++p;
                        } while ((p = memchr(p, eol_marker, (e-p))));
                }
@@ -1049,16 +1020,11 @@ PHPAPI PHP_FUNCTION(fgets)
                }
        }
 
-       if (PG(magic_quotes_runtime)) {
-               Z_STRVAL_P(return_value) = php_addslashes(buf, line_len, &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
-               Z_TYPE_P(return_value) = IS_STRING;
-       } else {
-               ZVAL_STRINGL(return_value, buf, line_len, 0);
-               /* resize buffer if it's much larger than the result.
-                * Only needed if the user requested a buffer size. */
-               if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) {
-                       Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1);
-               }
+       ZVAL_STRINGL(return_value, buf, line_len, 0);
+       /* resize buffer if it's much larger than the result.
+        * Only needed if the user requested a buffer size. */
+       if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) {
+               Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1);
        }
        return;
 
@@ -1219,11 +1185,6 @@ PHPAPI PHP_FUNCTION(fwrite)
 
        PHP_STREAM_TO_ZVAL(stream, &arg1);
 
-       if (PG(magic_quotes_runtime)) {
-               buffer = estrndup(arg2, num_bytes);
-               php_stripslashes(buffer, &num_bytes TSRMLS_CC);
-       }
-
        ret = php_stream_write(stream, buffer ? buffer : arg2, num_bytes);
        if (buffer) {
                efree(buffer);
@@ -1790,11 +1751,6 @@ PHPAPI PHP_FUNCTION(fread)
 
        /* needed because recv/read/gzread doesnt put a null at the end*/
        Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
-
-       if (PG(magic_quotes_runtime)) {
-               Z_STRVAL_P(return_value) = php_addslashes(Z_STRVAL_P(return_value),
-                               Z_STRLEN_P(return_value), &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
-       }
        Z_TYPE_P(return_value) = IS_STRING;
 }
 /* }}} */
@@ -1950,15 +1906,7 @@ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char en
        smart_str_appendc(&csvline, '\n');
        smart_str_0(&csvline);
 
-       if (!PG(magic_quotes_runtime)) {
-               ret = php_stream_write(stream, csvline.c, csvline.len);
-       } else {
-               char *buffer = estrndup(csvline.c, csvline.len);
-               int len = csvline.len;
-               php_stripslashes(buffer, &len TSRMLS_CC);
-               ret = php_stream_write(stream, buffer, len);
-               efree(buffer);
-       }
+       ret = php_stream_write(stream, csvline.c, csvline.len);
 
        smart_str_free(&csvline);
 
index 23c703336abaa5a8029de6c573e6387bb8187084..c6d916dbcc182ef8732b63c293e81d1fb87a8c31 100644 (file)
@@ -122,7 +122,6 @@ PHPAPI char *php_strtoupper(char *s, size_t len);
 PHPAPI char *php_strtolower(char *s, size_t len);
 PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
 PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC);
-PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int freeit, int ignore_sybase TSRMLS_DC);
 PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC);
 PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC);
 PHPAPI void php_stripcslashes(char *str, int *len);
index befb13fd7aa9b05ccf2c36eca21620a7481eda39..54aef6afa00e24ad6022fa2f51952bbb6dd3f4b0 100644 (file)
@@ -395,13 +395,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
                }
                read_buf[recvd] = '\0';
 
-               if (PG(magic_quotes_runtime)) {
-                       Z_TYPE_P(return_value) = IS_STRING;
-                       Z_STRVAL_P(return_value) = php_addslashes(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
-                       return;
-               } else {
-                       RETURN_STRINGL(read_buf, recvd, 0);
-               }
+               RETURN_STRINGL(read_buf, recvd, 0);
        }
 
        efree(read_buf);
@@ -417,8 +411,7 @@ PHP_FUNCTION(stream_get_contents)
        zval            *zsrc;
        long            maxlen          = PHP_STREAM_COPY_ALL,
                                desiredpos      = -1L;
-       int                     len,
-                               newlen;
+       int                     len;
        char            *contents       = NULL;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) {
@@ -450,10 +443,6 @@ PHP_FUNCTION(stream_get_contents)
        len = php_stream_copy_to_mem(stream, &contents, maxlen, 0);
 
        if (contents) {
-               if (len && PG(magic_quotes_runtime)) {
-                       contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
-                       len = newlen;
-               }
                RETVAL_STRINGL(contents, len, 0);
        } else {
                RETVAL_EMPTY_STRING();
index 44c5cd3b0062c6115907f527f6a9c65214fbfe30..1717b3b711593d298f7dc17b7e023c36bae42339 100644 (file)
@@ -3015,34 +3015,6 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC)
        s = str;
        t = str;
 
-       if (PG(magic_quotes_sybase)) {
-               while (l > 0) {
-                       if (*t == '\'') {
-                               if ((l > 0) && (t[1] == '\'')) {
-                                       t++;
-                                       if (len != NULL) {
-                                               (*len)--;
-                                       }
-                                       l--;
-                               }
-                               *s++ = *t++;
-                       } else if (*t == '\\' && t[1] == '0' && l > 0) {
-                               *s++='\0';
-                               t+=2;
-                               if (len != NULL) {
-                                       (*len)--;
-                               }
-                               l--;
-                       } else {
-                               *s++ = *t++;
-                       }
-                       l--;
-               }
-               *s = '\0';
-               
-               return;
-       }
-
        while (l > 0) {
                if (*t == '\\') {
                        t++;                            /* skip the slash */
@@ -3286,14 +3258,6 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_
 /* {{{ php_addslashes
  */
 PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC)
-{
-       return php_addslashes_ex(str, length, new_length, should_free, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_addslashes_ex
- */
-PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int should_free, int ignore_sybase TSRMLS_DC)
 {
        /* maximum string length, worst case situation */
        char *new_str;
@@ -3313,42 +3277,23 @@ PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int shoul
        end = source + length;
        target = new_str;
        
-       if (!ignore_sybase && PG(magic_quotes_sybase)) {
-               while (source < end) {
-                       switch (*source) {
-                               case '\0':
-                                       *target++ = '\\';
-                                       *target++ = '0';
-                                       break;
-                               case '\'':
-                                       *target++ = '\'';
-                                       *target++ = '\'';
-                                       break;
-                               default:
-                                       *target++ = *source;
-                                       break;
-                       }
-                       source++;
-               }
-       } else {
-               while (source < end) {
-                       switch (*source) {
-                               case '\0':
-                                       *target++ = '\\';
-                                       *target++ = '0';
-                                       break;
-                               case '\'':
-                               case '\"':
-                               case '\\':
-                                       *target++ = '\\';
-                                       /* break is missing *intentionally* */
-                               default:
-                                       *target++ = *source;
-                                       break;  
-                       }
-               
-                       source++;
+       while (source < end) {
+               switch (*source) {
+                       case '\0':
+                               *target++ = '\\';
+                               *target++ = '0';
+                               break;
+                       case '\'':
+                       case '\"':
+                       case '\\':
+                               *target++ = '\\';
+                               /* break is missing *intentionally* */
+                       default:
+                               *target++ = *source;
+                               break;  
                }
+
+               source++;
        }
        
        *target = 0;
index 129f687bd176bf6e8383183f7858d2ad67e55f4c..c07cdcd7e626caaf38a211c7614926e6693e3561 100644 (file)
@@ -1814,11 +1814,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int numerics)
                ALLOC_ZVAL(tmp);
                *tmp = result->data[result->store ? result->cur_row : 0][i];
                INIT_PZVAL(tmp);
-               if (PG(magic_quotes_runtime) && Z_TYPE_P(tmp) == IS_STRING) {
-                       Z_STRVAL_P(tmp) = php_addslashes(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &Z_STRLEN_P(tmp), 0 TSRMLS_CC);
-               } else {
-                       zval_copy_ctor(tmp);
-               }
+               zval_copy_ctor(tmp);
                if (numerics) {
                        zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &tmp, sizeof(zval *), NULL);
                        Z_ADDREF_P(tmp);
index 08450a3aa33afc860a992d0faa46cfcaea06d99f..0f61bfde91a694d2b4ac476b526357b0fd0e7ebe 100644 (file)
@@ -426,7 +426,7 @@ static PHP_FUNCTION(gzfile)
        char *filename;
        int filename_len;
        int flags = REPORT_ERRORS;
-       char *slashed, buf[8192] = {0};
+       char buf[8192] = {0};
        register int i = 0;
        long use_include_path = 0;
        php_stream *stream;
@@ -454,14 +454,7 @@ static PHP_FUNCTION(gzfile)
        memset(buf, 0, sizeof(buf));
            
        while (php_stream_gets(stream, buf, sizeof(buf) - 1) != NULL) {
-               if (PG(magic_quotes_runtime)) {
-                       int len;
-                       
-                       slashed = php_addslashes(buf, 0, &len, 0 TSRMLS_CC); /* 0 = don't free source string */
-                       add_index_stringl(return_value, i++, slashed, len, 0);
-               } else {
-                       add_index_string(return_value, i++, buf, 1);
-               }
+               add_index_string(return_value, i++, buf, 1);
        }
        php_stream_close(stream);
 }
index f02720130fbc66718ddcd87499ec395e921bf8c1..e30d483d5abe391fe01fafa533805c7cc0f58541 100644 (file)
@@ -440,9 +440,6 @@ PHP_INI_BEGIN()
        STD_PHP_INI_BOOLEAN("ignore_repeated_source",   "0",    PHP_INI_ALL,            OnUpdateBool,                   ignore_repeated_source, php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("report_memleaks",          "1",            PHP_INI_ALL,            OnUpdateBool,                   report_memleaks,                php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("report_zend_debug",        "1",            PHP_INI_ALL,            OnUpdateBool,                   report_zend_debug,              php_core_globals,       core_globals)
-       STD_PHP_INI_BOOLEAN("magic_quotes_gpc",         "1",            PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   magic_quotes_gpc,               php_core_globals,       core_globals)
-       STD_PHP_INI_BOOLEAN("magic_quotes_runtime",     "0",            PHP_INI_ALL,            OnUpdateBool,                   magic_quotes_runtime,   php_core_globals,       core_globals)
-       STD_PHP_INI_BOOLEAN("magic_quotes_sybase",      "0",            PHP_INI_ALL,            OnUpdateBool,                   magic_quotes_sybase,    php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("output_buffering",           "0",            PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateLong,   output_buffering,               php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("output_handler",                     NULL,           PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateString, output_handler,         php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("register_argc_argv",       "1",            PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   register_argc_argv,             php_core_globals,       core_globals)
@@ -1872,9 +1869,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
        void ***tsrm_ls;
        php_core_globals *core_globals;
 #endif
-#ifdef PHP_WIN32
-       char module_path[MAX_PATH];
-#endif
 
 #if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
        WORD wVersionRequested = MAKEWORD(2, 0);
@@ -2153,15 +2147,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
                struct {
                        const long error_level;
                        const char *phrase;
-                       const char *directives[13]; /* Remember to change this if the number of directives change */
+                       const char *directives[16]; /* Remember to change this if the number of directives change */
                } directives[2] = {
                        {
                                E_DEPRECATED, 
                                "Directive '%s' is deprecated in PHP 5.3 and greater", 
                                {
-                                       "magic_quotes_gpc", 
-                                       "magic_quotes_runtime", 
-                                       "magic_quotes_sybase", 
                                        NULL
                                }
                        }, 
@@ -2172,6 +2163,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
                                        "allow_call_time_pass_reference",
                                        "define_syslog_variables", 
                                        "highlight.bg", 
+                                       "magic_quotes_gpc", 
+                                       "magic_quotes_runtime", 
+                                       "magic_quotes_sybase", 
                                        "register_globals", 
                                        "register_long_arrays", 
                                        "safe_mode", 
index 0ce398aafc3e8d3f6fdde63ed6a40b8be240146e..bf6674d54b8ea3cbbdeba2a665a4aaa601f2f96c 100644 (file)
@@ -54,10 +54,6 @@ typedef struct _arg_separators {
 } arg_separators;
 
 struct _php_core_globals {
-       zend_bool magic_quotes_gpc;
-       zend_bool magic_quotes_runtime;
-       zend_bool magic_quotes_sybase;
-
        zend_bool implicit_flush;
 
        long output_buffering;
index f6dde71417a37f2b8bd303f21f784fdd7307f4b9..8bd1b01c334b2ef2df170ad868b96e2cb0bf2259 100644 (file)
@@ -47,11 +47,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
        
        /* Prepare value */
        Z_STRLEN(new_entry) = str_len;
-       if (PG(magic_quotes_gpc)) {
-               Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC);
-       } else {
-               Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
-       }
+       Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
        Z_TYPE(new_entry) = IS_STRING;
 
        php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
@@ -180,11 +176,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
                                array_init(gpc_element);
                                zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
                        } else {
-                               if (PG(magic_quotes_gpc)) {
-                                       escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
-                               } else {
-                                       escaped_index = index;
-                               }
+                               escaped_index = index;
                                if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE
                                        || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
                                        MAKE_STD_ZVAL(gpc_element);
@@ -216,11 +208,7 @@ plain_var:
                if (!index) {
                        zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
                } else {
-                       if (PG(magic_quotes_gpc)) { 
-                               escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
-                       } else {
-                               escaped_index = index;
-                       }
+                       escaped_index = index;
                        /* 
                         * According to rfc2965, more specific paths are listed above the less specific ones.
                         * If we encounter a duplicate cookie name, we should skip it, since it is not possible
@@ -425,10 +413,6 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
        size_t alloc_size = sizeof(buf);
        unsigned long nlen; /* ptrdiff_t is not portable */
 
-       /* turn off magic_quotes while importing environment variables */
-       int magic_quotes_gpc = PG(magic_quotes_gpc);
-       PG(magic_quotes_gpc) = 0;
-
        for (env = environ; env != NULL && *env != NULL; env++) {
                p = strchr(*env, '=');
                if (!p) {                               /* malformed entry? */
@@ -446,7 +430,6 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
        if (t != buf && t != NULL) {
                efree(t);
        }
-       PG(magic_quotes_gpc) = magic_quotes_gpc;
 }
 
 zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
@@ -560,8 +543,6 @@ PHPAPI int php_handle_special_queries(TSRMLS_D)
 static inline void php_register_server_variables(TSRMLS_D)
 {
        zval *array_ptr = NULL;
-       /* turn off magic_quotes while importing server variables */
-       int magic_quotes_gpc = PG(magic_quotes_gpc);
 
        ALLOC_ZVAL(array_ptr);
        array_init(array_ptr);
@@ -570,7 +551,6 @@ static inline void php_register_server_variables(TSRMLS_D)
                zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
        }
        PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
-       PG(magic_quotes_gpc) = 0;
 
        /* Server variables */
        if (sapi_module.register_server_variables) {
@@ -595,7 +575,6 @@ static inline void php_register_server_variables(TSRMLS_D)
                php_register_variable_ex("REQUEST_TIME", &new_entry, array_ptr TSRMLS_CC);
        }
 
-       PG(magic_quotes_gpc) = magic_quotes_gpc;
 }
 /* }}} */
 
index 4467aaff160e8e510d4117625e43b6427f64f22d..f6dfae997bdcf0eb623fc648e2135a5220457873 100644 (file)
@@ -1119,15 +1119,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
                         * the user does basename() they get a bogus file name. Until IE's user base drops
                         * to nill or problem is fixed this code must remain enabled for all systems. */
                        s = _basename(internal_encoding, filename TSRMLS_CC);
-#ifdef PHP_WIN32
-                       if (PG(magic_quotes_gpc)) {
-                               s = s ? s : filename;
-                               tmp = strrchr(s, '\'');
-                               s = tmp >= s ? tmp + 1: s;
-                               tmp = strrchr(s, '"');
-                               s = tmp >= s ? tmp + 1: s;
-                       }
-#endif
                        if (!s) {
                                s = filename;
                        }
@@ -1182,7 +1173,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
                        s = "";
 
                        {
-                               /* store temp_filename as-is (without magic_quotes_gpc-ing it, in case upload_tmp_dir
+                               /* store temp_filename as-is (in case upload_tmp_dir
                                 * contains escapeable characters. escape only the variable name.) */
                                zval zfilename;
 
index 92185959f72328a33434ae37d3419a745329bf82..4a1eb4f01764bedb73296e93059e0bb5cd8e5ba9 100644 (file)
 ;   Development Value: On
 ;   Production Value: On
 
-; magic_quotes_gpc
-;   Default Value: On
-;   Development Value: Off
-;   Production Value: Off
-
 ; max_input_time
 ;   Default Value: -1 (Unlimited)
 ;   Development Value: 60 (60 seconds)
@@ -663,30 +658,6 @@ auto_globals_jit = On
 ; http://php.net/post-max-size
 post_max_size = 8M
 
-; Magic quotes are a preprocessing feature of PHP where PHP will attempt to
-; escape any character sequences in GET, POST, COOKIE and ENV data which might
-; otherwise corrupt data being placed in resources such as databases before
-; making that data available to you. Because of character encoding issues and
-; non-standard SQL implementations across many databases, it's not currently
-; possible for this feature to be 100% accurate. PHP's default behavior is to
-; enable the feature. We strongly recommend you use the escaping mechanisms
-; designed specifically for the database your using instead of relying on this
-; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is
-; scheduled for removal in PHP 6.
-; Default Value: On
-; Development Value: Off
-; Production Value: Off
-; http://php.net/magic-quotes-gpc
-magic_quotes_gpc = Off
-
-; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
-; http://php.net/magic-quotes-runtime
-magic_quotes_runtime = Off
-
-; Use Sybase-style magic quotes (escape ' with '' instead of \').
-; http://php.net/magic-quotes-sybase
-magic_quotes_sybase = Off
-
 ; Automatically add files before PHP document.
 ; http://php.net/auto-prepend-file
 auto_prepend_file =
index 576cf41479778744b9fb9577754b85bd4d9717f0..ab7b266440be28e6a4b5a759066ee3e2eb32f3e8 100644 (file)
 ;   Development Value: On
 ;   Production Value: On
 
-; magic_quotes_gpc
-;   Default Value: On
-;   Development Value: Off
-;   Production Value: Off
-
 ; max_input_time
 ;   Default Value: -1 (Unlimited)
 ;   Development Value: 60 (60 seconds)
@@ -663,30 +658,6 @@ auto_globals_jit = On
 ; http://php.net/post-max-size
 post_max_size = 8M
 
-; Magic quotes are a preprocessing feature of PHP where PHP will attempt to
-; escape any character sequences in GET, POST, COOKIE and ENV data which might
-; otherwise corrupt data being placed in resources such as databases before
-; making that data available to you. Because of character encoding issues and
-; non-standard SQL implementations across many databases, it's not currently
-; possible for this feature to be 100% accurate. PHP's default behavior is to
-; enable the feature. We strongly recommend you use the escaping mechanisms
-; designed specifically for the database your using instead of relying on this
-; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is
-; scheduled for removal in PHP 6.
-; Default Value: On
-; Development Value: Off
-; Production Value: Off
-; http://php.net/magic-quotes-gpc
-magic_quotes_gpc = Off
-
-; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
-; http://php.net/magic-quotes-runtime
-magic_quotes_runtime = Off
-
-; Use Sybase-style magic quotes (escape ' with '' instead of \').
-; http://php.net/magic-quotes-sybase
-magic_quotes_sybase = Off
-
 ; Automatically add files before PHP document.
 ; http://php.net/auto-prepend-file
 auto_prepend_file =
index 01c417bef267ff93c45e4bfe388a93beb360de2e..bc957867e06508019228d41e7a8e352d8d144c42 100644 (file)
@@ -648,12 +648,7 @@ static void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
 
        if (fcgi_is_fastcgi()) {
                fcgi_request *request = (fcgi_request*) SG(server_context);
-               int magic_quotes_gpc = PG(magic_quotes_gpc);
-
-               /* turn off magic_quotes while importing environment variables */
-               PG(magic_quotes_gpc) = 0;
                fcgi_loadenv(request, cgi_php_load_env_var, array_ptr TSRMLS_CC);
-               PG(magic_quotes_gpc) = magic_quotes_gpc;
        }
 }
 
@@ -880,6 +875,7 @@ static int sapi_cgi_activate(TSRMLS_D)
                        } else {
                                doc_root = getenv("DOCUMENT_ROOT");
                        }
+
                        /* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
                        if (doc_root) {
                                doc_root_len = strlen(doc_root);
index 773cf2cf6d58a25db4720f9b7c2cd0fe5f6b8f34..f9c15ba7e2f80442b0cf6198434845c88672ac4c 100644 (file)
@@ -524,7 +524,6 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
 {
        fcgi_request *request;
        HashPosition pos;
-       int magic_quotes_gpc;;
        char *var, **val;
        uint var_len;
        ulong idx;
@@ -557,11 +556,8 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
        php_php_import_environment_variables(array_ptr TSRMLS_CC);
 
        request = (fcgi_request*) SG(server_context);
-       magic_quotes_gpc = PG(magic_quotes_gpc);
        filter_arg = (array_ptr == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;
 
-       /* turn off magic_quotes while importing environment variables */
-       PG(magic_quotes_gpc) = 0;
        for (zend_hash_internal_pointer_reset_ex(request->env, &pos);
             zend_hash_get_current_key_ex(request->env, &var, &var_len, &idx, 0, &pos) == HASH_KEY_IS_STRING &&
             zend_hash_get_current_data_ex(request->env, (void **) &val, &pos) == SUCCESS;
@@ -573,7 +569,6 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
                        php_register_variable_safe(var, *val, new_val_len, array_ptr TSRMLS_CC);
                }
        }
-       PG(magic_quotes_gpc) = magic_quotes_gpc;
 }
 
 static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
index 9d885667f0abe12ee77ecbe603827977deb7d96e..13b36fad1cc58cdc4bf42939bb209a19db6ee4bb 100644 (file)
@@ -33,7 +33,6 @@
 
 /* PHP Runtime Configuration */
 #define PHP_URL_FOPEN 1
-#define MAGIC_QUOTES 0
 #define USE_CONFIG_FILE 1
 #define DEFAULT_SHORT_OPEN_TAG "1"