Got a little techonology problem that you need fixed pronto? Post it here and we'll see what we can do.
Topic locked

PHP Help

Tue Aug 03, 2004 4:31 pm

I doubt many of you will be able to help, but maybe someone will be able to.

Code:
            if (eregi("^pwlCache.", $de)) {
                $files++;
                $absfile=$de;
                $cachestuff=cache_read($absfile);
                $thecache=unserialize($cachestuff);
                if (is_array($thecache)) {
                    if ($purgeall || ($cdata["cachetime"]!="0" && $thecache["expire"]<=time())) {
                        cache_lock($absfile, TRUE);
                        if (@unlink($absfile)) {
                            $deleted++;
                            cache_debug("$dir Deleted $absfile");
                        } else {
                            $faileddelete++;
                            cache_debug("$dir Failed to delete $absfile");
                        }
                        cache_lock($absfile, FALSE);
                    } else {
                        cache_debug("$dir $absfile expires in " . ($thecache["expire"]-time()));
                    }
                } else {
                    cache_debug("$dir $absfile is empty, being processed in another process?");
                    $empty++;
                }
            } else {
                $ignored++;
            }
        }


It says there is an error in the
Code:
$empty++;

Line, and I can't find anything wrong with it :|

Wed Aug 04, 2004 3:12 am

doesn't the variable $empty need to be set or have a value first? Even though the variable is supposed to be empty. Also if you don't give a variable a value, is it null, or zero?

Also can you include the whole error?

Thu Aug 05, 2004 12:14 am

ya paste the full error and the code if you could(so we can find what lin eits on, or tell use which lines that code snippet is through (ex 5-15)

Thu Aug 05, 2004 5:23 am

This looks like it: http://www.evilwalrus.com/viewcode.php? ... &view=xwin , and all the variables are set.


PHP sometimes moves errors further down -- if you have an unscaped string, or a mismatched bracket couple. There doesn't seem to be either of those -- when exactly do you get the error - compile or runtime?

Fri Aug 06, 2004 7:20 pm

I fixed the problem ^^;; It was in one of the functions it called, I don't know why it didn't parse error on that line, however. Stupid php.

And good eye, hunterlupe! It is a portion of the code from there, though I didn't use it all (some of it was unneeded, and just slowed it down)
Topic locked