CyberSource / cybersource-rest-samples-php

PHP sample code for the CyberSource REST API
26 stars 51 forks source link

downloadReport function is returning the wrong directory seperator on linux #42

Open nlhooper opened 3 years ago

nlhooper commented 3 years ago

The downloadReport funciton in ExternalConfiguration.php is using a hardcoded backslash in the returned path, which is incorrect on Linux. (apologies I dont know why the line breaks arent appearing in the code block):

function downloadReport($downloadData, $fileName){ $filePathName = __DIR__. DIRECTORY_SEPARATOR .$fileName; $file = fopen($filePathName, "w"); fwrite($file, $downloadData); fclose($file); return __DIR__.'\\'.$fileName; }

It should use the php constant DIRECTORY_SEPARATOR and as the path is already stored in the filePathName variable the return fucntion can be corrected to return $filePathName;