Skip to content

Commit 573b460

Browse files
author
Andi Gutmans
committed
Zend Library
1 parent f70a4db commit 573b460

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+16187
-0
lines changed

Zend/LICENSE

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Zend Temporary License
2+
======================
3+
4+
This is a temporary license, that is in effect until the final Zend license
5+
is available.
6+
7+
* The final license will include the ability to distribute Zend freely,
8+
as a part of PHP (in both compiled and source code formats). It may
9+
(and probably will) allow to redistribute Zend under other circumstances
10+
as well, but at the very least, it'll be freely distributed as a part
11+
of PHP.
12+
13+
* The source code in the Zend engine is the property of Andi Gutmans and
14+
Zeev Suraski. Parts of this code are based on source code taken from
15+
PHP 3.0, which may include several patches and enhancements that weren't
16+
made by us (Andi&Zeev). If you're the author of such a patch and you're
17+
not willing to give up ownership over your patch to us, please contact
18+
us as soon as possible, so we can remove it. We're doing this so that
19+
we'd be eligible to sell the Zend engine for uses other than PHP, most
20+
notably - as an embedded part of possible commercial products that we'd
21+
have.
22+
23+
* Patches submitted to the Zend CVS automatically fall under this license,
24+
and by submitting them you're implicitly giving up your ownership over
25+
this patch to us.
26+
27+
* Until further notice, Zend is in a status of a closed beta test. That means
28+
that only people that were explicitly given the right to access the Zend
29+
CVS repository are allowed to use it. If you're reading this file and you
30+
weren't explicitly given the right to access the Zend CVS repository from
31+
either Andi Gutmans or Zeev Suraski - you're not supposed to have it - please
32+
erase the Zend files from your system. When the closed beta period finishes,
33+
the Zend CVS tree will be open for the public (in read-only mode, of course).
34+
35+
36+
Any questions regarding Zend or this license should be addressed via Email to
37+
zend@zend.com.

