Infinite loop
| From: | Joe Estock | Date: | Sat, 13 Mar 2004 13:28:49 +0000 |
| Subject: | Infinite loop | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-8502@lists.php.net to get a copy of this message | ||
I know that this would most likely never be used, however someone brought this to my attention and I have verified it on PHP 4.3.4 on FreeBSD 5.2.1-RELEASE as well as PHP 4.3.4 on Windows XP.
---
while(str_replace(' ', ' ', ' f dfd 34 dsf ')) { }
---
This results in PHP obviously becoming stuck in an infinite loop. The semantecs of it make complete sense, str_replace will always return TRUE.
My question is this: Shouldn't there be some type of detection for this that would at least cause PHP to throw a warning?
Regards,
Joe Estock (guru)