Permalink
Browse files

Fixes #1118 - ignore properties that fully resolve

  • Loading branch information...
1 parent d6a10bc commit 569e320e396ec5c1016b0e28b4d24537ccb8221f @mrook mrook committed Jul 12, 2014
@@ -386,8 +386,10 @@ protected function resolveAllProperties(Properties $props) {
if ($fragment === null) {
if ($props->containsKey($propertyName)) {
$fragment = $props->getProperty($propertyName);
- $resolveStack[] = $propertyName;
- $resolved = false; // parse again (could have been replaced w/ another var)
+ if (strpos($fragment, '${') !== false) {
+ $resolveStack[] = $propertyName;
+ $resolved = false; // parse again (could have been replaced w/ another var)
+ }
} else {
$fragment = "\${".$propertyName."}";
}
@@ -75,7 +75,7 @@ public function circularDefinitionTargets()
return array(
array('test3'),
array('testCircularDefinition1'),
- array('testCircularDefinition2')
+ array('testCircularDefinition2'),
);
}
@@ -92,6 +92,15 @@ public function testCircularDefinitionDetection($target)
}
$this->fail("Did not throw exception on circular exception");
}
+
+ /**
+ * Inspired by @link http://www.phing.info/trac/ticket/1118
+ * This test should not throw exceptions
+ */
+ public function testUsingPropertyTwiceInPropertyValueShouldNotThrowException()
+ {
+ $this->executeTarget(__FUNCTION__);
+ }
}
class HangDetectorPropertyTask extends PropertyTask {
@@ -49,4 +49,8 @@
<target name="testCircularDefinition2">
<hangdetectorproperty file="property_hang.properties"/>
</target>
+
+ <target name="testUsingPropertyTwiceInPropertyValueShouldNotThrowException">
+ <property file="property_notcircular.properties"/>
+ </target>
</project>
@@ -0,0 +1,4 @@
+testprop1=xx
+testprop2=yy${testprop1}/${testprop1}
+
+

0 comments on commit 569e320

Please sign in to comment.