PHP Classes

Fix to solve the problem when local_part is null

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  Fix to solve the problem when...  >  (Un) Subscribe thread alerts  
Subject:Fix to solve the problem when...
Summary:Fix for bug in php8.1 when local_part is null
Messages:2
Author:Josep Sanz Campderrós
Date:2024-11-04 10:00:49
 

  1. Fix to solve the problem when...   Reply   Report abuse  
Picture of Josep Sanz Campderrós Josep Sanz Campderrós - 2024-11-04 10:00:49
Fixed a bug in php8.1 in rfc822_addresses.php to solve the problem when local_part is null

Function ParseAddrSpec(&$p, &$addr_spec)
{
$addr_spec = null;
$v = $this->v;
$l = strlen($v);
$a = $p;
if(!$this->ParseQuotedString($a, $local_part))
return(0);
if(!IsSet($local_part))
{
if(!$this->ParseAtom($a, $local_part, 1))
return(0);
// BEGIN TO SOLVE THE PROBLEM WHEN LOCAL_PART IS NULL IN PHP8.1 BY SANZ
if(!IsSet($local_part))
return(1);
// END TO SOLVE THE PROBLEM WHEN LOCAL_PART IS NULL IN PHP8.1 BY SANZ
$local_part = trim($local_part);
}
if($a >= $l
|| strcmp($v[$a], '@'))
return(1);
++$a;
if(!$this->ParseAtom($a, $domain, 1))
return(0);
if(!IsSet($domain))
return(1);
$addr_spec = $local_part.'@'.trim($domain);
$p = $a;
return(1);
}

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

Great. Can you provide an example address that I can use to create a test to verify the issue?