Doc #40583 [Com]: No explanation of "Illegal offset type"

From: Date: Mon, 21 May 2012 19:14:14 +0000
Subject: Doc #40583 [Com]: No explanation of "Illegal offset type"
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8386@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=40583&edit=1 ID: 40583 Comment by: aholovsky at gmail dot com Reported by: darrenoh at sidepotsinternational dot com Summary: No explanation of "Illegal offset type" Status: Not a bug Type: Documentation Problem Package: Documentation problem Operating System: OS X PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Your code should be: Reproduce code: --------------- foreach ($form['taxonomy'] as $key -> $vid) { if (substr($vid, 0, 1) != '#') { unset($form['taxonomy'][$key]); } } Previous Comments: ------------------------------------------------------------------------ [2007-02-22 16:07:01] dmytton@php.net 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 ;) ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=40583 -- Edit this bug report at https://bugs.php.net/bug.php?id=40583&edit=1

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