#65 problems with zero's in text

1.3.x
closed
nobody
None
5
2012-10-11
2004-02-03
Anonymous
No

a line with a single '0' ( zero ) would cause the page
to be truncated.

a OldStyleTable cell with a zero in it would be
displayed as empty.

example: http://wiki.xda-developers.com/wiki/WikiProblems

this is cause by testing the emptyness of a string with
an implicit value to boolean conversion.

the fix is to explicitly compare with an emptystring ('')

willem ( itsme@xs4all.nl )

diff -du lib/BlockParser.php lib.fixed/BlockParser.php
--- lib/BlockParser.php 2003-02-26 18:17:52.000000000 +0100
+++ lib.fixed/BlockParser.php 2004-02-03
01:28:50.893030200 +0100
@@ -362,7 +362,7 @@
function _getBlock (&$input) {
$this->_atSpace = $input->skipSpace();

  • if (! ($line = $input->currentLine()) )
  • if (($line = $input->currentLine())==='')
    return false;

     $tight_top = !$this->_atSpace;
    

    diff -du lib/CachedMarkup.php lib.fixed/CachedMarkup.php
    --- lib/CachedMarkup.php 2003-03-25 22:04:41.000000000
    +0100
    +++ lib.fixed/CachedMarkup.php 2004-02-03
    01:29:15.642079800 +0100
    @@ -25,7 +25,7 @@
    $this->_buf = '';
    $this->_content = array();
    $this->_append($content);
    - if ($this->_buf)
    + if ($this->_buf!='')
    $this->_content[] = $this->_buf;
    unset($this->_buf);
    }

Discussion

  • Reini Urban

    Reini Urban - 2004-02-27

    Logged In: YES
    user_id=13755

    fixed in CVS

     
  • Reini Urban

    Reini Urban - 2004-02-27

    Logged In: YES
    user_id=13755

    RCS file: /cvsroot/phpwiki/phpwiki/lib/BlockParser.php,v
    retrieving revision 1.38
    retrieving revision 1.39
    diff -u -b -r1.38 -r1.39
    --- BlockParser.php 15 Feb 2004 21:34:22 -0000 1.38
    +++ BlockParser.php 27 Feb 2004 02:22:21 -0000 1.39
    @@ -1,4 +1,4 @@
    -<?php rcs_id('$Id: BlockParser.php,v 1.38 2004/02/15
    21:34:22 rurban Exp $');
    +<?php rcs_id('$Id: BlockParser.php,v 1.39 2004/02/27
    02:22:21 rurban Exp $');
    / Copyright (C) 2002, Geoffrey T. Dairiki
    dairiki@dairiki.org


    * This file is part of PhpWiki.
    @@ -362,7 +362,7 @@
    function _getBlock (&$input) {
    $this->_atSpace = $input->skipSpace();

    • if (! ($line = $input->currentLine()) )
    • if (($line = $input->currentLine()) === '')
      return false;

       $tight_top = !$this->_atSpace;
      

      @@ -379,6 +379,8 @@
      }
      //$input->_debug('[', "_match failed");
      }
      + if (!$line)
      + return false;

       trigger_error("Couldn't match block: '$line'",
      

      E_USER_NOTICE);
      return false;

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks