From 2ff6ddeaaa45693976a61d5855fd280e8bf39ac3 Mon Sep 17 00:00:00 2001 From: Igor Date: Mon, 24 Aug 2015 14:27:56 +1200 Subject: [PATCH] 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). --- .../BehatExtension/Context/SilverStripeContext.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php b/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php index 552cbc3..6d462b1 100644 --- a/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php +++ b/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php @@ -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; } }