com php-src: Optimized zend_is_true() for objects (in most cases, it doesn't need to call the conversion handler).: Zend/zend_operators .h
| From: | Dmitry Stogov | Date: | Mon, 20 Nov 2017 09:38:31 +0000 |
| Subject: | com php-src: Optimized zend_is_true() for objects (in most cases, it doesn't need to call the conversion handler).: Zend/zend_operators .h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100318@lists.php.net to get a copy of this message | ||
Commit: efa4d8d3acead0cf21315f57ac2da1a08efa86ab
Author: Dmitry Stogov <dmitry@zend.com> Mon, 20 Nov 2017 12:38:31 +0300
Parents: f5dbe081efcc840048f2a5f454690621f0676beb
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=efa4d8d3acead0cf21315f57ac2da1a08efa86ab
Log:
Optimized zend_is_true() for objects (in most cases, it doesn't need to call the conversion
handler).
Changed paths:
M Zend/zend_operators.h
Diff:
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 913ab71..366fa1e 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -38,6 +38,7 @@
#include "zend_portability.h"
#include "zend_strtod.h"
#include "zend_multiply.h"
+#include "zend_object_handlers.h"
#define LONG_SIGN_MASK (((zend_long)1) << (8*sizeof(zend_long)-1))
@@ -335,7 +336,11 @@ again:
}
break;
case IS_OBJECT:
- result = zend_object_is_true(op);
+ if (EXPECTED(Z_OBJ_HT_P(op)->cast_object == zend_std_cast_object_tostring)) {
+ result = 1;
+ } else {
+ result = zend_object_is_true(op);
+ }
break;
case IS_RESOURCE:
if (EXPECTED(Z_RES_HANDLE_P(op))) {