Closed bellwood closed 3 years ago
Hello,
Thanks for the report. However we have tests supporting the hash
function which passed.
array_key_exists() expects parameter 2 to be array, null given Looking at the error message it seems the issue comes from the
$json
variable and not the$path
.
But since you defined your hashes in your config file, it shouldn't try to get the mix-sri.json
file. You might want to verify that your config is properly defined. The only reason for it to try to get it from the mix-sri.json
is because it can't find the hashes in the config file.
@Elhebert not sure if I can chalk this up to caching or just PEBKAC but after I removed mix-sri.json
from my public path (not yet automating that with your other package) and ran php artisan optimize
everything began working.
As part of my debug process, I'd also added a new public method to Sri.php
and was able to return the path I fed into it from blade using that method (pre artisan optimize
)
I have another older site to implement this on and if I can reproduce the issue I will re-open this issue.
Appreciate the follow up, thank you.
Working to implement this on an older L5.6 site on PHP 7.4 using the v1 branch.
Config has been published and hashes are added:
In my blade template:
No matter what path I give inside
Sri::hash()
I'm always getting the following:ErrorException(code: 0): array_key_exists() expects parameter 2 to be array, null given at /redacted/vendor/elhebert/laravel-sri/src/Sri.php:40)
If I debug at the top of the hash function
$path
is alwaysnull
.