mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-22 16:08:15 +02:00
b63c10f5f9
PHONGO_CE_INIT() is used to both make the classes final and disable serialization. Additionally, we provide __wakeUp() to ensure deserialization is also disabled (per PHPC-190). Eventually, BSON types will allow serialization (see PHPC-460) and the included error tests may be revised.
29 lines
679 B
PHP
29 lines
679 B
PHP
--TEST--
|
|
BSON BSON\Javascript cannot be serialized
|
|
--SKIPIF--
|
|
<?php require __DIR__ . "/../utils/basic-skipif.inc"?>
|
|
--FILE--
|
|
<?php
|
|
require_once __DIR__ . "/../utils/basic.inc";
|
|
|
|
use MongoDB\BSON as BSON;
|
|
|
|
echo throws(function() {
|
|
serialize(new BSON\Javascript('function() {}'));
|
|
}, 'Exception'), "\n";
|
|
|
|
echo throws(function() {
|
|
$classname = BSON_NAMESPACE . '\Javascript';
|
|
unserialize(sprintf('C:%d:"%s":0:{}', strlen($classname), $classname));
|
|
}, 'Exception'), "\n";
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
OK: Got Exception
|
|
Serialization of '%SBSON\Javascript' is not allowed
|
|
OK: Got Exception
|
|
Unserialization of '%SBSON\Javascript' is not allowed
|
|
===DONE===
|