ID:               18556
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           Verified
-Bug Type:         *Languages/Translation
+Bug Type:         Scripting Engine problem
 Operating System: Linux (RedHat 7.2)
-PHP Version:      4.2.2
+PHP Version:      4.2.2,4.3.0-dev
 Assigned To:      hholzgra
 New Comment:

Verified with latest CVS head. The example script outputs:

Instantiating an infoBlob with a lowercase i<br>Foo<br>Instantiating an
InfoBlob with an uppercase I<br>
Fatal error: Cannot instantiate non-existent class:  �nfoblob in t.php
on line 18
t.php(18) : Fatal error - Cannot instantiate non-existent class: 
�nfoblob



Previous Comments:
------------------------------------------------------------------------

[2002-08-28 21:12:13] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

Something related to this was fixed in CVS. (the #16865 which this one
was marked duplicate of is closed)

------------------------------------------------------------------------

[2002-07-25 04:38:08] [EMAIL PROTECTED]

dup of #16865

------------------------------------------------------------------------

[2002-07-25 03:57:43] [EMAIL PROTECTED]

known problem, see regression test case tests/lang/035.phpt

------------------------------------------------------------------------

[2002-07-25 02:52:33] [EMAIL PROTECTED]

This bug is related to others submitted that refer to _constants_ being
affected by the locale change, but since this actually concerns a class
name, I wanted to submit it separately. Pardon the error if it turns
out to be one...

I'm internationalizing an app, which loads (include_once) a file called
'imc_Info.inc' containing two class definitions with their respective
constructors:
class Info
and
class InfoOracle

In the course of loading the index page, I call
new InfoOracle()
and perform a query. This works fine in English, Spanish, French, and
Greek. If I switch my app's locale to Turkish ('tr_TR'), however, I get
a error:
Cannot instantiate non-existent class:  ?acle in /var/www/html
(Yes, that ? appears in my logs). After searching for bug reports
concerning Turkish, I noticed some closed/bogus reports that mentioned
_case_, so I did some poking around.

Although my class constructor clearly reads
function InfoOracle() {
        blah blah blah
}
PHP fails to acknowledge it. The get_declared_classes() function DOES
return "info" and "infooracle" in its array though. 

So I tried changing my call to
new infooracle(), simply lowercasing the whole name. That worked like a
charm, in Turkish. I noticed in one of the other bug reports that
Turkish contains no "I" in its character set, which _sort of_ explains
the problem, but it still strikes me as a bug. Shouldn't class names
remain unaffected by the current locale?

The following script demonstrates the problem. It generates the first
output, then throws an error attempting the second.

---- SCRIPT ----
<?
// Set language to desired language 
$g_lang = 'tr_TR';
putenv("LANG=$g_lang"); 
setlocale(LC_ALL, $g_lang);

class InfoBlob {
   var $foo;
   function InfoBlob() {
      $this->foo = "Foo";
   }
}

echo ('Instantiating an infoBlob with a lowercase i<br>');
$foobar = new infoBlob();
echo ($foobar->foo);
echo ('<br>Instantiating an InfoBlob with an uppercase I<br>');
$foobar = new InfoBlob();
echo ($foobar->foo);
?>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=18556&edit=1

Reply via email to