Skip to content
This repository has been archived by the owner on Feb 23, 2019. It is now read-only.

Notice caused by undefined variable #470

Closed
deltafactory opened this issue May 2, 2017 · 1 comment
Closed

Notice caused by undefined variable #470

deltafactory opened this issue May 2, 2017 · 1 comment

Comments

@deltafactory
Copy link

See $empty here:
https://github.com/szepeviktor/w3-total-cache-fixed/blob/v0.9.5.x/Cdn_Plugin.php#L774

@nigrosimone
Copy link
Collaborator

nigrosimone commented May 3, 2017

It must be a design flaw or legacy code.

@szepeviktor it seem legacy code.

this bug also exists in the current fix version
https://github.com/szepeviktor/w3-total-cache-fixed/blob/v0.9.5.x/Cdn_Plugin.php#L774

but all the w3tc_attachment_url() code doesn't exists in the latest official version:
https://plugins.trac.wordpress.org/browser/w3-total-cache/tags/0.9.5.4/Cdn_Plugin.php

maybe, the simplest fix is replace $empty with '':

function w3tc_attachment_url( $url ) {
        static $allowed_files = null;

		if ( ( defined( 'WP_ADMIN' ) && $this->_config->get_boolean( 'cdn.admin.media_library' ) ) ||
			 ( $this->can_cdn() && $this->can_cdn2( '' ) ) ) {

can_cdn2 expect a $buffer (the html of the cached page), but here has no-sense.

Furniel added a commit that referenced this issue May 10, 2017
nigrosimone added a commit that referenced this issue May 20, 2017
* Remove uninitialized variable, fixes #470

* Update README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants