VirtueMart Forum

VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: Stephen Roberts on December 14, 2011, 21:52:01 pm

Title: Bug in VirtueMartModelState getStateByCode (Rev 5074)
Post by: Stephen Roberts on December 14, 2011, 21:52:01 pm
I believe there's a bug in the state model's getStateByCode() function. The $code variable is being treated as an int in the query:

Code: [Select]
$query = 'SELECT * FROM `#__virtuemart_states` WHERE `' . $stateCodeFieldname . '` = ' (int)$code;
If I understand the function properly, the code should be treated as a 2 or 3 character string.
Title: Re: Bug in VirtueMartModelState getStateByCode (Rev 5074)
Post by: Milbo on December 14, 2011, 22:36:46 pm
Interesting,. on the other side, this code is never called. So I just deleted it. I think it was done while we add the security stuff in the summer. Thx
Title: Re: Bug in VirtueMartModelState getStateByCode (Rev 5074)
Post by: Stephen Roberts on December 14, 2011, 22:48:51 pm
Gotcha. It was almost identical to getStateIDByName() in shopfunctions.