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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
8 + 34 = ?
Subscribe to this entry?

 
 [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: Tue Dec 01 09:01:24 2020 UTC