Commit Graph

84 Commits

Author SHA1 Message Date
Zeev Suraski
4bab4a7b55 Fix writability checks 2003-01-09 14:46:46 +00:00
Zeev Suraski
32b100e6cb - Allow variables to have both 'static' modifier and an access level.
NOTE:  This only works at the syntax level right now (parser).  It
         doesn't actually work as of yet - all statics are considered
         public for now
- Prevent users from putting more restrictions on methods in derived classes
  (i.e., you cannot make a public method private in a derived class, etc.)
2002-12-09 12:10:17 +00:00
Zeev Suraski
dc5c790a49 Treat the absence of an access type just as if 'public' was supplied 2002-12-08 14:09:43 +00:00
Zeev Suraski
e156edb1d0 Remove unintentional code 2002-12-07 15:52:08 +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
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
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
Stanislav Malyshev
830c2e0df6 fix statics - make it behave like $this (fetch type "static")
Side effect: indirect references to statics won't work.
2002-11-10 17:50:27 +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
983be5c73c - ATTENTION: Finally nuke old_function and cfunction. I think it is time
- to get rid of these BC notations. This is from the days of the move from
- PHP/FI 2 -> PHP 3
2002-11-05 18:25:09 +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
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