Req #81058 [Com]: Inedible syntax porridge

From: Date: Thu, 20 May 2021 22:17:21 +0000
Subject: Req #81058 [Com]: Inedible syntax porridge
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233940@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81058&edit=1 ID: 81058 Comment by: a at b dot c dot de Reported by: zmfw1991 at gmail dot com Summary: Inedible syntax porridge Status: Not a bug Type: Feature/Change Request Package: Compile Warning Operating System: all? PHP Version: Irrelevant Block user comment: N Private report: N New Comment: You've discovered the concept of an empty loop (a loop "foreach()" containing an empty statement ";"). Empty statements are cromulent; they're allowed so one also has to allow loops to contain them. Empty loops have their uses. There is no PHP bug here, only a typo in coding. Previous Comments: ------------------------------------------------------------------------ [2021-05-20 11:20:29] rtrtrtrtrt at dfdfdfdf dot dfd guess what: it's parseable ------------------------------------------------------------------------ [2021-05-20 11:19:17] zmfw1991 at gmail dot com It would be wiser to throw out ParseError. But php doesn't do that. ------------------------------------------------------------------------ [2021-05-20 11:04:56] rtrtrtrtrt at dfdfdfdf dot dfd garbage in - garbage out ------------------------------------------------------------------------ [2021-05-20 11:02:49] zmfw1991 at gmail dot com No. This is bug! [RU] Правильнее было бы определять это как синтаксическую ошибку и выдавать предупреждение, но php сейчас это не обнаруживает, он не замечает лишнюю точку с запятой после if () но перед {}. Здесь возможно неявное и непредсказуемое поведение, притом что врядли кто-то будет писать и ожидать корректного поведения от странных конструкции таких как: if( expression ); { code } При этом PHP волне обнаруживает синтаксическую ошибку здесь, на слове else: if ( false ); { echo 'true'; } else { echo 'true'; } Но если else не указан, то PHP промолчит. Я на поиск такой ошибки убил час, а PHP молчит как партизан, она очень незаметна и не бросается в глаза, но это ошибка всё же. ------------------------------------------------------------------------ [2021-05-20 10:42:48] derick@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=81058 -- Edit this bug report at https://bugs.php.net/bug.php?id=81058&edit=1

« previous php.bugs (#233940) next »