|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-08-22 14:59 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2019-08-22 14:59 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sun Mar 22 10:00:01 2026 UTC |
Description: ------------ When you pass undefined key by reference, the key will be created and filled with null value. So you need manually remove these key or choose not to write own isset functions. As an attention, you cannot remove these key inside function you pass key, you should unset it manually at same level you calling own isset. Test script: --------------- <?php // declare function notempty(&$test, &$result = null) { if (! (is_null($test) || ('' === $test) || (is_float($test) && is_nan($test)) )) { $result = $test; } return isset($result); } // run $arr = [0]; if (notempty($arr[1], $result)) dosomething($result); var_dump($arr); // wtf, [0,null] Expected result: ---------------- Auto remove created keys or just really "check" keys before create it... Not sure its possible in C