Vinelab / cdn

CDN Assets Manager Package for Laravel.
MIT License
216 stars 71 forks source link

Undefined index: http in AwsS3Provider.php:140 #96

Closed crarau closed 8 years ago

crarau commented 8 years ago

I'm getting the error below. Is it something that I'm doing wrong? Using the latest codebase.

production.ERROR: ErrorException: Undefined index: http in /srv/wisk/wisksol/vendor/vinelab/cdn/src/Vinelab/Cdn/Providers/AwsS3Provider.php:140 Stack trace:

0 /srv/wisk/wisksol/vendor/vinelab/cdn/src/Vinelab/Cdn/Providers/AwsS3Provider.php(140): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined index...', '/srv/wisk/wisks...', 140, Array)

1 /srv/wisk/wisksol/vendor/vinelab/cdn/src/Vinelab/Cdn/ProviderFactory.php(50): Vinelab\Cdn\Providers\AwsS3Provider->init(Array)

2 /srv/wisk/wisksol/vendor/vinelab/cdn/src/Vinelab/Cdn/CdnFacade.php(170): Vinelab\Cdn\ProviderFactory->create(Array)

3 /srv/wisk/wisksol/vendor/vinelab/cdn/src/Vinelab/Cdn/CdnFacade.php(64): Vinelab\Cdn\CdnFacade->init()

4 [internal function]: Vinelab\Cdn\CdnFacade->__construct(Object(Vinelab\Cdn\ProviderFactory), Object(Vinelab\Cdn\CdnHelper), Object(Vinelab\Cdn\Validators\CdnFacadeValidator))

5 /srv/wisk/wisksol/bootstrap/cache/compiled.php(1306): ReflectionClass->newInstanceArgs(Array)

Thanks, Chip.

Mulkave commented 8 years ago

Please update to v1.4.3, attempts to solve this issue.

alexc-hollywood commented 8 years ago

Getting the same, and on dev branch using * or 1.4.3. Issue appears to be caused by the config file - there's no "http" array key under the S3 config section.

ErrorException in AwsS3Provider.php line 140: Undefined index: http

Mulkave commented 8 years ago

weird, the attempt to solve this was to add an http to the defaults as in here: https://github.com/Vinelab/cdn/blob/master/src/Vinelab/Cdn/Providers/AwsS3Provider.php#L52

which will be merged with the config later on so regardless of whether there's an http in the config or not it should be working: https://github.com/Vinelab/cdn/blob/master/src/Vinelab/Cdn/Providers/AwsS3Provider.php#L129

can you please check your composer.lock file, check for the commit of vinelab/cdn that's been installed on your side? Thanks!

marcaube commented 8 years ago

@Mulkave that's not quite how array_merge works with recursive arrays, e.g.

$default = [
    'foo' => [
        'bar' => 1,
        'baz' => 2
    ]
];

$configurations = [
    'foo' => [
        'qux' => 3
    ]
];

array_merge($default, $configurations); // ['foo' => ['qux' => 3]]

First-level elements of the first array will be replaced entirely by elements of the second array.