ID:               35985
 User updated by:  scott at abcoa dot com
 Reported By:      scott at abcoa dot com
 Status:           Bogus
 Bug Type:         Variables related
 Operating System: AIX 5.2
 PHP Version:      5.1.2
 New Comment:

I did not ask for help.  Why are you being so hasty!!  I do see the PHP
bug.  When you do the echo in PHP variable, it work okay but the bug is
present within html code becuase it got the data from the php variable.


Previous Comments:
------------------------------------------------------------------------

[2006-01-12 21:23:33] [EMAIL PROTECTED]

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.



------------------------------------------------------------------------

[2006-01-12 21:19:13] scott at abcoa dot com

Description:
------------
After some hair pulling over figuring out the problem was until I came
upon this bug and built a testcase for it.  The script I'm using is a
screen scraping feature since one of the Credit Bureaus doesn't have
XML data.  This bug was detected 2 months ago with PHP 4.3.7 then
upgraded PHP 5.1.1 and bug still exist.  

The bug here is that there's no "<td>" data in PHP but is present when
it is passed on to HTML.  I don't know if the bug is the echo, substr()
or strpos().  So, pay attention to the $ssn1 variable via echo output.

Reproduce code:
---------------
<?
  //$responsedata =
"<table><tr><td>SSN:</td><td>400-41-4001</td></table>";
  $responsedata =
"<table><tr><td>SSN:</td><td>400-41-4001</td></table>";

  //$StrPosValue3 = 0;
  for($x=0;$x<2;$x++) {  //1 - Individual, 2 - Joint
     $StrPosValue1 = strpos($responsedata,"SSN:",$StrPosValue3);
     if (!($StrPosValue1 === false)) {  
        $StrPosValue1 =
strpos($responsedata,"<td>",($StrPosValue1+1));
        $tmp1 = substr($responsedata,0,$StrPosValue1+4);
        $tmp2 =
substr($responsedata,$StrPosValue1,strlen($responsedata));
        $StrPosValue2 = strpos($tmp2,"</td>");
        $ssn1 = substr($tmp2,0,$StrPosValue2);
        $tmp3 = substr($tmp2,$StrPosValue2,strlen($tmp2));

        $ssn1 = trim($ssn1);
        $ssn1 = str_replace("-","",$ssn1);

        //12/23/2005 - Found a PHP bug that somehow insert the \"<td>\"
characters to the beginning of 
        //             the SSN characters, problem is it is not
visisible with the echo command unless 
        //             it is assigned to a variable or to this, echo
"test ".$ssn1." test"; statement...  
        //             So, we'll have to use PHP to remove it
ourselve...
        //=============================================
        //=============================================
        // See bug demo below...
        echo "## --> ".$ssn1." <-- ##<br>";
        echo "<script type='text/javascript'>\n";
        echo "alert('".$ssn1."');\n";
        echo "</script>\n";
        //=============================================
        //=============================================
        // Bug workaround available below...
        $ssn1 = substr($ssn1,-9);  //Used the last 9 characters and
dump the first 4 characters...
        //=============================================
        //=============================================
        
        $ssn1 = "XXX-XX-".substr($ssn1, -4);
        $responsedata = $tmp1.$ssn1.$tmp3;
        $StrPosValue3 = $StrPosValue1 + 1;
     }
  }
?>

Expected result:
----------------
Should not display the "<td>" data.

Actual result:
--------------
Displayed the "<td>" data.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35985&edit=1

Reply via email to