Doc #70305 [Opn->Ver]: PharData::decompress() Example 1: $p2 is undefined
| From: | cmb@php.net | Date: | Wed, 19 Aug 2015 16:51:31 +0000 |
| Subject: | Doc #70305 [Opn->Ver]: PharData::decompress() Example 1: $p2 is undefined | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12628@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70305&edit=1
ID: 70305
Updated by: cmb@php.net
Reported by: howellnick at gmail dot com
Summary: PharData::decompress() Example 1: $p2 is undefined
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2015-08-19 15:19:41] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70305&edit=1