You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ext/gettext/gettext.c: handle NULLs from bindtextdomain()
According to POSIX, bindtextdomain() returns "the implementation-
defined default directory pathname used by the gettext family of
functions" when its second parameter is NULL (i.e. when you are
querying the directory corresponding to some text domain and that
directory has not yet been set). Its PHP counterpart is feeding
that result direclty to RETURN_STRING, but this can go wrong in
two ways:
1. If an error occurs, even POSIX-compliant implementations
may return NULL.
2. At least one non-compliant implementation (musl) lacks
a default directory and returns NULL whenever the domain
has not yet been bound.
In either of those cases, PHP segfaults on the NULL string. In this
commit we check for the NULL, and RETURN_FALSE when it happens rather
than crashing.
This partially addresses GH #13696
0 commit comments