com php-src: Add test for previous commit: ext/standard/tests/s erialize/invalid_signs_in_lengths.phpt

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    81d8c37b0349eabc483b2e28771b7a03243b262e
Author:    Nikita Popov <[email protected]>         Thu, 23 Mar 2017 22:36:55 +0100
Parents:   8522e2894edd52322148945261433e79a3ec3f88
Branches:  master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=81d8c37b0349eabc483b2e28771b7a03243b262e

Log:
Add test for previous commit

Changed paths:
  A  ext/standard/tests/serialize/invalid_signs_in_lengths.phpt


Diff:
diff --git a/ext/standard/tests/serialize/invalid_signs_in_lengths.phpt b/ext/standard/tests/serialize/invalid_signs_in_lengths.phpt
new file mode 100644
index 0000000..6288cfc
--- /dev/null
+++ b/ext/standard/tests/serialize/invalid_signs_in_lengths.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Lengths and references are not signed
+--FILE--
+<?php
+
+var_dump(unserialize('s:+1:"x";'));
+var_dump(unserialize('s:-1:"x";'));
+var_dump(unserialize('a:+0:{}'));
+var_dump(unserialize('a:-0:{}'));
+var_dump(unserialize('O:+8:"stdClass":0:{}'));
+var_dump(unserialize('O:-8:"stdClass":0:{}'));
+var_dump(unserialize('C:+11:"ArrayObject":0:{}'));
+var_dump(unserialize('C:-11:"ArrayObject":0:{}'));
+var_dump(unserialize('a:1:{i:0;r:+1;}'));
+var_dump(unserialize('a:1:{i:0;r:-1;}'));
+var_dump(unserialize('a:1:{i:0;R:+1;}'));
+var_dump(unserialize('a:1:{i:0;R:-1;}'));
+
+?>
+--EXPECTF--
+Notice: unserialize(): Error at offset 0 of 9 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 9 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 7 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 7 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 20 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 20 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 24 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 24 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 9 of 15 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 9 of 15 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 9 of 15 bytes in %s on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 9 of 15 bytes in %s on line %d
+bool(false)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.