php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80822 signature of ArrayObject::exchangeArray($array) has changed
Submitted: 2021-03-03 00:20 UTC Modified: -
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: ievgen dot varava at spryker dot com Assigned:
Status: Open Package: Documentation problem
PHP Version: 8.0.2 OS: OS X
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ievgen dot varava at spryker dot com
New email:
PHP Version: OS:

 

 [2021-03-03 00:20 UTC] ievgen dot varava at spryker dot com
Description:
------------
---
From manual page: https://php.net/arrayobject.exchangearray
---
Signature of ArrayObject::exchangeArray($array) has changed, but is not documented. Some code that worked in php7 might become incompatible with php8

Test script:
---------------
<?php
interface intA {
    public function exchangeArray($param);
}

class classB extends ArrayObject implements intA {}
?>

Expected result:
----------------
no errors (works in php 7.4.13)

Actual result:
--------------
Fatal error:  Declaration of ArrayObject::exchangeArray(object|array $array) must be compatible with intA::exchangeArray($param)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-03 00:37 UTC] ievgen dot varava at spryker dot com
Also, passing invalid parameter throws TypeError in PHP8 vs InvalidArgumentException in PHP7

<?php
$a = new ArrayObject();
$a->exchangeArray(123);
?>
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Oct 23 07:03:32 2021 UTC