Bug #80656 [Opn->Nab]: str_contains() asserts that string contains null and empty string

From: Date: Fri, 22 Jan 2021 06:13:01 +0000
Subject: Bug #80656 [Opn->Nab]: str_contains() asserts that string contains null and empty string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231696@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80656&edit=1 ID: 80656 Updated by: requinix@php.net Reported by: artyomnsk2012 at gmail dot com Summary: str_contains() asserts that string contains null and empty string -Status: Open +Status: Not a bug Type: Bug -Package: Unknown/Other Function +Package: Strings related Operating System: Windows 7 PHP Version: 8.0.1 Block user comment: N Private report: N New Comment: > str_contains() asserts that 'test' string contains null Without strict_types, null will be implicitly converted to an empty string. See also https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg > str_contains() asserts that 'test' string contains empty string https://www.php.net/manual/en/function.str-contains.php Previous Comments: ------------------------------------------------------------------------ [2021-01-22 05:52:01] artyomnsk2012 at gmail dot com Description: ------------ str_contains() asserts that 'test' string contains null str_contains() asserts that 'test' string contains empty string php -r "var_dump(str_contains('test', null));" bool(true) php -r "var_dump(str_contains('test', ''));" bool(true) Test script: --------------- var_dump(str_contains('test', null)); var_dump(str_contains('test', '')); Expected result: ---------------- In test script I expect to see false value for both code lines Actual result: -------------- In test script I see true value for both code lines ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80656&edit=1

« previous php.bugs (#231696) next »