ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Upgrade from 1.6.3-1.6.4 causing PHP issues

July 10, 2008 10:22am

Subscribe [1]
  • #1 / Jul 10, 2008 10:22am

    woodlander

    33 posts

    I’m wondering if anyone can help.  I’m not familiar with PHP, so I have no idea what I’m looking at here.  The upgrade is causing the following notice to appear at the top of my weblogs:

    Notice: Undefined variable: now in /home/.../system/core/core.functions.php on line 1901

    Line 1901 is:

    $img_name = $now.’.jpg’;

    Can anyone offer a brief description on what this means?  Should I contact my web developer?
    Thanks, Courtney

  • #2 / Jul 10, 2008 10:49am

    Mr. Wilson

    131 posts

    Hi Courtney,

    That error is inside EE’s create_captcha() function. The short story is that it’s possible for the variable $now to not be set before it is used on line 1901. The variable is created inside a conditional that begins at line 1761:

    if ((mt_rand() % 100) < $SESS->gc_probability)
            {
                ...blah blah blah…
    
                $now = ((float)$usec + (float)$sec);
    
                ...blah blah blah…
            }

    If that conditional doesn’t evaluate to true, then $now is never set, and you get the PHP notice you pointed out. On a quick glance, this appears to be a bug.

  • #3 / Jul 10, 2008 11:02am

    woodlander

    33 posts

    My code looks the same as yours:

    if ((mt_rand() % 100) < $SESS->gc_probability)
            {
                ...blah blah blah…
    
                $now = ((float)$usec + (float)$sec);
    
                ...blah blah blah…
            }

    Any idea of a fix to remove that notice?
    Courtney

  • #4 / Jul 10, 2008 11:02am

    Robin Sowell

    13255 posts

    Mr. Wilson nailed it.  It’s a known bug, already fixed for the next release (see bug tracker).

    For a quick fix- you can open up system/core/core.functions.php and find the code above.  Add:

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

    Above that conditional and you’ll be fine until the official fix comes out.

  • #5 / Jul 10, 2008 11:26am

    woodlander

    33 posts

    Robin & Mr. Wilson, Thank you both for your help!

  • #6 / Jul 10, 2008 11:47am

    Robin Sowell

    13255 posts

    😉  Just sorry you caught a bug.  Should be gone next build upgrade.

    Otherwise- you all squared away and we good to close this one out?

  • #7 / Jul 10, 2008 11:51am

    woodlander

    33 posts

    Yep! Thanks again.

  • #8 / Jul 10, 2008 12:14pm

    Robin Sowell

    13255 posts

    Good deal- is done!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases