Commit Graph

1516 Commits

Author SHA1 Message Date
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
Andi Gutmans
b04acdadf4 - Print out object id for easier debugging 2001-12-26 20:06:06 +00:00
Andi Gutmans
29ea3da2f8 - Pretty much finish _clone() support 2001-12-26 19:54:20 +00:00
Andi Gutmans
2ce4b47657 - Initial support for _clone() 2001-12-26 17:49:22 +00:00
Andi Gutmans
f85c818fe8 - Start fixing the parsing rules so that function and method calls
- can't be used in a write context.
2001-12-26 14:46:18 +00:00
Andi Gutmans
76b9acc165 - Fix crash correctly. 2001-12-26 11:18:00 +00:00
Andi Gutmans
e1e02af55b - Revert delete syntax patch 2001-12-25 17:10:58 +00:00
Andi Gutmans
ee44180fc6 - Fix a crash (not a thorough fix).
- Commented old code
2001-12-25 16:51:37 +00:00
Andi Gutmans
df38ce3727 - Fixed bug where global functions weren't called if they didn't exist
- in the class scope
2001-12-24 17:39:16 +00:00
Andi Gutmans
3458373ed6 - Fix a bug where function's didn't work anymore in multi-threaded
- servers after the latest startup changes.
2001-12-23 18:39:52 +00:00
Andi Gutmans
9e7c0d67d0 - Add initial capability of defining nested classes as class foo::bar 2001-12-22 15:31:44 +00:00
Zeev Suraski
43617d0d50 MFZE1 2001-12-18 19:56:23 +00:00
Sebastian Bergmann
cc01431199 I'm too trigger-happy. 2001-12-16 20:28:18 +00:00
Sebastian Bergmann
7920d4fc7e delete is now function 2001-12-16 19:57:53 +00:00
Andi Gutmans
1e56cac358 - Seems like most people prefer delete($obj) over delete $obj. 2001-12-16 19:53:06 +00:00
Andi Gutmans
ac7ed464b5 - Start adding parsed variable checks. 2001-12-16 19:45:49 +00:00
Andi Gutmans
880e7d8ce7 - Framework for knowing what kind of variable we just parsed.
- This will be used in compile-time error checking which couldn't be done
- at the level of the grammar.
2001-12-16 19:18:19 +00:00
Andi Gutmans
7c749c1897 - Rearrange grammar to allow dereferencing of objects returned from
- functions. It still crashes though.
2001-12-13 22:21:50 +00:00
Andi Gutmans
f4b832d277 - Fix crash bug in startup code.
- Start work on being able to reference global and local scope
2001-12-13 16:55:04 +00:00
Andi Gutmans
ce98c73f82 - Infrastructure changes for allowing to access the global scope from
- within a class scope.
- Fix the Zend.dsp project a bit. It seems someone pretty much killed it
- when commiting their own personal configuration. Please be careful in
- future.
2001-12-12 20:45:38 +00:00
Andi Gutmans
74efc41fc3 - Make classes have scope and function/constant lookups default to the class 2001-12-12 17:38:37 +00:00
Andi Gutmans
4214a056a1 - Merge from ZE1 2001-12-11 18:51:02 +00:00
Andi Gutmans
4cb97fa3b9 - Rename zend_class_entry.constants -> zend_class_entry.constants_table 2001-12-11 18:46:43 +00:00
Andi Gutmans
1dcef1e4ea - Start making scope change correctly when calling namespace functions.
- When inside a namespace fallback to global namespace when function
- or constant is not found.
2001-12-11 17:56:57 +00:00
Sebastian Bergmann
5b0b5b6ed5 Forgot to update the LICENSE. 2001-12-11 17:38:49 +00:00
Sebastian Bergmann
d863d52a5d Update headers. 2001-12-11 15:16:21 +00:00
Sebastian Bergmann
4345f8a0b5 MFZE1 (AIX fixes) 2001-12-11 09:17:38 +00:00
Sebastian Bergmann
ff4cc2c6e2 MFZE1 (added zend_strip mode in the highliter) 2001-12-11 06:30:30 +00:00
Andi Gutmans
3bfee898db - More namespaces work.
- Nuke memory leak.
2001-12-10 18:57:17 +00:00
Andi Gutmans
8460372395 - Fix crash with unhandled exceptions 2001-12-08 20:58:20 +00:00
Andi Gutmans
055709538c - Support constants. The following works now:
<?
	class foo {
		const GC = "foo constant\n";
	}

	define("GC", "Global constant\n");

	namespace;
	print GC;
	namespace foo;
	print GC;
	namespace;
	print foo::GC;

