On Tue, Aug 31, 2004 at 09:48:47PM -0700, Andi Gutmans wrote:
> It does look as if you're right. I don't quite understand why the standard
> was written in such a way and not in a way which only makes the value
> itself undefined.
> I think we can apply the patch. Does anyone have a problem with setting
> arbitrary numbers such as LONG_MAX/LONG_MIN for an undefined conversion?
I didn't see any objections; so could this be committed?
(the patch again below for reference)
Index: Zend/zend_operators.c
===================================================================
RCS file: /repository/ZendEngine2/zend_operators.c,v
retrieving revision 1.194
diff -u -r1.194 zend_operators.c
--- Zend/zend_operators.c 19 Jul 2004 07:19:02 -0000 1.194
+++ Zend/zend_operators.c 27 Aug 2004 12:15:12 -0000
@@ -183,7 +183,15 @@
}
-#define DVAL_TO_LVAL(d, l) (l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d)
+#define DVAL_TO_LVAL(d, l) do { \
+ if ((d) > LONG_MAX) { \
+ l = LONG_MAX; \
+ } else if ((d) < LONG_MIN) { \
+ l = LONG_MIN; \
+ } else { \
+ l = (d); \
+ } \
+} while (0)
#define zendi_convert_to_long(op, holder, result)
\
if (op==result) {
\
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php