PHP Classes

Fix to solve an issue when hex contains non hexadecimal chars

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  Fix to solve an issue when hex...  >  (Un) Subscribe thread alerts  
Subject:Fix to solve an issue when hex...
Summary:Fix to solve an issue when hex contains non hexadecimal chars
Messages:2
Author:Josep Sanz Campderrós
Date:2024-11-04 09:55:54
 

  1. Fix to solve an issue when hex...   Reply   Report abuse  
Picture of Josep Sanz Campderrós Josep Sanz Campderrós - 2024-11-04 09:55:54
This fix solve an issue when hex contains non hexadecimal chars, this bug was detected with php 8.0.

Replace the line:

$h = HexDec($hex = strtolower(substr($value, $position+1, 2)));

By the follow two lines:

$hex = strtolower(substr($value, $position+1, 2));
$h = ctype_xdigit($hex) ? HexDec($hex) : -1;

With these lines, the issue will be solved.

  2. Re: Fix to solve an issue when hex...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2024-11-04 12:23:24 - In reply to message 1 from Josep Sanz Campderrós
Hello Josep,

Thank you again for sharing the fix.

Can you provide an example message that we can use to test the issue?