|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69196 PharData should extends Phar
Submitted: 2015-03-06 11:00 UTC Modified: 2021-01-19 15:47 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: Assigned:
Status: Open Package: PHAR related
PHP Version: 5.6Git-2015-03-06 (Git) OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-03-06 11:00 UTC]
According to the documentation, the PharData class ( extends the Phar class. But when using the reflection, we see that the PharData class extends the RecursiveDirectoryIterator class.

It must extend the Phar class since it overrides some of their methods.

Test script:
$r = new ReflectionClass('PharData');

Expected result:
string(4) "Phar"

Actual result:
string(26) "RecursiveDirectoryIterator"


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-07 03:06 UTC]
-Summary: PharData extends Phar or not? +Summary: PharData should extends Phar
 [2015-03-07 03:06 UTC]
I believe so.
 [2015-03-08 11:58 UTC]
-Assigned To: +Assigned To: reeze
 [2015-03-29 07:13 UTC]
Not sure it should really be this way (Phar extends PharData or PharData extends Phar).

Not directly related: See also bug #52909
 [2015-03-30 03:26 UTC]
-- Repost.

Hi Mike,

The bug #69196 could be fixed by specify different arg info IMO.

class Phar and PharData shared the most of the implementation, we could either fix doc or fix implementation, but as the documentation exist so long, I do prefer fix the implementation.
 [2015-03-30 09:50 UTC]
Sure, I'm with you, but I wouldn't fix implementation of "1+2 == 3" if documentation says "1+2 == 4". I just mean we should think about what is th right thing to do.
 [2017-10-24 06:19 UTC]
-Status: Assigned +Status: Open -Assigned To: reeze +Assigned To:
 [2019-06-14 15:27 UTC]
-Type: Bug +Type: Feature/Change Request
 [2019-06-14 15:27 UTC]
Arguably, this is a documentation bug, not a Phar bug. However, it's quite surprising and, so, I'm converting it to a feature request. A recent conversation on internals suggested making Phar and PharData implement an interface (rather than inheriting).


On Wed, 12 Jun 2019 at 18:16, Bishop Bettini <bishop@***> wrote:

> On Wed, Jun 12, 2019 at 11:35 AM G. P. B. <george.banyard@***>
> wrote:
>>    - PharData::setAlias, PharData::setDefaultStub and  PharData::setStub
>>    always throw PharException
>>    <> [11] [12] [13]
>> [11]
>> [12]
>> [13]
> I don't know how much this is used in the wild, but these methods exist so
> that a user may treat a Phar and a PharData as interface-equivalent objects
> independent of the phar.readonly INI setting. I lean toward leaving these
> no-op methods as is, but I am happy to further discuss their merit.

This does make sense, liek said I was just going thought the doc and didn't
try to see the bigger picture especially as I don't use Phar at all.
Would it make sense to create an interface PharStream (or something else)
on which both these object inherit? If this doesn't make sense please
ignore me.
 [2021-01-19 15:47 UTC]
Just for the record, the PharData documentation has been
fixed in the meantime.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 12 23:01:35 2024 UTC