Zend Server 7.0/PHP5.5 odd behavior

General discussion forum for the Zend Server
Post Reply
arek1115
Posts: 5
Joined: Tue Oct 07, 2014 1:41 pm

Zend Server 7.0/PHP5.5 odd behavior

Post by arek1115 » Tue Oct 07, 2014 3:22 pm

Platform: Windows 7 64-bit Professional
Installed: ZendServer-7.0.0-php-5.5.13-Windows_x86.exe

After upgrade from zend server 6, certain database driver's queries started to fail.
I inspected the parameters that were passed to the query and noticed something very strange
when inspecting the parameters even before they were sent to the database query.

Take a look at this stack trace

Stack trace:
'#0 C:\\...\\..File.php(1045): Service_Language->getLanguageValues(\'\\xCC\', 232742)
#1 C:\\..\\..Record.php(731): Service_File->getFirstLanguageCodeValues()
...

Method call: Service_Language->getLanguageValues(\'\\xCC\', 232742)
is coded as: $languageService->getLanguageValues('M', $mid);

And somehow, the first parameter gets fetched as '\xCC' instead like the passed 'M'.
This odd '\xCC' byte then gets passed as a query parameter, which ends up crashing the interpreter.

I don't know how to debug it on Windows, so I am simply posting this error behavior as is.

My temporary solution, is to use strtoupper('M') instead of passing a string literal and then it works.

User avatar
zvika
Zend Global Support
Posts: 997
Joined: Sun Dec 14, 2008 9:48 am
Contact:

Re: Zend Server 7.0/PHP5.5 odd behavior

Post by zvika » Mon Nov 10, 2014 2:34 pm

Hi Arek

The internal function strtoupper() uses the default encoding to convert the input character (perhaps from an ANSI / ISO-8859-1 PHP encoded text file? Try to convert to UTF-8 and run again).

It looks to me as MySQL encoding problem.
For quick test, alter the table column holding the 'M' from text to blob if applicable.

With this great article: http://www.toptal.com/php/a-utf-8-prime ... -and-mysql
See this relevant section in the article: "MySQL & UTF-8 Encoding – other things to consider"

I'm assuming you have upgraded your PHP as well as ZS version, which is the source of the change - check PHP default charset in the old and new installation (you should have an old /etc-6.3/php.ini under Zend Server after upgrade, compare to current /etc/php.ini)
Zvika Dror
Zend Support Team

Post Reply