Strange Error Displayed - Undefined variable: now
Posted: 27 June 2008 07:59 PM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  112
Joined  07-09-2007

On my blog post detail page I get the following message displayed at the top right where my first weblog entries tag appears.

I thought possibly it was view tracking, so I turned that off temporarily, but the issue didn’t go away. I also thought it might be the related posts by tag functionality (from Solspace’s Tag module) I recently added but that didn’t make it go away either.

I thought it might be GZip output which has been known to cause issues. No help disabling that either.

I recently upgraded this morning from 1.6.2 to 1.6.4 but didn’t notice this error until late this evening. The error is below… any help is appreciated.

Notice: Undefined variable: now in [path to system folder removed]/core/core.functions.php on line 1901

Reproduce by viewing any of my blog posts:

http://www.iso-100.com/blog/post/expressionengine-164-released/

No other page on my site other than a blog post detail page causes the issue.

NOTE: For some strange reason, I’m not seeing this error when I’m also logged into the admin console in that browser. As soon as I log out, I get the error.

Profile
 
 
Posted: 27 June 2008 08:46 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  10898
Joined  04-29-2002

Yeah, I was having issues when viewing your posts as a visitor.

But things have gotten better lately.. did you do something to fix it?

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Most recent build notes - 20080808

Profile
MSG
 
 
Posted: 27 June 2008 08:56 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  112
Joined  07-09-2007

I’m still seeing the message in FF3 and Safari 3.1, Sue. Are you not seeing it?

Profile
 
 
Posted: 27 June 2008 10:30 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
RankRank
Total Posts:  112
Joined  07-09-2007

Any ideas Sue?

Here’s a snippet from core.functions.php, with the referenced error line the one starting with $img_name:

/** -----------------------------------
        /**  Generate the image
        /** -----------------------------------*/
        
        $img_name = $now.'.jpg';

        
ImageJPEG($im, $img_path.$img_name);

Profile
 
 
Posted: 27 June 2008 10:33 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
RankRank
Total Posts:  112
Joined  07-09-2007

Updating my own post. This lead me to believe it had something to do with Captcha because I couldn’t think of anything else generating a time-based jpg.

I turned off “use truetype fonts” in the captcha settings and the error went away… but so did Captcha on the comment form.

I hope this helped nail things down…

Profile
 
 
Posted: 27 June 2008 10:34 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
RankRank
Total Posts:  112
Joined  07-09-2007

Argh. Scratch that… logging into the control panel is what made the error go away. Back to the drawing board.

I still think this is captcha related.

[Edit: Confirmed. Disabled captcha and the error is gone. Wonder what’s up with “now”?]

Profile
 
 
Posted: 29 June 2008 10:38 AM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  21199
Joined  05-20-2002

Hm- odd.  And you’re right- it’s captcha related.  Basically, $now is definied:

if ((mt_rand() % 100) < $SESS->gc_probability)
        
{
            $old
= time() - $expiration;
            
$DB->query("DELETE FROM exp_captcha WHERE date < ".$old);        

            list(
$usec, $sec) = explode(" ", microtime());
            
$now = ((float)$usec + (float)$sec);
etc...

You error outside of conditionals on

        
/** -----------------------------------
        /**  Generate the image
        /** -----------------------------------*/
        
        
$img_name = $now.'.jpg';

Something seems odd about that.  $now should be defined regardless, at least from looking at it.  Else you get the error. 

So- pulled up 1.6.3- and don’t spot that conditional in there.  So I’m thinking it’s a bug.  Let me give the crew a yell.  Until then- might just try adding

$now = ((float)$usec + (float)$sec);

Put that just above the

if ((mt_rand() % 100) < $SESS->gc_probability)
        
{

I can’t see why that wouldn’t work for now.  Or- could ditch the conditional entirely, which I know would work.  But it’s in there to try and make things a bit leaner, so I’d go w/the first option if it works.

And like I say- I’ll yell for the crew.

 Signature 

AKA rob1

Help Request Tips * Pro Network

Profile
 
 
Posted: 30 June 2008 10:17 AM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  21199
Joined  05-20-2002

Does look like a confirmed bug- and Derek notes that a temp fix is to put:

list($usec, $sec) = explode(" ", microtime());
$now = ((float)$usec + (float)$sec);
if ((
mt_rand() % 100) < $SESS->gc_probability)
etc...

I’ll take care of the bug reporting- otherwise we good to close for now?

 Signature 

AKA rob1

Help Request Tips * Pro Network

Profile
 
 
Posted: 02 July 2008 02:37 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
RankRank
Total Posts:  112
Joined  07-09-2007

Sounds good. I’ll have to try that fix sometime. For now, no CAPTCHA and Akismet instead.

Profile
 
 
Posted: 02 July 2008 03:50 PM   [ Ignore ]   [ # 9 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12918
Joined  05-15-2004

Closing this one out.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 60730 Total Logged-in Users: 25
Total Topics: 73195 Total Anonymous Users: 20
Total Replies: 394740 Total Guests: 489
Total Posts: 467935    
Members ( View Memberlist )
Newest Members:  LambergbcurranChethansisiharmonijoe_carneypsykonautJitsunROPasterfredpwsAnita V