Commit Graph

558 Commits

Author SHA1 Message Date
Stanislav Malyshev
462eff3497 fix __clone 2003-05-19 17:12:56 +00:00
Marcus Boerger
fcf92e7e17 Modify the abstract error message so that it shows up to three methods not implemented.
# The solution is generic so that we could change the number of methods shown. But the
#problem is that error message here have a maximum length of 1024 chars.
2003-05-04 19:24:24 +00:00
Marcus Boerger
38da5d0124 Fix warnings 2003-05-04 19:11:48 +00:00
Stanislav Malyshev
c5b1314e05 make import * fail if such classes or functions already there 2003-04-21 12:14:12 +00:00
Stanislav Malyshev
800de8acb0 allow class_exists() to work with namespaces too.
add CLASS_IS_NAMESPACE macro
2003-04-02 15:28:31 +00:00
Andrei Zmievski
1ad9bd68ff Stas's patch on zend_execute.c (1.448 -> 1.449) resulted in a bug where
the namespaced member accesses didn't work. This should hopefully
correct it.
2003-04-01 21:02:02 +00:00
Andrei Zmievski
62f9eb8006 Split ZEND_NAMESPACE into user and internal namespaces. Hope this is
okay with engine folks.
2003-04-01 19:37:04 +00:00
Sebastian Bergmann
8c06829b11 ZTS fix. 2003-03-30 13:40:40 +00:00
Stanislav Malyshev
bd4cdab9cf Fix namespace switch 2003-03-30 12:39:49 +00:00
Stanislav Malyshev
1972a656e7 fix fetch_class buglet 2003-03-27 17:57:47 +00:00
Stanislav Malyshev
43e87093c1 Un-nest namespaces - now namespace X { namespace Y {} } is a parse error
Also refine namespaced includes
2003-03-26 20:42:23 +00:00
Sebastian Bergmann
3fc852824f Eliminate TSRMLS_FETCH() calls in destroy_op_array() and zend_get_class_entry(). 2003-03-26 07:44:11 +00:00
Stanislav Malyshev
268a14e049 Fix {include|require}_once error message - if open
fails, don't use tream, use original name.
2003-03-24 11:54:42 +00:00
Zeev Suraski
d405373270 Fix handling of ::func() 2003-03-11 23:19:45 +00:00
foobar
66052056c7 Better fix for the memleaks (bug 19943) by Moriyoshi 2003-03-07 00:28:25 +00:00
Zeev Suraski
805f98065d Fix warnings 2003-03-06 23:45:50 +00:00
Zeev Suraski
ce4690685d Fix error message 2003-03-06 23:09:57 +00:00
Zeev Suraski
0338111950 Require abstract classes to be explicitly declared 'abstract', in order to
avoid making developers traverse the entire class/interface hierarchy
before they can figure out whether a class is instantiable
(ok, so it makes sense :)
2003-03-06 22:53:23 +00:00
foobar
4a8abb2f3d Fixed bug #19943 (the memleaks) 2003-03-06 16:27:05 +00:00
Zeev Suraski
44347cf64b Change opcode name 2003-03-06 14:42:36 +00:00
Zeev Suraski
ff76511a08 Add class type hints 2003-03-06 14:31:17 +00:00
Zeev Suraski
6ad2420d2d Implement $obj::static_func() 2003-03-05 13:25:33 +00:00
Zeev Suraski
26dd8492ed Add support for interfaces 2003-03-05 11:14:44 +00:00
Stanislav Malyshev
e645f20d07 Allow namespaces to have a number of parts. I.e., now you can do:
namespace foo {
	function abc() {}
}
...
namespace foo {
	functio def() {}
}
2003-02-20 19:01:53 +00:00
Zeev Suraski
955636af69 Avoid using a C++ reserved word 2003-02-18 17:18:28 +00:00
Wez Furlong
e52aac940f Implement simple stream support in the ZE scanners. 2003-02-18 09:37:54 +00:00
Zeev Suraski
d22cc2f329 Improve handling of static member variables 2003-02-17 14:06:39 +00:00
Zeev Suraski
ac0f7d9ed0 Fix complex cases of self-assignments (bugs #21600, #22231) 2003-02-16 19:18:23 +00:00
Zeev Suraski
f079bb65ff Make EG(This) and EG(scope) available to internal methods 2003-02-16 19:10:27 +00:00
Zeev Suraski
004947221e Revert patches - they weren't ready yet! 2003-02-16 18:34:48 +00:00
Georg Richter
60d1b378ed fixed compiler warning 2003-02-16 18:04:29 +00:00
Georg Richter
c08bfd2e3f tested patch from Zeev (fixes oo-bug in ext/mysqli) 2003-02-16 17:47:23 +00:00
Sebastian Bergmann
6d300baf84 ZTS fixes 2003-02-16 11:34:49 +00:00
Stanislav Malyshev
a4c3b2ce80 Namespace patch. Big changes:
1. Nested classes are gone.
2. New syntax for namespaces:
namespace foo {
	class X { ... }
	function bar { ... }
	var x = 1;
	const ZZ = 2;
}
3. Namespaced symbol access: $x = new foo::X; - etc.
For now, namespaces are case insensitive, just like classes.
Also, there can be no global class and namespace with the same name
(to avoid ambiguities in :: resolution).
2003-02-16 11:12:43 +00:00
Zeev Suraski
778ce2495d whitespace 2003-02-10 11:49:21 +00:00
Zeev Suraski
dbb73d8f1e Add ability to reference self:: and parent:: in constant initializers
(bug #21849)
2003-02-10 09:45:27 +00:00
Zeev Suraski
edc8e67e3b Remove redundant code 2003-02-10 08:32:44 +00:00
Zeev Suraski
55a66b1cb2 Fix the array() problem (and probably some other problems too) 2003-02-09 17:30:50 +00:00
Zeev Suraski
f660d28143 - read_property cleanup
- Implement unset/isset/empty for PPP
2003-02-05 14:27:30 +00:00
Zeev Suraski
17439aa9c4 Rework static class properties - now supports access restrictions 2003-02-05 13:35:52 +00:00
Zeev Suraski
61bd944b32 Core rearrangements - move Zend Objects specific code to their
specific implementation file
2003-02-02 16:17:25 +00:00
foobar
333406bdc2 - Added some missing CVS $Id$ tags, headers and footers. 2003-02-01 01:49:15 +00:00
Zeev Suraski
4b97a8dffd Code rearrangements 2003-01-29 15:02:57 +00:00
Zeev Suraski
8f52bf6835 Fix assignments to $this.
Fixes the 'make install' problem reported on php-dev
2003-01-29 08:55:12 +00:00
Zeev Suraski
6155a1fa24 Allow methods in parent classes to call protected methods in derived
classes
2003-01-28 09:44:18 +00:00
Stanislav Malyshev
3a4ace13b4 Replace MAKE_VAR opcode with special 'data' opcode
This opcode is not executeable but only holds data for opcodes
that need more than two arguments (presently only ASSIGN_OBJ and the ilk but
in the future also ASSIGN_DIM)
2003-01-27 15:13:01 +00:00
Zeev Suraski
76c93412d3 Let the scope propagate to internal functions 2003-01-23 16:40:30 +00:00
Ilia Alshanetsky
72cd67b3ca Fixed bug #21814 (Allow booleans to be used as array keys). 2003-01-22 14:48:30 +00:00
Ilia Alshanetsky
12d2b01a25 Fixed bug #20933 (isset/empty didn't work when used on string offsets). 2003-01-16 00:44:17 +00:00
Andi Gutmans
c073b76aac - Change "is" to "instanceof" as it explains better what the operator means.
- "is_a" was also appropriate but ugly.
2003-01-14 21:29:23 +00:00
Zeev Suraski
424e98f4e2 Implemented compatibility mode
To enable - zend2.implicit_clone = on in php.ini or using ini_set()
2003-01-12 12:39:06 +00:00
Andi Gutmans
76c663b321 - Fix typo and whitespace 2003-01-11 17:04:16 +00:00
Derick Rethans
2c44fab3a0 - Ported the zend_execute_internal hook to ZendEngine2. 2003-01-11 16:12:44 +00:00
Zeev Suraski
77208ec4d6 Fix incorrect linkage of access-levels, when using private methods 2003-01-02 13:58:08 +00:00
Sebastian Bergmann
2c5d4b8c23 Bump year. 2002-12-31 15:59:15 +00:00
Zeev Suraski
ce69b6f6ee Support private/protected constructors 2002-12-07 21:37:09 +00:00
Zeev Suraski
c087d9e9e4 Fix error messages 2002-12-07 15:53:37 +00:00
Zeev Suraski
e062dffe6c - Implement public/protected/private methods.
- Prevent instantiation of classes with abstract methods.
Based in part on Marcus's patch.
2002-12-06 17:09:44 +00:00
Andi Gutmans
671fff2fde h WHitespace 2002-11-30 11:20:25 +00:00
Andi Gutmans
6aa90a75bd - FN_IS_STATIC -> FN_STATIC 2002-11-24 20:32:49 +00:00
Andi Gutmans
e8214a3384 - Commit Marcus' cleanup of abstract and static inheritance and improve
- error messages
2002-11-23 20:44:12 +00:00
Sebastian Bergmann
ba1f645030 Show class name as well. Patch by Marcus Börger. 2002-11-22 06:19:04 +00:00
Sebastian Bergmann
da0e29e92f Show the name of the abstract method in the error. 2002-11-21 14:20:25 +00:00
Andi Gutmans
227f7838d6 - Fix build (thanks Marcus)
- Implement abstract methods, syntax:
-    abstract function foo($vars);
- I don't see any reason why modifiers such as static/public need to be
- used with abstract. PHP is weakly typed and there would be no meaning to
- this anyway. People who want a strictly typed compiled language are
- looking in the wrong place.
2002-11-20 18:00:23 +00:00
Zeev Suraski
4be862b02c MFZE1 - error_reporting fix 2002-11-19 17:51:30 +00:00
Stanislav Malyshev
29695934ed fix the leak 2002-11-17 17:57:57 +00:00
Stanislav Malyshev
3944ce41c3 semi-fix string offsets crash - now it doesn't crash, but still leaks 2002-11-13 15:13:24 +00:00
Sebastian Bergmann
155c453138 Fugbix typo. 2002-11-11 18:27:32 +00:00
Sebastian Bergmann
bab84eab34 Fix ZTS build. 2002-11-06 18:51:44 +00:00
Stanislav Malyshev
41bd9b3746 fix zend_assign_to_object_op 2002-11-06 15:11:45 +00:00
Andi Gutmans
c497868005 - Add support for static methods. Basically methods which are defined as
- static don't have $this. That's the whole difference.
2002-11-05 19:37:31 +00:00
Andi Gutmans
3c94041bed - Fix unset($this->foo) 2002-11-01 07:59:42 +00:00
Andi Gutmans
023836ae25 - Also tune jmpz_ex 2002-10-24 18:24:55 +00:00
Andi Gutmans
80109314b9 - Improve performance of part of the jmps. More to follow. 2002-10-24 18:04:12 +00:00
Andi Gutmans
1eb04a850e - This might improve performance. Commiting it so that I can check it on
- Linux
2002-10-23 20:40:07 +00:00
Andi Gutmans
4a9f1a9396 - Make Ts access a macro. I need this for my next patch which should
- improve performance but not sure yet if it will.
2002-10-23 20:26:28 +00:00
Andi Gutmans
8cbe1ea796 - Nuke unused get_incdec_op()
- Nuke old comment
2002-10-22 19:34:25 +00:00
Andi Gutmans
d12679a64d - Improve overall engine performance 2002-10-22 19:31:53 +00:00
Andi Gutmans
329354529b - Fix bug reported by Daniel T. Gorski 2002-10-22 17:00:59 +00:00
Andi Gutmans
536d4d8aab - Improve opcode dispatching 2002-10-19 09:45:51 +00:00
Andi Gutmans
cf36abb2eb - Change opcode dispatch mechanism to use a function per opcode and use
- a lookup table using the opcode # to call the correct function.
- Still have lots of tuning to do.
2002-10-18 21:19:27 +00:00
Andi Gutmans
7f9819e647 - Cleanup 2002-10-18 10:20:44 +00:00
Sebastian Bergmann
7b0949b005 Fix ZTS build. 2002-10-16 19:16:58 +00:00
Stanislav Malyshev
c42ec35331 Fix class static members: now the following code works:
<?php

class Foo {
         static $c = "Parent";
}

class Child extends Foo {
}

Foo::$c = "Hello";

var_dump(Child::$c);
?>
and returns "Hello" (class statics are not copied anymore, but looked up in
runtime)
2002-10-16 18:29:41 +00:00
Stanislav Malyshev
349b3a096a Fix and generalize $this handling.
ZEND_FETCH_FROM_THIS is removed, IS_UNUSED type on class variables will be
used instead as the sign that it's a fetch from $this
2002-10-16 18:06:36 +00:00
Andi Gutmans
046bdeaaab - Support new classname::$class_name, e.g.:
<?

	class foo::bar {
		public $hello = "Hello, World\n";
	}

	$name = "bar";
	$obj = new foo::$name;
	print $obj->hello;
?>
2002-10-14 20:13:03 +00:00
Ilia Alshanetsky
d3617c51b8 MFZE1 zend_str_tolower issue. 2002-10-09 14:21:40 +00:00
Andi Gutmans
77b3ffbc5a - Require $this-> when calling a methods. This whole automatic lookup
- first in the class and then in the global scope is confusing, slow and
- not quite BC compatible.
2002-10-07 21:46:44 +00:00
Andi Gutmans
278a00e1d8 - Fix problem with unsetting object members. 2002-10-06 19:55:31 +00:00
Ilia Alshanetsky
ee7b8f906d MFZE1 2002-09-26 18:56:11 +00:00
Andi Gutmans
f78fa50423 - Megapatch to try and support inheritance from sub-classes. Things might
- be *very* buggy now so don't get too upset if that happens.
- I still need to improve some stuff but it's a good step (hopefully).
2002-09-24 19:05:53 +00:00
Andi Gutmans
7f6c2da50a - WS fix - "while (" instead of "while(" 2002-09-15 07:46:20 +00:00
Andi Gutmans
43139dc755 - WS - Always use "if (" and not "if(" 2002-09-15 07:45:26 +00:00
Stanislav Malyshev
d8651c82cd Support for __get, __set and __call in classes.
This should work as follows: if class hasn't member with given name,
__get/__set is called. If class has no method with given name, __call is called.
__get/__set are not recursive, __call can be.
2002-09-04 09:07:58 +00:00
Stanislav Malyshev
c8a659f8f6 MFZE1 2002-09-02 09:13:53 +00:00
Thies C. Arntzen
10b58f2110 those are set by RETURN_FROM_EXECUTE 2002-08-23 12:18:54 +00:00
Thies C. Arntzen
d88ca858aa zend_execute: make sure that current_execute_data points to the right thing
after coming back from recursion.
2002-08-21 13:58:20 +00:00
Andi Gutmans
2372caf57e MFZE1 2002-08-17 20:20:36 +00:00
Zeev Suraski
b66561c44a MFZE1 2002-08-17 16:22:40 +00:00
Andi Gutmans
52406cb37c - Make new 'is' operator work with classes only and return false when
- the object isn't of the said class or the value isn't an object.
2002-08-08 16:32:34 +00:00
Zeev Suraski
6025b804c2 MFZE1 2002-08-03 09:44:27 +00:00
Stanislav Malyshev
0e7c1f4609 MFZE1 2002-08-01 16:07:19 +00:00
Jason Greene
b0cf6c3112 MFZE1 global declare 2002-07-30 22:19:50 +00:00
Andrei Zmievski
82c72f2799 @- Adding 'is' operator that can be used to check the type of a variable,
@  or its class. (Andrei)
2002-07-30 04:07:15 +00:00
Andi Gutmans
41e3f4f0c3 - Fix problem with debug_backtrace() reported by Stig. We weren't reporting
- global function information because it wasn't available. We have to do
- an additional assignment per-function call so that it'll be available.
- Also don't define the global scope as function name _main_ but leave it
- empty so that frameworks like Pear can decide what they want to do.
2002-07-26 10:38:25 +00:00
Andi Gutmans
7b68f5108a - Nuke delete(). It was a big mistake to introduce it and I finally
- understand why Java didn't do so.
- If you still want to control destruction of your object then either make
- sure you kill all references or create a destruction method which you
- call yourself.
2002-07-14 19:23:18 +00:00
Andi Gutmans
35e8d8139e - Nuke some unused code 2002-07-14 18:17:07 +00:00
Andi Gutmans
677a9e8751 - Fix problem where scope was lost in nested function calls.
- Thanks to Timm Friebe for diving into this one.
2002-07-06 17:44:45 +00:00
Andi Gutmans
ede84fa384 - Improve some error messages. 2002-06-29 15:30:27 +00:00
Andi Gutmans
b55a20abf4 - Fix problem with scope's not changing correctly during method calls.
- Reapply a tiny optimization to the allocator so that in non-debug mode
- we clean memory without detecting leaks.
2002-06-26 11:07:35 +00:00
Andi Gutmans
68663bf96b - Revert patch which checks at run-time if you're allowed to assign
- certain values by reference.
- We still need to find a solution for cases when this shouldn't be allowed
- as it might cause leaks.
2002-06-24 17:58:22 +00:00
Andi Gutmans
9c148f0d84 - Fix problem with constructor not being inherited and called correctly. 2002-06-23 15:46:58 +00:00
Andi Gutmans
690c85b406 - Fix bug in class constants
- Start centralizing main class lookups. This will help implement
- __autload()
2002-06-16 18:25:05 +00:00
Andi Gutmans
b2015c5610 - Fix problem with assigning functions by reference. 2002-06-11 17:33:53 +00:00
Stanislav Malyshev
3a419fa8dd Fix leak 2002-06-10 09:15:02 +00:00
Sebastian Bergmann
e449646b68 Remove unused local variable. 2002-06-05 18:17:19 +00:00
Andi Gutmans
2d6404d5b0 - Allow overloaded objects to receive the method name in its original
- case.
2002-06-05 17:34:56 +00:00
Andi Gutmans
14a81f91e3 - Hopefully fix problems with debug_backtrace() 2002-05-08 18:43:19 +00:00
Andi Gutmans
b66c89c47a - More debug backtrace work. It still doesn't work very well... 2002-05-07 18:42:13 +00:00
Andi Gutmans
7e5ec2d761 Initial support for built-in backtracing.
There are still a few problems such as includes and calling other functions
from internal functions which aren't seen (will have to think if and how to
fix this).
Also the main scripts filename isn't available. Need to think about that.
2002-05-02 17:20:48 +00:00
Harald Radi
51e797f1e3 some type cleanup work 2002-04-23 18:06:54 +00:00
Andi Gutmans
c84a4ead95 - Pass TSRMLS to callbacks. 2002-03-15 16:26:17 +00:00
Andi Gutmans
db84afb206 - Scope fix. When calling an imported function the scope will change
- correctly to the scope of the functions class.
<?php

	function Hello()
	{
		print "Wrong one\n";
	}

	class MyClass {
		static $hello = "Hello, World\n";

		function Hello()
		{
			print self::$hello;
		}

		function Trampoline()
		{
			Hello();
		}
	}

	import function Trampoline from MyClass;

	Trampoline();
?>
2002-03-15 15:28:06 +00:00
Andi Gutmans
0ce019f715 - Fix issues with $this when using it by itself without indirection such as
- $this->foo.
2002-03-15 15:09:46 +00:00
Stanislav Malyshev
40becd37e5 fix for delete $this and unset $this 2002-03-14 16:00:48 +00:00
Andi Gutmans
c8c629b3fc - Fix bug introduced with latest class hash table change. 2002-03-12 18:53:27 +00:00
Stanislav Malyshev
92dd5e611b - make class tables contain class_entry *, not class_entry
- fix isset($this)
2002-03-12 10:08:47 +00:00
Andi Gutmans
d77ff9607e - Fix build in ZTS mode. 2002-03-10 21:02:00 +00:00
Stanislav Malyshev
04ed2b520f New stuff for objects API:
- Better assignment handling
- More flexible operations with zval-containing objects
2002-03-10 13:42:37 +00:00
Andi Gutmans
90f6005f58 - Support importing constants. e.g.:
<?php

	class MyOuterClass {
		const Hello = "Hello, World\n";
	}

	import const Hello from MyOuterClass;
	print Hello;
2002-03-08 10:58:24 +00:00
Andi Gutmans
83f102fd9f - Add function * and class * functionality. Only constants are left.
<?php

	class MyOuterClass {
		class MyInnerClass {
			function func1()
			{
				print "func1()\n";
			}

			function func2()
			{
				print "func2()\n";
			}
		}
	}

	import class * from MyOuterClass;
	import function func2 from MyOuterClass::MyInnerClass;

	MyInnerClass::func1();
	func2();
2002-03-06 17:08:26 +00:00
Andi Gutmans
b90d80b588 - Initial patch to support importing from class scopes (for Stig).
- It isn't complete yet but I want to work on it from another machine. It
- shouldn't break anything else so just don't try and use it.
- The following is a teaser of something that already works:
<?php

	class MyClass
	{
		function hello()
		{
			print "Hello, World\n";
		}
		class MyClass2
		{
			function hello()
			{
				print "Hello, World in MyClass2\n";
			}
		}
	}

	import function hello, class MyClass2 from MyClass;

	MyClass2::hello();
	hello();
?>
2002-03-02 20:38:52 +00:00
Andi Gutmans
90bd4539c7 - Remove use of C++ reserved words namespace/this 2002-03-01 14:27:26 +00:00
Stanislav Malyshev
6608f07322 Mega-commit: Enter the new object model
Note: only standard Zend objects are working now. This is definitely going to
break custom objects like COM, Java, etc. - this will be fixed later.
Also, this may break other things that access objects' internals directly.
2002-02-07 14:08:43 +00:00
Andi Gutmans
8535164f21 - This small patch should also take care of allowing unseting of $this->foo
- and static members. The unset() opcode was luckily already suitable for
- object overloading.
2002-02-04 20:44:24 +00:00
Andi Gutmans
e366f5dbd8 - Fix problem with the objects_destructor called during shutdown. It was
- freeing objects from id 0 instead of id 1. id 0 is not used.
- Change isset/empty opcodes to support static members and the new way of
- doing $this->foobar. Also the opcodes operate now on the hash table
- combined with the variable names so that they can be overloaded by the
- soon to be added overloading patch.
2002-02-04 19:29:56 +00:00
Andi Gutmans
c2b73faade - Fix a bug reported by Sebastian with indirect class names not working. 2002-01-22 18:02:52 +00:00
Andi Gutmans
2131b019c7 - Improve performance of functions that use $GLOBALS[]
- Please check this and make sure it doesn't break anything.
2002-01-20 20:42:15 +00:00
Andi Gutmans
f1e8815c26 - Change exception handling to use the Java-like catch(MyException $exception)
- semantics. Example:
<?php

	class MyException {
		function __construct($exception)
		{
			$this->exception = $exception;
		}

		function Display()
		{
			print "MyException: $this->exception\n";
		}

	}
	class MyExceptionFoo extends MyException {
		function __construct($exception)
		{
			$this->exception = $exception;
		}
		function Display()
		{
			print "MyException: $this->exception\n";
		}
	}

	try {
		throw  new MyExceptionFoo("Hello");
	} catch (MyException $exception) {
		$exception->Display();
	}
?>
2002-01-13 20:21:55 +00:00
Andi Gutmans
0f398e4d4a - Make sure $this is passed on to methods 2002-01-06 19:52:22 +00:00
Sebastian Bergmann
62dc854bb0 Happy New Year. 2002-01-06 15:21:36 +00:00
Andi Gutmans
e56fb1639b - Allow passing of $this as function arguments.
- Fix a bug which I introduced a couple of months ago
2002-01-05 19:59:09 +00:00
Andi Gutmans
a4248dd584 - Significantly improve the performance of method calls and $this->member
- lookups.
2002-01-05 15:18:30 +00:00
Andi Gutmans
eb08cb956b - Improve performance of indirect-referenced function calls 2002-01-04 09:21:16 +00:00
Andi Gutmans
6203a250f7 - Separate other kinds of function calls too.
- Significantly improve performance of function calls by moving lowercasing
- the function name to compile-time when possible.
2002-01-04 08:05:21 +00:00
Andi Gutmans
0ab9d11225 - Start splitting up different kinds of function calls into different
- opcodes.
2002-01-04 06:44:19 +00:00
Derick Rethans
9b391a83c2 - MFZE1 for exit fix, exposing current function name in error messages and
exposing zend_zval_type_name().
2002-01-03 14:19:13 +00:00
Andi Gutmans
b14f6cf79f - Support default arguments for reference parameters
- Fix two compile warnings
2001-12-28 13:28:33 +00:00
Andi Gutmans
b3fd2faac0 - Support parent:: again 2001-12-27 13:12:45 +00:00
Andi Gutmans
5cb454a8ad - Fix scoping issue. The following works now:
<?
	class MyClass {
		static $id = 0;

		function MyClass()
		{
			$this->id = self::$id++;
		}

		function _clone()
		{
			$this->name = $clone->name;
			$this->address = "New York";
			$this->id = self::$id++;
		}
	}



	$obj = new MyClass();

	$obj->name = "Hello";
	$obj->address = "Tel-Aviv";

	print $obj->id;
	print "\n";

	$obj = $obj->_clone();

	print $obj->id;
	print "\n";
	print $obj->name;
	print "\n";
	print $obj->address;
	print "\n";
2001-12-26 20:17:34 +00:00