[chora] patch for htmlspaces

Cynic cynic@mail.cz
Wed, 23 May 2001 19:26:26 +0200


yeah, I realized that after I sent the mail.
BTW, how is the function used? (I have never used Chora, sorry.)
E. g. why is a tab expanded to '        ' ?
Or every other space to ' '? Is it by design? Or was it
meant to expand tabs to four non-breakable spaces each?

Whatever... your patch is wrong - if you call htmlspaces() with
an empty string, it returns it untouched. That's not what its
description says. This is a correct patch:

E:\__install__\.coding\PHP\programs\chora-2001-04-30\lib>diff -u base.php 
base.php.patch
--- base.php    Thu Apr 26 02:20:37 2001
+++ base.php.patch      Wed May 23 19:19:49 2001
@@ -247,7 +247,7 @@
      $text = str_replace("\t", '        ', $text);
      $text = str_replace('  ', '  ', $text);
      $text = str_replace('  ', '  ', $text);
-    return empty($text)?' ':$text;
+    return strlen($text) ? $text : ' ';
  }

  /**


At 18:43 23.5. 2001 +0200, you wrote:


>Cynic wrote:
> >
> > since when is empty( 0 ) false?
> >
> > D:\work\projekty\roaming>php -v
> > 4.0.6-dev
> >
> > D:\work\projekty\roaming>php -q
> > <? $x = 0 ; var_dump( empty( $x ) ) ; ?>
> > ^Z
> > bool(true)
> >
> > D:\work\projekty\roaming>
>
>hum, i meant true, but that is the problem in this case :)
>reading the patch would have told you that :)
>
>--
>Mathieu Arnold
>
>--
>Chora mailing list: http://horde.org/chora/
>Frequently Asked Questions: http://horde.org/faq/
>To unsubscribe, mail: chora-unsubscribe@lists.horde.org



cynic@mail.cz
-------------
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
     - Book of Installation chapt 3 sec 7