summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c24
-rw-r--r--ext/standard/exec.c11
-rw-r--r--ext/standard/file.c76
-rw-r--r--ext/standard/php_string.h1
-rw-r--r--ext/standard/streamsfuncs.c15
-rw-r--r--ext/standard/string.c87
-rw-r--r--ext/standard/tests/file/magic_quotes.phpt77
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation8.phpt37
-rw-r--r--ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt39
-rw-r--r--ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt52
-rw-r--r--ext/standard/tests/general_functions/set_magic_quotes_runtime_variation1.phpt204
-rw-r--r--ext/standard/tests/strings/add-and-stripslashes.phpt12
-rw-r--r--ext/standard/tests/strings/addslashes_variation3.phpt196
-rw-r--r--ext/standard/tests/strings/bug22904.phpt30
-rw-r--r--ext/standard/tests/strings/parse_str_basic3.phptbin5223 -> 5087 bytes
-rw-r--r--ext/standard/tests/strings/stripslashes_variation5.phptbin8397 -> 0 bytes
16 files changed, 84 insertions, 777 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 0c7079286c..48c4fccdbf 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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_FE(set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime)
- PHP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc)
- PHP_FE(get_magic_quotes_runtime, arginfo_get_magic_quotes_runtime)
+ PHP_DEP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc)
+ PHP_DEP_FE(get_magic_quotes_runtime, arginfo_get_magic_quotes_runtime)
PHP_FE(error_log, arginfo_error_log)
PHP_FE(error_get_last, arginfo_error_get_last)
@@ -4586,7 +4586,7 @@ PHP_FUNCTION(get_cfg_var)
/* }}} */
/* {{{ proto bool set_magic_quotes_runtime(int new_setting)
- Set the current active configuration setting of magic_quotes_runtime and return previous */
+ magic_quotes_runtime is not supported anymore */
PHP_FUNCTION(set_magic_quotes_runtime)
{
zend_bool new_setting;
@@ -4594,11 +4594,11 @@ PHP_FUNCTION(set_magic_quotes_runtime)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) {
return;
}
-
- if (zend_alter_ini_entry_ex("magic_quotes_runtime", sizeof("magic_quotes_runtime"), new_setting ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
+
+ if (new_setting) {
+ php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore");
}
- RETURN_TRUE;
+ RETURN_FALSE;
}
/* }}} */
@@ -4606,7 +4606,10 @@ PHP_FUNCTION(set_magic_quotes_runtime)
Get the current active configuration setting of magic_quotes_runtime */
PHP_FUNCTION(get_magic_quotes_runtime)
{
- RETURN_LONG(PG(magic_quotes_runtime));
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+ RETURN_FALSE;
}
/* }}} */
@@ -4614,7 +4617,10 @@ PHP_FUNCTION(get_magic_quotes_runtime)
Get the current active configuration setting of magic_quotes_gpc */
PHP_FUNCTION(get_magic_quotes_gpc)
{
- RETURN_LONG(PG(magic_quotes_gpc));
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+ RETURN_FALSE;
}
/* }}} */
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 890f73726b..ac96fe6815 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -60,7 +60,7 @@
PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
{
FILE *fp;
- char *buf, *tmp=NULL;
+ char *buf;
int l = 0, pclose_return;
char *b, *d=NULL;
php_stream *stream;
@@ -139,14 +139,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
}
/* Return last line from the shell command */
- if (PG(magic_quotes_runtime)) {
- int len;
-
- tmp = php_addslashes(buf, bufl, &len, 0 TSRMLS_CC);
- RETVAL_STRINGL(tmp, len, 0);
- } else {
- RETVAL_STRINGL(buf, bufl, 1);
- }
+ RETVAL_STRINGL(buf, bufl, 1);
} else { /* should return NULL, but for BC we return "" */
RETVAL_EMPTY_STRING();
}
diff --git a/ext/standard/file.c b/ext/standard/file.c
index f9fba1bc9f..3ef8980f24 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -423,13 +423,7 @@ PHP_FUNCTION(get_meta_tags)
have_name = 1;
} else if (saw_content) {
STR_FREE(value);
- /* Get the CONTENT attr (Single word attr, non-quoted) */
- if (PG(magic_quotes_runtime)) {
- value = php_addslashes(md.token_data, 0, &md.token_len, 0 TSRMLS_CC);
- } else {
- value = estrndup(md.token_data, md.token_len);
- }
-
+ value = estrndup(md.token_data, md.token_len);
have_content = 1;
}
@@ -463,13 +457,7 @@ PHP_FUNCTION(get_meta_tags)
have_name = 1;
} else if (saw_content) {
STR_FREE(value);
- /* Get the CONTENT attr (Single word attr, non-quoted) */
- if (PG(magic_quotes_runtime)) {
- value = php_addslashes(md.token_data, 0, &md.token_len, 0 TSRMLS_CC);
- } else {
- value = estrndup(md.token_data, md.token_len);
- }
-
+ value = estrndup(md.token_data, md.token_len);
have_content = 1;
}
@@ -561,11 +549,6 @@ PHP_FUNCTION(file_get_contents)
}
if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) {
-
- if (PG(magic_quotes_runtime)) {
- contents = php_addslashes(contents, len, &len, 1 TSRMLS_CC); /* 1 = free source string */
- }
-
RETVAL_STRINGL(contents, len, 0);
} else if (len == 0) {
RETVAL_EMPTY_STRING();
@@ -724,9 +707,9 @@ PHP_FUNCTION(file)
{
char *filename;
int filename_len;
- char *slashed, *target_buf=NULL, *p, *s, *e;
+ char *target_buf=NULL, *p, *s, *e;
register int i = 0;
- int target_len, len;
+ int target_len;
char eol_marker = '\n';
long flags = 0;
zend_bool use_include_path;
@@ -778,13 +761,7 @@ PHP_FUNCTION(file)
do {
p++;
parse_eol:
- if (PG(magic_quotes_runtime)) {
- /* s is in target_buf which is freed at the end of the function */
- slashed = php_addslashes(s, (p-s), &len, 0 TSRMLS_CC);
- add_index_stringl(return_value, i++, slashed, len, 0);
- } else {
- add_index_stringl(return_value, i++, estrndup(s, p-s), p-s, 0);
- }
+ add_index_stringl(return_value, i++, estrndup(s, p-s), p-s, 0);
s = p;
} while ((p = memchr(p, eol_marker, (e-p))));
} else {
@@ -797,13 +774,7 @@ parse_eol:
s = ++p;
continue;
}
- if (PG(magic_quotes_runtime)) {
- /* s is in target_buf which is freed at the end of the function */
- slashed = php_addslashes(s, (p-s-windows_eol), &len, 0 TSRMLS_CC);
- add_index_stringl(return_value, i++, slashed, len, 0);
- } else {
- add_index_stringl(return_value, i++, estrndup(s, p-s-windows_eol), p-s-windows_eol, 0);
- }
+ add_index_stringl(return_value, i++, estrndup(s, p-s-windows_eol), p-s-windows_eol, 0);
s = ++p;
} while ((p = memchr(p, eol_marker, (e-p))));
}
@@ -1049,16 +1020,11 @@ PHPAPI PHP_FUNCTION(fgets)
}
}
- if (PG(magic_quotes_runtime)) {
- Z_STRVAL_P(return_value) = php_addslashes(buf, line_len, &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
- Z_TYPE_P(return_value) = IS_STRING;
- } else {
- ZVAL_STRINGL(return_value, buf, line_len, 0);
- /* resize buffer if it's much larger than the result.
- * Only needed if the user requested a buffer size. */
- if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) {
- Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1);
- }
+ ZVAL_STRINGL(return_value, buf, line_len, 0);
+ /* resize buffer if it's much larger than the result.
+ * Only needed if the user requested a buffer size. */
+ if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) {
+ Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1);
}
return;
@@ -1219,11 +1185,6 @@ PHPAPI PHP_FUNCTION(fwrite)
PHP_STREAM_TO_ZVAL(stream, &arg1);
- if (PG(magic_quotes_runtime)) {
- buffer = estrndup(arg2, num_bytes);
- php_stripslashes(buffer, &num_bytes TSRMLS_CC);
- }
-
ret = php_stream_write(stream, buffer ? buffer : arg2, num_bytes);
if (buffer) {
efree(buffer);
@@ -1790,11 +1751,6 @@ PHPAPI PHP_FUNCTION(fread)
/* needed because recv/read/gzread doesnt put a null at the end*/
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
-
- if (PG(magic_quotes_runtime)) {
- Z_STRVAL_P(return_value) = php_addslashes(Z_STRVAL_P(return_value),
- Z_STRLEN_P(return_value), &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
- }
Z_TYPE_P(return_value) = IS_STRING;
}
/* }}} */
@@ -1950,15 +1906,7 @@ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char en
smart_str_appendc(&csvline, '\n');
smart_str_0(&csvline);
- if (!PG(magic_quotes_runtime)) {
- ret = php_stream_write(stream, csvline.c, csvline.len);
- } else {
- char *buffer = estrndup(csvline.c, csvline.len);
- int len = csvline.len;
- php_stripslashes(buffer, &len TSRMLS_CC);
- ret = php_stream_write(stream, buffer, len);
- efree(buffer);
- }
+ ret = php_stream_write(stream, csvline.c, csvline.len);
smart_str_free(&csvline);
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index 23c703336a..c6d916dbcc 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -122,7 +122,6 @@ PHPAPI char *php_strtoupper(char *s, size_t len);
PHPAPI char *php_strtolower(char *s, size_t len);
PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC);
-PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int freeit, int ignore_sybase TSRMLS_DC);
PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC);
PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC);
PHPAPI void php_stripcslashes(char *str, int *len);
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index befb13fd7a..54aef6afa0 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -395,13 +395,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
}
read_buf[recvd] = '\0';
- if (PG(magic_quotes_runtime)) {
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRVAL_P(return_value) = php_addslashes(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), &Z_STRLEN_P(return_value), 1 TSRMLS_CC);
- return;
- } else {
- RETURN_STRINGL(read_buf, recvd, 0);
- }
+ RETURN_STRINGL(read_buf, recvd, 0);
}
efree(read_buf);
@@ -417,8 +411,7 @@ PHP_FUNCTION(stream_get_contents)
zval *zsrc;
long maxlen = PHP_STREAM_COPY_ALL,
desiredpos = -1L;
- int len,
- newlen;
+ int len;
char *contents = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) {
@@ -450,10 +443,6 @@ PHP_FUNCTION(stream_get_contents)
len = php_stream_copy_to_mem(stream, &contents, maxlen, 0);
if (contents) {
- if (len && PG(magic_quotes_runtime)) {
- contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
- len = newlen;
- }
RETVAL_STRINGL(contents, len, 0);
} else {
RETVAL_EMPTY_STRING();
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 44c5cd3b00..1717b3b711 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3015,34 +3015,6 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC)
s = str;
t = str;
- if (PG(magic_quotes_sybase)) {
- while (l > 0) {
- if (*t == '\'') {
- if ((l > 0) && (t[1] == '\'')) {
- t++;
- if (len != NULL) {
- (*len)--;
- }
- l--;
- }
- *s++ = *t++;
- } else if (*t == '\\' && t[1] == '0' && l > 0) {
- *s++='\0';
- t+=2;
- if (len != NULL) {
- (*len)--;
- }
- l--;
- } else {
- *s++ = *t++;
- }
- l--;
- }
- *s = '\0';
-
- return;
- }
-
while (l > 0) {
if (*t == '\\') {
t++; /* skip the slash */
@@ -3287,14 +3259,6 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_
*/
PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC)
{
- return php_addslashes_ex(str, length, new_length, should_free, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ php_addslashes_ex
- */
-PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int should_free, int ignore_sybase TSRMLS_DC)
-{
/* maximum string length, worst case situation */
char *new_str;
char *source, *target;
@@ -3313,42 +3277,23 @@ PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int shoul
end = source + length;
target = new_str;
- if (!ignore_sybase && PG(magic_quotes_sybase)) {
- while (source < end) {
- switch (*source) {
- case '\0':
- *target++ = '\\';
- *target++ = '0';
- break;
- case '\'':
- *target++ = '\'';
- *target++ = '\'';
- break;
- default:
- *target++ = *source;
- break;
- }
- source++;
- }
- } else {
- while (source < end) {
- switch (*source) {
- case '\0':
- *target++ = '\\';
- *target++ = '0';
- break;
- case '\'':
- case '\"':
- case '\\':
- *target++ = '\\';
- /* break is missing *intentionally* */
- default:
- *target++ = *source;
- break;
- }
-
- source++;
+ while (source < end) {
+ switch (*source) {
+ case '\0':
+ *target++ = '\\';
+ *target++ = '0';
+ break;
+ case '\'':
+ case '\"':
+ case '\\':
+ *target++ = '\\';
+ /* break is missing *intentionally* */
+ default:
+ *target++ = *source;
+ break;
}
+
+ source++;
}
*target = 0;
diff --git a/ext/standard/tests/file/magic_quotes.phpt b/ext/standard/tests/file/magic_quotes.phpt
index 0f42cd7c87..e69de29bb2 100644
--- a/ext/standard/tests/file/magic_quotes.phpt
+++ b/ext/standard/tests/file/magic_quotes.phpt
@@ -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
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
index 7db0d1cc78..c7a72de944 100644
--- a/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
@@ -1,20 +1,17 @@
---TEST--
-Test function get_cfg_var() by calling deprecated option
---CREDITS--
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---INI--
-magic_quotes_gpc=1
---SKIPIF--
-<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
---FILE--
-<?php
-echo "*** Test by calling method or function with deprecated option ***\n";
-var_dump(get_cfg_var( 'magic_quotes_gpc' ) );
-
-?>
---EXPECTF--
-Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in %s on line 0
-*** Test by calling method or function with deprecated option ***
-string(1) "1"
-
+--TEST--
+Test function get_cfg_var() by calling deprecated option
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+magic_quotes_gpc=1
+--SKIPIF--
+<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with deprecated option ***\n";
+var_dump(get_cfg_var( 'magic_quotes_gpc' ) );
+
+?>
+--EXPECTF--
+Fatal error: Directive 'magic_quotes_gpc' is no longer available in PHP in Unknown on line 0
diff --git a/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt b/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
index cfa4dcc681..b1c694a720 100644
--- a/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
+++ b/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
@@ -1,27 +1,13 @@
--TEST--
Test get_magic_quotes_gpc() function
---INI--
-magic_quotes_gpc = 0
--FILE--
<?php
/* 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";
-
-$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";
+var_dump(get_magic_quotes_gpc());
echo "\n-- Error cases --\n";
// no checks on number of args
@@ -29,21 +15,16 @@ var_dump(get_magic_quotes_gpc(true));
?>
===DONE===
---EXPECT--
+--EXPECTF--
Simple testcase for get_magic_quotes_gpc() function
--- magic quotes gpc set in INI file: 0 --
-
--- Set magic quotes gpc to 1 - not allowed so should fail! --
+Deprecated: Function get_magic_quotes_gpc() is deprecated in %s on line %d
bool(false)
--- magic quotes gpc after set: 0 --
-
--- Set magic quotes gpc to 0: --
-bool(false)
+-- Error cases --
--- magic quotes gpc after set: 0 --
+Deprecated: Function get_magic_quotes_gpc() is deprecated in %s on line %d
--- Error cases --
-int(0)
-===DONE=== \ No newline at end of file
+Warning: get_magic_quotes_gpc() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt b/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
index fca064d840..abcef3577c 100644
--- a/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
+++ b/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
@@ -1,32 +1,14 @@
--TEST--
Test get_magic_quotes_runtime() function
---INI--
-magic_quotes_runtime = 0
--FILE--
<?php
/* 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";
-$g = 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";
+var_dump(get_magic_quotes_runtime());
echo "\n-- Error cases --\n";
// no checks on number of args
@@ -37,29 +19,13 @@ var_dump(get_magic_quotes_runtime(true));
--EXPECTF--
Simple testcase for get_magic_quotes_runtime() function
--- magic quotes runtime set in INI file: 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 --
+Deprecated: Function get_magic_quotes_runtime() is deprecated in %s on line %d
+bool(false)
--- 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)
+-- Error cases --
--- magic quotes runtime after set: 1 --
+Deprecated: Function get_magic_quotes_runtime() is deprecated in %s on line %d
--- Error cases --
-int(1)
+Warning: get_magic_quotes_runtime() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
===DONE===
diff --git a/ext/standard/tests/general_functions/set_magic_quotes_runtime_variation1.phpt b/ext/standard/tests/general_functions/set_magic_quotes_runtime_variation1.phpt
index 843dbe22f3..e69de29bb2 100644
--- a/ext/standard/tests/general_functions/set_magic_quotes_runtime_variation1.phpt
+++ b/ext/standard/tests/general_functions/set_magic_quotes_runtime_variation1.phpt
@@ -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===
diff --git a/ext/standard/tests/strings/add-and-stripslashes.phpt b/ext/standard/tests/strings/add-and-stripslashes.phpt
index a5eab410b9..6f01176d4e 100644
--- a/ext/standard/tests/strings/add-and-stripslashes.phpt
+++ b/ext/standard/tests/strings/add-and-stripslashes.phpt
@@ -1,5 +1,5 @@
--TEST--
-addslashes() and stripslashes() functions, normal and sybase-style
+addslashes() and stripslashes() functions
--FILE--
<?php
@@ -9,15 +9,6 @@ for($i=0; $i<512; $i++) {
}
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))) {
echo "OK\n";
} else {
@@ -27,4 +18,3 @@ if($input === stripslashes(addslashes($input))) {
?>
--EXPECT--
Normal: OK
-Sybase: OK
diff --git a/ext/standard/tests/strings/addslashes_variation3.phpt b/ext/standard/tests/strings/addslashes_variation3.phpt
index 8f46ebe9a4..e69de29bb2 100644
--- a/ext/standard/tests/strings/addslashes_variation3.phpt
+++ b/ext/standard/tests/strings/addslashes_variation3.phpt
@@ -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
diff --git a/ext/standard/tests/strings/bug22904.phpt b/ext/standard/tests/strings/bug22904.phpt
index 3c56e1a414..e69de29bb2 100644
--- a/ext/standard/tests/strings/bug22904.phpt
+++ b/ext/standard/tests/strings/bug22904.phpt
@@ -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
diff --git a/ext/standard/tests/strings/parse_str_basic3.phpt b/ext/standard/tests/strings/parse_str_basic3.phpt
index 06e614374e..f0f5981e8f 100644
--- a/ext/standard/tests/strings/parse_str_basic3.phpt
+++ b/ext/standard/tests/strings/parse_str_basic3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/stripslashes_variation5.phpt b/ext/standard/tests/strings/stripslashes_variation5.phpt
index 0507e04960..e69de29bb2 100644
--- a/ext/standard/tests/strings/stripslashes_variation5.phpt
+++ b/ext/standard/tests/strings/stripslashes_variation5.phpt
Binary files differ