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: 2018-03-12 22:33 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:
Status: Verified Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 13:01:28 2019 UTC