<?php
class x extends arrayobject{
protected $a = 'protected';
public $b = 'public';
public function __construct(){
parent::__construct(['a'=>'A', 'b'=>'B'], ARRAY_AS_PROPS);
}
}
$a = new x;
echo $a->b;
echo $a->a;
Fatal error: Uncaught Error: Undefined constant "ARRAY_AS_PROPS" in /in/D61YI:7
Stack trace:
#0 /in/D61YI(11): x->__construct()
#1 {main}
thrown in /in/D61YI on line 7
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Fatal error: Uncaught Error: Undefined constant "ARRAY_AS_PROPS" in /in/D61YI:7
Stack trace:
#0 /in/D61YI(11): x->__construct()
#1 {main}
thrown in /in/D61YI on line 7
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: Use of undefined constant ARRAY_AS_PROPS - assumed 'ARRAY_AS_PROPS' (this will throw an Error in a future version of PHP) in /in/D61YI on line 7
Fatal error: Uncaught TypeError: ArrayObject::__construct() expects parameter 2 to be int, string given in /in/D61YI:7
Stack trace:
#0 /in/D61YI(7): ArrayObject->__construct(Array, 'ARRAY_AS_PROPS')
#1 /in/D61YI(11): x->__construct()
#2 {main}
thrown in /in/D61YI on line 7
Process exited with code 255.
Output for 7.2.0 - 7.2.33
Warning: Use of undefined constant ARRAY_AS_PROPS - assumed 'ARRAY_AS_PROPS' (this will throw an Error in a future version of PHP) in /in/D61YI on line 7
Fatal error: Uncaught TypeError: ArrayObject::__construct() expects parameter 2 to be integer, string given in /in/D61YI:7
Stack trace:
#0 /in/D61YI(7): ArrayObject->__construct(Array, 'ARRAY_AS_PROPS')
#1 /in/D61YI(11): x->__construct()
#2 {main}
thrown in /in/D61YI on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20
Notice: Use of undefined constant ARRAY_AS_PROPS - assumed 'ARRAY_AS_PROPS' in /in/D61YI on line 7
Fatal error: Uncaught TypeError: ArrayObject::__construct() expects parameter 2 to be integer, string given in /in/D61YI:7
Stack trace:
#0 /in/D61YI(7): ArrayObject->__construct(Array, 'ARRAY_AS_PROPS')
#1 /in/D61YI(11): x->__construct()
#2 {main}
thrown in /in/D61YI on line 7
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Notice: Use of undefined constant ARRAY_AS_PROPS - assumed 'ARRAY_AS_PROPS' in /in/D61YI on line 7
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'ArrayObject::__construct() expects parameter 2 to be long, string given' in /in/D61YI:7
Stack trace:
#0 /in/D61YI(7): ArrayObject->__construct(Array, 'ARRAY_AS_PROPS')
#1 /in/D61YI(11): x->__construct()
#2 {main}
thrown in /in/D61YI on line 7
Process exited with code 255.