'strpos works with php 8.1 not php 7.2

Hi this code is working on php 8.1 PHP 8.1.2 (cli) (built: Apr 7 2022 17:46:26) (NTS) but not with PHP 7.2.24-0ubuntu0.18.04.11 (cli) (built: Mar 2 2022 17:52:35) ( NTS )

there is the code :

if(strpos(file_get_contents('cache2.db'),$link) == false) 
            {
                file_put_contents($i.'.png',file_get_content_curl($link));
                file_put_contents('cache2.db', $link. PHP_EOL, FILE_APPEND);
            }

With php 7.2, it open cache2.db and write in it, even if the link is in it. With php 8.1, it works as espected. I don't understand why, thanks for your help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source