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

AbstractOptions isset issue, #7286 #7287

Closed
wants to merge 8 commits into from
Closed

AbstractOptions isset issue, #7286 #7287

wants to merge 8 commits into from

Conversation

rms230
Copy link

@rms230 rms230 commented Mar 3, 2015

When calling isset() on an object variable that is a class extending AbstractOptions an exception is thrown.

An example useage of this is found in the EventManagerAwareTrait where the trait checks a class variable isset, if the class that is using the EventManagerAwareTrait extends AbstractOptions an exception is thrown.

This pull request fixes AbstractOptions by checking that the method exists and that the value is not equal to null, thus stopping the exception being thrown.

This pull request also fixes issue #7286

@rms230 rms230 changed the title AbstractOptions isset issue AbstractOptions isset issue, #7286 Mar 3, 2015
@Martin-P
Copy link
Contributor

Martin-P commented Mar 3, 2015

Perhaps you can split up and create a separate PR for each issue? I see a fix for Zend\StdLib\AbstractOptions and also for a completely unrelated issue about Zend\Form\View\Helper\FormCheckbox.

@@ -60,6 +60,7 @@ public function render(ElementInterface $element)
$hiddenAttributes = array(
'name' => $attributes['name'],
'value' => $element->getUncheckedValue(),
'disabled' => isset($attributes['disabled']) ? $attributes['disabled'] : false,
Copy link
Member

Choose a reason for hiding this comment

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

Use spaces instead of tabs

@weierophinney
Copy link
Member

@rms230 : Please read our contributing guide, particularly the section linked on branching for patches. The pull request here combines two separate features, which should be evaluated separately; this is due to doing both on your master branch. Also make sure you run php-cs-fixer (which is installed by default when you run composer install) to correct any CS issues you have; this will make it simpler for us to merge.

You can create a new branch from your master branch, revert the unwanted commits (the stuff around the form components), and create a new pull request from there. The changes do look good; I just want to make sure they come in cleanly.

Thanks!

rms230 added 6 commits March 11, 2015 15:13
The test checks that the exception was not thrown, this checks that future implementations do not revert changes were made.

Checking for an exception thrown would cause the tests to fail. How would I go about doing this with the standards?
@weierophinney
Copy link
Member

@rms230 If you want this included in 2.4.0, you have until tomorrow, 19 March 2015, to resubmit as a discrete patch against develop as outlined in my previous comment.

$element->setUseHiddenElement(true);
$element->setAttribute('disabled', true);
$markup = $this->helper->__invoke($element);
$this->assertRegexp('#type="checkbox".*?(disabled="disabled")#', $markup);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just tested this and this test already passes against current master.

@Martin-P
Copy link
Contributor

@weierophinney I created a separate PR for the checkbox issue and also updated the unittest so it fails against current master and passes with the provided fix from @rms230 See #7341.

weierophinney added a commit that referenced this pull request Mar 18, 2015
@weierophinney
Copy link
Member

Closed in favor of #7341

@Martin-P
Copy link
Contributor

@weierophinney Please see PR #7342 for the second part of this PR about the AbstractOptions issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants