Skip to content

Commit

Permalink
Merge branch 'PHP-5.6'
Browse files Browse the repository at this point in the history
* PHP-5.6:
  Revert "Add optional second arg to unserialize()"
  • Loading branch information
Tyrael committed Jun 11, 2014
2 parents 6953d33 + c38ab26 commit ec974c4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 39 deletions.
1 change: 0 additions & 1 deletion ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions ext/standard/tests/serialize/serialization_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";
?>
Expand All @@ -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
27 changes: 0 additions & 27 deletions ext/standard/tests/serialize/unserialize_consumed.phpt

This file was deleted.

10 changes: 2 additions & 8 deletions ext/standard/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,17 +943,16 @@ 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)
{
char *buf = NULL;
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;
}

Expand All @@ -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);
}
}
/* }}} */

Expand Down

0 comments on commit ec974c4

Please sign in to comment.