From:             thebeanieman at gmail dot com
Operating system: Windows XP SP3
PHP version:      5.2.6
PHP Bug Type:     Output Control
Bug description:  extra <br />

Description:
------------
Hi,

This is my code:

<?php

  $chemString = "H2O,3PO4.12WO3.XH2O,6H4(CH3)2,5H10O5";
  $chemString = trim($chemString);
  $offset = 0;
  $tempStr = "";

  for ($k=0;$k<mb_strlen($chemString);$k++){
      if ($k>0 && is_numeric(mb_substr($chemString,$k,1))){
          if (preg_match("/^[A-Z]+$/",mb_substr($chemString,$k-1,1))){
             $tempStr .= substr($chemString,$offset,1);
             $tempStr .=
"<sub>".substr($chemString,$offset+1,1)."</sub>";
             $offset = $offset+3;
             echo "ggg".strlen($offset)."sss<br />";
          }
      }
        echo "<br />".$k;
  }

?>

This is the source:

<br />0ggg1sss<br /><br />1<br />2<br />3<br />4<br />5<br />6ggg1sss<br
/><br />7<br />8<br />9<br />10<br />11<br />12ggg1sss<br /><br />13<br
/>14<br />15<br />16ggg2sss<br /><br />17<br />18<br />19<br />20<br
/>21ggg2sss<br /><br />22<br />23<br />24<br />25ggg2sss<br /><br />26<br
/>27<br />28<br />29<br />30<br />31ggg2sss<br /><br />32<br />33<br
/>34ggg2sss<br /><br />35

Expected result:
----------------
There is an extra <br /> tag. I know it's hard to see, but looks like a
bug.


i.e "<br />0ggg1sss<br /><br />1<br />"  --- the <br /> in the middle came
from nowhere!!


-- 
Edit bug report at http://bugs.php.net/?id=46027&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=46027&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=46027&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=46027&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46027&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=46027&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46027&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46027&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46027&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46027&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46027&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=46027&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=46027&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46027&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46027&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46027&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46027&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46027&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46027&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46027&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46027&r=mysqlcfg

Reply via email to