<?php
class Foo {
private $mVars;
public function generateVars() {
$this->mVars = [ 'x', 'y', 'z' ];
}
public function dumpVars() {
var_dump( $this->mVars );
}
}
// 1. Make mVars public, uncomment line 16, then eval.
$before = new Foo();
$before->generateVars();
// echo serialize($before) . "\n"; define('BEFORE', 1);
// 2. Insert the serialised text from first eval
$serialised = 'O:3:"Foo":1:{s:5:"mVars";a:3:{i:0;s:1:"x";i:1;s:1:"y";i:2;s:1:"z";}}';
// 3. Make mVars private, comment out line 16, then eval
$after = unserialize($serialised);
$after->dumpVars();
Parse error: syntax error, unexpected '[' in /in/7XTJj on line 6
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/7XTJj on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7XTJj on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7XTJj on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/7XTJj on line 4
Process exited with code 255.