jmcameron / attachments

Attachments Extension for Joomla 3, 4, and 5
GNU General Public License v3.0
12 stars 19 forks source link

Error Joomla 4 #39

Closed bsylwek closed 4 months ago

bsylwek commented 4 months ago

Hallo

Joomla 4..4.2 The following error occurs. It seems that I did everything as I wrote. Everything installed correctly under Joomla 4. Despite this, there are the following errors when I go to components --> Attachements and after entering the button under the article editor.

                        <span class="badge bg-secondary">0</span>
                        Error decoding JSON data: Syntax error                        </blockquote>
                                                <div>

Call stack

| Function | Location

1 | () | JROOT/libraries/vendor/joomla/registry/src/Format/Json.php:71 2 | Joomla\Registry\Format\Json->stringToObject() | JROOT/libraries/vendor/joomla/registry/src/Registry.php:336 3 | Joomla\Registry\Registry->loadString() | JROOT/libraries/vendor/joomla/registry/src/Registry.php:67 4 | Joomla\Registry\Registry->__construct() | JROOT/libraries/src/Component/ComponentRecord.php:139 5 | Joomla\CMS\Component\ComponentRecord->getParams() | JROOT/libraries/src/Component/ComponentHelper.php:114 6 | Joomla\CMS\Component\ComponentHelper::getParams() | JROOT/administrator/components/com_attachments/src/Model/AttachmentsModel.php:277 7 | JMCameron\Component\Attachments\Administrator\Model\AttachmentsModel->populateState() | JROOT/libraries/src/MVC/Model/StateBehaviorTrait.php:59 8 | Joomla\CMS\MVC\Model\BaseModel->getState() | JROOT/libraries/src/MVC/Model/ListModel.php:334 9 | Joomla\CMS\MVC\Model\ListModel->getStoreId() | JROOT/libraries/src/MVC/Model/ListModel.php:262 10 | Joomla\CMS\MVC\Model\ListModel->getItems() | JROOT/administrator/components/com_attachments/src/Model/AttachmentsModel.php:290 11 | JMCameron\Component\Attachments\Administrator\Model\AttachmentsModel->getItems() | JROOT/libraries/src/MVC/View/AbstractView.php:152 12 | Joomla\CMS\MVC\View\AbstractView->get() | JROOT/administrator/components/com_attachments/src/View/Attachments/HtmlView.php:55 13 | JMCameron\Component\Attachments\Administrator\View\Attachments\HtmlView->display() | JROOT/libraries/src/MVC/Controller/BaseController.php:660 14 | Joomla\CMS\MVC\Controller\BaseController->display() | JROOT/administrator/components/com_attachments/src/Controller/DisplayController.php:46 15 | JMCameron\Component\Attachments\Administrator\Controller\DisplayController->display() | JROOT/libraries/src/MVC/Controller/BaseController.php:693 16 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143 17 | Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() | JROOT/libraries/src/Component/ComponentHelper.php:361 18 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT/libraries/src/Application/AdministratorApplication.php:143 19 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT/libraries/src/Application/AdministratorApplication.php:186 20 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT/libraries/src/Application/CMSApplication.php:293 21 | Joomla\CMS\Application\CMSApplication->execute() | JROOT/administrator/includes/app.php:61 22 | require_once() | JROOT/administrator/index.php:32

JLTRY commented 4 months ago

Hello it seems that you lost your parameters for the component com_attachments You need an entry in table joomxx_extensions in your database Here is an example (10047, 10039, 'com_attachments', 'component', 'com_attachments', '', '', 1, 1, 0, 0, '{\"name\":\"com_attachments\",\"type\":\"component\",\"creationDate\":\"March 26, 2018\",\"author\":\"Jonathan M. Cameron\",\"copyright\":\"(C) 2007-2018 Jonathan M. Cameron. All rights reserved.\",\"authorEmail\":\"jmcameron@jmcameron.net\",\"authorUrl\":\"http:\/\/joomlacode.org\/gf\/project\/attachments3\/\",\"version\":\"3.2.6\",\"description\":\"ATTACH_ATTACHMENTS_COMPONENT_DESCRIPTION\",\"group\":\"\",\"namespace\":\"JMCameron\\Component\\Attachments\",\"filename\":\"attachments\"}', '{\"publish_default\":\"1\",\"auto_publish_warning\":\"\",\"default_access_level\":\"3\",\"user_field_1_name\":\"\",\"user_field_2_name\":\"\",\"user_field_3_name\":\"\",\"max_filename_length\":0,\"attachments_placement\":\"custom\",\"allow_frontend_access_editing\":\"0\",\"show_column_titles\":\"0\",\"show_description\":\"1\",\"show_creator_name\":\"0\",\"show_file_size\":\"1\",\"show_downloads\":\"0\",\"show_created_date\":\"0\",\"show_modified_date\":\"0\",\"date_format\":\"Y-m-d H:i\",\"sort_order\":\"filename\",\"hide_on_frontpage\":\"0\",\"hide_with_readmore\":\"0\",\"hide_on_blogs\":\"0\",\"hide_except_article_views\":\"0\",\"always_show_category_attachments\":\"1\",\"show_guest_access_levels\":[\"1\"],\"hide_add_attachments_link\":\"0\",\"max_attachment_size\":0,\"forbidden_filename_characters\":\"#=?%&\",\"attachments_table_style\":\"attachmentsList\",\"file_link_open_mode\":\"in_same_window\",\"attachments_titles\":\"\",\"link_check_timeout\":\"10\",\"superimpose_url_link_icons\":\"1\",\"suppress_obsolete_attachments\":\"0\",\"login_url\":\"index.php?option=com_users&view=login\",\"register_url\":\"index.php?option=com_users&view=registration\",\"secure\":\"0\",\"download_mode\":\"inline\"}', NULL, NULL, 0, 0, NULL, 0),

