Menu

#736 Destructuring non-array values (other than null) using [] or list() now emits a warning

Next
open
None
Trunk
Upkeep
8.5
Unknown
Unknown
Unknown
6 days ago
6 days ago
No

Hi Mark,

In many place the list() function is used on non array/object.

This is not allowed anymore in PHP 8.5. See https://www.php.net/manual/en/migration85.incompatible.php#migration85.incompatible.core.destruct-non-array-values

I don't know how to solve this case. For example the BIBCITEGATEWAY->parseCitations() returns sometimes arrays, sometimes strings.

The easy fix is testing the type of the returned value, but I got errors form testing the word processor and the function commentary seems contradictory.

This is just one case. I have to check at least 125 call site. You like this style !


See. line 909, /core/importexport/EXPORTCOMMON.php
See line 159, /home/lkppo/www/wikindx-dev/core/bibcitation/BIBCITEGATEWAY.php
See line 261, /home/lkppo/www/wikindx-dev/core/bibcitation/BIBCITEGATEWAY.php
See line 266, /home/lkppo/www/wikindx-dev/core/bibcitation/BIBCITEGATEWAY.php

Log extract:

[2025-12-20T00:01:55+01:00] PHP Warning: Cannot use string as array in /home/lkppo/www/wikindx-dev/core/importexport/EXPORTCOMMON.php on line 909
[2025-12-20T00:01:55+01:00] Request URI: /public/tinymce/plugins/wkxwpexport/dialog.php
[2025-12-20T00:01:55+01:00] User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
[2025-12-20T00:01:55+01:00] #1 EXPORTCOMMON->documentExportToHtmlSections called at [/home/lkppo/www/wikindx-dev/core/importexport/EXPORTCOMMON.php:1038]
[2025-12-20T00:01:55+01:00] #2 EXPORTCOMMON->exportSections called at [/home/lkppo/www/wikindx-dev/public/tinymce/plugins/wkxwpexport/dialog.php:121]
[2025-12-20T00:01:55+01:00] #3 WPExportDialog->wpExport called at [/home/lkppo/www/wikindx-dev/public/tinymce/plugins/wkxwpexport/dialog.php:81]
[2025-12-20T00:01:55+01:00] #4 WPExportDialog->__construct called at [/home/lkppo/www/wikindx-dev/public/tinymce/plugins/wkxwpexport/dialog.php:16]

Regards,

1 Attachments

Discussion

  • Mark Grimshaw

    Mark Grimshaw - 6 days ago

    Travelling back to Denmark over the next few days so will check after that.

    Mark

     
    • Stéphane Aulery

      Okay, happy holidays then.

       

Log in to post a comment.