3v4l.org

run code in 300+ PHP versions simultaneously
<?php $code = "<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> * (c) 2004-2006 Sean Kerr <sean@code-box.org> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * sfAction executes all the logic for the current request. * * @author Fabien Potencier <fabien.potencier@symfony-project.com> * @author Sean Kerr <sean@code-box.org> * * @method sfWebController getController() * @method sfWebResponse getResponse() */ abstract class sfAction extends sfComponent { protected \$security = []; /** * Initializes this action. * * @param sfContext \$context the current application context * @param string \$moduleName the module name * @param string \$actionName the action name */ public function initialize(\$context, \$moduleName, \$actionName) { parent::initialize(\$context, \$moduleName, \$actionName); // include security configuration if (\$file = \$context->getConfigCache()->checkConfig('modules/'.\$this->getModuleName().'/config/security.yml', true)) { require \$file; } } }"; $replaceRegex = '/^(?:<pre><code(?: [^>]+)?>|<code><span(?: [^>]+)?>\s*)(.*?)(?:<\/code><\/pre>|\s*<\/span>\s*<\/code>)$/s'; $splitRegex = '/(\r\n|\n|\r|<br \/>)/'; $content = preg_replace($replaceRegex, '$1', highlight_string($code, true)); $content = preg_split($splitRegex, $content); echo sprintf("Expected 41 lines, got %s lines\n\n", count($content)); $line = 37; $lines = []; for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) { $lines[] = '<li'.($i == $line ? ' class="selected"' : '').'>'.$content[$i - 1].'</li>'; } echo '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
Output for 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Expected 41 lines, got 41 lines <ol start="34"><li> </span><span style="color: #0000BB">parent</span><span style="color: #007700">::</span><span style="color: #0000BB">initialize</span><span style="color: #007700">(</span><span style="color: #0000BB">$context</span><span style="color: #007700">, </span><span style="color: #0000BB">$moduleName</span><span style="color: #007700">, </span><span style="color: #0000BB">$actionName</span><span style="color: #007700">);</li> <li></li> <li> </span><span style="color: #FF8000">// include security configuration</li> <li class="selected"> </span><span style="color: #007700">if (</span><span style="color: #0000BB">$file </span><span style="color: #007700">= </span><span style="color: #0000BB">$context</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getConfigCache</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">checkConfig</span><span style="color: #007700">(</span><span style="color: #DD0000">'modules/'</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getModuleName</span><span style="color: #007700">().</span><span style="color: #DD0000">'/config/security.yml'</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">)) {</li> <li> require </span><span style="color: #0000BB">$file</span><span style="color: #007700">;</li> <li> }</li> <li> }</li></ol>
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29
Expected 41 lines, got 41 lines <ol start="34"><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">parent</span><span style="color: #007700">::</span><span style="color: #0000BB">initialize</span><span style="color: #007700">(</span><span style="color: #0000BB">$context</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$moduleName</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$actionName</span><span style="color: #007700">);</li> <li></li> <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;include&nbsp;security&nbsp;configuration</li> <li class="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">$file&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$context</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getConfigCache</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">checkConfig</span><span style="color: #007700">(</span><span style="color: #DD0000">'modules/'</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getModuleName</span><span style="color: #007700">().</span><span style="color: #DD0000">'/config/security.yml'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">))&nbsp;{</li> <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require&nbsp;</span><span style="color: #0000BB">$file</span><span style="color: #007700">;</li> <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li> <li>&nbsp;&nbsp;&nbsp;&nbsp;}</li></ol>
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Wlrcv on line 55
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, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/Wlrcv on line 55
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/Wlrcv on line 55
Process exited with code 255.

preferences:
151.2 ms | 414 KiB | 5 Q