summaryrefslogtreecommitdiff
path: root/Zend/zend_operators.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2002-08-08 16:32:34 +0000
committerAndi Gutmans <andi@php.net>2002-08-08 16:32:34 +0000
commit52406cb37c3b62a93cff0d15ae7d7a85cd7fd419 (patch)
treea0f531428218e3e49d72736711dfa3ffd30be9f1 /Zend/zend_operators.c
parent7904787f950ea7b95f53d64af341c0a88393b748 (diff)
downloadphp-git-52406cb37c3b62a93cff0d15ae7d7a85cd7fd419.tar.gz
- Make new 'is' operator work with classes only and return false when
- the object isn't of the said class or the value isn't an object.
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r--Zend/zend_operators.c55
1 files changed, 8 insertions, 47 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 2e8d79e522..897d807020 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1358,57 +1358,18 @@ ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSR
}
-ZEND_API int is_type_function(zval *result, zval *op1, zend_class_entry *class, int type TSRMLS_DC)
+ZEND_API int is_class_function(zval *result, zval *op1, zend_class_entry *class TSRMLS_DC)
{
- if (class) {
- if (Z_TYPE_P(op1) == IS_OBJECT) {
- zend_class_entry *ce;
- for (ce = Z_OBJCE_P(op1); ce != NULL; ce = ce->parent) {
- if (ce == class) {
- ZVAL_BOOL(result, 1);
- return SUCCESS;
- }
+ if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_class_entry *ce;
+ for (ce = Z_OBJCE_P(op1); ce != NULL; ce = ce->parent) {
+ if (ce == class) {
+ ZVAL_BOOL(result, 1);
+ return SUCCESS;
}
- ZVAL_BOOL(result, 0);
- } else {
- ZVAL_BOOL(result, 0);
}
- return SUCCESS;
- }
-
- switch (type) {
- case IS_NULL:
- ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_NULL);
- break;
-
- case IS_LONG:
- ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_LONG);
- break;
-
- case IS_DOUBLE:
- ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_DOUBLE);
- break;
-
- case IS_STRING:
- ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_STRING);
- break;
-
- case IS_ARRAY:
- ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_ARRAY);
- break;
-
- case IS_OBJECT:
- ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_OBJECT);
- break;
-
- case IS_BOOL:
- ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_BOOL);
- break;
-
- default:
- zend_error(E_ERROR, "Unknown operand type");
- return FAILURE;
}
+ ZVAL_BOOL(result, 0);
return SUCCESS;
}