FIX logic error where a variable is used for two purposes

The issue that prompted this change was that at line 361, if an exception needed to be thrown, it would be thrown with $field being a NodeElement rather than a string, causing a Catchable Fatal Error to be thrown in ElementNotFoundException::__construct#46 (can't convert object of type NodeElement to string).
This commit is contained in:
Igor 2015-08-24 14:27:56 +12:00
parent 7f370df19b
commit 2ff6ddeaaa

View File

@ -351,9 +351,9 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
$fields = $this->getSession()->getPage()->findAll('named', array(
'field', $this->getSession()->getSelectorsHandler()->xpathLiteral($field)
));
if($fields) foreach($fields as $field) {
if($field->isVisible()) {
$field->setValue($value);
if($fields) foreach($fields as $f) {
if($f->isVisible()) {
$f->setValue($value);
return;
}
}