mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

Apparently under some targets the address can evaluate to an address with the most significant bit set. (displays as negative number)
54 lines
No EOL
805 B
PHP
54 lines
No EOL
805 B
PHP
--TEST--
|
|
Test internal weakmap API
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded('zend-test')) die('skip: zend-test extension required'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$id1 = new \stdClass;
|
|
$id2 = new \stdClass;
|
|
|
|
var_dump(zend_weakmap_attach($id1, 1));
|
|
var_dump(zend_weakmap_attach($id1, 3));
|
|
var_dump(zend_weakmap_attach($id2, 2));
|
|
|
|
var_dump(zend_weakmap_dump());
|
|
|
|
unset($id1);
|
|
|
|
var_dump(zend_weakmap_dump());
|
|
|
|
var_dump(zend_weakmap_remove($id2));
|
|
var_dump(zend_weakmap_remove($id2));
|
|
|
|
var_dump(zend_weakmap_dump());
|
|
|
|
var_dump(zend_weakmap_attach($id2, $id2));
|
|
|
|
var_dump(zend_weakmap_dump());
|
|
|
|
?>
|
|
--EXPECTF--
|
|
bool(true)
|
|
bool(false)
|
|
bool(true)
|
|
array(2) {
|
|
[%s]=>
|
|
int(1)
|
|
[%s]=>
|
|
int(2)
|
|
}
|
|
array(1) {
|
|
[%s]=>
|
|
int(2)
|
|
}
|
|
bool(true)
|
|
bool(false)
|
|
array(0) {
|
|
}
|
|
bool(true)
|
|
array(1) {
|
|
[%s]=>
|
|
object(stdClass)#2 (0) {
|
|
}
|
|
}
|