Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PHP8 Compatibility issue implode() legacy signature is being used and is removed in PHP8 #1937

Closed
dford-avb opened this issue Dec 28, 2021 · 2 comments · Fixed by #1938
Closed
Labels
bug confirmed PHP 8 Related to PHP8

Comments

@dford-avb
Copy link

dford-avb commented Dec 28, 2021

Preconditions (*)

  1. v19.4.15
  2. PHP 8.0.14

Steps to reproduce (*)

  1. Disable api2.xml caches,
  2. Make GET rest api call in browser (to get xml response)

Expected result (*)

  1. Return xml result
<magento_api>
<messages>
<error>
<data_item>
<code>404</code>
<message>Request does not match any route.</message>
</data_item>
</error>
</messages>
</magento_api>

Actual result (*)

  1. implode method is using legacy signature which is removed in php 8 -- app/code/core/Mage/Api2/Model/Renderer/Xml.php on line 108: $isAssoc = !preg_match('/^\d+$/', implode(array_keys($data), ''));
  2. Fatal error: Uncaught TypeError: implode(): Argument 2 ($array) must be of type ?array, string given in app/code/core/Mage/Api2/Model/Renderer/Xml.php on line 108
    6 | 0.1233 | 1754120 | implode( $separator = [0 => 'messages'], $array = '' ) | .../Xml.php:108
@sreichel
Copy link
Contributor

sreichel commented Feb 4, 2025

@all-contributors add @dford-avb bug

Copy link
Contributor

@sreichel

I've put up a pull request to add @dford-avb! 🎉

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug confirmed PHP 8 Related to PHP8
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants