Bug #75750 [Opn->Nab]: PHP 7.2.0RC3 (cli) (built: Sep 28 2017 16:28:14) ( NTS )

From: Date: Sat, 30 Dec 2017 22:59:59 +0000
Subject: Bug #75750 [Opn->Nab]: PHP 7.2.0RC3 (cli) (built: Sep 28 2017 16:28:14) ( NTS )
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213333@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75750&edit=1 ID: 75750 Updated by: requinix@php.net Reported by: helldar at ai-rus dot com Summary: PHP 7.2.0RC3 (cli) (built: Sep 28 2017 16:28:14) ( NTS ) -Status: Open +Status: Not a bug Type: Bug Package: Arrays related Operating System: Irrelevant PHP Version: 7.2.0 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php http://php.net/manual/en/function.in-array.php > Searches haystack for needle using loose comparison unless strict is set. https://www.google.com/search?q=php+loose+comparisons Use in_array($key, $arr, true). Previous Comments: ------------------------------------------------------------------------ [2017-12-30 22:52:33] helldar at ai-rus dot com The bug works in the following versions of PHP: 5.6.29, 7.0.14, 7.1.12 and 7.2.0RC3. Other versions I did not check. ------------------------------------------------------------------------ [2017-12-30 22:48:25] helldar at ai-rus dot com Description: ------------ When searching for an integer "0" in the in_array function that does not contain it as a value, the function always returns true PHP 7.2.0RC3 (cli) (built: Sep 28 2017 16:28:14) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0-dev, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.2.0RC3, Copyright (c) 1999-2017, by Zend Technologies with blackfire v1.18.0~linux-x64-non_zts72, https://blackfire.io, by SensioLabs Test script: --------------- $arr = ['Car', 'Images']; $key = 0; echo (string)in_array($key, $arr); // Returned: 1 OR $arr = ['Car', 'Images']; $key = 1; echo (string)in_array($key, $arr); // Returned: 0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75750&edit=1

« previous php.bugs (#213333) next »