magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.3k forks source link

[Magento 2.4.4] Class magento/zendframework1/library/Zend/Pdf/NameTree.php not compatible with PHP 8.1 #35335

Open magentix opened 2 years ago

magentix commented 2 years ago

Preconditions (*)

  1. Magento 2.4.4
  2. PHP 8.1

Steps to reproduce (*)

  1. Go to the Sales Shipments page in admin. Select shipments and the "Print Shipping Labels" action.

Expected result (*)

  1. Get a PDF with all the shipment labels

Actual result (*)

  1. PHP crashes with the following error :
Fatal error: During inheritance of ArrayAccess: Uncaught Exception: Deprecated Functionality: Return type of Zend_Pdf_NameTree::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in vendor/magento/zendframework1/library/Zend/Pdf/NameTree.php on line 117

The error happens with the Magento\Shipping\Model\Shipping\LabelGenerator::combineLabelsPdf method.

Additional Information: Please refer below comment:

https://github.com/magento/magento2/issues/35335#issuecomment-1103902652


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 2 years ago

Hi @magentix. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 2 years ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-November. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-November, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-November commented 2 years ago

Verified the issues on Magento 2.4-develop branch and 2.4.4 versions and the issue is reproducible on 2.4.4 instance but not on 2.4-develop branch. Steps performed:

  1. Configure Fedex shipping method as per https://jira.corp.magento.com/browse/MC-27213
  2. Frontend - Login as customer - Created Order
  3. Submit Invoice from admin
  4. Ship - Create Shipping Label and Submit
  5. Go to Sales - Shipments - Select shipment and Print Shipping Labels Issue: image
github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-2892 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 years ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Vishrootways commented 2 years ago

Facing the same issue. If this is a known issue then does any patch available to fix this issue?

hostep commented 2 years ago

@Vishrootways: try updating magento/zendframework1 to version 1.15.1, see https://github.com/magento/zf1/pull/46#issuecomment-1165267804

Vishrootways commented 2 years ago

@hostep Updating magento/zendframework1 to version 1.15.1 works. Thank you

Nuranto commented 2 years ago

This is issue is only partially fixed in 1.15.1.

I still got error, but in different file :

PHP Fatal error: During inheritance of ArrayAccess: Uncaught Exception: Deprecated Functionality: Return type of Zend_Memory_Value::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/magento/zendframework1/library/Zend/Memory/Value.php 

=> magento/zendframework1/library/Zend/Memory/Value.php

Here's a patch :

--- a/library/Zend/Memory/Value.php
+++ b/library/Zend/Memory/Value.php
@@ -86,7 +86,7 @@
      * @param integer $offset
      * @return boolean
      */
-    public function offsetExists($offset)
+    public function offsetExists(mixed $offset): bool
     {
         return $offset >= 0  &&  $offset < strlen($this->_value);
     }
@@ -98,7 +98,7 @@
      * @param integer $offset
      * @return string
      */
-    public function offsetGet($offset)
+    public function offsetGet(mixed $offset): mixed
     {
         return $this->_value[$offset];
     }
@@ -110,7 +110,7 @@
      * @param integer $offset
      * @param string $char
      */
-    public function offsetSet($offset, $char)
+    public function offsetSet(mixed $offset, mixed $value): void
     {
         $this->_value[$offset] = $char;

@@ -126,7 +126,7 @@
      *
      * @param integer $offset
      */
-    public function offsetUnset($offset)
+    public function offsetUnset(mixed $offset): void
     {
         unset($this->_value[$offset]);
hostep commented 2 years ago

@Nuranto: could you report this as a new issue on https://github.com/magento/zf1/issues? I think it will get picked up sooner that way, thanks! 🙂

Nuranto commented 2 years ago

Done 👍

magentix commented 2 years ago

Hi!

Fixed for me after zendframework1 1.15.1 upgrade:

Updating magento/zendframework1 (1.15.0 => 1.15.1): Downloading (connecting.Downloading (100%)
SPbryan007 commented 1 year ago

@magento give me 2.4.5-p1 instance

magento-deployment-service[bot] commented 1 year ago

Hi @SPbryan007. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @SPbryan007, here is your Magento Instance: https://72f6bd7b7d0063653c526ba435e0f2f8.instances.magento-community.engineering Admin access: https://72f6bd7b7d0063653c526ba435e0f2f8.instances.magento-community.engineering/admin_9959 Login: 0a17b5ea Password: 8ca9eca47982