Bug #70117 [NEW]: Unexpected return type error

From: Date: Thu, 23 Jul 2015 03:11:42 +0000
Subject: Bug #70117 [NEW]: Unexpected return type error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194643@lists.php.net to get a copy of this message
From:             laruence
Operating system: 
PHP version:      7.0.0beta1
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Unexpected return type error

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

-- 
Edit bug report at https://bugs.php.net/bug.php?id=70117&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70117&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70117&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70117&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70117&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70117&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70117&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70117&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70117&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70117&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70117&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70117&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70117&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70117&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70117&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70117&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70117&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70117&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70117&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70117&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70117&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#194643) next »