php-src/ext/spl/spl_fixedarray.stub.php
Máté Kocsis adb45a63c0
Fix GH-9186 @strict-properties can be bypassed using unserialization (#9354)
* Emit deprecation warnings when adding dynamic properties to classes during unserialization - this will become an Error in php 9.0.
  (Adding dynamic properties in other contexts was already a deprecation warning - the use case of unserialization was overlooked)
* Throw an error when attempting to add a dynamic property to a `readonly` class when unserializing
* Add new serialization methods `__serialize`/`__unserialize` for SplFixedArray to avoid creating deprecated dynamic
  properties that would then be added to the backing fixed-size array
* Don't add named dynamic/declared properties (e.g. $obj->foo) of SplFixedArray to the backing array when unserializing
* Update tests to declare properties or to expect the deprecation warning
* Add news entry

Co-authored-by: Tyson Andre <tysonandre775@hotmail.com>
2022-08-30 07:46:32 -04:00

58 lines
1.4 KiB
PHP

<?php
/** @generate-class-entries */
class SplFixedArray implements IteratorAggregate, ArrayAccess, Countable, JsonSerializable
{
public function __construct(int $size = 0) {}
/** @tentative-return-type */
public function __wakeup(): void {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
/** @tentative-return-type */
public function count(): int {}
/** @tentative-return-type */
public function toArray(): array {}
/** @tentative-return-type */
public static function fromArray(array $array, bool $preserveKeys = true): SplFixedArray {}
/** @tentative-return-type */
public function getSize(): int {}
/** @return bool */
public function setSize(int $size) {} // TODO make return type void
/**
* @param int $index
* @tentative-return-type
*/
public function offsetExists($index): bool {}
/**
* @param int $index
* @tentative-return-type
*/
public function offsetGet($index): mixed {}
/**
* @param int $index
* @tentative-return-type
*/
public function offsetSet($index, mixed $value): void {}
/**
* @param int $index
* @tentative-return-type
*/
public function offsetUnset($index): void {}
public function getIterator(): Iterator {}
public function jsonSerialize(): array {}
}