Permalink
Browse files

- remove magic quotes support, functions are kept (see the NEWS entry…

… for the details) for BC reasons but do not allow to set enable MQ
  • Loading branch information...
1 parent 5ef9ab3 commit cc1c7af0375db5b7ad2c7752569b925cc3372377 @pierrejoye pierrejoye committed Jul 22, 2011
Showing with 211 additions and 1,323 deletions.
  1. +1 −1 Zend/zend_float.c
  2. +1 −1 Zend/zend_ini_scanner.c
  3. +1 −1 Zend/zend_ini_scanner_defs.h
  4. +1 −1 Zend/zend_language_scanner.c
  5. +1 −1 Zend/zend_language_scanner_defs.h
  6. +0 −1 Zend/zend_operators.h
  7. +0 −9 configure.in
  8. +0 −7 ext/bz2/bz2.c
  9. +3 −17 ext/dba/dba.c
  10. +6 −26 ext/exif/exif.c
  11. +0 −1 ext/exif/tests/bug34704.phpt
  12. +0 −1 ext/exif/tests/exif002.phpt
  13. +0 −90 ext/exif/tests/exif006.phpt
  14. +0 −2 ext/filter/filter.c
  15. +0 −17 ext/filter/tests/bug39763.phpt
  16. +0 −3 ext/filter/tests/bug42718-2.phpt
  17. +0 −1 ext/filter/tests/bug42718.phpt
  18. +0 −2 ext/hash/tests/mhash_001.phpt
  19. +0 −2 ext/hash/tests/mhash_004.phpt
  20. +0 −1 ext/iconv/tests/translit-utf8.phpt
  21. +1 −6 ext/interbase/ibase_query.c
  22. +4 −14 ext/mssql/php_mssql.c
  23. +8 −0 ext/mysql/php_mysql.c
  24. +4 −0 ext/mysqli/mysqli.c
  25. +1 −1 ext/pcre/php_pcre.c
  26. +0 −13 ext/pcre/tests/bug33200.phpt
  27. +1 −2 ext/pdo/tests/pdo_test.inc
  28. +5 −12 ext/pgsql/pgsql.c
  29. +1 −1 ext/phar/func_interceptors.c
  30. +10 −14 ext/phar/tests/fgc_edgecases.phpt
  31. +1 −4 ext/spl/examples/dbaarray.inc
  32. +0 −15 ext/spl/spl_directory.c
  33. +0 −22 ext/spl/tests/SplFileObject_fwrite_variation_003.phpt
  34. +15 −9 ext/standard/basic_functions.c
  35. +2 −9 ext/standard/exec.c
  36. +12 −64 ext/standard/file.c
  37. +0 −1 ext/standard/php_string.h
  38. +2 −13 ext/standard/streamsfuncs.c
  39. +16 −71 ext/standard/string.c
  40. +0 −77 ext/standard/tests/file/magic_quotes.phpt
  41. +17 −20 ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
  42. +10 −29 ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
  43. +9 −43 ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
  44. +0 −204 ext/standard/tests/general_functions/set_magic_quotes_runtime_variation1.phpt
  45. +1 −11 ext/standard/tests/strings/add-and-stripslashes.phpt
  46. +0 −196 ext/standard/tests/strings/addslashes_variation3.phpt
  47. +0 −30 ext/standard/tests/strings/bug22904.phpt
  48. BIN ext/standard/tests/strings/parse_str_basic3.phpt
  49. BIN ext/standard/tests/strings/stripslashes_variation5.phpt
  50. +1 −5 ext/sybase_ct/php_sybase_ct.c
  51. +0 −2 ext/sysvsem/tests/sysv.phpt
  52. +0 −2 ext/xml/tests/xml001.phpt
  53. +0 −2 ext/xml/tests/xml002.phpt
  54. +0 −2 ext/xml/tests/xml003.phpt
  55. +0 −2 ext/xml/tests/xml004.phpt
  56. +0 −2 ext/xml/tests/xml_closures_001.phpt
  57. +0 −23 ext/zlib/tests/004.phpt
  58. +2 −9 ext/zlib/zlib.c
  59. +4 −7 main/main.c
  60. +0 −4 main/php_globals.h
  61. +3 −24 main/php_variables.c
  62. +1 −10 main/rfc1867.c
  63. +0 −29 php.ini-development
  64. +0 −29 php.ini-production
  65. +0 −5 sapi/cgi/cgi_main.c
  66. +0 −5 sapi/fpm/fpm/fpm_main.c
  67. +0 −2 tests/basic/023.phpt
  68. +0 −1 tests/basic/024.phpt
  69. +0 −1 tests/basic/025.phpt
  70. +0 −1 tests/basic/026.phpt
  71. +0 −1 tests/basic/027.phpt
  72. +65 −0 tests/basic/bug46313-win.phpt
  73. +0 −54 tests/basic/bug46313.phpt
  74. +0 −20 tests/basic/bug46759.phpt
  75. +0 −13 tests/security/magic_quotes_gpc.phpt
  76. +0 −1 win32/build/config.w32.h.in
  77. +1 −1 win32/syslog.reg
