php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35725 Error with the return of an assignment
Submitted: 2005-12-18 10:54 UTC Modified: 2005-12-18 23:10 UTC
From: simon dot jackson at caringbush dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.1 OS: RedHat ES 4
Private report: No CVE-ID: None
 [2005-12-18 10:54 UTC] simon dot jackson at caringbush dot net
Description:
------------
With Horde 3.0.9 (in many places) on PHP 5.0.4, the following works:

  if (class_exists($class)) {
    return $ret = &new $class($params);
  }

It fails on PHP 5.1.0 and PHP 5.1.1 with an error of

Notice: Only variable references should be returned by reference in ...on line ...

However, the following does work:

  if (class_exists($class)) {
    $ret = &new $class($params);
    return $ret;
  }

Is this an error in PHP or Horde?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-18 11:02 UTC] judas dot iscariote at gmail dot com
It's a Horde error, not a PHP bug.
 [2005-12-18 11:12 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is indeed a bug in Horde.
 [2005-12-18 22:57 UTC] simon dot jackson at caringbush dot net
I am trying to find in the manual how this syntax in incorrect. I have read the assignment section, and can't yet see how this is incorrect. This will help me (an perhaps the horde people) no make this mistake in the future.
 [2005-12-18 23:10 UTC] simon dot jackson at caringbush dot net
Perhaps this is in the "Returning References" section?

By the way, I meant "not to make this mistake in
the future."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 21:01:28 2024 UTC