Skip to content

Remove fragile bundled-vendor autoload require from OffsiteRedirect#19

Open
madsnorgaard wants to merge 1 commit into
Payfast:masterfrom
madsnorgaard:fix/remove-fragile-autoload-require
Open

Remove fragile bundled-vendor autoload require from OffsiteRedirect#19
madsnorgaard wants to merge 1 commit into
Payfast:masterfrom
madsnorgaard:fix/remove-fragile-autoload-require

Conversation

@madsnorgaard

Copy link
Copy Markdown

The payment gateway plugin opens with:

require_once __DIR__ . '/../../../../vendor/autoload.php';

That path resolves to payfast/vendor/autoload.php, which only exists when the module is checked out and composer install is run inside it (the dev layout in this repo). Installed the normal way - composer require payfast/commerce_payfast - the module ships no vendor/ of its own, so the require_once fatals with Failed opening required.

It is also redundant: payfast/payfast-common is a declared dependency in the module composer.json, so Payfast\PayfastCommon\Aggregator\Request\PaymentRequest is already resolved by the project autoloader through the existing use statement.

Removing the line fixes standard Composer installs and changes nothing for the bundled-vendor dev layout. One line removed.

OffsiteRedirect.php began with:
    require_once __DIR__ . '/../../../../vendor/autoload.php';

which resolves to payfast/vendor/autoload.php - a path that only exists
when the module is checked out and 'composer install' is run inside it.
Installed the normal way (composer require payfast/commerce_payfast), the
module ships no vendor/ of its own, so this require_once fatals with
'Failed opening required'.

It is also redundant: payfast/payfast-common is a declared dependency in
the module's composer.json, so Payfast\PayfastCommon\...\PaymentRequest is
resolved by the project autoloader through the existing 'use' statement.
Removing the line fixes standard installs and changes nothing for the
bundled-vendor dev layout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant