Bug->Doc #80454 [Opn->Ver]: Type mismatch error
| From: | cmb@php.net | Date: | Tue, 01 Dec 2020 14:16:10 +0000 |
| Subject: | Bug->Doc #80454 [Opn->Ver]: Type mismatch error | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18171@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80454&edit=1
ID: 80454
Updated by: cmb@php.net
Reported by: brucekwells at gmail dot com
Summary: Type mismatch error
-Status: Open
+Status: Verified
-Type: Bug
+Type: Documentation Problem
-Package: *Programming Data Structures
+Package: SPL related
Operating System: Window 10 latest
PHP Version: 8.0.0
Block user comment: N
Private report: N
New Comment:
As of PHP 8.0.0, SplFixedArray no longer implements Iterator, but
rather IteratorAggregate. Use the ::getIterator() method to get
the Iterator: <https://3v4l.org/13jav>.
This is documented in the migration guide[1], but not in the
manual proper.
[1] <https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.spl>
Previous Comments:
------------------------------------------------------------------------
[2020-12-01 14:05:25] brucekwells at gmail dot com
Description:
------------
The test script produces the following error on PHP 8.0.0:
Fatal error: Uncaught TypeError: NoRewindIterator::__construct(): Argument #1 ($iterator) must be of
type Iterator, SplFixedArray given
Works on PHP 7.4.9
Test script:
---------------
<?php
$tokens = [1,2,3];
new NoRewindIterator(SplFixedArray::fromArray($tokens));
Expected result:
----------------
No error message generated
Actual result:
--------------
Fatal error: Uncaught TypeError: NoRewindIterator::__construct(): Argument #1 ($iterator) must be of
type Iterator, SplFixedArray given in filename.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80454&edit=1