openlog() Rejects NUL Bytes In The Prefix

openlog() used to accept a syslog prefix containing a NUL byte and silently truncated it at the NUL byte. In PHP 8.6, a NUL byte in the argument throws a ValueError.

PHP code

<?php

try {
    var_dump(openlog("foo\0bar", LOG_PID, LOG_USER));
} catch (\ValueError $e) {
    echo $e->getMessage(), "\n";
}

?>

Before

bool(true)

After

openlog(): Argument #1 ($prefix) must not contain any null bytes

PHP version change

This behavior changed in 8.6

See Also

Error Messages