Doc #69560 [Asn->Csd]: Example comment is incorrect for PharData::compress().

From: Date: Fri, 01 Jul 2016 20:19:58 +0000
Subject: Doc #69560 [Asn->Csd]: Example comment is incorrect for PharData::compress().
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13669@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69560&edit=1 ID: 69560 Updated by: cmb@php.net Reported by: wbuckner at connecteddata dot com Summary: Example comment is incorrect for PharData::compress(). -Status: Assigned +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: Mac OS X PHP Version: 5.6.8 Assigned To: peehaa Block user comment: N Private report: N New Comment: This issue has already been fixed in the meantime. Nonetheless, thanks for your report, and for helping to make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2015-05-01 20:24:50] wbuckner at connecteddata dot com 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 this bug report at https://bugs.php.net/bug.php?id=69560&edit=1

« previous php.doc.bugs (#13669) next »