#40583 [Bgs]: No explanation of "Illegal offset type"
| From: | dmytton@php.net | Date: | Thu, 22 Feb 2007 16:07:01 +0000 |
| Subject: | #40583 [Bgs]: No explanation of "Illegal offset type" | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969375571@lists.php.net to get a copy of this message | ||
ID: 40583
Updated by: dmytton@php.net
Reported By: darrenoh at sidepotsinternational dot com
Status: Bogus
Bug Type: Documentation problem
Operating System: OS X
PHP Version: Irrelevant
New Comment:
If you enter illegal offset type into the search box top right and
select "online documentation" from the drop menu.
The first result in the search is:
Arrays - Manual
A map is a type that maps values to keys. This type is optimized in
several ways, so you can ... Doing so will result in a warning: Illegal
offset type. ...
php.net/manual/en/language.types.array.php - 21 Feb 2007
Even if you search google for the same query, the relevant PHP page is
first ;)
Previous Comments:
------------------------------------------------------------------------
[2007-02-22 16:03:21] darrenoh at sidepotsinternational dot com
There needs to be a way to search documentation for error
messages like this. Maybe a PHP wiki?
------------------------------------------------------------------------
[2007-02-22 15:56:08] dmytton@php.net
Yes, but it's documented in http://www.php.net/types.array which covers
the use of an array as a key anywhere in any PHP code. It's not really
specific to the unset() function.
------------------------------------------------------------------------
[2007-02-22 15:51:38] cynic@php.net
the OP is complaining that it's not documented, not that it's
happening.
------------------------------------------------------------------------
[2007-02-22 14:21:53] dmytton@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
You cannot use arrays or objects as keys. Doing so will result in a
warning: Illegal offset type. Check your code.
------------------------------------------------------------------------
[2007-02-21 19:05:53] darrenoh at sidepotsinternational dot com
Description:
------------
I'm having a problem with unset generating an "Illegal offset
type" error when I unset an array. My complaint is that
there's no way to find out what the error means or why the
unset command would generate it.
Reproduce code:
---------------
foreach ($form['taxonomy'] as $vid) {
if (substr($vid, 0, 1) != '#') {
unset($form['taxonomy'][$vid]);
}
}
Expected result:
----------------
I expected to be given an error message that I could find an
explanation for somewhere.
Actual result:
--------------
I found no explanation anywhere.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40583&edit=1