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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: thebeanieman at gmail dot com
New email:
PHP Version: OS:

 

 [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 Apr 19 01:01:28 2024 UTC