Commit Graph

502 Commits

Author SHA1 Message Date
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
8838c0f860 - Two new API calls for Derick (retreive CV name and value) by Dmitry 2005-01-22 02:29:18 +00:00
Andi Gutmans
a904c1dabc - Improve comments, docs, code... 2004-10-27 17:58:46 +00:00
Marcus Boerger
f71644b480 - Revert automatic pass arg_info
# We need to find a better solutions to prevent havy extension writer probs
2004-10-08 22:17:32 +00:00
Marcus Boerger
f916d603ef - Add arginfo ZEND_ARG_SEND_AUTOMATIC which lets the compiler automatically
determine whether pass by ref is possible or pass by value is needed.
# This is usefull when functions take array or string parameters as
# expressions. In such a case force by ref is not applicable and the
# executor would copy the variable unnecessarily as soon as it is at least
# once referenced.
2004-10-05 18:36:46 +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
Andi Gutmans
f82ed13625 - Commit new VM architecture. This one allows people (aka Derick) to
- ask the engine to use function handler mode. Will update the README
- about that.
2004-09-23 21:43:32 +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
Andi Gutmans
96ab56e146 - Roll back VM commit 2004-09-09 16:47:22 +00:00
Andi Gutmans
8eb8850c90 - Some architectural changes:
a) We specialize opcodes according to op_type fields. Each opcode has to
    be marked with which op_type's it uses.
 b) We support different execution methods. Function handlers, switch()
    and goto dispatching. goto seems to be the fastest but it really
    depends on the compiler and how well it optimizes. I suggest playing
    around with optimization flags.

- Warning: Things might break so keep us posted on how things are going.
  (Dmitry, Andi)
2004-09-08 22:14:12 +00:00
Andi Gutmans
edb7c7d4f5 - Stop using garbage. Please let me know if you find any bugs resulting
- of this patch (very likely). (Dmitry, Andi)
2004-08-19 20:03:06 +00:00
Andi Gutmans
993f70c1d2 - Don't use magic numbers 2004-08-12 05:54:11 +00:00
Marcus Boerger
5f0433db83 MFB: Enforce protocol on magic methods/functions 2004-08-02 08:27:57 +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
Stefan Esser
fb5cb59035 Fixed Zend Function Destructor to use correct TSRM handle. 2004-06-06 08:37:12 +00:00
Zeev Suraski
e2a5ebf597 Add ability to disable JIT for a particular auto global 2004-03-16 19:46:04 +00:00
Marcus Boerger
50ee116f08 Clearify the different method/class flags (as discussed with Andi). 2004-03-09 16:38:37 +00:00
Andi Gutmans
0fc9d5861d - Nuke unused code. 2004-03-09 15:27:39 +00:00
Derick Rethans
afc35efcf6 - Typo fix (by Jan) 2004-03-01 12:25:03 +00:00
Stanislav Malyshev
edb21137de add ZEND_API there too for opcode handlers 2004-02-29 16:01:21 +00:00
Marcus Boerger
7fdd68af8b Add some comments 2004-02-27 18:20:53 +00:00
Zeev Suraski
7086634a0b - Improve ARG_INFO() macros to support supplying required_num_args
- Initial fix for foreach($o->mthd()->arr) crash (now leaks)
2004-02-25 14:56:45 +00:00
Zeev Suraski
36a751840d - Abstract methods cannot have defaults for arguments
- Make function foo($a, $b=null) satisfy both foo($a) and foo($a, $b)
  prototypes
