mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-26 10:25:41 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54715b2765 |
No files matched your search
@@ -273,18 +273,6 @@ document printzops
|
||||
dump operands of the current opline
|
||||
end
|
||||
|
||||
define zbacktrace
|
||||
____executor_globals
|
||||
dump_bt $eg.current_execute_data
|
||||
end
|
||||
|
||||
document zbacktrace
|
||||
prints backtrace.
|
||||
This command is almost a short cut for
|
||||
> (gdb) ____executor_globals
|
||||
> (gdb) dump_bt $eg.current_execute_data
|
||||
end
|
||||
|
||||
define zmemcheck
|
||||
set $p = alloc_globals.head
|
||||
set $stat = "?"
|
||||
@@ -357,3 +345,4 @@ document zmemcheck
|
||||
usage: zmemcheck [ptr].
|
||||
if ptr is 0, all blocks will be listed.
|
||||
end
|
||||
|
||||
+1
-5
@@ -183,7 +183,7 @@ Syntax and indentation
|
||||
indentation and comment styles and up to function declaration
|
||||
syntax.
|
||||
|
||||
(see also http://www.catb.org/~esr/jargon/html/I/indent-style.html)
|
||||
(see also http://www.tuxedo.org/~esr/jargon/html/entry/indent-style.html)
|
||||
|
||||
[3] Be generous with whitespace and braces. Always prefer:
|
||||
|
||||
@@ -204,10 +204,6 @@ Syntax and indentation
|
||||
four spaces. It is important to maintain consistency in indenture so
|
||||
that definitions, comments, and control structures line up correctly.
|
||||
|
||||
[5] Preprocessor statements (#if and such) MUST start at column one. To
|
||||
indent preprocessor directives you should put the # at the beginning
|
||||
of a line, followed by any number of whitespace.
|
||||
|
||||
Documentation and Folding Hooks
|
||||
-------------------------------
|
||||
|
||||
|
||||
Binary file not shown.
+141
-105
@@ -26,11 +26,6 @@ Status legend
|
||||
|
||||
== Server APIs ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: activescript
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aolserver
|
||||
MAINTENANCE: Unknown
|
||||
@@ -41,46 +36,27 @@ PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache2handler / apache2filter
|
||||
EXTENSION: apache2
|
||||
PRIMARY MAINTAINER: Aaron Bannert <aaron@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: apache_hooks
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: caudium
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cgi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cli
|
||||
MAINTENANCE: Marcus Boerger <helly@php.net>, Edin Kadribasic <edink@php.net>
|
||||
STATUS: Working
|
||||
SINCE: 4.3.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: embed
|
||||
PRIMARY MAINTAINER: Edin Kadribasic <edink@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
EXTENSION: fhttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: isapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: milter
|
||||
EXTENSION: nsapi
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: nsapi
|
||||
PRIMARY MAINTAINER: Uwe Schindler <thetaphi@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: phttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
@@ -93,12 +69,12 @@ EXTENSION: roxen
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: thttpd
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Odd fixes
|
||||
EXTENSION: servlet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: tux
|
||||
EXTENSION: thttpd
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -116,10 +92,10 @@ EXTENSION: dba
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: DBM abstraction for db2, db3, db4, dbm, ndbm, gdbm, ini
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dbase
|
||||
MAINTENANCE: Orphaned
|
||||
PRIMARY MAINTAINER: Jim Winstead <jimw@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dbx
|
||||
@@ -133,10 +109,10 @@ EXTENSION: filepro
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: hwapi
|
||||
EXTENSION: hyperwave
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: informix
|
||||
PRIMARY MAINTAINER: Danny Heijl <Danny.Heijl@cevi.be>
|
||||
@@ -150,14 +126,20 @@ STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: interbase
|
||||
PRIMARY MAINTAINER: Ard Biesheuvel <ard@ard.nu>, Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Maintained
|
||||
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msql
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msession
|
||||
PRIMARY MAINTAINER Mark L. Woodward mlwmohawk@mohawksoft.com
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working/Experimental
|
||||
COMMENT: Tested on Linux, should work on other UNIX platforms. Backend server code can compile under Windows.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mssql
|
||||
PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -169,25 +151,12 @@ PRIMARY MAINTAINER: Zak Greant <zak@mysql.com>, Georg Richter <georg@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysqli
|
||||
PRIMARY MAINTAINER: Georg Richter <georg@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pgsql
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Yasuo Ohgaki <yohgaki@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sqlite
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Wez Furlong <wez@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0 (Since 4.3.2 in PECL)
|
||||
COMMENT: Integrates SQLite embeddable SQL database engine.
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sybase
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Not Working
|
||||
@@ -197,7 +166,7 @@ MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oci8
|
||||
PRIMARY MAINTAINER: Antony Dovgal <tony2001@php.net>
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -208,52 +177,20 @@ STATUS: Working
|
||||
COMMENT: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: oracle
|
||||
MAINTENANCE: Orphaned
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Using the new OCI8 driver is encouraged where possible.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== XML extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dom
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Boerger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: simplexml
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: wddx
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xml
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xmlrpc
|
||||
PRIMARY MAINTAINER: Dan Libby
|
||||
MAINTENANCE: UNKNOWN
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xsl
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
== Other extensions ==
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: aspell
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
COMMENT: For aspell .27 and greater, check out the pspell extension
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: bcmath
|
||||
MAINTENANCE: Unknown
|
||||
@@ -266,6 +203,13 @@ STATUS: Working
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dio
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Orphaned
|
||||
STATUS: Working
|
||||
SINCE: 4.0.6
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cyrus
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Orphaned
|
||||
STATUS: Working
|
||||
SINCE: 4.0.6
|
||||
@@ -275,17 +219,21 @@ PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: com_dotnet
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
|
||||
EXTENSION: com
|
||||
PRIMARY MAINTAINER: Harald Radi <h.radi@nme.at>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Windows
|
||||
SINCE: 5.0
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cpdf
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: crack
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ctype
|
||||
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -297,6 +245,21 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cybercash
|
||||
PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Unknown
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: domxml
|
||||
PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dotnet
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: exif
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -327,6 +290,10 @@ MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: icap
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Obsolete
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: iconv
|
||||
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -337,6 +304,11 @@ PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: java
|
||||
PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ldap
|
||||
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -347,8 +319,13 @@ PRIMARY MAINTAINER: Rui Hirokawa <hirokawa@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcal
|
||||
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcrypt
|
||||
PRIMARY MAINTAINER: Derick Rethans <derick@derickrethans.nl>
|
||||
PRIMARY MAINTAINER: Derick Rethans <d.rethans@jdimedia.nl>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -357,11 +334,12 @@ PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: msession
|
||||
PRIMARY MAINTAINER Mark L. Woodward mlwmohawk@mohawksoft.com
|
||||
EXTENSION: muscat
|
||||
PRIMARY MAINTAINER: Sam Liddicott <sam@ananova.com>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working/Experimental
|
||||
COMMENT: Tested on Linux, should work on other UNIX platforms. Backend server code can compile under Windows.
|
||||
STATUS: Working
|
||||
SINCE: 4.0.5
|
||||
COMMENT: Not tested against windows, only core API completed, rest under development
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: openssl
|
||||
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
|
||||
@@ -369,6 +347,11 @@ MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: overload
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pcre
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -390,12 +373,24 @@ PRIMARY MAINTAINER: Kristian K
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: printer
|
||||
PRIMARY MAINTAINER: Daniel Beulshausen <daniel@php4win.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.4
|
||||
COMMENT: Only for Win32
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pspell
|
||||
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: qtdom
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: readline
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
@@ -405,6 +400,18 @@ PRIMARY MAINTAINER: Kristian K
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sablot
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Obsolete
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: satellite
|
||||
PRIMARY MAINTAINER: David Eriksson <eriksson@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: session
|
||||
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -427,9 +434,11 @@ MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvmsg
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Unknown
|
||||
EXTENSION: swf
|
||||
PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
|
||||
MAINTENANCE: Orphaned
|
||||
STATUS: Deprecated (Use the ming swf extension instead)
|
||||
COMMENT: Only for Unix (won't change)
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: sysvsem
|
||||
MAINTENANCE: Unknown
|
||||
@@ -439,6 +448,26 @@ EXTENSION: sysvshm
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: vpopmail
|
||||
MAINTENANCE: Unknown
|
||||
STATUS: Experimental
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: wddx
|
||||
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xml
|
||||
PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xslt
|
||||
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working (mostly)
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: yaz
|
||||
PRIMARY MAINTAINER: Adam Dickmeiss <adam@indexdata.dk>
|
||||
MAINTENANCE: Maintained
|
||||
@@ -454,3 +483,10 @@ PRIMARY MAINTAINER: Stefan Roehrich <sr@linux.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: zziplib
|
||||
PRIMARY MAINTAINER: Hartmut Holzgraefe <hholzgra@php.net>
|
||||
MAINTENANCE: Odd Fixes
|
||||
STATUS: Working
|
||||
SINCE: 4.0.5
|
||||
-------------------------------------------------------------------------------
|
||||
# iptc?
|
||||
+13
-17
@@ -16,15 +16,15 @@ build-modules: $(PHP_MODULES)
|
||||
|
||||
libphp5.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
|
||||
-@$(LIBTOOL) --silent --mode=install cp libphp5.la $(phptempdir)/libphp5.la >/dev/null 2>&1
|
||||
|
||||
libs/libphp5.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
||||
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp5.so
|
||||
|
||||
install: $(all_targets) $(install_targets)
|
||||
install: $(install_targets)
|
||||
|
||||
install-sapi: $(OVERALL_TARGET)
|
||||
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
|
||||
install-sapi: libphp5.la
|
||||
@echo "Installing PHP SAPI module"
|
||||
-@$(LIBTOOL) --silent --mode=install cp libphp5.la $(phptempdir)/libphp5.la >/dev/null 2>&1
|
||||
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
|
||||
-@if test ! -r $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME); then \
|
||||
for i in 0.0.0 0.0 0; do \
|
||||
@@ -38,10 +38,10 @@ install-sapi: $(OVERALL_TARGET)
|
||||
|
||||
install-modules: build-modules
|
||||
@test -d modules && \
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
|
||||
@echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/"
|
||||
@rm -f modules/*.la >/dev/null 2>&1
|
||||
@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
|
||||
echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/" && \
|
||||
rm -f modules/*.la && \
|
||||
$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
|
||||
|
||||
install-tester:
|
||||
@echo "Installing regression tester: $(INSTALL_ROOT)$(PEAR_INSTALLDIR)/"
|
||||
@@ -50,15 +50,11 @@ install-tester:
|
||||
|
||||
install-su: install-pear install-tester
|
||||
|
||||
test:
|
||||
-@if test -x $(SAPI_CLI_PATH) && test ! -z $(SAPI_CLI_PATH); then \
|
||||
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' $(top_srcdir)/run-tests.php $(TESTS); \
|
||||
else \
|
||||
echo "ERROR: Cannot run tests without CLI sapi."; \
|
||||
fi
|
||||
test: $(SAPI_CLI_PATH)
|
||||
@TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' $(top_srcdir)/run-tests.php $(TESTS)
|
||||
|
||||
clean:
|
||||
find . -name \*.lo -o -name \*.o | xargs rm -f
|
||||
|
||||
@@ -1,519 +1,42 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
12 Aug 2004, PHP 5.0.1
|
||||
- Changed destructor mechanism so that destructors are called prior to request
|
||||
shutdown. (Marcus)
|
||||
- Rewritten UNIX and Windows install help files. (Documentation Team)
|
||||
- Updated several libraries bundled with the windows release which now
|
||||
includes libxml2-2.6.11, libxslt-1.1.7 and iconv-1.9.1. (Rob, Edin)
|
||||
- Improved and moved ActiveScript SAPI to PECL. (Wez)
|
||||
- Fixed bug #29606 (php_strip_whitespace() prints to stdout rather then
|
||||
returning the value). (Ilia)
|
||||
- Fixed bug #29577 (MYSQLI_CLIENT_FOUND_ROWS undefined) (Georg)
|
||||
- Fixed bug #29573 (Segmentation fault, when exception thrown within
|
||||
PHP function called from XSLT). (Christian)
|
||||
- Fixed bug #29522 (accessing properties without connection) (Georg)
|
||||
- Fixed bug #29505 (get_class_vars() severely broken when used with arrays).
|
||||
(Marcus)
|
||||
- Fixed bug #29490 (.Net object instantiation failed). (Michael Sisolak).
|
||||
- Fixed bug #29474 (win32: usleep() doesn't work). (Wez)
|
||||
- Fixed bug #29449 (win32: feof() hangs on empty tcp stream). (Wez)
|
||||
- Fixed bug #29437 (Possible crash inside array_walk_recursive()). (Ilia)
|
||||
- Fixed bug #29431 (crash when parsing invalid address; invalid address
|
||||
returned by stream_socket_recvfrom(), stream_socket_getname()). (Wez)
|
||||
- Fixed bug #29409 (Segfault in PHP functions called from XSLT). (Rob)
|
||||
- Fixed unloading of dynamically loaded extensions.
|
||||
(Marcus, kameshj at fastmail dot fm)
|
||||
- Fixed bug #29395 (sqlite_escape_string() returns bogus data on empty
|
||||
strings). (Ilia, Tony)
|
||||
- Fixed bug #29392 (com_dotnet crashes when echo'ing an object). (Wez)
|
||||
- Fixed bug #29368 (The destructor is called when an exception is thrown from
|
||||
the constructor). (Marcus)
|
||||
- Fixed bug #29354 (Exception constructor marked as both public and protected).
|
||||
(Marcus)
|
||||
- Fixed bug #29342 (strtotime() does not handle empty date string properly).
|
||||
(Ilia)
|
||||
- Fixed bug #29340 (win32 build produces invalid php_ifx.dll). (Edin)
|
||||
- Fixed bug #29335 (fetch functions now use MYSQLI_BOTH as default) (Georg)
|
||||
- Fixed bug #29291 (get_class_vars() return names with NULLs). (Marcus)
|
||||
- Fixed bug #29264 (gettext extension not working). (Edin)
|
||||
- Fixed bug #29258 (variant_date_from_timestamp() does not honour
|
||||
timezone). (Wez)
|
||||
- Fixed bug #29256 (error when sending large packets on a socket). (Dmitry)
|
||||
- Fixed bug #29236 (memory error when wsdl-cache is enabled). (Dmitry)
|
||||
- Fixed bug #29147 (Compile Error in mnoGoSearch functions). (Sergey, Antony)
|
||||
- Fixed bug #29132 ($_SERVER["PHP_AUTH_USER"] isn't defined). (Stefan)
|
||||
- Fixed bug #29119 (html_entity_decode() misbehaves with UTF-8). (Moriyoshi)
|
||||
- Fixed bug #29109 (SoapFault exception: [WSDL] Out of memory). (Dmitry)
|
||||
- Fixed bug #29061 (soap extension segfaults). (Dmitry)
|
||||
- Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). (Dmitry)
|
||||
- Fixed bug #28969 (Wrong data encoding of special characters). (Dmitry)
|
||||
- Fixed bug #28895 (ReflectionClass::isAbstract always returns false). (Marcus)
|
||||
- Fixed bug #28829 (Thread-unsafety in bcmath elementary values). (Sara)
|
||||
- Fixed bug #28464 (catch() does not catch exceptions by interfaces). (Marcus)
|
||||
- Fixed ReflectionClass::getMethod() and ReflectionClass::getProperty() to
|
||||
raise an ReflectionException instead of returning NULL on failure.
|
||||
(Sebastian)
|
||||
- Fixed convert.* filters to consume remaining buckets_in on flush. (Sara)
|
||||
- Fixed bug in mysqli->client_version. (Georg)
|
||||
? ? ??? 200?, Version 5.0.0
|
||||
|
||||
13 Jul 2004, PHP 5.0.0
|
||||
- Updated PCRE to provide better error handling in certain cases. (Andrei)
|
||||
- Changed doc comments to require a single white space after '/**'. (Marcus)
|
||||
- Fixed bug #29019 (Database not closing). (Marcus)
|
||||
- Fixed bug #29008 (array_combine() does not handle non-numeric/string keys).
|
||||
(Ilia)
|
||||
- Fixed bug #28999 (fixed behaviour of exec() to work as it did in 4.X). (Ilia)
|
||||
- Fixed bug #28868 (Internal filter registry not thread safe). (Sara)
|
||||
- Fixed bug #28851 (call_user_func_array has typo in error message). (Marcus)
|
||||
- Fixed bug #28831 (ArrayObject::offsetGet() does the work of offsetUnset()).
|
||||
(Marcus)
|
||||
- Fixed bug #28822 (ArrayObject::offsetExists() works inverted). (Marcus)
|
||||
- Fixed bug #28789 (ReflectionProperty getValue() fails on public static
|
||||
members). (Marcus)
|
||||
- Fixed bug #28771 (Segfault when using xslt and clone). (Rob)
|
||||
- Fixed bug #28751 (SoapServer does not call _autoload()). (Dmitry)
|
||||
- Fixed bug #28739 (array_*diff() and array_*intersect() not clearing the fci
|
||||
cache before work). (Andrey)
|
||||
- Fixed bug #28721 (appendChild() and insertBefore() unset DOMText).(Rob)
|
||||
- Fixed bug #28702 (SOAP does not parse WSDL service address correctly). (Dmitry)
|
||||
- Fixed bug #28699 (Reflection api bugs). (Marcus)
|
||||
- Fixed bug #28694 (ReflectionExtension::getFunctions() crashes PHP). (Marcus)
|
||||
- Fixed bug #28512 (Allocate enough space to store MSSQL data). (Frank)
|
||||
- Fixed bug #28325 (Circular references not properly serialised). (Moriyoshi)
|
||||
- Fixed strip_tags() to correctly handle '\0' characters. (Stefan)
|
||||
? ? ??? 2003, PHP 5 Beta 1
|
||||
|
||||
7 Jun 2004, PHP 5 Release Candidate 3
|
||||
- Moved the PDFLib extension to PECL. (Wez)
|
||||
- Added MySQL 4.1.2-alpha and 4.1.3-beta support to MySQLI extension. (Georg)
|
||||
- Added support for dumping private/protected properties to var_dump().
|
||||
(Andrey)
|
||||
- Added count() support for COM arrays. (Wez)
|
||||
- Added Firebird/InterBase UDF source that allows PHP functions to be called
|
||||
from SQL (Ard)
|
||||
- Removed Firebird/Interbase function ibase_timefmt() (Ard)
|
||||
- Changed user error handler mechanism to relay to built-in error handler if it
|
||||
returns false. (Andrei)
|
||||
- Changed class type hints for function parameters to not allow the passing of
|
||||
NULL values. (Andi)
|
||||
- Changed tidy_node to tidyNode and removed tidy_exception. (John)
|
||||
- Fixed ip2long() to return FALSE if an IP address passed to this function
|
||||
is not valid. (Derick)
|
||||
- Fixed memory leak in memory manager. (Andi)
|
||||
- Fixed problem with exceptions returning from include(). (Dmitry)
|
||||
- Fixed bug #28641 (Instance of Interface). (Marcus)
|
||||
- Fixed bug #28430 (Extending mysqli class). (Georg)
|
||||
- Fixed bug #28311 (Transparency detection code is off by 1).
|
||||
(Ilia, pikeman at pikeman dot sytes dot net)
|
||||
- Fixed bug #28304 (Missing bounds check inside imagefilter()). (Ilia)
|
||||
- Fixed bug #28300 (Userspace stream/filter names forced to lowercase). (Sara)
|
||||
- Fixed bug #28287 (stream_*_register() not calling __autoload()). (Sara)
|
||||
- Fixed bug #28267 (php_image_filter_contrast calls gdImageBrightness). (Ilia)
|
||||
- Fixed bug #28239 (No results returned on SOAP call, no error given). (Dmitry)
|
||||
- Fixed bug #28205 (num_rows property for statement object). (Georg)
|
||||
- Fixed bug #28161 (COM: Array style properties could not be accessed). (Wez)
|
||||
- Fixed bug #28125 (ArrayObject leaks when accessing elements). (Marcus)
|
||||
- Fixed bug #28100 (NULL parameter support for mysqli_ssl_set). (Georg)
|
||||
- Fixed bug #28099 (ArrayObject doesn't implement ArrayAccess). (Marcus)
|
||||
- Fixed bug #27929 (SPL: change visibility of ArrayIterator::__construct).
|
||||
(Marcus)
|
||||
- Fixed bug #27640 (memory leak of registered_zend_ini_directives). (Dmitry)
|
||||
- Fixed bug #27063 (SPL: ArrayObject does not handle PPP correctly). (Marcus)
|
||||
- Switch to using Zend Engine 2, which includes numerous engine level
|
||||
improvements. A full list is available at
|
||||
http://www.php.net/zend-engine-2.php.
|
||||
|
||||
25 Apr 2004, PHP 5 Release Candidate 2
|
||||
- Implementing an interface/abstract method with the wrong prototype is now
|
||||
a fatal error. (Zeev)
|
||||
- Reimplemented zend.ze1_compatibility_mode to have better PHP 4 compliance.
|
||||
(Dmitry, Andi)
|
||||
- Under CLI, fclose() on php://stdin, php://stdout and php://stderr will now
|
||||
close the real stream. Please update your CLI scripts to use STDIN, STDOUT
|
||||
and STDERR constants instead of fopen()/fclose(). (Wez)
|
||||
- Moved yaz extension to PECL. (Wez)
|
||||
- Added pty support to proc_open(). (Wez)
|
||||
- Added possibility to check in which extension an internal class was defined
|
||||
in using reflection API. (Marcus)
|
||||
- Changed tidy error handling to no longer use exceptions and
|
||||
renamed the "error_buf" property to errorBuffer. (John)
|
||||
- Changed class and method names to use studlyCaps convention. (Marcus)
|
||||
- Changed language parser to throw errors when a non-empty signature is used in
|
||||
a destructor definition. (Marcus)
|
||||
- Changed HTTP file uploads not to throw E_WARNINGs and E_NOTICEs. The error
|
||||
value in the $_FILES global should be used for error handling. (Derick)
|
||||
- Changed __construct() to always take precedence over old style constructor.
|
||||
(Dmitry)
|
||||
- Fixed handling of return values from storred procedures in mssql_execute()
|
||||
with multiple result sets returned. (Frank)
|
||||
- Fixed bug #28096 (stream_socket_accept() doesn't work with ssl). (Wez)
|
||||
- Fixed bug #28007 (compile mssql extension with old versions of FreeTDS
|
||||
fails). (Frank)
|
||||
- Fixed bug #27997 (SPL: Crash with getInnerIterator()). (Marcus)
|
||||
- Fixed bug #27974 (COM doesn't pass array parameters). (Wez)
|
||||
- Fixed bug #27928 (sqlite incorrectly handles invalid filenames). (Ilia)
|
||||
- Fixed bug $27923 (in some cases using foreach() to iterate over values
|
||||
led to a false error message about the key being a reference). (Adam)
|
||||
- Fixed bug #27865 (STDIN, STDOUT, STDERR are dup()d under CLI). (Wez)
|
||||
- Fixed bug #27821 (xml_parse() segfaults when xml_set_object() is called from
|
||||
class method). (Andi, Rob)
|
||||
- Fixed bug #27742 (WDSL SOAP Parsing Schema bug). (Dmitry)
|
||||
- Fixed bug #27722 (Segfault on schema without targetNamespace). (Dmitry)
|
||||
- Fixed bug #27719 (mktime issues on and around DST changeover). (Rasmus)
|
||||
- Fixed bug #27681 (soap extension fails without HAVE_TM_GMTOFF). (Dmitry)
|
||||
- Fixed bug #27641 (Object cloning in ze1_compatibility_mode was reimplemented)
|
||||
(Dmitry, Andi)
|
||||
- Fixed bug #27628 (Simplify the process of making a POST request via stream
|
||||
context). (Ilia)
|
||||
- Fixed bug #27619 (filters not applied to pre-buffered stream data). (Sara)
|
||||
- Fixed bug #27519 (Reflection_Function constructor crashes with non-existant
|
||||
function's name). (Marcus)
|
||||
- Fixed bug #27469 (serialize() objects of incomplete class). (Dmitry)
|
||||
- Fixed bug #27457 (handling of numeric indexes in strtr()). (Dmitry)
|
||||
- Fixed bug #27397 (debug_backtrace() not showing function arguments). (Zeev)
|
||||
- Fixed bug #27283 (The last catch statement was sometimes skipped). (Andi)
|
||||
- Fixed bug #26441 (When __set() returned a value it corrupted it). (Andi)
|
||||
- Fixed bug #19749 (shouldn't mmap() files larger than memory_limit). (Wez)
|
||||
- The SQLite (http://www.hwaci.com/sw/sqlite/) extension is now bundled and
|
||||
enabled by default. (Wez, Marcus, Tal)
|
||||
|
||||
18 March 2004, PHP 5 Release Candidate 1
|
||||
- Fixed numerous bugs with the just-in-time auto-global initialization, that
|
||||
could cause $_SERVER, $argv/$argc and other variables not to work properly.
|
||||
(Zeev)
|
||||
- Fixed data corruption with constant assignments to object properties. (Zeev)
|
||||
- Changed __toString() to be called automatically only with print and echo
|
||||
statements. (Andi)
|
||||
- Replaced the exec_finished hook by the zend_post_deactive hook for
|
||||
extensions. The new hook will be run after the symbol table and destructors
|
||||
are run. (Derick)
|
||||
- Fixed possible crash when internal get_method() is not defined. (Andi)
|
||||
- Fixed calling methods using call_user_func() in conjunction with
|
||||
the array("Class","Method") syntax to use the scope of the PHP user function.
|
||||
(Dmitry)
|
||||
- Fixed php-cgi to not ignore command-line switches when run in a web context.
|
||||
This fixes our test cases allowing INI with GET sections to work. (Rasmus)
|
||||
- Fixed getopt() so it works without $_SERVER. (Rasmus, bfrance)
|
||||
- Added support for PHP 4 style object comparisons which is enabled in
|
||||
ze1_compatiblity_mode. (Andi)
|
||||
- Added support for PHP 4 style object conversion to long, double, and boolean
|
||||
values which is enabled in ze1_compatibility_mode. (Andi, Stas)
|
||||
- Allow object oriented extensions to overload comparison functions and other
|
||||
operations. Solves problems using SimpleXML values. (Andi, Zeev)
|
||||
- Fixed crash when accessing a class constant with a value which in turn is
|
||||
also a constant. (Dmitry)
|
||||
- Fixed object's truth value conversion. It is always true unless
|
||||
ze1_compatibility_mode is on in which it behaves like in PHP 4. (Stas)
|
||||
- Improved out of memory handling in new memory manager. (Stas)
|
||||
- Fixed crash when an object references itself during destructor call. (Andi)
|
||||
- Fixed crash in foreach() when iterating over object properties or a method's
|
||||
return values. (Andi)
|
||||
- Fixed crash when an exception is thrown in a destructor. Such exceptions are
|
||||
now ignored as destruction happens out of context at no definite time. (Andi)
|
||||
- Fixed crashes in exception handling. (Dmitry, Andi)
|
||||
- Changed prototype checks so that they aren't done on constructors. (Andi)
|
||||
- Changed prototype checks to output an E_STRICT message instead of
|
||||
an E_COMPILE_ERROR. (Andi)
|
||||
- Changed Iterator::has_more() to Iterator::valid(). (Marcus)
|
||||
- Upgraded bundled oniguruma library to version 2.2.2. (Rui, Moriyoshi)
|
||||
- Added mb_list_encoding() to return an array with all mbstring supported
|
||||
encodings. (Derick)
|
||||
- Added support for more ISO8601 datetime formats in strtotime(). (Moriyoshi)
|
||||
. Timezone specifier (ex. "20040301T02:00:00+19:00")
|
||||
. Week specifier (ex. "1997W021")
|
||||
- Renamed php.ini option "zend2.implicit_clone" to
|
||||
"zend.ze1_compatibility_mode" as it doesn't only affect implicit cloning.
|
||||
(Andi, Zeev)
|
||||
- Methods that override parent methods are now subject to prototype checking,
|
||||
and have to be compatible with the method they're overriding - this check is
|
||||
disabled in compatibility mode. (Andi, Zeev)
|
||||
- Fixed crash in php_ini_scanned_files() when no additional INI files were
|
||||
actually parsed. (Jon)
|
||||
- Fixed bug in gdImageFilledRectangle in the bundled GD library, that required
|
||||
x1 < x2 and y1 < y2 for coordinates. (Derick)
|
||||
- Fixed crash with foreach() and temporary objects($obj->method()->a ...) where
|
||||
method returns a non-referenced object. (Andi, Zeev)
|
||||
- Fixed problem preventing startup errors from being displayed. (Marcus)
|
||||
- Fixed start-up problem if both SPL and SimpleXML were enabled. The double
|
||||
initialization of apache 1.3 was causing problems here. (Marcus, Derick)
|
||||
- Fixed bug #27606 (Expression must be a modifiable lvalue compiler error).
|
||||
(Derick)
|
||||
- Fixed bug #27597 (pg_fetch_array not returning false). (Marcus)
|
||||
- Fixed bug #27586 (ArrayObject::getIterator crashes with [] assignment).
|
||||
(Marcus)
|
||||
- Fixed bug #27537 (Objects pointing to each other segfaults). (Dmitry)
|
||||
- Fixed bug #27535 (Problem with object freeing mechanism). (Dmitry)
|
||||
- Fixed bug #27504 (Visibility bugs in call_user_function()). (Dmitry)
|
||||
- Fixed bug #27338 (memory leak inside tsrm_virtual_cwd.c on win32). (Ilia)
|
||||
- Fixed bug #27291 (get_browser matches browscap.ini patterns incorrectly).
|
||||
(Jay)
|
||||
- Fixed bug #27287 (wddx segfaults during deserialization). (Moriyoshi)
|
||||
- Fixed bug #27263 (session extension crashes when unserializing referenced
|
||||
values / objects). (Moriyoshi)
|
||||
- Fixed bug #27237 (Working with simplexml crashes apache2). (Rob)
|
||||
- Fixed bug #27227 (Mixed case class names causes Fatal Error in Constructor
|
||||
call). (Marcus)
|
||||
- Fixed bug #27125 (strval() doesn't work for objects with __toString()).
|
||||
(Marcus)
|
||||
- Fixed bug #27123 (Fix crash caused by bug in get_object_vars()). (Andi)
|
||||
- Fixed bug #26677 (mbstring compile errors with IRIX compiler).
|
||||
(K.Kosako <kosako at sofnec dot co dot jp>, Rui, Moriyoshi)
|
||||
- Fixed bug #26206 (register_long_arrays breaks superglobals). (Zeev)
|
||||
- Fixed bug #25724 (argv and argc not defined). (Zeev)
|
||||
- Improved the speed of internal functions that use callbacks by 40% due to a
|
||||
new internal fast_call_user_function() function. (Sterling)
|
||||
|
||||
12 Feb 2004, PHP 5 Beta 4
|
||||
- Changed exceptions so that they must now inherit from the built-in Exception
|
||||
class. This allows for a general catch(Exception $e) statement to catch all
|
||||
exceptions. (Andi, Zeev)
|
||||
- Added SPL extension. (Marcus, Derick)
|
||||
- Added checks for invalid characters in a cookie name and cookie data
|
||||
into set[raw]cookie(). (Brian)
|
||||
- Added support for ++ and += (and similar) to SimpleXML. (Andi, Zeev)
|
||||
- Added infrastructure for ++ and += (and similar) to object overloading
|
||||
modules. (Andi, Zeev)
|
||||
- Added error message when trying to re-assign to $this variable. (Zeev, Andi)
|
||||
- Added support for an interface to extend another interface. (Zeev)
|
||||
- Added new pspell functions: (Brian)
|
||||
. pspell_config_dict_dir()
|
||||
. pspell_config_data_dir()
|
||||
- Added new Interbase functions: (Ard)
|
||||
. ibase_service_attach() and ibase_service_detach().
|
||||
. ibase_backup() and ibase_restore().
|
||||
. ibase_maintain_db(), ibase_db_info() and ibase_server_info().
|
||||
- Added context option "http"/"request_fulluri" to send entire URI in request
|
||||
which is required format for some proxies. (Sara)
|
||||
- Added optional third parameter 'strict' to array_keys(). (Andrey)
|
||||
- Added stream_lock() method to userspace streams interface. (Hartmut, Wez)
|
||||
- Added xsltprocessor->registerPHPFunctions(). (Christian)
|
||||
- Readded support for using classes before they are declared according to
|
||||
the behavior in PHP 4. This won't work with classes who are using PHP 5
|
||||
features such as interfaces. (Zeev, Andi)
|
||||
- Completely overhauled SimpleXML extension. (Marcus, Rob, Sterling)
|
||||
- Upgraded bundled SQLite library to version 2.8.11. (Ilia, Wez)
|
||||
- Improved destructor implementation to always call destructors on clean
|
||||
shutdown. An order of destruction is not guaranteed. (Zeev, Andi)
|
||||
- Redesigned exception support. This fixes many bugs in the previous design
|
||||
such as nested try's and problems with overloaded extensions. (Zeev, Andi)
|
||||
- Redesigned clone by adding a clone keyword (clone $obj) and copying all
|
||||
properties before __clone() is called. Also allows calling parent __clone
|
||||
function by using parent::__clone(). (Zeev, Andi)
|
||||
- Fixed interfaces to check for function return-by-reference equality when
|
||||
inheriting and implementing interfaces. (Andi, Zeev)
|
||||
- Fixed foreach() to respect property visibility. (Marcus)
|
||||
- Fixed problem with parse error in include() file not stopping PHP's
|
||||
execution. (Ilia)
|
||||
- Fixed var_export() to show public, protected and private modifiers properly.
|
||||
(Derick)
|
||||
- Fixed problems with longlong values in mysqli. (Georg)
|
||||
- Fixed class name case preserving of user defined classes. (Marcus)
|
||||
- Fixed bug #27145 (Unmangle private/protected property names before printing
|
||||
them inside error messages). (Ilia)
|
||||
- Fixed bug #27103 (preg_split('//u') incorrectly splits UTF-8 strings into
|
||||
octets). (Moriyoshi)
|
||||
- Fixed bug #27042 (SPL: SeekableIterator seek() broken). (Marcus)
|
||||
- Fixed bug #27008 (Every class method can be called as static). (Marcus)
|
||||
- Fixed bug #26938 (exec() has problems reading long lines).
|
||||
(Ilia, runekl[at]opoint[dot]com
|
||||
- Fixed bug #26947 (ext/dom: Crash when using DomDocument::getElementById()).
|
||||
(Christian)
|
||||
- Fixed bug #26911 (crash in sqlite extension when fetching data from empty
|
||||
queries). (Ilia)
|
||||
- Fixed bug #26844 (ext/mime_magic: magic file validation broken). (Jani)
|
||||
- Fixed bug #26819 (http_build_query() crashes on NULL output). (Ilia)
|
||||
- Fixed bug #26817 (http_build_query() does not handle private & protected
|
||||
object properties correctly). (Ilia)
|
||||
- Fixed bug #26815 (foreach of (DOM) childnodes crashes when Xinclude is used).
|
||||
(Rob)
|
||||
- Fixed bug #26796 (SQLite causes crashes with other extensions *connect()
|
||||
calls). (Marcus)
|
||||
- Fixed bug #26762 (unserialize() produces lowercase classnames). (Marcus)
|
||||
- Fixed bug #26743 (getElementsByTagName doesn't work properly). (Rob)
|
||||
- Fixed bug #26736 (__autoload not invoked for parent classes). (Marcus)
|
||||
- Fixed bug #26723 (domNode::appendChild() changes child node namespace). (Rob)
|
||||
- Fixed bug #26697 (calling class_exists() on a nonexistent class in __autoload
|
||||
results in segfault). (Marcus)
|
||||
- Fixed bug #26696 (string index in a switch() crashes with multiple matches).
|
||||
(Andi)
|
||||
- Fixed bug #26695 (Reflection API does not recognize mixed-case class hints).
|
||||
(Marcus)
|
||||
- Fixed bug #26690 (make xsltProcessor->transformToUri use streams wrappers).
|
||||
(Ilia)
|
||||
- Fixed bug #26680 (Added version check in mysqli_report_index). (Georg)
|
||||
- Fixed bug #26675 (Segfault on ArrayAccess use). (Marcus)
|
||||
- Fixed bug #26640 (__autoload() not invoked by Reflection classes). (Jani)
|
||||
- Fixed bug #26543 (call_user_func() broken for self, parent). (Stanislav)
|
||||
- Fixed bug #26077 (memory leak when new() result is not assigned and no
|
||||
constructor is defined). (Stanislav)
|
||||
- Fixed bug #26065 (Crash when nesting classes). (Marcus)
|
||||
- Fixed bug #25816 (disallow arrays in class constants). (Stanislav)
|
||||
- Fixed bug #25329 (sqlite_create_function with method and reference to $this).
|
||||
(Marcus)
|
||||
- Fixed bug #25038 (call_user_func() issues a warning if function throws an
|
||||
exception). (Marcus)
|
||||
- Fixed bug #24608 (__set not triggered when overloading with array).
|
||||
(Stanislav)
|
||||
- Fixed bug #24243 (enabling browscap causes segfault). (Wez)
|
||||
- Completely Overhauled XML support
|
||||
. Brand new simplexml extension (Sterling)
|
||||
. New DOM extension (Rob, Chregu, Marcus)
|
||||
. New XSL extension (Chregu, Rob)
|
||||
. Moved the old DOM-XML and XSLT extensions to PECL (James, Sterling)
|
||||
. ext/xml can now use both libxml2 and expat to parse XML (Sterling)
|
||||
. Removed bundled expat (Jani)
|
||||
|
||||
21 Dec 2003, PHP 5 Beta 3
|
||||
- Bundled new tidy extension (John, Wez)
|
||||
- Upgraded PCRE library to version 4.5. (Andrei)
|
||||
- Dropped Windows 95 support. (Andi)
|
||||
- Moved extensions to PECL:
|
||||
. ext/crack (Jani, Derick)
|
||||
. ext/db (Jani, Derick)
|
||||
. ext/mcal (Jani, Derick)
|
||||
. ext/qtdom (Jani, Derick)
|
||||
. ext/notes (Wez)
|
||||
- Added 'c' modifier to date() which returns the date in the ISO 8601 format.
|
||||
(Derick, Manuzhai)
|
||||
- Added an optional parameter to microtime() to get the time as float. (Andrey)
|
||||
- Added MacRoman encoding support to htmlentities(). (Derick, Marcus Bointon)
|
||||
- Added possibility to call PHP functions as XSLT-functions. (Christian)
|
||||
- Added possibility to prevent PHP from registering variables when input filter
|
||||
support is used. (Derick)
|
||||
- Added iconv stream filter (convert.iconv.*). (Moriyoshi)
|
||||
- Added EXSLT support in ext/xsl. (Christian)
|
||||
- Added qdbm handler for dba extension. (mg at iceni dot pl, Marcus)
|
||||
- Added new functions:
|
||||
. dba_key_split() to split inifile keys in an array. (Marcus)
|
||||
. time_nanosleep() signal safe sleep (Magnus, Ilia)
|
||||
. headers_list(). (Sara)
|
||||
. php_strip_whitespace(). strip whitespace & comments from a script. (Ilia)
|
||||
. php_check_syntax(). check php script for parse errors. (Ilia)
|
||||
. image_type_to_extension(). return extension based on image type. (Ilia)
|
||||
. stream_socket_sendto() and stream_socket_recvfrom(). (Wez)
|
||||
. iconv_mime_decode_headers(). (Moriyoshi)
|
||||
. get_declared_interfaces(). (Andrey, Marcus)
|
||||
. sqlite_fetch_column_types(). (Ilia)
|
||||
- Added proxy support to http:// wrapper. (Sara)
|
||||
- Added rename(), rmdir() and mkdir() support to userstreams. (Sara)
|
||||
- Added rename(), rmdir() and mkdir() support to ftp:// wrapper. (Sara)
|
||||
- Changed rename(), rmdir() and mkdir() to be routed via streams API. (Sara)
|
||||
- Changed stat() and family to be routed via streams API. (Sara)
|
||||
- Fixed include_once() / require_once() on Windows to honor case-insensitivity
|
||||
of files. (Andi)
|
||||
- Fixed get_declared_classes() to return only classes. (Andrey, Marcus)
|
||||
- Fixed __autoload() to preserve case of the passed class name. (Andi)
|
||||
- Fixed bug #26615 () (runekl at opoint dot com, Derick)
|
||||
- Fixed bug #26591 ("__autoload threw an exception" during an uncaught).
|
||||
(Marcus)
|
||||
- Fixed bug #26534 (stream_get_meta_data() -> Access Violation). (Wez)
|
||||
- Fixed bug #26528 (HTML entities are not being decoded by
|
||||
xml_parse()/xml_parse_into_struct()). (Ilia)
|
||||
- Fixed bug #26182 (Object properties created redundantly). (Andi)
|
||||
- Fixed bug #26156 (REPLACE_ZVAL_VALUE works on uninit stack-based zvals).
|
||||
(Moriyoshi)
|
||||
- Fixed bug #26083 (Non-working write support in ext/dom). (Ilia)
|
||||
- Fixed bug #26072 (--disable-libxml does not work). (Jani)
|
||||
- Fixed bug #26001 (serialize crashes when accessing an overloaded object that
|
||||
has no properties (NULL hashtable)). (Wez)
|
||||
- Fixed bug #25664 (COM crashes when calling a Delphi implementations of
|
||||
ITypeInfo). (Wez)
|
||||
- Fixed bug #24837 (Incorrect behaviour of PPP using foreach). (Marcus)
|
||||
- Fixed bug #24693 (Allow session.use_trans_sid to be enabled/disabled from
|
||||
inside the script). (Ilia)
|
||||
- Fixed bug #24394 (Serializing cross-referenced objects causes segfault).
|
||||
(Moriyoshi)
|
||||
|
||||
30 Oct 2003, PHP 5 Beta 2
|
||||
- Lots and lots of changes in the Zend Engine 2 since beta 1:
|
||||
. Added Iterators
|
||||
. Improved memory manager
|
||||
. Added Reflection API
|
||||
. Removed the not so working namespaces support
|
||||
. Removed support for expressions within constant declarations.
|
||||
. You can read about most changes in ZEND_CHANGES under the Zend directory.
|
||||
- Improved the DBX extension: (Marc)
|
||||
. Added DBX_RESULT_UNBUFFERED flag for dbx_query().
|
||||
. Added dbx_fetch_row()
|
||||
. Added SQLite support.
|
||||
- Improved the Interbase extension: (Ard Biesheuvel)
|
||||
. Added support for multiple databases into ibase_trans()
|
||||
. Added support for CREATE DATABASE, SET TRANSACTION and EXECUTE PROCEDURE
|
||||
statements into ibase_query()
|
||||
. Added ability to bind PHP arrays to native Interbase arrays
|
||||
. Added ibase_commit_ret() and ibase_rollback_ret()
|
||||
. Added ibase_drop_db()
|
||||
. Added ibase_gen_id()
|
||||
. Added ibase_name_result()
|
||||
. Added ibase_errcode()
|
||||
. Added ibase_affected_rows() and ibase_num_params()
|
||||
. Added ibase_param_info()
|
||||
. Added ibase_wait_event()
|
||||
. Added ibase_set_event_handler() and ibase_free_event_handler()
|
||||
- Added new COM extension with integrated .Net support. (Wez)
|
||||
- Added new functions:
|
||||
. setrawcookie(). (Brian)
|
||||
. pg_version(). (Marcus)
|
||||
. dbase_get_header_info(). (Zak)
|
||||
. snmp_read_mib(). (Jani)
|
||||
. http_build_query(). (Sara)
|
||||
. ftp_alloc(). (Sara)
|
||||
. array_udiff(). (Andrey)
|
||||
. array_udiff_assoc(). (Andrey)
|
||||
. array_udiff_uassoc(). (Andrey)
|
||||
. array_diff_uassoc(). (Andrey)
|
||||
. convert_uuencode(). (Ilia)
|
||||
. convert_uudecode(). (Ilia)
|
||||
. substr_compare(). (Ilia)
|
||||
. pcntl_wait(). (GeorgeS)
|
||||
- Added "resume_pos" context option to "ftp://" wrapper. (Sara)
|
||||
- Added optional parameter to OCIWriteTemporaryLob() to specify the type of LOB
|
||||
(Patch by Novicky Marek <novicky@aarongroup.cz>). (Thies)
|
||||
- Added reflection API. (Andrei, George, Timm)
|
||||
- Changed length parameter in fgetcsv() to be optional. (Moriyoshi)
|
||||
- Fixed IPv6 support in MacOSX Panther. (Dan, Marko)
|
||||
- Fixed fgetcsv() to correctly handle international (non-ascii) characters.
|
||||
(Moriyoshi)
|
||||
- Fixed support for <![CDATA[]]> fields within XML documents in ext/xml.
|
||||
(Sterling)
|
||||
- Fixed visibility of __construct and __clone. (Marcus)
|
||||
- Fixed bug #25756 (SimpleXML's validate_schema_file() broken). (Moriyoshi)
|
||||
- Fixed bug #25581 (getimagesize() returns incorrect values on bitmap (os2)
|
||||
files). (Marcus)
|
||||
- Fixed bug #25494 (array_merge*() allows non-arrays as argument). (Jay)
|
||||
- Fixed bug #24766 (strange result array from unpack()). (Moriyoshi)
|
||||
- Fixed bug #24729 ($obj = new $className; causes crash when $className is not
|
||||
set). (Marcus)
|
||||
- Fixed bug #24565 (cannot read array elements received via $_REQUEST). (Zeev)
|
||||
- Fixed bug #24445 (get_parent_class() returns different values).
|
||||
(Sterling, Stanislav)
|
||||
- Fixed bug #24403 (preg_replace() problem: Using $this when not in object
|
||||
context). (Zeev)
|
||||
- Fixed bug #24399 (PEAR DB isError crash [instanceof_function fault?]).
|
||||
(Sterling, Marcus)
|
||||
- Fixed bug #24396 (foreach ($k=>$v), the key $k is missing). (Zeev)
|
||||
- Fixed bug #24279 (__get() crash when no value is returned). (Ilia)
|
||||
- Fixed bug #22367 (undefined variable has a value). (Zeev)
|
||||
- Fixed bug #19859 (allow fast_call_user_function to support __call).
|
||||
(Stanislav)
|
||||
- Fixed bug #17997 (Warning when switch() and reference are combined). (Zeev)
|
||||
- Fixed bug #17988 (strtotime failed to parse postgresql timestamp). (Derick)
|
||||
|
||||
29 Jun 2003, PHP 5 Beta 1
|
||||
- Removed the bundled MySQL client library. (Sterling)
|
||||
- Switched to Zend Engine 2, which includes numerous engine level improvements.
|
||||
A full list is available at http://www.php.net/zend-engine-2.php.
|
||||
- Added SQLite (http://www.hwaci.com/sw/sqlite/) extension: (Wez, Marcus, Tal)
|
||||
. Includes bundled SQLite library
|
||||
. Enabled by default
|
||||
- Completely Overhauled XML support:
|
||||
. New simplexml extension. (Sterling)
|
||||
. New DOM extension. (Rob, Chregu, Marcus)
|
||||
. New XSL extension. (Chregu, Rob)
|
||||
. Moved the old DOM-XML and XSLT extensions to PECL. (James, Sterling)
|
||||
. ext/xml can now use either libxml2 or expat to parse XML. (Sterling)
|
||||
. Removed bundled expat library. (Jani)
|
||||
|
||||
- New php.ini options:
|
||||
. "session.hash_function" and "session.hash_bits_per_character". (Sascha)
|
||||
. "mail.force_extra_paramaters". (Derick)
|
||||
. "register_long_arrays". (Zeev)
|
||||
- Improved the speed of internal functions that use callbacks by 40% due to a
|
||||
new internal fast_call_user_function() function. (Sterling)
|
||||
|
||||
- Improved the streams support: (Wez)
|
||||
. Improved performance of readfile(), fpassthru() and some internal streams
|
||||
operations under Win32.
|
||||
. stream_socket_client() - similar to fsockopen(), but more powerful.
|
||||
. stream_socket_server() - Creates a server socket.
|
||||
. stream_socket_client() - similar to fsockopen(), but more powerful.
|
||||
. stream_socket_server() - Creates a server socket.
|
||||
. stream_socket_accept() - Accept a client connection.
|
||||
. stream_socket_get_name() - Get local or remote name of socket.
|
||||
. stream_copy_to_stream()
|
||||
. stream_get_line() - Reads either the specified number of bytes or until
|
||||
. stream_get_line() - Reads either the specified number of bytes or until
|
||||
the ending string is found. (Ilia)
|
||||
. Added context property to userspace streams object. (Sara)
|
||||
. Added generic crypto interface for streams.
|
||||
@@ -523,20 +46,23 @@ PHP NEWS
|
||||
all platforms.
|
||||
. Added 'string.base64' stream filter. (Moriyoshi)
|
||||
. Renamed stream_register_wrapper() to stream_wrapper_register(). (Derick)
|
||||
|
||||
- Improved the GD extension: (Pierre-Alain Joye, Ilia)
|
||||
. imagefilter() - Apply different filters to image.
|
||||
(Only available with bundled GD library)
|
||||
. Antialiased drawing support:
|
||||
o imageantialias() - (de)active antialias
|
||||
o imageline() and imagepolygon() antialias support
|
||||
|
||||
- Changed the length parameter in fgetss() to be optional. (Moriyoshi)
|
||||
- Changed ini parser to allow for handling of quoted multi-line values. (Ilia)
|
||||
- Changed get_extension_funcs() to return list of the built-in Zend Engine
|
||||
- Changed get_extension_funcs() to return list of the built-in Zend Engine
|
||||
functions if "zend" is specified as the module name. (Ilia)
|
||||
- Changed array_search() to accept also objects as a needle. (Moriyoshi)
|
||||
- Changed ext/mcrypt to require libmcrypt version 2.5.6 or greater. (Derick)
|
||||
- Changed uniqid() parameters to be optional and allow any prefix length.
|
||||
(Marcus)
|
||||
|
||||
- Added new iconv functions. (Moriyoshi)
|
||||
. iconv_strlen()
|
||||
. iconv_substr()
|
||||
@@ -544,6 +70,7 @@ PHP NEWS
|
||||
. iconv_strrpos()
|
||||
. iconv_mime_decode()
|
||||
. iconv_mime_encode()
|
||||
|
||||
- Added misc. new functions:
|
||||
. ldap_sasl_bind(). (peter_c60@hotmail.com, Jani)
|
||||
. imap_getacl(). (Dan, Holger Burbach)
|
||||
@@ -554,10 +81,11 @@ PHP NEWS
|
||||
. strpbrk() - Searches a string for a list of characters. (Ilia)
|
||||
. get_headers() - Returns headers sent by the server of the specified URL.
|
||||
(Ilia)
|
||||
. str_split() - Breaks down a string into an array of elements based on
|
||||
. str_split() - Breaks down a string into an array of elements based on
|
||||
length. (Ilia)
|
||||
. array_walk_recursive(). (Ilia)
|
||||
. array_combine(). (Andrey)
|
||||
|
||||
- Added optional parameter to get_browser() to make it return an array. (Jay)
|
||||
- Added optional parameter to openssl_sign() to specify the hashing algorithm.
|
||||
(scott@planetscott.ca, Derick)
|
||||
@@ -567,24 +95,27 @@ PHP NEWS
|
||||
(Ilia)
|
||||
- Added optional parameter to file() which makes the result array not contain
|
||||
the line endings and to skip empty lines. (Ilia)
|
||||
- Added new range() functionality:
|
||||
. Support for float modifier. (Ilia)
|
||||
. Detection of numeric values inside strings passed as high & low. (Ilia)
|
||||
. Proper handle the situations where high == low. (Ilia)
|
||||
. Added an optional step parameter. (Jon)
|
||||
- Added new range() functionality: (Ilia)
|
||||
. Support for float modifier.
|
||||
. Detection of numeric values inside strings passed as high & low.
|
||||
. Proper handle the situations where high == low.
|
||||
- Added encoding detection feature for expat XML parser.
|
||||
(Adam Dickmeiss, Moriyoshi)
|
||||
- Added missing multibyte (unicode) support and numeric entity support to
|
||||
html_entity_decode(). (Moriyoshi)
|
||||
- Added IPv6 support to ext/sockets. (Sara)
|
||||
- Added "ftp://" wrapper support to opendir(), stat() and unlink(). (Sara)
|
||||
- Added context options 'method', 'header' and 'content' for "http://" fopen
|
||||
- Added context options 'method', 'header' and 'content' for "http://" fopen
|
||||
wrapper. (Sara)
|
||||
- Added input filter support. See README.input_filter for more info. (Rasmus)
|
||||
- Added a replace count for str_[i]replace(), see bug #8218. (Sara)
|
||||
- Fixed is_executable() to be available also on Windows. (Shane)
|
||||
- Fixed dirname() and strip_tags() to be binary-safe. (Moriyoshi)
|
||||
- Fixed bug #24098 (crash in pathinfo()). (Ilia)
|
||||
- Fixed bug #21985 and #22064 (various mb_send_mail() issues). (Moriyoshi)
|
||||
- Fixed bug #21600 (Assign by reference function call changes variable
|
||||
- Fixed bug #21600 (Assign by reference function call changes variable
|
||||
contents). (Zeev)
|
||||
|
||||
|
||||
### Add everything that MIGHT get merged to some PHP 4 branch
|
||||
### (before PHP 5.0.0 is released), below.
|
||||
|
||||
+18
-10
@@ -37,11 +37,8 @@ The next few rules are more of a technical nature.
|
||||
messages every day. Woe be to those who attempt to mess with it.
|
||||
|
||||
2. All news updates intended for public viewing, such as new features,
|
||||
bug fixes, improvements, etc., should go into the NEWS file.
|
||||
|
||||
NB! Lines, starting with @ will go automagically into NEWS file, but
|
||||
this is NOT recommended, though. Please, add news entries directly to
|
||||
NEWS file and don't forget to keep them adjusted and sorted.
|
||||
bug fixes, improvements, etc., should go into the NEWS file. Also see
|
||||
the note below about automatically updating NEWS in your commit message.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
@@ -62,10 +59,14 @@ The next few rules are more of a technical nature.
|
||||
The format of the commit messages is pretty simple.
|
||||
|
||||
If a line begins with #, it is taken to be a comment and will not appear
|
||||
in the ChangeLog. Everything else goes into the ChangeLog.
|
||||
in the ChangeLog. If the line begins with @, it will be redirected to the
|
||||
NEWS file. Everything else goes into the ChangeLog.
|
||||
|
||||
It is important to note that if your comment or news logline spans multiple
|
||||
lines, you have to put # at the beginning of _every_ such line.
|
||||
lines, you have to put # or @ at the beginning of _every_ such line. Every
|
||||
entry in NEWS has to have a name after it, so if you did it with someone's
|
||||
help, put both your names there. Your name WILL NOT be automatically put
|
||||
at the end of the NEWS entry - so, please provide it yourself.
|
||||
|
||||
Example. Say you modified two files, datetime.c and string.c. In datetime.c
|
||||
you added a new format option for date() function, and in string.c you fixed
|
||||
@@ -77,12 +78,17 @@ For datetime.c:
|
||||
|
||||
(PHP date) Added new 'K' format modifier for printing out number of
|
||||
days until New Year's Eve.
|
||||
@- Added new 'K' format modifier that will output the number of days
|
||||
@ until New Year's Eve. (Bob)
|
||||
|
||||
For string.c:
|
||||
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
|
||||
# Man, that thing was leaking all over the place!
|
||||
@- Fixed memory leak in trim(). (Bob)
|
||||
|
||||
The # lines will be omitted from the ChangeLog automagically.
|
||||
The lines above marked with @ will go into NEWS file automagically, and the
|
||||
# lines will be omitted from the ChangeLog. Alternatively, you might want
|
||||
to modify NEWS file directly and not use the @ lines.
|
||||
|
||||
If you fix some bugs, you should note the bug ID numbers in your
|
||||
commit message. Bug ID should be prefixed by "#" for easier access to
|
||||
@@ -91,10 +97,12 @@ bug report when developers are browsing CVS via. LXR or Bonsai.
|
||||
Example:
|
||||
|
||||
Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
@ Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
|
||||
If you don't see your messages in ChangeLog right away, don't worry!
|
||||
If you don't see your messages in ChangeLog and NEWS right away, don't worry!
|
||||
These files are updated once a day, so your stuff will not show up until
|
||||
somewhat later.
|
||||
somewhat later. Don't go adding stuff to NEWS by hand if you already put @
|
||||
lines in the commit message.
|
||||
|
||||
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
|
||||
to look at PHP CVS repository in various ways.
|
||||
|
||||
+3
-4
@@ -1,7 +1,6 @@
|
||||
(NOTE: you may also want to take a look at the pear package
|
||||
PECL_Gen, a PHP-only alternative for this script that
|
||||
supports way more extension writing tasks and is
|
||||
supposed to replace ext_skel completely in the long run ...)
|
||||
(NOTE: you may also want to take a look at scripts/ext_skel_ng,
|
||||
a PHP-only alternative for this script thats supposed
|
||||
to replace it completely in the long run ...)
|
||||
|
||||
WHAT IT IS
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
1. strrpos() and strripos() now use the entire string as a needle. Be aware
|
||||
that the existing scripts may no longer work as you expect.
|
||||
|
||||
EX :
|
||||
<?php
|
||||
var_dump(strrpos("ABCDEF","DEF"));
|
||||
var_dump(strrpos("ABCDEF","DAF"));
|
||||
?>
|
||||
|
||||
Will give you different results. The former returns 3 while the latter
|
||||
returns false rather than the position of the last occurrence of 'D'.
|
||||
The same applies to strripos().
|
||||
|
||||
2. Illegal use of string offsets causes E_ERROR instead of E_WARNING.
|
||||
|
||||
EX :
|
||||
<?php
|
||||
$a = "foo";
|
||||
unset($a[0][1][2]);
|
||||
?>
|
||||
|
||||
Fatal error: Cannot use string offset as an array in ... on line 1
|
||||
|
||||
3. array_merge() was changed to accept only arrays. If a non-array variable is
|
||||
passed, a E_WARNING will be thrown for every such parameter. Be careful
|
||||
because your code may start emitting E_WARNING out of the blue.
|
||||
|
||||
4. Be careful when porting from ext/mysql to ext/mysqli. The following
|
||||
functions return NULL when no more data is available in the result set
|
||||
(ext/mysql's functions return FALSE).
|
||||
|
||||
- mysqli_fetch_row()
|
||||
- mysqli_fetch_array()
|
||||
- mysqli_fetch_assoc()
|
||||
|
||||
5. PATH_TRANSLATED server variable is no longer set implicitly under
|
||||
Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the
|
||||
same value as the SCRIPT_FILENAME server variable when it is not populated
|
||||
by Apache. This change was made to comply with the CGI specification.
|
||||
Please refer to bug #23610 for further information.
|
||||
|
||||
6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the
|
||||
ext/tokenizer extension. If error_reporting is set to E_ALL notices will
|
||||
be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant
|
||||
is used, thus both // and /* */ are resolved as the T_COMMENT constant.
|
||||
However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed
|
||||
by PHP, are recongnized as T_DOC_COMMENT.
|
||||
|
||||
7. $_SERVER should be populated with argc and argv if variables_order
|
||||
includes "S". If you have specifically configured your system to not
|
||||
create $_SERVER, then of course it shouldn't be there. The change was to
|
||||
always make argc and argv available in the CLI version regardless of the
|
||||
variables_order setting. As in, the CLI version will now always populate
|
||||
the global $argc and $argv variables.
|
||||
|
||||
8. In some cases classes must be declared before used. It only happens only
|
||||
if some of the new features of PHP 5 are used. Otherwise the behaviour is
|
||||
the old.
|
||||
Example 1 (works with no errors):
|
||||
<?php
|
||||
$a = new a();
|
||||
class a {
|
||||
}
|
||||
?>
|
||||
|
||||
Example 2 (throws an error):
|
||||
<?php
|
||||
$a = new a();
|
||||
interface b{
|
||||
}
|
||||
class a implements b {
|
||||
}
|
||||
?>
|
||||
|
||||
Output (example 2) :
|
||||
Fatal error: Class 'a' not found in /tmp/cl.php on line 2
|
||||
|
||||
9. get_class() starting PHP 5 returns the name of the class as it was
|
||||
declared which may lead to problems in older scripts that rely on
|
||||
the previous behaviour - the class name is lowercased.
|
||||
Example :
|
||||
<?php
|
||||
class FooBar {
|
||||
}
|
||||
$a = new FooBar();
|
||||
var_dump(get_class($a));
|
||||
?>
|
||||
|
||||
Output (PHP 4):
|
||||
string(6) "foobar"
|
||||
|
||||
Output (PHP 5):
|
||||
string(6) "FooBar"
|
||||
----------------------------------------------------------------------
|
||||
Example code that will break :
|
||||
//....
|
||||
function someMethod($p) {
|
||||
if (get_class($p) != 'helpingclass') {
|
||||
return FALSE;
|
||||
}
|
||||
//...
|
||||
}
|
||||
//...
|
||||
Possible solution is to search for get_class() in all your scripts and
|
||||
use strtolower().
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ Note though that you might get little response, if your patch is
|
||||
too hard to review.
|
||||
|
||||
If you would like change/add many lines, it is better to ask module
|
||||
maintainer and/or internals@lists.php.net, or pear-dev@lists.php.net if
|
||||
maintainer and/or php-dev@lists.php.net, or pear-dev@lists.php.net if
|
||||
you are patching PEAR. Official module maintainers can be found in
|
||||
EXTENSIONS file in PHP source.
|
||||
|
||||
@@ -79,7 +79,7 @@ Check list for submitting patch
|
||||
|
||||
Where to send your patch?
|
||||
-------------------------
|
||||
If you are patching C source, send the patch to internals@lists.php.net.
|
||||
If you are patching C source, send the patch to php-dev@lists.php.net.
|
||||
If you are patching a module, you should also send the patch to the
|
||||
maintainer. Official module maintainers are listed in EXTENSION file
|
||||
in source.
|
||||
@@ -90,7 +90,7 @@ Please add the prefix "[PATCH]" to your email subject and make sure
|
||||
to include the patch as a MIME attachment even if it is short.
|
||||
|
||||
NOTE: only MIME attachments of type 'text/*' are accepted. The
|
||||
easiest way to accomplish this, is to make the extension
|
||||
easiest way to acclomplish this, is to make the extension
|
||||
'.txt'.
|
||||
|
||||
Test scripts should be included in the same email.
|
||||
@@ -100,7 +100,7 @@ Finally, add the bug Id(s) which can be closed by your patch, if any.
|
||||
|
||||
|
||||
What happens after you submit your patch
|
||||
----------------------------------------
|
||||
--------------------------------------
|
||||
If your patch is easy to review and has obviously no side-effects,
|
||||
it might take up to a few hours until someone commits it.
|
||||
|
||||
|
||||
+3
-12
@@ -1,20 +1,11 @@
|
||||
[IMPORTANT NOTICE]
|
||||
------------------
|
||||
Failed tests usualy indicate a problem with your local system setup
|
||||
and not within PHP itself (at least for official PHP release versions).
|
||||
You may decide to automaticaly submit a test summary to our QA workflow
|
||||
at the end of a test run.
|
||||
Please do *not* submit a failed test as a bug or ask for help on why
|
||||
it failed on your system without providing substantial backup information
|
||||
on *why* the test failed on your special setup. Thank you :-)
|
||||
Please do not ask developers why some or all tests are failing in
|
||||
your environment! Let us know if you find why it fails. Thank you.
|
||||
|
||||
|
||||
[Testing Basics]
|
||||
----------------
|
||||
The easiest way to test your PHP build is to run "make test" from the
|
||||
command line after successfully compiling. This will run the complete
|
||||
tests for all enabled functionalities and extensions using the PHP
|
||||
CLI binary.
|
||||
To execute test scripts, you must build PHP with some SAPI, then you
|
||||
type "make test" to execute all or some test scripts saved under
|
||||
"tests" directory under source root directory.
|
||||
@@ -117,7 +108,7 @@ Example script to be run by cron(1):
|
||||
========== qa-test.sh =============
|
||||
#!/bin/sh
|
||||
|
||||
CO_DIR=$HOME/cvs/php5
|
||||
CO_DIR=$HOME/cvs/php4
|
||||
MYMAIL=qa-test@domain.com
|
||||
TMPDIR=/var/tmp
|
||||
TODAY=`date +"%Y%m%d"`
|
||||
|
||||
@@ -108,7 +108,7 @@ module, program, etc).
|
||||
|
||||
For example for APXS:
|
||||
|
||||
PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php5.c php_apache.c)
|
||||
PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php4.c php_apache.c)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
The Win32 Build System.
|
||||
$Id$
|
||||
Wez Furlong <wez@thebrainroom.com>
|
||||
|
||||
If you need help with the build system, send mail to
|
||||
internals@lists.php.net; please don't email me directly.
|
||||
|
||||
===========================================================
|
||||
Contents:
|
||||
1. How to build PHP under windows
|
||||
a. Requirements
|
||||
b. Opening a command prompt
|
||||
c. Generating configure.js
|
||||
d. Configuring
|
||||
e. Building
|
||||
f. Cleaning up
|
||||
g. Running the test suite
|
||||
h. snapshot building
|
||||
|
||||
2. How to write config.w32 files
|
||||
x. to be written.
|
||||
|
||||
===========================================================
|
||||
1. How to build PHP under windows
|
||||
a. Requirements
|
||||
|
||||
You need:
|
||||
- Windows Scripting Host (cscript.exe)
|
||||
- Microsoft Build Tools from:
|
||||
Microsoft Visual Studio (VC6) or later
|
||||
|
||||
You also need:
|
||||
- bindlib_w32 [http://www.php.net/extra/bindlib_w32.zip]
|
||||
- win32build [http://www.php.net/extra/win32build.zip]
|
||||
|
||||
b. Opening the Build Environment Command Prompt:
|
||||
- Using Visual Studio (VC6)
|
||||
1. Install it
|
||||
2. If you have a VC++ Command Prompt icon on your start menu,
|
||||
click on it to get a Command Prompt with the env vars
|
||||
set up correctly.
|
||||
|
||||
If not, create a new shortcut and set the Target to:
|
||||
|
||||
%comspec% /k "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat"
|
||||
|
||||
You might also want to set the prompt to start in
|
||||
a convenient location (such as the root of your
|
||||
PHP source checkout).
|
||||
|
||||
- Using Visual Studio .Net
|
||||
1. Install it.
|
||||
2. Under the Visual Studio .Net Tools sub menu of your start
|
||||
menu, you should have a Visual Studio .Net Command Prompt
|
||||
icon. If not, create a new shortcut and set the Target to:
|
||||
|
||||
%comspec% /k "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
|
||||
|
||||
You might also want to set the prompt to start in
|
||||
a convenient location (such as the root of your
|
||||
PHP source checkout).
|
||||
|
||||
- Using the Platform SDK tools
|
||||
1. Download the Platform SDK:
|
||||
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
|
||||
|
||||
- You need the Core SDK, which is approx 200MB to download
|
||||
and requires approx 500MB of disk space.
|
||||
- The other components of the SDK are not required by PHP
|
||||
- You might be able to reduce the download size by downloading
|
||||
the installer control component first and then selecting
|
||||
only the Build Environment (around 30MB), but I haven't
|
||||
tried this.
|
||||
|
||||
** Note: it seems that MS don't include the 32 bit
|
||||
build tools in the platform SDK any longer, so
|
||||
you will probably have very limited luck if you
|
||||
don't also have VC++ or VS.Net already installed.
|
||||
|
||||
2. Once installed, you will have an icon on your start menu
|
||||
that will launch the build environment; the latest SDK's
|
||||
install a number of different versions of this; you probably
|
||||
want to choose the Windows 2000 Retail build environment.
|
||||
Clicking on this will open a command prompt with its Path,
|
||||
Include and Lib env vars set to point to the build tools
|
||||
and win32 headers.
|
||||
|
||||
c. Generating configure
|
||||
|
||||
Change directory to where you have your PHP 5 sources.
|
||||
Run buildconf.bat.
|
||||
|
||||
d. Configuring
|
||||
|
||||
cscript /nologo configure.js --help
|
||||
|
||||
Will give you a list of configuration options; these will
|
||||
have the form:
|
||||
|
||||
--enable-foo or --disable-foo or --with-foo or --without-foo.
|
||||
|
||||
--enable-foo will turn something on, and is equivalent to
|
||||
specifying --enable-foo=yes
|
||||
|
||||
--disable-foo will turn something off, and is equivalent to
|
||||
specifying --enable-foo=no
|
||||
|
||||
--enable-foo=shared will attempt to build that feature as
|
||||
a shared, dynamically loadable module.
|
||||
|
||||
Sometimes a configure option needs additional information
|
||||
about where to find headers and libraries; quite often
|
||||
you can specify --enable-foo=option where option could be
|
||||
the path to where to find those files. If you want to
|
||||
specify a parameter and build it as shared, you can use
|
||||
this syntax instead: --enable-foo=shared,option
|
||||
|
||||
The same rules all apply to --with-foo and --without-foo;
|
||||
the only difference is the way the options are named;
|
||||
the convention is that --enable-foo means that you are
|
||||
switching on something that comes with PHP, whereas
|
||||
--with-foo means that you want to build in something
|
||||
external to PHP.
|
||||
|
||||
e. Building
|
||||
|
||||
Once you have successfully configured your build (make
|
||||
sure you read the output from the command to make sure
|
||||
it worked correctly), you can build the code; simply type
|
||||
|
||||
"nmake" at the command prompt, and it will build everthing
|
||||
you asked for.
|
||||
|
||||
Once the build has completed, you will find your binaries
|
||||
in the build dir determined by configure; this is typically
|
||||
Release_TS for release builds or Debug_TS for debug builds.
|
||||
If you build a non-thread-safe build, it will use Release
|
||||
or Debug to store the files. Also in this build dir you
|
||||
will find sub directories for each module that went into
|
||||
your PHP build. The files you'll want to keep are the
|
||||
.exe and .dll files directly in your build dir.
|
||||
|
||||
f. Cleaning Up
|
||||
|
||||
You can automatically delete everything that was built
|
||||
by running "nmake clean". This will delete everything
|
||||
that was put there when you ran nmake, including the
|
||||
.exe and .dll files.
|
||||
|
||||
g. Running the test suite
|
||||
|
||||
You can verify that your build is working well by running
|
||||
the regression test suite. You do this by typing
|
||||
"nmake test". You can specify the tests you want to run
|
||||
by defing the TESTS variable - if you wanted to run the
|
||||
sqlite test suite only, you would type
|
||||
"nmake /D TESTS=ext/sqlite/tests test"
|
||||
|
||||
h. Snapshot Building
|
||||
|
||||
If you want to set up an automated build that will tolerate
|
||||
breakages in some of the modules, you can use the
|
||||
--enable-snapshot-build configure option to generate a
|
||||
makefile optimized for that purpose. A snapshot build will
|
||||
switch the argument parser so that the default option for
|
||||
configure switches that your don't specify will be set
|
||||
to "shared". The effect of this is to turn on all options
|
||||
unless you explicitly disable them. When you have configured
|
||||
your snapshot build, you can use "nmake build-snap" to build
|
||||
everything, ignoring build errors in individual extensions
|
||||
or SAPI.
|
||||
|
||||
vim:tw=78:sw=1:ts=1:et
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Using PHP 5 with the Zeus Web Server
|
||||
Using PHP4 with the Zeus Web Server
|
||||
-----------------------------------
|
||||
|
||||
Zeus fully supports running PHP in combination with our
|
||||
|
||||
+6
-11
@@ -1,12 +1,12 @@
|
||||
Input Filter Support in PHP 5
|
||||
-----------------------------
|
||||
Input Filter Support in PHP5
|
||||
----------------------------
|
||||
|
||||
XSS (Cross Site Scripting) hacks are becoming more and more prevalent,
|
||||
and can be quite difficult to prevent. Whenever you accept user data
|
||||
and somehow display this data back to users, you are likely vulnerable
|
||||
to XSS hacks.
|
||||
|
||||
The Input Filter support in PHP 5 is aimed at providing the framework
|
||||
The Input Filter support in PHP5 is aimed at providing the framework
|
||||
through which a company-wide or site-wide security policy can be
|
||||
enforced. It is implemented as a SAPI hook and is called from the
|
||||
treat_data and post handler functions. To implement your own security
|
||||
@@ -89,11 +89,7 @@ PHP_MINFO_FUNCTION(my_input_filter)
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
/* The filter handler. If you return 1 from it, then PHP also registers the
|
||||
* (modified) variable. Returning 0 prevents PHP from registering the variable;
|
||||
* you can use this if your filter already registers the variable under a
|
||||
* different name, or if you just don't want the variable registered at all. */
|
||||
SAPI_INPUT_FILTER_FUNC(my_sapi_input_filter)
|
||||
unsigned int my_sapi_input_filter(int arg, char *var, char **val, unsigned int val_len)
|
||||
{
|
||||
zval new_var;
|
||||
zval *array_ptr = NULL;
|
||||
@@ -141,8 +137,7 @@ SAPI_INPUT_FILTER_FUNC(my_sapi_input_filter)
|
||||
|
||||
php_strip_tags(*val, val_len, NULL, NULL, 0);
|
||||
|
||||
*new_val_len = strlen(*val);
|
||||
return 1;
|
||||
return strlen(*val);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(my_get_raw)
|
||||
@@ -155,7 +150,7 @@ PHP_FUNCTION(my_get_raw)
|
||||
HashTable *hash_ptr;
|
||||
char *raw_var;
|
||||
|
||||
if(zend_parse_parameters(2 TSRMLS_CC, "ls", &arg, &var, &var_len) == FAILURE) {
|
||||
if(zend_parse_parameters(2 TSRMLS_CC, "ls|l", &arg, &var, &var_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,13 @@ Zend
|
||||
dimensional arrays.
|
||||
* Look at replacing c-lib call tolower().
|
||||
* Make hash API functions work with HASH_OF() to save time.
|
||||
* Allow to set a default value for call-by-reference-parameters.
|
||||
eg: function hello (&$pallo = NULL) {}
|
||||
* Add configure test to determine if dlsym() requires underscore and set
|
||||
DLSYM_NEEDS_UNDERSCORE accordingly. Perl and zsh have it in configure,
|
||||
for example. (DONE?)
|
||||
* Allow foreach ($array as $k => &$val) syntax. right now we cannot
|
||||
traverse an array without copying each element.
|
||||
* Native large number support (probably with GNU GMP)
|
||||
* Const'ify APIs. Right now, many functions leave parameters untouched,
|
||||
but don't declare those as const. This makes interaction with other
|
||||
@@ -129,6 +133,10 @@ ext/session
|
||||
* Provide a callback facility which is executed upon encountering
|
||||
an unknown class name during deserialization
|
||||
|
||||
ext/sockets
|
||||
-----------
|
||||
* Review/Fix vectors
|
||||
|
||||
ext/standard
|
||||
------------
|
||||
* Add a version number to data serialized via serialize().
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
Zend Engine
|
||||
-----------
|
||||
- Look at making zend_constant value member be a zval* instead of zval. (Andi)
|
||||
- Add the patch for referring to existing .ini vars in .ini files. (Andrei)
|
||||
- Implement inheritance rules for type hints. (Marcus)
|
||||
- Implement true/false/NULL as keywords (apply the patch). (Andi, Marcus)
|
||||
- Implement typehinting for arrays (apply the patch). (Andi, Marcus)
|
||||
- Find a keyword for the if-set-or operator (apply the patch). (Marcus, all)
|
||||
- Fix ZTS destruction (apply the patch). (Marcus)
|
||||
|
||||
Build System
|
||||
------------
|
||||
- Implement load order of built-in extensions (apply the patch). (Wez)
|
||||
|
||||
Standard Library
|
||||
----------------
|
||||
- Implement new time/date parsing and handling functions. (Derick)
|
||||
@@ -16,6 +16,83 @@ Responsibility: Andi, Stig?
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: Introspection
|
||||
|
||||
get_function_definition(<is_callable> [field]) =>
|
||||
array(
|
||||
file => filename
|
||||
line_start =>
|
||||
line_end =>
|
||||
parameters => array( name, byref, default )
|
||||
static_variables => array( name, value/default )
|
||||
scope => 'namespace' | 'class' | null
|
||||
namespace => classname | namespacename | 'main'
|
||||
protection => protection_flags
|
||||
phpdoc => pre-scanned-phpdoc-string
|
||||
type => 'internal' | 'user'
|
||||
)
|
||||
|
||||
get_class_definition(<class> [field]) =>
|
||||
array(
|
||||
type => 'internal' | 'user'
|
||||
file => filename
|
||||
line_start =>
|
||||
line_end =>
|
||||
name => pretty-name
|
||||
parent => classname | namespace | null
|
||||
flags => bitfield (ABSTRACT)
|
||||
methods => array( array( name, phpdoc ) )
|
||||
default_properties => array( array( name, value, phpdoc ) )
|
||||
private_properties => array( array( name, value, phpdoc ) )
|
||||
protected_properties => array( array( name, value, phpdoc ) )
|
||||
public_properties => array( array( name, value, phpdoc ) )
|
||||
static_members => array( array( name, value, phpdoc ) )
|
||||
constants => array( array( name, value, phpdoc ) )
|
||||
classes => array( array( name, phpdoc ) )
|
||||
phpdoc => pre-scanned-phpdoc-string
|
||||
)
|
||||
|
||||
get_constant_definition(<constant> [field]) =>
|
||||
array(
|
||||
file => filename
|
||||
line_start =>
|
||||
line_end =>
|
||||
name =>
|
||||
value =>
|
||||
phpdoc =>
|
||||
)
|
||||
|
||||
get_global_variable_defintion(<name> [field]) =>
|
||||
array(
|
||||
file =>
|
||||
line_start =>
|
||||
line_end =>
|
||||
name =>
|
||||
phpdoc =>
|
||||
)
|
||||
|
||||
We tried to take into account the implementation of each piece of
|
||||
information, and there are some that are problematic, especially those
|
||||
regarding constants and global variables (where do we store the extra
|
||||
information?)
|
||||
|
||||
With "pre-scanned-phpdoc-string" we mean converting:
|
||||
|
||||
/**
|
||||
* Blah blah blah
|
||||
* @param foo ...
|
||||
*/
|
||||
|
||||
to:
|
||||
|
||||
Blah blah blah
|
||||
@param foo
|
||||
|
||||
The rest of the phpdoc handling should be left to an extension.
|
||||
Responsibility: Stig, Andrei, Harald
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: Redesign of API Versioning
|
||||
Responsibility: ?
|
||||
Time frame: 1 month
|
||||
@@ -95,6 +172,31 @@ Responsibility: Sterling, Harald
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: MySQL Extension
|
||||
Complete rewrite, leveraging the new MySQL 4 / MySQL 5
|
||||
features.
|
||||
Responsibility: Georg Richter, Zak Greant
|
||||
Timeframe: ?
|
||||
|
||||
|
||||
Component: XML
|
||||
- Rewrite DOMXML and incorporate all (or most of) W3C-DOM2.
|
||||
- Use the new ZE2 features (Exceptions, setter/getter).
|
||||
- Add SAX(2), XML Schema.
|
||||
- XSLT, HTML, XPath, XPointer, DTD Validation will still be
|
||||
supported, have to find a meaningful API for it.
|
||||
- Break BC, warn users now.
|
||||
- Look at the libxml2 patch by lukas schröder and see if we can prevent
|
||||
memory leaks with it (anyway, getting rid of mem-leaks and intelligent
|
||||
memory management is on top prio...)
|
||||
- In the longer term, domxml (or another name, as with todays features
|
||||
domxml is a little bit misleading) shall be the main xml-class, which
|
||||
covers most of what's needed for decent XML support in PHP ;)
|
||||
But there is certainly place for others like Sablotron etc.
|
||||
Responsibility: Christian Stocker
|
||||
Timeframe: ?
|
||||
|
||||
|
||||
Component: Test Suite
|
||||
Extending the test suite with atleast a test for every
|
||||
function in an extension that doesn't require external
|
||||
|
||||
+7
-55
@@ -34,9 +34,6 @@ typedef struct {
|
||||
size_t size;
|
||||
ts_allocate_ctor ctor;
|
||||
ts_allocate_dtor dtor;
|
||||
#ifdef MBO_0
|
||||
int done;
|
||||
#endif
|
||||
} tsrm_resource_type;
|
||||
|
||||
|
||||
@@ -160,15 +157,11 @@ TSRM_API void tsrm_shutdown(void)
|
||||
int j;
|
||||
|
||||
next_p = p->next;
|
||||
for (j=0; j<p->count; j++) {
|
||||
if (p->storage[j]) {
|
||||
#ifdef MBO_0
|
||||
if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
|
||||
resource_types_table[j].dtor(p->storage[j], &p->storage);
|
||||
}
|
||||
#endif
|
||||
free(p->storage[j]);
|
||||
for (j=0; j<id_count; j++) {
|
||||
if (resource_types_table && resource_types_table[j].dtor) {
|
||||
resource_types_table[j].dtor(p->storage[j], &p->storage);
|
||||
}
|
||||
free(p->storage[j]);
|
||||
}
|
||||
free(p->storage);
|
||||
free(p);
|
||||
@@ -191,7 +184,6 @@ TSRM_API void tsrm_shutdown(void)
|
||||
#if defined(GNUPTH)
|
||||
pth_kill();
|
||||
#elif defined(PTHREADS)
|
||||
pthread_setspecific(tls_key, 0);
|
||||
pthread_key_delete(tls_key);
|
||||
#elif defined(TSRM_WIN32)
|
||||
TlsFree(tls_key);
|
||||
@@ -226,9 +218,6 @@ TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].size = size;
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].ctor = ctor;
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].dtor = dtor;
|
||||
#ifdef MBO_0
|
||||
resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].done = 0;
|
||||
#endif
|
||||
|
||||
/* enlarge the arrays for the already active threads */
|
||||
for (i=0; i<tsrm_tls_table_size; i++) {
|
||||
@@ -283,16 +272,9 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
|
||||
tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
|
||||
}
|
||||
for (i=0; i<id_count; i++) {
|
||||
#if MBO_0
|
||||
if (resource_types_table[i].done) {
|
||||
(*thread_resources_ptr)->storage[i] = NULL;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
|
||||
if (resource_types_table[i].ctor) {
|
||||
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
|
||||
}
|
||||
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
|
||||
if (resource_types_table[i].ctor) {
|
||||
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,36 +419,6 @@ void ts_free_thread(void)
|
||||
/* deallocates all occurrences of a given id */
|
||||
void ts_free_id(ts_rsrc_id id)
|
||||
{
|
||||
#ifdef MBO_0
|
||||
int i;
|
||||
int j = TSRM_UNSHUFFLE_RSRC_ID(id);
|
||||
|
||||
tsrm_mutex_lock(tsmm_mutex);
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Freeing resource id %d", id));
|
||||
|
||||
if (tsrm_tls_table) {
|
||||
for (i=0; i<tsrm_tls_table_size; i++) {
|
||||
tsrm_tls_entry *p = tsrm_tls_table[i];
|
||||
|
||||
while (p) {
|
||||
if (p->count > j && p->storage[j]) {
|
||||
if (resource_types_table && resource_types_table[j].dtor) {
|
||||
resource_types_table[j].dtor(p->storage[j], &p->storage);
|
||||
}
|
||||
free(p->storage[j]);
|
||||
p->storage[j] = NULL;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
resource_types_table[j].done = 1;
|
||||
|
||||
tsrm_mutex_unlock(tsmm_mutex);
|
||||
|
||||
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully freed resource id %d", id));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <shellapi.h>
|
||||
#elif defined(NETWARE)
|
||||
# include <nks/thread.h>
|
||||
#ifdef USE_MPK
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// vim:ft=javascript
|
||||
// $Id$
|
||||
|
||||
if (CHECK_HEADER_ADD_INCLUDE("NewAPIs.h", "CFLAGS_PHP", php_usual_include_suspects)) {
|
||||
// Need to add the flag directly, since TSRM doesn't include the config
|
||||
// header
|
||||
ADD_FLAG("CFLAGS_PHP", "/DHAVE_NEWAPIS_H=1");
|
||||
}
|
||||
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c tsrm_win32.c");
|
||||
|
||||
+2
-3
@@ -95,15 +95,14 @@ dnl For the thread implementations, we always use --with-*
|
||||
dnl to maintain consistency
|
||||
|
||||
AC_ARG_WITH(tsrm-pth,
|
||||
[ --with-tsrm-pth[=pth-config]
|
||||
Use GNU Pth.],[
|
||||
[ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
|
||||
TSRM_PTH=$withval
|
||||
],[
|
||||
TSRM_PTH=no
|
||||
])
|
||||
|
||||
AC_ARG_WITH(tsrm-st,
|
||||
[ --with-tsrm-st Use SGI's State Threads],[
|
||||
[ --with-tsrm-st],[
|
||||
TSRM_ST=$withval
|
||||
],[
|
||||
TSRM_ST=no
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_REALPATH 1
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef __GNUC__
|
||||
# ifndef HAVE_ALLOCA_H
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||
# ifndef NETWARE
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+3
-37
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -34,11 +34,6 @@
|
||||
#ifdef TSRM_WIN32
|
||||
#include <io.h>
|
||||
#include "tsrm_win32.h"
|
||||
# if HAVE_NEWAPIS_H
|
||||
# define WANT_GETLONGPATHNAME_WRAPPER
|
||||
# define COMPILE_NEWAPIS_STUBS
|
||||
# include <NewAPIs.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef NETWARE
|
||||
@@ -302,8 +297,6 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
unsigned char is_absolute = 0;
|
||||
#ifndef TSRM_WIN32
|
||||
char resolved_path[MAXPATHLEN];
|
||||
#else
|
||||
char *new_path;
|
||||
#endif
|
||||
|
||||
if (path_length == 0)
|
||||
@@ -338,29 +331,6 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
#endif
|
||||
#if defined(TSRM_WIN32)
|
||||
{
|
||||
char *dummy = NULL;
|
||||
int new_path_length;
|
||||
|
||||
new_path_length = GetLongPathName(path, dummy, 0) + 1;
|
||||
if (new_path_length == 0) {
|
||||
return 1;
|
||||
}
|
||||
new_path = (char *) malloc(new_path_length);
|
||||
if (!new_path) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (GetLongPathName(path, new_path, new_path_length) != 0) {
|
||||
path = new_path;
|
||||
path_length = new_path_length;
|
||||
} else {
|
||||
free(new_path);
|
||||
new_path = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
free_path = path_copy = tsrm_strndup(path, path_length);
|
||||
|
||||
@@ -465,11 +435,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
}
|
||||
|
||||
free(old_state);
|
||||
#ifdef TSRM_WIN32
|
||||
if (new_path) {
|
||||
free(new_path);
|
||||
}
|
||||
#endif
|
||||
|
||||
free(free_path);
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
|
||||
|
||||
+2
-29
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -41,10 +41,6 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(__osf__) || defined(_AIX)
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
#include "readdir.h"
|
||||
#include <sys/utime.h>
|
||||
@@ -171,25 +167,6 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* On AIX & Tru64 when a file does not exist realpath() returns
|
||||
* NULL, and sets errno to ENOENT. Unlike in other libc implementations
|
||||
* the destination is not filled and remains undefined. Therefor, we
|
||||
* must populate it manually using strcpy as done on systems with no
|
||||
* realpath() function.
|
||||
*/
|
||||
#if defined(__osf__) || defined(_AIX)
|
||||
static char *php_realpath_hack(char *src, char *dest)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if ((ret = realpath(src, dest)) == NULL && errno == ENOENT) {
|
||||
return strcpy(dest, src);
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_UTIME
|
||||
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
|
||||
#endif
|
||||
@@ -271,11 +248,7 @@ typedef struct _virtual_cwd_globals {
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REALPATH
|
||||
#if defined(__osf__) || defined(_AIX)
|
||||
#define VCWD_REALPATH(path, real_path) php_realpath_hack(path, real_path)
|
||||
#else
|
||||
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
|
||||
#endif
|
||||
#else
|
||||
#define VCWD_REALPATH(path, real_path) strcpy(real_path, path)
|
||||
#endif
|
||||
|
||||
+2
-13
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "TSRM.h"
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
|
||||
#include "tsrm_win32.h"
|
||||
|
||||
#ifdef ZTS
|
||||
@@ -375,14 +374,4 @@ TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
TSRM_API char *realpath(char *orig_path, char *buffer)
|
||||
{
|
||||
int ret = GetFullPathName(orig_path, _MAX_PATH, buffer, NULL);
|
||||
if(!ret || ret > _MAX_PATH) {
|
||||
return NULL;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
#endif
|
||||
+3
-4
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -102,5 +102,4 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags);
|
||||
TSRM_API int shmdt(const void *shmaddr);
|
||||
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
|
||||
|
||||
TSRM_API char *realpath(char *orig_path, char *buffer);
|
||||
#endif
|
||||
#endif
|
||||
-4853
File diff suppressed because it is too large.
Load diff
+1
-3
@@ -14,9 +14,7 @@ libZend_la_SOURCES=\
|
||||
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
||||
zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
|
||||
zend_ini.c zend_qsort.c zend_objects.c zend_object_handlers.c \
|
||||
zend_objects_API.c zend_ts_hash.c zend_stream.c zend_mm.c \
|
||||
zend_default_classes.c zend_reflection_api.c \
|
||||
zend_iterators.c zend_interfaces.c zend_exceptions.c
|
||||
zend_objects_API.c zend_ts_hash.c zend_stream.c zend_mm.c zend_default_classes.c
|
||||
|
||||
libZend_la_LDFLAGS =
|
||||
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ write_property is used to directly write object's property by
|
||||
name. This handler is used to assign property variables or to change them
|
||||
in operations like += or ++ (unless get_property_zval_ptr is also set).
|
||||
|
||||
get_property_zval_ptr is used to obtain pointer to modifiable zval for
|
||||
get_property_zval_ptr is used to obtain pointer to modifyable zval for
|
||||
operations like += or ++. This should be used only if your object model
|
||||
stores properties as real zval's that can be modified from outside.
|
||||
Otherwise this handler should be NULL and the engine will use
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Title: Zend 2.0 Namespaces
|
||||
Version: $Revision$
|
||||
Status: declined
|
||||
Status: draft
|
||||
Maintainer: Stig S. Bakken <ssb@php.net>
|
||||
Created: 2001-09-08
|
||||
Modified: 2001-09-08
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
Title: Delegation
|
||||
(a/k/a. Object-Based Inheritance)
|
||||
Version: $Revision$
|
||||
Status: draft
|
||||
Maintainer: Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
|
||||
|
||||
Dynamic Delegation
|
||||
|
||||
Syntax / Example
|
||||
|
||||
<?php
|
||||
class aDelegatee {
|
||||
function doSomething() {
|
||||
echo 'hubu';
|
||||
}
|
||||
}
|
||||
|
||||
class anotherDelegatee {
|
||||
function doSomething() {
|
||||
echo 'tubu';
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
delegatee $bar;
|
||||
|
||||
function setDelegatee($delegatee) {
|
||||
$this->delegatee = $delegatee;
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new Foo;
|
||||
|
||||
$foo->setDelegatee(new aDelegatee);
|
||||
$foo->doSomething(); /* prints "hubu" */
|
||||
|
||||
$foo->setDelegatee(new anotherDelegatee);
|
||||
$foo->doSomething(); /* prints "tubu" */
|
||||
?>
|
||||
|
||||
Semantics / Synopsis
|
||||
|
||||
The "Foo" class may use all methods available in "$bar" as if they
|
||||
where locally defined or inherited from a superclass. The essential
|
||||
difference is that by assigning another object to "$bar" it is
|
||||
possible to dynamically switch between different implementations for
|
||||
these methods.
|
||||
|
||||
|
||||
Fixed Delegation
|
||||
|
||||
Syntax / Example
|
||||
|
||||
<?php
|
||||
class aDelegatee {
|
||||
function doSomething() {
|
||||
echo 'hubu';
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
final delegatee $bar = new aDelegatee;
|
||||
}
|
||||
|
||||
$foo = new Foo;
|
||||
|
||||
$foo->doSomething(); /* prints "hubu" */
|
||||
?>
|
||||
|
||||
Semantics / Synopsis
|
||||
|
||||
The "Foo" class may use all methods available in "$bar" as if they
|
||||
where locally defined or inherited from a superclass. The difference
|
||||
to the dynamic delegation is that once the delegatee object is set,
|
||||
it cannot be changed.
|
||||
|
||||
|
||||
Default Delegation
|
||||
|
||||
Syntax / Example
|
||||
|
||||
<?php
|
||||
class Foo {
|
||||
function __delegate($name, $parameters = array()) {
|
||||
echo $name;
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new Foo;
|
||||
$foo->bar(); /* prints "bar" */
|
||||
?>
|
||||
|
||||
Semantics / Synopsis
|
||||
|
||||
If a class has a __delegate() method, it is called whenever a
|
||||
method on an object of this class is called that is
|
||||
|
||||
* Not defined in the class.
|
||||
|
||||
* Not provided by a delegatee object.
|
||||
|
||||
The __delegate() method is called with the name and parameters
|
||||
of the method call.
|
||||
|
||||
This supersedes / obsoletes similar functionality introduced in
|
||||
Zend Engine 1 by ext/overload.
|
||||
+122
-445
@@ -19,43 +19,11 @@ Changes in the Zend Engine 2.0
|
||||
the box or after a very small amount of modifications would be
|
||||
high.
|
||||
|
||||
* $this
|
||||
|
||||
Unlike in Zend Engine 1 the pseudo variable $this cannot be
|
||||
exchanged in Zend Engine 2. You can of course modify or work with
|
||||
an object by using $this but you cannot replace $this with another
|
||||
object to change the original object.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class Foo {
|
||||
function replace($other)
|
||||
{
|
||||
$this = $other;
|
||||
}
|
||||
}
|
||||
|
||||
$object = new Foo;
|
||||
$object->prop = 'Hello';
|
||||
|
||||
$other = new Foo;
|
||||
$other->prop = 'Bye';
|
||||
|
||||
$object->replace($other);
|
||||
|
||||
print $object->prop; // still shows 'Hello'
|
||||
|
||||
?>
|
||||
|
||||
Zend Engine 2.0 will issue a compile error, if an assignment
|
||||
to $this is found.
|
||||
|
||||
* Private and Protected Members.
|
||||
|
||||
The Zend Engine 2.0 introduces private and protected member
|
||||
variables. Note that for performance reasons no error message is
|
||||
emitted in case of an illegal access to a private or protectecd
|
||||
The Zend Engine 2.0 introduces private and protected member
|
||||
variables. Note that for performance reasons no error message is
|
||||
emitted in case of an illegal access to a private or protectecd
|
||||
member variable.
|
||||
|
||||
Example:
|
||||
@@ -75,7 +43,7 @@ Changes in the Zend Engine 2.0
|
||||
|
||||
class MyClass2 extends MyClass {
|
||||
protected $Foo;
|
||||
|
||||
|
||||
function printHello() {
|
||||
MyClass::printHello(); /* Should print */
|
||||
print "MyClass2::printHello() " . $this->Hello; /* Shouldn't print out anything */
|
||||
@@ -96,9 +64,9 @@ Changes in the Zend Engine 2.0
|
||||
print $obj->Foo; /* Shouldn't print out anything */
|
||||
$obj->printHello();
|
||||
?>
|
||||
|
||||
Protected member variables can be accessed in classes extending the
|
||||
class they are declared in, whereas private member variables can
|
||||
|
||||
Protected member variables can be accessed in classes extending the
|
||||
class they are declared in, whereas private member variables can
|
||||
only be accessed by the class they belong to.
|
||||
|
||||
* Private and protected methods.
|
||||
@@ -130,14 +98,14 @@ Changes in the Zend Engine 2.0
|
||||
$o->aPublicMethod();
|
||||
?>
|
||||
|
||||
Old code that has no user-defined classes or functions named
|
||||
Old code that has no user-defined classes or functions named
|
||||
'public', 'protected' or 'private' should run without modifications.
|
||||
|
||||
* Abstract Classes and Methods.
|
||||
|
||||
The Zend Engine 2.0 introduces abstract classes and methods. An
|
||||
abstract method only declares the method's signature and does not
|
||||
provide an implementation. A class that contains abstract methods
|
||||
The Zend Engine 2.0 introduces abstract classes and methods. An
|
||||
abstract method only declares the method's signature and does not
|
||||
provide an implementation. A class that contains abstract methods
|
||||
needs to be declared abstract.
|
||||
|
||||
Example:
|
||||
@@ -157,10 +125,9 @@ Changes in the Zend Engine 2.0
|
||||
$o->test();
|
||||
?>
|
||||
|
||||
Classes that do not have abstract methods can be declared abstract
|
||||
to prevent them from being instantiated.
|
||||
Abstract classes cannot be instantiated.
|
||||
|
||||
Old code that has no user-defined classes or functions named
|
||||
Old code that has no user-defined classes or functions named
|
||||
'abstract' should run without modifications.
|
||||
|
||||
* Interfaces.
|
||||
@@ -171,58 +138,24 @@ Changes in the Zend Engine 2.0
|
||||
Example:
|
||||
|
||||
<?php
|
||||
interface Printable {
|
||||
public function dump();
|
||||
interface Throwable {
|
||||
public function getMessage();
|
||||
}
|
||||
|
||||
class PrintableExample implements Printable {
|
||||
public function dump() {
|
||||
class Exception implements Throwable {
|
||||
public function getMessage() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Old code that has no user-defined classes or functions named
|
||||
Old code that has no user-defined classes or functions named
|
||||
'interface' or 'implements' should run without modifications.
|
||||
|
||||
An interface may extend one or more base interfaces (but not
|
||||
implement them). Neither a class nor an interface can inherit
|
||||
methods of the same name from different root interfaces.
|
||||
|
||||
Interfaces may contain abstract static methods.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
interface Printable {
|
||||
function dump();
|
||||
}
|
||||
|
||||
interface Streamable extends Printable {
|
||||
function writeToStream();
|
||||
static function readFromStream();
|
||||
}
|
||||
|
||||
class PrintableExample implements Streamable {
|
||||
public function dump() {
|
||||
// ...
|
||||
}
|
||||
function writeToStream() {
|
||||
// ...
|
||||
}
|
||||
static function readFromStream() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
A class that does not implement all interface methods must be
|
||||
declared as an abstract class.
|
||||
|
||||
* Class Type Hints.
|
||||
|
||||
While remaining loosely typed the Zend Engine 2.0 introduces the
|
||||
ability to use class type hints to declare the expected class of
|
||||
While remaining loosely typed the Zend Engine 2.0 introduces the
|
||||
ability to use class type hints to declare the expected class of
|
||||
objects that are passed as parameters to a method.
|
||||
|
||||
Example:
|
||||
@@ -272,10 +205,11 @@ Changes in the Zend Engine 2.0
|
||||
|
||||
This syntax only applies to objects/classes, not built-in types.
|
||||
|
||||
* Final methods and classes.
|
||||
* final.
|
||||
|
||||
The Zend Engine 2.0 introduces the "final" keyword to declare
|
||||
final methods. Those cannot be overridden by sub-classes.
|
||||
final members and methods. Those cannot be overridden by
|
||||
sub-classes.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -287,24 +221,7 @@ Changes in the Zend Engine 2.0
|
||||
}
|
||||
?>
|
||||
|
||||
It is furthermore possible to make a class final. Doing this
|
||||
prevents a class from being specialized (it cannot be inherited
|
||||
by another class). There's no need to declare the methods of
|
||||
a final class themselves as final.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
final class Foo {
|
||||
// class definition
|
||||
}
|
||||
// the next line is impossible
|
||||
// class Bork extends Foo {}
|
||||
?>
|
||||
|
||||
Properties cannot be final. See per-class constants below.
|
||||
|
||||
Old code that has no user-defined classes or functions named
|
||||
Old code that has no user-defined classes or functions named
|
||||
'final' should run without modifications.
|
||||
|
||||
* Object Cloning.
|
||||
@@ -325,12 +242,13 @@ Changes in the Zend Engine 2.0
|
||||
replicate the parent object you want to create a new instance of
|
||||
this other object so that the replica has its own separate copy.
|
||||
|
||||
An object copy is created by using the clone operator.
|
||||
An object copy is created by calling the object's __clone()
|
||||
method.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
$copy_of_object = clone $object;
|
||||
$copy_of_object = $object->__clone();
|
||||
?>
|
||||
|
||||
When the developer asks to create a new copy of an object, the
|
||||
@@ -339,42 +257,90 @@ Changes in the Zend Engine 2.0
|
||||
all of the object's properties. If a __clone() method is
|
||||
defined, then it will be responsible to set the necessary
|
||||
properties in the created object. For convenience, the engine
|
||||
ensures, that the clone will be initialized with all of the
|
||||
properties from the source object, so that developers can start
|
||||
with a by-value replica of the source object, and only override
|
||||
properties that need to be changed.
|
||||
will supply a function that imports all of the properties from
|
||||
the source object, so that they can start with a by-value
|
||||
replica of the source object, and only override properties that
|
||||
need to be changed. [The function hasn't been implemented yet]
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class MyCloneable {
|
||||
static $id = 0;
|
||||
static $id = 0;
|
||||
|
||||
function MyCloneable() {
|
||||
$this->id = self::$id++;
|
||||
}
|
||||
function MyCloneable() {
|
||||
$this->id = self::$id++;
|
||||
}
|
||||
|
||||
function __clone() {
|
||||
$this->address = 'New York';
|
||||
$this->id = self::$id++;
|
||||
}
|
||||
function __clone() {
|
||||
$this->name = $that->name;
|
||||
$this->address = 'New York';
|
||||
$this->id = self::$id++;
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new MyCloneable();
|
||||
|
||||
$obj->name = 'Hello';
|
||||
$obj->name = 'Hello';
|
||||
$obj->address = 'Tel-Aviv';
|
||||
|
||||
$obj_clone = clone $obj;
|
||||
print $obj->id . "\n";
|
||||
|
||||
$obj = $obj->__clone();
|
||||
|
||||
print $obj->id . "\n";
|
||||
print $obj->name . "\n";
|
||||
print $obj->address . "\n";
|
||||
|
||||
print $obj_clone->id . "\n";
|
||||
print $obj_clone->name . "\n";
|
||||
print $obj_clone->address . "\n";
|
||||
?>
|
||||
|
||||
* Namespaces.
|
||||
|
||||
The Zend Engine 1.0 provided only three scopes: the global
|
||||
scope, the class scope and the function scope. All scopes but
|
||||
classes could contain variables, only the class and global
|
||||
scopes could contain functions, while only the global scope
|
||||
could contain constants and classes. This means that all of the
|
||||
Zend Engine 1.0's scoping methods were inherently limited for
|
||||
solving symbol name collision problems.
|
||||
|
||||
The Zend Engine 2.0 introduces the concept of namespaces
|
||||
to solve the symbol collision problem by making it possible to
|
||||
define multiple symbol tables able to contain all types of
|
||||
symbols.
|
||||
|
||||
A namespace may contain classes, constants, functions and variables.
|
||||
The member of a namespace is accessed by prefixing its name with the
|
||||
name of the namespace followed by '::'.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
namespace Foo {
|
||||
class Bar {}
|
||||
const aConstant = 'someValue';
|
||||
function aFunction() {}
|
||||
var $aVariable;
|
||||
}
|
||||
|
||||
$o = new Foo::Bar;
|
||||
echo Foo::aConstant;
|
||||
Foo::aFunction();
|
||||
Foo::$aVariable = 'someValue';
|
||||
?>
|
||||
|
||||
A namespace's name may contain colons to denote "sub-namespaces".
|
||||
This is pure syntactic sugar, the Zend Engine will not see, for
|
||||
instance, the namespaces "Package", "Package:Subpackage" and
|
||||
"Package:Subpackage:Subsubpackage" as related.
|
||||
|
||||
Namespaces can be neither nested nor instantiated.
|
||||
|
||||
To avoid ambiguities in the '::' resolution there may be no
|
||||
global class and namespace with the same name.
|
||||
|
||||
Old code that has no user-defined classes or functions named
|
||||
'namespace' should run without modifications.
|
||||
|
||||
* Unified Constructors.
|
||||
|
||||
The Zend Engine allows developers to declare constructor methods
|
||||
@@ -462,7 +428,8 @@ Changes in the Zend Engine 2.0
|
||||
|
||||
* Constants.
|
||||
|
||||
The Zend Engine 2.0 introduces per-class constants.
|
||||
The Zend Engine 2.0 introduces per-class and per-namespace
|
||||
constants.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -474,27 +441,24 @@ Changes in the Zend Engine 2.0
|
||||
echo 'Foo::constant = ' . Foo::constant . "\n";
|
||||
?>
|
||||
|
||||
Old code that has no user-defined classes or functions
|
||||
The Zend Engine 2.0 allows for expressions within constants:
|
||||
|
||||
<?php
|
||||
class Bar {
|
||||
const a = 1<<0;
|
||||
const b = 1<<1;
|
||||
const c = a | b;
|
||||
}
|
||||
?>
|
||||
|
||||
Old code that has no user-defined classes or functions
|
||||
named 'const' will run without modifications.
|
||||
|
||||
* Exceptions.
|
||||
|
||||
The Zend Engine 1.0 had no exception handling. The Zend Engine 2.0
|
||||
introduces a exception model similar to that of other programming
|
||||
languages. But there is no catch all and no finally clause.
|
||||
|
||||
Old code that has no user-defined classes or functions 'catch',
|
||||
'throw' and 'try' will run without modifications.
|
||||
|
||||
Exceptions can be rethrown in catch blocks. Also it is possible to
|
||||
have multiple catch blocks. In that case the caught exception is
|
||||
compared with the classtype of each catch block from top to bottom
|
||||
and the first block that has a 'instanceof' match gets executed.
|
||||
When the catch block finishes execution continues at the end of
|
||||
the last catch block. If no catch block has a 'instanceof' match
|
||||
then the next try/catch block is searched until no more try/catch
|
||||
blocks are available. In that case the exception is an uncaught
|
||||
exception and the program terminates with showing the exception.
|
||||
languages.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -522,106 +486,14 @@ Changes in the Zend Engine 2.0
|
||||
try {
|
||||
throw new MyExceptionFoo('Hello');
|
||||
}
|
||||
|
||||
catch (MyException $exception) {
|
||||
$exception->Display();
|
||||
}
|
||||
catch (Exception $exception) {
|
||||
echo $exception;
|
||||
}
|
||||
?>
|
||||
|
||||
Even though the above example shows that it is possible to define
|
||||
exception classes that don't inherit from Exception it is best to
|
||||
do so. This is because the internal Exception class can gather a
|
||||
lot of information otherwise not available. The PHP code emulation
|
||||
code would look something like shown below. The comments show the
|
||||
meaning of each property. As the code shows it is possible to read
|
||||
any available information by using the getter methods. But since
|
||||
some of the methods are used internally they are marked final. All
|
||||
in all the class is very restrictive because it must be ensured
|
||||
that anything used internally always works as expected.
|
||||
|
||||
Emulating class Exception:
|
||||
|
||||
<?php
|
||||
class Exception {
|
||||
function __construct(/*string*/ $message=NULL, /*int*/ $code=0) {
|
||||
if (func_num_args()) {
|
||||
$this->message = $message;
|
||||
}
|
||||
$this->code = $code;
|
||||
$this->file = __FILE__; // of throw clause
|
||||
$this->line = __LINE__; // of throw clause
|
||||
$this->trace = debug_backtrace();
|
||||
$this->string = StringFormat($this);
|
||||
}
|
||||
|
||||
protected $message = 'Unknown exception'; // exception message
|
||||
protected $code = 0; // user defined exception code
|
||||
protected $file; // source filename of exception
|
||||
protected $line; // source line of exception
|
||||
|
||||
private $trace; // backtrace of exception
|
||||
private $string; // internal only!!
|
||||
|
||||
final function getMessage() {
|
||||
return $this->message;
|
||||
}
|
||||
final function getCode() {
|
||||
return $this->code;
|
||||
}
|
||||
final function getFile() {
|
||||
return $this->file;
|
||||
}
|
||||
final function getTrace() {
|
||||
return $this->trace;
|
||||
}
|
||||
final function getTraceAsString() {
|
||||
return self::TraceFormat($this);
|
||||
}
|
||||
function _toString() {
|
||||
return $this->string;
|
||||
}
|
||||
static private function StringFormat(Exception $exception) {
|
||||
// ... a function not available in PHP scripts
|
||||
// that returns all relevant information as a string
|
||||
}
|
||||
static private function TraceFormat(Exception $exception) {
|
||||
// ... a function not available in PHP scripts
|
||||
// that returns the backtrace as a string
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
If you derive your exception classes from this Exception base class
|
||||
your exceptions will be nicely shown in the builtin handler for
|
||||
uncaught exceptions.
|
||||
|
||||
Note: The method getMessage() is a final read only access method to
|
||||
the private proeprty message that is set in the constructor. If you
|
||||
feel a need to overwrite the exception display then overload method
|
||||
__toString() in your derived class or implement your own extneral
|
||||
exception display function to accomplish your desired formatting.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
function display_exception(Exception $ex)
|
||||
{
|
||||
echo 'Exception: ' . $ex->getMessage() . 'with backtrace: <pre>';
|
||||
echo $ex->getTrace();
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// your code here
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
display_exeption($ex);
|
||||
}
|
||||
?>
|
||||
Old code that has no user-defined classes or functions 'catch',
|
||||
'throw' and 'try' will run without modifications.
|
||||
|
||||
* Dereferencing objects returned from functions.
|
||||
|
||||
@@ -651,21 +523,17 @@ Changes in the Zend Engine 2.0
|
||||
ShapeFactoryMethod('Square')->draw();
|
||||
?>
|
||||
|
||||
* Member variables of classes can now be initialized.
|
||||
* Static member variables of static classes can now be
|
||||
initialized.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class foo {
|
||||
static $my_static = 5;
|
||||
public $my_prop = 'bla';
|
||||
}
|
||||
|
||||
print foo::$my_static;
|
||||
|
||||
$obj = foo;
|
||||
|
||||
print $obj->my_prop;
|
||||
?>
|
||||
|
||||
* Static Methods.
|
||||
@@ -688,22 +556,14 @@ Changes in the Zend Engine 2.0
|
||||
The pseudo variable $this is not available inside a method that
|
||||
has been declared static.
|
||||
|
||||
* instanceof.
|
||||
New support for an instanceof operator which checks if an object
|
||||
is of a certain class or interface type.
|
||||
* instanceof (TBD)
|
||||
|
||||
Example:
|
||||
* Static function variables.
|
||||
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
}
|
||||
|
||||
$obj = new Foo();
|
||||
if ($obj instanceof Foo) {
|
||||
print "Yay!\n";
|
||||
}
|
||||
?>
|
||||
Statics are now treated at compile-time which allows developers
|
||||
to assign variables to statics by reference. This change also
|
||||
greatly improves their performance but means that indirect
|
||||
references to statics will not work anymore.
|
||||
|
||||
* Parameters that are passed by reference to a function
|
||||
may now have default values.
|
||||
@@ -720,11 +580,10 @@ Changes in the Zend Engine 2.0
|
||||
|
||||
* __autoload().
|
||||
|
||||
The __autoload() interceptor function will be automatically called
|
||||
when an undeclared class is to be instantiated. The name of that
|
||||
class will be passed to the __autoload() interceptor function as its
|
||||
only argument. __autoload() must succeed in loading the class. If it
|
||||
doesn't then an E_ERROR is emitted.
|
||||
The __autoload() interceptor function will be automatically called
|
||||
when an undeclared class is to be instantiated. The name of that
|
||||
class will be passed to the __autoload() interceptor function as its
|
||||
only argument.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -796,188 +655,6 @@ Changes in the Zend Engine 2.0
|
||||
var_dump($a);
|
||||
?>
|
||||
|
||||
* Iteration
|
||||
|
||||
Objects may be iterated in an overloaded way when used with
|
||||
foreach. The default behavior is to iterate over all properties
|
||||
with respect to property visibility.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class Foo {
|
||||
var $x = 1;
|
||||
var $y = 2;
|
||||
}
|
||||
|
||||
$obj = new Foo;
|
||||
|
||||
foreach ($obj as $prp_name => $prop_value) {
|
||||
// using the property
|
||||
}
|
||||
?>
|
||||
|
||||
Each class whose instances can be iterated with foreach should
|
||||
implement the empty interface 'Traversable'. Hence any object
|
||||
that says it implements 'Traversable' can be used with foreach.
|
||||
|
||||
The interfaces 'IteratorAggregate' and 'Iterator' allow to specify
|
||||
how class objects are iterated in PHP code. The first of them simply
|
||||
has a method 'getIterator' which must return an object that either
|
||||
implements the interface 'Iterator' or is instantiated from an
|
||||
internal class that can be iterated.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class ObjectIterator implements Iterator {
|
||||
|
||||
private $obj;
|
||||
private $num;
|
||||
|
||||
function __construct($obj) {
|
||||
$this->obj = $obj;
|
||||
}
|
||||
function rewind() {
|
||||
$this->num = 0;
|
||||
}
|
||||
function valid() {
|
||||
return $this->num < $this->obj->max;
|
||||
}
|
||||
function key() {
|
||||
return $this->num;
|
||||
}
|
||||
function current() {
|
||||
switch($this->num) {
|
||||
case 0: return "1st";
|
||||
case 1: return "2nd";
|
||||
case 2: return "3rd";
|
||||
default: return $this->num."th";
|
||||
}
|
||||
}
|
||||
function next() {
|
||||
$this->num++;
|
||||
}
|
||||
}
|
||||
|
||||
class Object implements IteratorAggregate {
|
||||
|
||||
public $max = 3;
|
||||
|
||||
function getIterator() {
|
||||
return new ObjectIterator($this);
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new Object;
|
||||
|
||||
// this foreach ...
|
||||
foreach($obj as $key => $val) {
|
||||
echo "$key = $val\n";
|
||||
}
|
||||
|
||||
// matches the following 7 lines with the for directive.
|
||||
$it = $obj->getIterator();
|
||||
for($it->rewind(); $it->valid(); $it->next()) {
|
||||
$key = $it->key();
|
||||
$val = $it->current();
|
||||
echo "$key = $val\n";
|
||||
}
|
||||
unset($it);
|
||||
?>
|
||||
|
||||
The matching for directive is very intersting here since it shows
|
||||
the use of all abstract methods declared in the interfaces Iterator
|
||||
and IteratorAggregate respectively.
|
||||
|
||||
* __METHOD__
|
||||
|
||||
The pseudo constant __METHOD__ shows the current class and method
|
||||
when used inside a method and the function when used outside of a
|
||||
class.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class Foo {
|
||||
function Show() {
|
||||
echo __FILE__ . '(' . __LINE__ . ')' . __METHOD__;
|
||||
}
|
||||
}
|
||||
function Test() {
|
||||
echo __FILE__ . '(' . __LINE__ . ')' . __METHOD__;
|
||||
}
|
||||
?>
|
||||
|
||||
* __toString()
|
||||
|
||||
The magic method __toString() allows to overload the object to
|
||||
string conversion. This conversion is only done automatically for
|
||||
the printing functions (echo, print) but not for other functions
|
||||
that expect strings. Also the function __toString is not used in
|
||||
places where objects are not allowed but strings are like array
|
||||
indices. Note that specialized objects may be converted to a string
|
||||
in any place but without calling __toString().
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class Foo {
|
||||
function __toString() {
|
||||
return "What ever";
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new Foo;
|
||||
|
||||
$str = (string) $obj; // call __toString()
|
||||
|
||||
echo $obj; // call __toString()
|
||||
|
||||
$ar = array();
|
||||
$ar[(string)$obj]; // this works
|
||||
$ar[$obj]; // this is not allowed
|
||||
?>
|
||||
|
||||
* Reflection API
|
||||
|
||||
PHP 5 comes with a complete Reflection API that adds the ability to
|
||||
reverse-engineer classes, interfaces, functions and methods as well
|
||||
as extensions.
|
||||
|
||||
The Reflection API also offers ways of getting doc comments for
|
||||
functions, classes and methods.
|
||||
|
||||
Nearly all aspects of object oriented code can be reflected by
|
||||
using the Reflection API which is documented separately:
|
||||
http://sitten-polizei.de/php/reflection_api/docs/language.reflection.html
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class Foo {
|
||||
public $prop;
|
||||
function Func($name) {
|
||||
echo "Hello $name";
|
||||
}
|
||||
}
|
||||
|
||||
ReflectionClass::export('Foo');
|
||||
ReflectionObject::export(new Foo);
|
||||
ReflectionMethod::export('Foo', 'func');
|
||||
ReflectionProperty::export('Foo', 'prop');
|
||||
ReflectionExtension::export('standard');
|
||||
?>
|
||||
|
||||
* New memory manager
|
||||
The Zend Engine has a new memory manager which allows it to run efficiently
|
||||
in multi-threaded environments as it doesn't need to use mutexes to lock
|
||||
and unlock during allocation/deallocation.
|
||||
|
||||
* Others
|
||||
Probably other changes which we forgot to list. This list will be kept up-to-date
|
||||
as much as possible.
|
||||
|
||||
|
||||
Changes in the Zend Engine 1.0
|
||||
|
||||
|
||||
@@ -135,10 +135,6 @@ SOURCE=.\zend_default_classes.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_interfaces.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_dynamic_array.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -227,10 +223,6 @@ SOURCE=.\zend_qsort.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_reflection_api.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_sprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -291,10 +283,6 @@ SOURCE=.\zend_default_classes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_interfaces.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_dynamic_array.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -403,10 +391,6 @@ SOURCE=.\zend_qsort.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_reflection_api.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+5
-19
@@ -10,7 +10,7 @@ if test "$YACC" != "bison -y"; then
|
||||
AC_MSG_WARN(You will need bison if you want to regenerate the Zend parser.)
|
||||
else
|
||||
AC_MSG_CHECKING(bison version)
|
||||
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /' | tr -d 'a-z'`
|
||||
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
|
||||
if test "${1}" = "1" -a "${2}" -lt "28"; then
|
||||
AC_MSG_WARN(You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)
|
||||
fi
|
||||
@@ -52,7 +52,6 @@ sys/time.h \
|
||||
signal.h \
|
||||
unix.h \
|
||||
stdlib.h \
|
||||
mach-o/dyld.h \
|
||||
dlfcn.h)
|
||||
|
||||
AC_TYPE_SIZE_T
|
||||
@@ -98,7 +97,7 @@ ZEND_FP_EXCEPT
|
||||
AC_DEFUN(LIBZEND_ENABLE_DEBUG,[
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Compile with debugging symbols],[
|
||||
[ --enable-debug Compile with debugging symbols],[
|
||||
ZEND_DEBUG=$enableval
|
||||
],[
|
||||
ZEND_DEBUG=no
|
||||
@@ -109,15 +108,15 @@ AC_ARG_ENABLE(debug,
|
||||
AC_DEFUN(LIBZEND_OTHER_CHECKS,[
|
||||
|
||||
AC_ARG_ENABLE(maintainer-zts,
|
||||
[ --enable-maintainer-zts Enable thread safety - for code maintainers only],[
|
||||
[ --enable-maintainer-zts Enable thread safety - for code maintainers only],[
|
||||
ZEND_MAINTAINER_ZTS=$enableval
|
||||
],[
|
||||
ZEND_MAINTAINER_ZTS=no
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(inline-optimization,
|
||||
[ --disable-inline-optimization
|
||||
If building zend_execute.lo fails, try this switch.],[
|
||||
[ --disable-inline-optimization If building zend_execute.lo fails, try
|
||||
this switch.],[
|
||||
ZEND_INLINE_OPTIMIZATION=$enableval
|
||||
],[
|
||||
ZEND_INLINE_OPTIMIZATION=yes
|
||||
@@ -130,13 +129,6 @@ AC_ARG_ENABLE(memory-limit,
|
||||
ZEND_MEMORY_LIMIT=no
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(zend-multibyte,
|
||||
[ --enable-zend-multibyte Compile with zend multibyte support. ], [
|
||||
ZEND_MULTIBYTE=$enableval
|
||||
],[
|
||||
ZEND_MULTIBYTE=no
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(whether to enable thread-safety)
|
||||
AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
|
||||
|
||||
@@ -148,9 +140,6 @@ AC_MSG_RESULT($ZEND_MEMORY_LIMIT)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable Zend debugging)
|
||||
AC_MSG_RESULT($ZEND_DEBUG)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable Zend multibyte)
|
||||
AC_MSG_RESULT($ZEND_MULTIBYTE)
|
||||
|
||||
if test "$ZEND_DEBUG" = "yes"; then
|
||||
AC_DEFINE(ZEND_DEBUG,1,[ ])
|
||||
@@ -179,9 +168,6 @@ else
|
||||
AC_DEFINE(MEMORY_LIMIT, 0, [Memory limit])
|
||||
fi
|
||||
|
||||
if test "$ZEND_MULTIBYTE" = "yes"; then
|
||||
AC_DEFINE(ZEND_MULTIBYTE, 1, [ ])
|
||||
fi
|
||||
|
||||
changequote({,})
|
||||
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
|
||||
|
||||
+13
-41
@@ -7,21 +7,21 @@
|
||||
CFG=ZendTS - Win32 Release_TSDbg
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ZendTS.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ZendTS.mak" CFG="ZendTS - Win32 Release_TSDbg"
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
!MESSAGE "ZendTS - Win32 Release_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "ZendTS - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "ZendTS - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "ZendTS - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
@@ -119,7 +119,7 @@ LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
@@ -164,10 +164,6 @@ SOURCE=.\zend_dynamic_array.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_exceptions.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -204,14 +200,6 @@ SOURCE=.\zend_ini_scanner.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_interfaces.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_iterators.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.c"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -260,10 +248,6 @@ SOURCE=.\zend_qsort.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_reflection_api.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_sprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -332,11 +316,11 @@ SOURCE=.\zend_errors.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_exceptions.h
|
||||
SOURCE=.\zend_execute.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_execute.h
|
||||
SOURCE=.\zend_execute_locks.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -380,18 +364,10 @@ SOURCE=.\zend_ini_scanner.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_interfaces.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_istdiostream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_iterators.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\zend_language_parser.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -440,10 +416,6 @@ SOURCE=.\zend_qsort.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_reflection_api.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_stack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -530,7 +502,7 @@ BuildCmds= \
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -601,7 +573,7 @@ BuildCmds= \
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
@@ -656,7 +628,7 @@ InputPath=.\zend_ini_scanner.l
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -703,7 +675,7 @@ InputPath=".\zend_language_scanner.l"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
+3
-5
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -37,8 +37,6 @@
|
||||
@BOTTOM@
|
||||
#endif
|
||||
|
||||
#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
@@ -68,6 +66,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#ifndef zend_isnan
|
||||
#ifdef HAVE_ISNAN
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(NAN)
|
||||
#define zend_isnan(a) (((a)==NAN)?1:0)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
#else
|
||||
@@ -96,8 +96,6 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
|
||||
#endif
|
||||
|
||||
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
+3
-8
@@ -440,17 +440,12 @@ YY_MALLOC_DECL
|
||||
#define ECHO /* There is no output */
|
||||
#endif
|
||||
|
||||
#ifdef ZEND_MULTIBYTE
|
||||
# define YY_INPUT(buf, result, max_size) \
|
||||
if ( ((result = zend_multibyte_yyinput(yyin, buf, max_size TSRMLS_CC)) == 0) \
|
||||
&& zend_stream_ferror( yyin TSRMLS_CC) ) \
|
||||
YY_FATAL_ERROR( "input in flex scanner failed" );
|
||||
#else
|
||||
# define YY_INPUT(buf, result, max_size) \
|
||||
#define YY_INPUT(buf, result, max_size) \
|
||||
if ( ((result = zend_stream_read(yyin, buf, max_size TSRMLS_CC)) == 0) \
|
||||
&& zend_stream_ferror( yyin TSRMLS_CC) ) \
|
||||
YY_FATAL_ERROR( "input in flex scanner failed" );
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef ECHO
|
||||
%- Standard (non-C++) definition
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #19859 (__call() does not catch call_user_func_array() calls)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class test
|
||||
{
|
||||
function __call($method,$args)
|
||||
{
|
||||
print "test::__call invoked for method '$method'\n";
|
||||
}
|
||||
}
|
||||
$x = new test;
|
||||
$x->fake(1);
|
||||
call_user_func_array(array($x,'fake'),array(1));
|
||||
call_user_func(array($x,'fake'),2);
|
||||
?>
|
||||
--EXPECT--
|
||||
test::__call invoked for method 'fake'
|
||||
test::__call invoked for method 'fake'
|
||||
test::__call invoked for method 'fake'
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #20240 (order of destructor calls)
|
||||
Bug #20240 order of destructor calls
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
|
||||
--FILE--
|
||||
@@ -7,7 +7,7 @@ Bug #20240 (order of destructor calls)
|
||||
|
||||
class test
|
||||
{
|
||||
public $member;
|
||||
var $member;
|
||||
|
||||
function test() {
|
||||
$this->member = 1;
|
||||
@@ -15,11 +15,7 @@ class test
|
||||
}
|
||||
|
||||
function destructor() {
|
||||
print __METHOD__ . "\n";
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
print __METHOD__ . "\n";
|
||||
print $this->member;
|
||||
}
|
||||
|
||||
function add() {
|
||||
@@ -39,5 +35,4 @@ echo "Done\n";
|
||||
2
|
||||
3
|
||||
Done
|
||||
test::destructor
|
||||
test::__destruct
|
||||
3
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #20242 (Method call in front of class definition)
|
||||
Bug #20242 Method call in front of class definition)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '>=')) die('skip ZendEngine 2 does not support this'); ?>
|
||||
--FILE--
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--TEST--
|
||||
Bug #21478 (Zend/zend_alloc.c :: shutdown_memory_manager produces segfault)
|
||||
Bug #21478 Zend/zend_alloc.c :: shutdown_memory_manager produces segfault
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed');
|
||||
if (!function_exists('stream_filter_register')) die('skip stream_filter_register() not available');
|
||||
if (!function_exists('stream_filter_register') die('skip stream_filter_register() not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -20,7 +20,7 @@ class debugfilter extends php_user_filter {
|
||||
|
||||
stream_filter_register("myfilter","debugfilter");
|
||||
|
||||
$fp = fopen(dirname(__FILE__)."/test.txt","w");
|
||||
$fp = fopen(dirname(__FILE__)."test.txt","w");
|
||||
stream_filter_append($fp, "myfilter");
|
||||
stream_filter_append($fp, "myfilter");
|
||||
stream_filter_append($fp, "myfilter");
|
||||
@@ -29,8 +29,7 @@ print "Done.\n";
|
||||
fclose($fp);
|
||||
// Uncommenting the following 'print' line causes the segfault to stop occuring
|
||||
// print "2\n";
|
||||
readfile(dirname(__FILE__)."/test.txt");
|
||||
unlink(dirname(__FILE__)."/test.txt");
|
||||
readfile(dirname(__FILE__)."test.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
Done.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #21888 (protected property and protected method of the same name)
|
||||
Bug #21888 protected property and protected method of the same name
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
bug #22725 (A derived class can call a parent's protected method that calls a private method)
|
||||
A derived class can call a parent's protected method that calls a private method
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
|
||||
--FILE--
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
Bug #22836 (returning references to NULL)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function &f()
|
||||
{
|
||||
$x = "foo";
|
||||
var_dump($x);
|
||||
print "'$x'\n";
|
||||
return ($a);
|
||||
}
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$h =& f();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Bug #23104 (Hash position not reset for constant arrays)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo($bar = array("a", "b", "c"))
|
||||
{
|
||||
var_dump(current($bar));
|
||||
}
|
||||
foo();
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "a"
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #24436 (isset()/empty() produce errors with non-existent variables in classes)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
|
||||
--INI--
|
||||
error_reporting=2047
|
||||
--FILE--
|
||||
<?php
|
||||
class test {
|
||||
function __construct() {
|
||||
if (empty($this->test[0][0])) { print "test1\n";}
|
||||
if (!isset($this->test[0][0])) { print "test2\n";}
|
||||
if (empty($this->test)) { print "test1\n";}
|
||||
if (!isset($this->test)) { print "test2\n";}
|
||||
}
|
||||
}
|
||||
|
||||
$test1 = new test();
|
||||
?>
|
||||
--EXPECT--
|
||||
test1
|
||||
test2
|
||||
test1
|
||||
test2
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #24635 (crash on dtor calling other functions)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class SiteClass {
|
||||
function __construct() { $this->page = new PageClass(); }
|
||||
}
|
||||
class PageClass {
|
||||
function Display() {
|
||||
$section = new SectionClass("PageClass::Display");
|
||||
}
|
||||
}
|
||||
class SectionClass {
|
||||
function __construct($comment) {
|
||||
$this->Comment = $comment;
|
||||
}
|
||||
function __destruct() {
|
||||
out($this->Comment); // this line doesn't crash PHP
|
||||
out("\n<!-- End Section: " . $this->Comment . "-->"); // this line
|
||||
}
|
||||
}
|
||||
function out($code) { return; }
|
||||
$site = new SiteClass();
|
||||
$site->page->Display();
|
||||
echo "OK\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #24699 (Memory Leak with per-class constants)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class TEST { const FOO = SEEK_CUR; };
|
||||
class TEST2 { const FOO = 1; };
|
||||
class TEST3 { const FOO = PHP_VERSION; };
|
||||
print TEST::FOO."\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
1
|
||||
@@ -1,9 +0,0 @@
|
||||
--TEST--
|
||||
Bug #24773 (unset() of integers treated as arrays causes a crash)
|
||||
--FILE--
|
||||
<?php
|
||||
$array = 'test';
|
||||
unset($array["lvl1"]["lvl2"]["b"]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot unset string offsets in %s on line %d
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Bug #24884 (calling $this->__clone(); crashes php)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
function __copy()
|
||||
{
|
||||
$string = PHP_VERSION;
|
||||
$version = $string{0};
|
||||
if($string < 5)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
else
|
||||
{
|
||||
return clone $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
$test = new Test();
|
||||
$test2 = $test->__copy();
|
||||
var_dump($test2);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#2 (0) {
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26010 (private / protected variables get exposed by get_object_vars())
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
private $private = 'private';
|
||||
protected $protected = 'protected';
|
||||
public $public = 'public';
|
||||
}
|
||||
$data = new foo();
|
||||
$obj_vars = get_object_vars($data);
|
||||
var_dump($obj_vars);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["public"]=>
|
||||
string(6) "public"
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26077 Memory leaks when creating an instance of an object
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {} new foo();
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1,67 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26166 (__toString() crash when no values returned)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
function __toString()
|
||||
{
|
||||
return "Hello World!\n";
|
||||
}
|
||||
}
|
||||
|
||||
class Bar
|
||||
{
|
||||
private $obj;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->obj = new Foo();
|
||||
}
|
||||
|
||||
function __toString()
|
||||
{
|
||||
return $this->obj->__toString();
|
||||
}
|
||||
}
|
||||
|
||||
$o = new Bar;
|
||||
echo $o;
|
||||
|
||||
echo "===THROW===\n";
|
||||
|
||||
class Error
|
||||
{
|
||||
function __toString() {
|
||||
throw new Exception("This is an error!");
|
||||
}
|
||||
}
|
||||
|
||||
$o = new Error;
|
||||
try {
|
||||
echo $o;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo "Got the exception\n";
|
||||
}
|
||||
|
||||
echo "===NONE===\n";
|
||||
|
||||
class None
|
||||
{
|
||||
function __toString() {
|
||||
}
|
||||
}
|
||||
|
||||
$o = new None;
|
||||
echo $o;
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Hello World!
|
||||
===THROW===
|
||||
Got the exception
|
||||
===NONE===
|
||||
|
||||
Fatal error: Method None::__toString() must return a string value in %sbug26166.php on line %d
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26229 (getIterator() segfaults when it returns arrays or scalars)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class array_iterator implements IteratorAggregate {
|
||||
public function getIterator() {
|
||||
return array('foo', 'bar');
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new array_iterator;
|
||||
|
||||
foreach ($obj as $property => $value) {
|
||||
var_dump($value);
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator in %sbug26229.php on line %d
|
||||
===DONE===
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26281 (switch() crash when condition is a string offset)
|
||||
--FILE--
|
||||
<?php
|
||||
$x = 'abc';
|
||||
switch ($x{0}) {
|
||||
case 'a':
|
||||
echo "no crash\n";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
no crash
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26696 (crash in switch() when string index is used)
|
||||
--FILE--
|
||||
<?php
|
||||
$str = 'asdd/?';
|
||||
$len = strlen($str);
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
switch ($str[$i]) {
|
||||
case '?':
|
||||
echo "?+\n";
|
||||
break;
|
||||
default:
|
||||
echo $str[$i].'-';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
a-s-d-d-/-?+
|
||||
===DONE===
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault)
|
||||
--SKIPIF--
|
||||
<?php if (function_exists('__autoload')) die('skip __autoload() declared in auto_prepend_file');?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($name)
|
||||
{
|
||||
echo __METHOD__ . "($name)\n";
|
||||
var_dump(class_exists('NotExistingClass'));
|
||||
echo __METHOD__ . "($name), done\n";
|
||||
}
|
||||
|
||||
var_dump(class_exists('NotExistingClass'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
__autoload(NotExistingClass)
|
||||
bool(false)
|
||||
__autoload(NotExistingClass), done
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -1,73 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26698 (Thrown exceptions while evaluting argument to pass as parameter crash PHP)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
ini_set("report_memleaks", 0); // the exception thrown in this test results in a memory leak, which is fine
|
||||
|
||||
class Object
|
||||
{
|
||||
function getNone()
|
||||
{
|
||||
throw new Exception('NONE');
|
||||
}
|
||||
}
|
||||
|
||||
class Proxy
|
||||
{
|
||||
function three($a, $b, $c)
|
||||
{
|
||||
}
|
||||
|
||||
function callOne()
|
||||
{
|
||||
try
|
||||
{
|
||||
$res = new Object();
|
||||
$this->three($res->getNone());
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
echo 'Caught: '.$e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
|
||||
function callTwo()
|
||||
{
|
||||
try
|
||||
{
|
||||
$res = new Object();
|
||||
$this->three(1, $res->getNone());
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
echo 'Caught: '.$e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
|
||||
function callThree()
|
||||
{
|
||||
try
|
||||
{
|
||||
$res = new Object();
|
||||
$this->three(1, 2, $res->getNone());
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
echo 'Caught: '.$e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$p = new Proxy();
|
||||
|
||||
$p->callOne();
|
||||
$p->callTwo();
|
||||
$p->callThree();
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
Caught: NONE
|
||||
Caught: NONE
|
||||
Caught: NONE
|
||||
===DONE===
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26801 (switch ($a{0}) crash)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = '11';
|
||||
$b = $a{0};
|
||||
switch ($b) {
|
||||
case '-':
|
||||
break;
|
||||
}
|
||||
|
||||
$a = '22';
|
||||
switch ($a{0}) {
|
||||
case '-':
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26802 (Can't call static method using a variable)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function global_func()
|
||||
{
|
||||
echo __METHOD__ . "\n";
|
||||
}
|
||||
|
||||
$function = 'global_func';
|
||||
$function();
|
||||
|
||||
class foo
|
||||
{
|
||||
static $method = 'global_func';
|
||||
|
||||
static public function foo_func()
|
||||
{
|
||||
echo __METHOD__ . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
/* The following is a BC break with PHP 4 where it would
|
||||
* call foo::fail. In PHP 5 we first evaluate static class
|
||||
* properties and then do the function call.
|
||||
*/
|
||||
$method = 'foo_func';
|
||||
foo::$method();
|
||||
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
global_func
|
||||
foo::foo_func
|
||||
===DONE===
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27145 (Errors messages print unmangled PPP property names)
|
||||
--FILE--
|
||||
<?php
|
||||
class a {
|
||||
protected static $v = "aa";
|
||||
}
|
||||
class b extends a {
|
||||
protected static $v = "bb";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot redeclare property static protected a::$v in class b in %s on line %d
|
||||
@@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27641 (zend.ze1_compatibility_mode = On causes object properties to be misreported)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public $a = "Default for A";
|
||||
public $b = "Default for B";
|
||||
|
||||
function __construct($a, $b) {
|
||||
$this->a = $a;
|
||||
$this->b = $b;
|
||||
}
|
||||
function A() {
|
||||
$args = func_get_args();
|
||||
call_user_func_array(Array(&$this, '__construct'), $args);
|
||||
}
|
||||
}
|
||||
|
||||
$t = new A("New A", "New B");
|
||||
print_r($t);
|
||||
print_r(get_class_vars(get_class($t)));
|
||||
print_r(get_object_vars($t));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Redefining already defined constructor for class A in %sbug27641.php on line %d
|
||||
A Object
|
||||
(
|
||||
[a] => New A
|
||||
[b] => New B
|
||||
)
|
||||
Array
|
||||
(
|
||||
[a] => Default for A
|
||||
[b] => Default for B
|
||||
)
|
||||
Array
|
||||
(
|
||||
[a] => New A
|
||||
[b] => New B
|
||||
)
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27731 (error_reporing() call inside @ block does not work correctly)
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
@error_reporting(E_WARNING);
|
||||
var_dump(error_reporting());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Bug #29505 (get_class_vars() severely broken when used with arrays)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public $empty = array();
|
||||
public $three = array(1, "b"=>"c", 3=>array());
|
||||
}
|
||||
|
||||
var_dump(get_class_vars('Test'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["empty"]=>
|
||||
array(0) {
|
||||
}
|
||||
["three"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["b"]=>
|
||||
string(1) "c"
|
||||
[3]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Scoping in destructor call
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class T
|
||||
{
|
||||
private $var = array();
|
||||
|
||||
public function add($a)
|
||||
{
|
||||
array_push($this->var, $a);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
print_r($this->var);
|
||||
}
|
||||
}
|
||||
|
||||
class TT extends T
|
||||
{
|
||||
}
|
||||
$t = new TT();
|
||||
$t->add("Hello");
|
||||
$t->add("World");
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => Hello
|
||||
[1] => World
|
||||
)
|
||||
File renamed without changes.
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Operator precedence
|
||||
--FILE--
|
||||
<?php /* $Id$ */
|
||||
|
||||
var_dump((object)1 instanceof stdClass);
|
||||
var_dump(! (object)1 instanceof Exception);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
+88
-123
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "zend_constants.h"
|
||||
#include "zend_list.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "zend_default_classes.h"
|
||||
#include "zend_builtin_functions.h"
|
||||
#include "zend_ini.h"
|
||||
|
||||
@@ -54,7 +54,6 @@ ZEND_API void (*zend_block_interruptions)(void);
|
||||
ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
||||
|
||||
void (*zend_on_timeout)(int seconds TSRMLS_DC);
|
||||
|
||||
@@ -65,7 +64,7 @@ static int (*zend_get_configuration_directive_p)(char *name, uint name_length, z
|
||||
static ZEND_INI_MH(OnUpdateErrorReporting)
|
||||
{
|
||||
if (!new_value) {
|
||||
EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT;
|
||||
EG(error_reporting) = E_ALL & ~E_NOTICE;
|
||||
} else {
|
||||
EG(error_reporting) = atoi(new_value);
|
||||
}
|
||||
@@ -73,9 +72,20 @@ static ZEND_INI_MH(OnUpdateErrorReporting)
|
||||
}
|
||||
|
||||
|
||||
static ZEND_INI_MH(OnUpdateImplicitClone)
|
||||
{
|
||||
if (!new_value) {
|
||||
EG(implicit_clone) = 0;
|
||||
} else {
|
||||
EG(implicit_clone) = atoi(new_value) ? 1 : 0;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_INI_BEGIN()
|
||||
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
|
||||
STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode", "0", ZEND_INI_ALL, OnUpdateBool, ze1_compatibility_mode, zend_executor_globals, executor_globals)
|
||||
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
|
||||
ZEND_INI_ENTRY("zend2.implicit_clone", NULL, ZEND_INI_ALL, OnUpdateImplicitClone)
|
||||
ZEND_INI_END()
|
||||
|
||||
|
||||
@@ -97,7 +107,7 @@ ZEND_API zval zval_used_for_init; /* True global variable */
|
||||
/* version information */
|
||||
static char *zend_version_info;
|
||||
static uint zend_version_info_length;
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2004 Zend Technologies\n"
|
||||
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2003 Zend Technologies\n"
|
||||
|
||||
|
||||
#define PRINT_ZVAL_INDENT 4
|
||||
@@ -127,7 +137,7 @@ static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC)
|
||||
if (is_object) {
|
||||
char *prop_name, *class_name;
|
||||
|
||||
zend_unmangle_property_name(string_key, &class_name, &prop_name);
|
||||
unmangle_property_name(string_key, &class_name, &prop_name);
|
||||
ZEND_PUTS(prop_name);
|
||||
if (class_name) {
|
||||
if (class_name[0]=='*') {
|
||||
@@ -137,7 +147,7 @@ static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ZEND_WRITE(string_key, str_len-1);
|
||||
ZEND_PUTS(string_key);
|
||||
}
|
||||
break;
|
||||
case HASH_KEY_IS_LONG:
|
||||
@@ -214,40 +224,18 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
||||
expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
{
|
||||
if (expr->value.obj.handlers->cast_object) {
|
||||
TSRMLS_FETCH();
|
||||
#if 0
|
||||
/* Standard PHP objects */
|
||||
if (Z_OBJ_HT_P(expr) == &std_object_handlers || !Z_OBJ_HT_P(expr)->cast_object) {
|
||||
if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
||||
break;
|
||||
}
|
||||
zend_error(E_NOTICE, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name);
|
||||
}
|
||||
#endif
|
||||
if (Z_OBJ_HANDLER_P(expr, cast_object)) {
|
||||
if(Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(Z_OBJ_HANDLER_P(expr, get)) {
|
||||
zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);
|
||||
if(Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zend_make_printable_zval(z, expr_copy, use_copy);
|
||||
FREE_ZVAL(z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (EG(exception)) {
|
||||
zval_dtor(expr_copy);
|
||||
expr_copy->value.str.len = 0;
|
||||
expr_copy->value.str.val = empty_string;
|
||||
break;
|
||||
}
|
||||
expr->value.obj.handlers->cast_object(expr, expr_copy, IS_STRING, 0 TSRMLS_CC);
|
||||
} else {
|
||||
expr_copy->value.str.val = (char *) emalloc(sizeof("Object id #")-1 + MAX_LENGTH_OF_LONG);
|
||||
expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Object id #%ld", (long)expr->value.obj.handle);
|
||||
}
|
||||
expr_copy->value.str.val = (char *) emalloc(sizeof("Object id #")-1 + MAX_LENGTH_OF_LONG);
|
||||
expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Object id #%ld", (long)expr->value.obj.handle);
|
||||
#if 0
|
||||
/* FIXME: This might break BC for some people */
|
||||
expr_copy->value.str.len = sizeof("Object")-1;
|
||||
expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);
|
||||
#endif
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
*expr_copy = *expr;
|
||||
@@ -317,7 +305,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC)
|
||||
Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
|
||||
}
|
||||
zend_printf("%s Object (", class_name?class_name:"Unknown Class");
|
||||
if (class_name) {
|
||||
if(class_name) {
|
||||
efree(class_name);
|
||||
}
|
||||
if (Z_OBJ_HANDLER_P(expr, get_properties)) {
|
||||
@@ -370,7 +358,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
|
||||
Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
|
||||
}
|
||||
zend_printf("%s Object\n", class_name?class_name:"Unknown Class");
|
||||
if (class_name) {
|
||||
if(class_name) {
|
||||
efree(class_name);
|
||||
}
|
||||
if (Z_OBJ_HANDLER_P(expr, get_properties)) {
|
||||
@@ -405,16 +393,23 @@ static FILE *zend_fopen_wrapper(const char *filename, char **opened_path)
|
||||
|
||||
static void register_standard_class(TSRMLS_D)
|
||||
{
|
||||
zend_standard_class_def = calloc(1, sizeof(zend_class_entry));
|
||||
zend_standard_class_def = malloc(sizeof(zend_class_entry));
|
||||
|
||||
zend_standard_class_def->type = ZEND_INTERNAL_CLASS;
|
||||
zend_standard_class_def->name_length = sizeof("stdClass") - 1;
|
||||
zend_standard_class_def->name = zend_strndup("stdClass", zend_standard_class_def->name_length);
|
||||
zend_initialize_class_data(zend_standard_class_def, 1 TSRMLS_CC);
|
||||
|
||||
zend_hash_add(CG(class_table), "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry *), NULL);
|
||||
zend_hash_add(GLOBAL_CLASS_TABLE, "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry *), NULL);
|
||||
}
|
||||
|
||||
#ifdef ZTS
|
||||
static void unregister_standard_class()
|
||||
{
|
||||
destroy_zend_class(&zend_standard_class_def);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void zend_set_default_compile_time_values(TSRMLS_D)
|
||||
{
|
||||
/* default compile-time values */
|
||||
@@ -429,7 +424,7 @@ static void zend_set_default_compile_time_values(TSRMLS_D)
|
||||
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC)
|
||||
{
|
||||
zend_function tmp_func;
|
||||
zend_class_entry *tmp_class;
|
||||
zend_class_entry tmp_class;
|
||||
|
||||
compiler_globals->compiled_filename = NULL;
|
||||
|
||||
@@ -439,7 +434,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
|
||||
|
||||
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
|
||||
zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *));
|
||||
zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
|
||||
|
||||
zend_set_default_compile_time_values(TSRMLS_C);
|
||||
|
||||
@@ -455,13 +450,11 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS
|
||||
{
|
||||
if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
|
||||
zend_hash_destroy(compiler_globals->function_table);
|
||||
free(compiler_globals->function_table);
|
||||
}
|
||||
if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) {
|
||||
zend_hash_destroy(compiler_globals->class_table);
|
||||
free(compiler_globals->class_table);
|
||||
}
|
||||
if (compiler_globals->auto_globals != GLOBAL_AUTO_GLOBALS_TABLE) {
|
||||
if (compiler_globals->auto_globals != global_auto_globals_table) {
|
||||
zend_hash_destroy(compiler_globals->auto_globals);
|
||||
free(compiler_globals->auto_globals);
|
||||
}
|
||||
@@ -477,9 +470,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
|
||||
EG(user_error_handler) = NULL;
|
||||
EG(user_exception_handler) = NULL;
|
||||
EG(in_execution) = 0;
|
||||
EG(in_autoload) = NULL;
|
||||
EG(current_execute_data) = NULL;
|
||||
EG(current_module) = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -512,8 +503,8 @@ static void alloc_globals_dtor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
/* FreeBSD and DragonFly floating point precision fix */
|
||||
#ifdef __FreeBSD__
|
||||
/* FreeBSD floating point precision fix */
|
||||
#include <floatingpoint.h>
|
||||
#endif
|
||||
|
||||
@@ -541,6 +532,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
zend_compiler_globals *compiler_globals;
|
||||
zend_executor_globals *executor_globals;
|
||||
void ***tsrm_ls;
|
||||
#ifdef ZTS
|
||||
extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
|
||||
extern ZEND_API ts_rsrc_id language_scanner_globals_id;
|
||||
#else
|
||||
@@ -548,14 +540,13 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
extern zend_scanner_globals language_scanner_globals;
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
|
||||
#else
|
||||
alloc_globals_ctor(&alloc_globals TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
/* FreeBSD and DragonFly floating point precision fix */
|
||||
#ifdef __FreeBSD__
|
||||
/* FreeBSD floating point precision fix */
|
||||
fpsetmask(0);
|
||||
#endif
|
||||
|
||||
@@ -576,12 +567,10 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
|
||||
zend_ticks_function = utility_functions->ticks_function;
|
||||
zend_on_timeout = utility_functions->on_timeout;
|
||||
zend_vspprintf = utility_functions->vspprintf_function;
|
||||
|
||||
zend_compile_file = compile_file;
|
||||
zend_execute = execute;
|
||||
zend_execute_internal = NULL;
|
||||
zend_throw_exception_hook = NULL;
|
||||
|
||||
zend_init_opcodes_handlers();
|
||||
|
||||
@@ -618,11 +607,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
executor_globals = ts_resource(executor_globals_id);
|
||||
tsrm_ls = ts_resource_ex(0, NULL);
|
||||
|
||||
compiler_globals_dtor(compiler_globals TSRMLS_CC);
|
||||
compiler_globals->in_compilation = 0;
|
||||
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
|
||||
|
||||
compiler_globals_dtor(compiler_globals, tsrm_ls);
|
||||
*compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE;
|
||||
*compiler_globals->class_table = *GLOBAL_CLASS_TABLE;
|
||||
compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
|
||||
@@ -649,6 +634,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
if (start_builtin_functions) {
|
||||
zend_startup_builtin_functions(TSRMLS_C);
|
||||
}
|
||||
zend_register_default_classes(TSRMLS_C);
|
||||
|
||||
zend_ini_startup(TSRMLS_C);
|
||||
|
||||
@@ -681,12 +667,8 @@ void zend_post_startup(TSRMLS_D)
|
||||
*GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
|
||||
*GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
free(compiler_globals->function_table);
|
||||
free(compiler_globals->class_table);
|
||||
compiler_globals_ctor(compiler_globals, tsrm_ls);
|
||||
free(EG(zend_constants));
|
||||
executor_globals_ctor(executor_globals, tsrm_ls);
|
||||
zend_new_thread_end_handler(tsrm_thread_id() TSRMLS_CC);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -700,6 +682,7 @@ void zend_shutdown(TSRMLS_D)
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
#endif
|
||||
zend_hash_graceful_reverse_destroy(&module_registry);
|
||||
zend_destroy_rsrc_list_dtors();
|
||||
|
||||
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
|
||||
zend_hash_destroy(GLOBAL_CLASS_TABLE);
|
||||
@@ -710,17 +693,10 @@ void zend_shutdown(TSRMLS_D)
|
||||
free(zend_version_info);
|
||||
|
||||
zend_shutdown_constants(TSRMLS_C);
|
||||
free(GLOBAL_FUNCTION_TABLE);
|
||||
free(GLOBAL_CLASS_TABLE);
|
||||
#ifdef ZTS
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
|
||||
free(GLOBAL_CONSTANTS_TABLE);
|
||||
GLOBAL_FUNCTION_TABLE = NULL;
|
||||
GLOBAL_CLASS_TABLE = NULL;
|
||||
GLOBAL_AUTO_GLOBALS_TABLE = NULL;
|
||||
unregister_standard_class();
|
||||
#endif
|
||||
zend_destroy_rsrc_list_dtors();
|
||||
}
|
||||
|
||||
|
||||
@@ -734,7 +710,7 @@ void zend_set_utility_values(zend_utility_values *utility_values)
|
||||
/* this should be compatible with the standard zenderror */
|
||||
void zenderror(char *error)
|
||||
{
|
||||
zend_error(E_PARSE, "%s", error);
|
||||
zend_error(E_PARSE, error);
|
||||
}
|
||||
|
||||
|
||||
@@ -828,21 +804,6 @@ void zend_deactivate(TSRMLS_D)
|
||||
}
|
||||
|
||||
|
||||
static int exec_done_cb(zend_module_entry *module TSRMLS_DC)
|
||||
{
|
||||
if (module->post_deactivate_func) {
|
||||
module->post_deactivate_func();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void zend_post_deactivate_modules(TSRMLS_D)
|
||||
{
|
||||
zend_hash_apply(&module_registry, (apply_func_t) exec_done_cb TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_message_dispatcher(long message, void *data)
|
||||
{
|
||||
@@ -863,6 +824,8 @@ ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval
|
||||
}
|
||||
|
||||
|
||||
#define ZEND_ERROR_BUFFER_SIZE 1024
|
||||
|
||||
ZEND_API void zend_error(int type, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -872,8 +835,6 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
char *error_filename;
|
||||
uint error_lineno;
|
||||
zval *orig_user_error_handler;
|
||||
zval *orig_garbage[2];
|
||||
int orig_garbage_ptr;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* Obtain relevant filename and lineno */
|
||||
@@ -888,7 +849,6 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
case E_COMPILE_WARNING:
|
||||
case E_ERROR:
|
||||
case E_NOTICE:
|
||||
case E_STRICT:
|
||||
case E_WARNING:
|
||||
case E_USER_ERROR:
|
||||
case E_USER_WARNING:
|
||||
@@ -913,11 +873,11 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
error_filename = "Unknown";
|
||||
}
|
||||
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
/* if we don't have a user defined error handler */
|
||||
if (!EG(user_error_handler)
|
||||
|| !(EG(user_error_handler_error_reporting) & type)) {
|
||||
if (!EG(user_error_handler)) {
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
} else switch (type) {
|
||||
case E_ERROR:
|
||||
@@ -936,8 +896,22 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
ALLOC_INIT_ZVAL(z_error_filename);
|
||||
ALLOC_INIT_ZVAL(z_error_lineno);
|
||||
ALLOC_INIT_ZVAL(z_context);
|
||||
z_error_message->value.str.val = (char *) emalloc(ZEND_ERROR_BUFFER_SIZE);
|
||||
|
||||
z_error_message->value.str.len = zend_vspprintf(&z_error_message->value.str.val, 0, format, args);
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
vsnprintf(z_error_message->value.str.val, ZEND_ERROR_BUFFER_SIZE, format, args);
|
||||
/* this MUST be revisited, but for now handle ALL implementation
|
||||
* out there correct. Since this is inside an error handler the
|
||||
* performance loss by strlne is irrelevant. */
|
||||
z_error_message->value.str.val[ZEND_ERROR_BUFFER_SIZE - 1] = '\0';
|
||||
z_error_message->value.str.len = strlen(z_error_message->value.str.val);
|
||||
#else
|
||||
strncpy(z_error_message->value.str.val, format, ZEND_ERROR_BUFFER_SIZE);
|
||||
z_error_message->value.str.val[ZEND_ERROR_BUFFER_SIZE - 1] = '\0';
|
||||
z_error_message->value.str.len = strlen(z_error_message->value.str.val);
|
||||
/* This is risky... */
|
||||
/* z_error_message->value.str.len = vsprintf(z_error_message->value.str.val, format, args); */
|
||||
#endif
|
||||
z_error_message->type = IS_STRING;
|
||||
|
||||
z_error_type->value.lval = type;
|
||||
@@ -954,7 +928,8 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
|
||||
z_context->value.ht = EG(active_symbol_table);
|
||||
z_context->type = IS_ARRAY;
|
||||
ZVAL_ADDREF(z_context); /* we don't want this one to be freed */
|
||||
z_context->is_ref = 1;
|
||||
z_context->refcount = 2; /* we don't want this one to be freed */
|
||||
|
||||
params = (zval ***) emalloc(sizeof(zval **)*5);
|
||||
params[0] = &z_error_type;
|
||||
@@ -965,33 +940,14 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
|
||||
orig_user_error_handler = EG(user_error_handler);
|
||||
EG(user_error_handler) = NULL;
|
||||
|
||||
orig_garbage_ptr = EG(garbage_ptr);
|
||||
EG(garbage_ptr) = 0;
|
||||
if (orig_garbage_ptr > 0) {
|
||||
memcpy(&orig_garbage, &EG(garbage), sizeof(zval*)*orig_garbage_ptr);
|
||||
}
|
||||
|
||||
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC)==SUCCESS) {
|
||||
if (retval) {
|
||||
if (Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) {
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
}
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
} else {
|
||||
/* The user error handler failed, use built-in error handler */
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
}
|
||||
|
||||
if (orig_garbage_ptr > 0) {
|
||||
while (EG(garbage_ptr)) {
|
||||
zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);
|
||||
}
|
||||
EG(garbage_ptr) = orig_garbage_ptr;
|
||||
memcpy(&EG(garbage), &orig_garbage, sizeof(zval*)*orig_garbage_ptr);
|
||||
}
|
||||
|
||||
EG(user_error_handler) = orig_user_error_handler;
|
||||
|
||||
efree(params);
|
||||
@@ -1061,12 +1017,13 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
|
||||
zend_execute(EG(active_op_array) TSRMLS_CC);
|
||||
if (EG(exception)) {
|
||||
char ex_class_name[128];
|
||||
if (Z_TYPE_P(EG(exception)) == IS_OBJECT) {
|
||||
if(Z_TYPE_P(EG(exception)) == IS_OBJECT) {
|
||||
strncpy(ex_class_name, Z_OBJ_CLASS_NAME_P(EG(exception)), 127);
|
||||
ex_class_name[127] = '\0';
|
||||
} else {
|
||||
strcpy(ex_class_name, "Unknown Exception");
|
||||
}
|
||||
#if 1 /* support set_exception_handler() */
|
||||
if (EG(user_exception_handler)) {
|
||||
zval *orig_user_exception_handler;
|
||||
zval ***params, *retval2, *old_exception;
|
||||
@@ -1080,22 +1037,30 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
|
||||
zval_ptr_dtor(&retval2);
|
||||
}
|
||||
} else {
|
||||
zend_exception_error(EG(exception) TSRMLS_CC);
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
EG(exception) = NULL;
|
||||
zend_error(E_ERROR, "Uncaught exception '%s'!", ex_class_name);
|
||||
}
|
||||
efree(params);
|
||||
zval_ptr_dtor(&old_exception);
|
||||
if (EG(exception)) {
|
||||
if(EG(exception)) {
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
EG(exception) = NULL;
|
||||
}
|
||||
} else {
|
||||
zend_exception_error(EG(exception) TSRMLS_CC);
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
EG(exception) = NULL;
|
||||
zend_error(E_ERROR, "Uncaught exception '%s'!", ex_class_name);
|
||||
}
|
||||
if (retval == NULL && *EG(return_value_ptr_ptr) != NULL) {
|
||||
zval_ptr_dtor(EG(return_value_ptr_ptr));
|
||||
local_retval = NULL;
|
||||
}
|
||||
} else if (!retval && *EG(return_value_ptr_ptr)) {
|
||||
#else
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
zend_error(E_ERROR, "Uncaught exception '%s'!", ex_class_name);
|
||||
#endif
|
||||
} else if (!retval) {
|
||||
zval_ptr_dtor(EG(return_value_ptr_ptr));
|
||||
local_retval = NULL;
|
||||
}
|
||||
|
||||
+58
-70
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "2.0.1"
|
||||
#define ZEND_VERSION "2.0.0-dev"
|
||||
|
||||
#define ZEND_ENGINE_2
|
||||
|
||||
@@ -91,7 +91,7 @@ const char *zend_mh_bundle_error(void);
|
||||
|
||||
#endif /* HAVE_MACH_O_DYLD_H */
|
||||
|
||||
#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H)
|
||||
#if defined(HAVE_LIBDL)
|
||||
|
||||
# ifndef RTLD_LAZY
|
||||
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
|
||||
@@ -101,11 +101,7 @@ const char *zend_mh_bundle_error(void);
|
||||
# define RTLD_GLOBAL 0
|
||||
# endif
|
||||
|
||||
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
|
||||
# else
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
|
||||
# endif
|
||||
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
|
||||
# define DL_UNLOAD dlclose
|
||||
# if defined(DLSYM_NEEDS_UNDERSCORE)
|
||||
# define DL_FETCH_SYMBOL(h,s) dlsym((h), "_" s)
|
||||
@@ -141,7 +137,7 @@ const char *zend_mh_bundle_error(void);
|
||||
#ifndef __GNUC__
|
||||
# ifndef HAVE_ALLOCA_H
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||
char *alloca ();
|
||||
@@ -150,33 +146,7 @@ char *alloca ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* GCC x.y.z supplies __GNUC__ = x and __GNUC_MINOR__ = y */
|
||||
#ifdef __GNUC__
|
||||
# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
||||
#else
|
||||
# define ZEND_GCC_VERSION 0
|
||||
#endif
|
||||
|
||||
#if ZEND_GCC_VERSION >= 2096
|
||||
# define ZEND_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
|
||||
#else
|
||||
# define ZEND_ATTRIBUTE_MALLOC
|
||||
#endif
|
||||
|
||||
#if ZEND_GCC_VERSION >= 2007
|
||||
# define ZEND_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
|
||||
#else
|
||||
# define ZEND_ATTRIBUTE_FORMAT(type, idx, first)
|
||||
#endif
|
||||
|
||||
#if ZEND_GCC_VERSION >= 3001
|
||||
# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
|
||||
#else
|
||||
# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first)
|
||||
#endif
|
||||
|
||||
|
||||
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(__darwin__) && !defined(__APPLE__)
|
||||
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE))
|
||||
# define do_alloca(p) alloca(p)
|
||||
# define free_alloca(p)
|
||||
#else
|
||||
@@ -258,8 +228,8 @@ typedef struct _zend_class_entry zend_class_entry;
|
||||
typedef struct _zend_object {
|
||||
zend_class_entry *ce;
|
||||
HashTable *properties;
|
||||
unsigned int in_get:1;
|
||||
unsigned int in_set:1;
|
||||
int in_get:1;
|
||||
int in_set:1;
|
||||
} zend_object;
|
||||
|
||||
typedef unsigned int zend_object_handle;
|
||||
@@ -292,6 +262,27 @@ struct _zval_struct {
|
||||
zend_uchar is_ref;
|
||||
};
|
||||
|
||||
struct _zend_op_array;
|
||||
|
||||
typedef struct _zend_function_entry {
|
||||
char *fname;
|
||||
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
|
||||
unsigned char *func_arg_types;
|
||||
} zend_function_entry;
|
||||
|
||||
|
||||
typedef struct _zend_property_reference {
|
||||
int type; /* read, write or r/w */
|
||||
zval *object;
|
||||
zend_llist *elements_list;
|
||||
} zend_property_reference;
|
||||
|
||||
|
||||
|
||||
typedef struct _zend_overloaded_element {
|
||||
int type; /* array offset or object proprety */
|
||||
zval element;
|
||||
} zend_overloaded_element;
|
||||
|
||||
/* excpt.h on Digital Unix 4.0 defines function_table */
|
||||
#undef function_table
|
||||
@@ -299,7 +290,7 @@ struct _zval_struct {
|
||||
/* A lot of stuff needs shifiting around in order to include zend_compile.h here */
|
||||
union _zend_function;
|
||||
|
||||
#include "zend_iterators.h"
|
||||
#define ZEND_CE_ABSTRACT ZEND_ACC_ABSTRACT /* same as ZEND_ACC_ABSTRACT */
|
||||
|
||||
struct _zend_class_entry {
|
||||
char type;
|
||||
@@ -313,9 +304,10 @@ struct _zend_class_entry {
|
||||
HashTable function_table;
|
||||
HashTable default_properties;
|
||||
HashTable properties_info;
|
||||
HashTable class_table;
|
||||
HashTable *static_members;
|
||||
HashTable constants_table;
|
||||
struct _zend_function_entry *builtin_functions;
|
||||
zend_function_entry *builtin_functions;
|
||||
|
||||
union _zend_function *constructor;
|
||||
union _zend_function *destructor;
|
||||
@@ -324,12 +316,9 @@ struct _zend_class_entry {
|
||||
union _zend_function *__set;
|
||||
union _zend_function *__call;
|
||||
|
||||
zend_class_iterator_funcs iterator_funcs;
|
||||
|
||||
|
||||
/* handlers */
|
||||
zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
|
||||
zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object TSRMLS_DC);
|
||||
int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */
|
||||
|
||||
zend_class_entry **interfaces;
|
||||
zend_uint num_interfaces;
|
||||
@@ -339,14 +328,19 @@ struct _zend_class_entry {
|
||||
zend_uint line_end;
|
||||
char *doc_comment;
|
||||
zend_uint doc_comment_len;
|
||||
|
||||
struct _zend_module_entry *module;
|
||||
|
||||
/* old handlers */
|
||||
#if 0
|
||||
void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
|
||||
zval (*handle_property_get)(zend_property_reference *property_reference);
|
||||
int (*handle_property_set)(zend_property_reference *property_reference, zval *value);
|
||||
#endif
|
||||
};
|
||||
|
||||
#include "zend_stream.h"
|
||||
typedef struct _zend_utility_functions {
|
||||
void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
||||
void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
int (*printf_function)(const char *format, ...);
|
||||
int (*write_function)(const char *str, uint str_length);
|
||||
FILE *(*fopen_function)(const char *filename, char **opened_path);
|
||||
void (*message_handler)(long message, void *data);
|
||||
@@ -356,7 +350,6 @@ typedef struct _zend_utility_functions {
|
||||
void (*ticks_function)(int ticks);
|
||||
void (*on_timeout)(int seconds TSRMLS_DC);
|
||||
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
||||
} zend_utility_functions;
|
||||
|
||||
|
||||
@@ -375,12 +368,9 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
#define MAX(a, b) (((a)>(b))?(a):(b))
|
||||
#define MIN(a, b) (((a)<(b))?(a):(b))
|
||||
#define ZEND_STRL(str) (str), (sizeof(str)-1)
|
||||
#define ZEND_STRS(str) (str), (sizeof(str)-1)
|
||||
#define ZEND_STRS(str) (str), (sizeof(str))
|
||||
#define ZEND_NORMALIZE_BOOL(n) \
|
||||
((n) ? (((n)>0) ? 1 : -1) : 0)
|
||||
#define ZEND_TRUTH(x) ((x) ? 1 : 0)
|
||||
#define ZEND_LOG_XOR(a, b) (ZEND_TRUTH(a) ^ ZEND_TRUTH(b))
|
||||
|
||||
|
||||
|
||||
/* data types */
|
||||
@@ -395,6 +385,9 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
#define IS_CONSTANT 8
|
||||
#define IS_CONSTANT_ARRAY 9
|
||||
|
||||
/* Special data type to temporarily mark large numbers */
|
||||
#define FLAG_IS_BC 10 /* for parser internal use only */
|
||||
|
||||
/* Ugly hack to support constants as static array indices */
|
||||
#define IS_CONSTANT_INDEX 0x80
|
||||
|
||||
@@ -405,6 +398,12 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
#define OE_IS_METHOD (1<<2)
|
||||
|
||||
|
||||
/* Argument passing types */
|
||||
#define BYREF_NONE 0
|
||||
#define BYREF_FORCE 1
|
||||
#define BYREF_ALLOW 2
|
||||
#define BYREF_FORCE_REST 3
|
||||
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions);
|
||||
void zend_shutdown(TSRMLS_D);
|
||||
void zend_register_standard_ini_entries(TSRMLS_D);
|
||||
@@ -437,7 +436,6 @@ END_EXTERN_C()
|
||||
}
|
||||
#define zend_first_try EG(bailout_set)=0; zend_try
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API char *get_zend_version(void);
|
||||
ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
|
||||
ZEND_API int zend_print_zval(zval *expr, int indent);
|
||||
@@ -445,14 +443,7 @@ ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int in
|
||||
ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC);
|
||||
ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC);
|
||||
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC);
|
||||
ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
||||
END_EXTERN_C()
|
||||
|
||||
void zend_activate(TSRMLS_D);
|
||||
void zend_deactivate(TSRMLS_D);
|
||||
void zend_activate_modules(TSRMLS_D);
|
||||
void zend_deactivate_modules(TSRMLS_D);
|
||||
void zend_post_deactivate_modules(TSRMLS_D);
|
||||
ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#define Z_DBG(expr) (expr)
|
||||
@@ -462,9 +453,8 @@ void zend_post_deactivate_modules(TSRMLS_D);
|
||||
|
||||
ZEND_API extern char *empty_string;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void free_estring(char **str_p);
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
#define STR_FREE(ptr) if (ptr && ptr!=empty_string) { efree(ptr); }
|
||||
#define STR_FREE_REL(ptr) if (ptr && ptr!=empty_string) { efree_rel(ptr); }
|
||||
@@ -484,19 +474,18 @@ END_EXTERN_C()
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
|
||||
extern ZEND_API int (*zend_printf)(const char *format, ...);
|
||||
extern ZEND_API zend_write_func_t zend_write;
|
||||
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
|
||||
extern ZEND_API void (*zend_block_interruptions)(void);
|
||||
extern ZEND_API void (*zend_unblock_interruptions)(void);
|
||||
extern ZEND_API void (*zend_ticks_function)(int ticks);
|
||||
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
extern void (*zend_on_timeout)(int seconds TSRMLS_DC);
|
||||
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
|
||||
|
||||
|
||||
ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
||||
ZEND_API void zend_error(int type, const char *format, ...);
|
||||
|
||||
void zenderror(char *error);
|
||||
|
||||
@@ -516,9 +505,9 @@ END_EXTERN_C()
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_message_dispatcher(long message, void *data);
|
||||
END_EXTERN_C()
|
||||
|
||||
ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents);
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
/* Messages for applications of Zend */
|
||||
@@ -528,7 +517,6 @@ END_EXTERN_C()
|
||||
#define ZMSG_MEMORY_LEAK_DETECTED 4L
|
||||
#define ZMSG_MEMORY_LEAK_REPEATED 5L
|
||||
#define ZMSG_LOG_SCRIPT_NAME 6L
|
||||
#define ZMSG_MEMORY_LEAKS_GRAND_TOTAL 7L
|
||||
|
||||
|
||||
#define ZVAL_ADDREF(pz) (++(pz)->refcount)
|
||||
|
||||
+131
-530
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -209,6 +209,22 @@ ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
static int zend_check_class(zval *obj, zend_class_entry *expected_ce TSRMLS_DC)
|
||||
{
|
||||
zend_class_entry *ce;
|
||||
|
||||
if (Z_TYPE_P(obj) != IS_OBJECT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (ce = Z_OBJCE_P(obj); ce != NULL; ce = ce->parent) {
|
||||
if (ce == expected_ce) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
{
|
||||
@@ -315,16 +331,9 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
*p = Z_STRVAL_PP(arg);
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
if (Z_OBJ_HANDLER_PP(arg, cast_object)
|
||||
&& Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
*p = Z_STRVAL_PP(arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
case IS_ARRAY:
|
||||
case IS_OBJECT:
|
||||
case IS_RESOURCE:
|
||||
default:
|
||||
return "string";
|
||||
@@ -400,17 +409,14 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
{
|
||||
zval **p = va_arg(*va, zval **);
|
||||
zend_class_entry *ce = va_arg(*va, zend_class_entry *);
|
||||
|
||||
if (Z_TYPE_PP(arg) == IS_OBJECT &&
|
||||
(!ce || instanceof_function(Z_OBJCE_PP(arg), ce TSRMLS_CC))) {
|
||||
*p = *arg;
|
||||
} else {
|
||||
if (!zend_check_class(*arg, ce TSRMLS_CC)) {
|
||||
if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
|
||||
*p = NULL;
|
||||
} else {
|
||||
return ce ? ce->name : "object";
|
||||
return ce->name;
|
||||
}
|
||||
}
|
||||
} else
|
||||
*p = *arg;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -424,16 +430,7 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'Z':
|
||||
{
|
||||
zval ***p = va_arg(*va, zval ***);
|
||||
if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
|
||||
*p = NULL;
|
||||
} else {
|
||||
*p = arg;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
@@ -463,6 +460,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int
|
||||
static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int flags TSRMLS_DC)
|
||||
{
|
||||
char *spec_walk;
|
||||
char buf[1024];
|
||||
int c, i;
|
||||
int min_num_args = -1;
|
||||
int max_num_args = 0;
|
||||
@@ -478,7 +476,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
|
||||
case 's': case 'b':
|
||||
case 'r': case 'a':
|
||||
case 'o': case 'O':
|
||||
case 'z': case 'Z':
|
||||
case 'z':
|
||||
max_num_args++;
|
||||
break;
|
||||
|
||||
@@ -493,12 +491,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
|
||||
|
||||
default:
|
||||
if (!quiet) {
|
||||
zend_function *active_function = EG(function_state_ptr)->function;
|
||||
char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
|
||||
zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters",
|
||||
class_name,
|
||||
class_name[0] ? "::" : "",
|
||||
get_active_function_name(TSRMLS_C));
|
||||
zend_error(E_WARNING, "%s(): bad type specifier while parsing parameters", get_active_function_name(TSRMLS_C));
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -510,16 +503,13 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
|
||||
|
||||
if (num_args < min_num_args || num_args > max_num_args) {
|
||||
if (!quiet) {
|
||||
zend_function *active_function = EG(function_state_ptr)->function;
|
||||
char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
|
||||
zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given",
|
||||
class_name,
|
||||
class_name[0] ? "::" : "",
|
||||
sprintf(buf, "%s() expects %s %d parameter%s, %d given",
|
||||
get_active_function_name(TSRMLS_C),
|
||||
min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most",
|
||||
num_args < min_num_args ? min_num_args : max_num_args,
|
||||
(num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s",
|
||||
num_args);
|
||||
zend_error(E_WARNING, buf);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -584,17 +574,14 @@ ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr
|
||||
va_start(va, type_spec);
|
||||
retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC);
|
||||
va_end(va);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
p++;
|
||||
va_start(va, type_spec);
|
||||
|
||||
object = va_arg(va, zval **);
|
||||
ce = va_arg(va, zend_class_entry *);
|
||||
*object = this_ptr;
|
||||
if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) {
|
||||
zend_error(E_CORE_ERROR, "%s::%s() must be derived from %s::%s",
|
||||
ce->name, get_active_function_name(TSRMLS_C), Z_OBJCE_P(this_ptr)->name, get_active_function_name(TSRMLS_C));
|
||||
}
|
||||
|
||||
retval = zend_parse_va_args(num_args, p, &va, 0 TSRMLS_CC);
|
||||
va_end(va);
|
||||
@@ -602,42 +589,51 @@ ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...)
|
||||
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, zend_class_entry *ce, void **object, ...)
|
||||
{
|
||||
void **arg_stack = EG(argument_stack).top_element;
|
||||
va_list va;
|
||||
int retval;
|
||||
char *p = type_spec;
|
||||
zval **object;
|
||||
zend_class_entry *ce;
|
||||
int quiet = flags & ZEND_PARSE_PARAMS_QUIET;
|
||||
|
||||
if (!this_ptr) {
|
||||
va_start(va, type_spec);
|
||||
retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC);
|
||||
va_end(va);
|
||||
} else {
|
||||
p++;
|
||||
va_start(va, type_spec);
|
||||
*object = this_ptr;
|
||||
|
||||
object = va_arg(va, zval **);
|
||||
ce = va_arg(va, zend_class_entry *);
|
||||
*object = this_ptr;
|
||||
if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) {
|
||||
if (!*object) {
|
||||
zval **parameter;
|
||||
|
||||
if (zend_get_parameters_ex(1, ¶meter) != SUCCESS) {
|
||||
if (!quiet) {
|
||||
zend_error(E_CORE_ERROR, "%s::%s() must be derived from %s::%s",
|
||||
ce->name, get_active_function_name(TSRMLS_C), Z_OBJCE_P(this_ptr)->name, get_active_function_name(TSRMLS_C));
|
||||
zend_error(E_WARNING, "%s() expects an object of class %s as first parameter, none was given",
|
||||
get_active_function_name(TSRMLS_C), ce->name);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
retval = zend_parse_va_args(num_args, p, &va, flags TSRMLS_CC);
|
||||
va_end(va);
|
||||
return FAILURE;
|
||||
} else {
|
||||
if (!zend_check_class(*parameter, ce TSRMLS_CC)) {
|
||||
if (!quiet) {
|
||||
zend_error(E_WARNING, "%s() expects parameter 1 to be %s, %s given",
|
||||
get_active_function_name(TSRMLS_C), ce->name,
|
||||
zend_zval_type_name(*parameter));
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
} else {
|
||||
*object = *parameter;
|
||||
}
|
||||
|
||||
EG(argument_stack).top_element++;
|
||||
}
|
||||
}
|
||||
|
||||
va_start(va, object);
|
||||
retval = zend_parse_va_args(num_args, type_spec, &va, flags TSRMLS_CC);
|
||||
va_end(va);
|
||||
|
||||
EG(argument_stack).top_element = arg_stack;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/* Argument parsing API -- andrei */
|
||||
|
||||
|
||||
@@ -645,60 +641,17 @@ ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC)
|
||||
{
|
||||
ALLOC_HASHTABLE_REL(arg->value.ht);
|
||||
|
||||
_zend_hash_init(arg->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC);
|
||||
zend_hash_init(arg->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
arg->type = IS_ARRAY;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int zend_merge_property(zval **value, int num_args, va_list args, zend_hash_key *hash_key)
|
||||
{
|
||||
/* which name should a numeric property have ? */
|
||||
if (hash_key->nKeyLength) {
|
||||
zval *obj = va_arg(args, zval *);
|
||||
zend_object_handlers *obj_ht = va_arg(args, zend_object_handlers *);
|
||||
zval member;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
ZVAL_STRINGL(&member, hash_key->arKey, hash_key->nKeyLength-1, 0);
|
||||
obj_ht->write_property(obj, &member, *value TSRMLS_CC);
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
|
||||
|
||||
/* This function should be called after the constructor has been called
|
||||
* because it may call __set from the uninitialized object otherwise. */
|
||||
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC)
|
||||
{
|
||||
zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj);
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = Z_OBJCE_P(obj);
|
||||
zend_hash_apply_with_arguments(properties, (apply_func_args_t)zend_merge_property, 2, obj, obj_ht);
|
||||
EG(scope) = old_scope;
|
||||
|
||||
if (destroy_ht) {
|
||||
zend_hash_destroy(properties);
|
||||
FREE_HASHTABLE(properties);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This function requires 'properties' to contain all props declared in the
|
||||
* class and all props being public. If only a subset is given or the class
|
||||
* has protected members then you need to merge the properties seperately by
|
||||
* calling zend_merge_properties(). */
|
||||
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
zend_object *object;
|
||||
|
||||
if (class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
|
||||
char *what = class_type->ce_flags & ZEND_ACC_INTERFACE ? "interface" : "abstract class";
|
||||
zend_error(E_ERROR, "Cannot instantiate %s %s", what, class_type->name);
|
||||
}
|
||||
|
||||
if (!class_type->constants_updated) {
|
||||
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
@@ -746,7 +699,7 @@ ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n)
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_LONG(tmp, n);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len)
|
||||
@@ -756,7 +709,7 @@ ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len)
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_NULL(tmp);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b)
|
||||
@@ -766,7 +719,7 @@ ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b)
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_BOOL(tmp, b);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r)
|
||||
@@ -776,7 +729,7 @@ ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r)
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_RESOURCE(tmp, r);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -787,7 +740,7 @@ ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d)
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_DOUBLE(tmp, d);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -798,7 +751,7 @@ ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str,
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_STRING(tmp, str, duplicate);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -809,12 +762,12 @@ ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str,
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_STRINGL(tmp, str, length, duplicate);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value)
|
||||
{
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -990,7 +943,7 @@ ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *s
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_STRING(tmp, str, duplicate);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
|
||||
}
|
||||
|
||||
|
||||
@@ -1001,7 +954,7 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_STRINGL(tmp, str, length, duplicate);
|
||||
|
||||
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
|
||||
return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
|
||||
}
|
||||
|
||||
|
||||
@@ -1163,62 +1116,27 @@ ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *valu
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_API int zend_register_module_ex(zend_module_entry *module TSRMLS_DC)
|
||||
{
|
||||
int name_len;
|
||||
char *lcname;
|
||||
zend_module_entry *module_ptr;
|
||||
|
||||
if (!module) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
zend_printf("%s: Registering module %d\n", module->name, module->module_number);
|
||||
#endif
|
||||
name_len = strlen(module->name);
|
||||
lcname = zend_str_tolower_dup(module->name, name_len);
|
||||
|
||||
if (zend_hash_add(&module_registry, lcname, name_len+1, (void *)module, sizeof(zend_module_entry), (void**)&module_ptr)==FAILURE) {
|
||||
zend_error(E_CORE_WARNING, "Module '%s' already loaded", module->name);
|
||||
efree(lcname);
|
||||
return FAILURE;
|
||||
}
|
||||
efree(lcname);
|
||||
module = module_ptr;
|
||||
|
||||
if (module->functions && zend_register_functions(NULL, module->functions, NULL, module->type TSRMLS_CC)==FAILURE) {
|
||||
zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load", module->name);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!module->module_started && module->module_startup_func) {
|
||||
EG(current_module) = module;
|
||||
if (module->module_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) {
|
||||
zend_error(E_CORE_ERROR,"Unable to start %s module", module->name);
|
||||
EG(current_module) = NULL;
|
||||
return FAILURE;
|
||||
}
|
||||
EG(current_module) = NULL;
|
||||
}
|
||||
|
||||
module->module_started=1;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_API int zend_startup_module(zend_module_entry *module)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
if (module) {
|
||||
module->module_number = zend_next_free_module();
|
||||
if (module->module_startup_func) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
module->module_number = zend_next_free_module();
|
||||
module->type = MODULE_PERSISTENT;
|
||||
return zend_register_module_ex(module TSRMLS_CC);
|
||||
if (module->module_startup_func(MODULE_PERSISTENT, module->module_number TSRMLS_CC)==FAILURE) {
|
||||
zend_error(E_CORE_ERROR,"Unable to start %s module", module->name);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
module->type = MODULE_PERSISTENT;
|
||||
zend_register_module(module);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* registers all functions in *library_functions in the function hash */
|
||||
ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
|
||||
int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
|
||||
{
|
||||
zend_function_entry *ptr = functions;
|
||||
zend_function function, *reg_function;
|
||||
@@ -1243,58 +1161,15 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
|
||||
while (ptr->fname) {
|
||||
internal_function->handler = ptr->handler;
|
||||
internal_function->arg_types = ptr->func_arg_types;
|
||||
internal_function->function_name = ptr->fname;
|
||||
internal_function->scope = scope;
|
||||
internal_function->fn_flags = ZEND_ACC_PUBLIC;
|
||||
internal_function->prototype = NULL;
|
||||
if (ptr->arg_info) {
|
||||
internal_function->arg_info = ptr->arg_info+1;
|
||||
internal_function->num_args = ptr->num_args;
|
||||
/* Currently you cannot denote that the function can accept less arguments than num_args */
|
||||
if (ptr->arg_info[0].required_num_args == -1) {
|
||||
internal_function->required_num_args = ptr->num_args;
|
||||
} else {
|
||||
internal_function->required_num_args = ptr->arg_info[0].required_num_args;
|
||||
}
|
||||
internal_function->pass_rest_by_reference = ptr->arg_info[0].pass_by_reference;
|
||||
internal_function->return_reference = ptr->arg_info[0].return_reference;
|
||||
} else {
|
||||
internal_function->arg_info = NULL;
|
||||
internal_function->num_args = 0;
|
||||
internal_function->required_num_args = 0;
|
||||
internal_function->pass_rest_by_reference = 0;
|
||||
internal_function->return_reference = 0;
|
||||
}
|
||||
if (ptr->flags) {
|
||||
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
|
||||
zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
|
||||
internal_function->fn_flags |= ZEND_ACC_PUBLIC;
|
||||
} else {
|
||||
internal_function->fn_flags = ptr->flags;
|
||||
}
|
||||
} else {
|
||||
internal_function->fn_flags = ZEND_ACC_PUBLIC;
|
||||
}
|
||||
if (ptr->flags & ZEND_ACC_ABSTRACT) {
|
||||
if (scope) {
|
||||
/* This is a class that must be abstract itself. Here we set the check info. */
|
||||
scope->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
|
||||
if (!(scope->ce_flags & ZEND_ACC_INTERFACE)) {
|
||||
/* Since the class is not an interface it needs to be declared as a abstract class. */
|
||||
/* Since here we are handling internal functions only we can add the keyword flag. */
|
||||
/* This time we set the flag for the keyword 'abstratc'. */
|
||||
scope->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
|
||||
zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname);
|
||||
return FAILURE;
|
||||
}
|
||||
if (!internal_function->handler) {
|
||||
zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
|
||||
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
if (!internal_function->handler) {
|
||||
zend_error(error_type, "Null function defined as active function");
|
||||
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
fname_len = strlen(ptr->fname);
|
||||
lowercase_name = do_alloca(fname_len+1);
|
||||
@@ -1315,10 +1190,6 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
ctor = reg_function;
|
||||
} else if (!strcmp(ptr->fname, ZEND_DESTRUCTOR_FUNC_NAME)) {
|
||||
dtor = reg_function;
|
||||
if (internal_function->num_args) {
|
||||
zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name, ptr->fname);
|
||||
}
|
||||
|
||||
} else if (!strcmp(ptr->fname, ZEND_CLONE_FUNC_NAME)) {
|
||||
clone = reg_function;
|
||||
}
|
||||
@@ -1341,27 +1212,6 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
scope->constructor = ctor;
|
||||
scope->destructor = dtor;
|
||||
scope->clone = clone;
|
||||
if (ctor) {
|
||||
ctor->common.fn_flags |= ZEND_ACC_CTOR;
|
||||
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Constructor %s::%s cannot be static", ctor->common.scope->name, ctor->common.function_name);
|
||||
}
|
||||
ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (dtor) {
|
||||
dtor->common.fn_flags |= ZEND_ACC_DTOR;
|
||||
if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Destructor %s::%s cannot be static", dtor->common.scope->name, dtor->common.function_name);
|
||||
}
|
||||
dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (clone) {
|
||||
clone->common.fn_flags |= ZEND_ACC_CLONE;
|
||||
if (clone->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Constructor %s::%s cannot be static", clone->common.scope->name, clone->common.function_name);
|
||||
}
|
||||
clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -1369,7 +1219,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
/* count=-1 means erase all functions, otherwise,
|
||||
* erase the first count functions
|
||||
*/
|
||||
ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC)
|
||||
void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC)
|
||||
{
|
||||
zend_function_entry *ptr = functions;
|
||||
int i=0;
|
||||
@@ -1395,16 +1245,16 @@ ZEND_API void zend_unregister_functions(zend_function_entry *functions, int coun
|
||||
ZEND_API int zend_register_module(zend_module_entry *module)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
return zend_register_module_ex(module TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_get_module_started(char *module_name)
|
||||
{
|
||||
zend_module_entry *module;
|
||||
|
||||
return (zend_hash_find(&module_registry, module_name, strlen(module_name)+1, (void**)&module) == SUCCESS && module->module_started) ? SUCCESS : FAILURE;
|
||||
#if 0
|
||||
zend_printf("%s: Registering module %d\n", module->name, module->module_number);
|
||||
#endif
|
||||
if (module->functions && zend_register_functions(NULL, module->functions, NULL, module->type TSRMLS_CC)==FAILURE) {
|
||||
zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load", module->name);
|
||||
return FAILURE;
|
||||
}
|
||||
module->module_started=1;
|
||||
return zend_hash_add(&module_registry, module->name, strlen(module->name)+1, (void *)module, sizeof(zend_module_entry), NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1415,9 +1265,8 @@ void module_destructor(zend_module_entry *module)
|
||||
if (module->type == MODULE_TEMPORARY) {
|
||||
zend_clean_module_rsrc_dtors(module->module_number TSRMLS_CC);
|
||||
clean_module_constants(module->module_number TSRMLS_CC);
|
||||
if (module->request_shutdown_func) {
|
||||
if (module->request_shutdown_func)
|
||||
module->request_shutdown_func(module->type, module->module_number TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
if (module->module_started && module->module_shutdown_func) {
|
||||
@@ -1484,27 +1333,6 @@ int zend_next_free_module(void)
|
||||
return ++module_count;
|
||||
}
|
||||
|
||||
static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC)
|
||||
{
|
||||
zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
|
||||
char *lowercase_name = malloc(orig_class_entry->name_length + 1);
|
||||
*class_entry = *orig_class_entry;
|
||||
|
||||
class_entry->type = ZEND_INTERNAL_CLASS;
|
||||
zend_initialize_class_data(class_entry, 0 TSRMLS_CC);
|
||||
class_entry->ce_flags = ce_flags;
|
||||
class_entry->module = EG(current_module);
|
||||
|
||||
if (class_entry->builtin_functions) {
|
||||
zend_register_functions(class_entry, class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length);
|
||||
zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL);
|
||||
free(lowercase_name);
|
||||
return class_entry;
|
||||
}
|
||||
|
||||
/* If parent_ce is not NULL then it inherits from parent_ce
|
||||
* If parent_ce is NULL and parent_name isn't then it looks for the parent and inherits from it
|
||||
* If both parent_ce and parent_name are NULL it does a regular class registration
|
||||
@@ -1526,41 +1354,28 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla
|
||||
register_class = zend_register_internal_class(class_entry TSRMLS_CC);
|
||||
|
||||
if (parent_ce) {
|
||||
zend_do_inheritance(register_class, parent_ce TSRMLS_CC);
|
||||
zend_do_inheritance(register_class, parent_ce);
|
||||
}
|
||||
return register_class;
|
||||
}
|
||||
|
||||
ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...)
|
||||
{
|
||||
zend_class_entry *interface_entry;
|
||||
va_list interface_list;
|
||||
|
||||
if (class_entry->type & ZEND_INTERNAL_CLASS) {
|
||||
class_entry->interfaces = realloc(class_entry->interfaces, sizeof(zend_class_entry*) * (class_entry->num_interfaces+num_interfaces));
|
||||
} else {
|
||||
class_entry->interfaces = erealloc(class_entry->interfaces, sizeof(zend_class_entry*) * (class_entry->num_interfaces+num_interfaces));
|
||||
}
|
||||
|
||||
va_start(interface_list, num_interfaces);
|
||||
while (num_interfaces--) {
|
||||
interface_entry = va_arg(interface_list, zend_class_entry *);
|
||||
class_entry->interfaces[class_entry->num_interfaces++] = interface_entry;
|
||||
zend_do_implement_interface(class_entry, interface_entry TSRMLS_CC);
|
||||
}
|
||||
va_end(interface_list);
|
||||
}
|
||||
|
||||
/* A class that contains at least one abstract method automatically becomes an abstract class.
|
||||
*/
|
||||
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_class_entry TSRMLS_DC)
|
||||
{
|
||||
return do_register_internal_class(orig_class_entry, 0 TSRMLS_CC);
|
||||
}
|
||||
zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
|
||||
char *lowercase_name = malloc(orig_class_entry->name_length + 1);
|
||||
*class_entry = *orig_class_entry;
|
||||
|
||||
ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC)
|
||||
{
|
||||
return do_register_internal_class(orig_class_entry, ZEND_ACC_INTERFACE TSRMLS_CC);
|
||||
class_entry->type = ZEND_INTERNAL_CLASS;
|
||||
zend_initialize_class_data(class_entry, 0 TSRMLS_CC);
|
||||
|
||||
if (class_entry->builtin_functions) {
|
||||
zend_register_functions(class_entry, class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length);
|
||||
zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL);
|
||||
free(lowercase_name);
|
||||
return class_entry;
|
||||
}
|
||||
|
||||
ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
|
||||
@@ -1639,7 +1454,7 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name)
|
||||
zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name)
|
||||
{
|
||||
char *lcname;
|
||||
zend_bool retval = 0;
|
||||
@@ -1647,17 +1462,15 @@ ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char
|
||||
|
||||
switch (Z_TYPE_P(callable)) {
|
||||
case IS_STRING:
|
||||
if (callable_name) {
|
||||
if (callable_name)
|
||||
*callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
|
||||
}
|
||||
if (syntax_only) {
|
||||
|
||||
if (syntax_only)
|
||||
return 1;
|
||||
}
|
||||
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
|
||||
if (zend_hash_exists(EG(function_table), lcname, Z_STRLEN_P(callable)+1)) {
|
||||
if (zend_hash_exists(EG(function_table), lcname, Z_STRLEN_P(callable)+1))
|
||||
retval = 1;
|
||||
}
|
||||
efree(lcname);
|
||||
break;
|
||||
|
||||
@@ -1692,17 +1505,17 @@ ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char
|
||||
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
|
||||
|
||||
if (EG(active_op_array) && strcmp(lcname, "self") == 0) {
|
||||
if(EG(active_op_array) && strcmp(lcname, "self") == 0) {
|
||||
ce = EG(active_op_array)->scope;
|
||||
} else if (strcmp(lcname, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
|
||||
} else if(strcmp(lcname, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
|
||||
ce = EG(active_op_array)->scope->parent;
|
||||
} else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
|
||||
} else if (zend_lookup_class(lcname, Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
}
|
||||
|
||||
efree(lcname);
|
||||
} else {
|
||||
ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
|
||||
ce = Z_OBJCE_PP(obj); /* ??? */
|
||||
|
||||
if (callable_name) {
|
||||
char *ptr;
|
||||
@@ -1722,18 +1535,12 @@ ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char
|
||||
|
||||
if (ce) {
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(method), Z_STRLEN_PP(method));
|
||||
if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method)+1)) {
|
||||
if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method)+1))
|
||||
retval = 1;
|
||||
}
|
||||
/* check for __call too */
|
||||
if (retval == 0 && ce->__call != 0) {
|
||||
retval = 1;
|
||||
}
|
||||
efree(lcname);
|
||||
}
|
||||
} else if (callable_name) {
|
||||
} else if (callable_name)
|
||||
*callable_name = estrndup("Array", sizeof("Array")-1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1752,34 +1559,6 @@ ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC)
|
||||
{
|
||||
char *lcname, *func;
|
||||
zend_bool retval = 0;
|
||||
|
||||
if (zend_is_callable(callable, 0, callable_name)) {
|
||||
return 1;
|
||||
}
|
||||
switch (Z_TYPE_P(callable)) {
|
||||
case IS_STRING:
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
|
||||
|
||||
if ((func = strstr(lcname, "::")) != NULL) {
|
||||
zval_dtor(callable);
|
||||
array_init(callable);
|
||||
add_next_index_stringl(callable, lcname, func - lcname, 1);
|
||||
func += 2;
|
||||
add_next_index_stringl(callable, func, strlen(func), 1);
|
||||
retval = 1;
|
||||
}
|
||||
efree(lcname);
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *zend_get_module_version(char *module_name)
|
||||
{
|
||||
zend_module_entry *module;
|
||||
@@ -1791,184 +1570,6 @@ ZEND_API char *zend_get_module_version(char *module_name)
|
||||
return module->version;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC)
|
||||
{
|
||||
zend_property_info property_info;
|
||||
HashTable *target_symbol_table;
|
||||
|
||||
if (!(access_type & ZEND_ACC_PPP_MASK)) {
|
||||
access_type |= ZEND_ACC_PUBLIC;
|
||||
}
|
||||
if (access_type & ZEND_ACC_STATIC) {
|
||||
target_symbol_table = ce->static_members;
|
||||
} else {
|
||||
target_symbol_table = &ce->default_properties;
|
||||
}
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
switch(Z_TYPE_P(property)) {
|
||||
case IS_ARRAY:
|
||||
case IS_CONSTANT_ARRAY:
|
||||
case IS_OBJECT:
|
||||
case IS_RESOURCE:
|
||||
zend_error(E_CORE_ERROR, "Internal zval's can't be arrays, objects or resources");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (access_type & ZEND_ACC_PPP_MASK) {
|
||||
case ZEND_ACC_PRIVATE: {
|
||||
char *priv_name;
|
||||
int priv_name_length;
|
||||
|
||||
zend_mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
|
||||
zend_hash_update(target_symbol_table, priv_name, priv_name_length+1, &property, sizeof(zval *), NULL);
|
||||
property_info.name = priv_name;
|
||||
property_info.name_length = priv_name_length;
|
||||
}
|
||||
break;
|
||||
case ZEND_ACC_PROTECTED: {
|
||||
char *prot_name;
|
||||
int prot_name_length;
|
||||
|
||||
zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
|
||||
zend_hash_update(target_symbol_table, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL);
|
||||
property_info.name = prot_name;
|
||||
property_info.name_length = prot_name_length;
|
||||
}
|
||||
break;
|
||||
case ZEND_ACC_PUBLIC:
|
||||
if (ce->parent) {
|
||||
char *prot_name;
|
||||
int prot_name_length;
|
||||
|
||||
zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
|
||||
zend_hash_del(target_symbol_table, prot_name, prot_name_length+1);
|
||||
pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS);
|
||||
}
|
||||
zend_hash_update(target_symbol_table, name, name_length+1, &property, sizeof(zval *), NULL);
|
||||
property_info.name = ce->type & ZEND_INTERNAL_CLASS ? zend_strndup(name, name_length) : estrndup(name, name_length);
|
||||
property_info.name_length = name_length;
|
||||
break;
|
||||
}
|
||||
property_info.flags = access_type;
|
||||
property_info.h = zend_get_hash_value(property_info.name, property_info.name_length+1);
|
||||
|
||||
zend_hash_update(&ce->properties_info, name, name_length + 1, &property_info, sizeof(zend_property_info), NULL);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC)
|
||||
{
|
||||
zval *property;
|
||||
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
property = malloc(sizeof(zval));
|
||||
} else {
|
||||
ALLOC_ZVAL(property);
|
||||
}
|
||||
INIT_ZVAL(*property);
|
||||
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC)
|
||||
{
|
||||
zval *property;
|
||||
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
property = malloc(sizeof(zval));
|
||||
} else {
|
||||
ALLOC_ZVAL(property);
|
||||
}
|
||||
INIT_PZVAL(property);
|
||||
ZVAL_LONG(property, value);
|
||||
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC)
|
||||
{
|
||||
zval *property;
|
||||
int len = strlen(value);
|
||||
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
property = malloc(sizeof(zval));
|
||||
ZVAL_STRINGL(property, zend_strndup(value, len), len, 0);
|
||||
} else {
|
||||
ALLOC_ZVAL(property);
|
||||
ZVAL_STRINGL(property, value, len, 1);
|
||||
}
|
||||
INIT_PZVAL(property);
|
||||
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC)
|
||||
{
|
||||
zval property;
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = scope;
|
||||
|
||||
if (!Z_OBJ_HT_P(object)->write_property) {
|
||||
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", Z_OBJCE_P(object)->name, name);
|
||||
}
|
||||
ZVAL_STRINGL(&property, name, name_length, 0);
|
||||
Z_OBJ_HT_P(object)->write_property(object, &property, value TSRMLS_CC);
|
||||
|
||||
EG(scope) = old_scope;
|
||||
}
|
||||
|
||||
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_NULL(tmp);
|
||||
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_LONG(tmp, value);
|
||||
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
tmp->is_ref = 0;
|
||||
tmp->refcount = 0;
|
||||
ZVAL_STRING(tmp, value, 1);
|
||||
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC)
|
||||
{
|
||||
zval property, *value;
|
||||
zend_class_entry *old_scope = EG(scope);
|
||||
|
||||
EG(scope) = scope;
|
||||
|
||||
if (!Z_OBJ_HT_P(object)->read_property) {
|
||||
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", Z_OBJCE_P(object)->name, name);
|
||||
}
|
||||
ZVAL_STRINGL(&property, name, name_length, 0);
|
||||
value = Z_OBJ_HT_P(object)->read_property(object, &property, silent TSRMLS_CC);
|
||||
|
||||
EG(scope) = old_scope;
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
+17
-122
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -32,47 +32,22 @@
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
typedef struct _zend_function_entry {
|
||||
char *fname;
|
||||
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
|
||||
struct _zend_arg_info *arg_info;
|
||||
zend_uint num_args;
|
||||
zend_uint flags;
|
||||
} zend_function_entry;
|
||||
|
||||
#define ZEND_FN(name) zif_##name
|
||||
#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
|
||||
#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(ZEND_FN(name))
|
||||
#define ZEND_METHOD(classname, name) ZEND_NAMED_FUNCTION(ZEND_FN(classname##_##name))
|
||||
#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
|
||||
#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(ZEND_FN(name))
|
||||
#define ZEND_METHOD(class, name) ZEND_NAMED_FUNCTION(ZEND_FN(class##_##name))
|
||||
|
||||
#define ZEND_FENTRY(zend_name, name, arg_info, flags) { #zend_name, name, arg_info, (zend_uint) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
|
||||
|
||||
#define ZEND_NAMED_FE(zend_name, name, arg_info) ZEND_FENTRY(zend_name, name, arg_info, 0)
|
||||
#define ZEND_FE(name, arg_info) ZEND_FENTRY(name, ZEND_FN(name), arg_info, 0)
|
||||
#define ZEND_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, 0)
|
||||
#define ZEND_ME(classname, name, arg_info, flags) ZEND_FENTRY(name, ZEND_FN(classname##_##name), arg_info, flags)
|
||||
#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_FENTRY(name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
|
||||
#define ZEND_MALIAS(classname, name, alias, arg_info, flags) \
|
||||
ZEND_FENTRY(name, ZEND_FN(classname##_##alias), arg_info, flags)
|
||||
#define ZEND_ME_MAPPING(name, func_name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(func_name), arg_types)
|
||||
|
||||
#define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, pass_by_ref, 0, 0 },
|
||||
#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, pass_by_ref, 0, 0 },
|
||||
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, allow_null, pass_by_ref, 0, 0 },
|
||||
#define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \
|
||||
zend_arg_info name[] = { \
|
||||
{ NULL, 0, NULL, 0, 0, pass_rest_by_reference, return_reference, required_num_args },
|
||||
#define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference) \
|
||||
ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_REFERENCE_AGNOSTIC, -1)
|
||||
#define ZEND_END_ARG_INFO() };
|
||||
#define ZEND_NAMED_FE(zend_name, name, arg_types) { #zend_name, name, arg_types },
|
||||
#define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(name), arg_types)
|
||||
#define ZEND_FALIAS(name, alias, arg_types) ZEND_NAMED_FE(name, ZEND_FN(alias), arg_types)
|
||||
#define ZEND_STATIC_FE(name, impl_name, arg_types) { name, impl_name, arg_types },
|
||||
#define ZEND_ME(class, name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(class##_##name), arg_types)
|
||||
|
||||
/* Name macros */
|
||||
#define ZEND_MODULE_STARTUP_N(module) zm_startup_##module
|
||||
#define ZEND_MODULE_SHUTDOWN_N(module) zm_shutdown_##module
|
||||
#define ZEND_MODULE_ACTIVATE_N(module) zm_activate_##module
|
||||
#define ZEND_MODULE_DEACTIVATE_N(module) zm_deactivate_##module
|
||||
#define ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module) zm_post_zend_deactivate_##module
|
||||
#define ZEND_MODULE_INFO_N(module) zm_info_##module
|
||||
|
||||
/* Declaration macros */
|
||||
@@ -80,7 +55,6 @@ typedef struct _zend_function_entry {
|
||||
#define ZEND_MODULE_SHUTDOWN_D(module) int ZEND_MODULE_SHUTDOWN_N(module)(SHUTDOWN_FUNC_ARGS)
|
||||
#define ZEND_MODULE_ACTIVATE_D(module) int ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS)
|
||||
#define ZEND_MODULE_DEACTIVATE_D(module) int ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS)
|
||||
#define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module) int ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void)
|
||||
#define ZEND_MODULE_INFO_D(module) void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
|
||||
#define ZEND_GET_MODULE(name) \
|
||||
@@ -126,21 +100,14 @@ typedef struct _zend_function_entry {
|
||||
class_container.destructor = NULL; \
|
||||
class_container.clone = NULL; \
|
||||
class_container.create_object = NULL; \
|
||||
class_container.interface_gets_implemented = NULL; \
|
||||
class_container.__call = handle_fcall; \
|
||||
class_container.__get = handle_propget; \
|
||||
class_container.__set = handle_propset; \
|
||||
class_container.parent = NULL; \
|
||||
class_container.num_interfaces = 0; \
|
||||
class_container.interfaces = NULL; \
|
||||
class_container.get_iterator = NULL; \
|
||||
class_container.iterator_funcs.funcs = NULL; \
|
||||
class_container.module = NULL; \
|
||||
class_container.num_interfaces = 0; \
|
||||
}
|
||||
|
||||
int zend_next_free_module(void);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zend_get_parameters(int ht, int param_count, ...);
|
||||
ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC);
|
||||
ZEND_API int zend_get_parameters_ex(int param_count, ...);
|
||||
@@ -160,39 +127,23 @@ ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *t
|
||||
ZEND_API char *zend_zval_type_name(zval *arg);
|
||||
|
||||
ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...);
|
||||
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...);
|
||||
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, zend_class_entry *ce, void **object, ...);
|
||||
|
||||
/* End of parameter parsing API -- andrei */
|
||||
|
||||
ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
|
||||
ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
|
||||
int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
|
||||
void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
|
||||
ZEND_API int zend_register_module(zend_module_entry *module_entry);
|
||||
ZEND_API int zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
|
||||
|
||||
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC);
|
||||
ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...);
|
||||
|
||||
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC);
|
||||
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_wrong_param_count(TSRMLS_D);
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);
|
||||
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
|
||||
ZEND_API char *zend_get_module_version(char *module_name);
|
||||
ZEND_API int zend_get_module_started(char *module_name);
|
||||
ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
|
||||
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
|
||||
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
|
||||
|
||||
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
|
||||
|
||||
ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
|
||||
|
||||
@@ -220,8 +171,6 @@ ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC);
|
||||
|
||||
/* no longer supported */
|
||||
ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
|
||||
|
||||
@@ -296,35 +245,9 @@ ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *valu
|
||||
#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
|
||||
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
|
||||
|
||||
|
||||
ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC);
|
||||
ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
|
||||
END_EXTERN_C()
|
||||
|
||||
typedef struct _zend_fcall_info {
|
||||
size_t size;
|
||||
HashTable *function_table;
|
||||
zval *function_name;
|
||||
HashTable *symbol_table;
|
||||
zval **retval_ptr_ptr;
|
||||
zend_uint param_count;
|
||||
zval ***params;
|
||||
zval **object_pp;
|
||||
zend_bool no_separation;
|
||||
} zend_fcall_info;
|
||||
|
||||
typedef struct _zend_fcall_info_cache {
|
||||
zend_bool initialized;
|
||||
zend_function *function_handler;
|
||||
zend_class_entry *calling_scope;
|
||||
zval **object_pp;
|
||||
} zend_fcall_info_cache;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API extern zend_fcall_info_cache empty_fcall_info_cache;
|
||||
|
||||
ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC);
|
||||
|
||||
ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC);
|
||||
ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
|
||||
ZEND_API int fast_call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table, zend_function **function_pointer TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
|
||||
zend_bool is_ref, int num_symbol_tables, ...);
|
||||
@@ -333,7 +256,6 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
|
||||
|
||||
ZEND_API ZEND_FUNCTION(display_disabled_function);
|
||||
ZEND_API ZEND_FUNCTION(display_disabled_class);
|
||||
END_EXTERN_C()
|
||||
|
||||
#if ZEND_DEBUG
|
||||
#define CHECK_ZVAL_STRING(z) \
|
||||
@@ -352,7 +274,7 @@ END_EXTERN_C()
|
||||
|
||||
#define ZVAL_BOOL(z, b) { \
|
||||
(z)->type = IS_BOOL; \
|
||||
(z)->value.lval = ((b) != 0); \
|
||||
(z)->value.lval = b; \
|
||||
}
|
||||
|
||||
#define ZVAL_NULL(z) { \
|
||||
@@ -389,24 +311,6 @@ END_EXTERN_C()
|
||||
(z)->type = IS_STRING; \
|
||||
}
|
||||
|
||||
#define ZVAL_ZVAL(z, zv, copy, dtor) { \
|
||||
int is_ref, refcount; \
|
||||
is_ref = (z)->is_ref; \
|
||||
refcount = (z)->refcount; \
|
||||
*(z) = *(zv); \
|
||||
if (copy) { \
|
||||
zval_copy_ctor(z); \
|
||||
} \
|
||||
if (dtor) { \
|
||||
if (!copy) { \
|
||||
ZVAL_NULL(zv); \
|
||||
} \
|
||||
zval_ptr_dtor(&zv); \
|
||||
} \
|
||||
(z)->is_ref = is_ref; \
|
||||
(z)->refcount = refcount; \
|
||||
}
|
||||
|
||||
#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
|
||||
#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
|
||||
|
||||
@@ -418,7 +322,6 @@ END_EXTERN_C()
|
||||
#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
|
||||
#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
|
||||
#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
|
||||
#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
|
||||
#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
|
||||
#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
|
||||
|
||||
@@ -430,7 +333,6 @@ END_EXTERN_C()
|
||||
#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
|
||||
#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
|
||||
#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
|
||||
#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
|
||||
#define RETURN_FALSE { RETVAL_FALSE; return; }
|
||||
#define RETURN_TRUE { RETVAL_TRUE; return; }
|
||||
|
||||
@@ -509,13 +411,6 @@ END_EXTERN_C()
|
||||
#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
|
||||
ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref)
|
||||
|
||||
#define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \
|
||||
{ \
|
||||
char *_name = (name); \
|
||||
int namelen = strlen(_name); \
|
||||
zend_declare_property(class_ptr, _name, namelen, value, mask TSRMLS_CC); \
|
||||
}
|
||||
|
||||
#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL)))
|
||||
#define ZVAL_IS_NULL(z) ((z)->type==IS_NULL)
|
||||
|
||||
|
||||
+70
-74
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -38,7 +38,7 @@ ZEND_API zend_alloc_globals alloc_globals;
|
||||
|
||||
|
||||
#ifdef ZEND_MM
|
||||
#define ZEND_DISABLE_MEMORY_CACHE 0
|
||||
#define ZEND_DISABLE_MEMORY_CACHE 1
|
||||
#else
|
||||
#define ZEND_DISABLE_MEMORY_CACHE 0
|
||||
#endif
|
||||
@@ -75,12 +75,12 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
|
||||
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
|
||||
if (AG(memory_limit)<AG(allocated_memory)) {\
|
||||
int php_mem_limit = AG(memory_limit); \
|
||||
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
|
||||
if (AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
|
||||
AG(memory_limit) = AG(allocated_memory) + 1048576; \
|
||||
if (file) { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \
|
||||
} else { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", php_mem_limit, s); \
|
||||
} else { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \
|
||||
} \
|
||||
} else { \
|
||||
if (file) { \
|
||||
@@ -99,7 +99,6 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
|
||||
#endif
|
||||
|
||||
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
#define REMOVE_POINTER_FROM_LIST(p) \
|
||||
if (p==AG(head)) { \
|
||||
AG(head) = p->pNext; \
|
||||
@@ -109,21 +108,14 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
|
||||
if (p->pNext) { \
|
||||
p->pNext->pLast = p->pLast; \
|
||||
}
|
||||
#else
|
||||
#define REMOVE_POINTER_FROM_LIST(p)
|
||||
#endif
|
||||
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
#define ADD_POINTER_TO_LIST(p) \
|
||||
#define ADD_POINTER_TO_LIST(p) \
|
||||
p->pNext = AG(head); \
|
||||
if (AG(head)) { \
|
||||
AG(head)->pLast = p; \
|
||||
} \
|
||||
AG(head) = p; \
|
||||
p->pLast = (zend_mem_header *) NULL;
|
||||
#else
|
||||
#define ADD_POINTER_TO_LIST(p)
|
||||
#endif
|
||||
|
||||
#define DECLARE_CACHE_VARS() \
|
||||
unsigned int real_size; \
|
||||
@@ -172,12 +164,6 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
if (CACHE_INDEX<MAX_CACHED_MEMORY) {
|
||||
AG(cache_stats)[CACHE_INDEX][0]++;
|
||||
}
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
CHECK_MEMORY_LIMIT(size, SIZE);
|
||||
if (AG(allocated_memory) > AG(allocated_memory_peak)) {
|
||||
AG(allocated_memory_peak) = AG(allocated_memory);
|
||||
}
|
||||
#endif
|
||||
p = (zend_mem_header *) ZEND_DO_MALLOC(sizeof(zend_mem_header) + MEM_HEADER_PADDING + SIZE + END_MAGIC_SIZE);
|
||||
#if !ZEND_DISABLE_MEMORY_CACHE
|
||||
@@ -197,7 +183,9 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
return (void *)p;
|
||||
}
|
||||
p->cached = 0;
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
ADD_POINTER_TO_LIST(p);
|
||||
#endif
|
||||
p->size = size; /* Save real size for correct cache output */
|
||||
#if ZEND_DEBUG
|
||||
p->filename = __zend_filename;
|
||||
@@ -211,6 +199,12 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
# endif
|
||||
memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
CHECK_MEMORY_LIMIT(size, SIZE);
|
||||
if (AG(allocated_memory) > AG(allocated_memory_peak)) {
|
||||
AG(allocated_memory_peak) = AG(allocated_memory);
|
||||
}
|
||||
#endif
|
||||
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING);
|
||||
@@ -234,12 +228,12 @@ ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_
|
||||
ZEND_SIGNED_MULTIPLY_LONG(nmemb, size, lval, dval, use_dval);
|
||||
|
||||
if (!use_dval
|
||||
&& lval < (long) (LONG_MAX - offset)) {
|
||||
&& lval < LONG_MAX - offset) {
|
||||
return emalloc_rel(lval + offset);
|
||||
}
|
||||
}
|
||||
|
||||
zend_error(E_ERROR, "Possible integer overflow in memory allocation (%zd * %zd + %zd)", nmemb, size, offset);
|
||||
zend_error(E_ERROR, "Possible integer overflow in memory allocation (%ld * %ld + %ld)", nmemb, size, offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -278,7 +272,9 @@ ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
}
|
||||
#endif
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
REMOVE_POINTER_FROM_LIST(p);
|
||||
#endif
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
AG(allocated_memory) -= SIZE;
|
||||
@@ -335,13 +331,9 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
|
||||
CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
#if MEMORY_LIMIT
|
||||
CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
|
||||
if (AG(allocated_memory) > AG(allocated_memory_peak)) {
|
||||
AG(allocated_memory_peak) = AG(allocated_memory);
|
||||
}
|
||||
#endif
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
REMOVE_POINTER_FROM_LIST(p);
|
||||
#endif
|
||||
p = (zend_mem_header *) ZEND_DO_REALLOC(p, sizeof(zend_mem_header)+MEM_HEADER_PADDING+SIZE+END_MAGIC_SIZE);
|
||||
if (!p) {
|
||||
if (!allow_failure) {
|
||||
@@ -352,17 +344,27 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
ADD_POINTER_TO_LIST(orig);
|
||||
#endif
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return (void *)NULL;
|
||||
}
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
ADD_POINTER_TO_LIST(p);
|
||||
#endif
|
||||
#if ZEND_DEBUG
|
||||
p->filename = __zend_filename;
|
||||
p->lineno = __zend_lineno;
|
||||
p->magic = MEM_BLOCK_START_MAGIC;
|
||||
memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
|
||||
if (AG(allocated_memory) > AG(allocated_memory_peak)) {
|
||||
AG(allocated_memory_peak) = AG(allocated_memory);
|
||||
}
|
||||
#endif
|
||||
|
||||
p->size = size;
|
||||
|
||||
@@ -466,44 +468,21 @@ ZEND_API void start_memory_manager(TSRMLS_D)
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
|
||||
ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC)
|
||||
{
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
zend_mem_header *p, *t;
|
||||
#endif
|
||||
|
||||
#if ZEND_DEBUG
|
||||
zend_uint grand_total_leaks=0;
|
||||
int had_leaks = 0;
|
||||
#endif
|
||||
|
||||
#if !ZEND_DISABLE_MEMORY_CACHE
|
||||
/* Free memory cache even on partial shutdown to avoid fragmentation */
|
||||
if (1 || full_shutdown) {
|
||||
unsigned int i, j;
|
||||
zend_mem_header *ptr;
|
||||
|
||||
for (i=1; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (j=0; j<AG(cache_count)[i]; j++) {
|
||||
ptr = (zend_mem_header *) AG(cache)[i][j];
|
||||
# if MEMORY_LIMIT
|
||||
AG(allocated_memory) -= REAL_SIZE(ptr->size);
|
||||
# endif
|
||||
REMOVE_POINTER_FROM_LIST(ptr);
|
||||
ZEND_DO_FREE(ptr);
|
||||
}
|
||||
AG(cache_count)[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif /* !ZEND_DISABLE_MEMORY_CACHE */
|
||||
|
||||
#if defined(ZEND_MM) && !ZEND_DEBUG
|
||||
zend_mm_shutdown(&AG(mm_heap));
|
||||
if (full_shutdown) {
|
||||
if (clean_cache) {
|
||||
zend_mm_shutdown(&AG(mm_heap));
|
||||
return;
|
||||
}
|
||||
zend_mm_startup(&AG(mm_heap), 256*1024);
|
||||
|
||||
#elif defined(ZEND_WIN32) && !ZEND_DEBUG
|
||||
if (full_shutdown && AG(memory_heap)) {
|
||||
if (clean_cache && AG(memory_heap)) {
|
||||
HeapDestroy(AG(memory_heap));
|
||||
return;
|
||||
}
|
||||
@@ -526,17 +505,36 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
|
||||
}
|
||||
#endif /* ZEND_ENABLE_FAST_CACHE */
|
||||
|
||||
#if !ZEND_DISABLE_MEMORY_CACHE && !defined(ZEND_MM)
|
||||
if (1 || clean_cache) {
|
||||
unsigned int i, j;
|
||||
zend_mem_header *ptr;
|
||||
|
||||
for (i=1; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (j=0; j<AG(cache_count)[i]; j++) {
|
||||
ptr = (zend_mem_header *) AG(cache)[i][j];
|
||||
#if MEMORY_LIMIT
|
||||
AG(allocated_memory) -= REAL_SIZE(ptr->size);
|
||||
#endif
|
||||
REMOVE_POINTER_FROM_LIST(ptr);
|
||||
ZEND_DO_FREE(ptr);
|
||||
}
|
||||
AG(cache_count)[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif /* !ZEND_DISABLE_MEMORY_CACHE */
|
||||
|
||||
#if ZEND_DEBUG || !defined(ZEND_MM)
|
||||
p = AG(head);
|
||||
t = AG(head);
|
||||
while (t) {
|
||||
if (!t->cached) {
|
||||
#if ZEND_DEBUG
|
||||
if (!t->reported) {
|
||||
if (!t->cached && !t->reported) {
|
||||
zend_mem_header *iterator;
|
||||
int total_leak=0, total_leak_count=0;
|
||||
|
||||
grand_total_leaks++;
|
||||
had_leaks = 1;
|
||||
if (!silent) {
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t);
|
||||
}
|
||||
@@ -553,7 +551,6 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
|
||||
if (!silent && total_leak_count>0) {
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (total_leak_count));
|
||||
}
|
||||
grand_total_leaks += total_leak_count;
|
||||
}
|
||||
#endif
|
||||
#if MEMORY_LIMIT
|
||||
@@ -568,12 +565,6 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
#if ZEND_DEBUG
|
||||
if (!silent && grand_total_leaks > 0) {
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAKS_GRAND_TOTAL, &grand_total_leaks);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MEMORY_LIMIT
|
||||
AG(memory_exhausted)=0;
|
||||
AG(allocated_memory_peak) = 0;
|
||||
@@ -585,7 +576,7 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
|
||||
zval display_memory_cache_stats;
|
||||
int i, j;
|
||||
|
||||
if (full_shutdown) {
|
||||
if (clean_cache) {
|
||||
/* we're shutting down completely, don't even touch the INI subsystem */
|
||||
break;
|
||||
}
|
||||
@@ -623,13 +614,12 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
#if defined(ZEND_MM) && ZEND_DEBUG
|
||||
zend_mm_shutdown(&AG(mm_heap));
|
||||
if (full_shutdown) {
|
||||
if (clean_cache) {
|
||||
zend_mm_shutdown(&AG(mm_heap));
|
||||
return;
|
||||
}
|
||||
zend_mm_startup(&AG(mm_heap), 256*1024);
|
||||
#elif defined(ZEND_WIN32) && ZEND_DEBUG
|
||||
if (full_shutdown && AG(memory_heap)) {
|
||||
if (clean_cache && AG(memory_heap)) {
|
||||
HeapDestroy(AG(memory_heap));
|
||||
return;
|
||||
}
|
||||
@@ -724,7 +714,7 @@ ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
if (valid_beginning && (end_magic != MEM_BLOCK_END_MAGIC)) {
|
||||
char *overflow_ptr, *magic_ptr=(char *) &mem_block_end_magic;
|
||||
int overflows=0;
|
||||
long i;
|
||||
int i;
|
||||
|
||||
if (silent) {
|
||||
return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
@@ -732,7 +722,7 @@ ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
had_problems = 1;
|
||||
overflow_ptr = (char *) &end_magic;
|
||||
|
||||
for (i=0; i<(int)sizeof(long); i++) {
|
||||
for (i=0; i<sizeof(long); i++) {
|
||||
if (overflow_ptr[i]!=magic_ptr[i]) {
|
||||
overflows++;
|
||||
}
|
||||
@@ -741,7 +731,7 @@ ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
zend_debug_alloc_output("%10s\t", "End:");
|
||||
zend_debug_alloc_output("Overflown (magic=0x%0.8lX instead of 0x%0.8lX)\n", end_magic, MEM_BLOCK_END_MAGIC);
|
||||
zend_debug_alloc_output("%10s\t","");
|
||||
if (overflows>=(int)sizeof(long)) {
|
||||
if (overflows>=sizeof(long)) {
|
||||
zend_debug_alloc_output("At least %d bytes overflown\n", sizeof(long));
|
||||
} else {
|
||||
zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
|
||||
@@ -754,6 +744,12 @@ ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
zend_debug_alloc_output("Unknown\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (had_problems) {
|
||||
int foo = 5;
|
||||
|
||||
foo += 1;
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
zend_debug_alloc_output("---------------------------------------\n");
|
||||
|
||||
+11
-68
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -64,10 +64,10 @@ typedef union _align_test {
|
||||
#define MAX_CACHED_ENTRIES 256
|
||||
#define PRE_INIT_CACHE_ENTRIES 32
|
||||
|
||||
#if ZEND_GCC_VERSION >= 2000
|
||||
# define PLATFORM_ALIGNMENT (__alignof__ (align_test))
|
||||
#if (defined (__GNUC__) && __GNUC__ >= 2)
|
||||
#define PLATFORM_ALIGNMENT (__alignof__ (align_test))
|
||||
#else
|
||||
# define PLATFORM_ALIGNMENT (sizeof(align_test))
|
||||
#define PLATFORM_ALIGNMENT (sizeof(align_test))
|
||||
#endif
|
||||
|
||||
#define MEM_HEADER_PADDING (((PLATFORM_ALIGNMENT-sizeof(zend_mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT)
|
||||
@@ -75,19 +75,15 @@ typedef union _align_test {
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API char *zend_strndup(const char *s, unsigned int length);
|
||||
|
||||
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
|
||||
#define USE_ZEND_ALLOC 1
|
||||
|
||||
#if USE_ZEND_ALLOC
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
|
||||
/* Standard wrapper macros */
|
||||
#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
@@ -117,66 +113,13 @@ ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZE
|
||||
#define perealloc_recoverable(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable((ptr), (size)))
|
||||
#define pestrdup(s, persistent) ((persistent)?strdup(s):estrdup(s))
|
||||
|
||||
#define pemalloc_rel(size, persistent) ((persistent)?malloc(size):emalloc_rel(size))
|
||||
#define pefree_rel(ptr, persistent) ((persistent)?free(ptr):efree_rel(ptr))
|
||||
#define pecalloc_rel(nmemb, size, persistent) ((persistent)?calloc((nmemb), (size)):ecalloc_rel((nmemb), (size)))
|
||||
#define perealloc_rel(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_rel((ptr), (size)))
|
||||
#define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size)))
|
||||
#define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
|
||||
|
||||
#else
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#undef _GNU_SOURCE
|
||||
|
||||
/* Standard wrapper macros */
|
||||
#define emalloc(size) malloc(size)
|
||||
#define safe_emalloc(nmemb, size, offset) malloc((nmemb) * (size) + (offset))
|
||||
#define efree(ptr) free(ptr)
|
||||
#define ecalloc(nmemb, size) calloc((nmemb), (size))
|
||||
#define erealloc(ptr, size) realloc((ptr), (size))
|
||||
#define erealloc_recoverable(ptr, size) realloc((ptr), (size))
|
||||
#define estrdup(s) strdup(s)
|
||||
#define estrndup(s, length) strndup((s), (length))
|
||||
|
||||
/* Relay wrapper macros */
|
||||
#define emalloc_rel(size) malloc(size)
|
||||
#define safe_emalloc_rel(nmemb, size, offset) malloc((nmemb) * (size) + (offset))
|
||||
#define efree_rel(ptr) free(ptr)
|
||||
#define ecalloc_rel(nmemb, size) calloc((nmemb), (size))
|
||||
#define erealloc_rel(ptr, size) realloc((ptr), (size))
|
||||
#define erealloc_recoverable_rel(ptr, size) realloc((ptr), (size))
|
||||
#define estrdup_rel(s) strdup(s)
|
||||
#define estrndup_rel(s, length) strndup((s), (length))
|
||||
|
||||
/* Selective persistent/non persistent allocation macros */
|
||||
#define pemalloc(size, persistent) malloc(size)
|
||||
#define pefree(ptr, persistent) free(ptr)
|
||||
#define pecalloc(nmemb, size, persistent) calloc((nmemb), (size))
|
||||
#define perealloc(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define perealloc_recoverable(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define pestrdup(s, persistent) strdup(s)
|
||||
|
||||
#define pemalloc_rel(size, persistent) malloc(size)
|
||||
#define pefree_rel(ptr, persistent) free(ptr)
|
||||
#define pecalloc_rel(nmemb, size, persistent) calloc((nmemb), (size))
|
||||
#define perealloc_rel(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define perealloc_recoverable_rel(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define pestrdup_rel(s, persistent) strdup(s)
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(strdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(strndup((ptr), (len))):(empty_string))
|
||||
|
||||
#endif
|
||||
|
||||
ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
|
||||
|
||||
ZEND_API void start_memory_manager(TSRMLS_D);
|
||||
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC);
|
||||
ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
ZEND_BEGIN_ARG_INFO(first_arg_force_ref, 0)
|
||||
ZEND_ARG_PASS_INFO(1)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(second_arg_force_ref, 0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(1)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(third_arg_force_ref, 0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(1)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(fourth_arg_force_ref, 0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(0)
|
||||
ZEND_ARG_PASS_INFO(1)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(all_args_by_ref, 1)
|
||||
ZEND_END_ARG_INFO();
|
||||
|
||||
+126
-224
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -63,7 +63,6 @@ static ZEND_FUNCTION(restore_error_handler);
|
||||
static ZEND_FUNCTION(set_exception_handler);
|
||||
static ZEND_FUNCTION(restore_exception_handler);
|
||||
static ZEND_FUNCTION(get_declared_classes);
|
||||
static ZEND_FUNCTION(get_declared_interfaces);
|
||||
static ZEND_FUNCTION(get_defined_functions);
|
||||
static ZEND_FUNCTION(get_defined_vars);
|
||||
static ZEND_FUNCTION(create_function);
|
||||
@@ -81,8 +80,9 @@ static ZEND_FUNCTION(zend_thread_id);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "zend_arg_defs.c"
|
||||
|
||||
ZEND_API unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE };
|
||||
ZEND_API unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
|
||||
ZEND_API unsigned char third_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
|
||||
|
||||
static zend_function_entry builtin_functions[] = {
|
||||
ZEND_FE(zend_version, NULL)
|
||||
@@ -123,7 +123,6 @@ static zend_function_entry builtin_functions[] = {
|
||||
ZEND_FE(set_exception_handler, NULL)
|
||||
ZEND_FE(restore_exception_handler, NULL)
|
||||
ZEND_FE(get_declared_classes, NULL)
|
||||
ZEND_FE(get_declared_interfaces, NULL)
|
||||
ZEND_FE(get_defined_functions, NULL)
|
||||
ZEND_FE(get_defined_vars, NULL)
|
||||
ZEND_FE(create_function, NULL)
|
||||
@@ -218,7 +217,7 @@ ZEND_FUNCTION(func_get_arg)
|
||||
arg_count = (ulong) *p;
|
||||
|
||||
if (requested_offset>=arg_count) {
|
||||
zend_error(E_WARNING, "func_get_arg(): Argument %ld not passed to function", requested_offset);
|
||||
zend_error(E_WARNING, "func_get_arg(): Argument %d not passed to function", requested_offset);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -353,7 +352,6 @@ ZEND_FUNCTION(each)
|
||||
{
|
||||
zval **array, *entry, **entry_ptr, *tmp;
|
||||
char *string_key;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
zval **inserted_pointer;
|
||||
HashTable *target_hash;
|
||||
@@ -388,9 +386,9 @@ ZEND_FUNCTION(each)
|
||||
entry->refcount++;
|
||||
|
||||
/* add the key elements */
|
||||
switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 1, NULL)) {
|
||||
switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 1)) {
|
||||
case HASH_KEY_IS_STRING:
|
||||
add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, 0);
|
||||
add_get_index_string(return_value, 0, string_key, (void **) &inserted_pointer, 0);
|
||||
break;
|
||||
case HASH_KEY_IS_LONG:
|
||||
add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer);
|
||||
@@ -482,7 +480,6 @@ ZEND_FUNCTION(define)
|
||||
c.flags = case_sensitive; /* non persistent */
|
||||
c.name = zend_strndup((*var)->value.str.val, (*var)->value.str.len);
|
||||
c.name_len = (*var)->value.str.len+1;
|
||||
c.module_number = PHP_USER_CONSTANT;
|
||||
if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
@@ -506,15 +503,15 @@ ZEND_FUNCTION(defined)
|
||||
convert_to_string_ex(var);
|
||||
if (zend_get_constant((*var)->value.str.val, (*var)->value.str.len, &c TSRMLS_CC)) {
|
||||
zval_dtor(&c);
|
||||
RETURN_TRUE;
|
||||
RETURN_LONG(1);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
RETURN_LONG(0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto string get_class([object object])
|
||||
/* {{{ proto string get_class(object object)
|
||||
Retrieves the class name */
|
||||
ZEND_FUNCTION(get_class)
|
||||
{
|
||||
@@ -522,13 +519,6 @@ ZEND_FUNCTION(get_class)
|
||||
char *name = "";
|
||||
zend_uint name_len = 0;
|
||||
|
||||
if (!ZEND_NUM_ARGS()) {
|
||||
if (EG(scope)) {
|
||||
RETURN_STRINGL(EG(scope)->name, EG(scope)->name_length, 1);
|
||||
} else {
|
||||
zend_error(E_ERROR, "get_class() called without object from outside a class");
|
||||
}
|
||||
}
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
@@ -567,15 +557,20 @@ ZEND_FUNCTION(get_parent_class)
|
||||
}
|
||||
|
||||
if (Z_TYPE_PP(arg) == IS_OBJECT) {
|
||||
|
||||
if (Z_OBJ_HT_PP(arg)->get_class_name
|
||||
&& Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_length, 1 TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_STRINGL(name, name_length, 0);
|
||||
} else if (Z_OBJ_HT_PP(arg)->get_class_entry && (ce = zend_get_class_entry(*arg TSRMLS_CC))) {
|
||||
RETURN_STRINGL(ce->name, ce->name_length, 1);
|
||||
} else {
|
||||
ce = zend_get_class_entry(*arg TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else if (Z_TYPE_PP(arg) == IS_STRING) {
|
||||
zend_class_entry **pce;
|
||||
|
||||
SEPARATE_ZVAL(arg);
|
||||
zend_str_tolower(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg));
|
||||
if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
}
|
||||
@@ -593,6 +588,7 @@ ZEND_FUNCTION(get_parent_class)
|
||||
static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
{
|
||||
zval **obj, **class_name;
|
||||
char *lcname;
|
||||
zend_class_entry *instance_ce;
|
||||
zend_class_entry **ce;
|
||||
zend_bool retval;
|
||||
@@ -612,7 +608,10 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
|
||||
convert_to_string_ex(class_name);
|
||||
|
||||
if (zend_lookup_class(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == FAILURE) {
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name));
|
||||
|
||||
if (zend_lookup_class(lcname, Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == FAILURE) {
|
||||
efree(lcname);
|
||||
retval = 0;
|
||||
} else {
|
||||
if (only_subclass) {
|
||||
@@ -621,10 +620,6 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
instance_ce = Z_OBJCE_PP(obj);
|
||||
}
|
||||
|
||||
if (!instance_ce) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (instanceof_function(instance_ce, *ce TSRMLS_CC)) {
|
||||
retval = 1;
|
||||
} else {
|
||||
@@ -632,6 +627,8 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
|
||||
}
|
||||
}
|
||||
|
||||
efree(lcname);
|
||||
|
||||
RETURN_BOOL(retval);
|
||||
}
|
||||
|
||||
@@ -649,7 +646,6 @@ ZEND_FUNCTION(is_subclass_of)
|
||||
Returns true if the object is of this class or has this class as one of its parents */
|
||||
ZEND_FUNCTION(is_a)
|
||||
{
|
||||
zend_error(E_STRICT, "is_a(): Deprecated. Please use the instanceof operator");
|
||||
is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -660,54 +656,29 @@ ZEND_FUNCTION(is_a)
|
||||
ZEND_FUNCTION(get_class_vars)
|
||||
{
|
||||
zval **class_name;
|
||||
char *lcname;
|
||||
zend_class_entry *ce, **pce;
|
||||
zval *tmp;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
convert_to_string_ex(class_name);
|
||||
|
||||
if (zend_lookup_class(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), &pce TSRMLS_CC) == FAILURE) {
|
||||
lcname = zend_str_tolower_dup((*class_name)->value.str.val, (*class_name)->value.str.len);
|
||||
|
||||
if (zend_lookup_class(lcname, Z_STRLEN_PP(class_name), &pce TSRMLS_CC) == FAILURE) {
|
||||
efree(lcname);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
ce = *pce;
|
||||
efree(lcname);
|
||||
array_init(return_value);
|
||||
|
||||
if (zend_hash_num_elements(&ce->default_properties) > 0) {
|
||||
HashPosition pos;
|
||||
zval **prop;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(&ce->default_properties, &pos);
|
||||
while (zend_hash_get_current_data_ex(&ce->default_properties, (void **) &prop, &pos) == SUCCESS) {
|
||||
char *key, *class_name, *prop_name;
|
||||
uint key_len;
|
||||
ulong num_index;
|
||||
zval *prop_copy;
|
||||
|
||||
zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos);
|
||||
zend_hash_move_forward_ex(&ce->default_properties, &pos);
|
||||
zend_unmangle_property_name(key, &class_name, &prop_name);
|
||||
if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) {
|
||||
/* filter privates from base classes */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* copy: enforce read only access */
|
||||
ALLOC_ZVAL(prop_copy);
|
||||
*prop_copy = **prop;
|
||||
zval_copy_ctor(prop_copy);
|
||||
INIT_PZVAL(prop_copy);
|
||||
|
||||
/* this is necessary to make it able to work with default array
|
||||
* properties, returned to user */
|
||||
if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || Z_TYPE_P(prop_copy) == IS_CONSTANT) {
|
||||
zval_update_constant(&prop_copy, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
add_assoc_zval(return_value, prop_name, prop_copy);
|
||||
}
|
||||
if (!ce->constants_updated) {
|
||||
zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
ce->constants_updated = 1;
|
||||
}
|
||||
zend_hash_copy(return_value->value.ht, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -718,12 +689,7 @@ ZEND_FUNCTION(get_class_vars)
|
||||
ZEND_FUNCTION(get_object_vars)
|
||||
{
|
||||
zval **obj;
|
||||
zval **value;
|
||||
HashTable *properties;
|
||||
HashPosition pos;
|
||||
char *key;
|
||||
uint key_len;
|
||||
ulong num_index;
|
||||
zval *tmp;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &obj) == FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
@@ -737,18 +703,8 @@ ZEND_FUNCTION(get_object_vars)
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
properties = Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC);
|
||||
zend_hash_internal_pointer_reset_ex(properties, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
|
||||
if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING && key[0]) {
|
||||
/* Not separating references */
|
||||
(*value)->refcount++;
|
||||
add_assoc_zval_ex(return_value, key, key_len, *value);
|
||||
}
|
||||
zend_hash_move_forward_ex(properties, &pos);
|
||||
}
|
||||
zend_hash_copy(return_value->value.ht, Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC),
|
||||
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -760,8 +716,9 @@ ZEND_FUNCTION(get_class_methods)
|
||||
zval **class;
|
||||
zval *method_name;
|
||||
zend_class_entry *ce = NULL, **pce;
|
||||
HashPosition pos;
|
||||
zend_function *mptr;
|
||||
char *string_key;
|
||||
ulong num_key;
|
||||
int key_type;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
@@ -774,6 +731,9 @@ ZEND_FUNCTION(get_class_methods)
|
||||
}
|
||||
ce = Z_OBJCE_PP(class);
|
||||
} else if (Z_TYPE_PP(class) == IS_STRING) {
|
||||
SEPARATE_ZVAL(class);
|
||||
zend_str_tolower(Z_STRVAL_PP(class), Z_STRLEN_PP(class));
|
||||
|
||||
if (zend_lookup_class(Z_STRVAL_PP(class), Z_STRLEN_PP(class), &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
}
|
||||
@@ -784,17 +744,17 @@ ZEND_FUNCTION(get_class_methods)
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRING(method_name, mptr->common.function_name, 1);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
zend_hash_move_forward_ex(&ce->function_table, &pos);
|
||||
zend_hash_internal_pointer_reset(&ce->function_table);
|
||||
while ((key_type = zend_hash_get_current_key(&ce->function_table, &string_key, &num_key, 1)) != HASH_KEY_NON_EXISTANT) {
|
||||
if (key_type == HASH_KEY_IS_STRING) {
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRING(method_name, string_key, 0);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
}
|
||||
zend_hash_move_forward(&ce->function_table);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
\
|
||||
|
||||
|
||||
/* {{{ proto bool method_exists(object object, string method)
|
||||
@@ -828,32 +788,25 @@ ZEND_FUNCTION(method_exists)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool class_exists(string classname [, bool autoload])
|
||||
/* {{{ proto bool class_exists(string classname)
|
||||
Checks if the class exists */
|
||||
ZEND_FUNCTION(class_exists)
|
||||
{
|
||||
char *class_name, *lc_name;
|
||||
zval **class_name;
|
||||
char *lcname;
|
||||
zend_class_entry **ce;
|
||||
int class_name_len;
|
||||
zend_bool autoload = 1;
|
||||
int found;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &class_name, &class_name_len, &autoload) == FAILURE) {
|
||||
return;
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
if (!autoload) {
|
||||
lc_name = do_alloca(class_name_len + 1);
|
||||
zend_str_tolower_copy(lc_name, class_name, class_name_len);
|
||||
|
||||
found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
|
||||
free_alloca(lc_name);
|
||||
RETURN_BOOL(found == SUCCESS);
|
||||
}
|
||||
|
||||
if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC) == SUCCESS) {
|
||||
convert_to_string_ex(class_name);
|
||||
lcname = zend_str_tolower_dup((*class_name)->value.str.val, (*class_name)->value.str.len);
|
||||
if (zend_lookup_class(lcname, Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == SUCCESS) {
|
||||
efree(lcname);
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
efree(lcname);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -866,7 +819,7 @@ ZEND_FUNCTION(function_exists)
|
||||
{
|
||||
zval **function_name;
|
||||
zend_function *func;
|
||||
char *lcname;
|
||||
char *lcname, *func_name_end;
|
||||
zend_bool retval;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) {
|
||||
@@ -875,6 +828,7 @@ ZEND_FUNCTION(function_exists)
|
||||
convert_to_string_ex(function_name);
|
||||
lcname = zend_str_tolower_dup((*function_name)->value.str.val, (*function_name)->value.str.len);
|
||||
|
||||
func_name_end = lcname + (*function_name)->value.str.len;
|
||||
retval = (zend_hash_find(EG(function_table), lcname, (*function_name)->value.str.len+1, (void **)&func) == SUCCESS);
|
||||
|
||||
efree(lcname);
|
||||
@@ -982,20 +936,19 @@ ZEND_FUNCTION(trigger_error)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto string set_error_handler(string error_handler [, int error_types])
|
||||
/* {{{ proto string set_error_handler(string error_handler)
|
||||
Sets a user-defined error handler function. Returns the previously defined error handler, or false on error */
|
||||
ZEND_FUNCTION(set_error_handler)
|
||||
{
|
||||
zval *error_handler;
|
||||
zval **error_handler;
|
||||
zend_bool had_orig_error_handler=0;
|
||||
char *error_handler_name = NULL;
|
||||
long error_type = E_ALL | E_STRICT;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) {
|
||||
return;
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &error_handler)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
if (!zend_is_callable(error_handler, 0, &error_handler_name)) {
|
||||
if (!zend_is_callable(*error_handler, 0, &error_handler_name)) {
|
||||
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
|
||||
get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name:"unknown");
|
||||
efree(error_handler_name);
|
||||
@@ -1007,19 +960,17 @@ ZEND_FUNCTION(set_error_handler)
|
||||
had_orig_error_handler = 1;
|
||||
*return_value = *EG(user_error_handler);
|
||||
zval_copy_ctor(return_value);
|
||||
zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting), sizeof(EG(user_error_handler_error_reporting)));
|
||||
zend_ptr_stack_push(&EG(user_error_handlers), EG(user_error_handler));
|
||||
}
|
||||
ALLOC_ZVAL(EG(user_error_handler));
|
||||
|
||||
if (!zend_is_true(error_handler)) { /* unset user-defined handler */
|
||||
if (!zend_is_true(*error_handler)) { /* unset user-defined handler */
|
||||
FREE_ZVAL(EG(user_error_handler));
|
||||
EG(user_error_handler) = NULL;
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
EG(user_error_handler_error_reporting) = (int)error_type;
|
||||
*EG(user_error_handler) = *error_handler;
|
||||
*EG(user_error_handler) = **error_handler;
|
||||
zval_copy_ctor(EG(user_error_handler));
|
||||
|
||||
if (!had_orig_error_handler) {
|
||||
@@ -1034,17 +985,11 @@ ZEND_FUNCTION(set_error_handler)
|
||||
ZEND_FUNCTION(restore_error_handler)
|
||||
{
|
||||
if (EG(user_error_handler)) {
|
||||
zval *zeh = EG(user_error_handler);
|
||||
|
||||
EG(user_error_handler) = NULL;
|
||||
zval_ptr_dtor(&zeh);
|
||||
zval_ptr_dtor(&EG(user_error_handler));
|
||||
}
|
||||
|
||||
if (zend_ptr_stack_num_elements(&EG(user_error_handlers))==0) {
|
||||
EG(user_error_handler) = NULL;
|
||||
} else {
|
||||
EG(user_error_handler_error_reporting) = zend_stack_int_top(&EG(user_error_handlers_error_reporting));
|
||||
zend_stack_del_top(&EG(user_error_handlers_error_reporting));
|
||||
EG(user_error_handler) = zend_ptr_stack_pop(&EG(user_error_handlers));
|
||||
}
|
||||
RETURN_TRUE;
|
||||
@@ -1052,26 +997,18 @@ ZEND_FUNCTION(restore_error_handler)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto string set_exception_handler(callable exception_handler)
|
||||
/* {{{ proto string set_exception_handler(string exception_handler)
|
||||
Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */
|
||||
ZEND_FUNCTION(set_exception_handler)
|
||||
{
|
||||
zval **exception_handler;
|
||||
char *exception_handler_name = NULL;
|
||||
zend_bool had_orig_exception_handler=0;
|
||||
|
||||
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &exception_handler)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) {
|
||||
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
|
||||
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
|
||||
efree(exception_handler_name);
|
||||
return;
|
||||
}
|
||||
efree(exception_handler_name);
|
||||
|
||||
convert_to_string_ex(exception_handler);
|
||||
if (EG(user_exception_handler)) {
|
||||
had_orig_exception_handler = 1;
|
||||
*return_value = *EG(user_exception_handler);
|
||||
@@ -1113,19 +1050,15 @@ ZEND_FUNCTION(restore_exception_handler)
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int copy_class_or_interface_name(zend_class_entry **pce, int num_args, va_list args, zend_hash_key *hash_key)
|
||||
static int copy_class_name(zend_class_entry **pce, int num_args, va_list args, zend_hash_key *hash_key)
|
||||
{
|
||||
zval *array = va_arg(args, zval *);
|
||||
int mask = va_arg(args, int);
|
||||
int comply = va_arg(args, int);
|
||||
int comply_mask = (comply)? mask:0;
|
||||
zend_class_entry *ce = *pce;
|
||||
|
||||
if ((hash_key->nKeyLength==0 || hash_key->arKey[0]!=0)
|
||||
&& (comply_mask == (ce->ce_flags & mask))) {
|
||||
if (hash_key->nKeyLength==0 || hash_key->arKey[0]!=0) {
|
||||
add_next_index_stringl(array, ce->name, ce->name_length, 1);
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1133,31 +1066,11 @@ static int copy_class_or_interface_name(zend_class_entry **pce, int num_args, va
|
||||
Returns an array of all declared classes. */
|
||||
ZEND_FUNCTION(get_declared_classes)
|
||||
{
|
||||
int mask = ZEND_ACC_INTERFACE;
|
||||
int comply = 0;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 0) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) copy_class_or_interface_name, 3, return_value, mask, comply);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array get_declared_interfaces()
|
||||
Returns an array of all declared interfaces. */
|
||||
ZEND_FUNCTION(get_declared_interfaces)
|
||||
{
|
||||
int mask = ZEND_ACC_INTERFACE;
|
||||
int comply = 1;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 0) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) copy_class_or_interface_name, 3, return_value, mask, comply);
|
||||
zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) copy_class_name, 1, return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1378,53 +1291,60 @@ ZEND_FUNCTION(get_defined_constants)
|
||||
if (argc) {
|
||||
HashPosition pos;
|
||||
zend_constant *val;
|
||||
int module_number;
|
||||
zval **modules;
|
||||
int prev_module_number = -1;
|
||||
char **module_names;
|
||||
zval *module_constants = NULL;
|
||||
zend_module_entry *module;
|
||||
int i = 1;
|
||||
|
||||
modules = ecalloc(zend_hash_num_elements(&module_registry) + 2, sizeof(zval *));
|
||||
module_names = emalloc((zend_hash_num_elements(&module_registry) + 2) * sizeof(char *));
|
||||
|
||||
module_names[0] = "internal";
|
||||
module_names = emalloc((zend_hash_num_elements(&module_registry) + 1) * sizeof(char *));
|
||||
zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
|
||||
while (zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) != FAILURE) {
|
||||
while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &module, &pos) != FAILURE) {
|
||||
module_names[i++] = module->name;
|
||||
zend_hash_move_forward_ex(&module_registry, &pos);
|
||||
}
|
||||
module_names[i] = "user";
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(EG(zend_constants), &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) {
|
||||
zval *const_val;
|
||||
|
||||
if (val->module_number == PHP_USER_CONSTANT) {
|
||||
module_number = i;
|
||||
} else if (val->module_number > i || val->module_number < 0) {
|
||||
/* should not happen */
|
||||
goto bad_module_id;
|
||||
} else {
|
||||
module_number = val->module_number;
|
||||
}
|
||||
if (val->module_number != prev_module_number) {
|
||||
if (prev_module_number != -1) {
|
||||
if (prev_module_number == 0) {
|
||||
add_assoc_zval(return_value, "internal", module_constants);
|
||||
} else if (prev_module_number <= i) {
|
||||
add_assoc_zval(return_value, module_names[prev_module_number], module_constants);
|
||||
} else {
|
||||
add_assoc_zval(return_value, "user", module_constants);
|
||||
}
|
||||
}
|
||||
|
||||
if (!modules[module_number]) {
|
||||
MAKE_STD_ZVAL(modules[module_number]);
|
||||
array_init(modules[module_number]);
|
||||
add_assoc_zval(return_value, module_names[module_number], modules[module_number]);
|
||||
}
|
||||
MAKE_STD_ZVAL(module_constants);
|
||||
array_init(module_constants);
|
||||
|
||||
prev_module_number = val->module_number;
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(const_val);
|
||||
*const_val = val->value;
|
||||
zval_copy_ctor(const_val);
|
||||
INIT_PZVAL(const_val);
|
||||
|
||||
add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val);
|
||||
bad_module_id:
|
||||
add_assoc_zval_ex(module_constants, val->name, val->name_len, const_val);
|
||||
|
||||
zend_hash_move_forward_ex(EG(zend_constants), &pos);
|
||||
}
|
||||
if (module_constants) {
|
||||
if (prev_module_number == 0) {
|
||||
add_assoc_zval(return_value, "internal", module_constants);
|
||||
} else if (prev_module_number <= i) {
|
||||
add_assoc_zval(return_value, module_names[prev_module_number], module_constants);
|
||||
} else {
|
||||
add_assoc_zval(return_value, "user", module_constants);
|
||||
}
|
||||
}
|
||||
efree(module_names);
|
||||
efree(modules);
|
||||
} else {
|
||||
zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) add_constant_info, return_value TSRMLS_CC);
|
||||
}
|
||||
@@ -1432,8 +1352,7 @@ bad_module_id:
|
||||
/* }}} */
|
||||
|
||||
|
||||
static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC)
|
||||
{
|
||||
static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) {
|
||||
void **p = *curpos - 2;
|
||||
zval *arg_array, **arg;
|
||||
int arg_count = (ulong) *p;
|
||||
@@ -1490,14 +1409,14 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
while (--args > EG(argument_stack).elements) {
|
||||
while (--args >= EG(argument_stack).elements) {
|
||||
if (*args--) {
|
||||
break;
|
||||
}
|
||||
args -= *(ulong*)args;
|
||||
frames_on_stack++;
|
||||
|
||||
if ((args-1) == EG(argument_stack).elements) {
|
||||
if (args == EG(argument_stack).elements) {
|
||||
arg_stack_consistent = 1;
|
||||
break;
|
||||
}
|
||||
@@ -1513,13 +1432,11 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
array_init(return_value);
|
||||
|
||||
while (ptr) {
|
||||
class_name = call_type = NULL;
|
||||
if (ptr->op_array) {
|
||||
filename = ptr->op_array->filename;
|
||||
lineno = ptr->opline->lineno;
|
||||
} else {
|
||||
filename = NULL;
|
||||
lineno = 0;
|
||||
}
|
||||
|
||||
function_name = ptr->function_state.function->common.function_name;
|
||||
@@ -1575,7 +1492,6 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
array_init(arg_array);
|
||||
add_next_index_string(arg_array, include_filename, 1);
|
||||
}
|
||||
call_type = NULL;
|
||||
}
|
||||
zend_printf("#%-2d ", indent);
|
||||
if (class_name) {
|
||||
@@ -1595,8 +1511,9 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRMLS_DC)
|
||||
/* {{{ proto void debug_backtrace(void)
|
||||
Prints out a backtrace */
|
||||
ZEND_FUNCTION(debug_backtrace)
|
||||
{
|
||||
zend_execute_data *ptr;
|
||||
int lineno;
|
||||
@@ -1611,14 +1528,18 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
int arg_stack_consistent = 0;
|
||||
int frames_on_stack = 0;
|
||||
|
||||
while (--args > EG(argument_stack).elements) {
|
||||
if (ZEND_NUM_ARGS()) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
while (--args >= EG(argument_stack).elements) {
|
||||
if (*args--) {
|
||||
break;
|
||||
}
|
||||
args -= *(ulong*)args;
|
||||
frames_on_stack++;
|
||||
|
||||
if ((args-1) == EG(argument_stack).elements) {
|
||||
if (args == EG(argument_stack).elements) {
|
||||
arg_stack_consistent = 1;
|
||||
break;
|
||||
}
|
||||
@@ -1628,11 +1549,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
|
||||
/* skip debug_backtrace() */
|
||||
ptr = ptr->prev_execute_data;
|
||||
if (skip_last--) {
|
||||
int arg_count = *((ulong*)(cur_arg_pos - 2));
|
||||
cur_arg_pos -= (arg_count + 2);
|
||||
frames_on_stack--;
|
||||
}
|
||||
cur_arg_pos -= 2;
|
||||
frames_on_stack--;
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
@@ -1736,37 +1654,22 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto array debug_backtrace(void)
|
||||
Return backtrace as array */
|
||||
ZEND_FUNCTION(debug_backtrace)
|
||||
{
|
||||
if (ZEND_NUM_ARGS()) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
zend_fetch_debug_backtrace(return_value, 1 TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool extension_loaded(string extension_name)
|
||||
Returns true if the named extension is loaded */
|
||||
ZEND_FUNCTION(extension_loaded)
|
||||
{
|
||||
zval **extension_name;
|
||||
char *lcname;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
convert_to_string_ex(extension_name);
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name));
|
||||
if (zend_hash_exists(&module_registry, lcname, Z_STRLEN_PP(extension_name)+1)) {
|
||||
RETVAL_TRUE;
|
||||
if (zend_hash_exists(&module_registry, Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name)+1)) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(lcname);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1806,7 +1709,6 @@ ZEND_FUNCTION(get_extension_funcs)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -24,10 +24,6 @@
|
||||
|
||||
int zend_startup_builtin_functions(TSRMLS_D);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRMLS_DC);
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif /* ZEND_BUILTIN_FUNCTIONS_H */
|
||||
|
||||
/*
|
||||
|
||||
+540
-832
File diff suppressed because it is too large.
Load diff
+75
-126
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -52,6 +52,7 @@ typedef struct _zend_op zend_op;
|
||||
|
||||
typedef struct _znode {
|
||||
int op_type;
|
||||
zend_llist *throw_list; /* Try and save this space later on */
|
||||
union {
|
||||
zval constant;
|
||||
|
||||
@@ -68,12 +69,12 @@ typedef struct _znode {
|
||||
|
||||
typedef struct _zend_execute_data zend_execute_data;
|
||||
|
||||
#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data, zend_op *opline, zend_op_array *op_array TSRMLS_DC
|
||||
#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data, opline, op_array TSRMLS_CC
|
||||
#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data, zend_op_array *op_array TSRMLS_DC
|
||||
#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data, op_array TSRMLS_CC
|
||||
|
||||
typedef int (*opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
|
||||
|
||||
extern ZEND_API opcode_handler_t zend_opcode_handlers[512];
|
||||
extern opcode_handler_t zend_opcode_handlers[512];
|
||||
|
||||
struct _zend_op {
|
||||
opcode_handler_t handler;
|
||||
@@ -93,27 +94,13 @@ typedef struct _zend_brk_cont_element {
|
||||
} zend_brk_cont_element;
|
||||
|
||||
|
||||
typedef struct _zend_try_catch_element {
|
||||
zend_uint try_op;
|
||||
zend_uint catch_op; /* ketchup! */
|
||||
} zend_try_catch_element;
|
||||
|
||||
|
||||
/* method flags (types) */
|
||||
#define ZEND_ACC_STATIC 0x01
|
||||
#define ZEND_ACC_ABSTRACT 0x02
|
||||
#define ZEND_ACC_FINAL 0x04
|
||||
#define ZEND_ACC_IMPLEMENTED_ABSTRACT 0x08
|
||||
#define ZEND_ACC_INTERFACE 0x08
|
||||
#define ZEND_ACC_ABSTRACT_CLASS 0x10
|
||||
#define ZEND_ACC_FINAL_CLASS 0x20
|
||||
|
||||
/* class flags (types) */
|
||||
/* ZEND_ACC_IMPLICIT_ABSTRACT_CLASS is used for abstract classes (since it is set by any abstract method even interfaces MAY have it set, too). */
|
||||
/* ZEND_ACC_EXPLICIT_ABSTRACT_CLASS denotes that a class was explicitly defined as abstract by using the keyword. */
|
||||
#define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS 0x10
|
||||
#define ZEND_ACC_EXPLICIT_ABSTRACT_CLASS 0x20
|
||||
#define ZEND_ACC_FINAL_CLASS 0x40
|
||||
#define ZEND_ACC_INTERFACE 0x80
|
||||
|
||||
/* method flags (visibility) */
|
||||
/* The order of those must be kept - public < protected < private */
|
||||
#define ZEND_ACC_PUBLIC 0x100
|
||||
#define ZEND_ACC_PROTECTED 0x200
|
||||
@@ -123,14 +110,6 @@ typedef struct _zend_try_catch_element {
|
||||
#define ZEND_ACC_CHANGED 0x800
|
||||
#define ZEND_ACC_IMPLICIT_PUBLIC 0x1000
|
||||
|
||||
/* method flags (special method detection) */
|
||||
#define ZEND_ACC_CTOR 0x2000
|
||||
#define ZEND_ACC_DTOR 0x4000
|
||||
#define ZEND_ACC_CLONE 0x8000
|
||||
|
||||
/* method flag (bc only), any method that has this flag can be used statically and non statically. */
|
||||
#define ZEND_ACC_ALLOW_STATIC 0x10000
|
||||
|
||||
char *zend_visibility_string(zend_uint fn_flags);
|
||||
|
||||
|
||||
@@ -142,29 +121,14 @@ typedef struct _zend_property_info {
|
||||
} zend_property_info;
|
||||
|
||||
|
||||
typedef struct _zend_arg_info {
|
||||
char *name;
|
||||
zend_uint name_len;
|
||||
char *class_name;
|
||||
zend_uint class_name_len;
|
||||
zend_bool allow_null;
|
||||
zend_bool pass_by_reference;
|
||||
zend_bool return_reference;
|
||||
int required_num_args;
|
||||
} zend_arg_info;
|
||||
|
||||
struct _zend_op_array {
|
||||
/* Common elements */
|
||||
zend_uchar type;
|
||||
zend_uchar *arg_types;
|
||||
char *function_name;
|
||||
zend_class_entry *scope;
|
||||
zend_uint fn_flags;
|
||||
union _zend_function *prototype;
|
||||
zend_uint num_args;
|
||||
zend_uint required_num_args;
|
||||
zend_arg_info *arg_info;
|
||||
zend_bool pass_rest_by_reference;
|
||||
unsigned char return_reference;
|
||||
/* END of common elements */
|
||||
|
||||
zend_uint *refcount;
|
||||
@@ -178,15 +142,13 @@ struct _zend_op_array {
|
||||
zend_uint last_brk_cont;
|
||||
zend_uint current_brk_cont;
|
||||
|
||||
zend_try_catch_element *try_catch_array;
|
||||
int last_try_catch;
|
||||
|
||||
/* static variables support */
|
||||
HashTable *static_variables;
|
||||
|
||||
zend_op *start_op;
|
||||
int backpatch_count;
|
||||
|
||||
zend_bool return_reference;
|
||||
zend_bool done_pass_two;
|
||||
zend_bool uses_this;
|
||||
|
||||
@@ -200,22 +162,14 @@ struct _zend_op_array {
|
||||
};
|
||||
|
||||
|
||||
#define ZEND_RETURN_VALUE 0
|
||||
#define ZEND_RETURN_REFERENCE 1
|
||||
#define ZEND_RETURN_REFERENCE_AGNOSTIC 2
|
||||
|
||||
typedef struct _zend_internal_function {
|
||||
/* Common elements */
|
||||
zend_uchar type;
|
||||
zend_uchar *arg_types;
|
||||
char *function_name;
|
||||
zend_class_entry *scope;
|
||||
zend_uint fn_flags;
|
||||
union _zend_function *prototype;
|
||||
zend_uint num_args;
|
||||
zend_uint required_num_args;
|
||||
zend_arg_info *arg_info;
|
||||
zend_bool pass_rest_by_reference;
|
||||
unsigned char return_reference;
|
||||
/* END of common elements */
|
||||
|
||||
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
|
||||
@@ -228,15 +182,11 @@ typedef union _zend_function {
|
||||
|
||||
struct {
|
||||
zend_uchar type; /* never used */
|
||||
zend_uchar *arg_types;
|
||||
char *function_name;
|
||||
zend_class_entry *scope;
|
||||
zend_uint fn_flags;
|
||||
union _zend_function *prototype;
|
||||
zend_uint num_args;
|
||||
zend_uint required_num_args;
|
||||
zend_arg_info *arg_info;
|
||||
zend_bool pass_rest_by_reference;
|
||||
unsigned char return_reference;
|
||||
} common;
|
||||
|
||||
zend_op_array op_array;
|
||||
@@ -299,6 +249,12 @@ void zend_init_compiler_data_structures(TSRMLS_D);
|
||||
|
||||
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
|
||||
|
||||
void zend_activate(TSRMLS_D);
|
||||
void zend_deactivate(TSRMLS_D);
|
||||
void zend_activate_modules(TSRMLS_D);
|
||||
void zend_deactivate_modules(TSRMLS_D);
|
||||
|
||||
|
||||
ZEND_API int lex_scan(zval *zendlval TSRMLS_DC);
|
||||
void startup_scanner(TSRMLS_D);
|
||||
void shutdown_scanner(TSRMLS_D);
|
||||
@@ -315,6 +271,8 @@ int zend_get_zendleng(TSRMLS_D);
|
||||
|
||||
|
||||
/* parser-driven code generators */
|
||||
void zend_do_fold_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
void zend_do_fold_constant(znode *result, znode *constant_name TSRMLS_DC);
|
||||
void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC);
|
||||
void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
@@ -368,31 +326,29 @@ void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC);
|
||||
int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier);
|
||||
void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC);
|
||||
void zend_do_end_function_declaration(znode *function_token TSRMLS_DC);
|
||||
void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, znode *varname, zend_bool pass_by_reference TSRMLS_DC);
|
||||
void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, zend_uchar pass_type TSRMLS_DC);
|
||||
int zend_do_begin_function_call(znode *function_name TSRMLS_DC);
|
||||
void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC);
|
||||
void zend_do_clone(znode *result, znode *expr TSRMLS_DC);
|
||||
void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC);
|
||||
void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC);
|
||||
void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name TSRMLS_DC);
|
||||
void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name, zend_bool case_sensitive TSRMLS_DC);
|
||||
void zend_do_begin_class_member_function_call(TSRMLS_D);
|
||||
void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
|
||||
void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
|
||||
void zend_do_handle_exception(TSRMLS_D);
|
||||
|
||||
void zend_do_try(znode *try_token TSRMLS_DC);
|
||||
void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC);
|
||||
void zend_do_end_catch(znode *try_token TSRMLS_DC);
|
||||
void zend_do_throw(znode *expr TSRMLS_DC);
|
||||
|
||||
ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, zend_bool compile_time);
|
||||
ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC);
|
||||
ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC);
|
||||
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC);
|
||||
ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time);
|
||||
ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *function_table, HashTable *class_table TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *function_table, HashTable *class_table, zend_class_entry *parent_ce TSRMLS_DC);
|
||||
ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry *ce2);
|
||||
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface);
|
||||
void zend_do_implements_interface(znode *interface_znode TSRMLS_DC);
|
||||
|
||||
void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC);
|
||||
void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce);
|
||||
void zend_do_early_binding(TSRMLS_D);
|
||||
|
||||
void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC);
|
||||
@@ -449,7 +405,7 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC
|
||||
void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC);
|
||||
|
||||
void zend_do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token, int variable TSRMLS_DC);
|
||||
void zend_do_foreach_cont(znode *value, znode *key, znode *as_token, znode *foreach_token TSRMLS_DC);
|
||||
void zend_do_foreach_cont(znode *value, znode *key, znode *as_token TSRMLS_DC);
|
||||
void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC);
|
||||
|
||||
void zend_do_declare_begin(TSRMLS_D);
|
||||
@@ -473,6 +429,10 @@ void zend_do_extended_fcall_end(TSRMLS_D);
|
||||
|
||||
void zend_do_ticks(TSRMLS_D);
|
||||
|
||||
void zend_do_begin_import(TSRMLS_D);
|
||||
void zend_do_import(int type, znode *what TSRMLS_DC);
|
||||
void zend_do_end_import(znode *import_from TSRMLS_DC);
|
||||
|
||||
void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body TSRMLS_DC);
|
||||
|
||||
ZEND_API void function_add_ref(zend_function *function);
|
||||
@@ -494,14 +454,14 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
|
||||
|
||||
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
|
||||
ZEND_API void zend_function_dtor(zend_function *function);
|
||||
ZEND_API void destroy_zend_class(zend_class_entry **pce);
|
||||
void zend_class_add_ref(zend_class_entry **ce);
|
||||
|
||||
ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal);
|
||||
ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name);
|
||||
void unmangle_property_name(char *mangled_property, char **prop_name, char **class_name);
|
||||
void zend_duplicate_property_info(zend_property_info *property_info);
|
||||
void zend_destroy_property_info(zend_property_info *property_info);
|
||||
|
||||
#define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
|
||||
#define ZEND_FUNCTION_DTOR (void (*)(void *)) destroy_zend_function
|
||||
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
|
||||
|
||||
zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
|
||||
@@ -511,13 +471,9 @@ int print_class(zend_class_entry *class_entry TSRMLS_DC);
|
||||
void print_op_array(zend_op_array *op_array, int optimizations);
|
||||
int pass_two(zend_op_array *op_array TSRMLS_DC);
|
||||
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
|
||||
void zend_do_first_catch(znode *open_parentheses TSRMLS_DC);
|
||||
void zend_initialize_try_catch_element(znode *try_token TSRMLS_DC);
|
||||
void zend_do_mark_last_catch(znode *first_catch, znode *last_additional_catch TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
|
||||
ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC);
|
||||
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
|
||||
int zend_get_class_fetch_type(char *class_name, uint class_name_len);
|
||||
void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
|
||||
|
||||
typedef zend_bool (*zend_auto_global_callback)(char *name, uint name_len TSRMLS_DC);
|
||||
typedef struct _zend_auto_global {
|
||||
@@ -530,7 +486,6 @@ typedef struct _zend_auto_global {
|
||||
void zend_auto_global_dtor(zend_auto_global *auto_global);
|
||||
ZEND_API int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC);
|
||||
ZEND_API zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC);
|
||||
ZEND_API int zend_auto_global_disable_jit(char *varname, zend_uint varname_length TSRMLS_DC);
|
||||
|
||||
int zendlex(znode *zendlval TSRMLS_DC);
|
||||
|
||||
@@ -686,6 +641,18 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
#define ZEND_IMPORT_FUNCTION 116
|
||||
#define ZEND_IMPORT_CLASS 117
|
||||
#define ZEND_IMPORT_CONST 118
|
||||
|
||||
#define ZEND_ASSIGN_ADD_OBJ 121
|
||||
#define ZEND_ASSIGN_SUB_OBJ 122
|
||||
#define ZEND_ASSIGN_MUL_OBJ 123
|
||||
#define ZEND_ASSIGN_DIV_OBJ 124
|
||||
#define ZEND_ASSIGN_MOD_OBJ 125
|
||||
#define ZEND_ASSIGN_SL_OBJ 126
|
||||
#define ZEND_ASSIGN_SR_OBJ 127
|
||||
#define ZEND_ASSIGN_CONCAT_OBJ 128
|
||||
#define ZEND_ASSIGN_BW_OR_OBJ 129
|
||||
#define ZEND_ASSIGN_BW_AND_OBJ 130
|
||||
#define ZEND_ASSIGN_BW_XOR_OBJ 131
|
||||
|
||||
#define ZEND_PRE_INC_OBJ 132
|
||||
#define ZEND_PRE_DEC_OBJ 133
|
||||
@@ -706,14 +673,9 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
|
||||
|
||||
#define ZEND_ADD_INTERFACE 144
|
||||
#define ZEND_VERIFY_INSTANCEOF 145
|
||||
#define ZEND_VERIFY_ABSTRACT_CLASS 146
|
||||
|
||||
#define ZEND_ASSIGN_DIM 147
|
||||
|
||||
#define ZEND_ISSET_ISEMPTY_PROP_OBJ 148
|
||||
|
||||
#define ZEND_HANDLE_EXCEPTION 149
|
||||
|
||||
/* end of block */
|
||||
/* END: OPCODES */
|
||||
|
||||
@@ -726,27 +688,20 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
#define ZEND_FETCH_STATIC 2
|
||||
#define ZEND_FETCH_STATIC_MEMBER 3
|
||||
|
||||
|
||||
/* obj/dim unsets */
|
||||
#define ZEND_UNSET_DIM 1
|
||||
#define ZEND_UNSET_OBJ 2
|
||||
|
||||
/* class fetches */
|
||||
#define ZEND_FETCH_CLASS_DEFAULT 0
|
||||
#define ZEND_FETCH_CLASS_SELF 1
|
||||
#define ZEND_FETCH_CLASS_PARENT 2
|
||||
#define ZEND_FETCH_CLASS_MAIN 3
|
||||
#define ZEND_FETCH_CLASS_GLOBAL 4
|
||||
#define ZEND_FETCH_CLASS_AUTO 5
|
||||
|
||||
|
||||
/* variable parsing type (compile-time) */
|
||||
#define ZEND_PARSED_MEMBER (1<<0)
|
||||
#define ZEND_PARSED_METHOD_CALL (1<<1)
|
||||
#define ZEND_PARSED_STATIC_MEMBER (1<<2)
|
||||
#define ZEND_PARSED_FUNCTION_CALL (1<<3)
|
||||
#define ZEND_PARSED_VARIABLE (1<<4)
|
||||
#define ZEND_PARSED_REFERENCE_VARIABLE (1<<5)
|
||||
#define ZEND_PARSED_MEMBER (1<<0)
|
||||
#define ZEND_PARSED_METHOD_CALL (1<<1)
|
||||
#define ZEND_PARSED_STATIC_MEMBER (1<<2)
|
||||
#define ZEND_PARSED_FUNCTION_CALL (1<<3)
|
||||
#define ZEND_PARSED_VARIABLE (1<<4)
|
||||
|
||||
|
||||
/* unset types */
|
||||
@@ -762,11 +717,10 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
#define BP_VAR_UNSET 6
|
||||
|
||||
|
||||
#define ZEND_INTERNAL_FUNCTION 1
|
||||
#define ZEND_USER_FUNCTION 2
|
||||
#define ZEND_OVERLOADED_FUNCTION 3
|
||||
#define ZEND_EVAL_CODE 4
|
||||
#define ZEND_OVERLOADED_FUNCTION_TEMPORARY 5
|
||||
#define ZEND_INTERNAL_FUNCTION 1
|
||||
#define ZEND_USER_FUNCTION 2
|
||||
#define ZEND_OVERLOADED_FUNCTION 3
|
||||
#define ZEND_EVAL_CODE 4
|
||||
|
||||
#define ZEND_INTERNAL_CLASS 1
|
||||
#define ZEND_USER_CLASS 2
|
||||
@@ -808,30 +762,26 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
}
|
||||
|
||||
/* Lost In Stupid Parentheses */
|
||||
#define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \
|
||||
( \
|
||||
zf \
|
||||
&& ((zend_function *) zf)->common.arg_info \
|
||||
&& \
|
||||
( \
|
||||
( \
|
||||
arg_num<=((zend_function *) zf)->common.num_args \
|
||||
&& ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference \
|
||||
) \
|
||||
|| ( \
|
||||
arg_num>((zend_function *) zf)->common.num_args \
|
||||
&& ((zend_function *) zf)->common.pass_rest_by_reference \
|
||||
) \
|
||||
) \
|
||||
#define ARG_SHOULD_BE_SENT_BY_REF(offset, conduct_check, arg_types) \
|
||||
( \
|
||||
conduct_check \
|
||||
&& arg_types \
|
||||
&& \
|
||||
( \
|
||||
( \
|
||||
offset<=arg_types[0] \
|
||||
&& arg_types[offset]==BYREF_FORCE \
|
||||
) \
|
||||
|| ( \
|
||||
offset>=arg_types[0] \
|
||||
&& arg_types[arg_types[0]]==BYREF_FORCE_REST \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
|
||||
#define ZEND_RETURN_VAL 0
|
||||
#define ZEND_RETURN_REF 1
|
||||
|
||||
|
||||
#define ZEND_RETURNS_FUNCTION 1<<0
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_CLONE_FUNC_NAME "__clone"
|
||||
@@ -840,7 +790,6 @@ END_EXTERN_C()
|
||||
#define ZEND_GET_FUNC_NAME "__get"
|
||||
#define ZEND_SET_FUNC_NAME "__set"
|
||||
#define ZEND_CALL_FUNC_NAME "__call"
|
||||
#define ZEND_AUTOLOAD_FUNC_NAME "__autoload"
|
||||
|
||||
#endif /* ZEND_COMPILE_H */
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+32
-37
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -38,7 +38,7 @@ void free_zend_constant(zend_constant *c)
|
||||
|
||||
void copy_zend_constant(zend_constant *c)
|
||||
{
|
||||
c->name = zend_strndup(c->name, c->name_len - 1);
|
||||
c->name = zend_strndup(c->name, c->name_len);
|
||||
if (!(c->flags & CONST_PERSISTENT)) {
|
||||
zval_copy_ctor(&c->value);
|
||||
}
|
||||
@@ -97,7 +97,6 @@ void zend_register_standard_constants(TSRMLS_D)
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
|
||||
@@ -167,7 +166,7 @@ ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval,
|
||||
c.value.type = IS_LONG;
|
||||
c.value.value.lval = lval;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name, name_len-1);
|
||||
c.name = zend_strndup(name, name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
@@ -181,7 +180,7 @@ ZEND_API void zend_register_double_constant(char *name, uint name_len, double dv
|
||||
c.value.type = IS_DOUBLE;
|
||||
c.value.value.dval = dval;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name, name_len-1);
|
||||
c.name = zend_strndup(name, name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
@@ -196,7 +195,7 @@ ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *st
|
||||
c.value.value.str.val = strval;
|
||||
c.value.value.str.len = strlen;
|
||||
c.flags = flags;
|
||||
c.name = zend_strndup(name, name_len-1);
|
||||
c.name = zend_strndup(name, name_len);
|
||||
c.name_len = name_len;
|
||||
c.module_number = module_number;
|
||||
zend_register_constant(&c TSRMLS_CC);
|
||||
@@ -212,35 +211,35 @@ ZEND_API void zend_register_string_constant(char *name, uint name_len, char *str
|
||||
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC)
|
||||
{
|
||||
zend_constant *c;
|
||||
int retval = 1;
|
||||
char *lookup_name;
|
||||
int retval = 1;
|
||||
char *colon;
|
||||
|
||||
if ((colon = memchr(name, ':', name_len)) && colon[1] == ':') {
|
||||
if((colon = memchr(name, ':', name_len)) && colon[1] == ':') {
|
||||
/* class constant */
|
||||
zend_class_entry **ce = NULL, *scope;
|
||||
int class_name_len = colon-name;
|
||||
int const_name_len = name_len - class_name_len - 2;
|
||||
char *constant_name = colon+2;
|
||||
zval **ret_constant;
|
||||
char *class_name;
|
||||
|
||||
if (EG(in_execution)) {
|
||||
if(EG(in_execution)) {
|
||||
scope = EG(scope);
|
||||
} else {
|
||||
scope = CG(active_class_entry);
|
||||
}
|
||||
|
||||
class_name = estrndup(name, class_name_len);
|
||||
|
||||
if (class_name_len == sizeof("self")-1 && strcmp(class_name, "self") == 0) {
|
||||
if (scope) {
|
||||
|
||||
lookup_name = do_alloca(class_name_len+1);
|
||||
zend_str_tolower_copy(lookup_name, name, class_name_len);
|
||||
lookup_name[class_name_len] = '\0';
|
||||
if(class_name_len == sizeof("self")-1 && strcmp(lookup_name, "self") == 0) {
|
||||
if(scope) {
|
||||
ce = &scope;
|
||||
} else {
|
||||
zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
|
||||
retval = 0;
|
||||
}
|
||||
} else if (class_name_len == sizeof("parent")-1 && strcmp(class_name, "parent") == 0) {
|
||||
} else if (class_name_len == sizeof("parent")-1 && strcmp(lookup_name, "parent") == 0) {
|
||||
if (!scope) {
|
||||
zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
|
||||
} else if (!scope->parent) {
|
||||
@@ -249,13 +248,12 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
|
||||
ce = &scope->parent;
|
||||
}
|
||||
} else {
|
||||
if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC) != SUCCESS) {
|
||||
if(zend_lookup_class(lookup_name, class_name_len, &ce TSRMLS_CC) != SUCCESS) {
|
||||
retval = 0;
|
||||
}
|
||||
}
|
||||
efree(class_name);
|
||||
|
||||
if (retval && ce) {
|
||||
if(retval && ce) {
|
||||
if (zend_hash_find(&((*ce)->constants_table), constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) {
|
||||
retval = 0;
|
||||
}
|
||||
@@ -263,18 +261,19 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
if (retval) {
|
||||
zval_update_constant(ret_constant, (void*)1 TSRMLS_CC);
|
||||
if(retval) {
|
||||
*result = **ret_constant;
|
||||
zval_copy_ctor(result);
|
||||
}
|
||||
|
||||
free_alloca(lookup_name);
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) {
|
||||
lookup_name = estrndup(name, name_len);
|
||||
zend_str_tolower(lookup_name, name_len);
|
||||
lookup_name = do_alloca(name_len+1);
|
||||
zend_str_tolower_copy(lookup_name, name, name_len);
|
||||
lookup_name[name_len] = '\0';
|
||||
|
||||
if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
|
||||
if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) {
|
||||
@@ -283,14 +282,12 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
|
||||
} else {
|
||||
retval=0;
|
||||
}
|
||||
efree(lookup_name);
|
||||
free_alloca(lookup_name);
|
||||
}
|
||||
|
||||
if (retval) {
|
||||
*result = c->value;
|
||||
zval_copy_ctor(result);
|
||||
result->refcount = 1;
|
||||
result->is_ref = 0;
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -299,8 +296,7 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
|
||||
|
||||
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
|
||||
{
|
||||
char *lowercase_name = NULL;
|
||||
char *name;
|
||||
char *lowercase_name;
|
||||
int ret = SUCCESS;
|
||||
|
||||
#if 0
|
||||
@@ -309,24 +305,23 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
|
||||
|
||||
if (!(c->flags & CONST_CS)) {
|
||||
/* keep in mind that c->name_len already contains the '\0' */
|
||||
lowercase_name = estrndup(c->name, c->name_len);
|
||||
zend_str_tolower(lowercase_name, c->name_len);
|
||||
name = lowercase_name;
|
||||
lowercase_name = do_alloca(c->name_len);
|
||||
zend_str_tolower_copy(lowercase_name, c->name, c->name_len - 1);
|
||||
} else {
|
||||
name = c->name;
|
||||
lowercase_name = do_alloca(c->name_len + 1);
|
||||
memcpy(lowercase_name, c->name, c->name_len);
|
||||
lowercase_name[c->name_len] = '\0';
|
||||
}
|
||||
|
||||
if (zend_hash_add(EG(zend_constants), name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
|
||||
zend_error(E_NOTICE,"Constant %s already defined", name);
|
||||
if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
|
||||
free(c->name);
|
||||
if (!(c->flags & CONST_PERSISTENT)) {
|
||||
zval_dtor(&c->value);
|
||||
}
|
||||
zend_error(E_NOTICE,"Constant %s already defined", lowercase_name);
|
||||
ret = FAILURE;
|
||||
}
|
||||
if (lowercase_name) {
|
||||
efree(lowercase_name);
|
||||
}
|
||||
free_alloca(lowercase_name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -27,8 +27,6 @@
|
||||
#define CONST_CS (1<<0) /* Case Sensitive */
|
||||
#define CONST_PERSISTENT (1<<1) /* Persistent */
|
||||
|
||||
#define PHP_USER_CONSTANT INT_MAX /* a constant defined in user space */
|
||||
|
||||
typedef struct _zend_constant {
|
||||
zval value;
|
||||
int flags;
|
||||
@@ -62,7 +60,7 @@ ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *st
|
||||
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
|
||||
void zend_copy_constants(HashTable *target, HashTable *sourc);
|
||||
void copy_zend_constant(zend_constant *c);
|
||||
END_EXTERN_C()
|
||||
END_EXTERN_C();
|
||||
|
||||
#define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant
|
||||
|
||||
|
||||
+105
-9
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -13,7 +13,6 @@
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Sterling Hughes <sterling@php.net> |
|
||||
| Marcus Boerger <helly@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -21,18 +20,115 @@
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_reflection_api.h"
|
||||
#include "zend_builtin_functions.h"
|
||||
#include "zend_interfaces.h"
|
||||
#include "zend_exceptions.h"
|
||||
|
||||
zend_class_entry *default_exception_ptr;
|
||||
|
||||
ZEND_FUNCTION(exception)
|
||||
{
|
||||
zval **message;
|
||||
zval **code;
|
||||
zval *tmp;
|
||||
zval *object;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_get_parameters_ex(argc, &message, &code) == FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
object = getThis();
|
||||
|
||||
if (argc > 0) {
|
||||
convert_to_string_ex(message);
|
||||
zval_add_ref(message);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "message", sizeof("message"), (void **) message, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
if (argc > 1) {
|
||||
convert_to_long_ex(code);
|
||||
zval_add_ref(code);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "code", sizeof("code"), (void **) code, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_STRING(tmp, zend_get_executed_filename(TSRMLS_C), 1);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "file", sizeof("file"), (void **) &tmp, sizeof(zval *), NULL);
|
||||
tmp = NULL;
|
||||
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_LONG(tmp, zend_get_executed_lineno(TSRMLS_C));
|
||||
zend_hash_update(Z_OBJPROP_P(object), "line", sizeof("line"), (void **) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
#define DEFAULT_0_PARAMS \
|
||||
if (ZEND_NUM_ARGS() > 0) { \
|
||||
ZEND_WRONG_PARAM_COUNT(); \
|
||||
}
|
||||
|
||||
static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC)
|
||||
{
|
||||
zval **value;
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
*return_value = **value;
|
||||
zval_copy_ctor(return_value);
|
||||
}
|
||||
|
||||
ZEND_FUNCTION(getfile)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "file", sizeof("file"), return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_FUNCTION(getline)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "line", sizeof("line"), return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_FUNCTION(getmessage)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "message", sizeof("message"), return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_FUNCTION(getcode)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "code", sizeof("code"), return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
static zend_function_entry default_exception_functions[] = {
|
||||
ZEND_FE(exception, NULL)
|
||||
ZEND_FE(getmessage, NULL)
|
||||
ZEND_FE(getcode, NULL)
|
||||
ZEND_FE(getfile, NULL)
|
||||
ZEND_FE(getline, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static void zend_register_default_exception(TSRMLS_D)
|
||||
{
|
||||
zend_class_entry default_exception;
|
||||
|
||||
INIT_CLASS_ENTRY(default_exception, "exception", default_exception_functions);
|
||||
default_exception_ptr = zend_register_internal_class(&default_exception TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API zend_class_entry *zend_exception_get_default(void)
|
||||
{
|
||||
return default_exception_ptr;
|
||||
}
|
||||
|
||||
ZEND_API void zend_register_default_classes(TSRMLS_D)
|
||||
{
|
||||
zend_register_interfaces(TSRMLS_C);
|
||||
zend_register_default_exception(TSRMLS_C);
|
||||
zend_register_reflection_api(TSRMLS_C);
|
||||
zend_register_iterator_wrapper(TSRMLS_C);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -12,18 +12,19 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: George Schlossnagle <george@omniti.com> |
|
||||
| Authors: Sterling Hughes <sterling@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef ZEND_REFLECTION_API_H
|
||||
#define ZEND_REFLECTION_API_H
|
||||
#ifndef ZEND_DEFAULT_CLASSES_H
|
||||
#define ZEND_DEFAULT_CLASSES_H
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
ZEND_API void zend_register_reflection_api(TSRMLS_D);
|
||||
ZEND_API zend_class_entry *zend_exception_get_default(void);
|
||||
ZEND_API void zend_register_default_classes(TSRMLS_D);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -30,7 +30,7 @@ typedef struct _dynamic_array {
|
||||
} dynamic_array;
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size);
|
||||
ZEND_API int zend_dynamic_array_init(dynamic_array *da);
|
||||
ZEND_API void *zend_dynamic_array_push(dynamic_array *da);
|
||||
ZEND_API void *zend_dynamic_array_pop(dynamic_array *da);
|
||||
ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index);
|
||||
|
||||
+1
-2
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -33,7 +33,6 @@
|
||||
#define E_USER_ERROR (1<<8L)
|
||||
#define E_USER_WARNING (1<<9L)
|
||||
#define E_USER_NOTICE (1<<10L)
|
||||
#define E_STRICT (1<<11L)
|
||||
|
||||
#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE)
|
||||
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
|
||||
|
||||
+52
-492
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -12,10 +12,7 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Marcus Boerger <helly@php.net> |
|
||||
| Sterling Hughes <sterling@php.net> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
| Authors: Sterling Hughes <sterling@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -23,108 +20,43 @@
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_reflection_api.h"
|
||||
#include "zend_builtin_functions.h"
|
||||
#include "zend_interfaces.h"
|
||||
|
||||
zend_class_entry *default_exception_ce;
|
||||
static zend_object_handlers default_exception_handlers;
|
||||
ZEND_API void zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC);
|
||||
ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
|
||||
zend_class_entry *default_exception_ptr;
|
||||
|
||||
|
||||
void zend_throw_exception_internal(zval *exception TSRMLS_DC)
|
||||
ZEND_FUNCTION(exception)
|
||||
{
|
||||
if (exception != NULL) {
|
||||
if (EG(exception)) {
|
||||
/* FIXME: bail out? */
|
||||
return;
|
||||
}
|
||||
EG(exception) = exception;
|
||||
}
|
||||
if (!EG(current_execute_data)) {
|
||||
zend_error(E_ERROR, "Exception thrown without a stack frame");
|
||||
}
|
||||
|
||||
if (zend_throw_exception_hook) {
|
||||
zend_throw_exception_hook(exception TSRMLS_CC);
|
||||
}
|
||||
|
||||
if ((EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) {
|
||||
/* no need to rethrow the exception */
|
||||
return;
|
||||
}
|
||||
EG(opline_before_exception) = EG(current_execute_data)->opline;
|
||||
EG(current_execute_data)->opline = &EG(active_op_array)->opcodes[EG(active_op_array)->last-1-1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ZEND_API void zend_clear_exception(TSRMLS_D)
|
||||
{
|
||||
if (!EG(exception)) {
|
||||
return;
|
||||
}
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
EG(exception) = NULL;
|
||||
EG(current_execute_data)->opline = EG(opline_before_exception);
|
||||
#if ZEND_DEBUG
|
||||
EG(opline_before_exception) = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
{
|
||||
zval tmp, obj;
|
||||
zend_object *object;
|
||||
zval *trace;
|
||||
|
||||
obj.value.obj = zend_objects_new(&object, class_type TSRMLS_CC);
|
||||
obj.value.obj.handlers = &default_exception_handlers;
|
||||
|
||||
ALLOC_HASHTABLE(object->properties);
|
||||
zend_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
|
||||
ALLOC_ZVAL(trace);
|
||||
trace->is_ref = 0;
|
||||
trace->refcount = 0;
|
||||
zend_fetch_debug_backtrace(trace, 0 TSRMLS_CC);
|
||||
|
||||
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
|
||||
zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
|
||||
zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
|
||||
|
||||
return obj.value.obj;
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, __clone)
|
||||
{
|
||||
/* Should never be executable */
|
||||
zend_throw_exception(NULL, "Cannot clone object using __clone()", 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, __construct)
|
||||
{
|
||||
char *message = NULL;
|
||||
long code = 0;
|
||||
zval **message;
|
||||
zval **code;
|
||||
zval *tmp;
|
||||
zval *object;
|
||||
int argc = ZEND_NUM_ARGS(), message_len;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sl", &message, &message_len, &code) == FAILURE) {
|
||||
zend_error(E_CORE_ERROR, "Wrong parameter count for exception([string $exception [, long $code ]])");
|
||||
if (zend_get_parameters_ex(argc, &message, &code) == FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
object = getThis();
|
||||
|
||||
if (message) {
|
||||
zend_update_property_string(default_exception_ce, object, "message", sizeof("message")-1, message TSRMLS_CC);
|
||||
if (argc > 0) {
|
||||
convert_to_string_ex(message);
|
||||
zval_add_ref(message);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "message", sizeof("message"), (void **) message, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
if (code) {
|
||||
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
|
||||
if (argc > 1) {
|
||||
convert_to_long_ex(code);
|
||||
zval_add_ref(code);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "code", sizeof("code"), (void **) code, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_STRING(tmp, zend_get_executed_filename(TSRMLS_C), 1);
|
||||
zend_hash_update(Z_OBJPROP_P(object), "file", sizeof("file"), (void **) &tmp, sizeof(zval *), NULL);
|
||||
tmp = NULL;
|
||||
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_LONG(tmp, zend_get_executed_lineno(TSRMLS_C));
|
||||
zend_hash_update(Z_OBJPROP_P(object), "line", sizeof("line"), (void **) &tmp, sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
#define DEFAULT_0_PARAMS \
|
||||
@@ -134,441 +66,69 @@ ZEND_METHOD(exception, __construct)
|
||||
|
||||
static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC)
|
||||
{
|
||||
zval *value;
|
||||
zval **value;
|
||||
|
||||
value = zend_read_property(default_exception_ce, object, name, name_len, 0 TSRMLS_CC);
|
||||
if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
*return_value = *value;
|
||||
*return_value = **value;
|
||||
zval_copy_ctor(return_value);
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, getFile)
|
||||
ZEND_FUNCTION(getfile)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "file", sizeof("file")-1, return_value TSRMLS_CC);
|
||||
_default_exception_get_entry(getThis(), "file", sizeof("file"), return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, getLine)
|
||||
ZEND_FUNCTION(getline)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "line", sizeof("line")-1, return_value TSRMLS_CC);
|
||||
_default_exception_get_entry(getThis(), "line", sizeof("line"), return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, getMessage)
|
||||
ZEND_FUNCTION(getmessage)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "message", sizeof("message")-1, return_value TSRMLS_CC);
|
||||
_default_exception_get_entry(getThis(), "message", sizeof("message"), return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, getCode)
|
||||
ZEND_FUNCTION(getcode)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "code", sizeof("code")-1, return_value TSRMLS_CC);
|
||||
_default_exception_get_entry(getThis(), "code", sizeof("code"), return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, getTrace)
|
||||
{
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
_default_exception_get_entry(getThis(), "trace", sizeof("trace")-1, return_value TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* {{{ ZEND_METHOD(exception, gettraceasstring) */
|
||||
#define TRACE_APPEND_CHR(chr) \
|
||||
*str = (char*)erealloc(*str, *len + 1 + 1); \
|
||||
(*str)[(*len)++] = chr
|
||||
|
||||
#define TRACE_APPEND_STRL(val, vallen) \
|
||||
{ \
|
||||
int l = vallen; \
|
||||
*str = (char*)erealloc(*str, *len + l + 1); \
|
||||
memcpy((*str) + *len, val, l); \
|
||||
*len += l; \
|
||||
}
|
||||
|
||||
#define TRACE_APPEND_STR(val) \
|
||||
TRACE_APPEND_STRL(val, sizeof(val)-1)
|
||||
|
||||
#define TRACE_APPEND_KEY(key) \
|
||||
if (zend_hash_find(ht, key, sizeof(key), (void**)&tmp) == SUCCESS) { \
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \
|
||||
}
|
||||
|
||||
static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_key *hash_key)
|
||||
{
|
||||
char **str;
|
||||
int *len;
|
||||
|
||||
str = va_arg(args, char**);
|
||||
len = va_arg(args, int*);
|
||||
|
||||
/* the trivial way would be to do:
|
||||
* conver_to_string_ex(arg);
|
||||
* append it and kill the now tmp arg.
|
||||
* but that could cause some E_NOTICE and also damn long lines.
|
||||
*/
|
||||
|
||||
switch (Z_TYPE_PP(arg)) {
|
||||
case IS_NULL:
|
||||
TRACE_APPEND_STR("NULL, ");
|
||||
break;
|
||||
case IS_STRING: {
|
||||
int l_added;
|
||||
TRACE_APPEND_CHR('\'');
|
||||
if (Z_STRLEN_PP(arg) > 15) {
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(arg), 15);
|
||||
TRACE_APPEND_STR("...', ");
|
||||
l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */
|
||||
} else {
|
||||
l_added = Z_STRLEN_PP(arg);
|
||||
TRACE_APPEND_STRL(Z_STRVAL_PP(arg), l_added);
|
||||
TRACE_APPEND_STR("', ");
|
||||
l_added += 3 + 1;
|
||||
}
|
||||
while (--l_added) {
|
||||
if ((*str)[*len - l_added] < 32) {
|
||||
(*str)[*len - l_added] = '?';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IS_BOOL:
|
||||
if (Z_LVAL_PP(arg)) {
|
||||
TRACE_APPEND_STR("true, ");
|
||||
} else {
|
||||
TRACE_APPEND_STR("false, ");
|
||||
}
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
TRACE_APPEND_STR("Resource id #");
|
||||
/* break; */
|
||||
case IS_LONG: {
|
||||
long lval = Z_LVAL_PP(arg);
|
||||
char s_tmp[MAX_LENGTH_OF_LONG + 1];
|
||||
int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */
|
||||
TRACE_APPEND_STRL(s_tmp, l_tmp);
|
||||
TRACE_APPEND_STR(", ");
|
||||
break;
|
||||
}
|
||||
case IS_DOUBLE: {
|
||||
double dval = Z_DVAL_PP(arg);
|
||||
char *s_tmp;
|
||||
int l_tmp;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
|
||||
l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */
|
||||
TRACE_APPEND_STRL(s_tmp, l_tmp);
|
||||
/* %G already handles removing trailing zeros from the fractional part, yay */
|
||||
efree(s_tmp);
|
||||
TRACE_APPEND_STR(", ");
|
||||
break;
|
||||
}
|
||||
case IS_ARRAY:
|
||||
TRACE_APPEND_STR("Array, ");
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
TRACE_APPEND_STR("Object(");
|
||||
TRACE_APPEND_STRL(Z_OBJCE_PP(arg)->name, strlen(Z_OBJCE_PP(arg)->name));
|
||||
TRACE_APPEND_STR("), ");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
|
||||
static int _build_trace_string(zval **frame, int num_args, va_list args, zend_hash_key *hash_key)
|
||||
{
|
||||
char *s_tmp, **str;
|
||||
int *len, *num;
|
||||
long line;
|
||||
HashTable *ht = Z_ARRVAL_PP(frame);
|
||||
zval **file, **tmp;
|
||||
|
||||
str = va_arg(args, char**);
|
||||
len = va_arg(args, int*);
|
||||
num = va_arg(args, int*);
|
||||
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1);
|
||||
sprintf(s_tmp, "#%d ", (*num)++);
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
if (zend_hash_find(ht, "file", sizeof("file"), (void**)&file) == SUCCESS) {
|
||||
if (zend_hash_find(ht, "line", sizeof("line"), (void**)&tmp) == SUCCESS) {
|
||||
line = Z_LVAL_PP(tmp);
|
||||
} else {
|
||||
line = 0;
|
||||
}
|
||||
s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 2 + 1);
|
||||
sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line);
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
} else {
|
||||
TRACE_APPEND_STR("[internal function]: ");
|
||||
}
|
||||
TRACE_APPEND_KEY("class");
|
||||
TRACE_APPEND_KEY("type");
|
||||
TRACE_APPEND_KEY("function");
|
||||
TRACE_APPEND_CHR('(');
|
||||
if (zend_hash_find(ht, "args", sizeof("args"), (void**)&tmp) == SUCCESS) {
|
||||
int last_len = *len;
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_PP(tmp), (apply_func_args_t)_build_trace_args, 2, str, len);
|
||||
if (last_len != *len) {
|
||||
*len -= 2; /* remove last ', ' */
|
||||
}
|
||||
}
|
||||
TRACE_APPEND_STR(")\n");
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, getTraceAsString)
|
||||
{
|
||||
zval *trace;
|
||||
char *res = estrdup(""), **str = &res, *s_tmp;
|
||||
int res_len = 0, *len = &res_len, num = 0;
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace), (apply_func_args_t)_build_trace_string, 3, str, len, &num);
|
||||
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
|
||||
sprintf(s_tmp, "#%d {main}", num);
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int zend_spprintf(char **message, int max_len, char *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
int len;
|
||||
|
||||
va_start(arg, format);
|
||||
len = zend_vspprintf(message, max_len, format, arg);
|
||||
va_end(arg);
|
||||
return len;
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, __toString)
|
||||
{
|
||||
zval message, file, line, *trace;
|
||||
char *str;
|
||||
int len;
|
||||
zend_fcall_info fci;
|
||||
zval fname;
|
||||
|
||||
_default_exception_get_entry(getThis(), "message", sizeof("message")-1, &message TSRMLS_CC);
|
||||
_default_exception_get_entry(getThis(), "file", sizeof("file")-1, &file TSRMLS_CC);
|
||||
_default_exception_get_entry(getThis(), "line", sizeof("line")-1, &line TSRMLS_CC);
|
||||
|
||||
convert_to_string(&message);
|
||||
convert_to_string(&file);
|
||||
convert_to_long(&line);
|
||||
|
||||
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 0);
|
||||
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = &Z_OBJCE_P(getThis())->function_table;
|
||||
fci.function_name = &fname;
|
||||
fci.symbol_table = NULL;
|
||||
fci.object_pp = &getThis();
|
||||
fci.retval_ptr_ptr = &trace;
|
||||
fci.param_count = 0;
|
||||
fci.params = NULL;
|
||||
fci.no_separation = 1;
|
||||
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_P(trace) != IS_STRING) {
|
||||
trace = NULL;
|
||||
}
|
||||
|
||||
if (Z_STRLEN(message) > 0) {
|
||||
len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s",
|
||||
Z_OBJCE_P(getThis())->name, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line),
|
||||
(trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n");
|
||||
} else {
|
||||
len = zend_spprintf(&str, 0, "exception '%s' in %s:%ld\nStack trace:\n%s",
|
||||
Z_OBJCE_P(getThis())->name, Z_STRVAL(file), Z_LVAL(line),
|
||||
(trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n");
|
||||
}
|
||||
|
||||
/* We store the result in the private property string so we can access
|
||||
* the result in uncaught exception handlers without memleaks. */
|
||||
zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
|
||||
|
||||
if (trace) {
|
||||
zval_ptr_dtor(&trace);
|
||||
}
|
||||
|
||||
zval_dtor(&message);
|
||||
zval_dtor(&file);
|
||||
zval_dtor(&line);
|
||||
|
||||
RETURN_STRINGL(str, len, 0);
|
||||
}
|
||||
|
||||
/* All functions that may be used in uncaught exception handlers must be final
|
||||
* and must not throw exceptions. Otherwise we would need a facility to handle
|
||||
* such exceptions in that handler.
|
||||
* Also all getXY() methods are final because thy serve as read only access to
|
||||
* their corresponding properties, no more, no less. If after all you need to
|
||||
* override somthing then it is method __toString().
|
||||
* And never try to change the state of exceptions and never implement anything
|
||||
* that gives the user anything to accomplish this.
|
||||
*/
|
||||
static zend_function_entry default_exception_functions[] = {
|
||||
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, __construct, NULL, 0)
|
||||
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getLine, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getTrace, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getTraceAsString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, __toString, NULL, 0)
|
||||
ZEND_FE(exception, NULL)
|
||||
ZEND_FE(getmessage, NULL)
|
||||
ZEND_FE(getcode, NULL)
|
||||
ZEND_FE(getfile, NULL)
|
||||
ZEND_FE(getline, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void zend_register_default_exception(TSRMLS_D)
|
||||
static void zend_register_default_exception(TSRMLS_D)
|
||||
{
|
||||
zend_class_entry ce;
|
||||
zend_class_entry default_exception;
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "Exception", default_exception_functions);
|
||||
default_exception_ce = zend_register_internal_class(&ce TSRMLS_CC);
|
||||
default_exception_ce->create_object = zend_default_exception_new;
|
||||
memcpy(&default_exception_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
default_exception_handlers.clone_obj = NULL;
|
||||
|
||||
zend_declare_property_string(default_exception_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_string(default_exception_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC);
|
||||
zend_declare_property_long(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_null(default_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_null(default_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
|
||||
zend_declare_property_null(default_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE TSRMLS_CC);
|
||||
INIT_CLASS_ENTRY(default_exception, "exception", default_exception_functions);
|
||||
default_exception_ptr = zend_register_internal_class(&default_exception TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API zend_class_entry *zend_exception_get_default(void)
|
||||
{
|
||||
return default_exception_ce;
|
||||
return default_exception_ptr;
|
||||
}
|
||||
|
||||
ZEND_API void zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...)
|
||||
ZEND_API void zend_register_default_classes(TSRMLS_D)
|
||||
{
|
||||
zval *ex;
|
||||
va_list arg;
|
||||
char *message;
|
||||
|
||||
va_start(arg, format);
|
||||
zend_vspprintf(&message, 0, format, arg);
|
||||
va_end(arg);
|
||||
|
||||
MAKE_STD_ZVAL(ex);
|
||||
if (exception_ce) {
|
||||
if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class");
|
||||
exception_ce = default_exception_ce;
|
||||
}
|
||||
} else {
|
||||
exception_ce = default_exception_ce;
|
||||
}
|
||||
object_init_ex(ex, exception_ce);
|
||||
|
||||
|
||||
if (message) {
|
||||
zend_update_property_string(default_exception_ce, ex, "message", sizeof("message")-1, message TSRMLS_CC);
|
||||
}
|
||||
if (code) {
|
||||
zend_update_property_long(default_exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC);
|
||||
}
|
||||
|
||||
efree(message);
|
||||
|
||||
zend_throw_exception_internal(ex TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC)
|
||||
{
|
||||
zend_throw_exception_ex(exception_ce, code TSRMLS_CC, "%s", message);
|
||||
}
|
||||
|
||||
|
||||
static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
zend_error_cb(type, file, lineno, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/* This function doesn't return as it calls E_ERROR */
|
||||
ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
|
||||
{
|
||||
zend_class_entry *ce_exception = Z_OBJCE_P(exception);
|
||||
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
|
||||
zval *str, *file, *line;
|
||||
|
||||
EG(exception) = NULL;
|
||||
|
||||
zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &str);
|
||||
if (!EG(exception)) {
|
||||
if (Z_TYPE_P(str) != IS_STRING) {
|
||||
zend_error(E_WARNING, "%s::__toString() must return a string", ce_exception->name);
|
||||
} else {
|
||||
zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
zval_ptr_dtor(&str);
|
||||
|
||||
if (EG(exception)) {
|
||||
/* do the best we can to inform about the inner exception */
|
||||
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
|
||||
file = zend_read_property(default_exception_ce, EG(exception), "file", sizeof("file")-1, 1 TSRMLS_CC);
|
||||
line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC);
|
||||
} else {
|
||||
file = NULL;
|
||||
line = NULL;
|
||||
}
|
||||
zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name);
|
||||
}
|
||||
|
||||
str = zend_read_property(default_exception_ce, exception, "string", sizeof("string")-1, 1 TSRMLS_CC);
|
||||
file = zend_read_property(default_exception_ce, exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
|
||||
line = zend_read_property(default_exception_ce, exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
|
||||
|
||||
zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str));
|
||||
} else {
|
||||
zend_error(E_ERROR, "Uncaught exception '%s'", ce_exception->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC)
|
||||
{
|
||||
zend_class_entry *exception_ce;
|
||||
|
||||
if (exception == NULL || exception->type != IS_OBJECT) {
|
||||
zend_error(E_ERROR, "Need to supply an object when throwing an exception");
|
||||
}
|
||||
|
||||
exception_ce = Z_OBJCE_P(exception);
|
||||
|
||||
if (!exception_ce || !instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
|
||||
zend_error(E_ERROR, "Exceptions must be valid objects derived from the Exception base class");
|
||||
}
|
||||
zend_throw_exception_internal(exception TSRMLS_CC);
|
||||
zend_register_default_exception(TSRMLS_C);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+5
-24
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -12,39 +12,20 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Marcus Boerger <helly@php.net> |
|
||||
| Sterling Hughes <sterling@php.net> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
| Authors: Sterling Hughes <sterling@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef ZEND_EXCEPTIONS_H
|
||||
#define ZEND_EXCEPTIONS_H
|
||||
#ifndef ZEND_DEFAULT_CLASSES_H
|
||||
#define ZEND_DEFAULT_CLASSES_H
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
void zend_throw_exception_internal(zval *exception TSRMLS_DC);
|
||||
|
||||
void zend_register_default_exception(TSRMLS_D);
|
||||
|
||||
ZEND_API zend_class_entry *zend_exception_get_default(void);
|
||||
ZEND_API void zend_register_default_classes(TSRMLS_D);
|
||||
|
||||
/* exception_ce NULL or zend_exception_get_default() or a derived class
|
||||
* message NULL or the message of the exception */
|
||||
ZEND_API void zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC);
|
||||
ZEND_API void zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...);
|
||||
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);
|
||||
ZEND_API void zend_clear_exception(TSRMLS_D);
|
||||
|
||||
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
|
||||
|
||||
/* show an exception using zend_error(E_ERROR,...) */
|
||||
ZEND_API void zend_exception_error(zval *exception TSRMLS_DC);
|
||||
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif
|
||||
|
||||
+1301
-1560
File diff suppressed because it is too large.
Load diff
+21
-24
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -32,14 +32,21 @@ typedef union _temp_variable {
|
||||
struct {
|
||||
zval **ptr_ptr;
|
||||
zval *ptr;
|
||||
zend_bool fcall_returned_reference;
|
||||
} var;
|
||||
struct {
|
||||
zval tmp_var;
|
||||
zval *str;
|
||||
zend_uint offset;
|
||||
} str_offset;
|
||||
zend_class_entry *class_entry;
|
||||
zval tmp_var; /* a dummy */
|
||||
|
||||
union {
|
||||
struct {
|
||||
zval *str;
|
||||
zend_uint offset;
|
||||
} str_offset;
|
||||
zend_property_reference overloaded_element;
|
||||
} data;
|
||||
|
||||
unsigned char type;
|
||||
zend_class_entry *class_entry;
|
||||
} EA;
|
||||
} temp_variable;
|
||||
|
||||
|
||||
@@ -52,18 +59,16 @@ void shutdown_executor(TSRMLS_D);
|
||||
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
|
||||
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
|
||||
ZEND_API int zend_is_true(zval *op);
|
||||
#define safe_free_zval_ptr(p) safe_free_zval_ptr_rel(p ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
static inline void safe_free_zval_ptr(zval *p)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (p!=EG(uninitialized_zval_ptr)) {
|
||||
FREE_ZVAL_REL(p);
|
||||
FREE_ZVAL(p);
|
||||
}
|
||||
}
|
||||
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
|
||||
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
|
||||
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
|
||||
|
||||
static inline int i_zend_is_true(zval *op)
|
||||
{
|
||||
@@ -93,16 +98,8 @@ static inline int i_zend_is_true(zval *op)
|
||||
result = (zend_hash_num_elements(op->value.ht)?1:0);
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
if(IS_ZEND_STD_OBJECT(*op)) {
|
||||
TSRMLS_FETCH();
|
||||
if(EG(ze1_compatibility_mode)) {
|
||||
result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
|
||||
} else {
|
||||
result = 1;
|
||||
}
|
||||
} else {
|
||||
result = 1;
|
||||
}
|
||||
/* OBJ-TBI */
|
||||
result = 1;
|
||||
break;
|
||||
default:
|
||||
result = 0;
|
||||
@@ -142,7 +139,6 @@ void execute_new_code(TSRMLS_D);
|
||||
|
||||
|
||||
/* services */
|
||||
ZEND_API char *get_active_class_name(char **space TSRMLS_DC);
|
||||
ZEND_API char *get_active_function_name(TSRMLS_D);
|
||||
ZEND_API char *zend_get_executed_filename(TSRMLS_D);
|
||||
ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
|
||||
@@ -151,8 +147,6 @@ ZEND_API zend_bool zend_is_executing(TSRMLS_D);
|
||||
ZEND_API void zend_set_timeout(long seconds);
|
||||
ZEND_API void zend_unset_timeout(TSRMLS_D);
|
||||
ZEND_API void zend_timeout(int dummy);
|
||||
ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
|
||||
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
void zend_init_timeout_thread();
|
||||
@@ -168,6 +162,9 @@ void zend_shutdown_timeout_thread();
|
||||
|
||||
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC);
|
||||
|
||||
#define IS_OVERLOADED_OBJECT 1
|
||||
#define IS_STRING_OFFSET 2
|
||||
|
||||
/* The following tries to resolve the classname of a zval of type object.
|
||||
* Since it is slow it should be only used in error messages.
|
||||
*/
|
||||
|
||||
+159
-482
@@ -2,10 +2,10 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.zend.com/license/2_00.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
@@ -29,19 +29,17 @@
|
||||
#include "zend_ptr_stack.h"
|
||||
#include "zend_constants.h"
|
||||
#include "zend_extensions.h"
|
||||
#include "zend_exceptions.h"
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
ZEND_API void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
|
||||
ZEND_API void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
|
||||
|
||||
/* true globals */
|
||||
ZEND_API zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL };
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
#include <process.h>
|
||||
/* true global */
|
||||
static WNDCLASS wc;
|
||||
static HWND timeout_window;
|
||||
static HANDLE timeout_thread_event;
|
||||
@@ -117,7 +115,7 @@ static int is_not_internal_class(zend_class_entry **ce TSRMLS_DC)
|
||||
void init_executor(TSRMLS_D)
|
||||
{
|
||||
INIT_ZVAL(EG(uninitialized_zval));
|
||||
/* trick to make uninitialized_zval never be modified, passed by ref, etc. */
|
||||
/* trick to make uninitialized_zval never be modified, passed by ref, etc. */
|
||||
EG(uninitialized_zval).refcount++;
|
||||
INIT_ZVAL(EG(error_zval));
|
||||
EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
|
||||
@@ -132,15 +130,14 @@ void init_executor(TSRMLS_D)
|
||||
EG(symtable_cache_ptr) = EG(symtable_cache)-1;
|
||||
EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
|
||||
EG(no_extensions)=0;
|
||||
EG(implicit_clone)=0;
|
||||
|
||||
EG(function_table) = CG(function_table);
|
||||
EG(class_table) = CG(class_table);
|
||||
|
||||
EG(in_execution) = 0;
|
||||
EG(in_autoload) = NULL;
|
||||
|
||||
zend_ptr_stack_init(&EG(argument_stack));
|
||||
zend_ptr_stack_push(&EG(argument_stack), (void *) NULL);
|
||||
|
||||
zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0);
|
||||
{
|
||||
@@ -154,7 +151,7 @@ void init_executor(TSRMLS_D)
|
||||
zend_hash_update(&EG(symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL);
|
||||
}
|
||||
EG(active_symbol_table) = &EG(symbol_table);
|
||||
|
||||
|
||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
|
||||
EG(opline_ptr) = NULL;
|
||||
EG(garbage_ptr) = 0;
|
||||
@@ -167,7 +164,6 @@ void init_executor(TSRMLS_D)
|
||||
|
||||
EG(current_execute_data) = NULL;
|
||||
|
||||
zend_stack_init(&EG(user_error_handlers_error_reporting));
|
||||
zend_ptr_stack_init(&EG(user_error_handlers));
|
||||
zend_ptr_stack_init(&EG(user_exception_handlers));
|
||||
|
||||
@@ -182,14 +178,19 @@ void init_executor(TSRMLS_D)
|
||||
|
||||
EG(scope) = NULL;
|
||||
|
||||
EG(current_execute_data) = NULL;
|
||||
|
||||
EG(This) = NULL;
|
||||
|
||||
EG(float_separator)[0] = '.';
|
||||
}
|
||||
|
||||
|
||||
void shutdown_executor(TSRMLS_D)
|
||||
{
|
||||
zend_try {
|
||||
zend_ptr_stack_destroy(&EG(arg_types_stack));
|
||||
|
||||
/* Removed because this can not be safely done, e.g. in this situation:
|
||||
Object 1 creates object 2
|
||||
Object 3 holds reference to object 2.
|
||||
@@ -206,41 +207,15 @@ void shutdown_executor(TSRMLS_D)
|
||||
}
|
||||
*/
|
||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
|
||||
zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
|
||||
zend_hash_graceful_reverse_destroy(&EG(symbol_table));
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
zval *zeh;
|
||||
/* remove error handlers before destroying classes and functions,
|
||||
so that if handler used some class, crash would not happen */
|
||||
if (EG(user_error_handler)) {
|
||||
zeh = EG(user_error_handler);
|
||||
EG(user_error_handler) = NULL;
|
||||
zval_dtor(zeh);
|
||||
FREE_ZVAL(zeh);
|
||||
}
|
||||
zend_hash_destroy(&EG(symbol_table));
|
||||
|
||||
if (EG(user_exception_handler)) {
|
||||
zeh = EG(user_exception_handler);
|
||||
EG(user_exception_handler) = NULL;
|
||||
zval_dtor(zeh);
|
||||
FREE_ZVAL(zeh);
|
||||
}
|
||||
|
||||
zend_stack_destroy(&EG(user_error_handlers_error_reporting));
|
||||
zend_stack_init(&EG(user_error_handlers_error_reporting));
|
||||
zend_ptr_stack_clean(&EG(user_error_handlers), ZVAL_DESTRUCTOR, 1);
|
||||
zend_ptr_stack_clean(&EG(user_exception_handlers), ZVAL_DESTRUCTOR, 1);
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
/* Cleanup static data for functions and arrays.
|
||||
We need a separate cleanup stage because of the following problem:
|
||||
Suppose we destroy class X, which destroys the class's function table,
|
||||
and in the function table we have function foo() that has static $bar.
|
||||
Now if an object of class X is assigned to $bar, its destructor will be
|
||||
called and will fail since X's function table is in mid-destruction.
|
||||
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 is 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 */
|
||||
@@ -266,10 +241,9 @@ void shutdown_executor(TSRMLS_D)
|
||||
|
||||
while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
|
||||
zend_hash_destroy(*EG(symtable_cache_ptr));
|
||||
FREE_HASHTABLE(*EG(symtable_cache_ptr));
|
||||
efree(*EG(symtable_cache_ptr));
|
||||
EG(symtable_cache_ptr)--;
|
||||
}
|
||||
zend_objects_store_free_object_storage(&EG(objects_store) TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
@@ -288,48 +262,27 @@ void shutdown_executor(TSRMLS_D)
|
||||
|
||||
zend_hash_destroy(&EG(included_files));
|
||||
|
||||
zend_ptr_stack_destroy(&EG(arg_types_stack));
|
||||
zend_stack_destroy(&EG(user_error_handlers_error_reporting));
|
||||
if (EG(user_error_handler)) {
|
||||
zval_dtor(EG(user_error_handler));
|
||||
FREE_ZVAL(EG(user_error_handler));
|
||||
}
|
||||
|
||||
if (EG(user_exception_handler)) {
|
||||
zval_dtor(EG(user_exception_handler));
|
||||
FREE_ZVAL(EG(user_exception_handler));
|
||||
}
|
||||
|
||||
zend_ptr_stack_clean(&EG(user_error_handlers), ZVAL_DESTRUCTOR, 1);
|
||||
zend_ptr_stack_destroy(&EG(user_error_handlers));
|
||||
|
||||
zend_ptr_stack_clean(&EG(user_exception_handlers), ZVAL_DESTRUCTOR, 1);
|
||||
zend_ptr_stack_destroy(&EG(user_exception_handlers));
|
||||
|
||||
zend_objects_store_destroy(&EG(objects_store));
|
||||
if (EG(in_autoload)) {
|
||||
zend_hash_destroy(EG(in_autoload));
|
||||
FREE_HASHTABLE(EG(in_autoload));
|
||||
}
|
||||
} zend_end_try();
|
||||
}
|
||||
|
||||
|
||||
/* return class name and "::" or "". */
|
||||
ZEND_API char *get_active_class_name(char **space TSRMLS_DC)
|
||||
{
|
||||
if (!zend_is_executing(TSRMLS_C)) {
|
||||
if (space) {
|
||||
*space = "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
switch (EG(function_state_ptr)->function->type) {
|
||||
case ZEND_USER_FUNCTION:
|
||||
case ZEND_INTERNAL_FUNCTION:
|
||||
{
|
||||
zend_class_entry *ce = EG(function_state_ptr)->function->common.scope;
|
||||
|
||||
if (space) {
|
||||
*space = ce ? "::" : "";
|
||||
}
|
||||
return ce ? ce->name : "";
|
||||
}
|
||||
default:
|
||||
if (space) {
|
||||
*space = "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *get_active_function_name(TSRMLS_D)
|
||||
{
|
||||
if (!zend_is_executing(TSRMLS_C)) {
|
||||
@@ -338,7 +291,7 @@ ZEND_API char *get_active_function_name(TSRMLS_D)
|
||||
switch (EG(function_state_ptr)->function->type) {
|
||||
case ZEND_USER_FUNCTION: {
|
||||
char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name;
|
||||
|
||||
|
||||
if (function_name) {
|
||||
return function_name;
|
||||
} else {
|
||||
@@ -389,27 +342,12 @@ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
|
||||
(*zval_ptr)->refcount--;
|
||||
if ((*zval_ptr)->refcount==0) {
|
||||
zval_dtor(*zval_ptr);
|
||||
safe_free_zval_ptr_rel(*zval_ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC);
|
||||
safe_free_zval_ptr(*zval_ptr);
|
||||
} else if ((*zval_ptr)->refcount == 1) {
|
||||
(*zval_ptr)->is_ref = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZEND_API void _zval_internal_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
#if DEBUG_ZEND>=2
|
||||
printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1);
|
||||
#endif
|
||||
(*zval_ptr)->refcount--;
|
||||
if ((*zval_ptr)->refcount==0) {
|
||||
zval_internal_dtor(*zval_ptr);
|
||||
free(*zval_ptr);
|
||||
} else if ((*zval_ptr)->refcount == 1) {
|
||||
(*zval_ptr)->is_ref = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ZEND_API int zend_is_true(zval *op)
|
||||
{
|
||||
@@ -458,7 +396,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
SEPARATE_ZVAL(pp);
|
||||
p = *pp;
|
||||
p->type = IS_ARRAY;
|
||||
|
||||
|
||||
/* First go over the array and see if there are any constant indices */
|
||||
zend_hash_internal_pointer_reset(p->value.ht);
|
||||
while (zend_hash_get_current_data(p->value.ht, (void **) &element)==SUCCESS) {
|
||||
@@ -476,7 +414,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
zend_hash_move_forward(p->value.ht);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (const_value.type == IS_STRING && const_value.value.str.len == str_index_len-1 &&
|
||||
!strncmp(const_value.value.str.val, str_index, str_index_len)) {
|
||||
/* constant value is the same as its name */
|
||||
@@ -490,13 +428,13 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
zval_copy_ctor(new_val);
|
||||
new_val->refcount = 1;
|
||||
new_val->is_ref = 0;
|
||||
|
||||
|
||||
/* preserve this bit for inheritance */
|
||||
Z_TYPE_PP(element) |= IS_CONSTANT_INDEX;
|
||||
|
||||
|
||||
switch (const_value.type) {
|
||||
case IS_STRING:
|
||||
zend_symtable_update(p->value.ht, const_value.value.str.val, const_value.value.str.len+1, &new_val, sizeof(zval *), NULL);
|
||||
zend_hash_update(p->value.ht, const_value.value.str.val, const_value.value.str.len+1, &new_val, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_LONG:
|
||||
zend_hash_index_update(p->value.ht, const_value.value.lval, &new_val, sizeof(zval *), NULL);
|
||||
@@ -506,16 +444,15 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
zval_dtor(&const_value);
|
||||
}
|
||||
zend_hash_apply_with_argument(p->value.ht, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
zend_hash_internal_pointer_reset(p->value.ht);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC)
|
||||
int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC)
|
||||
{
|
||||
zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
|
||||
zend_uint i;
|
||||
int i;
|
||||
int ex_retval;
|
||||
zval *local_retval_ptr;
|
||||
|
||||
@@ -532,28 +469,16 @@ int call_user_function(HashTable *function_table, zval **object_pp, zval *functi
|
||||
return ex_retval;
|
||||
}
|
||||
|
||||
|
||||
int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC)
|
||||
int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC)
|
||||
{
|
||||
zend_fcall_info fci;
|
||||
zend_function *function_pointer = NULL;
|
||||
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = function_table;
|
||||
fci.object_pp = object_pp;
|
||||
fci.function_name = function_name;
|
||||
fci.retval_ptr_ptr = retval_ptr_ptr;
|
||||
fci.param_count = param_count;
|
||||
fci.params = params;
|
||||
fci.no_separation = (zend_bool) no_separation;
|
||||
fci.symbol_table = symbol_table;
|
||||
|
||||
return zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
return fast_call_user_function(function_table, object_pp, function_name, retval_ptr_ptr, param_count, params, no_separation, symbol_table, &function_pointer TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC)
|
||||
int fast_call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table, zend_function **function_pointer TSRMLS_DC)
|
||||
{
|
||||
zend_uint i;
|
||||
int i;
|
||||
zval **original_return_value;
|
||||
HashTable *calling_symbol_table;
|
||||
zend_function_state *original_function_state_ptr;
|
||||
@@ -564,214 +489,132 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
int (*orig_binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
zend_class_entry *current_scope;
|
||||
zend_class_entry *calling_scope = NULL;
|
||||
char *function_name_lc;
|
||||
zval *current_this;
|
||||
zend_execute_data execute_data;
|
||||
zval *method_name;
|
||||
zval *params_array;
|
||||
int call_via_handler = 0;
|
||||
|
||||
switch (fci->size) {
|
||||
case sizeof(zend_fcall_info):
|
||||
break; /* nothing to do currently */
|
||||
default:
|
||||
zend_error(E_ERROR, "Corrupted fcall_info provided to zend_call_function()");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Initialize execute_data */
|
||||
if (EG(current_execute_data)) {
|
||||
execute_data = *EG(current_execute_data);
|
||||
} else {
|
||||
/* This only happens when we're called outside any execute()'s
|
||||
* It shouldn't be strictly necessary to NULL execute_data out,
|
||||
* but it may make bugs easier to spot
|
||||
*/
|
||||
memset(&execute_data, 0, sizeof(zend_execute_data));
|
||||
}
|
||||
EX(fbc) = NULL;
|
||||
EX(object) = NULL;
|
||||
EX(Ts) = NULL;
|
||||
EX(op_array) = NULL;
|
||||
EX(opline) = NULL;
|
||||
*retval_ptr_ptr = NULL;
|
||||
|
||||
/* we may return SUCCESS, and yet retval may be uninitialized,
|
||||
* if there was an exception...
|
||||
/**
|
||||
* Function name lookup code
|
||||
*
|
||||
*/
|
||||
*fci->retval_ptr_ptr = NULL;
|
||||
|
||||
if (!fci_cache || !fci_cache->initialized) {
|
||||
if (fci->function_name->type==IS_ARRAY) { /* assume array($obj, $name) couple */
|
||||
if (*function_pointer == NULL) {
|
||||
if (function_name->type==IS_ARRAY) { /* assume array($obj, $name) couple */
|
||||
zval **tmp_object_ptr, **tmp_real_function_name;
|
||||
|
||||
if (zend_hash_index_find(fci->function_name->value.ht, 0, (void **) &tmp_object_ptr)==FAILURE) {
|
||||
if (zend_hash_index_find(function_name->value.ht, 0, (void **) &tmp_object_ptr)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (zend_hash_index_find(fci->function_name->value.ht, 1, (void **) &tmp_real_function_name)==FAILURE) {
|
||||
if (zend_hash_index_find(function_name->value.ht, 1, (void **) &tmp_real_function_name)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
fci->function_name = *tmp_real_function_name;
|
||||
function_name = *tmp_real_function_name;
|
||||
SEPARATE_ZVAL_IF_NOT_REF(tmp_object_ptr);
|
||||
fci->object_pp = tmp_object_ptr;
|
||||
(*fci->object_pp)->is_ref = 1;
|
||||
object_pp = tmp_object_ptr;
|
||||
(*object_pp)->is_ref = 1;
|
||||
}
|
||||
|
||||
if (fci->object_pp && !*fci->object_pp) {
|
||||
fci->object_pp = NULL;
|
||||
if (object_pp && !*object_pp) {
|
||||
object_pp = NULL;
|
||||
}
|
||||
|
||||
if (fci->object_pp) {
|
||||
if (object_pp) {
|
||||
/* TBI!! new object handlers */
|
||||
if (Z_TYPE_PP(fci->object_pp) == IS_OBJECT) {
|
||||
if (!IS_ZEND_STD_OBJECT(**fci->object_pp)) {
|
||||
if (Z_TYPE_PP(object_pp) == IS_OBJECT) {
|
||||
if (!IS_ZEND_STD_OBJECT(**object_pp)) {
|
||||
zend_error(E_WARNING, "Cannot use call_user_function on objects without a class entry");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
calling_scope = Z_OBJCE_PP(fci->object_pp);
|
||||
fci->function_table = &calling_scope->function_table;
|
||||
EX(object) = *fci->object_pp;
|
||||
} else if (Z_TYPE_PP(fci->object_pp) == IS_STRING) {
|
||||
calling_scope = Z_OBJCE_PP(object_pp);
|
||||
function_table = &calling_scope->function_table;
|
||||
EX(object) = *object_pp;
|
||||
} else if (Z_TYPE_PP(object_pp) == IS_STRING) {
|
||||
zend_class_entry **ce;
|
||||
char *lc_class;
|
||||
int found = FAILURE;
|
||||
|
||||
if (EG(active_op_array) && strcmp(Z_STRVAL_PP(fci->object_pp), "self") == 0) {
|
||||
if (!EG(active_op_array)->scope) {
|
||||
zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
|
||||
}
|
||||
lc_class = zend_str_tolower_dup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp));
|
||||
if(EG(active_op_array) && strcmp(lc_class, "self") == 0) {
|
||||
ce = &(EG(active_op_array)->scope);
|
||||
found = (*ce != NULL?SUCCESS:FAILURE);
|
||||
fci->object_pp = EG(This)?&EG(This):NULL;
|
||||
} else if (strcmp(Z_STRVAL_PP(fci->object_pp), "parent") == 0 && EG(active_op_array)) {
|
||||
|
||||
if (!EG(active_op_array)->scope) {
|
||||
zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
|
||||
}
|
||||
if (!EG(active_op_array)->scope->parent) {
|
||||
zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent");
|
||||
}
|
||||
} else if(strcmp(lc_class, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
|
||||
ce = &(EG(active_op_array)->scope->parent);
|
||||
found = (*ce != NULL?SUCCESS:FAILURE);
|
||||
fci->object_pp = EG(This)?&EG(This):NULL;
|
||||
} else {
|
||||
zend_class_entry *scope;
|
||||
scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
|
||||
|
||||
found = zend_lookup_class(Z_STRVAL_PP(fci->object_pp), Z_STRLEN_PP(fci->object_pp), &ce TSRMLS_CC);
|
||||
if (found == FAILURE) {
|
||||
zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL_PP(fci->object_pp));
|
||||
}
|
||||
if (scope && EG(This) &&
|
||||
instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) &&
|
||||
instanceof_function(scope, *ce TSRMLS_CC)) {
|
||||
fci->object_pp = &EG(This);
|
||||
} else {
|
||||
fci->object_pp = NULL;
|
||||
}
|
||||
found = zend_lookup_class(lc_class, Z_STRLEN_PP(object_pp), &ce TSRMLS_CC);
|
||||
}
|
||||
efree(lc_class);
|
||||
if (found == FAILURE)
|
||||
return FAILURE;
|
||||
|
||||
fci->function_table = &(*ce)->function_table;
|
||||
function_table = &(*ce)->function_table;
|
||||
calling_scope = *ce;
|
||||
}
|
||||
|
||||
if (fci->function_table == NULL) {
|
||||
object_pp = NULL;
|
||||
} else
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (fci->function_name->type!=IS_STRING) {
|
||||
if (function_name->type!=IS_STRING) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (fci->object_pp) {
|
||||
if (Z_OBJ_HT_PP(fci->object_pp)->get_method == NULL) {
|
||||
zend_error(E_ERROR, "Object does not support method calls");
|
||||
}
|
||||
EX(function_state).function =
|
||||
Z_OBJ_HT_PP(fci->object_pp)->get_method(*fci->object_pp, Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name) TSRMLS_CC);
|
||||
} else if (calling_scope) {
|
||||
char *function_name_lc = zend_str_tolower_dup(Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name));
|
||||
function_name_lc = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
|
||||
|
||||
EX(function_state).function =
|
||||
zend_std_get_static_method(calling_scope, function_name_lc, Z_STRLEN_P(fci->function_name) TSRMLS_CC);
|
||||
efree(function_name_lc);
|
||||
} else {
|
||||
char *function_name_lc = zend_str_tolower_dup(Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name));
|
||||
|
||||
if (zend_hash_find(fci->function_table, function_name_lc, fci->function_name->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
|
||||
EX(function_state).function = NULL;
|
||||
}
|
||||
original_function_state_ptr = EG(function_state_ptr);
|
||||
if (zend_hash_find(function_table, function_name_lc, function_name->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
|
||||
efree(function_name_lc);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (EX(function_state).function == NULL) {
|
||||
/* try calling __call */
|
||||
if (calling_scope && calling_scope->__call) {
|
||||
EX(function_state).function = calling_scope->__call;
|
||||
/* prepare params */
|
||||
ALLOC_INIT_ZVAL(method_name);
|
||||
ZVAL_STRINGL(method_name, Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name), 0);
|
||||
|
||||
ALLOC_INIT_ZVAL(params_array);
|
||||
array_init(params_array);
|
||||
call_via_handler = 1;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
if (fci_cache) {
|
||||
fci_cache->function_handler = EX(function_state).function;
|
||||
fci_cache->object_pp = fci->object_pp;
|
||||
fci_cache->calling_scope = calling_scope;
|
||||
fci_cache->initialized = 1;
|
||||
}
|
||||
efree(function_name_lc);
|
||||
*function_pointer = EX(function_state).function;
|
||||
} else {
|
||||
EX(function_state).function = fci_cache->function_handler;
|
||||
calling_scope = fci_cache->calling_scope;
|
||||
fci->object_pp = fci_cache->object_pp;
|
||||
EX(function_state).function = *function_pointer;
|
||||
}
|
||||
|
||||
for (i=0; i<fci->param_count; i++) {
|
||||
|
||||
for (i=0; i<param_count; i++) {
|
||||
zval *param;
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i+1)
|
||||
&& !PZVAL_IS_REF(*fci->params[i])) {
|
||||
if ((*fci->params[i])->refcount>1) {
|
||||
if (EX(function_state).function->common.arg_types
|
||||
&& i<EX(function_state).function->common.arg_types[0]
|
||||
&& EX(function_state).function->common.arg_types[i+1]==BYREF_FORCE
|
||||
&& !PZVAL_IS_REF(*params[i])) {
|
||||
if ((*params[i])->refcount>1) {
|
||||
zval *new_zval;
|
||||
|
||||
if (fci->no_separation) {
|
||||
if (no_separation) {
|
||||
return FAILURE;
|
||||
}
|
||||
ALLOC_ZVAL(new_zval);
|
||||
*new_zval = **fci->params[i];
|
||||
*new_zval = **params[i];
|
||||
zval_copy_ctor(new_zval);
|
||||
new_zval->refcount = 1;
|
||||
(*fci->params[i])->refcount--;
|
||||
*fci->params[i] = new_zval;
|
||||
(*params[i])->refcount--;
|
||||
*params[i] = new_zval;
|
||||
}
|
||||
(*fci->params[i])->refcount++;
|
||||
(*fci->params[i])->is_ref = 1;
|
||||
param = *fci->params[i];
|
||||
} else if (*fci->params[i] != &EG(uninitialized_zval)) {
|
||||
(*fci->params[i])->refcount++;
|
||||
param = *fci->params[i];
|
||||
(*params[i])->refcount++;
|
||||
(*params[i])->is_ref = 1;
|
||||
param = *params[i];
|
||||
} else if (*params[i] != &EG(uninitialized_zval)) {
|
||||
(*params[i])->refcount++;
|
||||
param = *params[i];
|
||||
} else {
|
||||
ALLOC_ZVAL(param);
|
||||
*param = **(fci->params[i]);
|
||||
*param = **(params[i]);
|
||||
INIT_PZVAL(param);
|
||||
}
|
||||
if (call_via_handler) {
|
||||
add_next_index_zval(params_array, param);
|
||||
} else {
|
||||
zend_ptr_stack_push(&EG(argument_stack), param);
|
||||
}
|
||||
zend_ptr_stack_push(&EG(argument_stack), param);
|
||||
}
|
||||
|
||||
if (call_via_handler) {
|
||||
zend_ptr_stack_push(&EG(argument_stack), method_name);
|
||||
zend_ptr_stack_push(&EG(argument_stack), params_array);
|
||||
fci->param_count = 2;
|
||||
}
|
||||
zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) param_count, NULL);
|
||||
|
||||
zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) fci->param_count, NULL);
|
||||
|
||||
original_function_state_ptr = EG(function_state_ptr);
|
||||
EG(function_state_ptr) = &EX(function_state);
|
||||
|
||||
current_scope = EG(scope);
|
||||
@@ -779,35 +622,22 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
|
||||
current_this = EG(This);
|
||||
|
||||
if (fci->object_pp) {
|
||||
if ((EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||
EG(This) = NULL;
|
||||
if (object_pp) {
|
||||
EG(This) = *object_pp;
|
||||
|
||||
if (!PZVAL_IS_REF(EG(This))) {
|
||||
EG(This)->refcount++; /* For $this pointer */
|
||||
} else {
|
||||
EG(This) = *fci->object_pp;
|
||||
zval *this_ptr;
|
||||
|
||||
if (!PZVAL_IS_REF(EG(This))) {
|
||||
EG(This)->refcount++; /* For $this pointer */
|
||||
} else {
|
||||
zval *this_ptr;
|
||||
|
||||
ALLOC_ZVAL(this_ptr);
|
||||
*this_ptr = *EG(This);
|
||||
INIT_PZVAL(this_ptr);
|
||||
zval_copy_ctor(this_ptr);
|
||||
EG(This) = this_ptr;
|
||||
}
|
||||
ALLOC_ZVAL(this_ptr);
|
||||
*this_ptr = *EG(This);
|
||||
INIT_PZVAL(this_ptr);
|
||||
zval_copy_ctor(this_ptr);
|
||||
EG(This) = this_ptr;
|
||||
}
|
||||
} else {
|
||||
EG(This) = NULL;
|
||||
if (calling_scope && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||
int severity;
|
||||
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
|
||||
severity = E_STRICT;
|
||||
} else {
|
||||
severity = E_ERROR;
|
||||
}
|
||||
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically", calling_scope->name, EX(function_state).function->common.function_name);
|
||||
}
|
||||
}
|
||||
|
||||
EX(prev_execute_data) = EG(current_execute_data);
|
||||
@@ -815,9 +645,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
|
||||
if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
|
||||
calling_symbol_table = EG(active_symbol_table);
|
||||
EG(scope) = EX(function_state).function->common.scope;
|
||||
if (fci->symbol_table) {
|
||||
EG(active_symbol_table) = fci->symbol_table;
|
||||
if (symbol_table) {
|
||||
EG(active_symbol_table) = symbol_table;
|
||||
} else {
|
||||
ALLOC_HASHTABLE(EG(active_symbol_table));
|
||||
zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
@@ -825,7 +654,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
|
||||
original_return_value = EG(return_value_ptr_ptr);
|
||||
original_op_array = EG(active_op_array);
|
||||
EG(return_value_ptr_ptr) = fci->retval_ptr_ptr;
|
||||
EG(return_value_ptr_ptr) = retval_ptr_ptr;
|
||||
EG(active_op_array) = (zend_op_array *) EX(function_state).function;
|
||||
original_opline_ptr = EG(opline_ptr);
|
||||
orig_free_op1 = EG(free_op1);
|
||||
@@ -833,7 +662,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
orig_unary_op = EG(unary_op);
|
||||
orig_binary_op = EG(binary_op);
|
||||
zend_execute(EG(active_op_array) TSRMLS_CC);
|
||||
if (!fci->symbol_table) {
|
||||
if (!symbol_table) {
|
||||
zend_hash_destroy(EG(active_symbol_table));
|
||||
FREE_HASHTABLE(EG(active_symbol_table));
|
||||
}
|
||||
@@ -846,18 +675,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
EG(unary_op) = orig_unary_op;
|
||||
EG(binary_op) = orig_binary_op;
|
||||
} else {
|
||||
ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
|
||||
if (EX(function_state).function->common.scope) {
|
||||
EG(scope) = EX(function_state).function->common.scope;
|
||||
}
|
||||
((zend_internal_function *) EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, (fci->object_pp?*fci->object_pp:NULL), 1 TSRMLS_CC);
|
||||
INIT_PZVAL(*fci->retval_ptr_ptr);
|
||||
ALLOC_INIT_ZVAL(*retval_ptr_ptr);
|
||||
((zend_internal_function *) EX(function_state).function)->handler(param_count, *retval_ptr_ptr, (object_pp?*object_pp:NULL), 1 TSRMLS_CC);
|
||||
INIT_PZVAL(*retval_ptr_ptr);
|
||||
}
|
||||
zend_ptr_stack_clear_multiple(TSRMLS_C);
|
||||
if (call_via_handler) {
|
||||
zval_ptr_dtor(&method_name);
|
||||
zval_ptr_dtor(¶ms_array);
|
||||
}
|
||||
EG(function_state_ptr) = original_function_state_ptr;
|
||||
|
||||
if (EG(This)) {
|
||||
@@ -865,84 +687,47 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
}
|
||||
EG(scope) = current_scope;
|
||||
EG(This) = current_this;
|
||||
EG(current_execute_data) = EX(prev_execute_data);
|
||||
EG(current_execute_data) = EX(prev_execute_data); \
|
||||
|
||||
if (EG(exception)) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
|
||||
{
|
||||
zval **args[1];
|
||||
zval autoload_function;
|
||||
zval class_name, *class_name_ptr = &class_name;
|
||||
zval *autoload_function;
|
||||
zval *class_name;
|
||||
zval *retval_ptr;
|
||||
int retval;
|
||||
char *lc_name;
|
||||
zval *exception;
|
||||
char dummy = 1;
|
||||
|
||||
lc_name = do_alloca(name_length + 1);
|
||||
zend_str_tolower_copy(lc_name, name, name_length);
|
||||
|
||||
if (zend_hash_find(EG(class_table), lc_name, name_length+1, (void **) ce) == SUCCESS) {
|
||||
free_alloca(lc_name);
|
||||
if (zend_hash_find(EG(class_table), name, name_length+1, (void **) ce) == SUCCESS) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
|
||||
* (doesn't impact fuctionality of __autoload()
|
||||
*/
|
||||
if (zend_is_compiling(TSRMLS_C)) {
|
||||
free_alloca(lc_name);
|
||||
return FAILURE;
|
||||
}
|
||||
MAKE_STD_ZVAL(autoload_function);
|
||||
ZVAL_STRINGL(autoload_function, "__autoload", sizeof("__autoload")-1, 1);
|
||||
|
||||
if (EG(in_autoload) == NULL) {
|
||||
ALLOC_HASHTABLE(EG(in_autoload));
|
||||
zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0);
|
||||
}
|
||||
MAKE_STD_ZVAL(class_name);
|
||||
ZVAL_STRINGL(class_name, name, name_length, 1);
|
||||
args[0] = &class_name;
|
||||
|
||||
retval = call_user_function_ex(EG(function_table), NULL, autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
|
||||
|
||||
zval_ptr_dtor(&autoload_function);
|
||||
zval_ptr_dtor(&class_name);
|
||||
|
||||
if (zend_hash_add(EG(in_autoload), lc_name, name_length+1, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
|
||||
free_alloca(lc_name);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 0);
|
||||
|
||||
INIT_PZVAL(class_name_ptr);
|
||||
ZVAL_STRINGL(class_name_ptr, name, name_length, 0);
|
||||
|
||||
args[0] = &class_name_ptr;
|
||||
|
||||
exception = EG(exception);
|
||||
EG(exception) = NULL;
|
||||
retval = call_user_function_ex(EG(function_table), NULL, &autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
|
||||
|
||||
zend_hash_del(EG(in_autoload), lc_name, name_length+1);
|
||||
|
||||
if (retval == FAILURE) {
|
||||
EG(exception) = exception;
|
||||
free_alloca(lc_name);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (EG(exception)) {
|
||||
free_alloca(lc_name);
|
||||
zend_error(E_ERROR, "Function %s(%s) threw an exception of type '%s'", ZEND_AUTOLOAD_FUNC_NAME, name, Z_OBJCE_P(EG(exception))->name);
|
||||
return FAILURE;
|
||||
zend_error(E_ERROR, "__autoload threw an exception");
|
||||
}
|
||||
EG(exception) = exception;
|
||||
|
||||
/* If an exception is thrown retval_ptr will be NULL but we bailout before we reach this point */
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
|
||||
retval = zend_hash_find(EG(class_table), lc_name, name_length + 1, (void **) ce);
|
||||
free_alloca(lc_name);
|
||||
return retval;
|
||||
return zend_hash_find(EG(class_table), name, name_length + 1, (void **) ce);
|
||||
}
|
||||
|
||||
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
|
||||
@@ -977,7 +762,7 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR
|
||||
zval *local_retval_ptr=NULL;
|
||||
zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
|
||||
zend_op **original_opline_ptr = EG(opline_ptr);
|
||||
|
||||
|
||||
EG(return_value_ptr_ptr) = &local_retval_ptr;
|
||||
EG(active_op_array) = new_op_array;
|
||||
EG(no_extensions)=1;
|
||||
@@ -1012,22 +797,9 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC)
|
||||
{
|
||||
int result;
|
||||
|
||||
result = zend_eval_string(str, retval_ptr, string_name TSRMLS_CC);
|
||||
if (handle_exceptions && EG(exception)) {
|
||||
zend_exception_error(EG(exception) TSRMLS_CC);
|
||||
result = FAILURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void execute_new_code(TSRMLS_D)
|
||||
{
|
||||
zend_op *opline, *end;
|
||||
zend_op *opline, *end;
|
||||
zend_op *ret_opline;
|
||||
zval *local_retval=NULL;
|
||||
|
||||
@@ -1047,22 +819,22 @@ void execute_new_code(TSRMLS_D)
|
||||
if (!CG(active_op_array)->start_op) {
|
||||
CG(active_op_array)->start_op = CG(active_op_array)->opcodes;
|
||||
}
|
||||
|
||||
|
||||
opline=CG(active_op_array)->start_op;
|
||||
end=CG(active_op_array)->opcodes+CG(active_op_array)->last;
|
||||
|
||||
while (opline<end) {
|
||||
if (opline->op1.op_type==IS_CONST) {
|
||||
opline->op1.u.constant.is_ref = 1;
|
||||
opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
|
||||
}
|
||||
if (opline->op2.op_type==IS_CONST) {
|
||||
opline->op2.u.constant.is_ref = 1;
|
||||
opline->op2.u.constant.refcount = 2;
|
||||
}
|
||||
while (opline<end) {
|
||||
if (opline->op1.op_type==IS_CONST) {
|
||||
opline->op1.u.constant.is_ref = 1;
|
||||
opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
|
||||
}
|
||||
if (opline->op2.op_type==IS_CONST) {
|
||||
opline->op2.u.constant.is_ref = 1;
|
||||
opline->op2.u.constant.refcount = 2;
|
||||
}
|
||||
opline->handler = zend_opcode_handlers[opline->opcode];
|
||||
opline++;
|
||||
}
|
||||
}
|
||||
|
||||
EG(return_value_ptr_ptr) = &local_retval;
|
||||
EG(active_op_array) = CG(active_op_array);
|
||||
@@ -1090,7 +862,7 @@ ZEND_API void zend_timeout(int dummy)
|
||||
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_DESTROY:
|
||||
@@ -1101,18 +873,7 @@ static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wPa
|
||||
if (lParam==0) {
|
||||
KillTimer(timeout_window, wParam);
|
||||
} else {
|
||||
#ifdef ZTS
|
||||
void ***tsrm_ls;
|
||||
#endif
|
||||
SetTimer(timeout_window, wParam, lParam*1000, NULL);
|
||||
#ifdef ZTS
|
||||
tsrm_ls = ts_resource_ex(0, &wParam);
|
||||
if (!tsrm_ls) {
|
||||
/* shouldn't normally happen */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
EG(timed_out) = 0;
|
||||
}
|
||||
break;
|
||||
case WM_UNREGISTER_ZEND_TIMEOUT:
|
||||
@@ -1245,90 +1006,6 @@ void zend_unset_timeout(TSRMLS_D)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC)
|
||||
{
|
||||
zend_class_entry **pce;
|
||||
|
||||
check_fetch_type:
|
||||
switch (fetch_type) {
|
||||
case ZEND_FETCH_CLASS_SELF:
|
||||
if (!EG(scope)) {
|
||||
zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
|
||||
}
|
||||
return EG(scope);
|
||||
case ZEND_FETCH_CLASS_PARENT:
|
||||
if (!EG(scope)) {
|
||||
zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
|
||||
}
|
||||
if (!EG(scope)->parent) {
|
||||
zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent");
|
||||
}
|
||||
return EG(scope)->parent;
|
||||
case ZEND_FETCH_CLASS_AUTO: {
|
||||
fetch_type = zend_get_class_fetch_type(class_name, class_name_len);
|
||||
if (fetch_type!=ZEND_FETCH_CLASS_DEFAULT) {
|
||||
goto check_fetch_type;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC)==FAILURE) {
|
||||
zend_error(E_ERROR, "Class '%s' not found", class_name);
|
||||
}
|
||||
return *pce;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define MAX_ABSTRACT_INFO_CNT 3
|
||||
#define MAX_ABSTRACT_INFO_FMT "%s%s%s%s"
|
||||
#define DISPLAY_ABSTRACT_FN(idx) \
|
||||
ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : "", \
|
||||
ai.afn[idx] ? "::" : "", \
|
||||
ai.afn[idx] ? ai.afn[idx]->common.function_name : "", \
|
||||
ai.afn[idx] && ai.afn[idx+1] ? ", " : (ai.afn[idx] && ai.cnt >= MAX_ABSTRACT_INFO_CNT ? ", ..." : "")
|
||||
|
||||
typedef struct _zend_abstract_info {
|
||||
zend_function *afn[MAX_ABSTRACT_INFO_CNT+1];
|
||||
int cnt;
|
||||
} zend_abstract_info;
|
||||
|
||||
|
||||
static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC)
|
||||
{
|
||||
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
if (ai->cnt < MAX_ABSTRACT_INFO_CNT) {
|
||||
ai->afn[ai->cnt] = fn;
|
||||
}
|
||||
ai->cnt++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC)
|
||||
{
|
||||
zend_abstract_info ai;
|
||||
|
||||
if ((ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) && !(ce->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
|
||||
memset(&ai, 0, sizeof(ai));
|
||||
|
||||
zend_hash_apply_with_argument(&ce->function_table, (apply_func_arg_t) zend_verify_abstract_class_function, &ai TSRMLS_CC);
|
||||
|
||||
if (ai.cnt) {
|
||||
zend_error(E_ERROR, "Class %s contains %d abstract methods and must therefore be declared abstract (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
|
||||
ce->name, ai.cnt,
|
||||
DISPLAY_ABSTRACT_FN(0),
|
||||
DISPLAY_ABSTRACT_FN(1),
|
||||
DISPLAY_ABSTRACT_FN(2)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -12,22 +12,45 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: George Schlossnagle <george@omniti.com> |
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef ZEND_REFLECTION_API_H
|
||||
#define ZEND_REFLECTION_API_H
|
||||
#ifndef ZEND_EXECUTE_LOCKS_H
|
||||
#define ZEND_EXECUTE_LOCKS_H
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
#define PZVAL_LOCK(z) zend_pzval_lock_func(z)
|
||||
|
||||
ZEND_API void zend_register_reflection_api(TSRMLS_D);
|
||||
|
||||
END_EXTERN_C()
|
||||
static inline void zend_pzval_lock_func(zval *z)
|
||||
{
|
||||
z->refcount++;
|
||||
}
|
||||
|
||||
#endif
|
||||
#define PZVAL_UNLOCK(z) zend_pzval_unlock_func(z TSRMLS_CC)
|
||||
|
||||
static inline void zend_pzval_unlock_func(zval *z TSRMLS_DC)
|
||||
{
|
||||
z->refcount--;
|
||||
if (!z->refcount) {
|
||||
z->refcount = 1;
|
||||
z->is_ref = 0;
|
||||
EG(garbage)[EG(garbage_ptr)++] = z;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void zend_clean_garbage(TSRMLS_D)
|
||||
{
|
||||
while (EG(garbage_ptr)) {
|
||||
zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);
|
||||
}
|
||||
}
|
||||
|
||||
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
|
||||
|
||||
#endif /* ZEND_EXECUTE_LOCKS_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
Loaded 100 of 2818 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user