? Success
Pull Request for # 6232

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
28 Feb 2015

This small change is a fix for #6232

There might be other ways, but looking at the other drivers it looks like no other driver does this, but no other calls to processLimit that I can find, but PR certainly works for PDO when using Mysql (Not tested with any other PDO backend other than mysql)

avatar PhilETaylor PhilETaylor - open - 28 Feb 2015
avatar joomla-cms-bot joomla-cms-bot - change - 28 Feb 2015
Labels Added: ?
avatar brianteeman brianteeman - change - 28 Feb 2015
Rel_Number 6232
Relation Type Pull Request for
avatar brianteeman brianteeman - change - 28 Feb 2015
Category SQL
avatar PhilETaylor
PhilETaylor - comment - 1 Mar 2015

Looks like this breaks the UnitTesting - I cant run the unit tests on my mac at the moment due to environment issues - I need to reinstall OSX soon :)

The PR fixes the issue, but breaks the unit tests :( Need someone to follow this up with fixed tests please :)

avatar PhilETaylor
PhilETaylor - comment - 1 Mar 2015

Dont waste your time testing this yet - its crap code and breaks :)

avatar PhilETaylor
PhilETaylor - comment - 1 Mar 2015

Ok I have reworked on this with several test cases

The test Gist at https://gist.github.com/PhilETaylor/bdf4c5a29b6097098922 now gives 5's all the way

Joomla is now not complaining about the LIMIT 0, 5 being added twice when using the PDO driver

Just waiting to see if travis is happy. All unit tests run locally ok though

avatar PhilETaylor
PhilETaylor - comment - 1 Mar 2015

Excellent - Travis is now happy and all tests pass, even my own tests - woot woot :)

To test this you can run the Gist above, write your own custom code that limits a select query with the mysql pdo driver api, and also login to Joomla admin and make sure the first screen all loads fine (as that has several limited select queries running in the modules. Ensure your configuration.php uses the pdomysql driver in public $dbtype = 'pdomysql';

Paging (oh the pun!) @mbabker as I know you looked at the original issue reported.

avatar mbabker
mbabker - comment - 1 Mar 2015

Pre-patch I have 5/5/133/5

Post-patch I have 5/5/5/5

avatar mbabker mbabker - test_item - 1 Mar 2015 - Tested successfully
avatar waader
waader - comment - 13 Mar 2015

@test I have the exact same results as mbabker.

avatar waader waader - test_item - 13 Mar 2015 - Tested successfully
avatar brianteeman
brianteeman - comment - 14 Mar 2015

Setting to RTC thanks for testing


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6234.
avatar brianteeman brianteeman - change - 14 Mar 2015
Status Pending Ready to Commit
avatar brianteeman brianteeman - change - 14 Mar 2015
Labels Added: ?
avatar phproberto
phproberto - comment - 15 Mar 2015

@PhilETaylor removing the $driverOptions parameter from the function technically breaks backwards compatibility so this cannot be merged. Is that something needed for this fix?

avatar phproberto phproberto - change - 15 Mar 2015
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 15 Mar 2015
Labels Added: ?
avatar phproberto
phproberto - comment - 15 Mar 2015

Issues re-adds the RTC automatically and apparently I cannot edit items in the tracker but please do not merge this without checking the B/C issue

avatar brianteeman brianteeman - change - 15 Mar 2015
Labels Removed: ?
avatar brianteeman brianteeman - change - 15 Mar 2015
Status Ready to Commit Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Mar 2015
Labels Added: ?
avatar brianteeman brianteeman - change - 15 Mar 2015
Labels Removed: ?
avatar brianteeman
brianteeman - comment - 15 Mar 2015

RTC removed


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6234.
avatar PhilETaylor
PhilETaylor - comment - 15 Mar 2015

Removing the $driverOptions parameter is not required for the original issue to be fixed, but there is an additional issue that when you instantiate JDatabaseDriverPdo class you pass in the driverOptions as part of the $options array, and then in setQuery you are basically ignoring those options you set in the construct!

So, if you want just to fix the original issue then we can reinstate the driveroptions on the setQuery call - if you want to be proper about it then the code should stand as per the PR as this is the correct way. Or third, then we should be using the driverOptions from the options array used in the construct.

Also note that PDO is the ONLY driver that allows the driverOptions to be set at the setQuery method - thus is probably wrong and probably not used by anyone at all as to be compatible with other drivers the options are set at the getInstance level and not at the setQuery level

Therefore I conclude that, as is, this PR breaks nothing, but enhances the PDO Driver to use driver options provided in the correct manner - at instantiation of the class.

avatar PhilETaylor
PhilETaylor - comment - 15 Mar 2015

I have now reinstated the driverOptions as it was as its not related to this bug, but will fork a new issue to tidy this up as we should be using the instances options as a default.

Ready for testing if you like - however only reinstated what was there before so no real testing needed before RTC

avatar PhilETaylor
PhilETaylor - comment - 23 Mar 2015

FYI This never made it into Joomla 3.4.1

avatar zero-24 zero-24 - change - 11 Jun 2015
Status Pending Ready to Commit
avatar zero-24 zero-24 - change - 11 Jun 2015
Labels Added: ?
avatar Kubik-Rubik
Kubik-Rubik - comment - 7 Jul 2015

Thank you @PhilETaylor! Merged.

avatar Kubik-Rubik Kubik-Rubik - change - 7 Jul 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-07-07 23:19:26
Closed_By Kubik-Rubik
avatar Kubik-Rubik Kubik-Rubik - close - 7 Jul 2015
avatar zero-24 zero-24 - close - 7 Jul 2015
avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment