Backport of r120988.
authorMarek Habersack <grendel@twistedcode.net>
Mon, 8 Dec 2008 12:04:01 +0000 (12:04 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Mon, 8 Dec 2008 12:04:01 +0000 (12:04 -0000)
svn path=/branches/mono-2-2/mcs/; revision=120989

mcs/class/System.Web/Makefile
mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
mcs/class/System.Web/Test/System.Web.Compilation/ChangeLog
mcs/class/System.Web/Test/System.Web.Compilation/TemplateControlCompilerTest.cs
mcs/class/System.Web/Test/mainsoft/ChangeLog
mcs/class/System.Web/Test/mainsoft/NunitWebResources/ReadWritePropertyControl.ascx
mcs/class/System.Web/Test/mainsoft/NunitWebResources/ValidPropertyBind5.aspx [new file with mode: 0644]

index d445839190d6c6e17516325b49a2ff98ed4acd43..b1f6a14198fd62d6c8de59c4c1606470f88a8285 100644 (file)
@@ -152,6 +152,7 @@ TEST_RESOURCE_FILES = \
        Test/mainsoft/NunitWebResources/ValidPropertyBind2.aspx \
        Test/mainsoft/NunitWebResources/ValidPropertyBind3.aspx \
        Test/mainsoft/NunitWebResources/ValidPropertyBind4.aspx \
+       Test/mainsoft/NunitWebResources/ValidPropertyBind5.aspx \
        Test/mainsoft/NunitWebResources/ReadWritePropertyControl.ascx \
        Test/mainsoft/MainsoftWebTest/nunitweb_config.xml \
        Test/mainsoft/NunitWebResources/TemplateControlParsingTest.aspx \
index 0babcbce009dbac2752a0177b6cef74d76e52766..6d4756d9499b35cc4293be0a79c9e3ca216e6af1 100644 (file)
@@ -1,3 +1,7 @@
+2008-12-08  Marek Habersack  <mhabersack@novell.com>
+
+       * TemplateControlCompiler.cs: use the correct regex match group
+       index in SanitizeBindCall (), fixes bug #457011
 
 2008-12-02 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
index 534da95174ff149bb44e4d39bceaadfa8dc3d2fb..d97fe9b9fb8421b1b005adf99b2cb8f90915c171 100644 (file)
@@ -67,6 +67,8 @@ namespace System.Web.Compilation
                
 #if NET_2_0
                List <string> masterPageContentPlaceHolders;
+               // When modifying those, make sure to look at the SanitizeBindCall to make sure it
+               // picks up correct groups.
                static Regex bindRegex = new Regex (@"Bind\s*\(\s*[""']+(.*?)[""']+((\s*,\s*[""']+(.*?)[""']+)?)\s*\)\s*%>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                static Regex bindRegexInValue = new Regex (@"Bind\s*\(\s*[""']+(.*?)[""']+((\s*,\s*[""']+(.*?)[""']+)?)\s*\)\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
 #endif
@@ -501,7 +503,7 @@ namespace System.Web.Compilation
                {
                        GroupCollection groups = match.Groups;
                        StringBuilder sb = new StringBuilder ("Eval(\"" + groups [1] + "\"");
-                       Group second = groups [2];
+                       Group second = groups [4];
                        if (second != null) {
                                string v = second.Value;
                                if (v != null && v.Length > 0)
index 485a761fd4de8751748a9359be1f1f46bc003f54..1f7cdc22fcfde814b34eaa6630268f9d19f84263 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-08  Marek Habersack  <mhabersack@novell.com>
+
+       * TemplateControlCompilerTest.cs: added another valid Bind
+       expression test.
+
 2008-12-01  Marek Habersack  <mhabersack@novell.com>
 
        * TemplateControlCompilerTest.cs: Added test for bug #449970
index 2e0bddaae92fff829964559df8ac417f1d669075..17cbdbb043f37d79e03721972f61472ca808a903 100644 (file)
@@ -61,6 +61,7 @@ namespace MonoTests.System.Web.Compilation {
                        WebTest.CopyResource (GetType (), "ValidPropertyBind2.aspx", "ValidPropertyBind2.aspx");
                        WebTest.CopyResource (GetType (), "ValidPropertyBind3.aspx", "ValidPropertyBind3.aspx");
                        WebTest.CopyResource (GetType (), "ValidPropertyBind4.aspx", "ValidPropertyBind4.aspx");
+                       WebTest.CopyResource (GetType (), "ValidPropertyBind5.aspx", "ValidPropertyBind5.aspx");
                        WebTest.CopyResource (GetType (), "ReadWritePropertyControl.ascx", "ReadWritePropertyControl.ascx");
                        WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.aspx", "ContentPlaceHolderInTemplate.aspx");
                        WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.master", "ContentPlaceHolderInTemplate.master");
@@ -136,6 +137,12 @@ namespace MonoTests.System.Web.Compilation {
                {
                        new WebTest ("ValidPropertyBind4.aspx").Run ();
                }
+
+               [Test]
+               public void ValidPropertyBindTest5 ()
+               {
+                       new WebTest ("ValidPropertyBind5.aspx").Run ();
+               }
 #endif
                
                [Test]
index 5b7af0552cbc246367555d5b9068b17dc1c03659..f281bfd5df753701142216c7f06fa4861865ec47 100644 (file)
@@ -1,3 +1,10 @@
+2008-12-08  Marek Habersack  <mhabersack@novell.com>
+
+       * NunitWebResources/ValidPropertyBind5.aspx: added
+
+       * NunitWebResources/ReadWritePropertyControl.ascx: added a
+       writable string property.
+
 2008-11-21  Marek Habersack  <mhabersack@novell.com>
 
        * NunitWebResources/WebLogin.config,
index 3dcdcd6c09d6acd46610d6a9325b87c6c518bd83..e7de04dda0ac7ef8f6136663f0af61d525a9ab18 100644 (file)
         get { return _readWriteProperty; }
         set { _readWriteProperty = value; }
     }
+    
+    string _readWriteProperty2;
+    [System.ComponentModel.Bindable (true)]
+    public string ReadWriteProperty2
+    {
+       get { return _readWriteProperty2; }
+        set { _readWriteProperty2 = value; }
+    }
 </script>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWebResources/ValidPropertyBind5.aspx b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/ValidPropertyBind5.aspx
new file mode 100644 (file)
index 0000000..c284ca9
--- /dev/null
@@ -0,0 +1,20 @@
+<%@ Page Language="C#" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ Register TagPrefix="uc1" TagName="ReadWritePropertyControl" Src="ReadWritePropertyControl.ascx" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+    <head>
+        <title>UrlProperty test</title>
+    </head>
+<body>
+    <form id="form1" runat="server">
+    <asp:FormView runat="server" ID="fv1" DataSourceID="DataSource1" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" >
+    <ItemTemplate>
+    <uc1:ReadWritePropertyControl runat="server" ID="wuc1" ReadWriteProperty2='<%# Bind("Data", "ValidPropertyBind5.aspx?Data={0}") %>' />
+    </ItemTemplate>
+    </asp:FormView>
+    <asp:ObjectDataSource ID="DataSource1" runat="server" TypeName="MonoTests.System.Web.Compilation.BindTestDataSource" SelectMethod="GetData" />
+    </form>
+</body>
+</html>