Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Notices raised by cssconcat #5

Open
westonruter opened this issue Jun 2, 2015 · 0 comments
Open

PHP Notices raised by cssconcat #5

westonruter opened this issue Jun 2, 2015 · 0 comments

Comments

@westonruter
Copy link

When running unit tests for Customize Widgets Plus inside of Quickstart, I'm noticing PHP Notices being raised:

Only variable references should be returned by reference

/srv/www/wp-content/mu-plugins/http-concat/cssconcat.php:174
/srv/www/wp/wp-includes/class.wp-dependencies.php:219
/srv/www/wp/wp-includes/script-loader.php:653
/srv/www/wp/wp-includes/plugin.php:579
/srv/www/wp/wp-includes/class.wp-styles.php:39
/srv/www/wp-content/mu-plugins/http-concat/cssconcat.php:31
/srv/www/wp-content/mu-plugins/http-concat/cssconcat.php:191
/srv/www/wp/wp-includes/plugin.php:503
/srv/www/wp-tests/tests/phpunit/tests/customize/widgets.php:53
/srv/www/wp-tests/tests/phpunit/tests/customize/widgets.php:175

The code in question is:

class WPcom_CSS_Concat extends WP_Styles {
    // ...
    function &__get( $key ) {
        return $this->old_styles->$key;
    }
    // ...
}

I tried changing this method to:

    function &__get( $key ) {
        $value = $this->old_styles->$key;
        return $value;
    }

But then of course a different error is raised when wp_styles()->registered[ $key ] is attempted to be set:

Indirect modification of overloaded property WPcom_CSS_Concat::$registered has no effect

/srv/www/wp/wp-includes/class.wp-dependencies.php:221
/srv/www/wp/wp-includes/functions.wp-styles.php:116
/srv/www/wp-content/plugins/jetpack/_inc/genericons.php:11
/srv/www/wp/wp-includes/plugin.php:503
/srv/www/wp-tests/tests/phpunit/tests/customize/widgets.php:53
/srv/www/wp-tests/tests/phpunit/tests/customize/widgets.php:175

I think perhaps the approach for extending WP_Styles needs to be changed. Instead of storing the original instance of WP_Styles inside of the WPcom_CSS_Concat instance, I think it should be fully re-using all of its properties directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant