I'm using CakePHP 2.4.2 to run a CMS site on Amazon Elastic Beanstalk servers with an RDS database. Starting last night I am seeing errors in my logs, and certain pages not loading (500 error) because of it:
error: [PDOException] SQLSTATE[HY000]: General error: 1300 Invalid utf8 character string: '\x88\xB7'
I sometimes see the same set of 'utf8' characters, but there are a bunch of different strings that end up in the error logs, so it is the same error but not the same bad string each time. Here are some of the other strings I have in my logs:
'\x88\xB7'
'\x88W'
'H\x85'
'\xB0\\x91\x84{\x7F'
'\xC0\x9C'
'\xE8V'
'\xD8\x0E'
'\xA4'
Before leaving work last night I pushed up an ebextension config to install Zend Opcode Caching to the servers. I have no proof that this is the source of the errors, but it seems the only change I've made to the server that could cause the errors - and was the last change made before they started cropping up. I pushed the code up at about 5pm and started seeing errors in the logs around 6pm.
For good measure, here is the config I used to enable opcache:
packages:
yum:
php55-opcache: []
I have several servers in production, sans the opcache package, with the same settings that are working fine, and I have been unable to reproduce such errors on my local testing box either.
Could I have found some kind of obscure bug with opcache or is there some more logical conclusion for what I'm seeing? Since these errors are happening deep in my code, I'm kind of at a loss for how I can even go about debugging it. I've searched through my code to make sure there are no bad characters in the code itself, but beyond that I'm kind of poking around in the dark.
UPDATE:
I've looked into whether this is caused by a bad strtolower() conversion on a UTF8 string, but one of the queries involved contains no user-inputted values and none of the conditions use a UTF8 string, so I do not believe it can be tracked to that. One of the queries that is failing is a lookup on all regions available in my login controller:
$regions = $this->Region->find('all', array('conditions' => array('do_not_display' => 0, 'active' => 1)));