bug in GetLookupValues uses !empty() and should use isset()

46 views
Skip to first unread message

Mike

unread,
Dec 9, 2009, 12:56:46 PM12/9/09
to PHRETS
In function GetLookupValues, if the key comes in as a numeric 0, then
it is ignored since 0 is considered empty by php. Changing the !empty
() to isset() does not skip this entry in the lookup table.
Specifically, I changed:

if (!empty($key->Value)) {

to

if (isset($key->Value)) {

in the following code snippet around line 781 of the 1.0rc1 release of
phrets:

foreach ($lookup_xml_array as $key) {
if (!empty($key->Value)) {

$metadataentryid = isset($key-
>MetadataEntryID) ? "{$key->MetadataEntryID}" : "";
$value = isset($key->Value) ?
"{$key->Value}" : "";
$shortvalue = isset($key-
>ShortValue) ? "{$key->ShortValue}" : "";
$longvalue = isset($key-
>LongValue) ? "{$key->LongValue}" : "";

$this_table[] = array
('MetadataEntryID' => $metadataentryid, 'Value' => $value,
'ShortValue' => $shortvalue,

'LongValue' => $longvalue);
}
}

Troy Davisson

unread,
Dec 9, 2009, 8:09:15 PM12/9/09
to phr...@googlegroups.com
Good catch.  Changed in my development copy for the next release.




--

You received this message because you are subscribed to the Google Groups "PHRETS" group.
To post to this group, send email to phr...@googlegroups.com.
To unsubscribe from this group, send email to phrets+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/phrets?hl=en.



Gregory Moore

unread,
Dec 10, 2009, 7:27:54 AM12/10/09
to phr...@googlegroups.com
Troy,

Could this possibly the reasoning that some of listings were being ignored?
 As mentioned several weeks ago, I was missing a few entries. Each one did indeed have a "0" (zero) within the id.

I will run some more tests this afternoon and report back.

Gregg

Tanveer

unread,
Jan 28, 2010, 11:36:33 PM1/28/10
to PHRETS
I am a newbie to the world of RETS and PHP as well; while trying to
get the Resource, Classes, and Table and Lookup values info in one go
I come across a bug [think it is a bug] in PHRets. Just want it to
report you people may be it really is another bug in the
GetLookUpValues function of phrets release 1.0rc1.

When trying to retrieve values for like e.g.
System Name is [ContactAddlPhoneType1], LookupName is
[ContactAddlPhoneType] of Datatype Character
The Lookup Values are:

Warning: Invalid argument supplied for foreach() in E:\xampp-w32\www
\testrets\phrets-1.0rc1.php on line 779
System Name is [ContactAddlPhoneType2], LookupName is
[ContactAddlPhoneType] of Datatype Character
The Lookup Values are:

Warning: Invalid argument supplied for foreach() in E:\xampp-w32\www
\testrets\phrets-1.0rc1.php on line 779
System Name is [ContactAddlPhoneType3], LookupName is
[ContactAddlPhoneType] of Datatype Character

where a common lookup name is being shared amongst multiple SystemName
fields. I did try the fix suggested by Mike above but it did not
worked for me and the key in this case is also not an int.

On Dec 10 2009, 5:27 pm, Gregory Moore <gregg.moor...@gmail.com>
wrote:


> Troy,
>
> Could this possibly the reasoning that some of listings were being  
> ignored?
>   As mentioned several weeks ago, I was missing a few entries. Each  
> one did indeed have a "0" (zero) within the id.
>
> I will run some more tests this afternoon and report back.
>
> Gregg
>
> On Dec 9, 2009, at 8:09 PM, Troy Davisson wrote:
>
>
>
> > Good catch.  Changed in my development copy for the next release.
>

> > .- Hide quoted text -
>
> - Show quoted text -

Reply all
Reply to author
Forward
0 new messages