Skip to content

Instantly share code, notes, and snippets.

@c9s
Created January 26, 2012 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/1682446 to your computer and use it in GitHub Desktop.
Save c9s/1682446 to your computer and use it in GitHub Desktop.
<?php
$file = '/path/to/pear/channels/pear.corneltek.com/get/Onion-0.0.7.tgz';
$p = new PharData($file, 0,'phartest.phar');
$xml = file_get_contents( $p['package.xml'] );
file_put_contents( $p['package.xml'], $xml ); // fail here
/*
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Cannot create phar '/path/to/pear/channels/pear.corneltek.com/get/Onion-0.0.7.tgz', file extension (or combination) not recognised or the directory does not exist' in /Users/c9s/git/work/minipear/phar_fail.php:3
Stack trace:
#0 /Users/c9s/git/work/minipear/phar_fail.php(3): PharData->__construct('/path/to/pear/c...', 0, 'phartest.phar')
#1 {main}
thrown in /Users/c9s/git/work/minipear/phar_fail.php on line 3
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Cannot create phar '/path/to/pear/channels/pear.corneltek.com/get/Onion-0.0.7.tgz', file extension (or combination) not recognised or the directory does not exist' in /Users/c9s/git/work/minipear/phar_fail.php on line 3
UnexpectedValueException: Cannot create phar '/path/to/pear/channels/pear.corneltek.com/get/Onion-0.0.7.tgz', file extension (or combination) not recognised or the directory does not exist in /Users/c9s/git/work/minipear/phar_fail.php on line 3
Call Stack:
0.0005 648232 1. {main}() /Users/c9s/git/work/minipear/phar_fail.php:0
0.0006 650952 2. PharData->__construct() /Users/c9s/git/work/minipear/phar_fail.php:3
*/
// file_put_contents( 'phar://phartest.phar/package.xml' , $xml ); // works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment