Re: [PHP] Problem with Object references in an array via for loop

2008-05-29 Thread David Moylan
Also, for the record: Referring to the objects in the array directly works fine. So, syntax like $secs[$sid] = new CustomSecurity(); $secs[$sid]->load($sid); is fine, as I would expect. Don't have to define it to a simple variable like $obj in the code below. Further, if I then do $sec =

Re: [PHP] Problem with Object references in an array via for loop

2008-05-29 Thread David Moylan
Solved this. I tried setting a class variable directly and didn't have the same issue (should have tried that long ago). So that told me that my error was somewhere in some lower level code when I initialize my objects. I tracked it down to a problem where I wasn't cloning properly when I ne

Re: [PHP] Problem with Object references in an array via for loop

2008-05-29 Thread Robert Cummings
On Thu, 2008-05-29 at 14:01 -0300, Gabriel Sosa wrote: > try doing this > > $secs = array(); > foreach($_GET['sids'] as $sid){ > $obj = null; > $obj = new CustomSecurity(); > $obj->set(array('customSecurityID' => $sid)); > $secs[] = $obj; > } No, no, no. If it's a reference issue you need to

Re: [PHP] Problem with Object references in an array via for loop

2008-05-29 Thread David Moylan
Well, I did that except I'm providing the key explicitly. However, I've tried it now without the key and it's the same except for the key value. Very frustrating. Dave Gabriel Sosa wrote: I thought this line it may help, not actually the null $secs[] = $obj; i will still researching about

Re: [PHP] Problem with Object references in an array via for loop

2008-05-29 Thread Gabriel Sosa
I thought this line it may help, not actually the null $secs[] = $obj; i will still researching about this On Thu, May 29, 2008 at 2:08 PM, David Moylan <[EMAIL PROTECTED]> wrote: > Nope. Same performance. I originally had something like this (minus the > assigment to null) but I thought the c

Re: [PHP] Problem with Object references in an array via for loop

2008-05-29 Thread David Moylan
Nope. Same performance. I originally had something like this (minus the assigment to null) but I thought the confusion was in the variable assignment so I went directly to the array. I've tried your code exactly and get the same thing, assignment to null doesn't help. Dave Gabriel Sosa wro

Re: [PHP] Problem with Object references in an array via for loop

2008-05-29 Thread Gabriel Sosa
try doing this $secs = array(); foreach($_GET['sids'] as $sid){ $obj = null; $obj = new CustomSecurity(); $obj->set(array('customSecurityID' => $sid)); $secs[] = $obj; } i just don't know if the operator -> it's working wll over object arrays saludos On Thu, May 29, 2008 at 1:31 PM, Davi

[PHP] Problem with Object references in an array via for loop

2008-05-29 Thread David Moylan
I have a snippet of code like this which works fine in PHP4. $secs = array(); foreach($_GET['sids'] as $sid){ $secs[$sid] = new CustomSecurity(); $secs[$sid]->set(array('customSecurityID' => $sid)); } However, in PHP5 (5.2.4) the array has the proper keys in it but all of the array values