[PHP-DEV] PHP 4.0 Bug #9620 Updated: new operator does not behave correctly

2001-03-09 Thread sniper

ID: 9620
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old-Status: Duplicate
Status: Closed
Bug Type: Scripting Engine problem
Assigned To: 
Comments:



Previous Comments:
---

[2001-03-08 08:27:45] [EMAIL PROTECTED]
I submitted this bug previous and was told that this is how the new operator is 
supposed to work. I submit to you that in every other instance this makes sense, but 
for self referencing constructs, especially with the new operator, the fact that =new 
is not interpreted as =&new does not make sense whatsoever because why would I want to 
assign a copy of the object I just created, especially if that object opens files? Is 
there EVER a situation where I want to assign ANYTHING other than the object I just 
created???

Thank you.

- Response follows --

Yes, when you do a $obj = new Foo(), the object is copied.
Use =& if you want reference.

Previous Comments:
---

[2001-02-27 09:16:56] [EMAIL PROTECTED]
$objectlist=array();
class MyClass
{
  function MyClass()
  {
global $objectlist;
// Save the reference for later use
$objectList[]=&$this;
  }
};

// the object referred to by $myobject is NOT in the array
$myobject = new MyClass();
// $myobject2 exists in the array
$myobject2 =& new MyClass();

It appears that there is an object being copied when returning from the
constructor. What am I doing wrong?

I'm not supposed to return anything from the constuctor.



---



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9620&edit=2


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] PHP 4.0 Bug #9620 Updated: new operator does not behave correctly

2001-03-08 Thread stas

ID: 9620
Updated by: stas
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Duplicate
Bug Type: Scripting Engine problem
Assigned To: 
Comments:

Same as #9479. If you want further discussion on it, reopen it.

Previous Comments:
---

[2001-03-08 08:27:45] [EMAIL PROTECTED]
I submitted this bug previous and was told that this is how the new operator is 
supposed to work. I submit to you that in every other instance this makes sense, but 
for self referencing constructs, especially with the new operator, the fact that =new 
is not interpreted as =&new does not make sense whatsoever because why would I want to 
assign a copy of the object I just created, especially if that object opens files? Is 
there EVER a situation where I want to assign ANYTHING other than the object I just 
created???

Thank you.

- Response follows --

Yes, when you do a $obj = new Foo(), the object is copied.
Use =& if you want reference.

Previous Comments:
---

[2001-02-27 09:16:56] [EMAIL PROTECTED]
$objectlist=array();
class MyClass
{
  function MyClass()
  {
global $objectlist;
// Save the reference for later use
$objectList[]=&$this;
  }
};

// the object referred to by $myobject is NOT in the array
$myobject = new MyClass();
// $myobject2 exists in the array
$myobject2 =& new MyClass();

It appears that there is an object being copied when returning from the
constructor. What am I doing wrong?

I'm not supposed to return anything from the constuctor.



---



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9620&edit=2


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]