CyberSource / CyberSource/cybersource-rest-samples-php
downloadReport function is returning the wrong directory seperator on linux
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 31
- Forks
- 51
- Avg merge
- 36m
- Merged PRs (30d)
- 1
Description
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;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open ExternalConfiguration.php and inspect the downloadReport function, especially how $filePathName is built and returned. Confirm that the returned path uses the platform-independent DIRECTORY_SEPARATOR and matches the file that was written, then verify the behavior on Linux.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100