php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #38402 Wrong documented return type for ArrayObject::offsetGet
Submitted: 2006-08-09 20:19 UTC Modified: 2006-08-11 17:06 UTC
From: david dot nqd at gmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2006-08-09 20:19 UTC] david dot nqd at gmail dot com
Description:
------------
Hi,

The documented return type of ArrayObject::offsetGet is bool, when it should it be mixed (?)

The documentation for this function: "Returns the value at the specified $index" which may or may not be boolean.

- David


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-10 08:31 UTC] RQuadling at GMail dot com
The source to this function /php-src/ext/spl/spl_array.c /* $Id: spl_array.c,v 1.111 2006/05/20 19:47:18 helly Exp $ */ Lines 493-504 are

/* {{{ proto bool ArrayObject::offsetGet(mixed $index)
       proto bool ArrayIterator::offsetGet(mixed $index)
 Returns the value at the specified $index. */
SPL_METHOD(Array, offsetGet)
{
	zval *index, *value;
	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &index) == FAILURE) {
		return;
	}
	value = spl_array_read_dimension_ex(0, getThis(), index, BP_VAR_R TSRMLS_CC);
	RETURN_ZVAL(value, 1, 0);
} /* }}} */

As the manual is based upon the proto defined in the source, it LOOKS like the proto is incorrect.

Can you give a short proof?
 [2006-08-11 17:06 UTC] nlopess@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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Apr 28 11:01:30 2025 UTC