Problem with eAccelerator and Doctrine 2
When you see message “Class X is not a valid entity or mapped super class” you can solve this problem with adding two lines to the .htaccess file:
php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0
There is also
article which describes problem mentioned above.
How to set/change host in Symfony 2 command?
$host = $this->getContainer()->getParameter('host');
$this->getContainer()->get('router')->getContext()->setHost($host);
$this->getContainer()->get('router')->getContext()->setScheme('https');
$this->getContainer()->get('router')->getContext()->setBaseUrl('/web');
How to trim non-breaking space in PHP
Use this snippet:
$trim = trim($text, " \xC2\xA0\n\t\r\0\x0B");
\xC2\xA0 is non-breaking space (alt+space in mac os x)
Turn off deprecated warnings
Deprecated: Function split() is deprecated in deprecated.php on line 9
Simply turn off these warnings in your php.ini
1.error_reporting = E_ALL & ~E_DEPRECATED
Or during runtime
1.error_reporting(E_ALL & ~E_DEPRECATED);
Following function will throw this warning:
- call_user_method_array() instead use call_user_func_array()
- define_syslog_variables()
- dl()
- ereg_replace() instead use preg_replace()
- eregi() instead use preg_match()
- eregi_replace() instead use preg_replace()
- set_magic_quotes_runtime() instead use magic_quotes_runtime()
- session_register() instead use setzte Variable über $_SESSION
- session_unregister()
- session_is_registered()
- set_socket_blocking() instead use stream_set_blocking()
- split() instead use preg_split()
- spliti() instead use preg_split()
- sql_regcase()
- mysql_db_query() instead use mysql_select_db() oder mysql_query()
- mysql_escape_string() instead use mysql_real_escape_string()
How to capitalize UTF-8 string in PHP?
Sometimes I have to capitalize words in my pages. The problem is these words are encoded in UTF-8. Simple solution to resolve it:
$word = 'kędzierzyn-koźle';
$word = mb_convert_case($word, MB_CASE_TITLE, 'UTF-8');