summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerenc Kovacs <tyrael@php.net>2014-06-11 14:59:39 +0200
committerFerenc Kovacs <tyrael@php.net>2014-06-11 14:59:39 +0200
commitec974c439724e8b4151412eaa0caba5aec5e1c49 (patch)
tree975b9f0da0864ece1d90a47478182cf4dd25224b
parent6953d33d309b2d390f829e2708339598fbc83415 (diff)
parentc38ab260fe3a40cce049c835fb7833de00ab977c (diff)
downloadphp-git-ec974c439724e8b4151412eaa0caba5aec5e1c49.tar.gz
Merge branch 'PHP-5.6'
* PHP-5.6: Revert "Add optional second arg to unserialize()"
-rw-r--r--ext/standard/basic_functions.c1
-rw-r--r--ext/standard/tests/serialize/serialization_error_001.phpt6
-rw-r--r--ext/standard/tests/serialize/unserialize_consumed.phpt27
-rw-r--r--ext/standard/var.c10
4 files changed, 5 insertions, 39 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 189281bac6..dd4e59ec7c 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -2636,7 +2636,6 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_unserialize, 0, 0, 1)
ZEND_ARG_INFO(0, variable_representation)
- ZEND_ARG_INFO(1, consumed)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_usage, 0, 0, 0)
diff --git a/ext/standard/tests/serialize/serialization_error_001.phpt b/ext/standard/tests/serialize/serialization_error_001.phpt
index c6c17512f3..da6f50cc02 100644
--- a/ext/standard/tests/serialize/serialization_error_001.phpt
+++ b/ext/standard/tests/serialize/serialization_error_001.phpt
@@ -21,7 +21,7 @@ var_dump( unserialize() );
//Test serialize with one more than the expected number of arguments
var_dump( serialize(1,2) );
-var_dump( unserialize(1,$x,2) );
+var_dump( unserialize(1,2) );
echo "Done";
?>
@@ -31,12 +31,12 @@ echo "Done";
Warning: serialize() expects exactly 1 parameter, 0 given in %s on line 16
NULL
-Warning: unserialize() expects at least 1 parameter, 0 given in %s on line 17
+Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17
bool(false)
Warning: serialize() expects exactly 1 parameter, 2 given in %s on line 20
NULL
-Warning: unserialize() expects at most 2 parameters, 3 given in %s on line 21
+Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21
bool(false)
Done
diff --git a/ext/standard/tests/serialize/unserialize_consumed.phpt b/ext/standard/tests/serialize/unserialize_consumed.phpt
deleted file mode 100644
index 6cc11e273f..0000000000
--- a/ext/standard/tests/serialize/unserialize_consumed.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Unserialization of partial strings
---FILE--
-<?php
-$data = [123,4.56,true];
-$ser = serialize($data);
-$serlen = strlen($ser);
-
-$unser = unserialize($ser, $consumed);
-echo "Consume full string: ";
-var_dump($serlen == $consumed);
-echo "Return original data: ";
-var_dump($unser === $data);
-
-$ser .= "junk\x01data";
-$unser = unserialize($ser, $consumed);
-echo "Consume full string(junk): ";
-var_dump($serlen == $consumed);
-echo "Return original data(junk): ";
-var_dump($unser === $data);
-
---EXPECT--
-Consume full string: bool(true)
-Return original data: bool(true)
-Consume full string(junk): bool(true)
-Return original data(junk): bool(true)
-
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 930edd6877..457f31db33 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -943,7 +943,7 @@ PHP_FUNCTION(serialize)
}
/* }}} */
-/* {{{ proto mixed unserialize(string variable_representation[, int &consumed])
+/* {{{ proto mixed unserialize(string variable_representation)
Takes a string representation of variable and recreates it */
PHP_FUNCTION(unserialize)
{
@@ -951,9 +951,8 @@ PHP_FUNCTION(unserialize)
int buf_len;
const unsigned char *p;
php_unserialize_data_t var_hash;
- zval *consumed = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &buf, &buf_len, &consumed) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
RETURN_FALSE;
}
@@ -972,11 +971,6 @@ PHP_FUNCTION(unserialize)
RETURN_FALSE;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- if (consumed) {
- zval_dtor(consumed);
- ZVAL_LONG(consumed, ((char*)p) - buf);
- }
}
/* }}} */