findOrCreate string viewed as int #525

stijnboa opened this Issue Sep 26, 2016 · 2 comments


None yet

2 participants


$m = \R::findOrCreate('category', ['code' => (string)$me->menuid]);

// the value of $me->menuid => '00000'

results in query:
SELECTcategory.* FROMcategoryWHERE (codeIN ( 00000 ) )

Which returns all rows where a string is filled in (searches for integer 0)

To fix this the resulting query should be (quotes):

SELECTcategory.* FROMcategoryWHERE (codeIN ( '00000' ) )

Redbean version 4.3


Thank you for reporting this issue.
I will look into this.

@gabordemooij gabordemooij pushed a commit that closed this issue Oct 3, 2016
Gabor de Mooij Fix zeroes issue. Close #525. 1c7ec69
stijnboa commented Oct 4, 2016


@diego-vieira diego-vieira added a commit to diego-vieira/redbean that referenced this issue Nov 7, 2016
@diego-vieira Gabor de Mooij + diego-vieira Fix zeroes issue. Close #525. ef6c326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment