tags:

views:

47

answers:

2

I have a web application that runs fine on our Linux servers but when running on Mac OS with the Zend Community Edition Server using PHP 5.3 we get the error "usort(): Array was modified by the user comparison function " every time a page loads for the first time (it takes about 2 minutes for a page to tick over and load, on the linux servers the page loads in 1 second).

Has anyone else experienced this or has any idea how I can fix the problem, I have tried playing around with PHP and Apache memory settings with no luck.

Thanks in advance

A: 

What version of PHP is on the linux box?

Are the error_reporting levels the same on both boxes? Try setting them both to E_ALL.

The warning is almost certainly not lying. It's saying that the comparison function you're passing to usort() is changing the array that you're trying to sort - that could definitely make usort take a long time, possibly forever!

My first step would be to study the comparison function, and figure out why that's happening. It's possible that if the linux boxes are using a pre-5.3 version, there is some difference in the behavior of some language function used in the comparison function.

timdev
It is the same version of PHP on both servers, PHP 5.3.2. I will check the comparison functions.
Michael
If the versions are the same, I'd be very keen on making sure the code is actually the same, and any inputs are the same. But looking at whatever line the warning points you to is a good place to start. You might want to paste your comparison function and some example data into your question if you don't find the issue yourself.
timdev
A: 

This issue was resolved by moving from Zend Server CE to XAMPP. Seems to be a Zend Server CE problem.

Michael