fruitcake / php-cors

CORS (Cross-Origin Resource Sharing) for your Symfony/Laravel requests
MIT License
234 stars 15 forks source link

fix #11 pass empty string to strpos() instead of null #12

Closed gigerIT closed 1 year ago

gigerIT commented 2 years ago

Fixes: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in vendor/fruitcake/php-cors/src/CorsService.php on line 108

barryvdh commented 2 years ago

How does your config look like? An array with an explicit null value?

gigerIT commented 2 years ago

Yes we have some entries that are only applied when the app/env is in debug mode.

'allowed_origins' => ['prod.domain.com', config('app.debug') ? '*.pages.dev' : null],

I guess we also could use '' instead of null.

barryvdh commented 1 year ago

I'm inclined to think you shouldn't pass a null version.

mfn commented 1 year ago

You can keep the null and wrap the whole [] in array_filter()