#5664: PHP Warning when cache file is expired or does not exist
-------------------------------+--------------------------------------------
    Reporter:  dgrekov         |         Owner:          
        Type:  Bug             |        Status:  reopened
    Priority:  Medium          |     Milestone:  1.2.x.x 
   Component:  Cache           |       Version:  RC3     
    Severity:  Normal          |    Resolution:          
    Keywords:                  |   Php_version:  PHP 5   
Cake_version:  1.2.0.7692 RC3  |  
-------------------------------+--------------------------------------------
Changes (by dgrekov):

  * status:  closed => reopened
  * resolution:  needmoreinfo =>

Comment:

 Here is the function that causes the issue.
 {{{
 /**
                         * This function returns all values from the passed
                         * field, limited by the where
                         * @param array $what is a list of tables to be
 searched and grouped
                         * @param array $where is a list of conditions to
 limit the search group
                         * @return array of part numbers
                         * @TODO Add special cases for attributes
                         */
                   function getGroup($what = array(), $where = array()){
                 $cache_key = md5(serialize($what).serialize($where));
                         $list = Cache::read($cache_key);
                         if (empty($list)) {
                                 $where = $this->cleanConditions($where);
                                 $where = $this->cleanConditions($where);
                                 $where = $this->cleanConditions($where);
                                 foreach($what as $field){
                                         $results =
 $this->find('all',array(
 'conditions'=>array($where),
 'group'=>array($field),
 'fields'=>array($field)
 ));
                                         foreach($results as $key =>
 $result){
 if(isset($result['ProductTest'])){
                                                         $table =
 'ProductTest';
                                                 }else{
                                                         $table='Product';
                                                 }
                                                 // clean the fields here
 to reduce the array size and reduce the number of regex calls
                                                 $list[] =
 preg_replace($this->clean,'',$result[$table][$field]);

                                                 unset($results[$key]);
                                         }
                                 }
                                 //remove duplicates
                                 $list = array_unique($list);

                                 // sort array
                                 sort($list,SORT_STRING);
                                 Cache::write($cache_key, $list,
 array('duration'=>'+1 day'));
                         }
                         return $list;
           }
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5664#comment:4>
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