php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9092 variables-by-references in class constructor not working
Submitted: 2001-02-03 17:53 UTC Modified: 2001-06-12 12:41 UTC
From: t dot stinner at billiton dot de Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.0.4pl1 OS: Linux 2.2.16
Private report: No CVE-ID: None
 [2001-02-03 17:53 UTC] t dot stinner at billiton dot de
This code snippet:

class test {
      function test(&$test1=false) {
      }
} 

gives me 

Parse error - parse error, expecting `')''

on the line with the constructor (function ...)

shouldn't this work (or at least return a useful error)?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-03 18:09 UTC] zak@php.net
This should not work - how can you pass a literal value by reference?

However, you are right about the error message - it does seem to be incorrect.
 [2001-02-03 19:00 UTC] t dot stinner at billiton dot de
hmm, i see your point.

is it possible to define a value that should be 
passwd by reference as optional?


 [2001-02-20 01:34 UTC] andre@php.net
covered by 6343 
 [2001-06-12 12:41 UTC] jmoore@php.net
You cant pass a literal via reference. Closing report. This is in the todo for 4.1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC