Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.2
-
Fix Version/s: 1.9.3
-
Component/s: Zend_Service_Nirvanix
-
Labels:None
Description
When trying to execute the following script in the Windows command line an exception is thrown due to dirname returning a backslash.
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . 'C:\Program Files\PHP\ZendFramework-1.8.2-minimal\library');
require_once 'C:\Program Files\PHP\ZendFramework-1.8.2-minimal\library\Zend\Service\Nirvanix.php';
$auth = array('username' => 'userforzendbug',
'password' => 'zendpass',
'appKey' => '1a6df3fd-c81d-4cbf-9a97-27110926e916');
$nirvanix = new Zend_Service_Nirvanix($auth);
$imfs = $nirvanix->getService('IMFS');
$result = $imfs->putContents('/foo.txt', 'fourteen bytes');
print_r($result);
?>
In library/Zend/Services/Nirvanix/Namespace/Imfs.php at line 85:
...
$this->_httpClient->setParameterPost('destFolderPath', dirname($filePath));
$this->_httpClient->setFileUpload(basename($filePath), 'uploadFile', $data, $mimeType);
$response = $this->_httpClient->request(Zend_Http_Client::POST);
...
The fix is to always pass Nirvanix a forward slash. The replacement for line 85 could be something like a str_replace for the slash.
$this->_httpClient->setParameterPost('destFolderPath', str_replace("
", "/", dirname($filePath)));
after str_replace(" there should be a backslash backslash but it seems to have been stripped out.