Created
January 30, 2012 04:08
-
-
Save chobie/1702426 to your computer and use it in GitHub Desktop.
read_property: what's wrong?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/repository.c b/repository.c | |
index 88cc2bf..411f15d 100644 | |
--- a/repository.c | |
+++ b/repository.c | |
@@ -28,6 +28,30 @@ PHPAPI zend_class_entry *git2_repository_class_entry; | |
void php_git2_repository_init(TSRMLS_D); | |
static zend_object_handlers git2_repository_object_handlers; | |
+ | |
+static zval *php_git2_repository_read_property(zval *object, zval *member, int type TSRMLS_DC) | |
+{ | |
+ zval *retval; | |
+ zval **data = NULL; | |
+ char *key, *prop_key = NULL; | |
+ int key_len, prop_key_len = 0; | |
+ | |
+ prop_key = Z_STRVAL_P(member); | |
+ prop_key_len = Z_STRLEN_P(member); | |
+ | |
+ zend_mangle_property_name(&key, &key_len, "*", 1, prop_key, prop_key_len, 0); | |
+ if (zend_hash_find(Z_OBJPROP_P(object),key,key_len,(void **)&data) != SUCCESS) { | |
+ retval = &EG(uninitialized_zval); | |
+ } else { | |
+ php_var_dump(data, 1 TSRMLS_CC); | |
+ ALLOC_INIT_ZVAL(retval); | |
+ Z_SET_REFCOUNT_P(retval, 0); | |
+ ZVAL_ZVAL(retval,*data,1,0); | |
+ } | |
+ | |
+ return retval; | |
+} | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
o.O i've forget to release mangled key.