Forums

Only variables can be passed by reference in classes.php (3 posts)

  1. Dehumanizer
    Member
    Posted 6 years ago #

    This is a weird one. Today, I added about 40 categories to one of my blogs (http://www.dehumanizer.com/wayofthemind/), which only had 2 of them before, and went through all the posts, changing their categories from "General" to the correct ones.

    Afterwards, when going to a category page (like /wayofthemind/category/xxx, assuming xxx is a category), I got this in my error logs:

    [Tue Aug 23 17:43:40 2005] [error] PHP Fatal error: Only variables can be passed by reference in /var/www/htdocs/wayofthemind/wp-includes/classes.php on line 629

    I looked at that file, and after a few tests, found out that changing line 629 from:

    $category = &get_category($this->get('cat'));

    to something like:

    $crom = $this->get('cat');
    $category = &get_category($crom);

    makes the error disappear, and the page is correctly displayed.

    When googling for info about this problem, I found about 50 other WordPress blogs displaying the same error: google for
    "Only variables can be passed by reference in" "classes.php on line 629"

    (that's a single query), so I'm not the only one, at least..

    Using WordPress 1.5.2, PHP 5.0.4, no active plugins, no local customizations except adding geotags to the RSS feeds.

  2. I think this is something that has changed in PHP 5 - what used to be valid code in PHP 4 is now not valid.

    $this->get('cat') is seen by PHP 5 as the result of an expression rather than a variable so can't be passed by reference.

    This needs filing as a bug on trac.wordpress.org unless one already exists.

  3. Dehumanizer
    Member
    Posted 6 years ago #

    Hmm, didn't even know about trac. :) Ok, there it is:

    http://trac.wordpress.org/ticket/1614

Topic Closed

This topic has been closed to new replies.

About this Topic