doubleD Posted January 19, 2013 Share Posted January 19, 2013 (edited) Hi, I've upgraded from 1.5.2 to 1.5.3.1 and one of my modules gives me an error like Warning: preg_match() expects parameter 2 to be string, array given in Validate.php on line 383 Fatal error: Uncaught exception 'PrestaShopException' with message 'Property [CLASSNAME]->title is not valid' in ObjectModel.php:837 Stack trace: #0 [(44): ObjectModelCore->validateFields() #1 ObjectModel.php(598): [CLASSNAME]->getFields() #2 [CLASSNAME](84): ObjectModelCore->update() #3 [CLASSNAME](483): [CLASSNAME]->update() #4 [ADMINFOLDER]/functions.php(528): [CLASSNAME]->postProcess() #5 /classes/Dispatcher.php(328): runAdminTab('[CLASSNAME]...', false) #6 [ADMINFOLDER]/index.php(51): DispatcherCore->dispatch() #7 {main} thrown in classes/ObjectModel.php on line 837 Found out that the "problem" is due to one part of the ObjectModel.php class which is '// Retrocompatibility with $fieldsValidate,....': Prestashop 1.5.2 else { $this->def['fields'] = array(); $suffix = (isset($data['lang']) && $data['lang']) ? 'Lang' : ''; foreach ($this->{'fieldsValidate'.$suffix} as $field => $validate) $this->def['fields'][$field]['validate'] = $validate; foreach ($this->{'fieldsRequired'.$suffix} as $field) $this->def['fields'][$field]['required'] = true; foreach ($this->{'fieldsSize'.$suffix} as $field => $size) $this->def['fields'][$field]['size'] = $size; } And Prestashop 1.5.3.1 else { $this->def['fields'] = array(); $suffixs = array('', 'Lang'); foreach($suffixs as $suffix) { foreach ($this->{'fieldsValidate'.$suffix} as $field => $validate) $this->def['fields'][$field]['validate'] = $validate; foreach ($this->{'fieldsRequired'.$suffix} as $field) $this->def['fields'][$field]['required'] = true; foreach ($this->{'fieldsSize'.$suffix} as $field => $size) $this->def['fields'][$field]['size'] = $size; } } If i remove Lang from $suffixs = array('', 'Lang'); so it looks like $suffixs = array('', ''); the error is gone and everything works fine. I'd like to understand where my mistake is... Maybe the 'Lang' validation changed in 1.5.3.1? Thank's Edited January 21, 2013 by doubleD (see edit history) 2 Link to comment Share on other sites More sharing options...
Aixestudio Posted May 2, 2013 Share Posted May 2, 2013 Thank you !!!!! Link to comment Share on other sites More sharing options...
eStorePower Posted May 18, 2013 Share Posted May 18, 2013 (edited) I'm also having a problem to both of my 2 different stores. All of a sudden the error occurred. Fatal error: Class 'Cache' not found in classes/ObjectModel.php on line 1470 - (Prestashop 1.5.4.1) Fatal error: Class 'Cache' not found in classes/ObjectModel.php on line 195 - (Prestashop 1.5.3.1) My BO and FO are empty. Any help please.. Thanks. Edited May 18, 2013 by eStorePower (see edit history) Link to comment Share on other sites More sharing options...
vilto35 Posted August 1, 2013 Share Posted August 1, 2013 i'm in 1.5.4 and on the line 1470 there is : if ($field !== null || !Cache::isStored($cache_id)) { $reflection = new ReflectionClass($class); $definition = $reflection->getStaticPropertyValue('definition'); $definition['classname'] = $class; if (!empty($definition['multilang'])) $definition['associations'][Collection::LANG_ALIAS] = array( 'type' => self::HAS_MANY, 'field' => $definition['primary'], 'foreign_field' => $definition['primary'], ); if ($field) return isset($definition['fields'][$field]) ? $definition['fields'][$field] : null; Cache::store($cache_id, $definition); return $definition; } Any solution ? Link to comment Share on other sites More sharing options...
sahwira Posted October 6, 2013 Share Posted October 6, 2013 I notice this post is marked "SOLVED" but I don't see the solution to this problem of "Fatal error: Class 'Cache' not found in /home/content....html/classes/ObjectModel.php on line 1470" I have the same problem - what was the solution? Link to comment Share on other sites More sharing options...
sahwira Posted October 6, 2013 Share Posted October 6, 2013 I notice this post is marked "SOLVED" but I don't see the solution to this problem of "Fatal error: Class 'Cache' not found in /home/content....html/classes/ObjectModel.php on line 1470" The line 1470 is below: if ($field !== null || !Cache::isStored($cache_id)) What is the solution to this problem? Link to comment Share on other sites More sharing options...
predacom Posted November 5, 2013 Share Posted November 5, 2013 Thanks a lot doubleD works fine in 1.5.4.0 Link to comment Share on other sites More sharing options...
seddik.dimassi Posted February 15, 2014 Share Posted February 15, 2014 To solve this problem i have to delete everytime the class_index.php file located into the /cache folder. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now