[PHP-NOTES] note 130438 added to function.strrpos

[email protected] ("Anonymous") Fri, 1 Aug 2025 17:34:46 +0000 (UTC)
Newsgroups php.notes
Message-ID <[email protected]>
I just found out the hard way, that PHP 8.1 and 8.2 throw fatal errors if the offset is negative, and the string is too short.  Maybe ? also if the offset is positive and the string is too short?

I don't have complete documentation, but I believe the source string was either a null-string "" or "/" (representing the document's root).  The offset was (-2).  That threw a fatal error, but not using PHP 5.3 on my other server (old software there that's not getting updated).

So at what version does PHP start throwing fatal errors and shutting down your website?  When does PHP start forcing you to perform manual checks and write additional code to work?  I don't know.  Anybody else have a clue?
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2600:100e:b0c6:cadb:9ce3:53ff:c499:e305)
----
Manual Page -- https://php.net/manual/en/function.strrpos.php
Edit        -- https://main.php.net/note/edit/130438
Del: integrated  -- https://main.php.net/note/delete/130438/integrated
Del: useless     -- https://main.php.net/note/delete/130438/useless
Del: bad code    -- https://main.php.net/note/delete/130438/bad+code
Del: spam        -- https://main.php.net/note/delete/130438/spam
Del: non-english -- https://main.php.net/note/delete/130438/non-english
Del: in docs     -- https://main.php.net/note/delete/130438/in+docs
Del: other reasons-- https://main.php.net/note/delete/130438
Reject      -- https://main.php.net/note/reject/130438
Search      -- https://main.php.net/manage/user-notes.php