haylau Posted November 1, 2019 Posted November 1, 2019 @Jonny Just upgraded to 1.1 stable from 1.08. And then upgraded Panda to the latest version. Now, when I go to Preferences > Themes > Advanced Settings (to change columns per page etc) I get the following error. Any ideas? ThirtyBeesException Property Meta->page length (69) must be between 0 and 64 in file classes/ObjectModel.php at line 1036 Source file: classes/ObjectModel.php 1017: * @throws PrestaShopException 1018: * 1019: * @since 1.0.0 1020: * @version 1.0.0 Initial version 1021: */ 1022: public function validateFields($die = true, $errorReturn = false) 1023: { 1024: foreach ($this->def['fields'] as $field => $data) { 1025: if (!empty($data['lang'])) { 1026: continue; 1027: } 1028: 1029: if (is_array($this->update_fields) && empty($this->update_fields[$field]) && isset($this->def['fields'][$field]['shop']) && $this->def['fields'][$field]['shop']) { 1030: continue; 1031: } 1032: 1033: $message = $this->validateField($field, $this->$field); 1034: if ($message !== true) { 1035: if ($die) { 1036: throw new PrestaShopException($message); 1037: } 1038: 1039: return $errorReturn ? $message : false; 1040: } 1041: } 1042: 1043: return true; 1044: } 1045: 1046: /** Stack trace 1. classes/ObjectModel.php:324 source ObjectModelCore->validateFields() 2. classes/ObjectModel.php:586 source ObjectModelCore->getFields() 3. controllers/admin/AdminThemesController.php:269 source ObjectModelCore->add() 4. classes/controller/AdminController.php:2461 source AdminThemesControllerCore->renderForm() 5. controllers/admin/AdminThemesController.php:1753 source AdminControllerCore->initContent() 6. classes/controller/Controller.php:208 source AdminThemesControllerCore->initContent() 7. classes/Dispatcher.php:837 source ControllerCore->run() 8. nimda/index.php:63 source DispatcherCore->dispatch() 1
0 datakick Posted November 2, 2019 Posted November 2, 2019 The problem is that there is some module with long controller name. Controller name is used to compose page key in form: module-<module_name>-<controller_name> for example module-paypal-plussubmit Thirtybees has limit 64 characters for these meta page entries. If (( module name lenth + controller name length + 8 ) > 64) then this error is thrown, because the resulting page key can't fit database column. This limit is obviously too small, we should increase it for the next version of tb. I've created github issue to increase this limit. Meanwhile, you can do this to fix the situation: Edit file classes/Meta.php and change size of the page property to 128: 'page' => ['type' => self::TYPE_STRING, 'validate' => 'isFileName', 'required' => true, 'size' => 64], to 'page' => ['type' => self::TYPE_STRING, 'validate' => 'isFileName', 'required' => true, 'size' => 128], You will also have to connect to your phpadmin and modify table schema (you might need to change table name tb_meta according to your database prefix): ALTER TABLE `tb_meta` MODIFY `page` varchar(128) NOT NULL; 2 1
0 Acer Posted December 2, 2019 Posted December 2, 2019 (edited) Bytw: in my case (also a Panda issue), I did not have to implement the MySQL update. Just thought I'd let you know. Just implemented the changes to Meta.php and problem went away. Thank you Edited December 2, 2019 by Theo
0 dynambee Posted December 2, 2019 Posted December 2, 2019 1 hour ago, Theo said: Bytw: in my case (also a Panda issue), I did not have to implement the MySQL update. Just thought I'd let you know. Just implemented the changes to Meta.php and problem went away. Thank you This is potentially a bad idea. You should check the data table in question because what you are probably going to find is truncated data. Depending on how MySQL is configured it will silently truncate strings that are too long. Trying to insert 500 characters into a VARCHAR(255)? It might just insert the first 255 characters and not give any error. This causes weird problems down the road when you try to retrieve that data and you only get part of what you expect to get.
0 Acer Posted December 2, 2019 Posted December 2, 2019 (edited) 1 hour ago, dynambee said: This is potentially a bad idea. You should check the data table in question Perhaps you're right. However, I couldn't find the entry in question ('page') using phpMyAdmin (it's not in tb_meta). So before I just added a new entry to the table, I refreshed - and all was good. Or so it seemed. So should I add an entry to tb_meta table for 'page' or is it in another table somewhere? (I'm on 30Bz 1.1.0) Edited December 2, 2019 by Theo
0 dynambee Posted December 2, 2019 Posted December 2, 2019 38 minutes ago, Theo said: Perhaps you're right. However, I couldn't find the entry in question ('page') using phpMyAdmin (it's not in tb_meta). So before I just added a new entry to the table, I refreshed - and all was good. Or so it seemed. So should I add an entry to tb_meta table for 'page' or is it in another table somewhere? It's not an entry in the table, it's the table column named `page`. If you run this command on an SQL server: SHOW CREATE TABLE tb_meta; You will see something very similar to this: CREATE TABLE `tb_meta` ( `id_meta` int(11) unsigned NOT NULL AUTO_INCREMENT, `page` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `configurable` tinyint(1) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id_meta`), UNIQUE KEY `page` (`page`) ) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci As you can see, the `page` column is there and is a varchar(64) which means it can hold up to 64 characters per entry. The command provided by @datakick changes that from a varchar(64) to a varchar(128) so that it can hold up to 128 characters per entry.
0 Tuan Pham Posted September 27, 2020 Posted September 27, 2020 I ran into a similar error when clicking on Preferences > Themes > Advanced Settings Property Meta->page is not valid in file classes/ObjectModel.php at line 1058 Source file: classes/ObjectModel.php 1039: * @throws PrestaShopException 1040: * 1041: * @since 1.0.0 1042: * @version 1.0.0 Initial version 1043: */ 1044: public function validateFields($die = true, $errorReturn = false) 1045: { 1046: foreach ($this->def['fields'] as $field => $data) { 1047: if (!empty($data['lang'])) { 1048: continue; 1049: } 1050: 1051: if (is_array($this->update_fields) && empty($this->update_fields[$field]) && isset($this->def['fields'][$field]['shop']) && $this->def['fields'][$field]['shop']) { 1052: continue; 1053: } 1054: 1055: $message = $this->validateField($field, $this->$field); 1056: if ($message !== true) { 1057: if ($die) { 1058: throw new PrestaShopException($message); 1059: } 1060: 1061: return $errorReturn ? $message : false; 1062: } 1063: } 1064: 1065: return true; 1066: } 1067: 1068: /** Current thirty bees version: 1.1.x PANDA theme version: v 1.5.5 Does anyone have any idea how to fix this?
0 Tuan Pham Posted September 27, 2020 Posted September 27, 2020 Please disregard my previous question. I found the cause of my issue. Here are more details in case they help anyone else. When I edited a file in PayPal module using Emacs, Emacs created a backup file with ~ at the end (e.g., incontextvalidate.php~). I believe TB sees this new file as a new page and adds it to table tb_meta. Later, when I click on Preferences > Themes > Advanced Settings, Panda loads the pages but TB fails on validating incontextvalidate.php~ as a valid file name (due to the ~ character). To fix this, I needed to remove the backup file and remove that corresponding record in table tb_meta.
Question
haylau
@Jonny
Just upgraded to 1.1 stable from 1.08. And then upgraded Panda to the latest version.
Now, when I go to Preferences > Themes > Advanced Settings (to change columns per page etc) I get the following error. Any ideas?
ThirtyBeesException Property Meta->page length (69) must be between 0 and 64 in file classes/ObjectModel.php at line 1036 Source file: classes/ObjectModel.php 1017: * @throws PrestaShopException 1018: * 1019: * @since 1.0.0 1020: * @version 1.0.0 Initial version 1021: */ 1022: public function validateFields($die = true, $errorReturn = false) 1023: { 1024: foreach ($this->def['fields'] as $field => $data) { 1025: if (!empty($data['lang'])) { 1026: continue; 1027: } 1028: 1029: if (is_array($this->update_fields) && empty($this->update_fields[$field]) && isset($this->def['fields'][$field]['shop']) && $this->def['fields'][$field]['shop']) { 1030: continue; 1031: } 1032: 1033: $message = $this->validateField($field, $this->$field); 1034: if ($message !== true) { 1035: if ($die) { 1036: throw new PrestaShopException($message); 1037: } 1038: 1039: return $errorReturn ? $message : false; 1040: } 1041: } 1042: 1043: return true; 1044: } 1045: 1046: /** Stack trace 1. classes/ObjectModel.php:324 source ObjectModelCore->validateFields() 2. classes/ObjectModel.php:586 source ObjectModelCore->getFields() 3. controllers/admin/AdminThemesController.php:269 source ObjectModelCore->add() 4. classes/controller/AdminController.php:2461 source AdminThemesControllerCore->renderForm() 5. controllers/admin/AdminThemesController.php:1753 source AdminControllerCore->initContent() 6. classes/controller/Controller.php:208 source AdminThemesControllerCore->initContent() 7. classes/Dispatcher.php:837 source ControllerCore->run() 8. nimda/index.php:63 source DispatcherCore->dispatch()
8 answers to this question
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