php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70305 PharData::decompress() Example 1: $p2 is undefined
Submitted: 2015-08-19 15:19 UTC Modified: 2015-08-19 16:53 UTC
From: howellnick at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2015-08-19 15:19 UTC] howellnick at gmail dot com
Description:
------------
Example #1 A PharData::decompress() example

<?php
$p = new PharData('/path/to/my.tar', 0, 'my.tar.gz');
$p['myfile.txt'] = 'hi';
$p['myfile2.txt'] = 'hi';
$p3 = $p2->decompress(); // creates /path/to/my.tar
?>
---
From manual page: http://www.php.net/phardata.decompress
---

On the line:

$p3 = $p2->decompress(); // creates /path/to/my.tar


$p2 is clearly undefined. The line should probably be changed to:

$p2 = $p->decompress(); // creates /path/to/my.tar



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-19 16:51 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2015-08-19 16:51 UTC] cmb@php.net
Thanks for reporting this issue. The example is definitely wrong,
but simply changing to $p->decompress() is not supposed to work,
either.

It seems the example has been copied from PharData::compress(),
and only superficially been adapted. IMO, the example should be
replaced with a simple example showing how to decompress an
already existing compressed archive.
 [2015-08-19 16:53 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=337556
Log: fix erroneous example (fixes #70305)
 [2015-08-19 16:53 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2015-08-19 16:53 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 21:00:02 2026 UTC