Bug #78964 [Fbk->NoF]: Third parameter of array_slice() is int type but with NULL default
| From: | php-bugs at lists dot php dot net | Date: | Sun, 29 Dec 2019 04:22:09 +0000 |
| Subject: | Bug #78964 [Fbk->NoF]: Third parameter of array_slice() is int type but with NULL default | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224581@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78964&edit=1
ID: 78964
Updated by: php-bugs@lists.php.net
Reported by: kjell dot eikland at online dot no
Summary: Third parameter of array_slice() is int type but with
NULL default
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Arrays related
Operating System: Win
PHP Version: 7.4.0
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2019-12-15 21:45:36] requinix@php.net
Works for me. https://3v4l.org/GJCdH
------------------------------------------------------------------------
[2019-12-15 18:30:14] kjell dot eikland at online dot no
Description:
------------
I need to have keys returned in an array_slice() operation where I remove some n first elements and
keep the rest. That means that the third parameter must be NULL and the fourth is TRUE.
The third parameter is defined to be of type int, with a default of NULL. I get non-fatal error
messages when specifying a NULL parameter value to override the default for the fourth parameter.
Test script:
---------------
$arr = ['a' => 45, 'b' => 30];
$exp = array_slice($exp, 1, null, true);
Expected result:
----------------
$exp = ['b' => 30] and no debug error message returned.
Actual result:
--------------
$exp = ['b' => 30] and error message returned.
Severity Code Description Project File Line Suppression State
Warning PHP0406 Argument '3' passed to array_slice() is expected to be of type int, null
given ...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78964&edit=1