mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-03-25 17:32:28 +01:00
This removes a call to zend_hash_clean() on successive calls to a BSON object's get_properties handler, which can lead to an infinite loop when iterating the object's properties with foreach on PHP 7.x.
For historical reference, the original call to zend_hash_clean() was introduced in ad1f3f049f for #607 (PHPC-939).
34 lines
648 B
PHP
34 lines
648 B
PHP
--TEST--
|
|
MongoDB\BSON\Javascript get_properties handler (foreach)
|
|
--FILE--
|
|
<?php
|
|
|
|
$tests = [
|
|
new MongoDB\BSON\Javascript('function foo(bar) { return bar; }'),
|
|
new MongoDB\BSON\Javascript('function foo() { return bar; }', ['bar' => 42]),
|
|
];
|
|
|
|
foreach ($tests as $test) {
|
|
foreach ($test as $key => $value) {
|
|
var_dump($key);
|
|
var_dump($value);
|
|
}
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
string(4) "code"
|
|
string(33) "function foo(bar) { return bar; }"
|
|
string(5) "scope"
|
|
NULL
|
|
string(4) "code"
|
|
string(30) "function foo() { return bar; }"
|
|
string(5) "scope"
|
|
object(stdClass)#%d (%d) {
|
|
["bar"]=>
|
|
int(42)
|
|
}
|
|
===DONE===
|