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

Undefined array key 0 in (...)class.tx_caretakerinstance_Operation_CheckPathExists.php line 56 #92

Open
julianhofmann opened this issue Mar 16, 2023 · 0 comments

Comments

@julianhofmann
Copy link

Line 56 is list($path) = glob($path);.

Here list() assigns the index 0 of glob($path). glob() returns an array containing the matched files/directories, an empty array if no file matched or false on error. The last two cases will fail to be assigned because there is no entry in the array - or it is no array (false).

This use-case might be caused by not setting any paths to be checked.
Looking to tx_caretakerinstance_CheckPathTestService.php#L63: $paths = explode(chr(10), $paths);
$path will be a non-empty array even if the separator is not found ("If separator contains a value that is not contained in string and a negative limit is used, then an empty array will be returned, otherwise an array containing string will be returned. "). Exactly this will be, if $pathsis an empty string - there's no chr(10) in it, and explode() return array(0=>'').
In line 64 this empty string will be processed and cause the above warning due to an invalid/empty path.

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

1 participant