php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57921 cli_arg_typ_filenew does now create full path to relative files corectly
Submitted: 2007-11-20 17:52 UTC Modified: 2007-11-22 13:32 UTC
From: urkle@php.net Assigned: urkle (profile)
Status: Closed Package: phar (PECL)
PHP Version: Irrelevant OS: fedora 8
Private report: No CVE-ID: None
 [2007-11-20 17:52 UTC] urkle@php.net
Description:
------------
If passed "-f test.phar"  it will try to use "/home/myuserest.phar" as $d ends up being "."

(stupid PECL bug system won't let me add a comment to an existing issue)

Reproduce code:
---------------
Patch:
diff -ur T/clicommand.inc phar/clicommand.inc
--- old/clicommand.inc	2007-11-20 17:23:27.000000000 -0500
+++ new/clicommand.inc	2007-11-20 17:38:02.000000000 -0500
@@ -214,12 +214,13 @@
     static function cli_arg_typ_filenew($arg, $cfg, $key)
     {
         $d = dirname($arg);
+        $b = basename($arg);
         $f = realpath($d);
         
         if ($f === false) {
             self::error("Path for file '$arg' does not exist.\n");
         }
-        return $f . substr($arg, strlen($d));;
+        return $f . '/' . $b;
     }
 
     static function cli_arg_typ_filecont($arg, $cfg, $key)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-22 13:32 UTC] greg at chiaraquartet dot net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC