Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use array_key_exists instead of isset for "_findVariableInContext" #13

Closed
wants to merge 1 commit into from
Closed

Conversation

ThePixelDeveloper
Copy link

A bit of information on this bug.

Say I have a class with a $description property, value being the meta description of a website.

Now I have a form method in a child view class that returns an array with form values. Like

public function form()
{
    $default = array
    (
        'name'        => NULL,
        'description' => NULL,
        'tags'        => NULL,
    );

    return array_intersect_key($this->form, $default);
}

The initial page load would set the description value to that of the meta description (even though the key is set). This is because isset returns false for an array key that has a NULL value. array_key_exists solves this problem nicely.

@bobthecow
Copy link
Owner

Thanks! Pulled into dev. This will go in 0.4 since it's a backwards incompatible change.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants