Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: fox_code - A bridge to the powerful GeSHi syntax highlighter
Hello, welcome back!
You are right, create_function()
has been deprecated and removed in php 8. To replace it, you can try to replace l.4696-4700 of geshi.php
with
$list = preg_replace_callback(
'#\(\?\:((?:.\|)+.)\)#',
function ($matches) {return "[" . str_replace("|", "", $matches[1]) . "]";},
$list
);
but I have not tested it.
Offline
#38 2024-12-06 23:41:09
- hug
- Member
- Registered: 2024-12-02
- Posts: 11
Re: fox_code - A bridge to the powerful GeSHi syntax highlighter
Thank you, that worked the first time!
For others, this is for geshi.php
version 1.0.9.0.
The original code for PHP 7 and older for lines 4696-4700 looked like this.
static $callback_2;
if (!isset($callback_2)) {
$callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
}
$list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', $callback_2, $list);
Comment (or delete) and replace with etc’s code for PHP 8.
$list = preg_replace_callback(
'#\(\?\:((?:.\|)+.)\)#',
function ($matches) {return "[" . str_replace("|", "", $matches[1]) . "]";},
$list
);
Thanks again, —Hanna
Last edited by hug (2024-12-06 23:41:47)
Offline
Re: fox_code - A bridge to the powerful GeSHi syntax highlighter
Glad it works, and you are lucky if it’s the only fix needed for php8 compatibility.
Re static sites, you might consider etc_cache. Well configured, it turns txp into dynastatic cms, serving most pages directly from disk (so up to 3-4 times faster).
Offline