php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70117 Unexpected return type error
Submitted: 2015-07-23 03:11 UTC Modified: -
From: laruence@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.0beta1 OS:
Private report: No CVE-ID: None
 [2015-07-23 03:11 UTC] laruence@php.net
Description:
------------
return type are not well tested, it sometimes throw unexcepted errors while meet IS_INDIREcT or IS_REFERENCE

Test script:
---------------
<?php
$array = array(1, 2, 3);
debug_zval_dump($array);

var_dump(foo());

function &foo() :string {
    global $array;
    return $array[1];
}

Expected result:
----------------
no error

Actual result:
--------------
PHP Fatal error:  Uncaught TypeError: Return value of foo() must be of the type string, unknown returned in /tmp/1.php on line 10 in /tmp/1.php:10
Stack trace:
#0 /tmp/1.php(6): foo()
#1 {main}
  thrown in /tmp/1.php on line 10

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-23 03:24 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a123876b4e181731e3d95cabfb88bbc42d7d844b
Log: Fixed bug #70117 (Unexpected return type error)
 [2015-07-23 03:24 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2015-08-04 20:54 UTC] ab@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a123876b4e181731e3d95cabfb88bbc42d7d844b
Log: Fixed bug #70117 (Unexpected return type error)
 [2016-07-20 11:37 UTC] davey@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a123876b4e181731e3d95cabfb88bbc42d7d844b
Log: Fixed bug #70117 (Unexpected return type error)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC