From 09e0bfba498b74639be02732aaf0e527c898a58c Mon Sep 17 00:00:00 2001 From: SVN Migration Date: Wed, 14 May 2003 13:05:23 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'RELEASE_0_9b'. --- .gdbinit | 348 - CODING_STANDARDS | 240 - CREDITS | 2 - ChangeLog | 10342 ---------------- ChangeLog.1999.gz | Bin 78772 -> 0 bytes ChangeLog.2000.gz | Bin 159518 -> 0 bytes ChangeLog.2001.gz | Bin 198003 -> 0 bytes ChangeLog.2002.gz | Bin 262369 -> 0 bytes EXTENSIONS | 492 - INSTALL | 422 - LICENSE | 68 - Makefile.frag | 23 - Makefile.global | 68 - NEWS | 2544 ---- README.CVS-RULES | 115 - README.EXTENSIONS | 39 - README.EXT_SKEL | 193 - README.PARAMETER_PARSING_API | 127 - README.QNX | 57 - README.SELF-CONTAINED-EXTENSIONS | 155 - README.STREAMS | 379 - README.SUBMITTING_PATCH | 126 - README.TESTING | 170 - README.TESTING2 | 137 - README.UNIX-BUILD-SYSTEM | 123 - README.Zeus | 112 - README.input_filter | 188 - TODO | 162 - TODO-PHP5 | 211 - TODO.BUILDv5 | 3 - TSRM/LICENSE | 26 - TSRM/Makefile.am | 6 - TSRM/TODO | 2 - TSRM/TSRM.c | 666 - TSRM/TSRM.dsp | 186 - TSRM/TSRM.h | 176 - TSRM/acconfig.h | 1 - TSRM/acinclude.m4 | 5 - TSRM/build.mk | 43 - TSRM/buildconf | 33 - TSRM/configure.in | 31 - TSRM/readdir.h | 44 - TSRM/threads.m4 | 165 - TSRM/tsrm.m4 | 128 - TSRM/tsrm_config.nw.h | 11 - TSRM/tsrm_config.w32.h | 19 - TSRM/tsrm_config_common.h | 60 - TSRM/tsrm_nw.c | 240 - TSRM/tsrm_nw.h | 29 - TSRM/tsrm_strtok_r.c | 63 - TSRM/tsrm_strtok_r.h | 6 - TSRM/tsrm_virtual_cwd.c | 859 -- TSRM/tsrm_virtual_cwd.h | 266 - TSRM/tsrm_win32.c | 377 - TSRM/tsrm_win32.h | 105 - Zend/ChangeLog | 12075 ------------------- Zend/FlexLexer.h | 186 - Zend/LICENSE | 56 - Zend/Makefile.am | 51 - Zend/OBJECTS2_HOWTO | 195 - Zend/RFCs/001.txt | 136 - Zend/RFCs/002.txt | 169 - Zend/RFCs/003.txt | 72 - Zend/RFCs/004.txt | 107 - Zend/ZEND_CHANGES | 802 -- Zend/Zend.dsp | 586 - Zend/Zend.m4 | 236 - Zend/ZendCore.dep | 258 - Zend/ZendTS.dsp | 707 -- Zend/acconfig.h | 105 - Zend/acinclude.m4 | 47 - Zend/build.mk | 43 - Zend/buildconf | 33 - Zend/configure.in | 47 - Zend/flex.skl | 1643 --- Zend/tests/zend2.php | 339 - Zend/zend.c | 1099 -- Zend/zend.h | 617 - Zend/zend.ico | Bin 1382 -> 0 bytes Zend/zend_API.c | 1673 --- Zend/zend_API.h | 447 - Zend/zend_alloc.c | 787 -- Zend/zend_alloc.h | 146 - Zend/zend_builtin_functions.c | 1803 --- Zend/zend_builtin_functions.h | 35 - Zend/zend_compile.c | 3592 ------ Zend/zend_compile.h | 814 -- Zend/zend_config.nw.h | 88 - Zend/zend_config.w32.h | 107 - Zend/zend_constants.c | 275 - Zend/zend_constants.h | 73 - Zend/zend_default_classes.c | 140 - Zend/zend_default_classes.h | 39 - Zend/zend_dynamic_array.c | 72 - Zend/zend_dynamic_array.h | 47 - Zend/zend_errors.h | 48 - Zend/zend_exceptions.c | 140 - Zend/zend_exceptions.h | 39 - Zend/zend_execute.c | 4276 ------- Zend/zend_execute.h | 185 - Zend/zend_execute_API.c | 1094 -- Zend/zend_execute_locks.h | 61 - Zend/zend_extensions.c | 295 - Zend/zend_extensions.h | 125 - Zend/zend_fast_cache.h | 142 - Zend/zend_globals.h | 292 - Zend/zend_globals_macros.h | 117 - Zend/zend_hash.c | 1354 --- Zend/zend_hash.h | 290 - Zend/zend_highlight.c | 250 - Zend/zend_highlight.h | 61 - Zend/zend_indent.c | 156 - Zend/zend_indent.h | 35 - Zend/zend_ini.c | 524 - Zend/zend_ini.h | 210 - Zend/zend_ini_parser.y | 238 - Zend/zend_ini_scanner.h | 41 - Zend/zend_ini_scanner.l | 226 - Zend/zend_istdiostream.h | 44 - Zend/zend_language_parser.y | 974 -- Zend/zend_language_scanner.h | 50 - Zend/zend_language_scanner.l | 1588 --- Zend/zend_list.c | 368 - Zend/zend_list.h | 120 - Zend/zend_llist.c | 317 - Zend/zend_llist.h | 86 - Zend/zend_mm.c | 371 - Zend/zend_mm.h | 74 - Zend/zend_modules.h | 100 - Zend/zend_multibyte.c | 0 Zend/zend_multiply.h | 43 - Zend/zend_object_handlers.c | 843 -- Zend/zend_object_handlers.h | 112 - Zend/zend_objects.c | 150 - Zend/zend_objects.h | 40 - Zend/zend_objects_API.c | 297 - Zend/zend_objects_API.h | 80 - Zend/zend_opcode.c | 508 - Zend/zend_operators.c | 1801 --- Zend/zend_operators.h | 310 - Zend/zend_ptr_stack.c | 119 - Zend/zend_ptr_stack.h | 66 - Zend/zend_qsort.c | 127 - Zend/zend_qsort.h | 36 - Zend/zend_sprintf.c | 49 - Zend/zend_stack.c | 173 - Zend/zend_stack.h | 56 - Zend/zend_static_allocator.c | 84 - Zend/zend_static_allocator.h | 55 - Zend/zend_stream.c | 123 - Zend/zend_stream.h | 59 - Zend/zend_ts_hash.c | 364 - Zend/zend_ts_hash.h | 128 - Zend/zend_types.h | 39 - Zend/zend_variables.c | 175 - Zend/zend_variables.h | 66 - acconfig.h.in | 1 - acinclude.m4 | 1802 --- build/build.mk | 73 - build/build2.mk | 59 - build/buildcheck.sh | 113 - build/config-stubs | 8 - build/genif.sh | 41 - build/mkdep.awk | 75 - build/print_include.awk | 6 - build/shtool | 1046 -- buildconf | 24 - bundle/expat/Changes | 99 - bundle/expat/README | 72 - bundle/expat/README.php | 11 - bundle/expat/ascii.h | 85 - bundle/expat/asciitab.h | 36 - bundle/expat/config.m4 | 43 - bundle/expat/expat.h | 910 -- bundle/expat/iasciitab.h | 37 - bundle/expat/internal.h | 46 - bundle/expat/latin1tab.h | 36 - bundle/expat/nametab.h | 150 - bundle/expat/utf8tab.h | 37 - bundle/expat/winconfig.h | 30 - bundle/expat/xmlparse.c | 5592 --------- bundle/expat/xmlrole.c | 1330 -- bundle/expat/xmlrole.h | 114 - bundle/expat/xmltok.c | 1641 --- bundle/expat/xmltok.h | 312 - bundle/expat/xmltok_impl.c | 1778 --- bundle/expat/xmltok_impl.h | 46 - bundle/expat/xmltok_ns.c | 106 - bundle/libxml/DOCBparser.c | 6107 ---------- bundle/libxml/HTMLparser.c | 5013 -------- bundle/libxml/HTMLtree.c | 1099 -- bundle/libxml/SAX.c | 2015 ---- bundle/libxml/c14n.c | 1930 --- bundle/libxml/catalog.c | 3502 ------ bundle/libxml/config.m4 | 80 - bundle/libxml/debugXML.c | 2480 ---- bundle/libxml/encoding.c | 2340 ---- bundle/libxml/entities.c | 1006 -- bundle/libxml/error.c | 420 - bundle/libxml/globals.c | 653 - bundle/libxml/hash.c | 822 -- bundle/libxml/include/libxml/DOCBparser.h | 73 - bundle/libxml/include/libxml/HTMLparser.h | 117 - bundle/libxml/include/libxml/HTMLtree.h | 117 - bundle/libxml/include/libxml/Makefile.am | 46 - bundle/libxml/include/libxml/Makefile.in | 335 - bundle/libxml/include/libxml/SAX.h | 128 - bundle/libxml/include/libxml/c14n.h | 91 - bundle/libxml/include/libxml/catalog.h | 138 - bundle/libxml/include/libxml/debugXML.h | 163 - bundle/libxml/include/libxml/encoding.h | 230 - bundle/libxml/include/libxml/entities.h | 109 - bundle/libxml/include/libxml/globals.h | 336 - bundle/libxml/include/libxml/hash.h | 166 - bundle/libxml/include/libxml/list.h | 116 - bundle/libxml/include/libxml/nanoftp.h | 117 - bundle/libxml/include/libxml/nanohttp.h | 56 - bundle/libxml/include/libxml/parser.h | 869 -- bundle/libxml/include/libxml/parserInternals.h | 413 - bundle/libxml/include/libxml/schemasInternals.h | 353 - bundle/libxml/include/libxml/threads.h | 62 - bundle/libxml/include/libxml/tree.h | 894 -- bundle/libxml/include/libxml/uri.h | 67 - bundle/libxml/include/libxml/valid.h | 319 - bundle/libxml/include/libxml/xinclude.h | 26 - bundle/libxml/include/libxml/xlink.h | 180 - bundle/libxml/include/libxml/xmlIO.h | 283 - bundle/libxml/include/libxml/xmlautomata.h | 94 - bundle/libxml/include/libxml/xmlerror.h | 184 - bundle/libxml/include/libxml/xmlmemory.h | 169 - bundle/libxml/include/libxml/xmlreader.h | 56 - bundle/libxml/include/libxml/xmlregexp.h | 81 - bundle/libxml/include/libxml/xmlschemas.h | 106 - bundle/libxml/include/libxml/xmlschemastypes.h | 42 - bundle/libxml/include/libxml/xmlunicode.h | 164 - bundle/libxml/include/libxml/xmlversion.h | 272 - bundle/libxml/include/libxml/xmlversion.h.in | 272 - bundle/libxml/include/libxml/xpath.h | 410 - bundle/libxml/include/libxml/xpathInternals.h | 580 - bundle/libxml/include/libxml/xpointer.h | 83 - bundle/libxml/include/win32config.h | 111 - bundle/libxml/include/wsockcompat.h | 61 - bundle/libxml/libxml.h | 28 - bundle/libxml/list.c | 720 -- bundle/libxml/nanoftp.c | 1924 --- bundle/libxml/nanohttp.c | 1528 --- bundle/libxml/parser.c | 10912 ----------------- bundle/libxml/parserInternals.c | 3481 ------ bundle/libxml/stamp-h.in | 1 - bundle/libxml/threads.c | 537 - bundle/libxml/tree.c | 7566 ------------ bundle/libxml/trio.c | 6760 ----------- bundle/libxml/trio.h | 216 - bundle/libxml/triodef.h | 182 - bundle/libxml/trionan.c | 913 -- bundle/libxml/trionan.h | 81 - bundle/libxml/triop.h | 150 - bundle/libxml/triostr.c | 2024 ---- bundle/libxml/triostr.h | 127 - bundle/libxml/uri.c | 1962 --- bundle/libxml/valid.c | 5968 --------- bundle/libxml/xinclude.c | 1729 --- bundle/libxml/xlink.c | 179 - bundle/libxml/xmlIO.c | 2839 ----- bundle/libxml/xmlmemory.c | 777 -- bundle/libxml/xmlreader.c | 882 -- bundle/libxml/xmlregexp.c | 4319 ------- bundle/libxml/xmlschemas.c | 5468 --------- bundle/libxml/xmlschemastypes.c | 1880 --- bundle/libxml/xmlunicode.c | 4290 ------- bundle/libxml/xpath.c | 10990 ----------------- bundle/libxml/xpointer.c | 2902 ----- config.guess | 1363 --- config.sub | 1470 --- configure.in | 1365 --- cvsclean | 3 - ext/bcmath/CREDITS | 2 - ext/bcmath/bcmath.c | 557 - ext/bcmath/config.m4 | 17 - ext/bcmath/libbcmath/AUTHORS | 3 - ext/bcmath/libbcmath/COPYING.LIB | 515 - ext/bcmath/libbcmath/ChangeLog | 10 - ext/bcmath/libbcmath/FAQ | 21 - ext/bcmath/libbcmath/INSTALL | 9 - ext/bcmath/libbcmath/Makefile.am | 12 - ext/bcmath/libbcmath/NEWS | 3 - ext/bcmath/libbcmath/README | 9 - ext/bcmath/libbcmath/acconfig.h | 9 - ext/bcmath/libbcmath/aclocal.m4 | 127 - ext/bcmath/libbcmath/config.h.in | 41 - ext/bcmath/libbcmath/configure | 1859 --- ext/bcmath/libbcmath/configure.in | 18 - ext/bcmath/libbcmath/install-sh | 238 - ext/bcmath/libbcmath/missing | 134 - ext/bcmath/libbcmath/mkinstalldirs | 36 - ext/bcmath/libbcmath/src/Makefile.am | 22 - ext/bcmath/libbcmath/src/add.c | 88 - ext/bcmath/libbcmath/src/bcmath.h | 155 - ext/bcmath/libbcmath/src/compare.c | 161 - ext/bcmath/libbcmath/src/config.h | 12 - ext/bcmath/libbcmath/src/debug.c | 69 - ext/bcmath/libbcmath/src/div.c | 274 - ext/bcmath/libbcmath/src/divmod.c | 87 - ext/bcmath/libbcmath/src/doaddsub.c | 232 - ext/bcmath/libbcmath/src/init.c | 130 - ext/bcmath/libbcmath/src/int2num.c | 84 - ext/bcmath/libbcmath/src/nearzero.c | 69 - ext/bcmath/libbcmath/src/neg.c | 49 - ext/bcmath/libbcmath/src/num2long.c | 70 - ext/bcmath/libbcmath/src/num2str.c | 79 - ext/bcmath/libbcmath/src/outofmem.c | 46 - ext/bcmath/libbcmath/src/output.c | 208 - ext/bcmath/libbcmath/src/private.h | 43 - ext/bcmath/libbcmath/src/raise.c | 124 - ext/bcmath/libbcmath/src/raisemod.c | 97 - ext/bcmath/libbcmath/src/recmul.c | 306 - ext/bcmath/libbcmath/src/rmzero.c | 55 - ext/bcmath/libbcmath/src/rt.c | 65 - ext/bcmath/libbcmath/src/sqrt.c | 129 - ext/bcmath/libbcmath/src/str2num.c | 109 - ext/bcmath/libbcmath/src/sub.c | 90 - ext/bcmath/libbcmath/src/zero.c | 64 - ext/bcmath/php_bcmath.h | 71 - ext/bcmath/tests/bcadd.phpt | 16 - ext/bcmath/tests/bccomp.phpt | 18 - ext/bcmath/tests/bcdiv.phpt | 18 - ext/bcmath/tests/bcmod.phpt | 16 - ext/bcmath/tests/bcmul.phpt | 18 - ext/bcmath/tests/bcpow.phpt | 16 - ext/bcmath/tests/bcscale.phpt | 21 - ext/bcmath/tests/bcsqrt.phpt | 14 - ext/bcmath/tests/bcsub.phpt | 16 - ext/calendar/CREDITS | 2 - ext/calendar/cal_unix.c | 88 - ext/calendar/calendar.c | 639 - ext/calendar/config.m4 | 11 - ext/calendar/dow.c | 76 - ext/calendar/easter.c | 141 - ext/calendar/french.c | 160 - ext/calendar/gregor.c | 265 - ext/calendar/jewish.c | 763 -- ext/calendar/julian.c | 249 - ext/calendar/php_calendar.h | 50 - ext/calendar/sdncal.h | 97 - ext/calendar/tests/jdtojewish.phpt | 28 - ext/cpdf/CREDITS | 2 - ext/cpdf/config.m4 | 96 - ext/cpdf/cpdf.c | 2230 ---- ext/cpdf/cpdf.dsp | 111 - ext/cpdf/php_cpdf.h | 119 - ext/crack/CREDITS | 4 - ext/crack/EXPERIMENTAL | 5 - ext/crack/config.m4 | 33 - ext/crack/crack.c | 277 - ext/crack/crack.dsp | 114 - ext/crack/php_crack.h | 72 - ext/crack/tests/001.phpt | 23 - ext/ctype/CREDITS | 2 - ext/ctype/README | 5 - ext/ctype/config.m4 | 11 - ext/ctype/ctype.c | 216 - ext/ctype/ctype.dsp | 107 - ext/ctype/ctype.xml | 245 - ext/ctype/php_ctype.h | 83 - ext/ctype/tests/001.phpt | 41 - ext/ctype/tests/002.phpt | 50 - ext/curl/CREDITS | 2 - ext/curl/config.m4 | 78 - ext/curl/curl.dsp | 186 - ext/curl/interface.c | 1284 -- ext/curl/multi.c | 266 - ext/curl/php_curl.h | 166 - ext/curl/streams.c | 381 - ext/cyrus/CREDITS | 2 - ext/cyrus/config.m4 | 83 - ext/cyrus/cyrus.c | 516 - ext/cyrus/php_cyrus.h | 78 - ext/db/CREDITS | 2 - ext/db/config.m4 | 58 - ext/db/db.c | 1204 -- ext/db/db.dsp | 114 - ext/db/php_db.h | 80 - ext/db/tests/001.phpt | 16 - ext/db/tests/002.phpt | 17 - ext/db/tests/003.phpt | 20 - ext/db/tests/004.phpt | 23 - ext/db/tests/005.phpt | 27 - ext/db/tests/006.phpt | 29 - ext/db/tests/test.inc | 3 - ext/dba/CREDITS | 2 - ext/dba/config.m4 | 443 - ext/dba/dba.c | 1026 -- ext/dba/dba.dsp | 197 - ext/dba/dba_cdb.c | 350 - ext/dba/dba_db2.c | 205 - ext/dba/dba_db3.c | 234 - ext/dba/dba_db4.c | 239 - ext/dba/dba_dbm.c | 213 - ext/dba/dba_flatfile.c | 188 - ext/dba/dba_gdbm.c | 200 - ext/dba/dba_inifile.c | 186 - ext/dba/dba_ndbm.c | 171 - ext/dba/install_cdb.sh | 53 - ext/dba/libcdb/cdb.c | 193 - ext/dba/libcdb/cdb.h | 57 - ext/dba/libcdb/cdb_make.c | 244 - ext/dba/libcdb/cdb_make.h | 64 - ext/dba/libcdb/uint32.c | 49 - ext/dba/libcdb/uint32.h | 39 - ext/dba/libflatfile/flatfile.c | 321 - ext/dba/libflatfile/flatfile.h | 48 - ext/dba/libinifile/inifile.c | 598 - ext/dba/libinifile/inifile.h | 67 - ext/dba/php_cdb.h | 12 - ext/dba/php_db2.h | 12 - ext/dba/php_db3.h | 12 - ext/dba/php_db4.h | 12 - ext/dba/php_dba.h | 148 - ext/dba/php_dbm.h | 12 - ext/dba/php_flatfile.h | 12 - ext/dba/php_gdbm.h | 12 - ext/dba/php_inifile.h | 12 - ext/dba/php_ndbm.h | 12 - ext/dba/tests/dba001.phpt | 21 - ext/dba/tests/dba002.phpt | 22 - ext/dba/tests/dba003.phpt | 24 - ext/dba/tests/dba004.phpt | 28 - ext/dba/tests/dba005.phpt | 35 - ext/dba/tests/dba006.phpt | 37 - ext/dba/tests/dba007.phpt | 45 - ext/dba/tests/dba008.phpt | 32 - ext/dba/tests/dba009.phpt | 33 - ext/dba/tests/dba_cdb.phpt | 30 - ext/dba/tests/dba_cdb_make.phpt | 38 - ext/dba/tests/dba_cdb_read.phpt | 65 - ext/dba/tests/dba_db2.phpt | 29 - ext/dba/tests/dba_db3.phpt | 29 - ext/dba/tests/dba_db4.phpt | 29 - ext/dba/tests/dba_dbm.phpt | 29 - ext/dba/tests/dba_flatfile.phpt | 29 - ext/dba/tests/dba_gdbm.phpt | 32 - ext/dba/tests/dba_handler.inc | 75 - ext/dba/tests/dba_inifile.phpt | 29 - ext/dba/tests/dba_ndbm.phpt | 29 - ext/dba/tests/skipif.inc | 23 - ext/dba/tests/test.cdb | Bin 2230 -> 0 bytes ext/dba/tests/test.inc | 7 - ext/dbase/CREDITS | 2 - ext/dbase/config.m4 | 13 - ext/dbase/dbase.c | 775 -- ext/dbase/dbase.dsp | 151 - ext/dbase/dbf.h | 94 - ext/dbase/dbf_head.c | 291 - ext/dbase/dbf_head.h | 11 - ext/dbase/dbf_misc.c | 179 - ext/dbase/dbf_misc.h | 13 - ext/dbase/dbf_ndx.c | 191 - ext/dbase/dbf_ndx.h | 98 - ext/dbase/dbf_rec.c | 206 - ext/dbase/dbf_rec.h | 10 - ext/dbase/php_dbase.h | 44 - ext/dbx/CREDITS | 2 - ext/dbx/INSTALL | 25 - ext/dbx/config.m4 | 10 - ext/dbx/dbx.c | 882 -- ext/dbx/dbx.dsp | 173 - ext/dbx/dbx.h | 62 - ext/dbx/dbx_fbsql.c | 283 - ext/dbx/dbx_fbsql.h | 63 - ext/dbx/dbx_mssql.c | 282 - ext/dbx/dbx_mssql.h | 62 - ext/dbx/dbx_mysql.c | 304 - ext/dbx/dbx_mysql.h | 62 - ext/dbx/dbx_oci8.c | 301 - ext/dbx/dbx_oci8.h | 62 - ext/dbx/dbx_odbc.c | 301 - ext/dbx/dbx_odbc.h | 62 - ext/dbx/dbx_pgsql.c | 297 - ext/dbx/dbx_pgsql.h | 58 - ext/dbx/dbx_sybasect.c | 307 - ext/dbx/dbx_sybasect.h | 62 - ext/dbx/howto_extend_dbx.html | 316 - ext/dbx/php_dbx.h | 88 - ext/dbx/tests/001.phpt | 10 - ext/dbx/tests/002.phpt | 29 - ext/dbx/tests/003.phpt | 107 - ext/dbx/tests/004.phpt | 35 - ext/dbx/tests/005.phpt | 106 - ext/dbx/tests/006.phpt | 56 - ext/dbx/tests/007.phpt | 74 - ext/dbx/tests/008.phpt | 146 - ext/dbx/tests/009.phpt | 65 - ext/dbx/tests/dbx_test.p | 65 - ext/dbx/tests/dbx_test.pgsql.script | 37 - ext/dbx/tests/dbx_test.script | 38 - ext/dbx/tests/skipif.inc | 6 - ext/dio/EXPERIMENTAL | 0 ext/dio/config.m4 | 10 - ext/dio/dio.c | 591 - ext/dio/php_dio.h | 62 - ext/dio/tests/001.phpt | 23 - ext/domxml/CREDITS | 2 - ext/domxml/EXPERIMENTAL | 5 - ext/domxml/TODO | 23 - ext/domxml/config.m4 | 127 - ext/domxml/domxml.dsp | 114 - ext/domxml/php_domxml.c | 5661 --------- ext/domxml/php_domxml.h | 253 - ext/domxml/tests/domxml001.phpt | 273 - ext/domxml/tests/domxml002.phpt | 31 - ext/domxml/tests/domxml_test.inc | 42 - ext/domxml/tests/skipif.inc | 3 - ext/domxml/tests/xmldoc.phpt | 35 - ext/ereg/ereg.c | 637 - ext/ereg/php_ereg.h | 50 - ext/ereg/php_regex.h | 65 - ext/ereg/regex/COPYRIGHT | 20 - ext/ereg/regex/README | 32 - ext/ereg/regex/WHATSNEW | 92 - ext/ereg/regex/cclass.h | 30 - ext/ereg/regex/cname.h | 102 - ext/ereg/regex/debug.c | 242 - ext/ereg/regex/debug.ih | 14 - ext/ereg/regex/engine.c | 1019 -- ext/ereg/regex/engine.ih | 35 - ext/ereg/regex/main.c | 510 - ext/ereg/regex/main.ih | 19 - ext/ereg/regex/mkh | 76 - ext/ereg/regex/regcomp.c | 1608 --- ext/ereg/regex/regcomp.ih | 53 - ext/ereg/regex/regerror.c | 126 - ext/ereg/regex/regerror.ih | 12 - ext/ereg/regex/regex.3 | 502 - ext/ereg/regex/regex.7 | 233 - ext/ereg/regex/regex.dsp | 106 - ext/ereg/regex/regex.dsw | 29 - ext/ereg/regex/regex.h | 83 - ext/ereg/regex/regex.mak | 304 - ext/ereg/regex/regex2.h | 140 - ext/ereg/regex/regex_extra.h | 23 - ext/ereg/regex/regexec.c | 138 - ext/ereg/regex/regfree.c | 37 - ext/ereg/regex/split.c | 316 - ext/ereg/regex/tests | 475 - ext/ereg/regex/utils.h | 25 - ext/ereg/tests/001.phpt | 9 - ext/ereg/tests/002.phpt | 9 - ext/ereg/tests/003.phpt | 10 - ext/ereg/tests/004.phpt | 16 - ext/ereg/tests/005.phpt | 20 - ext/ereg/tests/006.phpt | 10 - ext/ereg/tests/007.phpt | 12 - ext/ereg/tests/008.phpt | 10 - ext/ereg/tests/009.phpt | 19 - ext/ereg/tests/010.phpt | 9 - ext/ereg/tests/011.phpt | 9 - ext/ereg/tests/012.phpt | 9 - ext/ereg/tests/013.phpt | 9 - ext/ereg/tests/014.phpt | 9 - ext/ereg/tests/015.phpt | 8 - ext/ereg/tests/016.phpt | 8 - ext/exif/CREDITS | 2 - ext/exif/config.m4 | 11 - ext/exif/example.php | 23 - ext/exif/exif.c | 4021 ------ ext/exif/exif.dsp | 113 - ext/exif/php_exif.h | 30 - ext/exif/test.php | 3 - ext/exif/test.txt | 365 - ext/exif/tests/exif000.phpt | 57 - ext/exif/tests/exif001.phpt | 84 - ext/exif/tests/exif002.phpt | 24 - ext/exif/tests/exif003.phpt | 91 - ext/exif/tests/exif004.phpt | 38 - ext/exif/tests/exif005.phpt | 22 - ext/exif/tests/exif006.phpt | 89 - ext/exif/tests/test1.jpg | Bin 523 -> 0 bytes ext/exif/tests/test2.jpg | Bin 1240 -> 0 bytes ext/exif/tests/test3.jpg | Bin 1240 -> 0 bytes ext/exif/tests/test4.jpg | Bin 713 -> 0 bytes ext/exif/tests/test5.jpg | Bin 603 -> 0 bytes ext/exif/tests/test6.jpg | Bin 1240 -> 0 bytes ext/ext_skel | 284 - ext/ext_skel_win32.php | 52 - ext/fam/CREDITS | 2 - ext/fam/config.m4 | 56 - ext/fam/fam.c | 442 - ext/fam/php_fam.h | 89 - ext/fbsql/CREDITS | 2 - ext/fbsql/Readme_w32.txt | 22 - ext/fbsql/config.m4 | 43 - ext/fbsql/fbsql.dsp | 171 - ext/fbsql/php_fbsql.c | 3536 ------ ext/fbsql/php_fbsql.h | 145 - ext/fdf/CREDITS | 2 - ext/fdf/config.m4 | 73 - ext/fdf/fdf.c | 1594 --- ext/fdf/fdf.dsp | 114 - ext/fdf/php_fdf.h | 96 - ext/filepro/CREDITS | 2 - ext/filepro/config.m4 | 13 - ext/filepro/filepro.c | 570 - ext/filepro/filepro.dsp | 109 - ext/filepro/php_filepro.h | 48 - ext/fribidi/tests/001.phpt | 25 - ext/fribidi/tests/002.phpt | 121 - ext/ftp/CREDITS | 2 - ext/ftp/config.m4 | 11 - ext/ftp/ftp.c | 1914 --- ext/ftp/ftp.h | 206 - ext/ftp/php_ftp.c | 1214 -- ext/ftp/php_ftp.h | 78 - ext/gd/CREDITS | 2 - ext/gd/config.m4 | 414 - ext/gd/gd.c | 4229 ------- ext/gd/gd.dsp | 596 - ext/gd/gd_ctx.c | 114 - ext/gd/gdcache.c | 203 - ext/gd/gdcache.h | 87 - ext/gd/gdttf.c | 879 -- ext/gd/gdttf.h | 16 - ext/gd/libgd/README | 72 - ext/gd/libgd/gd.c | 3673 ------ ext/gd/libgd/gd.h | 644 - ext/gd/libgd/gd2copypal.c | 65 - ext/gd/libgd/gd2time.c | 60 - ext/gd/libgd/gd2topng.c | 49 - ext/gd/libgd/gd_arc_f_buggy.c | 741 -- ext/gd/libgd/gd_gd.c | 264 - ext/gd/libgd/gd_gd2.c | 790 -- ext/gd/libgd/gd_gif_in.c | 580 - ext/gd/libgd/gd_io.c | 146 - ext/gd/libgd/gd_io.h | 43 - ext/gd/libgd/gd_io_dp.c | 341 - ext/gd/libgd/gd_io_file.c | 130 - ext/gd/libgd/gd_io_ss.c | 138 - ext/gd/libgd/gd_jpeg.c | 690 -- ext/gd/libgd/gd_png.c | 687 -- ext/gd/libgd/gd_ss.c | 49 - ext/gd/libgd/gd_topal.c | 1919 --- ext/gd/libgd/gd_wbmp.c | 201 - ext/gd/libgd/gdcache.c | 214 - ext/gd/libgd/gdcache.h | 86 - ext/gd/libgd/gddemo.c | 118 - ext/gd/libgd/gdfontg.c | 4384 ------- ext/gd/libgd/gdfontg.h | 29 - ext/gd/libgd/gdfontl.c | 4641 ------- ext/gd/libgd/gdfontl.h | 30 - ext/gd/libgd/gdfontmb.c | 3871 ------ ext/gd/libgd/gdfontmb.h | 28 - ext/gd/libgd/gdfonts.c | 3871 ------ ext/gd/libgd/gdfonts.h | 28 - ext/gd/libgd/gdfontt.c | 2592 ---- ext/gd/libgd/gdfontt.h | 29 - ext/gd/libgd/gdft.c | 1093 -- ext/gd/libgd/gdhelpers.c | 76 - ext/gd/libgd/gdhelpers.h | 25 - ext/gd/libgd/gdkanji.c | 627 - ext/gd/libgd/gdparttopng.c | 59 - ext/gd/libgd/gdtables.c | 728 -- ext/gd/libgd/gdtest.c | 409 - ext/gd/libgd/gdtestft.c | 108 - ext/gd/libgd/gdtopng.c | 44 - ext/gd/libgd/gdxpm.c | 139 - ext/gd/libgd/jisx0208.h | 1205 -- ext/gd/libgd/mathmake.c | 52 - ext/gd/libgd/pngtogd.c | 45 - ext/gd/libgd/pngtogd2.c | 52 - ext/gd/libgd/testac.c | 129 - ext/gd/libgd/wbmp.c | 369 - ext/gd/libgd/wbmp.h | 47 - ext/gd/libgd/webpng.c | 289 - ext/gd/libgd/xbm.c | 153 - ext/gd/php_gd.h | 188 - ext/gd/tests/bug19366.phpt | 50 - ext/gd/tests/bug22544.phpt | 26 - ext/gd/tests/conv_test.gif | Bin 4998 -> 0 bytes ext/gd/tests/conv_test.jpeg | Bin 2317 -> 0 bytes ext/gd/tests/conv_test.png | Bin 4053 -> 0 bytes ext/gd/tests/conv_test.xbm | 4 - ext/gd/tests/conv_test.xpm | 1588 --- ext/gd/tests/gif2gd.phpt | 32 - ext/gd/tests/gif2jpg.phpt | 29 - ext/gd/tests/gif2png.phpt | 29 - ext/gd/tests/imagefilter.phpt | 89 - ext/gd/tests/imagefttext.phpt | 52 - ext/gd/tests/jpeg2png.phpt | 47 - ext/gd/tests/jpg2gd.phpt | 44 - ext/gd/tests/png2gd.phpt | 44 - ext/gd/tests/test.png | Bin 2711 -> 0 bytes ext/gd/tests/test8859.ttf | Bin 10576 -> 0 bytes ext/gd/tests/xbm2png.phpt | 26 - ext/gd/tests/xpm2gd.phpt | 32 - ext/gd/tests/xpm2jpg.phpt | 29 - ext/gd/tests/xpm2png.phpt | 29 - ext/gettext/CREDITS | 2 - ext/gettext/config.m4 | 52 - ext/gettext/gettext.c | 319 - ext/gettext/gettext.dsp | 113 - ext/gettext/php_gettext.h | 58 - ext/gmp/CREDITS | 2 - ext/gmp/README | 5 - ext/gmp/TODO | 22 - ext/gmp/config.m4 | 25 - ext/gmp/gmp.c | 1253 -- ext/gmp/php_gmp.h | 115 - ext/gmp/tests/001.phpt | 23 - ext/gmp/tests/002.phpt | 19 - ext/gmp/tests/003.phpt | 49 - ext/hwapi/CREDITS | 2 - ext/hwapi/config.m4 | 35 - ext/hwapi/hwapi.cpp | 5031 -------- ext/hwapi/php_hwapi.h | 159 - ext/hyperwave/CREDITS | 2 - ext/hyperwave/config.m4 | 20 - ext/hyperwave/debug.h | 206 - ext/hyperwave/hg_comm.c | 5841 --------- ext/hyperwave/hg_comm.h | 238 - ext/hyperwave/hw.c | 4081 ------- ext/hyperwave/hw_error.h | 111 - ext/hyperwave/hyperwave.dsp | 120 - ext/hyperwave/php_hyperwave.h | 147 - ext/iconv/CREDITS | 2 - ext/iconv/config.m4 | 118 - ext/iconv/iconv.c | 1841 --- ext/iconv/iconv.dsp | 107 - ext/iconv/php_iconv.h | 86 - ext/iconv/tests/Quotes.UTF-8 | 4 - ext/iconv/tests/bug16069.phpt | 22 - ext/iconv/tests/eucjp2iso2022jp.phpt | 27 - ext/iconv/tests/eucjp2sjis.phpt | 58 - ext/iconv/tests/eucjp2utf8.phpt | 58 - ext/iconv/tests/iconv001.phpt | 18 - ext/iconv/tests/iconv002.phpt | 30 - ext/iconv/tests/iconv003.phpt | 13 - ext/iconv/tests/iconv_mime_decode.phpt | 17 - ext/iconv/tests/iconv_mime_encode.phpt | 393 - ext/iconv/tests/iconv_strlen.phpt | 19 - ext/iconv/tests/iconv_strpos.phpt | 52 - ext/iconv/tests/iconv_strrpos.phpt | 56 - ext/iconv/tests/iconv_substr.phpt | 59 - ext/iconv/tests/ob_iconv_handler.phpt | 17 - ext/iconv/tests/skipif.inc | 12 - ext/iconv/tests/test.inc | 7 - ext/iconv/tests/translit-failure.phpt | 33 - ext/iconv/tests/translit-utf8.phpt | 28 - ext/imap/CREDITS | 2 - ext/imap/IMAP_Win32_HOWTO.txt | 32 - ext/imap/config.m4 | 208 - ext/imap/imap.dsp | 176 - ext/imap/imap.h | 103 - ext/imap/php_imap.c | 4196 ------- ext/imap/php_imap.h | 221 - ext/informix/CREDITS | 2 - ext/informix/Makefile.frag | 10 - ext/informix/config.m4 | 96 - ext/informix/ifx.dsp | 134 - ext/informix/ifx.ec | 4597 ------- ext/informix/php_informix.h | 125 - ext/informix/php_informix_includes.h | 90 - ext/ingres_ii/CREDITS | 2 - ext/ingres_ii/EXPERIMENTAL | 5 - ext/ingres_ii/README | 13 - ext/ingres_ii/config.m4 | 35 - ext/ingres_ii/ii.c | 1544 --- ext/ingres_ii/ii.h | 65 - ext/ingres_ii/ingres.dsp | 111 - ext/ingres_ii/php_ii.h | 100 - ext/interbase/CREDITS | 2 - ext/interbase/config.m4 | 39 - ext/interbase/interbase.c | 3130 ----- ext/interbase/interbase.dsp | 113 - ext/interbase/php_interbase.h | 193 - ext/interbase/tests/002.phpt | 34 - ext/interbase/tests/003.phpt | 87 - ext/interbase/tests/004.phpt | 177 - ext/interbase/tests/005.phpt | 271 - ext/interbase/tests/006.phpt | 224 - ext/interbase/tests/interbase.inc | 105 - ext/interbase/tests/skipif.inc | 9 - ext/ldap/CREDITS | 2 - ext/ldap/LDAP_Win32_HOWTO.txt | 33 - ext/ldap/config.m4 | 125 - ext/ldap/ldap.c | 2133 ---- ext/ldap/ldap.dsp | 288 - ext/ldap/ldap.mak | 173 - ext/ldap/php_ldap.h | 119 - ext/mbstring/CREDITS | 2 - ext/mbstring/README | 17 - ext/mbstring/README_PHP3-i18n-ja | 774 -- ext/mbstring/config.m4 | 42 - ext/mbstring/cp932_table.h | 66 - ext/mbstring/html_entities.c | 291 - ext/mbstring/mb_gpc.c | 400 - ext/mbstring/mb_gpc.h | 47 - ext/mbstring/mbfilter.c | 9677 --------------- ext/mbstring/mbfilter.h | 597 - ext/mbstring/mbfilter_cn.c | 417 - ext/mbstring/mbfilter_cn.h | 33 - ext/mbstring/mbfilter_ja.c | 1291 -- ext/mbstring/mbfilter_ja.h | 98 - ext/mbstring/mbfilter_kr.c | 516 - ext/mbstring/mbfilter_kr.h | 33 - ext/mbstring/mbfilter_ru.c | 240 - ext/mbstring/mbfilter_ru.h | 38 - ext/mbstring/mbfilter_tw.c | 337 - ext/mbstring/mbfilter_tw.h | 30 - ext/mbstring/mbregex.c | 4708 -------- ext/mbstring/mbregex.h | 213 - ext/mbstring/mbstring.c | 3396 ------ ext/mbstring/mbstring.dsp | 211 - ext/mbstring/mbstring.h | 216 - ext/mbstring/php_mbregex.c | 1176 -- ext/mbstring/php_mbregex.h | 119 - ext/mbstring/php_unicode.c | 313 - ext/mbstring/php_unicode.h | 201 - ext/mbstring/tests/bug20087.phpt | 20 - ext/mbstring/tests/casefold.phpt | 24 - ext/mbstring/tests/common.inc | 53 - ext/mbstring/tests/htmlent.phpt | 35 - ext/mbstring/tests/ini_language.phpt | 15 - ext/mbstring/tests/mb_convert_encoding.phpt | 137 - ext/mbstring/tests/mb_convert_variables.phpt | 163 - ext/mbstring/tests/mb_detect_encoding.phpt | 119 - ext/mbstring/tests/mb_detect_order.phpt | 59 - ext/mbstring/tests/mb_ereg-compat-01.phpt | 21 - ext/mbstring/tests/mb_ereg-compat-02.phpt | 25 - ext/mbstring/tests/mb_ereg.phpt | 47 - ext/mbstring/tests/mb_ereg_replace-compat-01.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-02.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-03.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-04.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-05.phpt | 16 - ext/mbstring/tests/mb_ereg_replace-compat-06.phpt | 14 - ext/mbstring/tests/mb_ereg_replace-compat-07.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-08.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-09.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-10.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-11.phpt | 15 - ext/mbstring/tests/mb_ereg_replace-compat-12.phpt | 14 - ext/mbstring/tests/mb_ereg_replace-compat-13.phpt | 14 - ext/mbstring/tests/mb_ereg_replace.phpt | 18 - ext/mbstring/tests/mb_ereg_search_xxx.phpt | 82 - ext/mbstring/tests/mb_http_input.phpt | 50 - ext/mbstring/tests/mb_http_output.phpt | 84 - ext/mbstring/tests/mb_internal_encoding.phpt | 68 - ext/mbstring/tests/mb_output_handler_euc_jp.phpt | 21 - .../tests/mb_output_handler_shift_jis.phpt | 16 - ext/mbstring/tests/mb_parse_str.phpt | 80 - ext/mbstring/tests/mb_parse_str02.phpt | 105 - ext/mbstring/tests/mb_preferred_mime_name.phpt | 61 - ext/mbstring/tests/mb_regex_set_options.phpt | 18 - ext/mbstring/tests/mb_send_mail01.phpt | 38 - ext/mbstring/tests/mb_send_mail02.phpt | 38 - ext/mbstring/tests/mb_send_mail03.phpt | 38 - ext/mbstring/tests/mb_send_mail04.phpt | 38 - ext/mbstring/tests/mb_send_mail05.phpt | 42 - ext/mbstring/tests/mb_send_mail06.phpt | 41 - ext/mbstring/tests/mb_send_mail07.phpt | 41 - ext/mbstring/tests/mb_split-compat-01.phpt | 23 - ext/mbstring/tests/mb_split.phpt | 48 - ext/mbstring/tests/mb_strcut.phpt | 34 - ext/mbstring/tests/mb_strimwidth.phpt | 43 - ext/mbstring/tests/mb_strlen.phpt | 104 - ext/mbstring/tests/mb_strpos.phpt | 175 - ext/mbstring/tests/mb_strwidth.phpt | 32 - ext/mbstring/tests/mb_substitute_character.phpt | 49 - ext/mbstring/tests/mb_substr.phpt | 34 - ext/mbstring/tests/mb_substr_count.phpt | 44 - ext/mbstring/tests/overload01.phpt | 25 - ext/mbstring/tests/overload02.phpt | 36 - ext/mbstring/tests/php_gr_jp_10830.phpt | 18 - ext/mbstring/tests/simpletest.phpt | 34 - ext/mbstring/tests/skipif.inc | 14 - ext/mbstring/tests/zend-multibyte.phpt | 23 - ext/mbstring/unicode_data.h | 2738 ----- ext/mbstring/unicode_table.h | 347 - ext/mbstring/unicode_table_cn.h | 6463 ---------- ext/mbstring/unicode_table_ja.h | 5961 --------- ext/mbstring/unicode_table_kr.h | 7157 ----------- ext/mbstring/unicode_table_ru.h | 69 - ext/mbstring/unicode_table_tw.h | 11215 ----------------- ext/mcal/CREDITS | 2 - ext/mcal/config.m4 | 45 - ext/mcal/php_mcal.c | 1625 --- ext/mcal/php_mcal.h | 64 - ext/mcrypt/CREDITS | 2 - ext/mcrypt/TODO | 6 - ext/mcrypt/config.m4 | 63 - ext/mcrypt/mcrypt.c | 1273 -- ext/mcrypt/mcrypt.dsp | 117 - ext/mcrypt/php_mcrypt.h | 95 - ext/mcrypt/tests/blowfish.phpt | 77 - ext/mcrypt/tests/bug8040.phpt | 26 - ext/mcrypt/tests/vectors.txt | 33 - ext/mcve/CREDITS | 2 - ext/mcve/config.m4 | 25 - ext/mcve/mcve.c | 2103 ---- ext/mcve/mcve.php | 12 - ext/mcve/mcve_simple_test.php | 19 - ext/mcve/mcve_test1.php | 83 - ext/mcve/mcve_test2.php | 68 - ext/mcve/php_mcve.h | 119 - ext/mcve/tests/001.phpt | 23 - ext/mhash/CREDITS | 2 - ext/mhash/config.m4 | 25 - ext/mhash/mhash.c | 253 - ext/mhash/mhash.dsp | 115 - ext/mhash/php_mhash.h | 29 - ext/mhash/tests/001.phpt | 74 - ext/mhash/tests/002.phpt | 64 - ext/mhash/tests/003.phpt | 73 - ext/mhash/tests/skip.inc | 5 - ext/mime_magic/CREDITS | 2 - ext/mime_magic/EXPERIMENTAL | 0 ext/mime_magic/TODO | 3 - ext/mime_magic/config.m4 | 37 - ext/mime_magic/mime_magic.c | 1909 --- ext/mime_magic/mime_magic.dsp | 108 - ext/mime_magic/php_mime_magic.h | 428 - ext/ming/CREDITS | 2 - ext/ming/EXPERIMENTAL | 5 - ext/ming/config.m4 | 62 - ext/ming/ming.c | 2853 ----- ext/ming/ming.dsp | 107 - ext/ming/php_ming.h | 160 - ext/mnogosearch/CREDITS | 2 - ext/mnogosearch/README | 11 - ext/mnogosearch/config.m4 | 54 - ext/mnogosearch/index.php | 1055 -- ext/mnogosearch/php_mnogo.c | 2521 ---- ext/mnogosearch/php_mnogo.h | 114 - ext/msession/CREDITS | 3 - ext/msession/README | 33 - ext/msession/config.m4 | 36 - ext/msession/msession-test.php | 125 - ext/msession/msession.c | 1384 --- ext/msession/msession.php | 10 - ext/msession/php_msession.h | 109 - ext/msession/reqclient.h | 171 - ext/msql/CREDITS | 2 - ext/msql/config.m4 | 42 - ext/msql/msql.dsp | 107 - ext/msql/php_msql.c | 1317 -- ext/msql/php_msql.h | 82 - ext/mssql/CREDITS | 2 - ext/mssql/config.m4 | 52 - ext/mssql/mssql.dsp | 117 - ext/mssql/mssql_win32_howto.txt | 35 - ext/mssql/php_mssql.c | 2210 ---- ext/mssql/php_mssql.h | 205 - ext/mysql/CREDITS | 2 - ext/mysql/config.m4 | 160 - ext/mysql/libmysql/acinclude.m4 | 382 - ext/mysql/libmysql/array.c | 163 - ext/mysql/libmysql/bchange.c | 25 - ext/mysql/libmysql/bmove.c | 63 - ext/mysql/libmysql/bmove_upp.c | 37 - ext/mysql/libmysql/charset.c | 550 - ext/mysql/libmysql/config-win.h | 293 - ext/mysql/libmysql/ctype.c | 54 - ext/mysql/libmysql/ctype_autoconf.c | 44 - ext/mysql/libmysql/ctype_extra_sources.c | 82 - ext/mysql/libmysql/dbug.c | 2069 ---- ext/mysql/libmysql/dbug.h | 80 - ext/mysql/libmysql/default.c | 384 - ext/mysql/libmysql/dll.c | 0 ext/mysql/libmysql/errmsg.c | 96 - ext/mysql/libmysql/errmsg.h | 45 - ext/mysql/libmysql/errors.c | 78 - ext/mysql/libmysql/fix_copyright | 35 - ext/mysql/libmysql/get_password.c | 197 - ext/mysql/libmysql/global.h | 952 -- ext/mysql/libmysql/int2str.c | 141 - ext/mysql/libmysql/is_prefix.c | 20 - ext/mysql/libmysql/libmysql.c | 2604 ---- ext/mysql/libmysql/libmysql.dsp | 585 - ext/mysql/libmysql/list.c | 102 - ext/mysql/libmysql/longlong2str.c | 129 - ext/mysql/libmysql/m_ctype.h | 144 - ext/mysql/libmysql/m_string.h | 230 - ext/mysql/libmysql/mf_casecnv.c | 247 - ext/mysql/libmysql/mf_dirname.c | 92 - ext/mysql/libmysql/mf_fn_ext.c | 32 - ext/mysql/libmysql/mf_format.c | 142 - ext/mysql/libmysql/mf_loadpath.c | 40 - ext/mysql/libmysql/mf_pack.c | 518 - ext/mysql/libmysql/mf_path.c | 106 - ext/mysql/libmysql/mf_unixpath.c | 19 - ext/mysql/libmysql/mf_wcomp.c | 54 - ext/mysql/libmysql/mulalloc.c | 39 - ext/mysql/libmysql/my_alarm.h | 46 - ext/mysql/libmysql/my_alloc.c | 140 - ext/mysql/libmysql/my_compress.c | 74 - ext/mysql/libmysql/my_config.h | 15 - ext/mysql/libmysql/my_create.c | 50 - ext/mysql/libmysql/my_delete.c | 22 - ext/mysql/libmysql/my_dir.h | 86 - ext/mysql/libmysql/my_div.c | 17 - ext/mysql/libmysql/my_error.c | 110 - ext/mysql/libmysql/my_fopen.c | 160 - ext/mysql/libmysql/my_getwd.c | 180 - ext/mysql/libmysql/my_init.c | 312 - ext/mysql/libmysql/my_lib.c | 600 - ext/mysql/libmysql/my_list.h | 33 - ext/mysql/libmysql/my_malloc.c | 70 - ext/mysql/libmysql/my_messnc.c | 22 - ext/mysql/libmysql/my_net.c | 35 - ext/mysql/libmysql/my_net.h | 27 - ext/mysql/libmysql/my_once.c | 74 - ext/mysql/libmysql/my_open.c | 112 - ext/mysql/libmysql/my_pthread.c | 462 - ext/mysql/libmysql/my_pthread.h | 613 - ext/mysql/libmysql/my_read.c | 52 - ext/mysql/libmysql/my_realloc.c | 51 - ext/mysql/libmysql/my_static.c | 87 - ext/mysql/libmysql/my_static.h | 56 - ext/mysql/libmysql/my_sys.h | 592 - ext/mysql/libmysql/my_tempnam.c | 159 - ext/mysql/libmysql/my_thr_init.c | 212 - ext/mysql/libmysql/my_wincond.c | 128 - ext/mysql/libmysql/my_winthread.c | 105 - ext/mysql/libmysql/my_write.c | 76 - ext/mysql/libmysql/mysql.h | 298 - ext/mysql/libmysql/mysql.m4 | 16 - ext/mysql/libmysql/mysql_com.h | 222 - ext/mysql/libmysql/mysql_version.h | 24 - ext/mysql/libmysql/mysqld_error.h | 221 - ext/mysql/libmysql/mysys_err.h | 50 - ext/mysql/libmysql/mysys_priv.h | 18 - ext/mysql/libmysql/net.c | 671 -- ext/mysql/libmysql/password.c | 178 - ext/mysql/libmysql/raid.h | 147 - ext/mysql/libmysql/safemalloc.c | 510 - ext/mysql/libmysql/stamp-h.in | 1 - ext/mysql/libmysql/str2int.c | 188 - ext/mysql/libmysql/strcend.c | 42 - ext/mysql/libmysql/strcont.c | 32 - ext/mysql/libmysql/strend.c | 33 - ext/mysql/libmysql/strfill.c | 22 - ext/mysql/libmysql/string.c | 113 - ext/mysql/libmysql/strinstr.c | 36 - ext/mysql/libmysql/strmake.c | 40 - ext/mysql/libmysql/strmov.c | 45 - ext/mysql/libmysql/strnmov.c | 22 - ext/mysql/libmysql/strto.c | 194 - ext/mysql/libmysql/strtoll.c | 11 - ext/mysql/libmysql/strtoull.c | 12 - ext/mysql/libmysql/strxmov.c | 33 - ext/mysql/libmysql/thr_alarm.h | 98 - ext/mysql/libmysql/thr_mutex.c | 217 - ext/mysql/libmysql/typelib.c | 92 - ext/mysql/libmysql/update_sources | 103 - ext/mysql/libmysql/violite.c | 429 - ext/mysql/libmysql/violite.h | 103 - ext/mysql/mysql.dsp | 171 - ext/mysql/mysql.mak | 169 - ext/mysql/php_mysql.c | 2382 ---- ext/mysql/php_mysql.h | 125 - ext/mysqli/CREDITS | 2 - ext/mysqli/EXPERIMENTAL | 0 ext/mysqli/TODO | 13 - ext/mysqli/config.m4 | 45 - ext/mysqli/mysqli.c | 451 - ext/mysqli/mysqli.dsp | 120 - ext/mysqli/mysqli_api.c | 1913 --- ext/mysqli/mysqli_fe.c | 235 - ext/mysqli/mysqli_nonapi.c | 207 - ext/mysqli/mysqli_profiler.c | 494 - ext/mysqli/mysqli_profiler.h | 226 - ext/mysqli/mysqli_profiler_com.c | 98 - ext/mysqli/mysqli_profiler_com.h | 53 - ext/mysqli/php_mysqli.h | 304 - ext/mysqli/tests/001.phpt | 54 - ext/mysqli/tests/002.phpt | 60 - ext/mysqli/tests/003.phpt | 56 - ext/mysqli/tests/004.phpt | 35 - ext/mysqli/tests/005.phpt | 38 - ext/mysqli/tests/006.phpt | 51 - ext/mysqli/tests/007.phpt | 51 - ext/mysqli/tests/008.phpt | 53 - ext/mysqli/tests/009.phpt | 51 - ext/mysqli/tests/010.phpt | 54 - ext/mysqli/tests/011.phpt | 53 - ext/mysqli/tests/012.phpt | 54 - ext/mysqli/tests/013.phpt | 45 - ext/mysqli/tests/014.phpt | 66 - ext/mysqli/tests/015.phpt | 68 - ext/mysqli/tests/016.phpt | 25 - ext/mysqli/tests/017.phpt | 30 - ext/mysqli/tests/018.phpt | 25 - ext/mysqli/tests/019.phpt | 68 - ext/mysqli/tests/020.phpt | 70 - ext/mysqli/tests/021.phpt | 40 - ext/mysqli/tests/022.phpt | 44 - ext/mysqli/tests/023.phpt | 64 - ext/mysqli/tests/024.phpt | 65 - ext/mysqli/tests/025.phpt | 68 - ext/mysqli/tests/026.phpt | 48 - ext/mysqli/tests/027.phpt | 21 - ext/mysqli/tests/028.phpt | 19 - ext/mysqli/tests/029.phpt | 25 - ext/mysqli/tests/030.phpt | 24 - ext/mysqli/tests/031.phpt | 24 - ext/mysqli/tests/032.phpt | 25 - ext/mysqli/tests/033.phpt | 19 - ext/mysqli/tests/034.phpt | 19 - ext/mysqli/tests/035.phpt | 19 - ext/mysqli/tests/036.phpt | 43 - ext/mysqli/tests/037.phpt | 34 - ext/mysqli/tests/038.phpt | 31 - ext/mysqli/tests/039.phpt | 24 - ext/mysqli/tests/040.phpt | 31 - ext/mysqli/tests/041.phpt | 24 - ext/mysqli/tests/042.phpt | 61 - ext/mysqli/tests/043.phpt | 40 - ext/mysqli/tests/044.phpt | 19 - ext/mysqli/tests/045.phpt | 28 - ext/mysqli/tests/046.phpt | 31 - ext/mysqli/tests/047.phpt | 73 - ext/mysqli/tests/048.phpt | 60 - ext/mysqli/tests/049.phpt | 23 - ext/mysqli/tests/050.phpt | 19 - ext/mysqli/tests/051.phpt | 20 - ext/mysqli/tests/052.phpt | 20 - ext/mysqli/tests/053.phpt | 18 - ext/mysqli/tests/054.phpt | 18 - ext/mysqli/tests/055.phpt | 17 - ext/mysqli/tests/056.phpt | 19 - ext/mysqli/tests/057.phpt | 52 - ext/mysqli/tests/connect.inc | 10 - ext/ncurses/CREDITS | 2 - ext/ncurses/EXPERIMENTAL | 0 ext/ncurses/c-prototypes | 263 - ext/ncurses/config.m4 | 65 - ext/ncurses/example1.php | 28 - ext/ncurses/ncurses.c | 324 - ext/ncurses/ncurses.php | 10 - ext/ncurses/ncurses_fe.c | 223 - ext/ncurses/ncurses_functions.c | 2460 ---- ext/ncurses/php_ncurses.h | 80 - ext/ncurses/php_ncurses_fe.h | 197 - ext/ncurses/tests/001.phpt | 23 - ext/notes/notes.dsp | 202 - ext/notes/notes.dsw | 29 - ext/notes/php_notes.c | 2722 ----- ext/notes/php_notes.h | 47 - ext/oci8/CREDITS | 2 - ext/oci8/config.m4 | 149 - ext/oci8/oci8.c | 5521 --------- ext/oci8/oci8.dsp | 113 - ext/oci8/oci8.dsw | 29 - ext/oci8/php_oci8.h | 217 - ext/odbc/CREDITS | 2 - ext/odbc/birdstep.c | 652 - ext/odbc/config.m4 | 555 - ext/odbc/php_birdstep.h | 92 - ext/odbc/php_odbc.c | 3630 ------ ext/odbc/php_odbc.h | 117 - ext/odbc/php_odbc_includes.h | 287 - ext/openssl/CREDITS | 2 - ext/openssl/README | 321 - ext/openssl/config.m4 | 10 - ext/openssl/openssl.c | 3056 ----- ext/openssl/openssl.dsp | 107 - ext/openssl/php_openssl.h | 83 - ext/openssl/tests/001.phpt | 74 - ext/openssl/tests/skipif.inc | 11 - ext/openssl/xp_ssl.c | 557 - ext/oracle/CREDITS | 2 - ext/oracle/config.m4 | 160 - ext/oracle/oracle.c | 1769 --- ext/oracle/oracle.dsp | 113 - ext/oracle/php_oracle.h | 137 - ext/ovrimos/CREDITS | 2 - ext/ovrimos/config.m4 | 28 - ext/ovrimos/ovrimos.c | 1291 -- ext/ovrimos/php_ovrimos.h | 44 - ext/pcntl/CREDITS | 2 - ext/pcntl/EXPERIMENTAL | 5 - ext/pcntl/README | 16 - ext/pcntl/config.m4 | 19 - ext/pcntl/pcntl.c | 656 - ext/pcntl/php_pcntl.h | 81 - ext/pcntl/php_signal.c | 46 - ext/pcntl/php_signal.h | 28 - ext/pcntl/test-pcntl.php | 39 - ext/pcntl/tests/001.phpt | 84 - ext/pcre/CREDITS | 2 - ext/pcre/config.m4 | 56 - ext/pcre/config0.m4 | 56 - ext/pcre/pcrelib/AUTHORS | 6 - ext/pcre/pcrelib/COPYING | 50 - ext/pcre/pcrelib/ChangeLog | 958 -- ext/pcre/pcrelib/INSTALL | 185 - ext/pcre/pcrelib/LICENCE | 50 - ext/pcre/pcrelib/NEWS | 85 - ext/pcre/pcrelib/NON-UNIX-USE | 89 - ext/pcre/pcrelib/README | 312 - ext/pcre/pcrelib/chartables.c | 183 - ext/pcre/pcrelib/dftables.c | 148 - ext/pcre/pcrelib/dll.mk | 60 - ext/pcre/pcrelib/doc/Tech.Notes | 253 - ext/pcre/pcrelib/doc/pcre.3 | 1993 --- ext/pcre/pcrelib/doc/pcre.html | 2672 ---- ext/pcre/pcrelib/doc/pcre.txt | 2307 ---- ext/pcre/pcrelib/doc/pcregrep.1 | 92 - ext/pcre/pcrelib/doc/pcregrep.html | 125 - ext/pcre/pcrelib/doc/pcregrep.txt | 109 - ext/pcre/pcrelib/doc/pcreposix.3 | 149 - ext/pcre/pcrelib/doc/pcreposix.html | 191 - ext/pcre/pcrelib/doc/pcreposix.txt | 159 - ext/pcre/pcrelib/doc/pcretest.1 | 288 - ext/pcre/pcrelib/doc/pcretest.html | 377 - ext/pcre/pcrelib/doc/pcretest.txt | 329 - ext/pcre/pcrelib/doc/perltest.txt | 34 - ext/pcre/pcrelib/get.c | 227 - ext/pcre/pcrelib/internal.h | 632 - ext/pcre/pcrelib/maketables.c | 136 - ext/pcre/pcrelib/pcre.c | 5992 --------- ext/pcre/pcrelib/pcre.def | 22 - ext/pcre/pcrelib/pcre.h | 150 - ext/pcre/pcrelib/pcregrep.c | 640 - ext/pcre/pcrelib/pcreposix.c | 301 - ext/pcre/pcrelib/pcreposix.h | 88 - ext/pcre/pcrelib/pcretest.c | 1274 -- ext/pcre/pcrelib/study.c | 409 - ext/pcre/pcrelib/testdata/testinput1 | 3808 ------ ext/pcre/pcrelib/testdata/testinput2 | 1162 -- ext/pcre/pcrelib/testdata/testinput3 | 65 - ext/pcre/pcrelib/testdata/testinput4 | 155 - ext/pcre/pcrelib/testdata/testinput5 | 91 - ext/pcre/pcrelib/testdata/testinput6 | 78 - ext/pcre/pcrelib/testdata/testoutput1 | 6222 ---------- ext/pcre/pcrelib/testdata/testoutput2 | 4088 ------- ext/pcre/pcrelib/testdata/testoutput3 | 116 - ext/pcre/pcrelib/testdata/testoutput4 | 304 - ext/pcre/pcrelib/testdata/testoutput5 | 339 - ext/pcre/pcrelib/testdata/testoutput6 | 319 - ext/pcre/php_pcre.c | 1506 --- ext/pcre/php_pcre.h | 78 - ext/pcre/tests/bug20528.phpt | 24 - ext/pcre/tests/bug21732.phpt | 29 - ext/pdf/CREDITS | 2 - ext/pdf/config.m4 | 129 - ext/pdf/pdf.c | 3231 ----- ext/pdf/pdf.dsp | 114 - ext/pdf/php_pdf.h | 179 - ext/pfpro/CREDITS | 2 - ext/pfpro/TODO | 12 - ext/pfpro/config.m4 | 68 - ext/pfpro/pfpro.c | 549 - ext/pfpro/php_pfpro.h | 85 - ext/pgsql/CREDITS | 2 - ext/pgsql/README | 235 - ext/pgsql/config.m4 | 72 - ext/pgsql/mysql_users.php | 82 - ext/pgsql/pgsql.c | 4507 ------- ext/pgsql/pgsql.dsp | 167 - ext/pgsql/pgsql.mak | 170 - ext/pgsql/php_pgsql.h | 269 - ext/pgsql/tests/01createdb.phpt | 10 - ext/pgsql/tests/02connection.phpt | 10 - ext/pgsql/tests/03sync_query.phpt | 10 - ext/pgsql/tests/04async_query.phpt | 10 - ext/pgsql/tests/05large_object.phpt | 11 - ext/pgsql/tests/06copy.phpt | 10 - ext/pgsql/tests/07optional.phpt | 10 - ext/pgsql/tests/08escape.phpt | 14 - ext/pgsql/tests/09notice.phpt | 13 - ext/pgsql/tests/10pg_convert.phpt | 17 - ext/pgsql/tests/11pg_meta_data.phpt | 50 - ext/pgsql/tests/12pg_insert.phpt | 11 - ext/pgsql/tests/13pg_select.phpt | 22 - ext/pgsql/tests/14pg_update.phpt | 11 - ext/pgsql/tests/15pg_delete.phpt | 10 - ext/pgsql/tests/16pg_result_status.phpt | 11 - ext/pgsql/tests/17result.phpt | 49 - ext/pgsql/tests/18pg_escape_bytea.phpt | 10 - ext/pgsql/tests/19pg_ping.phpt | 10 - ext/pgsql/tests/20pg_get_pid.phpt | 10 - ext/pgsql/tests/21pg_get_notify.phpt | 10 - ext/pgsql/tests/80_bug14383.phpt | 37 - ext/pgsql/tests/98old_api.phpt | 10 - ext/pgsql/tests/9999dropdb.phpt | 10 - ext/pgsql/tests/README | 14 - ext/pgsql/tests/async_query.inc | 59 - ext/pgsql/tests/config.inc | 12 - ext/pgsql/tests/connection.inc | 44 - ext/pgsql/tests/copy.inc | 8 - ext/pgsql/tests/createdb.inc | 22 - ext/pgsql/tests/dropdb.inc | 11 - ext/pgsql/tests/escape.inc | 59 - ext/pgsql/tests/informational.inc | 47 - ext/pgsql/tests/large_object.inc | 67 - ext/pgsql/tests/notice.inc | 18 - ext/pgsql/tests/old_api.inc | 26 - ext/pgsql/tests/optional.inc | 13 - ext/pgsql/tests/pg_convert.inc | 14 - ext/pgsql/tests/pg_delete.inc | 17 - ext/pgsql/tests/pg_escape_bytea.inc | 25 - ext/pgsql/tests/pg_get_notify.inc | 16 - ext/pgsql/tests/pg_get_pid.inc | 13 - ext/pgsql/tests/pg_insert.inc | 13 - ext/pgsql/tests/pg_meta_data.inc | 13 - ext/pgsql/tests/pg_ping.inc | 10 - ext/pgsql/tests/pg_result_status.inc | 13 - ext/pgsql/tests/pg_select.inc | 15 - ext/pgsql/tests/pg_update.inc | 15 - ext/pgsql/tests/php.gif | Bin 3872 -> 0 bytes ext/pgsql/tests/result.inc | 24 - ext/pgsql/tests/skipif.inc | 22 - ext/pgsql/tests/sync_query.inc | 47 - ext/posix/CREDITS | 2 - ext/posix/config.m4 | 13 - ext/posix/php_posix.h | 124 - ext/posix/posix.c | 1016 -- ext/pspell/CREDITS | 2 - ext/pspell/README | 51 - ext/pspell/config.m4 | 36 - ext/pspell/php_pspell.h | 52 - ext/pspell/pspell.c | 819 -- ext/pspell/tests/01pspell_basic.phpt | 143 - ext/qtdom/CREDITS | 2 - ext/qtdom/EXPERIMENTAL | 5 - ext/qtdom/config.m4 | 37 - ext/qtdom/qtdom.c | 269 - ext/qtdom/qtdom.h | 74 - ext/qtdom/qtdom.php | 10 - ext/qtdom/qtdom_qt.cpp | 371 - ext/qtdom/qtdom_qt.h | 67 - ext/readline/CREDITS | 2 - ext/readline/README.libedit | 4 - ext/readline/config.m4 | 94 - ext/readline/php_readline.h | 39 - ext/readline/readline.c | 439 - ext/recode/CREDITS | 2 - ext/recode/config.m4 | 63 - ext/recode/php_recode.h | 39 - ext/recode/recode.c | 242 - ext/rpc/CREDITS | 2 - ext/rpc/EXPERIMENTAL | 5 - ext/rpc/RPC_HOWTO | 97 - ext/rpc/com/CREDITS | 2 - ext/rpc/com/TODO | 28 - ext/rpc/com/com.c | 1362 --- ext/rpc/com/com.dsp | 167 - ext/rpc/com/com.h | 45 - ext/rpc/com/com_wrapper.c | 930 -- ext/rpc/com/com_wrapper.h | 107 - ext/rpc/com/conversion.c | 855 -- ext/rpc/com/conversion.h | 42 - ext/rpc/com/dispatch.c | 641 - ext/rpc/com/php_com.h | 25 - ext/rpc/com/variant.c | 324 - ext/rpc/com/variant.h | 64 - ext/rpc/dotnet/CREDITS | 2 - ext/rpc/dotnet/EXPERIMENTAL | 5 - ext/rpc/dotnet/README | 32 - ext/rpc/dotnet/dotnet.cpp | 237 - ext/rpc/dotnet/dotnet.dsp | 167 - ext/rpc/dotnet/dotnet.php | 8 - ext/rpc/dotnet/php_dotnet.h | 21 - ext/rpc/handler.h | 144 - ext/rpc/hash.h | 74 - ext/rpc/java/CREDITS | 2 - ext/rpc/java/EXPERIMENTAL | 5 - ext/rpc/java/Makefile.frag | 13 - ext/rpc/java/README | 247 - ext/rpc/java/config.m4 | 190 - ext/rpc/java/except.php | 23 - ext/rpc/java/java.c | 862 -- ext/rpc/java/java.dsp | 254 - ext/rpc/java/jawt.php | 27 - ext/rpc/java/jver.php | 17 - ext/rpc/java/reflect.java | 419 - ext/rpc/php_rpc.h | 40 - ext/rpc/rpc.c | 936 -- ext/rpc/rpc.h | 173 - ext/rpc/rpc_proxy.c | 154 - ext/rpc/rpc_proxy.h | 22 - ext/rpc/skeleton/php_skeleton.h | 33 - ext/rpc/skeleton/skeleton.c | 269 - ext/rpc/skeleton/skeleton.h | 43 - ext/rpc/tests/test1.php | 14 - ext/rpc/tests/test2.php | 20 - ext/rpc/tests/test3.php | 19 - ext/rpc/tests/test4.php | 18 - ext/rpc/tests/tests.php | 6 - ext/rpc/xmlrpc/CREDITS | 2 - ext/rpc/xmlrpc/EXPERIMENTAL | 5 - ext/rpc/xmlrpc/config.m4 | 93 - ext/rpc/xmlrpc/libxmlrpc/README | 17 - ext/rpc/xmlrpc/libxmlrpc/acinclude.m4 | 32 - ext/rpc/xmlrpc/libxmlrpc/base64.c | 192 - ext/rpc/xmlrpc/libxmlrpc/base64.h | 38 - ext/rpc/xmlrpc/libxmlrpc/encodings.c | 119 - ext/rpc/xmlrpc/libxmlrpc/encodings.h | 46 - ext/rpc/xmlrpc/libxmlrpc/queue.c | 982 -- ext/rpc/xmlrpc/libxmlrpc/queue.h | 89 - ext/rpc/xmlrpc/libxmlrpc/simplestring.c | 244 - ext/rpc/xmlrpc/libxmlrpc/simplestring.h | 76 - ext/rpc/xmlrpc/libxmlrpc/system_methods.c | 375 - ext/rpc/xmlrpc/libxmlrpc/system_methods_private.h | 91 - ext/rpc/xmlrpc/libxmlrpc/xml_element.c | 734 -- ext/rpc/xmlrpc/libxmlrpc/xml_element.h | 202 - ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.c | 319 - ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.h | 44 - ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.c | 673 -- ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.h | 44 - ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.c | 409 - ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.h | 45 - ext/rpc/xmlrpc/libxmlrpc/xmlrpc.c | 2956 ----- ext/rpc/xmlrpc/libxmlrpc/xmlrpc.h | 454 - ext/rpc/xmlrpc/libxmlrpc/xmlrpc.m4 | 12 - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.c | 598 - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.h | 101 - .../libxmlrpc/xmlrpc_introspection_private.h | 106 - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_private.h | 178 - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_win32.h | 11 - ext/rpc/xmlrpc/php_xmlrpc.h | 120 - ext/rpc/xmlrpc/xmlrpc-epi-php.c | 1475 --- ext/rpc/xmlrpc/xmlrpc.dsp | 211 - ext/session/CREDITS | 2 - ext/session/config.m4 | 33 - ext/session/mod_files.c | 406 - ext/session/mod_files.h | 27 - ext/session/mod_files.sh | 16 - ext/session/mod_mm.c | 437 - ext/session/mod_mm.h | 35 - ext/session/mod_user.c | 184 - ext/session/mod_user.h | 39 - ext/session/php_session.h | 236 - ext/session/session.c | 1778 --- ext/session/tests/001.phpt | 35 - ext/session/tests/002.phpt | 13 - ext/session/tests/003.phpt | 44 - ext/session/tests/004.phpt | 111 - ext/session/tests/005.phpt | 146 - ext/session/tests/006.phpt | 70 - ext/session/tests/007.phpt | 59 - ext/session/tests/008-php4.2.3.phpt | 68 - ext/session/tests/008.phpt | 61 - ext/session/tests/009.phpt | 57 - ext/session/tests/010.phpt | 19 - ext/session/tests/011.phpt | 20 - ext/session/tests/012.phpt | 34 - ext/session/tests/013.phpt | 26 - ext/session/tests/014.phpt | 37 - ext/session/tests/015.phpt | 24 - ext/session/tests/016.phpt | 20 - ext/session/tests/017.phpt | 25 - ext/session/tests/018.phpt | 24 - ext/session/tests/019.phpt | 72 - ext/session/tests/020.phpt | 25 - ext/session/tests/021.phpt | 61 - ext/session/tests/skipif.inc | 10 - ext/shmop/CREDITS | 2 - ext/shmop/README | 69 - ext/shmop/config.m4 | 8 - ext/shmop/php_shmop.h | 84 - ext/shmop/shmop.c | 368 - ext/shmop/shmop.dsp | 107 - ext/shmop/tests/001.phpt | 91 - ext/skeleton/CREDITS | 1 - ext/skeleton/EXPERIMENTAL | 0 ext/skeleton/create_stubs | 289 - ext/skeleton/php_skeleton.h | 56 - ext/skeleton/skeleton.c | 167 - ext/skeleton/skeleton.dsp | 113 - ext/skeleton/skeleton.php | 19 - ext/skeleton/tests/001.phpt | 24 - ext/snmp/CREDITS | 3 - ext/snmp/config.m4 | 123 - ext/snmp/php_snmp.h | 61 - ext/snmp/snmp.c | 893 -- ext/snmp/snmp.dsp | 109 - ext/snmp/winsnmp.c | 249 - ext/soap/EXPERIMENTAL | 0 ext/soap/Makefile.in | 8 - ext/soap/TODO | 39 - ext/soap/config.m4 | 33 - ext/soap/interop/base.php | 25 - ext/soap/interop/client_round2.php | 102 - ext/soap/interop/client_round2_interop.php | 796 -- ext/soap/interop/client_round2_params.php | 636 - ext/soap/interop/client_round2_results.php | 75 - ext/soap/interop/client_round2_run.php | 54 - ext/soap/interop/database_round2.sql | 45 - ext/soap/interop/echoheadersvc.wsdl | 16 - ext/soap/interop/endpointdata.sql | 85 - ext/soap/interop/index.php | 70 - ext/soap/interop/info.php | 1 - ext/soap/interop/interop.wsdl | 18 - ext/soap/interop/interopB.wsdl | 13 - ext/soap/interop/server_round2.php | 35 - ext/soap/interop/server_round2_base.php | 184 - ext/soap/interop/server_round2_groupB.php | 87 - ext/soap/interop/server_round2_groupC.php | 41 - ext/soap/interop/server_round2_test.php | 258 - ext/soap/interop/test.utility.php | 81 - ext/soap/interop/testclient.php | 17 - ext/soap/interop/testserver.php | 17 - ext/soap/package.xml | 59 - ext/soap/php_encoding.c | 1135 -- ext/soap/php_encoding.h | 256 - ext/soap/php_http.c | 456 - ext/soap/php_http.h | 11 - ext/soap/php_packet_soap.c | 141 - ext/soap/php_packet_soap.h | 6 - ext/soap/php_schema.c | 1080 -- ext/soap/php_schema.h | 28 - ext/soap/php_sdl.c | 1139 -- ext/soap/php_sdl.h | 167 - ext/soap/php_soap.dsp | 148 - ext/soap/php_soap.h | 416 - ext/soap/php_xml.c | 242 - ext/soap/php_xml.h | 28 - ext/soap/soap.c | 2309 ---- ext/sockets/CREDITS | 2 - ext/sockets/config.m4 | 32 - ext/sockets/php_sockets.h | 133 - ext/sockets/php_sockets_win.c | 178 - ext/sockets/php_sockets_win.h | 82 - ext/sockets/sockets.c | 2304 ---- ext/sockets/sockets.dsp | 117 - ext/sockets/sockets.php | 10 - ext/sockets/tests/ipv4loop.phpt | 49 - ext/sockets/tests/ipv6loop.phpt | 52 - ext/sockets/unix_socket_constants.h | 406 - ext/sockets/win32_socket_constants.h | 54 - ext/spl/CREDITS | 2 - ext/spl/EXPERIMENTAL | 0 ext/spl/README | 39 - ext/spl/TODO | 13 - ext/spl/config.m4 | 41 - ext/spl/examples/dba_dump.php | 72 - ext/spl/php_spl.c | 310 - ext/spl/php_spl.h | 114 - ext/spl/spl.php | 306 - ext/spl/spl_array.c | 349 - ext/spl/spl_array.h | 49 - ext/spl/spl_engine.c | 253 - ext/spl/spl_engine.h | 63 - ext/spl/spl_foreach.c | 129 - ext/spl/spl_foreach.h | 37 - ext/spl/spl_functions.c | 187 - ext/spl/spl_functions.h | 80 - ext/spl/tests/.htaccess | 3 - ext/spl/tests/array_access_001.phpt | 127 - ext/spl/tests/array_access_002.phpt | 137 - ext/spl/tests/array_access_ex.phpt | 154 - ext/spl/tests/array_read.phpt | 208 - ext/spl/tests/foreach.phpt | 184 - ext/spl/tests/forward.phpt | 115 - ext/spl/tests/sequence.phpt | 138 - ext/sqlite/EXPERIMENTAL | 0 ext/sqlite/libsqlite/src/opcodes.c | 132 - ext/sqlite/libsqlite/src/sqlite.w32.h | 692 -- ext/sqlite/libsqlite/src/sqlite_config.w32.h | 8 - ext/sqlite/sqlite.dsp | 316 - ext/sqlite/tests/sqlite_007.phpt | 51 - ext/sqlite/tests/sqlite_008.phpt | 43 - ext/sqlite/tests/sqlite_009.phpt | 43 - ext/sqlite/tests/sqlite_010.phpt | 78 - ext/sqlite/tests/sqlite_011.phpt | 27 - ext/sqlite/tests/sqlite_012.phpt | 35 - ext/sqlite/tests/sqlite_013.phpt | 55 - ext/standard/CREDITS | 3 - ext/standard/Makefile.frag | 10 - ext/standard/aggregation.c | 658 - ext/standard/aggregation.h | 51 - ext/standard/array.c | 3780 ------ ext/standard/assert.c | 298 - ext/standard/base64.c | 248 - ext/standard/base64.h | 37 - ext/standard/basic_functions.c | 3056 ----- ext/standard/basic_functions.h | 224 - ext/standard/browscap.c | 291 - ext/standard/config.m4 | 289 - ext/standard/crc32.c | 52 - ext/standard/crc32.h | 109 - ext/standard/credits.c | 122 - ext/standard/credits.h | 42 - ext/standard/credits_ext.h | 95 - ext/standard/credits_sapi.h | 31 - ext/standard/crypt.c | 173 - ext/standard/css.c | 59 - ext/standard/css.h | 26 - ext/standard/cyr_convert.c | 299 - ext/standard/cyr_convert.h | 29 - ext/standard/datetime.c | 1070 -- ext/standard/datetime.h | 47 - ext/standard/dir.c | 505 - ext/standard/dl.c | 292 - ext/standard/dl.h | 34 - ext/standard/dns.c | 797 -- ext/standard/dns.h | 58 - ext/standard/exec.c | 445 - ext/standard/exec.h | 41 - ext/standard/file.c | 2027 ---- ext/standard/file.h | 125 - ext/standard/filestat.c | 932 -- ext/standard/filters.c | 1755 --- ext/standard/flock_compat.c | 238 - ext/standard/flock_compat.h | 55 - ext/standard/formatted_print.c | 847 -- ext/standard/fsock.c | 137 - ext/standard/fsock.h | 50 - ext/standard/ftok.c | 67 - ext/standard/ftp_fopen_wrapper.c | 777 -- ext/standard/head.c | 206 - ext/standard/head.h | 32 - ext/standard/html.c | 1197 -- ext/standard/html.h | 41 - ext/standard/http_fopen_wrapper.c | 548 - ext/standard/image.c | 1285 -- ext/standard/incomplete_class.c | 152 - ext/standard/info.c | 1048 -- ext/standard/info.h | 86 - ext/standard/iptc.c | 387 - ext/standard/lcg.c | 138 - ext/standard/levenshtein.c | 155 - ext/standard/link.c | 227 - ext/standard/mail.c | 282 - ext/standard/math.c | 1150 -- ext/standard/md5.c | 446 - ext/standard/md5.h | 65 - ext/standard/metaphone.c | 478 - ext/standard/microtime.c | 162 - ext/standard/microtime.h | 32 - ext/standard/pack.c | 918 -- ext/standard/pack.h | 28 - ext/standard/pageinfo.c | 196 - ext/standard/pageinfo.h | 35 - ext/standard/parsedate.y | 1019 -- ext/standard/php_array.h | 106 - ext/standard/php_assert.h | 32 - ext/standard/php_browscap.h | 29 - ext/standard/php_crypt.h | 39 - ext/standard/php_dir.h | 40 - ext/standard/php_ext_syslog.h | 39 - ext/standard/php_filestat.h | 78 - ext/standard/php_fopen_wrapper.c | 253 - ext/standard/php_fopen_wrappers.h | 32 - ext/standard/php_ftok.h | 28 - ext/standard/php_image.h | 62 - ext/standard/php_incomplete_class.h | 63 - ext/standard/php_iptc.h | 27 - ext/standard/php_lcg.h | 44 - ext/standard/php_link.h | 33 - ext/standard/php_mail.h | 34 - ext/standard/php_math.h | 158 - ext/standard/php_metaphone.h | 26 - ext/standard/php_parsedate.h | 26 - ext/standard/php_rand.h | 53 - ext/standard/php_smart_str.h | 179 - ext/standard/php_smart_str_public.h | 30 - ext/standard/php_standard.h | 75 - ext/standard/php_string.h | 147 - ext/standard/php_sunfuncs.h | 42 - ext/standard/php_type.h | 41 - ext/standard/php_var.h | 69 - ext/standard/php_versioning.h | 30 - ext/standard/proc_open.c | 813 -- ext/standard/proc_open.h | 49 - ext/standard/quot_print.c | 216 - ext/standard/quot_print.h | 28 - ext/standard/rand.c | 409 - ext/standard/reg.c | 637 - ext/standard/reg.h | 50 - ext/standard/scanf.c | 1259 -- ext/standard/scanf.h | 49 - ext/standard/sha1.c | 427 - ext/standard/sha1.h | 40 - ext/standard/soundex.c | 115 - ext/standard/streamsfuncs.c | 1025 -- ext/standard/streamsfuncs.h | 57 - ext/standard/string.c | 4637 ------- ext/standard/strnatcmp.c | 175 - ext/standard/sunfuncs.c | 242 - ext/standard/syslog.c | 281 - ext/standard/tests/aggregation/aggregate.lib | 65 - ext/standard/tests/aggregation/aggregate.phpt | 19 - .../tests/aggregation/aggregate_methods.phpt | 25 - .../aggregation/aggregate_methods_by_list.phpt | 22 - .../aggregation/aggregate_methods_by_regexp.phpt | 20 - .../tests/aggregation/aggregate_properties.phpt | 19 - .../aggregation/aggregate_properties_by_list.phpt | 20 - .../aggregate_properties_by_regexp.phpt | 22 - .../tests/aggregation/aggregation_info.phpt | 31 - ext/standard/tests/aggregation/deaggregate.phpt | 72 - ext/standard/tests/array/001.phpt | 159 - ext/standard/tests/array/002.phpt | 644 - ext/standard/tests/array/003.phpt | 104 - ext/standard/tests/array/004.phpt | 59 - ext/standard/tests/array/005.phpt | 46 - ext/standard/tests/array/006.phpt | 49 - ext/standard/tests/array/007.phpt | 175 - ext/standard/tests/array/008.phpt | 310 - .../tests/array/array_change_key_case.phpt | 769 -- ext/standard/tests/array/array_chunk.phpt | 5326 -------- ext/standard/tests/array/array_count_values.phpt | 95 - ext/standard/tests/array/array_search.phpt | 23 - ext/standard/tests/array/bug12776.phpt | 25 - ext/standard/tests/array/bug20381.phpt | 79 - ext/standard/tests/array/bug20865.phpt | 11 - ext/standard/tests/array/bug21182.phpt | 12 - ext/standard/tests/array/bug21998.phpt | 24 - ext/standard/tests/array/bug22088.phpt | 33 - ext/standard/tests/array/bug22463.phpt | 29 - ext/standard/tests/array/bug23581.phpt | 44 - ext/standard/tests/array/count_recursive.phpt | 52 - ext/standard/tests/array/data.inc | 13 - ext/standard/tests/array/range.phpt | 1345 --- ext/standard/tests/array/var_export.phpt | 11 - ext/standard/tests/assert/assert.phpt | 39 - ext/standard/tests/file/001-win32.phpt | 127 - ext/standard/tests/file/001.phpt | 148 - ext/standard/tests/file/002.phpt | 54 - ext/standard/tests/file/003.phpt | 43 - ext/standard/tests/file/bug12556.phpt | 50 - ext/standard/tests/file/bug20424.phpt | 12 - ext/standard/tests/file/bug22382.phpt | 27 - ext/standard/tests/file/bug22414.phpt | 38 - ext/standard/tests/file/fopencookie.phpt | 86 - ext/standard/tests/file/test.csv | 17 - ext/standard/tests/file/test2.csv | 1 - ext/standard/tests/file/userfilters.phpt | 37 - ext/standard/tests/file/userstreams.phpt | 325 - ext/standard/tests/filters/basic.phpt | 44 - ext/standard/tests/filters/bug22538.phpt | 44 - ext/standard/tests/general_functions/001.phpt | 69 - ext/standard/tests/general_functions/002.phpt | 13 - ext/standard/tests/general_functions/003.phpt | 60 - ext/standard/tests/general_functions/004.data | 4 - ext/standard/tests/general_functions/004.phpt | 18 - ext/standard/tests/general_functions/005.phpt | 26 - ext/standard/tests/general_functions/006.phpt | 13 - ext/standard/tests/general_functions/007.phpt | 26 - ext/standard/tests/general_functions/008.phpt | 40 - ext/standard/tests/general_functions/009.phpt | 26 - ext/standard/tests/general_functions/getopt.phpt | 30 - .../tests/general_functions/proc_open.phpt | 30 - .../tests/general_functions/sunfuncts.phpt | 44 - ext/standard/tests/image/246x247.png | Bin 360 -> 0 bytes ext/standard/tests/image/384x385.png | Bin 267 -> 0 bytes ext/standard/tests/image/bug13213.jpg | Bin 596 -> 0 bytes ext/standard/tests/image/bug13213.phpt | 23 - ext/standard/tests/image/getimagesize.phpt | 196 - ext/standard/tests/image/getimagesize_246x247.phpt | 42 - ext/standard/tests/image/getimagesize_384x385.phpt | 42 - ext/standard/tests/image/getimagesize_swc.phpt | 25 - .../tests/image/image_type_to_mime_type.phpt | 51 - ext/standard/tests/image/skipif_imagetype.inc | 15 - ext/standard/tests/image/test13pix.swf | Bin 589 -> 0 bytes ext/standard/tests/image/test1pix.bmp | Bin 58 -> 0 bytes ext/standard/tests/image/test1pix.jp2 | Bin 243 -> 0 bytes ext/standard/tests/image/test1pix.jpc | Bin 127 -> 0 bytes ext/standard/tests/image/test1pix.jpg | Bin 523 -> 0 bytes ext/standard/tests/image/test2pix.gif | Bin 35 -> 0 bytes ext/standard/tests/image/test4pix.gif | Bin 42 -> 0 bytes ext/standard/tests/image/test4pix.iff | Bin 114 -> 0 bytes ext/standard/tests/image/test4pix.png | Bin 148 -> 0 bytes ext/standard/tests/image/test4pix.psd | Bin 1247 -> 0 bytes ext/standard/tests/image/test4pix.swf | Bin 609 -> 0 bytes ext/standard/tests/image/test4pix.tif | Bin 312 -> 0 bytes ext/standard/tests/math/abs.phpt | 26 - ext/standard/tests/math/bug21523.phpt | 11 - ext/standard/tests/math/floorceil.phpt | 46 - ext/standard/tests/math/hexdec.phpt | 22 - ext/standard/tests/math/log.phpt | 44 - ext/standard/tests/math/pow.phpt | 151 - ext/standard/tests/math/round.phpt | 39 - ext/standard/tests/network/bug20134.phpt | 24 - ext/standard/tests/reg/001.phpt | 9 - ext/standard/tests/reg/002.phpt | 9 - ext/standard/tests/reg/003.phpt | 10 - ext/standard/tests/reg/004.phpt | 16 - ext/standard/tests/reg/005.phpt | 20 - ext/standard/tests/reg/006.phpt | 10 - ext/standard/tests/reg/007.phpt | 12 - ext/standard/tests/reg/008.phpt | 10 - ext/standard/tests/reg/009.phpt | 19 - ext/standard/tests/reg/010.phpt | 9 - ext/standard/tests/reg/011.phpt | 9 - ext/standard/tests/reg/012.phpt | 9 - ext/standard/tests/reg/013.phpt | 9 - ext/standard/tests/reg/014.phpt | 9 - ext/standard/tests/reg/015.phpt | 8 - ext/standard/tests/reg/016.phpt | 8 - ext/standard/tests/serialize/001.phpt | 117 - ext/standard/tests/serialize/003.phpt | 24 - ext/standard/tests/serialize/bug14293.phpt | 34 - ext/standard/tests/serialize/bug23298.phpt | 13 - ext/standard/tests/strings/004.phpt | 84 - .../tests/strings/add-and-stripcslashes.phpt | 28 - .../tests/strings/add-and-stripslashes.phpt | 32 - ext/standard/tests/strings/basename.phpt | Bin 1165 -> 0 bytes ext/standard/tests/strings/bin2hex.phpt | 16 - ext/standard/tests/strings/bug20108.phpt | 12 - ext/standard/tests/strings/bug20169.phpt | 14 - ext/standard/tests/strings/bug20261.phpt | 26 - ext/standard/tests/strings/bug20927.phpt | 18 - ext/standard/tests/strings/bug20934.phpt | 17 - ext/standard/tests/strings/bug21338.phpt | 10 - ext/standard/tests/strings/bug21453.phpt | 18 - ext/standard/tests/strings/bug21730.phpt | 35 - ext/standard/tests/strings/bug21744.phpt | 15 - ext/standard/tests/strings/bug22008.phpt | 24 - ext/standard/tests/strings/bug22187.phpt | 10 - ext/standard/tests/strings/bug22207.phpt | 11 - ext/standard/tests/strings/bug22224.phpt | 26 - ext/standard/tests/strings/bug22227.phpt | 9 - ext/standard/tests/strings/bug22904.phpt | 30 - ext/standard/tests/strings/chr_ord.phpt | 12 - ext/standard/tests/strings/chunk_split.phpt | 19 - ext/standard/tests/strings/count_chars.phpt | 20 - ext/standard/tests/strings/crc32.phpt | 16 - ext/standard/tests/strings/crypt.phpt | 26 - ext/standard/tests/strings/explode.phpt | 116 - ext/standard/tests/strings/htmlentities.phpt | 19 - ext/standard/tests/strings/htmlentities01.phpt | 13 - ext/standard/tests/strings/htmlentities02.phpt | 20 - ext/standard/tests/strings/htmlentities03.phpt | 20 - ext/standard/tests/strings/htmlentities04.phpt | 20 - ext/standard/tests/strings/htmlentities05.phpt | 25 - ext/standard/tests/strings/htmlentities06.phpt | 22 - ext/standard/tests/strings/htmlentities07.phpt | 23 - ext/standard/tests/strings/htmlentities08.phpt | 23 - ext/standard/tests/strings/htmlentities09.phpt | 23 - ext/standard/tests/strings/htmlentities10.phpt | 16 - ext/standard/tests/strings/htmlentities11.phpt | 14 - ext/standard/tests/strings/htmlentities12.phpt | 14 - ext/standard/tests/strings/htmlentities13.phpt | 14 - ext/standard/tests/strings/htmlentities14.phpt | 14 - ext/standard/tests/strings/htmlentities15.phpt | 22 - ext/standard/tests/strings/htmlentities16.phpt | 21 - ext/standard/tests/strings/implode.phpt | 25 - ext/standard/tests/strings/md5.phpt | 20 - ext/standard/tests/strings/md5raw.phpt | 20 - ext/standard/tests/strings/nl2br.phpt | 62 - ext/standard/tests/strings/sha1.phpt | 14 - ext/standard/tests/strings/sha1raw.phpt | 14 - ext/standard/tests/strings/str_repeat.phpt | 29 - ext/standard/tests/strings/str_shuffle.phpt | 12 - ext/standard/tests/strings/strcspn.phpt | 18 - ext/standard/tests/strings/strings001.phpt | 12 - ext/standard/tests/strings/strip_tags.phpt | 29 - ext/standard/tests/strings/strpos.phpt | 32 - ext/standard/tests/strings/strrev.phpt | 21 - ext/standard/tests/strings/strripos.phpt | 35 - ext/standard/tests/strings/strrpos.phpt | 34 - ext/standard/tests/strings/strspn.phpt | 18 - ext/standard/tests/strings/strstr.phpt | 32 - ext/standard/tests/strings/strtoupper.phpt | 20 - ext/standard/tests/strings/strtr.phpt | 10 - ext/standard/tests/strings/substr_count.phpt | 26 - ext/standard/tests/strings/substr_replace.phpt | 812 -- ext/standard/tests/strings/trim.phpt | 29 - ext/standard/tests/strings/url_t.phpt | 618 - ext/standard/tests/strings/wordwrap.phpt | 37 - ext/standard/tests/time/001.phpt | 31 - ext/standard/tests/time/002-win32.phpt | 66 - ext/standard/tests/time/002.phpt | 69 - ext/standard/tests/time/003.phpt | 44 - ext/standard/tests/time/idate.phpt | 32 - ext/standard/tests/time/mktime.phpt | 49 - ext/standard/tests/versioning/version_compare.phpt | 600 - ext/standard/type.c | 378 - ext/standard/uniqid.c | 97 - ext/standard/uniqid.h | 28 - ext/standard/url.c | 630 - ext/standard/url.h | 55 - ext/standard/url_scanner.c | 384 - ext/standard/url_scanner.h | 54 - ext/standard/url_scanner_ex.c | 1018 -- ext/standard/url_scanner_ex.h | 65 - ext/standard/url_scanner_ex.re | 517 - ext/standard/user_filters.c | 514 - ext/standard/var.c | 720 -- ext/standard/var_unserializer.c | 807 -- ext/standard/var_unserializer.re | 435 - ext/standard/versioning.c | 255 - ext/swf/CREDITS | 2 - ext/swf/config.m4 | 35 - ext/swf/php_swf.h | 119 - ext/swf/swf.c | 1263 -- ext/sybase/CREDITS | 2 - ext/sybase/config.m4 | 30 - ext/sybase/php_sybase_db.c | 1409 --- ext/sybase/php_sybase_db.h | 89 - ext/sybase_ct/CREDITS | 2 - ext/sybase_ct/config.m4 | 56 - ext/sybase_ct/php_sybase_ct.c | 2083 ---- ext/sybase_ct/php_sybase_ct.h | 129 - ext/sybase_ct/sybase_ct.dsp | 114 - ext/sysvmsg/CREDITS | 2 - ext/sysvmsg/EXPERIMENTAL | 0 ext/sysvmsg/config.m4 | 9 - ext/sysvmsg/php_sysvmsg.h | 76 - ext/sysvmsg/sysvmsg.c | 403 - ext/sysvmsg/tests/001.phpt | 24 - ext/sysvsem/CREDITS | 2 - ext/sysvsem/config.m4 | 29 - ext/sysvsem/php_sysvsem.h | 57 - ext/sysvsem/sysvsem.c | 407 - ext/sysvsem/tests/sysv.phpt | 114 - ext/sysvshm/CREDITS | 2 - ext/sysvshm/config.m4 | 11 - ext/sysvshm/php_sysvshm.h | 81 - ext/sysvshm/sysvshm.c | 434 - ext/tokenizer/CREDITS | 2 - ext/tokenizer/Makefile.frag | 1 - ext/tokenizer/config.m4 | 12 - ext/tokenizer/php_tokenizer.h | 60 - ext/tokenizer/tokenizer.c | 552 - ext/tokenizer/tokenizer.dsp | 108 - ext/tokenizer/tokenizer.php | 35 - ext/w32api/CREDITS | 2 - ext/w32api/EXPERIMENTAL | 0 ext/w32api/README | 5 - ext/w32api/TODO | 3 - ext/w32api/php_w32api.h | 345 - ext/w32api/w32api.c | 2286 ---- ext/w32api/w32api.dsp | 281 - ext/w32api/w32api_function_definition_parser.y | 67 - ext/w32api/w32api_function_definition_scanner.l | 63 - ext/w32api/w32api_type_definition_parser.y | 67 - ext/w32api/w32api_type_definition_scanner.l | 56 - ext/wddx/CREDITS | 2 - ext/wddx/config.m4 | 15 - ext/wddx/php_wddx.h | 46 - ext/wddx/php_wddx_api.h | 66 - ext/wddx/wddx.c | 1290 -- ext/xml/CREDITS | 2 - ext/xml/compat.c | 525 - ext/xml/config.m4 | 16 - ext/xml/expat_compat.h | 147 - ext/xml/php_xml.h | 146 - ext/xml/tests/inc.ent | 1 - ext/xml/tests/skipif.inc | 10 - ext/xml/tests/xml001.phpt | 96 - ext/xml/tests/xml002.phpt | 97 - ext/xml/tests/xml003.phpt | 95 - ext/xml/tests/xml004.phpt | 64 - ext/xml/tests/xml006.phpt | 12 - ext/xml/tests/xml007.phpt | 53 - ext/xml/tests/xmltest.xml | 20 - ext/xml/xml.c | 1599 --- ext/xml/xml.mak | 172 - ext/xmlrpc/CREDITS | 2 - ext/xmlrpc/EXPERIMENTAL | 5 - ext/xmlrpc/config.m4 | 93 - ext/xmlrpc/libxmlrpc/README | 17 - ext/xmlrpc/libxmlrpc/acinclude.m4 | 32 - ext/xmlrpc/libxmlrpc/base64.c | 192 - ext/xmlrpc/libxmlrpc/base64.h | 38 - ext/xmlrpc/libxmlrpc/encodings.c | 119 - ext/xmlrpc/libxmlrpc/encodings.h | 46 - ext/xmlrpc/libxmlrpc/queue.c | 982 -- ext/xmlrpc/libxmlrpc/queue.h | 89 - ext/xmlrpc/libxmlrpc/simplestring.c | 244 - ext/xmlrpc/libxmlrpc/simplestring.h | 76 - ext/xmlrpc/libxmlrpc/system_methods.c | 375 - ext/xmlrpc/libxmlrpc/system_methods_private.h | 91 - ext/xmlrpc/libxmlrpc/xml_element.c | 734 -- ext/xmlrpc/libxmlrpc/xml_element.h | 202 - ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c | 319 - ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h | 44 - ext/xmlrpc/libxmlrpc/xml_to_soap.c | 673 -- ext/xmlrpc/libxmlrpc/xml_to_soap.h | 44 - ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c | 409 - ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h | 45 - ext/xmlrpc/libxmlrpc/xmlrpc.c | 2956 ----- ext/xmlrpc/libxmlrpc/xmlrpc.h | 454 - ext/xmlrpc/libxmlrpc/xmlrpc.m4 | 12 - ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c | 598 - ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h | 101 - .../libxmlrpc/xmlrpc_introspection_private.h | 106 - ext/xmlrpc/libxmlrpc/xmlrpc_private.h | 178 - ext/xmlrpc/libxmlrpc/xmlrpc_win32.h | 11 - ext/xmlrpc/php_xmlrpc.h | 120 - ext/xmlrpc/xmlrpc-epi-php.c | 1485 --- ext/xmlrpc/xmlrpc.dsp | 211 - ext/xslt/README.XSLT-BACKENDS | 285 - ext/xslt/TODO | 31 - ext/xslt/config.m4 | 164 - ext/xslt/php_sablot.h | 142 - ext/xslt/php_xslt.h | 63 - ext/xslt/sablot.c | 1821 --- ext/xslt/tests/args.xsl | 10 - ext/xslt/tests/bug17791.phpt | 15 - ext/xslt/tests/bug17931.phpt | 32 - ext/xslt/tests/bug20177.phpt | 34 - ext/xslt/tests/bug20518.phpt | 33 - ext/xslt/tests/param.xsl | 15 - ext/xslt/tests/public.xml | 5 - ext/xslt/tests/qa.dtd | 7 - ext/xslt/tests/skipif.inc | 5 - ext/xslt/tests/test.xml | 5 - ext/xslt/tests/xslt-001.phpt | 21 - ext/xslt/tests/xslt.phpt | 12 - ext/xslt/tests/xslt_backend_info.phpt | 49 - ext/xslt/tests/xslt_getopt.phpt | 37 - ext/xslt/tests/xslt_process-001.phpt | 62 - ext/xslt/tests/xslt_process-002.phpt | 74 - ext/xslt/tests/xslt_set_object.phpt | 89 - ext/xslt/tests/xslt_set_object.xsl | 3 - ext/xslt/tests/xslt_set_scheme_handlers-001.phpt | 20 - ext/xslt/tests/xslt_set_scheme_handlers-002.phpt | 57 - ext/xslt/tests/xslt_set_scheme_handlers-003.phpt | 47 - ext/xslt/tests/xslt_setopt.phpt | 60 - ext/xslt/xslt.c | 276 - ext/xslt/xslt.dsp | 115 - ext/yaz/CREDITS | 2 - ext/yaz/README | 5 - ext/yaz/config.m4 | 53 - ext/yaz/php_yaz.c | 1599 --- ext/yaz/php_yaz.h | 76 - ext/yaz/yaz.dsp | 111 - ext/yp/CREDITS | 2 - ext/yp/config.m4 | 38 - ext/yp/php_yp.h | 69 - ext/yp/yp.c | 430 - ext/zip/CREDITS | 2 - ext/zip/config.m4 | 39 - ext/zip/php_zip.h | 70 - ext/zip/tests/001.phpt | 23 - ext/zip/zip.c | 331 - ext/zip/zip.dsp | 108 - ext/zlib/CREDITS | 2 - ext/zlib/config0.m4 | 53 - ext/zlib/php_zlib.h | 83 - ext/zlib/tests/001.phpt | 26 - ext/zlib/tests/002.phpt | 17 - ext/zlib/tests/003.phpt | 16 - ext/zlib/tests/gzreadgzwrite.phpt | 33 - ext/zlib/tests/gzreadgzwriteplain.phpt | 47 - ext/zlib/zlib.c | 1087 -- ext/zlib/zlib.dsp | 117 - ext/zlib/zlib_fopen_wrapper.c | 181 - ext/zlib/zlib_win32_howto.txt | 16 - footer | 9 - genfiles | 14 - header | 19 - ltmain.sh | 5062 -------- main/SAPI.c | 909 -- main/SAPI.h | 291 - main/alloca.c | 501 - main/build-defs.h.in | 91 - main/config.nw.h | 316 - main/config.w32.h | 177 - main/fopen_wrappers.c | 570 - main/fopen_wrappers.h | 47 - main/internal_functions.c.in | 56 - main/internal_functions_nw.c | 102 - main/internal_functions_registry.h | 37 - main/internal_functions_win32.c | 166 - main/logos.h | 1544 --- main/main.c | 1819 --- main/mergesort.c | 363 - main/network.c | 949 -- main/output.c | 1059 -- main/php.h | 434 - main/php3_compat.h | 122 - main/php_compat.h | 129 - main/php_content_types.c | 92 - main/php_content_types.h | 30 - main/php_globals.h | 160 - main/php_ini.c | 585 - main/php_ini.h | 76 - main/php_logos.c | 100 - main/php_logos.h | 31 - main/php_main.h | 56 - main/php_memory_streams.h | 64 - main/php_network.h | 194 - main/php_open_temporary_file.c | 264 - main/php_open_temporary_file.h | 27 - main/php_output.h | 109 - main/php_realpath.c | 283 - main/php_reentrancy.h | 129 - main/php_regex.h | 65 - main/php_scandir.c | 137 - main/php_scandir.h | 50 - main/php_sprintf.c | 55 - main/php_streams.h | 495 - main/php_syslog.h | 57 - main/php_ticks.c | 81 - main/php_ticks.h | 37 - main/php_variables.c | 737 -- main/php_variables.h | 46 - main/php_version.h | 7 - main/reentrancy.c | 504 - main/rfc1867.c | 1073 -- main/rfc1867.h | 33 - main/safe_mode.c | 229 - main/safe_mode.h | 39 - main/snprintf.c | 965 -- main/snprintf.h | 114 - main/spprintf.c | 561 - main/spprintf.h | 52 - main/streams/cast.c | 354 - main/streams/filter.c | 332 - main/streams/memory.c | 473 - main/streams/mmap.c | 52 - main/streams/php_stream_context.h | 109 - main/streams/php_stream_filter_api.h | 143 - main/streams/php_stream_mmap.h | 82 - main/streams/php_stream_plain_wrapper.h | 61 - main/streams/php_stream_transport.h | 161 - main/streams/php_stream_userspace.h | 35 - main/streams/php_streams_int.h | 61 - main/streams/plain_wrapper.c | 1126 -- main/streams/streams.c | 1671 --- main/streams/transports.c | 373 - main/streams/userspace.c | 863 -- main/streams/xp_socket.c | 667 - main/strlcat.c | 106 - main/strlcpy.c | 103 - main/win95nt.h | 82 - makedist | 142 - makerpm | 156 - netware/ApacheCore.imp | 365 - netware/BisonExtStandard.bat | 3 - netware/BisonFlexZend.bat | 8 - netware/ZendEngine2.mak | 160 - netware/build.bat | 21 - netware/buildext.bat | 18 - netware/buildlib.bat | 20 - netware/buildsapi.bat | 18 - netware/common.mif | 90 - netware/geterrnoptr.c | 9 - netware/grp.h | 31 - netware/libpq-fe.h | 378 - netware/libpq.imp | 93 - netware/libpq/libpq-fs.h | 24 - netware/mktemp.c | 87 - netware/mktemp.h | 1 - netware/param.h | 20 - netware/php-nw.bat | 10 - netware/php4apache.mak | 165 - netware/php4apache2filter.mak | 166 - netware/php4cli.mak | 163 - netware/phplib.imp | 177 - netware/phplib.mak | 404 - netware/phptest.ncf | 1 - netware/pipe.c | 329 - netware/pipe.h | 11 - netware/postgres_ext.h | 45 - netware/pwd.c | 86 - netware/pwd.h | 54 - netware/sendmail_nw.h | 17 - netware/setbuild.bat | 19 - netware/start.c | 119 - netware/sys/stat.h | 147 - netware/sysexits.h | 114 - netware/time_nw.c | 246 - netware/time_nw.h | 57 - netware/tsrm.mak | 109 - netware/wfile.c | 17 - netware/wfile.h | 16 - netware/zend.mak | 158 - pear/Archive/Tar.php | 1301 -- pear/Archive/docs/Tar.txt | 424 - pear/CMD.php | 285 - pear/CODING_STANDARDS | 8 - pear/Console/Getopt.php | 225 - pear/Console/tests/001-getopt.phpt | 68 - pear/Makefile.frag | 22 - pear/OS/Guess.php | 265 - pear/PEAR.php | 962 -- pear/PEAR/Autoloader.php | 186 - pear/PEAR/Builder.php | 383 - pear/PEAR/Command.php | 322 - pear/PEAR/Command/Auth.php | 155 - pear/PEAR/Command/Build.php | 89 - pear/PEAR/Command/Common.php | 249 - pear/PEAR/Command/Config.php | 225 - pear/PEAR/Command/Install.php | 302 - pear/PEAR/Command/Mirror.php | 99 - pear/PEAR/Command/Package.php | 660 - pear/PEAR/Command/Registry.php | 319 - pear/PEAR/Command/Remote.php | 407 - pear/PEAR/Common.php | 1674 --- pear/PEAR/Config.php | 1139 -- pear/PEAR/Dependency.php | 329 - pear/PEAR/Frontend/CLI.php | 487 - pear/PEAR/Installer.php | 874 -- pear/PEAR/Packager.php | 176 - pear/PEAR/Registry.php | 690 -- pear/PEAR/Remote.php | 367 - pear/README | 18 - pear/System.php | 449 - pear/catalog | 1 - pear/docs/Archive_Tar.txt | 424 - pear/install-pear.php | 109 - pear/install-pear.txt | 11 - pear/package-Archive_Tar.xml | 60 - pear/package-Console_Getopt.xml | 63 - pear/package-PEAR.xml | 342 - pear/package.dtd | 109 - pear/packages/DB-1.3.tar | Bin 387072 -> 0 bytes pear/packages/HTTP-1.2.tar | Bin 12288 -> 0 bytes pear/packages/Mail-1.0.1.tar | Bin 59904 -> 0 bytes pear/packages/Net_SMTP-1.0.tar | Bin 17408 -> 0 bytes pear/packages/Net_Socket-1.0.1.tar | Bin 15872 -> 0 bytes pear/packages/XML_Parser-1.0.1.tar | Bin 26112 -> 0 bytes pear/packages/XML_RPC-1.0.4.tar | Bin 49664 -> 0 bytes pear/scripts/pear.bat | 69 - pear/scripts/pear.sh | 28 - pear/scripts/pearcmd.php | 295 - pear/scripts/pearwin.php | 233 - pear/template.spec | 44 - pear/tests/merge.input | 1 - pear/tests/pear1.phpt | 88 - pear/tests/pear_autoloader.phpt | 81 - pear/tests/pear_config.phpt | 289 - pear/tests/pear_error.phpt | 154 - pear/tests/pear_error2.phpt | 25 - pear/tests/pear_error3.phpt | 54 - pear/tests/pear_error4.phpt | 104 - pear/tests/pear_registry.phpt | 168 - pear/tests/pear_system.phpt | 101 - pear/tests/php.ini | 2 - pear/tests/system.input | 1 - pear/tests/toonew.conf | 2 - pear/tests/user.input | 0 pear/tests/user2.input | 1 - php.gif | Bin 3872 -> 0 bytes php.ini-dist | 1126 -- php.ini-recommended | 1135 -- php4.spec.in | 48 - regex/COPYRIGHT | 20 - regex/README | 32 - regex/WHATSNEW | 92 - regex/cclass.h | 30 - regex/cname.h | 102 - regex/debug.c | 242 - regex/debug.ih | 14 - regex/engine.c | 1019 -- regex/engine.ih | 35 - regex/main.c | 510 - regex/main.ih | 19 - regex/mkh | 76 - regex/regcomp.c | 1608 --- regex/regcomp.ih | 53 - regex/regerror.c | 126 - regex/regerror.ih | 12 - regex/regex.3 | 502 - regex/regex.7 | 233 - regex/regex.dsp | 106 - regex/regex.dsw | 29 - regex/regex.h | 83 - regex/regex.mak | 304 - regex/regex2.h | 140 - regex/regex_extra.h | 23 - regex/regexec.c | 138 - regex/regfree.c | 37 - regex/split.c | 316 - regex/tests | 475 - regex/utils.h | 25 - run-tests-config.php | 74 - run-tests.php | 925 -- run-tests2.php | 1573 --- sapi/activescript/CREDITS | 2 - sapi/activescript/EXPERIMENTAL | 5 - sapi/activescript/README | 56 - sapi/activescript/classfactory.cpp | 362 - sapi/activescript/php4activescript.c | 152 - sapi/activescript/php4activescript.def | 5 - sapi/activescript/php4activescript.dsp | 185 - sapi/activescript/php4activescript.h | 25 - sapi/activescript/php4as_classfactory.h | 52 - sapi/activescript/php4as_scriptengine.h | 235 - sapi/activescript/scriptengine.cpp | 1877 --- sapi/aolserver/CREDITS | 2 - sapi/aolserver/README | 69 - sapi/aolserver/aolserver.c | 616 - sapi/aolserver/config.m4 | 33 - sapi/aolserver/php.sym | 2 - sapi/aolserver/php4aolserver.dsp | 135 - sapi/apache/CREDITS | 3 - sapi/apache/apMakefile.libdir | 4 - sapi/apache/apMakefile.tmpl | 77 - sapi/apache/config.m4 | 272 - sapi/apache/libphp5.module.in | 11 - sapi/apache/libpre.c | 55 - sapi/apache/mod_php5.c | 966 -- sapi/apache/mod_php5.exp | 1 - sapi/apache/mod_php5.h | 54 - sapi/apache/php.sym | 1 - sapi/apache/php4apache.dsp | 151 - sapi/apache/php_apache.c | 543 - sapi/apache/php_apache_http.h | 66 - sapi/apache/sapi_apache.c | 75 - sapi/apache2filter/CREDITS | 2 - sapi/apache2filter/EXPERIMENTAL | 5 - sapi/apache2filter/README | 71 - sapi/apache2filter/apache_config.c | 230 - sapi/apache2filter/config.m4 | 118 - sapi/apache2filter/php.sym | 1 - sapi/apache2filter/php_apache.h | 72 - sapi/apache2filter/php_functions.c | 393 - sapi/apache2filter/sapi_apache2.c | 698 -- sapi/apache2handler/CREDITS | 2 - sapi/apache2handler/EXPERIMENTAL | 5 - sapi/apache2handler/README | 76 - sapi/apache2handler/apache_config.c | 212 - sapi/apache2handler/config.m4 | 118 - sapi/apache2handler/php.sym | 1 - sapi/apache2handler/php4apache2.dsp | 142 - sapi/apache2handler/php_apache.h | 83 - sapi/apache2handler/php_functions.c | 516 - sapi/apache2handler/sapi_apache2.c | 585 - sapi/apache_hooks/CREDITS | 2 - sapi/apache_hooks/README | 206 - sapi/apache_hooks/apMakefile.libdir | 4 - sapi/apache_hooks/apMakefile.tmpl | 77 - sapi/apache_hooks/config.m4 | 242 - sapi/apache_hooks/libphp4.module.in | 11 - sapi/apache_hooks/mod_php4.c | 1474 --- sapi/apache_hooks/mod_php4.exp | 1 - sapi/apache_hooks/mod_php4.h | 81 - sapi/apache_hooks/php.sym | 1 - sapi/apache_hooks/php4apache_hooks.dsp | 151 - sapi/apache_hooks/php_apache.c | 1954 --- sapi/apache_hooks/php_apache_http.h | 44 - sapi/apache_hooks/sapi_apache.c | 136 - sapi/caudium/CREDITS | 2 - sapi/caudium/README | 16 - sapi/caudium/TODO | 30 - sapi/caudium/caudium.c | 791 -- sapi/caudium/config.m4 | 99 - sapi/cgi/CREDITS | 2 - sapi/cgi/Makefile.frag | 2 - sapi/cgi/README.FastCGI | 137 - sapi/cgi/cgi_main.c | 1635 --- sapi/cgi/config9.m4 | 171 - sapi/cgi/getopt.c | 154 - sapi/cgi/libfcgi/LICENSE.TERMS | 28 - sapi/cgi/libfcgi/acinclude.m4 | 389 - sapi/cgi/libfcgi/fcgi_stdio.c | 801 -- sapi/cgi/libfcgi/fcgiapp.c | 2323 ---- sapi/cgi/libfcgi/include/fastcgi.h | 136 - sapi/cgi/libfcgi/include/fcgi_config.h | 7 - sapi/cgi/libfcgi/include/fcgi_config_win32.h | 111 - sapi/cgi/libfcgi/include/fcgi_config_x86.h | 103 - sapi/cgi/libfcgi/include/fcgi_stdio.h | 249 - sapi/cgi/libfcgi/include/fcgiapp.h | 640 - sapi/cgi/libfcgi/include/fcgiappmisc.h | 50 - sapi/cgi/libfcgi/include/fcgimisc.h | 38 - sapi/cgi/libfcgi/include/fcgio.h | 147 - sapi/cgi/libfcgi/include/fcgios.h | 140 - sapi/cgi/libfcgi/libfcgi.m4 | 77 - sapi/cgi/libfcgi/os_unix.c | 1268 -- sapi/cgi/libfcgi/os_win32.c | 2067 ---- sapi/cgi/libfcgi/strerror.c | 91 - sapi/cgi/php.sym | 0 sapi/cgi/php_getopt.h | 30 - sapi/cli/CREDITS | 2 - sapi/cli/Makefile.frag | 9 - sapi/cli/README | 19 - sapi/cli/TODO | 2 - sapi/cli/config.m4 | 40 - sapi/cli/getopt.c | 156 - sapi/cli/php.1.in | 387 - sapi/cli/php_cli.c | 1032 -- sapi/cli/php_getopt.h | 32 - sapi/embed/CREDITS | 2 - sapi/embed/EXPERIMENTAL | 5 - sapi/embed/config.m4 | 32 - sapi/embed/php4embed.dsp | 100 - sapi/embed/php_embed.c | 225 - sapi/embed/php_embed.h | 61 - sapi/isapi/CREDITS | 2 - sapi/isapi/config.m4 | 27 - sapi/isapi/php.sym | 5 - sapi/isapi/php4isapi.c | 949 -- sapi/isapi/php4isapi.def | 5 - sapi/isapi/php4isapi.dsp | 165 - sapi/isapi/stresstest/getopt.c | 175 - sapi/isapi/stresstest/getopt.h | 12 - sapi/isapi/stresstest/notes.txt | 56 - sapi/isapi/stresstest/stresstest.cpp | 936 -- sapi/isapi/stresstest/stresstest.dsp | 108 - sapi/milter/CREDITS | 2 - sapi/milter/EXPERIMENTAL | 5 - sapi/milter/Makefile.frag | 2 - sapi/milter/TODO | 5 - sapi/milter/config.m4 | 39 - sapi/milter/getopt.c | 173 - sapi/milter/milter.php | 132 - sapi/milter/php_getopt.h | 7 - sapi/milter/php_milter.c | 1139 -- sapi/milter/php_milter.h | 31 - sapi/nsapi/CREDITS | 2 - sapi/nsapi/config.m4 | 45 - sapi/nsapi/nsapi-readme.txt | 79 - sapi/nsapi/nsapi.c | 597 - sapi/nsapi/php4nsapi.dsp | 135 - sapi/phttpd/CREDITS | 2 - sapi/phttpd/README | 5 - sapi/phttpd/config.m4 | 25 - sapi/phttpd/php.sym | 4 - sapi/phttpd/php_phttpd.h | 24 - sapi/phttpd/phttpd.c | 305 - sapi/pi3web/CREDITS | 2 - sapi/pi3web/README | 50 - sapi/pi3web/config.m4 | 35 - sapi/pi3web/php.sym | 0 sapi/pi3web/php4pi3web.dsp | 136 - sapi/pi3web/pi3web_sapi.c | 480 - sapi/pi3web/pi3web_sapi.h | 95 - sapi/roxen/README | 18 - sapi/roxen/TODO | 33 - sapi/roxen/config.m4 | 60 - sapi/roxen/roxen.c | 725 -- sapi/servlet/CREDITS | 2 - sapi/servlet/EXPERIMENTAL | 5 - sapi/servlet/Makefile.frag | 19 - sapi/servlet/README | 113 - sapi/servlet/config.m4 | 54 - sapi/servlet/cookies.php | 41 - sapi/servlet/date.php | 28 - sapi/servlet/formatter.java | 31 - sapi/servlet/jinfo.php | 5 - sapi/servlet/jver.php | 17 - sapi/servlet/reqheaders.php | 24 - sapi/servlet/reqinfo.php | 29 - sapi/servlet/reqparams.php | 35 - sapi/servlet/servlet.c | 397 - sapi/servlet/servlet.dsp | 286 - sapi/servlet/servlet.java | 221 - sapi/servlet/sessions.php | 60 - sapi/servlet/web.xml | 40 - sapi/tests/test001.phpt | 17 - sapi/tests/test002.phpt | 23 - sapi/tests/test003.phpt | 22 - sapi/tests/test004.phpt | 27 - sapi/tests/test005.phpt | 28 - sapi/tests/test006.phpt | 75 - sapi/tests/test007.phpt | 48 - sapi/thttpd/CREDITS | 2 - sapi/thttpd/README | 85 - sapi/thttpd/config.m4 | 39 - sapi/thttpd/php.sym | 3 - sapi/thttpd/php_thttpd.h | 35 - sapi/thttpd/stub.c | 0 sapi/thttpd/thttpd.c | 745 -- sapi/thttpd/thttpd_patch | 2332 ---- sapi/tux/CREDITS | 2 - sapi/tux/README | 86 - sapi/tux/config.m4 | 18 - sapi/tux/php.sym | 2 - sapi/tux/php_tux.c | 453 - sapi/webjames/CREDITS | 2 - sapi/webjames/README | 28 - sapi/webjames/config.m4 | 20 - sapi/webjames/php_webjames.h | 28 - sapi/webjames/webjames.c | 305 - scan_makefile_in.awk | 32 - scripts/Makefile.frag | 66 - scripts/apache/apconf-conv.sh | 24 - scripts/apache/aphtaccess-conv.sh | 24 - scripts/apache/conffix.awk | 23 - scripts/apache/htaccessfix.awk | 23 - scripts/dev/conv_proto | 30 - scripts/dev/conv_z_macros | 61 - scripts/dev/credits | 26 - scripts/ext_skel_ng/README | 36 - scripts/ext_skel_ng/TODO | 19 - scripts/ext_skel_ng/config_m4.php | 28 - scripts/ext_skel_ng/dummy.gif | Bin 377 -> 0 bytes scripts/ext_skel_ng/ext_skel_ng.php | 60 - scripts/ext_skel_ng/extension.dtd | 105 - scripts/ext_skel_ng/extension.xml | 174 - scripts/ext_skel_ng/extension_parser.php | 1160 -- scripts/ext_skel_ng/license.php | 42 - scripts/ext_skel_ng/license_bsd.php | 70 - scripts/ext_skel_ng/license_lgpl.php | 540 - scripts/ext_skel_ng/license_php.php | 93 - scripts/ext_skel_ng/php_constant.php | 83 - scripts/ext_skel_ng/php_element.php | 77 - scripts/ext_skel_ng/php_function.php | 346 - scripts/ext_skel_ng/php_global.php | 80 - scripts/ext_skel_ng/php_ini.php | 117 - scripts/ext_skel_ng/php_logo.php | 52 - scripts/ext_skel_ng/php_resource.php | 75 - scripts/ext_skel_ng/xml_stream_callback_parser.php | 36 - scripts/ext_skel_ng/xml_stream_parser.php | 54 - scripts/php-config.in | 32 - scripts/phpextdist | 27 - scripts/phpize.in | 56 - scripts/phpize.m4 | 123 - snapshot | 7 - stamp-h.in | 1 - strtok_r.c | 113 - stub.c | 1 - tests/basic/001.phpt | 8 - tests/basic/002.phpt | 12 - tests/basic/003.phpt | 14 - tests/basic/004.phpt | 13 - tests/basic/005.phpt | 13 - tests/basic/006.phpt | 8 - tests/basic/007.phpt | 8 - tests/basic/008.phpt | 8 - tests/basic/009.phpt | 8 - tests/basic/010.phpt | 8 - tests/basic/011.phpt | 27 - tests/basic/012.phpt | 27 - tests/basic/bug20539.phpt | 10 - tests/bin-info.inc | 21 - tests/classes/__call_001.phpt | 42 - tests/classes/__clone_001.phpt | 40 - tests/classes/__set__get_001.phpt | 72 - tests/classes/abstract.phpt | 30 - tests/classes/abstract_class.phpt | 29 - tests/classes/abstract_final.phpt | 16 - tests/classes/abstract_inherit.phpt | 22 - tests/classes/abstract_not_declared.phpt | 15 - tests/classes/abstract_redeclare.phpt | 22 - tests/classes/abstract_static.phpt | 26 - tests/classes/bug20120.phpt | 26 - tests/classes/class_example.phpt | 87 - tests/classes/constants_scope_001.phpt | 25 - tests/classes/ctor_dtor.phpt | 48 - tests/classes/ctor_dtor_inheritance.phpt | 99 - tests/classes/dereferencing_001.phpt | 35 - tests/classes/factory_001.phpt | 35 - tests/classes/final.phpt | 31 - tests/classes/final_abstract.phpt | 16 - tests/classes/final_redeclare.phpt | 28 - tests/classes/inheritance.phpt | 58 - tests/classes/inheritance_002.phpt | 87 - tests/classes/interface_class.phpt | 14 - tests/classes/interface_doubled.phpt | 199 - tests/classes/interface_implemented.phpt | 103 - tests/classes/interface_instantiate.phpt | 16 - tests/classes/interface_member.phpt | 13 - tests/classes/interface_method.phpt | 15 - tests/classes/interface_method_final.phpt | 15 - tests/classes/interface_method_private.phpt | 15 - tests/classes/interface_must_be_implemented.phpt | 17 - tests/classes/interfaces_001.phpt | 26 - tests/classes/interfaces_002.phpt | 29 - tests/classes/object_reference_001.phpt | 27 - tests/classes/private_001.phpt | 26 - tests/classes/private_002.phpt | 35 - tests/classes/private_003.phpt | 36 - tests/classes/private_003b.phpt | 37 - tests/classes/private_004.phpt | 32 - tests/classes/private_004b.phpt | 35 - tests/classes/private_005.phpt | 32 - tests/classes/private_005b.phpt | 35 - tests/classes/private_006.phpt | 41 - tests/classes/private_006b.phpt | 41 - tests/classes/private_007.phpt | 30 - tests/classes/private_007b.phpt | 31 - tests/classes/protected_001.phpt | 26 - tests/classes/protected_001b.phpt | 27 - tests/classes/protected_002.phpt | 35 - tests/classes/singleton_001.phpt | 37 - tests/classes/static_mix_1.phpt | 26 - tests/classes/static_mix_2.phpt | 27 - tests/classes/type_hinting_001.phpt | 38 - tests/classes/visibility_000a.phpt | 33 - tests/classes/visibility_000b.phpt | 33 - tests/classes/visibility_000c.phpt | 33 - tests/classes/visibility_001a.phpt | 33 - tests/classes/visibility_001b.phpt | 33 - tests/classes/visibility_001c.phpt | 33 - tests/classes/visibility_002a.phpt | 33 - tests/classes/visibility_002b.phpt | 33 - tests/classes/visibility_002c.phpt | 33 - tests/classes/visibility_003a.phpt | 33 - tests/classes/visibility_003b.phpt | 33 - tests/classes/visibility_003c.phpt | 33 - tests/classes/visibility_004a.phpt | 33 - tests/classes/visibility_004b.phpt | 33 - tests/classes/visibility_004c.phpt | 33 - tests/foo | 5 - tests/foo2 | 3 - tests/foo3 | 43 - tests/foo4 | 41 - tests/func/001.phpt | 6 - tests/func/002.phpt | 22 - tests/func/003.phpt | 289 - tests/func/004.phpt | 65 - tests/func/005.phpt | 19 - tests/func/005a.phpt | 28 - tests/func/006.phpt | 26 - tests/func/007.phpt | 22 - tests/func/008.phpt | 16 - tests/func/009.phpt | 16 - tests/lang/001.phpt | 8 - tests/lang/002.phpt | 14 - tests/lang/003.phpt | 21 - tests/lang/004.phpt | 15 - tests/lang/005.phpt | 18 - tests/lang/006.phpt | 25 - tests/lang/007.phpt | 29 - tests/lang/008.phpt | 20 - tests/lang/009.phpt | 13 - tests/lang/010.phpt | 15 - tests/lang/011.phpt | 25 - tests/lang/012.phpt | 20 - tests/lang/013.phpt | 12 - tests/lang/014.phpt | 15 - tests/lang/015.inc | 3 - tests/lang/015.phpt | 10 - tests/lang/016.inc | 5 - tests/lang/016.phpt | 11 - tests/lang/017.phpt | 20 - tests/lang/018.phpt | 36 - tests/lang/019.phpt | 38 - tests/lang/020.phpt | 78 - tests/lang/021.phpt | 44 - tests/lang/022.phpt | 65 - tests/lang/023-1.inc | 356 - tests/lang/023-2.inc | 6 - tests/lang/023.phpt | 256 - tests/lang/024.phpt | 11625 ------------------ tests/lang/025.phpt | 533 - tests/lang/026.phpt | 8 - tests/lang/027.phpt | 14 - tests/lang/028.phpt | 1060 -- tests/lang/030.phpt | 38 - tests/lang/031.phpt | 72 - tests/lang/032.phpt | 38 - tests/lang/033.phpt | 53 - tests/lang/034.phpt | 20 - tests/lang/035.phpt | 38 - tests/lang/bison1.phpt | 9 - tests/lang/bug19566.phpt | 10 - tests/lang/bug19943.phpt | 29 - tests/lang/bug20175.phpt | 165 - tests/lang/bug21094.phpt | 17 - tests/lang/bug21600.phpt | 34 - tests/lang/bug21800.phpt | 18 - tests/lang/bug21820.phpt | 13 - tests/lang/bug21849.phpt | 16 - tests/lang/bug21961.phpt | 58 - tests/lang/bug22231.phpt | 39 - tests/lang/bug22367.phpt | 118 - tests/lang/bug22510.phpt | 115 - tests/lang/bug22592.phpt | 53 - tests/lang/bug23489.phpt | 23 - tests/lang/bug23584.phpt | 13 - tests/lang/bug7515.phpt | 36 - tests/lang/error_2_exception_001.phpt | 45 - tests/lang/namespace_001.phpt | 31 - tests/lang/type_hints_001.phpt | 26 - tests/odbc-display.php | 19 - tests/odbc-t1.php | 38 - tests/odbc-t2.php | 82 - tests/odbc-t3.php | 95 - tests/odbc-t4.php | 91 - tests/odbc-t5.php | 137 - tests/quicktester.inc | 75 - tests/recurse | 21 - tests/run-test/test001.phpt | 6 - tests/run-test/test002.phpt | 18 - tests/run-test/test003.phpt | 6 - tests/run-test/test004.phpt | 10 - tests/run-test/test005.phpt | 32 - tests/run-test/test006.phpt | 9 - tests/run-test/test007.phpt | Bin 1191 -> 0 bytes tests/run-test/test008.phpt | 33 - tests/run-test/test008a.phpt | 32 - tests/run.html | 11 - tests/run.php | 17 - tests/scan_cases | 28 - tests/strings/001.phpt | 209 - tests/strings/002.phpt | 85 - tests/strings/004.phpt | 24 - tests/test.php4 | 15 - tests/test.pl | 34 - tests/test_class_inheritance | 29 - tests/testarray | 21 - tests/testarray.pl | 5 - tests/testarray2 | 5 - tests/testarray2.pl | 3 - tests/testclassfunc | 9 - tests/testcom | 11 - tests/testcpdf | 97 - tests/testcpdfclock | 87 - tests/testdom | 73 - tests/testfe | 18 - tests/testfunc | 33 - tests/testfunc.pl | 20 - tests/testfunc2 | 19 - tests/testfunc2.pl | 22 - tests/testfuncref | 10 - tests/testhyperwave | 235 - tests/testinclude | 5 - tests/testobj | 29 - tests/testpfpro.php | 39 - tests/tests.dsp | 61 - tests/tests.mak | 27 - tests/testscanf.php | 113 - tests/testswf | 120 - win32/crypt_win32.c | 355 - win32/crypt_win32.h | 60 - win32/flock.c | 83 - win32/flock.h | 11 - win32/glob.c | 922 -- win32/glob.h | 101 - win32/grp.h | 26 - win32/install.txt | 792 -- win32/installer/README | 93 - win32/installer/gen-nsis.php | 446 - win32/installer/setini.php | 87 - win32/md5crypt.c | 163 - win32/md5crypt.h | 37 - win32/param.h | 16 - win32/php4.dsp | 134 - win32/php4.dsw | 119 - win32/php4dll.dsp | 1813 --- win32/php4dllts.dsp | 2299 ---- win32/php4dllts.rc | 126 - win32/php4dllts.rc2 | 61 - win32/php4ts.dsp | 187 - win32/php4ts.rc | 126 - win32/php4ts.rc2 | 61 - win32/php4ts_cli.dsp | 175 - win32/php4ts_cli.rc | 126 - win32/php4ts_cli.rc2 | 61 - win32/php5ts.dsw | 239 - win32/php_modules.dsw | 569 - win32/php_registry.h | 7 - win32/pwd.c | 64 - win32/pwd.h | 38 - win32/pws-php4cgi.reg | 6 - win32/pws-php4isapi.reg | 5 - win32/readdir.c | 143 - win32/readdir.h | 43 - win32/registry.c | 88 - win32/resource.h | 15 - win32/select.c | 181 - win32/select.h | 22 - win32/sendmail.c | 927 -- win32/sendmail.h | 61 - win32/signal.h | 16 - win32/syslog.h | 78 - win32/testsuite.dsp | 150 - win32/time.c | 242 - win32/time.h | 43 - win32/unistd.h | 4 - win32/wfile.c | 17 - win32/wfile.h | 16 - win32/winutil.c | 31 - win32/winutil.h | 21 - win32/wsyslog.c | 122 - 2754 files changed, 833021 deletions(-) delete mode 100644 .gdbinit delete mode 100644 CODING_STANDARDS delete mode 100644 CREDITS delete mode 100644 ChangeLog delete mode 100644 ChangeLog.1999.gz delete mode 100644 ChangeLog.2000.gz delete mode 100644 ChangeLog.2001.gz delete mode 100644 ChangeLog.2002.gz delete mode 100644 EXTENSIONS delete mode 100644 INSTALL delete mode 100644 LICENSE delete mode 100644 Makefile.frag delete mode 100644 Makefile.global delete mode 100644 NEWS delete mode 100644 README.CVS-RULES delete mode 100644 README.EXTENSIONS delete mode 100644 README.EXT_SKEL delete mode 100644 README.PARAMETER_PARSING_API delete mode 100644 README.QNX delete mode 100644 README.SELF-CONTAINED-EXTENSIONS delete mode 100644 README.STREAMS delete mode 100644 README.SUBMITTING_PATCH delete mode 100644 README.TESTING delete mode 100644 README.TESTING2 delete mode 100644 README.UNIX-BUILD-SYSTEM delete mode 100644 README.Zeus delete mode 100644 README.input_filter delete mode 100644 TODO delete mode 100644 TODO-PHP5 delete mode 100644 TODO.BUILDv5 delete mode 100644 TSRM/LICENSE delete mode 100644 TSRM/Makefile.am delete mode 100644 TSRM/TODO delete mode 100644 TSRM/TSRM.c delete mode 100644 TSRM/TSRM.dsp delete mode 100644 TSRM/TSRM.h delete mode 100644 TSRM/acconfig.h delete mode 100644 TSRM/acinclude.m4 delete mode 100644 TSRM/build.mk delete mode 100755 TSRM/buildconf delete mode 100644 TSRM/configure.in delete mode 100644 TSRM/readdir.h delete mode 100644 TSRM/threads.m4 delete mode 100644 TSRM/tsrm.m4 delete mode 100644 TSRM/tsrm_config.nw.h delete mode 100644 TSRM/tsrm_config.w32.h delete mode 100644 TSRM/tsrm_config_common.h delete mode 100644 TSRM/tsrm_nw.c delete mode 100644 TSRM/tsrm_nw.h delete mode 100644 TSRM/tsrm_strtok_r.c delete mode 100644 TSRM/tsrm_strtok_r.h delete mode 100644 TSRM/tsrm_virtual_cwd.c delete mode 100644 TSRM/tsrm_virtual_cwd.h delete mode 100644 TSRM/tsrm_win32.c delete mode 100644 TSRM/tsrm_win32.h delete mode 100644 Zend/ChangeLog delete mode 100644 Zend/FlexLexer.h delete mode 100644 Zend/LICENSE delete mode 100644 Zend/Makefile.am delete mode 100644 Zend/OBJECTS2_HOWTO delete mode 100644 Zend/RFCs/001.txt delete mode 100644 Zend/RFCs/002.txt delete mode 100644 Zend/RFCs/003.txt delete mode 100644 Zend/RFCs/004.txt delete mode 100644 Zend/ZEND_CHANGES delete mode 100644 Zend/Zend.dsp delete mode 100644 Zend/Zend.m4 delete mode 100644 Zend/ZendCore.dep delete mode 100644 Zend/ZendTS.dsp delete mode 100644 Zend/acconfig.h delete mode 100644 Zend/acinclude.m4 delete mode 100644 Zend/build.mk delete mode 100755 Zend/buildconf delete mode 100644 Zend/configure.in delete mode 100644 Zend/flex.skl delete mode 100644 Zend/tests/zend2.php delete mode 100644 Zend/zend.c delete mode 100644 Zend/zend.h delete mode 100644 Zend/zend.ico delete mode 100644 Zend/zend_API.c delete mode 100644 Zend/zend_API.h delete mode 100644 Zend/zend_alloc.c delete mode 100644 Zend/zend_alloc.h delete mode 100644 Zend/zend_builtin_functions.c delete mode 100644 Zend/zend_builtin_functions.h delete mode 100644 Zend/zend_compile.c delete mode 100644 Zend/zend_compile.h delete mode 100644 Zend/zend_config.nw.h delete mode 100644 Zend/zend_config.w32.h delete mode 100644 Zend/zend_constants.c delete mode 100644 Zend/zend_constants.h delete mode 100644 Zend/zend_default_classes.c delete mode 100644 Zend/zend_default_classes.h delete mode 100644 Zend/zend_dynamic_array.c delete mode 100644 Zend/zend_dynamic_array.h delete mode 100644 Zend/zend_errors.h delete mode 100644 Zend/zend_exceptions.c delete mode 100644 Zend/zend_exceptions.h delete mode 100644 Zend/zend_execute.c delete mode 100644 Zend/zend_execute.h delete mode 100644 Zend/zend_execute_API.c delete mode 100644 Zend/zend_execute_locks.h delete mode 100644 Zend/zend_extensions.c delete mode 100644 Zend/zend_extensions.h delete mode 100644 Zend/zend_fast_cache.h delete mode 100644 Zend/zend_globals.h delete mode 100644 Zend/zend_globals_macros.h delete mode 100644 Zend/zend_hash.c delete mode 100644 Zend/zend_hash.h delete mode 100644 Zend/zend_highlight.c delete mode 100644 Zend/zend_highlight.h delete mode 100644 Zend/zend_indent.c delete mode 100644 Zend/zend_indent.h delete mode 100644 Zend/zend_ini.c delete mode 100644 Zend/zend_ini.h delete mode 100644 Zend/zend_ini_parser.y delete mode 100644 Zend/zend_ini_scanner.h delete mode 100644 Zend/zend_ini_scanner.l delete mode 100644 Zend/zend_istdiostream.h delete mode 100644 Zend/zend_language_parser.y delete mode 100644 Zend/zend_language_scanner.h delete mode 100644 Zend/zend_language_scanner.l delete mode 100644 Zend/zend_list.c delete mode 100644 Zend/zend_list.h delete mode 100644 Zend/zend_llist.c delete mode 100644 Zend/zend_llist.h delete mode 100644 Zend/zend_mm.c delete mode 100644 Zend/zend_mm.h delete mode 100644 Zend/zend_modules.h delete mode 100644 Zend/zend_multibyte.c delete mode 100644 Zend/zend_multiply.h delete mode 100644 Zend/zend_object_handlers.c delete mode 100644 Zend/zend_object_handlers.h delete mode 100644 Zend/zend_objects.c delete mode 100644 Zend/zend_objects.h delete mode 100644 Zend/zend_objects_API.c delete mode 100644 Zend/zend_objects_API.h delete mode 100644 Zend/zend_opcode.c delete mode 100644 Zend/zend_operators.c delete mode 100644 Zend/zend_operators.h delete mode 100644 Zend/zend_ptr_stack.c delete mode 100644 Zend/zend_ptr_stack.h delete mode 100644 Zend/zend_qsort.c delete mode 100644 Zend/zend_qsort.h delete mode 100644 Zend/zend_sprintf.c delete mode 100644 Zend/zend_stack.c delete mode 100644 Zend/zend_stack.h delete mode 100644 Zend/zend_static_allocator.c delete mode 100644 Zend/zend_static_allocator.h delete mode 100644 Zend/zend_stream.c delete mode 100644 Zend/zend_stream.h delete mode 100644 Zend/zend_ts_hash.c delete mode 100644 Zend/zend_ts_hash.h delete mode 100644 Zend/zend_types.h delete mode 100644 Zend/zend_variables.c delete mode 100644 Zend/zend_variables.h delete mode 100644 acconfig.h.in delete mode 100644 acinclude.m4 delete mode 100644 build/build.mk delete mode 100644 build/build2.mk delete mode 100755 build/buildcheck.sh delete mode 100755 build/config-stubs delete mode 100644 build/genif.sh delete mode 100644 build/mkdep.awk delete mode 100644 build/print_include.awk delete mode 100755 build/shtool delete mode 100755 buildconf delete mode 100644 bundle/expat/Changes delete mode 100644 bundle/expat/README delete mode 100644 bundle/expat/README.php delete mode 100644 bundle/expat/ascii.h delete mode 100644 bundle/expat/asciitab.h delete mode 100644 bundle/expat/config.m4 delete mode 100644 bundle/expat/expat.h delete mode 100644 bundle/expat/iasciitab.h delete mode 100644 bundle/expat/internal.h delete mode 100644 bundle/expat/latin1tab.h delete mode 100644 bundle/expat/nametab.h delete mode 100644 bundle/expat/utf8tab.h delete mode 100644 bundle/expat/winconfig.h delete mode 100644 bundle/expat/xmlparse.c delete mode 100644 bundle/expat/xmlrole.c delete mode 100644 bundle/expat/xmlrole.h delete mode 100644 bundle/expat/xmltok.c delete mode 100644 bundle/expat/xmltok.h delete mode 100644 bundle/expat/xmltok_impl.c delete mode 100644 bundle/expat/xmltok_impl.h delete mode 100644 bundle/expat/xmltok_ns.c delete mode 100644 bundle/libxml/DOCBparser.c delete mode 100644 bundle/libxml/HTMLparser.c delete mode 100644 bundle/libxml/HTMLtree.c delete mode 100644 bundle/libxml/SAX.c delete mode 100644 bundle/libxml/c14n.c delete mode 100644 bundle/libxml/catalog.c delete mode 100644 bundle/libxml/config.m4 delete mode 100644 bundle/libxml/debugXML.c delete mode 100644 bundle/libxml/encoding.c delete mode 100644 bundle/libxml/entities.c delete mode 100644 bundle/libxml/error.c delete mode 100644 bundle/libxml/globals.c delete mode 100644 bundle/libxml/hash.c delete mode 100644 bundle/libxml/include/libxml/DOCBparser.h delete mode 100644 bundle/libxml/include/libxml/HTMLparser.h delete mode 100644 bundle/libxml/include/libxml/HTMLtree.h delete mode 100644 bundle/libxml/include/libxml/Makefile.am delete mode 100644 bundle/libxml/include/libxml/Makefile.in delete mode 100644 bundle/libxml/include/libxml/SAX.h delete mode 100644 bundle/libxml/include/libxml/c14n.h delete mode 100644 bundle/libxml/include/libxml/catalog.h delete mode 100644 bundle/libxml/include/libxml/debugXML.h delete mode 100644 bundle/libxml/include/libxml/encoding.h delete mode 100644 bundle/libxml/include/libxml/entities.h delete mode 100644 bundle/libxml/include/libxml/globals.h delete mode 100644 bundle/libxml/include/libxml/hash.h delete mode 100644 bundle/libxml/include/libxml/list.h delete mode 100644 bundle/libxml/include/libxml/nanoftp.h delete mode 100644 bundle/libxml/include/libxml/nanohttp.h delete mode 100644 bundle/libxml/include/libxml/parser.h delete mode 100644 bundle/libxml/include/libxml/parserInternals.h delete mode 100644 bundle/libxml/include/libxml/schemasInternals.h delete mode 100644 bundle/libxml/include/libxml/threads.h delete mode 100644 bundle/libxml/include/libxml/tree.h delete mode 100644 bundle/libxml/include/libxml/uri.h delete mode 100644 bundle/libxml/include/libxml/valid.h delete mode 100644 bundle/libxml/include/libxml/xinclude.h delete mode 100644 bundle/libxml/include/libxml/xlink.h delete mode 100644 bundle/libxml/include/libxml/xmlIO.h delete mode 100644 bundle/libxml/include/libxml/xmlautomata.h delete mode 100644 bundle/libxml/include/libxml/xmlerror.h delete mode 100644 bundle/libxml/include/libxml/xmlmemory.h delete mode 100644 bundle/libxml/include/libxml/xmlreader.h delete mode 100644 bundle/libxml/include/libxml/xmlregexp.h delete mode 100644 bundle/libxml/include/libxml/xmlschemas.h delete mode 100644 bundle/libxml/include/libxml/xmlschemastypes.h delete mode 100644 bundle/libxml/include/libxml/xmlunicode.h delete mode 100644 bundle/libxml/include/libxml/xmlversion.h delete mode 100644 bundle/libxml/include/libxml/xmlversion.h.in delete mode 100644 bundle/libxml/include/libxml/xpath.h delete mode 100644 bundle/libxml/include/libxml/xpathInternals.h delete mode 100644 bundle/libxml/include/libxml/xpointer.h delete mode 100644 bundle/libxml/include/win32config.h delete mode 100644 bundle/libxml/include/wsockcompat.h delete mode 100644 bundle/libxml/libxml.h delete mode 100644 bundle/libxml/list.c delete mode 100644 bundle/libxml/nanoftp.c delete mode 100644 bundle/libxml/nanohttp.c delete mode 100644 bundle/libxml/parser.c delete mode 100644 bundle/libxml/parserInternals.c delete mode 100644 bundle/libxml/stamp-h.in delete mode 100644 bundle/libxml/threads.c delete mode 100644 bundle/libxml/tree.c delete mode 100644 bundle/libxml/trio.c delete mode 100644 bundle/libxml/trio.h delete mode 100644 bundle/libxml/triodef.h delete mode 100644 bundle/libxml/trionan.c delete mode 100644 bundle/libxml/trionan.h delete mode 100644 bundle/libxml/triop.h delete mode 100644 bundle/libxml/triostr.c delete mode 100644 bundle/libxml/triostr.h delete mode 100644 bundle/libxml/uri.c delete mode 100644 bundle/libxml/valid.c delete mode 100644 bundle/libxml/xinclude.c delete mode 100644 bundle/libxml/xlink.c delete mode 100644 bundle/libxml/xmlIO.c delete mode 100644 bundle/libxml/xmlmemory.c delete mode 100644 bundle/libxml/xmlreader.c delete mode 100644 bundle/libxml/xmlregexp.c delete mode 100644 bundle/libxml/xmlschemas.c delete mode 100644 bundle/libxml/xmlschemastypes.c delete mode 100644 bundle/libxml/xmlunicode.c delete mode 100644 bundle/libxml/xpath.c delete mode 100644 bundle/libxml/xpointer.c delete mode 100644 config.guess delete mode 100644 config.sub delete mode 100644 configure.in delete mode 100755 cvsclean delete mode 100644 ext/bcmath/CREDITS delete mode 100644 ext/bcmath/bcmath.c delete mode 100644 ext/bcmath/config.m4 delete mode 100644 ext/bcmath/libbcmath/AUTHORS delete mode 100644 ext/bcmath/libbcmath/COPYING.LIB delete mode 100644 ext/bcmath/libbcmath/ChangeLog delete mode 100644 ext/bcmath/libbcmath/FAQ delete mode 100644 ext/bcmath/libbcmath/INSTALL delete mode 100644 ext/bcmath/libbcmath/Makefile.am delete mode 100644 ext/bcmath/libbcmath/NEWS delete mode 100644 ext/bcmath/libbcmath/README delete mode 100644 ext/bcmath/libbcmath/acconfig.h delete mode 100644 ext/bcmath/libbcmath/aclocal.m4 delete mode 100644 ext/bcmath/libbcmath/config.h.in delete mode 100644 ext/bcmath/libbcmath/configure delete mode 100644 ext/bcmath/libbcmath/configure.in delete mode 100644 ext/bcmath/libbcmath/install-sh delete mode 100644 ext/bcmath/libbcmath/missing delete mode 100644 ext/bcmath/libbcmath/mkinstalldirs delete mode 100644 ext/bcmath/libbcmath/src/Makefile.am delete mode 100644 ext/bcmath/libbcmath/src/add.c delete mode 100644 ext/bcmath/libbcmath/src/bcmath.h delete mode 100644 ext/bcmath/libbcmath/src/compare.c delete mode 100644 ext/bcmath/libbcmath/src/config.h delete mode 100644 ext/bcmath/libbcmath/src/debug.c delete mode 100644 ext/bcmath/libbcmath/src/div.c delete mode 100644 ext/bcmath/libbcmath/src/divmod.c delete mode 100644 ext/bcmath/libbcmath/src/doaddsub.c delete mode 100644 ext/bcmath/libbcmath/src/init.c delete mode 100644 ext/bcmath/libbcmath/src/int2num.c delete mode 100644 ext/bcmath/libbcmath/src/nearzero.c delete mode 100644 ext/bcmath/libbcmath/src/neg.c delete mode 100644 ext/bcmath/libbcmath/src/num2long.c delete mode 100644 ext/bcmath/libbcmath/src/num2str.c delete mode 100644 ext/bcmath/libbcmath/src/outofmem.c delete mode 100644 ext/bcmath/libbcmath/src/output.c delete mode 100644 ext/bcmath/libbcmath/src/private.h delete mode 100644 ext/bcmath/libbcmath/src/raise.c delete mode 100644 ext/bcmath/libbcmath/src/raisemod.c delete mode 100644 ext/bcmath/libbcmath/src/recmul.c delete mode 100644 ext/bcmath/libbcmath/src/rmzero.c delete mode 100644 ext/bcmath/libbcmath/src/rt.c delete mode 100644 ext/bcmath/libbcmath/src/sqrt.c delete mode 100644 ext/bcmath/libbcmath/src/str2num.c delete mode 100644 ext/bcmath/libbcmath/src/sub.c delete mode 100644 ext/bcmath/libbcmath/src/zero.c delete mode 100644 ext/bcmath/php_bcmath.h delete mode 100644 ext/bcmath/tests/bcadd.phpt delete mode 100644 ext/bcmath/tests/bccomp.phpt delete mode 100644 ext/bcmath/tests/bcdiv.phpt delete mode 100644 ext/bcmath/tests/bcmod.phpt delete mode 100644 ext/bcmath/tests/bcmul.phpt delete mode 100644 ext/bcmath/tests/bcpow.phpt delete mode 100644 ext/bcmath/tests/bcscale.phpt delete mode 100644 ext/bcmath/tests/bcsqrt.phpt delete mode 100644 ext/bcmath/tests/bcsub.phpt delete mode 100644 ext/calendar/CREDITS delete mode 100644 ext/calendar/cal_unix.c delete mode 100644 ext/calendar/calendar.c delete mode 100644 ext/calendar/config.m4 delete mode 100644 ext/calendar/dow.c delete mode 100644 ext/calendar/easter.c delete mode 100644 ext/calendar/french.c delete mode 100644 ext/calendar/gregor.c delete mode 100644 ext/calendar/jewish.c delete mode 100644 ext/calendar/julian.c delete mode 100644 ext/calendar/php_calendar.h delete mode 100644 ext/calendar/sdncal.h delete mode 100644 ext/calendar/tests/jdtojewish.phpt delete mode 100644 ext/cpdf/CREDITS delete mode 100644 ext/cpdf/config.m4 delete mode 100644 ext/cpdf/cpdf.c delete mode 100644 ext/cpdf/cpdf.dsp delete mode 100644 ext/cpdf/php_cpdf.h delete mode 100644 ext/crack/CREDITS delete mode 100644 ext/crack/EXPERIMENTAL delete mode 100644 ext/crack/config.m4 delete mode 100644 ext/crack/crack.c delete mode 100644 ext/crack/crack.dsp delete mode 100644 ext/crack/php_crack.h delete mode 100644 ext/crack/tests/001.phpt delete mode 100644 ext/ctype/CREDITS delete mode 100644 ext/ctype/README delete mode 100644 ext/ctype/config.m4 delete mode 100644 ext/ctype/ctype.c delete mode 100644 ext/ctype/ctype.dsp delete mode 100644 ext/ctype/ctype.xml delete mode 100644 ext/ctype/php_ctype.h delete mode 100644 ext/ctype/tests/001.phpt delete mode 100644 ext/ctype/tests/002.phpt delete mode 100644 ext/curl/CREDITS delete mode 100644 ext/curl/config.m4 delete mode 100644 ext/curl/curl.dsp delete mode 100644 ext/curl/interface.c delete mode 100644 ext/curl/multi.c delete mode 100644 ext/curl/php_curl.h delete mode 100644 ext/curl/streams.c delete mode 100644 ext/cyrus/CREDITS delete mode 100644 ext/cyrus/config.m4 delete mode 100644 ext/cyrus/cyrus.c delete mode 100644 ext/cyrus/php_cyrus.h delete mode 100644 ext/db/CREDITS delete mode 100644 ext/db/config.m4 delete mode 100644 ext/db/db.c delete mode 100644 ext/db/db.dsp delete mode 100644 ext/db/php_db.h delete mode 100644 ext/db/tests/001.phpt delete mode 100644 ext/db/tests/002.phpt delete mode 100644 ext/db/tests/003.phpt delete mode 100644 ext/db/tests/004.phpt delete mode 100644 ext/db/tests/005.phpt delete mode 100644 ext/db/tests/006.phpt delete mode 100644 ext/db/tests/test.inc delete mode 100644 ext/dba/CREDITS delete mode 100644 ext/dba/config.m4 delete mode 100644 ext/dba/dba.c delete mode 100644 ext/dba/dba.dsp delete mode 100644 ext/dba/dba_cdb.c delete mode 100644 ext/dba/dba_db2.c delete mode 100644 ext/dba/dba_db3.c delete mode 100644 ext/dba/dba_db4.c delete mode 100644 ext/dba/dba_dbm.c delete mode 100644 ext/dba/dba_flatfile.c delete mode 100644 ext/dba/dba_gdbm.c delete mode 100644 ext/dba/dba_inifile.c delete mode 100644 ext/dba/dba_ndbm.c delete mode 100755 ext/dba/install_cdb.sh delete mode 100644 ext/dba/libcdb/cdb.c delete mode 100644 ext/dba/libcdb/cdb.h delete mode 100644 ext/dba/libcdb/cdb_make.c delete mode 100644 ext/dba/libcdb/cdb_make.h delete mode 100644 ext/dba/libcdb/uint32.c delete mode 100644 ext/dba/libcdb/uint32.h delete mode 100644 ext/dba/libflatfile/flatfile.c delete mode 100644 ext/dba/libflatfile/flatfile.h delete mode 100644 ext/dba/libinifile/inifile.c delete mode 100644 ext/dba/libinifile/inifile.h delete mode 100644 ext/dba/php_cdb.h delete mode 100644 ext/dba/php_db2.h delete mode 100644 ext/dba/php_db3.h delete mode 100644 ext/dba/php_db4.h delete mode 100644 ext/dba/php_dba.h delete mode 100644 ext/dba/php_dbm.h delete mode 100644 ext/dba/php_flatfile.h delete mode 100644 ext/dba/php_gdbm.h delete mode 100644 ext/dba/php_inifile.h delete mode 100644 ext/dba/php_ndbm.h delete mode 100644 ext/dba/tests/dba001.phpt delete mode 100644 ext/dba/tests/dba002.phpt delete mode 100644 ext/dba/tests/dba003.phpt delete mode 100644 ext/dba/tests/dba004.phpt delete mode 100644 ext/dba/tests/dba005.phpt delete mode 100644 ext/dba/tests/dba006.phpt delete mode 100644 ext/dba/tests/dba007.phpt delete mode 100644 ext/dba/tests/dba008.phpt delete mode 100755 ext/dba/tests/dba009.phpt delete mode 100644 ext/dba/tests/dba_cdb.phpt delete mode 100644 ext/dba/tests/dba_cdb_make.phpt delete mode 100644 ext/dba/tests/dba_cdb_read.phpt delete mode 100644 ext/dba/tests/dba_db2.phpt delete mode 100644 ext/dba/tests/dba_db3.phpt delete mode 100644 ext/dba/tests/dba_db4.phpt delete mode 100644 ext/dba/tests/dba_dbm.phpt delete mode 100644 ext/dba/tests/dba_flatfile.phpt delete mode 100644 ext/dba/tests/dba_gdbm.phpt delete mode 100644 ext/dba/tests/dba_handler.inc delete mode 100644 ext/dba/tests/dba_inifile.phpt delete mode 100644 ext/dba/tests/dba_ndbm.phpt delete mode 100644 ext/dba/tests/skipif.inc delete mode 100644 ext/dba/tests/test.cdb delete mode 100644 ext/dba/tests/test.inc delete mode 100644 ext/dbase/CREDITS delete mode 100644 ext/dbase/config.m4 delete mode 100644 ext/dbase/dbase.c delete mode 100644 ext/dbase/dbase.dsp delete mode 100644 ext/dbase/dbf.h delete mode 100644 ext/dbase/dbf_head.c delete mode 100644 ext/dbase/dbf_head.h delete mode 100644 ext/dbase/dbf_misc.c delete mode 100644 ext/dbase/dbf_misc.h delete mode 100644 ext/dbase/dbf_ndx.c delete mode 100644 ext/dbase/dbf_ndx.h delete mode 100644 ext/dbase/dbf_rec.c delete mode 100644 ext/dbase/dbf_rec.h delete mode 100644 ext/dbase/php_dbase.h delete mode 100644 ext/dbx/CREDITS delete mode 100644 ext/dbx/INSTALL delete mode 100644 ext/dbx/config.m4 delete mode 100644 ext/dbx/dbx.c delete mode 100644 ext/dbx/dbx.dsp delete mode 100644 ext/dbx/dbx.h delete mode 100644 ext/dbx/dbx_fbsql.c delete mode 100644 ext/dbx/dbx_fbsql.h delete mode 100644 ext/dbx/dbx_mssql.c delete mode 100644 ext/dbx/dbx_mssql.h delete mode 100644 ext/dbx/dbx_mysql.c delete mode 100644 ext/dbx/dbx_mysql.h delete mode 100644 ext/dbx/dbx_oci8.c delete mode 100644 ext/dbx/dbx_oci8.h delete mode 100644 ext/dbx/dbx_odbc.c delete mode 100644 ext/dbx/dbx_odbc.h delete mode 100644 ext/dbx/dbx_pgsql.c delete mode 100644 ext/dbx/dbx_pgsql.h delete mode 100644 ext/dbx/dbx_sybasect.c delete mode 100644 ext/dbx/dbx_sybasect.h delete mode 100644 ext/dbx/howto_extend_dbx.html delete mode 100644 ext/dbx/php_dbx.h delete mode 100644 ext/dbx/tests/001.phpt delete mode 100644 ext/dbx/tests/002.phpt delete mode 100644 ext/dbx/tests/003.phpt delete mode 100644 ext/dbx/tests/004.phpt delete mode 100644 ext/dbx/tests/005.phpt delete mode 100644 ext/dbx/tests/006.phpt delete mode 100644 ext/dbx/tests/007.phpt delete mode 100644 ext/dbx/tests/008.phpt delete mode 100644 ext/dbx/tests/009.phpt delete mode 100644 ext/dbx/tests/dbx_test.p delete mode 100644 ext/dbx/tests/dbx_test.pgsql.script delete mode 100644 ext/dbx/tests/dbx_test.script delete mode 100644 ext/dbx/tests/skipif.inc delete mode 100644 ext/dio/EXPERIMENTAL delete mode 100644 ext/dio/config.m4 delete mode 100644 ext/dio/dio.c delete mode 100644 ext/dio/php_dio.h delete mode 100644 ext/dio/tests/001.phpt delete mode 100644 ext/domxml/CREDITS delete mode 100644 ext/domxml/EXPERIMENTAL delete mode 100644 ext/domxml/TODO delete mode 100644 ext/domxml/config.m4 delete mode 100644 ext/domxml/domxml.dsp delete mode 100644 ext/domxml/php_domxml.c delete mode 100644 ext/domxml/php_domxml.h delete mode 100644 ext/domxml/tests/domxml001.phpt delete mode 100644 ext/domxml/tests/domxml002.phpt delete mode 100644 ext/domxml/tests/domxml_test.inc delete mode 100644 ext/domxml/tests/skipif.inc delete mode 100644 ext/domxml/tests/xmldoc.phpt delete mode 100644 ext/ereg/ereg.c delete mode 100644 ext/ereg/php_ereg.h delete mode 100644 ext/ereg/php_regex.h delete mode 100644 ext/ereg/regex/COPYRIGHT delete mode 100644 ext/ereg/regex/README delete mode 100644 ext/ereg/regex/WHATSNEW delete mode 100644 ext/ereg/regex/cclass.h delete mode 100644 ext/ereg/regex/cname.h delete mode 100644 ext/ereg/regex/debug.c delete mode 100644 ext/ereg/regex/debug.ih delete mode 100644 ext/ereg/regex/engine.c delete mode 100644 ext/ereg/regex/engine.ih delete mode 100644 ext/ereg/regex/main.c delete mode 100644 ext/ereg/regex/main.ih delete mode 100644 ext/ereg/regex/mkh delete mode 100644 ext/ereg/regex/regcomp.c delete mode 100644 ext/ereg/regex/regcomp.ih delete mode 100644 ext/ereg/regex/regerror.c delete mode 100644 ext/ereg/regex/regerror.ih delete mode 100644 ext/ereg/regex/regex.3 delete mode 100644 ext/ereg/regex/regex.7 delete mode 100644 ext/ereg/regex/regex.dsp delete mode 100644 ext/ereg/regex/regex.dsw delete mode 100644 ext/ereg/regex/regex.h delete mode 100644 ext/ereg/regex/regex.mak delete mode 100644 ext/ereg/regex/regex2.h delete mode 100644 ext/ereg/regex/regex_extra.h delete mode 100644 ext/ereg/regex/regexec.c delete mode 100644 ext/ereg/regex/regfree.c delete mode 100644 ext/ereg/regex/split.c delete mode 100644 ext/ereg/regex/tests delete mode 100644 ext/ereg/regex/utils.h delete mode 100644 ext/ereg/tests/001.phpt delete mode 100644 ext/ereg/tests/002.phpt delete mode 100644 ext/ereg/tests/003.phpt delete mode 100644 ext/ereg/tests/004.phpt delete mode 100644 ext/ereg/tests/005.phpt delete mode 100644 ext/ereg/tests/006.phpt delete mode 100644 ext/ereg/tests/007.phpt delete mode 100644 ext/ereg/tests/008.phpt delete mode 100644 ext/ereg/tests/009.phpt delete mode 100644 ext/ereg/tests/010.phpt delete mode 100644 ext/ereg/tests/011.phpt delete mode 100644 ext/ereg/tests/012.phpt delete mode 100644 ext/ereg/tests/013.phpt delete mode 100644 ext/ereg/tests/014.phpt delete mode 100644 ext/ereg/tests/015.phpt delete mode 100644 ext/ereg/tests/016.phpt delete mode 100644 ext/exif/CREDITS delete mode 100644 ext/exif/config.m4 delete mode 100644 ext/exif/example.php delete mode 100644 ext/exif/exif.c delete mode 100644 ext/exif/exif.dsp delete mode 100644 ext/exif/php_exif.h delete mode 100644 ext/exif/test.php delete mode 100644 ext/exif/test.txt delete mode 100644 ext/exif/tests/exif000.phpt delete mode 100644 ext/exif/tests/exif001.phpt delete mode 100644 ext/exif/tests/exif002.phpt delete mode 100644 ext/exif/tests/exif003.phpt delete mode 100644 ext/exif/tests/exif004.phpt delete mode 100644 ext/exif/tests/exif005.phpt delete mode 100644 ext/exif/tests/exif006.phpt delete mode 100644 ext/exif/tests/test1.jpg delete mode 100644 ext/exif/tests/test2.jpg delete mode 100644 ext/exif/tests/test3.jpg delete mode 100644 ext/exif/tests/test4.jpg delete mode 100644 ext/exif/tests/test5.jpg delete mode 100644 ext/exif/tests/test6.jpg delete mode 100755 ext/ext_skel delete mode 100644 ext/ext_skel_win32.php delete mode 100644 ext/fam/CREDITS delete mode 100644 ext/fam/config.m4 delete mode 100644 ext/fam/fam.c delete mode 100644 ext/fam/php_fam.h delete mode 100644 ext/fbsql/CREDITS delete mode 100644 ext/fbsql/Readme_w32.txt delete mode 100644 ext/fbsql/config.m4 delete mode 100644 ext/fbsql/fbsql.dsp delete mode 100644 ext/fbsql/php_fbsql.c delete mode 100644 ext/fbsql/php_fbsql.h delete mode 100644 ext/fdf/CREDITS delete mode 100644 ext/fdf/config.m4 delete mode 100644 ext/fdf/fdf.c delete mode 100644 ext/fdf/fdf.dsp delete mode 100644 ext/fdf/php_fdf.h delete mode 100644 ext/filepro/CREDITS delete mode 100644 ext/filepro/config.m4 delete mode 100644 ext/filepro/filepro.c delete mode 100644 ext/filepro/filepro.dsp delete mode 100644 ext/filepro/php_filepro.h delete mode 100644 ext/fribidi/tests/001.phpt delete mode 100644 ext/fribidi/tests/002.phpt delete mode 100644 ext/ftp/CREDITS delete mode 100644 ext/ftp/config.m4 delete mode 100644 ext/ftp/ftp.c delete mode 100644 ext/ftp/ftp.h delete mode 100644 ext/ftp/php_ftp.c delete mode 100644 ext/ftp/php_ftp.h delete mode 100644 ext/gd/CREDITS delete mode 100644 ext/gd/config.m4 delete mode 100644 ext/gd/gd.c delete mode 100644 ext/gd/gd.dsp delete mode 100644 ext/gd/gd_ctx.c delete mode 100644 ext/gd/gdcache.c delete mode 100644 ext/gd/gdcache.h delete mode 100644 ext/gd/gdttf.c delete mode 100644 ext/gd/gdttf.h delete mode 100644 ext/gd/libgd/README delete mode 100644 ext/gd/libgd/gd.c delete mode 100644 ext/gd/libgd/gd.h delete mode 100644 ext/gd/libgd/gd2copypal.c delete mode 100644 ext/gd/libgd/gd2time.c delete mode 100644 ext/gd/libgd/gd2topng.c delete mode 100644 ext/gd/libgd/gd_arc_f_buggy.c delete mode 100644 ext/gd/libgd/gd_gd.c delete mode 100644 ext/gd/libgd/gd_gd2.c delete mode 100644 ext/gd/libgd/gd_gif_in.c delete mode 100644 ext/gd/libgd/gd_io.c delete mode 100644 ext/gd/libgd/gd_io.h delete mode 100644 ext/gd/libgd/gd_io_dp.c delete mode 100644 ext/gd/libgd/gd_io_file.c delete mode 100644 ext/gd/libgd/gd_io_ss.c delete mode 100644 ext/gd/libgd/gd_jpeg.c delete mode 100644 ext/gd/libgd/gd_png.c delete mode 100644 ext/gd/libgd/gd_ss.c delete mode 100644 ext/gd/libgd/gd_topal.c delete mode 100644 ext/gd/libgd/gd_wbmp.c delete mode 100644 ext/gd/libgd/gdcache.c delete mode 100644 ext/gd/libgd/gdcache.h delete mode 100644 ext/gd/libgd/gddemo.c delete mode 100644 ext/gd/libgd/gdfontg.c delete mode 100644 ext/gd/libgd/gdfontg.h delete mode 100644 ext/gd/libgd/gdfontl.c delete mode 100644 ext/gd/libgd/gdfontl.h delete mode 100644 ext/gd/libgd/gdfontmb.c delete mode 100644 ext/gd/libgd/gdfontmb.h delete mode 100644 ext/gd/libgd/gdfonts.c delete mode 100644 ext/gd/libgd/gdfonts.h delete mode 100644 ext/gd/libgd/gdfontt.c delete mode 100644 ext/gd/libgd/gdfontt.h delete mode 100644 ext/gd/libgd/gdft.c delete mode 100644 ext/gd/libgd/gdhelpers.c delete mode 100644 ext/gd/libgd/gdhelpers.h delete mode 100644 ext/gd/libgd/gdkanji.c delete mode 100644 ext/gd/libgd/gdparttopng.c delete mode 100644 ext/gd/libgd/gdtables.c delete mode 100644 ext/gd/libgd/gdtest.c delete mode 100644 ext/gd/libgd/gdtestft.c delete mode 100644 ext/gd/libgd/gdtopng.c delete mode 100644 ext/gd/libgd/gdxpm.c delete mode 100644 ext/gd/libgd/jisx0208.h delete mode 100644 ext/gd/libgd/mathmake.c delete mode 100644 ext/gd/libgd/pngtogd.c delete mode 100644 ext/gd/libgd/pngtogd2.c delete mode 100644 ext/gd/libgd/testac.c delete mode 100644 ext/gd/libgd/wbmp.c delete mode 100644 ext/gd/libgd/wbmp.h delete mode 100644 ext/gd/libgd/webpng.c delete mode 100644 ext/gd/libgd/xbm.c delete mode 100644 ext/gd/php_gd.h delete mode 100644 ext/gd/tests/bug19366.phpt delete mode 100644 ext/gd/tests/bug22544.phpt delete mode 100644 ext/gd/tests/conv_test.gif delete mode 100644 ext/gd/tests/conv_test.jpeg delete mode 100644 ext/gd/tests/conv_test.png delete mode 100644 ext/gd/tests/conv_test.xbm delete mode 100644 ext/gd/tests/conv_test.xpm delete mode 100644 ext/gd/tests/gif2gd.phpt delete mode 100644 ext/gd/tests/gif2jpg.phpt delete mode 100644 ext/gd/tests/gif2png.phpt delete mode 100644 ext/gd/tests/imagefilter.phpt delete mode 100644 ext/gd/tests/imagefttext.phpt delete mode 100644 ext/gd/tests/jpeg2png.phpt delete mode 100644 ext/gd/tests/jpg2gd.phpt delete mode 100644 ext/gd/tests/png2gd.phpt delete mode 100644 ext/gd/tests/test.png delete mode 100644 ext/gd/tests/test8859.ttf delete mode 100644 ext/gd/tests/xbm2png.phpt delete mode 100644 ext/gd/tests/xpm2gd.phpt delete mode 100644 ext/gd/tests/xpm2jpg.phpt delete mode 100644 ext/gd/tests/xpm2png.phpt delete mode 100644 ext/gettext/CREDITS delete mode 100644 ext/gettext/config.m4 delete mode 100644 ext/gettext/gettext.c delete mode 100644 ext/gettext/gettext.dsp delete mode 100644 ext/gettext/php_gettext.h delete mode 100644 ext/gmp/CREDITS delete mode 100644 ext/gmp/README delete mode 100644 ext/gmp/TODO delete mode 100644 ext/gmp/config.m4 delete mode 100644 ext/gmp/gmp.c delete mode 100644 ext/gmp/php_gmp.h delete mode 100644 ext/gmp/tests/001.phpt delete mode 100644 ext/gmp/tests/002.phpt delete mode 100644 ext/gmp/tests/003.phpt delete mode 100644 ext/hwapi/CREDITS delete mode 100644 ext/hwapi/config.m4 delete mode 100644 ext/hwapi/hwapi.cpp delete mode 100644 ext/hwapi/php_hwapi.h delete mode 100644 ext/hyperwave/CREDITS delete mode 100644 ext/hyperwave/config.m4 delete mode 100644 ext/hyperwave/debug.h delete mode 100644 ext/hyperwave/hg_comm.c delete mode 100644 ext/hyperwave/hg_comm.h delete mode 100644 ext/hyperwave/hw.c delete mode 100644 ext/hyperwave/hw_error.h delete mode 100644 ext/hyperwave/hyperwave.dsp delete mode 100644 ext/hyperwave/php_hyperwave.h delete mode 100644 ext/iconv/CREDITS delete mode 100644 ext/iconv/config.m4 delete mode 100644 ext/iconv/iconv.c delete mode 100644 ext/iconv/iconv.dsp delete mode 100644 ext/iconv/php_iconv.h delete mode 100644 ext/iconv/tests/Quotes.UTF-8 delete mode 100644 ext/iconv/tests/bug16069.phpt delete mode 100644 ext/iconv/tests/eucjp2iso2022jp.phpt delete mode 100644 ext/iconv/tests/eucjp2sjis.phpt delete mode 100644 ext/iconv/tests/eucjp2utf8.phpt delete mode 100644 ext/iconv/tests/iconv001.phpt delete mode 100644 ext/iconv/tests/iconv002.phpt delete mode 100644 ext/iconv/tests/iconv003.phpt delete mode 100644 ext/iconv/tests/iconv_mime_decode.phpt delete mode 100644 ext/iconv/tests/iconv_mime_encode.phpt delete mode 100644 ext/iconv/tests/iconv_strlen.phpt delete mode 100644 ext/iconv/tests/iconv_strpos.phpt delete mode 100644 ext/iconv/tests/iconv_strrpos.phpt delete mode 100644 ext/iconv/tests/iconv_substr.phpt delete mode 100644 ext/iconv/tests/ob_iconv_handler.phpt delete mode 100644 ext/iconv/tests/skipif.inc delete mode 100644 ext/iconv/tests/test.inc delete mode 100644 ext/iconv/tests/translit-failure.phpt delete mode 100644 ext/iconv/tests/translit-utf8.phpt delete mode 100644 ext/imap/CREDITS delete mode 100644 ext/imap/IMAP_Win32_HOWTO.txt delete mode 100644 ext/imap/config.m4 delete mode 100644 ext/imap/imap.dsp delete mode 100644 ext/imap/imap.h delete mode 100644 ext/imap/php_imap.c delete mode 100644 ext/imap/php_imap.h delete mode 100644 ext/informix/CREDITS delete mode 100644 ext/informix/Makefile.frag delete mode 100644 ext/informix/config.m4 delete mode 100644 ext/informix/ifx.dsp delete mode 100644 ext/informix/ifx.ec delete mode 100644 ext/informix/php_informix.h delete mode 100644 ext/informix/php_informix_includes.h delete mode 100644 ext/ingres_ii/CREDITS delete mode 100644 ext/ingres_ii/EXPERIMENTAL delete mode 100644 ext/ingres_ii/README delete mode 100644 ext/ingres_ii/config.m4 delete mode 100644 ext/ingres_ii/ii.c delete mode 100644 ext/ingres_ii/ii.h delete mode 100644 ext/ingres_ii/ingres.dsp delete mode 100644 ext/ingres_ii/php_ii.h delete mode 100644 ext/interbase/CREDITS delete mode 100644 ext/interbase/config.m4 delete mode 100644 ext/interbase/interbase.c delete mode 100644 ext/interbase/interbase.dsp delete mode 100644 ext/interbase/php_interbase.h delete mode 100644 ext/interbase/tests/002.phpt delete mode 100644 ext/interbase/tests/003.phpt delete mode 100644 ext/interbase/tests/004.phpt delete mode 100644 ext/interbase/tests/005.phpt delete mode 100644 ext/interbase/tests/006.phpt delete mode 100755 ext/interbase/tests/interbase.inc delete mode 100755 ext/interbase/tests/skipif.inc delete mode 100644 ext/ldap/CREDITS delete mode 100644 ext/ldap/LDAP_Win32_HOWTO.txt delete mode 100644 ext/ldap/config.m4 delete mode 100644 ext/ldap/ldap.c delete mode 100644 ext/ldap/ldap.dsp delete mode 100644 ext/ldap/ldap.mak delete mode 100644 ext/ldap/php_ldap.h delete mode 100644 ext/mbstring/CREDITS delete mode 100644 ext/mbstring/README delete mode 100644 ext/mbstring/README_PHP3-i18n-ja delete mode 100644 ext/mbstring/config.m4 delete mode 100644 ext/mbstring/cp932_table.h delete mode 100644 ext/mbstring/html_entities.c delete mode 100644 ext/mbstring/mb_gpc.c delete mode 100644 ext/mbstring/mb_gpc.h delete mode 100644 ext/mbstring/mbfilter.c delete mode 100644 ext/mbstring/mbfilter.h delete mode 100644 ext/mbstring/mbfilter_cn.c delete mode 100644 ext/mbstring/mbfilter_cn.h delete mode 100644 ext/mbstring/mbfilter_ja.c delete mode 100644 ext/mbstring/mbfilter_ja.h delete mode 100644 ext/mbstring/mbfilter_kr.c delete mode 100644 ext/mbstring/mbfilter_kr.h delete mode 100644 ext/mbstring/mbfilter_ru.c delete mode 100644 ext/mbstring/mbfilter_ru.h delete mode 100644 ext/mbstring/mbfilter_tw.c delete mode 100644 ext/mbstring/mbfilter_tw.h delete mode 100644 ext/mbstring/mbregex.c delete mode 100644 ext/mbstring/mbregex.h delete mode 100644 ext/mbstring/mbstring.c delete mode 100644 ext/mbstring/mbstring.dsp delete mode 100644 ext/mbstring/mbstring.h delete mode 100644 ext/mbstring/php_mbregex.c delete mode 100644 ext/mbstring/php_mbregex.h delete mode 100644 ext/mbstring/php_unicode.c delete mode 100644 ext/mbstring/php_unicode.h delete mode 100644 ext/mbstring/tests/bug20087.phpt delete mode 100644 ext/mbstring/tests/casefold.phpt delete mode 100644 ext/mbstring/tests/common.inc delete mode 100644 ext/mbstring/tests/htmlent.phpt delete mode 100644 ext/mbstring/tests/ini_language.phpt delete mode 100644 ext/mbstring/tests/mb_convert_encoding.phpt delete mode 100644 ext/mbstring/tests/mb_convert_variables.phpt delete mode 100644 ext/mbstring/tests/mb_detect_encoding.phpt delete mode 100644 ext/mbstring/tests/mb_detect_order.phpt delete mode 100644 ext/mbstring/tests/mb_ereg-compat-01.phpt delete mode 100644 ext/mbstring/tests/mb_ereg-compat-02.phpt delete mode 100644 ext/mbstring/tests/mb_ereg.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-01.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-02.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-03.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-04.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-05.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-06.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-07.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-08.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-09.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-10.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-11.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-12.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace-compat-13.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_replace.phpt delete mode 100644 ext/mbstring/tests/mb_ereg_search_xxx.phpt delete mode 100644 ext/mbstring/tests/mb_http_input.phpt delete mode 100644 ext/mbstring/tests/mb_http_output.phpt delete mode 100644 ext/mbstring/tests/mb_internal_encoding.phpt delete mode 100644 ext/mbstring/tests/mb_output_handler_euc_jp.phpt delete mode 100644 ext/mbstring/tests/mb_output_handler_shift_jis.phpt delete mode 100644 ext/mbstring/tests/mb_parse_str.phpt delete mode 100644 ext/mbstring/tests/mb_parse_str02.phpt delete mode 100644 ext/mbstring/tests/mb_preferred_mime_name.phpt delete mode 100644 ext/mbstring/tests/mb_regex_set_options.phpt delete mode 100644 ext/mbstring/tests/mb_send_mail01.phpt delete mode 100644 ext/mbstring/tests/mb_send_mail02.phpt delete mode 100644 ext/mbstring/tests/mb_send_mail03.phpt delete mode 100644 ext/mbstring/tests/mb_send_mail04.phpt delete mode 100644 ext/mbstring/tests/mb_send_mail05.phpt delete mode 100644 ext/mbstring/tests/mb_send_mail06.phpt delete mode 100644 ext/mbstring/tests/mb_send_mail07.phpt delete mode 100644 ext/mbstring/tests/mb_split-compat-01.phpt delete mode 100644 ext/mbstring/tests/mb_split.phpt delete mode 100644 ext/mbstring/tests/mb_strcut.phpt delete mode 100644 ext/mbstring/tests/mb_strimwidth.phpt delete mode 100644 ext/mbstring/tests/mb_strlen.phpt delete mode 100644 ext/mbstring/tests/mb_strpos.phpt delete mode 100644 ext/mbstring/tests/mb_strwidth.phpt delete mode 100644 ext/mbstring/tests/mb_substitute_character.phpt delete mode 100644 ext/mbstring/tests/mb_substr.phpt delete mode 100644 ext/mbstring/tests/mb_substr_count.phpt delete mode 100644 ext/mbstring/tests/overload01.phpt delete mode 100644 ext/mbstring/tests/overload02.phpt delete mode 100644 ext/mbstring/tests/php_gr_jp_10830.phpt delete mode 100644 ext/mbstring/tests/simpletest.phpt delete mode 100644 ext/mbstring/tests/skipif.inc delete mode 100644 ext/mbstring/tests/zend-multibyte.phpt delete mode 100644 ext/mbstring/unicode_data.h delete mode 100644 ext/mbstring/unicode_table.h delete mode 100644 ext/mbstring/unicode_table_cn.h delete mode 100644 ext/mbstring/unicode_table_ja.h delete mode 100644 ext/mbstring/unicode_table_kr.h delete mode 100644 ext/mbstring/unicode_table_ru.h delete mode 100644 ext/mbstring/unicode_table_tw.h delete mode 100644 ext/mcal/CREDITS delete mode 100644 ext/mcal/config.m4 delete mode 100644 ext/mcal/php_mcal.c delete mode 100644 ext/mcal/php_mcal.h delete mode 100644 ext/mcrypt/CREDITS delete mode 100644 ext/mcrypt/TODO delete mode 100644 ext/mcrypt/config.m4 delete mode 100644 ext/mcrypt/mcrypt.c delete mode 100644 ext/mcrypt/mcrypt.dsp delete mode 100644 ext/mcrypt/php_mcrypt.h delete mode 100644 ext/mcrypt/tests/blowfish.phpt delete mode 100644 ext/mcrypt/tests/bug8040.phpt delete mode 100644 ext/mcrypt/tests/vectors.txt delete mode 100644 ext/mcve/CREDITS delete mode 100644 ext/mcve/config.m4 delete mode 100644 ext/mcve/mcve.c delete mode 100644 ext/mcve/mcve.php delete mode 100644 ext/mcve/mcve_simple_test.php delete mode 100644 ext/mcve/mcve_test1.php delete mode 100644 ext/mcve/mcve_test2.php delete mode 100644 ext/mcve/php_mcve.h delete mode 100644 ext/mcve/tests/001.phpt delete mode 100644 ext/mhash/CREDITS delete mode 100644 ext/mhash/config.m4 delete mode 100644 ext/mhash/mhash.c delete mode 100644 ext/mhash/mhash.dsp delete mode 100644 ext/mhash/php_mhash.h delete mode 100644 ext/mhash/tests/001.phpt delete mode 100644 ext/mhash/tests/002.phpt delete mode 100644 ext/mhash/tests/003.phpt delete mode 100644 ext/mhash/tests/skip.inc delete mode 100644 ext/mime_magic/CREDITS delete mode 100644 ext/mime_magic/EXPERIMENTAL delete mode 100644 ext/mime_magic/TODO delete mode 100644 ext/mime_magic/config.m4 delete mode 100644 ext/mime_magic/mime_magic.c delete mode 100644 ext/mime_magic/mime_magic.dsp delete mode 100644 ext/mime_magic/php_mime_magic.h delete mode 100644 ext/ming/CREDITS delete mode 100644 ext/ming/EXPERIMENTAL delete mode 100644 ext/ming/config.m4 delete mode 100644 ext/ming/ming.c delete mode 100644 ext/ming/ming.dsp delete mode 100644 ext/ming/php_ming.h delete mode 100644 ext/mnogosearch/CREDITS delete mode 100644 ext/mnogosearch/README delete mode 100644 ext/mnogosearch/config.m4 delete mode 100644 ext/mnogosearch/index.php delete mode 100644 ext/mnogosearch/php_mnogo.c delete mode 100644 ext/mnogosearch/php_mnogo.h delete mode 100644 ext/msession/CREDITS delete mode 100644 ext/msession/README delete mode 100644 ext/msession/config.m4 delete mode 100644 ext/msession/msession-test.php delete mode 100644 ext/msession/msession.c delete mode 100644 ext/msession/msession.php delete mode 100644 ext/msession/php_msession.h delete mode 100644 ext/msession/reqclient.h delete mode 100644 ext/msql/CREDITS delete mode 100644 ext/msql/config.m4 delete mode 100644 ext/msql/msql.dsp delete mode 100644 ext/msql/php_msql.c delete mode 100644 ext/msql/php_msql.h delete mode 100644 ext/mssql/CREDITS delete mode 100644 ext/mssql/config.m4 delete mode 100644 ext/mssql/mssql.dsp delete mode 100644 ext/mssql/mssql_win32_howto.txt delete mode 100644 ext/mssql/php_mssql.c delete mode 100644 ext/mssql/php_mssql.h delete mode 100644 ext/mysql/CREDITS delete mode 100644 ext/mysql/config.m4 delete mode 100644 ext/mysql/libmysql/acinclude.m4 delete mode 100644 ext/mysql/libmysql/array.c delete mode 100644 ext/mysql/libmysql/bchange.c delete mode 100644 ext/mysql/libmysql/bmove.c delete mode 100644 ext/mysql/libmysql/bmove_upp.c delete mode 100644 ext/mysql/libmysql/charset.c delete mode 100644 ext/mysql/libmysql/config-win.h delete mode 100644 ext/mysql/libmysql/ctype.c delete mode 100644 ext/mysql/libmysql/ctype_autoconf.c delete mode 100644 ext/mysql/libmysql/ctype_extra_sources.c delete mode 100644 ext/mysql/libmysql/dbug.c delete mode 100644 ext/mysql/libmysql/dbug.h delete mode 100644 ext/mysql/libmysql/default.c delete mode 100644 ext/mysql/libmysql/dll.c delete mode 100644 ext/mysql/libmysql/errmsg.c delete mode 100644 ext/mysql/libmysql/errmsg.h delete mode 100644 ext/mysql/libmysql/errors.c delete mode 100755 ext/mysql/libmysql/fix_copyright delete mode 100644 ext/mysql/libmysql/get_password.c delete mode 100644 ext/mysql/libmysql/global.h delete mode 100644 ext/mysql/libmysql/int2str.c delete mode 100644 ext/mysql/libmysql/is_prefix.c delete mode 100644 ext/mysql/libmysql/libmysql.c delete mode 100644 ext/mysql/libmysql/libmysql.dsp delete mode 100644 ext/mysql/libmysql/list.c delete mode 100644 ext/mysql/libmysql/longlong2str.c delete mode 100644 ext/mysql/libmysql/m_ctype.h delete mode 100644 ext/mysql/libmysql/m_string.h delete mode 100644 ext/mysql/libmysql/mf_casecnv.c delete mode 100644 ext/mysql/libmysql/mf_dirname.c delete mode 100644 ext/mysql/libmysql/mf_fn_ext.c delete mode 100644 ext/mysql/libmysql/mf_format.c delete mode 100644 ext/mysql/libmysql/mf_loadpath.c delete mode 100644 ext/mysql/libmysql/mf_pack.c delete mode 100644 ext/mysql/libmysql/mf_path.c delete mode 100644 ext/mysql/libmysql/mf_unixpath.c delete mode 100644 ext/mysql/libmysql/mf_wcomp.c delete mode 100644 ext/mysql/libmysql/mulalloc.c delete mode 100644 ext/mysql/libmysql/my_alarm.h delete mode 100644 ext/mysql/libmysql/my_alloc.c delete mode 100644 ext/mysql/libmysql/my_compress.c delete mode 100644 ext/mysql/libmysql/my_config.h delete mode 100644 ext/mysql/libmysql/my_create.c delete mode 100644 ext/mysql/libmysql/my_delete.c delete mode 100644 ext/mysql/libmysql/my_dir.h delete mode 100644 ext/mysql/libmysql/my_div.c delete mode 100644 ext/mysql/libmysql/my_error.c delete mode 100644 ext/mysql/libmysql/my_fopen.c delete mode 100644 ext/mysql/libmysql/my_getwd.c delete mode 100644 ext/mysql/libmysql/my_init.c delete mode 100644 ext/mysql/libmysql/my_lib.c delete mode 100644 ext/mysql/libmysql/my_list.h delete mode 100644 ext/mysql/libmysql/my_malloc.c delete mode 100644 ext/mysql/libmysql/my_messnc.c delete mode 100644 ext/mysql/libmysql/my_net.c delete mode 100644 ext/mysql/libmysql/my_net.h delete mode 100644 ext/mysql/libmysql/my_once.c delete mode 100644 ext/mysql/libmysql/my_open.c delete mode 100644 ext/mysql/libmysql/my_pthread.c delete mode 100644 ext/mysql/libmysql/my_pthread.h delete mode 100644 ext/mysql/libmysql/my_read.c delete mode 100644 ext/mysql/libmysql/my_realloc.c delete mode 100644 ext/mysql/libmysql/my_static.c delete mode 100644 ext/mysql/libmysql/my_static.h delete mode 100644 ext/mysql/libmysql/my_sys.h delete mode 100644 ext/mysql/libmysql/my_tempnam.c delete mode 100644 ext/mysql/libmysql/my_thr_init.c delete mode 100644 ext/mysql/libmysql/my_wincond.c delete mode 100644 ext/mysql/libmysql/my_winthread.c delete mode 100644 ext/mysql/libmysql/my_write.c delete mode 100644 ext/mysql/libmysql/mysql.h delete mode 100644 ext/mysql/libmysql/mysql.m4 delete mode 100644 ext/mysql/libmysql/mysql_com.h delete mode 100644 ext/mysql/libmysql/mysql_version.h delete mode 100644 ext/mysql/libmysql/mysqld_error.h delete mode 100644 ext/mysql/libmysql/mysys_err.h delete mode 100644 ext/mysql/libmysql/mysys_priv.h delete mode 100644 ext/mysql/libmysql/net.c delete mode 100644 ext/mysql/libmysql/password.c delete mode 100644 ext/mysql/libmysql/raid.h delete mode 100644 ext/mysql/libmysql/safemalloc.c delete mode 100644 ext/mysql/libmysql/stamp-h.in delete mode 100644 ext/mysql/libmysql/str2int.c delete mode 100644 ext/mysql/libmysql/strcend.c delete mode 100644 ext/mysql/libmysql/strcont.c delete mode 100644 ext/mysql/libmysql/strend.c delete mode 100644 ext/mysql/libmysql/strfill.c delete mode 100644 ext/mysql/libmysql/string.c delete mode 100644 ext/mysql/libmysql/strinstr.c delete mode 100644 ext/mysql/libmysql/strmake.c delete mode 100644 ext/mysql/libmysql/strmov.c delete mode 100644 ext/mysql/libmysql/strnmov.c delete mode 100644 ext/mysql/libmysql/strto.c delete mode 100644 ext/mysql/libmysql/strtoll.c delete mode 100644 ext/mysql/libmysql/strtoull.c delete mode 100644 ext/mysql/libmysql/strxmov.c delete mode 100644 ext/mysql/libmysql/thr_alarm.h delete mode 100644 ext/mysql/libmysql/thr_mutex.c delete mode 100644 ext/mysql/libmysql/typelib.c delete mode 100755 ext/mysql/libmysql/update_sources delete mode 100644 ext/mysql/libmysql/violite.c delete mode 100644 ext/mysql/libmysql/violite.h delete mode 100644 ext/mysql/mysql.dsp delete mode 100644 ext/mysql/mysql.mak delete mode 100644 ext/mysql/php_mysql.c delete mode 100644 ext/mysql/php_mysql.h delete mode 100644 ext/mysqli/CREDITS delete mode 100644 ext/mysqli/EXPERIMENTAL delete mode 100644 ext/mysqli/TODO delete mode 100644 ext/mysqli/config.m4 delete mode 100644 ext/mysqli/mysqli.c delete mode 100755 ext/mysqli/mysqli.dsp delete mode 100644 ext/mysqli/mysqli_api.c delete mode 100644 ext/mysqli/mysqli_fe.c delete mode 100644 ext/mysqli/mysqli_nonapi.c delete mode 100644 ext/mysqli/mysqli_profiler.c delete mode 100644 ext/mysqli/mysqli_profiler.h delete mode 100644 ext/mysqli/mysqli_profiler_com.c delete mode 100644 ext/mysqli/mysqli_profiler_com.h delete mode 100644 ext/mysqli/php_mysqli.h delete mode 100644 ext/mysqli/tests/001.phpt delete mode 100644 ext/mysqli/tests/002.phpt delete mode 100644 ext/mysqli/tests/003.phpt delete mode 100644 ext/mysqli/tests/004.phpt delete mode 100644 ext/mysqli/tests/005.phpt delete mode 100644 ext/mysqli/tests/006.phpt delete mode 100644 ext/mysqli/tests/007.phpt delete mode 100644 ext/mysqli/tests/008.phpt delete mode 100644 ext/mysqli/tests/009.phpt delete mode 100644 ext/mysqli/tests/010.phpt delete mode 100644 ext/mysqli/tests/011.phpt delete mode 100644 ext/mysqli/tests/012.phpt delete mode 100644 ext/mysqli/tests/013.phpt delete mode 100644 ext/mysqli/tests/014.phpt delete mode 100644 ext/mysqli/tests/015.phpt delete mode 100644 ext/mysqli/tests/016.phpt delete mode 100644 ext/mysqli/tests/017.phpt delete mode 100644 ext/mysqli/tests/018.phpt delete mode 100644 ext/mysqli/tests/019.phpt delete mode 100644 ext/mysqli/tests/020.phpt delete mode 100644 ext/mysqli/tests/021.phpt delete mode 100644 ext/mysqli/tests/022.phpt delete mode 100644 ext/mysqli/tests/023.phpt delete mode 100644 ext/mysqli/tests/024.phpt delete mode 100644 ext/mysqli/tests/025.phpt delete mode 100644 ext/mysqli/tests/026.phpt delete mode 100644 ext/mysqli/tests/027.phpt delete mode 100644 ext/mysqli/tests/028.phpt delete mode 100644 ext/mysqli/tests/029.phpt delete mode 100644 ext/mysqli/tests/030.phpt delete mode 100644 ext/mysqli/tests/031.phpt delete mode 100644 ext/mysqli/tests/032.phpt delete mode 100644 ext/mysqli/tests/033.phpt delete mode 100644 ext/mysqli/tests/034.phpt delete mode 100644 ext/mysqli/tests/035.phpt delete mode 100644 ext/mysqli/tests/036.phpt delete mode 100644 ext/mysqli/tests/037.phpt delete mode 100644 ext/mysqli/tests/038.phpt delete mode 100644 ext/mysqli/tests/039.phpt delete mode 100644 ext/mysqli/tests/040.phpt delete mode 100644 ext/mysqli/tests/041.phpt delete mode 100644 ext/mysqli/tests/042.phpt delete mode 100644 ext/mysqli/tests/043.phpt delete mode 100644 ext/mysqli/tests/044.phpt delete mode 100644 ext/mysqli/tests/045.phpt delete mode 100644 ext/mysqli/tests/046.phpt delete mode 100644 ext/mysqli/tests/047.phpt delete mode 100644 ext/mysqli/tests/048.phpt delete mode 100644 ext/mysqli/tests/049.phpt delete mode 100644 ext/mysqli/tests/050.phpt delete mode 100644 ext/mysqli/tests/051.phpt delete mode 100644 ext/mysqli/tests/052.phpt delete mode 100644 ext/mysqli/tests/053.phpt delete mode 100644 ext/mysqli/tests/054.phpt delete mode 100644 ext/mysqli/tests/055.phpt delete mode 100644 ext/mysqli/tests/056.phpt delete mode 100644 ext/mysqli/tests/057.phpt delete mode 100644 ext/mysqli/tests/connect.inc delete mode 100644 ext/ncurses/CREDITS delete mode 100644 ext/ncurses/EXPERIMENTAL delete mode 100644 ext/ncurses/c-prototypes delete mode 100644 ext/ncurses/config.m4 delete mode 100644 ext/ncurses/example1.php delete mode 100644 ext/ncurses/ncurses.c delete mode 100644 ext/ncurses/ncurses.php delete mode 100644 ext/ncurses/ncurses_fe.c delete mode 100644 ext/ncurses/ncurses_functions.c delete mode 100644 ext/ncurses/php_ncurses.h delete mode 100644 ext/ncurses/php_ncurses_fe.h delete mode 100644 ext/ncurses/tests/001.phpt delete mode 100644 ext/notes/notes.dsp delete mode 100644 ext/notes/notes.dsw delete mode 100644 ext/notes/php_notes.c delete mode 100644 ext/notes/php_notes.h delete mode 100644 ext/oci8/CREDITS delete mode 100644 ext/oci8/config.m4 delete mode 100644 ext/oci8/oci8.c delete mode 100644 ext/oci8/oci8.dsp delete mode 100644 ext/oci8/oci8.dsw delete mode 100644 ext/oci8/php_oci8.h delete mode 100644 ext/odbc/CREDITS delete mode 100644 ext/odbc/birdstep.c delete mode 100644 ext/odbc/config.m4 delete mode 100644 ext/odbc/php_birdstep.h delete mode 100644 ext/odbc/php_odbc.c delete mode 100644 ext/odbc/php_odbc.h delete mode 100644 ext/odbc/php_odbc_includes.h delete mode 100644 ext/openssl/CREDITS delete mode 100644 ext/openssl/README delete mode 100644 ext/openssl/config.m4 delete mode 100644 ext/openssl/openssl.c delete mode 100644 ext/openssl/openssl.dsp delete mode 100644 ext/openssl/php_openssl.h delete mode 100644 ext/openssl/tests/001.phpt delete mode 100644 ext/openssl/tests/skipif.inc delete mode 100644 ext/openssl/xp_ssl.c delete mode 100644 ext/oracle/CREDITS delete mode 100644 ext/oracle/config.m4 delete mode 100644 ext/oracle/oracle.c delete mode 100644 ext/oracle/oracle.dsp delete mode 100644 ext/oracle/php_oracle.h delete mode 100644 ext/ovrimos/CREDITS delete mode 100644 ext/ovrimos/config.m4 delete mode 100644 ext/ovrimos/ovrimos.c delete mode 100644 ext/ovrimos/php_ovrimos.h delete mode 100644 ext/pcntl/CREDITS delete mode 100644 ext/pcntl/EXPERIMENTAL delete mode 100644 ext/pcntl/README delete mode 100644 ext/pcntl/config.m4 delete mode 100755 ext/pcntl/pcntl.c delete mode 100644 ext/pcntl/php_pcntl.h delete mode 100644 ext/pcntl/php_signal.c delete mode 100644 ext/pcntl/php_signal.h delete mode 100755 ext/pcntl/test-pcntl.php delete mode 100644 ext/pcntl/tests/001.phpt delete mode 100644 ext/pcre/CREDITS delete mode 100644 ext/pcre/config.m4 delete mode 100644 ext/pcre/config0.m4 delete mode 100644 ext/pcre/pcrelib/AUTHORS delete mode 100644 ext/pcre/pcrelib/COPYING delete mode 100644 ext/pcre/pcrelib/ChangeLog delete mode 100644 ext/pcre/pcrelib/INSTALL delete mode 100644 ext/pcre/pcrelib/LICENCE delete mode 100644 ext/pcre/pcrelib/NEWS delete mode 100644 ext/pcre/pcrelib/NON-UNIX-USE delete mode 100644 ext/pcre/pcrelib/README delete mode 100644 ext/pcre/pcrelib/chartables.c delete mode 100644 ext/pcre/pcrelib/dftables.c delete mode 100644 ext/pcre/pcrelib/dll.mk delete mode 100644 ext/pcre/pcrelib/doc/Tech.Notes delete mode 100644 ext/pcre/pcrelib/doc/pcre.3 delete mode 100644 ext/pcre/pcrelib/doc/pcre.html delete mode 100644 ext/pcre/pcrelib/doc/pcre.txt delete mode 100644 ext/pcre/pcrelib/doc/pcregrep.1 delete mode 100644 ext/pcre/pcrelib/doc/pcregrep.html delete mode 100644 ext/pcre/pcrelib/doc/pcregrep.txt delete mode 100644 ext/pcre/pcrelib/doc/pcreposix.3 delete mode 100644 ext/pcre/pcrelib/doc/pcreposix.html delete mode 100644 ext/pcre/pcrelib/doc/pcreposix.txt delete mode 100644 ext/pcre/pcrelib/doc/pcretest.1 delete mode 100644 ext/pcre/pcrelib/doc/pcretest.html delete mode 100644 ext/pcre/pcrelib/doc/pcretest.txt delete mode 100644 ext/pcre/pcrelib/doc/perltest.txt delete mode 100644 ext/pcre/pcrelib/get.c delete mode 100644 ext/pcre/pcrelib/internal.h delete mode 100644 ext/pcre/pcrelib/maketables.c delete mode 100644 ext/pcre/pcrelib/pcre.c delete mode 100644 ext/pcre/pcrelib/pcre.def delete mode 100644 ext/pcre/pcrelib/pcre.h delete mode 100644 ext/pcre/pcrelib/pcregrep.c delete mode 100644 ext/pcre/pcrelib/pcreposix.c delete mode 100644 ext/pcre/pcrelib/pcreposix.h delete mode 100644 ext/pcre/pcrelib/pcretest.c delete mode 100644 ext/pcre/pcrelib/study.c delete mode 100644 ext/pcre/pcrelib/testdata/testinput1 delete mode 100644 ext/pcre/pcrelib/testdata/testinput2 delete mode 100644 ext/pcre/pcrelib/testdata/testinput3 delete mode 100644 ext/pcre/pcrelib/testdata/testinput4 delete mode 100644 ext/pcre/pcrelib/testdata/testinput5 delete mode 100644 ext/pcre/pcrelib/testdata/testinput6 delete mode 100644 ext/pcre/pcrelib/testdata/testoutput1 delete mode 100644 ext/pcre/pcrelib/testdata/testoutput2 delete mode 100644 ext/pcre/pcrelib/testdata/testoutput3 delete mode 100644 ext/pcre/pcrelib/testdata/testoutput4 delete mode 100644 ext/pcre/pcrelib/testdata/testoutput5 delete mode 100644 ext/pcre/pcrelib/testdata/testoutput6 delete mode 100644 ext/pcre/php_pcre.c delete mode 100644 ext/pcre/php_pcre.h delete mode 100644 ext/pcre/tests/bug20528.phpt delete mode 100644 ext/pcre/tests/bug21732.phpt delete mode 100644 ext/pdf/CREDITS delete mode 100644 ext/pdf/config.m4 delete mode 100644 ext/pdf/pdf.c delete mode 100644 ext/pdf/pdf.dsp delete mode 100644 ext/pdf/php_pdf.h delete mode 100644 ext/pfpro/CREDITS delete mode 100644 ext/pfpro/TODO delete mode 100644 ext/pfpro/config.m4 delete mode 100644 ext/pfpro/pfpro.c delete mode 100644 ext/pfpro/php_pfpro.h delete mode 100644 ext/pgsql/CREDITS delete mode 100644 ext/pgsql/README delete mode 100644 ext/pgsql/config.m4 delete mode 100644 ext/pgsql/mysql_users.php delete mode 100644 ext/pgsql/pgsql.c delete mode 100644 ext/pgsql/pgsql.dsp delete mode 100644 ext/pgsql/pgsql.mak delete mode 100644 ext/pgsql/php_pgsql.h delete mode 100644 ext/pgsql/tests/01createdb.phpt delete mode 100644 ext/pgsql/tests/02connection.phpt delete mode 100644 ext/pgsql/tests/03sync_query.phpt delete mode 100644 ext/pgsql/tests/04async_query.phpt delete mode 100644 ext/pgsql/tests/05large_object.phpt delete mode 100644 ext/pgsql/tests/06copy.phpt delete mode 100644 ext/pgsql/tests/07optional.phpt delete mode 100644 ext/pgsql/tests/08escape.phpt delete mode 100644 ext/pgsql/tests/09notice.phpt delete mode 100644 ext/pgsql/tests/10pg_convert.phpt delete mode 100644 ext/pgsql/tests/11pg_meta_data.phpt delete mode 100644 ext/pgsql/tests/12pg_insert.phpt delete mode 100644 ext/pgsql/tests/13pg_select.phpt delete mode 100644 ext/pgsql/tests/14pg_update.phpt delete mode 100644 ext/pgsql/tests/15pg_delete.phpt delete mode 100644 ext/pgsql/tests/16pg_result_status.phpt delete mode 100644 ext/pgsql/tests/17result.phpt delete mode 100644 ext/pgsql/tests/18pg_escape_bytea.phpt delete mode 100644 ext/pgsql/tests/19pg_ping.phpt delete mode 100644 ext/pgsql/tests/20pg_get_pid.phpt delete mode 100644 ext/pgsql/tests/21pg_get_notify.phpt delete mode 100644 ext/pgsql/tests/80_bug14383.phpt delete mode 100644 ext/pgsql/tests/98old_api.phpt delete mode 100644 ext/pgsql/tests/9999dropdb.phpt delete mode 100644 ext/pgsql/tests/README delete mode 100644 ext/pgsql/tests/async_query.inc delete mode 100644 ext/pgsql/tests/config.inc delete mode 100644 ext/pgsql/tests/connection.inc delete mode 100644 ext/pgsql/tests/copy.inc delete mode 100644 ext/pgsql/tests/createdb.inc delete mode 100644 ext/pgsql/tests/dropdb.inc delete mode 100644 ext/pgsql/tests/escape.inc delete mode 100644 ext/pgsql/tests/informational.inc delete mode 100644 ext/pgsql/tests/large_object.inc delete mode 100644 ext/pgsql/tests/notice.inc delete mode 100644 ext/pgsql/tests/old_api.inc delete mode 100644 ext/pgsql/tests/optional.inc delete mode 100644 ext/pgsql/tests/pg_convert.inc delete mode 100644 ext/pgsql/tests/pg_delete.inc delete mode 100644 ext/pgsql/tests/pg_escape_bytea.inc delete mode 100644 ext/pgsql/tests/pg_get_notify.inc delete mode 100644 ext/pgsql/tests/pg_get_pid.inc delete mode 100644 ext/pgsql/tests/pg_insert.inc delete mode 100644 ext/pgsql/tests/pg_meta_data.inc delete mode 100644 ext/pgsql/tests/pg_ping.inc delete mode 100644 ext/pgsql/tests/pg_result_status.inc delete mode 100644 ext/pgsql/tests/pg_select.inc delete mode 100644 ext/pgsql/tests/pg_update.inc delete mode 100644 ext/pgsql/tests/php.gif delete mode 100644 ext/pgsql/tests/result.inc delete mode 100644 ext/pgsql/tests/skipif.inc delete mode 100644 ext/pgsql/tests/sync_query.inc delete mode 100644 ext/posix/CREDITS delete mode 100644 ext/posix/config.m4 delete mode 100644 ext/posix/php_posix.h delete mode 100644 ext/posix/posix.c delete mode 100644 ext/pspell/CREDITS delete mode 100644 ext/pspell/README delete mode 100644 ext/pspell/config.m4 delete mode 100644 ext/pspell/php_pspell.h delete mode 100644 ext/pspell/pspell.c delete mode 100644 ext/pspell/tests/01pspell_basic.phpt delete mode 100644 ext/qtdom/CREDITS delete mode 100644 ext/qtdom/EXPERIMENTAL delete mode 100644 ext/qtdom/config.m4 delete mode 100644 ext/qtdom/qtdom.c delete mode 100644 ext/qtdom/qtdom.h delete mode 100644 ext/qtdom/qtdom.php delete mode 100644 ext/qtdom/qtdom_qt.cpp delete mode 100644 ext/qtdom/qtdom_qt.h delete mode 100644 ext/readline/CREDITS delete mode 100644 ext/readline/README.libedit delete mode 100644 ext/readline/config.m4 delete mode 100644 ext/readline/php_readline.h delete mode 100644 ext/readline/readline.c delete mode 100644 ext/recode/CREDITS delete mode 100644 ext/recode/config.m4 delete mode 100644 ext/recode/php_recode.h delete mode 100644 ext/recode/recode.c delete mode 100644 ext/rpc/CREDITS delete mode 100644 ext/rpc/EXPERIMENTAL delete mode 100644 ext/rpc/RPC_HOWTO delete mode 100644 ext/rpc/com/CREDITS delete mode 100644 ext/rpc/com/TODO delete mode 100644 ext/rpc/com/com.c delete mode 100644 ext/rpc/com/com.dsp delete mode 100644 ext/rpc/com/com.h delete mode 100644 ext/rpc/com/com_wrapper.c delete mode 100644 ext/rpc/com/com_wrapper.h delete mode 100644 ext/rpc/com/conversion.c delete mode 100644 ext/rpc/com/conversion.h delete mode 100644 ext/rpc/com/dispatch.c delete mode 100644 ext/rpc/com/php_com.h delete mode 100644 ext/rpc/com/variant.c delete mode 100644 ext/rpc/com/variant.h delete mode 100644 ext/rpc/dotnet/CREDITS delete mode 100644 ext/rpc/dotnet/EXPERIMENTAL delete mode 100644 ext/rpc/dotnet/README delete mode 100644 ext/rpc/dotnet/dotnet.cpp delete mode 100644 ext/rpc/dotnet/dotnet.dsp delete mode 100644 ext/rpc/dotnet/dotnet.php delete mode 100644 ext/rpc/dotnet/php_dotnet.h delete mode 100644 ext/rpc/handler.h delete mode 100644 ext/rpc/hash.h delete mode 100644 ext/rpc/java/CREDITS delete mode 100644 ext/rpc/java/EXPERIMENTAL delete mode 100644 ext/rpc/java/Makefile.frag delete mode 100644 ext/rpc/java/README delete mode 100644 ext/rpc/java/config.m4 delete mode 100644 ext/rpc/java/except.php delete mode 100644 ext/rpc/java/java.c delete mode 100644 ext/rpc/java/java.dsp delete mode 100644 ext/rpc/java/jawt.php delete mode 100644 ext/rpc/java/jver.php delete mode 100644 ext/rpc/java/reflect.java delete mode 100644 ext/rpc/php_rpc.h delete mode 100644 ext/rpc/rpc.c delete mode 100644 ext/rpc/rpc.h delete mode 100644 ext/rpc/rpc_proxy.c delete mode 100644 ext/rpc/rpc_proxy.h delete mode 100644 ext/rpc/skeleton/php_skeleton.h delete mode 100644 ext/rpc/skeleton/skeleton.c delete mode 100644 ext/rpc/skeleton/skeleton.h delete mode 100644 ext/rpc/tests/test1.php delete mode 100644 ext/rpc/tests/test2.php delete mode 100644 ext/rpc/tests/test3.php delete mode 100644 ext/rpc/tests/test4.php delete mode 100644 ext/rpc/tests/tests.php delete mode 100644 ext/rpc/xmlrpc/CREDITS delete mode 100644 ext/rpc/xmlrpc/EXPERIMENTAL delete mode 100644 ext/rpc/xmlrpc/config.m4 delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/README delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/acinclude.m4 delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/base64.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/base64.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/encodings.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/encodings.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/queue.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/queue.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/simplestring.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/simplestring.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/system_methods.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/system_methods_private.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xml_element.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xml_element.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xmlrpc.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xmlrpc.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xmlrpc.m4 delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.c delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xmlrpc_private.h delete mode 100644 ext/rpc/xmlrpc/libxmlrpc/xmlrpc_win32.h delete mode 100644 ext/rpc/xmlrpc/php_xmlrpc.h delete mode 100644 ext/rpc/xmlrpc/xmlrpc-epi-php.c delete mode 100644 ext/rpc/xmlrpc/xmlrpc.dsp delete mode 100644 ext/session/CREDITS delete mode 100644 ext/session/config.m4 delete mode 100644 ext/session/mod_files.c delete mode 100644 ext/session/mod_files.h delete mode 100644 ext/session/mod_files.sh delete mode 100644 ext/session/mod_mm.c delete mode 100644 ext/session/mod_mm.h delete mode 100644 ext/session/mod_user.c delete mode 100644 ext/session/mod_user.h delete mode 100644 ext/session/php_session.h delete mode 100644 ext/session/session.c delete mode 100644 ext/session/tests/001.phpt delete mode 100644 ext/session/tests/002.phpt delete mode 100644 ext/session/tests/003.phpt delete mode 100644 ext/session/tests/004.phpt delete mode 100644 ext/session/tests/005.phpt delete mode 100644 ext/session/tests/006.phpt delete mode 100644 ext/session/tests/007.phpt delete mode 100644 ext/session/tests/008-php4.2.3.phpt delete mode 100644 ext/session/tests/008.phpt delete mode 100644 ext/session/tests/009.phpt delete mode 100644 ext/session/tests/010.phpt delete mode 100644 ext/session/tests/011.phpt delete mode 100644 ext/session/tests/012.phpt delete mode 100644 ext/session/tests/013.phpt delete mode 100644 ext/session/tests/014.phpt delete mode 100644 ext/session/tests/015.phpt delete mode 100644 ext/session/tests/016.phpt delete mode 100644 ext/session/tests/017.phpt delete mode 100644 ext/session/tests/018.phpt delete mode 100644 ext/session/tests/019.phpt delete mode 100644 ext/session/tests/020.phpt delete mode 100644 ext/session/tests/021.phpt delete mode 100644 ext/session/tests/skipif.inc delete mode 100644 ext/shmop/CREDITS delete mode 100644 ext/shmop/README delete mode 100644 ext/shmop/config.m4 delete mode 100644 ext/shmop/php_shmop.h delete mode 100644 ext/shmop/shmop.c delete mode 100644 ext/shmop/shmop.dsp delete mode 100644 ext/shmop/tests/001.phpt delete mode 100644 ext/skeleton/CREDITS delete mode 100644 ext/skeleton/EXPERIMENTAL delete mode 100755 ext/skeleton/create_stubs delete mode 100644 ext/skeleton/php_skeleton.h delete mode 100644 ext/skeleton/skeleton.c delete mode 100644 ext/skeleton/skeleton.dsp delete mode 100644 ext/skeleton/skeleton.php delete mode 100644 ext/skeleton/tests/001.phpt delete mode 100644 ext/snmp/CREDITS delete mode 100644 ext/snmp/config.m4 delete mode 100644 ext/snmp/php_snmp.h delete mode 100644 ext/snmp/snmp.c delete mode 100644 ext/snmp/snmp.dsp delete mode 100644 ext/snmp/winsnmp.c delete mode 100644 ext/soap/EXPERIMENTAL delete mode 100644 ext/soap/Makefile.in delete mode 100644 ext/soap/TODO delete mode 100644 ext/soap/config.m4 delete mode 100644 ext/soap/interop/base.php delete mode 100644 ext/soap/interop/client_round2.php delete mode 100644 ext/soap/interop/client_round2_interop.php delete mode 100644 ext/soap/interop/client_round2_params.php delete mode 100644 ext/soap/interop/client_round2_results.php delete mode 100644 ext/soap/interop/client_round2_run.php delete mode 100644 ext/soap/interop/database_round2.sql delete mode 100644 ext/soap/interop/echoheadersvc.wsdl delete mode 100644 ext/soap/interop/endpointdata.sql delete mode 100644 ext/soap/interop/index.php delete mode 100644 ext/soap/interop/info.php delete mode 100644 ext/soap/interop/interop.wsdl delete mode 100644 ext/soap/interop/interopB.wsdl delete mode 100644 ext/soap/interop/server_round2.php delete mode 100644 ext/soap/interop/server_round2_base.php delete mode 100644 ext/soap/interop/server_round2_groupB.php delete mode 100644 ext/soap/interop/server_round2_groupC.php delete mode 100644 ext/soap/interop/server_round2_test.php delete mode 100644 ext/soap/interop/test.utility.php delete mode 100644 ext/soap/interop/testclient.php delete mode 100644 ext/soap/interop/testserver.php delete mode 100644 ext/soap/package.xml delete mode 100644 ext/soap/php_encoding.c delete mode 100644 ext/soap/php_encoding.h delete mode 100644 ext/soap/php_http.c delete mode 100644 ext/soap/php_http.h delete mode 100644 ext/soap/php_packet_soap.c delete mode 100644 ext/soap/php_packet_soap.h delete mode 100644 ext/soap/php_schema.c delete mode 100644 ext/soap/php_schema.h delete mode 100644 ext/soap/php_sdl.c delete mode 100644 ext/soap/php_sdl.h delete mode 100644 ext/soap/php_soap.dsp delete mode 100644 ext/soap/php_soap.h delete mode 100644 ext/soap/php_xml.c delete mode 100644 ext/soap/php_xml.h delete mode 100644 ext/soap/soap.c delete mode 100644 ext/sockets/CREDITS delete mode 100644 ext/sockets/config.m4 delete mode 100644 ext/sockets/php_sockets.h delete mode 100644 ext/sockets/php_sockets_win.c delete mode 100644 ext/sockets/php_sockets_win.h delete mode 100644 ext/sockets/sockets.c delete mode 100644 ext/sockets/sockets.dsp delete mode 100644 ext/sockets/sockets.php delete mode 100644 ext/sockets/tests/ipv4loop.phpt delete mode 100644 ext/sockets/tests/ipv6loop.phpt delete mode 100644 ext/sockets/unix_socket_constants.h delete mode 100644 ext/sockets/win32_socket_constants.h delete mode 100755 ext/spl/CREDITS delete mode 100755 ext/spl/EXPERIMENTAL delete mode 100755 ext/spl/README delete mode 100755 ext/spl/TODO delete mode 100755 ext/spl/config.m4 delete mode 100755 ext/spl/examples/dba_dump.php delete mode 100755 ext/spl/php_spl.c delete mode 100755 ext/spl/php_spl.h delete mode 100755 ext/spl/spl.php delete mode 100755 ext/spl/spl_array.c delete mode 100755 ext/spl/spl_array.h delete mode 100755 ext/spl/spl_engine.c delete mode 100755 ext/spl/spl_engine.h delete mode 100755 ext/spl/spl_foreach.c delete mode 100755 ext/spl/spl_foreach.h delete mode 100755 ext/spl/spl_functions.c delete mode 100755 ext/spl/spl_functions.h delete mode 100755 ext/spl/tests/.htaccess delete mode 100755 ext/spl/tests/array_access_001.phpt delete mode 100755 ext/spl/tests/array_access_002.phpt delete mode 100755 ext/spl/tests/array_access_ex.phpt delete mode 100755 ext/spl/tests/array_read.phpt delete mode 100755 ext/spl/tests/foreach.phpt delete mode 100755 ext/spl/tests/forward.phpt delete mode 100755 ext/spl/tests/sequence.phpt delete mode 100644 ext/sqlite/EXPERIMENTAL delete mode 100644 ext/sqlite/libsqlite/src/opcodes.c delete mode 100644 ext/sqlite/libsqlite/src/sqlite.w32.h delete mode 100644 ext/sqlite/libsqlite/src/sqlite_config.w32.h delete mode 100644 ext/sqlite/sqlite.dsp delete mode 100755 ext/sqlite/tests/sqlite_007.phpt delete mode 100755 ext/sqlite/tests/sqlite_008.phpt delete mode 100755 ext/sqlite/tests/sqlite_009.phpt delete mode 100755 ext/sqlite/tests/sqlite_010.phpt delete mode 100755 ext/sqlite/tests/sqlite_011.phpt delete mode 100755 ext/sqlite/tests/sqlite_012.phpt delete mode 100755 ext/sqlite/tests/sqlite_013.phpt delete mode 100644 ext/standard/CREDITS delete mode 100644 ext/standard/Makefile.frag delete mode 100644 ext/standard/aggregation.c delete mode 100644 ext/standard/aggregation.h delete mode 100644 ext/standard/array.c delete mode 100644 ext/standard/assert.c delete mode 100644 ext/standard/base64.c delete mode 100644 ext/standard/base64.h delete mode 100644 ext/standard/basic_functions.c delete mode 100644 ext/standard/basic_functions.h delete mode 100644 ext/standard/browscap.c delete mode 100644 ext/standard/config.m4 delete mode 100644 ext/standard/crc32.c delete mode 100644 ext/standard/crc32.h delete mode 100644 ext/standard/credits.c delete mode 100644 ext/standard/credits.h delete mode 100644 ext/standard/credits_ext.h delete mode 100644 ext/standard/credits_sapi.h delete mode 100644 ext/standard/crypt.c delete mode 100644 ext/standard/css.c delete mode 100644 ext/standard/css.h delete mode 100644 ext/standard/cyr_convert.c delete mode 100644 ext/standard/cyr_convert.h delete mode 100644 ext/standard/datetime.c delete mode 100644 ext/standard/datetime.h delete mode 100644 ext/standard/dir.c delete mode 100644 ext/standard/dl.c delete mode 100644 ext/standard/dl.h delete mode 100644 ext/standard/dns.c delete mode 100644 ext/standard/dns.h delete mode 100644 ext/standard/exec.c delete mode 100644 ext/standard/exec.h delete mode 100644 ext/standard/file.c delete mode 100644 ext/standard/file.h delete mode 100644 ext/standard/filestat.c delete mode 100644 ext/standard/filters.c delete mode 100644 ext/standard/flock_compat.c delete mode 100644 ext/standard/flock_compat.h delete mode 100644 ext/standard/formatted_print.c delete mode 100644 ext/standard/fsock.c delete mode 100644 ext/standard/fsock.h delete mode 100644 ext/standard/ftok.c delete mode 100644 ext/standard/ftp_fopen_wrapper.c delete mode 100644 ext/standard/head.c delete mode 100644 ext/standard/head.h delete mode 100644 ext/standard/html.c delete mode 100644 ext/standard/html.h delete mode 100644 ext/standard/http_fopen_wrapper.c delete mode 100644 ext/standard/image.c delete mode 100644 ext/standard/incomplete_class.c delete mode 100644 ext/standard/info.c delete mode 100644 ext/standard/info.h delete mode 100644 ext/standard/iptc.c delete mode 100644 ext/standard/lcg.c delete mode 100644 ext/standard/levenshtein.c delete mode 100644 ext/standard/link.c delete mode 100644 ext/standard/mail.c delete mode 100644 ext/standard/math.c delete mode 100644 ext/standard/md5.c delete mode 100644 ext/standard/md5.h delete mode 100644 ext/standard/metaphone.c delete mode 100644 ext/standard/microtime.c delete mode 100644 ext/standard/microtime.h delete mode 100644 ext/standard/pack.c delete mode 100644 ext/standard/pack.h delete mode 100644 ext/standard/pageinfo.c delete mode 100644 ext/standard/pageinfo.h delete mode 100644 ext/standard/parsedate.y delete mode 100644 ext/standard/php_array.h delete mode 100644 ext/standard/php_assert.h delete mode 100644 ext/standard/php_browscap.h delete mode 100644 ext/standard/php_crypt.h delete mode 100644 ext/standard/php_dir.h delete mode 100644 ext/standard/php_ext_syslog.h delete mode 100644 ext/standard/php_filestat.h delete mode 100644 ext/standard/php_fopen_wrapper.c delete mode 100644 ext/standard/php_fopen_wrappers.h delete mode 100644 ext/standard/php_ftok.h delete mode 100644 ext/standard/php_image.h delete mode 100644 ext/standard/php_incomplete_class.h delete mode 100644 ext/standard/php_iptc.h delete mode 100644 ext/standard/php_lcg.h delete mode 100644 ext/standard/php_link.h delete mode 100644 ext/standard/php_mail.h delete mode 100644 ext/standard/php_math.h delete mode 100644 ext/standard/php_metaphone.h delete mode 100644 ext/standard/php_parsedate.h delete mode 100644 ext/standard/php_rand.h delete mode 100644 ext/standard/php_smart_str.h delete mode 100644 ext/standard/php_smart_str_public.h delete mode 100644 ext/standard/php_standard.h delete mode 100644 ext/standard/php_string.h delete mode 100644 ext/standard/php_sunfuncs.h delete mode 100644 ext/standard/php_type.h delete mode 100644 ext/standard/php_var.h delete mode 100644 ext/standard/php_versioning.h delete mode 100644 ext/standard/proc_open.c delete mode 100644 ext/standard/proc_open.h delete mode 100644 ext/standard/quot_print.c delete mode 100644 ext/standard/quot_print.h delete mode 100644 ext/standard/rand.c delete mode 100644 ext/standard/reg.c delete mode 100644 ext/standard/reg.h delete mode 100644 ext/standard/scanf.c delete mode 100644 ext/standard/scanf.h delete mode 100644 ext/standard/sha1.c delete mode 100644 ext/standard/sha1.h delete mode 100644 ext/standard/soundex.c delete mode 100644 ext/standard/streamsfuncs.c delete mode 100644 ext/standard/streamsfuncs.h delete mode 100644 ext/standard/string.c delete mode 100644 ext/standard/strnatcmp.c delete mode 100644 ext/standard/sunfuncs.c delete mode 100644 ext/standard/syslog.c delete mode 100644 ext/standard/tests/aggregation/aggregate.lib delete mode 100644 ext/standard/tests/aggregation/aggregate.phpt delete mode 100644 ext/standard/tests/aggregation/aggregate_methods.phpt delete mode 100644 ext/standard/tests/aggregation/aggregate_methods_by_list.phpt delete mode 100644 ext/standard/tests/aggregation/aggregate_methods_by_regexp.phpt delete mode 100644 ext/standard/tests/aggregation/aggregate_properties.phpt delete mode 100644 ext/standard/tests/aggregation/aggregate_properties_by_list.phpt delete mode 100644 ext/standard/tests/aggregation/aggregate_properties_by_regexp.phpt delete mode 100644 ext/standard/tests/aggregation/aggregation_info.phpt delete mode 100644 ext/standard/tests/aggregation/deaggregate.phpt delete mode 100644 ext/standard/tests/array/001.phpt delete mode 100644 ext/standard/tests/array/002.phpt delete mode 100644 ext/standard/tests/array/003.phpt delete mode 100644 ext/standard/tests/array/004.phpt delete mode 100644 ext/standard/tests/array/005.phpt delete mode 100644 ext/standard/tests/array/006.phpt delete mode 100644 ext/standard/tests/array/007.phpt delete mode 100644 ext/standard/tests/array/008.phpt delete mode 100644 ext/standard/tests/array/array_change_key_case.phpt delete mode 100644 ext/standard/tests/array/array_chunk.phpt delete mode 100644 ext/standard/tests/array/array_count_values.phpt delete mode 100644 ext/standard/tests/array/array_search.phpt delete mode 100644 ext/standard/tests/array/bug12776.phpt delete mode 100644 ext/standard/tests/array/bug20381.phpt delete mode 100644 ext/standard/tests/array/bug20865.phpt delete mode 100644 ext/standard/tests/array/bug21182.phpt delete mode 100644 ext/standard/tests/array/bug21998.phpt delete mode 100644 ext/standard/tests/array/bug22088.phpt delete mode 100644 ext/standard/tests/array/bug22463.phpt delete mode 100644 ext/standard/tests/array/bug23581.phpt delete mode 100644 ext/standard/tests/array/count_recursive.phpt delete mode 100644 ext/standard/tests/array/data.inc delete mode 100644 ext/standard/tests/array/range.phpt delete mode 100644 ext/standard/tests/array/var_export.phpt delete mode 100644 ext/standard/tests/assert/assert.phpt delete mode 100644 ext/standard/tests/file/001-win32.phpt delete mode 100644 ext/standard/tests/file/001.phpt delete mode 100644 ext/standard/tests/file/002.phpt delete mode 100644 ext/standard/tests/file/003.phpt delete mode 100644 ext/standard/tests/file/bug12556.phpt delete mode 100644 ext/standard/tests/file/bug20424.phpt delete mode 100644 ext/standard/tests/file/bug22382.phpt delete mode 100644 ext/standard/tests/file/bug22414.phpt delete mode 100644 ext/standard/tests/file/fopencookie.phpt delete mode 100644 ext/standard/tests/file/test.csv delete mode 100644 ext/standard/tests/file/test2.csv delete mode 100644 ext/standard/tests/file/userfilters.phpt delete mode 100644 ext/standard/tests/file/userstreams.phpt delete mode 100644 ext/standard/tests/filters/basic.phpt delete mode 100644 ext/standard/tests/filters/bug22538.phpt delete mode 100644 ext/standard/tests/general_functions/001.phpt delete mode 100644 ext/standard/tests/general_functions/002.phpt delete mode 100644 ext/standard/tests/general_functions/003.phpt delete mode 100644 ext/standard/tests/general_functions/004.data delete mode 100644 ext/standard/tests/general_functions/004.phpt delete mode 100644 ext/standard/tests/general_functions/005.phpt delete mode 100644 ext/standard/tests/general_functions/006.phpt delete mode 100644 ext/standard/tests/general_functions/007.phpt delete mode 100644 ext/standard/tests/general_functions/008.phpt delete mode 100644 ext/standard/tests/general_functions/009.phpt delete mode 100644 ext/standard/tests/general_functions/getopt.phpt delete mode 100644 ext/standard/tests/general_functions/proc_open.phpt delete mode 100644 ext/standard/tests/general_functions/sunfuncts.phpt delete mode 100644 ext/standard/tests/image/246x247.png delete mode 100644 ext/standard/tests/image/384x385.png delete mode 100644 ext/standard/tests/image/bug13213.jpg delete mode 100644 ext/standard/tests/image/bug13213.phpt delete mode 100644 ext/standard/tests/image/getimagesize.phpt delete mode 100644 ext/standard/tests/image/getimagesize_246x247.phpt delete mode 100644 ext/standard/tests/image/getimagesize_384x385.phpt delete mode 100644 ext/standard/tests/image/getimagesize_swc.phpt delete mode 100644 ext/standard/tests/image/image_type_to_mime_type.phpt delete mode 100644 ext/standard/tests/image/skipif_imagetype.inc delete mode 100755 ext/standard/tests/image/test13pix.swf delete mode 100644 ext/standard/tests/image/test1pix.bmp delete mode 100644 ext/standard/tests/image/test1pix.jp2 delete mode 100644 ext/standard/tests/image/test1pix.jpc delete mode 100644 ext/standard/tests/image/test1pix.jpg delete mode 100644 ext/standard/tests/image/test2pix.gif delete mode 100644 ext/standard/tests/image/test4pix.gif delete mode 100644 ext/standard/tests/image/test4pix.iff delete mode 100644 ext/standard/tests/image/test4pix.png delete mode 100644 ext/standard/tests/image/test4pix.psd delete mode 100755 ext/standard/tests/image/test4pix.swf delete mode 100644 ext/standard/tests/image/test4pix.tif delete mode 100644 ext/standard/tests/math/abs.phpt delete mode 100644 ext/standard/tests/math/bug21523.phpt delete mode 100644 ext/standard/tests/math/floorceil.phpt delete mode 100644 ext/standard/tests/math/hexdec.phpt delete mode 100644 ext/standard/tests/math/log.phpt delete mode 100644 ext/standard/tests/math/pow.phpt delete mode 100644 ext/standard/tests/math/round.phpt delete mode 100644 ext/standard/tests/network/bug20134.phpt delete mode 100644 ext/standard/tests/reg/001.phpt delete mode 100644 ext/standard/tests/reg/002.phpt delete mode 100644 ext/standard/tests/reg/003.phpt delete mode 100644 ext/standard/tests/reg/004.phpt delete mode 100644 ext/standard/tests/reg/005.phpt delete mode 100644 ext/standard/tests/reg/006.phpt delete mode 100644 ext/standard/tests/reg/007.phpt delete mode 100644 ext/standard/tests/reg/008.phpt delete mode 100644 ext/standard/tests/reg/009.phpt delete mode 100644 ext/standard/tests/reg/010.phpt delete mode 100644 ext/standard/tests/reg/011.phpt delete mode 100644 ext/standard/tests/reg/012.phpt delete mode 100644 ext/standard/tests/reg/013.phpt delete mode 100644 ext/standard/tests/reg/014.phpt delete mode 100644 ext/standard/tests/reg/015.phpt delete mode 100644 ext/standard/tests/reg/016.phpt delete mode 100644 ext/standard/tests/serialize/001.phpt delete mode 100644 ext/standard/tests/serialize/003.phpt delete mode 100644 ext/standard/tests/serialize/bug14293.phpt delete mode 100644 ext/standard/tests/serialize/bug23298.phpt delete mode 100644 ext/standard/tests/strings/004.phpt delete mode 100644 ext/standard/tests/strings/add-and-stripcslashes.phpt delete mode 100644 ext/standard/tests/strings/add-and-stripslashes.phpt delete mode 100644 ext/standard/tests/strings/basename.phpt delete mode 100644 ext/standard/tests/strings/bin2hex.phpt delete mode 100644 ext/standard/tests/strings/bug20108.phpt delete mode 100644 ext/standard/tests/strings/bug20169.phpt delete mode 100644 ext/standard/tests/strings/bug20261.phpt delete mode 100644 ext/standard/tests/strings/bug20927.phpt delete mode 100644 ext/standard/tests/strings/bug20934.phpt delete mode 100644 ext/standard/tests/strings/bug21338.phpt delete mode 100644 ext/standard/tests/strings/bug21453.phpt delete mode 100644 ext/standard/tests/strings/bug21730.phpt delete mode 100644 ext/standard/tests/strings/bug21744.phpt delete mode 100644 ext/standard/tests/strings/bug22008.phpt delete mode 100644 ext/standard/tests/strings/bug22187.phpt delete mode 100644 ext/standard/tests/strings/bug22207.phpt delete mode 100644 ext/standard/tests/strings/bug22224.phpt delete mode 100644 ext/standard/tests/strings/bug22227.phpt delete mode 100644 ext/standard/tests/strings/bug22904.phpt delete mode 100644 ext/standard/tests/strings/chr_ord.phpt delete mode 100644 ext/standard/tests/strings/chunk_split.phpt delete mode 100644 ext/standard/tests/strings/count_chars.phpt delete mode 100644 ext/standard/tests/strings/crc32.phpt delete mode 100644 ext/standard/tests/strings/crypt.phpt delete mode 100644 ext/standard/tests/strings/explode.phpt delete mode 100644 ext/standard/tests/strings/htmlentities.phpt delete mode 100644 ext/standard/tests/strings/htmlentities01.phpt delete mode 100644 ext/standard/tests/strings/htmlentities02.phpt delete mode 100644 ext/standard/tests/strings/htmlentities03.phpt delete mode 100644 ext/standard/tests/strings/htmlentities04.phpt delete mode 100644 ext/standard/tests/strings/htmlentities05.phpt delete mode 100644 ext/standard/tests/strings/htmlentities06.phpt delete mode 100644 ext/standard/tests/strings/htmlentities07.phpt delete mode 100644 ext/standard/tests/strings/htmlentities08.phpt delete mode 100644 ext/standard/tests/strings/htmlentities09.phpt delete mode 100644 ext/standard/tests/strings/htmlentities10.phpt delete mode 100644 ext/standard/tests/strings/htmlentities11.phpt delete mode 100644 ext/standard/tests/strings/htmlentities12.phpt delete mode 100644 ext/standard/tests/strings/htmlentities13.phpt delete mode 100644 ext/standard/tests/strings/htmlentities14.phpt delete mode 100644 ext/standard/tests/strings/htmlentities15.phpt delete mode 100644 ext/standard/tests/strings/htmlentities16.phpt delete mode 100644 ext/standard/tests/strings/implode.phpt delete mode 100644 ext/standard/tests/strings/md5.phpt delete mode 100644 ext/standard/tests/strings/md5raw.phpt delete mode 100644 ext/standard/tests/strings/nl2br.phpt delete mode 100644 ext/standard/tests/strings/sha1.phpt delete mode 100644 ext/standard/tests/strings/sha1raw.phpt delete mode 100644 ext/standard/tests/strings/str_repeat.phpt delete mode 100644 ext/standard/tests/strings/str_shuffle.phpt delete mode 100644 ext/standard/tests/strings/strcspn.phpt delete mode 100644 ext/standard/tests/strings/strings001.phpt delete mode 100644 ext/standard/tests/strings/strip_tags.phpt delete mode 100644 ext/standard/tests/strings/strpos.phpt delete mode 100644 ext/standard/tests/strings/strrev.phpt delete mode 100644 ext/standard/tests/strings/strripos.phpt delete mode 100644 ext/standard/tests/strings/strrpos.phpt delete mode 100644 ext/standard/tests/strings/strspn.phpt delete mode 100644 ext/standard/tests/strings/strstr.phpt delete mode 100644 ext/standard/tests/strings/strtoupper.phpt delete mode 100644 ext/standard/tests/strings/strtr.phpt delete mode 100644 ext/standard/tests/strings/substr_count.phpt delete mode 100644 ext/standard/tests/strings/substr_replace.phpt delete mode 100644 ext/standard/tests/strings/trim.phpt delete mode 100644 ext/standard/tests/strings/url_t.phpt delete mode 100644 ext/standard/tests/strings/wordwrap.phpt delete mode 100644 ext/standard/tests/time/001.phpt delete mode 100644 ext/standard/tests/time/002-win32.phpt delete mode 100644 ext/standard/tests/time/002.phpt delete mode 100644 ext/standard/tests/time/003.phpt delete mode 100644 ext/standard/tests/time/idate.phpt delete mode 100644 ext/standard/tests/time/mktime.phpt delete mode 100644 ext/standard/tests/versioning/version_compare.phpt delete mode 100644 ext/standard/type.c delete mode 100644 ext/standard/uniqid.c delete mode 100644 ext/standard/uniqid.h delete mode 100644 ext/standard/url.c delete mode 100644 ext/standard/url.h delete mode 100644 ext/standard/url_scanner.c delete mode 100644 ext/standard/url_scanner.h delete mode 100644 ext/standard/url_scanner_ex.c delete mode 100644 ext/standard/url_scanner_ex.h delete mode 100644 ext/standard/url_scanner_ex.re delete mode 100644 ext/standard/user_filters.c delete mode 100644 ext/standard/var.c delete mode 100644 ext/standard/var_unserializer.c delete mode 100644 ext/standard/var_unserializer.re delete mode 100644 ext/standard/versioning.c delete mode 100644 ext/swf/CREDITS delete mode 100644 ext/swf/config.m4 delete mode 100644 ext/swf/php_swf.h delete mode 100644 ext/swf/swf.c delete mode 100644 ext/sybase/CREDITS delete mode 100644 ext/sybase/config.m4 delete mode 100644 ext/sybase/php_sybase_db.c delete mode 100644 ext/sybase/php_sybase_db.h delete mode 100644 ext/sybase_ct/CREDITS delete mode 100644 ext/sybase_ct/config.m4 delete mode 100644 ext/sybase_ct/php_sybase_ct.c delete mode 100644 ext/sybase_ct/php_sybase_ct.h delete mode 100644 ext/sybase_ct/sybase_ct.dsp delete mode 100644 ext/sysvmsg/CREDITS delete mode 100644 ext/sysvmsg/EXPERIMENTAL delete mode 100644 ext/sysvmsg/config.m4 delete mode 100644 ext/sysvmsg/php_sysvmsg.h delete mode 100644 ext/sysvmsg/sysvmsg.c delete mode 100644 ext/sysvmsg/tests/001.phpt delete mode 100644 ext/sysvsem/CREDITS delete mode 100644 ext/sysvsem/config.m4 delete mode 100644 ext/sysvsem/php_sysvsem.h delete mode 100644 ext/sysvsem/sysvsem.c delete mode 100644 ext/sysvsem/tests/sysv.phpt delete mode 100644 ext/sysvshm/CREDITS delete mode 100644 ext/sysvshm/config.m4 delete mode 100644 ext/sysvshm/php_sysvshm.h delete mode 100644 ext/sysvshm/sysvshm.c delete mode 100644 ext/tokenizer/CREDITS delete mode 100644 ext/tokenizer/Makefile.frag delete mode 100644 ext/tokenizer/config.m4 delete mode 100644 ext/tokenizer/php_tokenizer.h delete mode 100644 ext/tokenizer/tokenizer.c delete mode 100644 ext/tokenizer/tokenizer.dsp delete mode 100644 ext/tokenizer/tokenizer.php delete mode 100644 ext/w32api/CREDITS delete mode 100644 ext/w32api/EXPERIMENTAL delete mode 100644 ext/w32api/README delete mode 100644 ext/w32api/TODO delete mode 100644 ext/w32api/php_w32api.h delete mode 100644 ext/w32api/w32api.c delete mode 100644 ext/w32api/w32api.dsp delete mode 100644 ext/w32api/w32api_function_definition_parser.y delete mode 100644 ext/w32api/w32api_function_definition_scanner.l delete mode 100644 ext/w32api/w32api_type_definition_parser.y delete mode 100644 ext/w32api/w32api_type_definition_scanner.l delete mode 100644 ext/wddx/CREDITS delete mode 100644 ext/wddx/config.m4 delete mode 100644 ext/wddx/php_wddx.h delete mode 100644 ext/wddx/php_wddx_api.h delete mode 100644 ext/wddx/wddx.c delete mode 100644 ext/xml/CREDITS delete mode 100644 ext/xml/compat.c delete mode 100644 ext/xml/config.m4 delete mode 100644 ext/xml/expat_compat.h delete mode 100644 ext/xml/php_xml.h delete mode 100644 ext/xml/tests/inc.ent delete mode 100644 ext/xml/tests/skipif.inc delete mode 100644 ext/xml/tests/xml001.phpt delete mode 100644 ext/xml/tests/xml002.phpt delete mode 100644 ext/xml/tests/xml003.phpt delete mode 100644 ext/xml/tests/xml004.phpt delete mode 100644 ext/xml/tests/xml006.phpt delete mode 100644 ext/xml/tests/xml007.phpt delete mode 100644 ext/xml/tests/xmltest.xml delete mode 100644 ext/xml/xml.c delete mode 100644 ext/xml/xml.mak delete mode 100644 ext/xmlrpc/CREDITS delete mode 100644 ext/xmlrpc/EXPERIMENTAL delete mode 100644 ext/xmlrpc/config.m4 delete mode 100644 ext/xmlrpc/libxmlrpc/README delete mode 100644 ext/xmlrpc/libxmlrpc/acinclude.m4 delete mode 100644 ext/xmlrpc/libxmlrpc/base64.c delete mode 100644 ext/xmlrpc/libxmlrpc/base64.h delete mode 100644 ext/xmlrpc/libxmlrpc/encodings.c delete mode 100644 ext/xmlrpc/libxmlrpc/encodings.h delete mode 100644 ext/xmlrpc/libxmlrpc/queue.c delete mode 100644 ext/xmlrpc/libxmlrpc/queue.h delete mode 100644 ext/xmlrpc/libxmlrpc/simplestring.c delete mode 100644 ext/xmlrpc/libxmlrpc/simplestring.h delete mode 100644 ext/xmlrpc/libxmlrpc/system_methods.c delete mode 100644 ext/xmlrpc/libxmlrpc/system_methods_private.h delete mode 100644 ext/xmlrpc/libxmlrpc/xml_element.c delete mode 100644 ext/xmlrpc/libxmlrpc/xml_element.h delete mode 100644 ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c delete mode 100644 ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h delete mode 100644 ext/xmlrpc/libxmlrpc/xml_to_soap.c delete mode 100644 ext/xmlrpc/libxmlrpc/xml_to_soap.h delete mode 100644 ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c delete mode 100644 ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h delete mode 100644 ext/xmlrpc/libxmlrpc/xmlrpc.c delete mode 100644 ext/xmlrpc/libxmlrpc/xmlrpc.h delete mode 100644 ext/xmlrpc/libxmlrpc/xmlrpc.m4 delete mode 100644 ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c delete mode 100644 ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h delete mode 100644 ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h delete mode 100644 ext/xmlrpc/libxmlrpc/xmlrpc_private.h delete mode 100644 ext/xmlrpc/libxmlrpc/xmlrpc_win32.h delete mode 100644 ext/xmlrpc/php_xmlrpc.h delete mode 100644 ext/xmlrpc/xmlrpc-epi-php.c delete mode 100644 ext/xmlrpc/xmlrpc.dsp delete mode 100644 ext/xslt/README.XSLT-BACKENDS delete mode 100644 ext/xslt/TODO delete mode 100644 ext/xslt/config.m4 delete mode 100644 ext/xslt/php_sablot.h delete mode 100644 ext/xslt/php_xslt.h delete mode 100644 ext/xslt/sablot.c delete mode 100755 ext/xslt/tests/args.xsl delete mode 100644 ext/xslt/tests/bug17791.phpt delete mode 100644 ext/xslt/tests/bug17931.phpt delete mode 100644 ext/xslt/tests/bug20177.phpt delete mode 100644 ext/xslt/tests/bug20518.phpt delete mode 100644 ext/xslt/tests/param.xsl delete mode 100755 ext/xslt/tests/public.xml delete mode 100755 ext/xslt/tests/qa.dtd delete mode 100644 ext/xslt/tests/skipif.inc delete mode 100644 ext/xslt/tests/test.xml delete mode 100644 ext/xslt/tests/xslt-001.phpt delete mode 100644 ext/xslt/tests/xslt.phpt delete mode 100644 ext/xslt/tests/xslt_backend_info.phpt delete mode 100644 ext/xslt/tests/xslt_getopt.phpt delete mode 100644 ext/xslt/tests/xslt_process-001.phpt delete mode 100644 ext/xslt/tests/xslt_process-002.phpt delete mode 100644 ext/xslt/tests/xslt_set_object.phpt delete mode 100644 ext/xslt/tests/xslt_set_object.xsl delete mode 100644 ext/xslt/tests/xslt_set_scheme_handlers-001.phpt delete mode 100644 ext/xslt/tests/xslt_set_scheme_handlers-002.phpt delete mode 100644 ext/xslt/tests/xslt_set_scheme_handlers-003.phpt delete mode 100644 ext/xslt/tests/xslt_setopt.phpt delete mode 100644 ext/xslt/xslt.c delete mode 100644 ext/xslt/xslt.dsp delete mode 100644 ext/yaz/CREDITS delete mode 100644 ext/yaz/README delete mode 100644 ext/yaz/config.m4 delete mode 100644 ext/yaz/php_yaz.c delete mode 100644 ext/yaz/php_yaz.h delete mode 100644 ext/yaz/yaz.dsp delete mode 100644 ext/yp/CREDITS delete mode 100644 ext/yp/config.m4 delete mode 100644 ext/yp/php_yp.h delete mode 100644 ext/yp/yp.c delete mode 100644 ext/zip/CREDITS delete mode 100644 ext/zip/config.m4 delete mode 100644 ext/zip/php_zip.h delete mode 100644 ext/zip/tests/001.phpt delete mode 100644 ext/zip/zip.c delete mode 100644 ext/zip/zip.dsp delete mode 100644 ext/zlib/CREDITS delete mode 100644 ext/zlib/config0.m4 delete mode 100644 ext/zlib/php_zlib.h delete mode 100644 ext/zlib/tests/001.phpt delete mode 100644 ext/zlib/tests/002.phpt delete mode 100644 ext/zlib/tests/003.phpt delete mode 100644 ext/zlib/tests/gzreadgzwrite.phpt delete mode 100644 ext/zlib/tests/gzreadgzwriteplain.phpt delete mode 100644 ext/zlib/zlib.c delete mode 100644 ext/zlib/zlib.dsp delete mode 100644 ext/zlib/zlib_fopen_wrapper.c delete mode 100644 ext/zlib/zlib_win32_howto.txt delete mode 100644 footer delete mode 100755 genfiles delete mode 100644 header delete mode 100644 ltmain.sh delete mode 100644 main/SAPI.c delete mode 100644 main/SAPI.h delete mode 100644 main/alloca.c delete mode 100644 main/build-defs.h.in delete mode 100644 main/config.nw.h delete mode 100644 main/config.w32.h delete mode 100644 main/fopen_wrappers.c delete mode 100644 main/fopen_wrappers.h delete mode 100644 main/internal_functions.c.in delete mode 100644 main/internal_functions_nw.c delete mode 100644 main/internal_functions_registry.h delete mode 100644 main/internal_functions_win32.c delete mode 100644 main/logos.h delete mode 100644 main/main.c delete mode 100644 main/mergesort.c delete mode 100644 main/network.c delete mode 100644 main/output.c delete mode 100644 main/php.h delete mode 100644 main/php3_compat.h delete mode 100644 main/php_compat.h delete mode 100644 main/php_content_types.c delete mode 100644 main/php_content_types.h delete mode 100644 main/php_globals.h delete mode 100644 main/php_ini.c delete mode 100644 main/php_ini.h delete mode 100644 main/php_logos.c delete mode 100644 main/php_logos.h delete mode 100644 main/php_main.h delete mode 100644 main/php_memory_streams.h delete mode 100644 main/php_network.h delete mode 100644 main/php_open_temporary_file.c delete mode 100644 main/php_open_temporary_file.h delete mode 100644 main/php_output.h delete mode 100644 main/php_realpath.c delete mode 100644 main/php_reentrancy.h delete mode 100644 main/php_regex.h delete mode 100644 main/php_scandir.c delete mode 100644 main/php_scandir.h delete mode 100644 main/php_sprintf.c delete mode 100755 main/php_streams.h delete mode 100644 main/php_syslog.h delete mode 100644 main/php_ticks.c delete mode 100644 main/php_ticks.h delete mode 100644 main/php_variables.c delete mode 100644 main/php_variables.h delete mode 100644 main/php_version.h delete mode 100644 main/reentrancy.c delete mode 100644 main/rfc1867.c delete mode 100644 main/rfc1867.h delete mode 100644 main/safe_mode.c delete mode 100644 main/safe_mode.h delete mode 100644 main/snprintf.c delete mode 100644 main/snprintf.h delete mode 100644 main/spprintf.c delete mode 100644 main/spprintf.h delete mode 100644 main/streams/cast.c delete mode 100644 main/streams/filter.c delete mode 100644 main/streams/memory.c delete mode 100644 main/streams/mmap.c delete mode 100644 main/streams/php_stream_context.h delete mode 100644 main/streams/php_stream_filter_api.h delete mode 100644 main/streams/php_stream_mmap.h delete mode 100644 main/streams/php_stream_plain_wrapper.h delete mode 100644 main/streams/php_stream_transport.h delete mode 100644 main/streams/php_stream_userspace.h delete mode 100644 main/streams/php_streams_int.h delete mode 100644 main/streams/plain_wrapper.c delete mode 100755 main/streams/streams.c delete mode 100644 main/streams/transports.c delete mode 100644 main/streams/userspace.c delete mode 100644 main/streams/xp_socket.c delete mode 100644 main/strlcat.c delete mode 100644 main/strlcpy.c delete mode 100644 main/win95nt.h delete mode 100755 makedist delete mode 100644 makerpm delete mode 100644 netware/ApacheCore.imp delete mode 100755 netware/BisonExtStandard.bat delete mode 100755 netware/BisonFlexZend.bat delete mode 100644 netware/ZendEngine2.mak delete mode 100755 netware/build.bat delete mode 100755 netware/buildext.bat delete mode 100755 netware/buildlib.bat delete mode 100755 netware/buildsapi.bat delete mode 100644 netware/common.mif delete mode 100644 netware/geterrnoptr.c delete mode 100644 netware/grp.h delete mode 100644 netware/libpq-fe.h delete mode 100644 netware/libpq.imp delete mode 100644 netware/libpq/libpq-fs.h delete mode 100644 netware/mktemp.c delete mode 100644 netware/mktemp.h delete mode 100644 netware/param.h delete mode 100755 netware/php-nw.bat delete mode 100644 netware/php4apache.mak delete mode 100644 netware/php4apache2filter.mak delete mode 100644 netware/php4cli.mak delete mode 100644 netware/phplib.imp delete mode 100644 netware/phplib.mak delete mode 100644 netware/phptest.ncf delete mode 100644 netware/pipe.c delete mode 100644 netware/pipe.h delete mode 100644 netware/postgres_ext.h delete mode 100644 netware/pwd.c delete mode 100644 netware/pwd.h delete mode 100644 netware/sendmail_nw.h delete mode 100755 netware/setbuild.bat delete mode 100644 netware/start.c delete mode 100644 netware/sys/stat.h delete mode 100644 netware/sysexits.h delete mode 100644 netware/time_nw.c delete mode 100644 netware/time_nw.h delete mode 100644 netware/tsrm.mak delete mode 100644 netware/wfile.c delete mode 100644 netware/wfile.h delete mode 100644 netware/zend.mak delete mode 100644 pear/Archive/Tar.php delete mode 100644 pear/Archive/docs/Tar.txt delete mode 100755 pear/CMD.php delete mode 100644 pear/CODING_STANDARDS delete mode 100644 pear/Console/Getopt.php delete mode 100644 pear/Console/tests/001-getopt.phpt delete mode 100644 pear/Makefile.frag delete mode 100644 pear/OS/Guess.php delete mode 100644 pear/PEAR.php delete mode 100644 pear/PEAR/Autoloader.php delete mode 100644 pear/PEAR/Builder.php delete mode 100644 pear/PEAR/Command.php delete mode 100644 pear/PEAR/Command/Auth.php delete mode 100644 pear/PEAR/Command/Build.php delete mode 100644 pear/PEAR/Command/Common.php delete mode 100644 pear/PEAR/Command/Config.php delete mode 100644 pear/PEAR/Command/Install.php delete mode 100644 pear/PEAR/Command/Mirror.php delete mode 100644 pear/PEAR/Command/Package.php delete mode 100644 pear/PEAR/Command/Registry.php delete mode 100644 pear/PEAR/Command/Remote.php delete mode 100644 pear/PEAR/Common.php delete mode 100644 pear/PEAR/Config.php delete mode 100644 pear/PEAR/Dependency.php delete mode 100644 pear/PEAR/Frontend/CLI.php delete mode 100644 pear/PEAR/Installer.php delete mode 100644 pear/PEAR/Packager.php delete mode 100644 pear/PEAR/Registry.php delete mode 100644 pear/PEAR/Remote.php delete mode 100644 pear/README delete mode 100644 pear/System.php delete mode 100644 pear/catalog delete mode 100644 pear/docs/Archive_Tar.txt delete mode 100644 pear/install-pear.php delete mode 100644 pear/install-pear.txt delete mode 100644 pear/package-Archive_Tar.xml delete mode 100644 pear/package-Console_Getopt.xml delete mode 100644 pear/package-PEAR.xml delete mode 100644 pear/package.dtd delete mode 100644 pear/packages/DB-1.3.tar delete mode 100644 pear/packages/HTTP-1.2.tar delete mode 100644 pear/packages/Mail-1.0.1.tar delete mode 100644 pear/packages/Net_SMTP-1.0.tar delete mode 100644 pear/packages/Net_Socket-1.0.1.tar delete mode 100644 pear/packages/XML_Parser-1.0.1.tar delete mode 100644 pear/packages/XML_RPC-1.0.4.tar delete mode 100755 pear/scripts/pear.bat delete mode 100644 pear/scripts/pear.sh delete mode 100644 pear/scripts/pearcmd.php delete mode 100644 pear/scripts/pearwin.php delete mode 100644 pear/template.spec delete mode 100644 pear/tests/merge.input delete mode 100644 pear/tests/pear1.phpt delete mode 100644 pear/tests/pear_autoloader.phpt delete mode 100644 pear/tests/pear_config.phpt delete mode 100644 pear/tests/pear_error.phpt delete mode 100644 pear/tests/pear_error2.phpt delete mode 100644 pear/tests/pear_error3.phpt delete mode 100644 pear/tests/pear_error4.phpt delete mode 100644 pear/tests/pear_registry.phpt delete mode 100644 pear/tests/pear_system.phpt delete mode 100644 pear/tests/php.ini delete mode 100644 pear/tests/system.input delete mode 100644 pear/tests/toonew.conf delete mode 100644 pear/tests/user.input delete mode 100644 pear/tests/user2.input delete mode 100644 php.gif delete mode 100644 php.ini-dist delete mode 100644 php.ini-recommended delete mode 100644 php4.spec.in delete mode 100644 regex/COPYRIGHT delete mode 100644 regex/README delete mode 100644 regex/WHATSNEW delete mode 100644 regex/cclass.h delete mode 100644 regex/cname.h delete mode 100644 regex/debug.c delete mode 100644 regex/debug.ih delete mode 100644 regex/engine.c delete mode 100644 regex/engine.ih delete mode 100644 regex/main.c delete mode 100644 regex/main.ih delete mode 100644 regex/mkh delete mode 100644 regex/regcomp.c delete mode 100644 regex/regcomp.ih delete mode 100644 regex/regerror.c delete mode 100644 regex/regerror.ih delete mode 100644 regex/regex.3 delete mode 100644 regex/regex.7 delete mode 100644 regex/regex.dsp delete mode 100644 regex/regex.dsw delete mode 100644 regex/regex.h delete mode 100644 regex/regex.mak delete mode 100644 regex/regex2.h delete mode 100644 regex/regex_extra.h delete mode 100644 regex/regexec.c delete mode 100644 regex/regfree.c delete mode 100644 regex/split.c delete mode 100644 regex/tests delete mode 100644 regex/utils.h delete mode 100644 run-tests-config.php delete mode 100755 run-tests.php delete mode 100644 run-tests2.php delete mode 100644 sapi/activescript/CREDITS delete mode 100644 sapi/activescript/EXPERIMENTAL delete mode 100644 sapi/activescript/README delete mode 100644 sapi/activescript/classfactory.cpp delete mode 100644 sapi/activescript/php4activescript.c delete mode 100644 sapi/activescript/php4activescript.def delete mode 100644 sapi/activescript/php4activescript.dsp delete mode 100644 sapi/activescript/php4activescript.h delete mode 100644 sapi/activescript/php4as_classfactory.h delete mode 100644 sapi/activescript/php4as_scriptengine.h delete mode 100644 sapi/activescript/scriptengine.cpp delete mode 100644 sapi/aolserver/CREDITS delete mode 100644 sapi/aolserver/README delete mode 100644 sapi/aolserver/aolserver.c delete mode 100644 sapi/aolserver/config.m4 delete mode 100644 sapi/aolserver/php.sym delete mode 100644 sapi/aolserver/php4aolserver.dsp delete mode 100644 sapi/apache/CREDITS delete mode 100644 sapi/apache/apMakefile.libdir delete mode 100644 sapi/apache/apMakefile.tmpl delete mode 100644 sapi/apache/config.m4 delete mode 100644 sapi/apache/libphp5.module.in delete mode 100644 sapi/apache/libpre.c delete mode 100644 sapi/apache/mod_php5.c delete mode 100644 sapi/apache/mod_php5.exp delete mode 100644 sapi/apache/mod_php5.h delete mode 100644 sapi/apache/php.sym delete mode 100644 sapi/apache/php4apache.dsp delete mode 100644 sapi/apache/php_apache.c delete mode 100644 sapi/apache/php_apache_http.h delete mode 100644 sapi/apache/sapi_apache.c delete mode 100644 sapi/apache2filter/CREDITS delete mode 100644 sapi/apache2filter/EXPERIMENTAL delete mode 100644 sapi/apache2filter/README delete mode 100644 sapi/apache2filter/apache_config.c delete mode 100644 sapi/apache2filter/config.m4 delete mode 100644 sapi/apache2filter/php.sym delete mode 100644 sapi/apache2filter/php_apache.h delete mode 100644 sapi/apache2filter/php_functions.c delete mode 100644 sapi/apache2filter/sapi_apache2.c delete mode 100644 sapi/apache2handler/CREDITS delete mode 100644 sapi/apache2handler/EXPERIMENTAL delete mode 100644 sapi/apache2handler/README delete mode 100644 sapi/apache2handler/apache_config.c delete mode 100644 sapi/apache2handler/config.m4 delete mode 100644 sapi/apache2handler/php.sym delete mode 100644 sapi/apache2handler/php4apache2.dsp delete mode 100644 sapi/apache2handler/php_apache.h delete mode 100644 sapi/apache2handler/php_functions.c delete mode 100644 sapi/apache2handler/sapi_apache2.c delete mode 100644 sapi/apache_hooks/CREDITS delete mode 100644 sapi/apache_hooks/README delete mode 100644 sapi/apache_hooks/apMakefile.libdir delete mode 100644 sapi/apache_hooks/apMakefile.tmpl delete mode 100644 sapi/apache_hooks/config.m4 delete mode 100644 sapi/apache_hooks/libphp4.module.in delete mode 100644 sapi/apache_hooks/mod_php4.c delete mode 100644 sapi/apache_hooks/mod_php4.exp delete mode 100644 sapi/apache_hooks/mod_php4.h delete mode 100644 sapi/apache_hooks/php.sym delete mode 100755 sapi/apache_hooks/php4apache_hooks.dsp delete mode 100644 sapi/apache_hooks/php_apache.c delete mode 100644 sapi/apache_hooks/php_apache_http.h delete mode 100644 sapi/apache_hooks/sapi_apache.c delete mode 100644 sapi/caudium/CREDITS delete mode 100644 sapi/caudium/README delete mode 100644 sapi/caudium/TODO delete mode 100644 sapi/caudium/caudium.c delete mode 100644 sapi/caudium/config.m4 delete mode 100644 sapi/cgi/CREDITS delete mode 100644 sapi/cgi/Makefile.frag delete mode 100644 sapi/cgi/README.FastCGI delete mode 100644 sapi/cgi/cgi_main.c delete mode 100644 sapi/cgi/config9.m4 delete mode 100644 sapi/cgi/getopt.c delete mode 100644 sapi/cgi/libfcgi/LICENSE.TERMS delete mode 100644 sapi/cgi/libfcgi/acinclude.m4 delete mode 100644 sapi/cgi/libfcgi/fcgi_stdio.c delete mode 100644 sapi/cgi/libfcgi/fcgiapp.c delete mode 100644 sapi/cgi/libfcgi/include/fastcgi.h delete mode 100644 sapi/cgi/libfcgi/include/fcgi_config.h delete mode 100644 sapi/cgi/libfcgi/include/fcgi_config_win32.h delete mode 100644 sapi/cgi/libfcgi/include/fcgi_config_x86.h delete mode 100644 sapi/cgi/libfcgi/include/fcgi_stdio.h delete mode 100644 sapi/cgi/libfcgi/include/fcgiapp.h delete mode 100644 sapi/cgi/libfcgi/include/fcgiappmisc.h delete mode 100644 sapi/cgi/libfcgi/include/fcgimisc.h delete mode 100644 sapi/cgi/libfcgi/include/fcgio.h delete mode 100644 sapi/cgi/libfcgi/include/fcgios.h delete mode 100644 sapi/cgi/libfcgi/libfcgi.m4 delete mode 100644 sapi/cgi/libfcgi/os_unix.c delete mode 100644 sapi/cgi/libfcgi/os_win32.c delete mode 100644 sapi/cgi/libfcgi/strerror.c delete mode 100644 sapi/cgi/php.sym delete mode 100644 sapi/cgi/php_getopt.h delete mode 100644 sapi/cli/CREDITS delete mode 100644 sapi/cli/Makefile.frag delete mode 100644 sapi/cli/README delete mode 100644 sapi/cli/TODO delete mode 100644 sapi/cli/config.m4 delete mode 100644 sapi/cli/getopt.c delete mode 100644 sapi/cli/php.1.in delete mode 100644 sapi/cli/php_cli.c delete mode 100644 sapi/cli/php_getopt.h delete mode 100644 sapi/embed/CREDITS delete mode 100644 sapi/embed/EXPERIMENTAL delete mode 100644 sapi/embed/config.m4 delete mode 100644 sapi/embed/php4embed.dsp delete mode 100644 sapi/embed/php_embed.c delete mode 100644 sapi/embed/php_embed.h delete mode 100644 sapi/isapi/CREDITS delete mode 100644 sapi/isapi/config.m4 delete mode 100644 sapi/isapi/php.sym delete mode 100644 sapi/isapi/php4isapi.c delete mode 100644 sapi/isapi/php4isapi.def delete mode 100644 sapi/isapi/php4isapi.dsp delete mode 100644 sapi/isapi/stresstest/getopt.c delete mode 100644 sapi/isapi/stresstest/getopt.h delete mode 100644 sapi/isapi/stresstest/notes.txt delete mode 100644 sapi/isapi/stresstest/stresstest.cpp delete mode 100644 sapi/isapi/stresstest/stresstest.dsp delete mode 100644 sapi/milter/CREDITS delete mode 100644 sapi/milter/EXPERIMENTAL delete mode 100644 sapi/milter/Makefile.frag delete mode 100644 sapi/milter/TODO delete mode 100644 sapi/milter/config.m4 delete mode 100644 sapi/milter/getopt.c delete mode 100644 sapi/milter/milter.php delete mode 100644 sapi/milter/php_getopt.h delete mode 100644 sapi/milter/php_milter.c delete mode 100644 sapi/milter/php_milter.h delete mode 100644 sapi/nsapi/CREDITS delete mode 100644 sapi/nsapi/config.m4 delete mode 100644 sapi/nsapi/nsapi-readme.txt delete mode 100644 sapi/nsapi/nsapi.c delete mode 100644 sapi/nsapi/php4nsapi.dsp delete mode 100644 sapi/phttpd/CREDITS delete mode 100644 sapi/phttpd/README delete mode 100644 sapi/phttpd/config.m4 delete mode 100644 sapi/phttpd/php.sym delete mode 100644 sapi/phttpd/php_phttpd.h delete mode 100644 sapi/phttpd/phttpd.c delete mode 100644 sapi/pi3web/CREDITS delete mode 100644 sapi/pi3web/README delete mode 100644 sapi/pi3web/config.m4 delete mode 100644 sapi/pi3web/php.sym delete mode 100644 sapi/pi3web/php4pi3web.dsp delete mode 100644 sapi/pi3web/pi3web_sapi.c delete mode 100644 sapi/pi3web/pi3web_sapi.h delete mode 100644 sapi/roxen/README delete mode 100644 sapi/roxen/TODO delete mode 100644 sapi/roxen/config.m4 delete mode 100644 sapi/roxen/roxen.c delete mode 100644 sapi/servlet/CREDITS delete mode 100644 sapi/servlet/EXPERIMENTAL delete mode 100644 sapi/servlet/Makefile.frag delete mode 100644 sapi/servlet/README delete mode 100644 sapi/servlet/config.m4 delete mode 100644 sapi/servlet/cookies.php delete mode 100644 sapi/servlet/date.php delete mode 100644 sapi/servlet/formatter.java delete mode 100644 sapi/servlet/jinfo.php delete mode 100644 sapi/servlet/jver.php delete mode 100644 sapi/servlet/reqheaders.php delete mode 100644 sapi/servlet/reqinfo.php delete mode 100644 sapi/servlet/reqparams.php delete mode 100644 sapi/servlet/servlet.c delete mode 100644 sapi/servlet/servlet.dsp delete mode 100644 sapi/servlet/servlet.java delete mode 100644 sapi/servlet/sessions.php delete mode 100644 sapi/servlet/web.xml delete mode 100644 sapi/tests/test001.phpt delete mode 100644 sapi/tests/test002.phpt delete mode 100644 sapi/tests/test003.phpt delete mode 100644 sapi/tests/test004.phpt delete mode 100644 sapi/tests/test005.phpt delete mode 100644 sapi/tests/test006.phpt delete mode 100644 sapi/tests/test007.phpt delete mode 100644 sapi/thttpd/CREDITS delete mode 100644 sapi/thttpd/README delete mode 100644 sapi/thttpd/config.m4 delete mode 100644 sapi/thttpd/php.sym delete mode 100644 sapi/thttpd/php_thttpd.h delete mode 100644 sapi/thttpd/stub.c delete mode 100644 sapi/thttpd/thttpd.c delete mode 100644 sapi/thttpd/thttpd_patch delete mode 100644 sapi/tux/CREDITS delete mode 100644 sapi/tux/README delete mode 100644 sapi/tux/config.m4 delete mode 100644 sapi/tux/php.sym delete mode 100644 sapi/tux/php_tux.c delete mode 100644 sapi/webjames/CREDITS delete mode 100644 sapi/webjames/README delete mode 100644 sapi/webjames/config.m4 delete mode 100644 sapi/webjames/php_webjames.h delete mode 100644 sapi/webjames/webjames.c delete mode 100644 scan_makefile_in.awk delete mode 100644 scripts/Makefile.frag delete mode 100755 scripts/apache/apconf-conv.sh delete mode 100755 scripts/apache/aphtaccess-conv.sh delete mode 100644 scripts/apache/conffix.awk delete mode 100644 scripts/apache/htaccessfix.awk delete mode 100755 scripts/dev/conv_proto delete mode 100755 scripts/dev/conv_z_macros delete mode 100755 scripts/dev/credits delete mode 100644 scripts/ext_skel_ng/README delete mode 100644 scripts/ext_skel_ng/TODO delete mode 100644 scripts/ext_skel_ng/config_m4.php delete mode 100644 scripts/ext_skel_ng/dummy.gif delete mode 100644 scripts/ext_skel_ng/ext_skel_ng.php delete mode 100644 scripts/ext_skel_ng/extension.dtd delete mode 100644 scripts/ext_skel_ng/extension.xml delete mode 100644 scripts/ext_skel_ng/extension_parser.php delete mode 100644 scripts/ext_skel_ng/license.php delete mode 100644 scripts/ext_skel_ng/license_bsd.php delete mode 100644 scripts/ext_skel_ng/license_lgpl.php delete mode 100644 scripts/ext_skel_ng/license_php.php delete mode 100644 scripts/ext_skel_ng/php_constant.php delete mode 100644 scripts/ext_skel_ng/php_element.php delete mode 100644 scripts/ext_skel_ng/php_function.php delete mode 100644 scripts/ext_skel_ng/php_global.php delete mode 100644 scripts/ext_skel_ng/php_ini.php delete mode 100644 scripts/ext_skel_ng/php_logo.php delete mode 100644 scripts/ext_skel_ng/php_resource.php delete mode 100644 scripts/ext_skel_ng/xml_stream_callback_parser.php delete mode 100644 scripts/ext_skel_ng/xml_stream_parser.php delete mode 100644 scripts/php-config.in delete mode 100755 scripts/phpextdist delete mode 100644 scripts/phpize.in delete mode 100644 scripts/phpize.m4 delete mode 100755 snapshot delete mode 100644 stamp-h.in delete mode 100644 strtok_r.c delete mode 100644 stub.c delete mode 100644 tests/basic/001.phpt delete mode 100644 tests/basic/002.phpt delete mode 100644 tests/basic/003.phpt delete mode 100644 tests/basic/004.phpt delete mode 100644 tests/basic/005.phpt delete mode 100644 tests/basic/006.phpt delete mode 100644 tests/basic/007.phpt delete mode 100644 tests/basic/008.phpt delete mode 100644 tests/basic/009.phpt delete mode 100644 tests/basic/010.phpt delete mode 100644 tests/basic/011.phpt delete mode 100644 tests/basic/012.phpt delete mode 100644 tests/basic/bug20539.phpt delete mode 100644 tests/bin-info.inc delete mode 100644 tests/classes/__call_001.phpt delete mode 100644 tests/classes/__clone_001.phpt delete mode 100644 tests/classes/__set__get_001.phpt delete mode 100644 tests/classes/abstract.phpt delete mode 100644 tests/classes/abstract_class.phpt delete mode 100644 tests/classes/abstract_final.phpt delete mode 100644 tests/classes/abstract_inherit.phpt delete mode 100644 tests/classes/abstract_not_declared.phpt delete mode 100644 tests/classes/abstract_redeclare.phpt delete mode 100644 tests/classes/abstract_static.phpt delete mode 100644 tests/classes/bug20120.phpt delete mode 100644 tests/classes/class_example.phpt delete mode 100644 tests/classes/constants_scope_001.phpt delete mode 100644 tests/classes/ctor_dtor.phpt delete mode 100644 tests/classes/ctor_dtor_inheritance.phpt delete mode 100644 tests/classes/dereferencing_001.phpt delete mode 100644 tests/classes/factory_001.phpt delete mode 100644 tests/classes/final.phpt delete mode 100644 tests/classes/final_abstract.phpt delete mode 100644 tests/classes/final_redeclare.phpt delete mode 100644 tests/classes/inheritance.phpt delete mode 100755 tests/classes/inheritance_002.phpt delete mode 100644 tests/classes/interface_class.phpt delete mode 100644 tests/classes/interface_doubled.phpt delete mode 100644 tests/classes/interface_implemented.phpt delete mode 100644 tests/classes/interface_instantiate.phpt delete mode 100644 tests/classes/interface_member.phpt delete mode 100644 tests/classes/interface_method.phpt delete mode 100644 tests/classes/interface_method_final.phpt delete mode 100644 tests/classes/interface_method_private.phpt delete mode 100644 tests/classes/interface_must_be_implemented.phpt delete mode 100644 tests/classes/interfaces_001.phpt delete mode 100644 tests/classes/interfaces_002.phpt delete mode 100644 tests/classes/object_reference_001.phpt delete mode 100644 tests/classes/private_001.phpt delete mode 100644 tests/classes/private_002.phpt delete mode 100644 tests/classes/private_003.phpt delete mode 100644 tests/classes/private_003b.phpt delete mode 100644 tests/classes/private_004.phpt delete mode 100644 tests/classes/private_004b.phpt delete mode 100644 tests/classes/private_005.phpt delete mode 100644 tests/classes/private_005b.phpt delete mode 100644 tests/classes/private_006.phpt delete mode 100644 tests/classes/private_006b.phpt delete mode 100644 tests/classes/private_007.phpt delete mode 100644 tests/classes/private_007b.phpt delete mode 100644 tests/classes/protected_001.phpt delete mode 100644 tests/classes/protected_001b.phpt delete mode 100644 tests/classes/protected_002.phpt delete mode 100644 tests/classes/singleton_001.phpt delete mode 100644 tests/classes/static_mix_1.phpt delete mode 100644 tests/classes/static_mix_2.phpt delete mode 100644 tests/classes/type_hinting_001.phpt delete mode 100644 tests/classes/visibility_000a.phpt delete mode 100644 tests/classes/visibility_000b.phpt delete mode 100644 tests/classes/visibility_000c.phpt delete mode 100644 tests/classes/visibility_001a.phpt delete mode 100644 tests/classes/visibility_001b.phpt delete mode 100644 tests/classes/visibility_001c.phpt delete mode 100644 tests/classes/visibility_002a.phpt delete mode 100644 tests/classes/visibility_002b.phpt delete mode 100644 tests/classes/visibility_002c.phpt delete mode 100644 tests/classes/visibility_003a.phpt delete mode 100644 tests/classes/visibility_003b.phpt delete mode 100644 tests/classes/visibility_003c.phpt delete mode 100644 tests/classes/visibility_004a.phpt delete mode 100644 tests/classes/visibility_004b.phpt delete mode 100644 tests/classes/visibility_004c.phpt delete mode 100644 tests/foo delete mode 100644 tests/foo2 delete mode 100644 tests/foo3 delete mode 100644 tests/foo4 delete mode 100644 tests/func/001.phpt delete mode 100644 tests/func/002.phpt delete mode 100644 tests/func/003.phpt delete mode 100644 tests/func/004.phpt delete mode 100644 tests/func/005.phpt delete mode 100644 tests/func/005a.phpt delete mode 100644 tests/func/006.phpt delete mode 100644 tests/func/007.phpt delete mode 100644 tests/func/008.phpt delete mode 100644 tests/func/009.phpt delete mode 100644 tests/lang/001.phpt delete mode 100644 tests/lang/002.phpt delete mode 100644 tests/lang/003.phpt delete mode 100644 tests/lang/004.phpt delete mode 100644 tests/lang/005.phpt delete mode 100644 tests/lang/006.phpt delete mode 100644 tests/lang/007.phpt delete mode 100644 tests/lang/008.phpt delete mode 100644 tests/lang/009.phpt delete mode 100644 tests/lang/010.phpt delete mode 100644 tests/lang/011.phpt delete mode 100644 tests/lang/012.phpt delete mode 100644 tests/lang/013.phpt delete mode 100644 tests/lang/014.phpt delete mode 100755 tests/lang/015.inc delete mode 100644 tests/lang/015.phpt delete mode 100755 tests/lang/016.inc delete mode 100644 tests/lang/016.phpt delete mode 100644 tests/lang/017.phpt delete mode 100644 tests/lang/018.phpt delete mode 100644 tests/lang/019.phpt delete mode 100644 tests/lang/020.phpt delete mode 100644 tests/lang/021.phpt delete mode 100644 tests/lang/022.phpt delete mode 100755 tests/lang/023-1.inc delete mode 100755 tests/lang/023-2.inc delete mode 100644 tests/lang/023.phpt delete mode 100644 tests/lang/024.phpt delete mode 100644 tests/lang/025.phpt delete mode 100644 tests/lang/026.phpt delete mode 100644 tests/lang/027.phpt delete mode 100644 tests/lang/028.phpt delete mode 100644 tests/lang/030.phpt delete mode 100644 tests/lang/031.phpt delete mode 100644 tests/lang/032.phpt delete mode 100644 tests/lang/033.phpt delete mode 100644 tests/lang/034.phpt delete mode 100644 tests/lang/035.phpt delete mode 100644 tests/lang/bison1.phpt delete mode 100644 tests/lang/bug19566.phpt delete mode 100644 tests/lang/bug19943.phpt delete mode 100644 tests/lang/bug20175.phpt delete mode 100644 tests/lang/bug21094.phpt delete mode 100644 tests/lang/bug21600.phpt delete mode 100644 tests/lang/bug21800.phpt delete mode 100644 tests/lang/bug21820.phpt delete mode 100644 tests/lang/bug21849.phpt delete mode 100644 tests/lang/bug21961.phpt delete mode 100644 tests/lang/bug22231.phpt delete mode 100644 tests/lang/bug22367.phpt delete mode 100644 tests/lang/bug22510.phpt delete mode 100644 tests/lang/bug22592.phpt delete mode 100644 tests/lang/bug23489.phpt delete mode 100644 tests/lang/bug23584.phpt delete mode 100644 tests/lang/bug7515.phpt delete mode 100644 tests/lang/error_2_exception_001.phpt delete mode 100644 tests/lang/namespace_001.phpt delete mode 100644 tests/lang/type_hints_001.phpt delete mode 100644 tests/odbc-display.php delete mode 100644 tests/odbc-t1.php delete mode 100644 tests/odbc-t2.php delete mode 100644 tests/odbc-t3.php delete mode 100644 tests/odbc-t4.php delete mode 100644 tests/odbc-t5.php delete mode 100644 tests/quicktester.inc delete mode 100644 tests/recurse delete mode 100644 tests/run-test/test001.phpt delete mode 100644 tests/run-test/test002.phpt delete mode 100644 tests/run-test/test003.phpt delete mode 100644 tests/run-test/test004.phpt delete mode 100644 tests/run-test/test005.phpt delete mode 100644 tests/run-test/test006.phpt delete mode 100644 tests/run-test/test007.phpt delete mode 100644 tests/run-test/test008.phpt delete mode 100644 tests/run-test/test008a.phpt delete mode 100644 tests/run.html delete mode 100644 tests/run.php delete mode 100644 tests/scan_cases delete mode 100644 tests/strings/001.phpt delete mode 100644 tests/strings/002.phpt delete mode 100644 tests/strings/004.phpt delete mode 100644 tests/test.php4 delete mode 100644 tests/test.pl delete mode 100644 tests/test_class_inheritance delete mode 100644 tests/testarray delete mode 100644 tests/testarray.pl delete mode 100644 tests/testarray2 delete mode 100644 tests/testarray2.pl delete mode 100644 tests/testclassfunc delete mode 100644 tests/testcom delete mode 100644 tests/testcpdf delete mode 100644 tests/testcpdfclock delete mode 100644 tests/testdom delete mode 100644 tests/testfe delete mode 100644 tests/testfunc delete mode 100644 tests/testfunc.pl delete mode 100644 tests/testfunc2 delete mode 100644 tests/testfunc2.pl delete mode 100644 tests/testfuncref delete mode 100644 tests/testhyperwave delete mode 100644 tests/testinclude delete mode 100644 tests/testobj delete mode 100644 tests/testpfpro.php delete mode 100644 tests/tests.dsp delete mode 100644 tests/tests.mak delete mode 100644 tests/testscanf.php delete mode 100644 tests/testswf delete mode 100644 win32/crypt_win32.c delete mode 100644 win32/crypt_win32.h delete mode 100644 win32/flock.c delete mode 100644 win32/flock.h delete mode 100644 win32/glob.c delete mode 100644 win32/glob.h delete mode 100644 win32/grp.h delete mode 100644 win32/install.txt delete mode 100644 win32/installer/README delete mode 100644 win32/installer/gen-nsis.php delete mode 100644 win32/installer/setini.php delete mode 100644 win32/md5crypt.c delete mode 100644 win32/md5crypt.h delete mode 100644 win32/param.h delete mode 100644 win32/php4.dsp delete mode 100644 win32/php4.dsw delete mode 100644 win32/php4dll.dsp delete mode 100644 win32/php4dllts.dsp delete mode 100644 win32/php4dllts.rc delete mode 100644 win32/php4dllts.rc2 delete mode 100644 win32/php4ts.dsp delete mode 100644 win32/php4ts.rc delete mode 100644 win32/php4ts.rc2 delete mode 100644 win32/php4ts_cli.dsp delete mode 100644 win32/php4ts_cli.rc delete mode 100644 win32/php4ts_cli.rc2 delete mode 100644 win32/php5ts.dsw delete mode 100644 win32/php_modules.dsw delete mode 100644 win32/php_registry.h delete mode 100644 win32/pwd.c delete mode 100644 win32/pwd.h delete mode 100644 win32/pws-php4cgi.reg delete mode 100644 win32/pws-php4isapi.reg delete mode 100644 win32/readdir.c delete mode 100644 win32/readdir.h delete mode 100644 win32/registry.c delete mode 100644 win32/resource.h delete mode 100644 win32/select.c delete mode 100644 win32/select.h delete mode 100644 win32/sendmail.c delete mode 100644 win32/sendmail.h delete mode 100644 win32/signal.h delete mode 100644 win32/syslog.h delete mode 100644 win32/testsuite.dsp delete mode 100644 win32/time.c delete mode 100644 win32/time.h delete mode 100644 win32/unistd.h delete mode 100644 win32/wfile.c delete mode 100644 win32/wfile.h delete mode 100644 win32/winutil.c delete mode 100644 win32/winutil.h delete mode 100644 win32/wsyslog.c diff --git a/.gdbinit b/.gdbinit deleted file mode 100644 index 1174b900f1..0000000000 --- a/.gdbinit +++ /dev/null @@ -1,348 +0,0 @@ -set $zts = 0 - -define ____executor_globals - if $zts - set $eg = ((zend_executor_globals) (*((void ***) tsrm_ls))[executor_globals_id-1]) - else - set $eg = executor_globals - end -end - -document ____executor_globals - portable way of accessing executor_globals - type "set $zts = 1" if you use --enable-maintainer-zts on your configure line -end - -define dump_bt - set $t = $arg0 - while $t - printf "[0x%08x] ", $t - if $t->function_state.function->common.function_name - printf "%s() ", $t->function_state.function->common.function_name - else - printf "??? " - end - if $t->op_array != 0 - printf "%s:%d ", $t->op_array->filename, $t->opline->lineno - end - set $t = $t->prev_execute_data - printf "\n" - end -end - -document dump_bt - dumps the current execution stack. usage: dump_bt executor_globals.current_execute_data -end - -define printzv - set $ind = 1 - ____printzv $arg0 0 -end - -document printzv - prints content of zval -end - -define ____printzv_contents - ____executor_globals - set $zvalue = $arg0 - - if $zvalue.type == 0 - set $typename = "NULL" - end - if $zvalue.type == 1 - set $typename = "long" - end - if $zvalue.type == 2 - set $typename = "double" - end - if $zvalue.type == 3 - set $typename = "string" - end - if $zvalue.type == 4 - set $typename = "array" - end - if $zvalue.type == 5 - set $typename = "object" - end - if $zvalue.type == 6 - set $typename = "bool" - end - if $zvalue.type == 7 - set $typename = "resource" - end - if $zvalue.type == 8 - set $typename = "constant" - end - if $zvalue.type == 9 - set $typename = "const_array" - end - - printf "(refcount=%d) %s: ", $zvalue.refcount, $typename - if $zvalue.type == 1 - printf "%ld", $zvalue.value.lval - end - if $zvalue->type == 2 - printf "%lf", $zvalue.value.dval - end - if $zvalue.type == 3 - printf "\"%s\"(%d)", $zvalue.value.str.val, $zvalue.value.str.len - end - if $zvalue.type == 4 - if ! $arg1 - printf "{\n" - set $ind = $ind + 1 - ____print_ht $zvalue.value.ht - set $ind = $ind - 1 - set $i = $ind - while $i > 0 - printf " " - set $i = $i - 1 - end - printf "}" - end - end - if $zvalue.type == 5 - if ! $arg1 - printf "(prop examination disabled due to a gdb bug)" - if $zvalue.value.obj.handlers->get_properties -# set $ht = $zvalue->value.obj.handlers->get_properties($zvalue) -# printf "{\n" -# set $ind = $ind + 1 -# ____print_ht $ht -# set $ind = $ind - 1 -# set $i = $ind -# while $i > 0 -# printf " " -# set $i = $i - 1 -# end -# printf "}" - end - end - end - if $zvalue.type == 6 - if $zvalue.value.lval - printf "true" - else - printf "false" - end - end - if $zvalue.type == 7 - printf "#%d", $zvalue.value.lval - end - printf "\n" -end - -define ____printzv - ____executor_globals - set $zvalue = $arg0 - - printf "[0x%08x] ", $zvalue - - if $zvalue == $eg.uninitialized_zval_ptr - printf "*uninitialized* " - end - - set $zcontents = *(struct _zval_struct *) $zvalue - if $arg1 - ____printzv_contents $zcontents $arg1 - else - ____printzv_contents $zcontents 0 - end -end - -define ____print_const_table - set $ht = $arg0 - set $p = $ht->pListHead - - while $p != 0 - set $const = *(zend_constant *) $p->pData - - set $i = $ind - while $i > 0 - printf " " - set $i = $i - 1 - end - - if $p->nKeyLength > 0 - printf "\"%s\" => ", $p->arKey - else - printf "%d => ", $p->h - end - - ____printzv_contents $const.value 0 - set $p = $p->pListNext - end -end - -define print_const_table - set $ind = 1 - printf "[0x%08x] {\n", $arg0 - ____print_const_table $arg0 - printf "}\n" -end - -define ____print_ht - set $ht = $arg0 - set $p = $ht->pListHead - - while $p != 0 - set $zval = *(struct _zval_struct **)$p->pData - - set $i = $ind - while $i > 0 - printf " " - set $i = $i - 1 - end - - if $p->nKeyLength > 0 - printf "\"%s\" => ", $p->arKey - else - printf "%d => ", $p->h - end - - ____printzv $zval 1 - set $p = $p->pListNext - end -end - -define print_ht - set $ind = 1 - printf "[0x%08x] {\n", $arg0 - ____print_ht $arg0 - printf "}\n" -end - -document print_ht - dumps elements of HashTable made of zval -end - -define printzn - ____executor_globals - set $ind = 0 - set $znode = $arg0 - if $znode->op_type == 1 - set $optype = "IS_CONST" - end - if $znode->op_type == 2 - set $optype = "IS_TMP_VAR" - end - if $znode->op_type == 4 - set $optype = "IS_VAR" - end - if $znode->op_type == 8 - set $optype = "IS_UNUSED" - end - - printf "[0x%08x] %s", $znode, $optype - - if $znode->op_type == 1 - printf ": " - ____printzv &$znode->u.constant 0 - end - if $znode->op_type == 2 - printf ": " - set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var) - ____printzv ((union _temp_variable *)$tvar)->tmp_var 0 - end - if $znode->op_type == 4 - printf ": " - set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var) - ____printzv *$tvar->var.ptr_ptr 0 - end - if $znode->op_type == 8 - printf "\n" - end -end - -document printzn - print type and content of znode. - usage: printzn &opline->op1 -end - -define printzops - printf "op1 => " - printzn &execute_data->opline.op1 - printf "op2 => " - printzn &execute_data->opline.op2 - printf "result => " - printzn &execute_data->opline.result -end - -document printzops - dump operands of the current opline -end - -define zmemcheck - set $p = alloc_globals.head - set $stat = "?" - set $total_size = 0 - if $arg0 != 0 - set $not_found = 1 - else - set $not_found = 0 - end - printf " block size status file:line\n" - printf "-------------------------------------------------------------------------------\n" - while $p - set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test) - if $arg0 == 0 || (void *)$aptr == (void *)$arg0 - if $p->magic == 0x7312f8dc - set $stat = "OK" - end - if $p->magic == 0x99954317 - set $stat = "FREED" - end - if $p->magic == 0xfb8277dc - set $stat = "CACHED" - end - set $filename = strrchr($p->filename, '/') - if !$filename - set $filename = $p->filename - else - set $filename = $filename + 1 - end - printf " 0x%08x ", $aptr - if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10 - printf "ZVAL?(%-2d) ", $p->size - else - printf "%-9d ", $p->size - end - set $total_size = $total_size + $p->size - printf "%-06s %s:%d", $stat, $filename, $p->lineno - if $p->orig_filename - set $orig_filename = strrchr($p->orig_filename, '/') - if !$orig_filename - set $orig_filename = $p->orig_filename - else - set $orig_filename = $orig_filename + 1 - end - printf " <= %s:%d\n", $orig_filename, $p->orig_lineno - else - printf "\n" - end - if $arg0 != 0 - set $p = 0 - set $not_found = 0 - else - set $p = $p->pNext - end - else - set $p = $p->pNext - end - end - if $not_found - printf "no such block that begins at 0x%08x.\n", $aptr - end - if $arg0 == 0 - printf "-------------------------------------------------------------------------------\n" - printf " total: %d bytes\n", $total_size - end -end - -document zmemcheck - show status of a memory block. - usage: zmemcheck [ptr]. - if ptr is 0, all blocks will be listed. -end - diff --git a/CODING_STANDARDS b/CODING_STANDARDS deleted file mode 100644 index 12fbd3a0f1..0000000000 --- a/CODING_STANDARDS +++ /dev/null @@ -1,240 +0,0 @@ -PHP Coding Standards -==================== - - -This file lists several standards that any programmer, adding or changing -code in PHP, should follow. Since this file was added at a very late -stage of the development of PHP v3.0, the code base does not (yet) fully -follow it, but it's going in that general direction. Since we are now -well into the version 4 releases, many sections have been recoded to use -these rules. - - -Code Implementation -------------------- - -[0] Document your code in source files and the manual. [tm] - -[1] Functions that are given pointers to resources should not free them - -For instance, function int mail(char *to, char *from) should NOT free -to and/or from. -Exceptions: - - - The function's designated behavior is freeing that resource. E.g. efree() - - The function is given a boolean argument, that controls whether or not - the function may free its arguments (if true - the function must free its - arguments, if false - it must not) - - Low-level parser routines, that are tightly integrated with the token - cache and the bison code for minimum memory copying overhead. - -[2] Functions that are tightly integrated with other functions within the - same module, and rely on each other non-trivial behavior, should be - documented as such and declared 'static'. They should be avoided if - possible. - -[3] Use definitions and macros whenever possible, so that constants have - meaningful names and can be easily manipulated. The only exceptions - to this rule are 0 and 1, when used as false and true (respectively). - Any other use of a numeric constant to specify different behavior - or actions should be done through a #define. - -[4] When writing functions that deal with strings, be sure to remember - that PHP holds the length property of each string, and that it - shouldn't be calculated with strlen(). Write your functions in a such - a way so that they'll take advantage of the length property, both - for efficiency and in order for them to be binary-safe. - Functions that change strings and obtain their new lengths while - doing so, should return that new length, so it doesn't have to be - recalculated with strlen() (e.g. php_addslashes()) - -[5] NEVER USE strncat(). If you're absolutely sure you know what you're doing, - check its man page again, and only then, consider using it, and even then, - try avoiding it. - -[6] Use PHP_* macros in the PHP source, and ZEND_* macros in the Zend - part of the source. Although the PHP_* macro's are mostly aliased to the - ZEND_* macros it gives a better understanding on what kind of macro you're - calling. - -[7] When commenting out code using a #if statement, do NOT use 0 only. Instead - use "_0". For example, #if FOO_0, where FOO is your - cvs user foo. This allows easier tracking of why code was commented out, - especially in bundled libraries. - -[8] Do not define functions that are not available. For instance, if a - library is missing a function, do not define the PHP version of the - function, and do not raise a run-time error about the function not - existing. End users should use function_exists() to test for the - existence of a function - -[9] Prefer emalloc(), efree(), estrdup(), etc. to their standard C library - counterparts. These functions implement an internal "safety-net" - mechanism that ensures the deallocation of any unfreed memory at the - end of a request. They also provide useful allocation and overflow - information while running in debug mode. - - In almost all cases, memory returned to the engine must be allocated - using emalloc(). - - The use of malloc() should be limited to cases where a third-party - library may need to control or free the memory, or when the memory in - question needs to survive between multiple requests. - -Naming Conventions ------------------- - -[1] Function names for user-level functions should be enclosed with in - the PHP_FUNCTION() macro. They should be in lowercase, with words - underscore delimited, with care taken to minimize the letter count. - Abbreviations should not be used when they greatly decrease the - readability of the function name itself. - - Good: - 'mcrypt_enc_self_test' - 'mysql_list_fields' - - Ok: - 'mcrypt_module_get_algo_supported_key_sizes' - (could be 'mcrypt_mod_get_algo_sup_key_sizes'?) - 'get_html_translation_table' - (could be 'html_get_trans_table'?) - - Bad: - 'hw_GetObjectByQueryCollObj' - 'pg_setclientencoding' - 'jf_n_s_i' - - -[2] If they are part of a "parent set" of functions, that parent should - be included in the user function name, and should be clearly related - to the parent program or function family. This should be in the form - of parent_*. - - A family of 'foo' functions, for example: - Good: - 'foo_select_bar' - 'foo_insert_baz' - 'foo_delete_baz' - - Bad: - 'fooselect_bar' - 'fooinsertbaz' - 'delete_foo_baz' - -[3] Function names used by user functions should be prefixed - with "_php_", and followed by a word or an underscore-delimited list of - words, in lowercase letters, that describes the function. If applicable, - they should be declared 'static'. - -[4] Variable names must be meaningful. One letter variable names must be - avoided, except for places where the variable has no real meaning or - a trivial meaning (e.g. for (i=0; i<100; i++) ...). - -[5] Variable names should be in lowercase. Use underscores to separate - between words. - - -Syntax and indentation ----------------------- - -[1] Never use C++ style comments (i.e. // comment). Always use C-style - comments instead. PHP is written in C, and is aimed at compiling - under any ANSI-C compliant compiler. Even though many compilers - accept C++-style comments in C code, you have to ensure that your - code would compile with other compilers as well. - The only exception to this rule is code that is Win32-specific, - because the Win32 port is MS-Visual C++ specific, and this compiler - is known to accept C++-style comments in C code. - -[2] Use K&R-style. Of course, we can't and don't want to - force anybody to use a style he or she is not used to, but, - at the very least, when you write code that goes into the core - of PHP or one of its standard modules, please maintain the K&R - style. This applies to just about everything, starting with - indentation and comment styles and up to function declaration - syntax. - - (see also http://www.tuxedo.org/~esr/jargon/html/entry/indent-style.html) - -[3] Be generous with whitespace and braces. Always prefer: - - if (foo) { - bar; - } - - to: - - if(foo)bar; - - Keep one empty line between the variable declaration section and - the statements in a block, as well as between logical statement - groups in a block. Maintain at least one empty line between - two functions, preferably two. - -[4] When indenting, use the tab character. A tab is expected to represent - four spaces. It is important to maintain consistency in indenture so - that definitions, comments, and control structures line up correctly. - -Documentation and Folding Hooks -------------------------------- - -In order to make sure that the online documentation stays in line with -the code, each user-level function should have its user-level function -prototype before it along with a brief one-line description of what the -function does. It would look like this: - -/* {{{ proto int abs(int number) - Returns the absolute value of the number */ -PHP_FUNCTION(abs) -{ - ... -} -/* }}} */ - -The {{{ symbols are the default folding symbols for the folding mode in -Emacs and vim (set fdm=marker). Folding is very useful when dealing with -large files because you can scroll through the file quickly and just unfold -the function you wish to work on. The }}} at the end of each function marks -the end of the fold, and should be on a separate line. - -The "proto" keyword there is just a helper for the doc/genfuncsummary script -which generates a full function summary. Having this keyword in front of the -function prototypes allows us to put folds elsewhere in the code without -messing up the function summary. - -Optional arguments are written like this: - -/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]]) - Returns a header object with the defined parameters */ - -And yes, please keep the prototype on a single line, even if that line -is massive. - -New and Experimental Functions ------------------------------------ -To reduce the problems normally associated with the first public -implementation of a new set of functions, it has been suggested -that the first implementation include a file labeled 'EXPERIMENTAL' -in the function directory, and that the functions follow the -standard prefixing conventions during their initial implementation. - -The file labelled 'EXPERIMENTAL' should include the following -information: - Any authoring information (known bugs, future directions of the module). - Ongoing status notes which may not be appropriate for CVS comments. - -Aliases & Legacy Documentation ------------------------------------ -You may also have some deprecated aliases with close to duplicate -names, for example, somedb_select_result and somedb_selectresult. For -documentation purposes, these will only be documented by the most -current name, with the aliases listed in the documentation for -the parent function. For ease of reference, user-functions with -completely different names, that alias to the same function (such as -highlight_file and show_source), will be separately documented. The -proto should still be included, describing which function is aliased. - -Backwards compatible functions and names should be maintained as long -as the code can be reasonably be kept as part of the codebase. See -/phpdoc/README for more information on documentation. diff --git a/CREDITS b/CREDITS deleted file mode 100644 index 42549a2773..0000000000 --- a/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -For the list of people who've put work into PHP, please see -http://www.php.net/credits.php diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index c2f0250c08..0000000000 --- a/ChangeLog +++ /dev/null @@ -1,10342 +0,0 @@ -2003-04-07 Jani Taskinen - - * NEWS: - Removed entry that is in the PHP_4_3 branch.. - - * NEWS: - reorder - - * (PHP_4_3) - NEWS: - BFN - -2003-04-07 Sara Golemon - - * NEWS - ext/standard/http_fopen_wrapper.c: - Introduce support for context options 'method', 'header', 'content' - -2003-04-06 Jani Taskinen - - * (PHP_4_3) - NEWS: - BFN - - * (PHP_4_3) - ext/standard/datetime.c: - MFH: Fixed bug #23071 (when DST in effect, date("T") crashed PHP) - - * ext/standard/datetime.c: - Fixed bug #23071 (when DST in effect, date("T") crashed PHP) - -2003-04-06 Marcus Boerger - - * .gdbinit: - Support for ZTS - -2003-04-06 Moriyoshi Koizumi - - * (PHP_4_3) - .gdbinit: - MFH(r-1.5): improved zmemcheck macro so it displays the size of each memory - block too. - - * .gdbinit: - Improved zmemcheck macro so it displays the size of each memory block too. - - * (PHP_4_3) - .gdbinit: - MFH(r-1.4): improved readability of zmemcheck output - - * .gdbinit: - Improved readability of zmemcheck output - - * .gdbinit: - - Added zmemcheck macro, which may help you examine the memory blocks being - handled by the memory manager. - -2003-04-06 Jani Taskinen - - * NEWS: - reorder - -2003-04-05 Marcus Boerger - - * ext/gd/gd.c: - Collate version handling and bump up version (noticed by Peter Neuman) - -2003-04-05 Christian Stocker - - * ext/domxml/php_domxml.c - ext/domxml/php_domxml.h: - Useful for adding and parsing (well-balanced) document fragments. - - Bumped up API version number - -2003-04-05 Jani Taskinen - - * configure.in: - --enable-all is not useful at all, removed from help - - * ext/sockets/php_sockets.h: - Better ifdef it out here too - -2003-04-05 Sara Golemon - - * ext/openssl/xp_ssl.c: - Debug watches probably don't belong in CVS. - -2003-04-05 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - GD news. - - * ext/gd/libgd/gd.c - ext/gd/libgd/gd.h - ext/gd/libgd/gd_gd.c - ext/gd/libgd/gd_gd2.c - ext/gd/libgd/gd_io.h - ext/gd/libgd/gd_jpeg.c - ext/gd/libgd/gd_png.c - ext/gd/libgd/gd_topal.c - ext/gd/libgd/gdcache.c - ext/gd/libgd/gdcache.h - ext/gd/libgd/gdft.c - ext/gd/libgd/gdkanji.c: - Syncronized bunbled GD library with gd 2.0.12 - - -2003-04-05 Marcus Boerger - - * run-tests.php: - Include ldd output - -2003-04-05 Sascha Schumann - - * php.ini-dist - php.ini-recommended: - dividend -> divisor - - * ext/session/php_session.h - ext/session/session.c: - dividend -> divisor - - Submitted by: Jesus M. Castagnetto - -2003-04-05 Brian France - - * ext/curl/multi.c: - - Added HAVE_CONFIG_H check so the phpize build method works - -2003-04-05 Sara Golemon - - * main/streams/xp_socket.c: - Add IPv6 support to stream_socket_client/server() - -2003-04-05 Pierre-Alain Joye - - * pear/package-PEAR.xml: - what? maintainer is not a valid role :) - -2003-04-04 Wez Furlong - - * ext/standard/streamsfuncs.c: - Warning fix - -2003-04-04 Sara Golemon - - * ext/standard/streamsfuncs.c: - User shouldn't have to initialize this pass-by-ref parameter - -2003-04-04 Moriyoshi Koizumi - - * (PHP_4_3) - ext/sockets/config.m4 - ext/sockets/sockets.c: - MFH: added check for struct cmsghdr. now sockets extension can be built - under cygwin - -2003-04-04 Jani Taskinen - - * ext/rpc/java/config.m4: - - Fixed bug #22944 (--with-java "make install" fails) - -2003-04-04 Sterling Hughes - - * CODING_STANDARDS: - both these entries are bad, and were never agreed upon. - assert() usage is a controversial concept at best. - docref() is something quite a few of us strong disagree with. suspending - this until further discussion. - -2003-04-04 Jani Taskinen - - * (PHP_4_3) - ext/curl/curl.c: - Fix bug #23048, CURLOPT_ENCODING is not always available - -2003-04-04 Sterling Hughes - - * ext/curl/multi.c: - forgot to commit this. - -2003-04-04 Jani Taskinen - - * ext/gd/config.m4: - Check that t1lib has T1_StrError - - * configure.in - ext/sockets/config.m4: - - Checks specific to some extension belong in the extension's config.m4 - -2003-04-04 Andrei Zmievski - - * main/php.h: - Introduce ZEND_ME() and ZEND_METHOD() macros. Use these for declaring - class methods to avoid name collisions. - -2003-04-04 Moriyoshi Koizumi - - * (PHP_4_3) - ext/sockets/sockets.c: - MFH(r-1.135): fixed memleak in socket_select() - - * ext/sockets/sockets.c: - Fixed memleak in socket_select - - * configure.in - ext/sockets/sockets.c: - Added cmsghdr check. Now sockets extension can be built under cygwin. - - * (PHP_4_3) - TODO_SEGFAULTS: - Sorry, forgot these ones - - * (PHP_4_3) - TODO_SEGFAULTS: - renumbering - - * (PHP_4_3) - TODO_SEGFAULTS: - segfault busting news - replacing one tab to 4 spaces - - * (PHP_4_3) - ext/mbstring/mbfilter.c: - MFH(r-1.55): added missing sanity check, which was causing segfault. - - * ext/mbstring/mbfilter.c: - Added missing sanity check, which was causing segfault. - -2003-04-04 Wez Furlong - - * ext/standard/streamsfuncs.c: - Simplify and enhance readability. - -2003-04-04 Sascha Schumann - - * main/output.c: - Backout Jani's commit to resync branches - -2003-04-04 Sara Golemon - - * ext/standard/basic_functions.c - ext/standard/streamsfuncs.c - ext/standard/streamsfuncs.h: - Added stream_get_transports() - - * main/streams/streams.c: - Prevent php_stream_get_record from grabbing more than maxlen characters - -2003-04-04 Ilia Alshanetsky - - * ext/gd/gd.c: - Might as well disallow 0x0 images. - - Thanks Marcus. - -2003-04-04 Pierre-Alain Joye - - * pear/package-PEAR.xml: - - Add some releases notes - - Add myself in the maintainer list (stig) - -2003-04-04 Ilia Alshanetsky - - * (PHP_4_3) - TODO_SEGFAULTS: - Notes about various possible integer overflows in bundled gd library. - - * (PHP_4_3) - TODO_SEGFAULTS: - More gd stuff. - - * (PHP_4_3) - TODO_SEGFAULTS: - Fixed segv as well as info about new segvs in gd. - -2003-04-04 Stig Bakken - - * pear/package-PEAR.xml: - - whip script files where they belong - -2003-04-04 Ilia Alshanetsky - - * ext/gd/gd.c: - Fix segfault in imagecopyresized(). - -2003-04-04 Stig Bakken - - * pear/scripts/pear.sh: - - look for pearcmd.php in the right directory when run from a cvs checkout - - * pear/package-PEAR.xml - pear/scripts/pear.sh - pear/scripts/pear_unices: - - rename pear_unices to pear.sh and make it a pure shell script - -2003-04-04 Jani Taskinen - - * ext/gd/gd.c: - - Better errors for T1lib. - - Sanity check into imagepsextendfont(). - -2003-04-03 Stig Bakken - - * pear/package-PEAR.xml: - - pear.in is renamed to pearcmd.php - - * pear/package-PEAR.xml - pear/scripts/.cvsignore - pear/scripts/pear.in - pear/scripts/pear_unices - pear/scripts/pearcmd.php: - - paj's last Windows install fixes - - * pear/scripts/pear.bat: - - use PHP_PEAR_* environment variables (paj) - - * pear/PEAR/Frontend/CLI.php: - - disable table borders in output to save width - - * pear/OS/Guess.php: - - windows bugfix - - * pear/PEAR.php: - - support both error codes and messages in the second parameter to - PEAR::isError() - -2003-04-03 Jani Taskinen - - * ext/gd/gd.c: - Use php_error_docref. - -2003-04-03 Stig Bakken - - * pear/PEAR/Registry.php: - - remove track_errors ini fiddling, was a PHP bug that should be fixed now - - * pear/PEAR/Common.php: - - initialize pkginfo with an empty provides array - -2003-04-03 Rasmus Lerdorf - - * ext/exif/exif.c: - MFB - -2003-04-03 Marcus Boerger - - * configure.in: - Check for flex version 2.5.4 - -2003-04-03 Sascha Schumann - - * (PHP_4_3) - TODO_SEGFAULTS: - one in socket_select - - * (PHP_4_3) - TODO_SEGFAULTS: - augment summary with fixes which predate the list - - * (PHP_4_3) - TODO_SEGFAULTS: - add chunk_split - - * (PHP_4_3) - TODO_SEGFAULTS: - another one fixed, a new one found - - * ext/gd/gd.c: - Fix segfaults in imagecreate/imagecreatetruecolor - - * (PHP_4_3) - TODO_SEGFAULTS: - fix - - * (PHP_4_3) - TODO_SEGFAULTS: - update regarding dbase extension - -2003-04-03 Jani Taskinen - - * main/output.c: - WS & CS fix - -2003-04-03 Sara Golemon - - * ext/standard/array.c: - Kludgy fix for floating point drift causing problems like - range(1.0,1.5,0.1) == array(1.0,1.1,1.2,1.3,1.4); - -2003-04-03 Sascha Schumann - - * (PHP_4_3) - TODO_SEGFAULTS: - Update - we purged the full list\! - - * main/output.c: - Add some checks and avoid passing invalid data to call_user_function_ex. - - Fixes some heap corruption and allocation of negative amounts of memory. - - * ext/standard/basic_functions.c: - Prevent entering of anything but arrays/strings in register_shutdown_func - - Noticed by: Jan Schneider - -2003-04-03 Rasmus Lerdorf - - * (PHP_4_3) - ext/exif/exif.c: - Clean up the parameter handling here - -2003-04-03 Jani Taskinen - - * NEWS: - reorder - -2003-04-03 Christian Stocker - - * NEWS: - new domxml_elem_set_attribute_node() should have gone into NEWS, but I - forgot.. - - * ext/domxml/php_domxml.c - ext/domxml/php_domxml.h: - - Added domxml_elem_set_attribute_node() method. (Rob Richards) - -2003-04-03 Georg Richter - - * ext/mysqli/mysqli_api.c: - fixed mysqli_prepare_result - - * ext/mysqli/tests/047.phpt: - fixed output - -2003-04-03 Derick Rethans - - * ext/standard/string.c - ext/standard/string.c: - - CS - -2003-04-03 Jani Taskinen - - * ext/bcmath/bcmath.c: - Another CS fix. - - * ext/standard/basic_functions.c: - CS fix - -2003-04-03 Moriyoshi Koizumi - - * (PHP_4_3) - TODO_SEGFAULTS: - Unable to reproduce.. - - * (PHP_4_3) - TODO_SEGFAULTS: - segfault busting news - - * (PHP_4_3) - ext/xml/xml.c: - MFH(r-1.117): fixed segfault in xml_parser_create() - - * ext/xml/xml.c: - Fixed segfault in xml_parser_create() - -2003-04-03 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * (PHP_4_3) - ext/ftp/php_ftp.c: - Fixed bug #23004 (When ftp_close() is called, sent QUIT to the ftp server) - -2003-04-03 Moriyoshi Koizumi - - * (PHP_4_3) - main/output.c: - MFH(r-1.152): fixed memleak in output buffering facility - - * main/output.c: - Fixed memleak in output buffering facility - - * (PHP_4_3) - TODO_SEGFAULTS: - Removed i18n_convert() from the entries because that is an alias for - mb_convert_encoding() - -2003-04-03 Rasmus Lerdorf - - * (PHP_4_3) - TODO_SEGFAULTS: - Update - -2003-04-03 Moriyoshi Koizumi - - * (PHP_4_3) - ext/mbstring/php_mbregex.c: - MFH(r-1.38): fixed segfault in mb_ereg_match() - - * ext/mbstring/php_mbregex.c: - Fixed segfault in mb_ereg_match() - - * (PHP_4_3) - ext/mbstring/php_mbregex.c: - MFH(r-1.37): fixed lots of crashes in mbregex - - * ext/mbstring/php_mbregex.c: - Fixed lots of crashes in mbregex. - -2003-04-02 Rasmus Lerdorf - - * ext/bcmath/bcmath.c: - MFB: Check for negative precision - - * (PHP_4_3) - TODO_SEGFAULTS - ext/bcmath/bcmath.c: - Negative precision makes no sense, so check for that, but let the memory - manager error out on huge non-negative precision args - - * ext/standard/basic_functions.c: - MFB: Fix unregister_tick_function crash - - * (PHP_4_3) - TODO_SEGFAULTS - ext/standard/basic_functions.c: - Fix unregister_tick_function crash - -2003-04-02 Georg Richter - - * ext/mysqli/tests/028.phpt - ext/mysqli/tests/042.phpt: - fixed expected output - -2003-04-02 Rasmus Lerdorf - - * ext/exif/exif.c: - MFB: Get rid of bogus dtors - - * (PHP_4_3) - ext/exif/exif.c: - Get rid of bogus dtors - - * ext/standard/string.c: - MFB: Fix the setlocale() segfault - - * (PHP_4_3) - TODO_SEGFAULTS - ext/standard/string.c: - Fix the setlocale() segfault - -2003-04-02 Marcus Boerger - - * configure.in: - For now only bison 1.28, 1.35 and 1.75 are working properly - -2003-04-02 Derick Rethans - - * sapi/apache/.cvsignore: - - Update for new name - -2003-04-02 Jani Taskinen - - * (PHP_4_3) - NEWS: - BFN - -2003-04-02 Sterling Hughes - - * ext/curl/multi.c: - add the ability for curl_multi_info to introspect the handles. - - -2003-04-02 Colin Viebrock - - * ext/standard/basic_functions.c - ext/standard/info.c - ext/standard/info.h: - fixes for logo guid functions - - * main/logos.h: - oops ... committed the wrong one - - * main/logos.h: - fix logo (outline around letters) - -2003-04-02 Edin Kadribasic - - * (PHP_4_3) - NEWS: - BFN - - * ext/ldap/ldap.dsp: - Fixed bug #23008 - -2003-04-02 Christian Stocker - - * ext/domxml/php_domxml.c - ext/domxml/php_domxml.c: - Patch for Bug #22774 by Rob Richards - -2003-04-02 Sara Golemon - - * tests/strings/002.phpt: - Avoid having output_buffering cause this test to improperly fail. - - * ext/standard/tests/file/userfilters.phpt: - New test for userfilters rewrite - -2003-04-02 Ilia Alshanetsky - - * ext/standard/string.c: - Fixed possible integer overflow in str_repeat(). - -2003-04-02 Jay Smith - - * (PHP_4_3) - ext/pgsql/pgsql.c - ext/pgsql/php_pgsql.h: - MFH - -2003-04-01 Jay Smith - - * ext/pgsql/pgsql.c - ext/pgsql/php_pgsql.h: - Fix 'timestamp without timezone', too. - -2003-04-01 Marcus Boerger - - * ext/pgsql/pgsql.c: - Fix 'time with timezone', too - -2003-04-01 Jay Smith - - * ext/pgsql/pgsql.c: - Fixed bug #23009 (pg_select with timestamp) - -2003-04-01 Rasmus Lerdorf - - * (PHP_4_3) - TODO_SEGFAULTS - ext/standard/array.c: - Arbitrarily limit array_pad() to only do 1 million elements at a time. - Probably still too high, but it solves the segfault for now. - -2003-04-01 Moriyoshi Koizumi - - * ext/standard/tests/filters/bug22538.phpt: - Fixed bogus test - -2003-04-01 Sascha Schumann - - * (PHP_4_3) - main/output.c: - s/0/FAILURE/ - - * main/output.c: - Fix an uninitialized read, default to FAILURE - - * (PHP_4_3) - main/output.c: - Fix an uninitialised read for ob_start(array()) - -2003-04-01 Rasmus Lerdorf - - * ext/dbase/dbf_head.c - ext/exif/exif.c - ext/standard/array.c: - MFB - - * (PHP_4_3) - TODO_SEGFAULTS - ext/dbase/dbf_head.c: - Argh!!! I guess nobody has ever looked at this code. - -2003-04-01 Moriyoshi Koizumi - - * ext/standard/tests/filters/bug22538.phpt: - Added a test case for bug #22538 - - * ext/mbstring/php_mbregex.c: - oops - - * ext/mbstring/php_mbregex.c: - Reverted the last patch; the problem is elsewhere.. - -2003-04-01 Rasmus Lerdorf - - * (PHP_4_3) - TODO_SEGFAULTS - ext/exif/exif.c: - Fix exif crashes - -2003-04-01 Moriyoshi Koizumi - - * ext/mbstring/php_mbregex.c: - Fixed crash that occurs due to an abused persistent hashtable. - -2003-04-01 Rasmus Lerdorf - - * (PHP_4_3) - TODO_SEGFAULTS: - Update (not fixed in HEAD because the API for this function needs to - change in PHP5. It is moronic the way it is now) - - * (PHP_4_3) - ext/sockets/sockets.c: - Ok, really fix socket_iovec_alloc() this time - -2003-04-01 Jani Taskinen - - * NEWS: - crap removal - - * (PHP_4_3) - NEWS: - BFN - - * (PHP_4_3) - configure.in: - MFH: Fixed bug #22987 (missing perror() check in configure) - - * configure.in: - Fixed bug #22987 (missing perror() check in configure) - -2003-04-01 Sascha Schumann - - * (PHP_4_3) - TODO_SEGFAULTS: - more insight re. ob_start bug - - * (PHP_4_3) - TODO_SEGFAULTS: - The ob_start issue is reproducible. - -2003-04-01 Moshe Doron - - * ext/standard/tests/strings/bug22904.phpt: - oops - - * ext/standard/tests/strings/bug22904.phpt: - revert due the last string.c revert - - * ext/standard/string.c: - revert last commit for now - -2003-04-01 Sascha Schumann - - * (PHP_4_3) - TODO_SEGFAULTS: - editing - - * TODO_SEGFAULTS - TODO_SEGFAULTS: - - file TODO_SEGFAULTS was initially added on branch PHP_4_3. - -2003-04-01 Moriyoshi Koizumi - - * (PHP_4_3) - ext/mbstring/mbstring.c: - MFH(r-1.170): fixed crash in mb_convert_encoding() that occurs when a void - array is passed as the third parameter. - - * ext/mbstring/mbstring.c: - Fixed crash in mb_convert_encoding() that occurs when a void array is - passed as the third parameter - -2003-04-01 Thies C. Arntzen - - * ext/standard/info.c - ext/standard/info.c: - -** empty log message *** - -2003-04-01 Sascha Schumann - - * ext/ircg/ircg.c: - Fix segfault, logic and lock issue in ircg_is_conn_alive - - * ext/dba/config.m4 - ext/dba/config.m4 - ext/dba/config.m4: - fix VPATH builds - - * ext/standard/basic_functions.c: - Fix segfault in register_shutdown_function - - * (PHP_4_3) - acinclude.m4: - No need for shtool - - * acinclude.m4: - Don't need shtool - - * ext/ircg/ircg.c: - Intermediate commit of relocation map integration - - * (PHP_4_3) - ext/standard/file.c - ext/standard/file.c: - Fix segfault in flock() - -2003-04-01 Sara Golemon - - * ext/standard/mail.c: - Bug #22962 - -2003-04-01 Sebastian Bergmann - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - Sorry Sterling, but this broke the ZTS build and I'd rather not 'ZTS fix' - an April's Fool joke. - -2003-04-01 Sterling Hughes - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - Add the landonize() and landonize_url() functions which provide a secure - alternative to the sha1() and sha1_file() functions. - -2003-03-31 Moriyoshi Koizumi - - * ext/standard/tests/serialize/001.phpt: - oops - -2003-03-31 Jani Taskinen - - * (PHP_4_3) - NEWS: - BFN & houshold - - * NEWS: - Householding.. - -2003-03-31 Moriyoshi Koizumi - - * main/streams/streams.c: - Fixed bug #22538 (stream filter problem) - -2003-03-31 Jani Taskinen - - * (PHP_4_3) - acinclude.m4: - MFH: Fixed bug #22989 (sendmail not found by configure) - - * acinclude.m4: - Fixed bug #22989 (sendmail not found by configure) - -2003-03-31 Moriyoshi Koizumi - - * ext/standard/tests/serialize/001.phpt: - Fixed test; in ZE2, all the properties used in any methods are populated - at compile time. - -2003-03-31 Ilia Alshanetsky - - * main/streams/streams.c: - WS - -2003-03-31 Brian France - - * (PHP_4_3) - main/main.c: - - Fixes the problem where argv and argc are not populated unless S - is in the variables_order, even if register_argc_argv is on. - -2003-03-31 Moriyoshi Koizumi - - * (PHP_4_3) - ext/imap/php_imap.c: - MFH(r-1.161): fixed proto to sync with the documentation - - * ext/imap/php_imap.c: - Fixed proto to sync with the documentation - - * (PHP_4_3) - ext/mime_magic/config.m4: - MFH(r-1.10): rearranged search order for the magic file to avoid further - confusions - - * ext/mime_magic/config.m4: - Rearranged search order for the magic file to avoid further confusions - -2003-03-31 Marcus Boerger - - * main/main.c: - use the correct macro - noticed by Andrei - -2003-03-31 Moshe Doron - - * ext/standard/tests/strings/bug22904.phpt: - - - * ext/standard/string.c: - fix for 22904 - -2003-03-31 Wez Furlong - - * ext/openssl/openssl.c: - Fix const warning - -2003-03-31 David Hill - - * (PHP_4_3) - ext/standard/parsedate.y: - Changing parsedate to be reentrant using pure_parse (Dave) - - * (PHP_4_3) - configure.in: - Correcting checking of flex version (Dave) - -2003-03-31 Moshe Doron - - * ext/standard/string.c: - - -2003-03-31 Jani Taskinen - - * ext/gd/gd.c - ext/gd/gd.c - ext/gd/php_gd.h - ext/gd/php_gd.h: - cleanup - -2003-03-31 Sascha Schumann - - * (PHP_4_3) - ext/standard/lcg.c - ext/standard/lcg.c: - MFH TS issue, noticed by Sebastian Bergmann - - * ext/standard/lcg.c: - TS issue, noticed by Sebastian Bergmann - - * ext/standard/lcg.c: - Ensure that the seed function has been called, even if we are used by - another module's request init function. - - Noticed by: marcus.boerger@t-online.de - -2003-03-30 Derick Rethans - - * ext/openssl/openssl.c: - - Typo and some whitespace - - * ext/openssl/openssl.c: - - Added optional parameter to openssl_sign() to specify the hashing - algorithm to use. (Patch by Scott ) - -2003-03-30 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/gd/libgd/gd.c: - Fixed bug #22965 (Crash in gd lib's ImageFillToBorder()). - -2003-03-30 Sascha Schumann - - * sapi/apache/config.m4: - Merge proper -I parameter for APXS builds - -2003-03-30 Rasmus Lerdorf - - * (PHP_4_3) - ext/gd/gd.c: - No point calling the RSHUTDOWN hook here unless we are actually going - to do something in it. - -2003-03-30 Moriyoshi Koizumi - - * .gdbinit: - Added various gdb macros to examine zval, znode, and HashTable - -2003-03-30 Georg Richter - - * ext/mysqli/mysqli_profiler.c: - changed constant name - -2003-03-30 Marcus Boerger - - * run-tests.php: - if TEST_PHP_EXECUTABLE=auto then use ./sapi/cli/php - - * NEWS: - update - - * sapi/cli/php_cli.c: - more ini defaults for error message handling - - * main/main.c: - cleanup - -2003-03-30 Georg Richter - - * ext/mysqli/mysqli_profiler.h: - changed macro - -2003-03-30 Marcus Boerger - - * tests/classes/interface_doubled.phpt: - bugfix #22961 by cynic@php.net - - * sapi/cli/php_cli.c: - simplify and fix - - * sapi/cli/TODO: - done - -2003-03-30 Sebastian Bergmann - - * ext/mysqli/config.m4: - --+_ - -2003-03-30 Shane Caraveo - - * run-tests2.php: - uncomment removal of temp file - update changes from run-tests - - * sapi/isapi/php4isapi.c: - clean up url handling with path_info - handle sending a 404 if the requested file does not exist - - * main/php_variables.c: - _SERVER also should not be quoted by magic_quotes_GPC - also remove an empty if statement - -2003-03-29 Moriyoshi Koizumi - - * ext/standard/var.c: - Improved var_dump() and debug_zval_dump() so they also show the - namespace of the given object. - -2003-03-29 Marcus Boerger - - * main/php_ini.c: - fix phpinfo() & php -i - - * sapi/cli/php_cli.c: - use sizeof() as suggested by Andrei - -2003-03-29 Derick Rethans - - * sapi/cli/php_cli.c: - - html errors should default to off (0) in CLI - -2003-03-29 Moriyoshi Koizumi - - * sapi/cgi/cgi_main.c: - Fixed too optimized part - - * sapi/cgi/cgi_main.c: - CS & WS fixes - - * (PHP_4_3) - configure.in: - MFH(r-1.436): improved bison check; now configure accepts 1.28, 1.35 and - 1.75 - only. - - * configure.in: - Improved bison check; now configure accepts 1.28, 1.35, and 1.75 only. - - * (PHP_4_3) - ext/mbstring/tests/mb_parse_str.phpt - ext/mbstring/tests/mb_parse_str02.phpt: - MFH: fixed test cases so it wouldn't be failed in case register_globals=on - - * ext/mbstring/tests/mb_parse_str.phpt - ext/mbstring/tests/mb_parse_str02.phpt: - Fixed test cases so they wouldn't be failed in case register_globals=on - -2003-03-29 Sterling Hughes - - * Makefile.global - acinclude.m4 - configure.in - sapi/apache/apMakefile.tmpl - sapi/apache/config.m4 - sapi/apache/libphp4.module.in - sapi/apache/libphp5.module.in - sapi/apache/mod_php4.c - sapi/apache/mod_php4.exp - sapi/apache/mod_php4.h - sapi/apache/mod_php5.c - sapi/apache/mod_php5.exp - sapi/apache/mod_php5.h - sapi/apache/php.sym - sapi/apache/php_apache_http.h - sapi/apache2filter/config.m4 - sapi/apache2filter/php.sym - sapi/apache2filter/php_apache.h - sapi/apache2filter/sapi_apache2.c - sapi/apache2handler/config.m4 - sapi/apache2handler/php.sym - sapi/apache2handler/php_apache.h - sapi/apache2handler/sapi_apache2.c: - update php module name to php5, not php4. - apache, apache2* and cli/cgi work. - sapi module maintainers should fix up their sapis, as I don't run - any servers with php outside of apache. - -2003-03-28 Derick Rethans - - * run-tests.php: - - Add the exponent to the float modifier - -2003-03-28 Marcus Boerger - - * tests/classes/interfaces_001.phpt - tests/classes/interfaces_002.phpt: - fix these tests - -2003-03-28 Moriyoshi Koizumi - - * sapi/cgi/cgi_main.c: - Do the right fix.. - - * sapi/cgi/cgi_main.c: - Fixed bug #22773 - - * main/php_variables.c: - On 64bit platforms, pointers are 64bit long.. - -2003-03-28 Ilia Alshanetsky - - * ext/standard/file.c: - CS - -2003-03-28 David Hill - - * ext/standard/parsedate.y: - Changing parsedate to be reentrant using pure_parser (Dave) - -2003-03-28 Moriyoshi Koizumi - - * ext/mbstring/mbstring.c: - Removed redundant aliases & CS fix. - -2003-03-27 Moriyoshi Koizumi - - * main/php_variables.c: - Improved php_import_environment_variables: avoid emalloc()ing in most cases - -2003-03-27 Harald Radi - - * ext/rpc/com/com_wrapper.c: - MFB ext/com - fix #22899 - invoke is called twice - -2003-03-27 Ilia Alshanetsky - - * ext/standard/array.c: - CS - -2003-03-27 David Hill - - * configure.in: - Correcting checking of flex version (dave) - -2003-03-27 Shane Caraveo - - * sapi/cgi/cgi_main.c - sapi/isapi/php4isapi.c: - handle invalid paths passed to us from iis - -2003-03-27 David Hill - - * ext/standard/tests/time/002.phpt: - Backing out part of TZ change - -2003-03-27 Edin Kadribasic - - * (PHP_4_3) - NEWS: - BFN - - * ext/mysql/libmysql/config-win.h: - MFB - - * (PHP_4_3) - ext/mysql/libmysql/config-win.h: - Fixed bug #22083. - -2003-03-27 Jani Taskinen - - * sapi/apache2handler/sapi_apache2.c: - CS fix - -2003-03-27 Ian Holsman - - * sapi/apache2handler/sapi_apache2.c: - change to a pool-based bucket instead of a transient one. - - * sapi/apache2handler/sapi_apache2.c: - remove flush from standard unbuffered write. - people requiring a flush can turn implicit flush on. - Thanks ilia for benchmarking this! - -2003-03-26 Sterling Hughes - - * main/fopen_wrappers.c: - really fix - - * main/fopen_wrappers.c: - fix segfault - -2003-03-26 Martin Jansen - - * pear/PEAR/Common.php: - - Silence warning - -2003-03-26 David Croft - - * NEWS: - a missing piece of news - -2003-03-26 David Hill - - * ext/standard/tests/time/002.phpt - ext/standard/tests/time/idate.phpt - ext/standard/tests/time/mktime.phpt: - Changing TZ to match Unix98 standard to make Tru64 happy - -2003-03-26 Sebastian Bergmann - - * ext/rpc/com/com.c - ext/rpc/com/conversion.c - ext/rpc/com/conversion.h - ext/rpc/com/dispatch.c - ext/rpc/com/variant.c - main/main.c: - Eliminate TSRMLS_FETCH() calls in destroy_op_array() and - zend_get_class_entry(). - - * win32/php_modules.dsw: - Leftover. - - * ext/gd/gd.c: - Eliminate TSRMLS_FETCH() call in php_find_gd_font(). - -2003-03-25 Rasmus Lerdorf - - * (PHP_4_3) - ext/sockets/sockets.c: - Make sure we never pass a negative arg to emalloc - (once again, this API needs to be fixed, so this is just for 4.3) - - * (PHP_4_3) - ext/sockets/sockets.c: - Restrict this function to a max of 65k io vectors to avoid weird - overflows. Purely an arbitrary number. This API needs cleaning up, - but it would break BC and I don't want to do that in 4.3. - -2003-03-25 Ilia Alshanetsky - - * sapi/apache2handler/php_functions.c: - Added missing initialization, which causes AP2 to crash on startup in ZTS. - -2003-03-25 Martin Jansen - - * pear/scripts/pear.bat: - - Changing to DOS line breaks. - -2003-03-25 Jani Taskinen - - * (PHP_4_3) - acinclude.m4 - configure.in: - MFH: Made "--with-pear" "--disable-all"-aware. Plus some cosmetics fixes. - - * acinclude.m4 - configure.in: - Made "--with-pear" "--disable-all"-aware. Plus some cosmetics fixes. - - * php.ini-dist - php.ini-recommended: - MFB - -2003-03-25 Sebastian Bergmann - - * win32/php5ts.dsw: - Leftover. - -2003-03-25 Edin Kadribasic - - * sapi/apache2handler/apache_config.c - sapi/apache2handler/php4apache2.dsp - sapi/apache2handler/php_functions.c - sapi/apache2handler/sapi_apache2.c: - MFB and more. Fixed various win32 compilation issues. Also the sapi - is now built as php4apach2.dll since the filter is being obsoleted. - - * sapi/apache2filter/php4apache2.dsp: - MFB: Disable building of apache2filter (obsoleted by handler). - - * ext/gd/gd.dsp - ext/gd/gd_bundled.dsp: - MFB: php_gd.dll is no longer bult and the bundled library is always used. - - * php.ini-dist - php.ini-recommended: - MFB - - * (PHP_4_3) - php.ini-dist - php.ini-recommended: - php_fbsql.dll hasn't been successfully built at least from 4.1.x. - Related to #22859. - -2003-03-25 Sebastian Bergmann - - * ext/ftp/ftp.c - ext/pcre/php_pcre.c - ext/pcre/php_pcre.h - ext/session/session.c - ext/standard/aggregation.c - ext/standard/basic_functions.c - ext/standard/credits.c - ext/standard/credits.h - ext/standard/css.c - ext/standard/css.h - ext/standard/datetime.c - ext/standard/datetime.h - ext/standard/head.c - ext/standard/head.h - ext/standard/info.c - ext/standard/info.h - ext/standard/levenshtein.c - main/output.c - main/php_variables.c - sapi/apache/php_apache.c - sapi/apache2handler/php_functions.c - sapi/apache_hooks/php_apache.c - sapi/cgi/cgi_main.c - sapi/cli/php_cli.c - sapi/servlet/servlet.c: - Eliminate some TSRMLS_FETCH() calls. Tested with Win32 build of SAPI/CGI - and SAPI/CLI on Win32. - -2003-03-25 Shane Caraveo - - * README.TESTING2 - run-tests-config.php - run-tests2.php - sapi/tests/test001.phpt - sapi/tests/test002.phpt - sapi/tests/test003.phpt - sapi/tests/test004.phpt - sapi/tests/test005.phpt - sapi/tests/test006.phpt - sapi/tests/test007.phpt: - many new enhancements to run-tests that allow for testing cgi and other - sapi modules via http. see README.TESTING2 for more details - several sapi tests added - - * sapi/cgi/cgi_main.c: - use the correct flush on deactivate - add some code to make debugging iis 5 cgi easier - -2003-03-25 Jani Taskinen - - * sapi/apache2filter/php_functions.c - sapi/apache2handler/php_functions.c: - - This is not supposed to be 'pretty' name. (ref. bug #22853) - -2003-03-25 Ilia Alshanetsky - - * sapi/apache2handler/sapi_apache2.c: - Fixed bug #22805 (Reading of user input could stop prematurely). - -2003-03-24 Jani Taskinen - - * NEWS: - reorder - -2003-03-24 Edin Kadribasic - - * ext/gettext/gettext.dsp: - MFB - - * (PHP_4_3) - ext/gettext/gettext.dsp: - Patch by Nathan Fredrickson : - - Remove unneeded library from the link stage and add a couple of missing - defines which are part of libintl. - -2003-03-24 Moriyoshi Koizumi - - * (PHP_4_3) - ext/mbstring/mbfilter.c - ext/mbstring/mbstring.h - ext/standard/html.c: - MFH: fixed bug #22834 (compile failure due to ugly implicit casts) - - * ext/mbstring/mbfilter.c - ext/mbstring/mbstring.h - ext/standard/html.c: - Fixed bug #22834 (compile failure due to ugly implicit casts) - - * (PHP_4_3) - NEWS: - NFN - -2003-03-24 Rasmus Lerdorf - - * (PHP_4_3) - ext/sockets/sockets.c: - Fix arg list segfault - -2003-03-24 Moriyoshi Koizumi - - * ext/standard/tests/strings/htmlentities16.phpt: - oops... - - * (PHP_4_3) - ext/standard/tests/strings/htmlentities15.phpt - ext/standard/tests/strings/htmlentities16.phpt: - MFH(initial): added test cases for new functionality - - * ext/standard/tests/strings/htmlentities15.phpt - ext/standard/tests/strings/htmlentities16.phpt: - - Added test cases for new functionality - - * (PHP_4_3) - ext/standard/html.c: - MFH(r-1.76): added koi8-r, cp866, and cp1251 support for htmlentities() - Patch by Antony Dovgal - - * ext/standard/html.c: - Added koi8-r, cp866, and cp1251 support for htmlentities - -2003-03-24 James Cox - - * NEWS: - test + remove 4 - -2003-03-24 Ilia Alshanetsky - - * ext/mysql/libmysql/mysys_err.h: - Added missing header that prevents successful compilation. - - * (PHP_4_3) - NEWS: - Bug fixing news. - -2003-03-24 Jani Taskinen - - * README.EXT_SKEL: - fix bug #22841 - - * sapi/isapi/php4isapi.c: - This is AUTH_TYPE in every other SAPI. - - * (PHP_4_3) - NEWS: - blah.. - -2003-03-24 Uwe Schindler - - * sapi/nsapi/nsapi.c - sapi/nsapi/nsapi.c: - PHP_WIN32 included - -2003-03-24 Jani Taskinen - - * ext/oci8/config.m4: - Fixed bug #18640 properly - -2003-03-24 Georg Richter - - * ext/mysqli/mysqli_fe.c: - changed method name - -2003-03-23 Alex Waugh - - * ext/standard/php_fopen_wrappers.h: - Fix linkage of symbols. - -2003-03-23 Shane Caraveo - - * sapi/cgi/cgi_main.c: - For fastcgi env vars, don't magic quote them - - * ext/standard/proc_open.c - main/php_variables.c: - The environment should *never* be magic quoted. - -2003-03-23 Wez Furlong - - * (PHP_4_3) - ext/curl/config.m4: - MFH curl detection when multiple installations exist - - * ext/curl/config.m4: - Fix curl detection when multiple installations exist - -2003-03-23 Sterling Hughes - - * configure.in: - add a standard Exception class. - -2003-03-23 Moriyoshi Koizumi - - * ext/calendar/jewish.c: - Added some compiler check - -2003-03-22 Moriyoshi Koizumi - - * (PHP_4_3) - ext/calendar/jewish.c: - MFH(r-1.5): fixed win32 build with non-SBCS locale settings. - - * ext/calendar/jewish.c: - Fixed win32 build, which fails with non-SBCS-compatible locale settings. - -2003-03-22 Shane Caraveo - - * main/php_ini.c: - Fix PHPRC overriding other ini files. This is how PHPRC worked prior to - 4.3.x, and is usefull for applications that execute PHP and want to - emulate CGI and define alternate INI files (ie. cannot use -c). - -2003-03-22 David Croft - - * ChangeLog: - - -2003-03-21 Sterling Hughes - - * ext/standard/file.c: - fix segfault in file_set_contents() when the file could not successfully - be opened. - -2003-03-21 Marcus Boerger - - * ext/mysqli/mysqli.c: - Add missing initialization - -2003-03-21 James Cox - - * run-tests.php: - updating for new list - -2003-03-21 Stig Bakken - - * pear/PEAR/Builder.php: - - abort install when an extension fails to build (patch by ja at - morrdusk dot net) - -2003-03-21 Sterling Hughes - - * ext/xml/xml.c: - This broke the xml extension, and pres2, commented out for now - -2003-03-20 Hartmut Holzgraefe - - * scripts/ext_skel_ng/extension_parser.php: - protect string from CVS keyword expansionCVS: - ---------------------------------------------------------------------- - -2003-03-20 Marcus Boerger - - * ext/mysqli/mysqli_profiler.c: - missing TSRMLS_FETCH - - * ext/dba/dba.c: - CS - -2003-03-20 Christian Stocker - - * ext/domxml/php_domxml.c - ext/domxml/php_domxml.c: - fix for bug #22786 ("Crash when trying to call DomAttribute's set_namespace - method") - -2003-03-20 Jani Taskinen - - * ext/domxml/php_domxml.c: - WS & CS fixes.. - -2003-03-20 Wez Furlong - - * main/streams/streams.c: - Fix for persistent stream shutdown under debug builds - -2003-03-20 Jani Taskinen - - * ext/gd/gd.c: - CS fix - -2003-03-20 Wez Furlong - - * (PHP_4_3) - main/streams.c: - Fix for persistent stream shutdown in debug builds. - -2003-03-20 Jani Taskinen - - * ext/bcmath/bcmath.c - ext/bz2/bz2.c - ext/dio/dio.c - ext/gd/gd.c: - WS & CS fixes - -2003-03-19 Jani Taskinen - - * ext/mysqli/config.m4: - Better config.m4.. - - * ext/tokenizer/tokenizer.c: - And this too.. - - * ext/tokenizer/tokenizer.c: - Andrei forgot this.. - -2003-03-19 Marcus Boerger - - * sapi/cli/php_cli.c: - - reenable $argc/$argv - - add a comment where hardcoded defaults would go - -2003-03-19 Wez Furlong - - * (PHP_4_3) - main/streams.c: - This little fragment didn't get merged from head... - -2003-03-19 David Hill - - * README.TESTING: - Correcting example to use proper variable - NO_INTERACTION - -2003-03-19 Jani Taskinen - - * php.ini-dist - php.ini-recommended: - Using of quotes around paths is a very good idea.. - - * (PHP_4_3) - NEWS: - BFN - - * (PHP_4_3) - main/main.c: - MFH: Fixed bug #22775 (Fatal errors exit with status 0 with CGI/CLI) - - * main/main.c: - Fixed bug #22775 (Fatal errors exit with status 0 with CGI/CLI) - -2003-03-19 Wez Furlong - - * (PHP_4_3) - main/streams.c: - Fix my fix. - - * (PHP_4_3) - main/streams.c: - Manual merge of persistent stream sanity check from php5. - - * main/streams/streams.c: - Sanity check for when a stream is requested to be persistent but the - wrapper - does not respect the flag. - -2003-03-18 Wez Furlong - - * ext/standard/streamsfuncs.c: - Add the mode string that was used to open the stream to the meta data, - as requested by Philip Olson. - - * (PHP_4_3) - main/php_streams.h - main/streams.c: - Manual merge of the persistent plain file streams code. - See http://news.php.net/article.php?group=php.cvs&article=19680 for - more information. - - * ext/standard/php_fopen_wrapper.c - main/php_streams.h - main/streams/php_stream_plain_wrapper.h - main/streams/plain_wrapper.c: - Implement persistent plain file streams. - - Usage: - - php_stream *stream = php_stream_fopen("/path/to/file", "r+b", NULL, - STREAM_OPEN_PERSISTENT | ENFORCE_SAFE_MODE | REPORT_ERRORS); - - the filename and mode are combined to form the hash key for the persistent - list; they must be identical for this same stream to be returned again in - the - next request. - - Calling php_stream_close() on a persistent stream *will* close it, as is - usual with all persistent resources in PHP/ZE. - - This is deliberately *not* exposed to user-space PHP at this time. - - * main/streams/streams.c: - Q} - - * (PHP_4_3) - main/streams.c: - WS Fix: I forgot to apply Q} to my comment. - -2003-03-18 Marcus Boerger - - * main/main.c: - -turn html_errors on by default again - -disbale clickable error messages by docref_root default to '' - -2003-03-18 Jay Smith - - * ext/standard/browscap.c: - get_browser() needs to use zend_is_auto_global() on _SERVER. - -2003-03-18 Marcus Boerger - - * ext/standard/info.c - main/SAPI.h - sapi/cli/php_cli.c: - make phpinfo() depend on executed sapi - -2003-03-18 Ilia Alshanetsky - - * ext/gd/libgd/gdxpm.c: - Cleanup. - -2003-03-18 Jani Taskinen - - * ext/ftp/ftp.c: - Fixed bug #22765 - -2003-03-18 Wez Furlong - - * ext/standard/php_fopen_wrapper.c - main/php_open_temporary_file.c - main/php_open_temporary_file.h - main/streams/plain_wrapper.c: - Avoid using FILE* where possible. - Tidy up handling of potential error situations for the php:// wrapper. - - * (PHP_4_3) - main/php_open_temporary_file.c - main/php_open_temporary_file.h - main/php_streams.h - main/streams.c: - Avoid using FILE* unless we have to. - -2003-03-18 Marcus Boerger - - * sapi/cli/php_cli.c: - use new callback to overwrite ini settings - - * main/SAPI.h - main/php_ini.c: - give sapi modules the possibility to overwrite default ini settings - -2003-03-18 Wez Furlong - - * (PHP_4_3) - NEWS: - BFN - - * ext/openssl/xp_ssl.c - main/streams/xp_socket.c: - avoid unsigned issues. - - * (PHP_4_3) - main/streams.c: - Fix my 64-bit casting fix. - MFH Fix for #22721 - poor performance for file() on systems without mmap - support. - - * ext/standard/file.c: - CS fixes - - * main/streams/streams.c: - Fix for #22721 (poor file() performance on systems without mmap) - -2003-03-18 Stig Bakken - - * run-tests.php - run-tests2.php - build/buildcheck.sh - ext/gd/gd.c - ext/gd/php_gd.h - ext/iconv/iconv.c - ext/iconv/php_iconv.h - ext/oci8/oci8.c - ext/oci8/php_oci8.h - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - ext/odbc/php_odbc_includes.h - ext/oracle/oracle.c - ext/standard/file.c - ext/standard/formatted_print.c - ext/standard/math.c - ext/standard/php_ext_syslog.h - ext/standard/php_math.h - ext/standard/php_string.h - ext/standard/php_versioning.h - ext/standard/string.c - ext/standard/syslog.c - ext/standard/uniqid.c - ext/standard/uniqid.h - ext/standard/versioning.c - ext/xml/php_xml.h - ext/xml/xml.c - main/build-defs.h.in - main/php_ticks.c - main/php_ticks.h - main/snprintf.h - pear/PEAR.php - pear/System.php - pear/package.dtd - pear/OS/Guess.php - pear/PEAR/Autoloader.php - pear/PEAR/Builder.php - pear/PEAR/Command.php - pear/PEAR/Common.php - pear/PEAR/Config.php - pear/PEAR/Dependency.php - pear/PEAR/Installer.php - pear/PEAR/Packager.php - pear/PEAR/Registry.php - pear/PEAR/Remote.php - pear/PEAR/Command/Auth.php - pear/PEAR/Command/Build.php - pear/PEAR/Command/Common.php - pear/PEAR/Command/Config.php - pear/PEAR/Command/Install.php - pear/PEAR/Command/Package.php - pear/PEAR/Command/Registry.php - pear/PEAR/Command/Remote.php - pear/PEAR/Frontend/CLI.php - pear/scripts/pear.in - pear/scripts/pearwin.php - sapi/apache/php_apache.c - sapi/apache/php_apache_http.h - sapi/apache/sapi_apache.c - sapi/apache_hooks/php_apache.c - sapi/apache_hooks/sapi_apache.c - sapi/cgi/cgi_main.c: - - email address change - -2003-03-18 Jani Taskinen - - * (PHP_4_3) - NEWS - NEWS: - BFN - - * (PHP_4_3) - ext/gd/config.m4 - ext/gd/gdcache.c: - MFH: Fixed bug #22751 (Compile error in gdcache when external libgd is - used) - - * ext/gd/config.m4 - ext/gd/gdcache.c: - Fixed bug #22751 (Compile error in gdcache when external libgd is used) - - * sapi/apache2handler/sapi_apache2.c: - whitespace.. - -2003-03-17 Ilia Alshanetsky - - * main/streams/streams.c: - Win32 build fix. - -2003-03-17 Ian Holsman - - * sapi/apache2handler/sapi_apache2.c: - PR#22672 - User not logged under Apache2 - patch provided by Andrew Bradford. - -2003-03-17 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * main/streams/streams.c: - Fixed bug #22538 (failed stat on stdio/stdin/stderr streams). - -2003-03-17 Jani Taskinen - - * ext/sybase_ct/config.m4: - Fix the bad logic.. - - * (PHP_4_3) - NEWS: - BFN - - * ext/curl/interface.c - ext/curl/multi.c - ext/curl/streams.c - ext/zlib/zlib.c - ext/zlib/zlib_fopen_wrapper.c: - WS & CS fixes - -2003-03-17 Hartmut Holzgraefe - - * ext/gd/gd.c: - fixing my proto fix :| - -2003-03-17 Wez Furlong - - * acinclude.m4 - configure.in - main/main.c - main/safe_mode.c: - Fix for Bug #21310, based on a patch by jflemer@php.net. - -2003-03-17 Hartmut Holzgraefe - - * ext/curl/multi.c - ext/fdf/fdf.c - ext/ncurses/ncurses_functions.c - ext/standard/aggregation.c - ext/standard/dns.c: - proto fixes - - * ext/db/db.c - ext/dbx/dbx.c - ext/gd/gd.c - ext/ircg/ircg.c - ext/zlib/zlib.c: - proto fix - - * ext/mysqli/mysqli_api.c: - more proto fixes - -2003-03-17 Jani Taskinen - - * run-tests.php: - Be sure we get the correct version.. - - * run-tests.php: - added the version info to be send as-is to buildtest-process - - * (PHP_4_3) - NEWS: - Note about apache2 change - -2003-03-16 Sascha Schumann - - * (PHP_4) - ext/standard/php_smart_str.h: - Preserve explicit casting semantics from functions, so that you can - also pass void pointers to the macros. - - * ext/standard/php_smart_str.h: - Merge macro changes - -2003-03-16 Marcus Boerger - - * php.ini-dist - php.ini-recommended - main/main.c: - - disable html_errors per default as suggested by php.ini- - - new error format that does not point to any documentation (if either - not html_errors or no docref_root given e.g.: production boxes and - default) - - documentation update in php.ini- - -2003-03-16 Jani Taskinen - - * ext/interbase/interbase.c: - WS & CS fixes + some TSRM_FETCH() removals + pval -> zval - - * (PHP_4_3) - NEWS - ext/interbase/interbase.c: - MFH: - Fixed bug #22709 (crash within interbase when database unavailable) - - * ext/interbase/interbase.c: - - Fixed bug #22709 (crash within interbase when database unavailable) - -2003-03-15 Moriyoshi Koizumi - - * tests/lang/bug22592.phpt: - - Added test for bug22592 - -2003-03-15 Hartmut Holzgraefe - - * ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_nonapi.c - ext/mysqli/mysqli_profiler.c: - lots of proto stuff - - * scripts/ext_skel_ng/extension_parser.php: - docbook fixes - - * scripts/ext_skel_ng/php_constant.php: - thinko fix to kill warnings - - * scripts/ext_skel_ng/php_resource.php: - docbook typo fix - - * scripts/ext_skel_ng/php_function.php: - make sure the function name in the proto matches the function - -2003-03-15 Marcus Boerger - - * main/main.c: - fix Bug #21751 - the parameter was wrong when this code was introduced - -2003-03-15 Wez Furlong - - * main/streams/cast.c - main/streams/plain_wrapper.c - main/streams/xp_socket.c: - 64bit fixes - - * ext/openssl/openssl.c: - fix proto - - * (PHP_4_3) - main/network.c - main/streams.c: - 64 bit fixes - -2003-03-15 Jani Taskinen - - * NEWS: - And this never existed in any release either.. - - * (PHP_4_3) - php.ini-dist - php.ini-recommended: - MFH: "allow_webdav_methods" does not exist / is not needed anymore - - * php.ini-dist - php.ini-recommended: - "allow_webdav_methods" does not exist / is not needed anymore - -2003-03-14 Jay Smith - - * ext/standard/browscap.c: - - -2003-03-14 Jani Taskinen - - * ext/mssql/php_mssql.c: - No c++ comments - - * sapi/tux/php_tux.c: - no c++ comments - - * ext/interbase/interbase.c: - No c++ comments! - -2003-03-14 Moriyoshi Koizumi - - * tests/lang/bug19943.phpt: - Fixed typo - -2003-03-14 Ilia Alshanetsky - - * ext/gd/libgd/gd_gd.c - ext/gd/libgd/gd_gd2.c - ext/gd/libgd/gd_png.c - ext/gd/libgd/gd_ss.c - ext/gd/libgd/gd_wbmp.c: - Whitespace fixes. - -2003-03-14 Derick Rethans - - * (PHP_4_3) - NEWS: - - Explain that it is interbase related (Thanks to Andrey) - - * (PHP_4_3) - NEWS: - - BFN - -2003-03-14 Daniela Mariaschi - - * (PHP_4_3) - ext/interbase/config.m4: - reverting to 1.8.4.1 - - * ext/interbase/config.m4: - reverting to version 1.9 - -2003-03-13 Daniela Mariaschi - - * ext/interbase/config.m4: - Test for libgds needs libcrypt with Firebird to succeed - -2003-03-13 Jani Taskinen - - * (PHP_4_3) - NEWS: - BFN shortening - - * NEWS: - this is in the PHP_4_3 branch... - -2003-03-13 Edin Kadribasic - - * (PHP_4_3) - NEWS - php.ini-dist - php.ini-recommended: - Document removal of gd1 support on windows. - - * (PHP_4_3) - ext/gd/gd.dsp - ext/gd/gd_bundled.dsp: - Drop support for php_gd.dll (gd1). - The default build (gd.dsp) is now bundled gd2. - - * (PHP_4_3) - sapi/apache2filter/php4apache2.dsp: - Disable building of apache2filter (obsoleted by handler). - -2003-03-13 Daniela Mariaschi - - * (PHP_4_3) - ext/interbase/interbase.c: - Numeric/decimal datatype overflow on Win32 - Fixed bug #20641 - -2003-03-13 Edin Kadribasic - - * (PHP_4_3) - sapi/apache2handler/php4apache2.dsp - sapi/apache2handler/php_functions.c: - Make apache2 handler produce php4apache2.dll which should work as a - drop in replacement for the filter. Remove max_request_per_child from - minfo() since that function is not exported by win32 version of apache2 - lib. - -2003-03-13 Daniela Mariaschi - - * ext/interbase/interbase.c: - Numeric/decimal datatype overflow on Win32. - Fixed bug #20641 - -2003-03-13 Martin Jansen - - * (PHP_4_3) - pear/PEAR.php: - - Also fix #21845 in the release branch. - - -2003-03-13 Derick Rethans - - * ext/mcrypt/mcrypt.c: - - Whitespace - -2003-03-13 Martin Jansen - - * pear/PEAR.php: - - Fixing bug #21845. - -2003-03-13 Sara Golemon - - * NEWS - NEWS: - BFN - -2003-03-13 J Smith - - * ext/standard/tests/time/002.phpt: - Solaris knows nothing of "Europe/Amsterdam". Use "US/Eastern" instead. - -2003-03-13 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/curl/interface.c: - Fixed bug #22681 (Crash when reading from invalid file pointer). - -2003-03-13 Jani Taskinen - - * ext/sybase_ct/config.m4: - Prevent using both --with-sybase and --with-sybase-ct in same build - - * NEWS: - hrm - -2003-03-13 Sara Golemon - - * ext/gmp/gmp.c: - Bug #21534. Silly typo. - -2003-03-13 Hartmut Holzgraefe - - * README.EXT_SKEL: - advertising ext_skel_ng ;) - -2003-03-13 Ilia Alshanetsky - - * ext/gd/libgd/gd_io.c - ext/gd/libgd/gd_io.h - ext/gd/libgd/gd_io_dp.c - ext/gd/libgd/gd_io_file.c - ext/gd/libgd/gd_io_ss.c: - Cleanup. - -2003-03-12 Jani Taskinen - - * (PHP_4_3) - NEWS: - We should get this out before April.. - - * (PHP_4_3) - configure.in - main/php_version.h: - - Backup to 4.3.2RC - - * (PHP_4_3) - configure.in - main/php_version.h: - - Bump the version to RC1. - -2003-03-12 Stefan Esser - - * main/main.c: - reverting half the patch (it is not that simple) - -2003-03-12 Sterling Hughes - - * ext/standard/basic_functions.c - ext/standard/file.c - ext/standard/file.h: - - -2003-03-12 Ilia Alshanetsky - - * ext/odbc/php_odbc.c: - Fixed spprintf() usage. - Fixed compiler warnings. - -2003-03-12 Jani Taskinen - - * ext/gd/gd.c: - Added the type constants for imagegd2() - - * ext/gd/gd.c - ext/gd/gd_ctx.c: - Fix bug #22646 - - * acinclude.m4: - prevent warning - - * NEWS: - This was merged into PHP_4_3 branch.. - -2003-03-12 Ilia Alshanetsky - - * ext/gd/libgd/gd.c - ext/gd/libgd/xbm.c: - Style fixes. - -2003-03-12 Marcus Boerger - - * tests/classes/interface_class.phpt - tests/classes/interface_doubled.phpt - tests/classes/interface_implemented.phpt - tests/classes/interface_instantiate.phpt - tests/classes/interface_member.phpt - tests/classes/interface_method.phpt - tests/classes/interface_method_final.phpt - tests/classes/interface_method_private.phpt - tests/classes/interface_must_be_implemented.phpt: - Added some interface tests - -2003-03-11 Jani Taskinen - - * (PHP_4_3) - sapi/apache2handler/php_functions.c: - OnUpdateLong is only in php5/HEAD. (oops! :) - -2003-03-11 Moriyoshi Koizumi - - * (PHP_4_3) - ext/xml/expat/expat.h: - Fixed bug #22634 (broken cygwin build) - -2003-03-11 Jani Taskinen - - * NEWS: - This went to 4_3 branch - - * (PHP_4_3) - NEWS - NEWS: - BFN - - * (PHP_4_3) - ext/odbc/config.m4: - MFH: - Fixed bug #20715 (odbc could not be compiled as shared extension) - - * ext/odbc/config.m4: - - Fixed bug #20715 (odbc could not be compiled as shared extension) - -2003-03-11 Sascha Schumann - - * ext/standard/url_scanner_ex.c - ext/standard/url_scanner_ex.c - ext/standard/url_scanner_ex.c - ext/standard/url_scanner_ex.re - ext/standard/url_scanner_ex.re - ext/standard/url_scanner_ex.re: - fix sizeof(size_t) > sizeof(uint) issue - -2003-03-11 Jani Taskinen - - * (PHP_4_3) - ext/imap/config.m4: - MFH: Fixed bug #22616 (Wrong order of -lssl and -lcrypto with IMAP) - - * ext/imap/config.m4: - Fixed bug #22616 (Wrong order of -lssl and -lcrypto with IMAP) - -2003-03-11 Sascha Schumann - - * ext/standard/url_scanner_ex.c - ext/standard/url_scanner_ex.c - ext/standard/url_scanner_ex.re - ext/standard/url_scanner_ex.re: - reverting jani's non-sense commits - -2003-03-11 Georg Richter - - * ext/mysqli/config.m4: - added new profiler-files - - * ext/mysqli/mysqli.c - ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_nonapi.c - ext/mysqli/mysqli_profiler.c - ext/mysqli/mysqli_profiler.h - ext/mysqli/mysqli_profiler_com.c - ext/mysqli/mysqli_profiler_com.h - ext/mysqli/php_mysqli.h: - profiler: - moved profiler stuff from php_mysql.h to separate include file - added port communication - added xml support for file and port output - -2003-03-10 Jani Taskinen - - * ext/standard/url_scanner_ex.c: - touch - - * ext/standard/url_scanner_ex.re: - 64bit issue fixed - -2003-03-10 J Smith - - * tests/classes/__set__get_001.phpt: - modified test to reflect change in var_dump(). - -2003-03-10 Moriyoshi Koizumi - - * ext/standard/tests/strings/bug22224.phpt - tests/lang/bug22231.phpt: - Modified the test to reflect the recent change on var_dump() - -2003-03-10 David Hill - - * ext/pgsql/pgsql.c - ext/standard/url_scanner.c - ext/standard/url_scanner_ex.c: - Correcting int/long mismatched - 64bit issues. - -2003-03-10 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/gd/libgd/gdft.c: - Fixed bug #22613 (imagettfbox() does not add the kerning distance to the - running position). - Fixed few possible memory leaks. - -2003-03-10 David Hill - - * ext/ftp/php_ftp.c - ext/ftp/php_ftp.c - ext/sockets/sockets.c - ext/sockets/sockets.c: - fixing missed int to long with zend_parse_parameters - -2003-03-10 Andrei Zmievski - - * ext/standard/var.c: - Print the object handle (it's useful). - -2003-03-10 David Hill - - * ext/pfpro/php_pfpro.h - ext/skeleton/php_skeleton.h - ext/yaz/php_yaz.h - ext/zlib/php_zlib.h - main/php_globals.h: - 64 bit corrections to parameters to OnUpdateInt Bug #20994 (Dave) - -2003-03-10 Jani Taskinen - - * acinclude.m4 - configure.in: - - Always use the shtool mkdir. - - * NEWS: - this is in the 4_3 branch - -2003-03-10 David Hill - - * (PHP_4_3) - ext/pfpro/php_pfpro.h - ext/skeleton/php_skeleton.h - ext/yaz/php_yaz.h - ext/zlib/php_zlib.h - main/php_globals.h: - 64-bit corrections to parameters to OnUpdateInt Bug #20994 (Dave) - -2003-03-10 Jani Taskinen - - * (PHP_4_3) - sapi/apache2filter/config.m4 - sapi/apache2handler/.cvsignore - sapi/apache2handler/CREDITS - sapi/apache2handler/EXPERIMENTAL - sapi/apache2handler/README - sapi/apache2handler/apache_config.c - sapi/apache2handler/config.m4 - sapi/apache2handler/php.sym - sapi/apache2handler/php4apache2.dsp - sapi/apache2handler/php_apache.h - sapi/apache2handler/php_functions.c - sapi/apache2handler/sapi_apache2.c: - - MFH: apache2handler sapi module - - Changed apache2filter to use --with-apxs2filter - - * sapi/apache2filter/config.m4 - sapi/apache2handler/config.m4: - - Changed --with-apxs2 for apache2handler. - - -2003-03-10 Shane Caraveo - - * (PHP_4_3) - ext/standard/tests/time/mktime.phpt: - fix line endings in file - - * (PHP_4_3) - sapi/cgi/cgi_main.c: - fix using stdin. This was already fixed in php5. - -2003-03-10 Jani Taskinen - - * ext/fdf/fdf.c: - cs & ws fixes - - * (PHP_4_3) - ext/fdf/fdf.c: - no c++ comments.. - -2003-03-10 Shane Caraveo - - * (PHP_4_3) - ext/standard/tests/strings/bug21453.phpt: - line endings on win32 made the var_dump'ed string 4 bytes longer. this - should work on all platforms. - - * (PHP_4_3) - ext/standard/tests/reg/009.phpt: - splitting on whitespace will be different depending on platform, so be - specific with the line ending. - - * (PHP_4_3) - ext/standard/tests/file/fopencookie.phpt: - make test happy by adding missing functions to avoid warnings, taken from - user_stream.c - -2003-03-09 Sara Golemon - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/user_filters.c: - Adjustment to user filters reimplementation. Make a bucket an object - containing a resource(the real bucket) and a data element for direct - operations. Simplifies - user interface and reduces number of function calls/reallocs needed. - -2003-03-09 Derick Rethans - - * (PHP_4_3) - ext/pgsql/pgsql.c: - - No C++ comments! (Patch by Magnus) - -2003-03-09 Uwe Schindler - - * sapi/nsapi/nsapi-readme.txt - sapi/nsapi/nsapi-readme.txt: - Changes for iPlanet Webserver 6 - -2003-03-09 Derick Rethans - - * ext/standard/string.c: - - Fix proto - -2003-03-08 Georg Richter - - * ext/mysqli/mysqli.c - ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_fe.c - ext/mysqli/mysqli_nonapi.c - ext/mysqli/mysqli_profiler.c - ext/mysqli/php_mysqli.h: - various changes for profiler - -2003-03-08 Derick Rethans - - * (PHP_4_3) - NEWS - ext/gd/gdttf.c: - - MFH: Fixed a bug in GD's truecolor TTF handling. - - * ext/gd/gdttf.c: - - Fixed a bug in GD's truecolor TTF handling - -2003-03-08 Marcus Boerger - - * main/network.c: - fix warnings - one left - - * run-tests.php: - summary for selective tests if more than one - - -2003-03-08 Stefan Esser - - * main/main.c: - fix possible XSS in error messages - - * ext/standard/html.c: - wrong place. - -2003-03-08 Sascha Schumann - - * (PHP_4) - ext/standard/php_smart_str.h: - macro-ize smart string implementation to improve optimization - across single calls - -2003-03-08 Stefan Esser - - * ext/standard/html.c: - fixing memory leak - -2003-03-07 Jani Taskinen - - * sapi/isapi/php4isapi.c: - Fixed bug #22473 (ISAPI Secure Server Variables not available) - - * (PHP_4_3) - NEWS: - Added note about the 64bit fixes - - * NEWS: - These will be already in 4.3.x - -2003-03-07 Uwe Schindler - - * (PHP_4_3) - sapi/nsapi/CREDITS: - credits update - -2003-03-07 J Smith - - * tests/classes/interfaces_001.phpt - tests/classes/interfaces_002.phpt - tests/classes/type_hinting_001.phpt - tests/lang/type_hints_001.phpt: - Added tests for interfaces and class type hinting. - -2003-03-07 Ben Mansell - - * sapi/cgi/cgi_main.c: - Fix bug whereby a webserver closing stdout from the CGI/FastCGI binary - would cause PHP to get caught in an infinite loop of failing write() - syscalls. - -2003-03-07 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/ldap/ldap.c: - Fixed bug #22585 (Do not terminate the script on minor errors). - - * sapi/apache2handler/php_functions.c: - OnUpdateInt -> OnUpdateLong. - - * sapi/apache2handler/apache_config.c - sapi/apache2handler/php_apache.h - sapi/apache2handler/php_functions.c - sapi/apache2handler/sapi_apache2.c: - CS Fixes. - Fixed a bug with 404 handling. - Added more detailed Apache info for phpinfo(). - Added the support for last_modified. - -2003-03-07 David Hill - - * (PHP_4_3) - ext/bz2/bz2.c - ext/dio/dio.c - ext/domxml/php_domxml.c - ext/fdf/fdf.c - ext/ftp/php_ftp.c - ext/ldap/ldap.c - ext/mcrypt/mcrypt.c - ext/mhash/mhash.c - ext/openssl/openssl.c - ext/pgsql/pgsql.c - ext/posix/posix.c - ext/sockets/sockets.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/html.c - ext/standard/metaphone.c - ext/standard/string.c - ext/sysvsem/sysvsem.c - ext/zip/zip.c - ext/zlib/zlib.c - main/output.c: - 64-bit correction to variables passed to zend_parse_parameters - -2003-03-07 Jani Taskinen - - * configure.in: - Create php_version.h in the correct directory - - * ext/fam/fam.c - ext/fbsql/php_fbsql.c - ext/hwapi/hwapi.cpp - ext/hyperwave/hw.c - ext/informix/ifx.ec - ext/ingres_ii/ii.c - ext/interbase/interbase.c - ext/ircg/ircg.c - ext/ldap/ldap.c - ext/mbstring/mbstring.c - ext/mssql/php_mssql.c - ext/mysql/php_mysql.c - ext/mysqli/mysqli.c - ext/ncurses/ncurses.c - ext/odbc/php_odbc.c - ext/pfpro/pfpro.c - ext/pgsql/pgsql.c - ext/session/session.c - ext/skeleton/skeleton.c - ext/standard/assert.c - ext/standard/file.c - ext/sybase_ct/php_sybase_ct.c - ext/sysvmsg/sysvmsg.c - ext/tokenizer/tokenizer.c - ext/yaz/php_yaz.c - ext/zlib/zlib.c - main/main.c - netware/phplib.imp - sapi/apache/php_apache.c - sapi/apache_hooks/php_apache.c - scripts/ext_skel_ng/extension_parser.php: - Renamed OnUpdateInt -> OnUpdateLong to prevent further misunderstandings. - - * ext/odbc/config.m4: - Fixed typo caught by Dave. - - * ext/sysvmsg/php_sysvmsg.h - ext/sysvmsg/sysvmsg.c - ext/sysvsem/sysvsem.c - ext/sysvshm/php_sysvshm.h - ext/sysvshm/sysvshm.c: - WS & CS fixes - -2003-03-07 Marcus Boerger - - * tests/classes/abstract.phpt - tests/classes/abstract_class.phpt - tests/classes/abstract_inherit.phpt - tests/classes/abstract_not_declared.phpt - tests/classes/abstract_static.phpt: - abstract classes must now be declared abstract - -2003-03-06 David Hill - - * ext/bz2/bz2.c - ext/dio/dio.c - ext/domxml/php_domxml.c - ext/fdf/fdf.c - ext/ftp/php_ftp.c - ext/iconv/iconv.c - ext/ldap/ldap.c - ext/mcrypt/mcrypt.c - ext/mhash/mhash.c - ext/openssl/openssl.c - ext/pgsql/pgsql.c - ext/posix/posix.c - ext/sockets/sockets.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/html.c - ext/standard/metaphone.c - ext/standard/string.c - ext/sysvsem/sysvsem.c - ext/zip/zip.c - ext/zlib/zlib.c - main/output.c: - 64-bit correction to variables passed to zend_parse_parameters - -2003-03-06 Stefan Esser - - * ext/cyrus/cyrus.c - ext/db/db.c - ext/domxml/php_domxml.c - ext/fbsql/php_fbsql.c - ext/gd/libgd/gdtestft.c - ext/ming/ming.c - ext/msession/msession.c - ext/standard/basic_functions.c - ext/standard/file.c - ext/xslt/sablot.c - ext/zlib/zlib.c - main/main.c - main/streams/streams.c - sapi/servlet/servlet.c: - Fixing functionicalls with variable number of parameters... - -2003-03-06 Moriyoshi Koizumi - - * tests/lang/bug19943.phpt: - Further testing on this feature should have been done... - - * tests/classes/abstract_class.phpt - tests/classes/abstract_inherit.phpt: - Fixed typo - -2003-03-06 Jani Taskinen - - * tests/lang/bug19943.phpt: - - added test for the memleak part from bug #19943 - -2003-03-05 Sascha Schumann - - * acinclude.m4: - Allow shared modules to be built using $(CXX) - -2003-03-05 Jani Taskinen - - * (PHP_4_3) - NEWS: - I was bored.. - -2003-03-05 Moriyoshi Koizumi - - * ext/standard/filters.c: - Fixed a small leak in the convert filter code - -2003-03-05 Sascha Schumann - - * (PHP_4) - configure.in: - test commit - -2003-03-05 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * main/rfc1867.c: - Fixed bug #22550 (overflow protection for upload_max_filesize ini setting). - - * (PHP_4_3) - NEWS: - GD news. - - * ext/gd/tests/bug22544.phpt: - - Added test case for bug #22544. - -2003-03-05 Jani Taskinen - - * sapi/apache2filter/sapi_apache2.c - sapi/apache2handler/sapi_apache2.c: - - Fix for some unixware compile problem. (comment by Sascha :) - -2003-03-05 Ilia Alshanetsky - - * ext/gd/gd.c: - Better identification of bundled GD library. - - * (PHP_4_3) - ext/gd/gd.c - ext/gd/gdcache.c - ext/gd/gdcache.h - ext/gd/gdttf.c - ext/gd/php_gd.h - ext/gd/libgd/gd.c - ext/gd/libgd/gd.h - ext/gd/libgd/gd_arc_f_buggy.c - ext/gd/libgd/gd_gd2.c - ext/gd/libgd/gd_gif_in.c - ext/gd/libgd/gd_jpeg.c - ext/gd/libgd/gd_png.c - ext/gd/libgd/gd_ss.c - ext/gd/libgd/gd_topal.c - ext/gd/libgd/gd_wbmp.c - ext/gd/libgd/gdcache.c - ext/gd/libgd/gdft.c - ext/gd/libgd/gdhelpers.c - ext/gd/libgd/gdhelpers.h - ext/gd/libgd/gdkanji.c - ext/gd/libgd/gdxpm.c: - Synchronized bundled gd with gd 2.0.11 (bug fixes). - MFH - 1) Use Zend allocation macros instead of native allocation functions. - 2) Better error reporting mechanism. - 3) Some style fixes, which allow easier code synchronization & - maintenance. - - * ext/gd/libgd/gd_png.c: - Fixed bug #22544 (missing fix from official gd). - -2003-03-05 Ben Mansell - - * sapi/cgi/libfcgi/fcgiapp.c: - C++ -> C comments - -2003-03-05 Corne' Cornelius - - * ext/informix/ifx.ec: - - Reverted emalloc(),efree() changed for persistant connection resources - -2003-03-05 Ben Mansell - - * README.Zeus: - Update build instructions for Zeus web server - -2003-03-05 Corne' Cornelius - - * ext/informix/ifx.ec: - - Changed malloc() and free() to emalloc() and efree() - -2003-03-05 Moriyoshi Koizumi - - * (PHP_4_3) - ext/mbstring/mbstring.c: - MFH: added missing phpinfo entry (Russian support) - - * ext/mbstring/mbstring.c: - Added missing phpinfo entry (Russian support) - -2003-03-05 Wez Furlong - - * (PHP_4_3) - main/network.c - main/streams.c: - Fix some signed/unsigned issues with read() and SSL_read() return values. - Allow SSL_connect() to retry for non-blocking sockets. - Correctly declare the char as unsigned for php_stream_getc(), as per - fgetc() semantics. - -2003-03-04 Marcus Boerger - - * ext/dba/dba.c - ext/dba/php_dba.h: - Use stream locking support - -2003-03-04 Ilia Alshanetsky - - * README.STREAMS: - Added notes about locking functions. - -2003-03-04 Marcus Boerger - - * ext/dba/tests/dba_cdb.phpt - ext/dba/tests/dba_cdb_make.phpt - ext/dba/tests/dba_cdb_read.phpt - ext/dba/tests/dba_db2.phpt - ext/dba/tests/dba_db3.phpt - ext/dba/tests/dba_db4.phpt - ext/dba/tests/dba_dbm.phpt - ext/dba/tests/dba_flatfile.phpt - ext/dba/tests/dba_gdbm.phpt - ext/dba/tests/dba_inifile.phpt - ext/dba/tests/dba_ndbm.phpt - ext/dba/tests/skipif.inc - ext/dba/tests/test.inc: - Support all possible configurations and simplify includes - - * ext/dba/dba.c: - fix dba by fixing key_len retrieval - -2003-03-04 Moriyoshi Koizumi - - * tests/lang/bug22510.phpt: - - Added a test case for bug #22510 - -2003-03-04 Marcus Boerger - - * run-tests.php: - do not use $GLOBAL[] - -2003-03-04 Jani Taskinen - - * ext/hyperwave/hw.c: - typofix - -2003-03-04 Marcus Boerger - - * tests/classes/__call_001.phpt: - If this doesn't show "3.4" there is another error - -2003-03-04 Moriyoshi Koizumi - - * ext/iconv/iconv.c: - 64bit long fix - - * ext/mbstring/mbstring.c - ext/mbstring/php_mbregex.c: - 64bit long fix: patch by Dave Hill - -2003-03-04 Ilia Alshanetsky - - * ext/odbc/php_odbc.c: - Fixed bug #22437. - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * (PHP_4_3) - main/streams.c: - Compiler warning fix. - - * ext/standard/http_fopen_wrapper.c: - Added support for http redirects to ftp. - Fixed bug #22508 (Added protection against circular HTML redirects). - - * ext/standard/tests/file/bug22414.phpt: - Skip test if running under safe-mode. - -2003-03-04 Jani Taskinen - - * (PHP_4_3) - NEWS: - adding news entry for disable_classes addition - - * NEWS: - These are in the branch. - - * main/main.c: - ws & CS - - * NEWS: - remove this from here as it belongs elsewhere - -2003-03-04 Christian Stocker - - * ext/domxml/php_domxml.c: - MFB (make it really W3C compatible (unlink node, when in tree...)) - - * (PHP_4_3) - ext/domxml/php_domxml.c: - make it really W3C compatible (unlink node, when in tree...) - -2003-03-04 Edin Kadribasic - - * ext/standard/credits_ext.h - ext/standard/credits_sapi.h - sapi/apache2filter/CREDITS - sapi/apache2handler/CREDITS: - Credits update. - -2003-03-03 Georg Richter - - * ext/mysqli/php_mysqli.h: - fixed bug in macro-definition - - * ext/mysqli/tests/051.phpt - ext/mysqli/tests/052.phpt: - disabled output of errormessages - - * ext/mysqli/config.m4 - ext/mysqli/mysqli.c - ext/mysqli/mysqli_fe.c - ext/mysqli/mysqli_nonapi.c - ext/mysqli/mysqli_profiler.c - ext/mysqli/php_mysqli.h: - added profiler support - -2003-03-03 Edin Kadribasic - - * (PHP_4_3) - ext/standard/credits_ext.h - ext/standard/credits_sapi.h: - Update credits. - - * (PHP_4_3) - NEWS: - BFN - - * ext/mcrypt/mcrypt.dsp: - MFB: Enabled mcrypt_generic_deinit() on windows (#22520) - - * (PHP_4_3) - ext/mcrypt/mcrypt.dsp: - Enabled mcrypt_generic_deinit() on windows (#22520) - -2003-03-03 Ilia Alshanetsky - - * main/main.c: - More compiler warnings fixed. - - * main/php_variables.h - main/streams/xp_socket.c: - Compiler warning fix. - - * main/php_variables.c: - Fixed compiler warnings. - -2003-03-03 J Smith - - * tests/classes/__call_001.phpt - tests/classes/__clone_001.phpt - tests/classes/__set__get_001.phpt - tests/classes/constants_scope_001.phpt - tests/classes/dereferencing_001.phpt - tests/classes/factory_001.phpt - tests/classes/object_reference_001.phpt - tests/classes/singleton_001.phpt - tests/lang/error_2_exception_001.phpt - tests/lang/namespace_001.phpt: - Added some tests for ZE2 features and their functionality. - -2003-03-03 Marcus Boerger - - * tests/classes/ctor_dtor.phpt - tests/classes/ctor_dtor_inheritance.phpt: - Adding tests for ctor/dtor handling - - * tests/classes/abstract_static.phpt: - Adding tests for abstract static methods - - * tests/classes/abstract_final.phpt - tests/classes/final.phpt - tests/classes/final_abstract.phpt - tests/classes/final_redeclare.phpt: - Adding tests for final methods - -2003-03-03 Harald Radi - - * (PHP_4_3) - main/main.c: - MFH: adding disable_classes ini directive - - * (PHP_4_3) - php.ini-dist - php.ini-recommended: - MFH: adding placeholder for the new disable_classes directive - - * php.ini-dist - php.ini-recommended: - adding placeholder for the new disable_classes directive - - * main/main.c: - adding disable_classes ini directive based on the - newly introduced zend_disable_class function - -2003-03-03 Marcus Boerger - - * tests/run-test/test008a.phpt: - (re)check in non ZendOptimizer version of test - - * sapi/cli/TODO: - remove entry done already - -2003-03-02 Jani Taskinen - - * ext/ldap/config.m4: - typofix - - * ext/ldap/config.m4: - Special case for MacosX.. - - * ext/ldap/config.m4: - Fixed bug #22485 (hardcoded shared lib extensions) - -2003-03-02 Zeev Suraski - - * main/php_variables.c: - Fix old variable names - -2003-03-02 Marcus Boerger - - * run-tests.php: - fix problem in current HEAD - - -2003-03-02 Wez Furlong - - * sapi/activescript/scriptengine.cpp: - typo fix - -2003-03-02 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - New function news. - -2003-03-02 Uwe Schindler - - * sapi/nsapi/CREDITS: - -** empty log message *** - -2003-03-02 Zeev Suraski - - * ext/standard/info.c - main/php_variables.c: - - Optimize $_REQUEST - - Fix phpinfo() - -2003-03-02 Wez Furlong - - * sapi/activescript/classfactory.cpp - sapi/activescript/php4activescript.c: - Build-performance tweaks - - * ext/rpc/com/com.h - sapi/activescript/classfactory.cpp - sapi/activescript/scriptengine.cpp: - Fix build for activescript sapi - -2003-03-02 Derick Rethans - - * php.ini-dist - php.ini-recommended: - - It was called _VARS, not _GLOBALS :-) - -2003-03-02 Zeev Suraski - - * php.ini-dist - php.ini-recommended - ext/filepro/filepro.c - ext/session/session.c - main/main.c - main/php_globals.h - main/php_variables.c - main/php_variables.h: - Add JIT initialization for _SERVER and _ENV - (it's less important for the others, even though it should be fairly - easy now too) - -2003-03-02 Moriyoshi Koizumi - - * ext/standard/filters.c: - Fixed my silly mistake in the filter code - -2003-03-01 Moriyoshi Koizumi - - * main/network.c: - Reverted my previous commit - -2003-03-01 Wez Furlong - - * main/streams/plain_wrapper.c: - Ensure that all fields are initialized to NULL. - -2003-03-01 Moriyoshi Koizumi - - * main/network.c: - Fixed build - -2003-03-01 Wez Furlong - - * ext/xmlrpc/xmlrpc-epi-php.c: - Fix two crash bugs when optional parameters are not specified. - Fix folding markers. - - * main/streams/xp_socket.c: - Don't shutdown() unix sockets. - It causes the server end to close down/break. - - * main/streams/memory.c: - Folding fixes - - * scripts/Makefile.frag: - Add streams headers to those used for shared extensions. - - * NEWS: - New! - -2003-03-01 Pierre-Alain Joye - - * ext/gd/CREDITS: - update credits (ilia,myself) - -2003-03-01 Wez Furlong - - * ext/standard/basic_functions.c - ext/standard/streamsfuncs.c - ext/standard/streamsfuncs.h: - Expose php_stream_copy_to_stream as stream_copy_to_stream(); a high - performance alternative to looping reads and writes. - -2003-03-01 Pierre-Alain Joye - - * (PHP_4_3) - ext/gd/CREDITS: - Update credits - -2003-02-28 Wez Furlong - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/standard/streamsfuncs.c - main/network.c - main/php_network.h - main/streams/xp_socket.c - win32/select.c: - Tidy up stupid signed/unsigned issues with win32 by introducing a - php_socket_t typedef. - -2003-02-28 Rasmus Lerdorf - - * main/php_ini.c: - MFB config-file-scan-dir crash fix - - * (PHP_4_3) - main/php_ini.c: - but there is no top php.ini file, we would get a segfault. (Rasmus) - -2003-02-28 Wez Furlong - - * ext/standard/streamsfuncs.h: - Add this file... - - * NEWS - configure.in - ext/ftp/ftp.c - ext/openssl/xp_ssl.c - ext/standard/basic_functions.c - ext/standard/file.c - ext/standard/file.h - ext/standard/fsock.c - ext/standard/streamsfuncs.c - main/network.c - main/php_network.h - main/streams/php_stream_transport.h - main/streams/transports.c - main/streams/xp_socket.c: - New user-space functions: - . 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. - - Tidy up some leaks and debug printfs. - Move more streams functions into streamsfuncs.c and streamsfuncs.h. - -2003-02-28 Ilia Alshanetsky - - * ext/openssl/openssl.c - ext/standard/php_fopen_wrapper.c: - Fixed compiler warnings. - -2003-02-28 Moriyoshi Koizumi - - * (PHP_4_3) - NEWS: - Was actually an ucwords() problem... - -2003-02-28 Hartmut Holzgraefe - - * scripts/ext_skel_ng/TODO: - callbacks are now supported - (although there's still room for improvements) - -2003-02-28 Jani Taskinen - - * (PHP_4_3) - NEWS - NEWS: - BFN - -2003-02-28 Hartmut Holzgraefe - - * (PHP_4_3) - ext/standard/file.c - ext/standard/file.c - ext/yp/yp.c - ext/yp/yp.c: - MFphp5 - - * ext/standard/file.c: - it is still to early in the morning for coding :( - - * ext/standard/file.c: - make sure that GNU extensions exist for fnmatch() - -2003-02-28 Jani Taskinen - - * (PHP_4_3) - ext/curl/curl.c: - - MFH: Fixed bug #22312 (crash on failed connection when curl_getinfo() was - called). - (Phil Oleson ) - - * ext/curl/interface.c: - - Fixed bug #22312 (crash on failed connection when curl_getinfo() was - called). - (Phil Oleson ) - - * ext/ftp/ftp.c - ext/ftp/php_ftp.c - ext/openssl/xp_ssl.c - main/php_network.h: - - No need to include the ssl headers elsewhere but in ext/openssl - - * ext/yaz/config.m4 - ext/yaz/php_yaz.c: - YAZ 2.0 or later is required now. - -2003-02-28 Hartmut Holzgraefe - - * scripts/ext_skel_ng/extension_parser.php - scripts/ext_skel_ng/php_function.php: - - support for "callback" type - - proto syntax errors are now passed back to the top level parser - - * scripts/ext_skel_ng/ext_skel_ng.php: - support for passing description file name on command line - -2003-02-28 Jani Taskinen - - * ext/yaz/php_yaz.c - ext/yaz/php_yaz.h: - ws & CS - -2003-02-28 Hartmut Holzgraefe - - * scripts/ext_skel_ng/xml_stream_parser.php: - "on line #", not "in line #" - - * scripts/ext_skel_ng/php_element.php: - added "callback" type (and fixed a stupid typo) - - * scripts/ext_skel_ng/extension.dtd: - some DTD fixes and as a toplevel element for .c and .h code snippets - -2003-02-28 Wez Furlong - - * main/streams/plain_wrapper.c: - Implement memory mapping for win32. - Could do with some rigorous testing; simple readfile() tests here appear - to work. - -2003-02-28 Ilia Alshanetsky - - * main/network.c: - compiler warning fixed. - -2003-02-27 Ilia Alshanetsky - - * ext/standard/dir.c: - Fixed compiler warning. - - * ext/openssl/xp_ssl.c: - fixed compiler warnings. - -2003-02-27 Wez Furlong - - * ext/standard/config.m4: - streams.c -> streamsfuncs.c - - * ext/standard/streams.c - ext/standard/streamsfuncs.c - win32/php4dllts.dsp - win32/select.c: - Update win32 build. - Since msvc sucks, I had to rename ext/standard/streams.c to - ext/standed/streamsfuncs.c - - * ext/standard/config.m4 - ext/standard/file.c - ext/standard/file.h - ext/standard/streams.c - win32/select.c - win32/select.h - win32/installer/README: - Move streams specific stuff from ext/standard/file.c -> - ext/standard/streams.c - Move win32 select implementation into win32/. - Will update win32 build in a moment. - -2003-02-27 Ilia Alshanetsky - - * ext/standard/filestat.c: - Fixed a bug that would cause filetype() to return "unknown" for - non-existent files on Win32. - -2003-02-27 Wez Furlong - - * ext/standard/file.c - main/php_streams.h - main/streams/xp_socket.c: - Add a generic meta data api for streams. - -2003-02-27 Rasmus Lerdorf - - * TODO-PHP5: - The basic input filtering framework is done and working nicely - -2003-02-27 Wez Furlong - - * TODO: - Update todo slightly - - * ext/openssl/openssl.c - ext/standard/basic_functions.c - ext/standard/file.c - ext/standard/ftp_fopen_wrapper.c - ext/standard/http_fopen_wrapper.c - ext/standard/php_fopen_wrappers.h: - - Move https:// and ftps:// wrapper registration into the openssl module. - - Expose the http:// and ftp:// wrappers as PHPAPI - - Remove unused variables - - * main/network.c - main/streams/transports.c - main/streams/xp_socket.c - win32/php4dllts.dsp: - Fixup build for win32 - -2003-02-27 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/standard/filestat.c: - Fixed bug #21410 (fixed handling of NULL or "" files on Win32) - -2003-02-27 Jani Taskinen - - * NEWS: - ..if only all lakes were kossu.. - -2003-02-27 Hartmut Holzgraefe - - * ext/yp/yp.c: - changed from strncpy to strlcpy on request - -2003-02-27 Sascha Schumann - - * main/php_streams.h: - rename macro argument so that it does not partially match the string. - - fixes a warning on unixware - -2003-02-27 Corne' Cornelius - - * ext/informix/ifx.ec: - - Changed maxmsglen in ifx_errormsg() back to normal 255 instead of 10 - - * ext/informix/ifx.ec: - - Fixed possible Segfault in ifx_errormsg() using malloc() instead of - emalloc() - -2003-02-26 Pierre-Alain Joye - - * ext/gd/gd.c: - add imagesavealpha wrapper (Jukka Holappa , - 2 Pierre-Alain Joye) - - * ext/gd/php_gd.h: - add imagesavealpha wrapper (Jukka Holappa , - Pierre-Alain Joye) - -2003-02-26 Rasmus Lerdorf - - * main/main.c: - MFB: Get rid of a redundant syscall on non-Windows - - * (PHP_4_3) - main/main.c: - Get rid of an unnecessary syscall on non-Windows. We don't need two - setitimer() calls here in order to reset the timer. - -2003-02-26 Ilia Alshanetsky - - * ext/standard/exec.c - ext/standard/exec.h: - 1) Make the output of system() binary safe - 2) Solved a memory leak when the return_value variable passed by reference - is - not an integer in system()/exec()/passthru(). - 3) Solved a bug in exec(), which would make it append to the 2nd parameter - (passed by reference) if the parameter is an array instead of - overwriting it. - 4) Changed the code to use the streams code, resulting in a smaller code - base. - 5) Various cleanups resulting in reduction of overall code base inside the - file - by ~ 1/3. - 6) Speed improvements of ~2.5 times compared to previous performance - (based on - attached PHP script). - -2003-02-26 Marcus Boerger - - * ext/dba/dba.c: - allow keys as array(group, name) for handler inifile - - * ext/dba/dba_flatfile.c: - ws - - * ext/dba/libcdb/cdb.c: - make it faster - - * ext/dba/libinifile/inifile.c: - if skip param of dba_fetch is -1 stop do not restart search after last - element - -2003-02-26 Derick Rethans - - * ext/standard/mail.c - main/main.c: - - Added an extra ini setting with which extra commands can be forced to - the sendmail deamon on a per-vhost base. The value in this ini setting - will override all extra commands passed as the 5th parameter to mail() - and will work in Safe Mode. - - * ext/standard/file.c: - - Fix proto - - * ext/standard/basic_functions.c: - - Whitespace - -2003-02-26 Hartmut Holzgraefe - - * (PHP_4_3) - ext/yp/yp.c - ext/yp/yp.c: - MFphp5 - - * ext/yp/yp.c: - changed to emalloc just to be safe - - * scripts/ext_skel_ng/php_logo.php - scripts/ext_skel_ng/php_resource.php: - forgot to add these two on my last commit :( - -2003-02-25 Ilia Alshanetsky - - * ext/standard/exec.c: - Made shell_exec() use streams, this simplifies the code and in some cases - makes it a little faster too. - - * ext/standard/url.c: - MFH (forgot to put this fix into the 5.X tree). - -2003-02-25 Moriyoshi Koizumi - - * NEWS: - NEWS update - - * ext/standard/file.c: - Set fgetss() free from the length parameter - - * (PHP_4_3) - NEWS: - BFN: the fix was actually done by Ilia. - - * (PHP_4_3) - ext/standard/html.c: - MFH(r1.72): int / long change - Fixed bug #22301 (htmlspecialchars crashes on Tru64) - -2003-02-25 Ilia Alshanetsky - - * ext/standard/tests/file/bug22414.phpt: - Fixed test. - - * ext/standard/exec.c - ext/standard/tests/file/bug22414.phpt: - Fixed bug #22414 and added a test case for it. - -2003-02-25 Jani Taskinen - - * ext/odbc/config.m4: - Cleanup - - * (PHP_4_3) - NEWS - NEWS - NEWS: - BFN - - * (PHP_4_3) - configure.in: - MFH: Fixed bug #21224 (apache configure fails when using - --enable-versioning) - - * configure.in: - - Fixed bug #21224 (apache configure fails when using --enable-versioning) - - * (PHP_4_3) - main/php.h - main/php_sprintf.c - main/snprintf.c - main/snprintf.h: - MFH: Fixed bug #20256 (snprintf() not defined on some systems) - - * main/php.h - main/php_sprintf.c - main/snprintf.c - main/snprintf.h: - Fixed bug #20256 (snprintf() not defined) - -2003-02-25 Adam Dickmeiss - - * ext/yaz/php_yaz.c: - Tabify - - * ext/yaz/php_yaz.c: - yaz_search supports query type cql - -2003-02-25 Jani Taskinen - - * configure.in: - typofix - - * ext/curl/interface.c - ext/curl/multi.c: - (hope) fix some win32 build errors - -2003-02-25 Corne' Cornelius - - * ext/informix/CREDITS - ext/informix/ifx.ec - ext/informix/php_informix.h - ext/informix/php_informix_includes.h: - - Added Corne' Cornelius to CREDITS/Authors - -2003-02-25 Jani Taskinen - - * sapi/pi3web/pi3web_sapi.c: - Another win32 build fix. - - * sapi/activescript/php4activescript.c - sapi/activescript/scriptengine.cpp: - (hopefully) fix the build.. - - * (PHP_4_3) - configure.in: - MFH: Fixed bug #14245 ('make install' fails on AIX when using --with-apxs). - - * configure.in: - - Fixed bug #14245 ('make install' fails on AIX when using --with-apxs). - -2003-02-25 Corne' Cornelius - - * ext/informix/config.m4: - - Changed IFX_VERSION to work with Major versions with more then one digit - -2003-02-25 Jani Taskinen - - * ext/oci8/config.m4: - fix bug #22324, libjdbcoci8.so is not necessarily needed.. - -2003-02-25 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/standard/ftp_fopen_wrapper.c: - Fixed bug #22402 (opening of ftp for read/write could fail due to invalid - return code handling). - Solution suggested by jan@jancm.org - - * (PHP_4_3) - ext/gd/libgd/gd.c: - MFH (fix for crash in gdImageCopyMergeGray()). - - * ext/gd/libgd/gd.c: - Fixed a crash in gdImageCopyMergeGray(). - -2003-02-25 Stig Bakken - - * pear/package-PEAR.xml - pear/PEAR/Common.php - pear/PEAR/Packager.php - pear/PEAR/Command/Package.php: - - fixed generation, provides elements are now included for - every non-private class, function and method - - * ext/tokenizer/tokenizer.c: - - add new ZE2 tokens - -2003-02-25 Ilia Alshanetsky - - * main/streams/plain_wrapper.c: - Fixed various compiler warnings. - - * main/streams/plain_wrapper.c: - Use native flock() whenever possible. - - * ext/standard/file.c - main/php_streams.h - main/streams/plain_wrapper.c: - Added locking to streams. - Allow PHP to automatically release locks on files when terminating the - stream. - Fixed bugs in the handling of the 3rd optional parameter to flock(). - -2003-02-24 Moriyoshi Koizumi - - * main/streams/memory.c: - Removed unnecessary asserts - - * ext/standard/filters.c: - Fixed string.strip_tags filter so it reflects the change on php_strip_tags - - * ext/standard/file.c: - Made fgetss() binary safe too - - * ext/standard/string.c: - Fixed possible buffer overflow of php_strip_tags - - * ext/standard/php_string.h - ext/standard/string.c: - Made strip_tags() binary safe - -2003-02-24 Sara Golemon - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/user_filters.c: - Initial re-implementation of userfilters after filterchain redesign by wez. - More userspace API to come. - -2003-02-24 Wez Furlong - - * ext/standard/file.c - main/php_streams.h - main/streams/cast.c - main/streams/plain_wrapper.c - main/streams/streams.c: - MFB: Bunch of streams related fixes. - -2003-02-24 Ilia Alshanetsky - - * (PHP_4_3) - NEWS - NEWS: - Bug fixing news. - - * ext/standard/mail.c: - Fixed bug #22355 (PHP would remove folding from Subject & To fields). - -2003-02-24 Moriyoshi Koizumi - - * tests/lang/bug22367.phpt: - - Added test case for bug #22367 - - * ext/standard/reg.c: - Forgot to fix this part - - * tests/lang/bug21600.phpt: - Fixed the test as the result is just considered to be expected - - * (PHP_4_3) - ext/standard/reg.c: - MFH(r1.74): fixed an signed / unsigned issue - - * ext/standard/reg.c: - Fixed a signed / unsigned issue. - - -2003-02-24 Jani Taskinen - - * (PHP_4_3) - sapi/apache/config.m4: - MFH: Possible fix for #22259 + part 1/2 for fixing AIX DSO bug - - * sapi/apache/config.m4: - Possible fix for #22259 + part 1/2 for fixing one AIX bug.. - -2003-02-24 Moriyoshi Koizumi - - * ext/standard/reg.c: - Style fix - -2003-02-24 Jani Taskinen - - * (PHP_4_3) - tests/lang/bug21600.phpt - tests/lang/bug22231.phpt: - - Removing pointless tests. (both of these will be fixed in PHP 5) - - * NEWS - NEWS: - BFN - - * acinclude.m4: - fix quotes - -2003-02-24 Zeev Suraski - - * sapi/apache2filter/apache_config.c - sapi/apache2filter/php_functions.c - sapi/apache2filter/sapi_apache2.c: - (possibly) fix Win32 builds of the Apache 2 filter - -2003-02-24 Hartmut Holzgraefe - - * ext/yp/yp.c: - "key" has to be zero-delimited - - * scripts/ext_skel_ng/TODO - scripts/ext_skel_ng/dummy.gif - scripts/ext_skel_ng/ext_skel_ng.php - scripts/ext_skel_ng/extension.dtd - scripts/ext_skel_ng/extension.xml - scripts/ext_skel_ng/extension_parser.php - scripts/ext_skel_ng/php_function.php: - - code generation: resources and phpinfo logo - - duplicate code elimination for prototype parsing - - improved phpinfo block (incl. logo) - - some input error checking - - documentation generation for ini-directives, constants - and resources - -2003-02-24 Jani Taskinen - - * ext/informix/ifx.ec - ext/informix/ifx.ec: - no c++ comments - -2003-02-24 Corne' Cornelius - - * ext/informix/ifx.ec: - (PHP ifx_errormsg) Fixed Informix bug where ifx_errormsg() would Segfault - on an unopened connecection and with an errorcode - supplied - -2003-02-24 Jani Taskinen - - * acinclude.m4: - Always use the libtool which is build in the top_builddir. - - * ext/mhash/mhash.c - ext/mhash/php_mhash.h: - fix compile warning - -2003-02-24 Ilia Alshanetsky - - * ext/standard/file.c - ext/standard/tests/file/bug22382.phpt - ext/standard/tests/file/test2.csv: - Fixed bug #22382 (fgetcsv did not handle \" correctly). - -2003-02-24 George Schlossnagle - - * sapi/apache/mod_php4.c: - ws fix - - * sapi/apache/mod_php4.c: - hopefully a fix for 19919 - -2003-02-24 Jani Taskinen - - * ext/standard/basic_functions.c - ext/standard/dns.c - ext/standard/dns.h: - Extra paranoia checks if dn_skipname/dn_expand exist or not - -2003-02-23 Jani Taskinen - - * main/fopen_wrappers.c: - MFB: Fix for open_basedir error message - -2003-02-23 Rasmus Lerdorf - - * (PHP_4_3) - main/fopen_wrappers.c - main/streams.c: - open_basedir fixes from David Saez - -2003-02-23 Stig Bakken - - * pear/packages/XML_Parser-1.0.1.tar - pear/packages/XML_Parser-1.0.tar: - - - upgrading XML_Parser to 1.0.1 - -2003-02-23 Jani Taskinen - - * sapi/apache/libpre.c - sapi/apache/php_apache_http.h: - Added missing headers and Id tags. - - * sapi/cgi/config9.m4: - MFB: Fixed bug #22356 (Do not add empty -I flags). - - * (PHP_4_3) - sapi/cgi/config9.m4: - Fixed bug #22356 (Do not add empty -I flags). - - * ext/imap/config.m4: - Fix for bug #22353 - - * (PHP_4_3) - NEWS: - BFN - - * (PHP_4_3) - sapi/apache/config.m4 - sapi/apache2filter/config.m4: - MFH: - Fixed bug #22376 (wrong httpd.conf modified when using INSTALL_ROOT) - - * sapi/apache/config.m4 - sapi/apache2filter/config.m4 - sapi/apache2handler/config.m4: - - Fixed bug #22376 (wrong httpd.conf modified when using INSTALL_ROOT) - -2003-02-23 Marcus Boerger - - * tests/classes/abstract_inherit.phpt: - New test which currently fails - - * NEWS: - Fix the name - -2003-02-23 Jani Taskinen - - * sapi/apache2filter/EXPERIMENTAL - sapi/apache2handler/EXPERIMENTAL: - - These both are experimental still. (there has been a note in config.m4 - all the time but these marker files were missing) - - * NEWS: - Style - -2003-02-22 Marcus Boerger - - * ext/dba/libinifile/inifile.c: - Dropped optimization - -2003-02-22 Wez Furlong - - * (PHP_4_3) - NEWS: - Correct a bug number - thanks to Philip... - -2003-02-22 Marcus Boerger - - * ext/dba/libinifile/inifile.c: - INI files are case insensitive - -2003-02-22 Ilia Alshanetsky - - * ext/standard/basic_functions.c - ext/standard/file.c - ext/standard/file.h: - Revent previous patch, adding of file_write_content() was premature. - - * ext/standard/basic_functions.c - ext/standard/file.c - ext/standard/file.h - ext/standard/html.c: - int/long change. - -2003-02-22 Marcus Boerger - - * ext/dba/libinifile/inifile.c: - Remove testcode - - * ext/dba/config.m4 - ext/dba/dba.c - ext/dba/dba_inifile.c - ext/dba/php_inifile.h - ext/dba/libinifile/.cvsignore - ext/dba/libinifile/inifile.c - ext/dba/libinifile/inifile.h - ext/dba/tests/dba_inifile.phpt: - - -2003-02-22 Andrey Hristov - - * ext/standard/array.c: - additional speedup for array_shift(). No need to rehash if the removed - element's - key is not scalar and elements with scalar keys are already well numbered - (sequentially from 0) for some reason. This is the case if the leading - elements have no scalar indexes. - -2003-02-22 Wez Furlong - - * (PHP_4_3) - NEWS: - Squashed those ugly bugs! - -2003-02-22 Andrey Hristov - - * ext/standard/array.c: - rehash only in case something is changed. - -2003-02-22 Georg Richter - - * ext/mysqli/mysqli_api.c: - removed some comments - - * ext/mysqli/mysqli.c - ext/mysqli/mysqli_api.c - ext/mysqli/php_mysqli.h: - Fixed bug with stmt_close (libmysql bk version 1.1477 required) - Fixed bug with mysql_execute and float values - -2003-02-22 Justin Erenkrantz - - * sapi/apache2handler/sapi_apache2.c: - Add xbithack support to apache2handler SAPI. - - (configuration doesn't work, but that's not something new apparently.) - -2003-02-22 Wez Furlong - - * (PHP_4_3) - ext/standard/file.c - ext/standard/tests/file/bug21131.phpt - ext/standard/tests/file/bug22362.phpt - ext/standard/tests/file/bug22362.phpt - main/php_streams.h - main/streams.c: - Miscellaneous streams fixes, including probable fixes for: - Bug #21131 (fopen with 'a+' and rewind() doesn't work) - Bug #21713 (include remote files leaks temporary files + descriptors on - Solaris) - Bug #21185 (move_uploaded_file() does not ignore open_basedir as it - should) - Bug #22362 (combinations of fwrite(), fread() and fseek() produce - unexpected results) - -2003-02-21 Wez Furlong - - * main/network.c - win32/php4dllts.dsp: - Add comment about thread-safety of gethostbyname on win32. - Set the correct path to the win32 config.h file in the .dsp file. - -2003-02-21 Jani Taskinen - - * (PHP_4_3) - ext/snmp/php_snmp.h - ext/snmp/snmp.c: - fixed headers and cleaned up a bit - - * ext/standard/basic_functions.c - ext/standard/dns.c - ext/standard/dns.h: - - Fixed bug: #22339 - - * ext/informix/ifx.ec - ext/informix/php_informix_includes.h - ext/snmp/php_snmp.h: - MFB - - * (PHP_4_3) - ext/informix/ifx.ec: - ZTS build fixes, style and ws fixes - - * ext/ingres_ii/ii.c - ext/ingres_ii/ii.h: - ZTS fixes - - * (PHP_4_3) - ext/informix/ifx.ec: - Fix ZTS build - -2003-02-21 David Viner - - * sapi/apache/php4apache.dsp: - this tiny change adds the location of apache includes and libraries that - are installed when you use the Apache Windows Installer - (C:\Program Files\Apache Group\Apache\*). With this patch, - a windows developer who has used the Apache Windows Installer should be - able to compile the Apache sapi module without any modifications to - his/her - installed tree. It should have no effect whatsoever on anyone else. - - --dviner - -2003-02-20 Rasmus Lerdorf - - * README.input_filter - ext/mbstring/mb_gpc.c - main/SAPI.c - main/SAPI.h - main/php_variables.c - main/rfc1867.c: - An input filter might not simply strip stuff, it might also turn things - into entities or use some other mechanism which causes the filtered data - to be longer than the original data. Ergo, pass in the address of the - buffer instead so the filter is free to reallocate it. - -2003-02-20 Justin Erenkrantz - - * ext/pgsql/pgsql.c: - Remove C++-style comment. (Breaks Sun Forte compiler.) - -2003-02-20 Sara Golemon - - * ext/standard/php_fopen_wrapper.c: - Reduce unnecessary filter applications when stream is (read|write) only - -2003-02-20 Justin Erenkrantz - - * sapi/apache2handler/php_apache.h - sapi/apache2handler/php_functions.c - sapi/apache2handler/sapi_apache2.c: - Clean up apache2handler SAPI. - - Key improvements: - - Be streamy - - Re-enable virtual() support - - Set content_type correctly - - Remove unnecessary code and reintroduce some missing code - - Change signature from PhP to PHP - -2003-02-20 Moriyoshi Koizumi - - * (PHP_4_3) - NEWS: - BFN - - * (PHP_4_3) - ext/mbstring/mbstring.c: - MFH(r1.165): Fixed bug #22330 (overloaded strrpos() weirdness) - - * ext/mbstring/mbstring.c: - Fixed bug #22330 (overloaded strrpos() gives wrong results) - Patch by david at santinoli dot com. Thanks! - -2003-02-20 Derick Rethans - - * ext/standard/tests/strings/sha1.phpt - ext/standard/tests/strings/sha1raw.phpt: - - Fixed testcase... you can never trust on RFCs it seems - -2003-02-20 Hartmut Holzgraefe - - * scripts/ext_skel_ng/extension_parser.php: - put constants into C output - do not limit int constants to numbers, C #defines are ok as strings - foobar(void) needs special treatment in code generation - -2003-02-20 Jani Taskinen - - * NEWS: - style - -2003-02-20 Corne' Cornelius - - * (PHP_4_3) - ext/informix/php_informix_includes.h: - - from 16 to 32 to prevents possible overflow - -2003-02-20 Derick Rethans - - * ext/standard/md5.c: - - Fixed copy and paste bug - - * NEWS - ext/standard/md5.c - ext/standard/sha1.c: - - Also add the optional raw output parameter to md5_file and sha1_file. - -2003-02-20 Sascha Schumann - - * (PHP_4_3) - ext/session/session.c: - merge minor differences from head - -2003-02-20 Jani Taskinen - - * (PHP_4_3) - NEWS: - style fix - - * NEWS: - This is added in 4.3.2 - - * (PHP_4_3) - NEWS - NEWS - NEWS: - BFN - - * (PHP_4_3) - ext/pgsql/pgsql.c: - MFH: Fixed bug: #22306 (pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds but - returns false) - - * ext/pgsql/pgsql.c: - Fixed bug: #22306 (pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds but returns - false) - -2003-02-20 Sascha Schumann - - * NEWS - NEWS - NEWS: - update - -2003-02-20 Derick Rethans - - * ext/standard/md5.c - ext/standard/sha1.c: - - No need to add the \0 ourselves, the estrndup in STRINGL takes care of - that for us. - -2003-02-20 Sascha Schumann - - * (PHP_4_3) - ext/session/php_session.h - ext/session/session.c: - MFH general urlencoding - MFH session_regenerate_id, a change which is as important as the former - one - - * ext/session/session.c: - generally urlencode parameters - -2003-02-20 Jani Taskinen - - * (PHP_4_3) - ext/standard/dns.c: - MFH: - Fixed bug #22299 (gethostbyname() crash with non-existing domain on - MacOSX) - - * ext/standard/dns.c: - - Fixed bug #22299 (gethostbyname() crash with non-existing domain on - MacOSX) - -2003-02-20 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/standard/http_fopen_wrapper.c: - Revert accidental commit. - - * ext/standard/exec.c - ext/standard/http_fopen_wrapper.c: - Fixed bug #22308 (optimized passthru, code is now ~40 times faster). - -2003-02-20 Jani Taskinen - - * footer - header: - consistent with the used style - -2003-02-19 Jon Parise - - * ext/rpc/skeleton/php_skeleton.h - ext/rpc/skeleton/skeleton.c - ext/rpc/skeleton/skeleton.h: - Add folding markers and editor directive blocks. - -2003-02-19 Rasmus Lerdorf - - * ext/mbstring/mb_gpc.c - ext/mbstring/mb_gpc.h: - Fix mbstring input_filter - - * README.input_filter - ext/mbstring/mb_gpc.c - ext/mbstring/mbstring.c - main/SAPI.c - main/SAPI.h - main/php_content_types.c - main/php_variables.c - main/rfc1867.c: - Input Filter support. See README.input_filter for details. - -2003-02-19 Jani Taskinen - - * main/php_scandir.c - main/php_scandir.h: - MFB - - * (PHP_4_3) - main/php_scandir.c - main/php_scandir.h: - dirent.h needs to be included always. - -2003-02-19 Harald Radi - - * main/main.c: - prevent xdebug from crashing - -2003-02-19 Hartmut Holzgraefe - - * scripts/ext_skel_ng/extension.xml - scripts/ext_skel_ng/extension_parser.php - scripts/ext_skel_ng/php_function.php: - code for the special functions MINIT, MSHUTDOWN, RINIT, RSHUTDOWN, MINFO - and for private internal C helper functions may now be embedded into - the XML specification - -2003-02-19 Wez Furlong - - * NEWS: - typo.. - - * NEWS: - News about the ZE stream thing - -2003-02-19 Hartmut Holzgraefe - - * scripts/ext_skel_ng/extension.xml: - test specifications for MINIT and friends - - * scripts/ext_skel_ng/extension.dtd: - inside was supported but missing from the DTD, - added "role" attribute to support "internal" functions like - MINIT and stuff, "private" C functions not to be published as - PHP functions and "public" implemenations of PHP functions - -2003-02-19 Marc Boeren - - * ext/dbx/dbx_pgsql.c: - Fix for bug #22221: pgsql version for dbx_query suppressed a warning that - was trappable by using a user-defined error-handler. A different use of - pgsql_getrow removed the warning and thus the need for suppressing it. - -2003-02-19 Harald Radi - - * (PHP_4_3) - win32/php5ts.dsw: - remove php5ts workspace from PHP_4_3 branch - -2003-02-19 Sascha Schumann - - * sapi/thttpd/README - sapi/thttpd/README - sapi/thttpd/README: - some improvements - -2003-02-19 Hartmut Holzgraefe - - * scripts/ext_skel_ng/ext_skel_ng.php - scripts/ext_skel_ng/extension_parser.php - scripts/ext_skel_ng/php_function.php: - Microsoft Developer Studio project file (.dsp) generation added - - for now both config.m4 and .dsp files are generated for the simples - case only (one .c file, one .h file, no external dependencies) - - * scripts/ext_skel_ng/README - scripts/ext_skel_ng/ext_skel_ng.php - scripts/ext_skel_ng/extension.dtd - scripts/ext_skel_ng/extension.xml - scripts/ext_skel_ng/extension_parser.php - scripts/ext_skel_ng/php_constant.php - scripts/ext_skel_ng/php_element.php - scripts/ext_skel_ng/php_function.php - scripts/ext_skel_ng/xml_stream_callback_parser.php - scripts/ext_skel_ng/xml_stream_parser.php: - next generation ext_skel script - initial checkin - -2003-02-19 Corne' Cornelius - - * ext/informix/ifx.ec: - - Revert latest commit - -2003-02-19 Jani Taskinen - - * main/php_ini.c: - ws/style fixes - -2003-02-19 Corne' Cornelius - - * ext/informix/ifx.ec: - - Added Input Descriptor Binding to be used by blobs. This fixed a bug - where ESQL/C would cause a Segmentation fault if the first blob in a - result is NULL or '' as soon as it gets a result with blob != NULL - - Fixed leaks where blobs resources weren't always freed - -2003-02-19 Jani Taskinen - - * (PHP_4_3) - main/php_ini.c - main/php_scandir.c - main/php_scandir.h: - MFH: prevent conflicts with other libraries (e.g. libc-client) - - * ext/standard/dir.c: - scandir -> php_scandir, alphasort -> php_alphasort - - * main/php_ini.c - main/php_scandir.c - main/php_scandir.h: - Fix the possible conflicts with other libs (like libc-client) - - * main/SAPI.h - main/alloca.c - main/config.nw.h - main/fopen_wrappers.c - main/fopen_wrappers.h - main/internal_functions.c.in - main/internal_functions_nw.c - main/internal_functions_registry.h - main/internal_functions_win32.c - main/logos.h - main/mergesort.c - main/network.c - main/php3_compat.h - main/php_compat.h - main/php_content_types.h - main/php_globals.h - main/php_ini.h - main/php_logos.c - main/php_logos.h - main/php_main.h - main/php_memory_streams.h - main/php_network.h - main/php_open_temporary_file.h - main/php_reentrancy.h - main/php_regex.h - main/php_syslog.h - main/php_variables.c - main/reentrancy.c - main/rfc1867.c - main/rfc1867.h - main/safe_mode.c - main/safe_mode.h - main/snprintf.c - main/snprintf.h - main/spprintf.c - main/spprintf.h - main/strlcat.c - main/strlcpy.c - main/win95nt.h - main/streams/cast.c - main/streams/filter.c - main/streams/memory.c - main/streams/php_stream_context.h - main/streams/php_stream_filter_api.h - main/streams/php_stream_plain_wrapper.h - main/streams/php_stream_userspace.h - main/streams/php_streams_int.h - main/streams/plain_wrapper.c - main/streams/streams.c - main/streams/userspace.c: - ws fixes + missing Id tags, headers added - -2003-02-19 Corne' Cornelius - - * ext/informix/config.m4: - Updated IFX_VERSION entry to work with new Version output of ESQL/C - -2003-02-19 Jani Taskinen - - * NEWS: - cleanup, documentation belongs elsewhere - -2003-02-19 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/standard/http_fopen_wrapper.c: - Fixed bug #22283 (possible crash when opening relative URLs). - -2003-02-19 Moriyoshi Koizumi - - * ext/standard/filters.c: - Added string.strip_tags filter. - -2003-02-18 Moriyoshi Koizumi - - * ext/standard/filters.c: - Fixed memory leaks on conversion failure. - - * ext/standard/filters.c: - Revived convert filter codes - -2003-02-18 Jon Parise - - * ext/rpc/skeleton/skeleton.c: - Remove a stray COM reference. - -2003-02-18 Marcus Boerger - - * ext/dba/libflatfile/flatfile.c: - - wrong use of sizeof(char) - - use define for block size - - a bit faster - - * ext/dba/libflatfile/flatfile.c: - coding style - - * ext/dba/libflatfile/flatfile.h: - avoiding problems - -2003-02-18 Moriyoshi Koizumi - - * NEWS - NEWS - NEWS: - BFN - -2003-02-18 Derick Rethans - - * ext/standard/md5.c - ext/standard/sha1.c - ext/standard/tests/strings/md5.phpt - ext/standard/tests/strings/md5raw.phpt - ext/standard/tests/strings/sha1.phpt - ext/standard/tests/strings/sha1raw.phpt: - - Added new parameter to sha1() and md5() which return the digest as - binary data. (Original patch by Michael Bretterklieber - ) - - Added test cases for sha1() and md5() based on the testvectors in RFC - 1321 - and RFC 3174. - -2003-02-18 Moriyoshi Koizumi - - * ext/mbstring/mbstring.c: - Added description for the hand-made finite state machine. - -2003-02-18 Derick Rethans - - * run-tests.php: - - Add check for proc_open() being available - -2003-02-18 Sascha Schumann - - * ext/session/php_session.h - ext/session/session.c: - Refactor new-session-id code - - * ext/session/php_session.h - ext/session/session.c: - Remember whether to send a cookie, so that we send out the correct - session id. Also improve check for active session - -2003-02-18 Wez Furlong - - * ext/rpc/com/com.c - main/streams/streams.c: - Fix incorrect TSRMLS_CC usage. - Fix com_create_guid() - -2003-02-18 Sascha Schumann - - * ext/session/php_session.h - ext/session/session.c: - add session_regenerate_id() - -2003-02-18 Moriyoshi Koizumi - - * ext/mbstring/mbstring.c: - Fixed mb_send_mail() so that Content-Type and Content-Transfer-Encoding - headers are overridable by additional header parameters. - This patch fixes bug #21985 and bug #22064. - - * ext/standard/string.c: - Fixed bug #21708 (ucfirst() trouble again) - - - * ext/standard/file.c: - Fixed bug #21689 (fgetcsv suppresses some characters before a separator) - The fix is suggested by Masahiro Nakayama - - -2003-02-18 Zeev Suraski - - * win32/pwd.c - win32/time.h: - Commit missing stuff - -2003-02-18 Wez Furlong - - * ext/rpc/com/com.c - ext/rpc/com/variant.h: - Implement com_create_guid(). - Add a special case for RETVAL_VARIANT when a variant is of type - VT_DISPATCH but has a NULL dispatch pointer. - This kind of variant is returned by the WindowsInstaller automation - interface. - - * configure.in - ext/standard/basic_functions.c - main/main.c - main/php_ini.c: - Implement simple stream support in the ZE scanners. - -2003-02-18 Georg Richter - - * ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_fe.c - ext/mysqli/php_mysqli.h: - added new function mysqli_stmt_store_result - - * ext/mysqli/tests/057.phpt: - test for mysqli_stmt_store_result - -2003-02-18 Wez Furlong - - * ext/rpc/com/com.c: - Implement com_indexed_prop_set() which allows setting of array-like indexed - properties on COM objects. - It is expected that this function will be transient, waiting for - engine-level and then rpc-level support to be implemented so that this can - be integrated more completely. - I'm committing this now so that others can help develop the msi installer - scripts that require this feature. - -2003-02-18 Sara Golemon - - * ext/standard/php_fopen_wrapper.c: - Introduce //filter target to php: wrapper to allow inline application of - filters during fopen() style opperations - -2003-02-18 Jani Taskinen - - * NEWS: - style polizei - - * ext/pcntl/config.m4: - getpriority() and setpriority() are in libc.. - - * ext/standard/config.m4: - nice() is part of libc, use AC_CHECK_FUNCS instead - -2003-02-18 Ilia Alshanetsky - - * ext/mysqli/mysqli_api.c: - Fixed compiler warning. - -2003-02-18 Sara Golemon - - * ext/standard/file.c - main/streams/php_stream_filter_api.h: - Fix stream_filter_(ap|pre)pend to allow attaching on the read and/or write - chains. Automagically decide what to do if noone tells us. - -2003-02-18 Ilia Alshanetsky - - * NEWS: - New function news. - - * ext/pcntl/config.m4 - ext/pcntl/pcntl.c - ext/pcntl/php_pcntl.h: - Added pcntl_setpriority & pcntl_getpriority(). These functions can be used - to fetch and alter the priority of a process. - -2003-02-18 Wez Furlong - - * main/streams/filter.c - main/streams/streams.c: - TSRMLS! - - * ext/standard/tests/filters/basic.phpt: - Add basic test of read filters and read filter chain. - -2003-02-18 Ilia Alshanetsky - - * ext/standard/basic_functions.c - ext/standard/exec.c - ext/standard/exec.h: - By popular demand nice() is renamed to proc_nice(). - A better error message for proc_nice() failure. - -2003-02-18 Wez Furlong - - * ext/standard/file.c - ext/standard/filters.c - ext/standard/user_filters.c - main/php_streams.h - main/streams/cast.c - main/streams/context.h - main/streams/filter.c - main/streams/filter_api.h - main/streams/php_stream_context.h - main/streams/php_stream_filter_api.h - main/streams/php_stream_plain_wrapper.h - main/streams/php_stream_userspace.h - main/streams/plain_wrapper.h - main/streams/streams.c - main/streams/userspace.h: - Implement new filter API, stage 1. - This breaks user-space filters (for the time being), and those - weird convert.* filters in ext/standard/filters.c - - The filters stack has been separated into one chain for read and one chain - for write. - - The user-space stream_filter_append() type functions currently only - operate - on the read chain. They need extending to work with the write chain too. - -2003-02-18 Ilia Alshanetsky - - * ext/standard/basic_functions.c - ext/standard/config.m4 - ext/standard/exec.c - ext/standard/exec.h: - Added nice() function, which allows changing of priority for the current - process. - -2003-02-18 Georg Richter - - * ext/mysqli/tests/056.phpt: - new test (class which extends mysqli. currently this test fails :( ) - - * ext/mysqli/mysqli.c: - removed duplicate code - - * ext/mysqli/mysqli.c - ext/mysqli/mysqli_api.c: - fixed some leaks when mysql_close will be called before all stmts are - freed. - -2003-02-17 Georg Richter - - * ext/mysqli/tests/050.phpt - ext/mysqli/tests/051.phpt - ext/mysqli/tests/052.phpt - ext/mysqli/tests/053.phpt - ext/mysqli/tests/054.phpt - ext/mysqli/tests/055.phpt: - additional tests for non freed objects - -2003-02-17 Jani Taskinen - - * ext/snmp/config.m4: - MFB: Sanity check. - - * (PHP_4_3) - ext/snmp/config.m4: - Sanity check to prevent errors in other extensions tests. - - * NEWS: - Update - -2003-02-17 Georg Richter - - * ext/mysqli/tests/049.phpt: - test for mysql_fetch_row (oo-style) - -2003-02-17 Zeev Suraski - - * ext/rpc/com/com.c - ext/rpc/com/conversion.c - ext/rpc/com/dispatch.c - ext/rpc/com/variant.c - ext/snmp/winsnmp.c - ext/standard/file.c - ext/standard/flock_compat.c - ext/standard/ftp_fopen_wrapper.c - ext/standard/http_fopen_wrapper.c - ext/standard/pack.c - ext/standard/rand.c - ext/w32api/w32api.c - ext/zlib/zlib.c - main/fopen_wrappers.c - main/main.c - main/network.c - main/php.h - main/php_open_temporary_file.c - sapi/apache/php_apache_http.h - sapi/cgi/cgi_main.c - sapi/isapi/php4isapi.c: - Win32 build improvements - -2003-02-17 Wez Furlong - - * sapi/isapi/php4isapi.c: - Fix build under win32 - -2003-02-17 Georg Richter - - * ext/mysqli/mysqli_fe.c: - added close method/alias for result object (for compatibility with - statement and - link objects) - - * ext/mysqli/tests/048.phpt: - test for OO-Implementation (bind_result) - -2003-02-17 Shane Caraveo - - * ext/standard/proc_open.c: - you know it's time to get away from the keyboard when you do this. - - fix my last fix - -2003-02-17 Derick Rethans - - * ext/standard/proc_open.c: - - Style polizei - -2003-02-17 Jani Taskinen - - * ext/standard/basic_functions.c - ext/standard/datetime.c - ext/standard/datetime.h - ext/standard/php_standard.h - ext/standard/php_sunfuncs.h - ext/standard/sunfuncs.c - ext/standard/sunfuncs.h - win32/php4dllts.dsp: - - Cleaned this mess a bit: - . Centralized the functions sunrise/sunset to php_sunrise_sunset - to lessen duplicate code. - . Made wrapper function php_do_date_sunrise_sunset() to lessen - duplicate code. - . Coding style fixes. - . renamed sunfuncs.h -> php_sunfuncs.h - - * ext/standard/tests/time/idate.phpt: - - These results were obviously got with TZ=GMT - - * ext/standard/tests/general_functions/sunfuncts.phpt: - Assuming the results were created in system with Asia/Jerusalem as TZ - -2003-02-17 Shane Caraveo - - * ext/standard/proc_open.c: - fix it the right way - -2003-02-17 Jani Taskinen - - * ext/standard/tests/general_functions/sunfuncts.phpt: - override precision ini setting - -2003-02-17 Shane Caraveo - - * sapi/cgi/cgi_main.c: - prevent possible crash if used in combo with mod_gzip - fix command line - - * ext/standard/proc_open.c: - If you pass NULL, you do not get a NULL value, make sure it is. - -2003-02-17 Jani Taskinen - - * ext/bcmath/libbcmath/src/bcmath.h - ext/bcmath/libbcmath/src/config.h - ext/ovrimos/ovrimos.c - ext/standard/flock_compat.c - win32/glob.c - win32/time.h - win32/winutil.c: - - Let's be consistent with these.. - -2003-02-17 Wez Furlong - - * main/php_streams.h - main/streams/context.h - main/streams/filter_api.h - main/streams/plain_wrapper.h - main/streams/userspace.h: - Move some of the streams header into supplementary files - - -2003-02-17 Shane Caraveo - - * run-tests2.php: - bring up to date with change in run-tests - -2003-02-17 Jani Taskinen - - * (PHP_4_3) - configure.in - main/php_version.h: - Bump up the version. - -2003-02-17 Wez Furlong - - * ext/standard/sunfuncs.c: - Fix compile warning - -2003-02-16 Wez Furlong - - * win32/installer/setini.php: - Some additional sanity. - - * win32/php4dllts.dsp: - Add the sunfuncs to the .dsp file for Moshe. - - * win32/php4dllts.dsp: - Update win32 project for streams juggling. - - * ext/standard/file.c: - Remove unused vars - -2003-02-16 Moshe Doron - - * ext/standard/basic_functions.c - ext/standard/config.m4 - ext/standard/datetime.c - ext/standard/datetime.h - ext/standard/php_standard.h - ext/standard/sunfuncs.c - ext/standard/sunfuncs.h - ext/standard/tests/general_functions/sunfuncts.phpt - ext/standard/tests/time/idate.phpt: - - -2003-02-16 Wez Furlong - - * configure.in - main/memory_streams.c - main/streams.c - main/user_streams.c - main/streams/.cvsignore - main/streams/cast.c - main/streams/filter.c - main/streams/memory.c - main/streams/php_streams_int.h - main/streams/plain_wrapper.c - main/streams/streams.c - main/streams/userspace.c: - Move streams files around a bit, to ease maintenance. - I will update the win32 .dsp in a moment. - -2003-02-16 Georg Richter - - * ext/mysqli/tests/042.phpt - ext/mysqli/tests/047.phpt: - fixed output - -2003-02-16 Ilia Alshanetsky - - * ext/mysqli/mysqli_api.c: - Reverted lld -> lld patch and added explanation as to why it should not be - done. - - * ext/mysqli/mysqli_api.c - ext/mysqli/php_mysqli.h: - Moved longlong conversion to a macro. - - * ext/mysqli/tests/014.phpt: - better skip condition. - -2003-02-16 Wez Furlong - - * ext/standard/tests/file/bug21131.phpt: - Remove bogus test. - Append mode always causes written data to go to the end of the file, - regardless of the current seek position. - - * ext/standard/proc_open.c - ext/standard/proc_open.h: - Integrate Shanes patch that allows specifying the cwd and environment - for the child process created by proc_open(). - -2003-02-16 Jani Taskinen - - * (PHP_4_3_1) - NEWS: - BFN - -2003-02-16 Georg Richter - - * ext/mysqli/tests/047.phpt: - test for mysqli_prepare_result - -2003-02-16 Wez Furlong - - * ext/bcmath/libbcmath/src/config.h: - Fix bcmath build under win32. - -2003-02-16 Georg Richter - - * ext/mysqli/tests/046.phpt: - test for mysqli_stmt_affected_rows (delete command) - - * ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_fe.c - ext/mysqli/mysqli_nonapi.c - ext/mysqli/php_mysqli.h: - added new function mysqli_stmt_affected_rows - added bigint support for mysqli_affected_rows - fixed memleak in mysqli_prepare (stmt->is_null) - fixed return type for mysqli_connect - -2003-02-16 Wez Furlong - - * run-tests.php - ext/curl/interface.c - ext/curl/streams.c - ext/fbsql/php_fbsql.c - ext/ftp/ftp.c - ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c - ext/imap/php_imap.c - ext/ldap/ldap.c - ext/mcal/php_mcal.c - ext/mysql/php_mysql.c - ext/odbc/php_odbc.c - ext/rpc/com/com_wrapper.c - ext/snmp/snmp.c - ext/standard/dns.c - ext/standard/file.c - ext/standard/fsock.c - ext/standard/ftp_fopen_wrapper.c - ext/standard/http_fopen_wrapper.c - ext/standard/pack.c - ext/zlib/zlib.c - main/fopen_wrappers.c - main/mergesort.c - main/network.c - main/php.h - main/php_open_temporary_file.c - main/streams.c - win32/php4dllts.dsp - win32/sendmail.c - win32/time.h: - A add much more useful select(2) implementation than is provided by - windows sockets. The winsock implementation will only work with sockets; - our implementation works with sockets and file descriptors. - By association, stream_select() will now operate correctly with files, - pipes and sockets. - - This change required linking against the winsock2 library. In terms of - compatibility, only older versions of windows 95 do not have winsock2 - installed by default. It is available as a redistributable file, and is - most likely installed by any OS patches (eg: Internet Explorer) applied by - the user. - - Also, add a win32 compatible pipe test when opening a stream from a pipe. - This test will only work on NT, win2k and XP platforms. Without this - test, interleaved fread() and select() calls would cause the read buffer - to be clobbered. I will be working on a fix for this issue for win9x. - -2003-02-16 Anil Madhavapeddy - - * pear/PEAR/Command/Package.php: - fix error msg typo - -2003-02-16 Marcus Boerger - - * sapi/cgi/cgi_main.c - sapi/cgi/getopt.c - sapi/cgi/php_getopt.h - sapi/cli/getopt.c - sapi/cli/php.1.in - sapi/cli/php_cli.c - sapi/cli/php_getopt.h: - - Allow long option names - - Update CLI's manpage - - - -2003-02-15 Jani Taskinen - - * (PHP_4_3_1) - sapi/cgi/cgi_main.c: - revert this - - * (PHP_4_3_1) - main/fopen_wrappers.c: - Revert this. - - * (PHP_4_3) - sapi/apache2handler/.cvsignore - sapi/apache2handler/README: - - Remove all of it. - -2003-02-15 Ian Holsman - - * (PHP_4_3) - sapi/apache2handler/CREDITS - sapi/apache2handler/README - sapi/apache2handler/apache_config.c - sapi/apache2handler/config.m4 - sapi/apache2handler/php.sym - sapi/apache2handler/php4apache2.dsp - sapi/apache2handler/php_apache.h - sapi/apache2handler/php_functions.c - sapi/apache2handler/sapi_apache2.c: - - After short discussion, the #php.bugs mob decided that we don't want - this in PHP_4_3 branch. At least as long as it doesn't work as well - (or preferrably better :) than the apache2filter SAPI does. - - So please remove it from the branch for now.. - - --Jani - -2003-02-15 Ilia Alshanetsky - - * NEWS: - New feature news. - -2003-02-15 Jani Taskinen - - * (PHP_4_3_1) - configure.in - sapi/cgi/cgi_main.c: - - correct version plus the fix. - -2003-02-15 Edin Kadribasic - - * (PHP_4_3_1) - main/php_version.h: - New version number. - -2003-02-15 Jani Taskinen - - * (PHP_4_3) - NEWS: - BFN - -2003-02-15 Stig Bakken - - * (PHP_4_3) - pear/PEAR.php - pear/System.php - pear/package-PEAR.xml - pear/package.dtd - pear/OS/Guess.php - pear/PEAR/Autoloader.php - pear/PEAR/Builder.php - pear/PEAR/Command.php - pear/PEAR/Common.php - pear/PEAR/Config.php - pear/PEAR/Dependency.php - pear/PEAR/Installer.php - pear/PEAR/Packager.php - pear/PEAR/Registry.php - pear/PEAR/Remote.php - pear/PEAR/Command/Auth.php - pear/PEAR/Command/Build.php - pear/PEAR/Command/Common.php - pear/PEAR/Command/Config.php - pear/PEAR/Command/Install.php - pear/PEAR/Command/Package.php - pear/PEAR/Command/Registry.php - pear/PEAR/Command/Remote.php - pear/PEAR/Frontend/CLI.php - pear/scripts/pear.bat - pear/scripts/pear.in: - - import PEAR 1.0.1 - -2003-02-15 Jani Taskinen - - * main/main.c: - - Fix unsetting of open_basedir, safe_mode_exec_dir and user_dir with - "php_admin_value none" - - Fixes bug #22220 - -2003-02-15 Ilia Alshanetsky - - * ext/mysqli/config.m4: - Proper lib detection. - -2003-02-15 Moriyoshi Koizumi - - * (PHP_4_3) - NEWS - NEWS: - B.F.N. - - * main/streams.c: - Fixed bug #22234 - -2003-02-15 Wez Furlong - - * run-tests.php: - If a test does not have any data after 60 seconds of waiting, assume that - it died a horrible death and kill it. - This is useful on windows when a message box is popped-up during an - automated - test-run. - - * ext/standard/proc_open.c: - Add optional signal parameter to proc_terminate. - - * ext/standard/basic_functions.c - ext/standard/exec.h - ext/standard/proc_open.c: - Add proc_terminate() function to forcibly kill off a process created - with proc_open(). - -2003-02-15 Ilia Alshanetsky - - * ext/mysqli/tests/014.phpt: - Fixed skip condition. - -2003-02-15 Georg Richter - - * ext/mysqli/tests/014.phpt - ext/mysqli/tests/015.phpt: - added skipif section (innodb-support) - -2003-02-15 Moriyoshi Koizumi - - * (PHP_4_3) - ext/standard/formatted_print.c - ext/standard/tests/strings/bug22227.phpt: - MFH(r1.65): Fixed bug #22227 - MFH: Added test case for bug #22227 - - * ext/standard/formatted_print.c - ext/standard/tests/strings/bug22227.phpt: - Fixed bug #22227 - Added test case for bug #22227 - -2003-02-15 Marcus Boerger - - * sapi/cli/php_cli.c: - fix parameter string (-R & -H) - -2003-02-15 Wez Furlong - - * (PHP_4_3) - NEWS: - bug fixed. - -2003-02-15 Moriyoshi Koizumi - - * tests/lang/bug22231.phpt: - - Added test case for bug #22231 - -2003-02-15 Wez Furlong - - * (PHP_4_3) - main/network.c: - MFH: Fix for Bug #21809 (select() never times out during socket shutdown) - -2003-02-15 Edin Kadribasic - - * (PHP_4_3) - sapi/cgi/cgi_main.c: - Option -b needs an argument. This fixes #22229. - -2003-02-15 Sebastian Bergmann - - * ext/mysqli/tests/.cvsignore: - Add .cvsignore for tests. - -2003-02-15 Ian Holsman - - * (PHP_4_3) - sapi/apache2handler/.cvsignore - sapi/apache2handler/CREDITS - sapi/apache2handler/README - sapi/apache2handler/apache_config.c - sapi/apache2handler/config.m4 - sapi/apache2handler/php.sym - sapi/apache2handler/php4apache2.dsp - sapi/apache2handler/php_apache.h - sapi/apache2handler/php_functions.c - sapi/apache2handler/sapi_apache2.c: - alternate apache2 SAPI. - -2003-02-14 Ilia Alshanetsky - - * ext/mysqli/php_mysqli.h: - Allow mysqli to be built when imap (c-client) is used. - - * ext/ftp/ftp.c - ext/ftp/php_ftp.c - ext/mysqli/mysqli_api.c: - CS fixes. - - * ext/mysqli/mysqli.c - ext/mysqli/mysqli_api.c: - Fixed compile warnings. - -2003-02-14 Georg Richter - - * ext/mysqli/tests/045.phpt: - test for bind_result with show - -2003-02-14 Moriyoshi Koizumi - - * (PHP_4_3) - NEWS: - Slight fix for consistency - - * (PHP_4_3) - NEWS: - BFN - -2003-02-14 Marcus Boerger - - * ext/standard/image.c: - a little bit slower but somewhat tricky and more flexible and it does not - allocate static buffers anymore - -2003-02-14 Moriyoshi Koizumi - - * (PHP_4_3) - ext/standard/string.c: - Fixed wrong commit: s/&/*/ - - * (PHP_4_3) - ext/standard/string.c: - MFH(r1.358): Fixed a str_replace() bug similar to bug #22224 - - * ext/standard/string.c: - Fixed a str_replace() bug similar to bug #22224 - - * (PHP_4_3) - ext/standard/string.c - ext/standard/tests/strings/bug22224.phpt: - MFH(r1.357): Fixed bug #22224 - MFH: Added test case for the bug - - * ext/standard/string.c - ext/standard/tests/strings/bug22224.phpt: - Fixed bug #22224 (implode changes object references in array) - Added test case for the bug - -2003-02-14 Ilia Alshanetsky - - * ext/mysqli/mysqli_nonapi.c: - Fixed a typo. - -2003-02-14 Georg Richter - - * ext/mysqli/mysqli_nonapi.c: - fixed compiler warning - - * ext/mysqli/mysqli_api.c: - fixed a bug in mysqli_fetch - removed c++ comment (thx to Jani :) - fixed compiler warning - -2003-02-14 Ilia Alshanetsky - - * ext/mysqli/mysqli.c - ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_nonapi.c - ext/mysqli/php_mysqli.h: - Missing portion of the previous patch. - - * ext/mysqli/php_mysqli.h: - Buncha Fixes. - * Fixed a number of memory leaks. - * Fixed some php_error_docref() calls that tried to print non-existent - arguments. - * Fixed some signed/unsigned problems. - * Fixed the MYSQLI_FETCH_RESOURCE macro so that compilers do not complain - about un-initialized variables. - * CS fixes. - -2003-02-14 Georg Richter - - * ext/mysqli/mysqli_api.c: - bind_result fix - - * ext/mysqli/mysqli.c: - fixed a bug in prepare/bind - -2003-02-14 Jani Taskinen - - * sapi/cgi/cgi_main.c: - MFB - - * (PHP_4_3) - sapi/cgi/cgi_main.c: - Added missing Id tag - -2003-02-14 Thies C. Arntzen - - * .gdbinit: - add really nice dump_bt function for debugging in gdb - -2003-02-14 Jani Taskinen - - * (PHP_4_3) - configure.in - ext/standard/config.m4: - - MFH, do not add libcrypt if crypt() is provided by libc. - - * configure.in - ext/standard/config.m4: - - Don't add libcrypt if the crypt() function is provided already. - (by libc, like in HP-UX) - -2003-02-13 Sara Golemon - - * ext/ftp/ftp.c: - MFB(r-1.68.2.5) Bug 22052 - - * (PHP_4_3) - ext/ftp/ftp.c: - Buf #22052 More casual efree()ing causing segfaults - -2003-02-13 Marcus Boerger - - * ext/domxml/php_domxml.c: - pass tsrmls instead of fetching it always - -2003-02-13 Wez Furlong - - * main/streams.c: - MFB: Fix for bug #22199 - - * (PHP_4_3) - main/streams.c: - Fix for Bug #22199 (fputs() + fgets() destroys readbuffer for non-seekable - streams). - -2003-02-13 Jani Taskinen - - * (PHP_4_3) - NEWS: - typofix - -2003-02-13 Sara Golemon - - * NEWS - ext/ftp/ftp.c: - Bug #22059. ftp_chdir() causes segfault. efree(ftp->pwd) was being called - without knowing for certain that ftp->pwd - actually pointed anywhere. - -2003-02-13 Marcus Boerger - - * sapi/cgi/cgi_main.c: - fix non FCGI build - -2003-02-13 Ilia Alshanetsky - - * ext/standard/tests/strings/bug22187.phpt: - - Added test case for bug #22187. - - * main/snprintf.c: - Modified fix for bug #22187 so that it does not affect handling of numbers - represented in scientific notation. - -2003-02-13 Jani Taskinen - - * ext/standard/tests/strings/crypt.phpt: - - Added test for those different crypt() methods. Hopefully I got the - results right. - -2003-02-13 Georg Richter - - * ext/mysqli/tests/connect.inc: - include file for test - -2003-02-13 Shane Caraveo - - * sapi/cgi/cgi_main.c: - There is *absolutely no* definitive way to know if argv0 is the - actual php script, or if it is the beginning of a query string. - Additionaly, passing parameters on the command line is - not part of CGI spec, and is not required by either - Apache or IIS. So I have removed that code altogether, - and done some further cleanup. Also fix pre4.3 behaviour if - fix_pathinfo=0. - I've tested with IIS and Apache 1.3.27 on w2k and RH 7.3. - -2003-02-13 Ilia Alshanetsky - - * ext/rpc/com/variant.c: - Fixed warnings. - -2003-02-13 Wez Furlong - - * main/php_open_temporary_file.c: - Another IS_SLASH fix. - -2003-02-13 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/standard/formatted_print.c - ext/standard/tests/strings/bug22207.phpt: - Fixed bug #22207 (e notation in *printf would be missing a 0 when there is - no exponent). - Added a test case for the bug. - -2003-02-13 Wez Furlong - - * main/streams.c: - A probable cure for many getcwd/relative include related problems for - win32. - -2003-02-13 Ilia Alshanetsky - - * main/spprintf.c: - PAD() macro didn't increase the buffer size resulting in loss of the - padding. - -2003-02-13 Edin Kadribasic - - * ext/mysqli/mysqli_api.c: - Use my_ulonglong instead of unsigned long long to make msvc++ happy. - -2003-02-13 Jani Taskinen - - * NEWS: - change history - - * (PHP_4_3) - NEWS: - altering history.. - -2003-02-13 Harald Radi - - * (PHP_4_3) - ext/standard/info.c: - add missing include - -2003-02-13 Edin Kadribasic - - * ext/mysqli/.cvsignore: - Adding missing .cvsignore - -2003-02-13 Ilia Alshanetsky - - * main/streams.c: - Fixed a typo. - - * main/streams.c: - Simplified the mode validation code & added support for read+write mode to - 'x' mode. - - * ext/rpc/com/variant.c: - Added missing header needed for rpc_error(). - -2003-02-13 Wez Furlong - - * main/streams.c: - Clarify error message. - -2003-02-13 Edin Kadribasic - - * ext/mysqli/mysqli.dsp: - Initial windows project file - -2003-02-13 Ilia Alshanetsky - - * ext/standard/ftp_fopen_wrapper.c - ext/standard/http_fopen_wrapper.c - main/streams.c: - Added 'x' mode for fopen() used on local files. This mode will create a new - file only if a file does not already exist (O_CREAT|O_EXCL). - -2003-02-13 Wez Furlong - - * main/network.c: - Potential fixes for #21809 and #22099. - - * ext/standard/php_fopen_wrapper.c: - Use FILE*-less implementation for php://(stdin|stdout|stderr) - - * (PHP_4_3) - ext/standard/http_fopen_wrapper.c: - partial MFH: avoid problems with auto_detect_line_endings. - - * main/php_streams.h - main/streams.c: - Moving away from ANSI stdio for plain files. - - * ext/standard/http_fopen_wrapper.c: - Avoid problems with chunk_size and auto_detect_line_endings. - - * (PHP_4_3) - ext/standard/config.m4: - MFH: cli should be allowed to use chroot() function. - - * ext/standard/config.m4: - cli should be allowed to have the chroot() function. - - * main/streams.c: - Whitespace-fix these goto labels. - -2003-02-13 Uwe Steinmann - - * (PHP_4_3) - NEWS - ext/hwapi/hwapi.cpp: - - Some functions with objects as its parameters didn't recognize them - as such - -2003-02-13 Wez Furlong - - * win32/installer/gen-nsis.php: - Update installer so that no extensions are enabled by default. - -2003-02-13 Georg Richter - - * ext/mysqli/tests/001.phpt: - removed warnings (unused vars) - -2003-02-13 Uwe Steinmann - - * ext/hwapi/hwapi.cpp: - - added more missing strcmp() - -2003-02-13 Jani Taskinen - - * sapi/apache/config.m4: - Added HAVE_APACHE define. - - * (PHP_4_3) - ext/standard/image.c - ext/standard/php_image.h - ext/standard/tests/image/bug13213.phpt - ext/standard/tests/image/getimagesize.phpt - ext/standard/tests/image/image_type_to_mime_type.phpt - ext/standard/tests/image/test1pix.jp2: - - MFH: improved jpeg 2000 and wbmp support for getimagesize() - - * NEWS: - Merged these to 4.3.x branch - - * ext/standard/image.c: - ws fix - - * (PHP_4_3) - NEWS: - clean.. - -2003-02-13 Sascha Schumann - - * sapi/thttpd/thttpd_patch: - include limits.h for portability - - * sapi/thttpd/config.m4: - portability work - -2003-02-13 Wez Furlong - - * (PHP_4_3) - NEWS: - Fixed that one... - -2003-02-13 Georg Richter - - * ext/mysqli/tests/042.phpt - ext/mysqli/tests/043.phpt - ext/mysqli/tests/044.phpt: - new tests - -2003-02-13 Wez Furlong - - * main/streams.c: - Fix for Bug #21815 (fpassthru ignored buffered data but then complained - anyway) - -2003-02-13 Sara Golemon - - * (PHP_4_3) - ext/standard/http_fopen_wrapper.c: - Reverting earlier patch to reintroduce buggy behavior (yes, you heard that - right) of filtered http streams in favor of - performance. This has little consequence given limited filter support in - 4.3 branch. Filters will be redesigned in - 5.0 release. For more information see Wez, Ilia, or myself. - -2003-02-13 Georg Richter - - * ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_fe.c - ext/mysqli/php_mysqli.h: - added new function int mysql_get_server_version - this function is available since libmysql change set 1.1450 (2002-02-13) - -2003-02-12 Georg Richter - - * ext/mysqli/mysqli_fe.c: - changed function entries for statements - -2003-02-12 Ilia Alshanetsky - - * (PHP_4_3) - NEWS - NEWS: - Bug fixing news. - - * ext/fbsql/php_fbsql.c: - Fixed bug #22191 (frontbase build was broken for people using older - versions). - - * main/snprintf.c: - Fixed bug #22187 (spprintf function did not handle floats correctly). - -2003-02-12 Sascha Schumann - - * main/spprintf.c: - - trims +100 lines of code from spprintf.c - - introduces an overflow detection in STR_TO_DEC - - eliminates dead code (e.g. assert(foo); if (foo) {..}) - - removes unused macros from the original code - - simplifies code (e.g. cc was completely dropped) - - improves run-time performance - - The max_len feature is never used in our code base. - Nevertheless, cpu cycles were spent on each string - operation to check the current length against max_len which - is quite inefficient. Thus, I've moved the check to - vspprintf where it is applied only once per call. - -2003-02-12 Mark L. Woodward - - * ext/msession/config.m4: - Fix for GCC 3 - -2003-02-12 Jani Taskinen - - * sapi/apache/config.m4: - Fixed the "member fd in BUFF" test for --with-apxs builds - -2003-02-12 Derick Rethans - - * ext/mysqli/config.m4: - - Let's add the config.m4 file too :-) - -2003-02-12 Jani Taskinen - - * sapi/cli/.cvsignore: - added missing entry - - * (PHP_4_3) - NEWS: - add blame tag - -2003-02-12 Ilia Alshanetsky - - * ext/standard/url_scanner_ex.c - ext/standard/url_scanner_ex.re: - Fixed bug #22048 (incorrect insertion of session id when tabs are used to - separate tag elements). - -2003-02-12 Uwe Steinmann - - * ext/hwapi/hwapi.cpp: - - Fixed compile errors and some oddities like missing strcmp - -2003-02-12 Georg Richter - - * ext/mysqli/tests/036.phpt - ext/mysqli/tests/037.phpt - ext/mysqli/tests/038.phpt - ext/mysqli/tests/039.phpt - ext/mysqli/tests/040.phpt - ext/mysqli/tests/041.phpt: - added new tests - - * ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_fe.c - ext/mysqli/php_mysqli.h: - removed function mysql_num_warnings (libmysql change). - -2003-02-12 Jani Taskinen - - * sapi/cli/Makefile.frag - sapi/cli/config.m4 - sapi/cli/php.1 - sapi/cli/php.1.in: - "Generate" the man page so that it gets correct version always. - - * NEWS: - Man page is added in 4.3.1, moved this entry to branch - - * sapi/cli/Makefile.frag - sapi/cli/config.m4: - - Added the man page installation - - * (PHP_4_3) - Makefile.global: - MFH: Use $(INSTALL) for installing shared extensions. - - * ext/yaz/config.m4: - Fix obvious errors.. - - * NEWS: - news news news.. - -2003-02-12 Georg Richter - - * ext/mysqli/tests/001.phpt - ext/mysqli/tests/002.phpt - ext/mysqli/tests/003.phpt - ext/mysqli/tests/004.phpt - ext/mysqli/tests/005.phpt - ext/mysqli/tests/006.phpt - ext/mysqli/tests/007.phpt - ext/mysqli/tests/008.phpt - ext/mysqli/tests/009.phpt - ext/mysqli/tests/010.phpt - ext/mysqli/tests/011.phpt - ext/mysqli/tests/012.phpt - ext/mysqli/tests/013.phpt - ext/mysqli/tests/014.phpt - ext/mysqli/tests/015.phpt - ext/mysqli/tests/016.phpt - ext/mysqli/tests/017.phpt - ext/mysqli/tests/018.phpt - ext/mysqli/tests/019.phpt - ext/mysqli/tests/020.phpt - ext/mysqli/tests/021.phpt - ext/mysqli/tests/022.phpt - ext/mysqli/tests/023.phpt - ext/mysqli/tests/024.phpt - ext/mysqli/tests/025.phpt - ext/mysqli/tests/026.phpt - ext/mysqli/tests/027.phpt - ext/mysqli/tests/028.phpt - ext/mysqli/tests/029.phpt - ext/mysqli/tests/030.phpt - ext/mysqli/tests/031.phpt - ext/mysqli/tests/032.phpt - ext/mysqli/tests/033.phpt - ext/mysqli/tests/034.phpt - ext/mysqli/tests/035.phpt: - adding a few tests - - * ext/mysqli/CREDITS - ext/mysqli/EXPERIMENTAL - ext/mysqli/TODO - ext/mysqli/mysqli.c - ext/mysqli/mysqli_api.c - ext/mysqli/mysqli_fe.c - ext/mysqli/mysqli_nonapi.c - ext/mysqli/php_mysqli.h: - initial upload - -2003-02-11 Sascha Schumann - - * configure.in: - supply mandir to makefile - -2003-02-11 Moriyoshi Koizumi - - * (PHP_4_3) - main/SAPI.c: - MFH: reverted my patch & applying a new patch by Stefan Esser - -2003-02-11 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/imap/php_imap.c: - Fixed bug #22048 (crash in imap_headers when the e-mail contains an - abnormally large number of special characters). - - * NEWS: - New function news. - - * ext/standard/basic_functions.c - ext/standard/php_string.h - ext/standard/string.c: - Added strpbrk(), which is essentially a wrapper around C's strpbrk function - that allows searching through a string for a character list. - -2003-02-11 Stefan Esser - - * main/SAPI.c: - size matters not. - - * main/SAPI.c: - 8 + 20 + 1 + 1 = 30 - - There was no Bufferoverflow on 64bit systems. - - And the "fix" broke the header code on systems with old style snprintf. - -2003-02-11 Jani Taskinen - - * configure.in - build/buildcheck.sh: - - Fixed some weird crashes causd by the new default behaviour - of libtool 1.4.3 - - Require libtool 1.4.3 or newer from now on. - -2003-02-11 Marcus Boerger - - * sapi/cli/php_cli.c: - Make that clear - - * sapi/cli/php.1: - Document -H added by Ilia - - * main/spprintf.c: - speed up - -2003-02-11 Melvyn Sopacua - - * ext/xslt/TODO: - Update time - -2003-02-11 Ian Holsman - - * sapi/apache2handler/.cvsignore - sapi/apache2handler/CREDITS - sapi/apache2handler/README - sapi/apache2handler/apache_config.c - sapi/apache2handler/config.m4 - sapi/apache2handler/php.sym - sapi/apache2handler/php4apache2.dsp - sapi/apache2handler/php_apache.h - sapi/apache2handler/php_functions.c - sapi/apache2handler/sapi_apache2.c: - initial checkin of the apache2 SAPI using a handler instead of filters. - TBD: src highlighting - better post handling - -2003-02-11 Ilia Alshanetsky - - * sapi/cli/php_cli.c: - Added -H option to CLI binary. This option can be used to hide any - arguments - including the script name passed to the CLI binary. - -2003-02-11 Jani Taskinen - - * (PHP_4_3) - NEWS - NEWS: - fugbix news - -2003-02-11 Zeev Suraski - - * ext/rpc/rpc.c: - Fix random crashes - -2003-02-11 Moriyoshi Koizumi - - * ext/mbstring/mbstring.c: - Fixed ZTS build - -2003-02-11 Jani Taskinen - - * ext/readline/config.m4: - - There's no point in allowing using both --with-readline and - --with-libedit - the same time. Prefer --with-readline. - - Use PHP_ADD_LIBRARY when there is no path available. - - * (PHP_4_3) - NEWS: - Moved one entry from HEAD here.. - - * NEWS: - moved entry to branch NEWS - - * (PHP_4_3) - ext/ingres_ii/ii.c: - MFH: - Fixed bug: #21549 (problem with Ingres II persistent connections) - - * ext/ingres_ii/ii.c: - - Fixed bug: #21549 (problem with Ingres II persistent connections) - -2003-02-11 Sascha Schumann - - * sapi/apache/config.m4: - move check to proper place - - * sapi/apache/config.m4 - sapi/apache/mod_php4.c: - Detect whether BUFFs contain a fd element. IBM is hiding the actual - descriptor behind a void *, so we just disable this for IBM servers - -2003-02-11 Frank M. Kromann - - * ext/mssql/php_mssql.c - ext/mssql/php_mssql.c: - Bug #20426. Convert SMALLDATETIME correct - -2003-02-11 Stig Bakken - - * pear/Makefile.frag: - - clean up so Jani is not so confused - -2003-02-11 Sascha Schumann - - * sapi/thttpd/thttpd_patch: - Add "log to stdout" feature - -2003-02-11 Harald Radi - - * ext/rpc/handler.h - ext/rpc/rpc.c - ext/rpc/rpc.h: - clean up source and improve hashing for implicitly - created objects (aka return values) - - * ext/rpc/com/com.c - ext/rpc/com/com.h: - improved reverse lookup of ProgID based on an IDispatch pointer - -2003-02-11 Sascha Schumann - - * php.ini-dist - php.ini-recommended: - update regarding session.save_path - - * ext/session/mod_files.c: - support setting the filemode using session.save_path - - * ext/session/php_session.h - ext/session/session.c: - use appropiate prefixes in the ps_module structure so we don't clash - with syscalls - -2003-02-11 Jani Taskinen - - * NEWS: - fix news entry per for file() parameter.. - - * (PHP_4_3) - NEWS: - dots..I love ya.. - - * NEWS: - Blah - - * NEWS: - krhm.. - -2003-02-10 Wez Furlong - - * ext/rpc/com/com_wrapper.c: - fix rpc_error call - -2003-02-10 Ilia Alshanetsky - - * ext/standard/file.c - ext/standard/file.h: - Merged the flags for the file() function into a single flag. - -2003-02-10 Harald Radi - - * ext/rpc/handler.h - ext/rpc/php_rpc.h - ext/rpc/rpc.c - ext/rpc/rpc.h - ext/rpc/rpc_proxy.c - ext/rpc/com/com.c - ext/rpc/com/com_wrapper.c - ext/rpc/com/conversion.c - ext/rpc/com/variant.c - ext/rpc/com/variant.h: - a bunch of fixes - - * ext/rpc/skeleton/skeleton.c: - s/com/skeleton/ is not always a good idea - -2003-02-10 Wez Furlong - - * ext/rpc/com/com.c: - byref really means that we want the zval... - -2003-02-10 Moriyoshi Koizumi - - * main/SAPI.c: - Fixed possible snprintf problem - - * (PHP_4_3) - main/SAPI.c: - MFH: fixed possible buffer overflow in 64bit systems - - * main/SAPI.c: - Fixed possible buffer overflow in 64bit systems - - * NEWS - NEWS: - dot dot dot.. - - * NEWS: - MFB: Fixed typo - - * (PHP_4_3) - NEWS: - Fixed typo - -2003-02-10 Sara Golemon - - * (PHP_4_3) - NEWS: - Bug 22141 - -2003-02-10 Moriyoshi Koizumi - - * main/SAPI.c: - Jani happification - - * NEWS: - New function - -2003-02-10 Sara Golemon - - * (PHP_4_3) - ext/standard/string.c: - Partial MFH. Deprecated BM algo for str_replace can hang execution. See - Bug#22141 - -2003-02-10 Moriyoshi Koizumi - - * sapi/apache2filter/sapi_apache2.c: - Removed unnecessary code - - * ext/zlib/php_zlib.h - ext/zlib/zlib.c - main/SAPI.c: - Fixed zlib.output_compression so it can work even if zlib extension is - built as shared - -2003-02-10 Melvyn Sopacua - - * Makefile.global: - MFB: disable output buffering - - * (PHP_4_3) - Makefile.global: - Make sure we're not buffering stuff - -2003-02-10 Wez Furlong - - * ext/rpc/com/com.c: - Implement com_describe - -2003-02-10 Jani Taskinen - - * (PHP_4_3) - acinclude.m4 - config.guess - config.sub - configure.in - ltmain.sh: - - MFH: libtool upgrade to 1.4.3 - - * acinclude.m4 - configure.in - ltmain.sh: - - Updated libtool to 1.4.3 which has test for the sed problem.. - -2003-02-10 Jon Parise - - * ext/pgsql/pgsql.c: - Correct the spelling of 'supported'. - -2003-02-10 Stig Bakken - - * pear/PEAR.php: - - update PEAR::isError phpdoc - - * pear/PEAR.php: - - PEAR::isError accepts second parameter that will be matched against - the error code. PEAR::isError($obj, FOO) will return true if $obj - is an error object, and $obj->getCode() returns FOO. - - * pear/install-pear.txt: - - the "a" in "pear" is "application" now - -2003-02-10 Wez Furlong - - * ext/rpc/com/com_wrapper.c: - Error reporting clean up - - * ext/rpc/rpc.c: - Newly created objects should use a separate function_table from the global - class entry table. - For objects instantiated via new, make sure that intern->function_table - uses the newly created table when the class is registered. - For generic per-object hashing, copy the ce->function_table into - intern->function_table. - - * ext/rpc/com/com.c - ext/rpc/com/com_wrapper.c: - Error reporting leaks and cleanup - -2003-02-10 Zeev Suraski - - * tests/lang/bug21961.phpt: - Fix the test - -2003-02-10 Wez Furlong - - * ext/openssl/openssl.c: - Add additional optional parameter to openssl_pkcs7_encrypt to specify the - cipher. The cipher can be one of the constants listed below. - - Based on a patch from: - stefan at cuba dot ionum dot ch - - OPENSSL_CIPHER_RC2_40, (the default) - OPENSSL_CIPHER_RC2_128, - OPENSSL_CIPHER_RC2_64, - OPENSSL_CIPHER_DES, - OPENSSL_CIPHER_3DES, - - proto bool openssl_pkcs7_encrypt(string infile, string outfile, - mixed recipcerts, array headers [, long flags [, long cipher]]) - -2003-02-10 Harald Radi - - * (PHP_4_3) - NEWS: - 18 times the speed of light - -2003-02-10 Hartmut Holzgraefe - - * ext/fdf/fdf.c: - proto fixes - -2003-02-10 Jani Taskinen - - * ext/notes/php_notes.c: - some win32 fixes by Kai - -2003-02-10 Wez Furlong - - * win32/installer/gen-nsis.php - win32/installer/setini.php: - Fix php.ini customization. - Apparently, it seems that running the php script with output captured to - the log prevented it from working correctly. - - Also, deletes the php.ini when uninstalled. - - TODO: The defaults install and activate all extensions. This is a problem - for those extension that require non-bundled .dlls (such as OCI). - -2003-02-09 Jani Taskinen - - * (PHP_4_3) - sapi/nsapi/nsapi.c: - MFH (ws fixes, but merged to ease any fix patch merging) - - * sapi/nsapi/nsapi.c: - style, ws - - * sapi/nsapi/nsapi.c: - Some compilers puke on these.. - - * (PHP_4_3) - sapi/nsapi/nsapi.c: - MFH: Fixed _SERVER[] variables, memleaks - -2003-02-09 Harald Radi - - * ext/rpc/rpc.c: - fix a memleak - -2003-02-09 Wez Furlong - - * ext/standard/file.c: - ZTS fix - -2003-02-09 Jani Taskinen - - * NEWS: - We move, fix, change or add stuff - - * (PHP_4_3) - NEWS: - sex with punctuation mark.. - -2003-02-09 Kai Schröder - - * ext/standard/datetime.c - ext/standard/datetime.c: - fix for #17928 - -2003-02-09 Wez Furlong - - * ext/rpc/com/com.c - ext/rpc/com/com_wrapper.c - ext/rpc/com/variant.h: - Fix various little leaks and segfaults. - Fix scripts like this: - $obj = new COM('Foo'); - $obj2 = $obj->get_object(); - $obj2->method(); // <-- would segfault here - - * ext/rpc/handler.h - ext/rpc/rpc.c: - Add get_class_name handler so that the current var_dump implementation does - not segfault. - Add a generic rpc_object_from_data() function for generating rpc objects - from C code (as discussed with Harald). - - * ext/rpc/rpc_proxy.c: - Fix some warnings - -2003-02-09 Sascha Schumann - - * main/SAPI.c - sapi/apache/mod_php4.c - sapi/thttpd/thttpd.c: - use SUCCESS/FAILURE instead of 0/-1 - -2003-02-09 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * NEWS: - New features. - - * ext/standard/basic_functions.c - ext/standard/file.c - ext/standard/file.h - main/php_streams.h - main/streams.c: - Added feature request #9173 (added stream_get_line(), this function will - read either the specified number of bytes or until the ending string is - found). - - * ext/standard/file.c: - Added feature request #17983 (optional parameter to mkdir() that makes - directory creation recursive). - Fixed prototype for file() function. - -2003-02-09 Jani Taskinen - - * NEWS: - order, style.. - -2003-02-09 Ilia Alshanetsky - - * ext/standard/file.c: - Added feature request #14097 (option allowing file() command not to include - line endings in it's output. As well as another option, which allows blank - lines to be excluded from the output). - -2003-02-09 Jani Taskinen - - * ext/dba/config.m4: - break: First one not needed, second missing. - -2003-02-09 Shane Caraveo - - * NEWS: - news entry for previous commit - -2003-02-09 Jani Taskinen - - * (PHP_4_3) - ext/mime_magic/mime_magic.c - ext/standard/aggregation.c - ext/standard/basic_functions.c - ext/standard/image.c - main/SAPI.c - main/output.c: - MFH: fixed compile failures when ZLIB/PCRE are compiled as shared in same - build. - - * ext/mime_magic/mime_magic.c - ext/standard/aggregation.c - ext/standard/basic_functions.c - ext/standard/image.c - main/SAPI.c - main/output.c: - Fixed compile failures when ZLIB / PCRE are compiled as shared - extensions in same build. - - * ext/standard/aggregation.c: - Let this compile even if PCRE is compiled as shared in same build. - - * ext/pcre/config.m4: - Fixed bug #22131, enable use of shared lib with pcre. - -2003-02-09 Marcus Boerger - - * ext/gd/libgd/gd.c: - Kill some warnings - - * ext/gd/gd_bundled.dsp: - XBM for win - -2003-02-09 Kai Schröder - - * ext/standard/tests/file/003-win32.phpt: - shane added is_executable() for windows last night - - * ext/standard/tests/file/003.phpt: - reverting to version 1.5; shane added is_executable() for windows last - night - - * ext/standard/tests/general_functions/007.phpt - ext/standard/tests/general_functions/007.phpt: - newlines changed - - * ext/standard/tests/general_functions/getopt.phpt - ext/standard/tests/general_functions/getopt.phpt: - getopt() is currently not available on Windows - - * (PHP_4_3) - ext/standard/tests/file/001-win32.phpt - ext/standard/tests/file/001.phpt: - there are no symlinks on Windows - - * ext/standard/tests/file/001-win32.phpt - ext/standard/tests/file/001.phpt: - - there are no symlinks on Windows - - * ext/standard/tests/file/003-win32.phpt - ext/standard/tests/file/003.phpt: - is_executable() does not exist on Windows - - * ext/standard/tests/file/003-win32.phpt - ext/standard/tests/file/003-win32.phpt - ext/standard/tests/file/003.phpt: - - file 003-win32.phpt was initially added on branch PHP_4_3. - - * ext/standard/tests/time/002.phpt - ext/standard/tests/time/002.phpt: - die() to skip second message - - * ext/standard/datetime.c - ext/standard/datetime.c: - MSVC's mktime() does not examine the existence of a daylight-saving-time - zone - - * ext/standard/tests/time/003.phpt - ext/standard/tests/time/003.phpt: - Windows doesn't know timezone CET - - * ext/standard/tests/time/002.phpt - ext/standard/tests/time/002.phpt: - skip for Windows (does not support dates prior to midnight, January 1, - 1970) - - * ext/standard/tests/time/002-win32.phpt: - Windows does not support dates prior to midnight, January 1, 1970 - - * ext/standard/tests/time/mktime.phpt: - test for mktime() - -2003-02-09 Derick Rethans - - * ext/mssql/php_mssql.c - ext/mssql/php_mssql.c: - - Whitespace fixes - -2003-02-09 Kai Schröder - - * ext/standard/tests/time/mktime.phpt - ext/standard/tests/time/mktime.phpt: - - file mktime.phpt was initially added on branch PHP_4_3. - - * ext/standard/tests/time/002-win32.phpt - ext/standard/tests/time/002-win32.phpt: - - file 002-win32.phpt was initially added on branch PHP_4_3. - -2003-02-09 Frank M. Kromann - - * ext/mssql/php_mssql.c - ext/mssql/php_mssql.c: - cleanup variable initializations - - * ext/mssql/php_mssql.c - ext/mssql/php_mssql.c: - Fixing coredump when no php.ini file is used - - * ext/mssql/config.m4 - ext/mssql/php_mssql.h: - MFB - -2003-02-09 Yasuo Ohgaki - - * ext/pgsql/pgsql.c: - Fixed one more improper row offset handling. - -2003-02-09 Frank M. Kromann - - * (PHP_4_3) - ext/mssql/php_mssql.h: - DBFLT4 is not defined in FreeTDS. Needed for real data types - - * (PHP_4_3) - ext/mssql/config.m4: - Fixing autodetect of FreeTDS - -2003-02-09 Yasuo Ohgaki - - * ext/pgsql/pgsql.c: - Fixed improper result offset handling. - Prevent error when connection is broken. (optional) - -2003-02-09 Frank M. Kromann - - * ext/mssql/php_mssql.c - ext/mssql/php_mssql.c - ext/mssql/php_mssql.h - ext/mssql/php_mssql.h: - Bug #21707 problem with real - - * ext/gd/gd.dsp - ext/gd/gd_bundled.dsp: - Syncronize with branch - - * (PHP_4_3) - ext/gd/gd.dsp: - Fixing build with GD 2.0.11 - - * (PHP_4_3) - ext/gd/gd_bundled.dsp: - Adding missing HAVE_GD_STRINGFTEX define - - * (PHP_4_3) - ext/gd/gd.dsp - ext/gd/gd_bundled.dsp: - Adding some missing defines to enable functions. - Fixing bug #22130 - -2003-02-09 Shane Caraveo - - * ext/standard/basic_functions.c - ext/standard/filestat.c - ext/standard/php_filestat.h: - is_executable() now available on win32 - stats can now get information provided by access() - - * run-tests2.php: - whitespace changes - -2003-02-08 Sascha Schumann - - * ext/gettext/gettext.c: - Fix segfault in bindtextdomain when first parameter was empty. - - The Linux man page states: domainname must be a non-empty string. - - Noticed by: Nils Meyer - -2003-02-08 Marcus Boerger - - * sapi/cli/php.1: - Style corrections - See also: Stig's intro - Version info - -2003-02-08 Jani Taskinen - - * ext/standard/string.c: - style & ws fixes - -2003-02-08 Pierre-Alain Joye - - * (PHP_4_3) - ext/gd/libgd/gd.c - ext/gd/libgd/gd.h: - MFH: - Add gdImageEllipse - Replace gdImageFilledEllipse by a new function (backported from - the new phpgd) - the new gdImageFilledEllipse fix bug bug #22103 (ellipse part) - - * ext/gd/libgd/gd.c - ext/gd/libgd/gd.h: - Add gdImageEllipse - Replace gdImageFilledEllipse by a new function (backported from - the new phpgd) - the new gdImageFilledEllipse fix bug bug #22103 (ellipse part) - -2003-02-07 Sara Golemon - - * ext/standard/http_fopen_wrapper.c: - chunk_size should always be reduced to 1 while scanning response headers to - avoid buffering the actual stream prior to any read calls. - -2003-02-07 Ilia Alshanetsky - - * main/php_streams.h: - Added missing definitions. - -2003-02-07 Marcus Boerger - - * sapi/cli/php.1: - Adding some text and some backslashes which are needed sometimes - somewhere... - - * sapi/cli/php_cli.c: - Define STDIN/OUT/ERR for -B -R -F -E (works as expected). - Enable exit in same switches. - -2003-02-07 Ilia Alshanetsky - - * NEWS: - New function news. - - * ext/standard/basic_functions.c - ext/standard/php_string.h - ext/standard/string.c: - Added str_split() function. This function can be used to break down a - string into an array. - - * ext/standard/basic_functions.c - ext/standard/url.c - ext/standard/url.h - main/streams.c: - Added get_browser() function. This function can be used to fetch the - headers - sent by the server when a request is made for a given URL. - -2003-02-07 Marcus Boerger - - * sapi/cli/php_cli.c: - No more maximum line size for -R and -F - -2003-02-07 Uwe Schindler - - * sapi/nsapi/nsapi.c: - (NSAPI SAPI) Fixed _SERVER[] variables (all headers included) to be now - similar to apache SAPI; with this new file the memory leaks (webserver - eats up memory during a few days running) are also disappeared (all by - NSAPI allocated strings are freed). - -2003-02-07 Zeev Suraski - - * main/win95nt.h: - Fixlet - -2003-02-07 Dan Kalowsky - - * ext/odbc/php_odbc.c: - MFB - - * (PHP_4_3) - ext/odbc/php_odbc.c: - Patch for Bug #21279 submitted by ernani@php.net - -2003-02-06 James Cox - - * NEWS: - adding news about moved ext - -2003-02-06 Tal Peer - - * ext/fribidi/.cvsignore - ext/fribidi/CREDITS - ext/fribidi/EXPERIMENTAL - ext/fribidi/README - ext/fribidi/config.m4 - ext/fribidi/fribidi.c - ext/fribidi/fribidi.dsp - ext/fribidi/php_fribidi.h: - Moving fribidi to PECL - -2003-02-06 Sara Golemon - - * ext/bcmath/bcmath.c: - bc_raise() can return a scale lower than that passed into it. While most - other bcmath calls won't, it's safest to do a quick check that we're only - reducing n_scale, not increasing it. - -2003-02-06 Marcus Boerger - - * sapi/cli/php.1: - Rewrite/add some stuff - -2003-02-06 Jani Taskinen - - * (PHP_4_3) - NEWS: - fugbix news - - * (PHP_4_3) - ext/standard/array.c: - MFH: - Fixed bug #22088 (array_shift() leaves next index to be +1 too much) - - * ext/standard/array.c: - - Fixed bug #22088 (array_shift() leaves next index to be +1 too much) - - * ext/standard/tests/array/bug22088.phpt: - fix the test - - * ext/standard/tests/array/bug22088.phpt: - - Added testcase for bug #22088 - -2003-02-06 Andrey Hristov - - * (PHP_4_3) - NEWS: - added entry for memory_get_usage(). - - * (PHP_4_3) - ext/standard/basic_functions.c - ext/standard/php_var.h - ext/standard/var.c: - Backporting memory_get_usage() from HEAD. - As far as the code is small there won't be any problems. - -2003-02-05 Marcus Boerger - - * tests/classes/private_001.phpt - tests/classes/private_002.phpt - tests/classes/private_003.phpt - tests/classes/private_003b.phpt - tests/classes/private_004.phpt - tests/classes/private_004b.phpt - tests/classes/private_005.phpt - tests/classes/private_005b.phpt - tests/classes/private_006.phpt - tests/classes/private_006b.phpt - tests/classes/private_007.phpt - tests/classes/private_007b.phpt - tests/classes/protected_001.phpt - tests/classes/protected_001b.phpt - tests/classes/protected_002.phpt - tests/classes/visibility_000a.phpt - tests/classes/visibility_000b.phpt - tests/classes/visibility_000c.phpt - tests/classes/visibility_001a.phpt - tests/classes/visibility_001b.phpt - tests/classes/visibility_001c.phpt - tests/classes/visibility_002a.phpt - tests/classes/visibility_002b.phpt - tests/classes/visibility_002c.phpt - tests/classes/visibility_003a.phpt - tests/classes/visibility_003b.phpt - tests/classes/visibility_003c.phpt - tests/classes/visibility_004a.phpt - tests/classes/visibility_004b.phpt - tests/classes/visibility_004c.phpt: - Add PPP method tests - -2003-02-05 Ilia Alshanetsky - - * NEWS: - New function news. - - * ext/standard/array.c - ext/standard/basic_functions.c - ext/standard/php_array.h: - Added array_walk_recursive() function that can apply array_walk recursively - to an array. - -2003-02-05 Wez Furlong - - * ext/iconv/CREDITS: - Credits for iconv - - * sapi/activescript/EXPERIMENTAL: - Mark activescript sapi as experimental, so that the installer can - categorize it appropriately. - - * win32/installer/README - win32/installer/gen-nsis.php - win32/installer/setini.php: - Check in the prototype PHP installer for win32. - - -2003-02-05 Ilia Alshanetsky - - * sapi/apache/mod_php4.c - sapi/apache_hooks/mod_php4.c: - Build Fix. - -2003-02-05 Marcus Boerger - - * sapi/cli/php.1: - - - * sapi/cli/php.1: - First step - abrief version. - -2003-02-04 Stig Bakken - - * pear/package-PEAR.xml: - - replace @bin_dir@ in pear.bat - -2003-02-04 Sara Golemon - - * (PHP_4_3) - ext/bcmath/bcmath.c: - FMH(r-1.49/r-1.50) - -2003-02-04 Andi Gutmans - - * ext/bcmath/bcmath.c: - - Please follow coding standards (this isn't java :) - -2003-02-04 Marcus Boerger - - * ext/bcmath/bcmath.c: - fix ZTS build - -2003-02-04 Ilia Alshanetsky - - * sapi/apache/mod_php4.c - sapi/apache_hooks/mod_php4.c: - Fixed compilation of Apache & Apache Hooks SAPIs. - -2003-02-04 Marcus Boerger - - * sapi/cli/php_cli.c: - remove it then....this forces to put work in man page ... - -2003-02-04 Jani Taskinen - - * (PHP_4_3) - NEWS: - reorder the bug fixes (reverse #). added missing bug fixing news - -2003-02-04 Sara Golemon - - * ext/bcmath/bcmath.c: - Bug#13551 bcmath functions should not apply scale to arguments, only to - result - -2003-02-04 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/pgsql/pgsql.c: - Made the row parameter in pg_result_seek() non-optional, the current - implementation would result in random behavior if the 2nd argument is not - passed. - Fixed bug #22042 (pg_result_seek() would never seek to the 1st row in the - result due to always seeking to row next to the one requested). - Removed dead code from pg_result_seek(). - -2003-02-04 Zeev Suraski - - * ext/standard/aggregation.c - sapi/apache/mod_php4.c - sapi/apache_hooks/mod_php4.c: - Updates reflecting infrastructure changes - -2003-02-04 Uwe Steinmann - - * ext/pdf/pdf.c: - - fixed some prototypes and folding - - * ext/pdf/pdf.c: - - fixed prototype of pdf_get_buffer() - -2003-02-04 Jani Taskinen - - * (PHP_4_3) - NEWS: - Added missing bugfix news entry. - - * NEWS: - NEWS ordering.. - -2003-02-03 Hartmut Holzgraefe - - * main/output.c: - proto-fix - -2003-02-03 Ilia Alshanetsky - - * ext/standard/datetime.c: - Fixed bug #22017 (non descriptive error to appear when timestamp passed to - date() has value < 0. Win32 does not support timestamps prior to midnight - (00:00:00), January 1, 1970). - - * ext/standard/basic_functions.c: - Make putenv() return a proper error rather then NULL when invalid argument - is passed. - - * ext/imap/php_imap.c: - Fixed bug #22022 (Crash in imap_mail_compose() if the body is an empty - array). - - * ext/curl/interface.c: - Fixed bug #22031 (Made curl_write() & curl_write_header() binary safe). - -2003-02-03 Moriyoshi Koizumi - - * ext/mbstring/tests/mb_http_output.phpt - ext/mbstring/tests/mb_internal_encoding.phpt - ext/mbstring/tests/mb_strpos.phpt: - Trivial test adjustment - - * ext/mbstring/mbstring.c: - zend_get_parameters_* => zend_parse_parameters - -2003-02-03 Jani Taskinen - - * (PHP_4_3) - sapi/apache2filter/config.m4: - MFH: Fix bug: #22035 (EXTRA_LDFLAGS for AIX not quite right) - - * sapi/apache2filter/config.m4: - Fix bug: #22035 (EXTRA_LDFLAGS for AIX not correct) - - * (PHP_4_3) - NEWS: - fugbix news - - * (PHP_4_3) - ext/standard/array.c: - MFH: Fixed bug: #21998 (array_pop() did not reset the current array - position) - - * ext/standard/array.c: - - Fixed bug: #21998 (array_pop() did not reset the current array position) - - * ext/standard/tests/array/bug21998.phpt: - Correct description of the problem - -2003-02-03 Moriyoshi Koizumi - - * ext/mbstring/mbstring.c: - Really fixed proto. - - - * ext/mbstring/mbstring.c: - Oops! wrong commit. Reverting... - - * ext/mbstring/mbstring.c: - Fixed proto - - * tests/lang/bug21961.phpt: - Modified the test so it will be skipped under ZE1. - Thanks Kai - - * tests/lang/bug20175.phpt: - Added missing "?>" - - * ext/mbstring/tests/mb_strpos.phpt: - Fixed test case for mb_strpos(). - -2003-02-03 Jani Taskinen - - * sapi/apache_hooks/config.m4: - Make these configure messages differ from the regular apache configure - -2003-02-03 Moriyoshi Koizumi - - * tests/lang/bug21961.phpt: - Added test case for bug #21961 - -2003-02-03 Jani Taskinen - - * ext/standard/php_image.h: - This cause some warning/error in AIX - - * (PHP_4_3) - main/php_ini.c: - MFH: Fixed bug: #22011 (-n must ignore all ini files) - - * main/php_ini.c: - Fixed bug: #22011 (-n must ignore all ini files) - -2003-02-03 Derick Rethans - - * run-tests.php: - - Make VIM highlighting happy - -2003-02-03 Jani Taskinen - - * ext/interbase/config.m4: - Test that libgds actually exists. - - * ext/calendar/calendar.c: - ws - -2003-02-03 Giuseppe Tanzilli - - * (PHP_4_3) - sapi/servlet/Makefile.frag - sapi/servlet/config.m4 - sapi/servlet/servlet.c - sapi/servlet/servlet.java: - Fix sapi/servlet build on Unix - -2003-02-03 Sebastian Bergmann - - * sapi/cli/php_cli.c: - Fix ZTS build. - -2003-02-03 Jani Taskinen - - * ext/standard/tests/array/bug21998.phpt: - - Added test for bug #21998 - -2003-02-03 Stig Bakken - - * pear/package-PEAR.xml: - - 1.1 release notes update - * added some elements - - * pear/PEAR/Common.php: - - start using the source tokenizer - - * pear/package-PEAR.xml: - - substitute @php_dir@ in pear.in - -2003-02-03 Marcus Boerger - - * sapi/cli/php_cli.c: - - Added -B, -F, -R, -E for line by line std in processing. - - Added some error messages. - - Added more -h info. - -2003-02-02 Ilia Alshanetsky - - * main/php_scandir.h: - Fixed bug #22021. - - * ext/curl/interface.c: - Gave the user the ability to specify encoding of the request. - Patch by jens@mermaidconsulting.dk. - - * main/php_scandir.c: - Fixed build on Solaris (patch by Melvyn Sopacua). - -2003-02-02 Sebastian Bergmann - - * ext/standard/info.c: - Fix warning. - -2003-02-02 Zeev Suraski - - * ext/standard/info.c - ext/standard/info.c: - Fix phpinfo() display of Zend extensions - -2003-02-02 Marcus Boerger - - * ext/gd/config.m4 - ext/gd/libgd/gd.c - ext/gd/libgd/xbm.c - ext/gd/tests/conv_test.xbm - ext/gd/tests/xbm2png.phpt: - - new xbm support - - -2003-02-01 Marcus Boerger - - * ext/standard/image.c: - avoid warnings - - * ext/gd/config.m4: - Bundled version has XBM support as well as external. - - * ext/gd/gd.c: - Show if XPM support is available & Set availability bit only when - available. - - * ext/standard/image.c - ext/standard/php_image.h: - - - * ext/dba/config.m4: - Change DBM detection order - - * (PHP_4_3) - ext/dba/config.m4 - ext/dba/dba_cdb.c - ext/dba/dba_dbm.c - ext/dba/dba_gdbm.c - ext/dba/dba_ndbm.c: - MFH: include file handling and dbm fixes - - * ext/dba/config.m4 - ext/dba/dba_cdb.c - ext/dba/dba_dbm.c - ext/dba/dba_gdbm.c: - - unify configure mechanisms (include file handling) - - fix dbm - - allow dbm to be based on gdbm - -2003-02-01 Melvyn Sopacua - - * run-tests.php: - Make it easier to diff results of several runs in one day. - -2003-02-01 Jani Taskinen - - * NEWS: - Correct required mcrypt version - -2003-02-01 Melvyn Sopacua - - * (PHP_4_3) - INSTALL: - MFH: Bug #21892 (links to apache2 install instructions missing) - - * INSTALL: - Fix Bug #21892 (links to apache2 install instructions missing) - - -2003-02-01 Martin Jansen - - * pear/PEAR/Command/Registry.php: - - displayLine() is deprecated, so better use displayError() here. - -2003-02-01 Wez Furlong - - * ext/standard/var.c: - Don't assume that objects have class entries (in the ZE1 sense) when - determining the class name. - Additionally, don't assume that objects have a properties hash either. - -2003-01-31 Melvyn Sopacua - - * ext/mcrypt/config.m4: - Require 2.5.6+ - MFB: Be -ltdl aware - -2003-01-31 Ilia Alshanetsky - - * ext/openssl/openssl.c: - Fixed bug #21986 (openssl test failure). - -2003-01-31 Marcus Boerger - - * (PHP_4_3) - ext/dba/config.m4: - MFH: Shared dba requires at least db-3.3 - - * ext/dba/config.m4: - Shared dba requires at least db-3.3 - - * ext/dba/dba.c: - Fix proto - -2003-01-31 Frank M. Kromann - - * ext/ext_skel.php - ext/ext_skel.php - ext/ext_skel_win32.php: - Rename script. - Add check for CLI version - - * ext/ext_skel_win32.php - ext/ext_skel_win32.php: - - file ext_skel_win32.php was initially added on branch PHP_4_3. - -2003-01-31 Sascha Schumann - - * ext/standard/var.c: - Unbreak $Id tag - -2003-01-31 Melvyn Sopacua - - * (PHP_4_3) - ext/mcrypt/config.m4: - "The ugly patch" - Make mcrypt compile, when we finally are free of -ltdl. Bug #20926. - - -2003-01-31 Moriyoshi Koizumi - - * (PHP_4_3) - ext/mbstring/mbfilter.c - ext/mbstring/mbstring.c - ext/mbstring/tests/mb_send_mail01.phpt - ext/mbstring/tests/mb_send_mail02.phpt - ext/mbstring/tests/mb_send_mail03.phpt - ext/mbstring/tests/mb_send_mail04.phpt - ext/mbstring/tests/mb_send_mail05.phpt - ext/mbstring/tests/mb_send_mail06.phpt: - MFH: fixed a mb_send_mail() bug. - -2003-01-31 Jani Taskinen - - * (PHP_4_3) - NEWS: - Moved from HEAD. - - * NEWS: - Moved these entries to PHP_4_3 branch NEWS (for 4.3.1) - - * ext/oci8/php_oci8.h: - No c++ comments.. - -2003-01-31 Moriyoshi Koizumi - - * ext/mbstring/mbfilter.c - ext/mbstring/mbstring.c - ext/mbstring/tests/mb_send_mail01.phpt - ext/mbstring/tests/mb_send_mail02.phpt - ext/mbstring/tests/mb_send_mail03.phpt - ext/mbstring/tests/mb_send_mail04.phpt - ext/mbstring/tests/mb_send_mail05.phpt - ext/mbstring/tests/mb_send_mail06.phpt - ext/mbstring/tests/mb_send_mail07.phpt: - Fixed a mb_send_mail() bug that has been reported in php-i18n@lists.php.net - See http://lists.php.net/article.php?group=php.i18n&article=427 - -2003-01-31 Sascha Schumann - - * php.ini-dist: - Remove obsolete warning - -2003-01-31 Sara Golemon - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: - Add ftp_raw() to send raw command strings to an FTP server. - -2003-01-31 Frank M. Kromann - - * ext/skeleton/skeleton.php: - Use platform specific extension. - - * ext/skeleton/skeleton.dsp: - Dtandard visual studio project for ext_skel - - * ext/ext_skel.php: - Wrapper script to use ext_skel on Win32 - - * (PHP_4_3) - ext/ext_skel.php: - Wrapper script to execute ext_skel on WIn32 - - * ext/ext_skel.php: - - file ext_skel.php was initially added on branch PHP_4_3. - - * (PHP_4_3) - ext/skeleton/skeleton.php: - Allow extensions to be loaded on win32 - - * ext/skeleton/skeleton.dsp - ext/skeleton/skeleton.dsp: - - file skeleton.dsp was initially added on branch PHP_4_3. - -2003-01-30 Ilia Alshanetsky - - * ext/session/session.c: - Fix compiler warning. - -2003-01-30 Marcus Boerger - - * ext/dba/config.m4: - Revert this part, the new one adds more problems than it solves. - -2003-01-30 Sascha Schumann - - * (PHP_4_3) - main/streams.c - main/streams.c: - Partial MFH: Fix sticky eof issue, and avoid calling system stat macro - - * main/streams.c: - Fix sticky EOF problem - - Sometimes streams signal a temporary EOF, because all current data - has been consumed. But that does not preclude the possibility that - more data will become available later. - - Thus we must not treat eof in the read path as final. - - Now, "tail -f" like scripts work again. - -2003-01-30 Sara Golemon - - * ext/standard/string.c: - Unify str_replace and str_ireplace using INTERNAL_FUNCTION_PARAM_PASSTHRU - -- reduce codebase/maintenance complexity - -2003-01-30 Jani Taskinen - - * ext/informix/ifx.ec: - fix bug: #21945 (zts build failed) - -2003-01-30 Marcus Boerger - - * (PHP_4_3) - ext/dba/config.m4: - MFH: Allow to link against chosen modules correctly - - * ext/dba/config.m4: - Allow to link against chosen modules correctly - -2003-01-30 Sara Golemon - - * ext/standard/basic_functions.c - ext/standard/php_string.h - ext/standard/string.c: - Feature Request # 5919 - Addition of str_ireplace() - Also removed deprecated BM str replace menthod - Also rewrote php_str_to_str to use more processor/memory efficient method - (ilia) - -2003-01-30 Ilia Alshanetsky - - * ext/dbx/dbx.c - ext/fbsql/php_fbsql.c - ext/imap/php_imap.c - ext/mcal/php_mcal.c - ext/msql/php_msql.c - ext/mssql/php_mssql.c - ext/mysql/php_mysql.c - ext/sybase/php_sybase_db.c - ext/sybase_ct/php_sybase_ct.c: - Removed pointless checks. - -2003-01-29 Stig Bakken - - * pear/PEAR/Installer.php: - - Windows fix (thanks to paj) - -2003-01-29 Ilia Alshanetsky - - * ext/informix/ifx.ec: - Added sanity checks. - -2003-01-29 Maxim Maletsky - - * ext/oci8/CREDITS - ext/oci8/oci8.c: - Added myself to the maintainers list. - -2003-01-29 Edin Kadribasic - - * sapi/embed/php_embed.c: - Be more consistent with the sapi internal name. - - * ext/standard/dl.c: - Enable embedded code using sapi/embed to use dl(). - -2003-01-29 Jani Taskinen - - * (PHP_4_3) - NEWS: - ordered all bug fixes by the number :) - - * NEWS: - NEWS police is back. - - * (PHP_4_3) - NEWS: - news entries for new options in phpize and php-config - -2003-01-29 Harald Radi - - * ext/standard/basic_functions.c - main/main.c: - MFPHP_4_3 - - * (PHP_4_3) - main/main.c: - ilia pointet me to a thread on php-dev saying that - Co(Un)Initialize should be called per thread - -2003-01-29 Ilia Alshanetsky - - * ext/standard/basic_functions.c - ext/standard/php_string.h: - Added part of strpos commit that never made it in for some reason. - - -2003-01-28 Harald Radi - - * (PHP_4_3) - ext/standard/basic_functions.c: - moved to php4/main - - * (PHP_4_3) - main/main.c: - somehow the module shutdown order got reversed since 4.3.0, - thus the CoInitialize / CoUninitialize calles are more sane here - than in the basic functions module. - -2003-01-28 Jani Taskinen - - * (PHP_4_3) - NEWS: - fugbix news - -2003-01-28 Ilia Alshanetsky - - * (PHP_4_3) - ext/hyperwave/hw.c: - Fixed compile warning. - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * sapi/apache2filter/sapi_apache2.c: - Fixed bug #17868 (more then the directive used to include - a PHP file would result in a crash). - -2003-01-28 Derick Rethans - - * main/php_scandir.c - main/php_scandir.c: - - Fix includes - -2003-01-28 Ilia Alshanetsky - - * main/php_scandir.c - main/php_scandir.c: - Fixed compiler warning. - -2003-01-28 Jani Taskinen - - * (PHP_4_3) - Makefile.frag - configure.in - build/config-stubs - pear/Makefile.frag - pear/pear.m4 - pear/scripts/.cvsignore - pear/scripts/php-config.in - pear/scripts/phpextdist - pear/scripts/phpize.in - scripts/.cvsignore - scripts/Makefile.frag - scripts/config-stubs - scripts/conv_proto - scripts/conv_z_macros - scripts/credits - scripts/php-config.in - scripts/phpextdist - scripts/phpize.in - scripts/phpize.m4 - scripts/dev/conv_proto - scripts/dev/conv_z_macros - scripts/dev/credits: - - MFH: Fixed bug #13561 (--without-pear prevents install of php-config, - phpize) - - MFH: Added --ldflags option to php-config - - MFH: Added --clean option to phpize - -2003-01-28 Edin Kadribasic - - * sapi/embed/php_embed.c: - Call correct module startup function (not a hard coded one) allowing - startup override. - -2003-01-28 Sascha Schumann - - * ext/ircg/ircg_scanner.c: - sync with .re - - * ext/ircg/ircg_scanner.re: - update year - - * ext/ircg/Makefile.frag: - Looks like we are hitting a bug due to '\xxx' for xxx >= 200 not being - handled - correctly. - -2003-01-28 Zeev Suraski - - * win32/php4ts.dsw: - Get rid of php4ts.dsw - replaced by php5ts.dsw - -2003-01-28 Jani Taskinen - - * build/config-stubs - pear/Makefile.frag - pear/pear.m4 - pear/scripts/.cvsignore - scripts/.cvsignore - scripts/Makefile.frag - scripts/php-config.in - scripts/phpextdist - scripts/phpize.in - scripts/phpize.m4 - scripts/dev/conv_proto - scripts/dev/conv_z_macros - scripts/dev/credits: - - - Fixed bug: #13561 (--without-pear prevents install of phpize, - php-config) - - * Makefile.frag - configure.in - pear/scripts/php-config.in - pear/scripts/phpextdist - pear/scripts/phpize.in - scripts/config-stubs - scripts/conv_proto - scripts/conv_z_macros - scripts/credits: - - Fixed bug: #13561 (--without-pear prevents install of phpize, php-config) - - * ext/dba/config.m4: - Fix configure. (typo?) - -2003-01-28 Edin Kadribasic - - * sapi/embed/php_embed.c - sapi/embed/php_embed.h: - Expose php_embed_module struct (and make Wez happy). - -2003-01-28 Melvyn Sopacua - - * (PHP_5_0_dev_before_13561_fix) - tests/lang/bug20175.phpt: - Fix parse error and edink's fear of bison errors - -2003-01-28 Jani Taskinen - - * (PHP_5_0_dev_before_13561_fix) - ext/imap/config.m4: - fix some typos - - * (PHP_5_0_dev_before_13561_fix) - ext/mime_magic/config.m4: - fix typo - -2003-01-28 Marcus Boerger - - * (PHP_5_0_dev_before_13561_fix) - ext/dba/config.m4: - - fix this: els is optional but may not be empty - -2003-01-28 Frank M. Kromann - - * (PHP_5_0_dev_before_13561_fix) - ext/standard/info.c - ext/standard/info.c: - Fix the setting of computer name and processor type for php_uname() on - Win32 - -2003-01-28 Jani Taskinen - - * (PHP_5_0_dev_before_13561_fix) - makedist - makedist.ZendEngine2: - - Removed unnecessary makedist.ZendEngine2 - - Modified makedist to use php5 CVS module (alias) - -2003-01-28 Ilia Alshanetsky - - * (PHP_5_0_dev_before_13561_fix) - ext/standard/basic_functions.c - ext/standard/dir.c - ext/standard/php_dir.h: - Added scandir() function, which allows quick retrieval of all files & - directories within the specified path and sort the output in alphabetical - or reverse alphabetical order. - - * (PHP_5_0_dev_before_13561_fix) - sapi/apache2filter/php_functions.c: - Fixed win32 build (bug #21506). - Fixed a bug that would cause garbage data to appear at the end of the - loaded apache modules list in phpinfo(). - -2003-01-28 Jani Taskinen - - * ext/mime_magic/config.m4: - - Cleaned up and made less error-prone - - Changed --enable-mime-magic -> --with-mime-magic[=FILE] to allow - specifying of the file during configure. - -2003-01-28 Ilia Alshanetsky - - * (PHP_5_0_dev_before_13561_fix) - main/php_scandir.c - main/php_scandir.h: - - 2nd part of Sebastian's patch. - -2003-01-28 Edin Kadribasic - - * (PHP_5_0_dev_before_13561_fix) - win32/php4dllts.dsp: - Adding new files to the project. - -2003-01-28 Marcus Boerger - - * (PHP_4_3) - ext/dba/config.m4: - MFH: --without-flatfile, Berkeley DB version check - - * ext/dba/config.m4: - - fix "--without-flatfile" - - simplify Berkley DB verison check - -2003-01-27 Ilia Alshanetsky - - * configure.in - main/php_ini.c - main/php_scandir.c - main/php_scandir.h - win32/readdir.c - win32/readdir.h: - Moved the scandir code into it's own files so that it can be used by other - OSes where libc does not have a native scandir() implementation. - -2003-01-27 Maxim Maletsky - - * ext/oci8/oci8.c: - This fixes "warning C4101: 'charsetid' : unreferenced local variable" on - VC6 - - * ext/oci8/oci8.c: - (Maxim) - -2003-01-27 Sara Golemon - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c: - Fix potential buffer overflow. - -2003-01-27 Ilia Alshanetsky - - * main/output.c: - Removed pointless checks. - -2003-01-27 Edin Kadribasic - - * (PHP_4_3) - NEWS - ext/standard/dir.c - win32/glob.c: - MFH: Fixed bug #21597 (made glob() understand Windows paths). - - * ext/standard/dir.c - win32/glob.c: - Fixed bug #21597 (made glob() understand windows paths) - -2003-01-27 Jani Taskinen - - * (PHP_4_3) - configure.in: - revert previous commit - - * (PHP_4_3) - configure.in: - MFH: use grep -E instead of egrep. the latter is not defined by POSIX - anymore - -2003-01-27 Uwe Steinmann - - * ext/hyperwave/hw.c: - - fixed several bugs in hw_document_xx() functions. The macro to access - the document was the same as for a link to the sever. - -2003-01-27 Sara Golemon - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: - Feature Request #21748. Added function ftp_chmod(). - -2003-01-27 Moriyoshi Koizumi - - * tests/lang/bug21600.phpt: - Updated test so it describes the problem more clearly. - -2003-01-26 Stig Bakken - - * pear/PEAR.php: - - whoops, heritage shows through :) - -2003-01-26 Marcus Boerger - - * run-tests.php: - Simplify - -2003-01-26 Sander Roobol - - * (PHP_4_3) - ext/mime_magic/mime_magic.c: - MFH (well... it's not really an MFH... but who cares :) - - * ext/mime_magic/mime_magic.c: - Fix build - -2003-01-26 Shane Caraveo - - * sapi/isapi/php4isapi.c: - normalize CGI variables to the CGI spec - PATH_INFO and PATH_TRANSLATED are correct now - SCRIPT_FILENAME now contains the full path to the script - - * (PHP_4_3) - main/php_ini.c - win32/readdir.c - win32/readdir.h: - MFH - fix broken build by adding scandir and alphasort - - * main/php_ini.c - win32/readdir.c - win32/readdir.h: - Fix broken build by adding scandir and alphasort for win32 - -2003-01-26 Sara Golemon - - * ext/gd/gd.c - ext/gd/php_gd.h: - Feature Request #21784 Added: imagecolorallocatealpha - (pollita@php.net,jasper@pointless.net) - -2003-01-25 Shane Caraveo - - * (PHP_4_3) - sapi/cgi/cgi_main.c: - MFH - - fix bug 21261 - putenv on some platforms requires we provide the memory - cleanup env parsing logic - fix bug 21367 - missed optargs in a previous patch - - * sapi/cgi/cgi_main.c: - fix bug 21261 - putenv on some platforms requires we provide the memory - cleanup env parsing logic - fix bug 21367 - missed optargs in a previous patch - -2003-01-25 Ilia Alshanetsky - - * main/php_ini.c: - Fixed bug #21625 (When scanning a directory for ini files, do so in - alphabetical order. This gives a user a way to control the order in which - the ini files are loaded). - Fixed a bug that would make the code try to read files without an - extension - as ini files. - -2003-01-25 Marcus Boerger - - * (PHP_4_3) - ext/dba/config.m4: - MFH: The builtin version was always used even if configured otherwise. - - * (PHP_4_3) - run-tests.php: - MFH: Bug #21751: Part one never let this happen again... - - * ext/dba/config.m4: - The builtin version was always used even if configured otherwise. - - * run-tests.php: - Bug #21751: Part one never let this happen again... - -2003-01-25 Ilia Alshanetsky - - * ext/informix/ifx.ec: - Removed unneeded code. - -2003-01-25 Hartmut Holzgraefe - - * ext/mime_magic/mime_magic.c: - - mime file parser messages only with mime_magic.debug=On (default: off) - - fix docref URL in startup error messages - - show status in php info, either "enabled" or "..., disabled" - - * ext/mime_magic/php_mime_magic.h: - preparations for making magic file parser silent - - * ext/mime_magic/config.m4: - suggesting a plain magic file insteat of a mime one is a bad idea - -2003-01-25 Stig Bakken - - * pear/tests/osguess.php: - - not a real test, just a script for displaying OS_Guess output - - * pear/OS/Guess.php: - - add glibc version detection for Linux - - * pear/PEAR/Command/Remote.php: - - typo - -2003-01-25 Ilia Alshanetsky - - * ext/informix/ifx.ec: - Fixed a typo. - - * ext/standard/image.c: - Fixed compiler warning. - -2003-01-24 Sascha Schumann - - * ext/session/mod_files.c - ext/session/session.c: - Remove ugly netware hacks from the code - -2003-01-24 Ilia Alshanetsky - - * ext/wddx/wddx.c: - Removed unnecessary checks. - -2003-01-24 Dan Kalowsky - - * (PHP_4_3) - ext/odbc/php_odbc.c: - busted by the style police... - - * ext/odbc/php_odbc.c - ext/odbc/php_odbc.c: - Patch for bug #21844 - -2003-01-24 Ilia Alshanetsky - - * ext/gd/gd.c: - Fixed bug #21533 (a rare condition where error can remain undefined and - result in undefined behavior when it is used without being initialized). - - * ext/informix/ifx.ec: - Fixed bug #21865. - -2003-01-24 Jani Taskinen - - * (PHP_4_3) - ext/oci8/config.m4: - MFH: Fix bug #21795, Undeclared statement in oci8.c (OCI_ATTR_STATEMENT) - - * ext/oci8/config.m4: - Fix bug #21795, Undeclared statement in oci8.c (OCI_ATTR_STATEMENT) - -2003-01-24 Ilia Alshanetsky - - * ext/yp/yp.c: - Fixed a memory leak. - zend_error -> php_error_docref. - - * ext/crack/crack.c - ext/gmp/gmp.c - ext/standard/array.c - ext/standard/assert.c - ext/standard/browscap.c - ext/standard/html.c - ext/standard/var_unserializer.c - ext/standard/var_unserializer.re - ext/sysvmsg/sysvmsg.c: - zend_error -> php_error_docref. - - * ext/gd/gd.c - ext/hyperwave/hw.c - ext/standard/proc_open.c: - Fixed compile warning. - -2003-01-24 Andrey Hristov - - * ext/standard/string.c: - Resolving problem on OSF1 and probably other - 64 bit platforms. Thanks for the feedback of Magnus (novell kiruna se). - - * ext/standard/string.c: - Adding cast. - -2003-01-24 Jani Taskinen - - * ext/imap/php_imap.c: - - Fixed stupid typo.. - - * (PHP_4_3) - ext/standard/file.c: - MFH: Fix potential problem for 64-bit architectures. - - * (PHP_4_3) - NEWS: - figbug news - - * ext/snmp/snmp.c: - Fixed bug: #20857, snmpset() fails - - * ext/snmp/snmp.c: - ws fixes - - * tests/func/001.phpt - tests/func/005.phpt - tests/func/005a.phpt - tests/func/007.phpt - tests/func/008.phpt - tests/func/009.phpt: - MFB, removed unused GET/POST entries - - * (PHP_4_3) - tests/func/001.phpt - tests/func/005.phpt - tests/func/005a.phpt - tests/func/007.phpt - tests/func/008.phpt - tests/func/009.phpt: - Remove unused GET/POST entries - -2003-01-24 Ilia Alshanetsky - - * ext/dbx/dbx.c - ext/dio/dio.c - ext/pcre/php_pcre.c: - zend_error() -> php_error_docref(). - -2003-01-23 Moriyoshi Koizumi - - * tests/lang/bug21849.phpt: - Added test case for bug21849.phpt - -2003-01-23 Sebastian Bergmann - - * TODO-PHP5: - TODO for PHP 5. - -2003-01-23 Moriyoshi Koizumi - - * ext/mbstring/php_mbregex.c: - Really fixed the mb issue of mb_ereg_replace() - - * ext/mbstring/php_mbregex.c: - Fixed a mb_ereg_replace() bug; the function was not completely - multibyte-safe. - - * tests/lang/bug7515.phpt: - Fixed typo - - * tests/lang/029.phpt - tests/lang/bug7515.phpt: - Changed the test's file name as per the convention - - * ext/standard/tests/serialize/002.phpt - ext/standard/tests/serialize/bug14293.phpt: - Renamed the test name as per the convension - - * ext/standard/tests/image/bug13213.phpt - ext/standard/tests/math/bug21523.phpt - ext/standard/tests/network/bug20134.phpt - ext/standard/tests/strings/bug20108.phpt - ext/standard/tests/strings/bug20169.phpt - ext/standard/tests/strings/bug20927.phpt: - Test name formatting - - * ext/pcre/tests/bug20528.phpt: - Made the test's name more descriptive - - * ext/pcre/tests/bug20528.phpt - ext/pcre/tests/bug21732.phpt: - Removed pointless checks - - * ext/pcre/tests/bug21732.phpt: - Added test case for bug #21732 - -2003-01-23 Jani Taskinen - - * ext/imap/php_imap.c: - Fix bug: #21817 (only enable this if --with-kerberos is used) - -2003-01-23 Zeev Suraski - - * win32/php4dllts.dsp: - Fix .dsp - -2003-01-23 Jani Taskinen - - * configure.in: - remove this stupid highlight which causes trouble. - - * ext/gd/config.m4: - MFB - - * (PHP_4_3) - ext/gd/config.m4: - Enable building with freetype 2.1.3 - - * ext/ingres_ii/config.m4: - Correct default path - - * (PHP_4_3) - NEWS: - fugbix news - - * tests/func/005a.phpt: - - Added test for bug: #21513 - -2003-01-22 Ilia Alshanetsky - - * ext/sybase_ct/php_sybase_ct.c: - Removed non-needed code. - -2003-01-22 Anil Madhavapeddy - - * ext/standard/config.m4: - typo - -2003-01-22 Frank M. Kromann - - * ext/ming/ming.dsp - ext/ming/ming.dsp: - adding missing zlib.lib and path to bindlib - -2003-01-22 Ilia Alshanetsky - - * ext/gd/gd.c: - Fixed a crash when invalid color is passed to imagepstext(). - -2003-01-22 Sascha Schumann - - * (PHP_4_3) - ext/ircg/ircg.c - ext/ircg/ircg.c: - Fix for treating a NAMES list as single join - -2003-01-21 Moriyoshi Koizumi - - * ext/mbstring/php_mbregex.c: - Oops! wrong patch. Reverted. - - * ext/mbstring/php_mbregex.c: - Fixed mb_ereg_replace() bug (the function has ignored the default option) - - * tests/lang/bug21800.phpt: - Added test case for bug #21800 - - * ext/mbstring/php_mbregex.c: - Fixed mb_ereg_search() segfault that occurs when the function is called - before a string to be searched is passed by mb_ereg_search_init() - -2003-01-21 Andrey Hristov - - * ext/sysvshm/sysvshm.c: - increasing readability. - -2003-01-21 Ilia Alshanetsky - - * ext/odbc/birdstep.c: - getParameters -> zend_get_parameters_ex. - - * ext/fbsql/php_fbsql.c - ext/mbstring/mbstring.c - ext/standard/array.c - ext/standard/basic_functions.c - ext/standard/file.c - ext/standard/string.c - sapi/apache/php_apache.c - sapi/apache_hooks/php_apache.c: - ARG_COUNT(ht) -> ZEND_NUM_ARGS(). - -2003-01-21 Stig Bakken - - * pear/PEAR.php - pear/package-PEAR.xml: - - PEAR_Error now supports exceptions when using Zend Engine 2. Set the - error mode to PEAR_ERROR_EXCEPTION to make PEAR_Error throw itself - as an exception (invoke PEAR errors with raiseError() or throwError() - just like before). - -2003-01-21 Sascha Schumann - - * (PHP_4) - main/SAPI.h: - cvs server: warning: file `main/SAPI.h' seems to still contain conflict - indicators - - ..but it checks it in nevertheless. - - * main/SAPI.c - main/SAPI.h - sapi/apache/mod_php4.c: - add sapi_get_target_uid/_gid for obtaining information about the - non-privileged user the web server is running as. this is useful - for creating shared memory segments which need to be accessed by - the child processes/threads. - -2003-01-21 Jani Taskinen - - * (PHP_4_3) - sapi/apache2filter/config.m4: - MFH: Fixed bug: #21698, httpd.conf not modified with "make install" - - * sapi/apache2filter/config.m4: - Fixed bug: #21698, httpd.conf not modified with "make install" - - * ext/ircg/config.m4: - fix typo - - * (PHP_4_3) - ext/ircg/config.m4: - MFH: Fix bug: #21249, configure fails when searching for ircg-config script - - * ext/ircg/config.m4: - Fix bug: #21249, configure fails when searching for ircg-config script - -2003-01-21 Edin Kadribasic - - * sapi/embed/EXPERIMENTAL - sapi/embed/config.m4: - - Added missing warning about experimental nature of sapi/embed. - -2003-01-21 Pierre-Alain Joye - - * ext/gd/libgd/gd.c: - Remove the (c), in the future, can we add PHP Licence terms for the new - functions ? - - * ext/gd/libgd/gd.c: - Add credits to my functions (thx for the advice Wez&Ilia :) - -2003-01-20 Ilia Alshanetsky - - * ext/imap/php_imap.c - ext/imap/php_imap.h: - quota function fixes. Thanks Wez. - - * ext/imap/php_imap.c: - Changed php_error to php_error_docref. - Removed pointless memory allocation checks. - Memory leak fix inside quota functions. - -2003-01-20 Moriyoshi Koizumi - - * ext/pcre/php_pcre.c: - Fixed bug #21758 - -2003-01-20 Ilia Alshanetsky - - * ext/msession/msession.c: - Restore php_error -> php_error_docref patch. - -2003-01-20 Sascha Schumann - - * README.TESTING: - test commit - -2003-01-20 Derick Rethans - - * ext/standard/credits.c: - - Add credits for Magnus - -2003-01-20 Jani Taskinen - - * ext/gd/config.m4: - Add test for png.h - -2003-01-20 Mark L. Woodward - - * ext/msession/README - ext/msession/msession.c - ext/msession/php_msession.h - ext/msession/reqclient.h: - Updated for Msession 1.2. - Includes new APIs - -2003-01-19 Ilia Alshanetsky - - * ext/oracle/oracle.c: - ZTS fix. - -2003-01-19 Zeev Suraski - - * acinclude.m4 - configure.in: - relabel - -2003-01-19 Moriyoshi Koizumi - - * ext/standard/scanf.c: - Improved the patched part to prevent further potential bugs - -2003-01-19 Ilia Alshanetsky - - * ext/oracle/oracle.c: - fixed typos - -2003-01-19 Derick Rethans - - * README.TESTING: - - Moved to http://qa.php.net/write-test.php - -2003-01-19 Harald Radi - - * ext/standard/basic_functions.c - main/php_ini.c: - ini patch to allow 'entry[] = value' entries - -2003-01-19 Moriyoshi Koizumi - - * ext/standard/string.c - ext/standard/tests/strings/bug21744.phpt: - Fixed bug #21744(21741) - Added test case for the bug - -2003-01-19 Ilia Alshanetsky - - * ext/dbase/dbf_rec.c - ext/oci8/oci8.c - ext/oracle/oracle.c - ext/rpc/com/com.c - ext/rpc/com/conversion.c - ext/rpc/java/java.c - ext/w32api/w32api.c: - ZTS fixes. - - * ext/mcal/php_mcal.c: - Changed php_error to php_error_docref. - Make mcal compile with ZE2. - - * ext/dbase/dbf_rec.c - ext/dio/dio.c - ext/hwapi/hwapi.cpp - ext/ingres_ii/ii.c - ext/mime_magic/mime_magic.c - ext/oci8/oci8.c - ext/oracle/oracle.c - ext/ovrimos/ovrimos.c - ext/pcre/php_pcre.c - ext/pdf/pdf.c - ext/pfpro/pfpro.c - ext/posix/posix.c - ext/pspell/pspell.c - ext/recode/recode.c - ext/rpc/com/com.c - ext/rpc/com/com_wrapper.c - ext/rpc/com/conversion.c - ext/rpc/com/variant.c - ext/rpc/dotnet/dotnet.cpp - ext/rpc/java/java.c - ext/session/session.c - ext/snmp/winsnmp.c - ext/standard/filters.c - ext/sysvsem/sysvsem.c - ext/sysvshm/sysvshm.c - ext/w32api/w32api.c: - Changed php_error to php_error_docref. - -2003-01-18 Derick Rethans - - * ext/standard/credits.c: - s/4.4/5.0 - -2003-01-18 Ilia Alshanetsky - - * ext/bz2/bz2.c - ext/curl/interface.c - ext/cyrus/cyrus.c - ext/ircg/ircg.c - ext/ldap/ldap.c - ext/mnogosearch/php_mnogo.c - ext/msession/msession.c - ext/msql/php_msql.c - ext/mssql/php_mssql.c - ext/odbc/birdstep.c - ext/odbc/php_odbc.c - ext/sysvmsg/sysvmsg.c - ext/xslt/sablot.c: - Changed php_error to php_error_docref. - - Thanks to Marcus Börger for writing a script that significantly simplifies - this process. - - * ext/pcre/php_pcre.c: - Fixed bug #21732 (Added a sanity check, that prevents parameter mismatch). - - * ext/swf/swf.c - ext/xslt/sablot.c - ext/yp/yp.c - ext/zip/zip.c: - Changed php_error to php_error_docref. - - * ext/wddx/wddx.c - ext/yaz/php_yaz.c: - Removed pointless memory allocation checks. - Changed php_error to php_error_docref. - - * ext/bz2/bz2.c - ext/db/db.c - ext/dba/dba.c - ext/dbx/dbx.c - ext/dbx/dbx_odbc.c - ext/domxml/php_domxml.c - ext/fbsql/php_fbsql.c - ext/fdf/fdf.c - ext/hwapi/hwapi.cpp - ext/hyperwave/hw.c - ext/iconv/iconv.c - ext/informix/ifx.ec - ext/ingres_ii/ii.c - ext/interbase/interbase.c - ext/ldap/ldap.c - ext/mbstring/mbstring.c - ext/mbstring/php_mbregex.c - ext/mcal/php_mcal.c - ext/mcrypt/mcrypt.c - ext/mnogosearch/php_mnogo.c - ext/msql/php_msql.c - ext/mssql/php_mssql.c - ext/mysql/php_mysql.c - ext/oci8/oci8.c - ext/odbc/php_odbc.c - ext/openssl/openssl.c - ext/oracle/oracle.c - ext/ovrimos/ovrimos.c - ext/pdf/pdf.c - ext/pgsql/pgsql.c - ext/posix/posix.c - ext/pspell/pspell.c - ext/qtdom/qtdom.c - ext/session/session.c - ext/sockets/sockets.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/image.c - ext/standard/info.c - ext/standard/metaphone.c - ext/standard/string.c - ext/xml/php_xml.h - ext/xml/xml.c - ext/zlib/zlib.c - sapi/aolserver/aolserver.c - sapi/apache/php_apache.c - sapi/apache2filter/php_functions.c - sapi/apache_hooks/php_apache.c: - Removed pointless memory allocation checks. - -2003-01-18 Moriyoshi Koizumi - - * tests/lang/bug21094.phpt: - Added test case for bug #21094 - - * ext/standard/scanf.c: - WS - -2003-01-18 Marcus Boerger - - * ext/exif/exif.c: - correct my fault here and documnet the sense of the test - -2003-01-18 Moriyoshi Koizumi - - * ext/standard/tests/strings/bug21730.phpt: - - Fixed typo - - * ext/standard/tests/strings/bug21730.phpt: - Added test case for bug #21730 - -2003-01-18 Ilia Alshanetsky - - * ext/exif/exif.c: - Additional memory allocation fixes by Marcus Börger. - -2003-01-18 Moriyoshi Koizumi - - * ext/standard/scanf.c: - Tons of WS fixes - -2003-01-18 Ilia Alshanetsky - - * ext/exif/exif.c: - Removed the no longer needed memory allocation checks. - -2003-01-18 Moriyoshi Koizumi - - * ext/standard/scanf.c: - Fixed bug #21726 and #21730 - -2003-01-18 Andrey Hristov - - * ext/standard/basic_functions.c - ext/standard/php_var.h - ext/standard/var.c: - Renamed get_memory_usage() to memory_get_usage() (per Andi's advice) - This doesn't break any BC. - -2003-01-18 Wez Furlong - - * ext/standard/file.c: - Fix potential problem for 64-bit architectures. - -2003-01-18 Derick Rethans - - * ext/standard/file.c: - - Fixed memleak in fscanf(). - - * ext/standard/tests/general_functions/proc_open.phpt: - - Skip test if the function to test is not available - -2003-01-18 Jani Taskinen - - * (PHP_4_3) - ext/imap/config.m4 - ext/imap/php_imap.c: - MFH: Fix bug: #21687, imap extension does not include gss authentication - mechanism - - * ext/imap/config.m4 - ext/imap/php_imap.c: - Fix bug: #21687, imap extension does not include gss authentication - mechanism - -2003-01-17 Ilia Alshanetsky - - * ext/standard/tests/image/getimagesize.phpt: - Added missing test result. - -2003-01-17 Moriyoshi Koizumi - - * header: - Bump year. - - * win32/md5crypt.c: - WS fix - -2003-01-17 Ilia Alshanetsky - - * ext/gd/gd.c: - Removed pointless checks of array_init() return value. - -2003-01-17 Moriyoshi Koizumi - - * ext/standard/filters.c: - Fixed a quoted printable decoder so that it would conform to RFC2045. - -2003-01-17 Sascha Schumann - - * sapi/thttpd/thttpd.c - sapi/thttpd/thttpd_patch: - Fix POST handling once and for all. The daemon now never blocks and - handles - uploads of up to 2GB on 32 bit platforms. - - Uploads >16KB are put into a file-backed mmap area. - - SG(request_info).content_type got corrupted somewhere. As a workaround, - we provide SAPI with a duplicate of the original string. - -2003-01-17 Marcus Boerger - - * ext/standard/image.c - ext/standard/tests/image/image_type_to_mime_type.phpt - ext/standard/tests/image/test1pix.jp2: - fix jp2 detection and add testfile - -2003-01-17 Ilia Alshanetsky - - * ext/gd/gd.c - ext/gd/libgd/gd.c - ext/gd/libgd/gd.h - ext/gd/libgd/gd_gd2.c - ext/gd/libgd/gd_jpeg.c: - Syncronize bundled GD library with latest GD (2.0.11). - -2003-01-17 Derick Rethans - - * (PHP_4_3) - ext/standard/info.c: - - MFH: Fixed a bug that made that no newline was displayed when there was - no - value for a row. - - * ext/standard/info.c: - - Fixed a bug that made that no newline was displayed when there was no - value - for a row. - -2003-01-17 Andrey Hristov - - * ext/swf/swf.c: - Removed pointless checks around array_init(). - -2003-01-17 Ilia Alshanetsky - - * ext/imap/php_imap.c: - Fixed memory leaks in imap_get_quota & imap_get_quotaroot. - Removed pointless checks around array_init(). - -2003-01-17 Moriyoshi Koizumi - - * ext/standard/filters.c: - Significant speed enhancements. I was underestimating the power of recent - CPUs :) - -2003-01-17 Sebastian Bergmann - - * main/internal_functions_win32.c: - Move ZEND_ENGINE_2 check to where it is defined. - -2003-01-16 Harald Radi - - * main/config.w32.h - main/internal_functions_win32.c: - move the ZE2 check into internal_functions_win32.c - - * ext/bcmath/libbcmath/src/config.h: - revert previous commit - - * ext/bcmath/libbcmath/src/config.h: - unbreak the build - -2003-01-16 Ilia Alshanetsky - - * ext/pdf/pdf.c: - Fixed bug #21651 (crash in pdf_open_memory_image() when inserting a - non truecolor image). - -2003-01-16 Moriyoshi Koizumi - - * ext/standard/filters.c: - Finally fixed a qp encoder bug that line break characters that appear - exactly - at the end of the chunk lost in the output. - -2003-01-16 Marcus Boerger - - * ext/standard/tests/image/getimagesize.phpt - ext/standard/tests/image/image_type_to_mime_type.phpt: - - JPEG 2000 support - - * ext/standard/image.c - ext/standard/php_image.h: - - corrected error in file detection for very small files - - JPEG 2000 support, mostly Adam Wright - -2003-01-16 Harald Radi - - * ext/rpc/java/java.dsp: - change library name - - * ext/rpc/skeleton/php_skeleton.h - ext/rpc/skeleton/skeleton.c - ext/rpc/skeleton/skeleton.h: - update skeleton - - * win32/php4dllts.dsp: - fix path to config.w32.h - - * main/internal_functions_win32.c: - add COM - - * main/config.w32.h: - prevent HEAD + ZE1 builds and add COM - - * ext/rpc/com/com.dsp: - for those who prefer to have com as a shared lib - -2003-01-16 Sascha Schumann - - * (PHP_4) - configure.in - main/php_version.h: - Open up the PHP_4 branch which has been derived from the current PHP_4_3 - branch, so we don't introduce any ZE2-related changes. - - This branch has the purpose of housing experimental patches in the - context of PHP 4/ZE1. Patches which don't qualify as bug fixes - should not be committed to the PHP_4_3 branch. - - Note: The code on this branch is unlikely to be ever released in the form - of a standard PHP release. Commit new features to the HEAD branch! - Patches for this branch should be the exception. - - Note: The version is "4.5.0", because 4.4.0 has been used for some time - in HEAD before being switched to 5.0.0. I would have used something - like "4.X.X", but letters are not really supported by the current - system. - -2003-01-16 Harald Radi - - * ext/rpc/handler.h - ext/rpc/layer.h - ext/rpc/php_rpc.h - ext/rpc/rpc.c - ext/rpc/rpc.h - ext/rpc/com/com.c - ext/rpc/com/com.h - ext/rpc/com/php_com.h - ext/rpc/skeleton/skeleton.c - ext/rpc/skeleton/skeleton.h: - make layers loadable as self-sustaining php extension - which registeres itself in the rpc framework. - -2003-01-16 Dan Kalowsky - - * ext/odbc/php_odbc.h: - typo corrected - - * ext/odbc/php_odbc.c - ext/odbc/php_odbc.h: - Adding in test ability for WIndows to fetch_objects - -2003-01-16 Edin Kadribasic - - * ext/standard/math.c: - Fixed bug #21648 - -2003-01-16 Sascha Schumann - - * php.ini-dist - php.ini-recommended - ext/session/mod_files.c - ext/session/php_session.h - ext/session/session.c: - Add INI setting session.hash_bits_per_character which enables developers - to choose how session ids are represented, regardless of the hash - algorithm. - -2003-01-16 Ilia Alshanetsky - - * ext/oracle/oracle.c: - Fixed bug #20079 (made ora_logoff return TRUE on success). - -2003-01-15 Edin Kadribasic - - * win32/php_modules.dsw: - Added some missing modules. Removed some that are built in or moved to - ext/rpc. - -2003-01-15 Harald Radi - - * (PHP_4_3) - ext/rpc/.cvsignore - ext/rpc/CREDITS - ext/rpc/EXPERIMENTAL - ext/rpc/RPC_HOWTO - ext/rpc/handler.h - ext/rpc/hash.h - ext/rpc/layer.h - ext/rpc/php_rpc.h - ext/rpc/rpc.c - ext/rpc/rpc.h - ext/rpc/rpc_proxy.c - ext/rpc/rpc_proxy.h - ext/rpc/com/.cvsignore - ext/rpc/com/CREDITS - ext/rpc/com/TODO - ext/rpc/com/com.c - ext/rpc/com/com.h - ext/rpc/com/com_wrapper.c - ext/rpc/com/com_wrapper.h - ext/rpc/com/conversion.c - ext/rpc/com/conversion.h - ext/rpc/com/dispatch.c - ext/rpc/com/variant.c - ext/rpc/com/variant.h - ext/rpc/dotnet/.cvsignore - ext/rpc/dotnet/CREDITS - ext/rpc/dotnet/EXPERIMENTAL - ext/rpc/dotnet/README - ext/rpc/dotnet/dotnet.cpp - ext/rpc/dotnet/dotnet.dsp - ext/rpc/dotnet/dotnet.php - ext/rpc/dotnet/php_dotnet.h - ext/rpc/java/.cvsignore - ext/rpc/java/CREDITS - ext/rpc/java/EXPERIMENTAL - ext/rpc/java/Makefile.frag - ext/rpc/java/README - ext/rpc/java/config.m4 - ext/rpc/java/except.php - ext/rpc/java/java.c - ext/rpc/java/java.dsp - ext/rpc/java/jawt.php - ext/rpc/java/jver.php - ext/rpc/java/reflect.java - ext/rpc/skeleton/skeleton.c - ext/rpc/skeleton/skeleton.h - ext/rpc/tests/test1.php - ext/rpc/tests/test2.php - ext/rpc/tests/test3.php - ext/rpc/tests/test4.php - ext/rpc/tests/tests.php - ext/rpc/xmlrpc/.cvsignore - ext/rpc/xmlrpc/CREDITS - ext/rpc/xmlrpc/EXPERIMENTAL - ext/rpc/xmlrpc/config.m4 - ext/rpc/xmlrpc/php_xmlrpc.h - ext/rpc/xmlrpc/xmlrpc-epi-php.c - ext/rpc/xmlrpc/xmlrpc.dsp - ext/rpc/xmlrpc/libxmlrpc/.cvsignore - ext/rpc/xmlrpc/libxmlrpc/README - ext/rpc/xmlrpc/libxmlrpc/acinclude.m4 - ext/rpc/xmlrpc/libxmlrpc/base64.c - ext/rpc/xmlrpc/libxmlrpc/base64.h - ext/rpc/xmlrpc/libxmlrpc/encodings.c - ext/rpc/xmlrpc/libxmlrpc/encodings.h - ext/rpc/xmlrpc/libxmlrpc/queue.c - ext/rpc/xmlrpc/libxmlrpc/queue.h - ext/rpc/xmlrpc/libxmlrpc/simplestring.c - ext/rpc/xmlrpc/libxmlrpc/simplestring.h - ext/rpc/xmlrpc/libxmlrpc/system_methods.c - ext/rpc/xmlrpc/libxmlrpc/system_methods_private.h - ext/rpc/xmlrpc/libxmlrpc/xml_element.c - ext/rpc/xmlrpc/libxmlrpc/xml_element.h - ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.c - ext/rpc/xmlrpc/libxmlrpc/xml_to_dandarpc.h - ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.c - ext/rpc/xmlrpc/libxmlrpc/xml_to_soap.h - ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.c - ext/rpc/xmlrpc/libxmlrpc/xml_to_xmlrpc.h - ext/rpc/xmlrpc/libxmlrpc/xmlrpc.c - ext/rpc/xmlrpc/libxmlrpc/xmlrpc.h - ext/rpc/xmlrpc/libxmlrpc/xmlrpc.m4 - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.c - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection.h - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_private.h - ext/rpc/xmlrpc/libxmlrpc/xmlrpc_win32.h: - removing this stuff from the php 4.3 branch - -2003-01-15 Sascha Schumann - - * main/SAPI.h: - scrap STANDARD_SAPI_MODULE_PROPERTIES; it is causing more harm than good - -2003-01-15 Ilia Alshanetsky - - * ext/interbase/interbase.c: - More build fixes. - -2003-01-15 Wez Furlong - - * ext/standard/basic_functions.c - ext/standard/exec.h - ext/standard/proc_open.c - ext/standard/proc_open.h - ext/standard/tests/general_functions/proc_open.phpt: - Relieve scripts of the burden of ensuring that all pipes are closed prior - to calling proc_close(). - Implement proc_get_status(resource $process) which returns an array of - information about a process created with proc_open(). - The information includes: - array( - "command" => string "name of the command", - "pid" => long process identifier, - "running" => bool true if the process is still running - "exitcode" => long exitcode if the process exited - "signaled" => bool true if the process was signaled - "termsig" => long signal number if signaled - "stopped" => bool true if the process is stopped - "stopsig" => long signal number if stopped - ); - -2003-01-15 Ilia Alshanetsky - - * ext/informix/ifx.ec: - Fixed a typo. - -2003-01-15 Sebastian Bergmann - - * main/config.w32.h: - Define PHP_CAN_SUPPORT_PROC_OPEN. - - * win32/php4dll.dsp - win32/php4dllts.dsp: - Add proc_open.c to project. - -2003-01-15 Wez Furlong - - * ext/standard/basic_functions.c - ext/standard/config.m4 - ext/standard/exec.c - ext/standard/proc_open.c: - - Move proc_open code to a source file of it's own. - - Tidy up that netware mess by performing a configure check which will - define the symbol PHP_CAN_SUPPORT_PROC_OPEN if PHP can support - proc_open. - - Protected the proc_open specific code with #ifdef - PHP_CAN_SUPPORT_PROC_OPEN - so that user-space scripts can use function_exists and react - accordingly. - - ** Heads Up Win32: You need to add ext/standard/proc_open.c to the DSP and - ** #define PHP_CAN_SUPPORT_PROC_OPEN in the w32 config header. - -2003-01-15 Jani Taskinen - - * (PHP_4_3) - ext/session/mod_files.c: - MFH: handle ERANGE from strtol properly - -2003-01-15 Ilia Alshanetsky - - * ext/interbase/interbase.c: - Build fixes. - -2003-01-15 Moriyoshi Koizumi - - * ext/standard/filters.c: - Fixed a qp encoder bug that the constructor sometimes fails if - line-breaking mode is off. - -2003-01-15 Ilia Alshanetsky - - * ext/rpc/java/java.c: - Typo fixes. - - * ext/informix/ifx.ec: - Fixed typo. - - * ext/sybase/php_sybase_db.c - ext/sybase_ct/php_sybase_ct.c: - Various corrections. - - * ext/interbase/interbase.c: - Fixed typos. - - * ext/dbase/dbase.c: - Typo corrections. - -2003-01-15 Sascha Schumann - - * main/SAPI.c - main/SAPI.h: - whitespace - -2003-01-15 Yasuo Ohgaki - - * ext/pgsql/pgsql.c: - Fixed proto - -2003-01-15 Adam Dickmeiss - - * ext/yaz/php_yaz.c - ext/yaz/php_yaz.h: - Fix functions comments (connection resource rather than connection id). - New functions yaz_set_option and yaz_get_option. - Cleanup in yaz_connect. - - * ext/yaz/config.m4: - Fix lib config for the case where YAZ depends on multiple libraries - -2003-01-15 Ilia Alshanetsky - - * ext/interbase/interbase.c: - Kill compile warning. - - * ext/informix/ifx.ec - ext/interbase/interbase.c - ext/sybase/php_sybase_db.c - ext/sybase_ct/php_sybase_ct.c: - Newer parameter parsing API. - - * ext/hwapi/hwapi.cpp - ext/hyperwave/hw.c - ext/qtdom/qtdom.c - ext/rpc/dotnet/dotnet.cpp - ext/rpc/java/java.c - ext/snmp/winsnmp.c: - Getting rid of the old API parsing code. - - * ext/filepro/filepro.c: - Changed php_error to php_error_docref. - Made use of the more recent parameter parsing API, zend_get_parameters*. - - * ext/dbase/dbase.c: - Removed pointless checks around array_init() & ZE memory allocation macros. - Changed php_error to php_error_docref. - Dropped getParam* parameter parsing API in favor of zend_get_parameters*. - - * ext/cpdf/cpdf.c - ext/cpdf/php_cpdf.h: - This patch allows cpdf to be compiled in conjunction with ncurses, which - was - not possible before due to conflicting defines. - -2003-01-14 Ilia Alshanetsky - - * ext/rpc/xmlrpc/xmlrpc-epi-php.c: - Porting of patch applied to ext/xmlrpc. - - * ext/xmlrpc/xmlrpc-epi-php.c: - Made the code use php_error_docref(). - Removed pointless checks around array_init() and emalloc(). - Switched to zend_get_parameters_ex() argument parsing API. - - * ext/domxml/php_domxml.c: - Changed getParameters() to zend_get_parameters_ex(). - - * ext/hyperwave/hw.c: - Fixed compile warnings. - - * ext/cpdf/cpdf.c: - One more typo. - - * ext/cpdf/cpdf.c: - Fixed typos. - -2003-01-14 Moriyoshi Koizumi - - * ext/iconv/iconv.c: - Appended my name to the list of authors - - * ext/iconv/tests/iconv_mime_decode.phpt: - Test update for new feature - -2003-01-14 Ilia Alshanetsky - - * ext/cpdf/cpdf.c: - Switched from old getParse* argument parsing API to a more recent - zend_get_parameters*. - -2003-01-14 Andrey Hristov - - * ext/standard/basic_functions.c - ext/standard/php_var.h - ext/standard/var.c: - added function get_memory_usage(). available only when PHP is compiled - with --enable-memory-limit - -2003-01-14 Ilia Alshanetsky - - * ext/hyperwave/hg_comm.c: - Fixed compile warning & removed useless variable. - - * ext/hyperwave/hw.c: - Changed php_error to php_error_docref. - Got rid off the ancient getParameters* parameter parsing API. - -2003-01-14 Moriyoshi Koizumi - - * ext/standard/filters.c: - Added a new option "force-encode-first" to the quoted-printable encoder - as per Wez's request. If enabled, the encoder forcefully does qp - tranformation on every first character of lines in incoming stream. - -2003-01-14 Ilia Alshanetsky - - * ext/cpdf/cpdf.c: - Changed php_error() to php_error_docref(). - Made pdfdoc retrieval a macro. - -2003-01-14 Moriyoshi Koizumi - - * ext/standard/quot_print.c: - Made php_quot_print_decode() RFC2045-compliant - -2003-01-14 Edin Kadribasic - - * (PHP_4_3) - NEWS: - Bugfixing news - - * ext/gettext/gettext.dsp: - MFB: bind_textdomain_codeset() availability on windows - - * (PHP_4_3) - ext/gettext/gettext.dsp: - Made bind_textdomain_codeset() available on windows (fixes #21525). - -2003-01-14 Derick Rethans - - * win32/install.txt: - s/gd/gd2 - -2003-01-14 Ilia Alshanetsky - - * ext/sockets/sockets.c: - Changed php_error to php_error_docref(). - Removed pointless checks around array_init(). - -2003-01-14 Moriyoshi Koizumi - - * ext/standard/filters.c: - Fixed small memory leak that occurs when the invalid line length is passed - to the qprint ctor. - - * ext/standard/filters.c: - Fixed quoted-printable encoder so that it produces RFC2045 complicant - output. As per this specification requirement, the constructor now accepts - three options: binary (boolean), line-len (uint), line-break-chars - (string). - -2003-01-13 Jani Taskinen - - * ext/informix/config.m4 - ext/informix/config.m4: - Fixed bug: #21543, Informix version detection fails - -2003-01-13 Frank M. Kromann - - * ext/rpc/com/conversion.c: - false should be VT_FALSE - -2003-01-13 Moriyoshi Koizumi - - * (PHP_4_3) - tests/run-test/test008.phpt: - MFH - - * tests/run-test/test008.phpt: - Fixed typoFixed typoFixed typoFixed typoFixed typoFixed typoFixed typoFixed - typo - -2003-01-13 Andrey Hristov - - * ext/standard/array.c - ext/standard/basic_functions.c - ext/standard/php_array.h: - added array_combine(). - Creates an array by using the elements of the first parameter as keys and - the elements of the second as correspoding keys. Error is thrown in case - the arrays has different number of elements. Number of elements 0 is not - valid for both parameters. - -2003-01-13 Edin Kadribasic - - * sapi/servlet/servlet.dsp: - Adjust paths for the new location of ext/rpc/java - - * ext/rpc/java/java.dsp: - Adjust paths to the new location java.dsp - - * ext/rpc/xmlrpc/xmlrpc-epi-php.c: - Fix ZTS build here too. - - * ext/xmlrpc/xmlrpc-epi-php.c: - Fixed ZTS build. - -2003-01-13 Moriyoshi Koizumi - - * ext/standard/filters.c: - Fixed a silly segfault bug caused by lack of strict type checking - -2003-01-13 Sascha Schumann - - * build/buildcheck.sh: - which is not portable. use our bundled shtool instead. - -2003-01-13 Moriyoshi Koizumi - - * ext/standard/filters.c: - . Implemented a common filter parameter parsing function. - . Added automatic line-breaking feature for base64 encode filter. This - can be turned on by putting a option entry "base64-encode.line-length" - to the filter parameters. - -2003-01-13 Derick Rethans - - * ext/domxml/php_domxml.c: - - Fix ZTS build - -2003-01-12 Moriyoshi Koizumi - - * tests/lang/bug21600.phpt: - - Added test case for bug #21600 - - * ext/standard/filters.c: - Fixed a bug of the base64 decoder that a sequence of intervening - characters that are supposed to be ignored by the decoder cause output - corruption. - -2003-01-12 Stanislav Malyshev - - * ext/standard/aggregation.c: - ZE2 compatibility - -2003-01-12 Sebastian Bergmann - - * ext/standard/basic_functions.c - ext/standard/info.c: - ZTS fixes. - -2003-01-12 Stanislav Malyshev - - * ext/standard/aggregation.c: - Disable ZE2-incompatible parts - - * ext/standard/var.c: - remove unneeded var - -2003-01-12 Moriyoshi Koizumi - - * ext/standard/filters.c: - Fixed infinite loop bug when an invalid quoted-printable escape sequence - appears in the streem. - - * ext/standard/filters.c: - Fixed error msg format so it correctly reports the actual filter name - -2003-01-12 Sascha Schumann - - * php.ini-recommended: - recommending SHA-1 as hash function - - * php.ini-dist: - sync entries - - * php.ini-dist - php.ini-recommended - ext/session/php_session.h - ext/session/session.c: - add INI setting session.hash_function - add support for creating session ids using SHA-1 - source more entropy for session ids - - * ext/session/mod_files.c: - handle ERANGE from strtol properly - -2003-01-12 Moriyoshi Koizumi - - * ext/standard/filters.c: - . Updated quoted-printable filter by a neater implementation. - . Changed emalloc family functions to pemalloc ones for persistent - filters. - . Changed base64 and quoted-printable filter names to - "convert.base64-encode", - "convert.base64-decode", "convert.quoted-printable-encode", and - "convert.quoted-printable-decode" respectively for the consistency that - may be requested later. - -2003-01-12 Derick Rethans - - * NEWS: - - Update NEWS to show 5.0.0 - -2003-01-12 Jan Lehnardt - - * run-tests.php: - - fix typo - -2003-01-12 Sebastian Bergmann - - * ext/rpc/java/config.m4 - sapi/servlet/Makefile.frag - sapi/servlet/config.m4 - sapi/servlet/servlet.c - sapi/servlet/servlet.c - sapi/servlet/servlet.java: - Patch by Giuseppe Tanzilli . - -2003-01-12 Frank M. Kromann - - * ext/mssql/php_mssql.c: - Release skiped results. This will free memory on the server. - Make mssql_execute work for stored procedures with and without returning - result sets - -2003-01-11 Ilia Alshanetsky - - * ext/sybase_ct/php_sybase_ct.c: - Do not 'convert' double columns to integers after the 1st row in the result - set. - - * ext/sybase_ct/php_sybase_ct.c: - Fixed handling of NUMERIC type, when it contains numbers that could - potentially exceed the interger limit. - -2003-01-11 Moriyoshi Koizumi - - * ext/standard/browscap.c - ext/standard/datetime.c - ext/standard/file.c - ext/standard/formatted_print.c - ext/standard/pack.c - ext/standard/reg.c - ext/standard/string.c: - Reverted because correct decision has not been made yet. - - * sapi/apache2filter/php_functions.c: - This patch is likely to fix win32 build - - * ext/standard/browscap.c - ext/standard/datetime.c - ext/standard/pack.c - ext/standard/reg.c - ext/standard/string.c: - Reduced warnings in ZE2 build - - * ext/standard/file.c - ext/standard/formatted_print.c: - Reduced compiler warnings in ZE2 build - -2003-01-11 Ilia Alshanetsky - - * ext/standard/string.c: - Added stripos() & strripos() functions. - Added 3rd parameter (offset) to strrpos(). - -2003-01-11 Sebastian Bergmann - - * ext/rpc/rpc.c: - Add missing ,. - -2003-01-11 Harald Radi - - * ext/rpc/rpc.c - ext/rpc/rpc_proxy.c - ext/rpc/com/variant.c: - fix build - -2003-01-11 Sebastian Bergmann - - * win32/php4dllts.dsp: - Leftover. - -2003-01-11 Ilia Alshanetsky - - * sapi/cli/php_cli.c: - Fix the line numbering when the 1st line in the script is #!. - -2003-01-10 Harald Radi - - * main/config.w32.h - main/internal_functions_win32.c - win32/php4dllts.dsp: - HEAD defaults to build with ZE2 now - -2003-01-10 Frank M. Kromann - - * ext/mssql/php_mssql.c: - Fixing copy and paste errors - - * ext/mssql/php_mssql.c: - Avoid warnings when running stored procedures returning multiple results - before setting output and return values. - Additional results can be skipped by the optional parameter to - mssql_execute - -2003-01-10 Christian Stocker - - * ext/domxml/php_domxml.c: - Throw error if object is not a XML_DOCUMENT_NODE in domxml_dump_node() - - * (PHP_4_3) - ext/domxml/php_domxml.c: - Throw error if object is not a XML_DOCUMENT_NODE - -2003-01-10 Wez Furlong - - * ext/standard/math.c: - Fix the number format fix when the number of decimal places is 0. - -2003-01-10 Derick Rethans - - * ext/xmlrpc/xmlrpc-epi-php.c: - - Fixed bug #20155: xmlrpc compile problem with zendengine2 (Path by Jan - Schneider) - -2003-01-10 Moriyoshi Koizumi - - * ext/mime_magic/mime_magic.c - ext/standard/reg.c: - Reduced compiler warnings - - * ext/iconv/iconv.c: - Added missing cast operators - -2003-01-10 Ilia Alshanetsky - - * ext/gd/libgd/gd.c: - Fixed ImageRotate when rotation angle is 90 degrees, patch by - leon@leonatkinson.com. - -2003-01-10 Stig Bakken - - * (RELEASE_1_0_1) - pear/package-PEAR.xml: - - prepare 1.0.1 release - -2003-01-10 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - -2003-01-10 Stig Bakken - - * (RELEASE_1_0_1) - pear/scripts/pear.in: - - obey PHP_PEAR_INSTALL_DIR and PHP_PEAR_PHP_BIN environment variables - - * (RELEASE_1_0_1) - pear/PEAR/Command/Package.php: - - verbosity fix for cvstag and cvsdiff commands - - * (RELEASE_1_0_1) - pear/OS/Guess.php: - - TODO item - - * pear/PEAR/Command/Package.php: - - add "cvsdiff" command - - * (RELEASE_1_0_1) - pear/PEAR/Config.php: - - use getenv() instead of $_ENV[] - -2003-01-09 Ilia Alshanetsky - - * ext/standard/file.c: - CS fixes - - * ext/standard/file.c: - Fixed a memory corruption that occurs when an unterminated " is encountered - this bug maybe be related to #21556. - -2003-01-09 Frank M. Kromann - - * ext/mssql/config.m4: - Adding extended checks for where FreeTDS is installed - -2003-01-09 Ilia Alshanetsky - - * main/safe_mode.c: - Fixed compiler warnings. - -2003-01-09 Sara Golemon - - * ext/standard/filestat.c - main/safe_mode.c - main/safe_mode.h: - Bug #21531 file_exists() and other filestat functions throw errors when - in safe mode and file/directory does not exist. - Extended php_checkuid function to add "flags" field via rename to - php_checkuid_ex with alias for BC in functions that do want safe mode - errors thrown. - -2003-01-09 Moriyoshi Koizumi - - * ext/ctype/ctype.c: - Fixed typo - -2003-01-09 Wez Furlong - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/formatted_print.c - tests/strings/002.phpt: - Implement fprintf() and vfprintf(). - Add a couple of tests. - -2003-01-09 Sebastian Bergmann - - * (PHP_4_3) - main/.cvsignore - main/config.w32.h - main/config.w32.h.in - win32/php4dll.dsp - win32/php4dllts.dsp: - MFH: Revert config.w32.h.in -> config.w32.h build step. - -2003-01-09 Jani Taskinen - - * configure.in: - Fix bug: #21511, config.status warning - -2003-01-09 Wez Furlong - - * ext/standard/math.c - ext/standard/tests/math/bug21523.phpt: - Fix Bug #21523 - number_format could cause a memory allocation for a - negative memory size in situations where the sprintf implementation of the - host system generated less decimal places than were requested. - - Resolved this issue by making number_format examine the string returned - by spprintf and have it pad to the correct number of decimal places. - - Added a test-case based on the bug report; the length of decimal places - required to trigger this bug is sprintf implementation dependent; as the - implementation is now using spprintf (provided by PHP), that number is - 78 digits (NDIG - 2). - - - -2003-01-09 Stig Bakken - - * (RELEASE_1_0_1) - pear/PEAR.php: - - added debug_backtrace() support to PEAR errors - - * (RELEASE_1_0_1) - pear/System.php: - - System::which() now checks .exe .bat .cmd and .com on Windows - - * (RELEASE_1_0_1) - pear/PEAR/Frontend/CLI.php: - - cleanups - -2003-01-09 Zeev Suraski - - * configure.in - main/php_version.h: - Time for an update - -2003-01-09 Frank M. Kromann - - * ext/mssql/php_mssql.c: - Use the correct link when checking for more results on stored procedures - - * ext/mssql/php_mssql.c - ext/mssql/php_mssql.h: - Restire BC for mssql_execute(). This will not break the new feature for - handling - multiple results from a single stired procedure. - Adding mssql_free_statement() - -2003-01-09 Ilia Alshanetsky - - * ext/standard/fsock.c: - Fixed bug #21529 (memory corruption by fsockopen()). - -2003-01-09 Frank M. Kromann - - * ext/mssql/php_mssql.c: - changed from LVAL to RESVAL macro - -2003-01-09 Jani Taskinen - - * ext/standard/image.c: - Fix the ZTS build. - -2003-01-08 Moriyoshi Koizumi - - * ext/standard/filters.c: - Reimplemented base64 filter to use iconv()-like facility for flexibility. - -2003-01-08 Frank M. Kromann - - * ext/fbsql/php_fbsql.h - ext/mssql/php_mssql.c - ext/mssql/php_mssql.h: - Changed global data type to avoid problems with initialization - -2003-01-08 Ilia Alshanetsky - - * ext/standard/image.c - ext/standard/php_image.h: - Added support for WBMP images. - - * ext/gd/gd.c - ext/gd/libgd/gd_io_dp.c: - Fixed bug #21518. - Fixed memory in leak ImageCreateFromString(). - Fixed a bug that prevented proper identification of WBMP images and thus - prevented ImageCreateFromString() from working on those images. - - * (PHP_4_3) - NEWS: - Bug fixing news. - -2003-01-08 Zeev Suraski - - * ext/session/session.c: - Fix UMR - -2003-01-08 Georg Richter - - * (PHP_4_3) - ext/mysql/php_mysql.c: - fixed bug 21498 - - * ext/mysql/php_mysql.c: - fixed bug #21498 - -2003-01-08 Ilia Alshanetsky - - * ext/mcrypt/mcrypt.c: - Removed unused variable. - - * main/main.c: - Fixed bug #21499 (more descriptive message in the event of require/include - failure). - - * sapi/cgi/cgi_main.c - sapi/cli/php_cli.c: - Fixed bug #21297. The fix also fixes miscalculation of lines numbers by 1 - due the previously mentioned bug. - - * ext/odbc/php_odbc.c: - Version is char ;). - -2003-01-07 Christian Dickmann - - * pear/PEAR/Config.php: - fix default umask(); (thx to Mirco MEEBEY Bauer for bringing this behavior - to my attention and testing the patch) - -2003-01-07 Dan Kalowsky - - * ext/odbc/php_odbc.c: - Version tag for future move to PECL - - * ext/odbc/config.m4 - ext/odbc/php_odbc.c: - Reverting last change as it really doesn't fix longreadlen problems in all - cases. - -2003-01-07 Moriyoshi Koizumi - - * ext/standard/filters.c: - Instances should not be freed in dtor()... - - * ext/standard/filters.c: - Made error msg format more consistent - -2003-01-07 Pierre-Alain Joye - - * ext/gd/gd.c: - Fix line drawed twice (L. Atkinson) - -2003-01-07 Sara Golemon - - * ext/standard/user_filters.c: - Backout changes between 1.6 and 1.7 - -2003-01-07 Zeev Suraski - - * sapi/cgi/cgi_main.c: - Add missing call - -2003-01-07 Levi Dixon - - * ext/oci8/config.m4 - ext/oci8/oci8.c: - Added support for Shared Data Mode for OCI8_VERSION >= 8.1, which will - provide memory savings by sharing common statement data - -2003-01-07 Edin Kadribasic - - * (PHP_4_3) - NEWS: - Bugfix #17098 in the branch - - * (PHP_4_3) - sapi/apache2filter/sapi_apache2.c: - MFH: - Fixed bug #17098 (make Apache aware that PHP scripts represent dynamic - data - and should not be cached). Fix suggested by daniel.eckl@gmx.de. - -2003-01-07 Ilia Alshanetsky - - * run-tests.php: - Added a check for availability of PCRE extension needed by test-suite. - -2003-01-07 Vincent Blavet - - * pear/Archive/Tar.php: - - Synchronize with /pear/Archive_Tar/Tar.php 1.5 : - - Add support for long filenames (greater than 99 characters) - - Add private methods _readLongHeader() and _writeLongHeader() - -2003-01-07 Ilia Alshanetsky - - * ext/domxml/php_domxml.c: - Fixed ZTS build with ZE2. - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c: - ZTS cleanup. - -2003-01-07 Zeev Suraski - - * ext/standard/basic_functions.c: - whitespace - -2003-01-07 Edin Kadribasic - - * (PHP_4_3) - NEWS: - Bugfixing news - - * win32/sendmail.c: - MFB: - Fixed bug #21442 (Crash of mail() on Windows when the first parameter - is empty). - - * (PHP_4_3) - win32/sendmail.c: - Fixed bug #21442 (Crash of mail() on Windows when the first parameter - is empty). - -2003-01-07 Sascha Schumann - - * ext/mysql/config.m4: - tell user which header files could not be found - -2003-01-07 Moriyoshi Koizumi - - * ext/standard/user_filters.c: - Fixed small leak - -2003-01-07 Frank M. Kromann - - * ext/mssql/config.m4: - Making the mssql extension work when build as a shared object - -2003-01-07 Ilia Alshanetsky - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c: - Fixed ZTS build. - - * ext/ftp/ftp.c - ext/ftp/php_ftp.c: - MFB + CS - - * (PHP_4_3) - ext/ftp/ftp.c - ext/ftp/php_ftp.c: - Changed perror() to php_error_docref(), fixed bug #21309. - Made extension use ZE memory allocation wrappers, fixed a memory leak in - ftp_mkdir. - Removed duplicate ftp_syst() call inside ftp_systype(). - - -2003-01-07 Moriyoshi Koizumi - - * NEWS: - Trivial grammer fix - - * ext/standard/filters.c: - Implemented quoted-printable stream filter - -2003-01-07 Sara Golemon - - * ext/standard/user_filters.c: - Add option to stream_get_filters() user-defined fiters vs. all filters, - default to user only - -2003-01-07 Moriyoshi Koizumi - - * ext/standard/filters.c: - Implemented string.base64 stream filter - -2003-01-06 Stefan Esser - - * main/rfc1867.c: - Adding support for anonymous fileuploads (#21450) - -2003-01-06 Wez Furlong - - * main/streams.c: - Fix for Bug #20827: where stat is a macro on Tru64. - Patch from - -2003-01-06 Ilia Alshanetsky - - * ext/standard/string.c - ext/standard/tests/strings/bug21453.phpt: - Fixed bug #21453 (improper handling of non-terminated <). - - * ext/standard/browscap.c: - Fixed Bug #21443 and related bug #21468. - -2003-01-06 Dan Kalowsky - - * ext/odbc/php_odbc.c: - Patch for bug #19349 - - * ext/odbc/php_odbc.c: - Correction for bug #21279 - -2003-01-06 Moriyoshi Koizumi - - * ext/iconv/iconv.c - ext/standard/quot_print.c - ext/standard/quot_print.h: - Moved php_quot_print_decode() to quot_print.c so that it can be used - outside the iconv module - - * ext/iconv/iconv.c: - Added more RFC2047-compliancy check in iconv_mime_decode() - - * ext/iconv/iconv.c: - Fixed iconv_mime_decode() so that it comforms to RFC2231 - -2003-01-06 Georg Richter - - * ext/mysql/php_mysql.c: - fixed missing & (Thx to Sebastian Bergmann) - - * (PHP_4_3) - ext/mysql/php_mysql.c: - fixed a missing & (Thx to Sebastian Bergmann - -2003-01-06 Wez Furlong - - * ext/standard/tests/file/userfilters.phpt: - Make it slightly more obvious that the return value is relative to the - length - of the input data. - - * main/php_streams.h: - Fix for bug #21406; infinite loop during filter flushing. - -2003-01-06 Edin Kadribasic - - * (PHP_4_3) - NEWS: - Bugfixing news. - - * ext/gd/gd_bundled.dsp: - MFB: - Fixed bug #20503 (imagesetbrush() availability on windows). - - * (PHP_4_3) - ext/gd/gd_bundled.dsp: - Fixed bug #20503 (imagesetbrush() availability on windows). - -2003-01-06 Anantha Kesari H Y - - * ext/pgsql/php_pgsql.h: - Removed #ifdef NetWare and made the necessary changes in the directory - structure of NetWare. - - * netware/libpq/libpq-fs.h: - Header file for PostgreSQL. Moved from netware directory to netware/libpq - directory. - - * netware/libpq-fs.h: - This file moved to netware/libpq directory. - -2003-01-06 Christian Stocker - - * (PHP_4_3) - ext/domxml/php_domxml.c: - - fix crash in domxml_node_insert_before() (by Lukas Schröder) - - * ext/domxml/php_domxml.c - ext/domxml/php_domxml.h: - - get_path forgotten in .h file - - fix crash in domxml_node_insert_before() (by Lukas Schröder) - -2003-01-06 Anantha Kesari H Y - - * netware/phplib.imp: - Added symbols to build PostgreSQL extension for NetWare. - - * ext/mysql/mysql.mak: - Changes for NetWare makefile. - - * ext/pgsql/pgsql.mak - ext/pgsql/php_pgsql.h: - Makefile added newly and modified the header file for NetWare. - -2003-01-06 Christian Stocker - - * (PHP_4_3) - ext/domxml/php_domxml.c: - partly MFH from 1.288 (Fixed segfault, when trying to add a node to itself) - - * ext/domxml/php_domxml.c: - - Fixed segfault, when trying to add a node to itself. - -2003-01-06 Anantha Kesari H Y - - * ext/standard/basic_functions.c: - Added #ifdef HAVE_SYSLOG_H around syslog function in the whole file to - avoid link failure. - - * netware/phplib.mak: - Modified for Netware. - -2003-01-06 Sara Golemon - - * ext/standard/filters.c: - Added string.toupper and string.tolower filters and generalized non-op - filter methods - -2003-01-06 Frank M. Kromann - - * ext/gd/libgd/gdft.c: - Nuke warning, on Win32 build - - * ext/gd/gd_bundled.dsp: - enable imageftbbox() and imagefttext() on WIn32 - -2003-01-06 Sara Golemon - - * ext/standard/user_filters.c - main/php_streams.h - main/streams.c: - Expose stream_filters_hash so that it can be searched by - stream_get_filters() - -2003-01-06 Edin Kadribasic - - * (PHP_4_3) - NEWS: - Mention gif read-only support on windows. - - * (PHP_4_3) - ext/gd/gd_bundled.dsp: - MFH: Added missing flags and .c files for gif read support on Windows. - - * ext/gd/gd_bundled.dsp: - Complete gif readonly support addition by adding missing gd_gif_in.c - file to the project. - - * ext/mcrypt/mcrypt.c: - Comment out non ANSI C standard comliant code. Fixes win32 build. - - * ext/dba/dba.c: - Fixed win32 build. - -2003-01-06 Ilia Alshanetsky - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/gd/libgd/gd.h - ext/gd/libgd/gdft.c: - Fixed bug #21445. - -2003-01-05 Sara Golemon - - * ext/standard/file.c - ext/standard/user_filters.c: - Fixes to stream_get_wrappers() and stream_get_filters() handle hash table - layouts better, plus some picune whitespace fixes - -2003-01-05 Georg Richter - - * ext/mysql/php_mysql.c: - fixed bug #21435 - -2003-01-05 Sebastian Bergmann - - * ext/gd/gd_bundled.dsp: - Define HAVE_GD_GIF_READ. - -2003-01-05 Zeev Suraski - - * main/main.c: - Remove unnnecessary initialization - - * sapi/cgi/cgi_main.c - sapi/cli/php_cli.c: - Initialize lineno using the new infrastructure - -2003-01-05 Sebastian Bergmann - - * main/.cvsignore - main/config.w32.h - main/config.w32.h.in - win32/php4dll.dsp - win32/php4dllts.dsp: - Revert config.w32.h.in -> config.w32.h build step per discussion with Zeev. - -2003-01-05 Zeev Suraski - - * sapi/apache/php4apache.dsp: - Make the .dsp use the php4build build directories - -2003-01-05 Edin Kadribasic - - * ext/xslt/xslt.dsp: - MFB: - Made xslt_set_encoding() available on windows (bug #20640). - - * (PHP_4_3) - ext/xslt/xslt.dsp: - Made xslt_set_encoding() available on windows (bug #20640). - - * (PHP_4_3) - ext/standard/php_incomplete_class.h: - Fixed ZTS build. - -2003-01-05 Ilia Alshanetsky - - * ext/standard/string.c: - Fixed a memory leak in setlocale() & localeconv(). - -2003-01-05 Sara Golemon - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/user_filters.c: - Added stream_get_filters(); to list registered filters - -2003-01-05 Derick Rethans - - * ext/standard/filestat.c: - - Fix some of the netware crap - -2003-01-04 Derick Rethans - - * ext/standard/filestat.c: - - Change Warnings to Notices - -2003-01-04 Ilia Alshanetsky - - * ext/openssl/openssl.c: - CS fixes. - -2003-01-04 Marcus Boerger - - * (PHP_4_3) - ext/standard/browscap.c - ext/wddx/wddx.c: - Fix ZTS-ZE2 (After Cygwin now for the rest) - - * ext/exif/tests/exif003.phpt - ext/exif/tests/exif004.phpt: - better to check for existance first - - * ext/dbx/dbx.c - ext/imap/php_imap.c - ext/standard/browscap.c - ext/standard/incomplete_class.c - ext/standard/php_incomplete_class.h - ext/standard/var_unserializer.c - ext/wddx/wddx.c: - Fix ZTS-ZE2 build - -2003-01-04 Moriyoshi Koizumi - - * NEWS: - Forgot to include these functions in the list - -2003-01-04 Derick Rethans - - * NEWS: - - Fix typo - -2003-01-04 Moriyoshi Koizumi - - * ext/iconv/iconv.c: - Fixed cut'n'paste failure - - * NEWS: - NEWS update for new iconv functions - - * ext/iconv/tests/iconv_mime_encode.phpt: - Added test case for iconv_mime_encode() - -2003-01-04 Derick Rethans - - * (PHP_4_3) - ext/pgsql/pgsql.c: - - MFH: Fixed bug #21232 (Unresolved references to PQsetnonblocking). (Patch - by - Floyd ) - - * ext/pgsql/pgsql.c: - - Fixed bug #21232 (Unresolved references to PQsetnonblocking). (Patch by - Floyd ) - -2003-01-03 Alex Waugh - - * acinclude.m4: - Provide alternative for glibc brokenness test when cross compiling - -2003-01-03 Derick Rethans - - * sapi/apache/php_apache.c - sapi/apache/php_apache.c: - - Fix docrefs - - * sapi/apache/php_apache.c: - - Fix typo (patch by Joseph Tate) - -2003-01-03 Moriyoshi Koizumi - - * ext/iconv/tests/iconv_mime_decode.phpt: - Added test case for iconv_mime_decode() - - * ext/iconv/tests/iconv_strpos.phpt - ext/iconv/tests/iconv_strrpos.phpt: - Added test cases for iconv_strpos() and iconv_strrpos() - - * ext/iconv/iconv.c: - Fixed an iconv_strrpos() bug that the function doesn't return accurate - position of last occurrence - -2003-01-03 Derick Rethans - - * ext/mcrypt/TODO: - - Update todo - - * ext/mcrypt/config.m4 - ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: - - Removed support for libmcrypt 2.2.x to allow cleaner code. Another reason - to upgrade libmcrypt to a 2.5.x series as the older ones have too much - bugs - to be safely used with PHP. - - Updated macro's, php_errors and parameter parsing. - -2003-01-03 Ilia Alshanetsky - - * ext/standard/file.c: - Fixed a bug that would cause flock() to never set the 3rd argument. - CS fixes & switched to new parameter parsing API. - - * (PHP_4_3) - ext/standard/http_fopen_wrapper.c: - MFH (fix for bug #21267 & memory leak fix on reidrects). - - * ext/standard/http_fopen_wrapper.c: - Fixed a memory leak that occurs if the location specified by redirect - header - cannot be opened. - - * ext/standard/http_fopen_wrapper.c: - Further fixes related to bug #21267. - -2003-01-03 Anantha Kesari H Y - - * sapi/apache2filter/php_apache.h - sapi/apache2filter/sapi_apache2.c: - Modifications for NetWare. - - * netware/phplib.imp - netware/phplib.mak - netware/sendmail.c - netware/sendmail.h: - Some existing files modified and a couple of files removed for NetWare. - - * win32/sendmail.c - win32/sendmail.h: - NetWare related changes/modifications. - -2003-01-03 Moriyoshi Koizumi - - * ext/iconv/iconv.c: - Added offset validity check for iconv_strpos() - -2003-01-03 Anantha Kesari H Y - - * ext/xml/xml.mak - netware/geterrnoptr.c - netware/sendmail_nw.h - sapi/apache/libpre.c: - New file added for NetWare. - - * ext/ftp/ftp.c - ext/ldap/ldap.mak - ext/ldap/ldap.mak - ext/mysql/mysql.mak - ext/mysql/mysql.mak - ext/session/mod_files.c - ext/session/session.c - ext/standard/exec.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/html.c - ext/standard/syslog.c - ext/xml/xml.mak - netware/buildlib.bat - netware/phplib.mak: - Modified for NetWare. - - * main/config.nw.h - main/internal_functions_nw.c - main/php.h - main/php_sprintf.c - main/user_streams.c: - A new file added and some old files modified for NetWare. - -2003-01-03 Edin Kadribasic - - * netware/ApacheCore.imp - netware/BisonExtStandard.bat - netware/BisonFlexZend.bat: - Checking in files for Ananth Kesari - -2003-01-03 Anantha Kesari H Y - - * netware/ZendEngine2.mak - netware/grp.h - netware/libpq.imp - netware/mktemp.c - netware/param.h - netware/php-nw.bat - netware/php4apache.mak - netware/php4apache2filter.mak - netware/php4cli.mak - netware/phplib.imp - netware/phplib.mak - netware/phptest.ncf - netware/pipe.c - netware/pipe.h - netware/postgres_ext.h - netware/pwd.c - netware/pwd.h - netware/start.c - netware/sysexits.h - netware/time_nw.c - netware/time_nw.h - netware/tsrm.mak - netware/wfile.c - netware/wfile.h - netware/zend.mak: - A few New files added and some old files modified for NetWare. - - * netware/libpq-fe.h - netware/libpq-fs.h: - New files added for NetWare. - - * netware/common.mif - netware/sys/stat.h: - File modified for NetWare. - -2003-01-03 Derick Rethans - - * ext/standard/credits_sapi.h: - - Update this one as well - - * ext/standard/credits_ext.h - scripts/credits: - - Remove double "Win32 COM" functions line - - * README.PARAMETER_PARSING_API: - - Whitespace - - * (PHP_4_3) - NEWS: - Bugfixing news - -2003-01-03 Sara Golemon - - * ext/standard/basic_functions.c - ext/standard/file.c - ext/standard/file.h: - Added stream_get_wrappers() - -2003-01-03 Moriyoshi Koizumi - - * ext/iconv/tests/iconv_strlen.phpt - ext/iconv/tests/iconv_substr.phpt: - Added test cases for iconv_strlen() and iconv_substr() - - * ext/iconv/iconv.c: - Fixed iconv_mime_decode() so it would give more awareness to stateful - codesets - - * ext/iconv/iconv.c: - Fixed infinite loop of iconv_mime_encode() in case the specified line - length is too short to contain a proper mime-encoded string - - * ext/iconv/iconv.c: - Give mo' shift-sequence awareness to iconv_mime_encode - - * ext/iconv/iconv.c: - More shift-sequence awareness for iconv_substr() - - * ext/iconv/iconv.c: - Added missing casting operators - - * ext/iconv/tests/eucjp2iso2022jp.phpt: - MFB - - * (PHP_4_3) - ext/iconv/tests/eucjp2iso2022jp.phpt: - Updated the test so it reflects the recent change on iconv.c - - * ext/iconv/iconv.c: - MFB: fixed shift-out sequence unawareness issue - - * (PHP_4_3) - ext/iconv/iconv.c: - Fixed shift-out sequence unawareness issue - - * ext/standard/array.c: - Fixed small leaks in array_map() in case the first parameter is NULL like - array_map(NULL, array(...)); - -2003-01-03 Harald Radi - - * pear/scripts/pear.bat: - fixing typo - -2003-01-03 Jani Taskinen - - * NEWS: - - Removed entries that are going to 4.3.1 - - Grouped the entries a bit. - - * (PHP_4_3) - NEWS: - Group these entries a bit to make NEWS easier to read. - -2003-01-02 Stig Bakken - - * pear/PEAR/Config.php: - - allways fall back to PHP_SYSCONFDIR - -2003-01-02 Ilia Alshanetsky - - * ext/openssl/openssl.c: - Fixed a small memory leak when a NULL variable is passed to - openssl_csr_sign() as the first argument. - - * (PHP_4_3) - NEWS: - Bug fixing news. - - * ext/standard/html.c: - Fixed bug #21338 (crash inside html_entity_decode() when "" is passed). - Added test case for the bug. - - * ext/standard/tests/strings/bug21338.phpt: - - Fixed bug #21338 (crash inside html_entity_decode() when "" is passed). - Added test case for the bug. - - * acinclude.m4 - configure.in: - Raise required OpenSSL version to 0.9.6. - -2003-01-02 Derick Rethans - - * main/SAPI.h: - - Fixed bug #21169: Compile Failure, and lots of warnings on UnixWare - - * (PHP_4_3) - main/SAPI.h: - -** empty log message *** - -2003-01-02 Zeev Suraski - - * sapi/apache/php4apache.dsp: - Fix .dsp - -2003-01-02 Derick Rethans - - * main/php_streams.h: - - Fix warnings on UnixWare - - * (PHP_4_3) - Makefile.global: - - MFH: Fix "make test" when CC was set to something with a parameter - - * Makefile.global: - - Fix "make test" when CC was set to something with a parameter - -2003-01-01 Frank M. Kromann - - * ext/standard/base64.c - ext/standard/base64.h: - Allow base64 functions to be called from an extension buils as .so/.dll - (iconv) - -2003-01-01 Zeev Suraski - - * ext/standard/browscap.c - ext/standard/incomplete_class.c: - build fixes - -2003-01-01 Derick Rethans - - * (PHP_4_3) - tests/run-test/test005.phpt - tests/run-test/test008.phpt: - - MFH: Fix tests if Zend Optimizer is loaded - - * tests/run-test/test005.phpt - tests/run-test/test008.phpt: - - Fix tests if Zend Optimizer is loaded - -2003-01-01 Sebastian Bergmann - - * win32/php4dll.dsp - win32/php4dllts.dsp: - Add filter.c, user_filters.c. Group stream related sources. - - * ext/standard/filters.c - ext/standard/user_filters.c: - Fix warnings. - -2003-01-01 Wez Furlong - - * ext/standard/filters.c: - Tidy up - - * ext/standard/basic_functions.c - ext/standard/config.m4 - ext/standard/filters.c - ext/standard/php_standard.h - ext/standard/php_string.h - ext/standard/string.c - ext/standard/user_filters.c - ext/standard/tests/file/userfilters.phpt: - Move rot13 filter into a new filters.c source file. - Tidy up some other filter related code. - - - * acinclude.m4 - configure.in - main/streams.c: - Workaround for glibc 2.2.9x and later "a+" bug that does not seek to EOF - for - files fopen()ed with that mode. - - * (PHP_4_3) - acinclude.m4 - configure.in - main/streams.c: - Workaround a bug in glibc 2.2.9x and later that causes it not to seek to - EOF - for stdio streams opened with a mode of "a+". - diff --git a/ChangeLog.1999.gz b/ChangeLog.1999.gz deleted file mode 100644 index 9d92dda73f..0000000000 Binary files a/ChangeLog.1999.gz and /dev/null differ diff --git a/ChangeLog.2000.gz b/ChangeLog.2000.gz deleted file mode 100644 index 91cd3b2425..0000000000 Binary files a/ChangeLog.2000.gz and /dev/null differ diff --git a/ChangeLog.2001.gz b/ChangeLog.2001.gz deleted file mode 100644 index 4f0a6f8241..0000000000 Binary files a/ChangeLog.2001.gz and /dev/null differ diff --git a/ChangeLog.2002.gz b/ChangeLog.2002.gz deleted file mode 100644 index 6a8c3bea44..0000000000 Binary files a/ChangeLog.2002.gz and /dev/null differ diff --git a/EXTENSIONS b/EXTENSIONS deleted file mode 100644 index 57a608c523..0000000000 --- a/EXTENSIONS +++ /dev/null @@ -1,492 +0,0 @@ - List of PHP maintainers - ======================= - -Maintenance legend ------------------- - Supported: Someone is actually paid to look after this. - Maintained: Someone actually looks after it. - Odd Fixes: It has a maintainer but they don't have time to do - much other than throw the odd patch in. See below. - Orphan: No current maintainer [but maybe you could take the - role as you write your new code]. - Obsolete: Old code. Something tagged obsolete generally means - it has been replaced by a better system and you - should be using that. - Unknown: Not known at this time. - -Status legend -------------- - Working: Working under both Windows and Unix. - Windows: Working only under Windows. - Unix: Working only under Unix. - Experimental: Under development or initial release. - Not Working: Not working. - Unknown: Status unknown. - - -== Server APIs == - -------------------------------------------------------------------------------- -EXTENSION: aolserver -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: apache -PRIMARY MAINTAINER: Rasmus Lerdorf -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: apache2 -PRIMARY MAINTAINER: Aaron Bannert -MAINTENANCE: Maintained -STATUS: Experimental -------------------------------------------------------------------------------- -EXTENSION: cgi -MAINTENANCE: Unknown -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: fhttpd -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: isapi -MAINTENANCE: Unknown -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: nsapi -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: phttpd -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: pi3web -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: roxen -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: servlet -PRIMARY MAINTAINER: Sam Ruby -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: thttpd -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: webjames -PRIMARY MAINTAINER: Alex Waugh -MAINTENANCE: Maintained -STATUS: Experimental -------------------------------------------------------------------------------- - - -== Database extensions == - -------------------------------------------------------------------------------- -EXTENSION: dba -PRIMARY MAINTAINER: Marcus Börger -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: dbase -PRIMARY MAINTAINER: Jim Winstead -MAINTENANCE: Odd Fixes -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: dbx -PRIMARY MAINTAINER: Marc Boeren -MAINTENANCE: Maintained -STATUS: Working -SINCE: 4.0.6 -COMMENT: DB abstraction for odbc, mysql, pgsql, mssql, fbsql and more, see documentation -------------------------------------------------------------------------------- -EXTENSION: filepro -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: hyperwave -PRIMARY MAINTAINER: Uwe Steinmann -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: informix -PRIMARY MAINTAINER: Danny Heijl -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: ingres_ii -PRIMARY MAINTAINER: David Hénot -MAINTENANCE: Maintained -STATUS: Experimental -SINCE: 4.0.2 -------------------------------------------------------------------------------- -EXTENSION: interbase -PRIMARY MAINTAINER: Jouni Ahto -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 -MAINTENANCE: Maintained -STATUS: Working -COMMENT: Tested on phpts and isapi versions -------------------------------------------------------------------------------- -EXTENSION: mysql -PRIMARY MAINTAINER: Zak Greant , Georg Richter -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: pgsql -PRIMARY MAINTAINER: Yasuo Ohgaki -MAINTENANCE: Maintained -STATUS: Working -COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug. -------------------------------------------------------------------------------- -EXTENSION: sybase -MAINTENANCE: Unknown -STATUS: Not Working -------------------------------------------------------------------------------- -EXTENSION: sybase_ct -MAINTENANCE: Unknown -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: oci8 -PRIMARY MAINTAINER: Thies C. Arntzen -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: odbc -PRIMARY MAINTAINER: Daniel R. Kalowsky -MAINTENANCE: Maintained -STATUS: Working -COMMENT: Working -------------------------------------------------------------------------------- -EXTENSION: oracle -PRIMARY MAINTAINER: Thies C. Arntzen -MAINTENANCE: Maintained -STATUS: Working -COMMENT: Using the new OCI8 driver is encouraged where possible. -------------------------------------------------------------------------------- - - -== Other extensions == - -------------------------------------------------------------------------------- -EXTENSION: aspell -MAINTENANCE: Unknown -STATUS: Working -COMMENT: For aspell .27 and greater, check out the pspell extension -------------------------------------------------------------------------------- -EXTENSION: bcmath -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: bz2 -PRIMARY MAINTAINER: Hartmut Holzgraefe -MAINTENANCE: Odd Fixes -STATUS: Working -SINCE: 4.0.3 -------------------------------------------------------------------------------- -EXTENSION: dio -PRIMARY MAINTAINER: Sterling Hughes -MAINTENANCE: Orphaned -STATUS: Working -SINCE: 4.0.6 -------------------------------------------------------------------------------- -EXTENSION: cyrus -PRIMARY MAINTAINER: Sterling Hughes -MAINTENANCE: Orphaned -STATUS: Working -SINCE: 4.0.6 -------------------------------------------------------------------------------- -EXTENSION: calendar -PRIMARY MAINTAINER: Hartmut Holzgraefe -MAINTENANCE: Odd Fixes -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: com -PRIMARY MAINTAINER: Harald Radi -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: cpdf -PRIMARY MAINTAINER: Uwe Steinmann -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: crack -MAINTENANCE: Unknown -STATUS: Experimental -SINCE: 4.0.5 -------------------------------------------------------------------------------- -EXTENSION: ctype -PRIMARY MAINTAINER: Hartmut Holzgraefe -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: curl -PRIMARY MAINTAINER: Sterling Hughes -MAINTENANCE: Maintained -STATUS: Working -SINCE: 4.0.2 -------------------------------------------------------------------------------- -EXTENSION: cybercash -PRIMARY MAINTAINER: Evan Klinger -MAINTENANCE: Maintained -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: domxml -PRIMARY MAINTAINER: Uwe Steinmann -MAINTENANCE: Maintained -STATUS: Experimental -------------------------------------------------------------------------------- -EXTENSION: dotnet -PRIMARY MAINTAINER: Sam Ruby -MAINTENANCE: Maintained -STATUS: Experimental -------------------------------------------------------------------------------- -EXTENSION: exif -PRIMARY MAINTAINER: Marcus Boerger -MAINTENANCE: Maintained -STATUS: Working -SINCE: 4.2 -------------------------------------------------------------------------------- -EXTENSION: fdf -PRIMARY MAINTAINER: Uwe Steinmann -MAINTENANCE: Maintained -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: ftp -PRIMARY MAINTAINER: Stefan Esser (sesser@php.net) -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: gd -PRIMARY MAINTAINER: Rasmus Lerdorf -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: gettext -MAINTENANCE: Unknown -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: gmp -MAINTENANCE: Unknown -STATUS: Unknown -SINCE: 4.0.4 -------------------------------------------------------------------------------- -EXTENSION: icap -MAINTENANCE: Unknown -STATUS: Obsolete -------------------------------------------------------------------------------- -EXTENSION: iconv -PRIMARY MAINTAINER: Moriyoshi Koizumi -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: imap -PRIMARY MAINTAINER: Chuck Hagenbuch -MAINTENANCE: Odd Fixes -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: java -PRIMARY MAINTAINER: Sam Ruby -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: ldap -PRIMARY MAINTAINER: Stig Venaas -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: mbstring -PRIMARY MAINTAINER: Rui Hirokawa -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: mcal -PRIMARY MAINTAINER: Chuck Hagenbuch -MAINTENANCE: Odd Fixes -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: mcrypt -PRIMARY MAINTAINER: Derick Rethans -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: mhash -PRIMARY MAINTAINER: Sascha Schumann -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: muscat -PRIMARY MAINTAINER: Sam Liddicott -MAINTENANCE: Maintained -STATUS: Working -SINCE: 4.0.5 -COMMENT: Not tested against windows, only core API completed, rest under development -------------------------------------------------------------------------------- -EXTENSION: openssl -PRIMARY MAINTAINER: Wez Furlong -MAINTENANCE: Maintained -STATUS: Experimental -SINCE: 4.0.4 -------------------------------------------------------------------------------- -EXTENSION: overload -PRIMARY MAINTAINER: Andrei Zmievski -MAINTENANCE: Maintained -STATUS: Experimental -------------------------------------------------------------------------------- -EXTENSION: pcre -PRIMARY MAINTAINER: Andrei Zmievski -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: pdf -PRIMARY MAINTAINER: Uwe Steinmann -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: pfpro -PRIMARY MAINTAINER: David Croft -MAINTENANCE: Maintained -STATUS: Working -SINCE: 4.0.2 -------------------------------------------------------------------------------- -EXTENSION: posix -PRIMARY MAINTAINER: Kristian Köhntopp -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: printer -PRIMARY MAINTAINER: Daniel Beulshausen -MAINTENANCE: Maintained -STATUS: Working -SINCE: 4.0.4 -COMMENT: Only for Win32 -------------------------------------------------------------------------------- -EXTENSION: pspell -PRIMARY MAINTAINER: Vlad Krupin -MAINTENANCE: Unknown -STATUS: Unknown -SINCE: 4.0.2 -------------------------------------------------------------------------------- -EXTENSION: qtdom -MAINTENANCE: Unknown -STATUS: Experimental -SINCE: 4.0.4 -------------------------------------------------------------------------------- -EXTENSION: readline -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: recode -PRIMARY MAINTAINER: Kristian Köhntopp -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: sablot -PRIMARY MAINTAINER: Sterling Hughes -MAINTENANCE: Obsolete -STATUS: Experimental -SINCE: 4.0.3 -------------------------------------------------------------------------------- -EXTENSION: satellite -PRIMARY MAINTAINER: David Eriksson -MAINTENANCE: Odd Fixes -STATUS: Experimental -SINCE: 4.0.3 -------------------------------------------------------------------------------- -EXTENSION: session -PRIMARY MAINTAINER: Sascha Schumann -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: shmop -PRIMARY MAINTAINER: Ilia Alshanetsky -MAINTENANCE: Maintained -STATUS: Experimental -SINCE: 4.0.3 -------------------------------------------------------------------------------- -EXTENSION: snmp -PRIMARY MAINTAINER: Rasmus Lerdorf -MAINTENANCE: Odd Fixes -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: sockets -PRIMARY MAINTAINER: Chris Vandomelen -MAINTENANCE: Maintained -STATUS: Experimental -SINCE: 4.0.2 -------------------------------------------------------------------------------- -EXTENSION: swf -PRIMARY MAINTAINER: Sterling Hughes -MAINTENANCE: Orphaned -STATUS: Deprecated (Use the ming swf extension instead) -COMMENT: Only for Unix (won't change) -------------------------------------------------------------------------------- -EXTENSION: sysvsem -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: sysvshm -MAINTENANCE: Unknown -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: vpopmail -MAINTENANCE: Unknown -STATUS: Experimental -SINCE: 4.0.5 -------------------------------------------------------------------------------- -EXTENSION: wddx -PRIMARY MAINTAINER: Andrei Zmievski -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: xml -PRIMARY MAINTAINER: Thies C. Arntzen -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: xslt -PRIMARY MAINTAINER: Hartmut Holzgraefe -MAINTENANCE: Odd Fixes -STATUS: Working (mostly) -------------------------------------------------------------------------------- -EXTENSION: yaz -PRIMARY MAINTAINER: Adam Dickmeiss -MAINTENANCE: Maintained -STATUS: Unknown -SINCE: 4.0.1 -------------------------------------------------------------------------------- -EXTENSION: yp -MAINTENANCE: Unknown -STATUS: Unknown -------------------------------------------------------------------------------- -EXTENSION: zlib -PRIMARY MAINTAINER: Stefan Roehrich -MAINTENANCE: Maintained -STATUS: Working -------------------------------------------------------------------------------- -EXTENSION: zziplib -PRIMARY MAINTAINER: Hartmut Holzgraefe -MAINTENANCE: Odd Fixes -STATUS: Working -SINCE: 4.0.5 -------------------------------------------------------------------------------- -# iptc? diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 28ee3f0b06..0000000000 --- a/INSTALL +++ /dev/null @@ -1,422 +0,0 @@ -Installation Instructions for PHP 4 ------------------------------------ - -STOP! - -Before going any further, please remember you are going to find more -up to date instructions in the online manual, located here: - -http://www.php.net/manual/en/install.apache.php - -For Apache 2, instructions and up-to-date information regarding it's -support status, is available here: - -http://www.php.net/manual/en/install.apache2.php - -It is strongly recommended that you read the manual page before going -further. However, for the impatient, here is a quick set of steps that -will build PHP as (first) a dynamic Apache module (DSO) for Apache 1.3.x -with MySQL support and then a static module. A more verbose explanation follows. - -For installing PHP on other web servers, refer to one of the following -files: - - sapi/aolserver/README - sapi/pi3web/README - sapi/servlet/README - sapi/thttpd/README - README.Zeus - -Some notes: - -1: Only install either the static module or the dynamic one. Do not - install both. - -2: If you are recompiling PHP to add new extensions or upgrading - something like GD, remove the config.cache file before you re-run - configure. - -3: If you are on Linux and have installed shared libraries, make - sure the location of these shared libraries are listed in your - /etc/ld.so.conf file. For example, if you have: - - /usr/local/lib/mysql/libmysqlclient.so - - Make sure /etc/ld.so.conf contains: - - /usr/local/lib/mysql - - Then run ldconfig. - -If you want both PHP 3 and 4 modules in the same Apache server, check the -bottom of this file for instructions. - -INSTALLATION WITH THE ZEUS WEB SERVER: ---Please see the 'README.Zeus' file included in this distribution - - -QUICK INSTALL (DSO) - -For this to work your Apache httpd must have mod_so enabled. -Check using httpd -l. You should see something like: - -Compiled-in modules: - http_core.c - mod_so.c - -Chances are you will see a lot more modules than these two. That's ok, -as long as mod_so.c shows up you can proceed with the following steps: - -$ gunzip -c php-4.x.y.tar.gz | tar xf - -$ cd php-4.x.y -$ ./configure --with-mysql --with-apxs -$ make -$ make install - -If you get an error telling you that the apxs script could not be found, -look for it on your system and if you find it, provide the full path to it -as: --with-apxs=/path/to/apxs - -Make sure you specify the version of apxs that is actually installed on -your system and NOT the one that is in the apache source tarball. - -Next you must copy php.ini-dist to the appropriate place (normally -/usr/local/lib/php.ini) and edit it as necessary to set PHP options. - -The only thing left to do is to edit your httpd.conf file and make sure the -PHP 4 mime type is there and uncommented. You need a line that looks like -this: - - AddType application/x-httpd-php .php - -Then restart your server (apachectl restart) and you should be able to -serve up PHP files now. Make a test file called test.php and put some -PHP tags in it. Like , for example. - - -QUICK INSTALL (Static) - -$ gunzip -c apache_1.3.x.tar.gz | tar xf - -$ cd apache_1.3.x -$ ./configure -$ cd .. - -$ gunzip -c php-4.x.y.tar.gz | tar xf - -$ cd php-4.x.y -$ ./configure --with-mysql --with-apache=../apache_1.3.x -$ make -$ make install - -$ cd ../apache_1.3.x -$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a - (The above line is correct! Yes, we know libphp4.a does not exist at this - stage. It isn't supposed to. It will be created.) -$ make - (you should now have an httpd binary which you can copy to your Apache bin dir if - is is your first install then you need to "make install" as well) -$ cd ../php-4.x.y -$ cp php.ini-dist /usr/local/lib/php.ini -You can edit /usr/local/lib/php.ini file to set PHP options. -Edit your httpd.conf or srm.conf file and add: - AddType application/x-httpd-php .php - - -VERBOSE INSTALL - -Chances are you are reading this because the quick install steps above -did not work for you. If this is the case, congratulations, you are -among the elite few that actually reads documentation. It really is -not a difficult install and once you have done it once you will fly -through it. - -Installing PHP can be done in four simple steps: - -1. Unpack your distribution file. - - You will have downloaded a file named something like php-4.x.y.tar.gz. - Unzip this file with a command like: gunzip php-4.x.y.tar.gz - - Next you have to untar it with: tar -xvf php-4.x.y.tar - - This will create a php-4.x.y directory. cd into this new directory. - -2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build - a static module - - You now have to choose the options you would like. There are quite - a few of them. To see a list, type: ./configure --help - - The only options that you are likely to want to use are the ones in - the last section entitled, "--enable and --with options recognized:" - - A popular choice is to build the Apache module version. In order to - build PHP as a dynamic module for Apache-1.3.x you have to first have - Apache installed. Assuming Apache is already installed, make sure - the shared object module is enabled. To check this, type: httpd -l - You should see something like: - - Compiled-in modules: - http_core.c - mod_so.c - - You will most likely have a lot more modules than what is shown here. - As long as mod_so.c shows up in the list, PHP should be happy. - - Now, type: ./configure --with-mysql --with-apxs - - If you get an error telling you that the apxs script could not be found, - look for it on your system and if you find it, provide the full path to it - as: --with-apxs=/path/to/apxs - - Make sure you specify the version of apxs that is actually installed on - your system and NOT the one that is in the apache source tarball. - - You might also want other flags on this configure line. --with-mysql - is just an example. - - There are a few things that can go wrong during this configure step. - The most common is that you have asked for an option and that the - configure script can not find the files required to enable this - option in PHP. Chances are you can provide the full path to the - base directory under which the related files were installed. For - example, if you have installed the GD library in /opt/gd which means - that /opt/gd/include has your GD header files and /opt/gd/lib contains - your GD library files, you would use --with-gd=/opt/gd - - Skip to step 3 for compilation and installation instructions. - -2b. Configure PHP (Static Module) - Skip if you performed 2a - - You now have to choose the options you would like. There are quite - a few of them. To see a list, type: ./configure --help - - The only options that you are likely to want to use are the ones in - the last section entitled, "--enable and --with options recognized:" - - A popular choice is to build the Apache module version. You need - to know where the source code directory for your Apache server is - located. Then use an option like: --with-apache=/usr/local/src/apache - if that is your Apache source code directory. If you only specify - --with-apache, then it will default to look for your Apache source - in /usr/local/etc/httpd. - - NOTE: The directory you specify should be the top-level of the - unpacked Apache (or Stronghold) distribution. The configure program - will automatically look for httpd.h in different directories under that - location depending on which version of Apache, including Stronghold, - you are running. - - For MySQL support, since newer versions of MySQL installs its various - components under /usr/local, this is the default. If you have - changed the location you can specify it with: --with-mysql=/opt/local - for example. Otherwise just use: --with-mysql - - *NOTE* If you are using Apache 1.3b6 or later, you should run the - Apache Configure script at least once before compiling PHP. It - doesn't matter how you have Apache configured at this point. - - Skip to step 3b at this point. - -3. Compile and install the files. Simply type: make install - -3a. Dynamic Module Installation - - Nothing else is needed here. Proceed to step 4a. - -3b. Static Module Installation - - For the Apache module version this will copy the appropriate files - to the src/modules/php4 directory in your Apache distribution if - you are using Apache 1.3.x. If you are still running Apache 1.2.x - these files will be copied directly to the main src directory. - - For Apache 1.3b6 and later, you can use the new APACI configuration - mechanism. To automatically build Apache with PHP support, use: - - cd apache_1.3.x - ./configure --prefix=//apache \ - --activate-module=src/modules/php4/libphp4.a - make - make install - - If you do not wish to use this new configuration tool, the old - install procedure (src/Configure) will work fine. - - If you are using the old Apache ./Configure script, you will have to - edit the Apache src/Configuration file manually. If you do not have - this file, copy Configuration.tmpl to Configuration. - - For Apache 1.3.x add: - - AddModule modules/php4/libphp4.a - - For Apache 1.3.x don't do anything else. Just add this line and then - run "./Configure" followed by "make". - - For Apache 1.2.x add: - - Module php4_module mod_php4.o - - For Apache 1.2.x you will also have to look in the libphp4.module file, - which was copied to the src directory. The EXTRA_LIBS line in the Apache - Configuration file needs to be set to use the same libs as specified on - the LIBS line in libphp4.module. You also need to make sure to add - "-L." to the beginning of the EXTRA_LIBS line. - - So, as an example, your EXTRA_LIBS line might look like: - - EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient - - NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it - is in the libphp4.module file. - - Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file - and set the WANTHSREGEX directive accordingly in your Configuration file. - This last step applies to versions of Apache prior to 1.3b3. - - This is a bit of a hassle, but should serve as incentive to move to - Apache 1.3.x where this step has been eliminated. - - Once you are satisfied with your Configuration settings, type: ./Configure - If you get errors, chances are that you forgot a library or made a typo - somewhere. Re-edit Configuration and try again. If it goes well, - type: make - - Assuming it compiles without errors, proceed to step 4b. - -4a. Setting up the server. (Dynamic Module) - - The make install command in step 3 should have done most of your - work for you. It actually edits your httpd.conf file and tries to - enable the dynamic PHP module. To verify this, look for a line that - looks like this: - - LoadModule php4_module libexec/libphp4.so - - The actual path before the libphp4.so part might differ slightly. This - is likely fine. If you are paranoid you can examine the output from the - make install step to see where the libphp4.so file was actually put and - place the full path to this file on this LoadModule line. - - If somewhere in your httpd.conf file you have a ClearModuleList line - then you also need this line: - - AddModule mod_php4.c - - And finally you need to tell Apache which file extension should trigger - PHP. You do this by creating a special mime type and associating it - with an extension. We suggest using: - - AddType application/x-httpd-php .php - - You are however free to use any extension you wish, including .html. - - Note! If a line has a # at the beginning, then it is commented out - and you need to remove the # for that line to take effect. - - Finally you need to copy php.ini-dist to the appropriate place - (normally /usr/local/lib/php.ini) and edit if necessary. - - Once you have made these changes you should be ready to restart your - server and try it out. Type: apachectl restart - -4b. Setting up the server. (Static Module) - - You should now have a new httpd binary. Shut down your existing server, - if you have one, and copy this new binary overtop of it. Perhaps make - a backup of your previous one first. Then edit your conf/httpd.conf file - and add the line: - - AddType application/x-httpd-php .php - - There is also an interesting feature which can be quite instructive and - helpful while debugging. That is the option of having colour syntax - highlighting. To enable this, add the following line: - - AddType application/x-httpd-php-source .phps - - Any file ending in .phps will now be displayed with full colour syntax - highlighting instead of being executed. - - Note that on some older server setups, the AddType lines are in the - conf/srm.conf file instead of conf/httpd.conf. - - Note! If a line has a # at the beginning, then it is commented out - and you need to remove the # for that line to take effect. - - When you are finished making changes to your httpd.conf file, you need - to copy php.ini-dist to the appropriate place (normally - /usr/local/lib/php.ini) and edit if necessary. You can then - start up your server. - -5. Testing it all worked - - Create a test file named test.php in your web tree somewhere and - put some test PHP tags in it. is a good first test. - This tag tells PHP to do a braindump and tells you all sorts of things - about itself. - - -WHY DISABLING -fPIC WORKS ON LINUX - - From: Martin v. Loewis - To: glibc-linux@ricardo.ecn.wfu.edu - Subject: Re: Shared library -shared vs. -fpic - - [In reply to Kaz Kylheku ] - - > PIC stands for Position-Independent Code. - - Correct. - - > Code isn't position-independent (or ``relocatable'') cannot be - > loaded at an arbitrary address; - - Wrong. - - > it requires some references to be patched at load time. - - Correct. - - > Shared libraries need to be relocatable because it's not known - > beforehand what address they will be loaded at - - Correct, depending on the meaning of "relocatable". PIC code typically - does not contain relocations; that's why its position-independent. - - > Just because you don't specify -fPIC doesn't mean that the compiler - > won't emit position-independent code; the option prevents it from - > emitting position-dependent code in situations where it otherwise - > would. - - Correct. However, a non-trivial shared library typically won't be - position-independent unless explicitly compiled with - -fPIC. Linux/glibc indeed does not require a shared library to be - position-independent; instead, it will perform the relocations in the - binary, even if they refer to code pages. As a result, those relocated - pages won't be shared across processes, anymore. - - Regards, - Martin - -USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES - - With some (newer) installations of Apache, it's possible to compile both - PHP 3 and PHP 4, and run them concurrently. - - Note, it's only really wise to do this if you need to use the PHP 3 engine - to maintain backwards compatibility. - - To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the - necessary link extensions (--enable-versioning). Otherwise, all standard - installations instructions apply. For example: - - $ ./configure \ - --with-apxs=/apache/bin/apxs \ - --enable-versioning \ - --with-mysql \ - - - - - diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d4335c298c..0000000000 --- a/LICENSE +++ /dev/null @@ -1,68 +0,0 @@ --------------------------------------------------------------------- - The PHP License, Version 3.0 -Copyright (c) 1999 - 2003 The PHP Group. All rights reserved. --------------------------------------------------------------------- - -Redistribution and use in source and binary forms, with or without -modification, is permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - 3. The name "PHP" must not be used to endorse or promote products - derived from this software without prior written permission. For - written permission, please contact group@php.net. - - 4. Products derived from this software may not be called "PHP", nor - may "PHP" appear in their name, without prior written permission - from group@php.net. You may indicate that your software works in - conjunction with PHP by saying "Foo for PHP" instead of calling - it "PHP Foo" or "phpfoo" - - 5. The PHP Group may publish revised and/or new versions of the - license from time to time. Each version will be given a - distinguishing version number. - Once covered code has been published under a particular version - of the license, you may always continue to use it under the terms - of that version. You may also choose to use such covered code - under the terms of any subsequent version of the license - published by the PHP Group. No one other than the PHP Group has - the right to modify the terms applicable to covered code created - under this License. - - 6. Redistributions of any form whatsoever must retain the following - acknowledgment: - "This product includes PHP, freely available from - ". - -THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND -ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP -DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - --------------------------------------------------------------------- - -This software consists of voluntary contributions made by many -individuals on behalf of the PHP Group. - -The PHP Group can be contacted via Email at group@php.net. - -For more information on the PHP Group and the PHP project, -please see . - -This product includes the Zend Engine, freely available at -. diff --git a/Makefile.frag b/Makefile.frag deleted file mode 100644 index 2a4aa1c7f8..0000000000 --- a/Makefile.frag +++ /dev/null @@ -1,23 +0,0 @@ - -# -# Zend -# - -$(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h -$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h - -$(builddir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l - $(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l - -$(builddir)/zend_language_parser.h: $(builddir)/zend_language_parser.c -$(builddir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y - $(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@ - -$(builddir)/zend_ini_parser.h: $(builddir)/zend_ini_parser.c -$(builddir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y - $(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@ - -$(builddir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l - $(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l - -$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(builddir)/zend_language_parser.h diff --git a/Makefile.global b/Makefile.global deleted file mode 100644 index 607deaece8..0000000000 --- a/Makefile.global +++ /dev/null @@ -1,68 +0,0 @@ -mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p -INSTALL = $(top_srcdir)/build/shtool install -c -INSTALL_DATA = $(INSTALL) -m 644 - -DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir) -COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH) - - -all: $(all_targets) - -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 $@ - -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: $(install_targets) - -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 \ - if test -r $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME).$$i; then \ - $(LN_S) $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME); \ - break; \ - fi; \ - done; \ - fi - @$(INSTALL_IT) - -install-modules: build-modules - @test -d modules && \ - $(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)/" - @$(mkinstalldirs) $(INSTALL_ROOT)$(PEAR_INSTALLDIR) - @$(INSTALL) -m 755 $(top_srcdir)/run-tests.php $(INSTALL_ROOT)$(PEAR_INSTALLDIR) - -install-su: install-pear install-tester - -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 - find . -name \*.la -o -name \*.a | xargs rm -f - find . -name \*.so | xargs rm -f - find . -name .libs -a -type d|xargs rm -rf - rm -f libphp5.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/* - -distclean: clean - rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php5.spec sapi/apache/libphp5.module buildmk.stamp - egrep define'.*include/php' configure|sed 's/.*>//'|xargs rm -f - find . -name Makefile | xargs rm -f - -.PHONY: all clean install distclean test -.NOEXPORT: diff --git a/NEWS b/NEWS deleted file mode 100644 index 0bb3527dde..0000000000 --- a/NEWS +++ /dev/null @@ -1,2544 +0,0 @@ -PHP NEWS -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -? ? ??? 200?, Version 5.0.0 -- Moved extensions to PECL (http://pear.php.net/): (James, Tal) - . ext/fribidi -- Fixed dirname() and strip_tags() to be binary-safe. (Moriyoshi) -- Fixed bug #22386 (Using browscap causes segfault). (Jay) -- Fixed bug #22895 (PHP cli outputs errors in text AND html). (Marcus) -- Fixed bug #22059 (ftp_chdir causes segfault). (Sara) -- Fixed bug #21985 and #22064 (various mb_send_mail() issues). (Moriyoshi) -- Fixed bug #21600 (Assign by reference function call changes variable contents). - (Zeev) -- Fixed bug #21007 (html_errors off text-only output in phpinfo). (Marcus) -- Fixed bug #20442 (upgraded bundled expat to 1.95.5). (Ilia) -- Fixed bug #20155 (xmlrpc compile problem with ZE2). (Derick, Jan Schneider) -- 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 - functions if "zend" is specified as the module name. (Ilia) -- Changed is_executable() to be available also on Windows. (Shane) -- 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 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 opendir() and stat() related support to ftp:// wrapper. (Sara) -- Added IPv6 support to ext/sockets. (Sara) -- Added context options to http_fopen_wrapper 'method', 'header', 'content'. (Sara) -- Added domdocument->create_document_fragment() and documentfragment->open_mem() - methods to domxml. (Rob Richards, Chregu) -- Added domelement->set_attribute_node() method (bug #17638). (Rob Richards) -- 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) -- Added file_put_contents() function. (Sterling) -- Added "mail_force_extra_paramaters" php.ini option which forces the addition - of the specified parameters to be passed as extra parameters to the sendmail - binary. These parameters will always replace the value of the 5th parameter - to mail(), even in safe mode. (Derick) -- Added new "transport" layer for sockets and associated functions. (Wez) - . 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. - . generic crypto interface for streams (supports dynamic loading of OpenSSL) -- Added stream_copy_to_stream() function. (Wez) -- Added memory mapping support under win32 to improve performance of - readfile(), fpassthru() and some internal streams operations. (Wez) -- Added DBA handler 'inifile' to support ini files. (Marcus) -- Added input filter support. See README.input_filter. (Rasmus) -- Added "session.hash_function" and "session.hash_bits_per_character". (Sascha) -- Added lightweight streaming input abstraction to the Zend Engine scanners - that provides uniform support for include()'ing data from PHP streams across - all platforms (Wez, Zend Engine). -- Added optional parameter to sha1(), sha1_file(), md5() and md5_file() which - makes them return the digest as binary data. (Michael Bretterklieber, Derick) -- Added proc_nice() function. Changes priority of the current process. (Ilia) -- Added pcntl_getpriority() and pcntl_setpriority() functions. (Ilia) -- Added idate(), date_sunrise() and date_sunset() functions. (Moshe Doron) -- Added long options into CLI & CGI (e.g. --version). (Marcus) -- Added strpbrk() function. Searches a string for a list of characters. (Ilia) -- Added stream_get_line() function. Reads either the specified number of bytes - or until the ending string is found. (Ilia) -- Added optional parameter to mkdir() to make directory creation recursive. (Ilia) -- Added optional parameter to file() which makes the result array not contain - the line endings and to skip empty lines. (Ilia) -- Added get_headers() function. Returns headers sent by the server of - the specified URL. (Ilia) -- Added str_split() function. Breaks down a string into an array of elements - based on length. (Ilia) -- Added array_walk_recursive() function. (Ilia) -- Added new command line parameters -B, -F, -R and -E which allow to process stdin - line by line (See 'php -h' or 'man php' for more). (Marcus) -- Added string.base64 stream filter. (Moriyoshi) -- Added domxml_node_get_path(). (Lukas Schröder) -- Added iconv related functions. (Moriyoshi) - . iconv_strlen() - . iconv_substr() - . iconv_strpos() - . iconv_strrpos() - . iconv_mime_decode() - . iconv_mime_encode() -- 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 imagefilter() function. Allows application of various filters. - Only available with bundled GD. (Pierre-Alain Joye, Ilia) -- Added antialiased drawing support to bundled GD. (Pierre-Alain Joye, Ilia) - . imageantialias($im, $flag) to (de)active antialias - . imageline antialias support - . imagepolygon antialias support - -17 Feb 2003, Version 4.3.1 -- Fixed serious security vulnerability in CGI SAPI. (Shane) - -27 Dec 2002, Version 4.3.0 -- Added sha1() and sha1_file() for US Secure Hash Algorithm 1. (Stefan Esser) -- Make PHP_AUTH_* variables not available in safe mode under Apache when an - external basic auth mechanism is used. (Philip) -- Aliased dba_popen() to dba_open() until 4.3.2 when persistent STDIO streams - are introduced. (Andrei) -- Fixed a security bug in the bundled MySQL library. (Georg, Stefan) -- If you don't specify building any other SAPI "make install" will install the - CGI SAPI binary in {PREFIX}/bin/php. If you want to install CLI SAPI in that - location use "make install-cli" after "make install" or add --disable-cgi - to your configure options. In the Windows distribution CLI SAPI is included - in the "cli" folder. (Edin) -- Removed extensions: (Jan, Jani, Sebastian) - . ext/aspell - . ext/ccvs - . ext/icap - . sapi/fastcgi - . sapi/fhttpd -- Moved extensions to PECL (http://pear.php.net/): (James, Derick, George) - . ext/vpopmail - . ext/cybermut - . ext/cybercash -- ZLIB extension is now built-in in the Windows distribution. - External extension (php_zlib.dll) has been removed. (Edin) -- Fixed a crash when using invalid color index with imagecolortransparent(). - (Pierre-Alain Joye) -- Fixed bug #20987 (no handling for client certificates). (Ilia) -- Fixed bug #21039 (crash when not supplying an IV to mcrypt_generic_init). - (Derick) -- Fixed bug #20936 (openssl_pkey_get was broken). (jeroen@derks.it, Wez) -- Fixed bug #20927 (wordwrap crash). (Ilia) -- Fixed bug #20796 (when register_globals is on & arrays with same names are - passed via get/post/cookie the data inside $_GET/$_POST/$_COOKIE can would be - corrupted). (Ilia) -- Fixed bug #20725 (if the upload directory cannot be written to, the POST data - after the uploaded file is lost). (Ilia) -- Fixed bug #20865 (array_key_exists() fails to find NULL key). (Ilia) -- Fixed bug #20812 (ftp_get returned NULL on success, instead of TRUE). (Ilia) -- Fixed bug #20785 (crash when using pdf_open_memory_image() to load a - true-color image). (Ilia) -- Fixed a crash when converting between true-color images (png/jpeg) and - gd1/gd2 image formats, png/jpeg -> gd1/gd2 -> png/jpeg conversion now - works correctly. (Ilia, Pierre-Alain Joye) -- Fixed a memory leak in the bundled GD library inside - gdImageTrueColorToPalette(). (Ilia) -- Fixed bug #12776 (array_walk crash). (Moriyoshi) -- Fixed bug #20934 (htmlspecialchars returns latin1 from UTF-8). (Moriyoshi) -- Fixed bugs #20270, #15702, #18600 (segfaults in ext/java). (Tony J. White) -- Made bcmath extension thread safe. (Sander) -- Fixed bug #19566 (get_declared_classes() segfaults). (Moriyoshi, Marcus, Andi) -- Fixed bug #20381 (array_merge_recursive mangles input arrays). (Moriyoshi) -- Added -n command switch to cli and cgi version which allows to skip php.ini - parsing at startup. (Marcus, Wez) -- Fixed bug #19689 (absolute paths like /test/dir/ not working correctly). - (Ilia) -- Added "neutral" language entry to mbstring spec. (Moriyoshi) -- Changed bundled gd library to consider php.ini option memory_limit. (Marcus) -- Modified log() to accept multiple bases. (Jason) -- Fixed bugs #16190/18746 (ext/db: flatfile support with windows). (Marcus) -- Added gd_info() which returns an array of gd support information. (Marcus) -- Implemented features/changes requested in Bug #16960 (Timm): - . Added a new function sybase_unbuffered_query() - . Added a new function sybase_fetch_assoc() - . Added sybase_set_message_handler() which enables users to handle - server messages in a callback function - . Added an ini entry for deadlock retries - retrying deadlocks can cause - transaction state to break (sybct.deadlock_retry_count, - defaults to -1 "forever"). - . Fixed sybase_fetch_object() not to return objects with numeric members - . Fixed issues with identical fieldnames - . Made sybase_fetch_*() functions return correct datatypes - . Made phpinfo() section more verbose - . Made sybase_query() error messages more verbose -- Fixed bug #19935 (made OpenSSL file system operations abide by safe_mode - & open_basedir restrictions). (Ilia) -- Fixed bug #18868 (improved the check for availability of realpath()). (Ilia) -- Fixed width/height detection of bmp images using getimagesize() function on - big endian systems and added code to retrieve bmp bit depth. (Ilia) -- Fixed bug #20035 (line counting error when script starts with #! in - cgi/cli/fastcgi sapis). (Ilia) -- Fixed bug #20235 (incorrect handling of symlinks on ZTS build). (Ilia) -- Added sanity checks to headers_sent() & image_type_to_mime_type(). (Ilia) -- Added an aditional parameter to the jdtojewish() function which makes - the function return the symbolic hebrew name. (Moshe Doron, Derick) -- Fixed bug #20169 (implode() clobbers first argument). (Moriyoshi) -- Improved dba extension (Marcus) - . Added dba_handlers() that returns an array of installed handlers and - dba_list() that returns an associative array of open database files. - . Added bundled cdb support wich can be activated by --with-cdb without a - path. The bundled version supports cdb_make that allows writing cdb files. - . Added optional skip parameter to dba_fetch() to support multiple key-value - pairs with the same key for cdb handler. - . Added locking for those handlers that do not have their own locking. - . Added support for magic_quotes_runtime php.ini option. - . Added flatfile support what finally makes ext/db deprecated. -- Added imagerotate() which is available only when bundled libgd is used. - (Pierre-Alain Joye, Ilia) -- Fixed bug #17497 (mssql extension crashes if magic_quotes_runtime is on). - (Sterling) -- Remove $_FILES from $_REQUEST (import_request_variables is not modified), - this didn't work properly in the first place, and added confusion. (Sterling) -- Fix the socket_read() function on win32 to work in normal mode (reading to - the end of a line), as well as binary mode. (Sterling) -- Fixed bug #20110 (added sanity check to prevent include/require functions - from trying to include directories). (Ilia) -- Fixed bug #20108 (segmentation fault on printf("%1.1s", "string")). (Ilia) -- Added dbx_escape_string() function to dbx module. (Marc) -- Added Oracle (oci8) support to dbx module. (Marc) -- Updated FDF extension to work with Adode fdftk 5.0. (Hartmut) -- Added mb_strtolower() and mb_strtoupper(). (Moriyoshi) -- Fixed an infinite loop in setlocale() when only invalid locale names - were passed in the array. (patch by Pal Loberg, pallo@initio.no) -- Fixed bugs #19156 and #19544 (COM extension leaks memory and keeps - components referenced). (Harald) -- Added fribidi_get_charsets() and fribidi_charset_info() functions. (Tal) -- Added Oracle TIMESTAMP type to oci8 extension. (Thies) -- Fixed fgets($fp) to read until EOL when length parameter is not set. (Wez) -- Changed registry entries under "HKLM\SOFTWARE\PHP\Per Directory Values" to - work also with administrative directives such as safe_mode, open_basedir, - etc. (Claudio Felber) -- Added str_word_count() function which counts words inside a string. (Ilia) -- Added PGSQL_CONNECT_FORCE_NEW option to pg_connect() (Yasuo) -- Added ICONV_IMPL and ICONV_VERSION constants to iconv extension to - indicate which iconv implementation is used. (Moriyoshi) -- Fixed bug #4232 (Added %e & %E support to printf/sprintf). (Ilia) -- Fixed bug #17580 (Allow ini parser to parse files >16K). (Ilia) -- Fixed bug #19649 (Sanity checks for browscap.ini parser). (Ilia) -- Added experimental patch to address problem with floats on various locales. - (Bug #17079). (Ilia) -- Fixed bug #19280 (imap_header fails with many To: addresses). (Ilia) -- Added mb_regex_set_options(). The Options parameters of various mbregex - functions are now deprecated. (Moriyoshi) -- Fixed bug #19482 (Segfault with PCRE and locale). (Andrei) -- Made ImageTruecolorToPalette() in bundled GD2 library actually work. (Rasmus) -- Fixed ImageCopy() in bundled GD2 library to handle copying from truecolor to - palette-based. (Wez, Rasmus) -- Added read-only GIF support for bundled GD2 library. (Rasmus) -- Made several adjustments to xslt extension (David Viner, Lehnar, Melvyn) - . Added xslt_set_object and xslt_setopt function - . Changed backend interaction with Sablotron library - . Fixed leak with error_print - . Made xslt_make_array() always set NULL on last index to signal array end. -- Changed the glue argument in implode() to be optional. If not specified, - defaults to "". (Sterling) -- Fixed fields argument to contain correct info for xslt_set_error_handler(). - (Patch by Lenar Lohmus) -- Added --with-config-file-scan-dir compile-time switch which specifies a - directory which will be scanned for *.ini files. (Rasmus) -- Added ob_get_clean() and ob_get_flush(). (Yasuo) -- Added ftp_ssl_connect() to ext/ftp for FTP over SSL support. (Stefan Esser) -- Made a few additions and changes to Apache 2 sapi. (Ilia) - . Added apache_response_headers(), apache_note(), apache_getenv() and - apache_setenv() functions. - . Added more detailed error reporting to apache_lookup_uri() and virtual(). - . Renamed getallheaders() to apache_request_headers() and made an alias for BC. - . Added php_apache_sapi_getenv() and php_apache_sapi_get_stat(). - . Added syntax-highlighting handling (.phps) -- Fixed strstr(), strchr() and strrchr() to be binary safe. (Andrey) -- Added array_diff_assoc() and array_intersect_assoc(). (Andrey) -- Fixed bug #17825 (ob_start() chunk size option didn't work well). (Yasuo) -- Fixed output buffer infinite loop when buffer_size became 0. (Marcus, Wez) -- Added getopt() for parsing command line options and arguments. (Jon) -- Added pg_fetch_assoc(), pg_fetch_all(), pg_ping(), pg_meta_data(), pg_convert(), - pg_insert(), pg_select(), pg_update(), pg_delete(), pg_result_seek(), - pg_unescape_bytea(), pg_get_notify() and pg_get_pid(). (Yasuo) -- Fixed bug #17281 (Sanity checks for encoding sessions). (Ilia) -- Fixed bug #16995 and #19392 (Prevent crash if $HTTP_SESSION_VARS != ARRAY). - (Ilia) -- Fixed bug #19292 (open_basedir restriction problem). (Rasmus) -- Fixed bug #19366 (gdImageFill crashes when x & y are outside of - the image's boundries). (Ilia) -- Fixed bug #13936 (__FILE__ constant didn't contain full path). (Ilia) -- PHP now has a new stream system that allows it to do some clever stuff with - fopen() and fsockopen(). As a result: - . URL wrappers natively supports https:// URLs if you have compiled - OpenSSL support into PHP (shared extension does not support this). - . Added support for fopen("ftps://...", ...) which allows to connect to FTP - servers via SSL. (Stefan Esser) - . fsockopen() adds support for ssl:// and tls:// connections via TCP/IP - . copy($srcfilename, $destfilename) can now be used with URL wrappers - . zlib wrappers/streams can be used even on systems without fopencookie() - . Changed 'zlib:' fopen wrapper to 'compress.zlib://' and deprecate - 'zlib:' to avoid ambiguities when filenames have ':' characters. (Wez) - . Added 'compress.bzip2://' stream and wrapper support. - . Added user-space streams - it is now possible to define a class in PHP - code and register it as a URL wrapper. (stream_register_wrapper) - . Most extensions now support streams when passing files, which means - that those extensions will now also support URL wrappers. (Wez) - . Added URL-wrapper support to exif. (Marcus) - . Added memory stream support. (Marcus) - . Renamed: - socket_set_timeout() -> stream_set_timeout() - socket_set_blocking() -> stream_set_blocking() - set_file_buffer() -> stream_set_write_buffer() - socket_get_status() -> stream_get_meta_data() - As these functions can (in theory) work on any type of stream. (Wez) - . Raw POST data is now available as "php://input" stream. (Hartmut) - . fopen("php://output", "wb") returns a stream that writes to the output - buffer (like echo and print). (Wez) - . Added stream_context_create(), stream_context_set_params() and - stream_context_set_option and added an optional fourth parameter to - fopen() which accepts a stream context. Contexts allow sharing of - information between streams (a kind of "session") and setting - notification callbacks. (Wez) - . Made the "User-Agent" header sent by http:// and https:// wrappers - configurable in php.ini or via a stream context. (Sterling) - . Added stream_filter_prepend() and stream_filter_append() which apply - a filter to either the top or the bottom of a stream filter stack. - Implemented "string.rot13" filter as an example; more filters are - expected to follow in later releases and other extensions. (Wez) - . Added stream_select() which works like socket_select but works on - streams returned by fopen(), fsockopen() and pfsockopen() instead. (Wez) - . Added STDIN, STDOUT and STDERR constants for CLI sapi reflecting opened - streams to their respective standard I/O counterparts. (Edin) - . Added php.ini option "auto_detect_line_endings" which enables PHP to - detect Macintosh, Unix and Dos end-of-line characters in fgets() and - file(). Fixes bugs #16521 and #16708. (Wez) - . Fixed include(), require() and GD functions to work with remote files - under win32. - Fixed bug #18609 (ImageCreateFromJPEG can't fetch from a URL). (Wez) -- Fixed bug #18022 (fopen does not work with php://stdin anymore on Solaris). - (Wez) -- Added php.ini option "default_socket_timeout" to set the timeout limit for - PHP network streams. (kalowsky, ilia@prohost.org, Wez) -- Added file_get_contents() which returns the contents of a file as a string. - This function also supports the URL wrappers. (Wez) -- Fixed bug #19595 (Missing functions for GD2 format handling). (Edin) -- Fixed bug #19633 (Wrong directories in ext/ldap/config.m4). (Derick) -- Fixed bugs #17274 and #19627 (segfault in sem_remove). (Wez) -- Added mb_convert_case() function to the mbstring extension which can convert - strings between upper, lower and title case using Unicode mappings. - Fixed bug #19257 (strtolower & strtoupper does not work for UTF-8 strings). - (Wez) -- Fixed bug #18521 (htmlentities didn't warn about unsupported charsets). (Wez) -- Fixed bug #11643 (Session related, fix SID redefinition). (Ilia) -- Fixed bug #18556 (Scripting Engine, problem with locales like tr_TR). (Ilia) -- Changed y2k_compliance to default to 1 now. (Sascha) -- Added platform independent socket error constants for better error handling. (Jason) -- Update output of phpinfo() to use more CSS to reduce the file size, do - proper HTML escaping, and make it XHTML compliant. (Colin) -- Fixed compile errors in the FriBidi extension (Bug #16414). (Tal) -- Fixed bugs #7472, #12120 and #12989 as well as other potential problems - with strip_tags() function. (Ilia) -- Fixed bugs #17570 and #17957 (Regexps related). (Andrei, Ilia) -- Fixed bugs #18167 and #16859 (SEGV with session_decode). (Ilia) -- Fixed bugs #19573 and #13472 (Session, XHTML compliance and trans_sid). - (Sascha) -- Fixed bug #19570 (last character was missing in get_html_translation_table). - (Wez) -- Upgraded PCRE to version 3.9. (Wez) -- Fixed bug in OCIResult() which returned garbage when called on - empty result-sets. (Thies) -- Added ability to use Perl-style ${n} subpattern references in the - replacement string for preg_replace() (bug #18442). (Andrei) -- Fixed array_merge_recursive() to avoid problems with merging cyclical - arrays (bug #16064). (Andrei) -- Made function_exists() work properly with disabled functions. (Andrei) -- Added ability to extract() variables as references via OR'able EXTR_REFS - flag. (Andrei) -- Fixed a build failure with the OCI8 extension on Tru64. - (Patch by Michael Mauch, micahel.mauch@gmx.de) -- Added --disable-all configure option. (Jani) -- Backported debug_backtrace() from ZendEngine2. (Thies) -- Added html-free phpinfo() output for CLI. (Jan) -- Fixed socket_recvfrom() to be binary safe. (Jason) -- Changed mail() to use escape_shell_cmd() to allow multiple extra parameters - to the invocation of the mailer as used in the fifth parameter. (Derick) -- Changed cURL extension to require cURL version 7.9.8 (Derick) -- Added zend_execute_internal which is called like zend_execute but for - internal functions. (Thies) -- Changed pg_connection_status(), pg_connection_reset(), pg_connection_busy(), - pg_result_status() and pg_result_error() to silently return FALSE when - resource is not passed to them. (Yasuo) -- Fixed some mysql compile failures on 64 bit-OS. (Georg) -- Added warnings for deprecated mysql functions: - . mysql_create_db() - . mysql_drop_db() - . mysql_escape_string() -- Added XsltObject->result_dump_mem($result) for returning xslt-result directly - into a string and XsltObject->result_dump_file($result,$file[,$compression]) - for dumping into a file. (morus.walter@web.de, chregu) -- Made mime_magic and ZIP extensions available on Windows. (Edin) -- Added xslt_backend_version() and xslt_backend_name() for getting - information about the processor backend. (chregu) -- Added ImageColorMatch() and ImageLayerEffect() functions which are only - available when using the bundled GD library. (ttoohey) -- Made major improvents to the pcntl extension. (Jason) - . Greatly improved performance (signal callback mechanism uses ticks) - . Implemented object signal callback ability by using array($obj, $method) - . Added a restart parameter to pcntl_signal, which allows you to disable - the default of system call restarting -- Changed DomNode->next_sibling() and DomNode->previous_sibling() to return - NULL instead of false (W3C specs). (chregu) -- Changed DomNode->insert_before() and DomNode->append_child() to conform to - W3C specs (moving not copying nodes, accepting NULL as 2nd param). (chregu) -- Added DomNode->set_namespace(uri[,prefix]) (chregu) -- Fixed shuffle() to properly generate all possibilities. (Patch provided by - Adam ) -- Fixed DomNode->insert_before() to behave according to W3C spec - ie. new_child is moved, not copied. (chregu) -- Added some namespace support with DomNode->add_namespace(uri, prefix) - and DomDocument->create_element_ns(uri, nodename) (chregu) -- Added optional parameter to DomElement->node_name() for retrieving fully - qualified name (ie. namespace prefix). (chregu) -- Changed DomNode->child_nodes() to return empty array instead of false if no - child nodes are found. (chregu) -- Fixed a bug with handling the Expect header. (Patch by ilia@prohost.org) -- Fixed a bug in ODBC where closing the module caused a crash in the Windows - executable. (kalowsky) -- Fixed memory leaks in pack() and unpack(). (Patch by ilia@prohost.org) -- Added URLs to error messages which direct to a page describing the error or - function in question. (Derick, Wez, Marcus) -- Added odbc_data_source() functionality to identify DB ServerName, and a - description of it gathered from the DSN. (kalowsky) -- Fixed copy() to return TRUE with 0 byte files. (Patch by ilia@prohost.org) -- Added ob_list_handlers() which returns an array of all active output - handlers. (Marcus) -- Added mbstring encoding/decoding "HTML-ENTITIES". (Marcus) -- Added parameter 'L' for mb_http_input() to retrieve input encoding as a - comma separated string. (Marcus) -- Added the ability for declare() compiler modifications to occur globally - by using an empty statement. (Jason, Zend Engine) - i.e. - //Globally enables the ticks modifier for the whole program - declare (ticks=1); - - //Enables the ticks modifier for just the lexical block containing - //"statement". - declare (ticks=1) { - statement; - } -- Brought strtotime() "next" keyword handling in line with documentation and - its glibc cousin. (Rasmus) -- Fixed str_rot13() to not mangle source string. (Rasmus) -- Fixed imap_get_quota() to work with multiple returned resources as per - the RFC 2087 and bug #14673. (kalowsky, Sander Steffann) -- Added MarkerNote decoding to exif_read_data() for several Cameras. (Marcus) -- Disabled zlib.output_compression for "image/" content-type - headers which can be changed during script execution. (Stefan) -- Added new asynchronous FTP functions. (Stefan) -- Added optional 5th parameter to FTP functions to support resuming. (Stefan) -- Added optional 2nd parameter to print_r() to make it return the variable - representation instead of echoing it. (Derick) -- Added mysql_ping(), mysql_real_escape_string(), mysql_character_set_name(), - mysql_thread_id(), mysql_stat() and mysql_list_processes(). (Zak, Georg) -- Added safe_mode & open_basedir checks for pg_lo_export(). (Yasuo) -- Added open_basedir check for pg_lo_import(). (Yasuo) -- Fixed infinite recursion crash bug in ticks. (Jason) -- Added php.ini option "mysql.connect_timeout" to set the timeout limit for - mysql_connect() and mysql_pconnect(). (Georg) -- Added optional parameter "flags" to mysql_connect() and mysql_pconnect() - which can be used to set usage of idle timeout and different protocols, - SSL and compressed. (Georg) -- Added automatic rollback to ext/mysql for non committed transactions. (Georg) -- Fixed cases where preg_split() incorrectly terminated final element if it - contained null bytes. (Andrei) -- Added persistent connections/pipelining to thttpd. (Sascha) -- Fixed two potential blocking issues in thttpd. (Sascha) -- Fixed broken header file detection on Solaris. (Sascha) -- Improved nss/socket-related symbol/library detection. (Jani, Sascha) -- Made iconv() work well with both libiconv and libgconv. (Moriyoshi, Yasuo) -- Fixed socket_set_timeout() on win32. (Jason, Edin, Jani) -- Added domxml_node_namespace_uri(). (Rui Lopes) -- Fixed win32 memory leak in /ext/sockets that would occur on any error - condition. Also fixed host resolution error messages on win32. (Jason) -- Added optional 3rd parameter 'recursive' to ftp_rawlist() which will - do 'LIST -R' instead of 'LIST'. (Jani) -- Changed getimagesize() to always set unknown fields to 0 and added support - for iff imagetype. (Marcus) -- Added runtime Apache2 thread check to ensure we don't run a non-threaded - PHP inside a threaded Apache2 MPM. (Rasmus) -- Made getimagesize() and exif_read_data() to return also the mime-type and - exif_thumbnail() to return also the image-type. (Marcus) -- Added image_type_to_mime_type() which converts image-types to mime-types. - (Marcus) -- Made GD functions to only exist if they are available in libgd. Now the - availability can be tested with function_exists(). (Derick) -- Added an optional parameter to the header() function which overrides the HTTP - response code. (Derick) -- Changed the order of which modules are unloaded to the reverse order of - which they were loaded. (Derick, Zend Engine) -- Added preliminary SAX-Input support. It's now possible to build a DomDocument - with SAX-Events. (chregu) -- Bundled GD library 2.0.1 with php (ext/gd/libgd) (Rasmus, Jani, Markus, Edin) -- Fixed bug with Apache which let PHP_AUTH_* variables to be set when - external basic auth mechanism was used. (Jani) -- Fixed bzopen() crash in thread-safe mode. (Andrei) -- Added better error-messages (3rd parameter) and validating of DTDs (2nd - parameter) to domxml_open_mem() and domxml_open_file(). (Christian) -- Added domxml_doc_validate() for validating existing DomDocuments with a DTD. - (Christian) -- Added ability to capture string offsets in preg_match_*() results. - (David Brown, Andrei) -- Fixed set_error_handler() to accept methods as callbacks and also report - invalid callbacks. (Andrei) -- Fixed a memory corruption bug in overload extension. (Andrei) -- Fixed error handling in fsockopen() on win32. (Jason) -- Added win32 support for the timeout parameter of fsockopen(). (Jason) -- Fixed shuffle() to provide equal distribution of values. (Andrei) -- Added --with-mysql-sock configure option which can be used to override - the unix socket location. (e.g. NFS compiles, etc.) (James Cox) -- Fixed is_a() to properly work on extension registered classes. (Andrei) -- Added new constants: PHP_PREFIX and PHP_SHLIB_SUFFIX. (Stig) -- Added pctnl_alarm() function. (Edin) -- If zlib.output_compression is enabled and a page is compressed - a "Vary: Accept-Encoding" header is now added. (Stefan) -- Renamed getallheaders() to apache_request_headers() and kept getallheaders() - as an alias to it. Also added apache_response_headers() which returns the - current response headers from Apache. (Rasmus) -- Added missing AddRef() calls in the COM extension. This should fix weird - behaviour (in particular with ADODB). (Harald) -- Fixed segfault in version_compare(). (Stig) -- Added compressed Flash MX files support to getimagesize(). (Derick) -- Added ability to capture string offsets in preg_split() results. - (David Brown, Andrei) -- Fixed a crash bug in token_get_all(). (Andrei) -- Implemented glob() for Unix/Win32. (Hartmut, Edin, Markus) -- Added domxml_doc_set_root() to change the root node. (Lukas Schroeder) -- Fixed a crash bug in stripslashes() when working in sybase mode. (Rasmus) -- Added experimental support for Simplified Chinese, Traditional Chinese and - Korean encodings into mbstring. (Rui) -- Misc. Win32 mail() enhancements: support 'From:' header (msisolak@yahoo.com), - support Bcc header, case-insensitive headers, enhanced error reporting, - automatic proper line ending conversion, fixed crash with Cc, fixed buffer - overflows with $header. (Markus) -- Improved IMAP extension performance. (adam.kauffman@mindspring.com, - rjs3@andrew.cmu.edu, Jon) -- Added optional 5th parameter to domxml_xslt_process(). When set, profiling - information is saved to the specified file. (chregu) -- Added MD5 support for crypt() on Windows. (Edin) -- Fixed resource bug in LDAP extension. (Stig Venaas) -- Fixed crash in output buffering when buffer is overwritten in a callback. - (Yasuo) -- Added output_add_rewrite_var() and output_remove_rewrite_var() to inject - and remove variables from the URL-Rewriter. (Thies) -- The Windows build can now be configured more comfortably, for example - when dealing with built-in extensions. (Sebastian) -- Added large OID value (2^31 to 2^32) support for pg_lo_import(), - pg_lo_unlink(), pg_lo_open() and pg_lo_export(). (Yasuo) -- Fixed mixing OCIPlogon() and OCINLogon() to not leak Oracle-Sessions. (Thies) -- Added php.ini options for EXIF extension to encode and decode Unicode/JIS - user comments. (Marcus) -- Changed the "-c" CLI/CGI option to allow both 'filename' and - 'path to php.ini'. (Yasuo) -- Added version information to the .dll and .exe files created under Windows. - (jtate) -- Added __FUNCTION__ and __CLASS__ constants. (Jani, Zend Engine) -- Added optional 2nd parameter for pg_result_status() to specify return type. - (Yasuo) -- Added "log_errors_max_len" php.ini option which controls maximum length for - error messages. (Marcus) -- Added "ignore_repeated_errors" and "ignore_repeated_source" php.ini options - which can be used to disable logging of repeated error messages. (Marcus) -- Made pg_last_notice() work correctly. (Yasuo) -- Added "pgsql.ignore_notice" and "pgsql.log_notice" php.ini options. (Yasuo) -- Added "zlib.output_compression_level" php.ini option. (Stig) -- Added support for --with-apxs build on Mac OS X / Darwin. (markonen) -- Added support for dynamically loaded extensions on OS X / Darwin. - NOTE: This requires Apache 1.3.25 or later. (kalowsky, markonen) -- Fixed CR/LF processing in quoted_printable_decode() on Win32. (kir) -- Made crack extension available on Win32. Cracklib libraries for Win32 are - available at http://www.jtatesoftware.com/cracklib/. (jtate) -- Added mysql_info() function. (Jan) -- Added mysql_list_processes() and mysql_stat() functions. (Georg) -- Fixed memory allocation problem on systems that have iconv() support in libc. - (Yasuo) -- Made var_dump() handle recursive structures better. (Yasuo, Derick) -- Added exif_imagetype() function. (Marcus) -- New improved build system. Among other improvements, replaces the slow - recursive make with one global Makefile and eases the integration of proper - dependencies. Automake is only needed for its aclocal tool. The build - process is now more portable and less resource-consuming. (Sascha) - -06 Sep 2002, Version 4.2.3 -- Disabled the fifth parameter in mail() when safe-mode is turned on. (Derick) -- Enable UTF8 modifier support for PCRE on win32. (Wez, Edin) -- Enabled strcoll() on win32. (Markus) -- Fixed possible ASCII control char injection in mail(). (Stefan Esser) -- Fixed a potential crash bug in import_request_variables() (Zeev) -- Fixed several problems with directory functions on Windows. (Steph) -- Fixed xbithack bug in Apache module. (Rasmus) -- Fixed a bug that prevented touch() from working on various platforms. (Steph) -- Fixed ob_gzhandler()'s handling of requests that do have the Accept-Encoding - header, but do not allow compression. (Zeev) -- Fixed several bugs in the multithreaded version that could cause random parse - errors, especially on machines with multiple CPUs. (Zeev, Zend Engine) -- Fixed a build problem in bcmath. (Alan) -- Fixed several bzip2 issues. (Andrei, kalowsky) -- Fixed several COM issues. (Harald) -- Various exif fixes. (Marcus) -- Fixed domxml_xslt_process() and domxml_get_element_by_id() and several - other issues in DOMXML. (Christian) -- Fixed DOMXML crash on removing previously created attributes. (Christian) -- Fixed crash when converting $GLOBALS to an object. (Zeev, Zend Engine) -- Fixed ImageCreateFromGD2Part() (Jani) -- Fixed a build issue in the IMAP extension under IRIX. (kalowsky) -- Fixed a bug in imap_last_error() (Jani) -- Various mbstring fixes. (Yasuo, Rui) -- Fixed a build problem in the mcal extension. (Jani) -- Made MySQL rollback open transactions when the request ends. (Georg) -- Fixed a crash in the shutdown order of the ODBC module. (kalowsky) -- Fixed PCRE build problems. (troels@arvin.dk) -- Fixed a crash in pg_lo_write() (Yasuo) -- Fixed posix_isatty() and posix_ttyname(). (Markus) -- Fixed accidental pg_lo_import() API change. (Yasuo) -- Fixed ereg_replace() crash when the backreference number was greater than the - number of captured subpatterns. (oliver@billix.franken.de) -- Fixed array_rand() on thread-safe platforms such as Windows. (Edin) -- Report the right exit code after a call to exit(). (Edin) - -22 Jul 2002, Version 4.2.2 -- Fixed serious security vulnerability. (Stefan Esser) - -13 May 2002, Version 4.2.1 -- Added safe-mode checks to show_source(), parse_ini_file() and rmdir(). Also - fixed security problems with safe_mode_include_dir directive. (Rasmus) -- Changed HTTP upload code to accept 0 byte file uploads. (Zeev) -- Major update of domxml. New functions, better DOM compliance and bug fixes: - * Changed the old $node->append_child() to $node->append_sibling() since - the new append_child() behaves correctly (= W3C standard). - * Added domxml functions: - . domxml_elem_get_elements_by_tagname() - . domxml_doc_get_elements_by_tagname() - . domxml_doc_get_element_by_id() - . domxml_elem_remove_attribute() - . domxml_elem_get_attribute_node() - * Fixed a segfault in domxml_unlink(). - * Added formatting option to domxml_dump_mem(). - (Uwe, jtate, Chregu) -- Fixed a bug in socket_select() that could cause unexpected behavior when - using a statement like $w = $e = array($sock); This change unfortunately - prevents the use of constant values (e.g. NULL) for the socket array - paramaters. Instead, use a temporary variable or an expression with the - leftmost member being a temporary variable. ex.: - socket_select($w, $r, $e = NULL, 10); (Jason) -- Fixed crashes in the session serializer. (Stas) -- Fixed malformed atime/mtime with touch(). (Yasuo) -- Fixed a couple of bugs in array_sum() and array_merge(). (Andrei) -- Fixed SJIS directory name handling under Windows. (Rui) -- Fixed empty mb_output_handler() output when Content-Type is specified. - (Yasuo) -- Fixed the false logic in ext/session which made SID constant not to be - defined when cookies are disabled. (Sascha) -- Fixed possible crash bug in HTTP uploads. (Patch: Lucas Schroeder) -- Fixed possible NULL-pointer dereferencing in the COM extension which - caused 'Error in php_OLECHAR_to_char()' warnings on various places. - Also modified the API to consistently return NULL in case of an error. - (Alan, Harald) -- Fixed a bug in the COM extension that caused outproc servers to 'hang' - because of a missing Release() call. (Alan, Harald) - -22 Apr 2002, Version 4.2.0 -- ATTENTION!! register_globals defaults to 'off' now !!! -- Note: Apache2 support is EXPERIMENTAL. -- PostgreSQL functions are renamed, but all old function names are available. - Old function names will be available long enough. User can safely use old - function names. (Yasuo) -- Moved ext/mailparse to PECL. See http://thebrainroom.com/opensource/php/ - for more information and to download the extension. (Wez/Jim) -- Fixed pg_last_notice() crash. (Yasuo) -- Modified the mysql extension to disable 'LOAD LOCAL' when safe mode is - enabled. (Jason) -- Added CLI (command line interface) sapi which is more suitable for writing - shell scripts. Some of the differences to CGI sapi are: no HTTP headers, - plain text error messages, does not change working directory, have a new -r - option which executes a piece of PHP code directly from the commmand line, etc. - (Edin) -- Fixed HTTP file upload support to handle big files better. (Jani) -- Major modifications to the Sockets Extension and its API (Jason): - . Fixed numerous bugs. - . Added automatic host lookup capability to all functions that take addr's. - example: socket_connect($sock, 'www.yahoo.com', 80); - . Corrected and standardized host lookup errors - . Modified socket_recv() behavior. [$r=socket_recv($sock, $buf, $len, $flags)] - . Added socket_set_block() which changes a socket into blocking IO mode - . Modified socket_last_error() to not clear the last error - . Added socket_clear_error() which clears the last error on a socket - . Removed all code pertaining to fd_sets (socket_fd_*) - . Modified/Improved socket_select() to accept array of resources instead of - fd_sets. example: - -- Fixed segfault in ibase_close() if user does not free the resultset. - Bugs #15419, #15992. (daniela) -- Added optional 3rd parameter "int encoding_mode" to gzencode() and fixed - parameters to conform documentation. (Stefan) -- Changed read_exif_data() to be an alias of exif_read_data(). (Marcus) -- Added exif_tagname() function which returns the names of tags and - exif_thumbnail() function to extract embedded thumbnails. (Marcus) -- Fixed iconv support with FreeBSD. (kalowsky) -- Cleaned up the posix extension: (Markus) - . Removed unwanted warning messages - . Added posix_errno() and posix_strerror() for fetching error messages - . Changed the way posix_getgrnam() and posix_getgrgid() return their values - (breaks BC but makes more sense) - . Does not include functions in symbol table which aren't supported on host - system. -- Added TIFF support for getimagesize() and read_exif_data(). (Marcus) -- Changed the Velocis extension namespace to Birdstep to reflect new product - name. Added aliases for BC. (James) -- Added safe_mode checks for opendir(). (jflemer) -- Changed the 2nd parameter in pgsql_fetch_*() functions to support NULL if - all 3 parameters are supplied, but you do not want to provide a row number. - (Derick) -- Improved iconv() when using libc's iconv. (Yasuo) -- Added PHP_SAPI constant which contains the name of running SAPI. (Edin) -- Added ob_get_status() which returns an array of buffers with their status. - (Yasuo) -- Fixed a crash bug in ob_end_*() functions. ob_end_*() will not delete - buffers that may not be deleted. (Yasuo) -- Added 3rd parameter "bool erase" to ob_start(). If FALSE, the buffer may not - be deleted until script finishes. (Yasuo) -- Changed ob_*() functions to return TRUE for success, FALSE for failure. - (Yasuo) -- Added sybase_ct support to dbx module. (Marc) -- Fixed error message handling with PostgreSQL 7.2. (Rui) -- Added object aggregation capability, see aggregation_*() functions. (Andrei) -- Added debug_zval_dump() which works similarly to var_dump, but displays - extra internal information such as refcounts and true type names. (Jason) -- Added Andrei's tokenizer extension. (Stig) -- Fixed a bug in the COM extension which caused php to crash in - php_COM_get_ids_of_names(). (Paul, Harald) -- Removed ext/satellite. It is now part of PEAR. (eriksson) -- Changed php.ini directive 'safe_mode_include_dir' to accept a (semi)colon - separated path (like 'include_path') rather than a single directory. - (jflemer) -- Added is_a() function that can be used to test whether object is of a certain - class or is derived from it. (Andrei, Zend Engine) -- Added optional parameter to highlight_string() and highlight_file() which - makes these functions to return a highlighted string instead of dumping - it to standard output. (Derick) -- Added EXTR_IF_EXISTS and EXTR_PREFIX_IF_EXISTS flags to extract(). (Rasmus) -- Fixed a segfault in pg_pconnect(). If PostgreSQL server is restarted, broken - connection is detected and reconnected. (Yasuo) -- Fixed --enable-safe-mode configure option. (Yasuo) -- Added function domxml_dump_node($doc,$node). Dumps a node plus all children - into a string. (chregu) -- Added function domxml_node_get_content(). (chregu) -- Added function domxml_dump_file($filename,[$compression]). Dumps XML to - a file and uses compression, if specified. (chregu) -- Added exslt integration to domxml extension (http://exslt.org for details). - Configure with --with-dom-exslt[=DIR] (and --with-dom-xslt). - (chregu,jaroslaw) -- Fixed session_unset() to not touch any globals if register_globals is off. - (Thies) -- Added 3 new optional parameters to OCIFetchStatement(). They control - the number of rows to skip at the beginning of the cursor, the - maximun numer of rows that should be fetched and the format of the - returned array. (Thies) -- Updated the XSLT extension to support Sablotron 0.8. (Petr Cimprich) -- Fixed a bug in preg_match() and preg_match_all() when matching strings - contain null bytes. (Andrei) -- Added xpath_register_ns() function. This makes it possible to issue XPath - queries with namespaces like for example: "//namespace:sampletag". - (Chris Jarecki) -- Added multi-byte enabled regular expression functions. (Rui) -- Added optional second parameter to count() which can be used to specify - either normal or recursive counting. (patch by Vlad Bosinceanu ) -- Added mb_get_info() to get internal settings of mbstring. (Rui) -- Added async query functions to PostgreSQL module. (Yasuo) -- Added pg_copy_to()/pg_copy_from() for PostgreSQL module. (Youichi, Yasuo) -- Added IPv6 support for FTP extension. (Stig Venaas) -- Improved the speed of wordwrap() significantly. (Jim) -- Fixed pow()'s incorrect behaviour when dealing with powers of 0. (Jim) -- Added is_finite(), is_infinite() and is_nan(). (Jim) -- Fixed segfault in wordwrap() when wrapping to zero width and using - multi-character break or trying to force cut (bug #12768). (Jim) -- Fixed several bugs in dbase extension (dbase_pack() truncate file to right - size, fix 6852 #1 and 6852 #2). (Vlad) -- Fixed bug in krsort() where an extra character was being compared. (Andi) -- Fixed bug that made pspell include pspell.h from a wrong location. (Vlad) -- Added function overload in mbstring to add multibyte support for - string and mail functions. (Rui) -- Added flags parameter to preg_grep(). The only flag currently is - PREG_GREP_INVERT that will make the function return entries that - did not match. (Andrei) -- Fixed several crash bugs in the xslt extension. (Markus, Derick) -- Fixed problem with dbase not returning very large (larger than long) - integers properly. (Vlad) -- Added concepts to IRCG: bailout-on-trivial issue, write output to - files, fetch a resource upon connection end. (Sascha) -- Fixed POST-related bugs in thttpd, added QUERY_STRING, HTTP_HOST, - HTTP_ACCEPT_LANGUAGE to the script environment, improved patch - to send correct MIME types, and added support for /nocache/. (Sascha) -- Fixed several bugs and memleaks in the domxml extension. (Markus) -- Added var_export() which outputs a representation of a variable as reusable - PHP code. (Derick) -- Added -w option to the CGI-version to strip all comments and whitespace - from the script. (Thies) -- Added support for SO_RCVTIMEO and SO_SNDTIMEO to ext/sockets. (Jason) -- Added ob_get_level() which returns the nesting level of the output buffering - mechanism. (Yasuo, Derick) -- Added ob_flush() and ob_clean() functions which flush and clean an output - buffer without destroying the buffer. (Derick) -- Added new optional parameter to mysql_connect() which forces a new database - link to be created. (Markus, Derick) -- Added ldap_sort() function. (Stig Venaas) -- Added md5_file() function which calculates the MD5 sum of a file. - Patch by Alessandro Astarita (Derick) -- Added support for parsing recordsets contained in WDDX packets. (Andrei) -- Renamed key_exists() to array_key_exists(). (Derick) -- Fixed ImageColorsForIndex() and ImageColorAt() to work for TrueColor - images. (Rasmus) -- Added support for bind_textdomain_codeset(). (rudib@email.si) -- Added generic Win 32 API extension. (jmoore) -- Removed warning message about NONEXISTENT character set from mysql_connect() - when the server's default character set != latin1. (Mysql Team) -- Added Direct I/O extension for lowlevel access to the POSIX layer. (Sterling) -- Added SAPI module for the WebJames server on RISC OS. (Alex Waugh) -- Fixed ldap_add() and ldap_modify() functions to throw a warning with illegal - value arrays. Previously segfaulted or added wrong value. (Stig Venaas) -- Added udm_check_charset() function into mnoGoSearch extension. (gluke) -- Fixed mnoGoSearch extension to support mnogosearch-3.2.x. (gluke) -- Made fbsql_num_rows() to return the correct value on all select statements. - (Frank) -- Added array_chunk() function which splits an array into chunks of specified - size. (Andrei) -- Fixed $HTTP_RAW_POST_DATA to be populated on a missing content-type when - always_populate_raw_post_data is on. (Rasmus) -- Added session_cache_expire() function. (patch by anuradha@gnu.org) (Andrei) -- Added array_fill() function. (Rasmus) -- Made Authorization header to be hidden from phpinfo() output in safe_mode. - (Rasmus) -- Re-instated safe-mode realm mangling. (Rasmus) -- Fixed a bug in preg_replace() that would change the type of the replacement - array entries to string. (Andrei) -- Added user-space object overloading extension. (Andrei) -- Added ldap_start_tls() function. (Stig Venaas, patch by kuenne@rentec.com) -- Changed rand() and mt_rand() to be seed automatically if srand() or - mt_srand() has not been called. (Sterling) -- Changed the seed options to srand() and mt_srand() to be optional. If the - seed is not specified the most random seed possible is generated. (Sterling) -- Added array_change_key_case() function which returns an array with all - string keys lowercased or uppercased. (Edin) -- Added parameter to ircg_pconnect to suppress treating non-fatal errors - as fatal, and added conversion of Windows quotes to ". (Sascha) -- Added pcntl_exec() function which behaves similar to the system execve. - (Jason) -- Fixed segfault and check for truecolor image in ImageColorAt(). (Rasmus) -- Fixed nl2br() to handle all styles of line-endings in one string. - (Boian, Derick) -- Added mcrypt_generic_deinit() to replace mcrypt_generic_end(). (Derick) -- Added apache_setenv() function for injecting variables into Apache's - subprocess_env table. (Rasmus) -- Added support for 'int', 'bool', 'float' and 'null' in settype(). (Jeroen) -- Added IPv6 support to gethostbyaddr(). - (Patch by Matthias Wimmer and venaas) -- Fixed LONG_VARCHAR type crashing in ODBC extension. Patch by Walter Franzini. - (kalowsky) -- Changed in_array() and search_array() to allow the needle to be an array - in itself. (Andrei) -- Added ini_get_all() function which returns all registered ini entries - or entries for the specified extension. (Jani) -- Added mailparse_uudecode_all() which extracts all uuencoded attachments. - (Wez) -- Added support for chinese encodings in htmlentities() and htmlspecialchars(). - (Patch by Alan Knowles and Wez) -- Improved support for autoconf-2.50+/libtool 1.4b+. (Jan Kneschke, Sascha) - -27 Feb 2002, Version 4.1.2 -- Fixed start up failure when mm save handler is used and there are multiple - SAPIs working at the same time. (Yasuo) -- Fixed the Roxen SAPI. (Yasuo) -- Fixed a buffer overflow in the RFC-1867 file upload code. (Stefan) -- Fixed a crash bug in the session module. (Yasuo) -- Fixed a crash bug in the pspell module. (Yasuo) -- Changed the default output encoding of mbstring 'pass' to fix - initialization problem. (Rui) - -26 Dec 2001, Version 4.1.1 -- Fixed incompatibility with Windows .NET / IIS 6 - may improve stability - under other versions of IIS. (Zeev) -- Fixed bug that caused crashes or error notices on shutdown on threaded - platforms. (Zeev) -- Fixed several crash bugs in the xslt extension. (Markus, Derick) -- Fixed problem with dbase not returning very large (larger than long) - integers properly. (Vlad) -- Fixed several bugs and memleaks in the domxml extension. (Markus) -- Fixed bug in gmmktime() which was one hour off during standard time - - bug #9878. Patch by bfoddy@mediaone.net. (jmoore) -- Fixed bug in gmdate() timezone handling on Windows - bug #13885. (jmoore) -- Fixed several crash bugs in the mcrypt extension. (Derick) -- Made the mcrypt extension compile with the libmcrypt 2.2 series again. - (Sterling) -- Fixed a bug where the is_file() family of functions would in-correctly give - an error when they were given filenames that didn't exist. (Sterling) -- Fixed a bug in the strtotime() function where it was incorrectly recognizing - GMT +0100 and GMT -0100. (Derick) - -10 Dec 2001, Version 4.1.0 -- Fixed return values for strtok (Bug #13866) (jmoore) -- Worked around a bug in the MySQL client library that could cause PHP to hang - when using unbuffered queries. (Zeev) -- Fixed a bug which caused set_time_limit() to affect all subsequent requests - to running Apache child process. (Zeev) -- Removed the sablotron extension in favor of the new XSLT extension. - (Sterling) -- Fixed a bug in WDDX deserialization that would sometimes corrupt the root - element if it was a scalar one. (Andrei) -- Make ImageColorAt() and ImageColorsForIndex() work with TrueColor images. - (Rasmus) -- Fixed a bug in preg_match_all() that would return results under improper - indices in certain cases. (Andrei) -- Fixed a crash in str_replace() that would happen if search parameter was an - array and one of the replacements resulted in subject string being empty. - (Andrei) -- Fixed MySQL extension to work with MySQL 4.0. (Jani) -- Fixed a crash bug within Cobalt systems. Patch by tomc@tripac.com. (Jani) -- Bundled Dan Libby's xmlrpc-epi extension. -- Introduced extension version numbers. (Stig) -- Added version_compare() function. (Stig) -- Fixed pg_last_notice() (could cause random crashes in PostgreSQL - applications, even if they didn't use pg_last_notice()). (Zeev) -- Fixed DOM-XML's error reporting, so E_WARNING errors are given instead of - E_ERROR error's, this allows you to trap errors thrown by DOMXML functions. - (Sterling) -- Fixed a bug in the mcrypt extension, where list destructors were not - properly being allocated. (Sterling) -- Better Interbase blob, null and error handling. (Patch by Jeremy Bettis) -- Fixed a crash bug in array_map() if the input arrays had string or - non-sequential keys. Also modified it so that if a single array is passed, - its keys are preserved in the resulting array. (Andrei) -- Fixed a crash in dbase_replace_record. (Patch by robin.marlow@dps-int.com) -- Fixed a crash in msql_result(). (Zeev) -- Added support for single dimensional SafeArrays and Enumerations. - Added com_isenum() function to check if a component implements an - enumeration. (Alan, Harald) -- Fixed a bug in dbase_get_record() and dbase_get_record_with_names(). - boolean fields are now returned correctly. - Patch by Lawrence E. Widman (Jani) -- Added --version option to php-config. (Stig) -- Improved support for thttpd-2.21b by incorporating patches for all known - bugs. (Sascha) -- Added ircg_get_username, a roomkey argument to ircg_join, error fetching - infrastructure, a tokenizer to speed up message processing, and fixed - a lot of bugs in the IRCG extension. (Sascha) -- Improved speed of the serializer/deserializer. (Thies, Sascha) -- Floating point numbers are better detected when converting from strings. - (Zeev, Zend Engine) -- Replaced php.ini-optimized with php.ini-recommended. As the name implies, - it's warmly recommended to use this file as the basis for your PHP - configuration, rather than php.ini-dist. (Zeev) -- Restore xpath_eval() and php_xpathptr_eval() for 4.0.7. There - are still some known leaks. (Joey) -- Added import_request_variables(), to allow users to safely import form - variables to the global scope (Zeev) -- Introduced a new $_REQUEST array, which includes any GET, POST or COOKIE - variables. Like the other new variables, this variable is also available - regardless of the context. (Andi & Zeev) -- Introduced $_GET, $_POST, $_COOKIE, $_SERVER and $_ENV variables, which - deprecate the old $HTTP_*_VARS arrays. In addition to be much shorter to - type - these variables are also available regardless of the scope, and - there's no need to import them using the 'global' statement. (Andi & Zeev) -- Added vprintf() and vsprintf() functions that allow passing all arguments - after format as an array. (Andrei) -- Added support for GD2 image type for ImageCreateFromString(). (Jani) -- Added ImageCreateFromGD(), ImageCreateFromGD2(), ImageCreateFromGD2part(), - ImageGD() and ImageGD2() functions. (Jani) -- addcslashes now warns when charlist is invalid. The returned string - remained the same (Jeroen) -- Added optional extra argument to gmp_init(). The extra argument - indicates which number base gmp should use when converting a - string to the gmp-number. (Troels) -- Added the Cyrus-IMAP extension, which allows a direct interface to Cyrus' - more advanced capabilities. (Sterling) -- Enhanced read_exif_data() to support multiple comment tags. (Rasmus) -- Fixed a crash bug in array_map() when NULL callback was passed in. (Andrei) -- Change from E_ERROR to E_WARNING in the exif extension (Rasmus) -- New pow() implementation, which returns an integer when possible, - and warnings on wrong input (jeroen) -- Added optional second parameter to trim, chop and ltrim. You can - now specify which characters to trim (jeroen) -- Hugely improved the performance of the thread-safe version of PHP, especially - under Windows (Andi & Zeev) -- Improved request-shutdown performance significantly (Andi & Zeev, Zend - Engine) -- Added a few new math functions. (Jesus) -- Bump bundled expat to 1.95.2 (Thies) -- Improved the stability of OCIPlogon() after a database restart. (Thies) -- Fixed __FILE__ in the CGI & Java servlet modes when used in the main script. - It only worked correctly in included files before this fix (Andi) -- Improved the Zend hash table implementation to be much faster (Andi, Zend - Engine) -- Updated PHP's file open function (used by include()) to check in the calling - script's directory in case the file can't be found in the include_path (Andi) -- Fixed a corruption bug that could cause constants to become corrupted, and - possibly prevent resources from properly being cleaned up at the end of - a request (Zeev) -- Added optional use of Boyer-Moore algorithm to str_replace() (Sascha) -- Fixed and improved shared-memory session storage module (Sascha) -- Add config option (always_populate_raw_post_data) which when enabled - will always populate $HTTP_RAW_POST_DATA regardless of the post mime - type (Rasmus) -- Added support for socket and popen file types to ftp_fput (Jason) -- Fixed various memory leaks in the LDAP extension (Stig Venaas) -- Improved interactive mode - it is now available in all builds of PHP, without - any significant slowdown (Zeev, Zend Engine) -- Fixed crash in iptcparse() if the supplied data was bogus. (Thies) -- Fixed return value for a failed snmpset() - now returns false (Rasmus) -- Added hostname:port support to snmp functions (nbougues@axialys.net, Rasmus) -- Added fdf_set_encoding() function (Masaki YATSU, Rasmus) -- Reversed the destruction-order of resources. This fixes the reported OCI8 - "failed to rollback outstanding transactions!" message (Thies, Zend Engine) -- Added option for returning XMLRPC fault packets. (Matt Allen, Sascha - Schumann) -- Improved range() function to support range('a','z') and range(9,0) types of - ranges. (Rasmus) -- Added getmygid() and safe_mode_gid ini directive to allow safe mode to do - a gid check instead of a uid check. (James E. Flemer, Rasmus) -- Made assert() accept the array(&$obj, 'methodname') syntax. (Thies) -- Made sure that OCI8 outbound variables are always zero-terminated. (Thies) -- Fixed a bug that allowed users to spawn processes while using the 5th - parameter to mail(). (Derick) -- Added nl_langinfo() (when OS provides it) that returns locale. -- Fixed a major memory corruption bug in the thread safe version. (Zeev) -- Fixed a crash when using the CURLOPT_WRITEHEADER option. (Sterling) -- Added optional suffix removal parameter to basename(). (Hartmut) -- Added new parameter UDM_PARAM_VARDIR ha in Udm_Set_Agent_Param() function to - support alternative search data directory. This requires mnogoSearch 3.1.13 - or later. -- Fixed references in sessions. This doesn't work when using the WDDX - session-serializer. Also improved speed of sessions. (Thies) -- Added new experimental module pcntl (Process Control). (Jason) -- Fixed a bug when com.allow_dcom is set to false. (phanto) -- Added a further parameter to the constructor to load typelibs from file when - instantiating components (e.g. DCOM Components without local registration). - (phanto) -- Added the possibility to specify typelibs by full name in the typelib file - (Alan Brown) -- Renamed the ZZiplib extension to the Zip extension, function names have also - changed accordingly, functionality, has stayed constant. (Sterling) -- Made the length argument (argument 2) to pg_loread() optional, if not - specified data will be read in 1kb chunks. (Sterling) -- Added a third argument to pg_lowrite() which is the length of the data to - write. (Sterling) -- Added the CONNECTION_ABORTED, CONNECTION_TIMEOUT and CONNECTION_NORMAL - constants. (Zak) -- Assigning to a string offset beyond the end of the string now automatically - increases the string length by padding it with spaces, and performs the - assignment. (Zeev, Zend Engine) -- Added warnings in case an uninitialized string offset is read. (Zeev, Zend - Engine) -- Fixed a couple of overflow bugs in case of very large negative integer - numbers. (Zeev, Zend Engine) -- Fixed a crash bug in the string-offsets implementation (Zeev, Zend Engine) -- Improved the implementation of parent::method_name() for classes which use - run-time inheritance. (Zeev, Zend Engine) -- Added 'W' flag to date() function to return week number of year using ISO - 8601 standard. (Colin) -- Made the PostgreSQL driver do internal row counting when iterating through - result sets. (gvz@2scale.net) -- Updated ext/mysql/libmysql to version 3.23.39; Portability fixes, minor - bug fixes. (tim@mysql.com) -- Added get_defined_constants() function to return an associative array of - constants mapped to their values. (Sean) -- New mailparse extension for parsing and manipulating MIME mail. (Wez) -- Define HAVE_CONFIG_H when building standalone DSO extensions. (Stig) -- Added the 'u' modifier to printf/sprintf which prints unsigned longs. - (Derick) -- Improved IRIX compatibility. (Sascha) -- Fixed crash bug in bzopen() when specifying an invalid file. (Andi) -- Fixed bugs in the mcrypt extension that caused crashes. (Derick) -- Added the IMG_ARC_ROUNDED option for the ImageFilledArc() function, which - specified that the drawn curve should be rounded. (Sterling) -- Updated the sockets extension to use resources instead of longs for the - socket descriptors. The socket functions have been renamed to conform with - the PHP standard instead of their C counterparts. The sockets extension is - now usable under Win32. (Daniel) -- Added disk_total_space() to return the total size of a filesystem. - (Patch from Steven Bower) -- Renamed diskfreespace() to disk_free_space() to conform to established - naming conventions. (Jon) -- Fixed #2181. Now zero is returned instead of an unset value for - 7-bit encoding and plain text body type. (Vlad) -- Fixed a bug in call_user_*() functions that would not allow calling - functions/methods that accepted parameters by reference. (Andrei) -- Added com_release($obj) and com_addref($obj) functions and the related class - members $obj->Release() and $obj->AddRef() to gain more control over the used - COM components. (phanto) -- Added an additional parameter to dotnet_load to specify the codepage (phanto) -- Added peak memory logging. Use --enable-memory-limit to create a new Apache - 1.x logging directive "{mod_php_memory_usage}n" which will log the peak - amount of memory used by the script. (Thies) -- Made fstat() and stat() provide identical output by returning a numerical and - string indexed array. (Jason) -- Fixed memory leak upon re-registering constants. (Sascha, Zend Engine) - -23 Jun 2001, Version 4.0.6 -- Fixed memory fragmention problem which could lead to web server processes - growing much more than they should. (Andi, Zend Engine) -- Made $HTTP_SESSION_VARS['foo'] and $foo be references to the same value - when register_globals is on. (Andrei) -- Fixed disk_free_space() and disk_total_space() under FreeBSD. (Jon) -- Fixed readfile/passthru losing resources during connection abort (Sascha) -- Fixed bug in the mcrypt extension that caused segfaults when using a key - that is too large for the used algorithm, and a bug that caused - mcrypt_generic() to segfault PHP (Derick) -- Fixed getopt so that it accepts command line arguments in the form - - and - . (Jmoore) -- Fixed race in writing session files (Sascha) -- Fixed a possible crash in the PHP CGI when no input file is - specified (Zeev) -- Added is_callable() function that can be used to find out whether - its argument is a valid callable construct. (Andrei) -- Fixed a rare possible crash when generating extended information. (Dmitri - Dmitrienko, Zend Engine) -- Improved virtual() to support PHP-enabled URIs. (Zeev) -- Fixed undefined behavior when using floating point keys in array() - expressions. (Zeev, Zend Engine) -- Fixed a possible crash in case of parse errors in include files or eval - statements. (Zeev, Zend Engine) -- Added --with-layout configure option. (Stig) -- Improved interactive mode - supports function calls, and works in - multithreaded builds. (Zeev, Zend Engine) -- Fixed a crash bug in interactive mode. (Zeev, Zend Engine) -- Added pg_last_notice() function. (Rasmus from suggestion by Dirk@rackspace.com) -- Fixed a bug in preg_split() that would incorrectly limit the number of - results when used along with PREG_SPLIT_NO_EMPTY flag. (Andrei) -- Added connection error support to mysql_error() and mysql_errno(). (Jason) -- Added support to getimagesize to return dimensions of BMP and PSD - files. (Derick) -- Added heuristic to kill stale IRC connections, message scanner caching, and - nickname escaping to IRCG, suppress option to ircg_msg(), and statistics to - IRCG phpinfo() output. (Sascha) -- Added Japanese multibyte string functions support. (Rui) -- Added Mac OS X "\r" line ending support. (Andi, Zend Engine) -- Fixed a bug regarding the $PHP_SELF being incorrectly registered when - force-cgi-redirect was not enabled. (Sterling) -- pfpro extension now supports version 3 of the Verisign SDK. (John Donagher) -- Udm_Cat_List and Udm_Cat_Path functions has been added. -- Added key_exists() to check if a given key or index exists in an - array or object. (David Croft) -- Modify the cURL extension to compile only with the latest cURL release. - Backwards compatibility with regards to the extension api has not been - broken. (Sterling) -- Added the ability to use user-defined callbacks with cURL. (Sterling) -- Added the SSL_VERIFYPEER, CAINFO, MAXREDIRS, FILETIME, RANDOM_FILE, EGDSOCKET - and CONNECTTIMEOUT options to curl_setopt(). (Sterling) -- Added support for persistent connections with cURL. (Sterling) -- Fixed a problem in cURL with file descriptors being allocated, but never - closed. (Sterling) -- Fixed interactive mode (-a). It works again with the same limitations it - has always had. (Andi, Zend Engine) -- Improved memory manager to use less memory and provide better memory overflow - detection abilities in debug mode. (Andi, Zend Engine) -- Fixed resource leaks when resources were being cast to numbers. (Zeev, Zend - Engine) -- Fixed foreach() to not crash when being sent an invalid argument. (Andi, Zend - Engine) -- Fixed a bug in opendir() under Windows when trying to open a non-exisiting - directory. (Andi) -- Fixed popen() and the exec family under Win32 (Unable to fork issue). (Daniel) -- Make the printf family of functions binary clean. (Rasmus) -- Fixed WDDX serialization to HTML-escape key/variable names so as not to - break the XML packet. (Andrei) -- Made WDDX extension enabled by default. (Andrei) -- Added -C command-line option to avoid chdir to the script's directory. (Stig) -- Fixed a bug with /e modifier in preg_replace(), that would not correctly - replace two-digit references if single digit references were present - before them. This fixed bug #10218. (Andrei) -- Added temporary LOB support in OCI8. (Patch by David Benson) -- Fixed crash in pathinfo() -- OCI8 now supports binding of collections. (Patch by Andy Sautins - ) -- Added GD 2.0.1 support for truecolor and alpha channels, plus some other gd - functions, both old and new - see docs for more info. (Wez) -- Added S/MIME sign/verify encrypt/decrypt functions to openssl extension, - along with some other certificate manipulation and interrogation functions. - See docs for more info. (Wez) -- printf argnum (parameter swapping) support. (Morten Poulsen, Rasmus) -- Add DIRECTORY_SEPARATOR constant ('/' on UNIX, '\' on Windows). (Stig) -- Added small change to php_odbc module, to check for failed SQLDisconnects - and to close any outstanding transactions if the call fails, then disconnect - again. (lurcher) -- Modified get_parent_class() and get_class_methods() to accept a class name as - well as a class instance. (Andrei, Zend Engine) -- Added support for UNC style paths. (\\server\share\file, - //server/share/file). (Daniel, TSRM) -- Added dbx module (database abstraction) to the repository. (Marc) -- Using ITypeInfo instead of IDispatch if possible. This makes DCOM calls - and even COM calls much faster. - All ini settings are now prefixed by 'com.'. - Now you need not provide a path to the file containing the typelib, you can - also provide the GUID of the TypeLib - entry or an IID for preloading - type - information. (Harald) -- Rewrite of domxml. It's now mostly DOM Level 2 conform. (Uwe) -- Added array_map() function that applies a callback to the elements - of given arrays and returns the result. It can also be used with a - null callback to transpose arrays. (Andrei) -- Added array_filter(), which allows filtering of array elements via - the specified callback. (Andrei) -- Fixed all relevant array functions to avoid moving the internal array - pointer during operations. (Andrei) -- Added mysql_unbuffered_query(), which is useful for very large result sets. - (Zeev) - -30 Apr 2001, Version 4.0.5 -- Added new php.ini directive: arg_separator.input which is used to tell - PHP which characters are considered as argument separators in URLs. - Renamed php.ini directive: arg_separator -> arg_separator.output (Jani) -- Added FastCGI SAPI module. (Ben Mansell) -- Added array_reduce(), which allows iterative reduction of an array - to a single value via a callback function. (Andrei) -- The imageloadfont function of the gd extension should be not platform - dependent after this fix. (alex@zend.com) -- Fixed a compatibility problem in some file functions (fgets, fputs, fread, - fwrite). The ANSI standard says that if a file is opened in read/write - mode, fseek() should be called before switching from reading to writing - and vice versa. (alex@zend.com) -- Fixed argument checking for call_user_func* functions and allowed - specifying array($obj, 'method') syntax for call_user_func_array. (Andrei) -- Fixed parent::method() to also work with runtime bindings. - (Zeev, Zend Engine) -- Implemented high-performance zlib-based output compression - see - zlib.output_compression INI directive. (Zeev) -- Improved ob_gzhandler() to support chunked output buffering - it's - recommended to use it with 4KB chunks. (Zeev) -- Fixed chunked output buffering. (Zeev) -- Forced call_user_method() and call_user_method_array() to take the - object argument by reference. (Andrei) -- Fixed binding of ROWIDs in OCI8. (Thies) -- Added PEAR/Cache as a generic Caching System. (Sebastian, PEAR/Cache) -- Added IMAP quota support (imap_set_quota, imap_get_quota), enabled/added via - c-client2000. (kalowsky) -- Upgraded PCRE to version 3.4. (Andrei) -- Added array_search which works similar to in_array but returns - the key instead of a boolean. (jason@php.net) -- Fixed pgsql transaction support. (Stig, PEAR/DB) -- Added new object VARIANT() to encapsulate values for use with - the COM and DOTNET module. Therefore it is now possible to pass - values by reference, convert php values to extended variant types (currency, - date, idispatch, iunknown, ...) and define the codepage that should - be used for unicode - conversion. -- Improved overall speed of IRCG, added URL handling to message scanner. - (Sascha) -- Fixed some modules to allow using output-buffering. (Thies) -- Added the chroot() function. (Derick) -- PostgreSQL now does a rollback at the end of a request on every - persistent connection. This is done by doing an "empty" transaction - on the connection. This was advised by someone from the PostgreSQL - core-team. (Thies) -- Fixed PostgeSQL pg_connect() bug. We would sometimes close the default - link by accident. (Patch by: aja@nlgroup.ca) -- Improved OCI8 dead-session detection. (Patch by: George Schlossnagle) -- Fixed get_meta_tags() multiline bug #4556. (Sean) -- Prefer random() over *rand48(). (JimJag) -- Sped up WDDX serialization 2x. (Andrei) -- Added a new parameter to mail() which appends aditional command line - parameters to the mail program. (Derick) -- Added Udm_Clear_Search_Limits mnoGoSearch extension function. (gluke) -- Fixed mnogosearch protos. Fixed mnogosearch functions return values. - A bug with capital letters break search has been fixed. (gluke) -- Static methods can now be called via call_user_method_* functions, e.g. - call_user_method('method', 'class'), and also array('class', 'method') - constructs (for array_walk(), for example). (Andrei, Zend Engine) -- microtime() under Windows now returns accurate values. (James) -- Added PREG_SPLIT_DELIM_CAPTURE flag to preg_split() that allows for Perl-like - functionality of capturing parenthesized delimiter expression. (Andrei) -- Fixed strip_tags() to not strip a lone > character. (Rasmus) -- When using the ob_gzhandler() PHP now automagically also sets the - Content-Lengh correctly which enables browsers to use the HTTP - Keep-Alive feature. (Thies) -- Improved handling of preg_replace() /F modifier so that it's possible to - specify array($obj, 'method') construct as a replacement function. (Andrei) -- Added mysql_get_client_info(), mysql_get_server_info(), - mysql_get_proto_info(), and mysql_get_host_info() functions. (Sean) -- Major change of the php pdf api. It could break some functions though - backwards compatibility was tried to maintain. Adding some still - missing functions as well. (Uwe) -- Added mnoGoSearch extension - http://search.mnogo.ru. (Sergey K) -- Allow URL encoding in DB usernames and passwords. (Stig, PEAR) -- Added raiseError and setErrorHandling methods to PEAR class. (Stig, PEAR) -- Added support for converting images from JPG/PNG on the fly with the GD - extension, which is usefull for creating dynamic WAP-sites. (Derick) -- Updated ext/mysql/libmysql to version 3.23.32; bug fixes. (tim@mysql.com) -- Fixed possible crash in all (non-pcre) regex functions. (Thies) -- Improved str_replace() to accept an array for any parameter - similar - to preg_replace(). (Andrei) -- Fixed extract() to properly prefix numeric keys when EXTR_PREFIX_ALL is - used. (Andrei) -- Added EXTR_PREFIX_INVALID flag to extract() to automatically prefix - string keys that do not constitute valid variable names. (Andrei) -- BeOS patch from svanegmond@bang.dhs.org, modified somewhat by Rasmus. -- Fixed the Apache module to overwrite PATH_TRANSLATED with SCRIPT_FILENAME, - only if PATH_TRANSLATED is not previously set. (Zeev) -- Fixed crash bug in highlight_string(). (Rasmus) -- Added URL support for getimagesize() function. (Jani) -- Added xslt_set_scheme_handler() function. (carmelo@akooe.com) -- Added the pg_lolseek and pg_lotell functions. (Derick) -- Fixed wrong breaking with the wordwrap function. (Derick) -- Fixed 'O' and 'r' flags of date() to have correct sign for timezone - offset. (Andrei) -- Changed 'Z' flag to date() to always return timezone offset with - negative sign if it's west of UTC. (Andrei) -- Added the HTML_Processor class which provides common functions for - processing HTML. (Sterling) -- Added localeconv() and strcoll() functions for localization. (Sean) -- Added the xslt_set_base function. (Sterling) -- Added support for Zeus 3.3.8. -- Added odbc_error() and odbc_errormsg() functions. (Stig) -- New extension for vpopmail - http://www.inter7.com/vpopmail, - give it a try, but keep in mind that it is not ready for production - environments. (David Croft, Boian Bonev) -- Added sybase_get_last_message() to the Sybase CT module. (Jan Fedak) -- Made ldap_list(), ldap_read() and ldap_search() do parallel search when - first parameter is an array of link identifiers. (Stig Venaas) -- Made fopen() of HTTP URL follow redirects, $http_response_header will - contain all headers with empty string as delimiter. (Stig Venaas) -- Added Console_Getopt class for parsing command-line args. (Andrei, PEAR) -- Added an experimental version of the ZZipLib extension which provides the - ability to read zip files. (Sterling) -- Allow access to uploaded files in safe_mode. Beware that you can only - read the file. If you copy it to new location the copy will not have the - right UID and you script won't be able to access that copy. (Thies) -- Changed extract() to check that prefixed name is a valid one. (Andrei) -- Changed extract() to return the number of variables extracted. (Andrei) -- Added ldap_rename() function. (Stig Venaas) -- Made ldap_set_option() support controls. (Stig Venaas) -- Changed ldap_search() and added functions ldap_parse_result(), - ldap_first_reference(), ldap_next_reference() and ldap_parse_reference() - to cope with LDAPv3 stuff like referrals and references. (Stig Venaas) -- Fixed date('r') overflow. -- Made the php.ini path reported in phpinfo() always point to the absolute - path that was opened. (Zeev) -- Made the INI mechanism thread safe. (Zeev, Zend Engine) -- Changed setlocale() to use LC_* constants. (Jani) -- ctype functions now follow the extension naming conventions. (Hartmut) -- Added iconv() function (using libc or libiconv). (Stig) -- Added ODBC_TYPE constant. (Stig) -- Added the call_user_method_array function which allows you to call a method - with an arbitrary number of parameters. (Sterling) -- ext/odbc: IBM DB2 patch by Walter Franzini. -- Added extension for the cracklib library. (Alexander Feldman) - -19 Dec. 2000, Version 4.0.4 -- Allow assigning a newly created object by reference. This is needed only if - your constructor makes other data structures reference the $this object (for - example, $GLOBALS["foobar"] =& $this;) - The new syntax is $obj =& new MyClass(); (Andi, Zend Engine) -- Allow for three expression types to be sent to functions which are requesting - the function argument to be passed by reference (only c. was previously - supported): - a. func(new myclass()); - b. func(func2()); where func2() returns a reference, i.e. is defined as - function &func2(...) - { - ... - } - c. func($var); where func() is defined as function func(&$var) {...} - You CAN'T count on any other expressions to be passable by reference. - (Andi, Zend Engine) -- Made ldap_get_entries() return an array even if there are no entries - in search result. (Jani) -- Fixed bad mod_perl interaction which caused segfaults when using LFS (Sascha) -- const CONSTNAME now gets recognized. Before the patch only @const CONSTNAME - description was recognized. -- Added the is_null() function that will return true if a variable is of - type null. (Sterling) -- Fixed a bug which made readdir() unusable in some systems. (Jani) -- Added the get_defined_functions() function which returns a list of all - currently defined functions. (Sterling) -- Added the get_defined_vars() function which returns an associative array - of all variables defined in the current scope and their subsequent values. - (Sterling) -- Added the call_user_func_array() function which gives you the ability to - call a user function by passing an array of parameters as the second - argument. (Sterling) -- Added the constant() function which returns the value of a constant given - the constant's name. (Sterling) -- Implemented support for Perl-style matching regexp delimiters in PCRE. - You can use <{[( and )]}> to delimit your expressions now. (Andrei) -- Introduced new 'F' modifier in PCRE that lets you specify a function - name in the replacement argument to preg_replace() that will be called - at run-time to provide the replacement string. It is passed an array of - matched pattern and subpatterns. (Andrei) -- Put an end to BUG#4615 (kalowsky & Eric Veldhuyzen) -- Added the IRCG extension (Sascha) -- Fixed realpath() in Virtual Directory mode (Daniel) -- Integrated the Phil Nelson's bc math library routines into PHP, now that - the license allows it (Phil Nelson ) -- Added the xslt_set_error_handler() function to the Sablotron extension. - (Sterling) -- Improved Sablotron's error handling system allowing you to catch all - errors before they are outputted to the screen. (Sterling) -- Added OpenSSL extension (Stig Venaas) -- Fixed/created support for Solid 3.0 databases (kalowsky) -- Fixed support for Solid 2.3 databases (kalowsky) -- quoted_printable_decode() function is made RFC-2045 compliant. (Kir) -- Modified preg_grep() to always return the results with keys from the original - array. (Andrei) -- Modified preg_replace() to accept Perl-style $n backreferences in addition - to \\n ones. (Andrei) -- Modified preg_replace() to ignore backreferences that refer to - non-existing subpatterns. (Andrei) -- Fixed column-title buffer-overflow in OCIFetchStatement(). (Thies) -- Added 'output_handler' INI directive (Zeev) -- Fixed some buglets in the output buffering mechanism (Zeev) -- Added transparent gzip compression support (Jade Nicoletti, Zeev) -- Major overhaul of domxml. Added basic XPath support as well (Uwe) -- Added 'r' flag to date() which generates an RFC822 formatted date, e.g. - "Thu, 9 Nov 2000 16:33:01 -0500" (Colin) -- In CGI mode, $HTTP_SERVER_VARS now includes all of the environment variables - as well (Zeev) -- Allow user to use mysql_use_result in mysql queries (Stas) -- Fixed a memory leak that would occur when restarting Apache often - (mookid@sigent.ru) -- Fixed a bug that prevented $argv and $argc from being defined in the command - line version of PHP (Stas) -- Fixed a bug that prevented a changed compile-time extension_dir from - affecting modules that were loaded via php.ini (Zeev) -- Fixed a bug in ftp_mkdir() when used on ftp server which doesn't return - the full path (Jani) -- Added ImageCreateFromString() which creates an image stream out of - e.g. a MySQL blob. (Mathieu) -- Fixed a crash bug in imagewbmp() (Jani) -- Changed the sablot configuration file so that if you use any version of - Sablotron below 0.44 you must use Sablotron's built-in Expat libraries. - (Sterling) -- Added basic authentication support to thttpd (Sascha) -- Added support for the Caudium webserver (http://caudium.net/). It's based - on the Roxen SAPI module. Many bugs have been identified and fixed. (David) -- Fixed mysql_close(), pg_close(), msql_close() and sybase_close() - they - weren't properly closing the SQL connections (Zeev) -- Fixed crypt() to supply random seed if none is given (Andi) -- Made print_r() support recursive data structures, e.g. $GLOBALS. (Zeev) -- Fixed a bug that caused PHP not to properly flush its output buffer, if more - than one output buffer was used. (Zeev) -- Fixed a bug that could draw the shutdown sequence of the PHP Apache module - into an endless loop, under certain circumstances. It could cause Apache - processes under Solaris to get stuck, especially when using output - buffering. (Zeev) -- Added support for serializing references (Stas) -- Fixed conflict with OpenLDAP and Oracle 8.1.x (Jani) -- parse_ini_file() supports a new optional 2nd argument that instructs it - to divide the directives to arrays according to the sections in which they - reside (Zeev) -- parse_ini_file() is now thread-safe, and supported under Windows (Zeev) -- Unified aborted-connection semantics of all SAPI modules (Sascha) -- URL-opened files now store the HTTP response header in $http_response_header - (Zeev) -- Fixed array_rand() to shuffle results when the number of requested - elements is the same as the number of elements in the array. (Andrei) -- Added replace parameter to header() (Sascha) -- Fixed handling of single quotes in transparent session-id mode (Sascha) -- Fixed "php://*" fopen handler (Sascha) -- Made rename work in threadsafe enviroments (Daniel) -- Made session_destroy() close files before unlinking (Daniel) -- Added array_sum() function. (Andrei) -- Fixed a bug in session.c. The php_session_save_current_state did not check - if mod_data is NULL and such situation is possible if the user calls - session_module_name with a parameter. (alex@zend.com) -- Added IIS Admin extension. (Frank) -- OCIBindByName() now does better parameter-checking. (Thies) -- Made read() binary-safe in sockets.c (Chris Vandomelen) -- Made array_intersect() and array_diff() not alter order (Stig Venaas) -- Made ldap_connect() accept URL in host parameter when using OpenLDAP - 2.x. To use SSL, use ldaps://host/ as URL. (Stig Venaas) -- Made resource type names visible, e.g. var_dump() and - get_resource_type() display "file" for file resources. (Andrei) -- Added the curl_getinfo() function to find out information about a CURL - transfer. This function requires cURL 7.4.0 or above. (Sterling) -- Added the CURLOPT_KRB4, CURLOPT_INTERFACE, CURLOPT_QUOTE, CURLOPT_POSTQUOTE, - CURLOPT_QUOTE and CURLOPT_HTTPPROXYTUNNELL options. (Sterling) -- Renamed the shm_* functions to shmop_* (Derick) -- Updated ext/mysql/libmysql to version 3.23 (tim@mysql.com) -- Added ldap_get_option() and ldap_set_option() functions (Stig Venaas) -- Fixed a crash in CGI mode, in case no file was provided - (Daniel Beulshausen& Zeev) -- Fixed possible crash bug in imap_fetchstructure() (Jani) -- Fixed possible crash bug in imap_open() (Jani & Mark Musone) -- Added url_rewriter.tags configuration directive (Sascha) -- Added CORBA client extension, ready for use (eriksson@php.net) -- Fixed memory leak in x-httpd-source mode (Jason Greene) -- Changed ext/gd not to be enabled by default (Jani) -- Make increment of empty string ("") behave like in PHP 3 and result in "1" - (Andi, Zend Engine) -- Added POST handler for Adobe FDF format (Hartmut) -- Added transparent read and write .gz-files on glibc based systems - using the 'zlib:' fopen wrapper (Hartmut) -- Fixed a problem in the configuration parser (two null bytes were added - to each ENCAPSULATED TC_STRING) (alex@zend.com) -- Added HMAC support in the mhash module (nmav@altera.gr) -- Added module for Ovrimos sql server (nmav@altera.gr) - -11 Oct 2000, Version 4.0.3 -- Fixed a possible crash in -a interactive mode (Zeev, Zend Engine) -- Added mysql_escape_string() (Peter A. Savitch and & Brian Wang) -- Fixed many possible crash bugs with improper use of the printf() family of - functions (Andi) -- Fixed a problem that allowed users to override admin_value's and admin_flag's - (Zeev) -- Fixed PostgreSQL module to work when the link handle is omitted (Zeev) -- Fixed returning of empty LOB fields in OCI8. (Thies) -- Added Calendar module to default Win32 build (Andi) -- Added FTP module to default Win32 build (Andi) -- Fixed crash in the POSIX getrlimit() function (alex@zend.com) -- Fixed dirname() under certain conditions (Andi) -- Added --with-imap-ssl to support SSL'ized imap library in RH7 and others - (Rasmus) -- Fixed possible crash bug in parse_url() (Andi) -- Added support for trans sid under Win32 (Daniel) -- Added IPv6 support in fopen (Stig Venaas) -- Added the shmop extension. It allows more general ways of shared memory - access. (thanks to Ilia Alshanestky and Slava Poliakov - (Derick) -- Added the ability for CURLOPT_POSTFIELDS to accept an associative array of - HTTP POST variables and values. (Sterling) -- Added the CURLOPT_HTTPHEADER option to curl_setopt(). (Sterling) -- Added the curl_error() and curl_errno() functions. (Sterling) -- Changed ext/db not to be enabled by default (Jani) -- Fixed building Apache SAPI module on SCO UnixWare (Sascha) -- Fixed writing empty session sets to shared memory (tcarroll@chc-chimes.com) -- Added support for BSD/OS make (Sascha) -- Added improved URL rewriter (Sascha) -- Fixed readdir_r() use on Solaris (Sascha) -- Improved HTTP headers for private-caching (jon@csh.rit.edu, Sascha) -- Added new function session_cache_limiter (jon@csh.rit.edu, Sascha) -- Added ftp_exec to the ftp functions (thanks to ) - (Derick) -- PEAR: add last executed query as debug info in DB errors (Stig) -- PEAR: allow multiple modes in PEAR_Error (Stig) -- Made the Sybase CT module thread safe (Zeev) -- Added second argument to array_reverse() that indicatese whether - the original array keys should be preserved. (Andrei) -- Clean up htmlspecialchars/htmlentities inconsistencies. (Rasmus) -- PEAR: renamed DB_GETMODE_* to DB_FETCHMODE_*, added setFetchMode() - in DB_common to set the default mode, added some MySQL tests (Stig) -- Made eval() and several other runtime-evaluated code portions report the - nature and location of errors more accurately (Stas) -- Added an optional parameter to wordwrap that cuts a string if the length of a - word is longer than the maximum allowed. (Derick) -- Added functions pg_put_line and pg_end_copy (Dirk Elmendorf) -- Added second parameter for parse_str to save result (John Bafford) -- Fixed bug with curl places extra data in the output. (medvitz@medvitz.net) -- Added the pathinfo() function. (Sterling) -- Updated sybase_ct module and its sybase_query to use high performance API. - (Joey) -- Added a more configurable error reporting interface to DB. (Stig) -- Added is_uploaded_file() and move_uploaded_file() (Zeev) -- Added several directives to php.ini - post_max_size, file_uploads, - display_startup_errors - see php.ini-dist for further information (Zeev) -- Worked around a bug in the libc5 implementation of readdir() (Stas) -- Fixed some potential OpenBSD and NetBSD crash bugs when opening files. (Andi) -- Added EscapeShellArg() function (Rasmus) -- Added a php.ini option session.use_trans_sid to enable/disable trans-sid. - (Sterling) -- Added the Sablotron extension for XSL parsing. (Sterling) -- Fixed a bug in checkdate() which caused < 1 years to be valid (Jani) -- Added support for an optional output handler function for output - buffering. This enables transparent rendering of XML through XSL, - transparent compression, etc. (Zeev) -- Added support for user defined 'tick' callback functions. This helps - emulate background processing. (Andrei) -- Fixed problem with having $this as the XML parser object. (Andrei) -- Internal opened_path variable now uses the Zend memory manager so that full - paths of files won't leak on unclean shutdown (Andi) -- Removed support of print $obj automatically calling the __string_value() - method. Instead define yourself a method such as toString() and use - print $obj->toString() (Andi, Zend Engine) - -29 Aug 2000, Version 4.0.2 -- Added PHP API for Zend's ticks. (Stig) -- PHP 3 regression testing framework re-born (Stig) -- Added php_uname() function (Stig) -- Made a minor change to allow building with OpenLDAP 2.0 (Stig Venaas) -- Fixed a bug in preg_replace() that would truncate subject string if the - first argument was en empty array. (Andrei) -- Added ob_get_length function (Stig) -- Fixed a bug that did not respect limit parameter in preg_replace() when - using /e modifier. (Andrei) -- Added ability for each xml_set_*_handler() function to take the - array($obj, 'method') syntax for the handler argument as well - as the normal function name. (Andrei) -- Updated array_walk() to be able to accept array($obj, 'method') - syntax for the walk function. (Andrei) -- Fixed segfault with fgets(), fgetcsv(), fgetss(), and fread() when - called with negative length argument. (Torben) -- Fixed by-reference parameters passing for xml_ functions and for scanf - functions (Stas) -- Added experimental Oracle LDAP SDK support. 8.1.6 or later needed. Configure - with something like --with-ldap=/usr/local/oracle/product/8.1.6 (Stig Venaas) -- Fixed memory leaks in eval(); A script that used eval() extensively, could - end up consuming very large amounts of memory during execution (Zeev, Zend - Engine) -- Fixed memory_limit feature, which did not work properly in previous versions - (Zeev, Zend Engine) -- Fixed stdout support with the swf extension. (Sterling) -- Fixed byte order for ip2long and long2ip (Stas) -- Fixed dbase_add_record. (Sterling) -- Added support for libmcrypt 2.4.4 (Derick) -- Added strncasecmp function (Andi, Zend Engine) -- Fixed FTP module to accept multiline server replies (Jani) -- Fixed switch which only has a single default rule. (Andi, Zend Engine) -- Fixed problem with nested foreach()'s. (Andi, Zend Engine) -- The CCVS module is now stable and compiling. It compiles as a CGI and into - Apache cleanly without warnings. (Brendan W. McAdams) -- Fixed mSQL_close(). (nick@loman.net) -- Made return() in a require()'d file work like return() in an include()'d - file (Andi & Zeev, Zend Engine) -- Changed require_once() to work using the same table as include_once() - (Andi & Zeev, Zend Engine) -- Fixed PostgreSQL module to work when the link handle is omitted (Zeev) -- Fixed the Sybase modules to work properly with PHP 4.0 (Zeev) -- Fixed CLOB handling in OCI8 driver when using variable-width - character sets. (Thies) -- Added 4th optional parameter to sybase_[p]connect to specify the charset - for the connection (alf@alpha.ulatina.ac.cr) -- Fixed support for current thttpd releases. (Sascha) -- Added support for kerberized IMAP library using --with-kerberos - (Rasmus, Sascha) -- Virtualize realpath, chmod, chown and utime (Stas) -- Support content-encoding headers in file upload MIME parts - (Ragnar Kjørstad) -- Fixed warning when shutting down OCINLogon() connections. (Thies) -- Fixed \n in session variables bug on Win32 (Stas) -- OCIError() would sometimes not report failed connections. (Thies) -- Fixed HEAD request bug on an Apache ErrorDocument redirect and preserve - the status code across the redirect as well. (Rasmus) -- Added Olympus-specific tags to read_exif_data() (Rasmus) -- Fixed bug in imap_fetchheader() where using FT_PREFETCHTEXT didn't return - the body. Bug #4447. (Jani) -- Fixed exec() returning "\0" when output is empty -- Added XML_Parser class in PEAR (Stig) -- Added "make test" target in pear/ and added some regression tests (Stig) -- Fixed bug in strip_tags function as per bug #5857 (Rasmus) -- Fixed reading of IPTC via GetImageInfo() for certain JPEG files. (Thies) -- Improved the output-buffering functions to be re-entrant (Zeev) -- Made ldap_add(), ldap_modify(), ldap_mod_add(), ldap_mod_replace() - binary-safe. Original patch: Terrence Miao (Jani) -- CGI aka. command line version has now an option '-l' for syntax check - without execution (Hartmut) -- Fixed bug in ldap_get_values_len() which makes it NULL-safe. (Jani) -- Bug-report and fix submitted by Michel Alexeline -- Make ext_skel create a Makefile.in set up to handle shared extension - support automatically (Rasmus) -- Fixed php_realpath not to die on non-existing files (needed for touch()) - (Stas and china@thewrittenword.com) -- Fixed get_browser() function (Stas) -- Fixed symbol clash which caused a DSO problem on OpenBSD (Rob Black and - anil@recoil.org) -- Added new function: ldap_compare(). (Jani) -- Fixed a bug in ldap_get_entries() and ldap_get_attributes(). (Jani) -- Ported DB to new error reporting scheme in PEAR. (Stig) -- Added sybase and ibase DB backends in PEAR. (Sterling) -- New PEAR package Payment_Verisign for use with the Payflow Pro - (pfpro) extension. (David Croft) -- Added CURL support. (Sterling) -- Catch users trying to set "compatibility" parameter in PDF, which is not - supported from user-land. (Joey) -- Fixed dbase_add_record. (Sterling) -- Added new function wordwrap() to wordwrap long strings from Chris - Russel (David Croft) -- Added four additional arguments: attrsonly, sizelimit, timelimit, deref which - were missing in ldap_search(), ldap_list() and ldap_read() functions (Jani) -- Fixed a bug in ldap_search/list/read() which prevented returning the partial - results when 'Sizelimit exceeded' error occurred. (Jani Taskinen) -- Fixed preg_replace() to automatically escape quotes in matched - strings when using /e modifier. (Andrei) -- Itanium patch (Steve Robb) -- Set default include_path so PEAR files can be reached (Stig) -- Added "pear" executable, requires CGI version installed (Stig) -- Added extension ii for Ingres II native support. See README in ext/ingres_ii - directory. (David H) -- Added Win32 project for the Interbase module (Zeev) -- Added ability to perform calls to the parent class without explicitly - specifying its name, using parent::func_name(...) (Zeev, Zend Engine) -- You can now call Ora_Error() without prameters to get the reason - for a failed connection attempt. (Kirill Maximov) -- New extension "pfpro" for interface with Verisign Payflow Pro (David Croft) -- Added IMG_GIF, IMG_JPG, IMG_JPEG, IMG_PNG and IMG_WBMP constants for - imagetypes() function (Rasmus) -- Added ImageTypes() function which returns a bitfield with the supported - image formats. 1=gif, 2=jpeg, 4=png and 8=wbmp (Rasmus) -- Make it possible to specify an empty string as a thousands-seperator - in number_format() (Rasmus) -- Shared module support for LDAP extension (Troels Arvin) -- Fixed a bug with imap_mail where apache would segfault if the rpath - parameter was specified. -- Use dashes and short day name in cookies since some browsers seem picky - about this (Rasmus) -- Added pspell module. (Vlad) -- Added 3 additional arguments to the user-defined error handler - the file - name and line number in which the error occured, and the context (local - variables) of the code in which the error occured (Zeev, Zend Engine) -- Improved the error handling code to handle an error in a user-defined error - handling function (Zeev, Zend Engine) -- Fixed leak when using string offsets in the array() construct. - (Andi, Zend Engine) -- Fixed corruption problem when changing deeply nested values in objects. - (Andi & Zeev, Zend Engine) -- Improved array_multisort() to be able to specify sort type as well sort - order. Incidentally, it can be used to sort multi-dimensional arrays - as well. (Andrei) -- Fixed a possible data corruption in case of a huge amount of aborted requests - (Zeev) -- Apache module would sometimes close a wrong file-descriptor. (Sascha) -- Fixed use of alternative storage handlers in the session module. (Sascha) -- Updated str_pad() to be able to pad on left/right/both sides. (Andrei) -- Fixed crash in gzopen(). (Thies) -- Multiple character set support in gdttf.c (Rob Goodwin) -- When using HTTP auth from PHP, fill in the %u custom log field so the - authenticated used id will get logged in the Apache access_log (Rasmus) -- Support for pdflib 3.01. (Uwe) -- FDF Data is handled properly and can be accessed by reading - HTTP_RAW_POST_DATA. (Uwe) -- Added new 'O' format modifier that will output the GMT offset as "[+-]HHMM" - (eg: Pacific time is -0700). This is useful for things such as Date: mail - headers. (Mike W) -- Fixed crash on OCI?Logon() failure. (Thies) -- Make the special Header("http/...") response be case insensitive like 3.0 - (Rasmus) -- Allow cybercash to compile as a DL module. (Sterling) -- Fixed the dbase_create function. (Sterling) -- Fixed a problem under some versions of Windows that could cause PHP to hang - on startup if errors occured, e.g. in the php.ini file (Zeev) -- Fixed opendir() again. It should actually work well continuously now (Zeev) -- Added three additional arguments to be sent to a user-defined error handler - - the filename and line number in which the error occured, and the context - (the local variables) of the error (Zeev, Zend Engine) -- Improved the error handling code to handle an error in a user-defined error - handling function (Zeev, Zend Engine) -- Added an optional parameter to preg_replace() that can be used to - specify how many replacements to make. (Andrei) - -28 Jun 2000, Version 4.0.1 -- Fixed a possible crash in the LDAP modify code. (Eric Kilfoil) -- Fixed a bug in opendir(), which prevented readdir() from working properly if - the $dir argument wasn't explicitly specified (Zeev) -- Made --enable-discard-path work again. (Andi) -- Removed 8KB limit on line length of the file() function (Zeev) -- Disabled dl() when PHP is being used as a module inside a multithreaded web - server - it didn't work before, and caused weird results (Zeev) -- Added the ImageColorClosestHWB(), ImageCopyMerge() and ImagePaletteCopy() - functions. (Sterling) -- Added ImageCreateFromWBMP() function. (Jouni) -- Fixed problems with POST requests under the NSAPI module. (Roberto Biancardi) -- Added spliti() function. (Thies) -- Fixed serializer behaviour with regards to serializing objects whose class - definition was not available in the deserializing context. (Sascha) -- Improve memory cache performance and increase cache size. (Stas, Zend Engine) -- Added a crc32 checksum function - used by the UdmSearch search engine - and currently run through a system call. This will speed up the UdmSearch - php frontend significantly. (Rasmus) -- Modified in_array() to not touch array pointer. (Andrei) -- Added restore_error_handler(). (Zeev, Zend Engine) -- Fixed erroneous file names and line numbers in error situations under the - multithreaded version of PHP - most noticeably Win32 (Zeev, Zend Engine) -- Fixed problem with CGI crashing on certain servers especially Windows Apache - & O'Reilly website (Andi) -- Added Pi3Web SAPI module; run ./configure --with-pi3web to enable this. - (Holger; zimpel@t-online.de) -- Enhanced WDDX functions to call __sleep() and __wakeup() when working on - objects. (Andrei) -- Changed WDDX to serialize arrays as structs only if needed. (Thies) -- Implemented max_execution_time under Win32 (Zeev) -- Updated strtotime() to handle many more formats. It now has complete - feature parity with GNU date command. (Andrei) -- Added support for multiple arguments in unset(). (Faisal, Zend Engine) -- Functions that expect a resource but are passed something else now return - NULL instead of FALSE. (Thies, Zend Engine) -- Fixed gmmktime(), on certain systems it incorrectly adjusted for the timezone - offset and daylight savings time. (Andrei) -- Moved VC++ Win32 project and workspace files to the win32 directory - (Zeev) -- Fixed checkdate() to not return true on non-numeric arguments (Rasmus) -- Added --enable-c9x-inline option for compilers which support the new C9x - standard. If you encounter undefined references to i_zend_is_true and - other symbols, you should enable this. (Sascha, Zend Library) -- Fixed a problem in ldap_add() and ldap_modify(), sometimes added trailing - garbage to the values (Stig Venaas) -- Fixed a problem with dbmopen() not handing 'c' correctly with dbm/db/ndbm - databases. (JimJag) -- Fixed a crash in number_format() when used with locales. (Andrei) -- Fixed an initialization problem in the MS-SQL problem that could cause - a crash in mssql_query() (Zeev) -- Upgraded PCRE to version 3.2 and fixed a bug when anchored pattern - matched an empty string. (Andrei) -- Fixed a bug that prevented PHP from paying attention to the extension_dir - directive with extensions that were loaded from the php.ini file (Zeev) -- Changed set_error_handler() to return the name of the previously defined - error handler, if any (Zeev, Zend Engine) -- Declared officially dead. It didn't work in PHP 4.0.0 - either, but now it's gone for good (Zeev) -- Make convert_cyr_string() binary safe and stop it from corrupting other - PHP variables. (Andi) -- Added functions array_unique, array_intersect and array_diff (Stig Venaas) -- Fixed problem when using uninitialized values in comparisons with strings. - They behave as empty strings again just like in PHP 3. - (Andi & Zeev, Zend Engine) -- Fixed 'Z' flag in date() to adjust for daylight savings time. (Andrei) -- Fixed var_dump() not to modify the internal order of array elements (Zeev) -- Fixed stripcslashes() to remove to strip \ in unknown escapes instead of - leaving it. (Andrei) -- Changed WDDX to always serialize arrays as structs. (Andrei) -- Fixed include_once() to issue a warning in case the supplied file name is - not found (Zeev, Zend Engine) -- Fixed a bug in get_declared_classes() which could return the same class - multiple times under certain circumstances (Zeev, Zend Engine) -- Fixed a bug in rawurldecode() that would cause in rawurldecode() corrupting - its argument (Zeev) -- Parse errors (or other errors) in the php.ini files under Windows will no - longer mess up the HTTP headers in CGI mode and are now displayed in a - message box (Zeev) -- Fixed a crash in OCIFetchStatement() when trying to read after all data - has already been read. (Thies) -- fopen_wrappers() are now extensible via modules (Hartmut Holzgraefe) -- Make trim strip \0 to match php 3 (Rasmus) -- Added function imagecreatefromxbm(). (Jouni) -- Added function imagewbmp(). (Jouni, based on patch from Rune Nordbøe - Skillingstad) -- Added str_pad() for padding a string with an arbitrary string on left or - right. (Andrei) -- Made the short_tags, asp_tags and allow_call_time_pass_reference INI - directives work on a per-directory basis as well, e.g. from .htaccess - files. (Zeev) -- Added fflush() function. (Eric Huss) -- Fixed a problem with static variables, default function arguments and class - member variables, that contained array values. (Andi & Zeev, Zend Engine) -- Fixed virtual() when used with output buffering (Marc Pohl) -- Clean up constants in flock() function and add optional 3rd arg which - is set to true on EWOULDBLOCK (Rasmus) -- Added functions pg_loimport(), pg_loexport(). (Jouni) -- Added SWF support to getimagesize() function (Derick Rethans) -- Added support for both indexed and non-indexed arrays of file uploads - eg. name="file[]" type="file" (Rasmus) -- Added create_function(), which gives the ability to create functions - on-the-fly (Zeev, Zend Engine) -- Added support for comparisons of arrays (with arrays) and objects (with - objects); The equality operator (==) performs an unordered comparison, - whereas the identity operator (===) performs an ordered comparison (Zeev, - Zend Engine) -- Allow all functions that receive user-defined function callbacks to accept - an array that contains an object and a method name, in place of a function - name, e.g. usort($array, array($obj, "ObjSort")) (Zeev, Zend Engine) -- Added set_error_handler() to allow custom error handling functions, - instead of the built-in error handling code (Zeev, Zend Engine) -- Renamed user_error() to trigger_error(); user_error() remains - defined for compatibility (Zeev, Zend Engine) -- Fixed the global/static statements to require a trailing terminating - semi-colon ';'. (Andi, Zend Engine) -- Cleaned up PCRE extension and made it binary-safe. (Andrei) -- Added third argument to in_array(). If it's true, then in_array() - will use strict comparison instead of the default one. (Andrei) -- Added pg_trace() and pg_untrace (Dominic J. Eidson & Zeev) -- ignore_user_abort=Off is now default. (Thies) -- Added array_merge_recursive() that will recursively merge values - under the same keys. (Andrei) -- fixed crash in OCIParse when parsing invalid SQL. (Thies) -- Fixed a bug in mysql_connect() that made it ignore the socket argument, in - case of non-persistent connects (Zeev) -- Added disable_functions php.ini directive, to allow administrators to disable - certain functions for security reasons (Zeev) -- Fixed sessions on Win32. When setting the directory depth parameter in - save_path you need to now delimit it with a ';' instead of ':', e.g - "5;/tmp" instead of "5:/tmp" (Andi) -- Changed the Apache handler's return status to 'Declined' when a requested - PHP file could not be found. Returning 'Not Found' caused problems - in the ErrorDocument handler stage in that $REDIRECT_REDIRECT_ERROR_NOTES - was not getting set at all. Moving to 'Declined' should fix this and I - can't see any other side effects. (Rasmus) -- Fixed scanning decimal numbers in internationalized environments. They should - always be in standard US format e.g. 23.3. (Andi, Zend Engine) -- Added second argument to preg_quote() which allows quoting of - one additional character, usually the regex delimiter. (Andrei) -- Uncommitted outstanding OCI8 transactions are now rolled back - before the connection is closed. (Thies) -- ignore_user_abort() & friends should now work in CGI mode as well. - (Patch by daniel.braun@ercom.fr) -- Added extension YAZ (dickmeiss). -- Fixed a crash bug triggered by certain cases of class redeclarations - (Stas & Zeev, Zend Engine) -- Fixed min()/max() segfault. (Andrei) -- New module for reading EXIF header data from JPEG files. Most digital - cameras will embed all sorts of information about a picture inside the - jpeg images it generates. (Rasmus) -- Fixed basename() bug where "file.ext///" would not return the same - as "/path/file.ext///" (Rasmus) -- Added the swf_ortho function. (Sterling) -- Moved to virtual current working directory support. This highly improves the - functionality and stability of multi-threaded versions of PHP (Andi, Sascha) - -22 May 2000, Version 4.0.0 Release -- Allow the writing of flash files to stdout. -- Fixed a crash bug in .phps syntax-highlighted files (Andi) -- Improved round() to allow specification of rounding precision. - (Andrei, Todd Kirby ) -- Added SORT_REGULAR, SORT_NUMERIC, SORT_STRING flags that can be used with - non-user sort functions for precise sorting behavior. (Andrei) -- Fixed two 64-bit issues (startup crash, gethostbyaddr). (Sascha) -- NULL values are now preserved in the return value of mysql_fetch_array() - and mysql_fetch_object(). (Andrei) -- Ported InterBase module finally from PHP 3 to PHP 4. Full support for - InterBase 6. (Jouni) -- Added swf_definepoly for drawing polygons to the SWF functions. (Sterling) -- Ported imagegammacorrect from PHP3 to PHP4. (Sterling) -- Added array_rand() function. (Andrei) - -8 May 2000, Version 4.0 Release Candidate 2 -- NSAPI WIN32 Module compilable, untested (Shane) -- Apache WIN32 Module compilable and lightly tested. (Shane) -- Enabled assert() by default in php.ini-dist. (Andrei) -- Put in safeguards in case dynamic code evaluation in assert() and - preg_replace() with /e modifier fails. (Andrei) -- Fixed infinite recursion when serializing $GLOBALS[] in WDDX. (Andrei) -- Made WDDX serialization properly escape <, >, and &. Also speeded up - the serialization in general. (Andrei) -- Moved install-local to install-sapi for clarity. (Joey) -- Improved extension build framework. Refer to README.SELF-CONTAINED-EXTENSIONS - for an introduction. (Sascha) -- ImagePolygon() is no longer limited by a maximum number of polygons. - (Marc Pohl) -- Added configure time checking for bcmath package. (Joey, Sascha) -- Added get_declared_classes(). (Andrei, Zend Engine) -- Added initial NSAPI module from Jayakumar Muthukumarasamy. (Rasmus) -- Added the SWF module which allows you to create Macromedia Flash files via - libswf. (Sterling) -- Improved UNIX build system to support more vendor make tools (Sascha) -- Updated natural comparison/sorting algorithm by Martin Pool - . (Andrei) -- Fixed a crash in array_multisort() that happened when empty arrays - were passed to it. (Andrei) -- Added substr_count() from Peter Kovacs. (Andrei) -- Added an optional third argument to fseek to indicate where to seek from. - (Andrei) -- OCIBindByName() will no longer complain about bindlength beeing zero. (Thies) -- Converted the IMAP module to the high performance API (Zeev) -- The fgetcsv() function now handles embedded end-of-line in a quoted field - (Nick Talbott) -- Added user_error(), to allow explicitly generate error messages from scripts - (Zeev, Zend Engine) -- Fixed a problem in long2ip() that occasionally returned incorrect IP address. - (Evan, Andrei) -- Fixed many memory leaks in the IMAP module (Stas, Andi, Zeev) -- Fixed bug in number_format (Jon Forsberg) -- Make error_prepend_string and error_append_string work (Rasmus) -- array_walk() now automatically resets the array. (Andrei) -- Added natural comparison/sorting routines strnatcmp(), strnatcasecmp(), - natsort(), and natcasesort(). These are useful for comparing and sorting - strings that contain numbers. Based on the code from Martin Pool - . See http://www.linuxcare.com.au/projects/natsort/ - for more info on natural sorting. (Andrei) -- Zeus Webserver support (version 3.3.6+) for ISAPI (Ben Mansell) -- Fixed several problems with the PATH_TRANSLATED and PHP_SELF under Apache - (Paul Gregg & Zeev) -- Ported ldap_get_values_len() function from PHP3 to PHP4. (Sterling) -- Fixed a problem in include_once() with non constant arguments (Andi & Zeev, - Zend Engine) -- Added php.ini-optimized (Zeev) -- Ported ldap_errno(), ldap_err2str() and ldap_error() from PHP3 to PHP4. - (Sterling) -- WDDX now defaults to ISO-8859-1. (Thies) -- Fixed crash resulting from IMAP's error handling (Stas) -- Added $HTTP_POST_FILES[filename][tmp_name] - it was previously impossible to - retrieve the temporary name of an uploaded file using $HTTP_POST_FILES[] - (Zeev) -- Made the IMAP and LDAP modules compilable under Windows and thread-safe - (Zeev) -- Fixed a problem when dealing with large POST blocks in CGI mode (Zeev) -- Added session_get_cookie_params() function. (Sterling) -- Fixed return of stristr() to no longer always be lowercased. (Andrei) -- Changed the Windows version of PHP so that a php.ini file is no - longer mandatory (Zeev) -- session_start() is now more verbose if headers cannot be send. (Thies) -- Fixed a memory leak when using assign-op bitwise operators on strings (Zeev, - Zend Engine) -- Added support for reading properties that require arguments in the COM - module - writing to them will only be supported in PHP 4.1 (Zeev) -- Fixed a very old legacy memory leak in the COM module (Zeev) -- Fixed problems with object-overloading support - noteably, COM and Java - (Zeev, Zend Engine) -- Fixed an overrun in WDDX. (Thies) -- Fixed a crash bug with modules loaded through dl() not properly freeing their - resources (Zeev, Zend Engine) -- Added localtime() function. (Sterling) -- Added the 'I' format option for the date function, this option will return - true or false depending on whether or not daylight savings time is in effect. -(Sterling) -- Added gmstrftime() function. (Sterling) -- snmp_walkoid is now an alias for snmp_realwalk. (Sterling) -- Fixed a bug that could cause a crash when using 'global' inside large include - files (Stas, Zend Engine) -- Added --enable-libgcc switch to force linking against libgcc (Sascha) -- Fixed dynamic loading where extension_dir had no trailing slash (Sascha) -- Fixed dynamic loading on OpenBSD (Sascha) -- Improved POSIX threads check. ZTS works now on at least Linux, Solaris, - FreeBSD and OpenBSD (Sascha, TSRM) -- Added !== operator support. (Torben, Zend Engine) - -27 March 2000, Version 4.0 Release Candidate 1 -- Added support for UCD-SNMP 4.1.x (Sascha) -- Fixed a data corruption bug in mysql_result(), if used in table.fieldname - mode (Zeev) -- Fixed a crash problem in func_num_args(), func_get_arg() and func_get_args() - when used as function arguments (Andi, Zend Engine) -- Added get_class_methods(string classname) function. (Andrei) -- Added 'I' switch to test whether or not DST is active. (Sterling) -- Fixed a data corruption bug in mysql_result(), if used in table.fieldname - mode (Zeev) -- Modified the registry INI entry reader (Win32) to work with drive letters. - For example, if you wish to wish to specify INI entries for C:\foo\bar, you - should create HKLM\PHP\Per Directory Values\C\foo\bar in the registry, and add - string values for each directive you want to override in this directory (Zeev) -- Fixed extract() for EXTR_PREFIX_SAME and EXTR_SKIP cases. (Andrei) -- stristr() no longer modifies it's arguments. (Thies) -- Don't default to iso-8859-1 since this confuses some browsers. (Rasmus) -- Make it possible to specify both a port and a socket - in mysql_[p]connect. (Rasmus) -- Added --disable-pic for disabling generating PIC for shared objects - on platforms which support it (i.e. Linux) (Sascha) -- serialize()/unserialize() now call __sleep() and __wakeup() when - working on objects. (Thies) -- renamed to_string() method to __string_value() for consistency. - (Thies, Zend Engine) -- Fixed a bug in the third argument to define() -- Added is_numeric() that returns true if the argument is a number - or a numeric string. (Andrei) -- domxml now supports libxml 2.0 Beta and drops support for older versions, - due to massive changes in libxml -- fixed possible crash in unserialize() if serialized data was - corrupted. (Thies) -- Changed $HTTP_STATE_VARS to $HTTP_SESSION_VARS. Use only the latter - version now! (Andrei) -- Added GD-JPEG Support (Rasmus) -- Prevent from loading dynamic PHP modules which were compiled with different - debug and thread safety modes than PHP, which resulted in a crash (Andi) -- connection_aborted() and friends work again (Thies) -- Upgraded to libtool 1.3.4 (Sascha) -- UNIX configure creates config.nice in the build directory now which allows - easy reuse of configuration options (Sascha) -- Added support for embedded MySQL client library. Unless you specify a path - to --with-mysql, the bundled MySQL client library will be used (Sascha) -- Added include_once() and require_once() functionality (Andi, Zend Engine) -- Removed support for pdflib < 3.0 (Uwe) -- Added auto-registration of everything in $HTTP_SESSION_VARS[] if - register_globals is turned off. (Andrei) -- Cleaned up extension namespace (Stig) -- OCINLogon() sessions are now closed again. (Thies) -- Added ip2long() and long2ip(), - courtesy of Faisal Nasim (Andrei) -- Added ftruncate() and fstat(), - courtesy of Faisal Nasim (Andrei) -- Added parse_ini_file(). Currently implemented in non thread safe version - of PHP, and currently lacks section support (Zeev) -- "none" is now equivalent with "" in Apache config directives (Stig) -- OCINLogon no longer crashes. (Thies) -- Fixed comparisons of (string) "nan" with (string) "nan". (Thies, Zend Engine) -- Switched back to the old $HTTP_*_VARS[] behavior - $HTTP_GET_VARS["foo"] - and $foo are no longer references to each other, but separate variables - like they were prior to PHP 4.0 Beta 4 (Zeev) -- Fixed Sybase-DB compilation (Zeev) -- Fixed a (fairly common) situation where error_reporting values would not be - properly restored after a call to error_reporting(), in between requests - (Zeev) -- The various $HTTP_*_VARS[] are now protected, and cannot be manipulated by - user input (Zeev) -- Added ini_set() as an alias to ini_alter() (Zeev) -- The string None is now recognized as a keyword by the php.ini processor, and - can be used to denote an empty string (Zeev) -- Added get_class_vars(string class_name) and get_object_vars(object obj) - functions. (Andrei, Zend Engine) -- Added pdf_set_parameter(), pdf_skew(), pdf_show_boxed() (Uwe) -- Fixed comparison of (string) "inf" with (string) "inf", which was erroneously - returning false (Zeev) -- Implemented default_charset and default_mimetype config directives (Stig) -- Ported T1lib support from PHP3. (Jouni) -- Fixed -DEAPI inheritance from APXS. (Sascha) -- Fixed possible crash in module-shutdown. (Thies) -- Fixed safe_mode_protected_env_vars INI directive (Zeev) -- Fixed getrusage() (Sascha) -- Fixed OCI8 crash when returning cursors from stored-procedures. (Thies) - -21 February 2000 Version 4.0 Beta 4 patch level 1 -- Fixed crash when magic_quotes were switched off. (Thies) -- Support for pdflib 2.30 (Uwe) - -20 February 2000, Version 4.0 Beta 4 -- Introduced $HTTP_POST_FILES[], that contains information about files uploaded - through HTTP upload (Zeev) -- Made PHP work under Microsoft Personal Web Server, under both Windows NT - workstation and Windows 95 (Zeev) -- Made multipart/form-data content obey to the variables_order directive (Zeev) -- Updated the browscap module to work with PHP 4.0 (Zeev) -- Recover gracefully in ISAPI after the client prematurely presses STOP (Andi) -- Fixed bug in unset() on array offsets which are referenced more than once - (Andi, Zend Engine) -- Improved ISAPI module - it should no longer be necessary to set PHP as - an ISAPI filter, only as an ISAPI extension, unless you wish to perform - authentication using PHP. This didn't yet get enough testing, but it - should work (Zeev) -- Fixed RFC1867 file upload under Windows (Zeev) -- Initital support for pdflib 2.20 (Uwe) -- Added PostgreSQL support for DB (Rui Hirokawa ) -- Re-introduced "none" for disabling auto_prepend/append_file (Stig) -- Added DB/storage (Stig, PEAR) -- Introduced DB warnings (Stig, PEAR) -- Fixed overrun in strip_tags (Stas) -- Fixed crash in strip_tags() and related functions. (Thies) -- Workaround for bogus POST-Data from IE/Mac. (Thies) - Patch by Alain Malek -- Finished the server abstraction layer; All of the PHP code is now shared - across different servers (Apache, CGI, IIS, etc.), except for thin - interface modules (Zeev) -- Added NULL-support in gettype(). (Thies) -- base64_decode() will decode POST data correct. (Thies) - Patch submitted by: Turadg Aleahmad -- Much more work on domxml. Build xml tree, create xml doc works (Uwe) -- Made foreach() work on objects. (Thies, Zend Engine) -- Added domxml extension based on libxml, still little functionality (Uwe) -- Fixed memory corruption in fgetss(), strip_tags() and gzgetss() (Zeev) -- Updated calendar dynamic library to work with PHP 4. (Evan) -- Added strncmp() function, courtesy of Walter. (Andrei) -- Made the output of var_dump() more informative. (Thies) -- Fixed some OCIBindByName() problems. (Thies) -- Protect the ISAPI module against exceptions. Stack overflows in scripts are - now nicely detected and handled (Zeev) -- Fixed possible buffer-overflow in base64_decode. (Thies) -- Fixed possible buffer-overflow in setcookie(). (Thies) -- Fixed signal() bug that could cause the Apache master process to - die. (Thies) -- Added session_set_cookie_params() function. (Andrei) -- If header information is sent after output has already been sent, the warning - message will now state the filename and line number at which the first output - was made (Zeev) -- Added the XML Expat library to the standard PHP source distribution thanks - to its author James Clark (Andi & Zeev) -- Added XML support to the default Win32 build (Andi & Zeev) -- Added socket_get_status() function. Renamed: - set_socket_timeout() -> socket_set_timeout() - set_socket_blocking() -> socket_set_blocking(). (Andrei) -- Added realpath() function. (Andrei) -- mktime interprets years in the range 0-70 now as 2000-2070. You can - continue to specify the complete year (i.e. 1920) (Sascha) -- Added the ability to control the environment variables the user is allowed - to change in Safe Mode, using INI directives (Zeev) -- Fixed a crash bug in strtr() working on large input strings (Zeev) -- Ora_GetColumn()/Ora_FetchInto() now return NULL for NULL-Columns. (Thies) -- OCI8 now supports binding of NULL-values. Module cleanups. (Thies) -- Added ability to set timeout on socket read operations through - set_socket_timeout() function. (Andrei) -- Added implicit_flush INI directive (Zeev) -- Added implicit_flush() to control whether flush() should be called - implicitly after any output (Zeev) -- Fixed a crash in pfsockopen() (Zeev) -- Fixed a possible crash in phpinfo() (Zeev) -- Added register_argc_argv INI directive, to allow to selectively disable - the declaration of the $argv and $argc variables for increased - performance (Zeev) -- Added $HTTP_ENV_VARS[] and $HTTP_SERVER_VARS[] support, which similarly - to $HTTP_GET_VARS[], contain environment and server variables. Setting - register_globals to Off will now also prevent registration of the - environment and server variables into the global scope (Zeev) -- Renamed gpc_globals INI directive to register_globals (Zeev) -- Introduced variables_order that deprecates gpc_order, and allows control - over the server and environment variables, in addition to GET/POST/Cookies - (Zeev) -- new function cpdf_set_document_limits() (Uwe) -- Applied safe-mode patch to popen(). (Patch by Kristian Köhntopp) -- str_repeat() now returns correct length. (Thies) -- Don't assume libz and libpng are installed for the GD checks (Rasmus) -- Implemented support for and types according - to WDDX version 1.0 (Andrei) -- Made var_dump()/serialize()/unserialize() NULL aware. (Thies) -- Added new NULL constant (Zeev, Zend Engine) -- Fixed -c support in the standalone CGI binary (Zeev) -- Increased PHP's performance by 5-15% using a new memory cache (Andi & Zeev, - Zend Engine) -- Improved the php.ini reader to support constants and bitwise operators (Zeev) -- Fixed strrev() to no longer modify arg1. (Thies) -- Fixed buffer overruns in iptcembed(). (Thies) -- Fixed a bug in ODBC error reporting (Zeev) -- Added PHP_Logo_GUID() and Zend_Logo_GUID() functions, that return the GUIDs - of the PHP and Zend logos used in phpinfo() (Zeev) -- Added GNU Pth support (Sascha, TSRM library) -- Removed select(), fd_set() and fd_isset() - will be reimplemented soon! (Thies) -- Improved Win32 performance significantly by using different mutexes (Zeev, - TSRM library) -- Made quotemeta() and preg_quote() binary-safe. (Andrei) -- Added UDP support in fsockopen(). (Evan) -- Added --disable-pear option (Andrei) -- Renamed libzend repository to Zend (Zeev) -- Added support for thttpd (Sascha) -- Added session.cache_limiter and cache_expire options (Sascha) -- Restored the PHP_VERSION and PHP_OS constants (Zeev) -- Added get_loaded_extensions(), extension_loaded(), and - get_extension_funcs() functions. (Andrei) -- Added date/time stamping to PHP error log file. (Andrei, Joey) -- Added is_subclass_of() function (Andrei, Zend Engine) -- Implemented count_chars(). (Thies) -- Added class_exists() function (Andrei, Zend Engine) -- Made strspn() and strcspn() binary-safe. (Andrei) -- Added array_multisort() function. (Andrei) -- Made pageinfo.c thread-safe (Sascha) -- Made implode() binary-safe (Andrei) -- Made strstr(), stristr(), and ucwords() binary-safe() (Andrei) -- Made strtoupper(), strtolower(), substr_replace() binary-safe. (Andrei) -- Fixed a crash in the Apache syntax highlighting mode (Zeev) -- Report all ODBC error's not just the one on the top of the stack (lurcher) -- OCI8 now returns NULL values in LONG columns correct. (Thies) -- Added support for a C-like assert() function. (Thies) -- Added CyberCash support. (Evan) -- Made explode() binary-safe. (Thies) -- Made strpos() binary-safe. (Thies) -- Added XML_Set_Object() function, now you can use the XML-Parser from - within an object. (Thies) -- Session vars are now decoded into $HTTP_STATE_VARS[] array and the - globals, depending on track_vars and gpc_globals settings (Andrei) -- Added get_used_files() function - returns a hash mapping the use()'d files - to their full path (Zeev) -- PHP 4 scripts will now obey the max_execution_time setting and actually - time out (Rasmus) -- Added configure command to phpinfo() output (Stig) -- Added optional socket path to the mysql_?connect() functions (Rasmus) -- Made mysql and gd work as shared extensions again (Stig) -- Make the global GET/POST/Cookie variables and their $HTTP_*_VARS[] counterparts - be references to each other (Zeev) -- Added support for the 'use' keyword - behaves like 'require', but will not - use the same file more than once (Andi & Zeev, Zend Engine) -- Added check to see if a persistent connection is still valid with the - ODBC interface before reusing (nick@easysoft.com) -- Added DBMaker support (patch by Pax Tsai ) -- Renamed "PECL" to "PEAR" (PHP Extension and Add-on Repository) (Stig) -- buildconf now uses build.mk (Stig) -- Disable symlinks to urls (Rasmus) -- Informix driver now reflects version of ESQL/C used (Danny) -- Modified session_register() to take variable number of arguments (Andrei) -- Fixed file descriptor leak in thread safe mode (Zeev, Zend Engine) -- Added select(), fd_set() and fd_isset() (Evan) -- cpdf support has been ported from php3, needs ClibPDF 2.x (Uwe) -- Fixed a leak when using automatic output buffering (Zeev) -- Introduced PECL - PHP Extension and Code Library - (prounounced "pickle") (Stig) -- Fixed inconsistencies in the implementation of here-docs (Andi & Zeev, Zend - library) -- Fixed a problem with constant class-member initializations (Andi & Zeev, - Zend Engine) -- Fixed float-compare in min(),max(),a[r]sort(),[r]sort() (Thies) -- Implemented get_html_translation_table() function (Thies) -- Implemented array_flip() function. Returns input-array with key, value - flipped (Thies) -- Added Berkeley DB3 support in DBA (Sascha) -- Implemented 2-Arg version of strtr($str,$translation_array). This can be used - to revert what htmlspecialchars() did (Thies) -- Fixed mem-overwrite in XML_Parse_Into_Struct (Thies) -- Added substr_replace() function (Andrei) - -November 16 1999, Version 4.0 Beta 3 -- ucfirst()/ucwords() no longer modify arg1 (Thies) -- Fixed strtr() not to modify arg1 (Thies) -- Added Win32 build files for Informix driver and make it - compile with ZTS (danny) -- Added tmpfile() function (Stig) -- Upgraded regex library to alpha3.8 (Sascha) -- Fixed selecting nested-tables in OCI8. (Thies) -- RFC-854 fix for internal FTP-Code. Commands have to end in "\r\n" (Thies) -- Fixed OpenLink ODBC support (Stig) -- min(),max(),a[r]sort(),[r]sort(),k[r]sort() now work consistent with the - language-core. (Thies) -- tempnam() now uses mkstemp() if available (Stig) -- serialize() and var_dump() now honor the precision as set in php.ini - for doubles. (Thies) -- Improved the Win32 COM module to support [out] parameters (Boris Wedl) -- Fixed garbage returned at the end of certain Sybase-Columns (Thies) - Patch submitted by: neal@wanlink.com -- Added Microsoft SQL Server module for Win32 (Frank) -- Added support for forcing a variable number of internal function arguments - by reference. (Andi & Zeev, Zend Engine) -- Implemented getprotoby{name,number} (Evan) -- Added array_pad() function. (Andrei) -- Added new getservby{name,port} functions. (Evan) -- Added session.cookie_path and session.cookie_domain (Sascha) -- Continue processing PHP_INI_SYSTEM knownDirectives after extension= - (Sam Ruby) -- Enable IBM DB2 support - Tested against DB2 6.1 UDB on Linux (Rasmus) -- Added new str_repeat() function. (Andrei) -- Output-Buffering system is now Thread-Safe. (Thies) -- implemented OCI8 $lob->WriteToFile() function - very useful for streaming - large amounts of LOB-Data without to need of a huge buffer. (Thies) -- Added session.use_cookies option (Sascha) -- Added getcwd() function. (Thies) -- XML_Parse_Into_Struct no longer eats data. (Thies) -- Fixed parse_url('-') crash. (Thies) -- added === operator support. (Andi & Thies, Zend Engine) -- unserialize() now gives a notice when passed invalid data. (Thies) -- Fixed shuffle() so that it no longer breaks on Solaris. (Andrei) -- Added is_resource(), is_bool() functions. (Thies) -- Cleaned up File-Module (Thies) -- Upgraded math-funtions to use new Zend function API (Thies) -- Fixed zombie problem in shell_exec() and $a = `some_command` - constructs. (Thies) -- Thies introduced ZEND_FETCH_RESOURCE2 (Danny). -- Added Informix driver to list of maintained extensions. (Danny). -- Informix driver : Changed ifx.ec to use the new high-performance - ZEND API. (Danny) -- IXF_LIBDIR environment variable specifies alternate Informix library - path for configure (Danny). -- Fixed gmmktime() so that the following should always be true: - gmmktime([args]) == mktime([args]) + date('Z', mktime([args])) (Jouni) -- setlocale doesn't anymore screw up things if you forgot to change it back - to the original settings. (Jouni) -- Switched to new system where ChangeLog is automagically updated from commit - messages. NEWS file is now the place for public announcements. (Andrei) -- Fixed refcount problem in XML module. (Thies) -- Fixed crash in HTTP_RAW_POST_DATA handling (Thies) -- You can use resources as array-indices again (Thies, Zend Engine) -- Fixed pg_fetch_array() with three arguments (Sascha) - Patch submitted by: brian@soda.berkeley.edu -- Upgraded a lot internal functions to use new Zend function API (Thies) -- fdf support ported; not completely tested with latest version 4.0 for - glibc (Uwe) -- OCI8 connections are now kept open as long as they are referenced (Thies) -- Cleaned up Directory-Module (Thies) -- Small fix in Ora_Close (Thies) -- Ported range() and shuffle() from PHP 3 to PHP 4 (Andrei) -- Fixed header("HTTP/..."); behaviour (Sascha) -- Improved UNIX build system. Now utilizes libtool (Sascha) -- Upgrade some more internal functions to use new Zend function API. (Thies, - Zend Engine) -- Fixed backwards incompatibility with ereg() (Thies) -- Updated Zend garbage collection with a much more thorough method. - (Andi, Zend Engine) -- Added the ability to use variable references in the array() construct. - For example, array("foo" => &$foo). (Andi, Zend Engine) -- Added array_reverse() function (Andrei) -- Some more XML fixes/cleanups (Thies) -- Updated preg_replace() so that if any argument passed in is an array - it will make a copy of each entry before converting it to string so that - the original is intact. If the subject is an array then it will preserve - the keys in the output as well (Andrei) -- Updated OCI8 to use the new high-performance Zend function API. (Thies) -- Configure speedup (Stig) -- Fixed LOB/Persistent-Connection related OCI8-Crash (Thies) -- Generalized server-API build procedure on UNIX (Stig) -- Added '--disable-rpath' option (Sascha) -- Added AOLserver SAPI module (Sascha) -- Fixed XML Callbacks. (Thies) -- Updated ODBC to use the new high-performance Zend function API (kara) -- Updated zlib to use the new high-performance Zend function API. (Stefan) -- Updated preg_split() to allow returning only non-empty pieces (Andrei) -- Updated PCRE to use the new high-performance Zend function API (Andrei) -- Updated session, dba, mhash, mcrypt, sysvshm, sysvsem, gettext modules to use - the new high-performance Zend function API (Sascha) -- Extended var_dump to handle resource type somewhat (Andrei) -- Updated WDDX to use the new high-performance Zend function API (Andrei) -- Updated XML to use the new high-performance Zend function API. (Thies) -- Updated Oracle to use the new high-performance Zend function API. (Thies) -- Improved the performance of the MySQL module significantly by using the new - high-performance Zend function API. (Zeev) -- Added support for the Easysoft ODBC-ODCB Bridge (martin@easysoft.com) -- Fixed bug in odbc_setoption, getParameter call incorrect (martin@easysoft.com) -- Ora_Fetch_Into now resets the returned array in all cases (Thies) -- Fixed NULL-Column problem in Oracle-Driver (Thies) -- Added extra metadata functions to ODBC, SQLTables etc (nick@easysoft.com) -- Fixed SEGV in mcal make_event_object() and - typo in mcal_list_alarms() (Andrew Skalski) -- Fixed Ora_PLogon (Thies) -- Resourcified Oracle (Thies) -- Implemented object serialization/deserialization in WDDX (Andrei) -- Added krsort() function (Thies) -- Added func_num_args(), func_get_arg() and func_get_args() for standard - access to variable number of arguments functions (Zeev) -- Added FTP support (Andrew Skalski) -- Added optional allowable_tags arguments to strip_tags(), gzgetss() and - fgetss() to allow you to specify a string of tags that are not to be - stripped (Rasmus) -- Upgraded var_dump() to take multiple arguments (Andrei) -- Resourcified XML (Thies) -- Fixed a memory leak in the Apache per-directory directives handler (Zeev) -- Added array_count_values() function. (Thies) -- snmp, pgsql, mysql and gd modules can be built as dynamically loaded - modules (Greg) -- OCI8 fix for fetching empty LOBs (Thies) -- Added user-level callbacks for session module (Sascha) -- Added support for unknown POST content types (Zeev) -- Added "wddx" serialization handler for session module (Sascha) - (automatically enabled, if you compile with --with-wddx) -- Fixed unserializing objects (Thies) -- PHP 4.0 now serializes Objects as 'O' (not understood by PHP 3.0), but - unserializes PHP 3.0 serialized objects as expected. (Thies) -- Made serialize/unserialize work on classes. If the class is known at - unserialize() time, you'll get back a fully working object! (Thies) -- Reworked preg_* functions according to the new PCRE API, which also made - them behave much more like Perl ones (Andrei) -- Made it possible to specify external location of PCRE library (Andrei) -- Updated bundled PCRE library to version 2.08 (Andrei) -- count()/is_array/is_object... speedups. (Thies) -- OCI8 supports appending and positioning when saving LOBs (Thies) -- Added metaphone support (Thies) -- OCI8 doesn't use define callbacks any longer. (Thies) -- OCI8 Driver now supports LOBs like PHP 3.0. (Thies) -- var_dump now dumps the properties of an object (Thies) -- Rewrote the GET/POST/Cookie data reader to support multi-dimensional - arrays! (Zeev) -- Renamed allow_builtin_links to expose_php (defaults to On). This directive - tells PHP whether it may expose its existence to the outside world, e.g. - by adding itself to the Web server header (Zeev) -- Added support for transparent session id propagation (Sascha) -- Made WDDX serialize object properties properly (Andrei) -- Fixed WDDX mem leak when undefined variable is passed in - for serialization (Andrei) -- Added session_unset() function (Andrei) -- Fixed double session globals shutdown crash (Andrei) -- Fixed crash related to ignore_user_abort ini entry (Andrei) -- Added support for external entropy sources for session id creation - (on Unices /dev/random and /dev/urandom) (Sascha) -- Added gpc_globals variable directive to php.ini. By default it is On, but - if it is set to Off, GET, POST and Cookie variables will not be inserted - to the global scope. Mostly makes sense when coupled with track_vars (Zeev) -- Added versioning support for shared library (Sascha) - This allows concurrent use of PHP 3.0 and PHP 4.0 as Apache modules. See - the end of the INSTALL file for more information. -- Added second parameter to array_keys which specifies search value - for which the key should be returned (Andrei) -- Resourcified Informix driver (Danny) -- New resource handling for odbc, renamed to php_odbc.[ch] -- Make set_time_limit() work on Unix (Rasmus) -- Added connection handling support (Rasmus) -- Improved the Sybase-CT module to make use of resources (Zeev) -- Improved the mSQL module to make use of resources (Zeev) -- Changed mysql_query() and mysql_db_query() to return false in case of saving - the result set data fails (Zeev) -- Improved the resource mechanism - resources were not getting freed as soon - as they could (Zeev) -- Added shared memory module for session data storage (Sascha) -- Fixed session.auto_start (Sascha) -- Fixed several problems with output buffering and HEAD requests (Zeev) -- Fixed HTTP Status code issue with ISAPI module (Zeev) -- Fixed a problem that prevented $GLOBALS from working properly (Zeev, Zend - library) -- Ported newest GetImageSize (Thies) -- Added session compile support in Win32 (Andi) -- Added -d switch to the CGI binary that allows overriding php.ini values - from the command line (Zeev) -- Fixed a crash that would occur if wddx_deserialize did not receive - a valid packet (Andrei) -- Fixed a bugglet when redefining a class at run-time (Andi, Zend Engine) -- Fixed sem_get() on AIX (Sascha) -- Fixed fopen() to work with URL's in Win32 (Andi & Zeev) -- Fixed include_path for Win32 (Andi, Zend Engine) -- Fixed bug in ISAPI header sending function (Charles) -- Fixed memory leak when using undefined values (Andi & Zeev, Zend Engine) -- Added output_buffering directive to php.ini, to enable output buffering - for all PHP scripts - default is off (Zeev). -- Fixed some more class inheritance issues (Zeev, Zend Engine) -- Fixed Apache build wrt to shared modules on FreeBSD/Linux (Sascha) -- Added session.extern_referer_chk which checks whether session ids were - referred to by an external site and eliminates them (Sascha) -- Improved session id generation (Sascha) -- Improved speed of uniqid() by using the combined LCG and removing - the extra usleep() (Sascha) -- Introduced general combined linear congruential generator (Sascha) -- Made ldap_close back into an alias for ldap_unbind (Andrei) -- OciFetchInto now resets the returned array in all cases (Thies) -- Fixed mysql_errno() to work with recent versions of MySQL (Zeev) -- Fixed a problem with define() and boolean values (Zeev) -- Fixed inclusion of gd/freetype functions (Sascha) -- Fixed persistency of MHASH_* constants (Sascha) -- Oracle is now ZTS-Safe (Thies) -- Fixed flushing of cached information to disk in DBA's DB2 module (Sascha) -- OCI8 is now ZTS-Safe (Thies) -- Fixed is_writeable/is_writable problem; they are both defined now (Andrei) -- Imported PHP 3.0 diskfreespace() function (Thies) -- Fixed thread-safety issues in the MySQL module (Zeev) -- Fixed thread-safe support for dynamic modules (Zeev) -- Fixed Sybase CT build process (Zeev) - -August 9 1999, Version 4.0 Beta 2 -- Fixed a problem when sending HTTP/1.x header lines using header() (Zeev) -- Win32 builds now include the ODBC module built-in (Zeev) -- Fixed SYSV-SHM interface (Thies). -- Updated hyperwave module, made it thread safe -- Updated pdflib module, version 0.6 of pdflib no longer supported -- Updated fdf module -- Built-in phpinfo() links are now turned off by default. They can be turned - on using the allow_builtin_links INI directive (Zeev) -- Changed phpinfo() to list modules that have no info function (Zeev) -- Modified array_walk() function so that the userland callback is passed - a key and possible user data in addition to the value (Andrei) -- Fixed ldap_search(), ldap_read() and ldap_list() (Zeev) -- Fixed Apache information in phpinfo() (sam@breakfree.com) -- Improved register_shutdown_function() - you may now supply arguments that - will be passed to the shutdown function (Zeev) -- Improved call_user_func() and call_user_method() - they now support passing - arguments by reference (Zeev) -- Fixed usort() and uksort() (Zeev) -- Fixed md5() in the Apache module (Thies) -- Introduced build process for dynamic modules (Stig) -- Improved ISAPI module to supprt large server variables (Zeev) -- Imported PHP 3.0 fixes for problem with PHP as a dynamic module and Redhat - libc2.1 in zlib module (Stefan) -- Fixed sybase_fetch_object() (Zeev) -- Made the IMAP module work with PHP 4.0 (Zeev) -- Fixed a problem with include()/require() of URLs (Sascha, Zeev) -- Fixed a bug in implode() that caused it to corrupt its arguments (Zeev) -- Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name") - (Andi & Zeev) -- Fixed various inheritance problems (Andi & Zeev, Zend Engine) -- Children now inherit their parent's constructor, if they do not supply a - constructor of their own. -- Fixed runtime inheritance of classes (parent methods/properties were - overriding their children) (Zeev, Zend Engine) -- Fixed backwards incompatibility with the "new" operator (Andi, Zend Engine) -- Fixed bugs in uksort() and ksort() sort ordering (Andrei) -- Fixed a memory leak when using assignment-op operators with lvalue of type - string (Zeev, Zend Engine) -- Fixed a problem in inheritance from classes that are defined in include()d - files (Zeev, Zend Engine) -- Fixed a problem with the PHP error handler that could result in a crash - on certain operating systems (Zeev) -- Apache php_flag values only recognized 'On' (case sensitive) - changed - to case insensitive (Zeev) -- Fixed a memory leak with switch statement containing return statements - (Andi & Zeev, Zend Engine) -- Fixed a crash problem in switch statements that had a string offset - as a conditional (Andi & Zeev, Zend Engine) -- Imported PHP 3.0 fixes for rand() and mt_rand() (Rasmus) -- Added function entries for strip_tags() and similar_text() (Andrei) -- Fixed a bug in WDDX that would cause a crash if a number was passed in - instead of a variable name (Andrei) -- Ported strtotime() function from PHP 3.0 (Andrei) -- Merged in gdttf stuff from PHP 3.0 (Sascha) -- buildconf now checks your installation (Stig) -- XML module now built dynamically with --with-xml=shared (Stig) -- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev) -- Fixed array_walk() to work in PHP 4.0 (Andrei) -- Ported all remaining date() format options from PHP 3.0 (Andrei) -- $php_errormsg now works (Andrei) -- Added locale support for Perl Compatible Regexp functions (Andrei) -- Informix module ported (Danny) -- Removed --with-shared-apache (Sascha) -- Added patch for reverse lookup table in base64_decode (Sascha) - Submitted by bfranklin@dct.com -- Merged in PHP 3.0 version of str_replace (Sascha) -- Added DBA module (Sascha) -- Added session id detection within REQUEST_URI (Sascha) -- Merged in HP-UX/ANSI compatibility switch from PHP 3.0 (Sascha) -- Fixed rpath handling for utilitites built during Apache build (Sascha) -- Added missing E_ error level constants (Zeev, Zend Engine) -- Fixed a bug in sending multiple HTTP Cookies under Apache (Zeev) -- Fixed implicit connect on the MySQL, mSQL, PostgreSQL and Sybase - modules (Zeev) -- Gave PHP 4.0's SNMP extension all the functionality of PHP 3.0.12 (SteveL) - -July 19 1999, Version 4.0 Beta 1 -- First public beta of PHP 4.0 diff --git a/README.CVS-RULES b/README.CVS-RULES deleted file mode 100644 index d661edd4f4..0000000000 --- a/README.CVS-RULES +++ /dev/null @@ -1,115 +0,0 @@ -This is the first file you should be reading after you get your CVS account. -We'll assume you're basically familiar with CVS, but feel free to post -your questions on the mailing list. Please have a look at -http://cvsbook.red-bean.com/ for more detailed information on CVS. - -PHP is developed through the efforts of a large number of people. -Collaboration is a Good Thing(tm), and CVS lets us do this. Thus, following -some basic rules with regards to CVS usage will: - - a. Make everybody happier, especially those responsible for maintaining - the CVS itself. - b. Keep the changes consistently well documented and easily trackable. - c. Prevent some of those 'Oops' moments. - d. Increase the general level of good will on planet Earth. - - -Having said that, here are the organizational rules: - - 1. Respect other people working on the project. - - 2. Discuss any significant changes on the list before committing. - - 3. Look at EXTENSIONS file to see who is the primary maintainer of - the code you want to contribute to. - - 4. If you "strongly disagree" about something another person did, don't - start fighting publicly - take it up in private email. - - 5. If you don't know how to do something, ask first! - - 6. Test your changes before committing them. We mean it. Really. - - -The next few rules are more of a technical nature. - - 1. DO NOT TOUCH ChangeLog! It is automagically updated from the commit - 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. 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 - provide a nice commit message for each one. See example below. - - 4. Do write your commit message in such a way that it makes sense even - without the corresponding diff. One should be able to look at it, and - immediately know what was modified. Definitely include the function name - in the message as shown below. - - 5. In your commit messages, keep each line shorter than 80 characters. And - try to align your lines vertically, if they wrap. It looks bad otherwise. - - 6. If you modified a function that is callable from PHP, prepend PHP to - the function name as shown below. - - -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. 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 # 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 -a memory leak in php_trim(). Don't commit both of these at once. Commit them -separately and try to make sure your commit messages look something like the -following. - -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 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 -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 and NEWS right away, don't worry! -These files are updated once a day, so your stuff will not show up until -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. - -To receive daily updates to ChangeLog and NEWS, send an empty message to -php-cvs-daily-subscribe@lists.php.net. - -Happy hacking, - -PHP Team diff --git a/README.EXTENSIONS b/README.EXTENSIONS deleted file mode 100644 index 51e3b730e7..0000000000 --- a/README.EXTENSIONS +++ /dev/null @@ -1,39 +0,0 @@ -Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way -that broke both source and binary compatibility. If you are -maintaining a third party extension, here's how to update it: - -If this was your old module entry: - -zend_module_entry foo_module_entry = { - "foo", /* extension name */ - foo_functions, /* extension function list */ - NULL, /* extension-wide startup function */ - NULL, /* extension-wide shutdown function */ - PHP_RINIT(foo), /* per-request startup function */ - PHP_RSHUTDOWN(foo), /* per-request shutdown function */ - PHP_MINFO(foo), /* information function */ - STANDARD_MODULE_PROPERTIES -}; - -Here's how it should look if you want your code to build with PHP -4.1.0 and up: - -zend_module_entry foo_module_entry = { -#if ZEND_MODULE_API_NO >= 20010901 - STANDARD_MODULE_HEADER, -#endif - "foo", /* extension name */ - foo_functions, /* extension function list */ - NULL, /* extension-wide startup function */ - NULL, /* extension-wide shutdown function */ - PHP_RINIT(foo), /* per-request startup function */ - PHP_RSHUTDOWN(foo), /* per-request shutdown function */ - PHP_MINFO(foo), /* information function */ -#if ZEND_MODULE_API_NO >= 20010901 - FOO_VERSION, /* extension version number (string) */ -#endif - STANDARD_MODULE_PROPERTIES -}; - -If you don't care about source compatibility with earlier PHP releases -than 4.1.0, you can drop the #if/#endif lines. diff --git a/README.EXT_SKEL b/README.EXT_SKEL deleted file mode 100644 index afe03cb0df..0000000000 --- a/README.EXT_SKEL +++ /dev/null @@ -1,193 +0,0 @@ -(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 - - It's a tool for automatically creating the basic framework for a PHP module - and writing C code handling arguments passed to your functions from a simple - configuration file. See an example at the end of this file. - -HOW TO USE IT - - Very simple. First, change to the ext/ directory of the PHP 4 sources. If - you just need the basic framework and will be writing all the code in your - functions yourself, you can now do - - ./ext_skel --extname=module_name - - and everything you need is placed in directory module_name. - - [ Note that GNU awk is likely required for this script to work. Debian - systems seem to default to using mawk, so you may need to change the - #! line in skeleton/create_stubs and the cat $proto | awk line in - ext_skel to use gawk explicitly. ] - - If you don't need to test the existence of any external header files, - libraries or functions in them, the module is already almost ready to be - compiled in PHP. Just remove 3 comments in your_module_name/config.m4, - change back up to PHP sources top directory, and do - - ./buildconf; ./configure --enable-module_name; make - - But if you already have planned the overall scheme of your module, what - functions it will contain, their return types and the arguments they take - (a very good idea) and don't want to bother yourself with creating function - definitions and handling arguments passed yourself, it's time to create a - function definitions file, which you will give as an argument to ext_skel - with option - - --proto=filename. - -FORMAT OF FUNCTION DEFINITIONS FILE - - All the definitions must be on one line. In it's simplest form, it's just - the function name, e.g. - - my_function - - but then you'll be left with an almost empty function body without any - argument handling. - - Arguments are given in parenthesis after the function name, and are of - the form 'argument_type argument_name'. Arguments are separated from each - other with a comma and optional space. Argument_type can be one of int, - bool, double, float, string, array, object or mixed. - - An optional argument is separated from the previous by an optional space, - then '[' and of course comma and optional space, like all the other - arguments. You should close a row of optional arguments with same amount of - ']'s as there where '['s. Currently, it does not harm if you forget to do it - or there is a wrong amount of ']'s, but this may change in the future. - - An additional short description may be added after the parameters. - If present it will be filled into the 'proto' header comments in the stubs - code and the tag in the XML documentation. - - An example: - - my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st - - Arguments arg3 and arg4 are optional. - - If possible, the function definition should also contain it's return type - in front of the definition. It's not actually used for any C code generating - purposes but PHP in-source documentation instead, and as such, very useful. - It can be any of int, double, string, bool, array, object, resource, mixed - or void. - - The file must contain nothing else but function definitions, no comments or - empty lines. - -OTHER OPTIONS - - --no-help - - By default, ext_skel creates both comments in the source code and a test - function to help first time module writers to get started and testing - configuring and compiling their module. This option turns off all such things - which may just annoy experienced PHP module coders. Especially useful with - - --stubs=file - - which will leave out also all module specific stuff and write just function - stubs with function value declarations and passed argument handling, and - function entries and definitions at the end of the file, for copying and - pasting into an already existing module. - - --assign-params - --string-lens - - By default, function proto 'void foo(string bar)' creates the following: - ... - zval **bar; - ... (zend_get_parameters_ex() called in the middle...) - convert_to_string_ex(bar); - - Specifying both of these options changes the generated code to: - ... - zval **bar_arg; - int bar_len; - char *bar = NULL; - ... (zend_get_parameters_ex() called in the middle...) - convert_to_string_ex(bar_arg); - bar = Z_STRVAL_PP(bar_arg); - bar_len = Z_STRLEN_PP(bar_arg); - - You shouldn't have to ask what happens if you leave --string-lens out. If you - have to, it's questionable whether you should be reading this document. - - --with-xml[=file] - - Creates the basics for phpdoc .xml file. - - --full-xml - - Not implemented yet. When or if there will ever be created a framework for - self-contained extensions to use phpdoc system for their documentation, this - option enables it on the created xml file. - -CURRENT LIMITATIONS, BUGS AND OTHER ODDITIES - - Only arguments of types int, bool, double, float, string and array are - handled. For other types you must write the code yourself. And for type - mixed, it wouldn't even be possible to write anything, because only you - know what to expect. - - It can't handle correctly, and probably never will, variable list of - of arguments. (void foo(int bar [, ...]) - - Don't trust the generated code too much. It tries to be useful in most of - the situations you might encounter, but automatic code generation will never - beat a programmer who knows the real situation at hand. ext_skel is generally - best suited for quickly generating a wrapper for c-library functions you - might want to have available in PHP too. - - This program doesn't have a --help option. It has --no-help instead. - -EXAMPLE - - The following _one_ line - - bool my_drawtext(resource image, string text, resource font, int x, int y [, int color]) - - will create this function definition for you (note that there are a few - question marks to be replaced by you, and you must of course add your own - value definitions too): - -/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y[, int color]) - */ -PHP_FUNCTION(my_drawtext) -{ - zval **image, **text, **font, **x, **y, **color; - int argc; - int image_id = -1; - int font_id = -1; - - argc = ZEND_NUM_ARGS(); - if (argc < 5 || argc > 6 || zend_get_parameters_ex(argc, &image, &text, &font, &x, &y, &color) == FAILURE) { - WRONG_PARAM_COUNT; - } - - ZEND_FETCH_RESOURCE(???, ???, image, image_id, "???", ???_rsrc_id); - ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id); - - switch (argc) { - case 6: - convert_to_long_ex(color); - /* Fall-through. */ - case 5: - convert_to_long_ex(y); - convert_to_long_ex(x); - /* font: fetching resources already handled. */ - convert_to_string_ex(text); - /* image: fetching resources already handled. */ - break; - default: - WRONG_PARAM_COUNT; - } - - php_error(E_WARNING, "my_drawtext: not yet implemented"); -} -/* }}} */ - diff --git a/README.PARAMETER_PARSING_API b/README.PARAMETER_PARSING_API deleted file mode 100644 index a051723b5b..0000000000 --- a/README.PARAMETER_PARSING_API +++ /dev/null @@ -1,127 +0,0 @@ -New parameter parsing functions -=============================== - -It should be easier to parse input parameters to an extension function. -Hence, borrowing from Python's example, there are now a set of functions -that given the string of type specifiers, can parse the input parameters -and store the results in the user specified variables. This avoids most -of the IS_* checks and convert_to_* conversions. The functions also -check for the appropriate number of parameters, and try to output -meaningful error messages. - - -Prototypes ----------- -/* Implemented. */ -int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...); -int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...); - -The zend_parse_parameters() function takes the number of parameters -passed to the extension function, the type specifier string, and the -list of pointers to variables to store the results in. The _ex() version -also takes 'flags' argument -- current only ZEND_PARSE_PARAMS_QUIET can -be used as 'flags' to specify that the function should operate quietly -and not output any error messages. - -Both functions return SUCCESS or FAILURE depending on the result. - -The auto-conversions are performed as necessary. Arrays, objects, and -resources cannot be auto-converted. - - -Type specifiers ---------------- - l - long - d - double - s - string (with possible null bytes) and its length - b - boolean, stored in zend_bool - r - resource (stored in zval) - a - array - o - object (of any type) - O - object (of specific type, specified by class entry) - z - the actual zval - - The following characters also have a meaning in the specifier string: - | - indicates that the remaining parameters are optional, they - should be initialized to default values by the extension since they - will not be touched by the parsing function if they are not - passed to it. - / - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows - ! - the parameter it follows can be of specified type or NULL (only applies - to 'a', 'o', 'O', 'r', and 'z'). If NULL is passed, the results - pointer is set to NULL as well. - -Examples --------- -/* Gets a long, a string and its length, and a zval */ -long l; -char *s; -int s_len; -zval *param; -if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz", - &l, &s, &s_len, ¶m) == FAILURE) { - return; -} - - -/* Gets an object of class specified by my_ce, and an optional double. */ -zval *obj; -double d = 0.5; -zend_class_entry my_ce; -if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d", - &obj, my_ce, &d) == FAILURE) { - return; -} - - -/* Gets an object or null, and an array. - If null is passed for object, obj will be set to NULL. */ -zval *obj; -zval *arr; -if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a", - &obj, &arr) == FAILURE) { - return; -} - - -/* Gets a separated array which can also be null. */ -zval *arr; -if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!", - &arr) == FAILURE) { - return; -} - - -/* Get only the first three parameters (useful for varargs functions). */ -zval *z; -zend_bool b; -zval *r; -if (zend_parse_parameters(3 TSRMLS_CC, "zbr!", - &z, &b, &r) == FAILURE) { - return; -} - - -/* Get either a set of 3 longs or a string. */ -long l1, l2, l3; -char *s; -/* - * The function expects a pointer to a integer in this case, not a long - * or any other type. If you specify a type which is larger - * than a 'int', the upper bits might not be initialized - * properly, leading to random crashes on platforms like - * Tru64 or Linux/Alpha. - */ -int length; - -if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "lll", &l1, &l2, &l3) == SUCCESS) { - /* manipulate longs */ -} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "s", &s, &length) == SUCCESS) { - /* manipulate string */ -} else { - /* output error */ - - return; -} diff --git a/README.QNX b/README.QNX deleted file mode 100644 index d70d2e5d8b..0000000000 --- a/README.QNX +++ /dev/null @@ -1,57 +0,0 @@ -QNX4 Installation Notes ------------------------ - -NOTE: General installation instructions are in the INSTALL file - - -1. To compile and test PHP3 you have to grab, compile and install: - - GNU dbm library or another db library; - - GNU bison (1.25 or later; 1.25 tested); - - GNU flex (any version supporting -o and -P options; 2.5.4 tested); - - GNU diffutils (any version supporting -w option; 2.7 tested); - -2. To use CVS version you may need also: - - GNU CVS (1.9 tested); - - GNU autoconf (2.12 tested); - - GNU m4 (1.3 or later preferable; 1.4 tested); - -3. To run configure define -lunix in command line: - LDFLAGS=-lunix ./configure - -4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in - command line and run configure with --with-custom-odbc: - CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50 - If you have SQL Anywhere version 5.5.00, then you have to add - CFLAGS=-DSQLANY_BUG - to workaround its SQLFreeEnv() bug. Other versions has not been tested, - so try without this flag first. - -5. To build the Apache module, you may have to hardcode an include path for - alloc.h in your Apache base directory: - - APACHE_DIRECTORY/src/httpd.h: - change #include "alloc.h" - to #include "APACHE_DIRECTORY/src/alloc.h" - Unless you want to use system regex library, you have to hardcode also - a path to regex.h: - - APACHE_DIRECTORY/src/conf.h: - change #include - to #include "APACHE_DIRECTORY/src/regex/regex.h" - I don't know so far why this required for QNX, may be it is Watcom - compiler problem. - - If you building Apache module with SQL Anywhere support, you'll get - symbol conflict with BOOL. It is defined in Apache (httpd.h) and in - SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to - fix it yourself someway. - -6. With above precautions, it should compile as is and pass regression - tests completely: - make - make check - make install - - Don't bother me unless you really sure you made that all but it - still doesn't work. - -June 28, 1998 -Igor Kovalenko -- owl@infomarket.ru diff --git a/README.SELF-CONTAINED-EXTENSIONS b/README.SELF-CONTAINED-EXTENSIONS deleted file mode 100644 index e6a375331b..0000000000 --- a/README.SELF-CONTAINED-EXTENSIONS +++ /dev/null @@ -1,155 +0,0 @@ -$Id$ -============================================================================= - -HOW TO CREATE A SELF-CONTAINED PHP EXTENSION - - A self-contained extension can be distributed independently of - the PHP source. To create such an extension, two things are - required: - - - Configuration file (config.m4) - - Source code for your module - - We will describe now how to create these and how to put things - together. - -PREPARING YOUR SYSTEM - - While the result will run on any system, a developer's setup needs these - tools: - - GNU autoconf - GNU automake - GNU libtool - GNU m4 - - All of these are available from - - ftp://ftp.gnu.org/pub/gnu/ - -CONVERTING AN EXISTING EXTENSION - - Just to show you how easy it is to create a self-contained - extension, we will convert an embedded extension into a - self-contained one. Install PHP and execute the following - commands. - - $ mkdir /tmp/newext - $ cd /tmp/newext - - You now have an empty directory. We will copy the files from - the mysql extension: - - $ cp -rp php-4.0.X/ext/mysql/* . - - It is time to finish the module. Run: - - $ phpize - - You can now ship the contents of the directory - the extension - can live completely on its own. - - The user instructions boil down to - - $ ./configure \ - [--with-php-config=/path/to/php-config] \ - [--with-mysql=MYSQL-DIR] - $ make install - - The MySQL module will either use the embedded MySQL client - library or the MySQL installation in MYSQL-DIR. - - -DEFINING THE NEW EXTENSION - - Our demo extension is called "foobar". - - It consists of two source files "foo.c" and "bar.c" - (and any arbitrary amount of header files, but that is not - important here). - - The demo extension does not reference any external - libraries (that is important, because the user does not - need to specify anything). - - - LTLIBRARY_SOURCES specifies the names of the sources files. You can - name an arbitrary number of source files here. - -CREATING THE M4 CONFIGURATION FILE - - The m4 configuration can perform additional checks. For a - self-contained extension, you do not need more than a few - macro calls. - ------------------------------------------------------------------------------- -PHP_ARG_ENABLE(foobar,whether to enable foobar, -[ --enable-foobar Enable foobar]) - -if test "$PHP_FOOBAR" != "no"; then - PHP_NEW_EXTENSION(foobar, foo.c bar.c, $ext_shared) -fi ------------------------------------------------------------------------------- - - PHP_ARG_ENABLE will automatically set the correct variables, so - that the extension will be enabled by PHP_NEW_EXTENSION in shared mode. - - The first argument of PHP_NEW_EXTENSION describes the name of the - extension. The second names the source-code files. The third passes - $ext_shared which is set by PHP_ARG_ENABLE/WITH to PHP_NEW_EXTENSION. - - Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not - plan to distribute your module with PHP, these facilities allow you - to integrate your module easily into the main PHP module framework. - -CREATING SOURCE FILES - - ext_skel can be of great help when creating the common code for all modules - in PHP for you and also writing basic function definitions and C code for - handling arguments passed to your functions. See README.EXT_SKEL for further - information. - - As for the rest, you are currently alone here. There are a lot of existing - modules, use a simple module as a starting point and add your own code. - - -CREATING THE SELF-CONTAINED EXTENSION - - Put config.m4 and the source files into one directory. Then, run phpize - (this is installed during make install by PHP 4.0). - - For example, if you configured PHP with --prefix=/php, you would run - - $ /php/bin/phpize - - This will automatically copy the necessary build files and create - configure from your config.m4. - - And that's it. You now have a self-contained extension. - -INSTALLING A SELF-CONTAINED EXTENSION - - An extension can be installed by running: - - $ ./configure \ - [--with-php-config=/path/to/php-config] - $ make install - -ADDING SHARED MODULE SUPPORT TO A MODULE - - In order to be useful, a self-contained extension must be loadable - as a shared module. I will explain now how you can add shared module - support to an existing module called foo. - - 1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will - automatically be able to use --with-foo=shared[,..] or - --enable-foo=shared[,..]. - - 2. In config.m4, use PHP_NEW_EXTENSION(foo,.., $ext_shared) to enable - building the extension. - - 3. Add the following lines to your C source file: - - #ifdef COMPILE_DL_FOO - ZEND_GET_MODULE(foo) - #endif diff --git a/README.STREAMS b/README.STREAMS deleted file mode 100644 index f625406a3b..0000000000 --- a/README.STREAMS +++ /dev/null @@ -1,379 +0,0 @@ -An Overview of the PHP Streams abstraction -========================================== -$Id$ - -WARNING: some prototypes in this file are out of date. -The information contained here is being integrated into -the PHP manual - stay tuned... - -Please send comments to: Wez Furlong - -Why Streams? -============ -You may have noticed a shed-load of issock parameters flying around the PHP -code; we don't want them - they are ugly and cumbersome and force you to -special case sockets and files every time you need to work with a "user-level" -PHP file pointer. -Streams take care of that and present the PHP extension coder with an ANSI -stdio-alike API that looks much nicer and can be extended to support non file -based data sources. - -Using Streams -============= -Streams use a php_stream* parameter just as ANSI stdio (fread etc.) use a -FILE* parameter. - -The main functions are: - -PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count); -PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t - count); -PHPAPI size_t php_stream_printf(php_stream * stream TSRMLS_DC, - const char * fmt, ...); -PHPAPI int php_stream_eof(php_stream * stream); -PHPAPI int php_stream_getc(php_stream * stream); -PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen); -PHPAPI int php_stream_close(php_stream * stream); -PHPAPI int php_stream_flush(php_stream * stream); -PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence); -PHPAPI off_t php_stream_tell(php_stream * stream); -PHPAPI int php_stream_lock(php_stream * stream, int mode); - -These (should) behave in the same way as the ANSI stdio functions with similar -names: fread, fwrite, fprintf, feof, fgetc, fgets, fclose, fflush, fseek, ftell, flock. - -Opening Streams -=============== -In most cases, you should use this API: - -PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode, - int options, char **opened_path TSRMLS_DC); - -Where: - path is the file or resource to open. - mode is the stdio compatible mode eg: "wb", "rb" etc. - options is a combination of the following values: - IGNORE_PATH (default) - don't use include path to search for the file - USE_PATH - use include path to search for the file - IGNORE_URL - do not use plugin wrappers - REPORT_ERRORS - show errors in a standard format if something - goes wrong. - STREAM_MUST_SEEK - If you really need to be able to seek the stream - and don't need to be able to write to the original - file/URL, use this option to arrange for the stream - to be copied (if needed) into a stream that can - be seek()ed. - - opened_path is used to return the path of the actual file opened, - but if you used STREAM_MUST_SEEK, may not be valid. You are - responsible for efree()ing opened_path. opened_path may be (and usually - is) NULL. - -If you need to open a specific stream, or convert standard resources into -streams there are a range of functions to do this defined in php_streams.h. -A brief list of the most commonly used functions: - -PHPAPI php_stream *php_stream_fopen_from_file(FILE *file, const char *mode); - Convert a FILE * into a stream. - -PHPAPI php_stream *php_stream_fopen_tmpfile(void); - Open a FILE * with tmpfile() and convert into a stream. - -PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir, - const char *pfx, char **opened_path TSRMLS_DC); - Generate a temporary file name and open it. - -There are some network enabled relatives in php_network.h: - -PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent); - Convert a socket into a stream. - -PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port, - int socktype, int timeout, int persistent); - Open a connection to a host and return a stream. - -PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent, - struct timeval *timeout); - Open a UNIX domain socket. - - -Stream Utilities -================ - -If you need to copy some data from one stream to another, you will be please -to know that the streams API provides a standard way to do this: - -PHPAPI size_t php_stream_copy_to_stream(php_stream *src, - php_stream *dest, size_t maxlen); - -If you want to copy all remaining data from the src stream, pass -PHP_STREAM_COPY_ALL as the maxlen parameter, otherwise maxlen indicates the -number of bytes to copy. -This function will try to use mmap where available to make the copying more -efficient. - -If you want to read the contents of a stream into an allocated memory buffer, -you should use: - -PHPAPI size_t php_stream_copy_to_mem(php_stream *src, char **buf, - size_t maxlen, int persistent); - -This function will set buf to the address of the buffer that it allocated, -which will be maxlen bytes in length, or will be the entire length of the -data remaining on the stream if you set maxlen to PHP_STREAM_COPY_ALL. -The buffer is allocated using pemalloc(); you need to call pefree() to -release the memory when you are done. -As with copy_to_stream, this function will try use mmap where it can. - -If you have an existing stream and need to be able to seek() it, you -can use this function to copy the contents into a new stream that can -be seek()ed: - -PHPAPI int php_stream_make_seekable(php_stream *origstream, php_stream **newstream); - -It returns one of the following values: -#define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */ -#define PHP_STREAM_RELEASED 1 /* newstream should be used; origstream is no longer valid */ -#define PHP_STREAM_FAILED 2 /* an error occurred while attempting conversion */ -#define PHP_STREAM_CRITICAL 3 /* an error occurred; origstream is in an unknown state; you should close origstream */ - -make_seekable will always set newstream to be the stream that is valid -if the function succeeds. -When you have finished, remember to close the stream. - -NOTE: If you only need to seek forward, there is no need to call this -function, as the php_stream_seek can emulate forward seeking when the -whence parameter is SEEK_CUR. - -NOTE: Writing to the stream may not affect the original source, so it -only makes sense to use this for read-only use. - -NOTE: If the origstream is network based, this function will block -until the whole contents have been downloaded. - -NOTE: Never call this function with an origstream that is referenced -as a resource! It will close the origstream on success, and this -can lead to a crash when the resource is later used/released. - -NOTE: If you are opening a stream and need it to be seekable, use the -STREAM_MUST_SEEK option to php_stream_open_wrapper(); - -PHPAPI int php_stream_supports_lock(php_stream * stream); - -This function will return either 1 (success) or 0 (failure) indicating whether or -not a lock can be set on this stream. Typically you can only set locks on stdio streams. - -Casting Streams -=============== -What if your extension needs to access the FILE* of a user level file pointer? -You need to "cast" the stream into a FILE*, and this is how you do it: - -FILE * fp; -php_stream * stream; /* already opened */ - -if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&fp, REPORT_ERRORS) == FAILURE) { - RETURN_FALSE; -} - -The prototype is: - -PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int - show_err); - -The show_err parameter, if non-zero, will cause the function to display an -appropriate error message of type E_WARNING if the cast fails. - -castas can be one of the following values: -PHP_STREAM_AS_STDIO - a stdio FILE* -PHP_STREAM_AS_FD - a generic file descriptor -PHP_STREAM_AS_SOCKETD - a socket descriptor - -If you ask a socket stream for a FILE*, the abstraction will use fdopen to -create it for you. Be warned that doing so may cause buffered data to be lost -if you mix ANSI stdio calls on the FILE* with php stream calls on the stream. - -If your system has the fopencookie function, php streams can synthesize a -FILE* on top of any stream, which is useful for SSL sockets, memory based -streams, data base streams etc. etc. - -In situations where this is not desirable, you should query the stream -to see if it naturally supports FILE *. You can use this code snippet -for this purpose: - - if (php_stream_is(stream, PHP_STREAM_IS_STDIO)) { - /* can safely cast to FILE* with no adverse side effects */ - } - -You can use: - -PHPAPI int php_stream_can_cast(php_stream * stream, int castas) - -to find out if a stream can be cast, without actually performing the cast, so -to check if a stream is a socket you might use: - -if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) { - /* it can be a socket */ -} - -Please note the difference between php_stream_is and php_stream_can_cast; -stream_is tells you if the stream is a particular type of stream, whereas -can_cast tells you if the stream can be forced into the form you request. -The former doesn't change anything, while the later *might* change some -state in the stream. - -Stream Internals -================ - -There are two main structures associated with a stream - the php_stream -itself, which holds some state information (and possibly a buffer) and a -php_stream_ops structure, which holds the "virtual method table" for the -underlying implementation. - -The php_streams ops struct consists of pointers to methods that implement -read, write, close, flush, seek, gets and cast operations. Of these, an -implementation need only implement write, read, close and flush. The gets -method is intended to be used for streams if there is an underlying method -that can efficiently behave as fgets. The ops struct also contains a label -for the implementation that will be used when printing error messages - the -stdio implementation has a label of "STDIO" for example. - -The idea is that a stream implementation defines a php_stream_ops struct, and -associates it with a php_stream using php_stream_alloc. - -As an example, the php_stream_fopen() function looks like this: - -PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode) -{ - FILE * fp = fopen(filename, mode); - php_stream * ret; - - if (fp) { - ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, 0, mode); - if (ret) - return ret; - - fclose(fp); - } - return NULL; -} - -php_stream_stdio_ops is a php_stream_ops structure that can be used to handle -FILE* based streams. - -A socket based stream would use code similar to that above to create a stream -to be passed back to fopen_wrapper (or it's yet to be implemented successor). - -The prototype for php_stream_alloc is this: - -PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract, - size_t bufsize, int persistent, const char * mode) - -ops is a pointer to the implementation, -abstract holds implementation specific data that is relevant to this instance -of the stream, -bufsize is the size of the buffer to use - if 0, then buffering at the stream -level will be disabled (recommended for underlying sources that implement -their own buffering - such a FILE*), -persistent controls how the memory is to be allocated - persistently so that -it lasts across requests, or non-persistently so that it is freed at the end -of a request (it uses pemalloc), -mode is the stdio-like mode of operation - php streams places no real meaning -in the mode parameter, except that it checks for a 'w' in the string when -attempting to write (this may change). - -The mode parameter is passed on to fdopen/fopencookie when the stream is cast -into a FILE*, so it should be compatible with the mode parameter of fopen(). - -Writing your own stream implementation -====================================== - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -RULE #1: when writing your own streams: make sure you have configured PHP with ---enable-debug. -I've taken some great pains to hook into the Zend memory manager to help track -down allocation problems. It will also help you spot incorrect use of the -STREAMS_DC, STREAMS_CC and the semi-private STREAMS_REL_CC macros for function -definitions. -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -RULE #2: Please use the stdio stream as a reference; it will help you -understand the semantics of the stream operations, and it will always -be more up to date than these docs :-) - -First, you need to figure out what data you need to associate with the -php_stream. For example, you might need a pointer to some memory for memory -based streams, or if you were making a stream to read data from an RDBMS like -MySQL, you might want to store the connection and rowset handles. - -The stream has a field called abstract that you can use to hold this data. -If you need to store more than a single field of data, define a structure to -hold it, allocate it (use pemalloc with the persistent flag set -appropriately), and use the abstract pointer to refer to it. - -For structured state you might have this: - -struct my_state { - MYSQL conn; - MYSQL_RES * result; -}; - -struct my_state * state = pemalloc(sizeof(struct my_state), persistent); - -/* initialize the connection, and run a query, using the fields in state to - * hold the results */ - -state->result = mysql_use_result(&state->conn); - -/* now allocate the stream itself */ -stream = php_stream_alloc(&my_ops, state, 0, persistent, "r"); - -/* now stream->abstract == state */ - -Once you have that part figured out, you can write your implementation and -define the your own php_stream_ops struct (we called it my_ops in the above -example). - -For example, for reading from this weird MySQL stream: - -static size_t php_mysqlop_read(php_stream * stream, char * buf, size_t count) -{ - struct my_state * state = (struct my_state*)stream->abstract; - - if (buf == NULL && count == 0) { - /* in this special case, php_streams is asking if we have reached the - * end of file */ - if (... at end of file ...) - return EOF; - else - return 0; - } - - /* pull out some data from the stream and put it in buf */ - ... mysql_fetch_row(state->result) ... - /* we could do something strange, like format the data as XML here, - and place that in the buf, but that brings in some complexities, - such as coping with a buffer size too small to hold the data, - so I won't even go in to how to do that here */ -} - -Implement the other operations - remember that write, read, close and flush -are all mandatory. The rest are optional. Declare your stream ops struct: - -php_stream_ops my_ops = { - php_mysqlop_write, php_mysqlop_read, php_mysqlop_close, - php_mysqlop_flush, NULL, NULL, NULL, - "Strange MySQL example" -} - -Thats it! - -Take a look at the STDIO implementation in streams.c for more information -about how these operations work. -The main thing to remember is that in your close operation you need to release -and free the resources you allocated for the abstract field. In the case of -the example above, you need to use mysql_free_result on the rowset, close the -connection and then use pefree to dispose of the struct you allocated. -You may read the stream->persistent field to determine if your struct was -allocated in persistent mode or not. - -vim:tw=78:et diff --git a/README.SUBMITTING_PATCH b/README.SUBMITTING_PATCH deleted file mode 100644 index 51dac14029..0000000000 --- a/README.SUBMITTING_PATCH +++ /dev/null @@ -1,126 +0,0 @@ -Submitting Patch for PHP -======================== - -This document describes how to submit a patch for PHP. Since you are -reading this document, you are willing to submit a patch for PHP. -Please keep reading! Submitting a patch for PHP is easy. The hard -part is making it acceptable for inclusion into our repository. :-) - -How to create patch? --------------------- -We are working with CVS. You need to get CVS source to create a patch -that we accept. Visit http://www.php.net/anoncvs.php to get CVS -source. You can check out older versions, but make sure you get -the default branch (i.e. Do not use -r option when you check out the -CVS source) - -Read CODING_STANDARDS file before you start working. - -Now you are ready to create a patch. Modify source to fix a bug in PHP or -add a new feature to PHP. After you finished editing, please test your -patch. Read README.TESTING for testing. - -After you finish testing your patch, take diff file using -"cvs diff > your.patch" command. - -Read README.TESTING for submitting a test script for your patch. This is -not strictly required, but it is preferred to submit a test script along -with your patch. Making new test script is very easy. It also helps us -to understand what you have been fixed or added to PHP. - - -Tips for creating patch ------------------------ -If you would like to fix multiple bugs. It is easier for us if you -could create 1 patch for 1 bug, but this is not strictly required. -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 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. - -If you are new to CVS (Concurrent Versions System), visit -http://cvshome.org/ for details. - - -Recommended CVS client settings for creating patch file ------------------------------------------------------- -Recommended ~/.cvsrc file setting is: ------- -cvs -z3 -update -d -P -checkout -P -diff -u - ------- -diff -u means: - -u Use the unified output format. - -With this CVS setting, you don't have to worry about adding/deleting -newlines and spaces. - - -Check list for submitting patch -------------------------------- - - Did you run "make test" to check if your patch didn't break - other features? - - Did you compile PHP with --enable-debug and check the PHP and - web server error logs when you test your patch? - - Did you build PHP for multi-threaded web servers. (Optional) - - Did you create test script for "make test"? (Recommended) - - Did you check your patch is unified format and it does not - contain white space changes? (If you are not using recommended - cvs setting) - - Did you update CVS source before you take final patch? - - Did you read the patch again? - - -Where to send your patch? -------------------------- -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. - -If you are patching PEAR, send the patch to pear-dev@lists.php.net. - -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 acclomplish this, is to make the extension - '.txt'. - -Test scripts should be included in the same email. -Explain what has been fixed/added/changed by your patch. - -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. - -Because this is a volunteer-driven effort, more complex patches will -require more patience on your side. - -If you did not receive any feedback in a few days, please consider -resubmitting the description of your patch, along-side with -these questions: - -- Is my patch too hard to review? Because of which factors? -- Should I split it up in multiple parts? -- Are there any unwanted whitespace changes? - - -What happens when your patch is applied? ----------------------------------------- -Your name will be included together with your email address in the CVS -commit log. If your patch affects end-users, a brief description -and your name might be added to the NEWS file. - - -Thank you for submitting patch for PHP! diff --git a/README.TESTING b/README.TESTING deleted file mode 100644 index eca267a636..0000000000 --- a/README.TESTING +++ /dev/null @@ -1,170 +0,0 @@ -[IMPORTANT NOTICE] ------------------- - 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] ----------------- - 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. - -Usage: -make test - - "make test" basically executes "run-tests.php" script -under the source root (parallel builds will not work). Therefore you -can execute the script as follows: - -TEST_PHP_EXECUTABLE=sapi/cli/php \ -sapi/cli/php [-c /path/to/php.ini] run-tests.php [ext/foo/tests/GLOB] - - -[Which "php" executable "make test" look for] ---------------------------------------------- - You must use TEST_PHP_EXECUTABLE environment variable to explicitly -select the php executable to be used to run the tests. That can either -be the CLI or CGI executable. - - "make test" executes "run-tests.php" script with "php" binary. Some -test scripts such as session must be executed by CGI SAPI. Therefore, -you must build PHP with CGI SAPI to perform all tests. - -NOTE: PHP binary executing "run-tests.php" and php binary used for -executing test scripts may differ. If you use different PHP binary for -executing "run-tests.php" script, you may get errors. - - -[Which php.ini is used] ------------------------ - "make test" uses the same php.ini file as it would once installed. -The tests have been written to be independent of that php.ini file, -so if you find a test that is affected by a setting, please report -this, so we can address the issue. - - -[Which test scripts are executed] ---------------------------------- - "run-tests.php" ("make test"), without any arguments executes all -test scripts by extracting all directories named "tests" -from the source root and any subdirectories below. If there are files, -which have a "phpt" extension, "run-tests.php" looks at the sections -in these files, determines whether it should run it, by evaluating -the 'SKIP' section. If the test is eligible for execution, the 'FILE' -section is extracted into a ".php" file (with the same name besides -the extension) and gets executed. -When an argument is given or TESTS environment variable is set, the -GLOB is expanded by the shell and any file with extension "*.phpt" is -regarded as a test file. - - Tester can easily execute tests selectively with as follows. - -Examples: -./sapi/cli/php run-tests.php ext/mbstring/* -./sapi/cli/php run-tests.php ext/mbstring/020.phpt - - -[Test results] --------------- - Test results are printed to standard output. If there is a failed test, -the "run-tests.php" script saves the result, the expected result and the -code executed to the test script directory. For example, if -ext/myext/tests/myext.phpt fails to pass, the following files are created: - -ext/myext/tests/myext.php - actual test file executed -ext/myext/tests/myext.log - log of test execution (L) -ext/myext/tests/myext.exp - expected output (E) -ext/myext/tests/myext.out - output from test script (O) -ext/myext/tests/myext.diff - diff of .out and .exp (D) - - Failed tests are always bugs. Either the test is bugged or not considering -factors applying to the tester's environment, or there is a bug in PHP. -If this is a known bug, we strive to provide bug numbers, in either the -test name or the file name. You can check the status of such a bug, by -going to: http://bugs.php.net/12345 where 12345 is the bug number. -For clarity and automated processing, bug numbers are prefixed by a hash -sign '#' in test names and/or test cases are named bug12345.phpt. - -NOTE: The files generated by tests can be selected by setting the -environment variable TEST_PHP_LOG_FORMAT. For each file you want to be -generated use the character in brackets as shown above (default is LEOD). -The php file will be generated always. - -NOTE: You can set environment variable TEST_PHP_DETAILED to enable -detailed test information. - -[Automated testing] - If you like to keep up to speed, with latest developments and quality -assurance, setting the environment variable NO_INTERACTION to 1, will not -prompt the tester for any user input. - -Normally, the exit status of "make test" is zero, regardless of the results -of independent tests. Set the environment variable REPORT_EXIT_STATUS to 1, -and "make test" will set the exit status ("$?") to non-zero, when an -individual test has failed. - -Example script to be run by cron(1): -========== qa-test.sh ============= -#!/bin/sh - -CO_DIR=$HOME/cvs/php4 -MYMAIL=qa-test@domain.com -TMPDIR=/var/tmp -TODAY=`date +"%Y%m%d"` - -# Make sure compilation enviroment is correct -CONFIGURE_OPTS='--disable-all --enable-cli --with-pcre' -export MAKE=gmake -export CC=gcc - -# Set test environment -export NO_INTERACTION=1 -export REPORT_EXIT_STATUS=1 - -cd $CO_DIR -cvs update . >>$TMPDIR/phpqatest.$TODAY -./cvsclean ; ./buildconf ; ./configure $CONFIGURE_OPTS ; $MAKE -$MAKE test >>$TMPDIR/phpqatest.$TODAY 2>&1 -if test $? -gt 0 -then - cat $TMPDIR/phpqatest.$TODAY | mail -s"PHP-QA Test Failed for $TODAY" $MYMAIL -fi -========== end of qa-test.sh ============= - -NOTE: the exit status of run-tests.php will be 1 when -REPORT_EXIT_STATUS is set. The result of "make test" may be higher -than that. At present, gmake 3.79.1 returns 2, so it is -advised to test for non-zero, rather then a specific value. - - -[Creating new test files] -------------------------- - Writing test file is very easy if you are used to PHP. -See the HOWTO at http://qa.php.net/write-test.php - - -[How to help us] ----------------- - If you find bug in PHP, you can submit bug report AND test script -for us. You don't have to write complete script, just give us test -script with following format. Please test the script and make sure -you write the correct ACTUAL OUTPUT and EXPECTED OUTPUT before you -submit. - - diff --git a/README.TESTING2 b/README.TESTING2 deleted file mode 100644 index 30bd26c88e..0000000000 --- a/README.TESTING2 +++ /dev/null @@ -1,137 +0,0 @@ -[IMPORTANT NOTICE] ------------------- -This is an addendum to README.TESTING with additional information -specific to run-tests2.php. - -run-tests2.php is backward compatible with tests developed for -the original run-tests.php script. run-tests2 is *not* used by -'make test'. run-tests2 was developed to provide support for -testing PHP under it's primary environment, HTTP, and can run the -PHP tests under any of the SAPI modules that are direct executables, -or are accessable via HTTP. - -[New features] ----------------- -* Command line interface: - You can run 'php run-tests2.php -h' to get all the possible options. -* Configuration file: - the -c argument will allow you to use a configuration file. This is - handy if you are testing multiple environments and need various options - depending on the environment. - see run-tests-config.php for details. -* CGI Emulation: - Will emulate a CGI environment when testing with the cgi sapi executable. -* HTTP testing: - can be configured to run test scripts through an HTTP server running - on localhost. localhost is required since either the web server must - alias a directory to the php source directory, or the test scripts - must be copied to a directory under the web server - (see config options TEST_WEB_BASE_URL, TEST_BASE_PATH, and TEST_WEB_EXT) -* New sections supported for test files (see below) - -When running tests over http, tests that require ini settings different that what -the web server runs under will be skipped. Since the test harness defines a number -of ini settings by default, the web server may require special configuration to -make testing work. - -[Example Usage] ----------------- -Some (but not all!) examples of usage: - -1. run tests from the php source directory - php run-tests2.php -p /path/to/php-cli - -2. run tests using cgi emulation - php run-tests2.php -p /path/to/php-cgi - -3. run tests over http, copying test files into document root - php run-tests2.php -w -u http://localhost/test -m /path/to/htdocs/test - -4. run tests over http, php sources have been aliased in web server - php run-tests2.php -w -u http://localhost/test - -5. run tests using configuration file - php run-tests2.php -c /path/to/run-tests-config.php - -6. run tests using configuration file, but overriding some settings: - (config file must be first) - php run-tests2.php -c /path/to/run-tests-config.php -w -t 3 -d /path/to/testdir - -NOTE: configuration as described in README.TESTING still works. - -[New Test Sections] ----------------- -In addition to the traditional test sections -(see http://qa.php.net/write-test.php), several new sections are available -under run-tests2. - ---POST-- -This is not a new section, but not multipart posts are supported for testing -file uploads, or other types of POST data. - ---CGI-- -This section takes no value. It merely provides a simple marker for tests -that MUST be run as CGI, even if there is no --POST-- or --GET-- sections -in the test file. - ---DESCRIPTION-- -Not used for anything, just a section for documenting the test - ---ENV-- -This section get's eval()'d to help build an environment for the -execution of the test. This can be used to change environment -vars that are used for CGI emulation, or simply to set env vars -for cli testing. A full example looks like: - - --ENV-- - return <<conf all run-tests2 configuration vars - $this->env all environment variables that will get passed to the test - - ---REQUEST-- -This section is also eval'd, and is similar in nature to --ENV--. However, -this section is used to build the url used in an HTTP request. Valid values -to set in this section would include: - SCRIPT_NAME The inital part of the request url - PATH_INFO The pathinfo part of a request url - FRAGMENT The fragment section of a url (after #) - QUERY_STRING The query part of a url (after ?) - - --REQUEST-- - return << especially noticeable on slower systems -- slow recursive make replaced with one global Makefile -- eases integration of proper dependencies -- adds PHP_DEFINE(what[, value]) which creates a single include-file - per what. This will allow more fine-grained dependencies. -- abandoning the "one library per directory" concept -- improved integration of the CLI -- several new targets - build-modules: builds and copies dynamic modules into modules/ - install-cli: installs the CLI only, so that the install-sapi - target does only what its name says -- finally abandoned automake (still requires aclocal at this time) -- changed some configure-time constructs to run at buildconf-time -- upgraded shtool to 1.5.4 -- removed $(moduledir) (use EXTENSION_DIR) - -The Reason For a New System - -It became more and more apparent that there is a severe need -for addressing the portability concerns and improving the chance -that your build is correct (how often have you been told to -"make clean"? When this is done, you won't need to anymore). - - -If You Build PHP on a Unix System - - -You, as a user of PHP, will notice no changes. Of course, the build -system will be faster, look better and work smarter. - - - -If You Are Developing PHP - - - - -Extension developers: - -Makefile.ins are abandoned. The files which are to be compiled -are specified in the config.m4 now using the following macro: - -PHP_NEW_EXTENSION(foo, foo.c bar.c baz.cpp, $ext_shared) - -E.g. this enables the extension foo which consists of three source-code -modules, two in C and one in C++. And, depending on the user's wishes, -the extension will even be built as a dynamic module. - -The full syntax: - -PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]]) - -Please have a look at acinclude.m4 for the gory details and meanings -of the other parameters. - -And that's basically it for the extension side. - -If you previously built sub-libraries for this module, add -the source-code files here as well. If you need to specify -separate include directories, do it this way: - -PHP_NEW_EXTENSION(foo, foo.c mylib/bar.c mylib/gregor.c,,,-I@ext_srcdir@/lib) - -E.g. this builds the three files which are located relative to the -extension source directory and compiles all three files with the -special include directive (@ext_srcdir@ is automatically replaced). - -Now, you need to tell the build system that you want to build files -in a directory called $ext_builddir/lib: - -PHP_ADD_BUILD_DIR($ext_builddir/lib) - -Make sure to call this after PHP_NEW_EXTENSION, because $ext_builddir -is only set by the latter. - -If you have a complex extension, you might to need add special -Make rules. You can do this by calling PHP_ADD_MAKEFILE_FRAGMENT -in your config.m4 after PHP_NEW_EXTENSION. - -This will read a file in the source-dir of your extension called -Makefile.frag. In this file, $(builddir) and $(srcdir) will be -replaced by the values which are correct for your extension -and which are again determined by the PHP_NEW_EXTENSION macro. - -Make sure to prefix *all* relative paths correctly with either -$(builddir) or $(srcdir). Because the build system does not -change the working directory anymore, we must use either -absolute paths or relative ones to the top build-directory. -Correct prefixing ensures that. - - -SAPI developers: - -Instead of using PHP_SAPI=foo/PHP_BUILD_XYZ, you will need to type - -PHP_SELECT_SAPI(name, type, sources.c) - -I.e. specify the source-code files as above and also pass the -information regarding how PHP is supposed to be built (shared -module, program, etc). - -For example for APXS: - -PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php4.c php_apache.c) - - - -General info - -The foundation for the new system is the flexible handling of -sources and their contexts. With the help of macros you -can define special flags for each source-file, where it is -located, in which target context it can work, etc. - -Have a look at the well documented macros -PHP_ADD_SOURCES(_X) in acinclude.m4. diff --git a/README.Zeus b/README.Zeus deleted file mode 100644 index 8dcbb787f2..0000000000 --- a/README.Zeus +++ /dev/null @@ -1,112 +0,0 @@ -Using PHP4 with the Zeus Web Server ------------------------------------ - -Zeus fully supports running PHP in combination with our -webserver. There are three different interfaces that can be used to -enable PHP: - -* CGI -* ISAPI -* FastCGI - -Of the three, we recommend using FastCGI, which has been tested and -benchmarked as providing the best performance and reliability. - -Full details of how to install PHP are available from our -website, at: - -http://support.zeus.com/products/php.html - -If you have any problems, please check the support site for more -up-to-date information and advice. - - -Quick guide to installing CGI/FastCGI with Zeus ------------------------------------------------ - -Step 1 - Compile PHP as FastCGI. - -Compile as follows: - ./configure --enable-fastcgi - make - -Note that PHP has many options to the configure script - -e.g. --with-mysql. You will probably want to select your usual options -before compiling; the above is just a bare minimum, for illustration. - -After compilation finishes, you will be left with an executable -program called 'php'. Copy this into your document root, under a -dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php) - - -Step 2 - configure Zeus - -Four stages: - - enable FastCGI - - configure FastCGI - - setup alias for FastCGI - - setup alias for PHP - -1) Using the admin server, go to the 'module configuration' page for -your virtual server, and ensure that 'fastcgi' is enabled (select the -tickbox to the left). - -2) While we can run FastCGI's locally, there are known problems with -some OS's (specifically, the communication between web server and -FastCGI happens over a unix domain socket, and some OS's have trouble -sustaining high connection rates over these sockets). So instead, we -are going to set up the PHP FastCGI to run 'remotely' over localhost -(this uses TCP sockets, which do not suffer this problem). Go to the -'fastcgi configuration' page, and under 'add remote fastcgi': - Add Remote FastCGI - Docroot path /fcgi-bin/php - Remote machine localhost:8002 -The first entry is where you saved PHP, above. -The second entry is localhost: -We will start the FastCGI listening on this port shortly. -Click 'update' to commit these changes. - -3) Go to the path mapping module and add an alias for FastCGI: - Add Alias - Docroot path /fcgi-bin - Filesystem directory /path/to/docroot/fcgi-bin - Alias type fastcgi -Click 'update' to commit these changes - -4) Also on the path mapping module, add a handler for PHP: - Add handler - File extension php - Handler /fcgi-bin/php -Click 'update' to commit these changes - -Finally restart your virtual server for these changes to take effect. - - -Step 3 - start PHP as a FastCGI runner - -When you start PHP, it will pre-fork a given number of child processes -to handle incoming PHP requests. Each process will handle a given -number of requests before exiting (and being replaced by a newly -forked process). You can control these two parameters by setting the -following environment variables BEFORE starting the FastCGI runner: - -PHP_FCGI_CHILDREN - the number of child processes to pre-fork. This -variable MUST be set, if not then the PHP will not run as a FastCGI. -We recommend a value of 8 for a fairly busy site. If you have many, -long-running PHP scripts, then you may need to increase this further. - -PHP_FCGI_MAX_REQUESTS - the number of requests each PHP child process -handles before exiting. If not set, defaults to 500. - -To start the FastCGI runner, execute '$ZEUSHOME/web/bin/fcgirunner -8002 $DOCROOT/fcgi-bin/php'. Substitute the appropriate values for -$ZEUSHOME and $DOCROOT; also substitute for 8002 the port you chose, -above. - -To stop the runner (e.g. to experiment with the above environment -variables) you will need to manually stop and running PHP -processes. (Use 'ps' and 'kill'). As it is PHP which is forking lots -of children and not the runner, Zeus unfortunately cannot keep track -of what processes are running, sorry. A typical command line may look -like 'ps -efl | grep $DOCROOT/fcgi-bin/php | grep -v grep | awk -'{print $4}' | xargs kill' diff --git a/README.input_filter b/README.input_filter deleted file mode 100644 index 60a88ed9c2..0000000000 --- a/README.input_filter +++ /dev/null @@ -1,188 +0,0 @@ -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 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 -policy you will need to write a standard PHP extension. - -A simple implementation might look like the following. This stores the -original raw user data and adds a my_get_raw() function while the normal -$_POST, $_GET and $_COOKIE arrays are only populated with stripped -data. In this simple example all I am doing is calling strip_tags() on -the data. If register_globals is turned on, the default globals that -are created will be stripped ($foo) while a $RAW_foo is created with the -original user input. - -ZEND_BEGIN_MODULE_GLOBALS(my_input_filter) - zval *post_array; - zval *get_array; - zval *cookie_array; -ZEND_END_MODULE_GLOBALS(my_input_filter) - -#ifdef ZTS -#define IF_G(v) TSRMG(my_input_filter_globals_id, zend_my_input_filter_globals *, v) -#else -#define IF_G(v) (my_input_filter_globals.v) -#endif - -ZEND_DECLARE_MODULE_GLOBALS(my_input_filter) - -function_entry my_input_filter_functions[] = { - PHP_FE(my_get_raw, NULL) - {NULL, NULL, NULL} -}; - -zend_module_entry my_input_filter_module_entry = { - STANDARD_MODULE_HEADER, - "my_input_filter", - my_input_filter_functions, - PHP_MINIT(my_input_filter), - PHP_MSHUTDOWN(my_input_filter), - NULL, - PHP_RSHUTDOWN(my_input_filter), - PHP_MINFO(my_input_filter), - "0.1", - STANDARD_MODULE_PROPERTIES -}; - -PHP_MINIT_FUNCTION(my_input_filter) -{ - ZEND_INIT_MODULE_GLOBALS(my_input_filter, php_my_input_filter_init_globals, NULL); - - REGISTER_LONG_CONSTANT("POST", PARSE_POST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GET", PARSE_GET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT); - - sapi_register_input_filter(my_sapi_input_filter); - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(my_input_filter) -{ - if(IF_G(get_array)) { - zval_ptr_dtor(&IF_G(get_array)); - IF_G(get_array) = NULL; - } - if(IF_G(post_array)) { - zval_ptr_dtor(&IF_G(post_array)); - IF_G(post_array) = NULL; - } - if(IF_G(cookie_array)) { - zval_ptr_dtor(&IF_G(cookie_array)); - IF_G(cookie_array) = NULL; - } - return SUCCESS; -} - -PHP_MINFO_FUNCTION(my_input_filter) -{ - php_info_print_table_start(); - php_info_print_table_row( 2, "My Input Filter Support", "enabled" ); - php_info_print_table_row( 2, "Revision", "$Revision$"); - php_info_print_table_end(); -} - -unsigned int my_sapi_input_filter(int arg, char *var, char **val, unsigned int val_len) -{ - zval new_var; - zval *array_ptr = NULL; - char *raw_var; - int var_len; - - assert(*val != NULL); - - switch(arg) { - case PARSE_GET: - if(!IF_G(get_array)) { - ALLOC_ZVAL(array_ptr); - array_init(array_ptr); - INIT_PZVAL(array_ptr); - } - IF_G(get_array) = array_ptr; - break; - case PARSE_POST: - if(!IF_G(post_array)) { - ALLOC_ZVAL(array_ptr); - array_init(array_ptr); - INIT_PZVAL(array_ptr); - } - IF_G(post_array) = array_ptr; - break; - case PARSE_COOKIE: - if(!IF_G(cookie_array)) { - ALLOC_ZVAL(array_ptr); - array_init(array_ptr); - INIT_PZVAL(array_ptr); - } - IF_G(cookie_array) = array_ptr; - break; - } - Z_STRLEN(new_var) = val_len; - Z_STRVAL(new_var) = estrndup(*val, val_len); - Z_TYPE(new_var) = IS_STRING; - - var_len = strlen(var); - raw_var = emalloc(var_len+5); /* RAW_ and a \0 */ - strcpy(raw_var, "RAW_"); - strlcat(raw_var,var,var_len+5); - - php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC); - - php_strip_tags(*val, val_len, NULL, NULL, 0); - - return strlen(*val); -} - -PHP_FUNCTION(my_get_raw) -{ - long arg; - char *var; - int var_len; - zval **tmp; - zval *array_ptr = NULL; - HashTable *hash_ptr; - char *raw_var; - - if(zend_parse_parameters(2 TSRMLS_CC, "ls|l", &arg, &var, &var_len) == FAILURE) { - return; - } - - switch(arg) { - case PARSE_GET: - array_ptr = IF_G(get_array); - break; - case PARSE_POST: - array_ptr = IF_G(post_array); - break; - case PARSE_COOKIE: - array_ptr = IF_G(post_array); - break; - } - - if(!array_ptr) RETURN_FALSE; - - /* - * I'm changing the variable name here because when running with register_globals on, - * the variable will end up in the global symbol table - */ - raw_var = emalloc(var_len+5); /* RAW_ and a \0 */ - strcpy(raw_var, "RAW_"); - strlcat(raw_var,var,var_len+5); - hash_ptr = HASH_OF(array_ptr); - - if(zend_hash_find(hash_ptr, raw_var, var_len+5, (void **)&tmp) == SUCCESS) { - *return_value = **tmp; - zval_copy_ctor(return_value); - } else { - RETVAL_FALSE; - } - efree(raw_var); -} - diff --git a/TODO b/TODO deleted file mode 100644 index 81750cce87..0000000000 --- a/TODO +++ /dev/null @@ -1,162 +0,0 @@ -Things to do or at least think about doing in the future. Name in -parenthesis means that person has taken on this project. - -Zend ----- - * Allow foreach ($array as $k => list($a, $b)) syntax for multi - 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 - interfaces difficult which pass const parameters to us. - - -global ------- - * Make sure that all ZTS globals get destructed. Most ts_allocate_id() - calls should have a dtor entry. - * on some platforms unimplemented function will just do nothing - (e.g. symlink) they should print a warning or not even be defined! - (DONE ?) - * Use arg_separator.input to implode args in the CGI sapi extension - and arg_separator.input to explode in php_build_argv(). (DONE?) - * --enable-all in configure. (--enable-shared=max ...) - * make configure print out a summary when it's done (like XEmacs) - * replace standard functions which work on static data with - reentrancy-safe functions (DONE?). - * make SAPI conform to CGI/1.1. Currently, all SAPI modules - define REMOTE_ADDR etc. themselves and reach only various level - of compliance. - * see what functions might need to be changed to use HashPosition, so - that the internal array pointer is not affected. - * Move most extensions and PEAR packages out of the PHP CVS tree, - include them again during release packaging. - - Other - * use thread-safe resolver functions (either require BIND 8 or adns). - * implement javadoc based function docs template system. - * provide optional IPv6 support (seems to be done?). - * find a better way to implement script timeouts. SIGVTALRM is used - by some POSIX threads implementations (i.e. OpenBSD) and is not - available in ZTS mode. - * Implement flush feature suitable for nested output buffers. - -Streams -------- - * Route filestat.c through the wrapper layer; isolate the statcache code - so that it is independent of php functions and can be applied to any - stream/path. - * Add unlink() operation to wrappers, route userland unlink() through it. - Implement unlink() operation for the ftp wrapper. - * Add a method to take ownership of the memory buffer in memory streams so - that generating string values for zvals doesn't require an estrdup. - * bundle and use curl lib for fopen wrapper. - -documentation -------------- - * Add remarks in the documentation which functions are not implemented - on win32. - * Add remarks in the documentation which functions are not binary-safe. - * Update curl documentation (DONE?) - * Add developer documentation. - * Add detailed documentation for Java extension. - -ext/bz2 -------- - * Add ini setting for decompression buffer size. The default 4k is to small - for big files and takes ages to decompress. However, 40k which perform - quite good with big files may be to much under certain environments as - default setting. There should be consideren different default sizes for - different SAPIS (e.g. apache and cli). - -ext/curl --------- - * Have a warning scheme for when people use unsupported features. - -ext/oci8 --------- - * All OCIFetch*() functions should return 0 for no more data and false on - error. - * Have a flag that trims trailing spaces from CHAR fields on retrieval. - * Make allow_call_time_pass_reference=Off working. - * For additional todo information, see oci8.c, in ext/oci8 - -ext/odbc --------- - For PHP 4.3.0: - * update all php_error calls to php_error_docref where valid - * integrate EXPERIMENTAL ODBC update for use in PHP 5.0, use for - testing purposes only. - - For PHP 5.0.0 - * Activate EXPERIMENTAL ODBC codebase update - -ext/pcre --------- - * Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe - -ext/pcntl ---------- - * Change internal callback handler to use TICKS - * Remove all zend_extension code - * Add object callback support to pcntl_signal() - -ext/pgsql ---------- - For PHP 4.3.0: - * Add pg_metadata() with metadata cache feature. - * Add pg_convert() to check and convert array value for query. - * Add pg_insert/pg_update/pg_delete/pg_select for simple query. - -ext/session ------------ - For PHP 4.3.0: - * session_abort() to abort session. ie: Do not save session data. - * Allow unset($_SESSION) or unset($HTTP_SESSION_VARS) to unset - session vars regardless of register_globals setting. - - Other: - * Maybe implement finer-grained session variables that could be - locked individually. - * Write a network-transparent storage back-end with fallover - facilities - * 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(). - * Possibly modify parsing of GPC data to automatically create arrays if - variable name is seen more than once. - * Implement regex-cache for url-functions. - * Move socket related functions to fsock.c. - -ext/wddx --------- - * See if we can support the remaining data types: - dateTime - binary - - http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm - (Andrei) - - * implement wddx_packet_as_javascript(). (Andrei) - -other cool stuff ----------------- - * PVM extension - -vim:et:sw=4:ts=4 diff --git a/TODO-PHP5 b/TODO-PHP5 deleted file mode 100644 index 85b8481378..0000000000 --- a/TODO-PHP5 +++ /dev/null @@ -1,211 +0,0 @@ -Component: Zend Engine 2 - - Important stuff to finish: PPP members/PPP methods, - support of overloaded extensions, possibly differentiate - between class and namespace as discussed with Stig in - Germany. -Responsibility: Zeev, Andi, Stas -Time frame: Couple of months for first part and extensions will be - ongoing while PHP is being fixed. - Things to leave for later versions: Native aggregation - support, accessing static members via object and not class. - - -Component: Aggregation -Responsibility: Andi, Stig? -Time frame: ? - - -Component: Introspection - - get_function_definition( [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( [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( [field]) => - array( - file => filename - line_start => - line_end => - name => - value => - phpdoc => - ) - - get_global_variable_defintion( [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 - - -Component: Thread Safety - Identify the extensions that are not thread safe by design - or due to dependant libraries and identify them as such. - If possible try to resolve thread safety issue via code - improvements (if php code or patches will be accepted by - library maintainers). For situations where thread safety - cannot easily be acheived a flag in the extension API is - set so PHP can identify non-thread safe extensions. These - extensions will not be loaded in a ZTS compiled binary - (unless it is cli/cgi). - -Responsibility: ? -Time frame: ? - - -Component: SAPI - Environment variables defined in the CGI spec need to be - verified in each SAPI module that they conform to the CGI - spec correctly. If they do not, the SAPI module needs to - fix the variable prior to script execution. Having this - conformity will aid in having PHP scripts run correctly - under different sapi modules. - -Responsibility: Shane Caraveo & each sapi module owner -Timeframe: ? (but shouldn't be much effort, most modules are probably ok) - - -Component: Input Filtering - - Implement a SAPI input filter hook that will get called - just before registering a variable in the - treat_data/post_handler hooks. (done) - - Make sure this is also done in mbstring (done) - - Provide access functions, or perhaps a new - $_RAW_GET/POST/Cookie set of superglobals to get at the - unfiltered data - - Provide a .ini directive which allows people to set their - input filter to one of the built-in strip_tags, - htmlspecialchars or whatever other internal function might - be useful here. - - (The main benefit of this is to make it easier for people - to solve the XSS problem once and for all without having - to go through every line of their code and adding input - validation/filtering everywhere) -Responsibility: Rasmus -Timeframe: Yesterday - - -Component: RPC Abstraction Layer - Porting java, com, dotnet, xmlrpc, corba, soap and python, srm - (are there more ?) to work with the new oo api and preferably - by using ext/rpc. -Responsibility: Harald -Time frame: 2 months (but i have to wait for a few engine features first) - - -Component: OO Extensions - Each OO extension has to be revised and rewritten to fit into - the new OO model. We should decide which extensions are a must - to have for the release and which can be ported by the maintainer - later as a separate pecl release. - A list of extensions to be extended that have to be investigated: - * browscap - * aggregate - * all *sql extensions (*_fetch_object) - * domxml (seems like christian is rewriting it anyways) - * ming -Responsibility: Harald (, extension maintainers) - - -Component: Abstract Data Types (ADT) -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 - resources. Also developing an automated test thing which - cvs ups's, compiles and tests the build on a daily base on - as much platforms/extensions as possible. - - The test suite will also be extended to support threaded - testing and testing for differing sapi modules (via http - calls or other methods). -Reponsibility: Derick (, extension maintainers) -Time frame: 3 months diff --git a/TODO.BUILDv5 b/TODO.BUILDv5 deleted file mode 100644 index 28237ea4d1..0000000000 --- a/TODO.BUILDv5 +++ /dev/null @@ -1,3 +0,0 @@ -- clean up .cvsignores -- purge Makefile.ins and replace PHP_EXTENSION in config.m4s - with appropiate calls to PHP_NEW_EXTENSION diff --git a/TSRM/LICENSE b/TSRM/LICENSE deleted file mode 100644 index 8d208476e4..0000000000 --- a/TSRM/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. - -- Neither name of the copyright holders nor the names of their contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS -IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/TSRM/Makefile.am b/TSRM/Makefile.am deleted file mode 100644 index 91e585b65c..0000000000 --- a/TSRM/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -## process this file with automake to produce Makefile.am -AUTOMAKE_OPTIONS=foreign -noinst_LTLIBRARIES=libtsrm.la -libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c - -depend: diff --git a/TSRM/TODO b/TSRM/TODO deleted file mode 100644 index 82b4fedfde..0000000000 --- a/TSRM/TODO +++ /dev/null @@ -1,2 +0,0 @@ -- Improve the lock in ts_resource_ex() in order to cover less code. - This can probably be done by more careful hash table access diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c deleted file mode 100644 index f39114d770..0000000000 --- a/TSRM/TSRM.c +++ /dev/null @@ -1,666 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Thread Safe Resource Manager | - +----------------------------------------------------------------------+ - | Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski| - | This source file is subject to the TSRM license, that is bundled | - | with this package in the file LICENSE | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -#include "TSRM.h" - -#ifdef ZTS - -#include - -#if HAVE_STDARG_H -#include -#endif - -typedef struct _tsrm_tls_entry tsrm_tls_entry; - -struct _tsrm_tls_entry { - void **storage; - int count; - THREAD_T thread_id; - tsrm_tls_entry *next; -}; - - -typedef struct { - size_t size; - ts_allocate_ctor ctor; - ts_allocate_dtor dtor; -} tsrm_resource_type; - - -/* The memory manager table */ -static tsrm_tls_entry **tsrm_tls_table=NULL; -static int tsrm_tls_table_size; -static ts_rsrc_id id_count; - -/* The resource sizes table */ -static tsrm_resource_type *resource_types_table=NULL; -static int resource_types_table_size; - - -static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */ - -/* New thread handlers */ -static tsrm_thread_begin_func_t tsrm_new_thread_begin_handler; -static tsrm_thread_end_func_t tsrm_new_thread_end_handler; - -/* Debug support */ -int tsrm_error(int level, const char *format, ...); - -/* Read a resource from a thread's resource storage */ -static int tsrm_error_level; -static FILE *tsrm_error_file; - -#if TSRM_DEBUG -#define TSRM_ERROR(args) tsrm_error args -#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \ - { \ - int unshuffled_offset = TSRM_UNSHUFFLE_RSRC_ID(offset); \ - \ - if (offset==0) { \ - return &array; \ - } else if ((unshuffled_offset)>=0 && (unshuffled_offset)<(range)) { \ - TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Successfully fetched resource id %d for thread id %ld - 0x%0.8X", \ - unshuffled_offset, (long) thread_resources->thread_id, array[unshuffled_offset])); \ - return array[unshuffled_offset]; \ - } else { \ - TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Resource id %d is out of range (%d..%d)", \ - unshuffled_offset, TSRM_SHUFFLE_RSRC_ID(0), TSRM_SHUFFLE_RSRC_ID(thread_resources->count-1))); \ - return NULL; \ - } \ - } -#else -#define TSRM_ERROR(args) -#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \ - if (offset==0) { \ - return &array; \ - } else { \ - return array[TSRM_UNSHUFFLE_RSRC_ID(offset)]; \ - } -#endif - -#if defined(PTHREADS) -/* Thread local storage */ -static pthread_key_t tls_key; -#elif defined(TSRM_ST) -static int tls_key; -#elif defined(TSRM_WIN32) -static DWORD tls_key; -#elif defined(BETHREADS) -static int32 tls_key; -#endif - -/* Startup TSRM (call once for the entire process) */ -TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename) -{ -#if defined(GNUPTH) - pth_init(); -#elif defined(PTHREADS) - pthread_key_create( &tls_key, 0 ); -#elif defined(TSRM_ST) - st_init(); - st_key_create(&tls_key, 0); -#elif defined(TSRM_WIN32) - tls_key = TlsAlloc(); -#elif defined(BETHREADS) - tls_key = tls_allocate(); -#endif - - tsrm_error_file = stderr; - tsrm_error_set(debug_level, debug_filename); - tsrm_tls_table_size = expected_threads; - - tsrm_tls_table = (tsrm_tls_entry **) calloc(tsrm_tls_table_size, sizeof(tsrm_tls_entry *)); - if (!tsrm_tls_table) { - TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate TLS table")); - return 0; - } - id_count=0; - - resource_types_table_size = expected_resources; - resource_types_table = (tsrm_resource_type *) calloc(resource_types_table_size, sizeof(tsrm_resource_type)); - if (!resource_types_table) { - TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate resource types table")); - free(tsrm_tls_table); - tsrm_tls_table = NULL; - return 0; - } - - tsmm_mutex = tsrm_mutex_alloc(); - - tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL; - - TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Started up TSRM, %d expected threads, %d expected resources", expected_threads, expected_resources)); - return 1; -} - - -/* Shutdown TSRM (call once for the entire process) */ -TSRM_API void tsrm_shutdown(void) -{ - int i; - - if (tsrm_tls_table) { - for (i=0; inext; - for (j=0; jstorage[j], &p->storage); - } - free(p->storage[j]); - } - free(p->storage); - free(p); - p = next_p; - } - } - free(tsrm_tls_table); - tsrm_tls_table = NULL; - } - if (resource_types_table) { - free(resource_types_table); - resource_types_table=NULL; - } - tsrm_mutex_free(tsmm_mutex); - tsmm_mutex = NULL; - TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM")); - if (tsrm_error_file!=stderr) { - fclose(tsrm_error_file); - } -#if defined(GNUPTH) - pth_kill(); -#elif defined(PTHREADS) - pthread_key_delete(tls_key); -#elif defined(TSRM_WIN32) - TlsFree(tls_key); -#endif -} - - -/* allocates a new thread-safe-resource id */ -TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor) -{ - int i; - - TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtaining a new resource id, %d bytes", size)); - - tsrm_mutex_lock(tsmm_mutex); - - /* obtain a resource id */ - *rsrc_id = TSRM_SHUFFLE_RSRC_ID(id_count++); - TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtained resource id %d", *rsrc_id)); - - /* store the new resource type in the resource sizes table */ - if (resource_types_table_size < id_count) { - resource_types_table = (tsrm_resource_type *) realloc(resource_types_table, sizeof(tsrm_resource_type)*id_count); - if (!resource_types_table) { - tsrm_mutex_unlock(tsmm_mutex); - TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate storage for resource")); - *rsrc_id = 0; - return 0; - } - resource_types_table_size = id_count; - } - 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; - - /* enlarge the arrays for the already active threads */ - for (i=0; icount < id_count) { - int j; - - p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count); - for (j=p->count; jstorage[j] = (void *) malloc(resource_types_table[j].size); - if (resource_types_table[j].ctor) { - resource_types_table[j].ctor(p->storage[j], &p->storage); - } - } - p->count = id_count; - } - p = p->next; - } - } - tsrm_mutex_unlock(tsmm_mutex); - - TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", *rsrc_id)); - return *rsrc_id; -} - - -static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id) -{ - int i; - - TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id)); - (*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry)); - (*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count); - (*thread_resources_ptr)->count = id_count; - (*thread_resources_ptr)->thread_id = thread_id; - (*thread_resources_ptr)->next = NULL; - -#if defined(PTHREADS) - /* Set thread local storage to this new thread resources structure */ - pthread_setspecific(tls_key, (void *) *thread_resources_ptr); -#elif defined(TSRM_ST) - st_thread_setspecific(tls_key, (void *) *thread_resources_ptr); -#elif defined(TSRM_WIN32) - TlsSetValue(tls_key, (void *) *thread_resources_ptr); -#elif defined(BETHREADS) - tls_set(tls_key, (void*) *thread_resources_ptr); -#endif - - if (tsrm_new_thread_begin_handler) { - tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage)); - } - for (i=0; istorage[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); - } - } - - tsrm_mutex_unlock(tsmm_mutex); - - if (tsrm_new_thread_end_handler) { - tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage)); - } -} - - -/* fetches the requested resource for the current thread */ -TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id) -{ - THREAD_T thread_id; - int hash_value; - tsrm_tls_entry *thread_resources; - -#ifdef NETWARE - /* The below if loop is added for NetWare to fix an abend while unloading PHP - * when an Apache unload command is issued on the system console. - * While exiting from PHP, at the end for some reason, this function is called - * with tsrm_tls_table = NULL. When this happened, the server abends when - * tsrm_tls_table is accessed since it is NULL. - */ - if(tsrm_tls_table) { -#endif - if (!th_id) { -#if defined(PTHREADS) - /* Fast path for looking up the resources for the current - * thread. Its used by just about every call to - * ts_resource_ex(). This avoids the need for a mutex lock - * and our hashtable lookup. - */ - thread_resources = pthread_getspecific(tls_key); -#elif defined(TSRM_ST) - thread_resources = st_thread_getspecific(tls_key); -#elif defined(TSRM_WIN32) - thread_resources = TlsGetValue(tls_key); -#elif defined(BETHREADS) - thread_resources = (tsrm_tls_entry*)tls_get(tls_key); -#else - thread_resources = NULL; -#endif - if (thread_resources) { - TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id)); - /* Read a specific resource from the thread's resources. - * This is called outside of a mutex, so have to be aware about external - * changes to the structure as we read it. - */ - TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count); - } - thread_id = tsrm_thread_id(); - } else { - thread_id = *th_id; - } - - TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for thread %ld", id, (long) thread_id)); - tsrm_mutex_lock(tsmm_mutex); - - hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size); - thread_resources = tsrm_tls_table[hash_value]; - - if (!thread_resources) { - allocate_new_resource(&tsrm_tls_table[hash_value], thread_id); - return ts_resource_ex(id, &thread_id); - } else { - do { - if (thread_resources->thread_id == thread_id) { - break; - } - if (thread_resources->next) { - thread_resources = thread_resources->next; - } else { - allocate_new_resource(&thread_resources->next, thread_id); - return ts_resource_ex(id, &thread_id); - /* - * thread_resources = thread_resources->next; - * break; - */ - } - } while (thread_resources); - } - tsrm_mutex_unlock(tsmm_mutex); - /* Read a specific resource from the thread's resources. - * This is called outside of a mutex, so have to be aware about external - * changes to the structure as we read it. - */ - TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count); -#ifdef NETWARE - } /* if(tsrm_tls_table) */ -#endif -} - - -/* frees all resources allocated for the current thread */ -void ts_free_thread(void) -{ - tsrm_tls_entry *thread_resources; - int i; - THREAD_T thread_id = tsrm_thread_id(); - int hash_value; - tsrm_tls_entry *last=NULL; - - tsrm_mutex_lock(tsmm_mutex); - hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size); - thread_resources = tsrm_tls_table[hash_value]; - - while (thread_resources) { - if (thread_resources->thread_id == thread_id) { - for (i=0; icount; i++) { - if (resource_types_table[i].dtor) { - resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage); - } - } - for (i=0; icount; i++) { - free(thread_resources->storage[i]); - } - free(thread_resources->storage); - if (last) { - last->next = thread_resources->next; - } else { - tsrm_tls_table[hash_value] = thread_resources->next; - } -#if defined(PTHREADS) - pthread_setspecific(tls_key, 0); -#elif defined(TSRM_WIN32) - TlsSetValue(tls_key, 0); -#endif - free(thread_resources); - break; - } - if (thread_resources->next) { - last = thread_resources; - } - thread_resources = thread_resources->next; - } - tsrm_mutex_unlock(tsmm_mutex); -} - - -/* deallocates all occurrences of a given id */ -void ts_free_id(ts_rsrc_id id) -{ -} - - - - -/* - * Utility Functions - */ - -/* Obtain the current thread id */ -TSRM_API THREAD_T tsrm_thread_id(void) -{ -#ifdef TSRM_WIN32 - return GetCurrentThreadId(); -#elif defined(NETWARE) - /* There seems to be some problem with the LibC call: NXThreadGetId(). - * Due to this, the PHPMyAdmin application is abending in PHP calls. - * Used the call, kCurrentThread instead and it works fine. - */ -/* return NXThreadGetId(); */ - return kCurrentThread(); -#elif defined(GNUPTH) - return pth_self(); -#elif defined(PTHREADS) - return pthread_self(); -#elif defined(NSAPI) - return systhread_current(); -#elif defined(PI3WEB) - return PIThread_getCurrent(); -#elif defined(TSRM_ST) - return st_thread_self(); -#elif defined(BETHREADS) - return find_thread(NULL); -#endif -} - - -/* Allocate a mutex */ -TSRM_API MUTEX_T tsrm_mutex_alloc(void) -{ - MUTEX_T mutexp; -#ifdef NETWARE -#ifndef USE_MPK - /* To use the Recursive Mutex Locking of LibC */ - long flags = NX_MUTEX_RECURSIVE; - NXHierarchy_t order = 0; - NX_LOCK_INFO_ALLOC (lockInfo, "PHP-TSRM", 0); -#endif -#endif - -#ifdef TSRM_WIN32 - mutexp = malloc(sizeof(CRITICAL_SECTION)); - InitializeCriticalSection(mutexp); -#elif defined(NETWARE) -#ifdef USE_MPK - mutexp = kMutexAlloc((BYTE*)"PHP-TSRM"); -#else - mutexp = NXMutexAlloc(flags, order, &lockInfo); -#endif -#elif defined(GNUPTH) - mutexp = (MUTEX_T) malloc(sizeof(*mutexp)); - pth_mutex_init(mutexp); -#elif defined(PTHREADS) - mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - pthread_mutex_init(mutexp,NULL); -#elif defined(NSAPI) - mutexp = crit_init(); -#elif defined(PI3WEB) - mutexp = PIPlatform_allocLocalMutex(); -#elif defined(TSRM_ST) - mutexp = st_mutex_new(); -#elif defined(BETHREADS) - mutexp = (beos_ben*)malloc(sizeof(beos_ben)); - mutexp->ben = 0; - mutexp->sem = create_sem(1, "PHP sempahore"); -#endif -#ifdef THR_DEBUG - printf("Mutex created thread: %d\n",mythreadid()); -#endif - return( mutexp ); -} - - -/* Free a mutex */ -TSRM_API void tsrm_mutex_free(MUTEX_T mutexp) -{ - if (mutexp) { -#ifdef TSRM_WIN32 - DeleteCriticalSection(mutexp); - free(mutexp); -#elif defined(NETWARE) -#ifdef USE_MPK - kMutexFree(mutexp); -#else - NXMutexFree(mutexp); -#endif -#elif defined(GNUPTH) - free(mutexp); -#elif defined(PTHREADS) - pthread_mutex_destroy(mutexp); - free(mutexp); -#elif defined(NSAPI) - crit_terminate(mutexp); -#elif defined(PI3WEB) - PISync_delete(mutexp); -#elif defined(TSRM_ST) - st_mutex_destroy(mutexp); -#elif defined(BETHREADS) - delete_sem(mutexp->sem); - free(mutexp); -#endif - } -#ifdef THR_DEBUG - printf("Mutex freed thread: %d\n",mythreadid()); -#endif -} - - -/* Lock a mutex */ -TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp) -{ - TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id())); -#ifdef TSRM_WIN32 - EnterCriticalSection(mutexp); - return 1; -#elif defined(NETWARE) -#ifdef USE_MPK - return kMutexLock(mutexp); -#else - return NXLock(mutexp); -#endif -#elif defined(GNUPTH) - return pth_mutex_acquire(mutexp, 0, NULL); -#elif defined(PTHREADS) - return pthread_mutex_lock(mutexp); -#elif defined(NSAPI) - return crit_enter(mutexp); -#elif defined(PI3WEB) - return PISync_lock(mutexp); -#elif defined(TSRM_ST) - return st_mutex_lock(mutexp); -#elif defined(BETHREADS) - if (atomic_add(&mutexp->ben, 1) != 0) - return acquire_sem(mutexp->sem); - return 0; -#endif -} - - -/* Unlock a mutex */ -TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp) -{ - TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id())); -#ifdef TSRM_WIN32 - LeaveCriticalSection(mutexp); - return 1; -#elif defined(NETWARE) -#ifdef USE_MPK - return kMutexUnlock(mutexp); -#else - return NXUnlock(mutexp); -#endif -#elif defined(GNUPTH) - return pth_mutex_release(mutexp); -#elif defined(PTHREADS) - return pthread_mutex_unlock(mutexp); -#elif defined(NSAPI) - return crit_exit(mutexp); -#elif defined(PI3WEB) - return PISync_unlock(mutexp); -#elif defined(TSRM_ST) - return st_mutex_unlock(mutexp); -#elif defined(BETHREADS) - if (atomic_add(&mutexp->ben, -1) != 1) - return release_sem(mutexp->sem); - return 0; -#endif -} - - -TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler) -{ - void *retval = (void *) tsrm_new_thread_begin_handler; - - tsrm_new_thread_begin_handler = new_thread_begin_handler; - return retval; -} - - -TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler) -{ - void *retval = (void *) tsrm_new_thread_end_handler; - - tsrm_new_thread_end_handler = new_thread_end_handler; - return retval; -} - - - -/* - * Debug support - */ - -#if TSRM_DEBUG -int tsrm_error(int level, const char *format, ...) -{ - if (level<=tsrm_error_level) { - va_list args; - int size; - - fprintf(tsrm_error_file, "TSRM: "); - va_start(args, format); - size = vfprintf(tsrm_error_file, format, args); - va_end(args); - fprintf(tsrm_error_file, "\n"); - fflush(tsrm_error_file); - return size; - } else { - return 0; - } -} -#endif - - -void tsrm_error_set(int level, char *debug_filename) -{ - tsrm_error_level = level; - -#if TSRM_DEBUG - if (tsrm_error_file!=stderr) { /* close files opened earlier */ - fclose(tsrm_error_file); - } - - if (debug_filename) { - tsrm_error_file = fopen(debug_filename, "w"); - if (!tsrm_error_file) { - tsrm_error_file = stderr; - } - } else { - tsrm_error_file = stderr; - } -#endif -} - -#endif /* ZTS */ diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp deleted file mode 100644 index 1a5693f5a2..0000000000 --- a/TSRM/TSRM.dsp +++ /dev/null @@ -1,186 +0,0 @@ -# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=TSRM - Win32 Debug_TS -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "TSRM.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library") -!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library") -!MESSAGE "TSRM - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library") -!MESSAGE "TSRM - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "TSRM - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "TSRM___Win32_Debug_TS" -# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_TS" -# PROP Intermediate_Dir "Debug_TS" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=1 /YX /FD /GZ /c -# ADD BASE RSC /l 0x40d /d "_DEBUG" -# ADD RSC /l 0x40d /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "TSRM___Win32_Release_TS" -# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_TS" -# PROP Intermediate_Dir "Release_TS" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c -# ADD BASE RSC /l 0x40d /d "NDEBUG" -# ADD RSC /l 0x40d /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS_inline" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "TSRM___Win32_Release_TS_inline" -# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS_inline" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_TS_inline" -# PROP Intermediate_Dir "Release_TS_inline" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c -# ADD BASE RSC /l 0x40d /d "NDEBUG" -# ADD RSC /l 0x40d /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TSDbg" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "TSRM___Win32_Release_TSDbg" -# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TSDbg" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_TSDbg" -# PROP Intermediate_Dir "Release_TSDbg" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c -# ADD BASE RSC /l 0x40d /d "NDEBUG" -# ADD RSC /l 0x40d /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "TSRM - Win32 Debug_TS" -# Name "TSRM - Win32 Release_TS" -# Name "TSRM - Win32 Release_TS_inline" -# Name "TSRM - Win32 Release_TSDbg" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\TSRM.c -# End Source File -# Begin Source File - -SOURCE=.\tsrm_strtok_r.c -# End Source File -# Begin Source File - -SOURCE=.\tsrm_virtual_cwd.c -# End Source File -# Begin Source File - -SOURCE=.\tsrm_win32.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# Begin Source File - -SOURCE=.\TSRM.h -# End Source File -# Begin Source File - -SOURCE=.\tsrm_config.w32.h -# End Source File -# Begin Source File - -SOURCE=.\tsrm_config_common.h -# End Source File -# Begin Source File - -SOURCE=.\tsrm_strtok_r.h -# End Source File -# Begin Source File - -SOURCE=.\tsrm_virtual_cwd.h -# End Source File -# Begin Source File - -SOURCE=.\tsrm_win32.h -# End Source File -# End Group -# End Target -# End Project diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h deleted file mode 100644 index 09da7b49cb..0000000000 --- a/TSRM/TSRM.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Thread Safe Resource Manager | - +----------------------------------------------------------------------+ - | Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski| - | This source file is subject to the TSRM license, that is bundled | - | with this package in the file LICENSE | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -#ifndef TSRM_H -#define TSRM_H - -/* #ifndef WIN32 */ -#if !defined(WIN32) && !defined(NETWARE) -# include "tsrm_config.h" -#endif - -#ifdef WIN32 -# define TSRM_WIN32 -# include "tsrm_config.w32.h" -#endif - -#ifdef TSRM_WIN32 -# ifdef TSRM_EXPORTS -# define TSRM_API __declspec(dllexport) -# else -# define TSRM_API __declspec(dllimport) -# endif -#else -# define TSRM_API -#endif - -/* Only compile multi-threading functions if we're in ZTS mode */ -#ifdef ZTS - -#ifdef TSRM_WIN32 -# ifndef TSRM_INCLUDE_FULL_WINDOWS_HEADERS -# define WIN32_LEAN_AND_MEAN -# endif -# include -#elif defined(NETWARE) -# include -#ifdef USE_MPK -# include -#else -# include -#endif -#elif defined(GNUPTH) -# include -#elif defined(PTHREADS) -# include -#elif defined(TSRM_ST) -# include -#elif defined(BETHREADS) -#include -#include -#endif - -typedef int ts_rsrc_id; - -/* Define THREAD_T and MUTEX_T */ -#ifdef TSRM_WIN32 -# define THREAD_T DWORD -# define MUTEX_T CRITICAL_SECTION * -#elif defined(NETWARE) -# define THREAD_T NXThreadId_t -#ifdef USE_MPK -# define MUTEX_T MUTEX -#else -# define MUTEX_T NXMutex_t * -#endif -#elif defined(GNUPTH) -# define THREAD_T pth_t -# define MUTEX_T pth_mutex_t * -#elif defined(PTHREADS) -# define THREAD_T pthread_t -# define MUTEX_T pthread_mutex_t * -#elif defined(NSAPI) -# define THREAD_T SYS_THREAD -# define MUTEX_T CRITICAL -#elif defined(PI3WEB) -# define THREAD_T PIThread * -# define MUTEX_T PISync * -#elif defined(TSRM_ST) -# define THREAD_T st_thread_t -# define MUTEX_T st_mutex_t -#elif defined(BETHREADS) -# define THREAD_T thread_id -typedef struct { - sem_id sem; - int32 ben; -} beos_ben; -# define MUTEX_T beos_ben * -#endif - -typedef void (*ts_allocate_ctor)(void *, void ***); -typedef void (*ts_allocate_dtor)(void *, void ***); - -#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts - -#ifdef __cplusplus -extern "C" { -#endif - -/* startup/shutdown */ -TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename); -TSRM_API void tsrm_shutdown(void); - -/* allocates a new thread-safe-resource id */ -TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor); - -/* fetches the requested resource for the current thread */ -TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id); -#define ts_resource(id) ts_resource_ex(id, NULL) - -/* frees all resources allocated for the current thread */ -TSRM_API void ts_free_thread(void); - -/* deallocates all occurrences of a given id */ -TSRM_API void ts_free_id(ts_rsrc_id id); - - -/* Debug support */ -#define TSRM_ERROR_LEVEL_ERROR 1 -#define TSRM_ERROR_LEVEL_CORE 2 -#define TSRM_ERROR_LEVEL_INFO 3 - -typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id, void ***tsrm_ls); -typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id, void ***tsrm_ls); - - -TSRM_API int tsrm_error(int level, const char *format, ...); -TSRM_API void tsrm_error_set(int level, char *debug_filename); - -/* utility functions */ -TSRM_API THREAD_T tsrm_thread_id(void); -TSRM_API MUTEX_T tsrm_mutex_alloc(void); -TSRM_API void tsrm_mutex_free(MUTEX_T mutexp); -TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp); -TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp); - -TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler); -TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler); - -#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1) -#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1) - -#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL) -#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx -#define TSRMLS_SET_CTX(ctx) (void ***) ctx = tsrm_ls -#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element) -#define TSRMLS_D void ***tsrm_ls -#define TSRMLS_DC , TSRMLS_D -#define TSRMLS_C tsrm_ls -#define TSRMLS_CC , TSRMLS_C - -#ifdef __cplusplus -} -#endif - -#else /* non ZTS */ - -#define TSRMLS_FETCH() -#define TSRMLS_FETCH_FROM_CTX(ctx) -#define TSRMLS_SET_CTX(ctx) -#define TSRMLS_D void -#define TSRMLS_DC -#define TSRMLS_C -#define TSRMLS_CC - -#endif /* ZTS */ - -#endif /* TSRM_H */ diff --git a/TSRM/acconfig.h b/TSRM/acconfig.h deleted file mode 100644 index 2b94cf35e7..0000000000 --- a/TSRM/acconfig.h +++ /dev/null @@ -1 +0,0 @@ -#undef PTHREADS diff --git a/TSRM/acinclude.m4 b/TSRM/acinclude.m4 deleted file mode 100644 index 1953172aef..0000000000 --- a/TSRM/acinclude.m4 +++ /dev/null @@ -1,5 +0,0 @@ - -AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[ - LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' -]) - diff --git a/TSRM/build.mk b/TSRM/build.mk deleted file mode 100644 index aac1a8b982..0000000000 --- a/TSRM/build.mk +++ /dev/null @@ -1,43 +0,0 @@ -# Makefile to generate build tools -# -# Standard usage: -# make -f build.mk -# -# Written by Sascha Schumann -# -# $Id$ - - -LT_TARGETS = ltmain.sh ltconfig - -config_h_in = tsrm_config.h.in - -makefile_am_files = Makefile.am -makefile_in_files = $(makefile_am_files:.am=.in) -makefile_files = $(makefile_am_files:e.am=e) - -targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in) - -all: $(targets) - -clean: - rm -f $(targets) - -$(LT_TARGETS): - rm -f $(LT_TARGETS) - libtoolize --automake $(AMFLAGS) -f - -$(makefile_in_files): $(makefile_am_files) - automake -a -i $(AMFLAGS) $(makefile_files) - -aclocal.m4: configure.in acinclude.m4 - aclocal - -$(config_h_in): configure.in acconfig.h -# explicitly remove target since autoheader does not seem to work -# correctly otherwise (timestamps are not updated) - @rm -f $@ - autoheader - -configure: aclocal.m4 configure.in - autoconf diff --git a/TSRM/buildconf b/TSRM/buildconf deleted file mode 100755 index fe8dee6f76..0000000000 --- a/TSRM/buildconf +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -case "$1" in ---copy) - automake_flags=--copy - shift -;; -esac - -libtoolize --force --automake $automake_flags - -mv aclocal.m4 aclocal.m4.old 2>/dev/null -aclocal -if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then - echo "buildconf: keeping ${1}aclocal.m4" - mv aclocal.m4.old aclocal.m4 -else - echo "buildconf: created or modified ${1}aclocal.m4" -fi - -autoheader - -automake --add-missing --include-deps $automake_flags - -mv configure configure.old 2>/dev/null -autoconf -if cmp configure.old configure > /dev/null 2>&1; then - echo "buildconf: keeping ${1}configure" - mv configure.old configure -else - echo "buildconf: created or modified ${1}configure" -fi - diff --git a/TSRM/configure.in b/TSRM/configure.in deleted file mode 100644 index acfdd00b35..0000000000 --- a/TSRM/configure.in +++ /dev/null @@ -1,31 +0,0 @@ -dnl $Id$ -dnl -dnl Minimalistic configure.in for TSRM. -dnl - -AC_INIT(TSRM.c) -AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine) -AM_CONFIG_HEADER(tsrm_config.h) - -sinclude(tsrm.m4) - -TSRM_BASIC_CHECKS -TSRM_THREADS_CHECKS - -AM_PROG_LIBTOOL -if test "$enable_debug" != "yes"; then - AM_SET_LIBTOOL_VARIABLE([--silent]) -fi - -dnl TSRM_PTHREAD - -AC_CHECK_HEADERS( -utime.h \ -dirent.h \ -stdarg.h \ -alloca.h \ -unistd.h \ -limits.h -) - -AC_OUTPUT(Makefile) diff --git a/TSRM/readdir.h b/TSRM/readdir.h deleted file mode 100644 index b0f1ad9e6f..0000000000 --- a/TSRM/readdir.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef READDIR_H -#define READDIR_H - - -/* - * Structures and types used to implement opendir/readdir/closedir - * on Windows 95/NT. - */ - -#include -#include -#include -#include - - -/* struct dirent - same as Unix */ - -struct dirent { - long d_ino; /* inode (always 1 in WIN32) */ - off_t d_off; /* offset to this dirent */ - unsigned short d_reclen; /* length of d_name */ - char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */ -}; - - -/* typedef DIR - not the same as Unix */ -typedef struct { - long handle; /* _findfirst/_findnext handle */ - short offset; /* offset into directory */ - short finished; /* 1 if there are not more files */ - struct _finddata_t fileinfo; /* from _findfirst/_findnext */ - char *dir; /* the dir we are reading */ - struct dirent dent; /* the dirent to return */ -} DIR; - -/* Function prototypes */ -DIR *opendir(const char *); -struct dirent *readdir(DIR *); -int readdir_r(DIR *, struct dirent *, struct dirent **); -int closedir(DIR *); -void rewinddir(DIR *); - - -#endif /* READDIR_H */ diff --git a/TSRM/threads.m4 b/TSRM/threads.m4 deleted file mode 100644 index 790579656e..0000000000 --- a/TSRM/threads.m4 +++ /dev/null @@ -1,165 +0,0 @@ -dnl Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved. -dnl -dnl Redistribution and use in source and binary forms, with or without -dnl modification, are permitted provided that the following conditions -dnl are met: -dnl -dnl 1. Redistributions of source code must retain the above copyright -dnl notice, this list of conditions and the following disclaimer. -dnl -dnl 2. Redistributions in binary form must reproduce the above copyright -dnl notice, this list of conditions and the following disclaimer in -dnl the documentation and/or other materials provided with the -dnl distribution. -dnl -dnl THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY -dnl EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SASCHA SCHUMANN OR -dnl HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -dnl NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -dnl OF THE POSSIBILITY OF SUCH DAMAGE. - -dnl -dnl PTHREADS_FLAGS -dnl -dnl Set some magic defines to achieve POSIX threads conformance -dnl -AC_DEFUN(PTHREADS_FLAGS,[ - if test -z "$host_alias" && test -n "$host"; then - host_alias=$host - fi - if test -z "$host_alias"; then - AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess) - fi - case $host_alias in - *solaris*) - PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";; - *freebsd*) - PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";; - *linux*) - PTHREAD_FLAGS=-D_REENTRANT;; - *aix*) - PTHREAD_FLAGS=-D_THREAD_SAFE;; - *irix*) - PTHREAD_FLAGS=-D_POSIX_THREAD_SAFE_FUNCTIONS;; - *hpux*) - PTHREAD_FLAGS=-D_REENTRANT;; - *sco*) - PTHREAD_FLAGS=-D_REENTRANT;; -dnl Solves sigwait() problem, creates problems with u_long etc. -dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";; - esac - - if test -n "$PTHREAD_FLAGS"; then - CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS" - fi -])dnl -dnl -dnl PTHREADS_CHECK_COMPILE -dnl -dnl Check whether the current setup can use POSIX threads calls -dnl -AC_DEFUN(PTHREADS_CHECK_COMPILE, [ -AC_TRY_RUN( [ -#include -#include - -void *thread_routine(void *data) { - return data; -} - -int main() { - pthread_t thd; - pthread_mutexattr_t mattr; - int data = 1; - pthread_mutexattr_init(&mattr); - return pthread_create(&thd, NULL, thread_routine, &data); -} ], [ - pthreads_working=yes - ], [ - pthreads_working=no - ], pthreads_working=no ) ] )dnl -dnl -dnl PTHREADS_CHECK() -dnl -dnl Try to find a way to enable POSIX threads -dnl -dnl Magic flags -dnl -kthread gcc (FreeBSD) -dnl -Kthread UDK cc (UnixWare) -dnl -mt WorkShop cc (Solaris) -dnl -mthreads gcc (AIX) -dnl -pthread gcc (Linux, FreeBSD, NetBSD, OpenBSD) -dnl -pthreads gcc (Solaris) -dnl -qthreaded AIX cc V5 -dnl -threads gcc (HP-UX) -dnl -AC_DEFUN(PTHREADS_CHECK,[ - -if test "$beos_threads" = "1"; then - pthreads_working="yes" - ac_cv_pthreads_cflags="" -else - save_CFLAGS=$CFLAGS - save_LIBS=$LIBS - PTHREADS_ASSIGN_VARS - PTHREADS_CHECK_COMPILE - LIBS=$save_LIBS - CFLAGS=$save_CFLAGS - - AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[ - ac_cv_pthreads_cflags= - if test "$pthreads_working" != "yes"; then - for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do - ac_save=$CFLAGS - CFLAGS="$CFLAGS $flag" - PTHREADS_CHECK_COMPILE - CFLAGS=$ac_save - if test "$pthreads_working" = "yes"; then - ac_cv_pthreads_cflags=$flag - break - fi - done - fi -fi -]) - -AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[ -ac_cv_pthreads_lib= -if test "$pthreads_working" != "yes"; then - for lib in pthread pthreads c_r; do - ac_save=$LIBS - LIBS="$LIBS -l$lib" - PTHREADS_CHECK_COMPILE - LIBS=$ac_save - if test "$pthreads_working" = "yes"; then - ac_cv_pthreads_lib=$lib - break - fi - done -fi -]) - -if test "$pthreads_working" = "yes"; then - threads_result="POSIX-Threads found" -else - threads_result="POSIX-Threads not found" -fi -])dnl -dnl -dnl -AC_DEFUN(PTHREADS_ASSIGN_VARS,[ -if test -n "$ac_cv_pthreads_lib"; then - LIBS="$LIBS -l$ac_cv_pthreads_lib" -fi - -if test -n "$ac_cv_pthreads_cflags"; then - CFLAGS="$CFLAGS $ac_cv_pthreads_cflags" -fi -])dnl diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4 deleted file mode 100644 index f9f9e4dcd2..0000000000 --- a/TSRM/tsrm.m4 +++ /dev/null @@ -1,128 +0,0 @@ - -dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND) -AC_DEFUN(TSRM_CHECK_GCC_ARG,[ - gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_) - AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [ - echo 'void somefunc() { };' > conftest.c - cmd='$CC $1 -c conftest.c' - if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then - ac_result=no - else - ac_result=yes - fi - eval $gcc_arg_name=$ac_result - rm -f conftest.* - ]) - if eval test "\$$gcc_arg_name" = "yes"; then - $2 - else - : - $3 - fi -]) - -AC_DEFUN(TSRM_BASIC_CHECKS,[ - -AC_REQUIRE([AC_PROG_CC])dnl -dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl -AC_REQUIRE([AC_PROG_CC_C_O])dnl -AC_REQUIRE([AC_PROG_RANLIB])dnl - -AC_CHECK_HEADERS(stdarg.h) - -]) - - -AC_DEFUN(TSRM_CHECK_PTH,[ - -AC_MSG_CHECKING(for GNU Pth) -PTH_PREFIX="`$1 --prefix`" -if test -z "$PTH_PREFIX"; then - AC_MSG_RESULT(Please check your Pth installation) -fi - -CPPFLAGS="$CPPFLAGS `$1 --cflags`" -LDFLAGS="$LDFLAGS `$1 --ldflags`" -LIBS="$LIBS `$1 --libs`" - -AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth]) -AC_MSG_RESULT(yes - installed in $PTH_PREFIX) - -]) - -AC_DEFUN(TSRM_CHECK_ST,[ - if test -r "$1/include/st.h"; then - CPPFLAGS="$CPPFLAGS -I$1/include" - LDFLAGS="$LDFLAGS -L$1/lib" - elif test -r "$1/st.h"; then - CPPFLAGS="$CPPFLAGS -I$1" - LDFLAGS="$LDFLAGS -L$1" - fi - AC_CHECK_HEADERS(st.h,[],[ - AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix]) - ]) - LIBS="$LIBS -lst" - AC_MSG_CHECKING(for SGI's State Threads) - AC_MSG_RESULT(yes) - AC_DEFINE(TSRM_ST, 1, [ ]) -]) - -sinclude(threads.m4) -sinclude(TSRM/threads.m4) - -AC_DEFUN(TSRM_CHECK_PTHREADS,[ - -PTHREADS_CHECK - -if test "$beos_threads" = "1"; then - AC_DEFINE(BETHREADS, 1, Whether to use native BeOS threads) -else - if test "$pthreads_working" != "yes"; then - AC_MSG_ERROR(Your system seems to lack POSIX threads.) - fi - - AC_DEFINE(PTHREADS, 1, Whether to use Pthreads) - - AC_MSG_CHECKING(for POSIX threads) - AC_MSG_RESULT(yes) -fi -]) - - -AC_DEFUN(TSRM_THREADS_CHECKS,[ - -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.],[ - TSRM_PTH=$withval -],[ - TSRM_PTH=no -]) - -AC_ARG_WITH(tsrm-st, -[ --with-tsrm-st],[ - TSRM_ST=$withval -],[ - TSRM_ST=no -]) - -AC_ARG_WITH(tsrm-pthreads, -[ --with-tsrm-pthreads Use POSIX threads (default)],[ - TSRM_PTHREADS=$withval -],[ - TSRM_PTHREADS=yes -]) - -test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config - -if test "$TSRM_PTH" != "no"; then - TSRM_CHECK_PTH($TSRM_PTH) -elif test "$TSRM_ST" != "no"; then - TSRM_CHECK_ST($TSRM_ST) -elif test "$TSRM_PTHREADS" != "no"; then - TSRM_CHECK_PTHREADS -fi - -]) diff --git a/TSRM/tsrm_config.nw.h b/TSRM/tsrm_config.nw.h deleted file mode 100644 index 14fcc19ab2..0000000000 --- a/TSRM/tsrm_config.nw.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef TSRM_CONFIG_NW_H -#define TSRM_CONFIG_NW_H - -#define HAVE_UTIME 1 - -/* Though we have alloca(), this seems to be causing some problem - * with the stack pointer. Hence not using it - */ -/*#define HAVE_ALLOCA 1*/ - -#endif diff --git a/TSRM/tsrm_config.w32.h b/TSRM/tsrm_config.w32.h deleted file mode 100644 index 2703f754f0..0000000000 --- a/TSRM/tsrm_config.w32.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef TSRM_CONFIG_W32_H -#define TSRM_CONFIG_W32_H - -#define HAVE_UTIME 1 -#define HAVE_ALLOCA 1 - -#include -#include -#include - -#undef inline -#ifdef ZEND_WIN32_FORCE_INLINE -# define inline __forceinline -#else -# define inline -#endif - - -#endif diff --git a/TSRM/tsrm_config_common.h b/TSRM/tsrm_config_common.h deleted file mode 100644 index 0cc0e6c5a1..0000000000 --- a/TSRM/tsrm_config_common.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef TSRM_CONFIG_COMMON_H -#define TSRM_CONFIG_COMMON_H - -#if WINNT|WIN32 -# define TSRM_WIN32 -#endif - -#ifdef TSRM_WIN32 -# include "tsrm_config.w32.h" -#elif defined(NETWARE) -# include "tsrm_config.nw.h" -#else -# include "tsrm_config.h" -# include -#endif - -#if HAVE_ALLOCA_H && !defined(_ALLOCA_H) -# include -#endif - -/* AIX requires this to be the first thing in the file. */ -#ifndef __GNUC__ -# ifndef HAVE_ALLOCA_H -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -# ifndef NETWARE -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -#if HAVE_UNISTD_H -#include -#endif - -#if HAVE_LIMITS_H -#include -#endif - -#ifndef MAXPATHLEN -# ifdef PATH_MAX -# define MAXPATHLEN PATH_MAX -# else -# define MAXPATHLEN 256 -# endif -#endif - -#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) -# define tsrm_do_alloca(p) alloca(p) -# define tsrm_free_alloca(p) -#else -# define tsrm_do_alloca(p) malloc(p) -# define tsrm_free_alloca(p) free(p) -#endif - -#endif /* TSRM_CONFIG_COMMON_H */ diff --git a/TSRM/tsrm_nw.c b/TSRM/tsrm_nw.c deleted file mode 100644 index 2467c0fcd8..0000000000 --- a/TSRM/tsrm_nw.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Venkat Raghavan S | - | Anantha Kesari H Y | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include -#include -#include - -#include "TSRM.h" - -#ifdef NETWARE - -#ifdef USE_MKFIFO -#include -#elif !defined(USE_PIPE_OPEN) /* NXFifoOpen */ -#include -#endif - -#include -#include - -#include - -#include "mktemp.h" - -/* strtok() call in LibC is abending when used in a different address space - * -- hence using PHP's version itself for now - */ -#include "tsrm_strtok_r.h" -#define tsrm_strtok_r(a,b,c) strtok((a),(b)) - -#define WHITESPACE " \t" -#define MAX_ARGS 10 - - -TSRM_API FILE* popen(const char *commandline, const char *type) -{ - char *command = NULL, *argv[MAX_ARGS] = {'\0'}, **env = NULL; - char *tempName = "sys:/php/temp/phpXXXXXX.tmp"; - char *filePath = NULL; - char *ptr = NULL; - int ptrLen = 0, argc = 0, i = 0, envCount = 0, err = 0; - FILE *stream = NULL; -#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO) - int pipe_handle; - int mode = O_RDONLY; -#else - NXHandle_t pipe_handle; - NXMode_t mode = NX_O_RDONLY; -#endif - NXExecEnvSpec_t envSpec; - NXNameSpec_t nameSpec; - NXVmId_t newVM = 0; - - /* Check for validity of input parameters */ - if (!commandline || !type) - return NULL; - - /* Get temporary file name */ - filePath = mktemp(tempName); - if (!filePath) - return NULL; - - /* Set pipe mode according to type -- for now allow only "r" or "w" */ - if (strcmp(type, "r") == 0) -#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO) - mode = O_RDONLY; -#else - mode = NX_O_RDONLY; -#endif - else if (strcmp(type, "w") == 0) -#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO) - mode = O_WRONLY; -#else - mode = NX_O_WRONLY; -#endif - else - return NULL; - -#ifdef USE_PIPE_OPEN - pipe_handle = pipe_open(filePath, mode); - if (pipe_handle == -1) - return NULL; -#elif defined(USE_MKFIFO) - pipe_handle = mkfifo(filePath, mode); - if (pipe_handle == -1) - return NULL; -#else - /* - NetWare doesn't require first parameter - * - Allowing LibC to choose the buffer size for now - */ - err = NXFifoOpen(0, filePath, mode, 0, &pipe_handle); - if (err) - return NULL; -#endif - - /* Copy the environment variables in preparation for the spawn call */ - envCount = NXGetEnvCount() + 1; /* add one for NULL */ - env = (char **) NXMemAlloc(sizeof(char *) * envCount, 0); - if (!env) - return NULL; - - err = NXCopyEnv(env, envCount); - if (err) { - NXMemFree (env); - return NULL; - } - - /* Separate commandline string into words */ - ptr = tsrm_strtok_r((char*)commandline, WHITESPACE, NULL); - ptrLen = strlen(ptr); - - command = (char*)malloc(ptrLen + 1); - if (!command) { - NXMemFree (env); - return NULL; - } - - strcpy (command, ptr); - - ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL); - while (ptr && (argc < MAX_ARGS)) { - ptrLen = strlen(ptr); - - argv[argc] = (char*)malloc(ptrLen + 1); - if (!argv[argc]) { - NXMemFree (env); - if (command) - free (command); - - for (i = 0; i < argc; i++) { - if (argv[i]) - free (argv[i]); - } - - return NULL; - } - - strcpy (argv[argc], ptr); - argc++; - ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL); - } - - /* Setup the execution environment and spawn new process */ - envSpec.esFlags = 0; /* Not used */ - envSpec.esArgc = argc; - envSpec.esArgv = (void **) argv; - envSpec.esEnv = (void **) env; - -/* envSpec.esStdin.ssType = */ - envSpec.esStdout.ssType = NX_OBJ_FIFO; - envSpec.esStderr.ssType = NX_OBJ_FILE; - - /* 'ssHandle' is not a struct/union/class member */ -/* - envSpec.esStdin.ssHandle = - envSpec.esStdout.ssHandle = - envSpec.esStderr.ssHandle = -1; -*/ - envSpec.esStdin.ssPathCtx = NULL; - envSpec.esStdout.ssPathCtx = NULL; - envSpec.esStderr.ssPathCtx = NULL; - -#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO) - if (mode == O_RDONLY) { -#else - if (mode == NX_O_RDONLY) { -#endif - envSpec.esStdin.ssPath = filePath; - envSpec.esStdout.ssPath = stdout; - } else { /* Write Only */ - envSpec.esStdin.ssPath = stdin; - envSpec.esStdout.ssPath = filePath; - } - - envSpec.esStderr.ssPath = stdout; - - nameSpec.ssType = NX_OBJ_FIFO; -/* nameSpec.ssHandle = 0; */ /* 'ssHandle' is not a struct/union/class member */ - nameSpec.ssPathCtx = NULL; /* Not used */ - nameSpec.ssPath = argv[0]; - err = NXVmSpawn(&nameSpec, &envSpec, 0, &newVM); - if (!err) - /* Get file pointer corresponding to the pipe (file) opened */ - stream = fdopen(pipe_handle, type); - - /* Clean-up */ - if (env) - NXMemFree (env); - - if (pipe_handle) -#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO) - close(pipe_handle); -#else - NXClose(pipe_handle); -#endif - - if (command) - free (command); - - for (i = 0; i < argc; i++) { - if (argv[i]) - free (argv[i]); - } - - return stream; -} - -TSRM_API int pclose(FILE* stream) -{ - int err = 0; - NXHandle_t fd = 0; - - /* Get the process associated with this pipe (file) handle and terminate it */ - fd = fileno(stream); - NXClose (fd); - - err = fclose(stream); - - return err; -} - -#endif /* NETWARE */ diff --git a/TSRM/tsrm_nw.h b/TSRM/tsrm_nw.h deleted file mode 100644 index 5c5357ef95..0000000000 --- a/TSRM/tsrm_nw.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Venkat Raghavan S | - | Anantha Kesari H Y | - +----------------------------------------------------------------------+ -*/ - - -#ifndef TSRM_NW_H -#define TSRM_NW_H - -#include "TSRM.h" - -TSRM_API FILE* popen(const char *command, const char *type); -TSRM_API int pclose(FILE* stream); - -#endif diff --git a/TSRM/tsrm_strtok_r.c b/TSRM/tsrm_strtok_r.c deleted file mode 100644 index e9ad26a7ac..0000000000 --- a/TSRM/tsrm_strtok_r.c +++ /dev/null @@ -1,63 +0,0 @@ -#include - -#include "tsrm_config_common.h" -#include "tsrm_strtok_r.h" - -static inline int in_character_class(char ch, const char *delim) -{ - while (*delim) { - if (*delim == ch) { - return 1; - } - delim++; - } - return 0; -} - -char *tsrm_strtok_r(char *s, const char *delim, char **last) -{ - char *token; - - if (s == NULL) { - s = *last; - } - - while (*s && in_character_class(*s, delim)) { - s++; - } - if (!*s) { - return NULL; - } - - token = s; - - while (*s && !in_character_class(*s, delim)) { - s++; - } - if (!*s) { - *last = s; - } else { - *s = '\0'; - *last = s + 1; - } - return token; -} - -#if 0 - -main() -{ - char foo[] = "/foo/bar//\\barbara"; - char *last; - char *token; - - token = tsrm_strtok_r(foo, "/\\", &last); - while (token) { - printf ("Token = '%s'\n", token); - token = tsrm_strtok_r(NULL, "/\\", &last); - } - - return 0; -} - -#endif diff --git a/TSRM/tsrm_strtok_r.h b/TSRM/tsrm_strtok_r.h deleted file mode 100644 index 8c9e8198e7..0000000000 --- a/TSRM/tsrm_strtok_r.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef TSRM_STRTOK_R -#define TSRM_STRTOK_R - -char *tsrm_strtok_r(char *s, const char *delim, char **last); - -#endif diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c deleted file mode 100644 index d62745ad32..0000000000 --- a/TSRM/tsrm_virtual_cwd.c +++ /dev/null @@ -1,859 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Sascha Schumann | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tsrm_virtual_cwd.h" -#include "tsrm_strtok_r.h" - -#ifdef TSRM_WIN32 -#include -#include "tsrm_win32.h" -#endif - -#ifdef NETWARE -/*#include "pipe.h"*/ -#include "tsrm_nw.h" -#endif - -#ifndef HAVE_REALPATH -#define realpath(x,y) strcpy(y,x) -#endif - -#define VIRTUAL_CWD_DEBUG 0 - -#include "TSRM.h" - -/* Only need mutex for popen() in Windows and NetWare because it doesn't chdir() on UNIX */ -#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS) -MUTEX_T cwd_mutex; -#endif - -#ifdef ZTS -static ts_rsrc_id cwd_globals_id; -#else -static virtual_cwd_globals cwd_globals; -#endif - -cwd_state main_cwd_state; /* True global */ - -#ifndef TSRM_WIN32 -#include -#else -#include -#endif - -#ifndef S_ISDIR -#define S_ISDIR(mode) ((mode) & _S_IFDIR) -#endif - -#ifndef S_ISREG -#define S_ISREG(mode) ((mode) & _S_IFREG) -#endif - -#ifdef TSRM_WIN32 -#include -#define tsrm_strtok_r(a,b,c) _tcstok((a),(b)) -#define TOKENIZER_STRING "/\\" - -static int php_check_dots(const char *element, int n) -{ - while (n-- > 0) if (element[n] != '.') break; - - return (n != -1); -} - -#define IS_DIRECTORY_UP(element, len) \ - (len >= 2 && !php_check_dots(element, len)) - -#define IS_DIRECTORY_CURRENT(element, len) \ - (len == 1 && ptr[0] == '.') - -#elif defined(NETWARE) -/* NetWare has strtok() (in LibC) and allows both slashes in paths, like Windows -- - but rest of the stuff is like Unix */ -/* strtok() call in LibC is abending when used in a different address space -- hence using - PHP's version itself for now */ -/*#define tsrm_strtok_r(a,b,c) strtok((a),(b))*/ -#define TOKENIZER_STRING "/\\" - -#else -#define TOKENIZER_STRING "/" -#endif - - -/* default macros */ - -#ifndef IS_DIRECTORY_UP -#define IS_DIRECTORY_UP(element, len) \ - (len == 2 && memcmp(element, "..", 2) == 0) -#endif - -#ifndef IS_DIRECTORY_CURRENT -#define IS_DIRECTORY_CURRENT(element, len) \ - (len == 1 && ptr[0] == '.') -#endif - -/* define this to check semantics */ -#define IS_DIR_OK(s) (1) - -#ifndef IS_DIR_OK -#define IS_DIR_OK(state) (php_is_dir_ok(state) == 0) -#endif - - -#define CWD_STATE_COPY(d, s) \ - (d)->cwd_length = (s)->cwd_length; \ - (d)->cwd = (char *) malloc((s)->cwd_length+1); \ - memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1); - -#define CWD_STATE_FREE(s) \ - free((s)->cwd); - -static int php_is_dir_ok(const cwd_state *state) -{ -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) - struct stat buf; - - if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) -#else - struct stat_libc buf; - - if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISDIR(buf.st_mode)) -#endif - return (0); - - return (1); -} - -static int php_is_file_ok(const cwd_state *state) -{ -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) - struct stat buf; - - if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) -#else - struct stat_libc buf; - - if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISREG(buf.st_mode)) -#endif - return (0); - - return (1); -} - -static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC) -{ - CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state); -} - -static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC) -{ - CWD_STATE_FREE(&cwd_globals->cwd); -} - -static char *tsrm_strndup(const char *s, size_t length) -{ - char *p; - - p = (char *) malloc(length+1); - if (!p) { - return (char *)NULL; - } - if (length) { - memcpy(p,s,length); - } - p[length]=0; - return p; -} - -CWD_API void virtual_cwd_startup(void) -{ - char cwd[MAXPATHLEN]; - char *result; - - result = getcwd(cwd, sizeof(cwd)); - if (!result) { - cwd[0] = '\0'; - } - main_cwd_state.cwd = strdup(cwd); - main_cwd_state.cwd_length = strlen(cwd); - -#ifdef ZTS - ts_allocate_id(&cwd_globals_id, sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor); -#else - cwd_globals_ctor(&cwd_globals TSRMLS_CC); -#endif - -#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS) - cwd_mutex = tsrm_mutex_alloc(); -#endif -} - -CWD_API void virtual_cwd_shutdown(void) -{ -#ifndef ZTS - cwd_globals_dtor(&cwd_globals TSRMLS_CC); -#endif -#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS) - tsrm_mutex_free(cwd_mutex); -#endif - - free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably use emalloc()/efree() */ -} - -CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) -{ - cwd_state *state; - - state = &CWDG(cwd); - - if (state->cwd_length == 0) { - char *retval; - - *length = 1; - retval = (char *) malloc(2); - retval[0] = DEFAULT_SLASH; - retval[1] = '\0'; - return retval; - } - -#ifdef TSRM_WIN32 - /* If we have something like C: */ - if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') { - char *retval; - - *length = state->cwd_length+1; - retval = (char *) malloc(*length+1); - memcpy(retval, state->cwd, *length); - retval[*length-1] = DEFAULT_SLASH; - retval[*length] = '\0'; - return retval; - } -#endif - *length = state->cwd_length; - return strdup(state->cwd); -} - - -/* Same semantics as UNIX getcwd() */ -CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) -{ - size_t length; - char *cwd; - - cwd = virtual_getcwd_ex(&length TSRMLS_CC); - - if (buf == NULL) { - return cwd; - } - if (length > size-1) { - free(cwd); - errno = ERANGE; /* Is this OK? */ - return NULL; - } - memcpy(buf, cwd, length+1); - free(cwd); - return buf; -} - -/* Resolve path relatively to state and put the real path into state */ -/* returns 0 for ok, 1 for error */ -CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath) -{ - int path_length = strlen(path); - char *ptr, *path_copy; - char *tok = NULL; - int ptr_length; - cwd_state *old_state; - int ret = 0; - int copy_amount = -1; - char *free_path; - unsigned char is_absolute = 0; -#ifndef TSRM_WIN32 - char resolved_path[MAXPATHLEN]; -#endif - - if (path_length == 0) - return (0); - -#if !defined(TSRM_WIN32) && !defined(NETWARE) - /* cwd_length can be 0 when getcwd() fails. - * This can happen under solaris when a dir does not have read permissions - * but *does* have execute permissions */ - if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) { - if (use_realpath && realpath(path, resolved_path)) { - path = resolved_path; - path_length = strlen(path); - } - } else { /* Concat current directory with relative path and then run realpath() on it */ - char *tmp; - char *ptr; - - ptr = tmp = (char *) malloc(state->cwd_length+path_length+sizeof("/")); - if (!tmp) { - return 1; - } - memcpy(ptr, state->cwd, state->cwd_length); - ptr += state->cwd_length; - *ptr++ = DEFAULT_SLASH; - memcpy(ptr, path, path_length); - ptr += path_length; - *ptr = '\0'; - if (use_realpath && realpath(tmp, resolved_path)) { - path = resolved_path; - path_length = strlen(path); - } - free(tmp); - } -#endif - free_path = path_copy = tsrm_strndup(path, path_length); - - old_state = (cwd_state *) malloc(sizeof(cwd_state)); - CWD_STATE_COPY(old_state, state); -#if VIRTUAL_CWD_DEBUG - fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); -#endif - if (IS_ABSOLUTE_PATH(path_copy, path_length)) { - copy_amount = COPY_WHEN_ABSOLUTE(path_copy); - is_absolute = 1; -#ifdef TSRM_WIN32 - } else if (IS_SLASH(path_copy[0])) { - copy_amount = 2; -#endif - } - - if (copy_amount != -1) { - state->cwd = (char *) realloc(state->cwd, copy_amount + 1); - if (copy_amount) { - if (is_absolute) { - memcpy(state->cwd, path_copy, copy_amount); - path_copy += copy_amount; - } else { - memcpy(state->cwd, old_state->cwd, copy_amount); - } - } - state->cwd[copy_amount] = '\0'; - state->cwd_length = copy_amount; - } - - - if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) { - ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok); - while (ptr) { - ptr_length = strlen(ptr); - - if (IS_DIRECTORY_UP(ptr, ptr_length)) { - char save; - - save = DEFAULT_SLASH; - -#define PREVIOUS state->cwd[state->cwd_length - 1] - - while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) && - !IS_SLASH(PREVIOUS)) { - save = PREVIOUS; - PREVIOUS = '\0'; - state->cwd_length--; - } - - if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) { - state->cwd[state->cwd_length++] = save; - state->cwd[state->cwd_length] = '\0'; - } else { - PREVIOUS = '\0'; - state->cwd_length--; - } - } else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) { - state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1); -#ifdef TSRM_WIN32 - /* Windows 9x will consider C:\\Foo as a network path. Avoid it. */ - if ((state->cwd[state->cwd_length-1]!='\\' && state->cwd[state->cwd_length-1]!='/') || - IsDBCSLeadByte(state->cwd[state->cwd_length-2])) { - state->cwd[state->cwd_length++] = DEFAULT_SLASH; - } -#elif defined(NETWARE) - /* If the token is a volume name, it will have colon at the end -- so, no slash before it */ - if (ptr[ptr_length-1] != ':') { - state->cwd[state->cwd_length++] = DEFAULT_SLASH; - } -#else - state->cwd[state->cwd_length++] = DEFAULT_SLASH; -#endif - memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1); - state->cwd_length += ptr_length; - } - ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok); - } - - if (state->cwd_length == COPY_WHEN_ABSOLUTE(state->cwd)) { - state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1); - state->cwd[state->cwd_length] = DEFAULT_SLASH; - state->cwd[state->cwd_length+1] = '\0'; - state->cwd_length++; - } - } else { - state->cwd = (char *) realloc(state->cwd, path_length+1); - memcpy(state->cwd, path, path_length+1); - state->cwd_length = path_length; - } - - if (verify_path && verify_path(state)) { - CWD_STATE_FREE(state); - - *state = *old_state; - - ret = 1; - } else { - CWD_STATE_FREE(old_state); - ret = 0; - } - - free(old_state); - - free(free_path); -#if VIRTUAL_CWD_DEBUG - fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd); -#endif - return (ret); -} - -CWD_API int virtual_chdir(const char *path TSRMLS_DC) -{ - return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, 1)?-1:0; -} - -CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC) -{ - int length = strlen(path); - char *temp; - int retval; - - if (length == 0) { - return 1; /* Can't cd to empty string */ - } - while(--length >= 0 && !IS_SLASH(path[length])) { - } - - if (length == -1) { - /* No directory only file name */ - errno = ENOENT; - return -1; - } - - if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */ - length++; - } - temp = (char *) tsrm_do_alloca(length+1); - memcpy(temp, path, length); - temp[length] = 0; -#if VIRTUAL_CWD_DEBUG - fprintf (stderr, "Changing directory to %s\n", temp); -#endif - retval = p_chdir(temp TSRMLS_CC); - tsrm_free_alloca(temp); - return retval; -} - -CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) -{ - cwd_state new_state; - char *retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - - if (virtual_file_ex(&new_state, path, NULL, 1)==0) { - int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length; - - memcpy(real_path, new_state.cwd, len); - real_path[len] = '\0'; - retval = real_path; - } else { - retval = NULL; - } - - CWD_STATE_FREE(&new_state); - - return retval; -} - -CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - retval = virtual_file_ex(&new_state, path, verify_path, 1); - - *filepath = new_state.cwd; - - return retval; - -} - -CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC) -{ - return virtual_filepath_ex(path, filepath, php_is_file_ok TSRMLS_CC); -} - -CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) -{ - cwd_state new_state; - FILE *f; - - if (path[0] == '\0') { /* Fail to open empty path */ - return NULL; - } - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL, 1); - - f = fopen(new_state.cwd, mode); - - CWD_STATE_FREE(&new_state); - return f; -} - -CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) -{ - cwd_state new_state; - int ret; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, pathname, NULL, 1); - -#if defined(TSRM_WIN32) - ret = tsrm_win32_access(new_state.cwd, mode); -#else - ret = access(new_state.cwd, mode); -#endif - - CWD_STATE_FREE(&new_state); - - return ret; -} - - -#if HAVE_UTIME -CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) -{ - cwd_state new_state; - int ret; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, filename, NULL, 0); - - ret = utime(new_state.cwd, buf); - - CWD_STATE_FREE(&new_state); - return ret; -} -#endif - -CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC) -{ - cwd_state new_state; - int ret; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, filename, NULL, 1); - - ret = chmod(new_state.cwd, mode); - - CWD_STATE_FREE(&new_state); - return ret; -} - -#if !defined(TSRM_WIN32) && !defined(NETWARE) -CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC) -{ - cwd_state new_state; - int ret; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, filename, NULL, 0); - - ret = chown(new_state.cwd, owner, group); - - CWD_STATE_FREE(&new_state); - return ret; -} -#endif - -CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) -{ - cwd_state new_state; - int f; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL, 1); - - if (flags & O_CREAT) { - mode_t mode; - va_list arg; - - va_start(arg, flags); - mode = (mode_t) va_arg(arg, int); - va_end(arg); - - f = open(new_state.cwd, flags, mode); - } else { - f = open(new_state.cwd, flags); - } - CWD_STATE_FREE(&new_state); - return f; -} - -CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) -{ - cwd_state new_state; - int f; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL, 1); - - f = creat(new_state.cwd, mode); - - CWD_STATE_FREE(&new_state); - return f; -} - -CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC) -{ - cwd_state old_state; - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&old_state, &CWDG(cwd)); - virtual_file_ex(&old_state, oldname, NULL, 0); - oldname = old_state.cwd; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, newname, NULL, 0); - newname = new_state.cwd; - - retval = rename(oldname, newname); - - CWD_STATE_FREE(&old_state); - CWD_STATE_FREE(&new_state); - - return retval; -} - -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) -CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL, 1); - - retval = stat(new_state.cwd, buf); - - CWD_STATE_FREE(&new_state); - return retval; -} -#else -CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL, 1); - - retval = stat(new_state.cwd, (struct stat*)buf); - - CWD_STATE_FREE(&new_state); - return retval; -} -#endif - -#if !defined(TSRM_WIN32) && !defined(NETWARE) -CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL, 0); - - retval = lstat(new_state.cwd, buf); - - CWD_STATE_FREE(&new_state); - return retval; -} -#endif - -CWD_API int virtual_unlink(const char *path TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL, 0); - - retval = unlink(new_state.cwd); - - CWD_STATE_FREE(&new_state); - return retval; -} - -CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, pathname, NULL, 1); - -#ifdef TSRM_WIN32 - retval = mkdir(new_state.cwd); -#else - retval = mkdir(new_state.cwd, mode); -#endif - CWD_STATE_FREE(&new_state); - return retval; -} - -CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, pathname, NULL, 0); - - retval = rmdir(new_state.cwd); - - CWD_STATE_FREE(&new_state); - return retval; -} - -#ifdef TSRM_WIN32 -DIR *opendir(const char *name); -#endif - -CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC) -{ - cwd_state new_state; - DIR *retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, pathname, NULL, 1); - - retval = opendir(new_state.cwd); - - CWD_STATE_FREE(&new_state); - return retval; -} - -#ifdef TSRM_WIN32 - -CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) -{ - return popen_ex(command, type, CWDG(cwd).cwd, NULL); -} - -#elif defined(NETWARE) - -/* On NetWare, the trick of prepending "cd cwd; " doesn't work so we need to perform - a VCWD_CHDIR() and mutex it - */ -CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) -{ - char prev_cwd[MAXPATHLEN]; - char *getcwd_result; - FILE *retval; - - getcwd_result = VCWD_GETCWD(prev_cwd, MAXPATHLEN); - if (!getcwd_result) { - return NULL; - } - -#ifdef ZTS - tsrm_mutex_lock(cwd_mutex); -#endif - - VCWD_CHDIR(CWDG(cwd).cwd); - retval = popen(command, type); - VCWD_CHDIR(prev_cwd); - -#ifdef ZTS - tsrm_mutex_unlock(cwd_mutex); -#endif - - return retval; -} - -#else /* Unix */ - -CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) -{ - int command_length; - char *command_line; - char *ptr; - FILE *retval; - - command_length = strlen(command); - - ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1); - if (!command_line) { - return NULL; - } - memcpy(ptr, "cd ", sizeof("cd ")-1); - ptr += sizeof("cd ")-1; - - if (CWDG(cwd).cwd_length == 0) { - *ptr++ = DEFAULT_SLASH; - } else { - memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length); - ptr += CWDG(cwd).cwd_length; - } - - *ptr++ = ' '; - *ptr++ = ';'; - *ptr++ = ' '; - - memcpy(ptr, command, command_length+1); - retval = popen(command_line, type); - - free(command_line); - return retval; -} - -#endif - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h deleted file mode 100644 index 0e983a621c..0000000000 --- a/TSRM/tsrm_virtual_cwd.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Sascha Schumann | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef VIRTUAL_CWD_H -#define VIRTUAL_CWD_H - -#include "TSRM.h" -#include "tsrm_config_common.h" - -#include -#include -#include - -#ifdef HAVE_UTIME_H -#include -#endif - -#ifdef HAVE_STDARG_H -#include -#endif - -#ifndef TSRM_WIN32 -#include -#endif - -#ifdef TSRM_WIN32 -#include "readdir.h" -#include -/* mode_t isn't defined on Windows */ -typedef unsigned short mode_t; - -#define DEFAULT_SLASH '\\' -#define DEFAULT_DIR_SEPARATOR ';' -#define IS_SLASH(c) ((c) == '/' || (c) == '\\') -#define IS_SLASH_P(c) (*(c) == '/' || \ - (*(c) == '\\' && !IsDBCSLeadByte(*(c-1)))) - -/* COPY_WHEN_ABSOLUTE is 2 under Win32 because by chance both regular absolute paths - in the file system and UNC paths need copying of two characters */ -#define COPY_WHEN_ABSOLUTE(path) 2 -#define IS_UNC_PATH(path, len) \ - (len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1])) -#define IS_ABSOLUTE_PATH(path, len) \ - (len >= 2 && ((isalpha(path[0]) && path[1] == ':') || IS_UNC_PATH(path, len))) - -#elif defined(NETWARE) -#ifdef HAVE_DIRENT_H -#include -#endif - -#define DEFAULT_SLASH '/' -#define DEFAULT_DIR_SEPARATOR ';' -#define IS_SLASH(c) ((c) == '/' || (c) == '\\') -#define IS_SLASH_P(c) IS_SLASH(*(c)) -#define COPY_WHEN_ABSOLUTE(path) \ - (strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */ -#define IS_ABSOLUTE_PATH(path, len) \ - (strchr(path, ':') != NULL) /* Colon indicates volume name */ - -#else -#ifdef HAVE_DIRENT_H -#include -#endif - -#define DEFAULT_SLASH '/' - -#ifdef __riscos__ -#define DEFAULT_DIR_SEPARATOR ';' -#else -#define DEFAULT_DIR_SEPARATOR ':' -#endif - -#define IS_SLASH(c) ((c) == '/') -#define IS_SLASH_P(c) (*(c) == '/') - -#endif - - -#ifndef COPY_WHEN_ABSOLUTE -#define COPY_WHEN_ABSOLUTE(path) 0 -#endif - -#ifndef IS_ABSOLUTE_PATH -#define IS_ABSOLUTE_PATH(path, len) \ - (IS_SLASH(path[0])) -#endif - -#ifdef TSRM_EXPORTS -#define CWD_EXPORTS -#endif - -#ifdef TSRM_WIN32 -# ifdef CWD_EXPORTS -# define CWD_API __declspec(dllexport) -# else -# define CWD_API __declspec(dllimport) -# endif -#else -#define CWD_API -#endif - -typedef struct _cwd_state { - char *cwd; - int cwd_length; -} cwd_state; - -typedef int (*verify_path_func)(const cwd_state *); - -CWD_API void virtual_cwd_startup(void); -CWD_API void virtual_cwd_shutdown(void); -CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC); -CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC); -CWD_API int virtual_chdir(const char *path TSRMLS_DC); -CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC); -CWD_API int virtual_filepath(const char *path, char **filepath TSRMLS_DC); -CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC); -CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC); -CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC); -CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...); -CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC); -CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC); -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) -CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC); -#else -CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC); -#endif -#if !defined(TSRM_WIN32) && !defined(NETWARE) -CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC); -#endif -CWD_API int virtual_unlink(const char *path TSRMLS_DC); -CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC); -CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC); -CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC); -CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC); -CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC); -#if defined(TSRM_WIN32) -/* these are not defined in win32 headers */ -#ifndef W_OK -#define W_OK 0x02 -#endif -#ifndef R_OK -#define R_OK 0x04 -#endif -#ifndef X_OK -#define X_OK 0x01 -#endif -#ifndef F_OK -#define F_OK 0x00 -#endif -#endif - -#if HAVE_UTIME -CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC); -#endif -CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC); -#if !defined(TSRM_WIN32) && !defined(NETWARE) -CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC); -#endif - -CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath); - -typedef struct _virtual_cwd_globals { - cwd_state cwd; -} virtual_cwd_globals; - -#ifdef ZTS -# define CWDG(v) TSRMG(cwd_globals_id, virtual_cwd_globals *, v) -#else -# define CWDG(v) (cwd_globals.v) -#endif - -/* The actual macros to be used in programs using TSRM - * If the program defines VIRTUAL_DIR it will use the - * virtual_* functions - */ - -#ifdef VIRTUAL_DIR - -#define VCWD_GETCWD(buff, size) virtual_getcwd(buff, size TSRMLS_CC) -#define VCWD_FOPEN(path, mode) virtual_fopen(path, mode TSRMLS_CC) -/* Because open() has two modes, we have to macros to replace it */ -#define VCWD_OPEN(path, flags) virtual_open(path TSRMLS_CC, flags) -#define VCWD_OPEN_MODE(path, flags, mode) virtual_open(path TSRMLS_CC, flags, mode) -#define VCWD_CREAT(path, mode) virtual_creat(path, mode TSRMLS_CC) -#define VCWD_CHDIR(path) virtual_chdir(path TSRMLS_CC) -#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, virtual_chdir TSRMLS_CC) -#define VCWD_GETWD(buf) -#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC) -#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC) -#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC) -#if !defined(TSRM_WIN32) && !defined(NETWARE) -#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC) -#endif -#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC) -#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC) -#define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC) -#define VCWD_OPENDIR(pathname) virtual_opendir(pathname TSRMLS_CC) -#define VCWD_POPEN(command, type) virtual_popen(command, type TSRMLS_CC) -#define VCWD_ACCESS(pathname, mode) virtual_access(pathname, mode TSRMLS_CC) -#if HAVE_UTIME -#define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC) -#endif -#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC) -#if !defined(TSRM_WIN32) && !defined(NETWARE) -#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC) -#endif - -#else - -#define VCWD_GETCWD(buff, size) getcwd(buff, size) -#define VCWD_FOPEN(path, mode) fopen(path, mode) -#define VCWD_OPEN(path, flags) open(path, flags) -#define VCWD_OPEN_MODE(path, flags, mode) open(path, flags, mode) -#define VCWD_CREAT(path, mode) creat(path, mode) -#define VCWD_RENAME(oldname, newname) rename(oldname, newname) -#define VCWD_CHDIR(path) chdir(path) -#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, chdir) -#define VCWD_GETWD(buf) getwd(buf) -#define VCWD_STAT(path, buff) stat(path, buff) -#define VCWD_LSTAT(path, buff) lstat(path, buff) -#define VCWD_UNLINK(path) unlink(path) -#define VCWD_MKDIR(pathname, mode) mkdir(pathname, mode) -#define VCWD_RMDIR(pathname) rmdir(pathname) -#define VCWD_OPENDIR(pathname) opendir(pathname) -#define VCWD_POPEN(command, type) popen(command, type) -#if defined(TSRM_WIN32) -#define VCWD_ACCESS(pathname, mode) tsrm_win32_access(pathname, mode) -#else -#define VCWD_ACCESS(pathname, mode) access(pathname, mode) -#endif - -#ifdef HAVE_REALPATH -#define VCWD_REALPATH(path, real_path) realpath(path, real_path) -#else -#define VCWD_REALPATH(path, real_path) strcpy(real_path, path) -#endif - -#if HAVE_UTIME -#define VCWD_UTIME(path, time) utime(path, time) -#endif -#define VCWD_CHMOD(path, mode) chmod(path, mode) -#if !defined(TSRM_WIN32) && !defined(NETWARE) -#define VCWD_CHOWN(path, owner, group) chown(path, owner, group) -#endif - -#endif - -#endif /* VIRTUAL_CWD_H */ diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c deleted file mode 100644 index 0cffe4722a..0000000000 --- a/TSRM/tsrm_win32.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Daniel Beulshausen | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include -#include -#include -#include -#include - -#define TSRM_INCLUDE_FULL_WINDOWS_HEADERS - -#include "TSRM.h" - -#ifdef TSRM_WIN32 -#include "tsrm_win32.h" - -#ifdef ZTS -static ts_rsrc_id win32_globals_id; -#else -static tsrm_win32_globals win32_globals; -#endif - -static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC) -{ - globals->process = NULL; - globals->shm = NULL; - globals->process_size = 0; - globals->shm_size = 0; - globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com"); -} - -static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC) -{ - shm_pair *ptr; - - if (globals->process) { - free(globals->process); - } - - if (globals->shm) { - for (ptr = globals->shm; ptr < (globals->shm + globals->shm_size); ptr++) { - UnmapViewOfFile(ptr->addr); - CloseHandle(ptr->segment); - UnmapViewOfFile(ptr->descriptor); - CloseHandle(ptr->info); - } - free(globals->shm); - } - - free(globals->comspec); -} - -TSRM_API void tsrm_win32_startup(void) -{ -#ifdef ZTS - ts_allocate_id(&win32_globals_id, sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor); -#else - tsrm_win32_ctor(&win32_globals TSRMLS_CC); -#endif -} - -TSRM_API void tsrm_win32_shutdown(void) -{ -#ifndef ZTS - tsrm_win32_dtor(&win32_globals TSRMLS_CC); -#endif -} - -TSRM_API int tsrm_win32_access(const char *pathname, int mode) -{ - SHFILEINFO sfi; - - if (mode == 1 /*X_OK*/) { - return access(pathname, 0) == 0 && - SHGetFileInfo(pathname, 0, &sfi, sizeof(SHFILEINFO), SHGFI_EXETYPE) != 0 ? 0 : -1; - } else { - return access(pathname, mode); - } -} - - -static process_pair *process_get(FILE *stream TSRMLS_DC) -{ - process_pair *ptr; - process_pair *newptr; - - for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) { - if (ptr->stream == stream) { - break; - } - } - - if (ptr < (TWG(process) + TWG(process_size))) { - return ptr; - } - - newptr = (process_pair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(process_pair)); - if (newptr == NULL) { - return NULL; - } - - TWG(process) = newptr; - ptr = newptr + TWG(process_size); - TWG(process_size)++; - return ptr; -} - -static shm_pair *shm_get(int key, void *addr) -{ - shm_pair *ptr; - shm_pair *newptr; - TSRMLS_FETCH(); - - for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) { - if (!ptr->descriptor) { - continue; - } - if (!addr && ptr->descriptor->shm_perm.key == key) { - break; - } else if (ptr->addr == addr) { - break; - } - } - - if (ptr < (TWG(shm) + TWG(shm_size))) { - return ptr; - } - - newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair)); - if (newptr == NULL) { - return NULL; - } - - TWG(shm) = newptr; - ptr = newptr + TWG(shm_size); - TWG(shm_size)++; - return ptr; -} - -static HANDLE dupHandle(HANDLE fh, BOOL inherit) { - HANDLE copy, self = GetCurrentProcess(); - if (!DuplicateHandle(self, fh, self, ©, 0, inherit, DUPLICATE_SAME_ACCESS|DUPLICATE_CLOSE_SOURCE)) { - return NULL; - } - return copy; -} - -TSRM_API FILE *popen(const char *command, const char *type) -{ - return popen_ex(command, type, NULL, NULL); -} - -TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env) -{ - FILE *stream = NULL; - int fno, str_len = strlen(type), read, mode; - STARTUPINFO startup; - PROCESS_INFORMATION process; - SECURITY_ATTRIBUTES security; - HANDLE in, out; - char *cmd; - process_pair *proc; - TSRMLS_FETCH(); - - security.nLength = sizeof(SECURITY_ATTRIBUTES); - security.bInheritHandle = TRUE; - security.lpSecurityDescriptor = NULL; - - if (!str_len || !CreatePipe(&in, &out, &security, 2048L)) { - return NULL; - } - - memset(&startup, 0, sizeof(STARTUPINFO)); - memset(&process, 0, sizeof(PROCESS_INFORMATION)); - - startup.cb = sizeof(STARTUPINFO); - startup.dwFlags = STARTF_USESTDHANDLES; - startup.hStdError = GetStdHandle(STD_ERROR_HANDLE); - - read = (type[0] == 'r') ? TRUE : FALSE; - mode = ((str_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT; - - - if (read) { - in = dupHandle(in, FALSE); - startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE); - startup.hStdOutput = out; - } else { - out = dupHandle(out, FALSE); - startup.hStdInput = in; - startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); - } - - cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")); - sprintf(cmd, "%s /c %s", TWG(comspec), command); - if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, env, cwd, &startup, &process)) { - return NULL; - } - free(cmd); - - CloseHandle(process.hThread); - proc = process_get(NULL TSRMLS_CC); - - if (read) { - fno = _open_osfhandle((long)in, _O_RDONLY | mode); - CloseHandle(out); - } else { - fno = _open_osfhandle((long)out, _O_WRONLY | mode); - CloseHandle(in); - } - - stream = _fdopen(fno, type); - proc->prochnd = process.hProcess; - proc->stream = stream; - return stream; -} - -TSRM_API int pclose(FILE *stream) -{ - DWORD termstat = 0; - process_pair *process; - TSRMLS_FETCH(); - - if ((process = process_get(stream TSRMLS_CC)) == NULL) { - return 0; - } - - fflush(process->stream); - fclose(process->stream); - - WaitForSingleObject(process->prochnd, INFINITE); - GetExitCodeProcess(process->prochnd, &termstat); - process->stream = NULL; - CloseHandle(process->prochnd); - - return termstat; -} - -TSRM_API int shmget(int key, int size, int flags) -{ - shm_pair *shm; - char shm_segment[26], shm_info[29]; - HANDLE shm_handle, info_handle; - BOOL created = FALSE; - - if (size < 0) { - return -1; - } - - sprintf(shm_segment, "TSRM_SHM_SEGMENT:%d", key); - sprintf(shm_info, "TSRM_SHM_DESCRIPTOR:%d", key); - - shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment); - info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info); - - if ((!shm_handle && !info_handle)) { - if (flags & IPC_EXCL) { - return -1; - } - if (flags & IPC_CREAT) { - shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, shm_segment); - info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info); - created = TRUE; - } - if ((!shm_handle || !info_handle)) { - return -1; - } - } - - shm = shm_get(key, NULL); - shm->segment = shm_handle; - shm->info = info_handle; - shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); - - if (created) { - shm->descriptor->shm_perm.key = key; - shm->descriptor->shm_segsz = size; - shm->descriptor->shm_ctime = time(NULL); - shm->descriptor->shm_cpid = getpid(); - shm->descriptor->shm_perm.mode = flags; - - shm->descriptor->shm_perm.cuid = shm->descriptor->shm_perm.cgid= 0; - shm->descriptor->shm_perm.gid = shm->descriptor->shm_perm.uid = 0; - shm->descriptor->shm_atime = shm->descriptor->shm_dtime = 0; - shm->descriptor->shm_lpid = shm->descriptor->shm_nattch = 0; - shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0; - } - - if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) { - CloseHandle(shm->segment); - UnmapViewOfFile(shm->descriptor); - CloseHandle(shm->info); - return -1; - } - - return key; -} - -TSRM_API void *shmat(int key, const void *shmaddr, int flags) -{ - shm_pair *shm = shm_get(key, NULL); - - if (!shm->segment) { - return (void*)-1; - } - - shm->descriptor->shm_atime = time(NULL); - shm->descriptor->shm_lpid = getpid(); - shm->descriptor->shm_nattch++; - - shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); - - return shm->addr; -} - -TSRM_API int shmdt(const void *shmaddr) -{ - shm_pair *shm = shm_get(0, (void*)shmaddr); - - if (!shm->segment) { - return -1; - } - - shm->descriptor->shm_dtime = time(NULL); - shm->descriptor->shm_lpid = getpid(); - shm->descriptor->shm_nattch--; - - return UnmapViewOfFile(shm->addr) ? 0 : -1; -} - -TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) { - shm_pair *shm = shm_get(key, NULL); - - if (!shm->segment) { - return -1; - } - - switch (cmd) { - case IPC_STAT: - memcpy(buf, shm->descriptor, sizeof(struct shmid_ds)); - return 0; - - case IPC_SET: - shm->descriptor->shm_ctime = time(NULL); - shm->descriptor->shm_perm.uid = buf->shm_perm.uid; - shm->descriptor->shm_perm.gid = buf->shm_perm.gid; - shm->descriptor->shm_perm.mode = buf->shm_perm.mode; - return 0; - - case IPC_RMID: - if (shm->descriptor->shm_nattch < 1) { - shm->descriptor->shm_perm.key = -1; - } - return 0; - - default: - return -1; - } -} -#endif diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h deleted file mode 100644 index a027b8a4a9..0000000000 --- a/TSRM/tsrm_win32.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Daniel Beulshausen | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef TSRM_WIN32_H -#define TSRM_WIN32_H - -#include "TSRM.h" -#include - -struct ipc_perm { - int key; - unsigned short uid; - unsigned short gid; - unsigned short cuid; - unsigned short cgid; - unsigned short mode; - unsigned short seq; -}; - -struct shmid_ds { - struct ipc_perm shm_perm; - int shm_segsz; - time_t shm_atime; - time_t shm_dtime; - time_t shm_ctime; - unsigned short shm_cpid; - unsigned short shm_lpid; - short shm_nattch; -}; - -typedef struct { - FILE *stream; - HANDLE prochnd; -} process_pair; - -typedef struct { - void *addr; - HANDLE info; - HANDLE segment; - struct shmid_ds *descriptor; -} shm_pair; - -typedef struct { - process_pair *process; - shm_pair *shm; - int process_size; - int shm_size; - char *comspec; -} tsrm_win32_globals; - -#ifdef ZTS -# define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v) -#else -# define TWG(v) (win32_globals.v) -#endif - -#define IPC_PRIVATE 0 -#define IPC_CREAT 00001000 -#define IPC_EXCL 00002000 -#define IPC_NOWAIT 00004000 - -#define IPC_RMID 0 -#define IPC_SET 1 -#define IPC_STAT 2 -#define IPC_INFO 3 - -#define SHM_R PAGE_READONLY -#define SHM_W PAGE_READWRITE - -#define SHM_RDONLY FILE_MAP_READ -#define SHM_RND FILE_MAP_WRITE -#define SHM_REMAP FILE_MAP_COPY - - -TSRM_API void tsrm_win32_startup(void); -TSRM_API void tsrm_win32_shutdown(void); - -TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env); -TSRM_API FILE *popen(const char *command, const char *type); -TSRM_API int pclose(FILE *stream); -TSRM_API int tsrm_win32_access(const char *pathname, int mode); - -TSRM_API int shmget(int key, int size, int flags); -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); - -#endif \ No newline at end of file diff --git a/Zend/ChangeLog b/Zend/ChangeLog deleted file mode 100644 index 672e8f51e8..0000000000 --- a/Zend/ChangeLog +++ /dev/null @@ -1,12075 +0,0 @@ -2003-04-07 Jani Taskinen - - * zend_language_scanner.l: - Fixed bug #23093 (highlight_string() crashed with __FUNCTION__) - -2003-04-07 Sterling Hughes - - * zend_compile.h: - add markers that make this file easy to parse for external sources - -2003-04-04 Andrei Zmievski - - * zend_API.h: - Introduce ZEND_ME() and ZEND_METHOD() macros. Use these for declaring - class methods to avoid name collisions. - -2003-04-04 Stanislav Malyshev - - * zend_API.c - zend_API.h: - Fix namespace issues - -2003-04-03 Andrei Zmievski - - * zend_API.c: - Patch from Timm Friede for when EG(active_namespace) is NULL initially. - - * zend.c - zend_API.c - zend_compile.c: - Initialize all relevant zend_class_entry fields to avoid accidental - crashes. - -2003-04-03 Sebastian Bergmann - - * zend_list.c: - Leftover. - -2003-04-03 Sterling Hughes - - * zend_list.c - zend_list.h: - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - i will not commit before 12:00 - -2003-04-02 Andrei Zmievski - - * zend_API.c - zend_API.h: - - Add zend_register_internal_namespace() API function. - - Add zend_register_internal_class_in_ns() API function. - - * zend_compile.h: - Simplify. - -2003-04-02 Derick Rethans - - * zend_list.c: - - Fix whitespace - -2003-04-02 Sterling Hughes - - * zend_list.c - zend_list.h: - add the ability for curl_multi_info to introspect the handles. - - -2003-04-02 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Implement a different way to catch documentation comments. - - * zend_compile.c - zend_compile.h - zend_highlight.c - zend_language_parser.y - zend_language_scanner.l: - Revert portions of the doc comment patch. There should be no parser - errors now. - -2003-04-02 Stanislav Malyshev - - * zend_builtin_functions.c - zend_compile.h - zend_execute.c: - allow class_exists() to work with namespaces too. - add CLASS_IS_NAMESPACE macro - - * zend_builtin_functions.c: - fix typo - - * zend_builtin_functions.c: - fix parameterless get_declared_classes call - -2003-04-01 Andrei Zmievski - - * zend_execute.c: - Stas's patch on zend_execute.c (1.448 -> 1.449) resulted in a bug where - the namespaced member accesses didn't work. This should hopefully - correct it. - - * zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_opcode.c: - Split ZEND_NAMESPACE into user and internal namespaces. Hope this is - okay with engine folks. - -2003-04-01 Stanislav Malyshev - - * zend_builtin_functions.c: - improve namespace name hanfling - - * zend_builtin_functions.c: - fix get_declared_classes() - - * zend_language_parser.y - zend_language_scanner.l: - Add __NAMESPACE__ auto-constant. - - * zend_builtin_functions.c: - make get_declared_classes() work with namespaces (based on Tal Peer's - patch) - -2003-03-31 Andrei Zmievski - - * zend.h - zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Multi-purpose patch: - - The fields of zend_namespace were not completely initialized which - led to a variety of problems. - - The occurrence of class/interface/namespace definition is now - captured. - - Functions/classes/interfaces/namespaces can be preceded by doc - comments which are stored for use by extensions. - -2003-03-31 Stanislav Malyshev - - * zend.c: - Use strncpy instead of sprintf - -2003-03-30 Andrei Zmievski - - * zend_language_parser.y: - Since zend_do_begin_class_member_function_call assumes the previous - opcode is FETCH_CONSTANT, swap the calls around. - -2003-03-30 Sebastian Bergmann - - * zend_execute.c: - ZTS fix. - -2003-03-30 Stanislav Malyshev - - * zend.c: - Try to report class name of the exception - - * zend_execute.c: - Fix namespace switch - -2003-03-29 Zeev Suraski - - * zend_compile.c: - Add missing initialization - - * zend_compile.c: - Fix crash - - * zend_API.c - zend_compile.c - zend_compile.h: - Initial support for enforcing prototype of abstract/interface method - implementations - -2003-03-29 Sterling Hughes - - * zend.c: - remove unused variable - -2003-03-27 Stanislav Malyshev - - * zend_execute.c: - fix fetch_class buglet - -2003-03-26 Stanislav Malyshev - - * zend_execute.c - zend_language_parser.y: - Un-nest namespaces - now namespace X { namespace Y {} } is a parse error - Also refine namespaced includes - -2003-03-26 Ilia Alshanetsky - - * zend_compile.c: - Fixed bug #22900 (declaration of namespaces with same name results in - leaks). - -2003-03-26 Sebastian Bergmann - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.h: - Eliminate TSRMLS_FETCH() calls in destroy_op_array() and - zend_get_class_entry(). - - * zend_API.c - zend_object_handlers.c - zend_objects.c - zend_objects.h: - Eliminate TSRMLS_FETCH() calls in zend_objects_new() and - zend_objects_get_address(). - -2003-03-25 Andi Gutmans - - * zend_compile.c: - - Temporarily fix problem with inheriting from an internal class. This - might - - need some rework in the future (thanks to Marcus) - -2003-03-24 Stanislav Malyshev - - * zend_execute.c: - Fix {include|require}_once error message - if open - fails, don't use tream, use original name. - -2003-03-23 Andi Gutmans - - * zend.c: - - Fix win32 build - -2003-03-23 Stanislav Malyshev - - * zend.c: - resore namespace on shutdown - since some functions use - EG() and CG() pointers - -2003-03-23 Sebastian Bergmann - - * zend_default_classes.c: - ZTS fix. - -2003-03-23 Zeev Suraski - - * zend_compile.c: - Another fix for implicit public, perhaps it was not such a good idea :I - -2003-03-23 Sebastian Bergmann - - * Zend.dsp - ZendTS.dsp - zend_default_classes.c: - Add new files to ZendTS.dsp. Sync list of files in Zend.dsp with - ZendTS.dsp. ZTS fixes. - -2003-03-23 Sterling Hughes - - * zend_default_classes.h: - DEFAULT_CLASSES_H not DEFAULT_INTERFACES_H - - * Makefile.am - zend.c - zend_default_classes.c - zend_default_classes.h: - add a standard Exception class. - -2003-03-22 Shane Caraveo - - * zend_compile.h: - export functions needed by cli - - * zend_language_scanner.l: - fix crash in win32 debug build - -2003-03-20 Stanislav Malyshev - - * Zend.m4: - Add stdlib.h too - it is needed fot strto{ld} - -2003-03-19 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_highlight.c - zend_language_parser.y - zend_language_scanner.l: - - Keep track of starting/ending line numbers for user functions. - - Store last parsed doc comment in a compiler global for future use. - - * zend_API.c: - Lowercase the function name when used as key in the function name. The - original case is still preserved in zend_function structure. - -2003-03-18 Zeev Suraski - - * zend_compile.c - zend_object_handlers.c: - - Fix situation where a derived class declares a public (or implicit - public) - with the same name as a private in the parent - - Optimize 'static binding' of private properties a bit - -2003-03-18 Stig Bakken - - * RFCs/002.txt: - - email address change - -2003-03-17 Stanislav Malyshev - - * zend_extensions.c: - MFZE1 - -2003-03-17 Jani Taskinen - - * Makefile.am: - Added missing zend_mm.c file and renamed zend_object_API.c -> - zend_objects_API.c - -2003-03-13 Andrei Zmievski - - * zend_API.c: - Fix warning in va_start(). - -2003-03-12 Andrei Zmievski - - * zend_API.c: - Initialize the namespace when registering functions. - -2003-03-12 Zeev Suraski - - * zend_compile.c: - Fix a crash bug in the implicit public declaration - -2003-03-11 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Fix handling of ::func() - -2003-03-10 Zeev Suraski - - * zend_compile.c: - Clean redundant code - -2003-03-10 Jani Taskinen - - * zend_compile.c: - Fixed some leaks. Patch by Moriyoshi - -2003-03-10 Shane Caraveo - - * zend_config.w32.h: - fix isinf for win32 - -2003-03-09 Zeev Suraski - - * zend_language_parser.y: - Optimize - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Fix handling of ::foo - - * zend_compile.c: - Cleanup - -2003-03-09 Andi Gutmans - - * zend_language_scanner.l: - - Nuke junk - -2003-03-09 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Fix parsing rules of namespaces/classes - - * zend_language_parser.y: - Add ability to use ::interface_name in implements - - * zend_compile.c: - Fix :: handling - -2003-03-07 Sebastian Bergmann - - * ZEND_CHANGES: - Dedicated to Greg Beaver . - - * ZEND_CHANGES: - Document 'final'. - - * ZEND_CHANGES: - Fix class type hints example. - - * ZEND_CHANGES: - Update 'abstract' section. - -2003-03-07 Jani Taskinen - - * zend_ini.c - zend_ini.h: - Renamed OnUpdateInt -> OnUpdateLong to prevent further misunderstandings. - - * zend_execute.c: - Better fix for the memleaks (bug 19943) by Moriyoshi - -2003-03-06 Zeev Suraski - - * zend_compile.c - zend_execute.c: - Fix warnings - - * zend_execute.c: - Fix error message - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Require abstract classes to be explicitly declared 'abstract', in order to - avoid making developers traverse the entire class/interface hierarchy - before they can figure out whether a class is instantiable - (ok, so it makes sense :) - -2003-03-06 Sebastian Bergmann - - * ZEND_CHANGES: - -german+english+. - - * ZEND_CHANGES: - D some TBDs - -2003-03-06 Jani Taskinen - - * zend_execute.c: - Fixed bug #19943 (the memleaks) - -2003-03-06 Ilia Alshanetsky - - * zend_highlight.c: - More cleanup of the zend_strip() function. - No longer strip __LINE__, since while it may become useless it could break - code where __LINE__ is passed as a function parameter. - - * zend_highlight.c: - Fixed in zend_strip() that corrupted heredoc. - Optimized the writing routine by moving from putchar() to fwrite(). - Changed hardcoded opcode # to it's defined name. - -2003-03-06 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c: - Change opcode name - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Add class type hints - -2003-03-05 Zeev Suraski - - * zend_compile.c: - Fix auto globals - - * zend_compile.c - zend_execute.c - zend_language_parser.y: - Implement $obj::static_func() - - * zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c - zend_operators.c - zend_operators.h: - Add support for interfaces - -2003-03-04 Zeev Suraski - - * zend_compile.c - zend_language_parser.y: - Remove legacy code - - * zend_compile.c: - Remove redundant code - -2003-03-03 Harald Radi - - * zend_API.c: - add missing strtolower - - * zend_API.c - zend_API.h: - commiting zend_disable_class patch for George: - disabled classes will be replaced by dummy classes - that print a warning upon instanciation - -2003-03-02 Zeev Suraski - - * zend_execute_API.c: - Fix destructors some more - - * zend_compile.c - zend_compile.h: - Improve infrastructure - - * zend.c - zend_compile.c - zend_compile.h: - Add infrastructure for JIT initialization of auto globals - -2003-03-01 Zeev Suraski - - * zend_compile.c: - Fix mem leak - -2003-03-01 Andi Gutmans - - * zend_compile.c: - - Make __construct() have higher priority than class name functions - - for constructors. - - Fix problem with the engine allowing final/abstract for the same method. - - Both patches are by Marcus Börger. - -2003-02-27 Rasmus Lerdorf - - * zend_ini_scanner.l: - MFB: We know ini file scanning will never be interactive, so speed it up a - bit. Need a dynamic check for the language scanner. - -2003-02-26 Sebastian Bergmann - - * ZEND_CHANGES: - Syntactic sugar is sweet. - -2003-02-25 Zeev Suraski - - * zend_compile.c: - Get the bits right - final/private fix - -2003-02-25 Jani Taskinen - - * acconfig.h: - Do not redefine zend_isnan if it is already defined. - - * Zend.m4: - - Fixed bug #14245 ('make install' fails on AIX when using --with-apxs). - -2003-02-24 Stanislav Malyshev - - * zend_compile.c: - fix exception handling - -2003-02-24 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_language_parser.y - zend_language_scanner.l: - Add 'final' - -2003-02-24 Sebastian Bergmann - - * ZEND_CHANGES: - Remove obsolete not on redeclaring protected members. - - * ZEND_CHANGES: - Leftover. - - * ZEND_CHANGES: - Initial documentation of namespace {}. - -2003-02-23 Zeev Suraski - - * zend_compile.c: - Move abstract inheritance logic to the right spot - - * zend_compile.c: - Fixed abstract handling in inheritence - -2003-02-20 Wez Furlong - - * zend_stream.c: - -cough* - Fix another stupid mistake. - -2003-02-20 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_opcode.c: - Allow namespaces to have a number of parts. I.e., now you can do: - namespace foo { - function abc() {} - } - ... - namespace foo { - functio def() {} - } - -2003-02-19 Wez Furlong - - * zend_stream.c: - Fix stupid mistake that only affected interactive mode. - -2003-02-18 Rasmus Lerdorf - - * zend_stream.c: - fileno() needs a FILE * here, and at least on FreeBSD with gcc-2.95.3 - it is unable to figure out that this is indeed a FILE * and hence it - won't compile without this cast. - -2003-02-18 Zeev Suraski - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_scanner.l - zend_opcode.c: - Avoid using a C++ reserved word - -2003-02-18 Wez Furlong - - * ZendTS.dsp - flex.skl: - Fixup build for win32 - - * Makefile.am - flex.skl - zend.c - zend.h - zend_compile.h - zend_execute.c - zend_globals.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l - zend_stream.c - zend_stream.h: - Implement simple stream support in the ZE scanners. - -2003-02-17 Zeev Suraski - - * zend_language_parser.y: - Whitespace & minor renames - - * zend_language_parser.y: - whitespace - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Improve handling of static member variables - - * zend_config.w32.h - zend_ini_parser.y: - Improve Win32 build performance - -2003-02-16 Zeev Suraski - - * zend_execute.c: - Fix complex cases of self-assignments (bugs #21600, #22231) - - * zend_execute.c: - Make EG(This) and EG(scope) available to internal methods - - * zend_execute.c: - Revert patches - they weren't ready yet! - - * zend.c: - Fix initialization - -2003-02-16 Georg Richter - - * zend_execute.c: - fixed compiler warning - - * zend_execute.c: - tested patch from Zeev (fixes oo-bug in ext/mysqli) - -2003-02-16 Stanislav Malyshev - - * zend_compile.c - zend_language_parser.y: - add support for ::foo syntax meaning "global one" - - * zend_compile.c: - remove debug prints - -2003-02-16 Sebastian Bergmann - - * zend.c - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - ZTS fixes - -2003-02-16 Stanislav Malyshev - - * zend_object_handlers.c: - namespace patch - static variable access - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - Namespace patch. Big changes: - 1. Nested classes are gone. - 2. New syntax for namespaces: - namespace foo { - class X { ... } - function bar { ... } - var x = 1; - const ZZ = 2; - } - 3. Namespaced symbol access: $x = new foo::X; - etc. - For now, namespaces are case insensitive, just like classes. - Also, there can be no global class and namespace with the same name - (to avoid ambiguities in :: resolution). - -2003-02-15 Ilia Alshanetsky - - * zend_ini_scanner.l: - Added feature #19645 (ini parser can now handle quoted multi-line values). - -2003-02-14 Thies C. Arntzen - - * zend_execute_API.c: - init current_execute_data befor we start executing - - * Makefile.am: - ups - - * Makefile.am: - add really nice dump_bt function for debugging in gdb - -2003-02-13 Zeev Suraski - - * zend_object_handlers.c: - Fix error handling in illegal property access - -2003-02-13 Harald Radi - - * zend_language_scanner.l: - MFB PHP_4_3 - -2003-02-12 Ilia Alshanetsky - - * zend_API.c - zend_API.h: - Removed zend_get_module(), this function is not used by anything and more - importantly. it does not work. It tries to find data based on numeric keys - in hash table using string keys. - -2003-02-12 Zeev Suraski - - * zend_compile.c: - Fix declaration of class members that don't have an explicit access - modifier - -2003-02-11 Zeev Suraski - - * zend_compile.c: - Fix require() handling - that's an old bug! - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Improve parser handling of 'abstract' - -2003-02-10 Zeev Suraski - - * zend_compile.c: - Fix zend_initialize_class_data() - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h: - Centralize class initialization - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Treat $this->foo inside class X as an implicit 'public $foo' if X::$foo - is not explicitly declared - - Forbid multiple declaration of the same variable - - * zend_execute.c: - whitespace - - * zend_API.c - zend_compile.c: - Add missing destructors - -2003-02-10 Stanislav Malyshev - - * zend_object_handlers.c: - update static constants too - -2003-02-10 Zeev Suraski - - * zend_builtin_functions.c: - Fix get_parent_class() - - * zend_object_handlers.c: - Restore missing check - - * zend_execute.c - zend_execute_API.c: - Add ability to reference self:: and parent:: in constant initializers - (bug #21849) - - * zend_execute.c: - Remove redundant code - -2003-02-09 Zeev Suraski - - * zend_execute.c: - Fix the array() problem (and probably some other problems too) - -2003-02-08 Georg Richter - - * zend_API.c - zend_API.h: - fixed zend_parse_method_param - -2003-02-08 Sebastian Bergmann - - * zend_builtin_functions.c: - zend_config.h (and its Win32 version) is already included by zend.h - -2003-02-08 Ilia Alshanetsky - - * zend_builtin_functions.c: - The string.h is already avaliable through zend.h, so the manual inclusion - is not necessary. - -2003-02-07 Ilia Alshanetsky - - * zend_builtin_functions.c: - Added a check to ensure that string.h is avaliable before trying to use it. - - Thanks Andi. - - * zend_builtin_functions.c: - Added missing header. - -2003-02-07 Zeev Suraski - - * zend_globals.h - zend_object_handlers.c: - Improve PPP handling of properties - - * zend_config.w32.h: - Better fix - - * zend_config.w32.h: - Fix Windows build - -2003-02-07 Ilia Alshanetsky - - * zend_builtin_functions.c: - Fixed bug #15734 (Added an optional parameter to get_defined_constants(), - which if passed, will include information regarding who created the - constant). - -2003-02-06 Ilia Alshanetsky - - * zend_builtin_functions.c: - Fixed bug #19506 (get_extension_funcs() can now retrieve a list of built-in - Zend Engine functions, if "zend" is specified as the module name). - Made get_extension_funcs() on failure. - -2003-02-06 Zeev Suraski - - * zend_compile.c: - Fix the 2nd buglet in the error message :) - - * zend_object_handlers.c: - Fix check - - * zend_hash.c - zend_hash.h: - Fix prototype (may have caused stack corruption) - -2003-02-05 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_objects_API.c: - - read_property cleanup - - Implement unset/isset/empty for PPP - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h - zend_opcode.c: - Rework static class properties - now supports access restrictions - - * zend_hash.c - zend_hash.h: - Add quick_exists() - - * zend_object_handlers.c: - Add PPP support for arrays - - * zend_compile.c: - Fix buglet in error message - -2003-02-04 Zeev Suraski - - * zend_object_handlers.c: - Missing update - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_object_handlers.c - zend_opcode.c - zend_ts_hash.c - zend_ts_hash.h: - Reimplement PPP properties - -2003-02-03 Sebastian Bergmann - - * zend_API.h: - Build fix. - -2003-02-02 Harald Radi - - * zend_API.c - zend_API.h: - extend the parameter parsing API by two functions - for parsing method parameters with automatic - detection if the function was called as such or as - a class method (with a valid this ptr). - if called as a function the first parameter has to be - the object it is operating on, if called as a method - this is used. - - -2003-02-02 Zeev Suraski - - * zend.h - zend_operators.h: - whitespace - - * zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: - Core rearrangements - move Zend Objects specific code to their - specific implementation file - -2003-02-02 Andi Gutmans - - * zend_compile.c: - - Fix warning - -2003-02-01 Sebastian Bergmann - - * zend_ini_scanner.l - zend_language_scanner.l: - Fix build. - -2003-02-01 Jani Taskinen - - * acconfig.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_execute_locks.h - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_istdiostream.h - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - - Added some missing CVS $Id$ tags, headers and footers. - -2003-01-30 Ilia Alshanetsky - - * zend_operators.c: - Fixed compiler warning regarding signed/unsigned int comparisons. - -2003-01-30 Harald Radi - - * zend_ts_hash.c - zend_ts_hash.h: - fix non-zts build for wez - -2003-01-30 Ilia Alshanetsky - - * zend_execute_API.c: - Fix ZTS build. - -2003-01-29 Stanislav Malyshev - - * zend_compile.h - zend_execute_API.c - zend_opcode.c: - Add additional stage to post-session cleanup. - We need separate cleanup stage because of the following problem: - Suppose we destroy class X, which destroys function table, - and in function table we have function foo() that has static $bar. Now if - object of class X was assigned to $bar, its destructor will be called and - will - fail since X's function table is in mid-destruction. - So we want first of all to clean up all data and then move to tables - destruction. - Note that only run-time accessed data need to be cleaned up, pre-defined - data can not contain objects and thus are not probelmatic. - -2003-01-29 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Code rearrangements - -2003-01-29 Stanislav Malyshev - - * zend_execute_API.c: - Fix object destructors: - zend_objects_store_call_destructors is not used anymore, we rely on - symbol tables cleaners to destroy all objects. - - * zend_objects_API.c: - extra safety - - * zend_compile.c: - fix memory leak - -2003-01-29 Zeev Suraski - - * zend_execute.c - zend_object_handlers.c: - Fix assignments to $this. - Fixes the 'make install' problem reported on php-dev - -2003-01-28 Zeev Suraski - - * zend_compile.c: - Fix a ticks related crash - - * (PHP_5_0_dev_before_13561_fix) - zend_execute.c: - Allow methods in parent classes to call protected methods in derived - classes - -2003-01-27 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c: - Replace MAKE_VAR opcode with special 'data' opcode - This opcode is not executeable but only holds data for opcodes - that need more than two arguments (presently only ASSIGN_OBJ and the ilk - but - in the future also ASSIGN_DIM) - -2003-01-26 Sascha Schumann - - * zend_API.c: - Replace snprintf() call using zend_error's capabilities - -2003-01-23 Zeev Suraski - - * zend_execute.c: - Let the scope propagate to internal functions - -2003-01-23 Jani Taskinen - - * zend_execute_API.c: - Fixed bug: #14542, register_shutdown_function() timeout problem - -2003-01-22 Stanislav Malyshev - - * OBJECTS2_HOWTO: - some small refinements for get_class_* - -2003-01-22 Ilia Alshanetsky - - * zend_execute.c: - Fixed bug #21814 (Allow booleans to be used as array keys). - -2003-01-21 Sterling Hughes - - * zend_objects_API.c: - fix by phanto to the cloning - -2003-01-19 Zeev Suraski - - * Zend.m4: - relabel - -2003-01-19 Stanislav Malyshev - - * zend_compile.c: - Restore for now old statics behaviour (so that indirect $$var references - would work again). Comprehensive fix will follow later. - -2003-01-19 Harald Radi - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l: - ini patch to allow 'entry[] = value' entries - -2003-01-17 Harald Radi - - * zend_objects.c - zend_objects.h: - export zend_objects_destroy_object() - static inline was meaningless anyways as the function - was only used as a callback handler and was never - called directly - - * zend_objects_API.c - zend_objects_API.h: - make std_object_handlers struct available for shared modules - -2003-01-16 Ilia Alshanetsky - - * zend_execute.c: - Fixed bug #20933 (isset/empty didn't work when used on string offsets). - -2003-01-15 Andi Gutmans - - * zend_compile.c: - - Revert int -> unsigned int change for str.len - -2003-01-15 Sascha Schumann - - * zend.h: - Revert commit which turned the lengths of strings into zend_uint. - -2003-01-14 Andi Gutmans - - * ZEND_CHANGES - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Change "is" to "instanceof" as it explains better what the operator - means. - - "is_a" was also appropriate but ugly. - -2003-01-14 Stanislav Malyshev - - * zend_API.c: - fix memory leaks and key size - -2003-01-14 Ilia Alshanetsky - - * zend_ini_parser.y: - MFZE2 - -2003-01-14 Stanislav Malyshev - - * zend_compile.c: - fix warning - - * zend_API.c - zend_API.h: - Make add_property_ functions work via write_property handler - - * zend.c - zend_object_handlers.c: - ws - -2003-01-14 Ilia Alshanetsky - - * zend_ini_parser.y: - Reverting previous patch. - -2003-01-13 Ilia Alshanetsky - - * zend_ini_parser.y: - MFZE2 - -2003-01-13 Andi Gutmans - - * zend_objects_API.c: - - Don't check if the handle is bogus. We should crash. - -2003-01-12 Harald Radi - - * zend_modules.h: - fix wrong dereferenciation - -2003-01-12 Stanislav Malyshev - - * zend_compile.c: - fix inheritance - - * zend_API.h: - Remove handle_property from here too - - * zend.c - zend.h - zend_compile.c: - RIP handle_* functions. ZE2 will use __ handlers instead. - - * zend_object_handlers.c: - Move Z_OBJ_P here. - - * zend_operators.h: - Remove Z_OBJ - it's internal to Zend objects, no generic function except - those in zend_object_handlers.c should use it. - Add Z_OBJ_HANDLER macro for easy access to handlers - -2003-01-12 Sebastian Bergmann - - * zend.c - zend.h - zend_builtin_functions.c: - ZTS fixes. - -2003-01-12 Stanislav Malyshev - - * zend_object_handlers.c: - add get_class_name handler - - * zend.c: - Use generic handlers instead of Z_OBJ - -2003-01-12 Harald Radi - - * zend_modules.h: - - - * zend_ini.h - zend_ini_entry.h - zend_modules.h: - partially revert previous commit and - change zend_modules.h to include - a forward declaration to zend_ini_entry - - * zend_ini.h - zend_ini_entry.h - zend_modules.h: - added zend_ini_entry to zend_modules_entry as - discussed with zeev - - * zend_builtin_functions.c: - fix 'use of uninitialized variable' warning - -2003-01-12 Stanislav Malyshev - - * zend_objects_API.c: - validate handle - -2003-01-12 Zeev Suraski - - * zend.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_ini.c - zend_ini.h - zend_variables.c: - Implemented compatibility mode - To enable - zend2.implicit_clone = on in php.ini or using ini_set() - -2003-01-11 Andi Gutmans - - * zend_execute.c: - - Fix typo and whitespace - -2003-01-11 Derick Rethans - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c: - - Ported the zend_execute_internal hook to ZendEngine2. - -2003-01-11 Harald Radi - - * zend_ts_hash.c: - freed reader twice instead of writer and reader - -2003-01-10 Ilia Alshanetsky - - * zend_alloc.c: - MFZE2 - -2003-01-10 Andrei Zmievski - - * zend_API.c: - Automatically register constructor, destructor, and clone function when - class methods are registered. - -2003-01-09 Zeev Suraski - - * zend_compile.c: - Found some more occurences of that elusive bug... - - * zend_compile.c: - Fix one lousy, annoying lurking bug (memory corruption) - Sebastian - try coWiki again please... - - * zend_API.h: - Unify and make it easy to add code into the broken-string error handler - - * zend_language_parser.y: - Fix writability checks - - * zend.c: - Fix leak - -2003-01-08 James Cox - - * zend.h: - cvs is dev not alpha. - -2003-01-08 Ilia Alshanetsky - - * zend_builtin_functions.c: - MFZE2 - -2003-01-05 Zeev Suraski - - * zend_compile.c - zend_globals.h - zend_language_scanner.l: - MFZE1 - lineno fix - -2003-01-02 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix incorrect linkage of access-levels, when using private methods - -2003-01-01 Zeev Suraski - - * zend_API.c - zend_operators.h: - Win32 build fix - -2003-01-01 Stanislav Malyshev - - * zend_operators.h: - use handler for Z_OBJPROP - -2003-01-01 Zeev Suraski - - * zend_API.c: - Fix Wez's problem - -2002-12-31 Sebastian Bergmann - - * LICENSE - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.nw.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_language_scanner.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_mm.c - zend_mm.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_ts_hash.c - zend_ts_hash.h - zend_types.h - zend_variables.c - zend_variables.h: - Bump year. - -2002-12-31 Stanislav Malyshev - - * zend_object_handlers.h: - fix level of indirection - -2002-12-30 Andrei Zmievski - - * zend_execute_API.c: - Adjust the error message. - -2002-12-30 Stanislav Malyshev - - * zend_object_handlers.h: - Oops, fix it indeed - - * zend_object_handlers.h: - Better check - -2002-12-26 Andrei Zmievski - - * zend_compile.c: - do_inherit_method_check() is supposed to return 0 or 1, not SUCCESS or - FAILURE. - -2002-12-14 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE2 - -2002-12-10 Zeev Suraski - - * zend_compile.c: - Fix check to allow for static+access level modifiers - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Allow variables to have both 'static' modifier and an access level. - NOTE: This only works at the syntax level right now (parser). It - doesn't actually work as of yet - all statics are considered - public for now - - Prevent users from putting more restrictions on methods in derived - classes - (i.e., you cannot make a public method private in a derived class, etc.) - -2002-12-09 Andi Gutmans - - * zend_mm.c: - - Fix a bug which I just introduced. - - * zend_mm.c: - - Fix typo - - * zend_mm.c: - - Improvements - - * zend_mm.c - zend_mm.h: - - First attempt to improve memory manager during realloc()'s - -2002-12-08 Zeev Suraski - - * zend_compile.c: - Remove comment - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Treat the absence of an access type just as if 'public' was supplied - - * zend_compile.c: - Simplify/fix inheritance checks - - * zend_execute.c: - Support private/protected constructors - -2002-12-07 Sebastian Bergmann - - * ZEND_CHANGES: - Update. - -2002-12-07 Zeev Suraski - - * zend_execute.c: - Fix error messages - - * zend_language_parser.y - zend_language_scanner.l: - Remove unintentional code - -2002-12-07 Andi Gutmans - - * zend_compile.c: - - Dissallow using parent, self and main as class names - -2002-12-06 Zeev Suraski - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_hash.h - zend_language_parser.y - zend_language_scanner.l: - - Implement public/protected/private methods. - - Prevent instantiation of classes with abstract methods. - Based in part on Marcus's patch. - -2002-12-01 Andi Gutmans - - * zend_alloc.c: - - Allow enabling of memory cache with zend_mm - - * zend.c - zend.c - zend.h - zend.h - zend_builtin_functions.c - zend_builtin_functions.c: - - MFZE1 - - * zend.c - zend.h - zend_builtin_functions.c: - - Revert as the patch doesn't compile - - * zend.c - zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_indent.c - zend_object_handlers.c - zend_opcode.c - zend_operators.c - zend_operators.h - zend_variables.c: - h WHitespace - - * zend.c: - - Initialize constants_updated (by Marcus) - - * zend_builtin_functions.c: - - Nuke use of deprecated macro - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - FN_IS_STATIC -> FN_STATIC - - * zend.c: - - Fix crash - - * zend_compile.c - zend_compile.h: - - My personal cleanups - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_language_parser.y - zend_object_handlers.c: - - Commit Marcus' cleanup of abstract and static inheritance and improve - - error messages - -2002-11-22 Derick Rethans - - * zend_API.c: - - Initialize all functions to non-static (patch by Marcus Börger - . - -2002-11-22 Sebastian Bergmann - - * zend_execute.c: - Show class name as well. Patch by Marcus Börger. - - * zend_execute.c: - Show the name of the abstract method in the error. - - * zend_compile.h: - Fix prototype. - -2002-11-20 Derick Rethans - - * zend_builtin_functions.c: - - MFZE1: Disable leak() and crash() when not using debug mode - -2002-11-20 Andi Gutmans - - * ZEND_CHANGES: - - Add abstract methods - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l: - - Fix build (thanks Marcus) - - Implement abstract methods, syntax: - - abstract function foo($vars); - - I don't see any reason why modifiers such as static/public need to be - - used with abstract. PHP is weakly typed and there would be no meaning to - - this anyway. People who want a strictly typed compiled language are - - looking in the wrong place. - -2002-11-19 Zeev Suraski - - * zend.c - zend.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c: - MFZE1 - error_reporting fix - -2002-11-18 Andi Gutmans - - * zend_language_scanner.l: - - MFZE1 - -2002-11-17 Stanislav Malyshev - - * zend_execute.c: - fix the leak - -2002-11-16 Andi Gutmans - - * zend_language_scanner.l - zend_language_scanner.l: - - MFZE1 - - * Zend.m4 - configure.in: - - MFZE1 - - * zend_hash.c: - - Commit fix for bug #19566 (I think it's by Marcus :) - -2002-11-14 Andrei Zmievski - - * zend_llist.h: - MFZE1 - -2002-11-13 Stanislav Malyshev - - * zend_execute.c: - semi-fix string offsets crash - now it doesn't crash, but still leaks - - * zend_object_handlers.c: - fix static - -2002-11-11 Andi Gutmans - - * ZEND_CHANGES: - - Update with statics - -2002-11-11 Sebastian Bergmann - - * zend_execute.c: - Fugbix typo. - -2002-11-11 Ilia Alshanetsky - - * zend.h: - MFZE1 - -2002-11-10 Andi Gutmans - - * zend_compile.c: - - MFZE1 - -2002-11-10 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - fix statics - make it behave like $this (fetch type "static") - Side effect: indirect references to statics won't work. - -2002-11-06 Sebastian Bergmann - - * zend_execute.c: - Fix ZTS build. - -2002-11-06 Stanislav Malyshev - - * zend_execute.c: - fix zend_assign_to_object_op - -2002-11-05 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE1 - -2002-11-05 Andi Gutmans - - * zend_compile.h: - - Shift around zend_op members - - * ZEND_CHANGES: - - A couple of updates - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - Add support for static methods. Basically methods which are defined as - - static don't have $this. That's the whole difference. - - * tests/zend2.php: - - $clone -> $that - - * zend_execute_API.c: - - Fix bug introduced with type change of free_op1/2 - - * zend_language_parser.y - zend_language_scanner.l: - - ATTENTION: Finally nuke old_function and cfunction. I think it is time - - to get rid of these BC notations. This is from the days of the move from - - PHP/FI 2 -> PHP 3 - -2002-11-05 Ilia Alshanetsky - - * zend_hash.c: - Revert of previous patch. - -2002-11-05 Andi Gutmans - - * zend_compile.c - zend_objects.c: - - Change the automatically created variable $clone in __clone() to - - $that as discussed at the PHP Conference. If there are any objections - - alternative names please let me know. The reason for changing it from - - $clone is because $clone sounds as if it's the newly cloned object and - - not the old one. - -2002-11-05 Stanislav Malyshev - - * zend_compile.c - zend_compile.h: - avoid using 'class' in exported functions - it annoys c++ - -2002-11-05 Stig Bakken - - * zend.c: - Fixed some special cases that were crashing for the exception default - handler. - -2002-11-04 Ilia Alshanetsky - - * zend_compile.c: - Silence compiler warnings. - - * zend_hash.c: - If ordered is not set a random compiler assigned value of *p2 would be - used, - this patch fixes the problem by initializing *p2 to NULL. - - * zend_operators.c: - Silence compile warning, ctype.h is needed for tolower() function. - - * zend_language_scanner.l: - MFZE1 - -2002-11-02 Derick Rethans - - * zend_language_scanner.l: - - Fix segfault when __CLASS__ was used outside a class definition - - * zend.c: - - MFZE1 - -2002-11-02 Ilia Alshanetsky - - * zend_language_scanner.l: - MFZE1 (20214). - -2002-11-01 Andi Gutmans - - * zend_execute.c: - Fix unset($this->foo) - -2002-10-24 Andi Gutmans - - * zend_execute.c - zend_opcode.c: - Also tune jmpz_ex - - * zend_execute.c - zend_opcode.c - zend_compile.h: - - Improve performance of part of the jmps. More to follow. - -2002-10-23 Andi Gutmans - - * zend_execute.c - zend_compile.c: - - This might improve performance. Commiting it so that I can check it on - - Linux - - * zend_execute.c: - - Make Ts access a macro. I need this for my next patch which should - - improve performance but not sure yet if it will. - -2002-10-22 Andi Gutmans - - * zend_execute.c: - Nuke unused get_incdec_op() - - Nuke old comment - - * zend_compile.h - zend_execute.c - zend_globals.h: - Improve overall engine performance - - * zend_execute.c: - Fix bug reported by Daniel T. Gorski - -2002-10-21 Thies C. Arntzen - - * zend_builtin_functions.c: MFZE1 - -2002-10-20 Stanislav Malyshev - - * zend_object_handlers.c: looks like this message should go - - * zend_compile.c: Fix private handling - -2002-10-20 Sebastian Bergmann - - * zend_highlight.c - zend_highlight.h: Sync zend_html_puts parameter list with Zend Engine 1. - -2002-10-19 Andi Gutmans - - * zend_compile.h: - Fix compile warning. - - * zend_opcode.c - zend_compile.h - zend_execute.c: - Improve opcode dispatching - -2002-10-18 Andi Gutmans - - * zend.c - zend_compile.c - zend_execute.c: - - Change opcode dispatch mechanism to use a function per opcode and use - - a lookup table using the opcode # to call the correct function. - - Still have lots of tuning to do. - - * zend_execute.c: - Cleanup - -2002-10-16 Sebastian Bergmann - - * zend_execute.c: Fix ZTS build. - -2002-10-16 Stanislav Malyshev - - * zend_compile.c - zend_execute.c: Fix class static members: now the following code works: - - and returns "Hello" (class statics are not copied anymore, but looked up in - runtime) - - * zend_compile.c - zend_compile.h - zend_execute.c: Fix and generalize $this handling. - ZEND_FETCH_FROM_THIS is removed, IS_UNUSED type on class variables will be - used instead as the sign that it's a fetch from $this - -2002-10-14 Ilia Alshanetsky - - * zend_ini_parser.y - zend_ini_scanner.l - zend_globals.h: MFZE1 - -2002-10-14 Andi Gutmans - - * zend_execute.c - zend_language_parser.y: - Support new classname::$class_name, e.g.: - hello; - ?> - -2002-10-13 Ilia Alshanetsky - - * zend_extensions.h: Increased the API number. (re: floats patch) - -2002-10-12 Ilia Alshanetsky - - * zend_operators.c - zend_operators.h - zend.c - zend_execute_API.c - zend_globals.h: MFZE1 (floats & locale issue) - -2002-10-10 Sebastian Bergmann - - * ZEND_CHANGES: Fugbix typo. - -2002-10-10 Stanislav Malyshev - - * zend_object_handlers.c: add comment - - * zend_object_handlers.c: fix memory leaks - -2002-10-09 Stanislav Malyshev - - * zend_object_handlers.c: Fix object write handler behaviour: - * If this value is already set to given value, don't try to set it again. - * If we have reference, we should not move it. - * If we are assigning referenced variable, we should separate it. - -2002-10-09 Ilia Alshanetsky - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_object_handlers.c - zend_operators.c - zend_operators.h: MFZE1 zend_str_tolower issue. - -2002-10-07 Andi Gutmans - - * tests/zend2.php: - Fix test - - * zend_execute.c: - - Require $this-> when calling a methods. This whole automatic lookup - - first in the class and then in the global scope is confusing, slow and - - not quite BC compatible. - - * zend.c - zend_compile.c - zend_globals.h: - - Allow access to private/protected variables of $clone inside the __clone() - - method - -2002-10-06 Andi Gutmans - - * zend_execute.c: - Fix problem with unsetting object members. - -2002-10-01 Andi Gutmans - - * zend_language_parser.y: - - Fix problem when crashing on illegal tokens in class name during class - - definition. - -2002-09-30 Derick Rethans - - * ZEND_CHANGES: - No tabs :) - -2002-09-28 Derick Rethans - - * zend_builtin_functions.c: - Fix for defines... - - * zend_builtin_functions.c: - Fix build in non-ZTS mode - -2002-09-26 Ilia Alshanetsky - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_object_handlers.c - zend_operators.c - zend_operators.h: MFZE1 - -2002-09-25 Stanislav Malyshev - - * zend_extensions.h: - Propmote API NO year, so that it will never be the same as ZE1 API NO - -2002-09-24 Andi Gutmans - - * zend_compile.c: - Fix leak - - * zend_language_parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Megapatch to try and support inheritance from sub-classes. Things might - - be *very* buggy now so don't get too upset if that happens. - - I still need to improve some stuff but it's a good step (hopefully). - -2002-09-23 Andi Gutmans - - * zend_globals.h - zend_ini.c - zend_language_parser.y: - MFZE1. - -2002-09-21 Andi Gutmans - - * zend_extensions.h: - Someone screwed this up. - -2002-09-19 Derick Rethans - - * zend_ini.c: - Make Colin happy - -2002-09-19 Zeev Suraski - - * zend.c - zend.h - zend_execute_API.c: MFZE1 - connection_status() fix - - * zend.c: Fix non ZTS build - - * zend.c: Fix that obscure crash in Debug_TS mode - -2002-09-18 Zeev Suraski - - * zend.c: - Fix the thread-safe initialization of the ZE2. This should solve some - sporadic crashes, as well as the problem with the built-in constants. - - * zend_constants.c: Remove dead code - - * zend_builtin_functions.c: Add useful debugging function - -2002-09-17 Zeev Suraski - - * zend_hash.c - zend_hash.h: Add tracking for hashtable allocation - - * zend.c: ZE2 fix - - * zend_compile.c: whitespace - - * zend.c - zend.h: MFZE1 - threading fix - -2002-09-16 Andrei Zmievski - - * zend_API.h - zend_builtin_functions.c - zend_API.c - zend_execute_API.c: MFZE1 - -2002-09-15 Ilia Alshanetsky - - * zend_highlight.c: Make zend actually strip comments. Bug #18151 - - * zend.c: - Make zend return a proper exit error code when it encounters a parse error. - -2002-09-15 Andi Gutmans - - * zend_compile.c: - - Hopefully fix problem with __autoload not working well with inherited classes. - - There might still be some weird situations I haven't thought of. - - * zend_list.c - zend_execute.c: - WS fix - "while (" instead of "while(" - - * zend_execute_API.c - zend_ini.c - zend_list.c - zend_object_handlers.c - zend_objects_API.c - zend_operators.c - zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c: - WS - Always use "if (" and not "if(" - - * zend_execute_API.c: - WS - -2002-09-10 Stanislav Malyshev - - * zend_execute_API.c - zend_variables.c: MFZE1 - -2002-09-09 Stanislav Malyshev - - * zend_object_handlers.c: remove comment - -2002-09-08 Andi Gutmans - - * zend.h: - Prepare for alpha 3 - -2002-09-05 Stanislav Malyshev - - * zend_compile.c: quick-n-dirty inheritance support for __handlers - -2002-09-04 Sebastian Bergmann - - * ZEND_CHANGES: Whitespace fixes. - -2002-09-04 Stanislav Malyshev - - * zend_object_handlers.c: remove dead code - - * ZEND_CHANGES - zend_object_handlers.c: Fix __call and add some docs - -2002-09-04 Sebastian Bergmann - - * zend_object_handlers.c: Fix ZTS build. - - * ZEND_CHANGES: TBD: __call(), __get(), __set(). - -2002-09-04 Stanislav Malyshev - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_extensions.h - zend_object_handlers.c - zend_objects.c: Support for __get, __set and __call in classes. - This should work as follows: if class hasn't member with given name, - __get/__set is called. If class has no method with given name, __call is called. - __get/__set are not recursive, __call can be. - -2002-09-04 Sebastian Bergmann - - * ZEND_CHANGES: Workaround for superfluous comma in var_export() result. - - * ZEND_CHANGES: - Let debug_backtrace() example print out the class name, if applicable, and the function/method arguments. - -2002-09-03 Thies C. Arntzen - - * zend_builtin_functions.c: nuke warning - - * zend_builtin_functions.c: nuke unneeded stuff - -2002-09-03 Zeev Suraski - - * zend.c - zend.h - zend_ini.c: MFZE1 - -2002-09-03 Derick Rethans - - * zend_ini.c: - Revert - - * zend_ini.c: - - MFH for: Apply rest of html errors fix (Patch by Jan Lehnardt ) - -2002-09-03 Sebastian Bergmann - - * zend.h: - Add html_errors to zend_utility_values. Patch by Jan Lehnardt . - -2002-09-03 Andi Gutmans - - * zend_builtin_functions.c: - Fix typo - -2002-09-02 Thies C. Arntzen - - * zend_builtin_functions.c: - refine last patch. if the argument-stack is not consistent don't try to show - arguments. no call to zend_error is made as we might end up in an infinite - recursion if called from an error_handler. - so: if the arguments to functions aren't shown in debug_backtrace this is 'cause - the arument stack was not consistent when debug_backtrace was called. - - * zend_builtin_functions.c: - debug_backtrace() now checks the complete argument-stack for consistency. - -2002-09-02 Stanislav Malyshev - - * zend_execute.c: MFZE1 - -2002-09-01 Andi Gutmans - - * zend_llist.c: - Fix leak reported by "l0t3k" - -2002-09-01 Stanislav Malyshev - - * zend_operators.c: MFZE1 - -2002-08-28 Thies Arntzen - - * zend_builtin_functions.c - zend_execute_API.c: debug_backtrace() - - make args passed to functions called vy call_user_function available again. - - * zend_builtin_functions.c: debug_backtrace(): - - make args work if called from the error_handler - - fix refcount for args - - * zend.c: - clear current_execute_data on bailout as it would point into some freed area - on the stack. - -2002-08-28 derick - - * zend.c: - MFZE1 - -2002-08-26 Thies Arntzen - - * zend_builtin_functions.c: - debug_backtrace(): show name of included file for include and require calls - plus some small fixes suggested by andi. - -2002-08-24 Andi Gutmans - - * zend_builtin_functions.c: - Whitespace - - * zend_builtin_functions.c: - Whitespace and better variable name - -2002-08-24 Thies Arntzen - - * zend_builtin_functions.c: fix warning - -2002-08-23 Andi Gutmans - - * Zend.m4: - Add \n to configure fprintf - - * zend_extensions.c: - dlerror -> DL_ERROR - -2002-08-23 Thies Arntzen - - * zend_builtin_functions.c: - debug_backtrace: show include/require/eval as normal functions on the stack - -2002-08-23 derick - - * zend_builtin_functions.c: - No spaces :) - -2002-08-23 Thies Arntzen - - * zend_builtin_functions.c: - - debug_backtrace now also returns an array containing the arguments of the - called function. - - zeev, andi - is knowing the structure of the stack considered a bad thing in - zend_builtin_function? if yes i would have to create a new function in - zend_ptr_stack.c (but i think we are save this way) - - * zend_builtin_functions.c - zend_execute_API.c: - debug_backtrace: - added "type" ('->' or '::') for object calls. - made calls done thru call_user_func show-up correct in backtraces. - - andi, - does this look correct to you? - - * zend_execute.c: those are set by RETURN_FROM_EXECUTE - -2002-08-21 Thies Arntzen - - * zend_execute.c: - zend_execute: make sure that current_execute_data points to the right thing - after coming back from recursion. - -2002-08-19 Zeev Suraski - - * zend_operators.c: MFZE1 - -2002-08-17 Andi Gutmans - - * zend_execute.c: MFZE1 - -2002-08-17 Zeev Suraski - - * zend_execute.c - zend_hash.c: MFZE1 - -2002-08-16 Stig Bakken - - * zend.c: * append emacs footer - - * zend.c: * remove builtin exception class - -2002-08-16 Andi Gutmans - - * zend.c: - Fix whitespace - -2002-08-16 Stig Bakken - - * zend_execute_API.c - zend_globals.h - zend.c - zend_builtin_functions.c: - - Added set_exception_handler() function for registering a global, - catch-all exception handling function - - Added set_exception_handler() function for registering a global, - catch-all exception handling function (Stig) - -2002-08-15 Zeev Suraski - - * flex.skl - zend.c - zend_globals.h - zend_language_scanner.l: MFZE1 - -2002-08-14 jason - - * zend_compile.c - zend_compile.h - zend_globals.h - zend_language_parser.y: - MFZE1 (use token instead of global for opcode counting) - -2002-08-13 Andi Gutmans - - * zend_execute_API.c: - - Fix crash when exception is raised in __autoload function - -2002-08-13 Zeev Suraski - - * zend.h: MFZE1 - -2002-08-08 sebastian - - * zend_objects.c: Fix warning. - -2002-08-08 stas - - * zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h: Add ZEND_API to functions - -2002-08-08 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Make new 'is' operator work with classes only and return false when - - the object isn't of the said class or the value isn't an object. - - * zend_static_allocator.c: - Bad Harald! :) - -2002-08-08 Zeev Suraski - - * zend_alloc.c: MFZE1 - -2002-08-07 phanto - - * zend_static_allocator.c - zend_alloc.c - zend_config.w32.h - zend_hash.c - zend_ini.c - zend_llist.h - zend_mm.c - zend_operators.c: make win32 debug output more verbose - -2002-08-03 Andi Gutmans - - * tests/zend2.php: - Small fix - -2002-08-03 Zeev Suraski - - * zend_execute.c: MFZE1 - -2002-08-01 stas - - * zend_execute.c - zend_hash.c: MFZE1 - -2002-07-30 jason - - * zend_compile.c - zend_execute.c - zend_globals.h: MFZE1 global declare - - * zend_compile.c: Fix segfault - -2002-07-30 Andrei Zmievski - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - zend_operators.c - zend_operators.h: - - Adding 'is' operator that can be used to check the type of a variable, - or its class. - -2002-07-28 phanto - - * OBJECTS2_HOWTO: update the handlers struct - -2002-07-27 Andi Gutmans - - * zend_compile.c - zend_execute_API.c: - - Make sure classes are first looked for in the current scope. - - Make sure that during inheritance the global scope is searched if the - - current one doesn't work. - -2002-07-26 Andi Gutmans - - * zend_execute.c - zend.c - zend_builtin_functions.c - zend_compile.h: - - Fix problem with debug_backtrace() reported by Stig. We weren't reporting - - global function information because it wasn't available. We have to do - - an additional assignment per-function call so that it'll be available. - - Also don't define the global scope as function name _main_ but leave it - - empty so that frameworks like Pear can decide what they want to do. - -2002-07-25 sniper - - * Zend.m4: Fixed 3 major failures in this test: - - 1. Tests work better when they are actually run.. - 2. When file is opened, it should be closed sometime too. - 3. AC_TRY_RUN cleans after itself (rm -f conftest.*), so it's - good idea to read the values while the file still exists. - - -2002-07-24 Andi Gutmans - - * zend_mm.c: - Fix some compile problems with the new configure checks. - -2002-07-24 James Cox - - * Zend.m4 - zend_mm.c: move testing for the alignment values into configure. - - * Zend.m4: ws fixes. - -2002-07-23 Andi Gutmans - - * zend_hash.c: - Fix WS. - -2002-07-21 Andi Gutmans - - * zend_compile.c: - - Fix bug reported by Sebastian where old constructors didn't work in - - nested classes. - -2002-07-18 derick - - * zend.h - zend_extensions.c: - MFZE1 - MacOSX fixes by Marko Karppinen - -2002-07-17 Andi Gutmans - - * zend_compile.c: - - Remove code which wasn't supposed to go into the patch. - - * zend_compile.c - zend_language_parser.y: - Rejuggle some code. - -2002-07-17 sniper - - * ZEND_CHANGES: This was mentioned already above (with an example too :) - -2002-07-16 Andi Gutmans - - * ZEND_CHANGES: - Before I forget to list it, this was also added. - - * zend_language_scanner.l: - - Syntactic sugar - Add "public" as a synonym for "var". - - Now we have the three P's. - You can do: - - - -2002-07-15 derick - - * zend_operators.c: - MFH of the crap removal - -2002-07-15 Andi Gutmans - - * ZEND_CHANGES - zend.c - zend.h - zend_API.c - zend_compile.c - zend_language_parser.y - zend_language_scanner.l - zend_opcode.c: - - Commit patch to support protected member variables (by Timm Friebe w/ - - some fixes by me). - - You can't access protected variables from outside the object. If you want - - to see a protected member from your ancestors you need to declare the - - member as protected in the class you want to use it in. You can't - - redeclare a protected variable as private nor the other way around. - - * zend_operators.c: - - Really implement bool increment/decrement as flip-flop. - -2002-07-14 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_language_scanner.l - ZEND_CHANGES: - - Nuke delete(). It was a big mistake to introduce it and I finally - - understand why Java didn't do so. - - If you still want to control destruction of your object then either make - - sure you kill all references or create a destruction method which you - - call yourself. - - * zend_execute.c: - Nuke some unused code - -2002-07-14 derick - - * zend_operators.c: MFZE1 - - * zend_operators.c: - MFZE1 - -2002-07-07 Andi Gutmans - - * zend_objects_API.c: - Path which should improve previous fix. - - * zend_objects_API.c: - - First try at solving problem with different objects being allocated the - - same id. - -2002-07-07 Stanislav Malyshev - - * zend_object_handlers.c: name length should be strlen+1 - -2002-07-07 Sebastian Bergmann - - * zend_language_parser.y: - Allow for 'class Namespace::Bar extends Foo' syntax. Patch by Timm Friebe . - -2002-07-06 Andi Gutmans - - * zend_execute.c: - - Fix problem where scope was lost in nested function calls. - - Thanks to Timm Friebe for diving into this one. - -2002-07-06 Zeev Suraski - - * zend_language_parser.y: spelling fix - -2002-07-05 Stig Bakken - - * zend_builtin_functions.c: * folding fixes - -2002-07-01 Andi Gutmans - - * zend_compile.c: - Fix bug when acccessing $this not in class scope. - - * zend_objects.h - zend_objects.c: - Export zend_object_get_address() - -2002-06-30 Andi Gutmans - - * ZEND_CHANGES: - Remember to document autoload when I have time. - -2002-06-30 Derick Rethans - - * zend_modules.h: - MFZE1 - -2002-06-29 Andi Gutmans - - * zend.h: - Get ready for alpha2 - - * zend_execute_API.c: - Invalid -> Undefined - - * zend_language_parser.y: - Add missing semi-colon. - - * zend_execute_API.c - zend_execute.c: - Improve some error messages. - - * zend_compile.c: - Revert previous fix. - - * zend_compile.c: - Change E_ERROR -> E_COMPILE_ERROR where needed. - - * zend_compile.c: - - Fix for bug #17882. We complain if the same method is declared twice. - - * zend.h - zend_operators.c: - Fix bug 15037 - - Bump version to alpha2-dev - -2002-06-28 Andi Gutmans - - * zend_operators.c: - WS fix - -2002-06-26 Andi Gutmans - - * zend_execute_API.c: - - Autoloading support based on patch from Ivan Ristic. - - Again I hope this feature ends up working well because if it doesn't we - - might need to nuke it. This only works for global scoped classes and it - - will never work for sub-classes so don't even ask!!!!! - - Just define an __autoload() function in the global scope and it will be - - called with the class name as the parameter if it doesn't manage to find - - the class. - - * zend_API.c - zend_builtin_functions.c - zend_mm.h: - Centralize global class fetch - - * zend_alloc.c - zend_execute.c: - - Fix problem with scope's not changing correctly during method calls. - - Reapply a tiny optimization to the allocator so that in non-debug mode - - we clean memory without detecting leaks. - -2002-06-24 Andi Gutmans - - * zend_fast_cache.h: - - MFZE1 (Turn off fast cache until we make sure it performs well.) - - * zend_alloc.c: - More fixes (warnings, bug fixes etc.) - - * zend_execute.c: - - Revert patch which checks at run-time if you're allowed to assign - - certain values by reference. - - We still need to find a solution for cases when this shouldn't be allowed - - as it might cause leaks. - - * zend_alloc.c: - Fix crash bug and clean up a bit. - -2002-06-24 Sebastian Bergmann - - * Zend.m4: IMHO, ZTS should no longer be labeled experimental. - -2002-06-24 Andi Gutmans - - * zend_alloc.c: - MFZE1 - - * zend_alloc.c: - Don't use cache if we're using ZEND_MM - - * zend_mm.c: - - Hardcode alignment to 8. We might need a configure check for this. - - * zend_mm.c - zend_mm.h: - Improve memory manager to allocate small blocks quickly. - - * zend_alloc.h - zend_mm.h - zend_alloc.c: - - Don't keep allocated blocks in a linked list if we're in non-debug mode - - as now the memory manager takes care to nuke all leaking blocks. - - * zend.h - zend_types.h: - MFZE1 - -2002-06-23 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - Fix problem with constructor not being inherited and called correctly. - - * zend_mm.c: - Fix small bug - - * zend_mm.c: - - Almost completely implement realloc(). It now resizes in place when - - possible. - -2002-06-22 Andi Gutmans - - * zend_alloc.c - zend_mm.c: - Fix crash when zend_mm_shutdown is called more than once. - - * zend_alloc.c - zend_alloc.h - zend_globals.h - zend_language_parser.y: - MFZE1 - - * zend_constants.h - zend_objects.c - zend_variables.c - zend_variables.h - zend_constants.c - zend_alloc.c - zend_alloc.h: - Nuke persist_alloc(). - -2002-06-19 Andi Gutmans - - * zend_globals.h: - - This was also supposed to be part of the previous ZEND_MM commit :) - - * zend_alloc.c: - - Oops, this was supposed to be part of the previous #ifdef ZEND_MM change - - * zend_mm.h: - Use #ifdef for ZEND_MM - - * zend_mm.c: - Make sure MAX is defined - - * zend_constants.c: - - Fix problem where you couldn't define constants with different cases but - - the same name. - -2002-06-18 Derick Rethans - - * zend.c: - MFZE1 - -2002-06-17 Andi Gutmans - - * zend_mm.c: - Improve speed of alignment calculation - - * zend_mm.c - zend_mm.h - zend_alloc.c: - - Fix a bug and add code which frees actual allocated segments at the end - - of execution (this still doesn't work because some blocks remain - - referenced after the memory manager is killed. - - * zend_mm.c - zend_mm.h: - Save space per-allocated block. - -2002-06-16 Andi Gutmans - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - Fix bug in class constants - - Start centralizing main class lookups. This will help implement - - __autload() - - * zend_mm.c - zend_mm.h: - - Remove debug code which doesn't work anymore and add headers. - - * zend_globals.h - zend_mm.c - zend_mm.h - zend_alloc.c - ZendTS.dsp: - Commit an initial version of a home made memory manager. - - It's just for seeing if this would be an advantage to PHP in MT - - environments. If this is to become production material there is still - - a long way to go. - -2002-06-15 Andi Gutmans - - * zend_objects.h - zend_objects_API.c: - - Fix copy&paste problem where we allocated according to an old structure - - decleration and not the new one. - -2002-06-11 Andi Gutmans - - * zend_builtin_functions.c: - - Don't show debug_backtrace() in the trace itself. - - This patch is a bit ugly because the whole code itself is pretty complex - - and hard to re-order. - - * zend_execute.c - zend_language_parser.y: - - Fix problem with assigning functions by reference. - -2002-06-11 Sebastian Bergmann - - * RFCs/004.txt: Add __delegate(). - -2002-06-10 Harald Radi - - * zend_ts_hash.h - zend_ts_hash.c: added TS_HASH macro - -2002-06-10 Stanislav Malyshev - - * zend_execute.c: Fix leak - -2002-06-09 Harald Radi - - * zend_API.h - zend_builtin_functions.c - zend_object_handlers.h: - only check for an available class entry instead of - the std_object_handlers on some places - - -2002-06-08 Andi Gutmans - - * zend_hash.h - zend.h: - This should improve performance on Windows - - * zend_hash.h: - - Add a loop unrolled version of the hash function and a bit of an - - explanation about our hash function (Ralf S. Engelschall) - -2002-06-06 Sebastian Bergmann - - * RFCs/004.txt: Add RFC on delegation. - -2002-06-05 Sebastian Bergmann - - * zend_execute.c: Remove unused local variable. - -2002-06-05 Andi Gutmans - - * zend_compile.c - zend_execute.c - zend_object_handlers.c: - - Allow overloaded objects to receive the method name in its original - - case. - -2002-06-05 Derick Rethans - - * zend_llist.c: - Fix memleak (patch by Stefan Sesser) - -2002-06-04 Derick Rethans - - * zend_ini_scanner.l: - Fix for bug #17462 (Patch by Edin Kadribasic) - -2002-05-31 Andi Gutmans - - * ZendTS.dsp: - Add zend_objects_API.* to dsp - - * zend_objects_API.c: - Fix build (one more coming up) - - * zend_objects.c: - Fix build - -2002-05-31 Sebastian Bergmann - - * Zend.dsp: Add zend_objects_API.c to project. - -2002-05-31 Stanislav Malyshev - - * Makefile.am - zend_execute_API.c - zend_globals.h - zend_object_handlers.c - zend_objects.c - zend_objects.h - zend_objects_API.c - zend_objects_API.h: Generalize object storage and reference bookkeeping - -2002-05-30 Venkat Raghavan S - - * zend.h - zend_config.nw.h - acconfig.h: NetWare changes - -2002-05-26 Andi Gutmans - - * zend_multibyte.c: - - Add empty zend_multibyte.c to allow build with 4.3.0-dev. - -2002-05-24 Sebastian Bergmann - - * ZEND_CHANGES: Fugbix typo. - -2002-05-24 Andi Gutmans - - * ZEND_CHANGES: - Add a bit of information. - -2002-05-20 Zeev Suraski - - * zend_API.h - zend_execute.h - zend_list.h: MFZE1 (Expose more C++ APIs) - -2002-05-14 Andi Gutmans - - * zend_objects.c - zend_objects.h: - constructor_called is supposed to be destructor_called - -2002-05-13 Sterling Hughes - - * zend_qsort.c: MFZE1 - -2002-05-13 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-05-12 Zeev Suraski - - * zend_highlight.c: MFZE1 - -2002-05-12 Sebastian Bergmann - - * ZEND_CHANGES: Rephrase. - - * ZEND_CHANGES: Beautify. - - * ZEND_CHANGES: Start documenting the debug backtracing. - - * ZEND_CHANGES: Whitespace fixes. - -2002-05-11 Zeev Suraski - - * zend_highlight.c - zend_highlight.h: MFZE1 - -2002-05-10 Andi Gutmans - - * zend_builtin_functions.c: - Nuke C++ comment - - * zend_builtin_functions.c: - - Make debug_backtrace() return an array. Still not finished because I - might want to differentiate between method calls and static methods. - - Example: - $bt = debug_backtrace(); - foreach ($bt as $frame) { - if (isset($frame['class'])) { - print $frame['class']; - print "::"; - } - print $frame['function']; - print " ["; - print $frame['file']; - print ":"; - print $frame['line']; - print "]\n"; - } - -2002-05-08 Andi Gutmans - - * zend_execute.c - zend_builtin_functions.c: - - Hopefully fix problems with debug_backtrace() - -2002-05-08 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-05-07 Andi Gutmans - - * zend.c - zend_builtin_functions.c - zend_compile.h - zend_execute.c: - - More debug backtrace work. It still doesn't work very well... - -2002-05-02 Andi Gutmans - - * zend.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: Initial support for built-in backtracing. - There are still a few problems such as includes and calling other functions - from internal functions which aren't seen (will have to think if and how to - fix this). - Also the main scripts filename isn't available. Need to think about that. - -2002-04-30 Stanislav Malyshev - - * zend_API.h - zend_builtin_functions.c - zend_object_handlers.c - zend_object_handlers.h - zend_operators.h - zend_API.c: Make OBJCE return zend_class_entry*, also some cleanups - -2002-04-28 Sebastian Bergmann - - * zend_alloc.c - zend_alloc.h: Revert. - -2002-04-27 Sebastian Bergmann - - * zend_alloc.c - zend_alloc.h: - MFZE1: If the size-operands of memset are constants, the compiler can turn them into fast inline code. So, instead of using ecalloc, we use emalloc + memset in macro form now. emalloc will not return NULL, so the chosen macro form is safe. This is not true for malloc(3). An inline function accomodates our needs here. Suggested by: http://www.mail-archive.com/dev%40httpd.apache.org/msg02492.html (Sascha) - -2002-04-25 Harald Radi - - * zend_config.w32.h: unbreak the win32 build - -2002-04-24 Harald Radi - - * zend_API.c: MFZE1 saschas 'Avoid exceeding buffer limits' patch - -2002-04-23 Harald Radi - - * zend_hash.c - zend_hash.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ts_hash.c - zend_ts_hash.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_API.c - zend_API.h - zend.h: some type cleanup work - -2002-04-22 Harald Radi - - * zend_object_handlers.c - zend_object_handlers.h - zend_objects.h - zend_operators.h - zend_API.c - zend_API.h - zend_builtin_functions.c: added get_class_entry callback handler to the - object handlers structure - -2002-04-22 Sebastian Bergmann - - * Zend.m4: MFZE1: Change default value of inline-opt to yes (Sascha). - -2002-04-22 Harald Radi - - * zend_config.w32.h - acconfig.h - flex.skl: fixed linkage warning under win32 - -2002-04-20 Zeev Suraski - - * zend_execute_API.c: MFZE1 - -2002-04-19 Sebastian Bergmann - - * zend_list.c - zend_hash.c - zend_hash.h: - MFZE1: make sure the resource-list is always consistent during shutdown (Thies). - - * zend_hash.c: MFZE1: Fix imbalance bug (Zeev). - -2002-04-10 Jani Taskinen - - * zend_language_scanner.l - zend_language_parser.y: MFZE1 - -2002-04-07 Stanislav Malyshev - - * zend.h: make compatible with current PHP - - * zend_compile.c: sync - -2002-03-29 Derick Rethans - - * zend_compile.c: - revert patch - -2002-03-25 Derick Rethans - - * zend_compile.c: - MFZE1 - -2002-03-23 Andi Gutmans - - * zend_ts_hash.c - zend_ts_hash.h: - - Fix build without ZTS. If someone has a nicer fix let me know. - -2002-03-21 Andi Gutmans - - * zend_language_parser.y: - - No idea how this slipped in. Fix delete $obj statement. - -2002-03-20 Harald Radi - - * ZendTS.dsp - zend.h - zend_ts_hash.c - zend_ts_hash.h: added thread safe hashtable which allows concurrent - reads but only exclusive writes - -2002-03-19 Andi Gutmans - - * zend_language_parser.y - zend.h: - - Finish covering all parsed methods to check for validity in parser. - - Change zval's refcount to zend_uint (If it doesn't slow down the Engine - - too much it should probably stay this way). If anyone has time to test - - the difference in speed between zend_ushort & zend_uint in zend.h of - - the struct _zval_struct (one line change) I'd be glad to get some - - figures. - -2002-03-18 Andi Gutmans - - * zend_compile.c - zend_language_parser.y: - - More fixes to check for member/function call legality. - -2002-03-17 Andi Gutmans - - * zend_language_parser.y - zend_compile.c: - - Start putting error handling where method calls are being used in a - - context where only writable variables should be used. - -2002-03-15 Andi Gutmans - - * zend_execute.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_variables.c: - Pass TSRMLS to callbacks. - - * zend_execute.c: - - Scope fix. When calling an imported function the scope will change - - correctly to the scope of the functions class. - - - * zend_opcode.c - zend_execute.c - zend_compile.h - zend_compile.c: - - Fix issues with $this when using it by itself without indirection such as - - $this->foo. - -2002-03-14 Stanislav Malyshev - - * OBJECTS2_HOWTO: more cleanup - - * OBJECTS2_HOWTO: Update howto - - * zend_execute.c: fix for delete $this and unset $this - - * zend_execute_API.c: Fix call_user_function - -2002-03-12 Andi Gutmans - - * zend.h: - Forgot to close comment. - - * zend.h: - Macro for duality between Engine 1 and 2 - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_opcode.c - zend_operators.c: - Another couple of indirection fixes. - - Make class_entry->refcount be part of the structure and not allocated. - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: - Fix bug introduced with latest class hash table change. - -2002-03-12 Stanislav Malyshev - - * zend_API.c: Fix standard object creation - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend.c - zend.h: - make class tables contain class_entry *, not class_entry - - fix isset($this) - -2002-03-10 Andi Gutmans - - * zend_execute.c: - Fix build in ZTS mode. - -2002-03-10 Stanislav Malyshev - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_object_handlers.c - zend_object_handlers.h: New stuff for objects API: - - Better assignment handling - - More flexible operations with zval-containing objects - -2002-03-09 Andi Gutmans - - * tests/zend2.php: - - Add the original example script to the CVS so that it's always available. - -2002-03-08 Sebastian Bergmann - - * ZEND_CHANGES: Add 'import const' example. - -2002-03-08 Andi Gutmans - - * zend_execute.c: - Support importing constants. e.g.: - - - * ZEND_CHANGES: - Add another 'import' example and merge 'import' section into 'Namespaces' section. - -2002-03-06 Andi Gutmans - - * zend_execute.c: - - Add function * and class * functionality. Only constants are left. - - - * ZEND_CHANGES: Consistency. - - * ZEND_CHANGES: Add 'import statement' section. - -2002-03-02 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Initial patch to support importing from class scopes (for Stig). - - It isn't complete yet but I want to work on it from another machine. It - - shouldn't break anything else so just don't try and use it. - - The following is a teaser of something that already works: - - -2002-03-02 Derick Rethans - - * zend_builtin_functions.c: - MFZE1 - -2002-03-01 Andrei Zmievski - - * zend_API.c: MFZE1 - -2002-03-01 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Remove use of C++ reserved words namespace/this - - * zend_opcode.c - zend_language_parser.y - zend_compile.h - zend_compile.c - zend_API.c: - Fix bug in nested try/catch's - - Infrastructure for implementing imports of methods. - - * zend_objects.c: - - Fix crash reported by Sebastian when destructor function causes a fatal - - error. I hope this does it and we don't find any other problems. - -2002-02-26 Andi Gutmans - - * zend_alloc.h - zend_alloc.c - zend.c: - MFZE1 - -2002-02-21 Sebastian Bergmann - - * ZEND_CHANGES: - Maintain ZEND_CHANGES to account for the addition of private member variables. - -2002-02-21 Andi Gutmans - - * zend_object_handlers.c - zend_opcode.c - zend_language_parser.y - zend_language_scanner.l - zend_compile.c - zend.c - zend.h - zend_API.c: - Experimental support for private members. - Hello; - } - } - - class MyClass2 extends MyClass { - function printHello() - { - MyClass::printHello(); /* Should print */ - print $this->Hello; /* Shouldn't print out anything */ - } - } - - $obj = new MyClass(); - print $obj->Hello; /* Shouldn't print out anything */ - $obj->printHello(); /* Should print */ - - $obj = new MyClass2(); - print $obj->Hello; /* Shouldn't print out anything */ - $obj->printHello(); - ?> - -2002-02-14 Stanislav Malyshev - - * zend.h - zend_API.c: Pass TSRM to create_object - -2002-02-14 Andrei Zmievski - - * zend_compile.c: - Fix the bug where the declared properties without init values were not - entered into the table. - -2002-02-13 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - * zend_compile.h: - Export lex_scan(). Both the PHPDoc and tokenizer extension need this. I hope this is okay with Z&A. - -2002-02-08 Andi Gutmans - - * zend_objects.c: - Remove object debug messages. - -2002-02-07 Stanislav Malyshev - - * Makefile.am - OBJECTS2_HOWTO - ZendTS.dsp - configure.in - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_object_handlers.c - zend_object_handlers.h - zend_objects.c - zend_objects.h - zend_operators.c - zend_operators.h - zend_variables.c: Mega-commit: Enter the new object model - Note: only standard Zend objects are working now. This is definitely going to - break custom objects like COM, Java, etc. - this will be fixed later. - Also, this may break other things that access objects' internals directly. - -2002-02-04 Andi Gutmans - - * zend_execute.c: - - This small patch should also take care of allowing unseting of $this->foo - - and static members. The unset() opcode was luckily already suitable for - - object overloading. - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_objects.c: - - Fix problem with the objects_destructor called during shutdown. It was - - freeing objects from id 0 instead of id 1. id 0 is not used. - - Change isset/empty opcodes to support static members and the new way of - - doing $this->foobar. Also the opcodes operate now on the hash table - - combined with the variable names so that they can be overloaded by the - - soon to be added overloading patch. - -2002-02-03 Adam Dickmeiss - - * Makefile.am - configure.in: - Zend config sets ZEND_EXTRA_LIBS. Bugs 14452, 14602, 14616, 14824 - -2002-02-02 Sebastian Bergmann - - * zend_builtin_functions.c: Revert per Andi's request. Sorry :-( - - * zend_builtin_functions.c: Fix warning. Again :-) - -2002-02-02 Andi Gutmans - - * zend_builtin_functions.c: - - Please don't use strcmp() and friends in Zend but only the mem* - - functions. I didn't check this patch so please check that it works. - -2002-02-02 Sebastian Bergmann - - * zend_builtin_functions.c: Fix a warning. - -2002-02-02 Andi Gutmans - - * zend_modules.h: - Nice catch by Derick. GINIT is dead. - -2002-02-01 Sebastian Bergmann - - * zend_builtin_functions.c: MFZE1: is_a() - -2002-01-27 Sebastian Bergmann - - * zend_config.w32.h: - MFZE1: define a couple of macros under win32. (Patch By: Jon Parise ) - -2002-01-25 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_objects.c - zend_objects.h - zend_opcode.c: - - First destructor hell fix. There was a situation where an object's - - destructor could be run after its class was already dead. Right now - - object destructors is the first thing whic happens during shutdown in - - order to prevent this problem. It's very likely that destructors will - - cause more grief and we'll have to outline exactly when you should use - - them and what kind of logic you're allowed to do inside of them. - - This bug was reported by sebastian. - -2002-01-22 Andi Gutmans - - * zend_execute.c: - - Fix a bug reported by Sebastian with indirect class names not working. - -2002-01-20 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_opcode.c: - Improve performance of functions that use $GLOBALS[] - - Please check this and make sure it doesn't break anything. - -2002-01-19 Thies C. Arntzen - - * zend_language_parser.y: MFZE1 - -2002-01-14 Andi Gutmans - - * zend_execute_API.c: - - Fix crash bug in call_user_function_ex(). Thanks to Sebastian for the - - very nice and short reproducing script. - - -2002-01-14 Sebastian Bergmann - - * ZEND_CHANGES: Update Exceptions example. - -2002-01-13 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y: - - Change exception handling to use the Java-like catch(MyException $exception) - - semantics. Example: - exception = $exception; - } - - function Display() - { - print "MyException: $this->exception\n"; - } - - } - class MyExceptionFoo extends MyException { - function __construct($exception) - { - $this->exception = $exception; - } - function Display() - { - print "MyException: $this->exception\n"; - } - } - - try { - throw new MyExceptionFoo("Hello"); - } catch (MyException $exception) { - $exception->Display(); - } - ?> - - * zend_ini_scanner.l: - MFZE1 - -2002-01-06 Andi Gutmans - - * zend.c: - - Output error when there's an uncaught exception (by Timm Friebe) - - * zend_execute.c: - Make sure $this is passed on to methods - -2002-01-06 Sebastian Bergmann - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c: Happy New Year. - -2002-01-05 Andi Gutmans - - * zend_compile.c: - Small fix - - * zend_compile.c - zend_compile.h - zend_execute.c: - Allow passing of $this as function arguments. - - Fix a bug which I introduced a couple of months ago - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Significantly improve the performance of method calls and $this->member - - lookups. - -2002-01-04 Andi Gutmans - - * zend_execute.c: - - Improve performance of indirect-referenced function calls - - * zend_compile.c: - Nuke C++ comments - - * zend_compile.c - zend_compile.h - zend_execute.c: - Separate other kinds of function calls too. - - Significantly improve performance of function calls by moving lowercasing - - the function name to compile-time when possible. - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Start splitting up different kinds of function calls into different - - opcodes. - -2002-01-03 Derick Rethans - - * zend_API.c - zend_API.h - zend_execute.c - zend_list.c: - - MFZE1 for exit fix, exposing current function name in error messages and - exposing zend_zval_type_name(). - -2001-12-31 Sebastian Bergmann - - * ZEND_CHANGES: Consistency. - -2001-12-31 Andi Gutmans - - * ZEND_CHANGES: - - Add example of default argument for argument passed by-ref - -2001-12-30 Sebastian Bergmann - - * ZEND_CHANGES: Typo. - -2001-12-29 Andi Gutmans - - * zend.h: - - #define to help #ifdef stuff in PHP sources to make them work w/ ZE1 and - - 2 - - * ZEND_CHANGES: - A few clarifications - -2001-12-29 Sebastian Bergmann - - * ZEND_CHANGES: Integrate Andi's examples and some notes by Stig. - - * ZEND_CHANGES: Update Exceptions example. - -2001-12-28 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Fix some case insensitivity stuff in respect to classes - - * zend_execute.c - zend_language_parser.y: - - Support default arguments for reference parameters - - Fix two compile warnings - - * zend_compile.c: - - Wasn't adding the lower case version of the class name to the hash - -2001-12-27 Andi Gutmans - - * zend_compile.c - zend_objects.c: - - Use two underscores for __construct(), __clone and friends... - - * zend_objects.c: - - Only check refcount of object if the destructor was called. - - * zend.c - zend.h - zend_API.h - zend_compile.c - zend_objects.c - zend_objects.h: - - Experimental support for destructors. We need to see if destructors - - will actually work well in the context of PHP so we should consider this - - as experimental. Possible problems might be that when the constructor is - - run PHP might not be in a stable state. - - * zend_compile.c - zend_compile.h - zend_execute.c: - Support parent:: again - - * zend_compile.c: - Support unified constructor name _construct() - -2001-12-26 Andi Gutmans - - * zend_execute.c - zend_execute_API.c: - Fix scoping issue. The following works now: - id = self::$id++; - } - - function _clone() - { - $this->name = $clone->name; - $this->address = "New York"; - $this->id = self::$id++; - } - } - - - - $obj = new MyClass(); - - $obj->name = "Hello"; - $obj->address = "Tel-Aviv"; - - print $obj->id; - print "\n"; - - $obj = $obj->_clone(); - - print $obj->id; - print "\n"; - print $obj->name; - print "\n"; - print $obj->address; - print "\n"; - - * zend.c: - Print out object id for easier debugging - - * zend.c - zend.h - zend_API.h - zend_compile.c - zend_objects.c: - Pretty much finish _clone() support - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - Initial support for _clone() - - * zend_compile.c - zend_language_parser.y: - - Start fixing the parsing rules so that function and method calls - - can't be used in a write context. - - * zend.c: - Fix crash correctly. - -2001-12-25 Andi Gutmans - - * zend_language_parser.y: - Revert delete syntax patch - - * zend.c - zend_execute.c: - Fix a crash (not a thorough fix). - - Commented old code - -2001-12-24 Andi Gutmans - - * zend_execute.c: - - Fixed bug where global functions weren't called if they didn't exist - - in the class scope - -2001-12-23 Andi Gutmans - - * zend.c: - - Fix a bug where function's didn't work anymore in multi-threaded - - servers after the latest startup changes. - -2001-12-22 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_language_parser.y: - - Add initial capability of defining nested classes as class foo::bar - -2001-12-18 Zeev Suraski - - * zend_language_scanner.h - zend_language_scanner.l: MFZE1 - -2001-12-16 Sebastian Bergmann - - * ZEND_CHANGES: I'm too trigger-happy. - - * ZEND_CHANGES: delete is now function - -2001-12-16 Andi Gutmans - - * zend_language_parser.y: - - Seems like most people prefer delete($obj) over delete $obj. - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Start adding parsed variable checks. - - * zend_compile.h - zend_language_parser.y: - - Framework for knowing what kind of variable we just parsed. - - This will be used in compile-time error checking which couldn't be done - - at the level of the grammar. - -2001-12-13 Andi Gutmans - - * zend_language_parser.y: - - Rearrange grammar to allow dereferencing of objects returned from - - functions. It still crashes though. - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Fix crash bug in startup code. - - Start work on being able to reference global and local scope - -2001-12-12 Andi Gutmans - - * Zend.dsp - zend.c - zend_constants.c - zend_globals.h: - - Infrastructure changes for allowing to access the global scope from - - within a class scope. - - Fix the Zend.dsp project a bit. It seems someone pretty much killed it - - when commiting their own personal configuration. Please be careful in - - future. - - * zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y: - - Make classes have scope and function/constant lookups default to the class - -2001-12-11 Andi Gutmans - - * zend.c: - Merge from ZE1 - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c: - - Rename zend_class_entry.constants -> zend_class_entry.constants_table - - * zend_execute.c: - - Start making scope change correctly when calling namespace functions. - - When inside a namespace fallback to global namespace when function - - or constant is not found. - -2001-12-11 Sebastian Bergmann - - * LICENSE: Forgot to update the LICENSE. - - * LICENSE - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_qsort.c - zend_qsort.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h: Update headers. - - * Zend.m4 - zend.h: MFZE1 (AIX fixes) - - * zend_highlight.h - zend_highlight.c: MFZE1 (added zend_strip mode in the highliter) - -2001-12-10 Andi Gutmans - - * zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - More namespaces work. - - Nuke memory leak. - -2001-12-08 Andi Gutmans - - * zend.c: - Fix crash with unhandled exceptions - -2001-12-06 Andi Gutmans - - * zend_execute.c: - Support constants. The following works now: - - - * zend_language_parser.y - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Initial work on changing namespace scope. Only methods & variables - - right now. - - - * zend.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y: - - Nuke the namespace work I did. It'll be redone differently. - -2001-12-05 Sebastian Bergmann - - * ZEND_CHANGES: Document recent changes. - -2001-12-04 Andi Gutmans - - * zend_builtin_functions.c: - Damn Zeev :) - -2001-12-01 Andi Gutmans - - * zend_API.c: - - Revert one of the changes because it might be before the memory - - manager has started. - - * zend_API.c - zend_constants.c: - Use alloca() when possible. - -2001-11-30 Andi Gutmans - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_language_parser.y - zend_opcode.c: - - Initial support for class constants. There are still a few semantic - - issues which need to be looked into but basically it seems to work. - - Example: - - - * Zend.m4: - Fix typo - -2001-11-27 Andi Gutmans - - * zend_language_parser.y: - - Support syntax for class constants (doesn't do anything yet but - - required some reworking of the grammar). - -2001-11-26 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - - Support static $var = 0; style initialization of static class - - members. For example: - - class foo { - - static $my_static = 5; - - - - } - - - - print foo::$my_static; - -2001-11-25 Andi Gutmans - - * zend.c - zend_compile.c: - Fix crash and leak - - * zend_compile.c: - Whitespace - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y - zend_opcode.c: - Support static members. The following script works: - - -2001-11-24 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: - MFZE1 - -2001-11-15 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-11-05 stig - - * zend_objects.h: add newline at end of file to avoid warnings - - * zend_language_parser.y: non-zts compile fix - -2001-11-04 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_language_parser.y: - - Support instantiation of nested class. The following script now should - - work: - -bar(); - - - - $obj = new foo::barbara(); - - $obj->bar(); - - - -2001-11-03 Andi Gutmans - - * zend.h: - RISC OS patch by Alex Waugh - - * zend.c - zend_API.h - zend_compile.c: - Add some initializations - - * zend_compile.c - zend_execute.c - zend.h: - - Add constructor to the zend_class_entry instead of looking it up each - - time by name. - - This will allow the next patch of being able to instantiate nested - - classes such as new foo::bar::barbara(); - -2001-10-29 Andi Gutmans - - * zend_API.c - zend_opcode.c: - Fix internal classes - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_globals.h - zend_language_parser.y - zend_opcode.c: - Initial support for nested class definitions - -2001-10-27 Zeev Suraski - - * zend_execute.c: MFTGZE1 - -2001-10-26 Andi Gutmans - - * zend_execute_API.c: - Fix Zeev's MFZE1 - -2001-10-23 Zeev Suraski - - * zend_constants.c - zend_execute_API.c - zend_globals.h: MFZE1 - -2001-10-20 Andrei Zmievski - - * zend_API.c: MFHZ1 - -2001-10-12 Sebastian Bergmann - - * zend_API.c - zend_API.h - zend_modules.h: MFZE1: Introduced extension version numbers (Stig) - -2001-10-04 Sebastian Bergmann - - * zend_hash.c: MFZE1 - -2001-09-30 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - - Merge the NAMESPACES_BRANCH. It wasn't a good idea to have a branch when - - the whole CVS tree is work in progress - - * zend_compile.h - zend_execute.c: - - At last I've had some time to move all execute() locals into one struct. - - No immediate gain but it makes it more clear what variables are temps - - and which ones are execute() locals. - -2001-09-27 Andi Gutmans - - * zend_modules.h: - Bump it up in the right place - - * zend_modules.h: - Increase API number - -2001-09-26 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_execute.c: - Good catch by Sterling - -2001-09-24 Andi Gutmans - - * zend_execute.c - zend_execute_API.c - zend_globals.h: - More namespaces work - -2001-09-22 Sebastian Bergmann - - * ZEND_CHANGES: Keep ZEND_CHANGES up-to-date. - -2001-09-22 Zeev Suraski - - * zend_globals.h - flex.skl - zend.c - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-09-20 Andi Gutmans - - * zend.c - zend_compile.c: - Fix build on Win32 - - * zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l - zend.c: - - Create a branch for namespaces. This isn't even remotely close to - - working. - - * zend_list.h: - Nuke unused enum - -2001-09-19 Zeev Suraski - - * flex.skl - zend.c - zend_globals.h - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-09-19 Andi Gutmans - - * Makefile.am: - MFZE1 - -2001-09-19 Sebastian Bergmann - - * Makefile.am - zend_hash.c - zend_hash.h - zend_ini.c - zend_llist.c - zend_llist.h - zend_qsort.c - zend_qsort.h - Zend.dsp - ZendTS.dsp: MFZE1 - -2001-09-17 Brian L. Moon - - * RFCs/003.txt: adding RFC for loose type requirements for functions - -2001-09-16 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-09-10 Zeev Suraski - - * zend_compile.h - zend_globals.h - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: MFZE1 (nuke cplusplus code) - - * zend.c - zend_execute_API.c - zend_globals.h: MFZE1 (support return value in execute_scripts) - -2001-09-08 stig - - * RFCs/002.txt: remove bogus comment :) - - * RFCs/002.txt: RFC document for namespaces - - * RFCs/001.txt: wrapped to 80 columns :) - -2001-09-07 Andi Gutmans - - * zend_compile.c - zend_language_parser.y: - - Shift around the variable parsing code to make it simpler. - - * zend_llist.c: - - Fix warning (was fixed in ZE1 and not merged at some point). Please make - sure you merge patches! - -2001-09-05 Stanislav Malyshev - - * zend_operators.c: MFZE1 - -2001-09-03 Andi Gutmans - - * zend_language_parser.y: - CLS_CC -> TSRMLS_CC - -2001-08-31 Sterling Hughes - - * zend_llist.h: spaces->tabs - - * zend_llist.c - zend_llist.h - zend_execute_locks.h: MFZE1 - -2001-08-31 Zeev Suraski - - * zend.c - zend_compile.h: MFZE1 - -2001-08-30 Andi Gutmans - - * zend_compile.h - zend_compile.c: - Make it compile in thread-safe mode. - - * zend_compile.c - zend_compile.h - zend_execute.c: - Get rid of warning and C++ comments - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Initial support for exceptions. - -2001-08-30 Zeev Suraski - - * zend_execute.c: MFZE1 - -2001-08-28 Zeev Suraski - - * zend_language_scanner.l: MFZE1 - -2001-08-27 Andi Gutmans - - * RFCs/001.txt: - Add sample RFC - -2001-08-26 Stanislav Malyshev - - * Zend.m4 - zend.h: Add dlsym underscore detection, by Jani Taskinen - -2001-08-26 Andi Gutmans - - * zend_operators.c: - MFZE1 - - * zend_API.c: - - Merge Andrei's fix from Engine 1. Please commit patches to both trees! - -2001-08-21 Zeev Suraski - - * zend.c - zend_execute_API.c: MFZE1 - -2001-08-20 Zeev Suraski - - * zend_hash.c - zend_hash.h: MFZE1 - -2001-08-19 Andi Gutmans - - * zend.h: - Fix compile problem - -2001-08-19 Zeev Suraski - - * zend_compile.c: MFZE1 - -2001-08-18 Andi Gutmans - - * zend_execute.c - zend_llist.c - zend_llist.h: - Merge Sterling's patches from ZE1 - -2001-08-17 Andrei Zmievski - - * zend_execute.c: MFZE1 - -2001-08-17 Zeev Suraski - - * zend_alloc.c: MFZE1 - -2001-08-16 Zeev Suraski - - * flex.skl - zend_ini_scanner.l - zend_language_scanner.l: MFZE1 - -2001-08-16 Andi Gutmans - - * zend_execute.c: - Try and nuke get_object_zval_ptr() - - * zend_objects.c: - Remove bogus notice - - * zend_variables.c: - Sync with ZE1 - - * zend.h - zend_execute.c - zend_objects.c - zend_objects.h - zend_operators.c - zend_operators.h - zend_variables.c: - Fix a bug in method calls. - - Try to get the old copying behavior of objects to work (doesn't work yet). - -2001-08-15 Zeev Suraski - - * zend_extensions.c: MFZE1 - -2001-08-14 Zeev Suraski - - * zend_constants.c - zend_constants.h - zend_variables.c - zend_variables.h: MFZE1 - -2001-08-13 Andi Gutmans - - * zend_execute.c: - MFZE1 - - * zend_execute.c: - Merge from Engine 1 - -2001-08-13 Zeev Suraski - - * zend_API.c - zend_operators.c - zend_operators.h: MFZE1 - -2001-08-12 Stanislav Malyshev - - * zend_API.h: _FUNCTION is used in definition, so use _D - -2001-08-11 Andi Gutmans - - * zend_API.c - zend_API.h - zend_objects.c - zend_operators.c: - More work on making objects work - - * zend_API.c - zend_objects.c - zend_objects.h - zend_operators.c: - - Fix some places which create objects. The fixes are ugly and will be - revised when things start working well - -2001-08-11 Zeev Suraski - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_ini.h - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_operators.c: Whitespace - -2001-08-11 Andi Gutmans - - * Makefile.am - zend_objects.c: - Fix UNIX build. - - * zend_compile.c: - - Need to do some rewriting in the parser instead of this. - - * zend.h: - - For Sebastian. Will allow to see you're using the Engine 2 CVS via - phpinfo() - -2001-08-10 Andi Gutmans - - * zend_API.h: - Merge from Engine 1 - - * zend_compile.c: - A couple of fixes - - * zend_API.h: - Merge from Engine 1 CVS - -2001-08-09 Andi Gutmans - - * zend.c: - Merge from Engine 1 tree - -2001-08-08 Andi Gutmans - - * zend.c - zend_compile.c - zend_compile.h - zend_globals.h: - Merge new $_GET, $_POST etc. patch from Engine 1 tree - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Preliminary patch for method() dereferencing - - * zend.c - zend.h: - Merge zend_try fix from Engine 1 - -2001-08-07 Zeev Suraski - - * ZendTS.dsp: Migrate .dsp patches - -2001-08-07 Andi Gutmans - - * ZendTS.dsp: - Forgot to commit the updated dsp - - * ZendTS.dsp: - More sync with latest CVS - - * zend_objects.c - zend_objects.h - zend_operators.h - zend_variables.c - ZendTS.dsp - zend.h - zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_language_parser.y - zend_language_scanner.l: - Sync Engine2 CVS with latest Engine CVS - -2001-08-06 Zeev Suraski - - * zend_indent.c: Commit uncommitted build fix - - * zend_compile.c - zend_globals.h - zend_language_scanner.l: - Fix an off by one lineno issue, in case of an implicit ; - - * flex.skl - zend_highlight.c: Better shared code - - * Makefile.am - Zend.dsp - Zend.m4 - ZendTS.dsp - flex.skl - zend.c - zend_globals.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: - Merge from branch - move to standard C scanners in thread safe mode - - * Makefile.am - Zend.m4 - flex.skl - zend_ini_scanner.l - zend_language_scanner.l: Make the C++less scanner compile under UNIX - -2001-08-06 Andi Gutmans - - * zend_execute.c: - Move to using Z_ macros - - * zend_API.h: - Use Z_ macros - -2001-08-05 Zeev Suraski - - * zend_globals_macros.h: More nulled-out macros - - * zend.c - zend_API.c - zend_API.h: TSRMLS_FETCH work - -2001-08-04 stig - - * .cvsignore: added some more stuff to .cvsignore - -2001-08-03 Zeev Suraski - - * zend_alloc.c: Fix buglet - - * zend_alloc.c: Fix macro - - * zend.c - zend_alloc.c - zend_globals.h: - Implement fast memory allocation and reduced fragmentation under Windows. - - * zend_globals_macros.h: Some compat macros - -2001-08-02 Zeev Suraski - - * zend_execute.c: - require_once()/include_once will return true in case a file was not included - because it was already included earlier. - Changed the default return value type of the include() family from long to - boolean - - * zend_constants.c - zend_execute_API.c - zend_hash.c - zend_hash.h: - Avoid going over huge lists of functions, classes and constants. - Special thanks to the guys from the MS lab for the profiling tools :) - - * zend.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h: Some cleanup - - * zend_builtin_functions.c - zend_hash.c - zend_hash.h: TSRMLS fixes - - * zend_ini_parser.y: non ZTS build fix - - * Zend.dsp - ZendTS.dsp - flex.skl - zend.c - zend_globals.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_scanner.h - zend_language_scanner.l: - Implement a standard C thread safe scanner within flex - -2001-08-01 Zeev Suraski - - * flex.skl - zend_language_scanner.l: - Implement fast scanning in the multithreaded environment - -2001-07-31 Zeev Suraski - - * zend_language_scanner.l: the make Sebastian happy part of the day :) - - * zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: More TSRMLS_FETCH work - - * zend_list.c - zend_list.h: More TSRMLS_FETCH annihilation - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_hash.c - zend_hash.h - zend_ini.c - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c: More TSRMLS_FETCH work - -2001-07-30 Zeev Suraski - - * zend_language_scanner.l: Compile fix - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_highlight.c - zend_highlight.h - zend_ini.c - zend_ini.h - zend_ini_parser.y - zend_language_scanner.l - zend_modules.h: More TSRMLS_FETCH work - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_modules.h: - More TSRMLS_FETCH work, and get rid of redundant ParametersPassedByRef - -2001-07-30 Andrei Zmievski - - * zend_API.c - zend_API.h: - Let's be consisten and keep TSRMLS_DC declaration after num_args. - -2001-07-30 Zeev Suraski - - * zend_API.c - zend_API.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_operators.c - zend_operators.h - zend_variables.c: More TSRMLS_FETCH annihilation - - * zend_API.c - zend_API.h: Get rid of more TSRMLS_FETCH's - - * zend.c - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_opcode.c: Avoid TSRMLS_FETCH()'s (still lots of work left) - -2001-07-29 Andi Gutmans - - * zend_execute.h: - More object junk - - * zend.c: - Object macros... - -2001-07-28 Andi Gutmans - - * zend_operators.c: - Fix build - - * zend_operators.c: - More object macros. - - * zend_builtin_functions.c: - Use the Z_OBJ* macros for accessing objects - - * zend.h - zend_operators.h: - - Small patch to allow fixing the PHP tree to be compatible w/ the initial - - Zend 2 objects patch. Hopefully I can commit that this week. - -2001-07-28 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend.c - zend.h - zend_API.c - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_fast_cache.h - zend_globals_macros.h - zend_highlight.c - zend_indent.c - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_opcode.c: Redesigned thread safety mechanism - nua nua - -2001-07-28 sascha - - * zend.h: Fix build - -2001-07-27 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_execute_locks.h - zend_globals_macros.h - zend_ini.c - zend_ini.h - zend_language_parser.y - zend_language_scanner.l - zend_list.c - zend_list.h - zend_modules.h - zend_operators.c - zend_variables.c - zend.c: Get rid of ELS_*(), and use TSRMLS_*() instead. - This patch is *bound* to break some files, as I must have had typos somewhere. - If you use any uncommon extension, please try to build it... - -2001-07-23 sascha - - * zend_alloc.c: tsrm_error is only available, if TSRM_DEBUG is defined. - -2001-07-21 Zeev Suraski - - * zend.c - zend.h: Always track bailout file/lineno - - * zend.c: Fix Release builds - - * zend.c - zend.h - zend_execute_API.c - zend_globals.h - zend_list.c: - Improve bailout mechanism, supports nesting of bailouts a-la try..catch - - * zend_hash.c: Fix compile warning - -2001-07-21 Andrei Zmievski - - * zend_compile.c: - Fix certain cases where inheritance of base class's overloaded handlers wasn't - being done. - -2001-07-20 Zeev Suraski - - * zend.c - zend_execute_API.c - zend_list.c: - Implement a more granular shutdown mechanism for the executor - - prevent corruption of constants and missing destructions of resources - -2001-07-19 Zeev Suraski - - * zend_compile.c: Unfix, it has too strong effects - - * zend_compile.c: Catch all cases - - * zend_compile.c: Fix bug #11970, strike 2 - - * zend_execute.c: Revert bogus patch - -2001-07-18 Stanislav Malyshev - - * zend_operators.c: fix double->long conversion - -2001-07-17 Andi Gutmans - - * zend_hash.c: - Remove unused code - -2001-07-16 Zeev Suraski - - * zend_API.h - zend_compile.c - zend_globals.h - zend_variables.c: - Fix bug #10287 - avoid crashing under a bogus usage of list() - - * zend.h - zend_compile.c - zend_execute_API.c: Fix bug #10467 - -2001-07-15 Zeev Suraski - - * zend_hash.h: Minor cleaning - - * zend_language_parser.y: Optimize the parser a bit - - * zend_language_scanner.h - zend_language_scanner.l: Fix an inline - - * zend_variables.c - zend_variables.h: - Time to bid this old timer goodbye - get rid of var_uninit() - - * zend_hash.c: Fix bug #6239 - - * zend_language_parser.y: - Allow indirect reference to method names in class::method() construct - - * zend_execute_API.c: Fix bug #10257 - - * zend_execute.c: Fix bug #11970 - - * zend_compile.c: Fix bug #9884 - - * zend.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_language_scanner.l - zend_opcode.c: - Improved interactive mode - it is now available in all builds, without any significant slowdown - - * zend.c: Early initialization - -2001-07-13 Zeev Suraski - - * zend_hash.c: layout - -2001-07-13 Thies C. Arntzen - - * zend_hash.c - zend_hash.h - zend_list.c: - the resource-lists are now destroyed backwards. this will make sure that - resources get destroyed in the opposite order they were created and thereby - db-cursors will always be released before their corresponding connection etc. - this sould not break anything! - -2001-07-11 Zeev Suraski - - * zend_API.c - zend_ptr_stack.c - zend_ptr_stack.h: Remove the last couple of bogus inlines - -2001-07-11 Andi Gutmans - - * zend_hash.c - zend_hash.h: - Move inline_zend_hash_func() to header file - -2001-07-11 Thies C. Arntzen - - * zend_API.h: fixed ZVAL_FALSE and ZVAL_TRUE - -2001-07-11 Stanislav Malyshev - - * zend_hash.h: No hashpjw anymore, but we have zend_hash_func - -2001-07-11 Zeev Suraski - - * zend_operators.c - zend_variables.h: Get rid of ZVAL_RESET... - - * zend_API.c - zend_operators.c - zend_variables.c - zend_variables.h: Get rid of some inlines - -2001-07-10 Andi Gutmans - - * zend_extensions.h - zend_hash.c - zend_hash.h: - Merge faster hash implementation. - - The hash function parameter in hash_init(...) is not used anymore. - - It should be removed but it is "to be decided" if we want to do that now - - or in a major version as it means changing MANY places and third party - - modules might stop working. - -2001-07-10 Thies C. Arntzen - - * zend_API.h - zend_variables.c: cleaned up the RETVAL_ RETURN_ and ZVAL_ macros - - added check for \0 at end-of-string at some places. all strings in PHP - have to be terminated with \0 because 3th party libraries might not be - binary-safe. - -2001-07-10 Andi Gutmans - - * zend_compile.c: - Commit Thies' patch. str.len was too long. - -2001-07-09 Andrei Zmievski - - * zend_API.c - zend_API.h: Adding new parameter parsing API. - -2001-07-09 Andi Gutmans - - * zend_hash.c - zend_hash.h: - - Significantly improve hash table performance by using djb's hash function - instead of hashpjw() and by using power of two sizes of hash tables (this - saves the % and isn't necessary with a good hash function). - Please try this patch. - -2001-07-03 Rasmus Lerdorf - - * zend_API.c: Trivial fix - but the period looks odd in error messages - -2001-06-30 Andi Gutmans - - * zend_alloc.c: - Fix the memory limit fix. - -2001-06-29 Andi Gutmans - - * zend_operators.c: - Remove bogus comment. - -2001-06-29 Zeev Suraski - - * zend_alloc.c: Fix memory_limit, kill warning - -2001-06-28 Zeev Suraski - - * zend_execute_locks.h: Fix warnings - -2001-06-27 Zeev Suraski - - * zend_execute.c: - Fix leak in the patch, and revert a couple of lines I didn't mean to commit - - * zend_execute.c: - Warn about illegal offsets - - Allow assignments to uninitialized string offsets (automatically pads the - string with spaces) - -2001-06-26 Zeev Suraski - - * zend_operators.c: - Fixed autoconversion of negative values to double (Fix bug #11685) - -2001-06-26 Andi Gutmans - - * zend_builtin_functions.c: - Fix crash bug (fix by Jani). - -2001-06-24 Andi Gutmans - - * zend.h: - Bump Zend version - -2001-06-21 Andi Gutmans - - * zend_execute.c - zend_execute_locks.h - zend_globals.h: - - Hopefully fix bug #11476 and improve garbage to be freed very quickly. - Tree tagged as PRE_GRANULAR_GARBAGE_FIX before commiting. - - * zend_execute_locks.h: - - Use inline instead of macro for PZVAL_LOCK()/PZVAL_UNLOCK() so that it - can be debugged. - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - - Nuke dependency of all of PHP on zend_execute_locks.h. - -2001-06-21 Zeev Suraski - - * zend_execute.c: - Eliminate the leak that the original bogus code tried to solve - - * zend_compile.c - zend_execute.c - zend_globals.h: - parent::methodname() now works better with runtime classes (fix bug #11589) - - * zend_execute.c: - Fix bug #11590 (I want Andi to also review this patch before it goes into 4.0.6) - -2001-06-20 Andi Gutmans - - * zend_execute.c: - MFH - - * zend_execute.c: - Fix string offsets crash. - -2001-06-19 Andi Gutmans - - * zend_alloc.c: - Real MFH of memory fragmentation patch - - * zend_alloc.c: - Bad merge. Revert the previous patch (damn CVS). - - * zend_alloc.c: - MFH - - * zend_alloc.c: - - Fix memory fragmention problem which could lead to web server processes - growing much more than they should. (bug #11344?) - - * zend_execute.c - zend_execute.h: - MFH - -2001-06-19 Zeev Suraski - - * zend_execute.c - zend_execute.h: Add missing exports - - * zend_execute.c: Fix warning - -2001-06-13 Zeev Suraski - - * zend.c: MFH - - * zend.c: - Avoid crashing if the error reporting function is called after a bailout during shutdown - -2001-06-12 Zeev Suraski - - * zend_highlight.c: - Improve XHTML compliance (suggested by Anil Madhavapeddy) - -2001-06-10 Zeev Suraski - - * zend.c: Fix ZTS build problem - -2001-06-07 Andi Gutmans - - * zend_compile.h: - Avoid breaking op_array compatibility for 4.0.6 - -2001-05-30 Zeev Suraski - - * Zend.m4 - zend_execute_API.c: Add missing check - -2001-05-25 Andi Gutmans - - * zend_compile.c: - - Change if() to while() to make sure we skip enough opcodes - - * zend_compile.c: - MFH - - * zend_compile.c: - Fix memory leak - -2001-05-23 Andrei Zmievski - - * zend_builtin_functions.c: - Fix segfault -- need to copy-construct constant value. - -2001-05-21 Andrei Zmievski - - * zend_builtin_functions.c: Moving some functions into Zend. - -2001-05-20 sascha - - * .cvsignore: ignore ylwrap - -2001-05-20 Andi Gutmans - - * zend_list.h: - The previous name could be confused with resource # - - * zend_list.c - zend_list.h: - - Whitespace and change the name of the macro to something more verbose - ZEND_GET_RESOURCE_ID(...) - -2001-05-20 James Moore - - * zend_list.c - zend_list.h: - Add new ZEND_GET_LE macro for retrieving destructor - id's from remote extensions. (Jmoore, Zend Engine) - -2001-05-20 Andi Gutmans - - * zend_list.c: - Don't allow resource types of 0 - -2001-05-19 sascha - - * zend_hash.c: Fix segfault when using zend_hash_add_empty_element - -2001-05-18 Thies C. Arntzen - - * zend_alloc.c: reset allocated_memory_peak after each request. - -2001-05-17 Zeev Suraski - - * zend_language_scanner.l: That's slightly clearer that way :) - - * zend_alloc.c: Fix build - - * zend.c: MFH - - * zend.c: Fix corruption issue - -2001-05-16 Zeev Suraski - - * zend_hash.c - zend_hash.h: - Implement zend_hash_add_empty_element() using the existing infrastructure - - * zend_globals.h: Commit missing fix - - * Zend.m4 - zend_alloc.c - zend_globals.h: Merge memory usage into memory limit - -2001-05-14 sascha - - * zend_hash.c: - Initialize empty pDataPtr to a pseudo value to prevent a pefree on - pData. - -2001-05-12 Andi Gutmans - - * zend_variables.c: - Remove check for ht == NULL in copy_ctor. - If ht is NULL at this point then we are better off crashing and fixing - the bug that caused it. - -2001-05-11 sascha - - * zend.h: add missing closing paranthesis - - * zend_hash.c: Some extensions don't associate any data with hash entries, - except the key. Prior to this change, a separate chunk of memory - was allocated in that case to store exactly zero bytes (plus - memory manager overhead). We treat that case similar to the - pointer case, but don't copy any data at all (because the pointer - is usually the NULL pointer). - - * zend_constants.c: - Fix a memory leak which occured upon registering an already existing - constant. - -2001-05-11 Thies C. Arntzen - - * Zend.m4 - zend_alloc.c - zend_globals.h: added --enable-memory-usage-info - -2001-05-11 Andi Gutmans - - * zend_opcode.c: - MFH - - * zend_opcode.c: - - Fix crash bug when opcodes array is erealloc()'ed to a different memory - area before it reaches the loop. - - Some whitespace stuff - -2001-05-10 Zeev Suraski - - * zend_operators.c: - Treat numeric strings as numbers in the increment operator - -2001-05-09 Andrei Zmievski - - * zend_API.c: Nuke unused variable. - - * zend_API.c: Fix a few bugs in zend_is_callable() and make it stricter. - -2001-05-08 Andi Gutmans - - * zend_language_scanner.l: - Fix line numbers when some lines end with \r - - * zend_opcode.c: - Fix crash bug reported by DBG author Dmitri Dmitrienko. - -2001-05-07 Zeev Suraski - - * zend.c: Make zend_execute_scripts() reentrant - -2001-05-06 Zeev Suraski - - * zend.c - zend_compile.c - zend_compile.h: - Recover from a parse error in include files (before, it could result in a crash under certain circumstances). Fix bug #8663 - -2001-05-06 Andi Gutmans - - * .cvsignore: - .cc files were renamed. Update .cvsignore. - -2001-05-06 Zeev Suraski - - * zend_operators.h: Yikes, that would have been a very bad bug :) - - * zend_execute.c: - Floating point keys didn't work in array() (fix bug #6662) - - * zend_compile.c - zend_execute_API.c: - Hear hear, interactive mode is finally showing some progress: - - Support function calls - - Fix crash bug - - * zend_compile.h - zend_language_parser.y - zend_language_scanner.l: Support interactive mode in thread-safe builds - - * zend_operators.h: Fix autoconversion of hexadecimal strings - It's time to close bug #5404 :) - - * zend_highlight.c: Retain single spaces as spaces to condense HTML - -2001-05-02 Andi Gutmans - - * zend_ini_scanner.l: - Support \r as newline in the ini scanner - - * zend_language_scanner.l: - Handle MAC OS X \r line endings - - * zend_execute.c: - - Patch by Andrei to prevent crash in error situation when not all - object overloading handles are defined. - -2001-05-01 Andi Gutmans - - * zend.h: - Bump up Zend version - -2001-04-30 Andi Gutmans - - * zend_builtin_functions.c: - Add mistakenly removen closing bracket - - * zend_builtin_functions.c: - Get rid of warning - - * zend_alloc.c: - - Try to solve crash on OS400. There is actually no reason I can see for - why his fix should solve a crash but it doesn't harm. - - * zend_execute_API.c: - Fix crash bug in interactive mode - -2001-04-29 Andi Gutmans - - * zend_alloc.h: - Whitespace - - * zend_alloc.c - zend_alloc.h: - Improve overwrite detection in debug mode. - - * zend_operators.c: - - Previous patch for too early freeing of resources seemed to have worked. - - Clean it up a bit. - - * zend_operators.c: - - Try and solve the too early resource destruction problem. - -2001-04-28 Zeev Suraski - - * zend.h - zend_hash.c - zend_language_scanner.l - zend_operators.c: include limits.h if available - - * zend.h: Fix bug 5661 - -2001-04-28 Andi Gutmans - - * zend_operators.c: - Move all cases into switch(). - - * zend_alloc.c: - Just some little whitespace stuff. - - * zend_alloc.c: - - Don't add/remove cached memory blocks from blocks list as this will slow - - down performance a bit. - -2001-04-28 Zeev Suraski - - * zend_operators.c: - Resources weren't being properly destroyed by the convert_to_*() functions - -2001-04-27 Andi Gutmans - - * zend_API.c - zend_builtin_functions.c - zend_hash.c - zend_language_scanner.l - zend_operators.c - zend_operators.h: - More whitespace fixes while I'm at it. - - * zend.h - zend_alloc.c - zend_builtin_functions.c - zend_execute_API.c - zend_extensions.c - zend_language_scanner.l: - - Whitespace changes to be standard like the rest of Zend - -2001-04-24 Andi Gutmans - - * zend_execute.c: - Due to popular demand merge the foreach() crash fix. - -2001-04-24 Andrei Zmievski - - * zend_builtin_functions.c: MFH. - -2001-04-21 Andi Gutmans - - * zend_llist.c - zend_llist.h: - Add typedef for function pointer of llist dtor - -2001-04-20 Andi Gutmans - - * zend_execute.c: - - Fix for crash bug when using invalid arguments in the foreach() loop. - - Reported by Yasuo Ohgaki - -2001-04-19 Andi Gutmans - - * zend_API.h: - Patch from Jason Greene. - - Make it easier to write PHP function definitions in more than just one .c - file while accessing the same module globals. - -2001-04-17 Zeev Suraski - - * zend_alloc.c: small beautification - -2001-03-28 Zeev Suraski - - * zend_list.c: Fix warning - - * zend_list.c: Make Windows happy - - * zend_list.c: Get rid of more redundant code - - * zend_list.c: - Cleaner way of making sure resources start at 1 and not 0... - - * zend_list.c - zend_list.h: Remove redundant code - -2001-03-27 Zeev Suraski - - * zend_list.c - zend_list.h: God knows what this code was doing... - -2001-03-26 Andrei Zmievski - - * zend_builtin_functions.c: - Updated get_class_methods() to take class instance as well as class name. - - * zend_builtin_functions.c: - Making it possible to pass a class name to get_parent_class() as well - as a class instance. - -2001-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Fixing function name length. - -2001-03-19 Andi Gutmans - - * zend_language_parser.y: - - Add support for isset($var1, $var2, $var3); - Will be true only if all - - variables are set. - -2001-03-15 Andi Gutmans - - * zend_language_parser.y: - Nuke commented code - -2001-03-12 Andrei Zmievski - - * zend_API.c: Name length is already known. - -2001-03-12 Andi Gutmans - - * zend_API.c: - Missed second place. - - * zend_API.c: - Nuke snprintf() - - * zend_language_scanner.l: - White space - - * zend_language_scanner.l: - - Fix by Jani Taskinen for whole path also to work - with include_once()/require_once(). - -2001-03-12 Andrei Zmievski - - * zend_API.c - zend_API.h: - Improve zend_is_callable() to the point where it's actually useful. - Now it just needs to be invoked everywhere in PHP where a callback is - expected. - -2001-03-11 Andi Gutmans - - * Zend.m4 - acconfig.h: - Fix for Solaris. - -2001-03-10 Andi Gutmans - - * zend_execute.c: - Whitespace - -2001-03-07 Zeev Suraski - - * zend_ini.h: Add missing #define's - - * zend_compile.c - zend_execute.c: Make parent:: work in runtime bindings as well - -2001-03-06 sascha - - * Zend.m4: We actually only need AC_PROG_LEX here. - -2001-03-04 Zeev Suraski - - * zend_execute.c: Fix bug #8899 (thanks Jani) - -2001-03-03 sascha - - * Zend.m4: -Os is a valid GCC optimization level. - -2001-03-02 Zeev Suraski - - * zend_compile.c: Whitespace fix - -2001-02-28 Andrei Zmievski - - * zend_execute_API.c: Do case-insensitive class name matching when parsing - array('Class', 'method') structure. - You guys can clean it up, if there is a better way. - -2001-02-27 Andi Gutmans - - * zend_variables.c - zend_variables.h: - Nuke zval_del_ref() - -2001-02-27 Andrei Zmievski - - * zend_compile.c: Don't overwrite existing handlers with parent ones. - -2001-02-26 Andi Gutmans - - * Zend.dsp - ZendCore.dep - ZendTS.dsp - zend.c - zend_API.c - zend_API.h: - Rename modules.h to zend_modules.h - - * LICENSE: - One more copyright year update - - * zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_static_allocator.c - zend_static_allocator.h - zend_variables.c - zend_variables.h - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_ini.c - zend_modules.h: - Update copyright year - -2001-02-25 Andi Gutmans - - * zend_modules.h: - Fix dll linkage warnings - -2001-02-24 Andi Gutmans - - * zend_builtin_functions.c - zend_modules.h: - Add exports from Daniel Beulshausen - -2001-02-14 Stanislav Malyshev - - * zend.h: allow more extensions with resources - -2001-02-13 Zeev Suraski - - * zend_extensions.c: Move version registration to a more correct place - -2001-02-12 Andi Gutmans - - * zend_operators.c - zend_operators.h: - Remove two unused functions - - * zend_execute_API.c: - Fix whitespace. - -2001-02-12 Zeev Suraski - - * zend_execute_API.c: - Fix a bug that could cause corruption in case of an error during - get_zval_ptr() - -2001-02-09 Andi Gutmans - - * zend_execute.c: - - Remove duplicate code and do a tiny optimization in DO_FCALL - -2001-02-05 Zeev Suraski - - * zend_execute.c: Fix string offset data corruption - -2001-02-04 Andrei Zmievski - - * zend_execute_API.c: - Allow passing class name as well as an object instance to call methods. - -2001-02-03 Andrei Zmievski - - * zend_execute_API.c: - Set the correct function state during execution. This is mainly to have - get_active_function_name() to return proper value. - - * zend_compile.c: Inherit overloaded handlers. - -2001-02-01 Andrei Zmievski - - * zend_API.c - zend_API.h: - Added zend_is_callable() function that checks whether passed zval - represents a valid and exiting callable construct. - -2001-01-31 Andi Gutmans - - * zend_API.h - zend_API.c: - Change unset() functions to null(). unset() is legacy - - * zend_API.h: - - Quick fix. I'm for changing these to add_property_null() as we've nuked - - unset. - -2001-01-27 Andi Gutmans - - * zend_execute.c: - That doesn't seem like a smart thing to do :) - - I wonder if gcc optimized it out. - -2001-01-23 Thies C. Arntzen - - * zend_extensions.h - zend_ini_scanner.h - zend_list.c - zend_list.h: fix a couple of warnings - - * zend_API.c: fixed crash in add_index_bool. - -2001-01-22 Andrei Zmievski - - * zend_API.h: Make add_index_zval() available to the outside world. - -2001-01-21 Andi Gutmans - - * zend.h: - - Make people happy who like the Zend version number bumped up in parallel - with PHP. - -2001-01-20 Andi Gutmans - - * zend_API.c - zend_API.h: - - Patch from Sterling. Add API calls to add zval's as array indeces/ - object properties. Add _ex functions which take the string length as an - argument for better performance. - -2001-01-19 Andi Gutmans - - * zend_API.h - zend_API.c: - - For Sterling. I wonder if not all of the API functions should take the - - key_length as a parameter in order to save that strlen(). - -2001-01-17 Andi Gutmans - - * zend_execute.c: - - Fix leak in fetch_dim_address() which was already fixed in - - fetch_dim_object(). Take the oppertunity to make both use the same - - function and not duplicate the code. - -2001-01-16 Zeev Suraski - - * zend_list.c: Fix persistent resources, once and for all... - -2001-01-15 Zeev Suraski - - * zend.c - zend.h - zend_compile.c: Add free_estring() - -2001-01-12 Zeev Suraski - - * zend_istdiostream.h: Add newline - -2001-01-12 Rasmus Lerdorf - - * zend_highlight.c: Fix for bug number 8666 - -2001-01-07 Zeev Suraski - - * zend_ini.c: Fix mismatch in return values - - * zend.c - zend.h - zend_alloc.c - zend_ini.c - zend_ini.h: - Remove backward dependency from PHP -> Zend - - Rename get_ini_entry() as get_configuration_directive() for clarity - (it doesn't use the INI subsystem, but the module-supplied function for - retrieving configuration directives) - - * Zend.dsp - ZendTS.dsp: Remove -S option on all bison calls - - * zend.c: - Fix possibility of a crash during startup (very unlikely, but possible) - -2001-01-06 Zeev Suraski - - * ZendTS.dsp: Remove -S - -2001-01-06 Andi Gutmans - - * zend_ini.c: - This slipped in by mistake. - -2001-01-05 Zeev Suraski - - * zend_ini.c - zend_ini.h: - Merge in some ZEND_API additions from Daniel Beulshausen (needed for the - Win32 Apache module) - -2001-01-04 Andi Gutmans - - * zend_list.c: - - Make plist_destructor work like list_destructor to allow it to call - extended destructors. - -2001-01-03 Zeev Suraski - - * zend.h: Fix Zend version while we're at it - - * zend_execute_API.c: Merge call_user_function_ex() fixes - - * zend_language_scanner.l: Merge line number corruption bug fix - - * zend_language_scanner.l: - Fix another case of possible line number corruption - - * zend.h: Commit missing declaration - -2001-01-01 Andi Gutmans - - * zend_execute.c: - Remove unreachable code - -2000-12-30 Zeev Suraski - - * zend_language_scanner.l - zend_opcode.c: Fix possible corruption in line number information - -2000-12-27 Zeev Suraski - - * zend.c - zend_globals.h - zend_ini.c - zend_ini.h - ZendTS.dsp: - Make the INI mechanism thread safe (or at least thread safer :) - -2000-12-26 Zeev Suraski - - * zend_compile.h: - Use iostream.h instead of istream.h (IBM's compiler doesn't come with istream.h, - and iostream.h should include it) - - * ZendTS.dsp - zend_ini_scanner.l - zend_istdiostream.h - zend_language_scanner.l: - - Use supplied istdiostream definition for the INI scanner too - - Add Release_TSDbg configuration - -2000-12-24 Zeev Suraski - - * zend_extensions.h: This needs updating as well - - * zend_execute_API.c: - More aggressive protection in call_user_function_ex() - -2000-12-23 Zeev Suraski - - * zend_execute_API.c: - Fix a possible crash bug in call_user_function_ex(), if the function is - in fact not a user function - -2000-12-22 sascha - - * zend.c - zend_modules.h: - Set the floating-point exception mask on FreeBSD to 0 (as do other - FreeBSD system applications). Also bump up the module API number - as the zend_hash_get_current_key change affects source and binary - compatibility. - -2000-12-22 Zeev Suraski - - * zend.c - zend_builtin_functions.c - zend_execute.c - zend_hash.c - zend_hash.h: - Allow get_current_key() not to return the key itself, instead of a duplicate - - * zend_hash.c: * Fixed a possible crash in get_class_methods() - -2000-12-19 Stanislav Malyshev - - * zend_language_scanner.l: Add support for ASP tags in one-line comment - -2000-12-18 Andi Gutmans - - * flex.skl: - Success! Yay! - - * flex.skl: - Yet another one. - - * flex.skl: - Testing - - * flex.skl: - No luck - - * flex.skl: - Make this damn commit stuff work. - - * flex.skl: - Testing - -2000-12-18 Stanislav Malyshev - - * zend.c: - Use HashPosition iterator instead of saving/restoring internal pointer - - * zend.c: Preserve internal pointer over print_r (fix #8289) - -2000-12-18 Andi Gutmans - - * zend_compile.c: - Fix leak with useless statements such as "foo"; - - * flex.skl: - - Testing Sascha's CVS commit script which should work with branches. - - * flex.skl: - Testing - - * flex.skl: - Testin - -2000-12-18 Zeev Suraski - - * flex.skl: Test, ignore - -2000-12-18 Stanislav Malyshev - - * zend_operators.c: Add notice when auto-converting array to string - -2000-12-17 Andi Gutmans - - * zend_language_scanner.l: - - Clean up the scanner a tiny bit while messing with it. - - * zend_language_scanner.l: - - %> without asp_tags should not be treated as inline_html but as regular - tokens. Of course the parser will die with a parse error which is the - correct behavior. - - * zend_language_scanner.l: - - Fix problem in one line comments with line endings such as ??> - -2000-12-17 Stanislav Malyshev - - * zend_operators.c: Fix #8279 (-2147483647 > 2147483647). - -2000-12-14 Zeev Suraski - - * zend_modules.h: Update module_api_no - -2000-12-13 Zeev Suraski - - * zend_API.h - zend_execute_API.c: - Fix call_user_function() with objects - it could leak under certain circumstances - -2000-12-12 Stanislav Malyshev - - * zend_operators.c: Fix #8195: strncasecmp returns incorrect value - -2000-12-07 sascha - - * zend_builtin_functions.c: - Hardcode strlen due to problems on SCO OpenServer 5.0.4 which defines - strlen to __std_hdr_strlen. - -2000-12-07 Stanislav Malyshev - - * zend_compile.c: Whitespace fix - - * zend_compile.c: Allow var $foo = array(ABC => 1) constructs - - * zend_builtin_functions.c: - Fix memory leak - get_current_key mallocs it's result, no need to - copy it. - -2000-12-06 sascha - - * zend_hash.c: - INIT_DATA/UPDATE_DATA assumed that pData elements of the size of a void - pointer would actually be aligned like a void pointer. This lead - to bus errors on architectures which don't allow unaligned 32-bit accesses. - -2000-12-05 Andi Gutmans - - * zend_language_parser.y: - - Support for $var =& new foo() syntax. This allows you to use objects - which create extra references to themselves in the constructor. - -2000-12-05 Zeev Suraski - - * zend_execute.h: Expose all timeout functions - -2000-12-02 sascha - - * acconfig.h - configure.in: - Use the hardly-documented third parameter of AM_INIT_AUTOMAKE to suppress - defining PACKAGE/VERSION. - -2000-11-27 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: - - Allow passing references which are returned from functions and new - - statements to be passed by reference. - -2000-11-27 Andrei Zmievski - - * zend_builtin_functions.c: - Update class constants before trying to get default properties. - -2000-11-22 Andi Gutmans - - * zend_compile.c: - Remove code which has been commented out for ages. - -2000-11-22 sascha - - * zend_execute.c - zend_globals.h: Pass on the exit status - -2000-11-21 Zeev Suraski - - * zend_operators.c - zend_operators.h: Fix build - -2000-11-21 Andi Gutmans - - * zend_execute.c: - The baby patch wasn't that innocent :) - -2000-11-21 Andrei Zmievski - - * zend_builtin_functions.c: - Sterling's patch to make get_defined_vars() simpler and better. - -2000-11-20 Andi Gutmans - - * zend_execute.c: - NEVER copy and paste :) - - * zend_compile.c - zend_execute.c: - Baby patch towards making the damn pass-by-ref work. - -2000-11-20 Zeev Suraski - - * zend_extensions.h: Update API number - -2000-11-20 Stanislav Malyshev - - * zend.h: - Add macro to replace value of zval with another value while preserving - referencing structure - -2000-11-20 Andi Gutmans - - * zend_execute.c: - This patch is broken and needs more thorough fixing. - -2000-11-19 Andi Gutmans - - * zend_execute.c: - - Try and fix the problem when sending references returned from a function by reference. - -2000-11-19 Zeev Suraski - - * zend_alloc.h: Fix Zend build for non ZTS - -2000-11-18 Zeev Suraski - - * zend_alloc.c: Forgot to commit the non-debug build fix yesterday... - - * zend_alloc.c - zend_alloc.h: - Add thread-safety debugging information (idea - Dmitri Dmitrienko) - -2000-11-14 Stanislav Malyshev - - * zend_language_scanner.l: Restore compatibility with old broken way - - * zend_language_scanner.l: - Better 0x handling - not change non-0x number behaviour - - * zend_language_scanner.l: - Attempt at better handling long 0x-numbers, like 0xffffffff - -2000-11-13 Andi Gutmans - - * zend_extensions.c - zend_extensions.h: - Remove unused function - - * zend_extensions.h: - - Use typedef's for function pointers so that we can easily define arrays - - of these function pointers. - -2000-11-13 Stanislav Malyshev - - * zend_llist.c: - Fix zend_llist_apply_with_del - it should remove from list, - not only call dtor - -2000-11-12 Zeev Suraski - - * ZEND_CHANGES: Test, ignore - -2000-11-11 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Move SET_UNUSED() to header - - * zend_opcode.c: - Beautify by using the standard #define. - -2000-11-10 Andi Gutmans - - * zend_compile.h - zend_compile.c: - Remove this damn thing once again. - - * .cvsignore: - Add files to .cvsignore thanks to Jon Parise - -2000-11-09 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Maybe it's OK now? :) - - * zend_compile.c - zend_compile.h: - Undo the previous commit for fixing $obj = new foo(). - - * zend_compile.c - zend_compile.h: - - Commit experimental patch to fix the problem when doing $a = new foo() - and the constructor assigns $this by reference to other symbol table - elements. Thanks to Daniel J. Rodriguez on this one. - -2000-11-08 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: Add ability to find extensions by name - -2000-11-06 sascha - - * zend_ini.c: Kill a misleading warning which is intended for old code - which assumes sizeof(int) == sizeof(void *). - -2000-11-03 Andi Gutmans - - * zend_ini_scanner.h: - Add trailing \n? - -2000-11-03 Zeev Suraski - - * zend_ini_scanner.l: Fix for bug #5571 (by mookid@sigent.ru) - -2000-11-03 Andi Gutmans - - * Makefile.am: - Fix dependency. - -2000-11-03 Zeev Suraski - - * zend_operators.h: Fix build - - * zend_operators.h: Add RESVAL macros - -2000-11-02 Zeev Suraski - - * zend.c: Fix bug #7599 - - * zend_language_parser.y - zend_language_scanner.l: Missed those - - * zend_API.c - zend_compile.c - zend_compile.h: Maintain consistency - -2000-11-02 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_language_parser.y: - Replace do_exit() with zend_do_exit(). - - Problem reported by David Hedbor - -2000-11-02 Zeev Suraski - - * zend_ini_parser.y: Remove unnecessary variables - - * zend_ini.c: - explicit declaration here too - sigh, way too early in the morning - - * zend_ini.h: oops - - * zend_ini.h: explicit declaration - -2000-10-31 Zeev Suraski - - * zend_highlight.h: Fix Apache build - - * zend_ini.c - zend_ini.h: Remove unnecessary code, fix phpinfo() - - * Zend.m4: Require bison 1.28 - -2000-10-30 Zeev Suraski - - * Zend.dsp: Fix non-thread-safe Windows build - - * zend_globals.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: Final touches on the INI parser - -2000-10-30 Stanislav Malyshev - - * Makefile.am: Another attempt to make it build - - * Makefile.am - zend_ini_scanner.l: Fix build - -2000-10-29 Zeev Suraski - - * zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: Fix leaks - - * zend_alloc.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.h - zend_ini_scanner.l: The new INI parser is showing some signs of life - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix a corruption bug, when erroneously allowing to send non-variables by reference (several - bug-db reports seem to originate in this bug) - - * zend_extensions.c - zend_ini_parser.y: Fix build - - * zend_ini_scanner.h: Forgot this one - - * Makefile.am - ZendTS.dsp - zend_globals.h - zend_ini.h - zend_ini_parser.y - zend_ini_scanner.l: Generalization work - -2000-10-29 Stanislav Malyshev - - * zend_extensions.c - zend_extensions.h: - Allow module to proclaim compatibility with any Zend version - -2000-10-29 Zeev Suraski - - * Makefile.am - ZendTS.dsp - zend_ini_parser.y - zend_ini_scanner.l - zend_language_scanner.l: Some more work on the INI parser/scanner - - * Makefile.am - zend_ini_parser.y - zend_ini_scanner.l: Initial step in rewriting the INI parsing mechanism - - * .cvsignore - Makefile.am - Zend.dsp - ZendCore.dep - ZendTS.dsp - zend-parser.y - zend-scanner.h - zend-scanner.l - zend_compile.c - zend_compile.h - zend_highlight.c - zend_indent.c - zend_language_parser.y - zend_language_scanner.h - zend_language_scanner.l: Unify the names of these last 3 files... - - * Zend.dsp - ZendTS.dsp: Fix Windows build - - * Makefile.am - zend_ini.c - zend_ini.h - zend_operators.c - zend_operators.h: - Initial steps to move the INI mechanism to the Zend engine - -2000-10-27 Andrei Zmievski - - * zend_operators.h: Added macros for object properties and class entry. - -2000-10-26 Andi Gutmans - - * zend_API.c - zend_modules.h: - Fix new -m on Windows - -2000-10-25 Andrei Zmievski - - * zend_list.h: Remove the patch to register_list_destructors(). - -2000-10-20 Andrei Zmievski - - * zend_list.c - zend_list.h: - Fixed a bug in zend_rsrc_list_get_rsrc_type() - - Switched register_list_destructors() to use - zend_register_list_destructors_ex() instead - -2000-10-19 Andi Gutmans - - * zend_compile.c: - - Constant expressions which are used multiple times need to be copy_ctored - -2000-10-18 Andi Gutmans - - * zend_llist.c: - Fix whitespace - - * zend_extensions.c - zend_llist.c - zend_llist.h: - - Try #2. Wasn't allowed to delete in the previous manner because we were - in the middle of an llist_apply() - -2000-10-18 sascha - - * zend_fast_cache.h: - Add explicit conversion from 'void *', otherwise ANSI C++ compilers - will break out. - -2000-10-18 Andi Gutmans - - * zend_extensions.c: - Fix crash - -2000-10-17 Andi Gutmans - - * zend_builtin_functions.c: - Fix copy&paste bug - -2000-10-15 Andi Gutmans - - * zend_opcode.c: - - Increase op_array size faster and make eralloc() it in the end to save - memory. - -2000-10-14 Andi Gutmans - - * zend_builtin_functions.c: - Add another patch from Sterling. - - * zend_builtin_functions.c: - - Preliminary commit of Sterlings get_defined_functions()/get_defined_vars - functions - - * zend_extensions.c: - - Only run startup() if ZEND_EXTENSIONS is defined to 1. - This fixes a link error on platforms which don't support libdl - -2000-10-13 Andi Gutmans - - * zend_operators.c: - Make increment of "" become "1" - -2000-10-11 Andi Gutmans - - * zend_hash.c - zend_hash.h: Don't use 'new' symbol - -2000-10-11 Zeev Suraski - - * zend_execute.c - zend_execute_API.c: - Fix -a interactive mode (no idea how the previous commit got committed) - - * zend_execute.c: *** empty log message *** - - * zend.h: Update version - - * zend_hash.c - zend_hash.h: Add zend_hash_merge_ex(), for selective merging - -2000-10-06 Andi Gutmans - - * zend_execute.h: - Fix Bug #7061 - -2000-10-05 Andi Gutmans - - * zend-scanner.l: - - Updated included_files() also for plain include()/require(). - -2000-10-04 Andi Gutmans - - * zend_alloc.c: - Fix fprintf - -2000-10-02 Andi Gutmans - - * zend_extensions.h: - Change zend_extension_api_no - -2000-09-30 Andi Gutmans - - * zend_builtin_functions.c: - Cleanup error output - -2000-09-28 Andi Gutmans - - * zend_hash.c: - - Another has optimization/fix like the hash_copy one from earlier on - -2000-09-28 Stanislav Malyshev - - * zend_hash.c: - Make hash_copy call copy constructor on a real copy, not on a temp - -2000-09-28 Andi Gutmans - - * ZendTS.dsp: - Remove zend_gcc_inline.c - -2000-09-26 sascha - - * Makefile.am - Zend.m4 - zend_execute.h - zend_gcc_inline.c - zend_operators.h: - Remove --enable-c9x-inline option. We now use a syntax which is compatible - with all compilers by providing the function with static linkage in every - compilation unit. - -2000-09-25 Zeev Suraski - - * zend.c - zend_extensions.c - zend_extensions.h: - Fix previous update - move extension startup further down the startup sequence - - * zend.c: Move extension startup further down the startup sequence - -2000-09-19 Andi Gutmans - - * zend_operators.h: - Add Z_BVAL* macros - -2000-09-19 Stanislav Malyshev - - * zend_execute_locks.h: - Fix crash on Solaris with function parameter destruction - -2000-09-18 Stanislav Malyshev - - * zend_builtin_functions.c: - Made get_included_files() work again, in somewhat different way - -2000-09-17 Stanislav Malyshev - - * zend_compile.c: Set filename even on recursive include - -2000-09-14 Andi Gutmans - - * zend_execute.c: - - Fix NULL handling in ARRAY opcode and resolve memory leak - -2000-09-12 Zeev Suraski - - * zend-scanner.l - zend.c - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_highlight.h: Make compile_string() accept a description of the code - -2000-09-11 Andi Gutmans - - * zend_compile.c: - - Forgot to create extended info in include()/require() call - -2000-09-10 Stanislav Malyshev - - * zend-parser.y: Allow require_once to take expressions, just like require - - * ZEND_CHANGES: Try once more to remove dups - - * ZEND_CHANGES: Test commit - weed out duplicate messages - -2000-09-09 Zeev Suraski - - * zend.c: Don't use unsafe sprintf() - -2000-09-08 Stanislav Malyshev - - * zend.c: Don't trust snprintf return - -2000-09-06 Andi Gutmans - - * zend_config.w32.h: - Save two lines - - * zend_config.w32.h: - Fix header - -2000-09-06 sascha - - * Zend.m4: Unless overwritten, default to no optimization in debug mode. - -2000-09-05 Andi Gutmans - - * zend_operators.h - zend_operators.c: - Commiting Sterling's new multi_convert* functions - -2000-09-05 Andrei Zmievski - - * zend_builtin_functions.c: Fix memory overrun. - -2000-09-05 Stanislav Malyshev - - * zend_builtin_functions.c: - Fix crash with trigger_error having no args (#6549) - -2000-09-04 Andi Gutmans - - * Makefile.am: - Remove two tabs - -2000-09-02 Andi Gutmans - - * ZendTS.dsp: - - Defining TSRM_WIN32 in each and every dsp sucked. Revert this change - - * ZendTS.dsp: - Fix windows build - -2000-08-31 Andi Gutmans - - * ZendTS.dsp: - - This should fix the performance problem with Release builds - - * zend-scanner.l - zend.c - zend_execute.c: - - Use emalloc() for opened_path now. This was a potential leak before. - - This patch has potential to break stuff but I tested it as much as I - - could. Fixes should be easy. - - * zend.c: - Remove support for __string_value() in print $obj - -2000-08-31 Zeev Suraski - - * zend.c: Safer shutdown process - -2000-08-29 Andi Gutmans - - * zend.h: - Update Zend version. - -2000-08-26 Andi Gutmans - - * zend_builtin_functions.c: - Don't define this function in non-debug mode - -2000-08-24 Andi Gutmans - - * zend_execute.c: - - Revert patch from 9/7/2000 which seems to have broken unset(). - - I hope what made me do this patch doesn't appear again. - -2000-08-22 Andi Gutmans - - * zend_execute_API.c: - - Fix bug report by Andrei when using a method as a sort user function - - parameter in usort() like functions - -2000-08-20 Zeev Suraski - - * zend_config.w32.h: Fix Win32 build - -2000-08-20 sascha - - * zend_config.w32.h: - _isnan seems to be supported on Win32, add an appropiate macro. - - * acconfig.h: If available, use fpclassify for substituting zend_finite. - - * acconfig.h: - Including math.h before using macros defined there will work better :) - - * acconfig.h: Add zend_isinf and zend_isnan. - -2000-08-19 Andrei Zmievski - - * zend-scanner.l: One more fix to C compile. - -2000-08-19 Zeev Suraski - - * zend-scanner.l: Fix C build - - * zend-scanner.l: Fix eval() leakage in ZTS mode - - * zend_compile.c - zend_globals.h: Eliminate run-time leak with eval()'s - - * zend_alloc.c: Fix build with no memory_limit - - * zend_alloc.c: Fix memory_limit - -2000-08-19 Andi Gutmans - - * zend_execute.c: - Beautify - -2000-08-17 Stanislav Malyshev - - * zend_API.h: Fix EMPTY_STRING macros - -2000-08-15 Zeev Suraski - - * zend_extensions.h - zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: - Fix warning issue (compile errors inside require()'d files were incorrectly supressed) - -2000-08-14 Zeev Suraski - - * zend_execute.c: - Fix leak and some logic - -2000-08-14 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - This patch should hopefully fix situations where a constructor uses - - the $this pointer as a reference. - -2000-08-14 Stanislav Malyshev - - * zend_execute.c: Fix crash - -2000-08-14 Andi Gutmans - - * zend_compile.c - zend_execute.h: - - Unused results should be marked with EXT_TYPE_UNUSED and not IS_UNUSED - -2000-08-13 Stanislav Malyshev - - * zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: Fix zend_fiel_handle handling. Should fix URL include - and various opened_path inconsistencies. - -2000-08-13 Andi Gutmans - - * zend-parser.y: - - Revert foreach() change which only allowed variables and array(...) - -2000-08-11 Andi Gutmans - - * zend-parser.y: - Only support variables and array(...) in foreach loops - -2000-08-10 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Fix problem with nested foreach()'s (Andi, Zend Engine) - - * zend_compile.c: - Fix switch which only has a default rule (Andi, Zend Engine) - Change require_once() to use the same file list as include_once(). - Patch includes making require() & include() to behave the same when it - comes to scoping. require() is now an include() which isn't allowed to fail. - require() caused too many memory reallocations which ended up being quite - slow for sites that required lots of files. (Andi & Zeev, Zend Engine) - - Fix switch() which only has default rule (bug #5879, - -2000-08-09 Zeev Suraski - - * zend_modules.h: that too - - * zend_extensions.h: Update API number - - * zend-parser.y - zend-scanner.l - zend.c - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - The patch we promised - redesigned the compilation/execution API: - Advantages: - - Smaller memory footprint for the op arrays - - Slightly faster compilation times (due to saved erealloc() calls and faster zend_op - initialization) - - include_once() & require_once() share the same file list - - Consistency between include() and require() - this mostly means that return() - works inside require()'d files just as it does in include() files (it used to - be meaningless in require()'d files, most of the time (see below)) - - Made require() consistent with itself. Before, if the argument was not a constant - string, require() took the include() behavior (with return()). - - Removed lots of duplicate code. - Bottom line - require() and include() are very similar now; require() is simply an include() - which isn't allowed to fail. Due to the erealloc() calls for large op arrays, require() - didn't end up being any faster than include() in the Zend engine. - -2000-08-05 Andi Gutmans - - * zend_execute.c: - - Use some more SEPARATE_ZVAL macros instead of replicated code. - -2000-08-05 Stanislav Malyshev - - * zend_execute.c: Fix memory leak - -2000-08-04 Andi Gutmans - - * zend.h - zend_execute.c: - - Beautify code. Try and use more macros for splitting instead of - - replicating the code everywhere. - -2000-08-02 Andi Gutmans - - * zend_execute.c: - Remove commented code - -2000-07-29 Zeev Suraski - - * zend-scanner.l - zend_execute.c: Fix filename issues - -2000-07-28 Stanislav Malyshev - - * zend_builtin_functions.c - zend_constants.c - zend_constants.h: - Make define return false and issue E_NOTICE when trying to redefine constant - -2000-07-27 Andi Gutmans - - * zend-scanner.l - zend_execute.c: Always store full filename as compiled file name - -2000-07-26 Zeev Suraski - - * zend_compile.c: - Fix a possible issue with runtime inheritence under fairly rare circumstance - and optimize a tiny bit - -2000-07-26 Stanislav Malyshev - - * zend_builtin_functions.c - zend_operators.c - zend_operators.h: Add strncasecmp function - -2000-07-18 Zeev Suraski - - * zend_builtin_functions.c: Forgot to link this function... - - * zend_hash.c: This is probably the oldest bug in PHP :) - Luckily it's unlikely we're ever actually bitten by this bug. - -2000-07-16 Andi Gutmans - - * zend_compile.c: - Beautify Zeev's patch a bit. - -2000-07-16 Zeev Suraski - - * zend_compile.c: Implement parent::foo() - -2000-07-15 Zeev Suraski - - * zend-parser.y - zend_compile.c: Add more extended_info calls - -2000-07-14 Zeev Suraski - - * zend_builtin_functions.c - zend_list.c - zend_list.h: Improve register_resource_ex() infrastructure - -2000-07-12 Thies C. Arntzen - - * zend.c: fix ZTS startup without filename (thanx purify!) - - * zend.c: unset active_symbol_table on zend-shutdown. - -2000-07-11 Zeev Suraski - - * zend_list.c: Another persistent hash - disable apply protection - - * zend.c - zend_hash.c - zend_hash.h: - Disable the hash_apply() protection on hashes that persist across requests - it's unsafe - because we may be aborted at any point - -2000-07-11 Stanislav Malyshev - - * zend_execute.c: - Fix a bug in passing second parameter of RECV_INIT with is_ref set - -2000-07-11 Andi Gutmans - - * zend_compile.h: - Oops. Too early in the morning - - * zend_compile.h: - Include iostream.h in C++. - -2000-07-09 Andi Gutmans - - * zend_execute.c: - Fix memory leak. - - * zend_execute.c: - Need to seperate if the hash isn't a reference - -2000-07-08 Andi Gutmans - - * zend.h: - Add zend_ulong - -2000-07-07 Stanislav Malyshev - - * zend_execute.c: Remove C++ commennts. - -2000-07-06 Andi Gutmans - - * zend-scanner.l: - - Remove code which has never been used (neither in PHP 3) - - * zend_compile.c: - - Make is_method_call() static and remove a couple of old lines - - * zend_execute.c - zend_extensions.h: - Yet another fix... - - * zend_execute.c: - One more... - - * zend_compile.c: - One more fix for the latest patch - - * zend_compile.c: - One dumb bug in my latest patch - - * zend-parser.y - zend_compile.c - zend_execute.c: - - Complex fix for solving a problem with objects & method calls. - - Previous version is tagged PRE_METHOD_CALL_SEPERATE_FIX_PATCH. - - I need to check this fix on a server so if it doesn't work I will revert - - it. - - * zend-scanner.l: - - Fix problem with newlines not being recognized under certain conditions - -2000-07-03 Andi Gutmans - - * zend_compile.c: - Fix bug #4120 - -2000-07-03 Stanislav Malyshev - - * zend_execute_API.c: Unblock SIGPROF signal when starting timer. - On Linux, this signal is blocked by default after first signal is run - -2000-07-03 sascha - - * FlexLexer.h - zend-scanner.h - zend_alloc.h - zend_compile.h - zend_constants.h - zend_dynamic_array.h - zend_execute.h - zend_globals.h - zend_hash.h - zend_highlight.h - zend_list.h - zend_operators.h - zend_static_allocator.h - zend_variables.h: - Replace macros which begin with an underscore through an appropiately - named macro. - -2000-07-02 sascha - - * zend.h - zend_API.h - zend_builtin_functions.h - zend_config.w32.h - zend_dynamic_array.h - zend_errors.h - zend_execute_locks.h - zend_extensions.h - zend_fast_cache.h - zend_globals_macros.h - zend_indent.h - zend_llist.h - zend_modules.h - zend_ptr_stack.h - zend_stack.h: Change header protection macros to conform to standard. - - Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment" - - All identifiers that begin with an underscore and either an uppercase - letter or another underscore are always reserved for any use by the - implementation. - -2000-07-02 Andi Gutmans - - * zend-parser.y: - Take #2 with tab size 4 - - * zend-parser.y: - - Beautify parser a bit. It still could do with some more at some point - - * zend_execute.h - zend_execute_API.c: - Forgot ZEND_API - -2000-06-30 Zeev Suraski - - * zend_config.w32.h: - Add a messagebox style that's safe to use from an ISAPI filter - - * zend_builtin_functions.c - zend_execute_API.c - zend_globals.h: error_reporting fix - -2000-06-29 Zeev Suraski - - * zend.c - zend.h: Add $context argument to error handler - -2000-06-28 Zeev Suraski - - * zend.c: Improve error handling code - - * zend-scanner.l: Be HTML friendly - -2000-06-28 Andi Gutmans - - * zend.h: version update - -2000-06-26 Zeev Suraski - - * zend.h - zend_constants.c - zend_extensions.h: - Make it possible to detect whether we're thread safe or not from PHP scripts and the php.ini - file - -2000-06-26 Andi Gutmans - - * zend_extensions.c: - Add another "\n" at the end of error messages. - -2000-06-26 Zeev Suraski - - * zend_execute_API.c: - Make max_execution_time work properly when set to 0 under Win32 (disable) - -2000-06-25 Andi Gutmans - - * zend.c: - I wrote a long msg but the commit didn't go through. - - So here is the short version: - - a) Start moving to binary opens in Windows - - b) Give checkuid_mode() a small face lift including the fopen-wrappers.c - - The mode to this function should at least be a #define but that is for - - another day. Anyway this whole stuff should be given more face lifts in - - the future. - -2000-06-24 Zeev Suraski - - * zend_alloc.c: Nuke a warning - -2000-06-23 Andi Gutmans - - * zend_static_allocator.c - zend_static_allocator.h: - Not returning a value anymore - - * zend_static_allocator.h: - Don't need SUCCESS/FAILURE anymore - - * zend_static_allocator.c - zend_static_allocator.h: - Add license - - * zend_static_allocator.c - zend_static_allocator.h: - - Commit static allocator structure which we might use in an upcoming Zend - - change - -2000-06-22 Andi Gutmans - - * zend-scanner.l: - Fix asp_tags. - - * zend_extensions.c: - Oops I miss-wrote that field - - * zend_extensions.c - zend_extensions.h: - - Change API version and make the error messages more meaningful. - - * zend_alloc.c - zend_alloc.h: - Change cache size and only initialize part of it. - -2000-06-22 Stanislav Malyshev - - * zend_alloc.c: - Cached-freed memory blocks should not be in "occupied" list - - * zend_alloc.c - zend_globals.h: Make cache counters to be unsigned int - Start collecting statistics after cache pre-fill - -2000-06-18 sascha - - * Zend.m4 - acinclude.m4 - zend.c: fp_except check for FreeBSD 1.0-2.2.5 - - * Zend.m4 - acconfig.h - zend_config.w32.h - zend_operators.h: Welcome zend_finite(n). - - This chooses the best combination of what is available: - - finite, isfinite, isinf, isnan - -2000-06-18 Stanislav Malyshev - - * zend.h - zend.c: Make error callback be publicly accessible - -2000-06-18 Andi Gutmans - - * zend.c: - Better FreeBSD fix. Does fp_except_t exist on 3.4? - - * zend.c: - - I don't know how this happened. I tested the bloody thing and I remember - - copy&pasting from code which used ~. - -2000-06-17 Zeev Suraski - - * zend_builtin_functions.c - zend_execute_API.c - zend_globals.h - zend_ptr_stack.c - zend_ptr_stack.h: - Add restore_error_handler() - error_handler's are now stored in a stack - - * zend-scanner.l - zend.c - zend_API.h - zend_execute_API.c: - Allow the symbol_table to be passed to call_user_function_ex() - - * zend-scanner.h - zend-scanner.l: Fix filenames and line numbers in ZTS mode - - * zend_hash.c - zend_hash.h: - Avoid crashing with recursive applies - limit apply nest level to 3 (I'm not aware of a place - in which applying recursively on the same hash makes sense with more than one nest level, but - 3 should be enough) - -2000-06-16 Zeev Suraski - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - Ok, this time here's some real Win32 system programming :) - Redesigned the timeout system using a single timeout thread and a single window, - and used a much quicker check. - -2000-06-16 Andi Gutmans - - * zend_execute_API.c: Fix UNIX build - -2000-06-16 Zeev Suraski - - * zend_execute.c: Macro it up the right way - - * zend_execute.c: Macro this up, so it can be moved to other places - - * zend.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - Move timeout code to Zend - - Implement timeouts in Win32 - -2000-06-15 Zeev Suraski - - * Zend.dsp - zend.c: - Fix non thread-safe mode - asp_tags/short_tags etc weren't getting initialized properly - -2000-06-15 Andi Gutmans - - * zend_list.c: *** empty log message *** - - * zend-parser.y: - Support multiple arguments to unset() - -2000-06-15 Thies C. Arntzen - - * zend_list.h: ups. - - * zend_list.h: - changed return type of ZEND_VERIFY_RESOURCE from FALSE to NULL - -2000-06-14 sascha - - * zend_operators.h - zend_operators.c: - Move some stuff to zend_operators.h which is required by the - moved inline functions. - -2000-06-14 Andi Gutmans - - * zend_alloc.c - zend_alloc.h: - More correct way of doing bit mask - -2000-06-14 sascha - - * Zend.m4: Only replaced C0X and C0x, but not c0x.. - - * Zend.m4 - zend_execute.h - zend_gcc_inline.c - zend_operators.h: - Rename C0x-inline to C9x-inline, and frame preprocessor directives in - zend_gcc_inline.c with #ifndef C9X_INLINE_SEMANTICS..#endif. - -2000-06-14 Andi Gutmans - - * ZendTS.dsp: - Make Win32 build - -2000-06-13 Andi Gutmans - - * zend_compile.c - zend_compile.h: Add to the API - -2000-06-13 sascha - - * Makefile.am - Zend.m4 - zend_API.h - zend_compile.h - zend_execute.h - zend_execute_API.c - zend_gcc_inline.c - zend_globals.h - zend_operators.c - zend_operators.h: Add optional support for C0x inline semantics. - - These are enabled by specifying `--enable-c0x-inline' on the command - line. We might add an autoconf check for this particular feature - later. - - * zend_llist.h: - Add llist_apply_func_t and make prototypes use the typedefs. - -2000-06-12 Zeev Suraski - - * zend_builtin_functions.c: Make Egon happy :) - - * zend_builtin_functions.c: - Return the previous error handler from set_error_handler() - - * zend_API.c - zend_API.h - zend_builtin_functions.c: - Avoid using E_CORE_* errorlevels in any place which is not in the global startup sequence - - * zend-parser.y - zend-scanner.l - zend.h - zend_compile.c: Get rid of - -2000-06-11 Andi Gutmans - - * zend.c: - Solve floating point precision crash on FreeBSD. - - * zend.c: - - Fixes crash problem on FreeBSD when losing precision. Need to still see - - how to detect we're on FreeBSD - -2000-06-11 Zeev Suraski - - * zend_API.c: Fix zend_get_parameters() - -2000-06-10 Andi Gutmans - - * zend_operators.c: - - Fixed problem when using uninitialized values in comparisons with strings. - - They behave as empty strings again just like in PHP 3. - -2000-06-10 Zeev Suraski - - * zend_execute.c: - I can't think of a reason of why it should just be a notice... Make it a warning, like it was in PHP 3. - - * zend_API.c - zend_builtin_functions.c: Fix bug #4768 - -2000-06-09 Andrei Zmievski - - * zend_builtin_functions.c - zend_hash.h: Made an alias for hash apply with arguments. - -2000-06-09 Andi Gutmans - - * zend_alloc.c: - Forgot to remove the FIXME - - * zend_alloc.c: - Make the memory limit accurate - - * zend_alloc.c: - Fix cache initialization - - * zend_alloc.c - zend_alloc.h: - - Allocate and cache in 8 byte blocks. Most allocators anyway use 8 byte - - blocks. This should help fragmentation and cache hits. - - The old tree is tagged as PRE_EIGHT_BYTE_ALLOC_PATCH - -2000-06-09 Zeev Suraski - - * zend_execute.c: Fix bug #4933 - - * zend_builtin_functions.c: Fixed bug #4819 - -2000-06-09 Andi Gutmans - - * zend_modules.h: - - Time to change it. We changed register_internal_class() -> - - zend_register_internal_class() - - * zend_API.c - zend_API.h - zend_compile.c - zend_compile.h: - Andrei, this is for you! - - Add zend_register_internal_class_ex() which allows you to specify a - - parent to inherit from. You can either specify the parent directly or via - - its name. - - * zend-parser.y - zend-scanner.l: - Typo - - * zend_execute.c: - Remove old obsolete code. - - * zend_execute.c: - Make unset consistent with the way array offsets work - -2000-06-09 Stanislav Malyshev - - * zend_execute.c: Handle unset with empty key - -2000-06-09 Andi Gutmans - - * zend_API.c - zend_API.h: - - Change register_internal_class to zend_register_internal_class for - - consistency. - - Andrei: I'm still thinking about the _ex you want me to implement - -2000-06-08 sascha - - * Zend.m4 - acconfig.h: Clean up acconfig.h - - * zend_execute_API.c - zend_operators.c: Add a couple of casts - -2000-06-06 Zeev Suraski - - * zend.c - zend.h - zend_compile.c: - Enable asp_tags/short_tags/allow_call_time_pass_by_reference to work on a per-directory - basis as well - -2000-06-06 sascha - - * zend_API.c: - Add newline at the end of the file (breaks at least SCO and Tru64 C compiler). - -2000-06-05 Andi Gutmans - - * zend-scanner.l: - Revert internazionalization fix. - - * zend_builtin_functions.c: - Complete change to create_function() - -2000-06-04 Zeev Suraski - - * zend_compile.c - zend_execute_API.c: - Change shutdown order to sort out a crash when assigning a resource id to a static. - - * zend_hash.c - zend_hash.h - zend_operators.c: - Support unordered hash comparisons - - Make == perform an unordered comparison with arrays/objects, and === perform an ordered comparison - - * zend_builtin_functions.c: Rename lambda() - -2000-06-03 Zeev Suraski - - * zend_hash.c - zend_hash.h - zend_operators.c - zend_operators.h: - Support comparisons of arrays (with arrays) and objects (with objects) - -2000-06-03 Andi Gutmans - - * zend.c: - Change #if to #ifdef. - -2000-06-03 Zeev Suraski - - * ZendTS.dsp - zend.c: Don't take chances with new include files - - * zend_execute_API.c: - Improve call_user_function() to support array($obj, $method) - - * zend-parser.y - zend.h - zend_operators.c: - Export normalize_bool - - This global/static syntax fix brought us back to the 4 documented conflicts - - * zend_builtin_functions.c: Fix a lambda() bug - - * zend_builtin_functions.c: Add missing { - - * zend_globals.h - zend_hash.c - ZendTS.dsp - zend-scanner.l - zend.c - zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h: - Fix Win32 compilation (Use winsock2.h from now on) - - Add lambda() support - -2000-06-02 Andi Gutmans - - * zend-parser.y: - global/static require a trailing ';' - -2000-06-02 Zeev Suraski - - * zend_builtin_functions.c: Update error code - - * zend.c - zend.h - zend_config.w32.h: Nuke the old error code, use the new one - -2000-05-31 Zeev Suraski - - * zend.h: IS_BC isn't really being used, but still... - - * zend-parser.y - zend.h - zend_API.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.h - zend_variables.c: - Fix a bug in static initializers/default values/class member variables that contained - array values - -2000-05-29 Zeev Suraski - - * zend_API.c - zend_API.h: Allow disabling of functions for security reasons - -2000-05-28 Andi Gutmans - - * zend_operators.c: - - Use pointer arithmetic to speed up the function a bit - - * Zend.m4: - This should have been done for 4.0.0. - - Default build is without debug now. Use --enable-debug if you want a - - debug build which includes leak/memory overwrite etc. detection - -2000-05-26 Andi Gutmans - - * zend-scanner.l - zend_operators.c - zend_operators.h: - - Fixed scanning decimal numbers in internationalized environments. They should - - always be in standard US format e.g. 23.3 - -2000-05-25 Zeev Suraski - - * zend_compile.c: - Fix a crash bug in certain situations of class redeclarations - -2000-05-24 Thies C. Arntzen - - * zend_hash.h: rename hastable -> _hashtable to avoid clashes - - * zend-scanner.l: - add rdbuf() to our own istdiostream implementation, allowing C++ compile - using SUN and SGI native compilers. (by Jayakumar Muthukumarasamy ) - -2000-05-22 Zeev Suraski - - * zend.c: - Remove ugly Ltd. - -2000-05-21 Sam Ruby - - * zend.c: Windows build failure - -2000-05-21 Andi Gutmans - - * zend.c - zend_compile.h: - - Fix Apache php source highlighting mode. It was crashing due to the - - module shutdown functions being called when the startup functions weren't - - being called. - - * zend.h - zend_extensions.h: - Get ready for release - -2000-05-19 Zeev Suraski - - * zend_highlight.c - zend_highlight.h: Open these up for the API - -2000-05-18 Zeev Suraski - - * zend_alloc.c: Do it in thread unsafe mode for now. - -2000-05-18 sascha - - * zend_alloc.c: Kill warnings - -2000-05-18 Andi Gutmans - - * zend_alloc.c: - Do this someplace else. - - * zend_execute.c - zend_operators.c: - - Fix include() when used on resources (shouldn't work but shouldn't crash - either). - -2000-05-18 Andrei Zmievski - - * zend_operators.c: - Update for sort functions - user can now specify sort type. - -2000-05-17 Andi Gutmans - - * zend_operators.h - zend_operators.c: - - Add support for string_compare_function() and number_compare_function(). - UNTESTED! - -2000-05-17 Zeev Suraski - - * zend_operators.c: Normalize results of compare_function() - - * zend-scanner.l: - Fix crash if %> is encountered in HTML while ASP-tags are disabled - -2000-05-17 Andi Gutmans - - * zend_opcode.c: Fix order - -2000-05-17 sascha - - * zend_operators.h: Add missing prototype - -2000-05-16 Zeev Suraski - - * zend_alloc.c: - - Small optimization. Filling up the Cache helps performance. - -2000-05-12 sascha - - * Makefile.am: Fix parallel makes on BSD - -2000-05-11 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.h - zend_operators.c: - Get rid of chval - it's really not necessary and seems to be confusing people - - * zend_compile.c: Refined fix - - * zend_compile.c: - Fix a memory corruption bug with by-ref function arguments - -2000-05-10 Andi Gutmans - - * zend_extensions.h: - Bump up Zend extension version number - -2000-05-10 Thies C. Arntzen - - * zend_compile.c: make waning readable - -2000-05-08 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_opcode.c: Thoroughly initialize IS_UNUSED for proper cleanup - - * zend.h: - Change Zend Engine version number - - * zend_alloc.c: - Return real size allocated - -2000-05-08 Zeev Suraski - - * zend_operators.c: Make zend_binary_strcasecmp compile again - -2000-05-08 sascha - - * zend_operators.c: Make strcasecmp() act correctly WRT SUS II. - - Patch by: hholzgra@php.net - PR: #3556 - -2000-05-06 Andi Gutmans - - * zend_execute.h - zend_execute_API.c: - Make zend_eval_string() return SUCCESS/FAILURE - - * zend_execute.c: - - Make $obj->test = 5; work again (assigning to uninitialized objects) - -2000-05-05 sascha - - * Zend.m4: - Linking directly against libc might result in unexpected behaviour. - We check for dlopen in libdl first, and check then whether dlopen exists. - -2000-05-03 Andi Gutmans - - * zend_compile.h: - Change fetch_type to be zend_uint - - * zend_compile.c - zend_execute.c: - Change the place CAST uses for the op_type - -2000-05-02 Zeev Suraski - - * zend_hash.c - zend_hash.h: - Change zend_hash_get_current_key_ex() to also return the string length - -2000-05-02 sascha - - * zend_API.c: - Fix segfault occuring when a temporary module was unloaded and if this - module did not have a request shutdown function. - - * zend_API.h: - Add ZEND_GET_MODULE(name). This is a short-cut for the common - get_module function. - -2000-05-01 sascha - - * zend.c: - Source file does not end with a newline. Some old compilers don't like that. - -2000-05-01 Andrei Zmievski - - * zend_builtin_functions.c: Added a way to get all declared classes. - -2000-05-01 sascha - - * Makefile.am: Fix dependency - -2000-04-29 Zeev Suraski - - * zend_extensions.h - zend_opcode.c: - Pass the op_array to the ctor/dtor, instead of just the resource - - * zend_extensions.c: crash fix - - * zend_extensions.c - zend_extensions.h - zend_llist.c - zend_llist.h: - Add zend_llist_apply_with_arguments() - - Add a message handler to the extensions - - * zend_compile.h - zend_opcode.c: - Fix possible bug with extension dtors being called without the ctors being called first - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_opcode.c: Beautify - -2000-04-28 Zeev Suraski - - * zend.c - zend_extensions.c - zend_extensions.h: Fix a bug in the resource dispencer - - * zend_operators.c - zend_operators.h: Make convert_to_string() allocations traceable - -2000-04-27 Zeev Suraski - - * zend_extensions.h - zend-scanner.l - zend.c - zend_compile.c - zend_compile.h - zend_execute.c: *** empty log message *** - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c: Change to using the #define's - - * zend.c - zend.h: More error handling work (still completely disabled) - -2000-04-26 Zeev Suraski - - * zend_execute_API.c - zend_variables.c: Fix - forgot to split away if refcount>1 - -2000-04-25 Zeev Suraski - - * zend_extensions.c: Fix bug - - * zend.h: We'll need two... - - * zend_hash.h: Add useful macros - -2000-04-25 Andi Gutmans - - * zend_llist.c: - Fix persistence of llist - -2000-04-24 Zeev Suraski - - * zend_compile.c: - Forgot to keep the ':' in the class_name - - * zend_API.c: Correct fix - -2000-04-24 Thies C. Arntzen - - * zend_API.c: MODULE_TEMPORARY should get a call to RSHUTDOWN as well! - - * zend.c: - fixed shutdown crash if MSHUTDOWN tries to php_error() something. - -2000-04-21 Thies C. Arntzen - - * zend_variables.c - zend_variables.h: export zval_add-ref and zvale_del_ref - -2000-04-20 Zeev Suraski - - * zend_operators.h: - Change macro names from Z to Z_ - - * zend_operators.h: Add some macros for nicer zval handling - -2000-04-20 Andrei Zmievski - - * zend_operators.c: Do proper ieeefp.h check. - -2000-04-20 Thies C. Arntzen - - * zend_operators.c: - compile before commit! compile before commit! compile before commit! - - * zend_operators.c: - revert andrei's path (i can't compile anymore on linux) - we're always using #ifndef HAVE_BLA instead of if !HAVE_BLA and if we need ieeefp.h for some weird platform (which one is that?) we need an autoconf check for it. - -2000-04-19 Andrei Zmievski - - * zend_operators.c: Include proper files for finite. - -2000-04-19 Zeev Suraski - - * zend.c - zend.h - zend_builtin_functions.c - zend_execute_API.c - zend_globals.h: - Initial support for trapping errors (not complete and disabled; will be enabled only - post-PHP 4.0.0) - - * zend_builtin_functions.c - zend_constants.c - zend_errors.h: - - Renamed get_used_files() to get_required_files() for consistency - - Documented some functions - - Added user-level warning messages - - Added user_error() - -2000-04-19 Andi Gutmans - - * zend_opcode.c - zend_compile.h: - Export pass_include() for Windows - -2000-04-18 Zeev Suraski - - * zend_operators.h: - Add convert_to_writable_*_ex() macros (unused at this time) - -2000-04-17 Andi Gutmans - - * zend_compile.c - zend_execute.c: - Fix order of JMPZNZ arguments - -2000-04-17 Thies C. Arntzen - - * zend_operators.c: ups, finite is already a macro on Win32 - - * Zend.m4 - zend_operators.c: HPUX11 only has isfinite() - -2000-04-15 Andi Gutmans - - * zend-scanner.l: - Fix leak in require_once() - -2000-04-15 Thies C. Arntzen - - * zend_extensions.c: fixes compile on platforms without dl() support. - -2000-04-15 Zeev Suraski - - * zend.c: Fix ZTS - -2000-04-15 Andi Gutmans - - * zend-scanner.l: - "use" is not yet supported; instead use include_once() or require_once() - for the time being (Andi, Zend library) - -2000-04-15 Zeev Suraski - - * zend.c - zend_API.c - zend_compile.c - zend_execute_API.c - zend_list.c - zend_list.h: - Clean up resource lists namespace - - Prepare extended resource list destructor APIs (currently unused) - -2000-04-13 Zeev Suraski - - * zend_operators.c: - Fix a memory leak when using assign-op bitwise operators on strings - -2000-04-12 Zeev Suraski - - * zend_execute.c: *** empty log message *** - -2000-04-11 Andi Gutmans - - * zend_execute_API.c: - Fix memory leak - -2000-04-11 Zeev Suraski - - * zend_execute.c: Fix warnings - - * zend_execute.c: Fix fd leak in include_once() - -2000-04-10 Andi Gutmans - - * zend-scanner.l - zend_execute.c: - - -2000-04-10 Zeev Suraski - - * zend.h - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_operators.c: Fix object overloading support - -2000-04-10 Andi Gutmans - - * zend_execute.c: - Add warnings - - * zend_compile.c: - Two more places needed changing - -2000-04-10 Zeev Suraski - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.h: Clean up last/size definitions - -2000-04-09 Zeev Suraski - - * zend_compile.h: *** empty log message *** - -2000-04-07 Zeev Suraski - - * zend_execute.c: Thoroughly fix include_once() - - * zend_execute.c: Fix include_once() - -2000-04-06 Andi Gutmans - - * zend-parser.y: *** empty log message *** - - * zend_execute.c - zend_execute.h: Initial preparation for OO overloading patch - -2000-04-05 Andi Gutmans - - * zend_extensions.h: - Bump up version number - - * zend_compile.c - zend_execute.c: - FIx JMPZNZ - -2000-04-03 Zeev Suraski - - * zend_list.c: - Fix the problem with dl()'d modules not freeing their resources properly - -2000-04-01 Zeev Suraski - - * zend_API.h - zend_config.w32.h: *** empty log message *** - - * acconfig.h: Have a standard way of exporting symbols - - * zend_modules.h: Use int - - * zend_API.h: Generalize some common thread-safety stuff - - * zend_modules.h: Have a standard entry for the globals id - -2000-03-31 Zeev Suraski - - * zend_compile.c: - The previous fix ended up being broken, this one should do it - -2000-03-31 Andi Gutmans - - * zend_compile.c: - Fix bug - -2000-03-30 Zeev Suraski - - * zend_extensions.c: Fix zend_register_extension() - -2000-03-30 Andi Gutmans - - * zend_extensions.h: - Bump up API number after Lars' change - -2000-03-30 sascha - - * Makefile.am: Give another hint to BSD makes - - * Makefile.am: - Specifically mention $(srcdir), so that OpenBSD's make gets it - -2000-03-29 Zeev Suraski - - * zend_stack.c - zend_stack.h - zend_compile.c: - - Make the argument order for the stack applies more consistent with other Zend - data structures - - Fix a possible corruption problem due to switch() C-level optimization - -2000-03-29 Torben Wilson - - * zend-parser.y - zend-scanner.l - zend_compile.h - zend_execute.c - zend_opcode.c - zend_operators.c - zend_operators.h: - - Added !== (is not identical) operator. - -2000-03-29 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: *** empty log message *** - -2000-03-29 Andi Gutmans - - * zend_API.h: - - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that - Zend'ish modules don't need to mix PHP & Zend notation. - -2000-03-28 Zeev Suraski - - * zend_builtin_functions.c: - The checks for func_num_args() and friends were broken - fixed - -2000-03-27 Sam Ruby - - * Zend.dsp: Remove debug libraries from debug build - -2000-03-26 Andi Gutmans - - * zend_execute.c - zend_execute_API.c - zend_API.c - zend_builtin_functions.c: - Stop zend_func_args() and co. from crashing - - * zend.h: - - Didn't see Thies' commit message although I can't really see how it would - make a difference - - * zend.h - zend_opcode.c: - Include Andrea's fix for alloca.h - -2000-03-26 Thies C. Arntzen - - * zend.h - zend_execute.c: - needs to be included before we define macros calling alloca() - atleast using SGI's cc - should not harm other platforms (i hope) - - * zend_opcode.c: fix cast - -2000-03-25 Andi Gutmans - - * zend_alloc.c - zend_alloc.h: *** empty log message *** - -2000-03-25 Zeev Suraski - - * zend-parser.y - zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_variables.c: - Some header dependencies cleanup - - Generalize zval_print() and zval_print_r() - -2000-03-25 Sam Ruby - - * zend.h: RTLD_NOW => RTLD_LAZY|RTLD_GLOBAL - -2000-03-25 Zeev Suraski - - * Zend.dsp: Update dsp's - -2000-03-24 Zeev Suraski - - * zend_execute.c: - - Fixed a crash when sending a non-variable expression to a runtime-bound function - that expected a reference. - -2000-03-24 Andi Gutmans - - * zend_API.c - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_hash.c - zend_hash.h: - Nuke hash_*_ptr functions - -2000-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Use WRONG_PARAM_COUNT. - -2000-03-23 Zeev Suraski - - * zend_builtin_functions.c: - Make it compile - -2000-03-23 Andrei Zmievski - - * zend_builtin_functions.c: Added get_class_methods(). - -2000-03-22 Andi Gutmans - - * zend.h: - Change Zend version as API has changed - -2000-03-22 Zeev Suraski - - * zend_operators.c: - Wrong fix - - * zend_operators.c: - Only free when result != op1 - -2000-03-21 Andi Gutmans - - * zend.c - zend.h: - - Change zend_startup to accept a flag for starting builtin functions - - * zend.h - zend_API.h: - Move #defines - -2000-03-19 Thies C. Arntzen - - * zend_compile.h: kill warning - -2000-03-18 Andi Gutmans - - * zend.h: - Fix compile problem on FreeBSD - - * zend.h: - - No reason for refcount to be signed and move to zend_* typedefs - -2000-03-18 Thies C. Arntzen - - * zend.c: renamed _string_value_() to __string_value(). - -2000-03-18 Zeev Suraski - - * zend_builtin_functions.c: - The third argument to define() wasn't working right, fixed - - * zend_execute.c: - false wouldn't automaticaly switch to an array type, which resulted in an - incompatibility with PHP 3. Fixed. - -2000-03-16 Thies C. Arntzen - - * zend.c: renamed "to_string" -> "_string_value_" - -2000-03-15 Zeev Suraski - - * zend-scanner.l - zend.h - zend_execute.c: - Fix newly introduced problem reported by Sam Ruby - -2000-03-15 Andrei Zmievski - - * zend_hash.c - zend_hash.h: - Make zend_hash_move_forward()/zenv_hash_move_backwards() a little smarter. - -2000-03-15 Zeev Suraski - - * zend_opcode.c: - Fix warning (I thought I fixed this one before) - -2000-03-14 Andrei Zmievski - - * zend_llist.c - zend_llist.h: Implemented external list traversing. - -2000-03-14 Andi Gutmans - - * zend-parser.y: - - Allow array(1,2,3,) i.e. with trailing comma. You can only have one - trailing comma. - -2000-03-13 Zeev Suraski - - * zend_compile.c: - - - * zend_compile.c: - Spare a byte :) - -2000-03-13 Andi Gutmans - - * zend_compile.h - zend_modules.h: - Another zend_uchar - - * zend_compile.c: *** empty log message *** - - * zend.h - zend_compile.h: - - define zend_uint and zend_uchar and use them in a few places - -2000-03-13 Andrei Zmievski - - * zend_hash.c - zend_hash.h: - Introduced a way to traverse hashes through external pointers. - -2000-03-13 Andi Gutmans - - * zend_compile.h: - Change type from int -> char - -2000-03-13 Zeev Suraski - - * zend-scanner.l: - Fix filename/lineno initialization for do_return - -2000-03-12 Zeev Suraski - - * zend_builtin_functions.c - zend_modules.h: - - -2000-03-11 Andi Gutmans - - * zend_execute.c: - - Remove inline from functions which are pretty large and besides eating up - memory in compile time probably doesn't boost performance. - -2000-03-10 Andi Gutmans - - * zend_operators.c: - - Seems to be a problem here with the return value not being set - - * zend-parser.y - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - Quick way of supporting include_once(). - Good enough for RC1. - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h: - Support require_once(). - - * zend_compile.h - zend_execute.c: - Cleanup old IMPORT stuff - - * zend-parser.y - zend-scanner.l: - - Nuke import, add include_once and include_require scanner/parser rules. - Hope to nuke use too :) - - * zend_modules.h: - That broke the Win32 build - - * zend_modules.h: - Fix a bug and define an API_NO for the ZEND_MODULE_API - - * zend_modules.h: - zend_config.h is enough - - * zend_modules.h: - Save ZEND_DEBUG, ZTS, ZEND_API information - -2000-03-09 Andi Gutmans - - * zend_highlight.c: - Fix bug in syntax highlighter - -2000-03-06 stig - - * zend_modules.h: added GINIT_FUNC_ARGS and GINIT_FUNC_ARGS_PASSTHRU - -2000-03-06 Zeev Suraski - - * zend_extensions.h: - Bump up Zend's API version - -2000-03-06 stig - - * zend_modules.h: Added ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU. - -2000-03-06 Andi Gutmans - - * zend-scanner.l: - Fix memory leak - - * zend.c: - Missed one - -2000-03-06 Sam Ruby - - * zend.c - zend.h: Unresolved externs - -2000-03-06 Zeev Suraski - - * zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h - LICENSE - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_modules.h: It's official now... - -2000-03-05 Zeev Suraski - - * ZendTS.dsp - zend.c - zend.h: Wrap some commonly unused callbacks - -2000-03-04 Zeev Suraski - - * zend-scanner.l: - The default return value from include() and eval() changed from 1 to 0 - unintentionally after the old return-reference patches - fixed - -2000-03-02 Sam Ruby - - * zend_config.w32.h: Fix Win32 build breakage - -2000-03-01 Andi Gutmans - - * zend.c: - Upgrade to year 2000 - - * ZEND_CHANGES - zend_compile.c - zend_execute.c: - Fix typos - -2000-03-01 Thies C. Arntzen - - * zend_operators.c: now - -2000-02-27 Egon Schmid - - * zend_builtin_functions.c: Fixed some protos. - -2000-02-26 Sam Ruby - - * zend_builtin_functions.c: compilation error - Win32 - -2000-02-26 Andrei Zmievski - - * zend_builtin_functions.c: - Added get_class_vars() and get_object_vars() functions. - - * zend_execute.c: Fix typo. - -2000-02-26 Zeev Suraski - - * zend_operators.c: Fix comparisons of "inf"=="inf" and "-inf"=="-inf" - -2000-02-25 Zeev Suraski - - * zend_fast_cache.h - zend_variables.c: Use the fast cache here too - -2000-02-19 Zeev Suraski - - * zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_builtin_functions.c - zend_builtin_functions.h - zend_compile.c - zend_compile.h - zend_config.w32.h - zend_constants.c - zend_constants.h - zend_dynamic_array.c - zend_dynamic_array.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: (c) patch - - * zend_API.c - zend_API.h - zend_fast_cache.h - zend_hash.c: - - Fix a nasty bug in the hash, introduced in the recent migration to macros - - Make array_init() and friends trackable - - * zend_API.c - zend_API.h - zend_execute.c - zend_operators.c - zend_operators.h: Generalize macros - -2000-02-18 Zeev Suraski - - * zend-scanner.l: *** empty log message *** - -2000-02-18 sascha - - * zend_llist.c - zend_llist.h: - Get rid of second declaration of compare_func_t. Either put in a common - header file or prefix it with i.e. zend_llist_ - -2000-02-18 Andi Gutmans - - * zend_llist.c - zend_llist.h: - - Quick and dirty hack for supporting sorts. Improve later on when I wake up. - - * ZendTS.dsp - zend_dynamic_array.c: - Didn't compile on Win32 - - * zend_dynamic_array.c: - - Tiny change (I know I don't have to cast malloc() to void * but I like - casting my malloc()'s) - - * Makefile.am - zend_dynamic_array.c - zend_dynamic_array.h: - - Preliminary support for dynamic arrays. I need it on order to try out a - new hash implementation. It isn't used anywhere. - -2000-02-17 Andi Gutmans - - * zend.c - zend.h: - Add ZEND_API - -2000-02-16 Andi Gutmans - - * zend_execute.c: -Fix bug 3504 concerning leaks with unset() - - * zend_execute.c - zend.h - zend_compile.h: - Hopefully fix Thies' bug report. - -2000-02-16 Zeev Suraski - - * zend_builtin_functions.c: - ZEND_TEST_EXCEPTIONS should be defined/undefined before it's checked - -2000-02-16 Andi Gutmans - - * zend_execute.c: - Fix bug #3309 - -2000-02-14 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Put in the infrastructure for the unset() fix. Right now it has the old - behavior but I just need time tomorrow to add the correct behavior. - - * zend_builtin_functions.c: - Fix bug in func_get_arg() - - Get rid of compiler warnings for unused function crash() - -2000-02-13 Zeev Suraski - - * zend_constants.c: Fix a memory leak - -2000-02-13 Andi Gutmans - - * zend_hash.c: - Save a function call one very hash_add - - * zend_hash.c - zend_hash.h: - - Make startup a bit faster by changing some hash_update()'s and hash_add()'s - to hash_update_ptr()/hash_add_ptr() - - * zend_hash.c: - - Fix a couple of potential bugs where we were using emalloc/efree instead - of pemalloc/pefree. - - Fix a bug were we potentially would be freeing the key by mistake - -2000-02-13 Zeev Suraski - - * zend_builtin_functions.c: *** empty log message *** - - * zend_operators.c: Make (array) false == array() and not array(false) - -2000-02-11 Andrei Zmievski - - * zend_hash.c - zend_hash.h: Made a couple of typedefs for zend_hash_apply_*() calls. - -2000-02-11 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_config.w32.h: Update .dsp's - - * zend-scanner.l - zend.h - zend_API.h - zend_alloc.c - zend_config.w32.h - zend_constants.c - zend_execute.c - zend_extensions.c: Fine tune Andi's patch - -2000-02-10 Andi Gutmans - - * zend.h: - #define ZEND_WIN32 differently - - * zend-scanner.l - zend.h - zend_API.h - zend_alloc.c - zend_constants.c - zend_execute.c - zend_extensions.c: - Finally beautify those WIN32|WINNT checks - - * zend_execute.c: - Shouldn't be there - - * zend_execute.c: - Cleanup the code - -2000-02-09 Zeev Suraski - - * zend-parser.y - zend_execute.c: - Fix last known nasty bugs in Zend. It'll be cool if there are no new ones :) - -2000-02-09 Thies C. Arntzen - - * zend_execute.c: foreach() works now for objects as well. - -2000-02-08 Zeev Suraski - - * zend_operators.c: Fix declaration - - * zend_execute.c: Fix an elusive bug - -2000-02-08 Andrei Zmievski - - * zend_operators.c: Fix up the patch. - - * zend_builtin_functions.c - zend_operators.c - zend_operators.h: Patches from Walter for strncmp() stuff. - -2000-02-07 Zeev Suraski - - * zend_highlight.c: Remove old unnecessary check - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_highlight.c: - Syntax highlighting was erronously emitting more than one semicolon and/or garbage with heredocs - -2000-02-06 Andi Gutmans - - * zend_compile.c: - - Support the string offset syntax $a{2} with the regular array opcodes. - Will need to write new opcodes sometime but right now it's good enough - to announce the change to this string offset syntax for beta 4. - -2000-02-05 Andi Gutmans - - * zend-parser.y - zend_compile.c: - - This hopefully fixes the list($a, $a) = array(1,2) crash, i.e. when list - by mistake contains the same variable twice. - - BTW, there is no defined order of assignment. The value of $a after the - previous example is undefined, and should not be assumed to be either 1 - nor 2. - -2000-02-05 Zeev Suraski - - * zend_execute.c: More cleanup - - * zend.h - zend_builtin_functions.c - zend_execute.c - zend_execute_API.c: Pass the executor globals to internal functions - - * zend.c - zend.h - zend_API.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_modules.h - zend_variables.c: - Stop passing list/plist to internal functions - - Add a typedef for the pCopyConstructor function pointer - - Minor hacks - - * zend-scanner.l: - That was the broken downcasting that prevented the interactive C++ mode from working properly under UNIX - -2000-02-04 Zeev Suraski - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Maintain a state of whether we're compiling and/or executing - -2000-02-03 Andrei Zmievski - - * zend_API.c - zend_API.h: *** empty log message *** - -2000-02-02 Zeev Suraski - - * zend_API.c: - Fix built-in classes with more than 5 methods - - * zend_compile.c: - - Fix the annoying problem with list(), that surfaced up after our recent cleaning - patches - -2000-02-01 Andrei Zmievski - - * zend_API.c - zend_API.h: Added add_property_unset() and add_property_bool(). - -2000-02-01 Zeev Suraski - - * ZendTS.dsp - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_execute_locks.h: Improve dependencies - - * zend_execute.c: Sort out a gdb problem - - * zend_execute.c: Fix warning - -2000-02-01 Andi Gutmans - - * zend_compile.c - zend_execute_API.c - zend_globals.h: - Get rid of remains of garbage. - - This should fix Thies' UMR - -2000-02-01 Thies C. Arntzen - - * zend_execute_API.c: - moved destroying of garbage before resource-list gets destroyed - (see my previous mail) - zeev, andi - please comment! - - * zend.c: added missing break. - - * zend_hash.c - zend_hash.h: - took out zend_hash_pointer_update() & zend_hash_pointer_index_update_or_next_insert() - i really prefer link-errors instead of runtime-errors, don't you? - -2000-01-31 Andi Gutmans - - * zend_compile.h: - This has to always be done. - -2000-01-31 Zeev Suraski - - * zend-parser.y - zend_compile.h - zend_execute.c - zend_execute_API.c: - Optimized garbage mechanism - - Fixed another buglet in the parser - - * zend-parser.y - zend_alloc.c - zend_execute.c - zend_fast_cache.h: - Fix foreach() - - Fix indirect reference with object properties - -2000-01-30 Andi Gutmans - - * zend_execute.c: - - Fix the bug Thies found where I forgot to change a break; to NEXT_OPCODE(); - - If you find anymore let me know - - * zend_alloc.h: - Run it on align_test - -2000-01-29 Zeev Suraski - - * zend_compile.c: Fix ``'s - - * zend-parser.y - zend-scanner.l - zend_compile.h: Fix require() - -2000-01-29 Andi Gutmans - - * zend-parser.y: - Get rid of another rule which isn't needed. - - * zend-parser.y - zend_compile.c - zend_compile.h: - - Add parser support for string offsets. This added three shift/reduce - conflicts but they all seem to be fine. - - Cleaned up the parsing rules a bit and made them much more compact and - elegant. - - Please CVS update and see that I didn't break anything. - - * zend_alloc.h: - - This will save some memory w/ GCC compilers on some platforms - - * zend_execute.c: - Yet another tiny optimization. - -2000-01-28 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_execute.c: - Make loop a bit faster. - - * zend.h: - Make sure its use is understood. - - * zend.h - zend_execute.c: - Double the speed of some key switch() tests for Win32. - - * zend_execute.c: - - This makes the switch() statement twice as quick. Moving to enum - might make this a general speed up for other platforms too - -2000-01-26 Andi Gutmans - - * zend_execute_API.c: - Keep objects as references. - - * zend_execute_API.c - zend_opcode.c: - - Allow is_ref to become 0 in case the refcount is back to 1. - -2000-01-24 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - Make foreach() now copy the array but use the original array. It can - still be optimized A LOT but it's only a performance issue and not - a feature issue. - -2000-01-24 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_operators.c - zend_operators.h: - Implement declare() with declarables framework - - Implement ticks - Germany&Norway - 5 points! - - * zend_execute.c - zend_execute_API.c: Fixes - -2000-01-22 Zeev Suraski - - * zend_execute_API.c: Fix an elusive bug - -2000-01-20 Zeev Suraski - - * zend_hash.c: Add some order... - - * zend_hash.c: Indentation fixes - -2000-01-19 Andi Gutmans - - * zend_hash.c: - Optimize zend_hash_del a tiny bit. - - * zend_hash.c - zend_hash.h: - Hopefully fix the hash problem. - - * zend_hash.c: - Hrm I'm not concentrating - - * zend_hash.c: - - Actually the destructor should run after the data is already detached - from the hash but before the bucket is freed. - - * zend_hash.c: - - Rollback hash_apply and friends. They assume now that hash_del is reentrant - as it first applies the destructor and only later nukes the bucket - - * zend_hash.c: - - Run destructor before the hash structure is modified, thus, making - hash_del, reentrant (BLOCK_INTERRUPTIONS needs to be made a counter now). - - * zend_hash.c: - Undo a bug we introduced. (Another one out there). - -2000-01-19 Thies C. Arntzen - - * zend_API.h: - RETURN_NULL -> RETURN_NULL() // we don't want macros without an argumnet - -2000-01-18 Zeev Suraski - - * zend_execute.c: Leak fix - -2000-01-18 Thies C. Arntzen - - * zend_API.h: RETURN_NULL & RETVAL_NULL don't need (). - -2000-01-17 Thies C. Arntzen - - * zend_hash.c: use defines - -2000-01-17 Zeev Suraski - - * zend_hash.c - zend_hash.h - zend_variables.c: Get rid of the IsPointer functionality in the hash. - - * zend_hash.c: - Fixes a newly introduced bug in the hash - - * zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_modules.h - zend_opcode.c - zend_variables.c - zend_variables.h: - Destructors no longer return ints, the low level problem it was intended to solve is long gone now... - -2000-01-16 Zeev Suraski - - * zend.c - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h: - - Make zend_hash_apply() (and friends) reentrant and much, much quicker - - Introduce zend_hash_graceful_destroy(), which allows the destructor functions to - use zend_hash_apply() and/or zend_hash_graceful_destroy() - - Switch to zend_hash_graceful_destroy() in the resource list shutdowns - - * zend.c - zend_compile.c - zend_compile.h: - Allow module startup to be separate from the compiler/executor startup - -2000-01-16 Thies C. Arntzen - - * zend_hash.c: make the ht->inconsistent stuff less ugly:) - -2000-01-15 Zeev Suraski - - * zend_execute_API.c - zend_list.c: Fix a bug in call_user_function_ex() - - * zend-parser.y: - Added support for $foo->{$bar}["foobar"] notation (was supported in PHP 3) - -2000-01-15 Thies C. Arntzen - - * zend_hash.c - zend_hash.h: - if ZEND_DEBUG mode is on we'll now see warnings when a HashTable is accessed - while it's inconsistent. - - Zeev, Andi - you welcome to revert this patch if you don't like it - i find it - useful! accesssing inconsistent hashtables is one of the hardest things to track! - -2000-01-14 Andrei Zmievski - - * zend_highlight.c: - Since we're highlighting code, put and around the code. - -2000-01-13 Zeev Suraski - - * zend.h - zend_config.w32.h: Make Win32 compile again - -2000-01-12 sascha - - * acconfig.h - zend.h: - Move dl stuff from acconfig.h into zend.h. That allows us finer control - when it comes to suppressing dlfcn.h. - -2000-01-09 Zeev Suraski - - * zend_execute.c: Functionality & crash fixes - -2000-01-04 Andi Gutmans - - * zend.h - zend_operators.c: - - Rename IS_BC to FLAG_IS_BC. We will probably nuke it. - -2000-01-04 Thies C. Arntzen - - * zend_API.h: added ZVAL_*() macros. - -2000-01-04 Andi Gutmans - - * zend.h - zend_execute.c: - - Separate the overloaded objects' types from Zend's data types. - There is no reason for them to be the same, and IS_METHOD just cluttered - there data types. - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c - zend-parser.y - zend.c: - Change IS_UNSET -> IS_NULL - -2000-01-03 Zeev Suraski - - * zend_execute.c: Fix a bug when using [] on a string - -2000-01-03 Joey Smith - - * zend_operators.c: number.h comes from ext/bcmath, not functions/ - -2000-01-03 Zeev Suraski - - * zend_execute.c: Fix - -2000-01-03 Andi Gutmans - - * zend_operators.c: - Fix compare_function() for IS_UNSET - -2000-01-02 Zeev Suraski - - * zend_execute.c: Fix - -2000-01-02 Thies C. Arntzen - - * zend_API.h: renamed RET???_UNSET -> RET???_NULL - -2000-01-01 sascha - - * Zend.m4 - acconfig.h - acinclude.m4: Some cleanup - -2000-01-01 Andi Gutmans - - * zend_operators.c: - - IS_NULL should be 0 when converted to a long although I don't think it - really should be documented. - -2000-01-01 Zeev Suraski - - * zend_operators.c: Fix buglet - -1999-12-31 Zeev Suraski - - * Zend.dsp - ZendTS.dsp: .dsp updates - - * Zend.dsp - ZendTS.dsp - zend_config.w32.h: - Add Release_inline builds - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_constants.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_operators.h - zend_variables.c: - Nuke undefined_variable_string - - Introduce IS_UNSET - -1999-12-31 Andi Gutmans - - * ZendTS.dsp - zend-parser.y - zend_compile.c - zend_compile.h: - - Fix bug #3073. continue in do..while() loops should work now - -1999-12-30 Zeev Suraski - - * zend.c - zend_alloc.c - zend_fast_cache.h - zend_globals.h - zend_globals_macros.h: - This should enable people to use ALLOC_ZVAL() in code outside the php4.dll - -1999-12-30 sascha - - * Zend.m4: - Solaris' sed does not like this expression. Since -O0 is the default, - we can also omit it. - -1999-12-29 Zeev Suraski - - * zend_variables.c: - - Change var_reset() to set bool(0) instead of string("") - - Authors should go over their code and change it to use var_reset() instead of manually - setting it to string(""), in case they're interested in the false value. - - * zend_alloc.c: time_t is an int under Linux... this should always work. - -1999-12-28 sascha - - * zend_alloc.c: Fix warnings - -1999-12-28 Thies C. Arntzen - - * zend_API.h - zend_constants.c: new constant: SQL_NULL - new macros: RETURN_SQLNULL,RETVAL_SQLNULL,IS_SQLNULL - -1999-12-27 Zeev Suraski - - * zend_fast_cache.h: Fix - -1999-12-27 Andi Gutmans - - * zend_API.c: - Get rid of warning - -1999-12-27 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_fast_cache.h - zend_globals.h - zend_opcode.c - zend_operators.c - zend_variables.c - zend_zval_alloc.h: - Generalize the fast cache mechanism - - Add the HashTable struct to the fast cache mechanism - -1999-12-27 Andi Gutmans - - * zend_API.c: - - Make zend_internal_function allocate a full zend_function structure so - that we don't get memory overruns and Thies doesn't get angry :) - -1999-12-27 Zeev Suraski - - * zend_alloc.c: *** empty log message *** - - * zend_globals.h - zend_zval_alloc.h - zend_alloc.c: Add cache statistics support - -1999-12-27 Thies C. Arntzen - - * zend.c: fix UMR in ZTS mode - -1999-12-26 Zeev Suraski - - * Zend.dsp - ZendTS.dsp - zend_alloc.c - zend_globals.h - zend_zval_alloc.h: - - Enable the new zval cache on debug too. No real reason not to, and it keeps - the code cleaner. - - ZTS compile fixes - - * zend_alloc.c: Fix buglet - - * zend_zval_alloc.h: Add missing file - - * zend.h - zend_API.h - zend_alloc.c - zend_compile.c - zend_execute.c - zend_globals.h - zend_operators.c: - Introduce a zval-specific cache - 5-15% speed improvement - -1999-12-26 sascha - - * Makefile.am - acinclude.m4: Makefile.am: Add dummy target for dependencies - acinclude.m4: Cache result of broken sprintf check - -1999-12-26 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_operators.c: Change ALLOC_ZVAL() semantics - - * zend_alloc.c - zend_alloc.h - zend_globals.h: namespace protection - -1999-12-25 Zeev Suraski - - * zend_ptr_stack.c - zend_ptr_stack.h: inline functions cannot accept varargs - -1999-12-25 Andi Gutmans - - * zend-parser.y: - Prepare Zend for the new $a{2} string offset syntax. - -1999-12-24 Zeev Suraski - - * zend_config.w32.h: - Use __forceinline under Win32 (inlining under Win32 gives roughly 30% performance - increase) - - * zend-scanner.l: Shut gcc up - - * zend_compile.c: Optimize - -1999-12-24 Andi Gutmans - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c: - - Create two new macro's. ALLOC_ZVAL() and FREE_ZVAL(z) and make Zend use - them. - -1999-12-24 Zeev Suraski - - * zend_compile.c: - Use function_add_ref() here too - -1999-12-23 Zeev Suraski - - * zend_compile.c - zend_opcode.c: - Fix a class inheritence leak, when using static varibles in a parent class member function - - * zend_compile.c: This one slipped away - -1999-12-23 sascha - - * Zend.m4: Rename option to match description string - -1999-12-23 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c: - - require() of a dynamic expression now has the standard require() semantics - - Fixed a memory leak in require() of a dynamic expression - -1999-12-23 sascha - - * Makefile.am - Zend.m4: - Compile zend_execute.c with special CFLAGS. For GCC, INLINE_CFLAGS - contains -O0 to disable optimizations. This can be disabled by using - the appropiate parameter. - -1999-12-22 sascha - - * zend_builtin_functions.c: Kill compiler warning - - * Zend.m4: Don't set DEBUG_CFLAGS to -g, if -g is already in CFLAGS - -1999-12-22 Zeev Suraski - - * zend.c - zend.h: export - - * zend_extensions.h: Those void's don't belong in there - - * zend_API.h - zend_builtin_functions.c: - Fix function_exists() - - * zend_execute.c: - - Fix a very old legacy memory leak in break(n) statements - - * zend_execute.c: Fix for the array() initialization bug Stas found - -1999-12-22 Andi Gutmans - - * zend_compile.c: - Remove unused variable. - -1999-12-21 Zeev Suraski - - * zend-scanner.l - zend.h - zend_compile.c - zend_execute.c: - Fix the highlighting problem. STR_REALLOC() should be used instead of plain erealloc() - whenever you're dealing with strings that might be coming back from the engine - there seem - to be a few other places like this in PHP. - -1999-12-21 Andrei Zmievski - - * zend.c - zend_API.c - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_operators.c - zend_variables.c - zend_variables.h: We're using ZVAL's now. - -1999-12-21 Zeev Suraski - - * zend_execute.c: - Fix Sascha's leak. Good report! - - * zend_alloc.c: No need to block for interruptions so early - -1999-12-21 sascha - - * Zend.m4: - Explicitly check for C++ preprocessor, otherwise autoconf forces it onto - us at the wrong place (subsequent autoconf checks failed). - -1999-12-20 Zeev Suraski - - * zend_compile.c: - Fix @expr - - * zend.h - zend_compile.c - zend_execute.c: - - Fix the crash Thies was experiencing (returning a function call could cause a crash) - - Fix the leak Thies was experiencing (@fcall() leaked) - -1999-12-19 Zeev Suraski - - * Zend.dsp: Some updates - - * Zend.dsp - ZendTS.dsp: Make these work again - - * FlexLexer.h - Makefile.am - Zend.dsp - Zend.m4 - ZendTS.dsp - configure.in - flex.skl - libzend.dsp - libzend.m4 - libzendts.dsp: libzend -> Zend - - * zend.h - zend_API.h - zend_compile.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h: - - Made things work again (Thies, everybody - please check the latest CVS and see if you're - still getting any problems) - - Changed the interface of call_user_function_ex() to support returning of references - -1999-12-19 Andi Gutmans - - * zend.c - zend.h - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h: - More fixes related to the return references patch - - eval_string() and call_user_function_ex() still don't work. - - The libzend tree is untested and might not be stabl yet. - -1999-12-19 sascha - - * Makefile.am: Add zend_sprintf.c - - * acconfig.h - zend_sprintf.c: configure sets ZEND_BROKEN_SPRINTF - - * acinclude.m4: Variables are not interpolated unless we use _UNQUOTED - -1999-12-18 Zeev Suraski - - * zend.h - zend_API.h: - The tree compiles again - -1999-12-18 sascha - - * libzend.m4: Let autoconf check for the proper inline keyword - - * Makefile.am - libzend.m4: - automake created illegal target names due to the ZEND_SCANNER definition. - We now substitute @ZEND_SCANNER@ directly - -1999-12-18 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_builtin_functions.c: - - Introduce ZEND_NUM_ARGS(), to replace ARG_COUNT(ht) - - Rename getParameters() and friends for consistency and namespace cleanliness - -1999-12-17 Zeev Suraski - - * zend_constants.c: - Made PHP_VERSION and PHP_OS work again - - More php3_ cleanup - - Restored the PHP_VERSION and PHP_OS constants - -1999-12-17 sascha - - * libzend.m4: Define inline to inline explicitly - - * Makefile.am - acinclude.m4 - configure.in - libzend.m4: Move config code into separate file - -1999-12-17 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h: - - By mistake commited this to the branch. It fixes a bug we introduced with - the return reference patch. - -1999-12-15 Andrei Zmievski - - * zend_builtin_functions.c: Doh! I'm an idiot. - - * zend_builtin_functions.c - zend_compile.c: - s/inheritence/inheritance/g - - Added is_subclass_of() function - -1999-12-15 Zeev Suraski - - * zend-parser.y - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Implement return by reference: - - In function declaration instead of the return statement - - In the assignment phase - - Implement ability to turn off support for call-time pass by reference - -1999-12-15 Andrei Zmievski - - * zend_builtin_functions.c: val->len - - * zend_builtin_functions.c: Faster, must go faster. - -1999-12-15 Andi Gutmans - - * zend_execute.c - zend_opcode.c - zend-parser.y - zend_compile.c - zend_compile.h: - - Preliminary return ref patch. It breaks libzend so don't use this branch - right now. - -1999-12-14 Andrei Zmievski - - * zend_builtin_functions.c: - Added class_exists() - - Moved function_exists() here from from the basic_functions.c - - Modified method_exists() to convert method name to lowercase - when checking - -1999-12-13 Andi Gutmans - - * zend_execute.c: - - Fix problem when return_value's is_ref/refcount is overwritten by the - internal function. - -1999-12-11 Andi Gutmans - - * zend_execute.c: - Another small fix. - - * zend_execute.c: - Support returning references - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - This is supposed to be commited to the RETURN_REF_PATCH branch which is - the beginning of work on allowing returning of references from functions. - -1999-12-07 Andi Gutmans - - * zend-scanner.l: - - opened_path should not be freed here as the zend_file_dtor() takes care - of it. This doesn't fix the bug report for the crash of highlight_file() - though. - -1999-12-07 Zeev Suraski - - * zend-parser.y: Support ZTS definition in zend_config.h - -1999-12-06 Zeev Suraski - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_highlight.c - zend_indent.c: Move the #include of zend-parser.h out of zend_compile.h - - * zend-parser.y - zend_globals_macros.h: More localization - - * zend-parser.y - zend_compile.h - zend_globals_macros.h: Localize a couple of macros - -1999-12-05 Zeev Suraski - - * zend-scanner.l: *** empty log message *** - -1999-12-05 sascha - - * .cvsignore - zend-parser.y - zend.c - zend_API.c - zend_compile.c - zend_execute_API.c: Fix some warnings - -1999-12-04 Andrei Zmievski - - * zend_API.c: *** empty log message *** - - * zend_API.c - zend_API.h - zend_hash.h: Added zend_set_hash_symbol() function. - -1999-12-04 Thies C. Arntzen - - * zend_API.h: - backed out last change after andi decided on a different approach. - -1999-12-04 Andi Gutmans - - * zend_API.h: - - Call ZEND_SET_SYMBOL_WITH_LENGTH() with refcount 1 from the standard - ZEND_SET_SYMBOL() - -1999-12-04 Zeev Suraski - - * zend-scanner.l - zend_builtin_functions.c - zend_compile.c: - Implement get_used_files() and get_imported_files() - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_compile.c - zend_compile.h: - - Break the zend->PHP dependency introduced by the .php extension for use(), - by providing an API - - Enable Stig's patch for use() extensions (it wasn't refered to by the parser) - - Fix a memory leak in that code - -1999-12-04 Thies C. Arntzen - - * zend_API.h: the new SET_VAR_* macros forgot to set the refcount! - -1999-12-04 Sam Ruby - - * zend-scanner.l: build error - windows - -1999-12-04 stig - - * zend-scanner.l - zend_compile.h: Fix typo, add prototype for use_filename(). - - * zend-scanner.l: "use" should use arg+".php" as parameter to require - -1999-12-04 Zeev Suraski - - * zend-scanner.l: This should fix the fd leak with include()/require() - -1999-12-03 Andrei Zmievski - - * zend_API.h: *** empty log message *** - - * zend_API.h: Added ZEND_SET_GLOBAL_VAR_WITH_LENGTH_EX() macro. - -1999-12-03 Thies C. Arntzen - - * zend-scanner.l: revert my last patch - WARNING: we leak fd's again. - add initialzation of opened_path highlight_file() - -1999-12-03 Andi Gutmans - - * zend_API.h: - Remove _EX and make it the old _LENGTH - -1999-12-02 Andi Gutmans - - * zend_API.h: - Add _EX macro for Andrei - -1999-12-02 Zeev Suraski - - * zend-scanner.h - zend_compile.h: Solve a couple of compile issues - -1999-12-02 Thies C. Arntzen - - * zend-scanner.l: - php_fopen_wrapper_for_zend() does *NOT* insert the opened files into any list - the caller needs to fclose() the file. (not sure if this is desired) - fixed "Uninitialized memory read" when including URLs - -1999-12-01 stig - - * zend-scanner.h - zend.c - zend.h - zend_alloc.h - zend_builtin_functions.h - zend_compile.h - zend_constants.h - zend_execute.c - zend_execute.h - zend_extensions.h - zend_globals_macros.h - zend_hash.h - zend_indent.h: Fix warnings surfacing in maintainer-mode. - -1999-12-01 Zeev Suraski - - * zend_API.h: - Make it possible to explicitly set refcount in ZEND_SET_SYMBOL_WITH_LENGTH(), part 2 - - * libzendts.dsp - zend_API.h: - Allow to set the reference count explicitly for ZEND_SET_SYMBOL_WITH_LENGTH() - -1999-12-01 Andi Gutmans - - * zend_execute.c: - - Forgot to check for BP_VAR_IS in the fix made for Thies' string offset - problem. - -1999-11-30 Andi Gutmans - - * zend_API.c: - Applied Thies' bug fix. Great work! - - * zend-parser.y - zend-scanner.l - zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - - Add use support (behaves like require, but will not use the same file twice) - - Add import support (behaves like include, but requires parentheses; will not - use the same file twice; Currently, it is not yet properly implemented, and - only behaves like include) - - * zend_execute.c: - - Fix problem Thies reported. We by mistake separated variables which were - being fetched for read only. - -1999-11-27 Zeev Suraski - - * zend_alloc.c: Add ability to disable the memory cache - -1999-11-26 Zeev Suraski - - * zend-scanner.l: - Fix fd leak in ZTS mode - - * zend-scanner.l - zend_compile.c: UNIX/non ZTS compile fixes - - * zend-scanner.l - zend_compile.c - zend_compile.h: - Improve the file handle closing code - - * zend_llist.c - zend_llist.h: - Modify zend_llist_del() to receive a comparison function - - * zend_API.c: - This request_shutdown() is no longer needed (never was needed really) - - * zend-scanner.l: This should get the file to close properly - -1999-11-26 sascha - - * Makefile.am: Rebuild libzend.la, if the scanner was rebuilt - -1999-11-26 Zeev Suraski - - * zend_API.c - zend_modules.h: Remove request_started, increase thread safety - -1999-11-25 Zeev Suraski - - * zend_execute.c: That's a more thorough fix... - - * zend_execute.c: - Fix bug #2817 - assignments to string offsets could erronously modify unrelated strings - -1999-11-22 Zeev Suraski - - * zend_alloc.c: Fix compile problem with enable-memory-limit - - * zend-scanner.l: Fix inconsistencies with here-docs implementation - - * zend-scanner.l - zend_globals.h: Fix #2744 - -1999-11-21 Andi Gutmans - - * zend_execute.c: That slipped away - -1999-11-21 Zeev Suraski - - * zend.h - zend_API.c - zend_compile.c - zend_execute.h - zend_execute_API.c: - Optimize class instanciation - - Fix constant instanciation for array elements inside objects - -1999-11-19 Andi Gutmans - - * zend_execute.c: - - Moved var_uninit() for return_value to the beginning of DO_FCALL. - We forgot to do it for overloaded methods - - * zend.h - zend_execute.c: - - Functions whose return values aren't used have them freed in DO_FCALL - and don't need a special ZEND_FREE opcode following them anymore - -1999-11-17 Andi Gutmans - - * zend_compile.c - zend_execute.c: - - If a function's return value is unused then don't create a ZEND_FREE - opcode but free it after the function call in zend_execute. - - * zend_execute.c: - Forgot this - -1999-11-16 Andi Gutmans - - * zend_execute_API.c: - Weird that this compiled for me. - - * zend.h: - CHange used_return_value -> return_value_used - - * zend_compile.c: - - In any case create the free opcode. Need to allow the functions to - create a hint. - - * zend.h - zend_compile.c - zend_execute.c: - - Add support for used_return_value passed to internal functions. - -1999-11-14 Andi Gutmans - - * zend_compile.h: - Fix comment as to Joey's findings - -1999-11-13 Andi Gutmans - - * zend_execute.c: - Fix crash with string offset assignments. - -1999-11-04 Andrei Zmievski - - * zend_hash.c - zend_hash.h: Made zend_hash_rehash() callable from outside. - -1999-11-03 Andi Gutmans - - * zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c: - Add support for BYREF_FORCE_REST - -1999-10-28 Andi Gutmans - - * zend_compile.c - zend_execute.c: - Fix for Thies' leak and Andrei's crash - -1999-10-25 Zeev Suraski - - * zend_compile.h: *** empty log message *** - -1999-10-23 Sam Ruby - - * libzend.dsp - libzendts.dsp: - Allow CYGWIN directory to be specified as via environment variable - -1999-10-22 Andi Gutmans - - * zend_execute.c: - Fix isset() with string offsets. - -1999-10-19 Thies C. Arntzen - - * zend_operators.c: fixed is_identicat_function() - -1999-10-19 Andi Gutmans - - * zend_compile.h: - Move IS_IDENTICAL next to IS_EQUAL - - * zend_operators.c: - Fix is_identical function - - * zend-parser.y - zend-scanner.l - zend_compile.h - zend_execute.c - zend_opcode.c - zend_operators.c - zend_operators.h: - - Preliminary submit of Thie's patch. Will fix the rest on Windows - as this was added on UNIX with patch. Changed IS_SAME -> IS_IDENTICAL - -1999-10-18 Andrei Zmievski - - * zend_API.h: Be safe, use (). - -1999-10-15 Andrei Zmievski - - * zend_operators.c - zend_operators.h: unstatic'fy is_numeric_string() - - * zend_hash.c - zend_hash.h - zend_compile.c: *** empty log message *** - -1999-10-15 Andi Gutmans - - * zend_operators.h: - Add convert_to_number_ex() - -1999-10-14 sascha - - * configure.in: - Add "--disable-inline" for low-memory machines (be it limited - RAM or virtual memory). It's also useful for Digital C where - the C++ compiler thinks "inline" is an invalid specifier. - - * Makefile.am: Use sources from $(srcdir) - -1999-10-13 sascha - - * Makefile.am: Do not use $< for anything but implicit rules. - -1999-10-13 Thies C. Arntzen - - * zend_list.c: - (zend_fetch_resource) added warinig if resource is of wrong type - -1999-10-13 sascha - - * acconfig.h: Disable ZEND_EXTENSIONS_SUPPORT, if RTLD_NOW is not defined. - - Note that this part could be made platform independent by using - libltdl (for Solaris, Linux, *BSD, HP-UX, Win16/32, BeOS). - -1999-10-12 Thies C. Arntzen - - * zend_list.c - zend_list.h: new improved resource-API - -1999-10-12 sascha - - * acconfig.h: - Use DL_LAZY for OpenBSD. This seems to be a compatibility flag which - should be used for the 2nd parameter to dlopen. - - http://www.openbsd.org/cgi-bin/cvsweb/src/share/man/man3/dlfcn.3?rev=1.8 - -1999-10-12 Andi Gutmans - - * zend_execute.c: - - object.ptr was made NULL in DO_FCALL but wasn't restored. Right now I - push it in DO_FCALL and at the end of do_fcall_common it always gets - popped. We might be able to optimize it out. - -1999-10-11 Andrei Zmievski - - * .cvsignore: *** empty log message *** - - * zend_hash.c - zend_hash.h: Modified zend_hash() to accept a pointer to sort function. - -1999-10-11 Andi Gutmans - - * zend_execute.c: - - No idea why this bug didn't exist before. But I'm too tired to think of it. - During a regular do_fcall we need to set object.ptr to NULL and, thus, - push it in the beginning and pop it in the end. - I hope this fix more or less cuts it. I just want to sleep :) - -1999-10-10 Andi Gutmans - - * zend_execute.c: - - Didn't lower refcount when doing an internal function call linked to a regular object. - -1999-10-10 Thies C. Arntzen - - * .cvsignore: added some more autoconf/libtool stuff to be ignored - -1999-10-10 Andi Gutmans - - * zend_execute.c: - - Clean up a bit. Separate before the locking so that we can use SEPARATE_ZVAL - macro. - -1999-10-10 sascha - - * build.mk: Add clean target which removes standard targets - - * build.mk: build.mk can be used to generate build tools. It is usually - faster than buildconf, since it rebuilds only components, if - it is necessary. To use it, run - - $ make -f build.mk - -1999-10-09 Andi Gutmans - - * zend_execute.c: - Shouldn't be needed - - * zend_execute.c: - - God damn this sucked. I hopefully fixed the problems with classes although - we might need to clean stuff up a bit. - -1999-10-09 sascha - - * acconfig.h: - Define RTLD_NOW to DL_NOW, if RTLD_NOW is not defined (for OpenBSD). - -1999-10-07 Thies C. Arntzen - - * zend_variables.c - zend_variables.h: added zval_del_ref() function - -1999-10-07 Andi Gutmans - - * zend_execute.c: - Reverse my patch - -1999-10-06 Andi Gutmans - - * zend_execute.c: - - Fixed memory leak with this pointer. It was somtimes initialized with refcount - of 2 instead of 1. - - Also fixed a place where object.ptr_ptr is set to pointing to a zval* instead - of zval**. I don't think this is ever used so we might be able to remove it - altogether. - -1999-10-06 Thies C. Arntzen - - * zend_execute.c: fix for using resources as array indices - -1999-10-05 sascha - - * configure.in - zend.h - zend_globals.h: More portability stuff - - * configure.in: OSF/1 V4.0 wants -lcxx - - * zend_compile.h: - This causes link problems with anything higher than -O0. - -1999-10-04 sascha - - * Makefile.am: Add necessary rule. - - * Makefile.am - acconfig.h - acinclude.m4 - buildconf - configure.in - zend_config.in: Use libtool to build. - -1999-10-04 Thies C. Arntzen - - * zend_builtin_functions.c: use getParametersEx for all builtin functions - - * zend_API.c - zend_API.h: added add_*_resource() and add_*_bool() functions - -1999-10-03 Andi Gutmans - - * zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h: - Hooray. This might actually work. (I hope) - -1999-10-03 sascha - - * configure.in: Make it executable. - -1999-10-02 Andi Gutmans - - * zend_execute.c: - Another locking fix. - - * zend_execute.c: - Fixed locking problem when fetching string offsets - -1999-10-02 Zeev Suraski - - * zend_execute.c: - Fix the leak reported on the PHP 3 list (isset() on string offsets) - -1999-10-01 Andi Gutmans - - * zend.h - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.h: - - Move is_ref back to being an unsigned char and not a bit field. - - * zend.h - zend_API.h - zend_builtin_functions.c - zend_compile.h - zend_execute.c - zend_execute_API.c: - Remove locking support completely - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - For Andrei. Implement references in array() initializations - -1999-09-29 Zeev Suraski - - * zend_config.w32.h: *** empty log message *** - -1999-09-29 Andi Gutmans - - * zend_operators.c: Fix leak in += with arrays - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - - Fix SEND_VAR problem after fetch'ing a variable and not knowing the fetch type - -1999-09-29 Thies C. Arntzen - - * zend_API.c - zend_API.h: added add_property_resource - -1999-09-28 Andi Gutmans - - * zend_compile.h - zend_execute.c - zend_execute_API.c: - - Stop using the locking mechanism and start using refcount. - Now we know when we need to free but we still need to support it - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - - First part of the patch which makes reads use ptr and not ptr_ptr. - -1999-09-28 sascha - - * acconfig.h - configure.in - zend-scanner.l: Provide alternative istdiostream. - - This has been tested with Sun WorkShop 4.2 C++ which does not - contain class istdiostream. - -1999-09-26 sascha - - * Makefile.am - configure.in: Actually allow to set CXXFLAGS - - * configure.in - zend_config.in: - Build communication channel and add checks for C++ library - -1999-09-26 Andi Gutmans - - * zend_execute.c - zend_execute.h - zend_execute_API.c: - Changed Ts{}.var to Ts{}.var.ptr_ptr. - -1999-09-24 sascha - - * zend_operators.h: Add _ex API implementation for booleans. - -1999-09-24 Zeev Suraski - - * zend_list.c - zend_list.h: Exify the standardized resource stuff - -1999-09-23 Andi Gutmans - - * zend_operators.c: - Fix bug #2364. - I haven't checked all of the conversion macros yet but there's a change - there are more such bugs there. - -1999-09-23 sascha - - * configure.in: Fix vpath build w/ thread-safe enabled on Unix. - -1999-09-22 Thies C. Arntzen - - * zend_builtin_functions.c: - preliminary fix for each until andi & zeev clean up! - - * zend_list.c: - if you pass NULL as the resource_type_name to zend_fetch_resource*&friends the functions will not print any warnings if the resource is not found! - -1999-09-21 Andi Gutmans - - * zend_compile.c: - - Fix problem where function parameter fetches were created too late. - -1999-09-21 Zeev Suraski - - * zend_builtin_functions.c: Add get_func_args() - - * zend_builtin_functions.c: *** empty log message *** - -1999-09-20 Andi Gutmans - - * zend_builtin_functions.c: - - Move some more Zend internal functions from PHP - - * zend-parser.y: - Next part of locking fix. - $var = expr; and $var += expr; first create code for expr and later on - for the fetch_w of $var. - - * zend_builtin_functions.c: - Newline for Sun's compiler - - * zend_API.h - zend_builtin_functions.c: - Add some internal functions to Zend - - * zend_compile.c - zend_compile.h - zend_opcode.c: - - First step in fixing locking problem. Array fetches are now always done last. - Later on we will want to delay the write fetches even longer until after their - resulting expression is parsed. The way it is now, will make it very easy - to delay as long as we need. - - * zend_compile.c - zend_compile.h: - - Indirect references had all of the fetches by mistakenly backpatched. - Actually all of the fetches are supposed to be read, except for the last - one. - -1999-09-20 Zeev Suraski - - * libzend.dsp - libzendts.dsp - zend_builtin_functions.c: Added zend_num_args() and zend_get_arg() - - * Makefile.am - zend.c - zend_builtin_functions.c - zend_builtin_functions.h: - Add a file in which we can put Zend builtin functions - -1999-09-18 Andi Gutmans - - * zend_execute.c: - - Try to fix the leak Rasmus reported. It's pretty sucky code so I'm really - not sure this fix is OK.I can't remember all of what we did there. - -1999-09-18 Zeev Suraski - - * zend_list.c: Safer behavior - -1999-09-17 Thies C. Arntzen - - * zend_execute.c: make SUNs c89 happy - - * zend_execute_API.c: no // in the sources please - - * zend_globals_macros.h: added newline at end of file - -1999-09-17 Zeev Suraski - - * zend_execute.c: - Fix bug #2318 - -1999-09-16 Zeev Suraski - - * zend_operators.h: Introduce convert_to_*_ex() - -1999-09-16 sascha - - * configure.in: this helps compiling on non-ANSI C compliant platforms - -1999-09-13 stig - - * acconfig.h - configure.in: Make sure HAVE_LIBDL gets defined. - Disable more C++ tests when not configured for thread safety. - -1999-09-12 Zeev Suraski - - * zend.c: Make this class instanciatable - -1999-09-12 sascha - - * configure.in: check for c++ only, if thread safety is enabled - -1999-09-10 Zeev Suraski - - * zend_compile.c: Shut up a warning - -1999-09-09 Andi Gutmans - - * zend_compile.c - zend_globals.h - zend_stack.c - zend_stack.h: - Add foreach() freeing code. - - Fix switch() freeing code to only free current function's switch expressions. - - I have a feeling break expr; in a switch where expr > 1 leaks because it - won't free all of the expressions. Fix is probably not trivial. - - * zend_operators.c: - - Fix leak when decrementing strings which actually are longs. - -1999-09-08 Andi Gutmans - - * zend_execute.c: - - Fix for floating point array offsets. Same behaviour as in PHP 3.0. We - casted to (long). - - * Makefile.am - libzendts.dsp: - Add -b option to flex++ - -1999-09-07 stig - - * acconfig.h: define tests first, use after. - -1999-09-06 Andi Gutmans - - * zend_config.w32.h: - Fix win32 compile - - * zend_config.w32.h: - Make zend compile again in Win32. - -1999-09-06 stig - - * .cvsignore: ignore zend-scanner.cc - - * ZendCore.dep - libzend.dsp - libzendts.dsp: hand-patched some MSVC files - - * Makefile.am - acconfig.h - acinclude.m4 - config.unix.h - config.w32.h - configure.in - zend-scanner.l - zend.h - zend_API.c - zend_alloc.c - zend_compile.h - zend_config.w32.h - zend_execute.c - zend_hash.c - zend_list.c - zend_ptr_stack.c - zend_sprintf.c: * header file cleanup - * fixed --enable-thread-safety build for UNIX - - I don't have a Win32 environment available, could someone please try - compiling on Win32 to see if I got all the header file stuff right there? - -1999-09-05 Andi Gutmans - - * zend_globals_macros.h: - Oops - - * libzendts.dsp - zend.c - zend.h - zend_alloc.c - zend_alloc.h - zend_globals.h: - Shift around header files. - -1999-09-04 Zeev Suraski - - * zend_list.c: Fix a stupid bug (from stefan@roehri.ch) - -1999-09-03 Zeev Suraski - - * zend_list.h: Damn, forgot to commit that - - * zend_list.c - zend_list.h - zend_modules.h: Add new API for resources - -1999-09-03 sascha - - * zend_modules.h: Add global startup/shutdown functions - -1999-09-03 Zeev Suraski - - * zend_operators.c: - Revert the IS_RESOURCE patch. It had some unintended behavior. - - * zend_variables.c: Let $GLOBALS actually work... - - * zend_operators.c: - Release resources when converting to other types (fix Thies's reported problem) - -1999-09-02 Zeev Suraski - - * zend_compile.c: - Use \0NameFilenameLineno as key instead of numeric index for runtime defined functions - -1999-08-28 Zeev Suraski - - * zend_extensions.c - zend.h - zend_alloc.c - zend_extensions.h - zend_variables.c - zend_variables.h: *** empty log message *** - - * zend.h - zend_alloc.c - zend_alloc.h - zend_variables.c: Beef up debug macros - -1999-08-27 Zeev Suraski - - * zend_execute_API.c: Fix a crash bug in case of aborted execution - - * zend.h - zend_alloc.c - zend_alloc.h - zend_execute_API.c - zend_variables.c - zend_variables.h: Better debug macros - -1999-08-26 Andi Gutmans - - * zend_execute_API.c: - Damn. It wasn't a correct fix. This should do it. - When the zval ** are equal we don't want to assign_ref, in any other case - I can think of we do want to assign_ref. - - * zend_execute_API.c: - Fix leak when global is used in the global scope. - - * zend_compile.c: - Fix when redefining classes at run-time. - -1999-08-25 sascha - - * zend.h: make it compile with gcc again - -1999-08-25 Andi Gutmans - - * zend_hash.c - zend_hash.h: - Add hash_apply_with_arguments() - - * zend-scanner.l: - More elegant fix for Win32 include_path - - * zend-scanner.l: - - Temporary fix to allow Win32 MT safe version to use zend_fopen(). - -1999-08-23 Andi Gutmans - - * zend_execute.c: - Fixed a specific memory leak linked to locking. - -1999-08-22 sascha - - * zend.h - zend_globals.h: This changes makes it work on egcs 1.1.2/Alpha - - * configure.in - zend.h: remove checks - -1999-08-20 Zeev Suraski - - * zend_constants.c - zend_constants.h - zend.c: Fix for Thies's UMR - -1999-08-19 Andi Gutmans - - * zend-parser.y - zend_opcode.c: - - Make sure expr_list and echo_list are either empty or comma seperated - expressions - -1999-08-18 Thies C. Arntzen - - * zend-scanner.l: on unix ZTS gets defined in zend_config.h - -1999-08-17 Zeev Suraski - - * zend_execute_API.c: Fix #2012 - - * zend_execute.c: Fix #2070 - -1999-08-17 Andi Gutmans - - * zend.c - zend.h: - Add some ZENDAPI's - -1999-08-15 Andi Gutmans - - * zend_execute.c: - Oopsie - - * zend.h - zend_compile.h - zend_execute.c - zend_globals.h: - Optimize the execute stack a bit. - -1999-08-14 Zeev Suraski - - * zend_compile.c: Fix several class issues - - * zend_compile.c - zend_compile.h: - Generate better warnings for class/function redefinitions - -1999-08-10 Andi Gutmans - - * zend_compile.c - zend_constants.c: - Got rid of the C++ comments. - -1999-08-09 Andi Gutmans - - * zend_execute.c: - Thies's crash fix. - -1999-08-07 Zeev Suraski - - * zend_compile.h - zend_execute.c - zend_execute_API.c: Fix a few leaks - -1999-08-06 Zeev Suraski - - * zend_execute_API.c: Fix a bug in call_user_func_ex() - - * zend_API.h: Now that's an annoying bug. - - * zend_API.h - zend_execute_API.c: Introduce call_user_func_ex() - - * zend_execute.c: *** empty log message *** - -1999-08-03 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: - - Initialize extended value's and put the fetch_type in it's own variable - name. - -1999-08-02 Andi Gutmans - - * zend_compile.c - zend_compile.h: - Make set_compiled_filename() return a pointer to the allocated file name - -1999-07-31 Zeev Suraski - - * zend_API.h: These aren't necessary - -1999-07-30 Zeev Suraski - - * zend_API.h: Support symbols in any symbol table, not just the active one - -1999-07-30 Andi Gutmans - - * zend_ptr_stack.c: - Damn that's more like it. - - * zend_ptr_stack.c: - Cut&paste crap - - * zend_execute.c - zend_ptr_stack.c - zend_ptr_stack.h: - - Add ptr_stack_n_{push,pop} in order to speed up function calls a bit. - There seems to be no reason for stack->top in the ptr_stack except for - when realloc()'in the stack. I think I'll remove it. - -1999-07-30 Zeev Suraski - - * zend_API.h: - * Setting variables in the global scope wasn't handling is_ref's properly - -1999-07-29 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h: - - Fixed a leak when doing inheritance. The parent class name wasn't being freed. - - Fixed a stack leak. Functions that had late argument binding were set up as - INIT_FCALL_BY_NAME but were using DO_FCALL and not the corresponding - DO_FCALL_BY_NAME. - -1999-07-28 Andi Gutmans - - * zend_compile.c - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c: - Fixed various inheritance problems & Andrey's leak - -1999-07-27 Zeev Suraski - - * zend_compile.c: Inherit parent's constructor - - * zend_compile.c: - Fix runtime inheritence (child functions/members should have higher precedence) - -1999-07-27 Andi Gutmans - - * zend_execute.c: - Add missing lock - - * zend_execute.c: - Fix up the new operator a bit more. - -1999-07-27 Zeev Suraski - - * zend_execute.c: Set reference count and is_ref values for new objects - -1999-07-26 Zeev Suraski - - * zend_operators.c: - - Fixed a memory leak when using assignment-op operators with lvalue of type - string (or array/object) - - * zend_compile.c: *** empty log message *** - - * zend_compile.c - zend_compile.h - zend_execute.c: - Fix a bug in inheritence from classes defined in include files, that are - inherited from require()'d files - -1999-07-26 Andi Gutmans - - * zend_execute.c: - Oops I erased this by mistake - - * zend_execute.c: - - Should be a complete fix now. This break away code should maybe be made - somewhat generic - - * zend_execute.c: - Temporary fix for "this". Have to fix it tomorrow. - - * zend_execute.c: - - Fix compile error. Weird that Visual didn't catch this one. - - * zend-parser.y - zend.h - zend_compile.c - zend_compile.h - zend_execute.c: - Fix the new operator incompatibility. - - I commented PHP_FUNCTION(strtotime) in datetime.c because it stopped - win32 from compiling. This needs to be fixed!!! - - Check out libzend to compile the tree now. - - * zend.h - zend_execute.c: - new operator fixes - -1999-07-25 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Commiting to branch newoperator. - - To check it out do cvs checkout -rnewoperator libzend - -1999-07-24 Zeev Suraski - - * zend_compile.c: Fix that memory leak... nested function issue remains - - * zend_compile.c - zend_stack.c - zend_stack.h: Fix RETURN & SWITCH memory leak issue - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c: - Thoroughly fix the SWITCH problem. No RETURN handling yet. - -1999-07-23 Zeev Suraski - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h: Fix bug #1812 - - * zend.h - zend_operators.c: - * Add an API macro users can use to ensure an array member can be modifed - before they modify it. - * Fix a bug and remove redundant code in convert_to_long() (booleans and - resources weren't changing their types - -1999-07-22 Zeev Suraski - - * zend_constants.c: New constants - -1999-07-22 stig - - * buildconf: identify ourselves - -1999-07-20 Andi Gutmans - - * zend_execute.c: - Include alloca.h when need and available. - - * zend_compile.c - zend_execute_API.c - zend_list.c - zend_operators.c: - Get rid of C++ comments - -1999-07-19 Zeev Suraski - - * config.unix.h - config.w32.h - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: 0.91 update - -1999-07-19 Andi Gutmans - - * zend.h - zend_execute.c - zend_extensions.h: * Fix Zend version - * Fix a method call bug - - * LICENSE - libzendts.dsp: License update - - * zend_errors.h: Make error codes PHP 3.0 compatible - -1999-07-18 Andi Gutmans - - * zend_execute_API.c: - - Should fix the memory leak when returning from the main scope. - -1999-07-17 Zeev Suraski - - * configure.in: Debug on by default - -1999-07-16 Zeev Suraski - - * zend_compile.c: - Ignore T_PHP_TRACK_VARS in the parser (handled in the scanner) - - * config.unix.h - config.w32.h - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_errors.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_hash.c - zend_hash.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_list.c - zend_list.h - zend_llist.c - zend_llist.h - zend_modules.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_sprintf.c - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: License update - -1999-07-15 Andi Gutmans - - * zend.c: Change true/false back to 1/"" - - * zend_execute.c: Fix a lock issue - -1999-07-15 sascha - - * zend_execute_API.c: disable zend_handle_sigsegv - -1999-07-14 Andi Gutmans - - * libzendts.dsp - zend.c: Fix thread unsafe constants startup - - * LICENSE - zend.c - zend_constants.c - zend_constants.h: - License update - - Fix multithreaded constants startup - - * zend_operators.c: - Fix for boolean convert to number - -1999-07-12 Andi Gutmans - - * zend_execute.c: - Fixed a purify warning - -1999-07-10 Zeev Suraski - - * zend_alloc.c: Oh, that dumb bug. - -1999-07-10 Andi Gutmans - - * zend_execute.c - zend_hash.c: Ok, so we do have to lock in there - - * zend.c - zend_execute.c: Fix assignments of reference variables - -1999-07-10 Zeev Suraski - - * zend_execute_API.c: Woops, fix. - - * zend_execute.c - zend_execute_API.c - zend_globals.h: Put the garbage in the garbage bin - - * zend_alloc.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_variables.c: Get rid of AiCount completely - - * zend_execute.c: Final tweaks - - * zend_execute.c - zend_hash.c: More locking work - -1999-07-09 Zeev Suraski - - * zend_execute.c: *** empty log message *** - - * zend_execute.c: More stuff - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.c - zend_variables.c: Step 4: - Move to a 7-bit counter (not fully implemented yet) - - * zend_API.c - zend_compile.h - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_variables.c: Phase 3: - Use a single bit to mark IS_REF variables - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_execute.c - zend_execute_API.c - zend_opcode.c - zend_operators.c: Step 2: - Rename is_ref to EA - - * zend.c - zend_API.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_constants.h - zend_execute_API.c - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_modules.h - zend_opcode.c - zend_variables.c - zend_variables.h: Step 1 in nuking the garbage collector: - - Change the hash destructor to return int - - Don't kill the bucket on hash_destroy if the destructor returns 0 - - * config.w32.h - configure.in - zend_alloc.c: *** empty log message *** - - * zend_alloc.c: Send a SIGSEGV instead of exiting, to trigger a core dump - - * zend_alloc.c - zend_alloc.h - zend_hash.c: * Support recoverable failure from erealloc() - * Fix the shutdown code on an unrecoverable erealloc() failure - - * zend_execute_API.c: Fix the mess in SIGSEGV handling, hopefully - -1999-07-08 Zeev Suraski - - * zend_compile.h - zend_compile.c: - Support definition of classes that are derived from classes that are defined in runtime - -1999-07-06 sascha - - * zend.h: enable it, until we find a better way - -1999-07-05 sascha - - * zend.h: make Solaris gcc happy - - * configure.in - zend.h: use void * instead of long for 64-bit test - -1999-07-05 Thies C. Arntzen - - * zend_API.h: added RETVAL_RESOURCE and RETURN_RESOURCE - -1999-07-04 Zeev Suraski - - * zend_operators.c: - Make convert_to_string() regard false as "" instead of "0" - -1999-07-03 sascha - - * Makefile.am: don't wipe files for distributions - - * configure.in - zend.h: - checking for ints won't work, since they are 32 bit on both platforms - -1999-07-03 Zeev Suraski - - * zend_execute.c: Support isset()/empty() for string offsets - - * zend-scanner.l: Fix a crash - -1999-07-03 sascha - - * configure.in: add usual rhapsody hack - - * config.unix.h: missing DL_HANDLE broke build - - * zend_extensions.c: typo - -1999-07-02 sascha - - * acconfig.h - configure.in - zend.h: workaround for 64-bit platforms - -1999-07-02 Zeev Suraski - - * acconfig.h - configure.in - zend_globals.h: define zend_bool - -1999-06-30 Zeev Suraski - - * zend-parser.y: Make require accept any parameter - -1999-06-26 Zeev Suraski - - * zend_alloc.h - zend_operators.c - zend_alloc.c: - * Make the memory leak reporting code much better with repeats - * Remove useless variables - -1999-06-22 Zeev Suraski - - * zend_compile.c: Fix Thies's bug report - - * zend_alloc.c - zend_compile.c - zend_operators.c: - * Fix concatenation of arrays (it was PHP 3.0 style, copying zval's instead - of zval *, and it wasn't using reference counting) - * Fix a memory leak in static array()'s with textual indices - -1999-06-19 Zeev Suraski - - * zend.c: *** empty log message *** - - * zend.h - zend_extensions.h: - Add a standard get_ini_entry() to interface between Zend and the outside world - - * configure.in: *** empty log message *** - -1999-06-16 stig - - * zend_modules.h: - added INIT_FUNC_ARGS_PASSTHRU and SHUTDOWN_FUNC_ARGS_PASSTHRU - -1999-06-15 stig - - * zend_operators.c - zend_operators.h: * added zend_binary_strcasecmp() - -1999-06-12 Zeev Suraski - - * zend-parser.y: - We can't quite go with expr there (shift/reduce conflict), go with scalar. - - * zend-parser.y: require() improvement as per Andi's suggestion - -1999-06-11 Zeev Suraski - - * zend_operators.c: - Make the concatenation operator use make_printable as well - - * zend-scanner.l: Don't take failing on an include file so badly - - * zend-scanner.l: Support E_COMPILE_ERROR in the compiler - - * zend_compile.c: Two fixes: - * The error generated by a failed class inheritence wasn't properly - displaying the file in which he error occured. - * Inheritence didn't work if the parent class had uppercase letters in it. - - * zend-parser.y - zend-scanner.l - zend_execute.c: * Use to_string() instead of __print() - * Support boolean casts ((bool) and (boolean)) - - * zend.c: Change __print into to_string() - - * zend.c - zend.h - zend_execute.c - zend_execute_API.c: - * Make the output handling of variables much, much cooler. - Uses zend_make_printable_zval() instead of convert_to_string() now: - - $foo = true; - print "\$foo is $foo"; - will now print - $foo is true - (instead of "$foo is 1", earlier). - - Also, with objects, it automatically tries to call __print() and use it as a printing - function. - - For example: - - class foo { - function __print() { return "Foo Object"; } - }; - - $foo = new foo; - print $foo; - - will print "Foo Object". - -1999-06-10 Zeev Suraski - - * zend_operators.c: Now THAT's an annoying bug. - -1999-06-09 Zeev Suraski - - * zend_extensions.c: Fix - - * zend_API.c - zend_execute.c: - * Fix cases where you assign an array element to the parent array (the array was - being erased before the assignment, so the element was being smashed). - - * zend_execute.c - zend_execute_API.c: * Fix foreach() that receives a non array argument - * Clean up some C++ comments - -1999-06-09 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_operators.c: - Fix the static array() initializing - -1999-06-08 Zeev Suraski - - * zend_extensions.c: Replace error messages - -1999-06-08 Andi Gutmans - - * zend_compile.c - zend_compile.h - zend_execute.c: * Fix a by-name call/method call bug - * Clean and optimize the whole function call process - -1999-06-07 Zeev Suraski - - * zend_hash.c - zend_hash.h: Add zend_hash_get_current_key_type() - -1999-06-06 Andi Gutmans - - * zend_compile.c: - Work around a compiler bug - mark variables that are sent to functions that aren't yet - defined as FETCH_W (because they might end up being sent by reference) - -1999-06-05 Zeev Suraski - - * zend.c - zend.h - zend_compile.c - zend_compile.h: * Centralized shutdown - * Change shutdown order again - - * zend_compile.c: - Call the request_shutdown on modules before destroying symbol tables, so that - the session module can be implemented - - * zend-scanner.l - zend_compile.c - zend_execute.c: - - Fixed Karl's bug report. It's not really a thorough fix, we really need to rethink the INIT_FCALL/DO_FCALL issue. - - Fixed numerous AiCount problems - -1999-06-04 Zeev Suraski - - * zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: New $GLOBALS init - - * zend_execute_API.c: - Fix that GLOBALS leak. We were explicitly adding GLOBALS to the main symbol table, - but there's no reason to do it (INIT_GLOBALS takes care of it if necessary.) - - * zend.c - zend.h - zend_API.c - zend_API.h - zend_list.c - zend_list.h - zend_opcode.c - zend_operators.c: Minor updates (mostly __declspec() stuff) - -1999-06-04 Thies C. Arntzen - - * zend_API.h: added is_ref=0 and refcount=1 to SET_VAR_* macros - -1999-06-03 Zeev Suraski - - * zend-parser.y: T_BAD_CHARACTER is actually a string. - -1999-06-03 Andi Gutmans - - * zend-scanner.l - zend_execute.c: - - We weren't counting newlines in heredocs. The only place which is still questionable - is when there's a \ followed by a newline but it seems we have a parse error in this - case anyways. - - Fixed the alloca() macros so that the alloca() #define in win32 mode won't clash - with the real win32 alloca(). - -1999-06-01 Andi Gutmans - - * zend_execute.c: - - Make execute() use less stack in thread-safe win32 due to Microsoft's shitty 256kb stack. - -1999-05-31 Zeev Suraski - - * zend.h - zend_alloc.c: *** empty log message *** - -1999-05-31 Andi Gutmans - - * zend-scanner.l - zend_compile.c - zend_execute.c - zend_execute_API.c: Fixes - -1999-05-30 sascha - - * zend_alloc.c - zend_compile.h - zend_execute_API.c - zend_indent.c - zend_opcode.c: * fix some casts - * introduce unary_op_type - cleaner than casting data voids to function ptrs - -1999-05-29 Zeev Suraski - - * zend_execute_API.c: - That got fucked up when we went back to using uninitialized_zval - -1999-05-29 sascha - - * Makefile.am: another VPATH related change - -1999-05-29 Zeev Suraski - - * zend-parser.y: Fix a bug - - * zend_hash.c - zend_hash.h - zend_operators.c: Support overwrite mode in zend_hash_merge() - -1999-05-29 sascha - - * Makefile.am: - clean is not called from automake. use CLEANFILES instead - - allow VPATH compilation - -1999-05-29 Zeev Suraski - - * zend_execute.c: Correct fix - - * zend_execute_API.c: *** empty log message *** - - * zend_execute.c: Fix a leak - -1999-05-28 Zeev Suraski - - * zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute_API.c: * Support getThis() for internal functions. - * Fix 'new object or die' and AiCount issue thoroughly (earlier fix didn't - work with the optimizer). - * Add new macros for standardized definition of classes. - * Only report AiCount problems if shutdown was not silent. - -1999-05-27 Zeev Suraski - - * zend_execute.c: Fix the AiCount issue with objects - - * zend_API.h: Moved all #define's for SET_ and RETURN_ to zend_API.h - -1999-05-25 Zeev Suraski - - * zend_execute_API.c: - Avoid crashing if an error occurs before we open the first file. - -1999-05-24 Zeev Suraski - - * zend_operators.c: The last fix was wrong - - * zend_operators.c: Another operators fix - -1999-05-23 Zeev Suraski - - * zend_operators.c: - boolean comparison didn't work with smaller-than and greater-than, something that - fucked up berber's site a bit. fixed. - -1999-05-22 Zeev Suraski - - * zend_execute.c: - Sigh, another leak bites the dust. FREE_OP missing in case of a SEND_VAR. - - * zend-parser.y: I'm on a roll. Fix a nasty yet stupid AiCount bug - - * zend_alloc.c: Warn about AiCount not zeroing out - - * zend-parser.y - zend-scanner.h - zend.h - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_compile.h - zend_constants.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_extensions.h - zend_highlight.h - zend_list.h - zend_llist.h - zend_ptr_stack.h - zend_stack.h: - * Add struct name to all typedef's so that they can be debugged with MSVC - * Fix an AiCount bug - list(...) = $var was using $var multiple times, and thus - causing AiCount to be decreased multiple times even though it was increased only - once for $var. Mark all FETCH_DIM's so that they won't decrease AiCount, and only - decrease AiCount on the last FETCH_DIM. - * Fix a stupid bug - forgot to pass CLS_C to some compiler function. For some reason - MSVC doesn't report these :I - - * zend.h - zend_alloc.c - zend_execute_API.c: - Give more information and save log lines in memory leak reports - - * zend-scanner.l - zend_compile.c - zend_compile.h - zend_globals.h - zend_llist.c - zend_llist.h: Avoid leaking fd's in case of failures - - * zend-scanner.l: more fixes - -1999-05-21 Zeev Suraski - - * zend-scanner.l: That wasn't supposed to slip in - - * zend-scanner.l: * Properly handle failed file opens in C++ - * Properly handle failed require()'s within libzend - - * zend-scanner.l: * Fix the comments issue. yymore() worked like a charm. - * Change all flex states to be prefixed with ST_ - -1999-05-20 Zeev Suraski - - * zend_compile.h - zend_execute.c: Optimize allocations into uninitialized_zval assignments - -1999-05-20 Andi Gutmans - - * config.w32.h - libzend.dsp - libzendts.dsp - zend_compile.c - zend_compile.h: - Updates we did today - - * zend_compile.c: - Fix a small problem with class decelerations. - - * zend-scanner.l: -Open curly braces fix? - -1999-05-15 Zeev Suraski - - * zend.c - zend.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_hash.c - zend-parser.y: - * Fix all hash checks that checked Bucket.arKey for NULL, when it was changed - to char[1], these checks should have been changed to Bucket.nKeyLength==0 - * Support runtime declaration of functions. I ended up changing the grammar - to catch top level functions vs. nested functions. The reason is simple - - if we don't have functions properly declared at compile-time, function calls - cannot be resolved at compile time, and have to be resolved at runtime, which - ends up being much much slower (without the optimizer, that is). - It's no biggy though, the grammar change isn't that bad. - -1999-05-14 Zeev Suraski - - * configure.in - zend-scanner.l: - If a require() dies, we must bail out (since it corrupts an existing op_array - - * zend-scanner.l: Fix a bug - -1999-05-14 stig - - * Makefile.am: don't install Zend on the system - -1999-05-14 Zeev Suraski - - * zend-scanner.l: - Add \012 and \xff missing support to constant quoted string - -1999-05-12 Zeev Suraski - - * zend.h: *** empty log message *** - -1999-05-12 stig - - * Makefile.am: install libzend.a and header files on "make install" - - * acconfig.h - configure.in: add --enable-thread-safety option - -1999-05-12 Zeev Suraski - - * zend_llist.c - zend_llist.h: Added prepend to llist - -1999-05-11 Zeev Suraski - - * zend-scanner.l - zend.c: Fixes: - * Avoid closing stdin (I could have sworn I've committed that already) - * unclean_shutdown patches - - * zend_alloc.c: Easier Win32 debug code - - * zend-scanner.l - zend_compile.c - zend_globals.h - zend_highlight.c: - * Fix a bug that occured in case of parse errors. We need to restore the lexical state - even if the compilation failed. - -1999-05-10 Zeev Suraski - - * zend-scanner.h - zend-scanner.l - zend.c - zend_alloc.c - zend_compile.h: - Weed out all BoundsChecker-found bugs (including a serious file descriptor leak - in the C++ scanner) - -1999-05-09 Zeev Suraski - - * zend_modules.h: Change argument name - - * zend.c - zend_API.c - zend_API.h - zend_modules.h: Almost forgot to commit those - -1999-05-06 Zeev Suraski - - * zend-scanner.l: Ok, I tested it now. It works very nicely! - -1999-05-05 Andi Gutmans - - * zend_llist.c - zend_llist.h: llist improvements - -1999-05-02 Andi Gutmans - - * zend.c - zend_compile.h: - Don't support interactive mode when thread safe. - -1999-05-01 Zeev Suraski - - * zend_operators.c: Several operator fixes. Should fix the MySQL problem. - -1999-04-30 Andi Gutmans - - * zend_opcode.c: - Free refcount when destroying the last class reference. - - * zend-parser.y: - Missed one place - - * zend-parser.y: - First try at fixing $a->foo[] syntax. - - * zend-scanner.l: - - Move back to yyless(). I haven't tested it yet because it's taking too long - to compile and I have to disconnect - -1999-04-30 Zeev Suraski - - * zend-parser.y - zend-scanner.l: - Fix Boris's problem (in my never ending struggle to show I never mean what I say - when I say something's not gonna happen :) - - * zend-scanner.l - zend_compile.c: - * Fix a problem with constant quoted strings, that was causing Thies's problem - * Remove a development-time printf - -1999-04-29 Andi Gutmans - - * zend-scanner.l: - No reason to handle newlines here. - -1999-04-28 Zeev Suraski - - * zend-scanner.l: Make the C++ scanner support interactive input - -1999-04-27 Zeev Suraski - - * zend-scanner.l - zend_compile.h - zend_execute_API.c - zend_extensions.c - zend_extensions.h - zend_opcode.c: * Fix debugger+interactive mode bug - * Recognize whether an extension is with debug information or not - -1999-04-26 Zeev Suraski - - * libzendts.dsp: fix - - * config.w32.h - libzend.dsp - libzendts.dsp - zend-scanner.l - zend.c - zend_alloc.c - zend_compile.h - zend_globals.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_opcode.c - zend_sprintf.c: Various thread safety fixes and DLL updates - -1999-04-26 Andi Gutmans - - * zend-scanner.l - zend.c - zend_alloc.c - zend_globals.h: -More commits - -1999-04-24 Zeev Suraski - - * zend_compile.c: Another small fix - - * libzendts.dsp: dsp update - - * zend.c - zend_globals.h: Thread safety fixes - - * zend_list.c: Remove redundant includes - -1999-04-24 zeevread - - * zend-scanner.l: g++ compile fix - -1999-04-24 Zeev Suraski - - * Makefile.am - zend-scanner.l: *** empty log message *** - - * zend_API.c - zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c - zend-parser.y - zend-scanner.l: Cleanups, remove old ts code - -1999-04-23 Zeev Suraski - - * zend_operators.c: Arithmetics bug fix - - * zend-scanner.h - zend-scanner.l: Support eval() and highlight_string() in the C++ scanner - -1999-04-23 Andi Gutmans - - * zend-scanner.l: - - Use yyless() instead of unput() where possible. I'll erase the commented - out code in a day or so. - -1999-04-23 Zeev Suraski - - * FlexLexer.h - flex.skl - zend-scanner.h - zend-scanner.l - zend.h - zend_alloc.c - zend_alloc.h - zend_compile.h - zend_globals.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_operators.h - zend_variables.h: Ok, call me crazy, because I probably am. - Thread safe version now uses a C++ scanner object. Works fully. - -1999-04-22 Zeev Suraski - - * acconfig.h - zend-parser.y - zend-scanner.l - zend_compile.c - zend_compile.h - zend_execute.c - zend_globals.h - zend_highlight.c - zend_indent.c - zend_opcode.c: Make token names uniform, they all begin with T_ now. - -1999-04-21 stig - - * buildconf: state which aclocal.m4 and configure files are created - - * Makefile.am: - zend-parser.o and zend-scanner.o were included twice in libzend.a - -1999-04-21 Zeev Suraski - - * FlexLexer.h - flex.skl - libzendts.dsp - zend_API.c - zend_API.h - zend_globals.h: - * Change the thread safe project to create a C++ scanner. - * Add in a slightly modified skeleton file (only a couple of #if's for #include's - that we dont have in Windows) - - It does NOT compile or work yet :) - - * zend_list.h: Fix - - * zend.c - zend_compile.c - zend_constants.c - zend_constants.h - zend_list.c - zend_list.h: - Thread safety patch. It works now with 'just in time' resource initialization! - - * libzend.dsp - libzendts.dsp - zend_globals.h: Thread-safe project - -1999-04-21 stig - - * buildconf: move automake back to before autoconf - - * buildconf: - autoheader must be called after autoconf, automake after autoheader - - * zend_config.h.in: think before one commits - - * zend_config.h.in: doh. cvs appears to ignore .in files by default - -1999-04-21 Zeev Suraski - - * zend-parser.y - zend-scanner.l - zend.c - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_compile.h - zend_constants.c - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_opcode.c: - Thread safety patch. We're still not quite there but it compiles again, and - more logic has been implemented. - -1999-04-20 stig - - * .cvsignore - Makefile.am - Makefile.in - aclocal.m4 - buildconf: Makefile.in and aclocal.m4 are generated - added buildconf script - -1999-04-19 Zeev Suraski - - * zend_extensions.c - zend_extensions.h: - Return a success value from the startup function, so we can unload immediately - if it fails. - -1999-04-19 stig - - * .cvsignore - Makefile.am - Makefile.in - acconfig.h - acinclude.m4 - aclocal.m4 - config.h.in - configure.in - zend.h: convert to automake - -1999-04-19 Andi Gutmans - - * zend_API.c - zend_API.h: Add a couple of ZEND_API's - - * config.w32.h - zend-parser.y - zend_compile.c - zend_execute.c: Support =unset as arguments - -1999-04-19 stig - - * acconfig.h - config.h.in - configure.in: removed -lnsl and -lsocket checks from zend - -1999-04-18 Zeev Suraski - - * zend_execute.c: AiCount needs to be decreased here - - * configure.in - zend-scanner.l - zend.c - zend.h - zend_API.c - zend_API.h - zend_alloc.c - zend_compile.c - zend_extensions.c - zend_extensions.h - zend_globals.h - zend_llist.c - zend_modules.h - zend_opcode.c: Whatnot: - * updated alloc_persist to use critical sections - * changed extension shutdown to two-phase - * updated dependencies - * PR support (don't remember if there was any really) - -1999-04-15 Andi Gutmans - - * zend_execute.c: - - one more place which seems to have needed fixing. I don't have time to look - more into it. I hope we don't have anymore places which need fixing. - - * zend_compile.c: - - Should fix the pass by reference problem. This happened because we moved - start from arg 1 now and not arg 0. There might be more places which need fixing - like in the executor but the bug seems OK now. - -1999-04-14 Zeev Suraski - - * zend_compile.h: Compile fix - -1999-04-14 Andi Gutmans - - * config.w32.h - libzend.dsp - zend-scanner.l - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_opcode.c: -Tiny patches - -1999-04-13 Zeev Suraski - - * zend_execute.c: Better detection - - * zend_execute.c: - Move Ai stuff before get_zval_*(), like Andi suggested. Fixes Sascha's huge - memory leak - -1999-04-13 Andi Gutmans - - * zend-parser.y - zend_compile.c - zend_execute.c - zend_execute_API.c: - Fix various memory leaks. - - * zend_execute.c: Refcount bugfix - - * libzend.dsp - zend_API.c - zend_execute_API.c - zend_ptr_stack.c: * Optimize argument_stack top lookup - * Fix a nasty bug in zend_ptr_stack_clean() - -1999-04-12 Zeev Suraski - - * zend_execute_API.c - zend_globals.h: Remove unnecessary stack - - * zend_API.c: off by one - - * zend_execute.c: Minor optimization - - * zend_API.c: Make functions that don't take arguments somewhat happier:) - - * zend_execute.c: - This should take care of "this" for user-defined functions. It wasn't yet working - for built-in functions anyway, this one is coming soon. - - * zend_compile.c - zend_execute_API.c: - Destroy the resource list after destroying the symbol table, otherwise the - auto-destructor for resources are run when the resource list is no longer valid - - * zend-parser.y - zend.h - zend_API.c - zend_API.h - zend_compile.c - zend_compile.h - zend_execute.c - zend_execute.h - zend_execute_API.c - zend_globals.h - zend_ptr_stack.c: - This patch is a go. Not fully optimized yet, but working properly. - Prepatch tagged as BEFORE_STACK_PATCH. - - * zend_compile.c - zend_execute.c: Minor fixes: - missing zval_copy_ctor() - messed up AiCount fix - -1999-04-10 Zeev Suraski - - * zend_alloc.c - zend_alloc.h: Allow runtime setting of the memory limit - - * zend_alloc.c - zend_alloc.h - zend_globals.h: Get rid of php3_ini in Zend - - * zend.c - zend.h: - We need to initialize the utility values after we initialize the INI file, which in - turn, is after we initialize Zend. Set the utility values separately from Zend's - initialization - -1999-04-09 Andi Gutmans - - * zend-scanner.l: - Changed here-docs to <<< followed by whitespace. - -1999-04-09 stig - - * .cvsignore: ignore file - -1999-04-09 Andi Gutmans - - * zend-parser.y - zend_compile.h: - - I guess print $GLOBALS and print "$GLOBALS" should yield the same result - so I returned the one in encaps_var. - - Made INITAL_OP_ARRAY_SIZE smaller (64? can't remeber). I don't think the - erealloc()'s during compile time are such a biggy, we might make it even - smaller. We can have a configure time option as to it's size. - - * zend-parser.y: - - Support $GLOBALS in cvar's. Now list(..) = each($GLOBALS) will work. - - Remove support of $GLOBALS in enacapsed strings. print "$GLOBALS" isn't - supposed to work in any case. - -1999-04-09 Zeev Suraski - - * zend-scanner.l: - Honor a semicolon on the same line as an ending token of a heredoc - - * zend_compile.c: Prevent class redeclarations - -1999-04-08 Zeev Suraski - - * zend_API.c - zend_modules.h: * Add arguments to shutdown functions - * Remove traces of php_ini stuff - - * zend-parser.y: "Our favourite mistake" - - * zend-parser.y - zend_compile.c - zend_compile.h - zend_execute.c - zend_opcode.c: $GLOBALS support - -1999-04-08 Andi Gutmans - - * ZEND_CHANGES: foreach() syntax has changed - -1999-04-08 Zeev Suraski - - * zend_compile.c - zend_execute.c: Fix static assignment - -1999-04-07 Zeev Suraski - - * zend_execute_API.c: Remove an unused variable - - * libzend.dsp: That's better. - - * libzend.dsp: We didn't save the .dsp back then... - - * ZendCore.dsp - ZendCore.dsw - ZendCore.mak - diffs - libzend.dsp: Cleanups: ZendCore->libzend - -1999-04-07 Rasmus Lerdorf - - * zend.c: *** empty log message *** - -1999-04-07 Andi Gutmans - - * LICENSE - Makefile.in - ZEND_CHANGES - configure.in - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.h - zend_API.c - zend_API.h - zend_compile.h - zend_errors.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: New file. - - * LICENSE - Makefile.in - ZEND_CHANGES - configure.in - zend-parser.y - zend-scanner.h - zend-scanner.l - zend.h - zend_API.c - zend_API.h - zend_compile.h - zend_errors.h - zend_execute.c - zend_execute_API.c - zend_globals.h - zend_hash.c - zend_hash.h - zend_list.c - zend_list.h - zend_llist.h - zend_opcode.c - zend_operators.c - zend_operators.h - zend_ptr_stack.c - zend_ptr_stack.h - zend_stack.c - zend_stack.h - zend_variables.c - zend_variables.h: Zend Library - - * ZendCore.dep - ZendCore.dsp - ZendCore.dsw - ZendCore.mak - acconfig.h - aclocal.m4 - config.h.in - config.unix.h - config.w32.h - diffs - zend.c - zend.ico - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute.h - zend_extensions.c - zend_extensions.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_llist.c - zend_modules.h - zend_sprintf.c: New file. - - * ZendCore.dep - ZendCore.dsp - ZendCore.dsw - ZendCore.mak - acconfig.h - aclocal.m4 - config.h.in - config.unix.h - config.w32.h - diffs - zend.c - zend.ico - zend_alloc.c - zend_alloc.h - zend_compile.c - zend_constants.c - zend_constants.h - zend_execute.h - zend_extensions.c - zend_extensions.h - zend_highlight.c - zend_highlight.h - zend_indent.c - zend_indent.h - zend_llist.c - zend_modules.h - zend_sprintf.c: Zend Library - diff --git a/Zend/FlexLexer.h b/Zend/FlexLexer.h deleted file mode 100644 index fd65258570..0000000000 --- a/Zend/FlexLexer.h +++ /dev/null @@ -1,186 +0,0 @@ -// $Header$ - -// FlexLexer.h -- define interfaces for lexical analyzer classes generated -// by flex - -// Copyright (c) 1993 The Regents of the University of California. -// All rights reserved. -// -// This code is derived from software contributed to Berkeley by -// Kent Williams and Tom Epperly. -// -// Redistribution and use in source and binary forms with or without -// modification are permitted provided that: (1) source distributions retain -// this entire copyright notice and comment, and (2) distributions including -// binaries display the following acknowledgement: ``This product includes -// software developed by the University of California, Berkeley and its -// contributors'' in the documentation or other materials provided with the -// distribution and in all advertising materials mentioning features or use -// of this software. Neither the name of the University nor the names of -// its contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -// This file defines FlexLexer, an abstract class which specifies the -// external interface provided to flex C++ lexer objects, and yyFlexLexer, -// which defines a particular lexer class. -// -// If you want to create multiple lexer classes, you use the -P flag -// to rename each yyFlexLexer to some other xxFlexLexer. You then -// include in your other sources once per lexer class: -// -// #undef yyFlexLexer -// #define yyFlexLexer xxFlexLexer -// #include -// -// #undef yyFlexLexer -// #define yyFlexLexer zzFlexLexer -// #include -// ... - -#ifndef FLEXLEXER_H -// Never included before - need to define base class. -#define FLEXLEXER_H -#include - -extern "C++" { - -struct yy_buffer_state; -typedef int yy_state_type; - -class FlexLexer { -public: - virtual ~FlexLexer() { } - - const char* YYText() { return yytext; } - int YYLeng() { return yyleng; } - - virtual void - yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; - virtual struct yy_buffer_state* - yy_create_buffer( istream* s, int size ) = 0; - virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; - virtual void yyrestart( istream* s ) = 0; - - virtual int yylex() = 0; - - // Call yylex with new input/output sources. - int yylex( istream* new_in, ostream* new_out = 0 ) - { - switch_streams( new_in, new_out ); - return yylex(); - } - - // Switch to new input/output streams. A nil stream pointer - // indicates "keep the current one". - virtual void switch_streams( istream* new_in = 0, - ostream* new_out = 0 ) = 0; - - int lineno() const { return yylineno; } - - int debug() const { return yy_flex_debug; } - void set_debug( int flag ) { yy_flex_debug = flag; } - -protected: - char* yytext; - int yyleng; - int yylineno; // only maintained if you use %option yylineno - int yy_flex_debug; // only has effect with -d or "%option debug" -}; - -} -#endif - -#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) -// Either this is the first time through (yyFlexLexerOnce not defined), -// or this is a repeated include to define a different flavor of -// yyFlexLexer, as discussed in the flex man page. -#define yyFlexLexerOnce - -class yyFlexLexer : public FlexLexer { -public: - // arg_yyin and arg_yyout default to the cin and cout, but we - // only make that assignment when initializing in yylex(). - yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 ); - - virtual ~yyFlexLexer(); - - void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); - struct yy_buffer_state* yy_create_buffer( istream* s, int size ); - void yy_delete_buffer( struct yy_buffer_state* b ); - void yyrestart( istream* s ); - - virtual int yylex(); - virtual void switch_streams( istream* new_in, ostream* new_out ); - -protected: - virtual int LexerInput( char* buf, int max_size ); - virtual void LexerOutput( const char* buf, int size ); - virtual void LexerError( const char* msg ); - - void yyunput( int c, char* buf_ptr ); - int yyinput(); - - void yy_load_buffer_state(); - void yy_init_buffer( struct yy_buffer_state* b, istream* s ); - void yy_flush_buffer( struct yy_buffer_state* b ); - - int yy_start_stack_ptr; - int yy_start_stack_depth; - int* yy_start_stack; - - void yy_push_state( int new_state ); - void yy_pop_state(); - int yy_top_state(); - - yy_state_type yy_get_previous_state(); - yy_state_type yy_try_NUL_trans( yy_state_type current_state ); - int yy_get_next_buffer(); - - istream* yyin; // input source for default LexerInput - ostream* yyout; // output sink for default LexerOutput - - struct yy_buffer_state* yy_current_buffer; - - // yy_hold_char holds the character lost when yytext is formed. - char yy_hold_char; - - // Number of characters read into yy_ch_buf. - int yy_n_chars; - - // Points to current character in buffer. - char* yy_c_buf_p; - - int yy_init; // whether we need to initialize - int yy_start; // start state number - - // Flag which is used to allow yywrap()'s to do buffer switches - // instead of setting up a fresh yyin. A bit of a hack ... - int yy_did_buffer_switch_on_eof; - - // The following are not always needed, but may be depending - // on use of certain flex features (like REJECT or yymore()). - - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - yy_state_type* yy_state_buf; - yy_state_type* yy_state_ptr; - - char* yy_full_match; - int* yy_full_state; - int yy_full_lp; - - int yy_lp; - int yy_looking_for_trail_begin; - - int yy_more_flag; - int yy_more_len; - int yy_more_offset; - int yy_prev_more_offset; -}; - -#endif diff --git a/Zend/LICENSE b/Zend/LICENSE deleted file mode 100644 index ec736b0031..0000000000 --- a/Zend/LICENSE +++ /dev/null @@ -1,56 +0,0 @@ --------------------------------------------------------------------- - The Zend Engine License, Version 2.00 -Copyright (c) 1999-2003 Zend Technologies Ltd. All rights reserved. --------------------------------------------------------------------- - -Redistribution and use in source and binary forms, with or without -modification, is permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - 3. The names "Zend" and "Zend Engine" must not be used to endorse - or promote products derived from this software without prior - permission from Zend Technologies Ltd. For written permission, - please contact license@zend.com. - - 4. Zend Technologies Ltd. may publish revised and/or new versions - of the license from time to time. Each version will be given a - distinguishing version number. - Once covered code has been published under a particular version - of the license, you may always continue to use it under the - terms of that version. You may also choose to use such covered - code under the terms of any subsequent version of the license - published by Zend Technologies Ltd. No one other than Zend - Technologies Ltd. has the right to modify the terms applicable - to covered code created under this License. - - 5. Redistributions of any form whatsoever must retain the following - acknowledgment: - "This product includes the Zend Engine, freely available at - http://www.zend.com" - - 6. All advertising materials mentioning features or use of this - software must display the following acknowledgment: - "The Zend Engine is freely available at http://www.zend.com" - -THIS SOFTWARE IS PROVIDED BY ZEND TECHNOLOGIES LTD. ``AS IS'' AND -ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZEND -TECHNOLOGIES LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. - --------------------------------------------------------------------- diff --git a/Zend/Makefile.am b/Zend/Makefile.am deleted file mode 100644 index 8f1948eefc..0000000000 --- a/Zend/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -## Process this file with automake to produce Makefile.in -*- makefile -*- - -#CLEANFILES = zend_language_parser.c zend_language_parser.h zend_language_scanner.c zend_language_parser.output zend_ini_parser.c zend_ini_parser.h zend_ini_scanner.c zend_ini_parser.output - -AUTOMAKE_OPTIONS=foreign -noinst_LTLIBRARIES=libZend.la - -libZend_la_SOURCES=\ - zend_language_parser.y zend_language_scanner.l \ - zend_ini_parser.y zend_ini_scanner.l \ - zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \ - zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \ - zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \ - 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 - -libZend_la_LDFLAGS = -libZend_la_LIBADD = @ZEND_EXTRA_LIBS@ - -# automake isn't too clever about "non-standard" use of lex and yacc - -$(libZend_la_OBJECTS): zend_language_parser.h - -zend_ini_scanner.lo: zend_ini_parser.h - -# Language parser/scanner rules - -zend_language_scanner.c: $(srcdir)/zend_language_scanner.l - $(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l - -zend_language_parser.h: zend_language_parser.c -zend_language_parser.c: $(srcdir)/zend_language_parser.y - $(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o zend_language_parser.c - -# INI parser/scanner rules - -zend_ini_parser.c: $(srcdir)/zend_ini_parser.y - $(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o zend_ini_parser.c - -zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l - $(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l - -zend_ini_parser.h: zend_ini_parser.c - -depend: - -zend_execute.lo: $(srcdir)/zend_execute.c - $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(INLINE_CFLAGS) -c $(srcdir)/zend_execute.c - diff --git a/Zend/OBJECTS2_HOWTO b/Zend/OBJECTS2_HOWTO deleted file mode 100644 index aef370330d..0000000000 --- a/Zend/OBJECTS2_HOWTO +++ /dev/null @@ -1,195 +0,0 @@ -Creating an object ------------------- - -Object can be created in the following ways: - -1. As a result of a function call. E.g.: - -$foo = create_new_foo("parameter"); -$foo->run(); - -The function should create a new zval, create new object and get the -handle for it, set handle and handler table as needed. Note that the -handle is the only ID of the object, so it should be enough to -identify it. - -2. Overriding create_object handler for class. E.g.: - -$foo = new Java("some.Class.here", "parameter"); -$foo->run(); - -The create_object handler function should create a new zval, create -new object and get the handle for it, set handle and handler table as -needed, and also provide constructor method that would handle -constructor call. The get_constructor handler table entry should be -used for that. Do not rely class entry's constructor, unless you refer -to it from get_constructor handler. - -Object maintenance ------------------- - -The handlers add_ref and del_ref are called when a new zval referring -to the object is created. This does not create a new object - both -zvals still refer to the same object. - -clone_obj handler should create a new object, identical to an old one, -but being a separate entity. - -delete_obj should destroy an object, all references to it become -invalid. - -Object access - read --------------------- - -read_property is used to read object's property. This value is not -meant to be changed. The handler returns zval * with the value. - -Object access - write ---------------------- - -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 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 -read_property and write_property instead. - -get_property_ptr is used to obtain zval ** for future writing to -it. If your object properties are stored as zval*, return real place -where the property is stored. If the aren't, the best way is to create -proxy object and handle it via get and set methods (see below). -This method is meant to be used for send-by-reference and assign-by-reference -use of object properties. If you don;t want to implement property -referencing for your objects, you can set this handler to NULL. - -get and set handlers are used when engine needs to access the object -as a value. E.g., in the following situation: - -$foo =& $obj->bar; -$foo = 1; - -if $foo is an object (e.g., proxy object from get_property_ptr) it -would be accessed using write handler. - -Object access - method call ---------------------------- - -get_method handler is used to find method description by name. It -should set right type, function name and parameter mask for the -method. If the type is ZEND_OVERLOADED_FUNCTION, the method would be -called via call_method handler, otherwise it would be called with -standard Zend means. - -get_constructor performs the same function as get_method, but for the -object constructor. - -call_method handler is used to perform method call. Parameters are -passed like to any other Zend internal function. - -Object - comparison -------------------- - -Objects can be compared via compare_objects handler. This is used with -== operation, === compares objects by handles, i.e., return true if -and only if it's really the same object. Note that objects from -different object types (i.e., having different handlers) can not be -compared. - -Objects - reflection --------------------- - -get_class_name is used to retrieve class name of the object. -get_class_entry returns class entry (zend_class_entry) for the object, -in case there exists PHP class for it. -No other reflection functions are currently implemented. - -Objects - data structures and handlers ---------------------------------------- - -The object is represented by the following structure: - -struct _zend_object_value { - zend_object_handle handle; - zend_object_handlers *handlers; -}; - -handle is an ID of the object among the objects of the same type (not -class!). The type of the object and how it behaves is determined by -the handler table. - -typedef struct _zend_object_handlers { - zend_object_add_ref_t add_ref; - zend_object_del_ref_t del_ref; - zend_object_delete_obj_t delete_obj; - zend_object_clone_obj_t clone_obj; - zend_object_read_property_t read_property; - zend_object_write_property_t write_property; - zend_object_get_property_ptr_t get_property_ptr; - zend_object_get_property_zval_ptr_t get_property_zval_ptr; - zend_object_get_t get; - zend_object_set_t set; - zend_object_has_property_t has_property; - zend_object_unset_property_t unset_property; - zend_object_get_properties_t get_properties; - zend_object_get_method_t get_method; - zend_object_call_method_t call_method; - zend_object_get_constructor_t get_constructor; - zend_object_get_class_entry_t get_class_entry; - zend_object_get_class_name_t get_class_name; - zend_object_compare_t compare_objects; -} zend_object_handlers; - -See zend_object_handlers.h for prototypes. All objects are passed as zval's. - -Handlers explained: - -add_ref - called when a copy of the object handle is created. - -del_ref - called when a copy of the object handle is destroyed. - -delete_obj - called when an object needs to be destroyed. - -clone_obj - called when a new object identical to an old one should be -created (unlike Zend Engine 1, this never happens unless explicitly -asked for). - -read_property - returns zval *, containing the value of the -property. Is used when value of the property should be retrieved for -reading. - -write_property - assigns value to certain property of the object. - -get_property_zval_ptr - retrieves zval** for being directly modified by -the engine. If your properties are not zval's, don't define it. - -get_property_ptr - retrieves zval** for the property of the value, to -be used for read and write. If object properties are not zval's -natively, this method should create and return proxy object for use -with get and set methods. - -get - retrieves zval* for object contents. To be used mainly with -proxy objects from get_property_ptr, but also may be used for -convert_to_* functions. - -set - sets value for object contents. To be used mainly with -proxy objects from get_property_ptr. - -has_property - checks if the object has certain property set. - -unset_property - removes value for the property of the object - -get_method - retrieves description of the method - -call_method - calls the method (parameters should be put on stack like -for any other PHP internal function). - -get_constructor - get description for the object constructor method - -get_class_entry - should return the class entry for the object - -get_class_name - get the name of the class the object belongs to - -compare_objects - compares if two objects are equal diff --git a/Zend/RFCs/001.txt b/Zend/RFCs/001.txt deleted file mode 100644 index bf1d847b97..0000000000 --- a/Zend/RFCs/001.txt +++ /dev/null @@ -1,136 +0,0 @@ -Revamped object model using object handles -=========================================== - -Background ----------- - -In the Zend Engine 1.0 (and its predecessor the PHP 3 scripting -engine) the object model's design is that instantiated objects are -language values. This means that when programmers are performing -operations, such variable assignment and passing parameters to -functions, objects are handled very similarly to the way other -primitive types are handled such as integers and strings. -Semantically this means that the whole object is being copied. The -approach Java takes is different where one refers to objects by handle -and not by value (one can think of a handle as an objects' ID). - -Need ----- - -Unfortunately, the approach taken up to now has severely limited the -Zend Engine's object oriented model, both feature and simplicity -wise. One of the main problems with the former approach is that object -instantiation and duplication is very hard to control, a problem which -can not only lead to inefficient development but also often to strange -run-time behavior. Changing the object model to a handle oriented -model will allow the addressing of many needs such as destructors, -de-referencing method return values, tight control of object -duplication and more. - -Overview --------- - -The proposed object model is very much influenced by the Java -model. In general, when you create a new object you will be getting a -handle to the object instead of the object itself. When this handle is -sent to functions, assigned and copied it is only the handle which is -copied/sent/assigned. The object itself is never copied nor -duplicated. This results in all handles of this object to always point -at the same object making it a very consistent solution and saving -unnecessary duplication and confusing behavior. - -Functionality -------------- - -After this change the basic use of objects will be almost identical to -previous versions of the scripting engine. However, you won't bump -into awkward and confusing copying & destructing of objects. In order -to create and use a new object instance you will do the following: -$object = new MyClass(); $object->method(); - -The previous code will assign $object the handle of a new instance of -the class MyClass and call one of its methods. - - -Consider the following code: - -1 class MyClass -2 { -3 function setMember($value) -4 { -5 $this->member = $value; -6 } -7 -8 function getMember() -9 { -10 return $this->member; -11 } -12 } -13 -14 function foo($obj) -15 { -16 $obj->setMember("foo"); -17 } -18 -19 $object = new MyClass(); -20 $object->setMember("bar"); -21 foo($object); -22 print $object->getMember(); - -Without the new Java-like handles, at line 20 the objects' data member -member is set to the string value of "bar". Because of the internal -representation of objects in the Zend Engine 1.0, the object is marked -as a reference, and when it is sent by value to the function foo, it -is duplicated (!). Therefore, the call to foo() on line 21 will -result in the $obj->setMember("foo") call being called on a duplicate -of $object. Line 22 will then result in "bar" being printed. - -This is how the scripting engine has worked until today. Most -developers are probably unaware of the fact that they aren't always -talking to the same object but often duplicates; others may have -realized this can usually be solved by always passing objects by -reference (unless a replica is actually desired, which is uncommon). - -The new object model will allow for a much more intuitive -implementation of the code. On line 21, the object's handle (ID) is -passed to foo() by value. Inside foo(), the object is fetched -according to this handle and, therefore, the setMember() method is -called on the originally instantiated object and not a copy. Line 22 -will therefore result in "foo" being printed. This approach gives -developers tighter control of when objects are created and duplicated. -An additional not-as-important benefit is that the object handle will -be passed to foo() by value, which most probably will also save -unnecessary duplication of the value containing the ID itself and thus -additionally improving run-time performance. - -This was just a simple description of why the new object model solves -awkward behavior and makes object handling much easier, intuitive and -efficient. The importance of this change goes far beyond what is -mentioned in this section as you will see in further sections which -describe new features with a majority of them being based on this -change. - -Compatibility Notes --------------------- - -Many PHP programmers aren't even aware of the copying quirks of the -current object model and, therefore, there is a relatively good chance -that the amount of PHP applications that will work out of the box or -after a very small amount of modifications would be high. - -To simplify migration, version 2.0 will support an optional -'auto-clone' feature, which will perform a cloning of the object -whenever it would have been copied in version 1.0. Optionally, it -will also be possible to request that the engine will emit an E_NOTICE -message whenever such an automatic clone occurs, in order to allow -developers to gradually migrate to the version 2.0-style behavior -(without automatic clones). - -Dependencies ------------- - -The new object model is not dependent on other features. Many of the -other Zend Engine 2.0 features, such as the $foo->bar()->barbara() -syntax, destructors and others completely rely on this new object -model. - diff --git a/Zend/RFCs/002.txt b/Zend/RFCs/002.txt deleted file mode 100644 index c7e00d6677..0000000000 --- a/Zend/RFCs/002.txt +++ /dev/null @@ -1,169 +0,0 @@ -Title: Zend 2.0 Namespaces -Version: $Revision$ -Status: draft -Maintainer: Stig S. Bakken -Created: 2001-09-08 -Modified: 2001-09-08 - - -1. Background/Need -================== - -PHP and Zend 1.0 have come to a point where a lot of reusable code is -being written; from simple functions and classes to entire application -frameworks. It is becoming increasingly difficult to avoid symbol -name collisions with the current scoping methods. - -The symbol scopes available in Zend 1.0 are the global scope, the -class scope and the function scope. All scopes but classes may -contain variables, only the class and global scopes may contain -functions, while only the global scope may contain constants and -classes. This means that all of Zend 1.0's scoping methods are -inherently limited for solving symbol name collision problems. - - -2. Overview -=========== - -Namespaces in Zend 2.0 provide a way to manage the symbol collision -problem by making it possible to define multiple symbol tables able to -contain all types of symbols. Zend will get the notion of a current -namespace, defaulting to the current global one. The current name -space may be changed on a file-by-file basis. Symbols in other name -spaces than the current one may be referenced using a new namespace -operator. It will be possible to "import" symbols from one namespace -into another. - - -3. Functionality -================ - -3.1. Namespace Syntax -===================== - -The namespace operator ":" is used to refer to symbols in other -namespaces than the current one: - -Class: Namespace:class -Function: Namespace:function -Static method: Namespace:class::method -Variable: $Namespace:variable -Constant: Namespace:CONSTANT -Class variable: $Namespace:class::variable - -To refer to symbols in the global namespace, symbols are prefixed with -only the namespace operator: - -Class: :class -Function: :function -Static method: :class::method -Variable: $:variable -Constant: :CONSTANT -Class variable: $:class::variable - -Note: $:variable will effectively be just another syntax for -$GLOBALS['variable']. - -A namespace may have a name containing a ":", it is always the last -":" character in the symbol qualifier that is the actual namespace -operator: - -Class: Name:Space:class -Function: Name:Space:function -Static method: Name:Space:class::method -Variable: $Name:Space:variable -Constant: Name:Space:CONSTANT -Class variable: $Name:Space:class::variable - -(Here, the ":" between "Name" and "Space" is part of the name, it is -the one after "Space" that is the namespace operator.) - - -3.2. Defining Namespaces -======================== - -Individual files may define a namespace that will apply to the entire -file. If no "namespace" operator occurs in the file, it will be in -the global namespace: - - 1 namespace HTML; - 2 - 3 class Form { - 4 function Form() { - 5 // constructor - 6 } - 7 // ... - 8 } - -Or with the "nested" name syntax: - - 1 namespace HTML:Form; - 2 - 3 class Image { - 4 var $src; - 5 function Image($src) { - 6 $this->src = $src; - 7 } - 8 // ... - 9 } - -Code executed within the "HTML" namespace may refer to the Form class -as just "Form". Code executed from within other namespaces has to -refer to it as "HTML:Form". The "namespace" statement must occur -before any other statements in the file. - -# [ssb 2001-09-08]: -# Should it be possible to "add" symbols to a namespace by including a -# second file with the same namespace statement? - - -3.3. Importing Symbols -====================== - -It is possible to import symbols from another namespace into the -current one with the "import" statement: - - import * from HTML; // all symbols - - import Form from HTML; // single symbols - - import Form,Table from HTML; // multiple symbols - -There is a potential for name clashes between symols of different -types that have the same qualifier syntax. These are resolved in this -order: class, function, constant. - -Optionally, the symbol type may be explicitly given to import (as -"class", "function", "variable" or "constant"): - - import class Form from HTML; - -And finally, you may import all symbols of a given type: - - import constant * from HTML:Table; - -The namespace with its symbols must already be defined before using -"import". - - -4. Compatibility Notes -====================== - -Old code that does not take advantage of namespaces will run without -modifications. - - -5. Dependencies -=============== - -The class variable syntax depends on this class variables being -implemented in the new ZE2 object model. - - -6. Acknowledgements -=================== - -Andi Gutmans and Zeev Suraski for -initial ZE2 namespaces proposal - -Dean Hall for the initial symbol qualification syntax diff --git a/Zend/RFCs/003.txt b/Zend/RFCs/003.txt deleted file mode 100644 index aa90691b19..0000000000 --- a/Zend/RFCs/003.txt +++ /dev/null @@ -1,72 +0,0 @@ -Title: Loose type requirements for functions -Version: $Revision$ -Status: draft -Maintainer: Brian Moon -Created: 2001-09-17 -Modified: 2001-09-17 - - -1. Background/Need -================== - -Many internal function of PHP will reject parameters because of their -type (the array and variable function come to mind). For userland -this is not an easy task as there is no uniform way to do it. An -addition to the engine for requiring loose types would allow -delevopers to know that the data passed to their functions is of the -correct type and reduce the need for duplicating the same code in -every function to check for the type of data. - - -2. Overview -=========== - -Loose typing mostly means evaluating the contents of the variable and -not the type of the variable itself. The requirements for this would -and should work much like several of the is_* functions do now. - -The typing of parameters would be optional and those not typed would -simply continue to be treated as they are now. - -3. Functionality -================ - -3.1. Allowed Types -================== - -Only loose types should be needed to ensure the data is usable by the -function. Duplicating the functionallity of is_scalar, is_resource, -is_array and is_object should give developers all the information they -need to use a variable correctly. - -3.2. Syntax -=========== - -The current function syntax should be expanded to allow typing of -variables inline in a C style. - -function foo ($var){ -} - -could be changed to require an array such as: - -function foo (array $var){ -} - -3.3. Errors -=========== - -Mis-matches in type should be reported as fatal errors and should halt -the execution of a script as that function can not be run and code -following could not reliably run. - - -4. Compatibility Notes -====================== - -Old code that does not take advantage of this will run without -modifications. - - - - diff --git a/Zend/RFCs/004.txt b/Zend/RFCs/004.txt deleted file mode 100644 index 1e120ce306..0000000000 --- a/Zend/RFCs/004.txt +++ /dev/null @@ -1,107 +0,0 @@ -Title: Delegation - (a/k/a. Object-Based Inheritance) -Version: $Revision$ -Status: draft -Maintainer: Sebastian Bergmann - - -Dynamic Delegation - - Syntax / Example - - 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 - - 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 - - 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. diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES deleted file mode 100644 index 18ed6c6421..0000000000 --- a/Zend/ZEND_CHANGES +++ /dev/null @@ -1,802 +0,0 @@ -Changes in the Zend Engine 2.0 - - * New Object Model. - - The Zend Engine's handling of objects has been completely - changed in order to allow for new features, but also to increase - its performance. - - Objects were handled in previous versions like primitive types - (for instance integers and strings). The drawback of this method - is, that semantically the whole object was copied when a - variable was assigned or parameters were passed to a method. The - new approach refers to objects by handle and not by value (one - can think of a handle as an object's ID). - - Many PHP programmers aren't even aware of the copying quirks of - the old object model and, therefore, there is a relatively good - chance that the amount of PHP applications that will work out of - the box or after a very small amount of modifications would be - high. - - * 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 - member variable. - - Example: - - Hello; - print "MyClass::printHello() " . $this->Bar; - print "MyClass::printHello() " . $this->Foo; - } - } - - class MyClass2 extends MyClass { - protected $Foo; - - function printHello() { - MyClass::printHello(); /* Should print */ - print "MyClass2::printHello() " . $this->Hello; /* Shouldn't print out anything */ - print "MyClass2::printHello() " . $this->Bar; /* Shouldn't print (not declared)*/ - print "MyClass2::printHello() " . $this->Foo; /* Should print */ - } - } - - $obj = new MyClass(); - print $obj->Hello; /* Shouldn't print out anything */ - print $obj->Bar; /* Shouldn't print out anything */ - print $obj->Foo; /* Shouldn't print out anything */ - $obj->printHello(); /* Should print */ - - $obj = new MyClass2(); - print $obj->Hello; /* Shouldn't print out anything */ - print $obj->Bar; /* Shouldn't print out anything */ - 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 - only be accessed by the class they belong to. - - * Private and protected methods. - - The Zend Engine 2.0 introduces private and protected methods. - - Example: - - aPrivateMethod(); - } - } - - class Bar extends Foo { - public function aPublicMethod() { - echo "Bar::aPublicMethod() called.\n"; - $this->aProtectedMethod(); - } - } - - $o = new Bar; - $o->aPublicMethod(); - ?> - - 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 - needs to be declared abstract. - - Example: - - test(); - ?> - - Abstract classes cannot be instantiated. - - Old code that has no user-defined classes or functions named - 'abstract' should run without modifications. - - * Interfaces. - - The Zend Engine 2.0 introduces interfaces. A class may implement - an arbitrary list of interfaces. - - Example: - - - - Old code that has no user-defined classes or functions named - 'interface' or 'implements' should run without modifications. - - * 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 - objects that are passed as parameters to a method. - - Example: - - a($b); - $a->b($b); - ?> - - These class type hints are not checked upon compilation, as would - be the case in a typed language, but during runtime. - - This means that - - function foo(ClassName $object) { - // ... - } - - is equivalent to - - function foo($object) { - if (!($object instanceof ClassName)) { - die('Argument 1 must be an instance of ClassName'); - } - } - - This syntax only applies to objects/classes, not built-in types. - - * final. - - The Zend Engine 2.0 introduces the "final" keyword to declare - final members and methods. Those cannot be overridden by - sub-classes. - - Example: - - - - Old code that has no user-defined classes or functions named - 'final' should run without modifications. - - * Object Cloning. - - The Zend Engine 1.0 offered no way a user could decide what copy - constructor to run when an object is duplicated. During - duplication, the Zend Engine 1.0 did a bitwise copy making an - identical replica of all the object's properties. - - Creating a copy of an object with fully replicated properties is - not always the wanted behavior. A good example of the need for - copy constructors, is if you have an object which represents a - GTK window and the object holds the resource of this GTK window, - when you create a duplicate you might want to create a new - window with the same properties and have the new object hold the - resource of the new window. Another example is if your object - holds a reference to another object which it uses and when you - 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 calling the object's __clone() - method. - - Example: - - __clone(); - ?> - - When the developer asks to create a new copy of an object, the - Zend Engine will check if a __clone() method has been defined or - not. If not, it will call a default __clone() which will copy - 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 - 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: - - id = self::$id++; - } - - function __clone() { - $this->name = $that->name; - $this->address = 'New York'; - $this->id = self::$id++; - } - } - - $obj = new MyCloneable(); - - $obj->name = 'Hello'; - $obj->address = 'Tel-Aviv'; - - print $obj->id . "\n"; - - $obj = $obj->__clone(); - - print $obj->id . "\n"; - print $obj->name . "\n"; - print $obj->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: - - - - 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 - for classes. Classes which have a constructor method call this - method on each newly-created object, so it is suitable for any - initialization that the object may need before it can be used. - - With the Zend Engine 1.0, constructor methods were class methods - that had the same name as the class itself. Since it is very - common to call parent constructors from derived classes, the way - the Zend Engine 1.0 worked made it a bit cumbersome to move - classes around in a large class hierarchy. If a class is moved - to reside under a different parent, the constructor name of that - parent changes as well, and the code in the derived class that - calls the parent constructor has to be modified. - - The Zend Engine 2.0 introduces a standard way of declaring - constructor methods by calling them by the name __construct(). - - Example: - - - - For backwards compatibility, if the Zend Engine 2.0 cannot find - a __construct() function for a given class, it will search for - the old-style constructor function, by the name of the class. - Effectively, it means that the only case that would have - compatibility issues is if the class had a method named - __construct() which was used for different semantics. - - * Destructors. - - Having the ability to define destructors for objects can be very - useful. Destructors can log messages for debugging, close - database connections and do other clean-up work. - - No mechanism for object destructors existed in the Zend Engine - 1.0, although PHP had already support for registering functions - which should be run on request shutdown. - - The Zend Engine 2.0 introduces a destructor concept similar to - that of other object-oriented languages, such as Java: When the - last reference to an object is destroyed the object's - destructor, which is a class method name __destruct() that - recieves no parameters, is called before the object is freed - from memory. - - Example: - - name = 'MyDestructableClass'; - } - - function __destruct() { - print 'Destroying ' . $this->name . "\n"; - } - } - - $obj = new MyDestructableClass(); - ?> - - Like constructors, parent destructors will not be called - implicitly by the engine. In order to run a parent destructor, - one would have to explicitly call parent::__destruct() in the - destructor body. - - * Constants. - - The Zend Engine 2.0 introduces per-class and per-namespace - constants. - - Example: - - - - The Zend Engine 2.0 allows for expressions within constants: - - - - 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. - - Example: - - exception = $exception; - } - - function Display() { - print "MyException: $this->exception\n"; - } - } - - class MyExceptionFoo extends MyException { - function __construct($exception) { - $this->exception = $exception; - } - - function Display() { - print "MyException: $this->exception\n"; - } - } - - try { - throw new MyExceptionFoo('Hello'); - } - - catch (MyException $exception) { - $exception->Display(); - } - ?> - - Old code that has no user-defined classes or functions 'catch', - 'throw' and 'try' will run without modifications. - - * Dereferencing objects returned from functions. - - Example: - - draw(); - ShapeFactoryMethod('Square')->draw(); - ?> - - * Static member variables of static classes can now be - initialized. - - Example: - - - - * Static Methods. - - The Zend Engine 2.0 introduces the 'static' keyword to declare - a method static, thus callable from outside the object context. - - Example: - - - - The pseudo variable $this is not available inside a method that - has been declared static. - - * instanceof (TBD) - - * Static function variables. - - 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. - - Example: - - - - * __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. - - Example: - - - - * Method calls and property accesses can be overloaded - by class methods __call(), __get() and __set(). - - __get() and __set() Example: - - 1, 'b' => 2, 'c' => 3); - - function __get($nm) { - print "Getting [$nm]\n"; - - if(isset($this->x[$nm])) { - $r = $this->x[$nm]; - print "Returning: $r\n"; - return $r; - } else { - print "Nothing!\n"; - } - } - - function __set($nm, $val) { - print "Setting [$nm] to $val\n"; - - if(isset($this->x[$nm])) { - $this->x[$nm] = $val; - print "OK!\n"; - } else { - print "Not OK!\n"; - } - } - } - - $foo = new Setter(); - $foo->n = 1; - $foo->a = 100; - $foo->a++; - $foo->z++; - var_dump($foo); - ?> - - __call() Example: - - x; - } - } - - $foo = new Caller(); - $a = $foo->test(1, '2', 3.4, true); - var_dump($a); - ?> - - -Changes in the Zend Engine 1.0 - - The Zend Engine was designed from the ground up for increased speed, - reduced memory consumption and more reliable execution. We dare say - it meets all of these goals and does so pretty well. Beyond that, - there are several improvements in the language engine features: - - * References support. - - $foo = &$a; would make $foo and $a be two names to the same - variable. This works with arrays as well, on either side; e.g., - $foo = &$a[7]; would make $foo and $a[7] be two names to the - same variable. Changing one would change the other and vice - versa. - - * Object overloading support. - - This feature allows various OO libraries to use the OO notation - of PHP to access their functionality. Right now, no use is made - of that feature, but we'd have a COM module ready by the time - PHP 4.0 is released. A CORBA module would probably follow. - - * include() and eval() are now functions, and not statements. - - That means they return a value. The default return value from - include() and eval() is 1, so that you can do if (include()) - without further coding. The return value may be changed by - returning a value from the global scope of the included file or - the evaluated string. For example, if 'return 7;' is executed in - the global scope of foo.inc, include('foo.inc') would evaluate - to 7. - - * Automatic resource deallocation. - - Several people have been bitten by the fact that PHP 3.0 had no - concept of reference counting. The Zend Engine adds full - reference counting for every value in the system, including - resources. As soon as a resource is no longer referenced from - any variable, it is automatically destroyed to save memory and - resources. The most obvious example for the advantage in this is - a loop that has an SQL query inside it, something like '$result - = sql_query(...);'. In PHP 3.0, every iteration resulted in - another SQL result-set allocated in the memory, and all of the - result sets weren't destroyed until the end of the script's - execution. With the Zend Engine, as soon as we overwrite an old - result set with a new one, the old result set which is no longer - referenced, is destroyed. - - * Full support for nesting arrays and objects within each other, - in as many levels as you want. - - * true and false are now constants of type boolean. - - Comparing any other value to them would convert that value to a - boolean first, and conduct the comparison later. That means, for - example, that 5==true would evaluate to true (in PHP 3.0, true - was nothing but a constant for the integer value of 1, so - 5==true was identical to 5==1, which was false). - - * Runtime binding of function names. - - This complex name has a simple explanation - you can now call - functions before they're declared! - - * Added here-docs support. - - * Added foreach. - - Two syntaxes supported: - - foreach(array_expr as $val) statement - foreach(array_expr as $key => $val) statement - - * A true unset() implementation. - - A variable or element that is unset(), is now sent to oblivion - in its entirely, no trace remains from it. - - * Output buffering support. - - Use ob_start() to begin output buffering, ob_end_flush() to end - buffering and send out the buffered contents, ob_end_clean() to - end buffering without sending the buffered contents, and - ob_get_contents() to retreive the current contents of the output - buffer. Header information (header(), content type, cookies) are - not buffered. By turning on output buffering, you can - effectively send header information all throughout your file, - regardless of whether you've emitted body output or not. - - * Full variable reference within quoted strings: - - ${expr} - full indirect reference support for scalar - variables - {variable} - full variable support - - For example: - - $foo[5]['bar'] = 'foobar'; - print "{$foo[5]["bar"]}"; // would print "foobar" - - * Ability to call member functions of other classes from within - member functions or from the global scope. - - You can now, for example, override a parent function with a - child function, and call the parent function from it. - - * Runtime information for classes (class name, parent, available - functions, etc.). - - * Much more efficient syntax highlighter - runs much quicker, - performs more reliably, and generates much tighter HTML. - - * A full-featured debugger has been integrated with the language - (supports breakpoints, expression evaluation, step-in/over, - function call backtrace, and more). - - The Zend Engine claims 100% compatability with the engine of PHP - 3.0, and is shamelessly lying about it. Here's why: - - * Static variable initializers only accept scalar values - (in PHP 3.0 they accepted any valid expression). The impact - should be somewhere in between void and non existent, since - initializing a static variable with anything but a simple - static value makes no sense at all. - - * The scope of break and continue is local to that of an - include()'d file or an eval()'d string. The impact should - be somewhat smaller of the one above. - - * The return statement no longer works from a require()'d file. It - hardly worked in PHP 3.0, so the impact should be fairly small. If - you want this functionality - use include() instead. - - * unset() is no longer a function, but a statement. - - * The following letter combination is not supported within - encapsulated strings: "{$". If you have a string that includes - this letter combination, for example, print "{$somevar"; (which - printed the letter { and the contents of the variable $somevar in - PHP 3.0), it will result in a parse error with the Zend Engine. - In this case, you would have to change the code to print - "\{$somevar"; This incompatability is due to the full variable - reference within quoted strings feature added in the Zend - Engine. diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp deleted file mode 100644 index 542fdf724d..0000000000 --- a/Zend/Zend.dsp +++ /dev/null @@ -1,586 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Zend" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=Zend - Win32 Release_inline -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Zend.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Zend.mak" CFG="Zend - Win32 Release_inline" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Zend - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "Zend - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "Zend - Win32 Release_inline" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Zend - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40d /d "NDebug" -# ADD RSC /l 0x40d /d "NDebug" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "Zend - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x40d /d "_Debug" -# ADD RSC /l 0x40d /d "_Debug" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Zend___Win32_Release_inline" -# PROP BASE Intermediate_Dir "Zend___Win32_Release_inline" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Release_inline" -# PROP Intermediate_Dir "Release_inline" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /FR /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40d /d "NDebug" -# ADD RSC /l 0x40d /d "NDebug" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "Zend - Win32 Release" -# Name "Zend - Win32 Debug" -# Name "Zend - Win32 Release_inline" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\zend.c -# End Source File -# Begin Source File - -SOURCE=.\zend_alloc.c -# End Source File -# Begin Source File - -SOURCE=.\zend_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_builtin_functions.c -# End Source File -# Begin Source File - -SOURCE=.\zend_compile.c -# End Source File -# Begin Source File - -SOURCE=.\zend_constants.c -# End Source File -# Begin Source File - -SOURCE=.\zend_default_classes.c -# End Source File -# Begin Source File - -SOURCE=.\zend_dynamic_array.c -# End Source File -# Begin Source File - -SOURCE=.\zend_execute.c -# End Source File -# Begin Source File - -SOURCE=.\zend_execute_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_extensions.c -# End Source File -# Begin Source File - -SOURCE=.\zend_hash.c -# End Source File -# Begin Source File - -SOURCE=.\zend_highlight.c -# End Source File -# Begin Source File - -SOURCE=.\zend_indent.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ini.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_parser.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_scanner.c -# End Source File -# Begin Source File - -SOURCE=".\zend_language_parser.c" -# End Source File -# Begin Source File - -SOURCE=".\zend_language_scanner.c" -# End Source File -# Begin Source File - -SOURCE=.\zend_list.c -# End Source File -# Begin Source File - -SOURCE=.\zend_llist.c -# End Source File -# Begin Source File - -SOURCE=.\zend_mm.c -# End Source File -# Begin Source File - -SOURCE=.\zend_object_handlers.c -# End Source File -# Begin Source File - -SOURCE=.\zend_objects.c -# End Source File -# Begin Source File - -SOURCE=.\zend_objects_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_opcode.c -# End Source File -# Begin Source File - -SOURCE=.\zend_operators.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ptr_stack.c -# End Source File -# Begin Source File - -SOURCE=.\zend_qsort.c -# End Source File -# Begin Source File - -SOURCE=.\zend_sprintf.c -# End Source File -# Begin Source File - -SOURCE=.\zend_stack.c -# End Source File -# Begin Source File - -SOURCE=.\zend_stream.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ts_hash.c -# End Source File -# Begin Source File - -SOURCE=.\zend_variables.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\FlexLexer.h -# End Source File -# Begin Source File - -SOURCE=.\zend.h -# End Source File -# Begin Source File - -SOURCE=.\zend_alloc.h -# End Source File -# Begin Source File - -SOURCE=.\zend_API.h -# End Source File -# Begin Source File - -SOURCE=.\zend_builtin_functions.h -# End Source File -# Begin Source File - -SOURCE=.\zend_compile.h -# End Source File -# Begin Source File - -SOURCE=.\zend_config.w32.h -# End Source File -# Begin Source File - -SOURCE=.\zend_constants.h -# End Source File -# Begin Source File - -SOURCE=.\zend_default_classes.h -# End Source File -# Begin Source File - -SOURCE=.\zend_dynamic_array.h -# End Source File -# Begin Source File - -SOURCE=.\zend_errors.h -# End Source File -# Begin Source File - -SOURCE=.\zend_execute.h -# End Source File -# Begin Source File - -SOURCE=.\zend_execute_locks.h -# End Source File -# Begin Source File - -SOURCE=.\zend_extensions.h -# End Source File -# Begin Source File - -SOURCE=.\zend_fast_cache.h -# End Source File -# Begin Source File - -SOURCE=.\zend_globals.h -# End Source File -# Begin Source File - -SOURCE=.\zend_globals_macros.h -# End Source File -# Begin Source File - -SOURCE=.\zend_hash.h -# End Source File -# Begin Source File - -SOURCE=.\zend_highlight.h -# End Source File -# Begin Source File - -SOURCE=.\zend_indent.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ini.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_parser.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_scanner.h -# End Source File -# Begin Source File - -SOURCE=.\zend_istdiostream.h -# End Source File -# Begin Source File - -SOURCE=".\zend_language_parser.h" -# End Source File -# Begin Source File - -SOURCE=".\zend_language_scanner.h" -# End Source File -# Begin Source File - -SOURCE=.\zend_list.h -# End Source File -# Begin Source File - -SOURCE=.\zend_llist.h -# End Source File -# Begin Source File - -SOURCE=.\zend_mm.h -# End Source File -# Begin Source File - -SOURCE=.\zend_modules.h -# End Source File -# Begin Source File - -SOURCE=.\zend_object_handlers.h -# End Source File -# Begin Source File - -SOURCE=.\zend_objects.h -# End Source File -# Begin Source File - -SOURCE=.\zend_objects_API.h -# End Source File -# Begin Source File - -SOURCE=.\zend_operators.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ptr_stack.h -# End Source File -# Begin Source File - -SOURCE=.\zend_qsort.h -# End Source File -# Begin Source File - -SOURCE=.\zend_stack.h -# End Source File -# Begin Source File - -SOURCE=.\zend_stream.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ts_hash.h -# End Source File -# Begin Source File - -SOURCE=.\zend_variables.h -# End Source File -# End Group -# Begin Group "Parsers" - -# PROP Default_Filter "y" -# Begin Source File - -SOURCE=.\zend_ini_parser.y - -!IF "$(CFG)" == "Zend - Win32 Release" - -!ELSEIF "$(CFG)" == "Zend - Win32 Debug" - -# Begin Custom Build -InputDir=. -InputPath=.\zend_ini_parser.y - -BuildCmds= \ - bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y - -"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=".\zend_language_parser.y" - -!IF "$(CFG)" == "Zend - Win32 Release" - -# Begin Custom Build -InputDir=. -InputPath=".\zend_language_parser.y" - -BuildCmds= \ - bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y - -"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "Zend - Win32 Debug" - -# Begin Custom Build -InputDir=. -InputPath=".\zend_language_parser.y" - -BuildCmds= \ - bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y - -"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline" - -# Begin Custom Build -InputDir=. -InputPath=".\zend_language_parser.y" - -BuildCmds= \ - bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y - -"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Scanners" - -# PROP Default_Filter "l" -# Begin Source File - -SOURCE=.\flex.skl -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_scanner.l - -!IF "$(CFG)" == "Zend - Win32 Release" - -!ELSEIF "$(CFG)" == "Zend - Win32 Debug" - -# Begin Custom Build -InputPath=.\zend_ini_scanner.l - -"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=".\zend_language_scanner.l" - -!IF "$(CFG)" == "Zend - Win32 Release" - -# Begin Custom Build -InputPath=".\zend_language_scanner.l" - -"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "Zend - Win32 Debug" - -# Begin Custom Build -InputPath=".\zend_language_scanner.l" - -"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline" - -# Begin Custom Build -InputPath=".\zend_language_scanner.l" - -"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Text Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ZEND_BUGS -# End Source File -# Begin Source File - -SOURCE=.\ZEND_CHANGES -# End Source File -# Begin Source File - -SOURCE=.\ZEND_TODO -# End Source File -# End Group -# Begin Group "Resources" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\zend.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 deleted file mode 100644 index dc083338ee..0000000000 --- a/Zend/Zend.m4 +++ /dev/null @@ -1,236 +0,0 @@ -dnl -dnl $Id$ -dnl -dnl This file contains Zend specific autoconf functions. -dnl - -AC_DEFUN(LIBZEND_BISON_CHECK,[ - -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/\./ /'` - 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 - AC_MSG_RESULT(${1}.${2} (ok)) -fi - -]) - -AC_DEFUN(LIBZEND_BASIC_CHECKS,[ - -AC_REQUIRE([AC_PROG_YACC]) -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_PROG_CC_C_O]) -AC_REQUIRE([AC_PROG_LEX]) -AC_REQUIRE([AC_HEADER_STDC]) - -LIBZEND_BISON_CHECK - -dnl Ugly hack to get around a problem with gcc on AIX. -if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \ - "`uname -sv`" = "AIX 4"; then - CFLAGS=`echo $CFLAGS | sed -e 's/-g//'` -fi - -dnl Hack to work around a Mac OS X cpp problem -dnl Known versions needing this workaround are 5.3 and 5.4 -if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then - CPPFLAGS="$CPPFLAGS -traditional-cpp" -fi - -AC_CHECK_HEADERS( -limits.h \ -malloc.h \ -string.h \ -unistd.h \ -stdarg.h \ -sys/types.h \ -sys/time.h \ -signal.h \ -unix.h \ -stdlib.h \ -dlfcn.h) - -AC_TYPE_SIZE_T -AC_TYPE_SIGNAL - -AC_DEFUN(LIBZEND_LIBDL_CHECKS,[ -AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"]) -AC_CHECK_FUNC(dlopen,[AC_DEFINE(HAVE_LIBDL, 1,[ ])]) -]) - -AC_DEFUN(LIBZEND_DLSYM_CHECK,[ -dnl -dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name. -dnl -AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names]) -_LT_AC_TRY_DLOPEN_SELF([ - AC_MSG_RESULT(no) -], [ - AC_MSG_RESULT(yes) - AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ]) -], [ - AC_MSG_RESULT(no) -], []) -]) - -dnl This is required for QNX and may be some BSD derived systems -AC_CHECK_TYPE( uint, unsigned int ) -AC_CHECK_TYPE( ulong, unsigned long ) - -dnl Checks for library functions. -AC_FUNC_VPRINTF -AC_FUNC_MEMCMP -AC_FUNC_ALLOCA -AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass) -AC_ZEND_BROKEN_SPRINTF - -AC_CHECK_FUNCS(finite isfinite isinf isnan) - -ZEND_FP_EXCEPT - -]) - -AC_DEFUN(LIBZEND_ENABLE_DEBUG,[ - -AC_ARG_ENABLE(debug, -[ --enable-debug Compile with debugging symbols],[ - ZEND_DEBUG=$enableval -],[ - ZEND_DEBUG=no -]) - -]) - -AC_DEFUN(LIBZEND_OTHER_CHECKS,[ - -AC_ARG_ENABLE(maintainer-zts, -[ --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.],[ - ZEND_INLINE_OPTIMIZATION=$enableval -],[ - ZEND_INLINE_OPTIMIZATION=yes -]) - -AC_ARG_ENABLE(memory-limit, -[ --enable-memory-limit Compile with memory limit support. ], [ - ZEND_MEMORY_LIMIT=$enableval -],[ - ZEND_MEMORY_LIMIT=no -]) - -AC_MSG_CHECKING(whether to enable thread-safety) -AC_MSG_RESULT($ZEND_MAINTAINER_ZTS) - -AC_MSG_CHECKING(whether to enable inline optimization for GCC) -AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION) - -AC_MSG_CHECKING(whether to enable a memory limit) -AC_MSG_RESULT($ZEND_MEMORY_LIMIT) - -AC_MSG_CHECKING(whether to enable Zend debugging) -AC_MSG_RESULT($ZEND_DEBUG) - -if test "$ZEND_DEBUG" = "yes"; then - AC_DEFINE(ZEND_DEBUG,1,[ ]) - echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g" - if test "$CFLAGS" = "-g -O2"; then - CFLAGS=-g - fi - test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall" - test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \ - DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations" -else - AC_DEFINE(ZEND_DEBUG,0,[ ]) -fi - -test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS" - -if test "$ZEND_MAINTAINER_ZTS" = "yes"; then - AC_DEFINE(ZTS,1,[ ]) - CFLAGS="$CFLAGS -DZTS" - LIBZEND_CPLUSPLUS_CHECKS -fi - -if test "$ZEND_MEMORY_LIMIT" = "yes"; then - AC_DEFINE(MEMORY_LIMIT, 1, [Memory limit]) -else - AC_DEFINE(MEMORY_LIMIT, 0, [Memory limit]) -fi - - -changequote({,}) -if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then - INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//` -else - INLINE_CFLAGS="$CFLAGS" -fi -changequote([,]) - -AC_C_INLINE - -AC_SUBST(INLINE_CFLAGS) - - -dnl test and set the alignment define for ZEND_MM -dnl this also does the logarithmic test for ZEND_MM. -AC_MSG_CHECKING(for MM alignment and log values) - -AC_TRY_RUN([ -#include - -typedef union _mm_align_test { - void *ptr; - double dbl; - long lng; -} mm_align_test; - -#if (defined (__GNUC__) && __GNUC__ >= 2) -#define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test)) -#else -#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test)) -#endif - -int main() -{ - int i = ZEND_MM_ALIGNMENT; - int zeros = 0; - FILE *fp; - - while (i & ~0x1) { - zeros++; - i = i >> 1; - } - - fp = fopen("conftest.zend", "w"); - fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros); - fclose(fp); - - exit(0); -} -], [ - LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1` - LIBZEND_MM_ALIGN_LOG2=`cat conftest.zend | cut -d ' ' -f 2` - AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT, $LIBZEND_MM_ALIGN, [ ]) - AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT_LOG2, $LIBZEND_MM_ALIGN_LOG2, [ ]) -]) - -AC_MSG_RESULT(done) - -]) - - -AC_DEFUN(LIBZEND_CPLUSPLUS_CHECKS,[ - -]) - diff --git a/Zend/ZendCore.dep b/Zend/ZendCore.dep deleted file mode 100644 index 39a5c0fb0b..0000000000 --- a/Zend/ZendCore.dep +++ /dev/null @@ -1,258 +0,0 @@ -# Microsoft Developer Studio Generated Dependency File, included by ZendCore.mak - -.\zend_alloc.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - - -.\alloca.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_config.w32.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_compile.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_modules.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - - -.\zend_constants.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_constants.h"\ - ".\zend_operators.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_execute.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_constants.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_modules.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - - -.\zend_highlight.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_highlight.h"\ - ".\zend_llist.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_language_parser.tab.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - - -.\zend_llist.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_llist.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_opcode.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_modules.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - - -.\zend_operators.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - - -.\zend_ptr_stack.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_ptr_stack.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_stack.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_stack.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_variables.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_constants.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_modules.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - ".\zend_list.h"\ - - -.\zend.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_operators.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_API.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_constants.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_modules.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - ".\zend_list.h"\ - - -.\zend_hash.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_config.w32.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_ini.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - - -!IF "$(CFG)" == "ZendCore - Win32 Release" - -!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug" - -!ENDIF - -!IF "$(CFG)" == "ZendCore - Win32 Release" - -!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug" - -!ENDIF - -!IF "$(CFG)" == "ZendCore - Win32 Release" - -!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug" - -!ENDIF - -!IF "$(CFG)" == "ZendCore - Win32 Release" - -!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug" - -!ENDIF - diff --git a/Zend/ZendTS.dsp b/Zend/ZendTS.dsp deleted file mode 100644 index 8506facbbd..0000000000 --- a/Zend/ZendTS.dsp +++ /dev/null @@ -1,707 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ZendTS" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -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 NMAKE /f "ZendTS.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ZendTS.mak" CFG="ZendTS - Win32 Release_TSDbg" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!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 - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ZendTS - Win32 Release_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Release_TS" -# PROP BASE Intermediate_Dir "Release_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Release_TS" -# PROP Intermediate_Dir "Release_TS" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug_TS" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40d /d "NDebug_TS" -# ADD RSC /l 0x40d /d "NDebug_TS" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Debug_TS" -# PROP BASE Intermediate_Dir "Debug_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Debug_TS" -# PROP Intermediate_Dir "Debug_TS" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x40d /d "_Debug_TS" -# ADD RSC /l 0x40d /d "_Debug_TS" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "ZendTS___Win32_Release_TS_inline" -# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TS_inline" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Release_TS_inline" -# PROP Intermediate_Dir "Release_TS_inline" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40d /d "NDebug_TS" -# ADD RSC /l 0x40d /d "NDebug_TS" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "ZendTS___Win32_Release_TSDbg" -# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TSDbg" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Release_TSDbg" -# PROP Intermediate_Dir "Release_TSDbg" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40d /d "NDebug_TS" -# ADD RSC /l 0x40d /d "NDebug_TS" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "ZendTS - Win32 Release_TS" -# Name "ZendTS - Win32 Debug_TS" -# Name "ZendTS - Win32 Release_TS_inline" -# Name "ZendTS - Win32 Release_TSDbg" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\zend.c -# End Source File -# Begin Source File - -SOURCE=.\zend_alloc.c -# End Source File -# Begin Source File - -SOURCE=.\zend_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_builtin_functions.c -# End Source File -# Begin Source File - -SOURCE=.\zend_compile.c -# End Source File -# Begin Source File - -SOURCE=.\zend_constants.c -# End Source File -# Begin Source File - -SOURCE=.\zend_default_classes.c -# End Source File -# Begin Source File - -SOURCE=.\zend_dynamic_array.c -# End Source File -# Begin Source File - -SOURCE=.\zend_execute.c -# End Source File -# Begin Source File - -SOURCE=.\zend_execute_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_extensions.c -# End Source File -# Begin Source File - -SOURCE=.\zend_hash.c -# End Source File -# Begin Source File - -SOURCE=.\zend_highlight.c -# End Source File -# Begin Source File - -SOURCE=.\zend_indent.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ini.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_parser.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_scanner.c -# End Source File -# Begin Source File - -SOURCE=".\zend_language_parser.c" -# End Source File -# Begin Source File - -SOURCE=".\zend_language_scanner.c" -# End Source File -# Begin Source File - -SOURCE=.\zend_list.c -# End Source File -# Begin Source File - -SOURCE=.\zend_llist.c -# End Source File -# Begin Source File - -SOURCE=.\zend_mm.c -# End Source File -# Begin Source File - -SOURCE=.\zend_object_handlers.c -# End Source File -# Begin Source File - -SOURCE=.\zend_objects.c -# End Source File -# Begin Source File - -SOURCE=.\zend_objects_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_opcode.c -# End Source File -# Begin Source File - -SOURCE=.\zend_operators.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ptr_stack.c -# End Source File -# Begin Source File - -SOURCE=.\zend_qsort.c -# End Source File -# Begin Source File - -SOURCE=.\zend_sprintf.c -# End Source File -# Begin Source File - -SOURCE=.\zend_stack.c -# End Source File -# Begin Source File - -SOURCE=.\zend_stream.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ts_hash.c -# End Source File -# Begin Source File - -SOURCE=.\zend_variables.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\FlexLexer.h -# End Source File -# Begin Source File - -SOURCE=.\zend.h -# End Source File -# Begin Source File - -SOURCE=.\zend_alloc.h -# End Source File -# Begin Source File - -SOURCE=.\zend_API.h -# End Source File -# Begin Source File - -SOURCE=.\zend_builtin_functions.h -# End Source File -# Begin Source File - -SOURCE=.\zend_compile.h -# End Source File -# Begin Source File - -SOURCE=.\zend_config.w32.h -# End Source File -# Begin Source File - -SOURCE=.\zend_constants.h -# End Source File -# Begin Source File - -SOURCE=.\zend_default_classes.h -# End Source File -# Begin Source File - -SOURCE=.\zend_dynamic_array.h -# End Source File -# Begin Source File - -SOURCE=.\zend_errors.h -# End Source File -# Begin Source File - -SOURCE=.\zend_execute.h -# End Source File -# Begin Source File - -SOURCE=.\zend_execute_locks.h -# End Source File -# Begin Source File - -SOURCE=.\zend_extensions.h -# End Source File -# Begin Source File - -SOURCE=.\zend_fast_cache.h -# End Source File -# Begin Source File - -SOURCE=.\zend_globals.h -# End Source File -# Begin Source File - -SOURCE=.\zend_globals_macros.h -# End Source File -# Begin Source File - -SOURCE=.\zend_hash.h -# End Source File -# Begin Source File - -SOURCE=.\zend_highlight.h -# End Source File -# Begin Source File - -SOURCE=.\zend_indent.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ini.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_parser.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_scanner.h -# End Source File -# Begin Source File - -SOURCE=.\zend_istdiostream.h -# End Source File -# Begin Source File - -SOURCE=".\zend_language_parser.h" -# End Source File -# Begin Source File - -SOURCE=".\zend_language_scanner.h" -# End Source File -# Begin Source File - -SOURCE=.\zend_list.h -# End Source File -# Begin Source File - -SOURCE=.\zend_llist.h -# End Source File -# Begin Source File - -SOURCE=.\zend_mm.h -# End Source File -# Begin Source File - -SOURCE=.\zend_modules.h -# End Source File -# Begin Source File - -SOURCE=.\zend_object_handlers.h -# End Source File -# Begin Source File - -SOURCE=.\zend_objects.h -# End Source File -# Begin Source File - -SOURCE=.\zend_objects_API.h -# End Source File -# Begin Source File - -SOURCE=.\zend_operators.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ptr_stack.h -# End Source File -# Begin Source File - -SOURCE=.\zend_qsort.h -# End Source File -# Begin Source File - -SOURCE=.\zend_stack.h -# End Source File -# Begin Source File - -SOURCE=.\zend_stream.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ts_hash.h -# End Source File -# Begin Source File - -SOURCE=.\zend_variables.h -# End Source File -# End Group -# Begin Group "Parsers" - -# PROP Default_Filter "y" -# Begin Source File - -SOURCE=.\zend_ini_parser.y - -!IF "$(CFG)" == "ZendTS - Win32 Release_TS" - -# Begin Custom Build -InputDir=. -InputPath=.\zend_ini_parser.y - -BuildCmds= \ - bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y - -"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS" - -# Begin Custom Build -InputDir=. -InputPath=.\zend_ini_parser.y - -BuildCmds= \ - bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y - -"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline" - -# Begin Custom Build -InputDir=. -InputPath=.\zend_ini_parser.y - -BuildCmds= \ - bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y - -"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg" - -# Begin Custom Build -InputDir=. -InputPath=.\zend_ini_parser.y - -BuildCmds= \ - bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y - -"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=".\zend_language_parser.y" - -!IF "$(CFG)" == "ZendTS - Win32 Release_TS" - -# Begin Custom Build -InputDir=. -InputPath=".\zend_language_parser.y" - -BuildCmds= \ - bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y - -"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS" - -# Begin Custom Build -InputDir=. -InputPath=".\zend_language_parser.y" - -BuildCmds= \ - bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y - -"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline" - -# Begin Custom Build -InputDir=. -InputPath=".\zend_language_parser.y" - -BuildCmds= \ - bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y - -"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg" - -# Begin Custom Build -InputDir=. -InputPath=".\zend_language_parser.y" - -BuildCmds= \ - bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y - -"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Scanners" - -# PROP Default_Filter "l" -# Begin Source File - -SOURCE=.\flex.skl -# End Source File -# Begin Source File - -SOURCE=.\zend_ini_scanner.l - -!IF "$(CFG)" == "ZendTS - Win32 Release_TS" - -# Begin Custom Build -InputPath=.\zend_ini_scanner.l - -"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS" - -# Begin Custom Build -InputPath=.\zend_ini_scanner.l - -"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline" - -# Begin Custom Build -InputPath=.\zend_ini_scanner.l - -"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg" - -# Begin Custom Build -InputPath=.\zend_ini_scanner.l - -"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=".\zend_language_scanner.l" - -!IF "$(CFG)" == "ZendTS - Win32 Release_TS" - -# Begin Custom Build -InputPath=".\zend_language_scanner.l" - -"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS" - -# Begin Custom Build -InputPath=".\zend_language_scanner.l" - -"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline" - -# Begin Custom Build -InputPath=".\zend_language_scanner.l" - -"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg" - -# Begin Custom Build -InputPath=".\zend_language_scanner.l" - -"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Text Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\LICENSE -# End Source File -# Begin Source File - -SOURCE=.\ZEND_BUGS -# End Source File -# Begin Source File - -SOURCE=.\ZEND_CHANGES -# End Source File -# End Group -# Begin Group "Resources" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\zend.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/Zend/acconfig.h b/Zend/acconfig.h deleted file mode 100644 index 582d199f7a..0000000000 --- a/Zend/acconfig.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#define ZEND_API -#define ZEND_DLEXPORT -#define ZEND_DLIMPORT - -#ifndef NETWARE -@TOP@ -#endif - -#undef uint -#undef ulong - -/* Define if you want to enable memory limit support */ -#define MEMORY_LIMIT 0 - -#ifndef NETWARE -@BOTTOM@ -#endif - -#ifdef HAVE_STDLIB_H -# include -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -#ifdef HAVE_IEEEFP_H -# include -#endif - -#ifdef HAVE_STRING_H -# include -#else -# include -#endif - -#if ZEND_BROKEN_SPRINTF -int zend_sprintf(char *buffer, const char *format, ...); -#else -# define zend_sprintf sprintf -#endif - -#include - -#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 -#define zend_isnan(a) 0 -#endif -#endif - -#ifdef HAVE_ISINF -#define zend_isinf(a) isinf(a) -#elif defined(INFINITY) -/* Might not work, but is required by ISO C99 */ -#define zend_isinf(a) (((a)==INFINITY)?1:0) -#elif defined(HAVE_FPCLASS) -#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF)) -#else -#define zend_isinf(a) 0 -#endif - -#ifdef HAVE_FINITE -#define zend_finite(a) finite(a) -#elif defined(HAVE_ISFINITE) || defined(isfinite) -#define zend_finite(a) isfinite(a) -#elif defined(fpclassify) -#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0) -#else -#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1) -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 deleted file mode 100644 index 395f7220db..0000000000 --- a/Zend/acinclude.m4 +++ /dev/null @@ -1,47 +0,0 @@ -dnl $Id$ -dnl -dnl This file contains local autoconf functions. - -AC_DEFUN(ZEND_FP_EXCEPT,[ - AC_CACHE_CHECK(whether fp_except is defined, ac_cv_type_fp_except,[ - AC_TRY_COMPILE([ -#include -],[ -fp_except x = (fp_except) 0; -],[ - ac_cv_type_fp_except=yes -],[ - ac_cv_type_fp_except=no -],[ - ac_cv_type_fp_except=no -])]) - if test "$ac_cv_type_fp_except" = "yes"; then - AC_DEFINE(HAVE_FP_EXCEPT, 1, [whether floatingpoint.h defines fp_except]) - fi -]) - -dnl -dnl Check for broken sprintf() -dnl -AC_DEFUN(AC_ZEND_BROKEN_SPRINTF,[ - AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[ - AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[ - ac_cv_broken_sprintf=no - ],[ - ac_cv_broken_sprintf=yes - ],[ - ac_cv_broken_sprintf=no - ]) - ]) - if test "$ac_cv_broken_sprintf" = "yes"; then - ac_result=1 - else - ac_result=0 - fi - AC_DEFINE_UNQUOTED(ZEND_BROKEN_SPRINTF, $ac_result, [Whether sprintf is broken]) -]) - -AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[ - LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' -]) - diff --git a/Zend/build.mk b/Zend/build.mk deleted file mode 100644 index 6105ff12c4..0000000000 --- a/Zend/build.mk +++ /dev/null @@ -1,43 +0,0 @@ -# Makefile to generate build tools -# -# Standard usage: -# make -f build.mk -# -# Written by Sascha Schumann -# -# $Id$ - - -LT_TARGETS = ltmain.sh ltconfig - -config_h_in = zend_config.h.in - -makefile_am_files = Makefile.am -makefile_in_files = $(makefile_am_files:.am=.in) -makefile_files = $(makefile_am_files:e.am=e) - -targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in) - -all: $(targets) - -clean: - rm -f $(targets) - -$(LT_TARGETS): - rm -f $(LT_TARGETS) - libtoolize --automake $(AMFLAGS) -f - -$(makefile_in_files): $(makefile_am_files) - automake -a -i $(AMFLAGS) $(makefile_files) - -aclocal.m4: configure.in acinclude.m4 - aclocal - -$(config_h_in): configure.in acconfig.h -# explicitly remove target since autoheader does not seem to work -# correctly otherwise (timestamps are not updated) - @rm -f $@ - autoheader - -configure: aclocal.m4 configure.in - autoconf diff --git a/Zend/buildconf b/Zend/buildconf deleted file mode 100755 index fe8dee6f76..0000000000 --- a/Zend/buildconf +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -case "$1" in ---copy) - automake_flags=--copy - shift -;; -esac - -libtoolize --force --automake $automake_flags - -mv aclocal.m4 aclocal.m4.old 2>/dev/null -aclocal -if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then - echo "buildconf: keeping ${1}aclocal.m4" - mv aclocal.m4.old aclocal.m4 -else - echo "buildconf: created or modified ${1}aclocal.m4" -fi - -autoheader - -automake --add-missing --include-deps $automake_flags - -mv configure configure.old 2>/dev/null -autoconf -if cmp configure.old configure > /dev/null 2>&1; then - echo "buildconf: keeping ${1}configure" - mv configure.old configure -else - echo "buildconf: created or modified ${1}configure" -fi - diff --git a/Zend/configure.in b/Zend/configure.in deleted file mode 100644 index fd13fd9800..0000000000 --- a/Zend/configure.in +++ /dev/null @@ -1,47 +0,0 @@ -dnl $Id$ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(zend.c) -AM_INIT_AUTOMAKE(zend, 0.80A, nodefine) -AM_CONFIG_HEADER(zend_config.h) -AM_SANITY_CHECK -AM_MAINTAINER_MODE -AC_PROG_CC -AM_PROG_LEX -AM_PROG_CC_STDC -ZEND_VERSION=$VERSION - -dnl We want this one before the checks, so the checks can modify CFLAGS. -test -z "$CFLAGS" && auto_cflags=1 - -sinclude(Zend.m4) - -LIBZEND_BASIC_CHECKS -LIBZEND_LIBDL_CHECKS -LIBZEND_DLSYM_CHECK - -AM_PROG_LIBTOOL -if test "$enable_debug" != "yes"; then - AM_SET_LIBTOOL_VARIABLE([--silent]) -fi - -dnl -dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary -dnl and source packages. This should be harmless on other OSs. -dnl -if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then - CFLAGS="$CFLAGS -I/usr/pkg/include" - LDFLAGS="$LDFLAGS -L/usr/pkg/lib" -fi - -LIBZEND_ENABLE_DEBUG -LIBZEND_OTHER_CHECKS - -ZEND_EXTRA_LIBS="$LIBS" -LIBS="" -AC_SUBST(ZEND_EXTRA_LIBS) -AC_OUTPUT(Makefile) - -# Local Variables: -# tab-width: 4 -# End: diff --git a/Zend/flex.skl b/Zend/flex.skl deleted file mode 100644 index 1fac72db1f..0000000000 --- a/Zend/flex.skl +++ /dev/null @@ -1,1643 +0,0 @@ -/* A Lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header$ - * vim:ft=lex: - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -%- -#include -%* - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -%+ -class istream; -%* -#if HAVE_UNISTD_H -#include -#endif - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -#undef YY_USE_PROTOS -#define YY_USE_PROTOS - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -%- -%* - - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr TSRMLS_CC ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { -%- - struct _zend_file_handle *yy_input_file; -%+ - istream* yy_input_file; -%* - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -%- Standard (non-C++) definition -#define yy_current_buffer SCNG(current_buffer) -#define yy_hold_char SCNG(_yy_hold_char) -%* - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -%- Standard (non-C++) definition -/* yy_hold_char holds the character lost when yytext is formed. */ - -#if 0 -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -#endif - -/* Points to current character in buffer. */ -#define yy_c_buf_p SCNG(c_buf_p) -#define yy_init SCNG(init) -#define yy_start SCNG(start) - -#ifdef ZTS -#define TSRMLS_D void ***tsrm_ls -#define TSRMLS_DC , TSRMLS_D -#define TSRMLS_C tsrm_ls -#define TSRMLS_CC , TSRMLS_C -#else -#define TSRMLS_D -#define TSRMLS_DC -#define TSRMLS_C -#define TSRMLS_CC -#endif - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -/* static int yy_did_buffer_switch_on_eof; */ -#define yy_did_buffer_switch_on_eof SCNG(_yy_did_buffer_switch_on_eof) - -void yyrestart YY_PROTO(( struct _zend_file_handle *input_file TSRMLS_DC )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer TSRMLS_DC )); -void yy_load_buffer_state YY_PROTO(( TSRMLS_D )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( struct _zend_file_handle *file, int size TSRMLS_DC )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b TSRMLS_DC )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer TSRMLS_CC ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size TSRMLS_DC )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str TSRMLS_DC )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len TSRMLS_DC )); - -%* - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here -#undef yyleng -#define yyleng SCNG(yy_leng) -#undef yytext -#define yytext SCNG(yy_text) -#undef yytext_ptr -#define yytext_ptr SCNG(yy_text) -#undef yyin -#define yyin SCNG(yy_in) -#undef yyout -#define yyout SCNG(yy_out) -#undef yy_last_accepting_state -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#undef yy_last_accepting_cpos -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#undef yy_more_flag -#define yy_more_flag SCNG(_yy_more_flag) -#undef yy_more_len -#define yy_more_len SCNG(_yy_more_len) - - -%- Standard (non-C++) definition -static yy_state_type yy_get_previous_state YY_PROTO(( TSRMLS_D )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state TSRMLS_DC )); -static int yy_get_next_buffer YY_PROTO(( TSRMLS_D )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); -%* - -#undef TSRMLS_D -#undef TSRMLS_DC -#undef TSRMLS_C -#undef TSRMLS_CC - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ -%% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ -%% code to copy yytext_ptr to yytext[] goes here, if %array - yy_c_buf_p = yy_cp; - -#undef yyleng -#undef yytext -#undef yytext_ptr -#undef yyin -#undef yyout -#undef yy_last_accepting_state -#undef yy_last_accepting_cpos -#undef yy_more_flag -#undef yy_more_len - - -%% data tables for the DFA and the user's section 1 definitions go here - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -%- -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr TSRMLS_DC )); -#endif -%* - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -%- Standard (non-C++) definition -#ifdef __cplusplus -static int 3 YY_PROTO(( TSRMLS_D )); -#else -static int input YY_PROTO(( TSRMLS_D )); -#endif -%* -#endif - -#if YY_STACK_USED -#define yy_start_stack_ptr SCNG(yy_start_stack_ptr) -#define yy_start_stack_depth SCNG(yy_start_stack_depth) -#define yy_start_stack SCNG(yy_start_stack) -/* -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -*/ -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state TSRMLS_DC )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( TSRMLS_D )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( TSRMLS_D )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -/* Zend file handle reading */ -#ifndef ECHO -#define ECHO /* There is no output */ -#endif - -#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" ); - - - -#ifndef ECHO -%- Standard (non-C++) definition -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) ) -%+ C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%* -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ -%+ C++ definition - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -%* -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%- -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -%+ -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%* -#endif - - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -%- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) -%+ C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%* -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -%% YY_RULE_SETUP definition goes here - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -%% user's declarations go here - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - -#if 0 - if ( ! SCNG(yy_in) ) -%- - SCNG(yy_in) = stdin; -%+ - SCNG(yy_in) = &cin; -%* - - if ( ! SCNG(yy_out) ) -%- - SCNG(yy_out) = stdout; -%+ - SCNG(yy_out) = &cout; -%* -#endif - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); - - yy_load_buffer_state(TSRMLS_C); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% yymore()-related code goes here - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -%% code to set up and find next match goes here - -yy_find_action: -%% code to find the action number goes here - - YY_DO_BEFORE_ACTION; - -%% code for yylineno update goes here - -do_action: /* This label is used only to access EOF actions. */ - -%% debug code goes here - - switch ( yy_act ) - { /* beginning of action switch */ -%% actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = SCNG(yy_in); - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state TSRMLS_CC ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -%% code to do back-up for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer(TSRMLS_C) ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)]; - - yy_current_state = yy_get_previous_state(TSRMLS_C); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - -%+ -yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) - { - SCNG(yy_in) = arg_yyin; - SCNG(yy_out) = arg_yyout; - yy_c_buf_p = 0; - yy_init = 1; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - yy_more_offset = yy_prev_more_offset = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = 0; - - yy_current_buffer = 0; - -#ifdef YY_USES_REJECT - yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; -#else - yy_state_buf = 0; -#endif - } - -yyFlexLexer::~yyFlexLexer() - { - delete yy_state_buf; - yy_delete_buffer( yy_current_buffer TSRMLS_CC ); - } - -void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) - { - if ( new_in ) - { - yy_delete_buffer( SCNG(yy_current_buffer TSRMLS_CC ) ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE TSRMLS_CC ) TSRMLS_CC ); - } - - if ( new_out ) - SCNG(yy_out) = new_out; - } - -int yyFlexLexer::LexerInput( char* buf, int max_size ) - { - if ( SCNG(yy_in)->eof() || SCNG(yy_in)->fail() ) - return 0; - - if (yy_current_buffer->yy_is_interactive) { - SCNG(yy_in)->get( buf[0] ); - - if ( SCNG(yy_in)->eof() ) - return 0; - - if ( SCNG(yy_in)->bad() ) - return -1; - - return 1; - } else { - (void) SCNG(yy_in)->read( buf, max_size ); - - if ( SCNG(yy_in)->bad() ) - return -1; - else - return SCNG(yy_in)->gcount(); - } - } - -void yyFlexLexer::LexerOutput( const char* buf, int size ) - { - (void) SCNG(yy_out)->write( buf, size ); - } -%* - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -%- -static int yy_get_next_buffer(TSRMLS_D) -%+ -int yyFlexLexer::yy_get_next_buffer(TSRMLS_D) -%* - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars) = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - SCNG(yy_n_chars), num_to_read ); - - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars); - } - - if ( SCNG(yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( SCNG(yy_in) TSRMLS_CC ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - SCNG(yy_n_chars) += number_to_move; - yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -%- -static yy_state_type yy_get_previous_state(TSRMLS_D) -%+ -yy_state_type yyFlexLexer::yy_get_previous_state(TSRMLS_D) -%* - { - register yy_state_type yy_current_state; - register char *yy_cp; - -%% code to get the start state into yy_current_state goes here - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { -%% code to find the next state goes here - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -%- -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state TSRMLS_CC ) -yy_state_type yy_current_state; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state TSRMLS_DC ) -%* - { - register int yy_is_jam; -%% code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; - } - - -%- -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp TSRMLS_DC ) -#else -static void yyunput( c, yy_bp TSRMLS_CC ) -int c; -register char *yy_bp; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yyunput( int c, register char* yy_bp TSRMLS_DC ) -%* - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = SCNG(yy_n_chars) + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - SCNG(yy_n_chars) = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% update yylineno here - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -%- -#endif /* ifndef YY_NO_UNPUT */ -%* - - -%- -#ifdef __cplusplus -static int yyinput(TSRMLS_D) -#else -static int input(TSRMLS_C) -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -int yyFlexLexer::yyinput(TSRMLS_D) -%* - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[SCNG(yy_n_chars)] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer(TSRMLS_C) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( SCNG(yy_in) TSRMLS_CC ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(TSRMLS_C); -#else - return input(TSRMLS_C); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - -%% update BOL and yylineno - - return c; - } - - -%- -#ifdef YY_USE_PROTOS -void yyrestart( struct _zend_file_handle *input_file TSRMLS_DC ) -#else -void yyrestart( input_file TSRMLS_CC ) -struct _zend_file_handle *input_file; -#endif -%+ -void yyFlexLexer::yyrestart( istream* input_file TSRMLS_DC ) -%* - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); - - yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC ); - yy_load_buffer_state(TSRMLS_C); - } - - -%- -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC) -#else -void yy_switch_to_buffer( new_buffer TSRMLS_CC) -YY_BUFFER_STATE new_buffer; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer TSRMLS_DC ) -%* - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = SCNG(yy_n_chars); - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(TSRMLS_C); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( TSRMLS_D ) -#else -void yy_load_buffer_state(TSRMLS_C) -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yy_load_buffer_state() -%* - { - SCNG(yy_n_chars) = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - SCNG(yy_in) = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( struct _zend_file_handle *file, int size TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size TSRMLS_CC ) -struct _zend_file_handle *file; -int size; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size TSRMLS_DC ) -%* - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file TSRMLS_CC ); - - return b; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -#else -void yy_delete_buffer( b TSRMLS_CC ) -YY_BUFFER_STATE b; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -%* - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -%- - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, struct _zend_file_handle *file TSRMLS_DC ) -#else -void yy_init_buffer( b, file TSRMLS_CC ) -YY_BUFFER_STATE b; -struct _zend_file_handle *file; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - -%+ -extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file TSRMLS_DC ) -%* - - { - yy_flush_buffer( b TSRMLS_CC ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -%- -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file->handle.stream.interactive; -#endif -#endif -%+ - b->yy_is_interactive = (file == (istream *) &cin) ? 1 : 0; -%* - } - - -%- -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -#else -void yy_flush_buffer( b TSRMLS_CC ) -YY_BUFFER_STATE b; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - -%+ -void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b TSRMLS_DC ) -%* - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(TSRMLS_C); - } -%* - - -#ifndef YY_NO_SCAN_BUFFER -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size TSRMLS_CC ) -char *base; -yy_size_t size; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b TSRMLS_CC ); - - return b; - } -%* -#endif - - -#ifndef YY_NO_SCAN_STRING -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str TSRMLS_CC ) -yyconst char *yy_str; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len TSRMLS_CC ); - } -%* -#endif - - -#ifndef YY_NO_SCAN_BYTES -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len TSRMLS_DC ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len TSRMLS_CC ) -yyconst char *bytes; -int len; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n TSRMLS_CC); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -%* -#endif - - -#ifndef YY_NO_PUSH_STATE -%- -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state TSRMLS_DC ) -#else -static void yy_push_state( new_state TSRMLS_CC ) -int new_state; -#ifdef ZTS -void ***tsrm_ls; -#endif -#endif -%+ -void yyFlexLexer::yy_push_state( int new_state TSRMLS_DC ) -%* - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -%- -static void yy_pop_state(TSRMLS_D) -%+ -void yyFlexLexer::yy_pop_state(TSRMLS_D) -%* - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -%- -static int yy_top_state(TSRMLS_D) -%+ -int yyFlexLexer::yy_top_state() -%* - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%- -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - -%+ - -void yyFlexLexer::LexerError( yyconst char msg[] ) - { - cerr << msg << '\n'; - exit( YY_EXIT_FAILURE ); - } -%* - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif diff --git a/Zend/tests/zend2.php b/Zend/tests/zend2.php deleted file mode 100644 index 100bdbec95..0000000000 --- a/Zend/tests/zend2.php +++ /dev/null @@ -1,339 +0,0 @@ -Example 1: A singleton (static members) -======================================= - -counter; - print "\n"; - } - } - - - class SingletonCounter { - static $m_instance = NULL; - - function Instance() - { - if (self::$m_instance == NULL) { - self::$m_instance = new Counter(); - } - return self::$m_instance; - } - } - - SingletonCounter::Instance()->increment_and_print(); - SingletonCounter::Instance()->increment_and_print(); - SingletonCounter::Instance()->increment_and_print(); - -?> - -Example 2: Factory method (derefencing objects returned from functions) -======================================================================= - -draw(); - ShapeFactoryMethod("Square")->draw(); - - -?> - -Example 3: Nested class -======================= - -host' as $user\n"; - } - } - - class Oracle { - var $host = "localhost"; - - function db_connect($user) { - print "Connecting to Oracle database '$this->host' as $user\n"; - } - - } - } - - $MySQL_obj = new Database::MySQL(); - $MySQL_obj->db_connect("John"); - - $Oracle_obj = new Database::Oracle(); - $Oracle_obj->db_connect("Mark"); - - unset($MySQL_obj); - unset($Oracle_obj); -?> - -Example 3: Nested class suitable for a PEAR like hierarchy -========================================================== - -host' as $user\n"; - } - } - - class DB::Oracle { - var $host = "localhost"; - - function db_connect($user) { - print "Connecting to Oracle database '$this->host' as $user\n"; - } - - } - - $MySQL_obj = new DB::MySQL(); - $MySQL_obj->db_connect("Susan"); - - $Oracle_obj = new DB::Oracle(); - $Oracle_obj->db_connect("Barbara"); - -?> - -Example 4: Class constants and class scope -========================================== - - - -Example 5: Regular object method using both local and global functions -====================================================================== - -get_hello_world(); - return strlen($str); - } - } - - $obj = new HelloWorld(); - print "length_of_hello_world() = " . $obj->length_of_hello_world(); - print "\n"; -?> - -Example 6: Multiple derefencing of objects returned from methods -================================================================ - -name = $_name; - } - - function display() - { - print $this->name; - print "\n"; - } - } - - class Person { - function Person($_name, $_address) - { - $this->name = new Name($_name); - } - - function getName() - { - return $this->name; - } - } - - $person = new Person("John", "New York"); - $person->getName()->display(); - -?> - -Example 7: Exception handling -============================= - -error = $_error; - } - - function getException() - { - return $this->error; - } - } - - function ThrowException() - { - throw new MyException("'This is an exception!'"); - } - - - try { - } catch (MyException $exception) { - print "There was an exception: " . $exception->getException(); - print "\n"; - } - - try { - ThrowException(); - } catch (MyException $exception) { - print "There was an exception: " . $exception->getException(); - print "\n"; - } - -?> - -Example 8: __clone() -=================== - -id = self::$id++; - } - - function __clone() - { - $this->name = $that->name; - $this->address = "New York"; - $this->id = self::$id++; - } - } - - - - $obj = new MyCloneable(); - - $obj->name = "Hello"; - $obj->address = "Tel-Aviv"; - - print $obj->id; - print "\n"; - - $obj = $obj->__clone(); - - print $obj->id; - print "\n"; - print $obj->name; - print "\n"; - print $obj->address; - print "\n"; -?> - -Example 9: Unified constructors -=============================== - - - -Example 10: Destructors -======================= - -name = "MyDestructableClass"; - } - - function __destruct() - { - print "Destroying " . $this->name . "\n"; - } -} - -$obj = new MyDestructableClass(); - -?> diff --git a/Zend/zend.c b/Zend/zend.c deleted file mode 100644 index 47416cd520..0000000000 --- a/Zend/zend.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_extensions.h" -#include "zend_modules.h" -#include "zend_constants.h" -#include "zend_list.h" -#include "zend_API.h" -#include "zend_default_classes.h" -#include "zend_builtin_functions.h" -#include "zend_ini.h" - -#ifdef ZTS -# define GLOBAL_FUNCTION_TABLE &global_namespace.function_table -# define GLOBAL_CLASS_TABLE &global_namespace.class_table -# define GLOBAL_CONSTANTS_TABLE &global_namespace.constants_table -# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table -#else -# define GLOBAL_FUNCTION_TABLE CG(function_table) -# define GLOBAL_CLASS_TABLE CG(class_table) -# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals) -#endif - -#if defined(ZEND_WIN32) && ZEND_DEBUG -BOOL WINAPI IsDebuggerPresent(VOID); -#endif - -/* true multithread-shared globals */ -ZEND_API zend_class_entry *zend_standard_class_def = NULL; -ZEND_API int (*zend_printf)(const char *format, ...); -ZEND_API zend_write_func_t zend_write; -ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path); -ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); -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); - -void (*zend_on_timeout)(int seconds TSRMLS_DC); - -static void (*zend_message_dispatcher_p)(long message, void *data); -static int (*zend_get_configuration_directive_p)(char *name, uint name_length, zval *contents); - - -static ZEND_INI_MH(OnUpdateErrorReporting) -{ - if (!new_value) { - EG(error_reporting) = E_ALL & ~E_NOTICE; - } else { - EG(error_reporting) = atoi(new_value); - } - return SUCCESS; -} - - -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) - ZEND_INI_ENTRY("zend2.implicit_clone", NULL, ZEND_INI_ALL, OnUpdateImplicitClone) -ZEND_INI_END() - - -#ifdef ZTS -ZEND_API int compiler_globals_id; -ZEND_API int executor_globals_id; -ZEND_API int alloc_globals_id; -zend_class_entry global_main_class; -zend_namespace global_namespace; -HashTable *global_auto_globals_table; -#endif - -ZEND_API zend_utility_values zend_uv; - -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-2003 Zend Technologies\n" - - -#define PRINT_ZVAL_INDENT 4 - -static void print_hash(HashTable *ht, int indent TSRMLS_DC) -{ - zval **tmp; - char *string_key; - HashPosition iterator; - ulong num_key; - uint str_len; - int i; - - for (i=0; i "); - zend_print_zval_r(*tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC); - ZEND_PUTS("\n"); - zend_hash_move_forward_ex(ht, &iterator); - } - indent -= PRINT_ZVAL_INDENT; - for (i=0; i 0) { - ZEND_PUTS(","); - } - ZEND_PUTS("["); - switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) { - case HASH_KEY_IS_STRING: - ZEND_PUTS(string_key); - break; - case HASH_KEY_IS_LONG: - zend_printf("%ld", num_key); - break; - } - ZEND_PUTS("] => "); - zend_print_flat_zval_r(*tmp TSRMLS_CC); - zend_hash_move_forward_ex(ht, &iterator); - } -} - -ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy) -{ - if (expr->type==IS_STRING) { - *use_copy = 0; - return; - } - switch (expr->type) { - case IS_NULL: - expr_copy->value.str.len = 0; - expr_copy->value.str.val = empty_string; - break; - case IS_BOOL: - if (expr->value.lval) { - expr_copy->value.str.len = 1; - expr_copy->value.str.val = estrndup("1", 1); - } else { - expr_copy->value.str.len = 0; - expr_copy->value.str.val = empty_string; - } - break; - case IS_RESOURCE: - expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG); - expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval); - break; - case IS_ARRAY: - expr_copy->value.str.len = sizeof("Array")-1; - expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len); - break; - case IS_OBJECT: - 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; - zval_copy_ctor(expr_copy); - zend_locale_sprintf_double(expr_copy ZEND_FILE_LINE_CC); - break; - default: - *expr_copy = *expr; - zval_copy_ctor(expr_copy); - convert_to_string(expr_copy); - break; - } - expr_copy->type = IS_STRING; - *use_copy = 1; -} - - -ZEND_API int zend_print_zval(zval *expr, int indent) -{ - return zend_print_zval_ex(zend_write, expr, indent); -} - - -ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) -{ - zval expr_copy; - int use_copy; - - zend_make_printable_zval(expr, &expr_copy, &use_copy); - if (use_copy) { - expr = &expr_copy; - } - if (expr->value.str.len==0) { /* optimize away empty strings */ - if (use_copy) { - zval_dtor(expr); - } - return 0; - } - write_func(expr->value.str.val, expr->value.str.len); - if (use_copy) { - zval_dtor(expr); - } - return expr->value.str.len; -} - -ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) -{ - switch (expr->type) { - case IS_ARRAY: - ZEND_PUTS("Array ("); - if (++expr->value.ht->nApplyCount>1) { - ZEND_PUTS(" *RECURSION*"); - expr->value.ht->nApplyCount--; - return; - } - print_flat_hash(expr->value.ht TSRMLS_CC); - ZEND_PUTS(")"); - expr->value.ht->nApplyCount--; - break; - case IS_OBJECT: - { - HashTable *properties = NULL; - char *class_name = NULL; - zend_uint clen; - - if (Z_OBJ_HANDLER_P(expr, get_class_name)) { - 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) { - efree(class_name); - } - if (Z_OBJ_HANDLER_P(expr, get_properties)) { - properties = Z_OBJPROP_P(expr); - } - if (properties) { - if (++properties->nApplyCount>1) { - ZEND_PUTS(" *RECURSION*"); - properties->nApplyCount--; - return; - } - print_flat_hash(properties TSRMLS_CC); - properties->nApplyCount--; - } - ZEND_PUTS(")"); - break; - } - default: - zend_print_variable(expr); - break; - } -} - -ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC) -{ - zend_print_zval_r_ex(zend_write, expr, indent TSRMLS_CC); -} - - -ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) -{ - switch (expr->type) { - case IS_ARRAY: - ZEND_PUTS("Array\n"); - if (++expr->value.ht->nApplyCount>1) { - ZEND_PUTS(" *RECURSION*"); - expr->value.ht->nApplyCount--; - return; - } - print_hash(expr->value.ht, indent TSRMLS_CC); - expr->value.ht->nApplyCount--; - break; - case IS_OBJECT: - { - HashTable *properties = NULL; - char *class_name = NULL; - zend_uint clen; - - if (Z_OBJ_HANDLER_P(expr, get_class_name)) { - 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) { - efree(class_name); - } - if (Z_OBJ_HANDLER_P(expr, get_properties)) { - properties = Z_OBJPROP_P(expr); - } - if (properties) { - if (++properties->nApplyCount>1) { - ZEND_PUTS(" *RECURSION*"); - properties->nApplyCount--; - return; - } - print_hash(properties, indent TSRMLS_CC); - properties->nApplyCount--; - } - break; - } - default: - zend_print_variable(expr); - break; - } -} - - -static FILE *zend_fopen_wrapper(const char *filename, char **opened_path) -{ - if (opened_path) { - *opened_path = estrdup(filename); - } - return fopen(filename, "rb"); -} - - -static void register_standard_class(TSRMLS_D) -{ - 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(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 */ - CG(asp_tags) = 0; - CG(short_tags) = 1; - CG(allow_call_time_pass_reference) = 1; - CG(extended_info) = 0; -} - - -#ifdef ZTS -static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC) -{ - zend_function tmp_func; - zend_class_entry tmp_class; - - compiler_globals->compiled_filename = NULL; - - compiler_globals->function_table = &compiler_globals->global_namespace.function_table; - zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); - zend_hash_copy(compiler_globals->function_table, GLOBAL_FUNCTION_TABLE, NULL, &tmp_func, sizeof(zend_function)); - - compiler_globals->class_table = &compiler_globals->global_namespace.class_table; - 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_set_default_compile_time_values(TSRMLS_C); - - CG(interactive) = 0; - - compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0); - zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */); -} - - -static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC) -{ - if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) { - zend_hash_destroy(compiler_globals->function_table); - } - if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) { - zend_hash_destroy(compiler_globals->class_table); - } - if (compiler_globals->auto_globals != global_auto_globals_table) { - zend_hash_destroy(compiler_globals->auto_globals); - free(compiler_globals->auto_globals); - } -} - - -static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC) -{ - zend_startup_constants(TSRMLS_C); - zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE); - zend_init_rsrc_plist(TSRMLS_C); - EG(lambda_count)=0; - EG(user_error_handler) = NULL; - EG(user_exception_handler) = NULL; - EG(in_execution) = 0; - EG(current_execute_data) = NULL; - EG(active_namespace) = NULL; -} - - -static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC) -{ - zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); - zend_ini_shutdown(TSRMLS_C); -} - - -static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC) -{ - zend_copy_ini_directives(TSRMLS_C); - zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC); -} - -#endif - - -static void alloc_globals_ctor(zend_alloc_globals *alloc_globals_p TSRMLS_DC) -{ - start_memory_manager(TSRMLS_C); -} - - -#ifdef ZTS -static void alloc_globals_dtor(zend_alloc_globals *alloc_globals_p TSRMLS_DC) -{ - shutdown_memory_manager(0, 1 TSRMLS_CC); -} -#endif - - -#ifdef __FreeBSD__ -/* FreeBSD floating point precision fix */ -#include -#endif - - -static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_DC) -{ - scanner_globals_p->c_buf_p = (char *) 0; - scanner_globals_p->init = 1; - scanner_globals_p->start = 0; - scanner_globals_p->current_buffer = NULL; - scanner_globals_p->yy_in = NULL; - scanner_globals_p->yy_out = NULL; - scanner_globals_p->_yy_more_flag = 0; - scanner_globals_p->_yy_more_len = 0; - scanner_globals_p->yy_start_stack_ptr = 0; - scanner_globals_p->yy_start_stack_depth = 0; - scanner_globals_p->yy_start_stack = 0; -} - -void zend_init_opcodes_handlers(); - -int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions) -{ -#ifdef ZTS - 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 - extern zend_scanner_globals ini_scanner_globals; - extern zend_scanner_globals language_scanner_globals; -#endif - - 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 - -#ifdef __FreeBSD__ - /* FreeBSD floating point precision fix */ - fpsetmask(0); -#endif - - zend_startup_extensions_mechanism(); - - /* Set up utility functions and values */ - zend_error_cb = utility_functions->error_function; - zend_printf = utility_functions->printf_function; - zend_write = (zend_write_func_t) utility_functions->write_function; - zend_fopen = utility_functions->fopen_function; - if (!zend_fopen) { - zend_fopen = zend_fopen_wrapper; - } - zend_stream_open_function = utility_functions->stream_open_function; - zend_message_dispatcher_p = utility_functions->message_handler; - zend_block_interruptions = utility_functions->block_interruptions; - zend_unblock_interruptions = utility_functions->unblock_interruptions; - 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_compile_file = compile_file; - zend_execute = execute; - zend_execute_internal = NULL; - - zend_init_opcodes_handlers(); - - /* set up version */ - zend_version_info = strdup(ZEND_CORE_VERSION_INFO); - zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1; - -#ifndef ZTS - GLOBAL_FUNCTION_TABLE = &compiler_globals.global_namespace.function_table; - GLOBAL_CLASS_TABLE = &compiler_globals.global_namespace.class_table; - compiler_globals.global_namespace.static_members = NULL; -#endif - GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); - zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0); - - zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0); - zend_init_rsrc_list_dtors(); - - - /* This zval can be used to initialize allocate zval's to an uninit'ed value */ - zval_used_for_init.is_ref = 0; - zval_used_for_init.refcount = 1; - zval_used_for_init.type = IS_NULL; - -#ifdef ZTS - zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0); - zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); - ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor); - ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor); - ts_allocate_id(&language_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL); - ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_scanner_globals), (ts_allocate_ctor) scanner_globals_ctor, NULL); - compiler_globals = ts_resource(compiler_globals_id); - executor_globals = ts_resource(executor_globals_id); - tsrm_ls = ts_resource_ex(0, NULL); - - 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; - - zend_hash_destroy(executor_globals->zend_constants); - *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE; -#else - zend_hash_init_ex(CG(auto_globals), 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); - scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC); - scanner_globals_ctor(&language_scanner_globals TSRMLS_CC); - zend_startup_constants(); - zend_set_default_compile_time_values(TSRMLS_C); - EG(user_error_handler) = NULL; - EG(user_exception_handler) = NULL; -#endif - register_standard_class(TSRMLS_C); - zend_register_standard_constants(TSRMLS_C); - zend_register_auto_global("GLOBALS", sizeof("GLOBALS")-1, NULL TSRMLS_CC); - -#ifndef ZTS - zend_init_rsrc_plist(TSRMLS_C); -#endif - - if (start_builtin_functions) { - zend_startup_builtin_functions(TSRMLS_C); - } - zend_register_default_classes(TSRMLS_C); - - zend_ini_startup(TSRMLS_C); - -#ifdef ZTS - tsrm_set_new_thread_end_handler(zend_new_thread_end_handler); -#endif - - return SUCCESS; -} - - -void zend_register_standard_ini_entries(TSRMLS_D) -{ - int module_number = 0; - - REGISTER_INI_ENTRIES(); -} - - -#ifdef ZTS -/* Unlink the global (r/o) copies of the class, function and constant tables, - * and use a fresh r/w copy for the startup thread - */ -void zend_post_startup(TSRMLS_D) -{ - zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id); - zend_executor_globals *executor_globals = ts_resource(executor_globals_id); - - *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table; - *GLOBAL_CLASS_TABLE = *compiler_globals->class_table; - *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants; - zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); - compiler_globals_ctor(compiler_globals, tsrm_ls); - executor_globals_ctor(executor_globals, tsrm_ls); -} -#endif - - -void zend_shutdown(TSRMLS_D) -{ -#ifdef ZEND_WIN32 - zend_shutdown_timeout_thread(); -#endif -#ifndef ZTS - 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); - - zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE); - free(GLOBAL_AUTO_GLOBALS_TABLE); - zend_shutdown_extensions(TSRMLS_C); - free(zend_version_info); - - zend_shutdown_constants(TSRMLS_C); -#ifdef ZTS - zend_hash_destroy(GLOBAL_CONSTANTS_TABLE); - unregister_standard_class(); -#endif -} - - -void zend_set_utility_values(zend_utility_values *utility_values) -{ - zend_uv = *utility_values; - zend_uv.import_use_extension_length = strlen(zend_uv.import_use_extension); -} - - -/* this should be compatible with the standard zenderror */ -void zenderror(char *error) -{ - zend_error(E_PARSE, error); -} - - -BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, uint lineno) -{ - TSRMLS_FETCH(); - - if (!EG(bailout_set)) { - zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno); - exit(-1); - } - CG(unclean_shutdown) = 1; - CG(in_compilation) = EG(in_execution) = 0; - EG(current_execute_data) = NULL; - longjmp(EG(bailout), FAILURE); -} -END_EXTERN_C() - - -void zend_append_version_info(zend_extension *extension) -{ - char *new_info; - uint new_info_length; - - new_info_length = sizeof(" with v, by \n") - + strlen(extension->name) - + strlen(extension->version) - + strlen(extension->copyright) - + strlen(extension->author); - - new_info = (char *) malloc(new_info_length+1); - - sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author); - - zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length+1); - strcat(zend_version_info, new_info); - zend_version_info_length += new_info_length; - free(new_info); -} - - -ZEND_API char *get_zend_version() -{ - return zend_version_info; -} - - -void zend_activate(TSRMLS_D) -{ - init_compiler(TSRMLS_C); - init_executor(TSRMLS_C); - startup_scanner(TSRMLS_C); -} - - -void zend_activate_modules(TSRMLS_D) -{ - zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup TSRMLS_CC); -} - -void zend_deactivate_modules(TSRMLS_D) -{ - EG(opline_ptr) = NULL; /* we're no longer executing anything */ - - zend_try { - zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC); - } zend_end_try(); -} - -void zend_deactivate(TSRMLS_D) -{ - /* we're no longer executing anything */ - EG(opline_ptr) = NULL; - EG(active_symbol_table) = NULL; - - /* restore namespace to global */ - zend_switch_namespace(EG(global_namespace_ptr) TSRMLS_CC); - CG(function_table) = EG(function_table); - CG(class_table) = EG(class_table); - - zend_try { - shutdown_scanner(TSRMLS_C); - } zend_end_try(); - - /* shutdown_executor() takes care of its own bailout handling */ - shutdown_executor(TSRMLS_C); - - zend_try { - shutdown_compiler(TSRMLS_C); - } zend_end_try(); - - zend_try { - zend_ini_deactivate(TSRMLS_C); - } zend_end_try(); -} - - -BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(long message, void *data) -{ - if (zend_message_dispatcher_p) { - zend_message_dispatcher_p(message, data); - } -} -END_EXTERN_C() - - -ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents) -{ - if (zend_get_configuration_directive_p) { - return zend_get_configuration_directive_p(name, name_length, contents); - } else { - return FAILURE; - } -} - - -#define ZEND_ERROR_BUFFER_SIZE 1024 - -ZEND_API void zend_error(int type, const char *format, ...) -{ - va_list args; - zval ***params; - zval *retval; - zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context; - char *error_filename; - uint error_lineno; - zval *orig_user_error_handler; - TSRMLS_FETCH(); - - /* Obtain relevant filename and lineno */ - switch (type) { - case E_CORE_ERROR: - case E_CORE_WARNING: - error_filename = NULL; - error_lineno = 0; - break; - case E_PARSE: - case E_COMPILE_ERROR: - case E_COMPILE_WARNING: - case E_ERROR: - case E_NOTICE: - case E_WARNING: - case E_USER_ERROR: - case E_USER_WARNING: - case E_USER_NOTICE: - if (zend_is_compiling(TSRMLS_C)) { - error_filename = zend_get_compiled_filename(TSRMLS_C); - error_lineno = zend_get_compiled_lineno(TSRMLS_C); - } else if (zend_is_executing(TSRMLS_C)) { - error_filename = zend_get_executed_filename(TSRMLS_C); - error_lineno = zend_get_executed_lineno(TSRMLS_C); - } else { - error_filename = NULL; - error_lineno = 0; - } - break; - default: - error_filename = NULL; - error_lineno = 0; - break; - } - if (!error_filename) { - error_filename = "Unknown"; - } - - - va_start(args, format); - - /* if we don't have a user defined error handler */ - if (!EG(user_error_handler)) { - zend_error_cb(type, error_filename, error_lineno, format, args); - } else switch (type) { - case E_ERROR: - case E_PARSE: - case E_CORE_ERROR: - case E_CORE_WARNING: - case E_COMPILE_ERROR: - case E_COMPILE_WARNING: - /* The error may not be safe to handle in user-space */ - zend_error_cb(type, error_filename, error_lineno, format, args); - break; - default: - /* Handle the error in user space */ - ALLOC_INIT_ZVAL(z_error_message); - ALLOC_INIT_ZVAL(z_error_type); - 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); - -#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, va_arg(format, char *), 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; - z_error_type->type = IS_LONG; - - if (error_filename) { - z_error_filename->value.str.len = strlen(error_filename); - z_error_filename->value.str.val = estrndup(error_filename, z_error_filename->value.str.len); - z_error_filename->type = IS_STRING; - } - - z_error_lineno->value.lval = error_lineno; - z_error_lineno->type = IS_LONG; - - z_context->value.ht = EG(active_symbol_table); - z_context->type = IS_ARRAY; - 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; - params[1] = &z_error_message; - params[2] = &z_error_filename; - params[3] = &z_error_lineno; - params[4] = &z_context; - - orig_user_error_handler = EG(user_error_handler); - EG(user_error_handler) = NULL; - if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC)==SUCCESS) { - if (retval) { - 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); - } - EG(user_error_handler) = orig_user_error_handler; - - efree(params); - zval_ptr_dtor(&z_error_message); - zval_ptr_dtor(&z_error_type); - zval_ptr_dtor(&z_error_filename); - zval_ptr_dtor(&z_error_lineno); - if (ZVAL_REFCOUNT(z_context) == 2) { - FREE_ZVAL(z_context); - } - break; - } - - va_end(args); - - if (type == E_PARSE) { - EG(exit_status) = 255; - zend_init_compiler_data_structures(TSRMLS_C); - } -} - - -ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...) -{ -#if ZEND_DEBUG - va_list args; - - va_start(args, format); -# ifdef ZEND_WIN32 - { - char output_buf[1024]; - - vsnprintf(output_buf, 1024, format, args); - OutputDebugString(output_buf); - OutputDebugString("\n"); - if (trigger_break && IsDebuggerPresent()) { - DebugBreak(); - } - } -# else - vfprintf(stderr, format, args); - fprintf(stderr, "\n"); -# endif - va_end(args); -#endif -} - - -ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...) -{ - va_list files; - int i; - zend_file_handle *file_handle; - zend_op_array *orig_op_array = EG(active_op_array); - zval *local_retval=NULL; - - va_start(files, file_count); - for (i=0; i | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_H -#define ZEND_H - -#define ZEND_VERSION "2.0.0-dev" - -#define ZEND_ENGINE_2 - -#ifdef __cplusplus -#define BEGIN_EXTERN_C() extern "C" { -#define END_EXTERN_C() } -#else -#define BEGIN_EXTERN_C() -#define END_EXTERN_C() -#endif - -#include - -/* - * general definitions - */ - -#ifdef ZEND_WIN32 -# include "zend_config.w32.h" -# define ZEND_PATHS_SEPARATOR ';' -#elif defined(NETWARE) -# include "zend_config.nw.h" -# include "acconfig.h" -#elif defined(__riscos__) -# include "zend_config.h" -# define ZEND_PATHS_SEPARATOR ';' -#else -# include "zend_config.h" -# define ZEND_PATHS_SEPARATOR ':' -#endif - - -#ifdef ZEND_WIN32 -/* Only use this macro if you know for sure that all of the switches values - are covered by its case statements */ -#define EMPTY_SWITCH_DEFAULT_CASE() \ - default: \ - __assume(0); \ - break; -#else -#define EMPTY_SWITCH_DEFAULT_CASE() -#endif - -/* all HAVE_XXX test have to be after the include of zend_config above */ - -#ifdef HAVE_UNIX_H -# include -#endif - -#ifdef HAVE_STDARG_H -# include -#endif - -#ifdef HAVE_DLFCN_H -# include -#endif - -#if HAVE_MACH_O_DYLD_H -#include - -/* MH_BUNDLE loading functions for Mac OS X / Darwin */ -void *zend_mh_bundle_load (char* bundle_path); -int zend_mh_bundle_unload (void *bundle_handle); -void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name); -const char *zend_mh_bundle_error(void); - -#endif /* 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) */ -# endif - -# ifndef RTLD_GLOBAL -# define RTLD_GLOBAL 0 -# 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) -# else -# define DL_FETCH_SYMBOL dlsym -# endif -# define DL_ERROR dlerror -# define DL_HANDLE void * -# define ZEND_EXTENSIONS_SUPPORT 1 -#elif defined(HAVE_MACH_O_DYLD_H) -# define DL_LOAD(libname) zend_mh_bundle_load(libname) -# define DL_UNLOAD(handle) zend_mh_bundle_unload(handle) -# define DL_FETCH_SYMBOL(h,s) zend_mh_bundle_symbol(h,s) -# define DL_ERROR zend_mh_bundle_error -# define DL_HANDLE void * -# define ZEND_EXTENSIONS_SUPPORT 1 -#elif defined(ZEND_WIN32) -# define DL_LOAD(libname) LoadLibrary(libname) -# define DL_FETCH_SYMBOL GetProcAddress -# define DL_UNLOAD FreeLibrary -# define DL_HANDLE HMODULE -# define ZEND_EXTENSIONS_SUPPORT 1 -#else -# define DL_HANDLE void * -# define ZEND_EXTENSIONS_SUPPORT 0 -#endif - -#if HAVE_ALLOCA_H && !defined(_ALLOCA_H) -# include -#endif - -/* AIX requires this to be the first thing in the file. */ -#ifndef __GNUC__ -# ifndef HAVE_ALLOCA_H -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -#endif - -#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 -# define do_alloca(p) emalloc(p) -# define free_alloca(p) efree(p) -#endif - -#if ZEND_DEBUG -#define ZEND_FILE_LINE_D char *__zend_filename, uint __zend_lineno -#define ZEND_FILE_LINE_DC , ZEND_FILE_LINE_D -#define ZEND_FILE_LINE_ORIG_D char *__zend_orig_filename, uint __zend_orig_lineno -#define ZEND_FILE_LINE_ORIG_DC , ZEND_FILE_LINE_ORIG_D -#define ZEND_FILE_LINE_RELAY_C __zend_filename, __zend_lineno -#define ZEND_FILE_LINE_RELAY_CC , ZEND_FILE_LINE_RELAY_C -#define ZEND_FILE_LINE_C __FILE__, __LINE__ -#define ZEND_FILE_LINE_CC , ZEND_FILE_LINE_C -#define ZEND_FILE_LINE_EMPTY_C NULL, 0 -#define ZEND_FILE_LINE_EMPTY_CC , ZEND_FILE_LINE_EMPTY_C -#define ZEND_FILE_LINE_ORIG_RELAY_C __zend_orig_filename, __zend_orig_lineno -#define ZEND_FILE_LINE_ORIG_RELAY_CC , ZEND_FILE_LINE_ORIG_RELAY_C -#else -#define ZEND_FILE_LINE_D -#define ZEND_FILE_LINE_DC -#define ZEND_FILE_LINE_ORIG_D -#define ZEND_FILE_LINE_ORIG_DC -#define ZEND_FILE_LINE_RELAY_C -#define ZEND_FILE_LINE_RELAY_CC -#define ZEND_FILE_LINE_C -#define ZEND_FILE_LINE_CC -#define ZEND_FILE_LINE_EMPTY_C -#define ZEND_FILE_LINE_EMPTY_CC -#define ZEND_FILE_LINE_ORIG_RELAY_C -#define ZEND_FILE_LINE_ORIG_RELAY_CC -#endif /* ZEND_DEBUG */ - -#ifdef ZTS -#define ZTS_V 1 -#else -#define ZTS_V 0 -#endif - -#include "zend_errors.h" -#include "zend_alloc.h" - -#include "zend_types.h" - -#ifdef HAVE_LIMITS_H -# include -#endif - -#ifndef LONG_MAX -#define LONG_MAX 2147483647L -#endif - -#ifndef LONG_MIN -#define LONG_MIN (- LONG_MAX - 1) -#endif - -#undef SUCCESS -#undef FAILURE -#define SUCCESS 0 -#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */ - - -#include "zend_hash.h" -#include "zend_ts_hash.h" -#include "zend_llist.h" - -#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC -#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used TSRMLS_CC - - -/* - * zval - */ -typedef struct _zval_struct zval; -typedef struct _zend_class_entry zend_class_entry; - -typedef struct _zend_object { - zend_class_entry *ce; - HashTable *properties; - int in_get:1; - int in_set:1; -} zend_object; - -typedef unsigned int zend_object_handle; -typedef struct _zend_object_value zend_object_value; - -#include "zend_object_handlers.h" - -struct _zend_object_value { - zend_object_handle handle; - zend_object_handlers *handlers; -}; - -typedef union _zvalue_value { - long lval; /* long value */ - double dval; /* double value */ - struct { - char *val; - int len; - } str; - HashTable *ht; /* hash table value */ - zend_object_value obj; -} zvalue_value; - - -struct _zval_struct { - /* Variable information */ - zvalue_value value; /* value */ - zend_uint refcount; - zend_uchar type; /* active type */ - zend_uchar is_ref; -}; - -struct _zend_op_array; - -/* typedef struct _zend_namespace { - char *name; - zend_uint name_length; - HashTable function_table; - HashTable class_table; - HashTable constants_table; - HashTable *global_variables; - struct _zend_op_array *op_array; -} zend_namespace; -*/ - -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 - -/* A lot of stuff needs shifiting around in order to include zend_compile.h here */ -union _zend_function; - -#define ZEND_CE_ABSTRACT ZEND_ACC_ABSTRACT /* same as ZEND_ACC_ABSTRACT */ - -struct _zend_class_entry { - char type; - char *name; - zend_uint name_length; - struct _zend_class_entry *parent; - int refcount; - zend_bool constants_updated; - zend_uint ce_flags; - - HashTable function_table; - HashTable default_properties; - HashTable properties_info; - HashTable class_table; - HashTable *static_members; - HashTable constants_table; - zend_function_entry *builtin_functions; - struct _zend_class_entry *ns; - - union _zend_function *constructor; - union _zend_function *destructor; - union _zend_function *clone; - union _zend_function *__get; - union _zend_function *__set; - union _zend_function *__call; - - - /* handlers */ - zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC); - - zend_class_entry **interfaces; - zend_uint num_interfaces; - - char *filename; - zend_uint line_start; - zend_uint line_end; - char *doc_comment; - zend_uint doc_comment_len; - - /* 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 -}; - -typedef struct _zend_class_entry zend_namespace; /* namespace is the same as class */ - -#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); - 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); - void (*block_interruptions)(void); - void (*unblock_interruptions)(void); - int (*get_configuration_directive)(char *name, uint name_length, zval *contents); - 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); -} zend_utility_functions; - - -typedef struct _zend_utility_values { - char *import_use_extension; - uint import_use_extension_length; - zend_bool html_errors; -} zend_utility_values; - - -typedef int (*zend_write_func_t)(const char *str, uint str_length); - - -#undef MIN -#undef MAX -#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)) -#define ZEND_NORMALIZE_BOOL(n) \ - ((n) ? (((n)>0) ? 1 : -1) : 0) - - -/* data types */ -#define IS_NULL 0 -#define IS_LONG 1 -#define IS_DOUBLE 2 -#define IS_STRING 3 -#define IS_ARRAY 4 -#define IS_OBJECT 5 -#define IS_BOOL 6 -#define IS_RESOURCE 7 -#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 - - -/* overloaded elements data types */ -#define OE_IS_ARRAY (1<<0) -#define OE_IS_OBJECT (1<<1) -#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); - -#ifdef ZTS -void zend_post_startup(TSRMLS_D); -#endif - -void zend_set_utility_values(zend_utility_values *utility_values); - -BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, uint lineno); -END_EXTERN_C() - -#define zend_bailout() _zend_bailout(__FILE__, __LINE__) - -#define zend_try \ - { \ - jmp_buf orig_bailout; \ - zend_bool orig_bailout_set=EG(bailout_set); \ - \ - EG(bailout_set) = 1; \ - memcpy(&orig_bailout, &EG(bailout), sizeof(jmp_buf)); \ - if (setjmp(EG(bailout))==0) -#define zend_catch \ - else -#define zend_end_try() \ - memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf)); \ - EG(bailout_set) = orig_bailout_set; \ - } -#define zend_first_try EG(bailout_set)=0; zend_try - -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); -ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent); -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, ...); - -#if ZEND_DEBUG -#define Z_DBG(expr) (expr) -#else -#define Z_DBG(expr) -#endif - -ZEND_API extern char *empty_string; - -ZEND_API void free_estring(char **str_p); - - -#define STR_FREE(ptr) if (ptr && ptr!=empty_string) { efree(ptr); } -#define STR_FREE_REL(ptr) if (ptr && ptr!=empty_string) { efree_rel(ptr); } - -#define STR_REALLOC(ptr, size) \ - if (ptr!=empty_string) { \ - ptr = (char *) erealloc(ptr, size); \ - } else { \ - ptr = (char *) emalloc(size); \ - memset(ptr, 0, size); \ - } - -/* output support */ -#define ZEND_WRITE(str, str_len) zend_write((str), (str_len)) -#define ZEND_PUTS(str) zend_write((str), strlen((str))) -#define ZEND_PUTC(c) zend_write(&(c), 1), (c) - - -BEGIN_EXTERN_C() -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); -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); - - -ZEND_API void zend_error(int type, const char *format, ...); - -void zenderror(char *error); - -/* The following #define is used for code duality in PHP for Engine 1 & 2 */ -#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def -extern ZEND_API zend_class_entry *zend_standard_class_def; -extern ZEND_API zend_utility_values zend_uv; -extern ZEND_API zval zval_used_for_init; - -END_EXTERN_C() - -#define ZEND_UV(name) (zend_uv.name) - - -#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); } -#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); } - -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); - - -/* Messages for applications of Zend */ -#define ZMSG_FAILED_INCLUDE_FOPEN 1L -#define ZMSG_FAILED_REQUIRE_FOPEN 2L -#define ZMSG_FAILED_HIGHLIGHT_FOPEN 3L -#define ZMSG_MEMORY_LEAK_DETECTED 4L -#define ZMSG_MEMORY_LEAK_REPEATED 5L -#define ZMSG_LOG_SCRIPT_NAME 6L - - -#define ZVAL_ADDREF(pz) (++(pz)->refcount) -#define ZVAL_DELREF(pz) (--(pz)->refcount) -#define ZVAL_REFCOUNT(pz) ((pz)->refcount) - -#define INIT_PZVAL(z) \ - (z)->refcount = 1; \ - (z)->is_ref = 0; - -#define INIT_ZVAL(z) z = zval_used_for_init; - -#define ALLOC_INIT_ZVAL(zp) \ - ALLOC_ZVAL(zp); \ - INIT_ZVAL(*zp); - -#define MAKE_STD_ZVAL(zv) \ - ALLOC_ZVAL(zv); \ - INIT_PZVAL(zv); - -#define PZVAL_IS_REF(z) ((z)->is_ref) - -#define SEPARATE_ZVAL(ppzv) \ - { \ - zval *orig_ptr = *(ppzv); \ - \ - if (orig_ptr->refcount>1) { \ - orig_ptr->refcount--; \ - ALLOC_ZVAL(*(ppzv)); \ - **(ppzv) = *orig_ptr; \ - zval_copy_ctor(*(ppzv)); \ - (*(ppzv))->refcount=1; \ - (*(ppzv))->is_ref = 0; \ - } \ - } - -#define SEPARATE_ZVAL_IF_NOT_REF(ppzv) \ - if (!PZVAL_IS_REF(*ppzv)) { \ - SEPARATE_ZVAL(ppzv); \ - } - -#define SEPARATE_ZVAL_TO_MAKE_IS_REF(ppzv) \ - if (!PZVAL_IS_REF(*ppzv)) { \ - SEPARATE_ZVAL(ppzv); \ - (*(ppzv))->is_ref = 1; \ - } - -#define COPY_PZVAL_TO_ZVAL(zv, pzv) \ - (zv) = *(pzv); \ - if ((pzv)->refcount>1) { \ - zval_copy_ctor(&(zv)); \ - (pzv)->refcount--; \ - } else { \ - FREE_ZVAL(pzv); \ - } \ - INIT_PZVAL(&(zv)); - -#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \ - int is_ref, refcount; \ - \ - SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \ - is_ref = (*ppzv_dest)->is_ref; \ - refcount = (*ppzv_dest)->refcount; \ - zval_dtor(*ppzv_dest); \ - **ppzv_dest = *pzv_src; \ - if (copy) { \ - zval_copy_ctor(*ppzv_dest); \ - } \ - (*ppzv_dest)->is_ref = is_ref; \ - (*ppzv_dest)->refcount = refcount; \ -} - -#define ZEND_MAX_RESERVED_RESOURCES 4 - - -#endif /* ZEND_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend.ico b/Zend/zend.ico deleted file mode 100644 index 80978a6c7e..0000000000 Binary files a/Zend/zend.ico and /dev/null differ diff --git a/Zend/zend_API.c b/Zend/zend_API.c deleted file mode 100644 index 238bcbb6fa..0000000000 --- a/Zend/zend_API.c +++ /dev/null @@ -1,1673 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - | Andrei Zmievski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_execute.h" -#include "zend_API.h" -#include "zend_modules.h" -#include "zend_constants.h" - -#ifdef HAVE_STDARG_H -#include -#endif - -/* these variables are true statics/globals, and have to be mutex'ed on every access */ -static int module_count=0; -ZEND_API HashTable module_registry; - -/* this function doesn't check for too many parameters */ -ZEND_API int zend_get_parameters(int ht, int param_count, ...) -{ - void **p; - int arg_count; - va_list ptr; - zval **param, *param_ptr; - TSRMLS_FETCH(); - - p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; - - if (param_count>arg_count) { - return FAILURE; - } - - va_start(ptr, param_count); - - while (param_count-->0) { - param = va_arg(ptr, zval **); - param_ptr = *(p-arg_count); - if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { - zval *new_tmp; - - ALLOC_ZVAL(new_tmp); - *new_tmp = *param_ptr; - zval_copy_ctor(new_tmp); - INIT_PZVAL(new_tmp); - param_ptr = new_tmp; - ((zval *) *(p-arg_count))->refcount--; - *(p-arg_count) = param_ptr; - } - *param = param_ptr; - arg_count--; - } - va_end(ptr); - - return SUCCESS; -} - - -ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC) -{ - void **p; - int arg_count; - zval *param_ptr; - - p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; - - if (param_count>arg_count) { - return FAILURE; - } - - while (param_count-->0) { - param_ptr = *(p-arg_count); - if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { - zval *new_tmp; - - ALLOC_ZVAL(new_tmp); - *new_tmp = *param_ptr; - zval_copy_ctor(new_tmp); - INIT_PZVAL(new_tmp); - param_ptr = new_tmp; - ((zval *) *(p-arg_count))->refcount--; - *(p-arg_count) = param_ptr; - } - *(argument_array++) = param_ptr; - arg_count--; - } - - return SUCCESS; -} - - - - -/* Zend-optimized Extended functions */ -/* this function doesn't check for too many parameters */ -ZEND_API int zend_get_parameters_ex(int param_count, ...) -{ - void **p; - int arg_count; - va_list ptr; - zval ***param; - TSRMLS_FETCH(); - - p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; - - if (param_count>arg_count) { - return FAILURE; - } - - va_start(ptr, param_count); - while (param_count-->0) { - param = va_arg(ptr, zval ***); - *param = (zval **) p-(arg_count--); - } - va_end(ptr); - - return SUCCESS; -} - - -ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC) -{ - void **p; - int arg_count; - - p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; - - if (param_count>arg_count) { - return FAILURE; - } - - while (param_count-->0) { - *(argument_array++) = (zval **) p-(arg_count--); - } - - return SUCCESS; -} - - -ZEND_API void zend_wrong_param_count(TSRMLS_D) -{ - zend_error(E_WARNING, "Wrong parameter count for %s()", get_active_function_name(TSRMLS_C)); -} - - -/* Argument parsing API -- andrei */ - -ZEND_API char *zend_zval_type_name(zval *arg) -{ - switch (Z_TYPE_P(arg)) { - case IS_NULL: - return "null"; - - case IS_LONG: - return "integer"; - - case IS_DOUBLE: - return "double"; - - case IS_STRING: - return "string"; - - case IS_ARRAY: - return "array"; - - case IS_OBJECT: - return "object"; - - case IS_BOOL: - return "boolean"; - - case IS_RESOURCE: - return "resource"; - - default: - return "unknown"; - } -} - -ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC) -{ - if (Z_OBJ_HT_P(zobject)->get_class_entry) { - return Z_OBJ_HT_P(zobject)->get_class_entry(zobject TSRMLS_CC); - } else { - zend_error(E_ERROR, "Class entry requested for an object without PHP class"); - return NULL; - } -} - -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) -{ - char *spec_walk = *spec; - char c = *spec_walk++; - int return_null = 0; - - while (*spec_walk == '/' || *spec_walk == '!') { - if (*spec_walk == '/') { - SEPARATE_ZVAL_IF_NOT_REF(arg); - } else if (*spec_walk == '!' && Z_TYPE_PP(arg) == IS_NULL) { - return_null = 1; - } - spec_walk++; - } - - switch (c) { - case 'l': - { - long *p = va_arg(*va, long *); - switch (Z_TYPE_PP(arg)) { - case IS_STRING: - { - double d; - int type; - - if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, 0)) == 0) { - return "long"; - } else if (type == IS_DOUBLE) { - *p = (long) d; - } - } - break; - - case IS_NULL: - case IS_LONG: - case IS_DOUBLE: - case IS_BOOL: - convert_to_long_ex(arg); - *p = Z_LVAL_PP(arg); - break; - - case IS_ARRAY: - case IS_OBJECT: - case IS_RESOURCE: - default: - return "long"; - } - } - break; - - case 'd': - { - double *p = va_arg(*va, double *); - switch (Z_TYPE_PP(arg)) { - case IS_STRING: - { - long l; - int type; - - if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, 0)) == 0) { - return "double"; - } else if (type == IS_LONG) { - *p = (double) l; - } - } - break; - - case IS_NULL: - case IS_LONG: - case IS_DOUBLE: - case IS_BOOL: - convert_to_double_ex(arg); - *p = Z_DVAL_PP(arg); - break; - - case IS_ARRAY: - case IS_OBJECT: - case IS_RESOURCE: - default: - return "double"; - } - } - break; - - case 's': - { - char **p = va_arg(*va, char **); - int *pl = va_arg(*va, int *); - switch (Z_TYPE_PP(arg)) { - case IS_NULL: - if (return_null) { - *p = NULL; - *pl = 0; - break; - } - /* break omitted intentionally */ - - case IS_STRING: - case IS_LONG: - case IS_DOUBLE: - case IS_BOOL: - convert_to_string_ex(arg); - *p = Z_STRVAL_PP(arg); - *pl = Z_STRLEN_PP(arg); - break; - - case IS_ARRAY: - case IS_OBJECT: - case IS_RESOURCE: - default: - return "string"; - } - } - break; - - case 'b': - { - zend_bool *p = va_arg(*va, zend_bool *); - switch (Z_TYPE_PP(arg)) { - case IS_NULL: - case IS_STRING: - case IS_LONG: - case IS_DOUBLE: - case IS_BOOL: - convert_to_boolean_ex(arg); - *p = Z_BVAL_PP(arg); - break; - - case IS_ARRAY: - case IS_OBJECT: - case IS_RESOURCE: - default: - return "boolean"; - } - } - break; - - case 'r': - { - zval **p = va_arg(*va, zval **); - if (Z_TYPE_PP(arg) != IS_RESOURCE) { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else { - return "resource"; - } - } else - *p = *arg; - } - break; - - case 'a': - { - zval **p = va_arg(*va, zval **); - if (Z_TYPE_PP(arg) != IS_ARRAY) { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else { - return "array"; - } - } else - *p = *arg; - } - break; - - case 'o': - { - zval **p = va_arg(*va, zval **); - if (Z_TYPE_PP(arg) != IS_OBJECT) { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else { - return "object"; - } - } else - *p = *arg; - } - break; - - case 'O': - { - zval **p = va_arg(*va, zval **); - zend_class_entry *ce = va_arg(*va, zend_class_entry *); - if (!zend_check_class(*arg, ce TSRMLS_CC)) { - if (Z_TYPE_PP(arg) == IS_NULL && return_null) { - *p = NULL; - } else { - return ce->name; - } - } else - *p = *arg; - } - 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"; - } - - *spec = spec_walk; - - return NULL; -} - -static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int quiet TSRMLS_DC) -{ - char *expected_type = NULL; - - expected_type = zend_parse_arg_impl(arg, va, spec TSRMLS_CC); - if (expected_type) { - if (!quiet) { - zend_error(E_WARNING, "%s() expects parameter %d to be %s, %s given", - get_active_function_name(TSRMLS_C), arg_num, expected_type, - zend_zval_type_name(*arg)); - } - return FAILURE; - } - - return SUCCESS; -} - -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; - zval **arg; - void **p; - int arg_count; - int quiet = flags & ZEND_PARSE_PARAMS_QUIET; - - for (spec_walk = type_spec; *spec_walk; spec_walk++) { - c = *spec_walk; - switch (c) { - case 'l': case 'd': - case 's': case 'b': - case 'r': case 'a': - case 'o': case 'O': - case 'z': - max_num_args++; - break; - - case '|': - min_num_args = max_num_args; - break; - - case '/': - case '!': - /* Pass */ - break; - - default: - if (!quiet) { - zend_error(E_WARNING, "%s(): bad type specifier while parsing parameters", get_active_function_name(TSRMLS_C)); - } - return FAILURE; - } - } - - if (min_num_args < 0) { - min_num_args = max_num_args; - } - - if (num_args < min_num_args || num_args > max_num_args) { - if (!quiet) { - 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; - } - - p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; - - if (num_args > arg_count) { - zend_error(E_WARNING, "%s(): could not obtain parameters for parsing", - get_active_function_name(TSRMLS_C)); - return FAILURE; - } - - i = 0; - while (num_args-- > 0) { - arg = (zval **) p - (arg_count-i); - if (*type_spec == '|') { - type_spec++; - } - if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) { - return FAILURE; - } - i++; - } - - return SUCCESS; -} - -ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...) -{ - va_list va; - int retval; - - va_start(va, type_spec); - retval = zend_parse_va_args(num_args, type_spec, &va, flags TSRMLS_CC); - va_end(va); - - return retval; -} - -ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...) -{ - va_list va; - int retval; - - va_start(va, type_spec); - retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC); - va_end(va); - - return retval; -} - -ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...) -{ - va_list va; - int retval; - char *p = type_spec; - zval **object; - zend_class_entry *ce; - - 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 = va_arg(va, zval **); - ce = va_arg(va, zend_class_entry *); - *object = this_ptr; - - retval = zend_parse_va_args(num_args, p, &va, 0 TSRMLS_CC); - va_end(va); - } - return retval; -} - -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; - int quiet = flags & ZEND_PARSE_PARAMS_QUIET; - - *object = this_ptr; - - if (!*object) { - zval **parameter; - - if (zend_get_parameters_ex(1, ¶meter) != SUCCESS) { - if (!quiet) { - 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; - } 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 */ - - -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); - arg->type = IS_ARRAY; - return SUCCESS; -} - - -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->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); - class_type->constants_updated = 1; - } - - arg->type = IS_OBJECT; - if (class_type->create_object == NULL) { - arg->value.obj = zend_objects_new(&object, class_type TSRMLS_CC); - if (properties) { - object->properties = properties; - } else { - ALLOC_HASHTABLE_REL(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 *)); - } - } else { - arg->value.obj = class_type->create_object(class_type TSRMLS_CC); - } - return SUCCESS; -} - -ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_LINE_DC TSRMLS_DC) -{ - return _object_and_properties_init(arg, class_type, 0 ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); -} - -ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC) -{ - return _object_init_ex(arg, zend_standard_class_def ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); -} - - -ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)) -{ - zend_error(E_WARNING, "add_assoc_function() is no longer supported"); - return FAILURE; -} - - -ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_LONG(tmp, n); - - 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) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_NULL(tmp); - - 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) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_BOOL(tmp, b); - - 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) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_RESOURCE(tmp, r); - - return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_DOUBLE(tmp, d); - - return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRING(tmp, str, duplicate); - - return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRINGL(tmp, str, length, duplicate); - - 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_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL); -} - - -ZEND_API int add_index_long(zval *arg, uint index, long n) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_LONG(tmp, n); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_index_null(zval *arg, uint index) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_NULL(tmp); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - -ZEND_API int add_index_bool(zval *arg, uint index, int b) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_BOOL(tmp, b); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_index_resource(zval *arg, uint index, int r) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_RESOURCE(tmp, r); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_index_double(zval *arg, uint index, double d) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_DOUBLE(tmp, d); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_index_string(zval *arg, uint index, char *str, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRING(tmp, str, duplicate); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRINGL(tmp, str, length, duplicate); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_index_zval(zval *arg, uint index, zval *value) -{ - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &value, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_long(zval *arg, long n) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_LONG(tmp, n); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_null(zval *arg) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_NULL(tmp); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_bool(zval *arg, int b) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_BOOL(tmp, b); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_resource(zval *arg, int r) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_RESOURCE(tmp, r); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_double(zval *arg, double d) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_DOUBLE(tmp, d); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRING(tmp, str, duplicate); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRINGL(tmp, str, length, duplicate); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_zval(zval *arg, zval *value) -{ - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &value, sizeof(zval *), NULL); -} - - -ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRING(tmp, str, duplicate); - - return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRINGL(tmp, str, length, duplicate); - - return zend_hash_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_LONG(tmp, l); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API int add_get_index_double(zval *arg, uint index, double d, void **dest) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_DOUBLE(tmp, d); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRING(tmp, str, duplicate); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRINGL(tmp, str, length, duplicate); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC) -{ - zval *tmp; - zval z_key; - - MAKE_STD_ZVAL(tmp); - ZVAL_LONG(tmp, n); - ZVAL_STRINGL(&z_key, key, key_len-1, 0); - - Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); - zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; -} - -ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC) -{ - zval *tmp; - zval z_key; - - MAKE_STD_ZVAL(tmp); - ZVAL_BOOL(tmp, b); - - ZVAL_STRINGL(&z_key, key, key_len-1, 0); - - Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); - zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; -} - -ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC) -{ - zval *tmp; - zval z_key; - - MAKE_STD_ZVAL(tmp); - ZVAL_NULL(tmp); - - ZVAL_STRINGL(&z_key, key, key_len-1, 0); - - Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); - zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; -} - -ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC) -{ - zval *tmp; - zval z_key; - - MAKE_STD_ZVAL(tmp); - ZVAL_RESOURCE(tmp, n); - ZVAL_STRINGL(&z_key, key, key_len-1, 0); - - Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); - zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; -} - - -ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC) -{ - zval *tmp; - zval z_key; - - MAKE_STD_ZVAL(tmp); - ZVAL_DOUBLE(tmp, d); - ZVAL_STRINGL(&z_key, key, key_len-1, 0); - - Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); - zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; -} - - -ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC) -{ - zval *tmp; - zval z_key; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRING(tmp, str, duplicate); - - ZVAL_STRINGL(&z_key, key, key_len-1, 0); - - Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); - zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; -} - -ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC) -{ - zval *tmp; - zval z_key; - - MAKE_STD_ZVAL(tmp); - ZVAL_STRINGL(tmp, str, length, duplicate); - - ZVAL_STRINGL(&z_key, key, key_len-1, 0); - - Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); - zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ - return SUCCESS; -} - -ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC) -{ - zval z_key; - - ZVAL_STRINGL(&z_key, key, key_len-1, 0); - - Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, value TSRMLS_CC); - return SUCCESS; -} - -ZEND_API int zend_startup_module(zend_module_entry *module) -{ - if (module) { - module->module_number = zend_next_free_module(); - if (module->module_startup_func) { - TSRMLS_FETCH(); - - 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 */ -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; - zend_internal_function *internal_function = (zend_internal_function *)&function; - int count=0, unload=0; - HashTable *target_function_table = function_table; - int error_type; - zend_function *ctor = NULL, *dtor = NULL, *clone = NULL; - char *lowercase_name; - int fname_len, is_namespace = 0; - zend_namespace *scope_namespace; - - if (type==MODULE_PERSISTENT) { - error_type = E_CORE_WARNING; - } else { - error_type = E_WARNING; - } - - if (!target_function_table) { - target_function_table = CG(function_table); - } - internal_function->type = ZEND_INTERNAL_FUNCTION; - - if(scope) { - scope_namespace = scope->ns; - is_namespace = (scope->type == ZEND_INTERNAL_NAMESPACE || scope->type == ZEND_USER_NAMESPACE) ? 1 : 0; - } else { - scope_namespace = EG(active_namespace); - } - - 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->ns = scope_namespace; - internal_function->prototype = NULL; - 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); - memcpy(lowercase_name, ptr->fname, fname_len+1); - zend_str_tolower(lowercase_name, fname_len); - if (zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)®_function) == FAILURE) { - unload=1; - free_alloca(lowercase_name); - break; - } - if (scope) { - if (is_namespace) { - /* if namespace all methods must be "static final" */ - reg_function->common.fn_flags = ZEND_ACC_FINAL | ZEND_ACC_STATIC; - } else { - /* if class not namespace then look for ctor, dtor, clone - * If it's an old-style constructor, store it only if we don't have - * a constructor already. - */ - if (!strcmp(ptr->fname, scope->name) && !ctor) { - ctor = reg_function; - } else if (!strcmp(ptr->fname, ZEND_CONSTRUCTOR_FUNC_NAME)) { - ctor = reg_function; - } else if (!strcmp(ptr->fname, ZEND_DESTRUCTOR_FUNC_NAME)) { - dtor = reg_function; - } else if (!strcmp(ptr->fname, ZEND_CLONE_FUNC_NAME)) { - clone = reg_function; - } - } - } - ptr++; - count++; - free_alloca(lowercase_name); - } - if (unload) { /* before unloading, display all remaining bad function in the module */ - while (ptr->fname) { - if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) { - zend_error(error_type, "Function registration failed - duplicate name - %s", ptr->fname); - } - ptr++; - } - zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); - return FAILURE; - } - if (scope) { - scope->constructor = ctor; - scope->destructor = dtor; - scope->clone = clone; - } - return SUCCESS; -} - -/* count=-1 means erase all functions, otherwise, - * erase the first count functions - */ -void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC) -{ - zend_function_entry *ptr = functions; - int i=0; - HashTable *target_function_table = function_table; - - if (!target_function_table) { - target_function_table = CG(function_table); - } - while (ptr->fname) { - if (count!=-1 && i>=count) { - break; - } -#if 0 - zend_printf("Unregistering %s()\n", ptr->fname); -#endif - zend_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1); - ptr++; - i++; - } -} - - -ZEND_API int zend_register_module(zend_module_entry *module) -{ - TSRMLS_FETCH(); - -#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); -} - - -void module_destructor(zend_module_entry *module) -{ - TSRMLS_FETCH(); - - 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) - module->request_shutdown_func(module->type, module->module_number TSRMLS_CC); - } - - if (module->module_started && module->module_shutdown_func) { -#if 0 - zend_printf("%s: Module shutdown\n", module->name); -#endif - module->module_shutdown_func(module->type, module->module_number TSRMLS_CC); - } - module->module_started=0; - if (module->functions) { - zend_unregister_functions(module->functions, -1, NULL TSRMLS_CC); - } - -#if HAVE_LIBDL - if (module->handle) { - dlclose(module->handle); - } -#endif -} - - -/* call request startup for all modules */ -int module_registry_request_startup(zend_module_entry *module TSRMLS_DC) -{ - if (module->request_startup_func) { -#if 0 - zend_printf("%s: Request startup\n", module->name); -#endif - if (module->request_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) { - zend_error(E_WARNING, "request_startup() for %s module failed", module->name); - exit(1); - } - } - return 0; -} - - -/* for persistent modules - call request shutdown and flag NOT to erase - * for temporary modules - do nothing, and flag to erase - */ -int module_registry_cleanup(zend_module_entry *module TSRMLS_DC) -{ - switch (module->type) { - case MODULE_PERSISTENT: - if (module->request_shutdown_func) { -#if 0 - zend_printf("%s: Request shutdown\n", module->name); -#endif - module->request_shutdown_func(module->type, module->module_number TSRMLS_CC); - } - return 0; - break; - case MODULE_TEMPORARY: - return 1; - break; - } - return 0; -} - - -/* return the next free module number */ -int zend_next_free_module(void) -{ - return ++module_count; -} - -/* 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 - * If parent_name is specified but not found NULL is returned - */ -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_class_entry *register_class; - - if (!parent_ce && parent_name) { - zend_class_entry **pce; - if (zend_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &pce)==FAILURE) { - return NULL; - } else { - parent_ce = *pce; - } - } - - register_class = zend_register_internal_class(class_entry TSRMLS_CC); - - if (parent_ce) { - zend_do_inheritance(register_class, parent_ce); - } - return register_class; -} - -ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_class_entry TSRMLS_DC) -{ - zend_class_entry *class_entry = malloc(sizeof(zend_class_entry)); - char *lowercase_name = zend_strndup(orig_class_entry->name, orig_class_entry->name_length); - *class_entry = *orig_class_entry; - - 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(lowercase_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 zend_class_entry *zend_register_internal_ns_class(zend_class_entry *class_entry, zend_class_entry *parent_ce, zend_namespace *ns, char *ns_name TSRMLS_DC) -{ - zend_class_entry *register_class; - zend_namespace *orig_namespace = NULL; - HashTable *orig_class_table = NULL; - int restore_orig = 0; - - if (!ns && ns_name) { - zend_namespace **pns; - size_t ns_name_length = strlen(ns_name); - char *lowercase_name = zend_strndup(ns_name, ns_name_length); - zend_str_tolower(lowercase_name, ns_name_length); - if (zend_hash_find(&CG(global_namespace).class_table, lowercase_name, ns_name_length+1, (void **)&pns) == FAILURE) { - free(lowercase_name); - return NULL; - } else { - ns = *pns; - } - free(lowercase_name); - } - - if (EG(active_namespace) != ns) { - restore_orig = 1; - orig_namespace = CG(active_namespace); - CG(active_namespace) = ns; - orig_class_table = CG(class_table); - CG(class_table) = &ns->class_table; - } - class_entry->ns = ns; - register_class = zend_register_internal_class_ex(class_entry, parent_ce, NULL TSRMLS_CC); - if (restore_orig) { - CG(active_namespace) = orig_namespace; - CG(class_table) = orig_class_table; - } - - return register_class; -} - -ZEND_API zend_namespace *zend_register_internal_namespace(zend_namespace *orig_ns TSRMLS_DC) -{ - zend_namespace *ns = malloc(sizeof(zend_namespace)); - char *lowercase_name = zend_strndup(orig_ns->name, orig_ns->name_length); - *ns = *orig_ns; - - ns->type = ZEND_INTERNAL_NAMESPACE; - zend_init_namespace(ns TSRMLS_CC); - - zend_str_tolower(lowercase_name, ns->name_length); - zend_hash_update(&CG(global_namespace).class_table, lowercase_name, ns->name_length+1, &ns, sizeof(zend_namespace *), NULL); - free(lowercase_name); - - if (ns->builtin_functions) { - zend_register_functions(ns, ns->builtin_functions, &ns->function_table, MODULE_PERSISTENT TSRMLS_CC); - } - - return ns; -} - -ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, - zend_bool is_ref, int num_symbol_tables, ...) -{ - HashTable *symbol_table; - va_list symbol_table_list; - - if (num_symbol_tables <= 0) return FAILURE; - - symbol->is_ref = is_ref; - - va_start(symbol_table_list, num_symbol_tables); - while (num_symbol_tables-- > 0) { - symbol_table = va_arg(symbol_table_list, HashTable *); - zend_hash_update(symbol_table, name, name_length + 1, &symbol, sizeof(zval *), NULL); - zval_add_ref(&symbol); - } - va_end(symbol_table_list); - return SUCCESS; -} - - - - -/* Disabled functions support */ - -ZEND_API ZEND_FUNCTION(display_disabled_function) -{ - zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name(TSRMLS_C)); -} - - -static zend_function_entry disabled_function[] = { - ZEND_FE(display_disabled_function, NULL) - { NULL, NULL, NULL } -}; - - -ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) -{ - if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { - return FAILURE; - } - disabled_function[0].fname = function_name; - return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC); -} - -static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC) -{ - zend_object_value retval; - zend_object *intern; - retval = zend_objects_new(&intern, class_type TSRMLS_CC); - ALLOC_HASHTABLE(intern->properties); - zend_hash_init(intern->properties, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name); - return retval; -} - -static zend_function_entry disabled_class_new[] = { - { NULL, NULL, NULL } -}; - -ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) -{ - zend_class_entry *disabled_class; - disabled_class = (zend_class_entry *) emalloc(sizeof(zend_class_entry)); - - zend_str_tolower(class_name, class_name_length); - if (zend_hash_del(CG(class_table), class_name, class_name_length+1)==FAILURE) { - return FAILURE; - } - INIT_CLASS_ENTRY((*disabled_class), class_name, disabled_class_new); - disabled_class->create_object = display_disabled_class; - zend_register_internal_class(disabled_class TSRMLS_CC); - return 1; -} - -zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name) -{ - char *lcname; - zend_bool retval = 0; - TSRMLS_FETCH(); - - switch (Z_TYPE_P(callable)) { - case IS_STRING: - if (callable_name) - *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable)); - - if (syntax_only) - return 1; - - lcname = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable)); - zend_str_tolower(lcname, Z_STRLEN_P(callable)); - if (zend_hash_exists(EG(function_table), lcname, Z_STRLEN_P(callable)+1)) - retval = 1; - efree(lcname); - break; - - case IS_ARRAY: - { - zval **method; - zval **obj; - zend_class_entry *ce = NULL, **pce; - zend_uint callable_name_len; - - if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2 && - zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj) == SUCCESS && - zend_hash_index_find(Z_ARRVAL_P(callable), 1, (void **) &method) == SUCCESS && - (Z_TYPE_PP(obj) == IS_OBJECT || Z_TYPE_PP(obj) == IS_STRING) && - Z_TYPE_PP(method) == IS_STRING) { - - if (Z_TYPE_PP(obj) == IS_STRING) { - if (callable_name) { - char *ptr; - - callable_name_len = Z_STRLEN_PP(obj) + Z_STRLEN_PP(method) + sizeof("::"); - ptr = *callable_name = emalloc(callable_name_len); - memcpy(ptr, Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); - ptr += Z_STRLEN_PP(obj); - memcpy(ptr, "::", sizeof("::") - 1); - ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1); - } - - if (syntax_only) - return 1; - - lcname = estrndup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); - zend_str_tolower(lcname, Z_STRLEN_PP(obj)); - if (zend_lookup_class(lcname, Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) { - ce = *pce; - } - - efree(lcname); - } else { - ce = Z_OBJCE_PP(obj); /* ??? */ - - if (callable_name) { - char *ptr; - - callable_name_len = ce->name_length + Z_STRLEN_PP(method) + sizeof("::"); - ptr = *callable_name = emalloc(callable_name_len); - memcpy(ptr, ce->name, ce->name_length); - ptr += ce->name_length; - memcpy(ptr, "::", sizeof("::") - 1); - ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1); - } - - if (syntax_only) - return 1; - } - - if (ce) { - lcname = estrndup(Z_STRVAL_PP(method), Z_STRLEN_PP(method)); - zend_str_tolower(lcname, Z_STRLEN_PP(method)); - if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method)+1)) - retval = 1; - efree(lcname); - } - } else if (callable_name) - *callable_name = estrndup("Array", sizeof("Array")-1); - } - break; - - default: - if (callable_name) { - zval expr_copy; - int use_copy; - - zend_make_printable_zval(callable, &expr_copy, &use_copy); - *callable_name = estrndup(Z_STRVAL(expr_copy), Z_STRLEN(expr_copy)); - zval_dtor(&expr_copy); - } - break; - } - - return retval; -} - -ZEND_API char *zend_get_module_version(char *module_name) -{ - zend_module_entry *module; - - if (zend_hash_find(&module_registry, module_name, strlen(module_name) + 1, - (void**)&module) == FAILURE) { - return NULL; - } - return module->version; -} - -ZEND_API void zend_make_full_classname(zend_class_entry *ce, char **name, zend_uint *name_len) -{ - int len = ce->name_length; - char *full_name; - - if(ce->ns && ce->ns->name) { - len += ce->ns->name_length + 2; - } - - *name = full_name = emalloc(len+1); - *name_len = len; - - if(ce->ns && ce->ns->name) { - memcpy(full_name, ce->ns->name, ce->ns->name_length); - full_name += ce->ns->name_length; - *(full_name++) = ':'; - *(full_name++) = ':'; - } - - memcpy(full_name, ce->name, ce->name_length); - full_name[ce->name_length] = '\0'; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_API.h b/Zend/zend_API.h deleted file mode 100644 index d8ebb20ac8..0000000000 --- a/Zend/zend_API.h +++ /dev/null @@ -1,447 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - | Andrei Zmievski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_API_H -#define ZEND_API_H - -#include "zend_modules.h" -#include "zend_list.h" -#include "zend_fast_cache.h" -#include "zend_operators.h" -#include "zend_variables.h" -#include "zend_execute.h" - - -BEGIN_EXTERN_C() -#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(class, name) ZEND_NAMED_FUNCTION(ZEND_FN(class##_##name)) - -#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_INFO_N(module) zm_info_##module - -/* Declaration macros */ -#define ZEND_MODULE_STARTUP_D(module) int ZEND_MODULE_STARTUP_N(module)(INIT_FUNC_ARGS) -#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_INFO_D(module) void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS) - -#define ZEND_GET_MODULE(name) \ - ZEND_DLEXPORT zend_module_entry *get_module(void) { return &name##_module_entry; } - -#define ZEND_BEGIN_MODULE_GLOBALS(module_name) \ - typedef struct _zend_##module_name##_globals { -#define ZEND_END_MODULE_GLOBALS(module_name) \ - } zend_##module_name##_globals; - -#ifdef ZTS - -#define ZEND_DECLARE_MODULE_GLOBALS(module_name) \ - ts_rsrc_id module_name##_globals_id; -#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \ - extern ts_rsrc_id module_name##_globals_id; -#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \ - ts_allocate_id(&module_name##_globals_id, sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor); - -#else - -#define ZEND_DECLARE_MODULE_GLOBALS(module_name) \ - zend_##module_name##_globals module_name##_globals; -#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \ - extern zend_##module_name##_globals module_name##_globals; -#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \ - globals_ctor(&module_name##_globals); - -#endif - - - -#define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL) - -#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \ - { \ - class_container.name = strdup(class_name); \ - class_container.name_length = strlen(class_name); \ - class_container.builtin_functions = functions; \ - class_container.constructor = NULL; \ - class_container.destructor = NULL; \ - class_container.clone = NULL; \ - class_container.create_object = NULL; \ - class_container.__call = handle_fcall; \ - class_container.__get = handle_propget; \ - class_container.__set = handle_propset; \ - class_container.num_interfaces = 0; \ - } - -#define INIT_NAMESPACE(ns_container, ns_name) INIT_CLASS_ENTRY(ns_container, ns_name, NULL) - -#define INIT_NAMESPACE_WITH_FUNCS(ns_container, ns_name, functions) INIT_CLASS_ENTRY(ns_container, ns_name, functions) - - -int zend_next_free_module(void); - -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, ...); -ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC); - -#define zend_get_parameters_array(ht, param_count, argument_array) \ - _zend_get_parameters_array(ht, param_count, argument_array TSRMLS_CC) -#define zend_get_parameters_array_ex(param_count, argument_array) \ - _zend_get_parameters_array_ex(param_count, argument_array TSRMLS_CC) - - -/* Parameter parsing API -- andrei */ - -#define ZEND_PARSE_PARAMS_QUIET 1<<1 -ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...); -ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...); -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_class_entry *ce, void **object, ...); - -/* End of parameter parsing API -- andrei */ - -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 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_ns_class(zend_class_entry *class_entry, zend_class_entry *parent_ce, zend_namespace *ns, char *ns_name TSRMLS_DC); -ZEND_API zend_namespace *zend_register_internal_namespace(zend_namespace *ns TSRMLS_DC); - -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 char *zend_get_module_version(char *module_name); - -ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC); - -#define getThis() (this_ptr) - -#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT() -#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) -#define ARG_COUNT(dummy) (ht) -#define ZEND_NUM_ARGS() (ht) -#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(TSRMLS_C); return; } -#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { zend_wrong_param_count(TSRMLS_C); return ret; } - -#ifndef ZEND_WIN32 -#define DLEXPORT -#endif - -ZEND_API int zend_startup_module(zend_module_entry *module); - -#define array_init(arg) _array_init((arg) ZEND_FILE_LINE_CC) -#define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC TSRMLS_CC) -#define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC TSRMLS_CC) -#define object_and_properties_init(arg, ce, properties) _object_and_properties_init((arg), (ce), (properties) ZEND_FILE_LINE_CC TSRMLS_CC) -ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC); -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); - -/* no longer supported */ -ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)); - -ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n); -ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len); -ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b); -ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r); -ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d); -ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate); -ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate); -ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value); - -#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n) -#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1) -#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b) -#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r) -#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key)+1, __d) -#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate) -#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate) -#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value) - -/* unset() functions are only suported for legacy modules and null() functions should be used */ -#define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1) -#define add_index_unset(__arg, __key) add_index_null(__arg, __key) -#define add_next_index_unset(__arg) add_next_index_null(__arg) -#define add_property_unset(__arg, __key) add_property_null(__arg, __key) - -ZEND_API int add_index_long(zval *arg, uint idx, long n); -ZEND_API int add_index_null(zval *arg, uint idx); -ZEND_API int add_index_bool(zval *arg, uint idx, int b); -ZEND_API int add_index_resource(zval *arg, uint idx, int r); -ZEND_API int add_index_double(zval *arg, uint idx, double d); -ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate); -ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate); -ZEND_API int add_index_zval(zval *arg, uint index, zval *value); - -ZEND_API int add_next_index_long(zval *arg, long n); -ZEND_API int add_next_index_null(zval *arg); -ZEND_API int add_next_index_bool(zval *arg, int b); -ZEND_API int add_next_index_resource(zval *arg, int r); -ZEND_API int add_next_index_double(zval *arg, double d); -ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate); -ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate); -ZEND_API int add_next_index_zval(zval *arg, zval *value); - -ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate); -ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate); - -#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate) -#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate) - -ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest); -ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest); -ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate); -ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate); - -ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC); -ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC); -ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC); -ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r TSRMLS_DC); -ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC); -ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC); -ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC); -ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC); - -#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC) -#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC) -#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b TSRMLS_CC) -#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r TSRMLS_CC) -#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d TSRMLS_CC) -#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC) -#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, 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 zend_set_hash_symbol(zval *symbol, char *name, int name_length, - zend_bool is_ref, int num_symbol_tables, ...); - -#define add_method(arg, key, method) add_assoc_function((arg), (key), (method)) - -ZEND_API ZEND_FUNCTION(display_disabled_function); -ZEND_API ZEND_FUNCTION(display_disabled_class); - -ZEND_API void zend_make_full_classname(zend_class_entry *ce, char **name, zend_uint *name_len); - -#if ZEND_DEBUG -#define CHECK_ZVAL_STRING(z) \ - if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val); } -#define CHECK_ZVAL_STRING_REL(z) \ - if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (z)->value.str.val ZEND_FILE_LINE_RELAY_CC); } -#else -#define CHECK_ZVAL_STRING(z) -#define CHECK_ZVAL_STRING_REL(z) -#endif - -#define ZVAL_RESOURCE(z, l) { \ - (z)->type = IS_RESOURCE; \ - (z)->value.lval = l; \ - } - -#define ZVAL_BOOL(z, b) { \ - (z)->type = IS_BOOL; \ - (z)->value.lval = b; \ - } - -#define ZVAL_NULL(z) { \ - (z)->type = IS_NULL; \ - } - -#define ZVAL_LONG(z, l) { \ - (z)->type = IS_LONG; \ - (z)->value.lval = l; \ - } - -#define ZVAL_DOUBLE(z, d) { \ - (z)->type = IS_DOUBLE; \ - (z)->value.dval = d; \ - } - -#define ZVAL_STRING(z, s, duplicate) { \ - char *__s=(s); \ - (z)->value.str.len = strlen(__s); \ - (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \ - (z)->type = IS_STRING; \ - } - -#define ZVAL_STRINGL(z, s, l, duplicate) { \ - char *__s=(s); int __l=l; \ - (z)->value.str.len = __l; \ - (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \ - (z)->type = IS_STRING; \ - } - -#define ZVAL_EMPTY_STRING(z) { \ - (z)->value.str.len = 0; \ - (z)->value.str.val = empty_string; \ - (z)->type = IS_STRING; \ - } - -#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0) -#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1) - -#define RETVAL_RESOURCE(l) ZVAL_RESOURCE(return_value, l) -#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b) -#define RETVAL_NULL() ZVAL_NULL(return_value) -#define RETVAL_LONG(l) ZVAL_LONG(return_value, l) -#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d) -#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_FALSE ZVAL_BOOL(return_value, 0) -#define RETVAL_TRUE ZVAL_BOOL(return_value, 1) - -#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; } -#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; } -#define RETURN_NULL() { RETVAL_NULL(); return;} -#define RETURN_LONG(l) { RETVAL_LONG(l); return; } -#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; } -#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_FALSE { RETVAL_FALSE; return; } -#define RETURN_TRUE { RETVAL_TRUE; return; } - -#define SET_VAR_STRING(n, v) { \ - { \ - zval *var; \ - ALLOC_ZVAL(var); \ - ZVAL_STRING(var, v, 0); \ - ZEND_SET_GLOBAL_VAR(n, var); \ - } \ - } - -#define SET_VAR_STRINGL(n, v, l) { \ - { \ - zval *var; \ - ALLOC_ZVAL(var); \ - ZVAL_STRINGL(var, v, l, 0); \ - ZEND_SET_GLOBAL_VAR(n, var); \ - } \ - } - -#define SET_VAR_LONG(n, v) { \ - { \ - zval *var; \ - ALLOC_ZVAL(var); \ - ZVAL_LONG(var, v); \ - ZEND_SET_GLOBAL_VAR(n, var); \ - } \ - } - -#define SET_VAR_DOUBLE(n, v) { \ - { \ - zval *var; \ - ALLOC_ZVAL(var); \ - ZVAL_DOUBLE(var, v); \ - ZEND_SET_GLOBAL_VAR(n, var); \ - } \ - } - - -#define ZEND_SET_SYMBOL(symtable, name, var) \ - { \ - char *_name = (name); \ - \ - ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var, 1, 0); \ - } - -#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \ - { \ - zval **orig_var; \ - \ - if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \ - && PZVAL_IS_REF(*orig_var)) { \ - (var)->refcount = (*orig_var)->refcount; \ - (var)->is_ref = 1; \ - \ - if (_refcount) { \ - (var)->refcount += _refcount-1; \ - } \ - zval_dtor(*orig_var); \ - **orig_var = *(var); \ - FREE_ZVAL(var); \ - } else { \ - (var)->is_ref = _is_ref; \ - if (_refcount) { \ - (var)->refcount = _refcount; \ - } \ - zend_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \ - } \ - } - - -#define ZEND_SET_GLOBAL_VAR(name, var) \ - ZEND_SET_SYMBOL(&EG(symbol_table), name, var) - -#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 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) - -/* For compatibility */ -#define ZEND_MINIT ZEND_MODULE_STARTUP_N -#define ZEND_MSHUTDOWN ZEND_MODULE_SHUTDOWN_N -#define ZEND_RINIT ZEND_MODULE_ACTIVATE_N -#define ZEND_RSHUTDOWN ZEND_MODULE_DEACTIVATE_N -#define ZEND_MINFO ZEND_MODULE_INFO_N - -#define ZEND_MINIT_FUNCTION ZEND_MODULE_STARTUP_D -#define ZEND_MSHUTDOWN_FUNCTION ZEND_MODULE_SHUTDOWN_D -#define ZEND_RINIT_FUNCTION ZEND_MODULE_ACTIVATE_D -#define ZEND_RSHUTDOWN_FUNCTION ZEND_MODULE_DEACTIVATE_D -#define ZEND_MINFO_FUNCTION ZEND_MODULE_INFO_D - -END_EXTERN_C() - -#endif /* ZEND_API_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c deleted file mode 100644 index 9df3fe7888..0000000000 --- a/Zend/zend_alloc.c +++ /dev/null @@ -1,787 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_alloc.h" -#include "zend_globals.h" -#include "zend_fast_cache.h" -#ifdef HAVE_SIGNAL_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif - -#include "zend_mm.h" - -#ifndef ZTS -ZEND_API zend_alloc_globals alloc_globals; -#endif - - -#ifdef ZEND_MM -#define ZEND_DISABLE_MEMORY_CACHE 1 -#else -#define ZEND_DISABLE_MEMORY_CACHE 0 -#endif - -#ifdef ZEND_MM -#define ZEND_DO_MALLOC(size) zend_mm_alloc(&AG(mm_heap), size) -#define ZEND_DO_FREE(ptr) zend_mm_free(&AG(mm_heap), ptr) -#define ZEND_DO_REALLOC(ptr, size) zend_mm_realloc(&AG(mm_heap), ptr, size) -#elif defined(ZEND_WIN32) -#define ZEND_DO_MALLOC(size) (AG(memory_heap) ? HeapAlloc(AG(memory_heap), HEAP_NO_SERIALIZE, size) : malloc(size)) -#define ZEND_DO_FREE(ptr) (AG(memory_heap) ? HeapFree(AG(memory_heap), HEAP_NO_SERIALIZE, ptr) : free(ptr)) -#define ZEND_DO_REALLOC(ptr, size) (AG(memory_heap) ? HeapReAlloc(AG(memory_heap), HEAP_NO_SERIALIZE, ptr, size) : realloc(ptr, size)) -#else -#define ZEND_DO_MALLOC(size) malloc(size) -#define ZEND_DO_FREE(ptr) free(ptr) -#define ZEND_DO_REALLOC(ptr, size) realloc(ptr, size) -#endif - -#if ZEND_DEBUG -# define END_MAGIC_SIZE sizeof(long) -static long mem_block_end_magic = MEM_BLOCK_END_MAGIC; -#else -# define END_MAGIC_SIZE 0 -#endif - - -# if MEMORY_LIMIT -# if ZEND_DEBUG -#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, __zend_filename, __zend_lineno) -# else -#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, NULL, 0) -# endif - -#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\ - if (AG(memory_limit) AG(allocated_memory) - rs) { \ - AG(memory_limit) = AG(allocated_memory) + 1048576; \ - if (file) { \ - 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) { \ - fprintf(stderr, "Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)\n", php_mem_limit, file, lineno, s); \ - } else { \ - fprintf(stderr, "Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)\n", php_mem_limit, s); \ - } \ - exit(1); \ - } \ - } \ - } -# endif - -#ifndef CHECK_MEMORY_LIMIT -#define CHECK_MEMORY_LIMIT(s, rs) -#endif - - -#define REMOVE_POINTER_FROM_LIST(p) \ - if (p==AG(head)) { \ - AG(head) = p->pNext; \ - } else { \ - p->pLast->pNext = p->pNext; \ - } \ - if (p->pNext) { \ - p->pNext->pLast = p->pLast; \ - } - -#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; - -#define DECLARE_CACHE_VARS() \ - unsigned int real_size; \ - unsigned int cache_index - -#define REAL_SIZE(size) ((size+7) & ~0x7) - -#define CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size) \ - real_size = REAL_SIZE(size); \ - cache_index = real_size >> 3; - -#define SIZE real_size - -#define CACHE_INDEX cache_index - -ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - zend_mem_header *p; - DECLARE_CACHE_VARS(); - TSRMLS_FETCH(); - - CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size); - - if (!ZEND_DISABLE_MEMORY_CACHE && (CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] > 0)) { - p = AG(cache)[CACHE_INDEX][--AG(cache_count)[CACHE_INDEX]]; -#if ZEND_DEBUG - p->filename = __zend_filename; - p->lineno = __zend_lineno; - p->orig_filename = __zend_orig_filename; - p->orig_lineno = __zend_orig_lineno; - p->magic = MEM_BLOCK_START_MAGIC; - p->reported = 0; - /* Setting the thread id should not be necessary, because we fetched this block - * from this thread's cache - */ - AG(cache_stats)[CACHE_INDEX][1]++; - memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long)); -#endif - p->cached = 0; - p->size = size; - return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING); - } else { -#if ZEND_DEBUG - if (CACHE_INDEXcached = 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; - p->lineno = __zend_lineno; - p->orig_filename = __zend_orig_filename; - p->orig_lineno = __zend_orig_lineno; - p->magic = MEM_BLOCK_START_MAGIC; - p->reported = 0; -# ifdef ZTS - p->thread_id = tsrm_thread_id(); -# 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); -} - -#include "zend_multiply.h" - -ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - - if (nmemb < LONG_MAX - && size < LONG_MAX - && offset < LONG_MAX - && nmemb >= 0 - && size >= 0 - && offset >= 0) { - long lval; - double dval; - int use_dval; - - ZEND_SIGNED_MULTIPLY_LONG(nmemb, size, lval, dval, use_dval); - - if (!use_dval - && lval < LONG_MAX - offset) { - return emalloc_rel(lval + offset); - } - } - - zend_error(E_ERROR, "Possible integer overflow in memory allocation (%ld * %ld + %ld)", nmemb, size, offset); - return 0; -} - - - -ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - zend_mem_header *p = (zend_mem_header *) ((char *)ptr - sizeof(zend_mem_header) - MEM_HEADER_PADDING); - DECLARE_CACHE_VARS(); - TSRMLS_FETCH(); - -#if defined(ZTS) && TSRM_DEBUG - if (p->thread_id != tsrm_thread_id()) { - tsrm_error(TSRM_ERROR_LEVEL_ERROR, "Memory block allocated at %s:(%d) on thread %x freed at %s:(%d) on thread %x, ignoring", - p->filename, p->lineno, p->thread_id, - __zend_filename, __zend_lineno, tsrm_thread_id()); - return; - } -#endif - - CALCULATE_REAL_SIZE_AND_CACHE_INDEX(p->size); -#if ZEND_DEBUG - if (!_mem_block_check(ptr, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) { - return; - } - memset(ptr, 0x5a, p->size); -#endif - - if (!ZEND_DISABLE_MEMORY_CACHE - && (CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] < MAX_CACHED_ENTRIES)) { - AG(cache)[CACHE_INDEX][AG(cache_count)[CACHE_INDEX]++] = p; - p->cached = 1; -#if ZEND_DEBUG - p->magic = MEM_BLOCK_CACHED_MAGIC; -#endif - return; - } - HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG || !defined(ZEND_MM) - REMOVE_POINTER_FROM_LIST(p); -#endif - -#if MEMORY_LIMIT - AG(allocated_memory) -= SIZE; -#endif - - ZEND_DO_FREE(p); - HANDLE_UNBLOCK_INTERRUPTIONS(); -} - - -ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - void *p; - int final_size = size*nmemb; - - HANDLE_BLOCK_INTERRUPTIONS(); - p = _emalloc(final_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - if (!p) { - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (void *) p; - } - memset(p, 0, final_size); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return p; -} - - -ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - zend_mem_header *p; - zend_mem_header *orig; - DECLARE_CACHE_VARS(); - TSRMLS_FETCH(); - - if (!ptr) { - return _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - - p = orig = (zend_mem_header *) ((char *)ptr-sizeof(zend_mem_header)-MEM_HEADER_PADDING); - -#if defined(ZTS) && TSRM_DEBUG - if (p->thread_id != tsrm_thread_id()) { - void *new_p; - - tsrm_error(TSRM_ERROR_LEVEL_ERROR, "Memory block allocated at %s:(%d) on thread %x reallocated at %s:(%d) on thread %x, duplicating", - p->filename, p->lineno, p->thread_id, - __zend_filename, __zend_lineno, tsrm_thread_id()); - new_p = _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - memcpy(new_p, ptr, p->size); - return new_p; - } -#endif - - CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size); - - HANDLE_BLOCK_INTERRUPTIONS(); -#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) { - fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size); -#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID - kill(getpid(), SIGSEGV); -#else - 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; - - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (void *)((char *)p+sizeof(zend_mem_header)+MEM_HEADER_PADDING); -} - - -ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - int length; - char *p; - - length = strlen(s)+1; - HANDLE_BLOCK_INTERRUPTIONS(); - p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - if (!p) { - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (char *)NULL; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - memcpy(p, s, length); - return p; -} - - -ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - char *p; - - HANDLE_BLOCK_INTERRUPTIONS(); - p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - if (!p) { - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (char *)NULL; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - memcpy(p, s, length); - p[length] = 0; - return p; -} - - -ZEND_API char *zend_strndup(const char *s, uint length) -{ - char *p; - - p = (char *) malloc(length+1); - if (!p) { - return (char *)NULL; - } - if (length) { - memcpy(p, s, length); - } - p[length] = 0; - return p; -} - - -ZEND_API int zend_set_memory_limit(unsigned int memory_limit) -{ -#if MEMORY_LIMIT - TSRMLS_FETCH(); - - AG(memory_limit) = memory_limit; - return SUCCESS; -#else - return FAILURE; -#endif -} - - -ZEND_API void start_memory_manager(TSRMLS_D) -{ - AG(head) = NULL; - -#if MEMORY_LIMIT - AG(memory_limit) = 1<<30; /* ridiculous limit, effectively no limit */ - AG(allocated_memory) = 0; - AG(memory_exhausted) = 0; - AG(allocated_memory_peak) = 0; -#endif - -#if ZEND_ENABLE_FAST_CACHE - memset(AG(fast_cache_list_head), 0, sizeof(AG(fast_cache_list_head))); -#endif -#if !ZEND_DISABLE_MEMORY_CACHE - memset(AG(cache_count), 0, sizeof(AG(cache_count))); -#endif - -#ifdef ZEND_MM - zend_mm_startup(&AG(mm_heap), 256*1024); -#elif defined(ZEND_WIN32) - AG(memory_heap) = HeapCreate(HEAP_NO_SERIALIZE, 256*1024, 0); -#endif - -#if ZEND_DEBUG - memset(AG(cache_stats), 0, sizeof(AG(cache_stats))); - memset(AG(fast_cache_stats), 0, sizeof(AG(fast_cache_stats))); -#endif -} - - -ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC) -{ - zend_mem_header *p, *t; - -#if ZEND_DEBUG - int had_leaks = 0; -#endif - -#if defined(ZEND_MM) && !ZEND_DEBUG - if (clean_cache) { - zend_mm_shutdown(&AG(mm_heap)); - return; - } -#elif defined(ZEND_WIN32) && !ZEND_DEBUG - if (clean_cache && AG(memory_heap)) { - HeapDestroy(AG(memory_heap)); - return; - } -#endif - -#if ZEND_ENABLE_FAST_CACHE - { - zend_fast_cache_list_entry *fast_cache_list_entry, *next_fast_cache_list_entry; - unsigned int fci; - - for (fci=0; fcinext; - efree(fast_cache_list_entry); - fast_cache_list_entry = next_fast_cache_list_entry; - } - AG(fast_cache_list_head)[fci] = NULL; - } - } -#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; isize); -#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->cached && !t->reported) { - zend_mem_header *iterator; - int total_leak=0, total_leak_count=0; - - had_leaks = 1; - if (!silent) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t); - } - t->reported = 1; - for (iterator=t->pNext; iterator; iterator=iterator->pNext) { - if (!iterator->cached - && iterator->filename==t->filename - && iterator->lineno==t->lineno) { - total_leak += iterator->size; - total_leak_count++; - iterator->reported = 1; - } - } - if (!silent && total_leak_count>0) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (total_leak_count)); - } - } -#endif -#if MEMORY_LIMIT - AG(allocated_memory) -= REAL_SIZE(t->size); -#endif - p = t->pNext; - REMOVE_POINTER_FROM_LIST(t); - ZEND_DO_FREE(t); - t = p; - } else { - t = t->pNext; - } - } - -#if MEMORY_LIMIT - AG(memory_exhausted)=0; - AG(allocated_memory_peak) = 0; -#endif - - -#if (ZEND_DEBUG) - do { - zval display_memory_cache_stats; - int i, j; - - if (clean_cache) { - /* we're shutting down completely, don't even touch the INI subsystem */ - break; - } - if (zend_get_configuration_directive("display_memory_cache_stats", sizeof("display_memory_cache_stats"), &display_memory_cache_stats)==FAILURE) { - break; - } - if (!atoi(display_memory_cache_stats.value.str.val)) { - break; - } - fprintf(stderr, "Memory cache statistics\n" - "-----------------------\n\n" - "[zval, %2ld]\t\t%d / %d (%.2f%%)\n" - "[hash, %2ld]\t\t%d / %d (%.2f%%)\n", - (long) sizeof(zval), - AG(fast_cache_stats)[ZVAL_CACHE_LIST][1], AG(fast_cache_stats)[ZVAL_CACHE_LIST][0]+AG(fast_cache_stats)[ZVAL_CACHE_LIST][1], - ((double) AG(fast_cache_stats)[ZVAL_CACHE_LIST][1] / (AG(fast_cache_stats)[ZVAL_CACHE_LIST][0]+AG(fast_cache_stats)[ZVAL_CACHE_LIST][1]))*100, - (long) sizeof(HashTable), - AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1], AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][0]+AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1], - ((double) AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1] / (AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][0]+AG(fast_cache_stats)[HASHTABLE_CACHE_LIST][1]))*100); - - - for (i=0; imagic) { - case MEM_BLOCK_START_MAGIC: - if (!silent) { - zend_debug_alloc_output("OK (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size); - } - break; /* ok */ - case MEM_BLOCK_FREED_MAGIC: - if (!silent) { - zend_debug_alloc_output("Freed\n"); - had_problems = 1; - } else { - return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - break; - case MEM_BLOCK_CACHED_MAGIC: - if (!silent) { - if (!no_cache_notice) { - zend_debug_alloc_output("Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size); - had_problems = 1; - } - } else { - if (!no_cache_notice) { - return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - } - break; - default: - if (!silent) { - zend_debug_alloc_output("Overrun (magic=0x%0.8lX, expected=0x%0.8lX)\n", p->magic, MEM_BLOCK_START_MAGIC); - } else { - return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - had_problems = 1; - valid_beginning = 0; - break; - } - - - memcpy(&end_magic, (((char *) p)+sizeof(zend_mem_header)+MEM_HEADER_PADDING+p->size), sizeof(long)); - - if (valid_beginning && (end_magic != MEM_BLOCK_END_MAGIC)) { - char *overflow_ptr, *magic_ptr=(char *) &mem_block_end_magic; - int overflows=0; - int i; - - if (silent) { - return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - had_problems = 1; - overflow_ptr = (char *) &end_magic; - - for (i=0; i=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); - } - } else if (!silent) { - zend_debug_alloc_output("%10s\t", "End:"); - if (valid_beginning) { - zend_debug_alloc_output("OK\n"); - } else { - zend_debug_alloc_output("Unknown\n"); - } - } - - if (had_problems) { - int foo = 5; - - foo += 1; - } - - if (!silent) { - zend_debug_alloc_output("---------------------------------------\n"); - } - return ((!had_problems) ? 1 : 0); -} - - -ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - zend_mem_header *p; - int errors=0; - TSRMLS_FETCH(); - - p = AG(head); - - - zend_debug_alloc_output("------------------------------------------------\n"); - zend_debug_alloc_output("Full Memory Check at %s:%d\n" ZEND_FILE_LINE_RELAY_CC); - - while (p) { - if (!_mem_block_check((void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING), (silent?2:3) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) { - errors++; - } - p = p->pNext; - } - zend_debug_alloc_output("End of full memory check %s:%d (%d errors)\n" ZEND_FILE_LINE_RELAY_CC, errors); - zend_debug_alloc_output("------------------------------------------------\n"); -} -#endif - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h deleted file mode 100644 index dff79a8948..0000000000 --- a/Zend/zend_alloc.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_ALLOC_H -#define ZEND_ALLOC_H - -#include - -#include "../TSRM/TSRM.h" -#include "zend_globals_macros.h" - -#include "zend_mm.h" - -#define MEM_BLOCK_START_MAGIC 0x7312F8DCL -#define MEM_BLOCK_END_MAGIC 0x2A8FCC84L -#define MEM_BLOCK_FREED_MAGIC 0x99954317L -#define MEM_BLOCK_CACHED_MAGIC 0xFB8277DCL - -typedef struct _zend_mem_header { -#if ZEND_DEBUG - long magic; - char *filename; - uint lineno; - int reported; - char *orig_filename; - uint orig_lineno; -# ifdef ZTS - THREAD_T thread_id; -# endif -#endif -#if ZEND_DEBUG || !defined(ZEND_MM) - struct _zend_mem_header *pNext; - struct _zend_mem_header *pLast; -#endif - unsigned int size:31; - unsigned int cached:1; -} zend_mem_header; - -typedef union _align_test { - void *ptr; - double dbl; - long lng; -} align_test; - -#define MAX_CACHED_MEMORY 11 -#define MAX_CACHED_ENTRIES 256 -#define PRE_INIT_CACHE_ENTRIES 32 - -#if (defined (__GNUC__) && __GNUC__ >= 2) -#define PLATFORM_ALIGNMENT (__alignof__ (align_test)) -#else -#define PLATFORM_ALIGNMENT (sizeof(align_test)) -#endif - -#define MEM_HEADER_PADDING (((PLATFORM_ALIGNMENT-sizeof(zend_mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT) - - -BEGIN_EXTERN_C() - -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_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_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_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) -#define safe_emalloc(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define ecalloc(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define erealloc(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define erealloc_recoverable(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) - -/* Relay wrapper macros */ -#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define safe_emalloc_rel(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define efree_rel(ptr) _efree((ptr) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define ecalloc_rel(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define erealloc_rel(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) - -/* Selective persistent/non persistent allocation macros */ -#define pemalloc(size, persistent) ((persistent)?malloc(size):emalloc(size)) -#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr)) -#define pecalloc(nmemb, size, persistent) ((persistent)?calloc((nmemb), (size)):ecalloc((nmemb), (size))) -#define perealloc(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc((ptr), (size))) -#define perealloc_recoverable(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable((ptr), (size))) -#define pestrdup(s, persistent) ((persistent)?strdup(s):estrdup(s)) - -#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string)) -#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string)) - -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 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); -ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -void zend_debug_alloc_output(char *format, ...); -#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#else -#define mem_block_check(type, ptr, silent) -#define full_mem_check(silent) -#endif - - -END_EXTERN_C() - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c deleted file mode 100644 index 69921a1d60..0000000000 --- a/Zend/zend_builtin_functions.c +++ /dev/null @@ -1,1803 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_API.h" -#include "zend_builtin_functions.h" -#include "zend_constants.h" -#include "zend_ini.h" - -#undef ZEND_TEST_EXCEPTIONS - -static ZEND_FUNCTION(zend_version); -static ZEND_FUNCTION(func_num_args); -static ZEND_FUNCTION(func_get_arg); -static ZEND_FUNCTION(func_get_args); -static ZEND_NAMED_FUNCTION(zend_if_strlen); -static ZEND_FUNCTION(strcmp); -static ZEND_FUNCTION(strncmp); -static ZEND_FUNCTION(strcasecmp); -static ZEND_FUNCTION(strncasecmp); -static ZEND_FUNCTION(each); -static ZEND_FUNCTION(error_reporting); -static ZEND_FUNCTION(define); -static ZEND_FUNCTION(defined); -static ZEND_FUNCTION(get_class); -static ZEND_FUNCTION(get_parent_class); -static ZEND_FUNCTION(method_exists); -static ZEND_FUNCTION(class_exists); -static ZEND_FUNCTION(function_exists); -#if ZEND_DEBUG -static ZEND_FUNCTION(leak); -#ifdef ZEND_TEST_EXCEPTIONS -static ZEND_FUNCTION(crash); -#endif -#endif -static ZEND_FUNCTION(get_included_files); -static ZEND_FUNCTION(is_subclass_of); -static ZEND_FUNCTION(is_a); -static ZEND_FUNCTION(get_class_vars); -static ZEND_FUNCTION(get_object_vars); -static ZEND_FUNCTION(get_class_methods); -static ZEND_FUNCTION(trigger_error); -static ZEND_FUNCTION(set_error_handler); -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_defined_functions); -static ZEND_FUNCTION(get_defined_vars); -static ZEND_FUNCTION(create_function); -static ZEND_FUNCTION(get_resource_type); -static ZEND_FUNCTION(get_loaded_extensions); -static ZEND_FUNCTION(extension_loaded); -static ZEND_FUNCTION(get_extension_funcs); -static ZEND_FUNCTION(get_defined_constants); -static ZEND_FUNCTION(debug_backtrace); -static ZEND_FUNCTION(debug_print_backtrace); -#if ZEND_DEBUG -static ZEND_FUNCTION(zend_test_func); -#ifdef ZTS -static ZEND_FUNCTION(zend_thread_id); -#endif -#endif - -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) - ZEND_FE(func_num_args, NULL) - ZEND_FE(func_get_arg, NULL) - ZEND_FE(func_get_args, NULL) - { "strlen", zend_if_strlen, NULL }, - ZEND_FE(strcmp, NULL) - ZEND_FE(strncmp, NULL) - ZEND_FE(strcasecmp, NULL) - ZEND_FE(strncasecmp, NULL) - ZEND_FE(each, first_arg_force_ref) - ZEND_FE(error_reporting, NULL) - ZEND_FE(define, NULL) - ZEND_FE(defined, NULL) - ZEND_FE(get_class, NULL) - ZEND_FE(get_parent_class, NULL) - ZEND_FE(method_exists, NULL) - ZEND_FE(class_exists, NULL) - ZEND_FE(function_exists, NULL) -#if ZEND_DEBUG - ZEND_FE(leak, NULL) -#ifdef ZEND_TEST_EXCEPTIONS - ZEND_FE(crash, NULL) -#endif -#endif - ZEND_FE(get_included_files, NULL) - ZEND_FALIAS(get_required_files, get_included_files, NULL) - ZEND_FE(is_subclass_of, NULL) - ZEND_FE(is_a, NULL) - ZEND_FE(get_class_vars, NULL) - ZEND_FE(get_object_vars, NULL) - ZEND_FE(get_class_methods, NULL) - ZEND_FE(trigger_error, NULL) - ZEND_FALIAS(user_error, trigger_error, NULL) - ZEND_FE(set_error_handler, NULL) - ZEND_FE(restore_error_handler, NULL) - ZEND_FE(set_exception_handler, NULL) - ZEND_FE(restore_exception_handler, NULL) - ZEND_FE(get_declared_classes, NULL) - ZEND_FE(get_defined_functions, NULL) - ZEND_FE(get_defined_vars, NULL) - ZEND_FE(create_function, NULL) - ZEND_FE(get_resource_type, NULL) - ZEND_FE(get_loaded_extensions, NULL) - ZEND_FE(extension_loaded, NULL) - ZEND_FE(get_extension_funcs, NULL) - ZEND_FE(get_defined_constants, NULL) - ZEND_FE(debug_backtrace, NULL) - ZEND_FE(debug_print_backtrace, NULL) -#if ZEND_DEBUG - ZEND_FE(zend_test_func, NULL) -#ifdef ZTS - ZEND_FE(zend_thread_id, NULL) -#endif -#endif - { NULL, NULL, NULL } -}; - - -int zend_startup_builtin_functions(TSRMLS_D) -{ - return zend_register_functions(NULL, builtin_functions, NULL, MODULE_PERSISTENT TSRMLS_CC); -} - - -/* {{{ proto string zend_version(void) - Get the version of the Zend Engine */ -ZEND_FUNCTION(zend_version) -{ - RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1, 1); -} -/* }}} */ - - -/* {{{ proto int func_num_args(void) - Get the number of arguments that were passed to the function */ -ZEND_FUNCTION(func_num_args) -{ - void **p; - int arg_count; - - p = EG(argument_stack).top_element-1-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_num_args(); */ - p -= 1+arg_count; - if (*p) { - zend_error(E_ERROR, "func_num_args(): Can't be used as a function parameter"); - } - --p; - if (p>=EG(argument_stack).elements) { - RETURN_LONG((ulong) *p); - } else { - zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context"); - RETURN_LONG(-1); - } -} -/* }}} */ - - -/* {{{ proto mixed func_get_arg(int arg_num) - Get the $arg_num'th argument that was passed to the function */ -ZEND_FUNCTION(func_get_arg) -{ - void **p; - int arg_count; - zval **z_requested_offset; - zval *arg; - long requested_offset; - - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_requested_offset)==FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(z_requested_offset); - requested_offset = (*z_requested_offset)->value.lval; - - if (requested_offset < 0) { - zend_error(E_WARNING, "func_get_arg(): The argument number should be >= 0"); - RETURN_FALSE; - } - - p = EG(argument_stack).top_element-1-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_arg(); */ - p -= 1+arg_count; - if (*p) { - zend_error(E_ERROR, "func_get_arg(): Can't be used as a function parameter"); - } - --p; - if (p=arg_count) { - zend_error(E_WARNING, "func_get_arg(): Argument %d not passed to function", requested_offset); - RETURN_FALSE; - } - - arg = *(p-(arg_count-requested_offset)); - *return_value = *arg; - zval_copy_ctor(return_value); -} -/* }}} */ - - -/* {{{ proto array func_get_args() - Get an array of the arguments that were passed to the function */ -ZEND_FUNCTION(func_get_args) -{ - void **p; - int arg_count; - int i; - - p = EG(argument_stack).top_element-1-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_args(); */ - p -= 1+arg_count; - if (*p) { - zend_error(E_ERROR, "func_get_args(): Can't be used as a function parameter"); - } - --p; - - if (pvalue.ht, &element, sizeof(zval *), NULL); - } -} -/* }}} */ - - -/* {{{ proto int strlen(string str) - Get string length */ -ZEND_NAMED_FUNCTION(zend_if_strlen) -{ - zval **str; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_string_ex(str); - RETVAL_LONG((*str)->value.str.len); -} -/* }}} */ - - -/* {{{ proto int strcmp(string str1, string str2) - Binary safe string comparison */ -ZEND_FUNCTION(strcmp) -{ - zval **s1, **s2; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_string_ex(s1); - convert_to_string_ex(s2); - RETURN_LONG(zend_binary_zval_strcmp(*s1, *s2)); -} -/* }}} */ - - -/* {{{ proto int strncmp(string str1, string str2, int len) - Binary safe string comparison */ -ZEND_FUNCTION(strncmp) -{ - zval **s1, **s2, **s3; - - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &s1, &s2, &s3) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_string_ex(s1); - convert_to_string_ex(s2); - convert_to_long_ex(s3); - RETURN_LONG(zend_binary_zval_strncmp(*s1, *s2, *s3)); -} -/* }}} */ - - -/* {{{ proto int strcasecmp(string str1, string str2) - Binary safe case-insensitive string comparison */ -ZEND_FUNCTION(strcasecmp) -{ - zval **s1, **s2; - - if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_string_ex(s1); - convert_to_string_ex(s2); - RETURN_LONG(zend_binary_zval_strcasecmp(*s1, *s2)); -} -/* }}} */ - - -/* {{{ proto int strncasecmp(string str1, string str2, int len) - Binary safe string comparison */ -ZEND_FUNCTION(strncasecmp) -{ - zval **s1, **s2, **s3; - - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &s1, &s2, &s3) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_string_ex(s1); - convert_to_string_ex(s2); - convert_to_long_ex(s3); - RETURN_LONG(zend_binary_zval_strncasecmp(*s1, *s2, *s3)); -} -/* }}} */ - - -/* {{{ proto array each(array arr) - Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */ -ZEND_FUNCTION(each) -{ - zval **array, *entry, **entry_ptr, *tmp; - char *string_key; - ulong num_key; - zval **inserted_pointer; - HashTable *target_hash; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - target_hash = HASH_OF(*array); - if (!target_hash) { - zend_error(E_WARNING,"Variable passed to each() is not an array or object"); - return; - } - if (zend_hash_get_current_data(target_hash, (void **) &entry_ptr)==FAILURE) { - RETURN_FALSE; - } - array_init(return_value); - entry = *entry_ptr; - - /* add value elements */ - if (entry->is_ref) { - ALLOC_ZVAL(tmp); - *tmp = *entry; - zval_copy_ctor(tmp); - tmp->is_ref=0; - tmp->refcount=0; - entry=tmp; - } - zend_hash_index_update(return_value->value.ht, 1, &entry, sizeof(zval *), NULL); - entry->refcount++; - zend_hash_update(return_value->value.ht, "value", sizeof("value"), &entry, sizeof(zval *), NULL); - entry->refcount++; - - /* add the key elements */ - switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 1)) { - case HASH_KEY_IS_STRING: - 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); - break; - } - zend_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL); - (*inserted_pointer)->refcount++; - zend_hash_move_forward(target_hash); -} -/* }}} */ - - -/* {{{ proto int error_reporting(int new_error_level=null) - Return the current error_reporting level, and if an argument was passed - change to the new level */ -ZEND_FUNCTION(error_reporting) -{ - zval **arg; - int old_error_reporting; - - old_error_reporting = EG(error_reporting); - switch (ZEND_NUM_ARGS()) { - case 0: - break; - case 1: - if (zend_get_parameters_ex(1, &arg) == FAILURE) { - RETURN_FALSE; - } - convert_to_string_ex(arg); - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - break; - default: - ZEND_WRONG_PARAM_COUNT(); - break; - } - - RETVAL_LONG(old_error_reporting); -} -/* }}} */ - - -/* {{{ proto bool define(string constant_name, mixed value, case_sensitive=true) - Define a new constant */ -ZEND_FUNCTION(define) -{ - zval **var, **val, **non_cs; - int case_sensitive; - zend_constant c; - - switch (ZEND_NUM_ARGS()) { - case 2: - if (zend_get_parameters_ex(2, &var, &val)==FAILURE) { - RETURN_FALSE; - } - case_sensitive = CONST_CS; - break; - case 3: - if (zend_get_parameters_ex(3, &var, &val, &non_cs)==FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(non_cs); - if ((*non_cs)->value.lval) { - case_sensitive = 0; - } else { - case_sensitive = CONST_CS; - } - break; - default: - ZEND_WRONG_PARAM_COUNT(); - break; - } - - switch ((*val)->type) { - case IS_LONG: - case IS_DOUBLE: - case IS_STRING: - case IS_BOOL: - case IS_RESOURCE: - case IS_NULL: - break; - default: - zend_error(E_WARNING,"Constants may only evaluate to scalar values"); - RETURN_FALSE; - break; - } - convert_to_string_ex(var); - - c.value = **val; - zval_copy_ctor(&c.value); - 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; - if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ - - -/* {{{ proto bool defined(string constant_name) - Check whether a constant exists */ -ZEND_FUNCTION(defined) -{ - zval **var; - zval c; - - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &var)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - convert_to_string_ex(var); - if (zend_get_constant((*var)->value.str.val, (*var)->value.str.len, &c TSRMLS_CC)) { - zval_dtor(&c); - RETURN_LONG(1); - } else { - RETURN_LONG(0); - } -} -/* }}} */ - - -/* {{{ proto string get_class(object object) - Retrieves the class name */ -ZEND_FUNCTION(get_class) -{ - zval **arg; - char *name = ""; - zend_uint name_len = 0; - - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - if (Z_TYPE_PP(arg) != IS_OBJECT) { - RETURN_FALSE; - } - - if (Z_OBJ_HT_PP(arg)->get_class_name == NULL || - Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_len, 0 TSRMLS_CC) != SUCCESS) { - zend_class_entry *ce; - - ce = zend_get_class_entry(*arg TSRMLS_CC); - if (!ce) { - RETURN_FALSE; - } - - if(ce->ns) { - zend_make_full_classname(ce, &name, &name_len); - RETURN_STRINGL(name, name_len, 0); - } else { - RETURN_STRINGL(ce->name, ce->name_length, 1); - } - } - - RETURN_STRINGL(name, name_len, 0); -} -/* }}} */ - - -/* {{{ proto string get_parent_class(mixed object) - Retrieves the parent class name for object or class. */ -ZEND_FUNCTION(get_parent_class) -{ - zval **arg; - zend_class_entry *ce = NULL; - char *name; - zend_uint name_length; - - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - 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))) { - zend_make_full_classname(ce, &name, &name_length); - RETURN_STRINGL(name, name_length, 0); - } else { - 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_ns_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &pce TSRMLS_CC) == SUCCESS) { - ce = *pce; - } - } - - if (ce && ce->parent) { - zend_make_full_classname(ce->parent, &name, &name_length); - RETURN_STRINGL(name, name_length, 0); - } else { - RETURN_FALSE; - } -} -/* }}} */ - - -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; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &obj, &class_name)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - if (Z_TYPE_PP(obj) != IS_OBJECT) { - RETURN_FALSE; - } - - /* TBI!! new object handlers */ - if (!HAS_CLASS_ENTRY(**obj)) { - RETURN_FALSE; - } - - convert_to_string_ex(class_name); - - lcname = estrndup(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name)); - zend_str_tolower(lcname, Z_STRLEN_PP(class_name)); - - if (zend_lookup_ns_class(lcname, Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == FAILURE) { - efree(lcname); - retval = 0; - } else { - if (only_subclass) { - instance_ce = Z_OBJCE_PP(obj)->parent; - } else { - instance_ce = Z_OBJCE_PP(obj); - } - - if (instanceof_function(instance_ce, *ce TSRMLS_CC)) { - retval = 1; - } else { - retval = 0; - } - } - - efree(lcname); - - RETURN_BOOL(retval); -} - - -/* {{{ proto bool is_subclass_of(object object, string class_name) - Returns true if the object has this class as one of its parents */ -ZEND_FUNCTION(is_subclass_of) -{ - is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - - -/* {{{ proto bool is_a(object object, string class_name) - Returns true if the object is of this class or has this class as one of its parents */ -ZEND_FUNCTION(is_a) -{ - is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - - -/* {{{ proto array get_class_vars(string class_name) - Returns an array of default properties of the class */ -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); - lcname = estrndup((*class_name)->value.str.val, (*class_name)->value.str.len); - zend_str_tolower(lcname, (*class_name)->value.str.len); - - if (zend_lookup_ns_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 (!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 *)); - } -} -/* }}} */ - - -/* {{{ proto array get_object_vars(object obj) - Returns an array of object properties */ -ZEND_FUNCTION(get_object_vars) -{ - zval **obj; - zval *tmp; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &obj) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - if ((*obj)->type != IS_OBJECT) { - RETURN_FALSE; - } - if (Z_OBJ_HT_PP(obj)->get_properties == NULL) { - RETURN_FALSE; - } - - array_init(return_value); - 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 *)); -} -/* }}} */ - - -/* {{{ proto array get_class_methods(mixed class) - Returns an array of method names for class or class instance. */ -ZEND_FUNCTION(get_class_methods) -{ - zval **class; - zval *method_name; - zend_class_entry *ce = NULL, **pce; - 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(); - } - - if (Z_TYPE_PP(class) == IS_OBJECT) { - /* TBI!! new object handlers */ - if (!HAS_CLASS_ENTRY(**class)) { - RETURN_FALSE; - } - 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_ns_class(Z_STRVAL_PP(class), Z_STRLEN_PP(class), &pce TSRMLS_CC) == SUCCESS) { - ce = *pce; - } - } - - if (!ce) { - RETURN_NULL(); - } - - array_init(return_value); - 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) - Checks if the class method exists */ -ZEND_FUNCTION(method_exists) -{ - zval **klass, **method_name; - char *lcname; - - if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - if ((*klass)->type != IS_OBJECT) { - RETURN_FALSE; - } - - /* TBI!! new object handlers */ - if (!HAS_CLASS_ENTRY(**klass)) { - RETURN_FALSE; - } - - convert_to_string_ex(method_name); - lcname = estrndup((*method_name)->value.str.val, (*method_name)->value.str.len); - zend_str_tolower(lcname, (*method_name)->value.str.len); - if (zend_hash_exists(&Z_OBJCE_PP(klass)->function_table, lcname, (*method_name)->value.str.len+1)) { - efree(lcname); - RETURN_TRUE; - } else { - efree(lcname); - RETURN_FALSE; - } -} -/* }}} */ - -static inline zend_namespace *get_namespace_from_zval(zval **namespace_name TSRMLS_DC) -{ - zend_namespace **pns; - char *str_ns_name; - - convert_to_string_ex(namespace_name); - if(!Z_STRVAL_PP(namespace_name) || !Z_STRLEN_PP(namespace_name)) { - return EG(global_namespace_ptr); - } - - str_ns_name = estrndup(Z_STRVAL_PP(namespace_name), Z_STRLEN_PP(namespace_name)); - zend_str_tolower(str_ns_name, Z_STRLEN_PP(namespace_name)); - if(zend_hash_find(&EG(global_namespace_ptr)->class_table, str_ns_name, Z_STRLEN_PP(namespace_name)+1, (void **)&pns) == FAILURE || !CLASS_IS_NAMESPACE((*pns))) { - zend_error(E_WARNING, "Namespace '%s' is not defined!", Z_STRVAL_PP(namespace_name)); - efree(str_ns_name); - return NULL; - } - - efree(str_ns_name); - return *pns; -} - -/* {{{ proto bool class_exists(string classname) - Checks if the class exists */ -ZEND_FUNCTION(class_exists) -{ - zval **class_name; - char *lcname; - zend_class_entry **ce; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - convert_to_string_ex(class_name); - lcname = estrndup((*class_name)->value.str.val, (*class_name)->value.str.len); - zend_str_tolower(lcname, (*class_name)->value.str.len); - if (zend_lookup_ns_class(lcname, Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == SUCCESS) { - efree(lcname); - RETURN_TRUE; - } else { - efree(lcname); - RETURN_FALSE; - } -} -/* }}} */ - - -/* {{{ proto bool function_exists(string function_name) - Checks if the function exists */ -ZEND_FUNCTION(function_exists) -{ - zval **function_name; - zend_function *func; - char *lcname, *func_name, *func_name_end; - zend_bool retval; - - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_string_ex(function_name); - lcname = estrndup((*function_name)->value.str.val, (*function_name)->value.str.len); - zend_str_tolower(lcname, (*function_name)->value.str.len); - - func_name_end = lcname + (*function_name)->value.str.len; - if((func_name = zend_memnstr(lcname, "::", sizeof("::")-1, func_name_end)) == NULL) { - retval = (zend_hash_find(EG(function_table), lcname, (*function_name)->value.str.len+1, (void **)&func) == SUCCESS); - } else { - /* handle ::f case */ - if (func_name == lcname) { - retval = (zend_hash_find(EG(function_table), lcname+sizeof("::")-1, (*function_name)->value.str.len-(sizeof("::")-1)+1, (void **)&func) == SUCCESS); - } else { - /* handle ns::f case */ - int ns_name_length = func_name - lcname; - char *ns_name; - zend_namespace **ns; - - func_name += sizeof("::")-1; - - if(func_name >= func_name_end) { - /* ns:: case */ - retval = 0; - } else { - ns_name = estrndup(lcname, ns_name_length); - - if (zend_hash_find(&EG(global_namespace_ptr)->class_table, ns_name, ns_name_length+1, (void **)&ns) == SUCCESS && - CLASS_IS_NAMESPACE(*ns) && - zend_hash_find(&(*ns)->function_table, func_name, func_name_end - func_name + 1, (void **)&func) == SUCCESS) { - retval = 1; - } else { - retval = 0; - } - efree(ns_name); - } - } - } - efree(lcname); - - /* - * A bit of a hack, but not a bad one: we see if the handler of the function - * is actually one that displays "function is disabled" message. - */ - if (retval && func->type == ZEND_INTERNAL_FUNCTION && - func->internal_function.handler == zif_display_disabled_function) { - retval = 0; - } - - RETURN_BOOL(retval); -} -/* }}} */ - -#if ZEND_DEBUG -/* {{{ proto void leak(int num_bytes=3) - Cause an intentional memory leak, for testing/debugging purposes */ -ZEND_FUNCTION(leak) -{ - int leakbytes=3; - zval **leak; - - if (ZEND_NUM_ARGS()>=1) { - if (zend_get_parameters_ex(1, &leak)==SUCCESS) { - convert_to_long_ex(leak); - leakbytes = (*leak)->value.lval; - } - } - - emalloc(leakbytes); -} -/* }}} */ - - -#ifdef ZEND_TEST_EXCEPTIONS -ZEND_FUNCTION(crash) -{ - char *nowhere=NULL; - - memcpy(nowhere, "something", sizeof("something")); -} -#endif - -#endif /* ZEND_DEBUG */ - -/* {{{ proto array get_included_files(void) - Returns an array with the file names that were include_once()'d */ -ZEND_FUNCTION(get_included_files) -{ - char *entry; - if (ZEND_NUM_ARGS() != 0) { - ZEND_WRONG_PARAM_COUNT(); - } - - array_init(return_value); - zend_hash_internal_pointer_reset(&EG(included_files)); - while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 1) == HASH_KEY_IS_STRING) { - add_next_index_string(return_value, entry, 0); - zend_hash_move_forward(&EG(included_files)); - } -} -/* }}} */ - - -/* {{{ proto void trigger_error(string messsage [, int error_type]) - Generates a user-level error/warning/notice message */ -ZEND_FUNCTION(trigger_error) -{ - int error_type = E_USER_NOTICE; - zval **z_error_type, **z_error_message; - - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1, &z_error_message)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - break; - case 2: - if (zend_get_parameters_ex(2, &z_error_message, &z_error_type)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_long_ex(z_error_type); - error_type = (*z_error_type)->value.lval; - switch (error_type) { - case E_USER_ERROR: - case E_USER_WARNING: - case E_USER_NOTICE: - break; - default: - zend_error(E_WARNING, "Invalid error type specified"); - RETURN_FALSE; - break; - } - break; - default: - ZEND_WRONG_PARAM_COUNT(); - } - convert_to_string_ex(z_error_message); - zend_error(error_type, "%s", (*z_error_message)->value.str.val); - RETURN_TRUE; -} -/* }}} */ - - -/* {{{ 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; - zend_bool had_orig_error_handler=0; - char *error_handler_name = NULL; - - 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)) { - 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); - return; - } - efree(error_handler_name); - - if (EG(user_error_handler)) { - had_orig_error_handler = 1; - *return_value = *EG(user_error_handler); - zval_copy_ctor(return_value); - zend_ptr_stack_push(&EG(user_error_handlers), EG(user_error_handler)); - } - ALLOC_ZVAL(EG(user_error_handler)); - - if (Z_STRLEN_PP(error_handler)==0) { /* unset user-defined handler */ - FREE_ZVAL(EG(user_error_handler)); - EG(user_error_handler) = NULL; - RETURN_TRUE; - } - - *EG(user_error_handler) = **error_handler; - zval_copy_ctor(EG(user_error_handler)); - - if (!had_orig_error_handler) { - RETURN_NULL(); - } -} -/* }}} */ - - -/* {{{ proto void restore_error_handler(void) - Restores the previously defined error handler function */ -ZEND_FUNCTION(restore_error_handler) -{ - if (EG(user_error_handler)) { - 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) = zend_ptr_stack_pop(&EG(user_error_handlers)); - } - RETURN_TRUE; -} -/* }}} */ - - -/* {{{ 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; - zend_bool had_orig_exception_handler=0; - - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &exception_handler)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - convert_to_string_ex(exception_handler); - if (EG(user_exception_handler)) { - had_orig_exception_handler = 1; - *return_value = *EG(user_exception_handler); - zval_copy_ctor(return_value); - zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler)); - } - ALLOC_ZVAL(EG(user_exception_handler)); - - if (Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */ - FREE_ZVAL(EG(user_exception_handler)); - EG(user_exception_handler) = NULL; - RETURN_TRUE; - } - - *EG(user_exception_handler) = **exception_handler; - zval_copy_ctor(EG(user_exception_handler)); - - if (!had_orig_exception_handler) { - RETURN_NULL(); - } -} -/* }}} */ - - -/* {{{ proto void restore_exception_handler(void) - Restores the previously defined exception handler function */ -ZEND_FUNCTION(restore_exception_handler) -{ - if (EG(user_exception_handler)) { - zval_ptr_dtor(&EG(user_exception_handler)); - } - if (zend_ptr_stack_num_elements(&EG(user_exception_handlers))==0) { - EG(user_exception_handler) = NULL; - } else { - EG(user_exception_handler) = zend_ptr_stack_pop(&EG(user_exception_handlers)); - } - RETURN_TRUE; -} -/* }}} */ - - -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 *); - zend_class_entry *ce = *pce; - - if (hash_key->nKeyLength==0 || hash_key->arKey[0]!=0) { - if (ce->type == ZEND_USER_NAMESPACE || ce->type == ZEND_INTERNAL_NAMESPACE) { - zval *subarray; - - MAKE_STD_ZVAL(subarray); - array_init(subarray); - zend_hash_apply_with_arguments(&ce->class_table, (apply_func_args_t) copy_class_name, 1, subarray); - add_assoc_zval(array, ce->name, subarray); - } else { - add_next_index_stringl(array, ce->name, ce->name_length, 1); - } - } - return 0; -} - - -/* {{{ proto array get_declared_classes([string namespace]) - Returns an array of all declared classes. */ -ZEND_FUNCTION(get_declared_classes) -{ - zval **namespace_name; - zend_namespace *ns; - - if (ZEND_NUM_ARGS() != 0) { - if(ZEND_NUM_ARGS() > 1 || zend_get_parameters_ex(1, &namespace_name)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - ns = get_namespace_from_zval(namespace_name TSRMLS_CC); - - if(!ns) { - RETURN_FALSE; - } - } else { - ns = EG(global_namespace_ptr); - } - - array_init(return_value); - zend_hash_apply_with_arguments(&ns->class_table, (apply_func_args_t) copy_class_name, 1, return_value); -} -/* }}} */ - - -static int copy_function_name(zend_function *func, int num_args, va_list args, zend_hash_key *hash_key) -{ - zval *internal_ar = va_arg(args, zval *), - *user_ar = va_arg(args, zval *); - - if (hash_key->nKeyLength == 0 || hash_key->arKey[0] == 0) { - return 0; - } - - if (func->type == ZEND_INTERNAL_FUNCTION) { - add_next_index_stringl(internal_ar, hash_key->arKey, hash_key->nKeyLength-1, 1); - } else if (func->type == ZEND_USER_FUNCTION) { - add_next_index_stringl(user_ar, hash_key->arKey, hash_key->nKeyLength-1, 1); - } - - return 0; -} - - -/* {{{ proto array get_defined_functions(void) - Returns an array of all defined functions */ -ZEND_FUNCTION(get_defined_functions) -{ - zval *internal; - zval *user; - - if (ZEND_NUM_ARGS() != 0) { - ZEND_WRONG_PARAM_COUNT(); - } - - MAKE_STD_ZVAL(internal); - MAKE_STD_ZVAL(user); - - array_init(internal); - array_init(user); - array_init(return_value); - - zend_hash_apply_with_arguments(EG(function_table), (apply_func_args_t) copy_function_name, 2, internal, user); - - if (zend_hash_add(return_value->value.ht, "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) { - zend_error(E_WARNING, "Cannot add internal functions to return value from get_defined_functions()"); - RETURN_FALSE; - } - - if (zend_hash_add(return_value->value.ht, "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) { - zend_error(E_WARNING, "Cannot add user functions to return value from get_defined_functions()"); - RETURN_FALSE; - } -} -/* }}} */ - - -/* {{{ proto array get_defined_vars(void) - Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */ -ZEND_FUNCTION(get_defined_vars) -{ - zval *tmp; - - array_init(return_value); - - zend_hash_copy(return_value->value.ht, EG(active_symbol_table), - (copy_ctor_func_t)zval_add_ref, &tmp, sizeof(zval *)); -} -/* }}} */ - - -#define LAMBDA_TEMP_FUNCNAME "__lambda_func" -/* {{{ proto string create_function(string args, string code) - Creates an anonymous function, and returns its name (funny, eh?) */ -ZEND_FUNCTION(create_function) -{ - char *eval_code, *function_name; - int eval_code_length, function_name_length; - zval **z_function_args, **z_function_code; - int retval; - char *eval_name; - - if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &z_function_args, &z_function_code)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - convert_to_string_ex(z_function_args); - convert_to_string_ex(z_function_code); - - eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME) - +Z_STRLEN_PP(z_function_args) - +2 /* for the args parentheses */ - +2 /* for the curly braces */ - +Z_STRLEN_PP(z_function_code); - - eval_code = (char *) emalloc(eval_code_length); - sprintf(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(%s){%s}", Z_STRVAL_PP(z_function_args), Z_STRVAL_PP(z_function_code)); - - eval_name = zend_make_compiled_string_description("runtime-created function" TSRMLS_CC); - retval = zend_eval_string(eval_code, NULL, eval_name TSRMLS_CC); - efree(eval_code); - efree(eval_name); - - if (retval==SUCCESS) { - zend_function *func; - - if (zend_hash_find(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME), (void **) &func)==FAILURE) { - zend_error(E_ERROR, "Unexpected inconsistency in create_function()"); - RETURN_FALSE; - } - function_add_ref(func); - - function_name = (char *) emalloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG); - - do { - sprintf(function_name, "%clambda_%d", 0, ++EG(lambda_count)); - function_name_length = strlen(function_name+1)+1; - } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); - zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); - RETURN_STRINGL(function_name, function_name_length, 0); - } else { - RETURN_FALSE; - } -} -/* }}} */ - - -#if ZEND_DEBUG -ZEND_FUNCTION(zend_test_func) -{ - zval *arg1, *arg2; - - zend_get_parameters(ht, 2, &arg1, &arg2); -} - - -#ifdef ZTS -ZEND_FUNCTION(zend_thread_id) -{ - RETURN_LONG(tsrm_thread_id()); -} -#endif -#endif - -/* {{{ proto string get_resource_type(resource res) - Get the resource type name for a given resource */ -ZEND_FUNCTION(get_resource_type) -{ - char *resource_type; - zval **z_resource_type; - - if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &z_resource_type)==FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - if (Z_TYPE_PP(z_resource_type) != IS_RESOURCE) { - zend_error(E_WARNING, "Supplied argument is not a valid resource handle"); - RETURN_FALSE; - } - - resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(z_resource_type) TSRMLS_CC); - if (resource_type) { - RETURN_STRING(resource_type, 1); - } else { - RETURN_STRING("Unknown", 1); - } -} -/* }}} */ - - -static int add_extension_info(zend_module_entry *module, void *arg TSRMLS_DC) -{ - zval *name_array = (zval *)arg; - add_next_index_string(name_array, module->name, 1); - return 0; -} - -static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC) -{ - zval *name_array = (zval *)arg; - zval *const_val; - - MAKE_STD_ZVAL(const_val); - *const_val = constant->value; - zval_copy_ctor(const_val); - INIT_PZVAL(const_val); - add_assoc_zval_ex(name_array, constant->name, constant->name_len, const_val); - return 0; -} - - -/* {{{ proto array get_loaded_extensions(void) - Return an array containing names of loaded extensions */ -ZEND_FUNCTION(get_loaded_extensions) -{ - if (ZEND_NUM_ARGS() != 0) { - ZEND_WRONG_PARAM_COUNT(); - } - - array_init(return_value); - zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC); -} -/* }}} */ - - -/* {{{ proto array get_defined_constants(void) - Return an array containing the names and values of all defined constants */ -ZEND_FUNCTION(get_defined_constants) -{ - int argc = ZEND_NUM_ARGS(); - - if (argc != 0 && argc != 1) { - ZEND_WRONG_PARAM_COUNT(); - } - - array_init(return_value); - - if (argc) { - HashPosition pos; - zend_constant *val; - int prev_module_number = -1; - char **module_names; - zval *module_constants = NULL; - zend_module_entry *module; - int i = 1; - - 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(EG(zend_constants), (void **) &module, &pos) != FAILURE) { - module_names[i++] = module->name; - zend_hash_move_forward_ex(&module_registry, &pos); - } - - 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 != 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); - } - } - - 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(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); - } else { - zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) add_constant_info, return_value TSRMLS_CC); - } -} -/* }}} */ - - -static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) { - void **p = *curpos - 2; - zval *arg_array, **arg; - int arg_count = (ulong) *p; - - *curpos -= (arg_count+2); - - MAKE_STD_ZVAL(arg_array); - array_init(arg_array); - p -= arg_count; - - while (--arg_count >= 0) { - arg = (zval **) p++; - SEPARATE_ZVAL_TO_MAKE_IS_REF(arg); - (*arg)->refcount++; - add_next_index_zval(arg_array, *arg); - } - return arg_array; -} - -void debug_print_backtrace_args(zval *arg_array TSRMLS_DC) -{ - zval **tmp; - HashPosition iterator; - int i = 0; - - zend_hash_internal_pointer_reset_ex(arg_array->value.ht, &iterator); - while (zend_hash_get_current_data_ex(arg_array->value.ht, (void **) &tmp, &iterator) == SUCCESS) { - if (i++) { - ZEND_PUTS(", "); - } - zend_print_flat_zval_r(*tmp TSRMLS_CC); - zend_hash_move_forward_ex(arg_array->value.ht, &iterator); - } -} - -/* {{{ proto void debug_print_backtrace(void) */ -ZEND_FUNCTION(debug_print_backtrace) -{ - zend_execute_data *ptr; - int lineno; - char *function_name; - char *filename; - char *class_name = NULL; - char *call_type; - char *include_filename = NULL; - zval *arg_array = NULL; - void **cur_arg_pos = EG(argument_stack).top_element; - void **args = cur_arg_pos; - int arg_stack_consistent = 0; - int frames_on_stack = 0; - int indent = 0; - - 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 == EG(argument_stack).elements) { - arg_stack_consistent = 1; - break; - } - } - - ptr = EG(current_execute_data); - - /* skip debug_backtrace() */ - ptr = ptr->prev_execute_data; - cur_arg_pos -= 2; - frames_on_stack--; - - array_init(return_value); - - while (ptr) { - if (ptr->op_array) { - filename = ptr->op_array->filename; - lineno = ptr->opline->lineno; - } else { - filename = NULL; - } - - function_name = ptr->function_state.function->common.function_name; - - if (function_name) { - if (ptr->object) { - class_name = Z_OBJCE(*ptr->object)->name; - call_type = "->"; - } else if (ptr->function_state.function->common.scope) { - class_name = ptr->function_state.function->common.scope->name; - call_type = "::"; - } else { - class_name = NULL; - call_type = NULL; - } - if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) { - if (arg_stack_consistent && (frames_on_stack > 0)) { - arg_array = debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC); - frames_on_stack--; - } - } - } else { - /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */ - zend_bool build_filename_arg = 1; - - switch (ptr->opline->op2.u.constant.value.lval) { - case ZEND_EVAL: - function_name = "eval"; - build_filename_arg = 0; - break; - case ZEND_INCLUDE: - function_name = "include"; - break; - case ZEND_REQUIRE: - function_name = "require"; - break; - case ZEND_INCLUDE_ONCE: - function_name = "include_once"; - break; - case ZEND_REQUIRE_ONCE: - function_name = "require_once"; - break; - default: - /* this can actually happen if you use debug_backtrace() in your error_handler and - * you're in the top-scope */ - function_name = "unknown"; - build_filename_arg = 0; - break; - } - - if (build_filename_arg && include_filename) { - MAKE_STD_ZVAL(arg_array); - array_init(arg_array); - add_next_index_string(arg_array, include_filename, 1); - } - } - zend_printf("#%-2d ", indent); - if (class_name) { - ZEND_PUTS(class_name); - ZEND_PUTS(call_type); - } - zend_printf("%s(", function_name?function_name:"main"); - if (arg_array) { - debug_print_backtrace_args(arg_array TSRMLS_CC); - zval_ptr_dtor(&arg_array); - } - zend_printf(") called at [%s:%d]\n", filename, lineno); - include_filename = filename; - ptr = ptr->prev_execute_data; - ++indent; - } -} - -/* }}} */ -/* {{{ proto void debug_backtrace(void) - Prints out a backtrace */ -ZEND_FUNCTION(debug_backtrace) -{ - zend_execute_data *ptr; - int lineno; - char *function_name; - char *filename; - char *class_name; - char *call_type; - char *include_filename = NULL; - zval *stack_frame; - void **cur_arg_pos = EG(argument_stack).top_element; - void **args = cur_arg_pos; - int arg_stack_consistent = 0; - int frames_on_stack = 0; - - 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 == EG(argument_stack).elements) { - arg_stack_consistent = 1; - break; - } - } - - ptr = EG(current_execute_data); - - /* skip debug_backtrace() */ - ptr = ptr->prev_execute_data; - cur_arg_pos -= 2; - frames_on_stack--; - - array_init(return_value); - - while (ptr) { - MAKE_STD_ZVAL(stack_frame); - array_init(stack_frame); - - if (ptr->op_array) { - filename = ptr->op_array->filename; - lineno = ptr->opline->lineno; - add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1); - add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno); - - /* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function - * and debug_baktrace() might have been called by the error_handler. in this case we don't - * want to pop anything of the argument-stack */ - } else { - filename = NULL; - } - - function_name = ptr->function_state.function->common.function_name; - - if (function_name) { - add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1); - - if (ptr->object) { - class_name = Z_OBJCE(*ptr->object)->name; - call_type = "->"; - } else if (ptr->function_state.function->common.scope) { - class_name = ptr->function_state.function->common.scope->name; - call_type = "::"; - } else { - class_name = NULL; - call_type = NULL; - } - - if (class_name) { - add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, 1); - add_assoc_string_ex(stack_frame, "type", sizeof("type"), call_type, 1); - } - - if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) { - if (arg_stack_consistent && (frames_on_stack > 0)) { - add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC)); - frames_on_stack--; - } - } - } else { - /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */ - zend_bool build_filename_arg = 1; - - switch (ptr->opline->op2.u.constant.value.lval) { - case ZEND_EVAL: - function_name = "eval"; - build_filename_arg = 0; - break; - case ZEND_INCLUDE: - function_name = "include"; - break; - case ZEND_REQUIRE: - function_name = "require"; - break; - case ZEND_INCLUDE_ONCE: - function_name = "include_once"; - break; - case ZEND_REQUIRE_ONCE: - function_name = "require_once"; - break; - default: - /* this can actually happen if you use debug_backtrace() in your error_handler and - * you're in the top-scope */ - function_name = "unknown"; - build_filename_arg = 0; - break; - } - - if (build_filename_arg && include_filename) { - zval *arg_array; - - MAKE_STD_ZVAL(arg_array); - array_init(arg_array); - - /* include_filename always points to the last filename of the last last called-fuction. - if we have called include in the frame above - this is the file we have included. - */ - - add_next_index_string(arg_array, include_filename, 1); - add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array); - } - - add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1); - } - - add_next_index_zval(return_value, stack_frame); - - include_filename = filename; - - ptr = ptr->prev_execute_data; - } -} -/* }}} */ - - -/* {{{ proto bool extension_loaded(string extension_name) - Returns true if the named extension is loaded */ -ZEND_FUNCTION(extension_loaded) -{ - zval **extension_name; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) { - ZEND_WRONG_PARAM_COUNT(); - } - - convert_to_string_ex(extension_name); - if (zend_hash_exists(&module_registry, Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name)+1)) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ - - -/* {{{ proto array get_extension_funcs(string extension_name) - Returns an array with the names of functions belonging to the named extension */ -ZEND_FUNCTION(get_extension_funcs) -{ - zval **extension_name; - zend_module_entry *module; - zend_function_entry *func; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) { - ZEND_WRONG_PARAM_COUNT(); - } - - convert_to_string_ex(extension_name); - if (strncasecmp(Z_STRVAL_PP(extension_name), "zend", sizeof("zend"))) { - if (zend_hash_find(&module_registry, Z_STRVAL_PP(extension_name), - Z_STRLEN_PP(extension_name)+1, (void**)&module) == FAILURE) { - RETURN_FALSE; - } - - if (!(func = module->functions)) { - RETURN_FALSE; - } - } else { - func = builtin_functions; - } - - array_init(return_value); - - while (func->fname) { - add_next_index_string(return_value, func->fname, 1); - func++; - } -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h deleted file mode 100644 index 049e11e664..0000000000 --- a/Zend/zend_builtin_functions.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_BUILTIN_FUNCTIONS_H -#define ZEND_BUILTIN_FUNCTIONS_H - -int zend_startup_builtin_functions(TSRMLS_D); - -#endif /* ZEND_BUILTIN_FUNCTIONS_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c deleted file mode 100644 index 5bdffcbacd..0000000000 --- a/Zend/zend_compile.c +++ /dev/null @@ -1,3592 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend_language_parser.h" -#include "zend.h" -#include "zend_compile.h" -#include "zend_constants.h" -#include "zend_llist.h" -#include "zend_API.h" -#include "zend_fast_cache.h" - -#define IN_NAMESPACE() (CG(active_namespace) != &CG(global_namespace)) - -ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); - - -#ifndef ZTS -ZEND_API zend_compiler_globals compiler_globals; -ZEND_API zend_executor_globals executor_globals; -#endif - -static void build_runtime_defined_function_key(zval *result, char *name, int name_length, zend_op *opline TSRMLS_DC) -{ - char lineno_buf[32]; - uint lineno_len; - char *filename; - - lineno_len = zend_sprintf(lineno_buf, "%d", opline->lineno); - if (CG(active_op_array)->filename) { - filename = CG(active_op_array)->filename; - } else { - filename = "-"; - } - - /* NULL, name length, filename length, line number length */ - result->value.str.len = 1+name_length+strlen(filename)+lineno_len; - result->value.str.val = (char *) emalloc(result->value.str.len+1); - sprintf(result->value.str.val, "%c%s%s%s", '\0', name, filename, lineno_buf); - result->type = IS_STRING; - result->refcount = 1; -} - - -int zend_auto_global_arm(zend_auto_global *auto_global TSRMLS_DC) -{ - auto_global->armed = (auto_global->auto_global_callback ? 1 : 0); - return 0; -} - - -static void init_compiler_declarables(TSRMLS_D) -{ - CG(declarables).ticks.type = IS_LONG; - CG(declarables).ticks.value.lval = 0; -} - - - -void zend_init_compiler_data_structures(TSRMLS_D) -{ - zend_stack_init(&CG(bp_stack)); - zend_stack_init(&CG(function_call_stack)); - zend_stack_init(&CG(switch_cond_stack)); - zend_stack_init(&CG(foreach_copy_stack)); - zend_stack_init(&CG(object_stack)); - zend_stack_init(&CG(declare_stack)); - CG(active_class_entry) = NULL; - CG(active_namespace) = &CG(global_namespace); - zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0); - zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0); - zend_stack_init(&CG(list_stack)); - CG(handle_op_arrays) = 1; - CG(in_compilation) = 0; - CG(start_lineno) = 0; - init_compiler_declarables(TSRMLS_C); - CG(throw_list) = NULL; - CG(in_clone_method) = 0; - zend_hash_apply(CG(auto_globals), (apply_func_t) zend_auto_global_arm TSRMLS_CC); -} - - -void init_compiler(TSRMLS_D) -{ - zend_init_compiler_data_structures(TSRMLS_C); - zend_init_rsrc_list(TSRMLS_C); - zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0); - zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0); - CG(unclean_shutdown) = 0; -} - - -void shutdown_compiler(TSRMLS_D) -{ - zend_stack_destroy(&CG(bp_stack)); - zend_stack_destroy(&CG(function_call_stack)); - zend_stack_destroy(&CG(switch_cond_stack)); - zend_stack_destroy(&CG(foreach_copy_stack)); - zend_stack_destroy(&CG(object_stack)); - zend_stack_destroy(&CG(declare_stack)); - zend_stack_destroy(&CG(list_stack)); - zend_hash_destroy(&CG(filenames_table)); - zend_llist_destroy(&CG(open_files)); -} - - -ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC) -{ - char **pp, *p; - int length = strlen(new_compiled_filename); - - if (zend_hash_find(&CG(filenames_table), new_compiled_filename, length+1, (void **) &pp)==SUCCESS) { - CG(compiled_filename) = *pp; - return *pp; - } - p = estrndup(new_compiled_filename, length); - zend_hash_update(&CG(filenames_table), new_compiled_filename, length+1, &p, sizeof(char *), (void **) &pp); - CG(compiled_filename) = p; - return p; -} - - -ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC) -{ - CG(compiled_filename) = original_compiled_filename; -} - - -ZEND_API char *zend_get_compiled_filename(TSRMLS_D) -{ - return CG(compiled_filename); -} - - -ZEND_API int zend_get_compiled_lineno(TSRMLS_D) -{ - return CG(zend_lineno); -} - - -ZEND_API zend_bool zend_is_compiling(TSRMLS_D) -{ - return CG(in_compilation); -} - - -static zend_uint get_temporary_variable(zend_op_array *op_array) -{ - return (op_array->T)++ * sizeof(temp_variable); -} - - -void zend_do_fold_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC) -{ - int (*do_op)(zval *, zval *, zval * TSRMLS_DC); - -#define FOLD_CASE(val, func) \ - case val: \ - do_op = func; \ - break; - - switch (op) { - FOLD_CASE(ZEND_SL, shift_left_function) - FOLD_CASE(ZEND_SR, shift_right_function) - FOLD_CASE(ZEND_BW_OR, bitwise_or_function) - FOLD_CASE(ZEND_BW_AND, bitwise_and_function) - FOLD_CASE(ZEND_BW_XOR, bitwise_xor_function) - FOLD_CASE(ZEND_CONCAT, concat_function) - FOLD_CASE(ZEND_ADD, add_function) - FOLD_CASE(ZEND_SUB, sub_function) - FOLD_CASE(ZEND_MUL, mul_function) - FOLD_CASE(ZEND_DIV, div_function) - FOLD_CASE(ZEND_MOD, mod_function) - FOLD_CASE(ZEND_BOOL_XOR, boolean_xor_function) - case ZEND_BW_NOT: - bitwise_not_function(&result->u.constant, &op1->u.constant TSRMLS_CC); - break; - } - - do_op(&result->u.constant, &op1->u.constant, &op2->u.constant TSRMLS_CC); -} - -void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = op; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - opline->op2 = *op2; - *result = opline->result; -} - - -void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = op; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - *result = opline->result; - SET_UNUSED(opline->op2); -} - -#define MAKE_NOP(opline) { opline->opcode = ZEND_NOP; memset(&opline->result,0,sizeof(znode)); memset(&opline->op1,0,sizeof(znode)); memset(&opline->op2,0,sizeof(znode)); opline->result.op_type=opline->op1.op_type=opline->op2.op_type=IS_UNUSED; } - - -static void zend_do_op_data(zend_op *data_op, znode *value TSRMLS_DC) -{ - data_op->opcode = ZEND_OP_DATA; - data_op->op1 = *value; - SET_UNUSED(data_op->op2); -} - -void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC) -{ - int last_op_number = get_next_op_number(CG(active_op_array))-1; - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number]; - - if (last_op->opcode == ZEND_FETCH_OBJ_RW) { - switch (op) { - case ZEND_ASSIGN_ADD: - last_op->opcode = ZEND_ASSIGN_ADD_OBJ; - break; - case ZEND_ASSIGN_SUB: - last_op->opcode = ZEND_ASSIGN_SUB_OBJ; - break; - case ZEND_ASSIGN_MUL: - last_op->opcode = ZEND_ASSIGN_MUL_OBJ; - break; - case ZEND_ASSIGN_DIV: - last_op->opcode = ZEND_ASSIGN_DIV_OBJ; - break; - case ZEND_ASSIGN_MOD: - last_op->opcode = ZEND_ASSIGN_MOD_OBJ; - break; - case ZEND_ASSIGN_SL: - last_op->opcode = ZEND_ASSIGN_SL_OBJ; - break; - case ZEND_ASSIGN_SR: - last_op->opcode = ZEND_ASSIGN_SR_OBJ; - break; - case ZEND_ASSIGN_CONCAT: - last_op->opcode = ZEND_ASSIGN_CONCAT_OBJ; - break; - case ZEND_ASSIGN_BW_OR: - last_op->opcode = ZEND_ASSIGN_BW_OR_OBJ; - break; - case ZEND_ASSIGN_BW_AND: - last_op->opcode = ZEND_ASSIGN_BW_AND_OBJ; - break; - case ZEND_ASSIGN_BW_XOR: - last_op->opcode = ZEND_ASSIGN_BW_XOR_OBJ; - break; - default: - zend_error(E_COMPILE_ERROR, "Unknown binary op opcode %d", op); - } - - zend_do_op_data(opline, op2 TSRMLS_CC); - SET_UNUSED(opline->result); - *result = last_op->result; - } else { - opline->opcode = op; - opline->op1 = *op1; - opline->op2 = *op2; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - } -} - - -void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC) -{ - zend_op opline; - zend_op *opline_ptr; - zend_llist *fetch_list_ptr; - - if (bp) { - opline_ptr = &opline; - init_op(opline_ptr TSRMLS_CC); - } else { - opline_ptr = get_next_op(CG(active_op_array) TSRMLS_CC); - } - - opline_ptr->opcode = op; - opline_ptr->result.op_type = IS_VAR; - opline_ptr->result.u.EA.type = 0; - opline_ptr->result.u.var = get_temporary_variable(CG(active_op_array)); - opline_ptr->op1 = *varname; - *result = opline_ptr->result; - SET_UNUSED(opline_ptr->op2); - - opline_ptr->op2.u.EA.type = ZEND_FETCH_LOCAL; - if (varname->op_type == IS_CONST && varname->u.constant.type == IS_STRING) { - if (zend_is_auto_global(varname->u.constant.value.str.val, varname->u.constant.value.str.len TSRMLS_CC)) { - opline_ptr->op2.u.EA.type = ZEND_FETCH_GLOBAL; - } else { -/* if (CG(active_op_array)->static_variables && zend_hash_exists(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1)) { - opline_ptr->op2.u.EA.type = ZEND_FETCH_STATIC; - } -*/ } - } - - if (bp) { - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - zend_llist_add_element(fetch_list_ptr, opline_ptr); - } -} - -void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC) -{ - /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ - fetch_simple_variable_ex(result, varname, bp, ZEND_FETCH_W TSRMLS_CC); -} - -void zend_do_fetch_static_member(znode *class_znode TSRMLS_DC) -{ - zend_llist *fetch_list_ptr; - zend_llist_element *le; - zend_op *opline_ptr; - - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - le = fetch_list_ptr->head; - - opline_ptr = (zend_op *)le->data; - opline_ptr->op2 = *class_znode; - opline_ptr->op2.u.EA.type = ZEND_FETCH_STATIC_MEMBER; -} - -void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC) -{ - fetch_simple_variable(result, varname, 1 TSRMLS_CC); - - fetch_array_dim(result, result, first_dim TSRMLS_CC); -} - - -void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC) -{ - zend_op opline; - zend_llist *fetch_list_ptr; - - init_op(&opline TSRMLS_CC); - opline.opcode = ZEND_FETCH_DIM_W; /* the backpatching routine assumes W */ - opline.result.op_type = IS_VAR; - opline.result.u.EA.type = 0; - opline.result.u.var = get_temporary_variable(CG(active_op_array)); - opline.op1 = *parent; - opline.op2 = *dim; - opline.extended_value = ZEND_FETCH_STANDARD; - *result = opline.result; - - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - zend_llist_add_element(fetch_list_ptr, &opline); -} - - -void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC) -{ - fetch_array_dim(result, parent, offset TSRMLS_CC); -} - - -void zend_do_print(znode *result, znode *arg TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->opcode = ZEND_PRINT; - opline->op1 = *arg; - SET_UNUSED(opline->op2); - *result = opline->result; -} - - -void zend_do_echo(znode *arg TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_ECHO; - opline->op1 = *arg; - SET_UNUSED(opline->op2); -} - -void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body TSRMLS_DC) -{ - char *method_type; - - if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { - modifiers->u.constant.value.lval |= ZEND_ACC_ABSTRACT; - method_type = "Interface"; - } else { - method_type = "Abstract"; - } - - if (modifiers->u.constant.value.lval & ZEND_ACC_ABSTRACT) { - if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_RAISE_ABSTRACT_ERROR; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - } else { - /* we had code in the function body */ - zend_error(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body", method_type, CG(active_class_entry)->name, function_name->u.constant.value.str.val); - } - } else { - if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) { - zend_error(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body", CG(active_class_entry)->name, function_name->u.constant.value.str.val); - } - } -} - - -void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) -{ - int last_op_number = get_next_op_number(CG(active_op_array))-1; - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number]; - - if (last_op->opcode == ZEND_FETCH_OBJ_W) { - last_op->opcode = ZEND_ASSIGN_OBJ; - - zend_do_op_data(opline, value TSRMLS_CC); - SET_UNUSED(opline->result); - *result = last_op->result; - } else { - opline->opcode = ZEND_ASSIGN; - opline->op1 = *variable; - opline->op2 = *value; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - } -} - - -void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_ASSIGN_REF; - if (result) { - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - } else { - /* SET_UNUSED(opline->result); */ - opline->result.u.EA.type |= EXT_TYPE_UNUSED; - } - opline->op1 = *lvar; - opline->op2 = *rvar; -} - - -static inline void do_begin_loop(TSRMLS_D) -{ - zend_brk_cont_element *brk_cont_element; - int parent; - - parent = CG(active_op_array)->current_brk_cont; - CG(active_op_array)->current_brk_cont = CG(active_op_array)->last_brk_cont; - brk_cont_element = get_next_brk_cont_element(CG(active_op_array)); - brk_cont_element->parent = parent; -} - - -static inline void do_end_loop(int cont_addr TSRMLS_DC) -{ - CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = cont_addr; - CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array)); - CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent; -} - - -void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC) -{ - int while_cond_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMPZ; - opline->op1 = *expr; - close_bracket_token->u.opline_num = while_cond_op_number; - SET_UNUSED(opline->op2); - - do_begin_loop(TSRMLS_C); - INC_BPC(CG(active_op_array)); -} - - -void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - /* add unconditional jump */ - opline->opcode = ZEND_JMP; - opline->op1.u.opline_num = while_token->u.opline_num; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - /* update while's conditional jmp */ - CG(active_op_array)->opcodes[close_bracket_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - - do_end_loop(while_token->u.opline_num TSRMLS_CC); - - DEC_BPC(CG(active_op_array)); -} - - -void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC) -{ - int for_cond_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMPZNZ; - opline->op1 = *expr; /* the conditional expression */ - second_semicolon_token->u.opline_num = for_cond_op_number; - SET_UNUSED(opline->op2); -} - - -void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMP; - opline->op1.u.opline_num = cond_start->u.opline_num; - CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].extended_value = get_next_op_number(CG(active_op_array)); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - do_begin_loop(TSRMLS_C); - - INC_BPC(CG(active_op_array)); -} - - -void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMP; - opline->op1.u.opline_num = second_semicolon_token->u.opline_num+1; - CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - do_end_loop(second_semicolon_token->u.opline_num+1 TSRMLS_CC); - - DEC_BPC(CG(active_op_array)); -} - - -void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC) -{ - int last_op_number = get_next_op_number(CG(active_op_array))-1; - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number]; - - if (last_op->opcode == ZEND_FETCH_OBJ_RW) { - opline->opcode = (op==ZEND_PRE_INC)?ZEND_PRE_INC_OBJ:ZEND_PRE_DEC_OBJ; - opline->op1 = last_op->op1; - opline->op2 = last_op->op2; - - MAKE_NOP(last_op); - } else { - opline->opcode = op; - opline->op1 = *op1; - SET_UNUSED(opline->op2); - } - - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; -} - - -void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC) -{ - int last_op_number = get_next_op_number(CG(active_op_array))-1; - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number]; - - if (last_op->opcode == ZEND_FETCH_OBJ_RW) { - opline->opcode = (op==ZEND_POST_INC)?ZEND_POST_INC_OBJ:ZEND_POST_DEC_OBJ; - opline->op1 = last_op->op1; - opline->op2 = last_op->op2; - - MAKE_NOP(last_op); - } else { - opline->opcode = op; - opline->op1 = *op1; - SET_UNUSED(opline->op2); - } - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; -} - - -void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC) -{ - int if_cond_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMPZ; - opline->op1 = *cond; - closing_bracket_token->u.opline_num = if_cond_op_number; - SET_UNUSED(opline->op2); - INC_BPC(CG(active_op_array)); -} - - -void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC) -{ - int if_end_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - zend_llist *jmp_list_ptr; - - opline->opcode = ZEND_JMP; - /* save for backpatching */ - if (initialize) { - zend_llist jmp_list; - - zend_llist_init(&jmp_list, sizeof(int), NULL, 0); - zend_stack_push(&CG(bp_stack), (void *) &jmp_list, sizeof(zend_llist)); - } - zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr); - zend_llist_add_element(jmp_list_ptr, &if_end_op_number); - - CG(active_op_array)->opcodes[closing_bracket_token->u.opline_num].op2.u.opline_num = if_end_op_number+1; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void zend_do_if_end(TSRMLS_D) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_llist *jmp_list_ptr; - zend_llist_element *le; - - zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr); - for (le=jmp_list_ptr->head; le; le = le->next) { - CG(active_op_array)->opcodes[*((int *) le->data)].op1.u.opline_num = next_op_number; - } - zend_llist_destroy(jmp_list_ptr); - zend_stack_del_top(&CG(bp_stack)); - DEC_BPC(CG(active_op_array)); -} - -#if 0 -/* 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) - -#endif - -void zend_check_writable_variable(znode *variable) -{ - zend_uint type = variable->u.EA.type; - - if (type & ZEND_PARSED_METHOD_CALL) { - zend_error(E_COMPILE_ERROR, "Can't use method return value in write context"); - } - if (type == ZEND_PARSED_FUNCTION_CALL) { - zend_error(E_COMPILE_ERROR, "Can't use function return value in write context"); - } -} - -zend_bool zend_is_function_or_method_call(znode *variable) -{ - zend_uint type = variable->u.EA.type; - - return ((type & ZEND_PARSED_METHOD_CALL) || (type == ZEND_PARSED_FUNCTION_CALL)); -} - - -void zend_do_begin_import(TSRMLS_D) -{ - zend_llist_init(&CG(import_commands), sizeof(zend_op), NULL, 0); -} - - -void zend_do_import(int type, znode *what TSRMLS_DC) -{ - zend_op opline; - - init_op(&opline TSRMLS_CC); - - switch (type) { - case T_FUNCTION: - opline.opcode = ZEND_IMPORT_FUNCTION; - break; - case T_CLASS: - opline.opcode = ZEND_IMPORT_CLASS; - break; - case T_CONST: - opline.opcode = ZEND_IMPORT_CONST; - break; - } - - if (what) { - if (type == T_FUNCTION || type == T_CLASS) { - zend_str_tolower(what->u.constant.value.str.val, what->u.constant.value.str.len); - } - opline.op2 = *what; - } else { - SET_UNUSED(opline.op2); - } - - zend_llist_add_element(&CG(import_commands), &opline); -} - - -void zend_do_end_import(znode *import_from TSRMLS_DC) -{ - zend_llist_element *le; - zend_op *opline, *opline_ptr; - - le = CG(import_commands).head; - - while (le) { - opline_ptr = (zend_op *)le->data; - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - memcpy(opline, opline_ptr, sizeof(zend_op)); - opline->op1 = *import_from; - le = le->next; - } - zend_llist_destroy(&CG(import_commands)); -} - - -void zend_do_begin_variable_parse(TSRMLS_D) -{ - zend_llist fetch_list; - - zend_llist_init(&fetch_list, sizeof(zend_op), NULL, 0); - zend_stack_push(&CG(bp_stack), (void *) &fetch_list, sizeof(zend_llist)); -} - - -void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC) -{ - zend_llist *fetch_list_ptr; - zend_llist_element *le; - zend_op *opline, *opline_ptr=NULL; - int num_of_created_opcodes = 0; - - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - - le = fetch_list_ptr->head; - - while (le) { - opline_ptr = (zend_op *)le->data; - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - memcpy(opline, opline_ptr, sizeof(zend_op)); - switch (type) { - case BP_VAR_R: - if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use [] for reading"); - } - opline->opcode -= 3; - break; - case BP_VAR_W: - break; - case BP_VAR_RW: - opline->opcode += 3; - break; - case BP_VAR_IS: - opline->opcode += 6; /* 3+3 */ - break; - case BP_VAR_FUNC_ARG: - opline->opcode += 9; /* 3+3+3 */ - opline->extended_value = arg_offset; - break; - case BP_VAR_UNSET: - if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use [] for unsetting"); - } - opline->opcode += 12; /* 3+3+3+3 */ - break; - } - le = le->next; - num_of_created_opcodes++; - } - - if (num_of_created_opcodes == 1) { - if ((opline_ptr->op1.op_type == IS_CONST) && (opline_ptr->op1.u.constant.type == IS_STRING) && - (opline_ptr->op1.u.constant.value.str.len == (sizeof("this")-1)) && - !memcmp(opline_ptr->op1.u.constant.value.str.val, "this", sizeof("this"))) { - CG(active_op_array)->uses_this = 1; - } - } - - zend_llist_destroy(fetch_list_ptr); - zend_stack_del_top(&CG(bp_stack)); -} - - -void zend_do_init_string(znode *result TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_INIT_STRING; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void zend_do_add_char(znode *result, znode *op1, znode *op2 TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_ADD_CHAR; - opline->op1 = *op1; - opline->op2 = *op2; - opline->op2.op_type = IS_CONST; - opline->result = opline->op1; - *result = opline->result; -} - - -void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_ADD_STRING; - opline->op1 = *op1; - opline->op2 = *op2; - opline->op2.op_type = IS_CONST; - opline->result = opline->op1; - *result = opline->result; -} - - -void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC) -{ - zend_op *opline; - - if (op1->op_type == IS_CONST) { - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_INIT_STRING; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - if (op1->u.constant.value.str.len>0) { - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_ADD_STRING; - opline->result = *result; - opline->op1 = *result; - opline->op2 = *op1; - opline->result = opline->op1; - } else { - zval_dtor(&op1->u.constant); - } - } else { - *result = *op1; - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_ADD_VAR; - opline->result = *result; - opline->op1 = *result; - opline->op2 = *op2; - *result = opline->result; -} - -static void zend_lowercase_znode_if_const(znode *z) -{ - if (z->op_type == IS_CONST) { - zend_str_tolower(z->u.constant.value.str.val, z->u.constant.value.str.len); - } -} - -void zend_do_free(znode *op1 TSRMLS_DC) -{ - if (op1->op_type==IS_TMP_VAR) { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_FREE; - opline->op1 = *op1; - SET_UNUSED(opline->op2); - } else if (op1->op_type==IS_VAR) { - zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; - - while (opline->opcode == ZEND_END_SILENCE || opline->opcode == ZEND_EXT_FCALL_END || opline->opcode == ZEND_OP_DATA) { - opline--; - } - if (opline->result.op_type == op1->op_type - && opline->result.u.var == op1->u.var) { - opline->result.u.EA.type |= EXT_TYPE_UNUSED; - } else { - while (opline>CG(active_op_array)->opcodes) { - /* This should be an object instantiation - * Find JMP_NO_CTOR, mark the preceding ASSIGN and the - * proceeding INIT_FCALL_BY_NAME as unused - */ - if (opline->opcode == ZEND_JMP_NO_CTOR) { - (opline-1)->result.u.EA.type |= EXT_TYPE_UNUSED; - (opline+1)->op1.u.EA.type |= EXT_TYPE_UNUSED; - break; - } else if (opline->opcode == ZEND_FETCH_DIM_R - && opline->op1.op_type == IS_VAR - && opline->op1.u.var == op1->u.var) { - /* This should the end of a list() construct - * Mark its result as unused - */ - opline->extended_value = ZEND_FETCH_STANDARD; - break; - } else if (opline->result.op_type==IS_VAR - && opline->result.u.var == op1->u.var) { - break; - } - opline--; - } - } - } else if (op1->op_type == IS_CONST) { - zval_dtor(&op1->u.constant); - } -} - - -int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier) -{ - if ((current_access_type->u.constant.value.lval & ZEND_ACC_PPP_MASK) - && (new_modifier->u.constant.value.lval & ZEND_ACC_PPP_MASK) - && ((current_access_type->u.constant.value.lval & ZEND_ACC_PPP_MASK) != (new_modifier->u.constant.value.lval & ZEND_ACC_PPP_MASK))) { - zend_error(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed"); - } - if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { - zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member"); - } - if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) == (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) { - zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on a private class member"); - } - return (current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval); -} - - -void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC) -{ - zend_op_array op_array; - char *name = function_name->u.constant.value.str.val; - int name_len = function_name->u.constant.value.str.len; - int function_begin_line = function_token->u.opline_num; - zend_uint fn_flags; - - if (is_method) { - if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { - if (!(fn_flags_znode->u.constant.value.lval & ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "Access type for interface method %s::%s() must be omitted or declared public", CG(active_class_entry)->name, function_name->u.constant.value.str.val); - } - fn_flags_znode->u.constant.value.lval |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */ - } - fn_flags = fn_flags_znode->u.constant.value.lval; /* must be done *after* the above check */ - } else { - fn_flags = 0; - } - - function_token->u.op_array = CG(active_op_array); - zend_str_tolower(name, name_len); - - init_op_array(&op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC); - - op_array.function_name = name; - op_array.arg_types = NULL; - op_array.return_reference = return_reference; - op_array.fn_flags = fn_flags; - - op_array.scope = CG(active_class_entry); - op_array.ns = CG(active_namespace); - op_array.prototype = NULL; - - op_array.line_start = zend_get_compiled_lineno(TSRMLS_C); - - if (is_method) { - char *short_class_name = CG(active_class_entry)->name; - int short_class_name_length = CG(active_class_entry)->name_length; - zend_uint i; - - for (i=0; i < CG(active_class_entry)->name_length; i++) { - if (CG(active_class_entry)->name[i] == ':') { - short_class_name = &CG(active_class_entry)->name[i+1]; - short_class_name_length = strlen(short_class_name); - } - } - if (zend_hash_add(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) { - zend_op_array *child_op_array, *parent_op_array; - if (CG(active_class_entry)->parent - && (zend_hash_find(&CG(active_class_entry)->function_table, name, name_len+1, (void **) &child_op_array) == SUCCESS) - && (zend_hash_find(&CG(active_class_entry)->parent->function_table, name, name_len+1, (void **) &parent_op_array) == SUCCESS) - && (child_op_array == parent_op_array)) { - zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); - } else { - zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name, name); - } - } - - if (fn_flags & ZEND_ACC_ABSTRACT) { - CG(active_class_entry)->ce_flags |= ZEND_ACC_ABSTRACT; - } - - if (!(fn_flags & ZEND_ACC_PPP_MASK)) { - fn_flags |= ZEND_ACC_PUBLIC; - } - - if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len)) && !CG(active_class_entry)->constructor) { - CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array); - } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) { - CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array); - } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) { - CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array); - } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) { - CG(active_class_entry)->clone = (zend_function *) CG(active_op_array); - CG(in_clone_method) = 1; - } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) { - CG(active_class_entry)->__call = (zend_function *) CG(active_op_array); - } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) { - CG(active_class_entry)->__get = (zend_function *) CG(active_op_array); - } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) { - CG(active_class_entry)->__set = (zend_function *) CG(active_op_array); - } - } else if(IN_NAMESPACE()) { - if (zend_hash_add(&CG(active_namespace)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_namespace)->name, name); - } - } else { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_DECLARE_FUNCTION; - opline->op1.op_type = IS_CONST; - build_runtime_defined_function_key(&opline->op1.u.constant, function_name->u.constant.value.str.val, function_name->u.constant.value.str.len, opline TSRMLS_CC); - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_STRING; - opline->op2.u.constant.value.str.val = estrndup(name, name_len); - opline->op2.u.constant.value.str.len = name_len; - opline->op2.u.constant.refcount = 1; - opline->extended_value = ZEND_DECLARE_FUNCTION; - zend_hash_update(CG(function_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); - } - - if (CG(extended_info)) { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_EXT_NOP; - opline->lineno = function_begin_line; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - } - - { - /* Push a seperator to the switch and foreach stacks */ - zend_switch_entry switch_entry; - - switch_entry.cond.op_type = IS_UNUSED; - switch_entry.default_case = 0; - switch_entry.control_var = 0; - - zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry)); - - zend_stack_push(&CG(foreach_copy_stack), (void *) &switch_entry.cond, sizeof(znode)); - } - function_token->throw_list = CG(throw_list); - CG(throw_list) = NULL; - - if (CG(doc_comment)) { - CG(active_op_array)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len)); - CG(active_op_array)->doc_comment_len = CG(doc_comment_len); - RESET_DOC_COMMENT(); - } -} - - -void zend_do_end_function_declaration(znode *function_token TSRMLS_DC) -{ - zend_do_extended_info(TSRMLS_C); - zend_do_return(NULL, 0 TSRMLS_CC); - pass_two(CG(active_op_array) TSRMLS_CC); - CG(active_op_array)->line_end = zend_get_compiled_lineno(TSRMLS_C); - CG(active_op_array) = function_token->u.op_array; - - /* Pop the switch and foreach seperators */ - zend_stack_del_top(&CG(switch_cond_stack)); - zend_stack_del_top(&CG(foreach_copy_stack)); - - CG(throw_list) = function_token->throw_list; - - CG(in_clone_method) = 0; -} - - -void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, zend_uchar pass_type TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = op; - opline->result = *var; - opline->op1 = *offset; - if ((op == ZEND_RECV_INIT)) { - opline->op2 = *initialization; - } else { - SET_UNUSED(opline->op2); - } - if (!CG(active_op_array)->arg_types) { - if (pass_type==BYREF_FORCE) { - int i; - - CG(active_op_array)->arg_types = (unsigned char *) emalloc(sizeof(unsigned char)*(offset->u.constant.value.lval+1)); - for (i=1; iu.constant.value.lval; i++) { - CG(active_op_array)->arg_types[i] = BYREF_NONE; - } - CG(active_op_array)->arg_types[0]=(unsigned char) offset->u.constant.value.lval; - CG(active_op_array)->arg_types[offset->u.constant.value.lval] = pass_type; - } - } else { - CG(active_op_array)->arg_types = (unsigned char *) erealloc(CG(active_op_array)->arg_types, sizeof(unsigned char)*(offset->u.constant.value.lval+1)); - CG(active_op_array)->arg_types[0]=(unsigned char) offset->u.constant.value.lval; - CG(active_op_array)->arg_types[offset->u.constant.value.lval] = pass_type; - } - - if (class_type->op_type != IS_UNUSED) { - znode passed_var = opline->result; - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_VERIFY_INSTANCEOF; - opline->op1 = *class_type; - opline->op2 = passed_var; - opline->extended_value = offset->u.constant.value.lval; - } else { - opline->result.u.EA.type |= EXT_TYPE_UNUSED; - } -} - - -int zend_do_begin_function_call(znode *function_name TSRMLS_DC) -{ - zend_function *function; - - zend_str_tolower(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len); - if (zend_hash_find(CG(function_table), function_name->u.constant.value.str.val, function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) { - zend_do_begin_dynamic_function_call(function_name TSRMLS_CC); - return 1; /* Dynamic */ - } - - switch (function->type) { - case ZEND_USER_FUNCTION: { - zend_op_array *op_array = (zend_op_array *) function; - - zend_stack_push(&CG(function_call_stack), (void *) &op_array, sizeof(zend_function *)); - } - break; - case ZEND_INTERNAL_FUNCTION: { - zend_internal_function *internal_function = (zend_internal_function *) function; - - zend_stack_push(&CG(function_call_stack), (void *) &internal_function, sizeof(zend_function *)); - } - break; - } - zend_do_extended_fcall_begin(TSRMLS_C); - return 0; -} - - - -void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) -{ - zend_op *last_op; - int last_op_number; - unsigned char *ptr = NULL; - - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); - zend_do_begin_variable_parse(TSRMLS_C); - - last_op_number = get_next_op_number(CG(active_op_array))-1; - last_op = &CG(active_op_array)->opcodes[last_op_number]; - - if ((last_op->op2.op_type == IS_CONST) && (last_op->op2.u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1) - && !memcmp(last_op->op2.u.constant.value.str.val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME))) { - last_op->opcode = ZEND_CLONE; - left_bracket->u.constant.value.lval = ZEND_CLONE; - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); - zend_do_extended_fcall_begin(TSRMLS_C); - return; - } - - last_op->opcode = ZEND_INIT_METHOD_CALL; - - left_bracket->u.constant.value.lval = ZEND_INIT_FCALL_BY_NAME; - - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); - zend_do_extended_fcall_begin(TSRMLS_C); -} - - -void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC) -{ - unsigned char *ptr = NULL; - zend_op *opline; - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_INIT_FCALL_BY_NAME; - opline->op2 = *function_name; - opline->extended_value = 0; - SET_UNUSED(opline->op1); - - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); - zend_do_extended_fcall_begin(TSRMLS_C); -} - - -void zend_do_fetch_class(znode *result, znode *namespace_name, znode *class_name, zend_bool global_namespace TSRMLS_DC) -{ - long fetch_class_op_number; - zend_op *opline; - - fetch_class_op_number = get_next_op_number(CG(active_op_array)); - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_FETCH_CLASS; - if (namespace_name) { - zend_str_tolower(namespace_name->u.constant.value.str.val, namespace_name->u.constant.value.str.len); - opline->op1 = *namespace_name; - } else { - SET_UNUSED(opline->op1); - if (global_namespace) { - opline->extended_value = ZEND_FETCH_CLASS_GLOBAL; - } - } - CG(catch_begin) = fetch_class_op_number; - if (class_name->op_type == IS_CONST) { - zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); - if ((class_name->u.constant.value.str.len == (sizeof("self") - 1)) && - !memcmp(class_name->u.constant.value.str.val, "self", sizeof("self"))) { - SET_UNUSED(opline->op2); - opline->extended_value = ZEND_FETCH_CLASS_SELF; - zval_dtor(&class_name->u.constant); - } else if ((class_name->u.constant.value.str.len == (sizeof("parent") - 1)) && - !memcmp(class_name->u.constant.value.str.val, "parent", sizeof("parent"))) { - SET_UNUSED(opline->op2); - opline->extended_value = ZEND_FETCH_CLASS_PARENT; - zval_dtor(&class_name->u.constant); - } else { - opline->op2 = *class_name; - } - } else { - opline->op2 = *class_name; - } - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_CONST; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */ - *result = opline->result; -} - - -void zend_do_fetch_class_name(znode *result, znode *class_name_entry, znode *class_name, zend_bool case_sensitive TSRMLS_DC) -{ - zend_uint length; - - if (!result) { - result = class_name_entry; - } else { - *result = *class_name_entry; - } - if (!case_sensitive) { - zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); - } - - length = sizeof("::")-1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len; - result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1); - STR_FREE(class_name->u.constant.value.str.val); - result->u.constant.value.str.len = length; -} - -void zend_do_begin_class_member_function_call(TSRMLS_D) -{ - unsigned char *ptr = NULL; - long fetch_const_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = &CG(active_op_array)->opcodes[fetch_const_op_number-1]; - - /* a tmp var is leaked here */ - opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; - zend_lowercase_znode_if_const(&opline->op2); - - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); -} - - -void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC) -{ - zend_op *opline; - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - if (!is_method && !is_dynamic_fcall && function_name->op_type==IS_CONST) { - opline->opcode = ZEND_DO_FCALL; - opline->op1 = *function_name; - } else { - opline->opcode = ZEND_DO_FCALL_BY_NAME; - SET_UNUSED(opline->op1); - } - - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_VAR; - *result = opline->result; - SET_UNUSED(opline->op2); - - /* Check how much this is really needed - opline->op2.u.constant.value.lval = is_method; - */ - if (CG(throw_list) != NULL) { - long op_number = get_next_op_number(CG(active_op_array))-1; - zend_llist_add_element(CG(throw_list), &op_number); - } else { - opline->op2.u.opline_num = -1; - } - - zend_stack_del_top(&CG(function_call_stack)); - opline->extended_value = argument_list->u.constant.value.lval; -} - - -void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) -{ - zend_op *opline; - unsigned char *arg_types; - int original_op=op; - zend_function **function_ptr_ptr, *function_ptr; - int send_by_reference; - - - zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr); - function_ptr = *function_ptr_ptr; - - if (original_op==ZEND_SEND_REF - && !CG(allow_call_time_pass_reference)) { - zend_error(E_COMPILE_WARNING, - "Call-time pass-by-reference has been deprecated - argument passed by value; " - "If you would like to pass it by reference, modify the declaration of %s(). " - "If you would like to enable call-time pass-by-reference, you can set " - "allow_call_time_pass_reference to true in your INI file. " - "However, future versions may not support this any longer. ", - (function_ptr?function_ptr->common.function_name:"[runtime function name]"), - offset+1); - } - - if (function_ptr) { - arg_types = function_ptr->common.arg_types; - } else { - arg_types = NULL; - } - - send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(offset, 1, arg_types)?ZEND_ARG_SEND_BY_REF:0; - - - if (op == ZEND_SEND_VAR && zend_is_function_or_method_call(param)) { - /* Method call */ - op = ZEND_SEND_VAR_NO_REF; - } else if (op == ZEND_SEND_VAL && param->op_type == IS_VAR) { - op = ZEND_SEND_VAR_NO_REF; - } - - if (op!=ZEND_SEND_VAR_NO_REF && send_by_reference == ZEND_ARG_SEND_BY_REF) { - /* change to passing by reference */ - switch (param->op_type) { - case IS_VAR: - op = ZEND_SEND_REF; - break; - default: - zend_error(E_COMPILE_ERROR, "Only variables can be passed by reference"); - break; - } - } - - if (original_op == ZEND_SEND_VAR) { - switch (op) { - case ZEND_SEND_VAR_NO_REF: - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); - break; - case ZEND_SEND_VAR: - if (function_ptr) { - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); - } else { - zend_do_end_variable_parse(BP_VAR_FUNC_ARG, offset TSRMLS_CC); - } - break; - case ZEND_SEND_REF: - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); - break; - } - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - if (op == ZEND_SEND_VAR_NO_REF) { - if (function_ptr) { - opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND | send_by_reference; - } else { - opline->extended_value = 0; - } - } else { - if (function_ptr) { - opline->extended_value = ZEND_DO_FCALL; - } else { - opline->extended_value = ZEND_DO_FCALL_BY_NAME; - } - } - opline->opcode = op; - opline->op1 = *param; - opline->op2.u.opline_num = offset; - SET_UNUSED(opline->op2); -} - - -static int generate_free_switch_expr(zend_switch_entry *switch_entry TSRMLS_DC) -{ - zend_op *opline; - - if (switch_entry->cond.op_type!=IS_VAR && switch_entry->cond.op_type!=IS_TMP_VAR) { - return 1; - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_SWITCH_FREE; - opline->op1 = switch_entry->cond; - SET_UNUSED(opline->op2); - opline->extended_value = 0; - return 0; -} - -static int generate_free_foreach_copy(znode *foreach_copy TSRMLS_DC) -{ - zend_op *opline; - - if (foreach_copy->op_type!=IS_VAR && foreach_copy->op_type!=IS_TMP_VAR) { - return 1; - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_SWITCH_FREE; - opline->op1 = *foreach_copy; - SET_UNUSED(opline->op2); - opline->extended_value = 1; - return 0; -} - -void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) -{ - zend_op *opline; - - if (do_end_vparse) { - if (CG(active_op_array)->return_reference && !zend_is_function_or_method_call(expr)) { - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); - } else { - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); - } -#if 0 - } else if (expr && CG(active_op_array)->return_reference) { - zend_error(E_COMPILE_ERROR, "Only variables may be returned by reference"); -#endif - } - -#ifdef ZTS - zend_stack_apply_with_argument(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_switch_expr TSRMLS_CC); - zend_stack_apply_with_argument(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_foreach_copy TSRMLS_CC); -#else - zend_stack_apply(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_switch_expr); - zend_stack_apply(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_foreach_copy); -#endif - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_RETURN; - - if (expr) { - opline->op1 = *expr; - } else { - opline->op1.op_type = IS_CONST; - INIT_ZVAL(opline->op1.u.constant); - } - SET_UNUSED(opline->op2); -} - - -void zend_do_try(znode *try_token TSRMLS_DC) -{ - try_token->throw_list = (void *) CG(throw_list); - CG(throw_list) = (zend_llist *) emalloc(sizeof(zend_llist)); - zend_llist_init(CG(throw_list), sizeof(long), NULL, 0); - /* Initialize try backpatch list used to backpatch throw, do_fcall */ -} - -static void throw_list_applier(long *opline_num, long *catch_opline) -{ - zend_op *opline; - TSRMLS_FETCH(); /* Pass this by argument */ - - opline = &CG(active_op_array)->opcodes[*opline_num]; - - /* Backpatch the opline of the catch statement */ - switch (opline->opcode) { - case ZEND_DO_FCALL: - case ZEND_DO_FCALL_BY_NAME: - case ZEND_THROW: - opline->op2.u.opline_num = *catch_opline; - break; - default: - zend_error(E_COMPILE_ERROR, "Bad opcode in throw list"); - break; - } -} - -void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC) -{ - long catch_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline; - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_CATCH; - opline->op1 = *catch_class; - SET_UNUSED(opline->op1); /* FIXME: Define IS_CLASS or something like that */ - opline->op2 = *catch_var; - - if (first_catch) { - zend_llist_apply_with_argument(CG(throw_list), (llist_apply_with_arg_func_t) throw_list_applier, &CG(catch_begin) TSRMLS_CC); - zend_llist_destroy(CG(throw_list)); - efree(CG(throw_list)); - CG(throw_list) = (void *) try_token->throw_list; - } - try_token->u.opline_num = catch_op_number; -} - -void zend_do_end_catch(znode *try_token TSRMLS_DC) -{ - CG(active_op_array)->opcodes[try_token->u.opline_num].extended_value = get_next_op_number(CG(active_op_array)); -} - -void zend_do_throw(znode *expr TSRMLS_DC) -{ - zend_op *opline; - long throw_op_number = get_next_op_number(CG(active_op_array)); - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_THROW; - opline->op1 = *expr; - SET_UNUSED(opline->op2); - - if (CG(throw_list) != NULL) { - zend_llist_add_element(CG(throw_list), &throw_op_number); - } else { - opline->op2.u.opline_num = -1; - } -} - -ZEND_API void function_add_ref(zend_function *function) -{ - if (function->type == ZEND_USER_FUNCTION) { - zend_op_array *op_array = &function->op_array; - - (*op_array->refcount)++; - if (op_array->static_variables) { - HashTable *static_variables = op_array->static_variables; - zval *tmp_zval; - - ALLOC_HASHTABLE(op_array->static_variables); - zend_hash_init(op_array->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(op_array->static_variables, static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_zval, sizeof(zval *)); - } - } -} - -static void do_inherit_parent_constructor(zend_class_entry *ce) -{ - zend_function *function; - - if (!ce->parent) { - return; - } - if (!ce->__get) { - ce->__get = ce->parent->__get; - } - if (!ce->__set) { - ce->__set = ce->parent->__set; - } - if (!ce->__call) { - ce->__call = ce->parent->__call; - } - ce->create_object = ce->parent->create_object; - if (ce->constructor) { - return; - } - - if (zend_hash_find(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), (void **) &function)==SUCCESS) { - /* inherit parent's constructor */ - zend_hash_update(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), function, sizeof(zend_function), NULL); - function_add_ref(function); - } else { - /* don't inherit the old style constructor if we already have the new style cconstructor */ - if (!zend_hash_exists(&ce->function_table, ce->name, ce->name_length+1)) { - if (zend_hash_find(&ce->parent->function_table, ce->parent->name, ce->parent->name_length+1, (void **) &function)==SUCCESS) { - /* inherit parent's constructor */ - zend_hash_update(&ce->function_table, ce->name, ce->name_length+1, function, sizeof(zend_function), NULL); - function_add_ref(function); - } - } - } - ce->constructor = ce->parent->constructor; -} - - -char *zend_visibility_string(zend_uint fn_flags) -{ - if (fn_flags & ZEND_ACC_PRIVATE) { - return "private"; - } - if (fn_flags & ZEND_ACC_PROTECTED) { - return "protected"; - } - if (fn_flags & ZEND_ACC_PUBLIC) { - return "public"; - } - return ""; -} - - -static void do_inherit_method(zend_function *function) -{ - /* The class entry of the derived function intentionally remains the same - * as that of the parent class. That allows us to know in which context - * we're running, and handle private method calls properly. - */ - function_add_ref(function); -} - - -static zend_bool zend_do_perform_implementation_check(zend_function *fe) -{ - zend_op *op, *proto_op; - - if (!fe->common.prototype) { - return 1; - } - - if ((fe->common.arg_types && !fe->common.prototype->common.arg_types) - || (!fe->common.arg_types && fe->common.prototype->common.arg_types)) { - return 0; - } - - if (fe->common.arg_types) { - if (fe->common.arg_types[0] != fe->common.prototype->common.arg_types[0]) { - return 0; - } - if (memcmp(fe->common.arg_types+1, fe->common.prototype->common.arg_types+1, fe->common.arg_types[0]*sizeof(zend_uchar)) != 0) { - return 0; - } - } - - if (fe->common.prototype->type == ZEND_INTERNAL_FUNCTION) { - return 1; /* nothing further we can do here */ - } - - op = fe->op_array.opcodes; - proto_op = fe->common.prototype->op_array.opcodes; - - while (proto_op->opcode != ZEND_RAISE_ABSTRACT_ERROR) { - if (proto_op->opcode != op->opcode) { - return 0; - } - switch (proto_op->opcode) { - case ZEND_FETCH_CLASS: - if (zend_binary_zval_strcasecmp(&op->op2.u.constant, &proto_op->op2.u.constant)!=0) { - return 0; - } - break; - } - proto_op++; - op++; - } - return 1; -} - - -static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_function *parent, zend_hash_key *hash_key, zend_class_entry *child_ce) -{ - zend_uint child_flags; - zend_uint parent_flags = parent->common.fn_flags; - zend_function *child; - - if (zend_hash_quick_find(child_function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child)==FAILURE) { - if (parent_flags & ZEND_ACC_ABSTRACT) { - child_ce->ce_flags |= ZEND_ACC_ABSTRACT; - } - return 1; /* method doesn't exist in child, copy from parent */ - } - - if (parent_flags & ZEND_ACC_FINAL) { - zend_error(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name); - } - - child_flags = child->common.fn_flags; - /* You cannot change from static to non static and vice versa. - */ - if ((child_flags & ZEND_ACC_STATIC) != (parent_flags & ZEND_ACC_STATIC)) { - if (child->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); - } else { - zend_error(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); - } - } - - /* Disallow making an inherited method abstract. */ - if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) { - zend_error(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); - } - - if (parent_flags & ZEND_ACC_CHANGED) { - child->common.fn_flags |= ZEND_ACC_CHANGED; - } else { - /* Prevent derived classes from restricting access that was available in parent classes - */ - if ((child_flags & ZEND_ACC_PPP_MASK) > (parent_flags & ZEND_ACC_PPP_MASK)) { - zend_error(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); - } else if (((child_flags & ZEND_ACC_PPP_MASK) < (parent_flags & ZEND_ACC_PPP_MASK)) - && ((parent_flags & ZEND_ACC_PPP_MASK) & ZEND_ACC_PRIVATE)) { - child->common.fn_flags |= ZEND_ACC_CHANGED; - } - } - - if (parent_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_ABSTRACT)) { - child->common.prototype = parent; - } else if (parent->common.prototype) { - child->common.prototype = parent->common.prototype; - } - - if (!zend_do_perform_implementation_check(child)) { - zend_error(E_COMPILE_ERROR, "Declaration of %s::%s() must be the same as %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name); - } - - return 0; -} - - -static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_property_info *parent_info, zend_hash_key *hash_key, zend_class_entry *ce) -{ - zend_property_info *child_info; - zend_class_entry *parent_ce = ce->parent; - - if (parent_info->flags & ZEND_ACC_PRIVATE) { - if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) { - child_info->flags |= ZEND_ACC_CHANGED; - } - return 0; /* don't copy access information to child */ - } - - if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) { - if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) { - zend_error(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); - } else if (child_info->flags & ZEND_ACC_IMPLICIT_PUBLIC) { - /* Explicitly copy the value from the parent */ - zval **pvalue; - - if (zend_hash_quick_find(&parent_ce->default_properties, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &pvalue)==SUCCESS) { - zend_hash_quick_update(&ce->default_properties, hash_key->arKey, hash_key->nKeyLength, hash_key->h, pvalue, sizeof(zval *), NULL); - (*pvalue)->refcount++; - } - return 1; /* Inherit from the parent */ - } - return 0; /* Don't copy from parent */ - } else { - return 1; /* Copy from parent */ - } -} - - -void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) -{ - if ((ce->ce_flags & ZEND_ACC_INTERFACE) - && !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) { - zend_error(E_ERROR, "Interface %s may not inherit from class (%s)", ce->name, parent_ce->name); - } - - ce->parent = parent_ce; - - /* Inherit properties */ - zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0); - zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) zend_duplicate_property_info, sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce); - - /* STATIC_MEMBERS_FIXME */ -/* zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); */ - zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0); - zend_hash_merge_ex(&ce->function_table, &parent_ce->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce); - do_inherit_parent_constructor(ce); -} - - -void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface) -{ - zend_hash_merge(&ce->constants_table, &iface->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0); - zend_hash_merge_ex(&ce->function_table, &iface->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce); -} - - -ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time) -{ - zend_function *function; - - if (opline->opcode != ZEND_DECLARE_FUNCTION) { - zend_error(E_COMPILE_ERROR, "Internal compiler error. Please report!"); - } - - zend_hash_find(function_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void *) &function); - if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), NULL)==FAILURE) { - int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR; - zend_function *function; - - if (zend_hash_find(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void *) &function)==SUCCESS - && function->type==ZEND_USER_FUNCTION - && ((zend_op_array *) function)->last>0) { - zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)", - opline->op2.u.constant.value.str.val, - ((zend_op_array *) function)->filename, - ((zend_op_array *) function)->opcodes[0].lineno); - } else { - zend_error(error_level, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val); - } - return FAILURE; - } else { - (*function->op_array.refcount)++; - function->op_array.static_variables = NULL; /* NULL out the unbound function */ - return SUCCESS; - } -} - - -ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *function_table, HashTable *class_table TSRMLS_DC) -{ - zend_class_entry *ce, **pce; - - if (zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &pce)==FAILURE) { - zend_error(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", opline->op1.u.constant.value.str.val); - return NULL; - } else { - ce = *pce; - } - ce->refcount++; - if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, &ce, sizeof(zend_class_entry *), NULL)==FAILURE) { - ce->refcount--; - zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val); - return NULL; - } else { - return ce; - } -} - -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_class_entry *ce, **pce; - int found_ce; - - found_ce = zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &pce); - - if (found_ce == FAILURE) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val); - return NULL; - } else { - ce = *pce; - } - - zend_do_inheritance(ce, parent_ce); - - ce->refcount++; - - /* Register the derived class */ - if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, pce, sizeof(zend_class_entry *), NULL)==FAILURE) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val); - ce->refcount--; - zend_hash_destroy(&ce->function_table); - zend_hash_destroy(&ce->default_properties); - zend_hash_destroy(&ce->properties_info); - zend_hash_destroy(ce->static_members); - zend_hash_destroy(&ce->constants_table); - return NULL; - } - return ce; -} - - -void zend_do_early_binding(TSRMLS_D) -{ - zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; - - while (opline->opcode == ZEND_TICKS && opline > CG(active_op_array)->opcodes) { - opline--; - } - - if (do_bind_function(opline, CG(function_table), CG(class_table), 1) == FAILURE) { - return; - } - - zend_hash_del(CG(function_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len); - zval_dtor(&opline->op1.u.constant); - zval_dtor(&opline->op2.u.constant); - opline->opcode = ZEND_NOP; - memset(&opline->op1, 0, sizeof(znode)); - memset(&opline->op2, 0, sizeof(znode)); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMPNZ_EX; - if (expr1->op_type == IS_TMP_VAR) { - opline->result = *expr1; - } else { - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - } - opline->op1 = *expr1; - SET_UNUSED(opline->op2); - - op_token->u.opline_num = next_op_number; - - *expr1 = opline->result; -} - - -void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - *result = *expr1; /* we saved the original result in expr1 */ - opline->opcode = ZEND_BOOL; - opline->result = *result; - opline->op1 = *expr2; - SET_UNUSED(opline->op2); - - CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); -} - - -void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMPZ_EX; - if (expr1->op_type == IS_TMP_VAR) { - opline->result = *expr1; - } else { - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - } - opline->op1 = *expr1; - SET_UNUSED(opline->op2); - - op_token->u.opline_num = next_op_number; - - *expr1 = opline->result; -} - - -void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - *result = *expr1; /* we saved the original result in expr1 */ - opline->opcode = ZEND_BOOL; - opline->result = *result; - opline->op1 = *expr2; - SET_UNUSED(opline->op2); - - CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); -} - - -void zend_do_do_while_begin(TSRMLS_D) -{ - do_begin_loop(TSRMLS_C); - INC_BPC(CG(active_op_array)); -} - - -void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMPNZ; - opline->op1 = *expr; - opline->op2.u.opline_num = do_token->u.opline_num; - SET_UNUSED(opline->op2); - - do_end_loop(expr_open_bracket->u.opline_num TSRMLS_CC); - - DEC_BPC(CG(active_op_array)); -} - - -void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = op; - opline->op1.u.opline_num = CG(active_op_array)->current_brk_cont; - SET_UNUSED(opline->op1); - if (expr) { - opline->op2 = *expr; - } else { - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = 1; - INIT_PZVAL(&opline->op2.u.constant); - opline->op2.op_type = IS_CONST; - } -} - - -void zend_do_switch_cond(znode *cond TSRMLS_DC) -{ - zend_switch_entry switch_entry; - zend_op *opline; - - /* Initialize the conditional value */ - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_BOOL; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - opline->op1.op_type = IS_CONST; - opline->op1.u.constant.type = IS_BOOL; - opline->op1.u.constant.value.lval = 0; - INIT_PZVAL(&opline->op1.u.constant); - SET_UNUSED(opline->op2); - - switch_entry.cond = *cond; - switch_entry.default_case = -1; - switch_entry.control_var = opline->result.u.var; - zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry)); - - do_begin_loop(TSRMLS_C); - - INC_BPC(CG(active_op_array)); -} - - - -void zend_do_switch_end(znode *case_list TSRMLS_DC) -{ - zend_op *opline; - zend_switch_entry *switch_entry_ptr; - - zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr); - - if (case_list->op_type != IS_UNUSED) { /* non-empty switch */ - int next_op_number = get_next_op_number(CG(active_op_array)); - - CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number; - } - - /* add code to jmp to default case */ - if (switch_entry_ptr->default_case != -1) { - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_JMPZ; - opline->op1.op_type = IS_TMP_VAR; - opline->op1.u.var = switch_entry_ptr->control_var; - opline->op2.u.opline_num = switch_entry_ptr->default_case; - SET_UNUSED(opline->op2); - } - - - /* remember break/continue loop information */ - CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array)); - CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent; - - if (switch_entry_ptr->cond.op_type==IS_VAR || switch_entry_ptr->cond.op_type==IS_TMP_VAR) { - /* emit free for the switch condition*/ - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_SWITCH_FREE; - opline->op1 = switch_entry_ptr->cond; - SET_UNUSED(opline->op2); - } - if (switch_entry_ptr->cond.op_type == IS_CONST) { - zval_dtor(&switch_entry_ptr->cond.u.constant); - } - - zend_stack_del_top(&CG(switch_cond_stack)); - - DEC_BPC(CG(active_op_array)); -} - - -void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - int next_op_number; - zend_switch_entry *switch_entry_ptr; - znode result; - - zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr); - - opline->opcode = ZEND_CASE; - opline->result.u.var = switch_entry_ptr->control_var; - opline->result.op_type = IS_TMP_VAR; - opline->op1 = switch_entry_ptr->cond; - opline->op2 = *case_expr; - if (opline->op1.op_type == IS_CONST) { - zval_copy_ctor(&opline->op1.u.constant); - } - result = opline->result; - - next_op_number = get_next_op_number(CG(active_op_array)); - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_JMPZ; - opline->op1 = result; - SET_UNUSED(opline->op2); - case_token->u.opline_num = next_op_number; - - if (case_list->op_type==IS_UNUSED) { - return; - } - next_op_number = get_next_op_number(CG(active_op_array)); - CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number; -} - - -void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMP; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - result->u.opline_num = next_op_number; - - switch (CG(active_op_array)->opcodes[case_token->u.opline_num].opcode) { - case ZEND_JMP: - CG(active_op_array)->opcodes[case_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array)); - break; - case ZEND_JMPZ: - CG(active_op_array)->opcodes[case_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - break; - } -} - - - -void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - zend_switch_entry *switch_entry_ptr; - - zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr); - - opline->opcode = ZEND_JMP; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - default_token->u.opline_num = next_op_number; - - next_op_number = get_next_op_number(CG(active_op_array)); - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_BOOL; - opline->result.u.var = switch_entry_ptr->control_var; - opline->result.op_type = IS_TMP_VAR; - opline->op1.op_type = IS_CONST; - opline->op1.u.constant.type = IS_BOOL; - opline->op1.u.constant.value.lval = 1; - INIT_PZVAL(&opline->op1.u.constant); - SET_UNUSED(opline->op2); - switch_entry_ptr->default_case = next_op_number; - - if (case_list->op_type==IS_UNUSED) { - return; - } - next_op_number = get_next_op_number(CG(active_op_array)); - CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number; -} - - -void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC) -{ - zend_op *opline; - int doing_inheritance = 0; - zend_class_entry *new_class_entry = emalloc(sizeof(zend_class_entry)); - - zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); - - if (!(strcmp(class_name->u.constant.value.str.val, "main") && strcmp(class_name->u.constant.value.str.val, "self") && - strcmp(class_name->u.constant.value.str.val, "parent"))) { - zend_error(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", class_name->u.constant.value.str.val); - } - - new_class_entry->type = ZEND_USER_CLASS; - new_class_entry->name = class_name->u.constant.value.str.val; - new_class_entry->name_length = class_name->u.constant.value.str.len; - - zend_initialize_class_data(new_class_entry, 1 TSRMLS_CC); - new_class_entry->filename = zend_get_compiled_filename(TSRMLS_C); - new_class_entry->line_start = zend_get_compiled_lineno(TSRMLS_C); - new_class_entry->ce_flags |= class_token->u.constant.value.lval; - - if (parent_class_name->op_type != IS_UNUSED) { - doing_inheritance = 1; - } - - zend_str_tolower(new_class_entry->name, new_class_entry->name_length); - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->op1.op_type = IS_CONST; - build_runtime_defined_function_key(&opline->op1.u.constant, new_class_entry->name, new_class_entry->name_length, opline TSRMLS_CC); - - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_STRING; - opline->op2.u.constant.refcount = 1; - - if (doing_inheritance) { - opline->extended_value = parent_class_name->u.var; - opline->opcode = ZEND_DECLARE_INHERITED_CLASS; - } else { - opline->opcode = ZEND_DECLARE_CLASS; - } - - opline->op2.u.constant.value.str.val = estrndup(new_class_entry->name, new_class_entry->name_length); - opline->op2.u.constant.value.str.len = new_class_entry->name_length; - - zend_hash_update(CG(class_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &new_class_entry, sizeof(zend_class_entry *), NULL); - CG(active_class_entry) = new_class_entry; - - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_CONST; - CG(implementing_class) = opline->result; - - if (CG(doc_comment)) { - CG(active_class_entry)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len)); - CG(active_class_entry)->doc_comment_len = CG(doc_comment_len); - RESET_DOC_COMMENT(); - } -} - - -static void do_verify_abstract_class(TSRMLS_D) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_VERIFY_ABSTRACT_CLASS; - opline->op1 = CG(implementing_class); -} - - -void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRMLS_DC) -{ - do_inherit_parent_constructor(CG(active_class_entry)); - - CG(active_class_entry)->line_end = zend_get_compiled_lineno(TSRMLS_C); - - if (CG(active_class_entry)->num_interfaces > 0) { - CG(active_class_entry)->interfaces = (zend_class_entry **) emalloc(sizeof(zend_class_entry *)*CG(active_class_entry)->num_interfaces); - } - if (!(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) - && !(CG(active_class_entry)->ce_flags & ZEND_ACC_ABSTRACT_CLASS) - && ((parent_token->op_type != IS_UNUSED) || (CG(active_class_entry)->num_interfaces > 0))) { - do_verify_abstract_class(TSRMLS_C); - } - CG(active_class_entry) = NULL; -} - - -void zend_do_implements_interface(znode *interface_znode TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_ADD_INTERFACE; - opline->op1 = CG(implementing_class); - opline->op2 = *interface_znode; - opline->extended_value = CG(active_class_entry)->num_interfaces++; -} - - -void mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length) -{ - char *prop_name; - int prop_name_length; - - prop_name_length = 1 + src1_length + 1 + src2_length; - prop_name = emalloc(prop_name_length+1); - prop_name[0] = '\0'; - memcpy(prop_name + 1, src1, src1_length+1); - memcpy(prop_name + 1 + src1_length + 1, src2, src2_length+1); - - *dest = prop_name; - *dest_length = prop_name_length; -} - - -void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC) -{ - zval *property; - zend_property_info property_info; - zend_property_info *existing_property_info; - HashTable *target_symbol_table; - zend_bool free_var_name = 0; - - if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { - zend_error(E_COMPILE_ERROR, "Interfaces may not include member variables"); - } - - if (access_type & ZEND_ACC_ABSTRACT) { - zend_error(E_COMPILE_ERROR, "Properties cannot be declared abstract"); - } - - if (access_type & ZEND_ACC_FINAL) { - zend_error(E_COMPILE_ERROR, "Cannot declare property $%s::%s final, the final modifier is allowed only for methods", - CG(active_class_entry)->name, var_name->u.constant.value.str.val); - } - - if (!(access_type & ZEND_ACC_PPP_MASK)) { - access_type |= ZEND_ACC_PUBLIC; - } - - if (zend_hash_find(&CG(active_class_entry)->properties_info, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, (void **) &existing_property_info)==SUCCESS) { - if (!(existing_property_info->flags & ZEND_ACC_IMPLICIT_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", CG(active_class_entry)->name, var_name->u.constant.value.str.val); - } - } - ALLOC_ZVAL(property); - - if (value) { - *property = value->u.constant; - } else { - INIT_PZVAL(property); - property->type = IS_NULL; - } - - if (access_type & ZEND_ACC_STATIC) { - target_symbol_table = CG(active_class_entry)->static_members; - } else { - target_symbol_table = &CG(active_class_entry)->default_properties; - } - - switch (access_type & ZEND_ACC_PPP_MASK) { - case ZEND_ACC_PRIVATE: { - char *priv_name; - int priv_name_length; - - mangle_property_name(&priv_name, &priv_name_length, CG(active_class_entry)->name, CG(active_class_entry)->name_length, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len); - free_var_name = 1; - 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; - - mangle_property_name(&prot_name, &prot_name_length, "*", 1, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len); - free_var_name = 1; - 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: - zend_hash_update(target_symbol_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); - property_info.name = var_name->u.constant.value.str.val; - property_info.name_length = var_name->u.constant.value.str.len; - break; - } - property_info.flags = access_type; - property_info.h = zend_get_hash_value(property_info.name, property_info.name_length+1); - - zend_hash_update(&CG(active_class_entry)->properties_info, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property_info, sizeof(zend_property_info), NULL); - if (free_var_name) { - efree(var_name->u.constant.value.str.val); - } -} - - -void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC) -{ - zval *property; - - ALLOC_ZVAL(property); - - if (value) { - *property = value->u.constant; - } else { - INIT_PZVAL(property); - property->type = IS_NULL; - } - - zend_hash_update(&CG(active_class_entry)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); - - FREE_PNODE(var_name); -} - - - -void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC) -{ - zend_op opline; - zend_llist *fetch_list_ptr; - zend_op *opline_ptr=NULL; - - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - - if (fetch_list_ptr->count == 1) { - zend_llist_element *le; - - le = fetch_list_ptr->head; - opline_ptr = (zend_op *) le->data; - - if ((opline_ptr->op1.op_type == IS_CONST) && (opline_ptr->op1.u.constant.type == IS_STRING) && - (opline_ptr->op1.u.constant.value.str.len == (sizeof("this")-1)) && - !memcmp(opline_ptr->op1.u.constant.value.str.val, "this", sizeof("this"))) { - efree(opline_ptr->op1.u.constant.value.str.val); - SET_UNUSED(opline_ptr->op1); /* this means $this for objects */ - opline_ptr->op2 = *property; - /* if it was usual fetch, we change it to object fetch */ - switch (opline_ptr->opcode) { - case ZEND_FETCH_W: - opline_ptr->opcode = ZEND_FETCH_OBJ_W; - break; - case ZEND_FETCH_R: - opline_ptr->opcode = ZEND_FETCH_OBJ_R; - break; - case ZEND_FETCH_RW: - opline_ptr->opcode = ZEND_FETCH_OBJ_RW; - break; - case ZEND_FETCH_IS: - opline_ptr->opcode = ZEND_FETCH_OBJ_IS; - break; - case ZEND_FETCH_UNSET: - opline_ptr->opcode = ZEND_FETCH_OBJ_UNSET; - break; - case ZEND_FETCH_FUNC_ARG: - opline_ptr->opcode = ZEND_FETCH_OBJ_FUNC_ARG; - break; - } - *result = opline_ptr->result; - if (CG(active_class_entry) - && property->op_type == IS_CONST - && !zend_hash_exists(&CG(active_class_entry)->properties_info, property->u.constant.value.str.val, property->u.constant.value.str.len+1)) { - property->u.constant.value.str.val = estrndup(property->u.constant.value.str.val, property->u.constant.value.str.len); - zend_do_declare_property(property, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_IMPLICIT_PUBLIC TSRMLS_CC); - } - return; - } - } - - init_op(&opline TSRMLS_CC); - opline.opcode = ZEND_FETCH_OBJ_W; /* the backpatching routine assumes W */ - opline.result.op_type = IS_VAR; - opline.result.u.EA.type = 0; - opline.result.u.var = get_temporary_variable(CG(active_op_array)); - opline.op1 = *object; - opline.op2 = *property; - *result = opline.result; - - zend_llist_add_element(fetch_list_ptr, &opline); -} - - -void zend_do_push_object(znode *object TSRMLS_DC) -{ - zend_stack_push(&CG(object_stack), object, sizeof(znode)); -} - - -void zend_do_pop_object(znode *object TSRMLS_DC) -{ - znode *tmp; - - zend_stack_top(&CG(object_stack), (void **) &tmp); - *object = *tmp; - zend_stack_del_top(&CG(object_stack)); -} - - -void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - unsigned char *ptr = NULL; - - opline->opcode = ZEND_NEW; - opline->result.op_type = IS_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *class_type; - SET_UNUSED(opline->op2); - - new_token->u.opline_num = get_next_op_number(CG(active_op_array)); - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_JMP_NO_CTOR; - opline->op1 = (opline-1)->result; - SET_UNUSED(opline->op2); - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_INIT_CTOR_CALL; - opline->op1 = (opline-2)->result; - SET_UNUSED(opline->op2); - - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *)); -} - - -void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC) -{ - znode ctor_result; - - zend_do_end_function_call(NULL, &ctor_result, argument_list, 1, 0 TSRMLS_CC); - zend_do_free(&ctor_result TSRMLS_CC); - - CG(active_op_array)->opcodes[new_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - *result = CG(active_op_array)->opcodes[new_token->u.opline_num].op1; -} - -void zend_do_fold_constant(znode *result, znode *constant_name TSRMLS_DC) -{ - zval **zresult; - - if (zend_hash_find(&CG(active_class_entry)->constants_table, constant_name->u.constant.value.str.val, - constant_name->u.constant.value.str.len+1, (void **) &zresult) != SUCCESS) { - if (zend_get_constant(constant_name->u.constant.value.str.val, constant_name->u.constant.value.str.len, &result->u.constant TSRMLS_CC)) { - return; - } else { - zend_error(E_COMPILE_ERROR, "Cannot find %s constant in class %s\n", - constant_name->u.constant.value.str.val, CG(active_class_entry)->name); - } - } - - result->u.constant = **zresult; - zval_copy_ctor(&result->u.constant); -} - -void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC) -{ - switch (mode) { - case ZEND_CT: - if (constant_container) { - zend_do_fetch_class_name(NULL, constant_container, constant_name, 1 TSRMLS_CC); - *result = *constant_container; - } else { - *result = *constant_name; - } - result->u.constant.type = IS_CONSTANT; - break; - case ZEND_RT: - { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_FETCH_CONSTANT; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - if (constant_container) { - opline->op1 = *constant_container; - } else { - SET_UNUSED(opline->op1); - } - opline->op2 = *constant_name; - *result = opline->result; - } - break; - } -} - - -void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - switch (cmd->op_type) { - case IS_TMP_VAR: - opline->opcode = ZEND_SEND_VAL; - break; - default: - opline->opcode = ZEND_SEND_VAR; - break; - } - opline->op1 = *cmd; - opline->op2.u.opline_num = 0; - opline->extended_value = ZEND_DO_FCALL; - SET_UNUSED(opline->op2); - - /* FIXME: exception support not added to this op2 */ - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_DO_FCALL; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_VAR; - opline->op1.u.constant.value.str.val = estrndup("shell_exec", sizeof("shell_exec")-1); - opline->op1.u.constant.value.str.len = sizeof("shell_exec")-1; - INIT_PZVAL(&opline->op1.u.constant); - opline->op1.u.constant.type = IS_STRING; - opline->op1.op_type = IS_CONST; - opline->extended_value = 1; - SET_UNUSED(opline->op2); - *result = opline->result; -} - - - -void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_INIT_ARRAY; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - *result = opline->result; - if (expr) { - opline->op1 = *expr; - if (offset) { - opline->op2 = *offset; - } else { - SET_UNUSED(opline->op2); - } - } else { - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - } - opline->extended_value = is_ref; -} - - -void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_ADD_ARRAY_ELEMENT; - opline->result = *result; - opline->op1 = *expr; - if (offset) { - opline->op2 = *offset; - } else { - SET_UNUSED(opline->op2); - } - opline->extended_value = is_ref; -} - - - -void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr) -{ - zval *element; - - ALLOC_ZVAL(element); - *element = expr->u.constant; - if (offset) { - switch (offset->u.constant.type) { - case IS_CONSTANT: - /* Ugly hack to denote that this value has a constant index */ - element->type |= IS_CONSTANT_INDEX; - /* break missing intentionally */ - case IS_STRING: - zend_hash_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL); - zval_dtor(&offset->u.constant); - break; - case IS_LONG: - zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL); - break; - } - } else { - zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL); - } -} - - -void zend_do_add_list_element(znode *element TSRMLS_DC) -{ - list_llist_element lle; - - if (element) { - zend_check_writable_variable(element); - - lle.var = *element; - zend_llist_copy(&lle.dimensions, &CG(dimension_llist)); - zend_llist_prepend_element(&CG(list_llist), &lle); - } - (*((int *)CG(dimension_llist).tail->data))++; -} - - -void zend_do_new_list_begin(TSRMLS_D) -{ - int current_dimension = 0; - zend_llist_add_element(&CG(dimension_llist), ¤t_dimension); -} - - -void zend_do_new_list_end(TSRMLS_D) -{ - zend_llist_remove_tail(&CG(dimension_llist)); - (*((int *)CG(dimension_llist).tail->data))++; -} - - -void zend_do_list_init(TSRMLS_D) -{ - zend_stack_push(&CG(list_stack), &CG(list_llist), sizeof(zend_llist)); - zend_stack_push(&CG(list_stack), &CG(dimension_llist), sizeof(zend_llist)); - zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0); - zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0); - zend_do_new_list_begin(TSRMLS_C); -} - - -void zend_do_list_end(znode *result, znode *expr TSRMLS_DC) -{ - zend_llist_element *le; - zend_llist_element *dimension; - zend_op *opline; - znode last_container; - - le = CG(list_llist).head; - while (le) { - zend_llist *tmp_dimension_llist = &((list_llist_element *)le->data)->dimensions; - dimension = tmp_dimension_llist->head; - while (dimension) { - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - if (dimension == tmp_dimension_llist->head) { /* first */ - last_container = *expr; - switch (expr->op_type) { - case IS_VAR: - opline->opcode = ZEND_FETCH_DIM_R; - break; - case IS_TMP_VAR: - opline->opcode = ZEND_FETCH_DIM_TMP_VAR; - break; - case IS_CONST: /* fetch_dim_tmp_var will handle this bogus fetch */ - zval_copy_ctor(&expr->u.constant); - opline->opcode = ZEND_FETCH_DIM_TMP_VAR; - break; - } - } else { - opline->opcode = ZEND_FETCH_DIM_R; - } - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = last_container; - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = *((int *) dimension->data); - INIT_PZVAL(&opline->op2.u.constant); - opline->extended_value = ZEND_FETCH_ADD_LOCK; - last_container = opline->result; - dimension = dimension->next; - } - ((list_llist_element *) le->data)->value = last_container; - zend_llist_destroy(&((list_llist_element *) le->data)->dimensions); - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); - zend_do_assign(result, &((list_llist_element *) le->data)->var, &((list_llist_element *) le->data)->value TSRMLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; - le = le->next; - } - zend_llist_destroy(&CG(dimension_llist)); - zend_llist_destroy(&CG(list_llist)); - *result = *expr; - { - zend_llist *p; - - /* restore previous lists */ - zend_stack_top(&CG(list_stack), (void **) &p); - CG(dimension_llist) = *p; - zend_stack_del_top(&CG(list_stack)); - zend_stack_top(&CG(list_stack), (void **) &p); - CG(list_llist) = *p; - zend_stack_del_top(&CG(list_stack)); - } -} - -void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC) -{ - zval *tmp; - zend_op *opline; - znode lval; - znode result; - - ALLOC_ZVAL(tmp); - convert_to_string(&varname->u.constant); - if (static_assignment) { - *tmp = static_assignment->u.constant; - } else { - INIT_ZVAL(*tmp); - } - if (!CG(active_op_array)->static_variables) { - ALLOC_HASHTABLE(CG(active_op_array)->static_variables); - zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0); - } - zend_hash_update(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1, &tmp, sizeof(zval *), NULL); - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *varname; - SET_UNUSED(opline->op2); - opline->op2.u.EA.type = fetch_type; - result = opline->result; - - if (varname->op_type == IS_CONST) { - zval_copy_ctor(&varname->u.constant); - } - fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */ - - zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; - -/* zval_dtor(&varname->u.constant); */ -} - -void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC) -{ - zend_op *opline; - znode lval; - znode result; - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *varname; - SET_UNUSED(opline->op2); - opline->op2.u.EA.type = fetch_type; - result = opline->result; - - if (varname->op_type == IS_CONST) { - zval_copy_ctor(&varname->u.constant); - } - fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */ - - zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; -} - - -void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_CAST; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *expr; - SET_UNUSED(opline->op2); - opline->extended_value = type; - *result = opline->result; -} - - -void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC) -{ - zend_do_extended_fcall_begin(TSRMLS_C); - { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_INCLUDE_OR_EVAL; - opline->result.op_type = IS_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - SET_UNUSED(opline->op2); - opline->op2.u.constant.value.lval = type; - *result = opline->result; - } - zend_do_extended_fcall_end(TSRMLS_C); -} - - -void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC) -{ - int i; - - zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); - for (i=1; iu.constant.value.lval; i++) { - fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC); - *variable = *result; - } - zend_do_begin_variable_parse(TSRMLS_C); - fetch_simple_variable(result, variable, 1 TSRMLS_CC); -} - - -void zend_do_unset(znode *variable TSRMLS_DC) -{ - zend_op *last_op; - - zend_check_writable_variable(variable); - - last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1]; - - switch (last_op->opcode) { - case ZEND_FETCH_UNSET: - last_op->opcode = ZEND_UNSET_VAR; - break; - case ZEND_FETCH_DIM_UNSET: - case ZEND_FETCH_OBJ_UNSET: - last_op->opcode = ZEND_UNSET_DIM_OBJ; - break; - - } -} - - -void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC) -{ - zend_op *last_op; - - zend_do_end_variable_parse(BP_VAR_IS, 0 TSRMLS_CC); - - zend_check_writable_variable(variable); - - last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1]; - - switch (last_op->opcode) { - case ZEND_FETCH_IS: - last_op->opcode = ZEND_ISSET_ISEMPTY_VAR; - break; - case ZEND_FETCH_DIM_IS: - case ZEND_FETCH_OBJ_IS: - last_op->opcode = ZEND_ISSET_ISEMPTY_DIM_OBJ; - break; - } - last_op->result.op_type = IS_TMP_VAR; - last_op->extended_value = type; - - *result = last_op->result; -} - - -void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_INSTANCEOF; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *expr; - - opline->op2 = *class_znode; - - *result = opline->result; -} - - -void zend_do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token, int variable TSRMLS_DC) -{ - zend_op *opline; - zend_bool is_variable; - - if (variable) { - if (zend_is_function_or_method_call(array)) { - is_variable = 0; - } else { - is_variable = 1; - } - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); - } else { - is_variable = 0; - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - /* Preform array reset */ - opline->opcode = ZEND_FE_RESET; - opline->result.op_type = IS_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *array; - SET_UNUSED(opline->op2); - opline->extended_value = is_variable; - *open_brackets_token = opline->result; - - zend_stack_push(&CG(foreach_copy_stack), (void *) &opline->result, sizeof(znode)); - - /* save the location of the beginning of the loop (array fetching) */ - foreach_token->u.opline_num = get_next_op_number(CG(active_op_array)); - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_FE_FETCH; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *open_brackets_token; - SET_UNUSED(opline->op2); - *as_token = opline->result; -} - - -void zend_do_foreach_cont(znode *value, znode *key, znode *as_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - znode result_value, result_key, dummy; - - if (key->op_type != IS_UNUSED) { - znode *tmp; - - /* switch between the key and value... */ - tmp = key; - key = value; - value = tmp; - } - - opline->opcode = ZEND_FETCH_DIM_TMP_VAR; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.opline_num = get_temporary_variable(CG(active_op_array)); - opline->op1 = *as_token; - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = 0; - opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */ - result_value = opline->result; - - if (key->op_type != IS_UNUSED) { - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_FETCH_DIM_TMP_VAR; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.opline_num = get_temporary_variable(CG(active_op_array)); - opline->op1 = *as_token; - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = 1; - opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */ - result_key = opline->result; - } - - zend_do_assign(&dummy, value, &result_value TSRMLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; - if (key->op_type != IS_UNUSED) { - zend_do_assign(&dummy, key, &result_key TSRMLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; - } - zend_do_free(as_token TSRMLS_CC); - - do_begin_loop(TSRMLS_C); - INC_BPC(CG(active_op_array)); -} - - -void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMP; - opline->op1.u.opline_num = foreach_token->u.opline_num; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - CG(active_op_array)->opcodes[foreach_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - - do_end_loop(foreach_token->u.opline_num TSRMLS_CC); - - generate_free_foreach_copy(open_brackets_token TSRMLS_CC); - - zend_stack_del_top(&CG(foreach_copy_stack)); - - DEC_BPC(CG(active_op_array)); -} - - -void zend_do_declare_begin(TSRMLS_D) -{ - zend_stack_push(&CG(declare_stack), &CG(declarables), sizeof(zend_declarables)); -} - - -void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) -{ - convert_to_string(&var->u.constant); - - if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "ticks", sizeof("ticks")-1)) { - convert_to_long(&val->u.constant); - CG(declarables).ticks = val->u.constant; - } - zval_dtor(&var->u.constant); -} - - -void zend_do_declare_end(znode *declare_token TSRMLS_DC) -{ - zend_declarables *declarables; - - zend_stack_top(&CG(declare_stack), (void **) &declarables); - /* We should restore if there was more than (current - start) - (ticks?1:0) opcodes */ - if ((get_next_op_number(CG(active_op_array)) - declare_token->u.opline_num) - ((CG(declarables).ticks.value.lval)?1:0)) { - CG(declarables) = *declarables; - } -} - - -void zend_do_end_heredoc(TSRMLS_D) -{ - int opline_num = get_next_op_number(CG(active_op_array))-1; - zend_op *opline = &CG(active_op_array)->opcodes[opline_num]; - - if (opline->opcode != ZEND_ADD_STRING) { - return; - } - - opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0; - if (opline->op2.u.constant.value.str.len>0) { - if (opline->op2.u.constant.value.str.val[opline->op2.u.constant.value.str.len-1]=='\r') { - opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0; - } - } -} - - -void zend_do_exit(znode *result, znode *message TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_EXIT; - opline->op1 = *message; - SET_UNUSED(opline->op2); - - result->op_type = IS_CONST; - result->u.constant.type = IS_BOOL; - result->u.constant.value.lval = 1; -} - - -void zend_do_begin_silence(znode *strudel_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_BEGIN_SILENCE; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - *strudel_token = opline->result; -} - - -void zend_do_end_silence(znode *strudel_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_END_SILENCE; - opline->op1 = *strudel_token; - SET_UNUSED(opline->op2); -} - - -void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC) -{ - int jmpz_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline; - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_JMPZ; - opline->op1 = *cond; - SET_UNUSED(opline->op2); - opline->op2.u.opline_num = jmpz_op_number; - *qm_token = opline->op2; - - INC_BPC(CG(active_op_array)); -} - - -void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - CG(active_op_array)->opcodes[qm_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array))+1; /* jmp over the ZEND_JMP */ - - opline->opcode = ZEND_QM_ASSIGN; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *true_value; - SET_UNUSED(opline->op2); - - *qm_token = opline->result; - colon_token->u.opline_num = get_next_op_number(CG(active_op_array)); - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_JMP; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_QM_ASSIGN; - opline->result = *qm_token; - opline->op1 = *false_value; - SET_UNUSED(opline->op2); - - CG(active_op_array)->opcodes[colon_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array)); - - *result = opline->result; - - DEC_BPC(CG(active_op_array)); -} - - -void zend_do_extended_info(TSRMLS_D) -{ - zend_op *opline; - - if (!CG(extended_info)) { - return; - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_EXT_STMT; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void zend_do_extended_fcall_begin(TSRMLS_D) -{ - zend_op *opline; - - if (!CG(extended_info)) { - return; - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_EXT_FCALL_BEGIN; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void zend_do_extended_fcall_end(TSRMLS_D) -{ - zend_op *opline; - - if (!CG(extended_info)) { - return; - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_EXT_FCALL_END; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void zend_do_ticks(TSRMLS_D) -{ - if (CG(declarables).ticks.value.lval) { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_TICKS; - opline->op1.u.constant = CG(declarables).ticks; - opline->op1.op_type = IS_CONST; - SET_UNUSED(opline->op2); - } -} - -void zend_auto_global_dtor(zend_auto_global *auto_global) -{ - free(auto_global->name); -} - - -zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC) -{ - zend_auto_global *auto_global; - - if (zend_hash_find(CG(auto_globals), name, name_len+1, (void **) &auto_global)==SUCCESS) { - if (auto_global->armed) { - auto_global->armed = auto_global->auto_global_callback(auto_global->name, auto_global->name_len TSRMLS_CC); - } - return 1; - } - return 0; -} - - -int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC) -{ - zend_auto_global auto_global; - - auto_global.name = zend_strndup(name, name_len); - auto_global.name_len = name_len; - auto_global.auto_global_callback = auto_global_callback; - - return zend_hash_add(CG(auto_globals), name, name_len+1, &auto_global, sizeof(zend_auto_global), NULL); -} - - -int zendlex(znode *zendlval TSRMLS_DC) -{ - int retval; - - if (CG(increment_lineno)) { - CG(zend_lineno)++; - CG(increment_lineno) = 0; - } - - zendlval->u.constant.type = IS_LONG; - retval = lex_scan(&zendlval->u.constant TSRMLS_CC); - switch (retval) { - case T_COMMENT: - case T_DOC_COMMENT: - case T_OPEN_TAG: - case T_WHITESPACE: - retval = zendlex(zendlval TSRMLS_CC); - break; - case T_CLOSE_TAG: - if (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1]=='\n' - || (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-2]=='\r' && LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1])) { - CG(increment_lineno) = 1; - } - retval = ';'; /* implicit ; */ - break; - case T_OPEN_TAG_WITH_ECHO: - retval = T_ECHO; - break; - case T_END_HEREDOC: - efree(zendlval->u.constant.value.str.val); - break; - } - - INIT_PZVAL(&zendlval->u.constant); - zendlval->op_type = IS_CONST; - return retval; -} - - -void zend_duplicate_property_info(zend_property_info *property_info) -{ - property_info->name = estrndup(property_info->name, property_info->name_length); -} - - -void zend_destroy_property_info(zend_property_info *property_info) -{ - efree(property_info->name); -} - -void zend_init_namespace(zend_namespace *ns TSRMLS_DC) -{ - zend_bool persistent_hashes = (ns->type == ZEND_INTERNAL_NAMESPACE) ? 1 : 0; - - ns->refcount = 1; - ns->constants_updated = 0; - ns->ce_flags = 0; - - ns->filename = NULL; - ns->doc_comment = NULL; - ns->doc_comment_len = 0; - - if (persistent_hashes) { - ns->static_members = (HashTable *) malloc(sizeof(HashTable)); - } else { - ALLOC_HASHTABLE(ns->static_members); - } - zend_hash_init_ex(ns->static_members, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0); - zend_hash_init_ex(&ns->function_table, 10, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0); - zend_hash_init_ex(&ns->class_table, 10, NULL, ZEND_CLASS_DTOR, persistent_hashes, 0); - zend_hash_init_ex(&ns->constants_table, 10, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0); - - ns->parent = NULL; - ns->num_interfaces = 0; - ns->interfaces = NULL; - ns->ns = NULL; - ns->constructor = NULL; - ns->destructor = NULL; - ns->clone = NULL; - ns->__get = NULL; - ns->__set = NULL; - ns->__call = NULL; - ns->create_object = NULL; -} - -void zend_do_begin_namespace(znode *ns_token, znode *ns_name TSRMLS_DC) -{ - zend_namespace *ns, **pns; - zend_op *opline; - - zend_str_tolower(ns_name->u.constant.value.str.val, ns_name->u.constant.value.str.len); - - if(zend_hash_find(&CG(global_namespace).class_table, ns_name->u.constant.value.str.val, ns_name->u.constant.value.str.len+1, (void **)&pns) == SUCCESS) { - ns = *pns; - if(ns->type != ZEND_USER_NAMESPACE || ns == CG(active_namespace)) { - zend_error(E_COMPILE_ERROR, "Cannot redefine namespace '%s' - class or namespace with this name already defined", ns->name); - } - FREE_PNODE(ns_name); - } else { - ns = emalloc(sizeof(zend_namespace)); - ns->name = ns_name->u.constant.value.str.val; - ns->name_length = ns_name->u.constant.value.str.len; - ns->type = ZEND_USER_NAMESPACE; - zend_hash_add(&CG(global_namespace).class_table, ns->name, ns->name_length+1, (void **)&ns, sizeof(zend_namespace *), NULL); - zend_init_namespace(ns TSRMLS_CC); - ns->line_start = zend_get_compiled_lineno(TSRMLS_C); - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_START_NAMESPACE; - opline->op1.op_type = IS_CONST; - opline->op1.u.constant.type = IS_STRING; - opline->op1.u.constant.value.str.val = estrndup(ns->name, ns->name_length); - opline->op1.u.constant.value.str.len = ns->name_length; - opline->op1.u.constant.refcount = 1; - SET_UNUSED(opline->op2); - - - ns_token->u.previously_active_namespace = CG(active_namespace); - CG(active_namespace) = ns; - - if (CG(doc_comment)) { - /* - * Do not overwrite previously declared doc comment in case the namespace is - * split over several parts. - */ - if (CG(active_namespace)->doc_comment == NULL) { - CG(active_namespace)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len)); - CG(active_namespace)->doc_comment_len = CG(doc_comment_len); - } - RESET_DOC_COMMENT(); - } - - /* new symbol tables */ - CG(class_table) = &ns->class_table; - CG(function_table) = &ns->function_table; -} - -void zend_do_end_namespace(znode *ns_token TSRMLS_DC) -{ - zend_namespace *ns = ns_token->u.previously_active_namespace; - zend_op *opline; - - /* - * If the filename field has not been initialized yet, it means that we are - * on the first definition of namespace and should capture the definition - * information. - */ - if (CG(active_namespace)->filename == NULL) { - CG(active_namespace)->filename = zend_get_compiled_filename(TSRMLS_C); - CG(active_namespace)->line_end = zend_get_compiled_lineno(TSRMLS_C); - } - - opline = get_next_op(CG(active_op_array) TSRMLS_CC); - - opline->opcode = ZEND_START_NAMESPACE; - if(ns != &CG(global_namespace)) { - opline->op1.op_type = IS_CONST; - opline->op1.u.constant.type = IS_STRING; - opline->op1.u.constant.value.str.val = estrndup(ns->name, ns->name_length); - opline->op1.u.constant.value.str.len = ns->name_length; - opline->op1.u.constant.refcount = 1; - } else { - SET_UNUSED(opline->op1); - } - SET_UNUSED(opline->op2); - - CG(active_namespace) = ns; - /* restore symbol tables */ - CG(class_table) = &CG(active_namespace)->class_table; - CG(function_table) = &CG(active_namespace)->function_table; -} - -void zend_do_declare_namespace_var(znode *var_name, znode *value TSRMLS_DC) -{ - zval *var; - - ALLOC_ZVAL(var); - - if (value) { - *var = value->u.constant; - } else { - INIT_PZVAL(var); - var->type = IS_NULL; - } - - zend_hash_update(CG(active_namespace)->static_members, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &var, sizeof(zval *), NULL); - - FREE_PNODE(var_name); -} - -void zend_do_declare_namespace_constant(znode *var_name, znode *value TSRMLS_DC) -{ - zval *var; - - ALLOC_ZVAL(var); - - if (value) { - *var = value->u.constant; - } else { - INIT_PZVAL(var); - var->type = IS_NULL; - } - - zend_hash_update(&CG(active_namespace)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &var, sizeof(zval *), NULL); - - FREE_PNODE(var_name); -} - -void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC) -{ - zend_bool persistent_hashes = (ce->type == ZEND_INTERNAL_CLASS) ? 1 : 0; - - ce->refcount = 1; - ce->constants_updated = 0; - ce->ce_flags = 0; - - ce->doc_comment = NULL; - ce->doc_comment_len = 0; - - zend_hash_init_ex(&ce->default_properties, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0); - zend_hash_init_ex(&ce->properties_info, 0, NULL, (dtor_func_t) zend_destroy_property_info, persistent_hashes, 0); - - if (persistent_hashes) { - ce->static_members = (HashTable *) malloc(sizeof(HashTable)); - } else { - ALLOC_HASHTABLE(ce->static_members); - } - zend_hash_init_ex(ce->static_members, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0); - zend_hash_init_ex(&ce->constants_table, 0, NULL, ZVAL_PTR_DTOR, persistent_hashes, 0); - zend_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0); - zend_hash_init_ex(&ce->class_table, 10, NULL, ZEND_CLASS_DTOR, persistent_hashes, 0); - - if (nullify_handlers) { - ce->constructor = NULL; - ce->destructor = NULL; - ce->clone = NULL; - ce->__get = NULL; - ce->__set = NULL; - ce->__call = NULL; - ce->create_object = NULL; - } - - ce->parent = NULL; - ce->num_interfaces = 0; - ce->interfaces = NULL; - ce->ns = CG(active_namespace); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h deleted file mode 100644 index b0cec1e7df..0000000000 --- a/Zend/zend_compile.h +++ /dev/null @@ -1,814 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_COMPILE_H -#define ZEND_COMPILE_H - -#include "zend.h" - -#ifdef HAVE_STDARG_H -# include -#endif - -#include "zend_llist.h" - -#define DEBUG_ZEND 0 - -#define FREE_PNODE(znode) zval_dtor(&znode->u.constant); -#define FREE_OP(Ts, op, should_free) if (should_free) zval_dtor(should_free); - -#define SET_UNUSED(op) (op).op_type = IS_UNUSED - -#define INC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count++); } -#define DEC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count--); } -#define HANDLE_INTERACTIVE() if (CG(interactive)) { execute_new_code(TSRMLS_C); } - -#define RESET_DOC_COMMENT() \ - { \ - CG(doc_comment) = NULL; \ - CG(doc_comment_len) = 0; \ - } - -typedef struct _zend_op_array zend_op_array; -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; - - zend_uint var; - zend_uint opline_num; /* Needs to be signed */ - zend_op_array *op_array; - zend_op *jmp_addr; - struct { - zend_uint var; /* dummy */ - zend_uint type; - } EA; - zend_namespace *previously_active_namespace; - } u; -} znode; - -typedef struct _zend_execute_data zend_execute_data; - -#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 opcode_handler_t zend_opcode_handlers[512]; - -struct _zend_op { - opcode_handler_t handler; - znode result; - znode op1; - znode op2; - ulong extended_value; - uint lineno; - zend_uchar opcode; -}; - - -typedef struct _zend_brk_cont_element { - int cont; - int brk; - int parent; -} zend_brk_cont_element; - - -#define ZEND_ACC_STATIC 0x01 -#define ZEND_ACC_ABSTRACT 0x02 -#define ZEND_ACC_FINAL 0x04 -#define ZEND_ACC_INTERFACE 0x08 -#define ZEND_ACC_ABSTRACT_CLASS 0x10 - -/* The order of those must be kept - public < protected < private */ -#define ZEND_ACC_PUBLIC 0x100 -#define ZEND_ACC_PROTECTED 0x200 -#define ZEND_ACC_PRIVATE 0x400 -#define ZEND_ACC_PPP_MASK (ZEND_ACC_PUBLIC | ZEND_ACC_PROTECTED | ZEND_ACC_PRIVATE) - -#define ZEND_ACC_CHANGED 0x800 -#define ZEND_ACC_IMPLICIT_PUBLIC 0x1000 - -char *zend_visibility_string(zend_uint fn_flags); - - -typedef struct _zend_property_info { - zend_uint flags; - char *name; - int name_length; - ulong h; -} zend_property_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; - zend_namespace *ns; - union _zend_function *prototype; - /* END of common elements */ - - zend_uint *refcount; - - zend_op *opcodes; - zend_uint last, size; - - zend_uint T; - - zend_brk_cont_element *brk_cont_array; - zend_uint last_brk_cont; - zend_uint current_brk_cont; - - /* 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; - - char *filename; - zend_uint line_start; - zend_uint line_end; - char *doc_comment; - zend_uint doc_comment_len; - - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; -}; - - -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; - zend_namespace *ns; - union _zend_function *prototype; - /* END of common elements */ - - void (*handler)(INTERNAL_FUNCTION_PARAMETERS); -} zend_internal_function; - -#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name : "") - -typedef union _zend_function { - zend_uchar type; /* MUST be the first element of this struct! */ - - struct { - zend_uchar type; /* never used */ - zend_uchar *arg_types; - char *function_name; - zend_class_entry *scope; - zend_uint fn_flags; - zend_namespace *ns; - union _zend_function *prototype; - } common; - - zend_op_array op_array; - zend_internal_function internal_function; -} zend_function; - - -typedef struct _zend_function_state { - HashTable *function_symbol_table; - zend_function *function; - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; -} zend_function_state; - - -typedef struct _zend_switch_entry { - znode cond; - int default_case; - int control_var; -} zend_switch_entry; - - -typedef struct _list_llist_element { - znode var; - zend_llist dimensions; - znode value; -} list_llist_element; - -union _temp_variable; - -struct _zend_execute_data { - struct _zend_op *opline; - zend_function_state function_state; - zend_function *fbc; /* Function Being Called */ - zend_function *fbc_constructor; - zend_op_array *op_array; - zval *object; - union _temp_variable *Ts; - zend_bool original_in_execution; - zend_class_entry *calling_scope; - struct _zend_execute_data *prev_execute_data; -}; - -#define EX(element) execute_data.element - - -#define IS_CONST (1<<0) -#define IS_TMP_VAR (1<<1) -#define IS_VAR (1<<2) -#define IS_UNUSED (1<<3) /* Unused variable */ - -#define EXT_TYPE_UNUSED (1<<0) - -#include "zend_globals.h" - -BEGIN_EXTERN_C() - -void init_compiler(TSRMLS_D); -void shutdown_compiler(TSRMLS_D); -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); - -ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC); -ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC); -ZEND_API char *zend_get_compiled_filename(TSRMLS_D); -ZEND_API int zend_get_compiled_lineno(TSRMLS_D); - -#ifdef ZTS -const char *zend_get_zendtext(TSRMLS_D); -int zend_get_zendleng(TSRMLS_D); -#endif - - -/* 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); -void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC); -void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC); -void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC); -void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC); -void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC); -void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC); -void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC); - -void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC); -void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC); -void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC); -void zend_do_fetch_static_member(znode *class_znode TSRMLS_DC); -void zend_do_print(znode *result, znode *arg TSRMLS_DC); -void zend_do_echo(znode *arg TSRMLS_DC); -typedef int (*unary_op_type)(zval *, zval *); -ZEND_API unary_op_type get_unary_op(int opcode); -ZEND_API void *get_binary_op(int opcode); - -void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC); -void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC); -void zend_do_do_while_begin(TSRMLS_D); -void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC); - - -void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC); -void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC); -void zend_do_if_end(TSRMLS_D); - -void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC); -void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC); -void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC); - -void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC); -void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC); - -void zend_do_begin_variable_parse(TSRMLS_D); -void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC); - -void zend_check_writable_variable(znode *variable); - -void zend_do_free(znode *op1 TSRMLS_DC); - -void zend_do_init_string(znode *result TSRMLS_DC); -void zend_do_add_char(znode *result, znode *op1, znode *op2 TSRMLS_DC); -void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC); -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, 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_begin_dynamic_function_call(znode *function_name TSRMLS_DC); -void zend_do_fetch_class(znode *result, znode *namespace_name, znode *class_name, zend_bool global_namespace 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_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, 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); -void zend_do_implements_interface(znode *interface_znode TSRMLS_DC); - -void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce); -void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface); -void zend_do_early_binding(TSRMLS_D); - -void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC); - - -void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC); -void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC); -void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC); -void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC); - -void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC); - -void zend_do_switch_cond(znode *cond TSRMLS_DC); -void zend_do_switch_end(znode *case_list TSRMLS_DC); -void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC); -void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC); -void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC); - -void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC); -void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRMLS_DC); -void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC); -void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC); - -void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC); - - -void zend_do_push_object(znode *object TSRMLS_DC); -void zend_do_pop_object(znode *object TSRMLS_DC); - - -void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC); -void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC); - -void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC); - -void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC); - -void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC); -void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC); -void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr); -void zend_do_list_init(TSRMLS_D); -void zend_do_list_end(znode *result, znode *expr TSRMLS_DC); -void zend_do_add_list_element(znode *element TSRMLS_DC); -void zend_do_new_list_begin(TSRMLS_D); -void zend_do_new_list_end(TSRMLS_D); - -void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC); -void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC); - -void zend_do_unset(znode *variable TSRMLS_DC); -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 TSRMLS_DC); -void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC); - -void zend_do_declare_begin(TSRMLS_D); -void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC); -void zend_do_declare_end(znode *declare_token TSRMLS_DC); - -void zend_do_end_heredoc(TSRMLS_D); - -void zend_do_exit(znode *result, znode *message TSRMLS_DC); - -void zend_do_begin_silence(znode *strudel_token TSRMLS_DC); -void zend_do_end_silence(znode *strudel_token TSRMLS_DC); - -void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC); -void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC); -void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC); - -void zend_do_extended_info(TSRMLS_D); -void zend_do_extended_fcall_begin(TSRMLS_D); -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); - -#define INITIAL_OP_ARRAY_SIZE 64 - - -/* helper functions in zend_language_scanner.l */ -ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC); -ZEND_API zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC); -ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC); -ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...); -ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC); -ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC); -ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC); -ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC); -ZEND_API void zend_file_handle_dtor(zend_file_handle *fh); -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 destroy_zend_class(zend_class_entry **pce); -void zend_class_add_ref(zend_class_entry **ce); - -void zend_do_begin_namespace(znode *ns_token, znode *ns_name TSRMLS_DC); -void zend_do_end_namespace(znode *ns_token TSRMLS_DC); -void zend_init_namespace(zend_namespace *ns TSRMLS_DC); -void zend_do_declare_namespace_var(znode *name, znode *value TSRMLS_DC); -void zend_do_declare_namespace_constant(znode *name, znode *value TSRMLS_DC); -ZEND_API void destroy_zend_namespace(zend_namespace **pns); - -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 *)) destroy_zend_function -#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class -#define ZEND_NAMESPACE_DTOR (void (*)(void *)) destroy_zend_namespace - -zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC); -void init_op(zend_op *op TSRMLS_DC); -int get_next_op_number(zend_op_array *op_array); -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); -ZEND_API zend_bool zend_is_compiling(TSRMLS_D); -ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC); -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 { - char *name; - uint name_len; - zend_auto_global_callback auto_global_callback; - zend_bool armed; -} 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); - -int zendlex(znode *zendlval TSRMLS_DC); - -/* BEGIN: OPCODES */ -#define ZEND_NOP 0 - -#define ZEND_ADD 1 -#define ZEND_SUB 2 -#define ZEND_MUL 3 -#define ZEND_DIV 4 -#define ZEND_MOD 5 -#define ZEND_SL 6 -#define ZEND_SR 7 -#define ZEND_CONCAT 8 -#define ZEND_BW_OR 9 -#define ZEND_BW_AND 10 -#define ZEND_BW_XOR 11 -#define ZEND_BW_NOT 12 -#define ZEND_BOOL_NOT 13 -#define ZEND_BOOL_XOR 14 -#define ZEND_IS_IDENTICAL 15 -#define ZEND_IS_NOT_IDENTICAL 16 -#define ZEND_IS_EQUAL 17 -#define ZEND_IS_NOT_EQUAL 18 -#define ZEND_IS_SMALLER 19 -#define ZEND_IS_SMALLER_OR_EQUAL 20 -#define ZEND_CAST 21 -#define ZEND_QM_ASSIGN 22 - -#define ZEND_ASSIGN_ADD 23 -#define ZEND_ASSIGN_SUB 24 -#define ZEND_ASSIGN_MUL 25 -#define ZEND_ASSIGN_DIV 26 -#define ZEND_ASSIGN_MOD 27 -#define ZEND_ASSIGN_SL 28 -#define ZEND_ASSIGN_SR 29 -#define ZEND_ASSIGN_CONCAT 30 -#define ZEND_ASSIGN_BW_OR 31 -#define ZEND_ASSIGN_BW_AND 32 -#define ZEND_ASSIGN_BW_XOR 33 - -#define ZEND_PRE_INC 34 -#define ZEND_PRE_DEC 35 -#define ZEND_POST_INC 36 -#define ZEND_POST_DEC 37 - -#define ZEND_ASSIGN 38 -#define ZEND_ASSIGN_REF 39 - -#define ZEND_ECHO 40 -#define ZEND_PRINT 41 - -#define ZEND_JMP 42 -#define ZEND_JMPZ 43 -#define ZEND_JMPNZ 44 -#define ZEND_JMPZNZ 45 -#define ZEND_JMPZ_EX 46 -#define ZEND_JMPNZ_EX 47 -#define ZEND_CASE 48 -#define ZEND_SWITCH_FREE 49 -#define ZEND_BRK 50 -#define ZEND_CONT 51 -#define ZEND_BOOL 52 - -#define ZEND_INIT_STRING 53 -#define ZEND_ADD_CHAR 54 -#define ZEND_ADD_STRING 55 -#define ZEND_ADD_VAR 56 - -#define ZEND_BEGIN_SILENCE 57 -#define ZEND_END_SILENCE 58 - -#define ZEND_INIT_FCALL_BY_NAME 59 -#define ZEND_DO_FCALL 60 -#define ZEND_DO_FCALL_BY_NAME 61 -#define ZEND_RETURN 62 - -#define ZEND_RECV 63 -#define ZEND_RECV_INIT 64 - -#define ZEND_SEND_VAL 65 -#define ZEND_SEND_VAR 66 -#define ZEND_SEND_REF 67 - -#define ZEND_NEW 68 -#define ZEND_JMP_NO_CTOR 69 -#define ZEND_FREE 70 - -#define ZEND_INIT_ARRAY 71 -#define ZEND_ADD_ARRAY_ELEMENT 72 - -#define ZEND_INCLUDE_OR_EVAL 73 - -#define ZEND_UNSET_VAR 74 -#define ZEND_UNSET_DIM_OBJ 75 - -#define ZEND_FE_RESET 77 -#define ZEND_FE_FETCH 78 - -#define ZEND_EXIT 79 - - -/* the following 18 opcodes are 6 groups of 3 opcodes each, and must - * remain in that order! - */ -#define ZEND_FETCH_R 80 -#define ZEND_FETCH_DIM_R 81 -#define ZEND_FETCH_OBJ_R 82 -#define ZEND_FETCH_W 83 -#define ZEND_FETCH_DIM_W 84 -#define ZEND_FETCH_OBJ_W 85 -#define ZEND_FETCH_RW 86 -#define ZEND_FETCH_DIM_RW 87 -#define ZEND_FETCH_OBJ_RW 88 -#define ZEND_FETCH_IS 89 -#define ZEND_FETCH_DIM_IS 90 -#define ZEND_FETCH_OBJ_IS 91 -#define ZEND_FETCH_FUNC_ARG 92 -#define ZEND_FETCH_DIM_FUNC_ARG 93 -#define ZEND_FETCH_OBJ_FUNC_ARG 94 -#define ZEND_FETCH_UNSET 95 -#define ZEND_FETCH_DIM_UNSET 96 -#define ZEND_FETCH_OBJ_UNSET 97 - -#define ZEND_FETCH_DIM_TMP_VAR 98 -#define ZEND_FETCH_CONSTANT 99 - -/* Hole - 100 */ - -#define ZEND_EXT_STMT 101 -#define ZEND_EXT_FCALL_BEGIN 102 -#define ZEND_EXT_FCALL_END 103 -#define ZEND_EXT_NOP 104 - -#define ZEND_TICKS 105 - -#define ZEND_SEND_VAR_NO_REF 106 - -#define ZEND_CATCH 107 -#define ZEND_THROW 108 - -#define ZEND_FETCH_CLASS 109 - -#define ZEND_CLONE 110 - -#define ZEND_INIT_CTOR_CALL 111 -#define ZEND_INIT_METHOD_CALL 112 -#define ZEND_INIT_STATIC_METHOD_CALL 113 - -#define ZEND_ISSET_ISEMPTY_VAR 114 -#define ZEND_ISSET_ISEMPTY_DIM_OBJ 115 - -#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 -#define ZEND_POST_INC_OBJ 134 -#define ZEND_POST_DEC_OBJ 135 - -#define ZEND_ASSIGN_OBJ 136 -#define ZEND_OP_DATA 137 - -#define ZEND_INSTANCEOF 138 - -#define ZEND_DECLARE_CLASS 139 -#define ZEND_DECLARE_INHERITED_CLASS 140 -#define ZEND_DECLARE_FUNCTION 141 - -#define ZEND_RAISE_ABSTRACT_ERROR 142 - -#define ZEND_START_NAMESPACE 143 - -#define ZEND_ADD_INTERFACE 144 -#define ZEND_VERIFY_INSTANCEOF 145 -#define ZEND_VERIFY_ABSTRACT_CLASS 146 - -/* end of block */ -/* END: OPCODES */ - - - - -/* global/local fetches */ -#define ZEND_FETCH_GLOBAL 0 -#define ZEND_FETCH_LOCAL 1 -#define ZEND_FETCH_STATIC 2 -#define ZEND_FETCH_STATIC_MEMBER 3 - -/* 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 - - -/* 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) - - -/* unset types */ -#define ZEND_UNSET_REG 0 - -/* var status for backpatching */ -#define BP_VAR_R 0 -#define BP_VAR_W 1 -#define BP_VAR_RW 2 -#define BP_VAR_IS 3 -#define BP_VAR_NA 4 /* if not applicable */ -#define BP_VAR_FUNC_ARG 5 -#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_INTERNAL_CLASS 1 -#define ZEND_USER_CLASS 2 -#define ZEND_INTERNAL_NAMESPACE 3 -#define ZEND_USER_NAMESPACE 4 - -#define ZEND_EVAL (1<<0) -#define ZEND_INCLUDE (1<<1) -#define ZEND_INCLUDE_ONCE (1<<2) -#define ZEND_REQUIRE (1<<3) -#define ZEND_REQUIRE_ONCE (1<<4) - -#define ZEND_ISSET (1<<0) -#define ZEND_ISEMPTY (1<<1) - -#define ZEND_CT (1<<0) -#define ZEND_RT (1<<1) - - -#define ZEND_HANDLE_FILENAME 0 -#define ZEND_HANDLE_FD 1 -#define ZEND_HANDLE_FP 2 -#define ZEND_HANDLE_STDIOSTREAM 3 -#define ZEND_HANDLE_FSTREAM 4 -#define ZEND_HANDLE_STREAM 5 - -#define ZEND_FETCH_STANDARD 0 -#define ZEND_FETCH_ADD_LOCK 1 - -#define ZEND_MEMBER_FUNC_CALL 1<<0 - -#define ZEND_ARG_SEND_BY_REF (1<<0) -#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1) - -#define CLASS_IS_NAMESPACE(c) ((c)->type == ZEND_INTERNAL_NAMESPACE || (c)->type == ZEND_USER_NAMESPACE) - -#define AI_USE_PTR(ai) \ - if ((ai).ptr_ptr) { \ - (ai).ptr = *((ai).ptr_ptr); \ - (ai).ptr_ptr = &((ai).ptr); \ - } else { \ - (ai).ptr = NULL; \ - } - -/* Lost In Stupid Parentheses */ -#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 - -END_EXTERN_C() - -#define ZEND_CLONE_FUNC_NAME "__clone" -#define ZEND_CONSTRUCTOR_FUNC_NAME "__construct" -#define ZEND_DESTRUCTOR_FUNC_NAME "__destruct" -#define ZEND_GET_FUNC_NAME "__get" -#define ZEND_SET_FUNC_NAME "__set" -#define ZEND_CALL_FUNC_NAME "__call" - -#endif /* ZEND_COMPILE_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_config.nw.h b/Zend/zend_config.nw.h deleted file mode 100644 index c416b85161..0000000000 --- a/Zend/zend_config.nw.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_CONFIG_NW_H -#define ZEND_CONFIG_NW_H - - -#include -#include - -typedef unsigned long ulong; -typedef unsigned int uint; - -#define HAVE_ALLOCA 1 -#define HAVE_LIMITS_H 1 -/* #include */ - -#define HAVE_STRING_H 1 - -#undef HAVE_KILL -#define HAVE_GETPID 1 -/* #define HAVE_ALLOCA_H 1 */ -#define HAVE_MEMCPY 1 -#define HAVE_STRDUP 1 -#define HAVE_SYS_TYPES_H 1 -/* #define HAVE_STDIOSTR_H 1 */ -#define HAVE_CLASS_ISTDIOSTREAM -#define istdiostream stdiostream -#define HAVE_STDARG_H 1 -#define HAVE_DLFCN_H 1 -/* #define HAVE_LIBDL 1 */ -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 - -/* -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#define zend_isinf(a) 0 -#define zend_finite(x) _finite(x) -#define zend_isnan(x) _isnan(x) -*/ - -#define zend_sprintf sprintf - -/* This will cause the compilation process to be MUCH longer, but will generate - * a much quicker PHP binary - */ -/* -#undef inline -#ifdef ZEND_WIN32_FORCE_INLINE -# define inline __forceinline -#else -# define inline -#endif -*/ - -/* -#define zend_finite(A) _finite(A) -#define zend_isnan(A) _isnan(A) -*/ - -#endif /* ZEND_CONFIG_NW_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h deleted file mode 100644 index fe62faa8d6..0000000000 --- a/Zend/zend_config.w32.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_CONFIG_W32_H -#define ZEND_CONFIG_W32_H - -#define HAVE_ALLOCA 1 -#define HAVE_LIMITS_H 1 -#define _CRTDBG_MAP_ALLOC - -#include -#include -#include - -#include - -#ifndef ZEND_INCLUDE_FULL_WINDOWS_HEADERS -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - -#include - -typedef unsigned long ulong; -typedef unsigned int uint; - -#undef HAVE_KILL -#define HAVE_GETPID 1 -/* #define HAVE_ALLOCA_H 1 */ -#define HAVE_MEMCPY 1 -#define HAVE_STRDUP 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIOSTR_H 1 -#define HAVE_CLASS_ISTDIOSTREAM -#define istdiostream stdiostream -#define HAVE_STDARG_H 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 - -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#define strcasecmp(s1, s2) stricmp(s1, s2) -#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) -#define zend_isinf(a) ((_fpclass(a) == _FPCLASS_PINF) || (_fpclass(a) == _FPCLASS_NINF)) -#define zend_finite(x) _finite(x) -#define zend_isnan(x) _isnan(x) - -#define zend_sprintf sprintf - -/* This will cause the compilation process to be MUCH longer, but will generate - * a much quicker PHP binary - */ -#undef inline -#ifdef ZEND_WIN32_FORCE_INLINE -# define inline __forceinline -#else -# define inline -#endif - -#ifdef LIBZEND_EXPORTS -# define ZEND_API __declspec(dllexport) -#else -# define ZEND_API __declspec(dllimport) -#endif - -#define ZEND_DLEXPORT __declspec(dllexport) -#define ZEND_DLIMPORT __declspec(dllimport) - -/* 0x00200000L is MB_SERVICE_NOTIFICATION, which is only supported under Windows NT - * (and requires _WIN32_WINNT to be defined, which prevents the resulting executable - * from running under Windows 9x - * Windows 9x should silently ignore it, so it's being used here directly - */ -#ifndef MB_SERVICE_NOTIFICATION -#define MB_SERVICE_NOTIFICATION 0x00200000L -#endif - -#define ZEND_SERVICE_MB_STYLE (MB_TOPMOST|MB_SERVICE_NOTIFICATION) - -#endif /* ZEND_CONFIG_W32_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c deleted file mode 100644 index 826e6071fa..0000000000 --- a/Zend/zend_constants.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_constants.h" -#include "zend_variables.h" -#include "zend_operators.h" -#include "zend_globals.h" - - -void free_zend_constant(zend_constant *c) -{ - if (!(c->flags & CONST_PERSISTENT)) { - zval_dtor(&c->value); - } - free(c->name); -} - - -void copy_zend_constant(zend_constant *c) -{ - c->name = zend_strndup(c->name, c->name_len); - if (!(c->flags & CONST_PERSISTENT)) { - zval_copy_ctor(&c->value); - } -} - - -void zend_copy_constants(HashTable *target, HashTable *source) -{ - zend_constant tmp_constant; - - zend_hash_copy(target, source, (copy_ctor_func_t) copy_zend_constant, &tmp_constant, sizeof(zend_constant)); -} - - -static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC) -{ - if (c->flags & CONST_PERSISTENT) { - return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP; - } else { - return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE; - } -} - - -static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC) -{ - if (c->module_number == *module_number) { - return 1; - } else { - return 0; - } -} - - -void clean_module_constants(int module_number TSRMLS_DC) -{ - zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC); -} - - -int zend_startup_constants(TSRMLS_D) -{ - EG(zend_constants) = &CG(global_namespace).constants_table; - - if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) { - return FAILURE; - } - return SUCCESS; -} - - - -void zend_register_standard_constants(TSRMLS_D) -{ - REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS); - 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_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); - REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS); - - REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); - - /* true/false constants */ - { - zend_constant c; - - c.value.type = IS_BOOL; - c.flags = CONST_PERSISTENT; - c.module_number = 0; - - c.name = zend_strndup(ZEND_STRL("TRUE")); - c.name_len = sizeof("TRUE"); - c.value.value.lval = 1; - c.value.type = IS_BOOL; - zend_register_constant(&c TSRMLS_CC); - - c.name = zend_strndup(ZEND_STRL("FALSE")); - c.name_len = sizeof("FALSE"); - c.value.value.lval = 0; - c.value.type = IS_BOOL; - zend_register_constant(&c TSRMLS_CC); - - c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE")); - c.name_len = sizeof("ZEND_THREAD_SAFE"); - c.value.value.lval = ZTS_V; - c.value.type = IS_BOOL; - zend_register_constant(&c TSRMLS_CC); - - c.name = zend_strndup(ZEND_STRL("NULL")); - c.name_len = sizeof("NULL"); - c.value.type = IS_NULL; - zend_register_constant(&c TSRMLS_CC); - } -} - - -int zend_shutdown_constants(TSRMLS_D) -{ - zend_hash_destroy(EG(zend_constants)); - return SUCCESS; -} - - -void clean_non_persistent_constants(TSRMLS_D) -{ - if (EG(full_tables_cleanup)) { - zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC); - } else { - zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC); - } -} - - -ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC) -{ - zend_constant c; - - c.value.type = IS_LONG; - c.value.value.lval = lval; - c.flags = flags; - c.name = zend_strndup(name, name_len); - c.name_len = name_len; - c.module_number = module_number; - zend_register_constant(&c TSRMLS_CC); -} - - -ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC) -{ - zend_constant c; - - c.value.type = IS_DOUBLE; - c.value.value.dval = dval; - c.flags = flags; - c.name = zend_strndup(name, name_len); - c.name_len = name_len; - c.module_number = module_number; - zend_register_constant(&c TSRMLS_CC); -} - - -ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC) -{ - zend_constant c; - - c.value.type = IS_STRING; - c.value.value.str.val = strval; - c.value.value.str.len = strlen; - c.flags = flags; - c.name = zend_strndup(name, name_len); - c.name_len = name_len; - c.module_number = module_number; - zend_register_constant(&c TSRMLS_CC); -} - - -ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC) -{ - zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC); -} - - -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) -{ - zend_constant *c; - char *lookup_name; - int retval = 1; - - if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) { - lookup_name = do_alloca(name_len+1); - memcpy(lookup_name, name, name_len+1); - zend_str_tolower(lookup_name, name_len); - - 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) { - retval=0; - } - } else { - retval=0; - } - free_alloca(lookup_name); - } - - if (retval) { - *result = c->value; - zval_copy_ctor(result); - } - - return retval; -} - - -ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) -{ - char *lowercase_name; - int ret = SUCCESS; - -#if 0 - printf("Registering constant for module %d\n", c->module_number); -#endif - - lowercase_name = do_alloca(c->name_len); - - memcpy(lowercase_name, c->name, c->name_len); - - if (!(c->flags & CONST_CS)) { - zend_str_tolower(lowercase_name, c->name_len); - } - - 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; - } - free_alloca(lowercase_name); - return ret; -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h deleted file mode 100644 index 06fd50c4a4..0000000000 --- a/Zend/zend_constants.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_CONSTANTS_H -#define ZEND_CONSTANTS_H - -#include "zend_globals.h" - -#define CONST_CS (1<<0) /* Case Sensitive */ -#define CONST_PERSISTENT (1<<1) /* Persistent */ - -typedef struct _zend_constant { - zval value; - int flags; - char *name; - uint name_len; - int module_number; -} zend_constant; - -#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC) -#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC) -#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC) -#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC) - -#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC) -#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC) -#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC) -#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), 0 TSRMLS_CC) - -void clean_module_constants(int module_number TSRMLS_DC); -void free_zend_constant(zend_constant *c); -int zend_startup_constants(TSRMLS_D); -int zend_shutdown_constants(TSRMLS_D); -void zend_register_standard_constants(TSRMLS_D); -void clean_non_persistent_constants(TSRMLS_D); -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC); -ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC); -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); - -#define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c deleted file mode 100644 index 99da4bf663..0000000000 --- a/Zend/zend_default_classes.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Sterling Hughes | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_API.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_default_exception(TSRMLS_C); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_default_classes.h b/Zend/zend_default_classes.h deleted file mode 100644 index 60511409b1..0000000000 --- a/Zend/zend_default_classes.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Sterling Hughes | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_DEFAULT_CLASSES_H -#define ZEND_DEFAULT_CLASSES_H - -BEGIN_EXTERN_C() - -ZEND_API zend_class_entry *zend_exception_get_default(void); -ZEND_API void zend_register_default_classes(TSRMLS_D); - -END_EXTERN_C() - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_dynamic_array.c b/Zend/zend_dynamic_array.c deleted file mode 100644 index 306343b7cc..0000000000 --- a/Zend/zend_dynamic_array.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" - -typedef struct _dynamic_array { - char *array; - unsigned int element_size; - unsigned int current; - unsigned int allocated; -} dynamic_array; - -ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size) -{ - da->element_size = element_size; - da->allocated = size; - da->current = 0; - da->array = (char *) emalloc(size*element_size); - if (da->array == NULL) { - return 1; - } - return 0; -} - -ZEND_API void *zend_dynamic_array_push(dynamic_array *da) -{ - if (da->current == da->allocated) { - da->allocated *= 2; - da->array = (char *) erealloc(da->array, da->allocated*da->element_size); - } - return (void *)(da->array+(da->current++)*da->element_size); -} - -ZEND_API void *zend_dynamic_array_pop(dynamic_array *da) -{ - return (void *)(da->array+(--(da->current))*da->element_size); - -} - -ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index) -{ - if (index >= da->current) { - return NULL; - } - return (void *)(da->array+index*da->element_size); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_dynamic_array.h b/Zend/zend_dynamic_array.h deleted file mode 100644 index c321634267..0000000000 --- a/Zend/zend_dynamic_array.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_DYNAMIC_ARRAY_H -#define ZEND_DYNAMIC_ARRAY_H - -typedef struct _dynamic_array { - char *array; - unsigned int element_size; - unsigned int last_used; - unsigned int allocated; -} dynamic_array; - -BEGIN_EXTERN_C() -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); -END_EXTERN_C() - -#endif /* ZEND_DYNAMIC_ARRAY_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h deleted file mode 100644 index 29a2e065ba..0000000000 --- a/Zend/zend_errors.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_ERRORS_H -#define ZEND_ERRORS_H - -#define E_ERROR (1<<0L) -#define E_WARNING (1<<1L) -#define E_PARSE (1<<2L) -#define E_NOTICE (1<<3L) -#define E_CORE_ERROR (1<<4L) -#define E_CORE_WARNING (1<<5L) -#define E_COMPILE_ERROR (1<<6L) -#define E_COMPILE_WARNING (1<<7L) -#define E_USER_ERROR (1<<8L) -#define E_USER_WARNING (1<<9L) -#define E_USER_NOTICE (1<<10L) - -#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) - -#endif /* ZEND_ERRORS_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c deleted file mode 100644 index 99da4bf663..0000000000 --- a/Zend/zend_exceptions.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Sterling Hughes | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_API.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_default_exception(TSRMLS_C); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h deleted file mode 100644 index 60511409b1..0000000000 --- a/Zend/zend_exceptions.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Sterling Hughes | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_DEFAULT_CLASSES_H -#define ZEND_DEFAULT_CLASSES_H - -BEGIN_EXTERN_C() - -ZEND_API zend_class_entry *zend_exception_get_default(void); -ZEND_API void zend_register_default_classes(TSRMLS_D); - -END_EXTERN_C() - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c deleted file mode 100644 index bed9bd8a97..0000000000 --- a/Zend/zend_execute.c +++ /dev/null @@ -1,4276 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#define ZEND_INTENSIVE_DEBUGGING 0 - -#include -#include - -#include "zend.h" -#include "zend_compile.h" -#include "zend_execute.h" -#include "zend_API.h" -#include "zend_ptr_stack.h" -#include "zend_constants.h" -#include "zend_extensions.h" -#include "zend_fast_cache.h" -#include "zend_execute_locks.h" -#include "zend_ini.h" - -#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free TSRMLS_CC) -#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts TSRMLS_CC) - -/* Prototypes */ -static void zend_fetch_var_address(zend_op *opline, temp_variable *Ts, int type TSRMLS_DC); -static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC); -static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC); -static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC); -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); - -#define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED)) - -#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset)) -#define T(offset) (*(temp_variable *)((char *) Ts + offset)) - -static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zval **should_free TSRMLS_DC) -{ - switch (node->op_type) { - case IS_CONST: - *should_free = 0; - return &node->u.constant; - break; - case IS_TMP_VAR: - return *should_free = &T(node->u.var).tmp_var; - break; - case IS_VAR: - if (T(node->u.var).var.ptr) { - PZVAL_UNLOCK(T(node->u.var).var.ptr); - *should_free = 0; - return T(node->u.var).var.ptr; - } else { - *should_free = &T(node->u.var).tmp_var; - - switch (T(node->u.var).EA.type) { - case IS_STRING_OFFSET: { - temp_variable *T = &T(node->u.var); - zval *str = T->EA.data.str_offset.str; - - if (T->EA.data.str_offset.str->type != IS_STRING - || (T->EA.data.str_offset.offset<0) - || (T->EA.data.str_offset.str->value.str.len <= T->EA.data.str_offset.offset)) { - zend_error(E_NOTICE, "Uninitialized string offset: %d", T->EA.data.str_offset.offset); - T->tmp_var.value.str.val = empty_string; - T->tmp_var.value.str.len = 0; - } else { - char c = str->value.str.val[T->EA.data.str_offset.offset]; - - T->tmp_var.value.str.val = estrndup(&c, 1); - T->tmp_var.value.str.len = 1; - } - PZVAL_UNLOCK(str); - T->tmp_var.refcount=1; - T->tmp_var.is_ref=1; - T->tmp_var.type = IS_STRING; - return &T->tmp_var; - } - break; - } - } - break; - case IS_UNUSED: - *should_free = 0; - return NULL; - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - return NULL; -} - -static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC) -{ - if (node->op_type==IS_VAR) { - if (T(node->u.var).var.ptr_ptr) { - PZVAL_UNLOCK(*T(node->u.var).var.ptr_ptr); - } else if (T(node->u.var).EA.type==IS_STRING_OFFSET) { - PZVAL_UNLOCK(T(node->u.var).EA.data.str_offset.str); - } - return T(node->u.var).var.ptr_ptr; - } else { - return NULL; - } -} - -static inline zval **zend_fetch_property_address_inner(zval *object, znode *op2, temp_variable *Ts, int type TSRMLS_DC) -{ - zval *prop_ptr = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - zval **retval = NULL; - zval tmp; - - - switch (op2->op_type) { - case IS_CONST: - /* already a constant string */ - break; - case IS_VAR: - tmp = *prop_ptr; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - prop_ptr = &tmp; - break; - case IS_TMP_VAR: - convert_to_string(prop_ptr); - break; - } - - if (Z_OBJ_HT_P(object)->get_property_ptr != NULL) { - retval = Z_OBJ_HT_P(object)->get_property_ptr(object, prop_ptr TSRMLS_CC); - } - - if (retval == NULL) { - zend_error(E_WARNING, "This object doesn't support property references"); - retval = &EG(error_zval_ptr); - } - - if (prop_ptr == &tmp) { - zval_dtor(prop_ptr); - } - FREE_OP(Ts, op2, EG(free_op2)); - return retval; -} - - - -static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC) -{ - switch (opline->op1.op_type) { - case IS_VAR: - if (!T(opline->op1.u.var).var.ptr_ptr) { - get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - FREE_OP(Ts, &opline->op1, EG(free_op1)); - } else { - zval_ptr_dtor(&T(opline->op1.u.var).var.ptr); - if (opline->extended_value) { /* foreach() free */ - zval_ptr_dtor(&T(opline->op1.u.var).var.ptr); - } - } - break; - case IS_TMP_VAR: - zendi_zval_dtor(T(opline->op1.u.var).tmp_var); - break; - EMPTY_SWITCH_DEFAULT_CASE() - } -} - -void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC) -{ - zval *variable_ptr; - zval *value_ptr; - - if (!value_ptr_ptr || !variable_ptr_ptr) { - zend_error(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); - return; - } - - variable_ptr = *variable_ptr_ptr; - value_ptr = *value_ptr_ptr; - - if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) { - variable_ptr_ptr = &EG(uninitialized_zval_ptr); - } else if (variable_ptr != value_ptr) { - variable_ptr->refcount--; - if (variable_ptr->refcount==0) { - zendi_zval_dtor(*variable_ptr); - FREE_ZVAL(variable_ptr); - } - - if (!PZVAL_IS_REF(value_ptr)) { - /* break it away */ - value_ptr->refcount--; - if (value_ptr->refcount>0) { - ALLOC_ZVAL(*value_ptr_ptr); - **value_ptr_ptr = *value_ptr; - value_ptr = *value_ptr_ptr; - zendi_zval_copy_ctor(*value_ptr); - } - value_ptr->refcount = 1; - value_ptr->is_ref = 1; - } - - *variable_ptr_ptr = value_ptr; - value_ptr->refcount++; - } else if (!variable_ptr->is_ref) { - if (variable_ptr_ptr == value_ptr_ptr) { - SEPARATE_ZVAL(variable_ptr_ptr); - } else if (variable_ptr==EG(uninitialized_zval_ptr) - || variable_ptr->refcount>2) { - /* we need to separate */ - variable_ptr->refcount -= 2; - ALLOC_ZVAL(*variable_ptr_ptr); - **variable_ptr_ptr = *variable_ptr; - zval_copy_ctor(*variable_ptr_ptr); - *value_ptr_ptr = *variable_ptr_ptr; - (*variable_ptr_ptr)->refcount = 2; - } - (*variable_ptr_ptr)->is_ref = 1; - } - - if (result && !(result->u.EA.type & EXT_TYPE_UNUSED)) { - T(result->u.var).var.ptr_ptr = variable_ptr_ptr; - SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result); - AI_USE_PTR(T(result->u.var).var); - } -} - -static inline void make_real_object(zval **object_ptr TSRMLS_DC) -{ -/* this should modify object only if it's empty */ - if ((*object_ptr)->type == IS_NULL - || ((*object_ptr)->type == IS_BOOL && (*object_ptr)->value.lval==0) - || ((*object_ptr)->type == IS_STRING && (*object_ptr)->value.str.len == 0)) { - if (!PZVAL_IS_REF(*object_ptr)) { - SEPARATE_ZVAL(object_ptr); - } - zend_error(E_NOTICE, "Creating default object from empty value"); - object_init(*object_ptr); - } -} - -static inline zval **get_obj_zval_ptr_ptr(znode *op, temp_variable *Ts, int type TSRMLS_DC) -{ - if (op->op_type == IS_UNUSED) { - if (EG(This)) { - /* this should actually never be modified, _ptr_ptr is modified only when - the object is empty */ - return &EG(This); - } else { - zend_error(E_ERROR, "Using $this when not in object context"); - } - } - return get_zval_ptr_ptr(op, Ts, type); -} - -static inline zval *get_obj_zval_ptr(znode *op, temp_variable *Ts, zval **freeop, int type TSRMLS_DC) -{ - if (op->op_type == IS_UNUSED) { - if (EG(This)) { - return EG(This); - } else { - zend_error(E_ERROR, "Using $this when not in object context"); - } - } - return get_zval_ptr(op, Ts, freeop, type); -} - -static inline void zend_assign_to_object(znode *result, znode *op1, znode *op2, znode *value_op, temp_variable *Ts TSRMLS_DC) -{ - zval **object_ptr = get_obj_zval_ptr_ptr(op1, Ts, BP_VAR_W TSRMLS_CC); - zval *object; - zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - zval *free_value; - zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R); - zval tmp; - zval **retval = &T(result->u.var).var.ptr; - - make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ - object = *object_ptr; - - if (object->type != IS_OBJECT) { - zend_error(E_WARNING, "Attempt to assign property of non-object"); - FREE_OP(Ts, op2, EG(free_op2)); - *retval = EG(uninitialized_zval_ptr); - - SELECTIVE_PZVAL_LOCK(*retval, result); - PZVAL_UNLOCK(value); - return; - } - - /* here we are sure we are dealing with an object */ - switch (op2->op_type) { - case IS_CONST: - /* already a constant string */ - break; - case IS_VAR: - tmp = *property; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - property = &tmp; - break; - case IS_TMP_VAR: - convert_to_string(property); - break; - } - - if (EG(implicit_clone)) { - SEPARATE_ZVAL_IF_NOT_REF(object_ptr); - object = *object_ptr; - } - /* by now, property is a string */ - - - /* separate our value if necessary */ - if (value_op->op_type == IS_TMP_VAR) { - zval *orig_value = value; - - ALLOC_ZVAL(value); - *value = *orig_value; - value->is_ref = 0; - value->refcount = 0; - } - Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC); - if (property == &tmp) { - zval_dtor(property); - } - - FREE_OP(Ts, op2, EG(free_op2)); - if (result) { - T(result->u.var).var.ptr = value; - T(result->u.var).var.ptr_ptr = NULL; /* see if we can nuke this */ - SELECTIVE_PZVAL_LOCK(value, result); - } -} - -static inline void zend_assign_to_object_op(znode *result, znode *op1, znode *op2, znode *value_op, temp_variable *Ts, int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) TSRMLS_DC) -{ - zval **object_ptr = get_obj_zval_ptr_ptr(op1, Ts, BP_VAR_W TSRMLS_CC); - zval *object; - zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - zval *free_value; - zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R); - zval tmp; - zval **retval = &T(result->u.var).var.ptr; - int have_get_ptr = 0; - - T(result->u.var).var.ptr_ptr = NULL; - make_real_object(object_ptr TSRMLS_CC); - object = *object_ptr; - - if (object->type != IS_OBJECT) { - zend_error(E_WARNING, "Attempt to assign property of non-object"); - FREE_OP(Ts, op2, EG(free_op2)); - - *retval = EG(uninitialized_zval_ptr); - - SELECTIVE_PZVAL_LOCK(*retval, result); - return; - } - - /* here we are sure we are dealing with an object */ - switch (op2->op_type) { - case IS_CONST: - /* already a constant string */ - break; - case IS_VAR: - tmp = *property; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - property = &tmp; - break; - case IS_TMP_VAR: - convert_to_string(property); - break; - } - - /* here property is a string */ - if (Z_OBJ_HT_P(object)->get_property_zval_ptr) { - zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC); - if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - have_get_ptr = 1; - binary_op(*zptr, *zptr, value TSRMLS_CC); - *retval = *zptr; - SELECTIVE_PZVAL_LOCK(*retval, result); - } - } - - if (!have_get_ptr) { - zval *z = Z_OBJ_HT_P(object)->read_property(object, property TSRMLS_CC); - SEPARATE_ZVAL_IF_NOT_REF(&z); - binary_op(z, z, value TSRMLS_CC); - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - *retval = z; - SELECTIVE_PZVAL_LOCK(*retval, result); - if (z->refcount <= 1) { - zval_dtor(z); - } - } - - if (property == &tmp) { - zval_dtor(property); - } - - FREE_OP(Ts, op2, EG(free_op2)); -} - -static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts TSRMLS_DC) -{ - zval **variable_ptr_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W); - zval *variable_ptr; - - if (!variable_ptr_ptr) { - switch (T(op1->u.var).EA.type) { - case IS_STRING_OFFSET: { - temp_variable *T = &T(op1->u.var); - - if (T->EA.data.str_offset.str->type == IS_STRING) do { - zval tmp; - zval *final_value = value; - - if (((int)T->EA.data.str_offset.offset < 0)) { - zend_error(E_WARNING, "Illegal string offset: %d", T->EA.data.str_offset.offset); - break; - } - if (T->EA.data.str_offset.offset >= T->EA.data.str_offset.str->value.str.len) { - zend_uint i; - - if (T->EA.data.str_offset.str->value.str.len==0) { - STR_FREE(T->EA.data.str_offset.str->value.str.val); - T->EA.data.str_offset.str->value.str.val = (char *) emalloc(T->EA.data.str_offset.offset+1+1); - } else { - T->EA.data.str_offset.str->value.str.val = (char *) erealloc(T->EA.data.str_offset.str->value.str.val, T->EA.data.str_offset.offset+1+1); - } - for (i=T->EA.data.str_offset.str->value.str.len; iEA.data.str_offset.offset; i++) { - T->EA.data.str_offset.str->value.str.val[i] = ' '; - } - T->EA.data.str_offset.str->value.str.val[T->EA.data.str_offset.offset+1] = 0; - T->EA.data.str_offset.str->value.str.len = T->EA.data.str_offset.offset+1; - } - - if (value->type!=IS_STRING) { - tmp = *value; - if (op2 && op2->op_type == IS_VAR) { - zval_copy_ctor(&tmp); - } - convert_to_string(&tmp); - final_value = &tmp; - } - - T->EA.data.str_offset.str->value.str.val[T->EA.data.str_offset.offset] = final_value->value.str.val[0]; - - if (op2) { - if (op2->op_type == IS_VAR) { - if (value == &T(op2->u.var).tmp_var) { - STR_FREE(value->value.str.val); - } - } else { - if (final_value == &T(op2->u.var).tmp_var) { - /* we can safely free final_value here - * because separation is done only - * in case op2->op_type == IS_VAR */ - STR_FREE(final_value->value.str.val); - } - } - } - if (final_value == &tmp) { - zval_dtor(final_value); - } - /* - * the value of an assignment to a string offset is undefined - T(result->u.var).var = &T->EA.data.str_offset.str; - */ - } while (0); - /* zval_ptr_dtor(&T->EA.data.str_offset.str); Nuke this line if it doesn't cause a leak */ - T->tmp_var.type = IS_STRING; - } - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result); - AI_USE_PTR(T(result->u.var).var); - return; - } - - variable_ptr = *variable_ptr_ptr; - - if (variable_ptr == EG(error_zval_ptr)) { - if (result) { - T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result); - AI_USE_PTR(T(result->u.var).var); - } - if (type==IS_TMP_VAR) { - zval_dtor(value); - } - return; - } - - if (PZVAL_IS_REF(variable_ptr)) { - if (variable_ptr!=value) { - zend_uint refcount = variable_ptr->refcount; - zval garbage; - - if (type!=IS_TMP_VAR) { - value->refcount++; - } - garbage = *variable_ptr; - *variable_ptr = *value; - variable_ptr->refcount = refcount; - variable_ptr->is_ref = 1; - if (type!=IS_TMP_VAR) { - zendi_zval_copy_ctor(*variable_ptr); - value->refcount--; - } - zendi_zval_dtor(garbage); - } - } else { - variable_ptr->refcount--; - if (variable_ptr->refcount==0) { - switch (type) { - case IS_VAR: - /* break missing intentionally */ - case IS_CONST: - if (variable_ptr==value) { - variable_ptr->refcount++; - } else if (PZVAL_IS_REF(value)) { - zval tmp; - - tmp = *value; - zval_copy_ctor(&tmp); - tmp.refcount=1; - zendi_zval_dtor(*variable_ptr); - *variable_ptr = tmp; - } else { - value->refcount++; - zendi_zval_dtor(*variable_ptr); - safe_free_zval_ptr(variable_ptr); - *variable_ptr_ptr = value; - } - break; - case IS_TMP_VAR: - zendi_zval_dtor(*variable_ptr); - value->refcount=1; - *variable_ptr = *value; - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - } else { /* we need to split */ - switch (type) { - case IS_VAR: - /* break missing intentionally */ - case IS_CONST: - if (PZVAL_IS_REF(value) && value->refcount > 0) { - ALLOC_ZVAL(variable_ptr); - *variable_ptr_ptr = variable_ptr; - *variable_ptr = *value; - zval_copy_ctor(variable_ptr); - variable_ptr->refcount=1; - break; - } - *variable_ptr_ptr = value; - value->refcount++; - break; - case IS_TMP_VAR: - ALLOC_ZVAL(*variable_ptr_ptr); - value->refcount=1; - **variable_ptr_ptr = *value; - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - } - (*variable_ptr_ptr)->is_ref=0; - } - if (result) { - T(result->u.var).var.ptr_ptr = variable_ptr_ptr; - SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result); - AI_USE_PTR(T(result->u.var).var); - } -} - - -/* Utility Functions for Extensions */ -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) -{ - if (extension->statement_handler) { - extension->statement_handler(op_array); - } -} - - -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) -{ - if (extension->fcall_begin_handler) { - extension->fcall_begin_handler(op_array); - } -} - - -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) -{ - if (extension->fcall_end_handler) { - extension->fcall_end_handler(op_array); - } -} - - -static void print_refcount(zval *p, char *str) -{ - print_refcount(NULL, NULL); -} - - -static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_variable *Ts, int type, zval *variable TSRMLS_DC) -{ - switch (opline->op2.u.EA.type) { - case ZEND_FETCH_LOCAL: - return EG(active_symbol_table); - break; - case ZEND_FETCH_GLOBAL: - /* Don't think this is actually needed. - if (opline->op1.op_type == IS_VAR) { - PZVAL_LOCK(varname); - } -+ */ - return &EG(symbol_table); - break; - case ZEND_FETCH_STATIC: - if (!EG(active_op_array)->static_variables) { - ALLOC_HASHTABLE(EG(active_op_array)->static_variables); - zend_hash_init(EG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0); - } - return EG(active_op_array)->static_variables; - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - return NULL; -} - - -static void zend_fetch_var_address(zend_op *opline, temp_variable *Ts, int type TSRMLS_DC) -{ - zval *free_op1; - zval *varname = get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R); - zval **retval; - zval tmp_varname; - HashTable *target_symbol_table; - - if (varname->type != IS_STRING) { - tmp_varname = *varname; - zval_copy_ctor(&tmp_varname); - convert_to_string(&tmp_varname); - varname = &tmp_varname; - } - - if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - target_symbol_table = NULL; - retval = zend_std_get_static_property(T(opline->op2.u.var).EA.class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC); - } else { - target_symbol_table = zend_get_target_symbol_table(opline, Ts, type, varname TSRMLS_CC); - if (!target_symbol_table) { - return; - } - if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); - /* break missing intentionally */ - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval); - } - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - } - switch (opline->op2.u.EA.type) { - case ZEND_FETCH_LOCAL: - FREE_OP(Ts, &opline->op1, free_op1); - break; - case ZEND_FETCH_STATIC: - zval_update_constant(retval, (void *) 1 TSRMLS_CC); - break; - } - } - - - if (varname == &tmp_varname) { - zval_dtor(varname); - } - T(opline->result.u.var).var.ptr_ptr = retval; - SELECTIVE_PZVAL_LOCK(*retval, &opline->result); -} - - -static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type TSRMLS_DC) -{ - zval *dim = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - zval **retval; - char *offset_key; - int offset_key_length; - - switch (dim->type) { - case IS_NULL: - offset_key = ""; - offset_key_length = 0; - goto fetch_string_dim; - case IS_STRING: - offset_key = dim->value.str.val; - offset_key_length = dim->value.str.len; - -fetch_string_dim: - if (zend_hash_find(ht, offset_key, offset_key_length+1, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined index: %s", offset_key); - /* break missing intentionally */ - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined index: %s", offset_key); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_update(ht, offset_key, offset_key_length+1, &new_zval, sizeof(zval *), (void **) &retval); - } - break; - } - } - break; - case IS_DOUBLE: - case IS_RESOURCE: - case IS_BOOL: - case IS_LONG: { - long index; - - if (dim->type == IS_DOUBLE) { - index = (long)dim->value.dval; - } else { - index = dim->value.lval; - } - if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined offset: %d", index); - /* break missing intentionally */ - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined offset: %d", index); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval); - } - break; - } - } - } - break; - default: - zend_error(E_WARNING, "Illegal offset type"); - if (type == BP_VAR_R || type == BP_VAR_IS) { - retval = &EG(uninitialized_zval_ptr); - } else { - retval = &EG(error_zval_ptr); - } - break; - } - FREE_OP(Ts, op2, EG(free_op2)); - return retval; -} - -static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC) -{ - zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type); - zval *container; - zval ***retval = &T(result->u.var).var.ptr_ptr; - - if (!container_ptr) { - if (T(op1->u.var).EA.type == IS_STRING_OFFSET) { - zval *offset; - zend_error(E_WARNING, "Cannot use string offset as an array"); - - offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - FREE_OP(Ts, op2, EG(free_op2)); - } - *retval = &EG(error_zval_ptr); - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - - container = *container_ptr; - - if (container == EG(error_zval_ptr)) { - *retval = &EG(error_zval_ptr); - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - - if (container->type==IS_NULL - || (container->type==IS_BOOL && container->value.lval==0) - || (container->type==IS_STRING && container->value.str.len==0)) { - switch (type) { - case BP_VAR_RW: - case BP_VAR_W: - if (!PZVAL_IS_REF(container)) { - SEPARATE_ZVAL(container_ptr); - container = *container_ptr; - } - array_init(container); - break; - } - } - - switch (container->type) { - case IS_ARRAY: - if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) { - SEPARATE_ZVAL(container_ptr); - container = *container_ptr; - } - if (op2->op_type == IS_UNUSED) { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - if (zend_hash_next_index_insert(container->value.ht, &new_zval, sizeof(zval *), (void **) retval) == FAILURE) { - zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied"); - *retval = &EG(uninitialized_zval_ptr); - new_zval->refcount--; - } - } else { - *retval = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, type TSRMLS_CC); - } - SELECTIVE_PZVAL_LOCK(**retval, result); - break; - case IS_NULL: - /* for read-mode only */ - get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - *retval = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(**retval, result); - FREE_OP(Ts, op2, EG(free_op2)); - if (type==BP_VAR_W || type==BP_VAR_RW) { - zend_error(E_WARNING, "Cannot use a NULL value as an array"); - } - break; - case IS_STRING: { - zval *offset; - zval tmp; - - if (op2->op_type==IS_UNUSED) { - zend_error(E_ERROR, "[] operator not supported for strings"); - } - - offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - - if (offset->type != IS_LONG) { - tmp = *offset; - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; - } - if (type!=BP_VAR_R && type!=BP_VAR_IS) { - SEPARATE_ZVAL_IF_NOT_REF(container_ptr); - } - container = *container_ptr; - T(result->u.var).EA.data.str_offset.str = container; - PZVAL_LOCK(container); - T(result->u.var).EA.data.str_offset.offset = offset->value.lval; - T(result->u.var).EA.type = IS_STRING_OFFSET; - FREE_OP(Ts, op2, EG(free_op2)); - *retval = NULL; - return; - } - break; - default: { - zval *offset; - - offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - if (type==BP_VAR_R || type==BP_VAR_IS) { - *retval = &EG(uninitialized_zval_ptr); - } else { - *retval = &EG(error_zval_ptr); - } - FREE_OP(Ts, op2, EG(free_op2)); - SELECTIVE_PZVAL_LOCK(**retval, result); - if (type==BP_VAR_W || type==BP_VAR_RW) { - zend_error(E_WARNING, "Cannot use a scalar value as an array"); - } - } - break; - } -} - - -static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC) -{ - zval *free_op1; - zval *container = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R); - - if (container->type != IS_ARRAY) { - T(result->u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result); - return; - } - - T(result->u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, BP_VAR_R TSRMLS_CC); - SELECTIVE_PZVAL_LOCK(*T(result->u.var).var.ptr_ptr, result); -} - -static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC) -{ - zval **container_ptr = get_obj_zval_ptr_ptr(op1, Ts, type TSRMLS_CC); - zval *container; - zval ***retval = &T(result->u.var).var.ptr_ptr; - - container = *container_ptr; - if (container == EG(error_zval_ptr)) { - *retval = &EG(error_zval_ptr); - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - /* this should modify object only if it's empty */ - if (container->type == IS_NULL - || (container->type == IS_BOOL && container->value.lval==0) - || (container->type == IS_STRING && container->value.str.len == 0)) { - switch (type) { - case BP_VAR_RW: - case BP_VAR_W: - if (!PZVAL_IS_REF(container)) { - SEPARATE_ZVAL(container_ptr); - container = *container_ptr; - } - object_init(container); - break; - } - } - - if (container->type != IS_OBJECT) { - zval *offset; - - offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - FREE_OP(Ts, op2, EG(free_op2)); - if (type == BP_VAR_R || type == BP_VAR_IS) { - *retval = &EG(uninitialized_zval_ptr); - } else { - *retval = &EG(error_zval_ptr); - } - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - - - if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) { - SEPARATE_ZVAL(container_ptr); - container = *container_ptr; - } - *retval = zend_fetch_property_address_inner(container, op2, Ts, type TSRMLS_CC); - SELECTIVE_PZVAL_LOCK(**retval, result); -} - -static void zend_fetch_property_address_read(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC) -{ - zval *container; - zval **retval; - - retval = &T(result->u.var).var.ptr; - T(result->u.var).var.ptr_ptr = retval; - - container = get_obj_zval_ptr(op1, Ts, &EG(free_op1), type TSRMLS_CC); - - if (container == EG(error_zval_ptr)) { - *retval = EG(error_zval_ptr); - SELECTIVE_PZVAL_LOCK(*retval, result); - return; - } - - - if (container->type != IS_OBJECT) { - zend_error(E_NOTICE, "Trying to get property of non-object"); - - if (type==BP_VAR_R || type==BP_VAR_IS) { - *retval = EG(uninitialized_zval_ptr); - } else { - *retval = EG(error_zval_ptr); - } - } else { - zval *offset; - zval tmp; - - offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - switch (op2->op_type) { - case IS_CONST: - /* already a constant string */ - break; - case IS_VAR: - tmp = *offset; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - offset = &tmp; - break; - case IS_TMP_VAR: - convert_to_string(offset); - break; - } - - /* here we are sure we are dealing with an object */ - *retval = Z_OBJ_HT_P(container)->read_property(container, offset TSRMLS_CC); - if (offset == &tmp) { - zval_dtor(offset); - } - FREE_OP(Ts, op2, EG(free_op2)); - } - - SELECTIVE_PZVAL_LOCK(*retval, result); - return; -} - -static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp_variable * Ts, int (*incdec_op)(zval *) TSRMLS_DC) -{ - zval **object_ptr = get_obj_zval_ptr_ptr(op1, Ts, BP_VAR_W TSRMLS_CC); - zval *object; - zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - zval **retval = &T(result->u.var).var.ptr; - int have_get_ptr = 0; - - make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ - object = *object_ptr; - - if (object->type != IS_OBJECT) { - zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); - FREE_OP(Ts, op2, EG(free_op2)); - *retval = EG(uninitialized_zval_ptr); - - SELECTIVE_PZVAL_LOCK(*retval, result); - return; - } - - /* here we are sure we are dealing with an object */ - - if (Z_OBJ_HT_P(object)->get_property_zval_ptr) { - zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC); - if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - have_get_ptr = 1; - incdec_op(*zptr); - *retval = *zptr; - SELECTIVE_PZVAL_LOCK(*retval, result); - } - } - - if (!have_get_ptr) { - zval *z = Z_OBJ_HT_P(object)->read_property(object, property TSRMLS_CC); - SEPARATE_ZVAL_IF_NOT_REF(&z); - incdec_op(z); - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - if (z->refcount <= 1) { - zval_dtor(z); - } - } - - FREE_OP(Ts, op2, EG(free_op2)); -} - -static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, temp_variable * Ts, int (*incdec_op)(zval *) TSRMLS_DC) -{ - zval **object_ptr = get_obj_zval_ptr_ptr(op1, Ts, BP_VAR_W TSRMLS_CC); - zval *object; - zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R); - zval *retval = &T(result->u.var).tmp_var; - int have_get_ptr = 0; - - make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ - object = *object_ptr; - - if (object->type != IS_OBJECT) { - zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); - FREE_OP(Ts, op2, EG(free_op2)); - *retval = *EG(uninitialized_zval_ptr); - return; - } - - /* here we are sure we are dealing with an object */ - - if (Z_OBJ_HT_P(object)->get_property_zval_ptr) { - zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC); - if (zptr != NULL) { /* NULL means no success in getting PTR */ - have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - *retval = **zptr; - zendi_zval_copy_ctor(*retval); - - incdec_op(*zptr); - - } - } - - if (!have_get_ptr) { - zval *z = Z_OBJ_HT_P(object)->read_property(object, property TSRMLS_CC); - SEPARATE_ZVAL_IF_NOT_REF(&z); - *retval = *z; - zendi_zval_copy_ctor(*retval); - incdec_op(z); - Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); - if (z->refcount <= 1) { - zval_dtor(z); - } - } - - FREE_OP(Ts, op2, EG(free_op2)); -} - - -#if ZEND_INTENSIVE_DEBUGGING - -#define CHECK_SYMBOL_TABLES() \ - zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \ - if (&EG(symbol_table)!=EG(active_symbol_table)) { \ - zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \ - } - -static int zend_check_symbol(zval **pz TSRMLS_DC) -{ - if (Z_TYPE_PP(pz) > 9) { - fprintf(stderr, "Warning! %x has invalid type!\n", *pz); - } else if (Z_TYPE_PP(pz) == IS_ARRAY) { - zend_hash_apply(Z_ARRVAL_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC); - } else if (Z_TYPE_PP(pz) == IS_OBJECT) { - - /* OBJ-TBI - doesn't support new object model! */ - zend_hash_apply(Z_OBJPROP_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC); - } - - return 0; -} - - -#else -#define CHECK_SYMBOL_TABLES() -#endif - -#define NEXT_OPCODE() \ - CHECK_SYMBOL_TABLES() \ - EX(opline)++; \ - return 0; /* CHECK_ME */ - -#define RETURN_FROM_EXECUTE_LOOP(execute_data) \ - free_alloca(EX(Ts)); \ - EG(in_execution) = EX(original_in_execution); \ - EG(current_execute_data) = EX(prev_execute_data); \ - return 1; /* CHECK_ME */ - -opcode_handler_t zend_opcode_handlers[512]; - -ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC) -{ - ((zend_internal_function *) execute_data_ptr->function_state.function)->handler(execute_data_ptr->opline->extended_value, (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr, execute_data_ptr->object, return_value_used TSRMLS_CC); -} - -ZEND_API void execute(zend_op_array *op_array TSRMLS_DC) -{ - zend_execute_data execute_data; - - /* Initialize execute_data */ - EX(fbc) = NULL; - EX(object) = NULL; - EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable)*op_array->T); - EX(op_array) = op_array; - EX(original_in_execution) = EG(in_execution); - EX(prev_execute_data) = EG(current_execute_data); - EG(current_execute_data) = &execute_data; - - EG(in_execution) = 1; - if (op_array->start_op) { - EX(opline) = op_array->start_op; - } else { - EX(opline) = op_array->opcodes; - } - - if (op_array->uses_this && EG(This)) { - EG(This)->refcount++; /* For $this pointer */ - if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), NULL)==FAILURE) { - EG(This)->refcount--; - } - } - - EG(opline_ptr) = &EX(opline); - - EX(function_state).function = (zend_function *) op_array; - EG(function_state_ptr) = &EX(function_state); -#if ZEND_DEBUG - /* function_state.function_symbol_table is saved as-is to a stack, - * which is an intentional UMR. Shut it up if we're in DEBUG. - */ - EX(function_state).function_symbol_table = NULL; -#endif - if(EG(active_namespace) != op_array->ns) { - zend_switch_namespace(op_array->ns TSRMLS_CC); - } - - while (1) { -#ifdef ZEND_WIN32 - if (EG(timed_out)) { - zend_timeout(0); - } -#endif - - zend_clean_garbage(TSRMLS_C); - if (EX(opline)->handler(&execute_data, op_array TSRMLS_CC)) { - return; - } - } - zend_error(E_ERROR, "Arrived at end of main loop which shouldn't happen"); -} - -/* CHECK_ME */ -#undef EX -#define EX(element) execute_data->element - -int zend_add_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - add_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_sub_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - sub_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_mul_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - mul_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_div_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - div_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_mod_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - mod_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_sl_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - shift_left_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_sr_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - shift_right_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_concat_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - concat_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_is_identical_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - is_identical_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_is_not_identical_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - is_not_identical_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_is_equal_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - is_equal_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_is_not_equal_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - is_not_equal_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_is_smaller_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - is_smaller_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_is_smaller_or_equal_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - is_smaller_or_equal_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_bw_or_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - bitwise_or_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_bw_and_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - bitwise_and_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_bw_xor_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - bitwise_xor_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_bool_xor_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - boolean_xor_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - NEXT_OPCODE(); -} - - -int zend_bw_not_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - bitwise_not_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - NEXT_OPCODE(); -} - - -int zend_bool_not_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - boolean_not_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R) TSRMLS_CC); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - NEXT_OPCODE(); -} - - -inline int zend_binary_assign_op_helper(void *binary_op_arg, ZEND_OPCODE_HANDLER_ARGS) -{ - zval **var_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_RW); - int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = binary_op_arg; - - if (!var_ptr) { - zend_error(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets"); - } - - if (*var_ptr == EG(error_zval_ptr)) { - EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr, &EX(opline)->result); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); - } - - SEPARATE_ZVAL_IF_NOT_REF(var_ptr); - - binary_op(*var_ptr, *var_ptr, get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - EX_T(EX(opline)->result.u.var).var.ptr_ptr = var_ptr; - SELECTIVE_PZVAL_LOCK(*var_ptr, &EX(opline)->result); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - - NEXT_OPCODE(); -} - - -int zend_assign_add_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(add_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_sub_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(sub_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_mul_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(mul_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_div_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(div_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_mod_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(mod_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_sl_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(shift_left_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_sr_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(shift_right_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_concat_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(concat_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_bw_or_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(bitwise_or_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_bw_and_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(bitwise_and_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_bw_xor_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_binary_assign_op_helper(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_assign_add_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), add_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_sub_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), sub_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_mul_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), mul_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_div_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), div_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_mod_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), mod_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_sl_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), shift_left_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_sr_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), shift_right_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_concat_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), concat_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_bw_or_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), bitwise_or_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_bw_and_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), bitwise_and_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_bw_xor_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object_op(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts), bitwise_xor_function TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_pre_inc_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_pre_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), increment_function TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_pre_dec_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_pre_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), decrement_function TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_post_inc_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_post_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), increment_function TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_post_dec_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_post_incdec_property(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), decrement_function TSRMLS_CC); - NEXT_OPCODE(); -} - - -inline int zend_incdec_op_helper(void *incdec_op_arg, ZEND_OPCODE_HANDLER_ARGS) -{ - zval **var_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_RW); - int (*incdec_op)(zval *op1) = incdec_op_arg; - - if (!var_ptr) { - zend_error(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); - } - if (*var_ptr == EG(error_zval_ptr)) { - EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr, &EX(opline)->result); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); - } - - switch (EX(opline)->opcode) { - case ZEND_POST_INC: - case ZEND_POST_DEC: - EX_T(EX(opline)->result.u.var).tmp_var = **var_ptr; - zendi_zval_copy_ctor(EX_T(EX(opline)->result.u.var).tmp_var); - break; - } - - SEPARATE_ZVAL_IF_NOT_REF(var_ptr); - - incdec_op(*var_ptr); - - switch (EX(opline)->opcode) { - case ZEND_PRE_INC: - case ZEND_PRE_DEC: - EX_T(EX(opline)->result.u.var).var.ptr_ptr = var_ptr; - SELECTIVE_PZVAL_LOCK(*var_ptr, &EX(opline)->result); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - break; - } - NEXT_OPCODE(); -} - - -int zend_pre_inc_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_incdec_op_helper(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_pre_dec_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_incdec_op_helper(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_post_inc_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_incdec_op_helper(increment_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_post_dec_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_incdec_op_helper(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_print_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_print_variable(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R)); - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = 1; - EX_T(EX(opline)->result.u.var).tmp_var.type = IS_LONG; - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - NEXT_OPCODE(); -} - - -int zend_echo_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_print_variable(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R)); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - NEXT_OPCODE(); -} - - -int zend_fetch_r_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); -} - - -int zend_fetch_w_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_W TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_fetch_rw_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_RW TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_fetch_func_arg_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) { - /* Behave like FETCH_W */ - zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_W TSRMLS_CC); - } else { - /* Behave like FETCH_R */ - zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - } - NEXT_OPCODE(); -} - - -int zend_fetch_unset_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_R TSRMLS_CC); - PZVAL_UNLOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr); - if (EX_T(EX(opline)->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { - SEPARATE_ZVAL_IF_NOT_REF(EX_T(EX(opline)->result.u.var).var.ptr_ptr); - } - PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr); - NEXT_OPCODE(); -} - - -int zend_fetch_is_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_var_address(EX(opline), EX(Ts), BP_VAR_IS TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); -} - - -int zend_fetch_dim_r_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (EX(opline)->extended_value == ZEND_FETCH_ADD_LOCK) { - PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr); - } - zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); -} - - -int zend_fetch_dim_w_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_fetch_dim_rw_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_RW TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_fetch_dim_is_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_IS TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); -} - - -int zend_fetch_dim_func_arg_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) { - /* Behave like FETCH_DIM_W */ - zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC); - } else { - /* Behave like FETCH_DIM_R, except for locking used for list() */ - zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - } - NEXT_OPCODE(); -} - - -int zend_fetch_dim_unset_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - /* Not needed in DIM_UNSET - if (EX(opline)->extended_value == ZEND_FETCH_ADD_LOCK) { - PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr); - } - */ - zend_fetch_dimension_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - PZVAL_UNLOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr); - if (EX_T(EX(opline)->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { - SEPARATE_ZVAL_IF_NOT_REF(EX_T(EX(opline)->result.u.var).var.ptr_ptr); - } - PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr); - NEXT_OPCODE(); -} - - -int zend_fetch_obj_r_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); -} - - -int zend_fetch_obj_w_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_fetch_obj_rw_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_RW TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_fetch_obj_is_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_IS TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); -} - - -int zend_fetch_obj_func_arg_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->extended_value, EX(fbc), EX(fbc)->common.arg_types)) { - /* Behave like FETCH_OBJ_W */ - zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_W TSRMLS_CC); - } else { - zend_fetch_property_address_read(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - } - NEXT_OPCODE(); -} - - -int zend_fetch_obj_unset_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_property_address(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - - PZVAL_UNLOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr); - if (EX_T(EX(opline)->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { - SEPARATE_ZVAL_IF_NOT_REF(EX_T(EX(opline)->result.u.var).var.ptr_ptr); - } - PZVAL_LOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr); - NEXT_OPCODE(); -} - - -int zend_fetch_dim_tmp_var_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_fetch_dimension_address_from_tmp_var(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, EX(Ts) TSRMLS_CC); - AI_USE_PTR(EX_T(EX(opline)->result.u.var).var); - NEXT_OPCODE(); -} - - -int zend_make_var_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *value, *value2; - - value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - switch (EX(opline)->op1.op_type) { - case IS_TMP_VAR: - value2 = value; - ALLOC_ZVAL(value); - *value = *value2; - value->is_ref = 0; - value->refcount = 0; /* lock will increase this */ - break; - case IS_CONST: - value2 = value; - ALLOC_ZVAL(value); - *value = *value2; - zval_copy_ctor(value); - value->is_ref = 0; - value->refcount = 0; /* lock will increase this */ - break; - } - - EX_T(EX(opline)->result.u.var).var.ptr = value; - PZVAL_LOCK(EX_T(EX(opline)->result.u.var).var.ptr); - - NEXT_OPCODE(); -} - - -int zend_assign_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *op_data = EX(opline)+1; - zend_assign_to_object(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, &op_data->op1, EX(Ts) TSRMLS_CC); - /* assign_obj has two opcodes! */ - EX(opline)++; - NEXT_OPCODE(); -} - - -int zend_assign_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *value; - value = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - - zend_assign_to_variable(&EX(opline)->result, &EX(opline)->op1, &EX(opline)->op2, value, (EG(free_op2)?IS_TMP_VAR:EX(opline)->op2.op_type), EX(Ts) TSRMLS_CC); - /* zend_assign_to_variable() always takes care of op2, never free it! */ - - NEXT_OPCODE(); -} - - -int zend_assign_ref_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval **value_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op2, EX(Ts), BP_VAR_W); - - zend_assign_to_variable_reference(&EX(opline)->result, get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W), value_ptr_ptr, EX(Ts) TSRMLS_CC); - - NEXT_OPCODE(); -} - - -int zend_jmp_handler(ZEND_OPCODE_HANDLER_ARGS) -{ -#if DEBUG_ZEND>=2 - printf("Jumping to %d\n", EX(opline)->op1.u.opline_num); -#endif - EX(opline) = EX(opline)->op1.u.jmp_addr; - return 0; /* CHECK_ME */ -} - - -int zend_jmpz_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - znode *op1 = &EX(opline)->op1; - - if (!i_zend_is_true(get_zval_ptr(op1, EX(Ts), &EG(free_op1), BP_VAR_R))) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num); -#endif - EX(opline) = EX(opline)->op2.u.jmp_addr; - FREE_OP(EX(Ts), op1, EG(free_op1)); - return 0; /* CHECK_ME */ - } - FREE_OP(EX(Ts), op1, EG(free_op1)); - - NEXT_OPCODE(); -} - - -int zend_jmpnz_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - znode *op1 = &EX(opline)->op1; - - if (zend_is_true(get_zval_ptr(op1, EX(Ts), &EG(free_op1), BP_VAR_R))) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num); -#endif - EX(opline) = EX(opline)->op2.u.jmp_addr; - FREE_OP(EX(Ts), op1, EG(free_op1)); - return 0; /* CHECK_ME */ - } - FREE_OP(EX(Ts), op1, EG(free_op1)); - - NEXT_OPCODE(); -} - - -int zend_jmpznz_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - znode *res = &EX(opline)->op1; - - if (zend_is_true(get_zval_ptr(res, EX(Ts), &EG(free_op1), BP_VAR_R))) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp on true to %d\n", EX(opline)->extended_value); -#endif - EX(opline) = &op_array->opcodes[EX(opline)->extended_value]; - } else { -#if DEBUG_ZEND>=2 - printf("Conditional jmp on false to %d\n", EX(opline)->op2.u.opline_num); -#endif - EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num]; - } - FREE_OP(EX(Ts), res, EG(free_op1)); - - return 0; /* CHECK_ME */ -} - - -int zend_jmpz_ex_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *original_opline = EX(opline); - int retval = zend_is_true(get_zval_ptr(&original_opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R)); - - FREE_OP(EX(Ts), &original_opline->op1, EG(free_op1)); - EX_T(original_opline->result.u.var).tmp_var.value.lval = retval; - EX_T(original_opline->result.u.var).tmp_var.type = IS_BOOL; - if (!retval) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num); -#endif - EX(opline) = EX(opline)->op2.u.jmp_addr; - return 0; /* CHECK_ME */ - } - NEXT_OPCODE(); -} - - -int zend_jmpnz_ex_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op *original_opline = EX(opline); - int retval = zend_is_true(get_zval_ptr(&original_opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R)); - - FREE_OP(EX(Ts), &original_opline->op1, EG(free_op1)); - EX_T(original_opline->result.u.var).tmp_var.value.lval = retval; - EX_T(original_opline->result.u.var).tmp_var.type = IS_BOOL; - if (retval) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp to %d\n", EX(opline)->op2.u.opline_num); -#endif - EX(opline) = EX(opline)->op2.u.jmp_addr; - return 0; /* CHECK_ME */ - } - NEXT_OPCODE(); -} - - -int zend_free_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zendi_zval_dtor(EX_T(EX(opline)->op1.u.var).tmp_var); - NEXT_OPCODE(); -} - - -int zend_init_string_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - EX_T(EX(opline)->result.u.var).tmp_var.value.str.val = emalloc(1); - EX_T(EX(opline)->result.u.var).tmp_var.value.str.val[0] = 0; - EX_T(EX(opline)->result.u.var).tmp_var.value.str.len = 0; - EX_T(EX(opline)->result.u.var).tmp_var.refcount = 1; - EX_T(EX(opline)->result.u.var).tmp_var.type = IS_STRING; - EX_T(EX(opline)->result.u.var).tmp_var.is_ref = 0; - NEXT_OPCODE(); -} - - -int zend_add_char_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - add_char_to_string(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA), - &EX(opline)->op2.u.constant); - /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ - NEXT_OPCODE(); -} - - -int zend_add_string_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - add_string_to_string(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA), - &EX(opline)->op2.u.constant); - /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ - NEXT_OPCODE(); -} - - -int zend_add_var_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *var = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - zval var_copy; - int use_copy; - - zend_make_printable_zval(var, &var_copy, &use_copy); - if (use_copy) { - var = &var_copy; - } - add_string_to_string( &EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_NA), - var); - if (use_copy) { - zval_dtor(var); - } - /* original comment, possibly problematic: - * FREE_OP is missing intentionally here - we're always working on the same temporary variable - * (Zeev): I don't think it's problematic, we only use variables - * which aren't affected by FREE_OP(Ts, )'s anyway, unless they're - * string offsets or overloaded objects - */ - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - - NEXT_OPCODE(); -} - -static int zend_import_check_function(HashTable *target_ht, zend_function *function, zend_hash_key *hash_key, void *param) -{ - if(zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) { - zend_error(E_ERROR, "Import: function %s() already exists in current scope", function->common.function_name?function->common.function_name:"main"); - } - return 1; /* OK */ -} - -int zend_import_function_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce; - zend_function *function; - - ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - - if (EX(opline)->op2.op_type != IS_UNUSED) { - char *function_name_strval; - int function_name_strlen; - - function_name_strval = EX(opline)->op2.u.constant.value.str.val; - function_name_strlen = EX(opline)->op2.u.constant.value.str.len; - - if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen + 1, (void **) &function)==FAILURE) { - zend_error(E_ERROR, "Import: function %s() not found", function_name_strval); - } - if (zend_hash_add(EG(function_table), function_name_strval, function_name_strlen + 1, function, sizeof(zend_function), NULL) == FAILURE) { - zend_error(E_ERROR, "Import: function %s() already exists in current scope", function_name_strval); - } - function_add_ref(function); - } else { - zend_hash_merge_ex(EG(function_table), &ce->function_table, (copy_ctor_func_t) function_add_ref, sizeof(zend_function), (merge_checker_func_t)zend_import_check_function, NULL); - } - NEXT_OPCODE(); -} - -static int zend_import_check_class(HashTable *target_ht, zend_class_entry **ce, zend_hash_key *hash_key, void *param) -{ - if(zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) { - zend_error(E_ERROR, "Import: class '%s' already exists in current scope", (*ce)->name); - } - return 1; /* OK */ -} - -int zend_import_class_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce; - zend_class_entry **import_ce; - - ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - - if (EX(opline)->op2.op_type != IS_UNUSED) { - char *class_name_strval; - int class_name_strlen; - - class_name_strval = EX(opline)->op2.u.constant.value.str.val; - class_name_strlen = EX(opline)->op2.u.constant.value.str.len; - - if (zend_hash_find(&ce->class_table, class_name_strval, class_name_strlen + 1, (void **) &import_ce)==FAILURE) { - zend_error(E_ERROR, "Import: class %s not found", class_name_strval); - } - if (zend_hash_add(EG(class_table), class_name_strval, class_name_strlen + 1, import_ce, sizeof(zend_class_entry *), NULL) == FAILURE) { - zend_error(E_ERROR, "Import: class %s already exists in current scope", class_name_strval); - } - zend_class_add_ref(import_ce); - } else { - zend_hash_merge_ex(EG(class_table), &ce->class_table, (copy_ctor_func_t) zend_class_add_ref, sizeof(zend_class_entry *), (merge_checker_func_t)zend_import_check_class, NULL); - } - - NEXT_OPCODE(); -} - - -int zend_import_const_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce; - zval **import_constant; - zend_constant c; - - ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - if (EX(opline)->op2.op_type != IS_UNUSED) { - char *const_name_strval; - int const_name_strlen; - - const_name_strval = EX(opline)->op2.u.constant.value.str.val; - const_name_strlen = EX(opline)->op2.u.constant.value.str.len; - - if (zend_hash_find(&ce->constants_table, const_name_strval, const_name_strlen + 1, (void **) &import_constant)==FAILURE) { - zend_error(E_ERROR, "Import: constant %s not found", const_name_strval); - } - c.value = **import_constant; - zval_copy_ctor(&c.value); - c.flags = CONST_CS; - c.name = zend_strndup(const_name_strval, const_name_strlen); - c.name_len = const_name_strlen + 1; - - if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { - zend_error(E_ERROR, "Import: unable to register constant %s", const_name_strval); - } - } else { - HashPosition pos; - char *key; - uint key_length; - int key_type; - ulong dummy; - - zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos); - while (zend_hash_get_current_data_ex(&ce->constants_table, (void **)&import_constant, &pos) == SUCCESS) { - key_type = zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_length, &dummy, 0, &pos); - - c.value = **import_constant; - zval_copy_ctor(&c.value); - c.flags = CONST_CS; - c.name = zend_strndup(key, key_length - 1); - c.name_len = key_length; - - if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { - zend_error(E_ERROR, "Import: unable to register constant %s", key); - } - zend_hash_move_forward_ex(&ce->constants_table, &pos); - } - } - NEXT_OPCODE(); -} - - -int zend_fetch_class_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry **pce; - zend_class_entry *ce = NULL; - zend_bool is_const; - char *class_name_strval = NULL; - zend_uint class_name_strlen = 0; - zval *class_name; - zval tmp; - - if (EX(opline)->op2.op_type == IS_UNUSED) { - if (EX(opline)->extended_value == ZEND_FETCH_CLASS_SELF) { - if (!EG(scope)) { - zend_error(E_ERROR, "Cannot access self:: when no class scope is active"); - } - EX_T(EX(opline)->result.u.var).EA.class_entry = EG(scope); - NEXT_OPCODE(); - } else if (EX(opline)->extended_value == ZEND_FETCH_CLASS_MAIN) { - EX_T(EX(opline)->result.u.var).EA.class_entry = EG(global_namespace_ptr); - NEXT_OPCODE(); - } else if (EX(opline)->extended_value == 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"); - } - EX_T(EX(opline)->result.u.var).EA.class_entry = EG(scope)->parent; - NEXT_OPCODE(); - } - } - - is_const = (EX(opline)->op2.op_type == IS_CONST); - - if (is_const) { - class_name_strval = EX(opline)->op2.u.constant.value.str.val; - class_name_strlen = EX(opline)->op2.u.constant.value.str.len; - } else { - class_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - - if (class_name->type == IS_OBJECT) { - ce = Z_OBJCE_P(class_name); - } else { - tmp = *class_name; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - zend_str_tolower(tmp.value.str.val, tmp.value.str.len); - - class_name_strval = tmp.value.str.val; - class_name_strlen = tmp.value.str.len; - } - } - - if (!ce) { - int retval; - - if (EX(opline)->op1.op_type == IS_UNUSED && EX(opline)->extended_value != ZEND_FETCH_CLASS_GLOBAL) { - retval = zend_lookup_class(class_name_strval, class_name_strlen, &pce TSRMLS_CC); - - if(retval == FAILURE) { - /* try namespace */ - if(zend_hash_find(&EG(global_namespace_ptr)->class_table, class_name_strval, class_name_strlen+1, (void **)&pce) == SUCCESS && CLASS_IS_NAMESPACE((*pce))) { - retval = SUCCESS; - } - } - } else { - zend_namespace *ns; - - /* Looking for namespace */ - if(EX(opline)->extended_value == ZEND_FETCH_CLASS_GLOBAL) { - ns = EG(global_namespace_ptr); - } else { - if (zend_hash_find(&EG(global_namespace_ptr)->class_table, EX(opline)->op1.u.constant.value.str.val, EX(opline)->op1.u.constant.value.str.len+1, (void **)&pce) == FAILURE || !CLASS_IS_NAMESPACE((*pce))) { - zend_error(E_ERROR, "Namespace '%s' not found", EX(opline)->op1.u.constant.value.str.val); - } - ns = *pce; - } - retval = zend_hash_find(&ns->class_table, class_name_strval, class_name_strlen+1, (void **)&pce); - } - if (retval==SUCCESS) { - ce = *pce; - } - } - - if (!ce) { - zend_error(E_ERROR, "Class '%s' not found", class_name_strval); - } else { - EX_T(EX(opline)->result.u.var).EA.class_entry = ce; - } - if (!is_const) { - zval_dtor(&tmp); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - } - NEXT_OPCODE(); -} - - -int zend_init_ctor_call_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope)); - - if (EX(opline)->op1.op_type == IS_VAR) { - SELECTIVE_PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr, &EX(opline)->op1); - } - - /* We are not handling overloaded classes right now */ - EX(object) = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ - } else { - zval *this_ptr; - - ALLOC_ZVAL(this_ptr); - *this_ptr = *EX(object); - INIT_PZVAL(this_ptr); - zval_copy_ctor(this_ptr); - EX(object) = this_ptr; - } - - EX(fbc) = EX(fbc_constructor); - if (EX(fbc)->type == ZEND_USER_FUNCTION) { /* HACK!! */ - EX(calling_scope) = EX(fbc)->common.scope; - } else { - EX(calling_scope) = NULL; - } - - NEXT_OPCODE(); -} - - -int zend_init_method_call_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *function_name; - char *function_name_strval; - int function_name_strlen; - - zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope)); - - function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - function_name_strval = function_name->value.str.val; - function_name_strlen = function_name->value.str.len; - - EX(calling_scope) = EG(scope); - - EX(object) = get_obj_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R TSRMLS_CC); - - if (EX(object) && EX(object)->type == IS_OBJECT) { - /* First, locate the function. */ - EX(fbc) = Z_OBJ_HT_P(EX(object))->get_method(EX(object), function_name_strval, function_name_strlen TSRMLS_CC); - if (!EX(fbc)) { - zend_error(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); - } - } else { - zend_error(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); - } - - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { - EX(object) = NULL; - } else { - if (!PZVAL_IS_REF(EX(object))) { - EX(object)->refcount++; /* For $this pointer */ - } else { - zval *this_ptr; - ALLOC_ZVAL(this_ptr); - *this_ptr = *EX(object); - INIT_PZVAL(this_ptr); - zval_copy_ctor(this_ptr); - EX(object) = this_ptr; - } - } - - if (EX(fbc)->type == ZEND_USER_FUNCTION) { - EX(calling_scope) = EX(fbc)->common.scope; - } else { - EX(calling_scope) = NULL; - } - - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - - NEXT_OPCODE(); -} - - -int zend_init_static_method_call_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *function_name; - zval tmp; - zend_class_entry *ce; - zend_bool is_const; - char *function_name_strval; - int function_name_strlen; - - zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope)); - - is_const = (EX(opline)->op2.op_type == IS_CONST); - - if (is_const) { - function_name_strval = EX(opline)->op2.u.constant.value.str.val; - function_name_strlen = EX(opline)->op2.u.constant.value.str.len; - } else { - function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - - tmp = *function_name; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - zend_str_tolower(tmp.value.str.val, tmp.value.str.len); - - function_name_strval = tmp.value.str.val; - function_name_strlen = tmp.value.str.len; - } - - if (EX(opline)->op1.op_type == IS_UNUSED) { - ce = EG(global_namespace_ptr); - } else { - ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - } - - EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); - EX(calling_scope) = EX(fbc)->common.scope; - - if (!is_const) { - zval_dtor(&tmp); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - } - - if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) { - EX(object) = NULL; - } else { - if ((EX(object) = EG(This))) { - EX(object)->refcount++; - } - } - - NEXT_OPCODE(); -} - - -int zend_init_fcall_by_name_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *function_name; - zend_function *function; - zval tmp; - zend_bool is_const; - char *function_name_strval; - int function_name_strlen; - - zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope)); - - is_const = (EX(opline)->op2.op_type == IS_CONST); - - if (is_const) { - function_name_strval = EX(opline)->op2.u.constant.value.str.val; - function_name_strlen = EX(opline)->op2.u.constant.value.str.len; - } else { - function_name = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - - tmp = *function_name; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - zend_str_tolower(tmp.value.str.val, tmp.value.str.len); - - function_name_strval = tmp.value.str.val; - function_name_strlen = tmp.value.str.len; - } - - - do { - /* - if (EG(scope)) { - if (zend_hash_find(&EG(scope)->function_table, function_name_strval, function_name_strlen+1, (void **) &function) == SUCCESS) { - if ((EX(object) = EG(This))) { - EX(object)->refcount++; - } - EX(calling_scope) = EG(scope); - break; - } - } - */ - if (zend_hash_find(EG(function_table), function_name_strval, function_name_strlen+1, (void **) &function)==FAILURE) { - /* try global space also */ - if(zend_hash_find(&EG(global_namespace_ptr)->function_table, function_name_strval, function_name_strlen+1, (void **) &function)==FAILURE) { - zend_error(E_ERROR, "Call to undefined function: %s()", function_name_strval); - } - } - EX(calling_scope) = function->common.scope; - EX(object) = NULL; - } while (0); - - if (!is_const) { - zval_dtor(&tmp); - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - } - EX(fbc) = function; - - NEXT_OPCODE(); -} - - -int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS) -{ - zval **original_return_value; - zend_class_entry *current_scope; - zval *current_this; - int return_value_used = RETURN_VALUE_USED(EX(opline)); - zend_namespace *active_namespace = EG(active_namespace); - - zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) EX(opline)->extended_value, NULL); - - EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr; - - current_this = EG(This); - EG(This) = EX(object); - current_scope = EG(scope); - EG(scope) = EX(calling_scope); - - if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { - ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); - INIT_ZVAL(*(EX_T(EX(opline)->result.u.var).var.ptr)); - - if (!zend_execute_internal) { - /* saves one function call if zend_execute_internal is not used */ - ((zend_internal_function *) EX(function_state).function)->handler(EX(opline)->extended_value, EX_T(EX(opline)->result.u.var).var.ptr, EX(object), return_value_used TSRMLS_CC); - } else { - zend_execute_internal(execute_data, return_value_used TSRMLS_CC); - } - - EG(current_execute_data) = execute_data; - EX_T(EX(opline)->result.u.var).var.ptr->is_ref = 0; - EX_T(EX(opline)->result.u.var).var.ptr->refcount = 1; - if (!return_value_used) { - zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr); - } - } else if (EX(function_state).function->type == ZEND_USER_FUNCTION) { - HashTable *calling_symbol_table; - - EX_T(EX(opline)->result.u.var).var.ptr = NULL; - if (EG(symtable_cache_ptr)>=EG(symtable_cache)) { - /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/ - EX(function_state).function_symbol_table = *(EG(symtable_cache_ptr)--); - } else { - ALLOC_HASHTABLE(EX(function_state).function_symbol_table); - zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0); - /*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/ - } - calling_symbol_table = EG(active_symbol_table); - EG(active_symbol_table) = EX(function_state).function_symbol_table; - original_return_value = EG(return_value_ptr_ptr); - EG(return_value_ptr_ptr) = EX_T(EX(opline)->result.u.var).var.ptr_ptr; - EG(active_op_array) = (zend_op_array *) EX(function_state).function; - - zend_execute(EG(active_op_array) TSRMLS_CC); - - if (return_value_used && !EX_T(EX(opline)->result.u.var).var.ptr) { - if (!EG(exception)) { - ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); - INIT_ZVAL(*EX_T(EX(opline)->result.u.var).var.ptr); - } - } else if (!return_value_used && EX_T(EX(opline)->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr); - } - - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = op_array; - EG(return_value_ptr_ptr)=original_return_value; - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(EX(function_state).function_symbol_table); - FREE_HASHTABLE(EX(function_state).function_symbol_table); - } else { - *(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table; - zend_hash_clean(*EG(symtable_cache_ptr)); - } - EG(active_symbol_table) = calling_symbol_table; - } else { /* ZEND_OVERLOADED_FUNCTION */ - ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); - INIT_ZVAL(*(EX_T(EX(opline)->result.u.var).var.ptr)); - - /* Not sure what should be done here if it's a static method */ - if (EX(object)) { - Z_OBJ_HT_P(EX(object))->call_method(EX(fbc)->common.function_name, EX(opline)->extended_value, EX_T(EX(opline)->result.u.var).var.ptr, EX(object), return_value_used TSRMLS_CC); - } else { - zend_error(E_ERROR, "Cannot call overloaded function for non-object"); - } - - efree(EX(fbc)); - if (!return_value_used) { - zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr); - } - } - if (EG(This)) { - zval_ptr_dtor(&EG(This)); - } - EG(This) = current_this; - EG(scope) = current_scope; - zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &EX(fbc)); - - if(EG(active_namespace) != active_namespace) { - zend_switch_namespace(active_namespace TSRMLS_CC); - } - EX(function_state).function = (zend_function *) op_array; - EG(function_state_ptr) = &EX(function_state); - zend_ptr_stack_clear_multiple(TSRMLS_C); - - if (EG(exception)) { - if (EX(opline)->op2.u.opline_num == -1) { - RETURN_FROM_EXECUTE_LOOP(execute_data); - } else { - EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num]; - return 0; /* CHECK_ME */ - } - } - - NEXT_OPCODE(); -} - - -int zend_do_fcall_by_name_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - EX(function_state).function = EX(fbc); - return zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_do_fcall_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *fname = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - zend_ptr_stack_n_push(&EG(arg_types_stack), 3, EX(fbc), EX(object), EX(calling_scope)); - - do { - /* - if (EG(scope)) { - if (zend_hash_find(&EG(scope)->function_table, fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function) == SUCCESS) { - if ((EX(object) = EG(This))) { - EX(object)->refcount++; - } - EX(calling_scope) = EG(scope); - break; - } - } - */ - if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) { - zend_error(E_ERROR, "Unknown function: %s()\n", fname->value.str.val); - } - EX(object) = NULL; - EX(calling_scope) = EX(function_state).function->common.scope; - } while (0); - - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - - return zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_return_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *retval_ptr; - zval **retval_ptr_ptr; - - if ((EG(active_op_array)->return_reference == ZEND_RETURN_REF) && - (EX(opline)->op1.op_type != IS_CONST) && - (EX(opline)->op1.op_type != IS_TMP_VAR)) { - - retval_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W); - - if (!retval_ptr_ptr) { - zend_error(E_ERROR, "Cannot return overloaded elements or string offsets by reference"); - } - - SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); - (*retval_ptr_ptr)->refcount++; - - (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); - } else { - retval_ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - if (!EG(free_op1)) { /* Not a temp var */ - if (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0) { - ALLOC_ZVAL(*(EG(return_value_ptr_ptr))); - **EG(return_value_ptr_ptr) = *retval_ptr; - (*EG(return_value_ptr_ptr))->is_ref = 0; - (*EG(return_value_ptr_ptr))->refcount = 1; - zval_copy_ctor(*EG(return_value_ptr_ptr)); - } else { - *EG(return_value_ptr_ptr) = retval_ptr; - retval_ptr->refcount++; - } - } else { - ALLOC_ZVAL(*(EG(return_value_ptr_ptr))); - **EG(return_value_ptr_ptr) = *retval_ptr; - (*EG(return_value_ptr_ptr))->refcount = 1; - (*EG(return_value_ptr_ptr))->is_ref = 0; - } - } - RETURN_FROM_EXECUTE_LOOP(execute_data); -} - - -int zend_throw_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *value; - zval *exception; - - value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - if (value->type != IS_OBJECT) { - zend_error(E_ERROR, "Can only throw objects"); - } - /* Not sure if a complete copy is what we want here */ - MAKE_STD_ZVAL(exception); - *exception = *value; - if (!EG(free_op1)) { - zval_copy_ctor(exception); - } - INIT_PZVAL(exception); - EG(exception) = exception; - - if (EX(opline)->op2.u.opline_num == -1) { - RETURN_FROM_EXECUTE_LOOP(execute_data); - } else { - EX(opline) = &op_array->opcodes[EX(opline)->op2.u.opline_num]; - return 0; /* CHECK_ME */ - } - NEXT_OPCODE(); -} - - -int zend_catch_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce; - - /* Check if this is really an exception, if not, jump over code */ - if (EG(exception) == NULL) { - EX(opline) = &op_array->opcodes[EX(opline)->extended_value]; - return 0; /* CHECK_ME */ - } - ce = Z_OBJCE_P(EG(exception)); - if (ce != EX_T(EX(opline)->op1.u.var).EA.class_entry) { - while (ce->parent) { - if (ce->parent == EX_T(EX(opline)->op1.u.var).EA.class_entry) { - goto exception_should_be_taken; - } - ce = ce->parent; - } - EX(opline) = &op_array->opcodes[EX(opline)->extended_value]; - return 0; /* CHECK_ME */ - } - -exception_should_be_taken: - zend_hash_update(EG(active_symbol_table), EX(opline)->op2.u.constant.value.str.val, - EX(opline)->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL); - EG(exception) = NULL; - NEXT_OPCODE(); -} - - -int zend_send_val_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (EX(opline)->extended_value==ZEND_DO_FCALL_BY_NAME - && ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) { - zend_error(E_ERROR, "Cannot pass parameter %d by reference", EX(opline)->op2.u.opline_num); - } - { - zval *valptr; - zval *value; - - value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - ALLOC_ZVAL(valptr); - *valptr = *value; - if (!EG(free_op1)) { - zval_copy_ctor(valptr); - } - INIT_PZVAL(valptr); - zend_ptr_stack_push(&EG(argument_stack), valptr); - } - NEXT_OPCODE(); -} - - -inline int zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *varptr; - varptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - if (varptr == &EG(uninitialized_zval)) { - ALLOC_ZVAL(varptr); - INIT_ZVAL(*varptr); - varptr->refcount = 0; - } else if (PZVAL_IS_REF(varptr)) { - zval *original_var = varptr; - - ALLOC_ZVAL(varptr); - *varptr = *original_var; - varptr->is_ref = 0; - varptr->refcount = 0; - zval_copy_ctor(varptr); - } - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); /* for string offsets */ - - NEXT_OPCODE(); -} - - -int zend_send_var_no_ref_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (EX(opline)->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */ - if (!(EX(opline)->extended_value & ZEND_ARG_SEND_BY_REF)) { - return zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - } else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) { - return zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - { - zval *varptr; - varptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) { - varptr->is_ref = 1; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); - NEXT_OPCODE(); - } - zend_error(E_ERROR, "Only variables can be passed by reference"); - } - NEXT_OPCODE(); -} - - -int zend_send_ref_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval **varptr_ptr; - zval *varptr; - varptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W); - - if (!varptr_ptr) { - zend_error(E_ERROR, "Only variables can be passed by reference"); - } - - SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr); - varptr = *varptr_ptr; - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); - - NEXT_OPCODE(); -} - - -int zend_send_var_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if ((EX(opline)->extended_value == ZEND_DO_FCALL_BY_NAME) - && ARG_SHOULD_BE_SENT_BY_REF(EX(opline)->op2.u.opline_num, EX(fbc), EX(fbc)->common.arg_types)) { - return zend_send_ref_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); - } - return zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_recv_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval **param; - - if (zend_ptr_stack_get_arg(EX(opline)->op1.u.constant.value.lval, (void **) ¶m TSRMLS_CC)==FAILURE) { - zend_error(E_WARNING, "Missing argument %d for %s()\n", EX(opline)->op1.u.constant.value.lval, get_active_function_name(TSRMLS_C)); - if (EX(opline)->result.op_type == IS_VAR) { - PZVAL_UNLOCK(*EX_T(EX(opline)->result.u.var).var.ptr_ptr); - } - } else if (PZVAL_IS_REF(*param)) { - zend_assign_to_variable_reference(&EX(opline)->result, get_zval_ptr_ptr(&EX(opline)->result, EX(Ts), BP_VAR_W), param, NULL TSRMLS_CC); - } else { - zend_assign_to_variable(&EX(opline)->result, &EX(opline)->result, NULL, *param, IS_VAR, EX(Ts) TSRMLS_CC); - } - - NEXT_OPCODE(); -} - - -int zend_recv_init_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval **param, *assignment_value; - - if (zend_ptr_stack_get_arg(EX(opline)->op1.u.constant.value.lval, (void **) ¶m TSRMLS_CC)==FAILURE) { - if (EX(opline)->op2.u.constant.type == IS_CONSTANT || EX(opline)->op2.u.constant.type==IS_CONSTANT_ARRAY) { - zval *default_value; - - ALLOC_ZVAL(default_value); - *default_value = EX(opline)->op2.u.constant; - if (EX(opline)->op2.u.constant.type==IS_CONSTANT_ARRAY) { - zval_copy_ctor(default_value); - } - default_value->refcount=1; - zval_update_constant(&default_value, 0 TSRMLS_CC); - default_value->refcount=0; - default_value->is_ref=0; - param = &default_value; - assignment_value = default_value; - } else { - param = NULL; - assignment_value = &EX(opline)->op2.u.constant; - } - zend_assign_to_variable(&EX(opline)->result, &EX(opline)->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC); - } else { - assignment_value = *param; - if (PZVAL_IS_REF(assignment_value)) { - zend_assign_to_variable_reference(&EX(opline)->result, get_zval_ptr_ptr(&EX(opline)->result, EX(Ts), BP_VAR_W), param, NULL TSRMLS_CC); - } else { - zend_assign_to_variable(&EX(opline)->result, &EX(opline)->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC); - } - } - - NEXT_OPCODE(); -} - - -int zend_bool_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = zend_is_true(get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R)); - EX_T(EX(opline)->result.u.var).tmp_var.type = IS_BOOL; - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - - NEXT_OPCODE(); -} - - -inline int zend_brk_cont_helper(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *nest_levels_zval = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - zval tmp; - int array_offset, nest_levels, original_nest_levels; - zend_brk_cont_element *jmp_to; - - if (nest_levels_zval->type != IS_LONG) { - tmp = *nest_levels_zval; - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - nest_levels = tmp.value.lval; - } else { - nest_levels = nest_levels_zval->value.lval; - } - original_nest_levels = nest_levels; - array_offset = EX(opline)->op1.u.opline_num; - do { - if (array_offset==-1) { - zend_error(E_ERROR, "Cannot break/continue %d level%s", original_nest_levels, (original_nest_levels == 1) ? "" : "s"); - } - jmp_to = &op_array->brk_cont_array[array_offset]; - if (nest_levels>1) { - zend_op *brk_opline = &op_array->opcodes[jmp_to->brk]; - - switch (brk_opline->opcode) { - case ZEND_SWITCH_FREE: - zend_switch_free(brk_opline, EX(Ts) TSRMLS_CC); - break; - case ZEND_FREE: - zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); - break; - } - } - array_offset = jmp_to->parent; - } while (--nest_levels > 0); - - if (EX(opline)->opcode == ZEND_BRK) { - EX(opline) = op_array->opcodes+jmp_to->brk; - } else { - EX(opline) = op_array->opcodes+jmp_to->cont; - } - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - return 0; /* CHECK_ME */ -} - - -int zend_brk_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_brk_cont_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_cont_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_brk_cont_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_case_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - int switch_expr_is_overloaded=0; - - if (EX(opline)->op1.op_type==IS_VAR) { - if (EX_T(EX(opline)->op1.u.var).var.ptr_ptr) { - PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr); - } else { - switch_expr_is_overloaded = 1; - if (EX_T(EX(opline)->op1.u.var).EA.type==IS_STRING_OFFSET) { - EX_T(EX(opline)->op1.u.var).EA.data.str_offset.str->refcount++; - } - } - } - is_equal_function(&EX_T(EX(opline)->result.u.var).tmp_var, - get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R), - get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R) TSRMLS_CC); - - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - if (switch_expr_is_overloaded) { - /* We only free op1 if this is a string offset, - * Since if it is a TMP_VAR, it'll be reused by - * other CASE opcodes (whereas string offsets - * are allocated at each get_zval_ptr()) - */ - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - EX_T(EX(opline)->op1.u.var).var.ptr_ptr = NULL; - AI_USE_PTR(EX_T(EX(opline)->op1.u.var).var); - } - NEXT_OPCODE(); -} - - -int zend_switch_free_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_switch_free(EX(opline), EX(Ts) TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_new_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (EX_T(EX(opline)->op1.u.var).EA.class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_ABSTRACT_CLASS)) { - char *class_type; - - if (EX_T(EX(opline)->op1.u.var).EA.class_entry->ce_flags & ZEND_ACC_INTERFACE) { - class_type = "interface"; - } else { - class_type = "abstract class"; - } - zend_error(E_ERROR, "Cannot instantiate %s %s", class_type, EX_T(EX(opline)->op1.u.var).EA.class_entry->name); - } - EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr; - ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); - object_init_ex(EX_T(EX(opline)->result.u.var).var.ptr, EX_T(EX(opline)->op1.u.var).EA.class_entry); - EX_T(EX(opline)->result.u.var).var.ptr->refcount=1; - EX_T(EX(opline)->result.u.var).var.ptr->is_ref=1; - - NEXT_OPCODE(); -} - - -int zend_clone_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *obj = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr; - ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); - EX_T(EX(opline)->result.u.var).var.ptr->value.obj = Z_OBJ_HT_P(obj)->clone_obj(obj TSRMLS_CC); - EX_T(EX(opline)->result.u.var).var.ptr->type = IS_OBJECT; - EX_T(EX(opline)->result.u.var).var.ptr->refcount=1; - EX_T(EX(opline)->result.u.var).var.ptr->is_ref=1; - NEXT_OPCODE(); -} - - -int zend_fetch_constant_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce = NULL; - zval **value; - - if (EX(opline)->op1.op_type == IS_UNUSED) { - if (EG(scope)) { - ce = EG(scope); - if (zend_hash_find(&ce->constants_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EX_T(EX(opline)->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var); - NEXT_OPCODE(); - } - } - if(EG(active_namespace) != EG(global_namespace_ptr)) { - /* if we are not global, go find in local constant table */ - if (zend_hash_find(&EG(active_namespace)->constants_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EX_T(EX(opline)->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var); - NEXT_OPCODE(); - } - } - - if (!zend_get_constant(EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len, &EX_T(EX(opline)->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - EX(opline)->op2.u.constant.value.str.val, - EX(opline)->op2.u.constant.value.str.val); - EX_T(EX(opline)->result.u.var).tmp_var = EX(opline)->op2.u.constant; - zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var); - } - NEXT_OPCODE(); - } - - ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - - if (&ce->constants_table == &EG(global_namespace_ptr)->constants_table) { - if (!zend_get_constant(EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len, &EX_T(EX(opline)->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - EX(opline)->op2.u.constant.value.str.val, - EX(opline)->op2.u.constant.value.str.val); - EX_T(EX(opline)->result.u.var).tmp_var = EX(opline)->op2.u.constant; - zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var); - } - NEXT_OPCODE(); - } - if (zend_hash_find(&ce->constants_table, EX(opline)->op2.u.constant.value.str.val, EX(opline)->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { - zval_update_constant(value, (void *) 1 TSRMLS_CC); - EX_T(EX(opline)->result.u.var).tmp_var = **value; - zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var); - } else { - zend_error(E_ERROR, "Undefined class constant '%s'", EX(opline)->op2.u.constant.value.str.val); - } - - NEXT_OPCODE(); -} - - -inline int zend_init_add_array_helper(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *array_ptr = &EX_T(EX(opline)->result.u.var).tmp_var; - zval *expr_ptr, **expr_ptr_ptr = NULL; - zval *offset=get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - - if (EX(opline)->extended_value) { - expr_ptr_ptr=get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R); - expr_ptr = *expr_ptr_ptr; - } else { - expr_ptr=get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - } - - if (EX(opline)->opcode == ZEND_INIT_ARRAY) { - array_init(array_ptr); - if (!expr_ptr) { - NEXT_OPCODE(); - } - } - if (!EX(opline)->extended_value && EG(free_op1)) { /* temporary variable */ - zval *new_expr; - - ALLOC_ZVAL(new_expr); - *new_expr = *expr_ptr; - expr_ptr = new_expr; - INIT_PZVAL(expr_ptr); - } else { - if (EX(opline)->extended_value) { - SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); - expr_ptr = *expr_ptr_ptr; - expr_ptr->refcount++; - } else if (PZVAL_IS_REF(expr_ptr)) { - zval *new_expr; - - ALLOC_ZVAL(new_expr); - *new_expr = *expr_ptr; - expr_ptr = new_expr; - zendi_zval_copy_ctor(*expr_ptr); - INIT_PZVAL(expr_ptr); - } else { - expr_ptr->refcount++; - } - } - if (offset) { - switch (offset->type) { - case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); - break; - case IS_LONG: - case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); - break; - case IS_STRING: - zend_hash_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); - break; - case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); - break; - default: - zval_ptr_dtor(&expr_ptr); - /* do nothing */ - break; - } - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); - } - NEXT_OPCODE(); -} - - -int zend_init_array_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_init_add_array_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_add_array_element_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - return zend_init_add_array_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); -} - - -int zend_cast_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *expr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - zval *result = &EX_T(EX(opline)->result.u.var).tmp_var; - - *result = *expr; - if (!EG(free_op1)) { - zendi_zval_copy_ctor(*result); - } - switch (EX(opline)->extended_value) { - case IS_NULL: - convert_to_null(result); - break; - case IS_BOOL: - convert_to_boolean(result); - break; - case IS_LONG: - convert_to_long(result); - break; - case IS_DOUBLE: - convert_to_double(result); - break; - case IS_STRING: - convert_to_string(result); - break; - case IS_ARRAY: - convert_to_array(result); - break; - case IS_OBJECT: - convert_to_object(result); - break; - } - NEXT_OPCODE(); -} - - -int zend_include_or_eval_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_op_array *new_op_array=NULL; - zval **original_return_value = EG(return_value_ptr_ptr); - int return_value_used; - zval *inc_filename = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - zval tmp_inc_filename; - zend_bool failure_retval=0; - - if (inc_filename->type!=IS_STRING) { - tmp_inc_filename = *inc_filename; - zval_copy_ctor(&tmp_inc_filename); - convert_to_string(&tmp_inc_filename); - inc_filename = &tmp_inc_filename; - } - - return_value_used = RETURN_VALUE_USED(EX(opline)); - - switch (EX(opline)->op2.u.constant.value.lval) { - case ZEND_INCLUDE_ONCE: - case ZEND_REQUIRE_ONCE: { - int dummy = 1; - zend_file_handle file_handle; - - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { - - if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); - } - - if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - CG(active_namespace) = EG(global_namespace_ptr); - new_op_array = zend_compile_file(&file_handle, (EX(opline)->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); - zend_destroy_file_handle(&file_handle TSRMLS_CC); - } else { - zend_file_handle_dtor(&file_handle); - failure_retval=1; - } - } else { - if (EX(opline)->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); - } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); - } - } - break; - } - break; - case ZEND_INCLUDE: - case ZEND_REQUIRE: - CG(active_namespace) = EG(global_namespace_ptr); - new_op_array = compile_filename(EX(opline)->op2.u.constant.value.lval, inc_filename TSRMLS_CC); - break; - case ZEND_EVAL: { - char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); - - CG(active_namespace) = EG(global_namespace_ptr); - new_op_array = compile_string(inc_filename, eval_desc TSRMLS_CC); - efree(eval_desc); - } - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - if (inc_filename==&tmp_inc_filename) { - zval_dtor(&tmp_inc_filename); - } - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr; - if (new_op_array) { - zval *saved_object; - zend_function *saved_function; - zend_namespace *active_namespace = EG(active_namespace); - - EG(return_value_ptr_ptr) = EX_T(EX(opline)->result.u.var).var.ptr_ptr; - EG(active_op_array) = new_op_array; - EX_T(EX(opline)->result.u.var).var.ptr = NULL; - - saved_object = EX(object); - saved_function = EX(function_state).function; - - EX(function_state).function = (zend_function *) new_op_array; - EX(object) = NULL; - zend_switch_namespace(EG(global_namespace_ptr) TSRMLS_CC); - - zend_execute(new_op_array TSRMLS_CC); - - zend_switch_namespace(active_namespace TSRMLS_CC); - - EX(function_state).function = saved_function; - EX(object) = saved_object; - - if (!return_value_used) { - if (EX_T(EX(opline)->result.u.var).var.ptr) { - zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr); - } - } else { /* return value is used */ - if (!EX_T(EX(opline)->result.u.var).var.ptr) { /* there was no return statement */ - ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); - INIT_PZVAL(EX_T(EX(opline)->result.u.var).var.ptr); - EX_T(EX(opline)->result.u.var).var.ptr->value.lval = 1; - EX_T(EX(opline)->result.u.var).var.ptr->type = IS_BOOL; - } - } - - EG(opline_ptr) = &EX(opline); - EG(active_op_array) = op_array; - EG(function_state_ptr) = &EX(function_state); - destroy_op_array(new_op_array TSRMLS_CC); - efree(new_op_array); - } else { - if (return_value_used) { - ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); - INIT_ZVAL(*EX_T(EX(opline)->result.u.var).var.ptr); - EX_T(EX(opline)->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(EX(opline)->result.u.var).var.ptr->type = IS_BOOL; - } - } - EG(return_value_ptr_ptr) = original_return_value; - NEXT_OPCODE(); -} - - -int zend_unset_var_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval tmp, *varname; - HashTable *target_symbol_table; - - varname = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - if (varname->type != IS_STRING) { - tmp = *varname; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - varname = &tmp; - } - - if (EX(opline)->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - zend_std_unset_static_property(EX_T(EX(opline)->op2.u.var).EA.class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); - } else { - target_symbol_table = zend_get_target_symbol_table(EX(opline), EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1); - } - - if (varname == &tmp) { - zval_dtor(&tmp); - } - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - NEXT_OPCODE(); -} - - -int zend_unset_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval **container = get_obj_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - zval *offset = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - - if (container) { - HashTable *ht; - - if ((*container)->type == IS_ARRAY) { - ht = (*container)->value.ht; - } else { - ht = NULL; - if ((*container)->type == IS_OBJECT) { - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); - } - } - if (ht) { - switch (offset->type) { - case IS_DOUBLE: - case IS_RESOURCE: - case IS_BOOL: - case IS_LONG: - { - long index; - - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.lval; - } else { - index = offset->value.lval; - } - - zend_hash_index_del(ht, index); - break; - } - case IS_STRING: - zend_hash_del(ht, offset->value.str.val, offset->value.str.len+1); - break; - case IS_NULL: - zend_hash_del(ht, "", sizeof("")); - break; - default: - zend_error(E_WARNING, "Illegal offset type in unset"); - break; - } - } - } else { - /* overloaded element */ - } - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - - NEXT_OPCODE(); -} - - -int zend_fe_reset_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *array_ptr, **array_ptr_ptr; - HashTable *fe_ht; - - if (EX(opline)->extended_value) { - array_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R); - if (array_ptr_ptr == NULL) { - MAKE_STD_ZVAL(array_ptr); - } else { - SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr); - array_ptr = *array_ptr_ptr; - array_ptr->refcount++; - } - } else { - array_ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - if (EG(free_op1)) { /* IS_TMP_VAR */ - zval *tmp; - - ALLOC_ZVAL(tmp); - *tmp = *array_ptr; - INIT_PZVAL(tmp); - array_ptr = tmp; - } else { - array_ptr->refcount++; - } - } - PZVAL_LOCK(array_ptr); - EX_T(EX(opline)->result.u.var).var.ptr = array_ptr; - EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr; - - if ((fe_ht = HASH_OF(array_ptr)) != NULL) { - /* probably redundant */ - zend_hash_internal_pointer_reset(fe_ht); - } else { - /* JMP to the end of foreach - TBD */ - } - NEXT_OPCODE(); -} - - -int zend_fe_fetch_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *array = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - zval *result = &EX_T(EX(opline)->result.u.var).tmp_var; - zval **value, *key; - char *str_key; - ulong int_key; - HashTable *fe_ht; - - PZVAL_LOCK(array); - - fe_ht = HASH_OF(array); - if (!fe_ht) { - zend_error(E_WARNING, "Invalid argument supplied for foreach()"); - EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num; - return 0; /* CHECK_ME */ - } else if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) { - EX(opline) = op_array->opcodes+EX(opline)->op2.u.opline_num; - return 0; /* CHECK_ME */ - } - array_init(result); - - - (*value)->refcount++; - zend_hash_index_update(result->value.ht, 0, value, sizeof(zval *), NULL); - - ALLOC_ZVAL(key); - INIT_PZVAL(key); - switch (zend_hash_get_current_key(fe_ht, &str_key, &int_key, 1)) { - case HASH_KEY_IS_STRING: - key->value.str.val = str_key; - key->value.str.len = strlen(str_key); - key->type = IS_STRING; - break; - case HASH_KEY_IS_LONG: - key->value.lval = int_key; - key->type = IS_LONG; - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - zend_hash_index_update(result->value.ht, 1, &key, sizeof(zval *), NULL); - zend_hash_move_forward(fe_ht); - - NEXT_OPCODE(); -} - - -int zend_jmp_no_ctor_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *object_zval; - zend_function *constructor; - - if (EX(opline)->op1.op_type == IS_VAR) { - PZVAL_LOCK(*EX_T(EX(opline)->op1.u.var).var.ptr_ptr); - } - - object_zval = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - constructor = Z_OBJ_HT_P(object_zval)->get_constructor(object_zval TSRMLS_CC); - - EX(fbc_constructor) = NULL; - if (constructor == NULL) { - EX(opline) = op_array->opcodes + EX(opline)->op2.u.opline_num; - return 0; /* CHECK_ME */ - } else { - EX(fbc_constructor) = constructor; - } - - NEXT_OPCODE(); -} - - -int zend_isset_isempty_var_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval tmp, *varname = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - zval **value; - zend_bool isset = 1; - HashTable *target_symbol_table; - - if (varname->type != IS_STRING) { - tmp = *varname; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - varname = &tmp; - } - - if (EX(opline)->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - value = zend_std_get_static_property(EX_T(EX(opline)->op2.u.var).EA.class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); - if (!value) { - isset = 0; - } - } else { - target_symbol_table = zend_get_target_symbol_table(EX(opline), EX(Ts), BP_VAR_IS, varname TSRMLS_CC); - if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { - isset = 0; - } - } - - EX_T(EX(opline)->result.u.var).tmp_var.type = IS_BOOL; - - switch (EX(opline)->extended_value) { - case ZEND_ISSET: - if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = 0; - } else { - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = isset; - } - break; - case ZEND_ISEMPTY: - if (!isset || !zend_is_true(*value)) { - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = 1; - } else { - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = 0; - } - break; - } - - if (varname == &tmp) { - zval_dtor(&tmp); - } - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - - NEXT_OPCODE(); -} - - -int zend_isset_isempty_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval **container = get_obj_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - zval *offset = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - zval **value = NULL; - int result = 0; - - if (container) { - if ((*container)->type == IS_ARRAY) { - HashTable *ht; - int isset = 0; - - ht = (*container)->value.ht; - - switch (offset->type) { - case IS_DOUBLE: - case IS_RESOURCE: - case IS_BOOL: - case IS_LONG: - { - long index; - - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.lval; - } else { - index = offset->value.lval; - } - if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { - isset = 1; - } - break; - } - case IS_STRING: - if (zend_hash_find(ht, offset->value.str.val, offset->value.str.len+1, (void **) &value) == SUCCESS) { - isset = 1; - } - break; - case IS_NULL: - if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) { - isset = 1; - } - break; - default: - zend_error(E_WARNING, "Illegal offset type in unset"); - - break; - } - - switch (EX(opline)->extended_value) { - case ZEND_ISSET: - if (isset && Z_TYPE_PP(value) == IS_NULL) { - result = 0; - } else { - result = isset; - } - break; - case ZEND_ISEMPTY: - if (!isset || !zend_is_true(*value)) { - result = 0; - } else { - result = 1; - } - break; - } - } else if ((*container)->type == IS_OBJECT) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (EX(opline)->extended_value == ZEND_ISEMPTY) TSRMLS_CC); - } else if ((*container)->type == IS_STRING) { /* string offsets */ - switch (EX(opline)->extended_value) { - case ZEND_ISSET: - if (offset->value.lval <= Z_STRLEN_PP(container)) { - result = 1; - } - break; - case ZEND_ISEMPTY: - if (offset->value.lval <= Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { - result = 1; - } - break; - } - } - } - - EX_T(EX(opline)->result.u.var).tmp_var.type = IS_BOOL; - - switch (EX(opline)->extended_value) { - case ZEND_ISSET: - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = result; - break; - case ZEND_ISEMPTY: - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = !result; - break; - } - - FREE_OP(EX(Ts), &EX(opline)->op2, EG(free_op2)); - - NEXT_OPCODE(); -} - - -int zend_exit_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (EX(opline)->op1.op_type != IS_UNUSED) { - zval *ptr; - - ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - if (Z_TYPE_P(ptr) == IS_LONG) { - EG(exit_status) = Z_LVAL_P(ptr); - } else { - zend_print_variable(ptr); - } - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - } - zend_bailout(); - NEXT_OPCODE(); -} - - -int zend_begin_silence_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - EX_T(EX(opline)->result.u.var).tmp_var.value.lval = EG(error_reporting); - EX_T(EX(opline)->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */ - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - NEXT_OPCODE(); -} - - -int zend_raise_abstract_error_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_error(E_ERROR, "Cannot call abstract method %s::%s()", EG(scope)->name, op_array->function_name); - NEXT_OPCODE(); /* Never reached */ -} - - -int zend_end_silence_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval restored_error_reporting; - - restored_error_reporting.type = IS_LONG; - restored_error_reporting.value.lval = EX_T(EX(opline)->op1.u.var).tmp_var.value.lval; - convert_to_string(&restored_error_reporting); - zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - zendi_zval_dtor(restored_error_reporting); - NEXT_OPCODE(); -} - - -int zend_qm_assign_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - - EX_T(EX(opline)->result.u.var).tmp_var = *value; - if (!EG(free_op1)) { - zval_copy_ctor(&EX_T(EX(opline)->result.u.var).tmp_var); - } - NEXT_OPCODE(); -} - - -int zend_ext_stmt_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, op_array TSRMLS_CC); - } - NEXT_OPCODE(); -} - - -int zend_ext_fcall_begin_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, op_array TSRMLS_CC); - } - NEXT_OPCODE(); -} - - -int zend_ext_fcall_end_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, op_array TSRMLS_CC); - } - NEXT_OPCODE(); -} - - -int zend_declare_class_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - EX_T(EX(opline)->result.u.var).EA.class_entry = do_bind_class(EX(opline), EG(function_table), EG(class_table) TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_declare_inherited_class_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - EX_T(EX(opline)->result.u.var).EA.class_entry = do_bind_inherited_class(EX(opline), EG(function_table), EG(class_table), EX_T(EX(opline)->extended_value).EA.class_entry TSRMLS_CC); - NEXT_OPCODE(); -} - - -int zend_declare_function_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - do_bind_function(EX(opline), EG(function_table), EG(class_table), 0); - NEXT_OPCODE(); -} - - -int zend_ticks_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - if (++EG(ticks_count)>=EX(opline)->op1.u.constant.value.lval) { - EG(ticks_count)=0; - if (zend_ticks_function) { - zend_ticks_function(EX(opline)->op1.u.constant.value.lval); - } - } - NEXT_OPCODE(); -} - - -int zend_instanceof_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *expr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - zend_bool result; - - if (Z_TYPE_P(expr) == IS_OBJECT) { - result = instanceof_function(Z_OBJCE_P(expr), EX_T(EX(opline)->op2.u.var).EA.class_entry TSRMLS_CC); - } else { - result = 0; - } - ZVAL_BOOL(&EX_T(EX(opline)->result.u.var).tmp_var, result); - FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); - NEXT_OPCODE(); -} - - -int zend_ext_nop_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - NEXT_OPCODE(); -} - - -int zend_nop_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - NEXT_OPCODE(); -} - -int zend_start_namespace_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *namespace_name; - zend_namespace **pns; - - if(EX(opline)->op1.op_type != IS_UNUSED) { - namespace_name= get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); - if (Z_TYPE_P(namespace_name) != IS_STRING) { - zend_error(E_ERROR, "Internal error: Invalid type in namespace definition - %d", Z_TYPE_P(namespace_name)); - } - - if(zend_hash_find(&EG(global_namespace_ptr)->class_table, Z_STRVAL_P(namespace_name), Z_STRLEN_P(namespace_name)+1, (void **)&pns) != SUCCESS || (*pns)->type != ZEND_USER_NAMESPACE) { - zend_error(E_ERROR, "Internal error: Cannot locate namespace '%s'", Z_STRVAL_P(namespace_name)); - } - } else { - pns = &EG(global_namespace_ptr); - } - - if(EG(active_namespace) != *pns) { - zend_switch_namespace(*pns TSRMLS_CC); - } - NEXT_OPCODE(); -} - - -int zend_add_interface_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - zend_class_entry *iface = EX_T(EX(opline)->op2.u.var).EA.class_entry; - - if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) { - zend_error(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name); - } - - ce->interfaces[EX(opline)->extended_value] = iface; - - zend_do_implement_interface(ce, iface); - - NEXT_OPCODE(); -} - - -int zend_verify_instanceof_handler(ZEND_OPCODE_HANDLER_ARGS) -{ - zval *arg = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); - zend_class_entry *ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - - if ((Z_TYPE_P(arg) != IS_OBJECT) - || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) { - char *error_msg; - - if (ce->ce_flags & ZEND_ACC_INTERFACE) { - error_msg = "implement interface"; - } else { - error_msg = "be an instance of"; - } - zend_error(E_ERROR, "Argument %d must %s %s", EX(opline)->extended_value, error_msg, ce->name); - } - - NEXT_OPCODE(); -} - - -#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; - -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; -} - -int zend_verify_abstract_class(ZEND_OPCODE_HANDLER_ARGS) -{ - zend_class_entry *ce = EX_T(EX(opline)->op1.u.var).EA.class_entry; - zend_abstract_info ai; - - if ((ce->ce_flags & ZEND_ACC_ABSTRACT) && !(ce->ce_flags & ZEND_ACC_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); - - 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) - ); - } - - NEXT_OPCODE(); -} - - -void zend_init_opcodes_handlers() -{ - zend_opcode_handlers[ZEND_NOP] = zend_nop_handler; - zend_opcode_handlers[ZEND_ADD] = zend_add_handler; - zend_opcode_handlers[ZEND_SUB] = zend_sub_handler; - zend_opcode_handlers[ZEND_MUL] = zend_mul_handler; - zend_opcode_handlers[ZEND_DIV] = zend_div_handler; - zend_opcode_handlers[ZEND_MOD] = zend_mod_handler; - zend_opcode_handlers[ZEND_SL] = zend_sl_handler; - zend_opcode_handlers[ZEND_SR] = zend_sr_handler; - zend_opcode_handlers[ZEND_CONCAT] = zend_concat_handler; - zend_opcode_handlers[ZEND_BW_OR] = zend_bw_or_handler; - zend_opcode_handlers[ZEND_BW_AND] = zend_bw_and_handler; - zend_opcode_handlers[ZEND_BW_XOR] = zend_bw_xor_handler; - zend_opcode_handlers[ZEND_BW_NOT] = zend_bw_not_handler; - zend_opcode_handlers[ZEND_BOOL_NOT] = zend_bool_not_handler; - zend_opcode_handlers[ZEND_BOOL_XOR] = zend_bool_xor_handler; - zend_opcode_handlers[ZEND_IS_IDENTICAL] = zend_is_identical_handler; - zend_opcode_handlers[ZEND_IS_NOT_IDENTICAL] = zend_is_not_identical_handler; - zend_opcode_handlers[ZEND_IS_EQUAL] = zend_is_equal_handler; - zend_opcode_handlers[ZEND_IS_NOT_EQUAL] = zend_is_not_equal_handler; - zend_opcode_handlers[ZEND_IS_SMALLER] = zend_is_smaller_handler; - zend_opcode_handlers[ZEND_IS_SMALLER_OR_EQUAL] = zend_is_smaller_or_equal_handler; - zend_opcode_handlers[ZEND_CAST] = zend_cast_handler; - zend_opcode_handlers[ZEND_QM_ASSIGN] = zend_qm_assign_handler; - - zend_opcode_handlers[ZEND_ASSIGN_ADD] = zend_assign_add_handler; - zend_opcode_handlers[ZEND_ASSIGN_SUB] = zend_assign_sub_handler; - zend_opcode_handlers[ZEND_ASSIGN_MUL] = zend_assign_mul_handler; - zend_opcode_handlers[ZEND_ASSIGN_DIV] = zend_assign_div_handler; - zend_opcode_handlers[ZEND_ASSIGN_MOD] = zend_assign_mod_handler; - zend_opcode_handlers[ZEND_ASSIGN_SL] = zend_assign_sl_handler; - zend_opcode_handlers[ZEND_ASSIGN_SR] = zend_assign_sr_handler; - zend_opcode_handlers[ZEND_ASSIGN_CONCAT] = zend_assign_concat_handler; - zend_opcode_handlers[ZEND_ASSIGN_BW_OR] = zend_assign_bw_or_handler; - zend_opcode_handlers[ZEND_ASSIGN_BW_AND] = zend_assign_bw_and_handler; - zend_opcode_handlers[ZEND_ASSIGN_BW_XOR] = zend_assign_bw_xor_handler; - - zend_opcode_handlers[ZEND_PRE_INC] = zend_pre_inc_handler; - zend_opcode_handlers[ZEND_PRE_DEC] = zend_pre_dec_handler; - zend_opcode_handlers[ZEND_POST_INC] = zend_post_inc_handler; - zend_opcode_handlers[ZEND_POST_DEC] = zend_post_dec_handler; - - zend_opcode_handlers[ZEND_ASSIGN] = zend_assign_handler; - zend_opcode_handlers[ZEND_ASSIGN_REF] = zend_assign_ref_handler; - - zend_opcode_handlers[ZEND_ECHO] = zend_echo_handler; - zend_opcode_handlers[ZEND_PRINT] = zend_print_handler; - - zend_opcode_handlers[ZEND_JMP] = zend_jmp_handler; - zend_opcode_handlers[ZEND_JMPZ] = zend_jmpz_handler; - zend_opcode_handlers[ZEND_JMPNZ] = zend_jmpnz_handler; - zend_opcode_handlers[ZEND_JMPZNZ] = zend_jmpznz_handler; - zend_opcode_handlers[ZEND_JMPZ_EX] = zend_jmpz_ex_handler; - zend_opcode_handlers[ZEND_JMPNZ_EX] = zend_jmpnz_ex_handler; - zend_opcode_handlers[ZEND_CASE] = zend_case_handler; - zend_opcode_handlers[ZEND_SWITCH_FREE] = zend_switch_free_handler; - zend_opcode_handlers[ZEND_BRK] = zend_brk_handler; - zend_opcode_handlers[ZEND_CONT] = zend_cont_handler; - zend_opcode_handlers[ZEND_BOOL] = zend_bool_handler; - - zend_opcode_handlers[ZEND_INIT_STRING] = zend_init_string_handler; - zend_opcode_handlers[ZEND_ADD_CHAR] = zend_add_char_handler; - zend_opcode_handlers[ZEND_ADD_STRING] = zend_add_string_handler; - zend_opcode_handlers[ZEND_ADD_VAR] = zend_add_var_handler; - - zend_opcode_handlers[ZEND_BEGIN_SILENCE] = zend_begin_silence_handler; - zend_opcode_handlers[ZEND_END_SILENCE] = zend_end_silence_handler; - - zend_opcode_handlers[ZEND_INIT_FCALL_BY_NAME] = zend_init_fcall_by_name_handler; - zend_opcode_handlers[ZEND_DO_FCALL] = zend_do_fcall_handler; - zend_opcode_handlers[ZEND_DO_FCALL_BY_NAME] = zend_do_fcall_by_name_handler; - zend_opcode_handlers[ZEND_RETURN] = zend_return_handler; - - zend_opcode_handlers[ZEND_RECV] = zend_recv_handler; - zend_opcode_handlers[ZEND_RECV_INIT] = zend_recv_init_handler; - - zend_opcode_handlers[ZEND_SEND_VAL] = zend_send_val_handler; - zend_opcode_handlers[ZEND_SEND_VAR] = zend_send_var_handler; - zend_opcode_handlers[ZEND_SEND_REF] = zend_send_ref_handler; - - zend_opcode_handlers[ZEND_NEW] = zend_new_handler; - zend_opcode_handlers[ZEND_JMP_NO_CTOR] = zend_jmp_no_ctor_handler; - zend_opcode_handlers[ZEND_FREE] = zend_free_handler; - - zend_opcode_handlers[ZEND_INIT_ARRAY] = zend_init_array_handler; - zend_opcode_handlers[ZEND_ADD_ARRAY_ELEMENT] = zend_add_array_element_handler; - - zend_opcode_handlers[ZEND_INCLUDE_OR_EVAL] = zend_include_or_eval_handler; - - zend_opcode_handlers[ZEND_UNSET_VAR] = zend_unset_var_handler; - zend_opcode_handlers[ZEND_UNSET_DIM_OBJ] = zend_unset_dim_obj_handler; - - zend_opcode_handlers[ZEND_FE_RESET] = zend_fe_reset_handler; - zend_opcode_handlers[ZEND_FE_FETCH] = zend_fe_fetch_handler; - - zend_opcode_handlers[ZEND_EXIT] = zend_exit_handler; - - zend_opcode_handlers[ZEND_FETCH_R] = zend_fetch_r_handler; - zend_opcode_handlers[ZEND_FETCH_DIM_R] = zend_fetch_dim_r_handler; - zend_opcode_handlers[ZEND_FETCH_OBJ_R] = zend_fetch_obj_r_handler; - zend_opcode_handlers[ZEND_FETCH_W] = zend_fetch_w_handler; - zend_opcode_handlers[ZEND_FETCH_DIM_W] = zend_fetch_dim_w_handler; - zend_opcode_handlers[ZEND_FETCH_OBJ_W] = zend_fetch_obj_w_handler; - zend_opcode_handlers[ZEND_FETCH_RW] = zend_fetch_rw_handler; - zend_opcode_handlers[ZEND_FETCH_DIM_RW] = zend_fetch_dim_rw_handler; - zend_opcode_handlers[ZEND_FETCH_OBJ_RW] = zend_fetch_obj_rw_handler; - zend_opcode_handlers[ZEND_FETCH_IS] = zend_fetch_is_handler; - zend_opcode_handlers[ZEND_FETCH_DIM_IS] = zend_fetch_dim_is_handler; - zend_opcode_handlers[ZEND_FETCH_OBJ_IS] = zend_fetch_obj_is_handler; - zend_opcode_handlers[ZEND_FETCH_FUNC_ARG] = zend_fetch_func_arg_handler; - zend_opcode_handlers[ZEND_FETCH_DIM_FUNC_ARG] = zend_fetch_dim_func_arg_handler; - zend_opcode_handlers[ZEND_FETCH_OBJ_FUNC_ARG] = zend_fetch_obj_func_arg_handler; - zend_opcode_handlers[ZEND_FETCH_UNSET] = zend_fetch_unset_handler; - zend_opcode_handlers[ZEND_FETCH_DIM_UNSET] = zend_fetch_dim_unset_handler; - zend_opcode_handlers[ZEND_FETCH_OBJ_UNSET] = zend_fetch_obj_unset_handler; - - zend_opcode_handlers[ZEND_FETCH_DIM_TMP_VAR] = zend_fetch_dim_tmp_var_handler; - zend_opcode_handlers[ZEND_FETCH_CONSTANT] = zend_fetch_constant_handler; - - zend_opcode_handlers[ZEND_EXT_STMT] = zend_ext_stmt_handler; - zend_opcode_handlers[ZEND_EXT_FCALL_BEGIN] = zend_ext_fcall_begin_handler; - zend_opcode_handlers[ZEND_EXT_FCALL_END] = zend_ext_fcall_end_handler; - zend_opcode_handlers[ZEND_EXT_NOP] = zend_ext_nop_handler; - - zend_opcode_handlers[ZEND_TICKS] = zend_ticks_handler; - - zend_opcode_handlers[ZEND_SEND_VAR_NO_REF] = zend_send_var_no_ref_handler; - - zend_opcode_handlers[ZEND_CATCH] = zend_catch_handler; - zend_opcode_handlers[ZEND_THROW] = zend_throw_handler; - - zend_opcode_handlers[ZEND_FETCH_CLASS] = zend_fetch_class_handler; - - zend_opcode_handlers[ZEND_CLONE] = zend_clone_handler; - - zend_opcode_handlers[ZEND_INIT_CTOR_CALL] = zend_init_ctor_call_handler; - zend_opcode_handlers[ZEND_INIT_METHOD_CALL] = zend_init_method_call_handler; - zend_opcode_handlers[ZEND_INIT_STATIC_METHOD_CALL] = zend_init_static_method_call_handler; - - zend_opcode_handlers[ZEND_ISSET_ISEMPTY_VAR] = zend_isset_isempty_var_handler; - zend_opcode_handlers[ZEND_ISSET_ISEMPTY_DIM_OBJ] = zend_isset_isempty_dim_obj_handler; - - zend_opcode_handlers[ZEND_IMPORT_FUNCTION] = zend_import_function_handler; - zend_opcode_handlers[ZEND_IMPORT_CLASS] = zend_import_class_handler; - zend_opcode_handlers[ZEND_IMPORT_CONST] = zend_import_const_handler; - - zend_opcode_handlers[ZEND_ASSIGN_ADD_OBJ] = zend_assign_add_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_SUB_OBJ] = zend_assign_sub_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_MUL_OBJ] = zend_assign_mul_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_DIV_OBJ] = zend_assign_div_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_MOD_OBJ] = zend_assign_mod_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_SL_OBJ] = zend_assign_sl_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_SR_OBJ] = zend_assign_sr_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_CONCAT_OBJ] = zend_assign_concat_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_BW_OR_OBJ] = zend_assign_bw_or_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_BW_AND_OBJ] = zend_assign_bw_and_obj_handler; - zend_opcode_handlers[ZEND_ASSIGN_BW_XOR_OBJ] = zend_assign_bw_xor_obj_handler; - - zend_opcode_handlers[ZEND_PRE_INC_OBJ] = zend_pre_inc_obj_handler; - zend_opcode_handlers[ZEND_PRE_DEC_OBJ] = zend_pre_dec_obj_handler; - zend_opcode_handlers[ZEND_POST_INC_OBJ] = zend_post_inc_obj_handler; - zend_opcode_handlers[ZEND_POST_DEC_OBJ] = zend_post_dec_obj_handler; - - zend_opcode_handlers[ZEND_ASSIGN_OBJ] = zend_assign_obj_handler; - zend_opcode_handlers[ZEND_OP_DATA] = NULL; - - zend_opcode_handlers[ZEND_INSTANCEOF] = zend_instanceof_handler; - - zend_opcode_handlers[ZEND_DECLARE_CLASS] = zend_declare_class_handler; - zend_opcode_handlers[ZEND_DECLARE_INHERITED_CLASS] = zend_declare_inherited_class_handler; - zend_opcode_handlers[ZEND_DECLARE_FUNCTION] = zend_declare_function_handler; - - zend_opcode_handlers[ZEND_RAISE_ABSTRACT_ERROR] = zend_raise_abstract_error_handler; - zend_opcode_handlers[ZEND_START_NAMESPACE] = zend_start_namespace_handler; - - zend_opcode_handlers[ZEND_ADD_INTERFACE] = zend_add_interface_handler; - zend_opcode_handlers[ZEND_VERIFY_INSTANCEOF] = zend_verify_instanceof_handler; - zend_opcode_handlers[ZEND_VERIFY_ABSTRACT_CLASS] = zend_verify_abstract_class; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h deleted file mode 100644 index 5420e30a0c..0000000000 --- a/Zend/zend_execute.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_EXECUTE_H -#define ZEND_EXECUTE_H - -#include "zend_compile.h" -#include "zend_hash.h" -#include "zend_variables.h" -#include "zend_operators.h" - -typedef union _temp_variable { - zval tmp_var; - struct { - zval **ptr_ptr; - zval *ptr; - } var; - struct { - 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; - - -BEGIN_EXTERN_C() -ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC); -ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC); - -void init_executor(TSRMLS_D); -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); -static inline void safe_free_zval_ptr(zval *p) -{ - TSRMLS_FETCH(); - - if (p!=EG(uninitialized_zval_ptr)) { - FREE_ZVAL(p); - } -} -ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC); -ZEND_API int zend_lookup_ns_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); -void zend_switch_namespace(zend_namespace *ns TSRMLS_DC); - -static inline int i_zend_is_true(zval *op) -{ - int result; - - switch (op->type) { - case IS_NULL: - result = 0; - break; - case IS_LONG: - case IS_BOOL: - case IS_RESOURCE: - result = (op->value.lval?1:0); - break; - case IS_DOUBLE: - result = (op->value.dval ? 1 : 0); - break; - case IS_STRING: - if (op->value.str.len == 0 - || (op->value.str.len==1 && op->value.str.val[0]=='0')) { - result = 0; - } else { - result = 1; - } - break; - case IS_ARRAY: - result = (zend_hash_num_elements(op->value.ht)?1:0); - break; - case IS_OBJECT: - /* OBJ-TBI */ - result = 1; - break; - default: - result = 0; - break; - } - return result; -} - -ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC); - -/* dedicated Zend executor functions - do not use! */ -static inline void zend_ptr_stack_clear_multiple(TSRMLS_D) -{ - void **p = EG(argument_stack).top_element-2; - int delete_count = (ulong) *p; - - EG(argument_stack).top -= (delete_count+2); - while (--delete_count>=0) { - zval_ptr_dtor((zval **) --p); - } - EG(argument_stack).top_element = p; -} - -static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC) -{ - void **p = EG(argument_stack).top_element-2; - int arg_count = (ulong) *p; - - if (requested_arg>arg_count) { - return FAILURE; - } - *data = (p-arg_count+requested_arg-1); - return SUCCESS; -} - -void execute_new_code(TSRMLS_D); - - -/* services */ -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); -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); - -#ifdef ZEND_WIN32 -void zend_init_timeout_thread(); -void zend_shutdown_timeout_thread(); -#define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1) -#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2) -#endif - -#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p)) -#define zendi_zval_dtor(p) zval_dtor(&(p)) - -#define active_opline (*EG(opline_ptr)) - -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. - */ -#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && (zval)->type == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : "") - -END_EXTERN_C() - -#endif /* ZEND_EXECUTE_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c deleted file mode 100644 index a5082282ff..0000000000 --- a/Zend/zend_execute_API.c +++ /dev/null @@ -1,1094 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include -#include - -#include "zend.h" -#include "zend_compile.h" -#include "zend_execute.h" -#include "zend_API.h" -#include "zend_ptr_stack.h" -#include "zend_constants.h" -#include "zend_extensions.h" -#ifdef HAVE_SYS_TIME_H -#include -#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); - -#ifdef ZEND_WIN32 -#include -/* true global */ -static WNDCLASS wc; -static HWND timeout_window; -static HANDLE timeout_thread_event; -static DWORD timeout_thread_id; -static int timeout_thread_initialized=0; -#endif - - -#if ZEND_DEBUG -static void (*original_sigsegv_handler)(int); -static void zend_handle_sigsegv(int dummy) -{ - fflush(stdout); - fflush(stderr); - if (original_sigsegv_handler==zend_handle_sigsegv) { - signal(SIGSEGV, original_sigsegv_handler); - } else { - signal(SIGSEGV, SIG_DFL); - } - { - TSRMLS_FETCH(); - - fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n", - active_opline->opcode, - active_opline-EG(active_op_array)->opcodes, - get_active_function_name(TSRMLS_C), - zend_get_executed_filename(TSRMLS_C), - zend_get_executed_lineno(TSRMLS_C)); - } - if (original_sigsegv_handler!=zend_handle_sigsegv) { - original_sigsegv_handler(dummy); - } -} -#endif - - -static void zend_extension_activator(zend_extension *extension TSRMLS_DC) -{ - if (extension->activate) { - extension->activate(); - } -} - - -static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) -{ - if (extension->deactivate) { - extension->deactivate(); - } -} - - -static int is_not_internal_function(zend_function *function TSRMLS_DC) -{ - if (function->type == ZEND_INTERNAL_FUNCTION) { - return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP; - } else { - return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE; - } -} - - -static int is_not_internal_class(zend_class_entry **ce TSRMLS_DC) -{ - if ((*ce)->type == ZEND_INTERNAL_CLASS) { - return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP; - } else { - return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE; - } -} - - -void init_executor(TSRMLS_D) -{ - INIT_ZVAL(EG(uninitialized_zval)); -/* 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); - EG(error_zval_ptr)=&EG(error_zval); - zend_ptr_stack_init(&EG(arg_types_stack)); -/* destroys stack frame, therefore makes core dumps worthless */ -#if 0&&ZEND_DEBUG - original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv); -#endif - EG(return_value_ptr_ptr) = NULL; - - 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; - - zend_ptr_stack_init(&EG(argument_stack)); - - zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0); - { - zval *globals; - - ALLOC_ZVAL(globals); - globals->refcount=1; - globals->is_ref=1; - globals->type = IS_ARRAY; - globals->value.ht = &EG(symbol_table); - 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; - - zend_hash_init(&EG(included_files), 5, NULL, NULL, 0); - - EG(ticks_count) = 0; - - EG(user_error_handler) = NULL; - - EG(current_execute_data) = NULL; - - zend_ptr_stack_init(&EG(user_error_handlers)); - zend_ptr_stack_init(&EG(user_exception_handlers)); - - zend_objects_store_init(&EG(objects_store), 1024); - - EG(full_tables_cleanup) = 0; -#ifdef ZEND_WIN32 - EG(timed_out) = 0; -#endif - - EG(exception) = NULL; - - EG(scope) = NULL; - EG(active_namespace) = &CG(global_namespace); - - EG(global_namespace_ptr) = &CG(global_namespace); - CG(global_namespace).static_members = &EG(symbol_table); - - EG(current_execute_data) = NULL; - - EG(This) = NULL; - - EG(float_separator)[0] = '.'; -} - - -void shutdown_executor(TSRMLS_D) -{ - /* return to global namespace here */ - if(EG(active_namespace) != EG(global_namespace_ptr)) { - zend_switch_namespace(EG(global_namespace_ptr) TSRMLS_CC); - } - - 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. - Now when 1 and 2 are destroyed, 3 can still access 2 in its destructor, with - very problematic results */ -/* zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC); */ - -/* Moved after symbol table cleaners, because some of the cleaners can call - destructors, which would use EG(symtable_cache_ptr) and thus leave leaks */ -/* while (EG(symtable_cache_ptr)>=EG(symtable_cache)) { - zend_hash_destroy(*EG(symtable_cache_ptr)); - efree(*EG(symtable_cache_ptr)); - EG(symtable_cache_ptr)--; - } -*/ - zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC); - - zend_hash_destroy(&EG(symbol_table)); - - /* Cleanup static data for functions and arrays. - 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 */ - zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data TSRMLS_CC); - zend_hash_apply(EG(class_table), (apply_func_t) zend_cleanup_class_data TSRMLS_CC); - - while (EG(garbage_ptr)) { - if (EG(garbage)[--EG(garbage_ptr)]->refcount==1) { - zval_ptr_dtor(&EG(garbage)[EG(garbage_ptr)]); - } - } - - zend_ptr_stack_destroy(&EG(argument_stack)); - - /* Destroy all op arrays */ - if (EG(full_tables_cleanup)) { - zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC); - zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC); - } else { - zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC); - zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC); - } - - while (EG(symtable_cache_ptr)>=EG(symtable_cache)) { - zend_hash_destroy(*EG(symtable_cache_ptr)); - efree(*EG(symtable_cache_ptr)); - EG(symtable_cache_ptr)--; - } - } zend_end_try(); - - zend_try { - clean_non_persistent_constants(TSRMLS_C); - } zend_end_try(); - - /* The regular list must be destroyed after the main symbol table, - * op arrays, and constants are destroyed. - */ - zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC); - - zend_try { -#if ZEND_DEBUG - signal(SIGSEGV, original_sigsegv_handler); -#endif - - zend_hash_destroy(&EG(included_files)); - - 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)); - } zend_end_try(); -} - - -ZEND_API char *get_active_function_name(TSRMLS_D) -{ - if (!zend_is_executing(TSRMLS_C)) { - return NULL; - } - 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 { - return "main"; - } - } - break; - case ZEND_INTERNAL_FUNCTION: - return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name; - break; - default: - return NULL; - } -} - - -ZEND_API char *zend_get_executed_filename(TSRMLS_D) -{ - if (EG(active_op_array)) { - return EG(active_op_array)->filename; - } else { - return "[no active file]"; - } -} - - -ZEND_API uint zend_get_executed_lineno(TSRMLS_D) -{ - if (EG(opline_ptr)) { - return active_opline->lineno; - } else { - return 0; - } -} - - -ZEND_API zend_bool zend_is_executing(TSRMLS_D) -{ - return EG(in_execution); -} - - -ZEND_API void _zval_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_dtor(*zval_ptr); - safe_free_zval_ptr(*zval_ptr); - } else if ((*zval_ptr)->refcount == 1) { - (*zval_ptr)->is_ref = 0; - } -} - - -ZEND_API int zend_is_true(zval *op) -{ - return i_zend_is_true(op); -} - -#include "../TSRM/tsrm_strtok_r.h" - -ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) -{ - zval *p = *pp; - zend_bool inline_change = (zend_bool) (unsigned long) arg; - zval const_value; - - if (p->type == IS_CONSTANT) { - int refcount; - - SEPARATE_ZVAL(pp); - p = *pp; - - refcount = p->refcount; - - if (strchr(p->value.str.val, ':')) { - char *cur, *temp; - char *last; - zend_class_entry **ce; - zval **value; - - last = tsrm_strtok_r(p->value.str.val, ":", &temp); - - if (strcasecmp(last, "self")==0) { - if (EG(scope)) { - last = EG(scope)->name; - } else { - zend_error(E_ERROR, "Cannot access self:: when no class scope is active"); - } - } else if (strcasecmp(last, "parent")==0) { - if (!EG(scope)) { - zend_error(E_ERROR, "Cannot access parent:: when no class scope is active"); - } else if (!EG(scope)->parent) { - zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent"); - } else { - last = EG(scope)->parent->name; - } - } - - - if (zend_lookup_class(last, strlen(last), &ce TSRMLS_CC) == FAILURE) { - zend_error(E_ERROR, "Undefined class '%s'", last); - } - - last = tsrm_strtok_r(NULL, ":", &temp); - - for(;;) { - cur = tsrm_strtok_r(NULL, ":", &temp); - if (!cur) { - break; - } - if (zend_hash_find(&(*ce)->class_table, last, strlen(last)+1, (void **)&ce) == FAILURE) { - zend_error(E_ERROR, "Undefined sub-class '%s'", last); - } - last = cur; - } - if (zend_hash_find(&(*ce)->constants_table, last, strlen(last)+1, (void **) &value) == FAILURE) { - zend_error(E_ERROR, "Undefined class constant '%s'", last); - } - const_value = **value; - zval_copy_ctor(&const_value); - if (inline_change) { - STR_FREE(p->value.str.val); - } - *p = const_value; - } else { - if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - p->value.str.val, - p->value.str.val); - p->type = IS_STRING; - if (!inline_change) { - zval_copy_ctor(p); - } - } else { - if (inline_change) { - STR_FREE(p->value.str.val); - } - *p = const_value; - } - } - INIT_PZVAL(p); - p->refcount = refcount; - } else if (p->type == IS_CONSTANT_ARRAY) { - zval **element; - char *str_index; - uint str_index_len; - ulong num_index; - - 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) { - if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) { - zend_hash_move_forward(p->value.ht); - continue; - } - Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX; - if (zend_hash_get_current_key_ex(p->value.ht, &str_index, &str_index_len, &num_index, 0, NULL)!=HASH_KEY_IS_STRING) { - zend_hash_move_forward(p->value.ht); - continue; - } - if (!zend_get_constant(str_index, str_index_len-1, &const_value TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index); - 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 */ - zval_dtor(&const_value); - zend_hash_move_forward(p->value.ht); - continue; - } - - switch (const_value.type) { - case IS_STRING: - zend_hash_update(p->value.ht, const_value.value.str.val, const_value.value.str.len+1, element, sizeof(zval *), NULL); - (*element)->refcount++; - break; - case IS_LONG: - zend_hash_index_update(p->value.ht, const_value.value.lval, element, sizeof(zval *), NULL); - (*element)->refcount++; - break; - } - zend_hash_del(p->value.ht, str_index, str_index_len); - zval_dtor(&const_value); - } - zend_hash_apply_with_argument(p->value.ht, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); - } - return 0; -} - - -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); - int i; - int ex_retval; - zval *local_retval_ptr; - - for (i=0; itype==IS_ARRAY) { /* assume array($obj, $name) couple */ - zval **tmp_object_ptr, **tmp_real_function_name; - - if (zend_hash_index_find(function_name->value.ht, 0, (void **) &tmp_object_ptr)==FAILURE) { - return FAILURE; - } - if (zend_hash_index_find(function_name->value.ht, 1, (void **) &tmp_real_function_name)==FAILURE) { - return FAILURE; - } - function_name = *tmp_real_function_name; - SEPARATE_ZVAL_IF_NOT_REF(tmp_object_ptr); - object_pp = tmp_object_ptr; - (*object_pp)->is_ref = 1; - } - - if (object_pp && !*object_pp) { - object_pp = NULL; - } - - if (object_pp) { - /* TBI!! new object handlers */ - 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(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; - - lc_class = estrndup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp)); - zend_str_tolower(lc_class, Z_STRLEN_PP(object_pp)); - found = zend_lookup_class(lc_class, Z_STRLEN_PP(object_pp), &ce TSRMLS_CC); - efree(lc_class); - if (found == FAILURE) - return FAILURE; - - function_table = &(*ce)->function_table; - calling_scope = *ce; - object_pp = NULL; - } else - return FAILURE; - } - - if (function_name->type!=IS_STRING) { - return FAILURE; - } - - function_name_copy = *function_name; - zval_copy_ctor(&function_name_copy); - zend_str_tolower(function_name_copy.value.str.val, function_name_copy.value.str.len); - - original_function_state_ptr = EG(function_state_ptr); - if (zend_hash_find(function_table, function_name_copy.value.str.val, function_name_copy.value.str.len+1, (void **) &EX(function_state).function)==FAILURE) { - zval_dtor(&function_name_copy); - return FAILURE; - } - zval_dtor(&function_name_copy); - - for (i=0; icommon.arg_types - && icommon.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 (no_separation) { - return FAILURE; - } - ALLOC_ZVAL(new_zval); - *new_zval = **params[i]; - zval_copy_ctor(new_zval); - new_zval->refcount = 1; - (*params[i])->refcount--; - *params[i] = new_zval; - } - (*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 = **(params[i]); - INIT_PZVAL(param); - } - zend_ptr_stack_push(&EG(argument_stack), param); - } - - zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) param_count, NULL); - - EG(function_state_ptr) = &EX(function_state); - - current_scope = EG(scope); - EG(scope) = calling_scope; - - current_this = EG(This); - - if (object_pp) { - EG(This) = *object_pp; - - 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; - } - } else { - EG(This) = NULL; - } - - EX(prev_execute_data) = EG(current_execute_data); - EG(current_execute_data) = &execute_data; - - if (EX(function_state).function->type == ZEND_USER_FUNCTION) { - calling_symbol_table = EG(active_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); - } - - original_return_value = EG(return_value_ptr_ptr); - original_op_array = EG(active_op_array); - 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); - orig_free_op2 = EG(free_op2); - orig_unary_op = EG(unary_op); - orig_binary_op = EG(binary_op); - zend_execute(EG(active_op_array) TSRMLS_CC); - if (!symbol_table) { - zend_hash_destroy(EG(active_symbol_table)); - FREE_HASHTABLE(EG(active_symbol_table)); - } - EG(active_symbol_table) = calling_symbol_table; - EG(active_op_array) = original_op_array; - EG(return_value_ptr_ptr)=original_return_value; - EG(opline_ptr) = original_opline_ptr; - EG(free_op1) = orig_free_op1; - EG(free_op2) = orig_free_op2; - EG(unary_op) = orig_unary_op; - EG(binary_op) = orig_binary_op; - } else { - 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); - EG(function_state_ptr) = original_function_state_ptr; - EG(active_namespace) = current_namespace; - - if (EG(This)) { - zval_ptr_dtor(&EG(This)); - } - EG(scope) = current_scope; - EG(This) = current_this; - EG(current_execute_data) = EX(prev_execute_data); \ - - 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; - zval *retval_ptr; - int retval; - - if (zend_hash_find(EG(class_table), name, name_length+1, (void **) ce) == SUCCESS) { - return SUCCESS; - } - - MAKE_STD_ZVAL(autoload_function); - ZVAL_STRINGL(autoload_function, "__autoload", sizeof("__autoload")-1, 1); - - 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 (retval == FAILURE) { - return FAILURE; - } - - if (EG(exception)) { - zend_error(E_ERROR, "__autoload threw an exception"); - } - - /* If an exception is thrown retval_ptr will be NULL but we bailout before we reach this point */ - zval_ptr_dtor(&retval_ptr); - - return zend_hash_find(EG(class_table), name, name_length + 1, (void **) ce); -} - -ZEND_API int zend_lookup_ns_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) -{ - char *ns_name; - char *class_name; - char *name_end = name + name_length; - int ns_name_length; - zend_namespace **ns; - - /* handle simple class name case */ - if ((class_name = zend_memnstr(name, "::", sizeof("::")-1, name_end)) == NULL) { - return zend_lookup_class(name, name_length, ce TSRMLS_CC); - } - /* handle ::C case */ - if (class_name == name) { - return zend_lookup_class(name + sizeof("::")-1, name_length - sizeof("::")+1, ce TSRMLS_CC); - } - - ns_name_length = class_name - name; - class_name += sizeof("::")-1; - if (class_name == name_end) { - return FAILURE; - } - ns_name = zend_strndup(name, ns_name_length); - - if (zend_hash_find(&EG(global_namespace_ptr)->class_table, ns_name, ns_name_length+1, (void **)&ns) == SUCCESS && CLASS_IS_NAMESPACE(*ns) && - zend_hash_find(&(*ns)->class_table, class_name, name_end - class_name + 1, (void **)ce) == SUCCESS) { - free(ns_name); - return SUCCESS; - } - - free(ns_name); - return FAILURE; -} - -ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) -{ - zval pv; - zend_op_array *new_op_array; - zend_op_array *original_active_op_array = EG(active_op_array); - zend_function_state *original_function_state_ptr = EG(function_state_ptr); - zend_uchar original_handle_op_arrays; - int retval; - - if (retval_ptr) { - pv.value.str.len = strlen(str)+sizeof("return ;")-1; - pv.value.str.val = emalloc(pv.value.str.len+1); - strcpy(pv.value.str.val, "return "); - strcat(pv.value.str.val, str); - strcat(pv.value.str.val, " ;"); - } else { - pv.value.str.len = strlen(str); - pv.value.str.val = estrndup(str, pv.value.str.len); - } - pv.type = IS_STRING; - - /*printf("Evaluating '%s'\n", pv.value.str.val);*/ - - original_handle_op_arrays = CG(handle_op_arrays); - CG(handle_op_arrays) = 0; - new_op_array = compile_string(&pv, string_name TSRMLS_CC); - CG(handle_op_arrays) = original_handle_op_arrays; - - if (new_op_array) { - 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; - - zend_execute(new_op_array TSRMLS_CC); - - if (local_retval_ptr) { - if (retval_ptr) { - COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr); - } else { - zval_ptr_dtor(&local_retval_ptr); - } - } else { - if (retval_ptr) { - INIT_ZVAL(*retval_ptr); - } - } - - EG(no_extensions)=0; - EG(opline_ptr) = original_opline_ptr; - EG(active_op_array) = original_active_op_array; - EG(function_state_ptr) = original_function_state_ptr; - destroy_op_array(new_op_array TSRMLS_CC); - efree(new_op_array); - EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; - retval = SUCCESS; - } else { - retval = FAILURE; - } - zval_dtor(&pv); - return retval; -} - - -void execute_new_code(TSRMLS_D) -{ - zend_op *opline, *end; - zend_op *ret_opline; - zval *local_retval=NULL; - - if (!CG(interactive) - || CG(active_op_array)->backpatch_count>0 - || CG(active_op_array)->function_name - || CG(active_op_array)->type!=ZEND_USER_FUNCTION) { - return; - } - - ret_opline = get_next_op(CG(active_op_array) TSRMLS_CC); - ret_opline->opcode = ZEND_RETURN; - ret_opline->op1.op_type = IS_CONST; - INIT_ZVAL(ret_opline->op1.u.constant); - SET_UNUSED(ret_opline->op2); - - 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 (oplineop1.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++; - } - - EG(return_value_ptr_ptr) = &local_retval; - EG(active_op_array) = CG(active_op_array); - zend_execute(CG(active_op_array) TSRMLS_CC); - if (local_retval) { - zval_ptr_dtor(&local_retval); - } - - CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */ - CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last; -} - - -ZEND_API void zend_timeout(int dummy) -{ - TSRMLS_FETCH(); - - if (zend_on_timeout) { - zend_on_timeout(EG(timeout_seconds) TSRMLS_CC); - } - - zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded", - EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s"); -} - - -#ifdef ZEND_WIN32 -static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) { - case WM_DESTROY: - PostQuitMessage(0); - break; - case WM_REGISTER_ZEND_TIMEOUT: - /* wParam is the thread id pointer, lParam is the timeout amount in seconds */ - if (lParam==0) { - KillTimer(timeout_window, wParam); - } else { - SetTimer(timeout_window, wParam, lParam*1000, NULL); - } - break; - case WM_UNREGISTER_ZEND_TIMEOUT: - /* wParam is the thread id pointer */ - KillTimer(timeout_window, wParam); - break; - case WM_TIMER: { -#ifdef ZTS - void ***tsrm_ls; - - tsrm_ls = ts_resource_ex(0, &wParam); - if (!tsrm_ls) { - /* Thread died before receiving its timeout? */ - break; - } -#endif - KillTimer(timeout_window, wParam); - EG(timed_out) = 1; - } - break; - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - return 0; -} - - - -static unsigned __stdcall timeout_thread_proc(void *pArgs) -{ - MSG message; - - wc.style=0; - wc.lpfnWndProc = zend_timeout_WndProc; - wc.cbClsExtra=0; - wc.cbWndExtra=0; - wc.hInstance=NULL; - wc.hIcon=NULL; - wc.hCursor=NULL; - wc.hbrBackground=(HBRUSH)(COLOR_BACKGROUND + 5); - wc.lpszMenuName=NULL; - wc.lpszClassName = "Zend Timeout Window"; - if (!RegisterClass(&wc)) { - return -1; - } - timeout_window = CreateWindow(wc.lpszClassName, wc.lpszClassName, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); - SetEvent(timeout_thread_event); - while (GetMessage(&message, NULL, 0, 0)) { - SendMessage(timeout_window, message.message, message.wParam, message.lParam); - if (message.message == WM_QUIT) { - break; - } - } - DestroyWindow(timeout_window); - UnregisterClass(wc.lpszClassName, NULL); - return 0; -} - - -void zend_init_timeout_thread() -{ - timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL); - _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id); - WaitForSingleObject(timeout_thread_event, INFINITE); -} - - -void zend_shutdown_timeout_thread() -{ - if (!timeout_thread_initialized) { - return; - } - PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0); -} - -#endif - -/* This one doesn't exists on QNX */ -#ifndef SIGPROF -#define SIGPROF 27 -#endif - -void zend_set_timeout(long seconds) -{ - TSRMLS_FETCH(); - - EG(timeout_seconds) = seconds; -#ifdef ZEND_WIN32 - if (timeout_thread_initialized==0 && InterlockedIncrement(&timeout_thread_initialized)==1) { - /* We start up this process-wide thread here and not in zend_startup(), because if Zend - * is initialized inside a DllMain(), you're not supposed to start threads from it. - */ - zend_init_timeout_thread(); - } - PostThreadMessage(timeout_thread_id, WM_REGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) seconds); -#else -# ifdef HAVE_SETITIMER - { - struct itimerval t_r; /* timeout requested */ - sigset_t sigset; - - t_r.it_value.tv_sec = seconds; - t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; - - setitimer(ITIMER_PROF, &t_r, NULL); - signal(SIGPROF, zend_timeout); - sigemptyset(&sigset); - sigaddset(&sigset, SIGPROF); - sigprocmask(SIG_UNBLOCK, &sigset, NULL); - } -# endif -#endif -} - - -void zend_unset_timeout(TSRMLS_D) -{ -#ifdef ZEND_WIN32 - PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0); -#else -# ifdef HAVE_SETITIMER - { - struct itimerval no_timeout; - - no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0; - - setitimer(ITIMER_PROF, &no_timeout, NULL); - } -# endif -#endif -} - -void zend_switch_namespace(zend_namespace *ns TSRMLS_DC) -{ - if(NULL == ns) { - return; - } - EG(active_namespace) = ns; - EG(function_table) = &ns->function_table; - EG(class_table) = &ns->class_table; -/* EG(zend_constants) = &ns->constants_table; */ -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_execute_locks.h b/Zend/zend_execute_locks.h deleted file mode 100644 index b2fcbc83a4..0000000000 --- a/Zend/zend_execute_locks.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_EXECUTE_LOCKS_H -#define ZEND_EXECUTE_LOCKS_H - -#define PZVAL_LOCK(z) zend_pzval_lock_func(z) - -static inline void zend_pzval_lock_func(zval *z) -{ - z->refcount++; -} - -#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: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c deleted file mode 100644 index a1372dff2c..0000000000 --- a/Zend/zend_extensions.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend_extensions.h" - -ZEND_API zend_llist zend_extensions; -static int last_resource_number; - -int zend_load_extension(char *path) -{ -#if ZEND_EXTENSIONS_SUPPORT - DL_HANDLE handle; - zend_extension *new_extension; - zend_extension_version_info *extension_version_info; - - handle = DL_LOAD(path); - if (!handle) { -#ifndef ZEND_WIN32 - fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR()); -#else - fprintf(stderr, "Failed loading %s\n", path); -#endif - return FAILURE; - } - - extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info"); - if (!extension_version_info) { - extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "_extension_version_info"); - } - new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry"); - if (!new_extension) { - new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "_zend_extension_entry"); - } - if (!extension_version_info || !new_extension) { - fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path); - DL_UNLOAD(handle); - return FAILURE; - } - - - /* allow extension to proclaim compatibility with any Zend version */ - if (extension_version_info->zend_extension_api_no != ZEND_EXTENSION_API_NO &&(!new_extension->api_no_check || new_extension->api_no_check(ZEND_EXTENSION_API_NO) != SUCCESS)) { - if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) { - fprintf(stderr, "%s requires Zend Engine API version %d.\n" - "The Zend Engine API version %d which is installed, is outdated.\n\n", - new_extension->name, - extension_version_info->zend_extension_api_no, - ZEND_EXTENSION_API_NO); - DL_UNLOAD(handle); - return FAILURE; - } else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) { - fprintf(stderr, "%s requires Zend Engine API version %d.\n" - "The Zend Engine API version %d which is installed, is newer.\n" - "Contact %s at %s for a later version of %s.\n\n", - new_extension->name, - extension_version_info->zend_extension_api_no, - ZEND_EXTENSION_API_NO, - new_extension->author, - new_extension->URL, - new_extension->name); - DL_UNLOAD(handle); - return FAILURE; - } - } else if (ZTS_V!=extension_version_info->thread_safe) { - fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n", - new_extension->name, - (extension_version_info->thread_safe?"is":"isn't"), - (ZTS_V?"is":"isn't")); - DL_UNLOAD(handle); - return FAILURE; - } else if (ZEND_DEBUG!=extension_version_info->debug) { - fprintf(stderr, "Cannot load %s - it %s debug information, whereas Zend %s\n", - new_extension->name, - (extension_version_info->debug?"contains":"does not contain"), - (ZEND_DEBUG?"does":"does not")); - DL_UNLOAD(handle); - return FAILURE; - } - - return zend_register_extension(new_extension, handle); -#else - fprintf(stderr, "Extensions are not supported on this platform.\n"); - return FAILURE; -#endif -} - - -int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) -{ -#if ZEND_EXTENSIONS_SUPPORT - zend_extension extension; - - extension = *new_extension; - extension.handle = handle; - - zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension); - - zend_llist_add_element(&zend_extensions, &extension); - - /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/ -#endif - - return SUCCESS; -} - - -static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC) -{ -#if ZEND_EXTENSIONS_SUPPORT - if (extension->shutdown) { - extension->shutdown(extension); - } -#endif -} - -static int zend_extension_startup(zend_extension *extension) -{ -#if ZEND_EXTENSIONS_SUPPORT - if (extension->startup) { - if (extension->startup(extension)!=SUCCESS) { - return 1; - } - zend_append_version_info(extension); - } -#endif - return 0; -} - - -int zend_startup_extensions_mechanism() -{ - /* Startup extensions mechanism */ - zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1); - last_resource_number = 0; - return SUCCESS; -} - - -int zend_startup_extensions() -{ - zend_llist_apply_with_del(&zend_extensions, (int (*)(void *)) zend_extension_startup); - return SUCCESS; -} - - -void zend_shutdown_extensions(TSRMLS_D) -{ - zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown TSRMLS_CC); - zend_llist_destroy(&zend_extensions); -} - - -void zend_extension_dtor(zend_extension *extension) -{ -#if ZEND_EXTENSIONS_SUPPORT && !ZEND_DEBUG - if (extension->handle) { - DL_UNLOAD(extension->handle); - } -#endif -} - - -static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args TSRMLS_DC) -{ - int message; - void *arg; - - if (!extension->message_handler || num_args!=2) { - return; - } - message = va_arg(args, int); - arg = va_arg(args, void *); - extension->message_handler(message, arg); -} - - -ZEND_API void zend_extension_dispatch_message(int message, void *arg) -{ - TSRMLS_FETCH(); - - zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg); -} - - -ZEND_API int zend_get_resource_handle(zend_extension *extension) -{ - if (last_resource_numberresource_number = last_resource_number; - return last_resource_number++; - } else { - return -1; - } -} - - -ZEND_API zend_extension *zend_get_extension(char *extension_name) -{ - zend_llist_element *element; - - for (element = zend_extensions.head; element; element = element->next) { - zend_extension *extension = (zend_extension *) element->data; - - if (!strcmp(extension->name, extension_name)) { - return extension; - } - } - return NULL; -} - -/* - * Support for dynamic loading of MH_BUNDLEs on Darwin / Mac OS X - * - */ - -#if HAVE_MACH_O_DYLD_H - -void *zend_mh_bundle_load(char* bundle_path) -{ - NSObjectFileImage bundle_image; - NSModule bundle_handle; - NSSymbol bundle_init_nssymbol; - void (*bundle_init)(void); - - if (NSCreateObjectFileImageFromFile(bundle_path, &bundle_image) != NSObjectFileImageSuccess) { - return NULL; - } - - bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_PRIVATE); - NSDestroyObjectFileImage(bundle_image); - - /* call the init function of the bundle */ - bundle_init_nssymbol = NSLookupSymbolInModule(bundle_handle, "__init"); - if (bundle_init_nssymbol != NULL) { - bundle_init = NSAddressOfSymbol(bundle_init_nssymbol); - bundle_init(); - } - - return bundle_handle; -} - -int zend_mh_bundle_unload(void *bundle_handle) -{ - NSSymbol bundle_fini_nssymbol; - void (*bundle_fini)(void); - - /* call the fini function of the bundle */ - bundle_fini_nssymbol = NSLookupSymbolInModule(bundle_handle, "__fini"); - if (bundle_fini_nssymbol != NULL) { - bundle_fini = NSAddressOfSymbol(bundle_fini_nssymbol); - bundle_fini(); - } - - return (int) NSUnLinkModule(bundle_handle, NULL); -} - -void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name) -{ - NSSymbol symbol; - symbol = NSLookupSymbolInModule(bundle_handle, symbol_name); - return NSAddressOfSymbol(symbol); -} - -const char *zend_mh_bundle_error(void) -{ - /* Witness the state of the art error reporting */ - return NULL; -} - -#endif /* HAVE_MACH_O_DYLD_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h deleted file mode 100644 index dc9f3acf7b..0000000000 --- a/Zend/zend_extensions.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_EXTENSIONS_H -#define ZEND_EXTENSIONS_H - -#include "zend_compile.h" - -#define ZEND_EXTENSION_API_NO 90021012 - -typedef struct _zend_extension_version_info { - int zend_extension_api_no; - char *required_zend_version; - unsigned char thread_safe; - unsigned char debug; -} zend_extension_version_info; - - -typedef struct _zend_extension zend_extension; - -/* Typedef's for zend_extension function pointers */ -typedef int (*startup_func_t)(zend_extension *extension); -typedef void (*shutdown_func_t)(zend_extension *extension); -typedef void (*activate_func_t)(void); -typedef void (*deactivate_func_t)(void); - -typedef void (*message_handler_func_t)(int message, void *arg); - -typedef void (*op_array_handler_func_t)(zend_op_array *op_array); - -typedef void (*statement_handler_func_t)(zend_op_array *op_array); -typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array); -typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array); - -typedef void (*op_array_ctor_func_t)(zend_op_array *op_array); -typedef void (*op_array_dtor_func_t)(zend_op_array *op_array); - -struct _zend_extension { - char *name; - char *version; - char *author; - char *URL; - char *copyright; - - startup_func_t startup; - shutdown_func_t shutdown; - activate_func_t activate; - deactivate_func_t deactivate; - - message_handler_func_t message_handler; - - op_array_handler_func_t op_array_handler; - - statement_handler_func_t statement_handler; - fcall_begin_handler_func_t fcall_begin_handler; - fcall_end_handler_func_t fcall_end_handler; - - op_array_ctor_func_t op_array_ctor; - op_array_dtor_func_t op_array_dtor; - - int (*api_no_check)(int api_no); - void *reserved2; - void *reserved3; - void *reserved4; - void *reserved5; - void *reserved6; - void *reserved7; - void *reserved8; - - DL_HANDLE handle; - int resource_number; -}; - - -ZEND_API int zend_get_resource_handle(zend_extension *extension); -ZEND_API void zend_extension_dispatch_message(int message, void *arg); - -#define ZEND_EXTMSG_NEW_EXTENSION 1 - - -#define ZEND_EXTENSION() \ - ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_VERSION, ZTS_V, ZEND_DEBUG } - -#define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1 -#define COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1 - - -ZEND_API extern zend_llist zend_extensions; - -void zend_extension_dtor(zend_extension *extension); -ZEND_API int zend_load_extension(char *path); -ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); -void zend_append_version_info(zend_extension *extension); -int zend_startup_extensions_mechanism(void); -int zend_startup_extensions(void); -void zend_shutdown_extensions(TSRMLS_D); -ZEND_API zend_extension *zend_get_extension(char *extension_name); - -#endif /* ZEND_EXTENSIONS_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_fast_cache.h b/Zend/zend_fast_cache.h deleted file mode 100644 index 16d3213ac2..0000000000 --- a/Zend/zend_fast_cache.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_FAST_CACHE_H -#define ZEND_FAST_CACHE_H - -#ifndef ZEND_ENABLE_FAST_CACHE -# if ZEND_DEBUG -# define ZEND_ENABLE_FAST_CACHE 0 -# else -# define ZEND_ENABLE_FAST_CACHE 0 -# endif -#endif - -typedef struct _zend_fast_cache_list_entry { - struct _zend_fast_cache_list_entry *next; -} zend_fast_cache_list_entry; - -#define MAX_FAST_CACHE_TYPES 4 - - -#define ZVAL_CACHE_LIST 0 -#define HASHTABLE_CACHE_LIST 1 - -#if ZEND_ENABLE_FAST_CACHE - - -#include "zend_globals.h" -#include "zend_globals_macros.h" -#include "zend_alloc.h" - - -#if ZEND_DEBUG -# define RECORD_ZVAL_CACHE_HIT(fc_type) AG(fast_cache_stats)[fc_type][1]++; -# define RECORD_ZVAL_CACHE_MISS(fc_type) AG(fast_cache_stats)[fc_type][0]++; -#else -# define RECORD_ZVAL_CACHE_HIT(fc_type) -# define RECORD_ZVAL_CACHE_MISS(fc_type) -#endif - - -#define ZEND_FAST_ALLOC(p, type, fc_type) \ - { \ - TSRMLS_FETCH(); \ - \ - if (((p) = (type *) AG(fast_cache_list_head)[fc_type])) { \ - AG(fast_cache_list_head)[fc_type] = ((zend_fast_cache_list_entry *) AG(fast_cache_list_head)[fc_type])->next; \ - RECORD_ZVAL_CACHE_HIT(fc_type); \ - } else { \ - (p) = (type *) emalloc(sizeof(type)); \ - RECORD_ZVAL_CACHE_MISS(fc_type); \ - } \ - } - - -#define ZEND_FAST_FREE(p, fc_type) \ - { \ - TSRMLS_FETCH(); \ - \ - ((zend_fast_cache_list_entry *) (p))->next = (zend_fast_cache_list_entry *) AG(fast_cache_list_head)[fc_type]; \ - AG(fast_cache_list_head)[fc_type] = (zend_fast_cache_list_entry *) (p); \ - } - -#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \ - ZEND_FAST_ALLOC(p, type, fc_type) - -#define ZEND_FAST_FREE_REL(p, fc_type) \ - ZEND_FAST_FREE(p, fc_type) - - -#else /* !ZEND_ENABLE_FAST_CACHE */ - -#define ZEND_FAST_ALLOC(p, type, fc_type) \ - (p) = (type *) emalloc(sizeof(type)) - -#define ZEND_FAST_FREE(p, fc_type) \ - efree(p) - -#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \ - (p) = (type *) emalloc_rel(sizeof(type)) - -#define ZEND_FAST_FREE_REL(p, fc_type) \ - efree_rel(p) - -#endif /* ZEND_ENABLE_FAST_CACHE */ - - - - -/* fast cache for zval's */ -#define ALLOC_ZVAL(z) \ - ZEND_FAST_ALLOC(z, zval, ZVAL_CACHE_LIST) - -#define FREE_ZVAL(z) \ - ZEND_FAST_FREE(z, ZVAL_CACHE_LIST) - -#define ALLOC_ZVAL_REL(z) \ - ZEND_FAST_ALLOC_REL(z, zval, ZVAL_CACHE_LIST) - -#define FREE_ZVAL_REL(z) \ - ZEND_FAST_FREE_REL(z, ZVAL_CACHE_LIST) - -/* fast cache for HashTables */ -#define ALLOC_HASHTABLE(ht) \ - ZEND_FAST_ALLOC(ht, HashTable, HASHTABLE_CACHE_LIST) - -#define FREE_HASHTABLE(ht) \ - ZEND_FAST_FREE(ht, HASHTABLE_CACHE_LIST) - -#define ALLOC_HASHTABLE_REL(ht) \ - ZEND_FAST_ALLOC_REL(ht, HashTable, HASHTABLE_CACHE_LIST) - -#define FREE_HASHTABLE_REL(ht) \ - ZEND_FAST_FREE_REL(ht, HASHTABLE_CACHE_LIST) - -#endif /* ZEND_FAST_CACHE_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h deleted file mode 100644 index 39bb83c8e9..0000000000 --- a/Zend/zend_globals.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_GLOBALS_H -#define ZEND_GLOBALS_H - - -#include - -#include "zend_globals_macros.h" - -#include "zend_stack.h" -#include "zend_ptr_stack.h" -#include "zend_hash.h" -#include "zend_llist.h" -#include "zend_fast_cache.h" -#include "zend_objects.h" -#include "zend_objects_API.h" - -/* Define ZTS if you want a thread-safe Zend */ -/*#undef ZTS*/ - -#ifdef ZTS - -BEGIN_EXTERN_C() -ZEND_API extern int compiler_globals_id; -ZEND_API extern int executor_globals_id; -ZEND_API extern int alloc_globals_id; -END_EXTERN_C() - -#endif - -#define SYMTABLE_CACHE_SIZE 32 - - -#include "zend_compile.h" - -/* excpt.h on Digital Unix 4.0 defines function_table */ -#undef function_table - - -typedef struct _zend_declarables { - zval ticks; -} zend_declarables; - - -struct _zend_compiler_globals { - zend_stack bp_stack; - zend_stack switch_cond_stack; - zend_stack foreach_copy_stack; - zend_stack object_stack; - zend_stack declare_stack; - - zend_class_entry *active_class_entry; - zend_namespace *active_namespace; - - /* variables for list() compilation */ - zend_llist list_llist; - zend_llist dimension_llist; - zend_stack list_stack; - - zend_stack function_call_stack; - - char *compiled_filename; - - int zend_lineno; - int comment_start_line; - char *heredoc; - int heredoc_len; - - zend_op_array *active_op_array; - - zend_namespace global_namespace; - - HashTable *function_table; /* function symbol table */ - HashTable *class_table; /* class table */ - HashTable namespace_table; /* namespaces */ - - HashTable filenames_table; - - HashTable *auto_globals; - - zend_bool in_compilation; - zend_bool short_tags; - zend_bool asp_tags; - zend_bool allow_call_time_pass_reference; - - zend_declarables declarables; - - /* For extensions support */ - zend_bool extended_info; /* generate extension information for debugger/profiler */ - zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */ - - zend_bool unclean_shutdown; - - zend_bool ini_parser_unbuffered_errors; - - zend_llist open_files; - - zend_llist *throw_list; - long catch_begin; - - struct _zend_ini_parser_param *ini_parser_param; - - int interactive; - - zend_uint start_lineno; - zend_bool in_clone_method; - zend_bool increment_lineno; - - zend_llist import_commands; - znode implementing_class; - - zend_uint access_type; - - char *doc_comment; - zend_uint doc_comment_len; -}; - - -struct _zend_executor_globals { - zval **return_value_ptr_ptr; - - zval uninitialized_zval; - zval *uninitialized_zval_ptr; - - zval error_zval; - zval *error_zval_ptr; - - zend_function_state *function_state_ptr; - zend_ptr_stack arg_types_stack; - - /* symbol table cache */ - HashTable *symtable_cache[SYMTABLE_CACHE_SIZE]; - HashTable **symtable_cache_limit; - HashTable **symtable_cache_ptr; - - zend_op **opline_ptr; - - HashTable *active_symbol_table; - HashTable symbol_table; /* main symbol table */ - - HashTable included_files; /* files already included */ - - jmp_buf bailout; - - int error_reporting; - int orig_error_reporting; - int exit_status; - - zend_op_array *active_op_array; - - HashTable *function_table; /* function symbol table */ - HashTable *class_table; /* class table */ - HashTable *zend_constants; /* constants table */ - - zend_class_entry *scope; - zend_namespace *global_namespace_ptr; - zend_namespace *active_namespace; - - zval *This; - - long precision; - - int ticks_count; - - zend_bool in_execution; - zend_bool bailout_set; - zend_bool full_tables_cleanup; - zend_bool implicit_clone; - - /* for extended information support */ - zend_bool no_extensions; - -#ifdef ZEND_WIN32 - zend_bool timed_out; -#endif - - HashTable regular_list; - HashTable persistent_list; - - zend_ptr_stack argument_stack; - zval *free_op1, *free_op2; - int (*unary_op)(zval *result, zval *op1); - int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC); - - zval *garbage[2]; - int garbage_ptr; - - zval *user_error_handler; - zval *user_exception_handler; - zend_ptr_stack user_error_handlers; - zend_ptr_stack user_exception_handlers; - - /* timeout support */ - int timeout_seconds; - - int lambda_count; - - HashTable *ini_directives; - zend_objects_store objects_store; - zval *exception; - - struct _zend_execute_data *current_execute_data; - - zend_property_info std_property_info; - - /* locale stuff */ - char float_separator[1]; - - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; -}; - -#include "zend_mm.h" - -struct _zend_alloc_globals { - zend_mem_header *head; /* standard list */ - void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES]; - unsigned int cache_count[MAX_CACHED_MEMORY]; - void *fast_cache_list_head[MAX_FAST_CACHE_TYPES]; - -#ifdef ZEND_WIN32 - HANDLE memory_heap; -#endif - -#if ZEND_DEBUG - /* for performance tuning */ - int cache_stats[MAX_CACHED_MEMORY][2]; - int fast_cache_stats[MAX_FAST_CACHE_TYPES][2]; -#endif -#if MEMORY_LIMIT - unsigned int memory_limit; - unsigned int allocated_memory; - unsigned int allocated_memory_peak; - unsigned char memory_exhausted; -#endif -#ifdef ZEND_MM - zend_mm_heap mm_heap; -#endif -}; - -struct _zend_scanner_globals { - zend_file_handle *yy_in; - zend_file_handle *yy_out; - int yy_leng; - char *yy_text; - struct yy_buffer_state *current_buffer; - char *c_buf_p; - int init; - int start; - int lineno; - char _yy_hold_char; - int yy_n_chars; - int _yy_did_buffer_switch_on_eof; - int _yy_last_accepting_state; /* Must be of the same type as yy_state_type, - * if for whatever reason it's no longer int! - */ - char *_yy_last_accepting_cpos; - int _yy_more_flag; - int _yy_more_len; - int yy_start_stack_ptr; - int yy_start_stack_depth; - int *yy_start_stack; -}; - -#endif /* ZEND_GLOBALS_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_globals_macros.h b/Zend/zend_globals_macros.h deleted file mode 100644 index c9d65274ec..0000000000 --- a/Zend/zend_globals_macros.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_GLOBALS_MACROS_H -#define ZEND_GLOBALS_MACROS_H - -typedef struct _zend_compiler_globals zend_compiler_globals; -typedef struct _zend_executor_globals zend_executor_globals; -typedef struct _zend_alloc_globals zend_alloc_globals; -typedef struct _zend_scanner_globals zend_scanner_globals; - -/* Compiler */ -#ifdef ZTS -# define CG(v) TSRMG(compiler_globals_id, zend_compiler_globals *, v) -BEGIN_EXTERN_C() -int zendparse(void *compiler_globals); -END_EXTERN_C() -#else -# define CG(v) (compiler_globals.v) -extern ZEND_API struct _zend_compiler_globals compiler_globals; -int zendparse(void); -#endif - - -/* Executor */ -#ifdef ZTS -# define EG(v) TSRMG(executor_globals_id, zend_executor_globals *, v) -#else -# define EG(v) (executor_globals.v) -extern ZEND_API zend_executor_globals executor_globals; -#endif - - -/* Memory Manager */ -#ifdef ZTS -# define AG(v) TSRMG(alloc_globals_id, zend_alloc_globals *, v) -#else -# define AG(v) (alloc_globals.v) -extern ZEND_API zend_alloc_globals alloc_globals; -#endif - - -/* Language Scanner */ -#ifdef ZTS -# define LANG_SCNG(v) TSRMG(language_scanner_globals_id, zend_scanner_globals *, v) -extern ZEND_API ts_rsrc_id language_scanner_globals_id; -#else -# define LANG_SCNG(v) (language_scanner_globals.v) -extern ZEND_API zend_scanner_globals language_scanner_globals; -#endif - - -/* INI Scanner */ -#ifdef ZTS -# define INI_SCNG(v) TSRMG(ini_scanner_globals_id, zend_scanner_globals *, v) -extern ZEND_API ts_rsrc_id ini_scanner_globals_id; -#else -# define INI_SCNG(v) (ini_scanner_globals.v) -extern ZEND_API zend_scanner_globals ini_scanner_globals; -#endif - - -/* For limited downwards source compatibility */ -#define CLS_FETCH() -#define ELS_FETCH() -#define ALS_FETCH() -#define PLS_FETCH() -#define SLS_FETCH() -#define CLS_D -#define ELS_D -#define ALS_D -#define PLS_D -#define SLS_D -#define CLS_DC -#define ELS_DC -#define ALS_DC -#define PLS_DC -#define SLS_DC -#define CLS_C -#define ELS_C -#define ALS_C -#define PLS_C -#define SLS_C -#define CLS_CC -#define ELS_CC -#define ALS_CC -#define PLS_CC -#define SLS_CC - - -#endif /* ZEND_GLOBALS_MACROS_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c deleted file mode 100644 index 6ec60239ad..0000000000 --- a/Zend/zend_hash.c +++ /dev/null @@ -1,1354 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" - -#define HANDLE_NUMERIC(key, length, func) { \ - register char *tmp=key; \ - \ - if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index */ \ - char *end=tmp+length-1; \ - ulong idx; \ - \ - if (*tmp++=='0' && length>2) { /* don't accept numbers with leading zeros */ \ - break; \ - } \ - while (tmp='0' && *tmp<='9')) { \ - break; \ - } \ - tmp++; \ - } \ - if (tmp==end && *tmp=='\0') { /* a numeric index */ \ - idx = strtol(key, NULL, 10); \ - if (idx!=LONG_MAX) { \ - return func; \ - } \ - } \ - } while (0); \ -} - - -#define CONNECT_TO_BUCKET_DLLIST(element, list_head) \ - (element)->pNext = (list_head); \ - (element)->pLast = NULL; \ - if ((element)->pNext) { \ - (element)->pNext->pLast = (element); \ - } - -#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \ - (element)->pListLast = (ht)->pListTail; \ - (ht)->pListTail = (element); \ - (element)->pListNext = NULL; \ - if ((element)->pListLast != NULL) { \ - (element)->pListLast->pListNext = (element); \ - } \ - if (!(ht)->pListHead) { \ - (ht)->pListHead = (element); \ - } \ - if ((ht)->pInternalPointer == NULL) { \ - (ht)->pInternalPointer = (element); \ - } - -#if ZEND_DEBUG -#define HT_OK 0 -#define HT_IS_DESTROYING 1 -#define HT_DESTROYED 2 -#define HT_CLEANING 3 - -static void _zend_is_inconsistent(HashTable *ht, char *file, int line) -{ - if (ht->inconsistent==HT_OK) { - return; - } - switch (ht->inconsistent) { - case HT_IS_DESTROYING: - zend_output_debug_string(1, "%s(%d) : ht=0x%08x is being destroyed", file, line, ht); - break; - case HT_DESTROYED: - zend_output_debug_string(1, "%s(%d) : ht=0x%08x is already destroyed", file, line, ht); - break; - case HT_CLEANING: - zend_output_debug_string(1, "%s(%d) : ht=0x%08x is being cleaned", file, line, ht); - break; - } - zend_bailout(); -} -#define IS_CONSISTENT(a) _zend_is_inconsistent(a, __FILE__, __LINE__); -#define SET_INCONSISTENT(n) ht->inconsistent = n; -#else -#define IS_CONSISTENT(a) -#define SET_INCONSISTENT(n) -#endif - -#define HASH_PROTECT_RECURSION(ht) \ - if ((ht)->bApplyProtection) { \ - if ((ht)->nApplyCount++ >= 3) { \ - zend_error(E_ERROR, "Nesting level too deep - recursive dependency?"); \ - } \ - } - - -#define HASH_UNPROTECT_RECURSION(ht) \ - if ((ht)->bApplyProtection) { \ - (ht)->nApplyCount--; \ - } - - -#define ZEND_HASH_IF_FULL_DO_RESIZE(ht) \ - if ((ht)->nNumOfElements > (ht)->nTableSize) { \ - zend_hash_do_resize(ht); \ - } - -static int zend_hash_do_resize(HashTable *ht); - -ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength) -{ - return zend_inline_hash_func(arKey, nKeyLength); -} - - -#define UPDATE_DATA(ht, p, pData, nDataSize) \ - if (nDataSize == sizeof(void*)) { \ - if (!(p)->pDataPtr) { \ - pefree((p)->pData, (ht)->persistent); \ - } \ - memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \ - (p)->pData = &(p)->pDataPtr; \ - } else { \ - if ((p)->pDataPtr) { \ - (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \ - (p)->pDataPtr=NULL; \ - } \ - memcpy((p)->pData, pData, nDataSize); \ - } - -#define INIT_DATA(ht, p, pData, nDataSize); \ - if (nDataSize == sizeof(void*)) { \ - memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \ - (p)->pData = &(p)->pDataPtr; \ - } else { \ - (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \ - if (!(p)->pData) { \ - pefree(p, (ht)->persistent); \ - return FAILURE; \ - } \ - memcpy((p)->pData, pData, nDataSize); \ - (p)->pDataPtr=NULL; \ - } - - -ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) -{ - uint i = 3; - - SET_INCONSISTENT(HT_OK); - - while ((1U << i) < nSize) { - i++; - } - - ht->nTableSize = 1 << i; - ht->nTableMask = ht->nTableSize - 1; - - /* Uses ecalloc() so that Bucket* == NULL */ - if (persistent) { - ht->arBuckets = (Bucket **) calloc(ht->nTableSize, sizeof(Bucket *)); - } else { - ht->arBuckets = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *)); - } - - if (!ht->arBuckets) { - return FAILURE; - } - - ht->pDestructor = pDestructor; - ht->pListHead = NULL; - ht->pListTail = NULL; - ht->nNumOfElements = 0; - ht->nNextFreeElement = 0; - ht->pInternalPointer = NULL; - ht->persistent = persistent; - ht->nApplyCount = 0; - ht->bApplyProtection = 1; - return SUCCESS; -} - - -ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) -{ - int retval = _zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent ZEND_FILE_LINE_CC); - - ht->bApplyProtection = bApplyProtection; - return retval; -} - - -ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProtection) -{ - ht->bApplyProtection = bApplyProtection; -} - - - -ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag) -{ - ulong h; - uint nIndex; - Bucket *p; - - IS_CONSISTENT(ht); - - if (nKeyLength <= 0) { -#if ZEND_DEBUG - ZEND_PUTS("zend_hash_update: Can't put in empty key\n"); -#endif - return FAILURE; - } - - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update_or_next_insert(ht, idx, pData, nDataSize, pDest, flag)); - - h = zend_inline_hash_func(arKey, nKeyLength); - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - if (flag & HASH_ADD) { - return FAILURE; - } - HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p->pData == pData) { - ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n"); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - UPDATE_DATA(ht, p, pData, nDataSize); - if (pDest) { - *pDest = p->pData; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - return SUCCESS; - } - } - p = p->pNext; - } - - p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength, ht->persistent); - if (!p) { - return FAILURE; - } - memcpy(p->arKey, arKey, nKeyLength); - p->nKeyLength = nKeyLength; - INIT_DATA(ht, p, pData, nDataSize); - p->h = h; - CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]); - if (pDest) { - *pDest = p->pData; - } - - HANDLE_BLOCK_INTERRUPTIONS(); - CONNECT_TO_GLOBAL_DLLIST(p, ht); - ht->arBuckets[nIndex] = p; - HANDLE_UNBLOCK_INTERRUPTIONS(); - - ht->nNumOfElements++; - ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */ - return SUCCESS; -} - -ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag) -{ - uint nIndex; - Bucket *p; - - IS_CONSISTENT(ht); - - if (nKeyLength == 0) { - return zend_hash_index_update(ht, h, pData, nDataSize, pDest); - } - - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - if (flag & HASH_ADD) { - return FAILURE; - } - HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p->pData == pData) { - ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n"); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - UPDATE_DATA(ht, p, pData, nDataSize); - if (pDest) { - *pDest = p->pData; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - return SUCCESS; - } - } - p = p->pNext; - } - - p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength, ht->persistent); - if (!p) { - return FAILURE; - } - - memcpy(p->arKey, arKey, nKeyLength); - p->nKeyLength = nKeyLength; - INIT_DATA(ht, p, pData, nDataSize); - p->h = h; - - CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]); - - if (pDest) { - *pDest = p->pData; - } - - HANDLE_BLOCK_INTERRUPTIONS(); - ht->arBuckets[nIndex] = p; - CONNECT_TO_GLOBAL_DLLIST(p, ht); - HANDLE_UNBLOCK_INTERRUPTIONS(); - - ht->nNumOfElements++; - ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */ - return SUCCESS; -} - - -ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength) -{ - void *dummy = (void *) 1; - - return zend_hash_add(ht, arKey, nKeyLength, &dummy, sizeof(void *), NULL); -} - - -ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag) -{ - uint nIndex; - Bucket *p; - - IS_CONSISTENT(ht); - - if (flag & HASH_NEXT_INSERT) { - h = ht->nNextFreeElement; - } - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->nKeyLength == 0) && (p->h == h)) { - if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) { - return FAILURE; - } - HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p->pData == pData) { - ZEND_PUTS("Fatal error in zend_hash_index_update: p->pData == pData\n"); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - UPDATE_DATA(ht, p, pData, nDataSize); - HANDLE_UNBLOCK_INTERRUPTIONS(); - if ((long)h >= (long)ht->nNextFreeElement) { - ht->nNextFreeElement = h + 1; - } - if (pDest) { - *pDest = p->pData; - } - return SUCCESS; - } - p = p->pNext; - } - p = (Bucket *) pemalloc(sizeof(Bucket)-1, ht->persistent); - if (!p) { - return FAILURE; - } - p->nKeyLength = 0; /* Numeric indices are marked by making the nKeyLength == 0 */ - p->h = h; - INIT_DATA(ht, p, pData, nDataSize); - if (pDest) { - *pDest = p->pData; - } - - CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]); - - HANDLE_BLOCK_INTERRUPTIONS(); - ht->arBuckets[nIndex] = p; - CONNECT_TO_GLOBAL_DLLIST(p, ht); - HANDLE_UNBLOCK_INTERRUPTIONS(); - - if ((long)h >= (long)ht->nNextFreeElement) { - ht->nNextFreeElement = h + 1; - } - ht->nNumOfElements++; - ZEND_HASH_IF_FULL_DO_RESIZE(ht); - return SUCCESS; -} - - -static int zend_hash_do_resize(HashTable *ht) -{ - Bucket **t; - - IS_CONSISTENT(ht); - - if ((ht->nTableSize << 1) > 0) { /* Let's double the table size */ - t = (Bucket **) perealloc_recoverable(ht->arBuckets, (ht->nTableSize << 1) * sizeof(Bucket *), ht->persistent); - if (t) { - HANDLE_BLOCK_INTERRUPTIONS(); - ht->arBuckets = t; - ht->nTableSize = (ht->nTableSize << 1); - ht->nTableMask = ht->nTableSize - 1; - zend_hash_rehash(ht); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return SUCCESS; - } - return FAILURE; - } - return SUCCESS; -} - -ZEND_API int zend_hash_rehash(HashTable *ht) -{ - Bucket *p; - uint nIndex; - - IS_CONSISTENT(ht); - - memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *)); - p = ht->pListHead; - while (p != NULL) { - nIndex = p->h & ht->nTableMask; - CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]); - ht->arBuckets[nIndex] = p; - p = p->pListNext; - } - return SUCCESS; -} - -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) -{ - uint nIndex; - Bucket *p; - - IS_CONSISTENT(ht); - - if (flag == HASH_DEL_KEY) { - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_del_key_or_index(ht, arKey, nKeyLength, idx, HASH_DEL_INDEX)); - h = zend_inline_hash_func(arKey, nKeyLength); - } - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */ - ((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) { - HANDLE_BLOCK_INTERRUPTIONS(); - if (p == ht->arBuckets[nIndex]) { - ht->arBuckets[nIndex] = p->pNext; - } else { - p->pLast->pNext = p->pNext; - } - if (p->pNext) { - p->pNext->pLast = p->pLast; - } - if (p->pListLast != NULL) { - p->pListLast->pListNext = p->pListNext; - } else { - /* Deleting the head of the list */ - ht->pListHead = p->pListNext; - } - if (p->pListNext != NULL) { - p->pListNext->pListLast = p->pListLast; - } else { - ht->pListTail = p->pListLast; - } - if (ht->pInternalPointer == p) { - ht->pInternalPointer = p->pListNext; - } - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (!p->pDataPtr) { - pefree(p->pData, ht->persistent); - } - pefree(p, ht->persistent); - HANDLE_UNBLOCK_INTERRUPTIONS(); - ht->nNumOfElements--; - return SUCCESS; - } - p = p->pNext; - } - return FAILURE; -} - - -ZEND_API void zend_hash_destroy(HashTable *ht) -{ - Bucket *p, *q; - - IS_CONSISTENT(ht); - - SET_INCONSISTENT(HT_IS_DESTROYING); - - p = ht->pListHead; - while (p != NULL) { - q = p; - p = p->pListNext; - if (ht->pDestructor) { - ht->pDestructor(q->pData); - } - if (!q->pDataPtr && q->pData) { - pefree(q->pData, ht->persistent); - } - pefree(q, ht->persistent); - } - pefree(ht->arBuckets, ht->persistent); - - SET_INCONSISTENT(HT_DESTROYED); -} - - -ZEND_API void zend_hash_clean(HashTable *ht) -{ - Bucket *p, *q; - - IS_CONSISTENT(ht); - - SET_INCONSISTENT(HT_CLEANING); - - p = ht->pListHead; - while (p != NULL) { - q = p; - p = p->pListNext; - if (ht->pDestructor) { - ht->pDestructor(q->pData); - } - if (!q->pDataPtr && q->pData) { - pefree(q->pData, ht->persistent); - } - pefree(q, ht->persistent); - } - memset(ht->arBuckets, 0, ht->nTableSize*sizeof(Bucket *)); - ht->pListHead = NULL; - ht->pListTail = NULL; - ht->nNumOfElements = 0; - ht->nNextFreeElement = 0; - ht->pInternalPointer = NULL; - - SET_INCONSISTENT(HT_OK); -} - -/* This function is used by the various apply() functions. - * It deletes the passed bucket, and returns the address of the - * next bucket. The hash *may* be altered during that time, the - * returned value will still be valid. - */ -static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p) -{ - Bucket *retval; - - HANDLE_BLOCK_INTERRUPTIONS(); - - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (!p->pDataPtr) { - pefree(p->pData, ht->persistent); - } - retval = p->pListNext; - - if (p->pLast) { - p->pLast->pNext = p->pNext; - } else { - uint nIndex; - - nIndex = p->h & ht->nTableMask; - ht->arBuckets[nIndex] = p->pNext; - } - if (p->pNext) { - p->pNext->pLast = p->pLast; - } else { - /* Nothing to do as this list doesn't have a tail */ - } - - if (p->pListLast != NULL) { - p->pListLast->pListNext = p->pListNext; - } else { - /* Deleting the head of the list */ - ht->pListHead = p->pListNext; - } - if (p->pListNext != NULL) { - p->pListNext->pListLast = p->pListLast; - } else { - ht->pListTail = p->pListLast; - } - if (ht->pInternalPointer == p) { - ht->pInternalPointer = p->pListNext; - } - pefree(p, ht->persistent); - HANDLE_UNBLOCK_INTERRUPTIONS(); - ht->nNumOfElements--; - - return retval; -} - - -ZEND_API void zend_hash_graceful_destroy(HashTable *ht) -{ - Bucket *p; - - IS_CONSISTENT(ht); - - p = ht->pListHead; - while (p != NULL) { - p = zend_hash_apply_deleter(ht, p); - } - pefree(ht->arBuckets, ht->persistent); - - SET_INCONSISTENT(HT_DESTROYED); -} - -ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht) -{ - Bucket *p; - - IS_CONSISTENT(ht); - - p = ht->pListTail; - while (p != NULL) { - zend_hash_apply_deleter(ht, p); - p = ht->pListTail; - } - - pefree(ht->arBuckets, ht->persistent); - - SET_INCONSISTENT(HT_DESTROYED); -} - -/* This is used to selectively delete certain entries from a hashtable. - * destruct() receives the data and decides if the entry should be deleted - * or not - */ - - -ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) -{ - Bucket *p; - - IS_CONSISTENT(ht); - - HASH_PROTECT_RECURSION(ht); - p = ht->pListHead; - while (p != NULL) { - if (apply_func(p->pData TSRMLS_CC)) { - p = zend_hash_apply_deleter(ht, p); - } else { - p = p->pListNext; - } - } - HASH_UNPROTECT_RECURSION(ht); -} - - -ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC) -{ - Bucket *p; - - IS_CONSISTENT(ht); - - HASH_PROTECT_RECURSION(ht); - p = ht->pListHead; - while (p != NULL) { - if (apply_func(p->pData, argument TSRMLS_CC)) { - p = zend_hash_apply_deleter(ht, p); - } else { - p = p->pListNext; - } - } - HASH_UNPROTECT_RECURSION(ht); -} - - -ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t destruct, int num_args, ...) -{ - Bucket *p; - va_list args; - zend_hash_key hash_key; - - IS_CONSISTENT(ht); - - HASH_PROTECT_RECURSION(ht); - - p = ht->pListHead; - while (p != NULL) { - va_start(args, num_args); - hash_key.arKey = p->arKey; - hash_key.nKeyLength = p->nKeyLength; - hash_key.h = p->h; - if (destruct(p->pData, num_args, args, &hash_key)) { - p = zend_hash_apply_deleter(ht, p); - } else { - p = p->pListNext; - } - va_end(args); - } - - HASH_UNPROTECT_RECURSION(ht); -} - - -ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) -{ - Bucket *p, *q; - - IS_CONSISTENT(ht); - - HASH_PROTECT_RECURSION(ht); - p = ht->pListTail; - while (p != NULL) { - int result = apply_func(p->pData TSRMLS_CC); - - q = p; - p = p->pListLast; - if (result & ZEND_HASH_APPLY_REMOVE) { - if (q->nKeyLength>0) { - zend_hash_del(ht, q->arKey, q->nKeyLength); - } else { - zend_hash_index_del(ht, q->h); - } - } - if (result & ZEND_HASH_APPLY_STOP) { - break; - } - } - HASH_UNPROTECT_RECURSION(ht); -} - - -ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size) -{ - Bucket *p; - void *new_entry; - - IS_CONSISTENT(source); - IS_CONSISTENT(target); - - p = source->pListHead; - while (p) { - if (p->nKeyLength) { - zend_hash_update(target, p->arKey, p->nKeyLength, p->pData, size, &new_entry); - } else { - zend_hash_index_update(target, p->h, p->pData, size, &new_entry); - } - if (pCopyConstructor) { - pCopyConstructor(new_entry); - } - p = p->pListNext; - } - target->pInternalPointer = target->pListHead; -} - - -ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite) -{ - Bucket *p; - void *t; - int mode = (overwrite?HASH_UPDATE:HASH_ADD); - - IS_CONSISTENT(source); - IS_CONSISTENT(target); - - p = source->pListHead; - while (p) { - if (p->nKeyLength>0) { - if (zend_hash_add_or_update(target, p->arKey, p->nKeyLength, p->pData, size, &t, mode)==SUCCESS && pCopyConstructor) { - pCopyConstructor(t); - } - } else { - if ((mode==HASH_UPDATE || !zend_hash_index_exists(target, p->h)) && zend_hash_index_update(target, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) { - pCopyConstructor(t); - } - } - p = p->pListNext; - } - target->pInternalPointer = target->pListHead; -} - - -static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, void *source_data, Bucket *p, void *pParam, merge_checker_func_t merge_checker_func) -{ - zend_hash_key hash_key; - - hash_key.arKey = p->arKey; - hash_key.nKeyLength = p->nKeyLength; - hash_key.h = p->h; - return merge_checker_func(target, source_data, &hash_key, pParam); -} - - -ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam) -{ - Bucket *p; - void *t; - - IS_CONSISTENT(source); - IS_CONSISTENT(target); - - p = source->pListHead; - while (p) { - if (zend_hash_replace_checker_wrapper(target, p->pData, p, pParam, pMergeSource)) { - if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) { - pCopyConstructor(t); - } - } - p = p->pListNext; - } - target->pInternalPointer = target->pListHead; -} - - -ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength) -{ - return zend_inline_hash_func(arKey, nKeyLength); -} - - -/* Returns SUCCESS if found and FAILURE if not. The pointer to the - * data is returned in pData. The reason is that there's no reason - * someone using the hash table might not want to have NULL data - */ -ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) -{ - ulong h; - uint nIndex; - Bucket *p; - - IS_CONSISTENT(ht); - - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); - - h = zend_inline_hash_func(arKey, nKeyLength); - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - *pData = p->pData; - return SUCCESS; - } - } - p = p->pNext; - } - return FAILURE; -} - - -ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) -{ - uint nIndex; - Bucket *p; - - if (nKeyLength==0) { - return zend_hash_index_find(ht, h, pData); - } - - IS_CONSISTENT(ht); - - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - *pData = p->pData; - return SUCCESS; - } - } - p = p->pNext; - } - return FAILURE; -} - - -ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) -{ - ulong h; - uint nIndex; - Bucket *p; - - IS_CONSISTENT(ht); - - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); - - h = zend_inline_hash_func(arKey, nKeyLength); - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - return 1; - } - } - p = p->pNext; - } - return 0; -} - - -ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h) -{ - uint nIndex; - Bucket *p; - - if (nKeyLength==0) { - return zend_hash_index_exists(ht, h); - } - - IS_CONSISTENT(ht); - - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); - - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - return 1; - } - } - p = p->pNext; - } - return 0; - -} - - -ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) -{ - uint nIndex; - Bucket *p; - - IS_CONSISTENT(ht); - - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == 0)) { - *pData = p->pData; - return SUCCESS; - } - p = p->pNext; - } - return FAILURE; -} - - -ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h) -{ - uint nIndex; - Bucket *p; - - IS_CONSISTENT(ht); - - nIndex = h & ht->nTableMask; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == 0)) { - return 1; - } - p = p->pNext; - } - return 0; -} - - -ZEND_API int zend_hash_num_elements(HashTable *ht) -{ - IS_CONSISTENT(ht); - - return ht->nNumOfElements; -} - - -ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos) -{ - IS_CONSISTENT(ht); - - if (pos) - *pos = ht->pListHead; - else - ht->pInternalPointer = ht->pListHead; -} - - -/* This function will be extremely optimized by remembering - * the end of the list - */ -ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos) -{ - IS_CONSISTENT(ht); - - if (pos) - *pos = ht->pListTail; - else - ht->pInternalPointer = ht->pListTail; -} - - -ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos) -{ - HashPosition *current = pos ? pos : &ht->pInternalPointer; - - IS_CONSISTENT(ht); - - if (*current) { - *current = (*current)->pListNext; - return SUCCESS; - } else - return FAILURE; -} - -ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) -{ - HashPosition *current = pos ? pos : &ht->pInternalPointer; - - IS_CONSISTENT(ht); - - if (*current) { - *current = (*current)->pListLast; - return SUCCESS; - } else - return FAILURE; -} - - -/* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) -{ - Bucket *p; - - p = pos ? (*pos) : ht->pInternalPointer; - - IS_CONSISTENT(ht); - - if (p) { - if (p->nKeyLength) { - if (duplicate) { - *str_index = estrndup(p->arKey, p->nKeyLength); - } else { - *str_index = p->arKey; - } - if (str_length) { - *str_length = p->nKeyLength; - } - return HASH_KEY_IS_STRING; - } else { - *num_index = p->h; - return HASH_KEY_IS_LONG; - } - } - return HASH_KEY_NON_EXISTANT; -} - - -ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos) -{ - Bucket *p; - - p = pos ? (*pos) : ht->pInternalPointer; - - IS_CONSISTENT(ht); - - if (p) { - if (p->nKeyLength) { - return HASH_KEY_IS_STRING; - } else { - return HASH_KEY_IS_LONG; - } - } - return HASH_KEY_NON_EXISTANT; -} - - -ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos) -{ - Bucket *p; - - p = pos ? (*pos) : ht->pInternalPointer; - - IS_CONSISTENT(ht); - - if (p) { - *pData = p->pData; - return SUCCESS; - } else { - return FAILURE; - } -} - - -ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, - compare_func_t compar, int renumber TSRMLS_DC) -{ - Bucket **arTmp; - Bucket *p; - int i, j; - - IS_CONSISTENT(ht); - - if (!(ht->nNumOfElements>1) && !(renumber && ht->nNumOfElements>0)) { /* Doesn't require sorting */ - return SUCCESS; - } - arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), ht->persistent); - if (!arTmp) { - return FAILURE; - } - p = ht->pListHead; - i = 0; - while (p) { - arTmp[i] = p; - p = p->pListNext; - i++; - } - - (*sort_func)((void *) arTmp, i, sizeof(Bucket *), compar TSRMLS_CC); - - HANDLE_BLOCK_INTERRUPTIONS(); - ht->pListHead = arTmp[0]; - ht->pListTail = NULL; - ht->pInternalPointer = ht->pListHead; - - for (j = 0; j < i; j++) { - if (ht->pListTail) { - ht->pListTail->pListNext = arTmp[j]; - } - arTmp[j]->pListLast = ht->pListTail; - arTmp[j]->pListNext = NULL; - ht->pListTail = arTmp[j]; - } - pefree(arTmp, ht->persistent); - HANDLE_UNBLOCK_INTERRUPTIONS(); - - if (renumber) { - p = ht->pListHead; - i=0; - while (p != NULL) { - p->nKeyLength = 0; - p->h = i++; - p = p->pListNext; - } - ht->nNextFreeElement = i; - zend_hash_rehash(ht); - } - return SUCCESS; -} - - -ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC) -{ - Bucket *p1, *p2; - int result; - void *pData2; - - IS_CONSISTENT(ht1); - IS_CONSISTENT(ht2); - - HASH_PROTECT_RECURSION(ht1); - HASH_PROTECT_RECURSION(ht2); - - result = ht1->nNumOfElements - ht2->nNumOfElements; - if (result!=0) { - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return result; - } - - p1 = ht1->pListHead; - if (ordered) { - p2 = ht2->pListHead; - } - - while (p1) { - if (ordered && !p2) { - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return 1; /* That's not supposed to happen */ - } - if (ordered) { - if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */ - result = p1->h - p2->h; - if (result!=0) { - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return result; - } - } else { /* string indices */ - result = p1->nKeyLength - p2->nKeyLength; - if (result!=0) { - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return result; - } - result = memcmp(p1->arKey, p2->arKey, p1->nKeyLength); - if (result!=0) { - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return result; - } - } - pData2 = p2->pData; - } else { - if (p1->nKeyLength==0) { /* numeric index */ - if (zend_hash_index_find(ht2, p1->h, &pData2)==FAILURE) { - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return 1; - } - } else { /* string index */ - if (zend_hash_find(ht2, p1->arKey, p1->nKeyLength, &pData2)==FAILURE) { - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return 1; - } - } - } - result = compar(p1->pData, pData2 TSRMLS_CC); - if (result!=0) { - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return result; - } - p1 = p1->pListNext; - if (ordered) { - p2 = p2->pListNext; - } - } - - HASH_UNPROTECT_RECURSION(ht1); - HASH_UNPROTECT_RECURSION(ht2); - return 0; -} - - -ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC) -{ - Bucket *p, *res; - - IS_CONSISTENT(ht); - - if (ht->nNumOfElements == 0 ) { - *pData=NULL; - return FAILURE; - } - - res = p = ht->pListHead; - while ((p = p->pListNext)) { - if (flag) { - if (compar(&res, &p TSRMLS_CC) < 0) { /* max */ - res = p; - } - } else { - if (compar(&res, &p TSRMLS_CC) > 0) { /* min */ - res = p; - } - } - } - *pData = res->pData; - return SUCCESS; -} - -ZEND_API ulong zend_hash_next_free_element(HashTable *ht) -{ - IS_CONSISTENT(ht); - - return ht->nNextFreeElement; - -} - - -#if ZEND_DEBUG -void zend_hash_display_pListTail(HashTable *ht) -{ - Bucket *p; - - p = ht->pListTail; - while (p != NULL) { - zend_output_debug_string(0, "pListTail has key %s\n", p->arKey); - p = p->pListLast; - } -} - -void zend_hash_display(HashTable *ht) -{ - Bucket *p; - uint i; - - for (i = 0; i < ht->nTableSize; i++) { - p = ht->arBuckets[i]; - while (p != NULL) { - zend_output_debug_string(0, "%s <==> 0x%X\n", p->arKey, p->h); - p = p->pNext; - } - } - - p = ht->pListTail; - while (p != NULL) { - zend_output_debug_string(0, "%s <==> 0x%X\n", p->arKey, p->h); - p = p->pListLast; - } -} -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h deleted file mode 100644 index 37a84cb956..0000000000 --- a/Zend/zend_hash.h +++ /dev/null @@ -1,290 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_HASH_H -#define ZEND_HASH_H - -#include -#include "zend.h" - -#define HASH_KEY_IS_STRING 1 -#define HASH_KEY_IS_LONG 2 -#define HASH_KEY_NON_EXISTANT 3 - -#define HASH_UPDATE (1<<0) -#define HASH_ADD (1<<1) -#define HASH_NEXT_INSERT (1<<2) - -#define HASH_DEL_KEY 0 -#define HASH_DEL_INDEX 1 - -typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength); -typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC); -typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC); -typedef void (*dtor_func_t)(void *pDest); -typedef void (*copy_ctor_func_t)(void *pElement); -typedef void (*copy_ctor_param_func_t)(void *pElement, void *pParam); - -struct _hashtable; - -typedef struct bucket { - ulong h; /* Used for numeric indexing */ - uint nKeyLength; - void *pData; - void *pDataPtr; - struct bucket *pListNext; - struct bucket *pListLast; - struct bucket *pNext; - struct bucket *pLast; - char arKey[1]; /* Must be last element */ -} Bucket; - -typedef struct _hashtable { - uint nTableSize; - uint nTableMask; - uint nNumOfElements; - ulong nNextFreeElement; - Bucket *pInternalPointer; /* Used for element traversal */ - Bucket *pListHead; - Bucket *pListTail; - Bucket **arBuckets; - dtor_func_t pDestructor; - zend_bool persistent; - unsigned char nApplyCount; - zend_bool bApplyProtection; -#if ZEND_DEBUG - int inconsistent; -#endif -} HashTable; - - -typedef struct _zend_hash_key { - char *arKey; - uint nKeyLength; - ulong h; -} zend_hash_key; - - -typedef zend_bool (*merge_checker_func_t)(HashTable *target_ht, void *source_data, zend_hash_key *hash_key, void *pParam); - -typedef Bucket* HashPosition; - -BEGIN_EXTERN_C() - -/* startup/shutdown */ -ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC); -ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC); -ZEND_API void zend_hash_destroy(HashTable *ht); -ZEND_API void zend_hash_clean(HashTable *ht); -#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pHashFunction), (pDestructor), (persistent) ZEND_FILE_LINE_CC) -#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pHashFunction), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC) - -/* additions/updates/changes */ -ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag); -#define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ - zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE) -#define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ - zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD) - -ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag); -#define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ - zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE) -#define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ - zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD) - -ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag); -#define zend_hash_index_update(ht, h, pData, nDataSize, pDest) \ - zend_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE) -#define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \ - zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT) - -ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength); - - -#define ZEND_HASH_APPLY_KEEP 0 -#define ZEND_HASH_APPLY_REMOVE 1<<0 -#define ZEND_HASH_APPLY_STOP 1<<1 - - -typedef int (*apply_func_t)(void *pDest TSRMLS_DC); -typedef int (*apply_func_arg_t)(void *pDest, void *argument TSRMLS_DC); -typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list args, zend_hash_key *hash_key); - -ZEND_API void zend_hash_graceful_destroy(HashTable *ht); -ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht); -ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC); -ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC); -ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...); - -/* This function should be used with special care (in other words, - * it should usually not be used). When used with the ZEND_HASH_APPLY_STOP - * return value, it assumes things about the order of the elements in the hash. - * Also, it does not provide the same kind of reentrancy protection that - * the standard apply functions do. - */ -ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC); - - -/* Deletes */ -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag); -#define zend_hash_del(ht, arKey, nKeyLength) \ - zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY) -#define zend_hash_index_del(ht, h) \ - zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX) - -ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength); - -/* Data retreival */ -ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData); -ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData); -ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData); - -/* Misc */ -ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength); -ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h); -ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h); -ZEND_API ulong zend_hash_next_free_element(HashTable *ht); - -/* traversing */ -ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos); -ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); -ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); - -#define zend_hash_move_forward(ht) \ - zend_hash_move_forward_ex(ht, NULL) -#define zend_hash_move_backwards(ht) \ - zend_hash_move_backwards_ex(ht, NULL) -#define zend_hash_get_current_key(ht, str_index, num_index, duplicate) \ - zend_hash_get_current_key_ex(ht, str_index, NULL, num_index, duplicate, NULL) -#define zend_hash_get_current_key_type(ht) \ - zend_hash_get_current_key_type_ex(ht, NULL) -#define zend_hash_get_current_data(ht, pData) \ - zend_hash_get_current_data_ex(ht, pData, NULL) -#define zend_hash_internal_pointer_reset(ht) \ - zend_hash_internal_pointer_reset_ex(ht, NULL) -#define zend_hash_internal_pointer_end(ht) \ - zend_hash_internal_pointer_end_ex(ht, NULL) - -/* Copying, merging and sorting */ -ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size); -ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite); -ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam); -ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC); -ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC); -ZEND_API int zend_hash_minmax(HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC); - -ZEND_API int zend_hash_num_elements(HashTable *ht); - -ZEND_API int zend_hash_rehash(HashTable *ht); - -/* - * DJBX33A (Daniel J. Bernstein, Times 33 with Addition) - * - * This is Daniel J. Bernstein's popular `times 33' hash function as - * posted by him years ago on comp.lang.c. It basically uses a function - * like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best - * known hash functions for strings. Because it is both computed very - * fast and distributes very well. - * - * The magic of number 33, i.e. why it works better than many other - * constants, prime or not, has never been adequately explained by - * anyone. So I try an explanation: if one experimentally tests all - * multipliers between 1 and 256 (as RSE did now) one detects that even - * numbers are not useable at all. The remaining 128 odd numbers - * (except for the number 1) work more or less all equally well. They - * all distribute in an acceptable way and this way fill a hash table - * with an average percent of approx. 86%. - * - * If one compares the Chi^2 values of the variants, the number 33 not - * even has the best value. But the number 33 and a few other equally - * good numbers like 17, 31, 63, 127 and 129 have nevertheless a great - * advantage to the remaining numbers in the large set of possible - * multipliers: their multiply operation can be replaced by a faster - * operation based on just one shift plus either a single addition - * or subtraction operation. And because a hash function has to both - * distribute good _and_ has to be very fast to compute, those few - * numbers should be preferred and seems to be the reason why Daniel J. - * Bernstein also preferred it. - * - * - * -- Ralf S. Engelschall - */ - -static inline ulong zend_inline_hash_func(char *arKey, uint nKeyLength) -{ - register ulong hash = 5381; - - /* variant with the hash unrolled eight times */ - for (; nKeyLength >= 8; nKeyLength -= 8) { - hash = ((hash << 5) + hash) + *arKey++; - hash = ((hash << 5) + hash) + *arKey++; - hash = ((hash << 5) + hash) + *arKey++; - hash = ((hash << 5) + hash) + *arKey++; - hash = ((hash << 5) + hash) + *arKey++; - hash = ((hash << 5) + hash) + *arKey++; - hash = ((hash << 5) + hash) + *arKey++; - hash = ((hash << 5) + hash) + *arKey++; - } - switch (nKeyLength) { - case 7: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ - case 6: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ - case 5: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ - case 4: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ - case 3: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ - case 2: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ - case 1: hash = ((hash << 5) + hash) + *arKey++; break; - case 0: break; -EMPTY_SWITCH_DEFAULT_CASE() - } - return hash; -} - - -ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength); - -#if ZEND_DEBUG -/* debug */ -void zend_hash_display_pListTail(HashTable *ht); -void zend_hash_display(HashTable *ht); -#endif - -END_EXTERN_C() - -#define ZEND_INIT_SYMTABLE(ht) \ - ZEND_INIT_SYMTABLE_EX(ht, 2, 0) - -#define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \ - zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent) - - -#endif /* ZEND_HASH_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c deleted file mode 100644 index 586c1ab64d..0000000000 --- a/Zend/zend_highlight.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_language_parser.h" -#include "zend_compile.h" -#include "zend_highlight.h" -#include "zend_ptr_stack.h" -#include "zend_globals.h" - -ZEND_API void zend_html_putc(char c) -{ - switch (c) { - case '\n': - ZEND_PUTS("
"); - break; - case '<': - ZEND_PUTS("<"); - break; - case '>': - ZEND_PUTS(">"); - break; - case '&': - ZEND_PUTS("&"); - break; - case ' ': - ZEND_PUTS(" "); - break; - case '\t': - ZEND_PUTS("    "); - break; - default: - ZEND_PUTC(c); - break; - } -} - - -ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) -{ - const char *ptr=s, *end=s+len; - - while (ptrhighlight_html; - char *next_color; - int in_string=0; - - zend_printf(""); - zend_printf("\n", last_color); - /* highlight stuff coming back from zendlex() */ - token.type = 0; - while ((token_type=lex_scan(&token TSRMLS_CC))) { - switch (token_type) { - case T_INLINE_HTML: - next_color = syntax_highlighter_ini->highlight_html; - break; - case T_COMMENT: - case T_DOC_COMMENT: - next_color = syntax_highlighter_ini->highlight_comment; - break; - case T_OPEN_TAG: - case T_OPEN_TAG_WITH_ECHO: - next_color = syntax_highlighter_ini->highlight_default; - break; - case T_CLOSE_TAG: - next_color = syntax_highlighter_ini->highlight_default; - break; - case T_CONSTANT_ENCAPSED_STRING: - next_color = syntax_highlighter_ini->highlight_string; - break; - case '"': - next_color = syntax_highlighter_ini->highlight_string; - in_string = !in_string; - break; - case T_WHITESPACE: - zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */ - token.type = 0; - continue; - break; - default: - if (token.type==0) { - next_color = syntax_highlighter_ini->highlight_keyword; - } else { - if (in_string) { - next_color = syntax_highlighter_ini->highlight_string; - } else { - next_color = syntax_highlighter_ini->highlight_default; - } - } - break; - } - - if (last_color != next_color) { - if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf(""); - } - last_color = next_color; - if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf("", last_color); - } - } - switch (token_type) { - case T_END_HEREDOC: - zend_html_puts(token.value.str.val, token.value.str.len TSRMLS_CC); - break; - default: - zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); - break; - } - - if (token.type == IS_STRING) { - switch (token_type) { - case T_OPEN_TAG: - case T_OPEN_TAG_WITH_ECHO: - case T_CLOSE_TAG: - case T_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT: - break; - default: - efree(token.value.str.val); - break; - } - } else if (token_type == T_END_HEREDOC) { - zend_bool has_semicolon=(strchr(token.value.str.val, ';')?1:0); - - efree(token.value.str.val); - if (has_semicolon) { - /* the following semicolon was unput(), ignore it */ - lex_scan(&token TSRMLS_CC); - } - } - token.type = 0; - } - if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf("\n"); - } - zend_printf("\n"); - zend_printf(""); -} - - - -ZEND_API void zend_strip(TSRMLS_D) -{ - zval token; - int token_type; - int prev_space = 0; - - token.type = 0; - while ((token_type=lex_scan(&token TSRMLS_CC))) { - switch (token_type) { - case T_WHITESPACE: - if (!prev_space) { - putchar(' '); - prev_space = 1; - } - /* lack of break; is intentional */ - case T_COMMENT: - case T_DOC_COMMENT: - token.type = 0; - continue; - - case T_END_HEREDOC: { - char *ptr = LANG_SCNG(yy_text); - - fwrite(ptr, LANG_SCNG(yy_leng) - 1, 1, stdout); - /* The ensure that we only write one ; and that it followed by the required newline */ - putchar('\n'); - if (ptr[LANG_SCNG(yy_leng) - 1] == ';') { - lex_scan(&token TSRMLS_CC); - } - efree(token.value.str.val); - } - break; - - default: - fwrite(LANG_SCNG(yy_text), LANG_SCNG(yy_leng), 1, stdout); - break; - } - - if (token.type == IS_STRING) { - switch (token_type) { - case T_OPEN_TAG: - case T_OPEN_TAG_WITH_ECHO: - case T_CLOSE_TAG: - case T_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT: - break; - - default: - efree(token.value.str.val); - break; - } - } - prev_space = token.type = 0; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ - diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h deleted file mode 100644 index 807270049e..0000000000 --- a/Zend/zend_highlight.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_HIGHLIGHT_H -#define ZEND_HIGHLIGHT_H - -#define HL_COMMENT_COLOR "#FF8000" /* orange */ -#define HL_DEFAULT_COLOR "#0000BB" /* blue */ -#define HL_HTML_COLOR "#000000" /* black */ -#define HL_STRING_COLOR "#DD0000" /* red */ -#define HL_BG_COLOR "#FFFFFF" /* white */ -#define HL_KEYWORD_COLOR "#007700" /* green */ - - -typedef struct _zend_syntax_highlighter_ini { - char *highlight_html; - char *highlight_comment; - char *highlight_default; - char *highlight_string; - char *highlight_keyword; -} zend_syntax_highlighter_ini; - - -BEGIN_EXTERN_C() -ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC); -ZEND_API void zend_strip(TSRMLS_D); -ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC); -ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC); -ZEND_API void zend_html_putc(char c); -ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC); -END_EXTERN_C() - -extern zend_syntax_highlighter_ini syntax_highlighter_ini; - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c deleted file mode 100644 index d036bfdfeb..0000000000 --- a/Zend/zend_indent.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -/* This indenter doesn't really work, it's here for no particular reason. */ - - -#include "zend.h" -#include "zend_language_parser.h" -#include "zend_compile.h" -#include "zend_indent.h" - -#define zendtext LANG_SCNG(yy_text) -#define zendleng LANG_SCNG(yy_leng) - - -static void handle_whitespace(int *emit_whitespace) -{ - unsigned char c; - int i; - - for (c=0; c<128; c++) { - if (emit_whitespace[c]>0) { - for (i=0; i0) { - ZEND_PUTS(" {\n"); - memset(emit_whitespace, 0, sizeof(int)*256); - } else { - ZEND_PUTS("{"); - } - break; - case '}': - nest_level--; - if (emit_whitespace['\n']==0) { - ZEND_PUTS("\n"); - } - for (i=0; i0) { - for (i=0; i | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_INDENT_H -#define ZEND_INDENT_H - -ZEND_API void zend_indent(void); - -#endif /* ZEND_INDENT_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c deleted file mode 100644 index 3828adb863..0000000000 --- a/Zend/zend_ini.c +++ /dev/null @@ -1,524 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_qsort.h" -#include "zend_API.h" -#include "zend_ini.h" -#include "zend_alloc.h" -#include "zend_operators.h" - -static HashTable *registered_zend_ini_directives; - -#define NO_VALUE_PLAINTEXT "no value" -#define NO_VALUE_HTML "no value" - -/* - * hash_apply functions - */ -static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC) -{ - if (ini_entry->module_number == *module_number) { - return 1; - } else { - return 0; - } -} - - -static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC) -{ - if (ini_entry->modified) { - if (ini_entry->on_modify) { - ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC); - } - efree(ini_entry->value); - ini_entry->value = ini_entry->orig_value; - ini_entry->value_length = ini_entry->orig_value_length; - ini_entry->modified = 0; - ini_entry->orig_value = NULL; - ini_entry->orig_value_length = 0; - } - return 0; -} - -/* - * Startup / shutdown - */ -ZEND_API int zend_ini_startup(TSRMLS_D) -{ - registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable)); - - EG(ini_directives) = registered_zend_ini_directives; - if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0)==FAILURE) { - return FAILURE; - } - return SUCCESS; -} - - -ZEND_API int zend_ini_shutdown(TSRMLS_D) -{ - zend_hash_destroy(EG(ini_directives)); - free(EG(ini_directives)); - return SUCCESS; -} - - -ZEND_API int zend_ini_global_shutdown(TSRMLS_D) -{ - zend_hash_destroy(registered_zend_ini_directives); - free(registered_zend_ini_directives); - return SUCCESS; -} - - -ZEND_API int zend_ini_deactivate(TSRMLS_D) -{ - zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC); - return SUCCESS; -} - - -#ifdef ZTS -ZEND_API int zend_copy_ini_directives(TSRMLS_D) -{ - zend_ini_entry ini_entry; - - EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable)); - if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) { - return FAILURE; - } - zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry)); - zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC); - return SUCCESS; -} -#endif - - -static int ini_key_compare(const void *a, const void *b TSRMLS_DC) -{ - Bucket *f; - Bucket *s; - - f = *((Bucket **) a); - s = *((Bucket **) b); - - if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */ - return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength); - } else if (f->nKeyLength==0) { /* f is numeric, s is not */ - return -1; - } else if (s->nKeyLength==0) { /* s is numeric, f is not */ - return 1; - } else { /* both strings */ - return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength); - } -} - - -ZEND_API void zend_ini_sort_entries(TSRMLS_D) -{ - zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC); -} - -/* - * Registration / unregistration - */ - -ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC) -{ - zend_ini_entry *p = ini_entry; - zend_ini_entry *hashed_ini_entry; - zval default_value; - - while (p->name) { - p->module_number = module_number; - if (zend_hash_add(registered_zend_ini_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) { - zend_unregister_ini_entries(module_number TSRMLS_CC); - return FAILURE; - } - if ((zend_get_configuration_directive(p->name, p->name_length, &default_value))==SUCCESS) { - if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) { - hashed_ini_entry->value = default_value.value.str.val; - hashed_ini_entry->value_length = default_value.value.str.len; - } - } else { - if (hashed_ini_entry->on_modify) { - hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC); - } - } - p++; - } - return SUCCESS; -} - - -ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC) -{ - zend_hash_apply_with_argument(registered_zend_ini_directives, (apply_func_arg_t) zend_remove_ini_entries, (void *) &module_number TSRMLS_CC); -} - - -static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) -{ - if (p->on_modify) { - p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC); - } - return 0; -} - - -ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) -{ - zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC); -} - - -ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) -{ - zend_ini_entry *ini_entry; - char *duplicate; - TSRMLS_FETCH(); - - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - if (!(ini_entry->modifyable & modify_type)) { - return FAILURE; - } - - duplicate = estrndup(new_value, new_value_length); - - if (!ini_entry->on_modify - || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC)==SUCCESS) { - if (!ini_entry->modified) { - ini_entry->orig_value = ini_entry->value; - ini_entry->orig_value_length = ini_entry->value_length; - } else { /* we already changed the value, free the changed value */ - efree(ini_entry->value); - } - ini_entry->value = duplicate; - ini_entry->value_length = new_value_length; - ini_entry->modified = 1; - } else { - efree(duplicate); - } - - return SUCCESS; -} - - -ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) -{ - zend_ini_entry *ini_entry; - TSRMLS_FETCH(); - - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC); - return SUCCESS; -} - - -ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) -{ - zend_ini_entry *ini_entry; - - if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - ini_entry->displayer = displayer; - return SUCCESS; -} - - - -/* - * Data retrieval - */ - -ZEND_API long zend_ini_long(char *name, uint name_length, int orig) -{ - zend_ini_entry *ini_entry; - TSRMLS_FETCH(); - - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0); - } else if (ini_entry->value) { - return strtol(ini_entry->value, NULL, 0); - } - } - - return 0; -} - - -ZEND_API double zend_ini_double(char *name, uint name_length, int orig) -{ - zend_ini_entry *ini_entry; - TSRMLS_FETCH(); - - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0); - } else if (ini_entry->value) { - return (double) strtod(ini_entry->value, NULL); - } - } - - return 0.0; -} - - -ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) -{ - zend_ini_entry *ini_entry; - TSRMLS_FETCH(); - - if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return ini_entry->orig_value; - } else { - return ini_entry->value; - } - } - - return ""; -} - - -static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) -{ - if (ini_entry->displayer) { - ini_entry->displayer(ini_entry, type); - } else { - char *display_string; - uint display_string_length; - - if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - if (ini_entry->orig_value) { - display_string = ini_entry->orig_value; - display_string_length = ini_entry->orig_value_length; - } else { - if (zend_uv.html_errors) { - display_string = NO_VALUE_HTML; - display_string_length = sizeof(NO_VALUE_HTML)-1; - } else { - display_string = NO_VALUE_PLAINTEXT; - display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1; - } - } - } else if (ini_entry->value && ini_entry->value[0]) { - display_string = ini_entry->value; - display_string_length = ini_entry->value_length; - } else { - if (zend_uv.html_errors) { - display_string = NO_VALUE_HTML; - display_string_length = sizeof(NO_VALUE_HTML)-1; - } else { - display_string = NO_VALUE_PLAINTEXT; - display_string_length = sizeof(NO_VALUE_PLAINTEXT)-1; - } - } - ZEND_WRITE(display_string, display_string_length); - } -} - - -ZEND_INI_DISP(zend_ini_boolean_displayer_cb) -{ - int value; - - if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0); - } else if (ini_entry->value) { - value = atoi(ini_entry->value); - } else { - value = 0; - } - if (value) { - ZEND_PUTS("On"); - } else { - ZEND_PUTS("Off"); - } -} - - -ZEND_INI_DISP(zend_ini_color_displayer_cb) -{ - char *value; - - if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value; - } else if (ini_entry->value) { - value = ini_entry->value; - } else { - value = NULL; - } - if (value) { - if (zend_uv.html_errors) { - zend_printf("%s", value, value); - } else { - ZEND_PUTS(value); - } - } else { - if (zend_uv.html_errors) { - ZEND_PUTS(NO_VALUE_HTML); - } else { - ZEND_PUTS(NO_VALUE_PLAINTEXT); - } - } -} - - -ZEND_INI_DISP(display_link_numbers) -{ - char *value; - - if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value; - } else if (ini_entry->value) { - value = ini_entry->value; - } else { - value = NULL; - } - - if (value) { - if (atoi(value)==-1) { - ZEND_PUTS("Unlimited"); - } else { - zend_printf("%s", value); - } - } -} - - -/* Standard message handlers */ - -ZEND_API ZEND_INI_MH(OnUpdateBool) -{ - zend_bool *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (zend_bool *) (base+(size_t) mh_arg1); - - if (strncasecmp("on", new_value, sizeof("on"))) { - *p = (zend_bool) atoi(new_value); - } else { - *p = (zend_bool) 1; - } - return SUCCESS; -} - - -ZEND_API ZEND_INI_MH(OnUpdateLong) -{ - long *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (long *) (base+(size_t) mh_arg1); - - *p = zend_atoi(new_value, new_value_length); - return SUCCESS; -} - - -ZEND_API ZEND_INI_MH(OnUpdateReal) -{ - double *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (double *) (base+(size_t) mh_arg1); - - *p = strtod(new_value, NULL); - return SUCCESS; -} - - -ZEND_API ZEND_INI_MH(OnUpdateString) -{ - char **p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (char **) (base+(size_t) mh_arg1); - - *p = new_value; - return SUCCESS; -} - - -ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) -{ - char **p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - if (new_value && !new_value[0]) { - return FAILURE; - } - - p = (char **) (base+(size_t) mh_arg1); - - *p = new_value; - return SUCCESS; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h deleted file mode 100644 index 5502bf9460..0000000000 --- a/Zend/zend_ini.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_INI_H -#define ZEND_INI_H - -#define ZEND_INI_USER (1<<0) -#define ZEND_INI_PERDIR (1<<1) -#define ZEND_INI_SYSTEM (1<<2) - -#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM) - -#ifndef XtOffsetOf -# if defined(CRAY) || (defined(__arm) && !defined(LINUX)) -# ifdef __STDC__ -# define XtOffset(p_type, field) _Offsetof(p_type, field) -# else -# ifdef CRAY2 -# define XtOffset(p_type, field) \ - (sizeof(int)*((unsigned int)&(((p_type)NULL)->field))) - -# else /* !CRAY2 */ - -# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field)) - -# endif /* !CRAY2 */ -# endif /* __STDC__ */ -# else /* ! (CRAY || __arm) */ - -# define XtOffset(p_type, field) \ - ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) - -# endif /* !CRAY */ - -# ifdef offsetof -# define XtOffsetOf(s_type, field) offsetof(s_type, field) -# else -# define XtOffsetOf(s_type, field) XtOffset(s_type*, field) -# endif - -#endif - -typedef struct _zend_ini_entry zend_ini_entry; - -#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC) -#define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type) - -struct _zend_ini_entry { - int module_number; - int modifyable; - char *name; - uint name_length; - ZEND_INI_MH((*on_modify)); - void *mh_arg1; - void *mh_arg2; - void *mh_arg3; - - char *value; - uint value_length; - - char *orig_value; - uint orig_value_length; - int modified; - - void (*displayer)(zend_ini_entry *ini_entry, int type); -}; - - -ZEND_API int zend_ini_startup(TSRMLS_D); -ZEND_API int zend_ini_shutdown(TSRMLS_D); -ZEND_API int zend_ini_global_shutdown(TSRMLS_D); -ZEND_API int zend_ini_deactivate(TSRMLS_D); - -ZEND_API int zend_copy_ini_directives(TSRMLS_D); - -ZEND_API void zend_ini_sort_entries(TSRMLS_D); - -ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number TSRMLS_DC); -ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC); -ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC); -ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage); -ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage); -ZEND_API void display_ini_entries(zend_module_entry *module); - -ZEND_API long zend_ini_long(char *name, uint name_length, int orig); -ZEND_API double zend_ini_double(char *name, uint name_length, int orig); -ZEND_API char *zend_ini_string(char *name, uint name_length, int orig); - -ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); - -ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb); -ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb); -ZEND_API ZEND_INI_DISP(display_link_numbers); - -#define ZEND_INI_BEGIN() static zend_ini_entry ini_entries[] = { -#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } }; - -#define ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \ - { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer }, - -#define ZEND_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \ - ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL) - -#define ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \ - ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer) - -#define ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \ - ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL) - -#define ZEND_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \ - ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer) - -#define ZEND_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \ - ZEND_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL) - -#define ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \ - ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer) - -#define ZEND_INI_ENTRY(name, default_value, modifyable, on_modify) \ - ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL) - -#ifdef ZTS -#define STD_ZEND_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id) -#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \ - ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer) -#define STD_ZEND_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb) -#else -#define STD_ZEND_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - ZEND_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr) -#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \ - ZEND_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer) -#define STD_ZEND_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - ZEND_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb) -#endif - -#define INI_INT(name) zend_ini_long((name), sizeof(name), 0) -#define INI_FLT(name) zend_ini_double((name), sizeof(name), 0) -#define INI_STR(name) zend_ini_string((name), sizeof(name), 0) -#define INI_BOOL(name) ((zend_bool) INI_INT(name)) - -#define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name), 1) -#define INI_ORIG_FLT(name) zend_ini_double((name), sizeof(name), 1) -#define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name), 1) -#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name)) - - -#define REGISTER_INI_ENTRIES() zend_register_ini_entries(ini_entries, module_number TSRMLS_CC) -#define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries(module_number TSRMLS_CC) -#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module) - -#define REGISTER_INI_DISPLAYER(name, displayer) zend_ini_register_displayer((name), sizeof(name), displayer) -#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, zend_ini_boolean_displayer_cb) - -/* Standard message handlers */ -ZEND_API ZEND_INI_MH(OnUpdateBool); -ZEND_API ZEND_INI_MH(OnUpdateLong); -ZEND_API ZEND_INI_MH(OnUpdateReal); -ZEND_API ZEND_INI_MH(OnUpdateString); -ZEND_API ZEND_INI_MH(OnUpdateStringUnempty); - - -#define ZEND_INI_DISPLAY_ORIG 1 -#define ZEND_INI_DISPLAY_ACTIVE 2 - -#define ZEND_INI_STAGE_STARTUP (1<<0) -#define ZEND_INI_STAGE_SHUTDOWN (1<<1) -#define ZEND_INI_STAGE_ACTIVATE (1<<2) -#define ZEND_INI_STAGE_DEACTIVATE (1<<3) -#define ZEND_INI_STAGE_RUNTIME (1<<4) - -/* INI parsing engine */ -typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg); -int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg); -#define ZEND_INI_PARSER_ENTRY 1 -#define ZEND_INI_PARSER_SECTION 2 -#define ZEND_INI_PARSER_POP_ENTRY 3 - -typedef struct _zend_ini_parser_param { - zend_ini_parser_cb_t ini_parser_cb; - void *arg; -} zend_ini_parser_param; - -#endif /* ZEND_INI_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y deleted file mode 100644 index 0f9e4d7ba4..0000000000 --- a/Zend/zend_ini_parser.y +++ /dev/null @@ -1,238 +0,0 @@ -%{ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998-2002 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#define DEBUG_CFG_PARSER 0 -#include "zend.h" -#include "zend_API.h" -#include "zend_ini.h" -#include "zend_constants.h" -#include "zend_ini_scanner.h" -#include "zend_extensions.h" - -#define YYSTYPE zval - -#ifdef ZTS -#define YYPARSE_PARAM tsrm_ls -#define YYLEX_PARAM tsrm_ls -#endif - -#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb -#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg - -int ini_lex(zval *ini_lval TSRMLS_DC); -#ifdef ZTS -int ini_parse(void *arg); -#else -int ini_parse(void); -#endif - -zval yylval; - -#ifndef ZTS -extern int ini_lex(zval *ini_lval TSRMLS_DC); -extern FILE *ini_in; -extern void init_cfg_scanner(void); -#endif - -void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) -{ - int i_result; - int i_op1, i_op2; - char str_result[MAX_LENGTH_OF_LONG]; - - i_op1 = atoi(op1->value.str.val); - free(op1->value.str.val); - if (op2) { - i_op2 = atoi(op2->value.str.val); - free(op2->value.str.val); - } else { - i_op2 = 0; - } - - switch (type) { - case '|': - i_result = i_op1 | i_op2; - break; - case '&': - i_result = i_op1 & i_op2; - break; - case '~': - i_result = ~i_op1; - break; - case '!': - i_result = !i_op1; - break; - default: - i_result = 0; - break; - } - - result->value.str.len = zend_sprintf(str_result, "%d", i_result); - result->value.str.val = (char *) malloc(result->value.str.len+1); - memcpy(result->value.str.val, str_result, result->value.str.len); - result->value.str.val[result->value.str.len] = 0; - result->type = IS_STRING; -} - - -void zend_ini_get_constant(zval *result, zval *name) -{ - zval z_constant; - TSRMLS_FETCH(); - - if (zend_get_constant(name->value.str.val, name->value.str.len, &z_constant TSRMLS_CC)) { - /* z_constant is emalloc()'d */ - convert_to_string(&z_constant); - result->value.str.val = zend_strndup(z_constant.value.str.val, z_constant.value.str.len); - result->value.str.len = z_constant.value.str.len; - result->type = z_constant.type; - zval_dtor(&z_constant); - free(name->value.str.val); - } else { - *result = *name; - } -} - - -static void ini_error(char *str) -{ - char *error_buf; - int error_buf_len; - char *currently_parsed_filename; - TSRMLS_FETCH(); - - currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C); - error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */ - error_buf = (char *) emalloc(error_buf_len); - - sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); - - if (CG(ini_parser_unbuffered_errors)) { -#ifdef PHP_WIN32 - MessageBox(NULL, error_buf, "PHP Error", MB_OK|MB_TOPMOST|0x00200000L); -#else - fprintf(stderr, "PHP: %s", error_buf); -#endif - } else { - zend_error(E_WARNING, error_buf); - } - efree(error_buf); -} - - -int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg) -{ - int retval; - zend_ini_parser_param ini_parser_param; - TSRMLS_FETCH(); - - ini_parser_param.ini_parser_cb = ini_parser_cb; - ini_parser_param.arg = arg; - - CG(ini_parser_param) = &ini_parser_param; - if (zend_ini_open_file_for_scanning(fh TSRMLS_CC)==FAILURE) { - return FAILURE; - } - - CG(ini_parser_unbuffered_errors) = unbuffered_errors; - retval = ini_parse(TSRMLS_C); - - zend_ini_close_file(fh TSRMLS_CC); - - if (retval==0) { - return SUCCESS; - } else { - return FAILURE; - } -} - - -%} - -%pure_parser -%token TC_STRING -%token TC_ENCAPSULATED_STRING -%token BRACK -%token SECTION -%token CFG_TRUE -%token CFG_FALSE -%left '|' '&' -%right '~' '!' - -%% - -statement_list: - statement_list statement - | /* empty */ -; - -statement: - TC_STRING '=' string_or_value { -#if DEBUG_CFG_PARSER - printf("'%s' = '%s'\n", $1.value.str.val, $3.value.str.val); -#endif - ZEND_INI_PARSER_CB(&$1, &$3, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); - free($1.value.str.val); - free($3.value.str.val); - } - | TC_STRING BRACK '=' string_or_value { -#if DEBUG_CFG_PARSER - printf("'%s'[ ] = '%s'\n", $1.value.str.val, $4.value.str.val); -#endif - ZEND_INI_PARSER_CB(&$1, &$4, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG); - free($1.value.str.val); - free($4.value.str.val); - } - | TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free($1.value.str.val); } - | SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free($1.value.str.val); } - | '\n' -; - - -string_or_value: - expr { $$ = $1; } - | TC_ENCAPSULATED_STRING { $$ = $1; } - | CFG_TRUE { $$ = $1; } - | CFG_FALSE { $$ = $1; } - | '\n' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; } - | '\0' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; } -; - -expr: - constant_string { $$ = $1; } - | expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); } - | expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); } - | '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); } - | '!' expr { zend_ini_do_op('!', &$$, &$2, NULL); } - | '(' expr ')' { $$ = $2; } -; - -constant_string: - TC_STRING { zend_ini_get_constant(&$$, &$1); } -; - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h deleted file mode 100644 index ab55393a7f..0000000000 --- a/Zend/zend_ini_scanner.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef _ZEND_INI_SCANNER_H -#define _ZEND_INI_SCANNER_H - -BEGIN_EXTERN_C() -int zend_ini_scanner_get_lineno(TSRMLS_D); -char *zend_ini_scanner_get_filename(TSRMLS_D); -int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC); -void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC); -int ini_lex(zval *ini_lval TSRMLS_DC); -END_EXTERN_C() - -#endif /* _ZEND_INI_SCANNER_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l deleted file mode 100644 index fb85c101ff..0000000000 --- a/Zend/zend_ini_scanner.l +++ /dev/null @@ -1,226 +0,0 @@ -%{ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998-2002 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#define yyleng SCNG(yy_leng) -#define yytext SCNG(yy_text) -#define yytext_ptr SCNG(yy_text) -#define yyin SCNG(yy_in) -#define yyout SCNG(yy_out) -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#define yy_more_flag SCNG(_yy_more_flag) -#define yy_more_len SCNG(_yy_more_len) - -#include -#include "zend.h" -#include "zend_globals.h" -#include "zend_ini_parser.h" -#include "zend_ini_scanner.h" - -#undef YYSTYPE -#define YYSTYPE zval - -#define YY_DECL int ini_lex(zval *ini_lval TSRMLS_DC) - -/* Globals Macros */ -#define SCNG INI_SCNG -#ifdef ZTS -ZEND_API ts_rsrc_id ini_scanner_globals_id; -#else -ZEND_API zend_scanner_globals ini_scanner_globals; -#endif - - -static char *ini_filename; - -void init_ini_scanner(TSRMLS_D) -{ - SCNG(lineno)=1; -} - - -int zend_ini_scanner_get_lineno(TSRMLS_D) -{ - return SCNG(lineno); -} - - -char *zend_ini_scanner_get_filename(TSRMLS_D) -{ - return ini_filename; -} - - -int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC) -{ - if (FAILURE == zend_stream_fixup(fh TSRMLS_CC)) { - return FAILURE; - } - - init_ini_scanner(TSRMLS_C); - yyin = fh; - yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC); - ini_filename = fh->filename; - return SUCCESS; -} - - -void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC) -{ - zend_stream_close(fh); -} - -%} - -NEWLINE ("\r"|"\n"|"\r\n") - -%option noyywrap -%option never-interactive - -%% - -[ ]*[\[][ ]*[\]][ ]* { - return BRACK; -} - -[ ]*("true"|"on"|"yes")[ ]* { - ini_lval->value.str.val = zend_strndup("1", 1); - ini_lval->value.str.len = 1; - ini_lval->type = IS_STRING; - return CFG_TRUE; -} - - -[ ]*("false"|"off"|"no"|"none")[ ]* { - ini_lval->value.str.val = zend_strndup("", 0); - ini_lval->value.str.len = 0; - ini_lval->type = IS_STRING; - return CFG_FALSE; -} - -[[][^[]+[\]][ ]*{NEWLINE}? { - /* SECTION */ - - /* eat trailng and spaces ] */ - while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']' || yytext[yyleng-1]==' ')) { - yyleng--; - yytext[yyleng]=0; - } - - SCNG(lineno)++; - - /* eat leading [ */ - yytext++; - yyleng--; - - ini_lval->value.str.val = zend_strndup(yytext, yyleng); - ini_lval->value.str.len = yyleng; - ini_lval->type = IS_STRING; - return SECTION; -} - - -["][^"]*["] { - /* ENCAPSULATED TC_STRING */ - - /* eat trailing " */ - yytext[yyleng-1]=0; - - /* eat leading " */ - yytext++; - - ini_lval->value.str.val = zend_strndup(yytext, yyleng - 2); - ini_lval->value.str.len = yyleng - 2; - ini_lval->type = IS_STRING; - return TC_ENCAPSULATED_STRING; -} - -[&|~()!] { - return yytext[0]; -} - - -[^=\n\r\t;|&~()!"\[]+ { - /* STRING */ - register int i; - - /* eat trailing whitespace */ - for (i=yyleng-1; i>=0; i--) { - if (yytext[i]==' ' || yytext[i]=='\t') { - yytext[i]=0; - yyleng--; - } else { - break; - } - } - /* eat leading whitespace */ - while (yytext[0]) { - if (yytext[0]==' ' || yytext[0]=='\t') { - yytext++; - yyleng--; - } else { - break; - } - } - if (yyleng!=0) { - ini_lval->value.str.val = zend_strndup(yytext, yyleng); - ini_lval->value.str.len = yyleng; - ini_lval->type = IS_STRING; - return TC_STRING; - } else { - /* whitespace */ - } -} - - - -[=\n] { - if (yytext[0] == '\n') { - SCNG(lineno)++; - } - return yytext[0]; -} - -{NEWLINE} { - SCNG(lineno)++; - return '\n'; -} - -[;][^\r\n]*{NEWLINE}? { - /* comment */ - SCNG(lineno)++; - return '\n'; -} - -[ \t] { - /* eat whitespace */ -} - -. { -#if DEBUG - php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n", yylineno, yytext, yytext[0]); -#endif -} - -<> { - yy_delete_buffer(YY_CURRENT_BUFFER TSRMLS_CC); - yyterminate(); -} diff --git a/Zend/zend_istdiostream.h b/Zend/zend_istdiostream.h deleted file mode 100644 index b4dc9a8db7..0000000000 --- a/Zend/zend_istdiostream.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef _ZEND_STDIOSTREAM -#define _ZEND_STDIOSTREAM - -#if defined(ZTS) && !defined(HAVE_CLASS_ISTDIOSTREAM) -class istdiostream : public istream -{ -private: - stdiobuf _file; -public: - istdiostream (FILE* __f) : istream(), _file(__f) { init(&_file); } - stdiobuf* rdbuf()/* const */ { return &_file; } -}; -#endif - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y deleted file mode 100644 index 1b2d116cbb..0000000000 --- a/Zend/zend_language_parser.y +++ /dev/null @@ -1,974 +0,0 @@ -%{ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998-2002 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -/* - * LALR shift/reduce conflicts and how they are resolved: - * - * - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift. - * - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift. - * - 1 shift/reduce conflict due to objects within encapsulated strings. Solved by shift. - * - */ - - -#include "zend_compile.h" -#include "zend.h" -#include "zend_list.h" -#include "zend_globals.h" -#include "zend_API.h" - -#define YYERROR_VERBOSE -#define YYSTYPE znode -#ifdef ZTS -# define YYPARSE_PARAM tsrm_ls -# define YYLEX_PARAM tsrm_ls -#endif - - -%} - -%pure_parser -%expect 4 - -%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE -%left ',' -%left T_LOGICAL_OR -%left T_LOGICAL_XOR -%left T_LOGICAL_AND -%right T_PRINT -%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL -%left '?' ':' -%left T_BOOLEAN_OR -%left T_BOOLEAN_AND -%left '|' -%left '^' -%left '&' -%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL -%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL -%left T_SL T_SR -%left '+' '-' '.' -%left '*' '/' '%' -%right '!' '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@' -%right '[' -%nonassoc T_NEW T_INSTANCEOF -%token T_EXIT -%token T_IF -%left T_ELSEIF -%left T_ELSE -%left T_ENDIF -%token T_LNUMBER -%token T_DNUMBER -%token T_STRING -%token T_STRING_VARNAME -%token T_VARIABLE -%token T_NUM_STRING -%token T_INLINE_HTML -%token T_CHARACTER -%token T_BAD_CHARACTER -%token T_ENCAPSED_AND_WHITESPACE -%token T_CONSTANT_ENCAPSED_STRING -%token T_ECHO -%token T_DO -%token T_WHILE -%token T_ENDWHILE -%token T_FOR -%token T_ENDFOR -%token T_FOREACH -%token T_ENDFOREACH -%token T_DECLARE -%token T_ENDDECLARE -%token T_INSTANCEOF -%token T_AS -%token T_SWITCH -%token T_ENDSWITCH -%token T_CASE -%token T_DEFAULT -%token T_BREAK -%token T_CONTINUE -%token T_FUNCTION -%token T_CONST -%token T_RETURN -%token T_TRY -%token T_CATCH -%token T_THROW -%token T_USE -%token T_GLOBAL -%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC -%token T_VAR -%token T_UNSET -%token T_ISSET -%token T_EMPTY -%token T_CLASS -%token T_INTERFACE -%token T_EXTENDS -%token T_IMPLEMENTS -%token T_OBJECT_OPERATOR -%token T_DOUBLE_ARROW -%token T_LIST -%token T_ARRAY -%token T_CLASS_C -%token T_FUNC_C -%token T_LINE -%token T_FILE -%token T_NAMESPACE_C -%token T_COMMENT -%token T_DOC_COMMENT -%token T_OPEN_TAG -%token T_OPEN_TAG_WITH_ECHO -%token T_CLOSE_TAG -%token T_WHITESPACE -%token T_START_HEREDOC -%token T_END_HEREDOC -%token T_DOLLAR_OPEN_CURLY_BRACES -%token T_CURLY_OPEN -%token T_PAAMAYIM_NEKUDOTAYIM -%token T_IMPORT T_FROM -%token T_NAMESPACE_NAME -%token T_NAMESPACE - -%% /* Rules */ - -start: - top_statement_list -; - -top_statement_list: - top_statement_list { zend_do_extended_info(TSRMLS_C); } top_statement { HANDLE_INTERACTIVE(); } - | /* empty */ -; - - -top_statement: - statement - | function_declaration_statement { zend_do_early_binding(TSRMLS_C); } - | class_declaration_statement - | namespace_declaration_statement -; - - -inner_statement_list: - inner_statement_list { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); } - | /* empty */ -; - - -inner_statement: - statement - | function_declaration_statement - | class_declaration_statement -; - - -statement: - unticked_statement { zend_do_ticks(TSRMLS_C); RESET_DOC_COMMENT(); } -; - -unticked_statement: - '{' inner_statement_list '}' - | T_IF '(' expr ')' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } statement { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); } - | T_IF '(' expr ')' ':' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); } - | T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { zend_do_while_cond(&$4, &$5 TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$5 TSRMLS_CC); } - | T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE '(' { $5.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' ';' { zend_do_do_while_end(&$1, &$5, &$7 TSRMLS_CC); } - | T_FOR - '(' - for_expr - ';' { zend_do_free(&$3 TSRMLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); } - for_expr - ';' { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&$6, &$7 TSRMLS_CC); } - for_expr - ')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); } - for_statement { zend_do_for_end(&$7 TSRMLS_CC); } - | T_SWITCH '(' expr ')' { zend_do_switch_cond(&$3 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$6 TSRMLS_CC); } - | T_BREAK ';' { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); } - | T_BREAK expr ';' { zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); } - | T_CONTINUE ';' { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); } - | T_CONTINUE expr ';' { zend_do_brk_cont(ZEND_CONT, &$2 TSRMLS_CC); } - | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); } - | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); } - | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); } - | T_GLOBAL global_var_list ';' - | T_STATIC static_var_list ';' - | T_ECHO echo_expr_list ';' - | T_INLINE_HTML { zend_do_echo(&$1 TSRMLS_CC); } - | expr ';' { zend_do_free(&$1 TSRMLS_CC); } - | T_USE use_filename ';' { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&$2.u.constant); } - | T_UNSET '(' unset_variables ')' ';' - | T_FOREACH '(' variable T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 1 TSRMLS_CC); } w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); } - | T_FOREACH '(' expr_without_variable T_AS { zend_do_foreach_begin(&$1, &$3, &$2, &$4, 0 TSRMLS_CC); } w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$6, &$7, &$4 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$2 TSRMLS_CC); } - | T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); } - | ';' /* empty statement */ - | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}' - T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' { zend_do_begin_catch(&$1, &$8, &$9, 1 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } - additional_catches - | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); } - | T_IMPORT { zend_do_begin_import(TSRMLS_C); } import_rule T_FROM import_namespace { zend_do_end_import(&$5 TSRMLS_CC); } ';' -; - - -import_rule: - '*' { zend_do_import(T_FUNCTION, NULL TSRMLS_CC); zend_do_import(T_CLASS, NULL TSRMLS_CC); zend_do_import(T_CONST, NULL TSRMLS_CC); } - | import_commands -; - -import_commands: - import_commands ',' import_command - | import_command -; - -import_command: - T_FUNCTION T_STRING { zend_do_import(T_FUNCTION, &$2 TSRMLS_CC); } - | T_CLASS T_STRING { zend_do_import(T_CLASS, &$2 TSRMLS_CC); } - | T_CONST T_STRING { zend_do_import(T_CONST, &$2 TSRMLS_CC); } - | T_FUNCTION '*' { zend_do_import(T_FUNCTION, NULL TSRMLS_CC); } - | T_CLASS '*' { zend_do_import(T_CLASS, NULL TSRMLS_CC); } - | T_CONST '*' { zend_do_import(T_CONST, NULL TSRMLS_CC); } -; - -additional_catches: - non_empty_additional_catches - | /* empty */ -; - -non_empty_additional_catches: - non_empty_additional_catches T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' { zend_do_begin_catch(&$2, &$4, &$5, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$2 TSRMLS_CC); } - | T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$4, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } -; - - -unset_variables: - unset_variable - | unset_variables ',' unset_variable -; - -unset_variable: - variable { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); } -; - -use_filename: - T_CONSTANT_ENCAPSED_STRING { $$ = $1; } - | '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; } -; - - -function_declaration_statement: - unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); } -; - -class_declaration_statement: - unticked_class_declaration_statement { zend_do_ticks(TSRMLS_C); } -; - - -is_reference: - /* empty */ { $$.op_type = ZEND_RETURN_VAL; } - | '&' { $$.op_type = ZEND_RETURN_REF; } -; - - -unticked_function_declaration_statement: - T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type, NULL TSRMLS_CC); } - '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); } -; - -unticked_class_declaration_statement: - class_entry_type T_STRING extends_from - { zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); } - implements_list - '{' - class_statement_list - '}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); } -; - - -class_entry_type: - T_CLASS { $$.u.constant.value.lval = 0; } - | T_ABSTRACT T_CLASS { $$.u.constant.value.lval = ZEND_ACC_ABSTRACT_CLASS; } - | T_INTERFACE { $$.u.constant.value.lval = ZEND_ACC_INTERFACE; } -; - -namespace_declaration_statement: - T_NAMESPACE namespace_name '{' { zend_do_begin_namespace(&$1, &$2 TSRMLS_CC); } namespace_statement_list '}' { zend_do_end_namespace(&$1 TSRMLS_CC); } -; - -namespace_statement_list: - namespace_statement_list namespace_statement - | /* empty */ -; - -namespace_statement: - T_VAR namespace_var_declaration_list ';' - | namespace_const_declaration ';' - | function_declaration_statement - | class_declaration_statement -; - -namespace_var_declaration_list: - namespace_var_declaration_list ',' namespace_var_declaration - | namespace_var_declaration -; - -namespace_var_declaration: - T_VARIABLE { zend_do_declare_namespace_var(&$1, NULL TSRMLS_CC); } - | T_VARIABLE '=' static_scalar { zend_do_declare_namespace_var(&$1, &$3 TSRMLS_CC); } -; - -namespace_const_declaration: - namespace_const_declaration ',' T_STRING '=' const_scalar_expr { zend_do_declare_namespace_constant(&$3, &$5 TSRMLS_CC); } - | T_CONST T_STRING '=' const_scalar_expr { zend_do_declare_namespace_constant(&$2, &$4 TSRMLS_CC); } -; - -extends_from: - /* empty */ { $$.op_type = IS_UNUSED; } - | T_EXTENDS fully_qualified_class_name { $$ = $2; } -; - -implements_list: - /* empty */ - | T_IMPLEMENTS interface_list -; - -interface_list: - fully_qualified_class_name { zend_do_implements_interface(&$1 TSRMLS_CC); } - | interface_list ',' fully_qualified_class_name { zend_do_implements_interface(&$3 TSRMLS_CC); } -; - -foreach_optional_arg: - /* empty */ { $$.op_type = IS_UNUSED; } - | T_DOUBLE_ARROW w_variable { $$ = $2; } -; - -for_statement: - statement - | ':' inner_statement_list T_ENDFOR ';' -; - - -foreach_statement: - statement - | ':' inner_statement_list T_ENDFOREACH ';' -; - - -declare_statement: - statement - | ':' inner_statement_list T_ENDDECLARE ';' -; - - -declare_list: - T_STRING '=' static_scalar { zend_do_declare_stmt(&$1, &$3 TSRMLS_CC); } - | declare_list ',' T_STRING '=' static_scalar { zend_do_declare_stmt(&$3, &$5 TSRMLS_CC); } -; - - -switch_case_list: - '{' case_list '}' { $$ = $2; } - | '{' ';' case_list '}' { $$ = $3; } - | ':' case_list T_ENDSWITCH ';' { $$ = $2; } - | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; } -; - - -case_list: - /* empty */ { $$.op_type = IS_UNUSED; } - | case_list T_CASE expr case_separator { zend_do_extended_info(TSRMLS_C); zend_do_case_before_statement(&$1, &$2, &$3 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; } - | case_list T_DEFAULT case_separator { zend_do_extended_info(TSRMLS_C); zend_do_default_before_statement(&$1, &$2 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; } -; - - -case_separator: - ':' - | ';' -; - - -while_statement: - statement - | ':' inner_statement_list T_ENDWHILE ';' -; - - - -elseif_list: - /* empty */ - | elseif_list T_ELSEIF '(' expr ')' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } statement { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); } -; - - -new_elseif_list: - /* empty */ - | new_elseif_list T_ELSEIF '(' expr ')' ':' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); } -; - - -else_single: - /* empty */ - | T_ELSE statement -; - - -new_else_single: - /* empty */ - | T_ELSE ':' inner_statement_list -; - - -parameter_list: - non_empty_parameter_list - | /* empty */ -; - - -non_empty_parameter_list: - optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, BYREF_NONE TSRMLS_CC); } - | optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, BYREF_FORCE TSRMLS_CC); } - | optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, &$1, BYREF_FORCE TSRMLS_CC); } - | T_CONST optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$2, BYREF_NONE TSRMLS_CC); } - | optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$4, &$1, BYREF_NONE TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, BYREF_NONE TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, BYREF_FORCE TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$7, &$3, BYREF_FORCE TSRMLS_CC); } - | non_empty_parameter_list ',' T_CONST optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$4, BYREF_NONE TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$6, &$3, BYREF_NONE TSRMLS_CC); } -; - - -optional_class_type: - /* empty */ { $$.op_type = IS_UNUSED; } - | fully_qualified_class_name { $$ = $1; } -; - -function_call_parameter_list: - non_empty_function_call_parameter_list { $$ = $1; } - | /* empty */ { $$.u.constant.value.lval = 0; } -; - - -non_empty_function_call_parameter_list: - expr_without_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); } - | variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); } - | '&' w_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$2, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); } - | non_empty_function_call_parameter_list ',' expr_without_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); } - | non_empty_function_call_parameter_list ',' variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); } - | non_empty_function_call_parameter_list ',' '&' w_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$4, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); } -; - -global_var_list: - global_var_list ',' global_var { zend_do_fetch_global_variable(&$3, NULL, ZEND_FETCH_GLOBAL TSRMLS_CC); } - | global_var { zend_do_fetch_global_variable(&$1, NULL, ZEND_FETCH_GLOBAL TSRMLS_CC); } -; - - -global_var: - T_VARIABLE { $$ = $1; } - | '$' r_variable { $$ = $2; } - | '$' '{' expr '}' { $$ = $3; } -; - - -static_var_list: - static_var_list ',' T_VARIABLE { zend_do_fetch_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); } - | static_var_list ',' T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); } - | T_VARIABLE { zend_do_fetch_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); } - | T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); } - -; - - -class_statement_list: - class_statement_list class_statement - | /* empty */ -; - - -class_statement: - variable_modifiers { CG(access_type) = $1.u.constant.value.lval; } class_variable_declaration ';' - | class_constant_declaration ';' - | method_modifiers T_FUNCTION { $2.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $4.op_type, &$1 TSRMLS_CC); } '(' - parameter_list ')' method_body { zend_do_abstract_method(&$5, &$1, &$10 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } -; - - -method_body: - ';' /* abstract method */ { $$.u.constant.value.lval = ZEND_ACC_ABSTRACT; } - | '{' inner_statement_list '}' { $$.u.constant.value.lval = 0; } -; - -variable_modifiers: - non_empty_member_modifiers { $$ = $1; } - | T_VAR { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; } -; - -method_modifiers: - /* empty */ { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; } - | non_empty_member_modifiers { $$ = $1; if (!($$.u.constant.value.lval & ZEND_ACC_PPP_MASK)) { $$.u.constant.value.lval |= ZEND_ACC_PUBLIC; } } -; - -non_empty_member_modifiers: - member_modifier { $$ = $1; } - | non_empty_member_modifiers member_modifier { $$.u.constant.value.lval = zend_do_verify_access_types(&$1, &$2); } -; - -member_modifier: - T_PUBLIC { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; } - | T_PROTECTED { $$.u.constant.value.lval = ZEND_ACC_PROTECTED; } - | T_PRIVATE { $$.u.constant.value.lval = ZEND_ACC_PRIVATE; } - | T_STATIC { $$.u.constant.value.lval = ZEND_ACC_STATIC; } - | T_ABSTRACT { $$.u.constant.value.lval = ZEND_ACC_ABSTRACT; } - | T_FINAL { $$.u.constant.value.lval = ZEND_ACC_FINAL; } -; - -class_variable_declaration: - class_variable_declaration ',' T_VARIABLE { zend_do_declare_property(&$3, NULL, CG(access_type) TSRMLS_CC); } - | class_variable_declaration ',' T_VARIABLE '=' static_scalar { zend_do_declare_property(&$3, &$5, CG(access_type) TSRMLS_CC); } - | T_VARIABLE { zend_do_declare_property(&$1, NULL, CG(access_type) TSRMLS_CC); } - | T_VARIABLE '=' static_scalar { zend_do_declare_property(&$1, &$3, CG(access_type) TSRMLS_CC); } -; - -class_constant_declaration: - class_constant_declaration ',' T_STRING '=' const_scalar_expr { zend_do_declare_class_constant(&$3, &$5 TSRMLS_CC); } - | T_CONST T_STRING '=' const_scalar_expr { zend_do_declare_class_constant(&$2, &$4 TSRMLS_CC); } -; - -echo_expr_list: - echo_expr_list ',' expr { zend_do_echo(&$3 TSRMLS_CC); } - | expr { zend_do_echo(&$1 TSRMLS_CC); } -; - - -for_expr: - /* empty */ { $$.op_type = IS_CONST; $$.u.constant.type = IS_BOOL; $$.u.constant.value.lval = 1; } - | non_empty_for_expr { $$ = $1; } -; - -non_empty_for_expr: - non_empty_for_expr ',' { zend_do_free(&$1 TSRMLS_CC); } expr { $$ = $4; } - | expr { $$ = $1; } -; - -expr_without_variable: - T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); } - | variable '=' expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); } - | variable '=' '&' variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); } - | variable '=' '&' T_NEW dynamic_class_name { zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); } - | T_NEW dynamic_class_name { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_MINUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_MUL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_DIV_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_CONCAT_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_MOD_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_AND_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_OR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_XOR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_SL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_SR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); } - | rw_variable T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); } - | T_INC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); } - | rw_variable T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); } - | T_DEC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_DEC TSRMLS_CC); } - | expr T_BOOLEAN_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } - | expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } - | expr T_LOGICAL_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } - | expr T_LOGICAL_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } - | expr T_LOGICAL_XOR expr { zend_do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); } - | expr '|' expr { zend_do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); } - | expr '&' expr { zend_do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); } - | expr '^' expr { zend_do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); } - | expr '.' expr { zend_do_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); } - | expr '+' expr { zend_do_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); } - | expr '-' expr { zend_do_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); } - | expr '*' expr { zend_do_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); } - | expr '/' expr { zend_do_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); } - | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); } - | expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); } - | expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); } - | '+' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } - | '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } - | '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); } - | '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); } - | expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); } - | expr T_IS_NOT_IDENTICAL expr { zend_do_binary_op(ZEND_IS_NOT_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); } - | expr T_IS_EQUAL expr { zend_do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 TSRMLS_CC); } - | expr T_IS_NOT_EQUAL expr { zend_do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 TSRMLS_CC); } - | expr '<' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 TSRMLS_CC); } - | expr T_IS_SMALLER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 TSRMLS_CC); } - | expr '>' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); } - | expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); } - | expr T_INSTANCEOF dynamic_class_name { zend_do_instanceof(&$$, &$1, &$3, 0 TSRMLS_CC); } - | '(' expr ')' { $$ = $2; } - | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); } - expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); } - expr { zend_do_qm_false(&$$, &$7, &$2, &$5 TSRMLS_CC); } - | internal_functions_in_yacc { $$ = $1; } - | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); } - | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); } - | T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); } - | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); } - | T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); } - | T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); } - | T_UNSET_CAST expr { zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); } - | T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); } - | '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; } - | scalar { $$ = $1; } - | T_ARRAY '(' array_pair_list ')' { $$ = $3; } - | '`' encaps_list '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); } - | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } -; - -function_call: - T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); } - function_call_parameter_list - ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } - | class_or_namespace_constant '(' { zend_do_begin_class_member_function_call(TSRMLS_C); zend_do_extended_fcall_begin(TSRMLS_C); } - function_call_parameter_list - ')' { zend_do_end_function_call(NULL, &$$, &$4, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); } - function_call_parameter_list ')' - { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} -; - -fully_qualified_class_name: - namespace_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$$, &$1, &$3, 0 TSRMLS_CC); } - | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$$, NULL, &$2, 1 TSRMLS_CC); } - | T_STRING { zend_do_fetch_class(&$$, NULL, &$1, 0 TSRMLS_CC); } -; - -import_namespace: - T_NAMESPACE_NAME { zend_do_fetch_class(&$$, NULL, &$1, 0 TSRMLS_CC); } - | T_STRING { zend_do_fetch_class(&$$, NULL, &$1, 0 TSRMLS_CC); } -; - -dynamic_class_name: - namespace_name T_PAAMAYIM_NEKUDOTAYIM static_or_variable_string { zend_do_fetch_class(&$$, &$1, &$3, 0 TSRMLS_CC); } - | T_PAAMAYIM_NEKUDOTAYIM static_or_variable_string { zend_do_fetch_class(&$$, NULL, &$2, 1 TSRMLS_CC); } - | static_or_variable_string { zend_do_fetch_class(&$$, NULL, &$1, 0 TSRMLS_CC); } -; - -namespace_name: - T_NAMESPACE_NAME { $$ = $1; } - | T_STRING { $$ = $1; } -; - -static_or_variable_string: - T_STRING { $$ = $1; } - | r_variable_without_static_member { $$ = $1; } -; - - -exit_expr: - /* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; } - | '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; } - | '(' expr ')' { $$ = $2; } -; - - -ctor_arguments: - /* empty */ { $$.u.constant.value.lval=0; } - | '(' function_call_parameter_list ')' { $$ = $2; } -; - - -common_scalar: - T_LNUMBER { $$ = $1; } - | T_DNUMBER { $$ = $1; } - | T_CONSTANT_ENCAPSED_STRING { $$ = $1; } - | T_LINE { $$ = $1; } - | T_FILE { $$ = $1; } - | T_CLASS_C { $$ = $1; } - | T_FUNC_C { $$ = $1; } - | T_NAMESPACE_C { $$ = $1; } -; - - -const_scalar_expr: /* compile-time evaluated scalar expressions */ - const_scalar { $$ = $1; } - | const_scalar_expr_list { $$ = $1; } -; - -const_scalar_expr_list: - const_scalar_expr T_SL const_scalar_expr { zend_do_fold_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr T_SR const_scalar_expr { zend_do_fold_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr T_LOGICAL_XOR const_scalar_expr { zend_do_fold_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '|' const_scalar_expr { zend_do_fold_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '&' const_scalar_expr { zend_do_fold_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '^' const_scalar_expr { zend_do_fold_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '.' const_scalar_expr { zend_do_fold_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '+' const_scalar_expr { zend_do_fold_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '-' const_scalar_expr { zend_do_fold_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '*' const_scalar_expr { zend_do_fold_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '/' const_scalar_expr { zend_do_fold_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '%' const_scalar_expr { zend_do_fold_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); } - | const_scalar_expr '~' const_scalar_expr { zend_do_fold_binary_op(ZEND_BW_NOT, &$$, &$1, &$3 TSRMLS_CC); } - | '(' const_scalar_expr ')' { $$ = $2; } -; - -const_scalar: - common_scalar { $$ = $1; } - | T_STRING { zend_do_fold_constant(&$$, &$1 TSRMLS_CC); } - | '+' const_scalar { $$ = $2; } - | '-' const_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; } - | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; } - | class_or_namespace_constant { /* FIXME */ } -; - -static_scalar: /* compile-time evaluated scalars */ - common_scalar { $$ = $1; } - | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT TSRMLS_CC); } - | '+' static_scalar { $$ = $2; } - | '-' static_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; } - | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; } - | class_or_namespace_constant { /* FIXME */ } -; - -scalar: - T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT TSRMLS_CC); } - | T_STRING_VARNAME { $$ = $1; } - | class_or_namespace_constant { $$ = $1; } - | common_scalar { $$ = $1; } - | '"' encaps_list '"' { $$ = $2; } - | '\'' encaps_list '\'' { $$ = $2; } - | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; zend_do_end_heredoc(TSRMLS_C); } -; - - -static_array_pair_list: - /* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); } - | non_empty_static_array_pair_list possible_comma { $$ = $1; } -; - -possible_comma: - /* empty */ - | ',' -; - -non_empty_static_array_pair_list: - non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { zend_do_add_static_array_element(&$$, &$3, &$5); } - | non_empty_static_array_pair_list ',' static_scalar { zend_do_add_static_array_element(&$$, NULL, &$3); } - | static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, &$1, &$3); } - | static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, NULL, &$1); } -; - -expr: - r_variable { $$ = $1; } - | expr_without_variable { $$ = $1; } -; - - -r_variable: - variable { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; } -; - - -w_variable: - variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $$ = $1; } - { zend_check_writable_variable(&$1); } -; - -rw_variable: - variable { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; } - { zend_check_writable_variable(&$1); } -; - -r_variable_without_static_member: - variable_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; } -; - -variable: - base_variable_without_objects T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); } - object_property { zend_do_push_object(&$4 TSRMLS_CC); } method_or_not variable_properties - { zend_do_pop_object(&$$ TSRMLS_CC); $$.u.EA.type = $1.u.EA.type | ($7.u.EA.type ? $7.u.EA.type : $6.u.EA.type); } - | base_variable_without_objects { $$ = $1; } -; - - -variable_properties: - variable_properties variable_property { $$.u.EA.type = $2.u.EA.type; } - | /* empty */ { $$.u.EA.type = 0; } -; - - -variable_property: - T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); } method_or_not { $$.u.EA.type = $4.u.EA.type; } -; - -method_or_not: - '(' { zend_do_pop_object(&$1 TSRMLS_CC); zend_do_begin_method_call(&$1 TSRMLS_CC); } - function_call_parameter_list ')' - { zend_do_end_function_call(&$1, &$$, &$3, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); - zend_do_push_object(&$$ TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_METHOD_CALL; } - | /* empty */ { $$.u.EA.type = ZEND_PARSED_MEMBER; } -; - -variable_without_objects: - reference_variable { $$ = $1; } - | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); } -; - -static_member: - T_PAAMAYIM_NEKUDOTAYIM T_STRING T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $4; zend_do_fetch_class(&$1, NULL, &$2, 1 TSRMLS_CC); zend_do_fetch_static_member(&$1 TSRMLS_CC); } - | namespace_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_class(&$2, NULL, &$1, 0 TSRMLS_CC); zend_do_fetch_static_member(&$2 TSRMLS_CC); } - | namespace_name T_PAAMAYIM_NEKUDOTAYIM T_STRING T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $5; zend_do_fetch_class(&$4, &$1, &$3, 0 TSRMLS_CC); zend_do_fetch_static_member(&$4 TSRMLS_CC); } -; - - -base_variable_without_objects: - reference_variable { $$ = $1; $$.u.EA.type = ZEND_PARSED_VARIABLE; } - | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_VARIABLE; } - | static_member { $$ = $1; $$.u.EA.type = ZEND_PARSED_STATIC_MEMBER; } - | function_call { zend_do_begin_variable_parse(TSRMLS_C); $$ = $1; $$.u.EA.type = ZEND_PARSED_FUNCTION_CALL; } -; - -reference_variable: - reference_variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } - | reference_variable '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); } - | compound_variable { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); } -; - - -compound_variable: - T_VARIABLE { $$ = $1; } - | '$' '{' expr '}' { $$ = $3; } -; - -dim_offset: - /* empty */ { $$.op_type = IS_UNUSED; } - | expr { $$ = $1; } -; - - -object_property: - object_dim_list { $$ = $1; } - | variable_without_objects { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);} -; - -object_dim_list: - object_dim_list '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } - | object_dim_list '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); } - | variable_name { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);} -; - -variable_name: - T_STRING { $$ = $1; } - | '{' expr '}' { $$ = $2; } -; - -simple_indirect_reference: - '$' { $$.u.constant.value.lval = 1; } - | simple_indirect_reference '$' { $$.u.constant.value.lval++; } -; - -assignment_list: - assignment_list ',' assignment_list_element - | assignment_list_element -; - - -assignment_list_element: - variable { zend_do_add_list_element(&$1 TSRMLS_CC); } - | T_LIST '(' { zend_do_new_list_begin(TSRMLS_C); } assignment_list ')' { zend_do_new_list_end(TSRMLS_C); } - | /* empty */ { zend_do_add_list_element(NULL TSRMLS_CC); } -; - - -array_pair_list: - /* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); } - | non_empty_array_pair_list possible_comma { $$ = $1; } -; - -non_empty_array_pair_list: - non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { zend_do_add_array_element(&$$, &$5, &$3, 0 TSRMLS_CC); } - | non_empty_array_pair_list ',' expr { zend_do_add_array_element(&$$, &$3, NULL, 0 TSRMLS_CC); } - | expr T_DOUBLE_ARROW expr { zend_do_init_array(&$$, &$3, &$1, 0 TSRMLS_CC); } - | expr { zend_do_init_array(&$$, &$1, NULL, 0 TSRMLS_CC); } - | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable { zend_do_add_array_element(&$$, &$6, &$3, 1 TSRMLS_CC); } - | non_empty_array_pair_list ',' '&' w_variable { zend_do_add_array_element(&$$, &$4, NULL, 1 TSRMLS_CC); } - | expr T_DOUBLE_ARROW '&' w_variable { zend_do_init_array(&$$, &$4, &$1, 1 TSRMLS_CC); } - | '&' w_variable { zend_do_init_array(&$$, &$2, NULL, 1 TSRMLS_CC); } -; - -encaps_list: - encaps_list encaps_var { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list T_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list T_NUM_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list T_ENCAPSED_AND_WHITESPACE { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list T_CHARACTER { zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list T_BAD_CHARACTER { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list '[' { $2.u.constant.value.lval = (long) '['; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list ']' { $2.u.constant.value.lval = (long) ']'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list '{' { $2.u.constant.value.lval = (long) '{'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list '}' { $2.u.constant.value.lval = (long) '}'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.lval = (long) '-'; zend_do_add_char(&tmp, &$1, &$2 TSRMLS_CC); $2.u.constant.value.lval = (long) '>'; zend_do_add_char(&$$, &tmp, &$2 TSRMLS_CC); } - | /* empty */ { zend_do_init_string(&$$ TSRMLS_CC); } - -; - - - -encaps_var: - T_VARIABLE { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); } - | T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']' { fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); } - | T_VARIABLE T_OBJECT_OPERATOR T_STRING { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$2, &$1, 1 TSRMLS_CC); zend_do_fetch_property(&$$, &$2, &$3 TSRMLS_CC); } - | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$2, 1 TSRMLS_CC); } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_begin(&$$, &$2, &$4 TSRMLS_CC); } - | T_CURLY_OPEN variable '}' { $$ = $2; } -; - - -encaps_var_offset: - T_STRING { $$ = $1; } - | T_NUM_STRING { $$ = $1; } - | T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); } -; - - -internal_functions_in_yacc: - T_ISSET '(' isset_variables ')' { $$ = $3; } - | T_EMPTY '(' variable ')' { zend_do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 TSRMLS_CC); } - | T_INCLUDE expr { zend_do_include_or_eval(ZEND_INCLUDE, &$$, &$2 TSRMLS_CC); } - | T_INCLUDE_ONCE expr { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 TSRMLS_CC); } - | T_EVAL '(' expr ')' { zend_do_include_or_eval(ZEND_EVAL, &$$, &$3 TSRMLS_CC); } - | T_REQUIRE expr { zend_do_include_or_eval(ZEND_REQUIRE, &$$, &$2 TSRMLS_CC); } - | T_REQUIRE_ONCE expr { zend_do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 TSRMLS_CC); } -; - -isset_variables: - variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); } - | isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } variable { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, &tmp, &$4 TSRMLS_CC); zend_do_boolean_and_end(&$$, &$1, &tmp, &$2 TSRMLS_CC); } -; - -class_or_namespace_constant: - T_PAAMAYIM_NEKUDOTAYIM namespace_name { zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT TSRMLS_CC); } - | T_PAAMAYIM_NEKUDOTAYIM T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$1, NULL, &$2, 1 TSRMLS_CC); zend_do_fetch_constant(&$$, &$1, &$4, ZEND_RT TSRMLS_CC); } - | namespace_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$2, NULL, &$1, 0 TSRMLS_CC); zend_do_fetch_constant(&$$, &$2, &$3, ZEND_RT TSRMLS_CC); } - | namespace_name T_PAAMAYIM_NEKUDOTAYIM T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_class(&$4, &$1, &$3, 0 TSRMLS_CC); zend_do_fetch_constant(&$$, &$4, &$5, ZEND_RT TSRMLS_CC); } -; - -%% - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h deleted file mode 100644 index 50227ee9c7..0000000000 --- a/Zend/zend_language_scanner.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_SCANNER_H -#define ZEND_SCANNER_H - -typedef struct _zend_lex_state { - YY_BUFFER_STATE buffer_state; - int state; - zend_file_handle *in; - uint lineno; - char *filename; -} zend_lex_state; - - -void zend_fatal_scanner_error(char *); -BEGIN_EXTERN_C() -int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); -ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC); -ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC); -ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC); -END_EXTERN_C() - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l deleted file mode 100644 index ee1060cb55..0000000000 --- a/Zend/zend_language_scanner.l +++ /dev/null @@ -1,1588 +0,0 @@ -%{ - -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998-2002 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#define yyleng SCNG(yy_leng) -#define yytext SCNG(yy_text) -#define yytext_ptr SCNG(yy_text) -#define yyin SCNG(yy_in) -#define yyout SCNG(yy_out) -#define yy_last_accepting_state SCNG(_yy_last_accepting_state) -#define yy_last_accepting_cpos SCNG(_yy_last_accepting_cpos) -#define yy_more_flag SCNG(_yy_more_flag) -#define yy_more_len SCNG(_yy_more_len) - -%} - -%x ST_IN_SCRIPTING -%x ST_DOUBLE_QUOTES -%x ST_SINGLE_QUOTE -%x ST_BACKQUOTE -%x ST_HEREDOC -%x ST_LOOKING_FOR_PROPERTY -%x ST_LOOKING_FOR_VARNAME -%x ST_COMMENT -%x ST_DOC_COMMENT -%x ST_ONE_LINE_COMMENT -%option stack - -%{ - -#include -#include "zend.h" -#include "zend_alloc.h" -#include "zend_language_parser.h" -#include "zend_compile.h" -#include "zend_language_scanner.h" -#include "zend_highlight.h" -#include "zend_constants.h" -#include "zend_variables.h" -#include "zend_operators.h" - -#ifdef HAVE_STDARG_H -# include -#endif - -#ifdef HAVE_UNISTD_H -# include -#endif - -#define YY_DECL int lex_scan(zval *zendlval TSRMLS_DC) - -#define ECHO { ZEND_WRITE( yytext, yyleng ); } - -#ifdef ZTS -# define MY_INPUT yyinput -#else -# define MY_INPUT input -#endif - - -/* Globals Macros */ -#define SCNG LANG_SCNG -#ifdef ZTS -ZEND_API ts_rsrc_id language_scanner_globals_id; -#else -ZEND_API zend_scanner_globals language_scanner_globals; -#endif - - -#define YY_FATAL_ERROR zend_fatal_scanner_error - -#define HANDLE_NEWLINES(s, l) \ -do { \ - char *p = (s), *boundary = p+(l); \ - \ - while (p='0' && (c)<='7') -#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F')) - - -void zend_fatal_scanner_error(char *message) -{ - zend_error(E_COMPILE_ERROR, message); -} - -BEGIN_EXTERN_C() -void startup_scanner(TSRMLS_D) -{ - CG(heredoc) = NULL; - CG(heredoc_len)=0; - RESET_DOC_COMMENT(); - SCNG(yy_start_stack_ptr) = 0; - SCNG(yy_start_stack_depth) = 0; -} - - -void shutdown_scanner(TSRMLS_D) -{ - if (CG(heredoc)) { - efree(CG(heredoc)); - CG(heredoc_len)=0; - } - RESET_DOC_COMMENT(); -} -END_EXTERN_C() - - -ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC) -{ - memcpy(&lex_state->buffer_state, &YY_CURRENT_BUFFER, sizeof(YY_BUFFER_STATE)); - lex_state->in = SCNG(yy_in); - lex_state->state = YYSTATE; - lex_state->filename = zend_get_compiled_filename(TSRMLS_C); - lex_state->lineno = CG(zend_lineno); -} - - -ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC) -{ - YY_BUFFER_STATE original_buffer_state = YY_CURRENT_BUFFER; - - if (lex_state->buffer_state) { - yy_switch_to_buffer(lex_state->buffer_state TSRMLS_CC); - } else { - YY_CURRENT_BUFFER = NULL; - } - - yy_delete_buffer(original_buffer_state TSRMLS_CC); - SCNG(yy_in) = lex_state->in; - BEGIN(lex_state->state); - CG(zend_lineno) = lex_state->lineno; - zend_restore_compiled_filename(lex_state->filename TSRMLS_CC); -} - - -BEGIN_EXTERN_C() - - -ZEND_API void zend_file_handle_dtor(zend_file_handle *fh) -{ - TSRMLS_FETCH(); - - switch (fh->type) { - case ZEND_HANDLE_FP: - fclose(fh->handle.fp); - break; - case ZEND_HANDLE_STREAM: - fh->handle.stream.closer(fh->handle.stream.handle TSRMLS_CC); - break; - case ZEND_HANDLE_FILENAME: - /* We're only supposed to get here when destructing the used_files hash, - * which doesn't really contain open files, but references to their names/paths - */ - break; - } - if (fh->opened_path) { - efree(fh->opened_path); - fh->opened_path = NULL; - } - if (fh->free_filename && fh->filename) { - efree(fh->filename); - fh->filename = NULL; - } -} - - -int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) -{ - if (fh1->type != fh2->type) { - return 0; - } - switch (fh1->type) { - case ZEND_HANDLE_FP: - return fh1->handle.fp==fh2->handle.fp; - break; - case ZEND_HANDLE_STREAM: - return fh1->handle.stream.handle == fh2->handle.stream.handle; - break; - } - return 0; -} - - -ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC) -{ - zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles); -} - - -ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC) -{ - char *file_path=NULL; - - if (FAILURE == zend_stream_fixup(file_handle TSRMLS_CC)) { - return FAILURE; - } - - zend_llist_add_element(&CG(open_files), file_handle); - - /* Reset the scanner for scanning the new file */ - SCNG(yy_in) = file_handle; - yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC); - BEGIN(INITIAL); - - if (file_handle->opened_path) { - file_path = file_handle->opened_path; - } else { - file_path = file_handle->filename; - } - - zend_set_compiled_filename(file_path TSRMLS_CC); - - if (CG(start_lineno)) { - CG(zend_lineno) = CG(start_lineno); - CG(start_lineno) = 0; - } else { - CG(zend_lineno) = 1; - } - - CG(increment_lineno) = 0; - return SUCCESS; -} -END_EXTERN_C() - - -ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) -{ - zend_lex_state original_lex_state; - zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array)); - zend_op_array *original_active_op_array = CG(active_op_array); - zend_op_array *retval=NULL; - int compiler_result; - zend_bool compilation_successful=0; - znode retval_znode; - zend_bool original_in_compilation = CG(in_compilation); - - retval_znode.op_type = IS_CONST; - retval_znode.u.constant.type = IS_LONG; - retval_znode.u.constant.value.lval = 1; - retval_znode.u.constant.is_ref = 0; - retval_znode.u.constant.refcount = 1; - - zend_save_lexical_state(&original_lex_state TSRMLS_CC); - - retval = op_array; /* success oriented */ - - if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) { - if (type==ZEND_REQUIRE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); - zend_bailout(); - } else { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); - } - compilation_successful=0; - } else { - init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC); - CG(in_compilation) = 1; - CG(active_op_array) = op_array; - op_array->ns = CG(active_namespace); - compiler_result = zendparse(TSRMLS_C); - zend_do_return(&retval_znode, 0 TSRMLS_CC); - CG(in_compilation) = original_in_compilation; - if (compiler_result==1) { /* parser error */ - CG(unclean_shutdown) = 1; - retval = NULL; - } - compilation_successful=1; - } - - if (retval) { - CG(active_op_array) = original_active_op_array; - if (compilation_successful) { - pass_two(op_array TSRMLS_CC); - } else { - efree(op_array); - retval = NULL; - } - } - if (compilation_successful) { - zend_restore_lexical_state(&original_lex_state TSRMLS_CC); - } - return retval; -} - - -zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) -{ - zend_file_handle file_handle; - zval tmp; - zend_op_array *retval; - char *opened_path = NULL; - - if (filename->type != IS_STRING) { - tmp = *filename; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - filename = &tmp; - } - file_handle.filename = filename->value.str.val; - file_handle.free_filename = 0; - file_handle.type = ZEND_HANDLE_FILENAME; - file_handle.opened_path = NULL; - - - retval = zend_compile_file(&file_handle, type TSRMLS_CC); - if (retval && file_handle.handle.stream.handle) { - int dummy = 1; - - if (!file_handle.opened_path) { - file_handle.opened_path = opened_path = estrndup(filename->value.str.val, filename->value.str.len); - } - - zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL); - - if (opened_path) { - efree(opened_path); - } - } - zend_destroy_file_handle(&file_handle TSRMLS_CC); - - if (filename==&tmp) { - zval_dtor(&tmp); - } - return retval; -} - -ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC) -{ - /* enforce two trailing NULLs for flex... */ - STR_REALLOC(str->value.str.val, str->value.str.len+2); - - str->value.str.val[str->value.str.len+1]=0; - - SCNG(yy_in)=NULL; - yy_scan_buffer(str->value.str.val, str->value.str.len+2 TSRMLS_CC); - - zend_set_compiled_filename(filename TSRMLS_CC); - CG(zend_lineno) = 1; - CG(increment_lineno) = 0; - return SUCCESS; -} - - -zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) -{ - zend_lex_state original_lex_state; - zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array)); - zend_op_array *original_active_op_array = CG(active_op_array); - zend_op_array *retval; - zval tmp; - int compiler_result; - zend_bool original_in_compilation = CG(in_compilation); - - if (source_string->value.str.len==0) { - efree(op_array); - return NULL; - } - - CG(in_compilation) = 1; - - tmp = *source_string; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - source_string = &tmp; - - zend_save_lexical_state(&original_lex_state TSRMLS_CC); - if (zend_prepare_string_for_scanning(source_string, filename TSRMLS_CC)==FAILURE) { - efree(op_array); - retval = NULL; - } else { - init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC); - CG(active_op_array) = op_array; - op_array->ns = CG(active_namespace); - BEGIN(ST_IN_SCRIPTING); - compiler_result = zendparse(TSRMLS_C); - - if (compiler_result==1) { - CG(active_op_array) = original_active_op_array; - CG(unclean_shutdown)=1; - retval = NULL; - } else { - zend_do_return(NULL, 0 TSRMLS_CC); - CG(active_op_array) = original_active_op_array; - pass_two(op_array TSRMLS_CC); - retval = op_array; - } - zend_restore_lexical_state(&original_lex_state TSRMLS_CC); - } - zval_dtor(&tmp); - CG(in_compilation) = original_in_compilation; - return retval; -} - - -BEGIN_EXTERN_C() -int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC) -{ - zend_lex_state original_lex_state; - zend_file_handle file_handle; - - file_handle.type = ZEND_HANDLE_FILENAME; - file_handle.filename = filename; - file_handle.free_filename = 0; - file_handle.opened_path = NULL; - zend_save_lexical_state(&original_lex_state TSRMLS_CC); - if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) { - zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename); - return FAILURE; - } - zend_highlight(syntax_highlighter_ini TSRMLS_CC); - zend_destroy_file_handle(&file_handle TSRMLS_CC); - zend_restore_lexical_state(&original_lex_state TSRMLS_CC); - return SUCCESS; -} - -int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC) -{ - zend_lex_state original_lex_state; - zval tmp = *str; - - str = &tmp; - zval_copy_ctor(str); - zend_save_lexical_state(&original_lex_state TSRMLS_CC); - if (zend_prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) { - return FAILURE; - } - zend_highlight(syntax_highlighter_ini TSRMLS_CC); - zend_restore_lexical_state(&original_lex_state TSRMLS_CC); - zval_dtor(str); - return SUCCESS; -} -END_EXTERN_C() - -%} - -LNUM [0-9]+ -DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*) -EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) -HNUM "0x"[0-9a-fA-F]+ -LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* -WHITESPACE [ \n\r\t]+ -TABS_AND_SPACES [ \t]* -TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@] -ENCAPSED_TOKENS [\[\]{}$] -ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+ -ANY_CHAR (.|[\n]) -NEWLINE ("\r"|"\n"|"\r\n") -NAMESPACE_NAME ({LABEL}":")+{LABEL} - -%option noyylineno -%option noyywrap -%% - -"exit" { - return T_EXIT; -} - -"die" { - return T_EXIT; -} - -"function" { - return T_FUNCTION; -} - -"const" { - return T_CONST; -} - -"return" { - return T_RETURN; -} - -"try" { - return T_TRY; -} - -"catch" { - return T_CATCH; -} - -"throw" { - return T_THROW; -} - -"if" { - return T_IF; -} - -"elseif" { - return T_ELSEIF; -} - -"endif" { - return T_ENDIF; -} - -"else" { - return T_ELSE; -} - -"while" { - return T_WHILE; -} - -"endwhile" { - return T_ENDWHILE; -} - -"do" { - return T_DO; -} - -"for" { - return T_FOR; -} - -"endfor" { - return T_ENDFOR; -} - -"foreach" { - return T_FOREACH; -} - -"endforeach" { - return T_ENDFOREACH; -} - -"declare" { - return T_DECLARE; -} - -"enddeclare" { - return T_ENDDECLARE; -} - -"instanceof" { - return T_INSTANCEOF; -} - -"as" { - return T_AS; -} - -"switch" { - return T_SWITCH; -} - -"endswitch" { - return T_ENDSWITCH; -} - -"case" { - return T_CASE; -} - -"default" { - return T_DEFAULT; -} - -"break" { - return T_BREAK; -} - -"continue" { - return T_CONTINUE; -} - -"echo" { - return T_ECHO; -} - -"print" { - return T_PRINT; -} - -"class" { - return T_CLASS; -} - -"interface" { - return T_INTERFACE; -} - -"extends" { - return T_EXTENDS; -} - -"implements" { - return T_IMPLEMENTS; -} - -"namespace" { - return T_NAMESPACE; -} - -"->" { - yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); - return T_OBJECT_OPERATOR; -} - -{LABEL} { - yy_pop_state(TSRMLS_C); - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_STRING; -} - -{ANY_CHAR} { - yyless(0); - yy_pop_state(TSRMLS_C); -} - -"::" { - return T_PAAMAYIM_NEKUDOTAYIM; -} - -"new" { - return T_NEW; -} - -"var" { - return T_VAR; -} - -"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" { - return T_INT_CAST; -} - -"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" { - return T_DOUBLE_CAST; -} - -"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" { - return T_STRING_CAST; -} - -"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" { - return T_ARRAY_CAST; -} - -"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" { - return T_OBJECT_CAST; -} - -"("{TABS_AND_SPACES}("bool"|"boolean"){TABS_AND_SPACES}")" { - return T_BOOL_CAST; -} - -"("{TABS_AND_SPACES}("unset"){TABS_AND_SPACES}")" { - return T_UNSET_CAST; -} - -"eval" { - return T_EVAL; -} - -"include" { - return T_INCLUDE; -} - -"import" { - return T_IMPORT; -} - -"from" { - return T_FROM; -} - -"include_once" { - return T_INCLUDE_ONCE; -} - -"require" { - return T_REQUIRE; -} - -"require_once" { - return T_REQUIRE_ONCE; -} - -"use" { - return T_USE; -} - -"global" { - return T_GLOBAL; -} - -"isset" { - return T_ISSET; -} - -"empty" { - return T_EMPTY; -} - -"static" { - return T_STATIC; -} - -"abstract" { - return T_ABSTRACT; -} - -"final" { - return T_FINAL; -} - -"private" { - return T_PRIVATE; -} - -"protected" { - return T_PROTECTED; -} - -"public" { - return T_PUBLIC; -} - -"unset" { - return T_UNSET; -} - -"=>" { - return T_DOUBLE_ARROW; -} - -"list" { - return T_LIST; -} - -"array" { - return T_ARRAY; -} - -"++" { - return T_INC; -} - -"--" { - return T_DEC; -} - -"===" { - return T_IS_IDENTICAL; -} - -"!==" { - return T_IS_NOT_IDENTICAL; -} - -"==" { - return T_IS_EQUAL; -} - -"!="|"<>" { - return T_IS_NOT_EQUAL; -} - -"<=" { - return T_IS_SMALLER_OR_EQUAL; -} - -">=" { - return T_IS_GREATER_OR_EQUAL; -} - -"+=" { - return T_PLUS_EQUAL; -} - -"-=" { - return T_MINUS_EQUAL; -} - -"*=" { - return T_MUL_EQUAL; -} - -"/=" { - return T_DIV_EQUAL; -} - -".=" { - return T_CONCAT_EQUAL; -} - -"%=" { - return T_MOD_EQUAL; -} - -"<<=" { - return T_SL_EQUAL; -} - -">>=" { - return T_SR_EQUAL; -} - -"&=" { - return T_AND_EQUAL; -} - -"|=" { - return T_OR_EQUAL; -} - -"^=" { - return T_XOR_EQUAL; -} - -"||" { - return T_BOOLEAN_OR; -} - -"&&" { - return T_BOOLEAN_AND; -} - -"OR" { - return T_LOGICAL_OR; -} - -"AND" { - return T_LOGICAL_AND; -} - -"XOR" { - return T_LOGICAL_XOR; -} - -"<<" { - return T_SL; -} - -">>" { - return T_SR; -} - -{TOKENS} { - return yytext[0]; -} - - -"{" { - yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); - return '{'; -} - - -"${" { - yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); - return T_DOLLAR_OPEN_CURLY_BRACES; -} - - -"}" { - /* This is a temporary fix which is dependant on flex and it's implementation */ - if (yy_start_stack_ptr) { - yy_pop_state(TSRMLS_C); - } - return '}'; -} - - -{LABEL} { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - yy_pop_state(TSRMLS_C); - yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); - return T_STRING_VARNAME; -} - - -{ANY_CHAR} { - yyless(0); - yy_pop_state(TSRMLS_C); - yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); -} - - -{LNUM} { - errno = 0; - zendlval->value.lval = strtol(yytext, NULL, 0); - if (errno == ERANGE) { /* overflow */ - zendlval->value.dval = strtod(yytext, NULL); - zendlval->type = IS_DOUBLE; - return T_DNUMBER; - } else { - zendlval->type = IS_LONG; - return T_LNUMBER; - } -} - -{HNUM} { - errno = 0; - zendlval->value.lval = strtoul(yytext, NULL, 16); - if (errno == ERANGE) { /* overflow */ - /* not trying strtod - it returns trash on 0x-es */ - zendlval->value.lval = LONG_MAX; /* maximal long */ - zend_error(E_NOTICE,"Hex number is too big: %s", yytext); - } else { - if (zendlval->value.lval < 0) { - /* maintain consistency with the old way */ - zendlval->value.dval = (unsigned long) zendlval->value.lval; - zendlval->type = IS_DOUBLE; - return T_DNUMBER; - } - zendlval->type = IS_LONG; - } - zendlval->type = IS_LONG; - return T_LNUMBER; -} - -{LNUM}|{HNUM} { /* treat numbers (almost) as strings inside encapsulated strings */ - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_NUM_STRING; -} - -{DNUM}|{EXPONENT_DNUM} { - zendlval->value.dval = strtod(yytext, NULL); - zendlval->type = IS_DOUBLE; - return T_DNUMBER; -} - -"__CLASS__" { - char *class_name = NULL; - - if (CG(active_class_entry)) { - class_name = CG(active_class_entry)->name; - } - - if (!class_name) { - class_name = ""; - } - zendlval->value.str.len = strlen(class_name); - zendlval->value.str.val = estrndup(class_name, zendlval->value.str.len); - zendlval->type = IS_STRING; - return T_CLASS_C; -} - -"__FUNCTION__" { - char *func_name = NULL; - - if (CG(active_op_array)) { - func_name = CG(active_op_array)->function_name; - } - - if (!func_name) { - func_name = ""; - } - zendlval->value.str.len = strlen(func_name); - zendlval->value.str.val = estrndup(func_name, zendlval->value.str.len); - zendlval->type = IS_STRING; - return T_FUNC_C; -} - -"__LINE__" { - zendlval->value.lval = CG(zend_lineno); - zendlval->type = IS_LONG; - return T_LINE; -} - -"__FILE__" { - char *filename = zend_get_compiled_filename(TSRMLS_C); - - if (!filename) { - filename = ""; - } - zendlval->value.str.len = strlen(filename); - zendlval->value.str.val = estrndup(filename, zendlval->value.str.len); - zendlval->type = IS_STRING; - return T_FILE; -} - -"__NAMESPACE__" { - char *ns_name; - if(CG(active_namespace) == &CG(global_namespace)) { - ns_name = ""; - } else { - ns_name = CG(active_namespace)->name; - } - - zendlval->value.str.len = strlen(ns_name); - zendlval->value.str.val = estrndup(ns_name, zendlval->value.str.len); - zendlval->type = IS_STRING; - return T_NAMESPACE_C; -} - -(([^<]|"<"[^?%s<]){1,400})|"value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - return T_INLINE_HTML; -} - -"" { - HANDLE_NEWLINES(yytext, yyleng); - if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not */ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } -} - - -"<%="|"value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG_WITH_ECHO; - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } -} - - -"<%" { - if (CG(asp_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } -} - - -"value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINE(yytext[yyleng-1]); - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; -} - - -""{NEWLINE}? { - zend_error(E_WARNING, "<?php_track_vars?> is no longer supported - please use the track_vars INI directive instead"); - HANDLE_NEWLINE(yytext[yyleng-1]); - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; -} - -"$"{LABEL} { - zendlval->value.str.val = (char *)estrndup(yytext+1, yyleng-1); - zendlval->value.str.len = yyleng-1; - zendlval->type = IS_STRING; - return T_VARIABLE; -} - -{LABEL} { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_STRING; -} - -{NAMESPACE_NAME} { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_NAMESPACE_NAME; -} - -{LABEL} { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_STRING; -} - - -{WHITESPACE} { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - return T_WHITESPACE; -} - - -"#"|"//" { - BEGIN(ST_ONE_LINE_COMMENT); - yymore(); -} - -"?"|"%"|">" { - yymore(); -} - -[^\n\r?%>]+ { - yymore(); -} - -{NEWLINE} { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - CG(zend_lineno)++; - return T_COMMENT; -} - -"?>"|"%>" { - if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - yyless(yyleng-2); - BEGIN(ST_IN_SCRIPTING); - return T_COMMENT; - } else { - yymore(); - } -} - -"/**"{NEWLINE} { - CG(comment_start_line) = CG(zend_lineno); - BEGIN(ST_DOC_COMMENT); - yymore(); -} - -"/*" { - CG(comment_start_line) = CG(zend_lineno); - BEGIN(ST_COMMENT); - yymore(); -} - - -[^*]+ { - yymore(); -} - -"*/" { - CG(doc_comment) = yytext; /* no copying - intentional */ - CG(doc_comment_len) = yyleng; - HANDLE_NEWLINES(yytext, yyleng); - BEGIN(ST_IN_SCRIPTING); - return T_DOC_COMMENT; -} - -"*/" { - HANDLE_NEWLINES(yytext, yyleng); - BEGIN(ST_IN_SCRIPTING); - return T_COMMENT; -} - -"*" { - yymore(); -} - -("?>"|""){NEWLINE}? { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(INITIAL); - return T_CLOSE_TAG; /* implicit ';' at php-end tag */ -} - - -"%>"{NEWLINE}? { - if (CG(asp_tags)) { - BEGIN(INITIAL); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - zendlval->value.str.val = yytext; /* no copying - intentional */ - return T_CLOSE_TAG; /* implicit ';' at php-end tag */ - } else { - yyless(1); - return yytext[0]; - } -} - - -(["]([^$"\\]|("\\".))*["]) { - register char *s, *t; - char *end; - - zendlval->value.str.val = estrndup(yytext+1, yyleng-2); - zendlval->value.str.len = yyleng-2; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - - /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; - while (s=end) { - continue; - } - switch(*s) { - case 'n': - *t++ = '\n'; - zendlval->value.str.len--; - break; - case 'r': - *t++ = '\r'; - zendlval->value.str.len--; - break; - case 't': - *t++ = '\t'; - zendlval->value.str.len--; - break; - case '\\': - case '$': - case '"': - *t++ = *s; - zendlval->value.str.len--; - break; - default: - /* check for an octal */ - if (ZEND_IS_OCT(*s)) { - char octal_buf[4] = { 0, 0, 0, 0 }; - - octal_buf[0] = *s; - zendlval->value.str.len--; - if ((s+1)value.str.len--; - if ((s+1)value.str.len--; - } - } - *t++ = (char) strtol(octal_buf, NULL, 8); - } else if (*s=='x' && (s+1)value.str.len--; /* for the 'x' */ - - hex_buf[0] = *(++s); - zendlval->value.str.len--; - if ((s+1)value.str.len--; - } - *t++ = (char) strtol(hex_buf, NULL, 16); - } else { - *t++ = '\\'; - *t++ = *s; - } - break; - } - s++; - } else { - *t++ = *s++; - } - } - *t = 0; - - return T_CONSTANT_ENCAPSED_STRING; -} - - -([']([^'\\]|("\\".))*[']) { - register char *s, *t; - char *end; - - zendlval->value.str.val = estrndup(yytext+1, yyleng-2); - zendlval->value.str.len = yyleng-2; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - - /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; - while (s=end) { - continue; - } - switch(*s) { - case '\\': - case '\'': - *t++ = *s; - zendlval->value.str.len--; - break; - default: - *t++ = '\\'; - *t++ = *s; - break; - } - s++; - } else { - *t++ = *s++; - } - } - *t = 0; - - return T_CONSTANT_ENCAPSED_STRING; -} - - -["] { - BEGIN(ST_DOUBLE_QUOTES); - return '\"'; -} - - -"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} { - char *s; - CG(zend_lineno)++; - CG(heredoc_len) = yyleng-3-1-(yytext[yyleng-2]=='\r'?1:0); - s = yytext+3; - while ((*s == ' ') || (*s == '\t')) { - s++; - CG(heredoc_len)--; - } - CG(heredoc) = estrndup(s, CG(heredoc_len)); - BEGIN(ST_HEREDOC); - return T_START_HEREDOC; -} - - -[`] { - BEGIN(ST_BACKQUOTE); - return '`'; -} - - -['] { - BEGIN(ST_SINGLE_QUOTE); - return '\''; -} - - -^{LABEL}(";")?{NEWLINE} { - int label_len; - unsigned char unput_semicolon; - - CG(zend_lineno)++; - if (yytext[yyleng-2]=='\r') { - label_len = yyleng-2; - } else { - label_len = yyleng-1; - } - - if (yytext[label_len-1]==';') { - label_len--; - unput_semicolon=1; - } else{ - unput_semicolon=0; - } - - if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) { - zendlval->value.str.val = estrndup(yytext, yyleng); /* unput destroys yytext */ - zendlval->value.str.len = yyleng; - if (unput_semicolon) { - unput(';'); - } - efree(CG(heredoc)); - CG(heredoc)=NULL; - CG(heredoc_len)=0; - BEGIN(ST_IN_SCRIPTING); - return T_END_HEREDOC; - } else { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_STRING; - } -} - - -{ESCAPED_AND_WHITESPACE} { - HANDLE_NEWLINES(yytext, yyleng); - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - -([^'\\]|\\[^'\\])+ { - HANDLE_NEWLINES(yytext, yyleng); - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - - -[`]+ { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - - -["]+ { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - - -"$"[^a-zA-Z_\x7f-\xff{] { - zendlval->value.lval = (long) yytext[0]; - if (yyleng == 2) { - yyless(1); - } - return T_CHARACTER; -} - - -{ENCAPSED_TOKENS} { - zendlval->value.lval = (long) yytext[0]; - return yytext[0]; -} - -"{$" { - zendlval->value.lval = (long) yytext[0]; - yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); - yyless(1); - return T_CURLY_OPEN; -} - - -"\\'" { - zendlval->value.lval = (long) '\''; - return T_CHARACTER; -} - -"\\\\" { - zendlval->value.lval = (long)'\\'; - return T_CHARACTER; -} - -"\\\"" { - zendlval->value.lval = (long) '"'; - return T_CHARACTER; -} - -"\\`" { - zendlval->value.lval = (long) '`'; - return T_CHARACTER; -} - -"\\"[0-7]{1,3} { - zendlval->value.lval = strtol(yytext+1, NULL, 8); - return T_CHARACTER; -} - -"\\x"[0-9A-Fa-f]{1,2} { - zendlval->value.lval = strtol (yytext+2, NULL, 16); - return T_CHARACTER; -} - -"\\"{ANY_CHAR} { - switch (yytext[1]) { - case 'n': - zendlval->value.lval = (long) '\n'; - break; - case 't': - zendlval->value.lval = (long) '\t'; - break; - case 'r': - zendlval->value.lval = (long) '\r'; - break; - case '\\': - zendlval->value.lval = (long) '\\'; - break; - case '$': - zendlval->value.lval = (long) yytext[1]; - break; - case '{': - zendlval->value.lval = (long) yytext[1]; - break; - default: - zendlval->value.str.val = estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_BAD_CHARACTER; - break; - } - return T_CHARACTER; -} - - -["'`]+ { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - - -["] { - BEGIN(ST_IN_SCRIPTING); - return '\"'; -} - - -[`] { - BEGIN(ST_IN_SCRIPTING); - return '`'; -} - - -['] { - BEGIN(ST_IN_SCRIPTING); - return '\''; -} - - -<> { - return 0; -} - -<> { - zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line)); - return 0; -} - - - -{ANY_CHAR} { - zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); -} diff --git a/Zend/zend_list.c b/Zend/zend_list.c deleted file mode 100644 index d165190c05..0000000000 --- a/Zend/zend_list.c +++ /dev/null @@ -1,368 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -/* resource lists */ - -#include "zend.h" -#include "zend_list.h" -#include "zend_API.h" -#include "zend_globals.h" - -ZEND_API int le_index_ptr; - -/* true global */ -static HashTable list_destructors; - - -ZEND_API int zend_list_insert(void *ptr, int type) -{ - int index; - zend_rsrc_list_entry le; - TSRMLS_FETCH(); - - le.ptr=ptr; - le.type=type; - le.refcount=1; - - index = zend_hash_next_free_element(&EG(regular_list)); - - zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL); - return index; -} - -ZEND_API int _zend_list_delete(int id TSRMLS_DC) -{ - zend_rsrc_list_entry *le; - - if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) { -/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */ - if (--le->refcount<=0) { - return zend_hash_index_del(&EG(regular_list), id); - } else { - return SUCCESS; - } - } else { - return FAILURE; - } -} - - -ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC) -{ - zend_rsrc_list_entry *le; - - if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) { - *type = le->type; - return le->ptr; - } else { - *type = -1; - return NULL; - } -} - -ZEND_API int _zend_list_addref(int id TSRMLS_DC) -{ - zend_rsrc_list_entry *le; - - if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) { -/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */ - le->refcount++; - return SUCCESS; - } else { - return FAILURE; - } -} - - -ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type) -{ - int rsrc_id; - - rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type); - - if (rsrc_result) { - rsrc_result->value.lval = rsrc_id; - rsrc_result->type = IS_RESOURCE; - } - - return rsrc_id; -} - - -ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...) -{ - int id; - int actual_resource_type; - void *resource; - va_list resource_types; - int i; - - if (default_id==-1) { /* use id */ - if (!passed_id) { - if (resource_type_name) { - zend_error(E_WARNING, "%s(): no %s resource supplied", get_active_function_name(TSRMLS_C), resource_type_name); - } - return NULL; - } else if ((*passed_id)->type != IS_RESOURCE) { - if (resource_type_name) { - zend_error(E_WARNING, "%s(): supplied argument is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name); - } - return NULL; - } - id = (*passed_id)->value.lval; - } else { - id = default_id; - } - - resource = zend_list_find(id, &actual_resource_type); - if (!resource) { - if (resource_type_name) { - zend_error(E_WARNING, "%s(): %d is not a valid %s resource", get_active_function_name(TSRMLS_C), id, resource_type_name); - } - return NULL; - } - - va_start(resource_types, num_resource_types); - for (i=0; itype, (void **) &ld)==SUCCESS) { - switch (ld->type) { - case ZEND_RESOURCE_LIST_TYPE_STD: - if (ld->list_dtor) { - (ld->list_dtor)(le->ptr); - } - break; - case ZEND_RESOURCE_LIST_TYPE_EX: - if (ld->list_dtor_ex) { - ld->list_dtor_ex(le TSRMLS_CC); - } - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - } else { - zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)", le->type); - } -} - - -void plist_entry_destructor(void *ptr) -{ - zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr; - zend_rsrc_list_dtors_entry *ld; - TSRMLS_FETCH(); - - if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) { - switch (ld->type) { - case ZEND_RESOURCE_LIST_TYPE_STD: - if (ld->plist_dtor) { - (ld->plist_dtor)(le->ptr); - } - break; - case ZEND_RESOURCE_LIST_TYPE_EX: - if (ld->plist_dtor_ex) { - ld->plist_dtor_ex(le TSRMLS_CC); - } - break; - EMPTY_SWITCH_DEFAULT_CASE() - } - } else { - zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)", le->type); - } -} - - -int zend_init_rsrc_list(TSRMLS_D) -{ - if (zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0)==SUCCESS) { - EG(regular_list).nNextFreeElement=1; /* we don't want resource id 0 */ - return SUCCESS; - } else { - return FAILURE; - } -} - - -int zend_init_rsrc_plist(TSRMLS_D) -{ - return zend_hash_init_ex(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1, 0); -} - - -void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC) -{ - zend_hash_graceful_reverse_destroy(ht); -} - -static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC) -{ - if (le->type == *resource_id) { - return 1; - } else { - return 0; - } -} - - -static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC) -{ - if (ld->module_number == *module_number) { - zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC); - zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC); - return 1; - } else { - return 0; - } -} - - -void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC) -{ - zend_hash_apply_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC); -} - - -ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number) -{ - zend_rsrc_list_dtors_entry lde; - -#if 0 - printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number); -#endif - - lde.list_dtor=(void (*)(void *)) ld; - lde.plist_dtor=(void (*)(void *)) pld; - lde.list_dtor_ex = lde.plist_dtor_ex = NULL; - lde.module_number = module_number; - lde.resource_id = list_destructors.nNextFreeElement; - lde.type = ZEND_RESOURCE_LIST_TYPE_STD; - lde.type_name = NULL; - - if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) { - return FAILURE; - } - return list_destructors.nNextFreeElement-1; -} - - -ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number) -{ - zend_rsrc_list_dtors_entry lde; - -#if 0 - printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number); -#endif - - lde.list_dtor = NULL; - lde.plist_dtor = NULL; - lde.list_dtor_ex = ld; - lde.plist_dtor_ex = pld; - lde.module_number = module_number; - lde.resource_id = list_destructors.nNextFreeElement; - lde.type = ZEND_RESOURCE_LIST_TYPE_EX; - lde.type_name = type_name; - - if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) { - return FAILURE; - } - return list_destructors.nNextFreeElement-1; -} - -ZEND_API int zend_fetch_list_dtor_id(char *type_name) -{ - zend_rsrc_list_dtors_entry *lde; - HashPosition pos; - - zend_hash_internal_pointer_reset_ex(&list_destructors, &pos); - while (zend_hash_get_current_data_ex(&list_destructors, (void **)&lde, &pos) == SUCCESS) { - if (strcmp(type_name, lde->type_name) == 0) { -#if 0 - printf("Found resource id %d for resource type %s\n", (*lde).resource_id, type_name); -#endif - return lde->resource_id; - } - zend_hash_move_forward_ex(&list_destructors, &pos); - } - - return 0; -} - -int zend_init_rsrc_list_dtors(void) -{ - int retval; - - retval = zend_hash_init(&list_destructors, 50, NULL, NULL, 1); - list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */ - - return retval; -} - - -void zend_destroy_rsrc_list_dtors(void) -{ - zend_hash_destroy(&list_destructors); -} - - -char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC) -{ - zend_rsrc_list_dtors_entry *lde; - int rsrc_type; - - if (!zend_list_find(resource, &rsrc_type)) - return NULL; - - if (zend_hash_index_find(&list_destructors, rsrc_type, (void **) &lde)==SUCCESS) { - return lde->type_name; - } else { - return NULL; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_list.h b/Zend/zend_list.h deleted file mode 100644 index 05f5d50bf8..0000000000 --- a/Zend/zend_list.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_LIST_H -#define ZEND_LIST_H - -#include "zend_hash.h" -#include "zend_globals.h" - -BEGIN_EXTERN_C() - -#define ZEND_RESOURCE_LIST_TYPE_STD 1 -#define ZEND_RESOURCE_LIST_TYPE_EX 2 - -typedef struct _zend_rsrc_list_entry { - void *ptr; - int type; - int refcount; -} zend_rsrc_list_entry; - -typedef void (*rsrc_dtor_func_t)(zend_rsrc_list_entry *rsrc TSRMLS_DC); -#define ZEND_RSRC_DTOR_FUNC(name) void name(zend_rsrc_list_entry *rsrc TSRMLS_DC) - -typedef struct _zend_rsrc_list_dtors_entry { - /* old style destructors */ - void (*list_dtor)(void *); - void (*plist_dtor)(void *); - - /* new style destructors */ - rsrc_dtor_func_t list_dtor_ex; - rsrc_dtor_func_t plist_dtor_ex; - - char *type_name; - - int module_number; - int resource_id; - unsigned char type; -} zend_rsrc_list_dtors_entry; - - -#define register_list_destructors(ld, pld) zend_register_list_destructors((void (*)(void *))ld, (void (*)(void *))pld, module_number); -ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number); -ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number); - -void list_entry_destructor(void *ptr); -void plist_entry_destructor(void *ptr); - -void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC); -int zend_init_rsrc_list(TSRMLS_D); -int zend_init_rsrc_plist(TSRMLS_D); -void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC); -int zend_init_rsrc_list_dtors(void); -void zend_destroy_rsrc_list_dtors(void); - -ZEND_API int zend_list_insert(void *ptr, int type); -ZEND_API int _zend_list_addref(int id TSRMLS_DC); -ZEND_API int _zend_list_delete(int id TSRMLS_DC); -ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC); - -#define zend_list_addref(id) _zend_list_addref(id TSRMLS_CC) -#define zend_list_delete(id) _zend_list_delete(id TSRMLS_CC) -#define zend_list_find(id, type) _zend_list_find(id, type TSRMLS_CC) - -ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type); -ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...); - -ZEND_API char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC); -ZEND_API int zend_fetch_list_dtor_id(char *type_name); - -extern ZEND_API int le_index_ptr; /* list entry type for index pointers */ - -#define ZEND_VERIFY_RESOURCE(rsrc) \ - if (!rsrc) { \ - RETURN_NULL(); \ - } - -#define ZEND_FETCH_RESOURCE(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \ - rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type); \ - ZEND_VERIFY_RESOURCE(rsrc); - -#define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1, resource_type2) \ - rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2); \ - ZEND_VERIFY_RESOURCE(rsrc); - -#define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type) \ - zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type); - -#define ZEND_GET_RESOURCE_TYPE_ID(le_id, le_type_name) \ - if (le_id == 0) { \ - le_id = zend_fetch_list_dtor_id(le_type_name); \ - } -END_EXTERN_C() - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c deleted file mode 100644 index 13fab349af..0000000000 --- a/Zend/zend_llist.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_llist.h" -#include "zend_qsort.h" - -ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent) -{ - l->head = NULL; - l->tail = NULL; - l->count = 0; - l->size = size; - l->dtor = dtor; - l->persistent = persistent; -} - - -ZEND_API void zend_llist_add_element(zend_llist *l, void *element) -{ - zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent); - - tmp->prev = l->tail; - tmp->next = NULL; - if (l->tail) { - l->tail->next = tmp; - } else { - l->head = tmp; - } - l->tail = tmp; - memcpy(tmp->data, element, l->size); - - ++l->count; -} - - -ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element) -{ - zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent); - - tmp->next = l->head; - tmp->prev = NULL; - if (l->head) { - l->head->prev = tmp; - } else { - l->tail = tmp; - } - l->head = tmp; - memcpy(tmp->data, element, l->size); - - ++l->count; -} - - -#define DEL_LLIST_ELEMENT(current, l) \ - if ((current)->prev) {\ - (current)->prev->next = (current)->next;\ - } else {\ - (l)->head = (current)->next;\ - }\ - if ((current)->next) {\ - (current)->next->prev = (current)->prev;\ - } else {\ - (l)->tail = (current)->prev;\ - }\ - if ((l)->dtor) {\ - (l)->dtor((current)->data);\ - }\ - pefree((current), (l)->persistent);\ - --l->count; - - -ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2)) -{ - zend_llist_element *current=l->head; - zend_llist_element *next; - - while (current) { - next = current->next; - if (compare(current->data, element)) { - DEL_LLIST_ELEMENT(current, l); - break; - } - current = next; - } -} - - -ZEND_API void zend_llist_destroy(zend_llist *l) -{ - zend_llist_element *current=l->head, *next; - - while (current) { - next = current->next; - if (l->dtor) { - l->dtor(current->data); - } - pefree(current, l->persistent); - current = next; - } - - l->count = 0; -} - - -ZEND_API void zend_llist_clean(zend_llist *l) -{ - zend_llist_destroy(l); - l->head = l->tail = NULL; -} - - -ZEND_API void *zend_llist_remove_tail(zend_llist *l) -{ - zend_llist_element *old_tail; - void *data; - - if ((old_tail = l->tail)) { - if (l->tail->prev) { - l->tail->prev->next = NULL; - } - - data = old_tail->data; - - l->tail = l->tail->prev; - if (l->dtor) { - l->dtor(data); - } - pefree(old_tail, l->persistent); - - --l->count; - - return data; - } - - return NULL; -} - - -ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src) -{ - zend_llist_element *ptr; - - zend_llist_init(dst, src->size, src->dtor, src->persistent); - ptr = src->head; - while (ptr) { - zend_llist_add_element(dst, ptr->data); - ptr = ptr->next; - } -} - - -ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data)) -{ - zend_llist_element *element, *next; - - element=l->head; - while (element) { - next = element->next; - if (func(element->data)) { - DEL_LLIST_ELEMENT(element, l); - } - element = next; - } -} - - -ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC) -{ - zend_llist_element *element; - - for (element=l->head; element; element=element->next) { - func(element->data TSRMLS_CC); - } -} - -ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC) -{ - size_t i; - - zend_llist_element **elements; - zend_llist_element *element, **ptr; - - if (l->count <= 0) { - return; - } - - elements = (zend_llist_element **) emalloc(l->count * sizeof(zend_llist_element *)); - - ptr = &elements[0]; - - for (element=l->head; element; element=element->next) { - *ptr++ = element; - } - - zend_qsort(elements, l->count, sizeof(zend_llist_element *), (compare_func_t) comp_func TSRMLS_CC); - - l->head = elements[0]; - elements[0]->prev = NULL; - - for (i = 1; i < l->count; i++) { - elements[i]->prev = elements[i-1]; - elements[i-1]->next = elements[i]; - } - elements[i-1]->next = NULL; - l->tail = elements[i-1]; - efree(elements); -} - - -ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC) -{ - zend_llist_element *element; - - for (element=l->head; element; element=element->next) { - func(element->data, arg TSRMLS_CC); - } -} - - -ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...) -{ - zend_llist_element *element; - va_list args; - - va_start(args, num_args); - for (element=l->head; element; element=element->next) { - func(element->data, num_args, args TSRMLS_CC); - } - va_end(args); -} - - -ZEND_API int zend_llist_count(zend_llist *l) -{ - return l->count; -} - - -ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos) -{ - zend_llist_position *current = pos ? pos : &l->traverse_ptr; - - *current = l->head; - if (*current) { - return (*current)->data; - } else { - return NULL; - } -} - - -ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos) -{ - zend_llist_position *current = pos ? pos : &l->traverse_ptr; - - *current = l->tail; - if (*current) { - return (*current)->data; - } else { - return NULL; - } -} - - -ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos) -{ - zend_llist_position *current = pos ? pos : &l->traverse_ptr; - - if (*current) { - *current = (*current)->next; - if (*current) { - return (*current)->data; - } - } - return NULL; -} - - -ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos) -{ - zend_llist_position *current = pos ? pos : &l->traverse_ptr; - - if (*current) { - *current = (*current)->prev; - if (*current) { - return (*current)->data; - } - } - return NULL; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h deleted file mode 100644 index f6c25664ba..0000000000 --- a/Zend/zend_llist.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_LLIST_H -#define ZEND_LLIST_H - -typedef struct _zend_llist_element { - struct _zend_llist_element *next; - struct _zend_llist_element *prev; - char data[1]; /* Needs to always be last in the struct */ -} zend_llist_element; - -typedef void (*llist_dtor_func_t)(void *); -typedef int (*llist_compare_func_t)(const zend_llist_element **, const zend_llist_element ** TSRMLS_DC); -typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args TSRMLS_DC); -typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg TSRMLS_DC); -typedef void (*llist_apply_func_t)(void * TSRMLS_DC); - -typedef struct _zend_llist { - zend_llist_element *head; - zend_llist_element *tail; - size_t count; - size_t size; - llist_dtor_func_t dtor; - unsigned char persistent; - zend_llist_element *traverse_ptr; -} zend_llist; - -typedef zend_llist_element* zend_llist_position; - -BEGIN_EXTERN_C() -ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent); -ZEND_API void zend_llist_add_element(zend_llist *l, void *element); -ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element); -ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2)); -ZEND_API void zend_llist_destroy(zend_llist *l); -ZEND_API void zend_llist_clean(zend_llist *l); -ZEND_API void *zend_llist_remove_tail(zend_llist *l); -ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src); -ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC); -ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data)); -ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC); -ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...); -ZEND_API int zend_llist_count(zend_llist *l); -ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC); - -/* traversal */ -ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos); -ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos); -ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos); -ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos); - -#define zend_llist_get_first(l) zend_llist_get_first_ex(l, NULL) -#define zend_llist_get_last(l) zend_llist_get_last_ex(l, NULL) -#define zend_llist_get_next(l) zend_llist_get_next_ex(l, NULL) -#define zend_llist_get_prev(l) zend_llist_get_prev_ex(l, NULL) - -END_EXTERN_C() - -#endif /* ZEND_LLIST_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_mm.c b/Zend/zend_mm.c deleted file mode 100644 index 16ea253556..0000000000 --- a/Zend/zend_mm.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_mm.h" - -#if WIN32|WINNT -# ifndef inline -# define inline __inline -# endif -#endif - -#define ZEND_MM_FREE_BLOCK 0 -#define ZEND_MM_USED_BLOCK 1 - -#ifndef MAX -#define MAX(a, b) (((a)>(b))?(a):(b)) -#endif - -#ifndef ZEND_MM_ALIGNMENT -#define ZEND_MM_ALIGNMENT 8 -#define ZEND_MM_ALIGNMENT_LOG2 3 -#endif - -#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1) - -#define ZEND_MM_BUCKET_INDEX(true_size) (true_size >> ZEND_MM_ALIGNMENT_LOG2) - -#define ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket) \ - if (index < ZEND_MM_NUM_BUCKETS) { \ - free_list_bucket = &heap->free_buckets[index]; \ - } else { \ - /* This size doesn't exist */ \ - free_list_bucket = &heap->free_buckets[0]; \ - } - - -/* Aligned header size */ -#define ZEND_MM_ALIGNED_SIZE(size) ((size + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK) -#define ZEND_MM_ALIGNED_HEADER_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_block)) -#define ZEND_MM_ALIGNED_FREE_HEADER_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_free_block)) -#define ZEND_MM_ALIGNED_SEGMENT_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_segment)) - -/* Memory calculations */ -#define ZEND_MM_BLOCK_AT(blk, offset) ((zend_mm_block *) (((char *) (blk))+(offset))) -#define ZEND_MM_DATA_OF(p) ((void *) (((char *) (p))+ZEND_MM_ALIGNED_HEADER_SIZE)) -#define ZEND_MM_HEADER_OF(blk) ZEND_MM_BLOCK_AT(blk, -(int)ZEND_MM_ALIGNED_HEADER_SIZE) - -/* Debug output */ -#define ZEND_MM_DEBUG(stmt) - - -static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_block *mm_block) -{ - zend_mm_free_block **free_list_bucket; - size_t index = ZEND_MM_BUCKET_INDEX(mm_block->size); - - ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket); - - mm_block->next_free_block = *free_list_bucket; - mm_block->prev_free_block = NULL; - *free_list_bucket = mm_block; - - if (mm_block->next_free_block) { - mm_block->next_free_block->prev_free_block = mm_block; - } -} - - -static inline void zend_mm_remove_from_free_list(zend_mm_heap *heap, zend_mm_free_block *mm_block) -{ - if (mm_block->prev_free_block) { - mm_block->prev_free_block->next_free_block = mm_block->next_free_block; - } else { - zend_mm_free_block **free_list_bucket; - size_t index = ZEND_MM_BUCKET_INDEX(mm_block->size); - - ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket); - - *free_list_bucket = mm_block->next_free_block; - } - - if (mm_block->next_free_block) { - mm_block->next_free_block->prev_free_block = mm_block->prev_free_block; - } -} - -static inline void zend_mm_create_new_free_block(zend_mm_heap *heap, zend_mm_block *mm_block, size_t true_size) -{ - int remaining_size; - zend_mm_free_block *new_free_block; - - /* calculate sizes */ - remaining_size = mm_block->size - true_size; - - if (remaining_size < ZEND_MM_ALIGNED_FREE_HEADER_SIZE) { - /* keep best_fit->size as is, it'll include this extra space */ - return; - } - - /* prepare new free block */ - mm_block->size = true_size; - new_free_block = (zend_mm_free_block *) ZEND_MM_BLOCK_AT(mm_block, mm_block->size); - - new_free_block->type = ZEND_MM_FREE_BLOCK; - new_free_block->size = remaining_size; - new_free_block->prev_size = true_size; - - /* update the next block's prev_size */ - ZEND_MM_BLOCK_AT(new_free_block, new_free_block->size)->prev_size = new_free_block->size; - - /* add the new free block to the free list */ - zend_mm_add_to_free_list(heap, new_free_block); - return; -} - -zend_bool zend_mm_add_memory_block(zend_mm_heap *heap, size_t block_size) -{ - /* We need to make sure that block_size is big enough for the minimum segment size */ - zend_mm_free_block *mm_block; - zend_mm_block *guard_block; - zend_mm_segment *segment; - - /* align block size downwards */ - block_size = block_size & ZEND_MM_ALIGNMENT_MASK; - - segment = (zend_mm_segment *) malloc(block_size); - if (!segment) { - return 1; - } -/* fprintf(stderr, "Allocating segment %X\n", segment); */ - segment->next_segment = heap->segments_list; - heap->segments_list = segment; - - block_size -= ZEND_MM_ALIGNED_SEGMENT_SIZE; - mm_block = (zend_mm_free_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE); - - mm_block->size = block_size - ZEND_MM_ALIGNED_HEADER_SIZE; /* keep one guard block in the end */ - mm_block->type = ZEND_MM_FREE_BLOCK; - mm_block->prev_size = 0; /* Size is always at least ZEND_MM_ALIGNED_HEADER_SIZE big (>0) so 0 is OK */ - - /* setup guard block */ - guard_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size); - guard_block->type = ZEND_MM_USED_BLOCK; - guard_block->size = ZEND_MM_ALIGNED_HEADER_SIZE; - guard_block->guard_block = 1; - guard_block->prev_size = mm_block->size; - ZEND_MM_DEBUG(("Setup guard block at 0x%0.8X\n", guard_block)); - - zend_mm_add_to_free_list(heap, mm_block); - - return 0; -} - -/* Notes: - * - This function may alter the block_sizes values to match platform alignment - * - This function does *not* perform sanity checks on the arguments - */ -zend_bool zend_mm_startup(zend_mm_heap *heap, size_t block_size) -{ - heap->block_size = block_size; - heap->segments_list = NULL; - memset(heap->free_buckets, 0, sizeof(heap->free_buckets)); - return zend_mm_add_memory_block(heap, block_size); -} - - -void zend_mm_shutdown(zend_mm_heap *heap) -{ - zend_mm_segment *segment = heap->segments_list; - zend_mm_segment *prev; - - while (segment) { - prev = segment; - segment = segment->next_segment; -/* fprintf(stderr, "Freeing segment %X\n", prev);*/ - free(prev); - } - heap->segments_list = NULL; -} - -void *zend_mm_alloc(zend_mm_heap *heap, size_t size) -{ - size_t true_size; - zend_mm_free_block *p, *best_fit=NULL; - zend_mm_free_block **free_list_bucket; - size_t index; - - /* The max() can probably be optimized with an if() which checks more specific cases */ - true_size = MAX(ZEND_MM_ALIGNED_SIZE(size)+ZEND_MM_ALIGNED_HEADER_SIZE, ZEND_MM_ALIGNED_FREE_HEADER_SIZE); - - index = ZEND_MM_BUCKET_INDEX(true_size); - - if (index < ZEND_MM_NUM_BUCKETS) { - ZEND_MM_GET_FREE_LIST_BUCKET(index, free_list_bucket); - - while (free_list_bucket != &heap->free_buckets[ZEND_MM_NUM_BUCKETS]) { - if (*free_list_bucket) { - best_fit = *free_list_bucket; - goto zend_mm_finished_searching_for_block; - } - free_list_bucket++; - } - } - - for (p = heap->free_buckets[0]; p; p = p->next_free_block) { - if (p->size == true_size) { - best_fit = p; - break; - } - if ((p->size > true_size) && (!best_fit || (best_fit->size > p->size))) { /* better fit */ - best_fit = p; - } - } - -zend_mm_finished_searching_for_block: - if (!best_fit) { - if (true_size > (heap->block_size - ZEND_MM_ALIGNED_SEGMENT_SIZE - ZEND_MM_ALIGNED_HEADER_SIZE)) { - /* Make sure we add a memory block which is big enough */ - zend_mm_add_memory_block(heap, true_size + ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE); - } else { - zend_mm_add_memory_block(heap, heap->block_size); - } - return zend_mm_alloc(heap, size); - } - - /* mark as used */ - best_fit->type = ZEND_MM_USED_BLOCK; - ((zend_mm_block *) best_fit)->guard_block = 0; - - /* remove from free list */ - zend_mm_remove_from_free_list(heap, best_fit); - - zend_mm_create_new_free_block(heap, (zend_mm_block *) best_fit, true_size); - - return ZEND_MM_DATA_OF(best_fit); -} - - -void zend_mm_free(zend_mm_heap *heap, void *p) -{ - zend_mm_block *mm_block = ZEND_MM_HEADER_OF(p); - zend_mm_block *prev_block, *next_block; - - if (mm_block->type != ZEND_MM_USED_BLOCK) { - /* error */ - return; - } - - next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size); - - /* merge with previous block if empty */ - if (mm_block->prev_size != 0 - && (prev_block=ZEND_MM_BLOCK_AT(mm_block, -(int)mm_block->prev_size))->type == ZEND_MM_FREE_BLOCK) { - zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) prev_block); - prev_block->size += mm_block->size; - mm_block = prev_block; - next_block->prev_size = mm_block->size; - } - - /* merge with the next block if empty */ - if (next_block->type == ZEND_MM_FREE_BLOCK) { - mm_block->size += next_block->size; - zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block); - next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size); /* recalculate */ - next_block->prev_size = mm_block->size; - } - - mm_block->type = ZEND_MM_FREE_BLOCK; - zend_mm_add_to_free_list(heap, (zend_mm_free_block *) mm_block); -} - -void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size) -{ - zend_mm_block *mm_block = ZEND_MM_HEADER_OF(p); - zend_mm_block *next_block; - size_t true_size = MAX(ZEND_MM_ALIGNED_SIZE(size)+ZEND_MM_ALIGNED_HEADER_SIZE, ZEND_MM_ALIGNED_FREE_HEADER_SIZE); - - if (true_size <= mm_block->size) { - zend_mm_create_new_free_block(heap, mm_block, true_size); - /* We don't yet merge this free block with the following one */ - - return p; - } - - next_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size); - - if ((mm_block->prev_size == 0) && (next_block->type == ZEND_MM_USED_BLOCK) && - (next_block->guard_block)) { - zend_mm_segment *segment = (zend_mm_segment *) ((char *)mm_block - ZEND_MM_ALIGNED_SEGMENT_SIZE); - zend_mm_segment *segment_copy = segment; - zend_mm_block *guard_block; - size_t realloc_to_size; - - /* segment size, size of block and size of guard block */ - realloc_to_size = ZEND_MM_ALIGNED_SEGMENT_SIZE+true_size+ZEND_MM_ALIGNED_HEADER_SIZE; - segment = realloc(segment, realloc_to_size); - - if (segment != segment_copy) { - if (heap->segments_list == segment_copy) { - heap->segments_list = segment; - } else { - zend_mm_segment *seg = heap->segments_list; - - while (seg) { - if (seg->next_segment == segment_copy) { - seg->next_segment = segment; - break; - } - seg = seg->next_segment; - } - } - mm_block = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE); - } - - mm_block->size = true_size; - - /* setup guard block */ - guard_block = ZEND_MM_BLOCK_AT(mm_block, mm_block->size); - guard_block->type = ZEND_MM_USED_BLOCK; - guard_block->size = ZEND_MM_ALIGNED_HEADER_SIZE; - guard_block->guard_block = 1; - guard_block->prev_size = mm_block->size; - - return ZEND_MM_DATA_OF(mm_block); - } - - if (next_block->type != ZEND_MM_FREE_BLOCK || (mm_block->size + next_block->size < true_size)) { - void *ptr; - - ptr = zend_mm_alloc(heap, size); - memcpy(ptr, p, mm_block->size - ZEND_MM_ALIGNED_HEADER_SIZE); - zend_mm_free(heap, p); - return ptr; - } - - zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block); - mm_block->size += next_block->size; - /* update the next block's prev_size */ - ZEND_MM_BLOCK_AT(mm_block, mm_block->size)->prev_size = mm_block->size; - - zend_mm_create_new_free_block(heap, mm_block, true_size); - - return p; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_mm.h b/Zend/zend_mm.h deleted file mode 100644 index 2325d47512..0000000000 --- a/Zend/zend_mm.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef _ZEND_MM_H -#define _ZEND_MM_H - -#include - -#include "zend_types.h" - -/* Define this to enable Zend MM */ -#define ZEND_MM - -/* mm block type */ -typedef struct _zend_mm_block { - unsigned int size : 31; - unsigned int type : 1; - size_t prev_size; - unsigned int guard_block : 1; -} zend_mm_block; - -typedef struct _zend_mm_free_block { - unsigned int size : 31; - unsigned int type : 1; - size_t prev_size; - struct _zend_mm_free_block *prev_free_block; - struct _zend_mm_free_block *next_free_block; -} zend_mm_free_block; - -typedef struct _zend_mm_segment { - struct _zend_mm_segment *next_segment; -} zend_mm_segment; - -#define ZEND_MM_NUM_BUCKETS 64 - -typedef struct _zend_mm_heap { - zend_mm_segment *segments_list; - size_t block_size; - zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS]; -} zend_mm_heap; - -zend_bool zend_mm_startup(zend_mm_heap *heap, size_t block_size); -void zend_mm_shutdown(zend_mm_heap *heap); -void *zend_mm_alloc(zend_mm_heap *heap, size_t size); -void zend_mm_free(zend_mm_heap *heap, void *p); -void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size); - -#endif /* _ZEND_MM_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h deleted file mode 100644 index 3722d935ae..0000000000 --- a/Zend/zend_modules.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef MODULES_H -#define MODULES_H - -#include "zend.h" - -#define INIT_FUNC_ARGS int type, int module_number TSRMLS_DC -#define INIT_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC -#define SHUTDOWN_FUNC_ARGS int type, int module_number TSRMLS_DC -#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC -#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC -#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC - -ZEND_API extern unsigned char first_arg_force_ref[]; -ZEND_API extern unsigned char second_arg_force_ref[]; -ZEND_API extern unsigned char third_arg_force_ref[]; - -#define ZEND_MODULE_API_NO 20020429 -#ifdef ZTS -#define USING_ZTS 1 -#else -#define USING_ZTS 0 -#endif - -#define STANDARD_MODULE_HEADER sizeof(zend_module_entry), ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS, NULL -#define ZE2_STANDARD_MODULE_HEADER sizeof(zend_module_entry), ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS, ini_entries - -#define STANDARD_MODULE_PROPERTIES_EX 0, 0, 0, NULL, 0 - -#define STANDARD_MODULE_PROPERTIES \ - NULL, NULL, STANDARD_MODULE_PROPERTIES_EX - -#define NO_VERSION_YET NULL - -#define MODULE_PERSISTENT 1 -#define MODULE_TEMPORARY 2 - -struct _zend_ini_entry; -typedef struct _zend_module_entry zend_module_entry; - -struct _zend_module_entry { - unsigned short size; - unsigned int zend_api; - unsigned char zend_debug; - unsigned char zts; - struct _zend_ini_entry *ini_entry; - char *name; - zend_function_entry *functions; - int (*module_startup_func)(INIT_FUNC_ARGS); - int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); - int (*request_startup_func)(INIT_FUNC_ARGS); - int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); - void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); - char *version; - int (*global_startup_func)(void); - int (*global_shutdown_func)(void); - int globals_id; - int module_started; - unsigned char type; - void *handle; - int module_number; -}; - - -extern ZEND_API HashTable module_registry; - -void module_destructor(zend_module_entry *module); -int module_registry_cleanup(zend_module_entry *module TSRMLS_DC); -int module_registry_request_startup(zend_module_entry *module TSRMLS_DC); - -#define ZEND_MODULE_DTOR (void (*)(void *)) module_destructor -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h deleted file mode 100644 index be41e588c3..0000000000 --- a/Zend/zend_multiply.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 2003 Sascha Schumann | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sascha Schumann | - +----------------------------------------------------------------------+ -*/ - -#if defined(__i386__) && defined(__GNUC__) - -#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ - __asm__ ("imul %3,%0\n" \ - "adc $0,%1" \ - : "=r"(lval),"=r"(usedval) \ - : "0"(a), "r"(b), "1"(0)); \ - if (usedval) (dval) = (double) (a) * (double) (b); \ -} while (0) - -#else - -#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ - double __tmpvar = (double) (a) * (double) (b); \ - \ - if (__tmpvar >= LONG_MAX || __tmpvar <= LONG_MIN) { \ - (dval) = __tmpvar; \ - (usedval) = 1; \ - } else { \ - (lval) = (a) * (b); \ - (usedval) = 0; \ - } \ -} while (0) - -#endif diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c deleted file mode 100644 index 759967bec5..0000000000 --- a/Zend/zend_object_handlers.c +++ /dev/null @@ -1,843 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_globals.h" -#include "zend_variables.h" -#include "zend_API.h" -#include "zend_objects.h" -#include "zend_objects_API.h" -#include "zend_object_handlers.h" - -#define DEBUG_OBJECT_HANDLERS 0 - -#define Z_OBJ_P(zval_p) zend_objects_get_address(zval_p TSRMLS_CC) - -/* - __X accessors explanation: - - if we have __get and property that is not part of the properties array is - requested, we call __get handler. If it fails, we return uninitialized. - - if we have __set and property that is not part of the properties array is - set, we call __set handler. If it fails, we do not change the array. - - for both handlers above, when we are inside __get/__set, no further calls for - __get/__set for these objects will be made, to prevent endless recursion and - enable accessors to change properties array. - - if we have __call and method which is not part of the class function table is - called, we cal __call handler. -*/ - -static HashTable *zend_std_get_properties(zval *object TSRMLS_DC) -{ - zend_object *zobj; - zobj = Z_OBJ_P(object); - return zobj->properties; -} - -static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) -{ - zval **call_args[1]; - zval *retval = NULL; - zval __get_name; - int call_result; - - /* __get handler is called with two arguments: - property name - return value for the object (by reference) - - it should return whether the call was successfull or not - */ - INIT_PZVAL(&__get_name); - ZVAL_STRINGL(&__get_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1, 0); - - call_args[0] = &member; - - /* go call the __get handler */ - call_result = call_user_function_ex(NULL, - &object, - &__get_name, - &retval, - 1, call_args, - 0, NULL TSRMLS_CC); - - /* - call_result is if call_user_function gone OK. - retval returns the value that is received - */ - - - if (call_result == FAILURE) { - zend_error(E_ERROR, "Could not call __get handler for class %s", Z_OBJCE_P(object)->name); - return NULL; - } - - retval->refcount--; - - return retval; -} - -static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC) -{ - zval **call_args[2]; - zval *retval = NULL; - zval __set_name; - int call_result; - int ret; - - /* __set handler is called with two arguments: - property name - value to be set - - it should return whether the call was successfull or not - */ - INIT_PZVAL(&__set_name); - ZVAL_STRINGL(&__set_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1, 0); - - call_args[0] = &member; - value->refcount++; - call_args[1] = &value; - - /* go call the __set handler */ - call_result = call_user_function_ex(NULL, - &object, - &__set_name, - &retval, - 2, call_args, - 0, NULL TSRMLS_CC); - - /* - call_result is if call_user_function gone OK. - retval shows if __get method went OK. - */ - - - if (call_result == FAILURE) { - zend_error(E_ERROR, "Could not call __set handler for class %s", Z_OBJCE_P(object)->name); - return FAILURE; - } - - zval_ptr_dtor(&value); - - if (retval && zval_is_true(retval)) { - ret = SUCCESS; - } else { - ret = FAILURE; - } - - if (retval) { - zval_ptr_dtor(&retval); - } - - return ret; -} - - -inline int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce TSRMLS_DC) -{ - switch (property_info->flags & ZEND_ACC_PPP_MASK) { - case ZEND_ACC_PUBLIC: - return 1; - case ZEND_ACC_PROTECTED: - while (ce) { - if (ce==EG(scope)) { - return 1; - } - ce = ce->parent; - } - return 0; - case ZEND_ACC_PRIVATE: - if (ce==EG(scope)) { - return 1; - } else { - return 0; - } - break; - } - return 0; -} - -static inline zend_property_info *zend_get_property_info(zend_object *zobj, zval *member TSRMLS_DC) -{ - zend_property_info *property_info = NULL; - zend_property_info *scope_property_info; - zend_bool denied_access = 0; - - - ulong h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member)+1); - if (zend_hash_quick_find(&zobj->ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) { - if (zend_verify_property_access(property_info, zobj->ce TSRMLS_CC)) { - if (property_info->flags & ZEND_ACC_CHANGED - && !(property_info->flags & ZEND_ACC_PRIVATE)) { - /* We still need to make sure that we're not in a context - * where the right property is a different 'statically linked' private - * continue checking below... - */ - } else { - return property_info; - } - } else { - /* Try to look in the scope instead */ - denied_access = 1; - } - } - if (EG(scope) != zobj->ce - && EG(scope) - && zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &scope_property_info)==SUCCESS - && scope_property_info->flags & ZEND_ACC_PRIVATE) { - return scope_property_info; - } else if (property_info) { - if (denied_access) { - /* Information was available, but we were denied access. Error out. */ - zend_error(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), zobj->ce->name, Z_STRVAL_P(member)); - } else { - /* fall through, return property_info... */ - } - } else { - EG(std_property_info).flags = ZEND_ACC_PUBLIC; - EG(std_property_info).name = Z_STRVAL_P(member); - EG(std_property_info).name_length = Z_STRLEN_P(member); - EG(std_property_info).h = zend_get_hash_value(EG(std_property_info).name, EG(std_property_info).name_length+1); - property_info = &EG(std_property_info); - } - return property_info; -} - - -zval *zend_std_read_property(zval *object, zval *member TSRMLS_DC) -{ - zend_object *zobj; - zval tmp_member; - zval **retval; - zval *rv = NULL; - zend_property_info *property_info; - - zobj = Z_OBJ_P(object); - - if (member->type != IS_STRING) { - tmp_member = *member; - zval_copy_ctor(&tmp_member); - convert_to_string(&tmp_member); - member = &tmp_member; - } - -#if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member)); -#endif - - property_info = zend_get_property_info(zobj, member TSRMLS_CC); - - if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) { - if (zobj->ce->__get && !zobj->in_get) { - /* have getter - try with it! */ - zobj->in_get = 1; /* prevent circular getting */ - rv = zend_std_call_getter(object, member TSRMLS_CC); - zobj->in_get = 0; - - if (rv) { - retval = &rv; - } else { - retval = &EG(uninitialized_zval_ptr); - } - } else { - zend_error(E_NOTICE,"Undefined property: %s::$%s", zobj->ce->name, Z_STRVAL_P(member)); - retval = &EG(uninitialized_zval_ptr); - } - } - if (member == &tmp_member) { - zval_dtor(member); - } - return *retval; -} - - -static void zend_std_write_property(zval *object, zval *member, zval *value TSRMLS_DC) -{ - zend_object *zobj; - zval tmp_member; - zval **variable_ptr; - int setter_done = 0; - zend_property_info *property_info; - - zobj = Z_OBJ_P(object); - - if (member->type != IS_STRING) { - tmp_member = *member; - zval_copy_ctor(&tmp_member); - convert_to_string(&tmp_member); - member = &tmp_member; - } - - property_info = zend_get_property_info(zobj, member TSRMLS_CC); - - if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &variable_ptr) == SUCCESS) { - if (*variable_ptr == value) { - /* if we already have this value there, we don't actually need to do anything */ - setter_done = 1; - } else { - /* if we are assigning reference, we shouldn't move it, but instead assign variable - to the same pointer */ - if (PZVAL_IS_REF(*variable_ptr)) { - zval_dtor(*variable_ptr); /* old value should be destroyed */ - /* To check: can't *variable_ptr be some system variable like error_zval here? */ - (*variable_ptr)->type = value->type; - (*variable_ptr)->value = value->value; - if (value->refcount>0) { - zval_copy_ctor(*variable_ptr); - } - setter_done = 1; - } - } - } else { - if (zobj->ce->__set && !zobj->in_set) { - zobj->in_set = 1; /* prevent circular setting */ - if (zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) { - /* for now, just ignore it - __set should take care of warnings, etc. */ - } - setter_done = 1; - zobj->in_set = 0; - } - } - - if (!setter_done) { - zval **foo; - - /* if we assign referenced variable, we should separate it */ - value->refcount++; - if (PZVAL_IS_REF(value)) { - SEPARATE_ZVAL(&value); - } - zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &value, sizeof(zval *), (void **) &foo); - } - if (member == &tmp_member) { - zval_dtor(member); - } -} - -static zval **zend_std_get_property_ptr(zval *object, zval *member TSRMLS_DC) -{ - zend_object *zobj; - zval tmp_member; - zval **retval; - zend_property_info *property_info; - - zobj = Z_OBJ_P(object); - - if (member->type != IS_STRING) { - tmp_member = *member; - zval_copy_ctor(&tmp_member); - convert_to_string(&tmp_member); - member = &tmp_member; - } - -#if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member)); -#endif - - property_info = zend_get_property_info(zobj, member TSRMLS_CC); - - if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) { - zval *new_zval; - - if (!zobj->ce->__get) { - /* we don't have getter - will just add it */ - new_zval = &EG(uninitialized_zval); - -/* zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member)); */ - new_zval->refcount++; - zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval); - } else { - /* we do have getter - fail and let it try again with usual get/set */ - retval = NULL; - } - } - if (member == &tmp_member) { - zval_dtor(member); - } - return retval; -} - -static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) -{ - zend_object *zobj; - zval tmp_member; - zend_property_info *property_info; - - zobj = Z_OBJ_P(object); - - if (member->type != IS_STRING) { - tmp_member = *member; - zval_copy_ctor(&tmp_member); - convert_to_string(&tmp_member); - member = &tmp_member; - } - - property_info = zend_get_property_info(zobj, member TSRMLS_CC); - - zend_hash_del(zobj->properties, property_info->name, property_info->name_length+1); - if (member == &tmp_member) { - zval_dtor(member); - } -} - -static void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) -{ - zval ***args; - zend_internal_function *func = (zend_internal_function *)EG(function_state_ptr)->function; - zval method_name, method_args, __call_name; - zval *method_name_ptr, *method_args_ptr; - zval **call_args[2]; - zval *method_result_ptr = NULL; - int i, call_result; - - args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **)); - - if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { - efree(args); - zend_error(E_ERROR, "Cannot get arguments for __call"); - RETURN_FALSE; - } - - method_name_ptr = &method_name; - INIT_PZVAL(method_name_ptr); - ZVAL_STRING(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */ - - method_args_ptr = &method_args; - INIT_PZVAL(method_args_ptr); - array_init(method_args_ptr); - - for(i=0; iname); - } - - /* now destruct all auxiliaries */ - zval_dtor(method_args_ptr); - zval_dtor(method_name_ptr); - - /* destruct the function also, then - we have allocated it in get_method */ - efree(func); -} - -/* Ensures that we're allowed to call a private method. - * Returns the function address that should be called, or NULL - * if no such function exists. - */ -inline zend_function *zend_check_private(zend_function *fbc, zend_class_entry *ce, int fn_flags, char *function_name_strval, int function_name_strlen TSRMLS_DC) -{ - if (!ce) { - return 0; - } - - /* We may call a private function if: - * 1. The class of our object is the same as the scope, and the private - * function (EX(fbc)) has the same scope. - * 2. One of our parent classes are the same as the scope, and it contains - * a private function with the same name that has the same scope. - */ - if (fbc->common.scope == ce && EG(scope) == ce) { - /* rule #1 checks out ok, allow the function call */ - return fbc; - } - - - /* Check rule #2 */ - ce = ce->parent; - while (ce) { - if (ce == EG(scope)) { - if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==SUCCESS - && fbc->op_array.fn_flags & ZEND_ACC_PRIVATE - && fbc->common.scope == EG(scope)) { - return fbc; - } - break; - } - ce = ce->parent; - } - return NULL; -} - - -/* Ensures that we're allowed to call a protected method. - */ -inline int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) -{ - zend_class_entry *fbc_scope = ce; - - /* Is the context that's calling the function, the same as one of - * the function's parents? - */ - while (fbc_scope) { - if (fbc_scope==scope) { - return 1; - } - fbc_scope = fbc_scope->parent; - } - - /* Is the function's scope the same as our current object context, - * or any of the parents of our context? - */ - while (scope) { - if (scope==ce) { - return 1; - } - scope = scope->parent; - } - return 0; -} - - -static union _zend_function *zend_std_get_method(zval *object, char *method_name, int method_len TSRMLS_DC) -{ - zend_object *zobj; - zend_function *fbc; - char *lc_method_name; - - lc_method_name = do_alloca(method_len+1); - /* Create a zend_copy_str_tolower(dest, src, src_length); */ - memcpy(lc_method_name, method_name, method_len+1); - zend_str_tolower(lc_method_name, method_len); - - zobj = Z_OBJ_P(object); - if (zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&fbc) == FAILURE) { - if (zobj->ce->__call) { - zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); - call_user_call->type = ZEND_INTERNAL_FUNCTION; - call_user_call->handler = zend_std_call_user_call; - call_user_call->arg_types = NULL; - call_user_call->scope = zobj->ce; - call_user_call->fn_flags = 0; - call_user_call->function_name = estrndup(method_name, method_len); - - free_alloca(lc_method_name); - return (union _zend_function *)call_user_call; - } else { - return NULL; - } - } - - /* Check access level */ - if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) { - /* Ensure that we haven't overridden a private function and end up calling - * the overriding public function... - */ - if (EG(scope) && fbc->op_array.fn_flags & ZEND_ACC_CHANGED) { - zend_function *priv_fbc; - - if (zend_hash_find(&EG(scope)->function_table, method_name, method_len+1, (void **) &priv_fbc)==SUCCESS - && priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE) { - fbc = priv_fbc; - } - } - } else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) { - zend_function *updated_fbc; - - /* Ensure that if we're calling a private function, we're allowed to do so. - */ - updated_fbc = zend_check_private(fbc, object->value.obj.handlers->get_class_entry(object TSRMLS_CC), fbc->common.fn_flags, method_name, method_len TSRMLS_CC); - if (!updated_fbc) { - zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : ""); - } - fbc = updated_fbc; - } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) { - /* Ensure that if we're calling a protected function, we're allowed to do so. - */ - if (!zend_check_protected(fbc->common.scope, EG(scope))) { - zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : ""); - } - } - - free_alloca(lc_method_name); - return fbc; -} - - -/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */ -zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) -{ - zend_function *fbc; - - if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) { - char *class_name = ce->name; - - if (!class_name) { - class_name = ""; - } - zend_error(E_ERROR, "Call to undefined method %s::%s()", class_name, function_name_strval); - } - if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) { - /* No further checks necessary, most common case */ - } else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) { - zend_function *updated_fbc; - - /* Ensure that if we're calling a private function, we're allowed to do so. - */ - updated_fbc = zend_check_private(fbc, EG(scope), fbc->common.fn_flags, function_name_strval, function_name_strlen TSRMLS_CC); - if (!updated_fbc) { - zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : ""); - } - fbc = updated_fbc; - } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) { - /* Ensure that if we're calling a protected function, we're allowed to do so. - */ - if (!zend_check_protected(EG(scope), fbc->common.scope)) { - zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : ""); - } - } - - return fbc; -} - - -zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC) -{ - HashTable *statics_table; - zval **retval = NULL; - zend_class_entry *tmp_ce = ce; - zend_property_info *property_info; - zend_property_info std_property_info; - - if (ce->type == ZEND_USER_NAMESPACE || ce->type == ZEND_INTERNAL_NAMESPACE) { - zend_hash_find(ce->static_members, property_name, property_name_len+1, (void **) &retval); - } else { - if (zend_hash_find(&ce->properties_info, property_name, property_name_len+1, (void **) &property_info)==FAILURE) { - std_property_info.flags = ZEND_ACC_PUBLIC; - std_property_info.name = property_name; - std_property_info.name_length = property_name_len; - std_property_info.h = zend_get_hash_value(std_property_info.name, std_property_info.name_length+1); - property_info = &std_property_info; - } - -#if 1&&DEBUG_OBJECT_HANDLERS - zend_printf("Access type for %s::%s is %s\n", ce->name, property_name, zend_visibility_string(property_info->flags)); -#endif - - if (!zend_verify_property_access(property_info, ce TSRMLS_CC)) { - zend_error(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, property_name); - } - - while (tmp_ce) { - if (zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval)==SUCCESS) { - statics_table = tmp_ce->static_members; - break; - } - tmp_ce = tmp_ce->parent; - } - } - - if (!retval) { - if (silent) { - return NULL; - } else { - zend_error(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name, property_name); - } - } - - zval_update_constant(retval, (void *) 1 TSRMLS_CC); - return retval; -} - - -zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC) -{ - zend_error(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name); - return 0; -} - - -static union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) -{ - zend_object *zobj = Z_OBJ_P(object); - zend_function *constructor = zobj->ce->constructor; - - if (constructor) { - if (constructor->op_array.fn_flags & ZEND_ACC_PUBLIC) { - /* No further checks necessary */ - } else if (constructor->op_array.fn_flags & ZEND_ACC_PRIVATE) { - /* Ensure that if we're calling a private function, we're allowed to do so. - */ - if (object->value.obj.handlers->get_class_entry(object TSRMLS_CC) != EG(scope)) { - zend_error(E_ERROR, "Call to private constructor from context '%s'", EG(scope) ? EG(scope)->name : ""); - } - } else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) { - /* Ensure that if we're calling a protected function, we're allowed to do so. - */ - if (!zend_check_protected(constructor->common.scope, EG(scope))) { - zend_error(E_ERROR, "Call to protected constructor from context '%s'", EG(scope) ? EG(scope)->name : ""); - } - } - } - - return constructor; -} - - -int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC); - - -static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) -{ - zend_object *zobj1, *zobj2; - - zobj1 = Z_OBJ_P(o1); - zobj2 = Z_OBJ_P(o2); - - if (zobj1->ce != zobj2->ce) { - return 1; /* different classes */ - } - return zend_compare_symbol_tables_i(zobj1->properties, zobj2->properties TSRMLS_CC); -} - - -static int zend_std_has_property(zval *object, zval *member, int check_empty TSRMLS_DC) -{ - zend_object *zobj; - int result; - zval **value; - zval tmp_member; - zend_property_info *property_info; - - zobj = Z_OBJ_P(object); - - if (member->type != IS_STRING) { - tmp_member = *member; - zval_copy_ctor(&tmp_member); - convert_to_string(&tmp_member); - member = &tmp_member; - } - -#if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member)); -#endif - - property_info = zend_get_property_info(zobj, member TSRMLS_CC); - - if (zend_hash_find(zobj->properties, property_info->name, property_info->name_length+1, (void **) &value) == SUCCESS) { - if (check_empty) { - result = zend_is_true(*value); - } else { - result = (Z_TYPE_PP(value) != IS_NULL); - } - } else { - result = 0; - } - - if (member == &tmp_member) { - zval_dtor(member); - } - return result; -} - - -zend_class_entry *zend_std_object_get_class(zval *object TSRMLS_DC) -{ - zend_object *zobj; - zobj = Z_OBJ_P(object); - - return zobj->ce; -} - -int zend_std_object_get_class_name(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) -{ - zend_object *zobj; - zend_class_entry *ce; - zobj = Z_OBJ_P(object); - - if (parent) { - if (!zobj->ce->parent) { - return FAILURE; - } - ce = zobj->ce->parent; - } else { - ce = zobj->ce; - } - - zend_make_full_classname(ce, class_name, class_name_len); - return SUCCESS; -} - -zend_object_handlers std_object_handlers = { - zend_objects_store_add_ref, /* add_ref */ - zend_objects_store_del_ref, /* del_ref */ - zend_objects_store_delete_obj, /* delete_obj */ - zend_objects_clone_obj, /* clone_obj */ - - zend_std_read_property, /* read_property */ - zend_std_write_property, /* write_property */ - zend_std_get_property_ptr, /* get_property_ptr */ - zend_std_get_property_ptr, /* get_property_zval_ptr */ - NULL, /* get */ - NULL, /* set */ - zend_std_has_property, /* has_property */ - zend_std_unset_property, /* unset_property */ - zend_std_get_properties, /* get_properties */ - zend_std_get_method, /* get_method */ - NULL, /* call_method */ - zend_std_get_constructor, /* get_constructor */ - zend_std_object_get_class, /* get_class_entry */ - zend_std_object_get_class_name, /* get_class_name */ - zend_std_compare_objects /* compare_objects */ -}; - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h deleted file mode 100644 index 78c9e4fee3..0000000000 --- a/Zend/zend_object_handlers.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_OBJECT_HANDLERS_H -#define ZEND_OBJECT_HANDLERS_H - -union _zend_function; - -typedef zval *(*zend_object_read_property_t)(zval *object, zval *member TSRMLS_DC); -/* Used to fetch property from the object, read-only */ -typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *value TSRMLS_DC); -/* Used to set property of the object */ - -typedef zval **(*zend_object_get_property_ptr_t)(zval *object, zval *member TSRMLS_DC); -/* Used to create pointer to the property of the object, for future r/w access via get/set */ -typedef zval **(*zend_object_get_property_zval_ptr_t)(zval *object, zval *member TSRMLS_DC); -/* Used to create pointer to the property of the object, for future direct r/w access */ -typedef void (*zend_object_set_t)(zval **property, zval *value TSRMLS_DC); -/* Used to set object value (most probably used in combination with -typedef the result of the get_property_ptr) */ -typedef zval* (*zend_object_get_t)(zval *property TSRMLS_DC); -/* Used to get object value (most probably used in combination with -the result of the get_property_ptr or when converting object value to -one of the basic types) */ - -typedef int (*zend_object_has_property_t)(zval *object, zval *member, int check_empty TSRMLS_DC); -/* Used to check if a property of the object exists */ -typedef void (*zend_object_unset_property_t)(zval *object, zval *member TSRMLS_DC); -/* Used to remove a property of the object */ - -typedef HashTable *(*zend_object_get_properties_t)(zval *object TSRMLS_DC); -/* Used to get hash of the properties of the object, as hash of zval's */ - -typedef int (*zend_object_call_method_t)(char *method, INTERNAL_FUNCTION_PARAMETERS); -/* Used to call methods */ -/* args on stack! */ -/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback fror this. -*/ -typedef union _zend_function *(*zend_object_get_method_t)(zval *object, char *method, int method_len TSRMLS_DC); -typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC); -/* Get method parameter mask - by value/by reference, etc. */ - -/* Object maintenance/destruction */ -typedef void (*zend_object_add_ref_t)(zval *object TSRMLS_DC); -typedef void (*zend_object_del_ref_t)(zval *object TSRMLS_DC); -typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC); -typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC); - -typedef zend_class_entry *(*zend_object_get_class_entry_t)(zval *object TSRMLS_DC); -typedef int (*zend_object_get_class_name_t)(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC); -typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC); - -typedef struct _zend_object_handlers { - /* general object functions */ - zend_object_add_ref_t add_ref; - zend_object_del_ref_t del_ref; - zend_object_delete_obj_t delete_obj; - zend_object_clone_obj_t clone_obj; - /* individual object functions */ - zend_object_read_property_t read_property; - zend_object_write_property_t write_property; - zend_object_get_property_ptr_t get_property_ptr; - zend_object_get_property_zval_ptr_t get_property_zval_ptr; - zend_object_get_t get; - zend_object_set_t set; - zend_object_has_property_t has_property; - zend_object_unset_property_t unset_property; - zend_object_get_properties_t get_properties; - zend_object_get_method_t get_method; - zend_object_call_method_t call_method; - zend_object_get_constructor_t get_constructor; - zend_object_get_class_entry_t get_class_entry; - zend_object_get_class_name_t get_class_name; - zend_object_compare_t compare_objects; -} zend_object_handlers; - -extern zend_object_handlers std_object_handlers; -union _zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC); -zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC); -zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC); - - -#define IS_ZEND_STD_OBJECT(z) ((z).type == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL)) -#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL) - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c deleted file mode 100644 index 51d402c4e4..0000000000 --- a/Zend/zend_objects.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_globals.h" -#include "zend_variables.h" -#include "zend_API.h" - -static inline void zend_objects_call_destructor(zend_object *object, zend_object_handle handle TSRMLS_DC) -{ - if (object->ce->destructor) { - zval *obj; - zval *destructor_func_name; - zval *retval_ptr; - HashTable symbol_table; - - MAKE_STD_ZVAL(obj); - obj->type = IS_OBJECT; - obj->value.obj.handle = handle; - obj->value.obj.handlers = &std_object_handlers; - zval_copy_ctor(obj); - - - /* FIXME: Optimize this so that we use the old_object->ce->destructor function pointer instead of the name */ - MAKE_STD_ZVAL(destructor_func_name); - destructor_func_name->type = IS_STRING; - destructor_func_name->value.str.val = estrndup("__destruct", sizeof("__destruct")-1); - destructor_func_name->value.str.len = sizeof("__destruct")-1; - - ZEND_INIT_SYMTABLE(&symbol_table); - - call_user_function_ex(NULL, &obj, destructor_func_name, &retval_ptr, 0, NULL, 0, &symbol_table TSRMLS_CC); - - zend_hash_destroy(&symbol_table); - zval_ptr_dtor(&obj); - zval_ptr_dtor(&destructor_func_name); - if (retval_ptr) { - zval_ptr_dtor(&retval_ptr); - } - } -} - - -ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC) -{ - zend_objects_call_destructor(object, handle TSRMLS_CC); - /* Nuke the object */ - zend_hash_destroy(object->properties); - FREE_HASHTABLE(object->properties); - efree(object); -} - -ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC) -{ - zend_object_value retval; - - *object = emalloc(sizeof(zend_object)); - (*object)->ce = class_type; - retval.handle = zend_objects_store_put(*object, (zend_objects_store_dtor_t) zend_objects_destroy_object, NULL TSRMLS_CC); - retval.handlers = &std_object_handlers; - (*object)->in_get = 0; - (*object)->in_set = 0; - return retval; -} - -ZEND_API zend_object *zend_objects_get_address(zval *zobject TSRMLS_DC) -{ - return (zend_object *)zend_object_store_get_object(zobject TSRMLS_CC); -} - -ZEND_API zend_object_value zend_objects_clone_obj(zval *zobject TSRMLS_DC) -{ - zend_object_value retval; - zend_object *old_object; - zend_object *new_object; - zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); - - old_object = zend_objects_get_address(zobject TSRMLS_CC); - retval = zend_objects_new(&new_object, old_object->ce TSRMLS_CC); - - if (old_object->ce->clone) { - zval *old_obj; - zval *new_obj; - zval *clone_func_name; - zval *retval_ptr; - HashTable symbol_table; - - MAKE_STD_ZVAL(new_obj); - new_obj->type = IS_OBJECT; - new_obj->value.obj = retval; - zval_copy_ctor(new_obj); - - MAKE_STD_ZVAL(old_obj); - old_obj->type = IS_OBJECT; - old_obj->value.obj.handle = handle; - old_obj->value.obj.handlers = &std_object_handlers; /* If we reached here than the handlers are standrd */ - zval_copy_ctor(old_obj); - - /* FIXME: Optimize this so that we use the old_object->ce->clone function pointer instead of the name */ - MAKE_STD_ZVAL(clone_func_name); - clone_func_name->type = IS_STRING; - clone_func_name->value.str.val = estrndup("__clone", sizeof("__clone")-1); - clone_func_name->value.str.len = sizeof("__clone")-1; - - ALLOC_HASHTABLE(new_object->properties); - zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0); - - ZEND_INIT_SYMTABLE(&symbol_table); - ZEND_SET_SYMBOL(&symbol_table, "that", old_obj); - - call_user_function_ex(NULL, &new_obj, clone_func_name, &retval_ptr, 0, NULL, 0, &symbol_table TSRMLS_CC); - - zend_hash_destroy(&symbol_table); - zval_ptr_dtor(&new_obj); - zval_ptr_dtor(&clone_func_name); - zval_ptr_dtor(&retval_ptr); - } else { - ALLOC_HASHTABLE(new_object->properties); - zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *)); - } - - return retval; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h deleted file mode 100644 index 5c4d080913..0000000000 --- a/Zend/zend_objects.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_OBJECTS_H -#define ZEND_OBJECTS_H - -#include "zend.h" - -ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC); -ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC); -ZEND_API zend_object *zend_objects_get_address(zval *object TSRMLS_DC); -ZEND_API zend_object_value zend_objects_clone_obj(zval *object TSRMLS_DC); - -#endif /* ZEND_OBJECTS_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c deleted file mode 100644 index 7bc297b391..0000000000 --- a/Zend/zend_objects_API.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_globals.h" -#include "zend_variables.h" -#include "zend_API.h" -#include "zend_objects_API.h" - -#define ZEND_DEBUG_OBJECTS 0 - -ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size) -{ - objects->object_buckets = (zend_object_store_bucket *) emalloc(init_size * sizeof(zend_object_store_bucket)); - objects->top = 1; /* Skip 0 so that handles are true */ - objects->size = init_size; - objects->free_list_head = -1; -} - -ZEND_API void zend_objects_store_destroy(zend_objects_store *objects) -{ - efree(objects->object_buckets); -} - -ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC) -{ - zend_uint i = 1; - - for (i = 1; i < objects->top ; i++) { - if (objects->object_buckets[i].valid) { - struct _store_object *obj = &objects->object_buckets[i].bucket.obj; - if (obj->dtor && !objects->object_buckets[i].destructor_called) { - objects->object_buckets[i].destructor_called = 1; - obj->dtor(obj->object, i TSRMLS_CC); - } - objects->object_buckets[i].valid = 0; - } - } -} - -/* Store objects API */ - -ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_store_clone_t clone TSRMLS_DC) -{ - zend_object_handle handle; - struct _store_object *obj; - - if (EG(objects_store).free_list_head != -1) { - handle = EG(objects_store).free_list_head; - EG(objects_store).free_list_head = EG(objects_store).object_buckets[handle].bucket.free_list.next; - } else { - if (EG(objects_store).top == EG(objects_store).size) { - EG(objects_store).size <<= 1; - EG(objects_store).object_buckets = (zend_object_store_bucket *) erealloc(EG(objects_store).object_buckets, EG(objects_store).size * sizeof(zend_object_store_bucket)); - } - handle = EG(objects_store).top++; - } - obj = &EG(objects_store).object_buckets[handle].bucket.obj; - EG(objects_store).object_buckets[handle].valid = 1; - EG(objects_store).object_buckets[handle].destructor_called = 0; - - obj->refcount = 1; - obj->object = object; - obj->dtor = dtor; - obj->clone = clone; - -#if ZEND_DEBUG_OBJECTS - fprintf(stderr, "Allocated object id #%d\n", handle); -#endif - return handle; -} - -ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC) -{ - zend_object_handle handle = Z_OBJ_HANDLE_P(object); - - if (!EG(objects_store).object_buckets[handle].valid) { - zend_error(E_ERROR, "Trying to add reference to invalid object"); - } - - EG(objects_store).object_buckets[handle].bucket.obj.refcount++; -#if ZEND_DEBUG_OBJECTS - fprintf(stderr, "Increased refcount of object id #%d\n", handle); -#endif -} - -ZEND_API void zend_objects_store_delete_obj(zval *zobject TSRMLS_DC) -{ - zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); - struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj; - - if (!EG(objects_store).object_buckets[handle].valid) { - zend_error(E_ERROR, "Trying to delete invalid object"); - } - - - if (obj->dtor && !EG(objects_store).object_buckets[handle].destructor_called) { - EG(objects_store).object_buckets[handle].destructor_called = 1; - obj->dtor(obj->object, handle TSRMLS_CC); - } - EG(objects_store).object_buckets[handle].valid = 0; - -#if ZEND_DEBUG_OBJECTS - fprintf(stderr, "Deleted object id #%d\n", handle); -#endif - -} - -#define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \ - EG(objects_store).object_buckets[handle].bucket.free_list.next = EG(objects_store).free_list_head; \ - EG(objects_store).free_list_head = handle; \ - EG(objects_store).object_buckets[handle].valid = 0; - -ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) -{ - zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); - struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj; - - if (--obj->refcount == 0) { - if (EG(objects_store).object_buckets[handle].valid) { - if (!EG(objects_store).object_buckets[handle].destructor_called) { - EG(objects_store).object_buckets[handle].destructor_called = 1; - if (obj->dtor) { - obj->dtor(obj->object, handle TSRMLS_CC); - } - EG(objects_store).object_buckets[handle].valid = 0; - if (obj->refcount == 0) { - ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(); - } - } - } -#if ZEND_DEBUG_OBJECTS - fprintf(stderr, "Deallocated object id #%d\n", handle); -#endif - } -#if ZEND_DEBUG_OBJECTS - else { - fprintf(stderr, "Decreased refcount of object id #%d\n", handle); - } -#endif -} - -ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC) -{ - zend_object_value retval; - void *new_object; - struct _store_object *obj; - zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); - - if (!EG(objects_store).object_buckets[handle].valid) { - zend_error(E_ERROR, "Trying to clone invalid object"); - } - obj = &EG(objects_store).object_buckets[handle].bucket.obj; - - if (obj->clone == NULL) { - zend_error(E_ERROR, "Trying to clone uncloneable object"); - } - - obj->clone(obj->object, &new_object TSRMLS_CC); - - retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->clone TSRMLS_CC); - retval.handlers = Z_OBJ_HT_P(zobject); - - return retval; -} - -ZEND_API void *zend_object_store_get_object(zval *zobject TSRMLS_DC) -{ - zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); - - if (!EG(objects_store).object_buckets[handle].valid) { - zend_error(E_ERROR, "Trying to access invalid object"); - return NULL; - } - - return EG(objects_store).object_buckets[handle].bucket.obj.object; -} - - -/* Proxy objects workings */ -typedef struct _zend_proxy_object { - zval *object; - zval *property; -} zend_proxy_object; - -static zend_object_handlers zend_object_proxy_handlers; - -ZEND_API void zend_objects_proxy_dtor(zend_proxy_object *object, zend_object_handle handle TSRMLS_DC) -{ - zval_ptr_dtor(&object->object); - zval_ptr_dtor(&object->property); - efree(object); -} - -ZEND_API void zend_objects_proxy_clone(zend_proxy_object *object, zend_proxy_object **object_clone TSRMLS_DC) -{ - *object_clone = emalloc(sizeof(zend_proxy_object)); - (*object_clone)->object = object->object; - (*object_clone)->property = object->property; - zval_add_ref(&(*object_clone)->property); - zval_add_ref(&(*object_clone)->object); -} - -ZEND_API zval **zend_object_create_proxy(zval *object, zval *member TSRMLS_DC) -{ - zend_proxy_object *pobj = emalloc(sizeof(zend_proxy_object)); - zval *retval, **pretval; - - pobj->object = object; - pobj->property = member; - zval_add_ref(&pobj->property); - zval_add_ref(&pobj->object); - - MAKE_STD_ZVAL(retval); - retval->type = IS_OBJECT; - Z_OBJ_HANDLE_P(retval) = zend_objects_store_put(pobj, (zend_objects_store_dtor_t)zend_objects_proxy_dtor, (zend_objects_store_clone_t)zend_objects_proxy_clone TSRMLS_CC); - Z_OBJ_HT_P(retval) = &zend_object_proxy_handlers; - pretval = emalloc(sizeof(zval *)); - *pretval = retval; - - return pretval; -} - -ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC) -{ - zend_proxy_object *probj = zend_object_store_get_object(*property TSRMLS_CC); - - if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->write_property) { - Z_OBJ_HT_P(probj->object)->write_property(probj->object, probj->property, value TSRMLS_CC); - } else { - zend_error(E_WARNING, "Cannot write property of object - no write handler defined"); - } -} - -ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC) -{ - zend_proxy_object *probj = zend_object_store_get_object(property TSRMLS_CC); - - if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->read_property) { - return Z_OBJ_HT_P(probj->object)->read_property(probj->object, probj->property TSRMLS_CC); - } else { - zend_error(E_WARNING, "Cannot read property of object - no read handler defined"); - } - - return NULL; -} - -ZEND_API zend_object_handlers *zend_get_std_object_handlers() -{ - return &std_object_handlers; -} - -static zend_object_handlers zend_object_proxy_handlers = { - ZEND_OBJECTS_STORE_HANDLERS, - - NULL, /* read_property */ - NULL, /* write_property */ - NULL, /* get_property_ptr */ - NULL, /* get_property_zval_ptr */ - zend_object_proxy_get, /* get */ - zend_object_proxy_set, /* set */ - NULL, /* has_property */ - NULL, /* unset_property */ - NULL, /* get_properties */ - NULL, /* get_method */ - NULL, /* call_method */ - NULL, /* get_constructor */ - NULL, /* get_class_entry */ - NULL, /* get_class_name */ - NULL /* compare_objects */ -}; - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h deleted file mode 100644 index 362dddd83e..0000000000 --- a/Zend/zend_objects_API.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_OBJECTS_API_H -#define ZEND_OBJECTS_API_H - -#include "zend.h" - -typedef void (*zend_objects_store_dtor_t)(void *object, zend_object_handle handle TSRMLS_DC); -typedef void (*zend_objects_store_clone_t)(void *object, void **object_clone TSRMLS_DC); - -typedef struct _zend_object_store_bucket { - zend_bool destructor_called; - zend_bool valid; - union _store_bucket { - struct _store_object { - void *object; - zend_objects_store_dtor_t dtor; - zend_objects_store_clone_t clone; - zend_uint refcount; - } obj; - struct { - int next; - } free_list; - } bucket; -} zend_object_store_bucket; - -typedef struct _zend_objects_store { - zend_object_store_bucket *object_buckets; - zend_uint top; - zend_uint size; - int free_list_head; -} zend_objects_store; - -/* Global store handling functions */ -ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size); -ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC); -ZEND_API void zend_objects_store_destroy(zend_objects_store *objects); - -/* Store API functions */ -ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_store_clone_t clone TSRMLS_DC); - -ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC); -ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC); -ZEND_API void zend_objects_store_delete_obj(zval *object TSRMLS_DC); -ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC); -ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC); - -#define ZEND_OBJECTS_STORE_HANDLERS zend_objects_store_add_ref, zend_objects_store_del_ref, zend_objects_store_delete_obj, zend_objects_store_clone_obj - -ZEND_API zval **zend_object_create_proxy(zval *object, zval *member TSRMLS_DC); - -ZEND_API zend_object_handlers *zend_get_std_object_handlers(); -#endif /* ZEND_OBJECTS_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c deleted file mode 100644 index af9ff1450e..0000000000 --- a/Zend/zend_opcode.c +++ /dev/null @@ -1,508 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include - -#include "zend.h" -#include "zend_alloc.h" -#include "zend_compile.h" -#include "zend_extensions.h" -#include "zend_API.h" - - -static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) -{ - if (extension->op_array_ctor) { - extension->op_array_ctor(op_array); - } -} - - -static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) -{ - if (extension->op_array_dtor) { - extension->op_array_dtor(op_array); - } -} - - -static void op_array_alloc_ops(zend_op_array *op_array) -{ - op_array->opcodes = erealloc(op_array->opcodes, (op_array->size)*sizeof(zend_op)); -} - - - -void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC) -{ - op_array->type = type; - - op_array->backpatch_count = 0; - if (CG(interactive)) { - /* We must avoid a realloc() on the op_array in interactive mode, since pointers to constants - * will become invalid - */ - initial_ops_size = 8192; - } - - op_array->refcount = (zend_uint *) emalloc(sizeof(zend_uint)); - *op_array->refcount = 1; - op_array->size = initial_ops_size; - op_array->last = 0; - op_array->opcodes = NULL; - op_array_alloc_ops(op_array); - - op_array->T = 0; - - op_array->function_name = NULL; - op_array->filename = zend_get_compiled_filename(TSRMLS_C); - op_array->doc_comment = NULL; - op_array->doc_comment_len = 0; - - op_array->arg_types = NULL; - - op_array->scope = NULL; - op_array->ns = NULL; - - op_array->brk_cont_array = NULL; - op_array->last_brk_cont = 0; - op_array->current_brk_cont = -1; - - op_array->static_variables = NULL; - - op_array->return_reference = 0; - op_array->done_pass_two = 0; - - op_array->uses_this = 0; - - op_array->start_op = NULL; - - zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC); -} - - -ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC) -{ - switch (function->type) { - case ZEND_USER_FUNCTION: - destroy_op_array((zend_op_array *) function TSRMLS_CC); - break; - case ZEND_INTERNAL_FUNCTION: - /* do nothing */ - break; - } -} - -static void zend_cleanup_op_array_data(zend_op_array *op_array) -{ - if (op_array->static_variables) { - zend_hash_clean(op_array->static_variables); - } -} - -ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC) -{ - if(function->type == ZEND_USER_FUNCTION) { - zend_cleanup_op_array_data((zend_op_array *) function); - } - return 0; -} - -ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC) -{ - if((*pce)->type == ZEND_USER_CLASS) { - /* Clean all parts that can contain run-time data */ - /* Note that only run-time accessed data need to be cleaned up, pre-defined data can - not contain objects and thus are not probelmatic */ - zend_hash_clean((*pce)->static_members); - zend_hash_apply(&(*pce)->class_table, (apply_func_t) zend_cleanup_class_data TSRMLS_CC); - zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data TSRMLS_CC); - } - return 0; -} - -ZEND_API void destroy_zend_class(zend_class_entry **pce) -{ - zend_class_entry *ce = *pce; - - if (--ce->refcount > 0) { - return; - } - switch (ce->type) { - case ZEND_USER_CLASS: - zend_hash_destroy(&ce->default_properties); - zend_hash_destroy(&ce->properties_info); - zend_hash_destroy(ce->static_members); - efree(ce->name); - zend_hash_destroy(&ce->function_table); - FREE_HASHTABLE(ce->static_members); - zend_hash_destroy(&ce->constants_table); - zend_hash_destroy(&ce->class_table); - if (ce->num_interfaces > 0) { - efree(ce->interfaces); - } - if (ce->doc_comment) { - efree(ce->doc_comment); - } - efree(ce); - break; - case ZEND_INTERNAL_CLASS: - zend_hash_destroy(&ce->default_properties); - zend_hash_destroy(&ce->properties_info); - zend_hash_destroy(ce->static_members); - free(ce->name); - zend_hash_destroy(&ce->function_table); - free(ce->static_members); - zend_hash_destroy(&ce->constants_table); - zend_hash_destroy(&ce->class_table); - if (ce->num_interfaces > 0) { - free(ce->interfaces); - } - if (ce->doc_comment) { - free(ce->doc_comment); - } - free(ce); - break; - case ZEND_USER_NAMESPACE: - case ZEND_INTERNAL_NAMESPACE: - destroy_zend_namespace(pce); - break; - } -} - -ZEND_API void destroy_zend_namespace(zend_namespace **pns) -{ - zend_namespace *ns = *pns; - switch (ns->type) { - case ZEND_USER_NAMESPACE: - zend_hash_destroy(&ns->function_table); - zend_hash_destroy(&ns->class_table); - zend_hash_destroy(&ns->constants_table); - zend_hash_destroy(ns->static_members); - FREE_HASHTABLE(ns->static_members); - if (ns->doc_comment) { - efree(ns->doc_comment); - } - efree(ns->name); - efree(ns); - break; - - case ZEND_INTERNAL_NAMESPACE: - zend_hash_destroy(&ns->function_table); - zend_hash_destroy(&ns->class_table); - zend_hash_destroy(&ns->constants_table); - zend_hash_destroy(ns->static_members); - free(ns->static_members); - free(ns->name); - free(ns); - break; - } -} - -void zend_class_add_ref(zend_class_entry **ce) -{ - (*ce)->refcount++; -} - - -ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC) -{ - zend_op *opline = op_array->opcodes; - zend_op *end = op_array->opcodes+op_array->last; - - if (op_array->static_variables) { - zend_hash_destroy(op_array->static_variables); - FREE_HASHTABLE(op_array->static_variables); - } - - if (--(*op_array->refcount)>0) { - return; - } - - efree(op_array->refcount); - - while (oplineop1.op_type==IS_CONST) { -#if DEBUG_ZEND>2 - printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op1.u.constant); -#endif - zval_dtor(&opline->op1.u.constant); - } - if (opline->op2.op_type==IS_CONST) { -#if DEBUG_ZEND>2 - printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op2.u.constant); -#endif - zval_dtor(&opline->op2.u.constant); - } - opline++; - } - efree(op_array->opcodes); - if (op_array->function_name) { - efree(op_array->function_name); - } - if (op_array->doc_comment) { - efree(op_array->doc_comment); - } - if (op_array->arg_types) { - efree(op_array->arg_types); - } - if (op_array->brk_cont_array) { - efree(op_array->brk_cont_array); - } - if (op_array->done_pass_two) { - zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array TSRMLS_CC); - } -} - - -void init_op(zend_op *op TSRMLS_DC) -{ - memset(&op->result, 0, sizeof(znode)); - op->lineno = CG(zend_lineno); - SET_UNUSED(op->result); - op->extended_value = 0; - memset(&op->op1, 0, sizeof(znode)); - memset(&op->op2, 0, sizeof(znode)); -} - -zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC) -{ - zend_uint next_op_num = op_array->last++; - zend_op *next_op; - - if (next_op_num >= op_array->size) { - if (CG(interactive)) { - /* we messed up */ - zend_printf("Ran out of opcode space!\n" - "You should probably consider writing this huge script into a file!\n"); - zend_bailout(); - } - op_array->size *= 4; - op_array_alloc_ops(op_array); - } - - next_op = &(op_array->opcodes[next_op_num]); - - init_op(next_op TSRMLS_CC); - - return next_op; -} - - -int get_next_op_number(zend_op_array *op_array) -{ - return op_array->last; -} - - - - -zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array) -{ - op_array->last_brk_cont++; - op_array->brk_cont_array = erealloc(op_array->brk_cont_array, sizeof(zend_brk_cont_element)*op_array->last_brk_cont); - return &op_array->brk_cont_array[op_array->last_brk_cont-1]; -} - - -static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC) -{ - zend_op *opline = op_array->opcodes, *end=opline+op_array->last; - - while (oplineopcode == ZEND_EXT_STMT) { - if (opline+1opcode == ZEND_EXT_STMT) { - opline->opcode = ZEND_NOP; - opline++; - continue; - } - if (opline+1lineno = (opline+1)->lineno; - } - } else { - opline->opcode = ZEND_NOP; - } - } - opline++; - } -} - - - -static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) -{ - if (extension->op_array_handler) { - extension->op_array_handler(op_array); - } -} - - -int pass_two(zend_op_array *op_array TSRMLS_DC) -{ - zend_op *opline, *end; - - if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) { - return 0; - } - if (CG(extended_info)) { - zend_update_extended_info(op_array TSRMLS_CC); - } - if (CG(handle_op_arrays)) { - zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC); - } - - op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last); - op_array->size = op_array->last; - - opline = op_array->opcodes; - end = opline + 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; - } - switch (opline->opcode) { - case ZEND_JMP: - opline->op1.u.jmp_addr = &op_array->opcodes[opline->op1.u.opline_num]; - break; - case ZEND_JMPZ: - case ZEND_JMPNZ: - case ZEND_JMPZ_EX: - case ZEND_JMPNZ_EX: - opline->op2.u.jmp_addr = &op_array->opcodes[opline->op2.u.opline_num]; - break; - } - opline->handler = zend_opcode_handlers[opline->opcode]; - opline++; - } - - op_array->done_pass_two = 1; - return 0; -} - - -int print_class(zend_class_entry *class_entry TSRMLS_DC) -{ - printf("Class %s:\n", class_entry->name); - zend_hash_apply(&class_entry->function_table, (apply_func_t) pass_two TSRMLS_CC); - printf("End of class %s.\n\n", class_entry->name); - return 0; -} - -ZEND_API unary_op_type get_unary_op(int opcode) -{ - switch (opcode) { - case ZEND_BW_NOT: - return (unary_op_type) bitwise_not_function; - break; - case ZEND_BOOL_NOT: - return (unary_op_type) boolean_not_function; - break; - default: - return (unary_op_type) NULL; - break; - } -} - - -ZEND_API void *get_binary_op(int opcode) -{ - switch (opcode) { - case ZEND_ADD: - case ZEND_ASSIGN_ADD: - return (void *) add_function; - break; - case ZEND_SUB: - case ZEND_ASSIGN_SUB: - return (void *) sub_function; - break; - case ZEND_MUL: - case ZEND_ASSIGN_MUL: - return (void *) mul_function; - break; - case ZEND_DIV: - case ZEND_ASSIGN_DIV: - return (void *) div_function; - break; - case ZEND_MOD: - case ZEND_ASSIGN_MOD: - return (void *) mod_function; - break; - case ZEND_SL: - case ZEND_ASSIGN_SL: - return (void *) shift_left_function; - break; - case ZEND_SR: - case ZEND_ASSIGN_SR: - return (void *) shift_right_function; - break; - case ZEND_CONCAT: - case ZEND_ASSIGN_CONCAT: - return (void *) concat_function; - break; - case ZEND_IS_IDENTICAL: - return (void *) is_identical_function; - break; - case ZEND_IS_NOT_IDENTICAL: - return (void *) is_not_identical_function; - break; - case ZEND_IS_EQUAL: - return (void *) is_equal_function; - break; - case ZEND_IS_NOT_EQUAL: - return (void *) is_not_equal_function; - break; - case ZEND_IS_SMALLER: - return (void *) is_smaller_function; - break; - case ZEND_IS_SMALLER_OR_EQUAL: - return (void *) is_smaller_or_equal_function; - break; - case ZEND_BW_OR: - case ZEND_ASSIGN_BW_OR: - return (void *) bitwise_or_function; - break; - case ZEND_BW_AND: - case ZEND_ASSIGN_BW_AND: - return (void *) bitwise_and_function; - break; - case ZEND_BW_XOR: - case ZEND_ASSIGN_BW_XOR: - return (void *) bitwise_xor_function; - break; - default: - return (void *) NULL; - break; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c deleted file mode 100644 index 5a216afc93..0000000000 --- a/Zend/zend_operators.c +++ /dev/null @@ -1,1801 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include - -#include "zend.h" -#include "zend_operators.h" -#include "zend_variables.h" -#include "zend_globals.h" -#include "zend_list.h" -#include "zend_fast_cache.h" -#include "zend_API.h" - -#if 0&&WITH_BCMATH -#include "ext/bcmath/number.h" -#endif - -ZEND_API int zend_atoi(const char *str, int str_len) -{ - int retval; - - if (!str_len) { - str_len = strlen(str); - } - retval = strtol(str, NULL, 0); - if (str_len>0) { - switch (str[str_len-1]) { - case 'k': - case 'K': - retval *= 1024; - break; - case 'm': - case 'M': - retval *= 1048576; - break; - } - } - return retval; -} - - -ZEND_API double zend_string_to_double(const char *number, zend_uint length) -{ - double divisor = 10.0; - double result = 0.0; - double exponent; - const char *end = number+length; - const char *digit = number; - - if (!length) { - return result; - } - - while (digit < end) { - if ((*digit <= '9' && *digit >= '0')) { - result *= 10; - result += *digit - '0'; - } else if (*digit == '.') { - digit++; - break; - } else if (toupper(*digit) == 'E') { - exponent = (double) atoi(digit+1); - result *= pow(10.0, exponent); - return result; - } else { - return result; - } - digit++; - } - - while (digit < end) { - if ((*digit <= '9' && *digit >= '0')) { - result += (*digit - '0') / divisor; - divisor *= 10; - } else if (toupper(*digit) == 'E') { - exponent = (double) atoi(digit+1); - result *= pow(10.0, exponent); - return result; - } else { - return result; - } - digit++; - } - return result; -} - - -ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) -{ - switch (op->type) { - case IS_STRING: - { - char *strval; - - strval = op->value.str.val; - switch ((op->type=is_numeric_string(strval, op->value.str.len, &op->value.lval, &op->value.dval, 1))) { - case IS_DOUBLE: - case IS_LONG: - break; -#if 0 && WITH_BCMATH - case FLAG_IS_BC: - op->type = IS_DOUBLE; /* may have lost significant digits */ - break; -#endif - default: - op->value.lval = strtol(op->value.str.val, NULL, 10); - op->type = IS_LONG; - break; - } - STR_FREE(strval); - break; - } - case IS_BOOL: - op->type = IS_LONG; - break; - case IS_RESOURCE: - zend_list_delete(op->value.lval); - op->type = IS_LONG; - break; - case IS_NULL: - op->type = IS_LONG; - op->value.lval = 0; - break; - } -} - -#define zendi_convert_scalar_to_number(op, holder, result) \ - if (op==result) { \ - convert_scalar_to_number(op TSRMLS_CC); \ - } else { \ - switch ((op)->type) { \ - case IS_STRING: \ - { \ - switch (((holder).type=is_numeric_string((op)->value.str.val, (op)->value.str.len, &(holder).value.lval, &(holder).value.dval, 1))) { \ - case IS_DOUBLE: \ - case IS_LONG: \ - break; \ - case FLAG_IS_BC: \ - (holder).type = IS_DOUBLE; /* may have lost significant digits */ \ - break; \ - default: \ - (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \ - (holder).type = IS_LONG; \ - break; \ - } \ - (op) = &(holder); \ - break; \ - } \ - case IS_BOOL: \ - case IS_RESOURCE: \ - (holder).value.lval = (op)->value.lval; \ - (holder).type = IS_LONG; \ - (op) = &(holder); \ - break; \ - case IS_NULL: \ - (holder).value.lval = 0; \ - (holder).type = IS_LONG; \ - (op) = &(holder); \ - break; \ - } \ - } - - -#define DVAL_TO_LVAL(d, l) (l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d) - -#define zendi_convert_to_long(op, holder, result) \ - if (op==result) { \ - convert_to_long(op); \ - } else if ((op)->type != IS_LONG) { \ - switch ((op)->type) { \ - case IS_NULL: \ - (holder).value.lval = 0; \ - break; \ - case IS_DOUBLE: \ - DVAL_TO_LVAL((op)->value.dval, (holder).value.lval); \ - break; \ - case IS_STRING: \ - (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \ - break; \ - case IS_ARRAY: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \ - break; \ - case IS_OBJECT: \ - (holder).value.lval = 1; /* TBI!! */ \ - break; \ - case IS_BOOL: \ - case IS_RESOURCE: \ - (holder).value.lval = (op)->value.lval; \ - break; \ - default: \ - zend_error(E_WARNING, "Cannot convert to ordinal value"); \ - (holder).value.lval = 0; \ - break; \ - } \ - (holder).type = IS_LONG; \ - (op) = &(holder); \ - } - - -#define zendi_convert_to_boolean(op, holder, result) \ - if (op==result) { \ - convert_to_boolean(op); \ - } else if ((op)->type != IS_BOOL) { \ - switch ((op)->type) { \ - case IS_NULL: \ - (holder).value.lval = 0; \ - break; \ - case IS_RESOURCE: \ - case IS_LONG: \ - (holder).value.lval = ((op)->value.lval ? 1 : 0); \ - break; \ - case IS_DOUBLE: \ - (holder).value.lval = ((op)->value.dval ? 1 : 0); \ - break; \ - case IS_STRING: \ - if ((op)->value.str.len == 0 \ - || ((op)->value.str.len==1 && (op)->value.str.val[0]=='0')) { \ - (holder).value.lval = 0; \ - } else { \ - (holder).value.lval = 1; \ - } \ - break; \ - case IS_ARRAY: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \ - break; \ - case IS_OBJECT: \ - (holder).value.lval = 1; /* TBI!! */ \ - break; \ - default: \ - (holder).value.lval = 0; \ - break; \ - } \ - (holder).type = IS_BOOL; \ - (op) = &(holder); \ - } - - -ZEND_API void convert_to_long(zval *op) -{ - convert_to_long_base(op, 10); -} - - -ZEND_API void convert_to_long_base(zval *op, int base) -{ - char *strval; - long tmp; - - switch (op->type) { - case IS_NULL: - op->value.lval = 0; - break; - case IS_RESOURCE: { - TSRMLS_FETCH(); - - zend_list_delete(op->value.lval); - } - /* break missing intentionally */ - case IS_BOOL: - case IS_LONG: - break; - case IS_DOUBLE: - DVAL_TO_LVAL(op->value.dval, op->value.lval); - break; - case IS_STRING: - strval = op->value.str.val; - op->value.lval = strtol(strval, NULL, base); - STR_FREE(strval); - break; - case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); - zval_dtor(op); - op->value.lval = tmp; - break; - case IS_OBJECT: - zval_dtor(op); - op->value.lval = 1; /* TBI!! */ - break; - default: - zend_error(E_WARNING, "Cannot convert to ordinal value"); - zval_dtor(op); - op->value.lval = 0; - break; - } - - op->type = IS_LONG; -} - - -ZEND_API void convert_to_double(zval *op) -{ - char *strval; - double tmp; - - switch (op->type) { - case IS_NULL: - op->value.dval = 0.0; - break; - case IS_RESOURCE: { - TSRMLS_FETCH(); - - zend_list_delete(op->value.lval); - } - /* break missing intentionally */ - case IS_BOOL: - case IS_LONG: - op->value.dval = (double) op->value.lval; - break; - case IS_DOUBLE: - break; - case IS_STRING: - strval = op->value.str.val; - - op->value.dval = strtod(strval, NULL); - STR_FREE(strval); - break; - case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); - zval_dtor(op); - op->value.dval = tmp; - break; - case IS_OBJECT: - zval_dtor(op); - op->value.dval = 1; /* TBI!! */ - break; - default: - zend_error(E_WARNING, "Cannot convert to real value (type=%d)", op->type); - zval_dtor(op); - op->value.dval = 0; - break; - } - op->type = IS_DOUBLE; -} - - -ZEND_API void convert_to_null(zval *op) -{ - zval_dtor(op); - op->type = IS_NULL; -} - - -ZEND_API void convert_to_boolean(zval *op) -{ - char *strval; - int tmp; - - switch (op->type) { - case IS_BOOL: - break; - case IS_NULL: - op->value.lval = 0; - break; - case IS_RESOURCE: { - TSRMLS_FETCH(); - - zend_list_delete(op->value.lval); - } - /* break missing intentionally */ - case IS_LONG: - op->value.lval = (op->value.lval ? 1 : 0); - break; - case IS_DOUBLE: - op->value.lval = (op->value.dval ? 1 : 0); - break; - case IS_STRING: - strval = op->value.str.val; - - if (op->value.str.len == 0 - || (op->value.str.len==1 && op->value.str.val[0]=='0')) { - op->value.lval = 0; - } else { - op->value.lval = 1; - } - STR_FREE(strval); - break; - case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); - zval_dtor(op); - op->value.lval = tmp; - break; - case IS_OBJECT: - zval_dtor(op); - op->value.lval = 1; /* TBI!! */ - break; - default: - zval_dtor(op); - op->value.lval = 0; - break; - } - op->type = IS_BOOL; -} - - -ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) -{ - long lval; - double dval; - TSRMLS_FETCH(); - - switch (op->type) { - case IS_NULL: - op->value.str.val = empty_string; - op->value.str.len = 0; - break; - case IS_STRING: - break; - case IS_BOOL: - if (op->value.lval) { - op->value.str.val = estrndup_rel("1", 1); - op->value.str.len = 1; - } else { - op->value.str.val = empty_string; - op->value.str.len = 0; - } - break; - case IS_RESOURCE: { - long tmp = op->value.lval; - - zend_list_delete(op->value.lval); - op->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG); - op->value.str.len = sprintf(op->value.str.val, "Resource id #%ld", tmp); - break; - } - case IS_LONG: - lval = op->value.lval; - - op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_LONG + 1); - op->value.str.len = zend_sprintf(op->value.str.val, "%ld", lval); /* SAFE */ - break; - case IS_DOUBLE: { - dval = op->value.dval; - op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); - op->value.str.len = zend_sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); /* SAFE */ - /* %G already handles removing trailing zeros from the fractional part, yay */ - break; - } - case IS_ARRAY: - zval_dtor(op); - op->value.str.val = estrndup_rel("Array", sizeof("Array")-1); - op->value.str.len = sizeof("Array")-1; - zend_error(E_NOTICE, "Array to string conversion"); - break; - case IS_OBJECT: - zval_dtor(op); - op->value.str.val = estrndup_rel("Object", sizeof("Object")-1); - op->value.str.len = sizeof("Object")-1; - zend_error(E_NOTICE, "Object to string conversion"); - break; - default: - zval_dtor(op); - ZVAL_BOOL(op, 0); - break; - } - op->type = IS_STRING; -} - - -static void convert_scalar_to_array(zval *op, int type) -{ - zval *entry; - - ALLOC_ZVAL(entry); - *entry = *op; - INIT_PZVAL(entry); - - switch (type) { - case IS_ARRAY: - ALLOC_HASHTABLE(op->value.ht); - zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_index_update(op->value.ht, 0, (void *) &entry, sizeof(zval *), NULL); - op->type = IS_ARRAY; - break; - case IS_OBJECT: - { - /* OBJECTS_OPTIMIZE */ - TSRMLS_FETCH(); - - object_init(op); - zend_hash_update(Z_OBJPROP_P(op), "scalar", sizeof("scalar"), (void *) &entry, sizeof(zval *), NULL); - } - break; - } -} - - -ZEND_API void convert_to_array(zval *op) -{ - TSRMLS_FETCH(); - - switch (op->type) { - case IS_ARRAY: - return; - break; -/* OBJECTS_OPTIMIZE */ - case IS_OBJECT: - { - zval *tmp; - HashTable *ht; - - ALLOC_HASHTABLE(ht); - zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0); - if (Z_OBJ_HT_P(op)->get_properties) { - zend_hash_copy(ht, Z_OBJ_HT_P(op)->get_properties(op TSRMLS_CC), (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); - } - zval_dtor(op); - op->type = IS_ARRAY; - op->value.ht = ht; - } - return; - case IS_NULL: - ALLOC_HASHTABLE(op->value.ht); - zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0); - op->type = IS_ARRAY; - break; - default: - convert_scalar_to_array(op, IS_ARRAY); - break; - } -} - - -ZEND_API void convert_to_object(zval *op) -{ - switch (op->type) { - case IS_ARRAY: - { - /* OBJECTS_OPTIMIZE */ - TSRMLS_FETCH(); - - object_and_properties_init(op, zend_standard_class_def, op->value.ht); - return; - break; - } - case IS_OBJECT: - return; - case IS_NULL: - { - /* OBJECTS_OPTIMIZE */ - TSRMLS_FETCH(); - - object_init(op); - break; - } - default: - convert_scalar_to_array(op, IS_OBJECT); - break; - } -} - -ZEND_API void multi_convert_to_long_ex(int argc, ...) -{ - zval **arg; - va_list ap; - - va_start(ap, argc); - - while (argc--) { - arg = va_arg(ap, zval **); - convert_to_long_ex(arg); - } - - va_end(ap); -} - -ZEND_API void multi_convert_to_double_ex(int argc, ...) -{ - zval **arg; - va_list ap; - - va_start(ap, argc); - - while (argc--) { - arg = va_arg(ap, zval **); - convert_to_double_ex(arg); - } - - va_end(ap); -} - -ZEND_API void multi_convert_to_string_ex(int argc, ...) -{ - zval **arg; - va_list ap; - - va_start(ap, argc); - - while (argc--) { - arg = va_arg(ap, zval **); - convert_to_string_ex(arg); - } - - va_end(ap); -} - -ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) { - zval *tmp; - - if ((result == op1) && (result == op2)) { - /* $a += $a */ - return SUCCESS; - } - if (result != op1) { - *result = *op1; - zval_copy_ctor(result); - } - zend_hash_merge(result->value.ht, op2->value.ht, (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); - return SUCCESS; - } - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - double dval = (double) op1->value.lval + (double) op2->value.lval; - - if ((dval > (double) LONG_MAX) || (dval < (double) LONG_MIN)) { - result->value.dval = dval; - result->type = IS_DOUBLE; - } else { - result->value.lval = op1->value.lval + op2->value.lval; - result->type = IS_LONG; - } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) + op2->value.dval) : - (op1->value.dval + ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval + op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - - -ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - double dval = (double) op1->value.lval - (double) op2->value.lval; - - if ((dval < (double) LONG_MIN) || (dval > (double) LONG_MAX)) { - result->value.dval = dval; - result->type = IS_DOUBLE; - } else { - result->value.lval = op1->value.lval - op2->value.lval; - result->type = IS_LONG; - } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) - op2->value.dval) : - (op1->value.dval - ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval - op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - - -ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - double dval = (double) op1->value.lval * (double) op2->value.lval; - - if ((dval > (double) LONG_MAX) || (dval < (double) LONG_MIN)) { - result->value.dval = dval; - result->type = IS_DOUBLE; - } else { - result->value.lval = op1->value.lval * op2->value.lval; - result->type = IS_LONG; - } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) * op2->value.dval) : - (op1->value.dval * ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval * op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - -ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if ((op2->type == IS_LONG && op2->value.lval == 0) || (op2->type == IS_DOUBLE && op2->value.dval == 0.0)) { - zend_error(E_WARNING, "Division by zero"); - ZVAL_BOOL(result, 0); - return FAILURE; /* division by zero */ - } - if (op1->type == IS_LONG && op2->type == IS_LONG) { - if (op1->value.lval % op2->value.lval == 0) { /* integer */ - result->type = IS_LONG; - result->value.lval = op1->value.lval / op2->value.lval; - } else { - result->type = IS_DOUBLE; - result->value.dval = ((double) op1->value.lval) / op2->value.lval; - } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) / op2->value.dval) : - (op1->value.dval / ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval / op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - - -ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - - if (op2->value.lval == 0) { - ZVAL_BOOL(result, 0); - return FAILURE; /* modulus by zero */ - } - - result->type = IS_LONG; - result->value.lval = op1->value.lval % op2->value.lval; - return SUCCESS; -} - - - -ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - result->type = IS_BOOL; - - zendi_convert_to_boolean(op1, op1_copy, result); - zendi_convert_to_boolean(op2, op2_copy, result); - result->value.lval = op1->value.lval ^ op2->value.lval; - return SUCCESS; -} - - -ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) -{ - zval op1_copy; - - zendi_convert_to_boolean(op1, op1_copy, result); - - result->type = IS_BOOL; - result->value.lval = !op1->value.lval; - return SUCCESS; -} - - -ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) -{ - zval op1_copy = *op1; - - op1 = &op1_copy; - - if (op1->type == IS_DOUBLE) { - op1->value.lval = (long) op1->value.dval; - op1->type = IS_LONG; - } - if (op1->type == IS_LONG) { - result->value.lval = ~op1->value.lval; - result->type = IS_LONG; - return SUCCESS; - } - if (op1->type == IS_STRING) { - int i; - - result->type = IS_STRING; - result->value.str.val = estrndup(op1->value.str.val, op1->value.str.len); - result->value.str.len = op1->value.str.len; - for (i = 0; i < op1->value.str.len; i++) { - result->value.str.val[i] = ~op1->value.str.val[i]; - } - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - - -ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zval *longer, *shorter; - char *result_str; - int i, result_len; - - if (op1->value.str.len >= op2->value.str.len) { - longer = op1; - shorter = op2; - } else { - longer = op2; - shorter = op1; - } - - result->type = IS_STRING; - result_len = longer->value.str.len; - result_str = estrndup(longer->value.str.val, longer->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] |= shorter->value.str.val[i]; - } - if (result==op1) { - STR_FREE(result->value.str.val); - } - result->value.str.val = result_str; - result->value.str.len = result_len; - return SUCCESS; - } - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - - result->type = IS_LONG; - result->value.lval = op1->value.lval | op2->value.lval; - return SUCCESS; -} - - -ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zval *longer, *shorter; - char *result_str; - int i, result_len; - - if (op1->value.str.len >= op2->value.str.len) { - longer = op1; - shorter = op2; - } else { - longer = op2; - shorter = op1; - } - - result->type = IS_STRING; - result_len = shorter->value.str.len; - result_str = estrndup(shorter->value.str.val, shorter->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] &= longer->value.str.val[i]; - } - if (result==op1) { - STR_FREE(result->value.str.val); - } - result->value.str.val = result_str; - result->value.str.len = result_len; - return SUCCESS; - } - - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - - result->type = IS_LONG; - result->value.lval = op1->value.lval & op2->value.lval; - return SUCCESS; -} - - -ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zval *longer, *shorter; - char *result_str; - int i, result_len; - - if (op1->value.str.len >= op2->value.str.len) { - longer = op1; - shorter = op2; - } else { - longer = op2; - shorter = op1; - } - - result->type = IS_STRING; - result_len = shorter->value.str.len; - result_str = estrndup(shorter->value.str.val, shorter->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] ^= longer->value.str.val[i]; - } - if (result==op1) { - STR_FREE(result->value.str.val); - } - result->value.str.val = result_str; - result->value.str.len = result_len; - return SUCCESS; - } - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - - result->type = IS_LONG; - result->value.lval = op1->value.lval ^ op2->value.lval; - return SUCCESS; -} - - -ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - result->value.lval = op1->value.lval << op2->value.lval; - result->type = IS_LONG; - return SUCCESS; -} - - -ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - result->value.lval = op1->value.lval >> op2->value.lval; - result->type = IS_LONG; - return SUCCESS; -} - - - -/* must support result==op1 */ -ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) -{ - result->value.str.len = op1->value.str.len + 1; - result->value.str.val = (char *) erealloc(op1->value.str.val, result->value.str.len+1); - result->value.str.val[result->value.str.len - 1] = (char) op2->value.lval; - result->value.str.val[result->value.str.len] = 0; - result->type = IS_STRING; - return SUCCESS; -} - - -/* must support result==op1 */ -ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2) -{ - int length = op1->value.str.len + op2->value.str.len; - if (op1->value.str.val == empty_string) { - result->value.str.val = (char *) emalloc(length+1); - } else { - result->value.str.val = (char *) erealloc(op1->value.str.val, length+1); - } - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[length] = 0; - result->value.str.len = length; - result->type = IS_STRING; - return SUCCESS; -} - - -ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - int use_copy1, use_copy2; - - - zend_make_printable_zval(op1, &op1_copy, &use_copy1); - zend_make_printable_zval(op2, &op2_copy, &use_copy2); - - if (use_copy1) { - op1 = &op1_copy; - } - if (use_copy2) { - op2 = &op2_copy; - } - if (result==op1) { /* special case, perform operations on result */ - uint res_len = op1->value.str.len + op2->value.str.len; - - if (result->value.str.len == 0) { /* handle empty_string */ - STR_FREE(result->value.str.val); - result->value.str.val = emalloc(res_len+1); - } else { - result->value.str.val = erealloc(result->value.str.val, res_len+1); - } - memcpy(result->value.str.val+result->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[res_len]=0; - result->value.str.len = res_len; - } else { - result->value.str.len = op1->value.str.len + op2->value.str.len; - result->value.str.val = (char *) emalloc(result->value.str.len + 1); - memcpy(result->value.str.val, op1->value.str.val, op1->value.str.len); - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[result->value.str.len] = 0; - result->type = IS_STRING; - } - if (use_copy1) { - zval_dtor(op1); - } - if (use_copy2) { - zval_dtor(op2); - } - return SUCCESS; -} - - -ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - int use_copy1, use_copy2; - - zend_make_printable_zval(op1, &op1_copy, &use_copy1); - zend_make_printable_zval(op2, &op2_copy, &use_copy2); - - if (use_copy1) { - op1 = &op1_copy; - } - if (use_copy2) { - op2 = &op2_copy; - } - - result->value.lval = zend_binary_zval_strcmp(op1, op2); - result->type = IS_LONG; - - if (use_copy1) { - zval_dtor(op1); - } - if (use_copy2) { - zval_dtor(op2); - } - return SUCCESS; -} - -ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - op1_copy = *op1; - zval_copy_ctor(&op1_copy); - - op2_copy = *op2; - zval_copy_ctor(&op2_copy); - - convert_to_double(&op1_copy); - convert_to_double(&op2_copy); - - result->value.lval = ZEND_NORMALIZE_BOOL(op1_copy.value.dval-op2_copy.value.dval); - result->type = IS_LONG; - - return SUCCESS; -} - - -ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - zval op1_copy, op2_copy; - - if ((op1->type == IS_NULL && op2->type == IS_STRING) - || (op2->type == IS_NULL && op1->type == IS_STRING)) { - if (op1->type == IS_NULL) { - result->type = IS_LONG; - result->value.lval = zend_binary_strcmp("", 0, op2->value.str.val, op2->value.str.len); - return SUCCESS; - } else { - result->type = IS_LONG; - result->value.lval = zend_binary_strcmp(op1->value.str.val, op1->value.str.len, "", 0); - return SUCCESS; - } - } - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zendi_smart_strcmp(result, op1, op2); - return SUCCESS; - } - - if (op1->type == IS_BOOL || op2->type == IS_BOOL - || op1->type == IS_NULL || op2->type == IS_NULL) { - zendi_convert_to_boolean(op1, op1_copy, result); - zendi_convert_to_boolean(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = ZEND_NORMALIZE_BOOL(op1->value.lval-op2->value.lval); - return SUCCESS; - } - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - result->type = IS_LONG; - result->value.lval = op1->value.lval>op2->value.lval?1:(op1->value.lvalvalue.lval?-1:0); - return SUCCESS; - } - if ((op1->type == IS_DOUBLE || op1->type == IS_LONG) - && (op2->type == IS_DOUBLE || op2->type == IS_LONG)) { - result->value.dval = (op1->type == IS_LONG ? (double) op1->value.lval : op1->value.dval) - (op2->type == IS_LONG ? (double) op2->value.lval : op2->value.dval); - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval); - result->type = IS_LONG; - return SUCCESS; - } - if (op1->type==IS_ARRAY && op2->type==IS_ARRAY) { - zend_compare_arrays(result, op1, op2 TSRMLS_CC); - return SUCCESS; - } - - if (op1->type==IS_OBJECT && op2->type==IS_OBJECT) { - zend_compare_objects(result, op1, op2 TSRMLS_CC); - return SUCCESS; - } - - if (op1->type==IS_ARRAY) { - result->value.lval = 1; - result->type = IS_LONG; - return SUCCESS; - } - if (op2->type==IS_ARRAY) { - result->value.lval = -1; - result->type = IS_LONG; - return SUCCESS; - } - if (op1->type==IS_OBJECT) { - result->value.lval = 1; - result->type = IS_LONG; - return SUCCESS; - } - if (op2->type==IS_OBJECT) { - result->value.lval = -1; - result->type = IS_LONG; - return SUCCESS; - } - - ZVAL_BOOL(result, 0); - return FAILURE; -} - - -static int hash_zval_identical_function(const zval **z1, const zval **z2) -{ - zval result; - TSRMLS_FETCH(); - - /* is_identical_function() returns 1 in case of identity and 0 in case - * of a difference; - * whereas this comparison function is expected to return 0 on identity, - * and non zero otherwise. - */ - if (is_identical_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) { - return 1; - } - return !result.value.lval; -} - - -ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - result->type = IS_BOOL; - if (op1->type != op2->type) { - result->value.lval = 0; - return SUCCESS; - } - switch (op1->type) { - case IS_NULL: - result->value.lval = (op2->type==IS_NULL); - break; - case IS_BOOL: - case IS_LONG: - case IS_RESOURCE: - result->value.lval = (op1->value.lval == op2->value.lval); - break; - case IS_DOUBLE: - result->value.lval = (op1->value.dval == op2->value.dval); - break; - case IS_STRING: - if ((op1->value.str.len == op2->value.str.len) - && (!memcmp(op1->value.str.val, op2->value.str.val, op1->value.str.len))) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - break; - case IS_ARRAY: - if (zend_hash_compare(op1->value.ht, op2->value.ht, (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - break; - case IS_OBJECT: - if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2) && Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - break; - default: - ZVAL_BOOL(result, 0); - return FAILURE; - } - return SUCCESS; -} - - -ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - result->type = IS_BOOL; - if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) { - return FAILURE; - } - result->value.lval = !result->value.lval; - return SUCCESS; -} - - -ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { - return FAILURE; - } - convert_to_boolean(result); - if (result->value.lval == 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; -} - - -ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { - return FAILURE; - } - convert_to_boolean(result); - if (result->value.lval) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; -} - - -ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { - return FAILURE; - } - if (result->type == IS_LONG) { - result->type = IS_BOOL; - if (result->value.lval < 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - if (result->type == IS_DOUBLE) { - result->type = IS_BOOL; - if (result->value.dval < 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; -} - - -ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) -{ - if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { - return FAILURE; - } - if (result->type == IS_LONG) { - result->type = IS_BOOL; - if (result->value.lval <= 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - if (result->type == IS_DOUBLE) { - result->type = IS_BOOL; - if (result->value.dval <= 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; -} - - -ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC) -{ - zend_uint i; - - while (instance_ce) { - if (instance_ce == ce) { - return 1; - } - for (i=0; inum_interfaces; i++) { - - if (instanceof_function(instance_ce->interfaces[i], ce TSRMLS_CC)) { - return 1; - } - } - instance_ce = instance_ce->parent; - } - - return 0; -} - -#define LOWER_CASE 1 -#define UPPER_CASE 2 -#define NUMERIC 3 - - -static void increment_string(zval *str) -{ - int carry=0; - int pos=str->value.str.len-1; - char *s=str->value.str.val; - char *t; - int last=0; /* Shut up the compiler warning */ - int ch; - - if (str->value.str.len == 0) { - STR_FREE(str->value.str.val); - str->value.str.val = estrndup("1", sizeof("1")-1); - str->value.str.len = 1; - return; - } - - while (pos >= 0) { - ch = s[pos]; - if (ch >= 'a' && ch <= 'z') { - if (ch == 'z') { - s[pos] = 'a'; - carry=1; - } else { - s[pos]++; - carry=0; - } - last=LOWER_CASE; - } else if (ch >= 'A' && ch <= 'Z') { - if (ch == 'Z') { - s[pos] = 'A'; - carry=1; - } else { - s[pos]++; - carry=0; - } - last=UPPER_CASE; - } else if (ch >= '0' && ch <= '9') { - if (ch == '9') { - s[pos] = '0'; - carry=1; - } else { - s[pos]++; - carry=0; - } - last = NUMERIC; - } else { - carry=0; - break; - } - if (carry == 0) { - break; - } - pos--; - } - - if (carry) { - t = (char *) emalloc(str->value.str.len+1+1); - memcpy(t+1, str->value.str.val, str->value.str.len); - str->value.str.len++; - t[str->value.str.len] = '\0'; - switch (last) { - case NUMERIC: - t[0] = '1'; - break; - case UPPER_CASE: - t[0] = 'A'; - break; - case LOWER_CASE: - t[0] = 'a'; - break; - } - STR_FREE(str->value.str.val); - str->value.str.val = t; - } -} - - -ZEND_API int increment_function(zval *op1) -{ - switch (op1->type) { - case IS_LONG: - if (op1->value.lval == LONG_MAX) { - /* switch to double */ - double d = (double)op1->value.lval; - ZVAL_DOUBLE(op1, d+1); - } else { - op1->value.lval++; - } - break; - case IS_DOUBLE: - op1->value.dval = op1->value.dval + 1; - break; - case IS_NULL: - op1->value.lval = 1; - op1->type = IS_LONG; - break; - case IS_STRING: { - long lval; - double dval; - char *strval = op1->value.str.val; - - switch (is_numeric_string(strval, op1->value.str.len, &lval, &dval, 0)) { - case IS_LONG: - if (lval == LONG_MAX) { - /* switch to double */ - double d = (double)lval; - ZVAL_DOUBLE(op1, d+1); - } else { - op1->value.lval = lval+1; - op1->type = IS_LONG; - } - efree(strval); /* should never be empty_string */ - break; - case IS_DOUBLE: - op1->value.dval = dval+1; - op1->type = IS_DOUBLE; - efree(strval); /* should never be empty_string */ - break; -#if 0 - case FLAG_IS_BC: - /* Not implemented */ -#endif - default: - /* Perl style string increment */ - increment_string(op1); - break; - } - } - break; - default: - return FAILURE; - } - return SUCCESS; -} - - -ZEND_API int decrement_function(zval *op1) -{ - long lval; - double dval; - - switch (op1->type) { - case IS_LONG: - if (op1->value.lval == LONG_MIN) { - double d = (double)op1->value.lval; - ZVAL_DOUBLE(op1, d-1); - } else { - op1->value.lval--; - } - break; - case IS_DOUBLE: - op1->value.dval = op1->value.dval - 1; - break; - case IS_STRING: /* Like perl we only support string increment */ - if (op1->value.str.len == 0) { /* consider as 0 */ - STR_FREE(op1->value.str.val); - op1->value.lval = -1; - op1->type = IS_LONG; - break; - } - switch (is_numeric_string(op1->value.str.val, op1->value.str.len, &lval, &dval, 0)) { - case IS_LONG: - STR_FREE(op1->value.str.val); - if (lval == LONG_MIN) { - double d = (double)lval; - ZVAL_DOUBLE(op1, d-1); - } else { - op1->value.lval = lval-1; - op1->type = IS_LONG; - } - break; - case IS_DOUBLE: - STR_FREE(op1->value.str.val); - op1->value.dval = dval - 1; - op1->type = IS_DOUBLE; - break; - } - break; - default: - return FAILURE; - } - - return SUCCESS; -} - - -ZEND_API int zval_is_true(zval *op) -{ - convert_to_boolean(op); - return (op->value.lval ? 1 : 0); -} - -ZEND_API void zend_str_tolower(char *str, unsigned int length) -{ - register char *p=str, *end=p+length; - - while (p= 'A' && *p <= 'Z') { - *p = (*p)+32; - } - p++; - } -} - -ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2) -{ - int retval; - - retval = memcmp(s1, s2, MIN(len1, len2)); - if (!retval) { - return (len1 - len2); - } else { - return retval; - } -} - -ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length) -{ - int retval; - - retval = memcmp(s1, s2, MIN(length, MIN(len1, len2))); - if (!retval) { - return (MIN(length, len1) - MIN(length, len2)); - } else { - return retval; - } -} - - -ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2) -{ - int len; - int c1, c2; - - len = MIN(len1, len2); - - while (len--) { - c1 = tolower(*s1++); - c2 = tolower(*s2++); - if (c1 != c2) { - return c1 - c2; - } - } - - return len1 - len2; -} - - -ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length) -{ - int len; - int c1, c2; - - len = MIN(length, MIN(len1, len2)); - - while (len--) { - c1 = tolower(*s1++); - c2 = tolower(*s2++); - if (c1 != c2) { - return c1 - c2; - } - } - - return MIN(length, len1) - MIN(length, len2); -} - - -ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) -{ - return zend_binary_strcmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len); -} - -ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) -{ - return zend_binary_strncmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval); -} - - -ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) -{ - return zend_binary_strcasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len); -} - - -ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) -{ - return zend_binary_strncasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval); -} - - -ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) -{ - int ret1, ret2; - long lval1, lval2; - double dval1, dval2; - - if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1, 0)) && - (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2, 0))) { -#if 0&&WITH_BCMATH - if ((ret1==FLAG_IS_BC) || (ret2==FLAG_IS_BC)) { - bc_num first, second; - - /* use the BC math library to compare the numbers */ - init_num(&first); - init_num(&second); - str2num(&first, s1->value.str.val, 100); /* this scale should do */ - str2num(&second, s2->value.str.val, 100); /* ditto */ - result->value.lval = bc_compare(first, second); - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; - free_num(&first); - free_num(&second); - } else -#endif - if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { - if (ret1!=IS_DOUBLE) { - dval1 = strtod(s1->value.str.val, NULL); - } else if (ret2!=IS_DOUBLE) { - dval2 = strtod(s2->value.str.val, NULL); - } - result->value.dval = dval1 - dval2; - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval); - result->type = IS_LONG; - } else { /* they both have to be long's */ - result->value.lval = lval1 - lval2; - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; - } - } else { - result->value.lval = zend_binary_zval_strcmp(s1, s2); - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; - } - return; -} - - -static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC) -{ - zval result; - - if (compare_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) { - return 1; - } - return result.value.lval; -} - -ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC) -{ - return zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); -} - - - -ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) -{ - result->type = IS_LONG; - result->value.lval = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); -} - - -ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC) -{ - zend_compare_symbol_tables(result, a1->value.ht, a2->value.ht TSRMLS_CC); -} - - -ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) -{ - result->type = IS_LONG; - if (Z_OBJ_HT_P(o1) != Z_OBJ_HT_P(o2)) { - result->value.lval = 1; /* Comparing objects of different types is pretty much meaningless */ - return; - } - - if (Z_OBJ_HT_P(o1)->compare_objects == NULL) { - if (Z_OBJ_HANDLE_P(o1) == Z_OBJ_HANDLE_P(o2)) { - result->value.lval = 0; - } else { - result->value.lval = 1; - } - return; - } else { - result->value.lval = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC); - } -} - -ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) -{ - double dval = op->value.dval; - - TSRMLS_FETCH(); - - op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); - sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); - op->value.str.len = strlen(op->value.str.val); - - if (EG(float_separator)[0] != '.') { - char *p = op->value.str.val; - if ((p = strchr(p, '.'))) { - *p = EG(float_separator)[0]; - } - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h deleted file mode 100644 index 8d724480cf..0000000000 --- a/Zend/zend_operators.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_OPERATORS_H -#define ZEND_OPERATORS_H - -#include -#include - -#ifdef HAVE_IEEEFP_H -#include -#endif - - -#if 0&&WITH_BCMATH -#include "ext/bcmath/libbcmath/src/bcmath.h" -#endif - -#define MAX_LENGTH_OF_LONG 18 -#define MAX_LENGTH_OF_DOUBLE 32 - -ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC); -ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC); -ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); - -ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); - -ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC); - -static inline zend_bool is_numeric_string(char *str, int length, long *lval, double *dval, zend_bool allow_errors) -{ - long local_lval; - double local_dval; - char *end_ptr_long, *end_ptr_double; - int conv_base=10; - - if (!length) { - return 0; - } - - /* handle hex numbers */ - if (length>=2 && str[0]=='0' && (str[1]=='x' || str[1]=='X')) { - conv_base=16; - } - errno=0; - local_lval = strtol(str, &end_ptr_long, conv_base); - if (errno!=ERANGE) { - if (end_ptr_long == str+length) { /* integer string */ - if (lval) { - *lval = local_lval; - } - return IS_LONG; - } - } else { - end_ptr_long=NULL; - } - - if (conv_base==16) { /* hex string, under UNIX strtod() messes it up */ - return 0; - } - - errno=0; - local_dval = strtod(str, &end_ptr_double); - if (errno!=ERANGE) { - if (end_ptr_double == str+length) { /* floating point string */ - if (! zend_finite(local_dval)) { - /* "inf","nan" and maybe other weird ones */ - return 0; - } - - if (dval) { - *dval = local_dval; - } -#if 0&&WITH_BCMATH - if (length>16) { - register char *ptr=str, *end=str+length; - - while (ptrend_ptr_long && dval) { - *dval = local_dval; - return IS_DOUBLE; - } else if (end_ptr_long && lval) { - *lval = local_lval; - return IS_LONG; - } - } - return 0; -} - -static inline char * -zend_memnstr(char *haystack, char *needle, int needle_len, char *end) -{ - char *p = haystack; - char ne = needle[needle_len-1]; - - end -= needle_len; - - while (p <= end) { - if ((p = memchr(p, *needle, (end-p+1))) && ne == p[needle_len-1]) { - if (!memcmp(needle, p, needle_len-1)) { - return p; - } - } - - if (p == NULL) { - return NULL; - } - - p++; - } - - return NULL; -} - -ZEND_API int increment_function(zval *op1); -ZEND_API int decrement_function(zval *op2); - -BEGIN_EXTERN_C() -ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC); -ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC); -ZEND_API void convert_to_long(zval *op); -ZEND_API void convert_to_double(zval *op); -ZEND_API void convert_to_long_base(zval *op, int base); -ZEND_API void convert_to_null(zval *op); -ZEND_API void convert_to_boolean(zval *op); -ZEND_API void convert_to_array(zval *op); -ZEND_API void convert_to_object(zval *op); -ZEND_API void multi_convert_to_long_ex(int argc, ...); -ZEND_API void multi_convert_to_double_ex(int argc, ...); -ZEND_API void multi_convert_to_string_ex(int argc, ...); -ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2); -ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2); -#define convert_to_string(op) _convert_to_string((op) ZEND_FILE_LINE_CC) - -ZEND_API double zend_string_to_double(const char *number, zend_uint length); -END_EXTERN_C() - -ZEND_API int zval_is_true(zval *op); -ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); -ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); - -ZEND_API void zend_str_tolower(char *str, unsigned int length); -ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); -ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); -ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2); -ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); -ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2); -ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint length); -ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2); -ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length); - -ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); -ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC); -ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC); -ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC); - -ZEND_API int zend_atoi(const char *str, int str_len); - -ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC); - -#define convert_to_ex_master(ppzv, lower_type, upper_type) \ - if ((*ppzv)->type!=IS_##upper_type) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_to_##lower_type(*ppzv); \ - } - -#define convert_to_writable_ex_master(ppzv, lower_type, upper_type) \ - if ((*ppzv)->type!=IS_##upper_type) { \ - SEPARATE_ZVAL(ppzv); \ - convert_to_##lower_type(*ppzv); \ - } - - -#define convert_to_boolean_ex(ppzv) convert_to_ex_master(ppzv, boolean, BOOL) -#define convert_to_long_ex(ppzv) convert_to_ex_master(ppzv, long, LONG) -#define convert_to_double_ex(ppzv) convert_to_ex_master(ppzv, double, DOUBLE) -#define convert_to_string_ex(ppzv) convert_to_ex_master(ppzv, string, STRING) -#define convert_to_array_ex(ppzv) convert_to_ex_master(ppzv, array, ARRAY) -#define convert_to_object_ex(ppzv) convert_to_ex_master(ppzv, object, OBJECT) -#define convert_to_null_ex(ppzv) convert_to_ex_master(ppzv, null, NULL) - -#define convert_to_writable_boolean_ex(ppzv) convert_to_writable_ex_master(ppzv, boolean, BOOL) -#define convert_to_writable_long_ex(ppzv) convert_to_writable_ex_master(ppzv, long, LONG) -#define convert_to_writable_double_ex(ppzv) convert_to_writable_ex_master(ppzv, double, DOUBLE) -#define convert_to_writable_string_ex(ppzv) convert_to_writable_ex_master(ppzv, string, STRING) -#define convert_to_writable_array_ex(ppzv) convert_to_writable_ex_master(ppzv, array, ARRAY) -#define convert_to_writable_object_ex(ppzv) convert_to_writable_ex_master(ppzv, object, OBJECT) -#define convert_to_writable_null_ex(ppzv) convert_to_writable_ex_master(ppzv, null, NULL) - - -#define convert_scalar_to_number_ex(ppzv) \ - if ((*ppzv)->type!=IS_LONG && (*ppzv)->type!=IS_DOUBLE) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_scalar_to_number(*ppzv TSRMLS_CC); \ - } - - -#define Z_LVAL(zval) (zval).value.lval -#define Z_BVAL(zval) ((zend_bool)(zval).value.lval) -#define Z_DVAL(zval) (zval).value.dval -#define Z_STRVAL(zval) (zval).value.str.val -#define Z_STRLEN(zval) (zval).value.str.len -#define Z_ARRVAL(zval) (zval).value.ht -#define Z_OBJ_HANDLE(zval) (zval).value.obj.handle -#define Z_OBJ_HT(zval) (zval).value.obj.handlers -#define Z_OBJCE(zval) zend_get_class_entry(&(zval) TSRMLS_CC) -#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC) -#define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf -#define Z_RESVAL(zval) (zval).value.lval - -#define Z_LVAL_P(zval_p) Z_LVAL(*zval_p) -#define Z_BVAL_P(zval_p) Z_BVAL(*zval_p) -#define Z_DVAL_P(zval_p) Z_DVAL(*zval_p) -#define Z_STRVAL_P(zval_p) Z_STRVAL(*zval_p) -#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p) -#define Z_ARRVAL_P(zval_p) Z_ARRVAL(*zval_p) -#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*zval_p) -#define Z_OBJCE_P(zval_p) Z_OBJCE(*zval_p) -#define Z_RESVAL_P(zval_p) Z_RESVAL(*zval_p) -#define Z_OBJ_HANDLE_P(zval_p) Z_OBJ_HANDLE(*zval_p) -#define Z_OBJ_HT_P(zval_p) Z_OBJ_HT(*zval_p) -#define Z_OBJ_HANDLER_P(zval_p, h) Z_OBJ_HANDLER(*zval_p, h) - -#define Z_LVAL_PP(zval_pp) Z_LVAL(**zval_pp) -#define Z_BVAL_PP(zval_pp) Z_BVAL(**zval_pp) -#define Z_DVAL_PP(zval_pp) Z_DVAL(**zval_pp) -#define Z_STRVAL_PP(zval_pp) Z_STRVAL(**zval_pp) -#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp) -#define Z_ARRVAL_PP(zval_pp) Z_ARRVAL(**zval_pp) -#define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp) -#define Z_OBJCE_PP(zval_pp) Z_OBJCE(**zval_pp) -#define Z_RESVAL_PP(zval_pp) Z_RESVAL(**zval_pp) -#define Z_OBJ_HANDLE_PP(zval_p) Z_OBJ_HANDLE(**zval_p) -#define Z_OBJ_HT_PP(zval_p) Z_OBJ_HT(**zval_p) -#define Z_OBJ_HANDLER_PP(zval_p, h) Z_OBJ_HANDLER(**zval_p, h) - -#define Z_TYPE(zval) (zval).type -#define Z_TYPE_P(zval_p) Z_TYPE(*zval_p) -#define Z_TYPE_PP(zval_pp) Z_TYPE(**zval_pp) - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c deleted file mode 100644 index 756e4933c5..0000000000 --- a/Zend/zend_ptr_stack.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_ptr_stack.h" -#ifdef HAVE_STDARG_H -# include -#endif - -ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack) -{ - stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE); - stack->max = PTR_STACK_BLOCK_SIZE; - stack->top = 0; -} - - -ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...) -{ - va_list ptr; - void *elem; - - if (stack->top+count > stack->max) { /* we need to allocate more memory */ - stack->max *= 2; - stack->max += count; - stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max))); - stack->top_element = stack->elements+stack->top; - } - va_start(ptr, count); - while (count>0) { - elem = va_arg(ptr, void *); - stack->top++; - *(stack->top_element++) = elem; - count--; - } - va_end(ptr); -} - - -ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...) -{ - va_list ptr; - void **elem; - - va_start(ptr, count); - while (count>0) { - elem = va_arg(ptr, void **); - *elem = *(--stack->top_element); - stack->top--; - count--; - } - va_end(ptr); -} - - - -ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack) -{ - if (stack->elements) { - efree(stack->elements); - } -} - - -ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *)) -{ - int i = stack->top; - - while (--i >= 0) { - func(stack->elements[i]); - } -} - - -ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), zend_bool free_elements) -{ - zend_ptr_stack_apply(stack, func); - if (free_elements) { - int i = stack->top; - - while (--i >= 0) { - efree(stack->elements[i]); - } - } - stack->top = 0; - stack->top_element = stack->elements; -} - - -ZEND_API int zend_ptr_stack_num_elements(zend_ptr_stack *stack) -{ - return stack->top; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h deleted file mode 100644 index ff6b715bbb..0000000000 --- a/Zend/zend_ptr_stack.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_PTR_STACK_H -#define ZEND_PTR_STACK_H - -typedef struct _zend_ptr_stack { - int top, max; - void **elements; - void **top_element; -} zend_ptr_stack; - - -#define PTR_STACK_BLOCK_SIZE 64 - -ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack); -ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...); -ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...); -ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack); -ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *)); -ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), zend_bool free_elements); -ZEND_API int zend_ptr_stack_num_elements(zend_ptr_stack *stack); - -static inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr) -{ - if (stack->top >= stack->max) { /* we need to allocate more memory */ - stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max *= 2 ))); - stack->top_element = stack->elements+stack->top; - } - stack->top++; - *(stack->top_element++) = ptr; -} - -static inline void *zend_ptr_stack_pop(zend_ptr_stack *stack) -{ - stack->top--; - return *(--stack->top_element); -} - -#endif /* ZEND_PTR_STACK_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_qsort.c b/Zend/zend_qsort.c deleted file mode 100644 index 1f7d223d6e..0000000000 --- a/Zend/zend_qsort.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Sterling Hughes | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" - -#include - -#define QSORT_STACK_SIZE (sizeof(size_t) * CHAR_BIT) - -static void _zend_qsort_swap(void *a, void *b, size_t siz) -{ - register char *tmp_a_char; - register char *tmp_b_char; - register int *tmp_a_int; - register int *tmp_b_int; - register size_t i; - int t_i; - char t_c; - - tmp_a_int = (int *) a; - tmp_b_int = (int *) b; - - for (i = sizeof(int); i <= siz; i += sizeof(int)) { - t_i = *tmp_a_int; - *tmp_a_int++ = *tmp_b_int; - *tmp_b_int++ = t_i; - } - - tmp_a_char = (char *) tmp_a_int; - tmp_b_char = (char *) tmp_b_int; - - for (i = i - sizeof(int) + 1; i <= siz; ++i) { - t_c = *tmp_a_char; - *tmp_a_char++ = *tmp_b_char; - *tmp_b_char++ = t_c; - } -} - -ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC) -{ - void *begin_stack[QSORT_STACK_SIZE]; - void *end_stack[QSORT_STACK_SIZE]; - register char *begin; - register char *end; - register char *seg1; - register char *seg2; - register char *seg2p; - register int loop; - uint offset; - - begin_stack[0] = (char *) base; - end_stack[0] = (char *) base + ((nmemb - 1) * siz); - - for (loop = 0; loop >= 0; --loop) { - begin = begin_stack[loop]; - end = end_stack[loop]; - - while (begin < end) { - offset = (end - begin) >> 1; - _zend_qsort_swap(begin, begin + (offset - (offset % siz)), siz); - - seg1 = begin + siz; - seg2 = end; - - while (1) { - for (; seg1 < seg2 && compare(begin, seg1 TSRMLS_CC) > 0; - seg1 += siz); - - for (; seg2 >= seg1 && compare(seg2, begin TSRMLS_CC) > 0; - seg2 -= siz); - - if (seg1 >= seg2) - break; - - _zend_qsort_swap(seg1, seg2, siz); - - seg1 += siz; - seg2 -= siz; - } - - _zend_qsort_swap(begin, seg2, siz); - - seg2p = seg2; - - if ((seg2p - begin) <= (end - seg2p)) { - if ((seg2p + siz) < end) { - begin_stack[loop] = seg2p + siz; - end_stack[loop++] = end; - } - end = seg2p - siz; - } - else { - if ((seg2p - siz) > begin) { - begin_stack[loop] = begin; - end_stack[loop++] = seg2p - siz; - } - begin = seg2p + siz; - } - } - } -} - -/* - * Local Variables: - * c-basic-offset: 4 - * tab-width: 4 - * End: - * vim600: fdm=marker - * vim: noet sw=4 ts=4 - */ diff --git a/Zend/zend_qsort.h b/Zend/zend_qsort.h deleted file mode 100644 index fec4cd2fb6..0000000000 --- a/Zend/zend_qsort.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Sterling Hughes | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_QSORT_H -#define ZEND_QSORT_H - -BEGIN_EXTERN_C() -ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC); -END_EXTERN_C() - -#endif /* ZEND_QSORT_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c deleted file mode 100644 index 126685a499..0000000000 --- a/Zend/zend_sprintf.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include - -#include "zend.h" - -#ifdef HAVE_STDARG_H -# include -#endif - -#if ZEND_BROKEN_SPRINTF -int zend_sprintf(char *buffer, const char *format, ...) -{ - va_list args; - - va_start(args, format); - vsprintf(buffer, format, args); - va_end(args); - - return strlen(buffer); -} -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c deleted file mode 100644 index ac11a54305..0000000000 --- a/Zend/zend_stack.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend.h" -#include "zend_stack.h" - -ZEND_API int zend_stack_init(zend_stack *stack) -{ - stack->top = 0; - stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE); - if (!stack->elements) { - return FAILURE; - } else { - stack->max = STACK_BLOCK_SIZE; - return SUCCESS; - } -} - -ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size) -{ - if (stack->top >= stack->max) { /* we need to allocate more memory */ - stack->elements = (void **) erealloc(stack->elements, - (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE))); - if (!stack->elements) { - return FAILURE; - } - } - stack->elements[stack->top] = (void *) emalloc(size); - memcpy(stack->elements[stack->top], element, size); - return stack->top++; -} - - -ZEND_API int zend_stack_top(zend_stack *stack, void **element) -{ - if (stack->top > 0) { - *element = stack->elements[stack->top - 1]; - return SUCCESS; - } else { - *element = NULL; - return FAILURE; - } -} - - -ZEND_API int zend_stack_del_top(zend_stack *stack) -{ - if (stack->top > 0) { - efree(stack->elements[--stack->top]); - } - return SUCCESS; -} - - -ZEND_API int zend_stack_int_top(zend_stack *stack) -{ - int *e; - - if (zend_stack_top(stack, (void **) &e) == FAILURE) { - return FAILURE; /* this must be a negative number, since negative numbers can't be address numbers */ - } else { - return *e; - } -} - - -ZEND_API int zend_stack_is_empty(zend_stack *stack) -{ - if (stack->top == 0) { - return 1; - } else { - return 0; - } -} - - -ZEND_API int zend_stack_destroy(zend_stack *stack) -{ - register int i; - - for (i = 0; i < stack->top; i++) { - efree(stack->elements[i]); - } - - if (stack->elements) { - efree(stack->elements); - } - return SUCCESS; -} - - -ZEND_API void **zend_stack_base(zend_stack *stack) -{ - return stack->elements; -} - - -ZEND_API int zend_stack_count(zend_stack *stack) -{ - return stack->top; -} - - -ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element)) -{ - int i; - - switch (type) { - case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { - if (apply_function(stack->elements[i])) { - break; - } - } - break; - case ZEND_STACK_APPLY_BOTTOMUP: - for (i=0; itop; i++) { - if (apply_function(stack->elements[i])) { - break; - } - } - break; - } -} - - -ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) -{ - int i; - - switch (type) { - case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { - if (apply_function(stack->elements[i], arg)) { - break; - } - } - break; - case ZEND_STACK_APPLY_BOTTOMUP: - for (i=0; itop; i++) { - if (apply_function(stack->elements[i], arg)) { - break; - } - } - break; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h deleted file mode 100644 index d7ea084bc2..0000000000 --- a/Zend/zend_stack.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_STACK_H -#define ZEND_STACK_H - -typedef struct _zend_stack { - int top, max; - void **elements; -} zend_stack; - - -#define STACK_BLOCK_SIZE 64 - -ZEND_API int zend_stack_init(zend_stack *stack); -ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size); -ZEND_API int zend_stack_top(zend_stack *stack, void **element); -ZEND_API int zend_stack_del_top(zend_stack *stack); -ZEND_API int zend_stack_int_top(zend_stack *stack); -ZEND_API int zend_stack_is_empty(zend_stack *stack); -ZEND_API int zend_stack_destroy(zend_stack *stack); -ZEND_API void **zend_stack_base(zend_stack *stack); -ZEND_API int zend_stack_count(zend_stack *stack); -ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element)); -ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg); - -#define ZEND_STACK_APPLY_TOPDOWN 1 -#define ZEND_STACK_APPLY_BOTTOMUP 2 - -#endif /* ZEND_STACK_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_static_allocator.c b/Zend/zend_static_allocator.c deleted file mode 100644 index f49de8624b..0000000000 --- a/Zend/zend_static_allocator.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend_static_allocator.h" - -/* Not checking emalloc() and erealloc() return values as they are supposed to bailout */ - -inline static void block_init(Block *block, zend_uint block_size) -{ - block->pos = block->bp = (char *) emalloc(block_size); - block->end = block->bp + block_size; -} - -inline static char *block_allocate(Block *block, zend_uint size) -{ - char *retval = block->pos; - if ((block->pos += size) >= block->end) { - return (char *)NULL; - } - return retval; -} - -inline static void block_destroy(Block *block) -{ - efree(block->bp); -} - -void static_allocator_init(StaticAllocator *sa) -{ - sa->Blocks = (Block *) emalloc(sizeof(Block)); - block_init(sa->Blocks, ALLOCATOR_BLOCK_SIZE); - sa->num_blocks = 1; - sa->current_block = 0; -} - -char *static_allocator_allocate(StaticAllocator *sa, zend_uint size) -{ - char *retval; - - retval = block_allocate(&sa->Blocks[sa->current_block], size); - if (retval) { - return retval; - } - sa->Blocks = (Block *) erealloc(sa->Blocks, ++sa->num_blocks); - sa->current_block++; - block_init(&sa->Blocks[sa->current_block], (size > ALLOCATOR_BLOCK_SIZE) ? size : ALLOCATOR_BLOCK_SIZE); - retval = block_allocate(&sa->Blocks[sa->current_block], size); - return retval; -} - -void static_allocator_destroy(StaticAllocator *sa) -{ - zend_uint i; - - for (i=0; inum_blocks; i++) { - block_free(&sa->Blocks[i]); - } - efree(sa->Blocks); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_static_allocator.h b/Zend/zend_static_allocator.h deleted file mode 100644 index 8e98cdf587..0000000000 --- a/Zend/zend_static_allocator.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_STATIC_ALLOCATOR_H -#define ZEND_STATIC_ALLOCATOR_H - -#define ALLOCATOR_BLOCK_SIZE 400000 - -/* Temporary */ -typedef unsigned int zend_uint; -#define emalloc(s) malloc(s) -#define efree(p) free(p) - -typedef struct _Block { - char *bp; - char *pos; - char *end; -} Block; - -typedef struct _StaticAllocator { - Block *Blocks; - zend_uint num_blocks; - zend_uint current_block; -} StaticAllocator; - -void static_allocator_init(StaticAllocator *sa); -char *static_allocator_allocate(StaticAllocator *sa, zend_uint size); -void static_allocator_destroy(StaticAllocator *sa); - -#endif /* ZEND_STATIC_ALLOCATOR_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c deleted file mode 100644 index f13b0359e6..0000000000 --- a/Zend/zend_stream.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Wez Furlong | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - - -#include "zend.h" -#include "zend_compile.h" - -ZEND_DLIMPORT int isatty(int fd); - -static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len TSRMLS_DC) -{ - return fread(buf, 1, len, (FILE*)handle); -} - -static void zend_stream_stdio_closer(void *handle TSRMLS_DC) -{ - if ((FILE*)handle != stdin) - fclose((FILE*)handle); -} - -int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC) -{ - if (zend_stream_open_function) { - return zend_stream_open_function(filename, handle TSRMLS_CC); - } - handle->type = ZEND_HANDLE_FP; - handle->opened_path = NULL; - handle->handle.fp = zend_fopen(filename, &handle->opened_path); - handle->filename = (char *)filename; - handle->free_filename = 0; - - return (handle->handle.fp) ? SUCCESS : FAILURE; -} - -int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC) -{ - switch (file_handle->type) { - case ZEND_HANDLE_FILENAME: - if (FAILURE == zend_stream_open(file_handle->filename, file_handle TSRMLS_CC)) { - return FAILURE; - } - break; - - case ZEND_HANDLE_FD: - file_handle->handle.fp = fdopen(file_handle->handle.fd, "rb"); - file_handle->type = ZEND_HANDLE_FP; - break; - - case ZEND_HANDLE_FP: - file_handle->handle.fp = file_handle->handle.fp; - break; - - case ZEND_HANDLE_STREAM: - /* nothing to do */ - return SUCCESS; - - default: - return FAILURE; - } - if (file_handle->type == ZEND_HANDLE_FP) { - if (!file_handle->handle.fp) { - return FAILURE; - } - - /* promote to stream */ - file_handle->handle.stream.handle = file_handle->handle.fp; - file_handle->handle.stream.reader = zend_stream_stdio_reader; - file_handle->handle.stream.closer = zend_stream_stdio_closer; - file_handle->type = ZEND_HANDLE_STREAM; - - file_handle->handle.stream.interactive = isatty(fileno((FILE *)file_handle->handle.stream.handle)); - } - return SUCCESS; -} - -size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC) -{ - if (file_handle->handle.stream.interactive) { - int c = '*', n; - - for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != '\n'; ++n ) - buf[n] = (char) c; - if ( c == '\n' ) - buf[n++] = (char) c; - - return n; - } - return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len TSRMLS_CC); -} - -int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC) -{ - char buf; - - if (file_handle->handle.stream.reader(file_handle->handle.stream.handle, &buf, sizeof(buf) TSRMLS_CC)) { - return (int)buf; - } - return EOF; -} - -int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC) -{ - return 0; -} - - diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h deleted file mode 100644 index 130793287c..0000000000 --- a/Zend/zend_stream.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Wez Furlong | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_STREAM_H -#define ZEND_STREAM_H - -/* Lightweight stream implementation for the ZE scanners. - * These functions are private to the engine. - * */ - -typedef size_t (*zend_stream_reader_t)(void *handle, char *buf, size_t len TSRMLS_DC); -typedef void (*zend_stream_closer_t)(void *handle TSRMLS_DC); - -typedef struct _zend_stream { - void *handle; - zend_stream_reader_t reader; - zend_stream_closer_t closer; - int interactive; -} zend_stream; - -typedef struct _zend_file_handle { - zend_uchar type; - char *filename; - char *opened_path; - union { - int fd; - FILE *fp; - zend_stream stream; - } handle; - zend_bool free_filename; -} zend_file_handle; - -int zend_stream_open(const char *filename, zend_file_handle *handle TSRMLS_DC); -int zend_stream_ferror(zend_file_handle *file_handle TSRMLS_DC); -int zend_stream_getc(zend_file_handle *file_handle TSRMLS_DC); -size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC); -int zend_stream_fixup(zend_file_handle *file_handle TSRMLS_DC); - -#define zend_stream_close(handle) zend_file_handle_dtor((handle)) - -#endif - diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c deleted file mode 100644 index a47dcf4fc5..0000000000 --- a/Zend/zend_ts_hash.c +++ /dev/null @@ -1,364 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Harald Radi | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "zend_ts_hash.h" - -/* ts management functions */ -static void begin_read(TsHashTable *ht) -{ -#ifdef ZTS - tsrm_mutex_lock(ht->mx_reader); - if ((++(ht->reader)) == 1) { - tsrm_mutex_lock(ht->mx_writer); - } - tsrm_mutex_unlock(ht->mx_reader); -#endif -} - -static void end_read(TsHashTable *ht) -{ -#ifdef ZTS - tsrm_mutex_lock(ht->mx_reader); - if ((--(ht->reader)) == 0) { - tsrm_mutex_unlock(ht->mx_writer); - } - tsrm_mutex_unlock(ht->mx_reader); -#endif -} - -static void begin_write(TsHashTable *ht) -{ -#ifdef ZTS - tsrm_mutex_lock(ht->mx_writer); -#endif -} - -static void end_write(TsHashTable *ht) -{ -#ifdef ZTS - tsrm_mutex_unlock(ht->mx_writer); -#endif -} - -/* delegates */ -ZEND_API int zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent) -{ -#ifdef ZTS - ht->mx_reader = tsrm_mutex_alloc(); - ht->mx_writer = tsrm_mutex_alloc(); - ht->reader = 0; -#endif - return zend_hash_init(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent); -} - -ZEND_API int zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection) -{ -#ifdef ZTS - ht->mx_reader = tsrm_mutex_alloc(); - ht->mx_writer = tsrm_mutex_alloc(); - ht->reader = 0; -#endif - return zend_hash_init_ex(TS_HASH(ht), nSize, pHashFunction, pDestructor, persistent, bApplyProtection); -} - -ZEND_API void zend_ts_hash_destroy(TsHashTable *ht) -{ -#ifdef ZTS - tsrm_mutex_free(ht->mx_reader); - tsrm_mutex_free(ht->mx_writer); -#endif - zend_hash_destroy(TS_HASH(ht)); -} - -ZEND_API void zend_ts_hash_clean(TsHashTable *ht) -{ - ht->reader = 0; - zend_hash_clean(TS_HASH(ht)); -} - -ZEND_API int zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag) -{ - int retval; - - begin_write(ht); - retval = zend_hash_add_or_update(TS_HASH(ht), arKey, nKeyLength, pData, nDataSize, pDest, flag); - end_write(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag) -{ - int retval; - - begin_write(ht); - retval = zend_hash_quick_add_or_update(TS_HASH(ht), arKey, nKeyLength, h, pData, nDataSize, pDest, flag); - end_write(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag) -{ - int retval; - - begin_write(ht); - retval = zend_hash_index_update_or_next_insert(TS_HASH(ht), h, pData, nDataSize, pDest, flag); - end_write(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength) -{ - int retval; - - begin_write(ht); - retval = zend_hash_add_empty_element(TS_HASH(ht), arKey, nKeyLength); - end_write(ht); - - return retval; -} - -ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht) -{ -#ifdef ZTS - tsrm_mutex_free(ht->mx_reader); - tsrm_mutex_free(ht->mx_reader); -#endif - zend_hash_graceful_destroy(TS_HASH(ht)); -} - -ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC) -{ - begin_write(ht); - zend_hash_apply(TS_HASH(ht), apply_func TSRMLS_CC); - end_write(ht); -} - -ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC) -{ - begin_write(ht); - zend_hash_apply_with_argument(TS_HASH(ht), apply_func, argument TSRMLS_CC); - end_write(ht); -} - -ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int num_args, ...) -{ - va_list args; - - va_start(args, num_args); - begin_write(ht); - zend_hash_apply_with_arguments(TS_HASH(ht), apply_func, num_args, args); - end_write(ht); - va_end(args); -} - -ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC) -{ - begin_write(ht); - zend_hash_reverse_apply(TS_HASH(ht), apply_func TSRMLS_CC); - end_write(ht); -} - -ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) -{ - int retval; - - begin_write(ht); - retval = zend_hash_del_key_or_index(TS_HASH(ht), arKey, nKeyLength, h, flag); - end_write(ht); - - return retval; -} - -ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength) -{ - ulong retval; - - begin_read(ht); - retval = zend_get_hash_value(arKey, nKeyLength); - end_read(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData) -{ - int retval; - - begin_read(ht); - retval = zend_hash_find(TS_HASH(ht), arKey, nKeyLength, pData); - end_read(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) -{ - int retval; - - begin_read(ht); - retval = zend_hash_quick_find(TS_HASH(ht), arKey, nKeyLength, h, pData); - end_read(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData) -{ - int retval; - - begin_read(ht); - retval = zend_hash_index_find(TS_HASH(ht), h, pData); - end_read(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength) -{ - int retval; - - begin_read(ht); - retval = zend_hash_exists(TS_HASH(ht), arKey, nKeyLength); - end_read(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h) -{ - int retval; - - begin_read(ht); - retval = zend_hash_index_exists(TS_HASH(ht), h); - end_read(ht); - - return retval; -} - -ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size) -{ - begin_read(source); - begin_write(target); - zend_hash_copy(TS_HASH(target), TS_HASH(source), pCopyConstructor, tmp, size); - end_write(target); - end_read(source); -} - -ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite) -{ - begin_read(source); - begin_write(target); - zend_hash_merge(TS_HASH(target), TS_HASH(source), pCopyConstructor, tmp, size, overwrite); - end_write(target); - end_read(source); -} - -ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam) -{ - begin_read(source); - begin_write(target); - zend_hash_merge_ex(TS_HASH(target), TS_HASH(source), pCopyConstructor, size, pMergeSource, pParam); - end_write(target); - end_read(source); -} - -ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC) -{ - int retval; - - begin_write(ht); - retval = zend_hash_sort(TS_HASH(ht), sort_func, compare_func, renumber TSRMLS_CC); - end_write(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC) -{ - int retval; - - begin_read(ht1); - begin_read(ht2); - retval = zend_hash_compare(TS_HASH(ht1), TS_HASH(ht2), compar, ordered TSRMLS_CC); - end_read(ht2); - end_read(ht1); - - return retval; -} - -ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC) -{ - int retval; - - begin_read(ht); - retval = zend_hash_minmax(TS_HASH(ht), compar, flag, pData TSRMLS_CC); - end_read(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht) -{ - int retval; - - begin_read(ht); - retval = zend_hash_num_elements(TS_HASH(ht)); - end_read(ht); - - return retval; -} - -ZEND_API int zend_ts_hash_rehash(TsHashTable *ht) -{ - int retval; - - begin_write(ht); - retval = zend_hash_rehash(TS_HASH(ht)); - end_write(ht); - - return retval; -} - -#if ZEND_DEBUG -void zend_ts_hash_display_pListTail(TsHashTable *ht) -{ - begin_read(ht); - zend_hash_display_pListTail(TS_HASH(ht)); - end_read(ht); -} - -void zend_ts_hash_display(TsHashTable *ht) -{ - begin_read(ht); - zend_hash_display(TS_HASH(ht)); - end_read(ht); -} -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h deleted file mode 100644 index 736d214f88..0000000000 --- a/Zend/zend_ts_hash.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Harald Radi | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_TS_HASH_H -#define ZEND_TS_HASH_H - -#include "zend.h" - -typedef struct _zend_ts_hashtable { - HashTable hash; - zend_uint reader; -#ifdef ZTS - MUTEX_T mx_reader; - MUTEX_T mx_writer; -#endif -} TsHashTable; - -BEGIN_EXTERN_C() - -#define TS_HASH(table) (&(table->hash)) - -/* startup/shutdown */ -ZEND_API int zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent); -ZEND_API int zend_ts_hash_init_ex(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection); -ZEND_API void zend_ts_hash_destroy(TsHashTable *ht); -ZEND_API void zend_ts_hash_clean(TsHashTable *ht); - -/* additions/updates/changes */ -ZEND_API int zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag); -#define zend_ts_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ - zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE) -#define zend_ts_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ - zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD) - -ZEND_API int zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag); -#define zend_ts_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ - zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE) -#define zend_ts_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ - zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD) - -ZEND_API int zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag); -#define zend_ts_hash_index_update(ht, h, pData, nDataSize, pDest) \ - zend_ts_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE) -#define zend_ts_hash_next_index_insert(ht, pData, nDataSize, pDest) \ - zend_ts_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT) - -ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength); - -ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht); -ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC); -ZEND_API void zend_ts_hash_apply_with_argument(TsHashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC); -ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht, apply_func_args_t apply_func, int, ...); - -ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC); - - -/* Deletes */ -ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag); -#define zend_ts_hash_del(ht, arKey, nKeyLength) \ - zend_ts_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY) -#define zend_ts_hash_index_del(ht, h) \ - zend_ts_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX) - -ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength); - -/* Data retreival */ -ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData); -ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData); -ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData); - -/* Misc */ -ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength); -ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h); - -/* Copying, merging and sorting */ -ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size); -ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite); -ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam); -ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC); -ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC); -ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC); - -ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht); - -ZEND_API int zend_ts_hash_rehash(TsHashTable *ht); - -ZEND_API ulong zend_ts_hash_func(char *arKey, uint nKeyLength); - -#if ZEND_DEBUG -/* debug */ -void zend_ts_hash_display_pListTail(TsHashTable *ht); -void zend_ts_hash_display(TsHashTable *ht); -#endif - -END_EXTERN_C() - -#define ZEND_TS_INIT_SYMTABLE(ht) \ - ZEND_TS_INIT_SYMTABLE_EX(ht, 2, 0) - -#define ZEND_TS_INIT_SYMTABLE_EX(ht, n, persistent) \ - zend_ts_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent) - -#endif /* ZEND_HASH_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_types.h b/Zend/zend_types.h deleted file mode 100644 index 4a895115a8..0000000000 --- a/Zend/zend_types.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_TYPES_H -#define ZEND_TYPES_H - -typedef unsigned char zend_bool; -typedef unsigned char zend_uchar; -typedef unsigned int zend_uint; -typedef unsigned long zend_ulong; -typedef unsigned short zend_ushort; - -#endif /* ZEND_TYPES_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c deleted file mode 100644 index a3856953de..0000000000 --- a/Zend/zend_variables.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include -#include "zend.h" -#include "zend_API.h" -#include "zend_globals.h" -#include "zend_constants.h" -#include "zend_list.h" - -ZEND_API char *empty_string = ""; /* in order to save emalloc() and efree() time for - * empty strings (usually used to denote empty - * return values in failed functions). - * The macro STR_FREE() will not efree() it. - */ - - -ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) -{ - if (zvalue->type==IS_LONG) { - return; - } - switch (zvalue->type & ~IS_CONSTANT_INDEX) { - case IS_STRING: - case IS_CONSTANT: - CHECK_ZVAL_STRING_REL(zvalue); - STR_FREE_REL(zvalue->value.str.val); - break; - case IS_ARRAY: - case IS_CONSTANT_ARRAY: { - TSRMLS_FETCH(); - - if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) { - zend_hash_destroy(zvalue->value.ht); - FREE_HASHTABLE(zvalue->value.ht); - } - } - break; - case IS_OBJECT: - { - TSRMLS_FETCH(); - - Z_OBJ_HT_P(zvalue)->del_ref(zvalue TSRMLS_CC); - } - break; - case IS_RESOURCE: - { - TSRMLS_FETCH(); - - /* destroy resource */ - zend_list_delete(zvalue->value.lval); - } - break; - case IS_LONG: - case IS_DOUBLE: - case IS_BOOL: - case IS_NULL: - default: - return; - break; - } -} - - -ZEND_API void zval_add_ref(zval **p) -{ - (*p)->refcount++; -} - - -ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) -{ - switch (zvalue->type) { - case IS_RESOURCE: { - TSRMLS_FETCH(); - - zend_list_addref(zvalue->value.lval); - } - break; - case IS_BOOL: - case IS_LONG: - case IS_NULL: - break; - case IS_CONSTANT: - case IS_STRING: - if (zvalue->value.str.val) { - if (zvalue->value.str.len==0) { - zvalue->value.str.val = empty_string; - return SUCCESS; - } - } - CHECK_ZVAL_STRING_REL(zvalue); - zvalue->value.str.val = (char *) estrndup_rel(zvalue->value.str.val, zvalue->value.str.len); - break; - case IS_ARRAY: - case IS_CONSTANT_ARRAY: { - zval *tmp; - HashTable *original_ht = zvalue->value.ht; - TSRMLS_FETCH(); - - if (zvalue->value.ht == &EG(symbol_table)) { - return SUCCESS; /* do nothing */ - } - ALLOC_HASHTABLE_REL(zvalue->value.ht); - zend_hash_init(zvalue->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(zvalue->value.ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); - } - break; - case IS_OBJECT: - { - TSRMLS_FETCH(); - - if (EG(implicit_clone)) { - zvalue->value.obj = zvalue->value.obj.handlers->clone_obj(zvalue TSRMLS_CC); - } else { - Z_OBJ_HT_P(zvalue)->add_ref(zvalue TSRMLS_CC); - } - } - break; - } - return SUCCESS; -} - - -ZEND_API int zend_print_variable(zval *var) -{ - return zend_print_zval(var, 0); -} - - -#if ZEND_DEBUG -ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue) -{ - return zval_copy_ctor(zvalue); -} - - -ZEND_API void _zval_dtor_wrapper(zval *zvalue) -{ - zval_dtor(zvalue); -} - - - -ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr) -{ - zval_ptr_dtor(zval_ptr); -} -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h deleted file mode 100644 index 37e6c2eaf0..0000000000 --- a/Zend/zend_variables.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | 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 | - | available at through the world-wide-web at | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | 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 | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef ZEND_VARIABLES_H -#define ZEND_VARIABLES_H - - -ZEND_API int zend_print_variable(zval *var); - -BEGIN_EXTERN_C() -ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC); -ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC); -ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC); -#define zval_copy_ctor(zvalue) _zval_copy_ctor((zvalue) ZEND_FILE_LINE_CC) -#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC) -#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC) - -#if ZEND_DEBUG -ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue); -ZEND_API void _zval_dtor_wrapper(zval *zvalue); -ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr); -#define zval_copy_ctor_wrapper _zval_copy_ctor_wrapper -#define zval_dtor_wrapper _zval_dtor_wrapper -#define zval_ptr_dtor_wrapper _zval_ptr_dtor_wrapper -#else -#define zval_copy_ctor_wrapper _zval_copy_ctor -#define zval_dtor_wrapper _zval_dtor -#define zval_ptr_dtor_wrapper _zval_ptr_dtor -#endif - -END_EXTERN_C() - - -ZEND_API void zval_add_ref(zval **p); - -#define ZVAL_DESTRUCTOR (void (*)(void *)) zval_dtor_wrapper -#define ZVAL_PTR_DTOR (void (*)(void *)) zval_ptr_dtor_wrapper -#define ZVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor_wrapper - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/acconfig.h.in b/acconfig.h.in deleted file mode 100644 index f87979c2fd..0000000000 --- a/acconfig.h.in +++ /dev/null @@ -1 +0,0 @@ -/* Leave this file alone */ diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index 11ce6d7ae1..0000000000 --- a/acinclude.m4 +++ /dev/null @@ -1,1802 +0,0 @@ -dnl $Id$ -dnl -dnl This file contains local autoconf functions. - -dnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile[, ext_srcdir[, ext_builddir]]]) -dnl -dnl Processes a file called Makefile.frag in the source directory -dnl of the most recently added extension. $(srcdir) and $(builddir) -dnl are substituted with the proper paths. Can be used to supply -dnl custom rules and/or additional targets. -dnl -AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[ - ifelse($1,,src=$ext_srcdir/Makefile.frag,src=$1) - ifelse($2,,ac_srcdir=$ext_srcdir,ac_srcdir=$2) - ifelse($3,,ac_builddir=$ext_builddir,ac_builddir=$3) - sed -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments -]) - - -dnl PHP_DEFINE(WHAT[, value]) -dnl -dnl Creates builddir/include/what.h and in there #define WHAT value -dnl -AC_DEFUN([PHP_DEFINE],[ - [echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > include/php_]translit($1,A-Z,a-z)[.h] -]) - -dnl PHP_INIT_BUILD_SYSTEM -dnl -AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[ -test -d include || mkdir include -> Makefile.objects -> Makefile.fragments -dnl We need to play tricks here to avoid matching the grep line itself -pattern=define -grep -E $pattern'.*include/php' $srcdir/configure|sed 's/.*>//'|xargs touch 2>/dev/null -]) - -dnl PHP_GEN_GLOBAL_MAKEFILE -dnl -dnl Generates the global makefile. -dnl -AC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[ - cat >Makefile <> Makefile - done - - cat $abs_srcdir/Makefile.global Makefile.fragments Makefile.objects >> Makefile -]) - -dnl PHP_ADD_SOURCES(source-path, sources[, special-flags[, type]]) -dnl -dnl Adds sources which are located relative to source-path to the -dnl array of type type. Sources are processed with optional -dnl special-flags which are passed to the compiler. Sources -dnl can be either written in C or C++ (filenames shall end in .c -dnl or .cpp, respectively). -dnl -dnl Note: If source-path begins with a "/", the "/" is removed and -dnl the path is interpreted relative to the top build-directory. -dnl -dnl which array to append to? -AC_DEFUN([PHP_ADD_SOURCES],[ - PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,cli,PHP_CLI_OBJS,ifelse($4,sapi,PHP_SAPI_OBJS,PHP_GLOBAL_OBJS))) -]) -dnl -dnl _PHP_ASSIGN_BUILD_VARS(type) -dnl internal, don't use -AC_DEFUN([_PHP_ASSIGN_BUILD_VARS],[ -ifelse($1,shared,[ - b_c_pre=$shared_c_pre - b_cxx_pre=$shared_cxx_pre - b_c_meta=$shared_c_meta - b_cxx_meta=$shared_cxx_meta - b_c_post=$shared_c_post - b_cxx_post=$shared_cxx_post -],[ - b_c_pre=$php_c_pre - b_cxx_pre=$php_cxx_pre - b_c_meta=$php_c_meta - b_cxx_meta=$php_cxx_meta - b_c_post=$php_c_post - b_cxx_post=$php_cxx_post -])dnl - b_lo=[$]$1_lo -]) - -dnl PHP_ADD_SOURCES_X(source-path, sources[, special-flags[, target-var[, shared[, special-post-flags]]]]) -dnl -dnl Additional to PHP_ADD_SOURCES (see above), this lets you set the -dnl name of the array target-var directly, as well as whether -dnl shared objects will be built from the sources. Should not be -dnl used directly. -dnl -AC_DEFUN([PHP_ADD_SOURCES_X],[ -dnl relative to source- or build-directory? -dnl ac_srcdir/ac_bdir include trailing slash - case $1 in - ""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;; - /*[)] ac_srcdir=`echo "$1"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;; - *[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$1/"; ac_inc="-I$ac_bdir -I$ac_srcdir" ;; - esac - -dnl how to build .. shared or static? - ifelse($5,yes,_PHP_ASSIGN_BUILD_VARS(shared),_PHP_ASSIGN_BUILD_VARS(php)) - -dnl iterate over the sources - old_IFS=[$]IFS - for ac_src in $2; do - -dnl remove the suffix - IFS=. - set $ac_src - ac_obj=[$]1 - IFS=$old_IFS - -dnl append to the array which has been dynamically chosen at m4 time - $4="[$]$4 [$]ac_bdir[$]ac_obj.lo" - -dnl choose the right compiler/flags/etc. for the source-file - case $ac_src in - *.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;; - *.cpp[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;; - esac - -dnl create a rule for the object/source combo - cat >>Makefile.objects<]) - fi - - if test -z "$OPENSSL_LIBDIR"; then - AC_MSG_ERROR([Cannot find OpenSSL's libraries]) - fi - - old_CPPFLAGS=$CPPFLAGS - CPPFLAGS=-I$OPENSSL_INCDIR - AC_MSG_CHECKING([for OpenSSL version]) - AC_EGREP_CPP(yes,[ -#include -#if OPENSSL_VERSION_NUMBER >= 0x0090600fL - yes -#endif - ],[ - AC_MSG_RESULT([>= 0.9.6]) - ],[ - AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.]) - ]) - CPPFLAGS=$old_CPPFLAGS - - PHP_ADD_INCLUDE($OPENSSL_INCDIR) - PHP_ADD_LIBPATH($OPENSSL_LIBDIR) - - PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [ - PHP_ADD_LIBRARY(crypto) - ],[ - AC_MSG_ERROR([libcrypto not found!]) - ],[ - -L$OPENSSL_LIBDIR - ]) - - PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [ - PHP_ADD_LIBRARY(ssl) - ],[ - AC_MSG_ERROR([libssl not found!]) - ],[ - -L$OPENSSL_LIBDIR - ]) - - OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR - AC_SUBST(OPENSSL_INCDIR_OPT) -]) - -dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD) -dnl -dnl Use this macro, if you need to add libraries and or library search -dnl paths to the PHP build system which are only given in compiler -dnl notation. -dnl -AC_DEFUN([PHP_EVAL_LIBLINE],[ - for ac_i in $1; do - case $ac_i in - -l*) - ac_ii=`echo $ac_i|cut -c 3-` - PHP_ADD_LIBRARY($ac_ii,1,$2) - ;; - -L*) - ac_ii=`echo $ac_i|cut -c 3-` - PHP_ADD_LIBPATH($ac_ii,$2) - ;; - esac - done -]) - -dnl PHP_EVAL_INCLINE(LINE) -dnl -dnl Use this macro, if you need to add header search paths to the PHP -dnl build system which are only given in compiler notation. -dnl -AC_DEFUN([PHP_EVAL_INCLINE],[ - for ac_i in $1; do - case $ac_i in - -I*) - ac_ii=`echo $ac_i|cut -c 3-` - PHP_ADD_INCLUDE($ac_ii) - ;; - esac - done -]) - -AC_DEFUN([PHP_READDIR_R_TYPE],[ - dnl HAVE_READDIR_R is also defined by libmysql - AC_CHECK_FUNC(readdir_r,ac_cv_func_readdir_r=yes,ac_cv_func_readdir=no) - if test "$ac_cv_func_readdir_r" = "yes"; then - AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[ - AC_TRY_RUN([ -#define _REENTRANT -#include -#include - -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif - -main() { - DIR *dir; - char entry[sizeof(struct dirent)+PATH_MAX]; - struct dirent *pentry = (struct dirent *) &entry; - - dir = opendir("/"); - if (!dir) - exit(1); - if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) - exit(0); - exit(1); -} - ],[ - ac_cv_what_readdir_r=POSIX - ],[ - AC_TRY_CPP([ -#define _REENTRANT -#include -#include -int readdir_r(DIR *, struct dirent *); - ],[ - ac_cv_what_readdir_r=old-style - ],[ - ac_cv_what_readdir_r=none - ]) - ],[ - ac_cv_what_readdir_r=none - ]) - ]) - case $ac_cv_what_readdir_r in - POSIX) - AC_DEFINE(HAVE_POSIX_READDIR_R,1,[whether you have POSIX readdir_r]);; - old-style) - AC_DEFINE(HAVE_OLD_READDIR_R,1,[whether you have old-style readdir_r]);; - esac - fi -]) - -AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[ - PHP_SUBST(SHLIB_SUFFIX_NAME) - SHLIB_SUFFIX_NAME=so - case $host_alias in - *hpux*) - SHLIB_SUFFIX_NAME=sl - ;; - *darwin*) - SHLIB_SUFFIX_NAME=dylib - ;; - esac -]) - -AC_DEFUN([PHP_DEBUG_MACRO],[ - DEBUG_LOG=$1 - cat >$1 <conftest.$ac_ext <>$1 2>&1 - rm -fr conftest* -]) - -AC_DEFUN([PHP_DOES_PWRITE_WORK],[ - AC_TRY_RUN([ -#include -#include -#include -#include -#include -$1 - main() { - int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); - - if (fd < 0) exit(1); - if (pwrite(fd, "text", 4, 0) != 4) exit(1); - /* Linux glibc breakage until 2.2.5 */ - if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1); - exit(0); - } - - ],[ - ac_cv_pwrite=yes - ],[ - ac_cv_pwrite=no - ],[ - ac_cv_pwrite=no - ]) -]) - -AC_DEFUN([PHP_DOES_PREAD_WORK],[ - echo test > conftest_in - AC_TRY_RUN([ -#include -#include -#include -#include -#include -$1 - main() { - char buf[3]; - int fd = open("conftest_in", O_RDONLY); - if (fd < 0) exit(1); - if (pread(fd, buf, 2, 0) != 2) exit(1); - /* Linux glibc breakage until 2.2.5 */ - if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1); - exit(0); - } - ],[ - ac_cv_pread=yes - ],[ - ac_cv_pread=no - ],[ - ac_cv_pread=no - ]) - rm -f conftest_in -]) - -AC_DEFUN([PHP_PWRITE_TEST],[ - AC_CACHE_CHECK(whether pwrite works,ac_cv_pwrite,[ - PHP_DOES_PWRITE_WORK - if test "$ac_cv_pwrite" = "no"; then - PHP_DOES_PWRITE_WORK([ssize_t pwrite(int, void *, size_t, off64_t);]) - if test "$ac_cv_pwrite" = "yes"; then - ac_cv_pwrite=64 - fi - fi - ]) - - if test "$ac_cv_pwrite" != "no"; then - AC_DEFINE(HAVE_PWRITE, 1, [ ]) - if test "$ac_cv_pwrite" = "64"; then - AC_DEFINE(PHP_PWRITE_64, 1, [whether pwrite64 is default]) - fi - fi -]) - -AC_DEFUN([PHP_PREAD_TEST],[ - AC_CACHE_CHECK(whether pread works,ac_cv_pread,[ - PHP_DOES_PREAD_WORK - if test "$ac_cv_pread" = "no"; then - PHP_DOES_PREAD_WORK([ssize_t pread(int, void *, size_t, off64_t);]) - if test "$ac_cv_pread" = "yes"; then - ac_cv_pread=64 - fi - fi - ]) - - if test "$ac_cv_pread" != "no"; then - AC_DEFINE(HAVE_PREAD, 1, [ ]) - if test "$ac_cv_pread" = "64"; then - AC_DEFINE(PHP_PREAD_64, 1, [whether pread64 is default]) - fi - fi -]) - -AC_DEFUN([PHP_MISSING_TIME_R_DECL],[ - AC_MSG_CHECKING([for missing declarations of reentrant functions]) - AC_TRY_COMPILE([#include ],[struct tm *(*func)() = localtime_r],[ - : - ],[ - AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared]) - ]) - AC_TRY_COMPILE([#include ],[struct tm *(*func)() = gmtime_r],[ - : - ],[ - AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared]) - ]) - AC_TRY_COMPILE([#include ],[char *(*func)() = asctime_r],[ - : - ],[ - AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared]) - ]) - AC_TRY_COMPILE([#include ],[char *(*func)() = ctime_r],[ - : - ],[ - AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared]) - ]) - AC_TRY_COMPILE([#include ],[char *(*func)() = strtok_r],[ - : - ],[ - AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared]) - ]) - AC_MSG_RESULT([done]) -]) - -dnl -dnl PHP_LIBGCC_LIBPATH(gcc) -dnl Stores the location of libgcc in libgcc_libpath -dnl -AC_DEFUN([PHP_LIBGCC_LIBPATH],[ - changequote({,}) - libgcc_libpath=`$1 --print-libgcc-file-name|sed 's%/*[^/][^/]*$%%'` - changequote([,]) -]) - -AC_DEFUN([PHP_ARG_ANALYZE_EX],[ -ext_output="yes, shared" -ext_shared=yes -case [$]$1 in -shared,*) - $1=`echo "[$]$1"|sed 's/^shared,//'` - ;; -shared) - $1=yes - ;; -no) - ext_output=no - ext_shared=no - ;; -*) - ext_output=yes - ext_shared=no - ;; -esac - -PHP_ALWAYS_SHARED([$1]) -]) - -AC_DEFUN([PHP_ARG_ANALYZE],[ -ifelse([$3],yes,[PHP_ARG_ANALYZE_EX([$1])],[ext_output=ifelse([$]$1,,no,[$]$1)]) -ifelse([$2],,,[AC_MSG_RESULT([$ext_output])]) -]) - -dnl -dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val[, extension-or-not]]) -dnl Sets PHP_ARG_NAME either to the user value or to the default value. -dnl default-val defaults to no. This will also set the variable ext_shared, -dnl and will overwrite any previous variable of that name. -dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run -dnl the PHP_ARG_ANALYZE_EX. -dnl -AC_DEFUN([PHP_ARG_WITH],[ -PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_),[ifelse($5,,yes,$5)]) -]) - -AC_DEFUN([PHP_REAL_ARG_WITH],[ -ifelse([$2],,,[AC_MSG_CHECKING([$2])]) -AC_ARG_WITH($1,[$3],$5=[$]withval, -[ - $5=ifelse($4,,no,$4) - - if test "$PHP_ENABLE_ALL" && test "$6" = "yes"; then - $5=$PHP_ENABLE_ALL - fi -]) -PHP_ARG_ANALYZE($5,[$2],$6) -]) - -dnl -dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val[, extension-or-not]]) -dnl Sets PHP_ARG_NAME either to the user value or to the default value. -dnl default-val defaults to no. This will also set the variable ext_shared, -dnl and will overwrite any previous variable of that name. -dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run -dnl the PHP_ARG_ANALYZE_EX. -dnl -AC_DEFUN([PHP_ARG_ENABLE],[ -PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_),[ifelse($5,,yes,$5)]) -]) - -AC_DEFUN([PHP_REAL_ARG_ENABLE],[ -ifelse([$2],,,[AC_MSG_CHECKING([$2])]) -AC_ARG_ENABLE($1,[$3],$5=[$]enableval, -[ - $5=ifelse($4,,no,$4) - - if test "$PHP_ENABLE_ALL" && test "$6" = "yes"; then - $5=$PHP_ENABLE_ALL - fi -]) -PHP_ARG_ANALYZE($5,[$2],$6) -]) - -AC_DEFUN([PHP_ARG_BUNDLE],[ -PHP_REAL_ARG_BUNDLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_),[ifelse($5,,yes,$5)]) -]) - -AC_DEFUN([PHP_REAL_ARG_BUNDLE],[ -ifelse([$2],,,[AC_MSG_CHECKING([$2])]) -AC_ARG_WITH($1,[$3],$5=[$]withval, -[ - $5=ifelse($4,,no,$4) - - if test "$PHP_BUNDLE_ALL" && test "$6" = "yes"; then - $5=$PHP_BUNDLE_ALL - fi -]) -PHP_ARG_ANALYZE($5,[$2],$6) -]) - -AC_DEFUN([PHP_MODULE_PTR],[ - EXTRA_MODULE_PTRS="$EXTRA_MODULE_PTRS $1," -]) - -AC_DEFUN([PHP_CONFIG_NICE],[ - test -f $1 && mv $1 $1.old - rm -f $1.old - cat >$1<> $1 - fi - done - - for arg in [$]0 "[$]@"; do - echo "'[$]arg' \\" >> $1 - done - echo '"[$]@"' >> $1 - chmod +x $1 -]) - -AC_DEFUN([PHP_TIME_R_TYPE],[ -AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[ -AC_TRY_RUN([ -#include - -main() { -char buf[27]; -struct tm t; -time_t old = 0; -int r, s; - -s = gmtime_r(&old, &t); -r = (int) asctime_r(&t, buf, 26); -if (r == s && s == 0) return (0); -return (1); -} -],[ - ac_cv_time_r_type=hpux -],[ - AC_TRY_RUN([ -#include -main() { - struct tm t, *s; - time_t old = 0; - char buf[27], *p; - - s = gmtime_r(&old, &t); - p = asctime_r(&t, buf, 26); - if (p == buf && s == &t) return (0); - return (1); -} - ],[ - ac_cv_time_r_type=irix - ],[ - ac_cv_time_r_type=POSIX - ]) -],[ - ac_cv_time_r_type=POSIX -]) -]) - case $ac_cv_time_r_type in - hpux) AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;; - irix) AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;; - esac -]) - -AC_DEFUN([PHP_SUBST],[ - PHP_VAR_SUBST="$PHP_VAR_SUBST $1" -]) - -AC_DEFUN([PHP_SUBST_OLD],[ - PHP_SUBST($1) - AC_SUBST($1) -]) - -AC_DEFUN([PHP_TM_GMTOFF],[ -AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, -[AC_TRY_COMPILE([#include -#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;], - ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)]) - -if test "$ac_cv_struct_tm_gmtoff" = yes; then - AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm]) -fi -]) - -dnl PHP_CONFIGURE_PART(MESSAGE) -dnl Idea borrowed from mm -AC_DEFUN([PHP_CONFIGURE_PART],[ - AC_MSG_RESULT() - AC_MSG_RESULT([${T_MD}$1${T_ME}]) -]) - -AC_DEFUN([PHP_PROG_SENDMAIL],[ -PHP_ALT_PATH=/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib -AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:$PHP_ALT_PATH) -if test -n "$PROG_SENDMAIL"; then - AC_DEFINE(HAVE_SENDMAIL,1,[whether you have sendmail]) -fi -]) - -AC_DEFUN([PHP_RUNPATH_SWITCH],[ -dnl check for -R, etc. switch -AC_MSG_CHECKING([if compiler supports -R]) -AC_CACHE_VAL(php_cv_cc_dashr,[ - SAVE_LIBS=$LIBS - LIBS="-R /usr/lib $LIBS" - AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no) - LIBS=$SAVE_LIBS]) -AC_MSG_RESULT([$php_cv_cc_dashr]) -if test $php_cv_cc_dashr = "yes"; then - ld_runpath_switch=-R -else - AC_MSG_CHECKING([if compiler supports -Wl,-rpath,]) - AC_CACHE_VAL(php_cv_cc_rpath,[ - SAVE_LIBS=$LIBS - LIBS="-Wl,-rpath,/usr/lib $LIBS" - AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no) - LIBS=$SAVE_LIBS]) - AC_MSG_RESULT([$php_cv_cc_rpath]) - if test $php_cv_cc_rpath = "yes"; then - ld_runpath_switch=-Wl,-rpath, - else - dnl something innocuous - ld_runpath_switch=-L - fi -fi -]) - -AC_DEFUN([PHP_STRUCT_FLOCK],[ -AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock, - AC_TRY_COMPILE([ -#include -#include - ], - [struct flock x;], - [ - ac_cv_struct_flock=yes - ],[ - ac_cv_struct_flock=no - ]) -) -if test "$ac_cv_struct_flock" = "yes" ; then - AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock]) -fi -]) - -AC_DEFUN([PHP_SOCKLEN_T],[ -AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t, - AC_TRY_COMPILE([ -#include -#include -],[ -socklen_t x; -],[ - ac_cv_socklen_t=yes -],[ - ac_cv_socklen_t=no -])) -if test "$ac_cv_socklen_t" = "yes"; then - AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t]) -fi -]) - -dnl -dnl PHP_SET_SYM_FILE(path) -dnl -dnl set the path of the file which contains the symbol export list -dnl -AC_DEFUN([PHP_SET_SYM_FILE], -[ - PHP_SYM_FILE=$1 -]) - -dnl -dnl PHP_BUILD_THREAD_SAFE -dnl -AC_DEFUN([PHP_BUILD_THREAD_SAFE],[ - enable_maintainer_zts=yes - if test "$pthreads_working" != "yes"; then - AC_MSG_ERROR([ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.]) - fi -]) - -AC_DEFUN([PHP_REQUIRE_CXX],[ - if test -z "$php_cxx_done"; then - AC_PROG_CXX - AC_PROG_CXXCPP - php_cxx_done=yes - fi -]) - -dnl -dnl PHP_BUILD_SHARED -dnl -AC_DEFUN([PHP_BUILD_SHARED],[ - PHP_BUILD_PROGRAM - OVERALL_TARGET=libphp5.la - php_build_target=shared - - php_c_pre=$shared_c_pre - php_c_meta=$shared_c_meta - php_c_post=$shared_c_post - php_cxx_pre=$shared_cxx_pre - php_cxx_meta=$shared_cxx_meta - php_cxx_post=$shared_cxx_post - php_lo=$shared_lo -]) - -dnl -dnl PHP_BUILD_STATIC -dnl -AC_DEFUN([PHP_BUILD_STATIC],[ - PHP_BUILD_PROGRAM - OVERALL_TARGET=libphp5.la - php_build_target=static -]) - -dnl -dnl PHP_BUILD_BUNDLE -dnl -AC_DEFUN([PHP_BUILD_BUNDLE],[ - PHP_BUILD_PROGRAM - OVERALL_TARGET=libs/libphp5.bundle - php_build_target=static -]) - -dnl -dnl PHP_BUILD_PROGRAM -dnl -AC_DEFUN([PHP_BUILD_PROGRAM],[ - OVERALL_TARGET=[]ifelse($1,,php,$1) - php_c_pre='$(CC)' - php_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS)' - php_c_post=' && echo > $[@]' - php_cxx_pre='$(CXX)' - php_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)' - php_cxx_post=' && echo > $[@]' - php_lo=o - - shared_c_pre='$(LIBTOOL) --mode=compile $(CC)' - shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -prefer-pic' - shared_c_post= - shared_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)' - shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -prefer-pic' - shared_cxx_post= - shared_lo=lo - - php_build_target=program -]) - -dnl -dnl PHP_RUN_ONCE(namespace, variable, code) -dnl -dnl execute code, if variable is not set in namespace -dnl -AC_DEFUN([PHP_RUN_ONCE],[ - changequote({,}) - unique=`echo $2|sed 's/[^a-zA-Z0-9]/_/g'` - changequote([,]) - cmd="echo $ac_n \"\$$1$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "$1$unique=set" - $3 - fi -]) - -dnl -dnl PHP_EXPAND_PATH(path, variable) -dnl -dnl expands path to an absolute path and assigns it to variable -dnl -AC_DEFUN([PHP_EXPAND_PATH],[ - if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then - $2=$1 - else - changequote({,}) - ep_dir="`echo $1|sed 's%/*[^/][^/]*/*$%%'`" - changequote([,]) - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - $2="$ep_realdir/`basename \"$1\"`" - fi -]) -dnl -dnl internal, don't use -AC_DEFUN([_PHP_ADD_LIBPATH_GLOBAL],[ - PHP_RUN_ONCE(LIBPATH, $1, [ - test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$1" - LDFLAGS="$LDFLAGS -L$1" - PHP_RPATHS="$PHP_RPATHS $1" - ]) -])dnl -dnl -dnl -dnl -dnl PHP_ADD_LIBPATH(path[, shared-libadd]) -dnl -dnl add a library to linkpath/runpath -dnl -AC_DEFUN([PHP_ADD_LIBPATH],[ - if test "$1" != "/usr/lib"; then - PHP_EXPAND_PATH($1, ai_p) - ifelse([$2],,[ - _PHP_ADD_LIBPATH_GLOBAL([$ai_p]) - ],[ - if test "$ext_shared" = "yes"; then - $2="$ld_runpath_switch$ai_p -L$ai_p [$]$2" - else - _PHP_ADD_LIBPATH_GLOBAL([$ai_p]) - fi - ]) - fi -]) - -dnl -dnl PHP_UTILIZE_RPATHS() -dnl -dnl builds RPATHS/LDFLAGS from PHP_RPATHS -dnl -AC_DEFUN([PHP_UTILIZE_RPATHS],[ - OLD_RPATHS=$PHP_RPATHS - unset PHP_RPATHS - - for i in $OLD_RPATHS; do -dnl Can be passed to native cc/libtool - PHP_LDFLAGS="$PHP_LDFLAGS -L$i" -dnl Libtool-specific - PHP_RPATHS="$PHP_RPATHS -R $i" -dnl cc-specific - NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i" - done - - if test "$PHP_RPATH" = "no"; then - unset PHP_RPATHS - unset NATIVE_RPATHS - fi -]) - -dnl -dnl PHP_ADD_INCLUDE(path [,before]) -dnl -dnl add an include path. -dnl if before is 1, add in the beginning of INCLUDES. -dnl -AC_DEFUN([PHP_ADD_INCLUDE],[ - if test "$1" != "/usr/include"; then - PHP_EXPAND_PATH($1, ai_p) - PHP_RUN_ONCE(INCLUDEPATH, $ai_p, [ - if test "$2"; then - INCLUDES="-I$ai_p $INCLUDES" - else - INCLUDES="$INCLUDES -I$ai_p" - fi - ]) - fi -]) -dnl -dnl internal, don't use -AC_DEFUN([_PHP_X_ADD_LIBRARY],[dnl - ifelse([$2],,$3="-l$1 [$]$3", $3="[$]$3 -l$1") dnl -])dnl -dnl -dnl internal, don't use -AC_DEFUN([_PHP_ADD_LIBRARY_SKELETON],[ - case $1 in - c|c_r|pthread*[)] ;; - *[)] ifelse($3,,[ - _PHP_X_ADD_LIBRARY($1,$2,$5) - ],[ - if test "$ext_shared" = "yes"; then - _PHP_X_ADD_LIBRARY($1,$2,$3) - else - $4($1,$2) - fi - ]) ;; - esac -])dnl -dnl -dnl -dnl -dnl PHP_ADD_LIBRARY(library[, append[, shared-libadd]]) -dnl -dnl add a library to the link line -dnl -AC_DEFUN([PHP_ADD_LIBRARY],[ - _PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY],[LIBS]) -]) - -dnl -dnl PHP_ADD_LIBRARY_DEFER(library[, append[, shared-libadd]]) -dnl -dnl add a library to the link line (deferred) -dnl -AC_DEFUN([PHP_ADD_LIBRARY_DEFER],[ - _PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY_DEFER],[DLIBS]) -]) - -dnl -dnl PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd]) -dnl -dnl add a library to the link line and path to linkpath/runpath. -dnl if shared-libadd is not empty and $ext_shared is yes, -dnl shared-libadd will be assigned the library information -dnl -AC_DEFUN([PHP_ADD_LIBRARY_WITH_PATH],[ -ifelse($3,,[ - if test -n "$2"; then - PHP_ADD_LIBPATH($2) - fi - PHP_ADD_LIBRARY($1) -],[ - if test "$ext_shared" = "yes"; then - $3="-l$1 [$]$3" - if test -n "$2"; then - PHP_ADD_LIBPATH($2,$3) - fi - else - PHP_ADD_LIBRARY_WITH_PATH($1,$2) - fi -]) -]) - -dnl -dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path[, shared-libadd]) -dnl -dnl add a library to the link line (deferred) -dnl and path to linkpath/runpath (not deferred) -dnl if shared-libadd is not empty and $ext_shared is yes, -dnl shared-libadd will be assigned the library information -dnl -AC_DEFUN([PHP_ADD_LIBRARY_DEFER_WITH_PATH],[ -ifelse($3,,[ - if test -n "$2"; then - PHP_ADD_LIBPATH($2) - fi - PHP_ADD_LIBRARY_DEFER($1) -],[ - if test "$ext_shared" = "yes"; then - $3="-l$1 [$]$3" - if test -n "$2"; then - PHP_ADD_LIBPATH($2,$3) - fi - else - PHP_ADD_LIBRARY_DEFER_WITH_PATH($1,$2) - fi -]) -]) - -dnl -dnl PHP_ADD_FRAMEWORK(framework [,before]) -dnl -dnl add a (Darwin / Mac OS X) framework to the link -dnl line. if before is 1, the framework is added -dnl to the beginning of the line. - -AC_DEFUN([PHP_ADD_FRAMEWORK], [ - PHP_RUN_ONCE(FRAMEWORKS, $1, [ - if test "$2"; then - PHP_FRAMEWORKS="-framework $1 $PHP_FRAMEWORKS" - else - PHP_FRAMEWORKS="$PHP_FRAMEWORKS -framework $1" - fi - ]) -]) - -dnl -dnl PHP_ADD_FRAMEWORKPATH(path [,before]) -dnl -dnl add a (Darwin / Mac OS X) framework path to the link -dnl and include lines. default paths include (but are -dnl not limited to) /Local/Library/Frameworks and -dnl /System/Library/Frameworks, so these don't need -dnl to be specifically added. if before is 1, the -dnl framework path is added to the beginning of the -dnl relevant lines. - -AC_DEFUN([PHP_ADD_FRAMEWORKPATH], [ - PHP_EXPAND_PATH($1, ai_p) - PHP_RUN_ONCE(FRAMEWORKPATH, $ai_p, [ - if test "$2"; then - PHP_FRAMEWORKPATH="-F$ai_p $PHP_FRAMEWORKPATH" - else - PHP_FRAMEWORKPATH="$PHP_FRAMEWORKPATH -F$ai_p" - fi - ]) -]) - -dnl -dnl PHP_ADD_FRAMEWORK_WITH_PATH(framework, path) -dnl -dnl add a (Darwin / Mac OS X) framework path and the -dnl framework itself to the link and include lines. -AC_DEFUN([PHP_ADD_FRAMEWORK_WITH_PATH], [ - PHP_ADD_FRAMEWORKPATH($2) - PHP_ADD_FRAMEWORK($1) -]) - -dnl -dnl Set libtool variable -dnl -AC_DEFUN([PHP_SET_LIBTOOL_VARIABLE],[ - if test -z "$LIBTOOL"; then - LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' - else - LIBTOOL="$LIBTOOL $1" - fi -]) - -dnl -dnl Check for cc option -dnl -AC_DEFUN([PHP_CHECK_CC_OPTION],[ - echo "main(){return 0;}" > conftest.$ac_ext - opt=$1 - changequote({,}) - var=`echo $opt|sed 's/[^a-zA-Z0-9]/_/g'` - changequote([,]) - AC_MSG_CHECKING([if compiler supports -$1 really]) - ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1" - if eval $ac_php_compile 2>&1 | grep -E "$opt" > /dev/null 2>&1 ; then - eval php_cc_$var=no - AC_MSG_RESULT([no]) - else - if eval ./conftest 2>/dev/null ; then - eval php_cc_$var=yes - AC_MSG_RESULT([yes]) - else - eval php_cc_$var=no - AC_MSG_RESULT([no]) - fi - fi -]) - -AC_DEFUN([PHP_REGEX],[ - -if test "$REGEX_TYPE" = "php"; then - AC_DEFINE(HSREGEX,1,[ ]) - AC_DEFINE(REGEX,1,[ ]) - PHP_ADD_SOURCES(regex, regcomp.c regexec.c regerror.c regfree.c) -elif test "$REGEX_TYPE" = "system"; then - AC_DEFINE(REGEX,0,[ ]) -fi - -AC_MSG_CHECKING([which regex library to use]) -AC_MSG_RESULT([$REGEX_TYPE]) -]) - -dnl -dnl See if we have broken header files like SunOS has. -dnl -AC_DEFUN([PHP_MISSING_FCLOSE_DECL],[ - AC_MSG_CHECKING([for fclose declaration]) - AC_TRY_COMPILE([#include ],[int (*func)() = fclose],[ - AC_DEFINE(MISSING_FCLOSE_DECL,0,[ ]) - AC_MSG_RESULT([ok]) - ],[ - AC_DEFINE(MISSING_FCLOSE_DECL,1,[ ]) - AC_MSG_RESULT([missing]) - ]) -]) - -dnl -dnl Check for broken sprintf(), C99 conformance -dnl -AC_DEFUN([PHP_AC_BROKEN_SPRINTF],[ - AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[ - AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[ - ac_cv_broken_sprintf=no - ],[ - ac_cv_broken_sprintf=yes - ],[ - ac_cv_broken_sprintf=no - ]) - ]) - if test "$ac_cv_broken_sprintf" = "yes"; then - AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [Whether sprintf is C99 conform]) - else - AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [Whether sprintf is C99 conform]) - fi -]) - -dnl -dnl Check for broken snprintf(), C99 conformance -dnl -AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[ - AC_CACHE_CHECK(whether snprintf is broken, ac_cv_broken_snprintf,[ - AC_TRY_RUN([ -#define NULL (0L) -main() { - char buf[20]; - int res = 0; - res = res || (snprintf(buf, 2, "marcus") != 6); - res = res || (buf[1] != '\0'); - res = res || (snprintf(buf, 0, "boerger") != 7); - res = res || (buf[0] != 'm'); - res = res || (snprintf(NULL, 0, "boerger") != 7); - res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8); - exit(res); -} - ],[ - ac_cv_broken_snprintf=no - ],[ - ac_cv_broken_snprintf=yes - ],[ - ac_cv_broken_snprintf=no - ]) - ]) - if test "$ac_cv_broken_snprintf" = "yes"; then - AC_DEFINE(PHP_BROKEN_SNPRINTF, 1, [Whether snprintf is C99 conform]) - else - AC_DEFINE(PHP_BROKEN_SNPRINTF, 0, [Whether snprintf is C99 conform]) - fi -]) - -dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx) -dnl -dnl Basically sets up the link-stage for building module-name -dnl from object_var in build-dir. -dnl -AC_DEFUN([PHP_SHARED_MODULE],[ - PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la" - PHP_SUBST($2) - cat >>Makefile.objects</dev/null` - case $os in - "SunOS 5.6"|"SunOS 5.7") - case $CC in - gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";; - *) CFLAGS="$CFLAGS -fpic";; - esac - AC_MSG_RESULT([yes]);; - *) - AC_MSG_RESULT([no]);; - esac - else - AC_MSG_RESULT([no]) - fi -]) - -dnl -dnl Checks whether $withval is "shared" or starts with "shared,XXX" -dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff -dnl from $withval. -dnl -AC_DEFUN([PHP_WITH_SHARED],[ - PHP_ARG_ANALYZE_EX(withval) - shared=$ext_shared - unset ext_shared ext_output -]) - -dnl The problem is that the default compilation flags in Solaris 2.6 won't -dnl let programs access large files; you need to tell the compiler that -dnl you actually want your programs to work on large files. For more -dnl details about this brain damage please see: -dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html - -dnl Written by Paul Eggert . - -AC_DEFUN([PHP_SYS_LFS], -[dnl - # If available, prefer support for large files unless the user specified - # one of the CPPFLAGS, LDFLAGS, or LIBS variables. - AC_MSG_CHECKING([whether large file support needs explicit enabling]) - ac_getconfs='' - ac_result=yes - ac_set='' - ac_shellvars='CPPFLAGS LDFLAGS LIBS' - for ac_shellvar in $ac_shellvars; do - case $ac_shellvar in - CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;; - *) ac_lfsvar=LFS_$ac_shellvar ;; - esac - eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar - (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } - ac_getconf=`getconf $ac_lfsvar` - ac_getconfs=$ac_getconfs$ac_getconf - eval ac_test_$ac_shellvar=\$ac_getconf - done - case "$ac_result$ac_getconfs" in - yes) ac_result=no ;; - esac - case "$ac_result$ac_set" in - yes?*) ac_result="yes, but $ac_set is already set, so use its settings" - esac - AC_MSG_RESULT([$ac_result]) - case $ac_result in - yes) - for ac_shellvar in $ac_shellvars; do - eval $ac_shellvar=\$ac_test_$ac_shellvar - done ;; - esac -]) - -AC_DEFUN([PHP_SOCKADDR_SA_LEN],[ - AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[ - AC_TRY_COMPILE([#include -#include ], - [struct sockaddr s; s.sa_len;], - [ac_cv_sockaddr_sa_len=yes - AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[ ])], - [ac_cv_sockaddr_sa_len=no]) - ]) -]) - - -dnl ## PHP_OUTPUT(file) -dnl ## adds "file" to the list of files generated by AC_OUTPUT -dnl ## This macro can be used several times. -AC_DEFUN([PHP_OUTPUT],[ - PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1" -]) - -AC_DEFUN([PHP_DECLARED_TIMEZONE],[ - AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[ - AC_TRY_COMPILE([ -#include -#include -#ifdef HAVE_SYS_TIME_H -#include -#endif -],[ - time_t foo = (time_t) timezone; -],[ - ac_cv_declared_timezone=yes -],[ - ac_cv_declared_timezone=no -])]) - if test "$ac_cv_declared_timezone" = "yes"; then - AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone]) - fi -]) - -AC_DEFUN([PHP_EBCDIC],[ - AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[ - AC_TRY_RUN( [ -int main(void) { - return (unsigned char)'A' != (unsigned char)0xC1; -} -],[ - ac_cv_ebcdic=yes -],[ - ac_cv_ebcdic=no -],[ - ac_cv_ebcdic=no -])]) - if test "$ac_cv_ebcdic" = "yes"; then - AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC]) - fi -]) - -dnl Some systems, notably Solaris, cause getcwd() or realpath to fail if a -dnl component of the path has execute but not read permissions -AC_DEFUN([PHP_BROKEN_GETCWD],[ - AC_MSG_CHECKING([for broken getcwd]) - os=`uname -sr 2>/dev/null` - case $os in - SunOS*) - AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd]) - AC_MSG_RESULT([yes]);; - *) - AC_MSG_RESULT([no]);; - esac -]) - -AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND],[ - AC_MSG_CHECKING([for broken libc stdio]) - AC_CACHE_VAL(have_broken_glibc_fopen_append,[ - AC_TRY_RUN([ -#include -int main(int argc, char *argv[]) -{ - FILE *fp; - long position; - char *filename = "/tmp/phpglibccheck"; - - fp = fopen(filename, "w"); - if (fp == NULL) { - perror("fopen"); - exit(2); - } - fputs("foobar", fp); - fclose(fp); - - fp = fopen(filename, "a+"); - position = ftell(fp); - fclose(fp); - unlink(filename); - if (position == 0) - return 1; - return 0; -} -], -[have_broken_glibc_fopen_append=no], -[have_broken_glibc_fopen_append=yes ], -AC_TRY_COMPILE([ -#include -],[ -#if !__GLIBC_PREREQ(2,2) -choke me -#endif -], -[have_broken_glibc_fopen_append=yes], -[have_broken_glibc_fopen_append=no ]) -)]) - - if test "$have_broken_glibc_fopen_append" = "yes"; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+]) - else - AC_MSG_RESULT(no) - fi -]) - - -AC_DEFUN([PHP_FOPENCOOKIE],[ - AC_CHECK_FUNC(fopencookie, [ have_glibc_fopencookie=yes ]) - - if test "$have_glibc_fopencookie" = "yes" ; then - dnl this comes in two flavors: - dnl newer glibcs (since 2.1.2 ? ) - dnl have a type called cookie_io_functions_t - AC_TRY_COMPILE([ #define _GNU_SOURCE - #include - ], - [ cookie_io_functions_t cookie; ], - [ have_cookie_io_functions_t=yes ], - [] ) - - if test "$have_cookie_io_functions_t" = "yes" ; then - cookie_io_functions_t=cookie_io_functions_t - have_fopen_cookie=yes - - dnl even newer glibcs have a different seeker definition... - - AC_TRY_RUN([ -#define _GNU_SOURCE -#include - -struct cookiedata { - __off64_t pos; -}; - -__ssize_t reader(void *cookie, char *buffer, size_t size) -{ return size; } -__ssize_t writer(void *cookie, const char *buffer, size_t size) -{ return size; } -int closer(void *cookie) -{ return 0; } -int seeker(void *cookie, __off64_t *position, int whence) -{ ((struct cookiedata*)cookie)->pos = *position; return 0; } - -cookie_io_functions_t funcs = {reader, writer, seeker, closer}; - -main() { - struct cookiedata g = { 0 }; - FILE *fp = fopencookie(&g, "r", funcs); - - if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192) - exit(0); - exit(1); -} - - ], - [ cookie_io_functions_use_off64_t=yes ], - [ ] ) - - else - dnl older glibc versions (up to 2.1.2 ?) - dnl call it _IO_cookie_io_functions_t - AC_TRY_COMPILE([ #define _GNU_SOURCE - #include - ], - [ _IO_cookie_io_functions_t cookie; ], - [ have_IO_cookie_io_functions_t=yes ], - [] ) - if test "$have_cookie_io_functions_t" = "yes" ; then - cookie_io_functions_t=_IO_cookie_io_functions_t - have_fopen_cookie=yes - fi - fi - - if test "$have_fopen_cookie" = "yes" ; then - AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ]) - AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ]) - if test "$cookie_io_functions_use_off64_t" = "yes" ; then - AC_DEFINE(COOKIE_SEEKER_USES_OFF64_T, 1, [ ]) - fi - fi - - fi -]) - - -dnl -dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]]) -dnl -dnl Wrapper for AC_CHECK_LIB -dnl -AC_DEFUN([PHP_CHECK_LIBRARY], [ - save_old_LDFLAGS=$LDFLAGS - LDFLAGS="$5 $LDFLAGS" - AC_CHECK_LIB([$1],[$2],[ - LDFLAGS=$save_old_LDFLAGS - $3 - ],[ - LDFLAGS=$save_old_LDFLAGS - unset ac_cv_func_$1 - $4 - ])dnl -]) - -dnl -dnl PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]]) -dnl -dnl El cheapo wrapper for AC_CHECK_LIB -dnl -AC_DEFUN([PHP_CHECK_FRAMEWORK], [ - save_old_LDFLAGS=$LDFLAGS - LDFLAGS="-framework $1 $LDFLAGS" - dnl supplying "c" to AC_CHECK_LIB is technically cheating, but - dnl rewriting AC_CHECK_LIB is overkill and this only affects - dnl the "checking.." output anyway. - AC_CHECK_LIB(c,[$2],[ - LDFLAGS=$save_old_LDFLAGS - $3 - ],[ - LDFLAGS=$save_old_LDFLAGS - $4 - ]) -]) - -dnl -dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]]) -dnl -dnl Common setup macro for iconv -dnl -AC_DEFUN([PHP_SETUP_ICONV], [ - found_iconv=no - unset ICONV_DIR - - dnl - dnl Check libc first if no path is provided in --with-iconv - dnl - if test "$PHP_ICONV" = "yes"; then - AC_CHECK_FUNC(iconv, [ - PHP_DEFINE(HAVE_ICONV) - found_iconv=yes - ],[ - AC_CHECK_FUNC(libiconv,[ - PHP_DEFINE(HAVE_LIBICONV) - found_iconv=yes - ]) - ]) - fi - - dnl - dnl Check external libs for iconv funcs - dnl - if test "$found_iconv" = "no"; then - - for i in $PHP_ICONV /usr/local /usr; do - if test -r $i/include/giconv.h; then - AC_DEFINE(HAVE_GICONV_H, 1, [ ]) - ICONV_DIR=$i - iconv_lib_name=giconv - break - elif test -r $i/include/iconv.h; then - ICONV_DIR=$i - iconv_lib_name=iconv - break - fi - done - - if test -z "$ICONV_DIR"; then - AC_MSG_ERROR([Please specify the install prefix of iconv with --with-iconv=]) - fi - - if test -f $ICONV_DIR/lib/lib$iconv_lib_name.a || - test -f $ICONV_DIR/lib/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME - then - PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [ - found_iconv=yes - PHP_DEFINE(HAVE_LIBICONV) - ], [ - PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [ - found_iconv=yes - PHP_DEFINE(HAVE_ICONV) - ], [], [ - -L$ICONV_DIR/lib - ]) - ], [ - -L$ICONV_DIR/lib - ]) - fi - fi - - if test "$found_iconv" = "yes"; then - if test -n "$ICONV_DIR"; then - AC_DEFINE(HAVE_ICONV, 1, [ ]) - PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/lib, $1) - PHP_ADD_INCLUDE($ICONV_DIR/include) - fi - $2 -ifelse([$3],[],,[else $3]) - fi -]) - -AC_DEFUN([PHP_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_-,A-Z__), 1, [ ])]) - -dnl -dnl PHP_CHECK_FUNC_LIB(func, libs) -dnl This macro checks whether 'func' or '__func' exists -dnl in the specified library. -dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS. -dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNC -dnl - -dnl autoconf undefines the builtin "shift" :-( -dnl If possible, we use the builtin shift anyway, otherwise we use -dnl the ubercool definition I have tested so far with FreeBSD/GNU m4 -ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[ -define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])]) -]) - -AC_DEFUN([PHP_CHECK_FUNC_LIB],[ - ifelse($2,,:,[ - unset ac_cv_lib_$2[]_$1 - unset ac_cv_lib_$2[]___$1 - unset found - AC_CHECK_LIB($2, $1, [found=yes], [ - AC_CHECK_LIB($2, __$1, [found=yes], [found=no]) - ]) - - if test "$found" = "yes"; then - ac_libs=$LIBS - LIBS="$LIBS -l$2" - AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=no]) - LIBS=$ac_libs - fi - - if test "$found" = "yes"; then - PHP_ADD_LIBRARY($2) - PHP_DEF_HAVE($1) - PHP_DEF_HAVE(lib$2) - ac_cv_func_$1=yes - else - PHP_CHECK_FUNC_LIB($1,phpshift(phpshift($@))) - fi - ]) -]) - -dnl -dnl PHP_CHECK_FUNC(func, ...) -dnl This macro checks whether 'func' or '__func' exists -dnl in the default libraries and as a fall back in the specified library. -dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS. -dnl -AC_DEFUN([PHP_CHECK_FUNC],[ - unset ac_cv_func_$1 - unset ac_cv_func___$1 - unset found - - AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ]) - - case $found in - yes) - PHP_DEF_HAVE($1) - ac_cv_func_$1=yes - ;; - ifelse($#,1,,[ - *) PHP_CHECK_FUNC_LIB($@) ;; - ]) - esac -]) - -dnl -dnl PHP_AP_EXTRACT_VERSION(/path/httpd) -dnl This macro is used to get a comparable -dnl version for apache1/2. -dnl -AC_DEFUN([PHP_AP_EXTRACT_VERSION],[ - ac_output=`$1 -v 2>&1` - ac_IFS=$IFS -IFS="- /. -" - set $ac_output - IFS=$ac_IFS - - APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6` -]) diff --git a/build/build.mk b/build/build.mk deleted file mode 100644 index d9bb151857..0000000000 --- a/build/build.mk +++ /dev/null @@ -1,73 +0,0 @@ -# +----------------------------------------------------------------------+ -# | PHP Version 4 | -# +----------------------------------------------------------------------+ -# | Copyright (c) 1997-2002 The PHP Group | -# +----------------------------------------------------------------------+ -# | This source file is subject to version 2.02 of the PHP license, | -# | that is bundled with this package in the file LICENSE, and is | -# | available at through the world-wide-web at | -# | http://www.php.net/license/2_02.txt. | -# | If you did not receive a copy of the PHP license and are unable to | -# | obtain it through the world-wide-web, please send a note to | -# | license@php.net so we can mail you a copy immediately. | -# +----------------------------------------------------------------------+ -# | Author: Sascha Schumann | -# +----------------------------------------------------------------------+ -# -# $Id$ -# -# -# Makefile to generate build tools -# - -ZENDDIR = Zend - -SUBDIRS = $(ZENDDIR) TSRM - -STAMP = buildmk.stamp - -ALWAYS = generated_lists - - -all: $(STAMP) $(ALWAYS) - @$(MAKE) AMFLAGS=$(AMFLAGS) -s -f build/build2.mk - -generated_lists: - @echo makefile_am_files = $(ZENDDIR)/Makefile.am \ - TSRM/Makefile.am > $@ - @echo config_h_files = $(ZENDDIR)/acconfig.h TSRM/acconfig.h >> $@ - @echo config_m4_files = $(ZENDDIR)/Zend.m4 TSRM/tsrm.m4 TSRM/threads.m4 bundle/*/config*.m4 \ - $(ZENDDIR)/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@ - -$(STAMP): build/buildcheck.sh - @build/buildcheck.sh $(STAMP) - -snapshot: - distname='$(DISTNAME)'; \ - if test -z "$$distname"; then \ - distname='php4-snapshot'; \ - fi; \ - myname=`basename \`pwd\`` ; \ - cd .. && cp -rp $$myname $$distname; \ - cd $$distname; \ - rm -f $(SUBDIRS) 2>/dev/null || true; \ - for i in $(SUBDIRS); do \ - test -d $$i || (test -d ../$$i && cp -rp ../$$i $$i); \ - done; \ - find . -type l -exec rm {} \; ; \ - $(MAKE) AMFLAGS=--copy -f build/build.mk; \ - cd ..; \ - tar cf $$distname.tar $$distname; \ - rm -rf $$distname $$distname.tar.*; \ - bzip2 -9 $$distname.tar; \ - md5sum $$distname.tar.bz2; \ - sync; sleep 2; \ - md5sum $$distname.tar.bz2; \ - bzip2 -t $$distname.tar.bz2 - -cvsclean: - @for i in `find . -name .cvsignore`; do \ - (cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore | grep -v config.nice` *.o *.a .libs || true); \ - done - -.PHONY: $(ALWAYS) snapshot cvsclean diff --git a/build/build2.mk b/build/build2.mk deleted file mode 100644 index 26bad9f9c5..0000000000 --- a/build/build2.mk +++ /dev/null @@ -1,59 +0,0 @@ -# +----------------------------------------------------------------------+ -# | PHP Version 4 | -# +----------------------------------------------------------------------+ -# | Copyright (c) 1997-2002 The PHP Group | -# +----------------------------------------------------------------------+ -# | This source file is subject to version 2.02 of the PHP license, | -# | that is bundled with this package in the file LICENSE, and is | -# | available at through the world-wide-web at | -# | http://www.php.net/license/2_02.txt. | -# | If you did not receive a copy of the PHP license and are unable to | -# | obtain it through the world-wide-web, please send a note to | -# | license@php.net so we can mail you a copy immediately. | -# +----------------------------------------------------------------------+ -# | Author: Sascha Schumann | -# +----------------------------------------------------------------------+ -# -# $Id$ -# - -include generated_lists - -TOUCH_FILES = mkinstalldirs install-sh missing - -LT_TARGETS = ltmain.sh config.guess config.sub - -makefile_in_files = $(makefile_am_files:.am=.in) -makefile_files = $(makefile_am_files:e.am=e) - -config_h_in = main/php_config.h.in - -acconfig_h_SOURCES = acconfig.h.in $(config_h_files) - -targets = $(TOUCH_FILES) configure $(config_h_in) - - -all: $(targets) - -acconfig.h: $(acconfig_h_SOURCES) - @echo rebuilding $@ - cat $(acconfig_h_SOURCES) > $@ - -SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times)'||true) - -$(config_h_in): configure acconfig.h -# explicitly remove target since autoheader does not seem to work -# correctly otherwise (timestamps are not updated) - @echo rebuilding $@ - @rm -f $@ - @autoheader 2>&1 | $(SUPPRESS_WARNINGS) - -$(TOUCH_FILES): - touch $(TOUCH_FILES) - -aclocal.m4: configure.in acinclude.m4 - aclocal 2>&1 | $(SUPPRESS_WARNINGS) - -configure: aclocal.m4 configure.in $(config_m4_files) - @echo rebuilding $@ - @autoconf 2>&1 | $(SUPPRESS_WARNINGS) diff --git a/build/buildcheck.sh b/build/buildcheck.sh deleted file mode 100755 index 4776f1e177..0000000000 --- a/build/buildcheck.sh +++ /dev/null @@ -1,113 +0,0 @@ -#! /bin/sh -# +----------------------------------------------------------------------+ -# | PHP Version 4 | -# +----------------------------------------------------------------------+ -# | Copyright (c) 1997-2002 The PHP Group | -# +----------------------------------------------------------------------+ -# | This source file is subject to version 2.02 of the PHP license, | -# | that is bundled with this package in the file LICENSE, and is | -# | available at through the world-wide-web at | -# | http://www.php.net/license/2_02.txt. | -# | If you did not receive a copy of the PHP license and are unable to | -# | obtain it through the world-wide-web, please send a note to | -# | license@php.net so we can mail you a copy immediately. | -# +----------------------------------------------------------------------+ -# | Authors: Stig Bakken | -# | Sascha Schumann | -# +----------------------------------------------------------------------+ -# -# $Id: buildcheck.sh,v 1.25 2003-04-16 11:59:49 jan Exp $ -# - -echo "buildconf: checking installation..." - -stamp=$1 - -# autoconf 2.13 or newer -ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` -if test -z "$ac_version"; then -echo "buildconf: autoconf not found." -echo " You need autoconf version 2.13 or newer installed" -echo " to build PHP from CVS." -exit 1 -fi -IFS=.; set $ac_version; IFS=' ' -if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then -echo "buildconf: autoconf version $ac_version found." -echo " You need autoconf version 2.13 or newer installed" -echo " to build PHP from CVS." -exit 1 -else -echo "buildconf: autoconf version $ac_version (ok)" -fi - - -if test "$1" = "2" && test "$2" -ge "50"; then - echo "buildconf: Your version of autoconf likely contains buggy cache code." - echo " Running cvsclean for you." - echo " To avoid this, install autoconf-2.13 and automake-1.5." - ./cvsclean - stamp= -fi - - -# automake 1.4 or newer -am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` -am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'` -if test "$am_version" = ""; then -echo "buildconf: automake not found." -echo " You need automake version 1.4 or newer installed" -echo " to build PHP from CVS." -exit 1 -fi -IFS=.; set $am_version_clean; IFS=' ' -if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then -echo "buildconf: automake version $am_version found." -echo " You need automake version 1.4 or newer installed" -echo " to build PHP from CVS." -exit 1 -else -echo "buildconf: automake version $am_version (ok)" -fi - -# libtool 1.4.3 or newer -# Prefer glibtool over libtool for Mac OS X compatibility -libtool=`./build/shtool path glibtool 2> /dev/null` -if test ! -r "$libtool"; then libtool=`./build/shtool path libtool`; fi -lt_pversion=`$libtool --version 2>/dev/null|sed -n -e 's/^[^0-9]*//' -e 1's/[- ].*//p'` -if test "$lt_pversion" = ""; then -echo "buildconf: libtool not found." -echo " You need libtool version 1.4.3 or newer installed" -echo " to build PHP from CVS." -exit 1 -fi -lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'` -IFS=.; set $lt_version; IFS=' ' - -if test "$3" = ""; then - third=0 -else - third=$3 -fi - -if test "$1" -gt "1" || test "$2" -ge "5" || (test "$2" -ge "4" && test "$third" -ge "3") -then -echo "buildconf: libtool version $lt_pversion (ok)" -else -echo "buildconf: libtool version $lt_pversion found." -echo " You need libtool version 1.4.3 or newer installed" -echo " to build PHP from CVS." -exit 1 -fi - -am_prefix=`./build/shtool path automake | sed -e 's#/[^/]*/[^/]*$##'` -lt_prefix=`echo $libtool | sed -e 's#/[^/]*/[^/]*$##'` -if test "$am_prefix" != "$lt_prefix"; then - echo "WARNING: automake and libtool are installed in different" - echo " directories. This may cause aclocal to fail." - echo " continuing anyway" -fi - -test -n "$stamp" && touch $stamp - -exit 0 diff --git a/build/config-stubs b/build/config-stubs deleted file mode 100755 index 28208085a7..0000000000 --- a/build/config-stubs +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# $Id$ - -dir=$1; shift -for stubfile in $dir/*/config0.m4 $dir/*/config.m4 $dir/*/config9.m4; do - echo "sinclude($stubfile)" -done diff --git a/build/genif.sh b/build/genif.sh deleted file mode 100644 index cb5233b5ac..0000000000 --- a/build/genif.sh +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh - -# $Id: genif.sh,v 1.3 2002-03-22 10:22:41 sas Exp $ -# replacement for genif.pl - -infile=$1 -shift -srcdir=$1 -shift -extra_module_ptrs=$1 -shift -awk=$1 -shift - -if test -z "$infile" || test -z "$srcdir"; then - echo "please supply infile and srcdir" - exit 1 -fi - -module_ptrs=$extra_module_ptrs -header_list= -olddir=`pwd` -cd $srcdir - -for ext in ${1+"$@"} ; do - module_ptrs=" phpext_${ext}_ptr,@NEWLINE@$module_ptrs" - header_list="$header_list ext/$ext/*.h" -done - -includes=`$awk -f ./build/print_include.awk $header_list` - -cd $olddir - -cat $infile | \ - sed \ - -e "s'@EXT_INCLUDE_CODE@'$includes'" \ - -e "s'@EXT_MODULE_PTRS@'$module_ptrs'" \ - -e 's/@NEWLINE@/\ -/g' - - diff --git a/build/mkdep.awk b/build/mkdep.awk deleted file mode 100644 index a83f5f6c90..0000000000 --- a/build/mkdep.awk +++ /dev/null @@ -1,75 +0,0 @@ -# +----------------------------------------------------------------------+ -# | PHP Version 4 | -# +----------------------------------------------------------------------+ -# | Copyright (c) 2000 The PHP Group | -# +----------------------------------------------------------------------+ -# | This source file is subject to version 2.02 of the PHP license, | -# | that is bundled with this package in the file LICENSE, and is | -# | available at through the world-wide-web at | -# | http://www.php.net/license/2_02.txt. | -# | If you did not receive a copy of the PHP license and are unable to | -# | obtain it through the world-wide-web, please send a note to | -# | license@php.net so we can mail you a copy immediately. | -# +----------------------------------------------------------------------+ -# | Author: Sascha Schumann | -# +----------------------------------------------------------------------+ -# -# $Id$ -# -# Usage: -# -# echo top_srcdir top_builddir srcdir CPP [CPP-ARGS] filenames | \ -# awk -f mkdep.awk > dependencies - - -{ - top_srcdir=$1 - top_builddir=$2 - srcdir=$3 - cmd=$4 - - for (i = 5; i <= NF; i++) { - if (match($i, "^-[A-Z]") == 0) - break; - cmd=cmd " " $i - } - - dif=i-1 - - for (; i <= NF; i++) - filenames[i-dif]=$i - - no_files=NF-dif - - for(i = 1; i <= no_files; i++) { - if (system("test -r " filenames[i]) != 0) - continue - - target=filenames[i] - sub(srcdir "/", "", target) - target2=target - sub("\.(c|cpp)$", ".lo", target); - sub("\.(c|cpp)$", ".slo", target2); - - for (e in used) - delete used[e] - - cmdx=cmd " " filenames[i] - done=0 - while ((cmdx | getline) > 0) { - if (match($0, "^# [0-9]* \".*\.h\"") != 0) { - if (sub(top_srcdir, "$(top_srcdir)", $3) == 0) - sub(top_builddir, "$(top_builddir)", $3) - if (substr($3,2,1) != "/" && used[$3] != 1) { - if (done == 0) - printf(target " " target2 ":") - done=1 - printf(" \\\n\t" substr($3,2,length($3)-2)) - used[$3] = 1; - } - } - } - if (done == 1) - print "\n" - } -} diff --git a/build/print_include.awk b/build/print_include.awk deleted file mode 100644 index a4919fae87..0000000000 --- a/build/print_include.awk +++ /dev/null @@ -1,6 +0,0 @@ -/phpext_/ { - if (old_filename != FILENAME) { - printf "#include \"" FILENAME "\"@NEWLINE@" - old_filename = FILENAME - } -} diff --git a/build/shtool b/build/shtool deleted file mode 100755 index f3250796ec..0000000000 --- a/build/shtool +++ /dev/null @@ -1,1046 +0,0 @@ -#!/bin/sh -## -## GNU shtool -- The GNU Portable Shell Tool -## Copyright (c) 1994-2002 Ralf S. Engelschall -## -## See http://www.gnu.org/software/shtool/ for more information. -## See ftp://ftp.gnu.org/gnu/shtool/ for latest version. -## -## Version: 1.6.2 (02-Nov-2002) -## Contents: 4/19 available modules -## - -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -## USA, or contact Ralf S. Engelschall . -## -## NOTICE: Given that you include this file verbatim into your own -## source tree, you are justified in saying that it remains separate -## from your package, and that this way you are simply just using GNU -## shtool. So, in this situation, there is no requirement that your -## package itself is licensed under the GNU General Public License in -## order to take advantage of GNU shtool. -## - -## -## Usage: shtool [] [ [] []] -## -## Available commands: -## echo Print string with optional construct expansion -## install Install a program, script or datafile -## mkdir Make one or more directories -## path Deal with program paths -## -## Not available commands (because module was not built-in): -## mdate Pretty-print modification time of a file or dir -## table Pretty-print a field-separated list as a table -## prop Display progress with a running propeller -## move Move files with simultaneous substitution -## mkln Make link with calculation of relative paths -## mkshadow Make a shadow tree through symbolic links -## fixperm Fix file permissions inside a source tree -## rotate Logfile rotation -## tarball Roll distribution tarballs -## subst Apply sed(1) substitution operations -## guessos Simple operating system guesser -## arx Extended archive command -## slo Separate linker options by library class -## scpp Sharing C Pre-Processor -## version Maintain a version information file -## - -if [ $# -eq 0 ]; then - echo "$0:Error: invalid command line" 1>&2 - echo "$0:Hint: run \`$0 -h' for usage" 1>&2 - exit 1 -fi -if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then - echo "This is GNU shtool, version 1.6.2 (02-Nov-2002)" - echo "Copyright (c) 1994-2002 Ralf S. Engelschall " - echo "Report bugs to " - echo '' - echo "Usage: shtool [] [ [] []]" - echo '' - echo 'Available global :' - echo ' -v, --version display shtool version information' - echo ' -h, --help display shtool usage help page (this one)' - echo ' -d, --debug display shell trace information' - echo ' -r, --recreate recreate this shtool script via shtoolize' - echo '' - echo 'Available [] []:' - echo ' echo [-n|--newline] [-e|--expand] [ ...]' - echo ' install [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]' - echo ' [-C|--compare-copy] [-s|--strip] [-m|--mode ]' - echo ' [-o|--owner ] [-g|--group ] [-e|--exec' - echo ' ] [ ...] ' - echo ' mkdir [-t|--trace] [-f|--force] [-p|--parents] [-m|--mode' - echo ' ] [-o|--owner ] [-g|--group ] ' - echo ' [ ...]' - echo ' path [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename]' - echo ' [-m|--magic] [-p|--path ] [ ...]' - echo '' - echo 'Not available (because module was not built-in):' - echo ' mdate [-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits]' - echo ' [-f|--field-sep ] [-o|--order ] ' - echo ' table [-F|--field-sep ] [-w|--width ] [-c|--columns' - echo ' ] [-s|--strip ] ...' - echo ' prop [-p|--prefix ]' - echo ' move [-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve]' - echo ' ' - echo ' mkln [-t|--trace] [-f|--force] [-s|--symbolic] ' - echo ' [ ...] ' - echo ' mkshadow [-v|--verbose] [-t|--trace] [-a|--all] ' - echo ' fixperm [-v|--verbose] [-t|--trace] [ ...]' - echo ' rotate [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files' - echo ' ] [-s|--size ] [-c|--copy] [-r|--remove]' - echo ' [-a|--archive-dir ] [-z|--compress [:]]' - echo ' [-b|--background] [-d|--delay] [-p|--pad ] [-o|--owner' - echo ' ] [-g|--group ] [-m|--mode ] [-M|--migrate' - echo ' ] [-P|--prolog ] [-E|--epilog ] [...]' - echo ' tarball [-t|--trace] [-v|--verbose] [-o|--output ]' - echo ' [-c|--compress ] [-d|--directory ] [-u|--user' - echo ' ] [-g|--group ] [-e|--exclude ]' - echo ' [ ...]' - echo ' subst [-v|--verbose] [-t|--trace] [-n|--nop] [-s|--stealth]' - echo ' [-i|--interactive] [-b|--backup ] [-e|--exec ]' - echo ' [-f|--file ] [] [...]' - echo ' guessos ' - echo ' arx [-t|--trace] [-C|--command ] [' - echo ' ...]' - echo ' slo [-p|--prefix ] -- -L -l [-L -l' - echo ' ...]' - echo ' scpp [-v|--verbose] [-p|--preserve] [-f|--filter ]' - echo ' [-o|--output ] [-t|--template ] [-M|--mark' - echo ' ] [-D|--define ] [-C|--class ]' - echo ' [ ...]' - echo ' version [-l|--language ] [-n|--name ] [-p|--prefix' - echo ' ] [-s|--set ] [-e|--edit] [-i|--increase' - echo ' ] [-d|--display ] ' - echo '' - exit 0 -fi -if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then - echo "GNU shtool 1.6.2 (02-Nov-2002)" - exit 0 -fi -if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then - shtoolize -oshtool echo install mkdir path - exit 0 -fi -if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then - shift - set -x -fi -name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'` -case "$name" in - echo|install|mkdir|path ) - # implicit tool command selection - tool="$name" - ;; - * ) - # explicit tool command selection - tool="$1" - shift - ;; -esac -arg_spec="" -opt_spec="" -gen_tmpfile=no - -## -## DISPATCH INTO SCRIPT PROLOG -## - -case $tool in - echo ) - str_tool="echo" - str_usage="[-n|--newline] [-e|--expand] [ ...]" - arg_spec="0+" - opt_spec="n.e." - opt_alias="n:newline,e:expand" - opt_n=no - opt_e=no - ;; - install ) - str_tool="install" - str_usage="[-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy] [-C|--compare-copy] [-s|--strip] [-m|--mode ] [-o|--owner ] [-g|--group ] [-e|--exec ] [ ...] " - arg_spec="1+" - opt_spec="v.t.d.c.C.s.m:o:g:e+" - opt_alias="v:verbose,t:trace,d:mkdir,c:copy,C:compare-copy,s:strip,m:mode,o:owner,g:group,e:exec" - opt_v=no - opt_t=no - opt_d=no - opt_c=no - opt_C=no - opt_s=no - opt_m="0755" - opt_o="" - opt_g="" - opt_e="" - ;; - mkdir ) - str_tool="mkdir" - str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode ] [-o|--owner ] [-g|--group ] [ ...]" - arg_spec="1+" - opt_spec="t.f.p.m:o:g:" - opt_alias="t:trace,f:force,p:parents,m:mode,o:owner,g:group" - opt_t=no - opt_f=no - opt_p=no - opt_m="" - opt_o="" - opt_g="" - ;; - path ) - str_tool="path" - str_usage="[-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path ] [ ...]" - gen_tmpfile=yes - arg_spec="1+" - opt_spec="s.r.d.b.m.p:" - opt_alias="s:suppress,r:reverse,d:dirname,b:basename,m:magic,p:path" - opt_s=no - opt_r=no - opt_d=no - opt_b=no - opt_m=no - opt_p="$PATH" - ;; - -* ) - echo "$0:Error: unknown option \`$tool'" 2>&1 - echo "$0:Hint: run \`$0 -h' for usage" 2>&1 - exit 1 - ;; - * ) - echo "$0:Error: unknown command \`$tool'" 2>&1 - echo "$0:Hint: run \`$0 -h' for usage" 2>&1 - exit 1 - ;; -esac - -## -## COMMON UTILITY CODE -## - -# commonly used ASCII values -ASC_TAB=" " -ASC_NL=" -" - -# determine name of tool -if [ ".$tool" != . ]; then - # used inside shtool script - toolcmd="$0 $tool" - toolcmdhelp="shtool $tool" - msgprefix="shtool:$tool" -else - # used as standalone script - toolcmd="$0" - toolcmdhelp="sh $0" - msgprefix="$str_tool" -fi - -# parse argument specification string -eval `echo $arg_spec |\ - sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'` - -# parse option specification string -eval `echo h.$opt_spec |\ - sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'` - -# parse option alias string -eval `echo h:help,$opt_alias |\ - tr 'x-' 'x_' | sed -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'` - -# interate over argument line -opt_PREV='' -while [ $# -gt 0 ]; do - # special option stops processing - if [ ".$1" = ".--" ]; then - shift - break - fi - - # determine option and argument - opt_ARG_OK=no - if [ ".$opt_PREV" != . ]; then - # merge previous seen option with argument - opt_OPT="$opt_PREV" - opt_ARG="$1" - opt_ARG_OK=yes - opt_PREV='' - else - # split argument into option and argument - case "$1" in - --[a-zA-Z0-9]*=*) - eval `echo "x$1" |\ - sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'` - opt_STR=`echo $opt_OPT | tr 'x-' 'x_'` - eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}" - ;; - --[a-zA-Z0-9]*) - opt_OPT=`echo "x$1" | cut -c4-` - opt_STR=`echo $opt_OPT | tr 'x-' 'x_'` - eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}" - opt_ARG='' - ;; - -[a-zA-Z0-9]*) - eval `echo "x$1" |\ - sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \ - -e 's/";\(.*\)$/"; opt_ARG="\1"/'` - ;; - -[a-zA-Z0-9]) - opt_OPT=`echo "x$1" | cut -c3-` - opt_ARG='' - ;; - *) - break - ;; - esac - fi - - # eat up option - shift - - # determine whether option needs an argument - eval "opt_MODE=\$opt_MODE_${opt_OPT}" - if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then - if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then - opt_PREV="$opt_OPT" - continue - fi - fi - - # process option - case $opt_MODE in - '.' ) - # boolean option - eval "opt_${opt_OPT}=yes" - ;; - ':' ) - # option with argument (multiple occurances override) - eval "opt_${opt_OPT}=\"\$opt_ARG\"" - ;; - '+' ) - # option with argument (multiple occurances append) - eval "opt_${opt_OPT}=\"\$opt_${opt_OPT}\${ASC_NL}\$opt_ARG\"" - ;; - * ) - echo "$msgprefix:Error: unknown option: \`$opt_OPT'" 1>&2 - echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2 - exit 1 - ;; - esac -done -if [ ".$opt_PREV" != . ]; then - echo "$msgprefix:Error: missing argument to option \`$opt_PREV'" 1>&2 - echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2 - exit 1 -fi - -# process help option -if [ ".$opt_h" = .yes ]; then - echo "Usage: $toolcmdhelp $str_usage" - exit 0 -fi - -# complain about incorrect number of arguments -case $arg_MODE in - '=' ) - if [ $# -ne $arg_NUMS ]; then - echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2 - echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 - exit 1 - fi - ;; - '+' ) - if [ $# -lt $arg_NUMS ]; then - echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2 - echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 - exit 1 - fi - ;; -esac - -# establish a temporary file on request -if [ ".$gen_tmpfile" = .yes ]; then - if [ ".$TMPDIR" != . ]; then - tmpdir="$TMPDIR" - elif [ ".$TEMPDIR" != . ]; then - tmpdir="$TEMPDIR" - else - tmpdir="/tmp" - fi - tmpfile="$tmpdir/.shtool.$$" - rm -f $tmpfile >/dev/null 2>&1 - touch $tmpfile - chmod 600 $tmpfile -fi - -## -## DISPATCH INTO SCRIPT BODY -## - -case $tool in - -echo ) - ## - ## echo -- Print string with optional construct expansion - ## Copyright (c) 1998-2002 Ralf S. Engelschall - ## Originally written for WML as buildinfo - ## - - text="$*" - - # check for broken escape sequence expansion - seo='' - bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'` - if [ ".$bytes" != .3 ]; then - bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'` - if [ ".$bytes" = .3 ]; then - seo='-E' - fi - fi - - # check for existing -n option (to suppress newline) - minusn='' - bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'` - if [ ".$bytes" = .3 ]; then - minusn='-n' - fi - - # determine terminal bold sequence - term_bold='' - term_norm='' - if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then - case $TERM in - # for the most important terminal types we directly know the sequences - xterm|xterm*|vt220|vt220*) - term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' /dev/null` - term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' /dev/null` - ;; - vt100|vt100*|cygwin) - term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' /dev/null` - term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' /dev/null` - ;; - # for all others, we try to use a possibly existing `tput' or `tcout' utility - * ) - paths=`echo $PATH | sed -e 's/:/ /g'` - for tool in tput tcout; do - for dir in $paths; do - if [ -r "$dir/$tool" ]; then - for seq in bold md smso; do # 'smso' is last - bold="`$dir/$tool $seq 2>/dev/null`" - if [ ".$bold" != . ]; then - term_bold="$bold" - break - fi - done - if [ ".$term_bold" != . ]; then - for seq in sgr0 me rmso init reset; do # 'reset' is last - norm="`$dir/$tool $seq 2>/dev/null`" - if [ ".$norm" != . ]; then - term_norm="$norm" - break - fi - done - fi - break - fi - done - if [ ".$term_bold" != . -a ".$term_norm" != . ]; then - break; - fi - done - ;; - esac - if [ ".$term_bold" = . -o ".$term_norm" = . ]; then - echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2 - term_bold='' - term_norm='' - fi - fi - - # determine user name - username='' - if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uUgG]'`" != . ]; then - username="$LOGNAME" - if [ ".$username" = . ]; then - username="$USER" - if [ ".$username" = . ]; then - username="`(whoami) 2>/dev/null |\ - awk '{ printf("%s", $1); }'`" - if [ ".$username" = . ]; then - username="`(who am i) 2>/dev/null |\ - awk '{ printf("%s", $1); }'`" - if [ ".$username" = . ]; then - username='unknown' - fi - fi - fi - fi - fi - - # determine user id - userid='' - if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then - userid="`(id -u) 2>/dev/null`" - if [ ".$userid" = . ]; then - str="`(id) 2>/dev/null`" - if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then - userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*//'` - fi - if [ ".$userid" = . ]; then - userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \ - sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` - if [ ".$userid" = . ]; then - userid=`(ypcat passwd) 2>/dev/null | - egrep "^${username}:" | \ - sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` - if [ ".$userid" = . ]; then - userid='?' - fi - fi - fi - fi - fi - - # determine (primary) group id - groupid='' - if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[gG]'`" != . ]; then - groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \ - sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` - if [ ".$groupid" = . ]; then - groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \ - sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` - if [ ".$groupid" = . ]; then - groupid='?' - fi - fi - fi - - # determine (primary) group name - groupname='' - if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%g'`" != . ]; then - groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \ - sed -e 's/:.*$//'` - if [ ".$groupname" = . ]; then - groupname=`(ypcat group) 2>/dev/null | \ - egrep "^[^:]*:[^:]*:${groupid}:" | \ - sed -e 's/:.*$//'` - if [ ".$groupname" = . ]; then - groupname='?' - fi - fi - fi - - # determine host and domain name - hostname='' - domainname='' - if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then - hostname="`(uname -n) 2>/dev/null |\ - awk '{ printf("%s", $1); }'`" - if [ ".$hostname" = . ]; then - hostname="`(hostname) 2>/dev/null |\ - awk '{ printf("%s", $1); }'`" - if [ ".$hostname" = . ]; then - hostname='unknown' - fi - fi - case $hostname in - *.* ) - domainname=".`echo $hostname | cut -d. -f2-`" - hostname="`echo $hostname | cut -d. -f1`" - ;; - esac - fi - if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then - if [ ".$domainname" = . ]; then - if [ -f /etc/resolv.conf ]; then - domainname="`egrep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\ - sed -e 's/.*domain//' \ - -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \ - -e 's/^\.//' -e 's/^/./' |\ - awk '{ printf("%s", $1); }'`" - if [ ".$domainname" = . ]; then - domainname="`egrep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\ - sed -e 's/.*search//' \ - -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \ - -e 's/ .*//' -e 's/ .*//' \ - -e 's/^\.//' -e 's/^/./' |\ - awk '{ printf("%s", $1); }'`" - fi - fi - fi - fi - - # determine current time - time_day='' - time_month='' - time_year='' - time_monthname='' - if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then - time_day=`date '+%d'` - time_month=`date '+%m'` - time_year=`date '+%Y' 2>/dev/null` - if [ ".$time_year" = . ]; then - time_year=`date '+%y'` - case $time_year in - [5-9][0-9]) time_year="19$time_year" ;; - [0-4][0-9]) time_year="20$time_year" ;; - esac - fi - case $time_month in - 1|01) time_monthname='Jan' ;; - 2|02) time_monthname='Feb' ;; - 3|03) time_monthname='Mar' ;; - 4|04) time_monthname='Apr' ;; - 5|05) time_monthname='May' ;; - 6|06) time_monthname='Jun' ;; - 7|07) time_monthname='Jul' ;; - 8|08) time_monthname='Aug' ;; - 9|09) time_monthname='Sep' ;; - 10) time_monthname='Oct' ;; - 11) time_monthname='Nov' ;; - 12) time_monthname='Dec' ;; - esac - fi - - # expand special ``%x'' constructs - if [ ".$opt_e" = .yes ]; then - text=`echo $seo "$text" |\ - sed -e "s/%B/${term_bold}/g" \ - -e "s/%b/${term_norm}/g" \ - -e "s/%u/${username}/g" \ - -e "s/%U/${userid}/g" \ - -e "s/%g/${groupname}/g" \ - -e "s/%G/${groupid}/g" \ - -e "s/%h/${hostname}/g" \ - -e "s/%d/${domainname}/g" \ - -e "s/%D/${time_day}/g" \ - -e "s/%M/${time_month}/g" \ - -e "s/%Y/${time_year}/g" \ - -e "s/%m/${time_monthname}/g" 2>/dev/null` - fi - - # create output - if [ .$opt_n = .no ]; then - echo $seo "$text" - else - # the harder part: echo -n is best, because - # awk may complain about some \xx sequences. - if [ ".$minusn" != . ]; then - echo $seo $minusn "$text" - else - echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text" - fi - fi - ;; - -install ) - ## - ## install -- Install a program, script or datafile - ## Copyright (c) 1997-2002 Ralf S. Engelschall - ## Originally written for shtool - ## - - # special case: "shtool install -d [...]" internally - # maps to "shtool mkdir -f -p -m 755 [...]" - if [ "$opt_d" = yes ]; then - cmd="$0 mkdir -f -p -m 755" - if [ ".$opt_o" != . ]; then - cmd="$cmd -o '$opt_o'" - fi - if [ ".$opt_g" != . ]; then - cmd="$cmd -g '$opt_g'" - fi - if [ ".$opt_v" = .yes ]; then - cmd="$cmd -v" - fi - if [ ".$opt_t" = .yes ]; then - cmd="$cmd -t" - fi - for dir in "$@"; do - eval "$cmd $dir" || exit $? - done - exit 0 - fi - - # determine source(s) and destination - argc=$# - srcs="" - while [ $# -gt 1 ]; do - srcs="$srcs $1" - shift - done - dstpath="$1" - - # type check for destination - dstisdir=0 - if [ -d $dstpath ]; then - dstpath=`echo "$dstpath" | sed -e 's:/$::'` - dstisdir=1 - fi - - # consistency check for destination - if [ $argc -gt 2 -a $dstisdir = 0 ]; then - echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2 - exit 1 - fi - - # iterate over all source(s) - for src in $srcs; do - dst=$dstpath - - # if destination is a directory, append the input filename - if [ $dstisdir = 1 ]; then - dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'` - dst="$dst/$dstfile" - fi - - # check for correct arguments - if [ ".$src" = ".$dst" ]; then - echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2 - continue - fi - if [ -d "$src" ]; then - echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2 - continue - fi - - # make a temp file name in the destination directory - dsttmp=`echo $dst |\ - sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \ - -e "s;\$;/#INST@$$#;"` - - # verbosity - if [ ".$opt_v" = .yes ]; then - echo "$src -> $dst" 1>&2 - fi - - # copy or move the file name to the temp name - # (because we might be not allowed to change the source) - if [ ".$opt_C" = .yes ]; then - opt_c=yes - fi - if [ ".$opt_c" = .yes ]; then - if [ ".$opt_t" = .yes ]; then - echo "cp $src $dsttmp" 1>&2 - fi - cp $src $dsttmp || exit $? - else - if [ ".$opt_t" = .yes ]; then - echo "mv $src $dsttmp" 1>&2 - fi - mv $src $dsttmp || exit $? - fi - - # adjust the target file - if [ ".$opt_e" != . ]; then - sed='sed' - OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS" - for e - do - sed="$sed -e '$e'" - done - cp $dsttmp $dsttmp.old - eval "$sed <$dsttmp.old >$dsttmp" || exit $? - rm -f $dsttmp.old - fi - if [ ".$opt_s" = .yes ]; then - if [ ".$opt_t" = .yes ]; then - echo "strip $dsttmp" 1>&2 - fi - strip $dsttmp || exit $? - fi - if [ ".$opt_o" != . ]; then - if [ ".$opt_t" = .yes ]; then - echo "chown $opt_o $dsttmp" 1>&2 - fi - chown $opt_o $dsttmp || exit $? - fi - if [ ".$opt_g" != . ]; then - if [ ".$opt_t" = .yes ]; then - echo "chgrp $opt_g $dsttmp" 1>&2 - fi - chgrp $opt_g $dsttmp || exit $? - fi - if [ ".$opt_m" != ".-" ]; then - if [ ".$opt_t" = .yes ]; then - echo "chmod $opt_m $dsttmp" 1>&2 - fi - chmod $opt_m $dsttmp || exit $? - fi - - # determine whether to do a quick install - # (has to be done _after_ the strip was already done) - quick=no - if [ ".$opt_C" = .yes ]; then - if [ -r $dst ]; then - if cmp -s $src $dst; then - quick=yes - fi - fi - fi - - # finally, install the file to the real destination - if [ $quick = yes ]; then - if [ ".$opt_t" = .yes ]; then - echo "rm -f $dsttmp" 1>&2 - fi - rm -f $dsttmp - else - if [ ".$opt_t" = .yes ]; then - echo "rm -f $dst && mv $dsttmp $dst" 1>&2 - fi - rm -f $dst && mv $dsttmp $dst - fi - done - ;; - -mkdir ) - ## - ## mkdir -- Make one or more directories - ## Copyright (c) 1996-2002 Ralf S. Engelschall - ## Originally written for public domain by Noah Friedman - ## Cleaned up and enhanced for shtool - ## - - errstatus=0 - for p in ${1+"$@"}; do - # if the directory already exists... - if [ -d "$p" ]; then - if [ ".$opt_f" = .no -a ".$opt_p" = .no ]; then - echo "$msgprefix:Error: directory already exists: $p" 1>&2 - errstatus=1 - break - else - continue - fi - fi - # if the directory has to be created... - if [ ".$opt_p" = .no ]; then - if [ ".$opt_t" = .yes ]; then - echo "mkdir $p" 1>&2 - fi - mkdir $p || errstatus=$? - if [ ".$opt_o" != . ]; then - if [ ".$opt_t" = .yes ]; then - echo "chown $opt_o $p" 1>&2 - fi - chown $opt_o $p || errstatus=$? - fi - if [ ".$opt_g" != . ]; then - if [ ".$opt_t" = .yes ]; then - echo "chgrp $opt_g $p" 1>&2 - fi - chgrp $opt_g $p || errstatus=$? - fi - if [ ".$opt_m" != . ]; then - if [ ".$opt_t" = .yes ]; then - echo "chmod $opt_m $p" 1>&2 - fi - chmod $opt_m $p || errstatus=$? - fi - else - # the smart situation - set fnord `echo ":$p" |\ - sed -e 's/^:\//%/' \ - -e 's/^://' \ - -e 's/\// /g' \ - -e 's/^%/\//'` - shift - pathcomp='' - for d in ${1+"$@"}; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp="./$pathcomp" ;; - esac - if [ ! -d "$pathcomp" ]; then - if [ ".$opt_t" = .yes ]; then - echo "mkdir $pathcomp" 1>&2 - fi - mkdir $pathcomp || errstatus=$? - if [ ".$opt_o" != . ]; then - if [ ".$opt_t" = .yes ]; then - echo "chown $opt_o $pathcomp" 1>&2 - fi - chown $opt_o $pathcomp || errstatus=$? - fi - if [ ".$opt_g" != . ]; then - if [ ".$opt_t" = .yes ]; then - echo "chgrp $opt_g $pathcomp" 1>&2 - fi - chgrp $opt_g $pathcomp || errstatus=$? - fi - if [ ".$opt_m" != . ]; then - if [ ".$opt_t" = .yes ]; then - echo "chmod $opt_m $pathcomp" 1>&2 - fi - chmod $opt_m $pathcomp || errstatus=$? - fi - fi - pathcomp="$pathcomp/" - done - fi - done - exit $errstatus - ;; - -path ) - ## - ## path -- Deal with program paths - ## Copyright (c) 1998-2002 Ralf S. Engelschall - ## Originally written for Apache - ## - - namelist="$*" - - # check whether the test command supports the -x option - if [ -x /bin/sh ] 2>/dev/null; then - minusx="-x" - else - minusx="-r" - fi - - # split path string - paths="`echo $opt_p |\ - sed -e 's/^:/.:/' \ - -e 's/::/:.:/g' \ - -e 's/:$/:./' \ - -e 's/:/ /g'`" - - # SPECIAL REQUEST - # translate forward to reverse path - if [ ".$opt_r" = .yes ]; then - if [ "x$namelist" = "x." ]; then - rp='.' - else - rp='' - for pe in `IFS="$IFS/"; echo $namelist`; do - rp="../$rp" - done - fi - echo $rp | sed -e 's:/$::' - exit 0 - fi - - # SPECIAL REQUEST - # strip out directory or base name - if [ ".$opt_d" = .yes ]; then - echo "$namelist" |\ - sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' - exit 0 - fi - if [ ".$opt_b" = .yes ]; then - echo "$namelist" |\ - sed -e 's;.*/\([^/]*\)$;\1;' - exit 0 - fi - - # MAGIC SITUATION - # Perl Interpreter (perl) - if [ ".$opt_m" = .yes -a ".$namelist" = .perl ]; then - rm -f $tmpfile >/dev/null 2>&1 - touch $tmpfile - found=0 - pc=99 - for dir in $paths; do - dir=`echo $dir | sed -e 's;/*$;;'` - nc=99 - for name in perl perl5 miniperl; do - if [ $minusx "$dir/$name" -a ! -d "$dir/$name" ]; then - perl="$dir/$name" - pv=`$perl -e 'printf("%.3f", $]);'` - echo "$pv:$pc:$nc:$perl" >>$tmpfile - found=1 - fi - nc=`expr $nc - 1` - done - pc=`expr $pc - 1` - done - if [ $found = 1 ]; then - perl="`cat $tmpfile | sort -r -u | sed -e 'q' | cut -d: -f4`" - rm -f $tmpfile >/dev/null 2>&1 - echo "$perl" - exit 0 - fi - rm -f $tmpfile >/dev/null 2>&1 - exit 1 - fi - - # MAGIC SITUATION - # C pre-processor (cpp) - if [ ".$opt_m" = .yes -a ".$namelist" = .cpp ]; then - echo >$tmpfile.c "#include " - echo >>$tmpfile.c "Syntax Error" - # 1. try the standard cc -E approach - cpp="${CC-cc} -E" - (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out - my_error=`grep -v '^ *+' $tmpfile.out` - if [ ".$my_error" != . ]; then - # 2. try the cc -E approach and GCC's -traditional-ccp option - cpp="${CC-cc} -E -traditional-cpp" - (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out - my_error=`grep -v '^ *+' $tmpfile.out` - if [ ".$my_error" != . ]; then - # 3. try a standalone cpp command in path and lib dirs - for path in $paths /lib /usr/lib /usr/local/lib; do - path=`echo $path | sed -e 's;/*$;;'` - if [ $minusx "$path/cpp" -a ! -d "$path/cpp" ]; then - cpp="$path/cpp" - break - fi - done - if [ ".$cpp" != . ]; then - (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out - my_error=`grep -v '^ *+' $tmpfile.out` - if [ ".$my_error" != . ]; then - # ok, we gave up... - cpp='' - fi - fi - fi - fi - rm -f $tmpfile >/dev/null 2>&1 - rm -f $tmpfile.c $tmpfile.out >/dev/null 2>&1 - if [ ".$cpp" != . ]; then - echo "$cpp" - exit 0 - fi - exit 1 - fi - - # STANDARD SITUATION - # iterate over names - for name in $namelist; do - # iterate over paths - for path in $paths; do - path=`echo $path | sed -e 's;/*$;;'` - if [ $minusx "$path/$name" -a ! -d "$path/$name" ]; then - if [ ".$opt_s" != .yes ]; then - echo "$path/$name" - fi - exit 0 - fi - done - done - exit 1 - ;; - -esac - -exit 0 - -##EOF## diff --git a/buildconf b/buildconf deleted file mode 100755 index 5cd9ade76e..0000000000 --- a/buildconf +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $Id$ - -while test $# -gt 0; do - if test "$1" = "--copy"; then - automake_flags=--copy - fi - - if test "$1" = "--ZendEngine2"; then - ZENDDIR=ZendEngine2 - echo "Using Zend Engine 2 code" - fi - - shift -done - -if test -z "$ZENDDIR"; then - ZENDDIR=Zend - echo "using default Zend directory" -fi - -rm -f generated_lists - -${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags" ZENDDIR="$ZENDDIR" diff --git a/bundle/expat/Changes b/bundle/expat/Changes deleted file mode 100644 index 1df159b652..0000000000 --- a/bundle/expat/Changes +++ /dev/null @@ -1,99 +0,0 @@ -Release 1.95.5 Fri Sep 6 2002 - - Added XML_UseForeignDTD() for improved SAX2 support. - - Added XML_GetFeatureList(). - - Defined XML_Bool type and the values XML_TRUE and XML_FALSE. - - Use an incomplete struct instead of a void* for the parser - (may not retain). - - Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected. - - Finally fixed bug where default handler would report DTD - events that were already handled by another handler. - Initial patch contributed by Darryl Miller. - - Removed unnecessary DllMain() function that caused static - linking into a DLL to be difficult. - - Added VC++ projects for building static libraries. - - Reduced line-length for all source code and headers to be - no longer than 80 characters, to help with AS/400 support. - - Reduced memory copying during parsing (SF patch #600964). - - Fixed a variety of bugs: see SF issues 580793, 434664, - 483514, 580503, 581069, 584041, 584183, 584832, 585537, - 596555, 596678, 598352, 598944, 599715, 600479, 600971. - -Release 1.95.4 Fri Jul 12 2002 - - Added support for VMS, contributed by Craig Berry. See - vms/README.vms for more information. - - Added Mac OS (classic) support, with a makefile for MPW, - contributed by Thomas Wegner and Daryle Walker. - - Added Borland C++ Builder 5 / BCC 5.5 support, contributed - by Patrick McConnell (SF patch #538032). - - Fixed a variety of bugs: see SF issues 441449, 563184, - 564342, 566334, 566901, 569461, 570263, 575168, 579196. - - Made skippedEntityHandler conform to SAX2 (see source comment) - - Re-implemented WFC: Entity Declared from XML 1.0 spec and - added a new error "entity declared in parameter entity": - see SF bug report 569461 and SF patch 578161 - - Re-implemented section 5.1 from XML 1.0 spec: - see SF bug report 570263 and SF patch 578161 - -Release 1.95.3 Mon Jun 3 2002 - - Added a project to the MSVC workspace to create a wchar_t - version of the library; the DLLs are named libexpatw.dll. - - Changed the name of the Windows DLLs from expat.dll to - libexpat.dll; this fixes SF bug #432456. - - Added the XML_ParserReset() API function. - - Fixed XML_SetReturnNSTriplet() to work for element names. - - Made the XML_UNICODE builds usable (thanks, Karl!). - - Allow xmlwf to read from standard input. - - Install a man page for xmlwf on Unix systems. - - Fixed many bugs; see SF bug reports 231864, 461380, 464837, - 466885, 469226, 477667, 484419, 487840, 494749, 496505, - 547350. Other bugs which we can't test as easily may also - have been fixed, especially in the area of build support. - -Release 1.95.2 Fri Jul 27 2001 - - More changes to make MSVC happy with the build; add a single - workspace to support both the library and xmlwf application. - - Added a Windows installer for Windows users; includes - xmlwf.exe. - - Added compile-time constants that can be used to determine the - Expat version - - Removed a lot of GNU-specific dependencies to aide portability - among the various Unix flavors. - - Fix the UTF-8 BOM bug. - - Cleaned up warning messages for several compilers. - - Added the -Wall, -Wstrict-prototypes options for GCC. - -Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000 - - Changes to get expat to build under Microsoft compiler - - Removed all aborts and instead return an UNEXPECTED_STATE error. - - Fixed a bug where a stray '%' in an entity value would cause an - abort. - - Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for - finding this oversight. - - Changed default patterns in lib/Makefile.in to fit non-GNU makes - Thanks to robin@unrated.net for reporting and providing an - account to test on. - - The reference had the wrong label for XML_SetStartNamespaceDecl. - Reported by an anonymous user. - -Release 1.95.0 Fri Sep 29 2000 - - XML_ParserCreate_MM - Allows you to set a memory management suite to replace the - standard malloc,realloc, and free. - - XML_SetReturnNSTriplet - If you turn this feature on when namespace processing is in - effect, then qualified, prefixed element and attribute names - are returned as "uri|name|prefix" where '|' is whatever - separator character is used in namespace processing. - - Merged in features from perl-expat - o XML_SetElementDeclHandler - o XML_SetAttlistDeclHandler - o XML_SetXmlDeclHandler - o XML_SetEntityDeclHandler - o StartDoctypeDeclHandler takes 3 additional parameters: - sysid, pubid, has_internal_subset - o Many paired handler setters (like XML_SetElementHandler) - now have corresponding individual handler setters - o XML_GetInputContext for getting the input context of - the current parse position. - - Added reference material - - Packaged into a distribution that builds a sharable library diff --git a/bundle/expat/README b/bundle/expat/README deleted file mode 100644 index 15bcdccb50..0000000000 --- a/bundle/expat/README +++ /dev/null @@ -1,72 +0,0 @@ - - Expat, Release 1.95.2 - -This is expat, a C library for parsing XML, written by James Clark. -Expat is a stream-oriented XML parser. This means that you register -handlers with the parser before starting the parse. These handlers -are called when the parser discovers the associated structures in the -document being parsed. A start tag is an example of the kind of -structures for which you may register handlers. - -Windows users should use the expat_win32bin package, which includes -both precompiled libraries and executalbes, and source code for -developers. - -Expat is free software. You may copy, distribute, and modify it under -the terms of the License contained in the file COPYING distributed -with this package. This license is the same as the MIT/X Consortium -license. - -Versions of expat that have an odd minor version (the middle number in -the release above), are development releases and should be considered -as beta software. Releases with even minor version numbers are -intended to be production grade software. - -To build expat, you first run the configuration shell script in the -top level distribution directory: - - ./configure - -There are many options which you may provide to configure (which you -can discover by running configure with the --help option). But the -one of most interest is the one that sets the installation directory. -By default, the configure script will set things up to install -libexpat into /usr/local/lib, expat.h into /usr/local/include, and -xmlwf into /usr/local/bin. If, for example, you'd prefer to install -into /home/me/mystuff/lib, /home/me/mystuff/include, and -/home/me/mystuff/bin, you can tell configure about that with: - - ./configure --prefix=/home/me/mystuff - -After running the configure script, the "make" command will build -things and "make install" will install things into their proper -location. Note that you need to have write permission into the -directories into which things will be installed. - -When building for use with C++, you may need to add additional -compiler flags to support proper interaction with exceptions. This -can be done by setting the CFLAGS environment variable. For example, -when using GCC, you can use: - - CFLAGS=-fexceptions ./configure - -Note for Solaris users: The "ar" command is usually located in -"/usr/ccs/bin", which is not in the default PATH. You will need to -add this to your path for the "make" command, and probably also switch -to GNU make (the "make" found in /usr/ccs/bin does not seem to work -properly -- appearantly it does not understand .PHONY directives). If -you're using ksh or bash, use this command to build: - - PATH=/usr/ccs/bin:$PATH make - -A reference manual is available in the file doc/reference.html in this -distribution. - -The homepage for this project is http://expat.sourceforge.net/. There -are links there to connect you to the bug reports page. If you need -to report a bug when you don't have access to a browser, you may also -send a bug report by email to expat-bugs@lists.sourceforge.net. - -Discussion related to the direction of future expat development takes -place on expat-discuss@lists.sourceforge.net. Archives of this list -may be found at http://www.geocrawler.com/redir-sf.php3?list=expat-discuss. diff --git a/bundle/expat/README.php b/bundle/expat/README.php deleted file mode 100644 index 187ef60be8..0000000000 --- a/bundle/expat/README.php +++ /dev/null @@ -1,11 +0,0 @@ -this is the PHP-bundled version of expat 1.95.1 - -changes from the original version: -- include instead of -- include "php_compat.h" for namespace protection -- hardcode version in xmlparse.c -- stripped off all unneded files - - -thies@thieso.net, 11th May, 2001 - diff --git a/bundle/expat/ascii.h b/bundle/expat/ascii.h deleted file mode 100644 index 073e8a5fb6..0000000000 --- a/bundle/expat/ascii.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#define ASCII_A 0x41 -#define ASCII_B 0x42 -#define ASCII_C 0x43 -#define ASCII_D 0x44 -#define ASCII_E 0x45 -#define ASCII_F 0x46 -#define ASCII_G 0x47 -#define ASCII_H 0x48 -#define ASCII_I 0x49 -#define ASCII_J 0x4A -#define ASCII_K 0x4B -#define ASCII_L 0x4C -#define ASCII_M 0x4D -#define ASCII_N 0x4E -#define ASCII_O 0x4F -#define ASCII_P 0x50 -#define ASCII_Q 0x51 -#define ASCII_R 0x52 -#define ASCII_S 0x53 -#define ASCII_T 0x54 -#define ASCII_U 0x55 -#define ASCII_V 0x56 -#define ASCII_W 0x57 -#define ASCII_X 0x58 -#define ASCII_Y 0x59 -#define ASCII_Z 0x5A - -#define ASCII_a 0x61 -#define ASCII_b 0x62 -#define ASCII_c 0x63 -#define ASCII_d 0x64 -#define ASCII_e 0x65 -#define ASCII_f 0x66 -#define ASCII_g 0x67 -#define ASCII_h 0x68 -#define ASCII_i 0x69 -#define ASCII_j 0x6A -#define ASCII_k 0x6B -#define ASCII_l 0x6C -#define ASCII_m 0x6D -#define ASCII_n 0x6E -#define ASCII_o 0x6F -#define ASCII_p 0x70 -#define ASCII_q 0x71 -#define ASCII_r 0x72 -#define ASCII_s 0x73 -#define ASCII_t 0x74 -#define ASCII_u 0x75 -#define ASCII_v 0x76 -#define ASCII_w 0x77 -#define ASCII_x 0x78 -#define ASCII_y 0x79 -#define ASCII_z 0x7A - -#define ASCII_0 0x30 -#define ASCII_1 0x31 -#define ASCII_2 0x32 -#define ASCII_3 0x33 -#define ASCII_4 0x34 -#define ASCII_5 0x35 -#define ASCII_6 0x36 -#define ASCII_7 0x37 -#define ASCII_8 0x38 -#define ASCII_9 0x39 - -#define ASCII_TAB 0x09 -#define ASCII_SPACE 0x20 -#define ASCII_EXCL 0x21 -#define ASCII_QUOT 0x22 -#define ASCII_AMP 0x26 -#define ASCII_APOS 0x27 -#define ASCII_MINUS 0x2D -#define ASCII_PERIOD 0x2E -#define ASCII_COLON 0x3A -#define ASCII_SEMI 0x3B -#define ASCII_LT 0x3C -#define ASCII_EQUALS 0x3D -#define ASCII_GT 0x3E -#define ASCII_LSQB 0x5B -#define ASCII_RSQB 0x5D -#define ASCII_UNDERSCORE 0x5F diff --git a/bundle/expat/asciitab.h b/bundle/expat/asciitab.h deleted file mode 100644 index 79a15c28ca..0000000000 --- a/bundle/expat/asciitab.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/bundle/expat/config.m4 b/bundle/expat/config.m4 deleted file mode 100644 index 89e12be2c6..0000000000 --- a/bundle/expat/config.m4 +++ /dev/null @@ -1,43 +0,0 @@ -dnl -dnl $Id$ -dnl - -PHP_ARG_BUNDLE(bundle-expat, Whether to bundle the expat library, -[ --without-bundle-expat Disable the bundled expat library], yes) - -# BC ini option -PHP_ARG_WITH(expat-dir, external libexpat install dir, -[ --with-expat-dir=DIR XML: external libexpat install dir], no, no) - -if test "$PHP_BUNDLE_EXPAT" = "yes" && test "$PHP_EXPAT_DIR" = "no"; then - AC_C_BIGENDIAN - if test "$ac_cv_c_bigendian" = "yes"; then - order=4321 - else - order=1234 - fi - - AC_DEFINE(HAVE_LIBEXPAT_BUNDLED, 1, [ ]) - AC_DEFINE(HAVE_LIBEXPAT, 1, [ ]) - AC_DEFINE(BYTEORDER, $order, [ ]) - PHP_ADD_SOURCES(bundle/expat, xmlparse.c xmlrole.c xmltok.c) - PHP_ADD_INCLUDE(bundle/expat) - PHP_ADD_BUILD_DIR(bundle/expat) -elif test "$PHP_BUNDLE_EXPAT" != "no" && test "$PHP_EXPAT_DIR" != "no"; then - # Find external expat library - - for i in $PHP_BUNDLE_EXPAT $PHP_EXPAT_DIR; do - if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME; then - EXPAT_DIR=$i - fi - done - - if test -z "$EXPAT_DIR"; then - AC_MSG_ERROR(not found. Please reinstall the expat distribution.) - fi - - AC_DEFINE(HAVE_LIBEXPAT, 1, [ ]) - PHP_ADD_INCLUDE($EXPAT_DIR/include) - PHP_ADD_LIBRARY_WITH_PATH(expat, $EXPAT_DIR/lib, EXPAT_SHARED_LIBADD) - PHP_SUBST(EXPAT_SHARED_LIBADD) -fi diff --git a/bundle/expat/expat.h b/bundle/expat/expat.h deleted file mode 100644 index c137f61226..0000000000 --- a/bundle/expat/expat.h +++ /dev/null @@ -1,910 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlParse_INCLUDED -#define XmlParse_INCLUDED 1 - -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler -#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler -#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler -#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg -#endif - -#include -#include "php_compat.h" - -#ifndef XMLPARSEAPI -#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) -#ifdef PHP_EXPORTS -#define XMLPARSEAPI(type) type __cdecl -#else -#define XMLPARSEAPI(type) __declspec(dllimport) type __cdecl -#endif -#else -#define XMLPARSEAPI(type) type -#endif -#endif /* not defined XMLPARSEAPI */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef XML_UNICODE_WCHAR_T -#define XML_UNICODE -#endif - -struct XML_ParserStruct; -typedef struct XML_ParserStruct *XML_Parser; - -#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ -#ifdef XML_UNICODE_WCHAR_T -typedef wchar_t XML_Char; -typedef wchar_t XML_LChar; -#else -typedef unsigned short XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE_WCHAR_T */ -#else /* Information is UTF-8 encoded. */ -typedef char XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE */ - -/* Should this be defined using stdbool.h when C99 is available? */ -typedef unsigned char XML_Bool; -#define XML_TRUE ((XML_Bool) 1) -#define XML_FALSE ((XML_Bool) 0) - -enum XML_Error { - XML_ERROR_NONE, - XML_ERROR_NO_MEMORY, - XML_ERROR_SYNTAX, - XML_ERROR_NO_ELEMENTS, - XML_ERROR_INVALID_TOKEN, - XML_ERROR_UNCLOSED_TOKEN, - XML_ERROR_PARTIAL_CHAR, - XML_ERROR_TAG_MISMATCH, - XML_ERROR_DUPLICATE_ATTRIBUTE, - XML_ERROR_JUNK_AFTER_DOC_ELEMENT, - XML_ERROR_PARAM_ENTITY_REF, - XML_ERROR_UNDEFINED_ENTITY, - XML_ERROR_RECURSIVE_ENTITY_REF, - XML_ERROR_ASYNC_ENTITY, - XML_ERROR_BAD_CHAR_REF, - XML_ERROR_BINARY_ENTITY_REF, - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, - XML_ERROR_MISPLACED_XML_PI, - XML_ERROR_UNKNOWN_ENCODING, - XML_ERROR_INCORRECT_ENCODING, - XML_ERROR_UNCLOSED_CDATA_SECTION, - XML_ERROR_EXTERNAL_ENTITY_HANDLING, - XML_ERROR_NOT_STANDALONE, - XML_ERROR_UNEXPECTED_STATE, - XML_ERROR_ENTITY_DECLARED_IN_PE, - XML_ERROR_FEATURE_REQUIRES_XML_DTD, - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING -}; - -enum XML_Content_Type { - XML_CTYPE_EMPTY = 1, - XML_CTYPE_ANY, - XML_CTYPE_MIXED, - XML_CTYPE_NAME, - XML_CTYPE_CHOICE, - XML_CTYPE_SEQ -}; - -enum XML_Content_Quant { - XML_CQUANT_NONE, - XML_CQUANT_OPT, - XML_CQUANT_REP, - XML_CQUANT_PLUS -}; - -/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be - XML_CQUANT_NONE, and the other fields will be zero or NULL. - If type == XML_CTYPE_MIXED, then quant will be NONE or REP and - numchildren will contain number of elements that may be mixed in - and children point to an array of XML_Content cells that will be - all of XML_CTYPE_NAME type with no quantification. - - If type == XML_CTYPE_NAME, then the name points to the name, and - the numchildren field will be zero and children will be NULL. The - quant fields indicates any quantifiers placed on the name. - - CHOICE and SEQ will have name NULL, the number of children in - numchildren and children will point, recursively, to an array - of XML_Content cells. - - The EMPTY, ANY, and MIXED types will only occur at top level. -*/ - -typedef struct XML_cp XML_Content; - -struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - XML_Char * name; - unsigned int numchildren; - XML_Content * children; -}; - - -/* This is called for an element declaration. See above for - description of the model argument. It's the caller's responsibility - to free model when finished with it. -*/ -typedef void (*XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); - -XMLPARSEAPI(void) -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); - -/* The Attlist declaration handler is called for *each* attribute. So - a single Attlist declaration with multiple attributes declared will - generate multiple calls to this handler. The "default" parameter - may be NULL in the case of the "#IMPLIED" or "#REQUIRED" - keyword. The "isrequired" parameter will be true and the default - value will be NULL in the case of "#REQUIRED". If "isrequired" is - true and default is non-NULL, then this is a "#FIXED" default. -*/ -typedef void (*XML_AttlistDeclHandler) (void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); - -XMLPARSEAPI(void) -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); - -/* The XML declaration handler is called for *both* XML declarations - and text declarations. The way to distinguish is that the version - parameter will be NULL for text declarations. The encoding - parameter may be NULL for XML declarations. The standalone - parameter will be -1, 0, or 1 indicating respectively that there - was no standalone parameter in the declaration, that it was given - as no, or that it was given as yes. -*/ -typedef void (*XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); - -XMLPARSEAPI(void) -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); - - -typedef struct { - void *(*malloc_fcn)(size_t size); - void *(*realloc_fcn)(void *ptr, size_t size); - void (*free_fcn)(void *ptr); -} XML_Memory_Handling_Suite; - -/* Constructs a new parser; encoding is the encoding specified by the - external protocol or NULL if there is none specified. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreate(const XML_Char *encoding); - -/* Constructs a new parser and namespace processor. Element type - names and attribute names that belong to a namespace will be - expanded; unprefixed attribute names are never expanded; unprefixed - element type names are expanded only if there is a default - namespace. The expanded name is the concatenation of the namespace - URI, the namespace separator character, and the local part of the - name. If the namespace separator is '\0' then the namespace URI - and the local part will be concatenated without any separator. - When a namespace is not declared, the name and prefix will be - passed through without expansion. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); - - -/* Constructs a new parser using the memory management suit referred to - by memsuite. If memsuite is NULL, then use the standard library memory - suite. If namespaceSeparator is non-NULL it creates a parser with - namespace processing as described above. The character pointed at - will serve as the namespace separator. - - All further memory operations used for the created parser will come from - the given suite. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreate_MM(const XML_Char *encoding, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); - -/* Prepare a parser object to be re-used. This is particularly - valuable when memory allocation overhead is disproportionatly high, - such as when a large number of small documnents need to be parsed. - All handlers are cleared from the parser, except for the - unknownEncodingHandler. The parser's external state is re-initialized - except for the values of ns and ns_triplets. - - Added in Expat 1.95.3. -*/ -XMLPARSEAPI(XML_Bool) -XML_ParserReset(XML_Parser parser, const XML_Char *encoding); - -/* atts is array of name/value pairs, terminated by 0; - names and values are 0 terminated. -*/ -typedef void (*XML_StartElementHandler)(void *userData, - const XML_Char *name, - const XML_Char **atts); - -typedef void (*XML_EndElementHandler)(void *userData, - const XML_Char *name); - - -/* s is not 0 terminated. */ -typedef void (*XML_CharacterDataHandler)(void *userData, - const XML_Char *s, - int len); - -/* target and data are 0 terminated */ -typedef void (*XML_ProcessingInstructionHandler)(void *userData, - const XML_Char *target, - const XML_Char *data); - -/* data is 0 terminated */ -typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data); - -typedef void (*XML_StartCdataSectionHandler)(void *userData); -typedef void (*XML_EndCdataSectionHandler)(void *userData); - -/* This is called for any characters in the XML document for which - there is no applicable handler. This includes both characters that - are part of markup which is of a kind that is not reported - (comments, markup declarations), or characters that are part of a - construct which could be reported but for which no handler has been - supplied. The characters are passed exactly as they were in the XML - document except that they will be encoded in UTF-8 or UTF-16. - Line boundaries are not normalized. Note that a byte order mark - character is not passed to the default handler. There are no - guarantees about how characters are divided between calls to the - default handler: for example, a comment might be split between - multiple calls. -*/ -typedef void (*XML_DefaultHandler)(void *userData, - const XML_Char *s, - int len); - -/* This is called for the start of the DOCTYPE declaration, before - any DTD or internal subset is parsed. -*/ -typedef void (*XML_StartDoctypeDeclHandler)(void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset); - -/* This is called for the start of the DOCTYPE declaration when the - closing > is encountered, but after processing any external - subset. -*/ -typedef void (*XML_EndDoctypeDeclHandler)(void *userData); - -/* This is called for entity declarations. The is_parameter_entity - argument will be non-zero if the entity is a parameter entity, zero - otherwise. - - For internal entities (), value will - be non-NULL and systemId, publicID, and notationName will be NULL. - The value string is NOT nul-terminated; the length is provided in - the value_length argument. Since it is legal to have zero-length - values, do not use this argument to test for internal entities. - - For external entities, value will be NULL and systemId will be - non-NULL. The publicId argument will be NULL unless a public - identifier was provided. The notationName argument will have a - non-NULL value only for unparsed entity declarations. - - Note that is_parameter_entity can't be changed to XML_Bool, since - that would break binary compatibility. -*/ -typedef void (*XML_EntityDeclHandler) (void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -XMLPARSEAPI(void) -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); - -/* OBSOLETE -- OBSOLETE -- OBSOLETE - This handler has been superceded by the EntityDeclHandler above. - It is provided here for backward compatibility. - - This is called for a declaration of an unparsed (NDATA) entity. - The base argument is whatever was set by XML_SetBase. The - entityName, systemId and notationName arguments will never be - NULL. The other arguments may be. -*/ -typedef void (*XML_UnparsedEntityDeclHandler)(void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -/* This is called for a declaration of notation. The base argument is - whatever was set by XML_SetBase. The notationName will never be - NULL. The other arguments can be. -*/ -typedef void (*XML_NotationDeclHandler)(void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* When namespace processing is enabled, these are called once for - each namespace declaration. The call to the start and end element - handlers occur between the calls to the start and end namespace - declaration handlers. For an xmlns attribute, prefix will be - NULL. For an xmlns="" attribute, uri will be NULL. -*/ -typedef void (*XML_StartNamespaceDeclHandler)(void *userData, - const XML_Char *prefix, - const XML_Char *uri); - -typedef void (*XML_EndNamespaceDeclHandler)(void *userData, - const XML_Char *prefix); - -/* This is called if the document is not standalone, that is, it has an - external subset or a reference to a parameter entity, but does not - have standalone="yes". If this handler returns 0, then processing - will not continue, and the parser will return a - XML_ERROR_NOT_STANDALONE error. - If parameter entity parsing is enabled, then in addition to the - conditions above this handler will only be called if the referenced - entity was actually read. -*/ -typedef int (*XML_NotStandaloneHandler)(void *userData); - -/* This is called for a reference to an external parsed general - entity. The referenced entity is not automatically parsed. The - application can parse it immediately or later using - XML_ExternalEntityParserCreate. - - The parser argument is the parser parsing the entity containing the - reference; it can be passed as the parser argument to - XML_ExternalEntityParserCreate. The systemId argument is the - system identifier as specified in the entity declaration; it will - not be NULL. - - The base argument is the system identifier that should be used as - the base for resolving systemId if systemId was relative; this is - set by XML_SetBase; it may be NULL. - - The publicId argument is the public identifier as specified in the - entity declaration, or NULL if none was specified; the whitespace - in the public identifier will have been normalized as required by - the XML spec. - - The context argument specifies the parsing context in the format - expected by the context argument to XML_ExternalEntityParserCreate; - context is valid only until the handler returns, so if the - referenced entity is to be parsed later, it must be copied. - - The handler should return 0 if processing should not continue - because of a fatal error in the handling of the external entity. - In this case the calling parser will return an - XML_ERROR_EXTERNAL_ENTITY_HANDLING error. - - Note that unlike other handlers the first argument is the parser, - not userData. -*/ -typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* This is called in two situations: - 1) An entity reference is encountered for which no declaration - has been read *and* this is not an error. - 2) An internal entity reference is read, but not expanded, because - XML_SetDefaultHandler has been called. - Note: skipped parameter entities in declarations and skipped general - entities in attribute values cannot be reported, because - the event would be out of sync with the reporting of the - declarations or attribute values -*/ -typedef void (*XML_SkippedEntityHandler)(void *userData, - const XML_Char *entityName, - int is_parameter_entity); - -/* This structure is filled in by the XML_UnknownEncodingHandler to - provide information to the parser about encodings that are unknown - to the parser. - - The map[b] member gives information about byte sequences whose - first byte is b. - - If map[b] is c where c is >= 0, then b by itself encodes the - Unicode scalar value c. - - If map[b] is -1, then the byte sequence is malformed. - - If map[b] is -n, where n >= 2, then b is the first byte of an - n-byte sequence that encodes a single Unicode scalar value. - - The data member will be passed as the first argument to the convert - function. - - The convert function is used to convert multibyte sequences; s will - point to a n-byte sequence where map[(unsigned char)*s] == -n. The - convert function must return the Unicode scalar value represented - by this byte sequence or -1 if the byte sequence is malformed. - - The convert function may be NULL if the encoding is a single-byte - encoding, that is if map[b] >= -1 for all bytes b. - - When the parser is finished with the encoding, then if release is - not NULL, it will call release passing it the data member; once - release has been called, the convert function will not be called - again. - - Expat places certain restrictions on the encodings that are supported - using this mechanism. - - 1. Every ASCII character that can appear in a well-formed XML document, - other than the characters - - $@\^`{}~ - - must be represented by a single byte, and that byte must be the - same byte that represents that character in ASCII. - - 2. No character may require more than 4 bytes to encode. - - 3. All characters encoded must have Unicode scalar values <= - 0xFFFF, (i.e., characters that would be encoded by surrogates in - UTF-16 are not allowed). Note that this restriction doesn't - apply to the built-in support for UTF-8 and UTF-16. - - 4. No Unicode character may be encoded by more than one distinct - sequence of bytes. -*/ -typedef struct { - int map[256]; - void *data; - int (*convert)(void *data, const char *s); - void (*release)(void *data); -} XML_Encoding; - -/* This is called for an encoding that is unknown to the parser. - - The encodingHandlerData argument is that which was passed as the - second argument to XML_SetUnknownEncodingHandler. - - The name argument gives the name of the encoding as specified in - the encoding declaration. - - If the callback can provide information about the encoding, it must - fill in the XML_Encoding structure, and return 1. Otherwise it - must return 0. - - If info does not describe a suitable encoding, then the parser will - return an XML_UNKNOWN_ENCODING error. -*/ -typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); - -XMLPARSEAPI(void) -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end); - -XMLPARSEAPI(void) -XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler); - -XMLPARSEAPI(void) -XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler); - -XMLPARSEAPI(void) -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler); - -XMLPARSEAPI(void) -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler); -XMLPARSEAPI(void) -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); - -XMLPARSEAPI(void) -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end); - -XMLPARSEAPI(void) -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start); - -XMLPARSEAPI(void) -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end); - -/* This sets the default handler and also inhibits expansion of - internal entities. These entity references will be passed to the - default handler, or to the skipped entity handler, if one is set. -*/ -XMLPARSEAPI(void) -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); - -/* This sets the default handler but does not inhibit expansion of - internal entities. The entity reference will not be passed to the - default handler. -*/ -XMLPARSEAPI(void) -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); - -XMLPARSEAPI(void) -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end); - -XMLPARSEAPI(void) -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start); - -XMLPARSEAPI(void) -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); - -XMLPARSEAPI(void) -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler); - -XMLPARSEAPI(void) -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); - -XMLPARSEAPI(void) -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); - -XMLPARSEAPI(void) -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start); - -XMLPARSEAPI(void) -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end); - -XMLPARSEAPI(void) -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler); - -XMLPARSEAPI(void) -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler); - -/* If a non-NULL value for arg is specified here, then it will be - passed as the first argument to the external entity ref handler - instead of the parser object. -*/ -XMLPARSEAPI(void) -XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); - -XMLPARSEAPI(void) -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler); - -XMLPARSEAPI(void) -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *encodingHandlerData); - -/* This can be called within a handler for a start element, end - element, processing instruction or character data. It causes the - corresponding markup to be passed to the default handler. -*/ -XMLPARSEAPI(void) -XML_DefaultCurrent(XML_Parser parser); - -/* If do_nst is non-zero, and namespace processing is in effect, and - a name has a prefix (i.e. an explicit namespace qualifier) then - that name is returned as a triplet in a single string separated by - the separator character specified when the parser was created: URI - + sep + local_name + sep + prefix. - - If do_nst is zero, then namespace information is returned in the - default manner (URI + sep + local_name) whether or not the name - has a prefix. - - Note: Calling XML_SetReturnNSTriplet after XML_Parse or - XML_ParseBuffer has no effect. -*/ - -XMLPARSEAPI(void) -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); - -/* This value is passed as the userData argument to callbacks. */ -XMLPARSEAPI(void) -XML_SetUserData(XML_Parser parser, void *userData); - -/* Returns the last value set by XML_SetUserData or NULL. */ -#define XML_GetUserData(parser) (*(void **)(parser)) - -/* This is equivalent to supplying an encoding argument to - XML_ParserCreate. On success XML_SetEncoding returns non-zero, - zero otherwise. - Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer - has no effect and returns zero. -*/ -XMLPARSEAPI(int) -XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); - -/* If this function is called, then the parser will be passed as the - first argument to callbacks instead of userData. The userData will - still be accessible using XML_GetUserData. -*/ -XMLPARSEAPI(void) -XML_UseParserAsHandlerArg(XML_Parser parser); - -/* If useDTD == XML_TRUE is passed to this function, then the parser - will assume that there is an external subset, even if none is - specified in the document. In such a case the parser will call the - externalEntityRefHandler with a value of NULL for the systemId - argument (the publicId and context arguments will be NULL as well). - Note: If this function is called, then this must be done before - the first call to XML_Parse or XML_ParseBuffer, since it will - have no effect after that. Returns - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. - Note: If the document does not have a DOCTYPE declaration at all, - then startDoctypeDeclHandler and endDoctypeDeclHandler will not - be called, despite an external subset being parsed. - Note: If XML_DTD is not defined when Expat is compiled, returns - XML_ERROR_FEATURE_REQUIRES_XML_DTD. -*/ -XMLPARSEAPI(enum XML_Error) -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); - - -/* Sets the base to be used for resolving relative URIs in system - identifiers in declarations. Resolving relative identifiers is - left to the application: this value will be passed through as the - base argument to the XML_ExternalEntityRefHandler, - XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base - argument will be copied. Returns zero if out of memory, non-zero - otherwise. -*/ -XMLPARSEAPI(int) -XML_SetBase(XML_Parser parser, const XML_Char *base); - -XMLPARSEAPI(const XML_Char *) -XML_GetBase(XML_Parser parser); - -/* Returns the number of the attribute/value pairs passed in last call - to the XML_StartElementHandler that were specified in the start-tag - rather than defaulted. Each attribute/value pair counts as 2; thus - this correspondds to an index into the atts array passed to the - XML_StartElementHandler. -*/ -XMLPARSEAPI(int) -XML_GetSpecifiedAttributeCount(XML_Parser parser); - -/* Returns the index of the ID attribute passed in the last call to - XML_StartElementHandler, or -1 if there is no ID attribute. Each - attribute/value pair counts as 2; thus this correspondds to an - index into the atts array passed to the XML_StartElementHandler. -*/ -XMLPARSEAPI(int) -XML_GetIdAttributeIndex(XML_Parser parser); - -/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is - detected. The last call to XML_Parse must have isFinal true; len - may be zero for this call (or any other). - - The XML_Status enum gives the possible return values for the - XML_Parse and XML_ParseBuffer functions. Though the return values - for these functions has always been described as a Boolean value, - the implementation, at least for the 1.95.x series, has always - returned exactly one of these values. The preprocessor #defines - are included so this stanza can be added to code that still needs - to support older versions of Expat 1.95.x: - - #ifndef XML_STATUS_OK - #define XML_STATUS_OK 1 - #define XML_STATUS_ERROR 0 - #endif - - Otherwise, the #define hackery is quite ugly and would have been dropped. -*/ -enum XML_Status { - XML_STATUS_ERROR = 0, -#define XML_STATUS_ERROR XML_STATUS_ERROR - XML_STATUS_OK = 1 -#define XML_STATUS_OK XML_STATUS_OK -}; - -XMLPARSEAPI(enum XML_Status) -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); - -XMLPARSEAPI(void *) -XML_GetBuffer(XML_Parser parser, int len); - -XMLPARSEAPI(enum XML_Status) -XML_ParseBuffer(XML_Parser parser, int len, int isFinal); - -/* Creates an XML_Parser object that can parse an external general - entity; context is a '\0'-terminated string specifying the parse - context; encoding is a '\0'-terminated string giving the name of - the externally specified encoding, or NULL if there is no - externally specified encoding. The context string consists of a - sequence of tokens separated by formfeeds (\f); a token consisting - of a name specifies that the general entity of the name is open; a - token of the form prefix=uri specifies the namespace for a - particular prefix; a token of the form =uri specifies the default - namespace. This can be called at any point after the first call to - an ExternalEntityRefHandler so longer as the parser has not yet - been freed. The new parser is completely independent and may - safely be used in a separate thread. The handlers and userData are - initialized from the parser argument. Returns 0 if out of memory. - Otherwise returns a new XML_Parser object. -*/ -XMLPARSEAPI(XML_Parser) -XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, - const XML_Char *encoding); - -enum XML_ParamEntityParsing { - XML_PARAM_ENTITY_PARSING_NEVER, - XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, - XML_PARAM_ENTITY_PARSING_ALWAYS -}; - -/* Controls parsing of parameter entities (including the external DTD - subset). If parsing of parameter entities is enabled, then - references to external parameter entities (including the external - DTD subset) will be passed to the handler set with - XML_SetExternalEntityRefHandler. The context passed will be 0. - - Unlike external general entities, external parameter entities can - only be parsed synchronously. If the external parameter entity is - to be parsed, it must be parsed during the call to the external - entity ref handler: the complete sequence of - XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and - XML_ParserFree calls must be made during this call. After - XML_ExternalEntityParserCreate has been called to create the parser - for the external parameter entity (context must be 0 for this - call), it is illegal to make any calls on the old parser until - XML_ParserFree has been called on the newly created parser. - If the library has been compiled without support for parameter - entity parsing (ie without XML_DTD being defined), then - XML_SetParamEntityParsing will return 0 if parsing of parameter - entities is requested; otherwise it will return non-zero. - Note: If XML_SetParamEntityParsing is called after XML_Parse or - XML_ParseBuffer, then it has no effect and will always return 0. -*/ -XMLPARSEAPI(int) -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing); - -/* If XML_Parse or XML_ParseBuffer have returned 0, then - XML_GetErrorCode returns information about the error. -*/ -XMLPARSEAPI(enum XML_Error) -XML_GetErrorCode(XML_Parser parser); - -/* These functions return information about the current parse - location. They may be called when XML_Parse or XML_ParseBuffer - return 0; in this case the location is the location of the - character at which the error was detected. - - They may also be called from any other callback called to report - some parse event; in this the location is the location of the first - of the sequence of characters that generated the event. -*/ -XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser); -XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser); -XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser); - -/* Return the number of bytes in the current event. - Returns 0 if the event is in an internal entity. -*/ -XMLPARSEAPI(int) -XML_GetCurrentByteCount(XML_Parser parser); - -/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets - the integer pointed to by offset to the offset within this buffer - of the current parse position, and sets the integer pointed to by size - to the size of this buffer (the number of input bytes). Otherwise - returns a NULL pointer. Also returns a NULL pointer if a parse isn't - active. - - NOTE: The character pointer returned should not be used outside - the handler that makes the call. -*/ -XMLPARSEAPI(const char *) -XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); - -/* For backwards compatibility with previous versions. */ -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber -#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex - -/* Frees memory used by the parser. */ -XMLPARSEAPI(void) -XML_ParserFree(XML_Parser parser); - -/* Returns a string describing the error. */ -XMLPARSEAPI(const XML_LChar *) -XML_ErrorString(enum XML_Error code); - -/* Return a string containing the version number of this expat */ -XMLPARSEAPI(const XML_LChar *) -XML_ExpatVersion(void); - -typedef struct { - int major; - int minor; - int micro; -} XML_Expat_Version; - -/* Return an XML_Expat_Version structure containing numeric version - number information for this version of expat. -*/ -XMLPARSEAPI(XML_Expat_Version) -XML_ExpatVersionInfo(void); - -/* Added in Expat 1.95.5. */ -enum XML_FeatureEnum { - XML_FEATURE_END = 0, - XML_FEATURE_UNICODE, - XML_FEATURE_UNICODE_WCHAR_T, - XML_FEATURE_DTD, - XML_FEATURE_CONTEXT_BYTES, - XML_FEATURE_MIN_SIZE, - XML_FEATURE_SIZEOF_XML_CHAR, - XML_FEATURE_SIZEOF_XML_LCHAR - /* Additional features must be added to the end of this enum. */ -}; - -typedef struct { - enum XML_FeatureEnum feature; - XML_LChar *name; - long int value; -} XML_Feature; - -XMLPARSEAPI(const XML_Feature *) -XML_GetFeatureList(void); - - -/* Expat follows the GNU/Linux convention of odd number minor version for - beta/development releases and even number minor version for stable - releases. Micro is bumped with each release, and set to 0 with each - change to major or minor version. -*/ -#define XML_MAJOR_VERSION 1 -#define XML_MINOR_VERSION 95 -#define XML_MICRO_VERSION 5 - -#ifdef __cplusplus -} -#endif - -#endif /* not XmlParse_INCLUDED */ diff --git a/bundle/expat/iasciitab.h b/bundle/expat/iasciitab.h deleted file mode 100644 index 24a1d5ccc9..0000000000 --- a/bundle/expat/iasciitab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/bundle/expat/internal.h b/bundle/expat/internal.h deleted file mode 100644 index 6e2c5ed45f..0000000000 --- a/bundle/expat/internal.h +++ /dev/null @@ -1,46 +0,0 @@ -/* internal.h - - Internal definitions used by Expat. This is not needed to compile - client code. - - The following definitions are made: - - FASTCALL -- Used for most internal functions to specify that the - fastest possible calling convention be used. - - inline -- Used for selected internal functions for which inlining - may improve performance on some platforms. -*/ - -#if defined(__GNUC__) -/* Last minute instability reported with egcs on a RedHat Linux 7.3 - box; argh! -*/ -/* #define FASTCALL __attribute__((stdcall, regparm(3))) */ -#elif defined(WIN32) -/* XXX This seems to have an unexpected negative effect on Windows so - we'll disable it for now on that platform. It may be reconsidered - for a future release if it can be made more effective. -*/ -/* #define FASTCALL __fastcall */ -#endif - -#ifndef FASTCALL -#define FASTCALL -#endif - -#ifndef XML_MIN_SIZE -#if !defined(__cplusplus) && !defined(inline) -#ifdef __GNUC__ -#define inline __inline -#endif /* __GNUC__ */ -#endif -#endif /* XML_MIN_SIZE */ - -#ifdef __cplusplus -#define inline inline -#else -#ifndef inline -#define inline -#endif -#endif diff --git a/bundle/expat/latin1tab.h b/bundle/expat/latin1tab.h deleted file mode 100644 index 53c25d76b2..0000000000 --- a/bundle/expat/latin1tab.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, -/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, diff --git a/bundle/expat/nametab.h b/bundle/expat/nametab.h deleted file mode 100644 index b05e62c77a..0000000000 --- a/bundle/expat/nametab.h +++ /dev/null @@ -1,150 +0,0 @@ -static const unsigned namingBitmap[] = { -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, -0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, -0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, -0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, -0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, -0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, -0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, -0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, -0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, -0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, -0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, -0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, -0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, -0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, -0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, -0x40000000, 0xF580C900, 0x00000007, 0x02010800, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, -0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, -0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, -0x00000000, 0x00004C40, 0x00000000, 0x00000000, -0x00000007, 0x00000000, 0x00000000, 0x00000000, -0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, -0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, -0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, -0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, -0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, -0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, -0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, -0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, -0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, -0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, -0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, -0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, -0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, -0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, -0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, -0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, -0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, -0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, -}; -static const unsigned char nmstrtPages[] = { -0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, -0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -static const unsigned char namePages[] = { -0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, -0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; diff --git a/bundle/expat/utf8tab.h b/bundle/expat/utf8tab.h deleted file mode 100644 index 7bb3e77603..0000000000 --- a/bundle/expat/utf8tab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - - -/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, -/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, diff --git a/bundle/expat/winconfig.h b/bundle/expat/winconfig.h deleted file mode 100644 index ce91577f20..0000000000 --- a/bundle/expat/winconfig.h +++ /dev/null @@ -1,30 +0,0 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) -*/ - -#ifndef WINCONFIG_H -#define WINCONFIG_H - -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN - -#include -#include - -#define XML_NS 1 -#define XML_DTD 1 -#define XML_CONTEXT_BYTES 1024 - -/* we will assume all Windows platforms are little endian */ -#define BYTEORDER 1234 - -/* Windows has memmove() available. */ -/* #define HAVE_MEMMOVE */ - -#endif /* ndef WINCONFIG_H */ diff --git a/bundle/expat/xmlparse.c b/bundle/expat/xmlparse.c deleted file mode 100644 index 60e65d6907..0000000000 --- a/bundle/expat/xmlparse.c +++ /dev/null @@ -1,5592 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include /* memset(), memcpy() */ -#if PHP_WIN32 -#include "config.w32.h" -#else -#include "php_config.h" -#endif -#include "php_compat.h" - -#ifdef COMPILED_FROM_DSP - -#include "winconfig.h" -#ifdef _LIB -#define XMLPARSEAPI(type) type __cdecl -#else -#define XMLPARSEAPI(type) __declspec(dllexport) type __cdecl -#endif -#include "expat.h" -#undef XMLPARSEAPI - -#elif defined(MACOS_CLASSIC) - -#include "macconfig.h" -#include "expat.h" - -#else - -#include - -#ifdef __declspec -#define XMLPARSEAPI(type) __declspec(dllexport) type __cdecl -#endif - -#include "expat.h" - -#ifdef __declspec -#undef XMLPARSEAPI -#endif -#endif /* ndef COMPILED_FROM_DSP */ - -#ifdef XML_UNICODE -#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX -#define XmlConvert XmlUtf16Convert -#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS -#define XmlEncode XmlUtf16Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1)) -typedef unsigned short ICHAR; -#else -#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX -#define XmlConvert XmlUtf8Convert -#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS -#define XmlEncode XmlUtf8Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf8) -typedef char ICHAR; -#endif - - -#ifndef XML_NS - -#define XmlInitEncodingNS XmlInitEncoding -#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding -#undef XmlGetInternalEncodingNS -#define XmlGetInternalEncodingNS XmlGetInternalEncoding -#define XmlParseXmlDeclNS XmlParseXmlDecl - -#endif - -#ifdef XML_UNICODE - -#ifdef XML_UNICODE_WCHAR_T -#define XML_T(x) (const wchar_t)x -#define XML_L(x) L ## x -#else -#define XML_T(x) (const unsigned short)x -#define XML_L(x) x -#endif - -#else - -#define XML_T(x) x -#define XML_L(x) x - -#endif - -/* Round up n to be a multiple of sz, where sz is a power of 2. */ -#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) - -/* Handle the case where memmove() doesn't exist. */ -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#error memmove does not exist on this platform, nor is a substitute available -#endif /* HAVE_BCOPY */ -#endif /* HAVE_MEMMOVE */ - -#include "internal.h" -#include "xmltok.h" -#include "xmlrole.h" - -typedef const XML_Char *KEY; - -typedef struct { - KEY name; -} NAMED; - -typedef struct { - NAMED **v; - size_t size; - size_t used; - size_t usedLim; - XML_Memory_Handling_Suite *mem; -} HASH_TABLE; - -typedef struct { - NAMED **p; - NAMED **end; -} HASH_TABLE_ITER; - -#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ -#define INIT_DATA_BUF_SIZE 1024 -#define INIT_ATTS_SIZE 16 -#define INIT_BLOCK_SIZE 1024 -#define INIT_BUFFER_SIZE 1024 - -#define EXPAND_SPARE 24 - -typedef struct binding { - struct prefix *prefix; - struct binding *nextTagBinding; - struct binding *prevPrefixBinding; - const struct attribute_id *attId; - XML_Char *uri; - int uriLen; - int uriAlloc; -} BINDING; - -typedef struct prefix { - const XML_Char *name; - BINDING *binding; -} PREFIX; - -typedef struct { - const XML_Char *str; - const XML_Char *localPart; - const XML_Char *prefix; - int strLen; - int uriLen; - int prefixLen; -} TAG_NAME; - -/* TAG represents an open element. - The name of the element is stored in both the document and API - encodings. The memory buffer 'buf' is a separately-allocated - memory area which stores the name. During the XML_Parse()/ - XMLParseBuffer() when the element is open, the memory for the 'raw' - version of the name (in the document encoding) is shared with the - document buffer. If the element is open across calls to - XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to - contain the 'raw' name as well. - - A parser re-uses these structures, maintaining a list of allocated - TAG objects in a free list. -*/ -typedef struct tag { - struct tag *parent; /* parent of this element */ - const char *rawName; /* tagName in the original encoding */ - int rawNameLength; - TAG_NAME name; /* tagName in the API encoding */ - char *buf; /* buffer for name components */ - char *bufEnd; /* end of the buffer */ - BINDING *bindings; -} TAG; - -typedef struct { - const XML_Char *name; - const XML_Char *textPtr; - int textLen; - const XML_Char *systemId; - const XML_Char *base; - const XML_Char *publicId; - const XML_Char *notation; - XML_Bool open; - XML_Bool is_param; - XML_Bool is_internal; /* true if declared in internal subset outside PE */ -} ENTITY; - -typedef struct { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - const XML_Char * name; - int firstchild; - int lastchild; - int childcnt; - int nextsib; -} CONTENT_SCAFFOLD; - -#define INIT_SCAFFOLD_ELEMENTS 32 - -typedef struct block { - struct block *next; - int size; - XML_Char s[1]; -} BLOCK; - -typedef struct { - BLOCK *blocks; - BLOCK *freeBlocks; - const XML_Char *end; - XML_Char *ptr; - XML_Char *start; - XML_Memory_Handling_Suite *mem; -} STRING_POOL; - -/* The XML_Char before the name is used to determine whether - an attribute has been specified. */ -typedef struct attribute_id { - XML_Char *name; - PREFIX *prefix; - XML_Bool maybeTokenized; - XML_Bool xmlns; -} ATTRIBUTE_ID; - -typedef struct { - const ATTRIBUTE_ID *id; - XML_Bool isCdata; - const XML_Char *value; -} DEFAULT_ATTRIBUTE; - -typedef struct { - const XML_Char *name; - PREFIX *prefix; - const ATTRIBUTE_ID *idAtt; - int nDefaultAtts; - int allocDefaultAtts; - DEFAULT_ATTRIBUTE *defaultAtts; -} ELEMENT_TYPE; - -typedef struct { - HASH_TABLE generalEntities; - HASH_TABLE elementTypes; - HASH_TABLE attributeIds; - HASH_TABLE prefixes; - STRING_POOL pool; - STRING_POOL entityValuePool; - /* false once a parameter entity reference has been skipped */ - XML_Bool keepProcessing; - /* true once an internal or external PE reference has been encountered; - any external subset is considered an external PE reference */ - XML_Bool hasParamEntityRefs; - XML_Bool standalone; -#ifdef XML_DTD - /* indicates if external PE has been read */ - XML_Bool paramEntityRead; - HASH_TABLE paramEntities; -#endif /* XML_DTD */ - PREFIX defaultPrefix; - /* === scaffolding for building content model === */ - XML_Bool in_eldecl; - CONTENT_SCAFFOLD *scaffold; - unsigned contentStringLen; - unsigned scaffSize; - unsigned scaffCount; - int scaffLevel; - int *scaffIndex; -} DTD; - -typedef struct open_internal_entity { - const char *internalEventPtr; - const char *internalEventEndPtr; - struct open_internal_entity *next; - ENTITY *entity; -} OPEN_INTERNAL_ENTITY; - -typedef enum XML_Error FASTCALL Processor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr); - -static Processor prologProcessor; -static Processor prologInitProcessor; -static Processor contentProcessor; -static Processor cdataSectionProcessor; -#ifdef XML_DTD -static Processor ignoreSectionProcessor; -static Processor externalParEntProcessor; -static Processor externalParEntInitProcessor; -static Processor entityValueProcessor; -static Processor entityValueInitProcessor; -#endif /* XML_DTD */ -static Processor epilogProcessor; -static Processor errorProcessor; -static Processor externalEntityInitProcessor; -static Processor externalEntityInitProcessor2; -static Processor externalEntityInitProcessor3; -static Processor externalEntityContentProcessor; - -static enum XML_Error FASTCALL -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); -static enum XML_Error FASTCALL -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *, const char *); -static enum XML_Error FASTCALL -initializeEncoding(XML_Parser parser); -static enum XML_Error FASTCALL -doProlog(XML_Parser parser, const ENCODING *enc, const char *s, - const char *end, int tok, const char *next, const char **nextPtr); -static enum XML_Error FASTCALL -processInternalParamEntity(XML_Parser parser, ENTITY *entity); -static enum XML_Error FASTCALL -doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, - const char *start, const char *end, const char **endPtr); -static enum XML_Error FASTCALL -doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr); -#ifdef XML_DTD -static enum XML_Error FASTCALL -doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr); -#endif /* XML_DTD */ -static enum XML_Error FASTCALL -storeAtts(XML_Parser parser, const ENCODING *, - const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr); -static int FASTCALL -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr); - -static int FASTCALL -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, - XML_Bool isCdata, XML_Bool isId, const XML_Char *dfltValue, - XML_Parser parser); - -static enum XML_Error FASTCALL -storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static enum XML_Error FASTCALL -appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static ATTRIBUTE_ID * FASTCALL -getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int FASTCALL -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); -static enum XML_Error FASTCALL -storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int FASTCALL -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end); -static int FASTCALL -reportComment(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static void FASTCALL -reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); - -static const XML_Char * FASTCALL getContext(XML_Parser parser); -static XML_Bool FASTCALL -setContext(XML_Parser parser, const XML_Char *context); -static void FASTCALL normalizePublicId(XML_Char *s); -static void FASTCALL dtdInit(DTD *, XML_Parser parser); - -/* do not call if parentParser != NULL */ -static void FASTCALL dtdReset(DTD *, XML_Parser parser); -static void FASTCALL dtdDestroy(DTD *, XML_Parser parser); - -static int FASTCALL dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser); - -static int FASTCALL copyEntityTable(HASH_TABLE *, STRING_POOL *, - const HASH_TABLE *, XML_Parser parser); - -#ifdef XML_DTD -static void FASTCALL dtdSwap(DTD *, DTD *); -#endif /* XML_DTD */ - -static NAMED * FASTCALL -lookup(HASH_TABLE *table, KEY name, size_t createSize); - -static void FASTCALL -hashTableInit(HASH_TABLE *, XML_Memory_Handling_Suite *ms); - -static void FASTCALL hashTableClear(HASH_TABLE *); -static void FASTCALL hashTableDestroy(HASH_TABLE *); -static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); -static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *); -static void FASTCALL poolInit(STRING_POOL *, XML_Memory_Handling_Suite *ms); -static void FASTCALL poolClear(STRING_POOL *); -static void FASTCALL poolDestroy(STRING_POOL *); -static XML_Char * FASTCALL -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Char * FASTCALL -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); - -static XML_Bool FASTCALL poolGrow(STRING_POOL *pool); - -static int FASTCALL nextScaffoldPart(XML_Parser parser); -static XML_Content * FASTCALL build_model(XML_Parser parser); - -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s); -static const XML_Char * FASTCALL -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s); -static ELEMENT_TYPE * FASTCALL -getElementType(XML_Parser Paraser, const ENCODING *enc, - const char *ptr, const char *end); - -static void FASTCALL -parserInit(XML_Parser parser, const XML_Char *encodingName); - -#define poolStart(pool) ((pool)->start) -#define poolEnd(pool) ((pool)->ptr) -#define poolLength(pool) ((pool)->ptr - (pool)->start) -#define poolChop(pool) ((void)--(pool->ptr)) -#define poolLastChar(pool) (((pool)->ptr)[-1]) -#define poolDiscard(pool) ((pool)->ptr = (pool)->start) -#define poolFinish(pool) ((pool)->start = (pool)->ptr) -#define poolAppendChar(pool, c) \ - (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ - ? 0 \ - : ((*((pool)->ptr)++ = c), 1)) - -struct XML_ParserStruct { - /* The first member must be userData so that the XML_GetUserData - macro works. */ - void *m_userData; - void *m_handlerArg; - char *m_buffer; - XML_Memory_Handling_Suite m_mem; - /* first character to be parsed */ - const char *m_bufferPtr; - /* past last character to be parsed */ - char *m_bufferEnd; - /* allocated end of buffer */ - const char *m_bufferLim; - long m_parseEndByteIndex; - const char *m_parseEndPtr; - XML_Char *m_dataBuf; - XML_Char *m_dataBufEnd; - XML_StartElementHandler m_startElementHandler; - XML_EndElementHandler m_endElementHandler; - XML_CharacterDataHandler m_characterDataHandler; - XML_ProcessingInstructionHandler m_processingInstructionHandler; - XML_CommentHandler m_commentHandler; - XML_StartCdataSectionHandler m_startCdataSectionHandler; - XML_EndCdataSectionHandler m_endCdataSectionHandler; - XML_DefaultHandler m_defaultHandler; - XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; - XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; - XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; - XML_NotationDeclHandler m_notationDeclHandler; - XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler; - XML_NotStandaloneHandler m_notStandaloneHandler; - XML_ExternalEntityRefHandler m_externalEntityRefHandler; - void *m_externalEntityRefHandlerArg; - XML_SkippedEntityHandler m_skippedEntityHandler; - XML_UnknownEncodingHandler m_unknownEncodingHandler; - XML_ElementDeclHandler m_elementDeclHandler; - XML_AttlistDeclHandler m_attlistDeclHandler; - XML_EntityDeclHandler m_entityDeclHandler; - XML_XmlDeclHandler m_xmlDeclHandler; - const ENCODING *m_encoding; - INIT_ENCODING m_initEncoding; - const ENCODING *m_internalEncoding; - const XML_Char *m_protocolEncodingName; - XML_Bool m_ns; - XML_Bool m_ns_triplets; - void *m_unknownEncodingMem; - void *m_unknownEncodingData; - void *m_unknownEncodingHandlerData; - void (*m_unknownEncodingRelease)(void *); - PROLOG_STATE m_prologState; - Processor *m_processor; - enum XML_Error m_errorCode; - const char *m_eventPtr; - const char *m_eventEndPtr; - const char *m_positionPtr; - OPEN_INTERNAL_ENTITY *m_openInternalEntities; - XML_Bool m_defaultExpandInternalEntities; - int m_tagLevel; - ENTITY *m_declEntity; - const XML_Char *m_doctypeName; - const XML_Char *m_doctypeSysid; - const XML_Char *m_doctypePubid; - const XML_Char *m_declAttributeType; - const XML_Char *m_declNotationName; - const XML_Char *m_declNotationPublicId; - ELEMENT_TYPE *m_declElementType; - ATTRIBUTE_ID *m_declAttributeId; - XML_Bool m_declAttributeIsCdata; - XML_Bool m_declAttributeIsId; - DTD m_dtd; - const XML_Char *m_curBase; - TAG *m_tagStack; - TAG *m_freeTagList; - BINDING *m_inheritedBindings; - BINDING *m_freeBindingList; - int m_attsSize; - int m_nSpecifiedAtts; - int m_idAttIndex; - ATTRIBUTE *m_atts; - POSITION m_position; - STRING_POOL m_tempPool; - STRING_POOL m_temp2Pool; - char *m_groupConnector; - unsigned m_groupSize; - XML_Char m_namespaceSeparator; - XML_Parser m_parentParser; -#ifdef XML_DTD - XML_Bool m_isParamEntity; - XML_Bool m_useForeignDTD; - enum XML_ParamEntityParsing m_paramEntityParsing; -#endif -}; - -#define MALLOC(s) ((parser)->m_mem.malloc_fcn((s))) -#define REALLOC(p,s) ((parser)->m_mem.realloc_fcn((p),(s))) -#define FREE(p) ((parser)->m_mem.free_fcn((p))) - -#define userData (parser->m_userData) -#define handlerArg (parser->m_handlerArg) -#define startElementHandler (parser->m_startElementHandler) -#define endElementHandler (parser->m_endElementHandler) -#define characterDataHandler (parser->m_characterDataHandler) -#define processingInstructionHandler \ - (parser->m_processingInstructionHandler) -#define commentHandler (parser->m_commentHandler) -#define startCdataSectionHandler \ - (parser->m_startCdataSectionHandler) -#define endCdataSectionHandler (parser->m_endCdataSectionHandler) -#define defaultHandler (parser->m_defaultHandler) -#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler) -#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler) -#define unparsedEntityDeclHandler \ - (parser->m_unparsedEntityDeclHandler) -#define notationDeclHandler (parser->m_notationDeclHandler) -#define startNamespaceDeclHandler \ - (parser->m_startNamespaceDeclHandler) -#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler) -#define notStandaloneHandler (parser->m_notStandaloneHandler) -#define externalEntityRefHandler \ - (parser->m_externalEntityRefHandler) -#define externalEntityRefHandlerArg \ - (parser->m_externalEntityRefHandlerArg) -#define internalEntityRefHandler \ - (parser->m_internalEntityRefHandler) -#define skippedEntityHandler (parser->m_skippedEntityHandler) -#define unknownEncodingHandler (parser->m_unknownEncodingHandler) -#define elementDeclHandler (parser->m_elementDeclHandler) -#define attlistDeclHandler (parser->m_attlistDeclHandler) -#define entityDeclHandler (parser->m_entityDeclHandler) -#define xmlDeclHandler (parser->m_xmlDeclHandler) -#define encoding (parser->m_encoding) -#define initEncoding (parser->m_initEncoding) -#define internalEncoding (parser->m_internalEncoding) -#define unknownEncodingMem (parser->m_unknownEncodingMem) -#define unknownEncodingData (parser->m_unknownEncodingData) -#define unknownEncodingHandlerData \ - (parser->m_unknownEncodingHandlerData) -#define unknownEncodingRelease (parser->m_unknownEncodingRelease) -#define protocolEncodingName (parser->m_protocolEncodingName) -#define ns (parser->m_ns) -#define ns_triplets (parser->m_ns_triplets) -#define prologState (parser->m_prologState) -#define processor (parser->m_processor) -#define errorCode (parser->m_errorCode) -#define eventPtr (parser->m_eventPtr) -#define eventEndPtr (parser->m_eventEndPtr) -#define positionPtr (parser->m_positionPtr) -#define position (parser->m_position) -#define openInternalEntities (parser->m_openInternalEntities) -#define defaultExpandInternalEntities \ - (parser->m_defaultExpandInternalEntities) -#define tagLevel (parser->m_tagLevel) -#define buffer (parser->m_buffer) -#define bufferPtr (parser->m_bufferPtr) -#define bufferEnd (parser->m_bufferEnd) -#define parseEndByteIndex (parser->m_parseEndByteIndex) -#define parseEndPtr (parser->m_parseEndPtr) -#define bufferLim (parser->m_bufferLim) -#define dataBuf (parser->m_dataBuf) -#define dataBufEnd (parser->m_dataBufEnd) -#define dtd (parser->m_dtd) -#define curBase (parser->m_curBase) -#define declEntity (parser->m_declEntity) -#define doctypeName (parser->m_doctypeName) -#define doctypeSysid (parser->m_doctypeSysid) -#define doctypePubid (parser->m_doctypePubid) -#define declAttributeType (parser->m_declAttributeType) -#define declNotationName (parser->m_declNotationName) -#define declNotationPublicId (parser->m_declNotationPublicId) -#define declElementType (parser->m_declElementType) -#define declAttributeId (parser->m_declAttributeId) -#define declAttributeIsCdata (parser->m_declAttributeIsCdata) -#define declAttributeIsId (parser->m_declAttributeIsId) -#define freeTagList (parser->m_freeTagList) -#define freeBindingList (parser->m_freeBindingList) -#define inheritedBindings (parser->m_inheritedBindings) -#define tagStack (parser->m_tagStack) -#define atts (parser->m_atts) -#define attsSize (parser->m_attsSize) -#define nSpecifiedAtts (parser->m_nSpecifiedAtts) -#define idAttIndex (parser->m_idAttIndex) -#define tempPool (parser->m_tempPool) -#define temp2Pool (parser->m_temp2Pool) -#define groupConnector (parser->m_groupConnector) -#define groupSize (parser->m_groupSize) -#define namespaceSeparator (parser->m_namespaceSeparator) -#define parentParser (parser->m_parentParser) -#ifdef XML_DTD -#define isParamEntity (parser->m_isParamEntity) -#define useForeignDTD (parser->m_useForeignDTD) -#define paramEntityParsing (parser->m_paramEntityParsing) -#endif /* XML_DTD */ - -#define parsing (processor != prologInitProcessor) - - -XML_Parser -XML_ParserCreate(const XML_Char *encodingName) -{ - return XML_ParserCreate_MM(encodingName, NULL, NULL); -} - -XML_Parser -XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) -{ - XML_Char tmp[2]; - *tmp = nsSep; - return XML_ParserCreate_MM(encodingName, NULL, tmp); -} - -XML_Parser -XML_ParserCreate_MM(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep) { - XML_Parser parser; - static const XML_Char implicitContext[] = { - 'x', 'm', 'l', '=', 'h', 't', 't', 'p', ':', '/', '/', - 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/', - 'X', 'M', 'L', '/', '1', '9', '9', '8', '/', - 'n', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e', '\0' - }; - - - if (memsuite) { - XML_Memory_Handling_Suite *mtemp; - parser = memsuite->malloc_fcn(sizeof(struct XML_ParserStruct)); - if (parser != NULL) { - mtemp = &(parser->m_mem); - mtemp->malloc_fcn = memsuite->malloc_fcn; - mtemp->realloc_fcn = memsuite->realloc_fcn; - mtemp->free_fcn = memsuite->free_fcn; - } - } - else { - XML_Memory_Handling_Suite *mtemp; - parser = malloc(sizeof(struct XML_ParserStruct)); - if (parser != NULL) { - mtemp = &(parser->m_mem); - mtemp->malloc_fcn = malloc; - mtemp->realloc_fcn = realloc; - mtemp->free_fcn = free; - } - } - - if (!parser) - return parser; - - buffer = NULL; - bufferLim = NULL; - - attsSize = INIT_ATTS_SIZE; - atts = MALLOC(attsSize * sizeof(ATTRIBUTE)); - if (atts == NULL) { - FREE(parser); - return NULL; - } - dataBuf = MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); - if (dataBuf == NULL) { - FREE(atts); - FREE(parser); - return NULL; - } - dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; - - freeBindingList = NULL; - freeTagList = NULL; - - groupSize = 0; - groupConnector = NULL; - - unknownEncodingHandler = NULL; - unknownEncodingHandlerData = NULL; - - namespaceSeparator = '!'; - ns = XML_FALSE; - ns_triplets = XML_FALSE; - - poolInit(&tempPool, &(parser->m_mem)); - poolInit(&temp2Pool, &(parser->m_mem)); - parserInit(parser, encodingName); - dtdInit(&dtd, parser); - - if (!atts || !dataBuf || (encodingName && !protocolEncodingName)) { - XML_ParserFree(parser); - return NULL; - } - - if (nameSep) { - ns = XML_TRUE; - internalEncoding = XmlGetInternalEncodingNS(); - namespaceSeparator = *nameSep; - - if (!setContext(parser, implicitContext)) { - XML_ParserFree(parser); - return NULL; - } - } - else { - internalEncoding = XmlGetInternalEncoding(); - } - - return parser; -} - -static void FASTCALL -parserInit(XML_Parser parser, const XML_Char *encodingName) -{ - processor = prologInitProcessor; - XmlPrologStateInit(&prologState); - protocolEncodingName = (encodingName != NULL - ? poolCopyString(&tempPool, encodingName) - : NULL); - curBase = NULL; - XmlInitEncoding(&initEncoding, &encoding, 0); - userData = NULL; - handlerArg = NULL; - startElementHandler = NULL; - endElementHandler = NULL; - characterDataHandler = NULL; - processingInstructionHandler = NULL; - commentHandler = NULL; - startCdataSectionHandler = NULL; - endCdataSectionHandler = NULL; - defaultHandler = NULL; - startDoctypeDeclHandler = NULL; - endDoctypeDeclHandler = NULL; - unparsedEntityDeclHandler = NULL; - notationDeclHandler = NULL; - startNamespaceDeclHandler = NULL; - endNamespaceDeclHandler = NULL; - notStandaloneHandler = NULL; - externalEntityRefHandler = NULL; - externalEntityRefHandlerArg = parser; - skippedEntityHandler = NULL; - elementDeclHandler = NULL; - attlistDeclHandler = NULL; - entityDeclHandler = NULL; - xmlDeclHandler = NULL; - bufferPtr = buffer; - bufferEnd = buffer; - parseEndByteIndex = 0; - parseEndPtr = NULL; - declElementType = NULL; - declAttributeId = NULL; - declEntity = NULL; - doctypeName = NULL; - doctypeSysid = NULL; - doctypePubid = NULL; - declAttributeType = NULL; - declNotationName = NULL; - declNotationPublicId = NULL; - declAttributeIsCdata = XML_FALSE; - declAttributeIsId = XML_FALSE; - memset(&position, 0, sizeof(POSITION)); - errorCode = XML_ERROR_NONE; - eventPtr = NULL; - eventEndPtr = NULL; - positionPtr = NULL; - openInternalEntities = 0; - defaultExpandInternalEntities = XML_TRUE; - tagLevel = 0; - tagStack = NULL; - inheritedBindings = NULL; - nSpecifiedAtts = 0; - unknownEncodingMem = NULL; - unknownEncodingRelease = NULL; - unknownEncodingData = NULL; - parentParser = NULL; -#ifdef XML_DTD - isParamEntity = XML_FALSE; - useForeignDTD = XML_FALSE; - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif -} - -/* moves list of bindings to freeBindingList */ -static void FASTCALL -moveToFreeBindingList(XML_Parser parser, BINDING *bindings) -{ - while (bindings) { - BINDING *b = bindings; - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - } -} - -XML_Bool -XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) -{ - TAG *tStk; - if (parentParser) - return XML_FALSE; - /* move tagStack to freeTagList */ - tStk = tagStack; - while (tStk) { - TAG *tag = tStk; - tStk = tStk->parent; - tag->parent = freeTagList; - moveToFreeBindingList(parser, tag->bindings); - tag->bindings = NULL; - freeTagList = tag; - } - moveToFreeBindingList(parser, inheritedBindings); - if (unknownEncodingMem) - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - poolClear(&tempPool); - poolClear(&temp2Pool); - parserInit(parser, encodingName); - dtdReset(&dtd, parser); - return XML_TRUE; -} - -int -XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (parsing) - return 0; - if (encodingName == NULL) - protocolEncodingName = NULL; - else { - protocolEncodingName = poolCopyString(&tempPool, encodingName); - if (!protocolEncodingName) - return 0; - } - return 1; -} - -XML_Parser -XML_ExternalEntityParserCreate(XML_Parser oldParser, - const XML_Char *context, - const XML_Char *encodingName) -{ - XML_Parser parser = oldParser; - DTD *oldDtd = &dtd; - XML_StartElementHandler oldStartElementHandler = startElementHandler; - XML_EndElementHandler oldEndElementHandler = endElementHandler; - XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; - XML_ProcessingInstructionHandler oldProcessingInstructionHandler - = processingInstructionHandler; - XML_CommentHandler oldCommentHandler = commentHandler; - XML_StartCdataSectionHandler oldStartCdataSectionHandler - = startCdataSectionHandler; - XML_EndCdataSectionHandler oldEndCdataSectionHandler - = endCdataSectionHandler; - XML_DefaultHandler oldDefaultHandler = defaultHandler; - XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler - = unparsedEntityDeclHandler; - XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; - XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler - = startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler - = endNamespaceDeclHandler; - XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; - XML_ExternalEntityRefHandler oldExternalEntityRefHandler - = externalEntityRefHandler; - XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; - XML_UnknownEncodingHandler oldUnknownEncodingHandler - = unknownEncodingHandler; - XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; - XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; - XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; - XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; - ELEMENT_TYPE * oldDeclElementType = declElementType; - - void *oldUserData = userData; - void *oldHandlerArg = handlerArg; - XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; - void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; -#ifdef XML_DTD - int oldParamEntityParsing = paramEntityParsing; - int oldInEntityValue = prologState.inEntityValue; -#endif - XML_Bool oldns_triplets = ns_triplets; - - /* Note that the magical uses of the pre-processor to make field - access look more like C++ require that `parser' be overwritten - here. This makes this function more painful to follow than it - would be otherwise. - */ - if (ns) { - XML_Char tmp[2]; - - *tmp = namespaceSeparator; - parser = XML_ParserCreate_MM(encodingName, &parser->m_mem, - tmp); - } - else { - parser = XML_ParserCreate_MM(encodingName, &parser->m_mem, - NULL); - } - - if (!parser) - return NULL; - - startElementHandler = oldStartElementHandler; - endElementHandler = oldEndElementHandler; - characterDataHandler = oldCharacterDataHandler; - processingInstructionHandler = oldProcessingInstructionHandler; - commentHandler = oldCommentHandler; - startCdataSectionHandler = oldStartCdataSectionHandler; - endCdataSectionHandler = oldEndCdataSectionHandler; - defaultHandler = oldDefaultHandler; - unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; - notationDeclHandler = oldNotationDeclHandler; - startNamespaceDeclHandler = oldStartNamespaceDeclHandler; - endNamespaceDeclHandler = oldEndNamespaceDeclHandler; - notStandaloneHandler = oldNotStandaloneHandler; - externalEntityRefHandler = oldExternalEntityRefHandler; - skippedEntityHandler = oldSkippedEntityHandler; - unknownEncodingHandler = oldUnknownEncodingHandler; - elementDeclHandler = oldElementDeclHandler; - attlistDeclHandler = oldAttlistDeclHandler; - entityDeclHandler = oldEntityDeclHandler; - xmlDeclHandler = oldXmlDeclHandler; - declElementType = oldDeclElementType; - userData = oldUserData; - if (oldUserData == oldHandlerArg) - handlerArg = userData; - else - handlerArg = parser; - if (oldExternalEntityRefHandlerArg != oldParser) - externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; - defaultExpandInternalEntities = oldDefaultExpandInternalEntities; - ns_triplets = oldns_triplets; - parentParser = oldParser; -#ifdef XML_DTD - paramEntityParsing = oldParamEntityParsing; - prologState.inEntityValue = oldInEntityValue; - if (context) { -#endif /* XML_DTD */ - if (!dtdCopy(&dtd, oldDtd, parser) || !setContext(parser, context)) { - XML_ParserFree(parser); - return NULL; - } - processor = externalEntityInitProcessor; -#ifdef XML_DTD - } - else { - dtdSwap(&dtd, oldDtd); - isParamEntity = XML_TRUE; - XmlPrologStateInitExternalEntity(&prologState); - processor = externalParEntInitProcessor; - } -#endif /* XML_DTD */ - return parser; -} - -static void FASTCALL -destroyBindings(BINDING *bindings, XML_Parser parser) -{ - for (;;) { - BINDING *b = bindings; - if (!b) - break; - bindings = b->nextTagBinding; - FREE(b->uri); - FREE(b); - } -} - -void -XML_ParserFree(XML_Parser parser) -{ - for (;;) { - TAG *p; - if (tagStack == 0) { - if (freeTagList == NULL) - break; - tagStack = freeTagList; - freeTagList = NULL; - } - p = tagStack; - tagStack = tagStack->parent; - FREE(p->buf); - destroyBindings(p->bindings, parser); - FREE(p); - } - destroyBindings(freeBindingList, parser); - destroyBindings(inheritedBindings, parser); - poolDestroy(&tempPool); - poolDestroy(&temp2Pool); -#ifdef XML_DTD - if (isParamEntity) - dtdSwap(&dtd, &parentParser->m_dtd); -#endif /* XML_DTD */ - dtdDestroy(&dtd, parser); - FREE((void *)atts); - if (groupConnector) - FREE(groupConnector); - if (buffer) - FREE(buffer); - FREE(dataBuf); - if (unknownEncodingMem) - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - FREE(parser); -} - -void -XML_UseParserAsHandlerArg(XML_Parser parser) -{ - handlerArg = parser; -} - -enum XML_Error -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) -{ -#ifdef XML_DTD - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (parsing) - return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING; - useForeignDTD = useDTD; - return XML_ERROR_NONE; -#else - return XML_ERROR_FEATURE_REQUIRES_XML_DTD; -#endif -} - -void -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (parsing) - return; - ns_triplets = do_nst ? XML_TRUE : XML_FALSE; -} - -void -XML_SetUserData(XML_Parser parser, void *p) -{ - if (handlerArg == userData) - handlerArg = userData = p; - else - userData = p; -} - -int -XML_SetBase(XML_Parser parser, const XML_Char *p) -{ - if (p) { - p = poolCopyString(&dtd.pool, p); - if (!p) - return 0; - curBase = p; - } - else - curBase = NULL; - return 1; -} - -const XML_Char * -XML_GetBase(XML_Parser parser) -{ - return curBase; -} - -int -XML_GetSpecifiedAttributeCount(XML_Parser parser) -{ - return nSpecifiedAtts; -} - -int -XML_GetIdAttributeIndex(XML_Parser parser) -{ - return idAttIndex; -} - -void -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end) -{ - startElementHandler = start; - endElementHandler = end; -} - -void -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler start) { - startElementHandler = start; -} - -void -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler end) { - endElementHandler = end; -} - -void -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler) -{ - characterDataHandler = handler; -} - -void -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler) -{ - processingInstructionHandler = handler; -} - -void -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler) -{ - commentHandler = handler; -} - -void -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end) -{ - startCdataSectionHandler = start; - endCdataSectionHandler = end; -} - -void -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start) { - startCdataSectionHandler = start; -} - -void -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end) { - endCdataSectionHandler = end; -} - -void -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_FALSE; -} - -void -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_TRUE; -} - -void -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end) -{ - startDoctypeDeclHandler = start; - endDoctypeDeclHandler = end; -} - -void -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start) { - startDoctypeDeclHandler = start; -} - -void -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end) { - endDoctypeDeclHandler = end; -} - -void -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler) -{ - unparsedEntityDeclHandler = handler; -} - -void -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler) -{ - notationDeclHandler = handler; -} - -void -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end) -{ - startNamespaceDeclHandler = start; - endNamespaceDeclHandler = end; -} - -void -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start) { - startNamespaceDeclHandler = start; -} - -void -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end) { - endNamespaceDeclHandler = end; -} - -void -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler) -{ - notStandaloneHandler = handler; -} - -void -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler) -{ - externalEntityRefHandler = handler; -} - -void -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) -{ - if (arg) - externalEntityRefHandlerArg = arg; - else - externalEntityRefHandlerArg = parser; -} - -void -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler) -{ - skippedEntityHandler = handler; -} - -void -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *data) -{ - unknownEncodingHandler = handler; - unknownEncodingHandlerData = data; -} - -void -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl) -{ - elementDeclHandler = eldecl; -} - -void -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl) -{ - attlistDeclHandler = attdecl; -} - -void -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler) -{ - entityDeclHandler = handler; -} - -void -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler handler) { - xmlDeclHandler = handler; -} - -int -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing peParsing) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (parsing) - return 0; -#ifdef XML_DTD - paramEntityParsing = peParsing; - return 1; -#else - return peParsing == XML_PARAM_ENTITY_PARSING_NEVER; -#endif -} - -enum XML_Status -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) -{ - if (len == 0) { - if (!isFinal) - return XML_STATUS_OK; - positionPtr = bufferPtr; - errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0); - if (errorCode == XML_ERROR_NONE) - return XML_STATUS_OK; - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } -#ifndef XML_CONTEXT_BYTES - else if (bufferPtr == bufferEnd) { - const char *end; - int nLeftOver; - parseEndByteIndex += len; - positionPtr = s; - if (isFinal) { - errorCode = processor(parser, s, parseEndPtr = s + len, 0); - if (errorCode == XML_ERROR_NONE) - return XML_STATUS_OK; - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - errorCode = processor(parser, s, parseEndPtr = s + len, &end); - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - XmlUpdatePosition(encoding, positionPtr, end, &position); - nLeftOver = s + len - end; - if (nLeftOver) { - if (buffer == NULL || nLeftOver > bufferLim - buffer) { - /* FIXME avoid integer overflow */ - char *temp; - temp = buffer == NULL ? MALLOC(len * 2) : REALLOC(buffer, len * 2); - if (temp == NULL) { - errorCode = XML_ERROR_NO_MEMORY; - return XML_STATUS_ERROR; - } - buffer = temp; - if (!buffer) { - errorCode = XML_ERROR_NO_MEMORY; - eventPtr = eventEndPtr = NULL; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - bufferLim = buffer + len * 2; - } - memcpy(buffer, end, nLeftOver); - bufferPtr = buffer; - bufferEnd = buffer + nLeftOver; - } - return XML_STATUS_OK; - } -#endif /* not defined XML_CONTEXT_BYTES */ - else { - void *buff = XML_GetBuffer(parser, len); - if (buff == NULL) - return XML_STATUS_ERROR; - else { - memcpy(buff, s, len); - return XML_ParseBuffer(parser, len, isFinal); - } - } -} - -enum XML_Status -XML_ParseBuffer(XML_Parser parser, int len, int isFinal) -{ - const char *start = bufferPtr; - positionPtr = start; - bufferEnd += len; - parseEndByteIndex += len; - errorCode = processor(parser, start, parseEndPtr = bufferEnd, - isFinal ? (const char **)NULL : &bufferPtr); - if (errorCode == XML_ERROR_NONE) { - if (!isFinal) - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - return XML_STATUS_OK; - } - else { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } -} - -void * -XML_GetBuffer(XML_Parser parser, int len) -{ - if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ - int neededSize = len + (bufferEnd - bufferPtr); -#ifdef XML_CONTEXT_BYTES - int keep = bufferPtr - buffer; - - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - neededSize += keep; -#endif /* defined XML_CONTEXT_BYTES */ - if (neededSize <= bufferLim - buffer) { -#ifdef XML_CONTEXT_BYTES - if (keep < bufferPtr - buffer) { - int offset = (bufferPtr - buffer) - keep; - memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep); - bufferEnd -= offset; - bufferPtr -= offset; - } -#else - memmove(buffer, bufferPtr, bufferEnd - bufferPtr); - bufferEnd = buffer + (bufferEnd - bufferPtr); - bufferPtr = buffer; -#endif /* not defined XML_CONTEXT_BYTES */ - } - else { - char *newBuf; - int bufferSize = bufferLim - bufferPtr; - if (bufferSize == 0) - bufferSize = INIT_BUFFER_SIZE; - do { - bufferSize *= 2; - } while (bufferSize < neededSize); - newBuf = MALLOC(bufferSize); - if (newBuf == 0) { - errorCode = XML_ERROR_NO_MEMORY; - return NULL; - } - bufferLim = newBuf + bufferSize; -#ifdef XML_CONTEXT_BYTES - if (bufferPtr) { - int keep = bufferPtr - buffer; - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep); - FREE(buffer); - buffer = newBuf; - bufferEnd = buffer + (bufferEnd - bufferPtr) + keep; - bufferPtr = buffer + keep; - } - else { - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; - } -#else - if (bufferPtr) { - memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); - FREE(buffer); - } - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; -#endif /* not defined XML_CONTEXT_BYTES */ - } - } - return bufferEnd; -} - -enum XML_Error -XML_GetErrorCode(XML_Parser parser) -{ - return errorCode; -} - -long -XML_GetCurrentByteIndex(XML_Parser parser) -{ - if (eventPtr) - return parseEndByteIndex - (parseEndPtr - eventPtr); - return -1; -} - -int -XML_GetCurrentByteCount(XML_Parser parser) -{ - if (eventEndPtr && eventPtr) - return eventEndPtr - eventPtr; - return 0; -} - -const char * -XML_GetInputContext(XML_Parser parser, int *offset, int *size) -{ -#ifdef XML_CONTEXT_BYTES - if (eventPtr && buffer) { - *offset = eventPtr - buffer; - *size = bufferEnd - buffer; - return buffer; - } -#endif /* defined XML_CONTEXT_BYTES */ - return (char *) 0; -} - -int -XML_GetCurrentLineNumber(XML_Parser parser) -{ - if (eventPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.lineNumber + 1; -} - -int -XML_GetCurrentColumnNumber(XML_Parser parser) -{ - if (eventPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.columnNumber; -} - -void -XML_DefaultCurrent(XML_Parser parser) -{ - if (defaultHandler) { - if (openInternalEntities) - reportDefault(parser, - internalEncoding, - openInternalEntities->internalEventPtr, - openInternalEntities->internalEventEndPtr); - else - reportDefault(parser, encoding, eventPtr, eventEndPtr); - } -} - -const XML_LChar * -XML_ErrorString(enum XML_Error code) -{ - static const XML_LChar *message[] = { - 0, - XML_L("out of memory"), - XML_L("syntax error"), - XML_L("no element found"), - XML_L("not well-formed (invalid token)"), - XML_L("unclosed token"), - XML_L("partial character"), - XML_L("mismatched tag"), - XML_L("duplicate attribute"), - XML_L("junk after document element"), - XML_L("illegal parameter entity reference"), - XML_L("undefined entity"), - XML_L("recursive entity reference"), - XML_L("asynchronous entity"), - XML_L("reference to invalid character number"), - XML_L("reference to binary entity"), - XML_L("reference to external entity in attribute"), - XML_L("xml declaration not at start of external entity"), - XML_L("unknown encoding"), - XML_L("encoding specified in XML declaration is incorrect"), - XML_L("unclosed CDATA section"), - XML_L("error in processing external entity reference"), - XML_L("document is not standalone"), - XML_L("unexpected parser state - please send a bug report"), - XML_L("entity declared in parameter entity"), - XML_L("requested feature requires XML_DTD support in Expat"), - XML_L("cannot change setting once parsing has begun") - }; - if (code > 0 && code < sizeof(message)/sizeof(message[0])) - return message[code]; - return NULL; -} - -const XML_LChar * -XML_ExpatVersion(void) { - return "1.95.5"; -} - -XML_Expat_Version -XML_ExpatVersionInfo(void) -{ - XML_Expat_Version version; - - version.major = XML_MAJOR_VERSION; - version.minor = XML_MINOR_VERSION; - version.micro = XML_MICRO_VERSION; - - return version; -} - -const XML_Feature * -XML_GetFeatureList(void) -{ - static XML_Feature features[] = { - {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)")}, - {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)")}, -#ifdef XML_UNICODE - {XML_FEATURE_UNICODE, XML_L("XML_UNICODE")}, -#endif -#ifdef XML_UNICODE_WCHAR_T - {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T")}, -#endif -#ifdef XML_DTD - {XML_FEATURE_DTD, XML_L("XML_DTD")}, -#endif -#ifdef XML_CONTEXT_BYTES - {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"), - XML_CONTEXT_BYTES}, -#endif -#ifdef XML_MIN_SIZE - {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE")}, -#endif - {XML_FEATURE_END, NULL} - }; - - features[0].value = sizeof(XML_Char); - features[1].value = sizeof(XML_LChar); - return features; -} - -/* Initially tag->rawName always points into the parse buffer; - for those TAG instances opened while the current parse buffer was - processed, and not yet closed, we need to store tag->rawName in a more - permanent location, since the parse buffer is about to be discarded. -*/ -static XML_Bool FASTCALL -storeRawNames(XML_Parser parser) -{ - TAG *tag = tagStack; - while (tag) { - int bufSize; - int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1); - char *rawNameBuf = tag->buf + nameLen; - /* Stop if already stored. Since tagStack is a stack, we can stop - at the first entry that has already been copied; everything - below it in the stack is already been accounted for in a - previous call to this function. - */ - if (tag->rawName == rawNameBuf) - break; - /* For re-use purposes we need to ensure that the - size of tag->buf is a multiple of sizeof(XML_Char). - */ - bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)); - if (bufSize > tag->bufEnd - tag->buf) { - char *temp = REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_FALSE; - tag->buf = temp; - tag->name.str = (XML_Char *)temp; - tag->bufEnd = temp + bufSize; - rawNameBuf = temp + nameLen; - } - memcpy(rawNameBuf, tag->rawName, tag->rawNameLength); - tag->rawName = rawNameBuf; - tag = tag->parent; - } - return XML_TRUE; -} - -static enum XML_Error FASTCALL -contentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = - doContent(parser, 0, encoding, start, end, endPtr); - if (result != XML_ERROR_NONE) - return result; - if (!storeRawNames(parser)) - return XML_ERROR_NO_MEMORY; - return result; -} - -static enum XML_Error FASTCALL -externalEntityInitProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = externalEntityInitProcessor2; - return externalEntityInitProcessor2(parser, start, end, endPtr); -} - -static enum XML_Error FASTCALL -externalEntityInitProcessor2(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - const char *next = start; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(encoding, start, end, &next); - switch (tok) { - case XML_TOK_BOM: - /* If we are at the end of the buffer, this would cause the next stage, - i.e. externalEntityInitProcessor3, to pass control directly to - doContent (by detecting XML_TOK_NONE) without processing any xml text - declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. - */ - if (next == end && endPtr) { - *endPtr = next; - return XML_ERROR_NONE; - } - start = next; - break; - case XML_TOK_PARTIAL: - if (endPtr) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (endPtr) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityInitProcessor3; - return externalEntityInitProcessor3(parser, start, end, endPtr); -} - -static enum XML_Error FASTCALL -externalEntityInitProcessor3(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - const char *next = start; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(encoding, start, end, &next); - switch (tok) { - case XML_TOK_XML_DECL: - { - enum XML_Error result = processXmlDecl(parser, 1, start, next); - if (result != XML_ERROR_NONE) - return result; - start = next; - } - break; - case XML_TOK_PARTIAL: - if (endPtr) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (endPtr) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityContentProcessor; - tagLevel = 1; - return externalEntityContentProcessor(parser, start, end, endPtr); -} - -static enum XML_Error FASTCALL -externalEntityContentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = - doContent(parser, 1, encoding, start, end, endPtr); - if (result != XML_ERROR_NONE) - return result; - if (!storeRawNames(parser)) - return XML_ERROR_NO_MEMORY; - return result; -} - -static enum XML_Error FASTCALL -doContent(XML_Parser parser, - int startTagLevel, - const ENCODING *enc, - const char *s, - const char *end, - const char **nextPtr) -{ - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - for (;;) { - const char *next = s; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_TRAILING_CR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - *eventEndPP = end; - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - if (startTagLevel == 0) - return XML_ERROR_NO_ELEMENTS; - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - return XML_ERROR_NONE; - case XML_TOK_NONE: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (startTagLevel > 0) { - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - return XML_ERROR_NONE; - } - return XML_ERROR_NO_ELEMENTS; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (characterDataHandler) - characterDataHandler(handlerArg, &ch, 1); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - name = poolStoreString(&dtd.pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); - poolDiscard(&dtd.pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity or default handler. - */ - if (!dtd.hasParamEntityRefs || dtd.standalone) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->notation) - return XML_ERROR_BINARY_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - OPEN_INTERNAL_ENTITY openEntity; - if (!defaultExpandInternalEntities) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, entity->name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - entity->open = XML_TRUE; - openEntity.next = openInternalEntities; - openInternalEntities = &openEntity; - openEntity.entity = entity; - openEntity.internalEventPtr = NULL; - openEntity.internalEventEndPtr = NULL; - result = doContent(parser, - tagLevel, - internalEncoding, - (char *)entity->textPtr, - (char *)(entity->textPtr + entity->textLen), - 0); - entity->open = XML_FALSE; - openInternalEntities = openEntity.next; - if (result) - return result; - } - else if (externalEntityRefHandler) { - const XML_Char *context; - entity->open = XML_TRUE; - context = getContext(parser); - entity->open = XML_FALSE; - if (!context) - return XML_ERROR_NO_MEMORY; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - context, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - poolDiscard(&tempPool); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - case XML_TOK_START_TAG_WITH_ATTS: - if (!startElementHandler) { - enum XML_Error result = storeAtts(parser, enc, s, 0, 0); - if (result) - return result; - } - /* fall through */ - case XML_TOK_START_TAG_NO_ATTS: - { - TAG *tag; - enum XML_Error result; - XML_Char *toPtr; - if (freeTagList) { - tag = freeTagList; - freeTagList = freeTagList->parent; - } - else { - tag = MALLOC(sizeof(TAG)); - if (!tag) - return XML_ERROR_NO_MEMORY; - tag->buf = MALLOC(INIT_TAG_BUF_SIZE); - if (!tag->buf) { - FREE(tag); - return XML_ERROR_NO_MEMORY; - } - tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; - } - tag->bindings = NULL; - tag->parent = tagStack; - tagStack = tag; - tag->name.localPart = NULL; - tag->name.prefix = NULL; - tag->rawName = s + enc->minBytesPerChar; - tag->rawNameLength = XmlNameLength(enc, tag->rawName); - ++tagLevel; - { - const char *rawNameEnd = tag->rawName + tag->rawNameLength; - const char *fromPtr = tag->rawName; - toPtr = (XML_Char *)tag->buf; - for (;;) { - int bufSize; - int convLen; - XmlConvert(enc, - &fromPtr, rawNameEnd, - (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); - convLen = toPtr - (XML_Char *)tag->buf; - if (fromPtr == rawNameEnd) { - tag->name.strLen = convLen; - break; - } - bufSize = (tag->bufEnd - tag->buf) << 1; - { - char *temp = REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - tag->buf = temp; - tag->bufEnd = temp + bufSize; - toPtr = (XML_Char *)temp + convLen; - } - } - } - tag->name.str = (XML_Char *)tag->buf; - *toPtr = XML_T('\0'); - if (startElementHandler) { - result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); - if (result) - return result; - startElementHandler(handlerArg, tag->name.str, - (const XML_Char **)atts); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - break; - } - case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: - if (!startElementHandler) { - enum XML_Error result = storeAtts(parser, enc, s, 0, 0); - if (result) - return result; - } - /* fall through */ - case XML_TOK_EMPTY_ELEMENT_NO_ATTS: - if (startElementHandler || endElementHandler) { - const char *rawName = s + enc->minBytesPerChar; - enum XML_Error result; - BINDING *bindings = NULL; - TAG_NAME name; - name.str = poolStoreString(&tempPool, enc, rawName, - rawName + XmlNameLength(enc, rawName)); - if (!name.str) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - result = storeAtts(parser, enc, s, &name, &bindings); - if (result) - return result; - poolFinish(&tempPool); - if (startElementHandler) - startElementHandler(handlerArg, name.str, (const XML_Char **)atts); - if (endElementHandler) { - if (startElementHandler) - *eventPP = *eventEndPP; - endElementHandler(handlerArg, name.str); - } - poolClear(&tempPool); - while (bindings) { - BINDING *b = bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - break; - case XML_TOK_END_TAG: - if (tagLevel == startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - else { - int len; - const char *rawName; - TAG *tag = tagStack; - tagStack = tag->parent; - tag->parent = freeTagList; - freeTagList = tag; - rawName = s + enc->minBytesPerChar*2; - len = XmlNameLength(enc, rawName); - if (len != tag->rawNameLength - || memcmp(tag->rawName, rawName, len) != 0) { - *eventPP = rawName; - return XML_ERROR_TAG_MISMATCH; - } - --tagLevel; - if (endElementHandler) { - const XML_Char *localPart; - const XML_Char *prefix; - XML_Char *uri; - localPart = tag->name.localPart; - if (ns && localPart) { - /* localPart and prefix may have been overwritten in - tag->name.str, since this points to the binding->uri - buffer which gets re-used; so we have to add them again - */ - uri = (XML_Char *)tag->name.str + tag->name.uriLen; - /* don't need to check for space - already done in storeAtts() */ - while (*localPart) *uri++ = *localPart++; - prefix = (XML_Char *)tag->name.prefix; - if (ns_triplets && prefix) { - *uri++ = namespaceSeparator; - while (*prefix) *uri++ = *prefix++; - } - *uri = XML_T('\0'); - } - endElementHandler(handlerArg, tag->name.str); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - while (tag->bindings) { - BINDING *b = tag->bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - tag->bindings = tag->bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - } - break; - case XML_TOK_CHAR_REF: - { - int n = XmlCharRefNumber(enc, s); - if (n < 0) - return XML_ERROR_BAD_CHAR_REF; - if (characterDataHandler) { - XML_Char buf[XML_ENCODE_MAX]; - characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_CDATA_SECT_OPEN: - { - enum XML_Error result; - if (startCdataSectionHandler) - startCdataSectionHandler(handlerArg); -#if 0 - /* Suppose you doing a transformation on a document that involves - changing only the character data. You set up a defaultHandler - and a characterDataHandler. The defaultHandler simply copies - characters through. The characterDataHandler does the - transformation and writes the characters out escaping them as - necessary. This case will fail to work if we leave out the - following two lines (because & and < inside CDATA sections will - be incorrectly escaped). - - However, now we have a start/endCdataSectionHandler, so it seems - easier to let the user deal with this. - */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - result = doCdataSection(parser, enc, &next, end, nextPtr); - if (!next) { - processor = cdataSectionProcessor; - return result; - } - } - break; - case XML_TOK_TRAILING_RSQB: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - characterDataHandler(handlerArg, dataBuf, - dataPtr - (ICHAR *)dataBuf); - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (XML_Char *)end - (XML_Char *)s); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - if (startTagLevel == 0) { - *eventPP = end; - return XML_ERROR_NO_ELEMENTS; - } - if (tagLevel != startTagLevel) { - *eventPP = end; - return XML_ERROR_ASYNC_ENTITY; - } - return XML_ERROR_NONE; - case XML_TOK_DATA_CHARS: - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - characterDataHandler(handlerArg, dataBuf, - dataPtr - (ICHAR *)dataBuf); - if (s == next) - break; - *eventPP = s; - } - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (XML_Char *)next - (XML_Char *)s); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - default: - if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - *eventPP = s = next; - } - /* not reached */ -} - -/* If tagNamePtr is non-null, build a real list of attributes, - otherwise just check the attributes for well-formedness. -*/ -static enum XML_Error FASTCALL -storeAtts(XML_Parser parser, const ENCODING *enc, - const char *attStr, TAG_NAME *tagNamePtr, - BINDING **bindingsPtr) -{ - ELEMENT_TYPE *elementType = NULL; - int nDefaultAtts = 0; - const XML_Char **appAtts; /* the attribute list for the application */ - int attIndex = 0; - int prefixLen; - int i; - int n; - XML_Char *uri; - int nPrefixes = 0; - BINDING *binding; - const XML_Char *localPart; - - /* lookup the element type name */ - if (tagNamePtr) { - elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str,0); - if (!elementType) { - tagNamePtr->str = poolCopyString(&dtd.pool, tagNamePtr->str); - if (!tagNamePtr->str) - return XML_ERROR_NO_MEMORY; - elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, - sizeof(ELEMENT_TYPE)); - if (!elementType) - return XML_ERROR_NO_MEMORY; - if (ns && !setElementTypePrefix(parser, elementType)) - return XML_ERROR_NO_MEMORY; - } - nDefaultAtts = elementType->nDefaultAtts; - } - /* get the attributes from the tokenizer */ - n = XmlGetAttributes(enc, attStr, attsSize, atts); - if (n + nDefaultAtts > attsSize) { - int oldAttsSize = attsSize; - ATTRIBUTE *temp; - attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; - temp = REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - atts = temp; - if (n > oldAttsSize) - XmlGetAttributes(enc, attStr, n, atts); - } - appAtts = (const XML_Char **)atts; - for (i = 0; i < n; i++) { - /* add the name and value to the attribute list */ - ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name, - atts[i].name - + XmlNameLength(enc, atts[i].name)); - if (!attId) - return XML_ERROR_NO_MEMORY; - /* detect duplicate attributes */ - if ((attId->name)[-1]) { - if (enc == encoding) - eventPtr = atts[i].name; - return XML_ERROR_DUPLICATE_ATTRIBUTE; - } - (attId->name)[-1] = 1; - appAtts[attIndex++] = attId->name; - if (!atts[i].normalized) { - enum XML_Error result; - XML_Bool isCdata = XML_TRUE; - - /* figure out whether declared as other than CDATA */ - if (attId->maybeTokenized) { - int j; - for (j = 0; j < nDefaultAtts; j++) { - if (attId == elementType->defaultAtts[j].id) { - isCdata = elementType->defaultAtts[j].isCdata; - break; - } - } - } - - /* normalize the attribute value */ - result = storeAttributeValue(parser, enc, isCdata, - atts[i].valuePtr, atts[i].valueEnd, - &tempPool); - if (result) - return result; - if (tagNamePtr) { - appAtts[attIndex] = poolStart(&tempPool); - poolFinish(&tempPool); - } - else - poolDiscard(&tempPool); - } - else if (tagNamePtr) { - /* the value did not need normalizing */ - appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, - atts[i].valueEnd); - if (appAtts[attIndex] == 0) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - } - /* handle prefixed attribute names */ - if (attId->prefix && tagNamePtr) { - if (attId->xmlns) { - /* deal with namespace declarations here */ - if (!addBinding(parser, attId->prefix, attId, appAtts[attIndex], - bindingsPtr)) - return XML_ERROR_NO_MEMORY; - --attIndex; - } - else { - /* deal with other prefixed names later */ - attIndex++; - nPrefixes++; - (attId->name)[-1] = 2; - } - } - else - attIndex++; - } - if (tagNamePtr) { - int j; - nSpecifiedAtts = attIndex; - if (elementType->idAtt && (elementType->idAtt->name)[-1]) { - for (i = 0; i < attIndex; i += 2) - if (appAtts[i] == elementType->idAtt->name) { - idAttIndex = i; - break; - } - } - else - idAttIndex = -1; - /* do attribute defaulting */ - for (j = 0; j < nDefaultAtts; j++) { - const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + j; - if (!(da->id->name)[-1] && da->value) { - if (da->id->prefix) { - if (da->id->xmlns) { - if (!addBinding(parser, da->id->prefix, da->id, da->value, - bindingsPtr)) - return XML_ERROR_NO_MEMORY; - } - else { - (da->id->name)[-1] = 2; - nPrefixes++; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - else { - (da->id->name)[-1] = 1; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - } - appAtts[attIndex] = 0; - } - i = 0; - if (nPrefixes) { - /* expand prefixed attribute names */ - for (; i < attIndex; i += 2) { - if (appAtts[i][-1] == 2) { - ATTRIBUTE_ID *id; - ((XML_Char *)(appAtts[i]))[-1] = 0; - id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0); - if (id->prefix->binding) { - int j; - const BINDING *b = id->prefix->binding; - const XML_Char *s = appAtts[i]; - for (j = 0; j < b->uriLen; j++) { - if (!poolAppendChar(&tempPool, b->uri[j])) - return XML_ERROR_NO_MEMORY; - } - while (*s++ != XML_T(':')) - ; - do { - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - } while (*s++); - if (ns_triplets) { - tempPool.ptr[-1] = namespaceSeparator; - s = b->prefix->name; - do { - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - } while (*s++); - } - - appAtts[i] = poolStart(&tempPool); - poolFinish(&tempPool); - } - if (!--nPrefixes) - break; - } - else - ((XML_Char *)(appAtts[i]))[-1] = 0; - } - } - /* clear the flags that say whether attributes were specified */ - for (; i < attIndex; i += 2) - ((XML_Char *)(appAtts[i]))[-1] = 0; - if (!tagNamePtr) - return XML_ERROR_NONE; - for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) - binding->attId->name[-1] = 0; - /* expand the element type name */ - if (elementType->prefix) { - binding = elementType->prefix->binding; - if (!binding) - return XML_ERROR_NONE; - localPart = tagNamePtr->str; - while (*localPart++ != XML_T(':')) - ; - } - else if (dtd.defaultPrefix.binding) { - binding = dtd.defaultPrefix.binding; - localPart = tagNamePtr->str; - } - else - return XML_ERROR_NONE; - prefixLen = 0; - if (ns && ns_triplets && binding->prefix->name) { - for (; binding->prefix->name[prefixLen++];) - ; - } - tagNamePtr->localPart = localPart; - tagNamePtr->uriLen = binding->uriLen; - tagNamePtr->prefix = binding->prefix->name; - tagNamePtr->prefixLen = prefixLen; - for (i = 0; localPart[i++];) - ; - n = i + binding->uriLen + prefixLen; - if (n > binding->uriAlloc) { - TAG *p; - uri = MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char)); - if (!uri) - return XML_ERROR_NO_MEMORY; - binding->uriAlloc = n + EXPAND_SPARE; - memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char)); - for (p = tagStack; p; p = p->parent) - if (p->name.str == binding->uri) - p->name.str = uri; - FREE(binding->uri); - binding->uri = uri; - } - uri = binding->uri + binding->uriLen; - memcpy(uri, localPart, i * sizeof(XML_Char)); - if (prefixLen) { - uri = uri + (i - 1); - if (namespaceSeparator) { *(uri) = namespaceSeparator; } - memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char)); - } - tagNamePtr->str = binding->uri; - return XML_ERROR_NONE; -} - -static int FASTCALL -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr) -{ - BINDING *b; - int len; - for (len = 0; uri[len]; len++) - ; - if (namespaceSeparator) - len++; - if (freeBindingList) { - b = freeBindingList; - if (len > b->uriAlloc) { - XML_Char *temp = REALLOC(b->uri, - sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (temp == NULL) - return 0; - b->uri = temp; - b->uriAlloc = len + EXPAND_SPARE; - } - freeBindingList = b->nextTagBinding; - } - else { - b = MALLOC(sizeof(BINDING)); - if (!b) - return 0; - b->uri = MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (!b->uri) { - FREE(b); - return 0; - } - b->uriAlloc = len + EXPAND_SPARE; - } - b->uriLen = len; - memcpy(b->uri, uri, len * sizeof(XML_Char)); - if (namespaceSeparator) - b->uri[len - 1] = namespaceSeparator; - b->prefix = prefix; - b->attId = attId; - b->prevPrefixBinding = prefix->binding; - if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix) - prefix->binding = NULL; - else - prefix->binding = b; - b->nextTagBinding = *bindingsPtr; - *bindingsPtr = b; - if (startNamespaceDeclHandler) - startNamespaceDeclHandler(handlerArg, prefix->name, - prefix->binding ? uri : 0); - return 1; -} - -/* The idea here is to avoid using stack for each CDATA section when - the whole file is parsed with one call. -*/ -static enum XML_Error FASTCALL -cdataSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doCdataSection(parser, encoding, &start, - end, endPtr); - if (start) { - if (parentParser) { /* we are parsing an external entity */ - processor = externalEntityContentProcessor; - return externalEntityContentProcessor(parser, start, end, endPtr); - } - else { - processor = contentProcessor; - return contentProcessor(parser, start, end, endPtr); - } - } - return result; -} - -/* startPtr gets set to non-null is the section is closed, and to null if - the section is not yet closed. -*/ -static enum XML_Error FASTCALL -doCdataSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr) -{ - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = NULL; - for (;;) { - const char *next; - int tok = XmlCdataSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_CDATA_SECT_CLOSE: - if (endCdataSectionHandler) - endCdataSectionHandler(handlerArg); -#if 0 - /* see comment under XML_TOK_CDATA_SECT_OPEN */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - return XML_ERROR_NONE; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_DATA_CHARS: - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = next; - characterDataHandler(handlerArg, dataBuf, - dataPtr - (ICHAR *)dataBuf); - if (s == next) - break; - *eventPP = s; - } - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (XML_Char *)next - (XML_Char *)s); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_CDATA_SECTION; - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - *eventPP = s = next; - } - /* not reached */ -} - -#ifdef XML_DTD - -/* The idea here is to avoid using stack for each IGNORE section when - the whole file is parsed with one call. -*/ -static enum XML_Error FASTCALL -ignoreSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doIgnoreSection(parser, encoding, &start, - end, endPtr); - if (start) { - processor = prologProcessor; - return prologProcessor(parser, start, end, endPtr); - } - return result; -} - -/* startPtr gets set to non-null is the section is closed, and to null - if the section is not yet closed. -*/ -static enum XML_Error FASTCALL -doIgnoreSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr) -{ - const char *next; - int tok; - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = NULL; - tok = XmlIgnoreSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_IGNORE_SECT: - if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - return XML_ERROR_NONE; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - /* not reached */ -} - -#endif /* XML_DTD */ - -static enum XML_Error FASTCALL -initializeEncoding(XML_Parser parser) -{ - const char *s; -#ifdef XML_UNICODE - char encodingBuf[128]; - if (!protocolEncodingName) - s = NULL; - else { - int i; - for (i = 0; protocolEncodingName[i]; i++) { - if (i == sizeof(encodingBuf) - 1 - || (protocolEncodingName[i] & ~0x7f) != 0) { - encodingBuf[0] = '\0'; - break; - } - encodingBuf[i] = (char)protocolEncodingName[i]; - } - encodingBuf[i] = '\0'; - s = encodingBuf; - } -#else - s = protocolEncodingName; -#endif - if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) - return XML_ERROR_NONE; - return handleUnknownEncoding(parser, protocolEncodingName); -} - -static enum XML_Error FASTCALL -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next) -{ - const char *encodingName = NULL; - const XML_Char *storedEncName = NULL; - const ENCODING *newEncoding = NULL; - const char *version = NULL; - const char *versionend; - const XML_Char *storedversion = NULL; - int standalone = -1; - if (!(ns - ? XmlParseXmlDeclNS - : XmlParseXmlDecl)(isGeneralTextEntity, - encoding, - s, - next, - &eventPtr, - &version, - &versionend, - &encodingName, - &newEncoding, - &standalone)) - return XML_ERROR_SYNTAX; - if (!isGeneralTextEntity && standalone == 1) { - dtd.standalone = XML_TRUE; -#ifdef XML_DTD - if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif /* XML_DTD */ - } - if (xmlDeclHandler) { - if (encodingName != NULL) { - storedEncName = poolStoreString(&temp2Pool, - encoding, - encodingName, - encodingName - + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - poolFinish(&temp2Pool); - } - if (version) { - storedversion = poolStoreString(&temp2Pool, - encoding, - version, - versionend - encoding->minBytesPerChar); - if (!storedversion) - return XML_ERROR_NO_MEMORY; - } - xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone); - } - else if (defaultHandler) - reportDefault(parser, encoding, s, next); - if (protocolEncodingName == NULL) { - if (newEncoding) { - if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { - eventPtr = encodingName; - return XML_ERROR_INCORRECT_ENCODING; - } - encoding = newEncoding; - } - else if (encodingName) { - enum XML_Error result; - if (!storedEncName) { - storedEncName = poolStoreString( - &temp2Pool, encoding, encodingName, - encodingName + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - } - result = handleUnknownEncoding(parser, storedEncName); - poolClear(&temp2Pool); - if (result == XML_ERROR_UNKNOWN_ENCODING) - eventPtr = encodingName; - return result; - } - } - - if (storedEncName || storedversion) - poolClear(&temp2Pool); - - return XML_ERROR_NONE; -} - -static enum XML_Error FASTCALL -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - if (unknownEncodingHandler) { - XML_Encoding info; - int i; - for (i = 0; i < 256; i++) - info.map[i] = -1; - info.convert = NULL; - info.data = NULL; - info.release = NULL; - if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, - &info)) { - ENCODING *enc; - unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding()); - if (!unknownEncodingMem) { - if (info.release) - info.release(info.data); - return XML_ERROR_NO_MEMORY; - } - enc = (ns - ? XmlInitUnknownEncodingNS - : XmlInitUnknownEncoding)(unknownEncodingMem, - info.map, - info.convert, - info.data); - if (enc) { - unknownEncodingData = info.data; - unknownEncodingRelease = info.release; - encoding = enc; - return XML_ERROR_NONE; - } - } - if (info.release != NULL) - info.release(info.data); - } - return XML_ERROR_UNKNOWN_ENCODING; -} - -static enum XML_Error FASTCALL -prologInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = prologProcessor; - return prologProcessor(parser, s, end, nextPtr); -} - -#ifdef XML_DTD - -static enum XML_Error FASTCALL -externalParEntInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - - /* we know now that XML_Parse(Buffer) has been called, - so we consider the external parameter entity read */ - dtd.paramEntityRead = XML_TRUE; - - if (prologState.inEntityValue) { - processor = entityValueInitProcessor; - return entityValueInitProcessor(parser, s, end, nextPtr); - } - else { - processor = externalParEntProcessor; - return externalParEntProcessor(parser, s, end, nextPtr); - } -} - -static enum XML_Error FASTCALL -entityValueInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *start = s; - const char *next = s; - int tok; - - for (;;) { - tok = XmlPrologTok(encoding, start, end, &next); - if (tok <= 0) { - if (nextPtr != 0 && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - return storeEntityValue(parser, encoding, s, end); - } - else if (tok == XML_TOK_XML_DECL) { - enum XML_Error result = processXmlDecl(parser, 0, start, next); - if (result != XML_ERROR_NONE) - return result; - if (nextPtr) *nextPtr = next; - /* stop scanning for text declaration - we found one */ - processor = entityValueProcessor; - return entityValueProcessor(parser, next, end, nextPtr); - } - /* If we are at the end of the buffer, this would cause XmlPrologTok to - return XML_TOK_NONE on the next call, which would then cause the - function to exit with *nextPtr set to s - that is what we want for other - tokens, but not for the BOM - we would rather like to skip it; - then, when this routine is entered the next time, XmlPrologTok will - return XML_TOK_INVALID, since the BOM is still in the buffer - */ - else if (tok == XML_TOK_BOM && next == end && nextPtr) { - *nextPtr = next; - return XML_ERROR_NONE; - } - start = next; - } -} - -static enum XML_Error FASTCALL -externalParEntProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *start = s; - const char *next = s; - int tok; - - tok = XmlPrologTok(encoding, start, end, &next); - if (tok <= 0) { - if (nextPtr != 0 && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - } - /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM. - However, when parsing an external subset, doProlog will not accept a BOM - as valid, and report a syntax error, so we have to skip the BOM - */ - else if (tok == XML_TOK_BOM) { - s = next; - tok = XmlPrologTok(encoding, s, end, &next); - } - - processor = prologProcessor; - return doProlog(parser, encoding, s, end, tok, next, nextPtr); -} - -static enum XML_Error FASTCALL -entityValueProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *start = s; - const char *next = s; - const ENCODING *enc = encoding; - int tok; - - for (;;) { - tok = XmlPrologTok(enc, start, end, &next); - if (tok <= 0) { - if (nextPtr != 0 && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - return storeEntityValue(parser, enc, s, end); - } - start = next; - } -} - -#endif /* XML_DTD */ - -static enum XML_Error FASTCALL -prologProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *next = s; - int tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, nextPtr); -} - -static enum XML_Error FASTCALL -doProlog(XML_Parser parser, - const ENCODING *enc, - const char *s, - const char *end, - int tok, - const char *next, - const char **nextPtr) -{ -#ifdef XML_DTD - static const XML_Char externalSubsetName[] = { '#' , '\0' }; -#endif /* XML_DTD */ - static const XML_Char atypeCDATA[] = { 'C', 'D', 'A', 'T', 'A', '\0' }; - static const XML_Char atypeID[] = { 'I', 'D', '\0' }; - static const XML_Char atypeIDREF[] = { 'I', 'D', 'R', 'E', 'F', '\0' }; - static const XML_Char atypeIDREFS[] = { 'I', 'D', 'R', 'E', 'F', 'S', '\0' }; - static const XML_Char atypeENTITY[] = { 'E', 'N', 'T', 'I', 'T', 'Y', '\0' }; - static const XML_Char atypeENTITIES[] = - { 'E', 'N', 'T', 'I', 'T', 'I', 'E', 'S', '\0' }; - static const XML_Char atypeNMTOKEN[] = { - 'N', 'M', 'T', 'O', 'K', 'E', 'N', '\0' }; - static const XML_Char atypeNMTOKENS[] = { - 'N', 'M', 'T', 'O', 'K', 'E', 'N', 'S', '\0' }; - static const XML_Char notationPrefix[] = { - 'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N', '(', '\0' }; - static const XML_Char enumValueSep[] = { '|', '\0' }; - static const XML_Char enumValueStart[] = { '(', '\0' }; - - const char **eventPP; - const char **eventEndPP; - enum XML_Content_Quant quant; - - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - for (;;) { - int role; - XML_Bool handleDefault = XML_TRUE; - *eventPP = s; - *eventEndPP = next; - if (tok <= 0) { - if (nextPtr != 0 && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: -#ifdef XML_DTD - if (enc != encoding) - return XML_ERROR_NONE; - if (isParamEntity) { - if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) - == XML_ROLE_ERROR) - return XML_ERROR_SYNTAX; - return XML_ERROR_NONE; - } -#endif /* XML_DTD */ - return XML_ERROR_NO_ELEMENTS; - default: - tok = -tok; - next = end; - break; - } - } - role = XmlTokenRole(&prologState, tok, s, next, enc); - switch (role) { - case XML_ROLE_XML_DECL: - { - enum XML_Error result = processXmlDecl(parser, 0, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_DOCTYPE_NAME: - if (startDoctypeDeclHandler) { - doctypeName = poolStoreString(&tempPool, enc, s, next); - if (!doctypeName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - doctypePubid = NULL; - handleDefault = XML_FALSE; - } - doctypeSysid = NULL; /* always initialize to NULL */ - break; - case XML_ROLE_DOCTYPE_INTERNAL_SUBSET: - if (startDoctypeDeclHandler) { - startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, - doctypePubid, 1); - doctypeName = NULL; - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - break; -#ifdef XML_DTD - case XML_ROLE_TEXT_DECL: - { - enum XML_Error result = processXmlDecl(parser, 1, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; -#endif /* XML_DTD */ - case XML_ROLE_DOCTYPE_PUBLIC_ID: -#ifdef XML_DTD - useForeignDTD = XML_FALSE; -#endif /* XML_DTD */ - dtd.hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - doctypePubid = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!doctypePubid) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } -#ifdef XML_DTD - declEntity = (ENTITY *)lookup(&dtd.paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; -#endif /* XML_DTD */ - /* fall through */ - case XML_ROLE_ENTITY_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; - if (dtd.keepProcessing && declEntity) { - XML_Char *tem = poolStoreString(&dtd.pool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declEntity->publicId = tem; - poolFinish(&dtd.pool); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_DOCTYPE_CLOSE: - if (doctypeName) { - startDoctypeDeclHandler(handlerArg, doctypeName, - doctypeSysid, doctypePubid, 0); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - /* doctypeSysid will be non-NULL in the case of a previous - XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler - was not set, indicating an external subset - */ -#ifdef XML_DTD - if (doctypeSysid || useForeignDTD) { - dtd.hasParamEntityRefs = XML_TRUE; /* when docTypeSysid == NULL */ - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - if (useForeignDTD) - entity->base = curBase; - dtd.paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - if (dtd.paramEntityRead && - !dtd.standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - /* end of DTD - no need to update dtd.keepProcessing */ - } - useForeignDTD = XML_FALSE; - } -#endif /* XML_DTD */ - if (endDoctypeDeclHandler) { - endDoctypeDeclHandler(handlerArg); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_INSTANCE_START: -#ifdef XML_DTD - /* if there is no DOCTYPE declaration then now is the - last chance to read the foreign DTD - */ - if (useForeignDTD) { - dtd.hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - entity->base = curBase; - dtd.paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - if (dtd.paramEntityRead && - !dtd.standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - /* end of DTD - no need to update dtd.keepProcessing */ - } - } -#endif /* XML_DTD */ - processor = contentProcessor; - return contentProcessor(parser, s, end, nextPtr); - case XML_ROLE_ATTLIST_ELEMENT_NAME: - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_NAME: - declAttributeId = getAttributeId(parser, enc, s, next); - if (!declAttributeId) - return XML_ERROR_NO_MEMORY; - declAttributeIsCdata = XML_FALSE; - declAttributeType = NULL; - declAttributeIsId = XML_FALSE; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_CDATA: - declAttributeIsCdata = XML_TRUE; - declAttributeType = atypeCDATA; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ID: - declAttributeIsId = XML_TRUE; - declAttributeType = atypeID; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_IDREF: - declAttributeType = atypeIDREF; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_IDREFS: - declAttributeType = atypeIDREFS; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITY: - declAttributeType = atypeENTITY; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES: - declAttributeType = atypeENTITIES; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN: - declAttributeType = atypeNMTOKEN; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS: - declAttributeType = atypeNMTOKENS; - checkAttListDeclHandler: - if (dtd.keepProcessing && attlistDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ATTRIBUTE_ENUM_VALUE: - case XML_ROLE_ATTRIBUTE_NOTATION_VALUE: - if (dtd.keepProcessing && attlistDeclHandler) { - const XML_Char *prefix; - if (declAttributeType) { - prefix = enumValueSep; - } - else { - prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE - ? notationPrefix - : enumValueStart); - } - if (!poolAppendString(&tempPool, prefix)) - return XML_ERROR_NO_MEMORY; - if (!poolAppend(&tempPool, enc, s, next)) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: - case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: - if (dtd.keepProcessing) { - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, declAttributeIsId, 0, - parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T('(') - || (*declAttributeType == XML_T('N') - && declAttributeType[1] == XML_T('O'))) { - /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(')')) - || !poolAppendChar(&tempPool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: - case XML_ROLE_FIXED_ATTRIBUTE_VALUE: - if (dtd.keepProcessing) { - const XML_Char *attVal; - enum XML_Error result - = storeAttributeValue(parser, enc, declAttributeIsCdata, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar, - &dtd.pool); - if (result) - return result; - attVal = poolStart(&dtd.pool); - poolFinish(&dtd.pool); - /* ID attributes aren't allowed to have a default */ - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, XML_FALSE, attVal, parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T('(') - || (*declAttributeType == XML_T('N') - && declAttributeType[1] == XML_T('O'))) { - /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(')')) - || !poolAppendChar(&tempPool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - attVal, - role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_ENTITY_VALUE: - if (dtd.keepProcessing) { - enum XML_Error result = storeEntityValue(parser, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (declEntity) { - declEntity->textPtr = poolStart(&dtd.entityValuePool); - declEntity->textLen = poolLength(&dtd.entityValuePool); - poolFinish(&dtd.entityValuePool); - if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - declEntity->textPtr, - declEntity->textLen, - curBase, 0, 0, 0); - handleDefault = XML_FALSE; - } - } - else - poolDiscard(&dtd.entityValuePool); - if (result != XML_ERROR_NONE) - return result; - } - break; - case XML_ROLE_DOCTYPE_SYSTEM_ID: -#ifdef XML_DTD - useForeignDTD = XML_FALSE; -#endif /* XML_DTD */ - dtd.hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - doctypeSysid = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (doctypeSysid == NULL) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } -#ifdef XML_DTD - else - /* use externalSubsetName to make doctypeSysid non-NULL - for the case where no startDoctypeDeclHandler is set */ - doctypeSysid = externalSubsetName; -#endif /* XML_DTD */ - if (!dtd.standalone -#ifdef XML_DTD - && !paramEntityParsing -#endif /* XML_DTD */ - && notStandaloneHandler - && !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; -#ifndef XML_DTD - break; -#else /* XML_DTD */ - if (!declEntity) { - declEntity = (ENTITY *)lookup(&dtd.paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - declEntity->publicId = NULL; - } - /* fall through */ -#endif /* XML_DTD */ - case XML_ROLE_ENTITY_SYSTEM_ID: - if (dtd.keepProcessing && declEntity) { - declEntity->systemId = poolStoreString(&dtd.pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!declEntity->systemId) - return XML_ERROR_NO_MEMORY; - declEntity->base = curBase; - poolFinish(&dtd.pool); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_ENTITY_COMPLETE: - if (dtd.keepProcessing && declEntity && entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - 0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - 0); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_ENTITY_NOTATION_NAME: - if (dtd.keepProcessing && declEntity) { - declEntity->notation = poolStoreString(&dtd.pool, enc, s, next); - if (!declEntity->notation) - return XML_ERROR_NO_MEMORY; - poolFinish(&dtd.pool); - if (unparsedEntityDeclHandler) { - *eventEndPP = s; - unparsedEntityDeclHandler(handlerArg, - declEntity->name, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - handleDefault = XML_FALSE; - } - else if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - 0,0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_GENERAL_ENTITY_NAME: - { - if (XmlPredefinedEntityName(enc, s, next)) { - declEntity = NULL; - break; - } - if (dtd.keepProcessing) { - const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(&dtd.generalEntities, name, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd.pool); - declEntity = NULL; - } - else { - poolFinish(&dtd.pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_FALSE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { - poolDiscard(&dtd.pool); - declEntity = NULL; - } - } - break; - case XML_ROLE_PARAM_ENTITY_NAME: -#ifdef XML_DTD - if (dtd.keepProcessing) { - const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(&dtd.paramEntities, - name, sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd.pool); - declEntity = NULL; - } - else { - poolFinish(&dtd.pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_TRUE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { - poolDiscard(&dtd.pool); - declEntity = NULL; - } -#else /* not XML_DTD */ - declEntity = NULL; -#endif /* XML_DTD */ - break; - case XML_ROLE_NOTATION_NAME: - declNotationPublicId = NULL; - declNotationName = NULL; - if (notationDeclHandler) { - declNotationName = poolStoreString(&tempPool, enc, s, next); - if (!declNotationName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_NOTATION_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; - if (declNotationName) { /* means notationDeclHandler != NULL */ - XML_Char *tem = poolStoreString(&tempPool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declNotationPublicId = tem; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_NOTATION_SYSTEM_ID: - if (declNotationName && notationDeclHandler) { - const XML_Char *systemId - = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!systemId) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - systemId, - declNotationPublicId); - handleDefault = XML_FALSE; - } - poolClear(&tempPool); - break; - case XML_ROLE_NOTATION_NO_SYSTEM_ID: - if (declNotationPublicId && notationDeclHandler) { - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - 0, - declNotationPublicId); - handleDefault = XML_FALSE; - } - poolClear(&tempPool); - break; - case XML_ROLE_ERROR: - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: - return XML_ERROR_PARAM_ENTITY_REF; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - default: - return XML_ERROR_SYNTAX; - } -#ifdef XML_DTD - case XML_ROLE_IGNORE_SECT: - { - enum XML_Error result; - if (defaultHandler) - reportDefault(parser, enc, s, next); - handleDefault = XML_FALSE; - result = doIgnoreSection(parser, enc, &next, end, nextPtr); - if (!next) { - processor = ignoreSectionProcessor; - return result; - } - } - break; -#endif /* XML_DTD */ - case XML_ROLE_GROUP_OPEN: - if (prologState.level >= groupSize) { - if (groupSize) { - char *temp = REALLOC(groupConnector, groupSize *= 2); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - groupConnector = temp; - if (dtd.scaffIndex) { - int *temp = REALLOC(dtd.scaffIndex, groupSize * sizeof(int)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - dtd.scaffIndex = temp; - } - } - else { - groupConnector = MALLOC(groupSize = 32); - if (!groupConnector) - return XML_ERROR_NO_MEMORY; - } - } - groupConnector[prologState.level] = 0; - if (dtd.in_eldecl) { - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd.scaffIndex[dtd.scaffLevel] = myindex; - dtd.scaffLevel++; - dtd.scaffold[myindex].type = XML_CTYPE_SEQ; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_GROUP_SEQUENCE: - if (groupConnector[prologState.level] == '|') - return XML_ERROR_SYNTAX; - groupConnector[prologState.level] = ','; - if (dtd.in_eldecl && elementDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_GROUP_CHOICE: - if (groupConnector[prologState.level] == ',') - return XML_ERROR_SYNTAX; - if (dtd.in_eldecl - && !groupConnector[prologState.level] - && (dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type - != XML_CTYPE_MIXED) - ) { - dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type - = XML_CTYPE_CHOICE; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - groupConnector[prologState.level] = '|'; - break; - case XML_ROLE_PARAM_ENTITY_REF: -#ifdef XML_DTD - case XML_ROLE_INNER_PARAM_ENTITY_REF: - /* PE references in internal subset are - not allowed within declarations */ - if (prologState.documentEntity && - role == XML_ROLE_INNER_PARAM_ENTITY_REF) - return XML_ERROR_PARAM_ENTITY_REF; - dtd.hasParamEntityRefs = XML_TRUE; - if (!paramEntityParsing) - dtd.keepProcessing = dtd.standalone; - else { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&dtd.pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0); - poolDiscard(&dtd.pool); - /* first, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity handler - */ - if (prologState.documentEntity && - (dtd.standalone - ? !openInternalEntities - : !dtd.hasParamEntityRefs)) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - dtd.keepProcessing = dtd.standalone; - /* cannot report skipped entities in declarations */ - if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) { - skippedEntityHandler(handlerArg, name, 1); - handleDefault = XML_FALSE; - } - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - result = processInternalParamEntity(parser, entity); - if (result != XML_ERROR_NONE) - return result; - handleDefault = XML_FALSE; - break; - } - if (externalEntityRefHandler) { - dtd.paramEntityRead = XML_FALSE; - entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = XML_FALSE; - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - } - entity->open = XML_FALSE; - handleDefault = XML_FALSE; - if (!dtd.paramEntityRead) { - dtd.keepProcessing = dtd.standalone; - break; - } - } - else { - dtd.keepProcessing = dtd.standalone; - break; - } - } -#endif /* XML_DTD */ - if (!dtd.standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - break; - - /* Element declaration stuff */ - - case XML_ROLE_ELEMENT_NAME: - if (elementDeclHandler) { - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - dtd.scaffLevel = 0; - dtd.scaffCount = 0; - dtd.in_eldecl = XML_TRUE; - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_ANY: - case XML_ROLE_CONTENT_EMPTY: - if (dtd.in_eldecl) { - if (elementDeclHandler) { - XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content)); - if (!content) - return XML_ERROR_NO_MEMORY; - content->quant = XML_CQUANT_NONE; - content->name = NULL; - content->numchildren = 0; - content->children = NULL; - content->type = ((role == XML_ROLE_CONTENT_ANY) ? - XML_CTYPE_ANY : - XML_CTYPE_EMPTY); - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, content); - handleDefault = XML_FALSE; - } - dtd.in_eldecl = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_PCDATA: - if (dtd.in_eldecl) { - dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type - = XML_CTYPE_MIXED; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_ELEMENT: - quant = XML_CQUANT_NONE; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_OPT: - quant = XML_CQUANT_OPT; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_REP: - quant = XML_CQUANT_REP; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_PLUS: - quant = XML_CQUANT_PLUS; - elementContent: - if (dtd.in_eldecl) { - ELEMENT_TYPE *el; - const XML_Char *name; - int nameLen; - const char *nxt = (quant == XML_CQUANT_NONE - ? next - : next - enc->minBytesPerChar); - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd.scaffold[myindex].type = XML_CTYPE_NAME; - dtd.scaffold[myindex].quant = quant; - el = getElementType(parser, enc, s, nxt); - if (!el) - return XML_ERROR_NO_MEMORY; - name = el->name; - dtd.scaffold[myindex].name = name; - nameLen = 0; - for (; name[nameLen++]; ); - dtd.contentStringLen += nameLen; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_GROUP_CLOSE: - quant = XML_CQUANT_NONE; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_OPT: - quant = XML_CQUANT_OPT; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_REP: - quant = XML_CQUANT_REP; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_PLUS: - quant = XML_CQUANT_PLUS; - closeGroup: - if (dtd.in_eldecl) { - if (elementDeclHandler) - handleDefault = XML_FALSE; - dtd.scaffLevel--; - dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel]].quant = quant; - if (dtd.scaffLevel == 0) { - if (!handleDefault) { - XML_Content *model = build_model(parser); - if (!model) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, model); - } - dtd.in_eldecl = XML_FALSE; - dtd.contentStringLen = 0; - } - } - break; - /* End element declaration stuff */ - - case XML_ROLE_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - handleDefault = XML_FALSE; - break; - case XML_ROLE_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - handleDefault = XML_FALSE; - break; - case XML_ROLE_NONE: - switch (tok) { - case XML_TOK_BOM: - handleDefault = XML_FALSE; - break; - } - break; - case XML_ROLE_DOCTYPE_NONE: - if (startDoctypeDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ENTITY_NONE: - if (dtd.keepProcessing && entityDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_NOTATION_NONE: - if (notationDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ATTLIST_NONE: - if (dtd.keepProcessing && attlistDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ELEMENT_NONE: - if (elementDeclHandler) - handleDefault = XML_FALSE; - break; - } /* end of big switch */ - - if (handleDefault && defaultHandler) - reportDefault(parser, enc, s, next); - - s = next; - tok = XmlPrologTok(enc, s, end, &next); - } - /* not reached */ -} - -static enum XML_Error FASTCALL -epilogProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - processor = epilogProcessor; - eventPtr = s; - for (;;) { - const char *next = NULL; - int tok = XmlPrologTok(encoding, s, end, &next); - eventEndPtr = next; - switch (tok) { - /* report partial linebreak - it might be the last token */ - case -XML_TOK_PROLOG_S: - if (defaultHandler) { - eventEndPtr = next; - reportDefault(parser, encoding, s, next); - } - if (nextPtr) - *nextPtr = next; - return XML_ERROR_NONE; - case XML_TOK_NONE: - if (nextPtr) - *nextPtr = s; - return XML_ERROR_NONE; - case XML_TOK_PROLOG_S: - if (defaultHandler) - reportDefault(parser, encoding, s, next); - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_INVALID: - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - default: - return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; - } - eventPtr = s = next; - } -} - -#ifdef XML_DTD - -static enum XML_Error FASTCALL -processInternalParamEntity(XML_Parser parser, ENTITY *entity) -{ - const char *s, *end, *next; - int tok; - enum XML_Error result; - OPEN_INTERNAL_ENTITY openEntity; - entity->open = XML_TRUE; - openEntity.next = openInternalEntities; - openInternalEntities = &openEntity; - openEntity.entity = entity; - openEntity.internalEventPtr = NULL; - openEntity.internalEventEndPtr = NULL; - s = (char *)entity->textPtr; - end = (char *)(entity->textPtr + entity->textLen); - tok = XmlPrologTok(internalEncoding, s, end, &next); - result = doProlog(parser, internalEncoding, s, end, tok, next, 0); - entity->open = XML_FALSE; - openInternalEntities = openEntity.next; - return result; -} - -#endif /* XML_DTD */ - -static enum XML_Error FASTCALL -errorProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - return errorCode; -} - -static enum XML_Error FASTCALL -storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, - end, pool); - if (result) - return result; - if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) - poolChop(pool); - if (!poolAppendChar(pool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - return XML_ERROR_NONE; -} - -static enum XML_Error FASTCALL -appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - for (;;) { - const char *next; - int tok = XmlAttributeValueTok(enc, ptr, end, &next); - switch (tok) { - case XML_TOK_NONE: - return XML_ERROR_NONE; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, ptr); - if (n < 0) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - if (!isCdata - && n == 0x20 /* space */ - && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - for (i = 0; i < n; i++) { - if (!poolAppendChar(pool, buf[i])) - return XML_ERROR_NO_MEMORY; - } - } - break; - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, ptr, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_TRAILING_CR: - next = ptr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_ATTRIBUTE_VALUE_S: - case XML_TOK_DATA_NEWLINE: - if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - if (!poolAppendChar(pool, 0x20)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - char checkEntityDecl; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (!poolAppendChar(pool, ch)) - return XML_ERROR_NO_MEMORY; - break; - } - name = poolStoreString(&temp2Pool, enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); - poolDiscard(&temp2Pool); - /* first, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the default handler (if called from content) - */ - if (pool == &dtd.pool) /* are we called from prolog? */ - checkEntityDecl = -#ifdef XML_DTD - prologState.documentEntity && -#endif /* XML_DTD */ - (dtd.standalone - ? !openInternalEntities - : !dtd.hasParamEntityRefs); - else /* if (pool == &tempPool): we are called from content */ - checkEntityDecl = !dtd.hasParamEntityRefs || dtd.standalone; - if (checkEntityDecl) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - /* cannot report skipped entity here - see comments on - skippedEntityHandler - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - if ((pool == &tempPool) && defaultHandler) - reportDefault(parser, enc, ptr, next); - break; - } - if (entity->open) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_RECURSIVE_ENTITY_REF; - } - if (entity->notation) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BINARY_ENTITY_REF; - } - if (!entity->textPtr) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; - } - else { - enum XML_Error result; - const XML_Char *textEnd = entity->textPtr + entity->textLen; - entity->open = XML_TRUE; - result = appendAttributeValue(parser, internalEncoding, isCdata, - (char *)entity->textPtr, - (char *)textEnd, pool); - entity->open = XML_FALSE; - if (result) - return result; - } - } - break; - default: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_UNEXPECTED_STATE; - } - ptr = next; - } - /* not reached */ -} - -static enum XML_Error FASTCALL -storeEntityValue(XML_Parser parser, - const ENCODING *enc, - const char *entityTextPtr, - const char *entityTextEnd) -{ - STRING_POOL *pool = &(dtd.entityValuePool); - enum XML_Error result = XML_ERROR_NONE; -#ifdef XML_DTD - int oldInEntityValue = prologState.inEntityValue; - prologState.inEntityValue = 1; -#endif /* XML_DTD */ - /* never return Null for the value argument in EntityDeclHandler, - since this would indicate an external entity; therefore we - have to make sure that entityValuePool.start is not null */ - if (!pool->blocks) { - if (!poolGrow(pool)) - return XML_ERROR_NO_MEMORY; - } - - for (;;) { - const char *next; - int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: -#ifdef XML_DTD - if (isParamEntity || enc != encoding) { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&tempPool, enc, - entityTextPtr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0); - poolDiscard(&tempPool); - if (!entity) { - /* not a well-formedness error - see XML 1.0: WFC Entity Declared */ - /* cannot report skipped entity here - see comments on - skippedEntityHandler - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - dtd.keepProcessing = dtd.standalone; - goto endEntityValue; - } - if (entity->open) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_RECURSIVE_ENTITY_REF; - goto endEntityValue; - } - if (entity->systemId) { - if (externalEntityRefHandler) { - dtd.paramEntityRead = XML_FALSE; - entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = XML_FALSE; - result = XML_ERROR_EXTERNAL_ENTITY_HANDLING; - goto endEntityValue; - } - entity->open = XML_FALSE; - if (!dtd.paramEntityRead) - dtd.keepProcessing = dtd.standalone; - } - else - dtd.keepProcessing = dtd.standalone; - } - else { - entity->open = XML_TRUE; - result = storeEntityValue(parser, - internalEncoding, - (char *)entity->textPtr, - (char *)(entity->textPtr - + entity->textLen)); - entity->open = XML_FALSE; - if (result) - goto endEntityValue; - } - break; - } -#endif /* XML_DTD */ - /* in the internal subset, PE references are not legal - within markup declarations, e.g entity values in this case */ - eventPtr = entityTextPtr; - result = XML_ERROR_PARAM_ENTITY_REF; - goto endEntityValue; - case XML_TOK_NONE: - result = XML_ERROR_NONE; - goto endEntityValue; - case XML_TOK_ENTITY_REF: - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, entityTextPtr, next)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - break; - case XML_TOK_TRAILING_CR: - next = entityTextPtr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_DATA_NEWLINE: - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = 0xA; - break; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, entityTextPtr); - if (n < 0) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - for (i = 0; i < n; i++) { - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = buf[i]; - } - } - break; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_INVALID_TOKEN; - goto endEntityValue; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - result = XML_ERROR_INVALID_TOKEN; - goto endEntityValue; - default: - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_UNEXPECTED_STATE; - goto endEntityValue; - } - entityTextPtr = next; - } -endEntityValue: -#ifdef XML_DTD - prologState.inEntityValue = oldInEntityValue; -#endif /* XML_DTD */ - return result; -} - -static void FASTCALL -normalizeLines(XML_Char *s) -{ - XML_Char *p; - for (;; s++) { - if (*s == XML_T('\0')) - return; - if (*s == 0xD) - break; - } - p = s; - do { - if (*s == 0xD) { - *p++ = 0xA; - if (*++s == 0xA) - s++; - } - else - *p++ = *s++; - } while (*s); - *p = XML_T('\0'); -} - -static int FASTCALL -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - const XML_Char *target; - XML_Char *data; - const char *tem; - if (!processingInstructionHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - start += enc->minBytesPerChar * 2; - tem = start + XmlNameLength(enc, start); - target = poolStoreString(&tempPool, enc, start, tem); - if (!target) - return 0; - poolFinish(&tempPool); - data = poolStoreString(&tempPool, enc, - XmlSkipS(enc, tem), - end - enc->minBytesPerChar*2); - if (!data) - return 0; - normalizeLines(data); - processingInstructionHandler(handlerArg, target, data); - poolClear(&tempPool); - return 1; -} - -static int FASTCALL -reportComment(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - XML_Char *data; - if (!commentHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - data = poolStoreString(&tempPool, - enc, - start + enc->minBytesPerChar * 4, - end - enc->minBytesPerChar * 3); - if (!data) - return 0; - normalizeLines(data); - commentHandler(handlerArg, data); - poolClear(&tempPool); - return 1; -} - -static void FASTCALL -reportDefault(XML_Parser parser, const ENCODING *enc, - const char *s, const char *end) -{ - if (MUST_CONVERT(enc, s)) { - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - do { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); - *eventPP = s; - } while (s != end); - } - else - defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s); -} - - -static int FASTCALL -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, - XML_Bool isId, const XML_Char *value, XML_Parser parser) -{ - DEFAULT_ATTRIBUTE *att; - if (value || isId) { - /* The handling of default attributes gets messed up if we have - a default which duplicates a non-default. */ - int i; - for (i = 0; i < type->nDefaultAtts; i++) - if (attId == type->defaultAtts[i].id) - return 1; - if (isId && !type->idAtt && !attId->xmlns) - type->idAtt = attId; - } - if (type->nDefaultAtts == type->allocDefaultAtts) { - if (type->allocDefaultAtts == 0) { - type->allocDefaultAtts = 8; - type->defaultAtts = MALLOC(type->allocDefaultAtts - * sizeof(DEFAULT_ATTRIBUTE)); - if (!type->defaultAtts) - return 0; - } - else { - DEFAULT_ATTRIBUTE *temp; - int count = type->allocDefaultAtts * 2; - temp = REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE))); - if (temp == NULL) - return 0; - type->allocDefaultAtts = count; - type->defaultAtts = temp; - } - } - att = type->defaultAtts + type->nDefaultAtts; - att->id = attId; - att->value = value; - att->isCdata = isCdata; - if (!isCdata) - attId->maybeTokenized = XML_TRUE; - type->nDefaultAtts += 1; - return 1; -} - -static int FASTCALL -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) -{ - const XML_Char *name; - for (name = elementType->name; *name; name++) { - if (*name == XML_T(':')) { - PREFIX *prefix; - const XML_Char *s; - for (s = elementType->name; s != name; s++) { - if (!poolAppendChar(&dtd.pool, *s)) - return 0; - } - if (!poolAppendChar(&dtd.pool, XML_T('\0'))) - return 0; - prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), - sizeof(PREFIX)); - if (!prefix) - return 0; - if (prefix->name == poolStart(&dtd.pool)) - poolFinish(&dtd.pool); - else - poolDiscard(&dtd.pool); - elementType->prefix = prefix; - - } - } - return 1; -} - -static ATTRIBUTE_ID * FASTCALL -getAttributeId(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - ATTRIBUTE_ID *id; - const XML_Char *name; - if (!poolAppendChar(&dtd.pool, XML_T('\0'))) - return NULL; - name = poolStoreString(&dtd.pool, enc, start, end); - if (!name) - return NULL; - ++name; - id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID)); - if (!id) - return NULL; - if (id->name != name) - poolDiscard(&dtd.pool); - else { - poolFinish(&dtd.pool); - if (!ns) - ; - else if (name[0] == 'x' - && name[1] == 'm' - && name[2] == 'l' - && name[3] == 'n' - && name[4] == 's' - && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) { - if (name[5] == '\0') - id->prefix = &dtd.defaultPrefix; - else - id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX)); - id->xmlns = XML_TRUE; - } - else { - int i; - for (i = 0; name[i]; i++) { - if (name[i] == XML_T(':')) { - int j; - for (j = 0; j < i; j++) { - if (!poolAppendChar(&dtd.pool, name[j])) - return NULL; - } - if (!poolAppendChar(&dtd.pool, XML_T('\0'))) - return NULL; - id->prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), - sizeof(PREFIX)); - if (id->prefix->name == poolStart(&dtd.pool)) - poolFinish(&dtd.pool); - else - poolDiscard(&dtd.pool); - break; - } - } - } - } - return id; -} - -#define CONTEXT_SEP XML_T('\f') - -static const XML_Char * FASTCALL -getContext(XML_Parser parser) -{ - HASH_TABLE_ITER iter; - XML_Bool needSep = XML_FALSE; - - if (dtd.defaultPrefix.binding) { - int i; - int len; - if (!poolAppendChar(&tempPool, XML_T('='))) - return NULL; - len = dtd.defaultPrefix.binding->uriLen; - if (namespaceSeparator != XML_T('\0')) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i])) - return NULL; - needSep = XML_TRUE; - } - - hashTableIterInit(&iter, &(dtd.prefixes)); - for (;;) { - int i; - int len; - const XML_Char *s; - PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); - if (!prefix) - break; - if (!prefix->binding) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return NULL; - for (s = prefix->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return NULL; - if (!poolAppendChar(&tempPool, XML_T('='))) - return NULL; - len = prefix->binding->uriLen; - if (namespaceSeparator != XML_T('\0')) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) - return NULL; - needSep = XML_TRUE; - } - - - hashTableIterInit(&iter, &(dtd.generalEntities)); - for (;;) { - const XML_Char *s; - ENTITY *e = (ENTITY *)hashTableIterNext(&iter); - if (!e) - break; - if (!e->open) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return NULL; - for (s = e->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return 0; - needSep = XML_TRUE; - } - - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return NULL; - return tempPool.start; -} - -static XML_Bool FASTCALL -setContext(XML_Parser parser, const XML_Char *context) -{ - const XML_Char *s = context; - - while (*context != XML_T('\0')) { - if (*s == CONTEXT_SEP || *s == XML_T('\0')) { - ENTITY *e; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0); - if (e) - e->open = XML_TRUE; - if (*s != XML_T('\0')) - s++; - context = s; - poolDiscard(&tempPool); - } - else if (*s == XML_T('=')) { - PREFIX *prefix; - if (poolLength(&tempPool) == 0) - prefix = &dtd.defaultPrefix; - else { - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&tempPool), - sizeof(PREFIX)); - if (!prefix) - return XML_FALSE; - if (prefix->name == poolStart(&tempPool)) { - prefix->name = poolCopyString(&dtd.pool, prefix->name); - if (!prefix->name) - return XML_FALSE; - } - poolDiscard(&tempPool); - } - for (context = s + 1; - *context != CONTEXT_SEP && *context != XML_T('\0'); - context++) - if (!poolAppendChar(&tempPool, *context)) - return XML_FALSE; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - if (!addBinding(parser, prefix, 0, poolStart(&tempPool), - &inheritedBindings)) - return XML_FALSE; - poolDiscard(&tempPool); - if (*context != XML_T('\0')) - ++context; - s = context; - } - else { - if (!poolAppendChar(&tempPool, *s)) - return XML_FALSE; - s++; - } - } - return XML_TRUE; -} - -static void FASTCALL -normalizePublicId(XML_Char *publicId) -{ - XML_Char *p = publicId; - XML_Char *s; - for (s = publicId; *s; s++) { - switch (*s) { - case 0x20: - case 0xD: - case 0xA: - if (p != publicId && p[-1] != 0x20) - *p++ = 0x20; - break; - default: - *p++ = *s; - } - } - if (p != publicId && p[-1] == 0x20) - --p; - *p = XML_T('\0'); -} - -static void FASTCALL -dtdInit(DTD *p, XML_Parser parser) -{ - XML_Memory_Handling_Suite *ms = &parser->m_mem; - poolInit(&(p->pool), ms); -#ifdef XML_DTD - poolInit(&(p->entityValuePool), ms); -#endif /* XML_DTD */ - hashTableInit(&(p->generalEntities), ms); - hashTableInit(&(p->elementTypes), ms); - hashTableInit(&(p->attributeIds), ms); - hashTableInit(&(p->prefixes), ms); -#ifdef XML_DTD - p->paramEntityRead = XML_FALSE; - hashTableInit(&(p->paramEntities), ms); -#endif /* XML_DTD */ - p->defaultPrefix.name = NULL; - p->defaultPrefix.binding = NULL; - - p->in_eldecl = XML_FALSE; - p->scaffIndex = NULL; - p->scaffold = NULL; - p->scaffLevel = 0; - p->scaffSize = 0; - p->scaffCount = 0; - p->contentStringLen = 0; - - p->keepProcessing = XML_TRUE; - p->hasParamEntityRefs = XML_FALSE; - p->standalone = XML_FALSE; -} - -#ifdef XML_DTD - -static void FASTCALL -dtdSwap(DTD *p1, DTD *p2) -{ - DTD tem; - memcpy(&tem, p1, sizeof(DTD)); - memcpy(p1, p2, sizeof(DTD)); - memcpy(p2, &tem, sizeof(DTD)); -} - -#endif /* XML_DTD */ - -static void FASTCALL -dtdReset(DTD *p, XML_Parser parser) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - FREE(e->defaultAtts); - } - hashTableClear(&(p->generalEntities)); -#ifdef XML_DTD - p->paramEntityRead = XML_FALSE; - hashTableClear(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableClear(&(p->elementTypes)); - hashTableClear(&(p->attributeIds)); - hashTableClear(&(p->prefixes)); - poolClear(&(p->pool)); -#ifdef XML_DTD - poolClear(&(p->entityValuePool)); -#endif /* XML_DTD */ - p->defaultPrefix.name = NULL; - p->defaultPrefix.binding = NULL; - - p->in_eldecl = XML_FALSE; - if (p->scaffIndex) { - FREE(p->scaffIndex); - p->scaffIndex = NULL; - } - if (p->scaffold) { - FREE(p->scaffold); - p->scaffold = NULL; - } - p->scaffLevel = 0; - p->scaffSize = 0; - p->scaffCount = 0; - p->contentStringLen = 0; - - p->keepProcessing = XML_TRUE; - p->hasParamEntityRefs = XML_FALSE; - p->standalone = XML_FALSE; -} - -static void FASTCALL -dtdDestroy(DTD *p, XML_Parser parser) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - FREE(e->defaultAtts); - } - hashTableDestroy(&(p->generalEntities)); -#ifdef XML_DTD - hashTableDestroy(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableDestroy(&(p->elementTypes)); - hashTableDestroy(&(p->attributeIds)); - hashTableDestroy(&(p->prefixes)); - poolDestroy(&(p->pool)); -#ifdef XML_DTD - poolDestroy(&(p->entityValuePool)); -#endif /* XML_DTD */ - if (!parentParser) { - if (p->scaffIndex) - FREE(p->scaffIndex); - if (p->scaffold) - FREE(p->scaffold); - } -} - -/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise. - The new DTD has already been initialized. -*/ -static int FASTCALL -dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser) -{ - HASH_TABLE_ITER iter; - - /* Copy the prefix table. */ - - hashTableIterInit(&iter, &(oldDtd->prefixes)); - for (;;) { - const XML_Char *name; - const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); - if (!oldP) - break; - name = poolCopyString(&(newDtd->pool), oldP->name); - if (!name) - return 0; - if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX))) - return 0; - } - - hashTableIterInit(&iter, &(oldDtd->attributeIds)); - - /* Copy the attribute id table. */ - - for (;;) { - ATTRIBUTE_ID *newA; - const XML_Char *name; - const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); - - if (!oldA) - break; - /* Remember to allocate the scratch byte before the name. */ - if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) - return 0; - name = poolCopyString(&(newDtd->pool), oldA->name); - if (!name) - return 0; - ++name; - newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name, - sizeof(ATTRIBUTE_ID)); - if (!newA) - return 0; - newA->maybeTokenized = oldA->maybeTokenized; - if (oldA->prefix) { - newA->xmlns = oldA->xmlns; - if (oldA->prefix == &oldDtd->defaultPrefix) - newA->prefix = &newDtd->defaultPrefix; - else - newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes), - oldA->prefix->name, 0); - } - } - - /* Copy the element type table. */ - - hashTableIterInit(&iter, &(oldDtd->elementTypes)); - - for (;;) { - int i; - ELEMENT_TYPE *newE; - const XML_Char *name; - const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(&(newDtd->pool), oldE->name); - if (!name) - return 0; - newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name, - sizeof(ELEMENT_TYPE)); - if (!newE) - return 0; - if (oldE->nDefaultAtts) { - newE->defaultAtts = (DEFAULT_ATTRIBUTE *) - MALLOC(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); - if (!newE->defaultAtts) { - FREE(newE); - return 0; - } - } - if (oldE->idAtt) - newE->idAtt = (ATTRIBUTE_ID *) - lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0); - newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; - if (oldE->prefix) - newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes), - oldE->prefix->name, 0); - for (i = 0; i < newE->nDefaultAtts; i++) { - newE->defaultAtts[i].id = (ATTRIBUTE_ID *) - lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); - newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; - if (oldE->defaultAtts[i].value) { - newE->defaultAtts[i].value - = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); - if (!newE->defaultAtts[i].value) - return 0; - } - else - newE->defaultAtts[i].value = NULL; - } - } - - /* Copy the entity tables. */ - if (!copyEntityTable(&(newDtd->generalEntities), - &(newDtd->pool), - &(oldDtd->generalEntities), parser)) - return 0; - -#ifdef XML_DTD - if (!copyEntityTable(&(newDtd->paramEntities), - &(newDtd->pool), - &(oldDtd->paramEntities), parser)) - return 0; - newDtd->paramEntityRead = oldDtd->paramEntityRead; -#endif /* XML_DTD */ - - newDtd->keepProcessing = oldDtd->keepProcessing; - newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs; - newDtd->standalone = oldDtd->standalone; - - /* Don't want deep copying for scaffolding */ - newDtd->in_eldecl = oldDtd->in_eldecl; - newDtd->scaffold = oldDtd->scaffold; - newDtd->contentStringLen = oldDtd->contentStringLen; - newDtd->scaffSize = oldDtd->scaffSize; - newDtd->scaffLevel = oldDtd->scaffLevel; - newDtd->scaffIndex = oldDtd->scaffIndex; - - return 1; -} /* End dtdCopy */ - -static int FASTCALL -copyEntityTable(HASH_TABLE *newTable, - STRING_POOL *newPool, - const HASH_TABLE *oldTable, - XML_Parser parser) -{ - HASH_TABLE_ITER iter; - const XML_Char *cachedOldBase = NULL; - const XML_Char *cachedNewBase = NULL; - - hashTableIterInit(&iter, oldTable); - - for (;;) { - ENTITY *newE; - const XML_Char *name; - const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(newPool, oldE->name); - if (!name) - return 0; - newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY)); - if (!newE) - return 0; - if (oldE->systemId) { - const XML_Char *tem = poolCopyString(newPool, oldE->systemId); - if (!tem) - return 0; - newE->systemId = tem; - if (oldE->base) { - if (oldE->base == cachedOldBase) - newE->base = cachedNewBase; - else { - cachedOldBase = oldE->base; - tem = poolCopyString(newPool, cachedOldBase); - if (!tem) - return 0; - cachedNewBase = newE->base = tem; - } - } - if (oldE->publicId) { - tem = poolCopyString(newPool, oldE->publicId); - if (!tem) - return 0; - newE->publicId = tem; - } - } - else { - const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, - oldE->textLen); - if (!tem) - return 0; - newE->textPtr = tem; - newE->textLen = oldE->textLen; - } - if (oldE->notation) { - const XML_Char *tem = poolCopyString(newPool, oldE->notation); - if (!tem) - return 0; - newE->notation = tem; - } - newE->is_param = oldE->is_param; - newE->is_internal = oldE->is_internal; - } - return 1; -} - -#define INIT_SIZE 64 - -static int FASTCALL -keyeq(KEY s1, KEY s2) -{ - for (; *s1 == *s2; s1++, s2++) - if (*s1 == 0) - return 1; - return 0; -} - -static unsigned long FASTCALL -hash(KEY s) -{ - unsigned long h = 0; - while (*s) - h = (h << 5) + h + (unsigned char)*s++; - return h; -} - -static NAMED * FASTCALL -lookup(HASH_TABLE *table, KEY name, size_t createSize) -{ - size_t i; - if (table->size == 0) { - size_t tsize; - - if (!createSize) - return NULL; - tsize = INIT_SIZE * sizeof(NAMED *); - table->v = table->mem->malloc_fcn(tsize); - if (!table->v) - return NULL; - memset(table->v, 0, tsize); - table->size = INIT_SIZE; - table->usedLim = INIT_SIZE / 2; - i = hash(name) & (table->size - 1); - } - else { - unsigned long h = hash(name); - for (i = h & (table->size - 1); - table->v[i]; - i == 0 ? i = table->size - 1 : --i) { - if (keyeq(name, table->v[i]->name)) - return table->v[i]; - } - if (!createSize) - return NULL; - if (table->used == table->usedLim) { - /* check for overflow */ - size_t newSize = table->size * 2; - size_t tsize = newSize * sizeof(NAMED *); - NAMED **newV = table->mem->malloc_fcn(tsize); - if (!newV) - return NULL; - memset(newV, 0, tsize); - for (i = 0; i < table->size; i++) - if (table->v[i]) { - size_t j; - for (j = hash(table->v[i]->name) & (newSize - 1); - newV[j]; - j == 0 ? j = newSize - 1 : --j) - ; - newV[j] = table->v[i]; - } - table->mem->free_fcn(table->v); - table->v = newV; - table->size = newSize; - table->usedLim = newSize/2; - for (i = h & (table->size - 1); - table->v[i]; - i == 0 ? i = table->size - 1 : --i) - ; - } - } - table->v[i] = table->mem->malloc_fcn(createSize); - if (!table->v[i]) - return NULL; - memset(table->v[i], 0, createSize); - table->v[i]->name = name; - (table->used)++; - return table->v[i]; -} - -static void FASTCALL -hashTableClear(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) { - NAMED *p = table->v[i]; - if (p) { - table->mem->free_fcn(p); - table->v[i] = NULL; - } - } - table->usedLim = table->size / 2; - table->used = 0; -} - -static void FASTCALL -hashTableDestroy(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) { - NAMED *p = table->v[i]; - if (p) - table->mem->free_fcn(p); - } - if (table->v) - table->mem->free_fcn(table->v); -} - -static void FASTCALL -hashTableInit(HASH_TABLE *p, XML_Memory_Handling_Suite *ms) -{ - p->size = 0; - p->usedLim = 0; - p->used = 0; - p->v = NULL; - p->mem = ms; -} - -static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) -{ - iter->p = table->v; - iter->end = iter->p + table->size; -} - -static NAMED * FASTCALL -hashTableIterNext(HASH_TABLE_ITER *iter) -{ - while (iter->p != iter->end) { - NAMED *tem = *(iter->p)++; - if (tem) - return tem; - } - return NULL; -} - -static void FASTCALL -poolInit(STRING_POOL *pool, XML_Memory_Handling_Suite *ms) -{ - pool->blocks = NULL; - pool->freeBlocks = NULL; - pool->start = NULL; - pool->ptr = NULL; - pool->end = NULL; - pool->mem = ms; -} - -static void FASTCALL -poolClear(STRING_POOL *pool) -{ - if (!pool->freeBlocks) - pool->freeBlocks = pool->blocks; - else { - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - p->next = pool->freeBlocks; - pool->freeBlocks = p; - p = tem; - } - } - pool->blocks = NULL; - pool->start = NULL; - pool->ptr = NULL; - pool->end = NULL; -} - -static void FASTCALL -poolDestroy(STRING_POOL *pool) -{ - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } - p = pool->freeBlocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } -} - -static XML_Char * FASTCALL -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; - for (;;) { - XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); - if (ptr == end) - break; - if (!poolGrow(pool)) - return NULL; - } - return pool->start; -} - -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s) -{ - do { - if (!poolAppendChar(pool, *s)) - return NULL; - } while (*s++); - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char * FASTCALL -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; - for (; n > 0; --n, s++) { - if (!poolAppendChar(pool, *s)) - return NULL; - } - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s) -{ - while (*s) { - if (!poolAppendChar(pool, *s)) - return NULL; - s++; - } - return pool->start; -} - -static XML_Char * FASTCALL -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!poolAppend(pool, enc, ptr, end)) - return NULL; - if (pool->ptr == pool->end && !poolGrow(pool)) - return NULL; - *(pool->ptr)++ = 0; - return pool->start; -} - -static XML_Bool FASTCALL -poolGrow(STRING_POOL *pool) -{ - if (pool->freeBlocks) { - if (pool->start == 0) { - pool->blocks = pool->freeBlocks; - pool->freeBlocks = pool->freeBlocks->next; - pool->blocks->next = NULL; - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - pool->ptr = pool->start; - return XML_TRUE; - } - if (pool->end - pool->start < pool->freeBlocks->size) { - BLOCK *tem = pool->freeBlocks->next; - pool->freeBlocks->next = pool->blocks; - pool->blocks = pool->freeBlocks; - pool->freeBlocks = tem; - memcpy(pool->blocks->s, pool->start, - (pool->end - pool->start) * sizeof(XML_Char)); - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - return XML_TRUE; - } - } - if (pool->blocks && pool->start == pool->blocks->s) { - int blockSize = (pool->end - pool->start)*2; - pool->blocks = pool->mem->realloc_fcn(pool->blocks, - offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char)); - if (pool->blocks == NULL) - return XML_FALSE; - pool->blocks->size = blockSize; - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + blockSize; - } - else { - BLOCK *tem; - int blockSize = pool->end - pool->start; - if (blockSize < INIT_BLOCK_SIZE) - blockSize = INIT_BLOCK_SIZE; - else - blockSize *= 2; - tem = pool->mem->malloc_fcn(offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char)); - if (!tem) - return XML_FALSE; - tem->size = blockSize; - tem->next = pool->blocks; - pool->blocks = tem; - if (pool->ptr != pool->start) - memcpy(tem->s, pool->start, - (pool->ptr - pool->start) * sizeof(XML_Char)); - pool->ptr = tem->s + (pool->ptr - pool->start); - pool->start = tem->s; - pool->end = tem->s + blockSize; - } - return XML_TRUE; -} - -static int FASTCALL -nextScaffoldPart(XML_Parser parser) -{ - CONTENT_SCAFFOLD * me; - int next; - - if (!dtd.scaffIndex) { - dtd.scaffIndex = MALLOC(groupSize * sizeof(int)); - if (!dtd.scaffIndex) - return -1; - dtd.scaffIndex[0] = 0; - } - - if (dtd.scaffCount >= dtd.scaffSize) { - CONTENT_SCAFFOLD *temp; - if (dtd.scaffold) { - temp = (CONTENT_SCAFFOLD *) - REALLOC(dtd.scaffold, dtd.scaffSize * 2 * sizeof(CONTENT_SCAFFOLD)); - if (temp == NULL) - return -1; - dtd.scaffSize *= 2; - } - else { - temp = MALLOC(INIT_SCAFFOLD_ELEMENTS * sizeof(CONTENT_SCAFFOLD)); - if (temp == NULL) - return -1; - dtd.scaffSize = INIT_SCAFFOLD_ELEMENTS; - } - dtd.scaffold = temp; - } - next = dtd.scaffCount++; - me = &dtd.scaffold[next]; - if (dtd.scaffLevel) { - CONTENT_SCAFFOLD *parent = &dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel-1]]; - if (parent->lastchild) { - dtd.scaffold[parent->lastchild].nextsib = next; - } - if (!parent->childcnt) - parent->firstchild = next; - parent->lastchild = next; - parent->childcnt++; - } - me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0; - return next; -} - -static void FASTCALL -build_node(XML_Parser parser, - int src_node, - XML_Content *dest, - XML_Content **contpos, - XML_Char **strpos) -{ - dest->type = dtd.scaffold[src_node].type; - dest->quant = dtd.scaffold[src_node].quant; - if (dest->type == XML_CTYPE_NAME) { - const XML_Char *src; - dest->name = *strpos; - src = dtd.scaffold[src_node].name; - for (;;) { - *(*strpos)++ = *src; - if (!*src) - break; - src++; - } - dest->numchildren = 0; - dest->children = NULL; - } - else { - unsigned int i; - int cn; - dest->numchildren = dtd.scaffold[src_node].childcnt; - dest->children = *contpos; - *contpos += dest->numchildren; - for (i = 0, cn = dtd.scaffold[src_node].firstchild; - i < dest->numchildren; - i++, cn = dtd.scaffold[cn].nextsib) { - build_node(parser, cn, &(dest->children[i]), contpos, strpos); - } - dest->name = NULL; - } -} - -static XML_Content * FASTCALL -build_model (XML_Parser parser) -{ - XML_Content *ret; - XML_Content *cpos; - XML_Char * str; - int allocsize = (dtd.scaffCount * sizeof(XML_Content) - + (dtd.contentStringLen * sizeof(XML_Char))); - - ret = MALLOC(allocsize); - if (!ret) - return NULL; - - str = (XML_Char *) (&ret[dtd.scaffCount]); - cpos = &ret[1]; - - build_node(parser, 0, ret, &cpos, &str); - return ret; -} - -static ELEMENT_TYPE * FASTCALL -getElementType(XML_Parser parser, - const ENCODING *enc, - const char *ptr, - const char *end) -{ - const XML_Char *name = poolStoreString(&dtd.pool, enc, ptr, end); - ELEMENT_TYPE *ret; - - if (!name) - return NULL; - ret = (ELEMENT_TYPE *) lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE)); - if (!ret) - return NULL; - if (ret->name != name) - poolDiscard(&dtd.pool); - else { - poolFinish(&dtd.pool); - if (!setElementTypePrefix(parser, ret)) - return NULL; - } - return ret; -} diff --git a/bundle/expat/xmlrole.c b/bundle/expat/xmlrole.c deleted file mode 100644 index d9a2367087..0000000000 --- a/bundle/expat/xmlrole.c +++ /dev/null @@ -1,1330 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#if PHP_WIN32 -#include "config.w32.h" -#else -#include "php_config.h" -#endif -#include "php_compat.h" - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -/* -#else -#include -*/ -#endif /* ndef COMPILED_FROM_DSP */ - -#include "internal.h" -#include "xmlrole.h" -#include "ascii.h" - -/* Doesn't check: - - that ,| are not mixed in a model group - content of literals - -*/ - -static const char KW_ANY[] = { - ASCII_A, ASCII_N, ASCII_Y, '\0' }; -static const char KW_ATTLIST[] = { - ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' }; -static const char KW_CDATA[] = { - ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_DOCTYPE[] = { - ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' }; -static const char KW_ELEMENT[] = { - ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' }; -static const char KW_EMPTY[] = { - ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' }; -static const char KW_ENTITIES[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, - '\0' }; -static const char KW_ENTITY[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; -static const char KW_FIXED[] = { - ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' }; -static const char KW_ID[] = { - ASCII_I, ASCII_D, '\0' }; -static const char KW_IDREF[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; -static const char KW_IDREFS[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; -static const char KW_IGNORE[] = { - ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; -static const char KW_IMPLIED[] = { - ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; -static const char KW_INCLUDE[] = { - ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; -static const char KW_NDATA[] = { - ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_NMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; -static const char KW_NMTOKENS[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, - '\0' }; -static const char KW_NOTATION[] = - { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, - '\0' }; -static const char KW_PCDATA[] = { - ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_PUBLIC[] = { - ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' }; -static const char KW_REQUIRED[] = { - ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, - '\0' }; -static const char KW_SYSTEM[] = { - ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' }; - -#ifndef MIN_BYTES_PER_CHAR -#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) -#endif - -#ifdef XML_DTD -#define setTopLevel(state) \ - ((state)->handler = ((state)->documentEntity \ - ? internalSubset \ - : externalSubset1)) -#else /* not XML_DTD */ -#define setTopLevel(state) ((state)->handler = internalSubset) -#endif /* not XML_DTD */ - -typedef int FASTCALL PROLOG_HANDLER(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - -static PROLOG_HANDLER - prolog0, prolog1, prolog2, - doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, - internalSubset, - entity0, entity1, entity2, entity3, entity4, entity5, entity6, - entity7, entity8, entity9, entity10, - notation0, notation1, notation2, notation3, notation4, - attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, - attlist7, attlist8, attlist9, - element0, element1, element2, element3, element4, element5, element6, - element7, -#ifdef XML_DTD - externalSubset0, externalSubset1, - condSect0, condSect1, condSect2, -#endif /* XML_DTD */ - declClose, - error; - -static int FASTCALL common(PROLOG_STATE *state, int tok); - -static int FASTCALL -prolog0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - state->handler = prolog1; - return XML_ROLE_NONE; - case XML_TOK_XML_DECL: - state->handler = prolog1; - return XML_ROLE_XML_DECL; - case XML_TOK_PI: - state->handler = prolog1; - return XML_ROLE_PI; - case XML_TOK_COMMENT: - state->handler = prolog1; - return XML_ROLE_COMMENT; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int FASTCALL -prolog1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int FASTCALL -prolog2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int FASTCALL -doctype0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = doctype1; - return XML_ROLE_DOCTYPE_NAME; - } - return common(state, tok); -} - -static int FASTCALL -doctype1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = doctype3; - return XML_ROLE_DOCTYPE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = doctype2; - return XML_ROLE_DOCTYPE_NONE; - } - break; - } - return common(state, tok); -} - -static int FASTCALL -doctype2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype3; - return XML_ROLE_DOCTYPE_PUBLIC_ID; - } - return common(state, tok); -} - -static int FASTCALL -doctype3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype4; - return XML_ROLE_DOCTYPE_SYSTEM_ID; - } - return common(state, tok); -} - -static int FASTCALL -doctype4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static int FASTCALL -doctype5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static int FASTCALL -internalSubset(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ENTITY)) { - state->handler = entity0; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ATTLIST)) { - state->handler = attlist0; - return XML_ROLE_ATTLIST_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ELEMENT)) { - state->handler = element0; - return XML_ROLE_ELEMENT_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_NOTATION)) { - state->handler = notation0; - return XML_ROLE_NOTATION_NONE; - } - break; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_PARAM_ENTITY_REF: - return XML_ROLE_PARAM_ENTITY_REF; - case XML_TOK_CLOSE_BRACKET: - state->handler = doctype5; - return XML_ROLE_DOCTYPE_NONE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static int FASTCALL -externalSubset0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - state->handler = externalSubset1; - if (tok == XML_TOK_XML_DECL) - return XML_ROLE_TEXT_DECL; - return externalSubset1(state, tok, ptr, end, enc); -} - -static int FASTCALL -externalSubset1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_COND_SECT_OPEN: - state->handler = condSect0; - return XML_ROLE_NONE; - case XML_TOK_COND_SECT_CLOSE: - if (state->includeLevel == 0) - break; - state->includeLevel -= 1; - return XML_ROLE_NONE; - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_BRACKET: - break; - case XML_TOK_NONE: - if (state->includeLevel) - break; - return XML_ROLE_NONE; - default: - return internalSubset(state, tok, ptr, end, enc); - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static int FASTCALL -entity0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_PERCENT: - state->handler = entity1; - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = entity2; - return XML_ROLE_GENERAL_ENTITY_NAME; - } - return common(state, tok); -} - -static int FASTCALL -entity1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = entity7; - return XML_ROLE_PARAM_ENTITY_NAME; - } - return common(state, tok); -} - -static int FASTCALL -entity2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity4; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity3; - return XML_ROLE_ENTITY_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static int FASTCALL -entity3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity4; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static int FASTCALL -entity4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity5; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static int FASTCALL -entity5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) { - state->handler = entity6; - return XML_ROLE_ENTITY_NONE; - } - break; - } - return common(state, tok); -} - -static int FASTCALL -entity6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_NOTATION_NAME; - } - return common(state, tok); -} - -static int FASTCALL -entity7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity9; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity8; - return XML_ROLE_ENTITY_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static int FASTCALL -entity8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity9; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static int FASTCALL -entity9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity10; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static int FASTCALL -entity10(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - } - return common(state, tok); -} - -static int FASTCALL -notation0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_NAME: - state->handler = notation1; - return XML_ROLE_NOTATION_NAME; - } - return common(state, tok); -} - -static int FASTCALL -notation1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = notation3; - return XML_ROLE_NOTATION_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = notation2; - return XML_ROLE_NOTATION_NONE; - } - break; - } - return common(state, tok); -} - -static int FASTCALL -notation2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = notation4; - return XML_ROLE_NOTATION_PUBLIC_ID; - } - return common(state, tok); -} - -static int FASTCALL -notation3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_NOTATION_NONE; - return XML_ROLE_NOTATION_SYSTEM_ID; - } - return common(state, tok); -} - -static int FASTCALL -notation4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_NOTATION_NONE; - return XML_ROLE_NOTATION_SYSTEM_ID; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_NOTATION_NO_SYSTEM_ID; - } - return common(state, tok); -} - -static int FASTCALL -attlist0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist1; - return XML_ROLE_ATTLIST_ELEMENT_NAME; - } - return common(state, tok); -} - -static int FASTCALL -attlist1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist2; - return XML_ROLE_ATTRIBUTE_NAME; - } - return common(state, tok); -} - -static int FASTCALL -attlist2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - { - static const char *types[] = { - KW_CDATA, - KW_ID, - KW_IDREF, - KW_IDREFS, - KW_ENTITY, - KW_ENTITIES, - KW_NMTOKEN, - KW_NMTOKENS, - }; - int i; - for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) - if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { - state->handler = attlist8; - return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; - } - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) { - state->handler = attlist5; - return XML_ROLE_ATTLIST_NONE; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = attlist3; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int FASTCALL -attlist3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NMTOKEN: - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist4; - return XML_ROLE_ATTRIBUTE_ENUM_VALUE; - } - return common(state, tok); -} - -static int FASTCALL -attlist4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OR: - state->handler = attlist3; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int FASTCALL -attlist5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OPEN_PAREN: - state->handler = attlist6; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int FASTCALL -attlist6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - state->handler = attlist7; - return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; - } - return common(state, tok); -} - -static int FASTCALL -attlist7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OR: - state->handler = attlist6; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -/* default value */ -static int FASTCALL -attlist8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_IMPLIED)) { - state->handler = attlist1; - return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_REQUIRED)) { - state->handler = attlist1; - return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_FIXED)) { - state->handler = attlist9; - return XML_ROLE_ATTLIST_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static int FASTCALL -attlist9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_FIXED_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static int FASTCALL -element0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element1; - return XML_ROLE_ELEMENT_NAME; - } - return common(state, tok); -} - -static int FASTCALL -element1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_CONTENT_EMPTY; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_CONTENT_ANY; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = element2; - state->level = 1; - return XML_ROLE_GROUP_OPEN; - } - return common(state, tok); -} - -static int FASTCALL -element2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_PCDATA)) { - state->handler = element3; - return XML_ROLE_CONTENT_PCDATA; - } - break; - case XML_TOK_OPEN_PAREN: - state->level = 2; - state->handler = element6; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static int FASTCALL -element3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_ELEMENT_NONE; - } - return common(state, tok); -} - -static int FASTCALL -element4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element5; - return XML_ROLE_CONTENT_ELEMENT; - } - return common(state, tok); -} - -static int FASTCALL -element5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_ELEMENT_NONE; - } - return common(state, tok); -} - -static int FASTCALL -element6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_OPEN_PAREN: - state->level += 1; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static int FASTCALL -element7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_CLOSE_PAREN_QUESTION: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_OPT; - case XML_TOK_CLOSE_PAREN_PLUS: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_PLUS; - case XML_TOK_COMMA: - state->handler = element6; - return XML_ROLE_GROUP_SEQUENCE; - case XML_TOK_OR: - state->handler = element6; - return XML_ROLE_GROUP_CHOICE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static int FASTCALL -condSect0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) { - state->handler = condSect1; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) { - state->handler = condSect2; - return XML_ROLE_NONE; - } - break; - } - return common(state, tok); -} - -static int FASTCALL -condSect1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - state->includeLevel += 1; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static int FASTCALL -condSect2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - return XML_ROLE_IGNORE_SECT; - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static int FASTCALL -declClose(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return state->role_none; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return state->role_none; - } - return common(state, tok); -} - -static int FASTCALL -error(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - return XML_ROLE_NONE; -} - -static int FASTCALL -common(PROLOG_STATE *state, int tok) -{ -#ifdef XML_DTD - if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) - return XML_ROLE_INNER_PARAM_ENTITY_REF; -#endif - state->handler = error; - return XML_ROLE_ERROR; -} - -void -XmlPrologStateInit(PROLOG_STATE *state) -{ - state->handler = prolog0; -#ifdef XML_DTD - state->documentEntity = 1; - state->includeLevel = 0; - state->inEntityValue = 0; -#endif /* XML_DTD */ -} - -#ifdef XML_DTD - -void -XmlPrologStateInitExternalEntity(PROLOG_STATE *state) -{ - state->handler = externalSubset0; - state->documentEntity = 0; - state->includeLevel = 0; -} - -#endif /* XML_DTD */ diff --git a/bundle/expat/xmlrole.h b/bundle/expat/xmlrole.h deleted file mode 100644 index 281aba0481..0000000000 --- a/bundle/expat/xmlrole.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlRole_INCLUDED -#define XmlRole_INCLUDED 1 - -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt -#endif - -#include "xmltok.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - XML_ROLE_ERROR = -1, - XML_ROLE_NONE = 0, - XML_ROLE_XML_DECL, - XML_ROLE_INSTANCE_START, - XML_ROLE_DOCTYPE_NONE, - XML_ROLE_DOCTYPE_NAME, - XML_ROLE_DOCTYPE_SYSTEM_ID, - XML_ROLE_DOCTYPE_PUBLIC_ID, - XML_ROLE_DOCTYPE_INTERNAL_SUBSET, - XML_ROLE_DOCTYPE_CLOSE, - XML_ROLE_GENERAL_ENTITY_NAME, - XML_ROLE_PARAM_ENTITY_NAME, - XML_ROLE_ENTITY_NONE, - XML_ROLE_ENTITY_VALUE, - XML_ROLE_ENTITY_SYSTEM_ID, - XML_ROLE_ENTITY_PUBLIC_ID, - XML_ROLE_ENTITY_COMPLETE, - XML_ROLE_ENTITY_NOTATION_NAME, - XML_ROLE_NOTATION_NONE, - XML_ROLE_NOTATION_NAME, - XML_ROLE_NOTATION_SYSTEM_ID, - XML_ROLE_NOTATION_NO_SYSTEM_ID, - XML_ROLE_NOTATION_PUBLIC_ID, - XML_ROLE_ATTRIBUTE_NAME, - XML_ROLE_ATTRIBUTE_TYPE_CDATA, - XML_ROLE_ATTRIBUTE_TYPE_ID, - XML_ROLE_ATTRIBUTE_TYPE_IDREF, - XML_ROLE_ATTRIBUTE_TYPE_IDREFS, - XML_ROLE_ATTRIBUTE_TYPE_ENTITY, - XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, - XML_ROLE_ATTRIBUTE_ENUM_VALUE, - XML_ROLE_ATTRIBUTE_NOTATION_VALUE, - XML_ROLE_ATTLIST_NONE, - XML_ROLE_ATTLIST_ELEMENT_NAME, - XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, - XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, - XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, - XML_ROLE_FIXED_ATTRIBUTE_VALUE, - XML_ROLE_ELEMENT_NONE, - XML_ROLE_ELEMENT_NAME, - XML_ROLE_CONTENT_ANY, - XML_ROLE_CONTENT_EMPTY, - XML_ROLE_CONTENT_PCDATA, - XML_ROLE_GROUP_OPEN, - XML_ROLE_GROUP_CLOSE, - XML_ROLE_GROUP_CLOSE_REP, - XML_ROLE_GROUP_CLOSE_OPT, - XML_ROLE_GROUP_CLOSE_PLUS, - XML_ROLE_GROUP_CHOICE, - XML_ROLE_GROUP_SEQUENCE, - XML_ROLE_CONTENT_ELEMENT, - XML_ROLE_CONTENT_ELEMENT_REP, - XML_ROLE_CONTENT_ELEMENT_OPT, - XML_ROLE_CONTENT_ELEMENT_PLUS, - XML_ROLE_PI, - XML_ROLE_COMMENT, -#ifdef XML_DTD - XML_ROLE_TEXT_DECL, - XML_ROLE_IGNORE_SECT, - XML_ROLE_INNER_PARAM_ENTITY_REF, -#endif /* XML_DTD */ - XML_ROLE_PARAM_ENTITY_REF -}; - -typedef struct prolog_state { - int (FASTCALL *handler) (struct prolog_state *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - unsigned level; - int role_none; -#ifdef XML_DTD - unsigned includeLevel; - int documentEntity; - int inEntityValue; -#endif /* XML_DTD */ -} PROLOG_STATE; - -void XmlPrologStateInit(PROLOG_STATE *); -#ifdef XML_DTD -void XmlPrologStateInitExternalEntity(PROLOG_STATE *); -#endif /* XML_DTD */ - -#define XmlTokenRole(state, tok, ptr, end, enc) \ - (((state)->handler)(state, tok, ptr, end, enc)) - -#ifdef __cplusplus -} -#endif - -#endif /* not XmlRole_INCLUDED */ diff --git a/bundle/expat/xmltok.c b/bundle/expat/xmltok.c deleted file mode 100644 index 0a11e56748..0000000000 --- a/bundle/expat/xmltok.c +++ /dev/null @@ -1,1641 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#if PHP_WIN32 -#include "config.w32.h" -#else -#include "php_config.h" -#endif -#include "php_compat.h" - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -/* -#else -#include -*/ -#endif /* ndef COMPILED_FROM_DSP */ - -#include "internal.h" -#include "xmltok.h" -#include "nametab.h" - -#ifdef XML_DTD -#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) -#else -#define IGNORE_SECTION_TOK_VTABLE /* as nothing */ -#endif - -#define VTABLE1 \ - { PREFIX(prologTok), PREFIX(contentTok), \ - PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ - { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ - PREFIX(sameName), \ - PREFIX(nameMatchesAscii), \ - PREFIX(nameLength), \ - PREFIX(skipS), \ - PREFIX(getAtts), \ - PREFIX(charRefNumber), \ - PREFIX(predefinedEntityName), \ - PREFIX(updatePosition), \ - PREFIX(isPublicId) - -#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) - -#define UCS2_GET_NAMING(pages, hi, lo) \ - (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) - -/* A 2 byte UTF-8 representation splits the characters 11 bits between - the bottom 5 and 6 bits of the bytes. We need 8 bits to index into - pages, 3 bits to add to that index and 5 bits to generate the mask. -*/ -#define UTF8_GET_NAMING2(pages, byte) \ - (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ - + ((((byte)[0]) & 3) << 1) \ - + ((((byte)[1]) >> 5) & 1)] \ - & (1 << (((byte)[1]) & 0x1F))) - -/* A 3 byte UTF-8 representation splits the characters 16 bits between - the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index - into pages, 3 bits to add to that index and 5 bits to generate the - mask. -*/ -#define UTF8_GET_NAMING3(pages, byte) \ - (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ - + ((((byte)[1]) >> 2) & 0xF)] \ - << 3) \ - + ((((byte)[1]) & 3) << 1) \ - + ((((byte)[2]) >> 5) & 1)] \ - & (1 << (((byte)[2]) & 0x1F))) - -#define UTF8_GET_NAMING(pages, p, n) \ - ((n) == 2 \ - ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ - : ((n) == 3 \ - ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ - : 0)) - -/* Detection of invalid UTF-8 sequences is based on Table 3.1B - of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/ - with the additional restriction of not allowing the Unicode - code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE). - Implementation details: - (A & 0x80) == 0 means A < 0x80 - and - (A & 0xC0) == 0xC0 means A > 0xBF -*/ - -#define UTF8_INVALID2(p) \ - ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0) - -#define UTF8_INVALID3(p) \ - (((p)[2] & 0x80) == 0 \ - || \ - ((*p) == 0xEF && (p)[1] == 0xBF \ - ? \ - (p)[2] > 0xBD \ - : \ - ((p)[2] & 0xC0) == 0xC0) \ - || \ - ((*p) == 0xE0 \ - ? \ - (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0))) - -#define UTF8_INVALID4(p) \ - (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \ - || \ - ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \ - || \ - ((*p) == 0xF0 \ - ? \ - (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) - -static int FASTCALL -isNever(const ENCODING *enc, const char *p) -{ - return 0; -} - -static int FASTCALL -utf8_isName2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); -} - -static int FASTCALL -utf8_isName3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); -} - -#define utf8_isName4 isNever - -static int FASTCALL -utf8_isNmstrt2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); -} - -static int FASTCALL -utf8_isNmstrt3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); -} - -#define utf8_isNmstrt4 isNever - -static int FASTCALL -utf8_isInvalid2(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID2((const unsigned char *)p); -} - -static int FASTCALL -utf8_isInvalid3(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID3((const unsigned char *)p); -} - -static int FASTCALL -utf8_isInvalid4(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID4((const unsigned char *)p); -} - -struct normal_encoding { - ENCODING enc; - unsigned char type[256]; -#ifdef XML_MIN_SIZE - int (FASTCALL *byteType)(const ENCODING *, const char *); - int (FASTCALL *isNameMin)(const ENCODING *, const char *); - int (FASTCALL *isNmstrtMin)(const ENCODING *, const char *); - int (FASTCALL *byteToAscii)(const ENCODING *, const char *); - int (FASTCALL *charMatches)(const ENCODING *, const char *, int); -#endif /* XML_MIN_SIZE */ - int (FASTCALL *isName2)(const ENCODING *, const char *); - int (FASTCALL *isName3)(const ENCODING *, const char *); - int (FASTCALL *isName4)(const ENCODING *, const char *); - int (FASTCALL *isNmstrt2)(const ENCODING *, const char *); - int (FASTCALL *isNmstrt3)(const ENCODING *, const char *); - int (FASTCALL *isNmstrt4)(const ENCODING *, const char *); - int (FASTCALL *isInvalid2)(const ENCODING *, const char *); - int (FASTCALL *isInvalid3)(const ENCODING *, const char *); - int (FASTCALL *isInvalid4)(const ENCODING *, const char *); -}; - -#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc)) - -#ifdef XML_MIN_SIZE - -#define STANDARD_VTABLE(E) \ - E ## byteType, \ - E ## isNameMin, \ - E ## isNmstrtMin, \ - E ## byteToAscii, \ - E ## charMatches, - -#else - -#define STANDARD_VTABLE(E) /* as nothing */ - -#endif - -#define NORMAL_VTABLE(E) \ - E ## isName2, \ - E ## isName3, \ - E ## isName4, \ - E ## isNmstrt2, \ - E ## isNmstrt3, \ - E ## isNmstrt4, \ - E ## isInvalid2, \ - E ## isInvalid3, \ - E ## isInvalid4 - -static int FASTCALL checkCharRefNumber(int); - -#include "xmltok_impl.h" -#include "ascii.h" - -#ifdef XML_MIN_SIZE -#define sb_isNameMin isNever -#define sb_isNmstrtMin isNever -#endif - -#ifdef XML_MIN_SIZE -#define MINBPC(enc) ((enc)->minBytesPerChar) -#else -/* minimum bytes per character */ -#define MINBPC(enc) 1 -#endif - -#define SB_BYTE_TYPE(enc, p) \ - (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) - -#ifdef XML_MIN_SIZE -static int FASTCALL -sb_byteType(const ENCODING *enc, const char *p) -{ - return SB_BYTE_TYPE(enc, p); -} -#define BYTE_TYPE(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteType(enc, p)) -#else -#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) -#endif - -#ifdef XML_MIN_SIZE -#define BYTE_TO_ASCII(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p)) -static int FASTCALL -sb_byteToAscii(const ENCODING *enc, const char *p) -{ - return *p; -} -#else -#define BYTE_TO_ASCII(enc, p) (*(p)) -#endif - -#define IS_NAME_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p)) -#define IS_NMSTRT_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p)) -#define IS_INVALID_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p)) - -#ifdef XML_MIN_SIZE -#define IS_NAME_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p)) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p)) -#else -#define IS_NAME_CHAR_MINBPC(enc, p) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) -#endif - -#ifdef XML_MIN_SIZE -#define CHAR_MATCHES(enc, p, c) \ - (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c)) -static int FASTCALL -sb_charMatches(const ENCODING *enc, const char *p, int c) -{ - return *p == c; -} -#else -/* c is an ASCII character */ -#define CHAR_MATCHES(enc, p, c) (*(p) == c) -#endif - -#define PREFIX(ident) normal_ ## ident -#include "xmltok_impl.c" - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ - UTF8_cval1 = 0x00, - UTF8_cval2 = 0xc0, - UTF8_cval3 = 0xe0, - UTF8_cval4 = 0xf0 -}; - -static void FASTCALL -utf8_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - char *to; - const char *from; - if (fromLim - *fromP > toLim - *toP) { - /* Avoid copying partial characters. */ - for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) - if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) - break; - } - for (to = *toP, from = *fromP; from != fromLim; from++, to++) - *to = *from; - *fromP = from; - *toP = to; -} - -static void FASTCALL -utf8_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - unsigned short *to = *toP; - const char *from = *fromP; - while (from != fromLim && to != toLim) { - switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { - case BT_LEAD2: - *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); - from += 2; - break; - case BT_LEAD3: - *to++ = (unsigned short)(((from[0] & 0xf) << 12) - | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); - from += 3; - break; - case BT_LEAD4: - { - unsigned long n; - if (to + 1 == toLim) - goto after; - n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) - | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); - n -= 0x10000; - to[0] = (unsigned short)((n >> 10) | 0xD800); - to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); - to += 2; - from += 4; - } - break; - default: - *to++ = *from++; - break; - } - } -after: - *fromP = from; - *toP = to; -} - -#ifdef XML_NS -static const struct normal_encoding utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; -#endif - -static const struct normal_encoding utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#ifdef XML_NS - -static const struct normal_encoding internal_utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "iasciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#endif - -static const struct normal_encoding internal_utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -static void FASTCALL -latin1_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - for (;;) { - unsigned char c; - if (*fromP == fromLim) - break; - c = (unsigned char)**fromP; - if (c & 0x80) { - if (toLim - *toP < 2) - break; - *(*toP)++ = (char)((c >> 6) | UTF8_cval2); - *(*toP)++ = (char)((c & 0x3f) | 0x80); - (*fromP)++; - } - else { - if (*toP == toLim) - break; - *(*toP)++ = *(*fromP)++; - } - } -} - -static void FASTCALL -latin1_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = (unsigned char)*(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding latin1_encoding_ns = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding latin1_encoding = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -static void FASTCALL -ascii_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = *(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding ascii_encoding_ns = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding ascii_encoding = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -static int FASTCALL -unicode_byte_type(char hi, char lo) -{ - switch ((unsigned char)hi) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - return BT_LEAD4; - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return BT_TRAIL; - case 0xFF: - switch ((unsigned char)lo) { - case 0xFF: - case 0xFE: - return BT_NONXML; - } - break; - } - return BT_NONASCII; -} - -#define DEFINE_UTF16_TO_UTF8(E) \ -static void FASTCALL \ -E ## toUtf8(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - char **toP, const char *toLim) \ -{ \ - const char *from; \ - for (from = *fromP; from != fromLim; from += 2) { \ - int plane; \ - unsigned char lo2; \ - unsigned char lo = GET_LO(from); \ - unsigned char hi = GET_HI(from); \ - switch (hi) { \ - case 0: \ - if (lo < 0x80) { \ - if (*toP == toLim) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = lo; \ - break; \ - } \ - /* fall through */ \ - case 0x1: case 0x2: case 0x3: \ - case 0x4: case 0x5: case 0x6: case 0x7: \ - if (toLim - *toP < 2) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - default: \ - if (toLim - *toP < 3) { \ - *fromP = from; \ - return; \ - } \ - /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ - *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ - *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ - if (toLim - *toP < 4) { \ - *fromP = from; \ - return; \ - } \ - plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ - *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ - *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ - from += 2; \ - lo2 = GET_LO(from); \ - *(*toP)++ = (((lo & 0x3) << 4) \ - | ((GET_HI(from) & 0x3) << 2) \ - | (lo2 >> 6) \ - | 0x80); \ - *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ - break; \ - } \ - } \ - *fromP = from; \ -} - -#define DEFINE_UTF16_TO_UTF16(E) \ -static void FASTCALL \ -E ## toUtf16(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - unsigned short **toP, const unsigned short *toLim) \ -{ \ - /* Avoid copying first half only of surrogate */ \ - if (fromLim - *fromP > ((toLim - *toP) << 1) \ - && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ - fromLim -= 2; \ - for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ - *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ -} - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) -#define GET_LO(ptr) ((unsigned char)(ptr)[0]) -#define GET_HI(ptr) ((unsigned char)(ptr)[1]) - -DEFINE_UTF16_TO_UTF8(little2_) -DEFINE_UTF16_TO_UTF16(little2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) -#define GET_LO(ptr) ((unsigned char)(ptr)[1]) -#define GET_HI(ptr) ((unsigned char)(ptr)[0]) - -DEFINE_UTF16_TO_UTF8(big2_) -DEFINE_UTF16_TO_UTF16(big2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define LITTLE2_BYTE_TYPE(enc, p) \ - ((p)[1] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ - : unicode_byte_type((p)[1], (p)[0])) -#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) -#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) -#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) -#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) - -#ifdef XML_MIN_SIZE - -static int FASTCALL -little2_byteType(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TYPE(enc, p); -} - -static int FASTCALL -little2_byteToAscii(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TO_ASCII(enc, p); -} - -static int FASTCALL -little2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return LITTLE2_CHAR_MATCHES(enc, p, c); -} - -static int FASTCALL -little2_isNameMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static int FASTCALL -little2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) little2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#include "xmltok_impl.c" - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding little2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding little2_encoding = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#if BYTEORDER != 4321 - -#ifdef XML_NS - -static const struct normal_encoding internal_little2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding internal_little2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - - -#define BIG2_BYTE_TYPE(enc, p) \ - ((p)[0] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ - : unicode_byte_type((p)[0], (p)[1])) -#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) -#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) -#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) -#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) - -#ifdef XML_MIN_SIZE - -static int FASTCALL -big2_byteType(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TYPE(enc, p); -} - -static int FASTCALL -big2_byteToAscii(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TO_ASCII(enc, p); -} - -static int FASTCALL -big2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return BIG2_CHAR_MATCHES(enc, p, c); -} - -static int FASTCALL -big2_isNameMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static int FASTCALL -big2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) big2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#include "xmltok_impl.c" - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding big2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding big2_encoding = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#if BYTEORDER != 1234 - -#ifdef XML_NS - -static const struct normal_encoding internal_big2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding internal_big2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -#undef PREFIX - -static int FASTCALL -streqci(const char *s1, const char *s2) -{ - for (;;) { - char c1 = *s1++; - char c2 = *s2++; - if (ASCII_a <= c1 && c1 <= ASCII_z) - c1 += ASCII_A - ASCII_a; - if (ASCII_a <= c2 && c2 <= ASCII_z) - c2 += ASCII_A - ASCII_a; - if (c1 != c2) - return 0; - if (!c1) - break; - } - return 1; -} - -static void FASTCALL -initUpdatePosition(const ENCODING *enc, const char *ptr, - const char *end, POSITION *pos) -{ - normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); -} - -static int FASTCALL -toAscii(const ENCODING *enc, const char *ptr, const char *end) -{ - char buf[1]; - char *p = buf; - XmlUtf8Convert(enc, &ptr, end, &p, p + 1); - if (p == buf) - return -1; - else - return buf[0]; -} - -static int FASTCALL -isSpace(int c) -{ - switch (c) { - case 0x20: - case 0xD: - case 0xA: - case 0x9: - return 1; - } - return 0; -} - -/* Return 1 if there's just optional white space or there's an S - followed by name=val. -*/ -static int FASTCALL -parsePseudoAttribute(const ENCODING *enc, - const char *ptr, - const char *end, - const char **namePtr, - const char **nameEndPtr, - const char **valPtr, - const char **nextTokPtr) -{ - int c; - char open; - if (ptr == end) { - *namePtr = NULL; - return 1; - } - if (!isSpace(toAscii(enc, ptr, end))) { - *nextTokPtr = ptr; - return 0; - } - do { - ptr += enc->minBytesPerChar; - } while (isSpace(toAscii(enc, ptr, end))); - if (ptr == end) { - *namePtr = NULL; - return 1; - } - *namePtr = ptr; - for (;;) { - c = toAscii(enc, ptr, end); - if (c == -1) { - *nextTokPtr = ptr; - return 0; - } - if (c == ASCII_EQUALS) { - *nameEndPtr = ptr; - break; - } - if (isSpace(c)) { - *nameEndPtr = ptr; - do { - ptr += enc->minBytesPerChar; - } while (isSpace(c = toAscii(enc, ptr, end))); - if (c != ASCII_EQUALS) { - *nextTokPtr = ptr; - return 0; - } - break; - } - ptr += enc->minBytesPerChar; - } - if (ptr == *namePtr) { - *nextTokPtr = ptr; - return 0; - } - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - while (isSpace(c)) { - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - } - if (c != ASCII_QUOT && c != ASCII_APOS) { - *nextTokPtr = ptr; - return 0; - } - open = (char)c; - ptr += enc->minBytesPerChar; - *valPtr = ptr; - for (;; ptr += enc->minBytesPerChar) { - c = toAscii(enc, ptr, end); - if (c == open) - break; - if (!(ASCII_a <= c && c <= ASCII_z) - && !(ASCII_A <= c && c <= ASCII_Z) - && !(ASCII_0 <= c && c <= ASCII_9) - && c != ASCII_PERIOD - && c != ASCII_MINUS - && c != ASCII_UNDERSCORE) { - *nextTokPtr = ptr; - return 0; - } - } - *nextTokPtr = ptr + enc->minBytesPerChar; - return 1; -} - -static const char KW_version[] = { - ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0' -}; - -static const char KW_encoding[] = { - ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0' -}; - -static const char KW_standalone[] = { - ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, - ASCII_n, ASCII_e, '\0' -}; - -static const char KW_yes[] = { - ASCII_y, ASCII_e, ASCII_s, '\0' -}; - -static const char KW_no[] = { - ASCII_n, ASCII_o, '\0' -}; - -static int -doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, - const char *, - const char *), - int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - const char *val = NULL; - const char *name = NULL; - const char *nameEnd = NULL; - ptr += 5 * enc->minBytesPerChar; - end -= 2 * enc->minBytesPerChar; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) - || !name) { - *badPtr = ptr; - return 0; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { - if (!isGeneralTextEntity) { - *badPtr = name; - return 0; - } - } - else { - if (versionPtr) - *versionPtr = val; - if (versionEndPtr) - *versionEndPtr = ptr; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) { - if (isGeneralTextEntity) { - /* a TextDecl must have an EncodingDecl */ - *badPtr = ptr; - return 0; - } - return 1; - } - } - if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) { - int c = toAscii(enc, val, end); - if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) { - *badPtr = val; - return 0; - } - if (encodingName) - *encodingName = val; - if (encoding) - *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) - return 1; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) - || isGeneralTextEntity) { - *badPtr = name; - return 0; - } - if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) { - if (standalone) - *standalone = 1; - } - else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { - if (standalone) - *standalone = 0; - } - else { - *badPtr = val; - return 0; - } - while (isSpace(toAscii(enc, ptr, end))) - ptr += enc->minBytesPerChar; - if (ptr != end) { - *badPtr = ptr; - return 0; - } - return 1; -} - -static int FASTCALL -checkCharRefNumber(int result) -{ - switch (result >> 8) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return -1; - case 0: - if (latin1_encoding.type[result] == BT_NONXML) - return -1; - break; - case 0xFF: - if (result == 0xFFFE || result == 0xFFFF) - return -1; - break; - } - return result; -} - -int -XmlUtf8Encode(int c, char *buf) -{ - enum { - /* minN is minimum legal resulting value for N byte sequence */ - min2 = 0x80, - min3 = 0x800, - min4 = 0x10000 - }; - - if (c < 0) - return 0; - if (c < min2) { - buf[0] = (char)(c | UTF8_cval1); - return 1; - } - if (c < min3) { - buf[0] = (char)((c >> 6) | UTF8_cval2); - buf[1] = (char)((c & 0x3f) | 0x80); - return 2; - } - if (c < min4) { - buf[0] = (char)((c >> 12) | UTF8_cval3); - buf[1] = (char)(((c >> 6) & 0x3f) | 0x80); - buf[2] = (char)((c & 0x3f) | 0x80); - return 3; - } - if (c < 0x110000) { - buf[0] = (char)((c >> 18) | UTF8_cval4); - buf[1] = (char)(((c >> 12) & 0x3f) | 0x80); - buf[2] = (char)(((c >> 6) & 0x3f) | 0x80); - buf[3] = (char)((c & 0x3f) | 0x80); - return 4; - } - return 0; -} - -int -XmlUtf16Encode(int charNum, unsigned short *buf) -{ - if (charNum < 0) - return 0; - if (charNum < 0x10000) { - buf[0] = (unsigned short)charNum; - return 1; - } - if (charNum < 0x110000) { - charNum -= 0x10000; - buf[0] = (unsigned short)((charNum >> 10) + 0xD800); - buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00); - return 2; - } - return 0; -} - -struct unknown_encoding { - struct normal_encoding normal; - int (*convert)(void *userData, const char *p); - void *userData; - unsigned short utf16[256]; - char utf8[256][4]; -}; - -#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *) (enc)) - -int -XmlSizeOfUnknownEncoding(void) -{ - return sizeof(struct unknown_encoding); -} - -static int FASTCALL -unknown_isName(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); -} - -static int FASTCALL -unknown_isNmstrt(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); -} - -static int FASTCALL -unknown_isInvalid(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; -} - -static void FASTCALL -unknown_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - char buf[XML_UTF8_ENCODE_MAX]; - for (;;) { - const char *utf8; - int n; - if (*fromP == fromLim) - break; - utf8 = uenc->utf8[(unsigned char)**fromP]; - n = *utf8++; - if (n == 0) { - int c = uenc->convert(uenc->userData, *fromP); - n = XmlUtf8Encode(c, buf); - if (n > toLim - *toP) - break; - utf8 = buf; - *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2)); - } - else { - if (n > toLim - *toP) - break; - (*fromP)++; - } - do { - *(*toP)++ = *utf8++; - } while (--n != 0); - } -} - -static void FASTCALL -unknown_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - while (*fromP != fromLim && *toP != toLim) { - unsigned short c = uenc->utf16[(unsigned char)**fromP]; - if (c == 0) { - c = (unsigned short) - uenc->convert(uenc->userData, *fromP); - *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2)); - } - else - (*fromP)++; - *(*toP)++ = c; - } -} - -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - int (*convert)(void *userData, const char *p), - void *userData) -{ - int i; - struct unknown_encoding *e = mem; - for (i = 0; i < (int)sizeof(struct normal_encoding); i++) - ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; - for (i = 0; i < 128; i++) - if (latin1_encoding.type[i] != BT_OTHER - && latin1_encoding.type[i] != BT_NONXML - && table[i] != i) - return 0; - for (i = 0; i < 256; i++) { - int c = table[i]; - if (c == -1) { - e->normal.type[i] = BT_MALFORM; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else if (c < 0) { - if (c < -4) - return 0; - e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); - e->utf8[i][0] = 0; - e->utf16[i] = 0; - } - else if (c < 0x80) { - if (latin1_encoding.type[c] != BT_OTHER - && latin1_encoding.type[c] != BT_NONXML - && c != i) - return 0; - e->normal.type[i] = latin1_encoding.type[c]; - e->utf8[i][0] = 1; - e->utf8[i][1] = (char)c; - e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c); - } - else if (checkCharRefNumber(c) < 0) { - e->normal.type[i] = BT_NONXML; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else { - if (c > 0xFFFF) - return 0; - if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NMSTRT; - else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NAME; - else - e->normal.type[i] = BT_OTHER; - e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); - e->utf16[i] = (unsigned short)c; - } - } - e->userData = userData; - e->convert = convert; - if (convert) { - e->normal.isName2 = unknown_isName; - e->normal.isName3 = unknown_isName; - e->normal.isName4 = unknown_isName; - e->normal.isNmstrt2 = unknown_isNmstrt; - e->normal.isNmstrt3 = unknown_isNmstrt; - e->normal.isNmstrt4 = unknown_isNmstrt; - e->normal.isInvalid2 = unknown_isInvalid; - e->normal.isInvalid3 = unknown_isInvalid; - e->normal.isInvalid4 = unknown_isInvalid; - } - e->normal.enc.utf8Convert = unknown_toUtf8; - e->normal.enc.utf16Convert = unknown_toUtf16; - return &(e->normal.enc); -} - -/* If this enumeration is changed, getEncodingIndex and encodings -must also be changed. */ -enum { - UNKNOWN_ENC = -1, - ISO_8859_1_ENC = 0, - US_ASCII_ENC, - UTF_8_ENC, - UTF_16_ENC, - UTF_16BE_ENC, - UTF_16LE_ENC, - /* must match encodingNames up to here */ - NO_ENC -}; - -static const char KW_ISO_8859_1[] = { - ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, - ASCII_MINUS, ASCII_1, '\0' -}; -static const char KW_US_ASCII[] = { - ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, - '\0' -}; -static const char KW_UTF_8[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0' -}; -static const char KW_UTF_16[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0' -}; -static const char KW_UTF_16BE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, - '\0' -}; -static const char KW_UTF_16LE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, - '\0' -}; - -static int FASTCALL -getEncodingIndex(const char *name) -{ - static const char *encodingNames[] = { - KW_ISO_8859_1, - KW_US_ASCII, - KW_UTF_8, - KW_UTF_16, - KW_UTF_16BE, - KW_UTF_16LE, - }; - int i; - if (name == NULL) - return NO_ENC; - for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++) - if (streqci(name, encodingNames[i])) - return i; - return UNKNOWN_ENC; -} - -/* For binary compatibility, we store the index of the encoding - specified at initialization in the isUtf16 member. -*/ - -#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16) -#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i) - -/* This is what detects the encoding. encodingTable maps from - encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of - the external (protocol) specified encoding; state is - XML_CONTENT_STATE if we're parsing an external text entity, and - XML_PROLOG_STATE otherwise. -*/ - - -static int FASTCALL -initScan(const ENCODING **encodingTable, - const INIT_ENCODING *enc, - int state, - const char *ptr, - const char *end, - const char **nextTokPtr) -{ - const ENCODING **encPtr; - - if (ptr == end) - return XML_TOK_NONE; - encPtr = enc->encPtr; - if (ptr + 1 == end) { - /* only a single byte available for auto-detection */ -#ifndef XML_DTD /* FIXME */ - /* a well-formed document entity must have more than one byte */ - if (state != XML_CONTENT_STATE) - return XML_TOK_PARTIAL; -#endif - /* so we're parsing an external text entity... */ - /* if UTF-16 was externally specified, then we need at least 2 bytes */ - switch (INIT_ENC_INDEX(enc)) { - case UTF_16_ENC: - case UTF_16LE_ENC: - case UTF_16BE_ENC: - return XML_TOK_PARTIAL; - } - switch ((unsigned char)*ptr) { - case 0xFE: - case 0xFF: - case 0xEF: /* possibly first byte of UTF-8 BOM */ - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - /* fall through */ - case 0x00: - case 0x3C: - return XML_TOK_PARTIAL; - } - } - else { - switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { - case 0xFEFF: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XML_TOK_BOM; - /* 00 3C is handled in the default case */ - case 0x3C00: - if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC - || INIT_ENC_INDEX(enc) == UTF_16_ENC) - && state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - case 0xFFFE: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XML_TOK_BOM; - case 0xEFBB: - /* Maybe a UTF-8 BOM (EF BB BF) */ - /* If there's an explicitly specified (external) encoding - of ISO-8859-1 or some flavour of UTF-16 - and this is an external text entity, - don't look for the BOM, - because it might be a legal data. - */ - if (state == XML_CONTENT_STATE) { - int e = INIT_ENC_INDEX(enc); - if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC - || e == UTF_16LE_ENC || e == UTF_16_ENC) - break; - } - if (ptr + 2 == end) - return XML_TOK_PARTIAL; - if ((unsigned char)ptr[2] == 0xBF) { - *nextTokPtr = ptr + 3; - *encPtr = encodingTable[UTF_8_ENC]; - return XML_TOK_BOM; - } - break; - default: - if (ptr[0] == '\0') { - /* 0 isn't a legal data character. Furthermore a document - entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 if it it's an - external parsed general entity that's labelled as - UTF-16LE. - */ - if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC) - break; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - else if (ptr[1] == '\0') { - /* We could recover here in the case: - - parsing an external entity - - second byte is 0 - - no externally specified encoding - - no encoding declaration - by assuming UTF-16LE. But we don't, because this would mean when - presented just with a single byte, we couldn't reliably determine - whether we needed further bytes. - */ - if (state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - break; - } - } - *encPtr = encodingTable[INIT_ENC_INDEX(enc)]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); -} - - -#define NS(x) x -#define ns(x) x -#include "xmltok_ns.c" -#undef NS -#undef ns - -#ifdef XML_NS - -#define NS(x) x ## NS -#define ns(x) x ## _ns - -#include "xmltok_ns.c" - -#undef NS -#undef ns - -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - int (*convert)(void *userData, const char *p), - void *userData) -{ - ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); - if (enc) - ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON; - return enc; -} - -#endif /* XML_NS */ diff --git a/bundle/expat/xmltok.h b/bundle/expat/xmltok.h deleted file mode 100644 index 55cc181e7b..0000000000 --- a/bundle/expat/xmltok.h +++ /dev/null @@ -1,312 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlTok_INCLUDED -#define XmlTok_INCLUDED 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* The following token may be returned by XmlContentTok */ -#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be - start of illegal ]]> sequence */ -/* The following tokens may be returned by both XmlPrologTok and - XmlContentTok. -*/ -#define XML_TOK_NONE -4 /* The string to be scanned is empty */ -#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; - might be part of CRLF sequence */ -#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ -#define XML_TOK_PARTIAL -1 /* only part of a token */ -#define XML_TOK_INVALID 0 - -/* The following tokens are returned by XmlContentTok; some are also - returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. -*/ -#define XML_TOK_START_TAG_WITH_ATTS 1 -#define XML_TOK_START_TAG_NO_ATTS 2 -#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ -#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 -#define XML_TOK_END_TAG 5 -#define XML_TOK_DATA_CHARS 6 -#define XML_TOK_DATA_NEWLINE 7 -#define XML_TOK_CDATA_SECT_OPEN 8 -#define XML_TOK_ENTITY_REF 9 -#define XML_TOK_CHAR_REF 10 /* numeric character reference */ - -/* The following tokens may be returned by both XmlPrologTok and - XmlContentTok. -*/ -#define XML_TOK_PI 11 /* processing instruction */ -#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ -#define XML_TOK_COMMENT 13 -#define XML_TOK_BOM 14 /* Byte order mark */ - -/* The following tokens are returned only by XmlPrologTok */ -#define XML_TOK_PROLOG_S 15 -#define XML_TOK_DECL_OPEN 16 /* */ -#define XML_TOK_NAME 18 -#define XML_TOK_NMTOKEN 19 -#define XML_TOK_POUND_NAME 20 /* #name */ -#define XML_TOK_OR 21 /* | */ -#define XML_TOK_PERCENT 22 -#define XML_TOK_OPEN_PAREN 23 -#define XML_TOK_CLOSE_PAREN 24 -#define XML_TOK_OPEN_BRACKET 25 -#define XML_TOK_CLOSE_BRACKET 26 -#define XML_TOK_LITERAL 27 -#define XML_TOK_PARAM_ENTITY_REF 28 -#define XML_TOK_INSTANCE_START 29 - -/* The following occur only in element type declarations */ -#define XML_TOK_NAME_QUESTION 30 /* name? */ -#define XML_TOK_NAME_ASTERISK 31 /* name* */ -#define XML_TOK_NAME_PLUS 32 /* name+ */ -#define XML_TOK_COND_SECT_OPEN 33 /* */ -#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ -#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ -#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ -#define XML_TOK_COMMA 38 - -/* The following token is returned only by XmlAttributeValueTok */ -#define XML_TOK_ATTRIBUTE_VALUE_S 39 - -/* The following token is returned only by XmlCdataSectionTok */ -#define XML_TOK_CDATA_SECT_CLOSE 40 - -/* With namespace processing this is returned by XmlPrologTok for a - name with a colon. -*/ -#define XML_TOK_PREFIXED_NAME 41 - -#ifdef XML_DTD -#define XML_TOK_IGNORE_SECT 42 -#endif /* XML_DTD */ - -#ifdef XML_DTD -#define XML_N_STATES 4 -#else /* not XML_DTD */ -#define XML_N_STATES 3 -#endif /* not XML_DTD */ - -#define XML_PROLOG_STATE 0 -#define XML_CONTENT_STATE 1 -#define XML_CDATA_SECTION_STATE 2 -#ifdef XML_DTD -#define XML_IGNORE_SECTION_STATE 3 -#endif /* XML_DTD */ - -#define XML_N_LITERAL_TYPES 2 -#define XML_ATTRIBUTE_VALUE_LITERAL 0 -#define XML_ENTITY_VALUE_LITERAL 1 - -/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ -#define XML_UTF8_ENCODE_MAX 4 -/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ -#define XML_UTF16_ENCODE_MAX 2 - -typedef struct position { - /* first line and first column are 0 not 1 */ - unsigned long lineNumber; - unsigned long columnNumber; -} POSITION; - -typedef struct { - const char *name; - const char *valuePtr; - const char *valueEnd; - char normalized; -} ATTRIBUTE; - -struct encoding; -typedef struct encoding ENCODING; - -typedef int (FASTCALL *SCANNER)(const ENCODING *, - const char *, - const char *, - const char **); - -struct encoding { - SCANNER scanners[XML_N_STATES]; - SCANNER literalScanners[XML_N_LITERAL_TYPES]; - int (FASTCALL *sameName)(const ENCODING *, - const char *, - const char *); - int (FASTCALL *nameMatchesAscii)(const ENCODING *, - const char *, - const char *, - const char *); - int (FASTCALL *nameLength)(const ENCODING *, const char *); - const char *(FASTCALL *skipS)(const ENCODING *, const char *); - int (FASTCALL *getAtts)(const ENCODING *enc, - const char *ptr, - int attsMax, - ATTRIBUTE *atts); - int (FASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); - int (FASTCALL *predefinedEntityName)(const ENCODING *, - const char *, - const char *); - void (FASTCALL *updatePosition)(const ENCODING *, - const char *ptr, - const char *end, - POSITION *); - int (FASTCALL *isPublicId)(const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr); - void (FASTCALL *utf8Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - char **toP, - const char *toLim); - void (FASTCALL *utf16Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - unsigned short **toP, - const unsigned short *toLim); - int minBytesPerChar; - char isUtf8; - char isUtf16; -}; - -/* Scan the string starting at ptr until the end of the next complete - token, but do not scan past eptr. Return an integer giving the - type of token. - - Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. - - Return XML_TOK_PARTIAL when the string does not contain a complete - token; nextTokPtr will not be set. - - Return XML_TOK_INVALID when the string does not start a valid - token; nextTokPtr will be set to point to the character which made - the token invalid. - - Otherwise the string starts with a valid token; nextTokPtr will be - set to point to the character following the end of that token. - - Each data character counts as a single token, but adjacent data - characters may be returned together. Similarly for characters in - the prolog outside literals, comments and processing instructions. -*/ - - -#define XmlTok(enc, state, ptr, end, nextTokPtr) \ - (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) - -#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) - -#define XmlContentTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) - -#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) - -#ifdef XML_DTD - -#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) - -#endif /* XML_DTD */ - -/* This is used for performing a 2nd-level tokenization on the content - of a literal that has already been returned by XmlTok. -*/ -#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ - (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) - -#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) - -#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ - (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) - -#define XmlNameLength(enc, ptr) \ - (((enc)->nameLength)(enc, ptr)) - -#define XmlSkipS(enc, ptr) \ - (((enc)->skipS)(enc, ptr)) - -#define XmlGetAttributes(enc, ptr, attsMax, atts) \ - (((enc)->getAtts)(enc, ptr, attsMax, atts)) - -#define XmlCharRefNumber(enc, ptr) \ - (((enc)->charRefNumber)(enc, ptr)) - -#define XmlPredefinedEntityName(enc, ptr, end) \ - (((enc)->predefinedEntityName)(enc, ptr, end)) - -#define XmlUpdatePosition(enc, ptr, end, pos) \ - (((enc)->updatePosition)(enc, ptr, end, pos)) - -#define XmlIsPublicId(enc, ptr, end, badPtr) \ - (((enc)->isPublicId)(enc, ptr, end, badPtr)) - -#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) - -#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) - -typedef struct { - ENCODING initEnc; - const ENCODING **encPtr; -} INIT_ENCODING; - -int XmlParseXmlDecl(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); - -int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncoding(void); -const ENCODING *XmlGetUtf16InternalEncoding(void); -int XmlUtf8Encode(int charNumber, char *buf); -int XmlUtf16Encode(int charNumber, unsigned short *buf); - -int XmlSizeOfUnknownEncoding(void); -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - int (*conv)(void *userData, const char *p), - void *userData); - -int XmlParseXmlDeclNS(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); -int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncodingNS(void); -const ENCODING *XmlGetUtf16InternalEncodingNS(void); -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - int (*conv)(void *userData, const char *p), - void *userData); -#ifdef __cplusplus -} -#endif - -#endif /* not XmlTok_INCLUDED */ diff --git a/bundle/expat/xmltok_impl.c b/bundle/expat/xmltok_impl.c deleted file mode 100644 index be3d1d31ca..0000000000 --- a/bundle/expat/xmltok_impl.c +++ /dev/null @@ -1,1778 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef IS_INVALID_CHAR -#define IS_INVALID_CHAR(enc, ptr, n) (0) -#endif - -#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_INVALID_CHAR(enc, ptr, n)) { \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define INVALID_CASES(ptr, nextTokPtr) \ - INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ - case BT_NONXML: \ - case BT_MALFORM: \ - case BT_TRAIL: \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; - -#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NAME_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - case BT_DIGIT: \ - case BT_NAME: \ - case BT_MINUS: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) - -#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) - -#ifndef PREFIX -#define PREFIX(ident) ident -#endif - -/* ptr points to character following " */ - switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { - case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - /* fall through */ - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DECL_OPEN; - case BT_NMSTRT: - case BT_HEX: - ptr += MINBPC(enc); - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static int FASTCALL -PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, - const char *end, int *tokPtr) -{ - int upper = 0; - *tokPtr = XML_TOK_PI; - if (end - ptr != MINBPC(enc)*3) - return 1; - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_x: - break; - case ASCII_X: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_m: - break; - case ASCII_M: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - break; - case ASCII_L: - upper = 1; - break; - default: - return 1; - } - if (upper) - return 0; - *tokPtr = XML_TOK_XML_DECL; - return 1; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CDATA_SECT_CLOSE; - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - case BT_RSQB: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_LT: - return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_AMP: - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_RSQB: - if (ptr + MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { - ptr += MINBPC(enc); - break; - } - if (ptr + 2*MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { - ptr += MINBPC(enc); - break; - } - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_INVALID; - } - } - /* fall through */ - case BT_AMP: - case BT_LT: - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following "%" */ - -static int FASTCALL -PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_PERCENT; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_SEMI: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_PARAM_ENTITY_REF; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static int FASTCALL -PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_CR: case BT_LF: case BT_S: - case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: - *nextTokPtr = ptr; - return XML_TOK_POUND_NAME; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -XML_TOK_POUND_NAME; -} - -static int FASTCALL -PREFIX(scanLit)(int open, const ENCODING *enc, - const char *ptr, const char *end, - const char **nextTokPtr) -{ - while (ptr != end) { - int t = BYTE_TYPE(enc, ptr); - switch (t) { - INVALID_CASES(ptr, nextTokPtr) - case BT_QUOT: - case BT_APOS: - ptr += MINBPC(enc); - if (t != open) - break; - if (ptr == end) - return -XML_TOK_LITERAL; - *nextTokPtr = ptr; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_CR: case BT_LF: - case BT_GT: case BT_PERCNT: case BT_LSQB: - return XML_TOK_LITERAL; - default: - return XML_TOK_INVALID; - } - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -static int FASTCALL -PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - int tok; - if (ptr == end) - return XML_TOK_NONE; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_QUOT: - return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_APOS: - return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_LT: - { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - case BT_EXCL: - return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_QUEST: - return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_NMSTRT: - case BT_HEX: - case BT_NONASCII: - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - *nextTokPtr = ptr - MINBPC(enc); - return XML_TOK_INSTANCE_START; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - case BT_CR: - if (ptr + MINBPC(enc) == end) { - *nextTokPtr = end; - /* indicate that this might be part of a CR/LF pair */ - return -XML_TOK_PROLOG_S; - } - /* fall through */ - case BT_S: case BT_LF: - for (;;) { - ptr += MINBPC(enc); - if (ptr == end) - break; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_LF: - break; - case BT_CR: - /* don't split CR/LF pair */ - if (ptr + MINBPC(enc) != end) - break; - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - } - } - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - case BT_PERCNT: - return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_COMMA: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_COMMA; - case BT_LSQB: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_BRACKET; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_BRACKET; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if (ptr + MINBPC(enc) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_COND_SECT_CLOSE; - } - } - *nextTokPtr = ptr; - return XML_TOK_CLOSE_BRACKET; - case BT_LPAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_PAREN; - case BT_RPAR: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_PAREN; - switch (BYTE_TYPE(enc, ptr)) { - case BT_AST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_ASTERISK; - case BT_QUEST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_QUESTION; - case BT_PLUS: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_PLUS; - case BT_CR: case BT_LF: case BT_S: - case BT_GT: case BT_COMMA: case BT_VERBAR: - case BT_RPAR: - *nextTokPtr = ptr; - return XML_TOK_CLOSE_PAREN; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_VERBAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OR; - case BT_GT: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DECL_CLOSE; - case BT_NUM: - return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NAME; \ - break; \ - } \ - if (IS_NAME_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NMTOKEN; \ - break; \ - } \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NMSTRT: - case BT_HEX: - tok = XML_TOK_NAME; - ptr += MINBPC(enc); - break; - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: -#ifdef XML_NS - case BT_COLON: -#endif - tok = XML_TOK_NMTOKEN; - ptr += MINBPC(enc); - break; - case BT_NONASCII: - if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NAME; - break; - } - if (IS_NAME_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NMTOKEN; - break; - } - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_GT: case BT_RPAR: case BT_COMMA: - case BT_VERBAR: case BT_LSQB: case BT_PERCNT: - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return tok; -#ifdef XML_NS - case BT_COLON: - ptr += MINBPC(enc); - switch (tok) { - case XML_TOK_NAME: - if (ptr == end) - return XML_TOK_PARTIAL; - tok = XML_TOK_PREFIXED_NAME; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - default: - tok = XML_TOK_NMTOKEN; - break; - } - break; - case XML_TOK_PREFIXED_NAME: - tok = XML_TOK_NMTOKEN; - break; - } - break; -#endif - case BT_PLUS: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_PLUS; - case BT_AST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_ASTERISK; - case BT_QUEST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_QUESTION; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -tok; -} - -static int FASTCALL -PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LT: - /* this is for inside entity references */ - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_S: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_ATTRIBUTE_VALUE_S; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -static int FASTCALL -PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_PERCNT: - if (ptr == start) { - int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), - end, nextTokPtr); - return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -#ifdef XML_DTD - -static int FASTCALL -PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - int level = 0; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - end = ptr + n; - } - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - INVALID_CASES(ptr, nextTokPtr) - case BT_LT: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { - ++level; - ptr += MINBPC(enc); - } - } - break; - case BT_RSQB: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr += MINBPC(enc); - if (level == 0) { - *nextTokPtr = ptr; - return XML_TOK_IGNORE_SECT; - } - --level; - } - } - break; - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -#endif /* XML_DTD */ - -static int FASTCALL -PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, - const char **badPtr) -{ - ptr += MINBPC(enc); - end -= MINBPC(enc); - for (; ptr != end; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - case BT_HEX: - case BT_MINUS: - case BT_APOS: - case BT_LPAR: - case BT_RPAR: - case BT_PLUS: - case BT_COMMA: - case BT_SOL: - case BT_EQUALS: - case BT_QUEST: - case BT_CR: - case BT_LF: - case BT_SEMI: - case BT_EXCL: - case BT_AST: - case BT_PERCNT: - case BT_NUM: -#ifdef XML_NS - case BT_COLON: -#endif - break; - case BT_S: - if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) { - *badPtr = ptr; - return 0; - } - break; - case BT_NAME: - case BT_NMSTRT: - if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) - break; - default: - switch (BYTE_TO_ASCII(enc, ptr)) { - case 0x24: /* $ */ - case 0x40: /* @ */ - break; - default: - *badPtr = ptr; - return 0; - } - break; - } - } - return 1; -} - -/* This must only be called for a well-formed start-tag or empty - element tag. Returns the number of attributes. Pointers to the - first attsMax attributes are stored in atts. -*/ - -static int FASTCALL -PREFIX(getAtts)(const ENCODING *enc, const char *ptr, - int attsMax, ATTRIBUTE *atts) -{ - enum { other, inName, inValue } state = inName; - int nAtts = 0; - int open = 0; /* defined when state == inValue; - initialization just to shut up compilers */ - - for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { -#define START_NAME \ - if (state == other) { \ - if (nAtts < attsMax) { \ - atts[nAtts].name = ptr; \ - atts[nAtts].normalized = 1; \ - } \ - state = inName; \ - } -#define LEAD_CASE(n) \ - case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: - case BT_HEX: - START_NAME - break; -#undef START_NAME - case BT_QUOT: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_QUOT; - } - else if (open == BT_QUOT) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_APOS: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_APOS; - } - else if (open == BT_APOS) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_AMP: - if (nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_S: - if (state == inName) - state = other; - else if (state == inValue - && nAtts < attsMax - && atts[nAtts].normalized - && (ptr == atts[nAtts].valuePtr - || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE - || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE - || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) - atts[nAtts].normalized = 0; - break; - case BT_CR: case BT_LF: - /* This case ensures that the first attribute name is counted - Apart from that we could just change state on the quote. */ - if (state == inName) - state = other; - else if (state == inValue && nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_GT: - case BT_SOL: - if (state != inValue) - return nAtts; - break; - default: - break; - } - } - /* not reached */ -} - -static int FASTCALL -PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) -{ - int result = 0; - /* skip &# */ - ptr += 2*MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_x)) { - for (ptr += MINBPC(enc); - !CHAR_MATCHES(enc, ptr, ASCII_SEMI); - ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - switch (c) { - case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4: - case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9: - result <<= 4; - result |= (c - ASCII_0); - break; - case ASCII_A: case ASCII_B: case ASCII_C: - case ASCII_D: case ASCII_E: case ASCII_F: - result <<= 4; - result += 10 + (c - ASCII_A); - break; - case ASCII_a: case ASCII_b: case ASCII_c: - case ASCII_d: case ASCII_e: case ASCII_f: - result <<= 4; - result += 10 + (c - ASCII_a); - break; - } - if (result >= 0x110000) - return -1; - } - } - else { - for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - result *= 10; - result += (c - ASCII_0); - if (result >= 0x110000) - return -1; - } - } - return checkCharRefNumber(result); -} - -static int FASTCALL -PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, - const char *end) -{ - switch ((end - ptr)/MINBPC(enc)) { - case 2: - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) { - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - return ASCII_LT; - case ASCII_g: - return ASCII_GT; - } - } - break; - case 3: - if (CHAR_MATCHES(enc, ptr, ASCII_a)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_m)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) - return ASCII_AMP; - } - } - break; - case 4: - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_q: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_u)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_t)) - return ASCII_QUOT; - } - } - break; - case ASCII_a: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_s)) - return ASCII_APOS; - } - } - break; - } - } - return 0; -} - -static int FASTCALL -PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr1)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (*ptr1++ != *ptr2++) \ - return 0; - LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) -#undef LEAD_CASE - /* fall through */ - if (*ptr1++ != *ptr2++) - return 0; - break; - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 1) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 2) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 3) { - if (*ptr2++ != *ptr1++) - return 0; - } - } - } - break; - default: - if (MINBPC(enc) == 1 && *ptr1 == *ptr2) - return 1; - switch (BYTE_TYPE(enc, ptr2)) { - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - return 0; - default: - return 1; - } - } - } - /* not reached */ -} - -static int FASTCALL -PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, - const char *end1, const char *ptr2) -{ - for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { - if (ptr1 == end1) - return 0; - if (!CHAR_MATCHES(enc, ptr1, *ptr2)) - return 0; - } - return ptr1 == end1; -} - -static int FASTCALL -PREFIX(nameLength)(const ENCODING *enc, const char *ptr) -{ - const char *start = ptr; - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - ptr += MINBPC(enc); - break; - default: - return ptr - start; - } - } -} - -static const char * FASTCALL -PREFIX(skipS)(const ENCODING *enc, const char *ptr) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_LF: - case BT_CR: - case BT_S: - ptr += MINBPC(enc); - break; - default: - return ptr; - } - } -} - -static void FASTCALL -PREFIX(updatePosition)(const ENCODING *enc, - const char *ptr, - const char *end, - POSITION *pos) -{ - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_LF: - pos->columnNumber = (unsigned)-1; - pos->lineNumber++; - ptr += MINBPC(enc); - break; - case BT_CR: - pos->lineNumber++; - ptr += MINBPC(enc); - if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - pos->columnNumber = (unsigned)-1; - break; - default: - ptr += MINBPC(enc); - break; - } - pos->columnNumber++; - } -} - -#undef DO_LEAD_CASE -#undef MULTIBYTE_CASES -#undef INVALID_CASES -#undef CHECK_NAME_CASE -#undef CHECK_NAME_CASES -#undef CHECK_NMSTRT_CASE -#undef CHECK_NMSTRT_CASES diff --git a/bundle/expat/xmltok_impl.h b/bundle/expat/xmltok_impl.h deleted file mode 100644 index da0ea60a65..0000000000 --- a/bundle/expat/xmltok_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -enum { - BT_NONXML, - BT_MALFORM, - BT_LT, - BT_AMP, - BT_RSQB, - BT_LEAD2, - BT_LEAD3, - BT_LEAD4, - BT_TRAIL, - BT_CR, - BT_LF, - BT_GT, - BT_QUOT, - BT_APOS, - BT_EQUALS, - BT_QUEST, - BT_EXCL, - BT_SOL, - BT_SEMI, - BT_NUM, - BT_LSQB, - BT_S, - BT_NMSTRT, - BT_COLON, - BT_HEX, - BT_DIGIT, - BT_NAME, - BT_MINUS, - BT_OTHER, /* known not to be a name or name start character */ - BT_NONASCII, /* might be a name or name start character */ - BT_PERCNT, - BT_LPAR, - BT_RPAR, - BT_AST, - BT_PLUS, - BT_COMMA, - BT_VERBAR -}; - -#include diff --git a/bundle/expat/xmltok_ns.c b/bundle/expat/xmltok_ns.c deleted file mode 100644 index 011cb8f0c5..0000000000 --- a/bundle/expat/xmltok_ns.c +++ /dev/null @@ -1,106 +0,0 @@ -const ENCODING * -NS(XmlGetUtf8InternalEncoding)(void) -{ - return &ns(internal_utf8_encoding).enc; -} - -const ENCODING * -NS(XmlGetUtf16InternalEncoding)(void) -{ -#if BYTEORDER == 1234 - return &ns(internal_little2_encoding).enc; -#elif BYTEORDER == 4321 - return &ns(internal_big2_encoding).enc; -#else - const short n = 1; - return (*(const char *)&n - ? &ns(internal_little2_encoding).enc - : &ns(internal_big2_encoding).enc); -#endif -} - -static const ENCODING *NS(encodings)[] = { - &ns(latin1_encoding).enc, - &ns(ascii_encoding).enc, - &ns(utf8_encoding).enc, - &ns(big2_encoding).enc, - &ns(big2_encoding).enc, - &ns(little2_encoding).enc, - &ns(utf8_encoding).enc /* NO_ENC */ -}; - -static int FASTCALL -NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_PROLOG_STATE, ptr, end, nextTokPtr); -} - -static int FASTCALL -NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_CONTENT_STATE, ptr, end, nextTokPtr); -} - -int -NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, - const char *name) -{ - int i = getEncodingIndex(name); - if (i == UNKNOWN_ENC) - return 0; - SET_INIT_ENC_INDEX(p, i); - p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); - p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); - p->initEnc.updatePosition = initUpdatePosition; - p->encPtr = encPtr; - *encPtr = &(p->initEnc); - return 1; -} - -static const ENCODING * -NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) -{ -#define ENCODING_MAX 128 - char buf[ENCODING_MAX]; - char *p = buf; - int i; - XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); - if (ptr != end) - return 0; - *p = 0; - if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) - return enc; - i = getEncodingIndex(buf); - if (i == UNKNOWN_ENC) - return 0; - return NS(encodings)[i]; -} - -int -NS(XmlParseXmlDecl)(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - return doParseXmlDecl(NS(findEncoding), - isGeneralTextEntity, - enc, - ptr, - end, - badPtr, - versionPtr, - versionEndPtr, - encodingName, - encoding, - standalone); -} diff --git a/bundle/libxml/DOCBparser.c b/bundle/libxml/DOCBparser.c deleted file mode 100644 index f84a0be450..0000000000 --- a/bundle/libxml/DOCBparser.c +++ /dev/null @@ -1,6107 +0,0 @@ -/* - * DOCBparser.c : an attempt to parse SGML Docbook documents - * - * This is extremely hackish. It also adds one extension - * - * allowing to store the encoding of the document within the instance. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" -#ifdef LIBXML_DOCB_ENABLED - -#include -#ifdef HAVE_CTYPE_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_ZLIB_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * DocBook XML current versions - */ - -#define XML_DOCBOOK_XML_PUBLIC (const xmlChar *) \ - "-//OASIS//DTD DocBook XML V4.1.2//EN" -#define XML_DOCBOOK_XML_SYSTEM (const xmlChar *) \ - "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" - -/* - * Internal description of an SGML entity - */ -typedef struct _docbEntityDesc docbEntityDesc; -typedef docbEntityDesc *docbEntityDescPtr; -struct _docbEntityDesc { - int value; /* the UNICODE value for the character */ - const char *name; /* The entity name */ - const char *desc; /* the description */ -}; - -static int docbParseCharRef(docbParserCtxtPtr ctxt); -static xmlEntityPtr docbParseEntityRef(docbParserCtxtPtr ctxt, - xmlChar **str); -static void docbParseElement(docbParserCtxtPtr ctxt); -static void docbParseContent(docbParserCtxtPtr ctxt); - -/* - * Internal description of an SGML element - */ -typedef struct _docbElemDesc docbElemDesc; -typedef docbElemDesc *docbElemDescPtr; -struct _docbElemDesc { - const char *name; /* The tag name */ - int startTag; /* Whether the start tag can be implied */ - int endTag; /* Whether the end tag can be implied */ - int empty; /* Is this an empty element ? */ - int depr; /* Is this a deprecated element ? */ - int dtd; /* 1: only in Loose DTD, 2: only Frameset one */ - const char *desc; /* the description */ -}; - - -#define DOCB_MAX_NAMELEN 1000 -#define DOCB_PARSER_BIG_BUFFER_SIZE 1000 -#define DOCB_PARSER_BUFFER_SIZE 100 - -/* #define DEBUG */ -/* #define DEBUG_PUSH */ - -/************************************************************************ - * * - * Parser stacks related functions and macros * - * * - ************************************************************************/ - -/** - * docbnamePush: - * @ctxt: a DocBook SGML parser context - * @value: the element name - * - * Pushes a new element name on top of the name stack - * - * Returns 0 in case of error, the index in the stack otherwise - */ -static int -docbnamePush(docbParserCtxtPtr ctxt, xmlChar * value) -{ - if (ctxt->nameNr >= ctxt->nameMax) { - ctxt->nameMax *= 2; - ctxt->nameTab = - (xmlChar * *)xmlRealloc(ctxt->nameTab, - ctxt->nameMax * - sizeof(ctxt->nameTab[0])); - if (ctxt->nameTab == NULL) { - xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); - return (0); - } - } - ctxt->nameTab[ctxt->nameNr] = value; - ctxt->name = value; - return (ctxt->nameNr++); -} -/** - * docbnamePop: - * @ctxt: a DocBook SGML parser context - * - * Pops the top element name from the name stack - * - * Returns the name just removed - */ -static xmlChar * -docbnamePop(docbParserCtxtPtr ctxt) -{ - xmlChar *ret; - - if (ctxt->nameNr < 0) - return (0); - ctxt->nameNr--; - if (ctxt->nameNr < 0) - return (0); - if (ctxt->nameNr > 0) - ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; - else - ctxt->name = NULL; - ret = ctxt->nameTab[ctxt->nameNr]; - ctxt->nameTab[ctxt->nameNr] = 0; - return (ret); -} - -/* - * Macros for accessing the content. Those should be used only by the parser, - * and not exported. - * - * Dirty macros, i.e. one need to make assumption on the context to use them - * - * CUR_PTR return the current pointer to the xmlChar to be parsed. - * CUR returns the current xmlChar value, i.e. a 8 bit value if compiled - * in ISO-Latin or UTF-8, and the current 16 bit value if compiled - * in UNICODE mode. This should be used internally by the parser - * only to compare to ASCII values otherwise it would break when - * running with UTF-8 encoding. - * NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only - * to compare on ASCII based substring. - * UPP(n) returns the n'th next xmlChar converted to uppercase. Same as CUR - * it should be used only to compare on ASCII based substring. - * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined - * strings within the parser. - * - * Clean macros, not dependent of an ASCII context, expect UTF-8 encoding - * - * CURRENT Returns the current char value, with the full decoding of - * UTF-8 if we are using this mode. It returns an int. - * NEXT Skip to the next character, this does the proper decoding - * in UTF-8 mode. It also pop-up unfinished entities on the fly. - * COPY(to) copy one char to *to, increment CUR_PTR and to accordingly - */ - -#define UPPER (toupper(*ctxt->input->cur)) - -#define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val) - -#define NXT(val) ctxt->input->cur[(val)] - -#define UPP(val) (toupper(ctxt->input->cur[(val)])) - -#define CUR_PTR ctxt->input->cur - -#define SHRINK xmlParserInputShrink(ctxt->input) - -#define GROW xmlParserInputGrow(ctxt->input, INPUT_CHUNK) - -#define CURRENT ((int) (*ctxt->input->cur)) - -#define SKIP_BLANKS docbSkipBlankChars(ctxt) - -/* Imported from XML */ - -/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */ -#define CUR ((int) (*ctxt->input->cur)) -#define NEXT xmlNextChar(ctxt),ctxt->nbChars++ - -#define RAW (ctxt->token ? -1 : (*ctxt->input->cur)) -#define NXT(val) ctxt->input->cur[(val)] -#define CUR_PTR ctxt->input->cur - - -#define NEXTL(l) do { \ - if (*(ctxt->input->cur) == '\n') { \ - ctxt->input->line++; ctxt->input->col = 1; \ - } else ctxt->input->col++; \ - ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \ - } while (0) - -/************ - \ - if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \ - if (*ctxt->input->cur == '&') xmlParserHandleReference(ctxt); - ************/ - -#define CUR_CHAR(l) docbCurrentChar(ctxt, &l) -#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l) - -#define COPY_BUF(l,b,i,v) \ - if (l == 1) b[i++] = (xmlChar) v; \ - else i += xmlCopyChar(l,&b[i],v) - -/** - * docbCurrentChar: - * @ctxt: the DocBook SGML parser context - * @len: pointer to the length of the char read - * - * The current char value, if using UTF-8 this may actually span multiple - * bytes in the input buffer. Implement the end of line normalization: - * 2.11 End-of-Line Handling - * If the encoding is unspecified, in the case we find an ISO-Latin-1 - * char, then the encoding converter is plugged in automatically. - * - * Returns the current char value and its length - */ - -static int -docbCurrentChar(xmlParserCtxtPtr ctxt, int *len) { - if (ctxt->instate == XML_PARSER_EOF) - return(0); - - if (ctxt->token != 0) { - *len = 0; - return(ctxt->token); - } - if (ctxt->charset == XML_CHAR_ENCODING_UTF8) { - /* - * We are supposed to handle UTF8, check it's valid - * From rfc2044: encoding of the Unicode values on UTF-8: - * - * UCS-4 range (hex.) UTF-8 octet sequence (binary) - * 0000 0000-0000 007F 0xxxxxxx - * 0000 0080-0000 07FF 110xxxxx 10xxxxxx - * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx - * - * Check for the 0x110000 limit too - */ - const unsigned char *cur = ctxt->input->cur; - unsigned char c; - unsigned int val; - - c = *cur; - if (c & 0x80) { - if (cur[1] == 0) - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - if ((cur[1] & 0xc0) != 0x80) - goto encoding_error; - if ((c & 0xe0) == 0xe0) { - - if (cur[2] == 0) - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - if ((cur[2] & 0xc0) != 0x80) - goto encoding_error; - if ((c & 0xf0) == 0xf0) { - if (cur[3] == 0) - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - if (((c & 0xf8) != 0xf0) || - ((cur[3] & 0xc0) != 0x80)) - goto encoding_error; - /* 4-byte code */ - *len = 4; - val = (cur[0] & 0x7) << 18; - val |= (cur[1] & 0x3f) << 12; - val |= (cur[2] & 0x3f) << 6; - val |= cur[3] & 0x3f; - } else { - /* 3-byte code */ - *len = 3; - val = (cur[0] & 0xf) << 12; - val |= (cur[1] & 0x3f) << 6; - val |= cur[2] & 0x3f; - } - } else { - /* 2-byte code */ - *len = 2; - val = (cur[0] & 0x1f) << 6; - val |= cur[1] & 0x3f; - } - if (!IS_CHAR(val)) { - ctxt->errNo = XML_ERR_INVALID_ENCODING; - if ((ctxt->sax != NULL) && - (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Char 0x%X out of allowed range\n", val); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } - return(val); - } else { - /* 1-byte code */ - *len = 1; - return((int) *ctxt->input->cur); - } - } - /* - * Assume it's a fixed length encoding (1) with - * a compatible encoding for the ASCII set, since - * XML constructs only use < 128 chars - */ - *len = 1; - if ((int) *ctxt->input->cur < 0x80) - return((int) *ctxt->input->cur); - - /* - * Humm this is bad, do an automatic flow conversion - */ - xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1); - ctxt->charset = XML_CHAR_ENCODING_UTF8; - return(xmlCurrentChar(ctxt, len)); - -encoding_error: - /* - * If we detect an UTF8 error that probably mean that the - * input encoding didn't get properly advertized in the - * declaration header. Report the error and switch the encoding - * to ISO-Latin-1 (if you don't like this policy, just declare the - * encoding !) - */ - ctxt->errNo = XML_ERR_INVALID_ENCODING; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { - ctxt->sax->error(ctxt->userData, - "Input is not proper UTF-8, indicate encoding !\n"); - ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", - ctxt->input->cur[0], ctxt->input->cur[1], - ctxt->input->cur[2], ctxt->input->cur[3]); - } - - ctxt->charset = XML_CHAR_ENCODING_8859_1; - *len = 1; - return((int) *ctxt->input->cur); -} - -#if 0 -/** - * sgmlNextChar: - * @ctxt: the DocBook SGML parser context - * - * Skip to the next char input char. - */ - -static void -sgmlNextChar(docbParserCtxtPtr ctxt) { - if (ctxt->instate == XML_PARSER_EOF) - return; - if ((*ctxt->input->cur == 0) && - (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) { - xmlPopInput(ctxt); - } else { - if (*(ctxt->input->cur) == '\n') { - ctxt->input->line++; ctxt->input->col = 1; - } else ctxt->input->col++; - ctxt->input->cur++; - ctxt->nbChars++; - if (*ctxt->input->cur == 0) - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - } -} -#endif - -/** - * docbSkipBlankChars: - * @ctxt: the DocBook SGML parser context - * - * skip all blanks character found at that point in the input streams. - * - * Returns the number of space chars skipped - */ - -static int -docbSkipBlankChars(xmlParserCtxtPtr ctxt) { - int res = 0; - - while (IS_BLANK(*(ctxt->input->cur))) { - if ((*ctxt->input->cur == 0) && - (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) { - xmlPopInput(ctxt); - } else { - if (*(ctxt->input->cur) == '\n') { - ctxt->input->line++; ctxt->input->col = 1; - } else ctxt->input->col++; - ctxt->input->cur++; - ctxt->nbChars++; - if (*ctxt->input->cur == 0) - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - } - res++; - } - return(res); -} - - - -/************************************************************************ - * * - * The list of SGML elements and their properties * - * * - ************************************************************************/ - -/* - * Start Tag: 1 means the start tag can be ommited - * End Tag: 1 means the end tag can be ommited - * 2 means it's forbidden (empty elements) - * Depr: this element is deprecated - * DTD: 1 means that this element is valid only in the Loose DTD - * 2 means that this element is valid only in the Frameset DTD - * - * Name,Start Tag,End Tag, Empty, Depr., DTD, Description - */ -static docbElemDesc -docbookElementTable[] = { -{ "abbrev", 0, 0, 0, 3, 0, "" }, /* word */ -{ "abstract", 0, 0, 0, 9, 0, "" }, /* title */ -{ "accel", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "ackno", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "acronym", 0, 0, 0, 3, 0, "" }, /* word */ -{ "action", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "address", 0, 0, 0, 1, 0, "" }, -{ "affiliation",0, 0, 0, 9, 0, "" }, /* shortaffil */ -{ "alt", 0, 0, 0, 1, 0, "" }, -{ "anchor", 0, 2, 1, 0, 0, "" }, -{ "answer", 0, 0, 0, 9, 0, "" }, /* label */ -{ "appendix", 0, 0, 0, 9, 0, "" }, /* appendixinfo */ -{ "appendixinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "application",0, 0, 0, 2, 0, "" }, /* para */ -{ "area", 0, 2, 1, 0, 0, "" }, -{ "areaset", 0, 0, 0, 9, 0, "" }, /* area */ -{ "areaspec", 0, 0, 0, 9, 0, "" }, /* area */ -{ "arg", 0, 0, 0, 1, 0, "" }, -{ "artheader", 0, 0, 0, 9, 0, "" }, -{ "article", 0, 0, 0, 9, 0, "" }, /* div.title.content */ -{ "articleinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "artpagenums",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "attribution",0, 0, 0, 2, 0, "" }, /* para */ -{ "audiodata", 0, 2, 1, 0, 0, "" }, -{ "audioobject",0, 0, 0, 9, 0, "" }, /* objectinfo */ -{ "authorblurb",0, 0, 0, 9, 0, "" }, /* title */ -{ "authorgroup",0, 0, 0, 9, 0, "" }, /* author */ -{ "authorinitials",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "author", 0, 0, 0, 9, 0, "" }, /* person.ident.mix */ -{ "beginpage", 0, 2, 1, 0, 0, "" }, -{ "bibliodiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */ -{ "biblioentry",0, 0, 0, 9, 0, "" }, /* articleinfo */ -{ "bibliography",0, 0, 0, 9, 0, "" }, /* bibliographyinfo */ -{ "bibliographyinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "bibliomisc", 0, 0, 0, 2, 0, "" }, /* para */ -{ "bibliomixed",0, 0, 0, 1, 0, "" }, /* %bibliocomponent.mix, bibliomset) */ -{ "bibliomset", 0, 0, 0, 1, 0, "" }, /* %bibliocomponent.mix; | bibliomset) */ -{ "biblioset", 0, 0, 0, 9, 0, "" }, /* bibliocomponent.mix */ -{ "blockquote", 0, 0, 0, 9, 0, "" }, /* title */ -{ "book", 0, 0, 0, 9, 0, "" }, /* div.title.content */ -{ "bookinfo", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "bridgehead", 0, 0, 0, 8, 0, "" }, /* title */ -{ "callout", 0, 0, 0, 9, 0, "" }, /* component.mix */ -{ "calloutlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "caption", 0, 0, 0, 9, 0, "" }, /* textobject.mix */ -{ "caution", 0, 0, 0, 9, 0, "" }, /* title */ -{ "chapter", 0, 0, 0, 9, 0, "" }, /* chapterinfo */ -{ "chapterinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "citation", 0, 0, 0, 2, 0, "" }, /* para */ -{ "citerefentry",0, 0, 0, 9, 0, "" }, /* refentrytitle */ -{ "citetitle", 0, 0, 0, 2, 0, "" }, /* para */ -{ "city", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "classname", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "classsynopsisinfo",0,0, 0, 9, 0, "" }, /* cptr */ -{ "classsynopsis",0, 0, 0, 9, 0, "" }, /* ooclass */ -{ "cmdsynopsis",0, 0, 0, 9, 0, "" }, /* command */ -{ "co", 0, 2, 1, 0, 0, "" }, -{ "collab", 0, 0, 0, 9, 0, "" }, /* collabname */ -{ "collabname", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "colophon", 0, 0, 0, 9, 0, "" }, /* sect.title.content */ -{ "colspec", 0, 2, 1, 0, 0, "" }, -{ "colspec", 0, 2, 1, 0, 0, "" }, -{ "command", 0, 0, 0, 9, 0, "" }, /* cptr */ -{ "computeroutput",0, 0, 0, 9, 0, "" }, /* cptr */ -{ "confdates", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "confgroup", 0, 0, 0, 9, 0, "" }, /* confdates */ -{ "confnum", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "confsponsor",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "conftitle", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "constant", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "constructorsynopsis",0,0, 0, 9, 0, "" }, /* modifier */ -{ "contractnum",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "contractsponsor",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "contrib", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "copyright", 0, 0, 0, 9, 0, "" }, /* year */ -{ "corpauthor", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "corpname", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "country", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "database", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "date", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "dedication", 0, 0, 0, 9, 0, "" }, /* sect.title.content */ -{ "destructorsynopsis",0,0, 0, 9, 0, "" }, /* modifier */ -{ "docinfo", 0, 0, 0, 9, 0, "" }, -{ "edition", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "editor", 0, 0, 0, 9, 0, "" }, /* person.ident.mix */ -{ "email", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "emphasis", 0, 0, 0, 2, 0, "" }, /* para */ -{ "entry", 0, 0, 0, 9, 0, "" }, /* tbl.entry.mdl */ -{ "entrytbl", 0, 0, 0, 9, 0, "" }, /* tbl.entrytbl.mdl */ -{ "envar", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "epigraph", 0, 0, 0, 9, 0, "" }, /* attribution */ -{ "equation", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "errorcode", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "errorname", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "errortype", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "example", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "exceptionname",0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "fax", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "fieldsynopsis", 0, 0, 0, 9, 0, "" }, /* modifier */ -{ "figure", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "filename", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "firstname", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "firstterm", 0, 0, 0, 3, 0, "" }, /* word */ -{ "footnote", 0, 0, 0, 9, 0, "" }, /* footnote.mix */ -{ "footnoteref",0, 2, 1, 0, 0, "" }, -{ "foreignphrase",0, 0, 0, 2, 0, "" }, /* para */ -{ "formalpara", 0, 0, 0, 9, 0, "" }, /* title */ -{ "funcdef", 0, 0, 0, 1, 0, "" }, -{ "funcparams", 0, 0, 0, 9, 0, "" }, /* cptr */ -{ "funcprototype",0, 0, 0, 9, 0, "" }, /* funcdef */ -{ "funcsynopsis",0, 0, 0, 9, 0, "" }, /* funcsynopsisinfo */ -{ "funcsynopsisinfo", 0, 0, 0, 9, 0, "" }, /* cptr */ -{ "function", 0, 0, 0, 9, 0, "" }, /* cptr */ -{ "glossary", 0, 0, 0, 9, 0, "" }, /* glossaryinfo */ -{ "glossaryinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "glossdef", 0, 0, 0, 9, 0, "" }, /* glossdef.mix */ -{ "glossdiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */ -{ "glossentry", 0, 0, 0, 9, 0, "" }, /* glossterm */ -{ "glosslist", 0, 0, 0, 9, 0, "" }, /* glossentry */ -{ "glossseealso",0, 0, 1, 2, 0, "" }, /* para */ -{ "glosssee", 0, 0, 1, 2, 0, "" }, /* para */ -{ "glossterm", 0, 0, 0, 2, 0, "" }, /* para */ -{ "graphic", 0, 0, 0, 9, 0, "" }, -{ "graphicco", 0, 0, 0, 9, 0, "" }, /* areaspec */ -{ "group", 0, 0, 0, 9, 0, "" }, /* arg */ -{ "guibutton", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "guiicon", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "guilabel", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "guimenuitem",0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "guimenu", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "guisubmenu", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "hardware", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "highlights", 0, 0, 0, 9, 0, "" }, /* highlights.mix */ -{ "holder", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "honorific", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "imagedata", 0, 2, 1, 0, 0, "" }, -{ "imageobjectco",0, 0, 0, 9, 0, "" }, /* areaspec */ -{ "imageobject",0, 0, 0, 9, 0, "" }, /* objectinfo */ -{ "important", 0, 0, 0, 9, 0, "" }, /* title */ -{ "indexdiv", 0, 0, 0, 9, 0, "" }, /* sect.title.content */ -{ "indexentry", 0, 0, 0, 9, 0, "" }, /* primaryie */ -{ "index", 0, 0, 0, 9, 0, "" }, /* indexinfo */ -{ "indexinfo", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "indexterm", 0, 0, 0, 9, 0, "" }, /* primary */ -{ "informalequation",0, 0, 0, 9, 0, "" }, /* equation.content */ -{ "informalexample",0, 0, 0, 9, 0, "" }, /* example.mix */ -{ "informalfigure",0, 0, 0, 9, 0, "" }, /* figure.mix */ -{ "informaltable",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "initializer",0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "inlineequation",0, 0, 0, 9, 0, "" }, /* inlineequation.content */ -{ "inlinegraphic",0, 0, 0, 9, 0, "" }, -{ "inlinemediaobject",0,0, 0, 9, 0, "" }, /* objectinfo */ -{ "interfacename",0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "interface", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "invpartnumber",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "isbn", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "issn", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "issuenum", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "itemizedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "itermset", 0, 0, 0, 9, 0, "" }, /* indexterm */ -{ "jobtitle", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "keycap", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "keycode", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "keycombo", 0, 0, 0, 9, 0, "" }, /* keycap */ -{ "keysym", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "keyword", 0, 0, 0, 1, 0, "" }, -{ "keywordset", 0, 0, 0, 9, 0, "" }, /* keyword */ -{ "label", 0, 0, 0, 3, 0, "" }, /* word */ -{ "legalnotice",0, 0, 0, 9, 0, "" }, /* title */ -{ "lineage", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "lineannotation",0, 0, 0, 2, 0, "" }, /* para */ -{ "link", 0, 0, 0, 2, 0, "" }, /* para */ -{ "listitem", 0, 0, 0, 9, 0, "" }, /* component.mix */ -{ "literal", 0, 0, 0, 9, 0, "" }, /* cptr */ -{ "literallayout",0, 0, 0, 2, 0, "" }, /* para */ -{ "lot", 0, 0, 0, 9, 0, "" }, /* bookcomponent.title.content */ -{ "lotentry", 0, 0, 0, 2, 0, "" }, /* para */ -{ "manvolnum", 0, 0, 0, 3, 0, "" }, /* word */ -{ "markup", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "medialabel", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "mediaobjectco",0, 0, 0, 9, 0, "" }, /* objectinfo */ -{ "mediaobject",0, 0, 0, 9, 0, "" }, /* objectinfo */ -{ "member", 0, 0, 0, 2, 0, "" }, /* para */ -{ "menuchoice", 0, 0, 0, 9, 0, "" }, /* shortcut */ -{ "methodname", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "methodparam",0, 0, 0, 9, 0, "" }, /* modifier */ -{ "methodsynopsis",0, 0, 0, 9, 0, "" }, /* modifier */ -{ "modespec", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "modifier", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "mousebutton",0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "msgaud", 0, 0, 0, 2, 0, "" }, /* para */ -{ "msgentry", 0, 0, 0, 9, 0, "" }, /* msg */ -{ "msgexplan", 0, 0, 0, 9, 0, "" }, /* title */ -{ "msginfo", 0, 0, 0, 9, 0, "" }, /* msglevel */ -{ "msglevel", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "msgmain", 0, 0, 0, 9, 0, "" }, /* title */ -{ "msgorig", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "msgrel", 0, 0, 0, 9, 0, "" }, /* title */ -{ "msgset", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "msgsub", 0, 0, 0, 9, 0, "" }, /* title */ -{ "msgtext", 0, 0, 0, 9, 0, "" }, /* component.mix */ -{ "msg", 0, 0, 0, 9, 0, "" }, /* title */ -{ "note", 0, 0, 0, 9, 0, "" }, /* title */ -{ "objectinfo", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "olink", 0, 0, 0, 2, 0, "" }, /* para */ -{ "ooclass", 0, 0, 0, 9, 0, "" }, /* modifier */ -{ "ooexception",0, 0, 0, 9, 0, "" }, /* modifier */ -{ "oointerface",0, 0, 0, 9, 0, "" }, /* modifier */ -{ "optional", 0, 0, 0, 9, 0, "" }, /* cptr */ -{ "option", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "orderedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "orgdiv", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "orgname", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "otheraddr", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "othercredit",0, 0, 0, 9, 0, "" }, /* person.ident.mix */ -{ "othername", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "pagenums", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "paramdef", 0, 0, 0, 1, 0, "" }, -{ "parameter", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "para", 0, 0, 0, 2, 0, "" }, /* para */ -{ "partinfo", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "partintro", 0, 0, 0, 9, 0, "" }, /* div.title.content */ -{ "part", 0, 0, 0, 9, 0, "" }, /* partinfo */ -{ "phone", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "phrase", 0, 0, 0, 2, 0, "" }, /* para */ -{ "pob", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "postcode", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "prefaceinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "preface", 0, 0, 0, 9, 0, "" }, /* prefaceinfo */ -{ "primaryie", 0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "primary", 0, 0, 0, 9, 0, "" }, /* ndxterm */ -{ "printhistory",0, 0, 0, 9, 0, "" }, /* para.class */ -{ "procedure", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "productname",0, 0, 0, 2, 0, "" }, /* para */ -{ "productnumber",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "programlistingco",0, 0, 0, 9, 0, "" }, /* areaspec */ -{ "programlisting",0, 0, 0, 2, 0, "" }, /* para */ -{ "prompt", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "property", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "pubdate", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "publishername",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "publisher", 0, 0, 0, 9, 0, "" }, /* publishername */ -{ "pubsnumber", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "qandadiv", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "qandaentry", 0, 0, 0, 9, 0, "" }, /* revhistory */ -{ "qandaset", 0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "question", 0, 0, 0, 9, 0, "" }, /* label */ -{ "quote", 0, 0, 0, 2, 0, "" }, /* para */ -{ "refclass", 0, 0, 0, 9, 0, "" }, /* refclass.char.mix */ -{ "refdescriptor",0, 0, 0, 9, 0, "" }, /* refname.char.mix */ -{ "refentryinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "refentry", 0, 0, 0, 9, 0, "" }, /* ndxterm.class */ -{ "refentrytitle",0, 0, 0, 2, 0, "" }, /* para */ -{ "referenceinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "reference", 0, 0, 0, 9, 0, "" }, /* referenceinfo */ -{ "refmeta", 0, 0, 0, 9, 0, "" }, /* ndxterm.class */ -{ "refmiscinfo",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "refnamediv", 0, 0, 0, 9, 0, "" }, /* refdescriptor */ -{ "refname", 0, 0, 0, 9, 0, "" }, /* refname.char.mix */ -{ "refpurpose", 0, 0, 0, 9, 0, "" }, /* refinline.char.mix */ -{ "refsect1info",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "refsect1", 0, 0, 0, 9, 0, "" }, /* refsect */ -{ "refsect2info",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "refsect2", 0, 0, 0, 9, 0, "" }, /* refsect */ -{ "refsect3info",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "refsect3", 0, 0, 0, 9, 0, "" }, /* refsect */ -{ "refsynopsisdivinfo",0,0, 0, 9, 0, "" }, /* graphic */ -{ "refsynopsisdiv",0, 0, 0, 9, 0, "" }, /* refsynopsisdivinfo */ -{ "releaseinfo",0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "remark", 0, 0, 0, 2, 0, "" }, /* para */ -{ "replaceable",0, 0, 0, 1, 0, "" }, -{ "returnvalue",0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "revdescription",0, 0, 0, 9, 0, "" }, /* revdescription.mix */ -{ "revhistory", 0, 0, 0, 9, 0, "" }, /* revision */ -{ "revision", 0, 0, 0, 9, 0, "" }, /* revnumber */ -{ "revnumber", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "revremark", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "row", 0, 0, 0, 9, 0, "" }, /* tbl.row.mdl */ -{ "row", 0, 0, 0, 9, 0, "" }, /* tbl.row.mdl */ -{ "sbr", 0, 2, 1, 0, 0, "" }, -{ "screenco", 0, 0, 0, 9, 0, "" }, /* areaspec */ -{ "screeninfo", 0, 0, 0, 2, 0, "" }, /* para */ -{ "screen", 0, 0, 0, 2, 0, "" }, /* para */ -{ "screenshot", 0, 0, 0, 9, 0, "" }, /* screeninfo */ -{ "secondaryie",0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "secondary", 0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "sect1info", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "sect1", 0, 0, 0, 9, 0, "" }, /* sect */ -{ "sect2info", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "sect2", 0, 0, 0, 9, 0, "" }, /* sect */ -{ "sect3info", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "sect3", 0, 0, 0, 9, 0, "" }, /* sect */ -{ "sect4info", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "sect4", 0, 0, 0, 9, 0, "" }, /* sect */ -{ "sect5info", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "sect5", 0, 0, 0, 9, 0, "" }, /* sect */ -{ "sectioninfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "section", 0, 0, 0, 9, 0, "" }, /* sectioninfo */ -{ "seealsoie", 0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "seealso", 0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "seeie", 0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "see", 0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "seglistitem",0, 0, 0, 9, 0, "" }, /* seg */ -{ "segmentedlist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "seg", 0, 0, 0, 2, 0, "" }, /* para */ -{ "segtitle", 0, 0, 0, 8, 0, "" }, /* title */ -{ "seriesvolnums", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "set", 0, 0, 0, 9, 0, "" }, /* div.title.content */ -{ "setindexinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "setindex", 0, 0, 0, 9, 0, "" }, /* setindexinfo */ -{ "setinfo", 0, 0, 0, 9, 0, "" }, /* graphic */ -{ "sgmltag", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "shortaffil", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "shortcut", 0, 0, 0, 9, 0, "" }, /* keycap */ -{ "sidebarinfo",0, 0, 0, 9, 0, "" }, /* graphic */ -{ "sidebar", 0, 0, 0, 9, 0, "" }, /* sidebarinfo */ -{ "simpara", 0, 0, 0, 2, 0, "" }, /* para */ -{ "simplelist", 0, 0, 0, 9, 0, "" }, /* member */ -{ "simplemsgentry", 0, 0, 0, 9, 0, "" }, /* msgtext */ -{ "simplesect", 0, 0, 0, 9, 0, "" }, /* sect.title.content */ -{ "spanspec", 0, 2, 1, 0, 0, "" }, -{ "state", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "step", 0, 0, 0, 9, 0, "" }, /* title */ -{ "street", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "structfield",0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "structname", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "subjectset", 0, 0, 0, 9, 0, "" }, /* subject */ -{ "subject", 0, 0, 0, 9, 0, "" }, /* subjectterm */ -{ "subjectterm",0, 0, 0, 1, 0, "" }, -{ "subscript", 0, 0, 0, 1, 0, "" }, -{ "substeps", 0, 0, 0, 9, 0, "" }, /* step */ -{ "subtitle", 0, 0, 0, 8, 0, "" }, /* title */ -{ "superscript", 0, 0, 0, 1, 0, "" }, -{ "surname", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "symbol", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "synopfragment", 0, 0, 0, 9, 0, "" }, /* arg */ -{ "synopfragmentref", 0, 0, 0, 1, 0, "" }, -{ "synopsis", 0, 0, 0, 2, 0, "" }, /* para */ -{ "systemitem", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "table", 0, 0, 0, 9, 0, "" }, /* tbl.table.mdl */ -/* { "%tbl.table.name;", 0, 0, 0, 9, 0, "" },*/ /* tbl.table.mdl */ -{ "tbody", 0, 0, 0, 9, 0, "" }, /* row */ -{ "tbody", 0, 0, 0, 9, 0, "" }, /* row */ -{ "term", 0, 0, 0, 2, 0, "" }, /* para */ -{ "tertiaryie", 0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "tertiary ", 0, 0, 0, 4, 0, "" }, /* ndxterm */ -{ "textobject", 0, 0, 0, 9, 0, "" }, /* objectinfo */ -{ "tfoot", 0, 0, 0, 9, 0, "" }, /* tbl.hdft.mdl */ -{ "tgroup", 0, 0, 0, 9, 0, "" }, /* tbl.tgroup.mdl */ -{ "tgroup", 0, 0, 0, 9, 0, "" }, /* tbl.tgroup.mdl */ -{ "thead", 0, 0, 0, 9, 0, "" }, /* row */ -{ "thead", 0, 0, 0, 9, 0, "" }, /* tbl.hdft.mdl */ -{ "tip", 0, 0, 0, 9, 0, "" }, /* title */ -{ "titleabbrev",0, 0, 0, 8, 0, "" }, /* title */ -{ "title", 0, 0, 0, 8, 0, "" }, /* title */ -{ "tocback", 0, 0, 0, 2, 0, "" }, /* para */ -{ "toc", 0, 0, 0, 9, 0, "" }, /* bookcomponent.title.content */ -{ "tocchap", 0, 0, 0, 9, 0, "" }, /* tocentry */ -{ "tocentry", 0, 0, 0, 2, 0, "" }, /* para */ -{ "tocfront", 0, 0, 0, 2, 0, "" }, /* para */ -{ "toclevel1", 0, 0, 0, 9, 0, "" }, /* tocentry */ -{ "toclevel2", 0, 0, 0, 9, 0, "" }, /* tocentry */ -{ "toclevel3", 0, 0, 0, 9, 0, "" }, /* tocentry */ -{ "toclevel4", 0, 0, 0, 9, 0, "" }, /* tocentry */ -{ "toclevel5", 0, 0, 0, 9, 0, "" }, /* tocentry */ -{ "tocpart", 0, 0, 0, 9, 0, "" }, /* tocentry */ -{ "token", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "trademark", 0, 0, 0, 1, 0, "" }, -{ "type", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "ulink", 0, 0, 0, 2, 0, "" }, /* para */ -{ "userinput", 0, 0, 0, 9, 0, "" }, /* cptr */ -{ "varargs", 0, 2, 1, 0, 0, "" }, -{ "variablelist",0, 0, 0, 9, 0, "" }, /* formalobject.title.content */ -{ "varlistentry",0, 0, 0, 9, 0, "" }, /* term */ -{ "varname", 0, 0, 0, 7, 0, "" }, /* smallcptr */ -{ "videodata", 0, 2, 1, 0, 0, "" }, -{ "videoobject",0, 0, 0, 9, 0, "" }, /* objectinfo */ -{ "void", 0, 2, 1, 0, 0, "" }, -{ "volumenum", 0, 0, 0, 4, 0, "" }, /* docinfo */ -{ "warning", 0, 0, 0, 9, 0, "" }, /* title */ -{ "wordasword", 0, 0, 0, 3, 0, "" }, /* word */ -{ "xref", 0, 2, 1, 0, 0, "" }, -{ "year", 0, 0, 0, 4, 0, "" }, /* docinfo */ -}; - -#if 0 -/* - * start tags that imply the end of a current element - * any tag of each line implies the end of the current element if the type of - * that element is in the same line - */ -static const char *docbEquEnd[] = { -"dt", "dd", "li", "option", NULL, -"h1", "h2", "h3", "h4", "h5", "h6", NULL, -"ol", "menu", "dir", "address", "pre", "listing", "xmp", NULL, -NULL -}; -#endif - -/* - * according the SGML DTD, HR should be added to the 2nd line above, as it - * is not allowed within a H1, H2, H3, etc. But we should tolerate that case - * because many documents contain rules in headings... - */ - -/* - * start tags that imply the end of current element - */ -static const char *docbStartClose[] = { -NULL -}; - -static const char** docbStartCloseIndex[100]; -static int docbStartCloseIndexinitialized = 0; - -/************************************************************************ - * * - * functions to handle SGML specific data * - * * - ************************************************************************/ - -/** - * docbInitAutoClose: - * - * Initialize the docbStartCloseIndex for fast lookup of closing tags names. - * - */ -static void -docbInitAutoClose(void) { - int indx, i = 0; - - if (docbStartCloseIndexinitialized) return; - - for (indx = 0;indx < 100;indx ++) docbStartCloseIndex[indx] = NULL; - indx = 0; - while ((docbStartClose[i] != NULL) && (indx < 100 - 1)) { - docbStartCloseIndex[indx++] = &docbStartClose[i]; - while (docbStartClose[i] != NULL) i++; - i++; - } -} - -/** - * docbTagLookup: - * @tag: The tag name - * - * Lookup the SGML tag in the ElementTable - * - * Returns the related docbElemDescPtr or NULL if not found. - */ -static docbElemDescPtr -docbTagLookup(const xmlChar *tag) { - unsigned int i; - - for (i = 0; i < (sizeof(docbookElementTable) / - sizeof(docbookElementTable[0]));i++) { - if (xmlStrEqual(tag, BAD_CAST docbookElementTable[i].name)) - return(&docbookElementTable[i]); - } - return(NULL); -} - -/** - * docbCheckAutoClose: - * @newtag: The new tag name - * @oldtag: The old tag name - * - * Checks whether the new tag is one of the registered valid tags for - * closing old. - * Initialize the docbStartCloseIndex for fast lookup of closing tags names. - * - * Returns 0 if no, 1 if yes. - */ -static int -docbCheckAutoClose(const xmlChar *newtag, const xmlChar *oldtag) { - int i, indx; - const char **closed = NULL; - - if (docbStartCloseIndexinitialized == 0) docbInitAutoClose(); - - /* inefficient, but not a big deal */ - for (indx = 0; indx < 100;indx++) { - closed = docbStartCloseIndex[indx]; - if (closed == NULL) return(0); - if (xmlStrEqual(BAD_CAST *closed, newtag)) break; - } - - i = closed - docbStartClose; - i++; - while (docbStartClose[i] != NULL) { - if (xmlStrEqual(BAD_CAST docbStartClose[i], oldtag)) { - return(1); - } - i++; - } - return(0); -} - -/** - * docbAutoCloseOnClose: - * @ctxt: an SGML parser context - * @newtag: The new tag name - * - * The DocBook DTD allows an ending tag to implicitly close other tags. - */ -static void -docbAutoCloseOnClose(docbParserCtxtPtr ctxt, const xmlChar *newtag) { - docbElemDescPtr info; - xmlChar *oldname; - int i; - - if ((newtag[0] == '/') && (newtag[1] == 0)) - return; - -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"Close of %s stack: %d elements\n", newtag, ctxt->nameNr); - for (i = 0;i < ctxt->nameNr;i++) - xmlGenericError(xmlGenericErrorContext,"%d : %s\n", i, ctxt->nameTab[i]); -#endif - - for (i = (ctxt->nameNr - 1);i >= 0;i--) { - if (xmlStrEqual(newtag, ctxt->nameTab[i])) break; - } - if (i < 0) return; - - while (!xmlStrEqual(newtag, ctxt->name)) { - info = docbTagLookup(ctxt->name); - if ((info == NULL) || (info->endTag == 1)) { -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"docbAutoCloseOnClose: %s closes %s\n", newtag, ctxt->name); -#endif - } else { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Opening and ending tag mismatch: %s and %s\n", - newtag, ctxt->name); - ctxt->wellFormed = 0; - } - if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) - ctxt->sax->endElement(ctxt->userData, ctxt->name); - oldname = docbnamePop(ctxt); - if (oldname != NULL) { -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"docbAutoCloseOnClose: popped %s\n", oldname); -#endif - xmlFree(oldname); - } - } -} - -/** - * docbAutoClose: - * @ctxt: an SGML parser context - * @newtag: The new tag name or NULL - * - * The DocBook DTD allows a tag to implicitly close other tags. - * The list is kept in docbStartClose array. This function is - * called when a new tag has been detected and generates the - * appropriates closes if possible/needed. - * If newtag is NULL this mean we are at the end of the resource - * and we should check - */ -static void -docbAutoClose(docbParserCtxtPtr ctxt, const xmlChar *newtag) { - xmlChar *oldname; - while ((newtag != NULL) && (ctxt->name != NULL) && - (docbCheckAutoClose(newtag, ctxt->name))) { -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"docbAutoClose: %s closes %s\n", newtag, ctxt->name); -#endif - if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) - ctxt->sax->endElement(ctxt->userData, ctxt->name); - oldname = docbnamePop(ctxt); - if (oldname != NULL) { -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"docbAutoClose: popped %s\n", oldname); -#endif - xmlFree(oldname); - } - } -} - -/** - * docbAutoCloseTag: - * @doc: the SGML document - * @name: The tag name - * @elem: the SGML element - * - * The DocBook DTD allows a tag to implicitly close other tags. - * The list is kept in docbStartClose array. This function checks - * if the element or one of it's children would autoclose the - * given tag. - * - * Returns 1 if autoclose, 0 otherwise - */ -static int -docbAutoCloseTag(docbDocPtr doc, const xmlChar *name, docbNodePtr elem) { - docbNodePtr child; - - if (elem == NULL) return(1); - if (xmlStrEqual(name, elem->name)) return(0); - if (docbCheckAutoClose(elem->name, name)) return(1); - child = elem->children; - while (child != NULL) { - if (docbAutoCloseTag(doc, name, child)) return(1); - child = child->next; - } - return(0); -} - -/************************************************************************ - * * - * The list of SGML predefined entities * - * * - ************************************************************************/ - - -static docbEntityDesc -docbookEntitiesTable[] = { -/* - * the 4 absolute ones, plus apostrophe. - */ -{ 0x0026, "amp", "AMPERSAND" }, -{ 0x003C, "lt", "LESS-THAN SIGN" }, - -/* - * Converted with VI macros from docbook ent files - */ -{ 0x0021, "excl", "EXCLAMATION MARK" }, -{ 0x0022, "quot", "QUOTATION MARK" }, -{ 0x0023, "num", "NUMBER SIGN" }, -{ 0x0024, "dollar", "DOLLAR SIGN" }, -{ 0x0025, "percnt", "PERCENT SIGN" }, -{ 0x0027, "apos", "APOSTROPHE" }, -{ 0x0028, "lpar", "LEFT PARENTHESIS" }, -{ 0x0029, "rpar", "RIGHT PARENTHESIS" }, -{ 0x002A, "ast", "ASTERISK OPERATOR" }, -{ 0x002B, "plus", "PLUS SIGN" }, -{ 0x002C, "comma", "COMMA" }, -{ 0x002D, "hyphen", "HYPHEN-MINUS" }, -{ 0x002E, "period", "FULL STOP" }, -{ 0x002F, "sol", "SOLIDUS" }, -{ 0x003A, "colon", "COLON" }, -{ 0x003B, "semi", "SEMICOLON" }, -{ 0x003D, "equals", "EQUALS SIGN" }, -{ 0x003E, "gt", "GREATER-THAN SIGN" }, -{ 0x003F, "quest", "QUESTION MARK" }, -{ 0x0040, "commat", "COMMERCIAL AT" }, -{ 0x005B, "lsqb", "LEFT SQUARE BRACKET" }, -{ 0x005C, "bsol", "REVERSE SOLIDUS" }, -{ 0x005D, "rsqb", "RIGHT SQUARE BRACKET" }, -{ 0x005E, "circ", "RING OPERATOR" }, -{ 0x005F, "lowbar", "LOW LINE" }, -{ 0x0060, "grave", "GRAVE ACCENT" }, -{ 0x007B, "lcub", "LEFT CURLY BRACKET" }, -{ 0x007C, "verbar", "VERTICAL LINE" }, -{ 0x007D, "rcub", "RIGHT CURLY BRACKET" }, -{ 0x00A0, "nbsp", "NO-BREAK SPACE" }, -{ 0x00A1, "iexcl", "INVERTED EXCLAMATION MARK" }, -{ 0x00A2, "cent", "CENT SIGN" }, -{ 0x00A3, "pound", "POUND SIGN" }, -{ 0x00A4, "curren", "CURRENCY SIGN" }, -{ 0x00A5, "yen", "YEN SIGN" }, -{ 0x00A6, "brvbar", "BROKEN BAR" }, -{ 0x00A7, "sect", "SECTION SIGN" }, -{ 0x00A8, "die", "" }, -{ 0x00A8, "Dot", "" }, -{ 0x00A8, "uml", "" }, -{ 0x00A9, "copy", "COPYRIGHT SIGN" }, -{ 0x00AA, "ordf", "FEMININE ORDINAL INDICATOR" }, -{ 0x00AB, "laquo", "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK" }, -{ 0x00AC, "not", "NOT SIGN" }, -{ 0x00AD, "shy", "SOFT HYPHEN" }, -{ 0x00AE, "reg", "REG TRADE MARK SIGN" }, -{ 0x00AF, "macr", "MACRON" }, -{ 0x00B0, "deg", "DEGREE SIGN" }, -{ 0x00B1, "plusmn", "PLUS-MINUS SIGN" }, -{ 0x00B2, "sup2", "SUPERSCRIPT TWO" }, -{ 0x00B3, "sup3", "SUPERSCRIPT THREE" }, -{ 0x00B4, "acute", "ACUTE ACCENT" }, -{ 0x00B5, "micro", "MICRO SIGN" }, -{ 0x00B6, "para", "PILCROW SIGN" }, -{ 0x00B7, "middot", "MIDDLE DOT" }, -{ 0x00B8, "cedil", "CEDILLA" }, -{ 0x00B9, "sup1", "SUPERSCRIPT ONE" }, -{ 0x00BA, "ordm", "MASCULINE ORDINAL INDICATOR" }, -{ 0x00BB, "raquo", "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK" }, -{ 0x00BC, "frac14", "VULGAR FRACTION ONE QUARTER" }, -{ 0x00BD, "frac12", "VULGAR FRACTION ONE HALF" }, -{ 0x00BD, "half", "VULGAR FRACTION ONE HALF" }, -{ 0x00BE, "frac34", "VULGAR FRACTION THREE QUARTERS" }, -{ 0x00BF, "iquest", "INVERTED QUESTION MARK" }, -{ 0x00C0, "Agrave", "LATIN CAPITAL LETTER A WITH GRAVE" }, -{ 0x00C1, "Aacute", "LATIN CAPITAL LETTER A WITH ACUTE" }, -{ 0x00C2, "Acirc", "LATIN CAPITAL LETTER A WITH CIRCUMFLEX" }, -{ 0x00C3, "Atilde", "LATIN CAPITAL LETTER A WITH TILDE" }, -{ 0x00C4, "Auml", "LATIN CAPITAL LETTER A WITH DIAERESIS" }, -{ 0x00C5, "Aring", "LATIN CAPITAL LETTER A WITH RING ABOVE" }, -{ 0x00C6, "AElig", "LATIN CAPITAL LETTER AE" }, -{ 0x00C7, "Ccedil", "LATIN CAPITAL LETTER C WITH CEDILLA" }, -{ 0x00C8, "Egrave", "LATIN CAPITAL LETTER E WITH GRAVE" }, -{ 0x00C9, "Eacute", "LATIN CAPITAL LETTER E WITH ACUTE" }, -{ 0x00CA, "Ecirc", "LATIN CAPITAL LETTER E WITH CIRCUMFLEX" }, -{ 0x00CB, "Euml", "LATIN CAPITAL LETTER E WITH DIAERESIS" }, -{ 0x00CC, "Igrave", "LATIN CAPITAL LETTER I WITH GRAVE" }, -{ 0x00CD, "Iacute", "LATIN CAPITAL LETTER I WITH ACUTE" }, -{ 0x00CE, "Icirc", "LATIN CAPITAL LETTER I WITH CIRCUMFLEX" }, -{ 0x00CF, "Iuml", "LATIN CAPITAL LETTER I WITH DIAERESIS" }, -{ 0x00D0, "ETH", "LATIN CAPITAL LETTER ETH" }, -{ 0x00D1, "Ntilde", "LATIN CAPITAL LETTER N WITH TILDE" }, -{ 0x00D2, "Ograve", "LATIN CAPITAL LETTER O WITH GRAVE" }, -{ 0x00D3, "Oacute", "LATIN CAPITAL LETTER O WITH ACUTE" }, -{ 0x00D4, "Ocirc", "LATIN CAPITAL LETTER O WITH CIRCUMFLEX" }, -{ 0x00D5, "Otilde", "LATIN CAPITAL LETTER O WITH TILDE" }, -{ 0x00D6, "Ouml", "LATIN CAPITAL LETTER O WITH DIAERESIS" }, -{ 0x00D7, "times", "MULTIPLICATION SIGN" }, -{ 0x00D8, "Oslash", "LATIN CAPITAL LETTER O WITH STROKE" }, -{ 0x00D9, "Ugrave", "LATIN CAPITAL LETTER U WITH GRAVE" }, -{ 0x00DA, "Uacute", "LATIN CAPITAL LETTER U WITH ACUTE" }, -{ 0x00DB, "Ucirc", "LATIN CAPITAL LETTER U WITH CIRCUMFLEX" }, -{ 0x00DC, "Uuml", "LATIN CAPITAL LETTER U WITH DIAERESIS" }, -{ 0x00DD, "Yacute", "LATIN CAPITAL LETTER Y WITH ACUTE" }, -{ 0x00DE, "THORN", "LATIN CAPITAL LETTER THORN" }, -{ 0x00DF, "szlig", "LATIN SMALL LETTER SHARP S" }, -{ 0x00E0, "agrave", "LATIN SMALL LETTER A WITH GRAVE" }, -{ 0x00E1, "aacute", "LATIN SMALL LETTER A WITH ACUTE" }, -{ 0x00E2, "acirc", "LATIN SMALL LETTER A WITH CIRCUMFLEX" }, -{ 0x00E3, "atilde", "LATIN SMALL LETTER A WITH TILDE" }, -{ 0x00E4, "auml", "LATIN SMALL LETTER A WITH DIAERESIS" }, -{ 0x00E5, "aring", "LATIN SMALL LETTER A WITH RING ABOVE" }, -{ 0x00E6, "aelig", "LATIN SMALL LETTER AE" }, -{ 0x00E7, "ccedil", "LATIN SMALL LETTER C WITH CEDILLA" }, -{ 0x00E8, "egrave", "LATIN SMALL LETTER E WITH GRAVE" }, -{ 0x00E9, "eacute", "LATIN SMALL LETTER E WITH ACUTE" }, -{ 0x00EA, "ecirc", "LATIN SMALL LETTER E WITH CIRCUMFLEX" }, -{ 0x00EB, "euml", "LATIN SMALL LETTER E WITH DIAERESIS" }, -{ 0x00EC, "igrave", "LATIN SMALL LETTER I WITH GRAVE" }, -{ 0x00ED, "iacute", "LATIN SMALL LETTER I WITH ACUTE" }, -{ 0x00EE, "icirc", "LATIN SMALL LETTER I WITH CIRCUMFLEX" }, -{ 0x00EF, "iuml", "LATIN SMALL LETTER I WITH DIAERESIS" }, -{ 0x00F0, "eth", "LATIN SMALL LETTER ETH" }, -{ 0x00F1, "ntilde", "LATIN SMALL LETTER N WITH TILDE" }, -{ 0x00F2, "ograve", "LATIN SMALL LETTER O WITH GRAVE" }, -{ 0x00F3, "oacute", "LATIN SMALL LETTER O WITH ACUTE" }, -{ 0x00F4, "ocirc", "LATIN SMALL LETTER O WITH CIRCUMFLEX" }, -{ 0x00F5, "otilde", "LATIN SMALL LETTER O WITH TILDE" }, -{ 0x00F6, "ouml", "LATIN SMALL LETTER O WITH DIAERESIS" }, -{ 0x00F7, "divide", "DIVISION SIGN" }, -{ 0x00F8, "oslash", "CIRCLED DIVISION SLASH" }, -{ 0x00F9, "ugrave", "LATIN SMALL LETTER U WITH GRAVE" }, -{ 0x00FA, "uacute", "LATIN SMALL LETTER U WITH ACUTE" }, -{ 0x00FB, "ucirc", "LATIN SMALL LETTER U WITH CIRCUMFLEX" }, -{ 0x00FC, "uuml", "LATIN SMALL LETTER U WITH DIAERESIS" }, -{ 0x00FD, "yacute", "LATIN SMALL LETTER Y WITH ACUTE" }, -{ 0x00FE, "thorn", "LATIN SMALL LETTER THORN" }, -{ 0x00FF, "yuml", "LATIN SMALL LETTER Y WITH DIAERESIS" }, -{ 0x0100, "Amacr", "LATIN CAPITAL LETTER A WITH MACRON" }, -{ 0x0101, "amacr", "LATIN SMALL LETTER A WITH MACRON" }, -{ 0x0102, "Abreve", "LATIN CAPITAL LETTER A WITH BREVE" }, -{ 0x0103, "abreve", "LATIN SMALL LETTER A WITH BREVE" }, -{ 0x0104, "Aogon", "LATIN CAPITAL LETTER A WITH OGONEK" }, -{ 0x0105, "aogon", "LATIN SMALL LETTER A WITH OGONEK" }, -{ 0x0106, "Cacute", "LATIN CAPITAL LETTER C WITH ACUTE" }, -{ 0x0107, "cacute", "LATIN SMALL LETTER C WITH ACUTE" }, -{ 0x0108, "Ccirc", "LATIN CAPITAL LETTER C WITH CIRCUMFLEX" }, -{ 0x0109, "ccirc", "LATIN SMALL LETTER C WITH CIRCUMFLEX" }, -{ 0x010A, "Cdot", "LATIN CAPITAL LETTER C WITH DOT ABOVE" }, -{ 0x010B, "cdot", "DOT OPERATOR" }, -{ 0x010C, "Ccaron", "LATIN CAPITAL LETTER C WITH CARON" }, -{ 0x010D, "ccaron", "LATIN SMALL LETTER C WITH CARON" }, -{ 0x010E, "Dcaron", "LATIN CAPITAL LETTER D WITH CARON" }, -{ 0x010F, "dcaron", "LATIN SMALL LETTER D WITH CARON" }, -{ 0x0110, "Dstrok", "LATIN CAPITAL LETTER D WITH STROKE" }, -{ 0x0111, "dstrok", "LATIN SMALL LETTER D WITH STROKE" }, -{ 0x0112, "Emacr", "LATIN CAPITAL LETTER E WITH MACRON" }, -{ 0x0113, "emacr", "LATIN SMALL LETTER E WITH MACRON" }, -{ 0x0116, "Edot", "LATIN CAPITAL LETTER E WITH DOT ABOVE" }, -{ 0x0117, "edot", "LATIN SMALL LETTER E WITH DOT ABOVE" }, -{ 0x0118, "Eogon", "LATIN CAPITAL LETTER E WITH OGONEK" }, -{ 0x0119, "eogon", "LATIN SMALL LETTER E WITH OGONEK" }, -{ 0x011A, "Ecaron", "LATIN CAPITAL LETTER E WITH CARON" }, -{ 0x011B, "ecaron", "LATIN SMALL LETTER E WITH CARON" }, -{ 0x011C, "Gcirc", "LATIN CAPITAL LETTER G WITH CIRCUMFLEX" }, -{ 0x011D, "gcirc", "LATIN SMALL LETTER G WITH CIRCUMFLEX" }, -{ 0x011E, "Gbreve", "LATIN CAPITAL LETTER G WITH BREVE" }, -{ 0x011F, "gbreve", "LATIN SMALL LETTER G WITH BREVE" }, -{ 0x0120, "Gdot", "LATIN CAPITAL LETTER G WITH DOT ABOVE" }, -{ 0x0121, "gdot", "LATIN SMALL LETTER G WITH DOT ABOVE" }, -{ 0x0122, "Gcedil", "LATIN CAPITAL LETTER G WITH CEDILLA" }, -{ 0x0124, "Hcirc", "LATIN CAPITAL LETTER H WITH CIRCUMFLEX" }, -{ 0x0125, "hcirc", "LATIN SMALL LETTER H WITH CIRCUMFLEX" }, -{ 0x0126, "Hstrok", "LATIN CAPITAL LETTER H WITH STROKE" }, -{ 0x0127, "hstrok", "LATIN SMALL LETTER H WITH STROKE" }, -{ 0x0128, "Itilde", "LATIN CAPITAL LETTER I WITH TILDE" }, -{ 0x0129, "itilde", "LATIN SMALL LETTER I WITH TILDE" }, -{ 0x012A, "Imacr", "LATIN CAPITAL LETTER I WITH MACRON" }, -{ 0x012B, "imacr", "LATIN SMALL LETTER I WITH MACRON" }, -{ 0x012E, "Iogon", "LATIN CAPITAL LETTER I WITH OGONEK" }, -{ 0x012F, "iogon", "LATIN SMALL LETTER I WITH OGONEK" }, -{ 0x0130, "Idot", "LATIN CAPITAL LETTER I WITH DOT ABOVE" }, -{ 0x0131, "inodot", "LATIN SMALL LETTER DOTLESS I" }, -{ 0x0131, "inodot", "LATIN SMALL LETTER DOTLESS I" }, -{ 0x0132, "IJlig", "LATIN CAPITAL LIGATURE IJ" }, -{ 0x0133, "ijlig", "LATIN SMALL LIGATURE IJ" }, -{ 0x0134, "Jcirc", "LATIN CAPITAL LETTER J WITH CIRCUMFLEX" }, -{ 0x0135, "jcirc", "LATIN SMALL LETTER J WITH CIRCUMFLEX" }, -{ 0x0136, "Kcedil", "LATIN CAPITAL LETTER K WITH CEDILLA" }, -{ 0x0137, "kcedil", "LATIN SMALL LETTER K WITH CEDILLA" }, -{ 0x0138, "kgreen", "LATIN SMALL LETTER KRA" }, -{ 0x0139, "Lacute", "LATIN CAPITAL LETTER L WITH ACUTE" }, -{ 0x013A, "lacute", "LATIN SMALL LETTER L WITH ACUTE" }, -{ 0x013B, "Lcedil", "LATIN CAPITAL LETTER L WITH CEDILLA" }, -{ 0x013C, "lcedil", "LATIN SMALL LETTER L WITH CEDILLA" }, -{ 0x013D, "Lcaron", "LATIN CAPITAL LETTER L WITH CARON" }, -{ 0x013E, "lcaron", "LATIN SMALL LETTER L WITH CARON" }, -{ 0x013F, "Lmidot", "LATIN CAPITAL LETTER L WITH MIDDLE DOT" }, -{ 0x0140, "lmidot", "LATIN SMALL LETTER L WITH MIDDLE DOT" }, -{ 0x0141, "Lstrok", "LATIN CAPITAL LETTER L WITH STROKE" }, -{ 0x0142, "lstrok", "LATIN SMALL LETTER L WITH STROKE" }, -{ 0x0143, "Nacute", "LATIN CAPITAL LETTER N WITH ACUTE" }, -{ 0x0144, "nacute", "LATIN SMALL LETTER N WITH ACUTE" }, -{ 0x0145, "Ncedil", "LATIN CAPITAL LETTER N WITH CEDILLA" }, -{ 0x0146, "ncedil", "LATIN SMALL LETTER N WITH CEDILLA" }, -{ 0x0147, "Ncaron", "LATIN CAPITAL LETTER N WITH CARON" }, -{ 0x0148, "ncaron", "LATIN SMALL LETTER N WITH CARON" }, -{ 0x0149, "napos", "LATIN SMALL LETTER N PRECEDED BY APOSTROPHE" }, -{ 0x014A, "ENG", "LATIN CAPITAL LETTER ENG" }, -{ 0x014B, "eng", "LATIN SMALL LETTER ENG" }, -{ 0x014C, "Omacr", "LATIN CAPITAL LETTER O WITH MACRON" }, -{ 0x014D, "omacr", "LATIN SMALL LETTER O WITH MACRON" }, -{ 0x0150, "Odblac", "LATIN CAPITAL LETTER O WITH DOUBLE ACUTE" }, -{ 0x0151, "odblac", "LATIN SMALL LETTER O WITH DOUBLE ACUTE" }, -{ 0x0152, "OElig", "LATIN CAPITAL LIGATURE OE" }, -{ 0x0153, "oelig", "LATIN SMALL LIGATURE OE" }, -{ 0x0154, "Racute", "LATIN CAPITAL LETTER R WITH ACUTE" }, -{ 0x0155, "racute", "LATIN SMALL LETTER R WITH ACUTE" }, -{ 0x0156, "Rcedil", "LATIN CAPITAL LETTER R WITH CEDILLA" }, -{ 0x0157, "rcedil", "LATIN SMALL LETTER R WITH CEDILLA" }, -{ 0x0158, "Rcaron", "LATIN CAPITAL LETTER R WITH CARON" }, -{ 0x0159, "rcaron", "LATIN SMALL LETTER R WITH CARON" }, -{ 0x015A, "Sacute", "LATIN CAPITAL LETTER S WITH ACUTE" }, -{ 0x015B, "sacute", "LATIN SMALL LETTER S WITH ACUTE" }, -{ 0x015C, "Scirc", "LATIN CAPITAL LETTER S WITH CIRCUMFLEX" }, -{ 0x015D, "scirc", "LATIN SMALL LETTER S WITH CIRCUMFLEX" }, -{ 0x015E, "Scedil", "LATIN CAPITAL LETTER S WITH CEDILLA" }, -{ 0x015F, "scedil", "LATIN SMALL LETTER S WITH CEDILLA" }, -{ 0x0160, "Scaron", "LATIN CAPITAL LETTER S WITH CARON" }, -{ 0x0161, "scaron", "LATIN SMALL LETTER S WITH CARON" }, -{ 0x0162, "Tcedil", "LATIN CAPITAL LETTER T WITH CEDILLA" }, -{ 0x0163, "tcedil", "LATIN SMALL LETTER T WITH CEDILLA" }, -{ 0x0164, "Tcaron", "LATIN CAPITAL LETTER T WITH CARON" }, -{ 0x0165, "tcaron", "LATIN SMALL LETTER T WITH CARON" }, -{ 0x0166, "Tstrok", "LATIN CAPITAL LETTER T WITH STROKE" }, -{ 0x0167, "tstrok", "LATIN SMALL LETTER T WITH STROKE" }, -{ 0x0168, "Utilde", "LATIN CAPITAL LETTER U WITH TILDE" }, -{ 0x0169, "utilde", "LATIN SMALL LETTER U WITH TILDE" }, -{ 0x016A, "Umacr", "LATIN CAPITAL LETTER U WITH MACRON" }, -{ 0x016B, "umacr", "LATIN SMALL LETTER U WITH MACRON" }, -{ 0x016C, "Ubreve", "LATIN CAPITAL LETTER U WITH BREVE" }, -{ 0x016D, "ubreve", "LATIN SMALL LETTER U WITH BREVE" }, -{ 0x016E, "Uring", "LATIN CAPITAL LETTER U WITH RING ABOVE" }, -{ 0x016F, "uring", "LATIN SMALL LETTER U WITH RING ABOVE" }, -{ 0x0170, "Udblac", "LATIN CAPITAL LETTER U WITH DOUBLE ACUTE" }, -{ 0x0171, "udblac", "LATIN SMALL LETTER U WITH DOUBLE ACUTE" }, -{ 0x0172, "Uogon", "LATIN CAPITAL LETTER U WITH OGONEK" }, -{ 0x0173, "uogon", "LATIN SMALL LETTER U WITH OGONEK" }, -{ 0x0174, "Wcirc", "LATIN CAPITAL LETTER W WITH CIRCUMFLEX" }, -{ 0x0175, "wcirc", "LATIN SMALL LETTER W WITH CIRCUMFLEX" }, -{ 0x0176, "Ycirc", "LATIN CAPITAL LETTER Y WITH CIRCUMFLEX" }, -{ 0x0177, "ycirc", "LATIN SMALL LETTER Y WITH CIRCUMFLEX" }, -{ 0x0178, "Yuml", "LATIN CAPITAL LETTER Y WITH DIAERESIS" }, -{ 0x0179, "Zacute", "LATIN CAPITAL LETTER Z WITH ACUTE" }, -{ 0x017A, "zacute", "LATIN SMALL LETTER Z WITH ACUTE" }, -{ 0x017B, "Zdot", "LATIN CAPITAL LETTER Z WITH DOT ABOVE" }, -{ 0x017C, "zdot", "LATIN SMALL LETTER Z WITH DOT ABOVE" }, -{ 0x017D, "Zcaron", "LATIN CAPITAL LETTER Z WITH CARON" }, -{ 0x017E, "zcaron", "LATIN SMALL LETTER Z WITH CARON" }, -{ 0x0192, "fnof", "LATIN SMALL LETTER F WITH HOOK" }, -{ 0x01F5, "gacute", "LATIN SMALL LETTER G WITH ACUTE" }, -{ 0x02C7, "caron", "CARON" }, -{ 0x02D8, "breve", "BREVE" }, -{ 0x02D9, "dot", "DOT ABOVE" }, -{ 0x02DA, "ring", "RING ABOVE" }, -{ 0x02DB, "ogon", "OGONEK" }, -{ 0x02DC, "tilde", "TILDE" }, -{ 0x02DD, "dblac", "DOUBLE ACUTE ACCENT" }, -{ 0x0386, "Aacgr", "GREEK CAPITAL LETTER ALPHA WITH TONOS" }, -{ 0x0388, "Eacgr", "GREEK CAPITAL LETTER EPSILON WITH TONOS" }, -{ 0x0389, "EEacgr", "GREEK CAPITAL LETTER ETA WITH TONOS" }, -{ 0x038A, "Iacgr", "GREEK CAPITAL LETTER IOTA WITH TONOS" }, -{ 0x038C, "Oacgr", "GREEK CAPITAL LETTER OMICRON WITH TONOS" }, -{ 0x038E, "Uacgr", "GREEK CAPITAL LETTER UPSILON WITH TONOS" }, -{ 0x038F, "OHacgr", "GREEK CAPITAL LETTER OMEGA WITH TONOS" }, -{ 0x0390, "idiagr", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS" }, -{ 0x0391, "Agr", "GREEK CAPITAL LETTER ALPHA" }, -{ 0x0392, "Bgr", "GREEK CAPITAL LETTER BETA" }, -{ 0x0393, "b.Gamma", "GREEK CAPITAL LETTER GAMMA" }, -{ 0x0393, "Gamma", "GREEK CAPITAL LETTER GAMMA" }, -{ 0x0393, "Ggr", "GREEK CAPITAL LETTER GAMMA" }, -{ 0x0394, "b.Delta", "GREEK CAPITAL LETTER DELTA" }, -{ 0x0394, "Delta", "GREEK CAPITAL LETTER DELTA" }, -{ 0x0394, "Dgr", "GREEK CAPITAL LETTER DELTA" }, -{ 0x0395, "Egr", "GREEK CAPITAL LETTER EPSILON" }, -{ 0x0396, "Zgr", "GREEK CAPITAL LETTER ZETA" }, -{ 0x0397, "EEgr", "GREEK CAPITAL LETTER ETA" }, -{ 0x0398, "b.Theta", "GREEK CAPITAL LETTER THETA" }, -{ 0x0398, "Theta", "GREEK CAPITAL LETTER THETA" }, -{ 0x0398, "THgr", "GREEK CAPITAL LETTER THETA" }, -{ 0x0399, "Igr", "GREEK CAPITAL LETTER IOTA" }, -{ 0x039A, "Kgr", "GREEK CAPITAL LETTER KAPPA" }, -{ 0x039B, "b.Lambda", "GREEK CAPITAL LETTER LAMDA" }, -{ 0x039B, "Lambda", "GREEK CAPITAL LETTER LAMDA" }, -{ 0x039B, "Lgr", "GREEK CAPITAL LETTER LAMDA" }, -{ 0x039C, "Mgr", "GREEK CAPITAL LETTER MU" }, -{ 0x039D, "Ngr", "GREEK CAPITAL LETTER NU" }, -{ 0x039E, "b.Xi", "GREEK CAPITAL LETTER XI" }, -{ 0x039E, "Xgr", "GREEK CAPITAL LETTER XI" }, -{ 0x039E, "Xi", "GREEK CAPITAL LETTER XI" }, -{ 0x039F, "Ogr", "GREEK CAPITAL LETTER OMICRON" }, -{ 0x03A0, "b.Pi", "GREEK CAPITAL LETTER PI" }, -{ 0x03A0, "Pgr", "GREEK CAPITAL LETTER PI" }, -{ 0x03A0, "Pi", "GREEK CAPITAL LETTER PI" }, -{ 0x03A1, "Rgr", "GREEK CAPITAL LETTER RHO" }, -{ 0x03A3, "b.Sigma", "GREEK CAPITAL LETTER SIGMA" }, -{ 0x03A3, "Sgr", "GREEK CAPITAL LETTER SIGMA" }, -{ 0x03A3, "Sigma", "GREEK CAPITAL LETTER SIGMA" }, -{ 0x03A4, "Tgr", "GREEK CAPITAL LETTER TAU" }, -{ 0x03A5, "Ugr", "" }, -{ 0x03A6, "b.Phi", "GREEK CAPITAL LETTER PHI" }, -{ 0x03A6, "PHgr", "GREEK CAPITAL LETTER PHI" }, -{ 0x03A6, "Phi", "GREEK CAPITAL LETTER PHI" }, -{ 0x03A7, "KHgr", "GREEK CAPITAL LETTER CHI" }, -{ 0x03A8, "b.Psi", "GREEK CAPITAL LETTER PSI" }, -{ 0x03A8, "PSgr", "GREEK CAPITAL LETTER PSI" }, -{ 0x03A8, "Psi", "GREEK CAPITAL LETTER PSI" }, -{ 0x03A9, "b.Omega", "GREEK CAPITAL LETTER OMEGA" }, -{ 0x03A9, "OHgr", "GREEK CAPITAL LETTER OMEGA" }, -{ 0x03A9, "Omega", "GREEK CAPITAL LETTER OMEGA" }, -{ 0x03AA, "Idigr", "GREEK CAPITAL LETTER IOTA WITH DIALYTIKA" }, -{ 0x03AB, "Udigr", "GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA" }, -{ 0x03AC, "aacgr", "GREEK SMALL LETTER ALPHA WITH TONOS" }, -{ 0x03AD, "eacgr", "GREEK SMALL LETTER EPSILON WITH TONOS" }, -{ 0x03AE, "eeacgr", "GREEK SMALL LETTER ETA WITH TONOS" }, -{ 0x03AF, "iacgr", "GREEK SMALL LETTER IOTA WITH TONOS" }, -{ 0x03B0, "udiagr", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS" }, -{ 0x03B1, "agr", "" }, -{ 0x03B1, "alpha", "" }, -{ 0x03B1, "b.alpha", "" }, -{ 0x03B2, "b.beta", "GREEK SMALL LETTER BETA" }, -{ 0x03B2, "beta", "GREEK SMALL LETTER BETA" }, -{ 0x03B2, "bgr", "GREEK SMALL LETTER BETA" }, -{ 0x03B3, "b.gamma", "GREEK SMALL LETTER GAMMA" }, -{ 0x03B3, "gamma", "GREEK SMALL LETTER GAMMA" }, -{ 0x03B3, "ggr", "GREEK SMALL LETTER GAMMA" }, -{ 0x03B4, "b.delta", "GREEK SMALL LETTER DELTA" }, -{ 0x03B4, "delta", "GREEK SMALL LETTER DELTA" }, -{ 0x03B4, "dgr", "GREEK SMALL LETTER DELTA" }, -{ 0x03B5, "b.epsi", "" }, -{ 0x03B5, "b.epsis", "" }, -{ 0x03B5, "b.epsiv", "" }, -{ 0x03B5, "egr", "" }, -{ 0x03B5, "epsiv", "" }, -{ 0x03B6, "b.zeta", "GREEK SMALL LETTER ZETA" }, -{ 0x03B6, "zeta", "GREEK SMALL LETTER ZETA" }, -{ 0x03B6, "zgr", "GREEK SMALL LETTER ZETA" }, -{ 0x03B7, "b.eta", "GREEK SMALL LETTER ETA" }, -{ 0x03B7, "eegr", "GREEK SMALL LETTER ETA" }, -{ 0x03B7, "eta", "GREEK SMALL LETTER ETA" }, -{ 0x03B8, "b.thetas", "" }, -{ 0x03B8, "thetas", "" }, -{ 0x03B8, "thgr", "" }, -{ 0x03B9, "b.iota", "GREEK SMALL LETTER IOTA" }, -{ 0x03B9, "igr", "GREEK SMALL LETTER IOTA" }, -{ 0x03B9, "iota", "GREEK SMALL LETTER IOTA" }, -{ 0x03BA, "b.kappa", "GREEK SMALL LETTER KAPPA" }, -{ 0x03BA, "kappa", "GREEK SMALL LETTER KAPPA" }, -{ 0x03BA, "kgr", "GREEK SMALL LETTER KAPPA" }, -{ 0x03BB, "b.lambda", "GREEK SMALL LETTER LAMDA" }, -{ 0x03BB, "lambda", "GREEK SMALL LETTER LAMDA" }, -{ 0x03BB, "lgr", "GREEK SMALL LETTER LAMDA" }, -{ 0x03BC, "b.mu", "GREEK SMALL LETTER MU" }, -{ 0x03BC, "mgr", "GREEK SMALL LETTER MU" }, -{ 0x03BC, "mu", "GREEK SMALL LETTER MU" }, -{ 0x03BD, "b.nu", "GREEK SMALL LETTER NU" }, -{ 0x03BD, "ngr", "GREEK SMALL LETTER NU" }, -{ 0x03BD, "nu", "GREEK SMALL LETTER NU" }, -{ 0x03BE, "b.xi", "GREEK SMALL LETTER XI" }, -{ 0x03BE, "xgr", "GREEK SMALL LETTER XI" }, -{ 0x03BE, "xi", "GREEK SMALL LETTER XI" }, -{ 0x03BF, "ogr", "GREEK SMALL LETTER OMICRON" }, -{ 0x03C0, "b.pi", "GREEK SMALL LETTER PI" }, -{ 0x03C0, "pgr", "GREEK SMALL LETTER PI" }, -{ 0x03C0, "pi", "GREEK SMALL LETTER PI" }, -{ 0x03C1, "b.rho", "GREEK SMALL LETTER RHO" }, -{ 0x03C1, "rgr", "GREEK SMALL LETTER RHO" }, -{ 0x03C1, "rho", "GREEK SMALL LETTER RHO" }, -{ 0x03C2, "b.sigmav", "" }, -{ 0x03C2, "sfgr", "" }, -{ 0x03C2, "sigmav", "" }, -{ 0x03C3, "b.sigma", "GREEK SMALL LETTER SIGMA" }, -{ 0x03C3, "sgr", "GREEK SMALL LETTER SIGMA" }, -{ 0x03C3, "sigma", "GREEK SMALL LETTER SIGMA" }, -{ 0x03C4, "b.tau", "GREEK SMALL LETTER TAU" }, -{ 0x03C4, "tau", "GREEK SMALL LETTER TAU" }, -{ 0x03C4, "tgr", "GREEK SMALL LETTER TAU" }, -{ 0x03C5, "b.upsi", "GREEK SMALL LETTER UPSILON" }, -{ 0x03C5, "ugr", "GREEK SMALL LETTER UPSILON" }, -{ 0x03C5, "upsi", "GREEK SMALL LETTER UPSILON" }, -{ 0x03C6, "b.phis", "GREEK SMALL LETTER PHI" }, -{ 0x03C6, "phgr", "GREEK SMALL LETTER PHI" }, -{ 0x03C6, "phis", "GREEK SMALL LETTER PHI" }, -{ 0x03C7, "b.chi", "GREEK SMALL LETTER CHI" }, -{ 0x03C7, "chi", "GREEK SMALL LETTER CHI" }, -{ 0x03C7, "khgr", "GREEK SMALL LETTER CHI" }, -{ 0x03C8, "b.psi", "GREEK SMALL LETTER PSI" }, -{ 0x03C8, "psgr", "GREEK SMALL LETTER PSI" }, -{ 0x03C8, "psi", "GREEK SMALL LETTER PSI" }, -{ 0x03C9, "b.omega", "GREEK SMALL LETTER OMEGA" }, -{ 0x03C9, "ohgr", "GREEK SMALL LETTER OMEGA" }, -{ 0x03C9, "omega", "GREEK SMALL LETTER OMEGA" }, -{ 0x03CA, "idigr", "GREEK SMALL LETTER IOTA WITH DIALYTIKA" }, -{ 0x03CB, "udigr", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA" }, -{ 0x03CC, "oacgr", "GREEK SMALL LETTER OMICRON WITH TONOS" }, -{ 0x03CD, "uacgr", "GREEK SMALL LETTER UPSILON WITH TONOS" }, -{ 0x03CE, "ohacgr", "GREEK SMALL LETTER OMEGA WITH TONOS" }, -{ 0x03D1, "b.thetav", "" }, -{ 0x03D1, "thetav", "" }, -{ 0x03D2, "b.Upsi", "" }, -{ 0x03D2, "Upsi", "" }, -{ 0x03D5, "b.phiv", "GREEK PHI SYMBOL" }, -{ 0x03D5, "phiv", "GREEK PHI SYMBOL" }, -{ 0x03D6, "b.piv", "GREEK PI SYMBOL" }, -{ 0x03D6, "piv", "GREEK PI SYMBOL" }, -{ 0x03DC, "b.gammad", "GREEK LETTER DIGAMMA" }, -{ 0x03DC, "gammad", "GREEK LETTER DIGAMMA" }, -{ 0x03F0, "b.kappav", "GREEK KAPPA SYMBOL" }, -{ 0x03F0, "kappav", "GREEK KAPPA SYMBOL" }, -{ 0x03F1, "b.rhov", "GREEK RHO SYMBOL" }, -{ 0x03F1, "rhov", "GREEK RHO SYMBOL" }, -{ 0x0401, "IOcy", "CYRILLIC CAPITAL LETTER IO" }, -{ 0x0402, "DJcy", "CYRILLIC CAPITAL LETTER DJE" }, -{ 0x0403, "GJcy", "CYRILLIC CAPITAL LETTER GJE" }, -{ 0x0404, "Jukcy", "CYRILLIC CAPITAL LETTER UKRAINIAN IE" }, -{ 0x0405, "DScy", "CYRILLIC CAPITAL LETTER DZE" }, -{ 0x0406, "Iukcy", "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I" }, -{ 0x0407, "YIcy", "CYRILLIC CAPITAL LETTER YI" }, -{ 0x0408, "Jsercy", "CYRILLIC CAPITAL LETTER JE" }, -{ 0x0409, "LJcy", "CYRILLIC CAPITAL LETTER LJE" }, -{ 0x040A, "NJcy", "CYRILLIC CAPITAL LETTER NJE" }, -{ 0x040B, "TSHcy", "CYRILLIC CAPITAL LETTER TSHE" }, -{ 0x040C, "KJcy", "CYRILLIC CAPITAL LETTER KJE" }, -{ 0x040E, "Ubrcy", "CYRILLIC CAPITAL LETTER SHORT U" }, -{ 0x040F, "DZcy", "CYRILLIC CAPITAL LETTER DZHE" }, -{ 0x0410, "Acy", "CYRILLIC CAPITAL LETTER A" }, -{ 0x0411, "Bcy", "CYRILLIC CAPITAL LETTER BE" }, -{ 0x0412, "Vcy", "CYRILLIC CAPITAL LETTER VE" }, -{ 0x0413, "Gcy", "CYRILLIC CAPITAL LETTER GHE" }, -{ 0x0414, "Dcy", "CYRILLIC CAPITAL LETTER DE" }, -{ 0x0415, "IEcy", "CYRILLIC CAPITAL LETTER IE" }, -{ 0x0416, "ZHcy", "CYRILLIC CAPITAL LETTER ZHE" }, -{ 0x0417, "Zcy", "CYRILLIC CAPITAL LETTER ZE" }, -{ 0x0418, "Icy", "CYRILLIC CAPITAL LETTER I" }, -{ 0x0419, "Jcy", "CYRILLIC CAPITAL LETTER SHORT I" }, -{ 0x041A, "Kcy", "CYRILLIC CAPITAL LETTER KA" }, -{ 0x041B, "Lcy", "CYRILLIC CAPITAL LETTER EL" }, -{ 0x041C, "Mcy", "CYRILLIC CAPITAL LETTER EM" }, -{ 0x041D, "Ncy", "CYRILLIC CAPITAL LETTER EN" }, -{ 0x041E, "Ocy", "CYRILLIC CAPITAL LETTER O" }, -{ 0x041F, "Pcy", "CYRILLIC CAPITAL LETTER PE" }, -{ 0x0420, "Rcy", "CYRILLIC CAPITAL LETTER ER" }, -{ 0x0421, "Scy", "CYRILLIC CAPITAL LETTER ES" }, -{ 0x0422, "Tcy", "CYRILLIC CAPITAL LETTER TE" }, -{ 0x0423, "Ucy", "CYRILLIC CAPITAL LETTER U" }, -{ 0x0424, "Fcy", "CYRILLIC CAPITAL LETTER EF" }, -{ 0x0425, "KHcy", "CYRILLIC CAPITAL LETTER HA" }, -{ 0x0426, "TScy", "CYRILLIC CAPITAL LETTER TSE" }, -{ 0x0427, "CHcy", "CYRILLIC CAPITAL LETTER CHE" }, -{ 0x0428, "SHcy", "CYRILLIC CAPITAL LETTER SHA" }, -{ 0x0429, "SHCHcy", "CYRILLIC CAPITAL LETTER SHCHA" }, -{ 0x042A, "HARDcy", "CYRILLIC CAPITAL LETTER HARD SIGN" }, -{ 0x042B, "Ycy", "CYRILLIC CAPITAL LETTER YERU" }, -{ 0x042C, "SOFTcy", "CYRILLIC CAPITAL LETTER SOFT SIGN" }, -{ 0x042D, "Ecy", "CYRILLIC CAPITAL LETTER E" }, -{ 0x042E, "YUcy", "CYRILLIC CAPITAL LETTER YU" }, -{ 0x042F, "YAcy", "CYRILLIC CAPITAL LETTER YA" }, -{ 0x0430, "acy", "CYRILLIC SMALL LETTER A" }, -{ 0x0431, "bcy", "CYRILLIC SMALL LETTER BE" }, -{ 0x0432, "vcy", "CYRILLIC SMALL LETTER VE" }, -{ 0x0433, "gcy", "CYRILLIC SMALL LETTER GHE" }, -{ 0x0434, "dcy", "CYRILLIC SMALL LETTER DE" }, -{ 0x0435, "iecy", "CYRILLIC SMALL LETTER IE" }, -{ 0x0436, "zhcy", "CYRILLIC SMALL LETTER ZHE" }, -{ 0x0437, "zcy", "CYRILLIC SMALL LETTER ZE" }, -{ 0x0438, "icy", "CYRILLIC SMALL LETTER I" }, -{ 0x0439, "jcy", "CYRILLIC SMALL LETTER SHORT I" }, -{ 0x043A, "kcy", "CYRILLIC SMALL LETTER KA" }, -{ 0x043B, "lcy", "CYRILLIC SMALL LETTER EL" }, -{ 0x043C, "mcy", "CYRILLIC SMALL LETTER EM" }, -{ 0x043D, "ncy", "CYRILLIC SMALL LETTER EN" }, -{ 0x043E, "ocy", "CYRILLIC SMALL LETTER O" }, -{ 0x043F, "pcy", "CYRILLIC SMALL LETTER PE" }, -{ 0x0440, "rcy", "CYRILLIC SMALL LETTER ER" }, -{ 0x0441, "scy", "CYRILLIC SMALL LETTER ES" }, -{ 0x0442, "tcy", "CYRILLIC SMALL LETTER TE" }, -{ 0x0443, "ucy", "CYRILLIC SMALL LETTER U" }, -{ 0x0444, "fcy", "CYRILLIC SMALL LETTER EF" }, -{ 0x0445, "khcy", "CYRILLIC SMALL LETTER HA" }, -{ 0x0446, "tscy", "CYRILLIC SMALL LETTER TSE" }, -{ 0x0447, "chcy", "CYRILLIC SMALL LETTER CHE" }, -{ 0x0448, "shcy", "CYRILLIC SMALL LETTER SHA" }, -{ 0x0449, "shchcy", "CYRILLIC SMALL LETTER SHCHA" }, -{ 0x044A, "hardcy", "CYRILLIC SMALL LETTER HARD SIGN" }, -{ 0x044B, "ycy", "CYRILLIC SMALL LETTER YERU" }, -{ 0x044C, "softcy", "CYRILLIC SMALL LETTER SOFT SIGN" }, -{ 0x044D, "ecy", "CYRILLIC SMALL LETTER E" }, -{ 0x044E, "yucy", "CYRILLIC SMALL LETTER YU" }, -{ 0x044F, "yacy", "CYRILLIC SMALL LETTER YA" }, -{ 0x0451, "iocy", "CYRILLIC SMALL LETTER IO" }, -{ 0x0452, "djcy", "CYRILLIC SMALL LETTER DJE" }, -{ 0x0453, "gjcy", "CYRILLIC SMALL LETTER GJE" }, -{ 0x0454, "jukcy", "CYRILLIC SMALL LETTER UKRAINIAN IE" }, -{ 0x0455, "dscy", "CYRILLIC SMALL LETTER DZE" }, -{ 0x0456, "iukcy", "CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I" }, -{ 0x0457, "yicy", "CYRILLIC SMALL LETTER YI" }, -{ 0x0458, "jsercy", "CYRILLIC SMALL LETTER JE" }, -{ 0x0459, "ljcy", "CYRILLIC SMALL LETTER LJE" }, -{ 0x045A, "njcy", "CYRILLIC SMALL LETTER NJE" }, -{ 0x045B, "tshcy", "CYRILLIC SMALL LETTER TSHE" }, -{ 0x045C, "kjcy", "CYRILLIC SMALL LETTER KJE" }, -{ 0x045E, "ubrcy", "CYRILLIC SMALL LETTER SHORT U" }, -{ 0x045F, "dzcy", "CYRILLIC SMALL LETTER DZHE" }, -{ 0x2002, "ensp", "EN SPACE" }, -{ 0x2003, "emsp", "EM SPACE" }, -{ 0x2004, "emsp13", "THREE-PER-EM SPACE" }, -{ 0x2005, "emsp14", "FOUR-PER-EM SPACE" }, -{ 0x2007, "numsp", "FIGURE SPACE" }, -{ 0x2008, "puncsp", "PUNCTUATION SPACE" }, -{ 0x2009, "thinsp", "THIN SPACE" }, -{ 0x200A, "hairsp", "HAIR SPACE" }, -{ 0x2010, "dash", "HYPHEN" }, -{ 0x2013, "ndash", "EN DASH" }, -{ 0x2014, "mdash", "EM DASH" }, -{ 0x2015, "horbar", "HORIZONTAL BAR" }, -{ 0x2016, "Verbar", "DOUBLE VERTICAL LINE" }, -{ 0x2018, "lsquo", "" }, -{ 0x2018, "rsquor", "" }, -{ 0x2019, "rsquo", "RIGHT SINGLE QUOTATION MARK" }, -{ 0x201A, "lsquor", "SINGLE LOW-9 QUOTATION MARK" }, -{ 0x201C, "ldquo", "" }, -{ 0x201C, "rdquor", "" }, -{ 0x201D, "rdquo", "RIGHT DOUBLE QUOTATION MARK" }, -{ 0x201E, "ldquor", "DOUBLE LOW-9 QUOTATION MARK" }, -{ 0x2020, "dagger", "DAGGER" }, -{ 0x2021, "Dagger", "DOUBLE DAGGER" }, -{ 0x2022, "bull", "BULLET" }, -{ 0x2025, "nldr", "TWO DOT LEADER" }, -{ 0x2026, "hellip", "HORIZONTAL ELLIPSIS" }, -{ 0x2026, "mldr", "HORIZONTAL ELLIPSIS" }, -{ 0x2030, "permil", "PER MILLE SIGN" }, -{ 0x2032, "prime", "PRIME" }, -{ 0x2032, "vprime", "PRIME" }, -{ 0x2033, "Prime", "DOUBLE PRIME" }, -{ 0x2034, "tprime", "TRIPLE PRIME" }, -{ 0x2035, "bprime", "REVERSED PRIME" }, -{ 0x2041, "caret", "CARET" }, -{ 0x2043, "hybull", "HYPHEN BULLET" }, -{ 0x20DB, "tdot", "COMBINING THREE DOTS ABOVE" }, -{ 0x20DC, "DotDot", "COMBINING FOUR DOTS ABOVE" }, -{ 0x2105, "incare", "CARE OF" }, -{ 0x210B, "hamilt", "SCRIPT CAPITAL H" }, -{ 0x210F, "planck", "PLANCK CONSTANT OVER TWO PI" }, -{ 0x2111, "image", "BLACK-LETTER CAPITAL I" }, -{ 0x2112, "lagran", "SCRIPT CAPITAL L" }, -{ 0x2113, "ell", "SCRIPT SMALL L" }, -{ 0x2116, "numero", "NUMERO SIGN" }, -{ 0x2117, "copysr", "SOUND RECORDING COPYRIGHT" }, -{ 0x2118, "weierp", "SCRIPT CAPITAL P" }, -{ 0x211C, "real", "BLACK-LETTER CAPITAL R" }, -{ 0x211E, "rx", "PRESCRIPTION TAKE" }, -{ 0x2122, "trade", "TRADE MARK SIGN" }, -{ 0x2126, "ohm", "OHM SIGN" }, -{ 0x212B, "angst", "ANGSTROM SIGN" }, -{ 0x212C, "bernou", "SCRIPT CAPITAL B" }, -{ 0x2133, "phmmat", "SCRIPT CAPITAL M" }, -{ 0x2134, "order", "SCRIPT SMALL O" }, -{ 0x2135, "aleph", "ALEF SYMBOL" }, -{ 0x2136, "beth", "BET SYMBOL" }, -{ 0x2137, "gimel", "GIMEL SYMBOL" }, -{ 0x2138, "daleth", "DALET SYMBOL" }, -{ 0x2153, "frac13", "VULGAR FRACTION ONE THIRD" }, -{ 0x2154, "frac23", "VULGAR FRACTION TWO THIRDS" }, -{ 0x2155, "frac15", "VULGAR FRACTION ONE FIFTH" }, -{ 0x2156, "frac25", "VULGAR FRACTION TWO FIFTHS" }, -{ 0x2157, "frac35", "VULGAR FRACTION THREE FIFTHS" }, -{ 0x2158, "frac45", "VULGAR FRACTION FOUR FIFTHS" }, -{ 0x2159, "frac16", "VULGAR FRACTION ONE SIXTH" }, -{ 0x215A, "frac56", "VULGAR FRACTION FIVE SIXTHS" }, -{ 0x215B, "frac18", "" }, -{ 0x215C, "frac38", "" }, -{ 0x215D, "frac58", "" }, -{ 0x215E, "frac78", "" }, -{ 0x2190, "larr", "LEFTWARDS DOUBLE ARROW" }, -{ 0x2191, "uarr", "UPWARDS ARROW" }, -{ 0x2192, "rarr", "RIGHTWARDS DOUBLE ARROW" }, -{ 0x2193, "darr", "DOWNWARDS ARROW" }, -{ 0x2194, "harr", "LEFT RIGHT ARROW" }, -{ 0x2194, "xhArr", "LEFT RIGHT ARROW" }, -{ 0x2194, "xharr", "LEFT RIGHT ARROW" }, -{ 0x2195, "varr", "UP DOWN ARROW" }, -{ 0x2196, "nwarr", "NORTH WEST ARROW" }, -{ 0x2197, "nearr", "NORTH EAST ARROW" }, -{ 0x2198, "drarr", "SOUTH EAST ARROW" }, -{ 0x2199, "dlarr", "SOUTH WEST ARROW" }, -{ 0x219A, "nlarr", "LEFTWARDS ARROW WITH STROKE" }, -{ 0x219B, "nrarr", "RIGHTWARDS ARROW WITH STROKE" }, -{ 0x219D, "rarrw", "RIGHTWARDS SQUIGGLE ARROW" }, -{ 0x219E, "Larr", "LEFTWARDS TWO HEADED ARROW" }, -{ 0x21A0, "Rarr", "RIGHTWARDS TWO HEADED ARROW" }, -{ 0x21A2, "larrtl", "LEFTWARDS ARROW WITH TAIL" }, -{ 0x21A3, "rarrtl", "RIGHTWARDS ARROW WITH TAIL" }, -{ 0x21A6, "map", "RIGHTWARDS ARROW FROM BAR" }, -{ 0x21A9, "larrhk", "LEFTWARDS ARROW WITH HOOK" }, -{ 0x21AA, "rarrhk", "RIGHTWARDS ARROW WITH HOOK" }, -{ 0x21AB, "larrlp", "LEFTWARDS ARROW WITH LOOP" }, -{ 0x21AC, "rarrlp", "RIGHTWARDS ARROW WITH LOOP" }, -{ 0x21AD, "harrw", "LEFT RIGHT WAVE ARROW" }, -{ 0x21AE, "nharr", "LEFT RIGHT ARROW WITH STROKE" }, -{ 0x21B0, "lsh", "UPWARDS ARROW WITH TIP LEFTWARDS" }, -{ 0x21B1, "rsh", "UPWARDS ARROW WITH TIP RIGHTWARDS" }, -{ 0x21B6, "cularr", "ANTICLOCKWISE TOP SEMICIRCLE ARROW" }, -{ 0x21B7, "curarr", "CLOCKWISE TOP SEMICIRCLE ARROW" }, -{ 0x21BA, "olarr", "ANTICLOCKWISE OPEN CIRCLE ARROW" }, -{ 0x21BB, "orarr", "CLOCKWISE OPEN CIRCLE ARROW" }, -{ 0x21BC, "lharu", "LEFTWARDS HARPOON WITH BARB UPWARDS" }, -{ 0x21BD, "lhard", "LEFTWARDS HARPOON WITH BARB DOWNWARDS" }, -{ 0x21BE, "uharr", "UPWARDS HARPOON WITH BARB RIGHTWARDS" }, -{ 0x21BF, "uharl", "UPWARDS HARPOON WITH BARB LEFTWARDS" }, -{ 0x21C0, "rharu", "RIGHTWARDS HARPOON WITH BARB UPWARDS" }, -{ 0x21C1, "rhard", "RIGHTWARDS HARPOON WITH BARB DOWNWARDS" }, -{ 0x21C2, "dharr", "DOWNWARDS HARPOON WITH BARB RIGHTWARDS" }, -{ 0x21C3, "dharl", "DOWNWARDS HARPOON WITH BARB LEFTWARDS" }, -{ 0x21C4, "rlarr2", "RIGHTWARDS ARROW OVER LEFTWARDS ARROW" }, -{ 0x21C6, "lrarr2", "LEFTWARDS ARROW OVER RIGHTWARDS ARROW" }, -{ 0x21C7, "larr2", "LEFTWARDS PAIRED ARROWS" }, -{ 0x21C8, "uarr2", "UPWARDS PAIRED ARROWS" }, -{ 0x21C9, "rarr2", "RIGHTWARDS PAIRED ARROWS" }, -{ 0x21CA, "darr2", "DOWNWARDS PAIRED ARROWS" }, -{ 0x21CB, "lrhar2", "LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON" }, -{ 0x21CC, "rlhar2", "RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON" }, -{ 0x21CD, "nlArr", "LEFTWARDS DOUBLE ARROW WITH STROKE" }, -{ 0x21CE, "nhArr", "LEFT RIGHT DOUBLE ARROW WITH STROKE" }, -{ 0x21CF, "nrArr", "RIGHTWARDS DOUBLE ARROW WITH STROKE" }, -{ 0x21D0, "lArr", "LEFTWARDS ARROW" }, -{ 0x21D0, "xlArr", "LEFTWARDS DOUBLE ARROW" }, -{ 0x21D1, "uArr", "UPWARDS DOUBLE ARROW" }, -{ 0x21D2, "rArr", "RIGHTWARDS ARROW" }, -{ 0x21D2, "xrArr", "RIGHTWARDS DOUBLE ARROW" }, -{ 0x21D3, "dArr", "DOWNWARDS DOUBLE ARROW" }, -{ 0x21D4, "hArr", "" }, -{ 0x21D4, "iff", "LEFT RIGHT DOUBLE ARROW" }, -{ 0x21D5, "vArr", "UP DOWN DOUBLE ARROW" }, -{ 0x21DA, "lAarr", "LEFTWARDS TRIPLE ARROW" }, -{ 0x21DB, "rAarr", "RIGHTWARDS TRIPLE ARROW" }, -{ 0x2200, "forall", "" }, -{ 0x2201, "comp", "COMPLEMENT" }, -{ 0x2202, "part", "" }, -{ 0x2203, "exist", "" }, -{ 0x2204, "nexist", "THERE DOES NOT EXIST" }, -{ 0x2205, "empty", "" }, -{ 0x2207, "nabla", "NABLA" }, -{ 0x2209, "notin", "" }, -{ 0x220A, "epsi", "" }, -{ 0x220A, "epsis", "" }, -{ 0x220A, "isin", "" }, -{ 0x220D, "bepsi", "SMALL CONTAINS AS MEMBER" }, -{ 0x220D, "ni", "" }, -{ 0x220F, "prod", "N-ARY PRODUCT" }, -{ 0x2210, "amalg", "N-ARY COPRODUCT" }, -{ 0x2210, "coprod", "N-ARY COPRODUCT" }, -{ 0x2210, "samalg", "" }, -{ 0x2211, "sum", "N-ARY SUMMATION" }, -{ 0x2212, "minus", "MINUS SIGN" }, -{ 0x2213, "mnplus", "" }, -{ 0x2214, "plusdo", "DOT PLUS" }, -{ 0x2216, "setmn", "SET MINUS" }, -{ 0x2216, "ssetmn", "SET MINUS" }, -{ 0x2217, "lowast", "ASTERISK OPERATOR" }, -{ 0x2218, "compfn", "RING OPERATOR" }, -{ 0x221A, "radic", "" }, -{ 0x221D, "prop", "" }, -{ 0x221D, "vprop", "" }, -{ 0x221E, "infin", "" }, -{ 0x221F, "ang90", "RIGHT ANGLE" }, -{ 0x2220, "ang", "ANGLE" }, -{ 0x2221, "angmsd", "MEASURED ANGLE" }, -{ 0x2222, "angsph", "" }, -{ 0x2223, "mid", "" }, -{ 0x2224, "nmid", "DOES NOT DIVIDE" }, -{ 0x2225, "par", "PARALLEL TO" }, -{ 0x2225, "spar", "PARALLEL TO" }, -{ 0x2226, "npar", "NOT PARALLEL TO" }, -{ 0x2226, "nspar", "NOT PARALLEL TO" }, -{ 0x2227, "and", "" }, -{ 0x2228, "or", "" }, -{ 0x2229, "cap", "" }, -{ 0x222A, "cup", "" }, -{ 0x222B, "int", "" }, -{ 0x222E, "conint", "" }, -{ 0x2234, "there4", "" }, -{ 0x2235, "becaus", "BECAUSE" }, -{ 0x223C, "sim", "" }, -{ 0x223C, "thksim", "TILDE OPERATOR" }, -{ 0x223D, "bsim", "" }, -{ 0x2240, "wreath", "WREATH PRODUCT" }, -{ 0x2241, "nsim", "" }, -{ 0x2243, "sime", "" }, -{ 0x2244, "nsime", "" }, -{ 0x2245, "cong", "" }, -{ 0x2247, "ncong", "NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO" }, -{ 0x2248, "ap", "" }, -{ 0x2248, "thkap", "ALMOST EQUAL TO" }, -{ 0x2249, "nap", "NOT ALMOST EQUAL TO" }, -{ 0x224A, "ape", "" }, -{ 0x224C, "bcong", "ALL EQUAL TO" }, -{ 0x224D, "asymp", "EQUIVALENT TO" }, -{ 0x224E, "bump", "" }, -{ 0x224F, "bumpe", "" }, -{ 0x2250, "esdot", "" }, -{ 0x2251, "eDot", "" }, -{ 0x2252, "efDot", "" }, -{ 0x2253, "erDot", "" }, -{ 0x2254, "colone", "" }, -{ 0x2255, "ecolon", "" }, -{ 0x2256, "ecir", "" }, -{ 0x2257, "cire", "" }, -{ 0x2259, "wedgeq", "ESTIMATES" }, -{ 0x225C, "trie", "" }, -{ 0x2260, "ne", "" }, -{ 0x2261, "equiv", "" }, -{ 0x2262, "nequiv", "NOT IDENTICAL TO" }, -{ 0x2264, "le", "" }, -{ 0x2264, "les", "LESS-THAN OR EQUAL TO" }, -{ 0x2265, "ge", "GREATER-THAN OR EQUAL TO" }, -{ 0x2265, "ges", "GREATER-THAN OR EQUAL TO" }, -{ 0x2266, "lE", "" }, -{ 0x2267, "gE", "" }, -{ 0x2268, "lnE", "" }, -{ 0x2268, "lne", "" }, -{ 0x2268, "lvnE", "LESS-THAN BUT NOT EQUAL TO" }, -{ 0x2269, "gnE", "" }, -{ 0x2269, "gne", "" }, -{ 0x2269, "gvnE", "GREATER-THAN BUT NOT EQUAL TO" }, -{ 0x226A, "Lt", "MUCH LESS-THAN" }, -{ 0x226B, "Gt", "MUCH GREATER-THAN" }, -{ 0x226C, "twixt", "BETWEEN" }, -{ 0x226E, "nlt", "NOT LESS-THAN" }, -{ 0x226F, "ngt", "NOT GREATER-THAN" }, -{ 0x2270, "nlE", "" }, -{ 0x2270, "nle", "NEITHER LESS-THAN NOR EQUAL TO" }, -{ 0x2270, "nles", "" }, -{ 0x2271, "ngE", "" }, -{ 0x2271, "nge", "NEITHER GREATER-THAN NOR EQUAL TO" }, -{ 0x2271, "nges", "" }, -{ 0x2272, "lap", "LESS-THAN OR EQUIVALENT TO" }, -{ 0x2272, "lsim", "LESS-THAN OR EQUIVALENT TO" }, -{ 0x2273, "gap", "GREATER-THAN OR EQUIVALENT TO" }, -{ 0x2273, "gsim", "GREATER-THAN OR EQUIVALENT TO" }, -{ 0x2276, "lg", "LESS-THAN OR GREATER-THAN" }, -{ 0x2277, "gl", "" }, -{ 0x227A, "pr", "" }, -{ 0x227B, "sc", "" }, -{ 0x227C, "cupre", "" }, -{ 0x227C, "pre", "" }, -{ 0x227D, "sccue", "" }, -{ 0x227D, "sce", "" }, -{ 0x227E, "prap", "" }, -{ 0x227E, "prsim", "" }, -{ 0x227F, "scap", "" }, -{ 0x227F, "scsim", "" }, -{ 0x2280, "npr", "DOES NOT PRECEDE" }, -{ 0x2281, "nsc", "DOES NOT SUCCEED" }, -{ 0x2282, "sub", "" }, -{ 0x2283, "sup", "" }, -{ 0x2284, "nsub", "NOT A SUBSET OF" }, -{ 0x2285, "nsup", "NOT A SUPERSET OF" }, -{ 0x2286, "subE", "" }, -{ 0x2286, "sube", "" }, -{ 0x2287, "supE", "" }, -{ 0x2287, "supe", "" }, -{ 0x2288, "nsubE", "" }, -{ 0x2288, "nsube", "" }, -{ 0x2289, "nsupE", "" }, -{ 0x2289, "nsupe", "" }, -{ 0x228A, "subne", "" }, -{ 0x228A, "subnE", "SUBSET OF WITH NOT EQUAL TO" }, -{ 0x228A, "vsubne", "SUBSET OF WITH NOT EQUAL TO" }, -{ 0x228B, "supnE", "" }, -{ 0x228B, "supne", "" }, -{ 0x228B, "vsupnE", "SUPERSET OF WITH NOT EQUAL TO" }, -{ 0x228B, "vsupne", "SUPERSET OF WITH NOT EQUAL TO" }, -{ 0x228E, "uplus", "MULTISET UNION" }, -{ 0x228F, "sqsub", "" }, -{ 0x2290, "sqsup", "" }, -{ 0x2291, "sqsube", "" }, -{ 0x2292, "sqsupe", "" }, -{ 0x2293, "sqcap", "SQUARE CAP" }, -{ 0x2294, "sqcup", "SQUARE CUP" }, -{ 0x2295, "oplus", "CIRCLED PLUS" }, -{ 0x2296, "ominus", "CIRCLED MINUS" }, -{ 0x2297, "otimes", "CIRCLED TIMES" }, -{ 0x2298, "osol", "CIRCLED DIVISION SLASH" }, -{ 0x2299, "odot", "CIRCLED DOT OPERATOR" }, -{ 0x229A, "ocir", "CIRCLED RING OPERATOR" }, -{ 0x229B, "oast", "CIRCLED ASTERISK OPERATOR" }, -{ 0x229D, "odash", "CIRCLED DASH" }, -{ 0x229E, "plusb", "SQUARED PLUS" }, -{ 0x229F, "minusb", "SQUARED MINUS" }, -{ 0x22A0, "timesb", "SQUARED TIMES" }, -{ 0x22A1, "sdotb", "SQUARED DOT OPERATOR" }, -{ 0x22A2, "vdash", "" }, -{ 0x22A3, "dashv", "" }, -{ 0x22A4, "top", "DOWN TACK" }, -{ 0x22A5, "bottom", "" }, -{ 0x22A5, "perp", "" }, -{ 0x22A7, "models", "MODELS" }, -{ 0x22A8, "vDash", "" }, -{ 0x22A9, "Vdash", "" }, -{ 0x22AA, "Vvdash", "" }, -{ 0x22AC, "nvdash", "DOES NOT PROVE" }, -{ 0x22AD, "nvDash", "NOT TRUE" }, -{ 0x22AE, "nVdash", "DOES NOT FORCE" }, -{ 0x22AF, "nVDash", "NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE" }, -{ 0x22B2, "vltri", "" }, -{ 0x22B3, "vrtri", "" }, -{ 0x22B4, "ltrie", "" }, -{ 0x22B5, "rtrie", "" }, -{ 0x22B8, "mumap", "MULTIMAP" }, -{ 0x22BA, "intcal", "INTERCALATE" }, -{ 0x22BB, "veebar", "" }, -{ 0x22BC, "barwed", "NAND" }, -{ 0x22C4, "diam", "DIAMOND OPERATOR" }, -{ 0x22C5, "sdot", "DOT OPERATOR" }, -{ 0x22C6, "sstarf", "STAR OPERATOR" }, -{ 0x22C6, "star", "STAR OPERATOR" }, -{ 0x22C7, "divonx", "DIVISION TIMES" }, -{ 0x22C8, "bowtie", "" }, -{ 0x22C9, "ltimes", "LEFT NORMAL FACTOR SEMIDIRECT PRODUCT" }, -{ 0x22CA, "rtimes", "RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT" }, -{ 0x22CB, "lthree", "LEFT SEMIDIRECT PRODUCT" }, -{ 0x22CC, "rthree", "RIGHT SEMIDIRECT PRODUCT" }, -{ 0x22CD, "bsime", "" }, -{ 0x22CE, "cuvee", "CURLY LOGICAL OR" }, -{ 0x22CF, "cuwed", "CURLY LOGICAL AND" }, -{ 0x22D0, "Sub", "" }, -{ 0x22D1, "Sup", "" }, -{ 0x22D2, "Cap", "DOUBLE INTERSECTION" }, -{ 0x22D3, "Cup", "DOUBLE UNION" }, -{ 0x22D4, "fork", "" }, -{ 0x22D6, "ldot", "" }, -{ 0x22D7, "gsdot", "" }, -{ 0x22D8, "Ll", "" }, -{ 0x22D9, "Gg", "VERY MUCH GREATER-THAN" }, -{ 0x22DA, "lEg", "" }, -{ 0x22DA, "leg", "" }, -{ 0x22DB, "gEl", "" }, -{ 0x22DB, "gel", "" }, -{ 0x22DC, "els", "" }, -{ 0x22DD, "egs", "" }, -{ 0x22DE, "cuepr", "" }, -{ 0x22DF, "cuesc", "" }, -{ 0x22E0, "npre", "DOES NOT PRECEDE OR EQUAL" }, -{ 0x22E1, "nsce", "DOES NOT SUCCEED OR EQUAL" }, -{ 0x22E6, "lnsim", "" }, -{ 0x22E7, "gnsim", "GREATER-THAN BUT NOT EQUIVALENT TO" }, -{ 0x22E8, "prnap", "" }, -{ 0x22E8, "prnsim", "" }, -{ 0x22E9, "scnap", "" }, -{ 0x22E9, "scnsim", "" }, -{ 0x22EA, "nltri", "NOT NORMAL SUBGROUP OF" }, -{ 0x22EB, "nrtri", "DOES NOT CONTAIN AS NORMAL SUBGROUP" }, -{ 0x22EC, "nltrie", "NOT NORMAL SUBGROUP OF OR EQUAL TO" }, -{ 0x22ED, "nrtrie", "DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL" }, -{ 0x22EE, "vellip", "" }, -{ 0x2306, "Barwed", "PERSPECTIVE" }, -{ 0x2308, "lceil", "LEFT CEILING" }, -{ 0x2309, "rceil", "RIGHT CEILING" }, -{ 0x230A, "lfloor", "LEFT FLOOR" }, -{ 0x230B, "rfloor", "RIGHT FLOOR" }, -{ 0x230C, "drcrop", "BOTTOM RIGHT CROP" }, -{ 0x230D, "dlcrop", "BOTTOM LEFT CROP" }, -{ 0x230E, "urcrop", "TOP RIGHT CROP" }, -{ 0x230F, "ulcrop", "TOP LEFT CROP" }, -{ 0x2315, "telrec", "TELEPHONE RECORDER" }, -{ 0x2316, "target", "POSITION INDICATOR" }, -{ 0x231C, "ulcorn", "TOP LEFT CORNER" }, -{ 0x231D, "urcorn", "TOP RIGHT CORNER" }, -{ 0x231E, "dlcorn", "BOTTOM LEFT CORNER" }, -{ 0x231F, "drcorn", "BOTTOM RIGHT CORNER" }, -{ 0x2322, "frown", "" }, -{ 0x2322, "sfrown", "FROWN" }, -{ 0x2323, "smile", "" }, -{ 0x2323, "ssmile", "SMILE" }, -{ 0x2423, "blank", "OPEN BOX" }, -{ 0x24C8, "oS", "CIRCLED LATIN CAPITAL LETTER S" }, -{ 0x2500, "boxh", "BOX DRAWINGS LIGHT HORIZONTAL" }, -{ 0x2502, "boxv", "BOX DRAWINGS LIGHT VERTICAL" }, -{ 0x250C, "boxdr", "BOX DRAWINGS LIGHT DOWN AND RIGHT" }, -{ 0x2510, "boxdl", "BOX DRAWINGS LIGHT DOWN AND LEFT" }, -{ 0x2514, "boxur", "BOX DRAWINGS LIGHT UP AND RIGHT" }, -{ 0x2518, "boxul", "BOX DRAWINGS LIGHT UP AND LEFT" }, -{ 0x251C, "boxvr", "BOX DRAWINGS LIGHT VERTICAL AND RIGHT" }, -{ 0x2524, "boxvl", "BOX DRAWINGS LIGHT VERTICAL AND LEFT" }, -{ 0x252C, "boxhd", "BOX DRAWINGS LIGHT DOWN AND HORIZONTAL" }, -{ 0x2534, "boxhu", "BOX DRAWINGS LIGHT UP AND HORIZONTAL" }, -{ 0x253C, "boxvh", "BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL" }, -{ 0x2550, "boxH", "BOX DRAWINGS DOUBLE HORIZONTAL" }, -{ 0x2551, "boxV", "BOX DRAWINGS DOUBLE VERTICAL" }, -{ 0x2552, "boxDR", "BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE" }, -{ 0x2553, "boxDr", "BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE" }, -{ 0x2554, "boxdR", "BOX DRAWINGS DOUBLE DOWN AND RIGHT" }, -{ 0x2555, "boxDL", "BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE" }, -{ 0x2556, "boxdL", "BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE" }, -{ 0x2557, "boxDl", "BOX DRAWINGS DOUBLE DOWN AND LEFT" }, -{ 0x2558, "boxUR", "BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE" }, -{ 0x2559, "boxuR", "BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE" }, -{ 0x255A, "boxUr", "BOX DRAWINGS DOUBLE UP AND RIGHT" }, -{ 0x255B, "boxUL", "BOX DRAWINGS UP SINGLE AND LEFT DOUBLE" }, -{ 0x255C, "boxUl", "BOX DRAWINGS UP DOUBLE AND LEFT SINGLE" }, -{ 0x255D, "boxuL", "BOX DRAWINGS DOUBLE UP AND LEFT" }, -{ 0x255E, "boxvR", "BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE" }, -{ 0x255F, "boxVR", "BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE" }, -{ 0x2560, "boxVr", "BOX DRAWINGS DOUBLE VERTICAL AND RIGHT" }, -{ 0x2561, "boxvL", "BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE" }, -{ 0x2562, "boxVL", "BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE" }, -{ 0x2563, "boxVl", "BOX DRAWINGS DOUBLE VERTICAL AND LEFT" }, -{ 0x2564, "boxhD", "BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE" }, -{ 0x2565, "boxHD", "BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE" }, -{ 0x2566, "boxHd", "BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL" }, -{ 0x2567, "boxhU", "BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE" }, -{ 0x2568, "boxHU", "BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE" }, -{ 0x2569, "boxHu", "BOX DRAWINGS DOUBLE UP AND HORIZONTAL" }, -{ 0x256A, "boxvH", "BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE" }, -{ 0x256B, "boxVH", "BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE" }, -{ 0x256C, "boxVh", "BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL" }, -{ 0x2580, "uhblk", "UPPER HALF BLOCK" }, -{ 0x2584, "lhblk", "LOWER HALF BLOCK" }, -{ 0x2588, "block", "FULL BLOCK" }, -{ 0x2591, "blk14", "LIGHT SHADE" }, -{ 0x2592, "blk12", "MEDIUM SHADE" }, -{ 0x2593, "blk34", "DARK SHADE" }, -{ 0x25A1, "square", "WHITE SQUARE" }, -{ 0x25A1, "squ", "WHITE SQUARE" }, -{ 0x25AA, "squf", "" }, -{ 0x25AD, "rect", "WHITE RECTANGLE" }, -{ 0x25AE, "marker", "BLACK VERTICAL RECTANGLE" }, -{ 0x25B3, "xutri", "WHITE UP-POINTING TRIANGLE" }, -{ 0x25B4, "utrif", "BLACK UP-POINTING TRIANGLE" }, -{ 0x25B5, "utri", "WHITE UP-POINTING TRIANGLE" }, -{ 0x25B8, "rtrif", "BLACK RIGHT-POINTING TRIANGLE" }, -{ 0x25B9, "rtri", "WHITE RIGHT-POINTING TRIANGLE" }, -{ 0x25BD, "xdtri", "WHITE DOWN-POINTING TRIANGLE" }, -{ 0x25BE, "dtrif", "BLACK DOWN-POINTING TRIANGLE" }, -{ 0x25BF, "dtri", "WHITE DOWN-POINTING TRIANGLE" }, -{ 0x25C2, "ltrif", "BLACK LEFT-POINTING TRIANGLE" }, -{ 0x25C3, "ltri", "WHITE LEFT-POINTING TRIANGLE" }, -{ 0x25CA, "loz", "LOZENGE" }, -{ 0x25CB, "cir", "WHITE CIRCLE" }, -{ 0x25CB, "xcirc", "WHITE CIRCLE" }, -{ 0x2605, "starf", "BLACK STAR" }, -{ 0x260E, "phone", "TELEPHONE SIGN" }, -{ 0x2640, "female", "" }, -{ 0x2642, "male", "MALE SIGN" }, -{ 0x2660, "spades", "BLACK SPADE SUIT" }, -{ 0x2663, "clubs", "BLACK CLUB SUIT" }, -{ 0x2665, "hearts", "BLACK HEART SUIT" }, -{ 0x2666, "diams", "BLACK DIAMOND SUIT" }, -{ 0x2669, "sung", "" }, -{ 0x266D, "flat", "MUSIC FLAT SIGN" }, -{ 0x266E, "natur", "MUSIC NATURAL SIGN" }, -{ 0x266F, "sharp", "MUSIC SHARP SIGN" }, -{ 0x2713, "check", "CHECK MARK" }, -{ 0x2717, "cross", "BALLOT X" }, -{ 0x2720, "malt", "MALTESE CROSS" }, -{ 0x2726, "lozf", "" }, -{ 0x2736, "sext", "SIX POINTED BLACK STAR" }, -{ 0x3008, "lang", "" }, -{ 0x3009, "rang", "" }, -{ 0xE291, "rpargt", "" }, -{ 0xE2A2, "lnap", "" }, -{ 0xE2AA, "nsmid", "" }, -{ 0xE2B3, "prnE", "" }, -{ 0xE2B5, "scnE", "" }, -{ 0xE2B8, "vsubnE", "" }, -{ 0xE301, "smid", "" }, -{ 0xE411, "gnap", "" }, -{ 0xFB00, "fflig", "" }, -{ 0xFB01, "filig", "" }, -{ 0xFB02, "fllig", "" }, -{ 0xFB03, "ffilig", "" }, -{ 0xFB04, "ffllig", "" }, -{ 0xFE68, "sbsol", "SMALL REVERSE SOLIDUS" }, -}; - -/************************************************************************ - * * - * Commodity functions to handle entities * - * * - ************************************************************************/ - -/* - * Macro used to grow the current buffer. - */ -#define growBuffer(buffer) { \ - buffer##_size *= 2; \ - buffer = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \ - if (buffer == NULL) { \ - xmlGenericError(xmlGenericErrorContext, "realloc failed"); \ - return(NULL); \ - } \ -} - -/** - * docbEntityLookup: - * @name: the entity name - * - * Lookup the given entity in EntitiesTable - * - * TODO: the linear scan is really ugly, an hash table is really needed. - * - * Returns the associated docbEntityDescPtr if found, NULL otherwise. - */ -static docbEntityDescPtr -docbEntityLookup(const xmlChar *name) { - unsigned int i; - - for (i = 0;i < (sizeof(docbookEntitiesTable)/ - sizeof(docbookEntitiesTable[0]));i++) { - if (xmlStrEqual(name, BAD_CAST docbookEntitiesTable[i].name)) { -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", name); -#endif - return(&docbookEntitiesTable[i]); - } - } - return(NULL); -} - -/** - * docbEntityValueLookup: - * @value: the entity's unicode value - * - * Lookup the given entity in EntitiesTable - * - * TODO: the linear scan is really ugly, an hash table is really needed. - * - * Returns the associated docbEntityDescPtr if found, NULL otherwise. - */ -static docbEntityDescPtr -docbEntityValueLookup(int value) { - unsigned int i; -#ifdef DEBUG - int lv = 0; -#endif - - for (i = 0;i < (sizeof(docbookEntitiesTable)/ - sizeof(docbookEntitiesTable[0]));i++) { - if (docbookEntitiesTable[i].value >= value) { - if (docbookEntitiesTable[i].value > value) - break; -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", docbookEntitiesTable[i].name); -#endif - return(&docbookEntitiesTable[i]); - } -#ifdef DEBUG - if (lv > docbookEntitiesTable[i].value) { - xmlGenericError(xmlGenericErrorContext, - "docbookEntitiesTable[] is not sorted (%d > %d)!\n", - lv, docbookEntitiesTable[i].value); - } - lv = docbookEntitiesTable[i].value; -#endif - } - return(NULL); -} - -#if 0 -/** - * UTF8ToSgml: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of UTF-8 chars - * @inlen: the length of @in - * - * Take a block of UTF-8 chars in and try to convert it to an ASCII - * plus SGML entities block of chars out. - * - * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise - * The value of @inlen after return is the number of octets consumed - * as the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. - */ -int -UTF8ToSgml(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - const unsigned char* processed = in; - const unsigned char* outend; - const unsigned char* outstart = out; - const unsigned char* instart = in; - const unsigned char* inend; - unsigned int c, d; - int trailing; - - if (in == NULL) { - /* - * initialization nothing to do - */ - *outlen = 0; - *inlen = 0; - return(0); - } - inend = in + (*inlen); - outend = out + (*outlen); - while (in < inend) { - d = *in++; - if (d < 0x80) { c= d; trailing= 0; } - else if (d < 0xC0) { - /* trailing byte in leading position */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; } - else if (d < 0xF0) { c= d & 0x0F; trailing= 2; } - else if (d < 0xF8) { c= d & 0x07; trailing= 3; } - else { - /* no chance for this in Ascii */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - - if (inend - in < trailing) { - break; - } - - for ( ; trailing; trailing--) { - if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) - break; - c <<= 6; - c |= d & 0x3F; - } - - /* assertion: c is a single UTF-4 value */ - if (c < 0x80) { - if (out + 1 >= outend) - break; - *out++ = c; - } else { - int len; - docbEntityDescPtr ent; - - /* - * Try to lookup a predefined SGML entity for it - */ - - ent = docbEntityValueLookup(c); - if (ent == NULL) { - /* no chance for this in Ascii */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - len = strlen(ent->name); - if (out + 2 + len >= outend) - break; - *out++ = '&'; - memcpy(out, ent->name, len); - out += len; - *out++ = ';'; - } - processed = in; - } - *outlen = out - outstart; - *inlen = processed - instart; - return(0); -} -#endif - -/** - * docbEncodeEntities: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of UTF-8 chars - * @inlen: the length of @in - * @quoteChar: the quote character to escape (' or ") or zero. - * - * Take a block of UTF-8 chars in and try to convert it to an ASCII - * plus SGML entities block of chars out. - * - * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise - * The value of @inlen after return is the number of octets consumed - * as the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. - */ -int -docbEncodeEntities(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen, int quoteChar) { - const unsigned char* processed = in; - const unsigned char* outend = out + (*outlen); - const unsigned char* outstart = out; - const unsigned char* instart = in; - const unsigned char* inend = in + (*inlen); - unsigned int c, d; - int trailing; - - while (in < inend) { - d = *in++; - if (d < 0x80) { c= d; trailing= 0; } - else if (d < 0xC0) { - /* trailing byte in leading position */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; } - else if (d < 0xF0) { c= d & 0x0F; trailing= 2; } - else if (d < 0xF8) { c= d & 0x07; trailing= 3; } - else { - /* no chance for this in Ascii */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - - if (inend - in < trailing) - break; - - while (trailing--) { - if (((d= *in++) & 0xC0) != 0x80) { - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - c <<= 6; - c |= d & 0x3F; - } - - /* assertion: c is a single UTF-4 value */ - if (c < 0x80 && c != (unsigned int) quoteChar && c != '&' && c != '<' && c != '>') { - if (out >= outend) - break; - *out++ = c; - } else { - docbEntityDescPtr ent; - const char *cp; - char nbuf[16]; - int len; - - /* - * Try to lookup a predefined SGML entity for it - */ - ent = docbEntityValueLookup(c); - if (ent == NULL) { - snprintf(nbuf, sizeof(nbuf), "#%u", c); - cp = nbuf; - } - else - cp = ent->name; - len = strlen(cp); - if (out + 2 + len > outend) - break; - *out++ = '&'; - memcpy(out, cp, len); - out += len; - *out++ = ';'; - } - processed = in; - } - *outlen = out - outstart; - *inlen = processed - instart; - return(0); -} - - -/************************************************************************ - * * - * Commodity functions to handle streams * - * * - ************************************************************************/ - -/** - * docbNewInputStream: - * @ctxt: an SGML parser context - * - * Create a new input stream structure - * Returns the new input stream or NULL - */ -static docbParserInputPtr -docbNewInputStream(docbParserCtxtPtr ctxt) { - docbParserInputPtr input; - - input = (xmlParserInputPtr) xmlMalloc(sizeof(docbParserInput)); - if (input == NULL) { - ctxt->errNo = XML_ERR_NO_MEMORY; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "malloc: couldn't allocate a new input stream\n"); - return(NULL); - } - memset(input, 0, sizeof(docbParserInput)); - input->filename = NULL; - input->directory = NULL; - input->base = NULL; - input->cur = NULL; - input->buf = NULL; - input->line = 1; - input->col = 1; - input->buf = NULL; - input->free = NULL; - input->version = NULL; - input->consumed = 0; - input->length = 0; - return(input); -} - - -/************************************************************************ - * * - * Commodity functions, cleanup needed ? * - * * - ************************************************************************/ - -/** - * areBlanks: - * @ctxt: an SGML parser context - * @str: a xmlChar * - * @len: the size of @str - * - * Is this a sequence of blank chars that one can ignore ? - * - * Returns 1 if ignorable 0 otherwise. - */ - -static int areBlanks(docbParserCtxtPtr ctxt, const xmlChar *str, int len) { - int i; - xmlNodePtr lastChild; - - for (i = 0;i < len;i++) - if (!(IS_BLANK(str[i]))) return(0); - - if (CUR == 0) return(1); - if (CUR != '<') return(0); - if (ctxt->name == NULL) - return(1); - if (ctxt->node == NULL) return(0); - lastChild = xmlGetLastChild(ctxt->node); - if (lastChild == NULL) { - if ((ctxt->node->type != XML_ELEMENT_NODE) && - (ctxt->node->content != NULL)) return(0); - } else if (xmlNodeIsText(lastChild)) - return(0); - return(1); -} - -/************************************************************************ - * * - * External entities support * - * * - ************************************************************************/ - -/** - * docbParseCtxtExternalEntity: - * @ctx: the existing parsing context - * @URL: the URL for the entity to load - * @ID: the System ID for the entity to load - * @list: the return value for the set of parsed nodes - * - * Parse an external general entity within an existing parsing context - * - * Returns 0 if the entity is well formed, -1 in case of args problem and - * the parser error code otherwise - */ - -static int -docbParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, - const xmlChar *ID, xmlNodePtr *list) { - xmlParserCtxtPtr ctxt; - xmlDocPtr newDoc; - xmlSAXHandlerPtr oldsax = NULL; - int ret = 0; - - if (ctx->depth > 40) { - return(XML_ERR_ENTITY_LOOP); - } - - if (list != NULL) - *list = NULL; - if ((URL == NULL) && (ID == NULL)) - return(-1); - if (ctx->myDoc == NULL) /* @@ relax but check for dereferences */ - return(-1); - - - ctxt = xmlCreateEntityParserCtxt(URL, ID, ctx->myDoc->URL); - if (ctxt == NULL) return(-1); - ctxt->userData = ctxt; - oldsax = ctxt->sax; - ctxt->sax = ctx->sax; - newDoc = xmlNewDoc(BAD_CAST "1.0"); - if (newDoc == NULL) { - xmlFreeParserCtxt(ctxt); - return(-1); - } - if (ctx->myDoc != NULL) { - newDoc->intSubset = ctx->myDoc->intSubset; - newDoc->extSubset = ctx->myDoc->extSubset; - } - if (ctx->myDoc->URL != NULL) { - newDoc->URL = xmlStrdup(ctx->myDoc->URL); - } - newDoc->children = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL); - if (newDoc->children == NULL) { - ctxt->sax = oldsax; - xmlFreeParserCtxt(ctxt); - newDoc->intSubset = NULL; - newDoc->extSubset = NULL; - xmlFreeDoc(newDoc); - return(-1); - } - nodePush(ctxt, newDoc->children); - if (ctx->myDoc == NULL) { - ctxt->myDoc = newDoc; - } else { - ctxt->myDoc = ctx->myDoc; - newDoc->children->doc = ctx->myDoc; - } - - /* - * Parse a possible text declaration first - */ - GROW; - if ((RAW == '<') && (NXT(1) == '?') && - (NXT(2) == 'x') && (NXT(3) == 'm') && - (NXT(4) == 'l') && (IS_BLANK(NXT(5)))) { - xmlParseTextDecl(ctxt); - } - - /* - * Doing validity checking on chunk doesn't make sense - */ - ctxt->instate = XML_PARSER_CONTENT; - ctxt->validate = ctx->validate; - ctxt->loadsubset = ctx->loadsubset; - ctxt->depth = ctx->depth + 1; - ctxt->replaceEntities = ctx->replaceEntities; - if (ctxt->validate) { - ctxt->vctxt.error = ctx->vctxt.error; - ctxt->vctxt.warning = ctx->vctxt.warning; - /* Allocate the Node stack */ - ctxt->vctxt.nodeTab = (xmlNodePtr *) xmlMalloc(4 * sizeof(xmlNodePtr)); - if (ctxt->vctxt.nodeTab == NULL) { - xmlGenericError(xmlGenericErrorContext, - "docbParseCtxtExternalEntity: out of memory\n"); - ctxt->validate = 0; - ctxt->vctxt.error = NULL; - ctxt->vctxt.warning = NULL; - } else { - ctxt->vctxt.nodeNr = 0; - ctxt->vctxt.nodeMax = 4; - ctxt->vctxt.node = NULL; - } - } else { - ctxt->vctxt.error = NULL; - ctxt->vctxt.warning = NULL; - } - - docbParseContent(ctxt); - - if ((RAW == '<') && (NXT(1) == '/')) { - ctxt->errNo = XML_ERR_NOT_WELL_BALANCED; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "chunk is not well balanced\n"); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } else if (RAW != 0) { - ctxt->errNo = XML_ERR_EXTRA_CONTENT; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "extra content at the end of well balanced chunk\n"); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } - if (ctxt->node != newDoc->children) { - ctxt->errNo = XML_ERR_NOT_WELL_BALANCED; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "chunk is not well balanced\n"); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } - - if (!ctxt->wellFormed) { - if (ctxt->errNo == 0) - ret = 1; - else - ret = ctxt->errNo; - } else { - if (list != NULL) { - xmlNodePtr cur; - - /* - * Return the newly created nodeset after unlinking it from - * they pseudo parent. - */ - cur = newDoc->children->children; - *list = cur; - while (cur != NULL) { - cur->parent = NULL; - cur = cur->next; - } - newDoc->children->children = NULL; - } - ret = 0; - } - ctxt->sax = oldsax; - xmlFreeParserCtxt(ctxt); - newDoc->intSubset = NULL; - newDoc->extSubset = NULL; - xmlFreeDoc(newDoc); - - return(ret); -} - -/************************************************************************ - * * - * The parser itself * - * * - ************************************************************************/ - -/** - * docbParseSGMLName: - * @ctxt: an SGML parser context - * - * parse an SGML tag or attribute name, note that we convert it to lowercase - * since SGML names are not case-sensitive. - * - * Returns the Tag Name parsed or NULL - */ - -static xmlChar * -docbParseSGMLName(docbParserCtxtPtr ctxt) { - xmlChar *ret = NULL; - int i = 0; - xmlChar loc[DOCB_PARSER_BUFFER_SIZE]; - - if (!IS_LETTER(CUR) && (CUR != '_') && - (CUR != ':')) return(NULL); - - while ((i < DOCB_PARSER_BUFFER_SIZE) && - ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || - (CUR == ':') || (CUR == '_'))) { - if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20; - else loc[i] = CUR; - i++; - - NEXT; - } - - ret = xmlStrndup(loc, i); - - return(ret); -} - -/** - * docbParseName: - * @ctxt: an SGML parser context - * - * parse an SGML name, this routine is case sensitive. - * - * Returns the Name parsed or NULL - */ - -static xmlChar * -docbParseName(docbParserCtxtPtr ctxt) { - xmlChar buf[DOCB_MAX_NAMELEN]; - int len = 0; - - GROW; - if (!IS_LETTER(CUR) && (CUR != '_')) { - return(NULL); - } - - while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || - (CUR == '.') || (CUR == '-') || - (CUR == '_') || (CUR == ':') || - (IS_COMBINING(CUR)) || - (IS_EXTENDER(CUR))) { - buf[len++] = CUR; - NEXT; - if (len >= DOCB_MAX_NAMELEN) { - xmlGenericError(xmlGenericErrorContext, - "docbParseName: reached DOCB_MAX_NAMELEN limit\n"); - while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || - (CUR == '.') || (CUR == '-') || - (CUR == '_') || (CUR == ':') || - (IS_COMBINING(CUR)) || - (IS_EXTENDER(CUR))) - NEXT; - break; - } - } - return(xmlStrndup(buf, len)); -} - -/** - * docbParseSGMLAttribute: - * @ctxt: an SGML parser context - * @stop: a char stop value - * - * parse an SGML attribute value till the stop (quote), if - * stop is 0 then it stops at the first space - * - * Returns the attribute parsed or NULL - */ - -static xmlChar * -docbParseSGMLAttribute(docbParserCtxtPtr ctxt, const xmlChar stop) { - xmlChar *buffer = NULL; - int buffer_size = 0; - xmlChar *out = NULL; - xmlChar *name = NULL; - - xmlChar *cur = NULL; - xmlEntityPtr xent; - docbEntityDescPtr ent; - - /* - * allocate a translation buffer. - */ - buffer_size = DOCB_PARSER_BIG_BUFFER_SIZE; - buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); - if (buffer == NULL) { - xmlGenericError(xmlGenericErrorContext, - "docbParseSGMLAttribute: malloc failed"); - return(NULL); - } - out = buffer; - - /* - * Ok loop until we reach one of the ending chars - */ - while ((CUR != 0) && (CUR != stop) && (CUR != '>')) { - if ((stop == 0) && (IS_BLANK(CUR))) break; - if (CUR == '&') { - if (NXT(1) == '#') { - unsigned int c; - int bits; - - c = docbParseCharRef(ctxt); - if (c < 0x80) - { *out++ = c; bits= -6; } - else if (c < 0x800) - { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } - else if (c < 0x10000) - { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } - else - { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } - - for ( ; bits >= 0; bits-= 6) { - *out++ = ((c >> bits) & 0x3F) | 0x80; - } - } else { - xent = docbParseEntityRef(ctxt, &name); - if (name == NULL) { - *out++ = '&'; - if (out - buffer > buffer_size - 100) { - int indx = out - buffer; - - growBuffer(buffer); - out = &buffer[indx]; - } - *out++ = '&'; - } else { - ent = docbEntityLookup(name); - if (ent == NULL) { - *out++ = '&'; - cur = name; - while (*cur != 0) { - if (out - buffer > buffer_size - 100) { - int indx = out - buffer; - - growBuffer(buffer); - out = &buffer[indx]; - } - *out++ = *cur++; - } - xmlFree(name); - } else { - unsigned int c; - int bits; - - if (out - buffer > buffer_size - 100) { - int indx = out - buffer; - - growBuffer(buffer); - out = &buffer[indx]; - } - c = (xmlChar)ent->value; - if (c < 0x80) - { *out++ = c; bits= -6; } - else if (c < 0x800) - { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } - else if (c < 0x10000) - { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } - else - { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } - - for ( ; bits >= 0; bits-= 6) { - *out++ = ((c >> bits) & 0x3F) | 0x80; - } - xmlFree(name); - } - } - } - } else { - unsigned int c; - int bits; - - if (out - buffer > buffer_size - 100) { - int indx = out - buffer; - - growBuffer(buffer); - out = &buffer[indx]; - } - c = CUR; - if (c < 0x80) - { *out++ = c; bits= -6; } - else if (c < 0x800) - { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } - else if (c < 0x10000) - { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } - else - { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } - - for ( ; bits >= 0; bits-= 6) { - *out++ = ((c >> bits) & 0x3F) | 0x80; - } - NEXT; - } - } - *out++ = 0; - return(buffer); -} - - -/** - * docbParseEntityRef: - * @ctxt: an SGML parser context - * @str: location to store the entity name - * - * parse an SGML ENTITY references - * - * [68] EntityRef ::= '&' Name ';' - * - * Returns the associated xmlEntityPtr if found, or NULL otherwise, - * if non-NULL *str will have to be freed by the caller. - */ -static xmlEntityPtr -docbParseEntityRef(docbParserCtxtPtr ctxt, xmlChar **str) { - xmlChar *name; - xmlEntityPtr ent = NULL; - *str = NULL; - - if (CUR == '&') { - NEXT; - name = docbParseName(ctxt); - if (name == NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "docbParseEntityRef: no name\n"); - ctxt->wellFormed = 0; - } else { - GROW; - if (CUR == ';') { - *str = name; - - /* - * Ask first SAX for entity resolution, otherwise try the - * predefined set. - */ - if (ctxt->sax != NULL) { - if (ctxt->sax->getEntity != NULL) - ent = ctxt->sax->getEntity(ctxt->userData, name); - if (ent == NULL) - ent = xmlGetPredefinedEntity(name); - } - NEXT; - } else { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "docbParseEntityRef: expecting ';'\n"); - *str = name; - } - } - } - return(ent); -} - -/** - * docbParseAttValue: - * @ctxt: an SGML parser context - * - * parse a value for an attribute - * Note: the parser won't do substitution of entities here, this - * will be handled later in xmlStringGetNodeList, unless it was - * asked for ctxt->replaceEntities != 0 - * - * Returns the AttValue parsed or NULL. - */ - -static xmlChar * -docbParseAttValue(docbParserCtxtPtr ctxt) { - xmlChar *ret = NULL; - - if (CUR == '"') { - NEXT; - ret = docbParseSGMLAttribute(ctxt, '"'); - if (CUR != '"') { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n"); - ctxt->wellFormed = 0; - } else - NEXT; - } else if (CUR == '\'') { - NEXT; - ret = docbParseSGMLAttribute(ctxt, '\''); - if (CUR != '\'') { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n"); - ctxt->wellFormed = 0; - } else - NEXT; - } else { - /* - * That's an SGMLism, the attribute value may not be quoted - */ - ret = docbParseSGMLAttribute(ctxt, 0); - if (ret == NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "AttValue: no value found\n"); - ctxt->wellFormed = 0; - } - } - return(ret); -} - -/** - * docbParseSystemLiteral: - * @ctxt: an SGML parser context - * - * parse an SGML Literal - * - * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") - * - * Returns the SystemLiteral parsed or NULL - */ - -static xmlChar * -docbParseSystemLiteral(docbParserCtxtPtr ctxt) { - const xmlChar *q; - xmlChar *ret = NULL; - - if (CUR == '"') { - NEXT; - q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '"')) - NEXT; - if (!IS_CHAR(CUR)) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n"); - ctxt->wellFormed = 0; - } else { - ret = xmlStrndup(q, CUR_PTR - q); - NEXT; - } - } else if (CUR == '\'') { - NEXT; - q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '\'')) - NEXT; - if (!IS_CHAR(CUR)) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n"); - ctxt->wellFormed = 0; - } else { - ret = xmlStrndup(q, CUR_PTR - q); - NEXT; - } - } else { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "SystemLiteral \" or ' expected\n"); - ctxt->wellFormed = 0; - } - - return(ret); -} - -/** - * docbParsePubidLiteral: - * @ctxt: an SGML parser context - * - * parse an SGML public literal - * - * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" - * - * Returns the PubidLiteral parsed or NULL. - */ - -static xmlChar * -docbParsePubidLiteral(docbParserCtxtPtr ctxt) { - const xmlChar *q; - xmlChar *ret = NULL; - /* - * Name ::= (Letter | '_') (NameChar)* - */ - if (CUR == '"') { - NEXT; - q = CUR_PTR; - while (IS_PUBIDCHAR(CUR)) NEXT; - if (CUR != '"') { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n"); - ctxt->wellFormed = 0; - } else { - ret = xmlStrndup(q, CUR_PTR - q); - NEXT; - } - } else if (CUR == '\'') { - NEXT; - q = CUR_PTR; - while ((IS_LETTER(CUR)) && (CUR != '\'')) - NEXT; - if (!IS_LETTER(CUR)) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n"); - ctxt->wellFormed = 0; - } else { - ret = xmlStrndup(q, CUR_PTR - q); - NEXT; - } - } else { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "SystemLiteral \" or ' expected\n"); - ctxt->wellFormed = 0; - } - - return(ret); -} - -/** - * docbParseCharData: - * @ctxt: an SGML parser context - * @cdata: int indicating whether we are within a CDATA section - * - * parse a CharData section. - * if we are within a CDATA section ']]>' marks an end of section. - * - * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) - */ - -static void -docbParseCharData(docbParserCtxtPtr ctxt) { - xmlChar buf[DOCB_PARSER_BIG_BUFFER_SIZE + 5]; - int nbchar = 0; - int cur, l; - - SHRINK; - cur = CUR_CHAR(l); - while (((cur != '<') || (ctxt->token == '<')) && - ((cur != '&') || (ctxt->token == '&')) && - (IS_CHAR(cur))) { - COPY_BUF(l,buf,nbchar,cur); - if (nbchar >= DOCB_PARSER_BIG_BUFFER_SIZE) { - /* - * Ok the segment is to be consumed as chars. - */ - if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { - if (areBlanks(ctxt, buf, nbchar)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, - buf, nbchar); - } else { - if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, buf, nbchar); - } - } - nbchar = 0; - } - NEXTL(l); - cur = CUR_CHAR(l); - } - if (nbchar != 0) { - /* - * Ok the segment is to be consumed as chars. - */ - if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { - if (areBlanks(ctxt, buf, nbchar)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); - } else { - if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, buf, nbchar); - } - } - } -} - -/** - * docbParseExternalID: - * @ctxt: an SGML parser context - * @publicID: a xmlChar** receiving PubidLiteral - * - * Parse an External ID or a Public ID - * - * Returns the function returns SystemLiteral and in the second - * case publicID receives PubidLiteral, - * it is possible to return NULL and have publicID set. - */ - -static xmlChar * -docbParseExternalID(docbParserCtxtPtr ctxt, xmlChar **publicID) { - xmlChar *URI = NULL; - - if ((UPPER == 'S') && (UPP(1) == 'Y') && - (UPP(2) == 'S') && (UPP(3) == 'T') && - (UPP(4) == 'E') && (UPP(5) == 'M')) { - SKIP(6); - if (!IS_BLANK(CUR)) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Space required after 'SYSTEM'\n"); - ctxt->wellFormed = 0; - } - SKIP_BLANKS; - URI = docbParseSystemLiteral(ctxt); - if (URI == NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "docbParseExternalID: SYSTEM, no URI\n"); - ctxt->wellFormed = 0; - } - } else if ((UPPER == 'P') && (UPP(1) == 'U') && - (UPP(2) == 'B') && (UPP(3) == 'L') && - (UPP(4) == 'I') && (UPP(5) == 'C')) { - SKIP(6); - if (!IS_BLANK(CUR)) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Space required after 'PUBLIC'\n"); - ctxt->wellFormed = 0; - } - SKIP_BLANKS; - *publicID = docbParsePubidLiteral(ctxt); - if (*publicID == NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "docbParseExternalID: PUBLIC, no Public Identifier\n"); - ctxt->wellFormed = 0; - } - SKIP_BLANKS; - if ((CUR == '"') || (CUR == '\'')) { - URI = docbParseSystemLiteral(ctxt); - } - } - return(URI); -} - -/** - * docbParsePI: - * @ctxt: an XML parser context - * - * parse an XML Processing Instruction. - * - * [16] PI ::= '' Char*)))? '?>' - * - * The processing is transfered to SAX once parsed. - */ - -static void -docbParsePI(xmlParserCtxtPtr ctxt) { - xmlChar *buf = NULL; - int len = 0; - int size = DOCB_PARSER_BUFFER_SIZE; - int cur, l; - xmlChar *target; - xmlParserInputState state; - int count = 0; - - if ((RAW == '<') && (NXT(1) == '?')) { - xmlParserInputPtr input = ctxt->input; - state = ctxt->instate; - ctxt->instate = XML_PARSER_PI; - /* - * this is a Processing Instruction. - */ - SKIP(2); - SHRINK; - - /* - * Parse the target name and check for special support like - * namespace. - */ - target = xmlParseName(ctxt); - if (target != NULL) { - xmlChar *encoding = NULL; - - if ((RAW == '?') && (NXT(1) == '>')) { - if (input != ctxt->input) { - ctxt->errNo = XML_ERR_ENTITY_BOUNDARY; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "PI declaration doesn't start and stop in the same entity\n"); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } - SKIP(2); - - /* - * SAX: PI detected. - */ - if ((ctxt->sax) && (!ctxt->disableSAX) && - (ctxt->sax->processingInstruction != NULL)) - ctxt->sax->processingInstruction(ctxt->userData, - target, NULL); - ctxt->instate = state; - xmlFree(target); - return; - } - if (xmlStrEqual(target, BAD_CAST "sgml-declaration")) { - - encoding = xmlParseEncodingDecl(ctxt); - if (encoding == NULL) { - xmlGenericError(xmlGenericErrorContext, - "sgml-declaration: failed to find/handle encoding\n"); -#ifdef DEBUG - } else { - xmlGenericError(xmlGenericErrorContext, - "switched to encoding %s\n", encoding); -#endif - } - - } - buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar)); - if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, - "malloc of %d byte failed\n", size); - ctxt->instate = state; - return; - } - cur = CUR; - if (encoding != NULL) { - len = snprintf((char *) buf, size - 1, - " encoding = \"%s\"", encoding); - if (len < 0) - len = size; - } else { - if (!IS_BLANK(cur)) { - ctxt->errNo = XML_ERR_SPACE_REQUIRED; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "docbParsePI: PI %s space expected\n", target); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } - SKIP_BLANKS; - } - cur = CUR_CHAR(l); - while (IS_CHAR(cur) && /* checked */ - ((cur != '?') || (NXT(1) != '>'))) { - if (len + 5 >= size) { - size *= 2; - buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); - if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, - "realloc of %d byte failed\n", size); - ctxt->instate = state; - return; - } - } - count++; - if (count > 50) { - GROW; - count = 0; - } - COPY_BUF(l,buf,len,cur); - NEXTL(l); - cur = CUR_CHAR(l); - if (cur == 0) { - SHRINK; - GROW; - cur = CUR_CHAR(l); - } - } - buf[len] = 0; - if (cur != '?') { - ctxt->errNo = XML_ERR_PI_NOT_FINISHED; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "docbParsePI: PI %s never end ...\n", target); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } else { - if (input != ctxt->input) { - ctxt->errNo = XML_ERR_ENTITY_BOUNDARY; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "PI declaration doesn't start and stop in the same entity\n"); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } - SKIP(2); - - /* - * SAX: PI detected. - */ - if ((ctxt->sax) && (!ctxt->disableSAX) && - (ctxt->sax->processingInstruction != NULL)) - ctxt->sax->processingInstruction(ctxt->userData, - target, buf); - } - xmlFree(buf); - xmlFree(target); - } else { - ctxt->errNo = XML_ERR_PI_NOT_STARTED; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "docbParsePI : no target name\n"); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - } - ctxt->instate = state; - } -} - -/** - * docbParseComment: - * @ctxt: an SGML parser context - * - * Parse an XML (SGML) comment - * - * [15] Comment ::= '' - */ -static void -docbParseComment(docbParserCtxtPtr ctxt) { - xmlChar *buf = NULL; - int len; - int size = DOCB_PARSER_BUFFER_SIZE; - int q, ql; - int r, rl; - int cur, l; - xmlParserInputState state; - - /* - * Check that there is a comment right here. - */ - if ((RAW != '<') || (NXT(1) != '!') || - (NXT(2) != '-') || (NXT(3) != '-')) return; - - state = ctxt->instate; - ctxt->instate = XML_PARSER_COMMENT; - SHRINK; - SKIP(4); - buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar)); - if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, - "malloc of %d byte failed\n", size); - ctxt->instate = state; - return; - } - q = CUR_CHAR(ql); - NEXTL(ql); - r = CUR_CHAR(rl); - NEXTL(rl); - cur = CUR_CHAR(l); - len = 0; - while (IS_CHAR(cur) && - ((cur != '>') || - (r != '-') || (q != '-'))) { - if (len + 5 >= size) { - size *= 2; - buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); - if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, - "realloc of %d byte failed\n", size); - ctxt->instate = state; - return; - } - } - COPY_BUF(ql,buf,len,q); - q = r; - ql = rl; - r = cur; - rl = l; - NEXTL(l); - cur = CUR_CHAR(l); - if (cur == 0) { - SHRINK; - GROW; - cur = CUR_CHAR(l); - } - } - buf[len] = 0; - if (!IS_CHAR(cur)) { - ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Comment not terminated \n - * - * [15] Comment ::= '' - */ -static void -htmlParseComment(htmlParserCtxtPtr ctxt) { - xmlChar *buf = NULL; - int len; - int size = HTML_PARSER_BUFFER_SIZE; - int q, ql; - int r, rl; - int cur, l; - xmlParserInputState state; - - /* - * Check that there is a comment right here. - */ - if ((RAW != '<') || (NXT(1) != '!') || - (NXT(2) != '-') || (NXT(3) != '-')) return; - - state = ctxt->instate; - ctxt->instate = XML_PARSER_COMMENT; - SHRINK; - SKIP(4); - buf = (xmlChar *) xmlMalloc(size * sizeof(xmlChar)); - if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, - "malloc of %d byte failed\n", size); - ctxt->instate = state; - return; - } - q = CUR_CHAR(ql); - NEXTL(ql); - r = CUR_CHAR(rl); - NEXTL(rl); - cur = CUR_CHAR(l); - len = 0; - while (IS_CHAR(cur) && - ((cur != '>') || - (r != '-') || (q != '-'))) { - if (len + 5 >= size) { - size *= 2; - buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); - if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, - "realloc of %d byte failed\n", size); - ctxt->instate = state; - return; - } - } - COPY_BUF(ql,buf,len,q); - q = r; - ql = rl; - r = cur; - rl = l; - NEXTL(l); - cur = CUR_CHAR(l); - if (cur == 0) { - SHRINK; - GROW; - cur = CUR_CHAR(l); - } - } - buf[len] = 0; - if (!IS_CHAR(cur)) { - ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Comment not terminated \n */ - } - if (incomment) { - if (base + 3 < len) - return(-1); - if ((buf[base] == '-') && (buf[base + 1] == '-') && - (buf[base + 2] == '>')) { - incomment = 0; - base += 2; - } - continue; - } - if (buf[base] == first) { - if (third != 0) { - if ((buf[base + 1] != next) || - (buf[base + 2] != third)) continue; - } else if (next != 0) { - if (buf[base + 1] != next) continue; - } - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - if (next == 0) - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c' found at %d\n", - first, base); - else if (third == 0) - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c%c' found at %d\n", - first, next, base); - else - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c%c%c' found at %d\n", - first, next, third, base); -#endif - return(base - (in->cur - in->base)); - } - } - ctxt->checkIndex = base; -#ifdef DEBUG_PUSH - if (next == 0) - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c' failed\n", first); - else if (third == 0) - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c%c' failed\n", first, next); - else - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c%c%c' failed\n", first, next, third); -#endif - return(-1); -} - -/** - * htmlParseTryOrFinish: - * @ctxt: an HTML parser context - * @terminate: last chunk indicator - * - * Try to progress on parsing - * - * Returns zero if no parsing was possible - */ -static int -htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { - int ret = 0; - htmlParserInputPtr in; - int avail = 0; - xmlChar cur, next; - -#ifdef DEBUG_PUSH - switch (ctxt->instate) { - case XML_PARSER_EOF: - xmlGenericError(xmlGenericErrorContext, - "HPP: try EOF\n"); break; - case XML_PARSER_START: - xmlGenericError(xmlGenericErrorContext, - "HPP: try START\n"); break; - case XML_PARSER_MISC: - xmlGenericError(xmlGenericErrorContext, - "HPP: try MISC\n");break; - case XML_PARSER_COMMENT: - xmlGenericError(xmlGenericErrorContext, - "HPP: try COMMENT\n");break; - case XML_PARSER_PROLOG: - xmlGenericError(xmlGenericErrorContext, - "HPP: try PROLOG\n");break; - case XML_PARSER_START_TAG: - xmlGenericError(xmlGenericErrorContext, - "HPP: try START_TAG\n");break; - case XML_PARSER_CONTENT: - xmlGenericError(xmlGenericErrorContext, - "HPP: try CONTENT\n");break; - case XML_PARSER_CDATA_SECTION: - xmlGenericError(xmlGenericErrorContext, - "HPP: try CDATA_SECTION\n");break; - case XML_PARSER_END_TAG: - xmlGenericError(xmlGenericErrorContext, - "HPP: try END_TAG\n");break; - case XML_PARSER_ENTITY_DECL: - xmlGenericError(xmlGenericErrorContext, - "HPP: try ENTITY_DECL\n");break; - case XML_PARSER_ENTITY_VALUE: - xmlGenericError(xmlGenericErrorContext, - "HPP: try ENTITY_VALUE\n");break; - case XML_PARSER_ATTRIBUTE_VALUE: - xmlGenericError(xmlGenericErrorContext, - "HPP: try ATTRIBUTE_VALUE\n");break; - case XML_PARSER_DTD: - xmlGenericError(xmlGenericErrorContext, - "HPP: try DTD\n");break; - case XML_PARSER_EPILOG: - xmlGenericError(xmlGenericErrorContext, - "HPP: try EPILOG\n");break; - case XML_PARSER_PI: - xmlGenericError(xmlGenericErrorContext, - "HPP: try PI\n");break; - case XML_PARSER_SYSTEM_LITERAL: - xmlGenericError(xmlGenericErrorContext, - "HPP: try SYSTEM_LITERAL\n");break; - } -#endif - - while (1) { - - in = ctxt->input; - if (in == NULL) break; - if (in->buf == NULL) - avail = in->length - (in->cur - in->base); - else - avail = in->buf->buffer->use - (in->cur - in->base); - if ((avail == 0) && (terminate)) { - htmlAutoCloseOnEnd(ctxt); - if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { - /* - * SAX: end of the document processing. - */ - ctxt->instate = XML_PARSER_EOF; - if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) - ctxt->sax->endDocument(ctxt->userData); - } - } - if (avail < 1) - goto done; - switch (ctxt->instate) { - case XML_PARSER_EOF: - /* - * Document parsing is done ! - */ - goto done; - case XML_PARSER_START: - /* - * Very first chars read from the document flow. - */ - cur = in->cur[0]; - if (IS_BLANK(cur)) { - SKIP_BLANKS; - if (in->buf == NULL) - avail = in->length - (in->cur - in->base); - else - avail = in->buf->buffer->use - (in->cur - in->base); - } - if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) - ctxt->sax->setDocumentLocator(ctxt->userData, - &xmlDefaultSAXLocator); - if ((ctxt->sax) && (ctxt->sax->startDocument) && - (!ctxt->disableSAX)) - ctxt->sax->startDocument(ctxt->userData); - - cur = in->cur[0]; - next = in->cur[1]; - if ((cur == '<') && (next == '!') && - (UPP(2) == 'D') && (UPP(3) == 'O') && - (UPP(4) == 'C') && (UPP(5) == 'T') && - (UPP(6) == 'Y') && (UPP(7) == 'P') && - (UPP(8) == 'E')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) - goto done; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing internal subset\n"); -#endif - htmlParseDocTypeDecl(ctxt); - ctxt->instate = XML_PARSER_PROLOG; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering PROLOG\n"); -#endif - } else { - ctxt->instate = XML_PARSER_MISC; - } -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering MISC\n"); -#endif - break; - case XML_PARSER_MISC: - SKIP_BLANKS; - if (in->buf == NULL) - avail = in->length - (in->cur - in->base); - else - avail = in->buf->buffer->use - (in->cur - in->base); - if (avail < 2) - goto done; - cur = in->cur[0]; - next = in->cur[1]; - if ((cur == '<') && (next == '!') && - (in->cur[2] == '-') && (in->cur[3] == '-')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) - goto done; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing Comment\n"); -#endif - htmlParseComment(ctxt); - ctxt->instate = XML_PARSER_MISC; - } else if ((cur == '<') && (next == '!') && - (UPP(2) == 'D') && (UPP(3) == 'O') && - (UPP(4) == 'C') && (UPP(5) == 'T') && - (UPP(6) == 'Y') && (UPP(7) == 'P') && - (UPP(8) == 'E')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) - goto done; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing internal subset\n"); -#endif - htmlParseDocTypeDecl(ctxt); - ctxt->instate = XML_PARSER_PROLOG; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering PROLOG\n"); -#endif - } else if ((cur == '<') && (next == '!') && - (avail < 9)) { - goto done; - } else { - ctxt->instate = XML_PARSER_START_TAG; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering START_TAG\n"); -#endif - } - break; - case XML_PARSER_PROLOG: - SKIP_BLANKS; - if (in->buf == NULL) - avail = in->length - (in->cur - in->base); - else - avail = in->buf->buffer->use - (in->cur - in->base); - if (avail < 2) - goto done; - cur = in->cur[0]; - next = in->cur[1]; - if ((cur == '<') && (next == '!') && - (in->cur[2] == '-') && (in->cur[3] == '-')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) - goto done; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing Comment\n"); -#endif - htmlParseComment(ctxt); - ctxt->instate = XML_PARSER_PROLOG; - } else if ((cur == '<') && (next == '!') && - (avail < 4)) { - goto done; - } else { - ctxt->instate = XML_PARSER_START_TAG; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering START_TAG\n"); -#endif - } - break; - case XML_PARSER_EPILOG: - if (in->buf == NULL) - avail = in->length - (in->cur - in->base); - else - avail = in->buf->buffer->use - (in->cur - in->base); - if (avail < 1) - goto done; - cur = in->cur[0]; - if (IS_BLANK(cur)) { - htmlParseCharData(ctxt); - goto done; - } - if (avail < 2) - goto done; - next = in->cur[1]; - if ((cur == '<') && (next == '!') && - (in->cur[2] == '-') && (in->cur[3] == '-')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) - goto done; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing Comment\n"); -#endif - htmlParseComment(ctxt); - ctxt->instate = XML_PARSER_EPILOG; - } else if ((cur == '<') && (next == '!') && - (avail < 4)) { - goto done; - } else { - ctxt->errNo = XML_ERR_DOCUMENT_END; - ctxt->wellFormed = 0; - ctxt->instate = XML_PARSER_EOF; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering EOF\n"); -#endif - if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) - ctxt->sax->endDocument(ctxt->userData); - goto done; - } - break; - case XML_PARSER_START_TAG: { - xmlChar *name, *oldname; - int depth = ctxt->nameNr; - const htmlElemDesc * info; - - if (avail < 2) - goto done; - cur = in->cur[0]; - if (cur != '<') { - ctxt->instate = XML_PARSER_CONTENT; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - } - if (in->cur[1] == '/') { - ctxt->instate = XML_PARSER_END_TAG; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering END_TAG\n"); -#endif - break; - } - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) - goto done; - - oldname = xmlStrdup(ctxt->name); - htmlParseStartTag(ctxt); - name = ctxt->name; -#ifdef DEBUG - if (oldname == NULL) - xmlGenericError(xmlGenericErrorContext, - "Start of element %s\n", name); - else if (name == NULL) - xmlGenericError(xmlGenericErrorContext, - "Start of element failed, was %s\n", - oldname); - else - xmlGenericError(xmlGenericErrorContext, - "Start of element %s, was %s\n", - name, oldname); -#endif - if (((depth == ctxt->nameNr) && - (xmlStrEqual(oldname, ctxt->name))) || - (name == NULL)) { - if (CUR == '>') - NEXT; - if (oldname != NULL) - xmlFree(oldname); - break; - } - if (oldname != NULL) - xmlFree(oldname); - - /* - * Lookup the info for that element. - */ - info = htmlTagLookup(name); - if (info == NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "Tag %s invalid\n", - name); - ctxt->wellFormed = 0; - } else if (info->depr) { - /*************************** - if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, - "Tag %s is deprecated\n", - name); - ***************************/ - } - - /* - * Check for an Empty Element labeled the XML/SGML way - */ - if ((CUR == '/') && (NXT(1) == '>')) { - SKIP(2); - if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) - ctxt->sax->endElement(ctxt->userData, name); - oldname = htmlnamePop(ctxt); -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"End of tag the XML way: popping out %s\n", - oldname); -#endif - if (oldname != NULL) - xmlFree(oldname); - ctxt->instate = XML_PARSER_CONTENT; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - } - - if (CUR == '>') { - NEXT; - } else { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Couldn't find end of Start Tag %s\n", - name); - ctxt->wellFormed = 0; - - /* - * end of parsing of this node. - */ - if (xmlStrEqual(name, ctxt->name)) { - nodePop(ctxt); - oldname = htmlnamePop(ctxt); -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext, - "End of start tag problem: popping out %s\n", oldname); -#endif - if (oldname != NULL) - xmlFree(oldname); - } - - ctxt->instate = XML_PARSER_CONTENT; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - } - - /* - * Check for an Empty Element from DTD definition - */ - if ((info != NULL) && (info->empty)) { - if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) - ctxt->sax->endElement(ctxt->userData, name); - oldname = htmlnamePop(ctxt); -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"End of empty tag %s : popping out %s\n", name, oldname); -#endif - if (oldname != NULL) - xmlFree(oldname); - } - ctxt->instate = XML_PARSER_CONTENT; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - } - case XML_PARSER_CONTENT: { - long cons; - /* - * Handle preparsed entities and charRef - */ - if (ctxt->token != 0) { - xmlChar chr[2] = { 0 , 0 } ; - - chr[0] = (xmlChar) ctxt->token; - htmlCheckParagraph(ctxt); - if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) - ctxt->sax->characters(ctxt->userData, chr, 1); - ctxt->token = 0; - ctxt->checkIndex = 0; - } - if ((avail == 1) && (terminate)) { - cur = in->cur[0]; - if ((cur != '<') && (cur != '&')) { - if (ctxt->sax != NULL) { - if (IS_BLANK(cur)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace( - ctxt->userData, &cur, 1); - } else { - htmlCheckParagraph(ctxt); - if (ctxt->sax->characters != NULL) - ctxt->sax->characters( - ctxt->userData, &cur, 1); - } - } - ctxt->token = 0; - ctxt->checkIndex = 0; - in->cur++; - break; - } - } - if (avail < 2) - goto done; - cur = in->cur[0]; - next = in->cur[1]; - cons = ctxt->nbChars; - if ((xmlStrEqual(ctxt->name, BAD_CAST"script")) || - (xmlStrEqual(ctxt->name, BAD_CAST"style"))) { - /* - * Handle SCRIPT/STYLE separately - */ - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '<', '/', 0) < 0)) - goto done; - htmlParseScript(ctxt); - if ((cur == '<') && (next == '/')) { - ctxt->instate = XML_PARSER_END_TAG; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering END_TAG\n"); -#endif - break; - } - } else { - /* - * Sometimes DOCTYPE arrives in the middle of the document - */ - if ((cur == '<') && (next == '!') && - (UPP(2) == 'D') && (UPP(3) == 'O') && - (UPP(4) == 'C') && (UPP(5) == 'T') && - (UPP(6) == 'Y') && (UPP(7) == 'P') && - (UPP(8) == 'E')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) - goto done; - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Misplaced DOCTYPE declaration\n"); - ctxt->wellFormed = 0; - htmlParseDocTypeDecl(ctxt); - } else if ((cur == '<') && (next == '!') && - (in->cur[2] == '-') && (in->cur[3] == '-')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) - goto done; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing Comment\n"); -#endif - htmlParseComment(ctxt); - ctxt->instate = XML_PARSER_CONTENT; - } else if ((cur == '<') && (next == '!') && (avail < 4)) { - goto done; - } else if ((cur == '<') && (next == '/')) { - ctxt->instate = XML_PARSER_END_TAG; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering END_TAG\n"); -#endif - break; - } else if (cur == '<') { - ctxt->instate = XML_PARSER_START_TAG; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering START_TAG\n"); -#endif - break; - } else if (cur == '&') { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, ';', 0, 0) < 0)) - goto done; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing Reference\n"); -#endif - /* TODO: check generation of subtrees if noent !!! */ - htmlParseReference(ctxt); - } else { - /* TODO Avoid the extra copy, handle directly !!!!!! */ - /* - * Goal of the following test is: - * - minimize calls to the SAX 'character' callback - * when they are mergeable - */ - if ((ctxt->inputNr == 1) && - (avail < HTML_PARSER_BIG_BUFFER_SIZE)) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '<', 0, 0) < 0)) - goto done; - } - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing char data\n"); -#endif - htmlParseCharData(ctxt); - } - } - if (cons == ctxt->nbChars) { - if (ctxt->node != NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "detected an error in element content\n"); - ctxt->wellFormed = 0; - } - NEXT; - break; - } - - break; - } - case XML_PARSER_END_TAG: - if (avail < 2) - goto done; - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) - goto done; - htmlParseEndTag(ctxt); - if (ctxt->nameNr == 0) { - ctxt->instate = XML_PARSER_EPILOG; - } else { - ctxt->instate = XML_PARSER_CONTENT; - } - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - case XML_PARSER_CDATA_SECTION: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == CDATA\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - case XML_PARSER_DTD: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == DTD\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - case XML_PARSER_COMMENT: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == COMMENT\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - case XML_PARSER_PI: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == PI\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - case XML_PARSER_ENTITY_DECL: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == ENTITY_DECL\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - case XML_PARSER_ENTITY_VALUE: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == ENTITY_VALUE\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering DTD\n"); -#endif - break; - case XML_PARSER_ATTRIBUTE_VALUE: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == ATTRIBUTE_VALUE\n"); - ctxt->instate = XML_PARSER_START_TAG; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering START_TAG\n"); -#endif - break; - case XML_PARSER_SYSTEM_LITERAL: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == XML_PARSER_SYSTEM_LITERAL\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - case XML_PARSER_IGNORE: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == XML_PARSER_IGNORE\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - case XML_PARSER_PUBLIC_LITERAL: - xmlGenericError(xmlGenericErrorContext, - "HPP: internal error, state == XML_PARSER_LITERAL\n"); - ctxt->instate = XML_PARSER_CONTENT; - ctxt->checkIndex = 0; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering CONTENT\n"); -#endif - break; - - } - } -done: - if ((avail == 0) && (terminate)) { - htmlAutoCloseOnEnd(ctxt); - if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { - /* - * SAX: end of the document processing. - */ - ctxt->instate = XML_PARSER_EOF; - if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) - ctxt->sax->endDocument(ctxt->userData); - } - } - if ((ctxt->myDoc != NULL) && - ((terminate) || (ctxt->instate == XML_PARSER_EOF) || - (ctxt->instate == XML_PARSER_EPILOG))) { - xmlDtdPtr dtd; - dtd = xmlGetIntSubset(ctxt->myDoc); - if (dtd == NULL) - ctxt->myDoc->intSubset = - xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "HTML", - BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN", - BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd"); - } -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, "HPP: done %d\n", ret); -#endif - return(ret); -} - -/** - * htmlParseChunk: - * @ctxt: an XML parser context - * @chunk: an char array - * @size: the size in byte of the chunk - * @terminate: last chunk indicator - * - * Parse a Chunk of memory - * - * Returns zero if no error, the xmlParserErrors otherwise. - */ -int -htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, - int terminate) { - if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && - (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) { - int base = ctxt->input->base - ctxt->input->buf->buffer->content; - int cur = ctxt->input->cur - ctxt->input->base; - - xmlParserInputBufferPush(ctxt->input->buf, size, chunk); - ctxt->input->base = ctxt->input->buf->buffer->content + base; - ctxt->input->cur = ctxt->input->base + cur; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); -#endif - - if ((terminate) || (ctxt->input->buf->buffer->use > 80)) - htmlParseTryOrFinish(ctxt, terminate); - } else if (ctxt->instate != XML_PARSER_EOF) { - xmlParserInputBufferPush(ctxt->input->buf, 0, ""); - htmlParseTryOrFinish(ctxt, terminate); - } - if (terminate) { - if ((ctxt->instate != XML_PARSER_EOF) && - (ctxt->instate != XML_PARSER_EPILOG) && - (ctxt->instate != XML_PARSER_MISC)) { - ctxt->errNo = XML_ERR_DOCUMENT_END; - ctxt->wellFormed = 0; - } - if (ctxt->instate != XML_PARSER_EOF) { - if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) - ctxt->sax->endDocument(ctxt->userData); - } - ctxt->instate = XML_PARSER_EOF; - } - return((xmlParserErrors) ctxt->errNo); -} - -/************************************************************************ - * * - * User entry points * - * * - ************************************************************************/ - -/** - * htmlCreatePushParserCtxt: - * @sax: a SAX handler - * @user_data: The user data returned on SAX callbacks - * @chunk: a pointer to an array of chars - * @size: number of chars in the array - * @filename: an optional file name or URI - * @enc: an optional encoding - * - * Create a parser context for using the HTML parser in push mode - * To allow content encoding detection, @size should be >= 4 - * The value of @filename is used for fetching external entities - * and error/warning reports. - * - * Returns the new parser context or NULL - */ -htmlParserCtxtPtr -htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, - const char *chunk, int size, const char *filename, - xmlCharEncoding enc) { - htmlParserCtxtPtr ctxt; - htmlParserInputPtr inputStream; - xmlParserInputBufferPtr buf; - - xmlInitParser(); - - buf = xmlAllocParserInputBuffer(enc); - if (buf == NULL) return(NULL); - - ctxt = (htmlParserCtxtPtr) xmlMalloc(sizeof(htmlParserCtxt)); - if (ctxt == NULL) { - xmlFree(buf); - return(NULL); - } - memset(ctxt, 0, sizeof(htmlParserCtxt)); - htmlInitParserCtxt(ctxt); - if (sax != NULL) { - if (ctxt->sax != &htmlDefaultSAXHandler) - xmlFree(ctxt->sax); - ctxt->sax = (htmlSAXHandlerPtr) xmlMalloc(sizeof(htmlSAXHandler)); - if (ctxt->sax == NULL) { - xmlFree(buf); - xmlFree(ctxt); - return(NULL); - } - memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler)); - if (user_data != NULL) - ctxt->userData = user_data; - } - if (filename == NULL) { - ctxt->directory = NULL; - } else { - ctxt->directory = xmlParserGetDirectory(filename); - } - - inputStream = htmlNewInputStream(ctxt); - if (inputStream == NULL) { - xmlFreeParserCtxt(ctxt); - return(NULL); - } - - if (filename == NULL) - inputStream->filename = NULL; - else - inputStream->filename = xmlMemStrdup(filename); - inputStream->buf = buf; - inputStream->base = inputStream->buf->buffer->content; - inputStream->cur = inputStream->buf->buffer->content; - - inputPush(ctxt, inputStream); - - if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && - (ctxt->input->buf != NULL)) { - xmlParserInputBufferPush(ctxt->input->buf, size, chunk); -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); -#endif - } - - return(ctxt); -} - -/** - * htmlSAXParseDoc: - * @cur: a pointer to an array of xmlChar - * @encoding: a free form C string describing the HTML document encoding, or NULL - * @sax: the SAX handler block - * @userData: if using SAX, this pointer will be provided on callbacks. - * - * Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks - * to handle parse events. If sax is NULL, fallback to the default DOM - * behavior and return a tree. - * - * Returns the resulting document tree unless SAX is NULL or the document is - * not well formed. - */ - -htmlDocPtr -htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void *userData) { - htmlDocPtr ret; - htmlParserCtxtPtr ctxt; - - xmlInitParser(); - - if (cur == NULL) return(NULL); - - - ctxt = htmlCreateDocParserCtxt(cur, encoding); - if (ctxt == NULL) return(NULL); - if (sax != NULL) { - ctxt->sax = sax; - ctxt->userData = userData; - } - - htmlParseDocument(ctxt); - ret = ctxt->myDoc; - if (sax != NULL) { - ctxt->sax = NULL; - ctxt->userData = NULL; - } - htmlFreeParserCtxt(ctxt); - - return(ret); -} - -/** - * htmlParseDoc: - * @cur: a pointer to an array of xmlChar - * @encoding: a free form C string describing the HTML document encoding, or NULL - * - * parse an HTML in-memory document and build a tree. - * - * Returns the resulting document tree - */ - -htmlDocPtr -htmlParseDoc(xmlChar *cur, const char *encoding) { - return(htmlSAXParseDoc(cur, encoding, NULL, NULL)); -} - - -/** - * htmlCreateFileParserCtxt: - * @filename: the filename - * @encoding: a free form C string describing the HTML document encoding, or NULL - * - * Create a parser context for a file content. - * Automatic support for ZLIB/Compress compressed document is provided - * by default if found at compile-time. - * - * Returns the new parser context or NULL - */ -htmlParserCtxtPtr -htmlCreateFileParserCtxt(const char *filename, const char *encoding) -{ - htmlParserCtxtPtr ctxt; - htmlParserInputPtr inputStream; - xmlParserInputBufferPtr buf; - /* htmlCharEncoding enc; */ - xmlChar *content, *content_line = (xmlChar *) "charset="; - - buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE); - if (buf == NULL) return(NULL); - - ctxt = (htmlParserCtxtPtr) xmlMalloc(sizeof(htmlParserCtxt)); - if (ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, "malloc failed\n"); - return(NULL); - } - memset(ctxt, 0, sizeof(htmlParserCtxt)); - htmlInitParserCtxt(ctxt); - inputStream = (htmlParserInputPtr) xmlMalloc(sizeof(htmlParserInput)); - if (inputStream == NULL) { - xmlGenericError(xmlGenericErrorContext, "malloc failed\n"); - xmlFree(ctxt); - return(NULL); - } - memset(inputStream, 0, sizeof(htmlParserInput)); - - inputStream->filename = (char *) - xmlNormalizeWindowsPath((xmlChar *)filename); - inputStream->line = 1; - inputStream->col = 1; - inputStream->buf = buf; - inputStream->directory = NULL; - - inputStream->base = inputStream->buf->buffer->content; - inputStream->cur = inputStream->buf->buffer->content; - inputStream->free = NULL; - - inputPush(ctxt, inputStream); - - /* set encoding */ - if (encoding) { - content = xmlMalloc (xmlStrlen(content_line) + strlen(encoding) + 1); - if (content) { - strcpy ((char *)content, (char *)content_line); - strcat ((char *)content, (char *)encoding); - htmlCheckEncoding (ctxt, content); - xmlFree (content); - } - } - - return(ctxt); -} - -/** - * htmlSAXParseFile: - * @filename: the filename - * @encoding: a free form C string describing the HTML document encoding, or NULL - * @sax: the SAX handler block - * @userData: if using SAX, this pointer will be provided on callbacks. - * - * parse an HTML file and build a tree. Automatic support for ZLIB/Compress - * compressed document is provided by default if found at compile-time. - * It use the given SAX function block to handle the parsing callback. - * If sax is NULL, fallback to the default DOM tree building routines. - * - * Returns the resulting document tree unless SAX is NULL or the document is - * not well formed. - */ - -htmlDocPtr -htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr sax, - void *userData) { - htmlDocPtr ret; - htmlParserCtxtPtr ctxt; - htmlSAXHandlerPtr oldsax = NULL; - - xmlInitParser(); - - ctxt = htmlCreateFileParserCtxt(filename, encoding); - if (ctxt == NULL) return(NULL); - if (sax != NULL) { - oldsax = ctxt->sax; - ctxt->sax = sax; - ctxt->userData = userData; - } - - htmlParseDocument(ctxt); - - ret = ctxt->myDoc; - if (sax != NULL) { - ctxt->sax = oldsax; - ctxt->userData = NULL; - } - htmlFreeParserCtxt(ctxt); - - return(ret); -} - -/** - * htmlParseFile: - * @filename: the filename - * @encoding: a free form C string describing the HTML document encoding, or NULL - * - * parse an HTML file and build a tree. Automatic support for ZLIB/Compress - * compressed document is provided by default if found at compile-time. - * - * Returns the resulting document tree - */ - -htmlDocPtr -htmlParseFile(const char *filename, const char *encoding) { - return(htmlSAXParseFile(filename, encoding, NULL, NULL)); -} - -/** - * htmlHandleOmittedElem: - * @val: int 0 or 1 - * - * Set and return the previous value for handling HTML omitted tags. - * - * Returns the last value for 0 for no handling, 1 for auto insertion. - */ - -int -htmlHandleOmittedElem(int val) { - int old = htmlOmittedDefaultValue; - - htmlOmittedDefaultValue = val; - return(old); -} - -#endif /* LIBXML_HTML_ENABLED */ diff --git a/bundle/libxml/HTMLtree.c b/bundle/libxml/HTMLtree.c deleted file mode 100644 index fe69b3dee9..0000000000 --- a/bundle/libxml/HTMLtree.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* - * HTMLtree.c : implementation of access function for an HTML tree. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - - -#define IN_LIBXML -#include "libxml.h" -#ifdef LIBXML_HTML_ENABLED - -#include /* for memset() only ! */ - -#ifdef HAVE_CTYPE_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/************************************************************************ - * * - * Getting/Setting encoding meta tags * - * * - ************************************************************************/ - -/** - * htmlGetMetaEncoding: - * @doc: the document - * - * Encoding definition lookup in the Meta tags - * - * Returns the current encoding as flagged in the HTML source - */ -const xmlChar * -htmlGetMetaEncoding(htmlDocPtr doc) { - htmlNodePtr cur; - const xmlChar *content; - const xmlChar *encoding; - - if (doc == NULL) - return(NULL); - cur = doc->children; - - /* - * Search the html - */ - while (cur != NULL) { - if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { - if (xmlStrEqual(cur->name, BAD_CAST"html")) - break; - if (xmlStrEqual(cur->name, BAD_CAST"head")) - goto found_head; - if (xmlStrEqual(cur->name, BAD_CAST"meta")) - goto found_meta; - } - cur = cur->next; - } - if (cur == NULL) - return(NULL); - cur = cur->children; - - /* - * Search the head - */ - while (cur != NULL) { - if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { - if (xmlStrEqual(cur->name, BAD_CAST"head")) - break; - if (xmlStrEqual(cur->name, BAD_CAST"meta")) - goto found_meta; - } - cur = cur->next; - } - if (cur == NULL) - return(NULL); -found_head: - cur = cur->children; - - /* - * Search the meta elements - */ -found_meta: - while (cur != NULL) { - if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { - if (xmlStrEqual(cur->name, BAD_CAST"meta")) { - xmlAttrPtr attr = cur->properties; - int http; - const xmlChar *value; - - content = NULL; - http = 0; - while (attr != NULL) { - if ((attr->children != NULL) && - (attr->children->type == XML_TEXT_NODE) && - (attr->children->next == NULL)) { - value = attr->children->content; - if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv")) - && (!xmlStrcasecmp(value, BAD_CAST"Content-Type"))) - http = 1; - else if ((value != NULL) - && (!xmlStrcasecmp(attr->name, BAD_CAST"content"))) - content = value; - if ((http != 0) && (content != NULL)) - goto found_content; - } - attr = attr->next; - } - } - } - cur = cur->next; - } - return(NULL); - -found_content: - encoding = xmlStrstr(content, BAD_CAST"charset="); - if (encoding == NULL) - encoding = xmlStrstr(content, BAD_CAST"Charset="); - if (encoding == NULL) - encoding = xmlStrstr(content, BAD_CAST"CHARSET="); - if (encoding != NULL) { - encoding += 8; - } else { - encoding = xmlStrstr(content, BAD_CAST"charset ="); - if (encoding == NULL) - encoding = xmlStrstr(content, BAD_CAST"Charset ="); - if (encoding == NULL) - encoding = xmlStrstr(content, BAD_CAST"CHARSET ="); - if (encoding != NULL) - encoding += 9; - } - if (encoding != NULL) { - while ((*encoding == ' ') || (*encoding == '\t')) encoding++; - } - return(encoding); -} - -/** - * htmlSetMetaEncoding: - * @doc: the document - * @encoding: the encoding string - * - * Sets the current encoding in the Meta tags - * NOTE: this will not change the document content encoding, just - * the META flag associated. - * - * Returns 0 in case of success and -1 in case of error - */ -int -htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) { - htmlNodePtr cur, meta; - const xmlChar *content; - char newcontent[100]; - - - if (doc == NULL) - return(-1); - - if (encoding != NULL) { - snprintf(newcontent, sizeof(newcontent), "text/html; charset=%s", - encoding); - newcontent[sizeof(newcontent) - 1] = 0; - } - - cur = doc->children; - - /* - * Search the html - */ - while (cur != NULL) { - if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { - if (xmlStrcasecmp(cur->name, BAD_CAST"html") == 0) - break; - if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) - goto found_head; - if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) - goto found_meta; - } - cur = cur->next; - } - if (cur == NULL) - return(-1); - cur = cur->children; - - /* - * Search the head - */ - while (cur != NULL) { - if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { - if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) - break; - if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) - goto found_meta; - } - cur = cur->next; - } - if (cur == NULL) - return(-1); -found_head: - if (cur->children == NULL) { - if (encoding == NULL) - return(0); - meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); - xmlAddChild(cur, meta); - xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); - xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); - return(0); - } - cur = cur->children; - -found_meta: - if (encoding != NULL) { - /* - * Create a new Meta element with the right attributes - */ - - meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); - xmlAddPrevSibling(cur, meta); - xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); - xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); - } - - /* - * Search and destroy all the remaining the meta elements carrying - * encoding informations - */ - while (cur != NULL) { - if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { - if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) { - xmlAttrPtr attr = cur->properties; - int http; - const xmlChar *value; - - content = NULL; - http = 0; - while (attr != NULL) { - if ((attr->children != NULL) && - (attr->children->type == XML_TEXT_NODE) && - (attr->children->next == NULL)) { - value = attr->children->content; - if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv")) - && (!xmlStrcasecmp(value, BAD_CAST"Content-Type"))) - http = 1; - else - { - if ((value != NULL) && - (!xmlStrcasecmp(attr->name, BAD_CAST"content"))) - content = value; - } - if ((http != 0) && (content != NULL)) - break; - } - attr = attr->next; - } - if ((http != 0) && (content != NULL)) { - meta = cur; - cur = cur->next; - xmlUnlinkNode(meta); - xmlFreeNode(meta); - continue; - } - - } - } - cur = cur->next; - } - return(0); -} - -/** - * booleanHTMLAttrs: - * - * These are the HTML attributes which will be output - * in minimized form, i.e.