VirtueMart Forum

VirtueMart 2 + 3 + 4 => 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:

$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.