GeSHi / geshi-1.0

Original version of Generic Syntax Highlighter for PHP
http://qbnz.com/highlighter/
GNU General Public License v2.0
168 stars 101 forks source link

nginx: Undefined offset: 0 #89

Closed cweiske closed 6 years ago

cweiske commented 7 years ago

I get a PHP warning when highlighting nginx config code:

PHP Notice: Undefined offset: 0 in /usr/share/php/geshi.php on line 3469

Reproduction code:

<?php
require 'geshi.php';
$code = <<<'EOD'
location ~ \.(php|phar)(/.*)?$ {
    fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;
    set $path_info $fastcgi_path_info;
    fastcgi_param PATH_INFO $path_info;
    ...
}
EOD;
$geshi = new GeSHi($code, 'nginx');
$geshi->parse_code();

Happens with geshi 1.0.9.0.