bsylwek commented 4 months ago

phpmyadmin error #1136 - Column count doesn't match value count at row 1

INSERT INTO xx_extensions (extension_id, package_id, name, type, element, changelogurl, folder, client_id, enabled, access, protected, manifest_cache, params, custom_data, checked_out, checked_out_time, ordering, state, note, locked) VALUES (10047, 10039, 'com_attachments', 'component', 'com_attachments', '', '', 1, 1, 0, 0, '{"name":"com_attachments","type":"component","creationDate":"March 26, 2018","author":"Jonathan M. Cameron","copyright":"(C) 2007-2018 Jonathan M. Cameron. All rights reserved.","authorEmail":"jmcameron@jmcameron.net","authorUrl":"http:\/\/joomlacode.org\/gf\/project\/attachments3\/","version":"3.2.6","description":"ATTACH_ATTACHMENTS_COMPONENT_DESCRIPTION","group":"","namespace":"JMCameron\Component\Attachments","filename":"attachments"}', '{"publish_default":"1","auto_publish_warning":"","default_access_level":"3","user_field_1_name":"","user_field_2_name":"","user_field_3_name":"","max_filename_length":0,"attachments_placement":"custom","allow_frontend_access_editing":"0","show_column_titles":"0","show_description":"1","show_creator_name":"0","show_file_size":"1","show_downloads":"0","show_created_date":"0","show_modified_date":"0","date_format":"Y-m-d H:i","sort_order":"filename","hide_on_frontpage":"0","hide_with_readmore":"0","hide_on_blogs":"0","hide_except_article_views":"0","always_show_category_attachments":"1","show_guest_access_levels":["1"],"hide_add_attachments_link":"0","max_attachment_size":0,"forbidden_filename_characters":"#=?%&","attachments_table_style":"attachmentsList","file_link_open_mode":"in_same_window","attachments_titles":"","link_check_timeout":"10","superimpose_url_link_icons":"1","suppress_obsolete_attachments":"0","login_url":"index.php?option=com_users&view=login","register_url":"index.php?option=com_users&view=registration","secure":"0","download_mode":"inline"}', NULL, NULL, 0, 0, NULL, 0);

bsylwek commented 4 months ago

I checked phpmyadmin and for this component the entry looks like below

INSERT INTO xx_extensions (extension_id, package_id, name, type, element, changelogurl, folder, client_id, enabled, access, protected, manifest_cache, params, custom_data, checked_out, checked_out_time, ordering, state, note, locked) VALUES (10170, 0, 'com_attachments', 'component', 'com_attachments', '', '', 1, 1, 0, 0, '{\"name\":\"com_attachments\",\"type\":\"component\",\"creationDate\":\"January 1, 2024\",\"author\":\"Jonathan M. Cameron\",\"copyright\":\"(C) 2007-2024 Jonathan M. Cameron. All rights reserved.\",\"authorEmail\":\"jmcameron@jmcameron.net\",\"authorUrl\":\"http:\/\/joomlacode.org\/gf\/project\/attachments3\/\",\"version\":\"4.0.0\",\"description\":\"ATTACH_ATTACHMENTS_COMPONENT_DESCRIPTION\",\"group\":\"\",\"namespace\":\"JMCameron\\Component\\Attachments\",\"filename\":\"attachments\"}', '{\\"secure\\":\\"1\\"}', '', NULL, NULL, 0, 0, NULL, 0);

bsylwek commented 4 months ago

THANK YOU! Solved add to params components attachements via phpmyadmin this code For me, this field was empty and needed to be completed

{"publish_default":"1","auto_publish_warning":"","default_access_level":"1","user_field_1_name":"","user_field_2_name":"","user_field_3_name":"","max_filename_length":0,"attachments_placement":"end","allow_frontend_access_editing":"0","show_column_titles":"1","show_description":"1","show_creator_name":"1","show_file_size":"1","show_downloads":"1","show_created_date":"1","show_modified_date":"0","date_format":"Y-m-d H:i","sort_order":"filename","hide_on_frontpage":"0","hide_with_readmore":"0","hide_on_blogs":"0","hide_except_article_views":"0","always_show_category_attachments":"0","show_guest_access_levels":["1"],"hide_add_attachments_link":"0","max_attachment_size":0,"forbidden_filename_characters":"#=?%&","attachments_table_style":"attachmentsList","file_link_open_mode":"in_same_window","attachments_titles":"","link_check_timeout":"10","superimpose_url_link_icons":"1","suppress_obsolete_attachments":"0","login_url":"index.php?option=com_users&view=login","register_url":"index.php?option=com_users&view=registration","secure":"1","download_mode":"inline"}

JLTRY commented 4 months ago

fixed with a workarround. To check if reproductible