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

Wrong return type for inotify_add_watch(), should be int|false #3162

Closed
UlrichEckhardt opened this issue Feb 2, 2024 · 0 comments · Fixed by #3166
Closed

Wrong return type for inotify_add_watch(), should be int|false #3162

UlrichEckhardt opened this issue Feb 2, 2024 · 0 comments · Fixed by #3166
Assignees

Comments

@UlrichEckhardt
Copy link

Greetings!

inotify_add_watch() returns false when the path doesn't exist, the documentation says it always returns int. You can check this out yourself using this small example snippet:

<?php

declare(strict_types=1);

$inotify = inotify_init();

$watch = inotify_add_watch($inotify, '/nonexistant/path', IN_ALL_EVENTS);
if ($watch === false) {
    echo "inotify_add_watch() failed\n";
}

See also this Psalm bug.

Cheers!

Uli

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

Successfully merging a pull request may close this issue.

2 participants