Author: Kris.Wallsmith
Date: 2010-02-08 20:21:22 +0100 (Mon, 08 Feb 2010)
New Revision: 27752
Modified:
branches/1.3/lib/escaper/sfOutputEscaperArrayDecorator.class.php
branches/1.3/test/unit/escaper/sfOutputEscaperArrayDecoratorTest.php
branches/1.4/lib/escaper/sfOutputEscaperArrayDecorator.class.php
branches/1.4/test/unit/escaper/sfOutputEscaperArrayDecoratorTest.php
Log:
[1.3, 1.4] fixed initializion of output escaper array iterator (closes #8202)
Modified: branches/1.3/lib/escaper/sfOutputEscaperArrayDecorator.class.php
===================================================================
--- branches/1.3/lib/escaper/sfOutputEscaperArrayDecorator.class.php
2010-02-08 19:09:00 UTC (rev 27751)
+++ branches/1.3/lib/escaper/sfOutputEscaperArrayDecorator.class.php
2010-02-08 19:21:22 UTC (rev 27752)
@@ -27,6 +27,18 @@
private $count;
/**
+ * Constructor.
+ *
+ * @see sfOutputEscaper
+ */
+ public function __construct($escapingMethod, $value)
+ {
+ parent::__construct($escapingMethod, $value);
+
+ $this->count = count($this->value);
+ }
+
+ /**
* Reset the array to the beginning (as required for the Iterator interface).
*/
public function rewind()
@@ -66,7 +78,7 @@
{
next($this->value);
- $this->count --;
+ $this->count--;
}
/**
Modified: branches/1.3/test/unit/escaper/sfOutputEscaperArrayDecoratorTest.php
===================================================================
--- branches/1.3/test/unit/escaper/sfOutputEscaperArrayDecoratorTest.php
2010-02-08 19:09:00 UTC (rev 27751)
+++ branches/1.3/test/unit/escaper/sfOutputEscaperArrayDecoratorTest.php
2010-02-08 19:21:22 UTC (rev 27752)
@@ -24,7 +24,7 @@
sfConfig::set('sf_charset', 'UTF-8');
-$t = new lime_test(10);
+$t = new lime_test(11);
$a = array('<strong>escaped!</strong>', 1, null, array(2,
'<strong>escaped!</strong>'));
$escaped = sfOutputEscaper::escape('esc_entities', $a);
@@ -83,3 +83,9 @@
$t->fail('The escaped object behaves like an array');
}
}
+
+// ->valid()
+$t->diag('->valid()');
+
+$escaped = sfOutputEscaper::escape('esc_entities', array(1, 2, 3));
+$t->is($escaped->valid(), true, '->valid() returns true if called before
iteration');
Modified: branches/1.4/lib/escaper/sfOutputEscaperArrayDecorator.class.php
===================================================================
--- branches/1.4/lib/escaper/sfOutputEscaperArrayDecorator.class.php
2010-02-08 19:09:00 UTC (rev 27751)
+++ branches/1.4/lib/escaper/sfOutputEscaperArrayDecorator.class.php
2010-02-08 19:21:22 UTC (rev 27752)
@@ -27,6 +27,18 @@
private $count;
/**
+ * Constructor.
+ *
+ * @see sfOutputEscaper
+ */
+ public function __construct($escapingMethod, $value)
+ {
+ parent::__construct($escapingMethod, $value);
+
+ $this->count = count($this->value);
+ }
+
+ /**
* Reset the array to the beginning (as required for the Iterator interface).
*/
public function rewind()
@@ -66,7 +78,7 @@
{
next($this->value);
- $this->count --;
+ $this->count--;
}
/**
Modified: branches/1.4/test/unit/escaper/sfOutputEscaperArrayDecoratorTest.php
===================================================================
--- branches/1.4/test/unit/escaper/sfOutputEscaperArrayDecoratorTest.php
2010-02-08 19:09:00 UTC (rev 27751)
+++ branches/1.4/test/unit/escaper/sfOutputEscaperArrayDecoratorTest.php
2010-02-08 19:21:22 UTC (rev 27752)
@@ -24,7 +24,7 @@
sfConfig::set('sf_charset', 'UTF-8');
-$t = new lime_test(10);
+$t = new lime_test(11);
$a = array('<strong>escaped!</strong>', 1, null, array(2,
'<strong>escaped!</strong>'));
$escaped = sfOutputEscaper::escape('esc_entities', $a);
@@ -83,3 +83,9 @@
$t->fail('The escaped object behaves like an array');
}
}
+
+// ->valid()
+$t->diag('->valid()');
+
+$escaped = sfOutputEscaper::escape('esc_entities', array(1, 2, 3));
+$t->is($escaped->valid(), true, '->valid() returns true if called before
iteration');
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.