I think I may have found a bug in core.  It's in cake/libs/view/
helper.php in the function __selectArray().  Here is my patch:

diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php
index b8bc471..6d00740 100644
--- a/cake/libs/view/helper.php
+++ b/cake/libs/view/helper.php
@@ -859,7 +859,7 @@ class Helper extends Overloadable {
                }
                $array = array();
                if (!empty($data)) {
-                       foreach ($data as $var) {
+                       foreach (array_keys($data) as $var) {
                                $array[$var[$key]] = $var[$key];
                        }
                }

$data = array(
  'id' => '123',
  'name' => 'foobar',
  'description' => '',
);
Then the foreach loop assigns "123", "foobar" and "" to $var instead
of "id", "name" and "description".  This cannot possibly be what was
intended.

I am a bit puzzled by how I (or anyone else) did not notice this
sooner.  My "excuse" is that on my site it only became apparent on a
page that I do not visit often and that I previously thought was
working properly.

I am also surprised to see that this is not fixed in the latest
release 1.3.12.  Surely someone else has stubbed his toe on this!

I will cross post this to http://cakephp.lighthouseapp.com with a new
ticket.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to