[geeklog-hg] geeklog: Allow template variable names to be numbers including 0...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Wed Jan 1 11:05:11 EST 2014


changeset 9366:e3b5110d0db1
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e3b5110d0db1
user: Tom <websitemaster at cogeco.net>
date: Wed Jan 01 11:02:33 2014 -0500
description:
Allow template variable names to be numbers including 0 (bug #0001724)

diffstat:

 system/classes/template.class.php |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r a03be439ea66 -r e3b5110d0db1 system/classes/template.class.php
--- a/system/classes/template.class.php	Tue Dec 31 18:03:24 2013 -0500
+++ b/system/classes/template.class.php	Wed Jan 01 11:02:33 2014 -0500
@@ -552,7 +552,7 @@
     function set_var($varname, $value = "", $append = false, $nocache = false)
     {
         if (!is_array($varname)) {
-            if (!empty($varname)) {
+            if (!empty($varname) || $varname == 0) { // Allow varname to be numbers including 0
                 if ($this->debug & 1) {
                     printf("<b>set_var:</b> (with scalar) <b>%s</b> = '%s'<br>\n", $varname, htmlentities($value));
                 }
@@ -568,7 +568,7 @@
         } else {
             reset($varname);
             while(list($k, $v) = each($varname)) {
-                if (!empty($k)) {
+                if (!empty($k) || $k == 0) { // Allow varname to be numbers including 0
                     if ($this->debug & 1) {
                         printf("<b>set_var:</b> (with array) <b>%s</b> = '%s'<br>\n", $k, htmlentities($v));
                     }
@@ -608,7 +608,7 @@
     function clear_var($varname)
     {
         if (!is_array($varname)) {
-            if (!empty($varname)) {
+            if (!empty($varname) || $varname == 0) { // Allow number variable names including 0
                 if ($this->debug & 1) {
                     printf("<b>clear_var:</b> (with scalar) <b>%s</b><br>\n", $varname);
                 }
@@ -617,7 +617,7 @@
         } else {
             reset($varname);
             while(list($k, $v) = each($varname)) {
-                if (!empty($v)) {
+                if (!empty($v) || $v == 0) { // Allow number variable names including 0
                     if ($this->debug & 1) {
                         printf("<b>clear_var:</b> (with array) <b>%s</b><br>\n", $v);
                     }
@@ -650,7 +650,7 @@
     function unset_var($varname)
     {
         if (!is_array($varname)) {
-            if (!empty($varname)) {
+            if (!empty($varname) || $varname == 0) { // Allow number variable names including 0
                 if ($this->debug & 1) {
                     printf("<b>unset_var:</b> (with scalar) <b>%s</b><br>\n", $varname);
                 }
@@ -660,7 +660,7 @@
         } else {
             reset($varname);
             while(list($k, $v) = each($varname)) {
-                if (!empty($v)) {
+                if (!empty($v) || $v == 0) { // Allow number variable names including 0
                     if ($this->debug & 1) {
                         printf("<b>unset_var:</b> (with array) <b>%s</b><br>\n", $v);
                     }



More information about the geeklog-cvs mailing list