Announcement

Collapse
No announcement yet.

V6 Bug. ACTINIC.pm - sub ProcessEscapableText - broken

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    V6 Bug. ACTINIC.pm - sub ProcessEscapableText - broken

    ACTINIC.pm - sub ProcessEscapableText fails to properly detect multiple instances of embedded HTML. All versions up to 6.1.4 are affected.

    Symptoms:

    In View Search Settings / Results / Display Options, check "Description". Now into a product description put some embedded HTML e.g.

    Normal description!!<<font color=red>>!!this is red!!<</font>>!! and this is normal.

    Now upload and search for that product and the results will be garbled.

    Cause:

    The lines
    Code:
    	my (@PartsList) = ($sString =~  m/((.*?)!!<(.*?)>!!)*/g);
    	my ($sEndPart) = ($sString =~ m/>!!(.*?)$/g); # get the closing encode text
    Are not splitting the text as expected. The first line is only matching once and $sEndPart contains all text after the 1st lot of embedded HTML.


    Solution:

    The existing code was too scary for me so I replace the entire routine with the following and it seems to work OK.

    Code:
    sub ProcessEscapableText
    	{
    #? ACTINIC::ASSERT($#_ == 0, "Invalid argument count in ProcessEscapableText ($#_)", __LINE__, __FILE__);
    
    	my ($sString) = @_;
    	#
    	# first see if there is any escaped text
    	#
    	my (@Response);
    	if ($sString !~ /!!</)								# no escaped text
    		{
    		return (EncodeText($sString));				# encode it
    		}
    
    	#
    	# pick apart the string
    	#
    	
    	my $sNewString = '';
            while ( $sString =~  m/(.*?)!!<(.*?)>!!(.*)/ )		# pick out embedded HTML
    		{
    		@Response = EncodeText($1);			# encode preceding text
    		if ($Response[0] != $::SUCCESS)
    			{
    			return (@Response);
    			}
    		$sNewString .= $Response[1] . $2;		# encode text + raw HTML
    		$sString = $3;					# now look for more
    		}
    	@Response = EncodeText($sString);			# encode final part
    	if ($Response[0] != $::SUCCESS)
    		{
    		return (@Response);
    		}
    	$sNewString .= $Response[1];				# add in final part
    
    	return ($::SUCCESS, $sNewString, 0, 0);
    	}

    Norman
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    #2
    Thanks Norman - I have reported this to the development team.

    Comment

    Working...
    X