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
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.
Angelo
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?
The problem you’re getting there is just related to the file
command being a Linux command, not a Windows one.
Ultimately I think we’ll probably end up removing this call entirely… it’s really a relic of a time when PHP’s built-in filetype detection was less reliable. For the time being we’ll leave it as-is but it’ll probably be removed in a future release.
Thanks for the explanation regarding the file
command.
I found another PHP 8.1 deprecation:
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in C:\xampp\htdocs\omeka\application\views\helpers\Shortcodes.php on line 51
The warning is reported on every page of this Exhibit because null is getting passed as the value of $content
on some, but not all, calls to the shortcodes
function, though I can’t tell why.
I worked around the warning as follows:
if ($content === null || false === strpos($content, '[')) {
I am running Omeka 3.1.1 with ExhibitBuilder 3.6.1.
Thanks. We’ve caught that one also.