You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Ram Sharma (JIRA)" <ji...@apache.org> on 2008/06/09 09:03:45 UTC

[jira] Commented: (SHINDIG-367) Code was written to return only the requested profile fields but it was changing the object value right after the first value check.

    [ https://issues.apache.org/jira/browse/SHINDIG-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603484#action_12603484 ] 

Ram Sharma commented on SHINDIG-367:
------------------------------------

Hi Kevin,
So what Component should I choose for this issue.

> Code was written to return only the requested profile fields but it was changing the object value right after the first value check.
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-367
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-367
>             Project: Shindig
>          Issue Type: Bug
>          Components: Sample container & Examples
>         Environment: Windows, Apache
>            Reporter: Ram Sharma
>
> In php\src\socialdata\samplecontainer\BasicPeopleService.php following code is written to return only those fields which are requested by the gadget/client.
> if (is_array($profileDetails) && count($profileDetails)) {
> 					$newPerson = array();
> 					$newPerson['isOwner'] = $person->isOwner;
> 					$newPerson['isViewer'] = $person->isViewer;
> 					$newPerson['name'] = $person->name;
> 					foreach ($profileDetails as $field) {
> 						if (isset($person->$field) && ! isset($newPerson[$field])) {
> 							$newPerson[$field] = $person->$field;
> 						}
> 						$person = $newPerson;
> 					}
> }
> But the line $person = $newPerson; which is inside the foreach loop was resetting the people object just after the first field check. So other fields are getting reset(unset) and not retrieved by the code even after the fields are there in data source.
> I just took out the $person = $newPerson; from the foreach loop and it started retrieving all the requested fields. Now code for the same looks like:
> if (is_array($profileDetails) && count($profileDetails)) {
> 					$newPerson = array();
> 					$newPerson['isOwner'] = $person->isOwner;
> 					$newPerson['isViewer'] = $person->isViewer;
> 					$newPerson['name'] = $person->name;
> 					foreach ($profileDetails as $field) {
> 						if (isset($person->$field) && ! isset($newPerson[$field])) {
> 							$newPerson[$field] = $person->$field;
> 						}
> 					}
> $person = $newPerson;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.