Doc #76097 [Fbk->NoF]: foreach does not work with pharfileinfo
| From: | php-bugs at lists dot php dot net | Date: | Sun, 24 Jun 2018 04:25:43 +0000 |
| Subject: | Doc #76097 [Fbk->NoF]: foreach does not work with pharfileinfo | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15817@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76097&edit=1
ID: 76097
Updated by: php-bugs@lists.php.net
Reported by: bonnevillessei67 at hotmail dot com
Summary: foreach does not work with pharfileinfo
-Status: Feedback
+Status: No Feedback
Type: Documentation Problem
Package: PHAR related
Operating System: WAMP 3.0.8
PHP Version: Irrelevant
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2018-03-14 19:59:15] requinix@php.net
I don't see anything that says it does. Are you confusing SplFileInfo with SplFileObject?
------------------------------------------------------------------------
[2018-03-14 19:56:24] bonnevillessei67 at hotmail dot com
Description:
------------
---
From manual page: http://php.net/manual/en/pharfileinfo.construct.php
---
Spent two hours banging my head against the wall to find out 'foreach' does not loop over
'pharfileinfo' objects.
Please update the documentation and explain this limitation.
Test script:
---------------
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['testfile.txt'] = "hi\nthere\ndude";
$file = $p['testfile.txt'];
foreach ($file as $line => $text) {
echo "line number $line: $text";
}
// this also works
$file = new PharFileInfo('phar:///path/to/my.phar/testfile.txt');
foreach ($file as $line => $text) {
echo "line number $line: $text";
}
Expected result:
----------------
line number 1: hi
line number 2: there
line number 3: dude
line number 1: hi
line number 2: there
line number 3: dude
Actual result:
--------------
A blank screen is displayed.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76097&edit=1