Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entry URL field not set when entry updated from entries table - fatal error thrown after when loading table #10

Open
cylkee opened this issue Jul 25, 2019 · 0 comments

Comments

@cylkee
Copy link

cylkee commented Jul 25, 2019

Hi,

An Entry URL field is not set when an entry is updated and saved from the entries table. A fatal error is then thrown when trying to load the table until the affected entries are saved individually.

Steps to reproduce:

  1. Install the extension
  2. Add Entry URL field to a section and fill the required settings
  3. Check 'Display in entries table'
  4. Visit the section's entries table
  5. Select and highlight one entry which has 'None' in the Entry URL field's column - important make a note of the entry's ID before next step
  6. Click 'With Selected...' select box at the bottom of the list
  7. Set something (in my case I set an existing checkbox to Yes or No, doesn't matter which)
  8. The fatal error below is thrown any time you try to load the entries table unless you save the affected entry manually
  9. With the ID you noted earlier, use the browser address bar to manually navigate to entry (e.g. append edit/123/ to the URL), OR, use the browser back button from the error page which should show a cached version of the entries list, you can also click on the highlighted entry you just changed to take you to the same entry
  10. Note that the field that you changed with step 7 has been changed as expected, however the Entry URL field has not been set and is empty (assuming you picked an entry which was originally 'None', as step 5)
  11. Click Save Changes, the Entry URL field is set as per your expression.
  12. Load the entries table and it will display without an error.

This also happens if, in step 5, you select more than one entry marked 'None' in the Entry URL field's column.

If you choose to update an entry from the table which does have a link in the Entry URL field's column, a visual error is not thrown but it will not update the link if the expression was different from the expression from which it was first created. Try changing the expression, following steps 4 thru 7 and observe that the resulting URL does not match your expression. Steps 9 thru 11 will change it as expected.

Symphony Fatal Error: Argument `$value` is not of type `string`, given `NULL`.

An error occurred in /path-redacted/symphony/lib/toolkit/class.general.php around line 1706
    1701 throw new InvalidArgumentException(__('Enforced type `%1$s` for argument `$%2$s` does not match any known variable types.', array($param['type'], $name)));
    1702 }
    1703
    1704 // validate variable type
    1705 if (!call_user_func($validator, $param['var'])) {
    1706 throw new InvalidArgumentException(__('Argument `$%1$s` is not of type `%2$s`, given `%3$s`.', array($name, $param['type'], gettype($param['var']))));
    1707 }
    1708 }
    1709 }
    1710 

Backtrace

    [/path-redacted/symphony/lib/toolkit/class.widget.php:238]
        General::ensureType();
    [/path-redacted/extensions/entry_url_field/fields/field.entry_url.php:158]
        Widget::Anchor();
    [/path-redacted/symphony/content/content.publish.php:614]
        FieldEntry_URL->prepareTableValue();
    [/path-redacted/symphony/content/content.publish.php:356]
        contentPublish->__viewIndex();
    [/path-redacted/symphony/content/content.publish.php:361]
        contentPublish->__switchboard();
    [/path-redacted/symphony/lib/toolkit/class.administrationpage.php:496]
        contentPublish->view();
    [/path-redacted/symphony/content/content.publish.php:327]
        AdministrationPage->build();
    [/path-redacted/symphony/lib/core/class.administration.php:205]
        contentPublish->build();
    [/path-redacted/symphony/lib/core/class.administration.php:483]
        Administration->__buildPage();
    [/path-redacted/symphony/lib/boot/func.utilities.php:253]
        Administration->display();
    [/path-redacted/symphony/lib/boot/func.utilities.php:235]
        symphony_launcher();
    [/path-redacted/index.php:19]
        symphony();

