Skip to content

Conversation

@Kurantje
Copy link
Contributor

Query requires back-quoted table name to acommodate for table names with special characters.

Pull Request for Issue #39487

Summary of Changes

On line 734 it states: ->from($this->_tbl);
This should be: ->from($this->_db->quoteName($this->_tbl));

Testing Instructions

Create a component using a table with a special character, e.g. da-events
Go to ...?option=&view=event&layout=edit&id=1 to get the first element from the table

Actual result BEFORE applying this Pull Request

Invalid mySQL query exception

Expected result AFTER applying this Pull Request

In edit.php get the data from the da-events table for id=1

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Query requires back-quoted table name to acommodate for table names with special characters.
@ReLater
Copy link
Contributor

ReLater commented Dec 24, 2022

I have tested this item 🔴 unsuccessfully on 158adff

See my comment below


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39489.

@ReLater
Copy link
Contributor

ReLater commented Dec 24, 2022

There are some more code places that must be fixed via quoteName().

At least methods checkOut(), checkIn(). but I didn't test any further. Just opened and closed an item in my test component where I renamed the main table from ghsthing to ghsvs-thing and added protected $_tbl = '#__ghsvs-thing'; in my table class (extends Table). I got errors like example:

1064 You have an error in your SQL syntax; 
check the manual that corresponds to your MariaDB server version 
for the right syntax to use near '-thing SET `checked_out` = 340 ,
 `checked_out_time` = '2022-12-24 19:22:39' ...' at line 1

I didn't save or update and so on then.

The first fix of this pr ( load() ) works, but ... see above.

@ReLater
Copy link
Contributor

ReLater commented Dec 24, 2022

@Kurantje
I have provided a pr in your branch that you can merge into your branch and into this pr at the same time if you like to.
See https://github.com/Kurantje/joomla-cms/pull/1

quoteName in methods checkIn(), checkOut()
Legal table names with special characters throw exceptions. QuoteName each query avoids fixes this
@Kurantje
Copy link
Contributor Author

@ReLater, Thanks for highlighting. Submitted Table.php again, now with all sql table references with QuoteName

@Kurantje Kurantje closed this Dec 26, 2022
@ReLater
Copy link
Contributor

ReLater commented Dec 26, 2022

@Kurantje
Why did you close your PR?

@Kurantje
Copy link
Contributor Author

Oops! Didn't mean to. Will reopen. Thanks!

@Kurantje Kurantje reopened this Dec 26, 2022
@ReLater
Copy link
Contributor

ReLater commented Dec 27, 2022

I have tested this item ✅ successfully on 4e50a2d

@joomdonation
Copy link
Contributor

I have tested this item ✅ successfully on 4e50a2d

Code review + tried to view, delete, publish, unpublish.... records and all still works.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39489.

@joomdonation
Copy link
Contributor

RTC. Thanks !


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39489.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Dec 29, 2022
@joomdonation joomdonation added this to the Joomla! 4.2.7 milestone Dec 29, 2022
@roland-d roland-d merged commit ccaf94b into joomla:4.2-dev Dec 29, 2022
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Dec 29, 2022
@roland-d
Copy link
Contributor

Thank you

@Kurantje Kurantje deleted the patch-1 branch December 29, 2022 11:18
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

Successfully merging this pull request may close these issues.

6 participants