php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39574 ZipArchive::renameName won't accept variables for file names
Submitted: 2006-11-21 22:23 UTC Modified: 2006-11-21 22:48 UTC
From: damon dot dean at revcube dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.0 OS: Mac OS X
Private report: No CVE-ID: None
 [2006-11-21 22:23 UTC] damon dot dean at revcube dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-21 22:48 UTC] damon dot dean at revcube dot com
I'm going to retract this. I'm not sure that I should even be 
trying to call this function and renaming before extracting 
the file.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 23:01:31 2024 UTC