Medoo icon indicating copy to clipboard operation
Medoo copied to clipboard

"has" method has a problem

Open wendao76 opened this issue 8 years ago • 4 comments

''' return $result === '1' || $result === true; ''' in fact, $result=1, so the method always return false

wendao76 avatar Feb 28 '18 06:02 wendao76

What's database and version you are using that returned $result = 1 as integer type?

catfan avatar Mar 06 '18 13:03 catfan

I have this problem,too.

Use mysql5.7 and medoo 1.5.4

And I setting this ,the 'has' can work well:

'option' => [ PDO::ATTR_STRINGIFY_FETCHES => true]

Convert numeric values to strings when fetching. Requires bool.

I think this is a bug because of comparing with the strict type. ''' return intval($result) === 1 || $result === true; ''' well ?

ha-ni-cc avatar Mar 14 '18 02:03 ha-ni-cc

@wendao76 @catfan @ha-ni-cc yes, it's a bug. now,just use "PDO::ATTR_EMULATE_PREPARES => true" to solve this.

lovearthhome avatar Mar 15 '18 02:03 lovearthhome

This has been fixed on a951846f9bfe93419d40700d9fbefde5c9b10259.

catfan avatar Dec 15 '18 01:12 catfan