[pLog-svn] r3198 - plog/trunk
Mark Wu
markplace at gmail.com
Fri Apr 7 03:49:41 GMT 2006
I am using windowsXP + php 5.1.2
Mark
> -----Original Message-----
> From: Mark Wu [mailto:markplace at gmail.com]
> Sent: Friday, April 07, 2006 11:45 AM
> To: 'plog-svn at devel.lifetype.net'
> Subject: RE: [pLog-svn] r3198 - plog/trunk
>
> Ah.... I see, I think you are right.
>
> You should use the original object instead of the copy one.
>
> But the weird thing is the original code worked in Windows+php5 ...
>
> That's why I never find this bug.
>
> But, why it works in my machine? Because the OS? Or PHP version?
>
> Mark
>
> > -----Original Message-----
> > From: plog-svn-bounces at devel.lifetype.net
> > [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Oscar
> > Renalias
> > Sent: Friday, April 07, 2006 5:32 AM
> > To: plog-svn at devel.lifetype.net
> > Subject: Re: [pLog-svn] r3198 - plog/trunk
> >
> > You are right. The problem here, I believe, is that by doing this
> >
> > foreach( $checkGroups as $checks ) {
> >
> > PHP was creating a copy of each array in the $checkGroups array and
> > storing it in $checks, as opposed to using a reference. What was
> > happening is that later on, we were passing $checkGroups to the
> > template instead of $checks and since we had been working
> on a copy of
> > each one of the subarrays, the objects in $checkGroup had been
> > initialized correctly but the validate() had not been run therefore
> > isValid() was returning a negative result.
> >
> > What I just did is that we are now working on the original array
> > $checkGroups by using indexes to access it... I really
> didn't know it
> > worked like this, so we had to find out the hard way.
> >
> > Oscar
> >
> > On 4/6/06, Jon Daley <plogworld at jon.limedaley.com> wrote:
> > > I don't understand why this change was needed.
> The $checks
> > > object is a separate object than the $checkGroups, so if
> you modify
> > > $checks, $checkGroups isn't changed?
> > > If that is the case, I want to keep that in my
> > head, because
> > > that looks like an easy way for me to screw up something.
> > >
> > >
> > > On Thu, 6 Apr 2006, oscar at devel.lifetype.net wrote:
> > > >
> > > > this was a tricky one... All checks were being
> > unsuccessful in the
> > > > wizard template because the objects that was being
> passed in the
> > > > array were not the same objects that were being
> > instantiated and executed.
> > > >
> > > > Modified: plog/trunk/wizard.php
> > > >
> > ===================================================================
> > > > --- plog/trunk/wizard.php 2006-04-06 11:49:20 UTC (rev 3197)
> > > > +++ plog/trunk/wizard.php 2006-04-06 20:26:24 UTC (rev 3198)
> > > > - foreach( $checkGroups as $checks ) {
> > > > + foreach( $checkGroups as $checkGroup => $checks ) {
> > > > foreach( $checks as $id => $check ) {
> > > > - $valid = $checks["$id"]->validate();
> > > > + $valid =
> > > > + $checkGroups[$checkGroup][$id]->validate();
> > > > // if it doesn't validate but it's
> > not critical, then we can proced too
> > > > - if( !$checks["$id"]->isCritical())
> > > > - $valid = true;
> > > > + if(
> > !$checkGroups[$checkGroup][$id]->isCritical())
> > > > + $valid = true;
> > > > $ok = ($ok && $valid);
> > > _______________________________________________
> > > pLog-svn mailing list
> > > pLog-svn at devel.lifetype.net
> > > http://devel.lifetype.net/mailman/listinfo/plog-svn
> > >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list