CyberSource / CyberSource/cybersource-rest-client-php

ApiClient.php does not work when composer's "vendor-dir" is not "vendor"

Open
#116 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
41
Forks
77
Avg merge
26m
Merged PRs (30d)
1

Description

File: cybersource/rest-client-php/lib/ApiClient.php
Function: getClientId()

This code has hardcoded "vendor" dir name, but composer has the ability to override it with vendor-dir directive, and when it happens, lib will stop working rendering file not found message. Also, what if I do not use composer?

$packages = json_decode(file_get_contents(DIR . "/../../../../vendor/composer/installed.json"), true);

proper code (does not go outside of the "vendor" folder):

$packages = json_decode(file_get_contents(DIR . "/../../../composer/installed.json"), true);

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cybersource/rest-client-php/lib/ApiClient.php at getClientId() and inspect how the installed package metadata path is assembled. Check the behavior with Composer's vendor-dir override and when Composer is not used. Done means the client no longer assumes a fixed vendor directory and does not produce a file-not-found error in the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.