#5804: HABTM saveMulti issues warning when given empty selection
--------------------------------+-------------------------------------------
    Reporter:  benjam           |          Type:  Bug   
      Status:  new              |      Priority:  High  
   Milestone:  1.2.x.x          |     Component:  Model 
     Version:  RC3              |      Severity:  Normal
    Keywords:  habtm saveMulti  |   Php_version:  PHP 5 
Cake_version:  1.2.0.7692 RC3   |  
--------------------------------+-------------------------------------------
 This is nearly exactly the same bug as #3920, but it seems the function
 has changed slightly and lost the fix that was given in that bug.[[BR]]
 [[BR]]
 When I submit a form with a HABTM relationship, but the HABTM relationship
 value is empty, Cake throws the following error:[[BR]]
 {{{
 Warning (2): Invalid argument supplied for foreach()
 [ROOT\cake\cake\libs\model\model.php, line 1230]
 }}}
 [[BR]]
 It appears that the test for empty was removed somewhere between RC2 and
 RC3.[[BR]]
 [[BR]]
 A possible fix for the error is the following:[[BR]]
 On line 1213 of model.php, insert the following:[[BR]]
 {{{
                         if (empty($data)) {
                                 $data = array( );
                         }
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5804>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to