Donate Share

PHP UTF-8

Tracker: Bugs

5 Some files can't be required by a function - ID: 1568924
Last Update: Comment added ( harryf )

<?php
public function singleRepresentation($str)
{
// dynamically requiring file of phputf8 library,
// as it is only required if this function is
// called
require_once 'utf8/utils/ascii.php';
return utf8_decode(utf8_accents_to_ascii($str));
}
?>
Problem is!

utf8/utils/ascii.php contains global variables
$UTF8_LOWER_ACCENTS & $UTF8_UPPER_ACCENTS which
when required by a function become local to that
function!

Resulting in problems for utf8_accents_to_ascii()
that can no longer locate the variables it needs.

The solution is to change:
<?php
$UTF8_LOWER_ACCENTS = array(...);
?>
to
<?php
$GLOBALS['UTF8_LOWER_ACCENTS'] = array(...);
?>
If the bug is still difficult to understand have a look
at http://forums.devnetwork.net/viewtopic.php?p=315239


ole ( irkengir ) - 2006-10-01 22:07

5

Closed

Fixed

Harry Fuecks

UTF-8 Utils (./utils)

<= 0.3

Public


Comments ( 2 )




Date: 2006-10-25 20:09
Sender: harryfProject Admin

Logged In: YES
user_id=569780

OK - next release (0.4) containing this fix is out


Date: 2006-10-16 20:40
Sender: harryfProject Admin

Logged In: YES
user_id=569780

OK - now fixed in CVS - release coming soon. In fact the
utf8_accents_to_ascii() fn was badly broken - now works.


Log in to comment.

Attached File

No Files Currently Attached

Changes ( 7 )

Field Old Value Date By
status_id Open 2006-10-25 20:09 harryf
close_date - 2006-10-25 20:09 harryf
resolution_id Accepted 2006-10-16 20:40 harryf
resolution_id None 2006-10-04 10:54 harryf
assigned_to nobody 2006-10-04 10:54 harryf
category_id String Functions 2006-10-04 10:54 harryf
artifact_group_id None 2006-10-04 10:54 harryf