Zend/Makefile.in

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
CC = @CC@
2+
AR = ar rc
3+
LIBNAME = libzend.a
4+
PROF_CFLAGS =
5+
CFLAGS_SHLIB = @CFLAGS_SHLIB@
6+
LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
7+
LDFLAGS_SHLIB_EXPORT = @LDFLAGS_SHLIB_EXPORT@
8+
CPPFLAGS = @CPPFLAGS@
9+
CFLAGS = @CFLAGS@ $(CFLAGS_SHLIB) $(CPPFLAGS) $(INCLUDE) @DEBUG_CFLAGS@ $(PROF_CFLAGS)
10+
LDFLAGS = @LDFLAGS@ $(LDFLAGS_SHLIB) $(LDFLAGS_SHLIB_EXPORT)
11+
RANLIB = @RANLIB@
12+
YACC = @YACC@
13+
14+
SOURCE = zend_alloc.c zend_compile.c zend_constants.c zend_execute.c zend_execute_API.c \
15+
zend_highlight.c zend_llist.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
16+
zend_stack.c zend_variables.c zend-parser.c zend-scanner.c zend.c zend_API.c zend_extensions.c \
17+
zend_hash.c zend_list.c zend_indent.c
18+
19+
OBJS = zend_alloc.o zend_compile.o zend_constants.o zend_execute.o zend_execute_API.o \
20+
zend_highlight.o zend_llist.o zend_opcode.o zend_operators.o zend_ptr_stack.o \
21+
zend_stack.o zend_variables.o zend-parser.o zend-scanner.o zend.o zend_API.o zend_extensions.o \
22+
zend_hash.o zend_list.o zend_indent.o
23+
24+
LIBS = @LIBS@
25+
26+
all: $(LIBNAME)
27+
28+
libzend.a: $(OBJS)
29+
-rm -f libzend.a
30+
$(AR) libzend.a $(OBJS)
31+
$(RANLIB) libzend.a
32+
33+
zend-parser.h zend-parser.c: zend-parser.y
34+
bison -p zend -v -d zend-parser.y -o zend-parser.c
35+
36+
zend-scanner.o:
37+
$(CC) $(CFLAGS) -w -c zend-scanner.c
38+
39+
zend-scanner.c: zend-scanner.l
40+
flex -Pzend -ozend-scanner.c -i zend-scanner.l
41+
42+
clean:
43+
-rm -f libzend.a *.o
44+
45+
distclean: clean
46+
-rm -f *-scanner.c *-parser.[ch] *.output
47+
-rm -f config.status config.cache config.log
48+
-rm -f Makefile Makefile.depend config.h
49+
50+
.c.o:
51+
@rm -f $@
52+
$(CC) $(CFLAGS) -c $< -o $@
53+
@bn=`echo $@ | sed -e 's#functions/##'`; test -f $@ || \
54+
(test "$@" != "$$bn" && test -f "$$bn" && mv $$bn $@)
55+
56+
parser-scanner: zend-parser.c zend-parser.h zend-scanner.c
57+
58+
depend: parser-scanner
59+
$(CC) $(CFLAGS) -MM $(SOURCE) | perl -pe 's|regex/regex.h||;' > Makefile.depend
60+
61+
62+
zend_alloc.o: zend_alloc.c zend.h config.h config.unix.h zend_errors.h \
63+
zend_alloc.h zend_hash.h zend_llist.h zend_globals.h zend_stack.h \
64+
zend_ptr_stack.h zend_compile.h zend-parser.h zend_execute.h
65+
zend_compile.o: zend_compile.c zend.h config.h config.unix.h \
66+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
67+
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
68+
zend_execute.h zend_API.h modules.h zend_list.h zend_variables.h \
69+
zend_operators.h
70+
zend_constants.o: zend_constants.c zend.h config.h config.unix.h \
71+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_constants.h \
72+
zend_variables.h zend_operators.h zend_globals.h zend_stack.h \
73+
zend_ptr_stack.h zend_compile.h zend-parser.h zend_execute.h
74+
zend_execute.o: zend_execute.c zend.h config.h config.unix.h \
75+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
76+
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
77+
zend_execute.h zend_API.h modules.h zend_list.h zend_variables.h \
78+
zend_operators.h zend_constants.h zend_extensions.h
79+
zend_execute_API.o: zend_execute_API.c zend.h config.h config.unix.h \
80+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
81+
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
82+
zend_execute.h zend_API.h modules.h zend_list.h zend_variables.h \
83+
zend_operators.h zend_constants.h zend_extensions.h
84+
zend_highlight.o: zend_highlight.c zend.h config.h config.unix.h \
85+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
86+
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
87+
zend_execute.h zend_highlight.h
88+
zend_llist.o: zend_llist.c zend.h config.h config.unix.h zend_errors.h \
89+
zend_alloc.h zend_hash.h zend_llist.h
90+
zend_opcode.o: zend_opcode.c zend.h config.h config.unix.h \
91+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
92+
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
93+
zend_execute.h zend_variables.h zend_operators.h zend_extensions.h \
94+
zend_API.h modules.h zend_list.h
95+
zend_operators.o: zend_operators.c zend.h config.h config.unix.h \
96+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_operators.h \
97+
zend_variables.h zend_globals.h zend_stack.h zend_ptr_stack.h \
98+
zend_compile.h zend-parser.h zend_execute.h
99+
zend_ptr_stack.o: zend_ptr_stack.c zend.h config.h config.unix.h \
100+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_ptr_stack.h
101+
zend_stack.o: zend_stack.c zend.h config.h config.unix.h zend_errors.h \
102+
zend_alloc.h zend_hash.h zend_llist.h zend_stack.h
103+
zend_variables.o: zend_variables.c zend.h config.h config.unix.h \
104+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_API.h \
105+
modules.h zend_list.h zend_globals.h zend_stack.h zend_ptr_stack.h \
106+
zend_compile.h zend-parser.h zend_execute.h zend_constants.h \
107+
zend_variables.h
108+
zend-parser.o: zend-parser.c zend_compile.h zend.h config.h \
109+
config.unix.h zend_errors.h zend_alloc.h zend_hash.h zend_llist.h \
110+
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
111+
zend_execute.h zend_list.h zend_API.h modules.h zend_variables.h \
112+
zend_operators.h
113+
zend-scanner.o: zend-scanner.c zend.h config.h config.unix.h \
114+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
115+
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
116+
zend_execute.h zend-scanner.h zend_highlight.h zend_constants.h \
117+
zend_variables.h zend_operators.h
118+
zend.o: zend.c zend.h config.h config.unix.h zend_errors.h \
119+
zend_alloc.h zend_hash.h zend_llist.h zend_operators.h \
120+
zend_variables.h zend_extensions.h zend_compile.h zend-parser.h \
121+
zend_globals.h zend_stack.h zend_ptr_stack.h zend_execute.h modules.h \
122+
zend_constants.h zend_list.h
123+
zend_API.o: zend_API.c zend.h config.h config.unix.h zend_errors.h \
124+
zend_alloc.h zend_hash.h zend_llist.h zend_variables.h zend_execute.h \
125+
zend_compile.h zend-parser.h zend_globals.h zend_stack.h \
126+
zend_ptr_stack.h zend_API.h modules.h zend_list.h zend_constants.h \
127+
zend_operators.h
128+
zend_extensions.o: zend_extensions.c zend_extensions.h zend_compile.h \
129+
zend.h config.h config.unix.h zend_errors.h zend_alloc.h zend_hash.h \
130+
zend_llist.h zend-parser.h zend_globals.h zend_stack.h \
131+
zend_ptr_stack.h zend_execute.h
132+
zend_hash.o: zend_hash.c zend.h config.h config.unix.h zend_errors.h \
133+
zend_alloc.h zend_hash.h zend_llist.h
134+
zend_list.o: zend_list.c zend.h config.h config.unix.h zend_errors.h \
135+
zend_alloc.h zend_hash.h zend_llist.h zend_list.h zend_API.h \
136+
modules.h zend_globals.h zend_stack.h zend_ptr_stack.h zend_compile.h \
137+
zend-parser.h zend_execute.h
138+
zend_indent.o: zend_indent.c zend.h config.h config.unix.h \
139+
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
140+
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
141+
zend_execute.h zend_indent.h
142+
143+
# Local Variables:
144+
# tab-width: 4
145+
# End:

Zend/ZEND_CHANGES

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
Improvements
2+
------------
3+
4+
Zend was designed from the ground up for increased speed,
5+
reduced memory consumption and more reliable execution. We dare
6+
say it meets all of these goals and does so pretty well. Beyond
7+
that, there are several improvements in the language engine
8+
features:
9+
10+
* References support. $foo = &$a; would make $foo and $a be two
11+
names to the same variable. This works with arrays as well,
12+
on either side; e.g., $foo = &$a[7]; would make $foo and $a[7]
13+
be two names to the same variable. Changing one would change
14+
the other and vice versa.
15+
* Object overloading support. This feature allows various OO
16+
libraries to use the OO notation of PHP to access their
17+
functionality. Right now, no use is made of that feature,
18+
but we'd have a COM module ready by the time PHP 4.0 is released.
19+
A CORBA module would probably follow.
20+
* include() and eval() are now functions, and not statements.
21+
That means they return a value. The default return value from
22+
include() and eval() is 1, so that you can do if (include())
23+
without further coding. The return value may be changed by
24+
returning a value from the global scope of the included file
25+
or the evaluated string. For example, if 'return 7;' is executed
26+
in the global scope of foo.inc, include("foo.inc") would evaluate
27+
to 7.
28+
* Automatic resource deallocation. Several people have been bitten
29+
by the fact that PHP 3.0 had no concept of reference counting.
30+
Zend adds full reference counting for every value in the system,
31+
including resources. As soon as a resource is no longer referenced
32+
from any variable, it is automatically destroyed to save memory
33+
and resources. The most obvious example for the advantage in this
34+
is a loop that has an SQL query inside it, something like
35+
'$result = sql_query(...);'. In PHP 3.0, every iteration resulted
36+
in another SQL result-set allocated in the memory, and all of the
37+
result sets weren't destroyed until the end of the script's execution.
38+
In Zend, as soon as we overwrite an old result set with a new one,
39+
the old result set which is no longer referenced, is destroyed.
40+
* Full support for nesting arrays and objects within each other, in
41+
as many levels as you want.
42+
* Boolean type. true and false are now constants of type boolean.
43+
Comparing any other value to them would convert that value to a
44+
boolean first, and conduct the comparison later. That means, for
45+
example, that 5==true would evaluate to true (in PHP 3.0, true
46+
was nothing but a constant for the integer value of 1, so 5==true
47+
was identical to 5==1, which was false).
48+
* Runtime binding of function names. This complex name has a simple
49+
explanation - you can now call functions before they're declared!
50+
* Added here-docs support.
51+
* Added foreach. Two syntaxes supported:
52+
foreach($val in array_expr) statement
53+
foreach($key, $val in array_expr) statement
54+
* A true unset() implementation. A variable or element that is unset(), is now
55+
sent to oblivion in its entirely, no trace remains from it.
56+
* Output buffering support! Use ob_start() to begin output buffering, ob_end_flush()
57+
to end buffering and send out the buffered contents, ob_end_clean() to end buffering
58+
without sending the buffered contents, and ob_get_contents() to retreive the current
59+
contents of the output buffer.
60+
Header information (header(), content type, cookies) are not buffered. By turning
61+
on output buffering, you can effectively send header information all throughout your
62+
file, regardless of whether you've emitted body output or not.
63+
* Full variable reference within quoted strings:
64+
${expr} - full indirect reference support for scalar variables
65+
{variable} - full variable support
66+
For example:
67+
$foo[5]["bar"] = "foobar";
68+
print "{$foo[5]["bar"]}"; // would print "foobar"
69+
* Ability to call member functions of other classes from within member functions or from
70+
the global scope. You can now, for example, override a parent function with a child function,
71+
and call the parent function from it.
72+
* Runtime information for classes (class name, parent, available functions, etc.).
73+
* Much more efficient syntax highlighter - runs much quicker, performs more reliably, and
74+
generates much tighter HTML.
75+
* A full-featured debugger has been integrated with the language (supports breakpoints,
76+
expression evaluation, step-in/over, function call backtrace, and more).
77+
78+
79+
Incompatabilities
80+
-----------------
81+
82+
Zend claims 100% compatability with the engine of PHP 3.0, and is
83+
shamelessly lying about it. Here's why:
84+
85+
* static variable initializers only accept scalar values
86+
(in PHP 3.0 they accepted any valid expression). The impact
87+
should be somewhere in between void and non existant, since
88+
initializing a static variable with anything but a simple
89+
static value makes no sense at all.
90+
91+
* The scope of break and continue is local to that of an
92+
include()'d file or an eval()'d string. The impact should
93+
be somewhat smaller of the one above.
94+
95+
* return statement from a require()'d file no longer works. It
96+
hardly worked in PHP 3.0, so the impact should be fairly small.
97+
If you want this functionality - use include() instead.
98+
99+
* unset() is no longer a function, but a statement. It was never
100+
documented as a function so the impact should be no bigger than
101+
nada.
102+
103+
* The following letter combination is not supported within encapsulated
104+
strings: "{$". If you have a string that includes this letter
105+
combination, for example, print "{$somevar"; (which printed the
106+
letter { and the contents of the variable $somevar in PHP 3.0),
107+
it will result in a parse error under Zend. In this case, you
108+
would have to change the code to print "\{$somevar";
109+
This incompatability is due to the full variable reference
110+
within quoted strings feature added in Zend.
111+

0 commit comments

Comments
 (0)