Commit Graph

348 Commits

Author SHA1 Message Date
Matt Wilmas
2e6d655efd MFH: - Saved opcode when unary +/- is applied to IS_CONST op (e.g. for negative numbers)
- Made '+' in static_scalar context behave as '-' by calling add_function()
2008-08-29 17:54:29 +00:00
Marcus Boerger
4344e2ec9e - MFH Add missing ';'s 2008-08-12 10:23:02 +00:00
Dmitry Stogov
478acfd8b4 . Added support for using static HEREDOCs to initialize static variables and class members or constants. (Matt)
. Improved syntax highlighting and consistency for variables in double-quoted strings and literal text in HEREDOCs and backticks. (Matt)
. Optimized interpolated strings to use one less opcode. (Matt)
2008-07-26 15:30:28 +00:00
Dmitry Stogov
44325e6473 Fixed bug #45178 (memory corruption on assignment result of "new" by reference) 2008-07-24 11:47:51 +00:00
Dmitry Stogov
d5ef2f466c Added support for lambda functions and closures 2008-07-14 09:49:03 +00:00
Stanislav Malyshev
4f522eb576 allow aggregating use statements 2008-06-08 09:38:47 +00:00
Dmitry Stogov
5521912b15 Use IS_CV for dirrent access to $this variable 2008-05-07 12:04:39 +00:00
Felipe Pena
f66f55edc5 MFH: Implemented "jump label" operator (limited "goto")
[DOC]
2008-03-28 14:35:01 +00:00
Marcus Boerger
d3e5026564 - MFH Add E_DEPRECATED (Lars Strojny, Felipe Pena, Marcus)
[DOC] Finally added deprecation messages
2008-02-23 17:06:22 +00:00
Dmitry Stogov
ddcf7a2f49 Added NEWDOC 2008-02-12 09:27:45 +00:00
Dmitry Stogov
51278b6d22 Fixed ext/tokenizer test failures because of token renumbering 2008-02-12 08:49:08 +00:00
Stanislav Malyshev
fd597dce1b [DOC] Add compile-time __DIR__ constant which implements dirname(__FILE__) 2008-02-12 00:21:15 +00:00
Marcus Boerger
1ecdaa3885 - Fix warnings 2008-02-03 14:32:48 +00:00
Dmitry Stogov
5a3eb53723 Fixed bug #38469 (unexpected creation of cycle, json tests failed, leaks memory) 2007-12-28 13:22:00 +00:00
Dmitry Stogov
64e8f22355 Allowed import of global classes "use ::GlobalClassName;" 2007-12-13 10:02:03 +00:00
Dmitry Stogov
6484b3c458 Fixed bug #43344 (Wrong error message for undefined namespace constant) 2007-12-07 17:11:24 +00:00
Johannes Schlüter
45f6b4ce2f - MFH Improved version of ternary shortcut (Marcus) 2007-11-21 09:41:35 +00:00
Johannes Schlüter
4a8ed7ab68 - MFH ?: operator (Marcus)
[DOC] "expr1 ?: expr1" is a shortcut for: "expr1 ? expr1 : expr2" as
        exists in gcc and discussed some time back. Note that this is not
        an implementation ifsetor($var, default). While ifsetor would not
        generate any message for non existing variables or array indices
        the ternary shortcut does. Also the ternary shortcut does a boolean
        evaluation rather then checking for isset(). That way ther ternary
        shortcut can work on any expression while ifsetor can only work on
        variables. Also to be silent one has do do: "@$expr1 ?: $expr2".
2007-11-21 00:03:16 +00:00
Dmitry Stogov
9f230a0d79 Added support for "namespace::" prefix that is resolved to current namespace name. 2007-11-20 08:53:02 +00:00
Johannes Schlüter
18a656de6f - MFH: static can't be used as type hint, fixes #43126 (Etienne Kneuss) 2007-11-11 22:11:25 +00:00
Dmitry Stogov
b7d87bebc9 T_IMPORT -> T_USE 2007-11-07 09:13:50 +00:00
Dmitry Stogov
b599e434ad Fixed bug #35163 (Array elements can lose references) 2007-10-23 09:55:11 +00:00
Dmitry Stogov
41e9b6b61c Fixed bug #42802 (Namespace not supported in typehints) 2007-10-01 10:37:14 +00:00
Dmitry Stogov
166266df68 Added support for Late Static Binding. (Dmitry, Etienne Kneuss) 2007-09-29 07:28:34 +00:00
Dmitry Stogov
f32ffe9b43 Namespaces 2007-09-28 19:52:53 +00:00
Johannes Schlüter
9483a2ff23 - Readd support for ynamic access of static members (Etienne) 2007-09-27 00:32:40 +00:00
Stanislav Malyshev
c8f090c13e Revert variable class patch for 5.2 2007-08-13 21:16:57 +00:00
Johannes Schlüter
b3c6a9dffc - Add possibility to call static class members using variables (Etienne Kneuss) 2007-08-02 21:55:23 +00:00
Stanislav Malyshev
bc2b546dcc fix #41401 - parser precedence on unary operators
# now 1/-2*5 is -2.5 as it should be
2007-05-18 18:36:04 +00:00
Dmitry Stogov
80d2409fd8 Improved compilation of heredocs and interpolated strings. (Matt, Dmitry) 2007-05-18 13:12:05 +00:00
Ilia Alshanetsky
17c0c49a54 Addres limitation of __HALT_COMPILER() that allowed only one instance
per request.

