#39574 [NEW]: ZipArchive::renameName won't accept variables for file names
| From: | damon dot dean at revcube dot com | Date: | Tue, 21 Nov 2006 22:24:00 +0000 |
| Subject: | #39574 [NEW]: ZipArchive::renameName won't accept variables for file names | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-105272@lists.php.net to get a copy of this message | ||
From: damon dot dean at revcube dot com
Operating system: Mac OS X
PHP version: 5.2.0
PHP Bug Type: Scripting Engine problem
Bug description: ZipArchive::renameName won't accept variables for file names
Description:
------------
I'm not sure if this is a bug, or by design, but this function
works differently than others I've seen in PHP. No matter I
try, if I try to pass a file name as a variable to
ZipArchive::renameName, it prints the name of the variable as
the filename, rather than the value of the variable.
Reproduce code:
---------------
<?php
$logDateTime = date('Y_m_d_H_i_s');
$CSVFileName = "HGN_GGL"._."$logDateTime".".csv";
$zip = new ZipArchive;
if ($zip->open('./reports/report-csv.zip') === TRUE) {
//Also tried '' and ""with function below
$zip->renameName('report.csv', $CSVFileName);
$zip->extractTo('./reports');
echo "Yay!";
} else {
echo "Boo";
}
?>
Expected result:
----------------
I would expect it to output a file with a name along the lines
of this:
HGN_GGL_2006_11_21_14_17_07.csv
Actual result:
--------------
Instead, it produces a file name like this:
$CSVFileName
--
Edit bug report at http://bugs.php.net/?id=39574&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39574&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39574&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39574&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39574&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39574&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39574&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39574&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39574&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39574&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39574&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39574&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39574&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39574&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39574&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39574&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39574&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39574&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39574&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39574&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39574&r=mysqlcfg