@ 2015-10-12T05:30:30Z <?php
var_dump([
$original_set = [ 'arrayobject' => new arrayobject( [3] ), 'reference?' => [5] ],
$original_serialized = serialize( $original_set ),
$original_unserialized = unserialize( $original_serialized ),
$withreference_serialized = preg_replace( '/a:1:{i:0;i:5;}}/', 'R:4;}', $original_serialized ),
$withreference_unserialized = unserialize( $withreference_serialized ),
$withreference_unserialized['reference?'][9] = 8,
# $withreference_unserialized,
( $withreference_unserialized['arrayobject'][9] === $withreference_unserialized['reference?'][9] )
? 'looks like a reference' : 'does not look like a reference' ,
]) ;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 Fatal error: Uncaught InvalidArgumentException: Passed variable is not an array or object in /in/eO4Qp:8
Stack trace:
#0 [internal function]: ArrayObject->__unserialize(Array)
#1 /in/eO4Qp(8): unserialize('a:2:{s:11:"arra...')
#2 {main}
thrown in /in/eO4Qp on line 8
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 InvalidArgumentException: Passed variable is not an array or object in /in/eO4Qp:8
Stack trace:
#0 [internal function]: ArrayObject->__unserialize(Array)
#1 /in/eO4Qp(8): unserialize('a:2:{s:11:"arra...')
#2 {main}
thrown in /in/eO4Qp on line 8
Process exited with code 255 . Output for 7.3.32 - 7.3.33 array(7) {
[0]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(5)
}
}
[1]=>
string(110) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";a:1:{i:0;i:5;}}"
[2]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(5)
}
}
[3]=>
string(100) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";R:4;}"
[4]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#3 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
NULL
}
[5]=>
int(8)
[6]=>
string(30) "does not look like a reference"
}
Output for 7.3.2 - 7.3.31 Notice: Undefined offset: 9 in /in/eO4Qp on line 11
array(7) {
[0]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(5)
}
}
[1]=>
string(110) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";a:1:{i:0;i:5;}}"
[2]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(5)
}
}
[3]=>
string(100) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";R:4;}"
[4]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#3 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
NULL
}
[5]=>
int(8)
[6]=>
string(30) "does not look like a reference"
}
Output for 7.0.23 - 7.0.33 , 7.1.9 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.1 Notice: Undefined offset: 9 in /in/eO4Qp on line 11
array(7) {
[0]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(5)
}
}
[1]=>
string(110) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";a:1:{i:0;i:5;}}"
[2]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(5)
}
}
[3]=>
string(100) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";R:4;}"
[4]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#3 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(3)
}
}
[5]=>
int(8)
[6]=>
string(30) "does not look like a reference"
}
Output for 7.0.0 - 7.0.22 , 7.1.0 - 7.1.8 Process exited with code 139 . Output for 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 array(7) {
[0]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(5)
}
}
[1]=>
string(110) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";a:1:{i:0;i:5;}}"
[2]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(1) {
[0]=>
int(3)
}
}
["reference?"]=>
array(1) {
[0]=>
int(5)
}
}
[3]=>
string(100) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";R:4;}"
[4]=>
array(2) {
["arrayobject"]=>
object(ArrayObject)#3 (1) {
["storage":"ArrayObject":private]=>
&array(2) {
[0]=>
int(3)
[9]=>
int(8)
}
}
["reference?"]=>
&array(2) {
[0]=>
int(3)
[9]=>
int(8)
}
}
[5]=>
int(8)
[6]=>
string(22) "looks like a reference"
}
preferences:dark mode live preview
286.65 ms | 404 KiB | 376 Q