Update to “php-8.1.2-1 php-apache-8.1.2-1”

In February I reported this problem and I understood that there would be a porting work for the new version of php 8.1.2-1, I wanted to know if there are any news in this regard, thanks.

Ciao Angelo

Omeka Classic 3.1 is now released, with the fixes for PHP 8.1 compatibility.

Wow!! Thank you for all!! Merry Christmas and happy new year.


I just ran into a PHP 8.1 deprecation error in application\models\Mixin\ElementText.php regarding null passed to strlen.

To work around it, I changed line 524 to test for null:

if ($elementText == null || !strlen($elementText)) {

Thanks for sharing. We’ve applied a similar fix to the code.

I found another case (reported in the xampp\apache\logs\error.log):

PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in C:\\xampp\\htdocs\\omeka\\application\\libraries\\Omeka\\File\\MimeType\\Detect\\Strategy\\FileCommand.php on line 25, referer: http://localhost/omeka/admin/items/edit/12794

For me the error is occurring because the call to shell_exec is triggering this error which causes it to return null.

'file' is not recognized as an internal or external command, operable program or batch file.

I got around the deprecation warning by changing the detect() function as follows:

$command = "file -ib $fileArg";
$result = shell_exec($command);
return $result ? trim($result) : "";

However, I don’t know what is causing the error on the file command. I know that shell_exec is working in PHP, and I know that the file command works on the command line. Any ideas?