php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29308 Using the $this->* syntax in a method's argument list produces a parse error.
Submitted: 2004-07-21 18:19 UTC Modified: 2004-07-21 20:29 UTC
From: louis at mulliemedia dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.0.0 OS: Windows XP
Private report: No CVE-ID: None
 [2004-07-21 18:19 UTC] louis at mulliemedia dot com
Description:
------------
Using the $this->* syntax in a method's argument list produces a parse error at runtime.

PHP Version 5.0.0RC3

Reproduce code:
---------------
<?php

class Test
{
    var $LastResultSet='this Should print';
    function Test($Arg = $this->LastResultSet)
    {
       print $Arg;
    } 

}
$ob = &new Test;
$ob->Test();
?>

Expected result:
----------------
this Should print

Actual result:
--------------
Error in C:\Development\0.0.2\0.0.2.0\test.php on line 6: parse error, unexpected T_VARIABLE

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-21 20:29 UTC] helly@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

You can only use constants as default values.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Feb 25 20:01:24 2021 UTC