php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46027 extra <br />
Submitted: 2008-09-09 03:13 UTC Modified: 2008-09-09 13:35 UTC
From: thebeanieman at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.2.6 OS: Windows XP SP3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
31 - 30 = ?
Subscribe to this entry?

 
 [2008-09-09 03:13 UTC] thebeanieman at gmail dot com
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!!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-09 13:35 UTC] tularis@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 23:01:30 2024 UTC