[php-src] Issue #9715: Allowing use throw many times
| From: | bobanmiletic | Date: | Tue, 11 Oct 2022 07:24:54 +0000 |
| Subject: | [php-src] Issue #9715: Allowing use throw many times | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242572@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9715
Author: bobanmiletic
### Description
The following code:
filename.php
```php
<?php
function divide(float $dividend, float $divisor): float
{
if ($divisor === 0.) {
throw throw throw throw throw throw new Exception("Division by zero");
}
return $dividend / $divisor;
}
echo divide(5, 0);
```
Resulted in this output:
```
PHP Fatal error: Uncaught Exception: Division by zero in
filename.php:6
```
But I expected this output instead:
```
PHP Parse error: syntax error, unexpected "throw" in filename.php on line 6
```
### PHP Version
PHP 8.1.1
### Operating System
_No response_