#5641: Error with enum fields with values that contain ()'s
------------------------+---------------------------------------------------
    Reporter:  jdsmith  |          Type:  Bug    
      Status:  new      |      Priority:  Medium 
   Milestone:  1.2.x.x  |     Component:  General
     Version:  RC3      |      Severity:  Normal 
    Keywords:           |   Php_version:  n/a    
Cake_version:           |  
------------------------+---------------------------------------------------
 I have some enum fields that contain parenthesis, which causes the column
 method in /cake/libs/model/datasources/dbo/dbo_mysql.php to fail. It will
 only return the enum values up until it hits the first '('.

 This is due to the method of retrieving the values using explode on a '('
 character.

 This is the current code that was failing.

 {{{
 $col = str_replace(')', '', $real);
 $limit = $this->length($real);
 if (strpos($col, '(') !== false) {
   $list($col, $vals) = explode('(', $col);
 }
 }}}

 I replaced it with the following and it is working for me, though I
 haven't tested it for all data types yet.


 {{{
 $limit = $this->length($real);
 $col = $real;
 if(substr($real,strlen($real)-1) == ')') {
   if(strpos($col,'(') !== false) {
     $col  = substr($real,0,strpos($col,'(')+1);
     $vals = substr($real, strpos($real,'('),
 strlen($real)-strpos($real,'(') );
   }
 }
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5641>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to