php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch 31Jan2011_50813.diff_zend_object_handlers.c for Scripting Engine problem Bug #50813

Patch version 2011-02-01 06:53 UTC

Return to Bug #50813 | Download this patch
Patch Revisions:

Developer: mjk@emmjaykay.org

--- php-5.3.5.orig/Zend/zend_object_handlers.c	2010-11-02 18:35:26.000000000 -0700
+++ php-5.3.5/Zend/zend_object_handlers.c	2011-01-31 22:50:22.317984043 -0800
@@ -66,31 +66,6 @@
 }
 /* }}} */
 
-static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) /* {{{ */
-{
-	zval *retval = NULL;
-	zend_class_entry *ce = Z_OBJCE_P(object);
-
-	/* __get handler is called with one argument:
-	      property name
-
-	   it should return whether the call was successfull or not
-	*/
-
-	SEPARATE_ARG_IF_REF(member);
-
-	zend_call_method_with_1_params(&object, ce, &ce->__get, ZEND_GET_FUNC_NAME, &retval, member);
-
-	zval_ptr_dtor(&member);
-
-	if (retval) {
-		Z_DELREF_P(retval);
-	}
-
-	return retval;
-}
-/* }}} */
-
 static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */
 {
 	zval *retval = NULL;
@@ -158,6 +133,41 @@
 }
 /* }}} */
 
+
+static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) /* {{{ */
+{
+	zval *retval = NULL;
+	zend_class_entry *ce = Z_OBJCE_P(object);
+
+	/* __get handler is called with one argument:
+	      property name
+
+	   it should return whether the call was successfull or not
+	*/
+	zval *rv = NULL;
+
+	rv = zend_std_call_issetter(object, member TSRMLS_DC);
+ 
+	if (rv != NULL  &&
+		rv->value.lval == 1) {
+
+		SEPARATE_ARG_IF_REF(member);
+
+		zend_call_method_with_1_params(&object, ce, &ce->__get, ZEND_GET_FUNC_NAME, &retval, member);
+	
+		zval_ptr_dtor(&member);
+
+		if (retval) {
+			Z_DELREF_P(retval);
+		}
+
+		return retval;
+	} else {
+		return rv;
+	}
+}
+/* }}} */
+
 static int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce TSRMLS_DC) /* {{{ */
 {
 	switch (property_info->flags & ZEND_ACC_PPP_MASK) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 19:01:29 2024 UTC