Doc #75466 [Opn->Ver]: Undocumented Backward Compatibility Break from 7.0 to 7.1
Edit report at https://bugs.php.net/bug.php?id=75466&edit=1
ID: 75466
Updated by: cmb@php.net
Reported by: php at bouchery dot com
Summary: Undocumented Backward Compatibility Break from 7.0
to 7.1
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: Documentation problem
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Confirmed: <https://3v4l.org/bsJkj>
The relevant commit: <http://git.php.net/?p=php-src.git;a=commit;h=fe907562ada8929863561b27355e802db4f14a79>
Previous Comments:
------------------------------------------------------------------------
[2017-10-30 17:07:23] php at bouchery dot com
Description:
------------
---
From manual page: http://www.php.net/migration71.incompatible
---
When "return" without value in a function using return type into PHP 7.0, this will not
generate fatale if "return" is not executed.
When migrating to PHP 7.1, it will generate a compilation error "Fatal error: A function with
return type must return a value" even if "return" is not executed.
Test script:
---------------
<?php
function foo(): int {
if (false) {
return;
}
}
?>
Replace the "false" condition by what you want, never or rarely called.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75466&edit=1
Thread (3 messages)