2004-02-25 09:25:37 +00:00
Zeev Suraski
e7e0f7d4b4 - Check return-by-reference bit when implementing interface prototypes
- Add infrastructure for built-in functions to hint whether they
  return by reference or not.  It is NOT currently used for anything,
  except for interface prototypes (you can use it to request that the
  function that implements your prototype returns by reference or
  doesn't return by reference).
  For downwards compatibility - by default, interface prototypes are
  agnostic as to whether the function that implements them returns
  by reference or not.  Use ZEND_BEGIN_ARG_INFO_EX() with
  ZEND_RETURN_VALUE/ZEND_RETURN_REFERENCE to change that.
- Fix ArrayAccess::getOffset() to conduct additional checks.
  If your getOffset() should work with multidimensional arrays - it
  must return by reference.
2004-02-12 13:49:55 +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
Zeev Suraski
2adaa11f2f Prevent classes from implementing interfaces that have the same function 2004-01-28 10:25:45 +00:00
Marcus Boerger
3ca44539a1 Switch from ZEND_ACC_DYNAMIC to ZEND_ACC_ALLOW_STATIC and disallow calling
internal non-static methods statically.
# As discussed with Zeev:
# - For BC standard userspace methods allow this with an E_STRICT message.
# - If you want to implement an internal method taht can be called both
#   statically and non-statically then use flag ZEND_ACC_ALLOW_STATIC.
# - Magic user space methods __*() cannot and __construct, __destruct,
# __clone can never be called statically.
2004-01-24 16:59:24 +00:00
Marcus Boerger
6020ffd007 Simplify detection of methods that must be called dynamic (with object) 2004-01-23 22:04:42 +00:00
Marcus Boerger
7c2e02d380 Disallow static declaration of clone 2004-01-23 20:52:39 +00:00
foobar
ccfc46b0aa - Happy new year and PHP 5 for rest of the files too..
# Should the LICENSE and Zend/LICENSE dates be updated too?
2004-01-08 17:33:29 +00:00
Derick Rethans
6923a16c26 - Fixed var_export() to show public, protected and private modifiers properly.
- Exported (un)mangle_property_name.
2004-01-03 13:51:02 +00:00
Sebastian Bergmann
9c909f41fd Sync: Export externally used functions. 2003-12-16 11:44:19 +00:00
Zeev Suraski
3a42babad6 Fix behavior of return-by-reference functions. Remove erroneous warnings,
add E_STRICT warnings in case you return something by reference that you're
not supposed to (anything that's not a variable, or a return-value of a
function that returned by reference).
2003-12-14 16:09:07 +00:00
Andi Gutmans
d344648b07 - Fix __autoload() to preserve class case.
- Heads up, this patch might break stuff so please let me know if you
- bump into any problems.
2003-11-24 18:13:29 +00:00
Marcus Boerger
296529b886 Split isset/isempty for object property and object dimension hooking. 2003-11-10 16:14:44 +00:00
Marcus Boerger
3c62b3b5ac Expand Interface C API.
In short: zend_class_entry->interface_gets_implemented()  allows to modify
the class entry of a class when an interface gets implemented.
2003-10-22 19:59:58 +00:00
Marcus Boerger
cec053f707 Don't identify alias'ed functions 2003-08-24 16:35:58 +00:00
Marcus Boerger
1c2512ddea - Add fn_flag ZEND_ACC_ALIAS
- Unify way of function_entry generation by new macro ZEND_FENTRY
2003-08-24 11:09:45 +00:00
Marcus Boerger
baaa4c903d Internal classes can now have default properties. 2003-08-23 19:37:39 +00:00
Marcus Boerger
fbda310a41 - Flag ctor/dtor methods
- Use this to prevent memleaks when an exception gets thrown in ctors.
# I added the dtor flags for consistency, atm a compareable check in
# isn't necessary for destruction. But anyway i'll use this for the
# Relection API too.
2003-08-23 15:38:58 +00:00
Zeev Suraski
49c4866a47 - Improve tracking
- Fix several overloading issues
2003-08-18 22:31:11 +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
9d7122fb53 Generalize fetch_class 2003-08-03 08:21:08 +00:00
Zeev Suraski
68fa4e50f8 Get rid of an opcode 2003-07-30 17:49:27 +00:00
Zeev Suraski
c0b46739ca Improve array overloading - support unset($foo["bar"]) 2003-07-30 17:12:06 +00:00
Zeev Suraski
4839ce5952 Remove garbage 2003-07-30 17:02:41 +00:00
Zeev Suraski
2fd4ffce17 Add exec_finished() callback for modules - this is the last place where the
modules may touch the symbol table reliably
2003-07-30 16:13:52 +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
Stanislav Malyshev
237116aa27 Remove namespace leftovers 2003-07-23 08:58:46 +00:00
Zeev Suraski
3a898f6d4e More cleanup for assign-op handling of objects 2003-07-16 08:57:08 +00:00
Zeev Suraski
134338522f Rework zend_do_declare_property and related code into one code base 2003-07-07 16:22:56 +00:00
Zeev Suraski
938c0fbc19 Initial support for overloading of array syntax for objects (very initial) 2003-07-07 09:00:36 +00:00
Marcus Boerger
60c7abac61 Add final classes 2003-06-21 21:56:06 +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
Zeev Suraski
d329ce93f2 Nicer handling of protected/private members in print_r() 2003-06-08 18:53:58 +00:00
Stanislav Malyshev
f7f5a5ea6b MEGA-patch: namespaces are R.I.P. 2003-06-02 12:13:11 +00:00
Marcus Boerger
7463e7239b Defining it once is enough 2003-06-01 11:15:01 +00:00
Marcus Boerger
472cc5b9f3 Faster interface inheritance & faster inheritance checks 2003-05-29 19:00:40 +00:00
Sebastian Bergmann
dccdb2f549 Fix warnings. 2003-04-11 17:30:42 +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
Sterling Hughes
5ae7fa422d add markers that make this file easy to parse for external sources 2003-04-07 21:48:17 +00:00
Andrei Zmievski
1885d00861 Simplify. 2003-04-02 18:15:08 +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
800de8acb0 allow class_exists() to work with namespaces too.
add CLASS_IS_NAMESPACE macro
2003-04-02 15:28:31 +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
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
Zeev Suraski
5097be302e Initial support for enforcing prototype of abstract/interface method implementations 2003-03-29 11:19:38 +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
Shane Caraveo
170de9b95c export functions needed by cli 2003-03-22 23:26:00 +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
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
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
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
26dd8492ed Add support for interfaces 2003-03-05 11:14:44 +00:00
Zeev Suraski
98b990e336 Improve infrastructure 2003-03-02 13:33:31 +00:00
Zeev Suraski
f7b7800479 Add infrastructure for JIT initialization of auto globals 2003-03-02 10:04:53 +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
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
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
2814504143 Improve parser handling of 'abstract' 2003-02-11 09:48:37 +00:00
Zeev Suraski
c17c7a2bfa Centralize class initialization 2003-02-10 16:11:24 +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
Zeev Suraski
471947b188 Reimplement PPP properties 2003-02-04 12:12:34 +00:00
foobar
333406bdc2 - Added some missing CVS $Id$ tags, headers and footers. 2003-02-01 01:49:15 +00:00
Stanislav Malyshev
03f88ac2b2 Add additional stage to post-session cleanup.
We need separate cleanup stage because of the following problem:
Suppose we destroy class X, which destroys function table,
and in function table we have function foo() that has static $bar. Now if
object of class X was assigned to $bar, its destructor will be called and will
fail since X's function table is in mid-destruction.
So we want first of all to clean up all data and then move to tables
destruction.
Note that only run-time accessed data need to be cleaned up, pre-defined
data can not contain objects and thus are not probelmatic.
# Looks like we are having a lots of pain in the various parts of the body
# because of the destructors...
2003-01-29 17:54:48 +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
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
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
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
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
01e853c2ce - My personal cleanups 2002-11-23 20:46:39 +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
9726e74da5 Fix prototype. 2002-11-21 14:16:57 +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
6f9bfe5cca - Shift around zend_op members 2002-11-05 21:35:05 +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
Stanislav Malyshev
3a9eeea213 avoid using 'class' in exported functions - it annoys c++ 2002-11-05 17:21:23 +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
d12679a64d - Improve overall engine performance 2002-10-22 19:31:53 +00:00
Andi Gutmans
13274801e4 - Fix compile warning. 2002-10-19 20:57:15 +00:00
Andi Gutmans
536d4d8aab - Improve opcode dispatching 2002-10-19 09:45:51 +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
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
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
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
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
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
0ce019f715 - Fix issues with $this when using it by itself without indirection such as
- $this->foo.
2002-03-15 15:09:46 +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
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
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
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
Sebastian Bergmann
1fd542fd38 Export lex_scan(). Both the PHPDoc and tokenizer extension need this. I hope this is okay with Z&A. 2002-02-10 12:54:02 +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
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
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
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
Andi Gutmans
ae1a702501 - Fix some case insensitivity stuff in respect to classes 2001-12-28 16:36:04 +00:00
Andi Gutmans
b3fd2faac0 - Support parent:: again 2001-12-27 13:12:45 +00:00
Andi Gutmans
2ce4b47657 - Initial support for _clone() 2001-12-26 17:49:22 +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
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
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
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
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
Andi Gutmans
559d611a86 - MFZE1 2001-11-24 18:27:20 +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
Zeev Suraski
9f61e47c24 MFZE1 (nuke cplusplus code) 2001-09-10 00:08:24 +00:00
Zeev Suraski
819ea51d00 MFZE1 2001-08-31 13:11:52 +00:00
Andi Gutmans
619702157b - Make it compile in thread-safe mode. 2001-08-30 17:27:43 +00:00
Andi Gutmans
560606d210 - Get rid of warning and C++ comments 2001-08-30 15:31:35 +00:00
Andi Gutmans
29f5dbe10b - Initial support for exceptions. 2001-08-30 15:26:30 +00:00
Andi Gutmans
9d11db1200 - Merge new $_GET, $_POST etc. patch from Engine 1 tree 2001-08-08 17:18:16 +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
d76cf1da18 More TSRMLS_FETCH work 2001-07-31 04:53:54 +00:00
Zeev Suraski
4187439cff More TSRMLS_FETCH work 2001-07-30 07:43:02 +00:00
Zeev Suraski
b57703825b Avoid TSRMLS_FETCH()'s (still lots of work left) 2001-07-30 01:48:22 +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
85b4df53c0 Improved interactive mode - it is now available in all builds, without any significant slowdown 2001-07-15 14:08:58 +00:00
Zeev Suraski
bda9c83a82 Recover from a parse error in include files (before, it could result in a crash under certain circumstances). Fix bug #8663 2001-05-06 19:30:31 +00:00
Zeev Suraski
1e63f44084 Support interactive mode in thread-safe builds 2001-05-06 14:36:25 +00:00
Andi Gutmans
d2c9e8074c - Update copyright year 2001-02-26 05:43:27 +00:00
Zeev Suraski
6f6e13de54 Use iostream.h instead of istream.h (IBM's compiler doesn't come with istream.h,
and iostream.h should include it)
2000-12-26 23:05:55 +00:00
Andi Gutmans
8d9082563a - Allow passing references which are returned from functions and new
- statements to be passed by reference.
2000-11-27 18:46:23 +00:00
Andi Gutmans
1ccf94066c - Move SET_UNUSED() to header 2000-11-11 17:59:47 +00:00
Andi Gutmans
5e33cdaef3 - Remove this damn thing once again. 2000-11-10 11:48:12 +00:00
Andi Gutmans
f950a3724c - Maybe it's OK now? :) 2000-11-09 23:54:18 +00:00
Andi Gutmans
113a5bb8c2 - Undo the previous commit for fixing $obj = new foo(). 2000-11-09 23:43:21 +00:00
Andi Gutmans
d9d4824cd3 - Commit experimental patch to fix the problem when doing $a = new foo()
and the constructor assigns $this by reference to other symbol table
  elements. Thanks to Daniel J. Rodriguez on this one.
2000-11-09 22:11:14 +00:00
Zeev Suraski
f1a9920bcf Maintain consistency 2000-11-02 19:27:55 +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
d0fbddcc2b Fix a corruption bug, when erroneously allowing to send non-variables by reference (several
bug-db reports seem to originate in this bug)
2000-10-29 19:16:29 +00:00
Zeev Suraski
7b0d92dd18 Unify the names of these last 3 files... 2000-10-29 14:35:34 +00:00
Zeev Suraski
5286b3971c Make compile_string() accept a description of the code 2000-09-12 19:47:25 +00:00
Zeev Suraski
7795aca4ca Fix warning issue (compile errors inside require()'d files were incorrectly supressed) 2000-08-15 16:44:40 +00:00
Stanislav Malyshev
5090b1e8d5 Fix zend_fiel_handle handling. Should fix URL include
and various opened_path inconsistencies.
2000-08-13 18:00:50 +00:00
Andi Gutmans
e5015ed581 @ Fix problem with nested foreach()'s (Andi, Zend Engine) 2000-08-10 22:08:02 +00:00
Zeev Suraski
c06692e9ec The patch we promised - redesigned the compilation/execution API:
Advantages:
- Smaller memory footprint for the op arrays
- Slightly faster compilation times (due to saved erealloc() calls and faster zend_op
  initialization)
- include_once() & require_once() share the same file list
- Consistency between include() and require() - this mostly means that return()
  works inside require()'d files just as it does in include() files (it used to
  be meaningless in require()'d files, most of the time (see below))
- Made require() consistent with itself.  Before, if the argument was not a constant
  string, require() took the include() behavior (with return()).
- Removed lots of duplicate code.
Bottom line - require() and include() are very similar now;  require() is simply an include()
which isn't allowed to fail.  Due to the erealloc() calls for large op arrays, require()
didn't end up being any faster than include() in the Zend engine.
2000-08-09 19:22:35 +00:00
Andi Gutmans
f4e2a900d6 - Oops. Too early in the morning 2000-07-11 04:15:35 +00:00
Andi Gutmans
e95220e722 - Include iostream.h in C++. 2000-07-11 04:07:18 +00:00
Sascha Schumann
a61721741b Replace macros which begin with an underscore through an appropiately
named macro.
2000-07-03 00:55:36 +00:00
Andi Gutmans
727398b2d4 Add to the API 2000-06-13 19:01:22 +00:00
Sascha Schumann
df74f1dfab Add optional support for C0x inline semantics.
These are enabled by specifying `--enable-c0x-inline' on the command
line. We might add an autoconf check for this particular feature
later.
2000-06-13 17:58:33 +00:00
Andi Gutmans
eb0e694665 - Andrei, this is for you!
- Add zend_register_internal_class_ex() which allows you to specify a
- parent to inherit from. You can either specify the parent directly or via
- its name.
2000-06-09 14:40:14 +00:00
Zeev Suraski
0b7a9cea88 - Fix Win32 compilation (Use winsock2.h from now on)
- Add lambda() support
2000-06-03 01:49:49 +00:00
Andi Gutmans
a8b0d9609c - Fix Apache php source highlighting mode. It was crashing due to the
- module shutdown functions being called when the startup functions weren't
- being called.
2000-05-21 17:41:16 +00:00
Andi Gutmans
69eb908f06 - Change fetch_type to be zend_uint 2000-05-03 18:01:35 +00:00
Zeev Suraski
42d15298d7 Fix possible bug with extension dtors being called without the ctors being called first 2000-04-29 02:56:44 +00:00
Zeev Suraski
e0a48fe623 Beautify 2000-04-29 01:30:17 +00:00
Zeev Suraski
974671eced *** empty log message *** 2000-04-27 21:48:47 +00:00
Zeev Suraski
4b6594c5e9 Change to using the #define's 2000-04-27 21:26:17 +00:00
Andi Gutmans
207167c54b - Export pass_include() for Windows 2000-04-19 08:17:34 +00:00
Zeev Suraski
e663d856b3 Fix object overloading support 2000-04-10 20:21:13 +00:00
Zeev Suraski
232b90454f Clean up last/size definitions 2000-04-10 18:02:40 +00:00
Zeev Suraski
4cdcf638ce *** empty log message *** 2000-04-09 16:08:10 +00:00
Torben Wilson
521c8af6a4 Added !== (is not identical) operator. 2000-03-29 22:05:19 +00:00
Thies C. Arntzen
3b88c31bfc kill warning 2000-03-19 10:50:48 +00:00
Andi Gutmans
61379fe0c3 - Another zend_uchar 2000-03-13 15:59:24 +00:00
Andi Gutmans
e92f6f15cb - define zend_uint and zend_uchar and use them in a few places 2000-03-13 15:43:40 +00:00
Andi Gutmans
712ffd4c14 - Change type from int -> char 2000-03-13 15:11:07 +00:00
Andi Gutmans
b5de395367 - Support require_once(). 2000-03-10 16:04:16 +00:00
Andi Gutmans
9cc704421a - Cleanup old IMPORT stuff 2000-03-10 15:05:00 +00:00
Zeev Suraski
5e55e47f7f It's official now... 2000-03-06 05:26:39 +00:00
Zeev Suraski
0ac9536d99 (c) patch 2000-02-19 22:46:42 +00:00
Andi Gutmans
9b840c5f59 - Hopefully fix Thies' bug report. 2000-02-16 16:00:02 +00:00
Andi Gutmans
7fa17e8e08 - Put in the infrastructure for the unset() fix. Right now it has the old
behavior but I just need time tomorrow to add the correct behavior.
2000-02-14 20:31:01 +00:00
Zeev Suraski
b6197bcf90 Maintain a state of whether we're compiling and/or executing 2000-02-04 14:45:58 +00:00
Zeev Suraski
485412ecb1 Improve dependencies 2000-02-01 22:04:52 +00:00
Andi Gutmans
45686e3a55 - This has to always be done. 2000-01-31 21:09:14 +00:00
Zeev Suraski
f2d3ce4170 - Optimized garbage mechanism
- Fixed another buglet in the parser
2000-01-31 19:18:07 +00:00
Zeev Suraski
ad115d2088 Fix require() 2000-01-29 17:19:47 +00:00
Andi Gutmans
7663e4f65e - Add parser support for string offsets. This added three shift/reduce
conflicts but they all seem to be fine.
- Cleaned up the parsing rules a bit and made them much more compact and
  elegant.
- Please CVS update and see that I didn't break anything.
2000-01-29 10:16:04 +00:00
Zeev Suraski
fafbf6d8da - Implement declare() with declarables framework
- Implement ticks - Germany&Norway - 5 points!
2000-01-24 19:00:30 +00:00
Zeev Suraski
62114c1806 Destructors no longer return ints, the low level problem it was intended to solve is long gone now... 2000-01-17 17:33:37 +00:00
Zeev Suraski
dc0e663241 Allow module startup to be separate from the compiler/executor startup 2000-01-16 19:41:15 +00:00
Andi Gutmans
400ee6caa0 - Fix bug #3073. continue in do..while() loops should work now 1999-12-31 12:56:48 +00:00
Andi Gutmans
62b2087a84 - Create two new macro's. ALLOC_ZVAL() and FREE_ZVAL(z) and make Zend use
them.
1999-12-24 15:22:11 +00:00
Zeev Suraski
67b4b3a634 - require() of a dynamic expression now has the standard require() semantics
- Fixed a memory leak in require() of a dynamic expression
1999-12-23 15:03:25 +00:00
Andi Gutmans
7fe808ea02 - By mistake commited this to the branch. It fixes a bug we introduced with
the return reference patch.
1999-12-17 08:24:10 +00:00
Zeev Suraski
ced9cee10c - Implement return by reference:
- In function declaration instead of the return statement
  - In the assignment phase
- Implement ability to turn off support for call-time pass by reference
1999-12-15 20:15:32 +00:00
Zeev Suraski
ef596bbafb Move the #include of zend-parser.h out of zend_compile.h 1999-12-06 20:42:44 +00:00
Zeev Suraski
00c3ac908b Localize a couple of macros 1999-12-06 15:31:06 +00:00
Zeev Suraski
9baad80459 - Break the zend->PHP dependency introduced by the .php extension for use(),
by providing an API
- Enable Stig's patch for use() extensions (it wasn't refered to by the parser)
- Fix a memory leak in that code
1999-12-04 13:26:57 +00:00
Stig S. Bakken
aaadc71d5d Fix typo, add prototype for use_filename(). 1999-12-04 11:45:14 +00:00
Zeev Suraski
fdcaba4096 Solve a couple of compile issues 1999-12-02 18:59:29 +00:00
Stig S. Bakken
93536507f6 Fix warnings surfacing in maintainer-mode. 1999-12-01 22:55:20 +00:00
Andi Gutmans
5463dd5b38 - Add use support (behaves like require, but will not use the same file twice)
- Add import support (behaves like include, but requires parentheses;  will not
  use the same file twice; Currently, it is not yet properly implemented, and
  only behaves like include)
1999-11-30 20:15:04 +00:00
Zeev Suraski
58153dfed0 - Improve the file handle closing code 1999-11-26 23:45:22 +00:00
Andi Gutmans
4ebf7b85ad - Fix comment as to Joey's findings 1999-11-14 10:30:39 +00:00
Andi Gutmans
6d988ec694 - Add support for BYREF_FORCE_REST 1999-11-03 19:21:56 +00:00
Zeev Suraski
7f35cfda71 *** empty log message *** 1999-10-25 16:07:14 +00:00
Andi Gutmans
98f025430e - Move IS_IDENTICAL next to IS_EQUAL 1999-10-19 14:19:42 +00:00
Andi Gutmans
7a205f6087 - Preliminary submit of Thie's patch. Will fix the rest on Windows
as this was added on UNIX with patch. Changed IS_SAME -> IS_IDENTICAL
1999-10-19 13:33:17 +00:00