Skip to content

Instantly share code, notes, and snippets.

@naxhh
Last active August 29, 2015 14:10
Show Gist options
  • Save naxhh/08fc8e1c97cb0ba2f0ca to your computer and use it in GitHub Desktop.
Save naxhh/08fc8e1c97cb0ba2f0ca to your computer and use it in GitHub Desktop.
PHP POC of an error
<?php
/**
* POC of an error.
*
* Error log was confusing:
*
* PHP Fatal error: Call to undefined method Config::getClassInfo() in /path/Config.php on line 475
* PHP Fatal error: Class 'GetEnvironmentInfo' not found in /path/autoprepend5.lib.php on line 327
*
* Finally problem was related to I18N class.
* When setting the locale to tr_TR only.
*
* @see https://bugs.php.net/bug.php?id=35050
*
* This is fixed for PHP >= 3.4.0
*
*/
$class = new Test;
setlocale(LC_CTYPE, 'en_US.UTF-8');
$class->methodI();
setlocale(LC_CTYPE, 'tr_TR.UTF-8');
$class->methodI();
class Test {
public function methodI() {
echo setlocale(LC_CTYPE, 0) . PHP_EOL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment