Truncating strings

Report issues with Enuuk Auction Platform or Mods here - remember to raise a ticket with phpauction.net as well
Post Reply
bamse
Posts: 220
Joined: Mon Feb 06, 2012 12:05 pm
Contact:

Truncating strings

Post by bamse » Wed Mar 19, 2014 10:07 pm

Not sure whether this is an issue in newer versions of phpauction.

Following is for my ancient v 2.11

In several places (e.g. in userProfile.php), strings are truncated in output using just

Code: Select all

substr($string)
This can create at least two problems:

1. strange characters can appear in UTF-8 encoded strings
2. if $string contains html-tags truncating in this way can create invalid html (e.g. by removing the closing tag or by cutting inside a tag

The first problem could be fixed using mb_substr($string,"UTF-8") instead of substr($string)

For the second problem one could strip_tags() the string or use a function like the following to preserve tags: http://alanwhipple.com/2011/05/25/php-t ... ags-words/

RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Re: Truncating strings

Post by RWAP » Thu Mar 20, 2014 10:06 am

Yes - this looks to have been rectified in v3.0 onwards where they use:

Code: Select all

<?=mb_substr($offer['name'],0,10,'utf-8');?>
for example

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest