Skip Menu |

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 5421
Status: resolved
Priority: 0/
Queue: DBD-mysql

Owner: Nobody in particular
Requestors: mjhbugs-cpanrt [...]

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)

Subject: DBI:quote returns NULL for tied hash variables.
Download (untitled) / with headers
text/plain 1.4k
perl: v5.8.0 v 11.42 v 2.0419 Problem: dbi->quote(%hash->{'value'}) returns NULL if "%hash" is tied but valid. Example: use strict; use DBI; use Apache::Session::MySQL; use Data::Dumper; my $dbh = DBI->connect( "dbi:mysql:database=$db", $user, $pass); my $sessionId = '0167d73142462923e29ef694839a26c2'; my %session; tie %session, 'Apache::Session::MySQL', $sessionId, { 'Handle' => $dbh, 'LockHandle' => $dbh, }; my $session = \%session; my $username = $session->{'username'}; $Data::Dumper::Indent= 1; print Dumper($session) . "\n"; print $username . "\n"; print $session->{'username'} . "\n"; print $$session{'username'} . "\n\n"; print $dbh->quote( $session->{'username'} ) . "\n"; print $dbh->quote( ${ \$session->{'username'} } ) . "\n"; print $dbh->quote( $session{username} ) . "\n\n"; print $dbh->quote( $$session{username} ) . "\n"; print $dbh->quote($username) . "\n"; print $dbh->quote( "$session->{'username'}"); Produces: $VAR1 = { 'name' => undef, 'logged in' => 'y', 'cookie' => '0167d73142462923e29ef694839a26c2', 'username' => 'tESTING', '_session_id' => '0167d73142462923e29ef694839a26c2', 'last used' => 1075436736 }; tESTING tESTING tESTING NULL NULL NULL NULL 'tESTING' 'tESTING' As you can see, anything that forces the tied value into a scalar context works, anything that does not results in a NULL. cf.
Download (untitled) / with headers
text/plain 249b
This problem is fixed in the latest version of DBD::mysql (2.9002). See below. Jochen SV* dbd_db_quote(SV* dbh, SV* str, SV* type) { SV* result; char* ptr; char* sptr; STRLEN len; if (SvGMAGICAL(str)) mg_get(str);

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to