ZF-7413: strpos() operations on objects cause segfaults
It has come to my attention that Zend_Date() causes a segfault when you pass another Zend_Date object to its constructor. After some debugging I realized that this segfault is caused by Zend_Locale calling strpos() on that Zend_Date object in _prepareLocale().
I realize that this is probably really a PHP bug, but it seems cleaner if _prepareLocale() casts $locale to a string first before performing any string operations on it.
I was able to reproduce this by executing the following command:
php -r 'require_once "Zend/Date.php"; $x = new Zend_Date(); $y = new Zend_Date($x);'
Note that I'm only able to reproduce this problem on one out of three servers I've tested this on. I was able to reproduce it under 32-bit Debian Linux 5.0. I was not able to reproduce it under 64-bit Debian Linux 4.0 or 5.0.
I am attaching a patch that will fix the segmentation fault by casting $locale to a string at an earlier point.