? Success

User tests: Successful: Unsuccessful:

avatar meddy
meddy
12 Jan 2015

I ran into an issue where I was attempting to create a database connection with JDatabaseDriver. I was providing the correct configuration through the options array passed to the constructor of JDatabaseDriverMysqli. Unfortunately, the port configuration is immediately disregarded in the constructor code, as it sets the value to null instead of checking if it was provided.

I was able to get around this by passing the port along with the host, but it's unexpected to not be able to do it by providing a port value in the options array. On line 105 in the connect method it checks if the port was set, otherwise it defaults to 3306. This line is basically pointless, since the value will always be null, this leads me to believe that automatically setting the port option to null was not intended.

avatar meddy meddy - open - 12 Jan 2015
avatar jissues-bot jissues-bot - change - 12 Jan 2015
Labels Added: ?
avatar brianteeman brianteeman - change - 12 Jan 2015
Category Libraries SQL
avatar zero-24
zero-24 - comment - 12 Jan 2015

@meddy can you provide a fix as pull request against staging?

if you don't know how git / github work please have a look into:
https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests


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

avatar mbabker
mbabker - comment - 12 Jan 2015

@zero-24 This is a pull request :wink:

avatar zero-24
zero-24 - comment - 12 Jan 2015

Maybe here:

https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/database/driver/mysqli.php#L69

something like

$options['port'] = (isset($options['port'])) ? $options['port'] : null;

maybe the same for line 70
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/database/driver/mysqli.php#L70

$options['socket'] = (isset($options['socket'])) ? $options['socket'] : null;


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

avatar zero-24
zero-24 - comment - 12 Jan 2015

upps sorry i don't see that this is a pull request....

avatar waader
waader - comment - 14 Jan 2015

As there is a bool cast in line 68 should there be an int cast for the port?

avatar zero-24
zero-24 - comment - 14 Jan 2015

I agree with @waader

$options['port'] = (isset($options['port'])) ? (int) $options['port'] : null;

avatar meddy
meddy - comment - 14 Jan 2015

Isn't one of PHP main selling point's is its dynamic typing? I don't see why it's necessary, but I will add it.

avatar roland-d roland-d - change - 8 May 2016
Milestone Added:
avatar roland-d roland-d - change - 8 May 2016
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-05-08 17:44:30
Closed_By roland-d
avatar roland-d roland-d - close - 8 May 2016
avatar roland-d roland-d - merge - 8 May 2016
avatar roland-d roland-d - reference | 5f927dc - 8 May 16
avatar roland-d roland-d - merge - 8 May 2016
avatar roland-d roland-d - close - 8 May 2016
avatar roland-d
roland-d - comment - 8 May 2016

Merged on review

Add a Comment

Login with GitHub to post a comment