View Issue Details

IDProjectCategoryView StatusLast Update
0002257XdebugUncategorizedpublic2024-04-15 12:36
Reporternym Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status feedbackResolutionopen 
Product Version3.2.0 
Summary0002257: xdebug is base64 encoding long strings, resulting in code fault
Description

I have a very long string in hexadecimal format, convert it with hex2bin at this point Xdebug on Sublime Text is showing me the variable base64 encoded for some reason, if I echo the variable it prints correctly, if I try to $r=json_decode($r, true); it returns null, because it assumed the variable is really its base64 encoded representation.

Steps To Reproduce
<!doctype html>
<html lang="en">
    <body>   

<?php
$r = $_GET['r']; //r is any string in hex (obtained with bin2hex in javascript, see notes) format containing special characters such as ÉGOÏSTE 

$r = hex2bin($r);       

//here xdebug on sublime text show it as a base64 encoded string

echo $r;

$r=json_decode($r, true); //since the variable is now base64 and not jus rrepresented as that, this returns null

//the code fail here since there is a null check.

//the problem is xdebug represent long text variables as base64 encoded (probably due to weird letters used??) then assume the representation is the real value of the variable. Passing EGOISTE doesn't trigger the bug.

?>
    </body>

 </html>     
Additional Information
//javascript code used to bin2hex

function bin2hex (bin)
{

  var i = 0, l = bin.length, chr, hex = ''

  for (i; i < l; ++i)
  {

    chr = bin.charCodeAt(i).toString(16)

    hex += chr.length < 2 ? '0' + chr : chr

  }

  return hex

}
Tags3.0.2
Operating SystemWindows 10 x64
PHP Version8.2.0-8.2.9

Activities

nym

2024-03-30 21:45

reporter   ~0006887

The problem seems to be PHP related, can someone confirm?

derick

2024-04-15 12:36

administrator   ~0006899

Can you attach the Xdebug debugging log, and the files that you used to this report? You can learn at https://xdebug.org/reporting-bugs#step-debugger on how to create a debugging log.

Issue History

Date Modified Username Field Change
2024-03-30 21:27 nym New Issue
2024-03-30 21:27 nym Tag Attached: 3.0.2
2024-03-30 21:45 nym Note Added: 0006887
2024-04-15 12:35 derick Steps to Reproduce Updated
2024-04-15 12:35 derick Additional Information Updated
2024-04-15 12:36 derick Assigned To => derick
2024-04-15 12:36 derick Status new => feedback
2024-04-15 12:36 derick Note Added: 0006899