[pmwiki-users] Function not compatible anymore with php72
Petko Yotov
5ko at 5ko.fr
Tue Feb 11 14:21:15 PST 2020
I've updated these functions for PHP7.2 here:
https://www.pmwiki.org/wiki/TestSort/TestSort
Petko
On 09/02/2020 02:40, ABClf wrote:
> My config used to have this code (added for sorting search result in
> alphabetical order, including french diacritic : a b c d eéè f ...) :
>
> /*
> # Sorting pages using locale (sort 'é', 'è', 'ê', etc. with 'e' for
> example)
> $PageListSortCmp['namelocalesort'] = 'LocaleSort($x, $y)'; */
> $PageListSortCmp['title'] = 'LocaleSort($PCache[$x][\'=title\'],
> $PCache[$y][\'=title\'])';
> function LocaleSort($a, $b) {
> $x = array($a, $b);
> setlocale(LC_ALL, 'fr_FR.utf8'); ## or 'fr_FR.utf8'
> sort($x, SORT_LOCALE_STRING);
> return ($x[0]==$a)? -1:1;
> }
>
> I believe this doesn't work anymore (with recent php) : when used in
> config, I encounter this error :
>
> Deprecated: Function create_function() is deprecated in
> /home/www/dev6/scripts/pagelist.phpon line 520
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /home/www/dev6/scripts/pagelist.php:520) in
> /home/www/dev6/pmwiki.php on line 1337
>
> I need help for updating that piece of code ; if possible I would like
> to have the requested behaviour (alphabetical order including
> diacritic) by default (no need to add param to search box).
More information about the pmwiki-users
mailing list