htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated

From: Date: Fri, 03 Jan 2025 06:18:17 +0000
Subject: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated
Groups: php.internals 
Request: Send a blank email to internals+get-126197@lists.php.net to get a copy of this message
Ran into this error today which is confusing and seems broken. Can someone explain why this would throw an error and what the intended solution is? Thanks htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated: PHP 8.3 This code happens to be in a form building class so sometime $fieldValue is a string and other times it is null. Both are valid. $fieldValue = null; echo htmlentities($fieldValue ?? '’); Thanks ---------------------------------- Daniel Baldwin 541-401-7797

Attachment: [application/pkcs7-signature] smime.p7s
« previous php.internals (#126197) next »