Doc #69560 [NEW]: Example comment is incorrect for PharData::compress().
| From: | wbuckner at connecteddata dot com | Date: | Fri, 01 May 2015 20:24:50 +0000 |
| Subject: | Doc #69560 [NEW]: Example comment is incorrect for PharData::compress(). | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-12283@lists.php.net to get a copy of this message | ||
From: wbuckner at connecteddata dot com
Operating system: Mac OS X
PHP version: 5.6.8
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Example comment is incorrect for PharData::compress().
Description:
------------
---
From manual page: http://www.php.net/phardata.compress
---
Example #1 incorrectly uses ".phar" instead of ".tar" in the comments.
Comments read:
$p1 = $p->compress(Phar::GZ); // copies to /path/to/my.phar.gz <<< HERE
$p2 = $p->compress(Phar::BZ2); // copies to /path/to/my.phar.bz2 <<<
HERE
$p3 = $p2->compress(Phar::NONE); // exception: /path/to/my.phar already
exists <<<HERE
I fixed it in the online doc editor but not sure if it saved. The reason
this happened is the docblock was copied from Phar::compress() but this
is PharData::compress()!
Test script:
---------------
php > $p = new PharData('my.tar');
php > $p['myfile.txt'] = 'hi';
php > $p['myfile2.txt'] = 'hi';
php > $p1 = $p->compress(Phar::GZ);
$ ls my.*
my.tar my.tar.gz
Expected result:
----------------
<?php
$p = new PharData('/path/to/my.tar');
$p['myfile.txt'] = 'hi';
$p['myfile2.txt'] = 'hi';
$p1 = $p->compress(Phar::GZ); // copies to /path/to/my.tar.gz
$p2 = $p->compress(Phar::BZ2); // copies to /path/to/my.tar.bz2
$p3 = $p2->compress(Phar::NONE); // exception: /path/to/my.tar already
exists
?>
Actual result:
--------------
<?php
$p = new PharData('/path/to/my.tar');
$p['myfile.txt'] = 'hi';
$p['myfile2.txt'] = 'hi';
$p1 = $p->compress(Phar::GZ); // copies to /path/to/my.phar.gz
$p2 = $p->compress(Phar::BZ2); // copies to /path/to/my.phar.bz2
$p3 = $p2->compress(Phar::NONE); // exception: /path/to/my.phar already
exists
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=69560&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69560&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69560&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69560&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69560&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69560&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69560&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69560&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69560&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69560&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69560&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69560&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69560&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69560&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69560&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69560&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69560&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69560&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69560&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69560&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69560&r=mysqlcfg