The function create_function() is deprecated #797

Closed
opened 2026-10-05 00:17:54 +02:00 by adam · 3 comments
Owner

After upgrading Ubuntu to 18.04 and PHP to 7.2 I get these errors/warnings.

Deprecated: Function create_function() is deprecated in /var/www/piwigo/include/functions.inc.php on line 2165

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/piwigo/include/template.class.php on line 293.

After upgrading Ubuntu to 18.04 and PHP to 7.2 I get these errors/warnings. Deprecated: Function create_function() is deprecated in /var/www/piwigo/include/functions.inc.php on line 2165 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/piwigo/include/template.class.php on line 293. <!-- github-sync-id:333005103 -->
adam closed this issue 2026-10-05 00:17:54 +02:00
Author
Owner

Line 2165 in /var/www/piwigo/include/functions.inc.php
REPLACE
//$replace_chars = create_function('$m', 'return ord(strtolower($m[1]));');

WITH
$replace_chars = function($m) {
return ord(strtolower($m[1]));
};

Line 293 in /var/www/piwigo/include/template.class.php
REPLACE:
//while(list($handle, $filename) = each($filename_array))

WITH:
foreach ($filename_array as $handle=>$filename)

Line 2165 in /var/www/piwigo/include/functions.inc.php REPLACE //$replace_chars = create_function('$m', 'return ord(strtolower($m[1]));'); WITH $replace_chars = function($m) { return ord(strtolower($m[1])); }; Line 293 in /var/www/piwigo/include/template.class.php REPLACE: //while(list($handle, $filename) = each($filename_array)) WITH: foreach ($filename_array as $handle=>$filename) <!-- github-comment-id:398272910 -->
Author
Owner

Thanks for these fixings ameenullah
Sorry, but I have unluckily other errors which appear when I'm browsing into the app :
( ! ) Deprecated: Function create_function() is deprecated in /var/www/html/piwigo/admin/include/functions.php on line 678 after creating an album...

( ! ) Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/piwigo/include/smarty/libs/sysplugins/smarty_internal_compilebase.php on line 78
when I follow the tuto-popup

( ! ) Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/piwigo/include/smarty/libs/sysplugins/smarty_internal_compilebase.php on line 78

among others... :(

Thanks for these fixings ameenullah Sorry, but I have unluckily other errors which appear when I'm browsing into the app : ( ! ) Deprecated: Function create_function() is deprecated in /var/www/html/piwigo/admin/include/functions.php on line 678 after creating an album... ( ! ) Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/piwigo/include/smarty/libs/sysplugins/smarty_internal_compilebase.php on line 78 when I follow the tuto-popup ( ! ) Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/piwigo/include/smarty/libs/sysplugins/smarty_internal_compilebase.php on line 78 among others... :( <!-- github-comment-id:398535605 -->
Author
Owner

Bug fixed with Piwigo 2.9.4, compatible with PHP 7.2

Bug fixed with Piwigo 2.9.4, compatible with PHP 7.2 <!-- github-comment-id:405281530 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#797