summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2013-12-12 20:43:34 +0100
committerOndřej Surý <ondrej@sury.org>2013-12-12 20:43:34 +0100
commit5a58c4dae727fbc8bd92770c2708baf9e7688857 (patch)
tree90fbbe41815b12676f14d692bfcf00e03cfad008 /ext/standard
parent0d7d3241164b4769b93867da2e8adb724ae17950 (diff)
downloadphp-5a58c4dae727fbc8bd92770c2708baf9e7688857.tar.gz
New upstream version 5.5.7+dfsgupstream/5.5.7+dfsg
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/tests/general_functions/bug66094.phpt12
-rw-r--r--ext/standard/tests/general_functions/var_export-locale.phpt2
-rw-r--r--ext/standard/tests/general_functions/var_export_basic3.phpt2
-rw-r--r--ext/standard/tests/general_functions/var_export_basic5.phpt2
-rw-r--r--ext/standard/tests/serialize/serialization_error_002.phpt52
-rw-r--r--ext/standard/tests/time/strptime_basic.phpt4
7 files changed, 71 insertions, 5 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index b4128e066..96b3c30bb 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -5776,7 +5776,7 @@ PHP_FUNCTION(unregister_tick_function)
return;
}
- if (Z_TYPE_P(function) != IS_ARRAY) {
+ if (Z_TYPE_P(function) != IS_ARRAY && Z_TYPE_P(function) != IS_OBJECT) {
convert_to_string(function);
}
diff --git a/ext/standard/tests/general_functions/bug66094.phpt b/ext/standard/tests/general_functions/bug66094.phpt
new file mode 100644
index 000000000..8b33a4f4c
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug66094.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #66094 (unregister_tick_function tries to cast a Closure to a string)
+--FILE--
+<?php
+declare(ticks=1);
+register_tick_function($closure = function () { echo "Tick!\n"; });
+unregister_tick_function($closure);
+echo "done";
+?>
+--EXPECTF--
+Tick!
+done
diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt
index 3cbebe9c7..b6f87c431 100644
--- a/ext/standard/tests/general_functions/var_export-locale.phpt
+++ b/ext/standard/tests/general_functions/var_export-locale.phpt
@@ -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")) {
diff --git a/ext/standard/tests/general_functions/var_export_basic3.phpt b/ext/standard/tests/general_functions/var_export_basic3.phpt
index 9e27d9042..58c044816 100644
--- a/ext/standard/tests/general_functions/var_export_basic3.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic3.phpt
@@ -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])
diff --git a/ext/standard/tests/general_functions/var_export_basic5.phpt b/ext/standard/tests/general_functions/var_export_basic5.phpt
index 1512fa837..dacb35532 100644
--- a/ext/standard/tests/general_functions/var_export_basic5.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic5.phpt
@@ -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])
diff --git a/ext/standard/tests/serialize/serialization_error_002.phpt b/ext/standard/tests/serialize/serialization_error_002.phpt
new file mode 100644
index 000000000..70f35e4f3
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_error_002.phpt
@@ -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%eserialization_error_002.php on line 20
+bool(false)
+bool(false)
+unserialize error and deserialized false are identical? 1
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/time/strptime_basic.phpt b/ext/standard/tests/time/strptime_basic.phpt
index 194a78f82..30e3e82cc 100644
--- a/ext/standard/tests/time/strptime_basic.phpt
+++ b/ext/standard/tests/time/strptime_basic.phpt
@@ -24,7 +24,7 @@ $input = "10:00:00 AM July 2 1963";
$tstamp = strtotime($input);
$str = strftime("%r %B%e %Y %Z", $tstamp);
-var_dump(strptime($str, '%H:%M:%S %p %B %d %Y %Z'));
+var_dump(strptime($str, '%H:%M:%S %p %B %d %Y'));
$str = strftime("%T %D", $tstamp);
var_dump(strptime($str, '%H:%M:%S %m/%d/%y'));
@@ -55,7 +55,7 @@ array(9) {
["tm_yday"]=>
int(182)
["unparsed"]=>
- string(3) "GMT"
+ string(4) " GMT"
}
array(9) {
["tm_sec"]=>