• Resolved seitenwind

    (@seitenwind)


    Hi. Not sure if it’s an issue of the current version only. It’s not really a request for help but a bug report. I get the following:

    Notice: Undefined variable: file in .../plugins/wp-optimize/minify/class-wp-optimize-minify-functions.php on line 1112

    That’s the code around that line in that file:

    foreach ($possible_urls as $possible_url => $path) {
    	$pos = strpos($url, $possible_url);
    	if (false !== $pos) {
    		$file = substr_replace($url, $path, $pos, strlen($possible_url));
    		break;
    	}
    }
    if (file_exists($file)) {
    	return filesize($file);
    }

    As you can see the $file var might not always be defined here. I’ll build in a workaround for myself but you might want to fix the code so that file_exists() can’t try to access $file if it wasn’t defined before.

    Thanks for your work and your plugin.
    All the best

Viewing 9 replies - 1 through 9 (of 9 total)
  • @seitenwind Thanks for sharing this, I’ll share the same with our development team in-order to investigate further and apply a fix in future release.

    Plugin Author David Anderson

    (@davidanderson)

    Hi,

    I think you must be running a previous release – this fix was previously made, and was in the latest release made on 29th Nov (day before the report).

    Thank you,
    David

    I’m using the latest version, but the problem persists. I keep getting the class-wp-optimize-minify-functions.php on line 1112 error.
    Photo

    • This reply was modified 2 years, 11 months ago by Saulius.
    Thread Starter seitenwind

    (@seitenwind)

    Hi,

    as mentioned in my previous post, I’m using the current version (from the wordpress repository). And as Saulius confirms, the issue is still there.

    And more sites are facing this problem. Google’s search error shows other webpages covered by the error.

    We are having the same problem on all of our sites with WP Optimize. Any solution yet ?

    • This reply was modified 2 years, 11 months ago by chicagola.

    Delete wp optimize…

    • This reply was modified 2 years, 11 months ago by Saulius.

    thanks @seitenwind.

    my bandage:
    if (isset($file) && file_exists($file))

    i haven’t used PHP in like 15 years though, so no guarantee

    • This reply was modified 2 years, 10 months ago by Rahil627.

    Dear @seitenwind , dear Team!
    I have the very same problem:

    Warning: Undefined variable $file in /home/.sites/638/site1536954/web/wp-content/plugins/wp-optimize/minify/class-wp-optimize-minify-functions.php on line 1112 Warning: Undefined variable $file in /home/.sites/638/site1536954/web/wp-content/plugins/wp-optimize/minify/class-wp-optimize-minify-functions.php on line 1112

    @seitenwind : you solved the problem somehow, could you please explain to me how you’ve done it? I am an absolutely beginner, I don’t understand php yet. I am trying to speed up my site with WP-Optimize. The problem occured as soon as I have enabled “Minify” in the WP-Optimize interface. What can I do now?

    Thank you very much!
    Great Greets from Austria

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Undefined variable: file in class-wp-optimize-minify-functions.php on line 1112’ is closed to new replies.