Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve() fatal error when $delta['path'] is null #15

Closed
awhale opened this issue Feb 16, 2017 · 2 comments
Closed

resolve() fatal error when $delta['path'] is null #15

awhale opened this issue Feb 16, 2017 · 2 comments

Comments

@awhale
Copy link

awhale commented Feb 16, 2017

When there is no path on the $basePath parameter and no leading slash on the $newPath parameter, a fatal error is generated.

<?php
require('vendor/autoload.php');
$path = \Sabre\Uri\resolve('http://www.mydomain.com', '#');

Fatal error: Uncaught TypeError: strpos() expects parameter 1 to be string, null given in vendor/sabre/uri/lib/functions.php:59
Stack trace:
#0 vendor/sabre/uri/lib/functions.php(59): strpos(NULL, '/')

It is being caused by null being passed into strpos() at the first parameter with strict types enabled.

It could be resolved by casting or null coalescing the value to a string to mimic php5 behaviour, or throwing an exception if this is behaviour you do not want to support.

evert added a commit that referenced this issue Feb 19, 2017
@evert
Copy link
Member

evert commented Feb 19, 2017

Hi!

This might be the weirdest thing I've seen so far. I added a unittest which passed (don't pay attention to the failed build here, different reason).

But, when I slightly change the unitest to force it to fail, I your fatal error. I can't' explain it, I don't get it. Hopefully ill have some more info here soon

@evert
Copy link
Member

evert commented Feb 19, 2017

Never mind, I was looking at it wrong! Only happens with a fragment that does't have a value

evert added a commit that referenced this issue Feb 19, 2017
evert added a commit that referenced this issue Feb 19, 2017
evert added a commit that referenced this issue Feb 20, 2017
@evert evert closed this as completed in 0c53a5f Feb 20, 2017
evert added a commit that referenced this issue Feb 20, 2017
treyssatvincent pushed a commit to treyssatvincent/laravel-nextcloud-fs that referenced this issue Dec 20, 2023
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

No branches or pull requests

2 participants