0

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)));
James Alday
  • 873
  • 9
  • 23
  • Are you using `strtolower` around where this is happening? If so, you might need to use `mb_convert_case` or `mb_strtolower`. – bigmike7801 Apr 23 '14 at 16:07
  • 341 matches across 123 files. Yikes. I figured that might be a culprit as well, but I'm not sure how it would just start cropping up out of nowhere. I'll try to find one of the exact queries that's failing and test that. Thanks! – James Alday Apr 23 '14 at 16:14
  • Ok - just found a query in my login controller that is throwing this error, but it has no user entry whatsoever - it's just doing a find all on available regions in the system. No strtolower and no utf-8 input in the query. – James Alday Apr 23 '14 at 16:19
  • You should add this code as well as a brief explanation to your question above. – bigmike7801 Apr 23 '14 at 16:34

0 Answers0