DBD-mysql icon indicating copy to clipboard operation
DBD-mysql copied to clipboard

Silently ignores "; host=$hostname"

Open drboone opened this issue 4 years ago • 2 comments
trafficstars

Not sure if this is a DBI or DBD::mysql issue.

A DSN like "dbi:mysql:$database; host=$hostname" will silently ignore the host= clause and connect to localhost. This is bad juju: one could end up making changes to the wrong database. It's also a serious violation of "principle of least astonishment. The DSN should either be accepted and used fully, or rejected fully, not selectively ignored.

drboone avatar Jun 17 '21 18:06 drboone

So the issue here is the space in front of host?

dveeden avatar Jun 18 '21 07:06 dveeden

Seems to be.

drboone avatar Jun 18 '21 13:06 drboone