php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32664 public class function can be assigned like a public variable
Submitted: 2005-04-11 03:41 UTC Modified: 2005-04-11 08:23 UTC
From: mizmerize at yahoo dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.0.4 OS: Windows 2000 Advanced Server SP3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mizmerize at yahoo dot com
New email:
PHP Version: OS:

 

 [2005-04-11 03:41 UTC] mizmerize at yahoo dot com
Description:
------------
I made a class that has a public function. If I assign a value to the function, PHP will allow to assign a value, and if I started to retrieve the value, it will return the value.

Reproduce code:
---------------
/*example*/
class Field {
   function GetField(){
      
   }
}

/*usage*/

$m_Field=new Field;
$m_Field->GetField="Hello";
echo $m_Field->GetField; /* please note the absence of parenthesis*/

Expected result:
----------------
it should produce a fatal error, concerning the assigning of the data in a function;

Actual result:
--------------
Hello

/* returns the value you have set.*/

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-11 08:23 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

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 07 16:01:28 2024 UTC