php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51453 Mentioning NULL as special value for replacement in array_splice()
Submitted: 2010-04-01 11:22 UTC Modified: 2010-04-01 22:33 UTC
From: news_yodpeirs at thoftware dot de Assigned: degeberg (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: news_yodpeirs at thoftware dot de
New email:
PHP Version: OS:

 

 [2010-04-01 11:22 UTC] news_yodpeirs at thoftware dot de
Description:
------------
Documentation of array_splice() should mention NULL as a special value for replacement (just as objects) as typecasting NULL into an array results in an empty array.

If you want the splicing to create a new element with value NULL you have to use "array(NULL)" instead of NULL.

You should expect this if you read the explanation carefully (and if you know about typecasting NULL as array), but just as objects are considered as a special case for replacement, NULL should be too.

The explanation of replacement better should read: "If replacement is just one element it is not necessary to put array() around it, unless the element is an array itself, an object or NULL."

And the note better should be: "If replacement is not an array, it will be typecast to one (i.e. (array) $parameter). This may result in unexpected behavior when using an object or NULL replacement."

jmtc


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-01 22:33 UTC] degeberg@php.net
Automatic comment from SVN on behalf of degeberg
Revision: http://svn.php.net/viewvc/?view=revision&revision=297304
Log: Fixed #51453 (Mentioning NULL as special value for replacement in array_splice())
 [2010-04-01 22:33 UTC] degeberg@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: degeberg
 [2010-04-01 22:33 UTC] degeberg@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:09 UTC] phpdocbot@php.net
Automatic comment on behalf of degeberg
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=d6f393442baa05d31a005a940aacf5185d8cd563
Log: Fixed #51453 (Mentioning NULL as special value for replacement in array_splice())
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 03:02:51 2024 UTC