View
@@ -31,7 +31,7 @@ ZEND_API void zend_init_fpu(TSRMLS_D) /* {{{ */
EG(saved_fpu_cw_ptr) = (void*)&EG(saved_fpu_cw);
}
XPFPA_STORE_CW(EG(saved_fpu_cw_ptr));
- XPFPA_SWITCH_DOUBLE();
+// XPFPA_SWITCH_DOUBLE();
#else
EG(saved_fpu_cw_ptr) = NULL;
#endif
View
@@ -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 Mon Jan 03 10:40:06 2011 */
#line 1 "Zend/zend_ini_scanner.l"
/*
+----------------------------------------------------------------------+
@@ -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 Mon Jan 03 10:40:06 2011 */
#line 3 "Zend/zend_ini_scanner_defs.h"
enum YYCONDTYPE {
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Thu Jun 23 17:57:45 2011 */
+/* Generated by re2c 0.13.5 on Fri Jul 22 13:16:46 2011 */
#line 1 "Zend/zend_language_scanner.l"
/*
+----------------------------------------------------------------------+
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Thu Jun 23 17:57:45 2011 */
+/* Generated by re2c 0.13.5 on Fri Jul 22 13:16:46 2011 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {
View
@@ -474,7 +474,6 @@ static zend_always_inline int fast_increment_function(zval *op1)
"0:"
:
: "r"(op1));
-#else
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MAX)) {
/* switch to double */
Z_DVAL_P(op1) = (double)LONG_MAX + 1.0;
View
@@ -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)
View
@@ -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;
}
/* }}} */
View
@@ -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);
}
View
@@ -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++;
}
@@ -3,7 +3,6 @@ Bug #34704 (Infinite recursion due to corrupt JPEG)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--INI--
-magic_quotes_runtime=0
output_handler=
zlib.output_compression=0
--FILE--
@@ -3,7 +3,6 @@ Check for exif_thumbnail
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--INI--
-magic_quotes_runtime=0
output_handler=
zlib.output_compression=0
--FILE--
@@ -1,90 +0,0 @@
---TEST--
-Check for exif_read_data, magic_quotes_runtime
---SKIPIF--
-<?php
- if (!extension_loaded('exif')) die('skip exif extension not available');
- if (version_compare(PHP_VERSION, "4.4.0-dev", "<")) die('skip PHP 4.4 required');
-?>
---INI--
-output_handler=
-zlib.output_compression=0
-magic_quotes_runtime=1
---FILE--
-<?php
-/*
- test1.jpg is a 1*1 image that does not contain any Exif/Comment information
- test2.jpg is the same image but contains Exif/Comment information and a
- copy of test1.jpg as a thumbnail.
- test6.jpg is the same as test2.jpg but with a UNICODE UserComment: &Auml;&Ouml;&&Uuml;&szlig;&auml;&ouml;&uuml;
-*/
-var_dump(exif_read_data(dirname(__FILE__).'/test6.jpg','',true,false));
-?>
---EXPECTF--
-Deprecated: Directive 'magic_quotes_runtime' is deprecated in PHP 5.3 and greater in Unknown on line 0
-array(5) {
- ["FILE"]=>
- array(6) {
- ["FileName"]=>
- string(9) "test6.jpg"
- ["FileDateTime"]=>
- int(%d)
- ["FileSize"]=>
- int(1240)
- ["FileType"]=>
- int(2)
- ["MimeType"]=>
- string(10) "image/jpeg"
- ["SectionsFound"]=>
- string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
- }
- ["COMPUTED"]=>
- array(12) {
- ["html"]=>
- string(24) "width=\"1\" height=\"1\""
- ["Height"]=>
- int(1)
- ["Width"]=>
- int(1)
- ["IsColor"]=>
- int(1)
- ["ByteOrderMotorola"]=>
- int(1)
- ["UserComment"]=>
- string(16) "Hallo \'Du\'+da!"
- ["UserCommentEncoding"]=>
- string(5) "ASCII"
- ["Copyright"]=>
- string(45) "Photo \"M. Boerger\"., Edited \'M. Boerger\'."
- ["Copyright.Photographer"]=>
- string(21) "Photo \"M. Boerger\"."
- ["Copyright.Editor"]=>
- string(22) "Edited \'M. Boerger\'."
- ["Thumbnail.FileType"]=>
- int(2)
- ["Thumbnail.MimeType"]=>
- string(10) "image/jpeg"
- }
- ["IFD0"]=>
- array(2) {
- ["Copyright"]=>
- string(21) "Photo \"M. Boerger\"."
- ["UserComment"]=>
- string(5) "ASCII"
- }
- ["THUMBNAIL"]=>
- array(2) {
- ["JPEGInterchangeFormat"]=>
- int(134)
- ["JPEGInterchangeFormatLength"]=>
- int(523)
- }
- ["COMMENT"]=>
- array(3) {
- [0]=>
- string(13) "Comment \"1\""
- [1]=>
- string(13) "Comment \'2\'"
- [2]=>
- string(13) "Comment #3end"
- }
-}
View
@@ -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);
}
@@ -1,17 +0,0 @@
---TEST--
-Bug #39763 (filter applies magic_quotes twice in parse_str())
---INI--
-magic_quotes_gpc=1
-filter.default=
---FILE--
-<?php
-$arr = array();
-parse_str("val=%22probably+a+bug%22", $arr);
-echo $arr['val'] . "\n";
-parse_str("val=%22probably+a+bug%22");
-echo $val . "\n";
-?>
---EXPECT--
-Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
-\"probably a bug\"
-\"probably a bug\"
@@ -4,7 +4,6 @@ Bug #42718 - 2 (unsafe_raw filter not applied when configured as default filter)
<?php if (!extension_loaded("filter")) die("skip"); ?>
--INI--
display_errors=0
-magic_quotes_gpc=1
filter.default=unsafe_raw
filter.default_flags=
--GET--
@@ -13,9 +12,7 @@ a=1%00
<?php
echo ini_get('filter.default') . "\n";
echo ini_get('filter.default_flags') . "\n";
-echo addcslashes($_GET['a'],"\0") . "\n";
?>
--EXPECT--
unsafe_raw
-1\0
@@ -5,7 +5,6 @@ FILTER_UNSAFE_RAW not applied when configured as default filter, even with flags
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
--INI--
-magic_quotes_gpc=0
filter.default=unsafe_raw
filter.default_flags=4
--GET--
@@ -1,7 +1,5 @@
--TEST--
mhash() test
---INI--
-magic_quotes_runtime=0
--SKIPIF--
<?php
include "skip_mhash.inc";
@@ -1,7 +1,5 @@
--TEST--
mhash() modifying algorithm parameter
---INI--
-magic_quotes_runtime=0
--SKIPIF--
<?php
include "skip_mhash.inc";
@@ -6,7 +6,6 @@ include('skipif.inc');
( ICONV_IMPL != "libiconv" ) and die("skip ICONV_IMPL != \"libiconv\"");
?>
--INI--
-magic_quotes_runtime=0
error_reporting=2047
--FILE--
<?php // vim600: syn=php
@@ -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;
View
@@ -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) {
Oops, something went wrong.

0 comments on commit cc1c7af

Please sign in to comment.