|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-12-26 08:07 UTC] schmad at miller-group dot net
Description: ------------ Using array functions on a string like count() or unset() results in fatal offset errors which were not encountered in 4.3.x code. Reproduce code: --------------- $link = 'bla'; unset($link['one']); //In 4.x: No Error $link = ''; count($link['two']); //In 4.x: No Error Expected result: ---------------- $link = 'bla'; unset($link['one']); //In 4.x: No Error $link = ''; count($link['two']); //In 4.x: No Error Actual result: -------------- $link = 'bla'; unset($link['one']); //Outputs: Fatal error: Cannot unset string offsets in ... $link = ''; count($link['two']); //Outputs: Fatal error: Cannot use string offset as an array in ... PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
This behavior isn't limited to [] either, {} is affected the same way. But anyway, using unset() on strings like this has no use whatsoever. An example has now been added to migration5.xml so this bug is closed.