|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-08-10 13:34 UTC] kelunik@php.net
[2017-08-10 13:57 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
-Type: Feature/Change Request
+Type: Bug
-Package: PHP Language Specification
+Package: *General Issues
[2017-08-10 13:57 UTC] requinix@php.net
[2017-08-10 14:06 UTC] spam2 at rhsoft dot net
[2017-08-10 18:05 UTC] email at davekok dot nl
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 19:00:02 2025 UTC |
Description: ------------ When declaring a function with a type hinted argument passed by reference, the argument's type is not checked on the function's return. I would expect that when calling a function with a type hinted argument passed by reference. That the variable used will still contain data of that type when the function finishes. Test script: --------------- <?php function foo(int &$i) { $i = "string"; // incorrect type } function bar(?int &$i) { $i = null; // correct type } function baz(?int &$i) { $i = 4; // correct type } Expected result: ---------------- A error is thrown on foo's return stating that the variable $i has an incorrect type. Actual result: -------------- The code continues as if all is well.