# Patch by Greg Beaver
2007-04-04 00:42:42 +00:00
Dmitry Stogov
e470e22e20 - Fixed bug #35106 (nested foreach fails when array variable has a reference).
- Fixed bug #36214 (__get method works properly only when conditional operator is used).
- Fixed bug #39449 (Overloaded array properties do not work correctly).
- Fixed bug #39990 (Cannot "foreach" over overloaded properties).
2007-01-10 15:58:08 +00:00
Antony Dovgal
c348c293c8 MFH: fix #39903 (Notice message when executing __halt_compiler() more than once) 2006-12-20 16:31:10 +00:00
Marcus Boerger
7a5240e846 - MFH missing bits and pieces of the partial sync with head
# This time i added:
# ZEND_FE_RESET_VARIABLE
# ZEND_FE_RESET_REFERENCE
# and dapted parser,compiler,executor,interfaces to handle these flags
# their purpose is to be able to pass whetehr foreach is done by ref to
# the current() handler so that it can error out in case it is not capable
# to comply to the requested return signature/protocol/semantics (weyp).
2006-05-11 21:07:39 +00:00
Ilia Alshanetsky
e7f6a3fab2 As per agreement during PDM, remove the E_STRICT deprecation notice from
"var".
2006-03-12 16:52:18 +00:00
Andi Gutmans
61e93ccfe8 - Update copyright notices to 2006 2006-01-04 23:53:05 +00:00
Dmitry Stogov
cc50a96139 Fixed bug #34873 (Segmentation Fault on foreach in object) 2005-10-17 07:57:00 +00:00
Marcus Boerger
967413c58c - MFH Fix Bug #34243 ReflectionClass::getDocComment() returns no result 2005-09-21 09:56:51 +00:00
foobar
916815b779 Bump up the year 2005-08-03 13:30:58 +00:00
Dmitry Stogov
343af548a6 Fixed SIGSEGV on 'global ${"{$blah}_ID"};' 2005-07-04 13:24:46 +00:00
Dmitry Stogov
0a44789bf3 Fixed bug #30961 (Wrong linenumber in ReflectionClass getStartLine()) 2005-06-08 06:49:01 +00:00
Zeev Suraski
d33500ee20 Thought I committed it ages ago... Anyway, without further delays, the final
__halt_compiler() patch
2005-06-04 16:16:19 +00:00
Dmitry Stogov
1a72341328 Added array type hinting. (This patch requires full re-make) 2005-05-26 13:46:17 +00:00
Marcus Boerger
a29f5391db - Cleanup foreach handling 2005-02-11 22:26:45 +00:00
Dmitry Stogov
fc96c7f7fa foreash($a as $key => $val) optimization
Removed temorary array creation on each iteration.
2005-02-07 16:09:54 +00:00
Marcus Boerger
2d13dd0ef0 - Remove part of the cleanup which causes a problem with unnormal code
like tests/lang/040.phpt
# However there is a memleak introduced somewhen after august 04 for such
# code now, 5.0 and 4.3 are fine though.
2005-02-07 15:22:38 +00:00
Marcus Boerger
662cd8262e - Cleanup foreach statement 2005-02-05 14:01:59 +00:00
Andi Gutmans
db507dd153 - Commit the variable fetch optimization.
- Extensions which delete global variables need to use new special function
- delete_global_variable() (I'm about to rename it) to remove them.
- Will post to internals@ or via commit messages if there's anything else.
2004-10-04 19:54:35 +00:00
Sebastian Bergmann
6ccbb6b51b ZTS fix. 2004-09-16 05:43:29 +00:00
Andi Gutmans
d8efe626b5 - Fix bug #27669 (Dmitry).
Fixes:
<?
        class A
        {
                function hello()
                {
                        echo "Hello World\n";
                }
        }
        $y[0] = 'hello';
        A::$y[0]();
?>
2004-09-16 00:40:38 +00:00
Marcus Boerger
dc7cb19993 - Remove all for now
# - the optimization part can be done in apc or compareable products
# - NULL can be reintroduced later when needed
2004-08-02 16:38:09 +00:00
Sara Golemon
d96e7a170c Revert goto opcode 2004-07-29 17:45:31 +00:00
Sara Golemon
5865b3680a Add goto operator by popular request. 2004-07-29 15:23:47 +00:00
Marcus Boerger
86d46f7cc1 - Speed up by making null/false/true reserved word which allows to drop
an opcode (FETCH_CONSTANT) for every usage.
2004-07-16 06:50:57 +00:00
Andi Gutmans
173782b73e - Fix bug #27283 - Exceptions where the last catch() statement was sometimes
- skipped.
2004-04-20 14:14:55 +00:00
Stanislav Malyshev
1293330175 check writability on =& too 2004-03-28 16:37:57 +00:00
Marcus Boerger
50ee116f08 Clearify the different method/class flags (as discussed with Andi). 2004-03-09 16:38:37 +00:00
Marcus Boerger
059c533b4a Fix __METHOD__ (noticed by Davey Sahfik) 2004-02-26 19:59:49 +00:00
Andi Gutmans
4f05437e08 - Improve precendence:
<?php

$obj->foo = "Blah";

if (!$obj instanceof StdClass) {
    print "No";
} else {
    print "Yes";
}
2004-02-23 18:17:16 +00:00
Andi Gutmans
4a14e5c30d - Decrease precedence of instanceof so that the following is true:
php -r 'var_export((object)1 instanceof stdClass);';
Patch by Jan Lehnardt
2004-02-23 08:40:39 +00:00
Marcus Boerger
c6cbafa273 Fix: <interface> [extends <interface> [, <ineterface>]* ] 2004-02-11 22:13:39 +00:00
Zeev Suraski
c5d842279c Reinstate early-binding for classes.
Note that this is available for downwards compatibility only - and it doesn't
work if you use new features (namely, interfaces).  Generally, people should
declare their classes before using them, but we just didn't want hell to break
loose (c)
2004-02-04 16:30:15 +00:00
Zeev Suraski
9e60cb553f Rewrote exception support. Fixes a few limitations and bugs in the old
implementation, and allows exceptions to 'fire' much earlier than before.

Instructions on how to use the new mechanism will follow on internals@
shortly...

Note - this (most probably) breaks the current implementation of
set_exception_handler()
2004-02-03 12:17:09 +00:00
Zeev Suraski
8e30d96ad8 Redesign the clone() feature to fix some fundamental flaws in the previous
implementation.

Using clone directly is now done using
$replica = clone $src;

Clone methods must now be declared as follows:
function __clone($that)
{
}

Clone methods in derived classes can call the __clone method of their parent
classes using parent::__clone($that)
2004-02-02 12:28:19 +00:00
Andi Gutmans
ac5d5c7f35 - Re-allow conditional class declerations. Needless to say that I also
- think it's not great coding.. Use polymorphism instead :)
2004-01-11 19:37:15 +00:00
Andi Gutmans
6b87194bd9 - - A belated happy holidays (by two years) 2004-01-08 08:23:23 +00:00
Marcus Boerger
885eafac61 Fixed bug #26065 (Crash when nesting classes) 2003-12-27 22:59:49 +00:00
Andi Gutmans
535653ee8e - Nuke another rule (thanks to Jan for noticing this) 2003-12-19 14:39:17 +00:00
Andi Gutmans
f9f19c99b3 - Nuke unused code 2003-12-19 13:35:42 +00:00
Andi Gutmans
c0df450203 - Add E_STRICT, to be used to warn purists (like Jani :) 2003-11-18 09:25:04 +00:00
Andi Gutmans
530789987f - Head up! I'm reverting the patch which allows for expressions in constant
- declerations. Allowing the access of other constants in this code is
- flawed. We are reverting back to PHP 4's static scalars.
- Don't worry if you get the following msg when compiling:
- "zend_language_parser.y contains 3 useless nonterminals and 22 useless rules"
- I didn't nuke the code in case we have some brilliant ideas after beta 2
2003-10-28 23:44:23 +00:00
Andi Gutmans
df033b58a0 - Nuke const in function parameters. I just can't remember why this exists
- and it seems no one else remembers either. It has no semantic meaning.
2003-10-19 08:38:48 +00:00
Zeev Suraski
2ab30d7133 Allow foo::$bar() 2003-10-09 13:44:44 +00:00
Zeev Suraski
f8bbafd604 ntroduce infrastructure for supplying information about arguments,
including:

- Whether or not to pass by ref (replaces the old arg_types, with arg_info)
- Argument name (for future use, maybe introspection)
- Class/Interface name (for type hints)
- If a class/interface name is available, whether to allow a null instance

Both user and builtin functions share the same data structures.

To declare a builtin function that expects its first arg to be an instance
of class 'Person', its second argument as a regular arg, and its third by
reference, use:

ZEND_BEGIN_ARG_INFO(my_func_arg_info, 0)
    ZEND_ARG_OBJ_INFO(0, someone, Person, 1)
    ZEND_ARG_PASS_INFO(0)
    ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO();

and use my_func_arg_info as the arg_info parameter to the ZEND_FE() family
of macros.

The first arg to each ZEND_ARG_*() macro is whether or not to pass by ref.

The boolean arg to ZEND_BEGIN_ARG_INFO() tells the engine whether to treat
the arguments for which there's no explicit information as pass by reference
or not.
The boolean argument to ZEND_ARG_OBJ_INFO() (4th arg) is whether or not to allownull values.
2003-08-03 17:40:44 +00:00
Zeev Suraski
03b6af07eb Support references in foreach()
Syntax:
  foreach ($arr as &$val)
  foreach ($arr as $key => &$val)
2003-07-24 12:38:33 +00:00
Zeev Suraski
cbec89a358 Fix complex expressions for class names in NEW 2003-06-22 10:50:43 +00:00
Zeev Suraski
f263aecc8e Simplify 2003-06-22 10:12:25 +00:00
Marcus Boerger
c8bebdaf67 WS 2003-06-21 21:56:44 +00:00
Marcus Boerger
60c7abac61 Add final classes 2003-06-21 21:56:06 +00:00
Stanislav Malyshev
8cd9792375 Fix bug #23384 - static class::constant constants should now
work in static & array expressions.
2003-06-15 13:58:50 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Zeev Suraski
8d2a4e04ae Fix bogus implicit declarations of properties (squash bug #23671) 2003-06-09 13:51:53 +00:00
Stanislav Malyshev
f7f5a5ea6b MEGA-patch: namespaces are R.I.P. 2003-06-02 12:13:11 +00:00
Marcus Boerger
21d32c2430 Fix ~ operator in class constants. 2003-05-29 19:27:11 +00:00
Sterling Hughes
0191ba5de1 allow expressions within constants, so the following is possible
class foo {
	const a = 1<<0;
	const b = 1<<1;
	const c = a | b;
}

this makes const a compile-time expression.  all other operators are
unaffected.
2003-04-10 15:43:47 +00:00
Zeev Suraski
65f06d8027 Revert Harald's commit 2003-04-10 04:43:42 +00:00
George Schlossnagle
dd090f4a77 One line fix so that it will compile 2003-04-10 03:11:27 +00:00
Harald Radi
07e775bcde removing the *syntactical sugar* again
# commiting that on behalf of the community :)
# don't blame me, i'm just acting as a proxy
2003-04-09 20:23:06 +00:00
Andrei Zmievski
bdd3b6042c Implement a different way to catch documentation comments. 2003-04-02 16:51:49 +00:00
Andrei Zmievski
e6255b06b1 Revert portions of the doc comment patch. There should be no parser
errors now.
2003-04-02 16:13:12 +00:00
Stanislav Malyshev
59af205988 Add __NAMESPACE__ auto-constant. 2003-04-01 09:22:41 +00:00
Andrei Zmievski
5657b83691 Multi-purpose patch:
- The fields of zend_namespace were not completely initialized which
   led to a variety of problems.
 - The occurrence of class/interface/namespace definition is now
   captured.
 - Functions/classes/interfaces/namespaces can be preceded by doc
   comments which are stored for use by extensions.
2003-03-31 20:42:01 +00:00
Andrei Zmievski
52372c31cd Since zend_do_begin_class_member_function_call assumes the previous
opcode is FETCH_CONSTANT, swap the calls around.
2003-03-30 18:51:04 +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
Andrei Zmievski
39d5a63803 - Keep track of starting/ending line numbers for user functions.
- Store last parsed doc comment in a compiler global for future use.
2003-03-19 21:17:47 +00:00
Zeev Suraski
12cbee7b05 Optimize 2003-03-09 22:23:27 +00:00
Zeev Suraski
0eae231254 Fix handling of ::foo 2003-03-09 22:17:15 +00:00
Zeev Suraski
8bc88d8df4 Fix parsing rules of namespaces/classes 2003-03-09 20:53:57 +00:00
Zeev Suraski
a89abf9162 Add ability to use ::interface_name in implements 2003-03-09 17:07:15 +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
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
Zeev Suraski
d5ada68654 Remove legacy code 2003-03-04 13:52:03 +00:00
Zeev Suraski
535aa63293 Add 'final' 2003-02-24 12:05:58 +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
827434c2a3 Whitespace & minor renames 2003-02-17 15:07:57 +00:00
Zeev Suraski
76c6d7e721 whitespace 2003-02-17 15:04:29 +00:00
Stanislav Malyshev
3e45b23799 add support for ::foo syntax meaning "global one" 2003-02-16 13:27:33 +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
2814504143 Improve parser handling of 'abstract' 2003-02-11 09:48:37 +00:00
Zeev Suraski
6317e26576 - Treat $this->foo inside class X as an implicit 'public $foo' if X::$foo
is not explicitly declared
- Forbid multiple declaration of the same variable
2003-02-10 12:46:58 +00:00
foobar
333406bdc2 - Added some missing CVS $Id$ tags, headers and footers. 2003-02-01 01:49:15 +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
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
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
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
26578c386d - Initial support for nested class definitions 2001-10-29 17:19:02 +00:00
Andi Gutmans
2eabb14dc7 - Merge the NAMESPACES_BRANCH. It wasn't a good idea to have a branch when
- the whole CVS tree is work in progress
2001-09-30 17:29:55 +00:00
Andi Gutmans
d7536a8a5f - Shift around the variable parsing code to make it simpler. 2001-09-07 14:46:12 +00:00
Andi Gutmans
7c4a0cc6cf - CLS_CC -> TSRMLS_CC 2001-09-03 16:57:49 +00:00
Andi Gutmans
29f5dbe10b - Initial support for exceptions. 2001-08-30 15:26:30 +00:00
Zeev Suraski
4f6c95d17a Whitespace 2001-08-11 15:56:40 +00:00
Andi Gutmans
cb1a40f399 - Preliminary patch for method() dereferencing 2001-08-08 15:07:11 +00:00
Andi Gutmans
5af7770a81 - Sync Engine2 CVS with latest Engine CVS 2001-08-07 03:17:33 +00:00
Zeev Suraski
8ce8324e59 More TSRMLS_FETCH annihilation 2001-07-30 04:54:16 +00:00
Zeev Suraski
b4f3b9d3ce Redesigned thread safety mechanism - nua nua 2001-07-28 10:51:54 +00:00
Zeev Suraski
2c254ba762 Get rid of ELS_*(), and use TSRMLS_*() instead.
This patch is *bound* to break some files, as I must have had typos somewhere.
If you use any uncommon extension, please try to build it...
2001-07-27 10:10:39 +00:00
Zeev Suraski
ec6c9f67c4 Optimize the parser a bit 2001-07-15 19:24:32 +00:00
Zeev Suraski
73f488b323 Allow indirect reference to method names in class::method() construct 2001-07-15 18:39:14 +00:00
Zeev Suraski
1e63f44084 Support interactive mode in thread-safe builds 2001-05-06 14:36:25 +00:00
Andi Gutmans
5c7a762249 - Add support for isset($var1, $var2, $var3); - Will be true only if all
- variables are set.
2001-03-19 19:31:14 +00:00
Andi Gutmans
baa92cc540 - Nuke commented code 2001-03-15 18:58:07 +00:00
Andi Gutmans
d2c9e8074c - Update copyright year 2001-02-26 05:43:27 +00:00
Andi Gutmans
352d23b853 - Support for $var =& new foo() syntax. This allows you to use objects
which create extra references to themselves in the constructor.
2000-12-05 18:45:58 +00:00
Zeev Suraski
464a561bb0 Missed those 2000-11-02 19:31:21 +00:00
Andi Gutmans
ce501c78a8 - Replace do_exit() with zend_do_exit().
- Problem reported by David Hedbor <david@hedbor.org>
2000-11-02 18:42:54 +00:00
Zeev Suraski
7b0d92dd18 Unify the names of these last 3 files... 2000-10-29 14:35:34 +00:00