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

People
Owner: Nobody in particular
Requestors: mjhbugs-cpanrt [...] liminalflux.net
Cc:
AdminCc:

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 DBI.pm: v 11.42 DBD::MySQL.pm: 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. http://rt.cpan.org/NoAuth/Bug.html?id=5132
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 Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.