Database Query Log

    [0.0001] SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';
    [0.0000] SET CHARACTER SET 'utf8';
    [0.0001] SET time_zone = '+01:00';
    [0.0004] SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled' ORDER BY t2.delegate, t1.name;
    [0.0002] SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = 'session-token-redacted' LIMIT 1;
    [0.0002] SELECT SQL_CACHE a.* FROM `sym_authors` AS `a` WHERE `username` = 'username-redacted' ORDER BY a.id ASC LIMIT 1;
    [0.0001] UPDATE sym_authors SET `last_seen` = '2019-07-25 11:02:21' WHERE `id` = 1;
    [0.0001] SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled';
    [0.0001] SELECT SQL_CACHE * FROM `sym_extensions`;
    [0.0001] SELECT SQL_CACHE `id` FROM `sym_sections` WHERE `handle` = 'posts' LIMIT 1;
    [0.0002] SELECT SQL_CACHE * FROM `sym_sections_association` AS `sa`, `sym_sections` AS `s` WHERE `sa`.`child_section_id` = 11 AND `s`.`id` = `sa`.`parent_section_id` ORDER BY `s`.`sortorder` ASC;
    [0.0003] SELECT SQL_CACHE * FROM `sym_sections_association` AS `sa`, `sym_sections` AS `s` WHERE `sa`.`parent_section_id` = 11 AND `s`.`id` = `sa`.`child_section_id` ORDER BY `s`.`sortorder` ASC;
    [0.0002] SELECT SQL_CACHE `s`.* FROM `sym_sections` AS `s` ORDER BY `s`.`sortorder` asc;
    [0.0001] SELECT SQL_CACHE `id` FROM `sym_sections` WHERE `handle` = 'posts' LIMIT 1;
    [0.0001] SELECT SQL_CACHE `id` FROM `sym_sections` WHERE `handle` = 'posts' LIMIT 1;
    [0.0001] SELECT SQL_CACHE `id` FROM `sym_sections` WHERE `handle` = 'posts' LIMIT 1;
    [0.0003] SELECT SQL_CACHE COUNT(`e`.id) as `count` FROM `sym_entries` AS `e` WHERE `e`.`section_id` = 11;
    [0.0003] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND t1.`parent_section` = '11' ORDER BY t1.`sortorder` ASC;
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_input` WHERE `field_id` IN (51);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_entry_url` WHERE `field_id` IN (113);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_date` WHERE `field_id` IN (52);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_textarea` WHERE `field_id` IN (53,54);
    [0.0001] SELECT SQL_CACHE * FROM `sym_fields_selectbox_link` WHERE `field_id` IN (59);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_checkbox` WHERE `field_id` IN (74,55);
    [0.0002] SELECT SQL_CACHE CASE hide_association WHEN "no" THEN "yes" ELSE "no" END as show_association FROM `sym_sections_association` WHERE `child_section_field_id` = 59;
    [0.0003] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND t1.`parent_section` = '11' AND t1.show_column = 'yes' ORDER BY t1.`sortorder` ASC;
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_input` WHERE `field_id` IN (51);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_entry_url` WHERE `field_id` IN (113);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_date` WHERE `field_id` IN (52);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_textarea` WHERE `field_id` IN (53);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_selectbox_link` WHERE `field_id` IN (59);
    [0.0002] SELECT SQL_CACHE * FROM `sym_fields_checkbox` WHERE `field_id` IN (74,55);
    [0.0005] SELECT SQL_CACHE DISTINCT `e`.`id`, `e`.section_id, `e`.`author_id`, `e`.`modification_author_id`, `e`.`creation_date` AS `creation_date`, `e`.`modification_date` AS `modification_date` FROM `sym_entries` AS `e` WHERE 1 AND `e`.`section_id` = 11 ORDER BY ( SELECT `ed`.date FROM sym_entries_data_52 AS `ed` WHERE entry_id = e.id ) DESC, `e`.`id` DESC LIMIT 0, 20;
    [0.0009] SELECT SQL_CACHE `id` FROM `sym_fields` WHERE 1 AND `parent_section` = 11 AND `element_name` IN ('title', 'post-link', 'date', 'content', 'categories', 'feature', 'publish') ORDER BY `sortorder` ASC;
    [0.0003] SELECT SQL_CACHE * FROM `sym_entries_data_51` WHERE `entry_id` IN (846,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975) ORDER BY `id` ASC;
    [0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_113` WHERE `entry_id` IN (846,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975) ORDER BY `id` ASC;
    [0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_52` WHERE `entry_id` IN (846,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975) ORDER BY `id` ASC;
    [0.0011] SELECT SQL_CACHE * FROM `sym_entries_data_53` WHERE `entry_id` IN (846,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975) ORDER BY `id` ASC;
    [0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_59` WHERE `entry_id` IN (846,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975) ORDER BY `id` ASC;
    [0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_74` WHERE `entry_id` IN (846,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975) ORDER BY `id` ASC;
    [0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_55` WHERE `entry_id` IN (846,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975) ORDER BY `id` ASC;
    [0.0002] SELECT SQL_CACHE COUNT(DISTINCT `e`.id) as `count` FROM `sym_entries` AS `e` WHERE `e`.`section_id` = 11;
    [0.0006] SHOW COLUMNS FROM `sym_entries_data_56` WHERE `Field` in ('value');;
    [0.0003] SELECT SQL_CACHE * FROM `sym_sections_association` AS `sa`, `sym_sections` AS `s` WHERE `sa`.`parent_section_id` = 11 AND `s`.`id` = `sa`.`child_section_id` AND `sa`.`hide_association` = 'no' ORDER BY `s`.`sortorder` ASC;
    [0.0002] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND id IN (56) ORDER BY t1.`sortorder` ASC;
    [0.0001] SELECT SQL_CACHE * FROM `sym_fields_input` WHERE `field_id` IN (56);
    [0.0001] SELECT SQL_CACHE e.id, e.section_id, s.name, s.handle FROM `sym_entries` AS `e` LEFT JOIN `sym_sections` AS `s` ON (s.id = e.section_id) WHERE e.id IN (849);
    [0.0002] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND t1.`parent_section` = '12' AND t1.show_column = 'yes' ORDER BY t1.`sortorder` ASC;
    [0.0001] SELECT SQL_CACHE * FROM `sym_fields_input` WHERE `field_id` IN (56);
    [0.0001] SELECT SQL_CACHE * FROM `sym_fields_textarea` WHERE `field_id` IN (57);
    [0.0002] SELECT SQL_CACHE `e`.`id`, `e`.section_id, `e`.`author_id`, `e`.`modification_author_id`, `e`.`creation_date` AS `creation_date`, `e`.`modification_date` AS `modification_date` FROM `sym_entries` AS `e` WHERE 1 AND `e`.`id` IN ('849') AND `e`.`section_id` = 12 ORDER BY ( SELECT `ed`.value FROM sym_entries_data_56 AS `ed` WHERE entry_id = e.id ) ASC, `e`.`id` ASC;
    [0.0002] SELECT SQL_CACHE `id` FROM `sym_fields` WHERE 1 AND `parent_section` = 12 AND `element_name` IN ('name') ORDER BY `sortorder` ASC;
    [0.0001] SELECT SQL_CACHE * FROM `sym_entries_data_56` WHERE `entry_id` IN (849) ORDER BY `id` ASC;
    [0.0001] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND t1.`id` IN(67);
    [0.0001] SELECT SQL_CACHE * FROM `sym_fields_selectbox_link` WHERE `field_id` IN (67);
    [0.0001] SELECT SQL_CACHE CASE hide_association WHEN "no" THEN "yes" ELSE "no" END as show_association FROM `sym_sections_association` WHERE `child_section_field_id` = 67;
    [0.0003] SELECT SQL_CACHE COUNT(*) as `count` FROM `sym_entries_data_67` WHERE `relation_id` = 846;
    [0.0001] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND t1.`id` IN(73);
    [0.0001] SELECT SQL_CACHE * FROM `sym_fields_selectbox_link` WHERE `field_id` IN (73);
    [0.0001] SELECT SQL_CACHE CASE hide_association WHEN "no" THEN "yes" ELSE "no" END as show_association FROM `sym_sections_association` WHERE `child_section_field_id` = 73;
    [0.0003] SELECT SQL_CACHE COUNT(*) as `count` FROM `sym_entries_data_73` WHERE `relation_id` = 846;
    [0.0002] SELECT SQL_CACHE e.id, e.section_id, s.name, s.handle FROM `sym_entries` AS `e` LEFT JOIN `sym_sections` AS `s` ON (s.id = e.section_id) WHERE e.id IN (847);
    [0.0002] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND t1.`parent_section` = '12' AND t1.show_column = 'yes' ORDER BY t1.`sortorder` ASC;
    [0.0001] SELECT SQL_CACHE * FROM `sym_fields_input` WHERE `field_id` IN (56);
    [0.0001] SELECT SQL_CACHE * FROM `sym_fields_textarea` WHERE `field_id` IN (57);
    [0.0002] SELECT SQL_CACHE `e`.`id`, `e`.section_id, `e`.`author_id`, `e`.`modification_author_id`, `e`.`creation_date` AS `creation_date`, `e`.`modification_date` AS `modification_date` FROM `sym_entries` AS `e` WHERE 1 AND `e`.`id` IN ('847') AND `e`.`section_id` = 12 ORDER BY ( SELECT `ed`.value FROM sym_entries_data_56 AS `ed` WHERE entry_id = e.id ) ASC, `e`.`id` ASC;
    [0.0002] SELECT SQL_CACHE `id` FROM `sym_fields` WHERE 1 AND `parent_section` = 12 AND `element_name` IN ('name') ORDER BY `sortorder` ASC;
    [0.0001] SELECT SQL_CACHE * FROM `sym_entries_data_56` WHERE `entry_id` IN (847) ORDER BY `id` ASC;
    [0.0001] SELECT SQL_CACHE COUNT(*) as `count` FROM `sym_entries_data_67` WHERE `relation_id` = 957;
    [0.0001] SELECT SQL_CACHE COUNT(*) as `count` FROM `sym_entries_data_73` WHERE `relation_id` = 957;
    [0.0001] SELECT SQL_CACHE COUNT(*) as `count` FROM `sym_entries_data_67` WHERE `relation_id` = 958;
    [0.0001] SELECT SQL_CACHE COUNT(*) as `count` FROM `sym_entries_data_73` WHERE `relation_id` = 958; 

CentOS Linux 7.6.1810
Symphony 2.7.10
PHP 7.1.30
Time to test and create issue 2 hours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant