BrianHenryIE / strauss

Prefix PHP namespaces and classnames to allow multiple versions of libraries to exist without conflict.
https://brianhenryie.github.io/strauss/
MIT License
137 stars 21 forks source link

ConfigurationResolver.php from aws-sdk-php not fully prefixed. #114

Open Razorbacktrack opened 1 month ago

Razorbacktrack commented 1 month ago

Hi,

composer.json :

{
    "require": {
      "aws/aws-sdk-php": "^3.317",
      "brianhenryie/strauss": "^0.19.2"
    },
    "extra": {
      "aws/aws-sdk-php": [
        "CloudFront"
      ],
      "strauss": {
        "target_directory": "deps",
        "namespace_prefix": "TESt\\CdnPurge\\",
        "classmap_prefix": "TESt_CdnPurge",
        "constant_prefix": "CDN_PURGE_",
        "delete_vendor_packages": true
      }
    }
}

I had a fatal error on my plugin :

PHP Fatal error: Uncaught Error: Call to undefined function Aws\parse_ini_file() in /var/www/html/wp-content/plugins/CdnPurge/libraries/deps/aws/aws-sdk-php/src/Configuration/ConfigurationResolver.php:121

Because there was a call to a function not being prefixed:

$data = @\Aws\parse_ini_file($filename, true, INI_SCANNER_NORMAL);

instead of:

$data = @\TESt\CdnPurge\Aws\parse_ini_file($filename, true, INI_SCANNER_NORMAL);

I think that the problem is the '@' because strauss works correctly if I manually remove it on the original file before launching the prefix-namespaces command.

Thanks

BrianHenryIE commented 1 month ago

Fixed in master: https://github.com/brianHenryIE/strauss/compare/7212a4dd8ec397095c59023591681b4cb0f8611d...2e0a2f8beed433f7661ef498a1ea913b9b834956