Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Fix isset on null values #43

Closed
wants to merge 3 commits into from

Conversation

pikariop
Copy link
Contributor

PHP isset returns false when array item value is NULL. This resulted in __unset throwing an exception when attempting to remove a null field from the insert clause.

@samsonasik
Copy link
Contributor

please provide unit tests

@@ -226,7 +226,7 @@ public function __set($name, $value)
*/
public function __unset($name)
{
if (!isset($this->columns[$name])) {
if (!$this->__isset($name)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use array_key_exists() here as well; this is a case where DRY is not better, but instead adds performance overhead and indirection.

Make the same change on the __get() method, too.

@mwillbanks mwillbanks added this to the 2.6.1 milestone Oct 13, 2015
@mwillbanks mwillbanks added the bug label Oct 13, 2015
mwillbanks added a commit that referenced this pull request Oct 13, 2015
@mwillbanks
Copy link
Contributor

Merged in with commit: acfb14b

@mwillbanks mwillbanks closed this Oct 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants