3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @since 3.0.0 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ /** * Cell base. * */ class Cell { /** * Instance of the View created during rendering. Won't be set until after * Cell::__toString() is called. * * @var \Cake\View\View */ public $View; /** * Name of the action that was invoked. * * Action name will be inflected to get the template name when rendering. * * @var string */ public $action; /** * Rendering method. * * @param string $action Custom template name to render. If not provided (null), the last * value will be used. This value is automatically set by `CellTrait::cell()`. * @return void */ public function render($action = null) { if ($action !== null) { $this->action = $action; } return $this->__toString(); } /** * Magic method. * * Starts the rendering process when Cell is echoed. * * @return string Rendered cell */ public function __toString() { return $this->bla('action'); } public function bla($action) { throw new Exception('Not allowed'); } } $cell = new Cell(); echo $cell;
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.6
Fatal error: Uncaught Exception: Not allowed in /in/W22VR:66 Stack trace: #0 /in/W22VR(62): Cell->bla('action') #1 /in/W22VR(71): Cell->__toString() #2 {main} thrown in /in/W22VR on line 66
Process exited with code 255.
Output for 7.0.1 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Fatal error: Method Cell::__toString() must not throw an exception, caught Exception: Not allowed in /in/W22VR on line 0
Process exited with code 255.
Output for 5.3.0 - 5.3.2, 5.3.18 - 5.3.29, 5.4.8 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0
Fatal error: Method Cell::__toString() must not throw an exception in /in/W22VR on line 0
Process exited with code 255.
Output for 5.2.0 - 5.2.17, 5.3.3 - 5.3.17, 5.4.0 - 5.4.7
Fatal error: Method Cell::__toString() must not throw an exception in /in/W22VR on line 71
Process exited with code 255.
Output for 5.0.5, 5.1.0 - 5.1.6
Fatal error: Uncaught exception 'Exception' with message 'Not allowed' in /in/W22VR:66 Stack trace: #0 /in/W22VR(62): Cell->bla('action') #1 /in/W22VR(71): Cell->__toString() #2 {main} thrown in /in/W22VR on line 66
Process exited with code 255.
Output for 5.0.3 - 5.0.4
Fatal error: Uncaught exception 'Exception' with message 'Not allowed' in /in/W22VR:66 Stack trace: #0 /in/W22VR(66): Cell::bla() #1 /in/W22VR(62): Cell->bla('action') #2 /in/W22VR(71): Cell->__toString() #3 /in/W22VR(71): unknown() #4 {main} thrown in /in/W22VR on line 66
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Fatal error: Uncaught exception 'Exception' with message 'Not allowed' in /in/W22VR:66 Stack trace: #0 /in/W22VR(62): Cell->bla('action') #1 /in/W22VR(71): Cell->__toString() #2 /in/W22VR(71): unknown() #3 {main} thrown in /in/W22VR on line 66
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/W22VR on line 28
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/W22VR on line 28
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/W22VR on line 28
Process exited with code 255.

preferences:
233.06 ms | 401 KiB | 370 Q