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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Sun Jul 21 15:01:26 2019 UTC