1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 13:12:16 +02:00

Merge branch 'PHP-5.6' of https://git.php.net/repository/php-src into PHP-5.6

This commit is contained in:
krakjoe
2013-11-20 16:26:21 +00:00
6 changed files with 59 additions and 2 deletions

View File

@@ -789,6 +789,7 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o
static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
#if 0
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
@@ -843,6 +844,7 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
return SUCCESS;
}
}
#endif
return div_function(result, op1, op2 TSRMLS_CC);
}

View File

@@ -1,7 +1,7 @@
--TEST--
Test var_export() function with locale
--INI--
precision=14
serialize_precision=17
--SKIPIF--
<?php
if (!setlocale(LC_ALL, "german", "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8")) {

View File

@@ -1,7 +1,7 @@
--TEST--
Test var_export() function with valid float values
--INI--
precision=14
serialize_precision=17
--FILE--
<?php
/* Prototype : mixed var_export(mixed var [, bool return])

View File

@@ -1,5 +1,7 @@
--TEST--
Test var_export() function with valid arrays
--INI--
serialize_precision=17
--FILE--
<?php
/* Prototype : mixed var_export(mixed var [, bool return])

View File

@@ -0,0 +1,52 @@
--TEST--
Test unserialize(): error is indistinguishable from deserialized boolean
--FILE--
<?php
/* Prototype : proto string serialize(mixed variable)
* Description: Returns a string representation of variable (which can later be unserialized)
* Source code: ext/standard/var.c
* Alias to functions:
*/
/* Prototype : proto mixed unserialize(string variable_representation)
* Description: Takes a string representation of variable and recreates it
* Source code: ext/standard/var.c
* Alias to functions:
*/
echo "*** Testing unserialize() error/boolean distinction ***\n";
$garbage = "obvious non-serialized data";
$serialized_false = serialize(false);
var_dump($serialized_false);
$deserialized_garbage = unserialize($garbage);
var_dump($deserialized_garbage);
$deserialized_false = unserialize($serialized_false);
var_dump($deserialized_false);
echo "unserialize error and deserialized false are identical? " . (bool) ($deserialized_false == $deserialized_garbage) . "\n";
// candidate safe idiom for determining whether data is serialized
function isSerialized($str) {
return ($str == serialize(false) || @unserialize($str) !== false);
}
// Test unserialize error idiom
var_dump(isSerialized($garbage));
var_dump(isSerialized($serialized_false));
echo "Done";
?>
--EXPECTF--
*** Testing unserialize() error/boolean distinction ***
string(4) "b:0;"
Notice: unserialize(): Error at offset 0 of 27 bytes in %s/serialization_error_002.php on line 20
bool(false)
bool(false)
unserialize error and deserialized false are identical? 1
bool(false)
bool(true)
Done

View File

@@ -2,6 +2,7 @@
Bug #24640 (var_export and var_dump can't output large float)
--INI--
precision=12
serialize_precision=17
--FILE--
<?php
function test($v)