#50687 [Bgs]: array_reverse return values missing NULL

From: Date: Mon, 11 Jan 2010 06:35:37 +0000
Subject: #50687 [Bgs]: array_reverse return values missing NULL
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3674@lists.php.net to get a copy of this message
 ID:               50687
 Updated by:       kalle@php.net
 Reported By:      hanskrentel at yahoo dot de
 Status:           Bogus
 Bug Type:         Documentation problem
 Operating System: win
 PHP Version:      5.2.8
 New Comment:

If you pass an unexpected type to some functions in 5.2.x, they will
emit a warning and return "undefined". 5.3.x is more strict and won't
silently convert incompatible types, and also returns "undefined". So
this report is still bogus.


Previous Comments:
------------------------------------------------------------------------

[2010-01-10 02:31:53] hanskrentel at yahoo dot de

Sorry for not mentioning that it does a warning as well:

So it does return NULL and it does a warning.

According to the documentation it does return array only, not NULL.

------------------------------------------------------------------------

[2010-01-07 23:02:05] kalle@php.net

According to the sources, then the only time array_reverse() would
return NULL would also emit an E_WARNING in the 5.2 branch:

2696 	if (Z_TYPE_PP(input) != IS_ARRAY) {
 
2697 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should
be an array");
 
2698 		return;
 
2699 	}

------------------------------------------------------------------------

[2010-01-07 17:39:19] hanskrentel at yahoo dot de

Description:
------------
array_reverse has array as documented return type. while running
var_dump(array_reverse(NULL)); it reported to me NULL. I
think some documentation is missing here.

Reproduce code:
---------------
---
From manual page: function.array-reverse#Return Values
---


Expected result:
----------------
array (Not that I personally would expect that, but the documentation).

Actual result:
--------------
null


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50687&edit=1



Thread (5 messages)

« previous php.doc.bugs (#3674) next »