Failing tests on Mac

From: Date: Tue, 09 Oct 2007 15:29:28 +0000
Subject: Failing tests on Mac
Groups: php.qa 
Request: Send a blank email to php-qa+get-49724@lists.php.net to get a copy of this message
Tony and Raghu I've scanned through a few of the tests that are failing on Mac OSX. This is a summary of what I've found and relates to failures in the following test: strspn_variation3.phpt - see defect #42868 and is likely to apply to: strncmp_variation5.phpt strncasecmp_variation3.phpt strcspn_variation3.phpt and possibly others. In each case the test is passing a double to the function being tested, and the value of the double is > PHP_INT_MAX. The function is expecting to get an integer value and so the double is cast to a long in the function implementation without any checks on the value of the double. When a double that is greater than PHP_INT_MAX is cast as a long, the result on Linux and Windows as an integer value somewhere between -PHP_INT_MAX -1 and +PHP_INT_MAX, so in some cases the resulting long may have a reasonable value. On a Mac the resulting long is either -1 or some other negative number. The behaviour on all platforms is equally undesirable. I am not sure of how to proceed with this. Each function that displays this behaviour could have an additional check added to make sure that the input is sensible - but that might be a lot of fixes. Alternatively - zend_parse_parameters could be fixed to check the value of a double before casting to a long. This sounds as though it might have far reaching effects - and possibly ones that might break other code (certainly would break other tests). The other possibility is to leave the behaviour as it is and code different test cases for platforms that behave like the Mac. This is not an option I particularly like. Can you come up with any better ideas? Zoe Slattery

« previous php.qa (#49724) next »