[wp-trac] [WordPress Trac] #54877: Occasional PHP exception being thrown on WPDB/MySQLi connections

WordPress Trac noreply at wordpress.org
Sun Apr 10 01:35:37 UTC 2022


#54877: Occasional PHP exception being thrown on WPDB/MySQLi connections
-------------------------------------------------+-------------------------
 Reporter:  johnjamesjacoby                      |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.0
Component:  Database                             |     Version:  1.5
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-  |     Focuses:
  tests 2nd-opinion                              |
-------------------------------------------------+-------------------------

Comment (by peterwilsoncc):

 Replying to [comment:15 jrf]:
 > @costdev did some testing regarding the non-nullablility and got
 confusing results, so I've now actually [https://github.com/php/php-
 src/blob/c68591fa1681dd63b34a429a3378c37f4a657d8d/ext/mysqli/mysqli.stub.php#L294-L306
 checked the PHP source] and turns out the parameters **ARE** nullable and
 that the PHP manual is either wrong or just plain confusing.

 Is it possible, safe and worth defaulting to `(int) ini_get(
 'mysqli.default_port' )` and using that instead of `null`?

 Following the code when there's a contradiction between the code and docs
 always makes me nervous. It could later be decided to be a bug and fixed
 with minimal warning.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54877#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list