Commit Graph

558 Commits

Author SHA1 Message Date
Marcus Boerger
2bbf4ad261 Bugfix #24637 __destruct not called 2003-08-10 23:59:35 +00:00
Moriyoshi Koizumi
fe489dcb4f Fix segfault when a referenced parameter is specified with typehint.
Result of the node will never be used because verify_instanceof handler has
been eliminated.
2003-08-09 19:29:38 +00:00
Stanislav Malyshev
b6ff804cfe fix leaks: bug #24831 2003-08-04 10:40:05 +00:00
Zeev Suraski
1959133fb3 Simplify code using XOR 2003-08-04 07:53:09 +00:00
Marcus Boerger
538aad24e3 Fix test and add missing initialization 2003-08-03 22:03:52 +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
accd6b623b Finish the array overloading patch 2003-07-31 09:06:11 +00:00
Zeev Suraski
68fa4e50f8 Get rid of an opcode 2003-07-30 17:49:27 +00:00
Zeev Suraski
f41f62c2ff Support overloading of $foo["bar"] += "baz" 2003-07-30 17:40:54 +00:00
Zeev Suraski
c0b46739ca Improve array overloading - support unset($foo["bar"]) 2003-07-30 17:12:06 +00:00
Stanislav Malyshev
57b12285de fix compare 2003-07-27 16:43:05 +00:00
Stanislav Malyshev
7b1bbc85bc use zend_binary_strncasecmp 2003-07-27 16:39:35 +00:00
Stanislav Malyshev
9fa2d52310 make clone and throw coexist peacefully 2003-07-27 13:20:31 +00:00
Stanislav Malyshev
5724c7a66c fix leaks with class constants (bug #24699) 2003-07-27 12:03:54 +00:00
Stanislav Malyshev
78f8ca6e55 make __clone call case insensitive, just as other calls are 2003-07-27 11:42:21 +00:00
Zeev Suraski
55097d1dcf Fix another HANDLE_NUMERIC bug. Looks like you opened Pandora's box, Sterling ;) 2003-07-24 13:14:57 +00:00
Zeev Suraski
7928e763d2 Remove useless code 2003-07-24 12:51:07 +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
e10dbc607c Fix bug in the verification of interface-function implementation 2003-07-16 09:13:47 +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
d7e14ad8a3 Allow final private methods
#
# Declaring a method private and final would only be an error for an abstract
# class. But at the moment the method is defined and it's modifiers are checked
# we do not know whether or not we have an abstract class. It could already be
# abstract but it also become abstract later.
#
# Since i made the mistake in first place i remove the check now.
#
# Providing the correct test would slow down the compiler becuase we'd have to
# iterate through all methods on all abstract classes and check for this. I
# guess we can live without. Or does anybody wants this to be implemented ?
2003-07-03 16:45:37 +00:00
Stanislav Malyshev
8f0234160a enable Classname() constructor to be called via parent::__constructor() 2003-07-03 12:03:11 +00:00
Andi Gutmans
02c7aacf83 - Nuke CG(in_clone_method) 2003-07-02 16:52:07 +00:00
Sterling Hughes
778d8c8bf1 nuke "main" as a reserved keyword 2003-06-30 20:24:26 +00:00
Andi Gutmans
288dacca0c - ZE coding style requires if ( instead of if( 2003-06-30 20:22:35 +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
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
Sterling Hughes
5bb29cfaeb revert the function call caching patch until a new solution is decided
upon.
2003-05-31 18:31:28 +00:00
Marcus Boerger
21d32c2430 Fix ~ operator in class constants. 2003-05-29 19:27:11 +00:00
Marcus Boerger
472cc5b9f3 Faster interface inheritance & faster inheritance checks 2003-05-29 19:00:40 +00:00
Wez Furlong
15fd642525 Fix Bug #23285 (Potential Stack Overflow in zendlex). 2003-05-29 09:01:55 +00:00
Sterling Hughes
88b2f89eee Cache function call lookups with loops (store in a temporary variable on the
result opline).
Assuming lazy concensus on message that GeorgeS sent to the list last week
2003-05-28 20:42:40 +00:00
Stanislav Malyshev
462eff3497 fix __clone 2003-05-19 17:12:56 +00:00
Marcus Boerger
d3693d9214 Inheritance fix
# here we  go again, sorry for the mess and thanks to edin for reverting it
2003-05-08 15:04:43 +00:00
Edin Kadribasic
7a0efe828a Reverting Marcus' incomplete patch which broke the build. 2003-05-07 22:19:43 +00:00
Marcus Boerger
764eaa5b8b Inheritance fixes 2003-05-07 00:54:38 +00:00
Marcus Boerger
9d251cde97 Don't inherit twice what is needed only once 2003-05-04 18:56:35 +00:00
Sterling Hughes
b4262dcf17 Add check for final properties 2003-04-20 14:52:40 +00:00
Sebastian Bergmann
dccdb2f549 Fix warnings. 2003-04-11 17:30:42 +00:00
Sterling Hughes
c013f78274 satisfy andi's switch fetish ;-) 2003-04-10 20:08:02 +00:00
Sebastian Bergmann
974f406eda Fix ZTS build. Fix warning. 2003-04-10 17:02:31 +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
Andrei Zmievski
91eff553e3 Initialize all relevant zend_class_entry fields to avoid accidental
crashes.
2003-04-03 14:44:41 +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
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
96231c3ab5 Add missing initialization 2003-03-29 19:20:35 +00:00
Zeev Suraski
20860feef1 Fix crash 2003-03-29 11:27:17 +00:00
Zeev Suraski
5097be302e Initial support for enforcing prototype of abstract/interface method implementations 2003-03-29 11:19:38 +00:00
Ilia Alshanetsky
018d851129 Fixed bug #22900 (declaration of namespaces with same name results in leaks). 2003-03-26 17:06:08 +00:00
Andi Gutmans
85d2c35bfa - Temporarily fix problem with inheriting from an internal class. This might
- need some rework in the future (thanks to Marcus)
2003-03-25 20:36:26 +00:00
Zeev Suraski
0aef71ff89 Another fix for implicit public, perhaps it was not such a good idea :I 2003-03-23 08:14:41 +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
40326f6adf - Fix situation where a derived class declares a public (or implicit public)
with the same name as a private in the parent
- Optimize 'static binding' of private properties a bit
2003-03-18 16:30:23 +00:00
Zeev Suraski
fa7dc03edb Fix a crash bug in the implicit public declaration 2003-03-12 09:38:19 +00:00
Zeev Suraski
3e7cf8e15e Clean redundant code 2003-03-10 07:20:43 +00:00
foobar
f8fc50ed6d Fixed some leaks. Patch by Moriyoshi 2003-03-10 03:04:02 +00:00
Zeev Suraski
0eae231254 Fix handling of ::foo 2003-03-09 22:17:15 +00:00
Zeev Suraski
3012bdc332 Cleanup 2003-03-09 22:02:37 +00:00
Zeev Suraski
8bc88d8df4 Fix parsing rules of namespaces/classes 2003-03-09 20:53:57 +00:00
Zeev Suraski
8e1917bdbe Fix :: handling 2003-03-09 17:06:52 +00:00
Zeev Suraski
805f98065d Fix warnings 2003-03-06 23:45:50 +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
812d91d08c Fix auto globals 2003-03-05 21:36:30 +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
e0c3e2cf93 Remove redundant code 2003-03-04 13:36:16 +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
805637b06d Fix mem leak 2003-03-01 19:08:41 +00:00
Andi Gutmans
1a7c0d52dc - Make __construct() have higher priority than class name functions
- for constructors.
- Fix problem with the engine allowing final/abstract for the same method.
- Both patches are by Marcus Börger.
2003-03-01 14:57:49 +00:00
Zeev Suraski
5793784c93 Get the bits right - final/private fix 2003-02-25 10:03:26 +00:00
Stanislav Malyshev
3cf20f86db fix exception handling 2003-02-24 13:35:47 +00:00
Zeev Suraski
535aa63293 Add 'final' 2003-02-24 12:05:58 +00:00
Zeev Suraski
731a55ad52 Move abstract inheritance logic to the right spot 2003-02-23 13:58:48 +00:00
Zeev Suraski
bb956372a5 Fixed abstract handling in inheritence 2003-02-23 12:51:40 +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
Stanislav Malyshev
3e45b23799 add support for ::foo syntax meaning "global one" 2003-02-16 13:27:33 +00:00
Stanislav Malyshev
c9b2ec7be7 remove debug prints 2003-02-16 12:04:41 +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
3c2a1255cd Fix declaration of class members that don't have an explicit access modifier 2003-02-12 16:28:34 +00:00
Zeev Suraski
beaf84ea17 Fix require() handling - that's an old bug! 2003-02-11 15:41:46 +00:00
Zeev Suraski
2814504143 Improve parser handling of 'abstract' 2003-02-11 09:48:37 +00:00
Zeev Suraski
f196e11f42 Fix zend_initialize_class_data() 2003-02-10 16:46:05 +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
5e12de9510 Add missing destructors 2003-02-10 11:03:22 +00:00
Zeev Suraski
b39b33c4c5 Fix the 2nd buglet in the error message :) 2003-02-06 00:39:58 +00:00
Zeev Suraski
17439aa9c4 Rework static class properties - now supports access restrictions 2003-02-05 13:35:52 +00:00
Zeev Suraski
ef77e582f5 Fix buglet in error message 2003-02-05 07:46:13 +00:00
Zeev Suraski
471947b188 Reimplement PPP properties 2003-02-04 12:12:34 +00:00
Andi Gutmans
87f4472afb - Fix warning 2003-02-02 05:20:31 +00:00
foobar
333406bdc2 - Added some missing CVS $Id$ tags, headers and footers. 2003-02-01 01:49:15 +00:00
Stanislav Malyshev
123d8f782f fix memory leak 2003-01-29 14:25:53 +00:00
Zeev Suraski
49fd225238 Fix a ticks related crash 2003-01-28 11:34:24 +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
Stanislav Malyshev
dce8267f35 Restore for now old statics behaviour (so that indirect $$var references would work again). Comprehensive fix will follow later. 2003-01-19 17:25:39 +00:00
Andi Gutmans
e5afca38b6 - Revert int -> unsigned int change for str.len 2003-01-15 20:35:06 +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
Stanislav Malyshev
67c50ee22a fix warning 2003-01-14 12:27:07 +00:00
Stanislav Malyshev
33b67ab868 fix inheritance 2003-01-12 18:57:18 +00:00
Stanislav Malyshev
d48ffd97d6 RIP handle_* functions. ZE2 will use __ handlers instead.
# Yes, I know this will break some things. I will fix those I can find shortly.
2003-01-12 17:16:07 +00:00
Zeev Suraski
424e98f4e2 Implemented compatibility mode
To enable - zend2.implicit_clone = on in php.ini or using ini_set()
2003-01-12 12:39:06 +00:00
Zeev Suraski
66d30a4966 Found some more occurences of that elusive bug... 2003-01-09 16:16:57 +00:00
Zeev Suraski
ef6a44d15c Fix one lousy, annoying lurking bug (memory corruption)
Sebastian - try coWiki again please...
2003-01-09 16:10:33 +00:00
Zeev Suraski
cf05f34c66 MFZE1 - lineno fix 2003-01-05 16:09:59 +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
Andrei Zmievski
4121057117 do_inherit_method_check() is supposed to return 0 or 1, not SUCCESS or
FAILURE.
2002-12-26 16:27:59 +00:00
Zeev Suraski
66aba3c568 Fix check to allow for static+access level modifiers 2002-12-10 09:04:12 +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
8f491470a1 Remove comment 2002-12-08 14:10:58 +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
68aa19445b Simplify/fix inheritance checks 2002-12-07 21:46:12 +00:00
Andi Gutmans
1d1a796b58 - Dissallow using parent, self and main as class names 2002-12-07 15:51:25 +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
671fff2fde h WHitespace 2002-11-30 11:20:25 +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
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
Andi Gutmans
e19165b356 - MFZE1 2002-11-10 22:02:28 +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
f7f9721bdb - Change the automatically created variable $clone in __clone() to
- $that as discussed at the PHP Conference. If there are any objections
- alternative names please let me know. The reason for changing it from
- $clone is because $clone sounds as if it's the newly cloned object and
- not the old one.
2002-11-05 18:16:11 +00:00
Stanislav Malyshev
3a9eeea213 avoid using 'class' in exported functions - it annoys c++ 2002-11-05 17:21:23 +00:00
Ilia Alshanetsky
e849aa9d9b Silence compiler warnings. 2002-11-04 17:35:41 +00:00
Andi Gutmans
1eb04a850e - This might improve performance. Commiting it so that I can check it on
- Linux
2002-10-23 20:40:07 +00:00
Stanislav Malyshev
2461c9403b Fix private handling 2002-10-20 17:46:16 +00:00
Andi Gutmans
cf36abb2eb - Change opcode dispatch mechanism to use a function per opcode and use
- a lookup table using the opcode # to call the correct function.
- Still have lots of tuning to do.
2002-10-18 21:19:27 +00:00
Stanislav Malyshev
c42ec35331 Fix class static members: now the following code works:
<?php

class Foo {
         static $c = "Parent";
}

class Child extends Foo {
}

Foo::$c = "Hello";

var_dump(Child::$c);
?>
and returns "Hello" (class statics are not copied anymore, but looked up in
runtime)
2002-10-16 18:29:41 +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
Ilia Alshanetsky
d3617c51b8 MFZE1 zend_str_tolower issue. 2002-10-09 14:21:40 +00:00
Andi Gutmans
7cba0254e7 - Allow access to private/protected variables of $clone inside the __clone()
- method
2002-10-07 21:20:23 +00:00
Ilia Alshanetsky
ee7b8f906d MFZE1 2002-09-26 18:56:11 +00:00
Andi Gutmans
974b502199 - Fix leak 2002-09-24 19:32:01 +00:00