Commit Graph

72 Commits

Author SHA1 Message Date
Ilia Alshanetsky
d3617c51b8 MFZE1 zend_str_tolower issue. 2002-10-09 14:21:40 +00:00
Andi Gutmans
aa7bffeec6 - Fix problem when crashing on illegal tokens in class name during class
- definition.
2002-10-01 20:00:45 +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
8831b9cfd0 - MFZE1. 2002-09-23 17:20:59 +00:00
Jason Greene
b806a8e247 MFZE1 (use token instead of global for opcode counting) 2002-08-14 01:40:59 +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
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
9c52e883f0 - Rejuggle some code. 2002-07-17 18:36:29 +00:00
Andi Gutmans
bc5ea87e28 - Commit patch to support protected member variables (by Timm Friebe w/
- some fixes by me).
- You can't access protected variables from outside the object. If you want
- to see a protected member from your ancestors you need to declare the
- member as protected in the class you want to use it in. You can't
- redeclare a protected variable as private nor the other way around.
2002-07-15 18:09:56 +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
Sebastian Bergmann
c9f1c9c19f Allow for 'class Namespace::Bar extends Foo' syntax. Patch by Timm Friebe <thekid@thekid.de>. 2002-07-07 08:22:23 +00:00
Zeev Suraski
0ae66bd659 spelling fix 2002-07-06 16:48:13 +00:00
Andi Gutmans
5f2fcdd689 - Add missing semi-colon. 2002-06-29 15:38:40 +00:00
Andi Gutmans
e2f57d0fcc - MFZE1 2002-06-22 14:37:49 +00:00
Andi Gutmans
b2015c5610 - Fix problem with assigning functions by reference. 2002-06-11 17:33:53 +00:00
foobar
60ccb411ba MFZE1 2002-04-10 21:23:01 +00:00
Andi Gutmans
e7100e22dc - No idea how this slipped in. Fix delete $obj statement. 2002-03-21 04:20:03 +00:00
Andi Gutmans
a990c4da3e - Finish covering all parsed methods to check for validity in parser.
- Change zval's refcount to zend_uint (If it doesn't slow down the Engine
- too much it should probably stay this way). If anyone has time to test
- the difference in speed between zend_ushort & zend_uint in zend.h of
- the struct _zval_struct (one line change) I'd be glad to get some
- figures.
2002-03-19 19:09:53 +00:00
Andi Gutmans
c5ad6ae1b8 - More fixes to check for member/function call legality. 2002-03-18 20:27:03 +00:00
Andi Gutmans
46afe61d25 - Start putting error handling where method calls are being used in a
- context where only writable variables should be used.
2002-03-17 19:13:46 +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
Andi Gutmans
d1eea3de9c - Fix bug in nested try/catch's
- Infrastructure for implementing imports of methods.
2002-03-01 14:04:51 +00:00
Andi Gutmans
00e90f2ff3 - Experimental support for private members.
<?
	class MyClass {
		private $Hello = "Hello, World!\n";

		function printHello()
		{
			print $this->Hello;
		}
	}

	class MyClass2 extends MyClass {
		function printHello()
		{
			MyClass::printHello(); /* Should print */
			print $this->Hello; /* Shouldn't print out anything */
		}
	}

	$obj = new MyClass();
	print $obj->Hello; /* Shouldn't print out anything */
	$obj->printHello(); /* Should print */

	$obj = new MyClass2();
	print $obj->Hello; /* Shouldn't print out anything */
	$obj->printHello();
?>
2002-02-21 11:50:44 +00:00
Andi Gutmans
21b04ff2a6 @ Allow a series of consecutive catch() statements (Andi, Zend Engine)
<?php
	class MyException1 {

	}

	class MyException2 {

	}

	try {
		throw new MyException2();
	} catch (MyException1 $m) {
		print "Caught MyException1";
	} catch (MyException2 $m) {
		print "Caught MyException2";
	}
2002-02-13 19:26:07 +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
Thies C. Arntzen
a0ab80ab80 MFZE1 2002-01-19 10:35:51 +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
Sebastian Bergmann
62dc854bb0 Happy New Year. 2002-01-06 15:21:36 +00:00
Andi Gutmans
ae1a702501 - Fix some case insensitivity stuff in respect to classes 2001-12-28 16:36:04 +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
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
e1e02af55b - Revert delete syntax patch 2001-12-25 17:10:58 +00:00
Andi Gutmans
9e7c0d67d0 - Add initial capability of defining nested classes as class foo::bar 2001-12-22 15:31:44 +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
74efc41fc3 - Make classes have scope and function/constant lookups default to the class 2001-12-12 17:38:37 +00:00
Sebastian Bergmann
d863d52a5d Update headers. 2001-12-11 15:16:21 +00:00
Andi Gutmans
3bfee898db - More namespaces work.
- Nuke memory leak.
2001-12-10 18:57:17 +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
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
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
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
Stig S. Bakken
9382ddec52 non-zts compile fix 2001-11-05 00:16:33 +00:00