php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #75466 Undocumented Backward Compatibility Break from 7.0 to 7.1
Submitted: 2017-10-30 17:07 UTC Modified: 2020-08-13 11:58 UTC
Votes:7
Avg. Score:3.6 ± 1.3
Reproduced:5 of 6 (83.3%)
Same Version:5 (100.0%)
Same OS:1 (20.0%)
From: php at bouchery dot com Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at bouchery dot com
New email:
PHP Version: OS:

 

 [2017-10-30 17:07 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-12 22:33 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2020-08-13 11:58 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-08-13 12:00 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=af69aee72fc0357346886cfb6f2aa022b3af62de
Log: Fix #75466: Undocumented Backward Compatibility Break from 7.0 to 7.1
 [2020-08-13 12:00 UTC] phpdocbot@php.net
-Status: Verified +Status: Closed
 [2020-08-14 01:40 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=39a45de2a3375f3e1e5e0790c9183b4ad1c97b02
Log: Fix #75466: Undocumented Backward Compatibility Break from 7.0 to 7.1
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 17:01:23 2020 UTC