mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
- 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
This commit is contained in:
parent
5ef9ab3b03
commit
cc1c7af037
@ -31,7 +31,7 @@ ZEND_API void zend_init_fpu(TSRMLS_D) /* {{{ */
|
|||||||
EG(saved_fpu_cw_ptr) = (void*)&EG(saved_fpu_cw);
|
EG(saved_fpu_cw_ptr) = (void*)&EG(saved_fpu_cw);
|
||||||
}
|
}
|
||||||
XPFPA_STORE_CW(EG(saved_fpu_cw_ptr));
|
XPFPA_STORE_CW(EG(saved_fpu_cw_ptr));
|
||||||
XPFPA_SWITCH_DOUBLE();
|
// XPFPA_SWITCH_DOUBLE();
|
||||||
#else
|
#else
|
||||||
EG(saved_fpu_cw_ptr) = NULL;
|
EG(saved_fpu_cw_ptr) = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -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"
|
#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"
|
#line 3 "Zend/zend_ini_scanner_defs.h"
|
||||||
|
|
||||||
enum YYCONDTYPE {
|
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"
|
#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"
|
#line 3 "Zend/zend_language_scanner_defs.h"
|
||||||
|
|
||||||
enum YYCONDTYPE {
|
enum YYCONDTYPE {
|
||||||
|
@ -474,7 +474,6 @@ static zend_always_inline int fast_increment_function(zval *op1)
|
|||||||
"0:"
|
"0:"
|
||||||
:
|
:
|
||||||
: "r"(op1));
|
: "r"(op1));
|
||||||
#else
|
|
||||||
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MAX)) {
|
if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MAX)) {
|
||||||
/* switch to double */
|
/* switch to double */
|
||||||
Z_DVAL_P(op1) = (double)LONG_MAX + 1.0;
|
Z_DVAL_P(op1) = (double)LONG_MAX + 1.0;
|
||||||
|
@ -901,15 +901,6 @@ else
|
|||||||
AC_DEFINE(PHP_SIGCHILD, 0, [ ])
|
AC_DEFINE(PHP_SIGCHILD, 0, [ ])
|
||||||
fi
|
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,
|
PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc,
|
||||||
[ --enable-libgcc Enable explicitly linking against libgcc], no, no)
|
[ --enable-libgcc Enable explicitly linking against libgcc], no, no)
|
||||||
|
|
||||||
|
@ -352,13 +352,6 @@ static PHP_FUNCTION(bzread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
|
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;
|
Z_TYPE_P(return_value) = IS_STRING;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@ -560,20 +560,9 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
|||||||
|
|
||||||
DBA_WRITE_CHECK;
|
DBA_WRITE_CHECK;
|
||||||
|
|
||||||
if (PG(magic_quotes_runtime)) {
|
if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) {
|
||||||
v = estrndup(val, val_len);
|
DBA_ID_DONE;
|
||||||
php_stripslashes(v, &val_len TSRMLS_CC);
|
RETURN_TRUE;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DBA_ID_DONE;
|
DBA_ID_DONE;
|
||||||
@ -1029,9 +1018,6 @@ PHP_FUNCTION(dba_fetch)
|
|||||||
skip = 0;
|
skip = 0;
|
||||||
}
|
}
|
||||||
if((val = info->hnd->fetch(info, key_str, key_len, skip, &len TSRMLS_CC)) != NULL) {
|
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;
|
DBA_ID_DONE;
|
||||||
RETURN_STRINGL(val, len, 0);
|
RETURN_STRINGL(val, len, 0);
|
||||||
}
|
}
|
||||||
|
@ -1697,11 +1697,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
|||||||
case TAG_FMT_STRING:
|
case TAG_FMT_STRING:
|
||||||
if (value) {
|
if (value) {
|
||||||
length = php_strnlen(value, length);
|
length = php_strnlen(value, length);
|
||||||
if (PG(magic_quotes_runtime)) {
|
info_value->s = estrndup(value, length);
|
||||||
info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
|
|
||||||
} else {
|
|
||||||
info_value->s = estrndup(value, length);
|
|
||||||
}
|
|
||||||
info_data->length = length;
|
info_data->length = length;
|
||||||
} else {
|
} else {
|
||||||
info_data->length = 0;
|
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:
|
case TAG_FMT_UNDEFINED:
|
||||||
if (value) {
|
if (value) {
|
||||||
/* do not recompute length here */
|
/* do not recompute length here */
|
||||||
if (PG(magic_quotes_runtime)) {
|
info_value->s = estrndup(value, length);
|
||||||
info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
|
|
||||||
} else {
|
|
||||||
info_value->s = estrndup(value, length);
|
|
||||||
}
|
|
||||||
info_data->length = length;
|
info_data->length = length;
|
||||||
} else {
|
} else {
|
||||||
info_data->length = 0;
|
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->format = TAG_FMT_STRING;
|
||||||
info_data->length = 1;
|
info_data->length = 1;
|
||||||
info_data->name = estrdup(name);
|
info_data->name = estrdup(name);
|
||||||
if (PG(magic_quotes_runtime)) {
|
info_data->value.s = estrdup(value);
|
||||||
info_data->value.s = php_addslashes(value, strlen(value), NULL, 0 TSRMLS_CC);
|
|
||||||
} else {
|
|
||||||
info_data->value.s = estrdup(value);
|
|
||||||
}
|
|
||||||
image_info->sections_found |= 1<<section_index;
|
image_info->sections_found |= 1<<section_index;
|
||||||
image_info->info_list[section_index].count++;
|
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->format = TAG_FMT_UNDEFINED;
|
||||||
info_data->length = length;
|
info_data->length = length;
|
||||||
info_data->name = estrdup(name);
|
info_data->name = estrdup(name);
|
||||||
if (PG(magic_quotes_runtime)) {
|
info_data->value.s = safe_emalloc(length, 1, 1);
|
||||||
#ifdef EXIF_DEBUG
|
memcpy(info_data->value.s, value, length);
|
||||||
exif_error_docref(NULL EXIFERR_CC, image_info, E_NOTICE, "Adding %s as buffer%s", name, exif_char_dump(value, length, 0));
|
info_data->value.s[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;
|
|
||||||
}
|
|
||||||
image_info->sections_found |= 1<<section_index;
|
image_info->sections_found |= 1<<section_index;
|
||||||
image_info->info_list[section_index].count++;
|
image_info->info_list[section_index].count++;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ Bug #34704 (Infinite recursion due to corrupt JPEG)
|
|||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_runtime=0
|
|
||||||
output_handler=
|
output_handler=
|
||||||
zlib.output_compression=0
|
zlib.output_compression=0
|
||||||
--FILE--
|
--FILE--
|
||||||
|
@ -3,7 +3,6 @@ Check for exif_thumbnail
|
|||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_runtime=0
|
|
||||||
output_handler=
|
output_handler=
|
||||||
zlib.output_compression=0
|
zlib.output_compression=0
|
||||||
--FILE--
|
--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: ÄÖ&Üßäöü
|
|
||||||
*/
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
Z_STRVAL(new_var) = estrndup(*val, val_len);
|
||||||
INIT_PZVAL(tmp_new_var);
|
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);
|
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 {
|
} else {
|
||||||
Z_STRVAL(new_var) = estrndup(*val, val_len);
|
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"); ?>
|
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||||
--INI--
|
--INI--
|
||||||
display_errors=0
|
display_errors=0
|
||||||
magic_quotes_gpc=1
|
|
||||||
filter.default=unsafe_raw
|
filter.default=unsafe_raw
|
||||||
filter.default_flags=
|
filter.default_flags=
|
||||||
--GET--
|
--GET--
|
||||||
@ -13,9 +12,7 @@ a=1%00
|
|||||||
<?php
|
<?php
|
||||||
echo ini_get('filter.default') . "\n";
|
echo ini_get('filter.default') . "\n";
|
||||||
echo ini_get('filter.default_flags') . "\n";
|
echo ini_get('filter.default_flags') . "\n";
|
||||||
echo addcslashes($_GET['a'],"\0") . "\n";
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
unsafe_raw
|
unsafe_raw
|
||||||
|
|
||||||
1\0
|
|
||||||
|
@ -5,7 +5,6 @@ FILTER_UNSAFE_RAW not applied when configured as default filter, even with flags
|
|||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_gpc=0
|
|
||||||
filter.default=unsafe_raw
|
filter.default=unsafe_raw
|
||||||
filter.default_flags=4
|
filter.default_flags=4
|
||||||
--GET--
|
--GET--
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
mhash() test
|
mhash() test
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime=0
|
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
include "skip_mhash.inc";
|
include "skip_mhash.inc";
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
mhash() modifying algorithm parameter
|
mhash() modifying algorithm parameter
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime=0
|
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
include "skip_mhash.inc";
|
include "skip_mhash.inc";
|
||||||
|
@ -6,7 +6,6 @@ include('skipif.inc');
|
|||||||
( ICONV_IMPL != "libiconv" ) and die("skip ICONV_IMPL != \"libiconv\"");
|
( ICONV_IMPL != "libiconv" ) and die("skip ICONV_IMPL != \"libiconv\"");
|
||||||
?>
|
?>
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_runtime=0
|
|
||||||
error_reporting=2047
|
error_reporting=2047
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php // vim600: syn=php
|
<?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;
|
data = ((IBVARY *) data)->vary_string;
|
||||||
/* no break */
|
/* no break */
|
||||||
case SQL_TEXT:
|
case SQL_TEXT:
|
||||||
if (PG(magic_quotes_runtime)) {
|
ZVAL_STRINGL(val,(char *) data,len,1);
|
||||||
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);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SQL_SHORT:
|
case SQL_SHORT:
|
||||||
n = *(short *) data;
|
n = *(short *) data;
|
||||||
|
@ -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) {
|
if (Z_TYPE(result->data[result->cur_row][i]) != IS_NULL) {
|
||||||
char *data;
|
char *data;
|
||||||
int data_len;
|
int data_len;
|
||||||
int should_copy;
|
|
||||||
|
|
||||||
if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) {
|
if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) {
|
||||||
if (PG(magic_quotes_runtime)) {
|
data = Z_STRVAL(result->data[result->cur_row][i]);
|
||||||
data = php_addslashes(Z_STRVAL(result->data[result->cur_row][i]), Z_STRLEN(result->data[result->cur_row][i]), &data_len, 0 TSRMLS_CC);
|
data_len = Z_STRLEN(result->data[result->cur_row][i]);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result_type & MSSQL_NUM) {
|
if (result_type & MSSQL_NUM) {
|
||||||
add_index_stringl(return_value, i, data, data_len, should_copy);
|
add_index_stringl(return_value, i, data, data_len, 1);
|
||||||
should_copy = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result_type & MSSQL_ASSOC) {
|
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) {
|
else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) {
|
||||||
|
@ -1955,12 +1955,16 @@ Q: String or long first?
|
|||||||
if (sql_row[field_offset]) {
|
if (sql_row[field_offset]) {
|
||||||
Z_TYPE_P(return_value) = IS_STRING;
|
Z_TYPE_P(return_value) = IS_STRING;
|
||||||
|
|
||||||
|
#if PHP_API_VERSION < 20100412
|
||||||
if (PG(magic_quotes_runtime)) {
|
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);
|
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 {
|
} else {
|
||||||
|
#endif
|
||||||
Z_STRLEN_P(return_value) = sql_row_lengths[field_offset];
|
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));
|
Z_STRVAL_P(return_value) = (char *) safe_estrndup(sql_row[field_offset], Z_STRLEN_P(return_value));
|
||||||
|
#if PHP_API_VERSION < 20100412
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
Z_TYPE_P(return_value) = IS_NULL;
|
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);
|
MAKE_STD_ZVAL(data);
|
||||||
|
|
||||||
|
#if PHP_API_VERSION < 20100412
|
||||||
if (PG(magic_quotes_runtime)) {
|
if (PG(magic_quotes_runtime)) {
|
||||||
Z_TYPE_P(data) = IS_STRING;
|
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);
|
Z_STRVAL_P(data) = php_addslashes(mysql_row[i], mysql_row_lengths[i], &Z_STRLEN_P(data), 0 TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
ZVAL_STRINGL(data, mysql_row[i], mysql_row_lengths[i], 1);
|
ZVAL_STRINGL(data, mysql_row[i], mysql_row_lengths[i], 1);
|
||||||
|
#if PHP_API_VERSION < 20100412
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (result_type & MYSQL_NUM) {
|
if (result_type & MYSQL_NUM) {
|
||||||
add_index_zval(return_value, i, data);
|
add_index_zval(return_value, i, data);
|
||||||
|
@ -1137,13 +1137,17 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if PHP_API_VERSION < 20100412
|
||||||
/* check if we need magic quotes */
|
/* check if we need magic quotes */
|
||||||
if (PG(magic_quotes_runtime)) {
|
if (PG(magic_quotes_runtime)) {
|
||||||
Z_TYPE_P(res) = IS_STRING;
|
Z_TYPE_P(res) = IS_STRING;
|
||||||
Z_STRVAL_P(res) = php_addslashes(row[i], field_len[i], &Z_STRLEN_P(res), 0 TSRMLS_CC);
|
Z_STRVAL_P(res) = php_addslashes(row[i], field_len[i], &Z_STRLEN_P(res), 0 TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
ZVAL_STRINGL(res, row[i], field_len[i], 1);
|
ZVAL_STRINGL(res, row[i], field_len[i], 1);
|
||||||
|
#if PHP_API_VERSION < 20100412
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetchtype & MYSQLI_NUM) {
|
if (fetchtype & MYSQLI_NUM) {
|
||||||
|
@ -898,7 +898,7 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
|
|||||||
match = subject + offsets[backref<<1];
|
match = subject + offsets[backref<<1];
|
||||||
match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
|
match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
|
||||||
if (match_len) {
|
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 {
|
} else {
|
||||||
esc_match = match;
|
esc_match = match;
|
||||||
esc_match_len = 0;
|
esc_match_len = 0;
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
Bug #33200 (magic_quotes_sybase = On makes 'e' modifier misbehave)
|
|
||||||
--INI--
|
|
||||||
magic_quotes_sybase=1
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
$str = 'some \'$sample\' text';
|
|
||||||
$str = preg_replace("/(some.*text)/e", "strtoupper('\\1')", $str);
|
|
||||||
echo $str . "\r\n";
|
|
||||||
?>
|
|
||||||
--EXPECT--
|
|
||||||
Deprecated: Directive 'magic_quotes_sybase' is deprecated in PHP 5.3 and greater in Unknown on line 0
|
|
||||||
SOME '$SAMPLE' TEXT
|
|
@ -11,7 +11,6 @@ if (getenv('PDOTEST_DSN') === false) {
|
|||||||
$append = true;
|
$append = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ini_get('magic_quotes_runtime')) $common = stripslashes($common);
|
|
||||||
$conf = eval($common);
|
$conf = eval($common);
|
||||||
foreach($conf['ENV'] as $n=>$v) putenv("$n=$v");
|
foreach($conf['ENV'] as $n=>$v) putenv("$n=$v");
|
||||||
}
|
}
|
||||||
@ -76,4 +75,4 @@ class PDOTest {
|
|||||||
return self::factory();
|
return self::factory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -2499,12 +2499,8 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
|
|||||||
int should_copy=0;
|
int should_copy=0;
|
||||||
const uint element_len = strlen(element);
|
const uint element_len = strlen(element);
|
||||||
|
|
||||||
if (PG(magic_quotes_runtime)) {
|
data = safe_estrndup(element, element_len);
|
||||||
data = php_addslashes(element, element_len, &data_len, 0 TSRMLS_CC);
|
data_len = element_len;
|
||||||
} else {
|
|
||||||
data = safe_estrndup(element, element_len);
|
|
||||||
data_len = element_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result_type & PGSQL_NUM) {
|
if (result_type & PGSQL_NUM) {
|
||||||
add_index_stringl(return_value, i, data, data_len, should_copy);
|
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;
|
size_t data_len;
|
||||||
const size_t element_len = strlen(element);
|
const size_t element_len = strlen(element);
|
||||||
|
|
||||||
if (PG(magic_quotes_runtime)) {
|
data = safe_estrndup(element, element_len);
|
||||||
data = php_addslashes(element, element_len, &data_len, 0 TSRMLS_CC);
|
data_len = element_len;
|
||||||
} else {
|
|
||||||
data = safe_estrndup(element, element_len);
|
|
||||||
data_len = element_len;
|
|
||||||
}
|
|
||||||
field_name = PQfname(pg_result, i);
|
field_name = PQfname(pg_result, i);
|
||||||
add_assoc_stringl(row, field_name, data, data_len, 0);
|
add_assoc_stringl(row, field_name, data, data_len, 0);
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ phar_it:
|
|||||||
|
|
||||||
/* uses mmap if possible */
|
/* uses mmap if possible */
|
||||||
if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) {
|
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)) {
|
if (PG(magic_quotes_runtime)) {
|
||||||
int newlen;
|
int newlen;
|
||||||
contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
|
contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
|
||||||
|
@ -33,7 +33,6 @@ echo file_get_contents("foob", true);
|
|||||||
echo file_get_contents("./hi", 0, $context);
|
echo file_get_contents("./hi", 0, $context);
|
||||||
echo file_get_contents("../oops");
|
echo file_get_contents("../oops");
|
||||||
echo file_get_contents("./hi", 0, $context, 50000);
|
echo file_get_contents("./hi", 0, $context, 50000);
|
||||||
ini_set("magic_quotes_runtime", 1);
|
|
||||||
echo file_get_contents("./hi");
|
echo file_get_contents("./hi");
|
||||||
echo file_get_contents("./hi", 0, $context, 0, 0);
|
echo file_get_contents("./hi", 0, $context, 0, 0);
|
||||||
?>
|
?>
|
||||||
@ -60,7 +59,6 @@ echo file_get_contents("foob", true);
|
|||||||
echo file_get_contents("./hi", 0, $context);
|
echo file_get_contents("./hi", 0, $context);
|
||||||
echo file_get_contents("../oops");
|
echo file_get_contents("../oops");
|
||||||
echo file_get_contents("./hi", 0, $context, 50000);
|
echo file_get_contents("./hi", 0, $context, 50000);
|
||||||
ini_set("magic_quotes_runtime", 1);
|
|
||||||
echo file_get_contents("./hi");
|
echo file_get_contents("./hi");
|
||||||
echo file_get_contents("./hi", 0, $context, 0, 0);
|
echo file_get_contents("./hi", 0, $context, 0, 0);
|
||||||
?>
|
?>
|
||||||
@ -78,7 +76,6 @@ echo file_get_contents("foob", true);
|
|||||||
echo file_get_contents("./hi", 0, $context);
|
echo file_get_contents("./hi", 0, $context);
|
||||||
echo file_get_contents("../oops");
|
echo file_get_contents("../oops");
|
||||||
echo file_get_contents("./hi", 0, $context, 50000);
|
echo file_get_contents("./hi", 0, $context, 50000);
|
||||||
ini_set("magic_quotes_runtime", 1);
|
|
||||||
echo file_get_contents("./hi");
|
echo file_get_contents("./hi");
|
||||||
echo file_get_contents("./hi", 0, $context, 0, 0);
|
echo file_get_contents("./hi", 0, $context, 0, 0);
|
||||||
?>
|
?>
|
||||||
@ -87,17 +84,16 @@ Warning: file_get_contents(phar://%sfgc_edgecases.phar.php/oops): failed to open
|
|||||||
|
|
||||||
Warning: file_get_contents(): Failed to seek to position 50000 in the stream in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
|
Warning: file_get_contents(): Failed to seek to position 50000 in the stream in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
|
||||||
<?php
|
<?php
|
||||||
echo file_get_contents(\"foo/\" . basename(__FILE__));
|
echo file_get_contents("foo/" . basename(__FILE__));
|
||||||
$context = stream_context_create();
|
$context = stream_context_create();
|
||||||
file_get_contents(\"./hi\", 0, $context, 0, -1);
|
file_get_contents("./hi", 0, $context, 0, -1);
|
||||||
echo file_get_contents(\"foob\");
|
echo file_get_contents("foob");
|
||||||
set_include_path(\"%stests\");
|
set_include_path("%stests");
|
||||||
echo file_get_contents(\"foob\", true);
|
echo file_get_contents("foob", true);
|
||||||
echo file_get_contents(\"./hi\", 0, $context);
|
echo file_get_contents("./hi", 0, $context);
|
||||||
echo file_get_contents(\"../oops\");
|
echo file_get_contents("../oops");
|
||||||
echo file_get_contents(\"./hi\", 0, $context, 50000);
|
echo file_get_contents("./hi", 0, $context, 50000);
|
||||||
ini_set(\"magic_quotes_runtime\", 1);
|
echo file_get_contents("./hi");
|
||||||
echo file_get_contents(\"./hi\");
|
echo file_get_contents("./hi", 0, $context, 0, 0);
|
||||||
echo file_get_contents(\"./hi\", 0, $context, 0, 0);
|
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
|
@ -51,9 +51,6 @@ class DbaArray extends DbaReader implements ArrayAccess
|
|||||||
{
|
{
|
||||||
$data = dba_fetch($name, $this->db);
|
$data = dba_fetch($name, $this->db);
|
||||||
if($data) {
|
if($data) {
|
||||||
if (ini_get('magic_quotes_runtime')) {
|
|
||||||
$data = stripslashes($data);
|
|
||||||
}
|
|
||||||
//return unserialize($data);
|
//return unserialize($data);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@ -95,4 +92,4 @@ class DbaArray extends DbaReader implements ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1993,7 +1993,6 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS
|
|||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t line_len = 0;
|
size_t line_len = 0;
|
||||||
int len;
|
|
||||||
long line_add = (intern->u.file.current_line || intern->u.file.current_zval) ? 1 : 0;
|
long line_add = (intern->u.file.current_line || intern->u.file.current_zval) ? 1 : 0;
|
||||||
|
|
||||||
spl_filesystem_file_free_line(intern TSRMLS_CC);
|
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';
|
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 = buf;
|
||||||
intern->u.file.current_line_len = line_len;
|
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);
|
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||||
char *str;
|
char *str;
|
||||||
int str_len;
|
int str_len;
|
||||||
int ret;
|
|
||||||
long length = 0;
|
long length = 0;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) {
|
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);
|
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));
|
RETURN_LONG(php_stream_write(intern->u.file.stream, str, str_len));
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
SplFileObject::fwrite function - writing with magic_quotes_runtime ini set
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
ini_set('magic_quotes_runtime',true);
|
|
||||||
$file = dirname(__FILE__).'/SplFileObject_fwrite_variation_002.txt';
|
|
||||||
if(file_exists($file)) {
|
|
||||||
unlink($file);
|
|
||||||
}
|
|
||||||
$obj = New SplFileObject($file,'w');
|
|
||||||
$obj->fwrite('"test" \'write\'');
|
|
||||||
var_dump(file_get_contents($file));
|
|
||||||
?>
|
|
||||||
--CLEAN--
|
|
||||||
<?php
|
|
||||||
$file = dirname(__FILE__).'/SplFileObject_fwrite_variation_002.txt';
|
|
||||||
if(file_exists($file)) {
|
|
||||||
unlink($file);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
--EXPECT--
|
|
||||||
string(18) "\"test\" \'write\'"
|
|
@ -2966,8 +2966,8 @@ const zend_function_entry basic_functions[] = { /* {{{ */
|
|||||||
|
|
||||||
PHP_DEP_FALIAS(magic_quotes_runtime, set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime)
|
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_DEP_FE(set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime)
|
||||||
PHP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc)
|
PHP_DEP_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_runtime, arginfo_get_magic_quotes_runtime)
|
||||||
|
|
||||||
PHP_FE(error_log, arginfo_error_log)
|
PHP_FE(error_log, arginfo_error_log)
|
||||||
PHP_FE(error_get_last, arginfo_error_get_last)
|
PHP_FE(error_get_last, arginfo_error_get_last)
|
||||||
@ -4586,7 +4586,7 @@ PHP_FUNCTION(get_cfg_var)
|
|||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto bool set_magic_quotes_runtime(int new_setting)
|
/* {{{ 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)
|
PHP_FUNCTION(set_magic_quotes_runtime)
|
||||||
{
|
{
|
||||||
zend_bool new_setting;
|
zend_bool new_setting;
|
||||||
@ -4594,11 +4594,11 @@ PHP_FUNCTION(set_magic_quotes_runtime)
|
|||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) {
|
||||||
return;
|
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) {
|
if (new_setting) {
|
||||||
RETURN_FALSE;
|
php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore");
|
||||||
}
|
}
|
||||||
RETURN_TRUE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
@ -4606,7 +4606,10 @@ PHP_FUNCTION(set_magic_quotes_runtime)
|
|||||||
Get the current active configuration setting of magic_quotes_runtime */
|
Get the current active configuration setting of magic_quotes_runtime */
|
||||||
PHP_FUNCTION(get_magic_quotes_runtime)
|
PHP_FUNCTION(get_magic_quotes_runtime)
|
||||||
{
|
{
|
||||||
RETURN_LONG(PG(magic_quotes_runtime));
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
@ -4614,7 +4617,10 @@ PHP_FUNCTION(get_magic_quotes_runtime)
|
|||||||
Get the current active configuration setting of magic_quotes_gpc */
|
Get the current active configuration setting of magic_quotes_gpc */
|
||||||
PHP_FUNCTION(get_magic_quotes_gpc)
|
PHP_FUNCTION(get_magic_quotes_gpc)
|
||||||
{
|
{
|
||||||
RETURN_LONG(PG(magic_quotes_gpc));
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
|
PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *buf, *tmp=NULL;
|
char *buf;
|
||||||
int l = 0, pclose_return;
|
int l = 0, pclose_return;
|
||||||
char *b, *d=NULL;
|
char *b, *d=NULL;
|
||||||
php_stream *stream;
|
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 */
|
/* Return last line from the shell command */
|
||||||
if (PG(magic_quotes_runtime)) {
|
RETVAL_STRINGL(buf, bufl, 1);
|
||||||
int len;
|
|
||||||
|
|
||||||
tmp = php_addslashes(buf, bufl, &len, 0 TSRMLS_CC);
|
|
||||||
RETVAL_STRINGL(tmp, len, 0);
|
|
||||||
} else {
|
|
||||||
RETVAL_STRINGL(buf, bufl, 1);
|
|
||||||
}
|
|
||||||
} else { /* should return NULL, but for BC we return "" */
|
} else { /* should return NULL, but for BC we return "" */
|
||||||
RETVAL_EMPTY_STRING();
|
RETVAL_EMPTY_STRING();
|
||||||
}
|
}
|
||||||
|
@ -423,13 +423,7 @@ PHP_FUNCTION(get_meta_tags)
|
|||||||
have_name = 1;
|
have_name = 1;
|
||||||
} else if (saw_content) {
|
} else if (saw_content) {
|
||||||
STR_FREE(value);
|
STR_FREE(value);
|
||||||
/* Get the CONTENT attr (Single word attr, non-quoted) */
|
value = estrndup(md.token_data, md.token_len);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
have_content = 1;
|
have_content = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,13 +457,7 @@ PHP_FUNCTION(get_meta_tags)
|
|||||||
have_name = 1;
|
have_name = 1;
|
||||||
} else if (saw_content) {
|
} else if (saw_content) {
|
||||||
STR_FREE(value);
|
STR_FREE(value);
|
||||||
/* Get the CONTENT attr (Single word attr, non-quoted) */
|
value = estrndup(md.token_data, md.token_len);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
have_content = 1;
|
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 ((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);
|
RETVAL_STRINGL(contents, len, 0);
|
||||||
} else if (len == 0) {
|
} else if (len == 0) {
|
||||||
RETVAL_EMPTY_STRING();
|
RETVAL_EMPTY_STRING();
|
||||||
@ -724,9 +707,9 @@ PHP_FUNCTION(file)
|
|||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
int filename_len;
|
int filename_len;
|
||||||
char *slashed, *target_buf=NULL, *p, *s, *e;
|
char *target_buf=NULL, *p, *s, *e;
|
||||||
register int i = 0;
|
register int i = 0;
|
||||||
int target_len, len;
|
int target_len;
|
||||||
char eol_marker = '\n';
|
char eol_marker = '\n';
|
||||||
long flags = 0;
|
long flags = 0;
|
||||||
zend_bool use_include_path;
|
zend_bool use_include_path;
|
||||||
@ -778,13 +761,7 @@ PHP_FUNCTION(file)
|
|||||||
do {
|
do {
|
||||||
p++;
|
p++;
|
||||||
parse_eol:
|
parse_eol:
|
||||||
if (PG(magic_quotes_runtime)) {
|
add_index_stringl(return_value, i++, estrndup(s, p-s), p-s, 0);
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
s = p;
|
s = p;
|
||||||
} while ((p = memchr(p, eol_marker, (e-p))));
|
} while ((p = memchr(p, eol_marker, (e-p))));
|
||||||
} else {
|
} else {
|
||||||
@ -797,13 +774,7 @@ parse_eol:
|
|||||||
s = ++p;
|
s = ++p;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (PG(magic_quotes_runtime)) {
|
add_index_stringl(return_value, i++, estrndup(s, p-s-windows_eol), p-s-windows_eol, 0);
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
s = ++p;
|
s = ++p;
|
||||||
} while ((p = memchr(p, eol_marker, (e-p))));
|
} while ((p = memchr(p, eol_marker, (e-p))));
|
||||||
}
|
}
|
||||||
@ -1049,16 +1020,11 @@ PHPAPI PHP_FUNCTION(fgets)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PG(magic_quotes_runtime)) {
|
ZVAL_STRINGL(return_value, buf, line_len, 0);
|
||||||
Z_STRVAL_P(return_value) = php_addslashes(buf, line_len, &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
|
/* resize buffer if it's much larger than the result.
|
||||||
Z_TYPE_P(return_value) = IS_STRING;
|
* Only needed if the user requested a buffer size. */
|
||||||
} else {
|
if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) {
|
||||||
ZVAL_STRINGL(return_value, buf, line_len, 0);
|
Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1);
|
||||||
/* 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;
|
return;
|
||||||
|
|
||||||
@ -1219,11 +1185,6 @@ PHPAPI PHP_FUNCTION(fwrite)
|
|||||||
|
|
||||||
PHP_STREAM_TO_ZVAL(stream, &arg1);
|
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);
|
ret = php_stream_write(stream, buffer ? buffer : arg2, num_bytes);
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
efree(buffer);
|
efree(buffer);
|
||||||
@ -1790,11 +1751,6 @@ PHPAPI PHP_FUNCTION(fread)
|
|||||||
|
|
||||||
/* needed because recv/read/gzread doesnt put a null at the end*/
|
/* needed because recv/read/gzread doesnt put a null at the end*/
|
||||||
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
|
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;
|
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_appendc(&csvline, '\n');
|
||||||
smart_str_0(&csvline);
|
smart_str_0(&csvline);
|
||||||
|
|
||||||
if (!PG(magic_quotes_runtime)) {
|
ret = php_stream_write(stream, csvline.c, csvline.len);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
smart_str_free(&csvline);
|
smart_str_free(&csvline);
|
||||||
|
|
||||||
|
@ -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_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_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(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 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_stripslashes(char *str, int *len TSRMLS_DC);
|
||||||
PHPAPI void php_stripcslashes(char *str, int *len);
|
PHPAPI void php_stripcslashes(char *str, int *len);
|
||||||
|
@ -395,13 +395,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
|
|||||||
}
|
}
|
||||||
read_buf[recvd] = '\0';
|
read_buf[recvd] = '\0';
|
||||||
|
|
||||||
if (PG(magic_quotes_runtime)) {
|
RETURN_STRINGL(read_buf, recvd, 0);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
efree(read_buf);
|
efree(read_buf);
|
||||||
@ -417,8 +411,7 @@ PHP_FUNCTION(stream_get_contents)
|
|||||||
zval *zsrc;
|
zval *zsrc;
|
||||||
long maxlen = PHP_STREAM_COPY_ALL,
|
long maxlen = PHP_STREAM_COPY_ALL,
|
||||||
desiredpos = -1L;
|
desiredpos = -1L;
|
||||||
int len,
|
int len;
|
||||||
newlen;
|
|
||||||
char *contents = NULL;
|
char *contents = NULL;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) {
|
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);
|
len = php_stream_copy_to_mem(stream, &contents, maxlen, 0);
|
||||||
|
|
||||||
if (contents) {
|
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);
|
RETVAL_STRINGL(contents, len, 0);
|
||||||
} else {
|
} else {
|
||||||
RETVAL_EMPTY_STRING();
|
RETVAL_EMPTY_STRING();
|
||||||
|
@ -3015,34 +3015,6 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC)
|
|||||||
s = str;
|
s = str;
|
||||||
t = 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) {
|
while (l > 0) {
|
||||||
if (*t == '\\') {
|
if (*t == '\\') {
|
||||||
t++; /* skip the slash */
|
t++; /* skip the slash */
|
||||||
@ -3286,14 +3258,6 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_
|
|||||||
/* {{{ php_addslashes
|
/* {{{ php_addslashes
|
||||||
*/
|
*/
|
||||||
PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC)
|
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 */
|
/* maximum string length, worst case situation */
|
||||||
char *new_str;
|
char *new_str;
|
||||||
@ -3313,42 +3277,23 @@ PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int shoul
|
|||||||
end = source + length;
|
end = source + length;
|
||||||
target = new_str;
|
target = new_str;
|
||||||
|
|
||||||
if (!ignore_sybase && PG(magic_quotes_sybase)) {
|
while (source < end) {
|
||||||
while (source < end) {
|
switch (*source) {
|
||||||
switch (*source) {
|
case '\0':
|
||||||
case '\0':
|
*target++ = '\\';
|
||||||
*target++ = '\\';
|
*target++ = '0';
|
||||||
*target++ = '0';
|
break;
|
||||||
break;
|
case '\'':
|
||||||
case '\'':
|
case '\"':
|
||||||
*target++ = '\'';
|
case '\\':
|
||||||
*target++ = '\'';
|
*target++ = '\\';
|
||||||
break;
|
/* break is missing *intentionally* */
|
||||||
default:
|
default:
|
||||||
*target++ = *source;
|
*target++ = *source;
|
||||||
break;
|
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++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*target = 0;
|
*target = 0;
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
various magic quotes tests
|
|
||||||
--INI--
|
|
||||||
error_reporting=14335
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$filename = dirname(__FILE__)."/magic_quotes.dat";
|
|
||||||
|
|
||||||
var_dump(get_magic_quotes_runtime());
|
|
||||||
var_dump(get_magic_quotes_runtime("blah"));
|
|
||||||
|
|
||||||
file_put_contents($filename, "some'content'here\"and}there");
|
|
||||||
|
|
||||||
var_dump(set_magic_quotes_runtime(true));
|
|
||||||
var_dump(get_magic_quotes_runtime());
|
|
||||||
var_dump(set_magic_quotes_runtime(-1));
|
|
||||||
var_dump(get_magic_quotes_runtime());
|
|
||||||
|
|
||||||
var_dump(file_get_contents($filename));
|
|
||||||
|
|
||||||
var_dump(set_magic_quotes_runtime(0));
|
|
||||||
var_dump(get_magic_quotes_runtime());
|
|
||||||
|
|
||||||
var_dump(file_get_contents($filename));
|
|
||||||
|
|
||||||
var_dump(set_magic_quotes_runtime(1));
|
|
||||||
var_dump(get_magic_quotes_runtime());
|
|
||||||
|
|
||||||
file_put_contents($filename, "some'content'here\"and}there");
|
|
||||||
|
|
||||||
var_dump(file_get_contents($filename));
|
|
||||||
|
|
||||||
var_dump(set_magic_quotes_runtime(0));
|
|
||||||
var_dump(set_magic_quotes_runtime());
|
|
||||||
var_dump(get_magic_quotes_runtime());
|
|
||||||
|
|
||||||
var_dump(file_get_contents($filename));
|
|
||||||
|
|
||||||
|
|
||||||
@unlink($filename);
|
|
||||||
|
|
||||||
echo "Done\n";
|
|
||||||
?>
|
|
||||||
--EXPECTF--
|
|
||||||
int(0)
|
|
||||||
int(0)
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
int(1)
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
int(1)
|
|
||||||
string(30) "some\'content\'here\"and}there"
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
int(0)
|
|
||||||
string(27) "some'content'here"and}there"
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
int(1)
|
|
||||||
string(30) "some\'content\'here\"and}there"
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
|
|
||||||
Warning: set_magic_quotes_runtime() expects exactly 1 parameter, 0 given in %s on line %d
|
|
||||||
NULL
|
|
||||||
int(0)
|
|
||||||
string(27) "some'content'here"and}there"
|
|
||||||
Done
|
|
@ -1,20 +1,17 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Test function get_cfg_var() by calling deprecated option
|
Test function get_cfg_var() by calling deprecated option
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Francesco Fullone ff@ideato.it
|
Francesco Fullone ff@ideato.it
|
||||||
#PHPTestFest Cesena Italia on 2009-06-20
|
#PHPTestFest Cesena Italia on 2009-06-20
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_gpc=1
|
magic_quotes_gpc=1
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
|
<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
echo "*** Test by calling method or function with deprecated option ***\n";
|
echo "*** Test by calling method or function with deprecated option ***\n";
|
||||||
var_dump(get_cfg_var( 'magic_quotes_gpc' ) );
|
var_dump(get_cfg_var( 'magic_quotes_gpc' ) );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in %s on line 0
|
Fatal error: Directive 'magic_quotes_gpc' is no longer available in PHP in Unknown on line 0
|
||||||
*** Test by calling method or function with deprecated option ***
|
|
||||||
string(1) "1"
|
|
||||||
|
|
||||||
|
@ -1,27 +1,13 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Test get_magic_quotes_gpc() function
|
Test get_magic_quotes_gpc() function
|
||||||
--INI--
|
|
||||||
magic_quotes_gpc = 0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
/* Prototype: int get_magic_quotes_gpc ( void )
|
/* Prototype: int get_magic_quotes_gpc ( void )
|
||||||
* Description: Gets the current configuration setting of magic quotes gpc
|
* This function is not supported anymore and will always return false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo "Simple testcase for get_magic_quotes_gpc() function\n";
|
echo "Simple testcase for get_magic_quotes_gpc() function\n";
|
||||||
|
var_dump(get_magic_quotes_gpc());
|
||||||
$g = get_magic_quotes_gpc();
|
|
||||||
echo "\n-- magic quotes gpc set in INI file: " . $g . " --\n";
|
|
||||||
|
|
||||||
echo "\n-- Set magic quotes gpc to 1 - not allowed so should fail! --\n";
|
|
||||||
var_dump(ini_set("magic_quotes_gpc", 1));
|
|
||||||
$g = get_magic_quotes_gpc();
|
|
||||||
echo "\n-- magic quotes gpc after set: " . $g . " --\n";
|
|
||||||
|
|
||||||
echo "\n-- Set magic quotes gpc to 0: --\n";
|
|
||||||
var_dump(ini_set("magic_quotes_gpc", 0));
|
|
||||||
$g = get_magic_quotes_gpc();
|
|
||||||
echo "\n-- magic quotes gpc after set: " . $g . " --\n";
|
|
||||||
|
|
||||||
echo "\n-- Error cases --\n";
|
echo "\n-- Error cases --\n";
|
||||||
// no checks on number of args
|
// no checks on number of args
|
||||||
@ -29,21 +15,16 @@ var_dump(get_magic_quotes_gpc(true));
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
Simple testcase for get_magic_quotes_gpc() function
|
Simple testcase for get_magic_quotes_gpc() function
|
||||||
|
|
||||||
-- magic quotes gpc set in INI file: 0 --
|
Deprecated: Function get_magic_quotes_gpc() is deprecated in %s on line %d
|
||||||
|
|
||||||
-- Set magic quotes gpc to 1 - not allowed so should fail! --
|
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
-- magic quotes gpc after set: 0 --
|
|
||||||
|
|
||||||
-- Set magic quotes gpc to 0: --
|
|
||||||
bool(false)
|
|
||||||
|
|
||||||
-- magic quotes gpc after set: 0 --
|
|
||||||
|
|
||||||
-- Error cases --
|
-- Error cases --
|
||||||
int(0)
|
|
||||||
===DONE===
|
Deprecated: Function get_magic_quotes_gpc() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Warning: get_magic_quotes_gpc() expects exactly 0 parameters, 1 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
===DONE===
|
||||||
|
@ -1,32 +1,14 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Test get_magic_quotes_runtime() function
|
Test get_magic_quotes_runtime() function
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime = 0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
/* Prototype: int get_magic_quotes_runtime ( void )
|
/* Prototype: int get_magic_quotes_runtime ( void )
|
||||||
* Description: Gets the current active configuration setting of magic_quotes_runtime
|
* This function is not supported anymore and will always return false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo "Simple testcase for get_magic_quotes_runtime() function\n";
|
echo "Simple testcase for get_magic_quotes_runtime() function\n";
|
||||||
|
|
||||||
$g = get_magic_quotes_runtime();
|
var_dump(get_magic_quotes_runtime());
|
||||||
echo "\n-- magic quotes runtime set in INI file: " . $g . " --\n";
|
|
||||||
|
|
||||||
echo "\n-- Set magic quotes runtime to 1: --\n";
|
|
||||||
var_dump(set_magic_quotes_runtime(1));
|
|
||||||
$g = get_magic_quotes_runtime();
|
|
||||||
echo "\n-- magic quotes runtime after set: " . $g . " --\n";
|
|
||||||
|
|
||||||
echo "\n-- Set magic quotes runtime to 0: --\n";
|
|
||||||
var_dump(set_magic_quotes_runtime(0));
|
|
||||||
$g = get_magic_quotes_runtime();
|
|
||||||
echo "\n-- magic quotes runtime after set: " . $g . " --\n";
|
|
||||||
|
|
||||||
echo "\n-- Set magic quotes runtime to 1: --\n";
|
|
||||||
var_dump(set_magic_quotes_runtime(1));
|
|
||||||
$g = get_magic_quotes_runtime();
|
|
||||||
echo "\n-- magic quotes runtime after set: " . $g . " --\n";
|
|
||||||
|
|
||||||
echo "\n-- Error cases --\n";
|
echo "\n-- Error cases --\n";
|
||||||
// no checks on number of args
|
// no checks on number of args
|
||||||
@ -37,29 +19,13 @@ var_dump(get_magic_quotes_runtime(true));
|
|||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Simple testcase for get_magic_quotes_runtime() function
|
Simple testcase for get_magic_quotes_runtime() function
|
||||||
|
|
||||||
-- magic quotes runtime set in INI file: 0 --
|
Deprecated: Function get_magic_quotes_runtime() is deprecated in %s on line %d
|
||||||
|
bool(false)
|
||||||
-- Set magic quotes runtime to 1: --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
|
|
||||||
-- magic quotes runtime after set: 1 --
|
|
||||||
|
|
||||||
-- Set magic quotes runtime to 0: --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
|
|
||||||
-- magic quotes runtime after set: 0 --
|
|
||||||
|
|
||||||
-- Set magic quotes runtime to 1: --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
|
|
||||||
-- magic quotes runtime after set: 1 --
|
|
||||||
|
|
||||||
-- Error cases --
|
-- Error cases --
|
||||||
int(1)
|
|
||||||
|
Deprecated: Function get_magic_quotes_runtime() is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Warning: get_magic_quotes_runtime() expects exactly 0 parameters, 1 given in %s on line %d
|
||||||
|
NULL
|
||||||
===DONE===
|
===DONE===
|
||||||
|
@ -1,204 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
Test set_magic_quotes_runtime() function - usage variation
|
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime = 0
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
/* Prototype: bool set_magic_quotes_runtime ( int $new_setting )
|
|
||||||
* Description: Sets the current active configuration setting of magic_quotes_runtime
|
|
||||||
*/
|
|
||||||
|
|
||||||
echo "Simple testcase for set_magic_quotes_runtime() function\n";
|
|
||||||
|
|
||||||
$g = get_magic_quotes_runtime();
|
|
||||||
echo "magic quotes runtime set in INI file: ".$g."\n";
|
|
||||||
|
|
||||||
// Prevent notices about undefines variables
|
|
||||||
error_reporting(E_ALL & ~E_NOTICE);
|
|
||||||
|
|
||||||
$unset_var = 10;
|
|
||||||
unset ($unset_var);
|
|
||||||
|
|
||||||
class fooClass {
|
|
||||||
function __toString() {
|
|
||||||
return "true";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$fp = fopen(__FILE__, "r");
|
|
||||||
|
|
||||||
$values = array(
|
|
||||||
|
|
||||||
// int data
|
|
||||||
/*1*/ 0,
|
|
||||||
1,
|
|
||||||
12345,
|
|
||||||
-2345,
|
|
||||||
|
|
||||||
// float data
|
|
||||||
/*5*/ 0.0,
|
|
||||||
10.5,
|
|
||||||
-10.5,
|
|
||||||
10.1234567e10,
|
|
||||||
10.7654321E-10,
|
|
||||||
.5,
|
|
||||||
|
|
||||||
// null data
|
|
||||||
/*11*/ NULL,
|
|
||||||
null,
|
|
||||||
|
|
||||||
// boolean data
|
|
||||||
/*13*/ true,
|
|
||||||
false,
|
|
||||||
TRUE,
|
|
||||||
FALSE,
|
|
||||||
|
|
||||||
// empty data
|
|
||||||
/*17*/ "",
|
|
||||||
'',
|
|
||||||
|
|
||||||
// object data
|
|
||||||
/*19*/ new fooClass(),
|
|
||||||
|
|
||||||
// resource
|
|
||||||
/*20*/ $fp,
|
|
||||||
|
|
||||||
// undefined data
|
|
||||||
/*21*/ $undefined_var,
|
|
||||||
|
|
||||||
// unset data
|
|
||||||
/*22*/ $unset_var
|
|
||||||
);
|
|
||||||
|
|
||||||
// loop through each element of the array for data
|
|
||||||
|
|
||||||
$iterator = 1;
|
|
||||||
foreach($values as $value) {
|
|
||||||
echo "-- Iterator $iterator --\n";
|
|
||||||
var_dump( set_magic_quotes_runtime($value) );
|
|
||||||
echo "New value of magic_quotes_runtime after last set is " . get_magic_quotes_runtime(). "\n";
|
|
||||||
$iterator++;
|
|
||||||
};
|
|
||||||
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
?>
|
|
||||||
===DONE===
|
|
||||||
--EXPECTF--
|
|
||||||
Simple testcase for set_magic_quotes_runtime() function
|
|
||||||
magic quotes runtime set in INI file: 0
|
|
||||||
-- Iterator 1 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 2 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 3 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 4 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 5 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 6 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 7 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 8 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 9 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 10 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 11 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 12 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 13 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 14 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 15 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 1
|
|
||||||
-- Iterator 16 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 17 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 18 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 19 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
|
|
||||||
Warning: set_magic_quotes_runtime() expects parameter 1 to be boolean, object given in %s on line %d
|
|
||||||
NULL
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 20 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
|
|
||||||
Warning: set_magic_quotes_runtime() expects parameter 1 to be boolean, resource given in %s on line %d
|
|
||||||
NULL
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 21 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
-- Iterator 22 --
|
|
||||||
|
|
||||||
Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
|
|
||||||
bool(true)
|
|
||||||
New value of magic_quotes_runtime after last set is 0
|
|
||||||
===DONE===
|
|
@ -1,5 +1,5 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
addslashes() and stripslashes() functions, normal and sybase-style
|
addslashes() and stripslashes() functions
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@ -9,15 +9,6 @@ for($i=0; $i<512; $i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "Normal: ";
|
echo "Normal: ";
|
||||||
ini_set('magic_quotes_sybase', 0);
|
|
||||||
if($input === stripslashes(addslashes($input))) {
|
|
||||||
echo "OK\n";
|
|
||||||
} else {
|
|
||||||
echo "FAILED\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Sybase: ";
|
|
||||||
ini_set('magic_quotes_sybase', 1);
|
|
||||||
if($input === stripslashes(addslashes($input))) {
|
if($input === stripslashes(addslashes($input))) {
|
||||||
echo "OK\n";
|
echo "OK\n";
|
||||||
} else {
|
} else {
|
||||||
@ -27,4 +18,3 @@ if($input === stripslashes(addslashes($input))) {
|
|||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Normal: OK
|
Normal: OK
|
||||||
Sybase: OK
|
|
||||||
|
@ -1,196 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
Test addslashes() function : usage variations - with magic_quotes_sybase directive ON
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
/* Prototype : string addslashes ( string $str )
|
|
||||||
* Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
|
|
||||||
* Source code: ext/standard/string.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test addslashes() with PHP directive magic_quotes_sybase set ON
|
|
||||||
*/
|
|
||||||
|
|
||||||
echo "*** Testing addslashes() : with php directive magic_quotes_sybase set ON ***\n";
|
|
||||||
|
|
||||||
// setting ON the php directive magic_quotes_sybase
|
|
||||||
ini_set("magic_quotes_sybase", "1");
|
|
||||||
|
|
||||||
// initialising a heredoc string
|
|
||||||
$heredoc_string = <<<EOT
|
|
||||||
This is line 1 of 'heredoc' string
|
|
||||||
This is line 2 of "heredoc" string
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
$heredoc_null_string =<<<EOT
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
// initialising the string array
|
|
||||||
$str_array = array(
|
|
||||||
// string without any characters that can be backslashed
|
|
||||||
'Hello world',
|
|
||||||
|
|
||||||
// string with single quotes
|
|
||||||
"how're you doing?",
|
|
||||||
"don't disturb u'r neighbours",
|
|
||||||
"don't disturb u'r neighbours''",
|
|
||||||
'',
|
|
||||||
'\'',
|
|
||||||
"'",
|
|
||||||
|
|
||||||
// string with double quotes
|
|
||||||
'he said, "he will be on leave"',
|
|
||||||
'he said, ""he will be on leave"',
|
|
||||||
'"""PHP"""',
|
|
||||||
"",
|
|
||||||
"\"",
|
|
||||||
'"',
|
|
||||||
"hello\"",
|
|
||||||
|
|
||||||
// string with backslash characters
|
|
||||||
'Is your name Ram\Krishna?',
|
|
||||||
'\\0.0.0.0',
|
|
||||||
'c:\php\testcase\addslashes',
|
|
||||||
'\\',
|
|
||||||
|
|
||||||
// string with nul characters
|
|
||||||
'hello'.chr(0).'world',
|
|
||||||
chr(0).'hello'.chr(0),
|
|
||||||
chr(0).chr(0).'hello',
|
|
||||||
chr(0),
|
|
||||||
|
|
||||||
// mixed strings
|
|
||||||
"'\\0.0.0.0'",
|
|
||||||
"'\\0.0.0.0'".chr(0),
|
|
||||||
chr(0)."'c:\php\'",
|
|
||||||
'"\\0.0.0.0"',
|
|
||||||
'"c:\php\"'.chr(0)."'",
|
|
||||||
'"hello"'."'world'".chr(0).'//',
|
|
||||||
|
|
||||||
// string with hexadecimal number
|
|
||||||
"0xABCDEF0123456789",
|
|
||||||
"\xabcdef0123456789",
|
|
||||||
'!@#$%&*@$%#&/;:,<>',
|
|
||||||
"hello\x00world",
|
|
||||||
|
|
||||||
// heredoc strings
|
|
||||||
$heredoc_string,
|
|
||||||
$heredoc_null_string
|
|
||||||
);
|
|
||||||
|
|
||||||
$count = 1;
|
|
||||||
// looping to test for all strings in $str_array
|
|
||||||
foreach( $str_array as $str ) {
|
|
||||||
echo "\n-- Iteration $count --\n";
|
|
||||||
var_dump( addslashes($str) );
|
|
||||||
$count ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Done\n";
|
|
||||||
?>
|
|
||||||
--EXPECTF--
|
|
||||||
*** Testing addslashes() : with php directive magic_quotes_sybase set ON ***
|
|
||||||
|
|
||||||
-- Iteration 1 --
|
|
||||||
string(11) "Hello world"
|
|
||||||
|
|
||||||
-- Iteration 2 --
|
|
||||||
string(18) "how''re you doing?"
|
|
||||||
|
|
||||||
-- Iteration 3 --
|
|
||||||
string(30) "don''t disturb u''r neighbours"
|
|
||||||
|
|
||||||
-- Iteration 4 --
|
|
||||||
string(34) "don''t disturb u''r neighbours''''"
|
|
||||||
|
|
||||||
-- Iteration 5 --
|
|
||||||
string(0) ""
|
|
||||||
|
|
||||||
-- Iteration 6 --
|
|
||||||
string(2) "''"
|
|
||||||
|
|
||||||
-- Iteration 7 --
|
|
||||||
string(2) "''"
|
|
||||||
|
|
||||||
-- Iteration 8 --
|
|
||||||
string(30) "he said, "he will be on leave""
|
|
||||||
|
|
||||||
-- Iteration 9 --
|
|
||||||
string(31) "he said, ""he will be on leave""
|
|
||||||
|
|
||||||
-- Iteration 10 --
|
|
||||||
string(9) """"PHP""""
|
|
||||||
|
|
||||||
-- Iteration 11 --
|
|
||||||
string(0) ""
|
|
||||||
|
|
||||||
-- Iteration 12 --
|
|
||||||
string(1) """
|
|
||||||
|
|
||||||
-- Iteration 13 --
|
|
||||||
string(1) """
|
|
||||||
|
|
||||||
-- Iteration 14 --
|
|
||||||
string(6) "hello""
|
|
||||||
|
|
||||||
-- Iteration 15 --
|
|
||||||
string(25) "Is your name Ram\Krishna?"
|
|
||||||
|
|
||||||
-- Iteration 16 --
|
|
||||||
string(8) "\0.0.0.0"
|
|
||||||
|
|
||||||
-- Iteration 17 --
|
|
||||||
string(26) "c:\php\testcase\addslashes"
|
|
||||||
|
|
||||||
-- Iteration 18 --
|
|
||||||
string(1) "\"
|
|
||||||
|
|
||||||
-- Iteration 19 --
|
|
||||||
string(12) "hello\0world"
|
|
||||||
|
|
||||||
-- Iteration 20 --
|
|
||||||
string(9) "\0hello\0"
|
|
||||||
|
|
||||||
-- Iteration 21 --
|
|
||||||
string(9) "\0\0hello"
|
|
||||||
|
|
||||||
-- Iteration 22 --
|
|
||||||
string(2) "\0"
|
|
||||||
|
|
||||||
-- Iteration 23 --
|
|
||||||
string(12) "''\0.0.0.0''"
|
|
||||||
|
|
||||||
-- Iteration 24 --
|
|
||||||
string(14) "''\0.0.0.0''\0"
|
|
||||||
|
|
||||||
-- Iteration 25 --
|
|
||||||
string(13) "\0''c:\php\''"
|
|
||||||
|
|
||||||
-- Iteration 26 --
|
|
||||||
string(10) ""\0.0.0.0""
|
|
||||||
|
|
||||||
-- Iteration 27 --
|
|
||||||
string(13) ""c:\php\"\0''"
|
|
||||||
|
|
||||||
-- Iteration 28 --
|
|
||||||
string(20) ""hello"''world''\0//"
|
|
||||||
|
|
||||||
-- Iteration 29 --
|
|
||||||
string(18) "0xABCDEF0123456789"
|
|
||||||
|
|
||||||
-- Iteration 30 --
|
|
||||||
string(15) "«cdef0123456789"
|
|
||||||
|
|
||||||
-- Iteration 31 --
|
|
||||||
string(18) "!@#$%&*@$%#&/;:,<>"
|
|
||||||
|
|
||||||
-- Iteration 32 --
|
|
||||||
string(12) "hello\0world"
|
|
||||||
|
|
||||||
-- Iteration 33 --
|
|
||||||
string(71) "This is line 1 of ''heredoc'' string
|
|
||||||
This is line 2 of "heredoc" string"
|
|
||||||
|
|
||||||
-- Iteration 34 --
|
|
||||||
string(0) ""
|
|
||||||
Done
|
|
@ -1,30 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
Bug #22904 (magic mode failed for cybase with '\0')
|
|
||||||
--FILE--
|
|
||||||
not active yet
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
ini_set("magic_quotes_sybase","on");
|
|
||||||
test();
|
|
||||||
ini_set("magic_quotes_sybase","off");
|
|
||||||
test();
|
|
||||||
*/
|
|
||||||
function test(){
|
|
||||||
$buf = 'g\g"\0g'."'";
|
|
||||||
$slashed = addslashes($buf);
|
|
||||||
echo "$buf\n";
|
|
||||||
echo "$slashed\n";
|
|
||||||
echo stripslashes($slashed."\n");
|
|
||||||
/*
|
|
||||||
g\g"\0g'
|
|
||||||
g\\g"\\0g''
|
|
||||||
g\g"\0g'
|
|
||||||
g\g"\0g'
|
|
||||||
g\\g\"\\0g\'
|
|
||||||
g\g"\0g'
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
--EXPECT--
|
|
||||||
not active yet
|
|
Binary file not shown.
Binary file not shown.
@ -1814,11 +1814,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int numerics)
|
|||||||
ALLOC_ZVAL(tmp);
|
ALLOC_ZVAL(tmp);
|
||||||
*tmp = result->data[result->store ? result->cur_row : 0][i];
|
*tmp = result->data[result->store ? result->cur_row : 0][i];
|
||||||
INIT_PZVAL(tmp);
|
INIT_PZVAL(tmp);
|
||||||
if (PG(magic_quotes_runtime) && Z_TYPE_P(tmp) == IS_STRING) {
|
zval_copy_ctor(tmp);
|
||||||
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);
|
|
||||||
}
|
|
||||||
if (numerics) {
|
if (numerics) {
|
||||||
zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &tmp, sizeof(zval *), NULL);
|
zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &tmp, sizeof(zval *), NULL);
|
||||||
Z_ADDREF_P(tmp);
|
Z_ADDREF_P(tmp);
|
||||||
|
@ -6,8 +6,6 @@ if(!extension_loaded('sysvsem') || !extension_loaded('sysvshm')) {
|
|||||||
die("skip Both sysvsem and sysvshm required");
|
die("skip Both sysvsem and sysvshm required");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$MEMSIZE = 512; // size of shared memory to allocate
|
$MEMSIZE = 512; // size of shared memory to allocate
|
||||||
|
@ -5,8 +5,6 @@ XML parser test, function callbacks
|
|||||||
require_once("skipif.inc");
|
require_once("skipif.inc");
|
||||||
XML_SAX_IMPL == 'libxml' && die('skip this test is not intended for libxml SAX parser');
|
XML_SAX_IMPL == 'libxml' && die('skip this test is not intended for libxml SAX parser');
|
||||||
?>
|
?>
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
chdir(dirname(__FILE__));
|
chdir(dirname(__FILE__));
|
||||||
|
@ -5,8 +5,6 @@ XML parser test, object tuple callbacks
|
|||||||
require_once("skipif.inc");
|
require_once("skipif.inc");
|
||||||
XML_SAX_IMPL == 'libxml' && die('skip this test is not intended for libxml SAX parser');
|
XML_SAX_IMPL == 'libxml' && die('skip this test is not intended for libxml SAX parser');
|
||||||
?>
|
?>
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
chdir(dirname(__FILE__));
|
chdir(dirname(__FILE__));
|
||||||
|
@ -5,8 +5,6 @@ XML parser test, xml_set_object callbacks
|
|||||||
require_once("skipif.inc");
|
require_once("skipif.inc");
|
||||||
XML_SAX_IMPL == 'libxml' && die('skip this test is not intended for libxml SAX parser');
|
XML_SAX_IMPL == 'libxml' && die('skip this test is not intended for libxml SAX parser');
|
||||||
?>
|
?>
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
chdir(dirname(__FILE__));
|
chdir(dirname(__FILE__));
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
XML parser case folding test
|
XML parser case folding test
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php include("skipif.inc"); ?>
|
<?php include("skipif.inc"); ?>
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
chdir(dirname(__FILE__));
|
chdir(dirname(__FILE__));
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
XML parser test using closures as callbacks
|
XML parser test using closures as callbacks
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php include("skipif.inc"); ?>
|
<?php include("skipif.inc"); ?>
|
||||||
--INI--
|
|
||||||
magic_quotes_runtime=0
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
chdir(dirname(__FILE__));
|
chdir(dirname(__FILE__));
|
||||||
|
@ -12,9 +12,6 @@ var_dump(gzfile(1,1,1));
|
|||||||
var_dump(gzfile(dirname(__FILE__)."/004.txt.gz"));
|
var_dump(gzfile(dirname(__FILE__)."/004.txt.gz"));
|
||||||
var_dump(gzfile(dirname(__FILE__)."/004.txt.gz", 1));
|
var_dump(gzfile(dirname(__FILE__)."/004.txt.gz", 1));
|
||||||
|
|
||||||
ini_set("magic_quotes_runtime", 1);
|
|
||||||
var_dump(gzfile(dirname(__FILE__)."/004.txt.gz", -1));
|
|
||||||
|
|
||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
@ -66,24 +63,4 @@ array(6) {
|
|||||||
string(39) "and I know that it descends down on me
|
string(39) "and I know that it descends down on me
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
array(6) {
|
|
||||||
[0]=>
|
|
||||||
string(37) "When you\'re taught through feelings
|
|
||||||
"
|
|
||||||
[1]=>
|
|
||||||
string(26) "Destiny flying high above
|
|
||||||
"
|
|
||||||
[2]=>
|
|
||||||
string(38) "all I know is that you can realize it
|
|
||||||
"
|
|
||||||
[3]=>
|
|
||||||
string(18) "Destiny who cares
|
|
||||||
"
|
|
||||||
[4]=>
|
|
||||||
string(19) "as it turns around
|
|
||||||
"
|
|
||||||
[5]=>
|
|
||||||
string(39) "and I know that it descends down on me
|
|
||||||
"
|
|
||||||
}
|
|
||||||
Done
|
Done
|
||||||
|
@ -426,7 +426,7 @@ static PHP_FUNCTION(gzfile)
|
|||||||
char *filename;
|
char *filename;
|
||||||
int filename_len;
|
int filename_len;
|
||||||
int flags = REPORT_ERRORS;
|
int flags = REPORT_ERRORS;
|
||||||
char *slashed, buf[8192] = {0};
|
char buf[8192] = {0};
|
||||||
register int i = 0;
|
register int i = 0;
|
||||||
long use_include_path = 0;
|
long use_include_path = 0;
|
||||||
php_stream *stream;
|
php_stream *stream;
|
||||||
@ -454,14 +454,7 @@ static PHP_FUNCTION(gzfile)
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
while (php_stream_gets(stream, buf, sizeof(buf) - 1) != NULL) {
|
while (php_stream_gets(stream, buf, sizeof(buf) - 1) != NULL) {
|
||||||
if (PG(magic_quotes_runtime)) {
|
add_index_string(return_value, i++, buf, 1);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
php_stream_close(stream);
|
php_stream_close(stream);
|
||||||
}
|
}
|
||||||
|
11
main/main.c
11
main/main.c
@ -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("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_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("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_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_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)
|
STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
|
||||||
@ -2153,15 +2150,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
|||||||
struct {
|
struct {
|
||||||
const long error_level;
|
const long error_level;
|
||||||
const char *phrase;
|
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] = {
|
} directives[2] = {
|
||||||
{
|
{
|
||||||
E_DEPRECATED,
|
E_DEPRECATED,
|
||||||
"Directive '%s' is deprecated in PHP 5.3 and greater",
|
"Directive '%s' is deprecated in PHP 5.3 and greater",
|
||||||
{
|
{
|
||||||
"magic_quotes_gpc",
|
|
||||||
"magic_quotes_runtime",
|
|
||||||
"magic_quotes_sybase",
|
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2172,6 +2166,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
|||||||
"allow_call_time_pass_reference",
|
"allow_call_time_pass_reference",
|
||||||
"define_syslog_variables",
|
"define_syslog_variables",
|
||||||
"highlight.bg",
|
"highlight.bg",
|
||||||
|
"magic_quotes_gpc",
|
||||||
|
"magic_quotes_runtime",
|
||||||
|
"magic_quotes_sybase",
|
||||||
"register_globals",
|
"register_globals",
|
||||||
"register_long_arrays",
|
"register_long_arrays",
|
||||||
"safe_mode",
|
"safe_mode",
|
||||||
|
@ -54,10 +54,6 @@ typedef struct _arg_separators {
|
|||||||
} arg_separators;
|
} arg_separators;
|
||||||
|
|
||||||
struct _php_core_globals {
|
struct _php_core_globals {
|
||||||
zend_bool magic_quotes_gpc;
|
|
||||||
zend_bool magic_quotes_runtime;
|
|
||||||
zend_bool magic_quotes_sybase;
|
|
||||||
|
|
||||||
zend_bool implicit_flush;
|
zend_bool implicit_flush;
|
||||||
|
|
||||||
long output_buffering;
|
long output_buffering;
|
||||||
|
@ -47,11 +47,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
|
|||||||
|
|
||||||
/* Prepare value */
|
/* Prepare value */
|
||||||
Z_STRLEN(new_entry) = str_len;
|
Z_STRLEN(new_entry) = str_len;
|
||||||
if (PG(magic_quotes_gpc)) {
|
Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
|
||||||
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_TYPE(new_entry) = IS_STRING;
|
Z_TYPE(new_entry) = IS_STRING;
|
||||||
|
|
||||||
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
|
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);
|
array_init(gpc_element);
|
||||||
zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
|
zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
|
||||||
} else {
|
} else {
|
||||||
if (PG(magic_quotes_gpc)) {
|
escaped_index = index;
|
||||||
escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
|
|
||||||
} else {
|
|
||||||
escaped_index = index;
|
|
||||||
}
|
|
||||||
if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE
|
if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE
|
||||||
|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
|
|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
|
||||||
MAKE_STD_ZVAL(gpc_element);
|
MAKE_STD_ZVAL(gpc_element);
|
||||||
@ -216,11 +208,7 @@ plain_var:
|
|||||||
if (!index) {
|
if (!index) {
|
||||||
zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
|
zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
|
||||||
} else {
|
} else {
|
||||||
if (PG(magic_quotes_gpc)) {
|
escaped_index = index;
|
||||||
escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
|
|
||||||
} else {
|
|
||||||
escaped_index = index;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* According to rfc2965, more specific paths are listed above the less specific ones.
|
* 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
|
* 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);
|
size_t alloc_size = sizeof(buf);
|
||||||
unsigned long nlen; /* ptrdiff_t is not portable */
|
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++) {
|
for (env = environ; env != NULL && *env != NULL; env++) {
|
||||||
p = strchr(*env, '=');
|
p = strchr(*env, '=');
|
||||||
if (!p) { /* malformed entry? */
|
if (!p) { /* malformed entry? */
|
||||||
@ -446,7 +430,6 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
|
|||||||
if (t != buf && t != NULL) {
|
if (t != buf && t != NULL) {
|
||||||
efree(t);
|
efree(t);
|
||||||
}
|
}
|
||||||
PG(magic_quotes_gpc) = magic_quotes_gpc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
|
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)
|
static inline void php_register_server_variables(TSRMLS_D)
|
||||||
{
|
{
|
||||||
zval *array_ptr = NULL;
|
zval *array_ptr = NULL;
|
||||||
/* turn off magic_quotes while importing server variables */
|
|
||||||
int magic_quotes_gpc = PG(magic_quotes_gpc);
|
|
||||||
|
|
||||||
ALLOC_ZVAL(array_ptr);
|
ALLOC_ZVAL(array_ptr);
|
||||||
array_init(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]);
|
zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
|
||||||
}
|
}
|
||||||
PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
|
PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
|
||||||
PG(magic_quotes_gpc) = 0;
|
|
||||||
|
|
||||||
/* Server variables */
|
/* Server variables */
|
||||||
if (sapi_module.register_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);
|
php_register_variable_ex("REQUEST_TIME", &new_entry, array_ptr TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
PG(magic_quotes_gpc) = magic_quotes_gpc;
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -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
|
* 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. */
|
* to nill or problem is fixed this code must remain enabled for all systems. */
|
||||||
s = _basename(internal_encoding, filename TSRMLS_CC);
|
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) {
|
if (!s) {
|
||||||
s = filename;
|
s = filename;
|
||||||
}
|
}
|
||||||
@ -1182,7 +1173,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
|
|||||||
s = "";
|
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.) */
|
* contains escapeable characters. escape only the variable name.) */
|
||||||
zval zfilename;
|
zval zfilename;
|
||||||
|
|
||||||
|
@ -116,11 +116,6 @@
|
|||||||
; Development Value: On
|
; Development Value: On
|
||||||
; Production Value: On
|
; Production Value: On
|
||||||
|
|
||||||
; magic_quotes_gpc
|
|
||||||
; Default Value: On
|
|
||||||
; Development Value: Off
|
|
||||||
; Production Value: Off
|
|
||||||
|
|
||||||
; max_input_time
|
; max_input_time
|
||||||
; Default Value: -1 (Unlimited)
|
; Default Value: -1 (Unlimited)
|
||||||
; Development Value: 60 (60 seconds)
|
; Development Value: 60 (60 seconds)
|
||||||
@ -663,30 +658,6 @@ auto_globals_jit = On
|
|||||||
; http://php.net/post-max-size
|
; http://php.net/post-max-size
|
||||||
post_max_size = 8M
|
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.
|
; Automatically add files before PHP document.
|
||||||
; http://php.net/auto-prepend-file
|
; http://php.net/auto-prepend-file
|
||||||
auto_prepend_file =
|
auto_prepend_file =
|
||||||
|
@ -116,11 +116,6 @@
|
|||||||
; Development Value: On
|
; Development Value: On
|
||||||
; Production Value: On
|
; Production Value: On
|
||||||
|
|
||||||
; magic_quotes_gpc
|
|
||||||
; Default Value: On
|
|
||||||
; Development Value: Off
|
|
||||||
; Production Value: Off
|
|
||||||
|
|
||||||
; max_input_time
|
; max_input_time
|
||||||
; Default Value: -1 (Unlimited)
|
; Default Value: -1 (Unlimited)
|
||||||
; Development Value: 60 (60 seconds)
|
; Development Value: 60 (60 seconds)
|
||||||
@ -663,30 +658,6 @@ auto_globals_jit = On
|
|||||||
; http://php.net/post-max-size
|
; http://php.net/post-max-size
|
||||||
post_max_size = 8M
|
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.
|
; Automatically add files before PHP document.
|
||||||
; http://php.net/auto-prepend-file
|
; http://php.net/auto-prepend-file
|
||||||
auto_prepend_file =
|
auto_prepend_file =
|
||||||
|
@ -648,12 +648,7 @@ static void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
|
|||||||
|
|
||||||
if (fcgi_is_fastcgi()) {
|
if (fcgi_is_fastcgi()) {
|
||||||
fcgi_request *request = (fcgi_request*) SG(server_context);
|
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);
|
fcgi_loadenv(request, cgi_php_load_env_var, array_ptr TSRMLS_CC);
|
||||||
PG(magic_quotes_gpc) = magic_quotes_gpc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +524,6 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
|
|||||||
{
|
{
|
||||||
fcgi_request *request;
|
fcgi_request *request;
|
||||||
HashPosition pos;
|
HashPosition pos;
|
||||||
int magic_quotes_gpc;;
|
|
||||||
char *var, **val;
|
char *var, **val;
|
||||||
uint var_len;
|
uint var_len;
|
||||||
ulong idx;
|
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);
|
php_php_import_environment_variables(array_ptr TSRMLS_CC);
|
||||||
|
|
||||||
request = (fcgi_request*) SG(server_context);
|
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;
|
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);
|
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_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;
|
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);
|
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)
|
static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Cookies test#2
|
Cookies test#2
|
||||||
--INI--
|
|
||||||
magic_quotes_gpc=0
|
|
||||||
--COOKIE--
|
--COOKIE--
|
||||||
c o o k i e=value; c o o k i e= v a l u e ;;c%20o+o k+i%20e=v;name="value","value",UEhQIQ==;UEhQIQ==foo
|
c o o k i e=value; c o o k i e= v a l u e ;;c%20o+o k+i%20e=v;name="value","value",UEhQIQ==;UEhQIQ==foo
|
||||||
--FILE--
|
--FILE--
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Test HTTP_RAW_POST_DATA creation
|
Test HTTP_RAW_POST_DATA creation
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_gpc=0
|
|
||||||
always_populate_raw_post_data=1
|
always_populate_raw_post_data=1
|
||||||
--POST--
|
--POST--
|
||||||
a=ABC&y=XYZ&c[]=1&c[]=2&c[a]=3
|
a=ABC&y=XYZ&c[]=1&c[]=2&c[a]=3
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Test HTTP_RAW_POST_DATA with excessive post length
|
Test HTTP_RAW_POST_DATA with excessive post length
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_gpc=0
|
|
||||||
always_populate_raw_post_data=1
|
always_populate_raw_post_data=1
|
||||||
post_max_size=1K
|
post_max_size=1K
|
||||||
--POST--
|
--POST--
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Registration of HTTP_RAW_POST_DATA due to unknown content-type
|
Registration of HTTP_RAW_POST_DATA due to unknown content-type
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_gpc=0
|
|
||||||
always_populate_raw_post_data=0
|
always_populate_raw_post_data=0
|
||||||
--POST_RAW--
|
--POST_RAW--
|
||||||
Content-Type: unknown/type
|
Content-Type: unknown/type
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
--TEST--
|
--TEST--
|
||||||
Handling of max_input_nesting_level being reached
|
Handling of max_input_nesting_level being reached
|
||||||
--INI--
|
--INI--
|
||||||
magic_quotes_gpc=0
|
|
||||||
always_populate_raw_post_data=0
|
always_populate_raw_post_data=0
|
||||||
display_errors=0
|
display_errors=0
|
||||||
max_input_nesting_level=10
|
max_input_nesting_level=10
|
||||||
|
@ -1,3 +1,68 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #46313 (Magic quotes broke $_FILES)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if(substr(PHP_OS, 0, 3) != "WIN") die("skip Windows-only test"); ?>
|
||||||
|
--INI--
|
||||||
|
magic_quotes_gpc=1
|
||||||
|
file_uploads=1
|
||||||
|
register_globals=1
|
||||||
|
--POST_RAW--
|
||||||
|
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||||
|
-----------------------------20896060251896012921717172737
|
||||||
|
Content-Disposition: form-data; name="o1'file"; filename="o1'file.png"
|
||||||
|
Content-Type: text/plain-file1
|
||||||
|
|
||||||
|
1
|
||||||
|
-----------------------------20896060251896012921717172737
|
||||||
|
Content-Disposition: form-data; name="o2'file"; filename="o2'file2.txt"
|
||||||
|
Content-Type: text/plain-file2
|
||||||
|
|
||||||
|
2
|
||||||
|
-----------------------------20896060251896012921717172737--
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
var_dump($_FILES);
|
||||||
|
var_dump($GLOBALS["o1\'file_name"]);
|
||||||
|
var_dump($GLOBALS["o1\'file_name"] === $_FILES["o1\'file"]["name"]);
|
||||||
|
var_dump($GLOBALS["o1\'file"]);
|
||||||
|
var_dump($GLOBALS["o1\'file"] === $_FILES["o1\'file"]["tmp_name"]);
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
array(2) {
|
||||||
|
["o1\'file"]=>
|
||||||
|
array(5) {
|
||||||
|
["name"]=>
|
||||||
|
string(12) "o1"
|
||||||
|
["type"]=>
|
||||||
|
string(16) "text/plain-file1"
|
||||||
|
["tmp_name"]=>
|
||||||
|
string(14) "%s"
|
||||||
|
["error"]=>
|
||||||
|
int(0)
|
||||||
|
["size"]=>
|
||||||
|
int(1)
|
||||||
|
}
|
||||||
|
["o2\'file"]=>
|
||||||
|
array(5) {
|
||||||
|
["name"]=>
|
||||||
|
string(13) "o2"
|
||||||
|
["type"]=>
|
||||||
|
string(16) "text/plain-file2"
|
||||||
|
["tmp_name"]=>
|
||||||
|
string(14) "%s"
|
||||||
|
["error"]=>
|
||||||
|
int(0)
|
||||||
|
["size"]=>
|
||||||
|
int(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string(12) "o1"
|
||||||
|
bool(true)
|
||||||
|
string(%d) "%s"
|
||||||
|
bool(true)
|
||||||
|
Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
|
||||||
|
Warning: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
|
||||||
|
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #46313 (Magic quotes broke $_FILES)
|
Bug #46313 (Magic quotes broke $_FILES)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
Bug #46313 (Magic quotes broke $_FILES)
|
|
||||||
--SKIPIF--
|
|
||||||
<?php if(substr(PHP_OS, 0, 3) == "WIN") die("skip non-Windows test"); ?>
|
|
||||||
--INI--
|
|
||||||
magic_quotes_gpc=1
|
|
||||||
file_uploads=1
|
|
||||||
display_errors=0
|
|
||||||
--POST_RAW--
|
|
||||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
|
||||||
-----------------------------20896060251896012921717172737
|
|
||||||
Content-Disposition: form-data; name="o1'file"; filename="o1'file.png"
|
|
||||||
Content-Type: text/plain-file1
|
|
||||||
|
|
||||||
1
|
|
||||||
-----------------------------20896060251896012921717172737
|
|
||||||
Content-Disposition: form-data; name="o2'file"; filename="o2'file2.txt"
|
|
||||||
Content-Type: text/plain-file2
|
|
||||||
|
|
||||||
2
|
|
||||||
-----------------------------20896060251896012921717172737--
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
var_dump($_FILES);
|
|
||||||
?>
|
|
||||||
--EXPECTF--
|
|
||||||
array(2) {
|
|
||||||
["o1\'file"]=>
|
|
||||||
array(5) {
|
|
||||||
["name"]=>
|
|
||||||
string(12) "o1\'file.png"
|
|
||||||
["type"]=>
|
|
||||||
string(16) "text/plain-file1"
|
|
||||||
["tmp_name"]=>
|
|
||||||
string(%d) "%s"
|
|
||||||
["error"]=>
|
|
||||||
int(0)
|
|
||||||
["size"]=>
|
|
||||||
int(1)
|
|
||||||
}
|
|
||||||
["o2\'file"]=>
|
|
||||||
array(5) {
|
|
||||||
["name"]=>
|
|
||||||
string(13) "o2\'file2.txt"
|
|
||||||
["type"]=>
|
|
||||||
string(16) "text/plain-file2"
|
|
||||||
["tmp_name"]=>
|
|
||||||
string(%d) "%s"
|
|
||||||
["error"]=>
|
|
||||||
int(0)
|
|
||||||
["size"]=>
|
|
||||||
int(1)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
Testing magic_quotes_gpc
|
|
||||||
--INI--
|
|
||||||
display_errors=0
|
|
||||||
magic_quotes_gpc=1
|
|
||||||
--GET--
|
|
||||||
a='&b="&c=\"
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
|
|
||||||
foreach ($_GET AS $key => $value)
|
|
||||||
{
|
|
||||||
echo $key . ": " . $value . "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
--EXPECT--
|
|
||||||
a: \'
|
|
||||||
b: \"
|
|
||||||
c: \\\"
|
|
@ -1,13 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
Test if magic_quotes_gpc works as expected
|
|
||||||
--INI--
|
|
||||||
display_errors=0
|
|
||||||
magic_quotes_gpc=1
|
|
||||||
--GET--
|
|
||||||
a=abc'"%00123
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
echo $_GET['a'],"\n";
|
|
||||||
?>
|
|
||||||
--EXPECT--
|
|
||||||
abc\'\"\0123
|
|
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
/* PHP Runtime Configuration */
|
/* PHP Runtime Configuration */
|
||||||
#define PHP_URL_FOPEN 1
|
#define PHP_URL_FOPEN 1
|
||||||
#define MAGIC_QUOTES 0
|
|
||||||
#define USE_CONFIG_FILE 1
|
#define USE_CONFIG_FILE 1
|
||||||
#define DEFAULT_SHORT_OPEN_TAG "1"
|
#define DEFAULT_SHORT_OPEN_TAG "1"
|
||||||
|
|
||||||
|
@ -2,4 +2,4 @@ REGEDIT4
|
|||||||
|
|
||||||
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.3.99-dev]
|
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.3.99-dev]
|
||||||
"TypesSupported"=dword:00000007
|
"TypesSupported"=dword:00000007
|
||||||
"EventMessageFile"="g:\\test\\srcinstall6\\php5ts_debug.dll"
|
"EventMessageFile"="g:\\test\\srctrunkinstall\\php5ts.dll"
|
||||||
|
Loading…
Reference in New Issue
Block a user