?>
2001-12-06 18:05:18 +00:00
Andi Gutmans
42486196ad - Initial work on changing namespace scope. Only methods & variables
- right now.
<?
	$hey = "Global hey\n";

	class foo {
		static $hey = "Namespace hey\n";
		function bar()
		{
			print "in foo::bar()\n";
		}
	}
	function bar()
	{
		print "in bar()\n";
	}

	bar();
	namespace foo;
	bar();
	namespace;
	bar();
	namespace foo;
	$bar_indirect = "bar";
	$bar_indirect();

	namespace;
	print $hey;
	namespace foo;
	print $hey;
	$hey = "Namespace hey #2\n";
	namespace;
	print $hey;
	$hey = "Global hey #2\n";
	namespace foo;
	print $hey;
?>
2001-12-06 17:47:04 +00:00
Andi Gutmans
fe94f59427 - Nuke the namespace work I did. It'll be redone differently. 2001-12-06 17:23:08 +00:00
Sebastian Bergmann
8b34428167 Document recent changes. 2001-12-05 07:04:16 +00:00
Andi Gutmans
5476706142 - Damn Zeev :) 2001-12-04 17:58:32 +00:00
Andi Gutmans
94cfe03da5 - Revert one of the changes because it might be before the memory
- manager has started.
2001-12-01 08:46:02 +00:00
Andi Gutmans
bb9a36cad1 - Use alloca() when possible. 2001-12-01 08:33:48 +00:00
Andi Gutmans
e858d27888 - Initial support for class constants. There are still a few semantic
- issues which need to be looked into but basically it seems to work.
- Example:
<?php
	class foo
	{
		const hey = "hello";
	}

	print foo::hey;
?>
2001-11-30 16:29:47 +00:00
Andi Gutmans
7f66d5e99a - Fix typo 2001-11-30 11:42:30 +00:00
Andi Gutmans
f289014922 - Support syntax for class constants (doesn't do anything yet but
- required some reworking of the grammar).
2001-11-27 17:46:31 +00:00
Andi Gutmans
7cd6ccc0ec - Support static $var = 0; style initialization of static class
- members. For example:
-	class foo {
-		static $my_static = 5;
-
-	}
-
-	print foo::$my_static;
2001-11-26 18:05:01 +00:00
Andi Gutmans
0d559f17cd - Fix crash and leak 2001-11-25 12:29:08 +00:00
Andi Gutmans
4f3eaaa854 - Whitespace 2001-11-25 08:58:59 +00:00
Andi Gutmans
d2da63f629 - Support static members. The following script works:
<?
	class foo
	{
		class bar
		{
			function init_values()
			{
				for ($i=1; $i<10; $i++) {
					foo::bar::$hello[$i] = $i*$i;
				}
			}

			function print_values()
			{
				for ($i=1; $i<10; $i++) {
					print foo::bar::$hello[$i] . "\n";
				}
			}
		}
	}

	foo::bar::init_values();
	foo::bar::print_values();

	for ($i=1; $i<10; $i++) {
		print $hello[$i]?"Shouldn't be printed\n":"";
	}
?>
2001-11-25 08:49:09 +00:00
Andi Gutmans
559d611a86 - MFZE1 2001-11-24 18:27:20 +00:00
Zeev Suraski
08615c6f68 MFZE1 2001-11-15 23:26:52 +00:00
Stig S. Bakken
78f108d31a add newline at end of file to avoid warnings 2001-11-05 00:17:28 +00:00
Stig S. Bakken
9382ddec52 non-zts compile fix 2001-11-05 00:16:33 +00:00
Andi Gutmans
a332f826a7 - Support instantiation of nested class. The following script now should
- work:
-<?php
-	class foo
-	{
-		function bar()
-		{
-			print "bar() in class bar\n";
-		}
-
-		class barbara
-		{
-			function bar()
-			{
-				print "bar() in class foo::barbara\n";
-			}
-		}
-	}
-
-	$obj = new foo();
-	$obj->bar();
-
-	$obj = new foo::barbara();
-	$obj->bar();
-
2001-11-04 19:30:49 +00:00
Andi Gutmans
48e54e0c7a - RISC OS patch by Alex Waugh 2001-11-03 13:35:14 +00:00