User tests: Successful: Unsuccessful:
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.
Labels |
Added:
?
|
Category | ⇒ | Libraries SQL |
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;
upps sorry i don't see that this is a pull request....
As there is a bool cast in line 68 should there be an int cast for the port?
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.
Milestone |
Added: |
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-08 17:44:30 |
Closed_By | ⇒ | roland-d |
Merged on review
@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.