Skip to content

Commit b3b3322

Browse files
committed
In PHP5.3 we hit the __wakeUp() which has slightly different exception
1 parent 32ca098 commit b3b3322

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tests/standalone/bug0166.phpt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,24 @@ Disable serialization of objects
77
require_once __DIR__ . "/../utils/basic.inc";
88

99
$str = 'O:22:"MongoDB\Driver\Manager":0:{}';
10-
$v = @unserialize($str);
11-
var_dump($v);
10+
try {
11+
/* We throw exception in 5.3 - 5.6 triggers warning and returns false
12+
* This is inconsistency is only with manipulated serialization strings, or using them across versions
13+
* which isn't support by PHP in the getgo anyway */
14+
$v = @unserialize($str);
15+
var_dump($v);
16+
} catch(Exception $e) {
17+
var_dump(false);
18+
}
1219

13-
throws(function() {
14-
$manager = new MongoDB\Driver\Manager("mongodb://localhost");
20+
$manager = new MongoDB\Driver\Manager("mongodb://localhost");
21+
throws(function() use ($manager) {
1522
serialize($manager);
16-
}, "Exception", "serialize");
23+
}, "Exception");
1724
?>
1825
===DONE===
1926
<?php exit(0); ?>
2027
--EXPECT--
2128
bool(false)
22-
OK: Got Exception thrown from serialize
29+
OK: Got Exception
2330
===DONE===

0 commit comments

Comments
 (0)