mirror of
https://github.com/php/php-src.git
synced 2026-03-26 09:12:14 +01:00
* Make handling of SplFixedArray properties more consistent Create a brand new reference counted array every time in SplFixedArray to be freed by the callers (or return null). Switch from overriding `get_properties` to overriding `get_properties_for` handler * Print objects with null hash table like others in print_r Noticed when working on subsequent commits for SplFixedArray. Make whether zend_get_properties_for returns null or an empty array invisible to the end user - it would be always be a non-null array for user-defined classes. Always print newlines with `\n\s*(\n\s*)` after objects Noticed when working on SplFixedArray changes, e.g. in ext/spl/tests/SplFixedArray__construct_param_null.phpt
57 lines
892 B
PHP
57 lines
892 B
PHP
--TEST--
|
|
SplFixedArray::setSize in offsetSet destructor (#81429)
|
|
--FILE--
|
|
<?php
|
|
$values = new SplFixedArray(1);
|
|
$values->offsetSet(0, new HasDestructor());
|
|
$values->offsetSet(0, false);
|
|
echo "Done\n";
|
|
|
|
class HasDestructor {
|
|
public function __destruct() {
|
|
global $values;
|
|
var_dump($values);
|
|
$values->setSize($values->getSize() - 1);
|
|
echo "After reducing size:\n";
|
|
var_dump($values);
|
|
}
|
|
}
|
|
|
|
$values->setSize(5);
|
|
$values->offsetSet(4, new HasDestructor());
|
|
echo "Done\n";
|
|
--EXPECT--
|
|
object(SplFixedArray)#1 (1) {
|
|
[0]=>
|
|
bool(false)
|
|
}
|
|
After reducing size:
|
|
object(SplFixedArray)#1 (0) {
|
|
}
|
|
Done
|
|
Done
|
|
object(SplFixedArray)#1 (5) {
|
|
[0]=>
|
|
NULL
|
|
[1]=>
|
|
NULL
|
|
[2]=>
|
|
NULL
|
|
[3]=>
|
|
NULL
|
|
[4]=>
|
|
object(HasDestructor)#2 (0) {
|
|
}
|
|
}
|
|
After reducing size:
|
|
object(SplFixedArray)#1 (4) {
|
|
[0]=>
|
|
NULL
|
|
[1]=>
|
|
NULL
|
|
[2]=>
|
|
NULL
|
|
[3]=>
|
|
NULL
|
|
}
|