[PHP-DEV] Newbie Question - Updating Object Properties in the Hash From: fademail <email protected>
Date: 05/01/00

I am new to php development and am having the following problem -

I have a function which is registered as a method for an object. In this method I am attempting to update a property of the object but can't seem to get it working right. Here is what I am doing:

I add the string property and the method to the object in the function that serves as a constructor like this:

object_init(return_value);
add_property_string(return_value, "m_cPrefValue", value->value.str.val,1);
add_method(return_value, "getuserpreference", PHP3_GetUserPreference);
return;

In the getuserpreference method I then need to store a new value for the property m_cPrefValue so I try this:

pval * cPrefValue;

getThis(&id);
_php3_hash_update(id->value.ht, "m_cPrefValue", sizeof("m_cPrefValue"), "newstring" , sizeof("newstring"), (void **)&cPrefValue);

But that doesn't change the value in the hash because when I then access the property in the php script - i get the unupdated value.

I am able to get the property from within the function using:
_php3_hash_find(id->value.ht,"m_cPrefValue", sizeof("m_cPrefValue"),(void **)&cPrefValue);

If anyone could let me know what I am doing wrong I would very much appreciate it. Thanks

Daniel Swanson

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>