Yasuo Ohgaki
yohga****@users*****
2002年 7月 9日 (火) 18:14:47 JST
yohgaki 02/07/09 18:14:46 Modified: . Tag: ORIG ChangeLog LICENSE Makefile.global NEWS TODO acinclude.m4 buildconf config.guess config.sub configure.in genfiles ltmain.sh php.ini-dist php.ini-recommended run-tests.php build Tag: ORIG build.mk buildcheck.sh ext/aspell Tag: ORIG aspell.c ext/bcmath Tag: ORIG bcmath.c php_bcmath.h ext/bz2 Tag: ORIG bz2.c ext/bz2/tests Tag: ORIG .cvsignore ext/calendar Tag: ORIG easter.c ext/ccvs Tag: ORIG ccvs.c ext/com Tag: ORIG COM.c CREDITS VARIANT.c com.h conversion.c php_COM.h variant.h ext/cpdf Tag: ORIG cpdf.c ext/crack/tests Tag: ORIG .cvsignore ext/ctype/tests Tag: ORIG .cvsignore ext/curl Tag: ORIG curl.c ext/cybercash Tag: ORIG cybercash.c ext/cybermut/tests Tag: ORIG .cvsignore ext/cyrus Tag: ORIG cyrus.c ext/db Tag: ORIG db.c php_db.h ext/db/tests Tag: ORIG .cvsignore ext/dba Tag: ORIG dba.c ext/dbase Tag: ORIG dbase.c ext/dbx Tag: ORIG dbx_sybasect.c ext/dbx/tests Tag: ORIG .cvsignore ext/dio Tag: ORIG dio.c ext/dio/tests Tag: ORIG .cvsignore ext/domxml Tag: ORIG TODO config.m4 domxml.dsp php_domxml.c php_domxml.h ext/domxml/tests Tag: ORIG .cvsignore ext/exif Tag: ORIG exif.c ext/exif/tests Tag: ORIG .cvsignore 001.phpt 003.phpt test3.jpg ext/fbsql Tag: ORIG php_fbsql.c ext/fdf Tag: ORIG fdf.c ext/filepro Tag: ORIG filepro.c ext/ftp Tag: ORIG php_ftp.c ext/gd Tag: ORIG .cvsignore config.m4 gd.c gd.dsp gd_ctx.c php_gd.h ext/gd/libgd Tag: ORIG gd.c gd.h ext/gmp Tag: ORIG config.m4 gmp.c ext/gmp/tests Tag: ORIG .cvsignore ext/hwapi Tag: ORIG config.m4 ext/hyperwave Tag: ORIG hw.c ext/icap Tag: ORIG php_icap.c ext/iconv Tag: ORIG iconv.c ext/iconv/tests Tag: ORIG .cvsignore ext/imap Tag: ORIG config.m4 imap.dsp php_imap.c ext/informix Tag: ORIG Makefile.frag config.m4 ifx.ec php_informix.h ext/interbase Tag: ORIG interbase.c php_interbase.h ext/interbase/tests Tag: ORIG .cvsignore ext/ircg Tag: ORIG ircg.c ext/ldap Tag: ORIG config.m4 ldap.c ext/mbstring Tag: ORIG config.m4 mbfilter.c mbfilter.h mbstring.c ext/mbstring/tests Tag: ORIG .cvsignore ext/mcrypt Tag: ORIG mcrypt.c ext/mcrypt/tests Tag: ORIG .cvsignore ext/mcve/tests Tag: ORIG .cvsignore ext/mime_magic Tag: ORIG TODO mime_magic.c ext/mnogosearch Tag: ORIG README index.php php_mnogo.c php_mnogo.h ext/msession Tag: ORIG msession.c reqclient.h ext/msql Tag: ORIG php_msql.c ext/mssql Tag: ORIG php_mssql.c php_mssql.h ext/mysql Tag: ORIG config.m4 php_mysql.c ext/mysql/libmysql Tag: ORIG charset.c config-win.h ctype.c dbug.c dbug.h default.c dll.c errmsg.c errmsg.h get_password.c global.h libmysql.c list.c m_string.h mf_casecnv.c mf_dirname.c mf_format.c mf_path.c my_compress.c my_create.c my_getwd.c my_init.c my_lib.c my_malloc.c my_open.c my_pthread.c my_pthread.h my_realloc.c my_static.c my_sys.h my_tempnam.c my_thr_init.c my_write.c mysql.h mysql_com.h mysql_version.h mysqld_error.h net.c raid.h strmake.c strto.c strtoll.c strtoull.c thr_alarm.h violite.c ext/ncurses Tag: ORIG config.m4 example1.php ext/ncurses/tests Tag: ORIG .cvsignore ext/odbc Tag: ORIG config.m4 php_odbc.c php_odbc.h ext/openssl Tag: ORIG openssl.c ext/openssl/tests Tag: ORIG .cvsignore ext/overload Tag: ORIG overload.c ext/pcntl Tag: ORIG pcntl.c php_pcntl.h ext/pcntl/tests Tag: ORIG .cvsignore ext/pcre Tag: ORIG php_pcre.c ext/pdf Tag: ORIG config.m4 ext/pgsql Tag: ORIG config.m4 pgsql.c pgsql.dsp ext/pgsql/tests Tag: ORIG .cvsignore ext/posix Tag: ORIG posix.c ext/pspell/tests Tag: ORIG .cvsignore ext/rpc Tag: ORIG handler.h php_rpc.h rpc.c rpc.h rpc_proxy.c ext/rpc/com Tag: ORIG com.c ext/rpc/tests Tag: ORIG test1.php ext/session Tag: ORIG config.m4 mod_files.c mod_mm.c mod_mm.h php_session.h session.c ext/session/tests Tag: ORIG .cvsignore ext/skeleton/tests Tag: ORIG .cvsignore ext/snmp Tag: ORIG config.m4 ext/sockets Tag: ORIG php_sockets_win.c sockets.c ext/standard Tag: ORIG Makefile.frag array.c basic_functions.c credits_ext.h credits_sapi.h datetime.c dir.c exec.c file.c filestat.c formatted_print.c fsock.c head.c html.c image.c info.c link.c mail.c math.c php_filestat.h php_image.h php_rand.h php_smart_str.h rand.c reg.c string.c url_scanner_ex.c url_scanner_ex.re var.c versioning.c ext/standard/tests Tag: ORIG .cvsignore ext/standard/tests/aggregation Tag: ORIG .cvsignore ext/standard/tests/array Tag: ORIG .cvsignore ext/standard/tests/assert Tag: ORIG .cvsignore ext/standard/tests/file Tag: ORIG .cvsignore ext/standard/tests/general_functions Tag: ORIG .cvsignore ext/standard/tests/math Tag: ORIG .cvsignore ext/standard/tests/reg Tag: ORIG .cvsignore ext/standard/tests/serialize Tag: ORIG .cvsignore ext/standard/tests/strings Tag: ORIG .cvsignore ext/standard/tests/time Tag: ORIG .cvsignore ext/standard/tests/versioning Tag: ORIG .cvsignore ext/sysvmsg/tests Tag: ORIG .cvsignore ext/tokenizer Tag: ORIG tokenizer.c ext/xml/tests Tag: ORIG .cvsignore ext/xmlrpc Tag: ORIG xmlrpc-epi-php.c ext/xmlrpc/libxmlrpc Tag: ORIG encodings.c ext/xslt Tag: ORIG php_sablot.h sablot.c ext/xslt/tests Tag: ORIG .cvsignore ext/yaz Tag: ORIG config.m4 php_yaz.c ext/zip Tag: ORIG zip.c ext/zip/tests Tag: ORIG .cvsignore ext/zlib Tag: ORIG zlib.c ext/zlib/tests Tag: ORIG .cvsignore main Tag: ORIG SAPI.c SAPI.h build-defs.h.in config.w32.h.in fopen_wrappers.h main.c memory_streams.c network.c php.h php_compat.h php_globals.h php_ini.c php_network.h php_streams.h rfc1867.c snprintf.c snprintf.h spprintf.c spprintf.h streams.c pear Tag: ORIG Makefile.frag PEAR.php System.php package-Archive_Tar.xml package-Console_Getopt.xml package-PEAR.xml package.dtd pear/Archive Tag: ORIG Tar.php pear/Console Tag: ORIG Getopt.php pear/Date Tag: ORIG Calc.php pear/Net Tag: ORIG SMTP.php pear/PEAR Tag: ORIG Command.php Common.php Config.php Dependency.php Installer.php Registry.php Remote.php pear/PEAR/Command Tag: ORIG Auth.php Common.php Config.php Install.php Package.php Registry.php Remote.php pear/PEAR/Frontend Tag: ORIG CLI.php Gtk.php pear/XML/tests Tag: ORIG .cvsignore pear/scripts Tag: ORIG pear.bat pear.in pear/tests Tag: ORIG .cvsignore pear_config.phpt pear_error4.phpt sapi/aolserver Tag: ORIG aolserver.c sapi/apache Tag: ORIG config.m4 mod_php4.c php_apache.c php_apache_http.h sapi/apache2filter Tag: ORIG README apache_config.c config.m4 php_functions.c sapi_apache2.c sapi/cgi Tag: ORIG cgi_main.c sapi/cli Tag: ORIG config.m4 php_cli.c sapi/nsapi Tag: ORIG nsapi.c sapi/pi3web Tag: ORIG pi3web_sapi.c sapi/tux Tag: ORIG php_tux.c tests Tag: ORIG .cvsignore tests/basic Tag: ORIG .cvsignore tests/classes Tag: ORIG .cvsignore tests/func Tag: ORIG .cvsignore tests/lang Tag: ORIG .cvsignore tests/strings Tag: ORIG .cvsignore win32 Tag: ORIG install.txt php4dll.dsp php4dllts.dsp php4ts.dsw php_modules.dsw sendmail.c sendmail.h time.c time.h Log: Recent cvs.php.net changes Revision Changes Path No revision No revision 1.2.2.5 +3103 -0 php4/ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/php-i18n/php4/ChangeLog,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -u -r1.2.2.4 -r1.2.2.5 --- ChangeLog 19 May 2002 11:16:02 -0000 1.2.2.4 +++ ChangeLog 9 Jul 2002 09:14:29 -0000 1.2.2.5 @@ -1,3 +1,3106 @@ +2002-07-02 Frank M. Kromann <frank****@kroma*****> + + * ext/standard/mail.c: + Add default arguments to new internal mail function. + + * ext/imap/php_imap.c: + Make sure To addresses are parsed correct with RFC822. + + * win32/sendmail.c: Oops. Last commit reverted some of sebastians changes. + +2002-07-02 Marcus B〓rger <marcu****@post*****> + + * ext/exif/exif.c: -fix datatypes for some vriables + -fix comment for function exif_process_CME + -force return parameters to be passed by reference + +2002-07-02 Frank M. Kromann <frank****@kroma*****> + + * win32/sendmail.c + win32/sendmail.h: Switch from imap_sendmail.* to sendmail.c under Win32 + + * ext/fbsql/php_fbsql.c: + Fixing compilation of FrontBase extension with ZTS + +2002-07-02 Sterling Hughes <sterl****@bumbl*****> + + * ext/standard/filestat.c: + use access instead of manually determining file permissions.. + +2002-07-02 Frank M. Kromann <frank****@kroma*****> + + * ext/imap/imap.dsp + ext/imap/php_imap.c: + Switch from imap_sendmail.* to sendmail.c under Win32 + + * win32/imap_sendmail.c + win32/imap_sendmail.h: + These files are no longer needed as the imap module will use the standard sendmail function under Win32 + +2002-07-02 Rui Hirokawa <rui_hirok****@ybb*****> + + * main/rfc1867.c: *** empty log message *** + + * ext/mbstring/mbstring.h: + fixed shift_jis character corruption including 0x5c as second byte on uploaded filename. + + * ext/mbstring/mbstring.c: + fixed shift_jis character corruption including 0x5c as second byte. + +2002-07-02 Derick Rethans <d.ret****@jdime*****> + + * ext/standard/mail.c: + - Be nice to users and allow them to check if the mail was send + + * ext/standard/mail.c: - Disable 5th parameter to mail in safemode + - Disabled the fifth parameter to the mail function in safemode. + +2002-07-02 Christian Dickmann <chris****@gmx*****> + + * pear/PEAR/Command/Remote.php + pear/PEAR/Frontend/CLI.php: + make 'remote-info' use package.info. add deps to 'list-all' + +2002-07-02 Sascha Schumann <sasch****@schum*****> + + * configure.in: Avoid error messages, if the variable is empty. + + ./config.status: test: !=: unary operator expected + +2002-07-02 Derick Rethans <d.ret****@jdime*****> + + * ext/standard/file.c: + - Fix for bug #15547 (Patch by Justin Garrett <usjga****@byu*****>) + +2002-07-01 Marko Karppinen <karpp****@pobox*****> + + * Makefile.global + sapi/cli/config.m4: + - You don't need libtool to build sapi/cli on Darwin. + - We don't need libtool to build sapi/cli on Darwin. + - You want the sapi/cli build line to be in sapi/cli, not Makefile.global. + - We want the sapi/cli build line to be in sapi/cli, not Makefile.global. + - He can go about his business. + - You can go about your business. + - Move along. + - Move along. Move along. + +2002-07-01 Derick Rethans <d.ret****@jdime*****> + + * ext/standard/image.c + ext/standard/info.c + main/memory_streams.c: - No C++ comments + +2002-07-01 Marko Karppinen <karpp****@pobox*****> + + * configure.in: In Darwin we have this thing called two-level namespace + +2002-07-01 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.h + ext/domxml/php_domxml.c: + outcomment everything related to domxml_elem_set_attribute_node(). This + function is not implemented and shouldn't show up at all for the time + being + +2002-07-01 Jani Taskinen <snipe****@iki*****> + + * main/main.c: Fix win32 build. + +2002-07-01 James Cox <james****@blog*****> + + * acinclude.m4: + "-" is not acceptable in a #define (i have since discovered). converting all - to _ is the right thing to do. + + +2002-06-30 Sander Roobol <phy****@wanad*****> + + * main/main.c: + Main script should not be parsed when (include|require)_once()'ed, #17720 + +2002-06-30 Derick Rethans <d.ret****@jdime*****> + + * ext/ldap/ldap.c: - More error messages cleanup + +2002-06-30 Jani Taskinen <snipe****@iki*****> + + * ext/xmlrpc/libxmlrpc/encodings.c: MFH: Fix for bug #16252 + + * ext/xmlrpc/libxmlrpc/encodings.c: Fix bug: #16252 + + * Makefile.global: This does not work with AIX find.. + +2002-06-29 Jani Taskinen <snipe****@iki*****> + + * config.guess + config.sub + ltmain.sh: + - Upgrade bundled libtool to 1.4.2. Following stuff mentioned at: + http://www.gnu.org/software/libtool/news.html + + * Diagnose and warn about not-quite-working combinations of gcc and ld on Solaris. + * Improved OpenBSD support. + * Improved cygwin support. + * Bugfixes. + +2002-06-29 Sascha Schumann <sasch****@schum*****> + + * ext/ircg/ircg.c + ext/standard/php_smart_str.h: + Fix some 8bit issues with IRCG nickname encoding and + Change the underlying interface of smart_str to accept unsigned char. + +2002-06-29 Derick Rethans <d.ret****@jdime*****> + + * ext/exif/exif.c: Unify error messages part 1 + + * ext/gd/gd.c: - Fix GD build with GD 1.8.3 + + * ext/standard/array.c: - Fix for bug #17654 + +2002-06-29 Thies C. Arntzen <thies****@thies*****> + + * ext/standard/url_scanner_ex.c + ext/standard/url_scanner_ex.re: fix leak + +2002-06-29 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/README + ext/mnogosearch/index.php: + Search example (which demonstrates using of mnogosearch API) is updated. + +2002-06-29 James Cox <james****@blog*****> + + * acinclude.m4: fixes extensions with "-" + + +2002-06-29 Jani Taskinen <snipe****@iki*****> + + * ext/xmlrpc/xmlrpc-epi-php.c: + Fix some build error on win32 (snapshot build) + +2002-06-29 James Cox <james****@blog*****> + + * ext/gd/gd_bundled.dsp: make this build too. + + * ext/gd/gd.dsp: removed these files from build. + + * acinclude.m4: really fix it. + + +2002-06-29 Jani Taskinen <snipe****@iki*****> + + * ext/xslt/sablot.c: + This is not done anymore. (should fix win32 snapshot build too) + +2002-06-29 James Cox <james****@blog*****> + + * acinclude.m4: fixes bug #17453 + +2002-06-29 Jani Taskinen <snipe****@iki*****> + + * ext/pdf/config.m4: + - Fix the shared problem. (the previous patch really didn't fix anything) + + * build/rules.mk: Removing libs/ is not a good idea + + * ext/db/db.c + ext/db/php_db.h: Missing TSRMLS_* stuff + + * sapi/apache2filter/config.m4: Better fix it here too.. + +2002-06-29 Rasmus Lerdorf <rasmu****@lerdo*****> + + * sapi/apache/config.m4: Oops, extra pipe snuck in + +2002-06-28 Rasmus Lerdorf <rasmu****@lerdo*****> + + * sapi/apache/config.m4: Fix for bug #18055 + +2002-06-28 Anil Madhavapeddy <anil****@recoi*****> + + * ext/pdf/config.m4: + remember the value of ext_shared passed into the --with-pdflib, since it + gets overwritten by future PHP_ARG_WITH checks in the same m4 fragment + + from wilfr****@openb***** + +2002-06-28 Sebastian Bergmann <sb****@sebas*****> + + * sapi/apache2filter/README: Mention Apache 2.0.40. + +2002-06-28 Derick Rethans <d.ret****@jdime*****> + + * ext/db/db.c: - More gotchas... + + * ext/msession/msession.c: - Fix more TSRM gotchas + +2002-06-28 Jani Taskinen <snipe****@iki*****> + + * sapi/apache2filter/config.m4: Require 2.0.40 + +2002-06-28 Derick Rethans <d.ret****@jdime*****> + + * sapi/apache2filter/sapi_apache2.c: - YAAC: I hope this is the last one! + + * ext/imap/php_imap.c: - Fix TSRM gotcha + +2002-06-28 Jani Taskinen <snipe****@iki*****> + + * ext/gd/gd.c: t1lib.h needs to be included here now. + + * ext/gd/gd.c + ext/gd/php_gd.h: Moved all gd.h related stuff to gd.c + + * ext/gd/php_gd.h: Remove unnecessary #include's + + * ext/gd/gdt1.c + ext/gd/gdt1.h + ext/gd/config.m4: Remove unused files. + +2002-06-28 Derick Rethans <d.ret****@jdime*****> + + * ext/hyperwave/hw.c + ext/icap/php_icap.c + ext/imap/php_imap.c: Unify error messages + +2002-06-28 Jani Taskinen <snipe****@iki*****> + + * ext/gd/gd.c: Fix bug: #14735 + + * ext/gd/gd.c: Fix bug: #17528, do not crash with empty string. + + * sapi/apache2filter/config.m4: Fixed bug: #17491 (honor INSTALL_ROOT) + + * ext/mysql/libmysql/mysql_version.h: - Fix annoying redefine warning.. + + * ext/gd/config.m4: - Fix bug: #17671 + +2002-06-28 Derick Rethans <d.ret****@jdime*****> + + * ext/iconv/iconv.c: - Fix for bug #18039 + + * ext/gd/gd.c + ext/gd/gd_ctx.c + ext/gd/gdt1.c: Unify error messages + +2002-06-28 Jani Taskinen <snipe****@iki*****> + + * ext/session/config.m4 + ext/session/mod_mm.c + ext/session/mod_mm.h + ext/session/session.c: + - Fixed bug: #17977, session build as shared works now with mm handler too. + - Added listing of save handlers into phpinfo() output + +2002-06-27 Jani Taskinen <snipe****@iki*****> + + * Makefile.global: Fix bug: #18008 + + * ext/gd/gd.c: Consistency fix. + + * ext/imap/php_imap.c: - Fixed bug: #15595 (and possibly others too) + +2002-06-27 Sander Roobol <phy****@wanad*****> + + * ext/standard/Makefile.frag: + Update configure line in phpinfo() after re-running configure without + running make clean first, bug #18012. + +2002-06-27 Derick Rethans <d.ret****@jdime*****> + + * ext/filepro/filepro.c + ext/ftp/php_ftp.c + ext/fdf/fdf.c + ext/fbsql/php_fbsql.c: Unify error messages + + * ext/ldap/ldap.c: - Remove \n + +2002-06-27 Jani Taskinen <snipe****@iki*****> + + * ext/imap/php_imap.c: - Cleaning up the mess..these are NOT zvals. + +2002-06-26 Jani Taskinen <snipe****@iki*****> + + * ext/imap/php_imap.c: MFH: fix for bug: #17999 + + * ext/imap/php_imap.c: - Fixed bug: #17999 + - The errors should always be stored, but they are not supposed to be + shown at request shutdown unless E_NOTICES are allowed. + +2002-06-26 Anil Madhavapeddy <anil****@recoi*****> + + * ext/ncurses/config.m4: + use LIBNAME consistently. Useful on systems like OpenBSD where the curses + library is called 'curses' and not 'ncurses' + + * ext/ncurses/example1.php: + the ncurses_getch() is in the wrong place and never gets run + +2002-06-26 Jani Taskinen <snipe****@iki*****> + + * ext/odbc/config.m4: Better not pollute the EXTRA_LIBS with libpaths. + +2002-06-26 Marcus B〓rger <marcu****@post*****> + + * main/spprintf.c: -xbuf_resize does not need to have return value + +2002-06-26 Derick Rethans <d.ret****@jdime*****> + + * main/main.c + main/php_globals.h + php.ini-dist + php.ini-recommended: + - Implement Andrei's request for disabling memory leak reporting in debug + builds. + + * ext/standard/credits_sapi.h: - And the SAPI too + + * ext/standard/credits_ext.h: - Update credits + + * ext/mime_magic/TODO: - Update TODO + + * ext/mime_magic/mime_magic.c: - Nuke some TSRMLS_FETCHes + +2002-06-26 Jani Taskinen <snipe****@iki*****> + + * build/buildcheck.sh: silence the warning when glibtool is not found.. + +2002-06-26 Derick Rethans <d.ret****@jdime*****> + + * ext/gd/gd.c: - Fix build + + * Makefile.global: + - Let make clean follow symlinks (tested on Linux, IRIX, Solaris, FreeBSD + and Tru64) + + * ext/pgsql/config.m4: - Fix typo + + * ext/mcrypt/mcrypt.c: - Unify error messages + + * ext/mnogosearch/php_mnogo.c + ext/msession/msession.c: Unify error messages + +2002-06-26 Sascha Schumann <sasch****@schum*****> + + * build/buildcheck.sh: + Prefer glibtool over libtool for Mac OS X compatibility + + Submitted by: various people, including blake****@mac***** + +2002-06-26 Derick Rethans <d.ret****@jdime*****> + + * ext/msql/php_msql.c + ext/mssql/php_mssql.c + ext/mysql/php_mysql.c: Unify error messages + +2002-06-26 Sascha Schumann <sasch****@schum*****> + + * ext/interbase/interbase.c + sapi/aolserver/aolserver.c: + Fix code which makes wrong assumptions about the return value of snprintf. + + The AOLserver module did not use the return value, so simply drop it. + +2002-06-26 Derick Rethans <d.ret****@jdime*****> + + * ext/domxml/php_domxml.c + ext/dba/dba.c + ext/db/db.c: Unify error messages + +2002-06-26 Andi Gutmans <andi****@zend*****> + + * ext/standard/var.c: - No idea why this wasn't crashing before. + +2002-06-26 Derick Rethans <d.ret****@jdime*****> + + * ext/cyrus/cyrus.c + ext/cybercash/cybercash.c + ext/curl/curl.c + ext/cpdf/cpdf.c + ext/com/COM.c + ext/ccvs/ccvs.c + ext/calendar/easter.c + ext/bcmath/bcmath.c + ext/aspell/aspell.c: Unify error messages + + * ext/ldap/ldap.c: - Unify error messages + +2002-06-25 Marcus B〓rger <marcu****@post*****> + + * ext/gd/gd.c: map imageellipse to imagearc if missing + fix warnings + + * ext/standard/image.c: bits/channels for gif + +2002-06-25 Tomas V.V.Cox <cox****@idecn*****> + + * pear/scripts/pear.in: + change the include_path setting to be in the php space instead + of doing in the interpreter line (seems to break FreeBSD) + +2002-06-25 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.c: should compile on windows again + + * ext/domxml/php_domxml.h: include libxml/parserInternals.h + +2002-06-25 Marcus B〓rger <marcu****@post*****> + + * ext/gd/gd.c + ext/gd/config.m4: imageellipse is removed in 2.01 + +2002-06-25 Derick Rethans <d.ret****@jdime*****> + + * NEWS: - Update NEWS + +2002-06-25 Markus Fischer <mfisc****@guru*****> + + * ext/sockets/sockets.c: - Fix proto. + +2002-06-24 Jani Taskinen <snipe****@iki*****> + + * NEWS: Minor cleanup. + +2002-06-24 Marcus B〓rger <marcu****@post*****> + + * ext/exif/tests/003.phpt + ext/exif/tests/test3.jpg: modified test3 (old one had a warning) + + * ext/standard/image.c: missing return value + + * NEWS: cleanup + + * ext/exif/exif.c + ext/standard/image.c + ext/standard/php_image.h + ext/standard/basic_functions.c: + register IMAGETYPE_<xxx> constants in image.c as they are needed + there. + +2002-06-24 Derick Rethans <d.ret****@jdime*****> + + * ext/gd/config.m4 + ext/gd/gd.c: + - Make functions not exist when they are not available. This means you can + now safely do function_exists() on all gd functions. + +2002-06-24 Marko Karppinen <karpp****@pobox*****> + + * ext/xslt/php_sablot.h + ext/xslt/sablot.c: Revert to php_4_2_1 to get sablotron working again. + +2002-06-24 Marcus B〓rger <marcu****@post*****> + + * ext/exif/exif.c + ext/standard/image.c + ext/standard/php_image.h: + GetImageSize now allways set fields unknown to 0 and new Imagetype + iff. + +2002-06-24 Christian Stocker <chreg****@phant*****> + + * ext/domxml/TODO: added some points to the todo list + +2002-06-24 Rasmus Lerdorf <rasmu****@lerdo*****> + + * sapi/apache2filter/sapi_apache2.c: + Add runtime Apache2 thread check to ensure we don't run a non-threaded + PHP inside a threaded Apache2 MPM. + +2002-06-24 Martin Jansen <mail****@marti*****> + + * pear/PEAR/Command/Remote.php: * Rephrase help text. + +2002-06-24 Rasmus Lerdorf <rasmu****@lerdo*****> + + * sapi/apache2filter/config.m4 + sapi/apache2filter/sapi_apache2.c: + Turn off ZTS if Apache2 is using the prefork MPM. + +2002-06-24 Jani Taskinen <snipe****@iki*****> + + * configure.in: + - gethostname() is found in glibc (at least on Linux) and the yp_* funcs + are in libnsl. Fixes bug: #17941 + + * NEWS: ..unless someone adds all the missing ones.. :) + + * ext/mcal/config.m4: Fix the shared build properly. + + * acinclude.m4: + Fixed PHP_ADD_LIBRARY_DEFER_WITH_PATH to work with shared builds. + +2002-06-24 Edin Kadribasic <edink****@prove*****> + + * sapi/apache2filter/CREDITS + sapi/apache2filter/README + sapi/apache2filter/apache_config.c + sapi/apache2filter/php_apache.h + sapi/apache2filter/php_functions.c + sapi/apache2filter/sapi_apache2.c: MFH + +2002-06-24 Jani Taskinen <snipe****@iki*****> + + * ext/ldap/config.m4: No need to have multiple AC_CHECK_FUNCS calls + +2002-06-24 Derick Rethans <d.ret****@jdime*****> + + * Makefile.in: + - Fix make install to respect the prefix= argument (patch by Troels Arvin + <troel****@arvin*****>) + + * ext/mcal/config.m4: + - Fix building a shared extension (patch by Troels Arvin <troel****@arvin*****>) + + * ext/sysvsem/php_sysvsem.h + ext/sysvsem/sysvsem.c + ext/standard/versioning.c: - MFH + +2002-06-24 Edin Kadribasic <edink****@prove*****> + + * win32/time.c + win32/time.h: MFH + +2002-06-24 Derick Rethans <d.ret****@jdime*****> + + * ext/standard/string.c: - MFH + + * ext/standard/math.c: - Fix the MFH :) + + * ext/standard/basic_functions.c: - MFH + + * ext/mcrypt/mcrypt.c: - Partly MFH + + * ext/standard/math.c + ext/gmp/config.m4: - MFH + +2002-06-24 Sascha Schumann <sasch****@schum*****> + + * buildconf: iterate through passed arguments + +2002-06-23 Edin Kadribasic <edink****@prove*****> + + * win32/time.c + win32/time.h: + Allow dynamically compiled extensions to use gettimeofday() on win32. + +2002-06-23 Sterling Hughes <sterl****@bumbl*****> + + * ext/imap/php_imap.c: standardize a bit (we know its enabled :) + +2002-06-23 Derick Rethans <d.ret****@jdime*****> + + * sapi/apache2filter/php_functions.c: - MFH + +2002-06-23 Marcus B〓rger <marcu****@post*****> + + * main/snprintf.h: + explain difference between sprintf, snprintf and spprintf + + * main/spprintf.h: + * main/spprintf.c: -freeing memory for pbuf=NULL + + * main/spprintf.c: -allow pbuf = NULL in case of NO MEMORY, too + + * main/spprintf.c: -allways terminate buffer + -allow pbuf parameter to be NULL for buffer size calculation + +2002-06-23 Stefan Esser <s.ess****@e-mat*****> + + * main/rfc1867.c: MFH: several fixes to fileupload code + + * ext/standard/mail.c: merged in the filtering control chars patch + + * ext/standard/link.c: MFH: link/symlink safe_mode/open_base_dir fix + + * main/SAPI.c: MFH: replace header fix, content-type header handling fix + +2002-06-23 James Cox <james****@blog*****> + + * buildconf: + some people would prefer to be able to specify. So, we specify --ZendEngine2 for ZE2 builds, Zend for the rest. + + * build/build.mk + buildconf: + changing this to mv ZendEngine2 Zend instead of shell logic that isn't portable. + +2002-06-23 Marcus B〓rger <marcu****@post*****> + + * main/main.c: -unlimited php_printf + + * ext/exif/exif.c + ext/standard/basic_functions.c + ext/standard/image.c + ext/standard/php_image.h: + -imagetype2mimetype renamed to image_type_to_mime_type + + * ext/exif/tests/004.phpt + ext/exif/tests/test4.jpg: -new test for WinXP tags + + * ext/exif/tests/003.phpt: -fix test results + + * run-tests.php: -make it run again + + * main/snprintf.c: -compiler warning (missing data type) + + * ext/exif/tests/001.phpt: -corrected test result + +2002-06-22 Marcus B〓rger <marcu****@post*****> + + * ext/exif/exif.c + ext/standard/php_image.h: -exif version + -missing constant (and notice) + -corrected error messages + + * ext/exif/exif.c: + exif_read_data returns mime-type now for image and thumbnail And exif_thumbnail now optionally returns imagetype. + + * ext/standard/basic_functions.c + ext/standard/image.c + ext/standard/php_image.h: + GetImageSize now returns additional index 'MimeType' and new function + imagetype2mimetype to convert php imagetypes to mime-types. + + * ext/standard/image.c: ws fix + +2002-06-22 Stig Venaas <venaa****@unine*****> + + * ext/ldap/ldap.c: + Better not include ldap_parse_result() and ldap_start_tls() at all in + the symbol table when they are not usable. Makes it possible to check + on their usability. + +2002-06-22 Sander Roobol <phy****@wanad*****> + + * sapi/apache2filter/apache_config.c: + Made php_admin_value work outside <location> and <directory> blocks. + +2002-06-22 Andi Gutmans <andi****@zend*****> + + * sapi/cgi/cgi_main.c: - Revert WS changes + + * sapi/cgi/cgi_main.c: - This shouldn't have snuck in. + + * sapi/cgi/cgi_main.c: - Stop using persist_alloc(). + +2002-06-22 Stig Venaas <venaa****@unine*****> + + * ext/ldap/config.m4 + ext/ldap/ldap.c: Added test for ldap_start_tls_s() + +2002-06-22 Den V. Tsopa <tdv****@ediso*****> + + * ext/mbstring/mbfilter.c: small fix in preprocessor directive + +2002-06-21 Markus Fischer <mfisc****@guru*****> + + * ext/ldap/ldap.c: - Fix ZTS build, see #17915. + +2002-06-21 Stefan Esser <s.ess****@e-mat*****> + + * sapi/apache2filter/sapi_apache2.c + sapi/nsapi/nsapi.c + sapi/apache/mod_php4.c: Fixing the same possible memory leak. + +2002-06-21 Edin Kadribasic <edink****@prove*****> + + * main/config.w32.h.in: Made pgsql compile on win32 again. + All defines regarding libpq capabilities are kept in ext/pgsql/pgsql.dsp + where HAVE_PQESCAPE is already defined. + +2002-06-21 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Remote.php: * typo + +2002-06-21 Harald Radi <haral****@nme*****> + + * ext/com/COM.c: + removed CONST_EFREE_PERSISTENT so that andi can commit his patch + + +2002-06-21 Derick Rethans <d.ret****@jdime*****> + + * main/SAPI.c + main/SAPI.h + sapi/pi3web/pi3web_sapi.c + sapi/tux/php_tux.c + ext/standard/head.c: + - Added a new parameter to the header() function which overrides the HTTP + response code. + - Added a new parameter to the header() function which overrides the HTTP + response code. + +2002-06-21 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Config.php: * bending over backwards to find sensible defaults + +2002-06-21 Jani Taskinen <snipe****@iki*****> + + * ext/gmp/config.m4: Make this extension compile as shared extension too. + +2002-06-20 Sander Roobol <phy****@wanad*****> + + * ext/mime_magic/mime_magic.c: ZTS fixes + +2002-06-20 James Cox <james****@blog*****> + + * build/build.mk: oops.. + + * build/build.mk: make "make snapshot" work again.. + + * build/build.mk: fixing to permit builds with ZE2 + +2002-06-20 Uwe Steinmann <Uwe.S****@fernu*****> + + * ext/domxml/php_domxml.c: + - take version of libxslt and libxml from runtime variables to make + sure the reported versions correspond to the actually installed + versions of libxml and libxslt + +2002-06-20 Yasuo Ohgaki <yohga****@ohgak*****> + + * NEWS: Added missing NEWS entry for a bug fix. + +2002-06-19 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Frontend/CLI.php + pear/PEAR/Command/Remote.php + pear/PEAR/Command/Registry.php + pear/PEAR/Command/Install.php + pear/PEAR/Registry.php + pear/PEAR/Config.php + pear/PEAR/Dependency.php + pear/PEAR/Installer.php + pear/PEAR/Common.php: + - Force params to version_compare() to be strings, otherwise some + comparations will fail (ex. 0.9 will be equal to 0.90) + - Other minor cleanup's + + * pear/PEAR/Installer.php: + Do NOT allow install packages with errors in its description file + +2002-06-19 Marcus B〓rger <marcu****@post*****> + + * ext/mbstring/mbstring.c: + correct handling/generating of php_mbstr_default_identify_list + +2002-06-19 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.c: - Make domxml_xslt_process() working again. + +2002-06-19 Sander Roobol <phy****@wanad*****> + + * ext/standard/info.c: Made the API versions appear better on phpinfo(); + +2002-06-19 Alan Knowles <alan****@akbkh*****> + + * pear/Date/Calc.php: + Fixed Undefined index: 06 in ..... - commit to correct branch + + * pear/Date/Calc.php: Fixed Undefined index: 06 in ..... + +2002-06-19 Jani Taskinen <snipe****@iki*****> + + * ext/gd/config.m4: Fix bug: #17130 + +2002-06-19 Edin Kadribasic <edink****@prove*****> + + * main/streams.c: No need to check for allow_url_fopen here. + +2002-06-19 Jani Taskinen <snipe****@iki*****> + + * main/main.c: Use correct macro for boolean ini values. + +2002-06-18 Stig Venaas <venaa****@unine*****> + + * ext/standard/array.c: + Made array_unique() always keep the first occurrences of duplicates, + making the behavior easier to understand, and maybe more useful. + +2002-06-18 Andi Gutmans <andi****@zend*****> + + * ext/bcmath/bcmath.c + ext/bcmath/php_bcmath.h: + - Nuke use of persist_alloc(). This can't be used with a new memory manager + +2002-06-18 Stefan Esser <s.ess****@e-mat*****> + + * main/SAPI.c: + fix: appending the default charset to text/ content types never worked + fix: removed double free + +2002-06-18 Jan Lehnardt <jan****@dasmo*****> + + * ext/standard/array.c: - WS-fixes + +2002-06-18 Stefan Esser <s.ess****@e-mat*****> + + * main/SAPI.c: keep fingers away from already freed memory. + +2002-06-18 Hartmut Holzgraefe <hartm****@six*****> + + * ext/standard/file.c: + - fixed bug in enclosure handling (was still hardcoded to '"' in one place) + - added possibility to pass empty enclosure if you really don't want one + +2002-06-18 Sander Roobol <phy****@wanad*****> + + * ext/standard/string.c + ext/standard/tests/strings/add-and-stripslashes.phpt: + Fixed stripslashes when magic_quotes_sybase is enabled, and add a test for + add- and stripslashes(). + + * ext/standard/tests/strings/add-and-stripslashes.phpt: + Fix stripslashes when magic_quotes_sybase is enabled, and add a test for + add- and stripslashes(). + +2002-06-18 Derick Rethans <d.ret****@jdime*****> + + * ext/standard/var.c: - Fix for bug #16065 + +2002-06-18 Sander Roobol <phy****@wanad*****> + + * main/SAPI.c: + Patch by Michael Sisolak <msiso****@yahoo*****> to make header() honor the + replace parameter. Closes #16458. + +2002-06-18 Derick Rethans <d.ret****@jdime*****> + + * ext/zlib/zlib.c: - oops... read before commit :) + + * ext/zlib/zlib.c: + - It doesn't work from within a script... so we disallow it + +2002-06-18 Tomas V.V.Cox <cox****@idecn*****> + + * pear/package-PEAR.xml: "Release notes"++ + +2002-06-18 Markus Fischer <mfisc****@guru*****> + + * ext/dbx/dbx_sybasect.c: - User proper macros as suggested by Marc. + + * ext/domxml/php_domxml.c: - Fix ZTS build. + +2002-06-18 Jani Taskinen <snipe****@iki*****> + + * ext/mbstring/mbstring.c: Fixed bug: #17137, test pass still + +2002-06-18 Edin Kadribasic <edink****@prove*****> + + * ext/standard/math.c: ZTS fix. + + * ext/standard/math.c: + Check for +/- infinity in base_convert (bug #14807). + +2002-06-17 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/php_mnogo.c: +2002-06-17 Andrei Zmievski <andre****@php*****> + + * NEWS: Fix. + + * NEWS: *** empty log message *** + + * ext/standard/reg.c: MFH + + * ext/standard/reg.c: Applied fix for #17764. + +2002-06-17 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR.php: + Dropped case insentive ext search in PEAR::loadExtension() + + * pear/PEAR.php: Typo in the folding mark + +2002-06-17 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Config.php: + * php-4.2.1-installer.exe for Windows is installed in c:\php by + default, but it has PHP_SYSCONFDIR set to c:\php4. workaround. + +2002-06-17 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Dependency.php: + Use the new PEAR::loadExtension() in checkExtension() instead + of the "hack" + + * pear/PEAR.php: + Added PEAR::loadExtension($ext) - OS independant PHP extension load + + + * pear/PEAR.php: trailing ws + +2002-06-17 Hartmut Holzgraefe <hartm****@six*****> + + * ext/standard/formatted_print.c: + making printf/sprintf locale-aware without external dependencies + + * ext/standard/string.c: + fixed return types for ucwords/ucfirst when passed an empty string + +2002-06-17 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Remote.php: * doh + +2002-06-17 Alan Knowles <alan****@akbkh*****> + + * pear/PEAR/Common.php: Fixing for the coding standard :) + +2002-06-17 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Remote.php: + * add xmlrpc request to debug output (verbosity level 4+) + +2002-06-17 Alan Knowles <alan****@akbkh*****> + + * pear/PEAR/Common.php: + Added Dependancy check on XML - previously pear installer failed silently + +2002-06-17 Jani Taskinen <snipe****@iki*****> + + * ext/dbase/dbase.c: + - Made dbase_get_record() and dbase_get_record_with_names use same backend + function as they both do same thing, just the output is different. + + Fixes also bug #17762 as side effect. + +2002-06-16 Stefan Esser <s.ess****@e-mat*****> + + * ext/standard/link.c: Fixed Bug #17790 + + - link and symlink now check uid and open_base_dir for link and its target + +2002-06-16 Hartmut Holzgraefe <hartm****@six*****> + + * ext/standard/formatted_print.c: + reverted patch depending on not yet commited work + +2002-06-16 Derick Rethans <d.ret****@jdime*****> + + * ext/mcrypt/mcrypt.c: - Fix version in phpinfo(); + +2002-06-16 Andi Gutmans <andi****@zend*****> + + * configure.in: - Add zend_mm.c + +2002-06-16 Tomas V.V.Cox <cox****@idecn*****> + + * pear/package-PEAR.xml: + Install the pear command under the bin_dir setting intead of the fixed + PHP_BINDIR + +2002-06-16 Hartmut Holzgraefe <hartm****@six*****> + + * ext/standard/formatted_print.c: make sprinf() locale-aware (Bug# 12647) + +2002-06-16 Sander Roobol <phy****@wanad*****> + + * run-tests.php + tests/php.ini: + Made the tests (and not only run-tests.php) actually use php.ini-dist, and + removed unused php.ini file. + +2002-06-16 Markus Fischer <mfisc****@guru*****> + + * php.ini-recommended + php.ini-dist: - List new session.use_only_cookies option. + +2002-06-16 Stig Bakken <ssb****@fast*****> + + * pear/scripts/pear.in + pear/package-PEAR.xml: * set include_path when running "pear" + +2002-06-16 Jani Taskinen <snipe****@iki*****> + + * ext/xmlrpc/xmlrpc-epi-php.c: Fixed bug: #17732. + + xmlrpc_decode_request() and xmlrpc_set_type() expect some parameters to be + passed by reference. + +2002-06-15 Markus Fischer <mfisc****@guru*****> + + * ext/gd/gd.c: - Be more verbose which index causes the warning. + + * ext/gd/gd.c: - Don't forget to close the stream. + +2002-06-15 Harald Radi <haral****@nme*****> + + * ext/sockets/php_sockets_win.c + ext/sockets/sockets.c: workaround for a win32 memleak + +2002-06-15 Sebastian Bergmann <sb****@sebas*****> + + * ext/gd/.cvsignore: Add new target directories. + +2002-06-14 Markus Fischer <mfisc****@guru*****> + + * NEWS: - Update Win32/mail changes, mention bundled gd library. + +2002-06-14 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Installer.php: + - Fix issue with the DIRECTORY_SEPARATOR, did make the install of + XML_image2svg fail + - TODO++ and others minor stuff + +2002-06-14 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Remote.php: + * if verbosity config is > 3, display xmlrpc response + * another bugfix + +2002-06-14 Andrei Zmievski <andre****@php*****> + + * NEWS: Fix. + +2002-06-14 Sebastian Bergmann <sb****@sebas*****> + + * ext/gd/gd_bundled.dsp + win32/php_modules.dsw: Add gd_bundled to php_modules.dsw. + +2002-06-14 Alan Knowles <alan****@akbkh*****> + + * pear/PEAR/Command/Remote.php: + remote list and remote listall, can now list non-stable packages if you set prefered_state to something else + + * pear/PEAR/Remote.php: + Fixed XML RPC sending of args - lets try and get the right tag :) + + * pear/PEAR/Remote.php: Fixed XML RPC sending of args + +2002-06-14 Edin Kadribasic <edink****@prove*****> + + * ext/gd/libgd/gd.h: Use some more sane paths for win32 version. + +2002-06-14 Markus Fischer <mfisc****@guru*****> + + * ext/gd/gd_bundled.dsp: + - Remove freetype.lib and HAVE_LIBTTF; we're always linking against freetype2 + anyway. + +2002-06-14 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.c + ext/domxml/php_domxml.h: + - renamed domxml_parser_reference to domxml_parser_entitiy_reference + - renamed domxml_cdata_block to domxml_parser_cdata_section + (more consistent with the domxml_create_XXX methods) + - added domxml_parser_processing_instruction(target,data) + - added domxml_parser_namespace_decl(href,prefix) + + * ext/domxml/php_domxml.c + ext/domxml/php_domxml.h: - oops, that didn't even compile + - added domxml_parser_reference(reference) + + * ext/domxml/php_domxml.h + ext/domxml/php_domxml.c: + - Added preliminary SAX-Input support. It's now possible to build a DomDocument + with SAX-Events (added domxml_parser_start_document(), domxml_parser_end_document(), + domxml_parser_start_element(tagname[,attributes]), domxml_parser_end_element(tagname), + domxml_parser_characters(characters), domxml_parser_cdata_block(cdata), + domxml_parser_comment(comment), domxml_parser_get_document(). (chregu) + +2002-06-14 Sebastian Bergmann <sb****@sebas*****> + + * ext/standard/datetime.c + win32/sendmail.c: Remove unused local variables. + +2002-06-14 Jani Taskinen <snipe****@iki*****> + + * ext/odbc/php_odbc_includes.h + ext/odbc/php_odbc.h + ext/odbc/config.m4 + ext/odbc/php_odbc.c: + - Fixed bug #15803 (and propably others related too, part 2/2) + . Changed the configure/compile so that it doesn't "pollute" the INCLUDES + anymore and thus cause trouble with other extensions which + might use the same header files. (e.g. Informix) + . Separated the #include statements to own file so we don't get any + errors when compiling main/internal_functions.c + + * ext/informix/php_informix_includes.h + ext/informix/stub.c + ext/informix/php_informix.h + ext/informix/config.m4 + ext/informix/ifx.ec + ext/informix/Makefile.frag: + - Fixed bug #15803 (and propably others related too) + . Changed the compile so that it doesn't "pollute" the INCLUDES + anymore and thus cause trouble with other extensions which + might use the same header files. (e.g. ODBC) + . Some fixes for Informix compile problems (with the new build system) + . Removed unnecessary stub.c file. + +2002-06-13 Markus Fischer <mfisc****@guru*****> + + * ext/gd/gd_bundled.dsp: + - Initial MSVC makefile to create a php_gd2.dll based on the bundled libgd, + works out of the box here with the right image libs and headers. + + * win32/sendmail.c: + - We don't need the check here because the regex makes sure we never have \r\n + at the end of the header. + +2002-06-13 Jani Taskinen <snipe****@iki*****> + + * sapi/apache/mod_php4.c: + Fixes bugs: #16653, #14534, #14370 + +2002-06-13 Pierre-Alain Joye <pajoy****@phpin*****> + + * pear/Date/Calc.php: + Fix isValid method : wrong order for the params to checkdate() + +2002-06-13 Stefan Esser <s.ess****@e-mat*****> + + * win32/sendmail.c: Typo: == instead of = + + * win32/sendmail.c: - should fix bug#17753 + +2002-06-13 Jani Taskinen <snipe****@iki*****> + + * ext/openssl/openssl.c: Fixed bug: #17751 (typo) + +2002-06-13 Stefan Esser <s.ess****@e-mat*****> + + * ext/standard/mail.c: + Fixed: possible bufferunderrun (worst case == invalid free bytes counter) + + Fixed: isXXXX macros need (unsigned char) cast + + Fixed: bug#17746 - control chars are now filtered within "to" and "subject" parameters + +2002-06-13 Andrei Zmievski <andre****@php*****> + + * ext/bz2/bz2.c: Typo. + +2002-06-13 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Registry.php: Change a little the dep db structure + Comment the code and some clean up's + +2002-06-13 Andrei Zmievski <andre****@php*****> + + * ext/bz2/bz2.c: Fix #17650. + +2002-06-13 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Registry.php: + More work on the dependencies DB (still not tested/used) + +2002-06-13 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.h + ext/domxml/php_domxml.c: + - Added DOMXML_LOAD_DONT_KEEP_BLANKS as possible mode, if one wants really nicely + formatted XML-Documents (but this can have sideeffects, if you depend on whitespaces..) + - bumped up domxml-api-version number. + + * ext/domxml/php_domxml.c + ext/domxml/php_domxml.h: + - Added better error-messages (3rd parameter) and validating of DTDs (2nd parameter) to + domxml_open_mem(string xml[, int mode[, array errors]]) and domxml_open_file(string filename[, int mode[, array errors]]). + - Added domxml_doc_validate([array errors]) for validating existing DomDocuments with a DTD. + +2002-06-13 Edin Kadribasic <edink****@prove*****> + + * sapi/cli/php_cli.c: MFH (fix for #17733) + + * sapi/cli/php_cli.c: Fix exit code (bug #17733). + +2002-06-13 Derick Rethans <d.ret****@jdime*****> + + * ext/imap/php_imap.c: + - Fix for bug #14410 (Patch by C. McCohy <mccoh****@kyber*****>). + +2002-06-13 Jani Taskinen <snipe****@iki*****> + + * ext/pcre/php_pcre.c: Fix build in ZTS mode + +2002-06-12 Jason Greene <jason****@inetg*****> + + * NEWS: Fix entry + +2002-06-12 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Common.php: * comment typos + + * pear/package-PEAR.xml: * set working version to 0.91-dev + + * pear/Makefile.frag: * minor cleanup + + * LICENSE: * this should have been done last year :) + +2002-06-12 Andrei Zmievski <andre****@php*****> + + * ext/pcre/php_pcre.c + NEWS: + This patch adds ability to capture string offsets in the preg_match_*() + results. + +2002-06-12 Jani Taskinen <snipe****@iki*****> + + * NEWS: typofix + + * ext/standard/basic_functions.c: + - Fixed bug #17669. PG(magic_quotes_runtime) wasn't reset for each request. + + * NEWS: cleanup + +2002-06-12 Andrei Zmievski <andre****@php*****> + + * NEWS: + set_error_handler() should take methods as callbacks. Also fixed it to report + invalid callbacks. + + * ext/overload/overload.c + NEWS: Properly return the result of __call() handler. + +2002-06-12 Tomas V.V.Cox <cox****@idecn*****> + + * pear/scripts/pear.bat: + Attempt to make pear.bat work better under Windows + +2002-06-12 Hartmut Holzgraefe <hartm****@six*****> + + * ext/standard/datetime.c + ext/standard/tests/time/003.phpt: + fix for bug #10616 -> mktime() with negative date offsets not working on MacOSX + +2002-06-12 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.c: MFH (fixed domxml_get_element_by_id() ) + + * ext/domxml/php_domxml.c: Fixed domxml_get_element_by_id() + +2002-06-12 Sascha Schumann <sasch****@schum*****> + + * ext/session/session.c + ext/session/php_session.h: + This option enables administrators to make their users invulnerable to + attacks which involve passing session ids in URLs. + +2002-06-12 Markus Fischer <mfisc****@guru*****> + + * ext/bz2/bz2.c: - MFH fixes. + +2002-06-11 Markus Fischer <mfisc****@guru*****> + + * ext/domxml/TODO: - Those have been implemented already. + + * main/streams.c: - Fix builtin gets() emulation (hopefully). + + * ext/bz2/bz2.c: + - Fix bzcompress(), remove leaks and add some sanity check on emalloc()s. + + * TODO: - Add some recent observations with bz2. + + * main/streams.c: - Add missing Id tag. + + * main/streams.c: + - Always \0 terminate data returned from _php_stream_copy_to_mem(). + +2002-06-11 Pierre-Alain Joye <pajoy****@phpin*****> + + * pear/Date/Calc.php: Add comment to ::isLeapYear() + Remove useless comment added during the last commit + + * pear/Date/Calc.php: + Remove regexp and months checks and use the native php function checkdate() + Keep year check, only 4 digits allowed + +2002-06-11 Jason Greene <jason****@inetg*****> + + * TODO: Forgot one + + * TODO: Sockets currently works great with all compilers on Solaris + Update TODO + +2002-06-11 Hartmut Holzgraefe <hartm****@six*****> + + * ext/mime_magic/TODO + ext/mime_magic/mime_magic.c: + now it works on streams (plus some debug code removed) + + * main/php_streams.h: + macro definition fixed, guess it was the usual kind of cut&past bug? + +2002-06-11 Edin Kadribasic <edink****@prove*****> + + * sapi/cli/config.m4 + configure.in: + Disable installing pear when --disable-cli is used since pear installer + needs cli to function. + +2002-06-11 Markus Fischer <mfisc****@guru*****> + + * TODO: - These things have been done already. + +2002-06-11 Jason Greene <jason****@inetg*****> + + * ext/standard/fsock.c + main/network.c + main/php_network.h: Also fixed error handling on unix (micropatch) + + Closes Bug #14740 + +2002-06-11 Jani Taskinen <snipe****@iki*****> + + * ext/mysql/config.m4 + NEWS: - Reverted last bogus commit and fixed the credits in NEWS. + + +2002-06-10 Markus Fischer <mfisc****@guru*****> + + * ext/pcre/php_pcre.c: - Typo. + +2002-06-10 Stig Bakken <ssb****@fast*****> + + * ext/mysql/config.m4: Add --with-mysql-sock option (James Cox) + +2002-06-10 Markus Fischer <mfisc****@guru*****> + + * win32/php4dllts.dsp: - Revert zlib.lib patch. + +2002-06-10 Harald Radi <haral****@nme*****> + + * ext/rpc/handler.h + ext/rpc/php_rpc.h + ext/rpc/rpc.c + ext/rpc/rpc.h: pooling and singleton finally work + + * 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: new testcases + +2002-06-10 Frank M. Kromann <frank****@kroma*****> + + * php.ini-dist + php.ini-recommended + ext/mssql/php_mssql.h + ext/mssql/php_mssql.c: Adding ini setting for max_procs + +2002-06-10 Harald Radi <haral****@nme*****> + + * win32/php4dllts.dsp: mysql need zlib.lib now + + +2002-06-10 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/php_mnogo.c: +2002-06-10 Jan Lehnardt <jan****@dasmo*****> + + * ext/standard/array.c: - MFH (WS-fix) + + * ext/standard/array.c: - whitespace fix + +2002-06-10 Markus Fischer <mfisc****@guru*****> + + * ext/mysql/libmysql/config-win.h + win32/php4dllts.dsp: - Fix win32/mysql. + - Revert cryptic WS commit on php4dllts.dsp. + +2002-06-10 Joseph Tate <jtate****@mi-co*****> + + * ext/domxml/php_domxml.c: +2002-06-10 Harald Radi <haral****@nme*****> + + * win32/php4dllts.dsp: mysql need zlib.lib now + + * ext/mysql/libmysql/my_wincond.c + ext/mysql/libmysql/my_winthread.c: fix the build + + +2002-06-10 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/php_mnogo.c: + - MnoGoSearch extension compile fix with mnogosearch-3.2.4 and 3.2.5 + +2002-06-10 Markus Fischer <mfisc****@guru*****> + + * ext/standard/mail.c: - WS fix, damn win32. + +2002-06-10 Harald Radi <haral****@nme*****> + + * ext/standard/array.c: fix the build + +2002-06-10 Markus Fischer <mfisc****@guru*****> + + * ext/standard/file.c: - Fix proto. + +2002-06-10 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/php_mnogo.c: +2002-06-10 Markus Fischer <mfisc****@guru*****> + + * ext/calendar/easter.c: + - Fix easter_(days|date)()s first parameter now really defaults to the current + year if ommited (it was document but didn't work). + +2002-06-10 Andrei Zmievski <andre****@php*****> + + * ext/standard/array.c + NEWS: + Fix bug #7045: shuffle() now provides consistent distribution of values + in the array. + +2002-06-09 Tomas V.V.Cox <cox****@idecn*****> + + * pear/Makefile.frag: Commented out old unused stuff + + + * pear/scripts/phptar.in: Moved to pear/Archive_Tar/scripts + + * pear/PEAR/Frontend/Gtk.php: + if (!dl(php_gtk)) die("Unable to load the php_gtk extension\n"); + + * pear/PEAR/Frontend/CLI.php: + Beautify config-show output, some wrap changes and fix small + issue with _tableRow() with line counting + +2002-06-09 Jani Taskinen <snipe****@iki*****> + + * NEWS: cleanup + +2002-06-09 Tomas V.V.Cox <cox****@idecn*****> + + * pear/install-pear.php: displayLine() -> outputData() + + * pear/PEAR/Frontend/CLI.php: - outputData($data, $command) + + outputData($data, $command = '_default') + +2002-06-09 Harald Radi <haral****@nme*****> + + * ext/rpc/com/com.c + ext/rpc/com/com.h: reflect the new abstraction changes in the demo layer + + * ext/rpc/handler.h + ext/rpc/php_rpc.h + ext/rpc/rpc.c + ext/rpc/rpc.h + ext/rpc/rpc_proxy.c: - using stas' abstraction now + - layer can add individual ini settings now + - classentries for the loaded rpc object are created dynamically now + class hirarchy looks like: rpc<-[layer]<-[object] (e.g. rpc<-com<-adodb), + thus the whole class tree is reflected into php + - added user-functions to mark an object as a singleton and as poolable + + + * main/config.w32.h.in: + pg_escape_* functions were not available on win32 due to a missing define + + +2002-06-09 Sander Roobol <phy****@wanad*****> + + * ext/dio/dio.c + ext/gmp/gmp.c: + Don't use headers if the module contains only one phpinfo() entry, just + stick to ordinary rows. + + * ext/gd/config.m4 + ext/gd/gd.c: + Made phpinfo() show if we're using the bundled version of GD + +2002-06-09 James Cox <james****@blog*****> + + * ext/mysql/config.m4: + dont test for the socket -- enables installs over NFS etc. + +2002-06-09 Sander Roobol <phy****@wanad*****> + + * ext/gd/config.m4: + Fixed detection of JPEG support in bundled version of GD. + + * ext/mysql/config.m4: Fixed configure stuff + +2002-06-09 Andrei Zmievski <andre****@php*****> + + * ext/standard/php_rand.h + ext/standard/rand.c: Make RAND_RANGE() an API macro. + +2002-06-09 Jani Taskinen <snipe****@iki*****> + + * ext/hwapi/config.m4: De-messify + + * ext/mysql/config.m4: Cleaned up the mess. Now it actually works too. + +2002-06-08 Christian Dickmann <chris****@gmx*****> + + * pear/PEAR/Command/Config.php + pear/PEAR/Command/Remote.php: add modes to list-all. fix a mergerbug + +2002-06-08 Sascha Schumann <sasch****@schum*****> + + * sapi/apache2filter/sapi_apache2.c: too many flushes are bad + +2002-06-08 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Installer.php: + Hopefully fixed a couple of problems with destination paths: + - Bug #17529 + - In Windows getting <pear>\/\<file> + - Documentation under <doc_dir>/Package/Package/ + + +2002-06-08 Andrei Zmievski <andre****@php*****> + + * NEWS: *** empty log message *** + +2002-06-08 James Cox <james****@blog*****> + + * ext/mysql/config.m4: + added support for --with-mysql-sock so people can specify it (eg, NFS compiles, etc) + changed the default mysql.sock location to use the one from the RPM. Added /usr/local + locations to the search list. (imajes) + +2002-06-08 Markus Fischer <mfisc****@guru*****> + + * ext/standard/info.c + main/php_streams.h + main/streams.c: + - Since streams are always enabled, instead of just printing 'enabled' we tell + what streams are currently registered. + +2002-06-07 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Registry.php: + Experimental dependencies database handling functions + (not yet in production) + +2002-06-07 Sebastian Bergmann <sb****@sebas*****> + + * main/config.w32.h.in: + Unbreak build by setting PHP_PREFIX to c:\php4 for now. + + * main/config.w32.h.in: Fugbix typo. + +2002-06-07 Zak Greant <zak****@mysql*****> + + * ext/mysql/libmysql/strmake.c + ext/mysql/libmysql/strto.c + ext/mysql/libmysql/strtoll.c + ext/mysql/libmysql/strtoull.c + ext/mysql/libmysql/thr_alarm.h + ext/mysql/libmysql/violite.c + ext/mysql/libmysql/my_pthread.h + ext/mysql/libmysql/my_realloc.c + ext/mysql/libmysql/my_static.c + ext/mysql/libmysql/my_sys.h + ext/mysql/libmysql/my_tempnam.c + ext/mysql/libmysql/my_thr_init.c + ext/mysql/libmysql/my_wincond.c + ext/mysql/libmysql/my_winthread.c + ext/mysql/libmysql/my_write.c + ext/mysql/libmysql/mysql.h + ext/mysql/libmysql/mysql_com.h + ext/mysql/libmysql/mysql_version.h + ext/mysql/libmysql/mysqld_error.h + ext/mysql/libmysql/net.c + ext/mysql/libmysql/raid.h + ext/mysql/libmysql/config-win.h + ext/mysql/libmysql/ctype.c + ext/mysql/libmysql/dbug.c + ext/mysql/libmysql/dbug.h + ext/mysql/libmysql/default.c + ext/mysql/libmysql/dll.c + ext/mysql/libmysql/errmsg.c + ext/mysql/libmysql/errmsg.h + ext/mysql/libmysql/get_password.c + ext/mysql/libmysql/global.h + ext/mysql/libmysql/libmysql.c + ext/mysql/libmysql/list.c + ext/mysql/libmysql/m_string.h + ext/mysql/libmysql/mf_casecnv.c + ext/mysql/libmysql/mf_dirname.c + ext/mysql/libmysql/mf_format.c + ext/mysql/libmysql/mf_path.c + ext/mysql/libmysql/my_compress.c + ext/mysql/libmysql/my_create.c + ext/mysql/libmysql/my_getwd.c + ext/mysql/libmysql/my_init.c + ext/mysql/libmysql/my_lib.c + ext/mysql/libmysql/my_malloc.c + ext/mysql/libmysql/my_open.c + ext/mysql/libmysql/my_pthread.c + ext/mysql/libmysql/charset.c: + Updating embedded libmysql to version 3.23.48 + +2002-06-07 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Remote.php + pear/PEAR/Frontend/CLI.php: Beautify remote-info + +2002-06-07 Joseph Tate <jtate****@mi-co*****> + + * ext/domxml/php_domxml.c + ext/domxml/php_domxml.h: + Added aliases to make attr_node access functions more consistent. + Old access functions are now deprecated. + CVS: ---------------------------------------------------------------------- + CVS: Enter Log. Lines beginning with `CVS:' are removed automatically + CVS: + CVS: Committing in . + CVS: + CVS: Modified Files: + CVS: php_domxml.c + CVS: ---------------------------------------------------------------------- + +2002-06-07 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Config.php: + - Reapplied the "treat umask as octal in "config-set" + command" Stig's patch + - Ported the config-help command to new UI API + + * pear/PEAR/Frontend/CLI.php: more wrapping cases + +2002-06-07 Stig Bakken <ssb****@fast*****> + + * main/config.w32.h.in: * fix SHLIB_SUFFIX_NAME define for Windows + + * main/build-defs.h.in + main/main.c + configure.in: New constants: PHP_PREFIX and PHP_SHLIB_SUFFIX + +2002-06-07 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Common.php: Remove debug code + + * pear/PEAR/Command/Registry.php: More info output retouchs + + * pear/PEAR/Common.php: Fix some minor issues with the parsing + +2002-06-07 Stig Bakken <ssb****@fast*****> + + * configure.in + pear/Makefile.frag: * get rid of pearize + +2002-06-07 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Registry.php: + Make "info" full human friendly (in deps list and lastmodified) + + * pear/PEAR/Command/Common.php + pear/PEAR/Command/Package.php: + Make $_deps_rel_trans and $_deps_type_trans globally avaible: + moved from Command/Package.php -> Command/Common.php + + * pear/scripts/pear.in: Be nicer with the help + + * pear/scripts/pear.in: ws + +2002-06-07 Stefan Esser <s.ess****@e-mat*****> + + * main/rfc1867.c: - Stay always in buffer + +2002-06-07 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Package.php + pear/PEAR/Command/Registry.php: + Put back the "info" command in its full state: + "Displays information about a package. The package argument may be a + local package file, an URL to a package file, or the name of an + installed package." + Command "package-info" depreciated (again) + + * pear/Net/SMTP.php: + fix EOL handling in AUTH (patch from Scott Carr <scarr****@progb*****>) + + * pear/Net/SMTP.php: ws + +2002-06-06 Daniela Mariaschi <maria****@liber*****> + + * ext/interbase/interbase.c + ext/interbase/php_interbase.h: + Add control on Ib version. ibase_add_user(), ibase_modify_user() + and ibase_delete_user() available with IB6 or later. + fix bug #17184 + + * ext/interbase/php_interbase.h: + Add control on IB version. ibase_add_user(), ibase_modify_user() + and ibase_delete_user() are available with IB6 or later + + * ext/interbase/interbase.c: + Add control on the IB version. ibase_add_user(),ibase_modify_user() + and ibase_delete_user() are available with IB6 or later + +2002-06-06 Markus Fischer <mfisc****@guru*****> + + * NEWS: - Update + + * ext/dbx/dbx_sybasect.c: - Remove C++ comments. + + * ext/gd/libgd/gd.c: - Revert Ws thingy. + +2002-06-06 Jani Taskinen <snipe****@iki*****> + + * ext/mbstring/config.m4: + Changed the configure option to be --enable/disable + +2002-06-06 Tomas V.V.Cox <cox****@idecn*****> + + * pear/Date/Calc.php: + Added method Date_Calc::compareDates($day1,$month1,$year1,$day2,$month2,$year2) + + * pear/Date/Calc.php: ws+cs + +2002-06-06 Stig Bakken <ssb****@fast*****> + + * pear/package-PEAR.xml: * prepare 0.90 + + * pear/PEAR/Command/Install.php + pear/PEAR/Installer.php: + * add "nobuild" option to installer (-B or --nobuild option to CLI frontend) + + * pear/PEAR/Builder.php: * remove debug output + + * pear/PEAR/Builder.php: + * when building, look for "package-version" subdirectory, needed for + building stuff straight from tarballs + + * pear/PEAR/Common.php: * add PEAR_COMMON_PACKAGE_NAME_PREG constant + + * pear/PEAR/Frontend/CLI.php: * make displayFatalError work again + +2002-06-06 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Package.php: Forgot that one + + * pear/PEAR/Frontend/CLI.php: Wrap table contents + + * pear/PEAR/Command/Registry.php: + Implemented "pear info <Installed Package>" command + + + * pear/PEAR/Command/Package.php: + Split the doPackageInfo() in doPackageInfo() and _infoForDisplaying() + (this last one can be statically called and is used also from + the "info" command) + + * pear/package-Mail.xml: package.xml file for the PEAR Mail package + + * pear/PEAR/Command/Common.php: That will really avoid PHP warnings + + * pear/PEAR/Command/Package.php: Fix package command + +2002-06-06 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/php_mnogo.h + ext/mnogosearch/php_mnogo.c: +2002-06-05 Jani Taskinen <snipe****@iki*****> + + * ext/gd/libgd/gd.c: ws and indent fixes + + * ext/gd/libgd/gd.c: - Fixes a segfault reported in #17584 + +2002-06-05 Markus Fischer <mfisc****@guru*****> + + * win32/sendmail.c + win32/sendmail.h: + - Headers are now rewritten to always have \r\n line endings for SMTP. + Also automatically removes superflous line breaks at + the start and end of the header. + +2002-06-05 Derick Rethans <d.ret****@jdime*****> + + * ext/domxml/php_domxml.c: + - Fix a problem in domxml_dump_mem(_file) with xmlKeepBlanksDefault not + being set. (patch by Rob Richards <rrich****@digar*****>) + +2002-06-05 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/php_mnogo.c: +2002-06-05 Stefan Esser <s.ess****@e-mat*****> + + * main/rfc1867.c: + fixed multiline header detection (':' is valid within following lines) + fixed fill_buffer to fill the buffer always completely + +2002-06-05 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/php_mnogo.c + ext/mnogosearch/php_mnogo.h: more mnogosearch compilation fixes + +2002-06-05 Stefan Esser <s.ess****@e-mat*****> + + * main/rfc1867.c: + fixing some crashbugs that can be triggered with bogus uploads. + +2002-06-05 Sergey Kartashoff <gluke****@biosy*****> + + * ext/mnogosearch/php_mnogo.h + ext/mnogosearch/php_mnogo.c: + MnoGoSearch extension fixes to compile under latest + mnogosearch 3.2.4 and 3.2.5. Still does not compile with them, + but the work still in progress... + +2002-06-04 Edin Kadribasic <edink****@prove*****> + + * win32/glob.c: Sync with openbsd glob.c 1.19 + + * win32/glob.c: Removed some leftover debugging code. + +2002-06-04 Jani Taskinen <snipe****@iki*****> + + * ext/gd/config.m4: + - Fixed the include paths for the needed libraries for bundled libgd. + - Removed files which are not needed with libgd2 from the PHP_NEW_EXTENSION. + +2002-06-04 Edin Kadribasic <edink****@prove*****> + + * ext/pcntl/php_pcntl.h + ext/pcntl/pcntl.c: Added function pcntl_alarm(). + +2002-06-04 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Registry.php: * sort package names in "pear list" + +2002-06-04 Joseph Tate <jtate****@mi-co*****> + + * ext/domxml/php_domxml.c: + * ext/domxml/php_domxml.c: Bug fix to #17560 submitted by Rob Richards + +2002-06-04 Mark L. Woodward <mlwmo****@mohaw*****> + + * ext/msession/reqclient.h + ext/msession/msession.c: + Added persistent connections, and automattic reconnect on + lost connections. Requires Phoenix 1.0 + +2002-06-04 Markus Fischer <mfisc****@guru*****> + + * ext/posix/posix.c: - Fix ZTS built. + +2002-06-04 Jani Taskinen <snipe****@iki*****> + + * ext/gd/gd.c: MFH: fix bug #17535 + + * ext/gd/gd.c: Fixed bug: #17535 + + * NEWS: fine tuning + + * ext/gd/config.m4: + - Made the bundled libgd actually work. Fixed bug: #17244 + +2002-06-03 Markus Fischer <mfisc****@guru*****> + + * ext/posix/posix.c: + - Move macro code into distinct function for easier debugging as suggested by + Andi. + +2002-06-03 Harald Radi <h.rad****@nme*****> + + * win32/php4dllts.dsp: fix build + +2002-06-03 Rasmus Lerdorf <rasmu****@lerdo*****> + + * ext/standard/html.c: Make sure len is defined here + +2002-06-03 Edin Kadribasic <edink****@prove*****> + + * NEWS + ext/standard/array.c: MFH + + * ext/standard/array.c: Fixed array_rand() on ZTS platforms. + +2002-06-03 Markus Fischer <mfisc****@guru*****> + + * ext/posix/posix.c: - Fix isatty() and ttyname() (Closes #17323, #17333). + + * win32/sendmail.c: - Fix a leak and a crash. + + * win32/install.txt: + - Add note about IIS/CGI and cgi.force_redirect gotcha + +2002-06-02 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command.php: * fix bug that was re-introduced during merge + +2002-06-02 Markus Fischer <mfisc****@guru*****> + + * win32/sendmail.c: + - Only add the To: field with the $to parameter if we don't have it in the + custom header. This was the behaviour < 4.2.x (but it was broken, this one + isn't). + + * win32/sendmail.c: + - Revert fix for #14407. The From: header field IS different from the + sendmail_from field which is in fact the retturn path. + + * win32/sendmail.c: + - Try to fix most of the buffer overflows and dynamically allocate memory where + applicable. + +2002-06-02 Adam Dickmeiss <adam****@index*****> + + * ext/yaz/php_yaz.c: Use ZOOM API for newer YAZ versions. + + * ext/yaz/config.m4: report error when YAZ cannot be found + +2002-06-02 Stefan Roehrich <stefa****@roehr*****> + + * ext/zlib/zlib.c: + Added "Vary: Accept-Encoding" header to zlib.output_compression + compressed output as with obgzhandler(). + +2002-06-02 Christian Dickmann <chris****@gmx*****> + + * pear/PEAR/Frontend/CLI.php: make 'pear remote-info' work with CLI + + * pear/PEAR/Command/Remote.php + pear/PEAR/Frontend/CLI.php: make 'pear search' work with CLI. fix a typo + +2002-06-02 Markus Fischer <mfisc****@guru*****> + + * main/main.c + win32/sendmail.c: + - Finish implementation of custom smtp port (introduces "smtp_port" ini config). + + * win32/sendmail.c: - Rephrase comment + + * win32/sendmail.c: - Classig problem: right idea, wrong pointer ... + +2002-06-02 Christian Dickmann <chris****@gmx*****> + + * pear/PEAR/Registry.php + pear/System.php: + silence unlink() and rmdir(). fix a bug where wasn't set due to wrong ini setting + +2002-06-02 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Frontend/CLI.php + pear/scripts/pear.in + pear/tests/pear_config.phpt + pear/PEAR/Builder.php + pear/PEAR/Command.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/Common.php + pear/PEAR/Config.php + pear/PEAR/Installer.php + pear/package-PEAR.xml: * merge NEW_UI_API branch + + * pear/PEAR/Common.php + pear/PEAR/Installer.php + pear/scripts/pear.in + pear/package-PEAR.xml: + * implemented "package-info" replacement in package.xml + + * pear/PEAR/Installer.php: * typo? + + * pear/PEAR/Command/Config.php: + * make output of "config-get" easier to parse + + * pear/PEAR/Command/Config.php: * fix some error reporting + + * pear/PEAR/Config.php: * less verbose + + * pear/PEAR/Installer.php: * fix buildcallback + + * pear/PEAR/Builder.php + pear/PEAR/Installer.php + pear/package-PEAR.xml: * "pear install" now builds and C extensions + + * pear/scripts/pear.in: * add custom error handler + + * pear/PEAR/Frontend/CLI.php: * de-obsolete display{,Fatal}Error + +2002-06-01 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Builder.php: * add some phpdoc + +2002-06-01 Stefan Roehrich <stefa****@roehr*****> + + * ext/snmp/config.m4 + acinclude.m4 + ext/domxml/config.m4 + ext/imap/config.m4: + WS change to make very old compilers/preprocessors (e.g. HP/UX 9) + happy (thanks to Andreas Ley for recognizing this). + +2002-06-01 Christian Dickmann <chris****@gmx*****> + + * pear/PEAR/Command/Config.php + pear/PEAR/Command/Remote.php + pear/PEAR/Config.php + pear/PEAR/Frontend/CLI.php + pear/PEAR/Installer.php: + add 'pear search'. introduce type 'mask' to config. + +2002-06-01 Sascha Schumann <sasch****@schum*****> + + * sapi/apache/php_apache.c: Fix build + +2002-06-01 Andi Gutmans <andi****@zend*****> + + * configure.in: - Fix build with Engine 2 + + * sapi/apache/php_apache.c: - Reapply netware patch + +2002-06-01 Rasmus Lerdorf <rasmu****@lerdo*****> + + * sapi/apache/php_apache.c: + Put Netware header and comment back in. My CVS revision id got messed + up somehow. + +2002-06-01 Sander Roobol <phy****@wanad*****> + + * php.ini-dist + php.ini-recommended: + Update cracklib path and comment it out (thanks to Urs Gehrig for the hint) + +2002-06-01 Frank M. Kromann <frank****@kroma*****> + + * ext/mbstring/mbfilter.c: + Makring function declarations match implementations (ZTS compilation) + +2002-05-31 Rasmus Lerdorf <rasmu****@lerdo*****> + + * sapi/apache/php_apache.c: Oops + + * sapi/apache/php_apache.c: 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. + +2002-05-31 Jani Taskinen <snipe****@iki*****> + + * ext/mbstring/config.m4: Fixed typo.. + +2002-05-31 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Frontend/CLI.php: * added missing fold + +2002-05-31 Tomas V.V.Cox <cox****@idecn*****> + + * pear/System.php: fread already detects EOF + + * pear/System.php: + Be able to handle strings as well as arrays in _multipleToStruct() + + * pear/System.php: + - Make mkTemp() automatically removed temporary created files + or dirs at script shutdown time + - Remove unnecesarry PEAR inheritance + - Some PHPDoc fixes + +2002-05-31 Brad LaFountain <rodif_bl****@yahoo*****> + + * ext/domxml/domxml.dsp + ext/domxml/php_domxml.h: + Changed PHP_EXPORTS to DOMXML_EXPORTS as Edin Kadribasic suggested + +2002-05-31 Harald Radi <h.rad****@nme*****> + + * ext/standard/credits_ext.h: MFH + + * ext/standard/credits_ext.h: added wez to the com extension + + * ext/com/CREDITS + ext/com/VARIANT.c + ext/com/com.h + ext/com/conversion.c + ext/com/php_COM.h + ext/com/variant.h + ext/com/COM.c: MFH + + * ext/com/CREDITS: added wez and ordered names alphabetically + +2002-05-31 Venkat Raghavan S <rvenk****@novel*****> + + * sapi/apache/php_apache.c: + Removed ugly code done as part of NetWare change, upon Andi's advice. Now, the typecasting is done for all platforms. + +2002-05-31 Derick Rethans <d.ret****@jdime*****> + + * main/rfc1867.c: - Don't issue a notice when no file was uploaded + +2002-05-31 Brad LaFountain <rodif_bl****@yahoo*****> + + * ext/domxml/php_domxml.c: + initalize variable in domxml_doc_document_element() + + * ext/domxml/domxml.dsp: + defined PHP_EXPORTS for exporting php_domobject_new() + + * ext/domxml/php_domxml.c + ext/domxml/php_domxml.h: + added the ability to use new keywork with domxmls objects "new DomDocument()" + instead of xmldoc. This also allows you to create nodes without having + a whole document "new DomElement("foo")". + + moved DOMXML_API_VERSION to php_domxml.h + exposed php_domobject_new for other extensions to use + removed some un-needed code + +2002-05-31 Venkat Raghavan S <rvenk****@novel*****> + + * main/config.nw.h + main/php.h + main/php_compat.h + sapi/apache/php_apache_http.h + sapi/apache/php_apache.c + sapi/apache/mod_php4.c: NetWare related changes + + * netware/buildsapi.bat + netware/common.mif + netware/php4apache.mak + netware/phplib.imp + netware/pwd.h: NetWare related additions / changes to build mod_php + +2002-05-30 Harald Radi <h.rad****@nme*****> + + * ext/com/COM.c: + * ext/com/VARIANT.c + ext/com/conversion.c + ext/com/dispatch.c + ext/com/COM.c: + Added missing AddRef() calls in the COM extension. This should + fix weird behaviour (in particular with ADODB). + + +2002-05-30 Sander Roobol <phy****@wanad*****> + + * pear/Console/tests/.cvsignore: Add missing .cvsignore + +2002-05-30 Markus Fischer <mfisc****@guru*****> + + * ext/session/mod_files.c: + - Tell the user why his session doesn't work if he uses custom session_id()s. + + * win32/install.txt: - Typo + + * win32/install.txt: + - Give some useful updates to Win32/Apache/PHP4 installation. Also mention + strace for advanced users. + +2002-05-30 Christian Dickmann <chris****@gmx*****> + + * pear/PEAR/Command/Config.php + pear/PEAR/Command/Remote.php + pear/PEAR/Frontend/CLI.php: + fix a typo. add some information to config-show + +2002-05-30 Den V. Tsopa <tdv****@ediso*****> + + * ext/mbstring/mbfilter_ru.c: Fixes some dummy errors (again). + +2002-05-30 Jan Lehnardt <jan****@dasmo*****> + + * pear/tests/pear_error4.phpt: - add testcase for PEAR::delExpect() + +2002-05-30 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Config.php: * organize configuration_info array by group + +2002-05-30 Venkat Raghavan S <rvenk****@novel*****> + + * netware/ZendEngine2.mak + netware/build.bat: NetWare changes for ZE2 + +2002-05-30 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Config.php + pear/tests/pear_config.phpt: + * applied Alan's patch adding groups and prompts + +2002-05-30 Cliff Woolley <jwool****@apach*****> + + * sapi/apache2filter/php_functions.c: + That macro is and always was hopelessly broken, which is why it's + now deprecated. + +2002-05-29 Jan Lehnardt <jan****@dasmo*****> + + * pear/PEAR.php: - minor improvement of readability, + + * pear/PEAR.php: + - added delExpect() API method. It allows to unset one or more expected + - error codes. + - requires _checkDelExpect() (private) which I added as well. + - inspired by chregu (PHP-Deluxe, page 75) + +2002-05-29 Christian Dickmann <chris****@gmx*****> + + * pear/PEAR/Command/Install.php + pear/PEAR/Frontend/CLI.php + pear/PEAR/Installer.php + pear/PEAR/Common.php: fix a bug and add UI::log + +2002-05-29 Den V. Tsopa <tdv****@ediso*****> + + * ext/mbstring/mbfilter.c: Added GB2312 alias for CN-GB + +2002-05-29 Derick Rethans <d.ret****@jdime*****> + + * ext/imap/php_imap.c: - Fix for bug #17503 + +2002-05-29 Venkat Raghavan S <rvenk****@novel*****> + + * netware/mktemp.h + netware/sys/stat.h + netware/tsrm.mak: Changes to build TSRM on NetWare + +2002-05-29 Den V. Tsopa <tdv****@ediso*****> + + * ext/mbstring/mbfilter_ru.c: Fixed some dummy errors. (dets) + +2002-05-29 Venkat Raghavan S <rvenk****@novel*****> + + * netware/zend.mak: Changes to build Zend on NetWare + +2002-05-29 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command.php: * no longer test on whether displayLine exists + + * pear/PEAR/Builder.php + pear/PEAR/Command/Build.php: + * build extensions in /var/tmp/pear-build-$USER/extname-n.n + * copy built .so files + + * pear/PEAR/Command/Registry.php: * folding marks + + * pear/PEAR/Common.php: * make PEAR_Common::log work with the new UI API + + * pear/PEAR/Frontend/CLI.php: + * for now, provoke php errors on calls to the old methods + +2002-05-28 Andrei Zmievski <andre****@php*****> + + * acinclude.m4: Fix a bug in case statement. + +2002-05-28 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command.php: * don't create duplicate ui objects + + * pear/PEAR/Frontend/CLI.php: * gotta love these extra newlines + +2002-05-28 Venkat Raghavan S <rvenk****@novel*****> + + * netware/bisonflexzend.bat: + Batch file to do the Lex / Yacc stuff for Zend + + * netware/common.mif: SDK directory path change + +2002-05-28 Bertrand Mansion <bmans****@mamas*****> + + * pear/HTML/Table.php + pear/HTML/Common.php: Moved to /pear + +2002-05-28 Venkat Raghavan S <rvenk****@novel*****> + + * netware/build.bat + netware/common.mif + netware/tsrm.mak + netware/zend.mak: + Makefiles and batch file required to build Zend and TSRM + + * netware/php-nw.bat: *** empty log message *** + +2002-05-28 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Auth.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/PEAR/Common.php: * imported Christian Dickmann's new UI code + * converted PEAR_Frontend_CLI::userDialog() to new API + + * pear/package-PEAR.xml: * 0.11 release coming up + + * pear/PEAR/Command/Package.php: + * drop package-info command (deprecated by "info") + + * pear/tests/pear_config.phpt: * update test + + * pear/PEAR/Command/Build.php + pear/PEAR/Builder.php + pear/package-PEAR.xml: * update 0.11 release notes + * move build logic into PEAR_Builder + + * pear/scripts/pear.in + pear/PEAR/Config.php: + * disable *&$^*#@ runtime ^@#*&$@ magical ^*!@@!! quoting + + * pear/Archive/Tar.php + pear/docs/Archive_Tar.txt + pear/package-Archive_Tar.xml: * sync up + + * pear/PEAR/Config.php: + * disable magic_quotes_runtime (what a broken concept!!) while + reading config files + + * pear/PEAR/Installer.php: * fix some errors/warnings + * install data and test files now + + * pear/PEAR/Config.php: * added data_dir and test_dir + +2002-05-27 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Config.php: + * moved the --without-pear compat defines to the right place + + * pear/PEAR/Config.php: + * change root for documentation files to <peardir>/docs + + * pear/PEAR/Command/Config.php: + * treat umask as octal in "config-set" command + + * pear/PEAR/Common.php: * use new Archive_Tar gzip autodetection + + * pear/package-Archive_Tar.xml: * prepare 0.9 release + + * pear/PEAR/Config.php: + * fixed a bug in PEAR_Config::set() that broke validation of "set" parameters + + * pear/Archive/Tar.php: * better gzip detection (magic cookie) + +2002-05-27 Andi Gutmans <andi****@zend*****> + + * genfiles: + - Hope this is the last commit in the series. Make sure that the .h file + - also goes into ext/standard. I'm not sure how 4.2.1 was built with these + - broken files + + * genfiles: - One more try. + + * genfiles: - Isn't Makefile.frag being called? (Weird) + + * genfiles: - Be a bit more verbose + +2002-05-27 Sascha Schumann <sasch****@schum*****> + + * ext/ircg/ircg.c: + Flush data related to the streaming connection during php's rshutdown, + and not during the ircg_set_current call, because it is otherwise not + guaranteed that the HTTP header is sent out first. + +2002-05-27 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Installer.php + pear/package-PEAR.xml: * fixes for php without zlib + + * pear/Archive/Tar.php + pear/package-Archive_Tar.xml: + * make Archive_Tar auto-detect whether zlib is needed based on file + extension (.tar -> no zlib) + +2002-05-27 Andi Gutmans <andi****@zend*****> + + * makedist.ZendEngine2: - Small update + +2002-05-27 Stig Bakken <ssb****@fast*****> + + * pear/package.dtd: * update version + + * pear/PEAR/Command/Build.php + pear/PEAR/Common.php + pear/package.dtd + pear/package-PEAR.xml: + * first shot at "pear build" command for building extensions from C code + + * pear/PEAR/Command/Registry.php: * "info" command + + * pear/PEAR/Command/Config.php: * added config-help command + + * pear/PEAR/Config.php: * drop "any" as a valid preferred_state + + * pear/PEAR/Config.php: * more verbose docs for "verbose" :) + +2002-05-26 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Common.php: * un-indent description too + + * pear/PEAR/Common.php: + * try being smart about de-indenting release notes from the xml + + * pear/PEAR/WebInstaller.php: * PEAR_Frontend_Web is coming! + +2002-05-26 Andi Gutmans <andi****@zend*****> + + * genfiles: - Small fix + +2002-05-26 Edin Kadribasic <edink****@prove*****> + + * NEWS: I case we ever release 4.2.2. + + * sapi/cgi/cgi_main.c + sapi/cli/php_cli.c: MFH (fix for exit()) + +2002-05-26 Andi Gutmans <andi****@zend*****> + + * genfiles: - Update genfiles for new build system + +2002-05-26 Tomas V.V.Cox <cox****@idecn*****> + + * pear/scripts/pear.in: Added "pear -V" (show version information) + +2002-05-26 Stig Bakken <ssb****@fast*****> + + * pear/scripts/pear.in: * another help fix + +2002-05-26 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Config.php: + Make the error handling work again since the new internal command + structure + +2002-05-26 Martin Jansen <mail****@marti*****> + + * pear/package-PEAR.xml: * Add /me has helper. + +2002-05-26 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Package.php: * bold column headings + + * pear/package-PEAR.xml: ^t + +2002-05-26 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Install.php + pear/scripts/pear.in: "Help" fixes + +2002-05-26 Edin Kadribasic <edink****@prove*****> + + * sapi/cgi/cgi_main.c: Merge from cli. + +2002-05-26 Stig Bakken <ssb****@fast*****> + + * pear/package-PEAR.xml: * add package.dtd to the distribution + + * pear/package-PEAR.xml: * roll out 0.10 + + * pear/PEAR/Command.php: * focus on the present + + * pear/PEAR/Frontend/Gtk.php: * add @nodep stuff here too + + * pear/PEAR/Remote.php: * be nice to PEAR_Common::detectDepdencencies() + + * pear/PEAR/Common.php: * more work on the dependency detector + + * pear/scripts/pear.in: * Console_Getopt POSIX fix + + * pear/PEAR.php: * phpdoc fixes (un-break the broken) + +2002-05-26 Edin Kadribasic <edink****@prove*****> + + * sapi/cli/php_cli.c: + Due to the way Zend handles exit() we cannot rely on the return code + of php_execute_script. + + * sapi/cli/php_cli.c: Made constants persistent and fixed a memory leak. + +2002-05-26 Stig Bakken <ssb****@fast*****> + + * pear/Console/Getopt.php + pear/package-Console_Getopt.xml: + * POSIX getopt compatibility support (first argv element is the command) + + * pear/install-pear.php: * tidy output a bit + + * ext/standard/versioning.c: Fix segfault in version_compare() + + * pear/PEAR/Installer.php: * cleaned up error handling in _installFile + +2002-05-25 Martin Jansen <mail****@marti*****> + + * pear/PEAR/Command/Package.php: + * Make rel_trans from doPackageInfo globally available. + * Add command "package-dependencies" (shortcut "pd") to list the + dependencies of a package. + +2002-05-25 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Remote.php: + * typo caught by PEAR_Common::detectDependencies :) + +2002-05-24 Rui Hirokawa <rui_hirok****@ybb*****> + + * ext/mbstring/mbstring.c: reverted my patch. + + * ext/mbstring/config.m4 + ext/mbstring/mbfilter.c + ext/mbstring/mbfilter_ru.c + ext/mbstring/mbfilter_ru.h + ext/mbstring/mbstring.c: reverted patch to support iso2022kr. + +2002-05-24 Sander Roobol <phy****@wanad*****> + + * ext/standard/info.c: + Fix <head> and <body> tags in phpinfo() output (#17411) + +2002-05-24 Edin Kadribasic <edink****@prove*****> + + * sapi/cli/php_cli.c: + Register STDIN, STDOUT, and STDERR "constants" in cli in cases where + script itself is not being loaded from STDIN. + + This enables constructs like fwrite(STDERR, "Error 42"); + +2002-05-23 Derick Rethans <d.ret****@jdime*****> + + * ext/standard/image.c + ext/standard/php_image.h: + - Added support for compressed SWF (Flash MX) files to getimagesize(). + (Fixes feature request #17272). + - Added support to getimagesize() for compressed Flash MX files. + +2002-05-23 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Installer.php: TODO++ + Check dependencies break on package uninstall (when no force given) + + * pear/PEAR/Dependency.php: + Fix package dependency check (reported by Rasmus) + +2002-05-23 Andrei Zmievski <andre****@php*****> + + * ext/pcre/php_pcre.c + NEWS: + This code adds string offset capturing in preg_split() results. Original + patch by David Brown, modified by me. + +2002-05-23 Sascha Schumann <sasch****@schum*****> + + * ext/ircg/ircg.c: + Revamped timeout handling to be more consistent; it disconnects users + which are not associated with a stream window within 3 minutes. + + Improved the id generator, so that it becomes more unlikely that + two or more consecutive runs/instances will yield the same ids. + + Improved error message collecting to run at constant time intervals. + + Added a facility which aims at ensuring that the extension does not + shutdown(2) unrelated sockets. This has been disabled for now, + because of lack of extensive testing. + + The current time is now easily accessible through a wrapper function. + This replaces the ugly #ifdefs spread through the code. + + IRCG does not generate "Pragma: no-cache" headers anymore. Additionally, + ircg_set_current() will not cause the HTTP header to be sent, so you + can add/change headers afterwards. + + And some cleanup. + +2002-05-23 Edin Kadribasic <edink****@prove*****> + + * ext/standard/math.c: + MFH (patch for allowing strings in pow() args, fixes #17374) + +2002-05-23 Andi Gutmans <andi****@zend*****> + + * ext/standard/file.c: - Fix typo + +2002-05-23 Wez Furlong <wez.p****@thebr*****> + + * ext/standard/tests/general_functions/proc_open.phpt: + Add simple test case for proc_open + + * ext/standard/exec.c: Fix (stupid) segfault. #17379 + +2002-05-23 Derick Rethans <d.ret****@jdime*****> + + * ext/standard/exec.c: + - Fix unchecked return values with parameters to proc_open. (Fixes + bug #17375) + + * ext/standard/file.c: - Fix errormessage and whitespace + +2002-05-23 Yasuo Ohgaki <yohga****@dd*****> + + * ext/standard/file.c: + Added 4th parameter to specify enclosure character. Patch by Dean Richard Benson <dean****@viper*****> + Spit more meaningful error messages when delim and/or enclosure char is null. + +2002-05-22 Jani Taskinen <snipe****@iki*****> + + * run-tests.php: Skip POST data if it is empty. + +2002-05-22 Andi Gutmans <andi****@zend*****> + + * makedist.ZendEngine2: + - makedist script for creating Engine 2 distribution. + - Hopefully we can get a preview out in the next few days. + +2002-05-22 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Package.php: + Trigger an error if the run-test.php file is not found + Make the run-tests pear cmd run with the CGI SAPI + + * pear/PEAR/Dependency.php: + Test first if the package exists before comparing the version + (fix the version_compare() segfault) + + * pear/PEAR/Remote.php: Make pear -vv XXX set the XML_RPC debug flag + +2002-05-22 Wez Furlong <wez.p****@thebr*****> + + * sapi/activescript/CREDITS + sapi/activescript/README: Add README and CREDITS... + + * sapi/activescript/scriptengine.cpp: + Fix bug when length was queried before the string was converted. + +2002-05-21 Wez Furlong <wez.p****@thebr*****> + + * ext/com/COM.c: + Add documentation comment for properties in com_print_typeinfo + + * ext/com/COM.c: Enhance com_print_typeinfo. + The main expected use is like this, for figuring out what methods + are allowed for a COM object: + + $ie = new COM("InternetExplorer.Application"); + // Prints class definition for IE object + com_print_typeinfo($ie, "InternetExplorer.Application", false); + // Prints class definition for default IE event handler + com_print_typeinfo($ie, "InternetExplorer.Application", true); + +2002-05-21 Andrei Zmievski <andre****@php*****> + + * NEWS: *** empty log message *** + + * ext/tokenizer/tokenizer.c: Fix bug #16939. + +2002-05-21 Wez Furlong <wez.p****@thebr*****> + + * ext/com/COM.c: + Correct usage of convert_to_string_ex which is not allowed to zval* + + * ext/com/COM.c: Reformat some comments. + + * ext/com/COM.c: Fix a flag, remove an old comment. + + * ext/com/com.h + ext/com/dispatch.c + ext/com/php_COM.h + ext/com/variant.h + ext/com/COM.c: + - Make sure that COM and VARIANT resources are returned as resources + rather than longs. + - Make the IDispatch implementation a bit more generic (and + fix my mess of pointers). + - Add new com_message_pump() function that acts like an interruptible + usleep() that processes COM calls/events. + - Add new com_print_typeinfo() function for "decompiling" the typeinfo + for an interface into PHP script. This is useful for generating a + skeleton for use as an event sink. + - Add new com_event_sink() function for sinking events from COM + objects. Usage is like this: + + <?php + + class IEEventSinker { + var $terminated = false; + + function ProgressChange($progress, $progressmax) { + echo "Download progress: $progress / $progressmax\n"; + } + function DocumentComplete(&$dom, $url) { + echo "Document $url complete\n"; + } + function OnQuit() { + echo "Quit!\n"; + $this->terminated = true; + } + } + + $ie = new COM("InternetExplorer.Application"); + + $sink =& new IEEventSinker(); + com_event_sink($ie, $sink, "DWebBrowserEvents2"); + + $ie->Visible = true; + $ie->Navigate("http://www.php.net"); + + while(!$sink->terminated) { + com_message_pump(4000); + } + $ie = null; + ?> + +2002-05-21 Hartmut Holzgraefe <hartm****@six*****> + + * ext/mime_magic/TODO: ZTS issues fixed + + * ext/mime_magic/mime_magic.c: + not beautifull (yet), but should fix ZTS builds + +2002-05-21 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Installer.php: + files that are not installed should be removed from the + registered file list (TODO--) + +2002-05-21 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Registry.php: + * show installed_as instead of a "calculated" path for installed packages + + * pear/PEAR/Installer.php: * add TODO comment + +2002-05-21 Sebastian Bergmann <sb****@sebas*****> + + * win32/php4dll.dsp + win32/php4dllts.dsp + main/config.w32.h.in: Add HAVE_MBSTR_RU support for Win32. + + * ext/mbstring/mbfilter_ru.c: ZTS fixes. + +2002-05-21 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Registry.php: * disable wrapping for now + +2002-05-21 Den V. Tsopa <tdv****@ediso*****> + + * ext/mbstring/mbfilter_ru.c + ext/mbstring/mbfilter_ru.h + ext/mbstring/mbstring.c + ext/mbstring/unicode_table_ru.h + ext/mbstring/mbfilter.h + ext/mbstring/mbfilter.c + ext/mbstring/config.m4: + Added russian codepages (koi8-r,cp1251,cp866) support. + +2002-05-21 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Common.php: Some minor error verbosity updates + + * pear/PEAR/Command/Remote.php: doListRemote -> doRemoteList + + * pear/PEAR/Installer.php: + Make the installation of a package fail when _installFile + fails and "force" is not set + +2002-05-21 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Registry.php: + * list command no longer displays test and data files when listing + installed files + + * pear/PEAR/Command/Package.php: + * package-list command no longer needed ("list" does the same thing and + more) + + * pear/PEAR/Command/Registry.php: + * rename shell-test shortcut to st (was stest) + + * pear/PEAR/Command/Install.php + pear/PEAR/Command/Package.php + pear/PEAR/Command/Registry.php + pear/PEAR/Command/Remote.php + pear/PEAR/Command/Config.php: * added more shortcuts + + * pear/PEAR/Command/Package.php + pear/PEAR/Command/Registry.php + pear/PEAR/Command/Remote.php + pear/scripts/pear.in + pear/PEAR/Command/Install.php + pear/PEAR/Command.php + pear/PEAR/Command/Auth.php + pear/PEAR/Command/Common.php + pear/PEAR/Command/Config.php: + * implemented shortcuts ("pv" for "package-validate" etc.) + do "pear help shortcuts" to see what shortcuts exist + * renamed "list-installed" command to "list" and made it able to + list the contents of installed packages as well as tar/tgz/xml files + * added some more/better command docs + * fixed up the synopsis part in the help output + * display option parameters (--foo=bar, where bar is specified in + 'shortarg' as for example 'f:bar') + * renamed list-remote-packages to list-remote + * renamed remote-package-info to remote-info + + * pear/PEAR/Common.php: * make infoFromAny actually work :) + + * pear/PEAR/Remote.php: * better wording + +2002-05-21 Edin Kadribasic <edink****@prove*****> + + * ext/pgsql/pgsql.dsp: MFH (fix for #17315) + + * ext/pgsql/pgsql.dsp: + Fix for #17315. Requires client library 7.2 or greater to compile. + +2002-05-20 Markus Fischer <mfisc****@guru*****> + + * ext/posix/posix.c: - MFH fix for #17323. + + * ext/posix/posix.c: + - Fix posix_isatty() and posix_ttyname() (Closes #17323) + +2002-05-20 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Remote.php: * disable debug in XML_RPC fallback + +2002-05-20 Wez Furlong <wez.p****@thebr*****> + + * sapi/activescript/php4as_scriptengine.h + sapi/activescript/scriptengine.cpp + sapi/activescript/php4activescript.h: + Use the GIT for inter-thread marshalling. + +2002-05-20 Markus Fischer <mfisc****@guru*****> + + * ext/zip/zip.c: + - Add safe_mode/uid and open_basedir check to zip_open() (closes #16927). + + * ext/standard/filestat.c: - ZTS gotcha + + * ext/standard/filestat.c: + - Add open_basedir check for all functions using php_stat() (filesize, stat, + etc), closes #11563. + +2002-05-20 Harald Radi <h.rad****@nme*****> + + * sapi/activescript/classfactory.cpp + sapi/activescript/scriptengine.cpp: this way it even compiles + + * ext/com/com.h + ext/com/conversion.c + ext/com/COM.c: integrating wez's patch + +2002-05-20 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Remote.php: * new command setup + + * pear/packages/XML_RPC-1.0.2.tar + pear/packages/XML_RPC-1.0.3.tar: + * upgrade bundled XML_RPC package to 1.0.3 + + * pear/Makefile.frag + pear/install-pear.php: * new installer rule that does not depend on bash + + * pear/PEAR/Common.php: * _infoFromAny goes public! + + * pear/PEAR/Installer.php: + * some verbosity changes: 0 - only errors, 1 - status report when the + install is done, 2 - show each operation, 3 - show file operations + + * pear/PEAR/Command/Install.php: * no output in verbosity level 0 + + * pear/PEAR/Config.php: * added PEAR_Config::removeLayer() + + * pear/PEAR/Command/Package.php: * remove getCommands() from here + * added options to "pear cvstag": -q -Q -d -F + +2002-05-20 Yasuo Ohgaki <yohga****@dd*****> + + * ext/pgsql/pgsql.c: MFH + +2002-05-20 Stig Bakken <ssb****@fast*****> + + * pear/scripts/pear.in: * support multiple -v and -q options + + * pear/package-Archive_Tar.xml: * forgot to update the release date + + * pear/package-Archive_Tar.xml: * fix fix + + * pear/Archive/docs/Tar.txt + pear/Archive/Tar.php + pear/package-Archive_Tar.xml: * merge 0.4 files from /pear/Archive_Tar + + * pear/package-Console_Getopt.xml: * prepare 0.10 + + * pear/PEAR/Command/Registry.php: * remove run() from this class + +2002-05-20 Wez Furlong <wez.p****@thebr*****> + + * win32/php4dllts.dsp: + This somehow got undone when I committed the rest... + +2002-05-20 Yasuo Ohgaki <yohga****@dd*****> + + * ext/pgsql/pgsql.c: + Fixed possible pg_lo_write() overflow and make it more fail safe. + +2002-05-20 Wez Furlong <wez.p****@thebr*****> + + * win32/php4ts.dsw: Add activescript sapi to the workspace + + * sapi/activescript/classfactory.cpp + sapi/activescript/php4activescript.c + sapi/activescript/php4activescript.def + sapi/activescript/php4activescript.dsp + sapi/activescript/php4activescript.h + sapi/activescript/php4as_classfactory.h + sapi/activescript/php4as_scriptengine.h + sapi/activescript/scriptengine.cpp: Implement ActiveScript interfaces. + This allows use of PHP in: + Client-side script in Internet Explorer + Windows Scripting Host + ASP and ASP.NET pages + It's mostly working... give it a go. + You will need to regsvr32 the php4activescript.dll manually. + + * main/fopen_wrappers.h + main/spprintf.h: Protect C code with extern "C" + + * ext/com/COM.c + ext/com/conversion.c + ext/com/dispatch.c + ext/com/php_COM.h: Added generic COM wrapper for PHP objects. + +2002-05-20 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Command/Install.php: Added missing key 'doc' for -Z help + + * pear/PEAR/Common.php: + Fix small bug making the baseinstalldir attrib persist + +2002-05-20 Yasuo Ohgaki <yohga****@dd*****> + + * ext/pgsql/pgsql.c: + Improve large object performance. pg_lo_read() and pg_lo_read_all() should perform + much better now. + Fixed Old API support for pg_lo_import(). + +2002-05-20 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Install.php: * no need for getCommands() here + + * pear/PEAR/Command/Package.php: * new command setup + + * pear/PEAR/Command/Auth.php: * typo fixes, wrapping + +2002-05-19 Stig Bakken <ssb****@fast*****> + + * pear/package-PEAR.xml: * install pear.bat on Windows only + +2002-05-19 Jani Taskinen <snipe****@iki*****> + + * pear/package-Archive_Tar.xml + pear/package-Console_Getopt.xml + pear/package-PEAR.xml: Make this actually work somewhat better.. + +2002-05-19 Edin Kadribasic <edink****@prove*****> + + * NEWS: Give due credit to Markus. + +2002-05-19 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Dependency.php: * compat fix + +2002-05-19 Markus Fischer <mfisc****@guru*****> + + * NEWS: - Mention the availability of glob(). + +2002-05-19 Tomas V.V.Cox <cox****@idecn*****> + + * pear/scripts/pear.in: Put "pear help options" working again + + * pear/PEAR/Command/Common.php: Put "pear help command" working again + +2002-05-19 Sander Roobol <phy****@wanad*****> + + * run-tests.php: Fix php.ini-related stuff in run-tests.php + + * main/php_ini.c: + get_cfg_var("get_file_path") didn't work correctly when an alternative + php.ini _file_ was specified using -c + +2002-05-19 Edin Kadribasic <edink****@prove*****> + + * main/config.w32.h.in + win32/glob.c + win32/glob.h + win32/php4dllts.dsp + ext/standard/dir.c: Added glob() support for windows. + +2002-05-19 Sander Roobol <phy****@wanad*****> + + * php.ini-dist + php.ini-recommended: It's get_cfg_var() not cfg_get_var() + + * tests/basic/.cvsignore + tests/classes/.cvsignore + tests/func/.cvsignore + tests/lang/.cvsignore + tests/strings/.cvsignore + pear/tests/.cvsignore + tests/.cvsignore + ext/zip/tests/.cvsignore + ext/zlib/tests/.cvsignore + pear/XML/tests/.cvsignore + ext/standard/tests/strings/.cvsignore + ext/standard/tests/time/.cvsignore + ext/standard/tests/versioning/.cvsignore + ext/xml/tests/.cvsignore + ext/xslt/tests/.cvsignore + ext/standard/tests/general_functions/.cvsignore + ext/standard/tests/math/.cvsignore + ext/standard/tests/reg/.cvsignore + ext/standard/tests/serialize/.cvsignore + ext/standard/tests/.cvsignore + ext/standard/tests/aggregation/.cvsignore + ext/standard/tests/array/.cvsignore + ext/standard/tests/assert/.cvsignore + ext/standard/tests/file/.cvsignore + ext/pspell/tests/.cvsignore + ext/session/tests/.cvsignore + ext/skeleton/tests/.cvsignore + ext/mcve/tests/.cvsignore + ext/ncurses/tests/.cvsignore + ext/openssl/tests/.cvsignore + ext/pcntl/tests/.cvsignore + ext/pgsql/tests/.cvsignore + ext/iconv/tests/.cvsignore + ext/interbase/tests/.cvsignore + ext/mbstring/tests/.cvsignore + ext/mcrypt/tests/.cvsignore + ext/dio/tests/.cvsignore + ext/domxml/tests/.cvsignore + ext/exif/tests/.cvsignore + ext/gmp/tests/.cvsignore + ext/db/tests/.cvsignore + ext/dbplus/tests/.cvsignore + ext/dbx/tests/.cvsignore + ext/crack/tests/.cvsignore + ext/ctype/tests/.cvsignore + ext/cybermut/tests/.cvsignore + ext/bz2/tests/.cvsignore + run-tests.php: + Fix temporary filename problems, and update .cvsignores with new extensions + + * Makefile.global + run-tests.php: Fix make test and remove a warning + + * Makefile.global + run-tests.php: Cleaned up run-tests.php, and fixed it on linux/unix + +2002-05-19 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Package.php: * new command setup + + * pear/PEAR/Installer.php: * support platform-specific files + + * pear/OS/Guess.php: * take uname as optional constructor parameter + +2002-05-19 Jani Taskinen <snipe****@iki*****> + + * NEWS: Typo fixes + + * ext/exif/exif.c + ext/domxml/php_domxml.c: MFH + + * ext/exif/exif.c + ext/domxml/php_domxml.c: DO NOT use C++ comments! + 2002-05-18 Christian Stocker <chreg****@phant*****> * ext/domxml/php_domxml.c: 1.2.2.1 +4 -15 php4/LICENSE Index: LICENSE =================================================================== RCS file: /cvsroot/php-i18n/php4/LICENSE,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- LICENSE 29 Apr 2002 02:26:18 -0000 1.2 +++ LICENSE 9 Jul 2002 09:14:29 -0000 1.2.2.1 @@ -1,5 +1,5 @@ -------------------------------------------------------------------- - The PHP License, version 2.02 + The PHP License, version 3.0a1 Copyright (c) 1999 - 2002 The PHP Group. All rights reserved. -------------------------------------------------------------------- @@ -37,20 +37,6 @@ "This product includes PHP, freely available from http://www.php.net/". - 6. The software incorporates the Zend Engine, a product of Zend - Technologies, Ltd. ("Zend"). The Zend Engine is licensed to the - PHP Association (pursuant to a grant from Zend that can be - found at http://www.php.net/license/ZendGrant/) for - distribution to you under this license agreement, only as a - part of PHP. In the event that you separate the Zend Engine - (or any portion thereof) from the rest of the software, or - modify the Zend Engine, or any portion thereof, your use of the - separated or modified Zend Engine software shall not be governed - by this license, and instead shall be governed by the license - set forth at http://www.zend.com/license/ZendLicense/. - - - 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 @@ -73,3 +59,6 @@ For more information on the PHP Group and the PHP project, please see <http://www.php.net>. + +This product includes the Zend Engine, freely available at +<http://www.zend.com>. 1.2.2.2 +4 -5 php4/Makefile.global Index: Makefile.global =================================================================== RCS file: /cvsroot/php-i18n/php4/Makefile.global,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- Makefile.global 30 Apr 2002 08:13:16 -0000 1.2.2.1 +++ Makefile.global 9 Jul 2002 09:14:29 -0000 1.2.2.2 @@ -1,4 +1,3 @@ -TESTS = $(top_srcdir) mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p INSTALL = $(top_srcdir)/build/shtool install -c INSTALL_DATA = $(INSTALL) -m 644 @@ -21,7 +20,7 @@ $(LIBTOOL) --mode=link $(CC) -export-dynamic $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ sapi/cli/php: $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS) - $(LIBTOOL) --mode=link $(CC) -export-dynamic $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ + $(BUILD_CLI) install: $(install_targets) @@ -42,7 +41,7 @@ fi $(INSTALL_IT) -install-modules: +install-modules: build-modules @test -d modules && \ $(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \ echo "installing shared modules into $(EXTENSION_DIR)" && \ @@ -57,8 +56,8 @@ install-su: install-pear install-tester test: sapi/cli/php - TOP_BUILDDIR=$(top_builddir) TOP_SRCDIR=$(top_srcdir) \ - $(top_builddir)/sapi/cli/php -c php.ini-dist $(top_srcdir)/run-tests.php $(TESTS) + @TEST_PHP_EXECUTABLE=$(top_builddir)/sapi/cli/php \ + $(top_builddir)/sapi/cli/php -c php.ini-dist $(top_srcdir)/run-tests.php clean: find . -name \*.lo -o -name \*.o -o -name \*.la -o -name \*.a| xargs rm -f 1.2.2.5 +66 -6 php4/NEWS Index: NEWS =================================================================== RCS file: /cvsroot/php-i18n/php4/NEWS,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -u -r1.2.2.4 -r1.2.2.5 --- NEWS 19 May 2002 11:16:02 -0000 1.2.2.4 +++ NEWS 9 Jul 2002 09:14:29 -0000 1.2.2.5 @@ -1,12 +1,72 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2002, Version 4.3.0 +- Disabled the fifth parameter to the mail function in safemode. (Derick) +- GetImageSize now allways set fields unknown to 0 and new Imagetype + iff. (Marcus) +- Add runtime Apache2 thread check to ensure we don't run a non-threaded + PHP inside a threaded Apache2 MPM. (Rasmus) +- Turn off ZTS if Apache2 is using the prefork 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 only exist if they are available. This means that for + example your GD build has no JPG support, none of the JPG functions would + actually exist, so you can safely test that 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) +- Fixed a crash in ereg_replace() when backreference number was greater + than the number of subpatterns. (olive****@billi*****) +- 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 STDIN, STDOUT and STDERR constants for CLI sapi reflecting opened + streams to their respective I/O counterparts. (Edin) +- Added pctnl_alarm() function. (Edin) +- Fixed array_rand() on thread-safe platforms such as Windows. (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) -- Fix crash bug in stripslashes() when working in sybase mode (Rasmus) +- Fixed a crash bug in stripslashes() when working in sybase mode. (Rasmus) - Added experimental support for Simplified Chinese, Traditional Chinese and - Korean encoding in mbstring. (Rui) + Korean encodings into mbstring. (Rui) - Misc. Win32 mail() enhancements: support 'From:' header (msiso****@yahoo*****), - Bcc headers and be case-insensitive, enhanced error reporting. (Markus) + 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.****@minds*****, rjs3****@andre*****, Jon) - Added optional 5th parameter to domxml_xslt_process(). When set, profiling @@ -23,11 +83,11 @@ the previously selected database name. (Jani) - 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) -- Made the mbstring extension to be enabled by default. (Yasuo) +- Changed the mbstring extension to be enabled by default. (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 +- 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) @@ -70,7 +130,7 @@ . Added memory stream support. (Marcus) - Fixed memory allocation problem on systems that have iconv() support in libc. (Yasuo) -- Made var_dump() handle recursive structures better. (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 1.2.2.1 +16 -6 php4/TODO Index: TODO =================================================================== RCS file: /cvsroot/php-i18n/php4/TODO,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- TODO 29 Apr 2002 02:26:19 -0000 1.2 +++ TODO 9 Jul 2002 09:14:29 -0000 1.2.2.1 @@ -22,8 +22,6 @@ * 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. - * Add try..catch/throw exception handling. - * Fix Zend shallow copy issues with objects and arrays. global @@ -83,6 +81,14 @@ * 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. @@ -99,6 +105,12 @@ -------- * 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: @@ -123,8 +135,8 @@ ext/sockets ----------- - * Make the extension work on windows (Daniel Beulshausen) - * Make the extension work with Solaris and the Sun GCC + * Implement IPv6 + * Review/Fix vectors ext/standard ------------ @@ -141,8 +153,6 @@ strrpos() strrchr() strip_tags() - * Rewrite win32 SMTP code to be usable for *ix to, maybe as a (default) - module of its own (Hartmut) ext/wddx -------- 1.2.2.2 +23 -8 php4/acinclude.m4 Index: acinclude.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/acinclude.m4,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- acinclude.m4 30 Apr 2002 08:13:16 -0000 1.2.2.1 +++ acinclude.m4 9 Jul 2002 09:14:29 -0000 1.2.2.2 @@ -1,4 +1,4 @@ -dnl $Id: acinclude.m4,v 1.186 2002/04/28 04:53:40 sniper Exp $ +dnl $Id: acinclude.m4,v 1.193 2002/07/01 01:01:06 imajes Exp $ dnl dnl This file contains local autoconf functions. @@ -102,7 +102,7 @@ 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="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;; /*[)] ac_srcdir=`echo $ac_n "$1$ac_c"|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 @@ -210,10 +210,10 @@ CPPFLAGS=-I$OPENSSL_INCDIR AC_MSG_CHECKING([for OpenSSL version]) AC_EGREP_CPP(yes,[ - #include <openssl/opensslv.h> - #if OPENSSL_VERSION_NUMBER >= 0x0090500fL +#include <openssl/opensslv.h> +#if OPENSSL_VERSION_NUMBER >= 0x0090500fL yes - #endif +#endif ],[ AC_MSG_RESULT([>= 0.9.5]) ],[ @@ -985,14 +985,29 @@ ]) dnl -dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path) +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,[ - PHP_ADD_LIBPATH($2) +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 @@ -1168,7 +1183,7 @@ dnl ---------------------------------------------- Shared module PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes) PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir) - AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module) + AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module) fi fi 1.2.2.1 +19 -18 php4/buildconf Index: buildconf =================================================================== RCS file: /cvsroot/php-i18n/php4/buildconf,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- buildconf 29 Apr 2002 02:26:19 -0000 1.2 +++ buildconf 9 Jul 2002 09:14:29 -0000 1.2.2.1 @@ -1,12 +1,24 @@ #!/bin/sh -# $Id: buildconf,v 1.50 2000/09/26 11:19:38 sas Exp $ +# $Id: buildconf,v 1.53 2002/06/24 03:05:00 sas Exp $ -supplied_flag=$1 - -if test "$supplied_flag" = "--copy"; then - automake_flags=--copy +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 - + ## build.mk does not check aclocal exit status yet ## #mv aclocal.m4 aclocal.m4.old 2>/dev/null @@ -20,17 +32,6 @@ # exit 1 #fi -if test "$supplied_flag" = "--local"; then - subdirs='SUBDIRS=' -else - subdirs='' -fi - rm -f generated_lists -case "`uname`" in -*BSD/OS*) - ./build/bsd_makefile;; -esac - -${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags" +${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags" ZENDDIR="$ZENDDIR" 1.2.2.1 +66 -57 php4/config.guess Index: config.guess =================================================================== RCS file: /cvsroot/php-i18n/php4/config.guess,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.guess 29 Apr 2002 02:26:19 -0000 1.2 +++ config.guess 9 Jul 2002 09:14:29 -0000 1.2.2.1 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -timestamp='2001-11-08' +timestamp='2001-09-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,9 +24,8 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Originally written by Per Bothner <bothn****@cygnu*****>. -# Please send patches to <confi****@gnu*****>. Submit a context -# diff and a properly formatted ChangeLog entry. +# Written by Per Bothner <bothn****@cygnu*****>. +# Please send patches to <confi****@gnu*****>. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and @@ -128,7 +127,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or + # Netbsd (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old @@ -145,7 +144,6 @@ macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; - sparc*) machine=`uname -p`-unknown ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched @@ -174,45 +172,6 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -288,9 +247,30 @@ Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; @@ -353,6 +333,12 @@ aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; + sparc*:NetBSD:*) + echo `uname -p`-unknown-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -379,6 +365,18 @@ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -548,8 +546,10 @@ 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 @@ -558,13 +558,13 @@ case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include <stdlib.h> @@ -597,10 +597,10 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy - fi ;; + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; @@ -664,6 +664,9 @@ parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -715,6 +718,9 @@ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; @@ -727,6 +733,9 @@ *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; @@ -947,7 +956,7 @@ exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 1.2.2.1 +12 -18 php4/config.sub Index: config.sub =================================================================== RCS file: /cvsroot/php-i18n/php4/config.sub,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.sub 29 Apr 2002 02:26:19 -0000 1.2 +++ config.sub 9 Jul 2002 09:14:29 -0000 1.2.2.1 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -timestamp='2001-11-08' +timestamp='2001-09-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -29,8 +29,7 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Please send patches to <confi****@gnu*****>. Submit a context -# diff and a properly formatted ChangeLog entry. +# Please send patches to <confi****@gnu*****>. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -245,13 +244,14 @@ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ + | s390 | s390x \ | sh | sh[34] | sh[34]eb | shbe | shle \ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ + | stormy16 | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 \ | we32k \ - | x86 | xscale | xstormy16 \ + | x86 | xscale \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -280,7 +280,6 @@ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alphapca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ - | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cray2-* | cydra-* \ @@ -303,13 +302,14 @@ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ + | s390-* | s390x-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \ + | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* | xstormy16-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ | ymp-* \ | z8k-*) ;; @@ -724,7 +724,7 @@ pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | k6 | nexgen | viac3) + pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) @@ -733,7 +733,7 @@ pentiumii | pentium2) basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) @@ -784,12 +784,6 @@ rtpc | rtpc-*) basic_machine=romp-ibm ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; sa29200) basic_machine=a29k-amd os=-udi @@ -801,7 +795,7 @@ basic_machine=sh-hitachi os=-hms ;; - sparclite-wrs | simso-wrs) + sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; @@ -1074,7 +1068,7 @@ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux*) + | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) 1.2.2.4 +17 -13 php4/configure.in Index: configure.in =================================================================== RCS file: /cvsroot/php-i18n/php4/configure.in,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- configure.in 19 May 2002 11:16:02 -0000 1.2.2.3 +++ configure.in 9 Jul 2002 09:14:29 -0000 1.2.2.4 @@ -1,4 +1,4 @@ -dnl ## $Id: configure.in,v 1.349 2002/05/14 20:53:33 sas Exp $ -*- sh -*- +dnl ## $Id: configure.in,v 1.357 2002/07/02 09:31:33 sas Exp $ -*- sh -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -103,7 +103,8 @@ *dgux*) CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";; *darwin*|*rhapsody*) - CPPFLAGS="$CPPFLAGS -no-cpp-precomp";; + CPPFLAGS="$CPPFLAGS -no-cpp-precomp" + php_multiple_shlib_versions_ok=yes;; *bsdi*) BSD_MAKEFILE=yes;; *beos*) @@ -308,15 +309,18 @@ dnl to avoid -lnsl checks, if we already have the functions which dnl are usually in libnsl dnl Also, uClibc will bark at linking with glibc's libnsl. - unset ac_cv_func_gethostname unset ac_cv_func_yp_get_default_domain -AC_CHECK_FUNC(gethostname, [ +case $host_alias in + *unixware* | *sco*) + AC_CHECK_FUNC(gethostname, [ + php_no_nsl_checks=yes + ]) + ;; +esac + +AC_CHECK_FUNC(yp_get_default_domain, [ php_no_nsl_checks=yes -],[ - AC_CHECK_FUNC(yp_get_default_domain, [ - php_no_nsl_checks=yes - ]) ]) unset ac_cv_func_gethostname unset ac_cv_func_yp_get_default_domain @@ -642,7 +646,7 @@ [ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php) --without-pear Do not install PEAR], DEFAULT) -if test "$PHP_PEAR" != "no"; then +if test "$PHP_PEAR" != "no" && test "$disable_cli" != "1"; then install_pear="install-pear install-build install-headers install-programs" PEAR_INSTALLDIR=$PHP_PEAR fi @@ -1039,6 +1043,7 @@ PHP_SUBST(TSRM_LIB) PHP_SUBST(WARNING_LEVEL) PHP_SUBST_OLD(YACC) +PHP_SUBST_OLD(SHLIB_SUFFIX_NAME) old_CC=$CC @@ -1107,7 +1112,7 @@ zend_ini.c zend_qsort.c zend_multibyte.c) if test -r "$abs_srcdir/Zend/zend_objects.c"; then - PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c) + PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_mm.c) fi dnl Selectively disable optimization due to high RAM usage during @@ -1135,8 +1140,7 @@ $php_shtool mkdir -p pear/scripts ALL_OUTPUT_FILES="php4.spec main/build-defs.h \ -pear/scripts/pear pear/scripts/phpize pear/scripts/php-config \ -pear/scripts/pearize pear/scripts/phptar \ +pear/scripts/phpize pear/scripts/php-config \ $PHP_OUTPUT_FILES" AC_OUTPUT($ALL_OUTPUT_FILES, [], [ @@ -1239,7 +1243,7 @@ X fi - if test "$MYSQL_MODULE_TYPE" = "builtin" && test "$PHP_SAPI" != "cgi" && test "$PHP_SAPI" != "cli"; then + if test "$MYSQL_MODULE_TYPE" = "builtin" && test "$PHP_SAPI" != "cgi" && test "$PHP_SAPI" != "cli" && test "$php_multiple_shlib_versions_ok" != "yes"; then cat <<X +--------------------------------------------------------------------+ | *** WARNING *** | 1.2.2.1 +4 -14 php4/genfiles Index: genfiles =================================================================== RCS file: /cvsroot/php-i18n/php4/genfiles,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- genfiles 29 Apr 2002 02:26:19 -0000 1.2 +++ genfiles 9 Jul 2002 09:14:29 -0000 1.2.2.1 @@ -1,21 +1,11 @@ #! /bin/sh -STD='make -f Makefile.am LEX="flex -L" YACC="bison -y -l" srcdir=.' +STD='make -f Makefile.frag LEX="flex -L" YACC="bison -y -l" srcdir=Zend builddir=Zend' -(cd Zend && eval "$STD zend_language_parser.c zend_language_scanner.c zend_ini_parser.c zend_ini_scanner.c") +(eval "$STD Zend/zend_language_parser.c Zend/zend_language_scanner.c Zend/zend_ini_parser.c Zend/zend_ini_scanner.c") -files="Makefile main/Makefile ext/standard/Makefile" -sh build/fastgen.sh . yes no $files -touch .deps main/.deps ext/standard/libs.mk - -cat > config_vars.mk <<EOF -LEX=flex -L -YACC=bison -y -l -EOF - -(cd ext/standard && make parsedate.c) - -rm config_vars.mk .deps ext/standard/libs.mk $files +set -x +bison -d -y -l ext/standard/parsedate.y -o ext/standard/parsedate.c for f in ext/standard/url_scanner_ex.c ext/standard/var_unserializer.c; do cp $f $f.orig 1.2.2.1 +88 -50 php4/ltmain.sh Index: ltmain.sh =================================================================== RCS file: /cvsroot/php-i18n/php4/ltmain.sh,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ltmain.sh 29 Apr 2002 02:26:19 -0000 1.2 +++ ltmain.sh 9 Jul 2002 09:14:29 -0000 1.2.2.1 @@ -55,8 +55,8 @@ # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.4 -TIMESTAMP=" (1.920 2001/04/24 23:26:18)" +VERSION=1.4.2 +TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)" default_mode= help="Try \`$progname --help' for more information." @@ -84,6 +84,9 @@ save_LANG="$LANG"; LANG=C; export LANG fi +# Make sure IFS has a sensible default +: ${IFS=" "} + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then echo "$modename: not configured to build any kind of library" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 @@ -202,6 +205,11 @@ exit 1 fi +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + if test -z "$show_help"; then # Infer the operation mode. @@ -329,7 +337,7 @@ -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" @@ -615,6 +623,10 @@ # Now arrange that obj and lo_libobj become the same file $show "(cd $xdir && $LN_S $baseobj $libobj)" if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi exit 0 else error=$? @@ -1031,6 +1043,17 @@ # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; esac fi deplibs="$deplibs $arg" @@ -1122,7 +1145,7 @@ -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in @@ -1140,7 +1163,7 @@ -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in @@ -1750,7 +1773,7 @@ if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" @@ -1763,7 +1786,7 @@ # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" @@ -1911,17 +1934,17 @@ echo "*** Therefore, libtool will create a static module, that should work " echo "*** as long as the dlopening application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes + build_libtool_libs=module + build_old_libs=yes else - build_libtool_libs=no + build_libtool_libs=no fi fi else @@ -2175,7 +2198,7 @@ else # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" @@ -2312,6 +2335,16 @@ if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac if test "$need_version" = no; then versuffix= else @@ -2408,6 +2441,9 @@ *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + ;; *) # Add libc to deplibs on all other systems if necessary. if test $build_libtool_need_lc = "yes"; then @@ -2784,7 +2820,7 @@ export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2860,7 +2896,7 @@ else eval cmds=\"$archive_cmds\" fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2988,7 +3024,7 @@ output="$obj" eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3024,7 +3060,7 @@ reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3287,27 +3323,25 @@ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * +# define lt_ptr void * #else -# define lt_ptr_t char * +# define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; - lt_ptr_t address; + lt_ptr address; } lt_preloaded_symbols[] = {\ " - sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ - -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ - < "$nlist" >> "$output_objdir/$dlsyms" + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr_t) 0} + {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ @@ -3618,8 +3652,9 @@ # relink executable if necessary if test -n \"\$relink_command\"; then - if (eval \$relink_command); then : + if relink_command_output=\`eval \$relink_command 2>&1\`; then : else + $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi @@ -3790,7 +3825,7 @@ eval cmds=\"$old_archive_cmds\" fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4165,7 +4200,7 @@ # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4352,7 +4387,7 @@ # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4368,11 +4403,10 @@ if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec $SHELL $0 --finish$current_libdirs - exit 1 + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 fi - - exit 0 ;; # libtool finish mode @@ -4391,7 +4425,7 @@ if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4575,11 +4609,8 @@ LANG="$save_LANG"; export LANG fi - # Now actually exec the command. - eval "exec \$cmd$args" - - $echo "$modename: cannot exec \$cmd$args" - exit 1 + # Now prepare to actually exec the command. + exec_cmd='"$cmd"$args' else # Display what would be done. if test -n "$shlibpath_var"; then @@ -4641,14 +4672,14 @@ # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then - : + : elif test -d "$file"; then - exit_status=1 + exit_status=1 continue elif test "$rmforce" = yes; then - continue + continue fi rmfiles="$file" @@ -4670,7 +4701,7 @@ if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4685,7 +4716,7 @@ if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4744,10 +4775,17 @@ ;; esac - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi # We need to display help for each of the modes. case $mode in 1.2.2.3 +13 -2 php4/php.ini-dist Index: php.ini-dist =================================================================== RCS file: /cvsroot/php-i18n/php4/php.ini-dist,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- php.ini-dist 19 May 2002 11:16:02 -0000 1.2.2.2 +++ php.ini-dist 9 Jul 2002 09:14:29 -0000 1.2.2.3 @@ -270,6 +270,11 @@ ; sourcelines. ignore_repeated_source = Off +; If this parameter is set to Off, then memory leaks will not be shown (on +; stdout or in the log). This has only effect in a debug compile, and if +; error reporting includes E_WARNING in the allowed list +report_memleaks = On + ; Store the last error/warning message in $php_errormsg (boolean). track_errors = Off @@ -593,7 +598,7 @@ ; Default password for mysql_connect() (doesn't apply in safe mode). ; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo cfg_get_var("mysql.default_password") +; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") ; and reveal this password! And of course, any users with read access to this ; file will be able to reveal the password as well. mysql.default_password = @@ -725,6 +730,9 @@ ; Whether to use cookies. session.use_cookies = 1 +; This option enables administrators to make their users invulnerable to +; attacks which involve passing session ids in URLs; defaults to 0. +; session.use_only_cookies = 1 ; Name of the session (used as cookie name). session.name = PHPSESSID @@ -809,6 +817,9 @@ ; Use NT authentication when connecting to the server mssql.secure_connection = Off +; Specify max number of processes. Default = 25 +;mssql.max_procs = 25 + [Assertion] ; Assert(expr); active by default. ;assert.active = On @@ -930,7 +941,7 @@ [Crack] ; Modify the setting below to match the directory location of the cracklib ; dictionary files. Include the base filename, but not the file extension. -crack.default_dictionary = "c:\php4\lib\cracklib_dict" +; crack.default_dictionary = "c:\php\lib\cracklib_dict" ; Local Variables: ; tab-width: 4 1.2.2.3 +13 -2 php4/php.ini-recommended Index: php.ini-recommended =================================================================== RCS file: /cvsroot/php-i18n/php4/php.ini-recommended,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- php.ini-recommended 19 May 2002 11:16:02 -0000 1.2.2.2 +++ php.ini-recommended 9 Jul 2002 09:14:29 -0000 1.2.2.3 @@ -275,6 +275,11 @@ ; sourcelines. ignore_repeated_source = Off +; If this parameter is set to Off, then memory leaks will not be shown (on +; stdout or in the log). This has only effect in a debug compile, and if +; error reporting includes E_WARNING in the allowed list +report_memleaks = On + ; Store the last error/warning message in $php_errormsg (boolean). track_errors = Off @@ -598,7 +603,7 @@ ; Default password for mysql_connect() (doesn't apply in safe mode). ; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo cfg_get_var("mysql.default_password") +; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") ; and reveal this password! And of course, any users with read access to this ; file will be able to reveal the password as well. mysql.default_password = @@ -732,6 +737,9 @@ ; Whether to use cookies. session.use_cookies = 1 +; This option enables administrators to make their users invulnerable to +; attacks which involve passing session ids in URLs; defaults to 0. +; session.use_only_cookies = 1 ; Name of the session (used as cookie name). session.name = PHPSESSID @@ -816,6 +824,9 @@ ; Use NT authentication when connecting to the server mssql.secure_connection = Off +; Specify max number of processes. Default = 25 +;mssql.max_procs = 25 + [Assertion] ; Assert(expr); active by default. ;assert.active = On @@ -937,7 +948,7 @@ [Crack] ; Modify the setting below to match the directory location of the cracklib ; dictionary files. Include the base filename, but not the file extension. -crack.default_dictionary = "c:\php4\lib\cracklib_dict" +; crack.default_dictionary = "c:\php\lib\cracklib_dict" ; Local Variables: ; tab-width: 4 1.2.2.3 +118 -181 php4/run-tests.php Index: run-tests.php =================================================================== RCS file: /cvsroot/php-i18n/php4/run-tests.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- run-tests.php 19 May 2002 11:16:02 -0000 1.2.2.2 +++ run-tests.php 9 Jul 2002 09:14:29 -0000 1.2.2.3 @@ -13,24 +13,17 @@ | obtain it through the world-wide-web, please send a note to | | licen****@php***** so we can mail you a copy immediately. | +----------------------------------------------------------------------+ + | Authors: Preston L. Bannister <pbann****@php*****> | + | Sander Roobol <sande****@php*****> | | (based on version by: Stig Bakken <ssb****@fast*****>) | | (based on the PHP 3 test framework by Rasmus Lerdorf) | +----------------------------------------------------------------------+ */ /* - History - ------- - - 2002-05-07 Preston L. Bannister <prest****@cox*****> - - Rewrote and updated to run on Win32. Require exact specification of PHP executable to test (no guessing!). - Require a specific tests/php.ini (rather than whatever is lying around), - and test that this is indeed what we are using. - Die if any internal errors encountered in test script. Regularized output for simpler post-processing of output. @@ -38,9 +31,6 @@ Optionally output error lines indicating the failing test source and log for direct jump with MSVC or Emacs. - Run basic (non-extension) tests first. Treat PEAR as extension. - - Tested on Windows 2000 with the Cygnus Win32 toolkit installed. */ /* @@ -50,6 +40,7 @@ set_time_limit(0); ob_implicit_flush(); +error_reporting(E_ALL); if (ini_get('safe_mode')) { echo <<<SAFE_MODE_WARNING @@ -70,47 +61,45 @@ // Require the explicit specification. // Otherwise we could end up testing the wrong file! -$php = $_ENV['TEST_PHP_EXECUTABLE']; - -isset($php) - or die("FAIL environment variable TEST_PHP_EXECUTABLE must be set to specify PHP executable!\n"); +if(isset($_ENV['TEST_PHP_EXECUTABLE'])) { + $php = $_ENV['TEST_PHP_EXECUTABLE']; +} else { + error("environment variable TEST_PHP_EXECUTABLE must be set to specify PHP executable!"); +} - @ is_executable($php) - or die("FAIL invalid PHP executable specified by TEST_PHP_EXECUTABLE = " . $php . "\n"); +if(!@is_executable($php)) { + error("invalid PHP executable specified by TEST_PHP_EXECUTABLE = " . $php); +} // Check whether a detailed log is wanted. -define('DETAILED',0 + $_ENV['TEST_PHP_DETAILED']); - -// Write INI file to be used in tests. - -$include_path = getcwd(); - -$test_ini = realpath(dirname($php) . "/php.ini"); -save_text($test_ini,"[PHP]\ninclude_path = \"$include_path\"\n"); +if(isset($_ENV['TEST_PHP_DETAILED'])) { + define('DETAILED', $_ENV['TEST_PHP_DETAILED']); +} else { + define('DETAILED', 0); +} // Write test context information. echo " ===================================================================== -TIME " . date('Y-m-d H:i:s') . " - start of test run CWD : " . getcwd() . " PHP : $php PHP_SAPI : " . PHP_SAPI . " PHP_VERSION : " . PHP_VERSION . " PHP_OS : " . PHP_OS . " -INI actual : " . get_cfg_var('cfg_file_path') . " -INI wanted : " . realpath('tests/php.ini') . " -INI tests : $test_ini +INI actual : " . realpath(get_cfg_var('cfg_file_path')) . " +INI wanted : " . realpath('php.ini-dist') . " ===================================================================== - "; // Make sure we are using the proper php.ini. -$php_ini = realpath("tests/php.ini"); -realpath(get_cfg_var('cfg_file_path')) == $php_ini - or die("FAIL test/php.ini was not used!\n"); +$php_ini = realpath("php.ini-dist"); +if(realpath(get_cfg_var('cfg_file_path')) != $php_ini) { + error("php.ini-dist was not used!"); +} +$php .= " -c $php_ini"; // Determine the tests to be run. @@ -118,143 +107,87 @@ $test_files = array(); $test_results = array(); -if (isset($_SERVER['argc'])) { - - // If parameters given assume they represent selected tests to run. - - $argc = $_SERVER['argc']; - $argv = $_SERVER['argv']; - for ($i = 1; $i < $argc; $i++) { - $testfile = realpath($argv[$i]); - $test_to_run[$testfile] = 1; - } - +// If parameters given assume they represent selected tests to run. +if (isset($argc) && $argc>1) { + for ($i=1; $i<$argc; $i++) { + $testfile = realpath($argv[$i]); + $test_to_run[$testfile] = 1; + } } // Compile a list of all test files (*.phpt). +$test_files = array(); +$module_of_test = array(); +find_files(getcwd()); + +function find_files($dir) { + global $test_files, $module_of_test; + + /* FIXME: this messes up if you unpack PHP in /ext/pear :) */ + if (ereg('/ext/([^/]+)/',"$dir/",$r)) { + $module = $r[1]; + } else if (ereg('/pear/',"$dir/")) { + $module = 'pear'; + } else { + $module = ''; + } + + $o = opendir($dir) or error("cannot open directory: $dir"); + while (($name = readdir($o))!==false) { + if (is_dir("{$dir}/{$name}") && !in_array($name, array('.', '..', 'CVS'))) { + find_files("{$dir}/{$name}"); + } + + // Cleanup any left-over tmp files from last run. + if (substr($name, -4)=='.tmp') { + @unlink("$dir/$name"); + continue; + } + + // Otherwise we're only interested in *.phpt files. + if (substr($name, -5)=='.phpt') { + $testfile = realpath("{$dir}/{$name}"); + $test_files[] = $testfile; +// $module_of_test[$testfile] = $module; + } + } -{ - $directories = array(); - $directories[] = getcwd(); - for ($n = 0; $n < count($directories); $n++) { - $path = $directories[$n]; - $module = ''; - if (ereg('/ext/([^/]+)/',"$path/",$r)) { - $module = $r[1]; - } else if (ereg('/pear/',"$path/")) { - $module = 'PEAR'; - } - $o = opendir($path) or die("Cannot open directory - $path\n"); - while ($name = readdir($o)) { - if (is_dir("$path/$name")) { - if ('.' == $name) continue; - if ('..' == $name) continue; - if ('CVS' == $name) continue; - $directories[] = "$path/$name"; - continue; - } - - // Cleanup any left-over tmp files from last run. - if (ereg('[.]tmp$',$name)) { - @unlink("$path/$name"); - continue; - } - - // Otherwise we're only interested in *.phpt files. - if (!ereg('[.]phpt$',$name)) continue; - //echo "Runnable '" . $name . "' in '" . $path . "'\n"; - $testfile = realpath("$path/$name"); - $test_files[] = $testfile; - $module_of_test[$testfile] = $module; - } - closedir($o); - } + closedir($o); } // Run only selected tests, if specified. - if (count($test_to_run)) { - echo "Running selected tests.\n"; - while (list($name,$runnable) = each($test_to_run)) { - echo "test: $name runnable: $runnable\n"; - if (!$runnable) continue; - $test_results[$name] = run_test($php,$name); - } - exit; + echo "Running selected tests.\n"; + foreach($test_to_run AS $name=>$runnable) { + echo "test: $name runnable: $runnable\n"; + if ($runnable) { + $test_results[$name] = run_test($php,$name); + } + } + exit(0); } -// We need to know the compiled in modules so we know what to test. +sort($test_files); -$modules_compiled = @get_loaded_extensions(); -$modules_to_test = array( - '' => 1, - 'PEAR' => 1, -); -foreach ($modules_compiled as $module) { - echo "Will test compiled extension: $module\n"; - $modules_to_test[$module] = 1; -} +$start_time = time(); -echo ' +echo "TIME START " . date('Y-m-d H:i:s', $start_time) . " ===================================================================== -'; - -sort($test_files); -$modules_skipped = array(); - -// Run non-module tests. +"; -$module_current = ''; $path_current = ''; foreach ($test_files as $name) { - - // Only non-module tests wanted for this pass. - if ($module_of_test[$name]) continue; $path = dirname($name); if ($path_current != $path) { $path_current = $path; - echo ".... directory $path\n"; + echo " entering directory $path\n"; } $test_results[$name] = run_test($php,$name); } -// Run module tests (or at least those applicable to this PHP build). - -$module_current = ''; -$path_current = ''; -foreach ($test_files as $name) { - $module = $module_of_test[$name]; - - // Already ran non-module tests. - if (!$module) continue; - - if ($module_current != $module) { - $module_current = $module; - echo " ---------------------------------------------------------------------- -.... " . ($modules_to_test[$module] ? "testing " : "skipped ") . ($module ? "extension: $module" : "generic PHP") . " -"; - } - - // Can we run the test for the given module? - if (!$modules_to_test[$module]) { - $modules_skipped[$module] += 1; - $test_results[$name] = 'SKIPPED'; - continue; - } - - $path = dirname($name); - if ($path_current != $path) { - $path_current = $path; - echo ".... directory $path\n"; - } - - // We've gotten this far - run the test! - - $test_results[$name] = run_test($php,$name); -} +$end_time = time(); // Summarize results @@ -264,7 +197,7 @@ } $n_total = count($test_results); -$sum_results = array(); +$sum_results = array('PASSED'=>0, 'SKIPPED'=>0, 'FAILED'=>0); foreach ($test_results as $v) { $sum_results[$v]++; } @@ -275,26 +208,25 @@ echo " ===================================================================== -TIME " . date('Y-m-d H:i:s') . " - end of test run - -TEST RESULT SUMMARY +TIME END " . date('Y-m-d H:i:s', $end_time) . " ===================================================================== +TEST RESULT SUMMARY +--------------------------------------------------------------------- Number of tests : " . sprintf("%4d",$n_total) . " Tests skipped : " . sprintf("%4d (%2.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . " Tests failed : " . sprintf("%4d (%2.1f%%)",$sum_results['FAILED'],$percent_results['FAILED']) . " Tests passed : " . sprintf("%4d (%2.1f%%)",$sum_results['PASSED'],$percent_results['PASSED']) . " +Time taken : " . sprintf("%4d seconds", $end_time - $start_time) . " ===================================================================== -Skipped " . count($modules_skipped) . " extensions "; // // Write the given text to a temporary file, and return the filename. // -function save_text($filename,$text) -{ +function save_text($filename,$text) { $fp = @fopen($filename,'w') - or die("Cannot open file '" . $filename . "'!\n"); + or error("Cannot open file '" . $filename . "' (save_text)"); fwrite($fp,$text); fclose($fp); if (1 < DETAILED) echo " @@ -344,7 +276,7 @@ ); $fp = @fopen($file, "r") - or die("Cannot open test file: $file\n"); + or error("Cannot open test file: $file"); $section = ''; while (!feof($fp)) { @@ -362,14 +294,16 @@ } fclose($fp); - $tmp = dirname($file); - $tmp_skipif = realpath("$tmp/_SKIPIF"); - $tmp_file = realpath("$tmp/_FILE"); - $tmp_post = realpath("$tmp/_POST"); - - @unlink($tmp_skipif); - @unlink($tmp_file); - @unlink($tmp_post); + $tested = trim($section_text['TEST']).' ('.basename($file).')'; + + $tmp = realpath(dirname($file)); + $tmp_skipif = $tmp.uniqid('/phpt.'); + $tmp_file = $tmp.uniqid('/phpt.'); + $tmp_post = $tmp.uniqid('/phpt.'); + + @unlink($tmp_skipif); + @unlink($tmp_file); + @unlink($tmp_post); // Reset environment from any previous test. @@ -382,16 +316,16 @@ putenv("CONTENT_LENGTH="); // Check if test should be skipped. - + if (trim($section_text['SKIPIF'])) { - save_text($tmp_skipif,$section_text['SKIPIF']); - $output = `$php -f $tmp_skipif`; - @unlink($tmp_skipif); - $output = trim($output); - if (0 == strcmp('skip',$output)) { - return 'SKIPPED'; - } - } + save_text($tmp_skipif, $section_text['SKIPIF']); + $output = `$php $tmp_skipif`; + @unlink($tmp_skipif); + if(trim($output)=='skip') { + echo "SKIP $tested\n"; + return 'SKIPPED'; + } + } // We've satisfied the preconditions - run the test! @@ -403,7 +337,7 @@ putenv("PATH_TRANSLATED=$tmp_file"); putenv("SCRIPT_FILENAME=$tmp_file"); - if (isset($section_text['POST'])) { + if (!empty($section_text['POST'])) { $post = trim($section_text['POST']); save_text($tmp_post,$post); @@ -413,7 +347,7 @@ putenv("CONTENT_TYPE=application/x-www-form-urlencoded"); putenv("CONTENT_LENGTH=$content_length"); - $cmd = "$php 2>&1 < $tmp_post"; + $cmd = "$php -f $tmp_file 2>&1 < $tmp_post"; } else { @@ -421,7 +355,7 @@ putenv("CONTENT_TYPE="); putenv("CONTENT_LENGTH="); - $cmd = "$php 2>&1"; + $cmd = "$php -f $tmp_file 2>&1"; } @@ -437,20 +371,18 @@ "; $out = `$cmd`; - + @unlink($tmp_post); @unlink($tmp_file); // Does the output match what is expected? - - $tested = trim($section_text['TEST']); $output = trim(preg_replace('/^(..+\n)+\n/','',$out)); $wanted = trim($section_text['EXPECT']); $output = preg_replace('/\r\n/',"\n",$output); $wanted = preg_replace('/\r\n/',"\n",$wanted); - + $ok = (0 == strcmp($output,$wanted)); if ($ok) { echo "PASS $tested\n"; @@ -459,11 +391,11 @@ // Test failed so we need to report details. - echo "FAIL $tested (" . basename($file) . ").\n"; + echo "FAIL $tested\n"; $logname = ereg_replace('\.phpt$','.log',$file); $log = fopen($logname,'w') - or die("Cannot create test log - $logname\n"); + or error("Cannot create test log - $logname"); fwrite($log," ---- EXPECTED OUTPUT @@ -477,6 +409,11 @@ error_report($file,$logname,$tested); return 'FAILED'; +} + +function error($message) { + echo "ERROR: {$message}\n"; + exit(1); } /* No revision No revision 1.2.2.1 +9 -7 php4/build/build.mk Index: build.mk =================================================================== RCS file: /cvsroot/php-i18n/php4/build/build.mk,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- build.mk 29 Apr 2002 02:26:19 -0000 1.2 +++ build.mk 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -14,27 +14,30 @@ # | Author: Sascha Schumann <sasch****@schum*****> | # +----------------------------------------------------------------------+ # -# $Id: build.mk,v 1.11 2002/02/28 08:25:29 sebastian Exp $ +# $Id: build.mk,v 1.15 2002/06/23 15:47:40 imajes Exp $ # # # Makefile to generate build tools # -SUBDIRS = Zend TSRM +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 = Zend/Makefile.am \ + @echo makefile_am_files = $(ZENDDIR)/Makefile.am \ TSRM/Makefile.am > $@ - @echo config_h_files = Zend/acconfig.h TSRM/acconfig.h >> $@ - @echo config_m4_files = Zend/Zend.m4 TSRM/tsrm.m4 TSRM/threads.m4 \ - Zend/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@ + @echo config_h_files = $(ZENDDIR)/acconfig.h TSRM/acconfig.h >> $@ + @echo config_m4_files = $(ZENDDIR)/Zend.m4 TSRM/tsrm.m4 TSRM/threads.m4 \ + $(ZENDDIR)/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@ $(STAMP): build/buildcheck.sh @build/buildcheck.sh && touch $(STAMP) @@ -66,6 +69,5 @@ @for i in `find . -name .cvsignore`; do \ (cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a || true); \ done - @rm -f $(SUBDIRS) 2>/dev/null || true .PHONY: $(ALWAYS) snapshot cvsclean 1.2.2.1 +4 -3 php4/build/buildcheck.sh Index: buildcheck.sh =================================================================== RCS file: /cvsroot/php-i18n/php4/build/buildcheck.sh,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- buildcheck.sh 29 Apr 2002 02:26:19 -0000 1.2 +++ buildcheck.sh 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -16,7 +16,7 @@ # | Sascha Schumann <sasch****@schum*****> | # +----------------------------------------------------------------------+ # -# $Id: buildcheck.sh,v 1.16 2002/03/04 08:28:57 sas Exp $ +# $Id: buildcheck.sh,v 1.18 2002/06/26 18:42:50 sniper Exp $ # echo "buildconf: checking installation..." @@ -60,8 +60,9 @@ fi # libtool 1.4 or newer -libtool=`which libtool` -if test ! -f "$libtool"; then libtool=`which glibtool`; fi +# Prefer glibtool over libtool for Mac OS X compatibility +libtool=`which glibtool 2> /dev/null` +if test ! -f "$libtool"; then libtool=`which 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." No revision No revision 1.2.2.1 +4 -4 php4/ext/aspell/aspell.c Index: aspell.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/aspell/aspell.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- aspell.c 29 Apr 2002 02:30:38 -0000 1.2 +++ aspell.c 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: aspell.c,v 1.37 2002/02/28 08:25:38 sebastian Exp $ */ +/* $Id: aspell.c,v 1.38 2002/06/26 07:11:46 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -126,7 +126,7 @@ sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type); if(!sc) { - php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin)); + php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin)); RETURN_FALSE; } @@ -160,7 +160,7 @@ sc= (aspell *) zend_list_find(Z_LVAL_PP(scin), &type); if(!sc) { - php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin)); + php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin)); RETURN_FALSE; } if (aspell_check(sc, Z_STRVAL_PP(word))) @@ -192,7 +192,7 @@ sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type); if(!sc) { - php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin)); + php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin)); RETURN_FALSE; } if (aspell_check_raw(sc, Z_STRVAL_PP(word))) No revision No revision 1.2.2.1 +15 -34 php4/ext/bcmath/bcmath.c Index: bcmath.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/bcmath/bcmath.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- bcmath.c 29 Apr 2002 02:30:38 -0000 1.2 +++ bcmath.c 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: bcmath.c,v 1.36 2002/02/28 08:25:41 sebastian Exp $ */ +/* $Id: bcmath.c,v 1.38 2002/06/26 07:12:21 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -47,10 +47,10 @@ STANDARD_MODULE_HEADER, "bcmath", bcmath_functions, - PHP_MINIT(bcmath), - PHP_MSHUTDOWN(bcmath), - PHP_RINIT(bcmath), NULL, + NULL, + PHP_RINIT(bcmath), + PHP_RSHUTDOWN(bcmath), PHP_MINFO(bcmath), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES @@ -65,9 +65,9 @@ #endif /* Storage used for special numbers. */ -bc_num _zero_; -bc_num _one_; -bc_num _two_; +extern bc_num _zero_; +extern bc_num _one_; +extern bc_num _two_; /* Make a copy of a number! Just increments the reference count! */ @@ -85,34 +85,12 @@ } -PHP_MINIT_FUNCTION(bcmath) -{ - extern bc_num _zero_; - extern bc_num _one_; - extern bc_num _two_; - - _zero_ = bc_new_num (1, 0); - _one_ = bc_new_num (1, 0); - _one_->n_value[0] = 1; - _two_ = bc_new_num (1, 0); - _two_->n_value[0] = 2; - persist_alloc(_zero_); - persist_alloc(_one_); - persist_alloc(_two_); - persist_alloc(_zero_->n_ptr); - persist_alloc(_one_->n_ptr); - persist_alloc(_two_->n_ptr); - - return SUCCESS; -} - - - -PHP_MSHUTDOWN_FUNCTION(bcmath) +PHP_RSHUTDOWN_FUNCTION(bcmath) { bc_free_num(&_zero_); bc_free_num(&_one_); bc_free_num(&_two_); + return SUCCESS; } @@ -122,6 +100,9 @@ if (cfg_get_long("bcmath.scale", &bc_precision)==FAILURE) { bc_precision=0; } + + bc_init_numbers(); + return SUCCESS; } @@ -301,7 +282,7 @@ Z_TYPE_P(return_value) = IS_STRING; break; case -1: /* division by zero */ - php_error(E_WARNING, "Division by zero"); + php_error(E_WARNING, "%s(): Division by zero", get_active_function_name(TSRMLS_C)); break; } bc_free_num(&first); @@ -342,7 +323,7 @@ Z_TYPE_P(return_value) = IS_STRING; break; case -1: - php_error(E_WARNING, "Division by zero"); + php_error(E_WARNING, "%s(): Division by zero", get_active_function_name(TSRMLS_C)); break; } bc_free_num(&first); @@ -428,7 +409,7 @@ Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; } else { - php_error(E_WARNING, "Square root of negative number"); + php_error(E_WARNING, "%s(): Square root of negative number", get_active_function_name(TSRMLS_C)); } bc_free_num(&result); return; 1.2.2.1 +2 -3 php4/ext/bcmath/php_bcmath.h Index: php_bcmath.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/bcmath/php_bcmath.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_bcmath.h 29 Apr 2002 02:30:38 -0000 1.2 +++ php_bcmath.h 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_bcmath.h,v 1.10 2002/02/28 08:25:42 sebastian Exp $ */ +/* $Id: php_bcmath.h,v 1.11 2002/06/18 18:51:33 andi Exp $ */ #ifndef PHP_BCMATH_H #define PHP_BCMATH_H @@ -26,9 +26,8 @@ extern zend_module_entry bcmath_module_entry; #define phpext_bcmath_ptr &bcmath_module_entry -PHP_MINIT_FUNCTION(bcmath); -PHP_MSHUTDOWN_FUNCTION(bcmath); PHP_RINIT_FUNCTION(bcmath); +PHP_RSHUTDOWN_FUNCTION(bcmath); PHP_MINFO_FUNCTION(bcmath); PHP_FUNCTION(bcadd); No revision No revision 1.2.2.1 +17 -18 php4/ext/bz2/bz2.c Index: bz2.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/bz2/bz2.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- bz2.c 29 Apr 2002 02:30:39 -0000 1.2 +++ bz2.c 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: bz2.c,v 1.49 2002/04/19 10:06:41 wez Exp $ */ +/* $Id: bz2.c,v 1.52 2002/06/13 16:39:53 andrei Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -170,16 +170,14 @@ #ifdef VIRTUAL_DIR virtual_filepath(path, &path_copy TSRMLS_CC); #else - path_copy = estrdup(path); + path_copy = path; #endif /* try and open it directly first */ bz_file = BZ2_bzopen(path_copy, mode); - if (opened_path == NULL) { - efree(path_copy); - } else if (bz_file) { - *opened_path = path_copy; + if (opened_path && bz_file) { + *opened_path = estrdup(path_copy); } path_copy = NULL; @@ -367,8 +365,7 @@ block_size = 4, /* Block size for compression algorithm */ work_factor = 0, /* Work factor for compression algorithm */ argc; /* Argument count */ - unsigned int size, /* The size to "realloc" to */ - source_len, /* Length of the source data */ + unsigned int source_len, /* Length of the source data */ dest_len; /* Length of the destination buffer */ argc = ZEND_NUM_ARGS(); @@ -387,7 +384,9 @@ dest_len = Z_STRLEN_PP(source) + (0.01 * Z_STRLEN_PP(source)) + 600; /* Allocate the destination buffer */ - dest = emalloc(dest_len + 1); + if (NULL == (dest = emalloc(dest_len + 1))) { + RETURN_LONG(BZ_MEM_ERROR); + } /* Handle the optional arguments */ if (argc > 1) { @@ -401,20 +400,21 @@ } error = BZ2_bzBuffToBuffCompress(dest, - &size, + &dest_len, Z_STRVAL_PP(source), source_len, block_size, 0, work_factor); if (error != BZ_OK) { + efree(dest); RETURN_LONG(error); } else { /* Copy the buffer, we have perhaps allocate alot more than we need, so we erealloc() the buffer to the proper size */ - dest = erealloc(dest, size + 1); - dest[size] = 0; - RETURN_STRINGL(dest, size, 0); + dest = erealloc(dest, dest_len + 1); + dest[dest_len] = 0; + RETURN_STRINGL(dest, dest_len, 0); } } /* }}} */ @@ -449,11 +449,9 @@ /* Depending on the size of the source buffer, either allocate the length of the source buffer or the a default decompression size */ - dest = emalloc( - PHP_BZ_DECOMPRESS_SIZE > Z_STRLEN_PP(source) ? - PHP_BZ_DECOMPRESS_SIZE : - Z_STRLEN_PP(source) - ); + if (NULL == (dest = emalloc(PHP_BZ_DECOMPRESS_SIZE > Z_STRLEN_PP(source) ? PHP_BZ_DECOMPRESS_SIZE : Z_STRLEN_PP(source)))) { + RETURN_LONG(BZ_MEM_ERROR); + } /* (de)Compression Loop */ do { @@ -474,6 +472,7 @@ } while (error == BZ_OUTBUFF_FULL); if (error != BZ_OK) { + efree(dest); RETURN_LONG(error); } else { /* we might have allocated a little to much, so erealloc the buffer No revision No revision 1.2.2.1 +1 -3 php4/ext/bz2/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/bz2/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:39 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.2 +12 -3 php4/ext/calendar/easter.c Index: easter.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/calendar/easter.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- easter.c 19 May 2002 11:16:02 -0000 1.2.2.1 +++ easter.c 9 Jul 2002 09:14:30 -0000 1.2.2.2 @@ -33,13 +33,22 @@ long year, golden, solar, lunar, pfm, dom, tmp, easter; long method = CAL_EASTER_DEFAULT; + /* Default to the current year if year parameter is not given */ + { + time_t a; + struct tm b; + time(&a); + php_localtime_r(&a, &b); + year = 1900 + b.tm_year; + } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "l|l", &year, &method) == FAILURE) { + "|ll", &year, &method) == FAILURE) { return; } if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */ - php_error(E_WARNING, "easter_date() is only valid for years between 1970 and 2037 inclusive"); + php_error(E_WARNING, "%s(): This function is only valid for years between 1970 and 2037 inclusive", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -116,7 +125,7 @@ } /* }}} */ -/* {{{ proto int easter_days([int year]) +/* {{{ proto int easter_days([int year, [int method]]) Return the number of days after March 21 that Easter falls on for a given year (defaults to current year) */ PHP_FUNCTION(easter_days) { No revision No revision 1.2.2.1 +4 -4 php4/ext/ccvs/ccvs.c Index: ccvs.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ccvs/ccvs.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ccvs.c 29 Apr 2002 02:30:40 -0000 1.2 +++ ccvs.c 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ /* -* cvvs.c $Revision: 1.24 $ - PHP4 Interface to the RedHat CCVS API +* cvvs.c $Revision: 1.25 $ - PHP4 Interface to the RedHat CCVS API * ------- * Interfaces RedHat's CCVS [Credit Card Verification System] <http://www.redhat.com/products/ccvs/> * This code is ported from an original php3 interface written by RedHat's Doug DeJulio <ddj****@redha*****> @@ -27,10 +27,10 @@ /* * Code started on 2000.****@09***** by Brendan W. McAdams <bmcad****@php*****> -* $Revision: 1.24 $ +* $Revision: 1.25 $ */ -static char const cvsid[] = "$Id: ccvs.c,v 1.24 2002/02/28 08:25:45 sebastian Exp $"; +static char const cvsid[] = "$Id: ccvs.c,v 1.25 2002/06/26 07:13:13 derick Exp $"; #include <php.h> #include <stdlib.h> @@ -199,7 +199,7 @@ convert_to_string_ex(psess); if (!Z_STRVAL_PP(psess)) { - php_error(E_WARNING, "Invalid session to ccvs_new()"); + php_error(E_WARNING, "%s(): Invalid session", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } No revision No revision 1.2.2.3 +578 -87 php4/ext/com/COM.c Index: COM.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/com/COM.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- COM.c 2 May 2002 22:01:52 -0000 1.2.2.2 +++ COM.c 9 Jul 2002 09:14:30 -0000 1.2.2.3 @@ -15,9 +15,10 @@ | Author: Zeev Suraski <zeev****@zend*****> | | Harald Radi <h.rad****@nme*****> | | Alan Brown <abrow****@pobox*****> | + | Wez Furlong <wez****@thebr*****> | +----------------------------------------------------------------------+ */ - +/* $Id: COM.c,v 1.84 2002/06/26 07:14:45 derick Exp $ */ /* * This module implements support for COM components that support the IDispatch * interface. Both local (COM) and remote (DCOM) components can be accessed. @@ -57,6 +58,7 @@ #include <iostream.h> #include <math.h> +#include <ocidl.h> #include "php.h" #include "php_ini.h" @@ -65,11 +67,12 @@ #include "php_VARIANT.h" static ITypeLib *php_COM_find_typelib(char *search_string, int mode TSRMLS_DC); -static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC); static int do_COM_offget(VARIANT *result, comval *array, pval *property, int cleanup TSRMLS_DC); static int do_COM_propget(VARIANT *var_result, comval *obj, pval *arg_property, int cleanup TSRMLS_DC); static void php_register_COM_class(TSRMLS_D); static void php_COM_init(int module_number TSRMLS_DC); +static char *php_string_from_clsid(const CLSID *clsid TSRMLS_DC); +static int com_enable_events(comval *obj, int enable); static int le_comval; static int codepage; @@ -78,6 +81,9 @@ int resourcecounter = 1; #endif +static unsigned char arg1and2_force_ref[] = + { 2, BYREF_FORCE, BYREF_FORCE }; + function_entry COM_functions[] = { PHP_FE(com_load, NULL) PHP_FE(com_invoke, NULL) @@ -87,6 +93,9 @@ PHP_FE(com_propput, NULL) PHP_FE(com_load_typelib, NULL) PHP_FE(com_isenum, NULL) + PHP_FE(com_event_sink, arg1and2_force_ref) + PHP_FE(com_message_pump, NULL) + PHP_FE(com_print_typeinfo, NULL) PHP_FALIAS(com_get, com_propget, NULL) PHP_FALIAS(com_propset, com_propput, NULL) @@ -261,7 +270,7 @@ C_REFCOUNT(obj) = 1; C_DISPATCH(obj) = pDisp; C_HASTLIB(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &C_TYPEINFO(obj))); - + dispparams.rgvarg = NULL; dispparams.rgdispidNamedArgs = NULL; dispparams.cArgs = 0; @@ -272,9 +281,11 @@ if (C_HASENUM(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), DISPID_NEWENUM, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, var_result, NULL, NULL))) { if (V_VT(var_result) == VT_UNKNOWN) { + V_UNKNOWN(var_result)->lpVtbl->AddRef(V_UNKNOWN(var_result)); C_HASENUM(obj) = SUCCEEDED(V_UNKNOWN(var_result)->lpVtbl->QueryInterface(V_UNKNOWN(var_result), &IID_IEnumVARIANT, (void**)&C_ENUMVARIANT(obj))); } else if (V_VT(var_result) == VT_DISPATCH) { + V_DISPATCH(var_result)->lpVtbl->AddRef(V_DISPATCH(var_result)); C_HASENUM(obj) = SUCCEEDED(V_DISPATCH(var_result)->lpVtbl->QueryInterface(V_DISPATCH(var_result), &IID_IEnumVARIANT, (void**)&C_ENUMVARIANT(obj))); } @@ -358,6 +369,10 @@ { HRESULT hr = S_OK; + com_enable_events(obj, FALSE); + if (obj->sinkdispatch) + obj->sinkdispatch->lpVtbl->Release(obj->sinkdispatch); + if (C_ISREFD(obj)) { C_REFCOUNT(obj) = 1; hr = php_COM_release(obj TSRMLS_CC); @@ -507,40 +522,34 @@ server_name = NULL; } else if (Z_TYPE_P(server_name) == IS_ARRAY) { pval **tmp; - /* DAB: 22 Sept 2001 */ - /* Aha - we have a number of possible */ - /* arguments. They are in the hash */ - /* By name: Server, Domain, Username, Password */ - /* Flags. */ - /* This has been crafted to maintian maximum backward */ - /* compatability, If the server name is specified as a */ - /* string, then the function shoule behave as before */ - /* by defaulting username and password and using the */ - /* (I believe) incorrect CLSCTX_SERVER instantiation */ - /* paramter. However if server is specified in this array */ - /* then we use either CLSCTX_REMOTE_SERVER or whatever */ - /* flags are specified in the array */ + /* DAB: 22 Sept 2001 + * Aha - we have a number of possible arguments. + * They are in the hash By name: Server, Domain, Username, Password + * Flags. + * This has been crafted to maintian maximum backward compatability. + * If the server name is specified as a string, then the function + * should behave as before by defaulting username and password and + * using the (I believe) incorrect CLSCTX_SERVER instantiation + * paramter. However if server is specified in this array then we + * use either CLSCTX_REMOTE_SERVER or whatever flags are specified + * in the array */ HashTable *ht = Z_ARRVAL(*server_name); if (FAILURE == zend_hash_find(ht, "Server", 7, (void **) &tmp)) { server_name = NULL; } else { server_name = *tmp; convert_to_string_ex(&server_name); - /* CLSCTX_SERVER includes INPROC and LOCAL */ - /* SERVER. This means that any local server */ - /* will be instantiated BEFORE even looking */ - /* on a remote server. Thus if we have a */ - /* server name, probably we want to access */ - /* a remote machine or we would not have */ - /* bothered specifying it. So it would be */ - /* wrong to to connect locally. Futher, */ - /* unless the name passed is a GUID, there has */ - /* to be something to map the Prog.Id to GUID */ - /* and unless that has been modified to remove */ - /* the information about local instantiation */ - /* CLSCTX_SERVER would force a local instantiation */ - /* This setting can be overridden below if the user */ - /* specifies a flags element */ + /* CLSCTX_SERVER includes INPROC and LOCAL SERVER. This means + * that any local server will be instantiated BEFORE even + * looking on a remote server. Thus if we have a server name, + * probably we want to access a remote machine or we would not + * have bothered specifying it. So it would be wrong to to + * connect locally. Futher, unless the name passed is a GUID, + * there has to be something to map the Prog.Id to GUID and + * unless that has been modified to remove the information + * about local instantiation CLSCTX_SERVER would force a local + * instantiation This setting can be overridden below if the + * user specifies a flags element */ flags = CLSCTX_REMOTE_SERVER; } if (FAILURE == zend_hash_find(ht, "Username", 9, (void **) &tmp)) { @@ -567,7 +576,7 @@ } } else { if (!INI_INT("com.allow_dcom")) { - php_error(E_WARNING, "DCOM is disabled"); + php_error(E_WARNING, "%s(): DCOM is disabled", get_active_function_name(TSRMLS_C)); RETURN_NULL(); } else { flags = CLSCTX_REMOTE_SERVER; @@ -612,7 +621,7 @@ if (FAILED(hr)) { php_COM_destruct(obj TSRMLS_CC); error_message = php_COM_error_message(hr TSRMLS_CC); - php_error(E_WARNING,"Invalid ProgID, GUID string, or Moniker: %s", error_message); + php_error(E_WARNING, "%s(): Invalid ProgID, GUID string, or Moniker: %s", get_active_function_name(TSRMLS_C), error_message); LocalFree(error_message); RETURN_NULL(); } @@ -670,7 +679,7 @@ if (FAILED(hr)) { error_message = php_COM_error_message(hr TSRMLS_CC); clsid_str = php_string_from_clsid(&clsid TSRMLS_CC); - php_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s",clsid_str,error_message); + php_error(E_WARNING, "%s(): Unable to obtain IDispatch interface for CLSID %s: %s", get_active_function_name(TSRMLS_C), clsid_str, error_message); LocalFree(error_message); efree(clsid_str); php_COM_destruct(obj TSRMLS_CC); @@ -709,7 +718,7 @@ } } - RETURN_LONG(zend_list_insert(obj, IS_COM)); + RETURN_RESOURCE(zend_list_insert(obj, IS_COM)); } /* }}} */ @@ -744,7 +753,7 @@ break; default: - php_error(E_WARNING,"Wrong argument count to IEnumVariant::Next()"); + php_error(E_WARNING, "%s(): Wrong argument count to IEnumVariant::Next()", get_active_function_name(TSRMLS_C)); return FAILURE; } @@ -762,7 +771,7 @@ if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Next(C_ENUMVARIANT(obj), count, pSA->pvData, &count))) { char *error_message = php_COM_error_message(hr TSRMLS_CC); - php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message); + php_error(E_WARNING, "%s(): IEnumVariant::Next() failed: %s", get_active_function_name(TSRMLS_C), error_message); efree(error_message); VariantClear(var_result); return FAILURE; @@ -772,7 +781,7 @@ rgsabound[0].cElements = count; if (FAILED(SafeArrayRedim(pSA, rgsabound))) { char *error_message = php_COM_error_message(hr TSRMLS_CC); - php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message); + php_error(E_WARNING, "%s(): IEnumVariant::Next() failed: %s", get_active_function_name(TSRMLS_C), error_message); efree(error_message); VariantClear(var_result); return FAILURE; @@ -810,7 +819,7 @@ } else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset")) { if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj)))) { char *error_message = php_COM_error_message(hr TSRMLS_CC); - php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message); + php_error(E_WARNING,"%s(): IEnumVariant::Next() failed: %s", get_active_function_name(TSRMLS_C), error_message); efree(error_message); return FAILURE; } @@ -829,12 +838,12 @@ break; default: - php_error(E_WARNING,"Wrong argument count to IEnumVariant::Skip()"); + php_error(E_WARNING, "%s(): Wrong argument count to IEnumVariant::Skip()", get_active_function_name(TSRMLS_C)); return FAILURE; } if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Skip(C_ENUMVARIANT(obj), count))) { char *error_message = php_COM_error_message(hr TSRMLS_CC); - php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message); + php_error(E_WARNING,"%s(): IEnumVariant::Next() failed: %s", get_active_function_name(TSRMLS_C), error_message); efree(error_message); return FAILURE; } @@ -849,7 +858,7 @@ if (FAILED(hr)) { error_message = php_COM_error_message(hr TSRMLS_CC); - php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(function_name), error_message); + php_error(E_WARNING, "%s(): Unable to lookup %s: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(function_name), error_message); LocalFree(error_message); efree(funcname); return FAILURE; @@ -882,10 +891,10 @@ if (FAILED(hr)) { error_message = php_COM_error_message(hr TSRMLS_CC); if (ErrString) { - php_error(E_WARNING,"Invoke() failed: %s %s", error_message, ErrString); + php_error(E_WARNING, "%s(): Invoke() failed: %s %s", get_active_function_name(TSRMLS_C), error_message, ErrString); pefree(ErrString, 1); } else { - php_error(E_WARNING,"Invoke() failed: %s", error_message); + php_error(E_WARNING, "%s(): Invoke() failed: %s", get_active_function_name(TSRMLS_C), error_message); } LocalFree(error_message); return FAILURE; @@ -921,7 +930,7 @@ convert_to_long(object); obj = (comval *)zend_list_find(Z_LVAL_P(object), &type); if (!obj || (type != IS_COM)) { - php_error(E_WARNING,"%d is not a COM object handler", Z_STRVAL_P(function_name)); + php_error(E_WARNING,"%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C), Z_STRVAL_P(function_name)); RETURN_NULL(); } @@ -965,7 +974,7 @@ convert_to_long_ex(&object); obj = (comval *)zend_list_find(Z_LVAL_P(object), &type); if (!obj || (type != IS_COM)) { - php_error(E_WARNING,"%d is not a COM object handler"); + php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -996,7 +1005,7 @@ obj = (comval *)zend_list_find(Z_LVAL_P(object), &type); if (!obj || (type != IS_COM)) { - php_error(E_WARNING,"%d is not a COM object handler"); + php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1004,6 +1013,461 @@ } /* }}} */ +/* {{{ proto bool com_message_pump([int timeoutms]) + Process COM messages, sleeping for up to timeoutms milliseconds */ +PHP_FUNCTION(com_message_pump) +{ + long timeoutms = 0; + MSG msg; + DWORD result; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timeoutms) == FAILURE) + RETURN_FALSE; + + result = MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutms, QS_ALLINPUT); + + if (result == WAIT_OBJECT_0) { + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + /* we processed messages */ + RETVAL_TRUE; + } else { + /* we did not process messages (timed out) */ + RETVAL_FALSE; + } +} +/* }}} */ + + +static int com_enable_events(comval *obj, int enable) +{ + if (obj->sinkdispatch) { + IConnectionPointContainer *cont; + IConnectionPoint *point; + + if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IConnectionPointContainer, (void**)&cont))) { + + if (SUCCEEDED(cont->lpVtbl->FindConnectionPoint(cont, &obj->sinkid, &point))) { + + if (enable) { + point->lpVtbl->Advise(point, (IUnknown*)obj->sinkdispatch, &obj->sinkcookie); + } else { + point->lpVtbl->Unadvise(point, obj->sinkcookie); + } + point->lpVtbl->Release(point); + } + cont->lpVtbl->Release(cont); + } + } + return 0; +} + +static const struct { + VARTYPE vt; + const char *name; +} vt_names[] = { + { VT_NULL, "VT_NULL" }, + { VT_EMPTY, "VT_EMPTY" }, + { VT_UI1, "VT_UI1" }, + { VT_I2, "VT_I2" }, + { VT_I4, "VT_I4" }, + { VT_R4, "VT_R4" }, + { VT_R8, "VT_R8" }, + { VT_BOOL, "VT_BOOL" }, + { VT_ERROR, "VT_ERROR" }, + { VT_CY, "VT_CY" }, + { VT_DATE, "VT_DATE" }, + { VT_BSTR, "VT_BSTR" }, + { VT_DECIMAL, "VT_DECIMAL" }, + { VT_UNKNOWN, "VT_UNKNOWN" }, + { VT_DISPATCH, "VT_DISPATCH" }, + { VT_VARIANT, "VT_VARIANT" }, + { VT_I1, "VT_I1" }, + { VT_UI2, "VT_UI2" }, + { VT_UI4, "VT_UI4" }, + { VT_INT, "VT_INT" }, + { VT_UINT, "VT_UINT" }, + { VT_ARRAY, "VT_ARRAY" }, + { VT_BYREF, "VT_BYREF" }, + { VT_VOID, "VT_VOID" }, + { VT_PTR, "VT_PTR" }, + { VT_HRESULT, "VT_HRESULT" }, + { 0, NULL } +}; + +static inline const char *vt_to_string(VARTYPE vt) +{ + int i; + for (i = 0; vt_names[i].name != NULL; i++) { + if (vt_names[i].vt == vt) + return vt_names[i].name; + } + return "?"; +} + +static int process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid TSRMLS_DC) +{ + TYPEATTR *attr; + FUNCDESC *func; + int i; + OLECHAR *olename; + char *ansiname = NULL; + unsigned int ansinamelen; + int ret = 0; + + if (FAILED(typeinfo->lpVtbl->GetTypeAttr(typeinfo, &attr))) + return 0; + + /* verify that it is suitable */ + if (id_to_name == NULL || attr->typekind == TKIND_DISPATCH) { + + if (guid) + memcpy(guid, &attr->guid, sizeof(GUID)); + + if (printdef) { + char *guidstring; + + typeinfo->lpVtbl->GetDocumentation(typeinfo, MEMBERID_NIL, &olename, NULL, NULL, NULL); + ansiname = php_OLECHAR_to_char(olename, &ansinamelen, codepage TSRMLS_CC); + SysFreeString(olename); + + guidstring = php_string_from_clsid(&attr->guid TSRMLS_CC); + php_printf("class %s { /* GUID=%s */\n", ansiname, guidstring); + efree(guidstring); + + efree(ansiname); + } + + if (id_to_name) + zend_hash_init(id_to_name, 0, NULL, ZVAL_PTR_DTOR, 0); + + /* So we've got the dispatch interface; lets list the event methods */ + for (i = 0; i < attr->cFuncs; i++) { + zval *tmp; + DISPID lastid = 0; /* for props */ + int isprop; + + if (FAILED(typeinfo->lpVtbl->GetFuncDesc(typeinfo, i, &func))) + break; + + isprop = (func->invkind & DISPATCH_PROPERTYGET || func->invkind & DISPATCH_PROPERTYPUT); + + if (!isprop || lastid != func->memid) { + + lastid = func->memid; + + typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, &olename, NULL, NULL, NULL); + ansiname = php_OLECHAR_to_char(olename, &ansinamelen, codepage TSRMLS_CC); + SysFreeString(olename); + + if (printdef) { + int j; + char *funcdesc; + unsigned int funcdesclen, cnames = 0; + BSTR *names; + + names = (BSTR*)emalloc((func->cParams + 1) * sizeof(BSTR)); + + typeinfo->lpVtbl->GetNames(typeinfo, func->memid, names, func->cParams + 1, &cnames); + /* first element is the function name */ + SysFreeString(names[0]); + + php_printf("\t/* DISPID=%d */\n", func->memid); + + if (func->elemdescFunc.tdesc.vt != VT_VOID) { + php_printf("\t/* %s [%d] */\n", + vt_to_string(func->elemdescFunc.tdesc.vt), + func->elemdescFunc.tdesc.vt + ); + } + + if (isprop) { + + typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, NULL, &olename, NULL, NULL); + if (olename) { + funcdesc = php_OLECHAR_to_char(olename, &funcdesclen, codepage TSRMLS_CC); + SysFreeString(olename); + php_printf("\t/* %s */\n", funcdesc); + efree(funcdesc); + } + + php_printf("\tvar $%s;\n\n", ansiname); + + } else { + /* a function */ + + php_printf("\tfunction %s(\n", ansiname); + + for (j = 0; j < func->cParams; j++) { + ELEMDESC *elem = &func->lprgelemdescParam[j]; + + php_printf("\t\t/* %s [%d] ", vt_to_string(elem->tdesc.vt), elem->tdesc.vt); + + if (elem->paramdesc.wParamFlags & PARAMFLAG_FIN) + php_printf("[in]"); + if (elem->paramdesc.wParamFlags & PARAMFLAG_FOUT) + php_printf("[out]"); + + if (elem->tdesc.vt == VT_PTR) { + /* what does it point to ? */ + php_printf(" --> %s [%d] ", + vt_to_string(elem->tdesc.lptdesc->vt), + elem->tdesc.lptdesc->vt + ); + } + + /* when we handle prop put and get, this will look nicer */ + if (j+1 < (int)cnames) { + funcdesc = php_OLECHAR_to_char(names[j+1], &funcdesclen, codepage TSRMLS_CC); + SysFreeString(names[j+1]); + } else { + funcdesc = "???"; + } + + php_printf(" */ %s%s%c\n", + elem->tdesc.vt == VT_PTR ? "&$" : "$", + funcdesc, + j == func->cParams - 1 ? ' ' : ',' + ); + + if (j+1 < (int)cnames) + efree(funcdesc); + } + + php_printf("\t\t)\n\t{\n"); + + typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, NULL, &olename, NULL, NULL); + if (olename) { + funcdesc = php_OLECHAR_to_char(olename, &funcdesclen, codepage TSRMLS_CC); + SysFreeString(olename); + php_printf("\t\t/* %s */\n", funcdesc); + efree(funcdesc); + } + + php_printf("\t}\n"); + } + + efree(names); + } + + if (id_to_name) { + zend_str_tolower(ansiname, ansinamelen); + MAKE_STD_ZVAL(tmp); + ZVAL_STRINGL(tmp, ansiname, ansinamelen, 0); + zend_hash_index_update(id_to_name, func->memid, (void*)&tmp, sizeof(zval *), NULL); + } + } + typeinfo->lpVtbl->ReleaseFuncDesc(typeinfo, func); + + } + + if (printdef) + php_printf("}\n"); + + ret = 1; + } else { + zend_error(E_WARNING, "Thats not a dispatchable interface!! type kind = %08x\n", attr->typekind); + } + + typeinfo->lpVtbl->ReleaseTypeAttr(typeinfo, attr); + + return ret; +} + +static ITypeInfo *locate_typeinfo(char *typelibname, comval *obj, char *dispname, int sink TSRMLS_DC) +{ + ITypeInfo *typeinfo = NULL; + ITypeLib *typelib = NULL; + int gotguid = 0; + GUID iid; + + if (obj) { + if (dispname == NULL && sink) { + IProvideClassInfo2 *pci2; + IProvideClassInfo *pci; + + if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo2, (void**)&pci2))) { + gotguid = SUCCEEDED(pci2->lpVtbl->GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid)); + pci2->lpVtbl->Release(pci2); + } + if (!gotguid && SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo, (void**)&pci))) { + /* examine the available interfaces */ + /* TODO: write some code here */ + pci->lpVtbl->Release(pci); + } + } else if (dispname && C_HASTLIB(obj)) { + unsigned int idx; + /* get the library from the object; the rest will be dealt with later */ + C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &typelib, &idx); + } else if (typelibname == NULL) { + C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &typeinfo); + } + } else if (typelibname) { + /* Fetch the typelibrary and use that to look things up */ + typelib = php_COM_find_typelib(typelibname, CONST_CS TSRMLS_CC); + } + + if (!gotguid && dispname && typelib) { + unsigned short cfound; + MEMBERID memid; + OLECHAR *olename = php_char_to_OLECHAR(dispname, strlen(dispname), CP_ACP TSRMLS_CC); + + cfound = 1; + if (FAILED(typelib->lpVtbl->FindName(typelib, olename, 0, &typeinfo, &memid, &cfound)) || cfound == 0) { + CLSID coclass; + ITypeInfo *coinfo; + + /* assume that it might be a progid instead */ + if (SUCCEEDED(CLSIDFromProgID(olename, &coclass)) && + SUCCEEDED(typelib->lpVtbl->GetTypeInfoOfGuid(typelib, &coclass, &coinfo))) { + + /* enumerate implemented interfaces and pick the one as indicated by sink */ + TYPEATTR *attr; + int i; + + coinfo->lpVtbl->GetTypeAttr(coinfo, &attr); + + for (i = 0; i < attr->cImplTypes; i++) { + HREFTYPE rt; + int tf; + + if (FAILED(coinfo->lpVtbl->GetImplTypeFlags(coinfo, i, &tf))) + continue; + + if ((sink && tf == (IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT)) || + (!sink && (tf & IMPLTYPEFLAG_FSOURCE) == 0)) { + + /* flags match what we are looking for */ + + if (SUCCEEDED(coinfo->lpVtbl->GetRefTypeOfImplType(coinfo, i, &rt))) + if (SUCCEEDED(coinfo->lpVtbl->GetRefTypeInfo(coinfo, rt, &typeinfo))) + break; + + } + } + + coinfo->lpVtbl->ReleaseTypeAttr(coinfo, attr); + coinfo->lpVtbl->Release(coinfo); + } + } + + + efree(olename); + } else if (gotguid) { + typelib->lpVtbl->GetTypeInfoOfGuid(typelib, &iid, &typeinfo); + } + + if (typelib) + typelib->lpVtbl->Release(typelib); + + return typeinfo; +} + +/* {{{ proto bool com_print_typeinfo(mixed comobject | string typelib, string dispinterface, bool wantsink) + Print out a PHP class definition for a dispatchable interface */ +PHP_FUNCTION(com_print_typeinfo) +{ + zval *arg1; + char *ifacename = NULL; + char *typelibname = NULL; + int ifacelen; + zend_bool wantsink = 0; + comval *obj = NULL; + ITypeInfo *typeinfo; + + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/s!b", &arg1, &ifacename, + &ifacelen, &wantsink)) { + RETURN_FALSE; + } + + if (Z_TYPE_P(arg1) == IS_OBJECT && (Z_OBJCE_P(arg1) == &COM_class_entry || !strcmp(Z_OBJCE_P(arg1)->name, "COM"))) { + zval **tmp; + zend_hash_index_find(Z_OBJPROP_P(arg1), 0, (void**)&tmp); + ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM); + } else if (Z_TYPE_P(arg1) == IS_RESOURCE) { + ZEND_FETCH_RESOURCE(obj, comval*, &arg1, -1, "comval", IS_COM); + } else { + convert_to_string(arg1); + typelibname = Z_STRVAL_P(arg1); + } + + typeinfo = locate_typeinfo(typelibname, obj, ifacename, wantsink TSRMLS_CC); + if (typeinfo) { + process_typeinfo(typeinfo, NULL, 1, NULL TSRMLS_CC); + typeinfo->lpVtbl->Release(typeinfo); + RETURN_TRUE; + } else { + zend_error(E_WARNING, "Unable to find typeinfo using the parameters supplied"); + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto bool com_event_sink(mixed comobject, object sinkobject [, mixed sinkinterface]) + Connect events from a COM object to a PHP object */ +PHP_FUNCTION(com_event_sink) +{ + zval *object, *sinkobject, *sink=NULL; + char *dispname = NULL, *typelibname = NULL; + zend_bool gotguid = 0; + comval *obj; + ITypeInfo *typeinfo = NULL; + + RETVAL_FALSE; + + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|z/", &object, &sinkobject, &sink)) { + RETURN_FALSE; + } + + if (Z_TYPE_P(object) == IS_OBJECT && (Z_OBJCE_P(object) == &COM_class_entry || !strcmp(Z_OBJCE_P(object)->name, "COM"))) { + zval **tmp; + zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**)&tmp); + ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM); + } else { + ZEND_FETCH_RESOURCE(obj, comval*, &object, -1, "comval", IS_COM); + } + + if (sink && Z_TYPE_P(sink) == IS_ARRAY) { + /* 0 => typelibname, 1 => dispname */ + zval **tmp; + + if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS) + typelibname = Z_STRVAL_PP(tmp); + if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS) + dispname = Z_STRVAL_PP(tmp); + } else if (sink != NULL) { + convert_to_string(sink); + dispname = Z_STRVAL_P(sink); + } + + typeinfo = locate_typeinfo(typelibname, obj, dispname, 1 TSRMLS_CC); + + if (typeinfo) { + HashTable *id_to_name; + + ALLOC_HASHTABLE(id_to_name); + + if (process_typeinfo(typeinfo, id_to_name, 0, &obj->sinkid TSRMLS_CC)) { + + /* Create the COM wrapper for this sink */ + obj->sinkdispatch = php_COM_export_as_sink(sinkobject, &obj->sinkid, id_to_name TSRMLS_CC); + + /* Now hook it up to the source */ + com_enable_events(obj, TRUE); + RETVAL_TRUE; + + } else { + FREE_HASHTABLE(id_to_name); + } + } + + if (typeinfo) + typeinfo->lpVtbl->Release(typeinfo); + +} +/* }}} */ static int do_COM_offget(VARIANT *result, comval *array, pval *property, int cleanup TSRMLS_DC) { @@ -1036,7 +1500,7 @@ if (FAILED(hr)) { error_message = php_COM_error_message(hr TSRMLS_CC); - php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(arg_property), error_message); + php_error(E_WARNING, "%s(): Unable to lookup %s: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(arg_property), error_message); LocalFree(error_message); efree(propname); if (cleanup) { @@ -1053,10 +1517,10 @@ if (FAILED(hr)) { error_message = php_COM_error_message(hr TSRMLS_CC); if (ErrString) { - php_error(E_WARNING,"PropGet() failed: %s %s", error_message, ErrString); + php_error(E_WARNING, "%s(): PropGet() failed: %s %s", get_active_function_name(TSRMLS_C), error_message, ErrString); pefree(ErrString, 1); } else { - php_error(E_WARNING,"PropGet() failed: %s", error_message); + php_error(E_WARNING, "%s(): PropGet() failed: %s", get_active_function_name(TSRMLS_C), error_message); } LocalFree(error_message); efree(propname); @@ -1095,7 +1559,7 @@ if (FAILED(hr)) { error_message = php_COM_error_message(hr TSRMLS_CC); - php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(arg_property), error_message); + php_error(E_WARNING, "%s(): Unable to lookup %s: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(arg_property), error_message); LocalFree(error_message); efree(propname); @@ -1116,39 +1580,42 @@ if (FAILED(hr)) { error_message = php_COM_error_message(hr TSRMLS_CC); if (ErrString) { - php_error(E_WARNING,"PropPut() failed: %s %s", error_message, ErrString); + php_error(E_WARNING, "%s(): PropPut() failed: %s %s", get_active_function_name(TSRMLS_C), error_message, ErrString); pefree(ErrString, 1); } else { - php_error(E_WARNING,"PropPut() failed: %s", error_message); + php_error(E_WARNING, "%s(): PropPut() failed: %s", get_active_function_name(TSRMLS_C), error_message); } LocalFree(error_message); - efree(propname); FREE_VARIANT(var_result); - FREE_VARIANT(new_value); + + efree(new_value); + efree(propname); RETURN_NULL(); } - dispparams.cArgs = 0; - dispparams.cNamedArgs = 0; + if (return_value) { + dispparams.cArgs = 0; + dispparams.cNamedArgs = 0; - hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result, &ErrString TSRMLS_CC); + hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result, &ErrString TSRMLS_CC); - if (SUCCEEDED(hr)) { - php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC); - } else { - *return_value = *value; - zval_copy_ctor(return_value); - } + if (SUCCEEDED(hr)) { + php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC); + } else { + *return_value = *value; + zval_copy_ctor(return_value); + } - if (ErrString) { - pefree(ErrString, 1); + if (ErrString) { + pefree(ErrString, 1); + } } FREE_VARIANT(var_result); - FREE_VARIANT(new_value); + efree(new_value); // FREE_VARIANT does a VariantClear() which is not desired here ! efree(propname); } @@ -1170,7 +1637,7 @@ convert_to_long(arg_comval); obj = (comval *)zend_list_find(Z_LVAL_P(arg_comval), &type); if (!obj || (type != IS_COM)) { - php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_comval)); + php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C), Z_LVAL_P(arg_comval)); RETURN_NULL(); } convert_to_string_ex(&arg_property); @@ -1204,7 +1671,7 @@ /* obtain comval interface */ obj = (comval *)zend_list_find(Z_LVAL_P(arg_comval), &type); if (!obj || (type != IS_COM)) { - php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_comval)); + php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C), Z_LVAL_P(arg_comval)); RETURN_NULL(); } convert_to_string_ex(&arg_property); @@ -1322,6 +1789,7 @@ obj = obj_prop; php_COM_set(obj, &V_DISPATCH(var_result), TRUE TSRMLS_CC); + VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed } else { php_variant_to_pval(var_result, &return_value, codepage TSRMLS_CC); @@ -1329,7 +1797,6 @@ obj_prop = NULL; } - VariantInit(var_result); // to protect C_DISPATCH(obj) from being freed when var_result is destructed pval_destructor(&overloaded_property->element); } @@ -1346,7 +1813,6 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value) { - pval result; zend_overloaded_element *overloaded_property; zend_llist_element *element; pval **comval_handle; @@ -1416,7 +1882,7 @@ FREE_VARIANT(var_result); overloaded_property = (zend_overloaded_element *) element->data; - do_COM_propput(&result, obj, &overloaded_property->element, value TSRMLS_CC); + do_COM_propput(NULL, obj, &overloaded_property->element, value TSRMLS_CC); FREE_COM(obj_prop); pval_destructor(&overloaded_property->element); @@ -1424,6 +1890,20 @@ return SUCCESS; } +/* create an overloaded COM object from a dispatch pointer */ +PHPAPI zval *php_COM_object_from_dispatch(IDispatch *disp, zval *val TSRMLS_DC) +{ + comval *obj; + zval *zobj; + + ALLOC_COM(obj); + MAKE_STD_ZVAL(zobj); + php_COM_set(obj, &disp, FALSE TSRMLS_CC); + ZVAL_COM_EX(zobj, obj, val); + + return zobj; +} + PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference) { @@ -1526,6 +2006,10 @@ */ search_string = php_strtok_r(search_string, ",", &strtok_buf); + + if (search_string == NULL) + return NULL; + major = php_strtok_r(NULL, ",", &strtok_buf); minor = php_strtok_r(NULL, ",", &strtok_buf); @@ -1672,7 +2156,7 @@ } -static int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC) +PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC) { ITypeComp *TypeComp; int i; @@ -1710,7 +2194,7 @@ while (SUCCEEDED(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc))) { BSTR bstr_ids; zend_constant c; - zval exists, results; + zval exists, results, value; char *const_name; TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount); @@ -1725,25 +2209,27 @@ SysFreeString(bstr_ids); /* Before registering the contsnt, let's see if we can find it */ - if (zend_get_constant(c.name, c.name_len-1, &exists TSRMLS_CC)) { + if (zend_get_constant(c.name, c.name_len - 1, &exists TSRMLS_CC)) { /* Oops, it already exists. No problem if it is defined as the same value */ /* Check to see if they are the same */ if (!compare_function(&results, &c.value, &exists TSRMLS_CC) && INI_INT("com.autoregister_verbose")) { - php_error(E_WARNING,"Type library value %s is already defined and has a different value", c.name); + php_error(E_WARNING, "%s(): Type library value %s is already defined and has a different value", get_active_function_name(TSRMLS_C), c.name); } free(c.name); j++; continue; } - php_variant_to_pval(pVarDesc->lpvarValue, &c.value, codepage TSRMLS_CC); - if (mode & CONST_PERSISTENT) { - zval_persist(&c.value TSRMLS_CC); - mode |= CONST_EFREE_PERSISTENT; - } - c.flags = mode; + php_variant_to_pval(pVarDesc->lpvarValue, &value, codepage TSRMLS_CC); + /* we only import enumerations (=int) */ + if (Z_TYPE(value) == IS_LONG) { + c.flags = mode; + c.value.type = IS_LONG; + c.value.value.lval = Z_LVAL(value); + c.module_number = 0; /* the module number is not available here */ - zend_register_constant(&c TSRMLS_CC); + zend_register_constant(&c TSRMLS_CC); + } j++; } @@ -1754,7 +2240,6 @@ return SUCCESS; } - /* {{{ proto bool com_isenum(object com_module) Grabs an IEnumVariant */ PHP_FUNCTION(com_isenum) @@ -1774,7 +2259,7 @@ zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &comval_handle); obj = (comval *) zend_list_find(Z_LVAL_PP(comval_handle), &type); if (!obj || (type != IS_COM)) { - php_error(E_WARNING,"%s is not a COM object handler", ""); + php_error(E_WARNING,"%s(): %s is not a COM object handler", get_active_function_name(TSRMLS_C), ""); RETURN_FALSE; } @@ -1800,11 +2285,18 @@ php_register_COM_class(TSRMLS_C); } +PHPAPI ZEND_DECLARE_MODULE_GLOBALS(com) + +static void php_com_init_globals(zend_com_globals *com_globals) +{ +} PHP_MINIT_FUNCTION(COM) { + ZEND_INIT_MODULE_GLOBALS(com, php_com_init_globals, NULL); php_COM_init(module_number TSRMLS_CC); php_VARIANT_init(module_number TSRMLS_CC); + php_COM_dispatch_init(module_number TSRMLS_CC); REGISTER_LONG_CONSTANT("CLSCTX_INPROC_SERVER", CLSCTX_INPROC_SERVER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CLSCTX_INPROC_HANDLER", CLSCTX_INPROC_HANDLER, CONST_CS | CONST_PERSISTENT); @@ -1818,7 +2310,6 @@ return SUCCESS; } - PHP_MSHUTDOWN_FUNCTION(COM) { UNREGISTER_INI_ENTRIES(); @@ -1835,7 +2326,7 @@ PHP_MSHUTDOWN(COM), NULL, NULL, - PHP_MINFO(COM), + PHP_MINFO(COM), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES }; 1.2.2.1 +1 -1 php4/ext/com/CREDITS Index: CREDITS =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/com/CREDITS,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- CREDITS 29 Apr 2002 02:30:40 -0000 1.2 +++ CREDITS 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -1,2 +1,2 @@ Win32 COM -Zeev Suraski, Harald Radi, Alan Brown \ No newline at end of file +Alan Brown, Wez Furlong, Harald Radi, Zeev Suraski \ No newline at end of file 1.2.2.1 +1 -0 php4/ext/com/VARIANT.c Index: VARIANT.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/com/VARIANT.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- VARIANT.c 29 Apr 2002 02:30:40 -0000 1.2 +++ VARIANT.c 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -181,6 +181,7 @@ case OE_IS_OBJECT: if (!strcmp(Z_STRVAL(overloaded_property->element), "value")) { + // var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC); } else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) { ZVAL_LONG(&result, V_VT(var_arg)) 1.2.2.1 +13 -4 php4/ext/com/com.h Index: com.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/com/com.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- com.h 29 Apr 2002 02:30:40 -0000 1.2 +++ com.h 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -19,19 +19,28 @@ ITypeInfo *typeinfo; IEnumVARIANT *enumvariant; } i; + IDispatch *sinkdispatch; + GUID sinkid; + DWORD sinkcookie; } comval; END_EXTERN_C() #define ZVAL_COM(z,o) { \ - zval *handle; \ + zval *handle = NULL; \ + ZVAL_COM_EX(z,o,handle) \ + } + +#define ZVAL_COM_EX(z,o,handle) { \ HashTable *properties; \ \ ALLOC_HASHTABLE(properties); \ zend_hash_init(properties, 0, NULL, ZVAL_PTR_DTOR, 0); \ \ - MAKE_STD_ZVAL(handle); \ - ZVAL_LONG(handle, zend_list_insert((o), IS_COM)); \ + if (handle == NULL) { \ + MAKE_STD_ZVAL(handle); \ + } \ + ZVAL_RESOURCE(handle, zend_list_insert((o), IS_COM)); \ \ zval_copy_ctor(handle); \ zend_hash_index_update(properties, 0, &handle, sizeof(zval *), NULL); \ @@ -42,7 +51,7 @@ #define RETURN_COM(o) RETVAL_COM(o) \ return; -#define ALLOC_COM(z) (z) = (comval *) emalloc(sizeof(comval)); \ +#define ALLOC_COM(z) (z) = (comval *) ecalloc(1, sizeof(comval)); \ C_REFCOUNT(z) = 0; #define FREE_COM(z) php_COM_destruct(z TSRMLS_CC); 1.2.2.2 +19 -4 php4/ext/com/conversion.c Index: conversion.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/com/conversion.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- conversion.c 19 May 2002 11:16:03 -0000 1.2.2.1 +++ conversion.c 9 Jul 2002 09:14:30 -0000 1.2.2.2 @@ -56,7 +56,7 @@ case IS_OBJECT: if (!strcmp(Z_OBJCE_P(pval_arg)->name, "VARIANT")) { type = VT_VARIANT|VT_BYREF; - } else if (!strcmp(Z_OBJCE_P(pval_arg)->name, "COM")) { + } else { type = VT_DISPATCH; } break; @@ -155,6 +155,12 @@ } } else { switch (V_VT(var_arg)) { + + case VT_NULL: + case VT_VOID: + ZVAL_NULL(pval_arg); + break; + case VT_UI1: convert_to_long_ex(&pval_arg); V_UI1(var_arg) = (unsigned char) Z_LVAL_P(pval_arg); @@ -211,6 +217,7 @@ /** @todo case IS_STRING: + */ /* string representation of a time value */ default: @@ -262,7 +269,14 @@ break; case VT_DISPATCH: - comval_to_variant(pval_arg, var_arg TSRMLS_CC); + if (!strcmp(Z_OBJCE_P(pval_arg)->name, "COM")) { + comval_to_variant(pval_arg, var_arg TSRMLS_CC); + } else { + V_DISPATCH(var_arg) = php_COM_export_object(pval_arg TSRMLS_CC); + if (V_DISPATCH(var_arg)) { + V_VT(var_arg) = VT_DISPATCH; + } + } if (V_VT(var_arg) != VT_DISPATCH) { VariantInit(var_arg); } @@ -437,7 +451,7 @@ break; default: - php_error(E_WARNING, "Type not supported or not yet implemented."); + php_error(E_WARNING,"Unsupported variant type: %d (0x%X)", V_VT(var_arg), V_VT(var_arg)); } } } @@ -706,9 +720,10 @@ ZVAL_NULL(pval_arg); } else { ALLOC_COM(obj); - php_COM_set(obj, &V_DISPATCH(var_arg), TRUE TSRMLS_CC); + php_COM_set(obj, &V_DISPATCH(var_arg), FALSE TSRMLS_CC); ZVAL_COM(pval_arg, obj); + VariantInit(var_arg); // to protect C_DISPATCH(obj) from being freed when var_result is destructed } } break; 1.2.2.1 +22 -0 php4/ext/com/php_COM.h Index: php_COM.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/com/php_COM.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_COM.h 29 Apr 2002 02:30:40 -0000 1.2 +++ php_COM.h 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -18,6 +18,9 @@ PHP_FUNCTION(com_propput); PHP_FUNCTION(com_load_typelib); PHP_FUNCTION(com_isenum); +PHP_FUNCTION(com_event_sink); +PHP_FUNCTION(com_message_pump); +PHP_FUNCTION(com_print_typeinfo); PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, char **ErrString TSRMLS_DC); PHPAPI HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId TSRMLS_DC); @@ -31,6 +34,13 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value); PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_reference); PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference); +PHPAPI zval *php_COM_object_from_dispatch(IDispatch *disp, zval *val TSRMLS_DC); +PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC); + +/* dispatch.c */ +PHPAPI IDispatch *php_COM_export_object(zval *val TSRMLS_DC); +PHPAPI IDispatch *php_COM_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name TSRMLS_DC); +int php_COM_dispatch_init(int module_number TSRMLS_DC); zend_module_entry COM_module_entry; zend_class_entry COM_class_entry; @@ -43,6 +53,18 @@ #define phpext_com_ptr &COM_module_entry +ZEND_BEGIN_MODULE_GLOBALS(com) + int nothing; +ZEND_END_MODULE_GLOBALS(com) + +PHPAPI ZEND_EXTERN_MODULE_GLOBALS(com); + +#ifdef ZTS +#define COMG(v) TSRMG(com_globals_id, zend_com_globals *, v) +#else +#define COMG(v) (com_globals.v) +#endif + #else #define phpext_com_ptr NULL 1.2.2.1 +1 -1 php4/ext/com/variant.h Index: variant.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/com/variant.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- variant.h 29 Apr 2002 02:30:40 -0000 1.2 +++ variant.h 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -16,7 +16,7 @@ comval *obj; \ ALLOC_COM(obj); \ php_COM_set(obj, &V_DISPATCH(v), TRUE TSRMLS_CC); \ - ZVAL_LONG((z), zend_list_insert(obj, IS_COM)); \ + ZVAL_RESOURCE((z), zend_list_insert(obj, IS_COM)); \ } else { \ php_variant_to_pval((v), (z), codepage TSRMLS_CC); \ FREE_VARIANT(v); \ No revision No revision 1.2.2.1 +82 -82 php4/ext/cpdf/cpdf.c Index: cpdf.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/cpdf/cpdf.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- cpdf.c 29 Apr 2002 02:30:40 -0000 1.2 +++ cpdf.c 9 Jul 2002 09:14:30 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cpdf.c,v 1.41 2002/02/28 08:25:46 sebastian Exp $ */ +/* $Id: cpdf.c,v 1.42 2002/06/26 07:15:03 derick Exp $ */ /* cpdflib.h -- C language API definitions for ClibPDF library * Copyright (C) 1998 FastIO Systems, All Rights Reserved. */ @@ -262,7 +262,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d (type=%d)", id, type); + php_error(E_WARNING, "%s(): Unable to find identifier %d (type=%d)", get_active_function_name(TSRMLS_C), id, type); RETURN_FALSE; } @@ -289,7 +289,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d (type=%d)", id, type); + php_error(E_WARNING, "%s(): Unable to find identifier %d (type=%d)", get_active_function_name(TSRMLS_C), id, type); RETURN_FALSE; } @@ -317,7 +317,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d (type=%d)", id, type); + php_error(E_WARNING, "%s(): Unable to find identifier %d (type=%d)", get_active_function_name(TSRMLS_C), id, type); RETURN_FALSE; } @@ -344,7 +344,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d (type=%d)", id, type); + php_error(E_WARNING, "%s(): Unable to find identifier %d (type=%d)", get_active_function_name(TSRMLS_C), id, type); RETURN_FALSE; } @@ -377,7 +377,7 @@ pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -471,7 +471,7 @@ convert_to_string(arg2); #if APACHE if(strcmp(Z_STRVAL_P(arg2), "-") == 0) - php_error(E_WARNING, "Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead."); + php_error(E_WARNING, "%s(): Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead.", get_active_function_name(TSRMLS_C)); #endif cpdf_setOutputFilename(cpdf, Z_STRVAL_P(arg2)); } @@ -498,7 +498,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } zend_list_delete(id); @@ -536,7 +536,7 @@ width = Z_LVAL_P(argv[4]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -571,7 +571,7 @@ pagenr=Z_LVAL_P(arg2); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -599,7 +599,7 @@ pagenr=Z_LVAL_P(arg2); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -625,7 +625,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -651,7 +651,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -678,7 +678,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -709,7 +709,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -743,7 +743,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -770,7 +770,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -862,12 +862,12 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } /* if(Z_LVAL_P(arg4) > 6) { - php_error(E_WARNING, "Font encoding set to 5"); + php_error(E_WARNING, "%s(): Font encoding set to 5", get_active_function_name(TSRMLS_C)); Z_LVAL_P(arg4) = 5; } */ @@ -895,7 +895,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -922,7 +922,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -949,7 +949,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -976,7 +976,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1003,7 +1003,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1030,7 +1030,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1061,12 +1061,12 @@ matrix=Z_ARRVAL_P(arg2); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } if(zend_hash_num_elements(matrix) != 6) { - php_error(E_WARNING, "Text matrix must have 6 elements"); + php_error(E_WARNING, "%s(): Text matrix must have 6 elements", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1113,7 +1113,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1147,7 +1147,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1174,7 +1174,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1201,7 +1201,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1229,7 +1229,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1255,7 +1255,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1281,7 +1281,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1309,7 +1309,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1337,7 +1337,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1364,7 +1364,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1391,12 +1391,12 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } if((Z_LVAL_P(arg2) > 100) && (Z_LVAL_P(arg2) < 0)) { - php_error(E_WARNING, "Parameter of pdf_setflat() has to between 0 and 100"); + php_error(E_WARNING, "%s(): Parameter has to between 0 and 100", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1423,12 +1423,12 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } if((Z_LVAL_P(arg2) > 2) && (Z_LVAL_P(arg2) < 0)) { - php_error(E_WARNING, "Parameter of pdf_setlinejoin() has to between 0 and 2"); + php_error(E_WARNING, "%s(): Parameter has to between 0 and 2", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1455,12 +1455,12 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } if((Z_LVAL_P(arg2) > 2) && (Z_LVAL_P(arg2) < 0)) { - php_error(E_WARNING, "Parameter of pdf_setlinecap() has to be > 0 and =< 2"); + php_error(E_WARNING, "%s(): Parameter has to be > 0 and =< 2", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1487,12 +1487,12 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } if(Z_DVAL_P(arg2) < 1) { - php_error(E_WARNING, "Parameter of pdf_setmiterlimit() has to be >= 1"); + php_error(E_WARNING, "%s(): Parameter has to be >= 1", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1519,7 +1519,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1549,7 +1549,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1581,7 +1581,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1618,7 +1618,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1659,7 +1659,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1706,7 +1706,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1743,7 +1743,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1781,7 +1781,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1821,7 +1821,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1860,7 +1860,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1899,7 +1899,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1925,7 +1925,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1951,7 +1951,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1978,7 +1978,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2004,7 +2004,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2030,7 +2030,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2057,7 +2057,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2085,7 +2085,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2112,7 +2112,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2139,7 +2139,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2166,7 +2166,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2195,7 +2195,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2224,7 +2224,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2253,7 +2253,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2284,7 +2284,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2311,7 +2311,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2338,7 +2338,7 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2367,13 +2367,13 @@ id=Z_LVAL_P(arg1); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } #if APACHE if(strcmp(Z_STRVAL_P(arg2), "-") == 0) - php_error(E_WARNING, "Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Use cpdf_output_buffer() instead."); + php_error(E_WARNING, "%s(): Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Use cpdf_output_buffer() instead.", get_active_function_name(TSRMLS_C)); #endif cpdf_savePDFmemoryStreamToFile(pdf, Z_STRVAL_P(arg2)); @@ -2414,7 +2414,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2478,7 +2478,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2488,11 +2488,11 @@ ZEND_GET_RESOURCE_TYPE_ID(CPDF_GLOBAL(le_gd), "gd"); if(!CPDF_GLOBAL(le_gd)) { - php_error(E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded."); + php_error(E_ERROR, "%s(): Unable to find handle for GD image stream. Please check the GD extension is loaded.", get_active_function_name(TSRMLS_C)); } if (!im || type != CPDF_GLOBAL(le_gd)) { - php_error(E_WARNING, "cpdf: Unable to find image pointer"); + php_error(E_WARNING, "%s(): Unable to find image pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -2567,7 +2567,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2626,7 +2626,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2683,7 +2683,7 @@ id=Z_LVAL_P(argv[0]); pdf = zend_list_find(id, &type); if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php_error(E_WARNING, "Unable to find identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2691,7 +2691,7 @@ lastoutline = zend_list_find(oid, &type); if(!lastoutline || type!=CPDF_GLOBAL(le_outline)) { lastoutline = NULL; -/* php_error(E_WARNING, "Unable to find last outline entry %d", id); +/* php_error(E_WARNING, "%s(): Unable to find last outline entry %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; */ } No revision No revision 1.2.2.1 +1 -3 php4/ext/crack/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/crack/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:40 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/ctype/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ctype/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:41 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +11 -11 php4/ext/curl/curl.c Index: curl.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/curl/curl.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- curl.c 29 Apr 2002 02:30:41 -0000 1.2 +++ curl.c 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: curl.c,v 1.111 2002/04/03 23:59:36 sterling Exp $ */ +/* $Id: curl.c,v 1.112 2002/06/26 07:19:33 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -318,7 +318,7 @@ t->func, retval, 2, argv TSRMLS_CC); if (error == FAILURE) { - php_error(E_WARNING, "Couldn't call the CURLOPT_WRITEFUNCTION"); + php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_WRITEFUNCTION", get_active_function_name(TSRMLS_C)); length = -1; } else { @@ -372,7 +372,7 @@ t->func, retval, 3, argv TSRMLS_CC); if (error == FAILURE) { - php_error(E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); + php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION", get_active_function_name(TSRMLS_C)); length = -1; } else { @@ -431,7 +431,7 @@ t->func, retval, 2, argv TSRMLS_CC); if (error == FAILURE) { - php_error(E_WARNING, "Couldn't call the CURLOPT_HEADERFUNCTION"); + php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_HEADERFUNCTION", get_active_function_name(TSRMLS_C)); length = -1; } else { @@ -475,12 +475,12 @@ func, retval, 2, argv TSRMLS_CC); if (error == FAILURE) { - php_error(E_WARNING, "Couldn't call the CURLOPT_PASSWDFUNCTION"); + php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_PASSWDFUNCTION", get_active_function_name(TSRMLS_C)); ret = -1; } else { if (Z_STRLEN_P(retval) > buflen) { - php_error(E_WARNING, "Returned password is too long for libcurl to handle"); + php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle", get_active_function_name(TSRMLS_C)); ret = -1; } else { @@ -570,7 +570,7 @@ ch->cp = curl_easy_init(); if (! ch->cp) { - php_error(E_WARNING, "Cannot initialize a new cURL handle"); + php_error(E_WARNING, "%s(): Cannot initialize a new cURL handle", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -771,7 +771,7 @@ postfields = HASH_OF(*zvalue); if (! postfields) { - php_error(E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS"); + php_error(E_WARNING, "%s(): Couldn't get HashTable in CURLOPT_POSTFIELDS", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -827,8 +827,8 @@ ph = HASH_OF(*zvalue); if (! ph) { php_error(E_WARNING, - "You must pass either an object or an array with the CURLOPT_HTTPHEADER," - "CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments"); + "%s(): You must pass either an object or an array with the CURLOPT_HTTPHEADER," + "CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -844,7 +844,7 @@ slist = curl_slist_append(slist, indiv); if (! slist) { efree(indiv); - php_error(E_WARNING, "Couldn't build curl_slist from curl_setopt()"); + php_error(E_WARNING, "%s(): Couldn't build curl_slist", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } zend_llist_add_element(&ch->to_free.str, &indiv); No revision No revision 1.2.2.1 +3 -3 php4/ext/cybercash/cybercash.c Index: cybercash.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/cybercash/cybercash.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- cybercash.c 29 Apr 2002 02:30:41 -0000 1.2 +++ cybercash.c 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cybercash.c,v 1.18 2001/12/11 15:28:58 sebastian Exp $ */ +/* $Id: cybercash.c,v 1.19 2002/06/26 07:20:45 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -105,7 +105,7 @@ macbuff); if (array_init(return_value) == FAILURE) { - php_error(E_WARNING, "Return value from cybercash_encr could not be initialized"); + php_error(E_WARNING, "%s(): Return value could not be initialized", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -156,7 +156,7 @@ macbuff); if (array_init(return_value) == FAILURE) { - php_error(E_WARNING, "Could not initialize Return value from cybercash_decr"); + php_error(E_WARNING, "%s(): Could not initialize return value", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } No revision No revision 1.2.2.1 +1 -3 php4/ext/cybermut/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/cybermut/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:41 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +9 -9 php4/ext/cyrus/cyrus.c Index: cyrus.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/cyrus/cyrus.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- cyrus.c 29 Apr 2002 02:30:41 -0000 1.2 +++ cyrus.c 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cyrus.c,v 1.10 2002/04/23 19:01:31 derick Exp $ */ +/* $Id: cyrus.c,v 1.11 2002/06/26 07:24:47 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -167,11 +167,11 @@ break; case -1: - php_error(E_WARNING, "Invalid hostname: %s", host); + php_error(E_WARNING, "%s(): Invalid hostname: %s", get_active_function_name(TSRMLS_C), host); RETURN_FALSE; case -2: - php_error(E_WARNING, "Invalid port: %d", port); + php_error(E_WARNING, "%s(): Invalid port: %d", get_active_function_name(TSRMLS_C), port); RETURN_FALSE; } @@ -285,7 +285,7 @@ if (! user) { struct passwd *pwd = getpwuid(getuid()); if (! pwd) { - php_error(E_WARNING, "Couldn't determine user id"); + php_error(E_WARNING, "%s(): Couldn't determine user id", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -358,8 +358,8 @@ if (call_user_function_ex(EG(function_table), NULL, callback->function, &retval, 4, argv, 0, NULL TSRMLS_CC) == FAILURE) { - php_error(E_WARNING, "Couldn't call the %s handler", - callback->trigger); + php_error(E_WARNING, "%s(): Couldn't call the %s handler", + get_active_function_name(TSRMLS_C), callback->trigger); } zval_ptr_dtor(argv[0]); @@ -398,7 +398,7 @@ hash = HASH_OF(*z_callback); if (! hash) { php_error(E_WARNING, - "Second argument to cyrus_bind() must be an array or object"); + "%s(): Second argument must be an array or object", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -425,12 +425,12 @@ } if (! callback.trigger) { - php_error(E_WARNING, "You must specify a trigger in your callback"); + php_error(E_WARNING, "%s(): You must specify a trigger in your callback", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (! callback.function) { - php_error(E_WARNING, "You must specify a function in your callback"); + php_error(E_WARNING, "%s(): You must specify a function in your callback", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } No revision No revision 1.2.2.1 +28 -28 php4/ext/db/db.c Index: db.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/db/db.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- db.c 29 Apr 2002 02:30:41 -0000 1.2 +++ db.c 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: db.c,v 1.70 2002/02/28 08:25:55 sebastian Exp $ */ +/* $Id: db.c,v 1.73 2002/06/29 00:40:34 sniper Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -295,7 +295,7 @@ DBM_MODE_TYPE imode; if (filename == NULL) { - php_error(E_WARNING, "NULL filename passed to php_dbm_open()"); + php_error(E_WARNING, "%s(): NULL filename passed", get_active_function_name(TSRMLS_C)); return NULL; } @@ -341,7 +341,7 @@ lockfd = open(lockfn, O_RDWR|O_CREAT, 0644); close(lockfd); } else { - php_error(E_WARNING, "File appears to be locked [%s]\n", lockfn); + php_error(E_WARNING, "%s(): File appears to be locked [%s]", get_active_function_name(TSRMLS_C), lockfn); return -1; } #else /* NFS_HACK */ @@ -352,7 +352,7 @@ flock(lockfd, LOCK_EX); close(lockfd); } else { - php_error(E_WARNING, "Unable to establish lock: %s", filename); + php_error(E_WARNING, "%s(): Unable to establish lock: %s", get_active_function_name(TSRMLS_C), filename); } #endif /* else NFS_HACK */ @@ -369,7 +369,7 @@ if (dbf) { info = (dbm_info *)emalloc(sizeof(dbm_info)); if (!info) { - php_error(E_ERROR, "problem allocating memory!"); + php_error(E_ERROR, "%s(): problem allocating memory!", get_active_function_name(TSRMLS_C)); return NULL; } @@ -381,7 +381,7 @@ return info; } else { #if GDBM - php_error(E_WARNING, "dbmopen_gdbm(%s): %d [%s], %d [%s]", filename, gdbm_errno, gdbm_strerror(gdbm_errno), errno, strerror(errno)); + php_error(E_WARNING, "%s(%s): %d [%s], %d [%s]", get_active_function_name(TSRMLS_C), filename, gdbm_errno, gdbm_strerror(gdbm_errno), errno, strerror(errno)); if (gdbm_errno) ret = gdbm_errno; else if (errno) @@ -391,13 +391,13 @@ #else #if NDBM #if PHP_DEBUG - php_error(E_WARNING, "dbmopen_ndbm(%s): errno = %d [%s]\n", filename, errno, strerror(errno)); + php_error(E_WARNING, "%s(%s): errno = %d [%s]\n", get_active_function_name(TSRMLS_C), filename, errno, strerror(errno)); #endif if (errno) ret=errno; else ret = -1; #else #if PHP_DEBUG - php_error(E_WARNING, "dbmopen_flatfile(%s): errno = %d [%s]\n", filename, errno, strerror(errno)); + php_error(E_WARNING, "%s(%s): errno = %d [%s]\n", get_active_function_name(TSRMLS_C), filename, errno, strerror(errno)); #endif if (errno) ret=errno; else ret = -1; @@ -487,7 +487,7 @@ info = php_find_dbm(id TSRMLS_CC); if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); + php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id)); RETURN_FALSE; } @@ -518,7 +518,7 @@ dbf = info->dbf; if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); + php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C)); return 1; } @@ -547,7 +547,7 @@ info = php_find_dbm(id TSRMLS_CC); if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); + php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id)); RETURN_FALSE; } @@ -580,7 +580,7 @@ dbf = info->dbf; if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); + php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C)); return 1; } @@ -608,7 +608,7 @@ info = php_find_dbm(id TSRMLS_CC); if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); + php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id)); RETURN_FALSE; } @@ -639,7 +639,7 @@ dbf = info->dbf; if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); + php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C)); return(NULL); } @@ -684,18 +684,18 @@ info = php_find_dbm(id TSRMLS_CC); if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); + php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id)); RETURN_FALSE; } - ret = php_dbm_exists(info, Z_STRVAL_P(key)); + ret = php_dbm_exists(info, Z_STRVAL_P(key) TSRMLS_CC); RETURN_LONG(ret); } /* }}} */ /* {{{ php_dbm_exists */ -int php_dbm_exists(dbm_info *info, char *key) { +int php_dbm_exists(dbm_info *info, char *key TSRMLS_DC) { datum key_datum; int ret; DBM_TYPE dbf; @@ -708,7 +708,7 @@ dbf = info->dbf; if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); + php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C)); return(0); } @@ -733,18 +733,18 @@ info = php_find_dbm(id TSRMLS_CC); if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); + php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id)); RETURN_FALSE; } - ret = php_dbm_delete(info, Z_STRVAL_P(key)); + ret = php_dbm_delete(info, Z_STRVAL_P(key) TSRMLS_CC); RETURN_LONG(ret); } /* }}} */ /* {{{ php_dbm_delete */ -int php_dbm_delete(dbm_info *info, char *key) { +int php_dbm_delete(dbm_info *info, char *key TSRMLS_DC) { datum key_datum; int ret; DBM_TYPE dbf; @@ -757,7 +757,7 @@ dbf = info->dbf; if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); + php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C)); return(0); } @@ -780,11 +780,11 @@ info = php_find_dbm(id TSRMLS_CC); if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); + php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id)); RETURN_FALSE; } - ret = php_dbm_first_key(info); + ret = php_dbm_first_key(info TSRMLS_CC); if (!ret) { RETURN_FALSE; } else { @@ -795,14 +795,14 @@ /* {{{ php_dbm_first_key */ -char *php_dbm_first_key(dbm_info *info) { +char *php_dbm_first_key(dbm_info *info TSRMLS_DC) { datum ret_datum; char *ret; DBM_TYPE dbf; dbf = info->dbf; if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); + php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C)); return(NULL); } @@ -842,7 +842,7 @@ info = php_find_dbm(id TSRMLS_CC); if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); + php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id)); RETURN_FALSE; } @@ -871,7 +871,7 @@ dbf = info->dbf; if (!dbf) { - php_error(E_WARNING, "Unable to locate dbm file"); + php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C)); return(NULL); } 1.2.2.1 +4 -4 php4/ext/db/php_db.h Index: php_db.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/db/php_db.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_db.h 29 Apr 2002 02:30:41 -0000 1.2 +++ php_db.h 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_db.h,v 1.16 2002/02/28 08:25:55 sebastian Exp $ */ +/* $Id: php_db.h,v 1.17 2002/06/29 00:40:34 sniper Exp $ */ #ifndef PHP_DB_H @@ -57,9 +57,9 @@ int php_dbm_insert(dbm_info *info, char *key, char *value TSRMLS_DC); char *php_dbm_fetch(dbm_info *info, char *key TSRMLS_DC); int php_dbm_replace(dbm_info *info, char *key, char *value TSRMLS_DC); -int php_dbm_exists(dbm_info *info, char *key); -int php_dbm_delete(dbm_info *info, char *key); -char *php_dbm_first_key(dbm_info *info); +int php_dbm_exists(dbm_info *info, char *key TSRMLS_DC); +int php_dbm_delete(dbm_info *info, char *key TSRMLS_DC); +char *php_dbm_first_key(dbm_info *info TSRMLS_DC); char *php_dbm_nextkey(dbm_info *info, char *key TSRMLS_DC); /* db file functions */ No revision No revision 1.2.2.1 +2 -4 php4/ext/db/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/db/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:41 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -1,5 +1,3 @@ -*.exp -*.out -*.php +*.log phpt.* -test.dbm* +test.dbm No revision No revision 1.2.2.1 +9 -8 php4/ext/dba/dba.c Index: dba.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/dba/dba.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- dba.c 29 Apr 2002 02:30:41 -0000 1.2 +++ dba.c 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba.c,v 1.42 2002/02/28 08:25:57 sebastian Exp $ */ +/* $Id: dba.c,v 1.43 2002/06/26 07:51:59 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -117,9 +117,10 @@ #define DBA_ID_GET \ convert_to_long_ex(id); \ - DBA_IF_NOT_CORRECT_TYPE(Z_LVAL_PP(id)) { \ - php_error(E_WARNING, "Unable to find DBA identifier %d", \ - Z_LVAL_PP(id)); \ + DBA_IF_NOT_CORRECT_TYPE(Z_LVAL_PP(id)) { \ + php_error(E_WARNING, "%s(): Unable to find DBA identifier %d", \ + get_active_function_name(TSRMLS_C), \ + Z_LVAL_PP(id)); \ RETURN_FALSE; \ } @@ -138,7 +139,7 @@ /* check whether the user has write access */ #define DBA_WRITE_CHECK \ if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \ - php_error(E_WARNING, "you cannot perform a modification to a database without proper access"); \ + php_error(E_WARNING, "%s(): you cannot perform a modification to a database without proper access", get_active_function_name(TSRMLS_C)); \ RETURN_FALSE; \ } @@ -317,7 +318,7 @@ strcasecmp(hptr->name, Z_STRVAL_PP(args[2])); hptr++); if(!hptr->name) { - php_error(E_WARNING, "no such handler: %s", Z_STRVAL_PP(args[2])); + php_error(E_WARNING, "%s(): no such handler: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(args[2])); FREENOW; RETURN_FALSE; } @@ -336,7 +337,7 @@ modenr = DBA_TRUNC; break; default: - php_error(E_WARNING, "illegal DBA mode: %s", Z_STRVAL_PP(args[1])); + php_error(E_WARNING, "%s(): illegal DBA mode: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(args[1])); FREENOW; RETURN_FALSE; } @@ -351,7 +352,7 @@ if(hptr->open(info TSRMLS_CC) != SUCCESS) { dba_close(info); - php_error(E_WARNING, "driver initialization failed"); + php_error(E_WARNING, "%s(): driver initialization failed", get_active_function_name(TSRMLS_C)); FREENOW; RETURN_FALSE; } No revision No revision 1.2.2.1 +61 -118 php4/ext/dbase/dbase.c Index: dbase.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/dbase/dbase.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- dbase.c 29 Apr 2002 02:30:42 -0000 1.2 +++ dbase.c 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dbase.c,v 1.58 2002/03/05 00:28:20 fmk Exp $ */ +/* $Id: dbase.c,v 1.59 2002/06/17 02:27:34 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -421,9 +421,9 @@ } /* }}} */ -/* {{{ proto array dbase_get_record(int identifier, int record) - Returns an array representing a record from the database */ -PHP_FUNCTION(dbase_get_record) +/* {{{ php_dbase_get_record + */ +static void php_dbase_get_record(INTERNAL_FUNCTION_PARAMETERS, int assoc) { pval *dbh_id, *record; dbhead_t *dbh; @@ -458,8 +458,8 @@ RETURN_FALSE; } - fnp = NULL; - for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) { + fnp = NULL; + for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) { /* get the value */ str_value = (char *)emalloc(cur_f->db_flen + 1); @@ -467,116 +467,17 @@ cursize = cur_f->db_flen + 1; fnp = erealloc(fnp, cursize); } - snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp)); - - /* now convert it to the right php internal type */ - switch (cur_f->db_type) { - case 'C': - case 'D': - add_next_index_string(return_value, str_value, 1); - break; - case 'I': /* FALLS THROUGH */ - case 'N': - if (cur_f->db_fdc == 0) { - /* Large integers in dbase can be larger than long */ - errno_save = errno; - overflow_test = strtol(str_value, NULL, 10); - if (errno == ERANGE) { - /* If the integer is too large, keep it as string */ - add_next_index_string(return_value, str_value, 1); - } else { - add_next_index_long(return_value, overflow_test); - } - errno = errno_save; - } else { - add_next_index_double(return_value, atof(str_value)); - } - break; - case 'L': /* we used to FALL THROUGH, but now we check for T/Y and F/N - and insert 1 or 0, respectively. db_fdc is the number of - decimals, which we don't care about. 3/14/2001 LEW */ - if ((*str_value == 'T') || (*str_value == 'Y')) { - add_next_index_long(return_value, strtol("1", NULL, 10)); - } else { - if ((*str_value == 'F') || (*str_value == 'N')) { - add_next_index_long(return_value, strtol("0", NULL, 10)); - } else { - add_next_index_long(return_value, strtol(" ", NULL, 10)); - } - } - break; - case 'M': - /* this is a memo field. don't know how to deal with - this yet */ - break; - default: - /* should deal with this in some way */ - break; - } - efree(str_value); - } - efree(fnp); - - /* mark whether this record was deleted */ - if (data[0] == '*') { - add_assoc_long(return_value, "deleted", 1); - } - else { - add_assoc_long(return_value, "deleted", 0); - } - - free(data); -} -/* }}} */ - -/* From Martin Kuba <makub****@aida*****> */ -/* {{{ proto array dbase_get_record_with_names(int identifier, int record) - Returns an associative array representing a record from the database */ -PHP_FUNCTION(dbase_get_record_with_names) -{ - pval *dbh_id, *record; - dbhead_t *dbh; - int dbh_type; - dbfield_t *dbf, *cur_f; - char *data, *fnp, *str_value; - long overflow_test; - int errno_save; - DBase_TLS_VARS; - - if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &dbh_id, &record)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - convert_to_long(record); - - dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type); - if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { - php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id)); - RETURN_FALSE; - } - - if ((data = get_dbf_record(dbh, Z_LVAL_P(record))) == NULL) { - php_error(E_WARNING, "Tried to read bad record %d", Z_LVAL_P(record)); - RETURN_FALSE; - } - - dbf = dbh->db_fields; - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - fnp = (char *)emalloc(dbh->db_rlen); - for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) { - /* get the value */ - str_value = (char *)emalloc(cur_f->db_flen + 1); - sprintf(str_value, cur_f->db_format, get_field_val(data, cur_f, fnp)); + snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp)); /* now convert it to the right php internal type */ switch (cur_f->db_type) { case 'C': case 'D': - add_assoc_string(return_value, cur_f->db_fname, str_value, 1); + if (!assoc) { + add_next_index_string(return_value, str_value, 1); + } else { + add_assoc_string(return_value, cur_f->db_fname, str_value, 1); + } break; case 'I': /* FALLS THROUGH */ case 'N': @@ -586,25 +487,49 @@ overflow_test = strtol(str_value, NULL, 10); if (errno == ERANGE) { /* If the integer is too large, keep it as string */ - add_assoc_string(return_value, cur_f->db_fname, str_value, 1); + if (!assoc) { + add_next_index_string(return_value, str_value, 1); + } else { + add_assoc_string(return_value, cur_f->db_fname, str_value, 1); + } } else { - add_assoc_long(return_value, cur_f->db_fname, overflow_test); + if (!assoc) { + add_next_index_long(return_value, overflow_test); + } else { + add_assoc_long(return_value, cur_f->db_fname, overflow_test); + } } errno = errno_save; } else { - add_assoc_double(return_value, cur_f->db_fname, atof(str_value)); + if (!assoc) { + add_next_index_double(return_value, atof(str_value)); + } else { + add_assoc_double(return_value, cur_f->db_fname, atof(str_value)); + } } break; case 'L': /* we used to FALL THROUGH, but now we check for T/Y and F/N and insert 1 or 0, respectively. db_fdc is the number of decimals, which we don't care about. 3/14/2001 LEW */ if ((*str_value == 'T') || (*str_value == 'Y')) { - add_assoc_long(return_value, cur_f->db_fname,strtol("1", NULL, 10)); + if (!assoc) { + add_next_index_long(return_value, strtol("1", NULL, 10)); + } else { + add_assoc_long(return_value, cur_f->db_fname,strtol("1", NULL, 10)); + } } else { if ((*str_value == 'F') || (*str_value == 'N')) { - add_assoc_long(return_value, cur_f->db_fname,strtol("0", NULL, 10)); + if (!assoc) { + add_next_index_long(return_value, strtol("0", NULL, 10)); + } else { + add_assoc_long(return_value, cur_f->db_fname,strtol("0", NULL, 10)); + } } else { - add_assoc_long(return_value, cur_f->db_fname,strtol(" ", NULL, 10)); + if (!assoc) { + add_next_index_long(return_value, strtol(" ", NULL, 10)); + } else { + add_assoc_long(return_value, cur_f->db_fname,strtol(" ", NULL, 10)); + } } } break; @@ -617,6 +542,7 @@ } efree(str_value); } + efree(fnp); /* mark whether this record was deleted */ @@ -629,6 +555,23 @@ free(data); } /* }}} */ + +/* {{{ proto array dbase_get_record(int identifier, int record) + Returns an array representing a record from the database */ +PHP_FUNCTION(dbase_get_record) +{ + php_dbase_get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* From Martin Kuba <makub****@aida*****> */ +/* {{{ proto array dbase_get_record_with_names(int identifier, int record) + Returns an associative array representing a record from the database */ +PHP_FUNCTION(dbase_get_record_with_names) +{ + php_dbase_get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ /* {{{ proto bool dbase_create(string filename, array fields) Creates a new dBase-format database file */ @@ -783,7 +726,7 @@ } dbh->db_rlen = rlen; - put_dbf_info(dbh); + put_dbf_info(dbh); handle = zend_list_insert(dbh, DBase_GLOBAL(le_dbhead)); RETURN_LONG(handle); No revision No revision 1.2.2.1 +5 -5 php4/ext/dbx/dbx_sybasect.c Index: dbx_sybasect.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/dbx/dbx_sybasect.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- dbx_sybasect.c 29 Apr 2002 02:30:43 -0000 1.2 +++ dbx_sybasect.c 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dbx_sybasect.c,v 1.1 2002/02/18 09:21:51 mboeren Exp $ */ +/* $Id: dbx_sybasect.c,v 1.3 2002/06/18 07:48:41 mfischer Exp $ */ #include "dbx.h" #include "dbx_sybasect.h" @@ -186,7 +186,7 @@ FREE_ZVAL(zval_column_index); return 0; } - if (zend_hash_find(returned_zval->value.obj.properties, "name", 5, (void **) &zv_name)==FAILURE) { + if (zend_hash_find(Z_OBJPROP_P(returned_zval), "name", 5, (void **) &zv_name)==FAILURE) { zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -198,7 +198,7 @@ zval_ptr_dtor(zv_name); FREE_ZVAL(zval_column_index); -// MOVE_RETURNED_TO_RV(rv, returned_zval); +/* MOVE_RETURNED_TO_RV(rv, returned_zval); */ return 1; } @@ -223,7 +223,7 @@ FREE_ZVAL(zval_column_index); return 0; } - if (zend_hash_find(returned_zval->value.obj.properties, "type", 5, (void **) &zv_type)==FAILURE) { + if (zend_hash_find(Z_OBJPROP_P(returned_zval), "type", 5, (void **) &zv_type)==FAILURE) { zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -235,7 +235,7 @@ zval_ptr_dtor(zv_type); FREE_ZVAL(zval_column_index); -// MOVE_RETURNED_TO_RV(rv, returned_zval); +/* MOVE_RETURNED_TO_RV(rv, returned_zval); */ return 1; } No revision No revision 1.2.2.1 +1 -3 php4/ext/dbx/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/dbx/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:43 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -1 php4/ext/dio/dio.c Index: dio.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/dio/dio.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- dio.c 29 Apr 2002 02:30:43 -0000 1.2 +++ dio.c 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -124,7 +124,7 @@ PHP_MINFO_FUNCTION(dio) { php_info_print_table_start(); - php_info_print_table_header(2, "dio support", "enabled"); + php_info_print_table_row(2, "dio support", "enabled"); php_info_print_table_end(); } No revision No revision 1.2.2.1 +1 -3 php4/ext/dio/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/dio/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:43 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:31 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +8 -6 php4/ext/domxml/TODO Index: TODO =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/domxml/TODO,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- TODO 29 Apr 2002 02:30:43 -0000 1.2 +++ TODO 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -1,11 +1,5 @@ 1) Implement the following list entries and thier destructors: - le_domxmldoctypep - le_domxmldtdp - le_domxmlcdatap - le_domxmlpip - le_domxmlcommentp le_domxmlnotationp - le_domxmlentityrefp 2) Use ZEND_FETCH_RESOURCE() macros instead of custom functions. 3) Implement those classes we really want, kill all of the rest. @@ -15,3 +9,11 @@ it ought to be. 7) Fix the many, many memory leaks. 8) Modify new_child to allow creation of attribute, cdata, dtd, etc nodes. +9) implement schema support (libxml2 has it) +10) implement scheme handlers (like in ext/xslt), should be possible with xmlRegisterInputCallbacks +11) implement real sax support + - input (building of dom-tree with sax-events) is almost finished + - started with generating of sax-events from file/string (chregu) + - generating sax-events from dom-tree is a more tricky one (see mailinglist of libxml2) + + 1.2.2.2 +10 -10 php4/ext/domxml/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/domxml/config.m4,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- config.m4 19 May 2002 11:16:03 -0000 1.2.2.1 +++ config.m4 9 Jul 2002 09:14:32 -0000 1.2.2.2 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.38 2002/05/15 12:41:55 chregu Exp $ +dnl $Id: config.m4,v 1.39 2002/06/01 20:14:57 sr Exp $ dnl AC_DEFUN(PHP_DOM_CHECK_VERSION,[ @@ -7,10 +7,10 @@ CPPFLAGS=-I$DOMXML_DIR/include$DOMXML_DIR_ADD AC_MSG_CHECKING(for libxml version) AC_EGREP_CPP(yes,[ - #include <libxml/xmlversion.h> - #if LIBXML_VERSION >= 20414 +#include <libxml/xmlversion.h> +#if LIBXML_VERSION >= 20414 yes - #endif +#endif ],[ AC_MSG_RESULT(>= 2.4.14) ],[ @@ -78,10 +78,10 @@ CPPFLAGS=-I$DOMXSLT_DIR/include AC_MSG_CHECKING(for libxslt version) AC_EGREP_CPP(yes,[ - #include <libxslt/xsltconfig.h> - #if LIBXSLT_VERSION >= 10003 +#include <libxslt/xsltconfig.h> +#if LIBXSLT_VERSION >= 10003 yes - #endif +#endif ],[ AC_MSG_RESULT(>= 1.0.3) ],[ @@ -95,10 +95,10 @@ CPPFLAGS=-I$DOMEXSLT_DIR/include AC_MSG_CHECKING(for libexslt version) AC_EGREP_CPP(yes,[ - #include <libexslt/exsltconfig.h> - #if LIBEXSLT_VERSION >= 600 +#include <libexslt/exsltconfig.h> +#if LIBEXSLT_VERSION >= 600 yes - #endif +#endif ],[ AC_MSG_RESULT(>= 1.0.3) ],[ 1.2.2.1 +2 -2 php4/ext/domxml/domxml.dsp Index: domxml.dsp =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/domxml/domxml.dsp,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- domxml.dsp 29 Apr 2002 02:30:43 -0000 1.2 +++ domxml.dsp 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -44,7 +44,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOMXML" /D ZTS=1 /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D HAVE_DOMXML=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D HAVE_DOMXML=1 /D ZEND_DEBUG=0 /D "DOMXML_EXPORTS" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x406 /d "NDEBUG" @@ -72,7 +72,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOMXML" /D ZTS=1 /YX /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOMXML=1 /FR /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOMXML_EXPORTS" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOMXML=1 /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x406 /d "NDEBUG" 1.2.2.4 +846 -195 php4/ext/domxml/php_domxml.c Index: php_domxml.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/domxml/php_domxml.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- php_domxml.c 19 May 2002 11:16:03 -0000 1.2.2.3 +++ php_domxml.c 9 Jul 2002 09:14:32 -0000 1.2.2.4 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.159 2002/05/19 00:02:05 sniper Exp $ */ +/* $Id: php_domxml.c,v 1.178 2002/07/01 14:48:35 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -34,14 +34,12 @@ #include "ext/standard/info.h" #define PHP_XPATH 1 #define PHP_XPTR 2 -/* DOMXML API_VERSION, please bump it up, if you change anything in the API - therefore it's easier for the script-programmers to check, what's working how - Can be checked with phpversion("domxml"); -*/ -#define DOMXML_API_VERSION "20020516" /* General macros used by domxml */ -#define DOMXML_DOMOBJ_NEW(zval, obj, ret) if (NULL == (zval = php_domobject_new(obj, ret TSRMLS_CC))) { \ + +#define DOMXML_IS_TYPE(zval, ce) (zval && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJCE_P(zval)->refcount == ce->refcount) + +#define DOMXML_DOMOBJ_NEW(zval, obj, ret) if (NULL == (zval = php_domobject_new(obj, ret, zval TSRMLS_CC))) { \ php_error(E_WARNING, "%s(): cannot create required DOM object", \ get_active_function_name(TSRMLS_C)); \ RETURN_FALSE; \ @@ -70,12 +68,12 @@ DOMXML_GET_OBJ(ret, zval, le); #define DOMXML_NO_ARGS() if (ZEND_NUM_ARGS() != 0) { \ - php_error(E_WARNING, "%s() expects exactly 0 parameters, %d given", \ + php_error(E_WARNING, "%s(): expects exactly 0 parameters, %d given", \ get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); \ return; \ } -#define DOMXML_NOT_IMPLEMENTED() php_error(E_WARNING, "%s() not yet implemented", \ +#define DOMXML_NOT_IMPLEMENTED() php_error(E_WARNING, "%s(): not yet implemented", \ get_active_function_name(TSRMLS_C)); \ return; @@ -139,7 +137,7 @@ #define DOMXML_LOAD_RECOVERING 2 #define DOMXML_LOAD_SUBSTITUTE_ENTITIES 4 #define DOMXML_LOAD_COMPLETE_ATTRS 8 - +#define DOMXML_LOAD_DONT_KEEP_BLANKS 16 static int le_domxmldocp; static int le_domxmldoctypep; static int le_domxmldtdp; @@ -152,6 +150,7 @@ static int le_domxmlcommentp; static int le_domxmlnotationp; static int le_domxmlparserp; + /*static int le_domxmlentityp;*/ static int le_domxmlentityrefp; /*static int le_domxmlnsp;*/ @@ -160,6 +159,10 @@ #if HAVE_DOMXSLT static int le_domxsltstylesheetp; #endif +static void domxml_error(void *ctx, const char *msg, ...); +static void domxml_error_ext(void *ctx, const char *msg, ...); +static void domxml_error_validate(void *ctx, const char *msg, ...); +static xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int size, int recovery, void *data); #if defined(LIBXML_XPATH_ENABLED) static int le_xpathctxp; @@ -193,19 +196,23 @@ static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC); static int node_children(zval **children, xmlNode *nodep TSRMLS_DC); +static unsigned char first_args_force_ref[] = { 1, BYREF_FORCE }; +static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE }; +static unsigned char third_args_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; + static zend_function_entry domxml_functions[] = { PHP_FE(domxml_version, NULL) - PHP_FE(xmldoc, NULL) + PHP_FE(xmldoc, third_args_force_ref) PHP_FALIAS(domxml_open_mem, xmldoc, NULL) - PHP_FE(xmldocfile, NULL) + PHP_FE(xmldocfile, third_args_force_ref) PHP_FALIAS(domxml_open_file, xmldocfile, NULL) #if defined(LIBXML_HTML_ENABLED) PHP_FE(html_doc, NULL) PHP_FE(html_doc_file, NULL) #endif - PHP_FE(domxml_xmltree, NULL) - PHP_FALIAS(xmltree, domxml_xmltree, NULL) - PHP_FE(domxml_substitute_entities_default, NULL) + PHP_FE(domxml_xmltree, NULL) + PHP_FALIAS(xmltree, domxml_xmltree, NULL) + PHP_FE(domxml_substitute_entities_default, NULL) PHP_FE(domxml_doc_document_element, NULL) PHP_FE(domxml_doc_add_root, NULL) PHP_FE(domxml_doc_set_root, NULL) @@ -226,10 +233,22 @@ PHP_FE(domxml_node_set_content, NULL) PHP_FE(domxml_node_get_content, NULL) PHP_FE(domxml_new_xmldoc, NULL) - PHP_FALIAS(domxml_new_doc, domxml_new_xmldoc, NULL) + PHP_FALIAS(domxml_new_doc, domxml_new_xmldoc, NULL) PHP_FE(domxml_parser, NULL) PHP_FE(domxml_parser_add_chunk, NULL) PHP_FE(domxml_parser_end, NULL) + PHP_FE(domxml_parser_start_element, NULL) + PHP_FE(domxml_parser_end_element, NULL) + PHP_FE(domxml_parser_comment, NULL) + PHP_FE(domxml_parser_characters, NULL) + PHP_FE(domxml_parser_entity_reference, NULL) + PHP_FE(domxml_parser_processing_instruction, NULL) + PHP_FE(domxml_parser_cdata_section, NULL) + PHP_FE(domxml_parser_namespace_decl, NULL) + PHP_FE(domxml_parser_start_document, NULL) + PHP_FE(domxml_parser_end_document, NULL) + PHP_FE(domxml_parser_get_document, NULL) + #if defined(LIBXML_XPATH_ENABLED) PHP_FE(xpath_new_context, NULL) PHP_FE(xpath_eval, NULL) @@ -264,12 +283,13 @@ PHP_FALIAS(set_content, domxml_node_set_content, NULL) PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL) PHP_FALIAS(domxml_dumpmem, domxml_dump_mem, NULL) - + PHP_FE(domxml_doc_validate, second_args_force_ref) {NULL, NULL, NULL} }; static function_entry php_domxmldoc_class_functions[] = { + PHP_FALIAS(domdocument, xmldoc, NULL) PHP_FALIAS(doctype, domxml_doc_doctype, NULL) PHP_FALIAS(implementation, domxml_doc_implementation, NULL) PHP_FALIAS(document_element, domxml_doc_document_element, NULL) @@ -304,6 +324,8 @@ PHP_FALIAS(xpath_new_context, xpath_new_context, NULL) PHP_FALIAS(xptr_new_context, xptr_new_context, NULL) #endif + PHP_FALIAS(validate, domxml_doc_validate, first_args_force_ref) + {NULL, NULL, NULL} }; @@ -311,6 +333,18 @@ PHP_FALIAS(add_chunk, domxml_parser_add_chunk, NULL) PHP_FALIAS(end, domxml_parser_end, NULL) PHP_FALIAS(set_keep_blanks, domxml_parser_set_keep_blanks, NULL) + PHP_FALIAS(start_element, domxml_parser_start_element, NULL) + PHP_FALIAS(end_element, domxml_parser_end_element, NULL) + PHP_FALIAS(characters, domxml_parser_characters, NULL) + PHP_FALIAS(entity_reference, domxml_parser_entity_reference, NULL) + PHP_FALIAS(processing_instruction, domxml_parser_processing_instruction, NULL) + PHP_FALIAS(cdata_section, domxml_parser_cdata_section, NULL) + PHP_FALIAS(comment, domxml_parser_comment, NULL) + PHP_FALIAS(namespace_decl, domxml_parser_namespace_decl, NULL) + PHP_FALIAS(start_document, domxml_parser_start_document, NULL) + PHP_FALIAS(end_document, domxml_parser_end_document, NULL) + PHP_FALIAS(get_document, domxml_parser_get_document, NULL) + {NULL, NULL, NULL} }; @@ -371,29 +405,34 @@ }; static zend_function_entry php_domxmlelement_class_functions[] = { - PHP_FALIAS(domelement, domxml_element, NULL) + PHP_FALIAS(domelement, domxml_doc_create_element, NULL) PHP_FALIAS(name, domxml_elem_tagname, NULL) PHP_FALIAS(tagname, domxml_elem_tagname, NULL) PHP_FALIAS(get_attribute, domxml_elem_get_attribute, NULL) PHP_FALIAS(set_attribute, domxml_elem_set_attribute, NULL) PHP_FALIAS(remove_attribute, domxml_elem_remove_attribute, NULL) PHP_FALIAS(get_attribute_node, domxml_elem_get_attribute_node, NULL) +/* since this function is not implemented, outcomment it for the time beeing PHP_FALIAS(set_attribute_node, domxml_elem_set_attribute_node, NULL) +*/ PHP_FALIAS(get_elements_by_tagname, domxml_elem_get_elements_by_tagname, NULL) PHP_FALIAS(has_attribute, domxml_elem_has_attribute, NULL) {NULL, NULL, NULL} }; static zend_function_entry php_domxmlcdata_class_functions[] = { + PHP_FALIAS(domcdata, domxml_doc_create_cdata_section,NULL) PHP_FALIAS(length, domxml_cdata_length, NULL) {NULL, NULL, NULL} }; static zend_function_entry php_domxmltext_class_functions[] = { + PHP_FALIAS(domtext, domxml_doc_create_text_node, NULL) {NULL, NULL, NULL} }; static zend_function_entry php_domxmlcomment_class_functions[] = { + PHP_FALIAS(domcomment, domxml_doc_create_comment, NULL) {NULL, NULL, NULL} }; @@ -404,6 +443,7 @@ }; static zend_function_entry php_domxmlentityref_class_functions[] = { + PHP_FALIAS(domentityreference, domxml_doc_create_entity_reference, NULL) {NULL, NULL, NULL} }; @@ -417,6 +457,7 @@ }; static zend_function_entry php_domxmlpi_class_functions[] = { + PHP_FALIAS(domprocessinginstruction, domxml_doc_create_processing_instruction, NULL) PHP_FALIAS(target, domxml_pi_target, NULL) PHP_FALIAS(data, domxml_pi_data, NULL) {NULL, NULL, NULL} @@ -436,6 +477,12 @@ #endif static zend_function_entry php_domxmlattr_class_functions[] = { + PHP_FALIAS(domattribute, domxml_doc_create_attribute, NULL) + /* DOM_XML Consistent calls */ + PHP_FALIAS(node_name, domxml_attr_name, NULL) + PHP_FALIAS(node_value, domxml_attr_value, NULL) + PHP_FALIAS(node_specified, domxml_attr_specified, NULL) + /* W3C compliant calls */ PHP_FALIAS(name, domxml_attr_name, NULL) PHP_FALIAS(value, domxml_attr_value, NULL) PHP_FALIAS(specified, domxml_attr_specified, NULL) @@ -488,8 +535,7 @@ static zval *dom_object_get_data(void *obj) { -/* - char tmp[20]; +/* char tmp[20]; sprintf(tmp, "%08X", obj); fprintf(stderr, "Trying getting %s from object ...", tmp); if(((xmlNodePtr) obj)->_private) @@ -588,12 +634,12 @@ { xmlNodePtr node = (xmlNodePtr) rsrc->ptr; - /* if node has no parent, it will not be freed by php_free_xml_doc, so do it here + /* if node has no parent, it will not be freed by php_free_xml_doc, so do it here and for all children as well. */ if (node->parent == NULL) { attr_list_wrapper_dtor(node->properties); node_list_wrapper_dtor(node->children); - node_wrapper_dtor(node); + node_wrapper_dtor(node); xmlFreeNode(node); } else { node_wrapper_dtor(node); @@ -635,7 +681,7 @@ if (parser) { zval *wrapper = dom_object_get_data(parser); - zval_ptr_dtor(&wrapper); + zval_ptr_dtor(&wrapper); xmlFreeParserCtxt(parser); } } @@ -684,7 +730,7 @@ int type; if (NULL == wrapper) { - php_error(E_WARNING, "xsltstylesheet_get_object() invalid wrapper object passed"); + php_error(E_WARNING, "xsltstylesheet_get_object() invalid wrapper object passed", get_active_function_name(TSRMLS_C)); return NULL; } @@ -983,6 +1029,50 @@ return (wrapper); } +/* {{{ php_xmlparser_make_params() + Translates a PHP array to a xmlparser parameters array */ +static char **php_xmlparser_make_params(zval *idvars TSRMLS_DC) +{ + HashTable *parht; + int parsize; + zval **value; + char *expr, *string_key = NULL; + ulong num_key; + char **params = NULL; + int i = 0; + + parht = HASH_OF(idvars); + parsize = (2 * zend_hash_num_elements(parht) + 1) * sizeof(char *); + params = (char **)emalloc(parsize); + memset((char *)params, 0, parsize); + + for (zend_hash_internal_pointer_reset(parht); + zend_hash_get_current_data(parht, (void **)&value) == SUCCESS; + zend_hash_move_forward(parht)) { + + if (zend_hash_get_current_key(parht, &string_key, &num_key, 1) != HASH_KEY_IS_STRING) { + php_error(E_WARNING, "%s(): Invalid argument or parameter array", + get_active_function_name(TSRMLS_C)); + return NULL; + } + else { + SEPARATE_ZVAL(value); + convert_to_string_ex(value); + expr = Z_STRVAL_PP(value); + + if (expr) { + params[i++] = string_key; + params[i++] = expr; + } + } + } + + params[i++] = NULL; + + return params; +} +/* }}} */ +/* end parser stuff */ void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC) { @@ -1036,7 +1126,7 @@ } -static zval *php_domobject_new(xmlNodePtr obj, int *found TSRMLS_DC) +PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval *wrapper_in TSRMLS_DC) { zval *wrapper; char *content; @@ -1045,7 +1135,12 @@ *found = 0; if (!obj) { - MAKE_STD_ZVAL(wrapper); + if(!wrapper_in) + { + MAKE_STD_ZVAL(wrapper); + } + else + wrapper = wrapper_in; ZVAL_NULL(wrapper); return wrapper; } @@ -1056,14 +1151,20 @@ return wrapper; } - MAKE_STD_ZVAL(wrapper); + if(!wrapper_in) + { + MAKE_STD_ZVAL(wrapper); + } + else + wrapper = wrapper_in; switch (Z_TYPE_P(obj)) { case XML_ELEMENT_NODE: { xmlNodePtr nodep = obj; - object_init_ex(wrapper, domxmlelement_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmlelement_class_entry); rsrc_type = le_domxmlelementp; add_property_long(wrapper, "type", Z_TYPE_P(nodep)); add_property_stringl(wrapper, "tagname", (char *) nodep->name, strlen(nodep->name), 1); @@ -1073,7 +1174,8 @@ case XML_TEXT_NODE: { xmlNodePtr nodep = obj; - object_init_ex(wrapper, domxmltext_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmltext_class_entry); rsrc_type = le_domxmltextp; content = xmlNodeGetContent(nodep); add_property_long(wrapper, "type", Z_TYPE_P(nodep)); @@ -1087,7 +1189,8 @@ case XML_COMMENT_NODE: { xmlNodePtr nodep = obj; - object_init_ex(wrapper, domxmlcomment_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmlcomment_class_entry); rsrc_type = le_domxmlcommentp; content = xmlNodeGetContent(nodep); if (content) { @@ -1102,7 +1205,8 @@ case XML_PI_NODE: { xmlNodePtr nodep = obj; - object_init_ex(wrapper, domxmlpi_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmlpi_class_entry); rsrc_type = le_domxmlpip; content = xmlNodeGetContent(nodep); add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1); @@ -1116,7 +1220,8 @@ case XML_ENTITY_REF_NODE: { xmlNodePtr nodep = obj; - object_init_ex(wrapper, domxmlentityref_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmlentityref_class_entry); rsrc_type = le_domxmlentityrefp; add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1); break; @@ -1126,7 +1231,8 @@ case XML_ELEMENT_DECL: { xmlNodePtr nodep = obj; - object_init_ex(wrapper, domxmlnode_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmlnode_class_entry); rsrc_type = le_domxmlnodep; add_property_long(wrapper, "type", Z_TYPE_P(nodep)); add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1); @@ -1143,7 +1249,8 @@ case XML_ATTRIBUTE_NODE: { xmlAttrPtr attrp = (xmlAttrPtr) obj; - object_init_ex(wrapper, domxmlattr_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmlattr_class_entry); rsrc_type = le_domxmlattrp; add_property_long(wrapper, "type", Z_TYPE_P(attrp)); add_property_stringl(wrapper, "name", (char *) attrp->name, strlen(attrp->name), 1); @@ -1160,7 +1267,8 @@ { xmlDocPtr docp = (xmlDocPtr) obj; - object_init_ex(wrapper, domxmldoc_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmldoc_class_entry); rsrc_type = le_domxmldocp; if (docp->name) add_property_stringl(wrapper, "name", (char *) docp->name, strlen(docp->name), 1); @@ -1199,7 +1307,8 @@ case XML_DOCUMENT_TYPE_NODE: { xmlDtdPtr dtd = (xmlDtdPtr) obj; - object_init_ex(wrapper, domxmldoctype_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmldoctype_class_entry); /* rsrc_type = le_domxmldtdp; */ rsrc_type = le_domxmldoctypep; /* add_property_long(wrapper, "type", Z_TYPE_P(dtd)); */ @@ -1220,7 +1329,8 @@ case XML_CDATA_SECTION_NODE: { xmlNodePtr nodep = obj; - object_init_ex(wrapper, domxmlcdata_class_entry); + if(!wrapper_in) + object_init_ex(wrapper, domxmlcdata_class_entry); rsrc_type = le_domxmlcdatap; content = xmlNodeGetContent(nodep); add_property_long(wrapper, "type", Z_TYPE_P(nodep)); @@ -1241,7 +1351,6 @@ return (wrapper); } - static void domxml_error(void *ctx, const char *msg, ...) { char buf[1024]; @@ -1252,13 +1361,153 @@ php_error(E_WARNING, buf); } +static void domxml_error_ext(void *ctx, const char *msg, ...) +{ + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + xmlParserInputPtr input = NULL; + char buf[1024]; + va_list ap; + + va_start(ap, msg); + vsnprintf(buf, 1024, msg, ap); + va_end(ap); + + if (ctxt != NULL && ctxt->_private != NULL) { + zval *errormessages; + MAKE_STD_ZVAL(errormessages); + + if(array_init(errormessages) != SUCCESS) { + // do error handling here + } + add_assoc_string(errormessages,"errormessage",buf,1); + input = ctxt->input; + add_assoc_string(errormessages,"nodename",ctxt->name,1); + if (input != NULL) { + add_assoc_long(errormessages,"line",input->line); + add_assoc_long(errormessages,"col",input->col); + if (input->filename != NULL) { + add_assoc_string(errormessages,"directory",(char *) input->directory,1); + add_assoc_string(errormessages,"file",(char *) input->filename,1); + } + } + add_next_index_zval(ctxt->_private,errormessages); + } + php_error(E_WARNING, buf); + +} + +static void domxml_error_validate(void *ctx, const char *msg, ...) +{ + domxml_ErrorCtxt *ctxt ; + char buf[1024]; + + va_list ap; + + va_start(ap, msg); + vsnprintf(buf, 1024, msg, ap); + va_end(ap); + ctxt = (domxml_ErrorCtxt*) ctx; + + if (ctxt != NULL && ctxt->errors != NULL) { + zval *errormessages; + MAKE_STD_ZVAL(errormessages); + if(array_init(errormessages) != SUCCESS) { + // do error handling here + } + if (ctxt->parser != NULL) { + add_assoc_string(errormessages,"nodename",ctxt->parser->name,1); + + if (ctxt->parser->input != NULL) { + add_assoc_long(errormessages,"line",ctxt->parser->input->line); + add_assoc_long(errormessages,"col",ctxt->parser->input->col); + if (ctxt->parser->input->filename != NULL) { + add_assoc_string(errormessages,"directory",(char *) ctxt->parser->input->directory,1); + add_assoc_string(errormessages,"file",(char *) ctxt->parser->input->filename,1); + } + } + } + + if (ctxt->valid->node != NULL) + { +// php_error(E_WARNING,"nodename %s",(char *) ctxt->valid->name); + +// node = *ctxt->node; + } + add_assoc_string(errormessages,"errormessage",buf,1); + add_next_index_zval(ctxt->errors,errormessages); + } + + php_error(E_WARNING, buf); + +} + +xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int size, int recovery, void *data) { + + xmlDocPtr ret; + xmlParserCtxtPtr ctxt; + domxml_ErrorCtxt errorCtxt; + char *directory = NULL; + + xmlInitParser(); + /*if size == -1, we assume, it's a filename not a inmemory xml doc*/ + if (size == -1) { + ctxt = (xmlParserCtxt *) xmlCreateFileParserCtxt( buffer); + } else { + ctxt = (xmlParserCtxt *) xmlCreateMemoryParserCtxt((xmlChar *) buffer, size); + } + if (ctxt == NULL) { + return(NULL); + } + if (sax != NULL) { + if (ctxt->sax != NULL) + xmlFree(ctxt->sax); + ctxt->sax = sax; + } + if (data!=NULL) { + ctxt->_private=data; + } + + /* store directory name */ + if (size == -1) { + if ((ctxt->directory == NULL) && (directory == NULL)) + directory = xmlParserGetDirectory(buffer); + if ((ctxt->directory == NULL) && (directory != NULL)) + ctxt->directory = (char *) xmlStrdup((xmlChar *) directory); + } + errorCtxt.valid = &ctxt->vctxt; + errorCtxt.errors = data; + errorCtxt.parser = ctxt; + + ctxt->sax->error = domxml_error_ext; + ctxt->sax->warning = domxml_error_ext; + ctxt->vctxt.userData= (void *) &errorCtxt; + ctxt->vctxt.error = (xmlValidityErrorFunc) domxml_error_validate; + ctxt->vctxt.warning = (xmlValidityWarningFunc) domxml_error_validate; + + xmlParseDocument(ctxt); + + if ((ctxt->wellFormed) || recovery) { + ret = ctxt->myDoc; + } else { + ret = NULL; + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } + if (sax != NULL) + ctxt->sax = NULL; + + xmlFreeParserCtxt(ctxt); + + return(ret); +} PHP_RINIT_FUNCTION(domxml) { return SUCCESS; } - +/* PHP_MINIT_FUNCTION(domxml) + */ PHP_MINIT_FUNCTION(domxml) { zend_class_entry ce; @@ -1292,49 +1541,49 @@ le_domxsltstylesheetp = zend_register_list_destructors_ex(php_free_xslt_stylesheet, NULL, "xsltstylesheet", module_number); #endif - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomNode", php_domxmlnode_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domnode", php_domxmlnode_class_functions, NULL, NULL, NULL); domxmlnode_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomDocument", php_domxmldoc_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domdocument", php_domxmldoc_class_functions, NULL, NULL, NULL); domxmldoc_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomParser", php_domxmlparser_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domparser", php_domxmlparser_class_functions, NULL, NULL, NULL); domxmlparser_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomDocumentType", php_domxmldoctype_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domdocumenttype", php_domxmldoctype_class_functions, NULL, NULL, NULL); domxmldoctype_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "Dtd", php_domxmldtd_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "dtd", php_domxmldtd_class_functions, NULL, NULL, NULL); domxmldtd_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomElement", php_domxmlelement_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domelement", php_domxmlelement_class_functions, NULL, NULL, NULL); domxmlelement_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomAttribute", php_domxmlattr_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domattribute", php_domxmlattr_class_functions, NULL, NULL, NULL); domxmlattr_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomCData", php_domxmlcdata_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domcdata", php_domxmlcdata_class_functions, NULL, NULL, NULL); domxmlcdata_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomText", php_domxmltext_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domtext", php_domxmltext_class_functions, NULL, NULL, NULL); domxmltext_class_entry = zend_register_internal_class_ex(&ce, domxmlcdata_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomComment", php_domxmlcomment_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domcomment", php_domxmlcomment_class_functions, NULL, NULL, NULL); domxmlcomment_class_entry = zend_register_internal_class_ex(&ce, domxmlcdata_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomProcessingInstruction", php_domxmlpi_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domprocessinginstruction", php_domxmlpi_class_functions, NULL, NULL, NULL); domxmlpi_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomNotation", php_domxmlnotation_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domnotation", php_domxmlnotation_class_functions, NULL, NULL, NULL); domxmlnotation_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomEntity", php_domxmlentity_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domentity", php_domxmlentity_class_functions, NULL, NULL, NULL); domxmlentity_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomEntityReference", php_domxmlentityref_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domentityreference", php_domxmlentityref_class_functions, NULL, NULL, NULL); domxmlentityref_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL TSRMLS_CC); - INIT_OVERLOADED_CLASS_ENTRY(ce, "DomNamespace", php_domxmlns_class_functions, NULL, NULL, NULL); + INIT_OVERLOADED_CLASS_ENTRY(ce, "domnamespace", php_domxmlns_class_functions, NULL, NULL, NULL); domxmlns_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC); #if defined(LIBXML_XPATH_ENABLED) @@ -1399,7 +1648,7 @@ REGISTER_LONG_CONSTANT("DOMXML_LOAD_RECOVERING", DOMXML_LOAD_RECOVERING, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("DOMXML_LOAD_SUBSTITUTE_ENTITIES", DOMXML_LOAD_SUBSTITUTE_ENTITIES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("DOMXML_LOAD_COMPLETE_ATTRS",DOMXML_LOAD_COMPLETE_ATTRS, CONST_CS | CONST_PERSISTENT); - + REGISTER_LONG_CONSTANT("DOMXML_LOAD_DONT_KEEP_BLANKS",DOMXML_LOAD_DONT_KEEP_BLANKS, CONST_CS | CONST_PERSISTENT); xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error); #if HAVE_DOMXSLT xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error); @@ -1408,10 +1657,9 @@ #endif #endif - return SUCCESS; } - +/* }}} */ /* {{{ proto int domxml_test(int id) Unity function for testing */ @@ -1427,14 +1675,18 @@ } /* }}} */ - +/* {{{ PHP_MINFO_FUNCTION(domxml) + */ PHP_MINFO_FUNCTION(domxml) { + char buffer[128]; + int major, minor, subminor; /* don't know why that line was commented out in the previous version, so i left it (cmv) */ php_info_print_table_start(); php_info_print_table_row(2, "DOM/XML", "enabled"); - php_info_print_table_row(2, "DOM/XML API Version", DOMXML_API_VERSION); - php_info_print_table_row(2, "libxml Version", LIBXML_DOTTED_VERSION); + php_info_print_table_row(2, "DOM/XML API Version", DOMXML_API_VERSION); +/* php_info_print_table_row(2, "libxml Version", LIBXML_DOTTED_VERSION); */ + php_info_print_table_row(2, "libxml Version", xmlParserVersion); #if defined(LIBXML_HTML_ENABLED) php_info_print_table_row(2, "HTML Support", "enabled"); #endif @@ -1446,7 +1698,17 @@ #endif #if HAVE_DOMXSLT php_info_print_table_row(2, "DOM/XSLT", "enabled"); - php_info_print_table_row(2, "libxslt Version", LIBXSLT_DOTTED_VERSION); +/* php_info_print_table_row(2, "libxslt Version", LIBXSLT_DOTTED_VERSION); */ + major = xsltLibxsltVersion/10000; + minor = (xsltLibxsltVersion - major * 10000) / 100; + subminor = (xsltLibxsltVersion - major * 10000 - minor * 100); + snprintf(buffer, 128, "%d.%d.%d", major, minor, subminor); + php_info_print_table_row(2, "libxslt Version", buffer); + major = xsltLibxmlVersion/10000; + minor = (xsltLibxmlVersion - major * 10000) / 100; + subminor = (xsltLibxmlVersion - major * 10000 - minor * 100); + snprintf(buffer, 128, "%d.%d.%d", major, minor, subminor); + php_info_print_table_row(2, "libxslt compiled against libxml Version", buffer); #if HAVE_DOMEXSLT php_info_print_table_row(2, "DOM/EXSLT", "enabled"); php_info_print_table_row(2, "libexslt Version", LIBEXSLT_DOTTED_VERSION); @@ -1455,12 +1717,13 @@ php_info_print_table_end(); } +/* }}} */ /* {{{ Methods of Class DomAttribute */ /* {{{ proto array domxml_attr_name(void) - Returns list of attribute names - Notice: domxml_node_name() does exactly the same for attribute-nodes, + Returns list of attribute names + Notice: domxml_node_name() does exactly the same for attribute-nodes, is this function here still needed, or would an alias be enough? */ PHP_FUNCTION(domxml_attr_name) @@ -1572,7 +1835,7 @@ Creates node */ PHP_FUNCTION(domxml_node) { - zval *rv; + zval *rv = NULL; xmlNode *node; int ret, name_len; char *name; @@ -1586,7 +1849,11 @@ RETURN_FALSE; } - DOMXML_RET_OBJ(rv, node, &ret); + if(DOMXML_IS_TYPE(getThis(), domxmlnode_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), node, &ret); + } else { + DOMXML_RET_OBJ(rv, node, &ret); + } } /* }}} */ @@ -1725,7 +1992,7 @@ Clones a node */ PHP_FUNCTION(domxml_clone_node) { - zval *rv; + zval *rv = NULL; zval *id; xmlNode *n, *node; int ret, recursive = 0;; @@ -1749,7 +2016,7 @@ Returns first child from list of children */ PHP_FUNCTION(domxml_node_first_child) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *nodep, *first; int ret; @@ -1770,7 +2037,7 @@ Returns last child from list of children */ PHP_FUNCTION(domxml_node_last_child) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *nodep, *last; int ret; @@ -1791,7 +2058,7 @@ Returns next child from list of children */ PHP_FUNCTION(domxml_node_next_sibling) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *nodep, *first; int ret; @@ -1812,7 +2079,7 @@ Returns previous child from list of children */ PHP_FUNCTION(domxml_node_previous_sibling) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *nodep, *first; int ret; @@ -1833,7 +2100,7 @@ Returns document this node belongs to */ PHP_FUNCTION(domxml_node_owner_document) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *nodep; xmlDocPtr docp; int ret; @@ -1921,7 +2188,7 @@ Returns parent of node */ PHP_FUNCTION(domxml_node_parent) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *nodep, *last; int ret; @@ -1965,7 +2232,7 @@ while (last) { zval *child; - child = php_domobject_new(last, &ret TSRMLS_CC); + child = php_domobject_new(last, &ret, NULL TSRMLS_CC); add_next_index_zval(return_value, child); last = last->next; } @@ -1982,7 +2249,7 @@ DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep); xmlUnlinkNode(nodep); - /* This causes a Segmentation Fault for some reason. Removing + /* This causes a Segmentation Fault for some reason. Removing it allows the user to re-add the node at some other time, in addition to fixing the segfault. Node will be freed at shutdown. */ @@ -1991,12 +2258,11 @@ } /* }}} */ - /* {{{ proto object domxml_node_replace_node(object domnode) Replaces one node with another node */ PHP_FUNCTION(domxml_node_replace_node) { - zval *id, *rv, *node; + zval *id, *rv = NULL, *node; xmlNodePtr repnode, nodep, new_repnode; int ret; @@ -2032,7 +2298,7 @@ Adds node to list of children */ PHP_FUNCTION(domxml_node_append_child) { - zval *id, *rv, *node; + zval *id, *rv = NULL, *node; xmlNodePtr child, nodep, new_child; int ret; @@ -2074,7 +2340,7 @@ Adds node to list of siblings */ PHP_FUNCTION(domxml_node_append_sibling) { - zval *id, *rv, *node; + zval *id, *rv = NULL, *node; xmlNodePtr child, nodep, new_child; int ret; @@ -2112,7 +2378,7 @@ Adds node in list of nodes before given node */ PHP_FUNCTION(domxml_node_insert_before) { - zval *id, *rv, *node, *ref; + zval *id, *rv = NULL, *node, *ref; xmlNodePtr child, new_child, nodep, refp; int ret; @@ -2164,7 +2430,7 @@ while (children) { if (children == child) { - zval *rv; + zval *rv = NULL; xmlUnlinkNode(child); DOMXML_RET_OBJ(rv, child, &ret); return; @@ -2212,7 +2478,7 @@ * a child, then do the replacement */ if(foundoldchild && !foundnewchild) { - zval *rv; + zval *rv = NULL; xmlNodePtr node; node = xmlReplaceNode(oldchild, newchild); DOMXML_RET_OBJ(rv, oldchild, &ret); @@ -2223,7 +2489,7 @@ * the new node are identical. */ if(foundnewchild) { - zval *rv; + zval *rv = NULL; DOMXML_RET_OBJ(rv, newchild, &ret); return; } else { @@ -2293,7 +2559,7 @@ Adds child node to parent node */ PHP_FUNCTION(domxml_node_new_child) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNodePtr child, nodep; int ret, name_len, content_len; char *name, *content = NULL; @@ -2334,14 +2600,14 @@ /* FIXME: Actually the property 'content' of the node has to be updated as well. Since 'content' should disappear sooner or later and being replaces by a function 'content()' I skip this for now - */ + */ RETURN_TRUE; } /* }}} */ /* {{{ proto string domxml_node_get_content() Gets content of a node. - + "Read the value of a node, this can be either the text carried directly by this node if it's a TEXT node or the aggregate string of the values carried by this node child's (TEXT and ENTITY_REF). Entity references are substituted." @@ -2357,7 +2623,7 @@ if (!mem) { RETURN_FALSE; } - + RETVAL_STRING(mem,1); xmlFree(mem); } @@ -2416,7 +2682,7 @@ Constructor of DomElement */ PHP_FUNCTION(domxml_element) { - zval *rv; + zval *rv = NULL; xmlNode *node; int ret, name_len; char *name; @@ -2477,7 +2743,7 @@ Sets value of given attribute */ PHP_FUNCTION(domxml_elem_set_attribute) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *nodep; xmlAttr *attr; int ret, name_len, value_len; @@ -2504,7 +2770,7 @@ xmlAttr *attrp; int name_len; char *name; - + DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len); attrp = xmlHasProp(nodep,name); if (attrp == NULL) { @@ -2519,7 +2785,7 @@ Returns value of given attribute */ PHP_FUNCTION(domxml_elem_get_attribute_node) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *nodep; xmlAttr *attrp; int name_len, ret; @@ -2536,9 +2802,10 @@ /* {{{ proto bool domxml_elem_set_attribute_node(object attr) Sets value of given attribute */ +/* since this function is not implemented, outcomment it for the time beeing PHP_FUNCTION(domxml_elem_set_attribute_node) { - zval *id, *arg1, *rv; + zval *id, *arg1, *rv = NULL; xmlNode *nodep; xmlAttr *attrp, *newattrp; int ret; @@ -2551,7 +2818,7 @@ WRONG_PARAM_COUNT; } - /* FIXME: The following line doesn't work */ + FIXME: The following line doesn't work newattrp = xmlCopyProp(nodep, attrp); if (!newattrp) { php_error(E_WARNING, "%s(): no such attribute '%s'", get_active_function_name(TSRMLS_C), attrp->name); @@ -2560,6 +2827,7 @@ DOMXML_RET_OBJ(rv, (xmlNodePtr) newattrp, &ret); } +*/ /* }}} */ /* {{{ proto string domxml_elem_has_attribute(string attrname) @@ -2601,7 +2869,7 @@ contextnodep = NULL; DOMXML_PARAM_FOUR(docp, id, le_domxmldocp, "s|oo", &name, &name_len,&ctxpin,&contextnodep); - + /* if no xpath_context was submitted, create a new one */ if (ctxpin == NULL) { ctxp = xmlXPathNewContext(docp); @@ -2651,7 +2919,7 @@ int retnode; /* construct a node object */ - child = php_domobject_new(node, &retnode TSRMLS_CC); + child = php_domobject_new(node, &retnode, NULL TSRMLS_CC); zend_hash_next_index_insert(Z_ARRVAL_P(rv), &child, sizeof(zval *), NULL); } @@ -2687,17 +2955,17 @@ xmlDocPtr docp; idsIterator iter; xmlHashTable *ids = NULL; - int retnode; - - id = getThis(); - DOMXML_GET_OBJ(docp, id, le_domxmldocp); + int retnode,idname_len; + char *idname; + + DOMXML_PARAM_TWO(docp, id, le_domxmldocp, "s", &idname, &idname_len); ids = (xmlHashTable *) docp->ids; if(ids) { - iter.elementId = (xmlChar *) + iter.elementId = (xmlChar *) idname; iter.element = NULL; - xmlHashScan(ids, idsHashScanner, &iter); - rv = php_domobject_new(iter.element, &retnode TSRMLS_CC); + xmlHashScan(ids, (void *)idsHashScanner, &iter); + rv = php_domobject_new(iter.element, &retnode, NULL TSRMLS_CC); SEPARATE_ZVAL(&rv); *return_value = *rv; FREE_ZVAL(rv); @@ -2721,7 +2989,7 @@ DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len); MAKE_STD_ZVAL(rv); - + if(array_init(rv) != SUCCESS) { php_error(E_WARNING, "%s(): cannot create required array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; @@ -2735,7 +3003,7 @@ zval *child; int retnode; - child = php_domobject_new(node, &retnode TSRMLS_CC); + child = php_domobject_new(node, &retnode, NULL TSRMLS_CC); zend_hash_next_index_insert(Z_ARRVAL_P(rv), &child, sizeof(zval *), NULL); } } @@ -2827,7 +3095,7 @@ while (last) { zval *child; - child = php_domobject_new(last, &ret TSRMLS_CC); + child = php_domobject_new(last, &ret, NULL TSRMLS_CC); add_next_index_zval(return_value, child); last = last->next; } @@ -2858,7 +3126,7 @@ while (last) { zval *child; - child = php_domobject_new(last, &ret TSRMLS_CC); + child = php_domobject_new(last, &ret, NULL TSRMLS_CC); add_next_index_zval(return_value, child); last = last->next; } @@ -2874,7 +3142,7 @@ Returns DomDocumentType */ PHP_FUNCTION(domxml_doc_doctype) { - zval *id, *rv; + zval *id, *rv = NULL; xmlDtdPtr dtd; xmlDocPtr docp; int ret; @@ -2915,7 +3183,7 @@ Returns root node of document */ PHP_FUNCTION(domxml_doc_document_element) { - zval *id, *rv; + zval *id, *rv = NULL; xmlDoc *docp; xmlNode *root; int ret; @@ -2935,13 +3203,15 @@ Creates new element node */ PHP_FUNCTION(domxml_doc_create_element) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *node; - xmlDocPtr docp; + xmlDocPtr docp = NULL; int ret, name_len; char *name; - DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + if(!DOMXML_IS_TYPE(getThis(), domxmlelement_class_entry)) { + DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; @@ -2953,7 +3223,11 @@ } node->doc = docp; - DOMXML_RET_OBJ(rv, node, &ret); + if(DOMXML_IS_TYPE(getThis(), domxmlelement_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), node, &ret); + } else { + DOMXML_RET_OBJ(rv, node, &ret); + } } /* }}} */ @@ -2961,13 +3235,15 @@ Creates new text node */ PHP_FUNCTION(domxml_doc_create_text_node) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *node; - xmlDocPtr docp; + xmlDocPtr docp = NULL; int ret, content_len; char *content; - DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + if(!DOMXML_IS_TYPE(getThis(), domxmltext_class_entry)) { + DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &content, &content_len) == FAILURE) { return; @@ -2979,7 +3255,11 @@ } node->doc = docp; - DOMXML_RET_OBJ(rv, node, &ret); + if(DOMXML_IS_TYPE(getThis(), domxmltext_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), node, &ret); + } else { + DOMXML_RET_OBJ(rv, node, &ret); + } } /* }}} */ @@ -2987,13 +3267,15 @@ Creates new comment node */ PHP_FUNCTION(domxml_doc_create_comment) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *node; - xmlDocPtr docp; + xmlDocPtr docp = NULL; int ret, content_len; char *content; - DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + if(!DOMXML_IS_TYPE(getThis(), domxmlcomment_class_entry)) { + DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &content, &content_len) == FAILURE) { return; @@ -3005,7 +3287,11 @@ } node->doc = docp; - DOMXML_RET_OBJ(rv, node, &ret); + if(DOMXML_IS_TYPE(getThis(), domxmlcomment_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), node, &ret); + } else { + DOMXML_RET_OBJ(rv, node, &ret); + } } /* }}} */ @@ -3013,13 +3299,15 @@ Creates new attribute node */ PHP_FUNCTION(domxml_doc_create_attribute) { - zval *id, *rv; + zval *id, *rv = NULL; xmlAttrPtr node; - xmlDocPtr docp; + xmlDocPtr docp = NULL; int ret, name_len, value_len; char *name, *value; - DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + if(!DOMXML_IS_TYPE(getThis(), domxmlattr_class_entry)) { + DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) { return; @@ -3031,7 +3319,11 @@ } node->doc = docp; - DOMXML_RET_OBJ(rv, (xmlNodePtr) node, &ret); + if(DOMXML_IS_TYPE(getThis(), domxmlattr_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), (xmlNodePtr) node, &ret); + } else { + DOMXML_RET_OBJ(rv, (xmlNodePtr) node, &ret); + } } /* }}} */ @@ -3039,13 +3331,15 @@ Creates new cdata node */ PHP_FUNCTION(domxml_doc_create_cdata_section) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *node; - xmlDocPtr docp; + xmlDocPtr docp = NULL; int ret, content_len; char *content; - DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + if(!DOMXML_IS_TYPE(getThis(), domxmlcdata_class_entry)) { + DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &content, &content_len) == FAILURE) { return; @@ -3057,7 +3351,11 @@ } node->doc = docp; - DOMXML_RET_OBJ(rv, node, &ret); + if(DOMXML_IS_TYPE(getThis(), domxmlcdata_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), node, &ret); + } else { + DOMXML_RET_OBJ(rv, node, &ret); + } } /* }}} */ @@ -3065,13 +3363,15 @@ Creates new cdata node */ PHP_FUNCTION(domxml_doc_create_entity_reference) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *node; - xmlDocPtr docp; + xmlDocPtr docp = NULL; int ret, name_len; char *name; - DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + if(!DOMXML_IS_TYPE(getThis(), domxmlentityref_class_entry)) { + DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; @@ -3082,7 +3382,11 @@ } node->doc = docp; - DOMXML_RET_OBJ(rv, node, &ret); + if(DOMXML_IS_TYPE(getThis(), domxmlentityref_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), node, &ret); + } else { + DOMXML_RET_OBJ(rv, node, &ret); + } } /* }}} */ @@ -3090,13 +3394,15 @@ Creates new processing_instruction node */ PHP_FUNCTION(domxml_doc_create_processing_instruction) { - zval *id, *rv; + zval *id, *rv = NULL; xmlNode *node; - xmlDocPtr docp; + xmlDocPtr docp = NULL; int ret, name_len, content_len; char *name, *content; - DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + if(!DOMXML_IS_TYPE(getThis(), domxmlpi_class_entry)) { + DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp); + } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &content, &content_len) == FAILURE) { return; @@ -3108,7 +3414,11 @@ } node->doc = docp; - DOMXML_RET_OBJ(rv, node, &ret); + if(DOMXML_IS_TYPE(getThis(), domxmlpi_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), node, &ret); + } else { + DOMXML_RET_OBJ(rv, node, &ret); + } } /* }}} */ @@ -3116,7 +3426,7 @@ Creates new element node */ PHP_FUNCTION(domxml_doc_imported_node) { - zval *arg1, *id, *rv; + zval *arg1, *id, *rv = NULL; xmlNodePtr node, srcnode; xmlDocPtr docp; int ret, recursive = 0; @@ -3144,7 +3454,7 @@ Returns DTD of document */ PHP_FUNCTION(domxml_intdtd) { - zval *id, *rv; + zval *id, *rv = NULL; xmlDoc *docp; xmlDtd *dtd; int ret; @@ -3168,19 +3478,20 @@ xmlDoc *docp; xmlChar *mem; int format = 0; - int size; + int size, keepblanks; int encoding_len = 0; char *encoding; - + DOMXML_PARAM_THREE(docp, id, le_domxmldocp, "|ls", &format, &encoding, &encoding_len); if (format) { - xmlKeepBlanksDefault(0); + keepblanks = xmlKeepBlanksDefault(0); if (encoding_len) { xmlDocDumpFormatMemoryEnc(docp, &mem, &size, encoding, format); } else { xmlDocDumpFormatMemory(docp, &mem, &size, format); - } + } + xmlKeepBlanksDefault(keepblanks); } else { if (encoding_len) { xmlDocDumpMemoryEnc(docp, &mem, &size, encoding); @@ -3203,7 +3514,7 @@ { zval *id; xmlDoc *docp; - int file_len, bytes; + int file_len, bytes, keepblanks; int format = 0; int compressmode = 0; char *file; @@ -3213,8 +3524,9 @@ xmlSetCompressMode(compressmode); if (format) { - xmlKeepBlanksDefault(0); + keepblanks = xmlKeepBlanksDefault(0); bytes = xmlSaveFormatFile(file, docp, format); + xmlKeepBlanksDefault(keepblanks); } else { bytes = xmlSaveFile(file, docp); } @@ -3237,22 +3549,22 @@ xmlBufferPtr buf; int level = 0; int format = 0; - + DOMXML_PARAM_THREE(docp, id, le_domxmldocp, "o|ll", &nodep, &format, &level); - + DOMXML_GET_OBJ(elementp, nodep, le_domxmlnodep); if (Z_TYPE_P(elementp) == XML_DOCUMENT_NODE || Z_TYPE_P(elementp) == XML_HTML_DOCUMENT_NODE ) { php_error(E_WARNING, "%s(): cannot dump element with a document node", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } - + buf = xmlBufferCreate(); if (!buf) { php_error(E_WARNING, "%s(): could fetch buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } - + xmlNodeDump(buf, docp, elementp, level, format); mem = (xmlChar*) xmlBufferContent(buf); @@ -3262,11 +3574,14 @@ RETURN_FALSE; } RETVAL_STRING(mem, 1); + xmlBufferFree(buf); } /* }}} */ +/* {{{ idsHashScanner2(void *payload, void *data, xmlChar *name) + */ static void idsHashScanner2(void *payload, void *data, xmlChar *name) { zval *return_value = (zval *) data; @@ -3275,11 +3590,12 @@ xmlNode *nodep; TSRMLS_FETCH(); - + nodep = ((xmlNode *)((xmlID *)payload)->attr)->parent; - child = php_domobject_new(nodep, &ret TSRMLS_CC); + child = php_domobject_new(nodep, &ret, NULL TSRMLS_CC); add_next_index_zval(return_value, child); } +/* }}} */ /* {{{ proto string domxml_doc_ids(object doc_handle) Returns array of ids */ @@ -3298,32 +3614,42 @@ RETURN_FALSE; } - xmlHashScan(ids, idsHashScanner2, return_value); + xmlHashScan(ids, (void *)idsHashScanner2, return_value); } else { RETURN_FALSE; } } /* }}} */ -/* {{{ proto object xmldoc(string xmldoc[, int mode]) +/* {{{ proto object xmldoc(string xmldoc[, int mode[, array error]]) Creates DOM object of XML document */ PHP_FUNCTION(xmldoc) { - zval *rv; + zval *rv = NULL; xmlDoc *docp; - int ret; + int ret; char *buffer; int buffer_len; int mode = 0, prevSubstValue; int oldvalue = xmlDoValidityCheckingDefaultValue; -/* xmlDtdPtr dtd; */ + int oldvalue_keepblanks; + zval *errors ; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &buffer, &buffer_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &buffer, &buffer_len, &mode, &errors) == FAILURE) { return; } /* Either of the following line force validation */ /* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS; */ /* xmlDoValidityCheckingDefaultValue = 1; */ + if (ZEND_NUM_ARGS() == 3 ) { + zval_dtor(errors); + array_init(errors); + } + + if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS) + oldvalue_keepblanks = xmlKeepBlanksDefault(0); + else + oldvalue_keepblanks = xmlKeepBlanksDefault(1); if(mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) prevSubstValue = xmlSubstituteEntitiesDefault (1); @@ -3336,19 +3662,32 @@ switch (mode & (DOMXML_LOAD_PARSING | DOMXML_LOAD_VALIDATING | DOMXML_LOAD_RECOVERING)) { case DOMXML_LOAD_PARSING: xmlDoValidityCheckingDefaultValue = 0; - docp = xmlParseDoc(buffer); + if (ZEND_NUM_ARGS() == 3) { + docp = php_dom_xmlSAXParse( NULL, (char *) buffer, buffer_len, 0 , errors); + } else { + docp = xmlParseDoc(buffer); + } break; case DOMXML_LOAD_VALIDATING: xmlDoValidityCheckingDefaultValue = 1; - docp = xmlParseDoc(buffer); + if (ZEND_NUM_ARGS() == 3) { + docp = php_dom_xmlSAXParse(NULL, (char *) buffer, buffer_len, 0, errors); + } else { + docp = xmlParseDoc(buffer); + } break; case DOMXML_LOAD_RECOVERING: xmlDoValidityCheckingDefaultValue = 0; - docp = xmlRecoverDoc(buffer); + if (ZEND_NUM_ARGS() == 3) { + docp = php_dom_xmlSAXParse(NULL, (char *) buffer, buffer_len, 1, errors); + } else { + docp = xmlRecoverDoc(buffer); + } break; } xmlSubstituteEntitiesDefault (prevSubstValue); xmlDoValidityCheckingDefaultValue = oldvalue; + xmlKeepBlanksDefault(oldvalue_keepblanks); if (!docp) RETURN_FALSE; @@ -3358,43 +3697,91 @@ xmlParseDTD(dtd->ExternalID, dtd->SystemID); } */ - DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret); + + if(DOMXML_IS_TYPE(getThis(), domxmldoc_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), (xmlNodePtr) docp, &ret); + } else { + DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret); + } } /* }}} */ -/* {{{ proto object xmldocfile(string filename) +/* {{{ proto object xmldocfile(string filename[, int mode[, array error]) Creates DOM object of XML document in file */ PHP_FUNCTION(xmldocfile) { - zval *rv; + zval *rv = NULL; xmlDoc *docp; int ret, file_len; char *file; + int mode = 0, prevSubstValue; + int oldvalue = xmlDoValidityCheckingDefaultValue; + int oldvalue_keepblanks; + zval *errors = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &file, &file_len, &mode, &errors) == FAILURE) { return; } + + if (ZEND_NUM_ARGS() == 3 ) { + zval_dtor(errors); + array_init(errors); + } + + if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS) + oldvalue_keepblanks = xmlKeepBlanksDefault(0); + else + oldvalue_keepblanks = xmlKeepBlanksDefault(1); + + if(mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) + prevSubstValue = xmlSubstituteEntitiesDefault (1); + else + prevSubstValue = xmlSubstituteEntitiesDefault (0); + + if(mode & DOMXML_LOAD_COMPLETE_ATTRS) + xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS; + + switch (mode & (DOMXML_LOAD_PARSING | DOMXML_LOAD_VALIDATING | DOMXML_LOAD_RECOVERING)) { + case DOMXML_LOAD_PARSING: + xmlDoValidityCheckingDefaultValue = 0; + if (ZEND_NUM_ARGS() == 3) { + docp = php_dom_xmlSAXParse( NULL, (char *) file, -1 , 0 , errors); + } else { + docp = xmlParseFile(file); + } + break; + case DOMXML_LOAD_VALIDATING: + xmlDoValidityCheckingDefaultValue = 1; + if (ZEND_NUM_ARGS() == 3) { + docp = php_dom_xmlSAXParse(NULL, (char *) file, -1, 0, errors); + } else { + docp = xmlParseFile(file); + } + break; + case DOMXML_LOAD_RECOVERING: + xmlDoValidityCheckingDefaultValue = 0; + if (ZEND_NUM_ARGS() == 3) { + docp = php_dom_xmlSAXParse(NULL, (char*) file, -1, 1, errors); + } else { + docp = xmlRecoverFile(file); + } + break; + } + xmlSubstituteEntitiesDefault (prevSubstValue); + xmlDoValidityCheckingDefaultValue = oldvalue; + xmlKeepBlanksDefault(oldvalue_keepblanks); - docp = xmlParseFile(file); if (!docp) { RETURN_FALSE; } - DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret); - add_property_resource(return_value, "doc", ret); - if (docp->name) - add_property_stringl(return_value, "name", (char *) docp->name, strlen(docp->name), 1); - if (docp->URL) - add_property_stringl(return_value, "url", (char *) docp->URL, strlen(docp->URL), 1); - add_property_stringl(return_value, "version", (char *) docp->version, strlen(docp->version), 1); - if (docp->encoding) - add_property_stringl(return_value, "encoding", (char *) docp->encoding, strlen(docp->encoding), 1); - add_property_long(return_value, "standalone", docp->standalone); - add_property_long(return_value, "type", Z_TYPE_P(docp)); - add_property_long(return_value, "compression", docp->compression); - add_property_long(return_value, "charset", docp->charset); - zend_list_addref(ret); + if(DOMXML_IS_TYPE(getThis(), domxmldoc_class_entry)) { + DOMXML_DOMOBJ_NEW(getThis(), (xmlNodePtr) docp, &ret); + } else { + DOMXML_RET_OBJ(rv, (xmlNodePtr) docp, &ret); + } + } /* }}} */ @@ -3425,7 +3812,7 @@ Creates DOM object of HTML document */ PHP_FUNCTION(html_doc) { - zval *rv; + zval *rv = NULL; xmlDoc *docp; int ret; char *buffer; @@ -3452,7 +3839,7 @@ Creates DOM object of HTML document in file */ PHP_FUNCTION(html_doc_file) { - zval *rv; + zval *rv = NULL; xmlDoc *docp; int ret, file_len; char *file; @@ -3523,11 +3910,11 @@ } /* }}} */ -/* {{{ proto object domxml_doc_add_root(string name) +/* {{{ proto object domxml_add_root(string name) Adds root node to document */ PHP_FUNCTION(domxml_doc_add_root) { - zval *id, *rv; + zval *id, *rv = NULL; xmlDoc *docp; xmlNode *nodep; int ret, name_len; @@ -3567,11 +3954,52 @@ } /* }}} */ +/* {{{ proto bool domxml_doc_validate(array &error) + Validates a DomDocument according to his DTD*/ +PHP_FUNCTION(domxml_doc_validate) +{ + zval *id; + xmlValidCtxt cvp; + xmlDoc *docp; + domxml_ErrorCtxt errorCtxt; + zval *errors ; + int oldvalue = xmlDoValidityCheckingDefaultValue; + + DOMXML_PARAM_ONE(docp, id, le_domxmldocp,"|z",&errors); + errorCtxt.valid = &cvp; + + if (ZEND_NUM_ARGS() == 1) { + zval_dtor(errors); + array_init(errors); + errorCtxt.errors = errors; + } else { + errorCtxt.errors = NULL; + } + + errorCtxt.parser = NULL; + xmlDoValidityCheckingDefaultValue = 1; + cvp.userData = (void *) &errorCtxt; + cvp.error = (xmlValidityErrorFunc) domxml_error_validate; + cvp.warning = (xmlValidityWarningFunc) domxml_error_validate; + if (docp->intSubset == NULL) { + php_error(E_NOTICE, "%s(): No DTD given in XML-Document", get_active_function_name(TSRMLS_C)); + } + + if (xmlValidateDocument(&cvp, docp)) { + RETVAL_TRUE; + } else { + RETVAL_FALSE; + } + xmlDoValidityCheckingDefaultValue = oldvalue; + +} +/* }}} */ + /* {{{ proto object domxml_new_xmldoc(string version) Creates new xmldoc */ PHP_FUNCTION(domxml_new_xmldoc) { - zval *rv; + zval *rv = NULL; xmlDoc *docp; int ret, buf_len; char *buf; @@ -3610,11 +4038,216 @@ } /* parserp->loadsubset = XML_DETECT_IDS; */ - rv = php_xmlparser_new(parserp, &ret TSRMLS_CC); + rv = php_xmlparser_new(parserp, &ret TSRMLS_CC); DOMXML_RET_ZVAL(rv); } /* }}} */ +/* {{{ proto bool domxml_parser_start_document() + starts a document*/ +PHP_FUNCTION(domxml_parser_start_document) +{ + zval *id; + xmlParserCtxtPtr parserp; + + DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp); + startDocument(parserp); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_end_document() + ends a document */ +PHP_FUNCTION(domxml_parser_end_document) +{ + zval *id; + xmlParserCtxtPtr parserp; + + DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp); + endDocument(parserp); + +} +/* }}} */ + +/* {{{ proto bool domxml_parser_start_element(string tagname, array attributes) + Starts an element and adds attributes*/ +PHP_FUNCTION(domxml_parser_start_element) +{ + zval *id,*params = NULL; + xmlParserCtxtPtr parserp; + char *tagname; + int tagname_len; + char **atts = NULL; + + DOMXML_PARAM_THREE(parserp, id, le_domxmlparserp,"s|a", &tagname, &tagname_len, ¶ms); + if (params != NULL) { + atts = php_xmlparser_make_params(params TSRMLS_CC); + } + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + startElement(parserp, (xmlChar *) tagname, (const xmlChar **) atts); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_end_element(string tagname) + Ends an element */ +PHP_FUNCTION(domxml_parser_end_element) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *tagname; + int tagname_len; + + DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &tagname, &tagname_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + endElement(parserp, (xmlChar *) tagname); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_comment(string comment) + Adds a comment */ +PHP_FUNCTION(domxml_parser_comment) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *commentstring; + int commentstring_len; + + DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &commentstring, &commentstring_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + comment(parserp, (xmlChar *) commentstring); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_cdata_section(string chunk) + adds a cdata block */ +PHP_FUNCTION(domxml_parser_cdata_section) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *chunk; + int chunk_len; + + DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &chunk, &chunk_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + cdataBlock(parserp, (xmlChar *) chunk, chunk_len); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_characters(string characters) + Adds characters */ +PHP_FUNCTION(domxml_parser_characters) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *charactersstring; + int characters_len; + + DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &charactersstring, &characters_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + characters(parserp, (xmlChar *) charactersstring, characters_len); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_entity_reference(string reference) + Adds entity reference */ +PHP_FUNCTION(domxml_parser_entity_reference) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *referencestring; + int reference_len; + + DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &referencestring, &reference_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + reference(parserp, (xmlChar *) referencestring); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_processing_instruction(string target, string data) + Adds processing instruction */ +PHP_FUNCTION(domxml_parser_processing_instruction) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *data,*target; + int data_len, target_len; + + DOMXML_PARAM_FOUR(parserp, id, le_domxmlparserp,"ss", &target, &target_len, &data, &data_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + processingInstruction(parserp, (xmlChar *) target, (xmlChar *) data); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_namespace_decl(string href, string prefix) + Adds namespace declaration */ +PHP_FUNCTION(domxml_parser_namespace_decl) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *href,*prefix; + int href_len, prefix_len; + + DOMXML_PARAM_FOUR(parserp, id, le_domxmlparserp,"ss", &href, &href_len, &prefix, &prefix_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + namespaceDecl(parserp, (xmlChar *) href, (xmlChar *) prefix); + + RETURN_TRUE; +} +/* }}} */ + /* {{{ proto bool domxml_parser_add_chunk(string chunk) adds xml-chunk to parser */ PHP_FUNCTION(domxml_parser_add_chunk) @@ -3638,7 +4271,7 @@ Ends parsing and returns DomDocument*/ PHP_FUNCTION(domxml_parser_end) { - zval *id,*rv; + zval *id,*rv = NULL; xmlParserCtxtPtr parserp; char *chunk = NULL; int chunk_len = 0, error; @@ -3648,7 +4281,7 @@ DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"|s", &chunk, &chunk_len); error = xmlParseChunk(parserp, chunk, chunk_len, 1); if (error != 0) { - php_error(E_ERROR,"error: %d",error); + php_error(E_ERROR, "%s(): error: %d", get_active_function_name(TSRMLS_C), error); RETURN_FALSE; } if (parserp->myDoc != NULL) { @@ -3660,6 +4293,25 @@ } /* }}} */ +/* {{{ proto object domxml_parser_get_document() + Returns DomDocument from parser */ +PHP_FUNCTION(domxml_parser_get_document) +{ + zval *id,*rv = NULL; + xmlParserCtxtPtr parserp; + int ret; + + DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp); + + if (parserp->myDoc != NULL) { + DOMXML_RET_OBJ(rv, (xmlNodePtr) parserp->myDoc, &ret); + } + else { + RETVAL_FALSE + } +} +/* }}} */ + /* {{{ proto bool domxml_parser_set_keep_blanks(bool mode) Determines how to handle blanks */ PHP_FUNCTION(domxml_parser_set_keep_blanks) @@ -3698,7 +4350,7 @@ zval *pattr; int ret; - pattr = php_domobject_new((xmlNodePtr) ns, &ret TSRMLS_CC); + pattr = php_domobject_new((xmlNodePtr) ns, &ret, NULL TSRMLS_CC); SEPARATE_ZVAL(&pattr); /* if(!ret) { */ @@ -3741,7 +4393,7 @@ zval *pattr; int ret; - pattr = php_domobject_new((xmlNodePtr) attr, &ret TSRMLS_CC); + pattr = php_domobject_new((xmlNodePtr) attr, &ret, NULL TSRMLS_CC); /** XXX FIXME XXX */ /* if(0 <= (n = node_children(&children, attr->children TSRMLS_CC))) { zend_hash_update(Z_OBJPROP_P(value), "children", sizeof("children"), (void *) &children, sizeof(zval *), NULL); @@ -3779,7 +4431,7 @@ zval *child; int ret; - if (NULL != (child = php_domobject_new(last, &ret TSRMLS_CC))) { + if (NULL != (child = php_domobject_new(last, &ret, NULL TSRMLS_CC))) { zend_hash_next_index_insert(Z_ARRVAL_PP(children), &child, sizeof(zval *), NULL); /* Get the namespace of the current node and add it as a property */ @@ -3809,7 +4461,7 @@ Creates a tree of PHP objects from an XML document */ PHP_FUNCTION(domxml_xmltree) { - zval *children, *rv; + zval *children, *rv = NULL; xmlDoc *docp; xmlNode *root; int ret, buf_len; @@ -3991,7 +4643,7 @@ int retnode; /* construct a node object */ - child = php_domobject_new(node, &retnode TSRMLS_CC); + child = php_domobject_new(node, &retnode, NULL TSRMLS_CC); zend_hash_next_index_insert(Z_ARRVAL_P(arr), &child, sizeof(zval *), NULL); } zend_hash_update(Z_OBJPROP_P(rv), "nodeset", sizeof("nodeset"), (void *) &arr, sizeof(zval *), NULL); @@ -4099,8 +4751,6 @@ } /* }}} */ - - #if HAVE_DOMXSLT static zval *php_xsltstylesheet_new(xsltStylesheetPtr obj, int *found TSRMLS_DC) { @@ -4224,7 +4874,7 @@ if (xmlStrchr(string, '"')) { if (xmlStrchr(string, '\'')) { - php_error(E_WARNING, "Cannot create XPath expression (string contains both quote and double-quotes) in %s", + php_error(E_WARNING, "%s(): Cannot create XPath expression (string contains both quote and double-quotes)", get_active_function_name(TSRMLS_C)); return NULL; } @@ -4262,7 +4912,7 @@ zend_hash_move_forward(parht)) { if (zend_hash_get_current_key(parht, &string_key, &num_key, 1) != HASH_KEY_IS_STRING) { - php_error(E_WARNING, "Invalid argument or parameter array to %s", + php_error(E_WARNING, "%s(): Invalid argument or parameter array", get_active_function_name(TSRMLS_C)); return NULL; } @@ -4288,6 +4938,7 @@ return params; } +/* }}} */ /* {{{ proto object domxml_xslt_process(object xslstylesheet, object xmldoc [, array xslt_parameters [, bool xpath_parameters [, string profileFilename]]]) Perform an XSLT transformation */ @@ -4298,7 +4949,7 @@ - test other stuff - check xsltsp->errors ??? */ - zval *rv, *idxsl, *idxml, *idparams = NULL; + zval *rv = NULL, *idxsl, *idxml, *idparams = NULL; zend_bool xpath_params = 0; xsltStylesheetPtr xsltstp; xmlDocPtr xmldocp; 1.2.2.4 +41 -4 php4/ext/domxml/php_domxml.h Index: php_domxml.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/domxml/php_domxml.h,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- php_domxml.h 19 May 2002 11:16:03 -0000 1.2.2.3 +++ php_domxml.h 9 Jul 2002 09:14:32 -0000 1.2.2.4 @@ -16,13 +16,14 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.h,v 1.53 2002/05/16 21:59:26 chregu Exp $ */ +/* $Id: php_domxml.h,v 1.63 2002/07/01 14:48:38 chregu Exp $ */ #ifndef PHP_DOMXML_H #define PHP_DOMXML_H #if HAVE_DOMXML #include <libxml/parser.h> +#include <libxml/parserInternals.h> #include <libxml/tree.h> #include <libxml/xmlerror.h> #if defined(LIBXML_HTML_ENABLED) @@ -47,9 +48,28 @@ #endif #endif +/* DOMXML API_VERSION, please bump it up, if you change anything in the API + therefore it's easier for the script-programmers to check, what's working how + Can be checked with phpversion("domxml"); +*/ +#define DOMXML_API_VERSION "20020713" + extern zend_module_entry domxml_module_entry; #define domxml_module_ptr &domxml_module_entry +#ifdef PHP_WIN32 +#ifdef PHPAPI +#undef PHPAPI +#endif +#ifdef DOMXML_EXPORTS +#define PHPAPI __declspec(dllexport) +#else +#define PHPAPI __declspec(dllimport) +#endif /* DOMXML_EXPORTS */ +#endif /* PHP_WIN32 */ + +PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval* in TSRMLS_DC); + /* directory functions */ PHP_MINIT_FUNCTION(domxml); PHP_RINIT_FUNCTION(domxml); @@ -84,7 +104,7 @@ PHP_FUNCTION(domxml_dump_mem); PHP_FUNCTION(domxml_dump_mem_file); PHP_FUNCTION(domxml_dump_node); - +PHP_FUNCTION(domxml_doc_validate); #if defined(LIBXML_HTML_ENABLED) PHP_FUNCTION(domxml_html_dump_mem); #endif @@ -138,13 +158,14 @@ PHP_FUNCTION(domxml_attr_specified); /* Class Element methods */ -PHP_FUNCTION(domxml_element); PHP_FUNCTION(domxml_elem_tagname); PHP_FUNCTION(domxml_elem_get_attribute); PHP_FUNCTION(domxml_elem_set_attribute); PHP_FUNCTION(domxml_elem_remove_attribute); PHP_FUNCTION(domxml_elem_get_attribute_node); +/* since this function is not really implemented, outcomment it for the time beeing PHP_FUNCTION(domxml_elem_set_attribute_node); +*/ PHP_FUNCTION(domxml_elem_get_elements_by_tagname); PHP_FUNCTION(domxml_elem_has_attribute); /* Class CData methods */ @@ -168,6 +189,17 @@ PHP_FUNCTION(domxml_parser_add_chunk); PHP_FUNCTION(domxml_parser_end); PHP_FUNCTION(domxml_parser_set_keep_blanks); +PHP_FUNCTION(domxml_parser_start_element); +PHP_FUNCTION(domxml_parser_end_element); +PHP_FUNCTION(domxml_parser_characters); +PHP_FUNCTION(domxml_parser_entity_reference); +PHP_FUNCTION(domxml_parser_comment); +PHP_FUNCTION(domxml_parser_cdata_section); +PHP_FUNCTION(domxml_parser_namespace_decl); +PHP_FUNCTION(domxml_parser_processing_instruction); +PHP_FUNCTION(domxml_parser_start_document); +PHP_FUNCTION(domxml_parser_end_document); +PHP_FUNCTION(domxml_parser_get_document); /* Class XPathContext methods */ #if defined(LIBXML_XPATH_ENABLED) @@ -193,9 +225,14 @@ PHP_FUNCTION(domxml_xslt_process); PHP_FUNCTION(domxml_xslt_version); #endif - +typedef struct { + zval *errors; + xmlValidCtxtPtr valid; + xmlParserCtxtPtr parser; +} domxml_ErrorCtxt; #else #define domxml_module_ptr NULL + #endif /* HAVE_DOMXML */ #define phpext_domxml_ptr domxml_module_ptr No revision No revision 1.2.2.1 +1 -3 php4/ext/domxml/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/domxml/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:43 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.2 +183 -185 php4/ext/exif/exif.c Index: exif.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/exif/exif.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- exif.c 19 May 2002 11:16:03 -0000 1.2.2.1 +++ exif.c 9 Jul 2002 09:14:32 -0000 1.2.2.2 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: exif.c,v 1.92 2002/05/19 00:02:07 sniper Exp $ */ +/* $Id: exif.c,v 1.99 2002/07/02 22:38:37 helly Exp $ */ /* ToDos * @@ -95,19 +95,21 @@ #define EFREE_IF(ptr) if (ptr) efree(ptr) +static unsigned char exif_thumbnail_force_ref[] = {2, BYREF_NONE, BYREF_FORCE_REST}; + /* {{{ exif_functions[] */ function_entry exif_functions[] = { PHP_FE(exif_read_data, NULL) PHP_FALIAS(read_exif_data, exif_read_data, NULL) PHP_FE(exif_tagname, NULL) - PHP_FE(exif_thumbnail, NULL) + PHP_FE(exif_thumbnail, exif_thumbnail_force_ref) PHP_FE(exif_imagetype, NULL) {NULL, NULL, NULL} }; /* }}} */ -#define EXIF_VERSION "1.3 $Id: exif.c,v 1.92 2002/05/19 00:02:07 sniper Exp $" +#define EXIF_VERSION "1.4 $Id: exif.c,v 1.99 2002/07/02 22:38:37 helly Exp $" /* {{{ PHP_MINFO_FUNCTION */ @@ -146,7 +148,7 @@ { #ifdef HAVE_MBSTRING if (new_value && strlen(new_value) && !php_mb_check_encoding_list(new_value TSRMLS_CC)) { - php_error(E_WARNING,"Illegal encoding ignored: '%s'", new_value); + php_error(E_WARNING, "%s(): Illegal encoding ignored: '%s'", get_active_function_name(TSRMLS_C), new_value); return FAILURE; } #endif @@ -157,7 +159,7 @@ { #ifdef HAVE_MBSTRING if (!php_mb_check_encoding_list(new_value TSRMLS_CC)) { - php_error(E_WARNING,"Illegal encoding ignored: '%s'", new_value); + php_error(E_WARNING, "%s(): Illegal encoding ignored: '%s'", get_active_function_name(TSRMLS_C), new_value); return FAILURE; } #endif @@ -193,18 +195,6 @@ { ZEND_INIT_MODULE_GLOBALS(exif, php_exif_init_globals, NULL); REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -257,17 +247,17 @@ /* {{{ error messages */ -static const char * EXIF_ERROR_EALLOC = "Cannot allocate memory for all data"; -static const char * EXIF_ERROR_FILEEOF = "Unexpected end of file reached"; -static const char * EXIF_ERROR_CORRUPT = "File structure corrupted"; -static const char * EXIF_ERROR_THUMBEOF = "Thumbnail goes IFD boundary or end of file reached"; -static const char * EXIF_ERROR_FSREALLOC = "Illegal reallocating of undefined file section"; - -#define EXIF_ERRLOG_EALLOC php_error(E_ERROR, EXIF_ERROR_EALLOC); -#define EXIF_ERRLOG_FILEEOF php_error(E_WARNING, EXIF_ERROR_FILEEOF); -#define EXIF_ERRLOG_CORRUPT php_error(E_WARNING, EXIF_ERROR_CORRUPT); -#define EXIF_ERRLOG_THUMBEOF php_error(E_WARNING, EXIF_ERROR_THUMBEOF); -#define EXIF_ERRLOG_FSREALLOC php_error(E_WARNING, EXIF_ERROR_FSREALLOC); +static const char * EXIF_ERROR_EALLOC = "%s(): Cannot allocate memory for all data"; +static const char * EXIF_ERROR_FILEEOF = "%s(): Unexpected end of file reached"; +static const char * EXIF_ERROR_CORRUPT = "%s(): File structure corrupted"; +static const char * EXIF_ERROR_THUMBEOF = "%s(): Thumbnail goes IFD boundary or end of file reached"; +static const char * EXIF_ERROR_FSREALLOC = "%s(): Illegal reallocating of undefined file section"; + +#define EXIF_ERRLOG_EALLOC php_error(E_ERROR, EXIF_ERROR_EALLOC, get_active_function_name(TSRMLS_C)); +#define EXIF_ERRLOG_FILEEOF php_error(E_WARNING, EXIF_ERROR_FILEEOF, get_active_function_name(TSRMLS_C)); +#define EXIF_ERRLOG_CORRUPT php_error(E_WARNING, EXIF_ERROR_CORRUPT, get_active_function_name(TSRMLS_C)); +#define EXIF_ERRLOG_THUMBEOF php_error(E_WARNING, EXIF_ERROR_THUMBEOF, get_active_function_name(TSRMLS_C)); +#define EXIF_ERRLOG_FSREALLOC php_error(E_WARNING, EXIF_ERROR_FSREALLOC, get_active_function_name(TSRMLS_C)); /* }}} */ /* {{{ format description defines @@ -745,7 +735,7 @@ /* {{{ exif_convert_any_format * Evaluate number, be it int, rational, or float from directory. */ -static double exif_convert_any_format(void *value, int format, int motorola_intel) +static double exif_convert_any_format(void *value, int format, int motorola_intel TSRMLS_DC) { int s_den; unsigned u_den; @@ -778,10 +768,10 @@ /* Not sure if this is correct (never seen float used in Exif format) */ case TAG_FMT_SINGLE: - php_error(E_NOTICE, "Found value of type single"); + php_error(E_NOTICE, "%s(): Found value of type single", get_active_function_name(TSRMLS_C)); return (double)*(float *)value; case TAG_FMT_DOUBLE: - php_error(E_NOTICE, "Found value of type double"); + php_error(E_NOTICE, "%s(): Found value of type double", get_active_function_name(TSRMLS_C)); return *(double *)value; } return 0; @@ -790,7 +780,7 @@ /* {{{ exif_convert_any_to_int * Evaluate number, be it int, rational, or float from directory. */ -static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel) +static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel TSRMLS_DC) { int s_den; unsigned u_den; @@ -823,11 +813,11 @@ /* Not sure if this is correct (never seen float used in Exif format) */ case TAG_FMT_SINGLE: - php_error(E_NOTICE, "Found value of type single"); - return *(float *)value; + php_error(E_NOTICE, "%s(): Found value of type single", get_active_function_name(TSRMLS_C)); + return (size_t)*(float *)value; case TAG_FMT_DOUBLE: - php_error(E_NOTICE, "Found value of type double"); - return *(double *)value; + php_error(E_NOTICE, "%s(): Found value of type double", get_active_function_name(TSRMLS_C)); + return (size_t)*(double *)value; } return 0; } @@ -934,7 +924,7 @@ /* {{{ exif_get_sectionlist Return list of sectionnames specified by sectionlist. Return value must be freed */ -static char *exif_get_sectionlist(int sectionlist) +static char *exif_get_sectionlist(int sectionlist TSRMLS_DC) { int i, len=0; char *sections; @@ -1091,7 +1081,7 @@ /* {{{ exif_file_sections_realloc Reallocate a file section returns 0 on success and -1 on failure */ -static int exif_file_sections_realloc(image_info_type *ImageInfo, int section_index, size_t size) +static int exif_file_sections_realloc(image_info_type *ImageInfo, int section_index, size_t size TSRMLS_DC) { void *tmp; @@ -1130,7 +1120,7 @@ /* {{{ exif_iif_add_value Add a value to image_info */ -static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel) +static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, int motorola_intel TSRMLS_DC) { int index; image_info_value *info_value; @@ -1258,11 +1248,11 @@ break; case TAG_FMT_SINGLE: - php_error(E_WARNING, "Found value of type single"); - info_value->f = (double)*(float *)value; + php_error(E_WARNING, "%s(): Found value of type single", get_active_function_name(TSRMLS_C)); + info_value->f = *(float *)value; case TAG_FMT_DOUBLE: - php_error(E_WARNING, "Found value of type double"); + php_error(E_WARNING, "%s(): Found value of type double", get_active_function_name(TSRMLS_C)); info_value->d = *(double *)value; break; } @@ -1276,16 +1266,16 @@ /* {{{ exif_iif_add_tag Add a tag from IFD to image_info */ -static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value) +static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value TSRMLS_DC) { - exif_iif_add_value(image_info, section_index, name, tag, format, length, value, image_info->motorola_intel); + exif_iif_add_value(image_info, section_index, name, tag, format, length, value, image_info->motorola_intel TSRMLS_CC); } /* }}} */ /* {{{ exif_iif_add_int Add an int value to image_info */ -static void exif_iif_add_int(image_info_type *image_info, int section_index, char *name, int value) +static void exif_iif_add_int(image_info_type *image_info, int section_index, char *name, int value TSRMLS_DC) { image_info_data *info_data; image_info_data *list; @@ -1315,7 +1305,7 @@ /* {{{ exif_iif_add_str Add a string value to image_info MUST BE NUL TERMINATED */ -static void exif_iif_add_str(image_info_type *image_info, int section_index, char *name, char *value) +static void exif_iif_add_str(image_info_type *image_info, int section_index, char *name, char *value TSRMLS_DC) { image_info_data *info_data; image_info_data *list; @@ -1350,7 +1340,7 @@ /* {{{ exif_iif_add_fmt Add a format string value to image_info MUST BE NUL TERMINATED */ -static void exif_iif_add_fmt(image_info_type *image_info, int section_index, char *name, char *value, ...) +static void exif_iif_add_fmt(image_info_type *image_info, int section_index, char *name TSRMLS_DC, char *value, ...) { char *tmp; va_list arglist; @@ -1358,7 +1348,7 @@ va_start(arglist, value); if (value) { vspprintf(&tmp, 0, value, arglist); - exif_iif_add_str(image_info, section_index, name, tmp); + exif_iif_add_str(image_info, section_index, name, tmp TSRMLS_CC); efree(tmp); } va_end(arglist); @@ -1368,7 +1358,7 @@ /* {{{ exif_iif_add_str Add a string value to image_info MUST BE NUL TERMINATED */ -static void exif_iif_add_buffer(image_info_type *image_info, int section_index, char *name, int length, char *value) +static void exif_iif_add_buffer(image_info_type *image_info, int section_index, char *name, int length, char *value TSRMLS_DC) { image_info_data *info_data; image_info_data *list; @@ -1719,35 +1709,35 @@ We want to print out the marker contents as legible text; we must guard against random junk and varying newline representations. */ -static void exif_process_COM (image_info_type *image_info, uchar *value, int length) +static void exif_process_COM (image_info_type *image_info, uchar *value, size_t length TSRMLS_DC) { - exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2); + exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2 TSRMLS_CC); } /* }}} */ -/* {{{ exif_process_COM - Process a COM marker. +/* {{{ exif_process_CME + Process a CME marker. We want to print out the marker contents as legible text; we must guard against random junk and varying newline representations. */ #ifdef EXIF_JPEG2000 -static void exif_process_CME (image_info_type *image_info, uchar *value, int length) +static void exif_process_CME (image_info_type *image_info, uchar *value, size_t length TSRMLS_DC) { if (length>3) { switch(value[2]) { case 0: - exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value); + exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value TSRMLS_CC); break; case 1: exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value); break; default: - php_error(E_NOTICE, "Undefined JPEG2000 comment encoding"); + php_error(E_NOTICE, "%s(): Undefined JPEG2000 comment encoding", get_active_function_name(TSRMLS_C)); break; } } else { exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL); - php_error(E_NOTICE, "JPEG2000 comment section to small"); + php_error(E_NOTICE, "%s(): JPEG2000 comment section to small", get_active_function_name(TSRMLS_C)); } } #endif @@ -1863,7 +1853,7 @@ /* {{{ exif_ifd_make_value * Create a value for an ifd from an info_data pointer */ -static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel) { +static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel TSRMLS_DC) { size_t byte_count; char *value_ptr, *data_ptr; int i; @@ -1943,7 +1933,7 @@ /* {{{ exif_thumbnail_build * Check and build thumbnail */ -static void exif_thumbnail_build(image_info_type *ImageInfo) { +static void exif_thumbnail_build(image_info_type *ImageInfo TSRMLS_DC) { size_t new_size, new_move, new_value; char *new_data; void *value_ptr; @@ -1957,6 +1947,9 @@ if (!ImageInfo->read_thumbnail || !ImageInfo->Thumbnail.offset || !ImageInfo->Thumbnail.size) { return; /* ignore this call */ } +#ifdef EXIF_DEBUG + php_error(E_NOTICE, "%s(): Thumbnail.filetype = %d", get_active_function_name(TSRMLS_C), ImageInfo->Thumbnail.filetype); +#endif switch(ImageInfo->Thumbnail.filetype) { default: case IMAGE_FILETYPE_JPEG: @@ -1967,7 +1960,7 @@ info_list = &ImageInfo->info_list[SECTION_THUMBNAIL]; new_size = 8 + 2 + info_list->count * 12 + 4; #ifdef EXIF_DEBUG - php_error(E_NOTICE, "thumbnail: size of signature + directory(%d): 0x%02X", info_list->count, new_size); + php_error(E_NOTICE, "%s(): thumbnail: size of signature + directory(%d): 0x%02X", get_active_function_name(TSRMLS_C), info_list->count, new_size); #endif new_value= new_size; /* offset for ifd values outside ifd directory */ for (i=0; i<info_list->count; i++) { @@ -2002,7 +1995,7 @@ info_data = &info_list->list[i]; byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; #ifdef EXIF_DEBUG - php_error(E_NOTICE, "thumbnail: process tag(x%04X=%s): %s%s (%d bytes)", info_data->tag, exif_get_tagname(info_data->tag, tagname, -12), (info_data->length>1)&&info_data->format!=TAG_FMT_UNDEFINED&&info_data->format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(info_data->format), byte_count); + php_error(E_NOTICE, "%s(): thumbnail: process tag(x%04X=%s): %s%s (%d bytes)", get_active_function_name(TSRMLS_C), info_data->tag, exif_get_tagname(info_data->tag, tagname, -12), (info_data->length>1)&&info_data->format!=TAG_FMT_UNDEFINED&&info_data->format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(info_data->format), byte_count); #endif if (info_data->tag==TAG_STRIP_OFFSETS || info_data->tag==TAG_JPEG_INTERCHANGE_FORMAT) { php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); @@ -2013,7 +2006,7 @@ php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); php_ifd_set16u(new_data + 2, info_data->format, ImageInfo->motorola_intel); php_ifd_set32u(new_data + 4, info_data->length, ImageInfo->motorola_intel); - value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel); + value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel TSRMLS_CC); if (!value_ptr) { EXIF_ERRLOG_EALLOC efree(ImageInfo->Thumbnail.data); @@ -2026,7 +2019,7 @@ } else { php_ifd_set32u(new_data+8, new_value, ImageInfo->motorola_intel); #ifdef EXIF_DEBUG - php_error(E_NOTICE, "thumbnail: writing with value offset: 0x%04X + 0x%02X", new_value, byte_count); + php_error(E_NOTICE, "%s(): thumbnail: writing with value offset: 0x%04X + 0x%02X", get_active_function_name(TSRMLS_C), new_value, byte_count); #endif memmove(ImageInfo->Thumbnail.data+new_value, value_ptr, byte_count); new_value += byte_count; @@ -2037,7 +2030,7 @@ } memset(new_data, 0, 4); /* next ifd pointer */ #ifdef EXIF_DEBUG - php_error(E_NOTICE, "thumbnail: created"); + php_error(E_NOTICE, "%s(): thumbnail: created", get_active_function_name(TSRMLS_C)); #endif break; } @@ -2046,7 +2039,7 @@ /* {{{ exif_thumbnail_extract * Grab the thumbnail, corrected */ -static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, size_t length) { +static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, size_t length TSRMLS_DC) { /* according to exif2.1, the thumbnail is not supposed to be greater than 64K */ if (!ImageInfo->read_thumbnail) { return; /* ignore this call */ @@ -2055,7 +2048,7 @@ || ImageInfo->Thumbnail.size <= 0 || ImageInfo->Thumbnail.offset <= 0 ) { - php_error(E_WARNING, "Illegal thumbnail size/offset"); + php_error(E_WARNING, "%s(): Illegal thumbnail size/offset", get_active_function_name(TSRMLS_C)); return; } /* Check to make sure we are not going to go past the ExifLength */ @@ -2067,13 +2060,13 @@ if (!ImageInfo->Thumbnail.data) { EXIF_ERRLOG_EALLOC } - exif_thumbnail_build(ImageInfo); + exif_thumbnail_build(ImageInfo TSRMLS_CC); } /* }}} */ /* {{{ exif_process_undefined * Copy a string/buffer in Exif header to a character string and return length of allocated buffer if any. */ -static int exif_process_undefined(char **result, char *value, size_t byte_count) { +static int exif_process_undefined(char **result, char *value, size_t byte_count TSRMLS_DC) { /* we cannot use strlcpy - here the problem is that we have to copy NUL * chars up to byte_count, we also have to add a single NUL character to * force end of string. @@ -2113,7 +2106,7 @@ /* {{{ exif_process_string * Copy a string in Exif header to a character string and return length of allocated buffer if any. * In contrast to exif_process_string this function does allways return a string buffer */ -static int exif_process_string(char **result, char *value, size_t byte_count) { +static int exif_process_string(char **result, char *value, size_t byte_count TSRMLS_DC) { /* we cannot use strlcpy - here the problem is that we cannot use strlen to * determin length of string and we cannot use strlcpy with len=byte_count+1 * because then we might get into an EXCEPTION if we exceed an allocated @@ -2122,7 +2115,7 @@ * estrdup would sometimes allocate more memory and does not return length */ if ((byte_count=php_strnlen(value, byte_count)) > 0) { - return exif_process_undefined(result, value, byte_count); + return exif_process_undefined(result, value, byte_count TSRMLS_CC); } (*result) = estrndup("", 1); /* force empty string */ if (!*result) { @@ -2198,7 +2191,7 @@ } /* normal text without encoding */ - exif_process_string(pszInfoPtr, szValuePtr, ByteCount); + exif_process_string(pszInfoPtr, szValuePtr, ByteCount TSRMLS_CC); return strlen(*pszInfoPtr); } /* }}} */ @@ -2230,7 +2223,7 @@ * Process one of the nested IFDs directories. */ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, int section_index, int ReadNextIFD TSRMLS_DC) { - int l; + size_t length; int tag, format, components; char *value_ptr, tagname[64], cbuf[32], *outside=NULL; size_t byte_count, offset_val, fpos, fgot; @@ -2242,7 +2235,7 @@ if (!format || format >= NUM_FORMATS) { /* (-1) catches illegal zero case as unsigned underflows to positive large. */ - php_error(E_WARNING, "Illegal format code in IFD: 0x%04X", format); + php_error(E_WARNING, "%s(): Illegal format code in IFD: 0x%04X", get_active_function_name(TSRMLS_C), format); return TRUE; } @@ -2262,11 +2255,11 @@ if (value_ptr < dir_entry) { /* we can read this if offset_val > 0 */ /* some files have their values in other parts of the file */ - php_error(E_WARNING, "process tag(x%04X=%s): Illegal pointer offset(x%04X < x%04X)", tag, exif_get_tagname(tag, tagname, -12), offset_val, dir_entry); + php_error(E_WARNING, "%s(): process tag(x%04X=%s): Illegal pointer offset(x%04X < x%04X)", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12), offset_val, dir_entry); } else { /* this is for sure not allowed */ /* exception are IFD pointers */ - php_error(E_WARNING, "process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", tag, exif_get_tagname(tag, tagname, -12), offset_val, byte_count, offset_val+byte_count, IFDlength); + php_error(E_WARNING, "%s(): process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12), offset_val, byte_count, offset_val+byte_count, IFDlength); } return TRUE; } @@ -2294,7 +2287,7 @@ fgot = php_stream_tell(ImageInfo->infile); if (fgot!=offset_val) { EFREE_IF(outside); - php_error(E_WARNING, "Wrong file pointer: 0x%08X != 0x08X", fgot, offset_val); + php_error(E_WARNING, "%s(): Wrong file pointer: 0x%08X != 0x08X", get_active_function_name(TSRMLS_C), fgot, offset_val); return FALSE; } fgot = php_stream_read(ImageInfo->infile, value_ptr, byte_count); @@ -2313,24 +2306,24 @@ ImageInfo->sections_found |= FOUND_ANY_TAG; #ifdef EXIF_DEBUG - php_error(E_NOTICE, "process tag(x%04X=%s, @ x%04X + x%04X(=%d)): %s%s", tag, exif_get_tagname(tag, tagname, -12), offset_val, byte_count, byte_count, (components>1)&&format!=TAG_FMT_UNDEFINED&&format!=TAG_FMT_STRING?"ARRAY OF ":"", format==TAG_FMT_STRING?(value_ptr?value_ptr:"<no data>"):exif_get_tagformat(format)); + php_error(E_NOTICE, "%s(): process tag(x%04X=%s, @ x%04X + x%04X(=%d)): %s%s", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12), offset_val, byte_count, byte_count, (components>1)&&format!=TAG_FMT_UNDEFINED&&format!=TAG_FMT_STRING?"ARRAY OF ":"", format==TAG_FMT_STRING?(value_ptr?value_ptr:"<no data>"):exif_get_tagformat(format)); #endif if (section_index==SECTION_THUMBNAIL) { switch(tag) { case TAG_IMAGEWIDTH: case TAG_COMP_IMAGEWIDTH: - ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_IMAGEHEIGHT: case TAG_COMP_IMAGEHEIGHT: - ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_STRIP_OFFSETS: case TAG_JPEG_INTERCHANGE_FORMAT: /* accept both formats */ - ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_STRIP_BYTE_COUNTS: @@ -2340,13 +2333,13 @@ /* motorola is easier to read */ ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_TIFF_MM; } - ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_JPEG_INTERCHANGE_FORMAT_LEN: if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) { ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG; - ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); } break; @@ -2355,16 +2348,16 @@ switch(tag) { case TAG_COPYRIGHT: /* check for "<photographer> NUL <editor> NUL" */ - if (byte_count>1 && (l=php_strnlen(value_ptr, byte_count)) > 0) { - if (l<byte_count-1) { + if (byte_count>1 && (length=php_strnlen(value_ptr, byte_count)) > 0) { + if (length<byte_count-1) { /* When there are any characters after the first NUL */ ImageInfo->CopyrightPhotographer = estrdup(value_ptr); - ImageInfo->CopyrightEditor = estrdup(value_ptr+l+1); - ImageInfo->Copyright = emalloc(strlen(value_ptr)+strlen(value_ptr+l+1)+3); + ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1); + ImageInfo->Copyright = emalloc(strlen(value_ptr)+strlen(value_ptr+length+1)+3); if (!ImageInfo->Copyright) { EXIF_ERRLOG_EALLOC } else { - sprintf(ImageInfo->Copyright, "%s, %s", value_ptr, value_ptr+l+1); + sprintf(ImageInfo->Copyright, "%s, %s", value_ptr, value_ptr+length+1); } /* format = TAG_FMT_UNDEFINED; this musn't be ASCII */ /* but we are not supposed to change this */ @@ -2373,7 +2366,7 @@ ImageInfo->Copyright = estrdup(value_ptr); } } - break; + break; case TAG_USERCOMMENT: ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC); @@ -2398,7 +2391,7 @@ case TAG_FNUMBER: /* Simplest way of expressing aperture, so I trust it the most. (overwrite previously computd value if there is one) */ - ImageInfo->ApertureFNumber = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->ApertureFNumber = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_APERTURE: @@ -2407,7 +2400,7 @@ have appropriate aperture information yet. */ if (ImageInfo->ApertureFNumber == 0) { ImageInfo->ApertureFNumber - = (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2)*0.5); + = (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2)*0.5); } break; @@ -2418,7 +2411,7 @@ */ if (ImageInfo->ExposureTime == 0) { ImageInfo->ExposureTime - = (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2))); + = (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2))); } break; case TAG_EXPOSURETIME: @@ -2426,21 +2419,21 @@ break; case TAG_COMP_IMAGEWIDTH: - ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_FOCALPLANEXRES: - ImageInfo->FocalplaneXRes = exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->FocalplaneXRes = exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_SUBJECT_DISTANCE: /* Inidcates the distacne the autofocus camera is focused to. Tends to be less accurate as distance increases. */ - ImageInfo->Distance = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel); + ImageInfo->Distance = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_FOCALPLANEUNITS: - switch((int)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)) { + switch((int)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)) { case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */ case 2: /* According to the information I was using, 2 measn meters. @@ -2464,21 +2457,21 @@ switch(tag) { case TAG_EXIF_IFD_POINTER: #ifdef EXIF_DEBUG - php_error(E_NOTICE, "found EXIF"); + php_error(E_NOTICE, "%s(): found EXIF", get_active_function_name(TSRMLS_C)); #endif ImageInfo->sections_found |= FOUND_EXIF; sub_section_index = SECTION_EXIF; break; case TAG_GPS_IFD_POINTER: #ifdef EXIF_DEBUG - php_error(E_NOTICE, "found GPS"); + php_error(E_NOTICE, "%s(): found GPS", get_active_function_name(TSRMLS_C)); #endif ImageInfo->sections_found |= FOUND_GPS; sub_section_index = SECTION_GPS; break; case TAG_INTEROP_IFD_POINTER: #ifdef EXIF_DEBUG - php_error(E_NOTICE, "found INTEROPERABILITY"); + php_error(E_NOTICE, "%s(): found INTEROPERABILITY", get_active_function_name(TSRMLS_C)); #endif ImageInfo->sections_found |= FOUND_INTEROP; sub_section_index = SECTION_INTEROP; @@ -2486,17 +2479,17 @@ } SubdirStart = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel); if (SubdirStart < offset_base || SubdirStart > offset_base+IFDlength) { - php_error(E_WARNING, "Illegal IFD Pointer"); + php_error(E_WARNING, "%s(): Illegal IFD Pointer", get_active_function_name(TSRMLS_C)); return FALSE; } exif_process_IFD_in_JPEG(ImageInfo, SubdirStart, offset_base, IFDlength, sub_section_index TSRMLS_CC); #ifdef EXIF_DEBUG - php_error(E_NOTICE, "subsection %s done", exif_get_sectionname(sub_section_index)); + php_error(E_NOTICE, "%s(): subsection %s done", get_active_function_name(TSRMLS_C), exif_get_sectionname(sub_section_index)); #endif } } } - exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname)), tag, format, components, value_ptr); + exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname)), tag, format, components, value_ptr TSRMLS_CC); EFREE_IF(outside); return TRUE; } @@ -2511,7 +2504,7 @@ int NextDirOffset; #ifdef EXIF_DEBUG - php_error(E_NOTICE, "exif_process_IFD_in_JPEG(x%04X(=%d))", IFDlength, IFDlength); + php_error(E_NOTICE, "%s(): (x%04X(=%d))", get_active_function_name(TSRMLS_C), IFDlength, IFDlength); #endif ImageInfo->sections_found |= FOUND_IFD0; @@ -2519,7 +2512,7 @@ NumDirEntries = php_ifd_get16u(DirStart, ImageInfo->motorola_intel); if ((DirStart+2+NumDirEntries*12) > (OffsetBase+IFDlength)) { - php_error(E_WARNING, "Illegal directory size: x%04X + 2 + x%04X*12 = x%04X > x%04X", (int)DirStart+2-(int)OffsetBase, NumDirEntries, (int)DirStart+2+NumDirEntries*12-(int)OffsetBase, IFDlength); + php_error(E_WARNING, "%s(): Illegal directory size: x%04X + 2 + x%04X*12 = x%04X > x%04X", get_active_function_name(TSRMLS_C), (int)DirStart+2-(int)OffsetBase, NumDirEntries, (int)DirStart+2+NumDirEntries*12-(int)OffsetBase, IFDlength); return FALSE; } @@ -2537,23 +2530,23 @@ if (NextDirOffset) { /* the next line seems false but here IFDlength means length of all IFDs */ if (OffsetBase + NextDirOffset < OffsetBase || OffsetBase + NextDirOffset > OffsetBase+IFDlength) { - php_error(E_WARNING, "Illegal directory offset"); + php_error(E_WARNING, "%s(): Illegal directory offset", get_active_function_name(TSRMLS_C)); return FALSE; } /* That is the IFD for the first thumbnail */ #ifdef EXIF_DEBUG - php_error(E_NOTICE, "expect next IFD to be thumbnail"); + php_error(E_NOTICE, "%s(): expect next IFD to be thumbnail", get_active_function_name(TSRMLS_C)); #endif if (exif_process_IFD_in_JPEG(ImageInfo, OffsetBase + NextDirOffset, OffsetBase, IFDlength, SECTION_THUMBNAIL TSRMLS_CC)) { #ifdef EXIF_DEBUG - php_error(E_NOTICE, "thumbnail size: 0x%04X", ImageInfo->Thumbnail.size); + php_error(E_NOTICE, "%s(): thumbnail size: 0x%04X", get_active_function_name(TSRMLS_C), ImageInfo->Thumbnail.size); #endif if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN && ImageInfo->Thumbnail.size && ImageInfo->Thumbnail.offset && ImageInfo->read_thumbnail ) { - exif_thumbnail_extract(ImageInfo, OffsetBase, IFDlength); + exif_thumbnail_extract(ImageInfo, OffsetBase, IFDlength TSRMLS_CC); } return TRUE; } else { @@ -2575,7 +2568,7 @@ } else if (memcmp(CharBuf, "MM", 2) == 0) { ImageInfo->motorola_intel = 1; } else { - php_error(E_WARNING, "Invalid TIFF alignment marker."); + php_error(E_WARNING, "%s(): Invalid TIFF alignment marker", get_active_function_name(TSRMLS_C)); return; } @@ -2583,7 +2576,7 @@ if (php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel) != 0x2a || php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel) != 0x08 ) { - php_error(E_WARNING, "Invalid TIFF start (1)"); + php_error(E_WARNING, "%s(): Invalid TIFF start (1)", get_active_function_name(TSRMLS_C)); return; } @@ -2592,7 +2585,7 @@ exif_process_IFD_in_JPEG(ImageInfo, CharBuf+8, CharBuf, length/*-14*/, SECTION_IFD0 TSRMLS_CC); #ifdef EXIF_DEBUG - php_error(E_NOTICE, "exif_process_TIFF_in_JPEG, done"); + php_error(E_NOTICE, "%s(): done"); #endif /* Compute the CCD width, in milimeters. */ @@ -2611,12 +2604,12 @@ /* Check the APP1 for Exif Identifier Code */ static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00}; if (memcmp(CharBuf+2, ExifHeader, 6)) { - php_error(E_WARNING, "Incorrect APP1 Exif Identifier Code"); + php_error(E_WARNING, "%s(): Incorrect APP1 Exif Identifier Code", get_active_function_name(TSRMLS_C)); return; } exif_process_TIFF_in_JPEG(ImageInfo, CharBuf + 8, length - 8 TSRMLS_CC); #ifdef EXIF_DEBUG - php_error(E_NOTICE, "process Exif done"); + php_error(E_NOTICE, "%s(): done", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -2624,19 +2617,19 @@ /* {{{ exif_process_APP12 Process an JPEG APP12 block marker used by OLYMPUS */ -static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, unsigned int length) +static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t length TSRMLS_DC) { - int l1, l2=0; + size_t l1, l2=0; if ((l1 = php_strnlen(buffer+2, length-2)) > 0) { - exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2); + exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2 TSRMLS_CC); if (length > 2+l1+1) { l2 = php_strnlen(buffer+2+l1+1, length-2-l1+1); - exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1); + exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1 TSRMLS_CC); } } #ifdef EXIF_DEBUG - php_error(E_NOTICE, "process section APP12 with l1=%d, l2=%d done", l1, l2); + php_error(E_NOTICE, "%s(): Process section APP12 with l1=%d, l2=%d done", get_active_function_name(TSRMLS_C), l1, l2); #endif } /* }}} */ @@ -2655,7 +2648,7 @@ for(section=0;;section++) { #ifdef EXIF_DEBUG fpos = php_stream_tell(ImageInfo->infile); - php_error(E_NOTICE, "needing section %d @ 0x%08X", ImageInfo->file.count, fpos); + php_error(E_NOTICE, "%s(): Needing section %d @ 0x%08X", get_active_function_name(TSRMLS_C), ImageInfo->file.count, fpos); #endif /* get marker byte, swallowing possible padding */ @@ -2679,7 +2672,7 @@ } } while (marker == 0xff); if (last_marker==M_COM && !comment_correction) { - php_error(E_NOTICE, "Image has corrupt M_COM section: some software set wrong length information"); + php_error(E_NOTICE, "%s(): Image has corrupt M_COM section: some software set wrong length information", get_active_function_name(TSRMLS_C)); } if (last_marker==M_COM && comment_correction) return M_EOI; /* ah illegal: char after COM section not 0xFF */ @@ -2689,7 +2682,7 @@ #endif if (marker == 0xff) { /* 0xff is legal padding, but if we get that many, something's wrong. */ - php_error(E_WARNING, "too many padding bytes!"); + php_error(E_WARNING, "%s(): Too many padding bytes!", get_active_function_name(TSRMLS_C)); return FALSE; } @@ -2716,12 +2709,12 @@ got = php_stream_read(ImageInfo->infile, Data+2, itemlen-2); /* Read the whole section. */ if (got != itemlen-2) { - php_error(E_WARNING, "error reading from file: got=x%04X(=%d) != itemlen-2=x%04X(=%d)", got, got, itemlen-2, itemlen-2); + php_error(E_WARNING, "%s(): Error reading from file: got=x%04X(=%d) != itemlen-2=x%04X(=%d)", get_active_function_name(TSRMLS_C), got, got, itemlen-2, itemlen-2); return FALSE; } #ifdef EXIF_DEBUG - php_error(E_NOTICE, "process section(x%02X=%s) @ x%04X + x%04X(=%d)", marker, exif_get_markername(marker), fpos, itemlen, itemlen); + php_error(E_NOTICE, "%s(): Process section(x%02X=%s) @ x%04X + x%04X(=%d)", get_active_function_name(TSRMLS_C), marker, exif_get_markername(marker), fpos, itemlen, itemlen); #endif switch(marker) { case M_SOS: /* stop before hitting compressed data */ @@ -2744,11 +2737,11 @@ return TRUE; case M_EOI: /* in case it's a tables-only JPEG stream */ - php_error(E_WARNING, "No image in jpeg!"); + php_error(E_WARNING, "%s(): No image in jpeg!", get_active_function_name(TSRMLS_C)); return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? TRUE : FALSE; case M_COM: /* Comment section */ - exif_process_COM(ImageInfo, (char *)Data, itemlen); + exif_process_COM(ImageInfo, (char *)Data, itemlen TSRMLS_CC); break; case M_EXIF: @@ -2761,7 +2754,7 @@ break; case M_APP12: - exif_process_APP12(ImageInfo, (char *)Data, itemlen); + exif_process_APP12(ImageInfo, (char *)Data, itemlen TSRMLS_CC); break; @@ -2796,7 +2789,7 @@ last_marker = marker; } #ifdef EXIF_DEBUG - php_error(E_NOTICE, "exif_scan_JPEG_header, done"); + php_error(E_NOTICE, "%s(): done", get_active_function_name(TSRMLS_C)); #endif return TRUE; } @@ -2804,7 +2797,7 @@ /* {{{ exif_scan_thumbnail * scan JPEG in thumbnail (memory) */ -static int exif_scan_thumbnail(image_info_type *ImageInfo) +static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC) { uchar c, *data = ImageInfo->Thumbnail.data; int n, marker; @@ -2816,7 +2809,7 @@ } if (memcmp(data, "\xFF\xD8\xFF", 3)) { if (!ImageInfo->Thumbnail.width && !ImageInfo->Thumbnail.height) { - php_error(E_WARNING, "Thumbnail is not a jpeg image"); + php_error(E_WARNING, "%s(): Thumbnail is not a JPEG image", get_active_function_name(TSRMLS_C)); } return FALSE; } @@ -2844,7 +2837,7 @@ return FALSE; } #ifdef EXIF_DEBUG - php_error(E_NOTICE, "Thumnail: process section(x%02X=%s) @ x%04X + x%04X", marker, exif_get_markername(marker), pos, length); + php_error(E_NOTICE, "%s(): Thumbnail: process section(x%02X=%s) @ x%04X + x%04X", get_active_function_name(TSRMLS_C), marker, exif_get_markername(marker), pos, length); #endif switch (marker) { case M_SOF0: @@ -2865,13 +2858,13 @@ ImageInfo->Thumbnail.height = sof_info.height; ImageInfo->Thumbnail.width = sof_info.width; #ifdef EXIF_DEBUG - php_error(E_NOTICE, "Thumnail: size: %d * %d", sof_info.width, sof_info.height); + php_error(E_NOTICE, "%s(): Thumbnail: size: %d * %d", get_active_function_name(TSRMLS_C), sof_info.width, sof_info.height); #endif return TRUE; case M_SOS: case M_EOI: - php_error(E_WARNING, "could not compute size of thumbnail"); + php_error(E_WARNING, "%s(): Could not compute size of thumbnail", get_active_function_name(TSRMLS_C)); return FALSE; break; @@ -2881,7 +2874,7 @@ } } - php_error(E_WARNING, "could not compute size of thumbnail"); + php_error(E_WARNING, "%s(): Could not compute size of thumbnail", get_active_function_name(TSRMLS_C)); return FALSE; } /* }}} */ @@ -2901,7 +2894,7 @@ return FALSE; } #ifdef EXIF_DEBUG - php_error(E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2); + php_error(E_NOTICE, "%s(): Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", get_active_function_name(TSRMLS_C), ImageInfo->FileSize, dir_offset, 2); #endif php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections */ php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data, 2); @@ -2909,16 +2902,16 @@ dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/; if (ImageInfo->FileSize >= dir_offset+dir_size) { #ifdef EXIF_DEBUG - php_error(E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X), IFD entries(%d)", ImageInfo->FileSize, dir_offset+2, dir_size-2, num_entries); + php_error(E_NOTICE, "%s(): Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X), IFD entries(%d)", get_active_function_name(TSRMLS_C), ImageInfo->FileSize, dir_offset+2, dir_size-2, num_entries); #endif - if (exif_file_sections_realloc(ImageInfo, sn, dir_size)) { + if (exif_file_sections_realloc(ImageInfo, sn, dir_size TSRMLS_CC)) { return FALSE; } php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data+2, dir_size-2); /*php_error(E_NOTICE, "Dump: %s", exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 1));*/ next_offset = php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, ImageInfo->motorola_intel); #ifdef EXIF_DEBUG - php_error(E_NOTICE, "Read from TIFF done, next offset x%04X", next_offset); + php_error(E_NOTICE, "%s(): Read from TIFF done, next offset x%04X", get_active_function_name(TSRMLS_C), next_offset); #endif /* now we have the directory we can look how long it should be */ ifd_size = dir_size; @@ -2927,7 +2920,7 @@ entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel); entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); if (entry_type > NUM_FORMATS) { - php_error(E_WARNING, "Error in TIFF: Illegal format, suppose bytes"); + php_error(E_WARNING, "%s(): Error in TIFF: Illegal format, suppose bytes", get_active_function_name(TSRMLS_C)); entry_type = TAG_FMT_BYTE; } entry_length = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel) * php_tiff_bytes_per_format[entry_type]; @@ -2980,7 +2973,7 @@ && entry_offset == dir_offset + ifd_size) { ifd_size = entry_offset + entry_length - dir_offset; #ifdef EXIF_DEBUG - php_error(E_NOTICE, "Correcting: 0x%08X + 0x%08X - 0x%08X", entry_offset, entry_length, dir_offset); + php_error(E_NOTICE, "%s(): Correcting: 0x%08X + 0x%08X - 0x%08X", get_active_function_name(TSRMLS_C), entry_offset, entry_length, dir_offset); #endif } } @@ -2988,19 +2981,19 @@ if (ImageInfo->FileSize >= dir_offset + ImageInfo->file.list[sn].size) { if (ifd_size > dir_size) { if (dir_offset + ifd_size > ImageInfo->FileSize) { - php_error(E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size); + php_error(E_WARNING, "%s(): Error in TIFF: filesize(x%04X) less than size of IFD(x%04X + x%04X)", get_active_function_name(TSRMLS_C), ImageInfo->FileSize, dir_offset, ifd_size); return FALSE; } - if (exif_file_sections_realloc(ImageInfo, sn, ifd_size)) { + if (exif_file_sections_realloc(ImageInfo, sn, ifd_size TSRMLS_CC)) { return FALSE; } /* read values not stored in directory itself */ #ifdef EXIF_DEBUG - php_error(E_NOTICE, "Read from TIFF: filesize(x%04X), IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size); + php_error(E_NOTICE, "%s(): Read from TIFF: filesize(x%04X), IFD(x%04X + x%04X)", get_active_function_name(TSRMLS_C), ImageInfo->FileSize, dir_offset, ifd_size); #endif php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data+dir_size, ifd_size-dir_size); #ifdef EXIF_DEBUG - php_error(E_NOTICE, "Read from TIFF, done"); + php_error(E_NOTICE, "%s(): Read from TIFF, done", get_active_function_name(TSRMLS_C)); #endif } /* now process the tags */ @@ -3063,7 +3056,7 @@ if (fgot < ImageInfo->Thumbnail.size) { EXIF_ERRLOG_THUMBEOF } - exif_thumbnail_build(ImageInfo); + exif_thumbnail_build(ImageInfo TSRMLS_CC); } } #ifdef EXIF_DEBUG @@ -3276,7 +3269,7 @@ EFREE_IF(sections_str); /* now see what we need */ #ifdef EXIF_DEBUG - sections_str = exif_get_sectionlist(sections_needed); + sections_str = exif_get_sectionlist(sections_needed TSRMLS_CC); if (!sections_str) { RETURN_FALSE; } @@ -3301,7 +3294,7 @@ ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), read_thumbnail, read_all TSRMLS_CC); - sections_str = exif_get_sectionlist(ImageInfo.sections_found); + sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC); #ifdef EXIF_DEBUG if (sections_str) @@ -3322,78 +3315,81 @@ #endif /* now we can add our information */ - exif_iif_add_str(&ImageInfo, SECTION_FILE, "FileName", ImageInfo.FileName); - exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileDateTime", ImageInfo.FileDateTime); - exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileSize", ImageInfo.FileSize); - exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileType", ImageInfo.FileType); - exif_iif_add_str(&ImageInfo, SECTION_FILE, "SectionsFound", sections_str ? sections_str : "NONE"); + exif_iif_add_str(&ImageInfo, SECTION_FILE, "FileName", ImageInfo.FileName TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileDateTime", ImageInfo.FileDateTime TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileSize", ImageInfo.FileSize TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileType", ImageInfo.FileType TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_FILE, "MimeType", (char*)php_image_type_to_mime_type(ImageInfo.FileType) TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_FILE, "SectionsFound", sections_str ? sections_str : "NONE" TSRMLS_CC); #ifdef EXIF_DEBUG php_error(E_NOTICE, "generate section COMPUTED"); #endif if (ImageInfo.Width>0 && ImageInfo.Height>0) { - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "html", "width=\"%d\" height=\"%d\"", ImageInfo.Width, ImageInfo.Height); - exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Height", ImageInfo.Height); - exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Width", ImageInfo.Width); + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "html" TSRMLS_CC, "width=\"%d\" height=\"%d\"", ImageInfo.Width, ImageInfo.Height); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Height", ImageInfo.Height TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Width", ImageInfo.Width TSRMLS_CC); } - exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "IsColor", ImageInfo.IsColor); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "IsColor", ImageInfo.IsColor TSRMLS_CC); if (ImageInfo.motorola_intel != -1) { - exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "ByteOrderMotorola", ImageInfo.motorola_intel); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "ByteOrderMotorola", ImageInfo.motorola_intel TSRMLS_CC); } if (ImageInfo.FocalLength) { - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocalLength", "%4.1fmm", ImageInfo.FocalLength); + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocalLength" TSRMLS_CC, "%4.1fmm", ImageInfo.FocalLength); if(ImageInfo.CCDWidth) { - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "35mmFocalLength", "%dmm", (int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*35+0.5)); + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "35mmFocalLength" TSRMLS_CC, "%dmm", (int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*35+0.5)); } } if(ImageInfo.CCDWidth) { - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "CCDWidth", "%dmm", (int)ImageInfo.CCDWidth); + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "CCDWidth" TSRMLS_CC, "%dmm", (int)ImageInfo.CCDWidth); } if(ImageInfo.ExposureTime>0) { if(ImageInfo.ExposureTime <= 0.5) { - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime", "%0.3f s (1/%d)", ImageInfo.ExposureTime, (int)(0.5 + 1/ImageInfo.ExposureTime)); + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3f s (1/%d)", ImageInfo.ExposureTime, (int)(0.5 + 1/ImageInfo.ExposureTime)); } else { - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime", "%0.3f s", ImageInfo.ExposureTime); + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3f s", ImageInfo.ExposureTime); } } if(ImageInfo.ApertureFNumber) { - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ApertureFNumber", "f/%.1f", ImageInfo.ApertureFNumber); + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ApertureFNumber" TSRMLS_CC, "f/%.1f", ImageInfo.ApertureFNumber); } if(ImageInfo.Distance) { if(ImageInfo.Distance<0) { - exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "FocusDistance", "Infinite"); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "FocusDistance", "Infinite" TSRMLS_CC); } else { - exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocusDistance", "%0.2fm", ImageInfo.Distance); + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocusDistance" TSRMLS_CC, "%0.2fm", ImageInfo.Distance); } } if (ImageInfo.UserComment) { - exif_iif_add_buffer(&ImageInfo, SECTION_COMPUTED, "UserComment", ImageInfo.UserCommentLength, ImageInfo.UserComment); + exif_iif_add_buffer(&ImageInfo, SECTION_COMPUTED, "UserComment", ImageInfo.UserCommentLength, ImageInfo.UserComment TSRMLS_CC); if (ImageInfo.UserCommentEncoding && strlen(ImageInfo.UserCommentEncoding)) { - exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "UserCommentEncoding", ImageInfo.UserCommentEncoding); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "UserCommentEncoding", ImageInfo.UserCommentEncoding TSRMLS_CC); } } - exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright", ImageInfo.Copyright); - exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Photographer", ImageInfo.CopyrightPhotographer); - exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Editor", ImageInfo.CopyrightEditor); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright", ImageInfo.Copyright TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Photographer", ImageInfo.CopyrightPhotographer TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Editor", ImageInfo.CopyrightEditor TSRMLS_CC); for (i=0; i<ImageInfo.xp_fields.count; i++) { - exif_iif_add_str(&ImageInfo, SECTION_WINXP, exif_get_tagname(ImageInfo.xp_fields.list[i].tag, NULL, 0), ImageInfo.xp_fields.list[i].value); + exif_iif_add_str(&ImageInfo, SECTION_WINXP, exif_get_tagname(ImageInfo.xp_fields.list[i].tag, NULL, 0), ImageInfo.xp_fields.list[i].value TSRMLS_CC); } if (ImageInfo.Thumbnail.size) { if (read_thumbnail) { /* not exif_iif_add_str : this is a buffer */ - exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data); + exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data TSRMLS_CC); } if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { /* try to evaluate if thumbnail data is present */ - exif_scan_thumbnail(&ImageInfo); + exif_scan_thumbnail(&ImageInfo TSRMLS_CC); } + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.FileType", ImageInfo.Thumbnail.filetype TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Thumbnail.MimeType", (char*)php_image_type_to_mime_type(ImageInfo.Thumbnail.filetype) TSRMLS_CC); } if (ImageInfo.Thumbnail.width && ImageInfo.Thumbnail.height) { - exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Height", ImageInfo.Thumbnail.height); - exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Width", ImageInfo.Thumbnail.width); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Height", ImageInfo.Thumbnail.height TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Width", ImageInfo.Thumbnail.width TSRMLS_CC); } EFREE_IF(sections_str); @@ -3426,25 +3422,28 @@ } /* }}} */ -/* {{{ proto string|false exif_thumbnail(string filename [, &width, &height]) +/* {{{ proto string|false exif_thumbnail(string filename [, &width, &height [, &imagetype]]) Reads the embedded thumbnail */ PHP_FUNCTION(exif_thumbnail) { - zval **p_name, **p_width, **p_height; + zval **p_name, **p_width, **p_height, **p_imagetype; int ret, arg_c = ZEND_NUM_ARGS(); image_info_type ImageInfo; memset(&ImageInfo, 0, sizeof(ImageInfo)); - if ((arg_c != 1 && arg_c != 3) || zend_get_parameters_ex(arg_c, &p_name, &p_width, &p_height) == FAILURE) { + if ((arg_c!=1 && arg_c!=3 && arg_c!=4) || zend_get_parameters_ex(arg_c, &p_name, &p_width, &p_height, &p_imagetype) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(p_name); - if (arg_c == 3) { + if (arg_c >= 3) { zval_dtor(*p_width); zval_dtor(*p_height); } + if (arg_c >= 4) { + zval_dtor(*p_imagetype); + } ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC); if (ret==FALSE) { @@ -3452,14 +3451,10 @@ RETURN_FALSE; } - if (!ImageInfo.Thumbnail.data || !ImageInfo.Thumbnail.size) { #ifdef EXIF_DEBUG - php_error(E_NOTICE, "No thumbnail data %d %d, %d x %d", ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.width, ImageInfo.Thumbnail.height); + php_error(E_NOTICE, "Thumbnail data %d %d %d, %d x %d", ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.filetype, ImageInfo.Thumbnail.width, ImageInfo.Thumbnail.height); #endif - if (arg_c == 3) { - ZVAL_LONG(*p_width, ImageInfo.Thumbnail.width); - ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height); - } + if (!ImageInfo.Thumbnail.data || !ImageInfo.Thumbnail.size) { exif_discard_imageinfo(&ImageInfo); RETURN_FALSE; } @@ -3469,12 +3464,15 @@ #endif ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, 1); - if (arg_c == 3) { + if (arg_c >= 3) { if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { - exif_scan_thumbnail(&ImageInfo); + exif_scan_thumbnail(&ImageInfo TSRMLS_CC); } ZVAL_LONG(*p_width, ImageInfo.Thumbnail.width); ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height); + } + if (arg_c >= 4) { + ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype); } #ifdef EXIF_DEBUG No revision No revision 1.2.2.1 +1 -3 php4/ext/exif/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/exif/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:44 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* 1.2.2.1 +1 -1 php4/ext/exif/tests/001.phpt Index: 001.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/exif/tests/001.phpt,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- 001.phpt 29 Apr 2002 02:30:44 -0000 1.2 +++ 001.phpt 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -25,4 +25,4 @@ echo $accept; ?> --EXPECT-- -ArrayFitest2.jpgFi1240Fi2SeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1UsExif test image.UsASCIICoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.ArrayCoPhoto (c) M.BoergerUsASCIIArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end \ No newline at end of file +ArrayFitest2.jpgFi1240Fi2Miimage/jpegSeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1UsExif test image.UsASCIICoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.Th2Thimage/jpegArrayCoPhoto (c) M.BoergerUsASCIIArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end \ No newline at end of file 1.2.2.1 +4 -2 php4/ext/exif/tests/003.phpt Index: 003.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/exif/tests/003.phpt,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- 003.phpt 29 Apr 2002 02:30:44 -0000 1.2 +++ 003.phpt 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -12,7 +12,9 @@ copy of test1.jpg as a thumbnail. test3.jpg is the same as test2.jpg but with a UNICODE UserComment: ÄÖ&Üßäöü */ -ini_alter('exif.encode_unicode', 'ISO-8859-15'); +chdir($_ENV['PHP_DIR']); +ini_alter('exif.decode_unicode_motorola', 'UCS-2BE'); +ini_alter('exif.encode_unicode', 'ISO-8859-15'); $image = exif_read_data('./ext/exif/tests/test3.jpg','',true,false); $accept = ''; foreach($image as $idx=>$section) { @@ -27,4 +29,4 @@ echo $accept; ?> --EXPECT-- -ArrayFitest3.jpgFi1237Fi2SeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1Us〓〓〓〓〓〓〓UsUNICODECoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.ArrayCoPhoto (c) M.BoergerUsUNICODEArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end \ No newline at end of file +ArrayFitest3.jpgFi1240Fi2Miimage/jpegSeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1Us〓〓〓〓〓〓〓UsUNICODECoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.Th2Thimage/jpegArrayCoPhoto (c) M.BoergerUsUNICODEArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end \ No newline at end of file 1.2.2.1 +1 -1 php4/ext/exif/tests/test3.jpg <<Binary file>> No revision No revision 1.2.2.1 +45 -45 php4/ext/fbsql/php_fbsql.c Index: php_fbsql.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/fbsql/php_fbsql.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_fbsql.c 29 Apr 2002 02:30:44 -0000 1.2 +++ php_fbsql.c 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_fbsql.c,v 1.80 2002/03/19 22:38:35 fmk Exp $ */ +/* $Id: php_fbsql.c,v 1.82 2002/07/02 21:36:11 fmk Exp $ */ /* TODO: * @@ -262,7 +262,7 @@ #define CHECK_LINK(link) { \ if (link==-1) { \ if (FB_SQL_G(generateWarnings)) \ - php_error(E_WARNING, "FrontBase: A link to the server could not be established"); \ + php_error(E_WARNING, "%s(): A link to the server could not be established", get_active_function_name(TSRMLS_C)); \ RETURN_FALSE; \ } \ } @@ -526,14 +526,14 @@ if ((FB_SQL_G(maxLinks) != -1 && FB_SQL_G(linkCount) == FB_SQL_G(maxLinks))) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "FrontBase link limit %d exceeded ", FB_SQL_G(maxLinks)); + php_error(E_WARNING, "%s(): FrontBase link limit %d exceeded ", get_active_function_name(TSRMLS_C), FB_SQL_G(maxLinks)); RETURN_FALSE; } if ((FB_SQL_G(maxPersistent) != -1 && FB_SQL_G(persistentCount) == FB_SQL_G(maxPersistent))) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "FrontBase persistent link limit %d exceeded ", FB_SQL_G(maxPersistent)); + php_error(E_WARNING, "%s(): FrontBase persistent link limit %d exceeded ", get_active_function_name(TSRMLS_C), FB_SQL_G(maxPersistent)); RETURN_FALSE; } @@ -575,7 +575,7 @@ if ((FB_SQL_G(maxLinks) != -1 && FB_SQL_G(linkCount) == FB_SQL_G(maxLinks))) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "FrontBase link limit %d exceeded ", FB_SQL_G(maxLinks)); + php_error(E_WARNING, "%s(): FrontBase link limit %d exceeded ", get_active_function_name(TSRMLS_C), FB_SQL_G(maxLinks)); RETURN_FALSE; } @@ -722,7 +722,7 @@ if (c == NULL) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, fbcdcClassErrorMessage()); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), fbcdcClassErrorMessage()); return 0; } md = fbcdcCreateSession(c, "PHP", link->userName, link->userPassword, link->userName); @@ -733,9 +733,9 @@ if (FB_SQL_G(generateWarnings)) { if (emg) - php_error(E_WARNING, emg); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), emg); else - php_error(E_WARNING, "No message"); + php_error(E_WARNING, "%s(): No message", get_active_function_name(TSRMLS_C)); } link->errorText = strdup(emg); link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);; @@ -1050,7 +1050,7 @@ convert_to_string_ex(lob_handle); if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') { - if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "The handle is invalid"); + if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "%s(): The handle is invalid", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1113,7 +1113,7 @@ convert_to_string_ex(lob_handle); if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') { - if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "The handle is invalid"); + if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "%s(): The handle is invalid", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1349,8 +1349,8 @@ int port = atoi(name); if (port == 0 || port > 64535) { if (FB_SQL_G(generateWarnings)) { - php_error(E_WARNING, "Cannot connect to FBExec for database '%s'", name); - php_error(E_WARNING, fbcehClassErrorMessage()); + php_error(E_WARNING, "%s(): Cannot connect to FBExec for database '%s'", get_active_function_name(TSRMLS_C), name); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), fbcehClassErrorMessage()); } RETURN_FALSE; } @@ -1465,14 +1465,14 @@ else if (status == FBStopping) txt = "stopping"; else if (status == FBNoExec ) txt = "no exec"; if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Could not create %s@%s, database is %s", databaseName, phpLink->hostName, txt); + php_error(E_WARNING, "%s(): Could not create %s@%s, database is %s", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, txt); RETURN_FALSE; } if (!fbcehCreateDatabaseNamedWithOptions(phpLink->execHandler, databaseName, "")) { char* error = fbechErrorMessage(phpLink->execHandler); if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Could not create %s@%s. %s.", databaseName, phpLink->hostName, error); + php_error(E_WARNING, "%s(): Could not create %s@%s. %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, error); RETURN_FALSE; } for (i=0; i < 20; i++) @@ -1488,7 +1488,7 @@ if (status != FBRunning) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Database %s@%s created -- status unknown", databaseName, phpLink->hostName); + php_error(E_WARNING, "%s(): Database %s@%s created -- status unknown", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName); RETURN_FALSE; } RETURN_TRUE; @@ -1539,7 +1539,7 @@ else if (status == FBStopping ) txt = "stopping"; else if (status == FBNoExec ) txt = "no exec"; if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Could not drop %s@%s, database is %s.", databaseName, phpLink->hostName, txt); + php_error(E_WARNING, "%s(): Could not drop %s@%s, database is %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, txt); RETURN_FALSE; } @@ -1547,7 +1547,7 @@ { char* error = fbechErrorMessage(phpLink->execHandler); if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Could not drop %s@%s. %s.", databaseName, phpLink->hostName, error); + php_error(E_WARNING, "%s(): Could not drop %s@%s. %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, error); RETURN_FALSE; } for (i=0; i < 20; i++) @@ -1563,7 +1563,7 @@ if (status != FBUnknownStatus) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Database %s@%s dropped -- status unknown", databaseName, phpLink->hostName); + php_error(E_WARNING, "%s(): Database %s@%s dropped -- status unknown", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName); RETURN_FALSE; } } @@ -1612,7 +1612,7 @@ else if (status == FBStopping) txt = "stopping"; else if (status == FBNoExec ) txt = "no exec"; if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Could not start %s@%s, as database is %s.", databaseName, phpLink->hostName, txt); + php_error(E_WARNING, "%s(): Could not start %s@%s, as database is %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, txt); RETURN_FALSE; } @@ -1622,7 +1622,7 @@ { char* error = fbechErrorMessage(phpLink->execHandler); if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Could not start %s@%s. %s.", databaseName, phpLink->hostName, error); + php_error(E_WARNING, "%s(): Could not start %s@%s. %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, error); RETURN_FALSE; } } @@ -1640,7 +1640,7 @@ if (status != FBRunning) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Database %s@%s started -- status unknown", databaseName, phpLink->hostName); + php_error(E_WARNING, "%s(): Database %s@%s started -- status unknown", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName); RETURN_FALSE; } RETURN_TRUE; @@ -1688,7 +1688,7 @@ if (!fbcdcStopDatabase(phpLink->connection)) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Cannot stop database %s@%s", databaseName, phpLink->hostName); + php_error(E_WARNING, "%s(): Cannot stop database %s@%s", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName); RETURN_FALSE; } @@ -1765,7 +1765,7 @@ { link->errorNo = 1; link->errorText = strdup("Connection to database server was lost"); - if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, link->errorText); + if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), link->errorText); result = 0; } else if (fbcmdErrorsFound(md)) @@ -1775,9 +1775,9 @@ if (FB_SQL_G(generateWarnings)) { if (emg) - php_error(E_WARNING, "Error in statement: '%s' %s", sql, emg); + php_error(E_WARNING, "%s(): Error in statement: '%s' %s", get_active_function_name(TSRMLS_C), sql, emg); else - php_error(E_WARNING, "No message"); + php_error(E_WARNING, "%s(): No message", get_active_function_name(TSRMLS_C)); } link->errorText = strdup(emg); link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);; @@ -2232,7 +2232,7 @@ } /* }}} */ -void phpfbColumnAsString (PHPFBResult* result, int column, void* data , int* length, char** value) +void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* length, char** value TSRMLS_DC) { FBCMetaData* md = result->metaData; const FBCDatatypeMetaData* dtmd = fbcmdDatatypeMetaDataAtIndex(md, column); @@ -2432,7 +2432,7 @@ break; default: - php_error(E_ERROR, "Unimplemented type"); + php_error(E_ERROR, "%s(): Unimplemented type", get_active_function_name(TSRMLS_C)); break; } } @@ -2477,13 +2477,13 @@ else if (!phpfbFetchRow(result, rowIndex)) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "No such row %d in result set %d", rowIndex, rowIndex); + php_error(E_WARNING, "%s(): No such row %d in result set %d", get_active_function_name(TSRMLS_C), rowIndex, rowIndex); RETURN_FALSE; } else if (columnIndex >= result->columnCount) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "No such column %d in result set %d", columnIndex, rowIndex); + php_error(E_WARNING, "%s(): No such column %d in result set %d", get_active_function_name(TSRMLS_C), columnIndex, rowIndex); RETURN_FALSE; } else @@ -2495,7 +2495,7 @@ } else if (row[columnIndex]) { - phpfbColumnAsString(result, columnIndex, row[columnIndex], &Z_STRLEN_P(return_value), &Z_STRVAL_P(return_value)); + phpfbColumnAsString(result, columnIndex, row[columnIndex], &Z_STRLEN_P(return_value), &Z_STRVAL_P(return_value) TSRMLS_CC); Z_TYPE_P(return_value) = IS_STRING; } else @@ -2564,7 +2564,7 @@ if (columnIndex < 0) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Illegal column index - %d", columnIndex); + php_error(E_WARNING, "%s(): Illegal column index - %d", get_active_function_name(TSRMLS_C), columnIndex); RETURN_FALSE; } } @@ -2797,7 +2797,7 @@ if (((result_type & FBSQL_NUM) != FBSQL_NUM) && ((result_type & FBSQL_ASSOC) != FBSQL_ASSOC)) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Illegal result type use FBSQL_NUM, FBSQL_ASSOC, or FBSQL_BOTH."); + php_error(E_WARNING, "%s(): Illegal result type use FBSQL_NUM, FBSQL_ASSOC, or FBSQL_BOTH.", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (array_init(return_value)==FAILURE) @@ -2910,7 +2910,7 @@ char* value; unsigned int length; unsigned int c = 0; - phpfbColumnAsString(result, i, row[i], &length, &value); + phpfbColumnAsString(result, i, row[i], &length, &value TSRMLS_CC); if (result_type & FBSQL_NUM) { add_index_stringl(return_value, i, value, length, c); @@ -2966,7 +2966,7 @@ if (rowIndex < 0) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Illegal row_index (%i)", rowIndex); + php_error(E_WARNING, "%s(): Illegal row_index (%i)", get_active_function_name(TSRMLS_C), rowIndex); RETURN_FALSE; } @@ -3004,7 +3004,7 @@ for (i=0; i < result->columnCount; i++) { unsigned length = 0; - if (result->row[i]) phpfbColumnAsString(result, i, result->row[i], &length, NULL); + if (result->row[i]) phpfbColumnAsString(result, i, result->row[i], &length, NULL TSRMLS_CC); add_index_long(return_value, i, length); } } @@ -3043,7 +3043,7 @@ if (column < 0 || column >= result->columnCount) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "%d no such column in result", column); + php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column); RETURN_FALSE; } } @@ -3100,7 +3100,7 @@ if (column < 0 || column >= result->columnCount) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "%d no such column in result", column); + php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column); RETURN_FALSE; } } @@ -3143,7 +3143,7 @@ if (column < 0 || column >= result->columnCount) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "%d no such column in result", column); + php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column); RETURN_FALSE; } } @@ -3192,7 +3192,7 @@ if (column < 0 || column >= result->columnCount) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "%d no such column in result", column); + php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column); RETURN_FALSE; } } @@ -3233,7 +3233,7 @@ if (column < 0 || column >= result->columnCount) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "%d no such column in result", column); + php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column); RETURN_FALSE; } } @@ -3285,7 +3285,7 @@ if (column < 0 || column >= result->columnCount) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "%d no such column in result", column); + php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column); RETURN_FALSE; } } @@ -3339,7 +3339,7 @@ if (column < 0 || column >= result->columnCount) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "%d no such column in result", column); + php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column); RETURN_FALSE; } } @@ -3417,7 +3417,7 @@ if (index < 0) { if (FB_SQL_G(generateWarnings)) - php_error(E_WARNING, "Illegal index (%i)", index); + php_error(E_WARNING, "%s(): Illegal index (%i)", get_active_function_name(TSRMLS_C), index); RETURN_FALSE; } @@ -3427,7 +3427,7 @@ result->columnIndex = 0; row = fbcrhRowAtIndex(result->rowHandler, index); - phpfbColumnAsString(result, 0, row[0], &length, &value); + phpfbColumnAsString(result, 0, row[0], &length, &value TSRMLS_CC); RETURN_STRINGL(value, length, 1); } /* }}} */ @@ -3483,7 +3483,7 @@ ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); if (phpLink->execHandler == NULL) { - if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "No valid Exec handler available for this connection"); + if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "%s(): No valid Exec handler available for this connection", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } else { No revision No revision 1.2.2.1 +18 -18 php4/ext/fdf/fdf.c Index: fdf.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/fdf/fdf.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- fdf.c 29 Apr 2002 02:30:44 -0000 1.2 +++ fdf.c 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fdf.c,v 1.63 2001/12/11 15:29:13 sebastian Exp $ */ +/* $Id: fdf.c,v 1.64 2002/06/27 06:46:51 derick Exp $ */ /* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from http://beta1.adobe.com/ada/acrosdk/forms.html. */ @@ -196,7 +196,7 @@ err = FDFOpen(Z_STRVAL_PP(file), 0, &fdf); if(err != FDFErcOK || !fdf) { - php_error(E_WARNING, "Could not open fdf document: %s", Z_STRVAL_PP(file)); + php_error(E_WARNING, "%s(): Could not open fdf document: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(file)); RETURN_FALSE; } @@ -218,7 +218,7 @@ err = FDFCreate(&fdf); if(err != FDFErcOK || !fdf) { - php_error(E_WARNING, "Error creating new fdf document!"); + php_error(E_WARNING, "%s(): Error creating new fdf document!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -268,7 +268,7 @@ } if(err != FDFErcOK) { - php_error(E_WARNING, "Error getting value of %s", Z_STRVAL_PP(fieldname)); + php_error(E_WARNING, "%s(): Error getting value of %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname)); efree(buffer); RETURN_FALSE; } @@ -298,7 +298,7 @@ err = FDFSetValue(fdf, Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value), (ASBool) Z_LVAL_PP(isname)); if(err != FDFErcOK) { - php_error(E_WARNING, "Error setting field: %s to value: %s", Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value)); + php_error(E_WARNING, "%s(): Error setting field: %s to value: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value)); RETURN_FALSE; } RETURN_TRUE; @@ -337,7 +337,7 @@ if(err != FDFErcOK) { efree(buffer); - php_error(E_WARNING,"Error getting next fieldname!"); + php_error(E_WARNING, "%s(): Error getting next fieldname!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -386,7 +386,7 @@ possible errors this function can return. Or create global error handler function. */ if(err != FDFErcOK) { - php_error(E_WARNING,"Error setting appearence of field: %s", Z_STRVAL_PP(fieldname)); + php_error(E_WARNING, "%s(): Error setting appearence of field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname)); RETURN_FALSE; } @@ -413,7 +413,7 @@ err = FDFSetStatus(fdf, Z_STRVAL_PP(status)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error setting fdf document status key to: %s", Z_STRVAL_PP(status)); + php_error(E_WARNING, "%s(): Error setting fdf document status key to: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(status)); RETURN_FALSE; } @@ -446,7 +446,7 @@ } if(err != FDFErcOK) { - php_error(E_WARNING,"Error getting fdf document status key!"); + php_error(E_WARNING, "%s(): Error getting fdf document status key!", get_active_function_name(TSRMLS_C)); efree(buf); RETURN_FALSE; } @@ -474,7 +474,7 @@ err = FDFSetFile(fdf, Z_STRVAL_PP(filename)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error setting filename key to: %s", Z_STRVAL_PP(filename)); + php_error(E_WARNING, "%s(): Error setting filename key to: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename)); RETURN_FALSE; } @@ -507,7 +507,7 @@ } if(err != FDFErcOK) { - php_error(E_WARNING,"Error getting fdf document filename key!"); + php_error(E_WARNING, "%s(): Error getting fdf document filename key!", get_active_function_name(TSRMLS_C)); efree(buf); RETURN_FALSE; } @@ -534,7 +534,7 @@ convert_to_string_ex(filename); err = FDFSave(fdf, Z_STRVAL_PP(filename)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error saving fdf document into filename: %s", Z_STRVAL_PP(filename)); + php_error(E_WARNING, "%s(): Error saving fdf document into filename: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename)); RETURN_FALSE; } @@ -574,7 +574,7 @@ err = FDFAddTemplate(fdf, Z_LVAL_PP(newpage), &filespec, Z_STRVAL_PP(template), Z_LVAL_PP(rename)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error adding template: %s into fdf document", Z_STRVAL_PP(template)); + php_error(E_WARNING, "%s(): Error adding template: %s into fdf document", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(template)); RETURN_FALSE; } @@ -602,7 +602,7 @@ err=FDFSetFlags(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(flags), Z_LVAL_PP(newflags)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error setting flags for field: %s", Z_STRVAL_PP(fieldname)); + php_error(E_WARNING, "%s(): Error setting flags for field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname)); RETURN_FALSE; } @@ -631,7 +631,7 @@ err = FDFSetOpt(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(element), Z_STRVAL_PP(value), Z_STRVAL_PP(name)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error setting FDF option for field: %s", Z_STRVAL_PP(fieldname)); + php_error(E_WARNING, "%s(): Error setting FDF option for field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname)); RETURN_FALSE; } RETURN_TRUE; @@ -659,7 +659,7 @@ err = FDFSetSubmitFormAction(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(trigger), Z_STRVAL_PP(url), Z_LVAL_PP(flags)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error setting FDF submit action for field: %s", Z_STRVAL_PP(fieldname)); + php_error(E_WARNING, "%s(): Error setting FDF submit action for field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname)); RETURN_FALSE; } RETURN_TRUE; @@ -686,7 +686,7 @@ err = FDFSetJavaScriptAction(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(trigger), Z_STRVAL_PP(script)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error setting FDF javascript action for field: %s", Z_STRVAL_PP(fieldname)); + php_error(E_WARNING, "%s(): Error setting FDF javascript action for field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname)); RETURN_FALSE; } RETURN_TRUE; @@ -712,7 +712,7 @@ err = FDFSetEncoding(fdf, Z_STRVAL_PP(enc)); if(err != FDFErcOK) { - php_error(E_WARNING,"Error setting FDF encoding: %s", Z_STRVAL_PP(enc)); + php_error(E_WARNING, "%s(): Error setting FDF encoding: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(enc)); RETURN_FALSE; } RETURN_TRUE; No revision No revision 1.2.2.1 +19 -19 php4/ext/filepro/filepro.c Index: filepro.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/filepro/filepro.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- filepro.c 29 Apr 2002 02:30:44 -0000 1.2 +++ filepro.c 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filepro.c,v 1.45 2002/03/14 11:26:10 sesser Exp $ */ +/* $Id: filepro.c,v 1.46 2002/06/27 06:54:51 derick Exp $ */ /* filePro 4.x support developed by Chad Robinson, chadr****@brtte***** @@ -237,20 +237,20 @@ } if (!(fp = VCWD_FOPEN(workbuf, "r"))) { - php_error(E_WARNING, "filePro: cannot open map: [%d] %s", + php_error(E_WARNING, "%s(): Cannot open map: [%d] %s", get_active_function_name(TSRMLS_C), errno, strerror(errno)); RETURN_FALSE; } if (!fgets(readbuf, sizeof(readbuf), fp)) { fclose(fp); - php_error(E_WARNING, "filePro: cannot read map: [%d] %s", + php_error(E_WARNING, "%s(): Cannot read map: [%d] %s", get_active_function_name(TSRMLS_C), errno, strerror(errno)); RETURN_FALSE; } /* Get the field count, assume the file is readable! */ if (strcmp(php_strtok_r(readbuf, ":", &strtok_buf), "map")) { - php_error(E_WARNING, "filePro: map file corrupt or encrypted"); + php_error(E_WARNING, "%s(): Map file corrupt or encrypted", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } FP_GLOBAL(fp_keysize) = atoi(php_strtok_r(NULL, ":", &strtok_buf)); @@ -261,7 +261,7 @@ for (i = 0; i < FP_GLOBAL(fp_fcount); i++) { if (!fgets(readbuf, sizeof(readbuf), fp)) { fclose(fp); - php_error(E_WARNING, "filePro: cannot read map: [%d] %s", + php_error(E_WARNING, "%s(): Cannot read map: [%d] %s", get_active_function_name(TSRMLS_C), errno, strerror(errno)); RETURN_FALSE; } @@ -317,7 +317,7 @@ if (!FP_GLOBAL(fp_database)) { php_error(E_WARNING, - "filePro: must set database directory first!\n"); + "%s(): Must set database directory first!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -335,7 +335,7 @@ } if (!(fp = VCWD_FOPEN(workbuf, "r"))) { - php_error(E_WARNING, "filePro: cannot open key: [%d] %s", + php_error(E_WARNING, "%s(): Cannot open key: [%d] %s", get_active_function_name(TSRMLS_C), errno, strerror(errno)); RETURN_FALSE; } @@ -375,7 +375,7 @@ if (!FP_GLOBAL(fp_database)) { php_error(E_WARNING, - "filePro: must set database directory first!\n"); + "%s(): Must set database directory first!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -386,7 +386,7 @@ } php_error(E_WARNING, - "filePro: unable to locate field number %d.\n", + "%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C), Z_LVAL_P(fno)); RETVAL_FALSE; @@ -416,7 +416,7 @@ if (!FP_GLOBAL(fp_database)) { php_error(E_WARNING, - "filePro: must set database directory first!\n"); + "%s(): Must set database directory first!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -426,7 +426,7 @@ } } php_error(E_WARNING, - "filePro: unable to locate field number %d.\n", + "%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C), Z_LVAL_P(fno)); RETVAL_FALSE; } @@ -455,7 +455,7 @@ if (!FP_GLOBAL(fp_database)) { php_error(E_WARNING, - "filePro: must set database directory first!\n"); + "%s(): Must set database directory first!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -465,7 +465,7 @@ } } php_error(E_WARNING, - "filePro: unable to locate field number %d.\n", + "%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C), Z_LVAL_P(fno)); RETVAL_FALSE; } @@ -489,7 +489,7 @@ if (!FP_GLOBAL(fp_database)) { php_error(E_WARNING, - "filePro: must set database directory first!\n"); + "%s(): Must set database directory first!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -523,7 +523,7 @@ if (!FP_GLOBAL(fp_database)) { php_error(E_WARNING, - "filePro: must set database directory first!\n"); + "%s(): Must set database directory first!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -534,7 +534,7 @@ rnum = Z_LVAL_P(rno); if (rnum < 0 || fnum < 0 || fnum >= FP_GLOBAL(fp_fcount)) { - php_error(E_WARNING, "filepro: parameters out of range"); + php_error(E_WARNING, "%s(): Parameters out of range", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -543,7 +543,7 @@ offset += lp->width; } if (!lp) { - php_error(E_WARNING, "filePro: cannot locate field"); + php_error(E_WARNING, "%s(): Cannot locate field", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -559,7 +559,7 @@ } if (!(fp = VCWD_FOPEN(workbuf, "r"))) { - php_error(E_WARNING, "filePro: cannot open key: [%d] %s", + php_error(E_WARNING, "%s(): Cannot open key: [%d] %s", get_active_function_name(TSRMLS_C), errno, strerror(errno)); fclose(fp); RETURN_FALSE; @@ -568,7 +568,7 @@ readbuf = emalloc (lp->width+1); if (fread(readbuf, lp->width, 1, fp) != 1) { - php_error(E_WARNING, "filePro: cannot read data: [%d] %s", + php_error(E_WARNING, "%s(): Cannot read data: [%d] %s", get_active_function_name(TSRMLS_C), errno, strerror(errno)); efree(readbuf); fclose(fp); No revision No revision 1.2.2.1 +11 -11 php4/ext/ftp/php_ftp.c Index: php_ftp.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ftp/php_ftp.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_ftp.c 29 Apr 2002 02:30:45 -0000 1.2 +++ php_ftp.c 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ftp.c,v 1.58 2002/03/30 01:56:52 mfischer Exp $ */ +/* $Id: php_ftp.c,v 1.59 2002/06/27 06:49:02 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -108,7 +108,7 @@ #define XTYPE(xtype, mode) { \ if (mode != FTPTYPE_ASCII && mode != FTPTYPE_IMAGE) { \ - php_error(E_WARNING, "%s(): mode must be FTP_ASCII or FTP_BINARY", get_active_function_name(TSRMLS_C)); \ + php_error(E_WARNING, "%s(): Mode must be FTP_ASCII or FTP_BINARY", get_active_function_name(TSRMLS_C)); \ RETURN_FALSE; \ } \ xtype = mode; \ @@ -129,7 +129,7 @@ } if (timeout_sec <= 0) { - php_error(E_WARNING, "%s(): timeout has to be greater than 0", + php_error(E_WARNING, "%s(): Timeout has to be greater than 0", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -418,7 +418,7 @@ } if (php_stream_error(stream)) { - php_error(E_WARNING, "%s(): error writing %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(z_file)); + php_error(E_WARNING, "%s(): Error writing %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(z_file)); RETURN_FALSE; } @@ -476,7 +476,7 @@ if (!ftp_get(ftp, tmpstream, remote, xtype) || php_stream_error(tmpstream)) { php_stream_close(tmpstream); - php_error(E_WARNING, "ftp_get: %s", ftp->inbuf); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf); RETURN_FALSE; } @@ -484,13 +484,13 @@ if (outstream == NULL) { php_stream_close(tmpstream); - php_error(E_WARNING, "%s(): error opening %s", get_active_function_name(TSRMLS_C), local); + php_error(E_WARNING, "%s(): Error opening %s", get_active_function_name(TSRMLS_C), local); RETURN_FALSE; } php_stream_rewind(tmpstream); if (php_stream_copy_to_stream(tmpstream, outstream, PHP_STREAM_COPY_ALL) == 0) { - php_error(E_WARNING, "%s(): error writing %s", get_active_function_name(TSRMLS_C), local); + php_error(E_WARNING, "%s(): Error writing %s", get_active_function_name(TSRMLS_C), local); RETVAL_FALSE; } else @@ -713,12 +713,12 @@ switch (option) { case PHP_FTP_OPT_TIMEOUT_SEC: if (Z_TYPE_P(z_value) != IS_LONG) { - php_error(E_WARNING, "%s(): option TIMEOUT_SEC expects value of type long, %s given", + php_error(E_WARNING, "%s(): Option TIMEOUT_SEC expects value of type long, %s given", get_active_function_name(TSRMLS_C), zend_zval_type_name(z_value)); RETURN_FALSE; } if (Z_LVAL_P(z_value) <= 0) { - php_error(E_WARNING, "%s(): timeout has to be greater than 0", + php_error(E_WARNING, "%s(): Timeout has to be greater than 0", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -726,7 +726,7 @@ RETURN_TRUE; break; default: - php_error(E_WARNING, "%s(): unknown option '%d'", get_active_function_name(TSRMLS_C), option); + php_error(E_WARNING, "%s(): Unknown option '%d'", get_active_function_name(TSRMLS_C), option); RETURN_FALSE; break; } @@ -752,7 +752,7 @@ RETURN_LONG(ftp->timeout_sec); break; default: - php_error(E_WARNING, "%s(): unknown option '%d'", get_active_function_name(TSRMLS_C), option); + php_error(E_WARNING, "%s(): Unknown option '%d'", get_active_function_name(TSRMLS_C), option); RETURN_FALSE; break; } No revision No revision 1.2.2.1 +7 -0 php4/ext/gd/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gd/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:45 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -11,3 +11,10 @@ Release_TSDbg Release_TS_inline Debug_TS +Release_bundled +Release_inline_bundled +Debug_bundled +Release_TS_bundled +Release_TSDbg_bundled +Release_TS_inline_bundled +Debug_TS_bundled 1.2.2.1 +93 -28 php4/ext/gd/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gd/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:45 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -1,11 +1,40 @@ dnl -dnl $Id: config.m4,v 1.92 2002/04/23 23:17:41 sniper Exp $ +dnl $Id: config.m4,v 1.101 2002/06/28 12:23:18 sniper Exp $ dnl -AC_DEFUN(PHP_GD_JPEG,[ - PHP_ARG_WITH(jpeg-dir, for the location of libjpeg, - [ --with-jpeg-dir=DIR GD: Set the path to libjpeg install prefix.]) +dnl +dnl Configure options +dnl + +PHP_ARG_WITH(gd, for GD support, +[ --with-gd[=DIR] Include GD support (DIR is GD's install dir).]) + +PHP_ARG_WITH(jpeg-dir, for the location of libjpeg, +[ --with-jpeg-dir=DIR GD: Set the path to libjpeg install prefix.]) + +PHP_ARG_WITH(png-dir, for the location of libpng, +[ --with-png-dir=DIR GD: Set the path to libpng install prefix.]) + +PHP_ARG_WITH(xpm-dir, for the location of libXpm, +[ --with-xpm-dir=DIR GD: Set the path to libXpm install prefix.]) + +PHP_ARG_WITH(ttf, for FreeType 1.x support, +[ --with-ttf[=DIR] GD: Include FreeType 1.x support]) + +PHP_ARG_WITH(freetype-dir, for FreeType 2, +[ --with-freetype-dir=DIR GD: Set the path to FreeType 2 install prefix.]) + +PHP_ARG_WITH(t1lib, for T1lib support, +[ --with-t1lib[=DIR] GD: Include T1lib support.]) + +PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in GD, +[ --enable-gd-native-ttf GD: Enable TrueType string function.]) +dnl +dnl Checks for the configure options +dnl + +AC_DEFUN(PHP_GD_JPEG,[ if test "$PHP_JPEG_DIR" != "no"; then for i in /usr /usr/local $PHP_JPEG_DIR; do @@ -18,6 +47,7 @@ PHP_CHECK_LIBRARY(jpeg,jpeg_read_header, [ + PHP_ADD_INCLUDE($GD_JPEG_DIR/include) PHP_ADD_LIBRARY_WITH_PATH(jpeg, $GD_JPEG_DIR/lib, GD_SHARED_LIBADD) ],[ AC_MSG_ERROR([Problem with libjpeg.(a|so). Please check config.log for more information.]) @@ -30,9 +60,6 @@ ]) AC_DEFUN(PHP_GD_PNG,[ - PHP_ARG_WITH(png-dir, for the location of libpng, - [ --with-png-dir=DIR GD: Set the path to libpng install prefix.]) - if test "$PHP_PNG_DIR" != "no"; then for i in /usr /usr/local $PHP_PNG_DIR; do @@ -49,6 +76,7 @@ PHP_CHECK_LIBRARY(png,png_write_image, [ + PHP_ADD_INCLUDE($GD_PNG_DIR/include) PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, GD_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH(png, $GD_PNG_DIR/lib, GD_SHARED_LIBADD) ],[ @@ -63,9 +91,6 @@ ]) AC_DEFUN(PHP_GD_XPM,[ - PHP_ARG_WITH(xpm-dir, for the location of libXpm, - [ --with-xpm-dir=DIR GD: Set the path to libXpm install prefix.]) - if test "$PHP_XPM_DIR" != "no"; then for i in /usr /usr/local /usr/X11R6 $PHP_XPM_DIR; do @@ -78,6 +103,7 @@ PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage, [ + PHP_ADD_INCLUDE($GD_XPM_DIR/include) PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib, GD_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/lib, GD_SHARED_LIBADD) ],[ @@ -91,9 +117,6 @@ ]) AC_DEFUN(PHP_GD_FREETYPE1,[ - PHP_ARG_WITH(ttf,for FreeType 1.x support, - [ --with-ttf[=DIR] GD: Include FreeType 1.x support]) - if test "$PHP_TTF" != "no"; then if test "$PHP_FREETYPE_DIR" = "no" -o "$PHP_FREETYPE_DIR" = ""; then if test -n "$PHP_TTF" ; then @@ -106,6 +129,10 @@ TTF_DIR=$i TTF_INC_DIR=$i/include/freetype fi + if test -f "$i/include/freetype1/freetype/freetype.h"; then + TTF_DIR=$i + TTF_INC_DIR=$i/include/freetype1/freetype + fi done fi if test -n "$TTF_DIR" ; then @@ -123,14 +150,12 @@ ]) AC_DEFUN(PHP_GD_FREETYPE2,[ - PHP_ARG_WITH(freetype-dir, for freetype(2), - [ --with-freetype-dir=DIR GD: Set the path to freetype2 install prefix.]) - if test "$PHP_FREETYPE_DIR" != "no"; then + for i in /usr /usr/local $PHP_FREETYPE_DIR; do if test -f "$i/include/freetype2/freetype/freetype.h"; then FREETYPE2_DIR=$i - FREETYPE2_INC_DIR=$i/include/freetype2/freetype + FREETYPE2_INC_DIR=$i/include/freetype2 fi done @@ -148,9 +173,6 @@ ]) AC_DEFUN(PHP_GD_T1LIB,[ - PHP_ARG_WITH(t1lib, for T1lib support, - [ --with-t1lib[=DIR] GD: Include T1lib support.]) - if test "$PHP_T1LIB" != "no"; then for i in /usr /usr/local $PHP_T1LIB; do @@ -164,7 +186,7 @@ PHP_CHECK_LIBRARY(t1, T1_LoadFont, [ AC_DEFINE(HAVE_LIBT1,1,[ ]) - PHP_ADD_INCLUDE("$GD_T1_DIR/include") + PHP_ADD_INCLUDE($GD_T1_DIR/include) PHP_ADD_LIBRARY_WITH_PATH(t1, "$GD_T1_DIR/lib", GD_SHARED_LIBADD) ],[ AC_MSG_ERROR([Problem with libt1.(a|so). Please check config.log for more information.]) @@ -175,9 +197,6 @@ ]) AC_DEFUN(PHP_GD_TTSTR,[ - PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in GD, - [ --enable-gd-native-ttf GD: Enable TrueType string function.]) - if test "$PHP_GD_NATIVE_TTF" = "yes"; then AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ]) fi @@ -195,6 +214,7 @@ PHP_CHECK_LIBRARY(gd, gdImageCreateFromGd2, [AC_DEFINE(HAVE_GD_GD2, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImageEllipse, [AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdImageStringTTF, [AC_DEFINE(HAVE_GD_STRINGTTF, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_STRINGFT, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) @@ -205,8 +225,9 @@ ]) -PHP_ARG_WITH(gd, for GD support, -[ --with-gd[=DIR] Include GD support (DIR is GD's install dir).]) +dnl +dnl Main GD configure +dnl if test "$PHP_GD" = "php"; then GD_MODULE_TYPE=builtin @@ -215,9 +236,13 @@ libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c libgd/gdfontmb.c libgd/gdfontl.c \ libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \ libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c" - PHP_NEW_EXTENSION(gd, gd.c gdcache.c gdttf.c gdt1.c $sources, $ext_shared,,-I @ ext_srcdir@/libgd) + + PHP_NEW_EXTENSION(gd, gd.c $sources, $ext_shared,, \\$(GDLIB_CFLAGS)) PHP_ADD_BUILD_DIR($ext_builddir/libgd) +dnl PNG is required by GD library + test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes + dnl Various checks for GD features PHP_GD_TTSTR PHP_GD_JPEG @@ -227,10 +252,50 @@ PHP_GD_FREETYPE1 PHP_GD_T1LIB +dnl These are always available with bundled library + AC_DEFINE(HAVE_LIBGD, 1, [ ]) + AC_DEFINE(HAVE_LIBGD13, 1, [ ]) + AC_DEFINE(HAVE_LIBGD15, 1, [ ]) + AC_DEFINE(HAVE_LIBGD20, 1, [ ]) + AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ]) + AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ]) + AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ]) + AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ]) + AC_DEFINE(HAVE_GD_WBMP, 1, [ ]) + AC_DEFINE(HAVE_GD_GD2, 1, [ ]) + AC_DEFINE(HAVE_GD_PNG, 1, [ ]) + + AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ]) + +dnl Make sure the libgd/ is first in the include path + GDLIB_CFLAGS="-I$ext_srcdir/libgd -DHAVE_LIBPNG" + +dnl Depending which libraries were included to PHP configure, +dnl enable the support in bundled GD library + + if test -n "$GD_JPEG_DIR"; then + AC_DEFINE(HAVE_GD_JPG, 1, [ ]) + GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBJPEG" + fi + + if test -n "$GD_XPM_DIR"; then + AC_DEFINE(HAVE_GD_XPM, 1, [ ]) + GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_XPM" + fi + + if test -n "$FREETYPE2_DIR"; then + AC_DEFINE(HAVE_GD_STRINGFT, 1, [ ]) + AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ]) + GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE" + fi + + PHP_SUBST(GDLIB_CFLAGS) + else + if test "$PHP_GD" != "no"; then - PHP_NEW_EXTENSION(gd, gd.c gdcache.c gdttf.c gdt1.c, $ext_shared) + PHP_NEW_EXTENSION(gd, gd.c gdcache.c gdttf.c, $ext_shared) PHP_SUBST(GD_SHARED_LIBADD) dnl Various checks for GD features 1.2.2.1 +156 -300 php4/ext/gd/gd.c Index: gd.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gd/gd.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- gd.c 29 Apr 2002 02:30:45 -0000 1.2 +++ gd.c 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.185 2002/04/11 20:32:03 phanto Exp $ */ +/* $Id: gd.c,v 1.200 2002/06/29 15:54:02 derick Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -51,7 +51,10 @@ static int le_gd, le_gd_font; #if HAVE_LIBT1 +#include <t1lib.h> static int le_ps_font, le_ps_enc; +static void php_free_ps_font(zend_rsrc_list_entry *rsrc TSRMLS_DC); +static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC); #endif #include <gd.h> @@ -60,6 +63,9 @@ #include <gdfontmb.h> /* 3 Medium bold font */ #include <gdfontl.h> /* 4 Large font */ #include <gdfontg.h> /* 5 Giant font */ +#ifdef HAVE_GD_WBMP +#include "libgd/wbmp.h" +#endif #ifdef ENABLE_GD_TTF # include "gdttf.h" #endif @@ -93,6 +99,14 @@ #define CTX_PUTC(c, fp) fputc(c, fp) #endif +#ifndef HAVE_GDIMAGECOLORRESOLVE +extern int gdImageColorResolve(gdImagePtr, int, int, int); +#endif + +#if HAVE_COLORCLOSESTHWB +int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b); +#endif + static gdImagePtr _php_image_create_from_string (zval **Data, char *tn, gdImagePtr (*ioctx_func_p)() TSRMLS_DC); static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)()); static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)()); @@ -107,10 +121,15 @@ PHP_FE(imagechar, NULL) PHP_FE(imagecharup, NULL) PHP_FE(imagecolorallocate, NULL) +#if HAVE_LIBGD15 PHP_FE(imagepalettecopy, NULL) + PHP_FE(imagecreatefromstring, NULL) +#endif PHP_FE(imagecolorat, NULL) PHP_FE(imagecolorclosest, NULL) +#if HAVE_COLORCLOSESTHWB PHP_FE(imagecolorclosesthwb, NULL) +#endif PHP_FE(imagecolordeallocate, NULL) PHP_FE(imagecolorresolve, NULL) PHP_FE(imagecolorexact, NULL) @@ -119,28 +138,36 @@ PHP_FE(imagecolorstotal, NULL) PHP_FE(imagecolorsforindex, NULL) PHP_FE(imagecopy, NULL) +#if HAVE_LIBGD15 PHP_FE(imagecopymerge, NULL) + PHP_FE(imagecopymergegray, NULL) +#endif PHP_FE(imagecopyresized, NULL) PHP_FE(imagecreate, NULL) - +#if HAVE_LIBGD20 PHP_FE(imagecreatetruecolor, NULL) PHP_FE(imagetruecolortopalette, NULL) PHP_FE(imagesetthickness, NULL) PHP_FE(imageellipse, NULL) - PHP_FE(imagefilledellipse, NULL) PHP_FE(imagefilledarc, NULL) + PHP_FE(imagefilledellipse, NULL) PHP_FE(imagealphablending, NULL) PHP_FE(imagecolorresolvealpha, NULL) PHP_FE(imagecolorclosestalpha, NULL) PHP_FE(imagecolorexactalpha, NULL) PHP_FE(imagecopyresampled, NULL) +#endif + +#if HAVE_GD_IMAGESETTILE PHP_FE(imagesettile, NULL) +#endif +#if HAVE_GD_IMAGESETBRUSH PHP_FE(imagesetbrush, NULL) +#endif + PHP_FE(imagesetstyle, NULL) - PHP_FE(imagecopymergegray, NULL) - PHP_FE(imagecreatefromstring, NULL) #ifdef HAVE_GD_PNG PHP_FE(imagecreatefrompng, NULL) #endif @@ -200,12 +227,16 @@ PHP_FE(imagesx, NULL) PHP_FE(imagesy, NULL) PHP_FE(imagedashedline, NULL) + #ifdef ENABLE_GD_TTF PHP_FE(imagettfbbox, NULL) PHP_FE(imagettftext, NULL) +#if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX PHP_FE(imageftbbox, NULL) PHP_FE(imagefttext, NULL) #endif +#endif + #ifdef HAVE_LIBT1 PHP_FE(imagepsloadfont, NULL) /* @@ -319,7 +350,9 @@ /* need to use a PHPAPI function here because it is external module in windows */ -#if HAVE_LIBGD20 +#if HAVE_GD_BUNDLED + php_info_print_table_row(2, "GD Version", "bundled (2.0 compatible)"); +#elif HAVE_LIBGD20 php_info_print_table_row(2, "GD Version", "2.0 or higher"); #elif HAVE_GDIMAGECOLORRESOLVE php_info_print_table_row(2, "GD Version", "1.6.2 or higher"); @@ -474,9 +507,9 @@ php_stream_close(stream); efree(font); if (php_stream_eof(stream)) { - php_error(E_WARNING, "ImageFontLoad: end of file while reading header"); + php_error(E_WARNING, "%s(): End of file while reading header", get_active_function_name(TSRMLS_C)); } else { - php_error(E_WARNING, "ImageFontLoad: error while reading header"); + php_error(E_WARNING, "%s(): Error while reading header", get_active_function_name(TSRMLS_C)); } RETURN_FALSE; } @@ -492,7 +525,7 @@ body_size = font->w * font->h * font->nchars; } if (body_size != body_size_check) { - php_error(E_WARNING, "ImageFontLoad: error reading font"); + php_error(E_WARNING, "%s(): Error reading font", get_active_function_name(TSRMLS_C)); efree(font); RETURN_FALSE; } @@ -506,9 +539,9 @@ efree(font->data); efree(font); if (php_stream_eof(stream)) { - php_error(E_WARNING, "ImageFontLoad: end of file while reading body"); + php_error(E_WARNING, "%s(): End of file while reading body", get_active_function_name(TSRMLS_C)); } else { - php_error(E_WARNING, "ImageFontLoad: error while reading body"); + php_error(E_WARNING, "%s(): Error while reading body", get_active_function_name(TSRMLS_C)); } RETURN_FALSE; } @@ -564,11 +597,11 @@ } /* }}} */ +#if HAVE_LIBGD20 /* {{{ proto int imagecreatetruecolor(int x_size, int y_size) Create a new true color image */ PHP_FUNCTION(imagecreatetruecolor) { -#if HAVE_LIBGD20 zval **x_size, **y_size; gdImagePtr im; @@ -582,9 +615,6 @@ im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size)); ZEND_REGISTER_RESOURCE(return_value, im, le_gd); -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif } /* }}} */ @@ -592,7 +622,6 @@ Convert a true colour image to a palette based image with a number of colours, optionally using dithering. */ PHP_FUNCTION(imagetruecolortopalette) { -#if HAVE_LIBGD20 zval **IM, **dither, **ncolors; gdImagePtr im; @@ -607,10 +636,6 @@ gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors)); RETURN_TRUE; -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif - } /* }}} */ @@ -618,7 +643,6 @@ Set line thickness for drawing lines, ellipses, rectangles, polygons etc. */ PHP_FUNCTION(imagesetthickness) { -#if HAVE_LIBGD20 zval **IM, **thick; gdImagePtr im; @@ -632,10 +656,6 @@ gdImageSetThickness(im, Z_LVAL_PP(thick)); RETURN_TRUE; -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif - } /* }}} */ @@ -643,7 +663,6 @@ Draw an ellipse */ PHP_FUNCTION(imageellipse) { -#if 0 && HAVE_LIBGD20 /* this function is missing from GD 2.0.1 */ zval **IM, **cx, **cy, **w, **h, **color; gdImagePtr im; @@ -659,12 +678,13 @@ convert_to_long_ex(h); convert_to_long_ex(color); +#ifdef HAVE_GD_IMAGEELLIPSE /* this function is missing from GD 2.0.1 */ gdImageEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), Z_LVAL_PP(color)); - - RETURN_TRUE; #else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); + gdImageArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), 0, 360, Z_LVAL_PP(color)); #endif + + RETURN_TRUE; } /* }}} */ @@ -672,7 +692,6 @@ Draw an ellipse */ PHP_FUNCTION(imagefilledellipse) { -#if HAVE_LIBGD20 zval **IM, **cx, **cy, **w, **h, **color; gdImagePtr im; @@ -691,9 +710,6 @@ gdImageFilledEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), Z_LVAL_PP(color)); RETURN_TRUE; -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif } /* }}} */ @@ -701,7 +717,6 @@ Draw a filled partial ellipse */ PHP_FUNCTION(imagefilledarc) { -#if HAVE_LIBGD20 zval **IM, **cx, **cy, **w, **h, **ST, **E, **col, **style; gdImagePtr im; int e, st; @@ -729,9 +744,6 @@ gdImageFilledArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), st, e, Z_LVAL_PP(col), Z_LVAL_PP(style)); RETURN_TRUE; -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif } /* }}} */ @@ -739,7 +751,6 @@ Turn alpha blending mode on or off for the given image */ PHP_FUNCTION(imagealphablending) { -#if HAVE_LIBGD20 zval **IM, **blend; gdImagePtr im; @@ -753,9 +764,6 @@ gdImageAlphaBlending(im, Z_LVAL_PP(blend)); RETURN_TRUE; -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif } /* }}} */ @@ -763,7 +771,6 @@ Resolve/Allocate a colour with an alpha level. Works for true colour and palette based images */ PHP_FUNCTION(imagecolorresolvealpha) { -#if HAVE_LIBGD20 zval **IM, ** red, **green, **blue, **alpha; gdImagePtr im; @@ -779,10 +786,6 @@ convert_to_long_ex(alpha); RETURN_LONG(gdImageColorResolveAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha))); -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif - } /* }}} */ @@ -790,7 +793,6 @@ Find the closest matching colour with alpha transparency */ PHP_FUNCTION(imagecolorclosestalpha) { -#if HAVE_LIBGD20 zval **IM, ** red, **green, **blue, **alpha; gdImagePtr im; @@ -806,9 +808,6 @@ convert_to_long_ex(alpha); RETURN_LONG(gdImageColorClosestAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha))); -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif } /* }}} */ @@ -816,7 +815,6 @@ Find exact match for colour with transparency */ PHP_FUNCTION(imagecolorexactalpha) { -#if HAVE_LIBGD20 zval **IM, **red, **green, **blue, **alpha; gdImagePtr im; @@ -832,9 +830,6 @@ convert_to_long_ex(alpha); RETURN_LONG(gdImageColorExactAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha))); -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif } /* }}} */ @@ -842,7 +837,6 @@ Copy and resize part of an image using resampling to help ensure clarity */ PHP_FUNCTION(imagecopyresampled) { -#if HAVE_LIBGD20 zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **DW, **DH; gdImagePtr im_dst, im_src; int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX; @@ -875,17 +869,15 @@ gdImageCopyResampled(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH); RETURN_TRUE; -#else - zend_error(E_WARNING, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); -#endif } -/* }}} */ +/* }}} */ +#endif +#if HAVE_GD_IMAGESETTILE /* {{{ proto int imagesettile(resource image, resource tile) Set the tile image to $tile when filling $image with the "IMG_COLOR_TILED" color */ PHP_FUNCTION(imagesettile) { -#if HAVE_GD_IMAGESETTILE zval **IM, **TILE; gdImagePtr im, tile; @@ -899,17 +891,15 @@ gdImageSetTile(im, tile); RETURN_TRUE; -#else - zend_error(E_WARNING, "%s(): requires a more recent version of GD", get_active_function_name(TSRMLS_C)); -#endif } /* }}} */ +#endif +#if HAVE_GD_IMAGESETBRUSH /* {{{ proto int imagesetbrush(resource image, resource brush) Set the brush image to $brush when filling $image with the "IMG_COLOR_BRUSHED" color */ PHP_FUNCTION(imagesetbrush) { -#if HAVE_GD_IMAGESETBRUSH zval **IM, **TILE; gdImagePtr im, tile; @@ -923,11 +913,9 @@ gdImageSetBrush(im, tile); RETURN_TRUE; -#else - zend_error(E_WARNING, "%s(): requires a more recent version of GD", get_active_function_name(TSRMLS_C)); -#endif } /* }}} */ +#endif /* {{{ proto int imagecreate(int x_size, int y_size) Create a new image */ @@ -986,7 +974,7 @@ #ifdef HAVE_LIBGD15 /* Based on ext/standard/images.c */ - if (data == NULL) + if (data == NULL || strlen(data) <= 0) return -1; if (!memcmp(data, php_sig_gd2, 3)) @@ -1004,7 +992,7 @@ gdIOCtx *io_ctx; io_ctx = gdNewDynamicCtx (8, data); if (io_ctx) { - if (getmbi(gdGetC, io_ctx) == 0 && skipheader(gdGetC, io_ctx) == 0 ) { + if (getmbi((int(*)(void*))gdGetC, io_ctx) == 0 && skipheader((int(*)(void*))gdGetC, io_ctx) == 0 ) { io_ctx->free(io_ctx); return PHP_GDIMG_TYPE_WBM; } else @@ -1017,11 +1005,11 @@ } /* }}} */ +#ifdef HAVE_LIBGD15 /* {{{ _php_image_create_from_string */ gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioctx_func_p)() TSRMLS_DC) { -#ifdef HAVE_LIBGD15 gdImagePtr im; gdIOCtx *io_ctx; @@ -1033,14 +1021,11 @@ im = (*ioctx_func_p)(io_ctx); if (!im) { - php_error(E_WARNING, "%s: Passed data is not in '%s' format", get_active_function_name(TSRMLS_C), tn); + php_error(E_WARNING, "%s(): Passed data is not in '%s' format", get_active_function_name(TSRMLS_C), tn); return NULL; } return im; -#else - return NULL; -#endif } /* }}} */ @@ -1048,7 +1033,6 @@ Create a new image from the image stream in the string */ PHP_FUNCTION(imagecreatefromstring) { -#ifdef HAVE_LIBGD15 zval **data; gdImagePtr im; int imtype; @@ -1068,7 +1052,7 @@ #ifdef HAVE_GD_JPG im = _php_image_create_from_string (data, "JPEG", gdImageCreateFromJpegCtx TSRMLS_CC); #else - php_error(E_WARNING, "No JPEG support in this PHP build"); + php_error(E_WARNING, "%s(): No JPEG support in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif break; @@ -1077,7 +1061,7 @@ #ifdef HAVE_GD_PNG im = _php_image_create_from_string (data, "PNG", gdImageCreateFromPngCtx TSRMLS_CC); #else - php_error(E_WARNING, "No PNG support in this PHP build"); + php_error(E_WARNING, "%s(): No PNG support in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif break; @@ -1086,7 +1070,7 @@ #ifdef HAVE_GD_GIF_READ im = _php_image_create_from_string (data, "GIF", gdImageCreateFromGifCtx TSRMLS_CC); #else - php_error(E_WARNING, "No GIF support in this PHP build"); + php_error(E_WARNING, "%s(): No GIF support in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif break; @@ -1095,7 +1079,7 @@ #ifdef HAVE_GD_WBMP im = _php_image_create_from_string (data, "WBMP", gdImageCreateFromWBMPCtx TSRMLS_CC); #else - php_error(E_WARNING, "No WBMP support in this PHP build"); + php_error(E_WARNING, "%s(): No WBMP support in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif break; @@ -1104,27 +1088,25 @@ #ifdef HAVE_GD_GD2 im = _php_image_create_from_string (data, "GD2", gdImageCreateFromGd2Ctx TSRMLS_CC); #else - php_error(E_WARNING, "No GD2 support in this PHP build"); + php_error(E_WARNING, "%s(): No GD2 support in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif break; default: - php_error(E_WARNING, "Data is not in a recognized format."); + php_error(E_WARNING, "%s(): Data is not in a recognized format.", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (!im) { - php_error(E_WARNING, "Couldn't create GD Image Stream out of Data"); + php_error(E_WARNING, "%s(): Couldn't create GD Image Stream out of Data", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, im, le_gd); -#else - php_error(E_WARNING, "ImageCreateFromString: Only available with GD 1.5+"); -#endif } /* }}} */ +#endif /* {{{ _php_image_create_from */ @@ -1137,8 +1119,9 @@ FILE * fp = NULL; int argc=ZEND_NUM_ARGS(); - if ((image_type == PHP_GDIMG_TYPE_GD2PART && argc != 4) || - argc != 1 || zend_get_parameters_ex(argc, &file, &srcx, &srcy, &width, &height) == FAILURE) { + if ((image_type == PHP_GDIMG_TYPE_GD2PART && argc != 5) || + (image_type != PHP_GDIMG_TYPE_GD2PART && argc != 1) || + zend_get_parameters_ex(argc, &file, &srcx, &srcy, &width, &height) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -1176,13 +1159,13 @@ buff_size = php_stream_copy_to_mem(stream, &buff, PHP_STREAM_COPY_ALL, 1); if(!buff_size) { - php_error(E_WARNING,"%s: Cannot read image data", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING,"%s(): Cannot read image data", get_active_function_name(TSRMLS_C)); goto out_err; } io_ctx = gdNewDynamicCtx(buff_size, buff); if(!io_ctx) { - php_error(E_WARNING,"%s: Cannot allocate GD IO context", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING,"%s(): Cannot allocate GD IO context", get_active_function_name(TSRMLS_C)); goto out_err; } if (image_type == PHP_GDIMG_TYPE_GD2PART) { @@ -1211,10 +1194,11 @@ if (im) { ZEND_REGISTER_RESOURCE(return_value, im, le_gd); + php_stream_close(stream); return; } - php_error(E_WARNING,"%s: '%s' is not a valid %s file", get_active_function_name(TSRMLS_C), fn, tn); + php_error(E_WARNING, "%s(): '%s' is not a valid %s file", get_active_function_name(TSRMLS_C), fn, tn); out_err: php_stream_close(stream); RETURN_FALSE; @@ -1222,57 +1206,45 @@ } /* }}} */ +#ifdef HAVE_GD_GIF_READ /* {{{ proto int imagecreatefromgif(string filename) Create a new image from GIF file or URL */ PHP_FUNCTION(imagecreatefromgif) { -#ifdef HAVE_GD_GIF_READ _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageCreateFromGif, gdImageCreateFromGifCtx); -#else /* HAVE_GD_GIF_READ */ - php_error(E_WARNING, "ImageCreateFromGif: No GIF read support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_GIF_READ */ } /* }}} */ +#endif /* HAVE_GD_GIF_READ */ +#ifdef HAVE_GD_JPG /* {{{ proto int imagecreatefromjpeg(string filename) Create a new image from JPEG file or URL */ PHP_FUNCTION(imagecreatefromjpeg) { -#ifdef HAVE_GD_JPG _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageCreateFromJpeg, gdImageCreateFromJpegCtx); -#else /* HAVE_GD_JPG */ - php_error(E_WARNING, "ImageCreateFromJpeg: No JPEG support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_JPG */ } /* }}} */ +#endif /* HAVE_GD_JPG */ +#ifdef HAVE_GD_PNG /* {{{ proto int imagecreatefrompng(string filename) Create a new image from PNG file or URL */ PHP_FUNCTION(imagecreatefrompng) { -#ifdef HAVE_GD_PNG _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImageCreateFromPng, gdImageCreateFromPngCtx); -#else /* HAVE_GD_PNG */ - php_error(E_WARNING, "ImageCreateFromPng: No PNG support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_PNG */ } /* }}} */ +#endif /* HAVE_GD_PNG */ +#ifdef HAVE_GD_XBM /* {{{ proto int imagecreatefromxbm(string filename) Create a new image from XBM file or URL */ PHP_FUNCTION(imagecreatefromxbm) { -#ifdef HAVE_GD_XBM _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XBM, "XBM", gdImageCreateFromXbm, NULL); -#else /* HAVE_GD_XBM */ - php_error(E_WARNING, "ImageCreateFromXbm: No XBM support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_XBM */ } /* }}} */ +#endif /* HAVE_GD_XBM */ /* {{{ proto int imagecreatefromxpm(string filename) Create a new image from XPM file or URL */ @@ -1283,7 +1255,7 @@ _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XPM, "XPM", gdImageCreateFromXpm, NULL); #else */ - php_error(E_WARNING, "ImageCreateFromXpm: No XPM support in this PHP build"); + php_error(E_WARNING, "%s(): No XPM support in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; /* #endif @@ -1291,18 +1263,15 @@ } /* }}} */ +#ifdef HAVE_GD_WBMP /* {{{ proto int imagecreatefromwbmp(string filename) Create a new image from WBMP file or URL */ PHP_FUNCTION(imagecreatefromwbmp) { -#ifdef HAVE_GD_WBMP _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageCreateFromWBMP, gdImageCreateFromWBMPCtx); -#else /* HAVE_GD_WBMP */ - php_error(E_WARNING, "ImageCreateFromWBMP: No WBMP support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_WBMP */ } /* }}} */ +#endif /* HAVE_GD_WBMP */ /* {{{ proto int imagecreatefromgd(string filename) Create a new image from GD file or URL */ @@ -1312,16 +1281,12 @@ } /* }}} */ +#ifdef HAVE_GD_GD2 /* {{{ proto int imagecreatefromgd2(string filename) Create a new image from GD2 file or URL */ PHP_FUNCTION(imagecreatefromgd2) { -#ifdef HAVE_GD_GD2 _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, "GD2", gdImageCreateFromGd2, gdImageCreateFromGd2Ctx); -#else /* HAVE_GD_GD2 */ - php_error(E_WARNING, "ImageCreateFromGd2: No GD2 support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_GD2 */ } /* }}} */ @@ -1329,14 +1294,10 @@ Create a new image from a given part of GD2 file or URL */ PHP_FUNCTION(imagecreatefromgd2part) { -#ifdef HAVE_GD_GD2 _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2PART, "GD2", gdImageCreateFromGd2Part, gdImageCreateFromGd2PartCtx); -#else /* HAVE_GD_GD2 */ - php_error(E_WARNING, "ImageCreateFromGd2Part: No GD2 support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_GD2 */ } /* }}} */ +#endif /* HAVE_GD_GD2 */ /* {{{ _php_image_output */ @@ -1369,20 +1330,20 @@ if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) { if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) { - php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(TSRMLS_C), fn); + php_error(E_WARNING, "%s(): Invalid filename '%s'", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } fp = VCWD_FOPEN(fn, "wb"); if (!fp) { - php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn); + php_error(E_WARNING, "%s(): Unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255", get_active_function_name(TSRMLS_C), q); + php_error(E_WARNING, "%s(): Invalid threshold value '%d'. It must be between 0 and 255", get_active_function_name(TSRMLS_C), q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, fp, q); @@ -1406,14 +1367,14 @@ tmp = tmpfile(); if (tmp == NULL) { - php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "%s(): Unable to open temporary file", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255", get_active_function_name(TSRMLS_C), q); + php_error(E_WARNING, "%s(): Invalid threshold value '%d'. It must be between 0 and 255", get_active_function_name(TSRMLS_C), q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, tmp, q); @@ -1448,73 +1409,61 @@ } /* }}} */ +#ifdef HAVE_GD_GIF_CREATE /* {{{ proto int imagegif(int im [, string filename]) Output GIF image to browser or file */ PHP_FUNCTION(imagegif) { -#ifdef HAVE_GD_GIF_CREATE #ifdef HAVE_GD_GIF_CTX _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGifCtx); #else _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGif); #endif -#else /* HAVE_GD_GIF_CREATE */ - php_error(E_WARNING, "ImageGif: No GIF create support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_GIF_CREATE */ } /* }}} */ +#endif /* HAVE_GD_GIF_CREATE */ +#ifdef HAVE_GD_PNG /* {{{ proto int imagepng(int im [, string filename]) Output PNG image to browser or file */ PHP_FUNCTION(imagepng) { -#ifdef HAVE_GD_PNG #ifdef USE_GD_IOCTX _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePngCtx); #else _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePng); #endif -#else /* HAVE_GD_PNG */ - php_error(E_WARNING, "ImagePng: No PNG support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_PNG */ } /* }}} */ +#endif /* HAVE_GD_PNG */ +#ifdef HAVE_GD_JPG /* {{{ proto int imagejpeg(int im [, string filename [, int quality]]) Output JPEG image to browser or file */ PHP_FUNCTION(imagejpeg) { -#ifdef HAVE_GD_JPG #ifdef USE_GD_IOCTX _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageJpegCtx); #else _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageJpeg); #endif -#else /* HAVE_GD_JPG */ - php_error(E_WARNING, "ImageJpeg: No JPG support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_JPG */ } /* }}} */ +#endif /* HAVE_GD_JPG */ +#ifdef HAVE_GD_WBMP /* {{{ proto int imagewbmp(int im [, string filename, [, int foreground]]) Output WBMP image to browser or file */ PHP_FUNCTION(imagewbmp) { -#ifdef HAVE_GD_WBMP #ifdef USE_GD_IOCTX _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageWBMPCtx); #else _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageWBMP); #endif -#else /* HAVE_GD_WBMP */ - php_error(E_WARNING, "ImageWBMP: No WBMP support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_WBMP */ } /* }}} */ +#endif /* HAVE_GD_WBMP */ /* {{{ proto int imagegd(int im [, string filename]) Output GD image to browser or file */ @@ -1524,18 +1473,15 @@ } /* }}} */ +#ifdef HAVE_GD_GD2 /* {{{ proto int imagegd2(int im [, string filename]) Output GD2 image to browser or file */ PHP_FUNCTION(imagegd2) { -#ifdef HAVE_GD_GD2 _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, "GD2", gdImageGd2); -#else /* HAVE_GD_GD2 */ - php_error(E_WARNING, "ImageGd2: No GD2 support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_GD2 */ } /* }}} */ +#endif /* HAVE_GD_GD2 */ /* {{{ proto int imagedestroy(int im) Destroy an image */ @@ -1577,11 +1523,11 @@ } /* }}} */ +#if HAVE_LIBGD15 /* {{{ proto int imagepalettecopy(int dst, int src) Copy the palette from the src image onto the dst image */ PHP_FUNCTION(imagepalettecopy) { -#if HAVE_LIBGD15 zval **dstim, **srcim; gdImagePtr dst, src; @@ -1593,12 +1539,9 @@ ZEND_FETCH_RESOURCE(src, gdImagePtr, srcim, -1, "Image", le_gd); gdImagePaletteCopy(dst, src); -#else - php_error(E_WARNING, "Sorry ImagePaletteCopy was introduced in GD version 1.5"); - RETURN_FALSE; -#endif } /* }}} */ +#endif /* {{{ proto int imagecolorat(int im, int x, int y) Get the index of the color of a pixel */ @@ -1621,7 +1564,7 @@ if (im->tpixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) { RETURN_LONG(gdImageTrueColorPixel(im, Z_LVAL_PP(x), Z_LVAL_PP(y))); } else { - php_error(E_NOTICE, "%ld,%ld is out of bounds",Z_LVAL_PP(x), Z_LVAL_PP(y)); + php_error(E_NOTICE, "%s(): %ld,%ld is out of bounds", get_active_function_name(TSRMLS_C), Z_LVAL_PP(x), Z_LVAL_PP(y)); RETURN_FALSE; } } else { @@ -1633,7 +1576,7 @@ RETURN_LONG(im->pixels[Z_LVAL_PP(x)][Z_LVAL_PP(y)]); #endif } else { - php_error(E_NOTICE, "%ld,%ld is out of bounds",Z_LVAL_PP(x), Z_LVAL_PP(y)); + php_error(E_NOTICE, "%s(): %ld,%ld is out of bounds", get_active_function_name(TSRMLS_C), Z_LVAL_PP(x), Z_LVAL_PP(y)); RETURN_FALSE; } #if HAVE_LIBGD20 @@ -1663,11 +1606,11 @@ } /* }}} */ +#if HAVE_COLORCLOSESTHWB /* {{{ proto int imagecolorclosesthwb(int im, int red, int green, int blue) Get the index of the color which has the hue, white and blackness nearest to the given color */ PHP_FUNCTION(imagecolorclosesthwb) { -#if HAVE_COLORCLOSESTHWB zval **IM, **red, **green, **blue; gdImagePtr im; @@ -1682,12 +1625,9 @@ convert_to_long_ex(blue); RETURN_LONG(gdImageColorClosestHWB(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue))); -#else - php_error(E_WARNING, "ImageColorClosestHWB functionality was added in GD 1.8"); - RETURN_FALSE; -#endif } /* }}} */ +#endif /* {{{ proto int imagecolordeallocate(int im, int index) De-allocate a color for an image */ @@ -1710,7 +1650,8 @@ gdImageColorDeallocate(im, col); RETURN_TRUE; } else { - php_error(E_WARNING, "Color index out of range"); + php_error(E_WARNING, "%s(): Color index %d out of range", + get_active_function_name(TSRMLS_C), col); RETURN_FALSE; } } @@ -1826,7 +1767,8 @@ } #endif else { - php_error(E_WARNING, "Color index out of range"); + php_error(E_WARNING, "%s(): Color index %d out of range", + get_active_function_name(TSRMLS_C), col); RETURN_FALSE; } } @@ -2187,18 +2129,18 @@ col = Z_LVAL_PP(COL); if (Z_TYPE_PP(POINTS) != IS_ARRAY) { - php_error(E_WARNING, "2nd argument to imagepolygon not an array"); + php_error(E_WARNING, "%s(): 2nd argument to imagepolygon not an array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } nelem = zend_hash_num_elements(Z_ARRVAL_PP(POINTS)); if (nelem < 6) { - php_error(E_WARNING, "you must have at least 3 points in your array"); + php_error(E_WARNING, "%s(): You must have at least 3 points in your array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (nelem < npoints * 2) { - php_error(E_WARNING, "trying to use %d points in array with only %d points", npoints, nelem/2); + php_error(E_WARNING, "%s(): Trying to use %d points in array with only %d points", get_active_function_name(TSRMLS_C), npoints, nelem/2); RETURN_FALSE; } @@ -2482,11 +2424,11 @@ } /* }}} */ +#if HAVE_LIBGD15 /* {{{ proto int imagecopymerge(int src_im, int dst_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct) Merge one part of an image with another */ PHP_FUNCTION(imagecopymerge) { -#if HAVE_LIBGD15 zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **PCT; gdImagePtr im_dst, im_src; int srcH, srcW, srcY, srcX, dstY, dstX, pct; @@ -2517,10 +2459,6 @@ gdImageCopyMerge(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct); RETURN_TRUE; -#else - php_error(E_WARNING, "ImageCopyMerge was introduced in GD version 1.5"); - RETURN_FALSE; -#endif } /* }}} */ @@ -2528,7 +2466,6 @@ Merge one part of an image with another */ PHP_FUNCTION(imagecopymergegray) { -#if HAVE_LIBGD15 zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **PCT; gdImagePtr im_dst, im_src; int srcH, srcW, srcY, srcX, dstY, dstX, pct; @@ -2559,12 +2496,9 @@ gdImageCopyMergeGray(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct); RETURN_TRUE; -#else - php_error(E_WARNING, "%s(): was introduced in GD version 1.5", get_active_function_name(TSRMLS_C)); - RETURN_FALSE; -#endif } /* }}} */ +#endif /* {{{ proto int imagecopyresized(int dst_im, int src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h) Copy and resize part of an image */ @@ -2644,17 +2578,14 @@ #define TTFTEXT_BBOX 1 #endif +#ifdef ENABLE_GD_TTF +#if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX /* {{{ proto array imageftbbox(int size, int angle, string font_file, string text[, array extrainfo]) Give the bounding box of a text using fonts via freetype2 */ PHP_FUNCTION(imageftbbox) { -#if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX, 1); -#else - php_error(E_WARNING, "%s(): No FreeType 2 support in this PHP build", get_active_function_name(TSRMLS_C)); - RETURN_FALSE; -#endif } /* }}} */ @@ -2662,26 +2593,17 @@ Write text to the image using fonts via freetype2 */ PHP_FUNCTION(imagefttext) { -#if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW, 1); -#else - php_error(E_WARNING, "%s(): No FreeType 2 support in this PHP build", get_active_function_name(TSRMLS_C)); - RETURN_FALSE; -#endif } /* }}} */ +#endif /* {{{ proto array imagettfbbox(int size, int angle, string font_file, string text) Give the bounding box of a text using TrueType fonts */ PHP_FUNCTION(imagettfbbox) { -#ifdef ENABLE_GD_TTF php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX, 0); -#else - php_error(E_WARNING, "ImageTtfBBox: No TTF support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ @@ -2689,16 +2611,10 @@ Write text to the image using a TrueType font */ PHP_FUNCTION(imagettftext) { -#ifdef ENABLE_GD_TTF php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW, 0); -#else - php_error(E_WARNING, "ImageTtfText: No TTF support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ -#ifdef ENABLE_GD_TTF /* {{{ php_imagettftext_common */ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extended) @@ -2820,7 +2736,7 @@ if (error) { - php_error(E_WARNING, "%s", error); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), error); RETURN_FALSE; } @@ -2840,7 +2756,7 @@ /* {{{ php_free_ps_font */ -void php_free_ps_font(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void php_free_ps_font(zend_rsrc_list_entry *rsrc TSRMLS_DC) { int *font = (int *)rsrc->ptr; @@ -2851,7 +2767,7 @@ /* {{{ php_free_ps_enc */ -void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { char **enc = (char **)rsrc->ptr; @@ -2859,13 +2775,10 @@ } /* }}} */ -#endif - /* {{{ proto int imagepsloadfont(string pathname) Load a new font from specified file */ PHP_FUNCTION(imagepsloadfont) { -#if HAVE_LIBT1 zval **file; int f_ind, *font; @@ -2880,33 +2793,29 @@ if (f_ind < 0) { switch (f_ind) { case -1: - php_error(E_WARNING, "Couldn't find the font file"); + php_error(E_WARNING, "%s(): Couldn't find the font file", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; case -2: case -3: - php_error(E_WARNING, "Memory allocation fault in t1lib"); + php_error(E_WARNING, "%s(): Memory allocation fault in t1lib", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; default: - php_error(E_WARNING, "An unknown error occurred in t1lib"); + php_error(E_WARNING, "%s(): An unknown error occurred in t1lib", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } } if (T1_LoadFont(f_ind)) { - php_error(E_WARNING, "Couldn't load the font"); + php_error(E_WARNING, "%s(): Couldn't load the font", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } font = (int *) emalloc(sizeof(int)); *font = f_ind; ZEND_REGISTER_RESOURCE(return_value, font, le_ps_font); -#else - php_error(E_WARNING, "ImagePsLoadFont: No T1lib support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ @@ -2915,7 +2824,6 @@ /* The function in t1lib which this function uses seem to be buggy... PHP_FUNCTION(imagepscopyfont) { -#if HAVE_LIBT1 zval **fnt; int l_ind, type; gd_ps_font *nf_ind, *of_ind; @@ -2962,10 +2870,6 @@ nf_ind->extend = 1; l_ind = zend_list_insert(nf_ind, le_ps_font); RETURN_LONG(l_ind); -#else - php_error(E_WARNING, "ImagePsCopyFont: No T1lib support in this PHP build"); - RETURN_FALSE; -#endif } */ /* }}} */ @@ -2974,7 +2878,6 @@ Free memory used by a font */ PHP_FUNCTION(imagepsfreefont) { -#if HAVE_LIBT1 zval **fnt; int *f_ind; @@ -2986,10 +2889,6 @@ zend_list_delete(Z_LVAL_PP(fnt)); RETURN_TRUE; -#else - php_error(E_WARNING, "ImagePsFreeFont: No T1lib support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ @@ -2997,7 +2896,6 @@ To change a fonts character encoding vector */ PHP_FUNCTION(imagepsencodefont) { -#if HAVE_LIBT1 zval **fnt, **enc; char **enc_vector; int *f_ind; @@ -3011,22 +2909,18 @@ ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font); if ((enc_vector = T1_LoadEncoding(Z_STRVAL_PP(enc))) == NULL) { - php_error(E_WARNING, "Couldn't load encoding vector from %s", Z_STRVAL_PP(enc)); + php_error(E_WARNING, "%s(): Couldn't load encoding vector from %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(enc)); RETURN_FALSE; } T1_DeleteAllSizes(*f_ind); if (T1_ReencodeFont(*f_ind, enc_vector)) { T1_DeleteEncoding(enc_vector); - php_error(E_WARNING, "Couldn't reencode font"); + php_error(E_WARNING, "%s(): Couldn't reencode font", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } zend_list_insert(enc_vector, le_ps_enc); RETURN_TRUE; -#else - php_error(E_WARNING, "ImagePsEncodeFont: No T1lib support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ @@ -3034,7 +2928,6 @@ Extend or or condense (if extend < 1) a font */ PHP_FUNCTION(imagepsextendfont) { -#if HAVE_LIBT1 zval **fnt, **ext; int *f_ind; @@ -3046,13 +2939,10 @@ ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font); + T1_DeleteAllSizes(*f_ind); if (T1_ExtendFont(*f_ind, Z_DVAL_PP(ext)) != 0) RETURN_FALSE; RETURN_TRUE; -#else - php_error(E_WARNING, "ImagePsExtendFont: No T1lib support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ @@ -3060,7 +2950,6 @@ Slant a font */ PHP_FUNCTION(imagepsslantfont) { -#if HAVE_LIBT1 zval **fnt, **slt; int *f_ind; @@ -3074,10 +2963,6 @@ if (T1_SlantFont(*f_ind, Z_DVAL_PP(slt)) != 0) RETURN_FALSE; RETURN_TRUE; -#else - php_error(E_WARNING, "ImagePsSlantFont: No T1lib support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ @@ -3085,7 +2970,6 @@ Rasterize a string over an image */ PHP_FUNCTION(imagepstext) { -#if HAVE_LIBT1 zval **img, **str, **fnt, **sz, **fg, **bg, **sp, **px, **py, **aas, **wd, **ang; int i, j, x, y; int space; @@ -3164,7 +3048,7 @@ T1_AASetLevel(T1_AA_HIGH); break; default: - php_error(E_WARNING, "Invalid value %d as number of steps for antialiasing", aa_steps); + php_error(E_WARNING, "%s(): Invalid value %d as number of steps for antialiasing", get_active_function_name(TSRMLS_C), aa_steps); RETURN_FALSE; } @@ -3195,7 +3079,7 @@ } if (T1_errno) { - php_error(E_WARNING, "libt1 returned error %d", T1_errno); + php_error(E_WARNING, "%s(): libt1 returned error %d", get_active_function_name(TSRMLS_C), T1_errno); RETURN_FALSE; } @@ -3215,7 +3099,7 @@ } if (array_init(return_value) == FAILURE) { - php_error(E_WARNING, "Couldn't initialize array for returning bounding box"); + php_error(E_WARNING, "%s(): Couldn't initialize array for returning bounding box", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -3223,11 +3107,6 @@ add_next_index_long(return_value, str_img->metrics.descent); add_next_index_long(return_value, str_img->metrics.rightSideBearing); add_next_index_long(return_value, str_img->metrics.ascent); - -#else - php_error(E_WARNING, "ImagePsText: No T1lib support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ @@ -3235,7 +3114,6 @@ Return the bounding box needed by a string if rasterized */ PHP_FUNCTION(imagepsbbox) { -#if HAVE_LIBT1 zval **str, **fnt, **sz, **sp, **wd, **ang; int i, space, add_width = 0, char_width, amount_kern; int cur_x, cur_y, dx, dy; @@ -3335,61 +3213,39 @@ add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*Z_LVAL_PP(sz)/1000)); add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*Z_LVAL_PP(sz)/1000)); add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*Z_LVAL_PP(sz)/1000)); -#else - php_error(E_WARNING, "ImagePsBBox: No T1lib support in this PHP build"); - RETURN_FALSE; -#endif } /* }}} */ +#endif +#ifdef HAVE_GD_WBMP /* {{{ proto int image2wbmp(int im [, string filename [, int threshold]]) Output WBMP image to browser or file */ PHP_FUNCTION(image2wbmp) { -#ifdef HAVE_GD_WBMP _php_image_output (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", _php_image_bw_convert); -#else /* HAVE_GD_WBMP */ - php_error(E_WARNING, "Image2Wbmp: No WBMP support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_WBMP */ } /* }}} */ +#endif /* HAVE_GD_WBMP */ +#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP) /* {{{ proto void jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold) Convert JPEG image to WBMP image */ PHP_FUNCTION(jpeg2wbmp) { -#ifdef HAVE_GD_JPG -#ifdef HAVE_GD_WBMP _php_image_convert (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG); -#else /* HAVE_GD_WBMP */ - php_error(E_WARNING, "jpeg2wbmp: No WBMP support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_WBMP */ -#else /* HAVE_GD_JPG */ - php_error(E_WARNING, "jpeg2wbmp: No JPG support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_JPG */ } /* }}} */ +#endif +#if defined(HAVE_GD_PNG) && defined(HAVE_GD_WBMP) /* {{{ proto void png2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold) Convert PNG image to WBMP image */ PHP_FUNCTION(png2wbmp) { -#ifdef HAVE_GD_PNG -#ifdef HAVE_GD_WBMP _php_image_convert (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG); -#else /* HAVE_GD_WBMP */ - php_error(E_WARNING, "png2wbmp: No WBMP support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_WBMP */ -#else /* HAVE_GD_PNG */ - php_error(E_WARNING, "png2wbmp: No PNG support in this PHP build"); - RETURN_FALSE; -#endif /* HAVE_GD_PNG */ } /* }}} */ +#endif #ifdef HAVE_GD_WBMP /* {{{ _php_image_bw_convert @@ -3406,18 +3262,18 @@ im_dest = gdImageCreate (dest_width, dest_height); if (im_dest == NULL) { - php_error (E_WARNING, "%s: unable to allocate temporary buffer", get_active_function_name(TSRMLS_C)); + php_error (E_WARNING, "%s(): Unable to allocate temporary buffer", get_active_function_name(TSRMLS_C)); return; } white = gdImageColorAllocate (im_dest, 255, 255, 255); if( white == -1) { - php_error (E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); + php_error (E_WARNING, "%s(): Unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); return; } black = gdImageColorAllocate (im_dest, 0, 0, 0); if (black == -1) { - php_error (E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); + php_error (E_WARNING, "%s(): Unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); return; } @@ -3480,33 +3336,33 @@ /* Check threshold value */ if( int_threshold < 0 || int_threshold > 8 ) { - php_error (E_WARNING, "Invalid threshold value '%d' in %s", int_threshold, get_active_function_name(TSRMLS_C)); + php_error (E_WARNING, "%s(): Invalid threshold value '%d'", get_active_function_name(TSRMLS_C), int_threshold); RETURN_FALSE; } /* Check origin file */ if (!fn_org || fn_org == empty_string || php_check_open_basedir(fn_org TSRMLS_CC)) { - php_error (E_WARNING, "%s: invalid origin filename '%s'", get_active_function_name(TSRMLS_C), fn_org); + php_error (E_WARNING, "%s(): Invalid origin filename '%s'", get_active_function_name(TSRMLS_C), fn_org); RETURN_FALSE; } /* Check destination file */ if (!fn_dest || fn_dest == empty_string || php_check_open_basedir(fn_dest TSRMLS_CC)) { - php_error (E_WARNING, "%s: invalid destination filename '%s'", get_active_function_name(TSRMLS_C), fn_dest); + php_error (E_WARNING, "%s(): Invalid destination filename '%s'", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } /* Open origin file */ org = VCWD_FOPEN(fn_org, "rb"); if (!org) { - php_error (E_WARNING, "%s: unable to open '%s' for reading", get_active_function_name(TSRMLS_C), fn_org); + php_error (E_WARNING, "%s(): Unable to open '%s' for reading", get_active_function_name(TSRMLS_C), fn_org); RETURN_FALSE; } /* Open destination file */ dest = VCWD_FOPEN(fn_dest, "wb"); if (!dest) { - php_error (E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn_dest); + php_error (E_WARNING, "%s(): Unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } @@ -3515,7 +3371,7 @@ case PHP_GDIMG_TYPE_GIF: im_org = gdImageCreateFromGif (org); if (im_org == NULL) { - php_error (E_WARNING, "%s: unable to open '%s' Not a valid GIF file", get_active_function_name(TSRMLS_C), fn_dest); + php_error (E_WARNING, "%s(): Unable to open '%s' Not a valid GIF file", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } break; @@ -3525,7 +3381,7 @@ case PHP_GDIMG_TYPE_JPG: im_org = gdImageCreateFromJpeg (org); if (im_org == NULL) { - php_error (E_WARNING, "%s: unable to open '%s' Not a valid JPEG file", get_active_function_name(TSRMLS_C), fn_dest); + php_error (E_WARNING, "%s(): Unable to open '%s' Not a valid JPEG file", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } break; @@ -3536,14 +3392,14 @@ case PHP_GDIMG_TYPE_PNG: im_org = gdImageCreateFromPng(org); if (im_org == NULL) { - php_error (E_WARNING, "%s: unable to open '%s' Not a valid PNG file", get_active_function_name(TSRMLS_C), fn_dest); + php_error (E_WARNING, "%s(): Unable to open '%s' Not a valid PNG file", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } break; #endif /* HAVE_GD_PNG */ default: - php_error(E_WARNING, "%s: Format not supported", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "%s(): Format not supported", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -3580,7 +3436,7 @@ im_tmp = gdImageCreate (dest_width, dest_height); if (im_tmp == NULL ) { - php_error(E_WARNING, "%s: unable to allocate temporary buffer", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "%s(): Unable to allocate temporary buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -3592,18 +3448,18 @@ im_dest = gdImageCreate(dest_width, dest_height); if (im_dest == NULL) { - php_error(E_WARNING, "%s: unable to allocate destination buffer", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "%s(): Unable to allocate destination buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } white = gdImageColorAllocate(im_dest, 255, 255, 255); if (white == -1) { - php_error(E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "%s(): Unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } black = gdImageColorAllocate(im_dest, 0, 0, 0); if (black == -1) { - php_error(E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "%s(): Unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } 1.2.2.1 +0 -8 php4/ext/gd/gd.dsp Index: gd.dsp =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gd/gd.dsp,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- gd.dsp 29 Apr 2002 02:30:45 -0000 1.2 +++ gd.dsp 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -168,10 +168,6 @@ # End Source File # Begin Source File -SOURCE=.\gdt1.c -# End Source File -# Begin Source File - SOURCE=.\gdttf.c # End Source File # End Group @@ -181,10 +177,6 @@ # Begin Source File SOURCE=.\gdcache.h -# End Source File -# Begin Source File - -SOURCE=.\gdt1.h # End Source File # Begin Source File 1.2.2.1 +3 -3 php4/ext/gd/gd_ctx.c Index: gd_ctx.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gd/gd_ctx.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- gd_ctx.c 29 Apr 2002 02:30:45 -0000 1.2 +++ gd_ctx.c 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -52,13 +52,13 @@ if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) { if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) { - php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(TSRMLS_C), fn); + php_error(E_WARNING, "%s(): Invalid filename '%s'", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } fp = VCWD_FOPEN(fn, "wb"); if (!fp) { - php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn); + php_error(E_WARNING, "%s(): Unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } @@ -79,7 +79,7 @@ switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(TSRMLS_C), q); + php_error(E_WARNING, "%s(): Invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(TSRMLS_C), q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, ctx, q); 1.2.2.1 +1 -15 php4/ext/gd/php_gd.h Index: php_gd.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gd/php_gd.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_gd.h 29 Apr 2002 02:30:45 -0000 1.2 +++ php_gd.h 9 Jul 2002 09:14:32 -0000 1.2.2.1 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_gd.h,v 1.39 2002/03/17 17:01:18 sander Exp $ */ +/* $Id: php_gd.h,v 1.41 2002/06/28 12:35:30 sniper Exp $ */ #ifndef PHP_GD_H #define PHP_GD_H @@ -30,12 +30,6 @@ #if HAVE_LIBGD -#include <gd.h> - -#if HAVE_LIBT1 -#include "gdt1.h" -#endif - #define PHP_GDIMG_TYPE_GIF 1 #define PHP_GDIMG_TYPE_PNG 2 #define PHP_GDIMG_TYPE_JPG 3 @@ -65,9 +59,6 @@ PHP_MINIT_FUNCTION(gd); PHP_MSHUTDOWN_FUNCTION(gd); -#ifndef HAVE_GDIMAGECOLORRESOLVE -extern int gdImageColorResolve(gdImagePtr, int, int, int); -#endif PHP_FUNCTION(imagearc); PHP_FUNCTION(imagechar); PHP_FUNCTION(imagecharup); @@ -165,11 +156,6 @@ PHP_FUNCTION(image2wbmp); PHP_GD_API int phpi_get_le_gd(void); - -/* This is missing from gd.h */ -#if HAVE_COLORCLOSESTHWB -int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b); -#endif #else No revision No revision 1.2.2.2 +1 -0 php4/ext/gd/libgd/gd.c Index: gd.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gd/libgd/gd.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- gd.c 19 May 2002 11:16:03 -0000 1.2.2.1 +++ gd.c 9 Jul 2002 09:14:33 -0000 1.2.2.2 @@ -748,6 +748,7 @@ } else { + p = gdImageGetPixel(im->tile, srcx, srcy); /* Allow for transparency */ if (p != gdImageGetTransparent (im->tile)) { 1.2.2.1 +6 -0 php4/ext/gd/libgd/gd.h Index: gd.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gd/libgd/gd.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- gd.h 29 Apr 2002 02:30:45 -0000 1.2 +++ gd.h 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -5,9 +5,15 @@ extern "C" { #endif +#ifndef WIN32 /* default fontpath for unix systems */ #define DEFAULT_FONTPATH "/usr/share/fonts/truetype" #define PATHSEPARATOR ":" +#else +/* default fontpath for windows systems */ +#define DEFAULT_FONTPATH "c:\\winnt\\fonts" +#define PATHSEPARATOR ";" +#endif /* gd.h: declarations file for the graphic-draw module. * Permission to use, copy, modify, and distribute this software and its No revision No revision 1.2.2.1 +3 -3 php4/ext/gmp/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gmp/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:46 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.6 2002/03/12 16:19:34 sas Exp $ +dnl $Id: config.m4,v 1.7 2002/06/21 00:15:48 sniper Exp $ dnl PHP_ARG_WITH(gmp, for GNU MP support, @@ -17,9 +17,9 @@ AC_MSG_ERROR(Unable to locate gmp.h) fi PHP_ADD_INCLUDE($GMP_DIR/include) - PHP_NEW_EXTENSION(gmp, gmp.c, $ext_shared) AC_DEFINE(HAVE_GMP, 1, [ ]) - PHP_ADD_LIBRARY_WITH_PATH(gmp, $GMP_DIR/lib) + PHP_SUBST(GMP_SHARED_LIBADD) + PHP_ADD_LIBRARY_WITH_PATH(gmp, $GMP_DIR/lib, GMP_SHARED_LIBADD) fi 1.2.2.1 +1 -1 php4/ext/gmp/gmp.c Index: gmp.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gmp/gmp.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- gmp.c 29 Apr 2002 02:30:46 -0000 1.2 +++ gmp.c 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -163,7 +163,7 @@ ZEND_MODULE_INFO_D(gmp) { php_info_print_table_start(); - php_info_print_table_header(2, "gmp support", "enabled"); + php_info_print_table_row(2, "gmp support", "enabled"); php_info_print_table_end(); /* Remove comments if you have entries in php.ini No revision No revision 1.2.2.1 +1 -3 php4/ext/gmp/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/gmp/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:46 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +2 -7 php4/ext/hwapi/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/hwapi/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:46 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.1 2002/04/10 13:33:57 steinm Exp $ +dnl $Id: config.m4,v 1.2 2002/06/09 00:53:24 sniper Exp $ PHP_ARG_WITH(hwapi, for hwapi support, [ --with-hwapi[=DIR] Include official Hyperwave API support]) @@ -26,15 +26,10 @@ PHP_ADD_LIBRARY_WITH_PATH(hwapi, $HWAPI_DIR/lib, HWAPI_SHARED_LIBADD) AC_DEFINE(HAVE_HWAPI,1,[ ]) - AC_MSG_RESULT(yes) PHP_REQUIRE_CXX -dnl PHP_EXTENSION(hwapi, $ext_shared) - PHP_NEW_EXTENSION(hwapi, hwapi.cpp) + PHP_NEW_EXTENSION(hwapi, hwapi.cpp, $ext_shared) PHP_ADD_LIBRARY(hwapi) PHP_ADD_LIBRARY(pthread) PHP_ADD_LIBRARY(stdc++) PHP_ADD_INCLUDE($HWAPI_DIR/include) -else - AC_DEFINE(HAVE_HWAPI,0,[ ]) - AC_MSG_RESULT(no) fi No revision No revision 1.2.2.1 +117 -120 php4/ext/hyperwave/hw.c Index: hw.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/hyperwave/hw.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- hw.c 29 Apr 2002 02:30:47 -0000 1.2 +++ hw.c 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: hw.c,v 1.106 2002/03/16 13:48:57 wez Exp $ */ +/* $Id: hw.c,v 1.108 2002/07/03 06:10:28 steinm Exp $ */ #include <stdlib.h> #include <errno.h> @@ -746,7 +746,7 @@ if(host) efree(host); if(password) efree(password); if(username) efree(username); - php_error(E_ERROR, "Could not get memory for connection details"); + php_error(E_ERROR, "%s(): Could not get memory for connection details", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } sprintf(hashed_details, "hw_%s_%d", host, port); @@ -759,7 +759,7 @@ list_entry new_le; if (HwSG(max_links)!=-1 && HwSG(num_links)>=HwSG(max_links)) { - php_error(E_ERROR, "Hyperwave: Too many open links (%d)", HwSG(num_links)); + php_error(E_ERROR, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), HwSG(num_links)); if(host) efree(host); if(username) efree(username); if(password) efree(password); @@ -767,7 +767,7 @@ RETURN_FALSE; } if (HwSG(max_persistent!=-1) && HwSG(num_persistent)>=HwSG(max_persistent)) { - php_error(E_ERROR, "Hyperwave: Too many open persistent links (%d)", HwSG(num_persistent)); + php_error(E_ERROR, "%s(): Too many open persistent links (%d)", get_active_function_name(TSRMLS_C), HwSG(num_persistent)); if(host) efree(host); if(username) efree(username); if(password) efree(password); @@ -776,7 +776,7 @@ } if ( (sockfd = open_hg_connection(host, port)) < 0 ) { - php_error(E_ERROR, "Could not open connection to %s, Port: %d (retval=%d, errno=%d)", host, port, sockfd, errno); + php_error(E_ERROR, "%s(): Could not open connection to %s, Port: %d (retval=%d, errno=%d)", get_active_function_name(TSRMLS_C), host, port, sockfd, errno); if(host) efree(host); if(username) efree(username); if(password) efree(password); @@ -785,7 +785,7 @@ } if(NULL == (ptr = malloc(sizeof(hw_connection)))) { - php_error(E_ERROR, "Could not get memory for connection structure"); + php_error(E_ERROR, "%s(): Could not get memory for connection structure", get_active_function_name(TSRMLS_C)); if(host) efree(host); if(username) efree(username); if(password) efree(password); @@ -794,7 +794,7 @@ } if(0 != (ptr->lasterror = initialize_hg_connection(sockfd, &do_swap, &version, &userdata, &server_string, username, password))) { - php_error(E_ERROR, "Could not initalize hyperwave connection"); + php_error(E_ERROR, "%s(): Could not initalize hyperwave connection", get_active_function_name(TSRMLS_C)); if(host) efree(host); if(username) efree(username); if(password) efree(password); @@ -819,7 +819,7 @@ Z_TYPE(new_le) = le_psocketp; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { - php_error(E_ERROR, "Could not hash table with connection details"); + php_error(E_ERROR, "%s(): Could not hash table with connection details", get_active_function_name(TSRMLS_C)); if(host) efree(host); if(username) efree(username); if(password) efree(password); @@ -872,7 +872,7 @@ } if ( (sockfd = open_hg_connection(host, port)) < 0 ) { - php_error(E_ERROR, "Could not open connection to %s, Port: %d (retval=%d", host, port, sockfd); + php_error(E_ERROR, "%s(): Could not open connection to %s, Port: %d (retval=%d", get_active_function_name(TSRMLS_C), host, port, sockfd); if(host) efree(host); if(username) efree(username); if(password) efree(password); @@ -889,7 +889,7 @@ } if(0 != (ptr->lasterror = initialize_hg_connection(sockfd, &do_swap, &version, &userdata, &server_string, username, password))) { - php_error(E_ERROR, "Could not initalize hyperwave connection"); + php_error(E_ERROR, "%s(): Could not initalize hyperwave connection", get_active_function_name(TSRMLS_C)); if(host) efree(host); if(username) efree(username); if(password) efree(password); @@ -916,7 +916,7 @@ new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) { - php_error(E_ERROR, "Could not update connection details in hash table"); + php_error(E_ERROR, "%s(): Could not update connection details in hash table", get_active_function_name(TSRMLS_C)); if(host) efree(host); efree(hashed_details); RETURN_FALSE; @@ -982,7 +982,7 @@ id=Z_LVAL_PP(arg1); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } zend_list_delete(id); @@ -1006,7 +1006,7 @@ id=Z_LVAL_PP(arg1); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } if(NULL != (str = get_hw_info(ptr))) { @@ -1038,7 +1038,7 @@ id=Z_LVAL_PP(arg1); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } RETURN_LONG(ptr->lasterror); @@ -1061,7 +1061,7 @@ id=Z_LVAL_PP(arg1); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1352,7 +1352,7 @@ link=Z_LVAL_PP(arg1); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); return NULL; } @@ -1519,7 +1519,7 @@ msgid=Z_LVAL_PP(arg3); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1570,7 +1570,7 @@ link=Z_LVAL_PP(argv[0]); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -1646,7 +1646,7 @@ parms=Z_STRVAL_P(arg3); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -1678,7 +1678,7 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1710,7 +1710,7 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1739,7 +1739,7 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1772,7 +1772,7 @@ newobjarr=Z_ARRVAL_P(arg3); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -1875,7 +1875,7 @@ addobjarr=Z_ARRVAL_PP(argv[3]); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2030,7 +2030,7 @@ if (0 == (ptr->lasterror = send_lock(ptr->socket, id))) { if (0 == (ptr->lasterror = send_changeobject(ptr->socket, id, modification))) { if (0 != (ptr->lasterror = send_unlock(ptr->socket, id))) { - php_error(E_WARNING, "Aiii, Changeobject failed and couldn't unlock object (id = 0x%X)", id); + php_error(E_WARNING, "%s(): Aiii, Changeobject failed and couldn't unlock object (id = 0x%X)", get_active_function_name(TSRMLS_C), id); free(modification); RETURN_FALSE; } @@ -2042,7 +2042,7 @@ RETURN_FALSE; } } else { - php_error(E_WARNING, "Could not lock object (id = 0x%X)", id); + php_error(E_WARNING, "%s(): Could not lock object (id = 0x%X)", get_active_function_name(TSRMLS_C), id); free(modification); RETURN_FALSE; } @@ -2061,7 +2061,7 @@ } break; default: - php_error(E_WARNING, "hw_modifyobject: Mode must be 0 or 1 (recursive)"); + php_error(E_WARNING, "%s(): Mode must be 0 or 1 (recursive)", get_active_function_name(TSRMLS_C)); } free(modification); RETURN_TRUE; @@ -2106,7 +2106,7 @@ } ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -2218,7 +2218,7 @@ id=Z_LVAL_P(argv[1]); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2260,7 +2260,7 @@ ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find socket identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find socket identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -2268,7 +2268,7 @@ docptr = zend_list_find(doc, &type); if(!docptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find document identifier %d", doc); + php_error(E_WARNING, "%s(): Unable to find document identifier %d", get_active_function_name(TSRMLS_C), doc); RETURN_FALSE; } @@ -2303,7 +2303,7 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2365,7 +2365,7 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2406,7 +2406,7 @@ objrec=Z_STRVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } set_swap(ptr->swap_on); @@ -2510,7 +2510,7 @@ rootid = Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -2556,7 +2556,7 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -2565,7 +2565,7 @@ convert_to_array(arg3); prefixarray =Z_ARRVAL_P(arg3); if((prefixarray == NULL) || (zend_hash_num_elements(prefixarray) != 5)) { - php_error(E_WARNING, "You must provide 5 urlprefixes (you have provided %d)", zend_hash_num_elements(prefixarray)); + php_error(E_WARNING, "%s(): You must provide 5 urlprefixes (you have provided %d)", get_active_function_name(TSRMLS_C), zend_hash_num_elements(prefixarray)); RETURN_FALSE; } @@ -2580,7 +2580,7 @@ zend_hash_get_current_data(prefixarray, (void *) &dataptr); data = *dataptr; if (Z_TYPE_P(data) != IS_STRING) { - php_error(E_WARNING, "%s must be a String", key); + php_error(E_WARNING, "%s(): %s must be a String", get_active_function_name(TSRMLS_C), key); RETURN_FALSE; } else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) { urlprefix[HW_DEFAULT_LINK] = Z_STRVAL_P(data); @@ -2593,7 +2593,7 @@ } else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) { urlprefix[HW_APPLET_LINK] = Z_STRVAL_P(data); } else { - php_error(E_WARNING, "%s is not a valid urlprefix", key); + php_error(E_WARNING, "%s(): %s is not a valid urlprefix", get_active_function_name(TSRMLS_C), key); RETURN_FALSE; } zend_hash_move_forward(prefixarray); @@ -2669,7 +2669,7 @@ id=Z_LVAL_P(argv[1]); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -2730,7 +2730,7 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2796,14 +2796,14 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find connection identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find connection identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } doc=Z_LVAL_P(arg3); docptr = zend_list_find(doc, &type); if(!docptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find document identifier %d", doc); + php_error(E_WARNING, "%s(): Unable to find document identifier %d", get_active_function_name(TSRMLS_C), doc); RETURN_FALSE; } @@ -2863,14 +2863,8 @@ PHP_FUNCTION(hw_new_document_from_file) { pval **arg1, **arg2; - int len, type; char *ptr; - int issock=0; - int socketd=0; - FILE *fp; php_stream *stream; - int ready=0; - int bcount=0; int use_include_path=0; hw_document *doc; @@ -2895,13 +2889,16 @@ doc->size = php_stream_copy_to_mem(stream, &doc->data, PHP_STREAM_COPY_ALL, 1); php_stream_close(stream); - - doc->data = realloc(doc->data, bcount+1); + + /* I'm not sure if it is necessary to add a '\0'. It depends on whether + * PHP-Strings has to be null terminated. doc->size doesn't count the + * '\0'. + */ + doc->data = realloc(doc->data, doc->size+1); ptr = doc->data; - ptr[bcount] = '\0'; + ptr[doc->size] = '\0'; doc->attributes = strdup(Z_STRVAL_PP(arg1)); doc->bodytag = NULL; - doc->size = bcount; Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); Z_TYPE_P(return_value) = IS_LONG; } @@ -2922,7 +2919,7 @@ id=Z_LVAL_P(arg1); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } zend_list_delete(id); @@ -2949,7 +2946,7 @@ id=Z_LVAL_P(arg1); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -2983,7 +2980,7 @@ id=Z_LVAL_P(argv[0]); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3028,7 +3025,7 @@ id=Z_LVAL_P(argv[0]); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3057,7 +3054,7 @@ id=Z_LVAL_P(argv[0]); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3092,7 +3089,7 @@ id=Z_LVAL_P(arg1); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3119,7 +3116,7 @@ id=Z_LVAL_P(arg1); ptr = zend_list_find(id, &type); if(!ptr || (type!=le_document)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3147,14 +3144,14 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getparentsobj(ptr->socket, id, &childObjRecs, &count))) { - php_error(E_WARNING, "send_command (getparentsobj) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3182,7 +3179,7 @@ id=Z_LVAL_P(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3192,7 +3189,7 @@ int i; if (0 != (ptr->lasterror = send_getparents(ptr->socket, id, &childIDs, &count))) { - php_error(E_WARNING, "send_command (getparents) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3228,7 +3225,7 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3238,7 +3235,7 @@ int i; if (0 != (ptr->lasterror = send_children(ptr->socket, id, &childIDs, &count))){ - php_error(E_WARNING, "send_command (getchildcoll) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3275,14 +3272,14 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_childrenobj(ptr->socket, id, &childObjRecs, &count))) { - php_error(E_WARNING, "send_command (getchildcollobj) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3310,7 +3307,7 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3320,7 +3317,7 @@ int i; if (0 != (ptr->lasterror = send_getchildcoll(ptr->socket, id, &childIDs, &count))){ - php_error(E_WARNING, "send_command (getchildcoll) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3357,14 +3354,14 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getchildcollobj(ptr->socket, id, &childObjRecs, &count))) { - php_error(E_WARNING, "send_command (getchildcollobj) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3391,7 +3388,7 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3423,7 +3420,7 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } @@ -3465,13 +3462,13 @@ if (maxhits < 0) maxhits=0x7FFFFFFF; ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getobjbyquery(ptr->socket, query, maxhits, &childIDs, &count))) { - php_error(E_WARNING, "send_command (getobjectbyquery) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3509,13 +3506,13 @@ if (maxhits < 0) maxhits=0x7FFFFFFF; ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getobjbyqueryobj(ptr->socket, query, maxhits, &childObjRecs, &count))) { - php_error(E_WARNING, "send_command (getobjectbyqueryobj) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3550,13 +3547,13 @@ if (maxhits < 0) maxhits=0x7FFFFFFF; ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getobjbyquerycoll(ptr->socket, id, query, maxhits, &childIDs, &count))) { - php_error(E_WARNING, "send_command (getobjectbyquerycoll) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3596,13 +3593,13 @@ if (maxhits < 0) maxhits=0x7FFFFFFF; ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getobjbyquerycollobj(ptr->socket, id, query, maxhits, &childObjRecs, &count))) { - php_error(E_WARNING, "send_command (getobjectbyquerycollobj) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3636,13 +3633,13 @@ if (maxhits < 0) maxhits=0x7FFFFFFF; ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getobjbyftquery(ptr->socket, query, maxhits, &childIDs, &weights, &count))) { - php_error(E_WARNING, "send_command (getobjectbyftquery) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3681,13 +3678,13 @@ if (maxhits < 0) maxhits=0x7FFFFFFF; ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getobjbyftqueryobj(ptr->socket, query, maxhits, &childObjRecs, &weights, &count))) { - php_error(E_WARNING, "send_command (getobjectbyftqueryobj) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3723,13 +3720,13 @@ if (maxhits < 0) maxhits=0x7FFFFFFF; ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getobjbyftquerycoll(ptr->socket, id, query, maxhits, &childIDs, &weights, &count))) { - php_error(E_WARNING, "send_command (getobjectbyquerycoll) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3770,13 +3767,13 @@ if (maxhits < 0) maxhits=0x7FFFFFFF; ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getobjbyftquerycollobj(ptr->socket, id, query, maxhits, &childObjRecs, &weights, &count))) { - php_error(E_WARNING, "send_command (getobjectbyquerycollobj) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3805,13 +3802,13 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getchilddoccoll(ptr->socket, id, &childIDs, &count))) { - php_error(E_WARNING, "send_command (getchilddoccoll) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3845,13 +3842,13 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getchilddoccollobj(ptr->socket, id, &childObjRecs, &count))) { - php_error(E_WARNING, "send_command (getchilddoccollobj) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3881,13 +3878,13 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getanchors(ptr->socket, id, &anchorIDs, &count))) { - php_error(E_WARNING, "send_command (getanchors) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3921,13 +3918,13 @@ id=Z_LVAL_PP(arg2); ptr = (hw_connection *) zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", id); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getanchorsobj(ptr->socket, id, &anchorObjRecs, &count))) { - php_error(E_WARNING, "send_command (getanchors) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -3952,7 +3949,7 @@ link = Z_LVAL_PP(arg1); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -3982,7 +3979,7 @@ passwd=Z_STRVAL_PP(arg3); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -3991,7 +3988,7 @@ char *str; if (0 != (ptr->lasterror = send_identify(ptr->socket, name, passwd, &userdata))) { - php_error(E_WARNING, "send_identify returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror); if(ptr->username) free(ptr->username); ptr->username = NULL; RETURN_FALSE; @@ -4079,19 +4076,19 @@ retcoll=Z_LVAL_PP(arg4); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } cobjids = zend_hash_num_elements(Z_ARRVAL_PP(arg2)); if(NULL == (objectIDs = make_ints_from_array(Z_ARRVAL_PP(arg2)))) { - php_error(E_WARNING, "Could not create Int Array from Array\n"); + php_error(E_WARNING, "%s(): Could not create Int Array from Array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ccollids = zend_hash_num_elements(Z_ARRVAL_PP(arg3)); if(NULL == (collIDs = make_ints_from_array(Z_ARRVAL_PP(arg3)))) { - php_error(E_WARNING, "Could not create Int Array from Array\n"); + php_error(E_WARNING, "%s(): Could not create Int Array from Array", get_active_function_name(TSRMLS_C)); efree(objectIDs); RETURN_FALSE; } @@ -4140,12 +4137,12 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } if(NULL == (objrec = make_objrec_from_array(Z_ARRVAL_PP(arg3)))) { - php_error(E_WARNING, "Could not create Object Record from Array\n"); + php_error(E_WARNING, "%s(): Could not create Object Record from Array", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -4189,7 +4186,7 @@ id = Z_LVAL_PP(argv[1]); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } @@ -4222,13 +4219,13 @@ id=Z_LVAL_PP(arg2); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_getsrcbydest(ptr->socket, id, &childObjRecs, &count))) { - php_error(E_WARNING, "send_command (getsrcbydest) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -4257,13 +4254,13 @@ id=Z_LVAL_PP(arg3); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = send_mapid(ptr->socket, servid, id, &virtid))) { - php_error(E_WARNING, "send_command (mapid) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } RETURN_LONG(virtid); @@ -4293,13 +4290,13 @@ destid=Z_LVAL_PP(arg4); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } set_swap(ptr->swap_on); if (0 != (ptr->lasterror = getrellink(ptr->socket, rootid, sourceid, destid, &anchorstr))) { - php_error(E_WARNING, "command (getrellink) returned %d\n", ptr->lasterror); + php_error(E_WARNING, "%s(): Command returned %d", get_active_function_name(TSRMLS_C), ptr->lasterror); RETURN_FALSE; } @@ -4343,7 +4340,7 @@ docid=Z_LVAL_PP(arg1); hwdoc = zend_list_find(docid, &type); if(!hwdoc || (type!=le_document)) { - php_error(E_WARNING, "Unable to find file identifier %d", docid); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), docid); RETURN_FALSE; } @@ -4353,7 +4350,7 @@ convert_to_array_ex(arg4); prefixarray =Z_ARRVAL_PP(arg4); if((prefixarray == NULL) || (zend_hash_num_elements(prefixarray) != 5)) { - php_error(E_WARNING, "You must provide 5 urlprefixes (you have provided %d)", zend_hash_num_elements(prefixarray)); + php_error(E_WARNING, "%s(): You must provide 5 urlprefixes (you have provided %d)", get_active_function_name(TSRMLS_C), zend_hash_num_elements(prefixarray)); RETURN_FALSE; } @@ -4368,7 +4365,7 @@ zend_hash_get_current_data(prefixarray, (void *) &dataptr); data = *dataptr; if (Z_TYPE_P(data) != IS_STRING) { - php_error(E_WARNING, "%s must be a String", key); + php_error(E_WARNING, "%s(): %s must be a String", get_active_function_name(TSRMLS_C), key); RETURN_FALSE; } else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) { urlprefix[HW_DEFAULT_LINK] = Z_STRVAL_P(data); @@ -4381,7 +4378,7 @@ } else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) { urlprefix[HW_APPLET_LINK] = Z_STRVAL_P(data); } else { - php_error(E_WARNING, "%s is not a valid urlprefix", key); + php_error(E_WARNING, "%s(): %s is not a valid urlprefix", get_active_function_name(TSRMLS_C), key); RETURN_FALSE; } zend_hash_move_forward(prefixarray); @@ -4391,7 +4388,7 @@ } if(zend_hash_num_elements(Z_ARRVAL_PP(arg2)) != zend_hash_num_elements(Z_ARRVAL_PP(arg3))) { - php_error(E_WARNING, "Unequal number of elments in arrays"); + php_error(E_WARNING, "%s(): Unequal number of elements in arrays", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -4402,7 +4399,7 @@ dest = make_strs_from_array(arrht); if (0 != (error = send_insertanchors(&(hwdoc->data), &count, anchorrecs, dest, zend_hash_num_elements(arrht), urlprefix, &bodytag))) { - php_error(E_WARNING, "command (insertanchors) returned %d\n", error); + php_error(E_WARNING, "%s(): Command returned %d", get_active_function_name(TSRMLS_C), error); RETURN_FALSE; } /*fprintf(stderr, "in hw_insertanchors: %s\n", hwdoc->attributes); */ @@ -4439,7 +4436,7 @@ link=Z_LVAL_PP(arg1); ptr = zend_list_find(link, &type); if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - php_error(E_WARNING, "Unable to find file identifier %d", link); + php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link); RETURN_FALSE; } No revision No revision 1.2.2.1 +15 -15 php4/ext/icap/php_icap.c Index: php_icap.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/icap/php_icap.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_icap.c 29 Apr 2002 02:30:47 -0000 1.2 +++ php_icap.c 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_icap.c,v 1.35 2002/02/28 08:26:15 sebastian Exp $ */ +/* $Id: php_icap.c,v 1.36 2002/06/28 10:51:45 derick Exp $ */ #define ICAP1 @@ -187,7 +187,7 @@ } icap_stream = cal_open(NULL, Z_STRVAL_P(calendar), 0); if (!icap_stream) { - php_error(E_WARNING, "Couldn't open stream %s\n", Z_STRVAL_P(calendar)); + php_error(E_WARNING, "%s(): Couldn't open stream %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(calendar)); RETURN_FALSE; } @@ -216,7 +216,7 @@ ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if(myargcount==2) { @@ -261,7 +261,7 @@ ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -276,7 +276,7 @@ cal_login(icap_stream, Z_STRVAL_P(calendar)); */ if (icap_stream == NULL) { - php_error(E_WARNING, "Couldn't re-open stream\n"); + php_error(E_WARNING, "%s(): Couldn't re-open stream", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } RETURN_TRUE; @@ -304,7 +304,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -332,7 +332,7 @@ ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if(myargcount==3) { @@ -410,7 +410,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -488,7 +488,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } /* @@ -524,7 +524,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } /* @@ -562,7 +562,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -632,7 +632,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -667,7 +667,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (cal_remove(icap_le_struct->icap_stream, Z_LVAL_P(uid))) @@ -724,7 +724,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -869,7 +869,7 @@ icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { - php_error(E_WARNING, "Unable to find stream pointer"); + php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } No revision No revision 1.2.2.2 +2 -2 php4/ext/iconv/iconv.c Index: iconv.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/iconv/iconv.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- iconv.c 30 Apr 2002 08:13:17 -0000 1.2.2.1 +++ iconv.c 9 Jul 2002 09:14:33 -0000 1.2.2.2 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: iconv.c,v 1.38 2002/04/28 01:37:54 sniper Exp $ */ +/* $Id: iconv.c,v 1.39 2002/06/28 07:12:32 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -236,7 +236,7 @@ out_buf = tmp_buf; out_p = tmp_buf; out_p += out_size; - out_left = in_len; + out_left = bsz; result = iconv(cd, (char **)&in_p, &in_left, &out_p, &out_left); out_size += bsz - out_left; } No revision No revision 1.2.2.1 +1 -3 php4/ext/iconv/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/iconv/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:47 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +4 -4 php4/ext/imap/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/imap/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:47 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.43 2002/04/02 00:04:53 sniper Exp $ +dnl $Id: config.m4,v 1.44 2002/06/01 20:14:57 sr Exp $ dnl AC_DEFUN(IMAP_INC_CHK,[if test -r "$i$1/c-client.h"; then @@ -127,10 +127,10 @@ old_CPPFLAGS=$CPPFLAGS CPPFLAGS=-I$IMAP_INC_DIR AC_EGREP_CPP(this_is_true, [ - #include "imap4r1.h" - #if defined(IMAPSSLPORT) +#include "imap4r1.h" +#if defined(IMAPSSLPORT) this_is_true - #endif +#endif ],[ AC_DEFINE(HAVE_IMAP2001, 1, [ ]) ],[]) 1.2.2.1 +3 -10 php4/ext/imap/imap.dsp Index: imap.dsp =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/imap/imap.dsp,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- imap.dsp 29 Apr 2002 02:30:47 -0000 1.2 +++ imap.dsp 9 Jul 2002 09:14:33 -0000 1.2.2.1 @@ -123,7 +123,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /D HAVE_IMAP2001=1 /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\imap\c-client" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /D HAVE_IMAP2001=1 /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x40d /d "NDEBUG" @@ -133,7 +133,8 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib cclient.lib Secur32.lib CertIdl.Lib /nologo /dll /machine:I386 /nodefaultlib:"LIBCMT" /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib cclient.lib Secur32.lib CertIdl.Lib /nologo /dll /machine:I386 /nodefaultlib:"LIBCMT" /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\imap" +# SUBTRACT LINK32 /nodefaultlib !ENDIF @@ -148,10 +149,6 @@ # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=..\..\win32\imap_sendmail.c -# End Source File -# Begin Source File - SOURCE=.\php_imap.c # End Source File # Begin Source File @@ -162,10 +159,6 @@ # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\win32\imap_sendmail.h -# End Source File # Begin Source File SOURCE=.\php_imap.h 1.2.2.2 +215 -108 php4/ext/imap/php_imap.c Index: php_imap.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/imap/php_imap.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_imap.c 19 May 2002 11:16:03 -0000 1.2.2.1 +++ php_imap.c 9 Jul 2002 09:14:33 -0000 1.2.2.2 @@ -25,7 +25,7 @@ | PHP 4.0 updates: Zeev Suraski <zeev****@zend*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.115 2002/05/13 00:29:22 jon Exp $ */ +/* $Id: php_imap.c,v 1.125 2002/07/02 23:45:32 fmk Exp $ */ #define IMAP41 @@ -51,8 +51,9 @@ #include <signal.h> #ifdef PHP_WIN32 -#include "winsock.h" -#include "win32/imap_sendmail.h" +#include <winsock.h> +#include <stdlib.h> +#include "win32/sendmail.h" MAILSTREAM DEFAULTPROTO; #endif @@ -61,7 +62,8 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC); static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC); -static void _php_imap_parse_address(ADDRESS *addresslist, char *fulladdress, zval *paddress TSRMLS_DC); +static void _php_imap_parse_address(ADDRESS *addresslist, char **fulladdress, zval *paddress TSRMLS_DC); +static int _php_imap_address_size(ADDRESS *addresslist); /* These function declarations are missing from the IMAP header files... */ void rfc822_date(char *date); @@ -633,20 +635,24 @@ if (IMAPG(imap_errorstack) != NIL) { /* output any remaining errors at their original error level */ - ecur = IMAPG(imap_errorstack); - while (ecur != NIL) { - php_error(E_NOTICE, "%s (errflg=%d)", ecur->LTEXT, ecur->errflg); - ecur = ecur->next; + if (EG(error_reporting) & E_NOTICE) { + ecur = IMAPG(imap_errorstack); + while (ecur != NIL) { + php_error(E_NOTICE, "%s(): %s (errflg=%d)", get_active_function_name(TSRMLS_C), ecur->LTEXT, ecur->errflg); + ecur = ecur->next; + } } mail_free_errorlist(&IMAPG(imap_errorstack)); } if (IMAPG(imap_alertstack) != NIL) { /* output any remaining alerts at E_NOTICE level */ - acur = IMAPG(imap_alertstack); - while (acur != NIL) { - php_error(E_NOTICE, acur->LTEXT); - acur = acur->next; + if (EG(error_reporting) & E_NOTICE) { + acur = IMAPG(imap_alertstack); + while (acur != NIL) { + php_error(E_NOTICE, "%s(): %s", get_active_function_name(TSRMLS_C), acur->LTEXT); + acur = acur->next; + } } mail_free_stringlist(&IMAPG(imap_alertstack)); IMAPG(imap_alertstack) = NIL; @@ -661,7 +667,6 @@ PHP_MINFO_FUNCTION(imap) { php_info_print_table_start(); - php_info_print_table_header(2, "IMAP Support", "enabled" ); #if HAVE_IMAP2001 php_info_print_table_row(2, "IMAP c-Client Version", "2001"); #elif HAVE_IMAP2000 @@ -858,7 +863,7 @@ imap_stream = mail_open(NIL, Z_STRVAL_PP(mailbox), flags); if (imap_stream == NIL) { - php_error(E_WARNING, "Couldn't open stream %s\n", Z_STRVAL_PP(mailbox)); + php_error(E_WARNING, "%s(): Couldn't open stream %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(mailbox)); efree(IMAPG(imap_user)); IMAPG(imap_user) = 0; efree(IMAPG(imap_password)); IMAPG(imap_password) = 0; RETURN_FALSE; @@ -897,7 +902,7 @@ php_imap_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); RETURN_TRUE; #else - php_error(E_WARNING, "Persistent IMAP connections are not yet supported.\n"); + php_error(E_WARNING, "%s(): Persistent IMAP connections are not yet supported.", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif } @@ -933,7 +938,7 @@ } imap_stream = mail_open(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), flags); if (imap_stream == NIL) { - php_error(E_WARNING, "Couldn't re-open stream\n"); + php_error(E_WARNING, "%s(): Couldn't re-open stream", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } imap_le_struct->imap_stream = imap_stream; @@ -1043,12 +1048,12 @@ /* set the callback for the GET_QUOTA function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) { - php_error(E_WARNING, "c-client imap_getquota failed"); + php_error(E_WARNING, "%s(): c-client imap_getquota failed", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (array_init(return_value) == FAILURE) { - php_error(E_WARNING, "Unable to allocate array memory"); + php_error(E_WARNING, "%s(): Unable to allocate array memory", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1237,7 +1242,7 @@ msgindex = Z_LVAL_PP(msgno); } if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) { - php_error(E_WARNING, "Bad message number"); + php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1610,7 +1615,7 @@ } if (!Z_LVAL_PP(msgno) || Z_LVAL_PP(msgno) < 1 || (unsigned) Z_LVAL_PP(msgno) > imap_le_struct->imap_stream->nmsgs) { - php_error(E_WARNING, "Bad message number"); + php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1861,14 +1866,14 @@ msgindex = Z_LVAL_PP(msgno); } if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) { - php_error(E_WARNING, "Bad message number"); + php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } mail_fetchstructure_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), &body , myargc == 3 ? Z_LVAL_PP(flags) : NIL); if (!body) { - php_error(E_WARNING, "No body information available"); + php_error(E_WARNING, "%s(): No body information available", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1901,7 +1906,7 @@ body = mail_fetchbody_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_STRVAL_PP(sec), &len, myargc==4 ? Z_LVAL_PP(flags) : NIL); if (!body) { - php_error(E_WARNING, "No body information available"); + php_error(E_WARNING, "%s(): No body information available", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } RETVAL_STRINGL(body, len, 1); @@ -2222,12 +2227,12 @@ if (state == ST_NORMAL) { /* process printable character */ if (SPECIAL(*inp)) { - php_error(E_WARNING, "imap_utf7_decode: Invalid modified UTF-7 character: `%c'", *inp); + php_error(E_WARNING, "%s(): Invalid modified UTF-7 character: `%c'", get_active_function_name(TSRMLS_C), *inp); RETURN_FALSE; } else if (*inp != '&') { outlen++; } else if (inp + 1 == endp) { - php_error(E_WARNING, "imap_utf7_decode: Unexpected end of string"); + php_error(E_WARNING, "%s(): Unexpected end of string", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } else if (inp[1] != '-') { state = ST_DECODE0; @@ -2238,12 +2243,12 @@ } else if (*inp == '-') { /* return to NORMAL mode */ if (state == ST_DECODE1) { - php_error(E_WARNING, "imap_utf7_decode: Stray modified base64 character: `%c'", *--inp); + php_error(E_WARNING, "%s(): Stray modified base64 character: `%c'", get_active_function_name(TSRMLS_C), *--inp); RETURN_FALSE; } state = ST_NORMAL; } else if (!B64CHAR(*inp)) { - php_error(E_WARNING, "imap_utf7_decode: Invalid modified base64 character: `%c'", *inp); + php_error(E_WARNING, "%s(): Invalid modified base64 character: `%c'", get_active_function_name(TSRMLS_C), *inp); RETURN_FALSE; } else { switch (state) { @@ -2264,13 +2269,13 @@ /* enforce end state */ if (state != ST_NORMAL) { - php_error(E_WARNING, "imap_utf7_decode: Unexpected end of string"); + php_error(E_WARNING, "%s(): Unexpected end of string", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } /* allocate output buffer */ if ((out = emalloc(outlen + 1)) == NULL) { - php_error(E_WARNING, "imap_utf7_decode: Unable to allocate result string"); + php_error(E_WARNING, "%s(): Unable to allocate result string", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -2322,7 +2327,7 @@ #if PHP_DEBUG /* warn if we computed outlen incorrectly */ if (outp - out != outlen) { - php_error(E_WARNING, "imap_utf7_decode: outp - out [%d] != outlen [%d]", outp - out, outlen); + php_error(E_WARNING, "%s(): outp - out [%d] != outlen [%d]", get_active_function_name(TSRMLS_C), outp - out, outlen); } #endif @@ -2388,7 +2393,7 @@ /* allocate output buffer */ if ((out = emalloc(outlen + 1)) == NULL) { - php_error(E_WARNING, "imap_utf7_encode: Unable to allocate result string"); + php_error(E_WARNING, "%s(): Unable to allocate result string", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -2440,7 +2445,7 @@ #if PHP_DEBUG /* warn if we computed outlen incorrectly */ if (outp - out != outlen) { - php_error(E_WARNING, "imap_utf7_encode: outp - out [%d] != outlen [%d]", outp - out, outlen); + php_error(E_WARNING, "%s(): outp - out [%d] != outlen [%d]", get_active_function_name(TSRMLS_C), outp - out, outlen); } #endif @@ -2524,7 +2529,7 @@ convert_to_long_ex(rev); convert_to_long_ex(pgm); if (Z_LVAL_PP(pgm) > SORTSIZE) { - php_error(E_WARNING, "Unrecognized sort criteria"); + php_error(E_WARNING, "%s(): Unrecognized sort criteria", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (myargc >= 4) { @@ -2588,7 +2593,7 @@ } if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) { - php_error(E_WARNING, "Bad message number"); + php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -2614,7 +2619,7 @@ msgindex = Z_LVAL_PP(msgno); if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) { - php_error(E_WARNING, "Bad message number"); + php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -2704,7 +2709,7 @@ convert_to_string_ex(section); if (!Z_LVAL_PP(msg) || Z_LVAL_PP(msg) < 1 || (unsigned) Z_LVAL_PP(msg) > imap_le_struct->imap_stream->nmsgs) { - php_error(E_WARNING, "Bad message number"); + php_error(E_WARNING, "%s(): Bad message number", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -2713,8 +2718,8 @@ } body=mail_body(imap_le_struct->imap_stream, Z_LVAL_PP(msg), Z_STRVAL_PP(section)); - if (Z_TYPE_P(body) <= TYPEMAX) { - add_property_long(return_value, "type", Z_TYPE_P(body)); + if (body->type <= TYPEMAX) { + add_property_long(return_value, "type", body->type); } if (body->encoding <= ENCMAX) { add_property_long(return_value, "encoding", body->encoding); @@ -2748,9 +2753,9 @@ add_property_long(return_value, "bytes", body->size.bytes); } #ifdef IMAP41 - if (Z_TYPE(body->disposition)) { + if (body->disposition.type) { add_property_long(return_value, "ifdisposition", 1); - add_property_string(return_value, "disposition", Z_TYPE(body->disposition), 1); + add_property_string(return_value, "disposition", body->disposition.type, 1); } else { add_property_long(return_value, "ifdisposition", 0); } @@ -2863,6 +2868,9 @@ if (env->references) { add_property_string(myoverview, "references", env->references, 1); } + if (env->in_reply_to) { + add_property_string(myoverview, "in_reply_to", env->in_reply_to, 1); + } add_property_long(myoverview, "size", elt->rfc822_size); add_property_long(myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i)); add_property_long(myoverview, "msgno", i); @@ -2899,12 +2907,12 @@ } if (Z_TYPE_PP(envelope) != IS_ARRAY) { - php_error(E_WARNING, "IMAP: Expected Array as envelope parameter"); + php_error(E_WARNING, "%s(): Expected Array as envelope parameter", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (Z_TYPE_PP(body) != IS_ARRAY) { - php_error(E_WARNING, "IMAP: Expected Array as body parameter"); + php_error(E_WARNING, "%s(): Expected Array as body parameter", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -2979,7 +2987,7 @@ if (zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); - Z_TYPE_P(bod) = (short) Z_LVAL_PP(pvalue); + bod->type = (short) Z_LVAL_PP(pvalue); } if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); @@ -3005,10 +3013,10 @@ convert_to_string_ex(pvalue); bod->description = cpystr(Z_STRVAL_PP(pvalue)); } - if (zend_hash_find(Z_ARRVAL_PP(data), "Z_TYPE(disposition)", sizeof("Z_TYPE(disposition)"), (void **) &pvalue)== SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) { convert_to_string_ex(pvalue); - Z_TYPE(bod->disposition) = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); - memcpy(Z_TYPE(bod->disposition), Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); + bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); } if (zend_hash_find(Z_ARRVAL_PP(data), "disposition", sizeof("disposition"), (void **) &pvalue)== SUCCESS) { if (Z_TYPE_PP(pvalue) == IS_ARRAY) { @@ -3065,7 +3073,7 @@ if (zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); - Z_TYPE_P(bod) = (short) Z_LVAL_PP(pvalue); + bod->type = (short) Z_LVAL_PP(pvalue); } if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); @@ -3091,10 +3099,10 @@ convert_to_string_ex(pvalue); bod->description = cpystr(Z_STRVAL_PP(pvalue)); } - if (zend_hash_find(Z_ARRVAL_PP(data), "Z_TYPE(disposition)", sizeof("Z_TYPE(disposition)"), (void **) &pvalue)== SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) { convert_to_string_ex(pvalue); - Z_TYPE(bod->disposition) = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); - memcpy(Z_TYPE(bod->disposition), Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); + bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); } if (zend_hash_find(Z_ARRVAL_PP(data), "disposition", sizeof("disposition"), (void **) &pvalue)== SUCCESS) { if (Z_TYPE_PP(pvalue) == IS_ARRAY) { @@ -3160,7 +3168,7 @@ bod = topbod; - if (bod && Z_TYPE_P(bod) == TYPEMULTIPART) { + if (bod && bod->type == TYPEMULTIPART) { /* first body part */ part = bod->nested.part; @@ -3234,7 +3242,7 @@ /* {{{ _php_imap_mail */ -int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath) +int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath TSRMLS_DC) { #ifdef PHP_WIN32 int tsm_err; @@ -3244,10 +3252,78 @@ #endif #ifdef PHP_WIN32 - if (imap_TSendMail(INI_STR("SMTP"), &tsm_err, headers, subject, to, message, cc, bcc, rpath) != SUCCESS) { - php_error(E_WARNING, "%s", GetSMErrorText(tsm_err)); + char *tempMailTo; + char *tsm_errmsg = NULL; + ADDRESS *addr; + char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL; + int offset; + + if (to && *to) { + tempMailTo = estrdup(to); + bufferTo = (char *)emalloc(strlen(to)); + offset = 0; + addr = NULL; + rfc822_parse_adrlist(&addr, tempMailTo, NULL); + while (addr) { + if (strcmp(addr->host, ERRHOST) == 0) + return (BAD_MSG_DESTINATION); + else { + offset += sprintf(bufferTo + offset, "%s@%s,", addr->mailbox, addr->host); + } + addr = addr->next; + } + efree(tempMailTo); + bufferTo[offset] = 0; + } + + if (cc && *cc) { + tempMailTo = estrdup(cc); + bufferCc = (char *)emalloc(strlen(cc)); + offset = 0; + addr = NULL; + rfc822_parse_adrlist(&addr, tempMailTo, NULL); + while (addr) { + if (strcmp(addr->host, ERRHOST) == 0) + return (BAD_MSG_DESTINATION); + else { + offset += sprintf(bufferCc + offset, "%s@%s,", addr->mailbox, addr->host); + } + addr = addr->next; + } + efree(tempMailTo); + bufferCc[offset] = 0; + } + + if (bcc && *bcc) { + tempMailTo = estrdup(bcc); + bufferBcc = (char *)emalloc(strlen(bcc)); + offset = 0; + addr = NULL; + rfc822_parse_adrlist(&addr, tempMailTo, NULL); + while (addr) { + if (strcmp(addr->host, ERRHOST) == 0) + return (BAD_MSG_DESTINATION); + else { + offset += sprintf(bufferBcc + offset, "%s@%s,", addr->mailbox, addr->host); + } + addr = addr->next; + } + efree(tempMailTo); + bufferBcc[offset] = 0; + } + + + if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, headers, subject, bufferTo, message, bufferCc, bufferBcc, rpath) != SUCCESS) { + if (tsm_errmsg) { + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), tsm_errmsg); + efree(tsm_errmsg); + } else { + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err)); + } return 0; } + if (bufferCc) efree(bufferCc); + if (bufferBcc) efree(bufferBcc); #else if (!INI_STR("sendmail_path")) { return 0; @@ -3270,7 +3346,7 @@ return 1; } } else { - php_error(E_WARNING, "Could not execute mail delivery program"); + php_error(E_WARNING, "%s(): Could not execute mail delivery program", get_active_function_name(TSRMLS_C)); return 0; } #endif @@ -3295,7 +3371,7 @@ if (Z_STRVAL_PP(argv[0])) { to = Z_STRVAL_PP(argv[0]); } else { - php_error(E_WARNING, "No to field in mail command"); + php_error(E_WARNING, "%s(): No to field in mail command", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -3304,7 +3380,7 @@ if (Z_STRVAL_PP(argv[1])) { subject = Z_STRVAL_PP(argv[1]); } else { - php_error(E_WARNING, "No subject field in mail command"); + php_error(E_WARNING, "%s(): No subject field in mail command", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -3314,7 +3390,7 @@ message = Z_STRVAL_PP(argv[2]); } else { /* this is not really an error, so it is allowed. */ - php_error(E_WARNING, "No message string in mail command"); + php_error(E_WARNING, "%s(): No message string in mail command", get_active_function_name(TSRMLS_C)); message = NULL; } @@ -3342,7 +3418,7 @@ rpath = Z_STRVAL_PP(argv[6]); } - if (_php_imap_mail(to, subject, message, headers, cc, bcc, rpath)) { + if (_php_imap_mail(to, subject, message, headers, cc, bcc, rpath TSRMLS_CC)) { RETURN_TRUE; } else { RETURN_FALSE; @@ -3569,7 +3645,7 @@ } efree(charset); } else { - php_error(E_WARNING, "Unable to allocate temporary memory buffer for imap_mime_header_decode"); + php_error(E_WARNING, "%s(): Unable to allocate temporary memory buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -3577,33 +3653,47 @@ /* Support Functions */ +/* {{{ _php_imap_get_address_size + */ +static int _php_imap_address_size (ADDRESS *addresslist) +{ + ADDRESS *tmp; + int ret=0; + + tmp = addresslist; + + if (tmp) do { + ret += (tmp->personal) ? strlen(tmp->personal) : 0; + ret += (tmp->adl) ? strlen(tmp->adl) : 0; + ret += (tmp->mailbox) ? strlen(tmp->mailbox) : 0; + ret += (tmp->host) ? strlen(tmp->host) : 0; + } while ((tmp = tmp->next)); + + /* rfc822_write_address_full() needs some extra space for '<>,', etc. */ + ret += (ret) ? MAILTMPLEN : 0; + + return ret; +} + +/* }}} */ + + /* {{{ _php_imap_parse_address */ -static void _php_imap_parse_address (ADDRESS *addresslist, char *fulladdress, zval *paddress TSRMLS_DC) +static void _php_imap_parse_address (ADDRESS *addresslist, char **fulladdress, zval *paddress TSRMLS_DC) { - ADDRESS *addresstmp, *addresstmp2; - char tempaddress[MAILTMPLEN]; + ADDRESS *addresstmp; zval *tmpvals; - int ok = 1; - + char *tmpstr; + int len=0; + addresstmp = addresslist; - fulladdress[0] = 0x00; - while (ok && addresstmp) { /* while length < 1000 and we are not at the end of the list */ - addresstmp2 = addresstmp->next; /* save the pointer to the next address */ - addresstmp->next = NULL; /* make this address the only one now. */ - tempaddress[0] = '\0'; /* reset tempaddress buffer */ - rfc822_write_address(tempaddress, addresstmp); /* ok, write the address into tempaddress string */ - if ((strlen(tempaddress) + strlen(fulladdress)) < 1000) { /* is the new address + total address < 1000 */ - if (strlen(fulladdress)) { - strcat(fulladdress, ","); /* put in a comma */ - } - strcat(fulladdress, tempaddress); /* put in the new address */ - } else { /* no */ - ok = 0; /* stop looping */ - strcat(fulladdress, ", ..."); - } /* DO NOT optimize this out - changing it breaks things */ - addresstmp->next = addresstmp2; /* reset the pointer to the next address first! */ - addresstmp = addresstmp->next; + + if ((len = _php_imap_address_size(addresstmp))) { + tmpstr = (char *) malloc (len); + tmpstr[0] = '\0'; + rfc822_write_address(tmpstr, addresstmp); + *fulladdress = tmpstr; } addresstmp = addresslist; @@ -3624,7 +3714,7 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC) { zval *paddress; - char fulladdress[MAILTMPLEN]; + char *fulladdress=NULL; object_init(myzvalue); @@ -3642,59 +3732,79 @@ if (en->to) { MAKE_STD_ZVAL(paddress); array_init(paddress); - _php_imap_parse_address(en->to, fulladdress, paddress TSRMLS_CC); - if (fulladdress) add_property_string(myzvalue, "toaddress", fulladdress, 1); + _php_imap_parse_address(en->to, &fulladdress, paddress TSRMLS_CC); + if (fulladdress) { + add_property_string(myzvalue, "toaddress", fulladdress, 1); + free(fulladdress); + } add_assoc_object(myzvalue, "to", paddress); } if (en->from) { MAKE_STD_ZVAL(paddress); array_init(paddress); - _php_imap_parse_address(en->from, fulladdress, paddress TSRMLS_CC); - if (fulladdress) add_property_string(myzvalue, "fromaddress", fulladdress, 1); + _php_imap_parse_address(en->from, &fulladdress, paddress TSRMLS_CC); + if (fulladdress) { + add_property_string(myzvalue, "fromaddress", fulladdress, 1); + free(fulladdress); + } add_assoc_object(myzvalue, "from", paddress); } if (en->cc) { MAKE_STD_ZVAL(paddress); array_init(paddress); - _php_imap_parse_address(en->cc, fulladdress, paddress TSRMLS_CC); - if (fulladdress) add_property_string(myzvalue, "ccaddress", fulladdress, 1); + _php_imap_parse_address(en->cc, &fulladdress, paddress TSRMLS_CC); + if (fulladdress) { + add_property_string(myzvalue, "ccaddress", fulladdress, 1); + free(fulladdress); + } add_assoc_object(myzvalue, "cc", paddress); } if (en->bcc) { MAKE_STD_ZVAL(paddress); array_init(paddress); - _php_imap_parse_address(en->bcc, fulladdress, paddress TSRMLS_CC); - if (fulladdress) add_property_string(myzvalue, "bccaddress", fulladdress, 1); + _php_imap_parse_address(en->bcc, &fulladdress, paddress TSRMLS_CC); + if (fulladdress) { + add_property_string(myzvalue, "bccaddress", fulladdress, 1); + free(fulladdress); + } add_assoc_object(myzvalue, "bcc", paddress); } if (en->reply_to) { MAKE_STD_ZVAL(paddress); array_init(paddress); - _php_imap_parse_address(en->reply_to, fulladdress, paddress TSRMLS_CC); - if (fulladdress) add_property_string(myzvalue, "reply_toaddress", fulladdress, 1); + _php_imap_parse_address(en->reply_to, &fulladdress, paddress TSRMLS_CC); + if (fulladdress) { + add_property_string(myzvalue, "reply_toaddress", fulladdress, 1); + free(fulladdress); + } add_assoc_object(myzvalue, "reply_to", paddress); } if (en->sender) { MAKE_STD_ZVAL(paddress); array_init(paddress); - _php_imap_parse_address(en->sender, fulladdress, paddress TSRMLS_CC); - if (fulladdress) add_property_string(myzvalue, "senderaddress", fulladdress, 1); + _php_imap_parse_address(en->sender, &fulladdress, paddress TSRMLS_CC); + if (fulladdress) { + add_property_string(myzvalue, "senderaddress", fulladdress, 1); + free(fulladdress); + } add_assoc_object(myzvalue, "sender", paddress); } if (en->return_path) { MAKE_STD_ZVAL(paddress); array_init(paddress); - _php_imap_parse_address(en->return_path, fulladdress, paddress TSRMLS_CC); - if (fulladdress) add_property_string(myzvalue, "return_pathaddress", fulladdress, 1); + _php_imap_parse_address(en->return_path, &fulladdress, paddress TSRMLS_CC); + if (fulladdress) { + add_property_string(myzvalue, "return_pathaddress", fulladdress, 1); + free(fulladdress); + } add_assoc_object(myzvalue, "return_path", paddress); } - } /* }}} */ @@ -3706,8 +3816,8 @@ PARAMETER *par, *dpar; PART *part; - if (Z_TYPE_P(body) <= TYPEMAX) { - add_property_long(arg, "type", Z_TYPE_P(body)); + if (body->type <= TYPEMAX) { + add_property_long(arg, "type", body->type); } if (body->encoding <= ENCMAX) { @@ -3744,9 +3854,9 @@ } #ifdef IMAP41 - if (Z_TYPE(body->disposition)) { + if (body->disposition.type) { add_property_long(arg, "ifdisposition", 1); - add_property_string(arg, "disposition", Z_TYPE(body->disposition), 1); + add_property_string(arg, "disposition", body->disposition.type, 1); } else { add_property_long(arg, "ifdisposition", 0); } @@ -3794,7 +3904,7 @@ add_assoc_object(arg, "parameters", parametres); /* multipart message ? */ - if (Z_TYPE_P(body) == TYPEMULTIPART) { + if (body->type == TYPEMULTIPART) { MAKE_STD_ZVAL(parametres); array_init(parametres); for (part = body->CONTENT_PART; part; part = part->next) { @@ -3807,7 +3917,7 @@ } /* encapsulated message ? */ - if ((Z_TYPE_P(body) == TYPEMESSAGE) && (!strcasecmp(body->subtype, "rfc822"))) { + if ((body->type == TYPEMESSAGE) && (!strcasecmp(body->subtype, "rfc822"))) { body = body->CONTENT_MSG_BODY; MAKE_STD_ZVAL(parametres); array_init(parametres); @@ -3895,7 +4005,7 @@ top = mail_thread(imap_le_struct->imap_stream, "REFERENCES", NIL, mail_criteria(criteria), flags); if(top == NIL) { - php_error(E_WARNING, "imap_thread returned an empty tree"); + php_error(E_WARNING, "%s(): Function returned an empty tree", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -4086,9 +4196,6 @@ TSRMLS_FETCH(); /* Author: CJH */ - if (!(EG(error_reporting) & E_NOTICE)) { - return; - } if (errflg != NIL) { /* CJH: maybe put these into a more comprehensive log for debugging purposes? */ if (IMAPG(imap_errorstack) == NIL) { IMAPG(imap_errorstack) = mail_newerrorlist(); No revision No revision 1.2.2.1 +2 -2 php4/ext/informix/Makefile.frag Index: Makefile.frag =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/informix/Makefile.frag,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- Makefile.frag 29 Apr 2002 02:30:47 -0000 1.2 +++ Makefile.frag 9 Jul 2002 09:14:34 -0000 1.2.2.1 @@ -1,5 +1,5 @@ -$(builddir)/ifx.c: $(srcdir)/ifx.ec $(builddir)/libphpifx.a +$(srcdir)/ifx.c: $(srcdir)/ifx.ec $(builddir)/libphpifx.a (if test -d $(INFORMIXDIR); then \ THREADLIB=POSIX $(INFORMIXDIR)/bin/esql -e $(IFX_ESQL_FLAGS) $(srcdir)/ifx.ec; mv ifx.c $@; \ else \ @@ -7,4 +7,4 @@ fi) $(builddir)/libphpifx.a: - $(LINK) $(IFX_LIBOBJS) + $(LIBTOOL) --mode=link $(CC) $(IFX_LIBOBJS) -o $@ 1.2.2.1 +9 -9 php4/ext/informix/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/informix/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:47 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:34 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.26 2002/03/12 16:21:48 sas Exp $ +dnl $Id: config.m4,v 1.27 2002/06/14 00:01:43 sniper Exp $ dnl PHP_ARG_WITH(informix,for Informix support, @@ -8,23 +8,19 @@ if test "$PHP_INFORMIX" != "no"; then - PHP_NEW_EXTENSION(informix, ifx.c, $ext_shared) - PHP_ADD_MAKEFILE_FRAGMENT - PHP_SUBST(INFORMIX_SHARED_LIBADD) - if test "$INFORMIXDIR" = ""; then AC_MSG_ERROR([INFORMIXDIR environment variable is not set.]) fi if test "$PHP_INFORMIX" = "yes"; then - PHP_ADD_INCLUDE($INFORMIXDIR/incl/esql) + IFX_INCLUDE=-I$INFORMIXDIR/incl/esql PHP_ADD_LIBPATH($INFORMIXDIR/lib, INFORMIX_SHARED_LIBADD) PHP_ADD_LIBPATH($INFORMIXDIR/lib/esql, INFORMIX_SHARED_LIBADD) else if test "$PHP_INFORMIX" != "$INFORMIXDIR"; then AC_MSG_ERROR([Specified Informix base install directory is different than your INFORMIXDIR environment variable.]) fi - PHP_ADD_INCLUDE($PHP_INFORMIX/incl/esql) + IFX_INCLUDE=-I$PHP_INFORMIX/incl/esql PHP_ADD_LIBPATH($PHP_INFORMIX/lib, INFORMIX_SHARED_LIBADD) PHP_ADD_LIBPATH($PHP_INFORMIX/lib/esql, INFORMIX_SHARED_LIBADD) fi @@ -58,7 +54,9 @@ else IFX_ESQL_FLAGS="$IFX_ESQL_FLAGS -EUHAVE_IFX_IUS" fi - PHP_SUBST(IFX_ESQL_FLAGS) + + PHP_NEW_EXTENSION(informix, ifx.c, $ext_shared,, $IFX_INCLUDE) + PHP_ADD_MAKEFILE_FRAGMENT for i in $IFX_LIBS; do case "$i" in @@ -90,7 +88,9 @@ esac done - AC_DEFINE(HAVE_IFX,1,[ ]) + PHP_SUBST(INFORMIX_SHARED_LIBADD) PHP_SUBST(INFORMIXDIR) PHP_SUBST(IFX_LIBOBJS) + PHP_SUBST(IFX_ESQL_FLAGS) + AC_DEFINE(HAVE_IFX,1,[ ]) fi 1.2.2.1 +2 -1 php4/ext/informix/ifx.ec Index: ifx.ec =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/informix/ifx.ec,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ifx.ec 29 Apr 2002 02:30:48 -0000 1.2 +++ ifx.ec 9 Jul 2002 09:14:34 -0000 1.2.2.1 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ifx.ec,v 1.65 2002/03/22 12:15:39 derick Exp $ */ +/* $Id: ifx.ec,v 1.66 2002/06/14 00:01:43 sniper Exp $ */ /* ------------------------------------------------------------------- * if you want a function reference : "grep '^\*\*' ifx.ec" will give @@ -41,6 +41,7 @@ #include "ext/standard/php_standard.h" #include "php_open_temporary_file.h" #include "php_informix.h" +#include "php_informix_includes.h" #include "php_globals.h" #include "php_ini.h" 1.2.2.1 +1 -57 php4/ext/informix/php_informix.h Index: php_informix.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/informix/php_informix.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_informix.h 29 Apr 2002 02:30:48 -0000 1.2 +++ php_informix.h 9 Jul 2002 09:14:34 -0000 1.2.2.1 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_informix.h,v 1.17 2001/12/11 15:29:41 sebastian Exp $ */ +/* $Id: php_informix.h,v 1.18 2002/06/14 00:01:44 sniper Exp $ */ #ifndef PHP_INFORMIX_H #define PHP_INFORMIX_H @@ -43,12 +43,6 @@ extern zend_module_entry ifx_module_entry; #define ifx_module_ptr &ifx_module_entry -#undef TYPEMAX -#undef CHAR - -#include "locator.h" -#include "sqltypes.h" - /* user functions */ PHP_MINIT_FUNCTION(ifx); PHP_RINIT_FUNCTION(ifx); @@ -121,56 +115,6 @@ # define IFXG(v) TSRMG(ifx_globals_id, zend_ifx_globals *, v) #else # define IFXG(v) (ifx_globals.v) -#endif - -#define MAX_RESID 64 -#define BLOBINFILE 0 /* 0=in memory, 1=in file */ - -/* query result set data */ -typedef struct ifx_res { - char connecid[16]; - char cursorid[16]; - char descrpid[16]; - char statemid[16]; - int isscroll; - int ishold; - int iscursory; - int paramquery; - int numcols; - int rowid; - int affected_rows; - long sqlerrd[6]; - int res_id[MAX_RESID]; -} IFX_RES; - -typedef struct _IFX_IDRES { - int type; - union { - struct { - int mode; - loc_t blob_data; - } BLOBRES; - - struct { - char *char_data; - int len; - } CHARRES; - -#if HAVE_IFX_IUS - struct { - ifx_lo_t slob_data; - ifx_lo_create_spec_t *createspec; - int lofd; - } SLOBRES; -#endif - } DATARES; -} IFX_IDRES; - -#define BLOB DATARES.BLOBRES -#define CHAR DATARES.CHARRES - -#if HAVE_IFX_IUS -#define SLOB DATARES.SLOBRES #endif #else /* not HAVE_IFX */ No revision No revision 1.2.2.2 +16 -14 php4/ext/interbase/interbase.c Index: interbase.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/interbase/interbase.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- interbase.c 19 May 2002 11:16:03 -0000 1.2.2.1 +++ interbase.c 9 Jul 2002 09:14:34 -0000 1.2.2.2 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interbase.c,v 1.85 2002/05/12 12:18:56 daniela Exp $ */ +/* $Id: interbase.c,v 1.87 2002/06/26 07:54:50 sas Exp $ */ /* TODO: Arrays, roles? @@ -105,10 +105,11 @@ PHP_FE(ibase_blob_import, NULL) PHP_FE(ibase_errmsg, NULL) +#ifdef SQL_DIALECT_V6 PHP_FE(ibase_add_user, NULL) PHP_FE(ibase_modify_user, NULL) PHP_FE(ibase_delete_user, NULL) - +#endif {NULL, NULL, NULL} }; @@ -284,13 +285,12 @@ static void _php_ibase_module_error(char *msg, ...) { va_list ap; - int len; TSRMLS_FETCH(); va_start(ap, msg); - len = vsnprintf(IBG(errmsg), MAX_ERRMSG - 1, msg, ap); + /* vsnprintf NUL terminates the buf and writes at most n-1 chars+NUL */ + vsnprintf(IBG(errmsg), MAX_ERRMSG, msg, ap); va_end(ap); - IBG(errmsg[len]) = '\0'; php_error(E_WARNING, "InterBase module: %s", IBG(errmsg)); } @@ -608,7 +608,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Interbase Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.85 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.87 $"); #ifdef COMPILE_DL_INTERBASE php_info_print_table_row(2, "Dynamic Module", "yes"); #endif @@ -2872,7 +2872,7 @@ extern int wsa_fp; */ /*to handle reading and writing to windows sockets*/ - + /* {{{ proto string ibase_blob_import([link_identifier, ] int file_id) Create blob, copy file in it, and close it */ @@ -2947,7 +2947,7 @@ RETVAL_STRINGL((char *)&ib_blob, sizeof(ibase_blob_handle), 1); } /* }}} */ - +#ifdef SQL_DIALECT_V6 /* {{{ _php_ibase_user() */ static void _php_ibase_user(INTERNAL_FUNCTION_PARAMETERS, int operation) { @@ -3102,31 +3102,33 @@ RETURN_TRUE; } - +/* }}} */ /* {{{ proto int ibase_add_user(string server, string dba_user_name, string dba_password, string user_name, string password [, string first_name] [, string middle_name] [, string last_name]) - Add an user to security database */ + Add an user to security database (only for IB6 or later) */ PHP_FUNCTION(ibase_add_user) { _php_ibase_user(INTERNAL_FUNCTION_PARAM_PASSTHRU, isc_action_svc_add_user); } /* }}} */ - /* {{{ proto int ibase_modify_user(string server, string dba_user_name, string dba_password, string user_name, string password [, string first_name] [, string middle_name] [, string last_name]) - Modify an user in security database */ + Modify an user in security database (only for IB6 or later) */ PHP_FUNCTION(ibase_modify_user) { _php_ibase_user(INTERNAL_FUNCTION_PARAM_PASSTHRU, isc_action_svc_modify_user); } - +/* }}} */ /* {{{ proto int ibase_delete_user(string server, string dba_user_name, string dba_password, string username) - Delete an user from security database */ + Delete an user from security database (only for IB6 or later) */ PHP_FUNCTION(ibase_delete_user) { _php_ibase_user(INTERNAL_FUNCTION_PARAM_PASSTHRU, isc_action_svc_delete_user); } +/* }}} */ + +#endif /* SQL_DIALECT_V6 */ #endif /* HAVE_IBASE */ 1.2.2.1 +3 -3 php4/ext/interbase/php_interbase.h Index: php_interbase.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/interbase/php_interbase.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_interbase.h 29 Apr 2002 02:30:48 -0000 1.2 +++ php_interbase.h 9 Jul 2002 09:14:34 -0000 1.2.2.1 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_interbase.h,v 1.26 2002/03/15 15:26:01 daniela Exp $ */ +/* $Id: php_interbase.h,v 1.27 2002/06/06 19:51:04 daniela Exp $ */ #ifndef PHP_INTERBASE_H #define PHP_INTERBASE_H @@ -69,11 +69,11 @@ PHP_FUNCTION(ibase_blob_echo); PHP_FUNCTION(ibase_blob_info); PHP_FUNCTION(ibase_blob_import); - +#ifdef SQL_DIALECT_V6 PHP_FUNCTION(ibase_add_user); PHP_FUNCTION(ibase_modify_user); PHP_FUNCTION(ibase_delete_user); - +#endif PHP_FUNCTION(ibase_errmsg); #define IBASE_MSGSIZE 256 No revision No revision 1.2.2.1 +1 -3 php4/ext/interbase/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/interbase/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:48 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:34 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +132 -62 php4/ext/ircg/ircg.c Index: ircg.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ircg/ircg.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ircg.c 29 Apr 2002 02:30:48 -0000 1.2 +++ ircg.c 9 Jul 2002 09:14:34 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ircg.c,v 1.129 2002/03/08 12:43:10 sas Exp $ */ +/* $Id: ircg.c,v 1.132 2002/06/29 18:46:49 sas Exp $ */ /* {{{ includes */ @@ -33,6 +33,7 @@ #include "php_ircg.h" #include "ext/standard/html.h" +#include "ext/standard/php_lcg.h" #include "ext/standard/php_smart_str.h" #include "ext/standard/info.h" #include "ext/standard/basic_functions.h" @@ -53,7 +54,6 @@ #include <arpa/inet.h> #endif -#define IRCG_ERROR_MSG_GC_INTERVAL 50 /* }}} */ @@ -164,9 +164,11 @@ irconn_t conn; smart_str buffer; time_t login; - int buffer_count; int fd; int irconn_id; +#if 0 + struct sockaddr_in sin; /* address of stream conn */ +#endif php_fmt_msgs_t *fmt_msgs; irc_write_buf wb; HashTable ctcp_msgs; @@ -217,6 +219,8 @@ static void msg_send(php_irconn_t *conn, smart_str *msg); +static php_irconn_t *flush_data; + /* }}} */ /* {{{ Default format messages */ @@ -323,6 +327,28 @@ /* }}} */ + +static int is_my_conn(php_irconn_t *conn) +{ +#if 0 + struct sockaddr_in sin; + socklen_t len = sizeof(sin); + + if (getpeername(conn->fd, &sin, &len)) { + if (errno == EBADF || errno == ENOTSOCK || errno == ENOTCONN) + return 0; + else + /* closing a connection is better than leaking fds */ + return 1; + } + + if (sin.sin_addr.s_addr == conn->sin.sin_addr.s_addr + && sin.sin_port == conn->sin.sin_port) +#endif + return 1; + return 0; +} + /* {{{ quit_handler */ static void quit_handler(irconn_t *c, void *dummy) @@ -334,7 +360,8 @@ zend_hash_index_del(&h_fd2irconn, conn->fd); if (conn->file_fd == -1) irc_write_buf_del(&conn->wb); - shutdown(conn->fd, 2); + if (is_my_conn(conn)) + shutdown(conn->fd, 2); } if (conn->file_fd != -1) { smart_str m = {0}; @@ -351,7 +378,7 @@ zend_hash_index_del(&h_irconn, conn->irconn_id); zend_hash_destroy(&conn->ctcp_msgs); - if (conn->buffer.c) smart_str_free_ex(&conn->buffer, 1); + smart_str_free_ex(&conn->buffer, 1); #ifdef IRCG_PENDING_URL if (conn->od_port) { @@ -391,13 +418,14 @@ static void ircg_nickname_escape(smart_str *input, smart_str *output) { - char *p; - char *end; - char c; + unsigned char *p; + unsigned char *end; + unsigned char c; - end = input->c + input->len; + p = (unsigned char *) input->c; + end = p + input->len; - for(p = input->c; p < end; p++) { + while (p < end) { c = *p; if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') @@ -408,6 +436,7 @@ smart_str_appendc_ex(output, hextab[c >> 4], 1); smart_str_appendc_ex(output, hextab[c & 15], 1); } + p++; } } @@ -565,6 +594,7 @@ case '%': NEW_TOKEN(C_PERCENT, v) = 0; break; default: /* ignore invalid combinations */ + break; } p = q + 1; /* skip last format character */ } while (p < pe); @@ -673,12 +703,6 @@ #define ADD_HEADER(a) sapi_add_header(a, sizeof(a) - 1, 1) -static void msg_http_start(php_irconn_t *conn TSRMLS_DC) -{ - ADD_HEADER("Pragma: no-cache"); - sapi_send_headers(TSRMLS_C); -} - static void http_closed_connection(int fd) { int *id, stored_id; @@ -694,6 +718,25 @@ /* }}} */ +static time_t ircg_now(void) +{ + struct timeval now; + +#if IRCG_API_VERSION >= 20010601 + if (ircg_now_time_t != (time_t) 0) + return ircg_now_time_t; + else +#endif + gettimeofday(&now, NULL); + + return now.tv_sec; +} + +#define GC_INTVL 60 +#define WINDOW_TIMEOUT (3 * 60) + +static const char timeout_message[] = "Timed out waiting for streaming window"; + /* {{{ Message-delivery */ static void msg_accum_send(php_irconn_t *conn, smart_str *msg) { @@ -703,32 +746,19 @@ if (conn->file_fd != -1) { write(conn->file_fd, msg->c, msg->len); - smart_str_free_ex(msg, 1); - return; + goto done; } switch (conn->fd) { case -2: /* Connection was finished */ - smart_str_free_ex(msg, 1); - break; + goto done; case -1: /* No message window yet. Buffer */ - if (conn->buffer_count++ > 10) { - struct timeval now; - - smart_str_free_ex(msg, 1); -#if IRCG_API_VERSION >= 20010601 - if (ircg_now_time_t != (time_t) 0) - now.tv_sec = ircg_now_time_t; - else -#endif - gettimeofday(&now, NULL); - if ((now.tv_sec - conn->login) > 30) - irc_disconnect(&conn->conn, "Timed out waiting for window"); - return; + if ((ircg_now() - conn->login) > WINDOW_TIMEOUT) { + irc_disconnect(&conn->conn, timeout_message); + goto done; } smart_str_append_ex(&conn->buffer, msg, 1); - smart_str_free_ex(msg, 1); - break; + goto done; default: #if IRCG_API_VERSION - 0 >= 20010601 if ((n = irc_write_buf_append_ex(&conn->wb, msg, 0))) { @@ -757,14 +787,20 @@ irc_disconnect(&conn->conn, reason); } + return; #elif IRCG_API_VERSION - 0 >= 20010302 - irc_write_buf_append_ex(&conn->wb, msg, 0); + irc_write_buf_append_ex(&conn->wb, msg, 0); /* no copy */ + return; #else irc_write_buf_append(&conn->wb, msg); - smart_str_free_ex(msg, 1); + goto done; #endif break; } + + +done: + smart_str_free_ex(msg, 1); } static void msg_send(php_irconn_t *conn, smart_str *msg) @@ -923,7 +959,7 @@ * from the IRC server, and will usually present a nicely formatted * error message to the end-user. * - * We automatically garbage-collect every n-th login, so there is + * We automatically garbage-collect every GC_INTVL seconds, so there is * no need for a separate gc thread. */ @@ -931,9 +967,11 @@ smart_str msg; int msgid; int id; + time_t when; struct errormsg *next; }; +static time_t next_gc; static struct errormsg *errormsgs; static void error_msg_dtor(struct errormsg *m) @@ -942,21 +980,22 @@ free(m); } -static void error_msg_gc(void) +static void error_msg_gc(time_t now) { struct errormsg *m, *prev = NULL, *next; - int lim; + time_t lim; - lim = irconn_id - IRCG_ERROR_MSG_GC_INTERVAL; + lim = now - GC_INTVL; + next_gc = now + GC_INTVL; for (m = errormsgs; m; prev = m, m = m->next) { - if (m->id < lim) { + if (m->when < lim) { struct errormsg *to; /* Check whether we have subsequent outdated records */ for (to = m->next; to; to = next) { next = to->next; - if (m->id >= lim) break; + if (m->when >= lim) break; error_msg_dtor(to); } @@ -987,6 +1026,7 @@ m->id = conn->irconn_id; } + m->when = ircg_now(); m->msg.len = 0; smart_str_append_ex(&m->msg, msg, 1); m->msgid = msgid; @@ -1134,6 +1174,13 @@ if (conn->fd >= 0) send(conn->fd, " ", 2, 0); + else if (conn->file_fd < 0 && (ircg_now() - conn->login) > WINDOW_TIMEOUT) { + char buf[1024]; + + sprintf(buf, "timeout after %d seconds (%d, %d)", ircg_now()-conn->login, + ircg_now(), conn->login); + irc_disconnect(ircc, buf); + } } static void user_kick(irconn_t *ircc, smart_str *channel, smart_str *who, smart_str *kicked_by, smart_str *reason, void *dummy) @@ -1272,6 +1319,9 @@ #ifdef IRCG_WITH_THTTPD zval **p1; php_irconn_t *conn; +#if 0 + socklen_t len = sizeof(struct sockaddr_in); +#endif if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &p1) == FAILURE) WRONG_PARAM_COUNT; @@ -1287,8 +1337,16 @@ zend_hash_index_del(&h_fd2irconn, conn->fd); if (conn->file_fd == -1) irc_write_buf_del(&conn->wb); - shutdown(conn->fd, 2); + if (is_my_conn(conn)) + shutdown(conn->fd, 2); + } + +#if 0 + /* store peer information for safe shutdown */ + if (getpeername(conn->fd, &conn->sin, &len) == -1) { + php_error(E_WARNING, "getpeername failed: %d (%s)", errno, strerror(errno)); } +#endif irc_set_currents++; thttpd_register_on_close(http_closed_connection); @@ -1300,10 +1358,8 @@ } zend_hash_index_update(&h_fd2irconn, conn->fd, &Z_LVAL_PP(p1), sizeof(int), NULL); if (conn->file_fd == -1) { + flush_data = conn; irc_write_buf_add(&conn->wb, conn->fd); - msg_http_start(conn TSRMLS_CC); - msg_replay_buffer(conn); - irc_write_buf_flush(&conn->wb); } RETURN_TRUE; @@ -1800,7 +1856,6 @@ php_fmt_msgs_t *fmt_msgs = NULL; php_irconn_t *conn; int bailout_on_trivial = 1; - struct timeval tv; if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 7 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &p1, &p2, &p3, &p4, &p5, &p6, &p7) == FAILURE) @@ -1874,24 +1929,22 @@ } conn->password = conn->ident = NULL; if (irconn_id == 0) - irconn_id = time(NULL); + irconn_id = 10000.0 * php_combined_lcg(TSRMLS_C); else + irconn_id += 20.0 * (1.0 + php_combined_lcg(TSRMLS_C)); + + + while (zend_hash_index_exists(&h_irconn, irconn_id)) { irconn_id++; - if ((irconn_id % IRCG_ERROR_MSG_GC_INTERVAL) == 0) - error_msg_gc(); + } + conn->irconn_id = irconn_id; zend_hash_index_update(&h_irconn, irconn_id, &conn, sizeof(conn), NULL); conn->buffer.c = NULL; - conn->buffer_count = 0; -#if IRCG_API_VERSION >= 20010601 - if (ircg_now_time_t != (time_t) 0) - conn->login = ircg_now_time_t; - else -#endif - { - gettimeofday(&tv, NULL); - conn->login = tv.tv_sec; - } + conn->login = ircg_now(); + + if (conn->login >= next_gc) + error_msg_gc(conn->login); RETVAL_LONG(irconn_id); } @@ -2023,6 +2076,23 @@ } /* }}} */ +/* {{{ PHP_RSHUTDOWN + */ +PHP_RSHUTDOWN_FUNCTION(ircg) +{ + if (flush_data) { + php_irconn_t *conn = flush_data; + + msg_replay_buffer(conn); + irc_write_buf_flush(&conn->wb); + + flush_data = NULL; + } + + return SUCCESS; +} +/* }}} */ + /* {{{ ircg_module_entry */ zend_module_entry ircg_module_entry = { STANDARD_MODULE_HEADER, @@ -2031,7 +2101,7 @@ PHP_MINIT(ircg), PHP_MSHUTDOWN(ircg), NULL, - NULL, + PHP_RSHUTDOWN(ircg), PHP_MINFO(ircg), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES No revision No revision 1.2.2.1 +4 -3 php4/ext/ldap/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ldap/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:49 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:34 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.23 2002/03/12 16:22:40 sas Exp $ +dnl $Id: config.m4,v 1.25 2002/06/24 09:25:51 sniper Exp $ dnl AC_DEFUN(PHP_LDAP_CHECKS, [ @@ -103,6 +103,7 @@ fi CPPFLAGS=$_SAVE_CPPFLAGS - dnl Solaris 2.8 claims to be 2004 API, but doesn't have ldap_parse_reference - AC_CHECK_FUNCS(ldap_parse_reference) + dnl Solaris 2.8 claims to be 2004 API, but doesn't have + dnl ldap_parse_reference() nor ldap_start_tls_s() + AC_CHECK_FUNCS([ldap_parse_reference ldap_start_tls_s]) fi 1.2.2.2 +55 -55 php4/ext/ldap/ldap.c Index: ldap.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ldap/ldap.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- ldap.c 9 May 2002 04:16:59 -0000 1.2.2.1 +++ ldap.c 9 Jul 2002 09:14:34 -0000 1.2.2.2 @@ -22,7 +22,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ldap.c,v 1.118 2002/05/04 14:27:48 venaas Exp $ */ +/* $Id: ldap.c,v 1.124 2002/06/30 11:14:27 derick Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -119,13 +119,14 @@ PHP_FE(ldap_parse_result, arg3to6of6_force_ref) PHP_FE(ldap_first_reference, NULL) PHP_FE(ldap_next_reference, NULL) +#ifdef HAVE_LDAP_PARSE_REFERENCE PHP_FE(ldap_parse_reference, third_argument_force_ref) - PHP_FE(ldap_rename, NULL) #endif - -#if LDAP_API_VERSION > 2000 + PHP_FE(ldap_rename, NULL) +#ifdef HAVE_LDAP_START_TLS_S PHP_FE(ldap_start_tls, NULL) #endif +#endif #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) PHP_FE(ldap_set_rebind_proc, NULL) @@ -275,7 +276,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled" ); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.118 2002/05/04 14:27:48 venaas Exp $" ); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.124 2002/06/30 11:14:27 derick Exp $" ); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -401,7 +402,7 @@ } if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) { - php_error(E_WARNING, "LDAP: Too many open links (%d)", LDAPG(num_links)); + php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), LDAPG(num_links)); RETURN_FALSE; } @@ -416,7 +417,7 @@ rc = ldap_initialize(&ldap, host); if (rc != LDAP_SUCCESS) { - php_error(E_WARNING, "Could not create LDAP session handle (%d): %s\n", rc, ldap_err2string(rc)); + php_error(E_WARNING, "%s(): Could not create session handle: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); RETURN_FALSE; } } else { @@ -432,7 +433,7 @@ #ifdef HAVE_ORALDAP if (ssl) { if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) { - php_error(E_WARNING, "LDAP: SSL init failed"); + php_error(E_WARNING, "%s(): SSL init failed", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -472,6 +473,7 @@ pval **link, **bind_rdn, **bind_pw; char *ldap_bind_rdn, *ldap_bind_pw; ldap_linkdata *ld; + int rc; switch(ZEND_NUM_ARGS()) { case 1: /* Anonymous Bind */ @@ -504,8 +506,8 @@ ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - if (ldap_bind_s(ld->link, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) { - php_error(E_WARNING, "LDAP: Unable to bind to server: %s", ldap_err2string(_get_lderrno(ld->link))); + if ((rc = ldap_bind_s(ld->link, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) { + php_error(E_WARNING, "%s(): Unable to bind to server: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); RETURN_FALSE; } else { RETURN_TRUE; @@ -606,19 +608,19 @@ case 4 : if (Z_TYPE_PP(attrs) != IS_ARRAY) { - php_error(E_WARNING, "LDAP: Expected Array as last element"); + php_error(E_WARNING, "%s(): Expected Array as last element", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs)); if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) { - php_error(E_WARNING, "LDAP: Could not allocate memory"); + php_error(E_WARNING, "%s(): Could not allocate memory", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } for(i=0; i<num_attribs; i++) { if(zend_hash_index_find(Z_ARRVAL_PP(attrs), i, (void **) &attr) == FAILURE) { - php_error(E_WARNING, "LDAP: Array initialization wrong"); + php_error(E_WARNING, "%s(): Array initialization wrong", get_active_function_name(TSRMLS_C)); efree(ldap_attrs); RETURN_FALSE; } @@ -652,7 +654,7 @@ nlinks = zend_hash_num_elements(Z_ARRVAL_PP(link)); if (nlinks == 0) { - php_error(E_WARNING, "LDAP: No links in link array"); + php_error(E_WARNING, "%s(): No links in link array", get_active_function_name(TSRMLS_C)); if (ldap_attrs != NULL) { efree(ldap_attrs); } @@ -662,7 +664,7 @@ if (Z_TYPE_PP(base_dn) == IS_ARRAY) { nbases = zend_hash_num_elements(Z_ARRVAL_PP(base_dn)); if (nbases != nlinks) { - php_error(E_WARNING, "LDAP: Base must either be a string, or an array with the same number of elements as the links array"); + php_error(E_WARNING, "%s(): Base must either be a string, or an array with the same number of elements as the links array", get_active_function_name(TSRMLS_C)); if (ldap_attrs != NULL) { efree(ldap_attrs); } @@ -678,7 +680,7 @@ if (Z_TYPE_PP(filter) == IS_ARRAY) { nfilters = zend_hash_num_elements(Z_ARRVAL_PP(filter)); if (nfilters != nlinks) { - php_error(E_WARNING, "LDAP: Filter must either be a string, or an array with the same number of elements as the links array"); + php_error(E_WARNING, "%s(): Filter must either be a string, or an array with the same number of elements as the links array", get_active_function_name(TSRMLS_C)); if (ldap_attrs != NULL) { efree(ldap_attrs); } @@ -787,15 +789,15 @@ && errno != LDAP_REFERRAL #endif ) { - php_error(E_WARNING, "LDAP: Unable to perform the search: %s", ldap_err2string(_get_lderrno(ld->link))); + php_error(E_WARNING, "%s(): Search: %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno)); RETVAL_FALSE; } else { if (errno == LDAP_SIZELIMIT_EXCEEDED) { - php_error(E_WARNING, "LDAP: Partial search results returned: Sizelimit exceeded."); + php_error(E_WARNING, "%s(): Partial search results returned: Sizelimit exceeded.", get_active_function_name(TSRMLS_C)); } #ifdef LDAP_ADMINLIMIT_EXCEEDED else if (errno == LDAP_ADMINLIMIT_EXCEEDED) { - php_error(E_WARNING, "LDAP: Partial search results returned: Adminlimit exceeded."); + php_error(E_WARNING, "%s(): Partial search results returned: Adminlimit exceeded.", get_active_function_name(TSRMLS_C)); } #endif @@ -1148,7 +1150,7 @@ attribute = Z_STRVAL_PP(attr); if ((ldap_value = ldap_get_values(ld->link, resultentry->data, attribute)) == NULL) { - php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link))); + php_error(E_WARNING, "%s(): Cannot get the value(s) of attribute %s", get_active_function_name(TSRMLS_C), ldap_err2string(_get_lderrno(ld->link))); RETURN_FALSE; } @@ -1190,13 +1192,13 @@ attribute = Z_STRVAL_PP(attr); if ((ldap_value_len = ldap_get_values_len(ld->link, resultentry->data, attribute)) == NULL) { - php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link))); + php_error(E_WARNING, "%s(): Cannot get the value(s) of attribute %s", get_active_function_name(TSRMLS_C), ldap_err2string(_get_lderrno(ld->link))); RETURN_FALSE; } num_values = ldap_count_values_len(ldap_value_len); if (array_init(return_value) == FAILURE) { - php_error(E_ERROR, "Cannot initialize return value"); + php_error(E_ERROR, "%s(): Cannot initialize return value", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1322,7 +1324,7 @@ } if (Z_TYPE_PP(entry) != IS_ARRAY) { - php_error(E_WARNING, "LDAP: Expected Array as the last element"); + php_error(E_WARNING, "%s(): Expected Array as the last element", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1350,7 +1352,7 @@ if (zend_hash_get_current_key(Z_ARRVAL_PP(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) { ldap_mods[i]->mod_type = estrdup(attribute); } else { - php_error(E_ERROR, "LDAP: Unknown Attribute in the data"); + php_error(E_ERROR, "%s(): Unknown attribute in the data", get_active_function_name(TSRMLS_C)); /* Free allocated memory */ while (i >= 0) { efree(ldap_mods[i--]); @@ -1380,7 +1382,7 @@ } else { for(j=0; j < num_values; j++) { if (zend_hash_index_find(Z_ARRVAL_PP(value), j, (void **) &ivalue) == FAILURE) { - php_error(E_WARNING, "LDAP: Value array must have consecutive indices 0, 1, ..."); + php_error(E_WARNING, "%s(): Value array must have consecutive indices 0, 1, ...", get_active_function_name(TSRMLS_C)); num_berval[i] = j; num_attribs = i + 1; RETVAL_FALSE; @@ -1399,14 +1401,13 @@ /* check flag to see if do_mod was called to perform full add , gerrit thomson */ if (is_full_add == 1) { - if (ldap_add_s(ld->link, ldap_dn, ldap_mods) != LDAP_SUCCESS) { - ldap_perror(ld->link, "LDAP"); - php_error(E_WARNING, "LDAP: add operation could not be completed."); + if ((i = ldap_add_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) { + php_error(E_WARNING, "%s(): Add: %s", get_active_function_name(TSRMLS_C), ldap_err2string(i)); RETVAL_FALSE; } else RETVAL_TRUE; } else { - if (ldap_modify_s(ld->link, ldap_dn, ldap_mods) != LDAP_SUCCESS) { - php_error(E_WARNING, "LDAP: modify operation could not be completed."); + if ((i = ldap_modify_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) { + php_error(E_WARNING, "%s(): Modify: %s", get_active_function_name(TSRMLS_C), ldap_err2string(i)); RETVAL_FALSE; } else RETVAL_TRUE; } @@ -1469,6 +1470,7 @@ pval **link, **dn; ldap_linkdata *ld; char *ldap_dn; + int rc; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &dn) == FAILURE) { WRONG_PARAM_COUNT; @@ -1479,8 +1481,8 @@ convert_to_string_ex(dn); ldap_dn = Z_STRVAL_PP(dn); - if (ldap_delete_s(ld->link, ldap_dn) != LDAP_SUCCESS) { - ldap_perror(ld->link, "LDAP"); + if ((rc = ldap_delete_s(ld->link, ldap_dn)) != LDAP_SUCCESS) { + php_error(E_WARNING, "%s(): Delete: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); RETURN_FALSE; } @@ -1575,7 +1577,7 @@ break; } - php_error(E_WARNING, "LDAP: Compare operation could not be completed: %s", ldap_err2string(errno)); + php_error(E_WARNING, "%s(): Compare: %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno)); RETURN_LONG(-1); } @@ -1598,12 +1600,12 @@ ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link); if (zend_hash_index_find(&EG(regular_list), Z_LVAL_P(result), (void **) &le) == FAILURE || le->type != le_result) { - php_error(E_WARNING, "Supplied resource is not a valid ldap result resource"); + php_error(E_WARNING, "%s(): Supplied resource is not a valid ldap result resource", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) { - php_error(E_WARNING, "LDAP sort failed: %s", ldap_err2string(errno)); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno)); RETURN_FALSE; } @@ -1754,7 +1756,7 @@ char error=0; if ((Z_TYPE_PP(newval) != IS_ARRAY) || !(ncontrols = zend_hash_num_elements(Z_ARRVAL_PP(newval)))) { - php_error(E_WARNING, "Expected non-empty array value for this option"); + php_error(E_WARNING, "%s(): Expected non-empty array value for this option", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ctrls = emalloc((1 + ncontrols) * sizeof(*ctrls)); @@ -1763,12 +1765,12 @@ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(newval)); while (zend_hash_get_current_data(Z_ARRVAL_PP(newval), (void**)&ctrlval) == SUCCESS) { if (Z_TYPE_PP(ctrlval) != IS_ARRAY) { - php_error(E_WARNING, "The array value must contain only arrays, where each array is a control"); + php_error(E_WARNING, "%s(): The array value must contain only arrays, where each array is a control", get_active_function_name(TSRMLS_C)); error = 1; break; } if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "oid", sizeof("oid"), (void **) &val) == FAILURE) { - php_error(E_WARNING, "Control must have an oid key"); + php_error(E_WARNING, "%s(): Control must have an oid key", get_active_function_name(TSRMLS_C)); error = 1; break; } @@ -1839,7 +1841,7 @@ NULL /* &serverctrls */, 0 ); if (rc != LDAP_SUCCESS ) { - php_error(E_WARNING, "LDAP: Unable to parse result: %s", ldap_err2string(_get_lderrno(ld->link))); + php_error(E_WARNING, "%s(): Unable to parse result: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); RETURN_FALSE; } @@ -1851,7 +1853,7 @@ case 6 : zval_dtor(*referrals); if (array_init(*referrals) == FAILURE) { - php_error(E_ERROR, "Cannot initialize return value"); + php_error(E_ERROR, "%s(): Cannot initialize return value", get_active_function_name(TSRMLS_C)); ldap_value_free(lreferrals); ldap_memfree(lerrmsg); ldap_memfree(lmatcheddn); @@ -1942,11 +1944,11 @@ } /* }}} */ +#ifdef HAVE_LDAP_PARSE_REFERENCE /* {{{ proto bool ldap_parse_reference(resource link, resource reference_entry, array referrals) Extract information from reference entry */ PHP_FUNCTION(ldap_parse_reference) { -#ifdef HAVE_LDAP_PARSE_REFERENCE pval **link, **result_entry, **referrals; ldap_linkdata *ld; ldap_resultentry *resultentry; @@ -1965,7 +1967,7 @@ zval_dtor(*referrals); if (array_init(*referrals) == FAILURE) { - php_error(E_ERROR, "Cannot initialize return value"); + php_error(E_ERROR, "%s(): Cannot initialize return value", get_active_function_name(TSRMLS_C)); ldap_value_free(lreferrals); RETURN_FALSE; } @@ -1978,12 +1980,9 @@ ldap_value_free(lreferrals); } RETURN_TRUE; -#else - php_error(E_ERROR, "ldap_parse_reference not available in this LDAP lib"); - RETURN_FALSE; -#endif } /* }}} */ +#endif /* {{{ proto bool ldap_rename(resource link, string dn, string newrdn, string newparent, boolean deleteoldrdn); Modify the name of an entry */ @@ -2008,7 +2007,7 @@ rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_STRVAL_PP(newparent), Z_BVAL_PP(deleteoldrdn), NULL, NULL); #else if (Z_STRLEN_PP(newparent) != 0) { - php_error(E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN"); + php_error(E_WARNING, "%s(): You are using old LDAP API, newparent must be the empty string, can only modify RDN", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } /* could support old APIs but need check for ldap_modrdn2()/ldap_modrdn() */ @@ -2021,15 +2020,15 @@ RETURN_FALSE; } /* }}} */ -#endif -#if LDAP_API_VERSION > 2000 +#ifdef HAVE_LDAP_START_TLS_S /* {{{ proto bool ldap_start_tls(resource link) Start TLS */ PHP_FUNCTION(ldap_start_tls) { pval **link; ldap_linkdata *ld; + int rc; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) { WRONG_PARAM_COUNT; @@ -2037,9 +2036,8 @@ ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - if (ldap_start_tls_s(ld->link, NULL, NULL) != LDAP_SUCCESS) { - php_error(E_WARNING,"LDAP: Unable to start TLS: %s", - ldap_err2string(_get_lderrno(ld->link))); + if ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) { + php_error(E_WARNING,"%s(): Unable to start TLS: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); RETURN_FALSE; } else { RETURN_TRUE; @@ -2047,6 +2045,7 @@ } /* }}} */ #endif +#endif /* ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP */ #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) @@ -2057,6 +2056,7 @@ zval **cb_args[2]; zval *cb_retval; zval *cb_link = (zval *) params; + TSRMLS_FETCH(); ld = (ldap_linkdata *) zend_fetch_resource(&cb_link TSRMLS_CC, -1, "ldap link", NULL, 1, le_link); @@ -2076,7 +2076,7 @@ retval = Z_LVAL_P(cb_retval); zval_ptr_dtor(&cb_retval); } else { - php_error(E_WARNING, "LDAP: rebind_proc php callback failed"); + php_error(E_WARNING, "%s(): rebind_proc PHP callback failed", get_active_function_name(TSRMLS_C)); retval = LDAP_OTHER; } zval_dtor(cb_url); @@ -2111,7 +2111,7 @@ /* callable? */ if (!zend_is_callable(callback, 0, &callback_name)) { - php_error(E_WARNING, "%s() expects argument 2, '%s', to be a valid callback", get_active_function_name(TSRMLS_C), callback_name); + php_error(E_WARNING, "%s(): Two arguments expected for '%s' to be a valid callback", get_active_function_name(TSRMLS_C), callback_name); efree(callback_name); RETURN_FALSE; } @@ -2164,7 +2164,7 @@ RETVAL_STRINGL(ldap_buf, ldap_len, 1); free(ldap_buf); } else { - php_error(E_ERROR, "LDAP: Conversion from iso-8859-1 to t61 failed."); + php_error(E_ERROR, "%s(): Conversion from iso-8859-1 to t61 failed: %s", get_active_function_name(TSRMLS_C), ldap_err2string(result)); RETVAL_FALSE; } No revision No revision 1.2.2.4 +6 -2 php4/ext/mbstring/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mbstring/config.m4,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- config.m4 19 May 2002 11:16:04 -0000 1.2.2.3 +++ config.m4 9 Jul 2002 09:14:34 -0000 1.2.2.4 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.12 2002/05/12 14:55:25 sas Exp $ +dnl $Id: config.m4,v 1.16 2002/06/06 12:44:28 sniper Exp $ dnl PHP_ARG_ENABLE(mbstr_enc_trans, whether to enable encoding translation, @@ -26,13 +26,17 @@ if test "$PHP_MBSTRING" = "kr"; then AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support]) fi + if test "$PHP_MBSTRING" = "ru"; then + AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support]) + fi if test "$PHP_MBSTRING" = "all"; then AC_DEFINE(HAVE_MBSTR_JA,1,[whether to have japanese support]) AC_DEFINE(HAVE_MBSTR_CN,1,[whether to have simplified chinese support]) AC_DEFINE(HAVE_MBSTR_TW,1,[whether to have traditional chinese support]) AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support]) + AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support]) fi - PHP_NEW_EXTENSION(mbstring, mbfilter_ja.c mbfilter_cn.c mbfilter_tw.c mbfilter_kr.c mbfilter.c mbstring.c mbregex.c php_mbregex.c, $ext_shared) + PHP_NEW_EXTENSION(mbstring, mbfilter_ja.c mbfilter_cn.c mbfilter_tw.c mbfilter_kr.c mbfilter_ru.c mbfilter.c mbstring.c mbregex.c php_mbregex.c, $ext_shared) else PHP_MBSTR_ENC_TRANS=no fi 1.2.2.4 +179 -2 php4/ext/mbstring/Attic/mbfilter.c Index: mbfilter.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mbstring/Attic/mbfilter.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- mbfilter.c 19 May 2002 11:16:04 -0000 1.2.2.3 +++ mbfilter.c 9 Jul 2002 09:14:34 -0000 1.2.2.4 @@ -79,7 +79,7 @@ * */ -/* $Id: mbfilter.c,v 1.29 2002/05/15 12:13:56 hirokawa Exp $ */ +/* $Id: mbfilter.c,v 1.34 2002/06/22 08:01:57 dets Exp $ */ #ifdef HAVE_CONFIG_H @@ -104,6 +104,9 @@ #if defined(HAVE_MBSTR_KR) #include "mbfilter_kr.h" #endif +#if defined(HAVE_MBSTR_KR) +#include "mbfilter_ru.h" +#endif #include "zend.h" @@ -185,6 +188,16 @@ mbfl_no_encoding_7bit }; +static mbfl_language mbfl_language_russian = { + mbfl_no_language_russian, + "Russian", + "ru", + NULL, + mbfl_no_encoding_koi8r, + mbfl_no_encoding_qprint, + mbfl_no_encoding_8bit +}; + static mbfl_language *mbfl_language_ptr_table[] = { &mbfl_language_uni, &mbfl_language_japanese, @@ -192,6 +205,7 @@ &mbfl_language_simplified_chinese, &mbfl_language_traditional_chinese, &mbfl_language_english, + &mbfl_language_russian, NULL }; @@ -707,7 +721,7 @@ #if defined(HAVE_MBSTR_CN) -static const char *mbfl_encoding_euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", NULL}; +static const char *mbfl_encoding_euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", "gb2312", NULL}; static mbfl_encoding mbfl_encoding_euc_cn = { mbfl_no_encoding_euc_cn, @@ -953,6 +967,41 @@ MBFL_ENCTYPE_SBCS }; +#if defined(HAVE_MBSTR_RU) +static const char *mbfl_encoding_cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL}; + +static mbfl_encoding mbfl_encoding_cp1251 = { + mbfl_no_encoding_cp1251, + "Windows-1251", + "Windows-1251", + (const char *(*)[])&mbfl_encoding_cp1251_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +static const char *mbfl_encoding_cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL}; + +static mbfl_encoding mbfl_encoding_cp866 = { + mbfl_no_encoding_cp866, + "CP866", + "CP866", + (const char *(*)[])&mbfl_encoding_cp866_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; + +static const char *mbfl_encoding_koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL}; + +static mbfl_encoding mbfl_encoding_koi8r = { + mbfl_no_encoding_koi8r, + "KOI8-R", + "KOI8-R", + (const char *(*)[])&mbfl_encoding_koi8r_aliases, + NULL, + MBFL_ENCTYPE_SBCS +}; +#endif + static mbfl_encoding *mbfl_encoding_ptr_list[] = { &mbfl_encoding_pass, &mbfl_encoding_auto, @@ -1018,6 +1067,11 @@ &mbfl_encoding_uhc, &mbfl_encoding_2022kr, #endif +#if defined(HAVE_MBSTR_RU) + &mbfl_encoding_cp1251, + &mbfl_encoding_cp866, + &mbfl_encoding_koi8r, +#endif NULL }; @@ -1128,6 +1182,12 @@ static int mbfl_filt_ident_2022kr(int c, mbfl_identify_filter *filter TSRMLS_DC); #endif /* HAVE_MBSTR_KR */ +#if defined(HAVE_MBSTR_RU) +static int mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter TSRMLS_DC); +static int mbfl_filt_ident_cp866(int c, mbfl_identify_filter *filter TSRMLS_DC); +static int mbfl_filt_ident_koi8r(int c, mbfl_identify_filter *filter TSRMLS_DC); +#endif /* HAVE_MBSTR_RU */ + static int mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter TSRMLS_DC); static int mbfl_filt_ident_false(int c, mbfl_identify_filter *filter TSRMLS_DC); static int mbfl_filt_ident_true(int c, mbfl_identify_filter *filter TSRMLS_DC); @@ -1753,6 +1813,57 @@ #endif /* HAVE_MBSTR_KR */ +#if defined(HAVE_MBSTR_RU) +static struct mbfl_convert_vtbl vtbl_wchar_cp1251 = { + mbfl_no_encoding_cp1251, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_cp1251, + mbfl_filt_conv_common_flush }; + +static struct mbfl_convert_vtbl vtbl_cp1251_wchar = { + mbfl_no_encoding_cp1251, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_cp1251_wchar, + mbfl_filt_conv_common_flush }; + +static struct mbfl_convert_vtbl vtbl_wchar_cp866 = { + mbfl_no_encoding_cp866, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_cp866, + mbfl_filt_conv_common_flush }; + +static struct mbfl_convert_vtbl vtbl_cp866_wchar = { + mbfl_no_encoding_cp866, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_cp866_wchar, + mbfl_filt_conv_common_flush }; + +static struct mbfl_convert_vtbl vtbl_wchar_koi8r = { + mbfl_no_encoding_wchar, + mbfl_no_encoding_koi8r, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_wchar_koi8r, + mbfl_filt_conv_common_flush }; + + +static struct mbfl_convert_vtbl vtbl_koi8r_wchar = { + mbfl_no_encoding_koi8r, + mbfl_no_encoding_wchar, + mbfl_filt_conv_common_ctor, + mbfl_filt_conv_common_dtor, + mbfl_filt_conv_koi8r_wchar, + mbfl_filt_conv_common_flush }; +#endif /* HAVE_MBSTR_RU */ + static struct mbfl_convert_vtbl vtbl_cp1252_wchar = { mbfl_no_encoding_cp1252, mbfl_no_encoding_wchar, @@ -2018,6 +2129,14 @@ &vtbl_2022kr_wchar, &vtbl_wchar_2022kr, #endif +#if defined(HAVE_MBSTR_RU) + &vtbl_cp1251_wchar, + &vtbl_wchar_cp1251, + &vtbl_cp866_wchar, + &vtbl_wchar_cp866, + &vtbl_koi8r_wchar, + &vtbl_wchar_koi8r, +#endif &vtbl_cp1252_wchar, &vtbl_wchar_cp1252, &vtbl_ascii_wchar, @@ -2209,6 +2328,26 @@ #endif /* HAVE_MBSTR_KR */ +#if defined(HAVE_MBSTR_RU) +static struct mbfl_identify_vtbl vtbl_identify_cp1251 = { + mbfl_no_encoding_cp1251, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_cp1251 }; + +static struct mbfl_identify_vtbl vtbl_identify_cp866 = { + mbfl_no_encoding_cp866, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_cp866 }; + +static struct mbfl_identify_vtbl vtbl_identify_koi8r = { + mbfl_no_encoding_koi8r, + mbfl_filt_ident_common_ctor, + mbfl_filt_ident_common_dtor, + mbfl_filt_ident_koi8r }; +#endif /* HAVE_MBSTR_RU */ + static struct mbfl_identify_vtbl vtbl_identify_cp1252 = { mbfl_no_encoding_cp1252, mbfl_filt_ident_common_ctor, @@ -2325,6 +2464,11 @@ &vtbl_identify_uhc, &vtbl_identify_2022kr, #endif +#if defined(HAVE_MBSTR_RU) + &vtbl_identify_cp1251, + &vtbl_identify_cp866, + &vtbl_identify_koi8r, +#endif &vtbl_identify_cp1252, &vtbl_identify_8859_1, &vtbl_identify_8859_2, @@ -6138,6 +6282,39 @@ filter->flag = 1; /* not it */ return c; } + +#if defined(HAVE_MBSTR_RU) +// all of this is so ugly now! +static int +mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter TSRMLS_DC) +{ + if (c >= 0x80 && c < 0xff) + filter->flag = 0; + else + filter->flag = 1; /* not it */ + return c; +} + +static int +mbfl_filt_ident_cp866(int c, mbfl_identify_filter *filter TSRMLS_DC) +{ + if (c >= 0x80 && c < 0xff) + filter->flag = 0; + else + filter->flag = 1; /* not it */ + return c; +} + +static int +mbfl_filt_ident_koi8r(int c, mbfl_identify_filter *filter TSRMLS_DC) +{ + if (c >= 0x80 && c < 0xff) + filter->flag = 0; + else + filter->flag = 1; /* not it */ + return c; +} +#endif /* HAVE_MBSTR_RU */ static int mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter TSRMLS_DC) 1.2.2.4 +8 -1 php4/ext/mbstring/Attic/mbfilter.h Index: mbfilter.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mbstring/Attic/mbfilter.h,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- mbfilter.h 19 May 2002 11:16:04 -0000 1.2.2.3 +++ mbfilter.h 9 Jul 2002 09:14:34 -0000 1.2.2.4 @@ -86,7 +86,7 @@ * */ -/* $Id: mbfilter.h,v 1.10 2002/05/12 13:06:13 hirokawa Exp $ */ +/* $Id: mbfilter.h,v 1.11 2002/05/21 07:00:33 dets Exp $ */ #ifndef MBFL_MBFILTER_H @@ -113,6 +113,7 @@ mbfl_no_language_swedish, /* sv */ mbfl_no_language_simplified_chinese, /* zh-cn */ mbfl_no_language_traditional_chinese, /* zh-tw */ + mbfl_no_language_russian, /* ru */ mbfl_no_language_max }; @@ -176,6 +177,9 @@ mbfl_no_encoding_2022kr, mbfl_no_encoding_uhc, mbfl_no_encoding_hz, + mbfl_no_encoding_cp1251, + mbfl_no_encoding_cp866, + mbfl_no_encoding_koi8r, mbfl_no_encoding_charset_max }; @@ -246,6 +250,9 @@ #define MBFL_WCSPLANE_BIG5 0x70f40000 /* 2121h - 9898h */ #define MBFL_WCSPLANE_CNS11643 0x70f50000 /* 2121h - 9898h */ #define MBFL_WCSPLANE_UHC 0x70f60000 /* 8141h - fefeh */ +#define MBFL_WCSPLANE_CP1251 0x70f70000 +#define MBFL_WCSPLANE_CP866 0x70f80000 +#define MBFL_WCSPLANE_KOI8R 0x70f90000 #define MBFL_WCSGROUP_MASK 0xffffff #define MBFL_WCSGROUP_UCS4MAX 0x70000000 #define MBFL_WCSGROUP_WCHARMAX 0x78000000 1.2.2.4 +24 -15 php4/ext/mbstring/mbstring.c Index: mbstring.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbstring.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- mbstring.c 19 May 2002 11:16:04 -0000 1.2.2.3 +++ mbstring.c 9 Jul 2002 09:14:34 -0000 1.2.2.4 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.c,v 1.69 2002/05/16 12:31:05 pbannister Exp $ */ +/* $Id: mbstring.c,v 1.74 2002/06/19 21:55:42 helly Exp $ */ /* * PHP4 Multibyte String module "mbstring" (currently only for Japanese) @@ -65,7 +65,7 @@ #include "php_content_types.h" #include "SAPI.h" -#if ZEND_MULTIBYTE +#ifdef ZEND_MULTIBYTE #include "zend_multibyte.h" #endif /* ZEND_MULTIBYTE */ @@ -95,7 +95,7 @@ }; #endif -#if defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_JA) +#if defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA) static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = { mbfl_no_encoding_ascii, mbfl_no_encoding_utf8, @@ -104,7 +104,7 @@ }; #endif -#if defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_JA) +#if defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA) static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = { mbfl_no_encoding_ascii, mbfl_no_encoding_utf8, @@ -113,6 +113,23 @@ }; #endif +#if defined(HAVE_MBSTR_RU) & !defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA) +static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8, + mbfl_no_encoding_koi8r, + mbfl_no_encoding_cp1251, + mbfl_no_encoding_cp866 +}; +#endif + +#if !defined(HAVE_MBSTR_RU) & !defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA) +static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8 +}; +#endif + static const int php_mbstr_default_identify_list_size = sizeof(php_mbstr_default_identify_list)/sizeof(enum mbfl_no_encoding); static unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST }; @@ -2059,10 +2076,6 @@ if (from < 0) { from = 0; } - } - if (Z_STRLEN_PP(arg1) < from) { - /* keep index within string */ - from = Z_STRLEN_PP(arg1); } /* if "length" position is negative, set it to the length @@ -2074,10 +2087,6 @@ len = 0; } } - if (Z_STRLEN_PP(arg1) < (from + len)) { - /* limit span to characters in string */ - len = Z_STRLEN_PP(arg1) - from; - } ret = mbfl_strcut(&string, &result, from, len TSRMLS_CC); if (ret != NULL) { @@ -2269,7 +2278,7 @@ string.no_encoding = from_encoding; } } else { - php_error(E_WARNING, "$s() illegal character encoding specified", + php_error(E_WARNING, "%s() illegal character encoding specified", get_active_function_name(TSRMLS_C)); } if (list != NULL) { @@ -2790,8 +2799,8 @@ } } } else if (Z_TYPE_PP(var) == IS_STRING) { - string.val = Z_STRVAL_PP(args[n]); - string.len = Z_STRLEN_PP(args[n]); + string.val = Z_STRVAL_PP(var); + string.len = Z_STRLEN_PP(var); if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) { goto detect_end; /* complete detecting */ } No revision No revision 1.2.2.1 +1 -3 php4/ext/mbstring/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mbstring/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:50 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +54 -56 php4/ext/mcrypt/mcrypt.c Index: mcrypt.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mcrypt/mcrypt.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mcrypt.c 29 Apr 2002 02:30:51 -0000 1.2 +++ mcrypt.c 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -16,7 +16,7 @@ | Derick Rethans <d.ret****@jdime*****> | +----------------------------------------------------------------------+ */ -/* $Id: mcrypt.c,v 1.75 2002/02/28 12:10:35 yohgaki Exp $ */ +/* $Id: mcrypt.c,v 1.77 2002/06/26 09:09:35 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -147,7 +147,7 @@ #define MCRYPT_CHECK_TD_CPY \ if(td < 0) { \ - php_error(E_WARNING, MCRYPT_FAILED); \ + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), MCRYPT_FAILED); \ RETURN_FALSE; \ } \ ndata = ecalloc(nr, bsize); \ @@ -156,7 +156,7 @@ #define MCRYPT_CHECK_IV \ convert_to_string_ex(iv); \ if(Z_STRLEN_PP(iv) != bsize) { \ - php_error(E_WARNING, MCRYPT_IV_WRONG_SIZE); \ + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), MCRYPT_IV_WRONG_SIZE); \ RETURN_FALSE; \ } @@ -167,7 +167,7 @@ mdecrypt_##x(td, ndata, nsize); \ end_mcrypt_##x(td) -#define MCRYPT_IV_WRONG_SIZE "The IV parameter must be as long as the blocksize" +#define MCRYPT_IV_WRONG_SIZE "%s(): The IV parameter must be as long as the blocksize" #if HAVE_LIBMCRYPT24 #define MCRYPT_ENCRYPT 0 @@ -219,9 +219,9 @@ #endif #if HAVE_LIBMCRYPT22 -#define MCRYPT_FAILED "mcrypt initialization failed" +#define MCRYPT_FAILED "%s(): Initialization failed" #else -#define MCRYPT_OPEN_MODULE_FAILED "mcrypt module initialization failed" +#define MCRYPT_OPEN_MODULE_FAILED "%s(): Module initialization failed" #endif #if HAVE_LIBMCRYPT22 @@ -391,7 +391,7 @@ php_info_print_table_row(2, "version", "2.2.x"); #endif #if HAVE_LIBMCRYPT24 - php_info_print_table_row(2, "version", "2.4.x"); + php_info_print_table_row(2, "version", ">= 2.4.x"); php_info_print_table_row(2, "Supported ciphers", tmp1.c); php_info_print_table_row(2, "Supported modes", tmp2.c); smart_str_free (&tmp1); @@ -414,26 +414,25 @@ Opens the module of the algorithm and the mode to be used */ PHP_FUNCTION(mcrypt_module_open) { - zval **cipher, **cipher_directory, **mode, **mode_directory; - MCRYPT td; - int argc; - - argc = ZEND_NUM_ARGS(); - MCRYPT_CHECK_PARAM_COUNT (4,4) + char *cipher, *cipher_dir; + char *mode, *mode_dir; + int cipher_len, cipher_dir_len; + int mode_len, mode_dir_len; + MCRYPT td; + + if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ssss", + &cipher, &cipher_len, &cipher_dir, &cipher_dir_len, + &mode, &mode_len, &mode_dir, &mode_dir_len)) { + return; + } - zend_get_parameters_ex(4, &cipher, &cipher_directory, &mode, &mode_directory); - convert_to_string_ex(cipher); - convert_to_string_ex(cipher_directory); - convert_to_string_ex(mode); - convert_to_string_ex(mode_directory); - - td = mcrypt_module_open (Z_STRVAL_PP(cipher), - Z_STRLEN_PP(cipher_directory) > 0 ? Z_STRVAL_PP(cipher_directory) : MCG(algorithms_dir), - Z_STRVAL_PP(mode), - Z_STRLEN_PP(mode_directory) > 0 ? Z_STRVAL_PP(mode_directory) : MCG(modes_dir)); + td = mcrypt_module_open (cipher, + cipher_dir_len > 0 ? cipher_dir : MCG(algorithms_dir), + mode, + mode_dir_len > 0 ? mode_dir : MCG(modes_dir)); if (td == MCRYPT_FAILED) { - php_error (E_WARNING, "could not open encryption module"); + php_error (E_WARNING, "%s(): Could not open encryption module", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } else { ZEND_REGISTER_RESOURCE (return_value, td, le_mcrypt); @@ -467,7 +466,7 @@ iv_size = mcrypt_enc_get_iv_size (td); if (Z_STRLEN_PP(key) == 0) { - php_error (E_WARNING, "key size is 0"); + php_error (E_WARNING, "%s(): Key size is 0", get_active_function_name(TSRMLS_C)); } key_s = emalloc (Z_STRLEN_PP(key)); @@ -477,9 +476,9 @@ memset (iv_s, 0, iv_size + 1); if (Z_STRLEN_PP(key) > max_key_size) { - sprintf (dummy, "key size too large; supplied length: %d, max: %d", + sprintf (dummy, "Key size too large; supplied length: %d, max: %d", Z_STRLEN_PP(key), max_key_size); - php_error (E_WARNING, dummy); + php_error (E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), dummy); key_size = max_key_size; } else { key_size = Z_STRLEN_PP(key); @@ -487,9 +486,9 @@ memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key)); if (Z_STRLEN_PP(iv) != iv_size) { - sprintf (dummy, "iv size incorrect; supplied length: %d, needed: %d", + sprintf (dummy, "Iv size incorrect; supplied length: %d, needed: %d", Z_STRLEN_PP(iv), iv_size); - php_error (E_WARNING, dummy); + php_error (E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), dummy); } memcpy (iv_s, Z_STRVAL_PP(iv), iv_size); @@ -501,14 +500,14 @@ zend_list_delete (Z_LVAL_PP(mcryptind)); switch (result) { case -3: - php_error (E_WARNING, "mcrypt_generic_init: Key length incorrect"); + php_error (E_WARNING, "%s(): Key length incorrect", get_active_function_name(TSRMLS_C)); break; case -4: - php_error (E_WARNING, "mcrypt_generic_init: Memory allocation error"); + php_error (E_WARNING, "%s(): Memory allocation error", get_active_function_name(TSRMLS_C)); break; case -1: default: - php_error (E_WARNING, "mcrypt_generic_init: Unknown error"); + php_error (E_WARNING, "%s(): Unknown error", get_active_function_name(TSRMLS_C)); break; } } @@ -616,7 +615,7 @@ key_sizes = mcrypt_enc_get_supported_key_sizes (td, &count); if (array_init(return_value) == FAILURE) { - php_error(E_ERROR, "Unable to initialize array"); + php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C)); return; } if (count != 0) { @@ -667,12 +666,12 @@ MCRYPT_GET_TD_ARG #if HAVE_MCRYPT_GENERIC_DEINIT - php_error(E_NOTICE, "mcrypt_generic_end is deprecated, please use mcrypt_generic_deinit"); + php_error(E_NOTICE, "%s(): This function is deprecated, please use mcrypt_generic_deinit()", get_active_function_name(TSRMLS_C)); if (mcrypt_generic_deinit (td) < 0) { #else if (mcrypt_generic_end (td) < 0) { #endif - php_error (E_WARNING, "could not terminate encryption specifier"); + php_error (E_WARNING, "%s(): Could not terminate encryption specifier", get_active_function_name(TSRMLS_C)); RETURN_FALSE } RETURN_TRUE @@ -692,7 +691,7 @@ MCRYPT_GET_TD_ARG if (mcrypt_generic_deinit (td) < 0) { - php_error (E_WARNING, "could not terminate encryption specifier"); + php_error (E_WARNING, "%s(): Could not terminate encryption specifier", get_active_function_name(TSRMLS_C)); RETURN_FALSE } RETURN_TRUE @@ -837,8 +836,7 @@ if (mcrypt_module_self_test (module, dir) == 0) { RETURN_TRUE; - } - else { + } else { RETURN_FALSE; } } @@ -916,7 +914,7 @@ This function decrypts the crypttext */ PHP_FUNCTION(mcrypt_module_get_supported_key_sizes) { - int argc, i, count; + int i, count; int *key_sizes; MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir) @@ -924,7 +922,7 @@ key_sizes = mcrypt_module_get_algo_supported_key_sizes (module, dir, &count); if (array_init(return_value) == FAILURE) { - php_error(E_ERROR, "Unable to initialize array"); + php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C)); return; } if (count != 0) { @@ -967,11 +965,11 @@ modules = mcrypt_list_algorithms (lib_dir_s, &count); if (array_init(return_value) == FAILURE) { - php_error(E_ERROR, "Unable to initialize array"); + php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C)); return; } if (count == 0) { - php_error (E_WARNING, "No algorithms found in module dir"); + php_error (E_WARNING, "%s(): No algorithms found in module dir", get_active_function_name(TSRMLS_C)); } for (i = 0; i < count; i++) { add_index_string(return_value, i, modules[i], 1); @@ -1011,11 +1009,11 @@ modules = mcrypt_list_modes (lib_dir_s, &count); if (array_init(return_value) == FAILURE) { - php_error(E_ERROR, "Unable to initialize array"); + php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C)); return; } if (count == 0) { - php_error (E_WARNING, "No modes found in module dir"); + php_error (E_WARNING, "%s(): No modes found in module dir", get_active_function_name(TSRMLS_C)); } for (i = 0; i < count; i++) { add_index_string(return_value, i, modules[i], 1); @@ -1058,7 +1056,7 @@ } else { - php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED); + php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C)); RETVAL_LONG(0); } } @@ -1098,7 +1096,7 @@ } else { - php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED); + php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C)); RETVAL_LONG(0); } } @@ -1138,7 +1136,7 @@ } else { - php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED); + php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -1192,7 +1190,7 @@ } else { - php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED); + php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -1219,13 +1217,13 @@ mode, module_dir_string); if (td == MCRYPT_FAILED) { - php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED); + php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } /* Checking for key-length */ max_key_length = mcrypt_enc_get_key_size (td); if (Z_STRLEN_PP(key) > max_key_length) { - php_error (E_WARNING, "size of key is too large for this algorithm"); + php_error (E_WARNING, "%s(): Size of key is too large for this algorithm", get_active_function_name(TSRMLS_C)); } key_length_sizes = mcrypt_enc_get_supported_key_sizes (td, &count); if (count == 0 && key_length_sizes == NULL) { /* all lengths 1 - k_l_s = OK */ @@ -1260,7 +1258,7 @@ iv_size = mcrypt_enc_get_iv_size (td); if (argc == 5) { if (iv_size != Z_STRLEN_PP(iv)) { - php_error (E_WARNING, MCRYPT_IV_WRONG_SIZE); + php_error (E_WARNING, MCRYPT_IV_WRONG_SIZE, get_active_function_name(TSRMLS_C)); } else { @@ -1271,7 +1269,7 @@ else if (argc == 4) { if (iv_size != 0) { - php_error (E_WARNING, "attempt to use an empty IV, which is NOT recommend"); + php_error (E_WARNING, "%s(): Attempt to use an empty IV, which is NOT recommend", get_active_function_name(TSRMLS_C)); iv_s = emalloc (iv_size + 1); memset (iv_s, 0, iv_size + 1); } @@ -1293,7 +1291,7 @@ } if (mcrypt_generic_init (td, key_s, use_key_length, iv_s) < 0) { - php_error (E_ERROR, "generic_init failed"); + php_error (E_ERROR, "%s(): Mcrypt initialisation failed", get_active_function_name(TSRMLS_C)); } if (dencrypt == MCRYPT_ENCRYPT) mcrypt_generic (td, data_s, data_size); @@ -1439,7 +1437,7 @@ } if (size <= 0) { - php_error(E_WARNING, "can not create an IV with size 0 or smaller"); + php_error(E_WARNING, "%s(): Can not create an IV with size 0 or smaller", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1453,7 +1451,7 @@ O_RDONLY); if (fd < 0) { efree(iv); - php_error(E_WARNING, "cannot open source device"); + php_error(E_WARNING, "%s(): Cannot open source device", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } while (read_bytes < size) { @@ -1465,7 +1463,7 @@ n = read_bytes; close(fd); if (n < size) { - php_error(E_WARNING, "could not gather sufficient random data"); + php_error(E_WARNING, "%s(): Could not gather sufficient random data", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } else { No revision No revision 1.2.2.1 +1 -3 php4/ext/mcrypt/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mcrypt/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:51 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/mcve/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mcve/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:51 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.2 +1 -2 php4/ext/mime_magic/TODO Index: TODO =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mime_magic/TODO,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- TODO 19 May 2002 11:16:04 -0000 1.2.2.1 +++ TODO 9 Jul 2002 09:14:35 -0000 1.2.2.2 @@ -1,4 +1,3 @@ - general cleanup - support for content-encoding / compressed files -- use streams -- fix ZTS build +- nuke all TSRMLS_FETCH() calls where possible 1.2.2.1 +54 -224 php4/ext/mime_magic/mime_magic.c Index: mime_magic.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mime_magic/mime_magic.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mime_magic.c 29 Apr 2002 02:30:51 -0000 1.2 +++ mime_magic.c 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -15,7 +15,7 @@ | Author: Hartmut Holzgraefe <hartm****@six*****> | +----------------------------------------------------------------------+ - $Id: mime_magic.c,v 1.4 2002/03/27 13:51:55 hholzgra Exp $ + $Id: mime_magic.c,v 1.8 2002/06/26 18:49:08 derick Exp $ This module contains a lot of stuff taken from Apache mod_mime_magic, so the lincense section is a little bit longer than usual: @@ -150,8 +150,9 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - + #include "php.h" +#include "php_streams.h" #include "php_ini.h" #include "ext/standard/info.h" #include "php_mime_magic.h" @@ -181,10 +182,10 @@ static void mprint(union VALUETYPE *, struct magic *); static int mconvert(union VALUETYPE *, struct magic *); static int magic_rsl_get(char **, char **); -static int magic_process(char *); +static int magic_process(char * TSRMLS_DC); static long from_oct(int, char *); -static int fsmagic(const char *fn); +static int fsmagic(char *fn TSRMLS_DC); #if HAVE_ZLIB @@ -198,16 +199,12 @@ /* True global resources - no need for thread safety here */ -/* static int le_mime_magic; */ static magic_server_config_rec mime_global; -/* {{{ mime_magic_functions[] - * - * Every user visible function must have an entry in mime_magic_functions[]. - */ +/* {{{ mime_magic_functions[] */ function_entry mime_magic_functions[] = { - PHP_FE(mime_content_type, NULL) /* For testing, remove later. */ - {NULL, NULL, NULL} /* Must be the last line in mime_magic_functions[] */ + PHP_FE(mime_content_type, NULL) + {NULL, NULL, NULL} }; /* }}} */ @@ -221,11 +218,11 @@ mime_magic_functions, PHP_MINIT(mime_magic), PHP_MSHUTDOWN(mime_magic), - PHP_RINIT(mime_magic), /* Replace with NULL if there's nothing to do at request start */ - PHP_RSHUTDOWN(mime_magic), /* Replace with NULL if there's nothing to do at request end */ + NULL, + NULL, PHP_MINFO(mime_magic), #if ZEND_MODULE_API_NO >= 20010901 - "0.1", /* Replace with version number for your extension */ + "0.1", #endif STANDARD_MODULE_PROPERTIES }; @@ -238,7 +235,7 @@ /* {{{ PHP_INI */ PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("mime_magic.magicfile", "/usr/share/misc/magic.mime", PHP_INI_SYSTEM, OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals) +STD_PHP_INI_ENTRY("mime_magic.magicfile", "/usr/share/misc/magic.mime", PHP_INI_SYSTEM, OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals) PHP_INI_END() /* }}} */ @@ -246,7 +243,7 @@ */ static void php_mime_magic_init_globals(zend_mime_magic_globals *mime_magic_globals) { - mime_magic_globals->magicfile = NULL; + mime_global.magicfile = NULL; } /* }}} */ @@ -257,11 +254,11 @@ ZEND_INIT_MODULE_GLOBALS(mime_magic, php_mime_magic_init_globals, NULL); REGISTER_INI_ENTRIES(); - if(mime_magic_globals.magicfile) { - mime_global.magicfile = mime_magic_globals.magicfile; + mime_global.magicfile = MIME_MAGIC_G(magicfile); + + if(mime_global.magicfile) { apprentice(); } - return SUCCESS; } /* }}} */ @@ -275,24 +272,6 @@ } /* }}} */ -/* Remove if there's nothing to do at request start */ -/* {{{ PHP_RINIT_FUNCTION - */ -PHP_RINIT_FUNCTION(mime_magic) -{ - return SUCCESS; -} -/* }}} */ - -/* Remove if there's nothing to do at request end */ -/* {{{ PHP_RSHUTDOWN_FUNCTION - */ -PHP_RSHUTDOWN_FUNCTION(mime_magic) -{ - return SUCCESS; -} -/* }}} */ - /* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(mime_magic) @@ -301,17 +280,11 @@ php_info_print_table_header(2, "mime_magic support", "enabled"); php_info_print_table_end(); - /* Remove comments if you have entries in php.ini DISPLAY_INI_ENTRIES(); - */ } /* }}} */ -/* Remove the following function when you have succesfully modified config.m4 - so that your module can be compiled into PHP, it exists only for testing - purposes. */ - /* {{{ proto string mime_content_type(string filename) Return content-type for file */ PHP_FUNCTION(mime_content_type) @@ -330,9 +303,9 @@ RETURN_FALSE; } - magic_set_config(); + MIME_MAGIC_G(req_dat) = magic_set_config(); - if(MIME_MAGIC_OK != magic_process(filename)) { + if(MIME_MAGIC_OK != magic_process(filename TSRMLS_CC)) { RETVAL_FALSE; } else if(MIME_MAGIC_OK != magic_rsl_get(&content_type, &content_encoding)) { RETVAL_FALSE; @@ -359,10 +332,7 @@ char line[BUFSIZ + 1]; int errs = 0; int lineno; -#if MIME_MAGIC_DEBUG - int rule = 0; - struct magic *m, *prevm; -#endif + char *fname; magic_server_config_rec *conf = &mime_global; @@ -401,11 +371,6 @@ if (line[ws_offset] == '#') continue; -#if MIME_MAGIC_DEBUG - /* if we get here, we're going to use it so count it */ - rule++; -#endif - /* parse it */ if (parse(line + ws_offset, lineno) != 0) ++errs; @@ -413,42 +378,6 @@ (void) fclose(f); -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - MODNAME ": apprentice conf=%x file=%s m=%s m->next=%s last=%s", - conf, - conf->magicfile ? conf->magicfile : "NULL", - conf->magic ? "set" : "NULL", - (conf->magic && conf->magic->next) ? "set" : "NULL", - conf->last ? "set" : "NULL"); - php_error(E_NOTICE, - MODNAME ": apprentice read %d lines, %d rules, %d errors", - lineno, rule, errs); -#endif - -#if MIME_MAGIC_DEBUG - prevm = 0; - php_error(E_NOTICE, - MODNAME ": apprentice test"); - for (m = conf->magic; m; m = m->next) { - if (isprint((((unsigned long) m) >> 24) & 255) && - isprint((((unsigned long) m) >> 16) & 255) && - isprint((((unsigned long) m) >> 8) & 255) && - isprint(((unsigned long) m) & 255)) { - php_error(E_NOTICE, - MODNAME ": apprentice: POINTER CLOBBERED! " - "m=\"%c%c%c%c\" line=%d", - (((unsigned long) m) >> 24) & 255, - (((unsigned long) m) >> 16) & 255, - (((unsigned long) m) >> 8) & 255, - ((unsigned long) m) & 255, - prevm ? prevm->lineno : -1); - break; - } - prevm = m; - } -#endif - return (errs ? -1 : 0); } @@ -705,12 +634,6 @@ strncpy(m->desc, l, sizeof(m->desc) - 1); m->desc[sizeof(m->desc) - 1] = '\0'; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - MODNAME ": parse line=%d m=%x next=%x cont=%d desc=%s", - lineno, m, m->next, m->cont_level, m->desc); -#endif /* MIME_MAGIC_DEBUG */ - return 0; } @@ -877,7 +800,6 @@ magic_req_rec *req_dat = (magic_req_rec *) emalloc(sizeof(magic_req_rec)); req_dat->head = req_dat->tail = (magic_rsl *) NULL; - MIME_MAGIC_G(req_dat) = req_dat; return req_dat; } @@ -901,10 +823,13 @@ /* it is the responsibility of the caller to allocate "str" */ static int magic_rsl_add(char *str) { - magic_req_rec *req_dat = MIME_MAGIC_G(req_dat); + magic_req_rec *req_dat; magic_rsl *rsl; + TSRMLS_FETCH(); - /* make sure we have a list to put it in */ + req_dat = MIME_MAGIC_G(req_dat); + + /* make sure we have a list to put it in */ if (!req_dat) { php_error(E_WARNING, MODNAME ": request config should not be NULL"); @@ -975,7 +900,10 @@ cur_pos, /* current position within fragment */ res_pos; /* position in result string */ magic_rsl *frag; /* list-traversal pointer */ - magic_req_rec *req_dat = MIME_MAGIC_G(req_dat); + magic_req_rec *req_dat; + TSRMLS_FETCH(); + + req_dat = MIME_MAGIC_G(req_dat); /* allocate the result string */ result = (char *) emalloc(len + 1); @@ -1006,10 +934,7 @@ /* clean up and return */ result[res_pos] = 0; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - MODNAME ": rsl_strdup() %d chars: %s", res_pos - 1, result); -#endif + return result; } @@ -1018,9 +943,9 @@ * (formerly called "process" in file command, prefix added for clarity) Opens * the file and reads a fixed-size buffer to begin processing the contents. */ -static int magic_process(char *filename) +static int magic_process(char *filename TSRMLS_DC) { - int fd = 0; + php_stream *stream; unsigned char buf[HOWMANY + 1]; /* one extra for terminating '\0' */ int nbytes = 0; /* number of bytes read from a datafile */ int result; @@ -1028,7 +953,7 @@ /* * first try judging the file based on its filesystem status */ - switch ((result = fsmagic(filename))) { + switch ((result = fsmagic(filename TSRMLS_CC))) { case MIME_MAGIC_DONE: magic_rsl_putchar('\n'); return MIME_MAGIC_OK; @@ -1039,7 +964,9 @@ return result; } - if ((fd = open(filename, O_RDONLY, 0)) < 0) { + stream = php_stream_open_wrapper(filename, "r", IGNORE_PATH | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); + + if (stream == NULL) { /* We can't open it, but we were able to stat it. */ php_error(E_WARNING, MODNAME ": can't read `%s'", filename); @@ -1050,7 +977,7 @@ /* * try looking at the first HOWMANY bytes */ - if ((nbytes = read(fd, (char *) buf, sizeof(buf) - 1)) == -1) { + if ((nbytes = php_stream_read(stream, (char *) buf, sizeof(buf) - 1)) == -1) { php_error(E_WARNING, MODNAME ": read failed: %s", filename); return MIME_MAGIC_ERROR; @@ -1063,7 +990,7 @@ tryit(buf, nbytes, 1); } - (void) close(fd); + (void) php_stream_close(stream); (void) magic_rsl_putchar('\n'); return MIME_MAGIC_OK; @@ -1105,13 +1032,15 @@ * return MIME_MAGIC_OK to indicate it's a regular file still needing handling * other returns indicate a failure of some sort */ -static int fsmagic(const char *fn) +static int fsmagic(char *filename TSRMLS_DC) { - struct stat finfo; + php_stream_statbuf stat_ssb; - stat(fn, &finfo); + if(!php_stream_stat_path(filename, &stat_ssb)) { + return MIME_MAGIC_OK; + } - switch (finfo.st_mode & S_IFMT) { + switch (stat_ssb.sb.st_mode & S_IFMT) { case S_IFDIR: magic_rsl_puts(DIR_MAGIC_TYPE); return MIME_MAGIC_DONE; @@ -1146,7 +1075,7 @@ * symlink is broken. */ php_error(E_WARNING, - MODNAME ": broken symlink (%s)", fn); + MODNAME ": broken symlink (%s)", filename); return MIME_MAGIC_ERROR; #endif #ifdef S_IFSOCK @@ -1158,16 +1087,18 @@ #endif case S_IFREG: break; + case 0: + break; default: php_error(E_WARNING, - MODNAME ": invalid mode 0%o.", (unsigned int)finfo.st_mode); + MODNAME ": invalid mode 0%o.", (unsigned int)stat_ssb.sb.st_mode); return MIME_MAGIC_ERROR; } /* * regular file, check next possibility */ - if (finfo.st_size == 0) { + if (stat_ssb.sb.st_size == 0) { magic_rsl_puts(MIME_TEXT_UNKNOWN); return MIME_MAGIC_DONE; } @@ -1215,50 +1146,13 @@ */ static int match(unsigned char *s, int nbytes) { -#if MIME_MAGIC_DEBUG - int rule_counter = 0; -#endif int cont_level = 0; int need_separator = 0; union VALUETYPE p; magic_server_config_rec *conf = &mime_global; struct magic *m; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - MODNAME ": match conf=%x file=%s m=%s m->next=%s last=%s", - conf, - conf->magicfile ? conf->magicfile : "NULL", - conf->magic ? "set" : "NULL", - (conf->magic && conf->magic->next) ? "set" : "NULL", - conf->last ? "set" : "NULL"); -#endif - -#if MIME_MAGIC_DEBUG for (m = conf->magic; m; m = m->next) { - if (isprint((((unsigned long) m) >> 24) & 255) && - isprint((((unsigned long) m) >> 16) & 255) && - isprint((((unsigned long) m) >> 8) & 255) && - isprint(((unsigned long) m) & 255)) { - php_error(E_NOTICE, - MODNAME ": match: POINTER CLOBBERED! " - "m=\"%c%c%c%c\"", - (((unsigned long) m) >> 24) & 255, - (((unsigned long) m) >> 16) & 255, - (((unsigned long) m) >> 8) & 255, - ((unsigned long) m) & 255); - break; - } - } -#endif - - for (m = conf->magic; m; m = m->next) { -#if MIME_MAGIC_DEBUG - rule_counter++; - php_error(E_NOTICE, - MODNAME ": line=%d desc=%s", m->lineno, m->desc); -#endif - /* check if main entry matches */ if (!mget(&p, s, m, nbytes) || !mcheck(&p, m)) { @@ -1273,14 +1167,6 @@ m_cont = m->next; while (m_cont && (m_cont->cont_level != 0)) { -#if MIME_MAGIC_DEBUG - rule_counter++; - php_error(E_NOTICE, - MODNAME ": line=%d mc=%x mc->next=%x cont=%d desc=%s", - m_cont->lineno, m_cont, - m_cont->next, m_cont->cont_level, - m_cont->desc); -#endif /* * this trick allows us to keep *m in sync when the continue * advances the pointer @@ -1293,12 +1179,6 @@ /* if we get here, the main entry rule was a match */ /* this will be the last run through the loop */ -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - MODNAME ": rule matched, line=%d type=%d %s", - m->lineno, m->type, - (m->type == STRING) ? m->value.s : ""); -#endif /* print the match */ mprint(&p, m); @@ -1317,12 +1197,6 @@ */ m = m->next; while (m && (m->cont_level != 0)) { -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - MODNAME ": match line=%d cont=%d type=%d %s", - m->lineno, m->cont_level, m->type, - (m->type == STRING) ? m->value.s : ""); -#endif if (cont_level >= m->cont_level) { if (cont_level > m->cont_level) { /* @@ -1361,16 +1235,8 @@ /* move to next continuation record */ m = m->next; } -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - MODNAME ": matched after %d rules", rule_counter); -#endif return 1; /* all through */ } -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - MODNAME ": failed after %d rules", rule_counter); -#endif return 0; /* no match at all */ } @@ -1635,77 +1501,41 @@ switch (m->reln) { case 'x': -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "%lu == *any* = 1", v); -#endif matched = 1; break; case '!': matched = v != l; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "%lu != %lu = %d", v, l, matched); -#endif break; case '=': matched = v == l; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "%lu == %lu = %d", v, l, matched); -#endif break; case '>': if (m->flag & UNSIGNED) { matched = v > l; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "%lu > %lu = %d", v, l, matched); -#endif } else { matched = (long) v > (long) l; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "%ld > %ld = %d", v, l, matched); -#endif } break; case '<': if (m->flag & UNSIGNED) { matched = v < l; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "%lu < %lu = %d", v, l, matched); -#endif } else { matched = (long) v < (long) l; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "%ld < %ld = %d", v, l, matched); -#endif } break; case '&': matched = (v & l) == l; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "((%lx & %lx) == %lx) = %d", v, l, l, matched); -#endif break; case '^': matched = (v & l) != l; -#if MIME_MAGIC_DEBUG - php_error(E_NOTICE, - "((%lx & %lx) != %lx) = %d", v, l, l, matched); -#endif break; default: @@ -1720,7 +1550,7 @@ return matched; } -#if HAVE_ZLIB +#if HAVE_ZLIB /* * compress routines: zmagic() - returns 0 if not recognized, uncompresses * and prints information if recognized uncompress(s, method, old, n, newch) @@ -1729,10 +1559,6 @@ static int zmagic(unsigned char *buf, int nbytes) { - unsigned char *newbuf; - int newsize; - int i; - if (buf[0] != 0x1f) return 0; switch(buf[1]) { @@ -1872,7 +1698,11 @@ magic_rsl *frag; /* list-traversal pointer */ rsl_states state; - magic_req_rec *req_dat = MIME_MAGIC_G(req_dat); + magic_req_rec *req_dat; + + TSRMLS_FETCH(); + + req_dat = MIME_MAGIC_G(req_dat); /* check if we have a result */ if (!req_dat || !req_dat->head) { No revision No revision 1.2.2.1 +2 -8 php4/ext/mnogosearch/README Index: README =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mnogosearch/README,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- README 29 Apr 2002 02:30:51 -0000 1.2 +++ README 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -1,17 +1,11 @@ $Source: /repository/php4/ext/mnogosearch/README,v $ -$Id: README,v 1.8 2001/04/30 10:04:46 gluke Exp $ +$Id: README,v 1.9 2002/06/29 10:42:52 gluke Exp $ mnoGoSearch extension module for PHP4. -For details please refer to http://search.mnogo.ru +For details please refer to http://www.mnogosearch.org/ If used with mysql you should not use bundled mysql library in the php distribution. You should use native mysql library. To do this you should compile php with specefying mysql-dir (for example --with-mysql=/usr, not --with-mysql). - - TODO - ---- - -Implement indexing functions of the library. -For example retrieving, parsing, checking of the URL and so on... 1.2.2.1 +54 -13 php4/ext/mnogosearch/index.php Index: index.php =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mnogosearch/index.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- index.php 29 Apr 2002 02:30:51 -0000 1.2 +++ index.php 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -2,12 +2,12 @@ /* $Source: /repository/php4/ext/mnogosearch/index.php,v $ - $Id: index.php,v 1.11 2001/12/10 07:21:49 gluke Exp $ + $Id: index.php,v 1.12 2002/06/29 10:42:52 gluke Exp $ */ -/* mnoGoSearch-php-lite v.1.2 +/* mnoGoSearch-php-lite v.1.3 * for mnoGoSearch ( formely known as UdmSearch ) free web search engine - * (C) 2001 by Sergey Kartashoff <gluke****@mail*****>, + * (C) 2001-2002 by Sergey Kartashoff <gluke****@mail*****>, * mnoGoSearch Developers Team <devel****@mnogo*****> */ @@ -28,8 +28,12 @@ /* variables section */ -$dbaddr='mysql://udm:udm@/udm/'; -$dbmode='single'; +if (Udm_Api_Version() >= 30204) { + $dbaddr='mysql://mnogo:mnogo@/mnogo/?dbmode=single'; +} else { + $dbaddr='mysql://mnogo:mnogo@/mnogo/'; + $dbmode='single'; +} $localcharset='koi8-r'; $browsercharset='utf-8'; @@ -37,13 +41,21 @@ $ispelluseprefixes=$trackquery='no'; $spell_host=$vardir=$datadir=''; $ispellmode='text'; -$affix_file['en']='/opt/udm/ispell/en.aff'; + +$affix_file=array(); +$spell_file=array(); +$stopwordtable_arr=array(); +$stopwordfile_arr=array(); +$synonym_arr=array(); +$searchd_arr=array(); + +// $affix_file['en']='/opt/udm/ispell/en.aff'; // $affix_file['ru']='/opt/udm/ispell/ru.aff'; -$spell_file['en']='/opt/udm/ispell/en.dict'; +// $spell_file['en']='/opt/udm/ispell/en.dict'; // $spell_file['ru']='/opt/udm/ispell/ru.dict'; -$stopwordtable_arr[]='stopword'; + $stopwordtable_arr[]='stopword'; // $stopwordfile_arr[]='stopwords.txt'; -$synonym_arr[]='/opt/udm/synonym/english.syn'; +// $synonym_arr[]='/opt/udm/synonym/english.syn'; $searchd_arr[]='localhost'; $minwordlength=1; @@ -53,6 +65,27 @@ /* initialisation section */ +if(isset($HTTP_GET_VARS)){ + while(list($var, $val)=each($HTTP_GET_VARS)){ + $$var=$val; + } +} +if(isset($HTTP_POST_VARS)){ + while(list($var, $val)=each($HTTP_POST_VARS)){ + $$var=$val; + } +} +if(isset($HTTP_COOKIE_VARS)){ + while(list($var, $val)=each($HTTP_COOKIE_VARS)){ + $$var=$val; + } +} +if(isset($HTTP_SERVER_VARS)){ + while(list($var, $val)=each($HTTP_SERVER_VARS)){ + $$var=$val; + } +} + $self=$PHP_SELF; if ($ps=="") $ps=20; @@ -479,7 +512,11 @@ $have_spell_flag=0; - $udm_agent=Udm_Alloc_Agent($dbaddr,$dbmode); + if (Udm_Api_Version() >= 30204) { + $udm_agent=Udm_Alloc_Agent($dbaddr); + } else { + $udm_agent=Udm_Alloc_Agent($dbaddr,$dbmode); + } Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PAGE_SIZE,$ps); Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PAGE_NUM,$np); @@ -613,6 +650,10 @@ Udm_Set_Agent_Param($udm_agent,UDM_PARAM_REMOTE_ADDR,$REMOTE_ADDR); } + if (Udm_Api_Version() >= 30204) { + if ($have_query_flag)Udm_Set_Agent_Param($udm_agent,UDM_PARAM_QUERY,$query_orig); + } + if ($m=='any') { Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_ANY); } elseif ($m=='all') { @@ -924,7 +965,7 @@ print("Displaying documents $first_doc-$last_doc of total <B>$found</B> found.\n"); $stored_link=-1; - if ((Udm_Api_Version() >= 30203) && ($storedaddr != '')) { + if ((Udm_Api_Version() == 30203) && ($storedaddr != '')) { $stored_link=Udm_Open_Stored($udm_agent,$storedaddr); } @@ -964,7 +1005,7 @@ print ("<A HREF=\"$url\" TARGET=\"_blank\">$url</A>\n"); print ("($contype) $lastmod, $docsize bytes</UL></DL>\n"); - if (Udm_Api_Version() >= 30203) { + if (Udm_Api_Version() == 30203) { if ((($stored_link>0) && (Udm_Check_Stored($udm_agent,$stored_link,Udm_CRC32($udm_agent,$url)))) || ($stored_link==-1)) { $storedstr="$storedocurl?rec_id=".Udm_CRC32($udm_agent,$url). @@ -979,7 +1020,7 @@ } } - if ((Udm_Api_Version() >= 30203) && + if ((Udm_Api_Version() == 30203) && ($stored_link>0)) { Udm_Close_Stored($udm_agent, $stored_link); } 1.2.2.1 +502 -76 php4/ext/mnogosearch/php_mnogo.c Index: php_mnogo.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mnogosearch/php_mnogo.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_mnogo.c 29 Apr 2002 02:30:52 -0000 1.2 +++ php_mnogo.c 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -1,5 +1,5 @@ /* $Source: /repository/php4/ext/mnogosearch/php_mnogo.c,v $ */ -/* $Id: php_mnogo.c,v 1.50 2002/02/28 08:26:23 sebastian Exp $ */ +/* $Id: php_mnogo.c,v 1.59 2002/06/26 08:57:17 derick Exp $ */ /* +----------------------------------------------------------------------+ @@ -77,6 +77,7 @@ #define UDM_PARAM_SEARCHD 22 #define UDM_PARAM_QSTRING 23 #define UDM_PARAM_REMOTE_ADDR 24 +#define UDM_PARAM_QUERY 25 /* udm_add_search_limit constants */ #define UDM_LIMIT_URL 1 @@ -118,6 +119,7 @@ #define UDM_PARAM_SEARCHTIME 259 #define UDM_PARAM_FIRST_DOC 260 #define UDM_PARAM_LAST_DOC 261 +#define UDM_PARAM_WORDINFO_ALL 262 /* udm_load_ispell_data constants */ #define UDM_ISPELL_TYPE_AFFIX 1 @@ -135,16 +137,21 @@ */ function_entry mnogosearch_functions[] = { PHP_FE(udm_api_version, NULL) + #if UDM_VERSION_ID >= 30200 PHP_FE(udm_check_charset, NULL) -#endif - -#if UDM_VERSION_ID >= 30203 - PHP_FE(udm_crc32, NULL) +#if UDM_VERSION_ID == 30203 PHP_FE(udm_open_stored, NULL) PHP_FE(udm_check_stored,NULL) PHP_FE(udm_close_stored,NULL) #endif +#if UDM_VERSION_ID >= 30203 + PHP_FE(udm_crc32, NULL) +#endif +#if UDM_VERSION_ID >= 30204 + PHP_FE(udm_parse_query_string,NULL) +#endif +#endif PHP_FE(udm_alloc_agent, NULL) PHP_FE(udm_set_agent_param, NULL) @@ -197,14 +204,24 @@ static void _free_udm_agent(zend_rsrc_list_entry *rsrc TSRMLS_DC) { UDM_AGENT * Agent = (UDM_AGENT *)rsrc->ptr; +#if UDM_VERSION_ID >= 30204 + UdmEnvFree(Agent->Conf); + UdmAgentFree(Agent); +#else UdmFreeEnv(Agent->Conf); UdmFreeAgent(Agent); +#endif } static void _free_udm_res(zend_rsrc_list_entry *rsrc TSRMLS_DC) { UDM_RESULT * Res = (UDM_RESULT *)rsrc->ptr; - UdmFreeResult(Res); + +#if UDM_VERSION_ID >= 30204 + UdmResultFree(Res); +#else + UdmFreeResult(Res); +#endif } /* {{{ PHP_MINIT_FUNCTION @@ -278,6 +295,7 @@ REGISTER_LONG_CONSTANT("UDM_PARAM_QSTRING", UDM_PARAM_QSTRING,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_PARAM_REMOTE_ADDR", UDM_PARAM_REMOTE_ADDR,CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("UDM_PARAM_QUERY", UDM_PARAM_QUERY,CONST_CS | CONST_PERSISTENT); /* udm_add_search_limit constants */ REGISTER_LONG_CONSTANT("UDM_LIMIT_CAT", UDM_LIMIT_CAT,CONST_CS | CONST_PERSISTENT); @@ -290,6 +308,7 @@ REGISTER_LONG_CONSTANT("UDM_PARAM_FOUND", UDM_PARAM_FOUND,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_PARAM_NUM_ROWS", UDM_PARAM_NUM_ROWS,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_PARAM_WORDINFO", UDM_PARAM_WORDINFO,CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("UDM_PARAM_WORDINFO_ALL",UDM_PARAM_WORDINFO_ALL,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_PARAM_WORD_INFO", UDM_PARAM_WORDINFO,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCHTIME", UDM_PARAM_SEARCHTIME,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCH_TIME", UDM_PARAM_SEARCHTIME,CONST_CS | CONST_PERSISTENT); @@ -399,19 +418,37 @@ } convert_to_string_ex(yydbaddr); dbaddr = Z_STRVAL_PP(yydbaddr); - + +#if UDM_VERSION_ID >= 30204 + Env=UdmEnvInit(NULL); + UdmVarListReplaceStr(&Env->Vars,"SyslogFacility","local7"); + UdmSetLogLevel(Env,0); + UdmOpenLog("mnoGoSearch-php",Env,0); + + if(!memcmp(dbaddr,"searchd:",8)){ + UDM_URL Url; + UdmURLParse(&Url,dbaddr); + UdmDBListAdd(&Env->sdcl,Url.hostinfo); + } + UdmVarListReplaceStr(&Env->Vars,"DBAddr",dbaddr); + if(UDM_OK!=UdmDBSetAddr(Env->db,dbaddr,UDM_OPEN_MODE_READ)){ + sprintf(Env->errstr,"Invalid DBAddr: '%s'",dbaddr); + Env->errcode=1; + php_error(E_WARNING,"%s(): Invalid DBAddr", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + Agent=UdmAgentInit(NULL,Env,0); +#elif UDM_VERSION_ID >= 30200 Env=UdmAllocEnv(); - -#if UDM_VERSION_ID >= 30200 Env->vars=UdmAllocVarList(); Env->DBAddr=strdup(dbaddr); UdmEnvSetDBMode(Env,"single"); + Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ); #else + Env=UdmAllocEnv(); UdmEnvSetDBAddr(Env,dbaddr); -#endif - Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ); - +#endif ZEND_REGISTER_RESOURCE(return_value,Agent,le_link); } break; @@ -432,18 +469,37 @@ dbaddr = Z_STRVAL_PP(yydbaddr); dbmode = Z_STRVAL_PP(yydbmode); - Env=UdmAllocEnv(); -#if UDM_VERSION_ID >= 30200 +#if UDM_VERSION_ID >= 30204 + Env=UdmEnvInit(NULL); + UdmVarListReplaceStr(&Env->Vars,"SyslogFacility","local7"); + UdmSetLogLevel(Env,0); + UdmOpenLog("mnoGoSearch-php",Env,0); + + if(!memcmp(dbaddr,"searchd:",8)){ + UDM_URL Url; + UdmURLParse(&Url,dbaddr); + UdmDBListAdd(&Env->sdcl,Url.hostinfo); + } + UdmVarListReplaceStr(&Env->Vars,"DBAddr",dbaddr); + if(UDM_OK!=UdmDBSetAddr(Env->db,dbaddr,UDM_OPEN_MODE_READ)){ + sprintf(Env->errstr,"Invalid DBAddr: '%s'",dbaddr); + Env->errcode=1; + php_error(E_WARNING,"%s(): Invalid DBAddr", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + Agent=UdmAgentInit(NULL,Env,0); +#elif UDM_VERSION_ID >= 30200 + Env=UdmAllocEnv(); Env->vars=UdmAllocVarList(); Env->DBAddr=strdup(dbaddr); UdmEnvSetDBMode(Env,dbmode); -#else + Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ); +#else + Env=UdmAllocEnv(); UdmEnvSetDBAddr(Env,dbaddr); - UdmEnvSetDBMode(Env,dbmode); -#endif - + UdmEnvSetDBMode(Env,dbmode); Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ); - +#endif ZEND_REGISTER_RESOURCE(return_value,Agent,le_link); } break; @@ -485,67 +541,111 @@ switch(var){ case UDM_PARAM_PAGE_SIZE: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"ps",val); +#else Agent->page_size=atoi(val); if(Agent->page_size<1)Agent->page_size=20; - +#endif break; case UDM_PARAM_PAGE_NUM: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"np",val); +#else Agent->page_number=atoi(val); if(Agent->page_number<0)Agent->page_number=0; - +#endif break; - + case UDM_PARAM_SEARCH_MODE: switch (atoi(val)){ case UDM_MODE_ALL: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"m","all"); +#else Agent->search_mode=UDM_MODE_ALL; +#endif break; case UDM_MODE_ANY: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"m","any"); +#else Agent->search_mode=UDM_MODE_ANY; +#endif break; case UDM_MODE_BOOL: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"m","all"); +#else Agent->search_mode=UDM_MODE_BOOL; +#endif break; case UDM_MODE_PHRASE: +#if UDM_VERSION_ID >= 30200 + php_error(E_WARNING,"%s(): Unknown search mode", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; +#else Agent->search_mode=UDM_MODE_PHRASE; +#endif break; default: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"m","all"); +#else Agent->search_mode=UDM_MODE_ALL; - - php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown search mode"); +#endif + php_error(E_WARNING,"%s(): Unknown search mode", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } - break; case UDM_PARAM_WORD_MATCH: switch (atoi(val)){ case UDM_MATCH_WORD: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","wrd"); +#else Agent->word_match=UDM_MATCH_WORD; +#endif break; case UDM_MATCH_BEGIN: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","beg"); +#else Agent->word_match=UDM_MATCH_BEGIN; +#endif break; case UDM_MATCH_END: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","end"); +#else Agent->word_match=UDM_MATCH_END; +#endif break; case UDM_MATCH_SUBSTR: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","sub"); +#else Agent->word_match=UDM_MATCH_SUBSTR; +#endif break; default: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"wm","wrd"); +#else Agent->word_match=UDM_MATCH_WORD; - - php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown word match mode"); +#endif + php_error(E_WARNING,"%s(): Unknown word match mode", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -553,9 +653,11 @@ case UDM_PARAM_CACHE_MODE: switch (atoi(val)){ case UDM_CACHE_ENABLED: -#if UDM_VERSION_ID < 30200 +#if UDM_VERSION_ID < 30200 Agent->cache_mode=UDM_CACHE_ENABLED; -#else +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"Cache","yes"); +#else UdmReplaceStrVar(Agent->Conf->vars,"Cache","yes",UDM_VARSRC_GLOBAL); #endif break; @@ -563,6 +665,8 @@ case UDM_CACHE_DISABLED: #if UDM_VERSION_ID < 30200 Agent->cache_mode=UDM_CACHE_DISABLED; +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"Cache","no"); #else UdmReplaceStrVar(Agent->Conf->vars,"Cache","no",UDM_VARSRC_GLOBAL); #endif @@ -571,10 +675,12 @@ default: #if UDM_VERSION_ID < 30200 Agent->cache_mode=UDM_CACHE_DISABLED; +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"Cache","no"); #else UdmReplaceStrVar(Agent->Conf->vars,"Cache","no",UDM_VARSRC_GLOBAL); #endif - php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown cache mode"); + php_error(E_WARNING,"%s(): Unknown cache mode", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -586,6 +692,8 @@ case UDM_TRACK_ENABLED: #if UDM_VERSION_ID < 30200 Agent->track_mode|=UDM_TRACK_QUERIES; +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"TrackQuery","yes"); #else UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","yes",UDM_VARSRC_GLOBAL); #endif @@ -594,6 +702,8 @@ case UDM_TRACK_DISABLED: #if UDM_VERSION_ID < 30200 Agent->track_mode &= ~(UDM_TRACK_QUERIES); +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"TrackQuery","no"); #else UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","no",UDM_VARSRC_GLOBAL); #endif @@ -603,10 +713,12 @@ default: #if UDM_VERSION_ID < 30200 Agent->track_mode &= ~(UDM_TRACK_QUERIES); +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"TrackQuery","no"); #else UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","no",UDM_VARSRC_GLOBAL); #endif - php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown track mode"); + php_error(E_WARNING,"%s(): Unknown track mode", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -625,7 +737,7 @@ break; default: - php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown phrase mode"); + php_error(E_WARNING,"%s(): Unknown phrase mode", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -633,11 +745,12 @@ break; case UDM_PARAM_ISPELL_PREFIXES: - switch (atoi(val)){ case UDM_PREFIXES_ENABLED: #if UDM_VERSION_ID < 30200 Agent->Conf->ispell_mode |= UDM_ISPELL_USE_PREFIXES; +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"IspellUsePrefixes","1"); #else UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 1, UDM_VARSRC_GLOBAL); #endif @@ -646,6 +759,8 @@ case UDM_PREFIXES_DISABLED: #if UDM_VERSION_ID < 30200 Agent->Conf->ispell_mode &= ~UDM_ISPELL_USE_PREFIXES; +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"IspellUsePrefixes","0"); #else UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 0, UDM_VARSRC_GLOBAL); #endif @@ -655,10 +770,12 @@ default: #if UDM_VERSION_ID < 30200 Agent->Conf->ispell_mode |= UDM_ISPELL_USE_PREFIXES; +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"IspellUsePrefixes","0"); #else UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 1, UDM_VARSRC_GLOBAL); #endif - php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown ispell prefixes mode"); + php_error(E_WARNING,"%s(): Unknown ispell prefixes mode", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -670,6 +787,12 @@ #if UDM_VERSION_ID < 30200 Agent->Conf->local_charset=UdmGetCharset(val); Agent->charset=Agent->Conf->local_charset; +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"LocalCharset",val); + { + const char * charset=UdmVarListFindStr(&Agent->Conf->Vars,"LocalCharset","iso-8859-1"); + Agent->Conf->lcs=UdmGetCharSet(charset); + } #else Agent->Conf->local_charset=strdup(val); UdmReplaceStrVar(Agent->Conf->vars,"LocalCharset",val,UDM_VARSRC_GLOBAL); @@ -679,29 +802,47 @@ #if UDM_VERSION_ID >= 30200 case UDM_PARAM_BROWSER_CHARSET: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"BrowserCharset",val); + { + const char * charset=UdmVarListFindStr(&Agent->Conf->Vars,"BrowserCharset","iso-8859-1"); + Agent->Conf->lcs=UdmGetCharSet(charset); + } +#else Agent->Conf->browser_charset=strdup(val); UdmReplaceStrVar(Agent->Conf->vars,"BrowserCharset",val,UDM_VARSRC_GLOBAL); - +#endif break; case UDM_PARAM_HLBEG: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"HlBeg",val); +#else UdmReplaceStrVar(Agent->Conf->vars,"HlBeg",val,UDM_VARSRC_GLOBAL); - +#endif break; case UDM_PARAM_HLEND: - UdmReplaceStrVar(Agent->Conf->vars,"HlBeg",val,UDM_VARSRC_GLOBAL); - +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"HlEnd",val); +#else + UdmReplaceStrVar(Agent->Conf->vars,"HlEnd",val,UDM_VARSRC_GLOBAL); +#endif break; case UDM_PARAM_SYNONYM: if (UdmSynonymListLoad(Agent->Conf,val)) { - php_error(E_WARNING,Agent->Conf->errstr); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C),Agent->Conf->errstr); RETURN_FALSE; +#if UDM_VERSION_ID >= 30204 + } else UdmSynonymListSort(&(Agent->Conf->Synonyms)); +#else } else UdmSynonymListSort(&(Agent->Conf->SynList)); +#endif break; case UDM_PARAM_SEARCHD: +#if UDM_VERSION_ID <= 30203 UdmSDCLientListAdd(&(Agent->Conf->sdcl),val); { size_t i; @@ -709,17 +850,24 @@ UdmSDCLientListAdd(&Agent->sdcl,Agent->Conf->sdcl.Clients[i].addr); } } - +#endif break; case UDM_PARAM_QSTRING: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"QUERY_STRING",val); +#else UdmReplaceStrVar(Agent->Conf->vars,"QUERY_STRING",val,UDM_VARSRC_GLOBAL); - +#endif break; + case UDM_PARAM_REMOTE_ADDR: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"IP",val); +#else UdmReplaceStrVar(Agent->Conf->vars,"IP",val,UDM_VARSRC_GLOBAL); - +#endif break; #endif @@ -731,8 +879,12 @@ break; case UDM_PARAM_STOPFILE: +#if UDM_VERSION_ID >= 30204 + if (UdmStopListLoad(Agent->Conf,val)) { +#else if (UdmFileLoadStopList(Agent->Conf,val)) { - php_error(E_WARNING,Agent->Conf->errstr); +#endif + php_error(E_WARNING, "%s(): %s", Agent->Conf->errstr, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } break; @@ -740,6 +892,8 @@ case UDM_PARAM_WEIGHT_FACTOR: #if UDM_VERSION_ID < 30200 Agent->weight_factor=strdup(val); +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"wf",val); #else UdmReplaceStrVar(Agent->Conf->vars,"wf",val,UDM_VARSRC_GLOBAL); { @@ -763,27 +917,41 @@ break; case UDM_PARAM_MIN_WORD_LEN: +#if UDM_VERSION_ID >= 30204 + Agent->Conf->WordParam.min_word_len=atoi(val); +#else Agent->Conf->min_word_len=atoi(val); - +#endif break; case UDM_PARAM_MAX_WORD_LEN: +#if UDM_VERSION_ID >= 30204 + Agent->Conf->WordParam.max_word_len=atoi(val); +#else Agent->Conf->max_word_len=atoi(val); - +#endif break; case UDM_PARAM_CROSS_WORDS: switch (atoi(val)){ case UDM_CROSS_WORDS_ENABLED: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"CrossWords","yes"); +#else Agent->Conf->use_crossword=UDM_CROSS_WORDS_ENABLED; +#endif break; case UDM_CROSS_WORDS_DISABLED: +#if UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"CrossWords","no"); +#else Agent->Conf->use_crossword=UDM_CROSS_WORDS_DISABLED; +#endif break; default: - php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown crosswords mode"); + php_error(E_WARNING,"%s(): Unknown crosswords mode", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -795,16 +963,24 @@ case UDM_PARAM_VARDIR: #if UDM_VERSION_ID < 30200 udm_snprintf(Agent->Conf->vardir,sizeof(Agent->Conf->vardir)-1,"%s%s",val,UDMSLASHSTR); +#elif UDM_VERSION_ID >= 30204 + UdmVarListReplaceStr(&Agent->Conf->Vars,"Vardir",val); + snprintf(Agent->Conf->vardir,sizeof(Agent->Conf->vardir)-1,"%s%s",val,UDMSLASHSTR); #else snprintf(Agent->Conf->vardir,sizeof(Agent->Conf->vardir)-1,"%s%s",val,UDMSLASHSTR); #endif - break; +#if UDM_VERSION_ID >= 30204 + case UDM_PARAM_QUERY: + UdmVarListReplaceStr(&Agent->Conf->Vars,"q",val); + + break; +#endif + #endif - default: - php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown agent session parameter"); + php_error(E_WARNING,"%s(): Unknown agent session parameter", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -898,12 +1074,12 @@ #endif if (UdmImportAffixes(Agent->Conf,val1,val2,NULL,0)) { - php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load affix file %s",val2); + php_error(E_WARNING,"%s(): Cannot load affix file %s", get_active_function_name(TSRMLS_C),val2); RETURN_FALSE; } #else if (UdmImportAffixes(Agent->Conf,val1,charset,val2)) { - php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load affix file %s",val2); + php_error(E_WARNING,"%s(): Cannot load affix file %s", get_active_function_name(TSRMLS_C),val2); RETURN_FALSE; } @@ -919,12 +1095,12 @@ #endif if (UdmImportDictionary(Agent->Conf,val1,val2,1,"")) { - php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load spell file %s",val2); + php_error(E_WARNING,"%s(): Cannot load spell file %s", get_active_function_name(TSRMLS_C),val2); RETURN_FALSE; } #else if (UdmImportDictionary(Agent->Conf,val1,charset,val2,0,"")) { - php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load spell file %s",val2); + php_error(E_WARNING,"%s(): Cannot load spell file %s", get_active_function_name(TSRMLS_C),val2); RETURN_FALSE; } #endif @@ -932,16 +1108,23 @@ default: - php_error(E_WARNING,"Udm_Load_Ispell_Data: Unknown ispell type parameter"); + php_error(E_WARNING,"%s(): Unknown ispell type parameter", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } if (flag) { +#if UDM_VERSION_ID >= 30204 + if(Agent->Conf->Spells.nspell) { + UdmSortDictionary(&Agent->Conf->Spells); + UdmSortAffixes(&Agent->Conf->Affixes,&Agent->Conf->Spells); + } +#else if(Agent->Conf->nspell) { UdmSortDictionary(Agent->Conf); UdmSortAffixes(Agent->Conf); } +#endif } RETURN_TRUE; @@ -966,8 +1149,11 @@ break; } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link); - -#if UDM_VERSION_ID > 30111 + +#if UDM_VERSION_ID >= 30204 + UdmSpellListFree(&Agent->Conf->Spells); + UdmAffixListFree(&Agent->Conf->Affixes); +#elif UDM_VERSION_ID > 30111 UdmFreeIspell(Agent->Conf); #endif @@ -1005,26 +1191,40 @@ switch(var){ case UDM_LIMIT_URL: +#if UDM_VERSION_ID >= 30204 + UdmVarListAddStr(&Agent->Conf->Vars,"ul",val); +#else UdmAddURLLimit(Agent->Conf,val); - +#endif break; case UDM_LIMIT_TAG: +#if UDM_VERSION_ID >= 30204 + UdmVarListAddStr(&Agent->Conf->Vars,"t",val); +#else UdmAddTagLimit(Agent->Conf,val); - +#endif break; case UDM_LIMIT_LANG: +#if UDM_VERSION_ID >= 30204 + UdmVarListAddStr(&Agent->Conf->Vars,"lang",val); +#else UdmAddLangLimit(Agent->Conf,val); - +#endif break; case UDM_LIMIT_CAT: +#if UDM_VERSION_ID >= 30204 + UdmVarListAddStr(&Agent->Conf->Vars,"cat",val); +#else UdmAddCatLimit(Agent->Conf,val); - +#endif break; - case UDM_LIMIT_DATE: { + case UDM_LIMIT_DATE: +#if UDM_VERSION_ID < 30200 + { struct udm_stl_info_t stl_info = { 0, 0, 0 }; if (val[0] == '>') { @@ -1032,17 +1232,17 @@ } else if (val[0] == '<') { Z_TYPE(stl_info)=-1; } else { - php_error(E_WARNING,"Udm_Add_Search_Limit: Incorrect date limit format"); + php_error(E_WARNING,"%s(): Incorrect date limit format", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } stl_info.t1=(time_t)(atol(val+1)); UdmAddTimeLimit(Agent->Conf,&stl_info); - - break; } +#endif + break; default: - php_error(E_WARNING,"Udm_Add_Search_Limit: Unknown search limit parameter"); + php_error(E_WARNING,"%s(): Unknown search limit parameter", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -1056,6 +1256,8 @@ { pval ** yyagent; UDM_AGENT * Agent; + int i; + switch(ZEND_NUM_ARGS()){ case 1: { if (zend_get_parameters_ex(1, &yyagent)==FAILURE) { @@ -1068,9 +1270,20 @@ break; } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link); - +#if UDM_VERSION_ID >= 30204 + for(i=0;i<Agent->Conf->Vars.nvars;i++){ + if ((!strcasecmp("ul",Agent->Conf->Vars.Var[i].name))|| + (!strcasecmp("cat",Agent->Conf->Vars.Var[i].name))|| + (!strcasecmp("t",Agent->Conf->Vars.Var[i].name))|| + (!strcasecmp("lang",Agent->Conf->Vars.Var[i].name))) { + UDM_FREE(Agent->Conf->Vars.Var[i].name); + UDM_FREE(Agent->Conf->Vars.Var[i].val); + Agent->Conf->Vars.nvars--; + } + } +#else UdmClearLimits(Agent->Conf); - +#endif RETURN_TRUE; } /* }}} */ @@ -1141,7 +1354,9 @@ RETURN_STRING(buf,1); } /* }}} */ +#endif +#if UDM_VERSION_ID == 30203 /* {{{ proto int udm_open_stored(int agent, string storedaddr) Open connection to stored */ DLEXPORT PHP_FUNCTION(udm_open_stored) @@ -1260,6 +1475,37 @@ /* }}} */ #endif +#if UDM_VERSION_ID >= 30204 +/* {{{ proto int udm_parse_query_string(int agent, string str) + Parses query string, initialises variables and search limits taken from it */ +DLEXPORT PHP_FUNCTION(udm_parse_query_string) +{ + pval ** yystr, ** yyagent; + char *str; + UDM_AGENT * Agent; + int id=-1; + + switch(ZEND_NUM_ARGS()){ + case 2: { + if (zend_get_parameters_ex(2, &yyagent,&yystr)==FAILURE) { + RETURN_FALSE; + } + } + break; + default: + WRONG_PARAM_COUNT; + break; + } + ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link); + convert_to_string_ex(yystr); + str = Z_STRVAL_PP(yystr); + + UdmParseQueryString(Agent,&Agent->Conf->Vars,str); + RETURN_TRUE; +} +/* }}} */ +#endif + /* {{{ proto int udm_find(int agent, string query) Perform search */ DLEXPORT PHP_FUNCTION(udm_find) @@ -1283,7 +1529,7 @@ ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link); convert_to_string_ex(yyquery); -#if UDM_VERSION_ID < 30200 +#if UDM_VERSION_ID < 30200 if ((Res=UdmFind(Agent,UdmTolower(Z_STRVAL_PP(yyquery),Agent->charset)))) { #else if ((Res=UdmFind(Agent,Z_STRVAL_PP(yyquery)))) { @@ -1323,74 +1569,134 @@ if(row<Res->num_rows){ switch(field){ case UDM_FIELD_URL: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&Res->Doc[row].Sections,"URL",""),1); +#else RETURN_STRING((Res->Doc[row].url)?(Res->Doc[row].url):"",1); +#endif break; case UDM_FIELD_CONTENT: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Content-Type",""),1); +#else RETURN_STRING((Res->Doc[row].content_type)?(Res->Doc[row].content_type):"",1); +#endif break; case UDM_FIELD_TITLE: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Title",""),1); +#else RETURN_STRING((Res->Doc[row].title)?(Res->Doc[row].title):"",1); +#endif break; case UDM_FIELD_KEYWORDS: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Meta.Keywords",""),1); +#else RETURN_STRING((Res->Doc[row].keywords)?(Res->Doc[row].keywords):"",1); +#endif break; case UDM_FIELD_DESC: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Meta.Description",""),1); +#else RETURN_STRING((Res->Doc[row].description)?(Res->Doc[row].description):"",1); +#endif break; case UDM_FIELD_TEXT: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Body",""),1); +#else RETURN_STRING((Res->Doc[row].text)?(Res->Doc[row].text):"",1); +#endif break; case UDM_FIELD_SIZE: +#if UDM_VERSION_ID >= 30204 + RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"Content-Length",0)); +#else RETURN_LONG((Res->Doc[row].size)); +#endif break; - case UDM_FIELD_URLID: + case UDM_FIELD_URLID: +#if UDM_VERSION_ID >= 30204 + RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"ID",0)); +#else RETURN_LONG((Res->Doc[row].url_id)); +#endif break; case UDM_FIELD_RATING: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Score",""),1); +#else RETURN_LONG((Res->Doc[row].rating)); +#endif break; case UDM_FIELD_MODIFIED: +#if UDM_VERSION_ID >= 30204 + RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"Last-Modified",0)); +#else RETURN_LONG((Res->Doc[row].last_mod_time)); +#endif break; case UDM_FIELD_ORDER: +#if UDM_VERSION_ID >= 30204 + RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"Order",0)); +#else RETURN_LONG((Res->Doc[row].order)); +#endif break; case UDM_FIELD_CRC: +#if UDM_VERSION_ID >= 30204 + RETURN_LONG(UdmVarListFindInt(&(Res->Doc[row].Sections),"crc32",0)); +#else RETURN_LONG((Res->Doc[row].crc32)); +#endif break; case UDM_FIELD_CATEGORY: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Category",""),1); +#else RETURN_STRING((Res->Doc[row].category)?(Res->Doc[row].category):"",1); +#endif break; #if UDM_VERSION_ID >= 30203 case UDM_FIELD_LANG: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Content-Language",""),1); +#else RETURN_STRING((Res->Doc[row].lang)?(Res->Doc[row].lang):"",1); +#endif break; case UDM_FIELD_CHARSET: +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((char *)UdmVarListFindStr(&(Res->Doc[row].Sections),"Charset",""),1); +#else RETURN_STRING((Res->Doc[row].charset)?(Res->Doc[row].charset):"",1); +#endif break; #endif default: - php_error(E_WARNING,"Udm_Get_Res_Field: Unknown mnoGoSearch field name"); + php_error(E_WARNING,"%s(): Unknown mnoGoSearch field name", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } }else{ - php_error(E_WARNING,"Udm_Get_Res_Field: row number too large"); + php_error(E_WARNING,"%s(): row number too large", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -1426,9 +1732,73 @@ RETURN_LONG(Res->total_found); break; - case UDM_PARAM_WORDINFO: + case UDM_PARAM_WORDINFO: +#if UDM_VERSION_ID >= 30204 + { + int len,i; + for(len = i = 0; i < Res->WWList.nwords; i++) + len += Res->WWList.Word[i].len; + { + size_t wsize=(1+len*15)*sizeof(char); + char *wordinfo = (char*) malloc(wsize); + int corder = -1, ccount = 0; + + *wordinfo = '\0'; + + for(i = 0; i < Res->WWList.nwords; i++){ + if ((Res->WWList.Word[i].count > 0) || (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_QUERY)) { + if(wordinfo[0]) strcat(wordinfo,", "); + sprintf(UDM_STREND(wordinfo)," %s : %d", Res->WWList.Word[i].word, Res->WWList.Word[i].count); + } else if (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_STOP) { + if(wordinfo[0]) strcat(wordinfo,", "); + sprintf(UDM_STREND(wordinfo)," %s : stopword", Res->WWList.Word[i].word); + } + } + RETURN_STRING(wordinfo,1); + } + } +#else RETURN_STRING((Res->wordinfo)?(Res->wordinfo):"",1); +#endif + break; + +#if UDM_VERSION_ID >= 30204 + case UDM_PARAM_WORDINFO_ALL: + { + int len,i; + for(len = i = 0; i < Res->WWList.nwords; i++) + len += Res->WWList.Word[i].len; + { + size_t wsize=(1+len*15)*sizeof(char); + char *wordinfo = (char*) malloc(wsize); + int corder = -1, ccount = 0; + + *wordinfo = '\0'; + + for(i = 0; i < Res->WWList.nwords; i++){ + if (Res->WWList.Word[i].order != corder) { + if(wordinfo[0]) { + sprintf(UDM_STREND(wordinfo)," / %d, ", ccount); + } + ccount = Res->WWList.Word[i].count; + if (Res->WWList.Word[i].origin == UDM_WORD_ORIGIN_STOP) { + sprintf(UDM_STREND(wordinfo)," %s : stopword", Res->WWList.Word[i].word); + } else { + sprintf(UDM_STREND(wordinfo)," %s : %d", Res->WWList.Word[i].word, Res->WWList.Word[i].count); + corder = Res->WWList.Word[i].order; + } + } else { + ccount += Res->WWList.Word[i].count; + } + } + if (Res->WWList.nwords) { + sprintf(UDM_STREND(wordinfo)," / %d", ccount); + } + RETURN_STRING(wordinfo,1); + } + } break; +#endif case UDM_PARAM_SEARCHTIME: RETURN_DOUBLE(((double)Res->work_time)/1000); @@ -1443,7 +1813,7 @@ break; default: - php_error(E_WARNING,"Udm_Get_Res_Param: Unknown mnoGoSearch param name"); + php_error(E_WARNING,"%s(): Unknown mnoGoSearch param name", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -1516,7 +1886,11 @@ break; } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link); +#if UDM_VERSION_ID >= 30204 + RETURN_LONG(UdmEnvErrCode(Agent->Conf)); +#else RETURN_LONG(UdmDBErrorCode(Agent->db)); +#endif } /* }}} */ @@ -1539,7 +1913,11 @@ break; } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link); +#if UDM_VERSION_ID >= 30204 + RETURN_STRING((UdmEnvErrMsg(Agent->Conf))?(UdmEnvErrMsg(Agent->Conf)):"",1); +#else RETURN_STRING((UdmDBErrorMsg(Agent->db))?(UdmDBErrorMsg(Agent->db)):"",1); +#endif } /* }}} */ @@ -1577,7 +1955,14 @@ convert_to_string_ex(yycat); cat = Z_STRVAL_PP(yycat); +#if UDM_VERSION_ID >= 30204 + if (NULL==(c=(UDM_CATEGORY *)malloc(sizeof(UDM_CATEGORY)))) RETURN_FALSE; + if (NULL==(c->Category=malloc(sizeof(UDM_CATITEM)))) RETURN_FALSE; + strncpy(c->addr,cat,sizeof(c->addr)-1); + if(UdmCatAction(Agent,c,UDM_CAT_ACTION_LIST,Agent->Conf->db)){ +#else if((c=UdmCatList(Agent,cat))){ +#endif if (array_init(return_value)==FAILURE) { RETURN_FALSE; } @@ -1586,15 +1971,30 @@ RETURN_FALSE; } +#if UDM_VERSION_ID >= 30204 + { + int i; + for(i==0;i<c->ncategories;i++){ + snprintf(buf, UDMSTRSIZ, "%s%s",c->Category[i].link[0]?"@ ":"", c->Category[i].name); + add_next_index_string(return_value, c->Category[i].link[0]?c->Category[i].link:c->Category[i].path, 1); + add_next_index_string(return_value, buf, 1); + c++; + } + } +#else while(c->rec_id){ snprintf(buf, UDMSTRSIZ, "%s%s",c->link[0]?"@ ":"", c->name); add_next_index_string(return_value, c->link[0]?c->link:c->path, 1); add_next_index_string(return_value, buf, 1); c++; } - +#endif free(buf); - } else { +#if UDM_VERSION_ID >= 30204 + free(c->Category); + free(c); +#endif +} else { RETURN_FALSE; } } @@ -1626,7 +2026,14 @@ convert_to_string_ex(yycat); cat = Z_STRVAL_PP(yycat); +#if UDM_VERSION_ID >= 30204 + if (NULL==(c=(UDM_CATEGORY *)malloc(sizeof(UDM_CATEGORY)))) RETURN_FALSE; + if (NULL==(c->Category=malloc(sizeof(UDM_CATITEM)))) RETURN_FALSE; + strncpy(c->addr,cat,sizeof(c->addr)-1); + if(UdmCatAction(Agent,c,UDM_CAT_ACTION_PATH,Agent->Conf->db)){ +#else if((c=UdmCatPath(Agent,cat))){ +#endif if (array_init(return_value)==FAILURE) { RETURN_FALSE; } @@ -1635,14 +2042,29 @@ RETURN_FALSE; } +#if UDM_VERSION_ID >= 30204 + { + int i; + for(i==0;i<c->ncategories;i++){ + snprintf(buf, UDMSTRSIZ, "%s%s",c->Category[i].link[0]?"@ ":"", c->Category[i].name); + add_next_index_string(return_value, c->Category[i].link[0]?c->Category[i].link:c->Category[i].path, 1); + add_next_index_string(return_value, buf, 1); + c++; + } + } +#else while(c->rec_id){ snprintf(buf, UDMSTRSIZ, "%s%s",c->link[0]?"@ ":"", c->name); add_next_index_string(return_value, c->link[0]?c->link:c->path, 1); add_next_index_string(return_value, buf, 1); c++; } - +#endif free(buf); +#if UDM_VERSION_ID >= 30204 + free(c->Category); + free(c); +#endif } else { RETURN_FALSE; } @@ -1670,7 +2092,11 @@ break; } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link); +#if UDM_VERSION_ID >= 30204 + RETURN_LONG(UdmURLAction(Agent,NULL,UDM_URL_ACTION_DOCCOUNT,Agent->Conf->db)); +#else RETURN_LONG(UdmGetDocCount(Agent)); +#endif } /* }}} */ #endif 1.2.2.1 +9 -5 php4/ext/mnogosearch/php_mnogo.h Index: php_mnogo.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mnogosearch/php_mnogo.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_mnogo.h 29 Apr 2002 02:30:52 -0000 1.2 +++ php_mnogo.h 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -1,5 +1,5 @@ /* $Source: /repository/php4/ext/mnogosearch/php_mnogo.h,v $ */ -/* $Id: php_mnogo.h,v 1.15 2002/02/28 08:26:23 sebastian Exp $ */ +/* $Id: php_mnogo.h,v 1.18 2002/06/06 05:45:45 gluke Exp $ */ /* +----------------------------------------------------------------------+ @@ -57,13 +57,17 @@ DLEXPORT PHP_FUNCTION(udm_api_version); #if UDM_VERSION_ID >= 30200 DLEXPORT PHP_FUNCTION(udm_check_charset); -#endif - -#if UDM_VERSION_ID >= 30203 -DLEXPORT PHP_FUNCTION(udm_crc32); +#if UDM_VERSION_ID == 30203 DLEXPORT PHP_FUNCTION(udm_open_stored); DLEXPORT PHP_FUNCTION(udm_check_stored); DLEXPORT PHP_FUNCTION(udm_close_stored); +#endif +#if UDM_VERSION_ID >= 30203 +DLEXPORT PHP_FUNCTION(udm_crc32); +#endif +#if UDM_VERSION_ID >= 30204 +DLEXPORT PHP_FUNCTION(udm_parse_query_string); +#endif #endif DLEXPORT PHP_FUNCTION(udm_alloc_agent); No revision No revision 1.2.2.1 +157 -66 php4/ext/msession/msession.c Index: msession.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/msession/msession.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- msession.c 29 Apr 2002 02:30:52 -0000 1.2 +++ msession.c 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -16,6 +16,10 @@ | Portions copyright the PHP group. | +----------------------------------------------------------------------+ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "php.h" #include "php_ini.h" #include "php_msession.h" @@ -23,6 +27,7 @@ #include "ext/standard/info.h" #include "ext/session/php_session.h" + /* Macros and such */ #ifndef TRUE #define TRUE 1 @@ -37,6 +42,13 @@ /* Uncomment to get debugging messages */ /* #define ERR_DEBUG */ +/* Uncomment for conections which are persistent for a process + * This will be faster but allocates a thread in the msession + * daemon. + * Pros: No reconnect overhead. + * cons: Msession maintains a thread per connection. + */ +/* #define PERSISTENT_CONN */ #ifdef ERR_DEBUG #define ELOG( str ) php_log_err( str ) @@ -47,8 +59,12 @@ /* Test if system is OK fror use. */ /* Macros may be ugly, but I can globaly add debuging when needed. */ #define IFCONNECT_BEGIN if(s_reqb && s_conn) { -#define IFCONNECT_ENDVAL(V) } else { php_error(E_WARNING, s_szNoInit); return V; } -#define IFCONNECT_END } else { php_error(E_WARNING, s_szNoInit); RETURN_FALSE; } +#define IFCONNECT_ENDVAL(V) } else { php_error(E_WARNING, s_szNoInit, get_active_function_name(TSRMLS_C)); return V; } +#define IFCONNECT_END } else { php_error(E_WARNING, s_szNoInit, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } + +#ifndef HAVE_PHP_SESSION +#error HAVE_PHP_SESSION not defined +#endif /* Test if session module contains custom sesson ID patch */ #ifdef PHP_SESSION_API @@ -60,7 +76,6 @@ /* This sets the PHP API version used in the file. */ /* If this module does not compile on the version of PHP you are using, look for */ /* this value in Zend/zend_modules.h, and set appropriately */ - #if (ZEND_MODULE_API_NO <= 20001222) #define PHP_4_0 #define TSRMLS_CC @@ -102,8 +117,8 @@ #endif /* Static strings */ -static char s_szNoInit[]="Msession not initialized"; -static char s_szErrFmt[]="MSession Error :%s"; +static char s_szNoInit[]="%s(): Msession not initialized"; +static char s_szErrFmt[]="%s(): %s"; /* Per-process variables need by msession */ static char s_szdefhost[]="localhost"; @@ -183,6 +198,7 @@ PHP_RSHUTDOWN_FUNCTION(msession) { +#ifndef PERSISTENT_CONN if(s_conn) { CloseReqConn(s_conn); @@ -194,6 +210,7 @@ FreeRequestBuffer(s_reqb); s_reqb=NULL; } +#endif return SUCCESS; } @@ -204,32 +221,87 @@ php_info_print_table_end(); } +/* The PHP Version of DoRequest */ +/* Manages connections that have been disconnected */ +int PHPDoRequest(void **pconn, REQB **ppreq) +{ + void *conn = *pconn; + int stat = (*ppreq)->req.stat; + int param = (*ppreq)->req.param; + + int result = DoRequest(conn, ppreq); + + // Server closed the connection! + if((*ppreq)->req.stat == REQ_ERR && (result == REQE_BADCONN || result == REQE_NOSEND)) + { + // In the case of a bad socket, this should be + // all that changs! + (*ppreq)->req.stat = stat; + (*ppreq)->req.param = param; + ELOG("Connection was closed by server"); + if(ReopenReqConn(conn)) + result = DoRequest(*pconn, ppreq); + } +#ifdef ERR_DEBUG + if((*ppreq)->req.stat == REQ_ERR && (result == REQE_BADCONN || result == REQE_NOSEND)) + ELOG("Socket reports closed"); +#endif + return result; +} + int PHPMsessionConnect(const char *szhost, int nport) { + int fNewHost=FALSE; TSRMLS_FETCH(); + if(!s_reqb) s_reqb = AllocateRequestBuffer(2048); if(!s_reqb) // no buffer, it won't work! return 0; - - if(s_conn) - { - CloseReqConn(s_conn); - php_log_err("Call to connect with non-null s_conn" TSRMLS_CC); - } + if(strcmp(s_szhost, szhost)) { if(s_szhost != s_szdefhost) free(s_szhost); s_szhost = strdup(szhost); + fNewHost = TRUE; } - if(nport) + if(nport && nport != s_port) + { + fNewHost = TRUE; s_port = nport; + } + +#ifndef PERSISTENT_CONN + ELOG("PHPMsessionConnect:old"); + if(s_conn) + { + CloseReqConn(s_conn); + php_log_err("Call to connect with non-null s_conn" TSRMLS_CC); + } s_conn = OpenReqConn(s_szhost, s_port); +#else + ELOG("PHPMsessionConnect:new"); + if(s_conn && fNewHost) + { + ELOG("Closing old connection, opening new"); + CloseReqConn(s_conn); + s_conn = NULL; + } + if(!s_conn) + s_conn = OpenReqConn(s_szhost, s_port); +#ifdef ERR_DEBUG + else + { + ELOG("Reusing old connection"); + } +#endif +#endif + #ifdef ERR_DEBUG { @@ -244,6 +316,7 @@ void PHPMsessionDisconnect() { +#ifndef PERSISTENT_CONN if(s_conn) { CloseReqConn(s_conn); @@ -254,16 +327,17 @@ FreeRequestBuffer(s_reqb); s_reqb = NULL; } +#endif } -char *PHPMsessionGetData(const char *session) +char *PHPMsessionGetData(const char *session TSRMLS_DC) { char *ret = NULL; IFCONNECT_BEGIN FormatRequest(&s_reqb, REQ_DATAGET, session,"","",0); - DoRequest(s_conn, &s_reqb); + PHPDoRequest(&s_conn, &s_reqb); if(s_reqb->req.stat==REQ_OK) ret = safe_estrdup(s_reqb->req.datum); @@ -271,33 +345,31 @@ return ret; } -int PHPMsessionSetData(const char *session, const char *data) +int PHPMsessionSetData(const char *session, const char *data TSRMLS_DC) { - IFCONNECT_BEGIN int ret=0; FormatRequest(&s_reqb, REQ_DATASET, session,"",data,0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); ret = (s_reqb->req.stat==REQ_OK); if(s_reqb->req.stat!=REQ_OK) - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); return ret; IFCONNECT_ENDVAL(0) } - -int PHPMsessionDestroy(const char *session) +int PHPMsessionDestroy(const char *session TSRMLS_DC) { IFCONNECT_BEGIN int ret=0; FormatRequest(&s_reqb, REQ_DROP, session, "","",0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); ret = (s_reqb->req.stat==REQ_OK); if(s_reqb->req.stat!=REQ_OK) - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); return ret; IFCONNECT_ENDVAL(0) @@ -330,7 +402,7 @@ } else { - php_error(E_WARNING, "MSession connect failed"); + php_error(E_WARNING, "%s(): MSession connect failed", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -353,7 +425,7 @@ int count; FormatRequest(&s_reqb, REQ_COUNT, "", "","",0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); count = (s_reqb->req.stat == REQ_OK) ? s_reqb->req.param : 0; @@ -379,14 +451,14 @@ convert_to_string_ex(session); szsession = Z_STRVAL_PP(session); FormatRequest(&s_reqb, REQ_CREATE, szsession, "","",0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat==REQ_OK) { RETURN_TRUE; } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_FALSE; } IFCONNECT_END @@ -405,7 +477,7 @@ } convert_to_string_ex(session); szsession = Z_STRVAL_PP(session); - PHPMsessionDestroy(szsession); + PHPMsessionDestroy(szsession TSRMLS_CC); RETURN_TRUE; } @@ -426,7 +498,7 @@ convert_to_string_ex(session); szsession = Z_STRVAL_PP(session); FormatRequest(&s_reqb, REQ_SLOCK, szsession, "","",0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -434,7 +506,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_FALSE; } @@ -496,7 +568,7 @@ } } FormatRequest(&s_reqb, REQ_CTL, szsession, "","",fn); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -534,7 +606,7 @@ convert_to_long_ex(key); lkey = Z_LVAL_PP(key); FormatRequest(&s_reqb, REQ_SUNLOCK, szsession, "","",lkey); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -542,7 +614,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_FALSE; } IFCONNECT_END @@ -575,7 +647,7 @@ szvalue = Z_STRVAL_PP(value); FormatRequest(&s_reqb, REQ_SETVAL, szsession, szname, szvalue, 0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -583,7 +655,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_FALSE; } IFCONNECT_END @@ -614,7 +686,7 @@ szvalue = Z_STRVAL_PP(value); FormatRequest(&s_reqb, REQ_GETVAL, szsession, szname, szvalue,0); - DoRequest(s_conn, &s_reqb); + PHPDoRequest(&s_conn, &s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -623,7 +695,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_NULL(); } IFCONNECT_END @@ -647,7 +719,7 @@ val = Z_LVAL_PP(param); FormatRequest(&s_reqb, REQ_UNIQ,"", "", "",val); - DoRequest(s_conn, &s_reqb); + PHPDoRequest(&s_conn, &s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -656,7 +728,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_NULL(); } IFCONNECT_END @@ -680,7 +752,7 @@ val = Z_LVAL_PP(param); FormatRequest(&s_reqb, REQ_RANDSTR,"", "", "",val); - DoRequest(s_conn, &s_reqb); + PHPDoRequest(&s_conn, &s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -689,7 +761,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_NULL(); } IFCONNECT_END @@ -717,7 +789,7 @@ szvalue = Z_STRVAL_PP(value); FormatRequest(&s_reqb, REQ_FIND, "", szname, szvalue,0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat==REQ_OK && s_reqb->req.param) { @@ -735,7 +807,7 @@ } else if(s_reqb->req.stat != REQ_OK) { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_NULL(); } IFCONNECT_END @@ -748,7 +820,7 @@ { IFCONNECT_BEGIN FormatRequest(&s_reqb, REQ_LIST, "", "", "",0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat==REQ_OK && s_reqb->req.param) { @@ -768,7 +840,7 @@ { // May this should be an error? if(s_reqb->req.param != REQE_NOSESSION) - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_NULL(); } IFCONNECT_END @@ -789,7 +861,7 @@ convert_to_string_ex(session); szsession = Z_STRVAL_PP(session); FormatRequest(&s_reqb, REQ_GETALL, szsession, "", "",0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); array_init(return_value); @@ -819,7 +891,7 @@ else { if(s_reqb->req.param != REQE_NOSESSION) - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_NULL(); } IFCONNECT_END @@ -902,10 +974,10 @@ ELOG("FormatMulti"); FormatRequestMulti(&s_reqb, REQ_SETVAL, Z_STRVAL_PP(session), countpair, pairs,0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat != REQ_OK) - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); efree((void *)pairs); IFCONNECT_END } @@ -923,7 +995,7 @@ } convert_to_string_ex(name); FormatRequest(&s_reqb, REQ_LISTVAR, "", Z_STRVAL_PP(name), "",0); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); array_init(return_value); @@ -952,7 +1024,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_NULL(); } IFCONNECT_END @@ -985,7 +1057,7 @@ } convert_to_string_ex(session); FormatRequest(&s_reqb, REQ_TIMEOUT, Z_STRVAL_PP(session), "","",timeout); - DoRequest(s_conn,&s_reqb); + PHPDoRequest(&s_conn,&s_reqb); if(s_reqb->req.stat == REQ_OK) { @@ -993,7 +1065,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_NULL(); } IFCONNECT_END @@ -1017,7 +1089,7 @@ convert_to_string_ex(name); FormatRequest(&s_reqb, REQ_INC, Z_STRVAL_PP(session), Z_STRVAL_PP(name),0,0); - DoRequest(s_conn, &s_reqb); + PHPDoRequest(&s_conn, &s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -1026,7 +1098,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_FALSE; } IFCONNECT_END @@ -1047,7 +1119,7 @@ } convert_to_string_ex(session); - val = PHPMsessionGetData(Z_STRVAL_PP(session)); + val = PHPMsessionGetData(Z_STRVAL_PP(session) TSRMLS_CC); if(val) { @@ -1076,7 +1148,7 @@ convert_to_string_ex(session); convert_to_string_ex(value); - if(PHPMsessionSetData(Z_STRVAL_PP(session),Z_STRVAL_PP(value))) + if(PHPMsessionSetData(Z_STRVAL_PP(session), Z_STRVAL_PP(value) TSRMLS_CC)) { RETURN_TRUE; } @@ -1122,7 +1194,7 @@ ret = atoi(Z_STRVAL_PP(val)); FormatRequest(&s_reqb, REQ_PLUGIN, Z_STRVAL_PP(session), Z_STRVAL_PP(val), param ? Z_STRVAL_PP(param) : "",ret); - DoRequest(s_conn, &s_reqb); + PHPDoRequest(&s_conn, &s_reqb); if(s_reqb->req.stat==REQ_OK && s_reqb->req.len) { @@ -1131,7 +1203,7 @@ } else if(s_reqb->req.stat != REQ_OK) { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_FALSE; } @@ -1172,7 +1244,7 @@ } FormatRequestStrings(&s_reqb, REQ_CALL, NULL , n, strings); - DoRequest(s_conn, &s_reqb); + PHPDoRequest(&s_conn, &s_reqb); if(s_reqb->req.stat==REQ_OK && s_reqb->req.len) { @@ -1181,7 +1253,7 @@ } else if(s_reqb->req.stat != REQ_OK) { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); RETURN_FALSE; } IFCONNECT_END @@ -1192,9 +1264,28 @@ PS_OPEN_FUNC(msession) { + int port; + int len = strlen(save_path)+1; + char * path = alloca(len); + char * szport; + + strcpy(path, save_path); + + szport = strchr(path, ':'); + + if(szport) + { + *szport++=0; + port = atoi(szport); + } + else + { + port = s_port; + } + ELOG( "ps_open_msession"); PS_SET_MOD_DATA((void *)1); // session.c needs a non-zero here! - return PHPMsessionConnect(save_path, 8086) ? SUCCESS : FAILURE; + return PHPMsessionConnect(path, port) ? SUCCESS : FAILURE; } PS_CLOSE_FUNC(msession) @@ -1207,7 +1298,7 @@ PS_READ_FUNC(msession) { ELOG( "ps_read_msession"); - *val = PHPMsessionGetData(key); + *val = PHPMsessionGetData(key TSRMLS_CC); if(*val) { *vallen = strlen(*val); @@ -1224,13 +1315,13 @@ PS_WRITE_FUNC(msession) { ELOG( "ps_write_msession"); - return (PHPMsessionSetData(key,val)) ? SUCCESS : FAILURE; + return (PHPMsessionSetData(key, val TSRMLS_CC)) ? SUCCESS : FAILURE; } PS_DESTROY_FUNC(msession) { ELOG( "ps_destroy_msession"); - return (PHPMsessionDestroy(key)) ? SUCCESS : FAILURE; + return (PHPMsessionDestroy(key TSRMLS_CC)) ? SUCCESS : FAILURE; } PS_GC_FUNC(msession) @@ -1246,7 +1337,7 @@ { ELOG("Should create a new session"); FormatRequest(&s_reqb, REQ_UNIQ,"", "", "",SID_LEN); - DoRequest(s_conn, &s_reqb); + PHPDoRequest(&s_conn, &s_reqb); if(s_reqb->req.stat==REQ_OK) { @@ -1256,7 +1347,7 @@ } else { - php_error(E_WARNING, s_szErrFmt, ReqbErr(s_reqb)); + php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); } } ELOG("Yikes, could not get sid from msession"); 1.2.2.1 +6 -3 php4/ext/msession/reqclient.h Index: reqclient.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/msession/reqclient.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- reqclient.h 29 Apr 2002 02:30:52 -0000 1.2 +++ reqclient.h 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -58,9 +58,6 @@ REQ_SERIALIZE, REQ_LAST, REQ_INTERNAL_BEGIN=1023, - REQ_POPEN, - REQ_PCLOSE, - REQ_LOADDLL, REQ_INTERNALLAST, }; enum REQ_ERRORS @@ -83,6 +80,10 @@ REQE_UNKNOWN }; +#define REQ_POPEN 1024 +#define REQ_PCLOSE 1025 +#define REQ_PING 1026 + typedef struct _requestPacket { int version; @@ -136,6 +137,8 @@ int DoSingleRequest(char *hostname, int port, REQB **preq); void *OpenReqConn(char *hostname, int port); void CloseReqConn(void *conn); +void DeleteReqConn(void *conn); +unsigned char ReopenReqConn(void *conn); int DoRequest(void *conn, REQB **preq); char *ReqbErr(REQB *reqb); No revision No revision 1.2.2.1 +14 -14 php4/ext/msql/php_msql.c Index: php_msql.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/msql/php_msql.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_msql.c 29 Apr 2002 02:30:52 -0000 1.2 +++ php_msql.c 9 Jul 2002 09:14:35 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_msql.c,v 1.48 2002/03/12 20:17:48 andi Exp $ */ +/* $Id: php_msql.c,v 1.49 2002/06/26 08:39:36 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -267,12 +267,12 @@ list_entry *le; if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) { - php_error(E_WARNING,"mSQL: Too many open links (%d)",msql_globals.num_links); + php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), msql_globals.num_links); efree(hashed_details); RETURN_FALSE; } if (msql_globals.max_persistent!=-1 && msql_globals.num_persistent>=msql_globals.max_persistent) { - php_error(E_WARNING,"mSQL: Too many open persistent links (%d)",msql_globals.num_persistent); + php_error(E_WARNING, "%s(): Too many open persistent links (%d)", get_active_function_name(TSRMLS_C), msql_globals.num_persistent); efree(hashed_details); RETURN_FALSE; } @@ -343,7 +343,7 @@ } } if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) { - php_error(E_WARNING,"mSQL: Too many open links (%d)",msql_globals.num_links); + php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C),msql_globals.num_links); efree(hashed_details); RETURN_FALSE; } @@ -655,7 +655,7 @@ ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); if ((msql_result=msqlListDBs(msql))==NULL) { - php_error(E_WARNING,"Unable to save mSQL query result"); + php_error(E_WARNING, "%s(): Unable to save mSQL query result", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query); @@ -696,7 +696,7 @@ RETURN_FALSE; } if ((msql_result=msqlListTables(msql))==NULL) { - php_error(E_WARNING,"Unable to save mSQL query result"); + php_error(E_WARNING, "%s(): Unable to save mSQL query result", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query); @@ -738,7 +738,7 @@ } convert_to_string(table); if ((msql_result=msqlListFields(msql,Z_STRVAL_P(table)))==NULL) { - php_error(E_WARNING,"Unable to save mSQL query result"); + php_error(E_WARNING, "%s(): Unable to save mSQL query result", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query); @@ -786,7 +786,7 @@ convert_to_long(row); if (Z_LVAL_P(row)<0 || Z_LVAL_P(row)>=msqlNumRows(msql_result)) { - php_error(E_WARNING,"Unable to jump to row %d on mSQL query index %d",Z_LVAL_P(row),Z_LVAL_P(result)); + php_error(E_WARNING, "%s(): Unable to jump to row %d on mSQL query index %d", get_active_function_name(TSRMLS_C),Z_LVAL_P(row),Z_LVAL_P(result)); RETURN_FALSE; } msqlDataSeek(msql_result,Z_LVAL_P(row)); @@ -818,7 +818,7 @@ i++; } if (!tmp_field) { /* no match found */ - php_error(E_WARNING,"%s%s%s not found in mSQL query index %d", + php_error(E_WARNING, "%s(): %s%s%s not found in mSQL query index %d", get_active_function_name(TSRMLS_C), (table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_P(result)); efree(field_name); if (table_name) { @@ -836,7 +836,7 @@ convert_to_long(field); field_offset = Z_LVAL_P(field); if (field_offset<0 || field_offset>=msqlNumFields(msql_result)) { - php_error(E_WARNING,"Bad column offset specified"); + php_error(E_WARNING, "%s(): Bad column offset specified", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } break; @@ -1012,7 +1012,7 @@ if (!msql_result || Z_LVAL_P(offset)<0 || Z_LVAL_P(offset)>=msqlNumRows(msql_result)) { - php_error(E_WARNING,"Offset %d is invalid for mSQL query index %d",Z_LVAL_P(offset),Z_LVAL_P(result)); + php_error(E_WARNING, "%s(): %d is invalid for mSQL query index %d", get_active_function_name(TSRMLS_C),Z_LVAL_P(offset),Z_LVAL_P(result)); RETURN_FALSE; } msqlDataSeek(msql_result,Z_LVAL_P(offset)); @@ -1089,7 +1089,7 @@ if (field) { if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumRows(msql_result)) { - php_error(E_NOTICE,"mSQL: Bad field offset specified"); + php_error(E_NOTICE, "%s(): Bad field offset specified", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } msqlFieldSeek(msql_result,Z_LVAL_P(field)); @@ -1132,7 +1132,7 @@ RETURN_FALSE; } if (Z_LVAL_P(offset)<0 || Z_LVAL_P(offset)>=msqlNumFields(msql_result)) { - php_error(E_WARNING,"Field %d is invalid for mSQL query index %d", + php_error(E_WARNING,"%s(): Field %d is invalid for mSQL query index %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(offset),Z_LVAL_P(result)); RETURN_FALSE; } @@ -1166,7 +1166,7 @@ } convert_to_long(field); if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumFields(msql_result)) { - php_error(E_WARNING,"Field %d is invalid for mSQL query index %d",Z_LVAL_P(field),Z_LVAL_P(result)); + php_error(E_WARNING,"%s(): Field %d is invalid for mSQL query index %d", get_active_function_name(TSRMLS_C),Z_LVAL_P(field),Z_LVAL_P(result)); RETURN_FALSE; } msqlFieldSeek(msql_result,Z_LVAL_P(field)); No revision No revision 1.2.2.2 +38 -36 php4/ext/mssql/php_mssql.c Index: php_mssql.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mssql/php_mssql.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_mssql.c 19 May 2002 11:16:04 -0000 1.2.2.1 +++ php_mssql.c 9 Jul 2002 09:14:35 -0000 1.2.2.2 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mssql.c,v 1.83 2002/05/15 18:07:17 fmk Exp $ */ +/* $Id: php_mssql.c,v 1.85 2002/06/26 08:32:25 derick Exp $ */ #ifdef COMPILE_DL_MSSQL #define HAVE_MSSQL 1 @@ -101,7 +101,7 @@ ZEND_GET_MODULE(mssql) #endif -#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"MS SQL: A link to the server could not be established"); RETURN_FALSE; } } +#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "%s(): A link to the server could not be established", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } static PHP_INI_DISP(display_text_size) { @@ -137,6 +137,7 @@ STD_PHP_INI_ENTRY_EX("mssql.batchsize", "0", PHP_INI_ALL, OnUpdateInt, batchsize, zend_mssql_globals, mssql_globals, display_link_numbers) STD_PHP_INI_BOOLEAN("mssql.datetimeconvert", "1", PHP_INI_ALL, OnUpdateBool, datetimeconvert, zend_mssql_globals, mssql_globals) STD_PHP_INI_BOOLEAN("mssql.secure_connection", "0", PHP_INI_SYSTEM, OnUpdateBool, secure_connection, zend_mssql_globals, mssql_globals) + STD_PHP_INI_ENTRY_EX("mssql.max_procs", "25", PHP_INI_ALL, OnUpdateInt, max_procs, zend_mssql_globals, mssql_globals, display_link_numbers) PHP_INI_END() /* error handler */ @@ -145,7 +146,7 @@ TSRMLS_FETCH(); if (severity >= MS_SQL_G(min_error_severity)) { - php_error(E_WARNING,"MS SQL error: %s (severity %d)", dberrstr, severity); + php_error(E_WARNING,"%s(): %s (severity %d)", get_active_function_name(TSRMLS_C), dberrstr, severity); } return INT_CANCEL; } @@ -156,7 +157,7 @@ TSRMLS_FETCH(); if (severity >= MS_SQL_G(min_message_severity)) { - php_error(E_WARNING,"MS SQL message: %s (severity %d)", msgtext, severity); + php_error(E_WARNING,"%s(): message: %s (severity %d)", get_active_function_name(TSRMLS_C), msgtext, severity); } if (MS_SQL_G(server_message)) { STR_FREE(MS_SQL_G(server_message)); @@ -330,6 +331,7 @@ dbsetlogintime(MS_SQL_G(connect_timeout)); if (MS_SQL_G(timeout) < 0) MS_SQL_G(timeout) = 60; dbsettime(MS_SQL_G(timeout)); + dbsetmaxprocs((SHORT)MS_SQL_G(max_procs)); return SUCCESS; } @@ -430,13 +432,13 @@ } if (hashed_details == NULL) { - php_error(E_WARNING, "Out of memory"); + php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } /* set a DBLOGIN record */ if ((mssql.login = dblogin()) == NULL) { - php_error(E_WARNING,"MS SQL: Unable to allocate login record"); + php_error(E_WARNING,"%s(): Unable to allocate login record", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -471,20 +473,20 @@ list_entry new_le; if (MS_SQL_G(max_links) != -1 && MS_SQL_G(num_links) >= MS_SQL_G(max_links)) { - php_error(E_WARNING,"MS SQL: Too many open links (%d)",MS_SQL_G(num_links)); + php_error(E_WARNING,"%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), MS_SQL_G(num_links)); efree(hashed_details); dbfreelogin(mssql.login); RETURN_FALSE; } if (MS_SQL_G(max_persistent) != -1 && MS_SQL_G(num_persistent) >= MS_SQL_G(max_persistent)) { - php_error(E_WARNING,"MS SQL: Too many open persistent links (%d)",MS_SQL_G(num_persistent)); + php_error(E_WARNING,"%s(): Too many open persistent links (%d)", get_active_function_name(TSRMLS_C), MS_SQL_G(num_persistent)); efree(hashed_details); dbfreelogin(mssql.login); RETURN_FALSE; } /* create the link */ if ((mssql.link = dbopen(mssql.login, host)) == FAIL) { - php_error(E_WARNING,"MS SQL: Unable to connect to server: %s", host); + php_error(E_WARNING,"%s(): Unable to connect to server: %s", get_active_function_name(TSRMLS_C), host); efree(hashed_details); dbfreelogin(mssql.login); RETURN_FALSE; @@ -530,7 +532,7 @@ #if BROKEN_MSSQL_PCONNECTS log_error("PHP/MS SQL: Hashed persistent link is not a MS SQL link!",php_rqst->server); #endif - php_error(E_WARNING,"MS SQL: Hashed persistent link is not a MS SQL link!"); + php_error(E_WARNING, "%s(): Hashed persistent link is not a MS SQL link!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -544,7 +546,7 @@ #if BROKEN_MSSQL_PCONNECTS log_error("PHP/MS SQL: Unable to reconnect!",php_rqst->server); #endif - php_error(E_WARNING,"MS SQL: Link to server lost, unable to reconnect"); + php_error(E_WARNING, "%s(): Link to server lost, unable to reconnect", get_active_function_name(TSRMLS_C)); zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1); efree(hashed_details); RETURN_FALSE; @@ -592,13 +594,13 @@ } } if (MS_SQL_G(max_links) != -1 && MS_SQL_G(num_links) >= MS_SQL_G(max_links)) { - php_error(E_WARNING,"MS SQL: Too many open links (%d)",MS_SQL_G(num_links)); + php_error(E_WARNING,"%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), MS_SQL_G(num_links)); efree(hashed_details); RETURN_FALSE; } if ((mssql.link=dbopen(mssql.login, host))==NULL) { - php_error(E_WARNING,"MS SQL: Unable to connect to server: %s", host); + php_error(E_WARNING,"%s(): Unable to connect to server: %s", get_active_function_name(TSRMLS_C), host); efree(hashed_details); RETURN_FALSE; } @@ -738,7 +740,7 @@ convert_to_string_ex(db); if (dbuse(mssql_ptr->link, Z_STRVAL_PP(db))==FAIL) { - php_error(E_WARNING,"MS SQL: Unable to select database: %s", Z_STRVAL_PP(db)); + php_error(E_WARNING, "%s(): Unable to select database: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(db)); RETURN_FALSE; } else { RETURN_TRUE; @@ -829,7 +831,7 @@ Z_STRLEN_P(result) = res_length; Z_TYPE_P(result) = IS_STRING; } else { - php_error(E_WARNING,"MS SQL: column %d has unknown data type (%d)", offset, coltype(offset)); + php_error(E_WARNING, "%s(): column %d has unknown data type (%d)", get_active_function_name(TSRMLS_C), offset, coltype(offset)); ZVAL_FALSE(result); } } @@ -883,7 +885,7 @@ Z_STRLEN_P(result) = res_length; Z_TYPE_P(result) = IS_STRING; } else { - php_error(E_WARNING,"MS SQL: column %d has unknown data type (%d)", offset, coltype(offset)); + php_error(E_WARNING, "%s(): column %d has unknown data type (%d)", get_active_function_name(TSRMLS_C), offset, coltype(offset)); ZVAL_FALSE(result); } } @@ -1034,11 +1036,11 @@ convert_to_string_ex(query); if (dbcmd(mssql_ptr->link, Z_STRVAL_PP(query))==FAIL) { - php_error(E_WARNING,"MS SQL: Unable to set query"); + php_error(E_WARNING, "%s(): Unable to set query", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (dbsqlexec(mssql_ptr->link)==FAIL || dbresults(mssql_ptr->link)==FAIL) { - php_error(E_WARNING,"MS SQL: Query failed"); + php_error(E_WARNING, "%s(): Query failed", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1316,7 +1318,7 @@ convert_to_long_ex(offset); if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=result->num_rows) { - php_error(E_WARNING,"MS SQL: Bad row offset"); + php_error(E_WARNING, "%s(): Bad row offset", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1412,7 +1414,7 @@ if (field_offset<0 || field_offset >= result->num_fields) { if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */ - php_error(E_WARNING,"MS SQL: Bad column offset"); + php_error(E_WARNING, "%s(): Bad column offset", get_active_function_name(TSRMLS_C)); } RETURN_FALSE; } @@ -1465,7 +1467,7 @@ if (field_offset<0 || field_offset >= result->num_fields) { if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */ - php_error(E_WARNING,"MS SQL: Bad column offset"); + php_error(E_WARNING, "%s(): Bad column offset", get_active_function_name(TSRMLS_C)); } RETURN_FALSE; } @@ -1512,7 +1514,7 @@ if (field_offset<0 || field_offset >= result->num_fields) { if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */ - php_error(E_WARNING,"MS SQL: Bad column offset"); + php_error(E_WARNING, "%s(): Bad column offset", get_active_function_name(TSRMLS_C)); } RETURN_FALSE; } @@ -1560,7 +1562,7 @@ if (field_offset<0 || field_offset >= result->num_fields) { if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */ - php_error(E_WARNING,"MS SQL: Bad column offset"); + php_error(E_WARNING, "%s(): Bad column offset", get_active_function_name(TSRMLS_C)); } RETURN_FALSE; } @@ -1590,7 +1592,7 @@ field_offset = Z_LVAL_PP(offset); if (field_offset<0 || field_offset >= result->num_fields) { - php_error(E_WARNING,"MS SQL: Bad column offset"); + php_error(E_WARNING, "%s(): Bad column offset", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1616,7 +1618,7 @@ convert_to_long_ex(row); if (Z_LVAL_PP(row) < 0 || Z_LVAL_PP(row) >= result->num_rows) { - php_error(E_WARNING,"MS SQL: Bad row offset (%d)", Z_LVAL_PP(row)); + php_error(E_WARNING, "%s(): Bad row offset (%d)", get_active_function_name(TSRMLS_C), Z_LVAL_PP(row)); RETURN_FALSE; } @@ -1631,7 +1633,7 @@ } } if (i>=result->num_fields) { /* no match found */ - php_error(E_WARNING,"MS SQL: %s field not found in result", Z_STRVAL_PP(field)); + php_error(E_WARNING,"%s(): %s field not found in result", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(field)); RETURN_FALSE; } break; @@ -1640,7 +1642,7 @@ convert_to_long_ex(field); field_offset = Z_LVAL_PP(field); if (field_offset<0 || field_offset>=result->num_fields) { - php_error(E_WARNING,"MS SQL: Bad column offset specified"); + php_error(E_WARNING, "%s(): Bad column offset specified", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } break; @@ -1751,7 +1753,7 @@ convert_to_string_ex(sp_name); if (dbrpcinit(mssql_ptr->link, Z_STRVAL_PP(sp_name),0)==FAIL) { - php_error(E_WARNING,"MS SQL: unable to init stored procedure"); + php_error(E_WARNING, "%s(): unable to init stored procedure", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1763,7 +1765,7 @@ statement->executed=FALSE; } else { - php_error(E_WARNING,"mssql_init: unable to allocate statement"); + php_error(E_WARNING, "%s(): unable to allocate statement", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1900,7 +1902,7 @@ break; default: - php_error(E_WARNING,"mssql_bind: unsupported type"); + php_error(E_WARNING, "%s(): unsupported type", get_active_function_name(TSRMLS_C)); RETURN_FALSE; break; } @@ -1926,7 +1928,7 @@ /* no call to dbrpcparam if RETVAL */ if ( strcmp("RETVAL",Z_STRVAL_PP(param_name))!=0 ) { if (dbrpcparam(mssql_ptr->link, Z_STRVAL_PP(param_name), (BYTE)status, type, maxlen, datalen, (LPCBYTE)value)==FAIL) { - php_error(E_WARNING,"MS SQL: Unable to set parameter"); + php_error(E_WARNING, "%s(): Unable to set parameter", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -1962,14 +1964,14 @@ mssql_ptr=statement->link; if (dbrpcexec(mssql_ptr->link)==FAIL || dbsqlok(mssql_ptr->link)==FAIL) { - php_error(E_WARNING,"MS SQL: stored procedure execution failed."); + php_error(E_WARNING, "%s(): stored procedure execution failed.", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } retval_results=dbresults(mssql_ptr->link); if (retval_results==FAIL) { - php_error(E_WARNING,"MS SQL: could not retrieve results"); + php_error(E_WARNING, "%s(): could not retrieve results", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -2002,7 +2004,7 @@ } if (retval_results==SUCCEED) { - php_error(E_WARNING,"mssql_execute: multiple recordsets from a stored procedure not supported yet! (Skipping...)"); + php_error(E_WARNING, "%s(): multiple recordsets from a stored procedure not supported yet! (Skipping...)", get_active_function_name(TSRMLS_C)); retval_results=dbresults(mssql_ptr->link); while (retval_results==SUCCEED) { @@ -2046,7 +2048,7 @@ } } else { - php_error(E_WARNING,"mssql_execute: an output parameter variable was not provided"); + php_error(E_WARNING, "%s(): an output parameter variable was not provided", get_active_function_name(TSRMLS_C)); } } } @@ -2059,7 +2061,7 @@ Z_LVAL_P(bind->zval)=dbretstatus(mssql_ptr->link); } else { - php_error(E_WARNING,"mssql_execute: stored procedure has no return value. Nothing was returned into RETVAL"); + php_error(E_WARNING, "%s(): stored procedure has no return value. Nothing was returned into RETVAL", get_active_function_name(TSRMLS_C)); } } } 1.2.2.2 +2 -1 php4/ext/mssql/php_mssql.h Index: php_mssql.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mssql/php_mssql.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_mssql.h 19 May 2002 11:16:04 -0000 1.2.2.1 +++ php_mssql.h 9 Jul 2002 09:14:35 -0000 1.2.2.2 @@ -17,7 +17,7 @@ */ -/* $Id: php_mssql.h,v 1.22 2002/05/14 23:57:43 fmk Exp $ */ +/* $Id: php_mssql.h,v 1.23 2002/06/10 19:31:29 fmk Exp $ */ #ifndef PHP_MSSQL_H #define PHP_MSSQL_H @@ -121,6 +121,7 @@ long datetimeconvert; HashTable *resource_list, *resource_plist; long secure_connection; + long max_procs; ZEND_END_MODULE_GLOBALS(mssql) #define MSSQL_ROWS_BLOCK 128 No revision No revision 1.2.2.1 +31 -15 php4/ext/mysql/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:52 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.45 2002/04/27 01:02:52 sniper Exp $ +dnl $Id: config.m4,v 1.51 2002/06/11 00:18:34 sniper Exp $ dnl sinclude(ext/mysql/libmysql/acinclude.m4) @@ -7,7 +7,7 @@ sinclude(libmysql/acinclude.m4) sinclude(libmysql/mysql.m4) -AC_DEFUN(MYSQL_LIB_CHK,[ +AC_DEFUN(MYSQL_LIB_CHK, [ str="$MYSQL_DIR/$1/libmysqlclient.*" for j in `echo $str`; do if test -r $j; then @@ -16,33 +16,49 @@ fi done ]) - -AC_DEFUN(PHP_MYSQL_SOCK,[ - AC_MSG_CHECKING(for MySQL UNIX socket) - MYSQL_SOCK=/tmp/mysql.sock + +AC_DEFUN(PHP_MYSQL_SOCKET_SEARCH, [ for i in \ - /var/run/mysqld/mysqld.sock \ - /var/tmp/mysql.sock \ - /var/run/mysql/mysql.sock \ - /var/lib/mysql/mysql.sock \ - /var/mysql/mysql.sock \ - /Private/tmp/mysql.sock \ - ; do + /var/run/mysqld/mysqld.sock \ + /var/tmp/mysql.sock \ + /var/run/mysql/mysql.sock \ + /var/lib/mysql/mysql.sock \ + /var/mysql/mysql.sock \ + /usr/local/mysql/var/mysql.sock \ + /Private/tmp/mysql.sock \ + /tmp/mysql.sock \ + ; do if test -r $i; then MYSQL_SOCK=$i + break 2 fi done + AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ]) - AC_MSG_RESULT($MYSQL_SOCK) + AC_MSG_RESULT([$MYSQL_SOCK]) ]) + PHP_ARG_WITH(mysql, for MySQL support, [ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base directory. If unspecified, the bundled MySQL library will be used.], yes) +PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket, +[ --with-mysql-sock[=DIR] Location of the MySQL unix socket pointer. + If unspecified, the default locations are searched.]) + + if test "$PHP_MYSQL" != "no"; then - PHP_MYSQL_SOCK AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL]) + + AC_MSG_CHECKING(for MySQL UNIX socket location) + if test "$PHP_MYSQL_SOCK" != "no"; then + MYSQL_SOCK=$PHP_MYSQL_SOCK + AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ]) + AC_MSG_RESULT([$MYSQL_SOCK]) + else + PHP_MYSQL_SOCKET_SEARCH + fi fi if test "$PHP_MYSQL" = "yes"; then 1.2.2.3 +23 -23 php4/ext/mysql/php_mysql.c Index: php_mysql.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/php_mysql.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- php_mysql.c 9 May 2002 04:17:00 -0000 1.2.2.2 +++ php_mysql.c 9 Jul 2002 09:14:36 -0000 1.2.2.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mysql.c,v 1.136 2002/05/08 07:38:09 zak Exp $ */ +/* $Id: php_mysql.c,v 1.137 2002/06/26 08:07:59 derick Exp $ */ /* TODO: @@ -221,7 +221,7 @@ void timeout(int sig); -#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "MySQL: A link to the server could not be established"); RETURN_FALSE; } } +#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "%s(): A link to the server could not be established", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } /* {{{ _free_mysql_result * This wrapper is required since mysql_free_result() returns an integer, and @@ -450,7 +450,7 @@ if (PG(sql_safe_mode)) { if (ZEND_NUM_ARGS()>0) { - php_error(E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information"); + php_error(E_NOTICE, "%s(): SQL safe mode in effect - ignoring host/user/password information", get_active_function_name(TSRMLS_C)); } host_and_port=passwd=NULL; user=php_get_current_user(); @@ -559,12 +559,12 @@ list_entry new_le; if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) { - php_error(E_WARNING, "MySQL: Too many open links (%d)", MySG(num_links)); + php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), MySG(num_links)); efree(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } if (MySG(max_persistent)!=-1 && MySG(num_persistent)>=MySG(max_persistent)) { - php_error(E_WARNING, "MySQL: Too many open persistent links (%d)", MySG(num_persistent)); + php_error(E_WARNING, "%s(): Too many open persistent links (%d)", get_active_function_name(TSRMLS_C), MySG(num_persistent)); efree(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } @@ -580,7 +580,7 @@ /* Populate connect error globals so that the error functions can read them */ if (MySG(connect_error)!=NULL) efree(MySG(connect_error)); MySG(connect_error)=estrdup(mysql_error(&mysql->conn)); - php_error(E_WARNING, "%s", MySG(connect_error)); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), MySG(connect_error)); #if defined(HAVE_MYSQL_ERRNO) MySG(connect_errno)=mysql_errno(&mysql->conn); #endif @@ -617,7 +617,7 @@ #else if (mysql_connect(le->ptr, host, user, passwd)==NULL) { #endif - php_error(E_WARNING, "MySQL: Link to server lost, unable to reconnect"); + php_error(E_WARNING, "%s: Link to server lost, unable to reconnect", get_active_function_name(TSRMLS_C)); zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1); efree(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); @@ -657,7 +657,7 @@ } } if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) { - php_error(E_WARNING, "MySQL: Too many open links (%d)", MySG(num_links)); + php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), MySG(num_links)); efree(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } @@ -673,11 +673,11 @@ /* Populate connect error globals so that the error functions can read them */ if (MySG(connect_error)!=NULL) efree(MySG(connect_error)); MySG(connect_error)=estrdup(mysql_error(&mysql->conn)); - php_error(E_WARNING, "%s", MySG(connect_error)); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), MySG(connect_error)); #if defined(HAVE_MYSQL_ERRNO) MySG(connect_errno)=mysql_errno(&mysql->conn); #endif - php_error(E_WARNING, "MySQL Connection Failed: %s\n", mysql_error(&mysql->conn)); + php_error(E_WARNING, "%s(): MySQL Connection Failed: %s\n", get_active_function_name(TSRMLS_C), mysql_error(&mysql->conn)); efree(hashed_details); efree(mysql); MYSQL_DO_CONNECT_RETURN_FALSE(); @@ -1133,7 +1133,7 @@ mysql_result = (MYSQL_RES *) zend_list_find(mysql->active_result_id, &type); if (mysql_result && type==le_result) { if (!mysql_eof(mysql_result)) { - php_error(E_NOTICE, "Called %s() without first fetching all rows from a previous unbuffered query", + php_error(E_NOTICE, "%s(): Function called without first fetching all rows from a previous unbuffered query", get_active_function_name(TSRMLS_C)); while (mysql_fetch_row(mysql_result)); } @@ -1160,7 +1160,7 @@ } if (!mysql_result) { if (PHP_MYSQL_VALID_RESULT(&mysql->conn)) { /* query should have returned rows */ - php_error(E_WARNING, "MySQL: Unable to save result set"); + php_error(E_WARNING, "%s(): Unable to save result set", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } else { RETURN_TRUE; @@ -1281,7 +1281,7 @@ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); if ((mysql_result=mysql_list_dbs(&mysql->conn, NULL))==NULL) { - php_error(E_WARNING, "Unable to save MySQL query result"); + php_error(E_WARNING, "%s(): Unable to save MySQL query result", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result); @@ -1324,7 +1324,7 @@ RETURN_FALSE; } if ((mysql_result=mysql_list_tables(&mysql->conn, NULL))==NULL) { - php_error(E_WARNING, "Unable to save MySQL query result"); + php_error(E_WARNING, "%s(): Unable to save MySQL query result", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result); @@ -1368,7 +1368,7 @@ } convert_to_string_ex(table); if ((mysql_result=mysql_list_fields(&mysql->conn, Z_STRVAL_PP(table), NULL))==NULL) { - php_error(E_WARNING, "Unable to save MySQL query result"); + php_error(E_WARNING, "%s(): Unable to save MySQL query result", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result); @@ -1397,7 +1397,7 @@ mysql_result = mysql_list_processes(&mysql->conn); if (mysql_result == NULL) { - php_error(E_WARNING, "Unable to save MySQL query result"); + php_error(E_WARNING, "%s(): Unable to save MySQL query result", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1628,7 +1628,7 @@ convert_to_long_ex(row); if (Z_LVAL_PP(row)<0 || Z_LVAL_PP(row)>=(int)mysql_num_rows(mysql_result)) { - php_error(E_WARNING, "Unable to jump to row %d on MySQL result index %d", Z_LVAL_PP(row), Z_LVAL_PP(result)); + php_error(E_WARNING, "%s(): Unable to jump to row %d on MySQL result index %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(row), Z_LVAL_PP(result)); RETURN_FALSE; } mysql_data_seek(mysql_result, Z_LVAL_PP(row)); @@ -1660,7 +1660,7 @@ i++; } if (!tmp_field) { /* no match found */ - php_error(E_WARNING, "%s%s%s not found in MySQL result index %d", + php_error(E_WARNING, "%s(): %s%s%s not found in MySQL result index %d", get_active_function_name(TSRMLS_C), (table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_PP(result)); efree(field_name); if (table_name) { @@ -1678,7 +1678,7 @@ convert_to_long_ex(field); field_offset = Z_LVAL_PP(field); if (field_offset<0 || field_offset>=(int)mysql_num_fields(mysql_result)) { - php_error(E_WARNING, "Bad column offset specified"); + php_error(E_WARNING, "%s(): Bad column offset specified", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } break; @@ -1880,7 +1880,7 @@ convert_to_long_ex(offset); if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=(int)mysql_num_rows(mysql_result)) { - php_error(E_WARNING, "Offset %d is invalid for MySQL result index %d (or the query data is unbuffered)", Z_LVAL_PP(offset), Z_LVAL_PP(result)); + php_error(E_WARNING, "%s(): Offset %d is invalid for MySQL result index %d (or the query data is unbuffered)", get_active_function_name(TSRMLS_C), Z_LVAL_PP(offset), Z_LVAL_PP(result)); RETURN_FALSE; } mysql_data_seek(mysql_result, Z_LVAL_PP(offset)); @@ -2003,7 +2003,7 @@ if (field) { if (Z_LVAL_PP(field)<0 || Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) { - php_error(E_WARNING, "MySQL: Bad field offset"); + php_error(E_WARNING, "%s(): Bad field offset", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } mysql_field_seek(mysql_result, Z_LVAL_PP(field)); @@ -2047,7 +2047,7 @@ convert_to_long_ex(offset); if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=(int)mysql_num_fields(mysql_result)) { - php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", Z_LVAL_PP(offset), Z_LVAL_PP(result)); + php_error(E_WARNING, "%s(): Field %d is invalid for MySQL result index %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(offset), Z_LVAL_PP(result)); RETURN_FALSE; } mysql_field_seek(mysql_result, Z_LVAL_PP(offset)); @@ -2080,7 +2080,7 @@ convert_to_long_ex(field); if (Z_LVAL_PP(field)<0 || Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) { - php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", Z_LVAL_PP(field), Z_LVAL_PP(result)); + php_error(E_WARNING, "%s(): Field %d is invalid for MySQL result index %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(field), Z_LVAL_PP(result)); RETURN_FALSE; } mysql_field_seek(mysql_result, Z_LVAL_PP(field)); No revision No revision 1.2.2.1 +16 -17 php4/ext/mysql/libmysql/charset.c Index: charset.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/charset.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- charset.c 29 Apr 2002 02:30:52 -0000 1.2 +++ charset.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -289,8 +289,7 @@ return NULL; } -static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name, - myf flags) +static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name) { CHARSET_INFO tmp_cs,*cs; uchar tmp_ctype[CTYPE_TABLE_SIZE]; @@ -305,7 +304,7 @@ cs->to_lower=tmp_to_lower; cs->to_upper=tmp_to_upper; cs->sort_order=tmp_sort_order; - if (read_charset_file(cs_number, cs, flags)) + if (read_charset_file(cs_number, cs, MYF(MY_WME))) return NULL; cs = (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO), @@ -327,7 +326,7 @@ return cs; } -static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) +static CHARSET_INFO *get_internal_charset(uint cs_number) { CHARSET_INFO *cs; /* @@ -338,13 +337,13 @@ if (!(cs = find_charset((CHARSET_INFO**) cs_info_table.buffer, cs_number, cs_info_table.elements))) if (!(cs = find_compiled_charset(cs_number))) - cs=add_charset(cs_number, get_charset_name(cs_number), flags); + cs=add_charset(cs_number, get_charset_name(cs_number)); pthread_mutex_unlock(&THR_LOCK_charset); return cs; } -static CHARSET_INFO *get_internal_charset_by_name(const char *name, myf flags) +static CHARSET_INFO *get_internal_charset_by_name(const char *name) { CHARSET_INFO *cs; /* @@ -355,7 +354,7 @@ if (!(cs = find_charset_by_name((CHARSET_INFO**) cs_info_table.buffer, name, cs_info_table.elements))) if (!(cs = find_compiled_charset_by_name(name))) - cs=add_charset(get_charset_number(name), name, flags); + cs=add_charset(get_charset_number(name), name); pthread_mutex_unlock(&THR_LOCK_charset); return cs; } @@ -365,7 +364,7 @@ { CHARSET_INFO *cs; (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ - cs=get_internal_charset(cs_number, flags); + cs=get_internal_charset(cs_number); if (!cs && (flags & MY_WME)) { @@ -380,16 +379,16 @@ my_bool set_default_charset(uint cs, myf flags) { - CHARSET_INFO *new; + CHARSET_INFO *new_charset; DBUG_ENTER("set_default_charset"); DBUG_PRINT("enter",("character set: %d",(int) cs)); - new = get_charset(cs, flags); - if (!new) + new_charset = get_charset(cs, flags); + if (!new_charset) { DBUG_PRINT("error",("Couldn't set default character set")); DBUG_RETURN(TRUE); /* error */ } - default_charset_info = new; + default_charset_info = new_charset; DBUG_RETURN(FALSE); } @@ -397,7 +396,7 @@ { CHARSET_INFO *cs; (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ - cs=get_internal_charset_by_name(cs_name, flags); + cs=get_internal_charset_by_name(cs_name); if (!cs && (flags & MY_WME)) { @@ -411,17 +410,17 @@ my_bool set_default_charset_by_name(const char *cs_name, myf flags) { - CHARSET_INFO *new; + CHARSET_INFO *new_charset; DBUG_ENTER("set_default_charset_by_name"); DBUG_PRINT("enter",("character set: %s", cs_name)); - new = get_charset_by_name(cs_name, flags); - if (!new) + new_charset = get_charset_by_name(cs_name, flags); + if (!new_charset) { DBUG_PRINT("error",("Couldn't set default character set")); DBUG_RETURN(TRUE); /* error */ } - default_charset_info = new; + default_charset_info = new_charset; DBUG_RETURN(FALSE); } 1.2.2.1 +2 -2 php4/ext/mysql/libmysql/config-win.h Index: config-win.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/config-win.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config-win.h 29 Apr 2002 02:30:52 -0000 1.2 +++ config-win.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -239,7 +239,7 @@ #define HAVE_ALLOCA #define HAVE_STRPBRK #define HAVE_STRSTR -/* #define HAVE_COMPRESS -- not with PHP, please */ +/* #define HAVE_COMPRESS -- not with PHP, please */ #ifdef NOT_USED #define HAVE_SNPRINTF /* Gave link error */ @@ -273,7 +273,7 @@ #define FN_ROOTDIR "\\" #define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ #define FN_NO_CASE_SENCE /* Files are not case-sensitive */ -#define FN_LOWER_CASE TRUE /* Files are represented in lower case */ +#define FN_LOWER_CASE TRUE /* Files are represented in lower case */ #define MY_NFILE 1024 #define DO_NOT_REMOVE_THREAD_WRAPPERS 1.2.2.1 +3 -3 php4/ext/mysql/libmysql/ctype.c Index: ctype.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/ctype.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ctype.c 29 Apr 2002 02:30:52 -0000 1.2 +++ ctype.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -2,8 +2,8 @@ This file is public domain and comes with NO WARRANTY of any kind */ #include <global.h> - #include <m_ctype.h> +#include <m_string.h> /* generated by make, using conf_to_src */ #include "ctype_extra_sources.c" @@ -33,7 +33,7 @@ return NULL; } -uint8 compiled_charset_number(const char *name) +uint compiled_charset_number(const char *name) { CHARSET_INFO *cs; for (cs = compiled_charsets; cs->number > 0; cs++) @@ -43,7 +43,7 @@ return 0; /* this mimics find_type() */ } -const char *compiled_charset_name(uint8 charset_number) +const char *compiled_charset_name(uint charset_number) { CHARSET_INFO *cs; for (cs = compiled_charsets; cs->number > 0; cs++) 1.2.2.1 +87 -94 php4/ext/mysql/libmysql/dbug.c Index: dbug.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/dbug.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- dbug.c 29 Apr 2002 02:30:52 -0000 1.2 +++ dbug.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -307,6 +307,7 @@ * Macros and defines for testing file accessibility under UNIX and MSDOS. */ +#undef EXISTS #if !defined(HAVE_ACCESS) || defined(MSDOS) #define EXISTS(pathname) (FALSE) /* Assume no existance */ #define Writable(name) (TRUE) @@ -489,8 +490,7 @@ * */ -void _db_push_ (control) -const char *control; +void _db_push_ (const char *control) { reg1 char *scan; reg2 struct link *temp; @@ -691,15 +691,14 @@ * */ -void _db_enter_ (_func_, _file_, _line_, _sfunc_, _sfile_, _slevel_, - _sframep_) -const char *_func_; -const char *_file_; -uint _line_; -const char **_sfunc_; -const char **_sfile_; -uint *_slevel_; -char ***_sframep_ __attribute__((unused)); +void _db_enter_ ( +const char *_func_, +const char *_file_, +uint _line_, +const char **_sfunc_, +const char **_sfile_, +uint *_slevel_, +char ***_sframep_ __attribute__((unused))) { reg1 CODE_STATE *state; @@ -777,11 +776,11 @@ * */ -void _db_return_ (_line_, _sfunc_, _sfile_, _slevel_) -uint _line_; -const char **_sfunc_; -const char **_sfile_; -uint *_slevel_; +void _db_return_ ( +uint _line_, +const char **_sfunc_, +const char **_sfile_, +uint *_slevel_) { CODE_STATE *state; @@ -851,9 +850,9 @@ * */ -void _db_pargs_ (_line_, keyword) -uint _line_; -const char *keyword; +void _db_pargs_ ( +uint _line_, +const char *keyword) { CODE_STATE *state=code_state(); state->u_line = _line_; @@ -934,10 +933,11 @@ * Is used to examine corrputed memory or arrays. */ -void _db_dump_(_line_,keyword,memory,length) -uint _line_,length; -const char *keyword; -const char *memory; +void _db_dump_( +uint _line_, +const char *keyword, +const char *memory, +uint length) { int pos; char dbuff[90]; @@ -1004,11 +1004,11 @@ * */ -static struct link *ListParse (ctlp) -char *ctlp; +static struct link *ListParse ( +char *ctlp) { REGISTER char *start; - REGISTER struct link *new; + REGISTER struct link *new_malloc; REGISTER struct link *head; head = NULL; @@ -1020,10 +1020,10 @@ if (*ctlp == ',') { *ctlp++ = EOS; } - new = (struct link *) DbugMalloc (sizeof (struct link)); - new -> str = StrDup (start); - new -> next_link = head; - head = new; + new_malloc = (struct link *) DbugMalloc (sizeof (struct link)); + new_malloc -> str = StrDup (start); + new_malloc -> next_link = head; + head = new_malloc; } return (head); } @@ -1052,9 +1052,9 @@ * */ -static BOOLEAN InList (linkp, cp) -struct link *linkp; -const char *cp; +static BOOLEAN InList ( +struct link *linkp, +const char *cp) { REGISTER struct link *scan; REGISTER BOOLEAN result; @@ -1098,7 +1098,7 @@ static void PushState () { - REGISTER struct state *new; + REGISTER struct state *new_malloc; if (!init_done) { @@ -1106,19 +1106,19 @@ init_done=TRUE; } (void) code_state(); /* Alloc memory */ - new = (struct state *) DbugMalloc (sizeof (struct state)); - new -> flags = 0; - new -> delay = 0; - new -> maxdepth = MAXDEPTH; - new -> sub_level=0; - new -> out_file = stderr; - new -> prof_file = (FILE*) 0; - new -> functions = NULL; - new -> p_functions = NULL; - new -> keywords = NULL; - new -> processes = NULL; - new -> next_state = stack; - stack=new; + new_malloc = (struct state *) DbugMalloc (sizeof (struct state)); + new_malloc -> flags = 0; + new_malloc -> delay = 0; + new_malloc -> maxdepth = MAXDEPTH; + new_malloc -> sub_level=0; + new_malloc -> out_file = stderr; + new_malloc -> prof_file = (FILE*) 0; + new_malloc -> functions = NULL; + new_malloc -> p_functions = NULL; + new_malloc -> keywords = NULL; + new_malloc -> processes = NULL; + new_malloc -> next_state = stack; + stack=new_malloc; } @@ -1216,8 +1216,8 @@ * */ -BOOLEAN _db_keyword_ (keyword) -const char *keyword; +BOOLEAN _db_keyword_ ( +const char *keyword) { REGISTER BOOLEAN result; CODE_STATE *state; @@ -1256,8 +1256,8 @@ * */ -static void Indent (indent) -int indent; +static void Indent ( +int indent) { REGISTER int count; @@ -1289,8 +1289,8 @@ * */ -static void FreeList (linkp) -struct link *linkp; +static void FreeList ( +struct link *linkp) { REGISTER struct link *old; @@ -1325,13 +1325,13 @@ */ -static char *StrDup (str) -const char *str; +static char *StrDup ( +const char *str) { - reg1 char *new; - new = DbugMalloc ((int) strlen (str) + 1); - (void) strcpy (new, str); - return (new); + reg1 char *new_malloc; + new_malloc = DbugMalloc ((int) strlen (str) + 1); + (void) strcpy (new_malloc, str); + return (new_malloc); } @@ -1354,8 +1354,8 @@ * */ -static void DoPrefix (_line_) -uint _line_; +static void DoPrefix ( +uint _line_) { CODE_STATE *state; state=code_state(); @@ -1365,7 +1365,7 @@ #ifdef THREAD (void) fprintf (_db_fp_, "%-7s: ", my_thread_name()); #else - (void) fprintf (_db_fp_, "%5d: ", getpid ()); + (void) fprintf (_db_fp_, "%5d: ", (int) getpid ()); #endif } if (stack -> flags & NUMBER_ON) { @@ -1419,7 +1419,7 @@ } else { - if (!Writable(name)) + if (!Writable((char*)name)) { (void) fprintf (stderr, ERR_OPEN, _db_process_, name); perror (""); @@ -1528,8 +1528,8 @@ * */ -static void CloseFile (fp) -FILE *fp; +static void CloseFile ( +FILE *fp) { if (fp != stderr && fp != stdout) { if (fclose (fp) == EOF) { @@ -1590,14 +1590,14 @@ * */ -static char *DbugMalloc (size) -int size; +static char *DbugMalloc ( +int size) { - register char *new; + register char *new_malloc; - if (!(new = malloc ((unsigned int) size))) + if (!(new_malloc = (char*) malloc ((unsigned int) size))) DbugExit ("out of memory"); - return (new); + return (new_malloc); } @@ -1606,9 +1606,9 @@ * separator (to allow directory-paths in dos). */ -static char *static_strtok (s1, separator) -char *s1; -pchar separator; +static char *static_strtok ( +char *s1, +pchar separator) { static char *end = NULL; reg1 char *rtnval,*cpy; @@ -1692,8 +1692,8 @@ #ifndef Writable -static BOOLEAN Writable (pathname) -char *pathname; +static BOOLEAN Writable ( +char *pathname) { REGISTER BOOLEAN granted; REGISTER char *lastslash; @@ -1746,8 +1746,8 @@ */ #ifndef ChangeOwner -static void ChangeOwner (pathname) -char *pathname; +static void ChangeOwner ( +char *pathname) { if (chown (pathname, getuid (), getgid ()) == -1) { @@ -1847,8 +1847,8 @@ #define HZ (50) /* Probably in some header somewhere */ #endif -static int DelayArg (value) -int value; +static int DelayArg ( +int value) { uint delayarg = 0; @@ -1868,8 +1868,8 @@ */ #if ! defined(Delay) && ! defined(AMIGA) -static int Delay (ticks) -int ticks; +static int Delay ( +int ticks) { return ticks; } @@ -1969,12 +1969,13 @@ * own for whatever system that you have. */ -#ifdef HAVE_GETRUSAGE +#ifndef THREAD +#if defined(HAVE_GETRUSAGE) #include <sys/param.h> #include <sys/resource.h> -/* extern int getrusage(int, struct rusage *); */ +/* extern int getrusage(int, struct rusage *); */ /* * Returns the user time in milliseconds used by this process so @@ -1989,15 +1990,13 @@ return ((ru.ru_utime.tv_sec * 1000) + (ru.ru_utime.tv_usec / 1000)); } -#else -#if defined(MSDOS) || defined(__WIN__) +#elif defined(MSDOS) || defined(__WIN__) || defined(OS2) static ulong Clock() { return clock()*(1000/CLOCKS_PER_SEC); } -#else -#ifdef amiga +#elif defined (amiga) struct DateStamp { /* Yes, this is a hack, but doing it right */ long ds_Days; /* is incredibly ugly without splitting this */ @@ -2030,19 +2029,13 @@ } return (millisec); } - #else - -#ifndef THREAD static unsigned long Clock () { return (0); } -#endif -#endif /* amiga */ -#endif /* MSDOS || __WIN__ */ #endif /* RUSAGE */ - +#endif /* THREADS */ #ifdef NO_VARARGS 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/dbug.h Index: dbug.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/dbug.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- dbug.h 29 Apr 2002 02:30:52 -0000 1.2 +++ dbug.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -52,7 +52,7 @@ #define DEBUGGER_ON _no_db_=0 #define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); } -#define DBUG_ASSERT(A) A +#define DBUG_ASSERT(A) assert(A) #else /* No debugger */ #define DBUG_ENTER(a1) 1.2.2.1 +3 -3 php4/ext/mysql/libmysql/default.c Index: default.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/default.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- default.c 29 Apr 2002 02:30:52 -0000 1.2 +++ default.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -132,7 +132,7 @@ &group)) goto err; #endif -#ifdef __EMX__ +#if defined(__EMX__) || defined(OS2) if (getenv("ETC") && search_default_file(&args, &alloc, getenv("ETC"), conf_file, default_ext, &group)) @@ -208,7 +208,7 @@ const char *dir, const char *config_file, const char *ext, TYPELIB *group) { - char name[FN_REFLEN+10],buff[FN_REFLEN+1],*ptr,*end,*value,*tmp; + char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp; FILE *fp; uint line=0; my_bool read_values=0,found_group=0; @@ -349,7 +349,7 @@ GetWindowsDirectory(name,sizeof(name)); printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext); #endif -#ifdef __EMX__ +#if defined(__EMX__) || defined(OS2) if (getenv("ETC")) printf("%s\\%s%s ", getenv("ETC"), conf_file, default_ext); #endif 1.2.2.1 +0 -98 php4/ext/mysql/libmysql/dll.c <<Binary file>> 1.2.2.1 +28 -0 php4/ext/mysql/libmysql/errmsg.c Index: errmsg.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/errmsg.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- errmsg.c 29 Apr 2002 02:30:52 -0000 1.2 +++ errmsg.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -34,6 +34,34 @@ "Got packet bigger than 'max_allowed_packet'" }; +/* Start of code added by Roberto M. Serqueira - marti****@uol***** - 05.24.2001 */ + +#elif defined PORTUGUESE +const char *client_errors[]= +{ + "Erro desconhecido do MySQL", + "N〓o pode criar 'UNIX socket' (%d)", + "N〓o pode se conectar ao servidor MySQL local atrav〓s do 'socket' '%-.64s' (%d)", + "N〓o pode se conectar ao servidor MySQL em '%-.64s' (%d)", + "N〓o pode criar 'socket TCP/IP' (%d)", + "'Host' servidor MySQL '%-.64s' (%d) desconhecido", + "Servidor MySQL desapareceu", + "Incompatibilidade de protocolos. Vers〓o do Servidor: %d - Vers〓o do Cliente: %d", + "Cliente do MySQL com falta de mem〓ria", + "Informa〓〓o inv〓lida de 'host'", + "Localhost via 'UNIX socket'", + "%-.64s via 'TCP/IP'", + "Erro na negocia〓〓o de acesso ao servidor", + "Conex〓o perdida com servidor MySQL durante 'query'", + "Comandos fora de sincronismo. Voc〓 n〓o pode executar este comando agora", + "%-.64s via 'named pipe'", + "N〓o pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", + "N〓o pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", + "N〓o pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", + "N〓o pode inicializar conjunto de caracteres %-.64s (caminho %-.64s)", + "Obteve pacote maior do que 'max_allowed_packet'" +}; + #else /* ENGLISH */ const char *client_errors[]= { 1.2.2.1 +4 -0 php4/ext/mysql/libmysql/errmsg.h Index: errmsg.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/errmsg.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- errmsg.h 29 Apr 2002 02:30:52 -0000 1.2 +++ errmsg.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -15,7 +15,11 @@ #define CR_MIN_ERROR 2000 /* For easier client code */ #define CR_MAX_ERROR 2999 +#if defined(OS2) && defined( MYSQL_SERVER) +#define CER(X) client_errors[(X)-CR_MIN_ERROR] +#else #define ER(X) client_errors[(X)-CR_MIN_ERROR] +#endif #define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ #define CR_UNKNOWN_ERROR 2000 1.2.2.1 +3 -4 php4/ext/mysql/libmysql/get_password.c Index: get_password.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/get_password.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- get_password.c 29 Apr 2002 02:30:52 -0000 1.2 +++ get_password.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -21,7 +21,7 @@ #include <pwd.h> #endif /* HAVE_PWD_H */ #else /* ! HAVE_GETPASS */ -#ifndef __WIN__ +#if !defined( __WIN__) && !defined(OS2) #include <sys/ioctl.h> #ifdef HAVE_TERMIOS_H /* For tty-password */ #include <termios.h> @@ -48,9 +48,8 @@ #define getpass(A) getpassphrase(A) #endif -#ifdef __WIN__ -/* were just going to fake it here and get input from - the keyboard */ +#if defined( __WIN__) || defined(OS2) +/* were just going to fake it here and get input from the keyboard */ char *get_tty_password(char *opt_message) { 1.2.2.1 +48 -13 php4/ext/mysql/libmysql/global.h Index: global.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/global.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- global.h 29 Apr 2002 02:30:53 -0000 1.2 +++ global.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -29,14 +29,14 @@ #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) #include <config-win.h> +#elif defined(OS2) +#include <config-os2.h> #else #include <my_config.h> -#endif -#if defined(__cplusplus) -#if defined(inline) +#if defined(__cplusplus) && defined(inline) #undef inline /* fix configure problem */ #endif -#endif /* _cplusplus */ +#endif /* _WIN32... */ /* Fix problem with S_ISLNK() on Linux */ #if defined(HAVE_LINUXTHREADS) @@ -62,7 +62,7 @@ #define __STDC_EXT__ 1 /* To get large file support on hpux */ #endif -#if defined(THREAD) && !defined(__WIN__) +#if defined(THREAD) && !defined(__WIN__) && !defined(OS2) #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ #endif @@ -197,6 +197,11 @@ #ifdef DONT_USE_FINITE /* HPUX 11.x has is_finite() */ #undef HAVE_FINITE #endif +#if defined(HPUX) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) +/* Fix bug in setrlimit */ +#undef setrlimit +#define setrlimit cma_setrlimit64 +#endif /* We can not live without these */ @@ -206,7 +211,9 @@ #define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */ #define USE_REGEX 1 /* We want the use the regex library */ /* Do not define for ultra sparcs */ +#ifndef OS2 #define USE_BMOVE512 1 /* Use this unless the system bmove is faster */ +#endif /* Paranoid settings. Define I_AM_PARANOID if you are paranoid */ #ifdef I_AM_PARANOID @@ -250,12 +257,8 @@ #endif #if defined(__EMX__) || !defined(HAVE_UINT) -#undef uint -#undef ushort -#undef ulong typedef unsigned int uint; typedef unsigned short ushort; -typedef unsigned long ulong; #endif #define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) @@ -460,7 +463,11 @@ #endif #undef remove /* Crashes MySQL on SCO 5.0.0 */ #ifndef __WIN__ +#ifdef OS2 +#define closesocket(A) soclose(A) +#else #define closesocket(A) close(A) +#endif #ifndef ulonglong2double #define ulonglong2double(A) ((double) (A)) #define my_off_t2double(A) ((double) (A)) @@ -549,9 +556,13 @@ #ifndef NEAR #define NEAR /* Who needs segments ? */ #define FAR /* On a good machine */ +#ifndef HUGE_PTR #define HUGE_PTR #endif -#ifndef STDCALL +#endif +#if defined(__IBMC__) || defined(__IBMCPP__) +#define STDCALL _System _Export +#elif !defined( STDCALL) #define STDCALL #endif @@ -591,8 +602,8 @@ #endif #ifndef longlong_defined #if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8 -typedef unsigned long long ulonglong; /* ulong or unsigned long long */ -typedef long long longlong; +typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ +typedef long long int longlong; #else typedef unsigned long ulonglong; /* ulong or unsigned long long */ typedef long longlong; @@ -619,8 +630,32 @@ typedef unsigned long my_off_t; #endif #define MY_FILEPOS_ERROR (~(my_off_t) 0) -#ifndef __WIN__ +#if !defined(__WIN__) && !defined(OS2) typedef off_t os_off_t; +#endif + +#if defined(__WIN__) +#define socket_errno WSAGetLastError() +#define SOCKET_EINTR WSAEINTR +#define SOCKET_EAGAIN WSAEINPROGRESS +#define SOCKET_ENFILE ENFILE +#define SOCKET_EMFILE EMFILE +#elif defined(OS2) +#define socket_errno sock_errno() +#define SOCKET_EINTR SOCEINTR +#define SOCKET_EAGAIN SOCEINPROGRESS +#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK +#define SOCKET_ENFILE SOCENFILE +#define SOCKET_EMFILE SOCEMFILE +#define closesocket(A) soclose(A) +#else /* Unix */ +#define socket_errno errno +#define closesocket(A) close(A) +#define SOCKET_EINTR EINTR +#define SOCKET_EAGAIN EAGAIN +#define SOCKET_EWOULDBLOCK EWOULDBLOCK +#define SOCKET_ENFILE ENFILE +#define SOCKET_EMFILE EMFILE #endif typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ 1.2.2.1 +56 -33 php4/ext/mysql/libmysql/libmysql.c Index: libmysql.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/libmysql.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- libmysql.c 29 Apr 2002 02:30:53 -0000 1.2 +++ libmysql.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -1,7 +1,6 @@ /* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB This file is public domain and comes with NO WARRANTY of any kind */ -#define DONT_USE_RAID #include <global.h> #if defined(__WIN__) || defined(_WIN32) || defined(_WIN64) #include <winsock.h> @@ -25,9 +24,7 @@ #if !defined(MSDOS) && !defined(__WIN__) #include <sys/socket.h> #include <netinet/in.h> -#ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> -#endif #include <netdb.h> #ifdef HAVE_SELECT_H # include <select.h> @@ -50,7 +47,7 @@ uint mysql_port=0; my_string mysql_unix_port=0; -#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS) +#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS) #ifdef __WIN__ #define CONNECT_TIMEOUT 20 @@ -59,14 +56,12 @@ #endif #if defined(MSDOS) || defined(__WIN__) -#define ERRNO WSAGetLastError() +// socket_errno is defined in global.h for all platforms #define perror(A) #else #include <errno.h> -#define ERRNO errno #define SOCKET_ERROR -1 -#define closesocket(A) close(A) -#endif +#endif /* __WIN__ */ static void mysql_once_init(void); static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields, @@ -109,7 +104,7 @@ static int connect2(my_socket s, const struct sockaddr *name, uint namelen, uint timeout) { -#if defined(__WIN__) +#if defined(__WIN__) || defined(OS2) return connect(s, (struct sockaddr*) name, namelen); #else int flags, res, s_err; @@ -275,7 +270,7 @@ ** or packet is an error message *****************************************************************************/ -static uint +uint net_safe_read(MYSQL *mysql) { NET *net= &mysql->net; @@ -405,7 +400,7 @@ } -static int +int simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, uint length, my_bool skipp_check) { @@ -441,7 +436,7 @@ if (net_write_command(net,(uchar) command,arg, length ? length : (ulong) strlen(arg))) { - DBUG_PRINT("error",("Can't send command to server. Error: %d",errno)); + DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno)); end_server(mysql); if (mysql_reconnect(mysql) || net_write_command(net,(uchar) command,arg, @@ -478,7 +473,7 @@ char* getlogin(void); #endif -#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) +#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2) static void read_user_name(char *name) { DBUG_ENTER("read_user_name"); @@ -662,11 +657,12 @@ ****************************************************************************/ static const char *default_options[]= -{"port","socket","compress","password","pipe", "timeout", "user", - "init-command", "host", "database", "debug", "return-found-rows", - "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", - "character-set-dir", "default-character-set", "interactive-timeout", - "connect_timeout", +{ + "port","socket","compress","password","pipe", "timeout", "user", + "init-command", "host", "database", "debug", "return-found-rows", + "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", + "character-set-dir", "default-character-set", "interactive-timeout", + "connect-timeout", "local-infile", "disable-local-infile", NullS }; @@ -701,6 +697,9 @@ opt_arg=end+1; *end=0; /* Remove '=' */ } + /* Change all '_' in variable name to '-' */ + for (end= *option ; (end= strcend(end,'_')) ; ) + *end= '-'; switch (find_type(*option+2,&option_types,2)) { case 1: /* port */ if (opt_arg) @@ -798,7 +797,16 @@ options->charset_name = my_strdup(opt_arg, MYF(MY_WME)); break; case 19: /* Interactive-timeout */ - options->client_flag|=CLIENT_INTERACTIVE; + options->client_flag|= CLIENT_INTERACTIVE; + break; + case 21: + if (!opt_arg || atoi(opt_arg) != 0) + options->client_flag|= CLIENT_LOCAL_FILES; + else + options->client_flag&= ~CLIENT_LOCAL_FILES; + break; + case 22: + options->client_flag&= CLIENT_LOCAL_FILES; break; default: DBUG_PRINT("warning",("unknown option: %s",option[0])); @@ -993,10 +1001,18 @@ else bzero((char*) (mysql),sizeof(*(mysql))); mysql->options.connect_timeout=CONNECT_TIMEOUT; -#if defined(SIGPIPE) && defined(THREAD) +#if defined(SIGPIPE) && defined(THREAD) && !defined(__WIN__) if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE)) (void) signal(SIGPIPE,pipe_sig_handler); #endif + +/* + Only enable LOAD DATA INFILE by default if configured with + --with-enabled-local-inflile +*/ +#ifdef ENABLED_LOCAL_INFILE + mysql->options.client_flag|= CLIENT_LOCAL_FILES; +#endif return mysql; } @@ -1034,7 +1050,7 @@ mysql_unix_port = env; } mysql_debug(NullS); -#if defined(SIGPIPE) && !defined(THREAD) +#if defined(SIGPIPE) && !defined(THREAD) && !defined(__WIN__) (void) signal(SIGPIPE,SIG_IGN); #endif } @@ -1203,7 +1219,7 @@ if ((sock = socket(AF_UNIX,SOCK_STREAM,0)) == SOCKET_ERROR) { net->last_errno=CR_SOCKET_CREATE_ERROR; - sprintf(net->last_error,ER(net->last_errno),ERRNO); + sprintf(net->last_error,ER(net->last_errno),socket_errno); goto error; } net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE); @@ -1213,9 +1229,9 @@ if (connect2(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr), mysql->options.connect_timeout) <0) { - DBUG_PRINT("error",("Got error %d on connect to local server",ERRNO)); + DBUG_PRINT("error",("Got error %d on connect to local server",socket_errno)); net->last_errno=CR_CONNECTION_ERROR; - sprintf(net->last_error,ER(net->last_errno),unix_socket,ERRNO); + sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno); goto error; } } @@ -1266,7 +1282,7 @@ if ((sock = (my_socket) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR) { net->last_errno=CR_IPSOCK_ERROR; - sprintf(net->last_error,ER(net->last_errno),ERRNO); + sprintf(net->last_error,ER(net->last_errno),socket_errno); goto error; } net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE); @@ -1303,7 +1319,7 @@ if (!(hp=gethostbyname(host))) { net->last_errno=CR_UNKNOWN_HOST; - sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, errno); + sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno); goto error; } memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); @@ -1313,9 +1329,9 @@ if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), mysql->options.connect_timeout) <0) { - DBUG_PRINT("error",("Got error %d on connect to '%s'",ERRNO,host)); + DBUG_PRINT("error",("Got error %d on connect to '%s'",socket_errno,host)); net->last_errno= CR_CONN_HOST_ERROR; - sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, ERRNO); + sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno); goto error; } } @@ -1385,7 +1401,7 @@ charset_name=charset_name_buff; sprintf(charset_name,"%d",mysql->server_language); /* In case of errors */ if (!(mysql->charset = - get_charset((uint8) mysql->server_language, MYF(0)))) + get_charset((uint8) mysql->server_language, MYF(MY_WME)))) mysql->charset = default_charset_info; /* shouldn't be fatal */ } @@ -1444,7 +1460,6 @@ if (mysql->options.use_ssl) client_flag|=CLIENT_SSL; #endif /* HAVE_OPENSSL */ - if (db) client_flag|=CLIENT_CONNECT_WITH_DB; #ifdef HAVE_COMPRESS @@ -1563,13 +1578,13 @@ } mysql_init(&tmp_mysql); tmp_mysql.options=mysql->options; + bzero((char*) &mysql->options,sizeof(mysql->options)); if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, mysql->db, mysql->port, mysql->unix_socket, mysql->client_flag)) DBUG_RETURN(1); tmp_mysql.free_me=mysql->free_me; mysql->free_me=0; - bzero((char*) &mysql->options,sizeof(mysql->options)); mysql_close(mysql); *mysql=tmp_mysql; net_clear(&mysql->net); @@ -1800,7 +1815,7 @@ if (my_net_write(&mysql->net,"",0) || net_flush(&mysql->net)) { mysql->net.last_errno=CR_SERVER_LOST; - sprintf(mysql->net.last_error,ER(mysql->net.last_errno),errno); + sprintf(mysql->net.last_error,ER(mysql->net.last_errno),socket_errno); my_free(tmp_name,MYF(0)); DBUG_RETURN(-1); } @@ -1946,6 +1961,8 @@ DBUG_PRINT("info",("end of data")); res->eof=1; res->handle->status=MYSQL_STATUS_READY; + /* Don't clear handle in mysql_free_results */ + res->handle=0; } } DBUG_RETURN((MYSQL_ROW) NULL); @@ -2256,10 +2273,16 @@ mysql->options.connect_timeout= *(uint*) arg; break; case MYSQL_OPT_COMPRESS: - mysql->options.compress=1; /* Remember for connect */ + mysql->options.compress= 1; /* Remember for connect */ break; case MYSQL_OPT_NAMED_PIPE: mysql->options.named_pipe=1; /* Force named pipe */ + break; + case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/ + if (!arg || test(*(uint*) arg)) + mysql->options.client_flag|= CLIENT_LOCAL_FILES; + else + mysql->options.client_flag&= ~CLIENT_LOCAL_FILES; break; case MYSQL_INIT_COMMAND: my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR)); 1.2.2.1 +4 -4 php4/ext/mysql/libmysql/list.c Index: list.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/list.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- list.c 29 Apr 2002 02:30:53 -0000 1.2 +++ list.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -58,11 +58,11 @@ LIST *list_cons(void *data, LIST *list) { - LIST *new=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE)); - if (!new) + LIST *new_charset=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE)); + if (!new_charset) return 0; - new->data=data; - return list_add(list,new); + new_charset->data=data; + return list_add(list,new_charset); } 1.2.2.1 +10 -7 php4/ext/mysql/libmysql/m_string.h Index: m_string.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/m_string.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- m_string.h 29 Apr 2002 02:30:53 -0000 1.2 +++ m_string.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -55,10 +55,6 @@ # define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */ #endif -#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread) -#define strmov(A,B) stpcpy((A),(B)) -#endif - /* Unixware 7 */ #if !defined(HAVE_BFILL) # define bfill(A,B,C) memset((A),(C),(B)) @@ -72,10 +68,17 @@ # define bmove_allign(A,B,C) memcpy((A),(B),(C)) #endif -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(OS2) extern "C" { #endif +#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread) +#define strmov(A,B) stpcpy((A),(B)) +#ifndef stpcpy +extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ +#endif +#endif + extern char NEAR _dig_vec[]; /* Declared in int2str() */ #ifdef BAD_STRING_COMPILER @@ -134,7 +137,7 @@ uint new_len,uint tot_len); extern void strappend(char *s,uint len,pchar fill); extern char *strend(const char *s); -extern char *strcend(const char *, pchar); +extern char *strcend(const char *, pchar); extern char *strfield(char *src,int fields,int chars,int blanks, int tabch); extern char *strfill(my_string s,uint len,pchar fill); @@ -221,7 +224,7 @@ #endif #endif -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(OS2) } #endif #endif 1.2.2.1 +21 -12 php4/ext/mysql/libmysql/mf_casecnv.c Index: mf_casecnv.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/mf_casecnv.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mf_casecnv.c 29 Apr 2002 02:30:53 -0000 1.2 +++ mf_casecnv.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -11,20 +11,23 @@ #include "mysys_priv.h" #include <m_ctype.h> +#include <m_string.h> /* string to uppercase */ void caseup_str(my_string str) { #ifdef USE_MB - register uint32 l; - register char *end=str+(uint) strlen(str); if (use_mb(default_charset_info)) + { + register uint32 l; + register char *end=str+(uint) strlen(str); while (*str) { if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; else *str=toupper(*str),++str; } + } else #endif while ((*str = toupper(*str)) != 0) @@ -36,14 +39,16 @@ void casedn_str(my_string str) { #ifdef USE_MB - register uint32 l; - register char *end=str+(uint) strlen(str); if (use_mb(default_charset_info)) + { + register uint32 l; + register char *end=str+(uint) strlen(str); while (*str) { if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; else *str=tolower(*str),++str; } + } else #endif while ((*str= tolower(*str)) != 0) @@ -56,14 +61,16 @@ void caseup(my_string str, uint length) { #ifdef USE_MB - register uint32 l; - register char *end=str+length; if (use_mb(default_charset_info)) + { + register uint32 l; + register char *end=str+length; while (str<end) { if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; else *str=toupper(*str),++str; } + } else #endif for ( ; length>0 ; length--, str++) @@ -75,14 +82,16 @@ void casedn(my_string str, uint length) { #ifdef USE_MB - register uint32 l; - register char *end=str+length; if (use_mb(default_charset_info)) + { + register uint32 l; + register char *end=str+length; while (str<end) { if ((l=my_ismbchar(default_charset_info, str,end))) str+=l; else *str=tolower(*str),++str; } + } else #endif for ( ; length>0 ; length--, str++) @@ -129,10 +138,10 @@ int my_strcasecmp(const char *s, const char *t) { #ifdef USE_MB - register uint32 l; - register const char *end=s+(uint) strlen(s); if (use_mb(default_charset_info)) { + register uint32 l; + register const char *end=s+(uint) strlen(s); while (s<end) { if ((l=my_ismbchar(default_charset_info, s,end))) @@ -158,10 +167,10 @@ int my_casecmp(const char *s, const char *t, uint len) { #ifdef USE_MB - register uint32 l; - register const char *end=s+len; if (use_mb(default_charset_info)) { + register uint32 l; + register const char *end=s+len; while (s<end) { if ((l=my_ismbchar(default_charset_info, s,end))) 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/mf_dirname.c Index: mf_dirname.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/mf_dirname.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mf_dirname.c 29 Apr 2002 02:30:53 -0000 1.2 +++ mf_dirname.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -10,7 +10,7 @@ { register my_string pos,gpos; #ifdef FN_DEVCHAR - if ((pos=strrchr(name,FN_DEVCHAR)) == 0) + if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0) #endif pos=(char*) name-1; 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/mf_format.c Index: mf_format.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/mf_format.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mf_format.c 29 Apr 2002 02:30:53 -0000 1.2 +++ mf_format.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -51,7 +51,7 @@ pack_dirname(dev,dev); /* Put in ./.. and ~/.. */ if (flag & 4) (void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */ - if ((pos=strchr(name,FN_EXTCHAR)) != NullS) + if ((pos=(char*)strchr(name,FN_EXTCHAR)) != NullS) { if ((flag & 2) == 0) /* Skall vi byta extension ? */ { 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/mf_path.c Index: mf_path.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/mf_path.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mf_path.c 29 Apr 2002 02:30:53 -0000 1.2 +++ mf_path.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -60,7 +60,7 @@ /* test if file without filename is found in path */ /* Returns to if found and to has dirpart if found, else NullS */ -#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) #define F_OK 0 #define PATH_SEP ';' #define PROGRAM_EXTENSION ".exe" 1.2.2.1 +1 -0 php4/ext/mysql/libmysql/my_compress.c Index: my_compress.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_compress.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_compress.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_compress.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -6,6 +6,7 @@ #include <global.h> #ifdef HAVE_COMPRESS #include <my_sys.h> +#include <m_string.h> #include <zlib.h> /* 1.2.2.1 +2 -2 php4/ext/mysql/libmysql/my_create.c Index: my_create.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_create.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_create.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_create.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -6,7 +6,7 @@ #include <my_dir.h> #include "mysys_err.h" #include <errno.h> -#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) #include <share.h> #endif @@ -34,7 +34,7 @@ #elif defined(VMS) fd = open((my_string) FileName, access_flags | O_CREAT, 0, "ctx=stm","ctx=bin"); -#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__) +#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) if (access_flags & O_SHARE) fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); 1.2.2.1 +11 -3 php4/ext/mysql/libmysql/my_getwd.c Index: my_getwd.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_getwd.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_getwd.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_getwd.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -14,6 +14,9 @@ #include <dos.h> #include <direct.h> #endif +#if defined(OS2) +#include <direct.h> +#endif #ifdef __EMX__ // chdir2 support also drive change @@ -79,16 +82,16 @@ int res; size_s length; my_string start,pos; -#if defined(VMS) || defined(MSDOS) +#if defined(VMS) || defined(MSDOS) || defined(OS2) char buff[FN_REFLEN]; #endif DBUG_ENTER("my_setwd"); DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags)); start=(my_string) dir; -#if defined(MSDOS) /* MSDOS chdir can't change drive */ +#if defined(MSDOS) || defined(OS2) /* OS2/MSDOS chdir can't change drive */ #if !defined(_DDL) && !defined(WIN32) - if ((pos=strchr(dir,FN_DEVCHAR)) != 0) + if ((pos=(char*) strchr(dir,FN_DEVCHAR)) != 0) { uint drive,drives; @@ -96,8 +99,13 @@ drive=(uint) (toupper(dir[0])-'A'+1); drives= (uint) -1; if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32) { +#ifdef OS2 + _chdrive(drive); + drives = _getdrive(); +#else _dos_setdrive(drive,&drives); _dos_getdrive(&drives); +#endif } if (drive != drives) { 1.2.2.1 +2 -2 php4/ext/mysql/libmysql/my_init.c Index: my_init.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_init.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_init.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_init.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -60,7 +60,7 @@ pthread_init(); /* Must be called before DBUG_ENTER */ #endif my_thread_global_init(); -#ifndef __WIN__ +#if !defined( __WIN__) && !defined(OS2) sigfillset(&my_signals); /* signals blocked by mf_brkhant */ #endif #endif /* THREAD */ @@ -112,6 +112,7 @@ DBUG_PRINT("error",("%s",errbuff[0])); } } + free_charsets(); if (infoflag & MY_GIVE_INFO || info_file != stderr) { #ifdef HAVE_GETRUSAGE @@ -136,7 +137,6 @@ #if defined(MSDOS) && !defined(__WIN__) fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); #endif - free_charsets(); #if defined(SAFEMALLOC) TERMINATE(stderr); /* Give statistic on screen */ #elif defined(__WIN__) && defined(_MSC_VER) 1.2.2.1 +9 -6 php4/ext/mysql/libmysql/my_lib.c Index: my_lib.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_lib.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_lib.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_lib.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -13,7 +13,9 @@ # include <dirent.h> # define NAMLEN(dirent) strlen((dirent)->d_name) #else +#ifndef OS2 # define dirent direct +#endif # define NAMLEN(dirent) (dirent)->d_namlen # if defined(HAVE_SYS_NDIR_H) # include <sys/ndir.h> @@ -36,6 +38,11 @@ #include <iodef.h> #include <descrip.h> #endif + +#ifdef OS2 +#include "my_os2dirsrch.h" +#endif + #if defined(THREAD) && defined(HAVE_READDIR_R) #define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C) #else @@ -323,9 +330,7 @@ ***************************************************************************** */ -MY_DIR *my_dir(path, MyFlags) -const char *path; -myf MyFlags; +MY_DIR *my_dir(const char *path, myf MyFlags) { struct fileinfo *fnames; char *buffer, *obuffer, *tempptr; @@ -461,9 +466,7 @@ ** At MSDOS you always get stat of files, but time is in packed MSDOS-format ******************************************************************************/ -MY_DIR *my_dir(path, MyFlags) -const char *path; -myf MyFlags; +MY_DIR *my_dir(const char* path, myf MyFlags) { struct fileinfo *fnames; char *buffer, *obuffer, *tempptr; 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/my_malloc.c Index: my_malloc.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_malloc.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_malloc.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_malloc.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -19,7 +19,7 @@ if (!Size) Size=1; /* Safety */ - if ((point = malloc(Size)) == NULL) + if ((point = (char*)malloc(Size)) == NULL) { my_errno=errno; if (MyFlags & MY_FAE) 1.2.2.1 +4 -5 php4/ext/mysql/libmysql/my_open.c Index: my_open.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_open.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_open.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_open.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -6,7 +6,7 @@ #include "mysys_err.h" #include <my_dir.h> #include <errno.h> -#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) #include <share.h> #endif @@ -21,7 +21,7 @@ DBUG_ENTER("my_open"); DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", FileName, Flags, MyFlags)); -#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) if (Flags & O_SHARE) fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); @@ -61,8 +61,8 @@ pthread_mutex_destroy(&my_file_info[fd].mutex); #endif my_file_info[fd].type = UNOPEN; - my_file_opened--; } + my_file_opened--; pthread_mutex_unlock(&THR_LOCK_open); DBUG_RETURN(err); } /* my_close */ @@ -82,9 +82,8 @@ my_error(EE_OUT_OF_FILERESOURCES, MYF(ME_BELL+ME_WAITTANG), FileName, my_errno); return(-1); -#else - thread_safe_increment(my_file_opened,&THR_LOCK_open); #endif + thread_safe_increment(my_file_opened,&THR_LOCK_open); return(fd); /* safeguard */ } pthread_mutex_lock(&THR_LOCK_open); 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/my_pthread.c Index: my_pthread.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_pthread.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_pthread.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_pthread.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -131,7 +131,7 @@ ** Author: Gary Wisniewski <garyw****@spide*****>, much modified by Monty ****************************************************************************/ -#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) +#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(OS2) #if !defined(DONT_USE_SIGSUSPEND) 1.2.2.1 +58 -10 php4/ext/mysql/libmysql/my_pthread.h Index: my_pthread.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_pthread.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_pthread.h 29 Apr 2002 02:30:53 -0000 1.2 +++ my_pthread.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -11,9 +11,23 @@ #define ETIME ETIMEDOUT /* For FreeBSD */ #endif -#if defined(__WIN__) +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#if defined(__WIN__) || defined(OS2) + +#ifdef OS2 +typedef ULONG HANDLE; +typedef ULONG DWORD; +typedef int sigset_t; +#endif + +#ifdef OS2 +typedef HMTX pthread_mutex_t; +#else typedef CRITICAL_SECTION pthread_mutex_t; +#endif typedef HANDLE pthread_t; typedef struct thread_attr { DWORD dwStackSize ; @@ -32,19 +46,30 @@ typedef struct { uint32 waiting; +#ifdef OS2 + HEV semaphore; +#else HANDLE semaphore; +#endif } pthread_cond_t; +#ifndef OS2 struct timespec { /* For pthread_cond_timedwait() */ time_t tv_sec; long tv_nsec; }; +#endif typedef int pthread_mutexattr_t; #define win_pthread_self my_thread_var->pthread_self +#ifdef OS2 +#define pthread_handler_decl(A,B) void * _Optlink A(void *B) +typedef void * (_Optlink *pthread_handler)(void *); +#else #define pthread_handler_decl(A,B) void * __cdecl A(void *B) typedef void * (__cdecl *pthread_handler)(void *); +#endif void win_pthread_init(void); int win_pthread_setspecific(void *A,void *B,uint length); @@ -64,12 +89,14 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/ +#ifndef OS2 #define ETIMEDOUT 145 /* Win32 doesn't have this */ #define getpid() GetCurrentThreadId() +#endif #define pthread_self() win_pthread_self -#define HAVE_LOCALTIME_R -#define _REENTRANT -#define HAVE_PTHREAD_ATTR_SETSTACKSIZE +#define HAVE_LOCALTIME_R 1 +#define _REENTRANT 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 #ifdef USE_TLS /* For LIBMYSQL.DLL */ #undef SAFE_MUTEX /* This will cause conflicts */ @@ -91,13 +118,24 @@ #endif /* USE_TLS */ #define pthread_equal(A,B) ((A) == (B)) +#ifdef OS2 +int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *); +int pthread_mutex_lock (pthread_mutex_t *); +int pthread_mutex_unlock (pthread_mutex_t *); +int pthread_mutex_destroy (pthread_mutex_t *); +#define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A) +#define pthread_kill(A,B) raise(B) +#define pthread_exit(A) pthread_dummy() +#else #define pthread_mutex_init(A,B) InitializeCriticalSection(A) #define pthread_mutex_lock(A) (EnterCriticalSection(A),0) #define pthread_mutex_unlock(A) LeaveCriticalSection(A) #define pthread_mutex_destroy(A) DeleteCriticalSection(A) #define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) -/* Dummy defines for easier code */ #define pthread_kill(A,B) pthread_dummy(0) +#endif /* OS2 */ + +/* Dummy defines for easier code */ #define pthread_attr_setdetachstate(A,B) pthread_dummy(0) #define my_pthread_attr_setprio(A,B) pthread_attr_setprio(A,B) #define pthread_attr_setscope(A,B) @@ -297,12 +335,15 @@ #undef HAVE_GETHOSTBYADDR_R /* No definition */ #endif -#ifndef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC +#if defined(OS2) +#define my_pthread_getspecific(T,A) ((T) &(A)) +#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) +#elif !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC) #define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B)) #else #define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B)) void *my_pthread_getspecific_imp(pthread_key_t key); -#endif +#endif /* OS2 */ #ifndef HAVE_LOCALTIME_R struct tm *localtime_r(const time_t *clock, struct tm *res); @@ -521,12 +562,14 @@ struct st_my_thread_var { int thr_errno; - pthread_cond_t suspend, *current_cond; - pthread_mutex_t mutex, *current_mutex; + pthread_cond_t suspend; + pthread_mutex_t mutex; + pthread_mutex_t * volatile current_mutex; + pthread_cond_t * volatile current_cond; pthread_t pthread_self; long id; int cmp_length; - volatile int abort; + int volatile abort; #ifndef DBUG_OFF gptr dbug; char name[THREAD_NAME_SIZE+1]; @@ -562,4 +605,9 @@ #endif /* SAFE_STATISTICS */ #endif /* HAVE_ATOMIC_ADD */ #endif /* thread_safe_increment */ + +#ifdef __cplusplus +} +#endif + #endif /* _my_ptread_h */ 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/my_realloc.c Index: my_realloc.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_realloc.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_realloc.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_realloc.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -35,7 +35,7 @@ free(oldpoint); } #else - if ((point = realloc(oldpoint,Size)) == NULL) + if ((point = (char*)realloc(oldpoint,Size)) == NULL) { if (MyFlags & MY_FREE_ON_ERROR) my_free(oldpoint,MyFLAGS); 1.2.2.1 +2 -1 php4/ext/mysql/libmysql/my_static.c Index: my_static.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_static.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_static.c 29 Apr 2002 02:30:53 -0000 1.2 +++ my_static.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -6,7 +6,7 @@ a shared library */ -#ifndef stdin +#if !defined(stdin) || defined(OS2) #include "mysys_priv.h" #include "my_static.h" #include "my_alarm.h" @@ -83,4 +83,5 @@ my_bool NEAR my_disable_locking=0; my_bool NEAR my_disable_async_io=0; my_bool NEAR my_disable_flush_key_blocks=0; +my_bool NEAR my_disable_symlinks=0; my_bool NEAR mysys_uses_curses=0; 1.2.2.1 +4 -1 php4/ext/mysql/libmysql/my_sys.h Index: my_sys.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_sys.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_sys.h 29 Apr 2002 02:30:54 -0000 1.2 +++ my_sys.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -112,6 +112,7 @@ extern ulonglong safemalloc_mem_limit; #else #define my_checkmalloc() (0) +#undef TERMINATE #define TERMINATE(A) {} #define QUICK_SAFEMALLOC #define NORMAL_SAFEMALLOC @@ -194,7 +195,7 @@ extern ulong my_default_record_cache_size; extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, - NEAR my_disable_flush_key_blocks; + NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; extern char *defaults_extra_file; @@ -371,6 +372,8 @@ extern File my_create_with_symlink(const char *linkname, const char *filename, int createflags, int access_flags, myf MyFlags); +extern int my_delete_with_symlink(const char *name, myf MyFlags); +extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); extern int my_symlink(const char *content, const char *linkname, myf MyFlags); extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags); extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset, 1.2.2.1 +23 -4 php4/ext/mysql/libmysql/my_tempnam.c Index: my_tempnam.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_tempnam.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_tempnam.c 29 Apr 2002 02:30:54 -0000 1.2 +++ my_tempnam.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -1,6 +1,13 @@ /* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB This file is public domain and comes with NO WARRANTY of any kind */ +/* + This function is only used by some old ISAM code. + When we remove ISAM support from MySQL, we should also delete this file + + One should instead use the functions in mf_tempfile.c +*/ + #include "mysys_priv.h" #include <m_string.h> #include "my_static.h" @@ -12,7 +19,7 @@ #endif #ifdef HAVE_TEMPNAM -#ifndef MSDOS +#if !defined( MSDOS) && !defined(OS2) extern char **environ; #endif #endif @@ -77,14 +84,26 @@ temp[1]= 0; dir=temp; } - old_env=environ; +#ifdef OS2 + // changing environ variable doesn't work with VACPP + char buffer[256]; + sprintf( buffer, "TMP=%s", dir); + // remove ending backslash + if (buffer[strlen(buffer)-1] == '\\') + buffer[strlen(buffer)-1] = '\0'; + putenv( buffer); +#else + old_env=(char**)environ; if (dir) { /* Don't use TMPDIR if dir is given */ - environ=temp_env; + environ=(const char**)temp_env; /* May give warning */ temp_env[0]=0; } +#endif res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */ - environ=old_env; +#ifndef OS2 + environ=(const char**)old_env; /* May give warning */ +#endif if (!res) DBUG_PRINT("error",("Got error: %d from tempnam",errno)); return res; 1.2.2.1 +3 -3 php4/ext/mysql/libmysql/my_thr_init.c Index: my_thr_init.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_thr_init.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_thr_init.c 29 Apr 2002 02:30:54 -0000 1.2 +++ my_thr_init.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -58,7 +58,7 @@ pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST); pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST); pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST); -#ifdef __WIN__ +#if defined( __WIN__) || defined(OS2) win_pthread_init(); #endif #ifndef HAVE_LOCALTIME_R @@ -146,11 +146,11 @@ pthread_cond_destroy(&tmp->suspend); #endif pthread_mutex_destroy(&tmp->mutex); -#if !defined(__WIN__) || defined(USE_TLS) +#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS) free(tmp); #endif } -#if !defined(__WIN__) || defined(USE_TLS) +#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS) pthread_setspecific(THR_KEY_mysys,0); #endif } 1.2.2.1 +1 -0 php4/ext/mysql/libmysql/my_write.c Index: my_write.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/my_write.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- my_write.c 29 Apr 2002 02:30:54 -0000 1.2 +++ my_write.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -5,6 +5,7 @@ #include "mysys_err.h" #include <errno.h> + /* Write a chunk of bytes to a file */ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags) 1.2.2.1 +5 -1 php4/ext/mysql/libmysql/mysql.h Index: mysql.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/mysql.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mysql.h 29 Apr 2002 02:30:54 -0000 1.2 +++ mysql.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -22,6 +22,9 @@ #ifndef _global_h /* If not standard header */ #include <sys/types.h> +#ifdef __LCC__ +#include <winsock.h> /* For windows */ +#endif typedef char my_bool; #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) #define __WIN__ @@ -126,7 +129,8 @@ enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME}; + MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, + MYSQL_OPT_LOCAL_INFILE}; enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT}; 1.2.2.1 +6 -9 php4/ext/mysql/libmysql/mysql_com.h Index: mysql_com.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/mysql_com.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mysql_com.h 29 Apr 2002 02:30:54 -0000 1.2 +++ mysql_com.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -204,22 +204,19 @@ unsigned long *salt,my_bool old_ver); char *get_tty_password(char *opt_message); void hash_password(unsigned long *result, const char *password); -#ifdef __cplusplus -} -#endif /* Some other useful functions */ void my_init(void); void load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv); +my_bool my_thread_init(void); +void my_thread_end(void); -#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ - -#ifdef __WIN__ -#define socket_errno WSAGetLastError() -#else -#define socket_errno errno +#ifdef __cplusplus +} #endif + +#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ #endif 1.2.2.1 +2 -5 php4/ext/mysql/libmysql/mysql_version.h Index: mysql_version.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/mysql_version.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mysql_version.h 29 Apr 2002 02:30:54 -0000 1.2 +++ mysql_version.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -7,14 +7,11 @@ #include <custom_conf.h> #else #define PROTOCOL_VERSION 10 -#define MYSQL_SERVER_VERSION "3.23.39" +#define MYSQL_SERVER_VERSION "3.23.49" #define MYSQL_SERVER_SUFFIX "" #define FRM_VER 6 -#define MYSQL_VERSION_ID 32339 - -#ifndef MYSQL_PORT +#define MYSQL_VERSION_ID 32349 #define MYSQL_PORT 3306 -#endif #ifndef MYSQL_UNIX_ADDR #define MYSQL_UNIX_ADDR "/tmp/mysql.sock" 1.2.2.1 +11 -1 php4/ext/mysql/libmysql/mysqld_error.h Index: mysqld_error.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/mysqld_error.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mysqld_error.h 29 Apr 2002 02:30:54 -0000 1.2 +++ mysqld_error.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -208,4 +208,14 @@ #define ER_LOCK_WAIT_TIMEOUT 1205 #define ER_LOCK_TABLE_FULL 1206 #define ER_READ_ONLY_TRANSACTION 1207 -#define ER_ERROR_MESSAGES 208 +#define ER_DROP_DB_WITH_READ_LOCK 1208 +#define ER_CREATE_DB_WITH_READ_LOCK 1209 +#define ER_WRONG_ARGUMENTS 1210 +#define ER_NO_PERMISSION_TO_CREATE_USER 1211 +#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 +#define ER_LOCK_DEADLOCK 1213 +#define ER_TABLE_CANT_HANDLE_FULLTEXT 1214 +#define ER_CANNOT_ADD_FOREIGN 1215 +#define ER_NO_REFERENCED_ROW 1216 +#define ER_ROW_IS_REFERENCED 1217 +#define ER_ERROR_MESSAGES 218 1.2.2.1 +17 -10 php4/ext/mysql/libmysql/net.c Index: net.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/net.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- net.c 29 Apr 2002 02:30:54 -0000 1.2 +++ net.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -20,6 +20,7 @@ #include <signal.h> #include <errno.h> #include <sys/types.h> +#include <violite.h> #ifdef MYSQL_SERVER ulong max_allowed_packet=65536; @@ -53,13 +54,19 @@ #define RETRY_COUNT mysqld_net_retry_count extern ulong mysqld_net_retry_count; #else + +#ifdef OS2 /* avoid name conflict */ +#define thr_alarm_t thr_alarm_t_net +#define ALARM ALARM_net +#endif + typedef my_bool thr_alarm_t; typedef my_bool ALARM; -#define thr_alarm_init(A) (*A)=0 -#define thr_alarm_in_use(A) (*(A)) +#define thr_alarm_init(A) (*(A))=0 +#define thr_alarm_in_use(A) (*(A)!= 0) #define thr_end_alarm(A) #define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) -static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) +inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) { *A=1; return 0; @@ -109,7 +116,7 @@ if (vio != 0) /* If real connection */ { net->fd = vio_fd(vio); /* For perl DBI/DBD */ -#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) +#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) && !defined(OS2) if (!(test_flags & TEST_BLOCKING)) vio_blocking(vio, FALSE); #endif @@ -256,7 +263,7 @@ int length; char *pos,*end; thr_alarm_t alarmed; -#if !defined(__WIN__) && !defined(__EMX__) +#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) ALARM alarm_buff; #endif uint retry_count=0; @@ -314,7 +321,7 @@ if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0) { my_bool interrupted = vio_should_retry(net->vio); -#if (!defined(__WIN__) && !defined(__EMX__)) +#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed)) { if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff)) @@ -351,7 +358,7 @@ #endif /* EXTRA_DEBUG */ } #if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) - if (vio_errno(net->vio) == EINTR) + if (vio_errno(net->vio) == SOCKET_EINTR) { DBUG_PRINT("warning",("Interrupted write. Retrying...")); continue; @@ -411,7 +418,7 @@ if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L) { my_bool interrupted = vio_should_retry(net->vio); - if (!thr_got_alarm(&alarmed) && interrupted) + if (!thr_got_alarm(alarmed) && interrupted) { /* Probably in MIT threads */ if (retry_count++ < RETRY_COUNT) continue; @@ -433,7 +440,7 @@ uint i,retry_count=0; ulong len=packet_error; thr_alarm_t alarmed; -#if (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) +#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER) ALARM alarm_buff; #endif my_bool net_blocking=vio_is_blocking(net->vio); @@ -460,7 +467,7 @@ DBUG_PRINT("info",("vio_read returned %d, errno: %d", length, vio_errno(net->vio))); -#if (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) +#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER) /* We got an error that there was no data on the socket. We now set up an alarm to not 'read forever', change the socket to non blocking 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/raid.h Index: raid.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/raid.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- raid.h 29 Apr 2002 02:30:54 -0000 1.2 +++ raid.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -19,7 +19,7 @@ } #endif -#ifdef USE_RAID +#if defined(USE_RAID) && !defined(DONT_USE_RAID) #ifdef __GNUC__ #pragma interface /* gcc class implementation */ 1.2.2.1 +2 -1 php4/ext/mysql/libmysql/strmake.c Index: strmake.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/strmake.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- strmake.c 29 Apr 2002 02:30:54 -0000 1.2 +++ strmake.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -8,7 +8,8 @@ strmake(dst,src,length) moves length characters, or until end, of src to dst and appends a closing NUL to dst. - strmake() returns pointer to closing null; + Note that is strlen(src) >= length then dst[length] will be set to \0 + strmake() returns pointer to closing null */ #include <global.h> 1.2.2.1 +10 -6 php4/ext/mysql/libmysql/strto.c Index: strto.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/strto.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- strto.c 29 Apr 2002 02:30:54 -0000 1.2 +++ strto.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -28,13 +28,17 @@ #include "my_sys.h" /* defines errno */ #include <errno.h> -#ifdef MYSQL_LONGLONG +#undef strtoull +#undef strtoll +#undef strtoul +#undef strtol +#ifdef USE_LONGLONG #define UTYPE_MAX (~(ulonglong) 0) #define TYPE_MIN LONGLONG_MIN #define TYPE_MAX LONGLONG_MAX #define longtype longlong #define ulongtype ulonglong -#ifdef UNSIGNED +#ifdef USE_UNSIGNED #define function ulongtype strtoull #else #define function longtype strtoll @@ -45,7 +49,7 @@ #define TYPE_MAX LONG_MAX #define longtype long #define ulongtype unsigned long -#ifdef UNSIGNED +#ifdef USE_UNSIGNED #define function ulongtype strtoul #else #define function longtype strtol @@ -156,7 +160,7 @@ if (endptr != NULL) *endptr = (char *) s; -#ifndef UNSIGNED +#ifndef USE_UNSIGNED /* Check for a value that is within the range of `unsigned long int', but outside the range of `long int'. */ if (negative) @@ -171,7 +175,7 @@ if (overflow) { my_errno=ERANGE; -#ifdef UNSIGNED +#ifdef USE_UNSIGNED return UTYPE_MAX; #else return negative ? TYPE_MIN : TYPE_MAX; @@ -179,7 +183,7 @@ } /* Return the result of the appropriate sign. */ - return (negative ? -((longtype) i) : i); + return (negative ? -((longtype) i) : (longtype) i); noconv: /* There was no number to convert. */ 1.2.2.1 +2 -2 php4/ext/mysql/libmysql/strtoll.c Index: strtoll.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/strtoll.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- strtoll.c 29 Apr 2002 02:30:54 -0000 1.2 +++ strtoll.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -5,7 +5,7 @@ #include <global.h> #include <m_string.h> -#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG) -#define MYSQL_LONGLONG +#if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG) +#define USE_LONGLONG #include "strto.c" #endif 1.2.2.1 +2 -2 php4/ext/mysql/libmysql/strtoull.c Index: strtoull.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/strtoull.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- strtoull.c 29 Apr 2002 02:30:54 -0000 1.2 +++ strtoull.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -6,7 +6,7 @@ #include <global.h> #include <m_string.h> #if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG) -#define UNSIGNED -#define MYSQL_LONGLONG +#define USE_UNSIGNED +#define USE_LONGLONG #include "strto.c" #endif 1.2.2.1 +1 -1 php4/ext/mysql/libmysql/thr_alarm.h Index: thr_alarm.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/thr_alarm.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- thr_alarm.h 29 Apr 2002 02:30:54 -0000 1.2 +++ thr_alarm.h 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -51,7 +51,7 @@ rf_SetTimer crono; } thr_alarm_entry; -#elif defined(__EMX__) +#elif defined(__EMX__) || defined(OS2) typedef struct st_thr_alarm_entry { 1.2.2.1 +44 -26 php4/ext/mysql/libmysql/violite.c Index: violite.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mysql/libmysql/violite.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- violite.c 29 Apr 2002 02:30:54 -0000 1.2 +++ violite.c 9 Jul 2002 09:14:36 -0000 1.2.2.1 @@ -21,25 +21,30 @@ #ifdef HAVE_POLL #include <sys/poll.h> #endif - -#if defined(__EMX__) +#ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__FreeBSD__) +#include <netinet/in_systm.h> +#include <netinet/ip.h> +#if !defined(alpha_linux_port) +#include <netinet/tcp.h> +#endif +#endif + +#if defined(__EMX__) || defined(OS2) #define ioctlsocket ioctl -#endif /* defined(__EMX__) */ +#endif /* defined(__EMX__) */ #if defined(MSDOS) || defined(__WIN__) -#ifdef __WIN__ -#undef errno -#undef EINTR -#undef EAGAIN -#define errno WSAGetLastError() -#define EINTR WSAEINTR -#define EAGAIN WSAEINPROGRESS -#endif /* __WIN__ */ #define O_NONBLOCK 1 /* For emulation of fcntl() */ #endif #ifndef EWOULDBLOCK -#define EWOULDBLOCK EAGAIN +#define SOCKET_EWOULDBLOCK SOCKET_EAGAIN #endif #ifndef __WIN__ @@ -89,9 +94,12 @@ sprintf(vio->desc, (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"), vio->sd); -#if !defined(___WIN__) && !defined(__EMX__) +#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(NO_FCNTL_NONBLOCK) vio->fcntl_mode = fcntl(sd, F_GETFL); +#elif defined(HAVE_SYS_IOCTL_H) /* hpux */ + /* Non blocking sockets doesn't work good on HPUX 11.0 */ + (void) ioctl(sd,FIOSNBIO,0); #endif #else /* !defined(__WIN__) && !defined(__EMX__) */ { @@ -135,7 +143,7 @@ int vio_errno(Vio *vio __attribute__((unused))) { - return errno; /* On Win32 this mapped to WSAGetLastError() */ + return socket_errno; /* On Win32 this mapped to WSAGetLastError() */ } @@ -143,13 +151,18 @@ { int r; DBUG_ENTER("vio_read"); - DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size)); -#ifdef __WIN__ + DBUG_PRINT("enter", ("sd=%d size=%d", vio->sd, size)); +#if defined( __WIN__) || defined(OS2) if (vio->type == VIO_TYPE_NAMEDPIPE) { DWORD length; +#ifdef OS2 + if (!DosRead((HFILE)vio->hPipe, buf, size, &length)) + DBUG_RETURN(-1); +#else if (!ReadFile(vio->hPipe, buf, size, &length, NULL)) DBUG_RETURN(-1); +#endif DBUG_RETURN(length); } r = recv(vio->sd, buf, size,0); @@ -160,7 +173,7 @@ #ifndef DBUG_OFF if (r < 0) { - DBUG_PRINT("error", ("Got error %d during read",errno)); + DBUG_PRINT("vio_error", ("Got error %d during read",socket_errno)); } #endif /* DBUG_OFF */ DBUG_PRINT("exit", ("%d", r)); @@ -172,13 +185,18 @@ { int r; DBUG_ENTER("vio_write"); - DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size)); -#ifdef __WIN__ + DBUG_PRINT("enter", ("sd=%d size=%d", vio->sd, size)); +#if defined( __WIN__) || defined(OS2) if ( vio->type == VIO_TYPE_NAMEDPIPE) { DWORD length; +#ifdef OS2 + if (!DosWrite((HFILE)vio->hPipe, (char*) buf, size, &length)) + DBUG_RETURN(-1); +#else if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL)) DBUG_RETURN(-1); +#endif DBUG_RETURN(length); } r = send(vio->sd, buf, size,0); @@ -188,7 +206,7 @@ #ifndef DBUG_OFF if (r < 0) { - DBUG_PRINT("error", ("Got error on write: %d",errno)); + DBUG_PRINT("vio_error", ("Got error on write: %d",socket_errno)); } #endif /* DBUG_OFF */ DBUG_PRINT("exit", ("%d", r)); @@ -202,7 +220,7 @@ DBUG_ENTER("vio_blocking"); DBUG_PRINT("enter", ("set_blocking_mode: %d", (int) set_blocking_mode)); -#if !defined(___WIN__) && !defined(__EMX__) +#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(NO_FCNTL_NONBLOCK) if (vio->sd >= 0) @@ -282,7 +300,7 @@ int r=0; uint opt = 0; DBUG_ENTER("vio_keepalive"); - DBUG_PRINT("enter", ("sd=%d, set_keep_alive=%d", vio->sd, (int) + DBUG_PRINT("enter", ("sd=%d set_keep_alive=%d", vio->sd, (int) set_keep_alive)); if (vio->type != VIO_TYPE_NAMEDPIPE) { @@ -298,8 +316,8 @@ my_bool vio_should_retry(Vio * vio __attribute__((unused))) { - int en = errno; - return en == EAGAIN || en == EINTR || en == EWOULDBLOCK; + int en = socket_errno; + return en == SOCKET_EAGAIN || en == SOCKET_EINTR || en == SOCKET_EWOULDBLOCK; } @@ -327,7 +345,7 @@ } if (r) { - DBUG_PRINT("error", ("close() failed, error: %d",errno)); + DBUG_PRINT("vio_error", ("close() failed, error: %d",socket_errno)); /* FIXME: error handling (not critical for MySQL) */ } vio->type= VIO_CLOSED; @@ -366,7 +384,7 @@ if (getpeername(vio->sd, (struct sockaddr *) (& (vio->remote)), &addrLen) != 0) { - DBUG_PRINT("exit", ("getpeername, error: %d", errno)); + DBUG_PRINT("exit", ("getpeername, error: %d", socket_errno)); DBUG_RETURN(1); } my_inet_ntoa(vio->remote.sin_addr,buf); No revision No revision 1.2.2.1 +5 -5 php4/ext/ncurses/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ncurses/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:54 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:37 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.11 2002/03/12 16:48:12 sas Exp $ +dnl $Id: config.m4,v 1.12 2002/06/26 22:22:47 avsm Exp $ dnl PHP_ARG_WITH(ncurses, for ncurses support, @@ -44,10 +44,10 @@ -L$NCURSES_DIR/lib -lm ]) - AC_CHECK_LIB(ncurses, color_set, [AC_DEFINE(HAVE_NCURSES_COLOR_SET, 1, [ ])]) - AC_CHECK_LIB(ncurses, slk_color, [AC_DEFINE(HAVE_NCURSES_SLK_COLOR, 1, [ ])]) - AC_CHECK_LIB(ncurses, asume_default_colors, [AC_DEFINE(HAVE_NCURSES_ASSUME_DEFAULT_COLORS, 1, [ ])]) - AC_CHECK_LIB(ncurses, use_extended_names, [AC_DEFINE(HAVE_NCURSES_USE_EXTENDED_NAMES, 1, [ ])]) + AC_CHECK_LIB($LIBNAME, color_set, [AC_DEFINE(HAVE_NCURSES_COLOR_SET, 1, [ ])]) + AC_CHECK_LIB($LIBNAME, slk_color, [AC_DEFINE(HAVE_NCURSES_SLK_COLOR, 1, [ ])]) + AC_CHECK_LIB($LIBNAME, asume_default_colors, [AC_DEFINE(HAVE_NCURSES_ASSUME_DEFAULT_COLORS, 1, [ ])]) + AC_CHECK_LIB($LIBNAME, use_extended_names, [AC_DEFINE(HAVE_NCURSES_USE_EXTENDED_NAMES, 1, [ ])]) PHP_NEW_EXTENSION(ncurses, ncurses.c ncurses_fe.c ncurses_functions.c, $ext_shared, cli) PHP_SUBST(NCURSES_SHARED_LIBADD) 1.2.2.1 +1 -1 php4/ext/ncurses/example1.php Index: example1.php =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ncurses/example1.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- example1.php 29 Apr 2002 02:30:54 -0000 1.2 +++ example1.php 9 Jul 2002 09:14:37 -0000 1.2.2.1 @@ -22,7 +22,7 @@ if($n>26)$n=0; } } -} ncurses_getch(); +} ?> No revision No revision 1.2.2.1 +1 -3 php4/ext/ncurses/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ncurses/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:54 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:37 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +5 -4 php4/ext/odbc/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/odbc/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:55 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:37 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.51 2002/03/12 16:49:55 sas Exp $ +dnl $Id: config.m4,v 1.53 2002/06/26 21:44:58 sniper Exp $ dnl dnl @@ -535,10 +535,10 @@ fi if test -n "$ODBC_TYPE"; then - INCLUDES="$INCLUDES $ODBC_INCLUDE" if test "$ODBC_TYPE" != "dbmaker"; then if test "$shared" != "yes"; then - EXTRA_LIBS="$EXTRA_LIBS $ODBC_LFLAGS $ODBC_LIBS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ODBC_LFLAGS" + EXTRA_LIBS="$EXTRA_LIBS $ODBC_LIBS" fi fi AC_DEFINE(HAVE_UODBC,1,[ ]) @@ -548,5 +548,6 @@ PHP_SUBST_OLD(ODBC_LIBS) PHP_SUBST_OLD(ODBC_LFLAGS) PHP_SUBST_OLD(ODBC_TYPE) - PHP_NEW_EXTENSION(odbc, php_odbc.c, $shared) + + PHP_NEW_EXTENSION(odbc, php_odbc.c, $shared,, $ODBC_INCLUDE) fi 1.2.2.2 +2 -3 php4/ext/odbc/php_odbc.c Index: php_odbc.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/odbc/php_odbc.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_odbc.c 2 May 2002 22:01:52 -0000 1.2.2.1 +++ php_odbc.c 9 Jul 2002 09:14:37 -0000 1.2.2.2 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.c,v 1.126 2002/04/30 13:17:48 kalowsky Exp $ */ +/* $Id: php_odbc.c,v 1.127 2002/06/14 00:07:13 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -30,13 +30,12 @@ #include "php_globals.h" #include "ext/standard/info.h" - #include "ext/standard/php_string.h" #include "ext/standard/php_standard.h" #include "php_odbc.h" +#include "php_odbc_includes.h" #include "php_globals.h" - #if HAVE_UODBC 1.2.2.1 +3 -249 php4/ext/odbc/php_odbc.h Index: php_odbc.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/odbc/php_odbc.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_odbc.h 29 Apr 2002 02:30:55 -0000 1.2 +++ php_odbc.h 9 Jul 2002 09:14:37 -0000 1.2.2.1 @@ -18,181 +18,21 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.h,v 1.46 2002/03/12 02:27:03 sniper Exp $ */ +/* $Id: php_odbc.h,v 1.47 2002/06/14 00:07:15 sniper Exp $ */ #ifndef PHP_ODBC_H #define PHP_ODBC_H #if HAVE_UODBC #define ODBCVER 0x0250 -/*#ifndef MSVC5 -#define FAR -#endif -*/ + #ifdef ZTS #include "TSRM.h" #endif -/* checking in the same order as in configure.in */ - -#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) /* Solid Server */ - -#define ODBC_TYPE "Solid" -#if defined(HAVE_SOLID) -# include <cli0core.h> -# include <cli0ext1.h> -# include <cli0env.h> -#elif defined(HAVE_SOLID_30) -# include <cli0cli.h> -# include <cli0defs.h> -# include <cli0env.h> -#elif defined(HAVE_SOLID_35) -# if !defined(PHP_WIN32) -# include <sqlunix.h> -# endif /* end: #if !defined(PHP_WIN32) */ -# include <sqltypes.h> -# include <sqlucode.h> -# include <sqlext.h> -# include <sql.h> -#endif /* end: #if defined(HAVE_SOLID) */ -#undef HAVE_SQL_EXTENDED_FETCH -PHP_FUNCTION(solid_fetch_prev); -#define SQLSMALLINT SWORD -#define SQLUSMALLINT UWORD -#ifndef SQL_SUCCEEDED -#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) -#endif - -#elif defined(HAVE_EMPRESS) /* Empress */ - -#define ODBC_TYPE "Empress" -#include <sql.h> -#include <sqlext.h> -#undef HAVE_SQL_EXTENDED_FETCH - -#elif defined(HAVE_ADABAS) /* Adabas D */ - -#define ODBC_TYPE "Adabas D" -#include <WINDOWS.H> -#include <sql.h> -#include <sqlext.h> -#define HAVE_SQL_EXTENDED_FETCH 1 -#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) -#define SQLINTEGER ULONG -#define SQLUSMALLINT USHORT - -#elif defined(HAVE_SAPDB) /* SAP DB */ - -#define ODBC_TYPE "SAP DB" -#include <WINDOWS.H> -#include <sql.h> -#include <sqlext.h> -#define HAVE_SQL_EXTENDED_FETCH 1 -#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) - -#elif defined(HAVE_IODBC) /* iODBC library */ - -#define ODBC_TYPE "iODBC" -#include <isql.h> -#include <isqlext.h> -#define HAVE_SQL_EXTENDED_FETCH 1 -#define SQL_FD_FETCH_ABSOLUTE 0x00000010L -#define SQL_CURSOR_DYNAMIC 2UL -#define SQL_NO_TOTAL (-4) -#define SQL_SO_DYNAMIC 0x00000004L -#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) -#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET) -#ifndef SQL_SUCCEEDED -#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0) -#endif - -#elif defined(HAVE_UNIXODBC) /* unixODBC library */ - -#ifdef CHAR -#undef CHAR -#endif - -#ifdef SQLCHAR -#undef SQLCHAR -#endif - -#define ODBC_TYPE "unixODBC" -#include <sql.h> -#include <sqlext.h> -#define HAVE_SQL_EXTENDED_FETCH 1 - -#elif defined(HAVE_ESOOB) /* Easysoft ODBC-ODBC Bridge library */ - -#define ODBC_TYPE "ESOOB" -#include <sql.h> -#include <sqlext.h> -#define HAVE_SQL_EXTENDED_FETCH 1 - -#elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */ - -#define ODBC_TYPE "Openlink" -#include <iodbc.h> -#include <isql.h> -#include <isqlext.h> -#include <udbcext.h> -#define HAVE_SQL_EXTENDED_FETCH 1 -#define SQLSMALLINT SWORD -#define SQLUSMALLINT UWORD - -#elif defined(HAVE_BIRDSTEP) /* Raima Birdstep */ - -#define ODBC_TYPE "Birdstep" -#define UNIX -/* - * Extended Fetch in the Birdstep ODBC API is incapable of returning long varchar (memo) fields. - * So the following line has been commented-out to accomadate. - KNS - * - * #define HAVE_SQL_EXTENDED_FETCH 1 - */ -#include <sql.h> -#include <sqlext.h> -#define SQLINTEGER SDWORD -#define SQLSMALLINT SWORD -#define SQLUSMALLINT UWORD - - -#elif defined(HAVE_DBMAKER) /* DBMaker */ - -#define ODBC_TYPE "DBMaker" -#undef ODBCVER -#define ODBCVER 0x0300 -#define HAVE_SQL_EXTENDED_FETCH 1 -#include <odbc.h> - - -#elif defined(HAVE_CODBC) /* Custom ODBC */ - -#define ODBC_TYPE "Custom ODBC" -#define HAVE_SQL_EXTENDED_FETCH 1 -#include <odbc.h> - -#elif defined(HAVE_IBMDB2) /* DB2 CLI */ - -#define ODBC_TYPE "IBM DB2 CLI" -#define HAVE_SQL_EXTENDED_FETCH 1 -#include <sqlcli1.h> -#ifdef DB268K -/* Need to include ASLM for 68K applications */ -#include <LibraryManager.h> -#endif - -#else /* MS ODBC */ - -#define HAVE_SQL_EXTENDED_FETCH 1 -#include <WINDOWS.H> -#include <sql.h> -#include <sqlext.h> -#endif - extern zend_module_entry odbc_module_entry; #define odbc_module_ptr &odbc_module_entry - /* user functions */ PHP_MINIT_FUNCTION(odbc); PHP_MSHUTDOWN_FUNCTION(odbc); @@ -252,95 +92,9 @@ PHP_FUNCTION(odbc_specialcolumns); PHP_FUNCTION(odbc_statistics); -#if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC ) -#define ODBC_SQL_ENV_T SQLHANDLE -#define ODBC_SQL_CONN_T SQLHANDLE -#define ODBC_SQL_STMT_T SQLHANDLE -#elif defined( HAVE_SOLID_35 ) || defined( HAVE_SAPDB ) || defined ( HAVE_EMPRESS ) -#define ODBC_SQL_ENV_T SQLHENV -#define ODBC_SQL_CONN_T SQLHDBC -#define ODBC_SQL_STMT_T SQLHSTMT -#else -#define ODBC_SQL_ENV_T HENV -#define ODBC_SQL_CONN_T HDBC -#define ODBC_SQL_STMT_T HSTMT -#endif - -typedef struct odbc_connection { - ODBC_SQL_ENV_T henv; - ODBC_SQL_CONN_T hdbc; - char laststate[6]; - char lasterrormsg[SQL_MAX_MESSAGE_LENGTH]; - int id; - int persistent; -} odbc_connection; - -typedef struct odbc_result_value { - char name[32]; - char *value; - long int vallen; - SDWORD coltype; -} odbc_result_value; - -typedef struct odbc_result { - ODBC_SQL_STMT_T stmt; - int id; - odbc_result_value *values; - SWORD numcols; - SWORD numparams; -# if HAVE_SQL_EXTENDED_FETCH - int fetch_abs; -# endif - long longreadlen; - int binmode; - int fetched; - odbc_connection *conn_ptr; -} odbc_result; - -typedef struct { - char *defDB; - char *defUser; - char *defPW; - long allow_persistent; - long check_persistent; - long max_persistent; - long max_links; - long num_persistent; - long num_links; - int defConn; - long defaultlrl; - long defaultbinmode; - char laststate[6]; - char lasterrormsg[SQL_MAX_MESSAGE_LENGTH]; - HashTable *resource_list; - HashTable *resource_plist; -} php_odbc_globals; - -int odbc_add_result(HashTable *list, odbc_result *result); -odbc_result *odbc_get_result(HashTable *list, int count); -void odbc_del_result(HashTable *list, int count); -int odbc_add_conn(HashTable *list, HDBC conn); -odbc_connection *odbc_get_conn(HashTable *list, int count); -void odbc_del_conn(HashTable *list, int ind); -int odbc_bindcols(odbc_result *result TSRMLS_DC); - -#define ODBC_SQL_ERROR_PARAMS odbc_connection *conn_resource, ODBC_SQL_STMT_T stmt, char *func - -void odbc_sql_error(ODBC_SQL_ERROR_PARAMS); - -#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR) -#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY) - -#ifdef ZTS -# define ODBCG(v) TSRMG(odbc_globals_id, php_odbc_globals *, v) -#else -# define ODBCG(v) (odbc_globals.v) -extern ZEND_API php_odbc_globals odbc_globals; -#endif - #else -# define odbc_module_ptr NULL +#define odbc_module_ptr NULL #endif /* HAVE_UODBC */ No revision No revision 1.2.2.3 +2 -2 php4/ext/openssl/openssl.c Index: openssl.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/openssl/openssl.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- openssl.c 19 May 2002 11:16:04 -0000 1.2.2.2 +++ openssl.c 9 Jul 2002 09:14:37 -0000 1.2.2.3 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.48 2002/05/17 12:42:39 wez Exp $ */ +/* $Id: openssl.c,v 1.49 2002/06/13 19:41:21 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1416,7 +1416,7 @@ zend_error(E_WARNING, "cannot get private key from parameter 3"); goto cleanup; } - if (cert && !X509_check_private_key(cert, key)) { + if (cert && !X509_check_private_key(cert, priv_key)) { zend_error(E_WARNING, "private key does not correspond to signing cert"); goto cleanup; } No revision No revision 1.2.2.1 +1 -3 php4/ext/openssl/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/openssl/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:55 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:37 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.2 +3 -3 php4/ext/overload/overload.c Index: overload.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/overload/overload.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- overload.c 2 May 2002 22:01:53 -0000 1.2.2.1 +++ overload.c 9 Jul 2002 09:14:37 -0000 1.2.2.2 @@ -601,9 +601,9 @@ return; } - *return_value = *retval; - INIT_PZVAL(return_value); - FREE_ZVAL(retval); + return_value->value = retval->value; + zval_copy_ctor(return_value); + zval_ptr_dtor(&retval); } efree(args); No revision No revision 1.2.2.2 +15 -1 php4/ext/pcntl/pcntl.c Index: pcntl.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pcntl/pcntl.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- pcntl.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ pcntl.c 9 Jul 2002 09:14:38 -0000 1.2.2.2 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pcntl.c,v 1.26 2002/05/06 23:01:46 jason Exp $ */ +/* $Id: pcntl.c,v 1.27 2002/06/04 15:51:24 edink Exp $ */ #define PCNTL_DEBUG 0 @@ -51,6 +51,7 @@ PHP_FE(pcntl_wtermsig, NULL) PHP_FE(pcntl_wstopsig, NULL) PHP_FE(pcntl_exec, NULL) + PHP_FE(pcntl_alarm, NULL) {NULL, NULL, NULL} }; @@ -213,6 +214,19 @@ } RETURN_LONG((long) id); +} +/* }}} */ + +/* {{{ proto int pcntl_alarm(int seconds) + Set an alarm clock for delivery of a signal*/ +PHP_FUNCTION(pcntl_alarm) +{ + long seconds; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE) + return; + + RETURN_LONG ((long) alarm(seconds)); } /* }}} */ 1.2.2.1 +2 -1 php4/ext/pcntl/php_pcntl.h Index: php_pcntl.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pcntl/php_pcntl.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_pcntl.h 29 Apr 2002 02:30:56 -0000 1.2 +++ php_pcntl.h 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcntl.h,v 1.9 2002/03/16 22:31:57 mfischer Exp $ */ +/* $Id: php_pcntl.h,v 1.10 2002/06/04 15:51:25 edink Exp $ */ #ifndef PHP_PCNTL_H #define PHP_PCNTL_H @@ -39,6 +39,7 @@ PHP_RSHUTDOWN_FUNCTION(pcntl); PHP_MINFO_FUNCTION(pcntl); +PHP_FUNCTION(pcntl_alarm); PHP_FUNCTION(pcntl_fork); PHP_FUNCTION(pcntl_waitpid); PHP_FUNCTION(pcntl_wifexited); No revision No revision 1.2.2.1 +1 -3 php4/ext/pcntl/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pcntl/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:56 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.2 +100 -40 php4/ext/pcre/php_pcre.c Index: php_pcre.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pcre/php_pcre.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_pcre.c 19 May 2002 11:16:04 -0000 1.2.2.1 +++ php_pcre.c 9 Jul 2002 09:14:38 -0000 1.2.2.2 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.122 2002/05/13 17:28:36 andrei Exp $ */ +/* $Id: php_pcre.c,v 1.126 2002/06/13 01:04:40 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -32,11 +32,13 @@ #include "ext/standard/php_string.h" -#define PREG_PATTERN_ORDER 0 -#define PREG_SET_ORDER 1 +#define PREG_PATTERN_ORDER 1 +#define PREG_SET_ORDER 2 +#define PREG_OFFSET_CAPTURE (1<<8) #define PREG_SPLIT_NO_EMPTY (1<<0) #define PREG_SPLIT_DELIM_CAPTURE (1<<1) +#define PREG_SPLIT_OFFSET_CAPTURE (1<<2) #define PREG_REPLACE_EVAL (1<<0) @@ -98,8 +100,10 @@ REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -308,6 +312,21 @@ } /* }}} */ +static inline void add_offset_pair(zval *result, char *str, int len, int offset) +{ + zval *match_pair; + + ALLOC_ZVAL(match_pair); + array_init(match_pair); + INIT_PZVAL(match_pair); + + /* Add (match, offset) to the return value */ + add_next_index_stringl(match_pair, str, len, 1); + add_next_index_long(match_pair, offset); + + zend_hash_next_index_insert(Z_ARRVAL_P(result), &match_pair, sizeof(zval *), NULL); +} + /* {{{ php_pcre_match */ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) @@ -315,8 +334,7 @@ zval **regex, /* Regular expression */ **subject, /* String to match against */ **subpats = NULL, /* Array for subpatterns */ - **subpats_order, /* Order of the results in the subpatterns - array for global match */ + **flags, /* Match control flags */ *result_set, /* Holds a set of subpatterns after a global match */ **match_sets = NULL; /* An array of sets of matches for each @@ -332,7 +350,8 @@ int start_offset; /* Where the new search starts */ int matched; /* Has anything matched */ int i; - int subpats_order_val = 0; /* Integer value of subpats_order */ + int subpats_order = 0; /* Order of subpattern matches */ + int offset_capture = 0;/* Capture match offsets: yes/no */ int g_notempty = 0; /* If the match should not be empty */ const char **stringlist; /* Used to hold list of subpatterns */ char *match; /* The current match */ @@ -351,20 +370,21 @@ WRONG_PARAM_COUNT; } if (global) - subpats_order_val = PREG_PATTERN_ORDER; + subpats_order = PREG_PATTERN_ORDER; break; case 4: - if (zend_get_parameters_ex(4, ®ex, &subject, &subpats, &subpats_order) == FAILURE) { + if (zend_get_parameters_ex(4, ®ex, &subject, &subpats, &flags) == FAILURE) { WRONG_PARAM_COUNT; } - /* Make sure subpats_order is a number */ - convert_to_long_ex(subpats_order); - subpats_order_val = Z_LVAL_PP(subpats_order); - if (subpats_order_val < PREG_PATTERN_ORDER || - subpats_order_val > PREG_SET_ORDER) { - zend_error(E_WARNING, "Wrong value for parameter 4 in call to preg_match_all()"); + convert_to_long_ex(flags); + offset_capture = Z_LVAL_PP(flags) & PREG_OFFSET_CAPTURE; + subpats_order = Z_LVAL_PP(flags) & 0xff; + if ((global && (subpats_order < PREG_PATTERN_ORDER || subpats_order > PREG_SET_ORDER)) || + (!global && subpats_order != 0)) { + zend_error(E_WARNING, "Wrong value for parameter 4 in call to %s()", get_active_function_name(TSRMLS_C)); + return; } break; @@ -394,7 +414,7 @@ offsets = (int *)emalloc(size_offsets * sizeof(int)); /* Allocate match sets array and initialize the values */ - if (global && subpats_order_val == PREG_PATTERN_ORDER) { + if (global && subpats_order == PREG_PATTERN_ORDER) { match_sets = (zval **)emalloc(num_subpats * sizeof(zval *)); for (i=0; i<num_subpats; i++) { ALLOC_ZVAL(match_sets[i]); @@ -437,11 +457,16 @@ } if (global) { /* global pattern matching */ - if (subpats_order_val == PREG_PATTERN_ORDER) { + if (subpats_order == PREG_PATTERN_ORDER) { /* For each subpattern, insert it into the appropriate array. */ for (i = 0; i < count; i++) { - add_next_index_stringl(match_sets[i], (char *)stringlist[i], - offsets[(i<<1)+1] - offsets[i<<1], 1); + if (offset_capture) { + add_offset_pair(match_sets[i], (char *)stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1]); + } else { + add_next_index_stringl(match_sets[i], (char *)stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], 1); + } } /* * If the number of captured subpatterns on this run is @@ -461,19 +486,28 @@ /* Add all the subpatterns to it */ for (i = 0; i < count; i++) { - add_next_index_stringl(result_set, (char *)stringlist[i], - offsets[(i<<1)+1] - offsets[i<<1], 1); + if (offset_capture) { + add_offset_pair(result_set, (char *)stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1]); + } else { + add_next_index_stringl(result_set, (char *)stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], 1); + } } /* And add it to the output array */ zend_hash_next_index_insert(Z_ARRVAL_PP(subpats), &result_set, sizeof(zval *), NULL); } - } - else { /* single pattern matching */ + } else { /* single pattern matching */ /* For each subpattern, insert it into the subpatterns array. */ for (i = 0; i < count; i++) { - add_next_index_stringl((*subpats), (char *)stringlist[i], - offsets[(i<<1)+1] - offsets[i<<1], 1); + if (offset_capture) { + add_offset_pair(*subpats, (char *)stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1]); + } else { + add_next_index_stringl(*subpats, (char *)stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], 1); + } } } @@ -503,7 +537,7 @@ } while (global); /* Add the match sets to the output array and clean up */ - if (global && subpats_order_val == PREG_PATTERN_ORDER) { + if (global && subpats_order == PREG_PATTERN_ORDER) { for (i=0; i<num_subpats; i++) { zend_hash_next_index_insert(Z_ARRVAL_PP(subpats), &match_sets[i], sizeof(zval *), NULL); } @@ -516,7 +550,7 @@ } /* }}} */ -/* {{{ proto int preg_match(string pattern, string subject [, array subpatterns]) +/* {{{ proto int preg_match(string pattern, string subject [, array subpatterns [, int flags]]) Perform a Perl-style regular expression match */ PHP_FUNCTION(preg_match) { @@ -524,7 +558,7 @@ } /* }}} */ -/* {{{ proto int preg_match_all(string pattern, string subject, array subpatterns [, int order]) +/* {{{ proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags]) Perform a Perl-style global regular expression match */ PHP_FUNCTION(preg_match_all) { @@ -1080,8 +1114,10 @@ int limit_val = -1; /* Integer value of limit */ int no_empty = 0; /* If NO_EMPTY flag is set */ int delim_capture = 0; /* If delimiters should be captured */ + int offset_capture = 0;/* If offsets should be captured */ int count = 0; /* Count of matched subpatterns */ int start_offset; /* Where the new search starts */ + int next_offset; /* End of the last delimiter match + 1 */ int g_notempty = 0; /* If the match should not be empty */ char *match, /* The current match */ *last_match; /* Location of last match */ @@ -1102,6 +1138,7 @@ convert_to_long_ex(flags); no_empty = Z_LVAL_PP(flags) & PREG_SPLIT_NO_EMPTY; delim_capture = Z_LVAL_PP(flags) & PREG_SPLIT_DELIM_CAPTURE; + offset_capture = Z_LVAL_PP(flags) & PREG_SPLIT_OFFSET_CAPTURE; } } @@ -1123,6 +1160,7 @@ /* Start at the beginning of the string */ start_offset = 0; + next_offset = 0; last_match = Z_STRVAL_PP(subject); match = NULL; @@ -1143,9 +1181,15 @@ match = Z_STRVAL_PP(subject) + offsets[0]; if (!no_empty || &Z_STRVAL_PP(subject)[offsets[0]] != last_match) { - /* Add the piece to the return value */ - add_next_index_stringl(return_value, last_match, - &Z_STRVAL_PP(subject)[offsets[0]]-last_match, 1); + + if (offset_capture) { + /* Add (match, offset) pair to the return value */ + add_offset_pair(return_value, last_match, &Z_STRVAL_PP(subject)[offsets[0]]-last_match, next_offset); + } else { + /* Add the piece to the return value */ + add_next_index_stringl(return_value, last_match, + &Z_STRVAL_PP(subject)[offsets[0]]-last_match, 1); + } /* One less left to do */ if (limit_val != -1) @@ -1153,15 +1197,22 @@ } last_match = &Z_STRVAL_PP(subject)[offsets[1]]; + next_offset = offsets[1]; if (delim_capture) { int i, match_len; for (i = 1; i < count; i++) { match_len = offsets[(i<<1)+1] - offsets[i<<1]; - if (!no_empty || match_len > 0) - add_next_index_stringl(return_value, - &Z_STRVAL_PP(subject)[offsets[i<<1]], - match_len, 1); + /* If we have matched a delimiter */ + if (!no_empty || match_len > 0) { + if (offset_capture) { + add_offset_pair(return_value, &Z_STRVAL_PP(subject)[offsets[i<<1]], match_len, offsets[i<<1]); + } else { + add_next_index_stringl(return_value, + &Z_STRVAL_PP(subject)[offsets[i<<1]], + match_len, 1); + } + } } } } else { /* Failed to match */ @@ -1185,11 +1236,20 @@ /* Advance to the position right after the last full match */ start_offset = offsets[1]; } - + + if (!no_empty || start_offset != Z_STRLEN_PP(subject)) - /* Add the last piece to the return value */ - add_next_index_string(return_value, - &Z_STRVAL_PP(subject)[start_offset], 1); + { + if (offset_capture) { + /* Add the last (match, offset) pair to the return value */ + add_offset_pair(return_value, &Z_STRVAL_PP(subject)[start_offset], Z_STRLEN_PP(subject) - start_offset, start_offset); + } else { + /* Add the last piece to the return value */ + add_next_index_string(return_value, + &Z_STRVAL_PP(subject)[start_offset], 1); + } + } + /* Clean up */ efree(offsets); @@ -1307,7 +1367,7 @@ } if (Z_TYPE_PP(input) != IS_ARRAY) { - zend_error(E_WARNING, "Secong argument to preg_grep() should be an array"); + zend_error(E_WARNING, "Second argument to preg_grep() should be an array"); return; } @@ -1346,7 +1406,7 @@ /* Check for too many substrings condition. */ if (count == 0) { - zend_error(E_NOTICE, "Matched, but too many substrings\n"); + zend_error(E_NOTICE, "Matched, but too many substrings"); count = size_offsets/3; } No revision No revision 1.2.2.1 +17 -19 php4/ext/pdf/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pdf/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:57 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -1,13 +1,27 @@ dnl -dnl $Id: config.m4,v 1.29 2002/03/12 16:28:51 sas Exp $ +dnl $Id: config.m4,v 1.31 2002/06/29 01:19:31 sniper Exp $ dnl PHP_ARG_WITH(pdflib,for PDFlib support, [ --with-pdflib[=DIR] Include PDFlib support.]) +pdflib_ext_shared=$ext_shared + +PHP_ARG_WITH(jpeg-dir, for the location of libjpeg, +[ --with-jpeg-dir[=DIR] PDFLIB: define libjpeg install directory. + (OPTIONAL for PDFlib v4)]) + +PHP_ARG_WITH(png-dir, for the location of libpng, +[ --with-png-dir[=DIR] PDFLIB: define libpng install directory. + (OPTIONAL for PDFlib v4)]) + +PHP_ARG_WITH(tiff-dir, for the location of libtiff, +[ --with-tiff-dir[=DIR] PDFLIB: define libtiff install directory. + (OPTIONAL for PDFlib v4)]) + if test "$PHP_PDFLIB" != "no"; then - PHP_NEW_EXTENSION(pdf, pdf.c, $ext_shared) + PHP_NEW_EXTENSION(pdf, pdf.c, $pdflib_ext_shared) PHP_SUBST(PDFLIB_SHARED_LIBADD) dnl # @@ -15,11 +29,6 @@ dnl # dnl # libjpeg - - PHP_ARG_WITH(jpeg-dir, for the location of libjpeg, - [ --with-jpeg-dir[=DIR] PDFLIB: define libjpeg install directory. - (OPTIONAL for PDFlib v4)]) - if test "$PHP_JPEG_DIR" != "no"; then PHP_CHECK_LIBRARY(jpeg,jpeg_read_header, [ @@ -34,11 +43,6 @@ fi dnl # libpng - - PHP_ARG_WITH(png-dir, for the location of libpng, - [ --with-png-dir[=DIR] PDFLIB: define libpng install directory. - (OPTIONAL for PDFlib v4)]) - if test "$PHP_PNG_DIR" != "no"; then PHP_CHECK_LIBRARY(png,png_create_info_struct, [ @@ -53,11 +57,6 @@ fi dnl # libtiff - - PHP_ARG_WITH(tiff-dir, for the location of libtiff, - [ --with-tiff-dir[=DIR] PDFLIB: define libtiff install directory. - (OPTIONAL for PDFlib v4)]) - if test "$PHP_TIFF_DIR" != "no"; then PHP_CHECK_LIBRARY(tiff,TIFFOpen, [ @@ -72,7 +71,6 @@ fi dnl # zlib - AC_MSG_CHECKING([for the location of zlib]) if test "$PHP_ZLIB_DIR" = "no"; then AC_MSG_RESULT([no. If configure fails, try --with-zlib-dir=<DIR>]) @@ -81,7 +79,6 @@ PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, PDFLIB_SHARED_LIBADD) fi - dnl # dnl # The main PDFlib configure dnl # @@ -122,3 +119,4 @@ ;; esac fi + No revision No revision 1.2.2.1 +2 -2 php4/ext/pgsql/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pgsql/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:30:58 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.33 2002/04/25 02:40:58 yohgaki Exp $ +dnl $Id: config.m4,v 1.34 2002/06/26 13:07:40 derick Exp $ dnl AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[ @@ -53,7 +53,7 @@ old_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR" AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 or later])) - AC_CHECK_LIB(pq, PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or laler])) + AC_CHECK_LIB(pq, PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later])) AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq under windows])) AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL])) AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 7.0.x or later])) 1.2.2.2 +20 -11 php4/ext/pgsql/pgsql.c Index: pgsql.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pgsql/pgsql.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- pgsql.c 19 May 2002 11:16:05 -0000 1.2.2.1 +++ pgsql.c 9 Jul 2002 09:14:38 -0000 1.2.2.2 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.199 2002/05/11 03:01:08 yohgaki Exp $ */ +/* $Id: pgsql.c,v 1.201 2002/05/20 01:40:22 yohgaki Exp $ */ #include <stdlib.h> @@ -1851,12 +1851,14 @@ } /* }}} */ +#define PGSQL_LO_READ_BUF_SIZE 8192 + /* {{{ proto string pg_lo_read(resource large_object [, int len]) Read a large object */ PHP_FUNCTION(pg_lo_read) { zval **pgsql_id, **len; - int buf_len = 1024, nbytes; + int buf_len = PGSQL_LO_READ_BUF_SIZE, nbytes; char *buf; pgLofp *pgsql; @@ -1902,6 +1904,16 @@ if (argc > 2) { convert_to_long_ex(z_len); + if (Z_LVAL_PP(z_len) > Z_STRLEN_PP(str)) { + php_error(E_WARNING, "%s() cannot write more than buffer size %d. Tried to wtite %d", + get_active_function_name(TSRMLS_C), Z_LVAL_PP(str), Z_LVAL_PP(z_len)); + RETURN_FALSE; + } + if (Z_LVAL_PP(z_len) < 0) { + php_error(E_WARNING, "%s() buffer size must be larger than 0. %d specified for buffer size.", + get_active_function_name(TSRMLS_C), Z_LVAL_PP(str), Z_LVAL_PP(z_len)); + RETURN_FALSE; + } len = Z_LVAL_PP(z_len); } else { @@ -1923,11 +1935,10 @@ PHP_FUNCTION(pg_lo_read_all) { zval **pgsql_id; - int i, tbytes; + int tbytes; volatile int nbytes; - char buf[8192]; + char buf[PGSQL_LO_READ_BUF_SIZE]; pgLofp *pgsql; - int output=1; switch(ZEND_NUM_ARGS()) { case 1: @@ -1943,11 +1954,9 @@ ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp); tbytes = 0; - while ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, 8192))>0) { - for(i=0; i<nbytes; i++) { - if (output) { (void) PUTC(buf[i]); } - } - tbytes += i; + while ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, PGSQL_LO_READ_BUF_SIZE))>0) { + php_body_write(buf, nbytes TSRMLS_CC); + tbytes += nbytes; } RETURN_LONG(tbytes); } @@ -1974,7 +1983,7 @@ CHECK_DEFAULT_LINK(id); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "rs", &pgsql_link, &file_in, &name_len) == SUCCESS) { + "sr", &file_in, &name_len, &pgsql_link ) == SUCCESS) { php_error(E_NOTICE, "Old API for %s() is used.", get_active_function_name(TSRMLS_C)); } else { 1.2.2.1 +4 -4 php4/ext/pgsql/pgsql.dsp Index: pgsql.dsp =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pgsql/pgsql.dsp,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- pgsql.dsp 29 Apr 2002 02:30:58 -0000 1.2 +++ pgsql.dsp 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -45,7 +45,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PGSQL_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZEND_DEBUG=0 /D "HAVE_PQCMDTUPLES" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -72,7 +72,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PGSQL_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZEND_DEBUG=1 /D "HAVE_PQCMDTUPLES" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -100,7 +100,7 @@ # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\PostgreSQL\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "ZTS" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZTS=1 /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZEND_DEBUG=0 /D "HAVE_PQCMDTUPLES" /FR /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D ZEND_DEBUG=0 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -127,7 +127,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZTS=1 /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "ZTS" /D ZEND_DEBUG=1 /D "HAVE_PQCMDTUPLES" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D "ZTS" /D ZEND_DEBUG=1 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" No revision No revision 1.2.2.1 +1 -3 php4/ext/pgsql/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pgsql/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:58 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.2 +57 -11 php4/ext/posix/posix.c Index: posix.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/posix/posix.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- posix.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ posix.c 9 Jul 2002 09:14:38 -0000 1.2.2.2 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: posix.c,v 1.46 2002/05/04 16:54:13 sas Exp $ */ +/* $Id: posix.c,v 1.50 2002/06/04 08:54:14 mfischer Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -25,6 +25,7 @@ #include "php.h" #include "ext/standard/info.h" #include "ext/standard/php_string.h" +#include "ext/standard/file.h" /* Provides php_file_le_stream() */ #include "php_posix.h" #if HAVE_POSIX @@ -130,7 +131,7 @@ static PHP_MINFO_FUNCTION(posix) { php_info_print_table_start(); - php_info_print_table_row(2, "Revision", "$Revision: 1.46 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.50 $"); php_info_print_table_end(); } /* }}} */ @@ -580,16 +581,50 @@ #endif /* }}} */ +/* Checks if the provides resource is a stream and if it provides a file descriptor */ +static int php_posix_stream_get_fd(long rsrc_id, int *fd TSRMLS_DC) +{ + php_stream *stream; + int rsrc_type; + + stream = zend_list_find(rsrc_id, &rsrc_type); + if (!stream || rsrc_type != php_file_le_stream()) { + php_error(E_WARNING, "%s() expects argument 1 to be a valid stream resource", + get_active_function_name(TSRMLS_C)); + return 0; + } + if (php_stream_can_cast(stream, PHP_STREAM_AS_FD) == SUCCESS) { + php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)fd, 0); + } else { + php_error(E_WARNING, "%s() could not use stream of type '%s'", + get_active_function_name(TSRMLS_C), stream->ops->label); + return 0; + } + return 1; +} + /* {{{ proto string posix_ttyname(int fd) Determine terminal device name (POSIX.1, 4.7.2) */ PHP_FUNCTION(posix_ttyname) { - long fd; + zval *z_fd; char *p; + int fd; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fd) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) return; + switch (Z_TYPE_P(z_fd)) { + case IS_RESOURCE: + if (!php_posix_stream_get_fd(Z_RESVAL_P(z_fd), &fd TSRMLS_CC)) { + RETURN_FALSE; + } + break; + default: + convert_to_long(z_fd); + fd = Z_LVAL_P(z_fd); + } + if (NULL == (p = ttyname(fd))) { POSIX_G(last_error) = errno; RETURN_FALSE; @@ -603,17 +638,28 @@ Determine if filedesc is a tty (POSIX.1, 4.7.1) */ PHP_FUNCTION(posix_isatty) { - long fd; - int result; + zval *z_fd; + int fd; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fd) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) return; - result = isatty(fd); - if (!result) + switch (Z_TYPE_P(z_fd)) { + case IS_RESOURCE: + if (!php_posix_stream_get_fd(Z_RESVAL_P(z_fd), &fd TSRMLS_CC)) { + RETURN_FALSE; + } + break; + default: + convert_to_long(z_fd); + fd = Z_LVAL_P(z_fd); + } + + if (isatty(fd)) { + RETURN_TRUE; + } else { RETURN_FALSE; - - RETURN_TRUE; + } } /* }}} */ No revision No revision 1.2.2.1 +1 -3 php4/ext/pspell/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pspell/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:30:59 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +47 -44 php4/ext/rpc/handler.h Index: handler.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/rpc/handler.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- handler.h 29 Apr 2002 02:30:59 -0000 1.2 +++ handler.h 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -2,16 +2,18 @@ #define HANDLER_H #include "php.h" +#include "php_ini.h" #define RPC_HANDLER(layer) {#layer, layer##_handler_init, &layer##_object_handlers, \ &layer##_class_entry, layer##_function_entry, \ - layer##_method_entry} + layer##_method_entry, layer##_ini_entry} #define RPC_DECLARE_HANDLER(layer) void layer##_handler_init(); \ rpc_object_handlers layer##_object_handlers; \ zend_class_entry layer##_class_entry; \ function_entry layer##_function_entry[]; \ - function_entry layer##_method_entry[]; + function_entry layer##_method_entry[]; \ + zend_ini_entry layer##_ini_entry[]; #define RPC_INIT_FUNCTION(layer) void layer##_handler_init() @@ -20,12 +22,16 @@ #define RPC_REGISTER_HANDLERS_END() }; +#define RPC_INI_START(layer) zend_ini_entry layer##_ini_entry[] = { +#define RPC_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } }; -#define RPC_FUNCTION_ENTRY_START(layer) function_entry layer##_function_entry[] = { \ - ZEND_FALIAS(layer##_load, rpc_load, NULL) \ - ZEND_FALIAS(layer##_call, rpc_call, NULL) \ - ZEND_FALIAS(layer##_get, rpc_get, NULL) \ - ZEND_FALIAS(layer##_set, rpc_set, NULL) +#define RPC_FUNCTION_ENTRY_START(layer) function_entry layer##_function_entry[] = { \ + ZEND_FALIAS(layer##_load, rpc_load, NULL) \ + ZEND_FALIAS(layer##_call, rpc_call, NULL) \ + ZEND_FALIAS(layer##_get, rpc_get, NULL) \ + ZEND_FALIAS(layer##_set, rpc_get, NULL) \ + ZEND_FALIAS(layer##_singleton, rpc_singleton, NULL) \ + ZEND_FALIAS(layer##_poolable, rpc_poolable, NULL) #define RPC_FUNCTION_ENTRY_END() {NULL, NULL, NULL} \ }; @@ -35,82 +41,79 @@ #define RPC_METHOD_ENTRY_END() {NULL, NULL, NULL} \ }; -#define POOL TRUE -#define DONT_POOL FALSE - #define DONT_HASH 0 #define HASH_AS_INT 1 #define HASH_AS_STRING 2 #define HASH_WITH_SIGNATURE 4 -#define HASH_AS_INT_WITH_SIGNATURE (HASH_AS_INT + HASH_WITH_SIGNATURE) -#define HASH_AS_STRING_WITH_SIGNATURE (HASH_AS_STRING + HASH_WITH_SIGNATURE) +#define HASH_AS_INT_WITH_SIGNATURE (HASH_AS_INT & HASH_WITH_SIGNATURE) +#define HASH_AS_STRING_WITH_SIGNATURE (HASH_AS_STRING & HASH_WITH_SIGNATURE) #define CLASS 0 #define METHOD 1 #define PROPERTY 2 +/* string */ +typedef struct _rpc_string { + char *str; + zend_uint len; +} rpc_string; + /* rpc handler that have to be implemented by a * specific rpc layer */ typedef struct _rpc_object_handlers { - const zend_bool pool_instances; + const zend_bool poolable; const zend_uint hash_type; - int (*rpc_hash)(char *name, zend_uint name_len, char **hash, zend_uint *hash_len, int num_args, char *arg_types, int type); - int (*rpc_ctor)(char *class_name, zend_uint class_name_len, void **data, int num_args, zval **args[]); + int (*rpc_hash)(rpc_string name, rpc_string *hash, int num_args, char *arg_types, int type); + int (*rpc_name)(rpc_string hash, rpc_string *name, int type); + int (*rpc_ctor)(rpc_string class_name, void **data, int num_args, zval **args[]); int (*rpc_dtor)(void **data); - int (*rpc_call)(char *method_name, zend_uint method_name_len, void **data, zval **return_value, int num_args, zval **args[]); - int (*rpc_get)(char *property_name, zend_uint property_name_len, zval *return_value, void **data); - int (*rpc_set)(char *property_name, zend_uint property_name_len, zval *value, void **data); + int (*rpc_call)(rpc_string method_name, void **data, zval **return_value, int num_args, zval **args[]); + int (*rpc_get)(rpc_string property_name, zval *return_value, void **data); + int (*rpc_set)(rpc_string property_name, zval *value, void **data); int (*rpc_compare)(void **data1, void **data2); - int (*rpc_get_classname)(char **class_name, zend_uint *class_name_length, void **data); - int (*rpc_has_property)(char *property_name, zend_uint property_name_length, void **data); - int (*rpc_unset_property)(char *property_name, zend_uint property_name_length, void **data); + int (*rpc_has_property)(rpc_string property_name, void **data); + int (*rpc_unset_property)(rpc_string property_name, void **data); int (*rpc_get_properties)(HashTable **properties, void **data); } rpc_object_handlers; /* handler entry */ typedef struct _rpc_handler_entry { - char *name; + char *name; void (*rpc_handler_init)(); - rpc_object_handlers *handlers; + rpc_object_handlers *handlers; zend_class_entry *ce; function_entry *functions; function_entry *methods; + zend_ini_entry *ini; } rpc_handler_entry; -/* string */ -typedef struct _rpc_string { - char *str; - zend_uint len; -} rpc_string; - /* class/method/function hash */ typedef struct _rpc_class_hash { - rpc_string name; /* must be first entry */ - TsHashTable methods; - TsHashTable properties; + rpc_string name; /* must be first entry */ + zend_bool poolable; + zend_bool singleton; + TsHashTable methods; + TsHashTable properties; + rpc_object_handlers **handlers; + zend_class_entry *ce; + void *data; } rpc_class_hash; /* internal data */ typedef struct _rpc_internal { - char *class_name; - zend_uint class_name_len; - zend_class_entry *ce; - rpc_object_handlers **handlers; - void *data; - zend_uint refcount; - zend_uint clonecount; - zend_bool pool_instances; - rpc_class_hash *hash; - TsHashTable function_table; MUTEX_T mx_handler; + TsHashTable function_table; + rpc_object_handlers **handlers; + rpc_class_hash *hash; + zend_class_entry *ce; + void *data; } rpc_internal; /* proxy data */ typedef struct _rpc_proxy { - zend_uint refcount; - zend_uint clonecount; + zend_uint dummy; } rpc_proxy; 1.2.2.1 +4 -10 php4/ext/rpc/php_rpc.h Index: php_rpc.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/rpc/php_rpc.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_rpc.h 29 Apr 2002 02:30:59 -0000 1.2 +++ php_rpc.h 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -18,23 +18,17 @@ ZEND_MINIT_FUNCTION(rpc); ZEND_MSHUTDOWN_FUNCTION(rpc); +ZEND_RINIT_FUNCTION(rpc); +ZEND_RSHUTDOWN_FUNCTION(rpc); ZEND_MINFO_FUNCTION(rpc); ZEND_FUNCTION(rpc_load); ZEND_FUNCTION(rpc_call); ZEND_FUNCTION(rpc_set); ZEND_FUNCTION(rpc_get); +ZEND_FUNCTION(rpc_singleton); +ZEND_FUNCTION(rpc_poolable); -ZEND_BEGIN_MODULE_GLOBALS(rpc) - int dummy; -ZEND_END_MODULE_GLOBALS(rpc) - -#ifdef ZTS -#define RPC_G(v) TSRMG(rpc_globals_id, zend_rpc_globals *, v) -#else -#define RPC_G(v) (rpc_globals.v) -#endif - #define phpext_rpc_ptr &rpc_module_entry #endif /* PHP_RPC_H */ 1.2.2.1 +277 -202 php4/ext/rpc/rpc.c Index: rpc.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/rpc/rpc.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- rpc.c 29 Apr 2002 02:30:59 -0000 1.2 +++ rpc.c 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -10,21 +10,16 @@ #include "rpc.h" #include "layer.h" -ZEND_DECLARE_MODULE_GLOBALS(rpc) - -static void rpc_globals_ctor(zend_rpc_globals * TSRMLS_DC); static void rpc_instance_dtor(void *); -static void rpc_proxy_dtor(void *pDest); static void rpc_class_dtor(void *); static void rpc_string_dtor(void *); -static void rpc_export_functions(char *, zend_class_entry *, function_entry[] TSRMLS_DC); -static zend_object_value rpc_create_object(zend_class_entry * TSRMLS_DC); + +static zend_object_value rpc_objects_new(zend_class_entry * TSRMLS_DC); +static void rpc_objects_delete(void *object, zend_object_handle handle TSRMLS_DC); + +static int zend_ts_hash_remove_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData); /* object handler */ -static void rpc_add_ref(zval * TSRMLS_DC); -static void rpc_del_ref(zval * TSRMLS_DC); -static void rpc_delete(zval * TSRMLS_DC); -static zend_object_value rpc_clone(zval * TSRMLS_DC); static zval* rpc_read(zval *, zval *, int TSRMLS_DC); static void rpc_write(zval *, zval *, zval * TSRMLS_DC); static zval** rpc_get_property(zval *, zval * TSRMLS_DC); @@ -35,8 +30,7 @@ static HashTable* rpc_get_properties(zval * TSRMLS_DC); static union _zend_function* rpc_get_method(zval *, char *, int TSRMLS_DC); static union _zend_function* rpc_get_constructor(zval * TSRMLS_DC); -static zend_class_entry** rpc_get_class_entry(zval *object TSRMLS_DC); -static int rpc_get_classname(zval *, char **, zend_uint *, int TSRMLS_DC); +static zend_class_entry* rpc_get_class_entry(zval *object TSRMLS_DC); static int rpc_compare(zval *, zval * TSRMLS_DC); /**/ @@ -48,16 +42,16 @@ extern zend_object_handlers rpc_proxy_handlers; static zend_object_handlers rpc_handlers = { - rpc_add_ref, - rpc_del_ref, - rpc_delete, - rpc_clone, + ZEND_OBJECTS_STORE_HANDLERS, + rpc_read, rpc_write, rpc_get_property, NULL, rpc_get, rpc_set, + NULL, + NULL, rpc_has_property, rpc_unset_property, rpc_get_properties, @@ -65,7 +59,7 @@ NULL, rpc_get_constructor, rpc_get_class_entry, - rpc_get_classname, + NULL, rpc_compare }; @@ -92,9 +86,10 @@ }; /* }}} */ +zend_class_entry rpc_class_entry; + static HashTable *handlers; -static TsHashTable *instance; -static TsHashTable *proxy; +static TsHashTable *pool; static TsHashTable *classes; static zend_llist *classes_list; @@ -102,30 +97,26 @@ ZEND_GET_MODULE(rpc); #endif -/* {{{ PHP_INI - */ -PHP_INI_BEGIN() -/* TODO: add module specific ini settings here */ -PHP_INI_END() -/* }}} */ - -static void rpc_globals_ctor(zend_rpc_globals *rpc_globals TSRMLS_DC) -{ -} +ZEND_INI_BEGIN() +ZEND_INI_END() /* {{{ ZEND_MINIT_FUNCTION */ ZEND_MINIT_FUNCTION(rpc) { + zend_class_entry *rpc_entry; + + /* rpc base class entry */ + INIT_CLASS_ENTRY(rpc_class_entry, "rpc", NULL); + rpc_entry = zend_register_internal_class(&rpc_class_entry TSRMLS_CC); + handlers = (HashTable *) pemalloc(sizeof(HashTable), TRUE); - instance = (TsHashTable *) pemalloc(sizeof(TsHashTable), TRUE); - proxy = (TsHashTable *) pemalloc(sizeof(TsHashTable), TRUE); + pool = (TsHashTable *) pemalloc(sizeof(TsHashTable), TRUE); classes = (TsHashTable *) pemalloc(sizeof(TsHashTable), TRUE); classes_list = (zend_llist *) pemalloc(sizeof(zend_llist), TRUE); zend_hash_init(handlers, 0, NULL, NULL, TRUE); - zend_ts_hash_init(instance, 0, NULL, rpc_instance_dtor, TRUE); - zend_ts_hash_init(proxy, 0, NULL, rpc_proxy_dtor, TRUE); + zend_ts_hash_init(pool, sizeof(rpc_internal **), NULL, rpc_instance_dtor, TRUE); zend_ts_hash_init(classes, 0, NULL, NULL, TRUE); zend_llist_init(classes_list, sizeof(rpc_class_hash **), rpc_class_dtor, TRUE); @@ -133,24 +124,21 @@ HANDLER.rpc_handler_init(); /* create a class entry for every rpc handler */ - INIT_OVERLOADED_CLASS_ENTRY((*(HANDLER.ce)), - HANDLER.name, - HANDLER.methods, - NULL, - NULL, - NULL); + INIT_CLASS_ENTRY((*(HANDLER.ce)), + HANDLER.name, + HANDLER.methods); - HANDLER.ce->create_object = rpc_create_object; + HANDLER.ce->create_object = rpc_objects_new; /* load all available rpc handler into a hash */ zend_hash_add(handlers, HANDLER.name, strlen(HANDLER.name) + 1, &(HANDLER.handlers), sizeof(rpc_object_handlers *), NULL); /* register classes and functions */ - zend_register_internal_class(HANDLER.ce TSRMLS_CC); + zend_register_internal_class_ex(HANDLER.ce, rpc_entry, NULL TSRMLS_CC); zend_register_functions(HANDLER.functions, NULL, MODULE_PERSISTENT TSRMLS_CC); + zend_register_ini_entries(HANDLER.ini, module_number TSRMLS_CC); } - ZEND_INIT_MODULE_GLOBALS(rpc, rpc_globals_ctor, NULL); REGISTER_INI_ENTRIES(); return SUCCESS; @@ -162,16 +150,13 @@ ZEND_MSHUTDOWN_FUNCTION(rpc) { /* destroy instances first */ - zend_ts_hash_destroy(instance); - zend_ts_hash_destroy(proxy); - zend_ts_hash_destroy(classes); + zend_ts_hash_destroy(pool); + zend_ts_hash_destroy(classes); zend_llist_destroy(classes_list); zend_hash_destroy(handlers); pefree(handlers, TRUE); - pefree(instance, TRUE); - pefree(proxy, TRUE); pefree(classes, TRUE); UNREGISTER_INI_ENTRIES(); @@ -191,36 +176,16 @@ } /* }}} */ -static void rpc_instance_dtor(void *pDest) -{ - rpc_internal **intern; - - intern = (rpc_internal **) pDest; - - (*(*intern)->handlers)->rpc_dtor(&((*intern)->data)); - - tsrm_mutex_free((*intern)->function_table.mx_reader); - tsrm_mutex_free((*intern)->function_table.mx_writer); - tsrm_mutex_free((*intern)->mx_handler); - - pefree(*intern, TRUE); -} - -static void rpc_proxy_dtor(void *pDest) -{ - rpc_proxy **proxy_intern; - - proxy_intern = (rpc_proxy **) pDest; - - pefree(*proxy_intern, TRUE); -} - static void rpc_class_dtor(void *pDest) { rpc_class_hash **hash; hash = (rpc_class_hash **) pDest; + if ((*hash)->singleton) { + RPC_HT(*hash)->rpc_dtor((*hash)->data); + } + zend_ts_hash_destroy(&((*hash)->methods)); zend_ts_hash_destroy(&((*hash)->properties)); @@ -238,7 +203,18 @@ pefree(*string, TRUE); } -static zend_object_value rpc_create_object(zend_class_entry *class_type TSRMLS_DC) +static void rpc_instance_dtor(void *pDest) +{ + rpc_internal **intern; + + intern = (rpc_internal **) pDest; + + RPC_HT(*intern)->rpc_dtor((*intern)->data); + + pefree(*intern, TRUE); +} + +static zend_object_value rpc_objects_new(zend_class_entry *class_type TSRMLS_DC) { zend_object_value *zov; rpc_internal *intern; @@ -250,13 +226,8 @@ /* set up the internal representation of our rpc instance */ intern = (rpc_internal *) pemalloc(sizeof(rpc_internal), TRUE); - intern->class_name = NULL; - intern->class_name_len = 0; intern->ce = class_type; - intern->refcount = 1; - intern->clonecount = 1; intern->data = NULL; - intern->pool_instances = 0; intern->function_table.hash = intern->ce->function_table; intern->function_table.reader = 0; intern->function_table.mx_reader = tsrm_mutex_alloc(); @@ -267,15 +238,7 @@ /* TODO: exception */ } - /* store the instance in a hash and set the key as handle, thus - * we can find it later easily - */ - tsrm_mutex_lock(instance->mx_writer); - { - zov->handle = zend_hash_next_free_element(&(instance->hash)); - zend_ts_hash_next_index_insert(instance, &intern, sizeof(rpc_internal *), NULL); - } - tsrm_mutex_unlock(instance->mx_writer); + zov->handle = zend_objects_store_put(intern, rpc_objects_delete, NULL TSRMLS_CC); return *zov; } @@ -295,71 +258,36 @@ /* store the instance in a hash and set the key as handle, thus * we can find it later easily */ - tsrm_mutex_lock(proxy->mx_writer); +/* tsrm_mutex_lock(proxy->mx_writer); { - zov->handle = zend_hash_next_free_element(&(proxy->hash)); + zov->handle = zend_hash_next_free_element(TS_HASH(proxy)); zend_ts_hash_next_index_insert(proxy, &proxy_intern, sizeof(rpc_proxy *), NULL); } tsrm_mutex_unlock(proxy->mx_writer); - +*/ return *zov; } /* object handler */ -static void rpc_add_ref(zval *object TSRMLS_DC) -{ - GET_INTERNAL(intern); - RPC_ADDREF(intern); -} - -static void rpc_del_ref(zval *object TSRMLS_DC) +static void rpc_objects_delete(void *object, zend_object_handle handle TSRMLS_DC) { - rpc_internal **intern; + rpc_internal *intern = (rpc_internal *) object; - if (GET_INTERNAL_EX(intern, object) == SUCCESS) { - if (RPC_REFCOUNT(intern) > 0) { - RPC_DELREF(intern); - } - - if (RPC_REFCOUNT(intern) == 0) { - zend_ts_hash_index_del(instance, Z_OBJ_HANDLE(*object)); - } - } -} - -static void rpc_delete(zval *object TSRMLS_DC) -{ - rpc_internal **intern; - - if (GET_INTERNAL_EX(intern, object) == SUCCESS) { - if (RPC_CLONECOUNT(intern) > 0) { - RPC_DELCLONE(intern); - } - - if (RPC_CLONECOUNT(intern) == 0) { - zend_ts_hash_index_del(instance, Z_OBJ_HANDLE_P(object)); + if (RPC_CLASS(intern) && RPC_CLASS(intern)->singleton) { + pefree(intern, TRUE); + } else if (RPC_CLASS(intern) && RPC_CLASS(intern)->poolable) { + if (RPC_CLASS(intern)->name.str) { + zend_ts_hash_add(pool, RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL); + } else { + zend_ts_hash_index_update(pool, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL); } + } else { + RPC_HT(intern)->rpc_dtor(intern->data); + pefree(intern, TRUE); } } -static zend_object_value rpc_clone(zval *object TSRMLS_DC) -{ - GET_INTERNAL(intern); - - /* cloning the underlaying resource is neither possible nor would it - * make sense, therfore we return the old zend_object_value and increase - * the clone count to not loose the clone when the original object gets - * deleted. - */ - RPC_ADDCLONE(intern); - - /* also increase the refcounter as a clone is just another reference */ - RPC_ADDREF(intern); - - return object->value.obj; -} - static zval* rpc_read(zval *object, zval *member, int type TSRMLS_DC) { zval *return_value; @@ -372,10 +300,10 @@ ZVAL_DELREF(return_value); ZVAL_NULL(return_value); - if ((*intern)->hash && Z_TYPE_P(member) == IS_LONG) { - rpc_internal_get(*intern, NULL, Z_LVAL_P(member), return_value); + if (intern->hash && Z_TYPE_P(member) == IS_LONG) { + rpc_internal_get(intern, NULL, Z_LVAL_P(member), return_value); } else if (Z_TYPE_P(member) == IS_STRING) { - rpc_internal_get(*intern, Z_STRVAL_P(member), Z_STRLEN_P(member), return_value); + rpc_internal_get(intern, Z_STRVAL_P(member), Z_STRLEN_P(member), return_value); } else { /* TODO: exception here */ } @@ -387,10 +315,10 @@ { GET_INTERNAL(intern); - if ((*intern)->hash && Z_TYPE_P(member) == IS_LONG) { - rpc_internal_set(*intern, NULL, Z_LVAL_P(member), value); + if (intern->hash && Z_TYPE_P(member) == IS_LONG) { + rpc_internal_set(intern, NULL, Z_LVAL_P(member), value); } else if (Z_TYPE_P(member) == IS_STRING) { - rpc_internal_set(*intern, Z_STRVAL_P(member), Z_STRLEN_P(member), value); + rpc_internal_set(intern, Z_STRVAL_P(member), Z_STRLEN_P(member), value); } else { /* TODO: exception here */ } @@ -403,7 +331,6 @@ return_value = emalloc(sizeof(zval *)); MAKE_STD_ZVAL(*return_value); -// ZVAL_DELREF(*return_value); Z_TYPE_P(object) = IS_OBJECT; (*return_value)->value.obj = rpc_create_proxy(TSRMLS_C); @@ -448,7 +375,7 @@ zend_function *function; GET_INTERNAL(intern); - if (zend_ts_hash_find(&((*intern)->function_table), method, method_len + 1, &function) != SUCCESS) { + if (zend_ts_hash_find(&(intern->function_table), method, method_len + 1, &function) != SUCCESS) { zend_internal_function *zif; zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function)); @@ -459,7 +386,7 @@ zif->type = ZEND_INTERNAL_FUNCTION; /* add new method to the method table */ - zend_ts_hash_add(&((*intern)->function_table), method, method_len + 1, zif, sizeof(zend_function), &function); + zend_ts_hash_add(&(intern->function_table), method, method_len + 1, zif, sizeof(zend_function), &function); efree(zif); } @@ -470,39 +397,31 @@ { zend_function *rpc_ctor; GET_INTERNAL(intern); - - if (zend_ts_hash_find(&((*intern)->function_table), (*intern)->ce->name, (*intern)->ce->name_length + 1, &rpc_ctor) != SUCCESS) { + + if (zend_ts_hash_find(&(intern->function_table), intern->ce->name, intern->ce->name_length + 1, &rpc_ctor) != SUCCESS) { zend_internal_function *zif; zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function)); zif->type = ZEND_INTERNAL_FUNCTION; - zif->function_name = (*intern)->ce->name; - zif->scope = (*intern)->ce; + zif->function_name = intern->ce->name; + zif->scope = intern->ce; zif->arg_types = NULL; zif->handler = ZEND_FN(rpc_load); /* add new constructor to the method table */ - zend_ts_hash_add(&((*intern)->function_table), (*intern)->ce->name, (*intern)->ce->name_length + 1, zif, sizeof(zend_function), &rpc_ctor); + zend_ts_hash_add(&(intern->function_table), intern->ce->name, intern->ce->name_length + 1, zif, sizeof(zend_function), &rpc_ctor); efree(zif); } return rpc_ctor; } -static zend_class_entry** rpc_get_class_entry(zval *object TSRMLS_DC) +static zend_class_entry* rpc_get_class_entry(zval *object TSRMLS_DC) { GET_INTERNAL(intern); - return &((*intern)->ce); -} - -static int rpc_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) -{ -// GET_INTERNAL(intern); - - /* FIXME */ - return FAILURE; + return intern->ce; } static int rpc_compare(zval *object1, zval *object2 TSRMLS_DC) @@ -518,11 +437,12 @@ { zval *object = getThis(); zval ***args, ***args_free; - zend_uint num_args = ZEND_NUM_ARGS(); + zend_uint num_args = ZEND_NUM_ARGS(); + zend_class_entry overloaded_class_entry; rpc_class_hash *class_hash; rpc_class_hash **class_hash_find = NULL; - rpc_internal **intern; - rpc_string hash_val; + rpc_internal *intern; + rpc_string hash_val, class_val; int retval, append = 0; char *arg_types; @@ -541,7 +461,7 @@ Z_TYPE_P(object) = IS_OBJECT; /* create a new object */ - object->value.obj = rpc_create_object(*ce TSRMLS_CC); + object->value.obj = rpc_objects_new(*ce TSRMLS_CC); /* now everything is set up the same way as if we were called as a constructor */ } @@ -554,22 +474,22 @@ GET_ARGS_EX(num_args, args, args_free, 1); /* if classname != integer */ - if ((zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 1 TSRMLS_CC, "l", &((*intern)->class_name_len)) != SUCCESS) || + if ((zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 1 TSRMLS_CC, "l", &class_val.str) != SUCCESS) || /* or we have no hash function */ - !((*(*intern)->handlers)->rpc_hash) || + !(RPC_HT(intern)->rpc_hash) || /* or integer hashing is not allowed */ - !((*(*intern)->handlers)->hash_type & HASH_AS_INT)) { + !(RPC_HT(intern)->hash_type & HASH_AS_INT)) { /* else check for string - classname */ - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 1 TSRMLS_CC, "s", &((*intern)->class_name), &((*intern)->class_name_len)) != SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 1 TSRMLS_CC, "s", &class_val.str, &class_val.len) != SUCCESS) { /* none of the two possibilities */ /* TODO: exception */ php_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C)); } else { /* hash classname if hashing function exists */ - if ((*(*intern)->handlers)->rpc_hash) { + if (RPC_HT(intern)->rpc_hash) { - GET_CTOR_SIGNATURE(intern, hash_val, num_args, arg_types); + GET_SIGNATURE(intern, class_val.str, class_val.len, hash_val, num_args, arg_types); /* check if already hashed */ if (zend_ts_hash_find(classes, hash_val.str, hash_val.len + 1, (void **) &class_hash_find) != SUCCESS) { @@ -578,15 +498,25 @@ /* set up the cache */ zend_ts_hash_init(&(class_hash->methods), 0, NULL, rpc_string_dtor, TRUE); zend_ts_hash_init(&(class_hash->properties), 0, NULL, rpc_string_dtor, TRUE); - + class_hash->handlers = intern->handlers; + class_hash->singleton = FALSE; + class_hash->poolable = FALSE; + class_hash->data = NULL; /* do hashing */ - if ((*(*intern)->handlers)->rpc_hash((*intern)->class_name, (*intern)->class_name_len, &(class_hash->name.str), - &(class_hash->name.len), num_args, arg_types, CLASS) != SUCCESS) { + if (RPC_HT(intern)->rpc_hash(class_val, (rpc_string *)(class_hash), num_args, arg_types, CLASS) != SUCCESS) { /* TODO: exception */ } - /* register with non-hashed key + /* overload class entry */ + RPC_HT(intern)->rpc_name(class_val, &class_val, CLASS); + INIT_CLASS_ENTRY(overloaded_class_entry, NULL, NULL); + overloaded_class_entry.name = class_val.str; + overloaded_class_entry.name_length = class_val.len; + class_hash->ce = zend_register_internal_class_ex(&overloaded_class_entry, intern->ce, NULL TSRMLS_CC); + intern->ce = class_hash->ce; + + /* register with non-hashed key * also track all instaces in a llist for destruction later on, because there might be duplicate entries in * the hashtable and we can't determine if a pointer references to an already freed element */ @@ -598,49 +528,78 @@ if (class_hash->name.str) { /* register string hashcode */ zend_ts_hash_add(classes, class_hash->name.str, class_hash->name.len + 1, &class_hash, sizeof(rpc_class_hash *), NULL); - } else if (!class_hash->name.str && ((*(*intern)->handlers)->hash_type & HASH_AS_INT)) { + } else if (!class_hash->name.str && (RPC_HT(intern)->hash_type & HASH_AS_INT)) { /* register int hashcode */ zend_ts_hash_index_update(classes, class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL); } } else { class_hash = *class_hash_find; + intern->ce = class_hash->ce; } FREE_SIGNATURE(hash_val, arg_types); + } else { + /* overload class entry */ + INIT_CLASS_ENTRY(overloaded_class_entry, class_val.str, NULL); + intern->ce = zend_register_internal_class_ex(&overloaded_class_entry, intern->ce, NULL TSRMLS_CC); } } } else { /* integer classname (hashcode) */ - if (zend_ts_hash_index_find(classes, (*intern)->class_name_len, (void**) &class_hash_find) != SUCCESS) { + if (zend_ts_hash_index_find(classes, class_val.len, (void**) &class_hash_find) != SUCCESS) { class_hash = pemalloc(sizeof(rpc_class_hash), TRUE); /* set up the cache */ class_hash->name.str = NULL; - class_hash->name.len = (*intern)->class_name_len; + class_hash->name.len = class_val.len; + class_hash->handlers = intern->handlers; + class_hash->singleton = FALSE; + class_hash->poolable = FALSE; + class_hash->data = NULL; zend_ts_hash_init(&(class_hash->methods), 0, NULL, rpc_string_dtor, TRUE); zend_ts_hash_init(&(class_hash->properties), 0, NULL, rpc_string_dtor, TRUE); + /* overload class entry */ + RPC_HT(intern)->rpc_name(class_val, &class_val, CLASS); + INIT_CLASS_ENTRY(overloaded_class_entry, class_val.str, NULL); + class_hash->ce = zend_register_internal_class_ex(&overloaded_class_entry, intern->ce, NULL TSRMLS_CC); + intern->ce = class_hash->ce; + /* register int hashcode, we don't know more */ zend_ts_hash_index_update(classes, class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL); } else { class_hash = *class_hash_find; + intern->ce = class_hash->ce; } } /* if hash function available */ - if ((*(*intern)->handlers)->rpc_hash) { + if (RPC_HT(intern)->rpc_hash) { + rpc_internal *pool_intern; + /* assign cache structure */ - (*intern)->hash = class_hash; + RPC_CLASS(intern) = class_hash; - /* call the rpc ctor */ - retval = (*(*intern)->handlers)->rpc_ctor(class_hash->name.str, class_hash->name.len, &((*intern)->data), num_args, args); + if (zend_ts_hash_remove_key_or_index(pool, RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, (void **) &pool_intern) == SUCCESS) { + intern->data = pool_intern->data; + + pefree(pool_intern, TRUE); + retval = SUCCESS; + } else if (RPC_CLASS(intern)->singleton) { + /* singleton */ + intern->data = RPC_CLASS(intern)->data; + retval = SUCCESS; + } else { + /* call the rpc ctor */ + retval = RPC_HT(intern)->rpc_ctor(*(rpc_string *)(class_hash), &(intern->data), num_args, args); + } } else { /* disable caching from now on */ - (*intern)->hash = NULL; + intern->hash = NULL; /* call the rpc ctor */ - retval = (*(*intern)->handlers)->rpc_ctor((*intern)->class_name, (*intern)->class_name_len, &((*intern)->data), num_args, args); + retval = RPC_HT(intern)->rpc_ctor(class_val, &(intern->data), num_args, args); } efree(args_free); @@ -654,7 +613,7 @@ { zval *object = getThis(); zval ***args, ***args_free; - zend_uint num_args = ZEND_NUM_ARGS(); + zend_uint num_args = ZEND_NUM_ARGS(); char *hash = NULL, *arg_types; int hash_len, retval, strip = 0; @@ -690,23 +649,23 @@ method_hash->str = hash; method_hash->len = hash_len; - if ((*intern)->hash) { + if (intern->hash) { /* cache method table lookups */ - if (!hash && !((*(*intern)->handlers)->hash_type & HASH_AS_INT)) { + if (!hash && !(RPC_HT(intern)->hash_type & HASH_AS_INT)) { /* TODO: exception */ } else if(hash) { /* string passed */ GET_METHOD_SIGNATURE(intern, method_hash, hash_val, num_args, arg_types); /* check if already hashed */ - if (zend_ts_hash_find(&((*intern)->hash->methods), hash_val.str, hash_val.len + 1, (void **) &method_hash_find) != SUCCESS) { - if ((*(*intern)->handlers)->rpc_hash(hash, hash_len, &(method_hash->str), &(method_hash->len), num_args, arg_types, METHOD) != SUCCESS) { + if (zend_ts_hash_find(&(intern->hash->methods), hash_val.str, hash_val.len + 1, (void **) &method_hash_find) != SUCCESS) { + if (RPC_HT(intern)->rpc_hash(*method_hash, method_hash, num_args, arg_types, METHOD) != SUCCESS) { /* TODO: exception */ } /* register with non-hashed key */ - zend_ts_hash_add(&((*intern)->hash->methods), hash_val.str, hash_val.len + 1, &method_hash, sizeof(rpc_string *), NULL); + zend_ts_hash_add(&(intern->hash->methods), hash_val.str, hash_val.len + 1, &method_hash, sizeof(rpc_string *), NULL); } else { pefree(method_hash, TRUE); method_hash = *method_hash_find; @@ -720,9 +679,9 @@ * considering possible thread implementations in future php versions * and srm it is better to do concurrency checks */ - tsrm_mutex_lock((*intern)->mx_handler); - retval = (*(*intern)->handlers)->rpc_call(method_hash->str, method_hash->len, &((*intern)->data), &return_value, num_args, args); - tsrm_mutex_unlock((*intern)->mx_handler); + tsrm_mutex_lock(intern->mx_handler); + retval = RPC_HT(intern)->rpc_call(*method_hash, &(intern->data), &return_value, num_args, args); + tsrm_mutex_unlock(intern->mx_handler); } efree(args_free); @@ -737,7 +696,7 @@ zval *object, *value; char *property = NULL; int property_len; - rpc_internal **intern; + rpc_internal *intern; /* get class entry */ GET_CLASS(ce); @@ -750,10 +709,10 @@ } GET_INTERNAL_EX(intern, object); - if (!property && !(*intern)->hash) { + if (!property && !intern->hash) { /* TODO: exception here */ } else { - rpc_internal_set(*intern, property, property_len, value); + rpc_internal_set(intern, property, property_len, value); } } @@ -762,7 +721,7 @@ zval *object; char *property = NULL; int property_len; - rpc_internal **intern; + rpc_internal *intern; /* get class entry */ GET_CLASS(ce); @@ -775,13 +734,52 @@ } GET_INTERNAL_EX(intern, object); - if (!property && !(*intern)->hash) { + if (!property && !intern->hash) { /* TODO: exception here */ } else { - rpc_internal_get(*intern, property, property_len, return_value); + rpc_internal_get(intern, property, property_len, return_value); + } +} + +ZEND_FUNCTION(rpc_singleton) +{ + zval *object; + rpc_internal *intern; + /* get class entry */ + GET_CLASS(ce); + + zend_parse_parameters(1 TSRMLS_CC, "O", &object, *ce); + + GET_INTERNAL_EX(intern, object); + + if (!RPC_CLASS(intern)) { + /* TODO: exception here, no hashing */ + } else if (!RPC_CLASS(intern)->singleton) { + RPC_CLASS(intern)->singleton = TRUE; + RPC_CLASS(intern)->data = intern->data; + } +} + +ZEND_FUNCTION(rpc_poolable) +{ + zval *object; + rpc_internal *intern; + /* get class entry */ + GET_CLASS(ce); + + zend_parse_parameters(1 TSRMLS_CC, "O", &object, *ce); + + GET_INTERNAL_EX(intern, object); + + if (RPC_HT(intern)->poolable && RPC_CLASS(intern) && (RPC_HT(intern)->poolable == TRUE)) { + RPC_CLASS(intern)->poolable = TRUE; + } else { + /* TODO: exception here, no hashing */ } } +/*******************/ + static void rpc_internal_get(rpc_internal *intern, char *property, zend_uint property_len, zval *return_value) { int retval; @@ -796,12 +794,12 @@ if (intern->hash) { /* cache method table lookups */ - if (!property && !((*intern->handlers)->hash_type & HASH_AS_INT)) { + if (!property && !(RPC_HT(intern)->hash_type & HASH_AS_INT)) { /* TODO: exception */ } else if(property) { /* check if already hashed */ if (zend_ts_hash_find(&(intern->hash->properties), property, property_len + 1, (void **) &property_hash_find) != SUCCESS) { - if ((*intern->handlers)->rpc_hash(property, property_len, &(property_hash->str), &(property_hash->len), 0, NULL, PROPERTY) != SUCCESS) { + if (RPC_HT(intern)->rpc_hash(*property_hash, property_hash, 0, NULL, PROPERTY) != SUCCESS) { /* TODO: exception */ } @@ -816,7 +814,7 @@ tsrm_mutex_lock(intern->mx_handler); - retval = (*intern->handlers)->rpc_get(property_hash->str, property_hash->len, return_value, intern->data); + retval = RPC_HT(intern)->rpc_get(*property_hash, return_value, intern->data); tsrm_mutex_unlock(intern->mx_handler); if (retval != SUCCESS) { @@ -827,15 +825,92 @@ static void rpc_internal_set(rpc_internal *intern, char *property, zend_uint property_len, zval *value) { int retval; + rpc_string property_name; + + property_name.str = property; + property_name.len = property_len; tsrm_mutex_lock(intern->mx_handler); - retval = (*intern->handlers)->rpc_set(property, property_len, value, intern->data); + retval = RPC_HT(intern)->rpc_set(property_name, value, intern->data); tsrm_mutex_unlock(intern->mx_handler); if (retval != SUCCESS) { /* TODO: exception here */ } } + +/***********************************/ + +static int zend_ts_hash_remove_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData) +{ + uint nIndex; + uint h = nKeyLength; + uint result; + void **ppData; + Bucket *p; + + tsrm_mutex_lock(ht->mx_writer); + + if (arKey) { + result = zend_hash_find(TS_HASH(ht), arKey, nKeyLength, (void **) &ppData); + } else { + result = zend_hash_index_find(TS_HASH(ht), h, (void **) &ppData); + } + + if (result == SUCCESS) { + *pData = *ppData; + + if (arKey) { + h = zend_inline_hash_func(arKey, nKeyLength); + } + + nIndex = h & TS_HASH(ht)->nTableMask; + + p = TS_HASH(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 == TS_HASH(ht)->arBuckets[nIndex]) { + TS_HASH(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 */ + TS_HASH(ht)->pListHead = p->pListNext; + } + if (p->pListNext != NULL) { + p->pListNext->pListLast = p->pListLast; + } else { + TS_HASH(ht)->pListTail = p->pListLast; + } + if (TS_HASH(ht)->pInternalPointer == p) { + TS_HASH(ht)->pInternalPointer = p->pListNext; + } + if (!p->pDataPtr) { + pefree(p->pData, TS_HASH(ht)->persistent); + } + pefree(p, TS_HASH(ht)->persistent); + HANDLE_UNBLOCK_INTERRUPTIONS(); + TS_HASH(ht)->nNumOfElements--; + return SUCCESS; + } + p = p->pNext; + } + } + tsrm_mutex_unlock(ht->mx_writer); + + return FAILURE; +} + + + /* * Local variables: 1.2.2.1 +6 -16 php4/ext/rpc/rpc.h Index: rpc.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/rpc/rpc.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- rpc.h 29 Apr 2002 02:30:59 -0000 1.2 +++ rpc.h 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -5,12 +5,15 @@ #define HANDLER handler_entries[__handler_counter] #define HANDLER_COUNT (sizeof(handler_entries) / sizeof(rpc_handler_entry)) -#define GET_INTERNAL(intern) rpc_internal **intern; \ +#define RPC_HT(intern) (*((intern)->handlers)) +#define RPC_CLASS(intern) ((intern)->hash) + +#define GET_INTERNAL(intern) rpc_internal *intern; \ if (GET_INTERNAL_EX(intern, object) != SUCCESS) { \ /* TODO: exception */ \ } -#define GET_INTERNAL_EX(intern, object) zend_ts_hash_index_find(instance, object->value.obj.handle, (void **) &intern) +#define GET_INTERNAL_EX(intern, object) (((intern = zend_object_store_get_object(object TSRMLS_CC)) == NULL) ? FAILURE : SUCCESS) #define GET_CLASS(ce) char *key; \ int key_len; \ @@ -48,16 +51,13 @@ /* TODO: exception */ \ } -#define GET_CTOR_SIGNATURE(intern, hash_val, num_args, arg_types) \ - GET_SIGNATURE(intern, (*intern)->class_name, (*intern)->class_name_len, hash_val, num_args, arg_types) - #define GET_METHOD_SIGNATURE(intern, method, hash_val, num_args, arg_types) \ GET_SIGNATURE(intern, method->str, method->len, hash_val, num_args, arg_types) #define GET_SIGNATURE(intern, name, name_len, hash_val, num_args, arg_types) \ hash_val.len = name_len; \ \ - if ((*(*intern)->handlers)->hash_type & HASH_WITH_SIGNATURE) { \ + if ((*intern->handlers)->hash_type & HASH_WITH_SIGNATURE) { \ zend_uint _signature_counter; \ \ arg_types = (char *) emalloc(sizeof(char) * (num_args + 1)); \ @@ -108,16 +108,6 @@ #define FREE_SIGNATURE(hash_val, arg_types) \ efree(arg_types); \ efree(hash_val.str); - - - -#define RPC_REFCOUNT(intern) ((*intern)->refcount) -#define RPC_ADDREF(intern) (++RPC_REFCOUNT(intern)) -#define RPC_DELREF(intern) (--RPC_REFCOUNT(intern)) - -#define RPC_CLONECOUNT(intern) ((*intern)->clonecount) -#define RPC_ADDCLONE(intern) (++RPC_CLONECOUNT(intern)) -#define RPC_DELCLONE(intern) (--RPC_CLONECOUNT(intern)) static int __handler_counter; 1.2.2.1 +4 -2 php4/ext/rpc/rpc_proxy.c Index: rpc_proxy.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/rpc/rpc_proxy.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- rpc_proxy.c 29 Apr 2002 02:30:59 -0000 1.2 +++ rpc_proxy.c 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -18,7 +18,7 @@ static HashTable* rpc_proxy_get_properties(zval * TSRMLS_DC); static union _zend_function* rpc_proxy_get_method(zval *, char *, int TSRMLS_DC); static union _zend_function* rpc_proxy_get_constructor(zval * TSRMLS_DC); -static zend_class_entry** rpc_proxy_get_class_entry(zval *object TSRMLS_DC); +static zend_class_entry* rpc_proxy_get_class_entry(zval *object TSRMLS_DC); static int rpc_proxy_get_classname(zval *, char **, zend_uint *, int TSRMLS_DC); static int rpc_proxy_compare(zval *, zval * TSRMLS_DC); /**/ @@ -34,6 +34,8 @@ NULL, rpc_proxy_get, rpc_proxy_set, + NULL, + NULL, rpc_proxy_has_property, rpc_proxy_unset_property, rpc_proxy_get_properties, @@ -111,7 +113,7 @@ return NULL; } -static zend_class_entry** rpc_proxy_get_class_entry(zval *object TSRMLS_DC) +static zend_class_entry* rpc_proxy_get_class_entry(zval *object TSRMLS_DC) { return NULL; } No revision No revision 1.2.2.1 +39 -22 php4/ext/rpc/com/com.c Index: com.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/com.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- com.c 29 Apr 2002 02:30:59 -0000 1.2 +++ com.c 9 Jul 2002 09:14:38 -0000 1.2.2.1 @@ -1,45 +1,55 @@ #include "com.h" /* protos */ -static int com_hash(char *, zend_uint, char **, zend_uint *, int, char *, int); -static int com_ctor(char *, zend_uint, void **, int , zval ***); +static int com_hash(rpc_string, rpc_string *, int, char *, int); +static int com_name(rpc_string, rpc_string *, int); +static int com_ctor(rpc_string, void **, int , zval ***); static int com_dtor(void **); -static int com_call(char *, zend_uint, void **, zval **, int, zval ***); -static int com_get(char *, zend_uint, zval *, void **); -static int com_set(char *, zend_uint, zval *, void **); +static int com_call(rpc_string, void **, zval **, int, zval ***); +static int com_get(rpc_string, zval *, void **); +static int com_set(rpc_string, zval *, void **); static int com_compare(void **, void **); -static int com_get_classname(char **, zend_uint *, void **); -static int com_has_property(char *, zend_uint, void **); -static int com_unset_property(char *, zend_uint, void **); +static int com_has_property(rpc_string, void **); +static int com_unset_property(rpc_string, void **); static int com_get_properties(HashTable **, void **); /* register rpc callback function */ RPC_REGISTER_HANDLERS_START(com) -POOL, +TRUE, /* poolable */ HASH_AS_INT_WITH_SIGNATURE, com_hash, +com_name, com_ctor, com_dtor, com_call, com_get, com_set, com_compare, -com_get_classname, com_has_property, com_unset_property, com_get_properties RPC_REGISTER_HANDLERS_END() +/* register ini settings */ +RPC_INI_START(com) +PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) +PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) +PHP_INI_ENTRY_EX("com.autoregister_verbose", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) +PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) +RPC_INI_END() + /* register userspace functions */ RPC_FUNCTION_ENTRY_START(com) ZEND_FALIAS(com_invoke, rpc_call, NULL) ZEND_FE(com_addref, NULL) + ZEND_FE(com_release, NULL) RPC_FUNCTION_ENTRY_END() /* register class methods */ RPC_METHOD_ENTRY_START(com) ZEND_FALIAS(addref, com_addref, NULL) + ZEND_FALIAS(release, com_release, NULL) RPC_METHOD_ENTRY_END() /* init function that is called before the class is registered @@ -51,55 +61,58 @@ /* rpc handler functions */ -static int com_hash(char *name, zend_uint name_len, char **hash, zend_uint *hash_len, int num_args, char *arg_types, int type) +static int com_hash(rpc_string name, rpc_string *hash, int num_args, char *arg_types, int type) { - *hash = strdup(name); - *hash_len = name_len; + hash->str = strdup(name.str); + hash->len = name.len; return SUCCESS; } -static int com_ctor(char *class_name, zend_uint class_name_len, void **data, int num_args, zval **args[]) +static int com_name(rpc_string hash, rpc_string *name, int type) { + name->str = strdup(hash.str); + name->len = hash.len; + return SUCCESS; } -static int com_dtor(void **data) +static int com_ctor(rpc_string class_name, void **data, int num_args, zval **args[]) { return SUCCESS; } -static int com_call(char *method_name, zend_uint method_name_len, void **data, zval **return_value, int num_args, zval **args[]) +static int com_dtor(void **data) { return SUCCESS; } -static int com_get(char *property_name, zend_uint property_name_len, zval *return_value, void **data) +static int com_call(rpc_string method_name, void **data, zval **return_value, int num_args, zval **args[]) { return SUCCESS; } -static int com_set(char *property_name, zend_uint property_name_len, zval *value, void **data) +static int com_get(rpc_string property_name, zval *return_value, void **data) { return SUCCESS; } -static int com_compare(void **data1, void **data2) +static int com_set(rpc_string property_name, zval *value, void **data) { return SUCCESS; } -static int com_get_classname(char **class_name, zend_uint *class_name_length, void **data) +static int com_compare(void **data1, void **data2) { return SUCCESS; } -static int com_has_property(char *property_name, zend_uint property_name_length, void **data) +static int com_has_property(rpc_string property_name, void **data) { return SUCCESS; } -static int com_unset_property(char *property_name, zend_uint property_name_length, void **data) +static int com_unset_property(rpc_string property_name, void **data) { return SUCCESS; } @@ -111,5 +124,9 @@ /* custom functions */ ZEND_FUNCTION(com_addref) +{ +} + +ZEND_FUNCTION(com_release) { } No revision No revision 1.2.2.1 +9 -34 php4/ext/rpc/tests/test1.php Index: test1.php =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/rpc/tests/test1.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- test1.php 29 Apr 2002 02:30:59 -0000 1.2 +++ test1.php 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -1,39 +1,14 @@ <?php -print "huhuhdsa"; -$rpc = new com("class", true, "huh"); -$rpc2 = new com("class", true, "hehe", 1); -$rpc->call("blah"); -$rpc->call("heh"); -$rpc->call("blah"); -com_call($rpc, 1, "1"); -com_call($rpc, 1, "1"); -$rpc->call("blah"); -$rpc->call("blah"); -$rpc->call("blah"); -$rpc2->call("hehe"); -$rpc2->call("hehe"); -$rpc2->call("hehe"); -$rpc2->call("hehe"); -$rpc2->call("hehe"); -com_call($rpc, "call", 1); -com_call($rpc, 1, "1"); -com_call($rpc, "call", 1); -com_call($rpc2, "call", 1); -com_call($rpc2, "call", 1); -//$rpc->addref(); +$rpc = new com("class"); -//$clone = $rpc->__clone(); +/* class hirarchy test */ +echo "is class .. " . (get_class($rpc) == "class" ? "passed" : "faiure"); +echo "\n"; +echo "is com .. " . (is_subclass_of($rpc, "com") ? "passed" : "failure"); +echo "\n"; +echo "is rpc .. " . (is_subclass_of($rpc, "rpc") ? "passed" : "failure"); -//$rpc->prop = 1; -//$a = $rpc->prop; - -//$a = &$rpc->prop; - -//delete $rpc; -//delete $clone; - -$heh = com_load("heh", 1); -$heh->knorp(); -/*delete $heh;*/ +/* uncloneable */ +//$rpc->__clone(); // issues a fatal ?> No revision No revision 1.2.2.2 +10 -11 php4/ext/session/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/session/config.m4,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- config.m4 9 May 2002 04:17:00 -0000 1.2.2.1 +++ config.m4 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.18 2002/05/04 16:48:48 sas Exp $ +dnl $Id: config.m4,v 1.19 2002/06/28 02:27:02 sniper Exp $ dnl PHP_ARG_WITH(mm,for mm support, @@ -8,6 +8,15 @@ PHP_ARG_ENABLE(session, whether to enable PHP sessions, [ --disable-session Disable session support], yes) +if test "$PHP_SESSION" != "no"; then + AC_CHECK_FUNCS(pread pwrite) + PHP_MISSING_PWRITE_DECL + PHP_MISSING_PREAD_DECL + PHP_NEW_EXTENSION(session, session.c mod_files.c mod_mm.c mod_user.c, $ext_shared) + PHP_SUBST(SESSION_SHARED_LIBADD) + AC_DEFINE(HAVE_PHP_SESSION,1,[ ]) +fi + if test "$PHP_MM" != "no"; then for i in /usr/local /usr $PHP_MM; do if test -f "$i/include/mm.h"; then @@ -22,14 +31,4 @@ PHP_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/lib, SESSION_SHARED_LIBADD) PHP_ADD_INCLUDE($MM_DIR/include) AC_DEFINE(HAVE_LIBMM, 1, [Whether you have libmm]) - PHP_MODULE_PTR(phpext_ps_mm_ptr) -fi - -if test "$PHP_SESSION" != "no"; then - AC_CHECK_FUNCS(pread pwrite) - PHP_MISSING_PWRITE_DECL - PHP_MISSING_PREAD_DECL - PHP_NEW_EXTENSION(session, session.c mod_files.c mod_mm.c mod_user.c, $ext_shared) - PHP_SUBST(SESSION_SHARED_LIBADD) - AC_DEFINE(HAVE_PHP_SESSION,1,[ ]) fi 1.2.2.1 +8 -3 php4/ext/session/mod_files.c Index: mod_files.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/session/mod_files.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mod_files.c 29 Apr 2002 02:30:59 -0000 1.2 +++ mod_files.c 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mod_files.c,v 1.74 2002/04/23 19:58:31 sas Exp $ */ +/* $Id: mod_files.c,v 1.75 2002/05/30 11:41:37 mfischer Exp $ */ #include "php.h" @@ -58,6 +58,8 @@ PS_MOD(files) }; +/* If you change the logic here, please also update the error message in + * ps_files_open() appropriately */ static int ps_files_valid_key(const char *key) { size_t len; @@ -135,8 +137,11 @@ ps_files_close(data); - if (!ps_files_valid_key(key) || - !ps_files_path_create(buf, sizeof(buf), data, key)) + if (!ps_files_valid_key(key)) { + php_error(E_WARNING, "The session id contains illegal characters, valid characters are only a-z, A-Z and 0-9"); + return; + } + if (!ps_files_path_create(buf, sizeof(buf), data, key)) return; data->lastkey = estrdup(key); 1.2.2.1 +1 -12 php4/ext/session/mod_mm.c Index: mod_mm.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/session/mod_mm.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mod_mm.c 29 Apr 2002 02:31:00 -0000 1.2 +++ mod_mm.c 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mod_mm.c,v 1.38 2002/03/06 12:25:01 sas Exp $ */ +/* $Id: mod_mm.c,v 1.39 2002/06/28 02:27:02 sniper Exp $ */ #include "php.h" @@ -422,17 +422,6 @@ return SUCCESS; } - -zend_module_entry php_session_mm_module = { - STANDARD_MODULE_HEADER, - "session mm", - NULL, - PHP_MINIT(ps_mm), PHP_MSHUTDOWN(ps_mm), - NULL, NULL, - NULL, - NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES -}; #endif 1.2.2.1 +3 -9 php4/ext/session/mod_mm.h Index: mod_mm.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/session/mod_mm.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- mod_mm.h 29 Apr 2002 02:31:00 -0000 1.2 +++ mod_mm.h 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -23,19 +23,13 @@ #include "php_session.h" +PHP_MINIT_FUNCTION(ps_mm); +PHP_MSHUTDOWN_FUNCTION(ps_mm); + extern ps_module ps_mod_mm; #define ps_mm_ptr &ps_mod_mm -extern zend_module_entry php_session_mm_module; -#define phpext_ps_mm_ptr &php_session_mm_module - PS_FUNCS(mm); -#else - -#define ps_mm_ptr NULL -#define phpext_ps_mm_ptr NULL - #endif - #endif 1.2.2.2 +1 -0 php4/ext/session/php_session.h Index: php_session.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/session/php_session.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_session.h 9 May 2002 04:17:00 -0000 1.2.2.1 +++ php_session.h 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -113,6 +113,7 @@ zval *http_session_vars; zend_bool auto_start; zend_bool use_cookies; + zend_bool use_only_cookies; zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */ zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */ } php_ps_globals; 1.2.2.4 +77 -44 php4/ext/session/session.c Index: session.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/session/session.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- session.c 19 May 2002 11:16:05 -0000 1.2.2.3 +++ session.c 9 Jul 2002 09:14:39 -0000 1.2.2.4 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.308 2002/05/13 17:28:37 andrei Exp $ */ +/* $Id: session.c,v 1.311 2002/07/03 02:16:46 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -44,33 +44,36 @@ #include "ext/standard/url_scanner_ex.h" #include "ext/standard/php_rand.h" /* for RAND_MAX */ #include "ext/standard/info.h" - #include "ext/standard/php_smart_str.h" #include "mod_files.h" #include "mod_user.h" +#ifdef HAVE_LIBMM +#include "mod_mm.h" +#endif + /* {{{ session_functions[] */ function_entry session_functions[] = { - PHP_FE(session_name, NULL) - PHP_FE(session_module_name, NULL) - PHP_FE(session_save_path, NULL) - PHP_FE(session_id, NULL) - PHP_FE(session_decode, NULL) - PHP_FE(session_register, NULL) - PHP_FE(session_unregister, NULL) - PHP_FE(session_is_registered, NULL) - PHP_FE(session_encode, NULL) - PHP_FE(session_start, NULL) - PHP_FE(session_destroy, NULL) - PHP_FE(session_unset, NULL) - PHP_FE(session_set_save_handler, NULL) - PHP_FE(session_cache_limiter, NULL) - PHP_FE(session_cache_expire, NULL) + PHP_FE(session_name, NULL) + PHP_FE(session_module_name, NULL) + PHP_FE(session_save_path, NULL) + PHP_FE(session_id, NULL) + PHP_FE(session_decode, NULL) + PHP_FE(session_register, NULL) + PHP_FE(session_unregister, NULL) + PHP_FE(session_is_registered, NULL) + PHP_FE(session_encode, NULL) + PHP_FE(session_start, NULL) + PHP_FE(session_destroy, NULL) + PHP_FE(session_unset, NULL) + PHP_FE(session_set_save_handler, NULL) + PHP_FE(session_cache_limiter, NULL) + PHP_FE(session_cache_expire, NULL) PHP_FE(session_set_cookie_params, NULL) PHP_FE(session_get_cookie_params, NULL) - PHP_FE(session_write_close, NULL) + PHP_FE(session_write_close, NULL) {NULL, NULL, NULL} }; /* }}} */ @@ -97,7 +100,6 @@ return SUCCESS; } - static PHP_INI_MH(OnUpdateSerializer) { PS(serializer) = _php_find_ps_serializer(new_value TSRMLS_CC); @@ -119,24 +121,26 @@ /* {{{ PHP_INI */ PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals) - PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler) - STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateInt, gc_probability, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateInt, gc_maxlifetime, php_ps_globals, ps_globals) - PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, OnUpdateSerializer) - STD_PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, OnUpdateInt, cookie_lifetime, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.cookie_path", "/", PHP_INI_ALL, OnUpdateString, cookie_path, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.cookie_domain", "", PHP_INI_ALL, OnUpdateString, cookie_domain, php_ps_globals, ps_globals) - STD_PHP_INI_BOOLEAN("session.cookie_secure", "", PHP_INI_ALL, OnUpdateBool, cookie_secure, php_ps_globals, ps_globals) - STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateBool, use_cookies, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateString, extern_referer_chk, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, OnUpdateInt, entropy_length, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, OnUpdateString, cache_limiter, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateInt, cache_expire, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.use_trans_sid", "1", PHP_INI_ALL, OnUpdateBool, use_trans_sid, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals) + PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler) + STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateInt, gc_probability, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateInt, gc_maxlifetime, php_ps_globals, ps_globals) + PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, OnUpdateSerializer) + STD_PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, OnUpdateInt, cookie_lifetime, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.cookie_path", "/", PHP_INI_ALL, OnUpdateString, cookie_path, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.cookie_domain", "", PHP_INI_ALL, OnUpdateString, cookie_domain, php_ps_globals, ps_globals) + STD_PHP_INI_BOOLEAN("session.cookie_secure", "", PHP_INI_ALL, OnUpdateBool, cookie_secure, php_ps_globals, ps_globals) + STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateBool, use_cookies, php_ps_globals, ps_globals) + STD_PHP_INI_BOOLEAN("session.use_only_cookies", "0", PHP_INI_ALL, OnUpdateBool, use_only_cookies, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateString, extern_referer_chk, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, OnUpdateInt, entropy_length, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, OnUpdateString, cache_limiter, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateInt, cache_expire, php_ps_globals, ps_globals) + STD_PHP_INI_BOOLEAN("session.use_trans_sid", "1", PHP_INI_ALL, OnUpdateBool, use_trans_sid, php_ps_globals, ps_globals) + /* Commented out until future discussion */ /* PHP_INI_ENTRY("session.encode_sources", "globals,track", PHP_INI_ALL, NULL) */ PHP_INI_END() @@ -213,7 +217,7 @@ PHP_MINIT(session), PHP_MSHUTDOWN(session), PHP_RINIT(session), PHP_RSHUTDOWN(session), PHP_MINFO(session), - NO_VERSION_YET, + NO_VERSION_YET, STANDARD_MODULE_PROPERTIES }; @@ -839,7 +843,7 @@ define_sid = 0; } - if (!PS(id) && + if (!PS(use_only_cookies) && !PS(id) && zend_hash_find(&EG(symbol_table), "_GET", sizeof("_GET"), (void **) &data) == SUCCESS && Z_TYPE_PP(data) == IS_ARRAY && @@ -849,7 +853,7 @@ send_cookie = 0; } - if (!PS(id) && + if (!PS(use_only_cookies) && !PS(id) && zend_hash_find(&EG(symbol_table), "_POST", sizeof("_POST"), (void **) &data) == SUCCESS && Z_TYPE_PP(data) == IS_ARRAY && @@ -862,9 +866,9 @@ /* check the REQUEST_URI symbol for a string of the form '<session-name>=<session-id>' to allow URLs of the form - http://yoursite/<session-name>=<session-id>/script.php */ + http://yoursite/<session-name>=<session-id>/script.php */ - if (!PS(id) && + if (!PS(use_only_cookies) && !PS(id) && zend_hash_find(&EG(symbol_table), "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &data) == SUCCESS && Z_TYPE_PP(data) == IS_STRING && @@ -965,12 +969,12 @@ Set session cookie parameters */ PHP_FUNCTION(session_set_cookie_params) { - zval **lifetime, **path, **domain, **secure; + zval **lifetime, **path, **domain, **secure; if (!PS(use_cookies)) return; - if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 4 || + if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 4 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &lifetime, &path, &domain, &secure) == FAILURE) WRONG_PARAM_COUNT; @@ -1458,21 +1462,50 @@ zend_register_auto_global("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC); PS(module_number) = module_number; /* if we really need this var we need to init it in zts mode as well! */ + REGISTER_INI_ENTRIES(); + +#ifdef HAVE_LIBMM + PHP_MINIT(ps_mm) (INIT_FUNC_ARGS_PASSTHRU); +#endif return SUCCESS; } PHP_MSHUTDOWN_FUNCTION(session) { UNREGISTER_INI_ENTRIES(); + +#ifdef HAVE_LIBMM + PHP_MSHUTDOWN(ps_mm) (SHUTDOWN_FUNC_ARGS_PASSTHRU); +#endif + return SUCCESS; } PHP_MINFO_FUNCTION(session) { + ps_module **mod; + smart_str handlers = {0}; + int i; + + for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++) { + if (*mod && (*mod)->name) { + smart_str_appends(&handlers, (*mod)->name); + smart_str_appendc(&handlers, ' '); + } + } + php_info_print_table_start(); php_info_print_table_row(2, "Session Support", "enabled" ); + + if (handlers.c) { + smart_str_0(&handlers); + php_info_print_table_row(2, "Registered save handlers", handlers.c); + smart_str_free(&handlers); + } else { + php_info_print_table_row(2, "Registered save handlers", "none"); + } php_info_print_table_end(); DISPLAY_INI_ENTRIES(); No revision No revision 1.2.2.1 +1 -3 php4/ext/session/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/session/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:00 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/skeleton/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/skeleton/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:00 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +4 -4 php4/ext/snmp/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/snmp/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:31:00 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.25 2002/03/12 16:35:28 sas Exp $ +dnl $Id: config.m4,v 1.26 2002/06/01 20:14:58 sr Exp $ dnl PHP_ARG_WITH(snmp,for SNMP support, @@ -35,10 +35,10 @@ if test "$ac_cv_header_default_store_h" = "yes"; then AC_MSG_CHECKING(for OpenSSL support in SNMP libraries) AC_EGREP_CPP(yes,[ - #include <ucd-snmp-config.h> - #if USE_OPENSSL +#include <ucd-snmp-config.h> +#if USE_OPENSSL yes - #endif +#endif ],[ SNMP_SSL=yes ],[ No revision No revision 1.2.2.1 +1 -0 php4/ext/sockets/php_sockets_win.c Index: php_sockets_win.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/sockets/php_sockets_win.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_sockets_win.c 29 Apr 2002 02:31:00 -0000 1.2 +++ php_sockets_win.c 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -44,6 +44,7 @@ } retval = recv(sock, buffer, bytes, 0); + SleepEx(1, TRUE); if(retval < 0) { efree(buffer); return retval; 1.2.2.5 +5 -4 php4/ext/sockets/sockets.c Index: sockets.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/sockets/sockets.c,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -u -r1.2.2.4 -r1.2.2.5 --- sockets.c 19 May 2002 11:16:05 -0000 1.2.2.4 +++ sockets.c 9 Jul 2002 09:14:39 -0000 1.2.2.5 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.114 2002/05/12 07:22:47 jason Exp $ */ +/* $Id: sockets.c,v 1.116 2002/06/25 06:24:45 mfischer Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -56,7 +56,6 @@ # define set_errno(a) (errno = a) # define set_h_errno(a) (h_errno = a) #else /* windows */ -# include <winsock.h> # include "php_sockets.h" # include "php_sockets_win.h" # define IS_INVALID_SOCKET(a) (a->bsd_socket == INVALID_SOCKET) @@ -755,6 +754,8 @@ retval = (*read_function)(php_sock->bsd_socket, tmpbuf, length); #else retval = recv(php_sock->bsd_socket, tmpbuf, length, 0); + /* i don't know why, but it _does_ fix a memleak */ + SleepEx(1, TRUE); #endif if (retval == -1) { @@ -1942,8 +1943,8 @@ } /* }}} */ -/* {{{ proto int socket_last_error(resource socket) - Returns the last error on the socket */ +/* {{{ proto int socket_last_error([resource socket]) + Returns the last socket error (either the last used or the provided socket resource) */ PHP_FUNCTION(socket_last_error) { zval *arg1 = NULL; No revision No revision 1.2.2.1 +1 -0 php4/ext/standard/Makefile.frag Index: Makefile.frag =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/Makefile.frag,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- Makefile.frag 29 Apr 2002 02:31:01 -0000 1.2 +++ Makefile.frag 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -7,3 +7,4 @@ $(srcdir)/url_scanner_ex.c: $(srcdir)/url_scanner_ex.re re2c -b $(srcdir)/url_scanner_ex.re > $@ +$(srcdir)/info.c: $(builddir)/../../main/build-defs.h 1.2.2.2 +140 -90 php4/ext/standard/array.c Index: array.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/array.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- array.c 19 May 2002 11:16:05 -0000 1.2.2.1 +++ array.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.162 2002/05/13 17:28:38 andrei Exp $ */ +/* $Id: array.c,v 1.169 2002/06/29 15:39:41 derick Exp $ */ #include "php.h" #include "php_ini.h" @@ -60,18 +60,18 @@ #define EXTR_PREFIX_IF_EXISTS 5 #define EXTR_IF_EXISTS 6 -#define SORT_REGULAR 0 -#define SORT_NUMERIC 1 -#define SORT_STRING 2 +#define SORT_REGULAR 0 +#define SORT_NUMERIC 1 +#define SORT_STRING 2 -#define SORT_DESC 3 -#define SORT_ASC 4 +#define SORT_DESC 3 +#define SORT_ASC 4 -#define CASE_LOWER 0 -#define CASE_UPPER 1 +#define CASE_LOWER 0 +#define CASE_UPPER 1 -#define COUNT_NORMAL 0 -#define COUNT_RECURSIVE 1 +#define COUNT_NORMAL 0 +#define COUNT_RECURSIVE 1 PHP_MINIT_FUNCTION(array) { @@ -105,10 +105,10 @@ PHP_MSHUTDOWN_FUNCTION(array) { #ifdef ZTS - ts_free_id(array_globals_id); + ts_free_id(array_globals_id); #endif - return SUCCESS; + return SUCCESS; } static void set_compare_func(int sort_type TSRMLS_DC) @@ -158,19 +158,19 @@ Z_STRLEN(second) = s->nKeyLength-1; } - if (ARRAYG(compare_func)(&result, &first, &second TSRMLS_CC) == FAILURE) { - return 0; - } + if (ARRAYG(compare_func)(&result, &first, &second TSRMLS_CC) == FAILURE) { + return 0; + } - if (Z_TYPE(result) == IS_DOUBLE) { - if (Z_DVAL(result) < 0) { + if (Z_TYPE(result) == IS_DOUBLE) { + if (Z_DVAL(result) < 0) { return -1; - } else if (Z_DVAL(result) > 0) { + } else if (Z_DVAL(result) > 0) { return 1; - } else { + } else { return 0; } - } + } convert_to_long(&result); @@ -302,19 +302,19 @@ first = *((pval **) f->pData); second = *((pval **) s->pData); - if (ARRAYG(compare_func)(&result, first, second TSRMLS_CC) == FAILURE) { - return 0; - } + if (ARRAYG(compare_func)(&result, first, second TSRMLS_CC) == FAILURE) { + return 0; + } - if (Z_TYPE(result) == IS_DOUBLE) { - if (Z_DVAL(result) < 0) { + if (Z_TYPE(result) == IS_DOUBLE) { + if (Z_DVAL(result) < 0) { return -1; - } else if (Z_DVAL(result) > 0) { + } else if (Z_DVAL(result) > 0) { return 1; - } else { + } else { return 0; } - } + } convert_to_long(&result); @@ -979,7 +979,7 @@ (*BG(array_walk_func_name))->value.str.val); zend_hash_move_forward_ex(target_hash, &pos); - } + } efree(key); return 0; @@ -989,7 +989,7 @@ Apply a user function to every member of an array */ PHP_FUNCTION(array_walk) { - int argc; + int argc; zval **array, **userdata = NULL, **old_walk_func_name; @@ -1023,8 +1023,8 @@ /* }}} */ /* void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) - * 0 = return boolean - * 1 = return key + * 0 = return boolean + * 1 = return key */ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) { @@ -1039,7 +1039,7 @@ uint str_key_len; char *string_key; int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function; - + if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &array, &strict) == FAILURE) { WRONG_PARAM_COUNT; @@ -1059,15 +1059,15 @@ convert_to_boolean_ex(strict); if (Z_LVAL_PP(strict)) { is_equal_func = is_identical_function; - } + } } target_hash = HASH_OF(*array); zend_hash_internal_pointer_reset_ex(target_hash, &pos); while(zend_hash_get_current_data_ex(target_hash, (void **)&entry, &pos) == SUCCESS) { - is_equal_func(&res, *value, *entry TSRMLS_CC); + is_equal_func(&res, *value, *entry TSRMLS_CC); if (Z_LVAL(res)) { - if (behavior==0) { + if (behavior==0) { RETURN_TRUE; } else { /* Return current key */ @@ -1344,10 +1344,10 @@ WRONG_PARAM_COUNT; } - /* allocate an array for return */ - if (array_init(return_value) == FAILURE) { + /* allocate an array for return */ + if (array_init(return_value) == FAILURE) { RETURN_FALSE; - } + } switch(Z_TYPE_PP(start_key)) { case IS_STRING: @@ -1395,10 +1395,10 @@ WRONG_PARAM_COUNT; } - /* allocate an array for return */ - if (array_init(return_value) == FAILURE) { + /* allocate an array for return */ + if (array_init(return_value) == FAILURE) { RETURN_FALSE; - } + } if(Z_TYPE_PP(zlow)==IS_STRING && Z_TYPE_PP(zhigh)==IS_STRING) { char *low, *high; @@ -1435,11 +1435,61 @@ /* }}} */ -static int array_data_shuffle(const void *a, const void *b TSRMLS_DC) +static void array_data_shuffle(zval *array TSRMLS_DC) { - return (php_rand(TSRMLS_C) % 2) ? 1 : -1; -} + Bucket **elems, *temp; + HashTable *hash; + int j, n_elems, cur_elem = 0, rnd_idx, n_left; + + n_elems = zend_hash_num_elements(Z_ARRVAL_P(array)); + + if (n_elems <= 1) { + return; + } + elems = (Bucket **)emalloc(n_elems * sizeof(Bucket *)); + hash = Z_ARRVAL_P(array); + n_left = n_elems; + + for (j = 0, temp = hash->pListHead; temp; temp = temp->pListNext) + elems[j++] = temp; + while (--n_left) { + rnd_idx = php_rand(TSRMLS_C); + RAND_RANGE(rnd_idx, cur_elem, n_left, PHP_RAND_MAX); + if (rnd_idx != cur_elem) { + temp = elems[cur_elem]; + elems[cur_elem] = elems[rnd_idx]; + elems[rnd_idx] = temp; + } + cur_elem++; + } + + HANDLE_BLOCK_INTERRUPTIONS(); + hash->pListHead = elems[0]; + hash->pListTail = NULL; + hash->pInternalPointer = hash->pListHead; + + for (j = 0; j < n_elems; j++) { + if (hash->pListTail) { + hash->pListTail->pListNext = elems[j]; + } + elems[j]->pListLast = hash->pListTail; + elems[j]->pListNext = NULL; + hash->pListTail = elems[j]; + } + temp = hash->pListHead; + j = 0; + while (temp != NULL) { + temp->nKeyLength = 0; + temp->h = j++; + temp = temp->pListNext; + } + hash->nNextFreeElement = n_elems; + zend_hash_rehash(hash); + HANDLE_UNBLOCK_INTERRUPTIONS(); + + efree(elems); +} /* {{{ proto bool shuffle(array array_arg) Randomly shuffle the contents of an array */ @@ -1450,9 +1500,9 @@ if (zend_parse_parameters(1 TSRMLS_CC, "a", &array) == FAILURE) { RETURN_FALSE; } - if (zend_hash_sort(Z_ARRVAL_PP(&array), (sort_func_t)php_mergesort, array_data_shuffle, 1 TSRMLS_CC) == FAILURE) { - RETURN_FALSE; - } + + array_data_shuffle(array TSRMLS_CC); + RETURN_TRUE; } /* }}} */ @@ -1563,8 +1613,8 @@ PHP_FUNCTION(array_push) { zval ***args, /* Function arguments array */ - *stack, /* Input array */ - *new_var; /* Variable to be pushed */ + *stack, /* Input array */ + *new_var; /* Variable to be pushed */ int i, /* Loop counter */ argc; /* Number of function arguments */ @@ -1929,7 +1979,7 @@ /* Get the argument count and check it */ argc = ZEND_NUM_ARGS(); - if (argc < 2) { + if (argc < 1) { WRONG_PARAM_COUNT; } @@ -2006,7 +2056,7 @@ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos); while(zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS) { if (search_value != NULL) { - is_equal_function(&res, *search_value, *entry TSRMLS_CC); + is_equal_function(&res, *search_value, *entry TSRMLS_CC); add_key = zval_is_true(&res); } @@ -2078,7 +2128,7 @@ { zval **input, /* Input array */ **entry; /* An entry in the input array */ - zval **tmp; + zval **tmp; HashTable *myht; HashPosition pos; @@ -2343,10 +2393,10 @@ (*entry)->refcount++; switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(array), &string_key, &str_key_len, &num_key, 0, &pos)) { - case HASH_KEY_IS_LONG: + case HASH_KEY_IS_LONG: zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(entry), NULL); break; - case HASH_KEY_IS_STRING: + case HASH_KEY_IS_STRING: new_key=estrndup(string_key,str_key_len); if (change_to_upper) php_strtoupper(new_key, str_key_len - 1); @@ -2368,9 +2418,13 @@ { zval **array; HashTable *target_hash; - Bucket **arTmp, **cmpdata, **lastkept; Bucket *p; - int i; + struct bucketindex { + Bucket *b; + unsigned int i; + }; + struct bucketindex *arTmp, *cmpdata, *lastkept; + unsigned int i; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) { WRONG_PARAM_COUNT; @@ -2386,29 +2440,36 @@ zval_copy_ctor(return_value); if (target_hash->nNumOfElements <= 1) /* nothing to do */ - return; + return; /* create and sort array with pointers to the target_hash buckets */ - arTmp = (Bucket **) pemalloc((target_hash->nNumOfElements + 1) * sizeof(Bucket *), target_hash->persistent); + arTmp = (struct bucketindex *) pemalloc((target_hash->nNumOfElements + 1) * sizeof(struct bucketindex), target_hash->persistent); if (!arTmp) RETURN_FALSE; - for (i = 0, p = target_hash->pListHead; p; i++, p = p->pListNext) - arTmp[i] = p; - arTmp[i] = NULL; - set_compare_func(SORT_STRING TSRMLS_CC); - zend_qsort((void *) arTmp, i, sizeof(Bucket *), array_data_compare TSRMLS_CC); + for (i = 0, p = target_hash->pListHead; p; i++, p = p->pListNext) { + arTmp[i].b = p; + arTmp[i].i = i; + } + arTmp[i].b = NULL; + set_compare_func(SORT_STRING TSRMLS_CC); + zend_qsort((void *) arTmp, i, sizeof(struct bucketindex), array_data_compare TSRMLS_CC); /* go through the sorted array and delete duplicates from the copy */ lastkept = arTmp; - for (cmpdata = arTmp + 1; *cmpdata; cmpdata++) { + for (cmpdata = arTmp + 1; cmpdata->b; cmpdata++) { if (array_data_compare(lastkept, cmpdata TSRMLS_CC)) { - lastkept = cmpdata; + lastkept = cmpdata; } else { - p = *cmpdata; + if (lastkept->i > cmpdata->i) { + p = lastkept->b; + lastkept = cmpdata; + } else { + p = cmpdata->b; + } if (p->nKeyLength) - zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength); + zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength); else - zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); + zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); } } pefree(arTmp, target_hash->persistent); @@ -2438,7 +2499,7 @@ /* for each argument, create and sort list with pointers to the hash buckets */ lists = (Bucket ***)emalloc(argc * sizeof(Bucket **)); ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **)); - set_compare_func(SORT_STRING TSRMLS_CC); + set_compare_func(SORT_STRING TSRMLS_CC); for (i=0; i<argc; i++) { if (Z_TYPE_PP(args[i]) != IS_ARRAY) { php_error(E_WARNING, "Argument #%d to array_intersect() is not an array", i+1); @@ -2485,7 +2546,7 @@ } if (c) { /* Value of ptrs[0] not in all arguments, delete all entries */ - /* with value < value of ptrs[i] */ + /* with value < value of ptrs[i] */ for (;;) { p = *ptrs[0]; if (p->nKeyLength) @@ -2543,7 +2604,7 @@ /* for each argument, create and sort list with pointers to the hash buckets */ lists = (Bucket ***)emalloc(argc * sizeof(Bucket **)); ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **)); - set_compare_func(SORT_STRING TSRMLS_CC); + set_compare_func(SORT_STRING TSRMLS_CC); for (i=0; i<argc; i++) { if (Z_TYPE_PP(args[i]) != IS_ARRAY) { php_error(E_WARNING, "Argument #%d to array_diff() is not an array", i+1); @@ -2553,11 +2614,11 @@ hash = HASH_OF(*args[i]); list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent); if (!list) - RETURN_FALSE; + RETURN_FALSE; lists[i] = list; ptrs[i] = list; for (p = hash->pListHead; p; p = p->pListNext) - *list++ = p; + *list++ = p; *list = NULL; zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), array_data_compare TSRMLS_CC); } @@ -2567,7 +2628,7 @@ zval_copy_ctor(return_value); /* go through the lists and look for values of ptr[0] - that are not in the others */ + that are not in the others */ while (*ptrs[0]) { c = 1; for (i=1; i<argc; i++) { @@ -2606,7 +2667,7 @@ } out: for (i=0; i<argc; i++) { - hash = HASH_OF(*args[i]); + hash = HASH_OF(*args[i]); pefree(lists[i], hash->persistent); } efree(ptrs); @@ -2660,7 +2721,7 @@ int array_size; int num_arrays = 0; int parse_state[MULTISORT_LAST]; /* 0 - flag not allowed - 1 - flag allowed */ + 1 - flag allowed */ int sort_order = SORT_ASC; int sort_type = SORT_REGULAR; int i, k; @@ -2878,15 +2939,7 @@ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos); while (num_req_val && (key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTANT) { -#ifdef HAVE_RANDOM - randval = random(); -#else -#ifdef HAVE_LRAND48 - randval = lrand48(); -#else - randval = rand(); -#endif -#endif + randval = php_rand(TSRMLS_C); if ((double)(randval/(PHP_RAND_MAX+1.0)) < (double)num_req_val/(double)num_avail) { /* If we are returning a single result, just do it. */ @@ -2910,10 +2963,7 @@ } if (num_req_val == num_avail) { - if (zend_hash_sort(Z_ARRVAL_P(return_value), (sort_func_t)php_mergesort, array_data_shuffle, 1 TSRMLS_CC) == FAILURE) { - zval_dtor(return_value); - RETURN_FALSE; - } + array_data_shuffle(return_value TSRMLS_CC); } } /* }}} */ 1.2.2.4 +8 -1 php4/ext/standard/basic_functions.c Index: basic_functions.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/basic_functions.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- basic_functions.c 19 May 2002 11:16:05 -0000 1.2.2.3 +++ basic_functions.c 9 Jul 2002 09:14:39 -0000 1.2.2.4 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.478 2002/05/11 19:19:49 rasmus Exp $ */ +/* $Id: basic_functions.c,v 1.483 2002/07/03 06:45:01 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -281,6 +281,7 @@ PHP_FE(iptcparse, NULL) PHP_FE(iptcembed, NULL) PHP_FE(getimagesize, second_args_force_ref) + PHP_FE(image_type_to_mime_type, NULL) PHP_FE(phpinfo, NULL) PHP_FE(phpversion, NULL) @@ -673,7 +674,9 @@ PHP_FE(is_writable, NULL) PHP_FALIAS(is_writeable, is_writable, NULL) PHP_FE(is_readable, NULL) +#ifndef PHP_WIN32 PHP_FE(is_executable, NULL) +#endif PHP_FE(is_file, NULL) PHP_FE(is_dir, NULL) PHP_FE(is_link, NULL) @@ -992,6 +995,7 @@ PHP_MINIT(proc_open) (INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(user_streams) (INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(imagetypes) (INIT_FUNC_ARGS_PASSTHRU); php_register_url_stream_wrapper("http", &php_stream_http_wrapper TSRMLS_CC); php_register_url_stream_wrapper("php", &php_stream_php_wrapper TSRMLS_CC); @@ -1067,6 +1071,9 @@ PHP_RINIT(syslog) (INIT_FUNC_ARGS_PASSTHRU); PHP_RINIT(dir) (INIT_FUNC_ARGS_PASSTHRU); PHP_RINIT(url_scanner_ex) (INIT_FUNC_ARGS_PASSTHRU); + + /* Reset magic_quotes_runtime */ + PG(magic_quotes_runtime) = INI_BOOL("magic_quotes_runtime"); return SUCCESS; } 1.2.2.1 +10 -7 php4/ext/standard/credits_ext.h Index: credits_ext.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/credits_ext.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- credits_ext.h 29 Apr 2002 02:31:01 -0000 1.2 +++ credits_ext.h 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -13,7 +13,7 @@ CREDIT_LINE("aspell", "Rasmus Lerdorf"); CREDIT_LINE("Assert", "Thies C. Arntzen"); CREDIT_LINE("BC Math", "Andi Gutmans"); -CREDIT_LINE("bz2", "Sterling Hughes"); +CREDIT_LINE("Bzip2", "Sterling Hughes"); CREDIT_LINE("Calendar", "Shane Caraveo, Colin Viebrock, Hartmut Holzgraefe, Wez Furlong"); CREDIT_LINE("ccvs", "Brendan W. McAdams, Doug DeJulio"); CREDIT_LINE("cpdf", "Uwe Steinmann"); @@ -25,7 +25,6 @@ CREDIT_LINE("DBA", "Sascha Schumann"); CREDIT_LINE("dBase", "Jim Winstead"); CREDIT_LINE("DBM", "Rasmus Lerdorf, Jim Winstead"); -CREDIT_LINE("dbplus", "Hartmut Holzgraefe"); CREDIT_LINE("dbx (database abstraction)", "Marc Boeren, Rui Hirokawa, Frank M. Kromann"); CREDIT_LINE("domxml", "Uwe Steinmann"); CREDIT_LINE("dotnet", "Sam Ruby"); @@ -38,6 +37,7 @@ CREDIT_LINE("GD imaging", "Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto"); CREDIT_LINE("GetText", "Alex Plotnick"); CREDIT_LINE("GNU GMP support", "Stanislav Malyshev"); +CREDIT_LINE("HwAPI", "Uwe Steinmann"); CREDIT_LINE("HyperWave", "Uwe Steinmann"); CREDIT_LINE("icap", "Mark Musone"); CREDIT_LINE("IMAP", "Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky"); @@ -47,16 +47,17 @@ CREDIT_LINE("IRCG", "Sascha Schumann"); CREDIT_LINE("Java", "Sam Ruby"); CREDIT_LINE("LDAP", "Amitay Isaacs, Eric Warnke, Rasmus Lerdorf, Gerrit Thomson, Stig Venaas"); -CREDIT_LINE("Mailparse MIME parsing and manipulation functions", "Wez Furlong"); CREDIT_LINE("MCAL", "Mark Musone, Chuck Hagenbuch"); CREDIT_LINE("mcrypt", "Sascha Schumann, Derick Rethans"); +CREDIT_LINE("MCVE", "Brad House, Chris Faulhaber, Steven Schoch"); CREDIT_LINE("mhash", "Sascha Schumann"); +CREDIT_LINE("mime_magic", "Hartmut Holzgraefe"); CREDIT_LINE("MING", "Dave Hayden"); CREDIT_LINE("mnoGoSearch", "Alex Barkov, Ramil Kalimullin, Sergey Kartashoff"); -CREDIT_LINE("MS SQL", "Frank M. Kromann"); CREDIT_LINE("msession", "Mark L. Woodward"); CREDIT_LINE("mSQL", "Zeev Suraski"); -CREDIT_LINE("Multibyte (Japanese) String Functions", "Tsukada Takuya"); +CREDIT_LINE("MS SQL", "Frank M. Kromann"); +CREDIT_LINE("Multibyte (Japanese) String Functions", "Tsukada Takuya, Rui Hirokawa"); CREDIT_LINE("MySQL", "Zeev Suraski"); CREDIT_LINE("ncurses", "Hartmut Holzgraefe"); CREDIT_LINE("OCI8", "Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson"); @@ -73,6 +74,7 @@ CREDIT_LINE("qtdom", "Jan Borsodi"); CREDIT_LINE("Readline", "Thies C. Arntzen"); CREDIT_LINE("Recode", "Kristian K〓hntopp"); +CREDIT_LINE("rpc abstraction", "Harald Radi"); CREDIT_LINE("Satellite (CORBA)", "David Eriksson"); CREDIT_LINE("Sessions", "Sascha Schumann, Andrei Zmievski"); CREDIT_LINE("Shared Memory Operations", "Slava Poliakov, Ilia Alshanetsky"); @@ -81,6 +83,7 @@ CREDIT_LINE("SWF", "Sterling Hughes"); CREDIT_LINE("Sybase-CT", "Zeev Suraski, Tom May"); CREDIT_LINE("Sybase-DB", "Zeev Suraski"); +CREDIT_LINE("System V Message based IPC", "Wez Furlong"); CREDIT_LINE("System V Semaphores", "Tom May"); CREDIT_LINE("System V Shared Memory", "Christian Cartus"); CREDIT_LINE("tokenizer", "Andrei Zmievski"); @@ -89,9 +92,9 @@ CREDIT_LINE("Vpopmail", "David Croft, Boian Bonev"); CREDIT_LINE("W32API", "James Moore"); CREDIT_LINE("WDDX", "Andrei Zmievski"); -CREDIT_LINE("Win32 COM", "Zeev Suraski, Harald Radi, Alan Brown"); -CREDIT_LINE("XML", "Stig Bakken, Thies C. Arntzen"); +CREDIT_LINE("Win32 COM", "Alan Brown, Wez Furlong, Harald Radi, Zeev Suraski"); CREDIT_LINE("xmlrpc", "Dan Libby"); +CREDIT_LINE("XML", "Stig Bakken, Thies C. Arntzen"); CREDIT_LINE("YAZ", "Adam Dickmeiss"); CREDIT_LINE("Yellow Pages", "Stephanie Wehner, Fredrik Ohrn"); CREDIT_LINE("Zip", "Sterling Hughes"); 1.2.2.2 +2 -1 php4/ext/standard/credits_sapi.h Index: credits_sapi.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/credits_sapi.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- credits_sapi.h 9 May 2002 04:17:00 -0000 1.2.2.1 +++ credits_sapi.h 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -10,12 +10,13 @@ */ +CREDIT_LINE("ActiveScript", "Wez Furlong"); CREDIT_LINE("AOLserver", "Sascha Schumann"); CREDIT_LINE("Apache 1.3", "Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar"); CREDIT_LINE("Apache 2.0", "Sascha Schumann, Aaron Bannert"); CREDIT_LINE("Caudium / Roxen", "David Hedbor"); CREDIT_LINE("CGI", "Rasmus Lerdorf, Stig Bakken"); -CREDIT_LINE("CLI", "Rasmus Lerdorf, Stig Bakken, Edin Kadribasic"); +CREDIT_LINE("CLI", "Rasmus Lerdorf, Stig Bakken, Edin Kadribasic, Marcus Boerger"); CREDIT_LINE("fastcgi", "Ben Mansell"); CREDIT_LINE("fhttpd", "Alex Belits"); CREDIT_LINE("ISAPI", "Andi Gutmans, Zeev Suraski"); 1.2.2.2 +62 -27 php4/ext/standard/datetime.c Index: datetime.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/datetime.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- datetime.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ datetime.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -19,7 +19,7 @@ */ -/* $Id: datetime.c,v 1.86 2002/05/06 21:44:43 mfischer Exp $ */ +/* $Id: datetime.c,v 1.88 2002/06/14 05:42:08 sebastian Exp $ */ #include "php.h" @@ -81,9 +81,9 @@ { pval **arguments[7]; struct tm *ta, tmbuf; - time_t t; - int i, gmadjust, seconds, arg_count = ZEND_NUM_ARGS(); - int is_dst = -1; + time_t t, seconds; + int i, gmadjust, arg_count = ZEND_NUM_ARGS(); + int is_dst = -1, val, chgsecs = 0; if (arg_count > 7 || zend_get_parameters_array_ex(arg_count, arguments) == FAILURE) { WRONG_PARAM_COUNT; @@ -118,10 +118,10 @@ ** Now change date values with supplied parameters. */ switch(arg_count) { - case 7: + case 7: /* daylight saving time flag */ ta->tm_isdst = is_dst = Z_LVAL_PP(arguments[6]); /* fall-through */ - case 6: + case 6: /* year */ /* special case: a zero in year, month and day is considered illegal as it would be interpreted as 30.11.1999 otherwise @@ -149,29 +149,64 @@ ta->tm_year = Z_LVAL_PP(arguments[5]) - ((Z_LVAL_PP(arguments[5]) > 1000) ? 1900 : 0); /* fall-through */ - case 5: - ta->tm_mday = Z_LVAL_PP(arguments[4]); - /* fall-through */ - case 4: - ta->tm_mon = Z_LVAL_PP(arguments[3]) - 1; - /* fall-through */ - case 3: - ta->tm_sec = Z_LVAL_PP(arguments[2]); - /* fall-through */ - case 2: - ta->tm_min = Z_LVAL_PP(arguments[1]); - /* fall-through */ - case 1: - ta->tm_hour = Z_LVAL_PP(arguments[0]); - /* fall-through */ - case 0: - break; - } + case 5: /* day in month (1-baesd) */ + val = (*arguments[4])->value.lval; + if (val < 1) { + chgsecs += (1-val) * 60*60*24; + val = 1; + } + ta->tm_mday = val; + /* fall-through */ + case 4: /* month (zero-based) */ + val = (*arguments[3])->value.lval - 1; + while (val < 0) { + val += 12; ta->tm_year--; + } + ta->tm_mon = val; + /* fall-through */ + case 3: /* second */ + val = (*arguments[2])->value.lval; + if (val < 1) { + chgsecs += (1-val); val = 1; + } + ta->tm_sec = val; + /* fall-through */ + case 2: /* minute */ + val = (*arguments[1])->value.lval; + if (val < 1) { + chgsecs += (1-val) * 60; val = 1; + } + ta->tm_min = val; + /* fall-through */ + case 1: /* hour */ + val = (*arguments[0])->value.lval; + if (val < 1) { + chgsecs += (1-val) * 60*60; val = 1; + } + ta->tm_hour = val; + /* fall-through */ + case 0: + break; + } + + t = mktime(ta); + seconds = t - chgsecs; + - seconds = mktime(ta); - if (is_dst == -1) - is_dst = ta->tm_isdst; + if (is_dst == -1) { + struct tm t1, t2; + t1 = *localtime(&t); + t2 = *localtime(&seconds); + + if(t1.tm_isdst != t2.tm_isdst) { + seconds += (t1.tm_isdst == 1) ? 3600 : -3600; + ta = localtime(&seconds); + } + + is_dst = ta->tm_isdst; + } + if (gm) { #if HAVE_TM_GMTOFF /* 1.2.2.2 +5 -1 php4/ext/standard/dir.c Index: dir.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/dir.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- dir.c 19 May 2002 11:16:05 -0000 1.2.2.1 +++ dir.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c,v 1.90 2002/05/18 13:31:31 mfischer Exp $ */ +/* $Id: dir.c,v 1.91 2002/05/19 14:32:23 edink Exp $ */ /* {{{ includes/startup/misc */ @@ -40,7 +40,11 @@ #endif #ifdef HAVE_GLOB +#ifndef PHP_WIN32 #include <glob.h> +#else +#include "win32/glob.h" +#endif #endif typedef struct { 1.2.2.2 +32 -12 php4/ext/standard/exec.c Index: exec.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/exec.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- exec.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ exec.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf | +----------------------------------------------------------------------+ */ -/* $Id: exec.c,v 1.74 2002/05/05 17:14:12 stas Exp $ */ +/* $Id: exec.c,v 1.76 2002/05/23 10:17:07 wez Exp $ */ #include <stdio.h> #include "php.h" @@ -591,16 +591,16 @@ close a process opened by proc_open */ PHP_FUNCTION(proc_close) { - zval **proc; + zval *proc; void *child; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &proc) == FAILURE) { RETURN_FALSE; } - ZEND_FETCH_RESOURCE(child, void *, proc, -1, "process", le_proc_open); + ZEND_FETCH_RESOURCE(child, void *, &proc, -1, "process", le_proc_open); - zend_list_delete(Z_LVAL_PP(proc)); + zend_list_delete(Z_LVAL_P(proc)); RETURN_LONG(FG(pclose_ret)); } /* }}} */ @@ -747,15 +747,25 @@ goto exit_fail; } else { - zend_hash_index_find(Z_ARRVAL_PP(descitem), 0, (void **)&ztype); - convert_to_string_ex(ztype); + if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 0, (void **)&ztype) == SUCCESS) { + convert_to_string_ex(ztype); + } else { + php_error (E_WARNING, "%s(): Missing handle qualifier in array", + get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype)); + goto exit_fail; + } if (strcmp(Z_STRVAL_PP(ztype), "pipe") == 0) { descriptor_t newpipe[2]; zval **zmode; - zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zmode); - convert_to_string_ex(zmode); + if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zmode) == SUCCESS) { + convert_to_string_ex(zmode); + } else { + php_error (E_WARNING, "%s(): Missing mode parameter for 'pipe'", + get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype)); + goto exit_fail; + } descriptors[ndesc].mode = DESC_PIPE; @@ -793,11 +803,21 @@ descriptors[ndesc].mode = DESC_FILE; - zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zfile); - convert_to_string_ex(zfile); + if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zfile) == SUCCESS) { + convert_to_string_ex(zfile); + } else { + php_error (E_WARNING, "%s(): Missing file name parameter for 'file'", + get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype)); + goto exit_fail; + } - zend_hash_index_find(Z_ARRVAL_PP(descitem), 2, (void **)&zmode); - convert_to_string_ex(zmode); + if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 2, (void **)&zmode) == SUCCESS) { + convert_to_string_ex(zmode); + } else { + php_error (E_WARNING, "%s(): Missing mode parameter for 'file'", + get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype)); + goto exit_fail; + } /* try a wrapper */ 1.2.2.4 +47 -19 php4/ext/standard/file.c Index: file.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/file.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- file.c 19 May 2002 11:16:05 -0000 1.2.2.3 +++ file.c 9 Jul 2002 09:14:39 -0000 1.2.2.4 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.229 2002/05/12 15:59:42 rasmus Exp $ */ +/* $Id: file.c,v 1.235 2002/07/02 06:16:35 derick Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -192,7 +192,7 @@ -/* {{{ proto bool flock(resource fp, int operation [, int wouldblock]) +/* {{{ proto bool flock(resource fp, int operation [, int &wouldblock]) Portable file locking */ static int flock_values[] = { LOCK_SH, LOCK_EX, LOCK_UN }; @@ -525,6 +525,11 @@ } convert_to_string_ex(arg1); convert_to_string_ex(arg2); + + if (php_check_open_basedir(Z_STRVAL_PP(arg1) TSRMLS_CC)) { + RETURN_FALSE; + } + d = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)); strlcpy(p, Z_STRVAL_PP(arg2), sizeof(p)); @@ -1924,16 +1929,17 @@ } /* }}} */ -/* {{{ proto array fgetcsv(resource fp, int length [, string delimiter]) +/* {{{ proto array fgetcsv(resource fp, int length [, string delimiter [, string enclosure]]) Get line from file pointer and parse for CSV fields */ PHP_FUNCTION(fgetcsv) { char *temp, *tptr, *bptr, *lineEnd; char delimiter = ','; /* allow this to be set as parameter */ + char enclosure = '"'; /* allow this to be set as parameter */ /* first section exactly as php_fgetss */ - zval **fd, **bytes, **p_delim; + zval **fd, **bytes, **p_delim, **p_enclosure; int len, type; char *buf; php_stream *stream; @@ -1952,10 +1958,32 @@ convert_to_string_ex(p_delim); /* Make sure that there is at least one character in string */ if (Z_STRLEN_PP(p_delim) < 1) { + php_error(E_WARNING, "%s() 3rd parameter must be a character", + get_active_function_name(TSRMLS_C)); + return; + } + /* use first character from string */ + delimiter = Z_STRVAL_PP(p_delim)[0]; + break; + + case 4: + if (zend_get_parameters_ex(4, &fd, &bytes, &p_delim, &p_enclosure) == FAILURE) { WRONG_PARAM_COUNT; } - /* use first character from string */ + convert_to_string_ex(p_delim); + /* Make sure that there is at least one character in string */ + if (Z_STRLEN_PP(p_delim) < 1) { + php_error(E_WARNING, "%s() 3rd parameter must be a character", + get_active_function_name(TSRMLS_C)); + return; + } + /* use first character from string */ delimiter = Z_STRVAL_PP(p_delim)[0]; + + convert_to_string_ex(p_enclosure); + /* use first character from string */ + enclosure = Z_STRVAL_PP(p_enclosure)[0]; + break; default: @@ -1975,17 +2003,17 @@ } buf = emalloc(len + 1); - /*needed because recv/read/gzread doesnt set null char at end*/ + /* needed because recv/read/gzread doesnt set null char at end */ memset(buf, 0, len + 1); - if (php_stream_gets(stream, buf, len) == NULL) { + if (php_stream_gets(stream, buf, len) == NULL) { efree(buf); RETURN_FALSE; } - /* Now into new section that parses buf for comma/quote delimited fields */ + /* Now into new section that parses buf for delimiter/enclosure fields */ - /* Strip trailing space from buf, saving end of line in case required for quoted field */ + /* Strip trailing space from buf, saving end of line in case required for enclosure field */ lineEnd = emalloc(len + 1); bptr = buf; @@ -2000,7 +2028,7 @@ /* reserve workspace for building each individual field */ - temp = emalloc(len); /* unlikely but possible! */ + temp = emalloc(len); /* unlikely but possible! */ tptr = temp; /* Initialize return array */ @@ -2009,18 +2037,18 @@ /* Main loop to read CSV fields */ /* NB this routine will return a single null entry for a blank line */ - do { + do { /* 1. Strip any leading space */ while(isspace((int) *bptr) && (*bptr!=delimiter)) bptr++; /* 2. Read field, leaving bptr pointing at start of next field */ - if (*bptr == '"') { - /* 2A. handle quote delimited field */ + if (enclosure && *bptr == enclosure) { + /* 2A. handle enclosure delimited field */ bptr++; /* move on to first character in field */ while (*bptr) { - if (*bptr == '"') { - /* handle the double-quote */ - if ( *(bptr+1) == '"') { - /* embedded double quotes */ + if (*bptr == enclosure) { + /* handle the enclosure */ + if ( *(bptr+1) == enclosure) { + /* embedded enclosure */ *tptr++ = *bptr; bptr +=2; } else { /* must be end of string - skip to start of next field or end */ @@ -2040,7 +2068,7 @@ /* read a new line from input, as at start of routine */ memset(buf, 0, len+1); - if (php_stream_gets(stream, buf, len) == NULL) { + if (php_stream_gets(stream, buf, len) == NULL) { efree(lineEnd); efree(temp); efree(buf); @@ -2064,7 +2092,7 @@ } } } else { - /* 2B. Handle non-quoted field */ + /* 2B. Handle non-enclosure field */ while ((*bptr != delimiter) && *bptr) *tptr++ = *bptr++; *tptr=0; /* terminate temporary string */ 1.2.2.2 +57 -22 php4/ext/standard/filestat.c Index: filestat.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/filestat.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- filestat.c 19 May 2002 11:16:05 -0000 1.2.2.1 +++ filestat.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filestat.c,v 1.92 2002/05/16 01:07:21 sniper Exp $ */ +/* $Id: filestat.c,v 1.97 2002/07/03 06:45:01 derick Exp $ */ #include "php.h" #include "safe_mode.h" @@ -110,6 +110,12 @@ #define FS_LSTAT 16 #define FS_STAT 17 +/* From: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt__access.2c_._waccess.asp */ +#ifdef PHP_WIN32 +#define F_OK 0 +#define W_OK 2 +#define R_OK 4 +#endif PHP_RINIT_FUNCTION(filestat) { @@ -553,6 +559,10 @@ char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime", "blksize", "blocks"}; + if (php_check_open_basedir(filename TSRMLS_CC)) { + RETURN_FALSE; + } + stat_sb = &BG(sb); if (!BG(CurrentStatFile) || strcmp(filename, BG(CurrentStatFile))) { @@ -658,21 +668,6 @@ } php_error(E_WARNING, "Unknown file type (%d)", BG(sb).st_mode&S_IFMT); RETURN_STRING("unknown", 1); - case FS_IS_W: - if (getuid()==0) { - RETURN_TRUE; /* root */ - } - RETURN_BOOL((BG(sb).st_mode & wmask) != 0); - case FS_IS_R: - if (getuid()==0) { - RETURN_TRUE; /* root */ - } - RETURN_BOOL((BG(sb).st_mode&rmask)!=0); - case FS_IS_X: - if (getuid()==0) { - xmask = S_IXROOT; /* root */ - } - RETURN_BOOL((BG(sb).st_mode&xmask)!=0 && !S_ISDIR(BG(sb).st_mode)); case FS_IS_FILE: RETURN_BOOL(S_ISREG(BG(sb).st_mode)); case FS_IS_DIR: @@ -683,8 +678,6 @@ #else RETURN_FALSE; #endif - case FS_EXISTS: - RETURN_TRUE; /* the false case was done earlier */ case FS_LSTAT: #if HAVE_SYMLINK stat_sb = &BG(lsb); @@ -816,18 +809,50 @@ /* {{{ proto bool is_writable(string filename) Returns true if file can be written */ -FileFunction(PHP_FN(is_writable), FS_IS_W) +PHP_FUNCTION(is_writable) +{ + char *filename; + int filename_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + RETURN_BOOL(!access (filename, W_OK)); +} /* }}} */ /* {{{ proto bool is_readable(string filename) Returns true if file can be read */ -FileFunction(PHP_FN(is_readable), FS_IS_R) +PHP_FUNCTION(is_readable) +{ + char *filename; + int filename_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + RETURN_BOOL(!access (filename, R_OK)); +} /* }}} */ +#ifndef PHP_WIN32 /* {{{ proto bool is_executable(string filename) Returns true if file is executable */ -FileFunction(PHP_FN(is_executable), FS_IS_X) +PHP_FUNCTION(is_executable) +{ + char *filename; + int filename_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + RETURN_BOOL(!access (filename, X_OK)); +} /* }}} */ +#endif /* {{{ proto bool is_file(string filename) Returns true if file is a regular file */ @@ -846,7 +871,17 @@ /* {{{ proto bool file_exists(string filename) Returns true if filename exists */ -FileFunction(PHP_FN(file_exists), FS_EXISTS) +PHP_FUNCTION(file_exists) +{ + char *filename; + int filename_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + RETURN_BOOL(!access (filename, F_OK)); +} /* }}} */ /* {{{ proto array lstat(string filename) 1.2.2.1 +16 -4 php4/ext/standard/formatted_print.c Index: formatted_print.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/formatted_print.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- formatted_print.c 29 Apr 2002 02:31:01 -0000 1.2 +++ formatted_print.c 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: formatted_print.c,v 1.47 2002/03/22 09:09:18 derick Exp $ */ +/* $Id: formatted_print.c,v 1.50 2002/06/17 11:50:25 hholzgra Exp $ */ #include <math.h> /* modf() */ #include "php.h" @@ -25,6 +25,10 @@ #include "zend_execute.h" #include <stdio.h> +#ifdef HAVE_LOCALE_H +#include <locale.h> +#endif + #define ALIGN_LEFT 0 #define ALIGN_RIGHT 1 #define ADJ_WIDTH 1 @@ -274,6 +278,14 @@ char *cvt; register int i = 0, j = 0; int sign, decpt; + char decimal_point = '.'; +#ifdef HAVE_LOCALECONV + struct lconv l; + + localeconv_r(&l); + + decimal_point = l.decimal_point[0]; +#endif PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n", *buffer, pos, size, number, width, padding, alignment, fmt)); @@ -308,7 +320,7 @@ numbuf[i++] = '0'; if (precision > 0) { int k = precision; - numbuf[i++] = '.'; + numbuf[i++] = decimal_point; while ((decpt++ < 0) && k--) { numbuf[i++] = '0'; } @@ -317,12 +329,12 @@ while (decpt-- > 0) numbuf[i++] = cvt[j++]; if (precision > 0) - numbuf[i++] = '.'; + numbuf[i++] = decimal_point; } } else { numbuf[i++] = cvt[j++]; if (precision > 0) - numbuf[i++] = '.'; + numbuf[i++] = decimal_point; } while (cvt[j]) { 1.2.2.1 +27 -5 php4/ext/standard/fsock.c Index: fsock.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/fsock.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- fsock.c 29 Apr 2002 02:31:01 -0000 1.2 +++ fsock.c 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fsock.c,v 1.95 2002/04/19 10:06:41 wez Exp $ */ +/* $Id: fsock.c,v 1.96 2002/06/11 03:55:28 jason Exp $ */ /* converted to PHP Streams and moved much code to main/network.c [wez] */ @@ -121,6 +121,7 @@ char *host; int host_len; int port = -1; + int err; zval *zerrno = NULL, *zerrstr = NULL; double timeout = 60; unsigned long conv; @@ -152,7 +153,7 @@ zval_dtor(zerrno); ZVAL_LONG(zerrno, 0); } - if (zerrstr) { + if (zerrstr) { zval_dtor(zerrstr); ZVAL_STRING(zerrno, "", 1); } @@ -192,6 +193,10 @@ else #endif stream = php_stream_sock_open_host(host, (unsigned short)port, socktype, (int)timeout, persistent); +#ifdef PHP_WIN32 + /* Preserve error */ + err = WSAGetLastError(); +#endif if (stream == NULL) { zend_error(E_WARNING, "%s(): unable to connect to %s:%d", @@ -227,15 +232,32 @@ efree(hashkey); if (stream == NULL) { - if (zerrno) { + if (zerrno) { zval_dtor(zerrno); +#ifndef PHP_WIN32 ZVAL_LONG(zerrno, errno); +#else + ZVAL_LONG(zerrno, err); +#endif } - if (zerrstr) { +#ifndef PHP_WIN32 + if (zerrstr) { zval_dtor(zerrstr); - ZVAL_STRING(zerrno, strerror(errno), 1); + ZVAL_STRING(zerrstr, strerror(errno), 1); } +#else + if (zerrstr) { + char *buf; + if (! FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, + Z_LVAL_P(zerrno), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0, NULL)) { + RETURN_FALSE; + } + + ZVAL_STRING(zerrstr, buf, 1); + LocalFree(buf); + } +#endif RETURN_FALSE; } 1.2.2.2 +7 -6 php4/ext/standard/head.c Index: head.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/head.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- head.c 19 May 2002 11:16:05 -0000 1.2.2.1 +++ head.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <rasmu****@lerdo*****> | +----------------------------------------------------------------------+ */ -/* $Id: head.c,v 1.56 2002/05/17 07:10:19 jwoolley Exp $ */ +/* $Id: head.c,v 1.57 2002/06/21 09:31:20 derick Exp $ */ #include <stdio.h> #include "php.h" @@ -35,19 +35,20 @@ /* Implementation of the language Header() function */ -/* {{{ proto void header(string header [, bool replace]) +/* {{{ proto void header(string header [, bool replace, [int http_response_code]]) Sends a raw HTTP header */ PHP_FUNCTION(header) { char *header; int header_len; zend_bool replace = 1; + int http_code = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &header, - &header_len, &replace) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &header, + &header_len, &replace, &http_code) == FAILURE) { return; } - sapi_add_header_ex(header, header_len, 1, replace TSRMLS_CC); + sapi_add_header_ex(header, header_len, 1, replace, http_code TSRMLS_CC); } /* }}} */ @@ -121,7 +122,7 @@ strcat(cookie, "; secure"); } - return sapi_add_header_ex(cookie, strlen(cookie), 0, 0 TSRMLS_CC); + return sapi_add_header_ex(cookie, strlen(cookie), 0, 0, 0 TSRMLS_CC); } 1.2.2.2 +3 -2 php4/ext/standard/html.c Index: html.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/html.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- html.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ html.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: html.c,v 1.46 2002/05/05 23:06:39 wez Exp $ */ +/* $Id: html.c,v 1.47 2002/06/03 18:26:27 rasmus Exp $ */ #include "php.h" #include "reg.h" @@ -526,7 +526,7 @@ { int i; enum entity_charset charset = cs_8859_1; - int len; + int len = 0; /* Guarantee default behaviour for backwards compatibility */ if (charset_hint == NULL) @@ -573,6 +573,7 @@ #endif } if (charset_hint) { + if(!len) len = strlen(charset_hint); /* now walk the charset map and look for the codeset */ for (i = 0; charset_map[i].codeset; i++) { if (strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) { 1.2.2.2 +222 -43 php4/ext/standard/image.c Index: image.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/image.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- image.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ image.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -16,7 +16,7 @@ | Marcus Boerger <helly****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: image.c,v 1.55 2002/05/04 17:24:08 sas Exp $ */ +/* $Id: image.c,v 1.64 2002/07/01 18:52:30 derick Exp $ */ /* * Based on Daniel Schmitt's imageinfo.c which carried the following * Copyright notice. @@ -49,18 +49,26 @@ #endif #include "php_image.h" +#if HAVE_ZLIB +#include "zlib.h" +#endif + /* file type markers */ PHPAPI const char php_sig_gif[3] = {'G', 'I', 'F'}; PHPAPI const char php_sig_psd[4] = {'8', 'B', 'P', 'S'}; PHPAPI const char php_sig_bmp[2] = {'B', 'M'}; PHPAPI const char php_sig_swf[3] = {'F', 'W', 'S'}; +PHPAPI const char php_sig_swc[3] = {'C', 'W', 'S'}; PHPAPI const char php_sig_jpg[3] = {(char) 0xff, (char) 0xd8, (char) 0xff}; PHPAPI const char php_sig_png[8] = {(char) 0x89, (char) 0x50, (char) 0x4e, (char) 0x47, (char) 0x0d, (char) 0x0a, (char) 0x1a, (char) 0x0a}; PHPAPI const char php_sig_tif_ii[4] = {'I','I', (char)0x2A, (char)0x00}; PHPAPI const char php_sig_tif_mm[4] = {'M','M', (char)0x00, (char)0x2A}; PHPAPI const char php_sig_jpc[3] = {(char)0xFF, (char)0x4F, (char)0xff}; +PHPAPI const char php_sig_iff[4] = {'F','O','R','M'}; +/* REMEMBER TO ADD MIME-TYPE TO FUNCTION php_image_type_to_mime_type */ +/* PCX must check first 64bytes and byte 0=0x0a and byte2 < 0x06 */ /* return info as a struct, to make expansion easier */ @@ -71,6 +79,28 @@ unsigned int channels; }; +/* {{{ PHP_MINIT_FUNCTION(imagetypes) + * Register IMAGETYPE_<xxx> constants used by GetImageSize(), image_type_to_mime_type, ext/exif */ +PHP_MINIT_FUNCTION(imagetypes) +{ + REGISTER_LONG_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT); + return SUCCESS; +} +/* }}} */ + /* {{{ php_handle_gif * routine to handle GIF files. If only everything were that easy... ;} */ static struct gfxinfo *php_handle_gif (php_stream * stream TSRMLS_DC) @@ -88,6 +118,11 @@ php_stream_read(stream, a, sizeof(a)); /* fread(a, sizeof(a), 1, fp); */ result->height = (unsigned short)a[0] | (((unsigned short)a[1])<<8); + php_stream_read(stream, a, 1); + + result->bits = a[0]&0x80 ? ((a[0]&0x07) + 1) : 0; + result->channels = 3; /* allways */ + return result; } /* }}} */ @@ -112,8 +147,10 @@ in_width = (((unsigned long) a[ 4 ]) << 24) + (((unsigned long) a[ 5 ]) << 16) + (((unsigned long) a[ 6 ]) << 8) + ((unsigned long) a[ 7 ]); } - result->width = (unsigned int) in_width; - result->height = (unsigned int) in_height; + result->width = (unsigned int) in_width; + result->height = (unsigned int) in_height; + result->bits = 0; + result->channels = 0; return result; } @@ -134,8 +171,10 @@ php_stream_read(stream, temp, sizeof(temp)); php_stream_read(stream, (char*) &dim, sizeof(dim)); - result->width = dim.in_width; - result->height = dim.in_height; + result->width = dim.in_width; + result->height = dim.in_height; + result->bits = 0; + result->channels = 0; return result; } @@ -157,6 +196,39 @@ } /* }}} */ +#if HAVE_ZLIB +/* {{{ php_handle_swc + */ +static struct gfxinfo *php_handle_swc(php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + + long bits; + unsigned char a[64]; + unsigned long len = 64; + char *b; + + b = ecalloc (1, len + 1); + + result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo)); + php_stream_seek(stream, 5, SEEK_CUR); + + php_stream_read(stream, a, sizeof(a)); /* fread(a, sizeof(a), 1, fp); */ + uncompress (b, &len, a, sizeof(a)); + + bits = php_swf_get_bits (b, 0, 5); + result->width = (php_swf_get_bits (b, 5 + bits, bits) - + php_swf_get_bits (b, 5, bits)) / 20; + result->height = (php_swf_get_bits (b, 5 + (3 * bits), bits) - + php_swf_get_bits (b, 5 + (2 * bits), bits)) / 20; + efree (b); + result->bits = 0; + result->channels = 0; + return result; +} +/* }}} */ +#endif + /* {{{ php_handle_swf */ static struct gfxinfo *php_handle_swf (php_stream * stream TSRMLS_DC) @@ -174,6 +246,8 @@ php_swf_get_bits (a, 5, bits)) / 20; result->height = (php_swf_get_bits (a, 5 + (3 * bits), bits) - php_swf_get_bits (a, 5 + (2 * bits), bits)) / 20; + result->bits = 0; + result->channels = 0; return result; } /* }}} */ @@ -286,7 +360,7 @@ { marker = 0xff; comment_correction--; - } else { + } else { last_marker = M_PSEUDO; /* stop skipping non 0xff for M_COM */ } } @@ -338,7 +412,7 @@ buffer = emalloc(length); if ( !buffer) return; - if (php_stream_read(stream, buffer, (long) length) <= 0) { + if (php_stream_read(stream, buffer, (long) length) <= 0) { efree(buffer); return; } @@ -545,10 +619,10 @@ { if (motorola_intel) { return ((( char *)Long)[0] << 24) | (((uchar *)Long)[1] << 16) - | (((uchar *)Long)[2] << 8 ) | (((uchar *)Long)[3] << 0 ); + | (((uchar *)Long)[2] << 8 ) | (((uchar *)Long)[3] << 0 ); } else { return ((( char *)Long)[3] << 24) | (((uchar *)Long)[2] << 16) - | (((uchar *)Long)[1] << 8 ) | (((uchar *)Long)[0] << 0 ); + | (((uchar *)Long)[1] << 8 ) | (((uchar *)Long)[0] << 0 ); } } /* }}} */ @@ -578,7 +652,7 @@ ifd_size = 2; ifd_data = emalloc(ifd_size); php_stream_read(stream, ifd_data, 2); - num_entries = php_ifd_get16u(ifd_data, motorola_intel); + num_entries = php_ifd_get16u(ifd_data, motorola_intel); dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/; ifd_size = dir_size; ifd_data = erealloc(ifd_data,ifd_size); @@ -607,7 +681,7 @@ entry_value = php_ifd_get32s(dir_entry+8, motorola_intel); break; default: - continue; + continue; } switch(entry_tag) { case TAG_IMAGEWIDTH: @@ -624,14 +698,107 @@ if ( width && height) { /* not the same when in for-loop */ result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); - result->height = height; - result->width = width; + result->height = height; + result->width = width; + result->bits = 0; + result->channels = 0; return result; } return NULL; } /* }}} */ +/* {{{ php_handle_psd + */ +static struct gfxinfo *php_handle_iff(php_stream * stream TSRMLS_DC) +{ + struct gfxinfo *result = NULL; + unsigned char a[10]; + int chunkId; + int size; + + if (php_stream_read(stream, a, 8) != 8) + return NULL; + if (strncmp(a+4, "ILBM", 4) && strncmp(a+4, "PBM ", 4)) + return NULL; + + result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo)); + + /* loop chunks to find BMHD chunk */ + do { + if (php_stream_read(stream, a, 8) != 8) { + efree(result); + return NULL; + } + chunkId = php_ifd_get32s(a+0, 1); + size = php_ifd_get32s(a+4, 1); + if ((size & 1) == 1) { + size++; + } + if (chunkId == 0x424d4844) { /* BMHD chunk */ + if (php_stream_read(stream, a, 9) != 9) { + efree(result); + return NULL; + } + result->width = php_ifd_get16s(a+0, 1); + result->height = php_ifd_get16s(a+2, 1); + result->bits = a[8] & 0xff; + result->channels = 0; + if (result->width > 0 && result->height > 0 && result->bits > 0 && result->bits < 33) + return result; + } else { + php_stream_seek(stream, size, SEEK_CUR); + } + } while (1); +} +/* }}} */ + +/* {{{ php_image_type_to_mime_type + * Convert internal image_type to mime type */ +PHPAPI const char * php_image_type_to_mime_type(int image_type) +{ + switch( image_type) { + case IMAGE_FILETYPE_GIF: + return "image/gif"; + case IMAGE_FILETYPE_JPEG: + case IMAGE_FILETYPE_JPC: + return "image/jpeg"; + case IMAGE_FILETYPE_PNG: + return "image/png"; + case IMAGE_FILETYPE_SWF: + case IMAGE_FILETYPE_SWC: + return "application/x-shockwave-flash"; + case IMAGE_FILETYPE_PSD: + return "image/psd"; + case IMAGE_FILETYPE_BMP: + return "image/bmp"; + case IMAGE_FILETYPE_TIFF_II: + case IMAGE_FILETYPE_TIFF_MM: + return "image/tiff"; + case IMAGE_FILETYPE_IFF: + return "image/iff"; + default: + case IMAGE_FILETYPE_UNKNOWN: + return "application/octet-stream"; /* suppose binary format */ + } +} +/* }}} */ + +/* {{{ proto array image_type_to_mime_type(int imagetype) + Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */ +PHP_FUNCTION(image_type_to_mime_type) +{ + zval **p_image_type; + int arg_c = ZEND_NUM_ARGS(); + + if ((arg_c!=1) || zend_get_parameters_ex(arg_c, &p_image_type) == FAILURE) { + WRONG_PARAM_COUNT; + } + zval_dtor(*p_image_type); + ZVAL_STRING(return_value, (char*)php_image_type_to_mime_type(Z_LVAL_PP(p_image_type)), 1); +} +/* }}} */ + /* {{{ php_imagetype detect filetype from first bytes */ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC) @@ -658,22 +825,26 @@ } } else if (!memcmp(filetype, php_sig_swf, 3)) { return IMAGE_FILETYPE_SWF; + } else if (!memcmp(filetype, php_sig_swc, 3)) { + return IMAGE_FILETYPE_SWC; } else if (!memcmp(filetype, php_sig_psd, 3)) { return IMAGE_FILETYPE_PSD; } else if (!memcmp(filetype, php_sig_bmp, 2)) { return IMAGE_FILETYPE_BMP; } else if (!memcmp(filetype, php_sig_jpc, 3)) { return IMAGE_FILETYPE_JPC; - } else { - php_stream_read(stream, filetype+3, 1); - if (!memcmp(filetype, php_sig_tif_ii, 4)) { - return IMAGE_FILETYPE_TIFF_II; - } else - if (!memcmp(filetype, php_sig_tif_mm, 4)) { - return IMAGE_FILETYPE_TIFF_MM; - } } - + php_stream_read(stream, filetype+3, 1); + if (!memcmp(filetype, php_sig_tif_ii, 4)) { + return IMAGE_FILETYPE_TIFF_II; + } else + if (!memcmp(filetype, php_sig_tif_mm, 4)) { + return IMAGE_FILETYPE_TIFF_MM; + } + if (!memcmp(filetype, php_sig_iff, 4)) { + return IMAGE_FILETYPE_IFF; + } + return IMAGE_FILETYPE_UNKNOWN; } /* }}} */ @@ -683,7 +854,7 @@ PHP_FUNCTION(getimagesize) { zval **arg1, **info = NULL; - int itype = 0; + int itype = 0; char temp[64]; struct gfxinfo *result = NULL; php_stream * stream = NULL; @@ -723,40 +894,47 @@ itype = php_getimagetype(stream, NULL TSRMLS_CC); switch( itype) { - case IMAGE_FILETYPE_GIF: + case IMAGE_FILETYPE_GIF: result = php_handle_gif (stream TSRMLS_CC); - break; - case IMAGE_FILETYPE_JPEG: + break; + case IMAGE_FILETYPE_JPEG: if (info) { result = php_handle_jpeg(stream, *info TSRMLS_CC); } else { result = php_handle_jpeg(stream, NULL TSRMLS_CC); } - break; - case IMAGE_FILETYPE_PNG: + break; + case IMAGE_FILETYPE_PNG: result = php_handle_png(stream TSRMLS_CC); - break; - case IMAGE_FILETYPE_SWF: + break; + case IMAGE_FILETYPE_SWF: result = php_handle_swf(stream TSRMLS_CC); - break; - case IMAGE_FILETYPE_PSD: + break; +#if HAVE_ZLIB + case IMAGE_FILETYPE_SWC: + result = php_handle_swc(stream TSRMLS_CC); + break; +#endif + case IMAGE_FILETYPE_PSD: result = php_handle_psd(stream TSRMLS_CC); - break; - case IMAGE_FILETYPE_BMP: + break; + case IMAGE_FILETYPE_BMP: result = php_handle_bmp(stream TSRMLS_CC); - break; - case IMAGE_FILETYPE_TIFF_II: + break; + case IMAGE_FILETYPE_TIFF_II: result = php_handle_tiff(stream, NULL, 0 TSRMLS_CC); - break; - case IMAGE_FILETYPE_TIFF_MM: + break; + case IMAGE_FILETYPE_TIFF_MM: result = php_handle_tiff(stream, NULL, 1 TSRMLS_CC); - break; - case IMAGE_FILETYPE_JPC: + break; + case IMAGE_FILETYPE_JPC: result = php_handle_jpc(stream TSRMLS_CC); - break; + break; + case IMAGE_FILETYPE_IFF: + result = php_handle_iff(stream TSRMLS_CC); default: - case IMAGE_FILETYPE_UNKNOWN: - break; + case IMAGE_FILETYPE_UNKNOWN: + break; } php_stream_close(stream); @@ -779,6 +957,7 @@ if (result->channels != 0) { add_assoc_long(return_value, "channels", result->channels); } + add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype), 1); efree(result); } else { RETURN_FALSE; 1.2.2.4 +45 -20 php4/ext/standard/info.c Index: info.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/info.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- info.c 19 May 2002 11:16:05 -0000 1.2.2.3 +++ info.c 9 Jul 2002 09:14:39 -0000 1.2.2.4 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.180 2002/05/13 17:43:04 zeev Exp $ */ +/* $Id: info.c,v 1.184 2002/07/01 18:52:30 derick Exp $ */ #include "php.h" #include "php_ini.h" @@ -145,16 +145,16 @@ dwWindowsMajorVersion, dwWindowsMinorVersion); php_uname = tmp_uname; } else if (mode == 'n') { - // XXX HOW TO GET THIS ON WINDOWS? + /* XXX HOW TO GET THIS ON WINDOWS? */ php_uname = "localhost"; } else if (mode == 'v') { dwBuild = (DWORD)(HIWORD(dwVersion)); snprintf(tmp_uname, sizeof(tmp_uname), "build %d", dwBuild); php_uname = tmp_uname; } else if (mode == 'm') { - // XXX HOW TO GET THIS ON WINDOWS? + /* XXX HOW TO GET THIS ON WINDOWS? */ php_uname = "i386"; - } else { // assume mode == 'a' + } else { /* assume mode == 'a' */ /* Get build numbers for Windows NT or Win95 */ if (dwVersion < 0x80000000){ dwBuild = (DWORD)(HIWORD(dwVersion)); @@ -184,7 +184,7 @@ php_uname = buf.version; } else if (mode == 'm') { php_uname = buf.machine; - } else { // assume mode == 'a' + } else { /* assume mode == 'a' */ snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %s %s %s", buf.sysname, buf.nodename, buf.release, buf.version, buf.machine); @@ -208,26 +208,21 @@ int expose_php = INI_INT("expose_php"); time_t the_time; struct tm *ta, tmbuf; - char php_api_no[9]; - char mod_api_no[9]; - char ext_api_no[9]; + the_time = time(NULL); ta = php_localtime_r(&the_time, &tmbuf); - snprintf (php_api_no, 9, "%d", PHP_API_VERSION); - snprintf (mod_api_no, 9, "%d", ZEND_MODULE_API_NO); - snprintf (ext_api_no, 9, "%d", ZEND_EXTENSION_API_NO); - PUTS("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n"); + PUTS("<head>"); + php_info_print_style(); + PUTS("<title>phpinfo()</title></head><body>"); if (flag & PHP_INFO_GENERAL) { char *zend_version = get_zend_version(); + char *api_numbers; php_uname = php_get_uname('a'); - PUTS("<head>"); - php_info_print_style(); - PUTS("<title>phpinfo()</title></head><body>"); php_info_print_box_start(1); if (expose_php) { @@ -260,10 +255,11 @@ #endif php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:PHP_CONFIG_FILE_PATH); - - php_info_print_table_row(2, "PHP API No.", php_api_no); - php_info_print_table_row(2, "PHP Extensions API No.", mod_api_no); - php_info_print_table_row(2, "Zend Extensions API No.", ext_api_no); + + api_numbers = emalloc(sizeof("PHP: \nPHP Extension: \nZend Extension: ") + 3*8); + snprintf(api_numbers, sizeof("PHP: \nPHP Extension: \nZend Extension: ") + 3*8, "PHP: %d\nPHP Extension: %d\nZend Extension: %d", PHP_API_VERSION, ZEND_MODULE_API_NO, ZEND_EXTENSION_API_NO); + php_info_print_table_row(2, "API Versions:", api_numbers); + efree(api_numbers); #if ZEND_DEBUG php_info_print_table_row(2, "Debug Build", "yes" ); @@ -277,7 +273,36 @@ php_info_print_table_row(2, "Thread Safety", "disabled" ); #endif - php_info_print_table_row(2, "PHP Streams", "enabled"); + { + HashTable *url_stream_wrappers_hash; + char *stream_protocol, *stream_protocols_buf = NULL; + int stream_protocol_len, stream_protocols_buf_len = 0; + + if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) { + for (zend_hash_internal_pointer_reset(url_stream_wrappers_hash); + zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, NULL, 0, NULL) == HASH_KEY_IS_STRING; + zend_hash_move_forward(url_stream_wrappers_hash)) { + if (NULL == (stream_protocols_buf = erealloc(stream_protocols_buf, + stream_protocols_buf_len + stream_protocol_len + 1 /* "\n" */ + 1 /* 0 byte at end */))) { + break; + } + memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len); + stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = '\n'; + stream_protocols_buf_len += stream_protocol_len + 1; + } + if (stream_protocols_buf) { + stream_protocols_buf[stream_protocols_buf_len] = 0; + php_info_print_table_row(2, "Registered PHP Streams", stream_protocols_buf); + efree(stream_protocols_buf); + } else { + /* Any chances we will ever hit this? */ + php_info_print_table_row(2, "Registered PHP Streams", "no streams registered"); + } + } else { + /* Any chances we will ever hit this? */ + php_info_print_table_row(2, "PHP Streams", "disabled"); /* ?? */ + } + } php_info_print_table_end(); 1.2.2.1 +25 -1 php4/ext/standard/link.c Index: link.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/link.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- link.c 29 Apr 2002 02:31:02 -0000 1.2 +++ link.c 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: link.c,v 1.37 2002/02/28 08:26:46 sebastian Exp $ */ +/* $Id: link.c,v 1.38 2002/06/16 21:24:15 sesser Exp $ */ #include "php.h" #include "php_filestat.h" @@ -114,6 +114,18 @@ RETURN_FALSE; } + if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(frompath), NULL, CHECKUID_CHECK_FILE_AND_DIR)) { + RETURN_FALSE; + } + + if (php_check_open_basedir(Z_STRVAL_PP(topath) TSRMLS_CC)) { + RETURN_FALSE; + } + + if (php_check_open_basedir(Z_STRVAL_PP(frompath) TSRMLS_CC)) { + RETURN_FALSE; + } + if (!strncasecmp(Z_STRVAL_PP(topath), "http://", 7) || !strncasecmp(Z_STRVAL_PP(topath), "ftp://", 6)) { php_error(E_WARNING, "Unable to symlink to a URL"); RETURN_FALSE; @@ -143,6 +155,18 @@ convert_to_string_ex(frompath); if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(topath), NULL, CHECKUID_CHECK_FILE_AND_DIR)) { + RETURN_FALSE; + } + + if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(frompath), NULL, CHECKUID_CHECK_FILE_AND_DIR)) { + RETURN_FALSE; + } + + if (php_check_open_basedir(Z_STRVAL_PP(topath) TSRMLS_CC)) { + RETURN_FALSE; + } + + if (php_check_open_basedir(Z_STRVAL_PP(frompath) TSRMLS_CC)) { RETURN_FALSE; } 1.2.2.2 +30 -18 php4/ext/standard/mail.c Index: mail.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/mail.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- mail.c 19 May 2002 11:16:05 -0000 1.2.2.1 +++ mail.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mail.c,v 1.52 2002/05/14 20:43:48 mfischer Exp $ */ +/* $Id: mail.c,v 1.57 2002/07/02 23:46:15 fmk Exp $ */ #include <stdlib.h> #include <ctype.h> @@ -70,8 +70,12 @@ PHP_FUNCTION(mail) { char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *extra_cmd=NULL; - int to_len,message_len,headers_len,subject_len,extra_cmd_len; - + int to_len,message_len,headers_len,subject_len,extra_cmd_len,i; + + if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) { + php_error(E_WARNING, "%s(): SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE.", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss", &to, &to_len, @@ -83,14 +87,22 @@ return; } - for(to_len--;to_len;to_len--) { - if(!isspace(to[to_len]))break; - to[to_len]='\0'; + if (to_len > 0) { + for(to_len--;to_len;to_len--) { + if(!isspace((unsigned char)to[to_len]))break; + to[to_len]='\0'; + } + for(i=0;!iscntrl((unsigned char)to[i]);i++) {} + to[i]='\0'; } - for(subject_len--;subject_len;subject_len--) { - if(!isspace(subject[subject_len]))break; - subject[subject_len]='\0'; + if (subject_len > 0) { + for(subject_len--;subject_len;subject_len--) { + if(!isspace((unsigned char)subject[subject_len]))break; + subject[subject_len]='\0'; + } + for(i=0;!iscntrl((unsigned char)subject[i]);i++) {} + subject[i]='\0'; } if(extra_cmd) @@ -111,7 +123,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC) { #ifdef PHP_WIN32 - int tsm_err; + int tsm_err; char *tsm_errmsg = NULL; #endif FILE *sendmail; @@ -122,14 +134,14 @@ if (!sendmail_path) { #ifdef PHP_WIN32 /* handle old style win smtp sending */ - if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, headers, subject, to, message) == FAILURE) { - if (tsm_errmsg) { - php_error(E_WARNING, "%s() %s", get_active_function_name(TSRMLS_C), tsm_errmsg); - efree(tsm_errmsg); + if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, headers, subject, to, message, NULL, NULL, NULL) == FAILURE) { + if (tsm_errmsg) { + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), tsm_errmsg); + efree(tsm_errmsg); } else { - php_error(E_WARNING, "%s() %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err)); + php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err)); } - return 0; + return 0; } return 1; #else @@ -160,7 +172,7 @@ if (sendmail) { #ifndef PHP_WIN32 if (EACCES == errno) { - php_error(E_WARNING, "%s() permission denied; unable to execute shell to run mail delivery binary", + php_error(E_WARNING, "%s(): Permission denied; unable to execute shell to run mail delivery binary", get_active_function_name(TSRMLS_C)); pclose(sendmail); return 0; @@ -188,7 +200,7 @@ return 1; } } else { - php_error(E_WARNING, "%s() could not execute mail delivery program", + php_error(E_WARNING, "%s(): Could not execute mail delivery program", get_active_function_name(TSRMLS_C)); return 0; } 1.2.2.1 +10 -3 php4/ext/standard/math.c Index: math.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/math.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- math.c 29 Apr 2002 02:31:02 -0000 1.2 +++ math.c 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: math.c,v 1.83 2002/04/01 09:19:57 derick Exp $ */ +/* $Id: math.c,v 1.85 2002/06/18 00:14:52 edink Exp $ */ #include "php.h" #include "php_math.h" @@ -757,7 +757,7 @@ * the number. */ PHPAPI char * -_php_math_zvaltobase(zval *arg, int base) +_php_math_zvaltobase(zval *arg, int base TSRMLS_DC) { static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; @@ -770,6 +770,13 @@ char *ptr, *end; char buf[(sizeof(double) << 3) + 1]; + /* Don't try to convert +/- infinity */ + if (fvalue == HUGE_VAL || fvalue == -HUGE_VAL) { + php_error(E_WARNING, "Number too large in %s() call", + get_active_function_name(TSRMLS_C)); + return empty_string; + } + end = ptr = buf + sizeof(buf) - 1; *ptr = '\0'; @@ -930,7 +937,7 @@ if(_php_math_basetozval(*number, Z_LVAL_PP(frombase), &temp) != SUCCESS) { RETURN_FALSE; } - result = _php_math_zvaltobase(&temp, Z_LVAL_PP(tobase)); + result = _php_math_zvaltobase(&temp, Z_LVAL_PP(tobase) TSRMLS_CC); RETVAL_STRING(result, 0); } 1.2.2.1 +3 -1 php4/ext/standard/php_filestat.h Index: php_filestat.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/php_filestat.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_filestat.h 29 Apr 2002 02:31:02 -0000 1.2 +++ php_filestat.h 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_filestat.h,v 1.16 2002/04/26 23:46:51 yohgaki Exp $ */ +/* $Id: php_filestat.h,v 1.17 2002/07/03 06:45:01 derick Exp $ */ #ifndef PHP_FILESTAT_H #define PHP_FILESTAT_H @@ -36,7 +36,9 @@ PHP_FUNCTION(filetype); PHP_FUNCTION(is_writable); PHP_FUNCTION(is_readable); +#ifndef PHP_WIN32 PHP_FUNCTION(is_executable); +#endif PHP_FUNCTION(is_file); PHP_FUNCTION(is_dir); PHP_FUNCTION(is_link); 1.2.2.1 +11 -2 php4/ext/standard/php_image.h Index: php_image.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/php_image.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_image.h 29 Apr 2002 02:31:02 -0000 1.2 +++ php_image.h 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -17,13 +17,15 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_image.h,v 1.13 2002/03/18 18:54:28 wez Exp $ */ +/* $Id: php_image.h,v 1.19 2002/06/24 19:36:26 helly Exp $ */ #ifndef PHP_IMAGE_H #define PHP_IMAGE_H PHP_FUNCTION(getimagesize); +PHP_FUNCTION(image_type_to_mime_type); + /* {{{ enum image_filetype This enum is used to have ext/standard/image.c and ext/exif/exif.c use the same constants for file types. @@ -41,10 +43,17 @@ IMAGE_FILETYPE_JPC, IMAGE_FILETYPE_JP2, IMAGE_FILETYPE_JPX, - IMAGE_FILETYPE_JB2 + IMAGE_FILETYPE_JB2, + IMAGE_FILETYPE_SWC, + IMAGE_FILETYPE_IFF, +/* WHEN EXTENDING: PLEASE ALSO REGISTER IN image.c:PHP_MINIT_FUNCTION(imagetypes) */ } image_filetype; /* }}} */ +PHP_MINIT_FUNCTION(imagetypes); + PHPAPI int php_getimagetype(php_stream *stream, char *filetype TSRMLS_DC); + +PHPAPI const char * php_image_type_to_mime_type(int image_type); #endif /* PHP_IMAGE_H */ 1.2.2.1 +4 -1 php4/ext/standard/php_rand.h Index: php_rand.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/php_rand.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_rand.h 29 Apr 2002 02:31:02 -0000 1.2 +++ php_rand.h 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -20,7 +20,7 @@ | Based on code from: Shawn Cokus <Cokus****@math*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_rand.h,v 1.18 2002/02/28 08:26:48 sebastian Exp $ */ +/* $Id: php_rand.h,v 1.19 2002/06/09 04:26:36 andrei Exp $ */ #ifndef PHP_RAND_H #define PHP_RAND_H @@ -38,6 +38,9 @@ #else #define PHP_RAND_MAX RAND_MAX #endif + +#define RAND_RANGE(__n, __min, __max, __tmax) \ + (__n) = (__min) + (long) ((double) ((__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0))) /* MT Rand */ #define PHP_MT_RAND_MAX ((long) (0x7FFFFFFF)) /* (1<<31) - 1 */ 1.2.2.2 +2 -2 php4/ext/standard/php_smart_str.h Index: php_smart_str.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/php_smart_str.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_smart_str.h 9 May 2002 04:17:00 -0000 1.2.2.1 +++ php_smart_str.h 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -49,13 +49,13 @@ #define smart_str_append_long(dest, val) smart_str_append_long_ex(dest, val, 0) #define smart_str_append_unsigned(dest, val) smart_str_append_unsigned_ex(dest, val, 0) -static inline void smart_str_appendc_ex(smart_str *dest, char c, int what) +static inline void smart_str_appendc_ex(smart_str *dest, unsigned char c, int what) { size_t newlen; smart_str_alloc(dest, 1, what); dest->len = newlen; - dest->c[dest->len - 1] = c; + ((unsigned char *) dest->c)[dest->len - 1] = c; } 1.2.2.1 +1 -3 php4/ext/standard/rand.c Index: rand.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/rand.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- rand.c 29 Apr 2002 02:31:02 -0000 1.2 +++ rand.c 9 Jul 2002 09:14:39 -0000 1.2.2.1 @@ -20,7 +20,7 @@ | Based on code from: Shawn Cokus <Cokus****@math*****> | +----------------------------------------------------------------------+ */ -/* $Id: rand.c,v 1.58 2002/02/28 08:26:48 sebastian Exp $ */ +/* $Id: rand.c,v 1.59 2002/06/09 04:26:36 andrei Exp $ */ #include <stdlib.h> @@ -315,8 +315,6 @@ * * -RL */ -#define RAND_RANGE(__n, __min, __max, __tmax) \ - (__n) = (__min) + (long) ((double) ((__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0))) /* {{{ proto int rand([int min, int max]) Returns a random number */ 1.2.2.2 +3 -1 php4/ext/standard/reg.c Index: reg.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/reg.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- reg.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ reg.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -17,7 +17,7 @@ | Jaakko Hyv〓tti <jaakk****@hyvat*****> | +----------------------------------------------------------------------+ */ -/* $Id: reg.c,v 1.62 2002/05/04 11:20:12 hirokawa Exp $ */ +/* $Id: reg.c,v 1.63 2002/06/17 15:10:22 andrei Exp $ */ #include <stdio.h> #include "php.h" @@ -342,6 +342,7 @@ while (*walk) if ('\\' == *walk && '0' <= walk[1] && '9' >= walk[1] + && walk[1] - '0' <= re.re_nsub && subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) { new_l += subs[walk[1] - '0'].rm_eo @@ -369,6 +370,7 @@ while (*walk) if ('\\' == *walk && '0' <= walk[1] && '9' >= walk[1] + && walk[1] - '0' <= re.re_nsub && subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1 /* this next case shouldn't happen. it does. */ 1.2.2.3 +14 -8 php4/ext/standard/string.c Index: string.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/string.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- string.c 19 May 2002 11:16:05 -0000 1.2.2.2 +++ string.c 9 Jul 2002 09:14:39 -0000 1.2.2.3 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.274 2002/05/16 16:04:45 pbannister Exp $ */ +/* $Id: string.c,v 1.276 2002/06/18 11:51:06 sander Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1826,7 +1826,7 @@ convert_to_string_ex(str); if (!Z_STRLEN_PP(str)) { - RETURN_FALSE; + RETURN_EMPTY_STRING(); } ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); @@ -1847,7 +1847,7 @@ convert_to_string_ex(str); if (!Z_STRLEN_PP(str)) { - RETURN_FALSE; + RETURN_EMPTY_STRING(); } ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); @@ -2133,8 +2133,6 @@ { char *s, *t; int l; - char escape_char='\\'; - if (len != NULL) { l = *len; @@ -2153,8 +2151,16 @@ (*len)--; l--; } - } - *s++ = *t++; + *s++ = *t++; + } else if (*t=='\\' && l>0 && t[1]=='0') { + *s++='\0'; + t += 2; + if (len != NULL) + (*len)--; + l--; + } else { + *s++ = *t++; + } l--; } *s = '\0'; @@ -2163,7 +2169,7 @@ } while (l > 0) { - if (*t == escape_char) { + if (*t == '\\') { t++; /* skip the slash */ if (len != NULL) (*len)--; 1.2.2.4 +3 -3 php4/ext/standard/url_scanner_ex.c Index: url_scanner_ex.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/url_scanner_ex.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- url_scanner_ex.c 19 May 2002 11:16:05 -0000 1.2.2.3 +++ url_scanner_ex.c 9 Jul 2002 09:14:39 -0000 1.2.2.4 @@ -1,5 +1,5 @@ -/* Generated by re2c 0.5 on Wed May 8 08:08:09 2002 */ -#line 1 "/home/rasmus/php4/ext/standard/url_scanner_ex.re" +/* Generated by re2c 0.5 on Sat Jun 29 13:09:10 2002 */ +#line 1 "/home/thies/devel/php4/ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ | PHP Version 4 | @@ -890,7 +890,7 @@ php_url_scanner_ex_activate(TSRMLS_C); php_start_ob_buffer(NULL, chunk_size, 1 TSRMLS_CC); - php_ob_set_internal_handler(php_url_scanner_output_handler, chunk_size, estrdup("URL-Rewriter"), 1 TSRMLS_CC); + php_ob_set_internal_handler(php_url_scanner_output_handler, chunk_size, "URL-Rewriter", 1 TSRMLS_CC); BG(url_adapt_state_ex).active = 1; } 1.2.2.2 +1 -1 php4/ext/standard/url_scanner_ex.re Index: url_scanner_ex.re =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/url_scanner_ex.re,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- url_scanner_ex.re 9 May 2002 04:17:00 -0000 1.2.2.1 +++ url_scanner_ex.re 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -406,7 +406,7 @@ php_url_scanner_ex_activate(TSRMLS_C); php_start_ob_buffer(NULL, chunk_size, 1 TSRMLS_CC); - php_ob_set_internal_handler(php_url_scanner_output_handler, chunk_size, estrdup("URL-Rewriter"), 1 TSRMLS_CC); + php_ob_set_internal_handler(php_url_scanner_output_handler, chunk_size, "URL-Rewriter", 1 TSRMLS_CC); BG(url_adapt_state_ex).active = 1; } 1.2.2.2 +4 -12 php4/ext/standard/var.c Index: var.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/var.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- var.c 30 Apr 2002 08:13:17 -0000 1.2.2.1 +++ var.c 9 Jul 2002 09:14:39 -0000 1.2.2.2 @@ -86,30 +86,22 @@ break; case IS_ARRAY: myht = Z_ARRVAL_PP(struc); - if (++((*struc)->value.ht->nApplyCount) > 1) { + if (myht->nApplyCount > 1) { PUTS("*RECURSION*\n"); - (*struc)->value.ht->nApplyCount = 0; - break; + return; } php_printf("%sarray(%d) {\n", COMMON, zend_hash_num_elements(myht)); goto head_done; case IS_OBJECT: object = Z_OBJ_PP(struc); - if (++object->properties->nApplyCount > 1) { + myht = Z_OBJPROP_PP(struc); + if (myht->nApplyCount > 1) { PUTS("*RECURSION*\n"); - object->properties->nApplyCount = 0; return; } - myht = Z_OBJPROP_PP(struc); php_printf("%sobject(%s)(%d) {\n", COMMON, Z_OBJCE_PP(struc)->name, zend_hash_num_elements(myht)); head_done: zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_array_element_dump, 1, level); - if (Z_TYPE_PP(struc) == IS_ARRAY) { - (*struc)->value.ht->nApplyCount--; - } - else { - object->properties->nApplyCount--; - } if (level > 1) { php_printf("%*c", level-1, ' '); } 1.2.2.1 +18 -9 php4/ext/standard/versioning.c Index: versioning.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/versioning.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- versioning.c 29 Apr 2002 02:31:03 -0000 1.2 +++ versioning.c 9 Jul 2002 09:14:40 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: versioning.c,v 1.8 2002/02/28 08:26:50 sebastian Exp $ */ +/* $Id: versioning.c,v 1.9 2002/05/26 12:01:30 ssb Exp $ */ #include <stdio.h> #include <sys/types.h> @@ -105,12 +105,21 @@ PHPAPI int php_version_compare(const char *orig_ver1, const char *orig_ver2) { - char *ver1 = php_canonicalize_version(orig_ver1); - char *ver2 = php_canonicalize_version(orig_ver2); + char *ver1; + char *ver2; char *p1, *p2, *n1, *n2; long l1, l2; int compare = 0; + if (!*orig_ver1 || !*orig_ver2) { + if (!*orig_ver1 && !*orig_ver2) { + return 0; + } else { + return *orig_ver1 ? 1 : -1; + } + } + ver1 = php_canonicalize_version(orig_ver1); + ver2 = php_canonicalize_version(orig_ver2); p1 = n1 = ver1; p2 = n2 = ver2; while (*p1 && *p2 && n1 && n2) { @@ -187,22 +196,22 @@ if (argc == 2) { RETURN_LONG(compare); } - if (!strcmp(op, "<") || !strcmp(op, "lt")) { + if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) { RETURN_BOOL(compare == -1); } - if (!strcmp(op, "<=") || !strcmp(op, "le")) { + if (!strncmp(op, "<=", op_len) || !strncmp(op, "le", op_len)) { RETURN_BOOL(compare != 1); } - if (!strcmp(op, ">") || !strcmp(op, "gt")) { + if (!strncmp(op, ">", op_len) || !strncmp(op, "gt", op_len)) { RETURN_BOOL(compare == 1); } - if (!strcmp(op, ">=") || !strcmp(op, "ge")) { + if (!strncmp(op, ">=", op_len) || !strncmp(op, "ge", op_len)) { RETURN_BOOL(compare != -1); } - if (!strcmp(op, "==") || !strcmp(op, "=") || !strcmp(op, "eq")) { + if (!strncmp(op, "==", op_len) || !strncmp(op, "=", op_len) || !strncmp(op, "eq", op_len)) { RETURN_BOOL(compare == 0); } - if (!strcmp(op, "!=") || !strcmp(op, "<>") || !strcmp(op, "ne")) { + if (!strncmp(op, "!=", op_len) || !strncmp(op, "<>", op_len) || !strncmp(op, "ne", op_len)) { RETURN_BOOL(compare != 0); } RETURN_NULL(); No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:03 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:40 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/aggregation/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:03 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:40 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/array/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/array/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:03 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:40 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/assert/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/assert/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:03 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:40 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/file/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/file/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:03 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/general_functions/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/general_functions/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:03 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/math/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/math/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:03 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/reg/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/reg/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:03 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/serialize/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/serialize/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:04 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/strings/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/strings/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:04 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/time/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/time/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:04 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/ext/standard/tests/versioning/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/versioning/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:04 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.1.2.2 +1 -3 php4/ext/sysvmsg/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/sysvmsg/tests/.cvsignore,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- .cvsignore 9 May 2002 04:17:00 -0000 1.1.2.1 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.1.2.2 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +2 -1 php4/ext/tokenizer/tokenizer.c Index: tokenizer.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/tokenizer/tokenizer.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- tokenizer.c 29 Apr 2002 02:31:05 -0000 1.2 +++ tokenizer.c 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -480,7 +480,7 @@ if (zend_parse_parameters(argc TSRMLS_CC, "s", &source, &source_len) == FAILURE) return; - ZVAL_STRINGL(&source_z, source, source_len, 0); + ZVAL_STRINGL(&source_z, source, source_len, 1); zend_save_lexical_state(&original_lex_state TSRMLS_CC); if (zend_prepare_string_for_scanning(&source_z, "" TSRMLS_CC) == FAILURE) { @@ -490,6 +490,7 @@ tokenize(return_value TSRMLS_CC); zend_restore_lexical_state(&original_lex_state TSRMLS_CC); + zval_dtor(&source_z); } /* }}} */ No revision No revision 1.2.2.1 +1 -3 php4/ext/xml/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/xml/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:06 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +5 -2 php4/ext/xmlrpc/xmlrpc-epi-php.c Index: xmlrpc-epi-php.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/xmlrpc-epi-php.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- xmlrpc-epi-php.c 29 Apr 2002 02:31:06 -0000 1.2 +++ xmlrpc-epi-php.c 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -77,13 +77,16 @@ static int le_xmlrpc_server; +static unsigned char second_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_NONE }; +static unsigned char first_args_force_ref[] = { 2, BYREF_FORCE, BYREF_NONE }; + function_entry xmlrpc_functions[] = { PHP_FE(xmlrpc_encode, NULL) PHP_FE(xmlrpc_decode, NULL) - PHP_FE(xmlrpc_decode_request, NULL) + PHP_FE(xmlrpc_decode_request, second_args_force_ref) PHP_FE(xmlrpc_encode_request, NULL) PHP_FE(xmlrpc_get_type, NULL) - PHP_FE(xmlrpc_set_type, NULL) + PHP_FE(xmlrpc_set_type, first_args_force_ref) PHP_FE(xmlrpc_server_create, NULL) PHP_FE(xmlrpc_server_destroy, NULL) PHP_FE(xmlrpc_server_register_method, NULL) No revision No revision 1.2.2.1 +6 -1 php4/ext/xmlrpc/libxmlrpc/encodings.c Index: encodings.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/encodings.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- encodings.c 29 Apr 2002 02:31:07 -0000 1.2 +++ encodings.c 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -30,8 +30,13 @@ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif -static const char rcsid[] = "#(@) $Id: encodings.c,v 1.2 2002/03/26 00:14:26 sniper Exp $"; +#include <php_config.h> + +static const char rcsid[] = "#(@) $Id: encodings.c,v 1.3 2002/06/30 05:10:39 sniper Exp $"; #include <errno.h> No revision No revision 1.2.2.1 +4 -9 php4/ext/xslt/php_sablot.h Index: php_sablot.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/xslt/php_sablot.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_sablot.h 29 Apr 2002 02:31:07 -0000 1.2 +++ php_sablot.h 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -16,8 +16,6 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_sablot.h,v 1.9 2002/04/19 22:17:22 sterling Exp $ */ - #ifndef PHP_XSLT_H #define PHP_XSLT_H @@ -43,7 +41,6 @@ #define XSLT_ERROR(handle) ((handle)->handlers->error) #define XSLT_PROCESSOR(handle) ((handle)->processor.ptr) -#define XSLT_CONTEXT(handle) ((handle)->processor.ctx) #define XSLT_ERRNO(handle) ((handle)->err->no) #define XSLT_ERRSTR(handle) ((handle)->err->str) @@ -62,9 +59,9 @@ PHP_FUNCTION(xslt_set_encoding); PHP_FUNCTION(xslt_set_log); PHP_FUNCTION(xslt_process); -PHP_FUNCTION(xslt_free); PHP_FUNCTION(xslt_error); PHP_FUNCTION(xslt_errno); +PHP_FUNCTION(xslt_free); struct scheme_handlers { zval *get_all; @@ -93,9 +90,8 @@ }; struct xslt_processor { - SablotSituation ctx; - SablotHandle ptr; - long idx; + SablotHandle ptr; + long idx; }; struct xslt_log { @@ -111,10 +107,9 @@ }; typedef struct { - struct xslt_processor processor; struct xslt_handlers *handlers; + struct xslt_processor processor; struct xslt_error *err; - int cacheable; } php_xslt; #else 1.2.2.1 +314 -377 php4/ext/xslt/sablot.c Index: sablot.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/xslt/sablot.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- sablot.c 29 Apr 2002 02:31:07 -0000 1.2 +++ sablot.c 9 Jul 2002 09:14:41 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sablot.c,v 1.46 2002/04/21 00:41:37 sterling Exp $ */ +/* $Id: sablot.c,v 1.48 2002/06/29 01:55:34 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -30,7 +30,6 @@ #if HAVE_SABLOT_BACKEND #include <sablot.h> -#include <sdom.h> #include <string.h> #include <stdarg.h> @@ -53,15 +52,15 @@ static int scheme_close(void *, SablotHandle, int); /* Sax handler functions */ -static SAX_RETURN sax_startdoc(void *, SablotHandle); -static SAX_RETURN sax_startelement(void *, SablotHandle, const char *, const char **); -static SAX_RETURN sax_endelement(void *, SablotHandle, const char *); -static SAX_RETURN sax_startnamespace(void *, SablotHandle, const char *, const char *); -static SAX_RETURN sax_endnamespace(void *, SablotHandle, const char *); -static SAX_RETURN sax_comment(void *, SablotHandle, const char *); -static SAX_RETURN sax_pi(void *, SablotHandle, const char *, const char *); -static SAX_RETURN sax_characters(void *, SablotHandle, const char *, int); -static SAX_RETURN sax_enddoc(void *, SablotHandle); +static SAX_RETURN sax_startdoc(void *); +static SAX_RETURN sax_startelement(void *, const char *, const char **); +static SAX_RETURN sax_endelement(void *, const char *); +static SAX_RETURN sax_startnamespace(void *, const char *, const char *); +static SAX_RETURN sax_endnamespace(void *, const char *); +static SAX_RETURN sax_comment(void *, const char *); +static SAX_RETURN sax_pi(void *, const char *, const char *); +static SAX_RETURN sax_characters(void *, const char *, int); +static SAX_RETURN sax_enddoc(void *); /* Error handlers */ static MH_ERROR error_makecode(void *, SablotHandle, int, unsigned short, unsigned short); @@ -78,17 +77,16 @@ PHP_FE(xslt_create, NULL) PHP_FE(xslt_set_sax_handlers, NULL) PHP_FE(xslt_set_scheme_handlers, NULL) - PHP_FE(xslt_process, NULL) - PHP_FE(xslt_set_base, NULL) - PHP_FE(xslt_set_log, NULL) PHP_FE(xslt_set_error_handler, NULL) + PHP_FE(xslt_set_base, NULL) #ifdef HAVE_SABLOT_SET_ENCODING PHP_FE(xslt_set_encoding, NULL) #endif + PHP_FE(xslt_set_log, NULL) + PHP_FE(xslt_process, NULL) + PHP_FE(xslt_error, NULL) + PHP_FE(xslt_errno, NULL) PHP_FE(xslt_free, NULL) - - PHP_FE(xslt_error, NULL) - PHP_FE(xslt_errno, NULL) {NULL, NULL, NULL} }; /* }}} */ @@ -170,10 +168,9 @@ Create a new XSLT processor */ PHP_FUNCTION(xslt_create) { - php_xslt *handle; /* The php -> sablotron handle */ - SablotSituation ctx; /* Sablotron situation */ - SablotHandle processor; /* The sablotron processor */ - int error; /* The error container */ + php_xslt *handle; /* The php -> sablotron handle */ + SablotHandle processor; /* The sablotron processor */ + int error; /* The error container */ /* Allocate the php-sablotron handle */ handle = ecalloc(1, sizeof(php_xslt)); @@ -182,20 +179,8 @@ XSLT_LOG(handle).path = NULL; - /* Unless SAX handlers are */ - handle->cacheable = 1; - - /* Allocate the processor ctx */ - error = SablotCreateSituation(&ctx); - if (error) { - XSLT_ERRNO(handle) = error; - RETURN_FALSE; - } - - XSLT_CONTEXT(handle) = ctx; - /* Allocate the actual processor itself, via sablotron */ - error = SablotCreateProcessorForSituation(XSLT_CONTEXT(handle), &processor); + error = SablotCreateProcessor(&processor); if (error) { XSLT_ERRNO(handle) = error; RETURN_FALSE; @@ -234,8 +219,6 @@ } ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt); - handle->cacheable = 0; - /* Convert the sax_handlers_p zval ** to a hash table we can process */ sax_handlers = HASH_OF(*sax_handlers_p); if (!sax_handlers) { @@ -257,39 +240,39 @@ } /* Document handlers (document start, document end) */ - if (!strcmp(string_key, "document")) { + if (strcasecmp(string_key, "document") == 0) { SEPARATE_ZVAL(handler); register_sax_handler_pair(&XSLT_SAX(handle).doc_start, &XSLT_SAX(handle).doc_end, handler); } /* Element handlers, start of an element, and end of an element */ - else if (!strcmp(string_key, "element")) { + else if (strcasecmp(string_key, "element") == 0) { SEPARATE_ZVAL(handler); register_sax_handler_pair(&XSLT_SAX(handle).element_start, &XSLT_SAX(handle).element_end, handler); } /* Namespace handlers, start of a namespace, end of a namespace */ - else if (!strcmp(string_key, "namespace")) { + else if (strcasecmp(string_key, "namespace") == 0) { SEPARATE_ZVAL(handler); register_sax_handler_pair(&XSLT_SAX(handle).namespace_start, &XSLT_SAX(handle).namespace_end, handler); } /* Comment handlers, called when a comment is reached */ - else if (!strcmp(string_key, "comment")) { + else if (strcasecmp(string_key, "comment") == 0) { XSLT_SAX(handle).comment = *handler; zval_add_ref(&XSLT_SAX(handle).comment); } /* Processing instructions handler called when processing instructions (<? ?>) */ - else if (!strcmp(string_key, "pi")) { + else if (strcasecmp(string_key, "pi") == 0) { XSLT_SAX(handle).pi = *handler; zval_add_ref(&XSLT_SAX(handle).pi); } /* Character handler, called when data is found */ - else if (!strcmp(string_key, "character")) { + else if (strcasecmp(string_key, "character") == 0) { XSLT_SAX(handle).characters = *handler; zval_add_ref(&XSLT_SAX(handle).characters); } @@ -335,36 +318,34 @@ key_type = zend_hash_get_current_key(scheme_handlers, &string_key, &num_key, 0); if (key_type == HASH_KEY_IS_LONG) { - php_error(E_NOTICE, "Numerical key %d (with value %s) being ignored " - "in xslt_set_scheme_handlers()", + php_error(E_NOTICE, "Numerical key %d (with value %s) being ignored in xslt_set_scheme_handlers()", num_key, Z_STRVAL_PP(handler)); continue; } /* Open the URI and return the whole string */ - if (!strcmp(string_key, "get_all")) { + if (strcasecmp(string_key, "get_all") == 0) { assign_handle = &XSLT_SCHEME(handle).get_all; } /* Open the URI and return a handle */ - else if (!strcmp(string_key, "open")) { + else if (strcasecmp(string_key, "open") == 0) { assign_handle = &XSLT_SCHEME(handle).open; } /* Retrieve data from the URI */ - else if (!strcmp(string_key, "get")) { + else if (strcasecmp(string_key, "get") == 0) { assign_handle = &XSLT_SCHEME(handle).get; } /* Save data to the URI */ - else if (!strcmp(string_key, "put")) { + else if (strcasecmp(string_key, "put") == 0) { assign_handle = &XSLT_SCHEME(handle).put; } /* Close the URI */ - else if (!strcmp(string_key, "close")) { + else if (strcasecmp(string_key, "close") == 0) { assign_handle = &XSLT_SCHEME(handle).close; } /* Invalid handler name */ else { - php_error(E_WARNING, "%s() invalid option '%s', skipping", - get_active_function_name(TSRMLS_C), string_key); + php_error(E_WARNING, "%s() invalid option '%s', skipping", get_active_function_name(TSRMLS_C), string_key); continue; } @@ -435,8 +416,6 @@ /* Set the encoding */ SablotSetEncoding(XSLT_PROCESSOR(handle), Z_STRVAL_PP(encoding)); -#else - php_error(E_WARNING, "Sablotron not compiled with encoding support"); #endif } @@ -457,9 +436,7 @@ } ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt); - if (Z_TYPE_PP(logfile) == IS_LONG || - Z_TYPE_PP(logfile) == IS_BOOL || - Z_TYPE_PP(logfile) == IS_DOUBLE) { + if (Z_TYPE_PP(logfile) == IS_LONG || Z_TYPE_PP(logfile) == IS_BOOL || Z_TYPE_PP(logfile) == IS_DOUBLE) { XSLT_LOG(handle).do_log = Z_LVAL_PP(logfile); RETURN_NULL(); } @@ -478,163 +455,83 @@ } /* }}} */ -/* {{{ S_DOM *_php_sablot_dom_proc(php_xslt *, char *, size_t, zval **) - */ -static SDOM_Document -_php_sablot_dom_proc(php_xslt *handle, char *datap, size_t data_len, zval **args) -{ - SDOM_Document domtree; - - if (!strncmp(datap, "arg:", 4)) { - zval **data; - - if (zend_hash_find(Z_ARRVAL_PP(args), - datap + 4, - data_len - 3, - (void **) &data) == FAILURE && - zend_hash_find(Z_ARRVAL_PP(args), - datap + 5, - data_len - 4, - (void **) &data) == FAILURE) { - php_error(E_WARNING, "Cannot find argument: %s", datap); - return NULL; - } - - SablotParseBuffer(XSLT_CONTEXT(handle), Z_STRVAL_PP(data), &domtree); - } - else { - SablotParse(XSLT_CONTEXT(handle), datap, &domtree); - } - - return domtree; -} -/* }}} */ - /* {{{ proto string xslt_process(resource processor, string xml, string xslt[, mixed result[, array args[, array params]]]) Perform the xslt transformation */ PHP_FUNCTION(xslt_process) { - zval **processor_p; /* Resource Pointer to a PHP-XSLT processor */ - zval **xml_p; /* A zval pointer to the XML data */ - zval **xsl_p; /* A zval pointer to the XSL data */ - zval **result_p; /* A zval pointer to the transformation results */ - zval **params_p; /* A zval pointer to the XSL parameters array */ - zval **args_p; /* A zval pointer to the XSL arguments array */ - zval **data; /* Parameter data */ - php_xslt *handle; /* A PHP-XSLT processor */ - SDOM_Document xml_dom; /* XML DOM tree to SablotRunProcessorGen */ - SDOM_Document xsl_dom; /* XSL DOM tree to SablotRunProcessorGen */ - char *string_key; /* String key from xslt_process() */ - char *result; /* The result file or argument buffer */ - int argc; /* The number of arguments given */ - int error; /* Our error container */ - ulong num_key; /* Numerical key */ - - argc = ZEND_NUM_ARGS(); + zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */ + **xml_p, /* A zval pointer to the XML data */ + **xslt_p, /* A zval pointer to the XSLT data */ + **result_p, /* A zval pointer to the transformation results */ + **params_p, /* A zval pointer to the XSLT parameters array */ + **args_p; /* A zval pointer to the XSLT arguments array */ + php_xslt *handle; /* A PHP-XSLT processor */ + char **params = NULL; /* A Sablotron parameter array (derived from the zval parameter array) */ + char **args = NULL; /* A Sablotron argument array (derived from the zval argument array) */ + char *xslt; /* The XSLT stylesheet or argument buffer (pointer to xslt_p) */ + char *xml; /* The XML stylesheet or argument buffer (pointer to xml_p) */ + char *result; /* The result file or argument buffer */ + int argc = ZEND_NUM_ARGS(); /* The number of arguments given */ + int error; /* Our error container */ if (argc < 3 || argc > 6 || - zend_get_parameters_ex(argc, &processor_p, &xml_p, &xsl_p, - &result_p, &args_p, ¶ms_p) == FAILURE) { + zend_get_parameters_ex(argc, &processor_p, &xml_p, &xslt_p, &result_p, &args_p, ¶ms_p) == FAILURE) { WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt); - /* Convert the XML and XSLT strings to S_DOM * handles */ + ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt); convert_to_string_ex(xml_p); - convert_to_string_ex(xsl_p); - - xml_dom = _php_sablot_dom_proc(handle, - Z_STRVAL_PP(xml_p), - Z_STRLEN_PP(xml_p), - args_p); - if (!xml_dom) { - RETURN_FALSE; - } - - xsl_dom = _php_sablot_dom_proc(handle, - Z_STRVAL_PP(xsl_p), - Z_STRLEN_PP(xsl_p), - args_p); - if (!xsl_dom) { - RETURN_FALSE; - } + convert_to_string_ex(xslt_p); - - SablotAddArgTree(XSLT_CONTEXT(handle), - XSLT_PROCESSOR(handle), - "xml", - xml_dom); - SablotAddArgTree(XSLT_CONTEXT(handle), - XSLT_PROCESSOR(handle), - "xsl", - xsl_dom); + xml = Z_STRVAL_PP(xml_p); + xslt = Z_STRVAL_PP(xslt_p); /* Well, no result file was given or result buffer, that means (guess what?) - * we're returning the result yipp di doo! - */ - if (argc < 4 || - Z_TYPE_PP(result_p) == IS_NULL || - !strcmp(Z_STRVAL_PP(result_p), "arg:/result")) { - result = "result"; - SablotAddArgBuffer(XSLT_CONTEXT(handle), - XSLT_PROCESSOR(handle), - result, - NULL); + we're returning the result yipp di doo! */ + if (argc < 4 || Z_TYPE_PP(result_p) == IS_NULL) { + result = "arg:/_result"; } - /* The result buffer to place the data into, either a file or - * an argument buffer, etc. - */ + /* The result buffer to place the data into, either a file or an argument buffer, etc. */ else { convert_to_string_ex(result_p); result = Z_STRVAL_PP(result_p); } - /* Add the XSLT parameters */ + /* Translate a PHP array into a Sablotron array */ + if (argc > 4) { + xslt_make_array(args_p, &args); + } + if (argc > 5) { - for (zend_hash_internal_pointer_reset(Z_ARRVAL_PP(params_p)); - zend_hash_get_current_data(Z_ARRVAL_PP(params_p), (void **) &data) == FAILURE; - zend_hash_move_forward(Z_ARRVAL_PP(params_p))) { - if (zend_hash_get_current_key(Z_ARRVAL_PP(params_p), - &string_key, - &num_key, - 0) == HASH_KEY_IS_LONG) { - php_error(E_WARNING, "Only string keys are allowed as XSLT parameters"); - RETURN_FALSE; - } - - SablotAddParam(XSLT_CONTEXT(handle), - XSLT_PROCESSOR(handle), - string_key, - Z_STRVAL_PP(data)); - } + xslt_make_array(params_p, ¶ms); } - + /* Perform transformation */ - error = SablotRunProcessorGen(XSLT_CONTEXT(handle), - XSLT_PROCESSOR(handle), - "arg:/xsl", - "arg:/xml", - result); + error = SablotRunProcessor(XSLT_PROCESSOR(handle), xslt, xml, result, params, args); if (error) { XSLT_ERRNO(handle) = error; + + if (params) xslt_free_array(params); + if (args) xslt_free_array(args); + RETURN_FALSE; } - SablotDestroyDocument(XSLT_CONTEXT(handle), xml_dom); - SablotDestroyDocument(XSLT_CONTEXT(handle), xsl_dom); - /* If the result buffer is specified, then we return the results of the XSLT transformation */ - if (!strcmp(result, "arg:/result")) { + if (!strcmp(result, "arg:/_result")) { char *trans_result; /* Fetch the result buffer into trans_result */ - error = SablotGetResultArg(XSLT_PROCESSOR(handle), - "arg:/result", - &trans_result); + error = SablotGetResultArg(handle->processor.ptr, "arg:/_result", &trans_result); if (error) { /* Save the error number */ XSLT_ERRNO(handle) = error; + + /* Cleanup */ + if (params) xslt_free_array(params); + if (args) xslt_free_array(args); + RETURN_FALSE; } @@ -642,26 +539,12 @@ SablotFree(trans_result); } else { - RETURN_TRUE; + RETVAL_TRUE; } -} -/* }}} */ - -/* {{{ proto void xslt_free(resource processor) - Free the xslt processor up */ -PHP_FUNCTION(xslt_free) -{ - zval **processor_p; /* Resource pointer to a php-xslt processor */ - php_xslt *handle; /* A PHP-XSLT processor */ - if (ZEND_NUM_ARGS() != 1 || - zend_get_parameters_ex(1, &processor_p) == FAILURE) { - WRONG_PARAM_COUNT; - } - ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt); - - /* Remove the entry from the list */ - zend_list_delete(Z_LVAL_PP(processor_p)); + /* Cleanup */ + if (params) xslt_free_array(params); + if (args) xslt_free_array(args); } /* }}} */ @@ -703,6 +586,24 @@ } /* }}} */ +/* {{{ proto void xslt_free(resource processor) + Free the xslt processor up */ +PHP_FUNCTION(xslt_free) +{ + zval **processor_p; /* Resource pointer to a php-xslt processor */ + php_xslt *handle; /* A PHP-XSLT processor */ + + if (ZEND_NUM_ARGS() != 1 || + zend_get_parameters_ex(1, &processor_p) == FAILURE) { + WRONG_PARAM_COUNT; + } + ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt); + + /* Remove the entry from the list */ + zend_list_delete(Z_LVAL_PP(processor_p)); +} +/* }}} */ + /* {{{ free_processor() Free an XSLT processor */ static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC) @@ -717,10 +618,6 @@ SablotDestroyProcessor(XSLT_PROCESSOR(handle)); } - if (XSLT_CONTEXT(handle)) { - SablotDestroySituation(XSLT_CONTEXT(handle)); - } - /* Free Scheme handlers */ XSLT_FUNCH_FREE(XSLT_SCHEME(handle).get_all); XSLT_FUNCH_FREE(XSLT_SCHEME(handle).open); @@ -792,16 +689,11 @@ /* {{{ scheme_getall() The getall scheme handler */ -static int scheme_getall(void *user_data, - SablotHandle proc, - const char *scheme, - const char *rest, - char **buffer, - int *byte_count) -{ - zval *argv[3]; /* Arguments to the scheme getall function */ - zval *retval; /* Return value from the scheme getall function */ - php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ +static int scheme_getall(void *user_data, SablotHandle proc, const char *scheme, const char *rest, char **buffer, int *byte_count) +{ + zval *argv[3]; /* Arguments to the scheme getall function */ + zval *retval; /* Return value from the scheme getall function */ + php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ TSRMLS_FETCH(); /* If the scheme handler get all function doesn't @@ -875,15 +767,11 @@ /* {{{ scheme_open() Called when the URI needs to be opened */ -static int scheme_open(void *user_data, - SablotHandle proc, - const char *scheme, - const char *rest, - int *fd) -{ - zval *argv[3]; /* Arguments to the scheme open function */ - zval *retval; /* The return value from the scheme open function */ - php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ +static int scheme_open(void *user_data, SablotHandle proc, const char *scheme, const char *rest, int *fd) +{ + zval *argv[3]; /* Arguments to the scheme open function */ + zval *retval; /* The return value from the scheme open function */ + php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ TSRMLS_FETCH(); /* If no open handler exists, let's exit */ @@ -924,9 +812,9 @@ Called when data needs to be fetched from the URI */ static int scheme_get(void *user_data, SablotHandle proc, int fd, char *buffer, int *byte_count) { - zval *argv[3]; /* Arguments to the scheme get function */ - zval *retval; /* Return value from the scheme get function */ - php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ + zval *argv[3]; /* Arguments to the scheme get function */ + zval *retval; /* Return value from the scheme get function */ + php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ TSRMLS_FETCH(); /* If no get handler exists, let's exit */ @@ -966,15 +854,11 @@ /* {{{ scheme_put() Called when data needs to be written */ -static int scheme_put(void *user_data, - SablotHandle proc, - int fd, - const char *buffer, - int *byte_count) -{ - zval *argv[3]; /* Arguments to the scheme put function */ - zval *retval; /* Return value from the scheme put function */ - php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ +static int scheme_put(void *user_data, SablotHandle proc, int fd, const char *buffer, int *byte_count) +{ + zval *argv[3]; /* Arguments to the scheme put function */ + zval *retval; /* Return value from the scheme put function */ + php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ TSRMLS_FETCH(); /* If no put handler exists, let's exit */ @@ -1016,9 +900,9 @@ Called when its time to close the fd */ static int scheme_close(void *user_data, SablotHandle proc, int fd) { - zval *argv[2]; /* Arguments to the scheme close function*/ - zval *retval; /* Return value from the scheme close function */ - php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ + zval *argv[2]; /* Arguments to the scheme close function*/ + zval *retval; /* Return value from the scheme close function */ + php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ TSRMLS_FETCH(); /* if no close handler exists, exit */ @@ -1052,7 +936,7 @@ /* {{{ sax_startdoc() Called when the document starts to be processed */ -static SAX_RETURN sax_startdoc(void *ctx, SablotHandle proc) +static SAX_RETURN sax_startdoc(void *ctx) { zval *argv[1]; /* Arguments to the sax start doc function */ zval *retval; /* Return value from sax start doc function */ @@ -1083,14 +967,13 @@ /* {{{ sax_startelement() Called when an element is begun to be processed */ static SAX_RETURN sax_startelement(void *ctx, - SablotHandle proc, const char *name, const char **attr) { - zval *argv[3]; /* Arguments to the sax start element function */ - zval *retval; /* Return value from the sax start element function */ - php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */ - char **p; /* Pointer to attributes */ + zval *argv[3]; /* Arguments to the sax start element function */ + zval *retval; /* Return value from the sax start element function */ + php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */ + char **p; /* Pointer to attributes */ TSRMLS_FETCH(); /* If no element start function is found, exit */ @@ -1129,9 +1012,9 @@ } /* }}} */ -/* {{{ sax_endelement() +/* {{{ xslt_sax_endelement() Called when an ending XML element is encountered */ -static SAX_RETURN sax_endelement(void *ctx, SablotHandle proc, const char *name) +static SAX_RETURN sax_endelement(void *ctx, const char *name) { zval *argv[2]; /* Arguments to the sax end element function */ zval *retval; /* Return value from the sax end element function */ @@ -1166,7 +1049,6 @@ /* {{{ sax_startnamespace() Called at the beginning of the parsing of a new namespace */ static SAX_RETURN sax_startnamespace(void *ctx, - SablotHandle proc, const char *prefix, const char *uri) { @@ -1205,7 +1087,7 @@ /* {{{ sax_endnamespace() Called when a new namespace is finished being parsed */ -static SAX_RETURN sax_endnamespace(void *ctx, SablotHandle proc, const char *prefix) +static SAX_RETURN sax_endnamespace(void *ctx, const char *prefix) { zval *argv[2]; /* Arguments to the sax end namespace function */ zval *retval; /* Return value from the sax end namespace function */ @@ -1239,7 +1121,7 @@ /* {{{ sax_comment() Called when a comment is found */ -static SAX_RETURN sax_comment(void *ctx, SablotHandle proc, const char *contents) +static SAX_RETURN sax_comment(void *ctx, const char *contents) { zval *argv[2]; /* Arguments to the sax comment function */ zval *retval; /* Return value from the sax comment function */ @@ -1274,16 +1156,13 @@ /* {{{ sax_pi() Called when processing instructions are found */ static SAX_RETURN sax_pi(void *ctx, - SablotHandle proc, const char *target, const char *contents) { - zval *argv[3]; /* Arguments to the sax processing instruction function */ - zval *retval; /* Return value from the sax processing instruction function */ - php_xslt *handle; /* A PHP-XSLT processor */ + zval *argv[3]; /* Arguments to the sax processing instruction function */ + zval *retval; /* Return value from the sax processing instruction function */ + php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */ TSRMLS_FETCH(); - - handle = (php_xslt *) ctx; /* If no processing instructions function exists, exit */ if (!XSLT_SAX(handle).pi) { @@ -1316,7 +1195,6 @@ /* {{{ sax_characters() Called when characters are come upon */ static SAX_RETURN sax_characters(void *ctx, - SablotHandle proc, const char *contents, int length) { @@ -1352,13 +1230,13 @@ /* {{{ sax_enddoc() Called when the document is finished being parsed */ -static SAX_RETURN sax_enddoc(void *ctx, SablotHandle proc) +static SAX_RETURN sax_enddoc(void *ctx) { zval *argv[1]; /* Arguments to the end document function */ zval *retval; /* Return value from the end document function */ php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */ TSRMLS_FETCH(); - + /* If no end document function exists, exit */ if (!XSLT_SAX(handle).doc_end) { return; @@ -1381,78 +1259,9 @@ } /* }}} */ - -/* {{{ _error_parse() - Parse a char ** array into an _error_fields structure */ -struct _error_fields { - char *message; - char *type; - char *line; -}; - -static void -_error_parse (char **fields, struct _error_fields *xse) -{ - char *val; - char *p; - int pos; - int len; - - /* Prep structure */ - memset(xse, 0, sizeof(struct _error_fields)); - - while (*fields) { - p = strchr(*fields, ':'); - if (p == NULL) - continue; - - len = strlen(*fields); - - pos = p - *fields; - val = estrndup(*fields + pos + 1, len - pos); - - if (!strncmp(*fields, "msg", MIN(3, pos+1))) { - xse->message = val; - } - else if (!strncmp(*fields, "type", MIN(4, pos+1))) { - xse->type = val; - } - else if (!strncmp(*fields, "line", MIN(4, pos+1))) { - xse->line = val; - } - - ++fields; - } - - if (!xse->type) - xse->type = estrdup("unknown error type"); - - if (!xse->line) - xse->line = estrdup("unknown line"); - - if (!xse->message) - xse->message = estrdup("unknown error"); -} -/* }}} */ - -/* {{{ _free_error_field_struct() - Free an error field structure created by _error_parse() */ -static void -_free_error_field_struct(struct _error_fields *xse) -{ - if (xse->message) efree(xse->message); - if (xse->type) efree(xse->type); - if (xse->line) efree(xse->line); -} -/* }}} */ - /* {{{ error_makecode() Make the error code */ -static MH_ERROR error_makecode(void *user_data, - SablotHandle proc, - int severity, - unsigned short facility, - unsigned short code) +static MH_ERROR error_makecode(void *user_data, SablotHandle proc, int severity, unsigned short facility, unsigned short code) { return 0; } @@ -1460,34 +1269,87 @@ /* {{{ error_log() Called when its time to log data */ -static MH_ERROR error_log(void *user_data, - SablotHandle proc, - MH_ERROR code, - MH_LEVEL level, - char **fields) -{ - php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ - struct _error_fields err; /* Error structure */ - char *msgbuf; /* Message buffer */ - int msgbuf_len; /* Message buffer len */ - int error = 0; /* Error container */ - -#define msgformat "Sablotron message on line %s, level %s: %s\n" +static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_LEVEL level, char **fields) +{ + php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ + char *errmsg = NULL; /* Error message*/ + char *errtype = NULL; /* Error type */ + char *errline = NULL; /* Error line */ + char *msgbuf = NULL; /* Message buffer */ + char msgformat[] = "Sablotron Message on line %s, level %s: %s\n"; /* Message format */ + int error = 0; /* Error container */ - /* Skip, if logging is disabled */ if (!XSLT_LOG(handle).do_log) return 0; - /* parse error list into a structure */ - _error_parse(fields, &err); + /* Parse the error array */ + /* Loop through the error array */ + if (fields) { + while (*fields) { + char *key; /* Key to for the message */ + char *val; /* The message itself */ + char *ptr; /* Pointer to the location of the ':' (separator) */ + int pos; /* Position of the ':' (separator) */ + int len; /* Length of the string */ + + len = strlen(*fields); + + /* Grab the separator's position */ + ptr = strchr(*fields, ':'); + if (!ptr) { + continue; + } + pos = ptr - *fields; + + /* Allocate the key and value and copy the data onto them */ + key = emalloc(pos + 1); + val = emalloc((len - pos) + 1); + + strlcpy(key, *fields, pos + 1); + strlcpy(val, *fields + pos + 1, len - pos); + + /* Check to see whether or not we want to save the data */ + if (!strcmp(key, "msg")) { + errmsg = estrndup(val, len - pos); + } + else if (!strcmp(key, "type")) { + errtype = estrndup(val, len - pos); + } + else if (!strcmp(key, "line")) { + errline = estrndup(val, len - pos); + } + + /* Cleanup */ + if (key) efree(key); + if (val) efree(val); + /* Next key:value pair please :) */ + fields++; + } + } + + /* If no error line is given, then place none in the + file */ + if (!errline) { + errline = estrndup("none", sizeof("none") - 1); + } + + /* Default type is a log handle */ + if (!errtype) { + errtype = estrndup("log", sizeof("log") - 1); + } + + /* No error message, no cry */ + if (!errmsg) { + errmsg = estrndup("unknown error", sizeof("unknown error") - 1); + } + /* Allocate the message buf and copy the data into it */ - msgbuf_len = (sizeof(msgformat) - 6) + - strlen(err.message) + - strlen(err.line) + - strlen(err.type); - msgbuf = emalloc(msgbuf_len + 1); - snprintf(msgbuf, msgbuf_len, msgformat, err.line, err.type, err.message); + msgbuf = emalloc((sizeof(msgformat) - 6) + + strlen(errmsg) + + strlen(errline) + + strlen(errtype) + 1); + sprintf(msgbuf, msgformat, errline, errtype, errmsg); /* If the error is serious enough, copy it to our error buffer which will show up when someone calls the xslt_error() function */ @@ -1497,7 +1359,7 @@ if (XSLT_ERRSTR(handle)) efree(XSLT_ERRSTR(handle)); - XSLT_ERRSTR(handle) = estrndup(msgbuf, msgbuf_len); + XSLT_ERRSTR(handle) = estrdup(errmsg); } /* If we haven't allocated and opened the file yet */ @@ -1522,7 +1384,7 @@ } /* Write the error to the file */ - error = write(XSLT_LOG(handle).fd, msgbuf, msgbuf_len); + error = write(XSLT_LOG(handle).fd, msgbuf, strlen(msgbuf)); if (error == -1) { php_error(E_WARNING, "Cannot write data to log file, %s, with fd, %d [%d]: %s", (XSLT_LOG(handle).path ? XSLT_LOG(handle).path : "stderr"), @@ -1533,8 +1395,10 @@ } /* Cleanup */ - if (msgbuf) efree(msgbuf); - _free_error_field_struct(&err); + if (msgbuf) efree(msgbuf); + if (errtype) efree(errtype); + if (errline) efree(errline); + if (errmsg) efree(errmsg); return 0; } @@ -1542,17 +1406,10 @@ /* {{{ error_print() Print out an error message or call the error handler */ -static MH_ERROR error_print(void *user_data, - SablotHandle proc, - MH_ERROR code, - MH_LEVEL level, - char **fields) +static MH_ERROR error_print(void *user_data, SablotHandle proc, MH_ERROR code, MH_LEVEL level, char **fields) { - php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ - struct _error_fields err; /* Error field structure */ + php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ - _error_parse(fields, &err); - if (XSLT_ERROR(handle)) { zval *argv[4]; /* Arguments to the error function */ zval *retval; /* Return value from the error function */ @@ -1575,9 +1432,41 @@ ZVAL_LONG(argv[1], level); ZVAL_LONG(argv[2], code); - add_assoc_string_ex(argv[3], "type", sizeof("type") - 1, err.type, 0); - add_assoc_string_ex(argv[3], "message", sizeof("message") - 1, err.message, 0); - add_assoc_long_ex(argv[3], "line", sizeof("line") - 1, atoi(err.line)); + if (fields) { + while (*fields) { + char *key; /* Key to for the message */ + char *val; /* The message itself */ + char *ptr; /* Pointer to the location of the ':' (separator) */ + int pos; /* Position of the ':' (separator) */ + int len; /* Length of the string */ + + len = strlen(*fields); + + /* Grab the separator's position */ + ptr = strchr(*fields, ':'); + if (!ptr) { + continue; + } + pos = ptr - *fields; + + /* Allocate the key and value and copy the data onto them */ + key = emalloc(pos + 1); + val = emalloc((len - pos) + 1); + + strlcpy(key, *fields, pos + 1); + strlcpy(val, *fields + pos + 1, len - pos); + + /* Add it */ + add_assoc_stringl_ex(argv[3], key, pos, val, len - pos - 1, 1); + + /* Cleanup */ + efree(key); + efree(val); + + /* Next field please */ + fields++; + } + } /* Call the function */ xslt_call_function("error handler", XSLT_ERROR(handle), @@ -1587,10 +1476,10 @@ zval_ptr_dtor(&retval); } else { - char *msgbuf; /* Message buffer */ - size_t msgbuf_len; /* Message buffer length */ - -#define msgformat "Sablotron error on line %s: %s" + char *errmsg = NULL; /* Error message */ + char *errline = NULL; /* Error line */ + char *msgbuf = NULL; /* Message buffer */ + char msgformat[] = "Sablotron error on line %s: %s"; /* Message format */ /* If the error is not serious, exit out */ if (code == MH_LEVEL_WARN || @@ -1599,27 +1488,75 @@ return 0; } - /* Allocate the message buffer and copy the data onto it */ - msgbuf_len = (sizeof(msgformat) - 4) + - strlen(err.message) + - strlen(err.line); - msgbuf = emalloc(msgbuf_len + 1); + /* Loop through and extract the error message and the + error line */ + if (fields) { + while (fields && *fields) { + char *key; /* Key to for the message */ + char *val; /* The message itself */ + char *ptr; /* Pointer to the location of the ':' (separator) */ + int pos; /* Position of the ':' (separator) */ + int len; /* Length of the string */ + + len = strlen(*fields); + + /* Grab the separator's position */ + ptr = strchr(*fields, ':'); + if (!ptr) { + continue; + } + pos = ptr - *fields; + + /* Allocate the key and value and copy the data onto them */ + key = emalloc(pos + 1); + val = emalloc((len - pos) + 1); + + strlcpy(key, *fields, pos + 1); + strlcpy(val, *fields + pos + 1, len - pos); + + /* Check to see whether or not we want to save the data */ + if (!strcmp(key, "msg")) { + errmsg = estrndup(val, len - pos); + } + else if (!strcmp(key, "line")) { + errline = estrndup(val, len - pos); + } + + /* Cleanup */ + if (key) efree(key); + if (val) efree(val); + + /* Next key:value pair please :) */ + fields++; + } + } + + if (!errline) { + errline = estrndup("none", sizeof("none") - 1); + } - snprintf(msgbuf, msgbuf_len, msgformat, err.line, err.message); + if (!errmsg) { + errmsg = estrndup("unkown error", sizeof("unkown error") - 1); + } + + /* Allocate the message buffer and copy the data onto it */ + msgbuf = emalloc((sizeof(msgformat) - 4) + strlen(errmsg) + strlen(errline) + 1); + sprintf(msgbuf, msgformat, errline, errmsg); /* Copy the error message onto the handle for use when the xslt_error function is called */ - XSLT_ERRSTR(handle) = estrndup(msgbuf, msgbuf_len); + XSLT_ERRSTR(handle) = estrdup(errmsg); /* Output a warning */ php_error(E_WARNING, msgbuf); /* Cleanup */ efree(msgbuf); - _free_error_field_struct(&err); + efree(errmsg); + efree(errline); } - return 0; + return(0); } /* }}} */ @@ -1630,6 +1567,6 @@ * tab-width: 4 * c-basic-offset: 4 * End: - * vim600: fdm=marker - * vim: noet sw=4 ts=4 + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 */ No revision No revision 1.2.2.1 +1 -3 php4/ext/xslt/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/xslt/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:08 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +3 -1 php4/ext/yaz/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/yaz/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:31:08 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.7 2002/03/12 16:38:47 sas Exp $ +dnl $Id: config.m4,v 1.8 2002/06/02 21:58:34 dickmeiss Exp $ dnl PHP_ARG_WITH(yaz,for YAZ support, @@ -37,5 +37,7 @@ PHP_EVAL_INCLINE($YAZINC) PHP_SUBST(YAZ_SHARED_LIBADD) PHP_NEW_EXTENSION(yaz, php_yaz.c, $ext_shared) + else + AC_MSG_ERROR([YAZ not found (missing $yazconfig)]) fi fi 1.2.2.1 +424 -27 php4/ext/yaz/php_yaz.c Index: php_yaz.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/yaz/php_yaz.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_yaz.c 29 Apr 2002 02:31:08 -0000 1.2 +++ php_yaz.c 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_yaz.c,v 1.43 2002/04/19 20:15:39 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.44 2002/06/02 21:59:54 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -25,6 +25,7 @@ #include "php.h" #if HAVE_YAZ + #include "ext/standard/info.h" #include "php_yaz.h" @@ -32,23 +33,44 @@ #include <yaz/tcpip.h> #include <yaz/pquery.h> -#ifndef YAZ_DATE +#ifdef YAZ_VERSIONL + +#if YAZ_VERSIONL >= 0x010808 +#define USE_ZOOM 1 +#endif + +#else + +#ifdef YAZ_DATE +#define USE_ZOOM 0 +#endif + +#endif + +#ifndef USE_ZOOM #error YAZ version 1.8 or later must be used. #endif -#include <yaz/sortspec.h> #include <yaz/diagbib1.h> #include <yaz/otherinfo.h> #include <yaz/marcdisp.h> #include <yaz/yaz-util.h> #include <yaz/yaz-version.h> #include <yaz/yaz-ccl.h> +#if USE_ZOOM +#include <yaz/zoom.h> +#else +#include <yaz/sortspec.h> #include <yaz/ill.h> +#endif #define MAX_ASSOC 100 -typedef struct Yaz_ResultSetInfo *Yaz_ResultSet; typedef struct Yaz_AssociationInfo *Yaz_Association; + +#if USE_ZOOM +#else +typedef struct Yaz_ResultSetInfo *Yaz_ResultSet; typedef struct Yaz_RecordCacheInfo *Yaz_RecordCache; struct Yaz_RecordCacheInfo { @@ -79,7 +101,16 @@ #define PHP_YAZ_ERROR_INIT (-5) #define PHP_YAZ_ERROR_TIMEOUT (-6) +#endif + struct Yaz_AssociationInfo { + CCL_parser ccl_parser; +#if USE_ZOOM + ZOOM_connection zoom_conn; + ZOOM_resultset zoom_set; + ZOOM_scanset zoom_scan; + ZOOM_package zoom_package; +#else char *host_port; int num_databaseNames; char **databaseNames; @@ -87,6 +118,7 @@ COMSTACK cs; char *cookie_in; char *cookie_out; + char *client_IP; char *user; char *group; char *pass; @@ -95,13 +127,9 @@ int error; char *addinfo; Yaz_ResultSet resultSets; - int persistent; - int in_use; - int order; int state; int mask_select; int reconnect_flag; - char *sort_criteria; ODR odr_in; ODR odr_out; ODR odr_scan; @@ -119,14 +147,24 @@ char *preferredRecordSyntax; char *schema; - CCL_parser ccl_parser; char *ill_buf_out; int ill_len_out; +#endif + char *sort_criteria; + int persistent; + int in_use; + int order; }; static Yaz_Association yaz_association_mk () { Yaz_Association p = xmalloc (sizeof(*p)); +#if USE_ZOOM + p->zoom_conn = ZOOM_connection_create (0); + p->zoom_set = 0; + p->zoom_scan = 0; + p->zoom_package = 0; +#else p->host_port = 0; p->num_databaseNames = 0; p->databaseNames = 0; @@ -134,6 +172,7 @@ p->cs = 0; p->cookie_in = 0; p->cookie_out = 0; + p->client_IP = 0; p->user = 0; p->group = 0; p->pass = 0; @@ -141,8 +180,6 @@ p->error = 0; p->addinfo = 0; p->resultSets = 0; - p->in_use = 0; - p->order = 0; p->state = PHP_YAZ_STATE_CLOSED; p->mask_select = 0; p->reconnect_flag = 0; @@ -164,9 +201,13 @@ p->elementSetName = 0; p->preferredRecordSyntax = 0; p->schema = 0; +#endif + p->sort_criteria = 0; + p->in_use = 0; + p->order = 0; + p->persistent = 0; p->ccl_parser = ccl_parser_create(); p->ccl_parser->bibset = 0; - p->sort_criteria = 0; return p; } @@ -175,6 +216,12 @@ int i; if (!p) return ; +#if USE_ZOOM + ZOOM_resultset_destroy (p->zoom_set); + ZOOM_scanset_destroy (p->zoom_scan); + ZOOM_package_destroy (p->zoom_package); + ZOOM_connection_destroy (p->zoom_conn); +#else xfree (p->host_port); xfree (p->local_databases); for (i = 0; i<p->num_databaseNames; i++) @@ -184,7 +231,7 @@ cs_close (p->cs); xfree (p->cookie_in); xfree (p->cookie_out); - xfree (p->sort_criteria); + xfree (p->client_IP); xfree (p->user); xfree (p->group); xfree (p->pass); @@ -201,10 +248,14 @@ xfree (p->elementSetName); xfree (p->preferredRecordSyntax); xfree (p->schema); +#endif + xfree (p->sort_criteria); ccl_qual_rm(&p->ccl_parser->bibset); ccl_parser_destroy(p->ccl_parser); } +#if USE_ZOOM +#else static Yaz_ResultSet yaz_resultset_mk() { ODR odr = odr_createmem (ODR_ENCODE); @@ -227,6 +278,7 @@ if (p->odr) odr_destroy (p->odr); } +#endif #ifdef ZTS static MUTEX_T yaz_mutex; @@ -258,9 +310,9 @@ PHP_FE(yaz_element, NULL) PHP_FE(yaz_range, NULL) PHP_FE(yaz_itemorder, NULL) + PHP_FE(yaz_es_result, NULL) PHP_FE(yaz_scan, NULL) PHP_FE(yaz_scan_result, second_argument_force_ref) - PHP_FE(yaz_es_result, NULL) PHP_FE(yaz_present, NULL) PHP_FE(yaz_ccl_conf, NULL) PHP_FE(yaz_ccl_parse, third_argument_force_ref) @@ -302,6 +354,9 @@ tsrm_mutex_unlock(yaz_mutex); #endif } + +#if USE_ZOOM +#else static void do_close (Yaz_Association p) { p->mask_select = 0; @@ -361,6 +416,7 @@ t->addinfo = xstrdup (addinfo); t->error = *r->condition; } +#endif static const char *array_lookup_string(HashTable *ht, const char *idx) { @@ -408,6 +464,41 @@ static int send_sort_present (Yaz_Association t); static int send_sort (Yaz_Association t); +#if USE_ZOOM +const char *option_get (Yaz_Association as, const char *name) +{ + if (!as) + return 0; + return ZOOM_connection_option_get (as->zoom_conn, name); +} + +int option_get_int (Yaz_Association as, const char *name, int def) +{ + const char *v; + v = ZOOM_connection_option_get (as->zoom_conn, name); + if (!v) + return def; + return atoi(v); +} + +void option_set (Yaz_Association as, const char *name, const char *value) +{ + if (as && value) + ZOOM_connection_option_set (as->zoom_conn, name, value); +} + +void option_set_int (Yaz_Association as, const char *name, int v) +{ + if (as) + { + char s[30]; + + sprintf (s, "%d", v); + ZOOM_connection_option_set (as->zoom_conn, name, s); + } +} +#else + static void handle_records (Yaz_Association t, Z_Records *sr, int present_phase) { @@ -672,6 +763,12 @@ if (a == 0) abort(); sprintf (str, "send_APDU t=%p type=%d", t, a->which); + if (t->client_IP) + { + Z_OtherInformation **oi; + yaz_oi_APDU(a, &oi); + yaz_oi_set_string_oidval(oi, out, VAL_CLIENT_IP, 1, t->client_IP); + } if (t->cookie_out) { Z_OtherInformation **oi; @@ -765,7 +862,7 @@ Z_SearchRequest *sreq = apdu->u.searchRequest; /* resultSetPrepare (req, t, req->cur_pa); */ - if (t->resultSetStartPoint == 1 && t->piggyback && + if (t->resultSetStartPoint == 1 && t->piggyback && t->numberOfRecordsRequested && (t->schema == 0 || *t->schema == 0) && (t->sort_criteria == 0 || *t->sort_criteria == 0) ) @@ -1053,7 +1150,7 @@ fd =cs_fileno(p->cs); if (no <= 0) { - if (p->mask_select) /* only mark for those still pending */ + if (p->mask_select) /* only mark for those still pending */ { p->error = PHP_YAZ_ERROR_TIMEOUT; do_close (p); @@ -1090,6 +1187,9 @@ return no; } +/* USE_ZOOM */ +#endif + static int strcmp_null(const char *s1, const char *s2) { if (s1 == 0 && s2 == 0) @@ -1108,6 +1208,7 @@ char *zurl_str; const char *user_str = 0, *group_str = 0, *pass_str = 0; const char *cookie_str = 0, *proxy_str = 0; + const char *client_IP = 0; int persistent = 1; int piggyback = 1; pval **zurl, **user = 0; @@ -1140,6 +1241,7 @@ piggyback_val = array_lookup_bool(ht, "piggyback"); if (piggyback_val) piggyback = *piggyback_val; + client_IP = array_lookup_string(ht, "clientIP"); } else { @@ -1165,6 +1267,19 @@ for (i = 0; i<MAX_ASSOC; i++) { as = shared_associations[i]; +#if USE_ZOOM + if (persistent && as && !as->in_use && + !strcmp_null(option_get(as, "host"), zurl_str) && + !strcmp_null(option_get(as, "user"), user_str) && + !strcmp_null(option_get(as, "group"), group_str) && + !strcmp_null(option_get(as, "pass"), pass_str) && + !strcmp_null(option_get(as, "cookie"), cookie_str)) + { + option_set (as, "clientIP", client_IP); + ZOOM_connection_connect (as->zoom_conn, zurl_str, 0); + break; + } +#else if (persistent && as && !as->in_use && !strcmp_null (as->host_port, zurl_str) && !strcmp_null (as->user, user_str) && @@ -1173,6 +1288,7 @@ !strcmp_null (as->proxy, proxy_str) && !strcmp_null (as->cookie_out, cookie_str)) break; +#endif } if (i == MAX_ASSOC) { @@ -1203,6 +1319,14 @@ yaz_association_destroy(shared_associations[i]); } shared_associations[i] = as = yaz_association_mk (); +#if USE_ZOOM + option_set (as, "user", user_str); + option_set (as, "group", group_str); + option_set (as, "pass", pass_str); + option_set (as, "cookie", cookie_str); + option_set (as, "clientIP", client_IP); + ZOOM_connection_connect (as->zoom_conn, zurl_str, 0); +#else as->host_port = xstrdup (zurl_str); if (cookie_str) as->cookie_out = xstrdup (cookie_str); @@ -1214,19 +1338,31 @@ as->pass = xstrdup (pass_str); if (proxy_str) as->proxy = xstrdup (proxy_str); +#endif } - as->action = 0; as->in_use = 1; as->persistent = persistent; as->order = YAZSG(assoc_seq); +#if USE_ZOOM +#else + as->action = 0; as->error = 0; xfree (as->sort_criteria); as->sort_criteria = 0; + as->piggyback = piggyback; as->numberOfRecordsRequested = 10; as->resultSetStartPoint = 1; + xfree (as->local_databases); as->local_databases = 0; + + xfree (as->client_IP); + as->client_IP = 0; + if (client_IP) + as->client_IP = xstrdup (client_IP); +#endif + #ifdef ZTS tsrm_mutex_unlock (yaz_mutex); #endif @@ -1260,7 +1396,10 @@ char *query_str, *type_str; pval **id, **type, **query; Yaz_Association p; +#if USE_ZOOM +#else Yaz_ResultSet r; +#endif if (ZEND_NUM_ARGS() == 3) { if (zend_get_parameters_ex(3, &id, &type, &query) == FAILURE) @@ -1277,11 +1416,29 @@ { RETURN_FALSE; } - p->action = 0; convert_to_string_ex (type); type_str = (*type)->value.str.val; convert_to_string_ex (query); query_str = (*query)->value.str.val; +#if USE_ZOOM + ZOOM_resultset_destroy (p->zoom_set); + p->zoom_set = 0; + if (!strcmp (type_str, "rpn")) + { + ZOOM_query q = ZOOM_query_create (); + ZOOM_query_prefix (q, query_str); + if (p->sort_criteria) + ZOOM_query_sortby (q, p->sort_criteria); + p->zoom_set = ZOOM_connection_search (p->zoom_conn, q); + ZOOM_query_destroy (q); + RETVAL_TRUE; + } + else + { + RETVAL_FALSE; + } +#else + p->action = 0; yaz_resultset_destroy (p->resultSets); r = p->resultSets = yaz_resultset_mk(); r->query = odr_malloc (r->odr, sizeof(*r->query)); @@ -1315,6 +1472,7 @@ } if (p->resultSets) p->action = send_search; +#endif release_assoc (p); } /* }}} */ @@ -1336,12 +1494,22 @@ { RETURN_FALSE; } +#if USE_ZOOM + if (p->zoom_set) + { + size_t start = option_get_int (p, "start", 0); + size_t count = option_get_int (p, "count", 0); + if (count > 0) + ZOOM_resultset_records (p->zoom_set, 0 /* recs */, start, count); + } +#else p->action = 0; if (p->resultSets) { p->resultSets->recordList = 0; p->action = send_sort_present; } +#endif release_assoc (p); RETURN_TRUE; } @@ -1351,6 +1519,10 @@ Process events. */ PHP_FUNCTION(yaz_wait) { +#if USE_ZOOM + int no = 0; + ZOOM_connection conn_ar[MAX_ASSOC]; +#endif int i, id, timeout = 15; YAZSLS_FETCH(); @@ -1378,6 +1550,11 @@ #endif for (i = 0; i<MAX_ASSOC; i++) { +#if USE_ZOOM + Yaz_Association p = shared_associations[i]; + if (p && p->order == YAZSG(assoc_seq)) + conn_ar[no++] = p->zoom_conn; +#else Yaz_Association p = shared_associations[i]; if (!p || p->order != YAZSG(assoc_seq) || !p->action || p->mask_select) @@ -1391,12 +1568,19 @@ p->reconnect_flag = 1; (*p->action)(p); } +#endif } #ifdef ZTS tsrm_mutex_unlock (yaz_mutex); #endif +#if USE_ZOOM + if (no) + while (ZOOM_event (no, conn_ar)) + ; +#else while (do_event(&id, timeout)) ; +#endif RETURN_TRUE; } /* }}} */ @@ -1416,7 +1600,11 @@ { RETURN_LONG(0); } +#if USE_ZOOM + RETVAL_LONG(ZOOM_connection_errcode (p->zoom_conn)); +#else RETVAL_LONG(p->error); +#endif release_assoc (p); } /* }}} */ @@ -1432,6 +1620,19 @@ WRONG_PARAM_COUNT; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p); +#if USE_ZOOM + if (p) + { + int code = ZOOM_connection_errcode (p->zoom_conn); + const char *msg = ZOOM_connection_errmsg (p->zoom_conn); + if (!code) + msg = ""; + return_value->value.str.len = strlen(msg); + return_value->value.str.val = + estrndup(msg, return_value->value.str.len); + return_value->type = IS_STRING; + } +#else if (p && p->error) { const char *msg = 0; @@ -1474,6 +1675,7 @@ estrndup(msg, return_value->value.str.len); return_value->type = IS_STRING; } +#endif release_assoc (p); } /* }}} */ @@ -1489,10 +1691,21 @@ WRONG_PARAM_COUNT; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p); +#if USE_ZOOM + if (p) + { + const char *addinfo = ZOOM_connection_addinfo (p->zoom_conn); + return_value->value.str.len = strlen(addinfo); + return_value->value.str.val = + estrndup(addinfo, return_value->value.str.len); + return_value->type = IS_STRING; + } +#else if (p && p->error > 0 && p->addinfo && *p->addinfo) { RETVAL_STRING(p->addinfo, 1); } +#endif release_assoc (p); } /* }}} */ @@ -1508,6 +1721,16 @@ WRONG_PARAM_COUNT; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p); +#if USE_ZOOM + if (p && p->zoom_set) + { + RETVAL_LONG(ZOOM_resultset_size (p->zoom_set)); + } + else + { + RETVAL_LONG(0); + } +#else if (!p || !p->resultSets) { RETVAL_LONG(0); @@ -1516,11 +1739,12 @@ { RETVAL_LONG(p->resultSets->resultCount); } +#endif release_assoc (p); } /* }}} */ -static Z_GenericRecord *marc_to_grs1(const char *buf, ODR o, Odr_oid *oid) +static Z_GenericRecord *marc_to_grs1(const char *buf, ODR o) { int entry_p; int record_length; @@ -1805,7 +2029,61 @@ convert_to_string_ex(pval_type); type = (*pval_type)->value.str.val; +#if USE_ZOOM + if (p && p->zoom_set) + { + ZOOM_record r = ZOOM_resultset_record (p->zoom_set, pos-1); + if (!strcmp(type, "string")) + type = "render"; + if (r) + { + if (!strcmp (type, "syntax") || + !strcmp (type, "database") || + !strcmp (type, "render") || + !strcmp (type, "xml")) + { + const char *info = ZOOM_record_get (r, type, 0); + return_value->value.str.len = strlen(info); + return_value->value.str.val = + estrndup(info, return_value->value.str.len); + return_value->type = IS_STRING; + } + else if (!strcmp (type, "array")) + { + Z_External *ext = (Z_External *) ZOOM_record_get (r, "raw", 0); + oident *ent = oid_getentbyoid(ext->direct_reference); + + if (ext->which == Z_External_grs1 && ent->value == VAL_GRS1) + { + retval_grs1 (return_value, ext->u.grs1); + } + else if (ext->which == Z_External_octet) + { + char *buf = (char *) (ext->u.octet_aligned->buf); + ODR odr = odr_createmem (ODR_DECODE); + Z_GenericRecord *rec = 0; + + switch (ent->value) + { + case VAL_SOIF: + case VAL_HTML: + break; + case VAL_TEXT_XML: + case VAL_APPLICATION_XML: + /* text2grs1 (&buf, &len, t->odr_in, 0, 0); */ + break; + default: + rec = marc_to_grs1 (buf, odr); + } + if (rec) + retval_grs1 (return_value, rec); + odr_destroy (odr); + } + } + } + } +#else if (p && p->resultSets && p->resultSets->recordList && pos >= p->resultSetStartPoint && pos < p->resultSetStartPoint + p->resultSets->recordList->num_records) @@ -1875,7 +2153,7 @@ /* text2grs1 (&buf, &len, t->odr_in, 0, 0); */ break; default: - rec = marc_to_grs1 (buf, odr, r->direct_reference); + rec = marc_to_grs1 (buf, odr); } if (rec) retval_grs1 (return_value, rec); @@ -1884,6 +2162,7 @@ } } } +#endif release_assoc (p); } /* }}} */ @@ -1901,12 +2180,16 @@ WRONG_PARAM_COUNT; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); + convert_to_string_ex (pval_syntax); +#if USE_ZOOM + option_set (p, "preferredRecordSyntax", (*pval_syntax)->value.str.val); +#else if (p) { - convert_to_string_ex (pval_syntax); xfree (p->preferredRecordSyntax); p->preferredRecordSyntax = xstrdup ((*pval_syntax)->value.str.val); } +#endif release_assoc (p); } /* }}} */ @@ -1923,12 +2206,16 @@ WRONG_PARAM_COUNT; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); + convert_to_string_ex (pval_element); +#if USE_ZOOM + option_set (p, "elementSetName", (*pval_element)->value.str.val); +#else if (p) { - convert_to_string_ex (pval_element); xfree (p->elementSetName); p->elementSetName = xstrdup ((*pval_element)->value.str.val); } +#endif release_assoc (p); } /* }}} */ @@ -1945,12 +2232,16 @@ WRONG_PARAM_COUNT; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); + convert_to_string_ex (pval_element); +#if USE_ZOOM + option_set (p, "schema", (*pval_element)->value.str.val); +#else if (p) { - convert_to_string_ex (pval_element); xfree (p->schema); p->schema = xstrdup ((*pval_element)->value.str.val); } +#endif release_assoc (p); } /* }}} */ @@ -1969,15 +2260,20 @@ WRONG_PARAM_COUNT; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); + convert_to_long_ex (pval_start); + convert_to_long_ex (pval_number); +#if USE_ZOOM + option_set_int (p, "start", (*pval_start)->value.lval - 1); + option_set_int (p, "count", (*pval_number)->value.lval); +#else if (p) { - convert_to_long_ex (pval_start); p->resultSetStartPoint = (*pval_start)->value.lval; if (p->resultSetStartPoint < 1) p->resultSetStartPoint = 1; - convert_to_long_ex (pval_number); p->numberOfRecordsRequested = (*pval_number)->value.lval; } +#endif release_assoc (p); } /* }}} */ @@ -1999,12 +2295,15 @@ if (p) { convert_to_string_ex (pval_criteria); +#if USE_ZOOM +#else if (p->resultSets && p->resultSets->sorted) { if (!p->sort_criteria || strcmp (p->sort_criteria, (*pval_criteria)->value.str.val)) p->resultSets->sorted = 0; } +#endif xfree (p->sort_criteria); p->sort_criteria = xstrdup ((*pval_criteria)->value.str.val); } @@ -2012,6 +2311,13 @@ } /* }}} */ +#if USE_ZOOM +const char *ill_array_lookup (void *handle, const char *name) +{ + return array_lookup_string((HashTable *) handle, name); +} + +#else static const char *ill_array_lookup (void *clientData, const char *idx) { return array_lookup_string((HashTable *) clientData, idx+4); @@ -2148,7 +2454,7 @@ return apdu; } - +#endif /* {{{ proto int yaz_itemorder(int id, array package) Sends Item Order request */ @@ -2171,6 +2477,16 @@ get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); if (p) { +#if USE_ZOOM + ZOOM_options options = ZOOM_options_create(); + + ZOOM_options_set_callback (options, ill_array_lookup, + Z_ARRVAL_PP(pval_package)); + ZOOM_package_destroy (p->zoom_package); + p->zoom_package = ZOOM_connection_package (p->zoom_conn, options); + ZOOM_package_send(p->zoom_package, "itemorder"); + ZOOM_options_destroy (options); +#else Z_APDU *apdu; p->action = 0; @@ -2188,11 +2504,15 @@ memcpy (p->ill_buf_out, buf, p->ill_len_out); p->action = send_packet; } +#endif } release_assoc (p); } /* }}} */ + +#if USE_ZOOM +#else static Z_APDU *encode_scan (Yaz_Association t, const char *type, const char *query, HashTable *ht) { @@ -2237,6 +2557,7 @@ req->databaseNames = set_DatabaseNames (t, &req->num_databaseNames); return apdu; } +#endif /* {{{ proto int yaz_scan(int id, type, query [, flags]) Sends Scan Request */ @@ -2276,6 +2597,17 @@ convert_to_string_ex (pval_query); get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); +#if USE_ZOOM + ZOOM_scanset_destroy (p->zoom_scan); + p->zoom_scan = 0; + if (p) + { + option_set (p, "number", array_lookup_string (flags_ht, "number")); + option_set (p, "position", array_lookup_string (flags_ht, "position")); + option_set (p, "stepSize", array_lookup_string (flags_ht, "stepsize")); + p->zoom_scan = ZOOM_connection_scan (p->zoom_conn, + Z_STRVAL_PP(pval_query));} +#else if (p) { Z_APDU *apdu; @@ -2295,6 +2627,7 @@ p->action = send_packet; } } +#endif release_assoc (p); } /* }}} */ @@ -2321,6 +2654,16 @@ RETURN_FALSE; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); +#if USE_ZOOM + if (p && p->zoom_package) + { + const char *str = ZOOM_package_option_get(p->zoom_package, + "targetReference"); + if (str) + add_assoc_string (return_value, "targetReference", + (char*)str, 1); + } +#else if (p && p->es_response) { int i; @@ -2337,9 +2680,9 @@ id->buf, id->len, 1); } } +#endif release_assoc (p); } - /* }}} */ /* {{{ proto int yaz_scan_result(int id, array options) @@ -2375,6 +2718,54 @@ RETURN_FALSE; } get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); +#if USE_ZOOM + if (p && p->zoom_scan) + { + int pos = 0; + const char *term; + int occ, len; + int size = ZOOM_scanset_size (p->zoom_scan); + + for (pos = 0; pos < size; pos++) + { + const char *term = + ZOOM_scanset_term(p->zoom_scan, pos, &occ, &len); + zval *my_zval; + ALLOC_ZVAL(my_zval); + array_init(my_zval); + INIT_PZVAL(my_zval); + + add_next_index_string(my_zval, "term", 1); + + if (term) + add_next_index_stringl (my_zval, (char*) term, len, 1); + else + add_next_index_string (my_zval, "?", 1); + add_next_index_long (my_zval, occ); + + zend_hash_next_index_insert ( + return_value->value.ht, (void *) &my_zval, sizeof(zval *), + NULL); + } + if (pval_opt) + { + const char *v; + add_assoc_long(*pval_opt, "number", size); + + v = ZOOM_scanset_option_get (p->zoom_scan, "stepSize"); + if (v) + add_assoc_long(*pval_opt, "stepsize", atoi(v)); + + v = ZOOM_scanset_option_get (p->zoom_scan, "position"); + if (v) + add_assoc_long(*pval_opt, "position", atoi(v)); + + v = ZOOM_scanset_option_get (p->zoom_scan, "scanStatus"); + if (v) + add_assoc_long(*pval_opt, "status", atoi(v)); + } + } +#else if (p && p->scan_response) { int i; @@ -2420,6 +2811,7 @@ } } +#endif release_assoc (p); } /* }}} */ @@ -2546,6 +2938,10 @@ } convert_to_string_ex (pval_database); get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); +#if USE_ZOOM + option_set (p, "databaseName", (*pval_database)->value.str.val); + RETVAL_TRUE; +#else if (p) { xfree (p->local_databases); @@ -2554,6 +2950,7 @@ } else RETVAL_FALSE; +#endif release_assoc (p); } /* }}} */ No revision No revision 1.2.2.1 +11 -2 php4/ext/zip/zip.c Index: zip.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/zip/zip.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- zip.c 29 Apr 2002 02:31:08 -0000 1.2 +++ zip.c 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zip.c,v 1.31 2002/04/14 08:49:57 derick Exp $ */ +/* $Id: zip.c,v 1.32 2002/05/20 18:33:08 mfischer Exp $ */ #include "php.h" #include "php_ini.h" @@ -128,9 +128,18 @@ return; } + if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + RETURN_FALSE; + } + + if (php_check_open_basedir(filename TSRMLS_CC)) { + RETURN_FALSE; + } + archive_p = zzip_opendir(filename); if (archive_p == NULL) { - php_error(E_WARNING, "Cannot open zip archive %s", filename); + php_error(E_WARNING, "%s() Cannot open zip archive %s", + get_active_function_name(TSRMLS_C), filename); RETURN_FALSE; } No revision No revision 1.2.2.1 +1 -3 php4/ext/zip/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/zip/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:08 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.3 +8 -2 php4/ext/zlib/zlib.c Index: zlib.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/zlib/zlib.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- zlib.c 2 May 2002 22:01:53 -0000 1.2.2.2 +++ zlib.c 9 Jul 2002 09:14:42 -0000 1.2.2.3 @@ -18,7 +18,7 @@ | Jade Nicoletti <nicol****@nns*****> | +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.133 2002/05/02 01:11:58 yohgaki Exp $ */ +/* $Id: zlib.c,v 1.136 2002/06/18 10:09:41 derick Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -161,7 +161,7 @@ PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals) + STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals) STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdate_zlib_output_compression_level, output_compression_level, zend_zlib_globals, zlib_globals) PHP_INI_END() @@ -971,10 +971,16 @@ if (sapi_add_header("Content-Encoding: gzip", sizeof("Content-Encoding: gzip") - 1, 1)==FAILURE) { return FAILURE; } + if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) { + return FAILURE; + } ZLIBG(ob_gzip_coding) = CODING_GZIP; } else if(php_memnstr(Z_STRVAL_PP(a_encoding), "deflate", 7, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) { if (sapi_add_header("Content-Encoding: deflate", sizeof("Content-Encoding: deflate") - 1, 1)==FAILURE) { return FAILURE; + } + if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) { + return FAILURE; } ZLIBG(ob_gzip_coding) = CODING_DEFLATE; } else { No revision No revision 1.2.2.1 +1 -3 php4/ext/zlib/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/zlib/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:31:08 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +30 -12 php4/main/SAPI.c Index: SAPI.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/SAPI.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- SAPI.c 29 Apr 2002 02:33:37 -0000 1.2 +++ SAPI.c 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: SAPI.c,v 1.129 2002/01/14 13:36:54 sesser Exp $ */ +/* $Id: SAPI.c,v 1.133 2002/06/21 09:31:21 derick Exp $ */ #include <ctype.h> #include <sys/stat.h> @@ -385,12 +385,17 @@ return code; } +static int sapi_find_matching_header(void *element1, void *element2) +{ + return strncasecmp(((sapi_header_struct*)element1)->header, (char*)element2, strlen((char*)element2)) == 0; +} + /* This function expects a *duplicated* string, that was previously emalloc()'d. * Pointers sent to this functions will be automatically freed by the framework. */ -SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC) +SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace, int http_response_code TSRMLS_DC) { - int retval, free_header = 0; + int retval; sapi_header_struct sapi_header; char *colon_offset; long myuid = 0L; @@ -436,7 +441,7 @@ if (colon_offset) { *colon_offset = 0; if (!STRCASECMP(header_line, "Content-Type")) { - char *ptr = colon_offset, *mimetype = NULL, *newheader; + char *ptr = colon_offset+1, *mimetype = NULL, *newheader; size_t len = header_line_len - (ptr - header_line), newlen; while (*ptr == ' ' && *ptr != '\0') { ptr++; @@ -452,16 +457,16 @@ sapi_header.header_len = newlen - 1; colon_offset = strchr(newheader, ':'); *colon_offset = '\0'; - free_header = 1; + efree(header_line); } efree(mimetype); SG(sapi_headers).send_default_content_type = 0; } else if (!STRCASECMP(header_line, "Location")) { - if (SG(sapi_headers).http_response_code < 300 || - SG(sapi_headers).http_response_code > 307) { - /* Return a Found Redirect if one is not already specified */ + if (SG(sapi_headers).http_response_code < 300 || + SG(sapi_headers).http_response_code > 307) { + /* Return a Found Redirect if one is not already specified */ SG(sapi_headers).http_response_code = 302; - } + } } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */ int newlen; char *result, *newheader; @@ -542,6 +547,9 @@ } } + if (http_response_code) { + SG(sapi_headers).http_response_code = http_response_code; + } if (sapi_module.header_handler) { retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) TSRMLS_CC); } else { @@ -551,10 +559,20 @@ zend_llist_clean(&SG(sapi_headers).headers); } if (retval & SAPI_HEADER_ADD) { + /* in replace mode first remove the header if it already exists in the headers llist */ + if (replace) { + colon_offset = strchr(sapi_header.header, ':'); + if (colon_offset) { + char sav; + colon_offset++; + sav = *colon_offset; + *colon_offset = 0; + zend_llist_del_element(&SG(sapi_headers).headers, sapi_header.header, (int(*)(void*, void*))sapi_find_matching_header); + *colon_offset = sav; + } + } + zend_llist_add_element(&SG(sapi_headers).headers, (void *) &sapi_header); - } - if (free_header) { - efree(sapi_header.header); } return SUCCESS; } 1.2.2.2 +2 -2 php4/main/SAPI.h Index: SAPI.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/SAPI.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- SAPI.h 19 May 2002 11:16:06 -0000 1.2.2.1 +++ SAPI.h 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -133,9 +133,9 @@ SAPI_API void sapi_deactivate(TSRMLS_D); SAPI_API void sapi_initialize_empty_request(TSRMLS_D); -SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC); +SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace, int http_response_code TSRMLS_DC); #define sapi_add_header(header_line, header_line_len, duplicate) \ - sapi_add_header_ex((header_line), (header_line_len), (duplicate), 1 TSRMLS_CC) + sapi_add_header_ex((header_line), (header_line_len), (duplicate), 1, 0 TSRMLS_CC) SAPI_API int sapi_send_headers(TSRMLS_D); SAPI_API void sapi_free_header(sapi_header_struct *sapi_header); SAPI_API void sapi_handle_post(void *arg TSRMLS_DC); 1.2.2.1 +3 -1 php4/main/build-defs.h.in Index: build-defs.h.in =================================================================== RCS file: /cvsroot/php-i18n/php4/main/build-defs.h.in,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- build-defs.h.in 29 Apr 2002 02:33:37 -0000 1.2 +++ build-defs.h.in 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: build-defs.h.in,v 1.9 2002/03/04 09:10:32 imajes Exp $ */ +/* $Id: build-defs.h.in,v 1.10 2002/06/07 12:19:26 ssb Exp $ */ #define CONFIGURE_COMMAND "@CONFIGURE_COMMAND@" #define PHP_ADA_INCLUDE "" @@ -80,9 +80,11 @@ #define PEAR_INSTALLDIR "@EXPANDED_PEAR_INSTALLDIR@" #define PHP_INCLUDE_PATH "@INCLUDE_PATH@" #define PHP_EXTENSION_DIR "@EXPANDED_EXTENSION_DIR@" +#define PHP_PREFIX "@prefix@" #define PHP_BINDIR "@EXPANDED_BINDIR@" #define PHP_LIBDIR "@EXPANDED_LIBDIR@" #define PHP_DATADIR "@EXPANDED_DATADIR@" #define PHP_SYSCONFDIR "@EXPANDED_SYSCONFDIR@" #define PHP_LOCALSTATEDIR "@EXPANDED_LOCALSTATEDIR@" #define PHP_CONFIG_FILE_PATH "@EXPANDED_PHP_CONFIG_FILE_PATH@" +#define PHP_SHLIB_SUFFIX "@SHLIB_SUFFIX_NAME@" 1.1.2.3 +5 -1 php4/main/config.w32.h.in Index: config.w32.h.in =================================================================== RCS file: /cvsroot/php-i18n/php4/main/config.w32.h.in,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- config.w32.h.in 19 May 2002 11:16:06 -0000 1.1.2.2 +++ config.w32.h.in 9 Jul 2002 09:14:42 -0000 1.1.2.3 @@ -2,12 +2,13 @@ Build Configuration for Win32. This has only been tested with MS VisualC++ 6 (and later). - $Id: config.w32.h.in,v 1.2 2002/05/10 04:58:05 edink Exp $ + $Id: config.w32.h.in,v 1.9 2002/06/21 13:11:47 edink Exp $ */ /* Default PHP / PEAR directories */ #define CONFIGURATION_FILE_PATH "php.ini" #define PHP_BINDIR "c:\\php4" +#define PHP_PREFIX "c:\\php4" #define PHP_CONFIG_FILE_PATH (getenv("SystemRoot"))?getenv("SystemRoot"):"" #define PHP_DATADIR "c:\\php4" #define PHP_EXTENSION_DIR "c:\\php4" @@ -45,6 +46,7 @@ #define HAVE_MBSTR_CN 1 #define HAVE_MBSTR_JA 1 #define HAVE_MBSTR_KR 1 +#define HAVE_MBSTR_RU 1 #define HAVE_MBSTR_TW 1 /* Enable / Disable MySQL extension (default: enabled) */ @@ -160,3 +162,5 @@ #undef HAVE_RINT #define HAVE_STRFTIME 1 #define SIZEOF_INT 4 +#define HAVE_GLOB +#define PHP_SHLIB_SUFFIX "dll" 1.2.2.1 +3 -1 php4/main/fopen_wrappers.h Index: fopen_wrappers.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/fopen_wrappers.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- fopen_wrappers.h 29 Apr 2002 02:33:37 -0000 1.2 +++ fopen_wrappers.h 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -15,11 +15,12 @@ | Author: Jim Winstead <jimw****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: fopen_wrappers.h,v 1.36 2002/03/17 14:21:00 wez Exp $ */ +/* $Id: fopen_wrappers.h,v 1.37 2002/05/20 01:32:48 wez Exp $ */ #ifndef FOPEN_WRAPPERS_H #define FOPEN_WRAPPERS_H +BEGIN_EXTERN_C() #include "php_globals.h" PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC); @@ -34,6 +35,7 @@ PHPAPI int php_is_url(char *path); PHPAPI char *php_strip_url_passwd(char *path); +END_EXTERN_C() #endif /* 1.2.2.5 +25 -10 php4/main/main.c Index: main.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/main.c,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -u -r1.2.2.4 -r1.2.2.5 --- main.c 19 May 2002 11:16:06 -0000 1.2.2.4 +++ main.c 9 Jul 2002 09:14:42 -0000 1.2.2.5 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.456 2002/05/13 08:46:24 zeev Exp $ */ +/* $Id: main.c,v 1.463 2002/07/01 09:00:00 sniper Exp $ */ /* {{{ includes */ @@ -242,6 +242,7 @@ STD_PHP_INI_ENTRY("log_errors_max_len", "1024", PHP_INI_ALL, OnUpdateInt, log_errors_max_len, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("ignore_repeated_errors", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("ignore_repeated_source", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_source, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_SYSTEM, OnUpdateBool, report_memleaks, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateBool, magic_quotes_gpc, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_runtime, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_sybase, php_core_globals, core_globals) @@ -278,7 +279,7 @@ STD_PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, open_basedir, php_core_globals, core_globals) STD_PHP_INI_ENTRY("safe_mode_exec_dir", "1", PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals) STD_PHP_INI_ENTRY("upload_max_filesize", "2M", PHP_INI_SYSTEM, OnUpdateInt, upload_max_filesize, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("file_uploads", "1", PHP_INI_ALL, OnUpdateBool, file_uploads, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("file_uploads", "1", PHP_INI_ALL, OnUpdateBool, file_uploads, php_core_globals, core_globals) STD_PHP_INI_ENTRY("post_max_size", "8M", PHP_INI_SYSTEM, OnUpdateInt, post_max_size, sapi_globals_struct,sapi_globals) STD_PHP_INI_ENTRY("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, upload_tmp_dir, php_core_globals, core_globals) STD_PHP_INI_ENTRY("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, user_dir, php_core_globals, core_globals) @@ -288,6 +289,7 @@ STD_PHP_INI_ENTRY("error_prepend_string", NULL, PHP_INI_ALL, OnUpdateStringUnempty, error_prepend_string, php_core_globals, core_globals) PHP_INI_ENTRY("SMTP", "localhost",PHP_INI_ALL, NULL) + PHP_INI_ENTRY("smtp_port", "25", PHP_INI_ALL, NULL) PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL) PHP_INI_ENTRY("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting) #if MEMORY_LIMIT @@ -298,8 +300,8 @@ PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL) PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, NULL) - STD_PHP_INI_ENTRY("allow_url_fopen", "1", PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals) PHP_INI_END() /* }}} */ @@ -361,16 +363,19 @@ { va_list args; int ret; - char buffer[PRINTF_BUFFER_SIZE]; + char *buffer; int size; TSRMLS_FETCH(); va_start(args, format); - size = vsnprintf(buffer, sizeof(buffer), format, args); - if(size > sizeof(buffer) - 1) { - size = sizeof(buffer) - 1; + size = vspprintf(&buffer, 0, format, args); + if (buffer) { + ret = PHPWRITE(buffer, size); + efree(buffer); + } else { + php_error(E_ERROR, "Out of memory"); + ret = 0; } - ret = PHPWRITE(buffer, size); va_end(args); return ret; @@ -605,7 +610,7 @@ case ZMSG_MEMORY_LEAK_REPEATED: { TSRMLS_FETCH(); - if (EG(error_reporting)&E_WARNING) { + if ((EG(error_reporting)&E_WARNING) && PG(report_memleaks)) { #if ZEND_DEBUG char memory_leak_buf[512]; @@ -959,12 +964,14 @@ REGISTER_MAIN_STRINGL_CONSTANT("PEAR_INSTALL_DIR", PEAR_INSTALLDIR, sizeof(PEAR_INSTALLDIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PEAR_EXTENSION_DIR", PHP_EXTENSION_DIR, sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_EXTENSION_DIR", PHP_EXTENSION_DIR, sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_STRINGL_CONSTANT("PHP_PREFIX", PHP_PREFIX, sizeof(PHP_PREFIX)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINDIR", PHP_BINDIR, sizeof(PHP_BINDIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_LIBDIR", PHP_LIBDIR, sizeof(PHP_LIBDIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_DATADIR", PHP_DATADIR, sizeof(PHP_DATADIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_SYSCONFDIR", PHP_SYSCONFDIR, sizeof(PHP_SYSCONFDIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_LOCALSTATEDIR", PHP_LOCALSTATEDIR, sizeof(PHP_LOCALSTATEDIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, sizeof(PHP_CONFIG_FILE_PATH)-1, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS); php_output_register_constants(TSRMLS_C); if (php_startup_ticks(TSRMLS_C) == FAILURE) { @@ -1347,6 +1354,14 @@ && primary_file->filename) { VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1); VCWD_CHDIR_FILE(primary_file->filename); + } + + if(primary_file->filename) { + char realfile[MAXPATHLEN]; + int dummy = 1; + if(VCWD_REALPATH(primary_file->filename, realfile)) { + zend_hash_add(&EG(included_files), realfile, strlen(realfile)+1, (void *)&dummy, sizeof(int), NULL); + } } if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) { 1.2.2.1 +1 -1 php4/main/memory_streams.c Index: memory_streams.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/memory_streams.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- memory_streams.c 29 Apr 2002 02:33:37 -0000 1.2 +++ memory_streams.c 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -475,7 +475,7 @@ self->mode = mode; stream = php_stream_alloc(&php_stream_temp_ops, self, 0, "rwb"); self->innerstream = php_stream_memory_create(mode); -// php_stream_temp_write(stream, NULL, 0 TSRMLS_CC); +/* php_stream_temp_write(stream, NULL, 0 TSRMLS_CC); */ return stream; } /* }}} */ 1.2.2.2 +79 -2 php4/main/network.c Index: network.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/network.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- network.c 30 Apr 2002 08:13:17 -0000 1.2.2.1 +++ network.c 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -15,7 +15,7 @@ | Author: Stig Venaas <venaa****@unine*****> | +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.50 2002/04/30 00:20:34 wez Exp $ */ +/* $Id: network.c,v 1.51 2002/06/11 03:55:28 jason Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ #define MAX_CHUNKS_PER_READ 10 @@ -289,11 +289,78 @@ } return ret; #else /* !defined(PHP_WIN32) && ... */ +#ifdef PHP_WIN32 + return php_connect_nonb_win32((SOCKET) sockfd, addr, addrlen, timeout); +#endif return connect(sockfd, addr, addrlen); #endif } /* }}} */ +#ifdef PHP_WIN32 +/* {{{ php_connect_nonb_win32 */ +PHPAPI int php_connect_nonb_win32(SOCKET sockfd, + const struct sockaddr *addr, + socklen_t addrlen, + struct timeval *timeout) +{ + int error = 0, error_len, ret; + u_long non_block = TRUE, block = FALSE; + + fd_set rset, wset; + + if (timeout == NULL) { + /* blocking mode */ + return connect(sockfd, addr, addrlen); + } + + /* Set the socket to be non-blocking */ + ioctlsocket(sockfd, FIONBIO, &non_block); + + if (connect(sockfd, addr, addrlen) == SOCKET_ERROR) { + if (WSAGetLastError() != WSAEWOULDBLOCK) { + return SOCKET_ERROR; + } + } + + FD_ZERO(&rset); + FD_SET(sockfd, &rset); + + FD_ZERO(&wset); + FD_SET(sockfd, &wset); + + if ((ret = select(sockfd + 1, &rset, &wset, NULL, timeout)) == 0) { + WSASetLastError(WSAETIMEDOUT); + return SOCKET_ERROR; + } + + if (ret == SOCKET_ERROR) { + return SOCKET_ERROR; + } + + if(FD_ISSET(sockfd, &rset) || FD_ISSET(sockfd, &wset)) { + error_len = sizeof(error); + if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char *) &error, &error_len) == SOCKET_ERROR) { + return SOCKET_ERROR; + } + } else { + /* whoops: sockfd has disappeared */ + return SOCKET_ERROR; + } + + /* Set the socket back to blocking */ + ioctlsocket(sockfd, FIONBIO, &block); + + if (error) { + WSASetLastError(error); + return SOCKET_ERROR; + } + + return 0; +} +/* }}} */ +#endif + /* {{{ php_hostconnect * Creates a socket of type socktype and connects to the given host and * port, returns the created socket on success, else returns -1. @@ -301,7 +368,7 @@ */ int php_hostconnect(const char *host, unsigned short port, int socktype, int timeout) { - int n, repeatto, s; + int n, repeatto, s, err; struct sockaddr **sal, **psal; struct timeval timeoutval; @@ -351,6 +418,10 @@ } break; } +#ifdef PHP_WIN32 + /* Preserve the last error */ + err = WSAGetLastError(); +#endif close (s); } sal++; @@ -361,6 +432,12 @@ } php_network_freeaddresses(psal); php_error(E_WARNING, "php_hostconnect: connect failed"); + +#ifdef PHP_WIN32 + /* Restore the last error */ + WSASetLastError(err); +#endif + return -1; ok: 1.2.2.2 +10 -1 php4/main/php.h Index: php.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php.h 9 May 2002 04:17:00 -0000 1.2.2.1 +++ php.h 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.170 2002/05/07 22:00:33 sas Exp $ */ +/* $Id: php.h,v 1.171 2002/05/31 04:49:45 rvenkat Exp $ */ #ifndef PHP_H #define PHP_H @@ -61,6 +61,12 @@ #define PHP_DIR_SEPARATOR '/' #endif +#ifdef NETWARE +#define PHP_UNAME "NetWare" /* For php_get_uname() function */ +#define PHP_OS PHP_UNAME /* This is obtained using 'uname' on Unix and assigned in the case of Windows; + we'll do it this way atleast for now */ +#endif + #include "php_regex.h" #if HAVE_ASSERT_H @@ -179,6 +185,9 @@ # ifdef PHP_WIN32 #include "win32/pwd.h" #include "win32/param.h" +#elif defined(NETWARE) +#include <sys/param.h> +#include "NetWare/pwd.h" # else #include <pwd.h> #include <sys/param.h> 1.2.2.1 +2 -0 php4/main/php_compat.h Index: php_compat.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_compat.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_compat.h 29 Apr 2002 02:33:38 -0000 1.2 +++ php_compat.h 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -3,6 +3,8 @@ #ifdef PHP_WIN32 #include "config.w32.h" +#elif defined(NETWARE) +#include "config.nw.h" #else #include "php_config.h" #endif 1.2.2.1 +1 -0 php4/main/php_globals.h Index: php_globals.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_globals.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_globals.h 29 Apr 2002 02:33:38 -0000 1.2 +++ php_globals.h 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -79,6 +79,7 @@ int log_errors_max_len; zend_bool ignore_repeated_errors; zend_bool ignore_repeated_source; + zend_bool report_memleaks; char *error_log; char *doc_root; 1.2.2.2 +10 -7 php4/main/php_ini.c Index: php_ini.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_ini.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_ini.c 19 May 2002 11:16:06 -0000 1.2.2.1 +++ php_ini.c 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ini.c,v 1.94 2002/05/12 14:48:20 sas Exp $ */ +/* $Id: php_ini.c,v 1.95 2002/05/19 14:45:31 sander Exp $ */ /* Check CWD for php.ini */ #define INI_CHECK_CWD @@ -306,12 +306,15 @@ if (!VCWD_STAT(sapi_module.php_ini_path_override, &statbuf)) { if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { fh.handle.fp = VCWD_FOPEN(sapi_module.php_ini_path_override, "r"); + fh.filename = sapi_module.php_ini_path_override; } } } /* Search php.ini file in search path */ - if (!fh.handle.fp) + if (!fh.handle.fp) { fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC); + fh.filename = php_ini_opened_path; + } if (free_ini_search_path) { efree(php_ini_search_path); } @@ -322,18 +325,18 @@ return SUCCESS; /* having no configuration file is ok */ } fh.type = ZEND_HANDLE_FP; - fh.filename = php_ini_opened_path; zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists); - if (php_ini_opened_path) { + { zval tmp; - Z_STRLEN(tmp) = strlen(php_ini_opened_path); - Z_STRVAL(tmp) = zend_strndup(php_ini_opened_path, Z_STRLEN(tmp)); + Z_STRLEN(tmp) = strlen(fh.filename); + Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRLEN(tmp)); Z_TYPE(tmp) = IS_STRING; zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"), (void *) &tmp, sizeof(zval), NULL); - efree(php_ini_opened_path); + if(php_ini_opened_path) + efree(php_ini_opened_path); php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); } 1.2.2.1 +6 -1 php4/main/php_network.h Index: php_network.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_network.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_network.h 29 Apr 2002 02:33:38 -0000 1.2 +++ php_network.h 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -15,7 +15,7 @@ | Author: Stig Venaas <venaa****@unine*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_network.h,v 1.20 2002/03/19 17:49:00 wez Exp $ */ +/* $Id: php_network.h,v 1.21 2002/06/11 03:55:28 jason Exp $ */ #ifndef _PHP_NETWORK_H #define _PHP_NETWORK_H @@ -87,6 +87,11 @@ int php_hostconnect(const char *host, unsigned short port, int socktype, int timeout); PHPAPI int php_connect_nonb(int sockfd, const struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout); + +#ifdef PHP_WIN32 +PHPAPI int php_connect_nonb_win32(SOCKET sockfd, const struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout); +#endif + void php_any_addr(int family, php_sockaddr_storage *addr, unsigned short port); int php_sockaddr_size(php_sockaddr_storage *addr); 1.2.2.2 +5 -1 php4/main/php_streams.h Index: php_streams.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_streams.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_streams.h 30 Apr 2002 08:13:17 -0000 1.2.2.1 +++ php_streams.h 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -265,7 +265,7 @@ #define php_stream_stat(stream, ssb) _php_stream_stat((stream), (ssb) TSRMLS_CC) PHPAPI int _php_stream_stat_path(char *path, php_stream_statbuf *ssb TSRMLS_DC); -#define php_stream_stat_path(path, ssb) _php_stream_stat((path), (ssb) TSRMLS_CC) +#define php_stream_stat_path(path, ssb) _php_stream_stat_path((path), (ssb) TSRMLS_CC) PHPAPI php_stream *_php_stream_opendir(char *path, int options, php_stream_context *context STREAMS_DC TSRMLS_DC); #define php_stream_opendir(path, options, context) _php_stream_opendir((path), (options), (context) STREAMS_CC TSRMLS_CC) @@ -452,6 +452,10 @@ php_stream_notification_notify((context), (code), PHP_STREAM_NOTIFY_SEVERITY_ERR, \ (xmsg), (xcode), 0, 0, NULL TSRMLS_CC); } } while(0) + +/* Give other modules access to the url_stream_wrappers_hash */ +PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash(); + #endif /* 1.2.2.2 +34 -11 php4/main/rfc1867.c Index: rfc1867.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/rfc1867.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- rfc1867.c 19 May 2002 11:16:06 -0000 1.2.2.1 +++ rfc1867.c 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -16,7 +16,7 @@ | Jani Taskinen <snipe****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: rfc1867.c,v 1.99 2002/05/11 11:58:16 zeev Exp $ */ +/* $Id: rfc1867.c,v 1.103 2002/06/07 08:00:12 sesser Exp $ */ /* * This product includes software developed by the Apache Group @@ -158,7 +158,7 @@ */ static int fill_buffer(multipart_buffer *self TSRMLS_DC) { - int bytes_to_read, actual_read = 0; + int bytes_to_read, total_read = 0, actual_read = 0; /* shift the existing data if necessary */ if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) { @@ -171,7 +171,7 @@ bytes_to_read = self->bufsize - self->bytes_in_buffer; /* read the required number of bytes */ - if (bytes_to_read > 0) { + while (bytes_to_read > 0) { char *buf = self->buffer + self->bytes_in_buffer; @@ -181,10 +181,14 @@ if (actual_read > 0) { self->bytes_in_buffer += actual_read; SG(read_post_bytes) += actual_read; + total_read += actual_read; + bytes_to_read -= actual_read; + } else { + break; } } - return actual_read; + return total_read; } @@ -334,7 +338,12 @@ /* add header to table */ char *key = line; - char *value = strchr(line, ':'); + char *value = NULL; + + /* space in the beginning means same header */ + if (!isspace(line[0])) { + value = strchr(line, ':'); + } if (value) { *value = 0; @@ -343,7 +352,7 @@ entry.value = estrdup(value); entry.key = estrdup(key); - } else if (zend_llist_remove_tail(header)) { /* If no ':' on the line, add to previous line */ + } else if (header->count) { /* If no ':' on the line, add to previous line */ prev_len = strlen(prev_entry.value); cur_len = strlen(line); @@ -354,6 +363,10 @@ entry.value[cur_len + prev_len] = '\0'; entry.key = estrdup(prev_entry.key); + + zend_llist_remove_tail(header); + } else { + continue; } zend_llist_add_element(header, &entry); @@ -400,7 +413,9 @@ ++pos; } } - ++pos; + if (*pos) { + ++pos; + } } else ++pos; } @@ -706,15 +721,21 @@ /* If file_uploads=off, skip the file part */ if (!PG(file_uploads)) { - efree(filename); - if (param) efree(param); + if (filename) { + efree(filename); + } + if (param) { + efree(param); + } continue; } /* Return with an error if the posted data is garbled */ if (!param) { sapi_module.sapi_error(E_WARNING, "File Upload Mime headers garbled"); - efree(filename); + if (filename) { + efree(filename); + } SAFE_RETURN; } @@ -729,7 +750,9 @@ cancel_upload = 0; if(strlen(filename) == 0) { +#ifdef DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "No file uploaded"); +#endif cancel_upload = UPLOAD_ERROR_D; } @@ -822,7 +845,7 @@ s = NULL; /* Possible Content-Type: */ - if (!(cd = php_mime_get_hdr_value(header, "Content-Type")) || filename == "") { + if (cancel_upload || !(cd = php_mime_get_hdr_value(header, "Content-Type"))) { cd = ""; } else { /* fix for Opera 6.01 */ 1.2.2.2 +1 -1 php4/main/snprintf.c Index: snprintf.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/snprintf.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- snprintf.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ snprintf.c 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -361,7 +361,7 @@ { int sign, decpt; register char *p1, *p2; - register i; + register int i; char buf1[NDIG]; p1 = ap_php_ecvt(number, ndigit, &decpt, &sign, buf1); 1.2.2.2 +43 -0 php4/main/snprintf.h Index: snprintf.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/snprintf.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- snprintf.h 9 May 2002 04:17:00 -0000 1.2.2.1 +++ snprintf.h 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -16,6 +16,49 @@ +----------------------------------------------------------------------+ */ +/* + +Comparing: sprintf, snprintf, spprintf + +sprintf offers the ability to make a lot of failures since it does not know + the size of the buffer it uses. Therefore usage of sprintf often + results in possible entries for buffer overrun attacks. So please + use this version only if you are sure the call is safe. sprintf + allways terminstes the buffer it writes to. + +snprintf knows the buffers size and will not write behind it. But you will + have to use either a static buffer or allocate a dynamic buffer + before beeing able to call the function. In other words you must + be sure that you really know the maximum size of the buffer required. + A bad thing is having a big maximum while in most cases you would + only need a small buffer. If the size of the resulting string is + longer or equal to the buffer size than the buffer is not terminated. + +spprintf is the dynamical version of snprintf. It allocates the buffer in size + as needed and allows a maximum setting as snprintf (turn this feature + off by setting max_len to 0). spprintf is a little bit slower than + snprintf and offers possible memory leakes if you miss freeing the + buffer allocated by the function. Therfore this function should be + used where either no maximum is known or the maximum is much bigger + than normal size required. spprintf allways terminates the buffer. + +Example: + + #define MAX 1024 | #define MAX 1024 | #define MAX 1024 + char buffer[MAX] | char buffer[MAX] | char *buffer; + | | + | | // No need to initialize buffer: + | | // spprintf ignores value of buffer + sprintf(buffer, "test"); | snprintf(buffer, MAX, "test"); | spprintf(&buffer, MAX, "text"); + | | if (!buffer) + | | return OUT_OF_MEMORY + // sprintf allways terminates | // manual termination of | // spprintf allays terminates buffer + // buffer | // buffer *IS* required | + | buffer[MAX-1] = 0; | + action_with_buffer(buffer); | action_with_buffer(buffer); | action_with_buffer(buffer); + | | efree(buffer); +*/ + #ifndef SNPRINTF_H #define SNPRINTF_H 1.2.2.2 +16 -16 php4/main/spprintf.c Index: spprintf.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/spprintf.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- spprintf.c 9 May 2002 04:17:00 -0000 1.2.2.1 +++ spprintf.c 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -118,16 +118,15 @@ /* Resize xbuf so that add bytes can be added. Reallocation is done * in defined block size to minimize calls to realloc. */ -static int xbuf_resize(xbuffy *xbuf, size_t add) +static void xbuf_resize(xbuffy *xbuf, size_t add) { char *buf; - int ret; size_t size, offset; if (xbuf->buf) { offset = xbuf->nextb - xbuf->buf; if (offset+add < xbuf->size) { - return 0; /* do not change size if not necessary */ + return; /* do not change size if not necessary */ } } else { offset = 0; @@ -139,32 +138,27 @@ } if (xbuf->max_len && size > xbuf->max_len) { size = xbuf->max_len; - ret = 1; - } else { - ret = 0; } - + buf = erealloc(xbuf->buf, size+1); /* alloc space for NUL */ - if (!buf) { - return 1; - } else { + if (buf) { xbuf->buf = buf; xbuf->buf_end = xbuf->max_len ? &buf[size] : (char *) ~0; xbuf->nextb = buf+offset; xbuf->size = size; - return ret; } } /* Initialise xbuffy with size spprintf_BLOCK_SIZE */ -static int xbuf_init(xbuffy *xbuf, size_t max_len) +static char * xbuf_init(xbuffy *xbuf, size_t max_len) { xbuf->buf = NULL; xbuf->size = 0; xbuf->max_len = max_len; - return xbuf_resize(xbuf, 0); /* NOT max_len */ + xbuf_resize(xbuf, 0); /* NOT max_len */ + return xbuf->buf; } /* @@ -617,8 +611,9 @@ * Notice that if no length is given, we initialize buf_end to the * highest possible address. */ - if (xbuf_init(&xbuf, max_len)) { - *pbuf = NULL; + if (!xbuf_init(&xbuf, max_len)) { + if (pbuf) + *pbuf = NULL; return 0; } else { /* @@ -627,7 +622,12 @@ cc = xbuf_format_converter(&xbuf, format, ap); if (xbuf.nextb <= xbuf.buf_end) *(xbuf.nextb) = '\0'; - *pbuf = xbuf.buf; + else if (xbuf.size) + xbuf.buf[xbuf.size-1] = '\0'; + if (pbuf) + *pbuf = xbuf.buf; + else + efree(pbuf); return cc; } } 1.2.2.1 +15 -0 php4/main/spprintf.h Index: spprintf.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/spprintf.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- spprintf.h 29 Apr 2002 02:33:38 -0000 1.2 +++ spprintf.h 9 Jul 2002 09:14:42 -0000 1.2.2.1 @@ -16,14 +16,29 @@ +----------------------------------------------------------------------+ */ +/* + +The pbuf parameter of all spprintf version receives a pointer to the allocated +buffer. This buffer must be freed manually after usage using efree() function. +The buffer will allways be terminated by a zero character. When pbuf is NULL +the function can be used to calculate the required size of the buffer but for +that purpose snprintf is faster. When both pbuf and the return value are 0 +than you are out of memory. + +There is also snprintf: See difference explained in snprintf.h + +*/ + #ifndef SPPRINTF_H #define SPPRINTF_H #include "snprintf.h" +BEGIN_EXTERN_C() extern int spprintf( char **pbuf, size_t max_len, const char *format, ...); PHPAPI extern int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap); +END_EXTERN_C() #endif /* SNPRINTF_H */ 1.2.2.2 +11 -15 php4/main/streams.c Index: streams.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/streams.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- streams.c 30 Apr 2002 08:13:17 -0000 1.2.2.1 +++ streams.c 9 Jul 2002 09:14:42 -0000 1.2.2.2 @@ -20,6 +20,8 @@ +----------------------------------------------------------------------+ */ +/* $Id: streams.c,v 1.57 2002/06/19 00:31:30 edink Exp $ */ + #define _GNU_SOURCE #include "php.h" #include "php_globals.h" @@ -248,21 +250,13 @@ return NULL; } else { /* unbuffered fgets - poor performance ! */ - size_t n = 1; char *c = buf; /* TODO: look at error returns? */ - while(n < maxlen && stream->ops->read(stream, c, 1 TSRMLS_CC) > 0) { - n++; - if (*c == '\n') { - c++; - break; - } - c++; - } - *c = 0; - return buf; + while (--maxlen > 0 && stream->ops->read(stream, buf, 1 TSRMLS_CC) == 1 && *buf++ != '\n'); + *buf = '\0'; + return c == buf && maxlen > 0 ? NULL : c; } } @@ -441,7 +435,8 @@ } } if (len) { - *buf = perealloc_rel_orig(*buf, len, persistent); + *buf = perealloc_rel_orig(*buf, len + 1, persistent); + (*buf)[len] = '\0'; } else { pefree(*buf, persistent); *buf = NULL; @@ -1052,9 +1047,6 @@ PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) { - if (!PG(allow_url_fopen) && wrapper->is_url) - return FAILURE; - return zend_hash_add(&url_stream_wrappers_hash, protocol, strlen(protocol), wrapper, sizeof(*wrapper), NULL); } @@ -1481,6 +1473,10 @@ return zend_hash_update(Z_ARRVAL_PP(wrapperhash), (char*)optionname, strlen(optionname)+1, (void**)&optionvalue, sizeof(zval *), NULL); } +PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash() +{ + return &url_stream_wrappers_hash; +} /* * Local variables: No revision No revision 1.2.2.3 +13 -83 php4/pear/Makefile.frag Index: Makefile.frag =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Makefile.frag,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Makefile.frag 19 May 2002 11:16:07 -0000 1.2.2.2 +++ Makefile.frag 9 Jul 2002 09:14:43 -0000 1.2.2.3 @@ -28,57 +28,13 @@ # Net \ # Schedule \ -#PEAR_FILES = \ -# Archive/Tar.php \ -# Console/Getopt.php \ -# PEAR.php \ -# PEAR/Autoloader.php \ -# PEAR/Command.php \ -# PEAR/Command/Auth.php \ -# PEAR/Command/Common.php \ -# PEAR/Command/Config.php \ -# PEAR/Command/Install.php \ -# PEAR/Command/Package.php \ -# PEAR/Command/Registry.php \ -# PEAR/Command/Remote.php \ -# PEAR/Frontend/CLI.php \ -# PEAR/Frontend/Gtk.php \ -# PEAR/Common.php \ -# PEAR/Config.php \ -# PEAR/Dependency.php \ -# PEAR/Installer.php \ -# PEAR/Packager.php \ -# PEAR/Registry.php \ -# PEAR/Remote.php \ -# System.php \ -# XML/Parser.php - # These are moving to /pear (in cvs): -# Crypt/CBC.php \ # Crypt/HCEMD5.php \ -# DB.php \ -# DB/common.php \ -# DB/fbsql.php \ -# DB/ibase.php \ -# DB/ifx.php \ -# DB/msql.php \ -# DB/mssql.php \ -# DB/mysql.php \ -# DB/oci8.php \ -# DB/odbc.php \ -# DB/pgsql.php \ -# DB/storage.php \ -# DB/sybase.php \ # Date/Calc.php \ # Date/Human.php \ # File/Find.php \ # File/Passwd.php \ -# File/SearchReplace.php \ -# HTML/Common.php \ # HTML/Form.php \ -# HTML/IT.php \ -# HTML/ITX.php \ -# HTML/IT_Error.php \ # HTML/Page.php \ # HTML/Processor.php \ # HTML/Select.php \ @@ -92,39 +48,15 @@ # Net/Curl.php \ # Net/Dig.php \ # Net/SMTP.php \ -# Net/Socket.php \ # Schedule/At.php \ -PEARCMD=$(top_builddir)/sapi/cli/php -d include_path=$(top_srcdir)/pear pear/scripts/pear.in +#PEARCMD=$(top_builddir)/sapi/cli/php -d include_path=$(top_srcdir)/pear pear/scripts/pear.in install-pear-installer: $(top_builddir)/sapi/cli/php - @for descfile in $(srcdir)/package-*.xml; do \ - tmp="$${descfile%.xml}"; \ - pkgname="$${tmp#*-}"; \ - pkgver=`grep '<version>' $$descfile|head -1|cut -d\> -f2|cut -d\< -f1`; \ - if $(PEARCMD) shell-test $$pkgname; then \ - if ! $(PEARCMD) shell-test $$pkgname $$pkgver; then \ - $(PEARCMD) -q upgrade $$descfile | sed -e "s/^/$$pkgname $$pkgver: /"; \ - fi; \ - else \ - $(PEARCMD) -q install $$descfile | sed -e "s/^/$$pkgname $$pkgver: /"; \ - fi; \ - done + $(top_builddir)/sapi/cli/php $(srcdir)/install-pear.php $(srcdir)/package-*.xml -install-pear-packages: # requires cli installed - @/bin/ls -1 $(srcdir)/packages | while read package; do \ - case $$package in \ - *.tgz) pkg=$${package%.tgz};; \ - *.tar) pkg=$${package%.tar};; \ - *) continue;; \ - esac; \ - pkgname="$${pkg%-*}"; pkgver="$${pkg#*-}"; \ - if $(INSTALL_ROOT)$(bindir)/pear -d php_dir=$(INSTALL_ROOT)$(PEAR_INSTALLDIR) shell-test $$pkgname $$pkgver; then \ - echo "$$pkgname $$pkgver: already installed"; \ - else \ - $(INSTALL_ROOT)$(bindir)/pear -q -d php_dir=$(INSTALL_ROOT)$(PEAR_INSTALLDIR) -d bin_dir=$(INSTALL_ROOT)$(bindir) -d doc_dir=$(INSTALL_ROOT)$(datadir)/doc/pear -d ext_dir=$(INSTALL_ROOT)$(EXTENSION_DIR) install $(srcdir)/packages/$$package 2>&1 | sed -e "s/^/$$pkgname $$pkgver: /"; \ - fi; \ - done +install-pear-packages: $(top_builddir)/sapi/cli/php + $(top_builddir)/sapi/cli/php $(srcdir)/install-pear.php $(srcdir)/packages/*.tar install-pear: @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \ @@ -146,7 +78,8 @@ scan_makefile_in.awk \ acinclude.m4 -bin_SCRIPTS = phpize php-config pear pearize phptar +bin_SCRIPTS = phpize php-config +# pear phptar install-build: @echo "Installing build environment" @@ -158,9 +91,9 @@ echo "Installing program: $$prog"; \ $(INSTALL) -m 755 $(builddir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \ done; \ - for file in $(INSTALL_ROOT)$(bindir)/pearcmd-*.php; do \ - rm -f $$file; \ - done; \ + #for file in $(INSTALL_ROOT)$(bindir)/pearcmd-*.php; do \ + # rm -f $$file; \ + #done; \ for prog in phpextdist; do \ echo "Installing program: $$prog"; \ $(INSTALL) -m 755 $(srcdir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \ @@ -190,17 +123,14 @@ cd $(top_builddir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \ done -$(builddir)/scripts/pear: $(srcdir)/scripts/pear.in $(top_builddir)/config.status - (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status) +#$(builddir)/scripts/pear: $(srcdir)/scripts/pear.in $(top_builddir)/config.status +# (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status) $(builddir)/scripts/phpize: $(srcdir)/scripts/phpize.in $(top_builddir)/config.status (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status) -$(builddir)/scripts/phptar: $(srcdir)/scripts/phptar.in $(top_builddir)/config.status - (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status) - -$(builddir)/scripts/pearize: $(srcdir)/scripts/pearize.in $(top_builddir)/config.status - (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status) +#$(builddir)/scripts/phptar: $(srcdir)/scripts/phptar.in $(top_builddir)/config.status +# (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status) $(builddir)/scripts/php-config: $(srcdir)/scripts/php-config.in $(top_builddir)/config.status (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status) 1.2.2.1 +128 -27 php4/pear/PEAR.php Index: PEAR.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- PEAR.php 29 Apr 2002 02:33:39 -0000 1.2 +++ PEAR.php 9 Jul 2002 09:14:43 -0000 1.2.2.1 @@ -18,7 +18,7 @@ // | Tomas V.V.Cox <cox****@idecn*****> | // +----------------------------------------------------------------------+ // -// $Id: PEAR.php,v 1.38 2002/04/19 13:58:25 ssb Exp $ +// $Id: PEAR.php,v 1.45 2002/06/17 14:35:12 cox Exp $ // define('PEAR_ERROR_RETURN', 1); @@ -127,8 +127,8 @@ * $_PEAR_destructor_object_list for destructor emulation if a * destructor object exists. * - * @param string (optional) which class to use for error objects, - * defaults to PEAR_Error. + * @param string $error_class (optional) which class to use for + * error objects, defaults to PEAR_Error. * @access public * @return void */ @@ -183,9 +183,9 @@ * You MUST use a reference, or they will not persist! * * @access public - * @param string The calling classname, to prevent clashes - * @param string The variable to retrieve. - * @return mixed A reference to the variable. If not set it will be + * @param string $class The calling classname, to prevent clashes + * @param string $var The variable to retrieve. + * @return mixed A reference to the variable. If not set it will be * auto initialised to NULL. */ function &getStaticProperty($class, $var) @@ -202,8 +202,8 @@ * classes. * * @access public - * @param mixed The function name (or array of class/method) to call - * @param mixed The arguments to pass to the function + * @param mixed $func The function name (or array of class/method) to call + * @param mixed $args The arguments to pass to the function * @return void */ function registerShutdownFunc($func, $args = array()) @@ -217,7 +217,7 @@ /** * Tell whether a value is a PEAR error. * - * @param mixed the value to test + * @param mixed $data the value to test * @access public * @return bool true if parameter is an error */ @@ -237,12 +237,12 @@ * PEAR objects. If called in an object, setErrorHandling sets * the default behaviour for that object. * - * @param int + * @param int $mode * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or * PEAR_ERROR_CALLBACK. * - * @param mixed + * @param mixed $options * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). * @@ -318,7 +318,7 @@ * * Note that this method can not be called statically * - * @param mixed a single error code or an array of error codes to expect + * @param mixed $code a single error code or an array of error codes to expect * * @return int the new depth of the "expected errors" stack * @access public @@ -348,6 +348,76 @@ } // }}} + // {{{ _checkDelExpect() + + /** + * This method checks unsets an error code if available + * + * @param mixed error code + * @return bool true if the error code was unset, false otherwise + * @access private + * @since PHP 4.3.0 + */ + function _checkDelExpect($error_code) + { + $deleted = false; + + foreach ($this->_expected_errors AS $key => $error_array) { + if (in_array($error_code, $error_array)) { + unset($this->_expected_errors[$key][array_search($error_code, $error_array)]); + $deleted = true; + } + + // clean up empty arrays + if (0 == count($this->_expected_errors[$key])) { + unset($this->_expected_errors[$key]); + } + } + return $deleted; + } + + // }}} + // {{{ delExpect() + + /** + * This method deletes all occurences of the specified element from + * the expected error codes stack. + * + * @param mixed $error_code error code that should be deleted + * @return mixed list of error codes that were deleted or error + * @access public + * @since PHP 4.3.0 + */ + function delExpect($error_code) + { + $deleted = false; + + if ((is_array($error_code) && (0 != count($error_code)))) { + // $error_code is a non-empty array here; + // we walk through it trying to unset all + // values + foreach($error_code AS $key => $error) { + if ($this->_checkDelExpect($error)) { + $deleted = true; + } else { + $deleted = false; + } + } + return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME + } elseif (!empty($error_code)) { + // $error_code comes alone, trying to unset it + if ($this->_checkDelExpect($error_code)) { + return true; + } else { + return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME + } + } else { + // $error_code is empty + return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME + } + } + + // }}} // {{{ raiseError() /** @@ -356,16 +426,16 @@ * handling applied. If the $mode and $options parameters are not * specified, the object's defaults are used. * - * @param mixed a text error message or a PEAR error object + * @param mixed $message a text error message or a PEAR error object * - * @param int a numeric error code (it is up to your class + * @param int $code a numeric error code (it is up to your class * to define these if you want to use codes) * - * @param int One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, + * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or * PEAR_ERROR_CALLBACK. * - * @param mixed If $mode is PEAR_ERROR_TRIGGER, this parameter + * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter * specifies the PHP-internal error level (one of * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). * If $mode is PEAR_ERROR_CALLBACK, this @@ -373,13 +443,13 @@ * method. In other error modes this parameter * is ignored. * - * @param string If you need to pass along for example debug + * @param string $userinfo If you need to pass along for example debug * information, this parameter is meant for that. * - * @param string The returned error object will be instantiated - * from this class, if specified. + * @param string $error_class The returned error object will be + * instantiated from this class, if specified. * - * @param bool If true, raiseError will only pass error codes, + * @param bool $skipmsg If true, raiseError will only pass error codes, * the error message parameter will be dropped. * * @access public @@ -445,8 +515,8 @@ * you can easily override the actual error handler for some code and restore * it later with popErrorHandling. * - * @param mixed (same as setErrorHandling) - * @param mixed (same as setErrorHandling) + * @param mixed $mode (same as setErrorHandling) + * @param mixed $options (same as setErrorHandling) * * @return bool Always true * @@ -497,6 +567,35 @@ } // }}} + // {{{ loadExtension() + + /** + * OS independant PHP extension load. Remember to take care + * on the correct extension name for case sensitive OSes. + * + * @param string $ext The extension name + * @return bool Success or not on the dl() call + */ + function loadExtension($ext) + { + if (!extension_loaded($ext)) { + if (OS_WINDOWS) { + $suffix = '.dll'; + } elseif (PHP_OS == 'HP-UX') { + $suffix = '.sl'; + } elseif (PHP_OS == 'AIX') { + $suffix = '.a'; + } elseif (PHP_OS == 'OSX') { + $suffix = '.bundle'; + } else { + $suffix = '.so'; + } + return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); + } + return true; + } + + // }}} } // {{{ _PEAR_call_destructors() @@ -524,7 +623,7 @@ // not called more than once. $_PEAR_destructor_object_list = array(); } - + // Now call the shutdown functions if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) { foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) { @@ -557,17 +656,19 @@ /** * PEAR_Error constructor * - * @param string message + * @param string $message message * - * @param int (optional) error code + * @param int $code (optional) error code * - * @param int (optional) error mode, one of: PEAR_ERROR_RETURN, + * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN, * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER or * PEAR_ERROR_CALLBACK * - * @param mixed (optional) error level, _OR_ in the case of + * @param mixed $options (optional) error level, _OR_ in the case of * PEAR_ERROR_CALLBACK, the callback function or object/method * tuple. + * + * @param string $userinfo (optional) additional user/debug info * * @access public * 1.2.2.1 +36 -12 php4/pear/System.php Index: System.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/System.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- System.php 29 Apr 2002 02:33:39 -0000 1.2 +++ System.php 9 Jul 2002 09:14:43 -0000 1.2.2.1 @@ -16,12 +16,14 @@ // | Authors: Tomas V.V.Cox <cox****@idecn*****> | // +----------------------------------------------------------------------+ // -// $Id: System.php,v 1.11 2002/02/28 08:27:05 sebastian Exp $ +// $Id: System.php,v 1.15 2002/06/02 14:27:15 dickmann Exp $ // require_once 'PEAR.php'; require_once 'Console/Getopt.php'; +$GLOBALS['_System_temp_files'] = array(); + /** * System offers cross plattform compatible system functions * @@ -41,11 +43,11 @@ * * @package System * @author Tomas V.V.Cox <cox****@idecn*****> -* @version $Revision: 1.11 $ +* @version $Revision: 1.15 $ * @access public * @see http://pear.php.net/manual/ */ -class System extends PEAR +class System { /** * returns the commandline arguments of a function @@ -145,7 +147,8 @@ function _multipleToStruct($files) { $struct = array('dirs' => array(), 'files' => array()); - foreach($files as $file) { + settype($files, 'array'); + foreach ($files as $file) { if (is_dir($file)) { $tmp = System::_dirToStruct($file, 0); $struct = array_merge_recursive($tmp, $struct); @@ -179,19 +182,19 @@ if (isset($do_recursive)) { $struct = System::_multipleToStruct($opts[1]); foreach($struct['files'] as $file) { - if (!unlink($file)) { + if (!@unlink($file)) { $ret = false; } } foreach($struct['dirs'] as $dir) { - if (!rmdir($dir)) { + if (!@rmdir($dir)) { $ret = false; } } } else { foreach ($opts[1] as $file) { $delete = (is_dir($file)) ? 'rmdir' : 'unlink'; - if (!$delete($file)) { + if (!@$delete($file)) { $ret = false; } } @@ -289,8 +292,7 @@ System::raiseError("Could not open $file"); continue; } - while(!feof($fd)) { - $cont = fread($fd, 2048); + while ($cont = fread($fd, 2048)) { if (isset($outputfd)) { fwrite($outputfd, $cont); } else { @@ -306,7 +308,8 @@ } /** - * Creates temporal files or directories + * Creates temporary files or directories. This function will remove + * the created files when the scripts finish its execution. * * Usage: * 1) $tempfile = System::mktemp("prefix"); @@ -316,8 +319,8 @@ * * prefix -> The string that will be prepended to the temp name * (defaults to "tmp"). - * -d -> A temporal dir will be created instead of a file. - * -t -> The target dir where the temporal (file|dir) will be created. If + * -d -> A temporary dir will be created instead of a file. + * -t -> The target dir where the temporary (file|dir) will be created. If * this param is missing by default the env vars TMP on Windows or * TMPDIR in Unix will be used. If these vars are also missing * c:\windows\temp or /tmp will be used. @@ -329,6 +332,7 @@ */ function mktemp($args = null) { + static $first_time = true; $opts = System::_parseArgs($args, 't:d'); if (PEAR::isError($opts)) { return System::raiseError($opts); @@ -354,7 +358,27 @@ return System::raiseError("Unable to create temporary directory $tmpdir"); } } + $GLOBALS['_System_temp_files'][] = $tmp; + if ($first_time) { + PEAR::registerShutdownFunc(array('System', '_removeTmpFiles')); + $first_time = false; + } return $tmp; + } + + /** + * Remove temporary files created my mkTemp. This function is executed + * at script shutdown time + * + * @access private + */ + function _removeTmpFiles() + { + if (count($GLOBALS['_System_temp_files'])) { + $delete = $GLOBALS['_System_temp_files']; + array_unshift($delete, '-r'); + System::rm($delete); + } } /** 1.1.2.2 +22 -15 php4/pear/Attic/package-Archive_Tar.xml Index: package-Archive_Tar.xml =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Attic/package-Archive_Tar.xml,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- package-Archive_Tar.xml 19 May 2002 11:39:46 -0000 1.1.2.1 +++ package-Archive_Tar.xml 9 Jul 2002 09:14:43 -0000 1.1.2.2 @@ -1,7 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "../package.dtd"> -<!-- do not use the "Type" attribute here, that one is only for - generated package.xml files --> +<!DOCTYPE package SYSTEM "package.dtd"> <package version="1.0"> <name>Archive_Tar</name> <summary>Tar file management class</summary> @@ -26,28 +24,37 @@ </maintainer> </maintainers> <release> - <version>0.3</version> - <date>2002-04-13</date> - <notes>Windows bugfix: used wrong directory separators</notes> + <version>0.9</version> + <date>2002-05-27</date> + <notes> + * Auto-detect gzip'ed files + </notes> <state>stable</state> <filelist> - <file role="php" baseinstalldir="Archive" name="Archive/Tar.php"/> + <dir name="Archive"> + <file role="php" name="Tar.php"/> + </dir> + <file role="doc" name="docs/Archive_Tar.txt" baseinstalldir="/"/> </filelist> </release> <changelog> <release> + <version>0.4</version> + <date>2002-05-20</date> + <notes>Windows bugfix: use forward slashes inside archives</notes> + <state>stable</state> + </release> + <release> <version>0.2</version> <date>2002-02-18</date> <notes>From initial commit to stable</notes> <state>stable</state> - <filelist> - <dir name="/" baseinstalldir="Archive"> - <file role="php">Tar.php</file> - <dir name="docs" role="doc"> - <file>Tar.txt</file> - </dir> - </dir> - </filelist> + </release> + <release> + <version>0.3</version> + <date>2002-04-13</date> + <notes>Windows bugfix: used wrong directory separators</notes> + <state>stable</state> </release> </changelog> </package> 1.1.2.2 +24 -6 php4/pear/Attic/package-Console_Getopt.xml Index: package-Console_Getopt.xml =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Attic/package-Console_Getopt.xml,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- package-Console_Getopt.xml 19 May 2002 11:39:46 -0000 1.1.2.1 +++ package-Console_Getopt.xml 9 Jul 2002 09:14:43 -0000 1.1.2.2 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "../package.dtd"> +<!DOCTYPE package SYSTEM "package.dtd"> <!-- do not use the "Type" attribute here, that one is only for generated package.xml files --> <package version="1.0"> @@ -17,18 +17,36 @@ </maintainer> <maintainer> <user>ssb</user> - <role>helper</role> + <role>developer</role> <name>Stig Bakken</name> <email>stig****@php*****</email> </maintainer> </maintainers> <release> - <version>0.9</version> - <date>2002-05-12</date> - <notes>Initial release</notes> + <version>0.11</version> + <date>2002-05-26</date> + <notes>POSIX getopt compatibility fix: treat first element of args +array as command name +</notes> <state>beta</state> <filelist> - <file role="php" baseinstalldir="Console" name="Console/Getopt.php"/> + <dir name="Console"> + <file role="php" name="Getopt.php"/> + </dir> </filelist> </release> + <changelog> + <release> + <version>0.10</version> + <date>2002-05-12</date> + <notes>Packaging fix</notes> + <state>beta</state> + </release> + <release> + <version>0.9</version> + <date>2002-05-12</date> + <notes>Initial release</notes> + <state>beta</state> + </release> + </changelog> </package> 1.1.2.2 +90 -8 php4/pear/Attic/package-PEAR.xml Index: package-PEAR.xml =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Attic/package-PEAR.xml,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- package-PEAR.xml 19 May 2002 11:39:46 -0000 1.1.2.1 +++ package-PEAR.xml 9 Jul 2002 09:14:43 -0000 1.1.2.2 @@ -6,7 +6,7 @@ <description>The PEAR package contains: * the PEAR base class * the PEAR_Error error handling mechanism - * the PEAR command-line toolkit, for creating, distributing + * the PEAR installer, for creating, distributing and installing packages </description> <license>PHP License</license> @@ -23,21 +23,39 @@ <name>Tomas V.V.Cox</name> <email>cox****@idecn*****</email> </maintainer> + <maintainer> + <user>mj</user> + <role>helper</role> + <name>Martin Jansen</name> + <email>mj****@php*****</email> + </maintainer> </maintainers> <release> - <version>0.10-dev</version> + <version>0.91-dev</version> <state>beta</state> - <date>yyyy-mm-dd</date> + <date>2002-06-15</date> <notes> -* HTTP proxy support when downloading packages +New Features: +* Added PEAR::loadExtension($ext) - OS independant PHP extension load +* Added PEAR::delExpect() API method. It allows to unset one or more expected error codes +* System::mkTemp() automatically remove created tmp files/dirs at script shutdown +* New command "pear search" + +Fixed Bugs: +* fix for XML-RPC bug that made some remote commands fail +* fix problems under Windows with the DIRECTORY_SEPARATOR +* lot of other minor fixes </notes> <filelist> + <file role="data" name="package.dtd"/> <file role="php" name="PEAR.php"/> + <file role="php" name="System.php"/> <dir name="PEAR"> <file role="php" name="Autoloader.php"/> <file role="php" name="Command.php"/> <dir name="Command"> <file role="php" name="Auth.php"/> + <file role="php" name="Build.php"/> <file role="php" name="Common.php"/> <file role="php" name="Config.php"/> <file role="php" name="Install.php"/> @@ -52,6 +70,7 @@ <file role="php" name="CLI.php"/> <file role="php" name="Gtk.php"/> </dir> + <file role="php" name="Builder.php"/> <file role="php" name="Installer.php"/> <file role="php" name="Packager.php"/> <file role="php" name="Registry.php"/> @@ -62,18 +81,81 @@ </dir> <dir name="scripts"> <file baseinstalldir="/" role="script" install-as="pear" name="pear.in"> - <replace from="@prefix@/bin" to="PHP_BINDIR" type="php-const"/> + <replace from="@prefix@/bin" to="bin_dir" type="pear-config"/> + <replace from="@pear_version@" to="version" type="package-info"/> + <replace from="@include_path@" to="php_dir" type="pear-config"/> </file> - <file baseinstalldir="/" role="script" name="pear.bat"></file> + <file baseinstalldir="/" role="script" platform="windows" name="pear.bat"></file> </dir> </filelist> <deps> <dep type="php" rel="ge" version="4.1"/> - <dep type="pkg" rel="has">Archive_Tar</dep> - <dep type="pkg" rel="has">Console_Getopt</dep> + <dep type="pkg" rel="has" version="0.4">Archive_Tar</dep> + <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep> </deps> </release> <changelog> + <release> + <version>0.90</version> + <state>beta</state> + <date>2002-05-28</date> + <notes> +* fix: "help" command was broken +* new command: "info" +* new command: "config-help" +* un-indent multi-line data from xml description files +* new command: "build" +* fix: config-set did not work with "set" parameters +* disable magic_quotes_runtime +* "install" now builds and installs C extensions +* added PEAR::delExpect() +* System class no longer inherits PEAR +* grouped PEAR_Config parameters +* add --nobuild option to install/upgrade commands +* new and more generic Frontend API +</notes> + <deps> + <dep type="php" rel="ge" version="4.1"/> + <dep type="pkg" rel="has" version="0.4">Archive_Tar</dep> + <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep> + </deps> + </release> + <release> + <version>0.10</version> + <state>beta</state> + <date>2002-05-26</date> + <notes> +Lots of stuff this time. 0.9 was not actually self-hosting, even +though it claimed to be. This version finally is self-hosting +(really!), meaning you can upgrade the installer with the command +"pear upgrade PEAR". + +* new config paramers: http_proxy and umask +* HTTP proxy support when downloading packages +* generalized command handling code +* and fixed the bug that would not let commands have the + same options as "pear" itself +* added long options to every command +* added command shortcuts ("pear help shortcuts") +* added stub for Gtk installer +* some phpdoc fixes +* added class dependency detector (using ext/tokenizer) +* dependency handling fixes +* added OS_Guess class for detecting OS +* install files with the "platform" attribute set + only on matching operating systems +* PEAR_Remote now falls back to the XML_RPC package + if xmlrpc-epi is not available +* renamed command: package-list -> list +* new command: package-dependencies +* lots of minor fixes +</notes> + <deps> + <dep type="php" rel="ge" version="4.1"/> + <dep type="pkg" rel="has" version="0.5">Archive_Tar</dep> + <dep type="pkg" rel="ge" version="0.11">Console_Getopt</dep> + </deps> + </release> <release> <version>0.9</version> <state>beta</state> 1.2.2.2 +16 -6 php4/pear/package.dtd Index: package.dtd =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/package.dtd,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- package.dtd 30 Apr 2002 08:13:17 -0000 1.2.2.1 +++ package.dtd 9 Jul 2002 09:14:43 -0000 1.2.2.2 @@ -1,10 +1,10 @@ <!-- - $Id: package.dtd,v 1.24 2002/04/28 07:58:41 ssb Exp $ + $Id: package.dtd,v 1.26 2002/05/27 01:22:59 ssb Exp $ - This is the PEAR package description, version 1.0b7. + This is the PEAR package description, version 1.0b8. It should be used with the informal public identifier: - "-//PHP Group//DTD PEAR Package 1.0b7//EN//XML" + "-//PHP Group//DTD PEAR Package 1.0b8//EN//XML" Copyright (c) 1997-2002 The PHP Group @@ -43,7 +43,7 @@ <!ELEMENT changelog (release)+> -<!ELEMENT release (version|license|state|date|notes|filelist|deps|provides|script)+> +<!ELEMENT release (version|license|state|date|notes|filelist|deps|provides|script|configureoptions)+> <!ELEMENT version (#PCDATA)> @@ -60,9 +60,11 @@ baseinstalldir CDATA #IMPLIED> <!ELEMENT file (replace*)> -<!ATTLIST file role (php|ext|test|doc|data|script) 'php' +<!ATTLIST file role (php|ext|src|test|doc|data|script) 'php' debug (na|on|off) 'na' - threaded (na|on|off) 'na' + zts (na|on|off) 'na' + phpapi NUMBER #IMPLIED + zendapi NUMBER #IMPLIED format CDATA #IMPLIED baseinstalldir CDATA #IMPLIED platform CDATA #IMPLIED @@ -103,3 +105,11 @@ pre-build |post-build | pre-configure|post-configure| pre-setup |post-setup ) #REQUIRED> + +<!ELEMENT configureoptions (configureoption*)> + +<!ELEMENT configureoption EMPTY> +<!ATTLIST configureoption + name CDATA #REQUIRED + default CDATA #IMPLIED + prompt CDATA #REQUIRED> No revision No revision 1.2.2.2 +49 -6 php4/pear/Archive/Tar.php Index: Tar.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Archive/Tar.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- Tar.php 19 May 2002 11:16:07 -0000 1.2.2.1 +++ Tar.php 9 Jul 2002 09:14:43 -0000 1.2.2.2 @@ -16,7 +16,7 @@ // | Author: Vincent Blavet <vince****@blave*****> | // +----------------------------------------------------------------------+ // -// $Id: Tar.php,v 1.8 2002/05/09 13:00:12 vblavet Exp $ +// $Id: Tar.php,v 1.12 2002/05/28 00:35:16 ssb Exp $ require_once 'PEAR.php'; @@ -24,7 +24,7 @@ * Creates a (compressed) Tar archive * * @author Vincent Blavet <vince****@blave*****> -* @version $Revision: 1.8 $ +* @version $Revision: 1.12 $ * @package Archive */ class Archive_Tar extends PEAR @@ -61,15 +61,35 @@ * @param boolean $p_compress if true, the archive will be gezip(ped) * @access public */ - function Archive_Tar($p_tarname, $p_compress = false) + function Archive_Tar($p_tarname, $p_compress = null) { $this->PEAR(); + if ($p_compress === null) { + if (@file_exists($p_tarname)) { + if ($fp = @fopen($p_tarname, "r")) { + // look for gzip magic cookie + $data = fread($fp, 2); + if ($data == "\37\213") { + $p_compress = true; + } + } + } else { + // probably a remote file or some file accessible + // through a stream interface + if (substr($p_tarname, -2) == 'gz') { + $p_compress = true; + } + } + } $this->_tarname = $p_tarname; if ($p_compress) { // assert zlib extension support $extname = 'zlib'; if (!extension_loaded($extname)) { - $dlext = (OS_WINDOWS) ? '.dll' : '.so'; - @dl($extname . $dlext); + if (OS_WINDOWS) { + @dl("php_$extname.dll"); + } else { + @dl("$extname.so"); + } } if (!extension_loaded($extname)) { die("The extension '$extname' couldn't be found.\n". @@ -78,7 +98,7 @@ return false; } } - $this->_compress = $p_compress; + $this->_compress = (bool)$p_compress; } // }}} @@ -1073,6 +1093,15 @@ // }}} // {{{ _dirCheck() + + /** + * Check if a directory exists and create it (including parent + * dirs) if not. + * + * @param string $p_dir directory to check + * + * @return bool TRUE if the directory exists or was created + */ function _dirCheck($p_dir) { if ((@is_dir($p_dir)) || ($p_dir == '')) @@ -1092,9 +1121,22 @@ return true; } + // }}} // {{{ _pathReduction() + + /** + * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar", and + * remove double slashes. + * + * @param string $p_dir path to reduce + * + * @return string reduced path + * + * @access private + * + */ function _pathReduction($p_dir) { $v_result = ''; @@ -1126,6 +1168,7 @@ $v_result = strtr($v_result, '\\', '/'); return $v_result; } + // }}} // {{{ _translateWinPath() No revision No revision 1.2.2.2 +4 -1 php4/pear/Console/Getopt.php Index: Getopt.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Console/Getopt.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- Getopt.php 19 May 2002 11:16:07 -0000 1.2.2.1 +++ Getopt.php 9 Jul 2002 09:14:43 -0000 1.2.2.2 @@ -16,7 +16,7 @@ // | Author: Andrei Zmievski <andre****@php*****> | // +----------------------------------------------------------------------+ // -// $Id: Getopt.php,v 1.14 2002/05/13 17:28:37 andrei Exp $ +// $Id: Getopt.php,v 1.15 2002/05/26 12:13:47 ssb Exp $ require_once 'PEAR.php'; @@ -77,6 +77,9 @@ if ($long_options) sort($long_options); + if ($args[0]{0} != '-') { + array_shift($args); + } reset($args); while (list($i, $arg) = each($args)) { No revision No revision 1.2.2.1 +90 -72 php4/pear/Date/Calc.php Index: Calc.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Date/Calc.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- Calc.php 29 Apr 2002 02:33:41 -0000 1.2 +++ Calc.php 9 Jul 2002 09:14:43 -0000 1.2.2.1 @@ -28,8 +28,8 @@ * @author Monte Ohrt <monte****@ispi*****> */ -class Date_Calc { - +class Date_Calc +{ /** * Returns the current local date. NOTE: This function * retrieves the local date using strftime(), which may @@ -62,29 +62,24 @@ function isValidDate($day, $month, $year) { - - if(empty($year) || empty($month) || empty($day)) - return false; - - // must be digits only - if(preg_match("/\D/",$year)) - return false; - if(preg_match("/\D/",$month)) - return false; - if(preg_match("/\D/",$day)) - return false; - if($year < 0 || $year > 9999) return false; - if($month < 1 || $month > 12) - return false; - if($day < 1 || $day > 31 || $day > Date_Calc::daysInMonth($month,$year)) + if(!checkdate($month,$day,$year)) return false; return true; - } // end func isValidDate + /** + * Returns true for a leap year, else false + * + * @param string year in format CCYY + * + * @access public + * + * @return boolean true/false + */ + function isLeapYear($year="") { @@ -755,6 +750,29 @@ } // end func dateDiff /** + * Compares two dates + * + * @param string $day1 day in format DD + * @param string $month1 month in format MM + * @param string $year1 year in format CCYY + * @param string $day2 day in format DD + * @param string $month2 month in format MM + * @param string $year2 year in format CCYY + * + * @access public + * @return int 0 on equality, 1 if date 1 is greater, -1 if smaller + */ + function compareDates($day1,$month1,$year1,$day2,$month2,$year2) + { + $ndays1 = Date_Calc::dateToDays($day1, $month1, $year1); + $ndays2 = Date_Calc::dateToDays($day2, $month2, $year2); + if ($ndays1 == $ndays2) { + return 0; + } + return ($ndays1 > $ndays2) ? 1 : -1; + } + + /** * Find the number of days in the given month. * * @param string month in format MM, default current local month @@ -782,7 +800,6 @@ return 30; else return 31; - } // end func daysInMonth /** @@ -805,17 +822,17 @@ if(empty($month)) $month = Date_Calc::dateNow("%m"); - if(DATE_CALC_BEGIN_WEEKDAY == 1) - { + if(DATE_CALC_BEGIN_WEEKDAY == 1) + { - if(Date_Calc::firstOfMonthWeekday($month,$year) == 0) - $first_week_days = 1; - else - $first_week_days = 7 - (Date_Calc::firstOfMonthWeekday($month,$year) - 1); - - } - else - $first_week_days = 7 - Date_Calc::firstOfMonthWeekday($month,$year); + if(Date_Calc::firstOfMonthWeekday($month,$year) == 0) + $first_week_days = 1; + else + $first_week_days = 7 - (Date_Calc::firstOfMonthWeekday($month,$year) - 1); + + } + else + $first_week_days = 7 - Date_Calc::firstOfMonthWeekday($month,$year); return ceil(((Date_Calc::daysInMonth($month,$year) - $first_week_days) / 7) + 1); @@ -891,17 +908,17 @@ $this_weekday = Date_Calc::dayOfWeek($day,$month,$year); - if(DATE_CALC_BEGIN_WEEKDAY == 1) - { - if($this_weekday == 0) - $beginOfWeek = Date_Calc::dateToDays($day,$month,$year) - 6; - else - $beginOfWeek = Date_Calc::dateToDays($day,$month,$year) - - $this_weekday + 1; - } - else - $beginOfWeek = (Date_Calc::dateToDays($day,$month,$year) - - $this_weekday); + if(DATE_CALC_BEGIN_WEEKDAY == 1) + { + if($this_weekday == 0) + $beginOfWeek = Date_Calc::dateToDays($day,$month,$year) - 6; + else + $beginOfWeek = Date_Calc::dateToDays($day,$month,$year) + - $this_weekday + 1; + } + else + $beginOfWeek = (Date_Calc::dateToDays($day,$month,$year) + - $this_weekday); /* $beginOfWeek = (Date_Calc::dateToDays($day,$month,$year) @@ -1081,17 +1098,17 @@ $month_array = array(); // date for the first row, first column of calendar month - if(DATE_CALC_BEGIN_WEEKDAY == 1) - { - if(Date_Calc::firstOfMonthWeekday($month,$year) == 0) - $curr_day = Date_Calc::dateToDays("01",$month,$year) - 6; - else - $curr_day = Date_Calc::dateToDays("01",$month,$year) - - Date_Calc::firstOfMonthWeekday($month,$year) + 1; - } - else - $curr_day = (Date_Calc::dateToDays("01",$month,$year) - - Date_Calc::firstOfMonthWeekday($month,$year)); + if(DATE_CALC_BEGIN_WEEKDAY == 1) + { + if(Date_Calc::firstOfMonthWeekday($month,$year) == 0) + $curr_day = Date_Calc::dateToDays("01",$month,$year) - 6; + else + $curr_day = Date_Calc::dateToDays("01",$month,$year) + - Date_Calc::firstOfMonthWeekday($month,$year) + 1; + } + else + $curr_day = (Date_Calc::dateToDays("01",$month,$year) + - Date_Calc::firstOfMonthWeekday($month,$year)); // number of days in this month $daysInMonth = Date_Calc::daysInMonth($month,$year); @@ -1173,7 +1190,6 @@ floor(( 1461 * $year) / 4 ) + floor(( 153 * $month + 2) / 5 ) + $day + 1721119); - } // end func dateToDays /** @@ -1190,18 +1206,18 @@ function daysToDate($days,$format="%Y%m%d") { - $days -= 1721119; - $century = floor(( 4 * $days - 1) / 146097); - $days = floor(4 * $days - 1 - 146097 * $century); - $day = floor($days / 4); - - $year = floor(( 4 * $day + 3) / 1461); - $day = floor(4 * $day + 3 - 1461 * $year); - $day = floor(($day + 4) / 4); - - $month = floor(( 5 * $day - 3) / 153); - $day = floor(5 * $day - 3 - 153 * $month); - $day = floor(($day + 5) / 5); + $days -= 1721119; + $century = floor(( 4 * $days - 1) / 146097); + $days = floor(4 * $days - 1 - 146097 * $century); + $day = floor($days / 4); + + $year = floor(( 4 * $day + 3) / 1461); + $day = floor(4 * $day + 3 - 1461 * $year); + $day = floor(($day + 4) / 4); + + $month = floor(( 5 * $day - 3) / 153); + $day = floor(5 * $day - 3 - 153 * $month); + $day = floor(($day + 5) / 5); if($month < 10) $month +=3; @@ -1217,7 +1233,6 @@ $century = sprintf("%02d",$century); $year = sprintf("%02d",$year); - return(Date_Calc::dateFormat($day,$month,$century.$year,$format)); } // end func daysToDate @@ -1237,8 +1252,8 @@ * @return string date in given format */ - function NWeekdayOfMonth($occurance,$dayOfWeek,$month,$year,$format="%Y%m%d") { - + function NWeekdayOfMonth($occurance,$dayOfWeek,$month,$year,$format="%Y%m%d") + { $year = sprintf("%04d",$year); $month = sprintf("%02d",$month); @@ -1432,7 +1447,7 @@ $month = (int)$month; if(empty($month)) - $month = Date_Calc::dateNow("%m"); + $month = (int) Date_Calc::dateNow("%m"); $month_names = Date_Calc::getMonthNames(); return $month_names[$month]; @@ -1524,7 +1539,8 @@ * @param string month name * @return integer month number */ - function getMonthFromFullName($month){ + function getMonthFromFullName($month) + { $month = strtolower($month); $months = Date_Calc::getMonthNames(); while(list($id, $name) = each($months)){ @@ -1544,7 +1560,8 @@ * * @returns array An array of month names */ - function getMonthNames(){ + function getMonthNames() + { for($i=1;$i<13;$i++){ $months[$i] = strftime('%B', mktime(0, 0, 0, $i, 1, 2001)); } @@ -1560,7 +1577,8 @@ * * @returns array An array of week day names */ - function getWeekDays(){ + function getWeekDays() + { for($i=0;$i<7;$i++){ $weekdays[$i] = strftime('%A', mktime(0, 0, 0, 1, $i, 2001)); } @@ -1569,4 +1587,4 @@ } // end class Date_calendar -?> \ No newline at end of file +?> No revision No revision 1.2.2.1 +206 -206 php4/pear/Net/SMTP.php Index: SMTP.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Net/SMTP.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- SMTP.php 29 Apr 2002 02:33:42 -0000 1.2 +++ SMTP.php 9 Jul 2002 09:14:43 -0000 1.2.2.1 @@ -23,49 +23,49 @@ * Net_Socket:: class. */ class Net_SMTP extends PEAR { - - /** + + /** * The server to connect to. * @var string */ - var $host = 'localhost'; - - /** + var $host = 'localhost'; + + /** * The port to connect to. * @var int */ - var $port = 25; - - /** + var $port = 25; + + /** * The value to give when sending EHLO or HELO. * @var string */ - var $localhost = 'localhost'; - - /** + var $localhost = 'localhost'; + + /** * The socket resource being used to connect to the SMTP server. * @var resource */ - var $socket; - - /** + var $socket; + + /** * The most recent reply code * @var int */ - var $code; - - /** + var $code; + + /** * Stores detected features of the SMTP server. * @var array */ - var $esmtp; - + var $esmtp; + /** * The last line read from the server. * @var string */ var $lastline; - + /** * Constructor * @@ -76,12 +76,12 @@ * @param int The port to connect to. * @param string The value to give when sending EHLO or HELO. */ - function Net_SMTP($host = null, $port = null, $localhost = null) { + function Net_SMTP($host = null, $port = null, $localhost = null) { if (isset($host)) $this->host = $host; if (isset($port)) $this->port = $port; if (isset($localhost)) $this->localhost = $localhost; - } - + } + /** * Attempt to connect to the SMTP server. * @@ -91,16 +91,16 @@ */ function connect() { include_once 'Net/Socket.php'; - - if (PEAR::isError($this->socket = new Net_Socket())) { return new PEAR_Error('unable to create a socket object'); } - if (PEAR::isError($this->socket->connect($this->host, $this->port))) { return new PEAR_Error('unable to open socket'); } - - if (PEAR::isError($this->validateResponse('220'))) { return new PEAR_Error('smtp server not 220 ready'); } - if (!$this->identifySender()) { return new PEAR_Error('unable to identify smtp server'); } - - return true; - } - + + if (PEAR::isError($this->socket = new Net_Socket())) { return new PEAR_Error('unable to create a socket object'); } + if (PEAR::isError($this->socket->connect($this->host, $this->port))) { return new PEAR_Error('unable to open socket'); } + + if (PEAR::isError($this->validateResponse('220'))) { return new PEAR_Error('smtp server not 220 ready'); } + if (!$this->identifySender()) { return new PEAR_Error('unable to identify smtp server'); } + + return true; + } + /** * Attempt to disconnect from the SMTP server. * @@ -108,14 +108,14 @@ * kind of failure, or true on success. * @access public */ - function disconnect() { - if (PEAR::isError($this->socket->write("QUIT\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!$this->validateResponse('221')) { return new PEAR_Error('221 Bye not received'); } - if (PEAR::isError($this->socket->disconnect())) { return new PEAR_Error('socket disconnect failed'); } - - return true; - } - + function disconnect() { + if (PEAR::isError($this->socket->write("QUIT\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!$this->validateResponse('221')) { return new PEAR_Error('221 Bye not received'); } + if (PEAR::isError($this->socket->disconnect())) { return new PEAR_Error('socket disconnect failed'); } + + return true; + } + /** * Attempt to do SMTP authentication. * @@ -126,242 +126,242 @@ * kind of failure, or true on success. * @access public */ - function auth($uid, $pwd) { - /* Note: not currently checking if AUTH LOGIN is allowed */ - /* Note: only allows one authentication mechanism */ - - if (!isset($this->esmtp['AUTH'])) { return new PEAR_Error('auth not supported'); } - - if (PEAR::isError($this->socket->write("AUTH LOGIN\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!$this->validateResponse('334')) { return new PEAR_Error('AUTH LOGIN not recognized'); } - - if (PEAR::isError($this->socket->write(base64_encode($uid) . "\n"))) { return new PEAR_Error('write to socket failed'); } - if (!$this->validateResponse('334')) { return new PEAR_Error('354 not received'); } - - if (PEAR::isError($this->socket->write(base64_encode($pwd) . "\n"))) { return new PEAR_Error('write to socket failed'); } - if (!$this->validateResponse('235')) { return new PEAR_Error('235 not received'); } - - return true; - } - + function auth($uid, $pwd) { + /* Note: not currently checking if AUTH LOGIN is allowed */ + /* Note: only allows one authentication mechanism */ + + if (!isset($this->esmtp['AUTH'])) { return new PEAR_Error('auth not supported'); } + + if (PEAR::isError($this->socket->write("AUTH LOGIN\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!$this->validateResponse('334')) { return new PEAR_Error('AUTH LOGIN not recognized'); } + + if (PEAR::isError($this->socket->write(base64_encode($uid) . "\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!$this->validateResponse('334')) { return new PEAR_Error('354 not received'); } + + if (PEAR::isError($this->socket->write(base64_encode($pwd) . "\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!$this->validateResponse('235')) { return new PEAR_Error('235 not received'); } + + return true; + } + /** * Send the HELO command. - * + * * @param string The domain name to say we are. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function helo($domain) { - if (PEAR::isError($this->socket->write("HELO $domain\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function helo($domain) { + if (PEAR::isError($this->socket->write("HELO $domain\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Send the MAIL FROM: command. - * + * * @param string The sender (reverse path) to set. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function mailFrom($reverse_path) { - if (PEAR::isError($this->socket->write("MAIL FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function mailFrom($reverse_path) { + if (PEAR::isError($this->socket->write("MAIL FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Send the RCPT TO: command. - * + * * @param string The recipient (forward path) to add. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function rcptTo($forward_path) { - /* Note: 251 is also a valid response code */ - - if (PEAR::isError($this->socket->write("RCPT TO: <$forward_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error($this->lastline); } - - return true; - } - + function rcptTo($forward_path) { + /* Note: 251 is also a valid response code */ + + if (PEAR::isError($this->socket->write("RCPT TO: <$forward_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error($this->lastline); } + + return true; + } + /** * Send the DATA command. - * + * * @param string The message body to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function data($data) { - $data = preg_replace("/([^\r]{1})\n/", "\\1\r\n", $data); - $data = preg_replace("/\n\n/", "\n\r\n", $data); - $data = preg_replace("/\n\./", "\n..", $data); - - if (PEAR::isError($this->socket->write("DATA\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('354'))) { return new PEAR_Error('354 not received'); } - if (PEAR::isError($this->socket->write($data . "\r\n.\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function data($data) { + $data = preg_replace("/([^\r]{1})\n/", "\\1\r\n", $data); + $data = preg_replace("/\n\n/", "\n\r\n", $data); + $data = preg_replace("/\n\./", "\n..", $data); + + if (PEAR::isError($this->socket->write("DATA\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('354'))) { return new PEAR_Error('354 not received'); } + if (PEAR::isError($this->socket->write($data . "\r\n.\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Send the SEND FROM: command. - * + * * @param string The reverse path to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function send_from($reverse_path) { - if (PEAR::isError($this->socket->write("SEND FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function send_from($reverse_path) { + if (PEAR::isError($this->socket->write("SEND FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Send the SOML FROM: command. - * + * * @param string The reverse path to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function soml_from($reverse_path) { - if (PEAR::isError($this->socket->write("SOML FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function soml_from($reverse_path) { + if (PEAR::isError($this->socket->write("SOML FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Send the SAML FROM: command. - * + * * @param string The reverse path to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function saml_from($reverse_path) { - if (PEAR::isError($this->socket->write("SAML FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function saml_from($reverse_path) { + if (PEAR::isError($this->socket->write("SAML FROM:<$reverse_path>\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Send the RSET command. - * + * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function rset() { - if (PEAR::isError($this->socket->write("RSET\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function rset() { + if (PEAR::isError($this->socket->write("RSET\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Send the VRFY command. - * + * * @param string The string to verify * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function vrfy($string) { - /* Note: 251 is also a valid response code */ - if (PEAR::isError($this->socket->write("VRFY $string\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function vrfy($string) { + /* Note: 251 is also a valid response code */ + if (PEAR::isError($this->socket->write("VRFY $string\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Send the NOOP command. - * + * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public */ - function noop() { - if (PEAR::isError($this->socket->write("NOOP\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } - - return true; - } - + function noop() { + if (PEAR::isError($this->socket->write("NOOP\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('250 OK not received'); } + + return true; + } + /** * Attempt to send the EHLO command and obtain a list of ESMTP * extensions available, and failing that just send HELO. - * + * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access private */ - function identifySender() { - if (PEAR::isError($this->socket->write("EHLO $this->localhost\r\n"))) { return new PEAR_Error('write to socket failed'); } - + function identifySender() { + if (PEAR::isError($this->socket->write("EHLO $this->localhost\r\n"))) { return new PEAR_Error('write to socket failed'); } + $extensions = array(); - if (!($this->validateAndParseResponse('250', $extensions))) { - if (PEAR::isError($this->socket->write("HELO $this->localhost\r\n"))) { return new PEAR_Error('write to socket failed'); } - if (!($this->validateResponse('250'))) { return new PEAR_Error('HELO not accepted', $this->code); } - return true; - } - - for ($i = 0; $i < count($extensions); $i++) { - $verb = strtok($extensions[$i], ' '); - $arguments = substr($extensions[$i], strlen($verb) + 1, strlen($extensions[$i]) - strlen($verb) - 2); - $this->esmtp[$verb] = $arguments; - } - return true; - } - + if (!($this->validateAndParseResponse('250', $extensions))) { + if (PEAR::isError($this->socket->write("HELO $this->localhost\r\n"))) { return new PEAR_Error('write to socket failed'); } + if (!($this->validateResponse('250'))) { return new PEAR_Error('HELO not accepted', $this->code); } + return true; + } + + for ($i = 0; $i < count($extensions); $i++) { + $verb = strtok($extensions[$i], ' '); + $arguments = substr($extensions[$i], strlen($verb) + 1, strlen($extensions[$i]) - strlen($verb) - 2); + $this->esmtp[$verb] = $arguments; + } + return true; + } + /** * Read a response from the server and see if the response code * matches what we are expecting. - * + * * @param int The response code we are expecting. * * @return boolean True if we get what we expect, false otherwise. * @access private */ - function validateResponse($code) { - while ($this->lastline = $this->socket->readLine()) { - $reply_code = strtok($this->lastline, ' '); - if (!(strcmp($code, $reply_code))) { - $this->code = $reply_code; - return true; - } else { - $reply_code = strtok($this->lastline, '-'); - if (strcmp($code, $reply_code)) { - $this->code = $reply_code; - return false; - } - } - } - + function validateResponse($code) { + while ($this->lastline = $this->socket->readLine()) { + $reply_code = strtok($this->lastline, ' '); + if (!(strcmp($code, $reply_code))) { + $this->code = $reply_code; + return true; + } else { + $reply_code = strtok($this->lastline, '-'); + if (strcmp($code, $reply_code)) { + $this->code = $reply_code; + return false; + } + } + } + return false; - } - + } + /** * Read a response from the server and see if the response code * matches what we are expecting. Also save the rest of the @@ -374,27 +374,27 @@ * @return boolean True if we get what we expect, false otherwise. * @access private */ - function validateAndParseResponse($code, &$arguments) { - $arguments = array(); - - while ($this->lastline = $this->socket->readLine()) { - $reply_code = strtok($this->lastline, ' '); - if (!(strcmp($code, $reply_code))) { - $arguments[] = substr($this->lastline, strlen($code) + 1, strlen($this->lastline) - strlen($code) - 1); - $this->code = $reply_code; - return true; - } else { - $reply_code = strtok($this->lastline, '-'); - if (strcmp($code, $reply_code)) { - $this->code = $reply_code; - return false; - } - } - $arguments[] = substr($this->lastline, strlen($code) + 1, strlen($this->lastline) - strlen($code) - 1); - } - + function validateAndParseResponse($code, &$arguments) { + $arguments = array(); + + while ($this->lastline = $this->socket->readLine()) { + $reply_code = strtok($this->lastline, ' '); + if (!(strcmp($code, $reply_code))) { + $arguments[] = substr($this->lastline, strlen($code) + 1, strlen($this->lastline) - strlen($code) - 1); + $this->code = $reply_code; + return true; + } else { + $reply_code = strtok($this->lastline, '-'); + if (strcmp($code, $reply_code)) { + $this->code = $reply_code; + return false; + } + } + $arguments[] = substr($this->lastline, strlen($code) + 1, strlen($this->lastline) - strlen($code) - 1); + } + return false; - } - + } + } -?> +?> \ No newline at end of file No revision No revision 1.2.2.3 +36 -4 php4/pear/PEAR/Command.php Index: Command.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Command.php 19 May 2002 11:16:07 -0000 1.2.2.2 +++ Command.php 9 Jul 2002 09:14:43 -0000 1.2.2.3 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Command.php,v 1.12 2002/05/12 21:09:03 ssb Exp $ +// $Id: Command.php,v 1.16 2002/06/02 23:59:41 ssb Exp $ require_once "PEAR.php"; @@ -28,6 +28,12 @@ $GLOBALS['_PEAR_Command_commandlist'] = array(); /** + * List of shortcuts to common commands. + * @var array shortcut => command + */ +$GLOBALS['_PEAR_Command_shortcuts'] = array(); + +/** * Array of command objects * @var array class => object */ @@ -82,7 +88,7 @@ * * - DON'T USE HTML! The text you return will be used from both Gtk, * web and command-line interfaces, so for now, keep everything to - * plain text. There may be a common (XML) markup format later. + * plain text. * * - DON'T USE EXIT OR DIE! Always use pear errors. From static * classes do PEAR::raiseError(), from other classes do @@ -105,6 +111,9 @@ if (empty($GLOBALS['_PEAR_Command_commandlist'])) { PEAR_Command::registerCommands(); } + if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) { + $command = $GLOBALS['_PEAR_Command_shortcuts'][$command]; + } $class = @$GLOBALS['_PEAR_Command_commandlist'][$command]; if (empty($class)) { return PEAR::raiseError("unknown command `$command'"); @@ -136,13 +145,17 @@ */ function &setFrontendClass($uiclass) { + if (is_object($GLOBALS['_PEAR_Command_uiobject']) && + strtolower($uiclass) == get_class($GLOBALS['_PEAR_Command_uiobject'])) { + return; + } $file = str_replace('_', '/', $uiclass) . '.php'; @include_once $file; if (class_exists(strtolower($uiclass))) { $obj = &new $uiclass; // quick test to see if this class implements a few of the most // important frontend methods - if (method_exists($obj, 'displayLine') && method_exists($obj, 'userConfirm')) { + if (method_exists($obj, 'userConfirm')) { $GLOBALS['_PEAR_Command_uiobject'] = &$obj; $GLOBALS['_PEAR_Command_uiclass'] = $uiclass; return $obj; @@ -211,6 +224,10 @@ $GLOBALS['_PEAR_Command_commandlist'][$command] = $class; $GLOBALS['_PEAR_Command_commanddesc'][$command] = $desc; } + $shortcuts = $GLOBALS['_PEAR_Command_objects'][$class]->getShortcuts(); + foreach ($shortcuts as $shortcut => $command) { + $GLOBALS['_PEAR_Command_shortcuts'][$shortcut] = $command; + } } return true; } @@ -232,6 +249,21 @@ } /** + * Get the list of command shortcuts. + * + * @return array shortcut => command + * + * @access public + */ + function getShortcuts() + { + if (empty($GLOBALS['_PEAR_Command_shortcuts'])) { + PEAR_Command::registerCommands(); + } + return $GLOBALS['_PEAR_Command_shortcuts']; + } + + /** * Compiles arguments for getopt. * * @param string $command command to get optstring for @@ -287,4 +319,4 @@ } } -?> \ No newline at end of file +?> 1.2.2.3 +120 -44 php4/pear/PEAR/Common.php Index: Common.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Common.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Common.php 19 May 2002 11:16:07 -0000 1.2.2.2 +++ Common.php 9 Jul 2002 09:14:43 -0000 1.2.2.3 @@ -17,14 +17,16 @@ // | Tomas V.V.Cox <cox****@idecn*****> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.58 2002/05/15 11:23:01 cox Exp $ +// $Id: Common.php,v 1.75 2002/06/19 23:38:45 cox Exp $ require_once 'PEAR.php'; require_once 'Archive/Tar.php'; require_once 'System.php'; require_once 'PEAR/Config.php'; -// {{{ globals +// {{{ constants and globals + +define('PEAR_COMMON_PACKAGE_NAME_PREG', '/^([A-Z][a-zA-Z0-9_]+|[a-z][a-z0-9_]+)$/'); /** * List of temporary files and directories registered by @@ -61,13 +63,13 @@ * Valid file roles * @var array */ -$GLOBALS['_PEAR_Common_file_roles'] = array('php','ext','test','doc','data','extsrc','script'); +$GLOBALS['_PEAR_Common_file_roles'] = array('php','ext','test','doc','data','src','script'); /** * Valid replacement types * @var array */ -$GLOBALS['_PEAR_Common_replacement_types'] = array('php-const', 'pear-config'); +$GLOBALS['_PEAR_Common_replacement_types'] = array('php-const', 'pear-config', 'package-info'); /** * Valid "provide" types @@ -128,8 +130,9 @@ */ function PEAR_Common() { - $this->PEAR(); + parent::PEAR(); $this->config = &PEAR_Config::singleton(); + $this->debug = $this->config->get('verbose'); } // }}} @@ -209,7 +212,7 @@ { if ($this->debug >= $level) { if (is_object($this->ui)) { - $this->ui->displayLine($msg); + $this->ui->log($msg); } else { print "$msg\n"; } @@ -254,6 +257,26 @@ // }}} + // {{{ _unIndent() + + function _unIndent($str) + { + // remove leading newlines + $str = preg_replace('/^[\r\n]+/', '', $str); + // find whitespace at the beginning of the first line + $indent_len = strspn($str, " \t"); + $indent = substr($str, 0, $indent_len); + $data = ''; + // remove the same amount of whitespace from following lines + foreach (explode("\n", $str) as $line) { + if (substr($line, 0, $indent_len) == $indent) { + $data .= substr($line, $indent_len) . "\n"; + } + } + return $data; + } + + // }}} // {{{ _element_start() /** @@ -422,10 +445,20 @@ case 'dep': // dependencies array index if (!$this->in_changelog) { - $this->d_i = (isset($this->d_i)) ? $this->d_i + 1 : 0; + $this->d_i++; $this->pkginfo['release_deps'][$this->d_i] = $attribs; } break; + case 'configureoptions': + if (!$this->in_changelog) { + $this->pkginfo['configure_options'] = array(); + } + break; + case 'configureoption': + if (!$this->in_changelog) { + $this->pkginfo['configure_options'][] = $attribs; + } + break; } } @@ -450,6 +483,7 @@ case 'name': switch ($this->prev_element) { case 'package': + // XXX should we check the package name here? $this->pkginfo['package'] = ereg_replace('[^a-zA-Z0-9._]', '_', $data); break; case 'maintainer': @@ -461,6 +495,7 @@ $this->pkginfo['summary'] = $data; break; case 'description': + $data = $this->_unIndent($this->cdata); $this->pkginfo['description'] = $data; break; case 'user': @@ -488,6 +523,9 @@ } break; case 'notes': + // try to "de-indent" release notes in case someone + // has been over-indenting their xml ;-) + $data = $this->_unIndent($this->cdata); if ($this->in_changelog) { $this->current_release['release_notes'] = $data; } else { @@ -508,7 +546,7 @@ $this->lib_sources[] = $data; break; case 'dep': - if ($data = trim($data)) { + if ($data && !$this->in_changelog) { $this->pkginfo['release_deps'][$this->d_i]['name'] = $data; } break; @@ -595,6 +633,7 @@ array_pop($this->element_stack); $spos = sizeof($this->element_stack) - 1; $this->current_element = ($spos > 0) ? $this->element_stack[$spos] : ''; + $this->cdata = ''; } // }}} @@ -636,17 +675,12 @@ function infoFromTgzFile($file) { if (!@is_file($file)) { - return $this->raiseError('tgz :: could not open file'); - } - if (substr($file, -4) == '.tar') { - $compress = false; - } else { - $compress = true; + return $this->raiseError("tgz :: could not open file \"$file\""); } - $tar = new Archive_Tar($file, $compress); + $tar = new Archive_Tar($file); $content = $tar->listContent(); if (!is_array($content)) { - return $this->raiseError('tgz :: could not get contents of package'); + return $this->raiseError("tgz :: could not get contents of package \"$file\""); } $xml = null; foreach ($content as $file) { @@ -708,6 +742,10 @@ */ function infoFromString($data) { + require_once('PEAR/Dependency.php'); + if ($error = PEAR_Dependency::checkExtension('xml')) { + return $this->raiseError($error); + } $xp = @xml_parser_create(); if (!$xp) { return $this->raiseError('Unable to create XML parser'); @@ -721,10 +759,13 @@ $this->pkginfo = array(); $this->current_element = false; $this->destdir = ''; + unset($this->dir_install); $this->pkginfo['filelist'] = array(); $this->filelist =& $this->pkginfo['filelist']; $this->dir_names = array(); $this->in_changelog = false; + $this->d_i = 0; + $this->cdata = ''; if (!xml_parse($xp, $data, 1)) { $code = xml_get_error_code($xp); @@ -843,6 +884,19 @@ } $ret .= "$indent </deps>\n"; } + if (isset($pkginfo['configure_options'])) { + $ret .= "$indent <configureoptions>\n"; + foreach ($pkginfo['configure_options'] as $c) { + $ret .= "$indent <configureoption name=\"". + htmlspecialchars($c['name']) . "\""; + if (isset($c['default'])) { + $ret .= " default=\"" . htmlspecialchars($c['default']) . "\""; + } + $ret .= " prompt=\"" . htmlspecialchars($c['prompt']) . "\""; + $ret .= "/>\n"; + } + $ret .= "$indent </configureoptions>\n"; + } if (isset($pkginfo['filelist'])) { $ret .= "$indent <filelist>\n"; foreach ($pkginfo['filelist'] as $file => $fa) { @@ -887,9 +941,9 @@ } // }}} - // {{{ _infoFromAny() + // {{{ infoFromAny() - function _infoFromAny($info) + function infoFromAny($info) { if (is_string($info) && file_exists($info)) { $tmp = substr($info, -4); @@ -898,13 +952,13 @@ } elseif ($tmp == '.tar' || $tmp == '.tgz') { $info = $this->infoFromTgzFile($info); } else { - $fp = fopen($params[0], "r"); + $fp = fopen($info, "r"); $test = fread($fp, 5); fclose($fp); if ($test == "<?xml") { - $info = $obj->infoFromDescriptionFile($info); + $info = $this->infoFromDescriptionFile($info); } else { - $info = $obj->infoFromTgzFile($info); + $info = $this->infoFromTgzFile($info); } } if (PEAR::isError($info)) { @@ -920,12 +974,12 @@ function validatePackageInfo($info, &$errors, &$warnings) { global $_PEAR_Common_maintainer_roles, - $_PEAR_Common_release_states, - $_PEAR_Common_dependency_types, - $_PEAR_Common_dependency_relations, - $_PEAR_Common_file_roles, - $_PEAR_Common_replacement_types; - if (PEAR::isError($info = $this->_infoFromAny($info))) { + $_PEAR_Common_release_states, + $_PEAR_Common_dependency_types, + $_PEAR_Common_dependency_relations, + $_PEAR_Common_file_roles, + $_PEAR_Common_replacement_types; + if (PEAR::isError($info = $this->infoFromAny($info))) { return $this->raiseError($info); } if (!is_array($info)) { @@ -1011,6 +1065,17 @@ $i++; } } + if (!empty($info['configure_options'])) { + $i = 1; + foreach ($info['configure_options'] as $c) { + if (empty($c['name'])) { + $errors[] = "configure option $i: missing name"; + } + if (empty($c['prompt'])) { + $errors[] = "configure option $i: missing prompt"; + } + } + } if (empty($info['filelist'])) { $errors[] = 'no files'; } else { @@ -1043,6 +1108,7 @@ } $contents = fread($fp, filesize($file)); $tokens = token_get_all($contents); +/* for ($i = 0; $i < sizeof($tokens); $i++) { list($token, $data) = $tokens[$i]; if (is_string($token)) { @@ -1052,6 +1118,7 @@ var_dump(rtrim($data)); } } +*/ $look_for = 0; $paren_level = 0; $bracket_level = 0; @@ -1066,12 +1133,11 @@ $declared_methods = array(); $used_classes = array(); $used_functions = array(); + $nodeps = array(); for ($i = 0; $i < sizeof($tokens); $i++) { list($token, $data) = $tokens[$i]; switch ($token) { - case '{': - $brace_level++; - continue 2; + case '{': $brace_level++; continue 2; case '}': $brace_level--; if ($current_class_level == $brace_level) { @@ -1103,25 +1169,31 @@ $declared_methods[$current_class][] = $data; } else { $current_function = $data; + $declared_functions[] = $current_function; } $current_function_level = $brace_level; - $declared_functions[] = $current_function; + $m = array(); } elseif ($look_for == T_NEW) { $used_classes[$data] = true; } $look_for = 0; continue 2; + case T_VARIABLE: + $look_for = 0; + continue 2; case T_COMMENT: if (preg_match('!^/\*\*\s!', $data)) { $lastphpdoc = $data; - //$j = $i; - //while ($tokens[$j][0] == T_WHITESPACE) $j++; - // the declaration that the phpdoc applies to - // is at $tokens[$j] now + if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) { + $nodeps = array_merge($nodeps, $m[1]); + } } continue 2; case T_DOUBLE_COLON: - $used_classes[$tokens[$i - 1][1]] = true; + $class = $tokens[$i - 1][1]; + if (strtolower($class) != 'parent') { + $used_classes[$class] = true; + } continue 2; } } @@ -1129,7 +1201,7 @@ "declared_classes" => $declared_classes, "declared_methods" => $declared_methods, "declared_functions" => $declared_functions, - "used_classes" => array_keys($used_classes), + "used_classes" => array_diff(array_keys($used_classes), $nodeps), ); } @@ -1141,25 +1213,30 @@ if (!function_exists("token_get_all")) { return false; } - if (PEAR::isError($info = $this->_infoFromAny($any))) { + if (PEAR::isError($info = $this->infoFromAny($any))) { return $this->raiseError($info); } if (!is_array($info)) { return false; } $deps = array(); - $used_c = $decl_c = array(); + $used_c = $decl_c = $decl_f = $decl_m = array(); foreach ($info['filelist'] as $file => $fa) { $tmp = $this->analyzeSourceCode($file); $used_c = @array_merge($used_c, $tmp['used_classes']); $decl_c = @array_merge($decl_c, $tmp['declared_classes']); + $decl_f = @array_merge($decl_f, $tmp['declared_functions']); + $decl_m = @array_merge($decl_m, $tmp['declared_methods']); } $used_c = array_unique($used_c); $decl_c = array_unique($decl_c); $undecl_c = array_diff($used_c, $decl_c); return array('used_classes' => $used_c, 'declared_classes' => $decl_c, - 'undeclared_classes' => $undecl_c); + 'declared_methods' => $decl_m, + 'declared_functions' => $decl_f, + 'undeclared_classes' => $undecl_c, + ); } // }}} @@ -1247,7 +1324,7 @@ } // }}} - // {{{ getReplacementTypes() + // {{{ getProvideTypes() /** * Get the implemented file replacement types in @@ -1261,7 +1338,7 @@ } // }}} - // {{{ getReplacementTypes() + // {{{ getScriptPhases() /** * Get the implemented file replacement types in @@ -1288,7 +1365,7 @@ */ function validPackageName($name) { - return (bool)preg_match('/^[A-Z][A-Za-z0-9_]+$/', $name); + return (bool)preg_match(PEAR_COMMON_PACKAGE_NAME_PREG, $name); } @@ -1448,7 +1525,6 @@ if ($callback) { call_user_func($callback, 'done', $bytes); } - // callback: done! return $dest_file; } 1.2.2.3 +212 -24 php4/pear/PEAR/Config.php Index: Config.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Config.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Config.php 19 May 2002 11:16:07 -0000 1.2.2.2 +++ Config.php 9 Jul 2002 09:14:43 -0000 1.2.2.3 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.19 2002/05/14 17:59:41 cox Exp $ +// $Id: Config.php,v 1.32 2002/06/21 06:08:54 ssb Exp $ require_once 'PEAR.php'; @@ -26,10 +26,6 @@ */ $GLOBALS['_PEAR_Config_instance'] = null; -define('PEAR_CONFIG_DEFAULT_DOCDIR', - PHP_DATADIR.DIRECTORY_SEPARATOR.'doc'.DIRECTORY_SEPARATOR.'pear'); -define('PEAR_DEFAULT_UMASK', umask()); - // in case a --without-pear PHP installation is used if (!defined('PEAR_INSTALL_DIR')) { define('PEAR_INSTALL_DIR', PHP_LIBDIR); @@ -38,6 +34,40 @@ define('PEAR_EXTENSION_DIR', PHP_EXTENSION_DIR); } +define('PEAR_CONFIG_DEFAULT_BINDIR', + PHP_BINDIR); +define('PEAR_CONFIG_DEFAULT_DOCDIR', + PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs'); +if (@is_dir(PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib')) { + define('PEAR_CONFIG_DEFAULT_PHPDIR', + PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib'); +} else { + define('PEAR_CONFIG_DEFAULT_PHPDIR', + PEAR_INSTALL_DIR); +} +define('PEAR_CONFIG_DEFAULT_DATADIR', + PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data'); +define('PEAR_CONFIG_DEFAULT_TESTDIR', + PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests'); +if (@is_dir(PHP_SYSCONFDIR)) { + define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR); +} else { + // real bootstrapping nightmare + if (OS_WINDOWS) { + if (@is_dir(PHP_CONFIG_FILE_PATH)) { + define('PEAR_CONFIG_SYSCONFDIR', PHP_CONFIG_FILE_PATH); + } elseif (@is_dir('c:\winnt') && @file_exists('c:\winnt\php.ini')) { + define('PEAR_CONFIG_SYSCONFDIR', 'c:\winnt'); + } elseif (@is_dir('c:\windows') && @file_exists('c:\windows\php.ini')) { + define('PEAR_CONFIG_SYSCONFDIR', 'c:\windows'); + } + } + if (!defined('PEAR_CONFIG_SYSCONFDIR')) { + define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR); + } +} +define('PEAR_DEFAULT_UMASK', umask()); + /** * This is a class for storing configuration data, keeping track of * which are system-defined, user-defined or defaulted. @@ -84,63 +114,106 @@ * @var array layer => array(infotype => value, ...) */ var $configuration_info = array( + // Internet Access 'master_server' => array( 'type' => 'string', 'default' => 'pear.php.net', 'doc' => 'name of the main PEAR server', + 'prompt' => 'PEAR server', + 'group' => 'Internet Access', ), + 'http_proxy' => array( + 'type' => 'string', + 'default' => '', + 'doc' => 'HTTP proxy (host:port) to use when downloading packages', + 'prompt' => 'HTTP Proxy Server Address', + 'group' => 'Internet Access', + ), + // File Locations 'php_dir' => array( 'type' => 'directory', - 'default' => PEAR_INSTALL_DIR, + 'default' => PEAR_CONFIG_DEFAULT_PHPDIR, 'doc' => 'directory where .php files are installed', + 'prompt' => 'PEAR directory', + 'group' => 'File Locations', ), 'ext_dir' => array( 'type' => 'directory', 'default' => PEAR_EXTENSION_DIR, 'doc' => 'directory where loadable extensions are installed', + 'prompt' => 'PHP extension directory', + 'group' => 'File Locations', ), 'doc_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_DOCDIR, 'doc' => 'directory where documentation is installed', + 'prompt' => 'PEAR documentation directory', + 'group' => 'File Locations', ), 'bin_dir' => array( 'type' => 'directory', - 'default' => PHP_BINDIR, + 'default' => PEAR_CONFIG_DEFAULT_BINDIR, 'doc' => 'directory where executables are installed', + 'prompt' => 'PEAR executables directory', + 'group' => 'File Locations', + ), + 'data_dir' => array( + 'type' => 'directory', + 'default' => PEAR_CONFIG_DEFAULT_DATADIR, + 'doc' => 'directory where data files are installed', + 'prompt' => 'PEAR data directory', + 'group' => 'File Locations (Advanced)', ), + 'test_dir' => array( + 'type' => 'directory', + 'default' => PEAR_CONFIG_DEFAULT_TESTDIR, + 'doc' => 'directory where regression tests are installed', + 'prompt' => 'PEAR test directory', + 'group' => 'File Locations (Advanced)', + ), + // Maintainers 'username' => array( 'type' => 'string', 'default' => '', 'doc' => '(maintainers) your PEAR account name', + 'prompt' => 'PEAR username (for maintainers)', + 'group' => 'Maintainers', ), 'password' => array( 'type' => 'password', 'default' => '', 'doc' => '(maintainers) your PEAR account password', + 'prompt' => 'PEAR password (for maintainers)', + 'group' => 'Maintainers', ), + // Advanced 'verbose' => array( 'type' => 'integer', 'default' => 1, - 'doc' => 'verbosity level', + 'doc' => 'verbosity level +0: really quiet +1: somewhat quiet +2: verbose +3: debug', + 'prompt' => 'Debug Log Level', + 'group' => 'Advanced', ), 'preferred_state' => array( 'type' => 'set', 'default' => 'stable', - 'doc' => 'the installer will prefer releases with this state -when installing packages without a version or state specified', + 'doc' => 'the installer will prefer releases with this state when installing packages without a version or state specified', 'valid_set' => array( - 'stable', 'beta', 'alpha', 'devel', 'snapshot', 'any'), - ), - 'http_proxy' => array( - 'type' => 'string', - 'default' => '', - 'doc' => 'HTTP proxy (host:port) to use when downloading packages', + 'stable', 'beta', 'alpha', 'devel', 'snapshot'), + 'prompt' => 'Preferred Package State', + 'group' => 'Advanced', ), 'umask' => array( - 'type' => 'int', + 'type' => 'mask', 'default' => PEAR_DEFAULT_UMASK, 'doc' => 'umask used when creating files (Unix-like systems only)', + 'prompt' => 'Unix file mask', + 'group' => 'Advanced', ), /* 'testset1' => array( @@ -172,16 +245,16 @@ $sl = DIRECTORY_SEPARATOR; if (empty($user_file)) { if (OS_WINDOWS) { - $user_file = PHP_SYSCONFDIR . $sl . 'pear.ini'; + $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini'; } else { $user_file = getenv('HOME') . $sl . '.pearrc'; } } if (empty($system_file)) { if (OS_WINDOWS) { - $system_file = PHP_SYSCONFDIR . $sl . 'pearsys.ini'; + $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini'; } else { - $system_file = PHP_SYSCONFDIR . $sl . 'pear.conf'; + $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf'; } } $this->layers = array_keys($this->configuration); @@ -379,12 +452,13 @@ } $size = filesize($file); $contents = fread($fp, $size); + fclose($fp); $version = '0.1'; if (preg_match('/^#PEAR_Config\s+(\S+)\s+/si', $contents, $matches)) { $version = $matches[1]; $contents = substr($contents, strlen($matches[0])); } - if (version_compare($version, '1', '<')) { + if (version_compare("$version", '1', '<')) { $data = unserialize($contents); if (!is_array($data)) { if (strlen(trim($contents)) > 0) { @@ -432,6 +506,10 @@ $data[$key] = base64_encode($data[$key]); break; } + case 'mask': { + $data[$key] = octdec($data[$key]); + break; + } } } return true; @@ -466,6 +544,10 @@ $data[$key] = base64_decode($data[$key]); break; } + case 'mask': { + $data[$key] = decoct($data[$key]); + break; + } } } return true; @@ -524,10 +606,9 @@ } extract($this->configuration_info[$key]); switch ($type) { - case 'integer': { + case 'integer': $value = (int)$value; break; - } case 'set': { // If a valid_set is specified, require the value to // be in the set. If there is no valid_set, accept @@ -535,7 +616,7 @@ if ($valid_set) { reset($valid_set); if ((key($valid_set) === 0 && !in_array($value, $valid_set)) || - empty($valid_set[$value])) + (key($valid_set) !== 0 && empty($valid_set[$value]))) { return false; } @@ -589,6 +670,90 @@ } return false; } + // }}} + // {{{ getPrompt(key) + + /** + * Get the short documentation for a config value. + * + * @param string config key + * + * @return string short documentation string + * + * @access public + * + */ + function getPrompt($key) + { + if (isset($this->configuration_info[$key])) { + return $this->configuration_info[$key]['prompt']; + } + return false; + } + // }}} + // {{{ getGroup(key) + + /** + * Get the parameter group for a config key. + * + * @param string config key + * + * @return string parameter group + * + * @access public + * + */ + function getGroup($key) + { + if (isset($this->configuration_info[$key])) { + return $this->configuration_info[$key]['group']; + } + return false; + } + + // }}} + // {{{ getGroups() + + /** + * Get the list of parameter groups. + * + * @return array list of parameter groups + * + * @access public + * + */ + function getGroups() + { + $tmp = array(); + foreach ($this->configuration_info as $key => $info) { + $tmp[$info['group']] = 1; + } + return array_keys($tmp); + } + + // }}} + // {{{ getGroupKeys() + + /** + * Get the list of the parameters in a group. + * + * @param string $group parameter group + * + * @return array list of parameters in $group + * + * @access public + * + */ + function getGroupKeys($group) + { + $keys = array(); + foreach ($this->configuration_info as $key => $info) { + if ($info['group'] == $group) { + $keys[] = $key; + } + } + return $keys; + } // }}} // {{{ getSetValues(key) @@ -658,6 +823,29 @@ { if (isset($this->configuration[$layer][$key])) { unset($this->configuration[$layer][$key]); + return true; + } + return false; + } + + // }}} + // {{{ removeLayer(layer) + + /** + * Temporarily remove an entire config layer. USE WITH CARE! + * + * @param string config key + * + * @param string (optional) config layer + * + * @return bool TRUE on success, FALSE on failure + * + * @access public + */ + function removeLayer($layer) + { + if (isset($this->configuration[$layer])) { + unset($this->configuration[$layer]); return true; } return false; 1.2.2.2 +15 -11 php4/pear/PEAR/Dependency.php Index: Dependency.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Dependency.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- Dependency.php 19 May 2002 11:16:07 -0000 1.2.2.1 +++ Dependency.php 9 Jul 2002 09:14:43 -0000 1.2.2.2 @@ -17,7 +17,7 @@ // | Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Dependency.php,v 1.8 2002/05/12 14:53:54 ssb Exp $ +// $Id: Dependency.php,v 1.13 2002/06/19 23:38:46 cox Exp $ /** * Methods for dependencies check. Based on Stig's dependencies RFC @@ -90,6 +90,9 @@ */ function checkPackage($name, $req = null, $relation = 'has') { + if (substr($relation, 0, 2) == "v.") { + $relation = substr($relation, 2); + } switch ($relation) { case 'has': if (!$this->registry->packageExists($name)) { @@ -108,10 +111,13 @@ case 'ge': case 'gt': $version = $this->registry->packageInfo($name, 'version'); - if (!version_compare($version, $req, $relation)) { + if (!$this->registry->packageExists($name) + || !version_compare("$version", "$req", $relation)) + { return "requires package `$name' " . - $this->signOperator($relation) . " $req"; + $this->signOperator($relation) . " $req"; } + return false; } return "Relation '$relation' with requirement '$req' is not supported (name=$name)"; } @@ -128,11 +134,8 @@ function checkExtension($name, $req = null, $relation = 'has') { // XXX (ssb): could we avoid loading the extension here? - if (!extension_loaded($name)) { - $dlext = OS_WINDOWS ? '.dll' : '.so'; - if (!@dl($name . $dlext)) { - return "'$name' PHP extension is not installed"; - } + if (!PEAR::loadExtension($name)) { + return "'$name' PHP extension is not installed"; } if ($relation == 'has') { return false; @@ -140,7 +143,8 @@ if (substr($relation, 0, 2) == 'v.') { $ext_ver = phpversion($name); $operator = substr($relation, 2); - if (!version_compare($ext_ver, $req, $operator)) { + // Force params to be strings, otherwise the comparation will fail (ex. 0.9==0.90) + if (!version_compare("$ext_ver", "$req", $operator)) { return "'$name' PHP extension version " . $this->signOperator($operator) . " $req is required"; } @@ -180,7 +184,7 @@ if (substr($relation, 0, 2) == 'v.') { $php_ver = phpversion(); $operator = substr($relation, 2); - if (!version_compare($php_ver, $req, $operator)) { + if (!version_compare("$php_ver", "$req", $operator)) { return "PHP version " . $this->signOperator($operator) . " $req is required"; } @@ -254,4 +258,4 @@ } } -?> \ No newline at end of file +?> 1.2.2.4 +131 -53 php4/pear/PEAR/Installer.php Index: Installer.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Installer.php,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- Installer.php 19 May 2002 11:16:07 -0000 1.2.2.3 +++ Installer.php 9 Jul 2002 09:14:43 -0000 1.2.2.4 @@ -17,16 +17,26 @@ // | Tomas V.V.Cox <cox****@idecn*****> | // +----------------------------------------------------------------------+ // -// $Id: Installer.php,v 1.56 2002/05/19 06:19:26 ssb Exp $ +// $Id: Installer.php,v 1.70 2002/06/19 23:38:46 cox Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Registry.php'; require_once 'PEAR/Dependency.php'; +define('PEAR_INSTALLER_OK', 1); +define('PEAR_INSTALLER_FAILED', 0); +define('PEAR_INSTALLER_SKIPPED', -1); + /** * Administration class used to install PEAR packages and maintain the * installed package database. * + * TODO: + * - Check dependencies break on package uninstall (when no force given) + * - add a guessInstallDest() method with the code from _installFile() and + * use that method in Registry::_rebuildFileMap() & Command_Registry::doList(), + * others.. + * * @since PHP 4.0.2 * @author Stig Bakken <ssb****@fast*****> */ @@ -122,12 +132,12 @@ } $path = $props['installed_as']; if (!@unlink($path)) { - $this->log(1, "unable to delete: $path"); + $this->log(2, "unable to delete: $path"); } else { - $this->log(1, "deleted file $path"); + $this->log(2, "deleted file $path"); // Delete package directory if it's empty if (@rmdir(dirname($path))) { - $this->log(2, "+ rmdir $path"); + $this->log(3, "+ rmdir $path"); } } } @@ -147,40 +157,35 @@ } // return if this file is meant for another platform if (!$os->matchSignature($atts['platform'])) { - $this->log(1, "skipped $file (meant for $atts[platform], we are ".$os->getSignature().")"); - return; + $this->log(2, "skipped $file (meant for $atts[platform], we are ".$os->getSignature().")"); + return PEAR_INSTALLER_SKIPPED; } } switch ($atts['role']) { - case 'test': case 'data': case 'ext': - // don't install test files for now - $this->log(2, "$file: $atts[role] file not installed yet"); - return true; case 'doc': - $dest_dir = $this->config->get('doc_dir') . - DIRECTORY_SEPARATOR . $this->pkginfo['package']; + case 'data': + case 'test': + $dest_dir = $this->config->get($atts['role'] . '_dir') . + DIRECTORY_SEPARATOR . $this->pkginfo['package']; + unset($atts['baseinstalldir']); break; - case 'extsrc': - // don't install test files for now - $this->log(2, "$file: no support for building extensions yet"); - return true; + case 'ext': case 'php': - $dest_dir = $this->config->get('php_dir'); + $dest_dir = $this->config->get($atts['role'] . '_dir'); break; - case 'script': { + case 'script': $dest_dir = $this->config->get('bin_dir'); break; - } + case 'src': + case 'extsrc': + $this->source_files++; + return; default: - break; + // Files with no role will end in "/" + return $this->raiseError("Invalid role `$atts[role]' for file $file"); } - if (!isset($atts['baseinstalldir']) || - $atts['baseinstalldir'] == '/' || - $atts['baseinstalldir'] == DIRECTORY_SEPARATOR) { - $atts['baseinstalldir'] = ''; - } - if (!empty($atts['baseinstalldir']) && $atts['role'] != 'doc') { + if (!empty($atts['baseinstalldir'])) { $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir']; } if (dirname($file) != '.' && empty($atts['install-as'])) { @@ -191,21 +196,27 @@ } else { $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as']; } - $dest_file = preg_replace('!//+!', '/', $dest_file); + $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file; + + // Clean up the DIRECTORY_SEPARATOR mess + $ds2 = str_repeat(DIRECTORY_SEPARATOR, 2); + list($dest_file, $orig_file) = preg_replace(array('!\\\\!', '!/!', "!$ds2+!"), + DIRECTORY_SEPARATOR, + array($dest_file, $orig_file)); + $dest_dir = dirname($dest_file); if (!@is_dir($dest_dir)) { if (!$this->mkDirHier($dest_dir)) { - $this->log(0, "failed to mkdir $dest_dir"); - return false; + return $this->raiseError("failed to mkdir $dest_dir", + PEAR_INSTALLER_FAILED); } - $this->log(2, "+ mkdir $dest_dir"); + $this->log(3, "+ mkdir $dest_dir"); } - $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file; if (empty($atts['replacements'])) { if (!@copy($orig_file, $dest_file)) { - $this->log(0, "failed to copy $orig_file to $dest_file"); - return false; + return $this->raiseError("failed to copy $orig_file to $dest_file", + PEAR_INSTALLER_FAILED); } - $this->log(2, "+ cp $orig_file $dest_file"); + $this->log(3, "+ cp $orig_file $dest_file"); } else { $fp = fopen($orig_file, "r"); $contents = fread($fp, filesize($orig_file)); @@ -222,30 +233,32 @@ } } elseif ($a['type'] == 'pear-config') { $to = $this->config->get($a['to']); + } elseif ($a['type'] == 'package-info') { + $to = $this->pkginfo[$a['to']]; } if ($to) { - $subst_from = $a['from']; - $subst_to = $to; + $subst_from[] = $a['from']; + $subst_to[] = $to; } } - $this->log(1, "doing ".sizeof($subst_from)." substitution(s) for $dest_file"); + $this->log(2, "doing ".sizeof($subst_from)." substitution(s) for $dest_file"); if (sizeof($subst_from)) { $contents = str_replace($subst_from, $subst_to, $contents); } $wp = @fopen($dest_file, "w"); if (!is_resource($wp)) { - $this->log(0, "failed to create $dest_file"); - return false; + return $this->raiseError("failed to create $dest_file", + PEAR_INSTALLER_FAILED); } fwrite($wp, $contents); fclose($wp); } if (!OS_WINDOWS) { if ($atts['role'] == 'script') { - $mode = 0777 & ~$this->config->get('umask'); - $this->log(2, "+ chmod +x $dest_file"); + $mode = 0777 & ~(int)octdec($this->config->get('umask')); + $this->log(3, "+ chmod +x $dest_file"); } else { - $mode = 0666 & ~$this->config->get('umask'); + $mode = 0666 & ~(int)octdec($this->config->get('umask')); } if (!@chmod($dest_file, $mode)) { $this->log(0, "failed to change mode of $dest_file"); @@ -255,8 +268,8 @@ // Store the full path where the file was installed for easy unistall $this->pkginfo['filelist'][$file]['installed_as'] = $dest_file; - $this->log(1, "installed file $dest_file"); - return true; + $this->log(2, "installed file $dest_file"); + return PEAR_INSTALLER_OK; } // }}} @@ -349,7 +362,7 @@ } $this->log(2, '+ tmp dir created at ' . $tmpdir); - $tar = new Archive_Tar($pkgfile, true); + $tar = new Archive_Tar($pkgfile); if (!@$tar->extract($tmpdir)) { return $this->raiseError("unable to unpack $pkgfile"); } @@ -382,11 +395,17 @@ if (PEAR::isError($pkginfo)) { return $pkginfo; } + $this->validatePackageInfo($pkginfo, $errors, $warnings); + // XXX We allow warnings, have we to do it? + if (count($errors)) { + return $this->raiseError("The following errors where found:\n". + implode("\n", $errors)); + } $pkgname = $pkginfo['package']; // Check dependencies ------------------------------------------- - if (isset($pkginfo['release_deps']) && !isset($options['nodeps'])) { + if (isset($pkginfo['release_deps']) && empty($options['nodeps'])) { $error = $this->checkDeps($pkginfo); if ($error) { if (empty($options['soft'])) { @@ -402,14 +421,14 @@ return $this->raiseError("$pkgname already installed"); } } else { - // check to do only when upgrading packages + // checks to do only when upgrading packages if (!$this->registry->packageExists($pkgname)) { return $this->raiseError("$pkgname not installed"); } $v1 = $this->registry->packageInfo($pkgname, 'version'); $v2 = $pkginfo['version']; - $cmp = version_compare($v1, $v2, 'gt'); - if (empty($options['force']) && !version_compare($v2, $v1, 'gt')) { + $cmp = version_compare("$v1", "$v2", 'gt'); + if (empty($options['force']) && !version_compare("$v2", "$v1", 'gt')) { return $this->raiseError("upgrade to a newer version ($v2 is not newer than $v1)"); } if (empty($options['register-only'])) { @@ -423,7 +442,10 @@ // Copy files to dest dir --------------------------------------- // info from the package it self we want to access from _installFile - $this->pkginfo = $pkginfo; + $this->pkginfo = &$pkginfo; + // used to determine whether we should build any C code + $this->source_files = 0; + if (empty($options['register-only'])) { if (!is_dir($this->config->get('php_dir'))) { return $this->raiseError("no script destination directory\n", @@ -445,7 +467,47 @@ // <== XXX This part should be removed later on foreach ($pkginfo['filelist'] as $file => $atts) { - $this->_installFile($file, $atts, $tmp_path); + $this->expectError(PEAR_INSTALLER_FAILED); + $res = $this->_installFile($file, $atts, $tmp_path); + $this->popExpect(); + if (PEAR::isError($res)) { + if (empty($options['force'])) { + return $this->raiseError($res); + } else { + $this->log(0, "Warning: " . $res->getMessage()); + } + } + if ($res != PEAR_INSTALLER_OK) { + // Do not register files that were not installed + unset($pkginfo['filelist'][$file]); + } + } + + if ($this->source_files > 0 && empty($options['nobuild'])) { + $this->log(1, "$this->source_files source files, building"); + $bob = &new PEAR_Builder($this->ui); + $bob->debug = $this->debug; + $built = $bob->build($descfile, array(&$this, '_buildCallback')); + if (PEAR::isError($built)) { + return $built; + } + foreach ($built as $ext) { + $bn = basename($ext['file']); + $this->log(2, "installing $bn"); + $dest = $this->config->get('ext_dir') . + DIRECTORY_SEPARATOR . $bn; + $this->log(3, "+ cp $ext[file] ext_dir"); + if (!@copy($ext['file'], $dest)) { + return $this->raiseError("failed to copy $bn to $dest"); + } + $pkginfo['filelist'][$bn] = array( + 'role' => 'ext', + 'installed_as' => $dest, + 'php_api' => $ext['php_api'], + 'zend_mod_api' => $ext['zend_mod_api'], + 'zend_ext_api' => $ext['zend_ext_api'], + ); + } } } @@ -455,9 +517,9 @@ if (!empty($options['force']) && $this->registry->packageExists($pkgname)) { $this->registry->deletePackage($pkgname); } - $ret = $this->registry->addPackage($pkgname, $this->pkginfo); + $ret = $this->registry->addPackage($pkgname, $pkginfo); } else { - $ret = $this->registry->updatePackage($pkgname, $this->pkginfo, false); + $ret = $this->registry->updatePackage($pkgname, $pkginfo, false); } if (!$ret) { return null; @@ -515,6 +577,22 @@ case 'done': $this->log(1, '...done: ' . number_format($params, 0, '', ',') . ' bytes'); break; + } + if (method_exists($this->ui, '_downloadCallback')) + $this->ui->_downloadCallback($msg, $params); + } + + // }}} + // {{{ _buildCallback() + + function _buildCallback($what, $data) + { + switch ($what) { + + } + if (($what == 'cmdoutput' && $this->debug > 1) || + ($what == 'output' && $this->debug > 0)) { + $this->ui->outputData(rtrim($data), 'build'); } } 1.2.2.1 +186 -2 php4/pear/PEAR/Registry.php Index: Registry.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Registry.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- Registry.php 29 Apr 2002 02:33:42 -0000 1.2 +++ Registry.php 9 Jul 2002 09:14:43 -0000 1.2.2.1 @@ -14,10 +14,18 @@ // | licen****@php***** so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Stig Bakken <ssb****@fast*****> | +// | Tomas V.V.Cox <cox****@idecn*****> | +// | | // +----------------------------------------------------------------------+ // -// $Id: Registry.php,v 1.26 2002/04/24 00:48:06 ssb Exp $ +// $Id: Registry.php,v 1.31 2002/06/19 23:38:47 cox Exp $ +/* +TODO: + - Transform into singleton() + - Add application level lock (avoid change the registry from the cmdline + while using the GTK interface, for ex.) +*/ require_once "System.php"; require_once "PEAR.php"; @@ -208,7 +216,7 @@ */ function _lock($mode = LOCK_EX) { - if(!strstr(php_uname(), 'Windows 95/98')) { + if(!strstr(php_uname(), 'Windows 95/98')) { if ($mode != LOCK_UN && is_resource($this->lock_fp)) { // XXX does not check type of lock (LOCK_SH/LOCK_EX) return true; @@ -224,7 +232,11 @@ } $open_mode = 'r'; } + + @ini_set('track_errors', true); $this->lock_fp = @fopen($this->lockfile, $open_mode); + @ini_restore('track_errors'); + if (!is_resource($this->lock_fp)) { return $this->raiseError("could not create lock file: $php_errormsg"); } @@ -417,6 +429,178 @@ } // }}} + + /** + Experimental dependencies database handling functions (not yet in production) + + TODO: + - test it + - Think on the "not" dep relation. It's supposed that a package can't + be installed if conflicts with another. The problem comes when the + user forces the installation and later upgrades it + **/ + + // XXX Terrible slow, a lot of read, lock, write, unlock + function rebuildDepsFile() + { + // Init the file with empty data + $error = $this->_depWriteDepDB(array()); + if (PEAR::isError($error)) { + return $error; + } + $packages = $this->listPackages(); + foreach ($packages as $package) { + $deps = $this->packageInfo($package, 'release_deps'); + $error = $this->setPackageDep($package, $deps); + if (PEAR::isError($error)) { + return $error; + } + } + return true; + } + + function &_depGetDepDB() + { + if (!$fp = fopen($this->depfile, 'r')) { + return $this->raiseError("Could not open dependencies file `".$this->depfile."'"); + } + $data = fread($fp, filesize($this->depfile)); + fclose($fp); + return unserialize($data); + } + + function _depWriteDepDB(&$deps) + { + if (PEAR::isError($e = $this->_lock(LOCK_EX))) { + return $e; + } + if (!$fp = fopen($this->depfile, 'w')) { + $this->_unlock(); + return $this->raiseError("Could not open dependencies file `".$this->depfile."' for writting"); + } + fwrite($fp, serialize($deps)); + fclose($fp); + $this->_unlock(); + return true; + } + + /* + The data structure is as follows: + $dep_db = array( + // Other packages depends in some manner on this packages + 'deps' => array( + 'Package Name' => array( + 0 => array( + // This package depends on 'Package Name' + 'depend' => 'Package', + // Which version 'Package' needs of 'Package Name' + 'version' => '1.0', + // The requirement (version_compare() operator) + 'rel' => 'ge' + ), + ), + ) + // This packages are dependant on other packages + 'pkgs' => array( + 'Package Dependant' => array( + // This is a index list with paths over the 'deps' array for quick + // searching things like "what dependecies has this package?" + // $dep_db['deps']['Package Name'][3] + 'Package Name' => 3 // key in array ['deps']['Package Name'] + ), + ) + ) + + Note: It only supports package dependencies no other type + */ + + function removePackageDep($package) + { + $data = &$this->_depGetDepDB(); + if (PEAR::isError($data)) { + return $data; + } + // Other packages depends on this package, can't be removed + if (isset($data['deps'][$package])) { + return $data['deps'][$package]; + } + // The package depends on others, remove those dependencies + if (isset($data['pkgs'][$package])) { + foreach ($data['pkgs'][$package] as $pkg => $key) { + // remove the dependency + unset($data['deps'][$pkg][$key]); + // if no more dependencies, remove the subject too + if (!count($data['deps'][$pkg])) { + unset($data['deps'][$pkg]); + } + } + // remove the package from the index list + unset($data['pkgs'][$package]); + } + return $this->_depWriteDepDB(); + } + + /** + * Update or insert a the dependencies of a package, prechecking + * that the package won't break any dependency in the process + */ + function setPackageDep($package, $new_version, $rel_deps = array()) + { + $data = &$this->_depGetDepDB(); + if (PEAR::isError($deps)) { + return $deps; + } + // Other packages depend on this package, check deps. Mostly for + // handling uncommon cases like: + // <dep type='pkg' rel='lt' version='1.0'>Foo</dep> and we are trying to + // update Foo to version 2.0 + if (isset($data['deps'][$package])) { + foreach ($data['deps'][$package] as $dep) { + $require = $dep['version']; + $relation = $dep['rel']; + // XXX (cox) Possible problem with changes in the way + // PEAR_Dependency::checkPackage() works + if ($relation != 'has') { + if (!version_compare("$new_version", "$require", $relation)) { + $fails[] = $dep; + } + } + } + if (isset($fails)) { + return $fails; + } + } + + // This package has no dependencies + if (!is_array($rel_deps) || !count($rel_deps)) { + return true; + } + + // The package depends on others, register that + foreach ($rel_deps as $dep) { + // We only support deps of type 'pkg's + if ($dep && $dep['type'] == 'pkg' && isset($dep['name'])) { + $write = array('depend' => $package, + 'version' => $dep['version'], + 'rel' => $dep['rel']); + settype($data['deps'][$dep['name']], 'array'); + + // The dependency already exists, update it + if (isset($data['pkgs'][$package][$dep['name']])) { + $key = $data['pkgs'][$package][$dep['name']]; + $data['deps'][$dep['name']][$key] = $write; + + // New dependency, insert it + } else { + $data['deps'][$dep['name']][] = $write; + $key = key($data['deps'][$dep['name']]); + settype($data['pkgs'][$package], 'array'); + $data['pkgs'][$package][$dep['name']] = $key; + } + } + } + return $this->_depWriteDepDB($data); + } } ?> 1.2.2.3 +31 -12 php4/pear/PEAR/Remote.php Index: Remote.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Remote.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Remote.php 19 May 2002 11:16:07 -0000 1.2.2.2 +++ Remote.php 9 Jul 2002 09:14:43 -0000 1.2.2.3 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.19 2002/05/14 01:51:06 ssb Exp $ +// $Id: Remote.php,v 1.28 2002/06/17 10:58:34 ssb Exp $ require_once 'PEAR.php'; require_once 'PEAR/Config.php'; @@ -24,6 +24,10 @@ /** * This is a class for doing remote operations against the central * PEAR database. + * + * @nodep XML_RPC_Value + * @nodep XML_RPC_Message + * @nodep XML_RPC_Client */ class PEAR_Remote extends PEAR { @@ -59,12 +63,16 @@ $server_host = $this->config->get('master_server'); $username = $this->config->get('username'); $password = $this->config->get('password'); - $f = new XML_RPC_Message($method, $this->_encode($args)); + $eargs = array(); + foreach($args as $arg) $eargs[] = $this->_encode($arg); + $f = new XML_RPC_Message($method, $eargs); $c = new XML_RPC_Client('/xmlrpc.php', $server_host, 80); if ($username && $password) { $c->setCredentials($username, $password); } - $c->setDebug(1); + if ($this->config->get('verbose') >= 3) { + $c->setDebug(1); + } $r = $c->send($f); if (!$r) { return $this->raiseError("XML_RPC send failed"); @@ -73,6 +81,7 @@ if ($e = $r->faultCode()) { return $this->raiseError($r->faultString(), $e); } + return XML_RPC_decode($v); } @@ -104,7 +113,7 @@ if (extension_loaded("xmlrpc")) { break; } - return $this->raiseError("xmlrpc extension not loaded"); + return $this->raiseError("unable to load xmlrpc extension"); } while (false); $params = func_get_args(); array_shift($params); @@ -130,6 +139,12 @@ $tmp = base64_encode("$username:$password"); $req_headers .= "Authorization: Basic $tmp\r\n"; } + if ($this->config->get('verbose') > 3) { + print "XMLRPC REQUEST HEADERS:\n"; + var_dump($req_headers); + print "XMLRPC REQUEST BODY:\n"; + var_dump($request); + } fwrite($fp, ("POST /xmlrpc.php HTTP/1.0\r\n$req_headers\r\n$request")); $response = ''; $line1 = fgets($fp, 2048); @@ -153,6 +168,10 @@ $response .= $chunk; } fclose($fp); + if ($this->config->get('verbose') > 3) { + print "XMLRPC RESPONSE:\n"; + var_dump($response); + } $ret = xmlrpc_decode($response); if (is_array($ret) && isset($ret['__PEAR_TYPE__'])) { if ($ret['__PEAR_TYPE__'] == 'error') { @@ -165,7 +184,7 @@ if ($ret['message'] === '') $ret['message'] = null; if ($ret['userinfo'] === '') $ret['userinfo'] = null; if (strtolower($class) == 'db_error') { - $ret = $this->raiseError(DB::errorMessage($ret['code']), + $ret = $this->raiseError(PEAR::errorMessage($ret['code']), $ret['code'], null, null, $ret['userinfo']); } else { @@ -173,9 +192,9 @@ null, null, $ret['userinfo']); } } - } elseif (is_array($ret) && sizeof($ret) == 1 && - isset($ret[0]['faultString']) && - isset($ret[0]['faultCode'])) { + } elseif (is_array($ret) && sizeof($ret) == 1 && is_array($ret[0]) && + !empty($ret[0]['faultString']) && + !empty($ret[0]['faultCode'])) { extract($ret[0]); $faultString = "XML-RPC Server Fault: " . str_replace("\n", " ", $faultString); @@ -193,10 +212,10 @@ { global $XML_RPC_Boolean, $XML_RPC_Int, $XML_RPC_Double; global $XML_RPC_String, $XML_RPC_Array, $XML_RPC_Struct; - + $type = gettype($php_val); - $xmlrpcval = new XML_RPC_value; - + $xmlrpcval = new XML_RPC_Value; + switch($type) { case "array": reset($php_val); @@ -255,4 +274,4 @@ } -?> \ No newline at end of file +?> No revision No revision 1.2.2.3 +29 -19 php4/pear/PEAR/Command/Auth.php Index: Auth.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Auth.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Auth.php 19 May 2002 11:16:07 -0000 1.2.2.2 +++ Auth.php 9 Jul 2002 09:14:43 -0000 1.2.2.3 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Auth.php,v 1.7 2002/05/14 12:34:49 ssb Exp $ +// $Id: Auth.php,v 1.10 2002/06/02 13:07:18 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Remote.php"; @@ -31,24 +31,26 @@ var $commands = array( 'login' => array( 'summary' => 'Connects and authenticates to remote server', + 'shortcut' => 'li', 'function' => 'doLogin', 'options' => array(), - 'doc' => 'To use functions in the installer that require any kind -of privilege, you need to log in first. The username and password you enter -here will be stored in your per-user PEAR configuration (~/.pearrc on -Unix-like systems). After logging in, your username and password will be -passed along in every subsequent operation on the remote server. -', + 'doc' => ' +Log in to the remote server. To use remote functions in the installer +that require any kind of privileges, you need to log in first. The +username and password you enter here will be stored in your per-user +PEAR configuration (~/.pearrc on Unix-like systems). After logging +in, your username and password will be sent along in subsequent +operations on the remote server.', ), 'logout' => array( 'summary' => 'Logs out from the remote server', + 'shortcut' => 'lo', 'function' => 'doLogout', 'options' => array(), - 'doc' => 'Logs out from the remote server. -This command does not actually connect to the remote -server, it only deletes the stored username and password from your -user configuration. -', + 'doc' => ' +Logs out from the remote server. This command does not actually +connect to the remote server, it only deletes the stored username and +password from your user configuration.', ) ); @@ -85,20 +87,28 @@ if (empty($username)) { $username = @$_ENV['USER']; } - $this->ui->displayLine("Logging in to $server."); - $username = trim($this->ui->userDialog('Username', 'text', $username)); - + $this->ui->outputData("Logging in to $server.", $command); + + list($username, $password) = $this->ui->userDialog( + $command, + array('Username', 'Password'), + array('text', 'password'), + array($username, '') + ); + $username = trim($username); + $password = trim($password); + $this->config->set('username', $username); - $password = trim($this->ui->userDialog('Password', 'password')); $this->config->set('password', $password); + $remote->expectError(401); $ok = $remote->call('logintest'); $remote->popExpect(); if ($ok === true) { - $this->ui->displayLine("Logged in."); + $this->ui->outputData("Logged in.", $command); $this->config->store(); } else { - $this->ui->displayLine("Login failed!"); + return $this->raiseError("Login failed!"); } } @@ -120,7 +130,7 @@ function doLogout($command, $options, $params) { $server = $this->config->get('master_server'); - $this->ui->displayLine("Logging out from $server."); + $this->ui->outputData("Logging out from $server.", $command); $this->config->remove('username'); $this->config->remove('password'); $this->config->store(); 1.2.2.2 +122 -5 php4/pear/PEAR/Command/Common.php Index: Common.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Common.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- Common.php 19 May 2002 11:16:07 -0000 1.2.2.1 +++ Common.php 9 Jul 2002 09:14:43 -0000 1.2.2.2 @@ -16,7 +16,7 @@ // | Author: Stig S〓ther Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.11 2002/05/14 01:48:20 ssb Exp $ +// $Id: Common.php,v 1.16 2002/06/07 08:43:45 cox Exp $ require_once "PEAR.php"; @@ -38,6 +38,28 @@ */ var $ui; + var $_deps_rel_trans = array( + 'lt' => '<', + 'le' => '<=', + 'eq' => '=', + 'ne' => '!=', + 'gt' => '>', + 'ge' => '>=', + 'has' => '==' + ); + + var $_deps_type_trans = array( + 'pkg' => 'package', + 'extension' => 'extension', + 'php' => 'PHP', + 'prog' => 'external program', + 'ldlib' => 'external library for linking', + 'rtlib' => 'external runtime library', + 'os' => 'operating system', + 'websrv' => 'web server', + 'sapi' => 'SAPI backend' + ); + // }}} // {{{ constructor @@ -72,6 +94,25 @@ } // }}} + // {{{ getShortcuts() + + /** + * Return a list of all the command shortcuts defined by this class. + * @return array shortcut => command + * @access public + */ + function getShortcuts() + { + $ret = array(); + foreach (array_keys($this->commands) as $command) { + if (isset($this->commands[$command]['shortcut'])) { + $ret[$this->commands[$command]['shortcut']] = $command; + } + } + return $ret; + } + + // }}} // {{{ getOptions() function getOptions($command) @@ -112,11 +153,77 @@ // }}} // {{{ getHelp() - + /** + * Returns the help message for the given command + * + * @param string $command The command + * @return mixed A fail string if the command does not have help or + * a two elements array containing [0]=>help string, + * [1]=> help string for the accepted cmd args + */ function getHelp($command) { - $help = preg_replace('/{config\s+([^\}]+)}/e', "\$config->get('\1')", @$this->commands[$command]['doc']); - return $help; + $config = &PEAR_Config::singleton(); + $help = @$this->commands[$command]['doc']; + if (empty($help)) { + // XXX (cox) Fallback to summary if there is no doc (show both?) + if (!$help = @$this->commands[$command]['summary']) { + return "No help for command \"$command\""; + } + } + if (preg_match_all('/{config\s+([^\}]+)}/e', $help, $matches)) { + foreach($matches[0] as $k => $v) { + $help = preg_replace("/$v/", $config->get($matches[1][$k]), $help); + } + } + return array($help, $this->getHelpArgs($command)); + } + + // }}} + // {{{ getHelpArgs() + /** + * Returns the help for the accepted arguments of a command + * + * @param string $command + * @return string The help string + */ + function getHelpArgs($command) + { + if (isset($this->commands[$command]['options']) && + count($this->commands[$command]['options'])) + { + $help = "Options:\n"; + foreach ($this->commands[$command]['options'] as $k => $v) { + if (isset($v['shortopt'])) { + $s = $v['shortopt']; + if (strlen($s) > 1 && $s{1} == ':') { + $argname = ''; + $optional = false; + if (strlen($s) > 2 && $s{2} == ':') { + $optional = true; + $argname = substr($s, 3); + } else { + $argname = substr($s, 2); + } + if (empty($argname)) { + $argname = 'arg'; + } + if ($optional) { + $help .= " -$s [$argname], --{$k}[=$argname]\n"; + } else { + $help .= " -$s $argname, --$k=$argname\n"; + } + } else { + $help .= " -$s, --$k\n"; + } + } else { + $help .= " --$k\n"; + } + $help .= " $v[doc]\n"; + } + return $help; + } + return null; } // }}} @@ -126,7 +233,17 @@ { $func = @$this->commands[$command]['function']; if (empty($func)) { - return $this->raiseError("unknown command `$command'"); + // look for shortcuts + foreach (array_keys($this->commands) as $cmd) { + if (@$this->commands[$cmd]['shortcut'] == $command) { + $command = $cmd; + $func = @$this->commands[$command]['function']; + if (empty($func)) { + return $this->raiseError("unknown command `$command'"); + } + break; + } + } } return $this->$func($command, $options, $params); } 1.2.2.3 +99 -67 php4/pear/PEAR/Command/Config.php Index: Config.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Config.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Config.php 19 May 2002 11:16:07 -0000 1.2.2.2 +++ Config.php 9 Jul 2002 09:14:43 -0000 1.2.2.3 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.10 2002/05/14 12:46:17 ssb Exp $ +// $Id: Config.php,v 1.18 2002/06/08 18:44:34 dickmann Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -32,14 +32,19 @@ var $commands = array( 'config-show' => array( 'summary' => 'Show All Settings', + 'function' => 'doConfigShow', + 'shortcut' => 'csh', 'options' => array(), - 'doc' => 'Displays all configuration values. An optional argument + 'doc' => ' +Displays all configuration values. An optional argument may be used to tell which configuration layer to display. Valid configuration layers are "user", "system" and "default". ', ), 'config-get' => array( 'summary' => 'Show One Setting', + 'function' => 'doConfigGet', + 'shortcut' => 'cg', 'options' => array(), 'doc' => 'Displays the value of one configuration parameter. The first argument is the name of the parameter, an optional second argument @@ -51,6 +56,8 @@ ), 'config-set' => array( 'summary' => 'Change Setting', + 'function' => 'doConfigSet', + 'shortcut' => 'cs', 'options' => array(), 'doc' => 'Sets the value of one configuration parameter. The first argument is the name of the parameter, the second argument is the new value. @@ -60,6 +67,16 @@ in. The default layer is "user". ', ), + 'config-help' => array( + 'summary' => 'Show Information About Setting', + 'function' => 'doConfigHelp', + 'shortcut' => 'ch', + 'options' => array(), + 'doc' => '[parameter] +Displays help for a configuration parameter. Without arguments it +displays help for all configuration parameters. +', + ), ); /** @@ -72,79 +89,94 @@ parent::PEAR_Command_Common($ui, $config); } - function run($command, $options, $params) + function doConfigShow($command, $options, $params) { - $cf = &$this->config; - $failmsg = ''; - switch ($command) { - case 'config-show': { - // $params[0] -> the layer - if ($error = $this->_checkLayer(@$params[0])) { - $failmsg .= $error; - break; - } - $keys = $cf->getKeys(); - sort($keys); - $this->ui->startTable(array('caption' => 'Configuration:')); - foreach ($keys as $key) { - $type = $cf->getType($key); - $value = $cf->get($key, @$params[0]); - if ($type == 'password' && $value) { - $value = '********'; - } - if (empty($value)) { - $value = '<not set>'; - } - $this->ui->tableRow(array($key, $value)); - } - $this->ui->endTable(); - break; - } - case 'config-get': { - // $params[0] -> the parameter - // $params[1] -> the layer - if ($error = $this->_checkLayer(@$params[1])) { - $failmsg .= $error; - break; - } - if (sizeof($params) < 1 || sizeof($params) > 2) { - $failmsg .= "config-get expects 1 or 2 parameters. Try \"help config-get\" for help"; - } elseif (sizeof($params) == 1) { - $this->ui->displayLine("$params[0] = " . $cf->get($params[0])); - } else { - $this->ui->displayLine("($params[1])$params[0] = " . - $cf->get($params[0], $params[1])); - } - break; - } - case 'config-set': { - // $param[0] -> a parameter to set - // $param[1] -> the value for the parameter - // $param[2] -> the layer - if (sizeof($params) < 2 || sizeof($params) > 3) { - $failmsg .= "config-set expects 2 or 3 parameters. Try \"help config-set\" for help"; - break; - } - if ($error = $this->_checkLayer(@$params[2])) { - $failmsg .= $error; - break; - } - if (!call_user_func_array(array(&$cf, 'set'), $params)) - { - $failmsg = "config-set (" . implode(", ", $params) . ") failed"; - } else { - $cf->store(); - } - break; + // $params[0] -> the layer + if ($error = $this->_checkLayer(@$params[0])) { + return $this->raiseError($error); + } + $keys = $this->config->getKeys(); + sort($keys); + $data = array('caption' => 'Configuration:'); + foreach ($keys as $key) { + $type = $this->config->getType($key); + $value = $this->config->get($key, @$params[0]); + if ($type == 'password' && $value) { + $value = '********'; } - default: { - return false; + if ($value === false) { + $value = 'false'; + } elseif ($value === true) { + $value = 'true'; } + $data['data'][$this->config->getGroup($key)][] = array($this->config->getPrompt($key) , $key, $value); + } + $this->ui->outputData($data, $command); + return true; + } + + function doConfigGet($command, $options, $params) + { + // $params[0] -> the parameter + // $params[1] -> the layer + if ($error = $this->_checkLayer(@$params[1])) { + return $this->raiseError($error); + } + if (sizeof($params) < 1 || sizeof($params) > 2) { + return $this->raiseError("config-get expects 1 or 2 parameters"); + } elseif (sizeof($params) == 1) { + $this->ui->outputData("$params[0]=" . $this->config->get($params[0]), $command); + } else { + $data = "$params[1].$params[0]=" .$this->config->get($params[0], $params[1]); + $this->ui->outputData($data, $command); + } + return true; + } + + function doConfigSet($command, $options, $params) + { + // $param[0] -> a parameter to set + // $param[1] -> the value for the parameter + // $param[2] -> the layer + $failmsg = ''; + if (sizeof($params) < 2 || sizeof($params) > 3) { + $failmsg .= "config-set expects 2 or 3 parameters"; + return PEAR::raiseError($failmsg); + } + if ($error = $this->_checkLayer(@$params[2])) { + $failmsg .= $error; + return PEAR::raiseError($failmsg); + } + if (!call_user_func_array(array(&$this->config, 'set'), $params)) + { + $failmsg = "config-set (" . implode(", ", $params) . ") failed"; + } else { + $this->config->store(); } if ($failmsg) { return $this->raiseError($failmsg); } return true; + } + + function doConfigHelp($command, $options, $params) + { + if (empty($params)) { + $params = $this->config->getKeys(); + } + $data['caption'] = "Config help" . ((count($params) == 1) ? " for $params[0]" : ''); + $data['headline'] = array('Name', 'Type', 'Description'); + $data['border'] = true; + foreach ($params as $name) { + $type = $this->config->getType($name); + $docs = $this->config->getDocs($name); + if ($type == 'set') { + $docs = rtrim($docs) . "\nValid set: " . + implode(' ', $this->config->getSetValues($name)); + } + $data['data'][] = array($name, $type, $docs); + } + $this->ui->outputData($data, $command); } /** 1.2.2.4 +53 -61 php4/pear/PEAR/Command/Install.php Index: Install.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Install.php,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- Install.php 19 May 2002 11:16:07 -0000 1.2.2.3 +++ Install.php 9 Jul 2002 09:14:44 -0000 1.2.2.4 @@ -16,7 +16,7 @@ // | Author: Stig S〓ther Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Install.php,v 1.25 2002/05/14 01:49:18 ssb Exp $ +// $Id: Install.php,v 1.34 2002/06/19 23:38:48 cox Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Installer.php"; @@ -35,6 +35,7 @@ 'install' => array( 'summary' => 'Install Package', 'function' => 'doInstall', + 'shortcut' => 'i', 'options' => array( 'force' => array( 'shortopt' => 'f', @@ -52,12 +53,17 @@ 'shortopt' => 's', 'doc' => 'soft install, fail silently, or upgrade if already installed', ), + 'nobuild' => array( + 'shortopt' => 'B', + 'doc' => 'don\'t build C extensions', + ), 'nocompress' => array( 'shortopt' => 'Z', 'doc' => 'request uncompressed files when downloading', ), ), - 'doc' => 'Installs one or more PEAR packages. You can specify a package to + 'doc' => '<package> ... +Installs one or more PEAR packages. You can specify a package to install in four ways: "Package-1.0.tgz" : installs from a local file @@ -79,6 +85,7 @@ 'upgrade' => array( 'summary' => 'Upgrade Package', 'function' => 'doInstall', + 'shortcut' => 'up', 'options' => array( 'force' => array( 'shortopt' => 'f', @@ -92,12 +99,17 @@ 'shortopt' => 'r', 'doc' => 'do not install files, only register the package as upgraded', ), + 'nobuild' => array( + 'shortopt' => 'B', + 'doc' => 'don\'t build C extensions', + ), 'nocompress' => array( 'shortopt' => 'Z', - 'request uncompressed files when downloading', + 'doc' => 'request uncompressed files when downloading', ), ), - 'doc' => 'Upgrades one or more PEAR packages. See documentation for the + 'doc' => '<package> ... +Upgrades one or more PEAR packages. See documentation for the "install" command for ways to specify a package. When upgrading, your package will be updated if the provided new @@ -109,6 +121,7 @@ 'uninstall' => array( 'summary' => 'Un-install Package', 'function' => 'doUninstall', + 'shortcut' => 'un', 'options' => array( 'nodeps' => array( 'shortopt' => 'n', @@ -119,14 +132,9 @@ 'doc' => 'do not remove files, only register the packages as not installed', ), ), - 'doc' => 'Upgrades one or more PEAR packages. See documentation for the -"install" command for ways to specify a package. - -When upgrading, your package will be updated if the provided new -package has a higher version number (use the -f option if you need to -upgrade anyway). - -More than one package may be specified at once. + 'doc' => '<package> ... +Uninstalls one or more PEAR packages. More than one package may be +specified at once. '), ); @@ -146,65 +154,49 @@ // }}} - // {{{ getCommands() - - /** - * Return a list of all the commands defined by this class. - * @return array list of commands - * @access public - */ - function getCommands() + function doInstall($command, $options, $params) { - $ret = array(); - foreach (array_keys($this->commands) as $command) { - $ret[$command] = $this->commands[$command]['summary']; + if (empty($this->installer)) { + $this->installer = &new PEAR_Installer($this->ui); + } + if ($command == 'upgrade') { + $options[$command] = true; + } + foreach ($params as $pkg) { + $bn = basename($pkg); + $info = $this->installer->install($pkg, $options, $this->config); + if (is_array($info)) { + if ($this->config->get('verbose') > 0) { + $label = "$info[package] $info[version]"; + $this->ui->outputData("$command ok: $label", $command); + } + } else { + return $this->raiseError("$command failed"); + } } - return $ret; + return true; } - // }}} - // {{{ run() - - function run($command, $options, $params) + function doUninstall($command, $options, $params) { - $this->installer = &new PEAR_Installer($ui); -// return parent::run($command, $options, $params); - $failmsg = ''; - switch ($command) { - case 'upgrade': - $options['upgrade'] = true; - // fall through - case 'install': - foreach ($params as $pkg) { - $bn = basename($pkg); - $info = $this->installer->install($pkg, $options, $this->config); - if (is_array($info)) { - $label = "$info[package] $info[version]"; - $this->ui->displayLine("$command ok: $label"); - } else { - $failmsg = "$command failed"; - } - } - break; - case 'uninstall': - foreach ($params as $pkg) { - if ($this->installer->uninstall($pkg, $options)) { - $this->ui->displayLine("uninstall ok"); - } else { - $failmsg = "uninstall failed"; - } - } - break; - default: - return false; + if (empty($this->installer)) { + $this->installer = &new PEAR_Installer($this->ui); } - if ($failmsg) { - return $this->raiseError($failmsg); + if (sizeof($params) < 1) { + return $this->raiseError("Please supply the package(s) you want to uninstall"); + } + foreach ($params as $pkg) { + if ($this->installer->uninstall($pkg, $options)) { + if ($this->config->get('verbose') > 0) { + $this->ui->outputData("uninstall $pkg ok", $command); + } + } else { + return $this->raiseError("uninstall $pkg failed"); + } } return true; } - // }}} } ?> 1.2.2.3 +143 -284 php4/pear/PEAR/Command/Package.php Index: Package.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Package.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Package.php 19 May 2002 11:16:07 -0000 1.2.2.2 +++ Package.php 9 Jul 2002 09:14:44 -0000 1.2.2.3 @@ -13,14 +13,14 @@ // | obtain it through the world-wide-web, please send a note to | // | licen****@php***** so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ -// | Author: Stig Bakken <ssb****@fast*****> | +// | Authors: Stig Bakken <ssb****@fast*****> | +// | Martin Jansen <mj****@php*****> | // +----------------------------------------------------------------------+ // -// $Id: Package.php,v 1.24 2002/05/19 06:48:40 ssb Exp $ +// $Id: Package.php,v 1.39 2002/06/07 08:43:36 cox Exp $ -require_once 'PEAR/Command/Common.php'; -require_once 'PEAR/Packager.php'; require_once 'PEAR/Common.php'; +require_once 'PEAR/Command/Common.php'; class PEAR_Command_Package extends PEAR_Command_Common { @@ -28,54 +28,78 @@ 'package' => array( 'summary' => 'Build Package', 'function' => 'doPackage', + 'shortcut' => 'p', 'options' => array( 'nocompress' => array( 'shortopt' => 'Z', 'doc' => 'Do not gzip the package file' ), - '???' => array( + 'showname' => array( 'shortopt' => 'n', - 'doc' => 'Return only the created package file name. Useful for -shell script operations. -', + 'doc' => 'Print the name of the packaged file.', ), ), - 'doc' => 'Creates a PEAR package from its description file (usually -called package.xml). + 'doc' => '[descfile] +Creates a PEAR package from its description file (usually called +package.xml). ' ), - 'package-info' => array( - 'summary' => 'Display information about a package file', - 'function' => 'doPackageInfo', - 'options' => array(), - 'doc' => 'Extracts information from a package file and displays it. -', - ), - 'package-list' => array( - 'summary' => 'List Files in Package', - 'function' => 'doPackageList', - 'options' => array(), - 'doc' => '', - ), 'package-validate' => array( 'summary' => 'Validate Package Consistency', 'function' => 'doPackageValidate', + 'shortcut' => 'pv', 'options' => array(), - 'doc' => '', + 'doc' => ' +', ), 'cvstag' => array( 'summary' => 'Set CVS Release Tag', 'function' => 'doCvsTag', - 'options' => array(), - 'doc' => '', + 'shortcut' => 'ct', + 'options' => array( + 'quiet' => array( + 'shortopt' => 'q', + 'doc' => 'Be quiet', + ), + 'reallyquiet' => array( + 'shortopt' => 'Q', + 'doc' => 'Be really quiet', + ), + 'slide' => array( + 'shortopt' => 'F', + 'doc' => 'Move (slide) tag if it exists', + ), + 'delete' => array( + 'shortopt' => 'd', + 'doc' => 'Remove tag', + ), + ), + 'doc' => ' +Sets a CVS tag on all files in a package. Use this command after you have +packaged a distribution tarball with the "package" command to tag what +revisions of what files were in that release. If need to fix something +after running cvstag once, but before the tarball is released to the public, +use the "slide" option to move the release tag. +', ), 'run-tests' => array( 'summary' => 'Run Regression Tests', 'function' => 'doRunTests', + 'shortcut' => 'rt', 'options' => array(), - 'doc' => '', + 'doc' => '[testfile|dir ...] +Run regression tests with PHP\'s regression testing script (run-tests.php).', ), + 'package-dependencies' => array( + 'summary' => 'Show package dependencies', + 'function' => 'doPackageDependencies', + 'shortcut' => 'pd', + 'options' => array(), + 'doc' => ' +List all depencies the package has.' + ), ); + var $output; /** * PEAR_Command_Package constructor. @@ -90,124 +114,24 @@ function _displayValidationResults($err, $warn, $strict = false) { foreach ($err as $e) { - $this->ui->displayLine("Error: $e"); + $this->output .= "Error: $e\n"; } foreach ($warn as $w) { - $this->ui->displayLine("Warning: $w"); + $this->output .= "Warning: $w\n"; } - $this->ui->displayLine(sprintf('Validation: %d error(s), %d warning(s)', - sizeof($err), sizeof($warn))); + $this->output .= sprintf('Validation: %d error(s), %d warning(s)'."\n", + sizeof($err), sizeof($warn)); if ($strict && sizeof($err) > 0) { - $this->ui->displayLine("Fix these errors and try again."); + $this->output .= "Fix these errors and try again."; return false; } return true; } - /** - * Return a list of all the commands defined by this class. - * @return array list of commands - * @access public - */ - function getCommands() - { - return array('package' => 'Build Package', - 'package-info' => 'Show Package Info', - 'package-list' => 'List Files in Package', - 'package-validate' => 'Validate Package', - 'cvstag' => 'Set CVS Release Tag', - 'run-tests' => 'Run Regression Tests'); - } - - // {{{ getOptions() - - function getOptions() - { - return array('Z', 'n', 'F' /*, 'd', 'q', 'Q'*/); - } - - // }}} - // {{{ getHelp() - - function getHelp($command) - { - switch ($command) { - case 'package': - return array('[-n] [<package.xml>]', - 'Creates a PEAR package from its description file (usually '. - "named as package.xml)\n". - " -n Return only the created package file name. Useful for\n". - " shell script operations.\n". - " -Z Do not compress the tar package"); - case 'package-list': - return array('<pear package>', - 'List the contents (the files) of a PEAR package'); - case 'package-info': - return array('<pear package>', - 'Shows information about a PEAR package'); - case 'package-validate': - return array('<package.(tgz|tar|xml)>', - 'Verifies a package or description file'); - case 'cvstag': - return array('<package.xml>', - 'Runs "cvs tag" on files contained in a release'); - } - } - - // }}} - // {{{ run() - - /** - * Execute the command. - * - * @param string command name - * - * @param array option_name => value - * - * @param array list of additional parameters - * - * @return bool TRUE on success, FALSE for unknown commands, or - * a PEAR error on failure - * - * @access public - */ - function run($command, $options, $params) - { - $failmsg = ''; - switch ($command) { - case 'package': - case 'package-list': - case 'package-info': - case 'package-validate': - break; - // {{{ cvstag - - case 'cvstag': { - } - - // }}} - // {{{ run-tests - - case 'run-tests': { - break; - } - - // }}} - default: { - return false; - } - } - if ($failmsg) { - return $this->raiseError($failmsg); - } - return true; - } - - // }}} - - function doPackage($command, $options, $params) { + $this->output = ''; + include_once 'PEAR/Packager.php'; $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml'; ob_start(); $packager =& new PEAR_Packager($this->config->get('php_dir'), @@ -217,171 +141,43 @@ $err = $warn = array(); $packager->validatePackageInfo($pkginfofile, $err, $warn); if (!$this->_displayValidationResults($err, $warn, true)) { + $this->ui->outputData($this->output, $command); return; } - $compress = empty($options['Z']) ? true : false; + $compress = empty($options['nocompress']) ? true : false; $result = $packager->Package($pkginfofile, $compress); - $output = ob_get_contents(); + $this->output = ob_get_contents(); ob_end_clean(); if (PEAR::isError($result)) { + $this->ui->outputData($this->output, $command); return $this->raiseError($result); } // Don't want output, only the package file name just created - if (isset($options['n'])) { - $this->ui->displayLine($result); - return; + if (isset($options['showname'])) { + $this->output = $result; } - $lines = explode("\n", $output); + /* (cox) What is supposed to do that code? + $lines = explode("\n", $this->output); foreach ($lines as $line) { - $this->ui->displayLine($line); + $this->output .= $line."n"; } + */ if (PEAR::isError($result)) { - $this->ui->displayLine("Package failed: ".$result->getMessage()); - } - return true; - } - - - function doPackageList($command, $options, $params) - { - // $params[0] -> the PEAR package to list its files - if (sizeof($params) != 1) { - return $this->raiseError("bad parameters, try \"help $command\""); - } - $obj = new PEAR_Common(); - - if (PEAR::isError($info = $obj->infoFromTgzFile($params[0]))) { - return $info; - } - $list =$info['filelist']; - $caption = 'Contents of ' . basename($params[0]); - $this->ui->startTable(array('caption' => $caption, - 'border' => true)); - $this->ui->tableRow(array('Package Files', 'Install Destination'), - array('bold' => true)); - foreach ($list as $file => $att) { - if (isset($att['baseinstalldir'])) { - $dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR . - $file; - } else { - $dest = $file; - } - switch ($att['role']) { - case 'test': - $dest = '-- will not be installed --'; break; - case 'doc': - $dest = $this->config->get('doc_dir') . DIRECTORY_SEPARATOR . - $dest; - break; - case 'php': - default: - $dest = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . - $dest; - } - $dest = preg_replace('!/+!', '/', $dest); - $file = preg_replace('!/+!', '/', $file); - $opts = array(0 => array('wrap' => 23), - 1 => array('wrap' => 45) - ); - $this->ui->tableRow(array($file, $dest), null, $opts); - } - $this->ui->endTable(); - return true; - } - - function doPackageInfo($command, $options, $params) - { - // $params[0] -> the PEAR package to list its information - if (sizeof($params) != 1) { - return $this->raiseError("bad parameter(s), try \"help $command\""); - } - - $obj = new PEAR_Common(); - if (PEAR::isError($info = $obj->infoFromTgzFile($params[0]))) { - return $info; - } - unset($info['filelist']); - unset($info['changelog']); - $keys = array_keys($info); - $longtext = array('description', 'summary'); - foreach ($keys as $key) { - if (is_array($info[$key])) { - switch ($key) { - case 'maintainers': { - $i = 0; - $mstr = ''; - foreach ($info[$key] as $m) { - if ($i++ > 0) { - $mstr .= "\n"; - } - $mstr .= $m['name'] . " <"; - if (isset($m['email'])) { - $mstr .= $m['email']; - } else { - $mstr .= $m['handle'] . '@php.net'; - } - $mstr .= "> ($m[role])"; - } - $info[$key] = $mstr; - break; - } - case 'release_deps': { - static $rel_trans = array( - 'lt' => '<', - 'le' => '<=', - 'eq' => '=', - 'ne' => '!=', - 'gt' => '>', - 'ge' => '>=', - ); - $i = 0; - $dstr = ''; - foreach ($info[$key] as $d) { - if ($i++ > 0) { - $dstr .= ", "; - } - if (isset($rel_trans[$d['rel']])) { - $d['rel'] = $rel_trans[$d['rel']]; - } - $dstr .= "$d[type] $d[rel]"; - if (isset($d['version'])) { - $dstr .= " $d[version]"; - } - } - $info[$key] = $dstr; - break; - } - default: { - $info[$key] = implode(", ", $info[$key]); - break; - } - } - } - $info[$key] = trim($info[$key]); - if (in_array($key, $longtext)) { - $info[$key] = preg_replace('/ +/', ' ', $info[$key]); - } - } - $caption = 'About ' . basename($params[0]); - $this->ui->startTable(array('caption' => $caption, - 'border' => true)); - foreach ($info as $key => $value) { - $key = ucwords(str_replace('_', ' ', $key)); - $this->ui->tableRow(array($key, $value), null, array(1 => array('wrap' => 55))); + $this->output .= "Package failed: ".$result->getMessage(); } - $this->ui->endTable(); + $this->ui->outputData($this->output, $command); return true; } function doPackageValidate($command, $options, $params) { + $this->output = ''; if (sizeof($params) < 1) { $params[0] = "package.xml"; } $obj = new PEAR_Common; $info = null; - if (file_exists($params[0])) { - $fp = fopen($params[0], "r"); + if ($fp = @fopen($params[0], "r")) { $test = fread($fp, 5); fclose($fp); if ($test == "<?xml") { @@ -396,11 +192,14 @@ } $obj->validatePackageInfo($info, $err, $warn); $this->_displayValidationResults($err, $warn); + $this->ui->outputData($this->output, $command); return true; } function doCvsTag($command, $options, $params) { + $this->output = ''; + $_cmd = $command; if (sizeof($params) < 1) { $help = $this->getHelp($command); return $this->raiseError("$command: missing parameter: $help[0]"); @@ -413,6 +212,7 @@ $err = $warn = array(); $obj->validatePackageInfo($info, $err, $warn); if (!$this->_displayValidationResults($err, $warn, true)) { + $this->ui->outputData($this->output, $command); break; } $version = $info['version']; @@ -420,31 +220,32 @@ $cvstag = "RELEASE_$cvsversion"; $files = array_keys($info['filelist']); $command = "cvs"; - if (isset($options['q'])) { + if (isset($options['quiet'])) { $command .= ' -q'; } - if (isset($options['Q'])) { + if (isset($options['reallyquiet'])) { $command .= ' -Q'; } $command .= ' tag'; - if (isset($options['F'])) { + if (isset($options['slide'])) { $command .= ' -F'; } - if (isset($options['d'])) { + if (isset($options['delete'])) { $command .= ' -d'; } $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]); foreach ($files as $file) { $command .= ' ' . escapeshellarg($file); } - $this->ui->displayLine("+ $command"); + $this->output .= "+ $command\n"; if (empty($options['n'])) { $fp = popen($command, "r"); while ($line = fgets($fp, 1024)) { - $this->ui->displayLine(rtrim($line)); + $this->output .= rtrim($line)."\n"; } pclose($fp); } + $this->ui->outputData($this->output, $_cmd); return true; } @@ -458,12 +259,70 @@ $run_tests = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . 'run-tests.php'; if (!file_exists($run_tests)) { $run_tests = PEAR_INSTALL_DIR . DIRECTORY_SEPARATOR . 'run-tests.php'; + if (!file_exists($run_tests)) { + return $this->raiseError("No `run-test.php' file found"); + } } $plist = implode(" ", $params); - $cmd = "$php -d include_path=$cwd$ps$ip $run_tests $plist"; + $cmd = "$php -C -d include_path=$cwd$ps$ip -f $run_tests -- $plist"; system($cmd); return true; } -} + function doPackageDependencies($command, $options, $params) + { + // $params[0] -> the PEAR package to list its information + if (sizeof($params) != 1) { + return $this->raiseError("bad parameter(s), try \"help $command\""); + } + + $obj = new PEAR_Common(); + if (PEAR::isError($info = $obj->infoFromAny($params[0]))) { + return $info; + } + + if (is_array($info['release_deps'])) { + $data = array( + 'caption' => 'Dependencies for ' . $info['package'], + 'border' => true, + 'headline' => array("Type", "Name", "Relation", "Version"), + ); + + foreach ($info['release_deps'] as $d) { + + if (isset($this->_deps_rel_trans[$d['rel']])) { + $rel = $this->_deps_rel_trans[$d['rel']]; + } else { + $rel = $d['rel']; + } + + if (isset($this->_deps_type_trans[$d['type']])) { + $type = ucfirst($this->_deps_type_trans[$d['type']]); + } else { + $type = $d['type']; + } + + if (isset($d['name'])) { + $name = $d['name']; + } else { + $name = ''; + } + + if (isset($d['version'])) { + $version = $d['version']; + } else { + $version = ''; + } + + $data['data'][] = array($type, $name, $rel, $version); + } + + $this->ui->outputData($data, $command); + return true; + } + + // Fallback + $this->ui->outputData("This package does not have any dependencies.", $command); + } +} ?> 1.2.2.2 +254 -97 php4/pear/PEAR/Command/Registry.php Index: Registry.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Registry.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- Registry.php 9 May 2002 04:17:01 -0000 1.2.2.1 +++ Registry.php 9 Jul 2002 09:14:44 -0000 1.2.2.2 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Registry.php,v 1.9 2002/05/09 02:31:36 ssb Exp $ +// $Id: Registry.php,v 1.24 2002/06/19 23:38:49 cox Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Registry.php'; @@ -25,6 +25,44 @@ class PEAR_Command_Registry extends PEAR_Command_Common { + // {{{ command definitions + + var $commands = array( + 'list' => array( + 'summary' => 'List Installed Packages', + 'function' => 'doList', + 'shortcut' => 'l', + 'options' => array(), + 'doc' => '[package] +If invoked without parameters, this command lists the PEAR packages +installed in your php_dir ({config php_dir)). With a parameter, it +lists the files in that package. +', + ), + 'shell-test' => array( + 'summary' => 'Shell Script Test', + 'function' => 'doShellTest', + 'shortcut' => 'st', + 'options' => array(), + 'doc' => '<package> [[relation] version] +Tests if a package is installed in the system. Will exit(1) if it is not. + <relation> The version comparison operator. One of: + <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne + <version> The version to compare with +'), + 'info' => array( + 'summary' => 'Display information about a package', + 'function' => 'doInfo', + 'shortcut' => 'i', + 'options' => array(), + 'doc' => '<pacakge> +Displays information about a package. The package argument may be a +local package file, an URL to a package file, or the name of an +installed package.' + ) + ); + + // }}} // {{{ constructor /** @@ -38,124 +76,243 @@ } // }}} + // {{{ doList() - // {{{ getCommands() - - /** - * Return a list of all the commands defined by this class. - * @return array list of commands - * @access public - */ - function getCommands() + function _sortinfo($a, $b) { - return array('list-installed' => 'List Installed Packages', - 'shell-test' => 'Shell Script Test'); + return strcmp($a['package'], $b['package']); } - function getHelp($command) + function doList($command, $options, $params) { - switch ($command) { - case 'list-installed': - return array(null, 'List the installed PEAR packages in the system'); - case 'shell-test': - return array('<package name> [<relation>] [<version>]', - "Tests if a package is installed in the system. Will exit(1) if it is not.\n". - " <relation> The version comparison operator. One of:\n". - " <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne\n". - " <version> The version to compare with"); + $reg = new PEAR_Registry($this->config->get('php_dir')); + if (sizeof($params) == 0) { + $installed = $reg->packageInfo(); + usort($installed, array(&$this, '_sortinfo')); + $i = $j = 0; + $data = array( + 'caption' => 'Installed packages:', + 'border' => true, + 'headline' => array('Package', 'Version', 'State') + ); + foreach ($installed as $package) { + $data['data'][] = array($package['package'], + $package['version'], + @$package['release_state']); + } + if (count($installed)==0) { + $data = '(no packages installed)'; + } + $this->ui->outputData($data, $command); + } else { + if (file_exists($params[0]) && !is_dir($params[0])) { + include_once "PEAR/Common.php"; + $obj = &new PEAR_Common; + $info = $obj->infoFromAny($params[0]); + $headings = array('Package File', 'Install Path'); + $installed = false; + } else { + $info = $reg->packageInfo($params[0]); + $headings = array('Type', 'Install Path'); + $installed = true; + } + if (PEAR::isError($info)) { + return $this->raiseError($info); + } + if ($info === null) { + return $this->raiseError("`$params[0]' not installed"); + } + $list = $info['filelist']; + if ($installed) { + $caption = 'Installed Files For ' . $params[0]; + } else { + $caption = 'Contents of ' . basename($params[0]); + } + $data = array( + 'caption' => $caption, + 'border' => true, + 'headline' => $headings); + foreach ($list as $file => $att) { + if ($installed) { + if (empty($att['installed_as'])) { + continue; + } + $data['data'][] = array($att['role'], $att['installed_as']); + } else { + if (isset($att['baseinstalldir'])) { + $dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR . + $file; + } else { + $dest = $file; + } + switch ($att['role']) { + case 'test': + case 'data': + if ($installed) { + break 2; + } + $dest = '-- will not be installed --'; + break; + case 'doc': + $dest = $this->config->get('doc_dir') . DIRECTORY_SEPARATOR . + $dest; + break; + case 'php': + default: + $dest = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . + $dest; + } + $dest = preg_replace('!/+!', '/', $dest); + $file = preg_replace('!/+!', '/', $file); + $data['data'][] = array($file, $dest); + } + } + $this->ui->outputData($data, $command); + + } + return true; } // }}} - // {{{ run() + // {{{ doShellTest() - /** - * Execute the command. - * - * @param string command name - * - * @param array option_name => value - * - * @param array list of additional parameters - * - * @return bool TRUE on success, FALSE if the command was unknown, - * or a PEAR error on failure - * - * @access public - */ - function run($command, $options, $params) + function doShellTest($command, $options, $params) { - $failmsg = ''; - $cf = &PEAR_Config::singleton(); - switch ($command) { - // {{{ list-installed - - case 'list-installed': { - $reg = new PEAR_Registry($cf->get('php_dir')); - $installed = $reg->packageInfo(); - $i = $j = 0; - $this->ui->startTable( - array('caption' => 'Installed packages:', - 'border' => true)); - foreach ($installed as $package) { - if ($i++ % 20 == 0) { - $this->ui->tableRow( - array('Package', 'Version', 'State'), - array('bold' => true)); - } - $this->ui->tableRow(array($package['package'], - $package['version'], - @$package['release_state'])); - } - if ($i == 0) { - $this->ui->tableRow(array('(no packages installed yet)')); - } - $this->ui->endTable(); - break; + $this->pushErrorHandling(PEAR_ERROR_RETURN); + $reg = &new PEAR_Registry($this->config->get('php_dir')); + // "pear shell-test Foo" + if (sizeof($params) == 1) { + if (!$reg->packageExists($params[0])) { + exit(1); + } + // "pear shell-test Foo 1.0" + } elseif (sizeof($params) == 2) { + $v = $reg->packageInfo($params[0], 'version'); + if (!$v || !version_compare("$v", "{$params[1]}", "ge")) { + exit(1); } + // "pear shell-test Foo ge 1.0" + } elseif (sizeof($params) == 3) { + $v = $reg->packageInfo($params[0], 'version'); + if (!$v || !version_compare("$v", "{$params[2]}", $params[1])) { + exit(1); + } + } else { + $this->popErrorHandling(); + $this->raiseError("$command: expects 1 to 3 parameters"); + exit(1); + } + } - // }}} - case 'shell-test': { - // silence error messages for the rest of the execution - PEAR::pushErrorHandling(PEAR_ERROR_RETURN); - $reg = &new PEAR_Registry($this->config->get('php_dir')); - // "pear shell-test Foo" - if (sizeof($params) == 1) { - if (!$reg->packageExists($params[0])) { - exit(1); - } - // "pear shell-test Foo 1.0" - } elseif (sizeof($params) == 2) { - $v = $reg->packageInfo($params[0], 'version'); - if (!$v || !version_compare($v, $params[1], "ge")) { - exit(1); - } - // "pear shell-test Foo ge 1.0" - } elseif (sizeof($params) == 3) { - $v = $reg->packageInfo($params[0], 'version'); - if (!$v || !version_compare($v, $params[2], $params[1])) { - exit(1); + // }}} + // {{{ doInfo + + function doInfo($command, $options, $params) + { + // $params[0] The package for showing info + if (sizeof($params) != 1) { + return $this->raiseError("This command only accepts one param: ". + "the package you want information"); + } + if (@is_file($params[0])) { + $obj = &new PEAR_Common(); + $info = $obj->infoFromAny($params[0]); + } else { + $reg = &new PEAR_Registry($this->config->get('php_dir')); + $info = $reg->packageInfo($params[0]); + } + if (PEAR::isError($info)) { + return $info; + } + if (empty($info)) { + $this->ui->displayLine("Nothing found for `$params[0]'"); + return; + } + unset($info['filelist']); + unset($info['changelog']); + $keys = array_keys($info); + $longtext = array('description', 'summary'); + foreach ($keys as $key) { + if (is_array($info[$key])) { + switch ($key) { + case 'maintainers': { + $i = 0; + $mstr = ''; + foreach ($info[$key] as $m) { + if ($i++ > 0) { + $mstr .= "\n"; + } + $mstr .= $m['name'] . " <"; + if (isset($m['email'])) { + $mstr .= $m['email']; + } else { + $mstr .= $m['handle'] . '@php.net'; + } + $mstr .= "> ($m[role])"; + } + $info[$key] = $mstr; + break; + } + case 'release_deps': { + $i = 0; + $dstr = ''; + foreach ($info[$key] as $d) { + if (isset($this->_deps_rel_trans[$d['rel']])) { + $rel = $this->_deps_rel_trans[$d['rel']]; + } else { + $rel = $d['rel']; + } + if (isset($this->_deps_type_trans[$d['type']])) { + $type = ucfirst($this->_deps_type_trans[$d['type']]); + } else { + $type = $d['type']; + } + if (isset($d['name'])) { + $name = $d['name'] . ' '; + } else { + $name = ''; + } + if (isset($d['version'])) { + $version = $d['version'] . ' '; + } else { + $version = ''; + } + $dstr .= "$type $name$rel $version\n"; + } + $info[$key] = $dstr; + break; + } + default: { + $info[$key] = implode(", ", $info[$key]); + break; } - } else { - PEAR::popErrorHandling(); - PEAR::raiseError("$command: expects 1 to 3 parameters"); - exit(1); } - break; } - default: { - return false; + if ($key == '_lastmodified') { + $hdate = date('Y-m-d', $info[$key]); + unset($info[$key]); + $info['Last Modified'] = $hdate; + } else { + $info[$key] = trim($info[$key]); + if (in_array($key, $longtext)) { + $info[$key] = preg_replace('/ +/', ' ', $info[$key]); + } } } - if ($failmsg) { - return $this->raiseError($failmsg); + $caption = 'About ' . $info['package'] . '-' . $info['version']; + $data = array( + 'caption' => $caption, + 'border' => true); + foreach ($info as $key => $value) { + $key = ucwords(trim(str_replace('_', ' ', $key))); + $data['data'][] = array($key, $value); } - return true; + + $this->ui->outputData($data, 'package-info'); } // }}} - - } ?> 1.2.2.3 +291 -146 php4/pear/PEAR/Command/Remote.php Index: Remote.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Remote.php,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Remote.php 9 May 2002 04:17:01 -0000 1.2.2.2 +++ Remote.php 9 Jul 2002 09:14:44 -0000 1.2.2.3 @@ -17,14 +17,80 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.8 2002/05/09 02:31:36 ssb Exp $ +// $Id: Remote.php,v 1.21 2002/07/02 13:04:01 dickmann Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Common.php'; require_once 'PEAR/Remote.php'; +require_once 'PEAR/Registry.php'; class PEAR_Command_Remote extends PEAR_Command_Common { + // {{{ command definitions + + var $commands = array( + 'remote-info' => array( + 'summary' => 'Information About Remote Packages', + 'function' => 'doRemoteInfo', + 'shortcut' => 'ri', + 'options' => array(), + 'doc' => '<package> +Get details on a package from the server.', + ), + 'list-upgrades' => array( + 'summary' => 'List Available Upgrades', + 'function' => 'doListUpgrades', + 'shortcut' => 'lu', + 'options' => array(), + 'doc' => ' +List releases on the server of packages you have installed where +a newer version is available with the same release state (stable etc.).' + ), + 'remote-list' => array( + 'summary' => 'List Remote Packages', + 'function' => 'doRemoteList', + 'shortcut' => 'rl', + 'options' => array(), + 'doc' => ' +Lists the packages available on the configured server along with the +latest stable release of each package.', + ), + 'search' => array( + 'summary' => 'Search remote package database', + 'function' => 'doSearch', + 'shortcut' => 'sp', + 'options' => array(), + 'doc' => ' +Lists all packages which match the search paramteres (first param +is package name, second package info)', + ), + 'list-all' => array( + 'summary' => 'List All Packages', + 'function' => 'doListAll', + 'shortcut' => 'la', + 'options' => array(), + 'doc' => ' +Lists the packages available on the configured server along with the +latest stable release of each package.', + ), + 'download' => array( + 'summary' => 'Download Package', + 'function' => 'doDownload', + 'shortcut' => 'd', + 'options' => array( + 'nocompress' => array( + 'shortopt' => 'Z', + 'doc' => 'download an uncompressed (.tar) file', + ), + ), + 'doc' => '{package|package-version} +Download a package tarball. The file will be named as suggested by the +server, for example if you download the DB package and the latest stable +version of DB is 1.2, the downloaded file will be DB-1.2.tgz.', + ), + ); + + // }}} // {{{ constructor /** @@ -39,167 +105,184 @@ // }}} - // {{{ getCommands() + // {{{ remote-info - /** - * Return a list of all the commands defined by this class. - * @return array list of commands - * @access public - */ - function getCommands() + function doRemoteInfo($command, $options, $params) { - return array('remote-package-info' => 'Information About Remote Package', - 'list-upgrades' => 'List Available Upgrades', - 'list-remote-packages' => 'List Remote Packages', - 'download' => 'Download Package'); - } + if (sizeof($params) != 1) { + return $this->raiseError("$command expects one param: the remote package name"); + } + $r = new PEAR_Remote($this->config); + $info = $r->call('package.info', $params[0]); + if (PEAR::isError($info)) { + return $this->raiseError($info); + } - // }}} - // {{{ run() + $reg = new PEAR_Registry($this->config->get('php_dir')); + $installed = $reg->packageInfo($info['name']); + $info['installed'] = $installed['version'] ? $installed['version'] : '- no -'; - /** - * Execute the command. - * - * @param string command name - * - * @param array option_name => value - * - * @param array list of additional parameters - * - * @return bool TRUE on success, FALSE for unknown commands, or - * a PEAR error on failure - * - * @access public - */ - function run($command, $options, $params) - { - $failmsg = ''; - $remote = &new PEAR_Remote($this->config); - switch ($command) { - // {{{ remote-package-info - - case 'remote-package-info': { - break; - } + $this->ui->outputData($info, $command); - // }}} - // {{{ list-remote-packages + return true; + } - case 'list-remote-packages': { - $r = new PEAR_Remote($this->config); - $available = $r->call('package.listAll', true); - if (PEAR::isError($available)) { - return $this->raiseError($available); - } - $i = $j = 0; - $this->ui->startTable( - array('caption' => 'Available packages:', - 'border' => true)); - foreach ($available as $name => $info) { - if ($i++ % 20 == 0) { - $this->ui->tableRow( - array('Package', 'Version'), - array('bold' => true)); - } - $this->ui->tableRow(array($name, $info['stable'])); - } - if ($i == 0) { - $this->ui->tableRow(array('(no packages installed yet)')); - } - $this->ui->endTable(); - break; - } + // }}} + // {{{ list-remote - // }}} - // {{{ download + function doRemoteList($command, $options, $params) + { + $r = new PEAR_Remote($this->config); + $list_options = false; + if ($this->config->get('preferred_state') == 'stable') + $list_options = true; + $available = $r->call('package.listAll', $list_options); + if (PEAR::isError($available)) { + return $this->raiseError($available); + } + $i = $j = 0; + $data = array( + 'caption' => 'Available packages:', + 'border' => true, + 'headline' => array('Package', 'Version'), + ); + foreach ($available as $name => $info) { + $data['data'][] = array($name, $info['stable']); + } + if (count($available)==0) { + $data = '(no packages installed yet)'; + } + $this->ui->outputData($data, $command); + return true; + } - case 'download': { - //$params[0] -> The package to download - if (count($params) != 1) { - return PEAR::raiseError("download expects one argument: the package to download"); - } - $server = $this->config->get('master_server'); - if (!ereg('^http://', $params[0])) { - $pkgfile = "http://$server/get/$params[0]"; - } else { - $pkgfile = $params[0]; - } - $this->bytes_downloaded = 0; - $saved = PEAR_Common::downloadHttp($pkgfile, $this->ui, '.', - array(&$this, 'downloadCallback')); - if (PEAR::isError($saved)) { - return $this->raiseError($saved); - } - $fname = basename($saved); - $this->ui->displayLine("File $fname downloaded ($this->bytes_downloaded bytes)"); - break; - } + // }}} + // {{{ list-all - // }}} - // {{{ list-upgrades + function doListAll($command, $options, $params) + { + $r = new PEAR_Remote($this->config); + $reg = new PEAR_Registry($this->config->get('php_dir')); + $list_options = false; + if ($this->config->get('preferred_state') == 'stable') + $list_options = true; + $available = $r->call('package.listAll', $list_options); + if (PEAR::isError($available)) { + return $this->raiseError($available); + } + $data = array( + 'caption' => 'All packages:', + 'border' => true, + 'headline' => array('Package', 'Latest', 'Local'), + ); + + foreach ($available as $name => $info) { + $installed = $reg->packageInfo($name); + $desc = $info['summary']; + if (isset($params[$name])) + $desc .= "\n\n".$info['description']; + + if (isset($options['mode'])) + { + if ($options['mode'] == 'installed' && !isset($installed['version'])) + continue; + if ($options['mode'] == 'notinstalled' && isset($installed['version'])) + continue; + if ($options['mode'] == 'upgrades' + && (!isset($installed['version']) || $installed['version'] == $info['stable'])) + { + continue; + }; + }; + + $data['data'][$info['category']][] = array( + $name, + $info['stable'], + $installed['version'], + $desc, + $info['deps'], + ); + } + $this->ui->outputData($data, $command); + return true; + } - case 'list-upgrades': { - include_once "PEAR/Registry.php"; - if (empty($params[0])) { - $state = $this->config->get('preferred_state'); - } else { - $state = $params[0]; - } - $caption = 'Available Upgrades'; - if (empty($state) || $state == 'any') { - $latest = $remote->call("package.listLatestReleases"); - } else { - $latest = $remote->call("package.listLatestReleases", $state); - $caption .= ' (' . $state . ')'; - } - $caption .= ':'; - if (PEAR::isError($latest)) { - return $latest; - } - $reg = new PEAR_Registry($this->config->get('php_dir')); - $inst = array_flip($reg->listPackages()); - $this->ui->startTable(array('caption' => $caption, - 'border' => 1)); - $this->ui->tableRow(array('Package', 'Version', 'Size'), - array('bold' => true)); - foreach ($latest as $package => $info) { - if (!isset($inst[$package])) { - // skip packages we don't have installed - continue; - } - extract($info); - $inst_version = $reg->packageInfo($package, 'version'); - if (version_compare($version, $inst_version, "le")) { - // installed version is up-to-date - continue; - } - if ($filesize >= 20480) { - $filesize += 1024 - ($filesize % 1024); - $fs = sprintf("%dkB", $filesize / 1024); - } elseif ($filesize > 0) { - $filesize += 103 - ($filesize % 103); - $fs = sprintf("%.1fkB", $filesize / 1024.0); - } else { - $fs = " -"; // XXX center instead - } - $this->ui->tableRow(array($package, $version, $fs)); - } - $this->ui->endTable(); - break; - } + // }}} + // {{{ search - // }}} - default: { - return false; - } + function doSearch($command, $options, $params) + { + if ((!isset($params[0]) || empty($params[0])) + && (!isset($params[1]) || empty($params[1]))) + { + return $this->raiseError('no valid search string supplied'); + }; + + $r = new PEAR_Remote($this->config); + $reg = new PEAR_Registry($this->config->get('php_dir')); + $available = $r->call('package.listAll', true); + if (PEAR::isError($available)) { + return $this->raiseError($available); } - if ($failmsg) { - return $this->raiseError($failmsg); + $data = array( + 'caption' => 'Matched packages:', + 'border' => true, + 'headline' => array('Package', 'Latest', 'Local'), + ); + + foreach ($available as $name => $info) { + $found = (!empty($params[0]) && stristr($name, $params[0]) !== false); + if (!$found && !(isset($params[1]) && !empty($params[1]) + && (stristr($info['summary'], $params[1]) !== false + || stristr($info['description'], $params[1]) !== false))) + { + continue; + }; + + $installed = $reg->packageInfo($name); + $desc = $info['summary']; + if (isset($params[$name])) + $desc .= "\n\n".$info['description']; + + $data['data'][$info['category']][] = array( + $name, + $info['stable'], + $installed['version'], + $desc, + ); } + if (!isset($data['data'])) { + return $this->raiseError('no packages found'); + }; + $this->ui->outputData($data, $command); return true; } // }}} + // {{{ download + + function doDownload($command, $options, $params) + { + //$params[0] -> The package to download + if (count($params) != 1) { + return PEAR::raiseError("download expects one argument: the package to download"); + } + $server = $this->config->get('master_server'); + if (!ereg('^http://', $params[0])) { + $pkgfile = "http://$server/get/$params[0]"; + } else { + $pkgfile = $params[0]; + } + $this->bytes_downloaded = 0; + $saved = PEAR_Common::downloadHttp($pkgfile, $this->ui, '.', + array(&$this, 'downloadCallback')); + if (PEAR::isError($saved)) { + return $this->raiseError($saved); + } + $fname = basename($saved); + $this->ui->outputData("File $fname downloaded ($this->bytes_downloaded bytes)", $command); + return true; + } function downloadCallback($msg, $params = null) { @@ -207,6 +290,68 @@ $this->bytes_downloaded = $params; } } + + // }}} + // {{{ list-upgrades + + function doListUpgrades($command, $options, $params) + { + include_once "PEAR/Registry.php"; + $remote = new PEAR_Remote($this->config); + if (empty($params[0])) { + $state = $this->config->get('preferred_state'); + } else { + $state = $params[0]; + } + $caption = 'Available Upgrades'; + if (empty($state) || $state == 'any') { + $latest = $remote->call("package.listLatestReleases"); + } else { + $latest = $remote->call("package.listLatestReleases", $state); + $caption .= ' (' . $state . ')'; + } + $caption .= ':'; + if (PEAR::isError($latest)) { + return $latest; + } + $reg = new PEAR_Registry($this->config->get('php_dir')); + $inst = array_flip($reg->listPackages()); + $data = array( + 'caption' => $caption, + 'border' => 1, + 'headline' => array('Package', 'Version', 'Size'), + ); + foreach ($latest as $package => $info) { + if (!isset($inst[$package])) { + // skip packages we don't have installed + continue; + } + extract($info); + $inst_version = $reg->packageInfo($package, 'version'); + if (version_compare("$version", "$inst_version", "le")) { + // installed version is up-to-date + continue; + } + if ($filesize >= 20480) { + $filesize += 1024 - ($filesize % 1024); + $fs = sprintf("%dkB", $filesize / 1024); + } elseif ($filesize > 0) { + $filesize += 103 - ($filesize % 103); + $fs = sprintf("%.1fkB", $filesize / 1024.0); + } else { + $fs = " -"; // XXX center instead + } + $data['data'][] = array($package, $version, $fs); + } + if (empty($data['data'])) { + $this->ui->outputData('No upgrades available'); + } else { + $this->ui->outputData($data, $command); + } + return true; + } + + // }}} } -?> \ No newline at end of file +?> No revision No revision 1.2.2.1 +178 -26 php4/pear/PEAR/Frontend/CLI.php Index: CLI.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Frontend/CLI.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- CLI.php 29 Apr 2002 02:33:42 -0000 1.2 +++ CLI.php 9 Jul 2002 09:14:44 -0000 1.2.2.1 @@ -16,7 +16,7 @@ | Author: Stig S〓ther Bakken <ssb****@fast*****> | +----------------------------------------------------------------------+ - $Id: CLI.php,v 1.12 2002/04/14 13:34:52 mfischer Exp $ + $Id: CLI.php,v 1.23 2002/07/02 13:04:01 dickmann Exp $ */ require_once "PEAR.php"; @@ -68,11 +68,24 @@ function displayLine($text) { + trigger_error("Frontend::displayLine deprecated", E_USER_ERROR); + } + + function _displayLine($text) + { print "$this->lp$text\n"; } + // }}} + // {{{ display(text) + function display($text) { + trigger_error("Frontend::display deprecated", E_USER_ERROR); + } + + function _display($text) + { print $text; } @@ -81,7 +94,7 @@ function displayError($eobj) { - return $this->displayLine($eobj->getMessage()); + return $this->_displayLine($eobj->getMessage()); } // }}} @@ -98,6 +111,11 @@ function displayHeading($title) { + trigger_error("Frontend::displayHeading deprecated", E_USER_ERROR); + } + + function _displayHeading($title) + { print $this->lp.$this->bold($title)."\n"; print $this->lp.str_repeat("=", strlen($title))."\n"; } @@ -105,27 +123,36 @@ // }}} // {{{ userDialog(prompt, [type], [default]) - function userDialog($prompt, $type = 'text', $default = '') + function userDialog($command, $prompts, $types = array(), $defaults = array()) { - if ($type == 'password') { - system('stty -echo'); - } - print "$this->lp$prompt "; - if ($default) { - print "[$default] "; - } - print ": "; - $fp = fopen("php://stdin", "r"); - $line = fgets($fp, 2048); - fclose($fp); - if ($type == 'password') { - system('stty echo'); - print "\n"; - } - if ($default && trim($line) == "") { - return $default; + $result = array(); + if (is_array($prompts)) { + $fp = fopen("php://stdin", "r"); + foreach ($prompts as $key => $prompt) { + $type = $types[$key]; + $default = $defaults[$key]; + if ($type == 'password') { + system('stty -echo'); + } + print "$this->lp$prompt "; + if ($default) { + print "[$default] "; + } + print ": "; + $line = fgets($fp, 2048); + if ($type == 'password') { + system('stty echo'); + print "\n"; + } + if ($default && trim($line) == "") { + $result[$key] = $default; + } else { + $result[$key] = $line; + } + } + fclose($fp); } - return $line; + return $result; } // }}} @@ -133,6 +160,7 @@ function userConfirm($prompt, $default = 'yes') { + trigger_error("Frontend::userConfirm not yet converted", E_USER_ERROR); static $positives = array('y', 'yes', 'on', '1'); static $negatives = array('n', 'no', 'off', '0'); print "$this->lp$prompt [$default] : "; @@ -160,6 +188,11 @@ function startTable($params = array()) { + trigger_error("Frontend::startTable deprecated", E_USER_ERROR); + } + + function _startTable($params = array()) + { $this->omode = 'table'; $params['table_data'] = array(); $params['widest'] = array(); // indexed by column @@ -173,6 +206,11 @@ function tableRow($columns, $rowparams = array(), $colparams = array()) { + trigger_error("Frontend::tableRow deprecated", E_USER_ERROR); + } + + function _tableRow($columns, $rowparams = array(), $colparams = array()) + { $highest = 1; for ($i = 0; $i < sizeof($columns); $i++) { $col = &$columns[$i]; @@ -187,7 +225,7 @@ $w = strlen($line); } } - $lines = sizeof($lines); + $lines = sizeof($multiline); } else { $w = strlen($col); } @@ -218,10 +256,15 @@ function endTable() { + trigger_error("Frontend::tableRow deprecated", E_USER_ERROR); + } + + function _endTable() + { $this->omode = ''; extract($this->params); if (!empty($caption)) { - $this->displayHeading($caption); + $this->_displayHeading($caption); } if (count($table_data) == 0) { return; @@ -253,7 +296,7 @@ } } if ($borderline) { - $this->displayLine($borderline); + $this->_displayLine($borderline); } for ($i = 0; $i < sizeof($table_data); $i++) { extract($table_data[$i]); @@ -297,13 +340,122 @@ $rowtext .= $cellstart . $cell . $cellend; } $rowtext .= $rowend; - $this->displayLine($rowtext); + $this->_displayLine($rowtext); } } if ($borderline) { - $this->displayLine($borderline); + $this->_displayLine($borderline); } } + + // }}} + // {{{ outputData() + + function outputData($data, $command = '_default') + { + switch ($command) + { + case 'search': + $this->_startTable($data); + if (isset($data['headline']) && is_array($data['headline'])) + $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55))); + + foreach($data['data'] as $category) { + foreach($category as $pkg) { + $this->_tableRow($pkg, null, array(1 => array('wrap' => 55))); + } + }; + $this->_endTable(); + break; + case 'list-all': + $this->_startTable($data); + if (isset($data['headline']) && is_array($data['headline'])) + $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55))); + + foreach($data['data'] as $category) { + foreach($category as $pkg) { + unset($pkg[3]); + unset($pkg[4]); + $this->_tableRow($pkg, null, array(1 => array('wrap' => 55))); + } + }; + $this->_endTable(); + break; + case 'config-show': + $data['border'] = true; + $opts = array(0 => array('wrap' => 20), + 1 => array('wrap' => 20), + 2 => array('wrap' => 35)); + $this->_startTable($data); + if (isset($data['headline']) && is_array($data['headline'])) { + $this->_tableRow($data['headline'], + array('bold' => true), + $opts); + } + foreach($data['data'] as $group) { + foreach($group as $value) { + if ($value[2] == '') { + $value[2] = "<not set>"; + } + $this->_tableRow($value, null, $opts); + } + } + $this->_endTable(); + break; + case 'remote-info': + $data = array( + 'caption' => 'Package details:', + 'border' => true, + 'data' => array( + array("Latest", $data['stable']), + array("Installed", $data['installed']), + array("Package", $data['name']), + array("License", $data['license']), + array("Category", $data['category']), + array("Summary", $data['summary']), + array("Description", $data['description']), + ), + ); + default: { + if (is_array($data)) + { + $this->_startTable($data); + $count = count($data['data'][0]); + if ($count == 2) { + $opts = array(0 => array('wrap' => 25), + 1 => array('wrap' => 48) + ); + } elseif ($count == 3) { + $opts = array(0 => array('wrap' => 20), + 1 => array('wrap' => 20), + 2 => array('wrap' => 35) + ); + } + if (isset($data['headline']) && is_array($data['headline'])) { + $this->_tableRow($data['headline'], + array('bold' => true), + $opts); + } + foreach($data['data'] as $row) { + $this->_tableRow($row, null, $opts); + } + $this->_endTable(); + } else { + $this->_displayLine($data); + } + } + } + } + + // }}} + // {{{ log(text) + + + function log($text) + { + return $this->_displayLine($text); + } + // }}} // {{{ bold($text) 1.1.2.2 +8 -2 php4/pear/PEAR/Frontend/Gtk.php Index: Gtk.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Frontend/Gtk.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- Gtk.php 9 May 2002 04:17:01 -0000 1.1.2.1 +++ Gtk.php 9 Jul 2002 09:14:44 -0000 1.1.2.2 @@ -16,11 +16,15 @@ | Author: Stig S〓ther Bakken <ssb****@fast*****> | +----------------------------------------------------------------------+ - $Id: Gtk.php,v 1.1 2002/05/09 02:31:36 ssb Exp $ + $Id: Gtk.php,v 1.3 2002/06/09 18:18:01 cox Exp $ */ require_once "PEAR.php"; +/** + * @nodep GtkWindow + * @nodep gdk + */ class PEAR_Frontend_Gtk extends PEAR { // {{{ properties @@ -44,7 +48,9 @@ { parent::PEAR(); if (!extension_loaded('php_gtk')) { - dl('php_gtk.' . (OS_WINDOWS ? 'dll' : 'so')); + if (!@dl('php_gtk.' . (OS_WINDOWS ? 'dll' : 'so'))) { + die("Unable to load the php_gtk extension\n"); + } } $this->window = &new GtkWindow(); $this->window->set_title('PEAR Installer'); No revision No revision 1.2.2.1 +1 -3 php4/pear/XML/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/XML/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:33:42 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:44 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +15 -9 php4/pear/scripts/pear.bat Index: pear.bat =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/scripts/pear.bat,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- pear.bat 29 Apr 2002 02:33:43 -0000 1.2 +++ pear.bat 9 Jul 2002 09:14:44 -0000 1.2.2.1 @@ -16,16 +16,22 @@ REM Authors: Alexander Merz (alexm****@php*****) REM ---------------------------------------------------------------------- REM -REM $Id: pear.bat,v 1.7 2002/04/09 09:59:17 imajes Exp $ +REM $Id: pear.bat,v 1.8 2002/06/12 16:31:53 cox Exp $ -REM change this four lines to match the paths of your system +REM change this lines to match the paths of your system REM ------------------- -set PHP_PATH=c:\php -set PEAR_INSTALL_DIR=c:\php\pear -set PEAR_EXTENSION_DIR=c:\php\extensions -set PEAR_DOC_DIR=c:\php\pear\docs + +REM *** Unused stuff **** +REM set PHP_PATH=c:\php +REM set PEAR_INSTALL_DIR=c:\php\pear +REM set PEAR_EXTENSION_DIR=c:\php\extensions +REM set PEAR_DOC_DIR=c:\php\pear\docs REM ------------------- -set DIRECTORY_SEPARATOR=\ +REM set DIRECTORY_SEPARATOR=\ +REM %PHP_PATH%\php.exe -q %PEAR_INSTALL_DIR%\scripts\pear.in %1 %2 %3 %4 %5 %6 %7 %8 %9 + +set PHP_BIN=c:\php\php.exe +set PEAR_PATH=c:\php\pear -%PHP_PATH%\php.exe -q %PEAR_INSTALL_DIR%\scripts\pear.in %1 %2 %3 %4 %5 %6 %7 %8 %9 - @ ECHO ON \ No newline at end of file +%PHP_BIN% -C -d include_path=%PEAR_PATH% -f %PEAR_PATH%\scripts\pear.in %1 %2 %3 %4 %5 %6 %7 %8 %9 + @ ECHO ON 1.2.2.4 +66 -13 php4/pear/scripts/pear.in Index: pear.in =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/scripts/pear.in,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- pear.in 19 May 2002 11:16:07 -0000 1.2.2.3 +++ pear.in 9 Jul 2002 09:14:44 -0000 1.2.2.4 @@ -16,14 +16,25 @@ // +----------------------------------------------------------------------+ // | Authors: Stig Bakken <ssb****@fast*****> | // | Tomas V.V.Cox <cox****@idecn*****> | +// | | // +----------------------------------------------------------------------+ // +// $Id: pear.in,v 1.61 2002/06/25 13:45:29 cox Exp $ +/** + * @nodep Gtk + */ +ini_set('include_path', '@include_path@'); ini_set('allow_url_fopen', true); set_time_limit(0); ob_implicit_flush(true); ini_set('track_errors', true); ini_set('html_errors', false); +ini_set('magic_quotes_runtime', false); +error_reporting(E_ALL & ~E_NOTICE); +set_error_handler('error_handler'); + +$pear_package_version = "@pear_version@"; require_once 'PEAR.php'; require_once 'PEAR/Config.php'; @@ -34,8 +45,8 @@ $all_commands = PEAR_Command::getCommands(); $argv = Console_Getopt::readPHPArgv(); -$progname = basename(array_shift($argv)); -$options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:v"); +$progname = basename($argv[0]); +$options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:vV"); if (PEAR::isError($options)) { usage($options); } @@ -98,11 +109,13 @@ $config->remove($param, 'user'); break; case 'v': - $config->set('verbose', $verbose + 1); + $config->set('verbose', $config->get('verbose') + 1); break; case 'q': - $config->set('verbose', $verbose - 1); + $config->set('verbose', $config->get('verbose') - 1); break; + case 'V': + usage(null, 'version'); default: // all non pear params goes to the command $cmdopts[$opt[0]] = $param; @@ -118,7 +131,7 @@ $config->store('user'); } -$command = (isset($options[1][0])) ? array_shift($options[1]) : null; +$command = (isset($options[1][0])) ? $options[1][0] : null; if (empty($command) && ($store_user_config || $store_system_config)) { exit; @@ -127,15 +140,17 @@ if ($fetype == 'Gtk') { Gtk::main(); } else do { - if (empty($all_commands[$command]) || $command == 'help') { - usage(null, @$options[1][2]); + if ($command == 'help') { + usage(null, @$options[1][1]); } + PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $cmd = PEAR_Command::factory($command, $config); + PEAR::popErrorHandling(); if (PEAR::isError($cmd)) { - die($cmd->getMessage()); + usage(null, @$options[1][1]); } - + $short_args = $long_args = null; PEAR_Command::getGetoptArgs($command, $short_args, $long_args); if (PEAR::isError($tmp = Console_Getopt::getopt($options[1], $short_args, $long_args))) { @@ -173,7 +188,6 @@ { global $progname, $all_commands; $stderr = fopen('php://stderr', 'w'); - fputs($stderr, "\n"); if (PEAR::isError($error)) { fputs($stderr, $error->getMessage() . "\n"); } elseif ($error !== null) { @@ -214,17 +228,56 @@ " -s store user configuration\n". " -S store system configuration\n". " -u foo unset `foo' in the user configuration\n". - " -h, -? display help/usage (this message)\n"; + " -h, -? display help/usage (this message)\n". + " -V version information\n"; + } elseif ($command == "shortcuts") { + $sc = PEAR_Command::getShortcuts(); + $ret = "Shortcuts:\n"; + foreach ($sc as $s => $c) { + $ret .= sprintf(" %-8s %s\n", $s, $c); + } + return $ret; + + } elseif ($command == "version") { + return "PEAR $GLOBALS[pear_package_version]"; + } elseif ($help = PEAR_Command::getHelp($command)) { if (is_string($help)) { - return "Usage : $help"; + return "$progname $command [options] $help\n"; + } + if ($help[1] === null) { + return "$progname $command $help[0]"; + } else { + return "$progname $command [options] $help[0]\n$help[1]"; } - return "Usage : $progname $command {$help[0]}\n{$help[1]}"; } return "No such command"; } // }}} + +function error_handler($errno, $errmsg, $file, $line, $vars) { + if (error_reporting() == 0) { + return; // @silenced error + } + $errortype = array ( + 1 => "Error", + 2 => "Warning", + 4 => "Parsing Error", + 8 => "Notice", + 16 => "Core Error", + 32 => "Core Warning", + 64 => "Compile Error", + 128 => "Compile Warning", + 256 => "User Error", + 512 => "User Warning", + 1024=> "User Notice" + ); + $prefix = $errortype[$errno]; + $file = basename($file); + print "\n$prefix: $errmsg in $file on line $line\n"; +} + /* * Local variables: No revision No revision 1.2.2.1 +2 -4 php4/pear/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:33:43 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:44 -0000 1.2.2.1 @@ -1,5 +1,3 @@ -*.exp -*.out -*.php +*.log phpt.* -*.reg \ No newline at end of file +*.reg 1.2.2.2 +86 -24 php4/pear/tests/pear_config.phpt Index: pear_config.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/tests/pear_config.phpt,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- pear_config.phpt 19 May 2002 11:16:07 -0000 1.2.2.1 +++ pear_config.phpt 9 Jul 2002 09:14:44 -0000 1.2.2.2 @@ -12,27 +12,27 @@ copy("merge.input", "merge.conf"); PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s\n"); -print "#0 starting up\n"; +print "\n#0 starting up\n"; dump_files(); -print "#1 testing: constructor\n"; +print "\n#1 testing: constructor\n"; $config = new PEAR_Config("user.conf", "system.conf"); dump_array("files", $config->files); -print "#2 testing: singleton\n"; +print "\n#2 testing: singleton\n"; $o1 = &PEAR_Config::singleton(); $o1->blah = 'blah'; $o2 = &PEAR_Config::singleton(); var_dump($o1->blah); @var_dump($o2->blah); -print "#3 testing: readConfigFile\n"; +print "\n#3 testing: readConfigFile\n"; $config->readConfigFile("user2.conf", "user"); dump_config($config); $config->readConfigFile("user.conf"); dump_config($config); -print "#4 testing: mergeConfigFile\n"; +print "\n#4 testing: mergeConfigFile\n"; $config->readConfigFile("user2.conf"); dump_config($config, "user"); $config->mergeConfigFile("merge.conf", true); @@ -44,11 +44,11 @@ dump_config($config, "user"); $config->mergeConfigFile("merge.conf", true, "xyzzy"); -print "#5 testing: config file version detection\n"; +print "\n#5 testing: config file version detection\n"; $config->readConfigFile("user.conf", "user"); $config->readConfigFile("toonew.conf", "user"); -print "#6 testing: get/set/remove\n"; +print "\n#6 testing: get/set/remove\n"; var_dump($config->get("verbose")); $config->set("verbose", 100, "system"); var_dump($config->get("verbose")); @@ -62,21 +62,21 @@ $config->remove("verbose", "system"); var_dump($config->get("verbose")); -print "#7 testing: getType\n"; +print "\n#7 testing: getType\n"; var_dump($config->getType("__unknown__")); var_dump($config->getType("verbose")); var_dump($config->getType("master_server")); var_dump($config->getType("ext_dir")); -print "#8 testing: getDocs\n"; +print "\n#8 testing: getDocs\n"; print "master_server: " . $config->getDocs("master_server") . "\n"; -print "#9 testing: getKeys\n"; +print "\n#9 testing: getKeys\n"; $keys = $config->getKeys(); sort($keys); print implode(" ", $keys) . "\n"; -print "#10 testing: definedBy\n"; +print "\n#10 testing: definedBy\n"; var_dump($config->definedBy("verbose")); $config->set("verbose", 6, "system"); $config->set("verbose", 3, "user"); @@ -89,23 +89,34 @@ $config->remove("verbose", "system"); var_dump($config->definedBy("verbose")); -print "#11 testing: isDefined\n"; +print "\n#11 testing: isDefined\n"; var_dump($config->isDefined("php_dir")); var_dump($config->isDefined("verbose")); var_dump($config->isDefined("HTTP_GET_VARS")); var_dump($config->isDefined("query")); -/* -print "setting user values\n"; -var_dump($config->set("master_server", "pear.localdomain")); -var_dump($config->writeConfigFile(null, "user")); -dumpall(); - -print "going back to defaults\n"; -$config->remove("master_server", "user"); -$config->writeConfigFile(null, "user"); -dumpall(); -*/ +print "\n#12 testing: getGroup\n"; +foreach ($keys as $key) { + print "$key: ".$config->getGroup($key)."\n"; +} + +print "\n#13 testing: getGroups\n"; +$groups = $config->getGroups(); +sort($groups); +print implode(", ", $groups) . "\n"; + +print "\n#14 testing: getGroupKeys\n"; +foreach ($groups as $group) { + $gk = $config->getGroupKeys($group); + sort($gk); + print "$group: " . implode(", ", $gk) . "\n"; +} + +print "\n#15 testing: getPrompt\n"; +foreach ($keys as $key) { + print "$key: ".$config->getPrompt($key)."\n"; +} + // @@ -167,24 +178,30 @@ #0 starting up ..system.conf: master_server="pear.php.net" ..user.conf: <empty> + #1 testing: constructor files: system="system.conf" user="user.conf" + #2 testing: singleton string(4) "blah" string(4) "blah" + #3 testing: readConfigFile user: verbose="2" system: master_server="pear.php.net" user: <empty> system: master_server="pear.php.net" + #4 testing: mergeConfigFile user: verbose="2" user: verbose="100" user: verbose="2" user: <empty> unknown config file type `xyzzy' + #5 testing: config file version detection toonew.conf: unknown version `2.0' + #6 testing: get/set/remove int(1) int(100) @@ -192,24 +209,69 @@ int(50) int(2) int(1) + #7 testing: getType bool(false) string(7) "integer" string(6) "string" string(9) "directory" + #8 testing: getDocs master_server: name of the main PEAR server + #9 testing: getKeys -bin_dir doc_dir ext_dir http_proxy master_server password php_dir preferred_state umask username verbose +bin_dir data_dir doc_dir ext_dir http_proxy master_server password php_dir preferred_state test_dir umask username verbose + #10 testing: definedBy string(7) "default" string(4) "user" string(4) "user" string(6) "system" string(7) "default" + #11 testing: isDefined bool(true) bool(true) bool(false) bool(false) + +#12 testing: getGroup +bin_dir: File Locations +data_dir: File Locations (Advanced) +doc_dir: File Locations +ext_dir: File Locations +http_proxy: Internet Access +master_server: Internet Access +password: Maintainers +php_dir: File Locations +preferred_state: Advanced +test_dir: File Locations (Advanced) +umask: Advanced +username: Maintainers +verbose: Advanced + +#13 testing: getGroups +Advanced, File Locations, File Locations (Advanced), Internet Access, Maintainers + +#14 testing: getGroupKeys +Advanced: preferred_state, umask, verbose +File Locations: bin_dir, doc_dir, ext_dir, php_dir +File Locations (Advanced): data_dir, test_dir +Internet Access: http_proxy, master_server +Maintainers: password, username + +#15 testing: getPrompt +bin_dir: PEAR executables directory +data_dir: PEAR data directory +doc_dir: PEAR documentation directory +ext_dir: PHP extension directory +http_proxy: HTTP Proxy Server Address +master_server: PEAR server +password: PEAR password (for package maintainers) +php_dir: PEAR directory +preferred_state: Preferred Package State +test_dir: PEAR test directory +umask: Unix file mask +username: PEAR username (for package maintainers) +verbose: Debug Log Level done 1.2.2.1 +13 -0 php4/pear/tests/pear_error4.phpt Index: pear_error4.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/tests/pear_error4.phpt,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- pear_error4.phpt 29 Apr 2002 02:33:43 -0000 1.2 +++ pear_error4.phpt 9 Jul 2002 09:14:44 -0000 1.2.2.1 @@ -72,6 +72,15 @@ $obj->raiseError("syntax error"); $obj->popExpect(); +print "subtest 8\n"; +$obj->expectError(array(1, 2, 3)); +$obj->expectError(array(3, 4, 5)); +$obj->raiseError(4); +$obj->delExpect(2); +$obj->raiseError(3); +$obj->delExpect(1, 3, 4, 5); +$err = $obj->delExpect(2); + ?> --EXPECT-- subtest 1 @@ -87,3 +96,7 @@ subtest 6 subtest 7 error: type mismatch +subtest 8 +error: 4 +error: 3 +error: The expected error you submitted does not exist No revision No revision 1.2.2.2 +4 -4 php4/sapi/aolserver/aolserver.c Index: aolserver.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/aolserver/aolserver.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- aolserver.c 19 May 2002 11:16:07 -0000 1.2.2.1 +++ aolserver.c 9 Jul 2002 09:14:44 -0000 1.2.2.2 @@ -22,7 +22,7 @@ * - CGI/1.1 conformance */ -/* $Id: aolserver.c,v 1.68 2002/05/11 02:58:43 zeev Exp $ */ +/* $Id: aolserver.c,v 1.69 2002/06/26 07:54:49 sas Exp $ */ /* conflict between PHP and AOLserver headers */ #define Debug php_Debug @@ -205,7 +205,7 @@ int i; php_info_print_table_start(); - php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.68 2002/05/11 02:58:43 zeev Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.69 2002/06/26 07:54:49 sas Exp $"); php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -310,9 +310,9 @@ char *value = Ns_SetValue(NSG(conn->headers), i); char *p; char c; - int buf_len; - buf_len = snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key); + snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key); + for(p = buf + 5; (c = *p); p++) { c = toupper(c); if(c < 'A' || c > 'Z') { No revision No revision 1.2.2.2 +3 -2 php4/sapi/apache/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache/config.m4,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- config.m4 19 May 2002 11:16:07 -0000 1.2.2.1 +++ config.m4 9 Jul 2002 09:14:44 -0000 1.2.2.2 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.56 2002/05/17 08:07:13 jwoolley Exp $ +dnl $Id: config.m4,v 1.58 2002/06/29 00:12:46 rasmus Exp $ dnl AC_MSG_CHECKING(for Apache 1.x module support via DSO through APXS) @@ -36,7 +36,8 @@ APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET` # Test that we're trying to configure with apache 1.x - APACHE_VERSION=`$APXS_HTTPD -v | head -1 | cut -f3 -d' ' | cut -f2 -d'/' | cut -f1 -d'-' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` +dnl APACHE_VERSION=`$APXS_HTTPD -v | head -1 | cut -f3 -d' ' | cut -f2 -d'/' | cut -f1 -d'-' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + APACHE_VERSION=`$APXS_HTTPD -v | head -1 | awk 'BEGIN { RS=" "; } /Apache/ { print $0; }' | cut -f2 -d'/' | cut -f1 -d'-' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` if test "$APACHE_VERSION" -ge 2000000; then AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2]) fi 1.2.2.3 +7 -2 php4/sapi/apache/mod_php4.c Index: mod_php4.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache/mod_php4.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- mod_php4.c 19 May 2002 11:16:07 -0000 1.2.2.2 +++ mod_php4.c 9 Jul 2002 09:14:44 -0000 1.2.2.3 @@ -17,10 +17,14 @@ | PHP 4.0 patches by Zeev Suraski <zeev****@zend*****> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.131 2002/05/11 03:33:29 zeev Exp $ */ +/* $Id: mod_php4.c,v 1.134 2002/06/21 14:47:58 sesser Exp $ */ #include "php_apache_http.h" +#ifdef NETWARE +#define SIGPIPE SIGINT +#endif + #if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) #include "ext/mbstring/mbstring.h" #endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */ @@ -159,6 +163,7 @@ header_content = p = strchr(header_name, ':'); if (!p) { + efree(sapi_header->header); return 0; } @@ -399,7 +404,7 @@ authorization = table_get(r->headers_in, "Authorization"); } if (authorization -/* && !auth_type(r) */ + && !auth_type(r) && !strcasecmp(getword(r->pool, &authorization, ' '), "Basic")) { tmp = uudecode(r->pool, authorization); SG(request_info).auth_user = getword_nulls_nc(r->pool, &tmp, ':'); 1.2.2.1 +42 -6 php4/sapi/apache/php_apache.c Index: php_apache.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache/php_apache.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_apache.c 29 Apr 2002 02:33:44 -0000 1.2 +++ php_apache.c 9 Jul 2002 09:14:44 -0000 1.2.2.1 @@ -17,11 +17,11 @@ | David Sklar <sklar****@stude*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_apache.c,v 1.58 2002/04/23 11:40:19 hholzgra Exp $ */ +/* $Id: php_apache.c,v 1.65 2002/06/01 17:38:23 sas Exp $ */ #include "php_apache_http.h" -#ifdef PHP_WIN32 +#if defined(PHP_WIN32) || defined(NETWARE) #include "zend.h" #include "ap_compat.h" #else @@ -39,7 +39,8 @@ extern module *top_module; PHP_FUNCTION(virtual); -PHP_FUNCTION(getallheaders); +PHP_FUNCTION(apache_request_headers); +PHP_FUNCTION(apache_response_headers); PHP_FUNCTION(apachelog); PHP_FUNCTION(apache_note); PHP_FUNCTION(apache_lookup_uri); @@ -50,11 +51,13 @@ function_entry apache_functions[] = { PHP_FE(virtual, NULL) - PHP_FE(getallheaders, NULL) + PHP_FE(apache_request_headers, NULL) PHP_FE(apache_note, NULL) PHP_FE(apache_lookup_uri, NULL) PHP_FE(apache_child_terminate, NULL) PHP_FE(apache_setenv, NULL) + PHP_FE(apache_response_headers, NULL) + PHP_FALIAS(getallheaders, apache_request_headers, NULL) {NULL, NULL, NULL} }; @@ -77,7 +80,7 @@ static PHP_MINIT_FUNCTION(apache) { #ifdef ZTS - ts_allocate_id(&php_apache_info_id, sizeof(php_apache_info_struct), php_apache_globals_ctor, NULL); + ts_allocate_id(&php_apache_info_id, sizeof(php_apache_info_struct), (ts_allocate_ctor) php_apache_globals_ctor, NULL); #else php_apache_globals_ctor(&php_apache_info TSRMLS_CC); #endif @@ -180,6 +183,10 @@ php_info_print_table_row(1, "Apache for Windows 95/NT"); php_info_print_table_end(); php_info_print_table_start(); +#elif defined(NETWARE) + php_info_print_table_row(1, "Apache for NetWare"); + php_info_print_table_end(); + php_info_print_table_start(); #else php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE); php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET); @@ -204,6 +211,10 @@ sprintf(output_buf, "Connection: %d - Keep-Alive: %d", serv->timeout, serv->keep_alive_timeout); php_info_print_table_row(2, "Timeouts", output_buf); #if !defined(WIN32) && !defined(WINNT) +/* + This block seems to be working on NetWare; But it seems to be showing + all modules instead of just the loaded ones +*/ php_info_print_table_row(2, "Server Root", server_root); strcpy(modulenames, ""); @@ -321,8 +332,11 @@ /* }}} */ /* {{{ proto array getallheaders(void) + Alias for apache_request_headers() */ +/* }}} */ +/* {{{ proto array apache_request_headers(void) Fetch all HTTP request headers */ -PHP_FUNCTION(getallheaders) +PHP_FUNCTION(apache_request_headers) { array_header *env_arr; table_entry *tenv; @@ -343,6 +357,28 @@ RETURN_FALSE; } } +} +/* }}} */ + +/* {{{ proto array apache_response_headers(void) + Fetch all HTTP response headers */ +PHP_FUNCTION(apache_response_headers) +{ + array_header *env_arr; + table_entry *tenv; + int i; + + if (array_init(return_value) == FAILURE) { + RETURN_FALSE; + } + env_arr = table_elts(((request_rec *) SG(server_context))->headers_out); + tenv = (table_entry *)env_arr->elts; + for (i = 0; i < env_arr->nelts; ++i) { + if (!tenv[i].key) continue; + if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) { + RETURN_FALSE; + } + } } /* }}} */ 1.2.2.1 +4 -0 php4/sapi/apache/php_apache_http.h Index: php_apache_http.h =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache/php_apache_http.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_apache_http.h 29 Apr 2002 02:33:44 -0000 1.2 +++ php_apache_http.h 9 Jul 2002 09:14:44 -0000 1.2.2.1 @@ -5,6 +5,10 @@ #include <stddef.h> #endif +#ifdef NETWARE +#include <netinet/in.h> +#endif + #include "zend.h" #include "php_regex.h" No revision No revision 1.2.2.1 +1 -2 php4/sapi/apache2filter/README Index: README =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache2filter/README,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- README 29 Apr 2002 02:33:44 -0000 1.2 +++ README 9 Jul 2002 09:14:44 -0000 1.2.2.1 @@ -17,8 +17,7 @@ HOW TO INSTALL - Get the latest Apache 2.0 sources from CVS and install it. This - SAPI module is known to work with Apache 2.0.35. + This SAPI module is known to work with Apache 2.0.40. $ cd apache-2.x $ cd src 1.2.2.2 +2 -2 php4/sapi/apache2filter/apache_config.c Index: apache_config.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache2filter/apache_config.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- apache_config.c 19 May 2002 11:16:08 -0000 1.2.2.1 +++ apache_config.c 9 Jul 2002 09:14:44 -0000 1.2.2.2 @@ -165,9 +165,9 @@ "PHP Value Modifier"), AP_INIT_TAKE2("php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, "PHP Flag Modifier"), - AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF, + AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, "PHP Value Modifier (Admin)"), - AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF, + AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, "PHP Flag Modifier (Admin)"), AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, "Directory containing the php.ini file"), 1.2.2.3 +13 -8 php4/sapi/apache2filter/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache2filter/config.m4,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- config.m4 19 May 2002 11:16:08 -0000 1.2.2.2 +++ config.m4 9 Jul 2002 09:14:44 -0000 1.2.2.3 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.17 2002/05/17 08:07:14 jwoolley Exp $ +dnl $Id: config.m4,v 1.21 2002/06/29 00:33:02 sniper Exp $ dnl AC_MSG_CHECKING(for Apache 2.0 module support via DSO through APXS) @@ -34,6 +34,7 @@ APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR` APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET` APXS_CFLAGS=`$APXS -q CFLAGS` + APXS_MPM=`$APXS -q MPM_NAME` for flag in $APXS_CFLAGS; do case $flag in @@ -42,19 +43,21 @@ done # Test that we're trying to configure with apache 2.x - APACHE_VERSION=`$APXS_HTTPD -v | head -1 | cut -f3 -d' ' | cut -f2 -d'/' | cut -f1 -d'-' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + APACHE_VERSION=`$APXS_HTTPD -v | head -1 | awk 'BEGIN { RS=" "; } /Apache/ { print $0; }' | cut -f2 -d'/' | cut -f1 -d'-' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` if test "$APACHE_VERSION" -le 2000000; then AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)]) - elif test "$APACHE_VERSION" -lt 2000035; then - AC_MSG_ERROR([Please note that Apache version >= 2.0.35 is required.]) + elif test "$APACHE_VERSION" -lt 2000040; then + AC_MSG_ERROR([Please note that Apache version >= 2.0.40 is required.]) fi + INSTALL_IT="\$(mkinstalldirs) \"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" && $APXS -S LIBEXECDIR=\"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" -i `[ -d \`$APXS -q SYSCONFDIR\` ] || echo -a` -n php4" + case $host_alias in *aix*) APXS_SBINDIR=`$APXS -q SBINDIR` EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-bI:$APXS_SBINDIR/httpd.exp" PHP_SELECT_SAPI(apache2filter, shared, sapi_apache2.c apache_config.c php_functions.c) - INSTALL_IT="$APXS -i -a -n php4 $SAPI_LIBTOOL" + INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL" ;; *darwin*) dnl When using bundles on Darwin, we must resolve all symbols. However, @@ -72,16 +75,18 @@ PHP_SUBST(MH_BUNDLE_FLAGS) PHP_SELECT_SAPI(apache2filter, bundle, sapi_apache2.c apache_config.c php_functions.c) SAPI_SHARED=libs/libphp4.so - INSTALL_IT="$APXS -i -a -n php4 $SAPI_SHARED" + INSTALL_IT="$INSTALL_IT $SAPI_SHARED" ;; *) PHP_SELECT_SAPI(apache2filter, shared, sapi_apache2.c apache_config.c php_functions.c) - INSTALL_IT="$APXS -i -a -n php4 $SAPI_LIBTOOL" + INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL" ;; esac PHP_ADD_INCLUDE($APXS_INCLUDEDIR) - PHP_BUILD_THREAD_SAFE + if test "$APXS_MPM" != "prefork"; then + PHP_BUILD_THREAD_SAFE + fi AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) 1.2.2.2 +1 -1 php4/sapi/apache2filter/php_functions.c Index: php_functions.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache2filter/php_functions.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php_functions.c 19 May 2002 11:16:08 -0000 1.2.2.1 +++ php_functions.c 9 Jul 2002 09:14:44 -0000 1.2.2.2 @@ -93,7 +93,7 @@ ADD_STRING(method); ADD_TIME(mtime); ADD_LONG(clength); -#if !MODULE_MAGIC_AT_LEAST(20020506,0) +#if MODULE_MAGIC_NUMBER < 20020506 ADD_STRING(boundary); #endif ADD_STRING(range); 1.2.2.2 +23 -5 php4/sapi/apache2filter/sapi_apache2.c Index: sapi_apache2.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache2filter/sapi_apache2.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- sapi_apache2.c 9 May 2002 04:17:01 -0000 1.2.2.1 +++ sapi_apache2.c 9 Jul 2002 09:14:44 -0000 1.2.2.2 @@ -40,6 +40,7 @@ #include "http_main.h" #include "util_script.h" #include "http_core.h" +#include "ap_mpm.h" #include "php_apache.h" @@ -66,13 +67,15 @@ b = apr_bucket_transient_create(str, str_length, ba); APR_BRIGADE_INSERT_TAIL(bb, b); +#if 0 /* Add a Flush bucket to the end of this brigade, so that * the transient buckets above are more likely to make it out * the end of the filter instead of having to be copied into * someone's setaside. */ b = apr_bucket_flush_create(ba); APR_BRIGADE_INSERT_TAIL(bb, b); - +#endif + if (ap_pass_brigade(f->next, bb) != APR_SUCCESS) { php_handle_aborted_connection(); } @@ -92,7 +95,10 @@ val = strchr(sapi_header->header, ':'); - if (!val) return 0; + if (!val) { + sapi_free_header(sapi_header); + return 0; + } *val = '\0'; @@ -423,7 +429,9 @@ { apache2_sapi_module.shutdown(&apache2_sapi_module); sapi_shutdown(); +#ifdef ZTS tsrm_shutdown(); +#endif return APR_SUCCESS; } @@ -437,6 +445,15 @@ static int php_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { +#ifndef ZTS + int threaded_mpm; + + ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm); + if(threaded_mpm) { + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, 0, "Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP."); + return DONE; + } +#endif /* When this is NULL, apache won't override the hard-coded default * php.ini path setting. */ apache2_php_ini_path_override = NULL; @@ -468,8 +485,9 @@ if (apache2_php_ini_path_override) { apache2_sapi_module.php_ini_path_override = apache2_php_ini_path_override; } - +#ifdef ZTS tsrm_startup(1, 1, 0, NULL); +#endif sapi_startup(&apache2_sapi_module); apache2_sapi_module.startup(&apache2_sapi_module); apr_pool_cleanup_register(pconf, NULL, php_apache_server_shutdown, apr_pool_cleanup_null); @@ -546,8 +564,8 @@ ap_hook_post_config(php_apache_server_startup, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_insert_filter(php_insert_filter, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_post_read_request(php_post_read_request, NULL, NULL, APR_HOOK_MIDDLE); - ap_register_output_filter("PHP", php_output_filter, AP_FTYPE_RESOURCE); - ap_register_input_filter("PHP", php_input_filter, AP_FTYPE_RESOURCE); + ap_register_output_filter("PHP", php_output_filter, NULL, AP_FTYPE_RESOURCE); + ap_register_input_filter("PHP", php_input_filter, NULL, AP_FTYPE_RESOURCE); } AP_MODULE_DECLARE_DATA module php4_module = { No revision No revision 1.2.2.4 +19 -11 php4/sapi/cgi/cgi_main.c Index: cgi_main.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/cgi/cgi_main.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- cgi_main.c 19 May 2002 11:16:08 -0000 1.2.2.3 +++ cgi_main.c 9 Jul 2002 09:14:44 -0000 1.2.2.4 @@ -1020,11 +1020,8 @@ switch (behavior) { case PHP_MODE_STANDARD: - if (php_execute_script(&file_handle TSRMLS_CC)) { - exit_status = EG(exit_status); - } else { - exit_status = 255; - } + php_execute_script(&file_handle TSRMLS_CC); + exit_status = EG(exit_status); break; case PHP_MODE_LINT: PG(during_request_startup) = 0; @@ -1065,13 +1062,24 @@ #endif } - if (SG(request_info).path_translated) { - persist_alloc(SG(request_info).path_translated); - } + { + char *path_translated; + + /* Go through this trouble so that the memory manager doesn't warn + * about SG(request_info).path_translated leaking + */ + if (SG(request_info).path_translated) { + path_translated = strdup(SG(request_info).path_translated); + STR_FREE(SG(request_info).path_translated); + SG(request_info).path_translated = path_translated; + } + + php_request_shutdown((void *) 0); - php_request_shutdown((void *) 0); - - STR_FREE(SG(request_info).path_translated); + if (SG(request_info).path_translated) { + free(SG(request_info).path_translated); + } + } #ifdef PHP_FASTCGI if (!fastcgi) break; No revision No revision 1.2.2.1 +12 -2 php4/sapi/cli/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/cli/config.m4,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- config.m4 29 Apr 2002 02:33:45 -0000 1.2 +++ config.m4 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -1,11 +1,12 @@ dnl -dnl $Id: config.m4,v 1.5 2002/04/14 03:57:59 sniper Exp $ +dnl $Id: config.m4,v 1.7 2002/07/01 21:17:39 markonen Exp $ dnl AC_MSG_CHECKING(for CLI build) AC_ARG_ENABLE(cli, -[ --disable-cli Disable building CLI version of PHP.], +[ --disable-cli Disable building CLI version of PHP + (this forces --without-pear).], [ PHP_SAPI_CLI=$enableval ],[ @@ -13,7 +14,16 @@ ]) if test "$PHP_SAPI_CLI" != "no"; then + case $host_alias in + *darwin*) + BUILD_CLI="\$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o sapi/cli/php" + ;; + *) + BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o sapi/cli/php" + ;; + esac INSTALL_CLI="\$(INSTALL) -m 0755 sapi/cli/php \$(INSTALL_ROOT)\$(bindir)/php" + PHP_SUBST(BUILD_CLI) PHP_SUBST(INSTALL_CLI) else PHP_DISABLE_CLI 1.2.2.3 +56 -5 php4/sapi/cli/php_cli.c Index: php_cli.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/cli/php_cli.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- php_cli.c 19 May 2002 11:16:08 -0000 1.2.2.2 +++ php_cli.c 9 Jul 2002 09:14:45 -0000 1.2.2.3 @@ -296,6 +296,55 @@ efree(*arg); } +static void cli_register_file_handles(TSRMLS_D) +{ + zval *zin, *zout, *zerr; + php_stream *s_in, *s_out, *s_err; + php_stream_context *sc_in=NULL, *sc_out=NULL, *sc_err=NULL; + zend_constant ic, oc, ec; + + MAKE_STD_ZVAL(zin); + MAKE_STD_ZVAL(zout); + MAKE_STD_ZVAL(zerr); + + s_in = php_stream_open_wrapper_ex("php://stdin", "rb", 0, NULL, sc_in); + s_out = php_stream_open_wrapper_ex("php://stdout", "wb", 0, NULL, sc_out); + s_err = php_stream_open_wrapper_ex("php://stderr", "wb", 0, NULL, sc_err); + + if (s_in==NULL || s_out==NULL || s_err==NULL) { + return; + } + + php_stream_to_zval(s_in, zin); + php_stream_to_zval(s_out, zout); + php_stream_to_zval(s_err, zerr); + + ic.value = *zin; + zval_copy_ctor(&ic.value); + ic.flags = CONST_CS | CONST_PERSISTENT; + ic.name = zend_strndup("STDIN", 6); + ic.name_len = 6; + zend_register_constant(&ic TSRMLS_CC); + + oc.value = *zout; + zval_copy_ctor(&oc.value); + oc.flags = CONST_CS | CONST_PERSISTENT; + oc.name = zend_strndup("STDOUT", 7); + oc.name_len = 7; + zend_register_constant(&oc TSRMLS_CC); + + ec.value = *zerr; + zval_copy_ctor(&ec.value); + ec.flags = CONST_CS | CONST_PERSISTENT; + ec.name = zend_strndup("STDERR", 7); + ec.name_len = 7; + zend_register_constant(&ec TSRMLS_CC); + + FREE_ZVAL(zin); + FREE_ZVAL(zout); + FREE_ZVAL(zerr); +} + /* {{{ main */ int main(int argc, char *argv[]) @@ -619,11 +668,11 @@ switch (behavior) { case PHP_MODE_STANDARD: - if (php_execute_script(&file_handle TSRMLS_CC)) { - exit_status = EG(exit_status); - } else { - exit_status = 255; + if (strcmp(file_handle.filename, "-")) { + cli_register_file_handles(TSRMLS_C); } + php_execute_script(&file_handle TSRMLS_CC); + exit_status = EG(exit_status); break; case PHP_MODE_LINT: PG(during_request_startup) = 0; @@ -663,9 +712,11 @@ break; #endif case PHP_MODE_CLI_DIRECT: + cli_register_file_handles(TSRMLS_C); if (zend_eval_string(exec_direct, NULL, "Command line code" TSRMLS_CC) == FAILURE) { exit_status=254; } + break; } php_request_shutdown((void *) 0); @@ -675,7 +726,7 @@ } } zend_catch { - exit_status = 255; + exit_status = EG(exit_status); } zend_end_try(); php_module_shutdown(TSRMLS_C); No revision No revision 1.2.2.1 +1 -0 php4/sapi/nsapi/nsapi.c Index: nsapi.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/nsapi/nsapi.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- nsapi.c 29 Apr 2002 02:33:46 -0000 1.2 +++ nsapi.c 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -156,6 +156,7 @@ header_name = sapi_header->header; header_content = p = strchr(header_name, ':'); if (p == NULL) { + efree(sapi_header->header); return 0; } No revision No revision 1.2.2.1 +3 -3 php4/sapi/pi3web/pi3web_sapi.c Index: pi3web_sapi.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/pi3web/pi3web_sapi.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- pi3web_sapi.c 29 Apr 2002 02:33:46 -0000 1.2 +++ pi3web_sapi.c 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pi3web_sapi.c,v 1.40 2002/02/23 15:16:59 holger Exp $ */ +/* $Id: pi3web_sapi.c,v 1.41 2002/06/21 09:31:21 derick Exp $ */ #include "pi3web_sapi.h" #include "php.h" @@ -77,7 +77,7 @@ PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n"); PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">Pi3Web Server Information</th></tr>\n"); php_info_print_table_header(2, "Information Field", "Value"); - php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c,v 1.40 2002/02/23 15:16:59 holger Exp $"); + php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c,v 1.41 2002/06/21 09:31:21 derick Exp $"); php_info_print_table_row(2, "Server Name Stamp", HTTPCore_getServerStamp()); snprintf(variable_buf, 511, "%d", HTTPCore_debugEnabled()); php_info_print_table_row(2, "Debug Enabled", variable_buf); @@ -424,7 +424,7 @@ break; case PHP_MODE_INDENT: header_line = (char *)estrdup("Content-Type: text/plain"); - sapi_add_header_ex(header_line, strlen(header_line), 1, 1 TSRMLS_CC); + sapi_add_header_ex(header_line, strlen(header_line), 1, 1, 0 TSRMLS_CC); if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS ) { zend_indent(); No revision No revision 1.2.2.1 +1 -1 php4/sapi/tux/php_tux.c Index: php_tux.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/tux/php_tux.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_tux.c 29 Apr 2002 02:33:47 -0000 1.2 +++ php_tux.c 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -195,7 +195,7 @@ sprintf(buf, "Server: %s", TUXAPI_version); - sapi_add_header_ex(buf, strlen(buf), 1, 0 TSRMLS_CC); + sapi_add_header_ex(buf, strlen(buf), 1, 0, 0 TSRMLS_CC); php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC); php_register_variable("SERVER_SOFTWARE", TUXAPI_version, track_vars_array TSRMLS_CC); php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC); No revision No revision 1.2.2.1 +1 -3 php4/tests/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:33:47 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out +*.log phpt.* -dirname.php No revision No revision 1.2.2.1 +1 -3 php4/tests/basic/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/basic/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:33:48 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/tests/classes/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/classes/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:33:48 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/tests/func/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/func/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:33:48 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/tests/lang/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/lang/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:33:48 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +1 -3 php4/tests/strings/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/strings/.cvsignore,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- .cvsignore 29 Apr 2002 02:33:49 -0000 1.2 +++ .cvsignore 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -1,4 +1,2 @@ -*.exp -*.out -*.php +*.log phpt.* No revision No revision 1.2.2.1 +156 -14 php4/win32/install.txt Index: install.txt =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/install.txt,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- install.txt 29 Apr 2002 02:33:50 -0000 1.2 +++ install.txt 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -104,6 +104,8 @@ %SYSTEMROOT% directory is typically: c:\windows for Windows 95/98 c:\winnt or c:\winnt40 for NT/2000/XP servers + We will refer to %SYSTEMROOT% for both %WINDOWS% or + %SYSTEMROOT% throughout the text. Edit your php.ini file: @@ -204,25 +206,76 @@ on Windows. One is to use the CGI binary (php-cgi.exe), the other is to use the Apache module dll. In either case you need to stop the Apache server, and edit your - srm.conf or httpd.conf to configure Apache to work with PHP. + httpd.conf or srm.conf to configure Apache to work with PHP. + We'll refer to either of these files with httpd.conf in the + text. Although there can be a few variations of configuring PHP under Apache, these are simple enough to be used by the newcomer. Please consult the Apache Docs for further configuration directives. + + Installing PHP for Apache as module + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Now that version 4.1 introduces a safer sapi module, we recommend that you configure PHP as a module in Apache. - To do this, you should move php4ts.dll to the windows/system (for Windows 9x/Me) - or winnt/system32 (for Windows NT/2000/XP) directory, overwriting any - older file. Then you should add the following three lines to your Apache - conf file: (swap c:/php/ for your PHP install path) + To accomplish this, you have to load the php4apache.dll in your + Apache httpd.conf. + + !! NOTE !! + Whereever you load php4apache.dll from, php4apache.dll also + needs the php4ts.dll also included in the PHP4 distribution. + php4apache.dll depends on php4ts.dll which is loaded as soon as + Apache loads php4apache.dll. If php4ts.dll can't be found, you + usually get an error like (also see the "Problems?" section at + the end of the file): + + Cannot load c:/php/sapi/php4apache.dll into server + + So where does php4ts.dll has to be to be properly loaded ? + php4ts.dll is searched in the following order: + + 1) in the directory where apache.exe is start from + 2) in the directory where php4apache.dll is loaded from + 3) in your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and + %SYSTEMROOT% directory. + Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP) + 4) in your whole %PATH% + + Note: What is %SYSTEMROOT% ? Depending on your Windows + installation this may be for example c:\winnt or C:\windows + + Usually you would just copy it over to %SYSTEMROOT%\System32. + But if you want to have multiple PHP installations (for + whatever reason) this is a bad idea. For this circumstance the + safest thing is to let php4ts.dll reside in the same directory + where php4apache.dll is loaded from (see point 2 above). + + + After you've set up the file layout properly, you're ready to + finally configure Apache to load the PHP4 module. Just add the + following lines to your httpd.conf: LoadModule php4_module c:/php/sapi/php4apache.dll AddModule mod_php4.c AddType application/x-httpd-php .php + Note: Especially newer versions of Apache do not need the + AddModule directive anymore, your milage may vary. + + + Where do I have to put the php.ini ? + The php.ini files is only searched in two places: + 1) in your Apache installation directory (e.g. c:\apache\apache) + 2) in your %SYSTEMROOT% directory. + + + Installing PHP for Apache as CGI binary + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + If you wish to install PHP as a CGI binary, read this first: http://www.cert.org/advisories/CA-1996-11.html @@ -253,9 +306,21 @@ If you wish to use this feature with the cgi binary, create a new file, and use the show_source("path/to/original_file.php"); function. - On Win-Apache all backslashes in a path statement such - as: "c:\directory\file.ext", must be converted to - forward slashes. + + Forward or backslash in pathnames ? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + On Win-Apache, path names can contain either forward- or backslashes. + Example: + + LoadModule php4_module C:\php\sapi\php4apache.dll + + works as good as + + LoadModule php4_module C:/php/sapi/php4apache.dll + + You even can mix the slash-style: + + LoadModule php4_module C:\php/sapi\php4apache.dll ---------------------------------------------------------- @@ -369,6 +434,16 @@ add execute rights for I_USR_ to the directory that contains php-cgi.exe + !NOTE!: Since 4.1.2, the php.ini setting cgi.force_redirect defaults to '1' + which effectively prevents the cgi from working within IIS. You need to set + up at least a minimal php.ini file with the following directive: + + cgi.force_redirect = 0 + + If it doesn't work immidiately, make sure you have the php.ini file in the + right place (%SYSTEMROOT%\php.ini). + + To use the ISAPI module, do the following: If you don't want to perform HTTP Authentication using PHP, @@ -551,7 +626,7 @@ Something went wrong when the server tried to run PHP. To get to see a sensible error message, from the command line, change to the directory - containing php-cgi.exe and run <literal>php-cgi.exe -i</literal> + containing php-cgi.exe and run "php-cgi.exe -i" (without quotes). If php has any problems running, then a suitable error message will be displayed which will give you a clue as to what needs to be done next. If you get a screen full of html codes (the output of the phpinfo() function) then @@ -586,6 +661,69 @@ There is also the additional benefit that IIS will do any authentication required for you based on the NTLanMan permissions on your script file. + + You have inherent problems loading the right DLL? + Sometimes, loading the right DLL can be a pain on Windows. + Advanced Windows users may use a tool called strace (named + after the famous Unix application) to trace file access on the + system (however, it only works on NT-alike Windows, read: + NT/2000/XP). It can be found at + http://razor.bindview.com/tools/desc/strace_readme.html . Read + the instruction there carefully! + + Example scenery: + + Apache/PHP4 as module. Though I've properly configured + php4apache.dll in httpd.conf, I always get: + + Syntax error on line 1025 of c:/apache/apache/conf/httpd.conf: + Cannot load c:/php/php-4.2.1-win32/sapi/php4apache.dll into server + + But c:/php/php-4.2.1-win32/sapi/php4apache.dll definitely + exists: + + dir c:\php\php-4.2.1-win32\sapi\php4apache.dll + Directory of c:\php\php-4.2.1-win32\sapi + 13.05.2002 00:01 24.576 php4apache.dll + + 'strace'ing the apache.exe binary revealed the following: + c: + cd \apache\apache + strace apache >strace.txt + + Then looking into strace.txt: + [...] +729 3348 3248 NtOpenSection (0xe, {24, 24, 0x40, 0, 0, "php4ts.dll"}, ... ) == STATUS_OBJECT_NAME_NOT_FOUND +731 3348 3248 NtQueryAttributesFile ({24, 0, 0x40, 0, 0, "\??\c:\php\php-4.2.1-win32\sapi\php4ts.dll"}, 1234824, ... ) == STATUS_OBJECT_NAME_NOT_FOUND +733 3348 3248 NtQueryAttributesFile ({24, 108, 0x40, 0, 0, "php4ts.dll"}, 1234824, ... ) == STATUS_OBJECT_NAME_NOT_FOUND +735 3348 3248 NtQueryAttributesFile ({24, 0, 0x40, 0, 0, "\??\C:\WINNT\System32\php4ts.dll"}, 1234824, ... ) == STATUS_OBJECT_NAME_NOT_FOUND + [...] + + This went on quiet some time for all directories in the %PATH% + environment variable. The solution finally was to copy + php4ts.dll in any of the directories searched by the System (I + prefered to use c:\php\php-4.2.1-win32\sapi). + + Note: This does not only apply to php4ts.dll but in fact to every + DLL which gets loaded through PHP too. So, if you've + problems running your PHP CLI application because it + can't load a certain library but you're sure it's there, + try this tool. + + + I'm using IIS/CGI and everytime I try to access a php file I get + "Security Alert! The PHP CGI cannot be accessed directly." + + Since 4.1.2, the php.ini setting cgi.force_redirect defaults to '1' which + effectively prevents the cgi from working within IIS. You need to set up at + least a minimal php.ini file with the following directive: + + cgi.force_redirect = 0 + + If it doesn't work immidiately, make sure you have the php.ini file in the + right place (%SYSTEMROOT%\php.ini). + + Other problems If you are still stuck, someone on the PHP installation mailing list may be able to help you. You should check out the archive first, in case @@ -609,9 +747,13 @@ If you think you have found a bug in PHP, please report it. The PHP developers probably don't know about it, and unless you - report it, chances are it won't be fixed. You can report bugs - using the bug-tracking system at http://bugs.php.net/ + report it, chances are it won't be fixed. + + 1) Read about Bugs-Dos-And-Donts + http://bugs.php.net/bugs-dos-and-donts.php + + 2) If you think you've found a bug, read + http://bugs.php.net/bugs-dos-and-donts.php - Read the Bugs-Dos-And-Donts at - http://bugs.php.net/bugs-dos-and-donts.php - _BEFORE_ submitting any bug reports! + 3) Feel welcome to file a report at + http://bugs.php.net/ 1.2.2.3 +4 -0 php4/win32/php4dll.dsp Index: php4dll.dsp =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/php4dll.dsp,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- php4dll.dsp 2 May 2002 22:01:53 -0000 1.2.2.2 +++ php4dll.dsp 9 Jul 2002 09:14:45 -0000 1.2.2.3 @@ -923,6 +923,10 @@ # End Source File # Begin Source File +SOURCE=..\ext\mbstring\mbfilter_ru.c +# End Source File +# Begin Source File + SOURCE=..\ext\mbstring\mbfilter_tw.c # End Source File # Begin Source File 1.2.2.4 +16 -0 php4/win32/php4dllts.dsp Index: php4dllts.dsp =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/php4dllts.dsp,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- php4dllts.dsp 19 May 2002 11:16:08 -0000 1.2.2.3 +++ php4dllts.dsp 9 Jul 2002 09:14:45 -0000 1.2.2.4 @@ -513,6 +513,10 @@ # End Source File # Begin Source File +SOURCE=..\ext\mbstring\mbfilter_ru.c +# End Source File +# Begin Source File + SOURCE=..\ext\mbstring\mbfilter_tw.c # End Source File # Begin Source File @@ -1448,6 +1452,10 @@ # End Source File # Begin Source File +SOURCE=..\ext\com\dispatch.c +# End Source File +# Begin Source File + SOURCE=..\ext\com\VARIANT.c # End Source File # End Group @@ -1920,6 +1928,10 @@ # End Source File # Begin Source File +SOURCE=.\glob.c +# End Source File +# Begin Source File + SOURCE=.\md5crypt.c # End Source File # Begin Source File @@ -1965,6 +1977,10 @@ # Begin Source File SOURCE=.\crypt_win32.h +# End Source File +# Begin Source File + +SOURCE=.\glob.h # End Source File # Begin Source File 1.2.2.2 +16 -1 php4/win32/php4ts.dsw Index: php4ts.dsw =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/php4ts.dsw,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- php4ts.dsw 19 May 2002 11:16:08 -0000 1.2.2.1 +++ php4ts.dsw 9 Jul 2002 09:14:45 -0000 1.2.2.2 @@ -42,6 +42,21 @@ ############################################################################### +Project: "php4activescript"="..\SAPI\activescript\php4activescript.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name php4dllts + End Project Dependency +}}} + +############################################################################### + Project: "php4aolserver"="..\sapi\aolserver\php4aolserver.dsp" - Package Owner=<4> Package=<5> @@ -195,7 +210,7 @@ ############################################################################### -Project: "tests"="..\tests\tests.dsp" - Package Owner=<4> +Project: "testsuite"=".\testsuite.dsp" - Package Owner=<4> Package=<5> {{{ 1.2.2.1 +12 -0 php4/win32/php_modules.dsw Index: php_modules.dsw =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/php_modules.dsw,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- php_modules.dsw 29 Apr 2002 02:33:50 -0000 1.2 +++ php_modules.dsw 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -195,6 +195,18 @@ ############################################################################### +Project: "gd_bundled"=..\ext\gd\gd_bundled.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "gettext"=..\ext\gettext\gettext.dsp - Package Owner=<4> Package=<5> 1.2.2.2 +208 -64 php4/win32/sendmail.c Index: sendmail.c =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/sendmail.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- sendmail.c 19 May 2002 11:16:08 -0000 1.2.2.1 +++ sendmail.c 9 Jul 2002 09:14:45 -0000 1.2.2.2 @@ -17,7 +17,7 @@ * */ -/* $Id: sendmail.c,v 1.32 2002/05/17 16:16:27 mfischer Exp $ */ +/* $Id: sendmail.c,v 1.46 2002/07/02 23:44:06 fmk Exp $ */ #include "php.h" /*php specific */ #include <stdio.h> @@ -31,6 +31,10 @@ #include "sendmail.h" #include "php_ini.h" +#if HAVE_PCRE || HAVE_BUNDLED_PCRE +#include "ext/pcre/php_pcre.h" +#endif + /* extern int _daylight; extern long _timezone; @@ -52,10 +56,12 @@ response is ecalloc()d in Ack() itself and efree()d here because the content is in *error_message now */ #define SMTP_ERROR_RESPONSE(response) { \ - if (NULL != (*error_message = ecalloc(1, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response)))) { \ - snprintf(*error_message, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response), SMTP_ERROR_RESPONSE_SPEC, response); \ + if (response && error_message) { \ + if (NULL != (*error_message = ecalloc(1, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response)))) { \ + snprintf(*error_message, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response), SMTP_ERROR_RESPONSE_SPEC, response); \ + } \ + efree(response); \ } \ - efree(response); \ } #ifndef THREAD_SAFE @@ -100,10 +106,78 @@ {"Bad Mail Host"}, {"Bad Message File"}, {"\"sendmail_from\" not set in php.ini or custom \"From:\" header missing"}, - {"Mailserver rejected our \"sendmail_from\" setting"} /* 20 */ + {"Mailserver rejected our \"sendmail_from\" setting"}, /* 20 */ + {"Error while trimming mail header with PCRE, please file a bug report at http://bugs.php.net/"} /* 21 */ }; +/* This pattern converts all single occurences of \n (Unix) + * withour a leading \r to \r\n and all occurences of \r (Mac) + * without a trailing \n to \r\n + * Thx to Nibbler from ircnet/#linuxger + */ +#define PHP_WIN32_MAIL_UNIFY_PATTERN "/(\r\n?)|\n/" +#define PHP_WIN32_MAIL_UNIFY_REPLACE "\r\n" + +/* This pattern removes \r\n from the start of the string, + * \r\n from the end of the string and also makes sure every line + * is only wrapped with a single \r\n (thus reduces multiple + * occurences of \r\n between lines to a single \r\n) */ +#define PHP_WIN32_MAIL_RMVDBL_PATTERN "/^\r\n|(\r\n)+$/m" +#define PHP_WIN32_MAIL_RMVDBL_REPLACE "" + +/* This function is meant to unify the headers passed to to mail() + * This means, use PCRE to transform single occurences of \n or \r in \r\n + * As a second step we also eleminate all \r\n occurences which are: + * 1) At the start of the header + * 2) At the end of the header + * 3) Two or more occurences in the header are removed so only one is left + * + * Returns NULL on error, or the new char* buffer on success. + * You have to take care and efree() the buffer on your own. + */ +static char *php_win32_mail_trim_header(char *header TSRMLS_DC) +{ +#if HAVE_PCRE || HAVE_BUNDLED_PCRE + + char *result, *result2; + int result_len; + zval *replace; + + if (!header) { + return NULL; + } + + MAKE_STD_ZVAL(replace); + ZVAL_STRING(replace, PHP_WIN32_MAIL_UNIFY_REPLACE, 0); + + result = php_pcre_replace(PHP_WIN32_MAIL_UNIFY_PATTERN, sizeof(PHP_WIN32_MAIL_UNIFY_PATTERN)-1, + header, strlen(header), + replace, + 0, + &result_len, + -1 TSRMLS_CC); + if (NULL == result) { + FREE_ZVAL(replace); + return NULL; + } + + ZVAL_STRING(replace, PHP_WIN32_MAIL_RMVDBL_REPLACE, 0); + + result2 = php_pcre_replace(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1, + result, result_len, + replace, + 0, + &result_len, + -1 TSRMLS_CC); + efree(result); + FREE_ZVAL(replace); + return result2; +#else + /* In case we don't have PCRE support (for whatever reason...) simply do nothing and return the unmodified header */ + return estrdup(header); +#endif +} /********************************************************************* // Name: TSendMail @@ -119,11 +193,13 @@ // See SendText() for additional args! //********************************************************************/ int TSendMail(char *host, int *error, char **error_message, - char *headers, char *Subject, char *mailTo, char *data) + char *headers, char *Subject, char *mailTo, char *data, + char *mailCc, char *mailBcc, char *mailRPath) { int ret; char *RPath = NULL; char *headers_lc = NULL; /* headers_lc is only created if we've a header at all */ + TSRMLS_FETCH(); WinsockStarted = FALSE; @@ -137,52 +213,41 @@ strcpy(MailHost, host); } - /* use from address as return path (if specified in headers) */ if (headers) { char *pos = NULL; size_t i; + + /* Use PCRE to trim the header into the right format */ + if (NULL == (headers = php_win32_mail_trim_header(headers TSRMLS_CC))) { + *error = W32_SM_PCRE_ERROR; + return FAILURE; + } + /* Create a lowercased header for all the searches so we're finally case * insensitive when searching for a pattern. */ if (NULL == (headers_lc = estrdup(headers))) { + efree(headers); *error = OUT_OF_MEMORY; return FAILURE; } for (i = 0; i < strlen(headers_lc); i++) { headers_lc[i] = tolower(headers_lc[i]); } - /* Try to match 'from:' only at start of the string or after following a \r\n */ - if (strstr(headers_lc, "\r\nfrom:")) { - pos = strstr(headers_lc, "\r\nfrom:") + 7; /* Jump over the string "\r\nfrom:", hence the 7 */ - } else if (!strncmp(headers_lc, "from:", 5)) { - pos = headers + 5; /* Jump over the string "from:", hence the 5 */ - } - if (pos) { - char *pos_end; - /* Let pos point to the real header string */ - pos = headers + (pos - headers_lc); - /* Ignore any whitespaces */ - while (pos && ((*pos == ' ' || *pos == '\t'))) - pos++; - /* Match until \r\n or end of header string */ - if (pos_end = strstr(pos, "\r\n")) { - RPath = estrndup(pos, pos_end - pos); - } else { - RPath = estrndup(pos, strlen(pos)); - } - } } /* Fall back to sendmail_from php.ini setting */ - if (!RPath) { - if (INI_STR("sendmail_from")) { - RPath = estrdup(INI_STR("sendmail_from")); - } else { - if (headers_lc) { - efree(headers_lc); - } - *error = W32_SM_SENDMAIL_FROM_NOT_SET; - return FAILURE; + if (mailRPath && *mailRPath) { + RPath = estrdup(mailRPath); + } + else if (INI_STR("sendmail_from")) { + RPath = estrdup(INI_STR("sendmail_from")); + } else { + if (headers) { + efree(headers); + efree(headers_lc); } + *error = W32_SM_SENDMAIL_FROM_NOT_SET; + return FAILURE; } /* attempt to connect with mail host */ @@ -191,22 +256,27 @@ if (RPath) { efree(RPath); } - if (headers_lc) { + if (headers) { + efree(headers); efree(headers_lc); } /* 128 is safe here, the specifier in snprintf isn't longer than that */ if (NULL == (*error_message = ecalloc(1, HOST_NAME_LEN + 128))) { return FAILURE; } - snprintf(*error_message, HOST_NAME_LEN + 128, "Failed to connect to mailserver at \"%s\", verify your \"SMTP\" setting in php.ini", MailHost); + snprintf(*error_message, HOST_NAME_LEN + 128, + "Failed to connect to mailserver at \"%s\" port %d, verify your \"SMTP\"" + "and \"smtp_port\" setting in php.ini or use ini_set()", + MailHost, !INI_INT("smtp_port") ? 25 : INI_INT("smtp_port")); return FAILURE; } else { - ret = SendText(RPath, Subject, mailTo, data, headers, headers_lc, error_message); + ret = SendText(RPath, Subject, mailTo, mailCc, mailBcc, data, headers, headers_lc, error_message); TSMClose(); if (RPath) { efree(RPath); } - if (headers_lc) { + if (headers) { + efree(headers); efree(headers_lc); } if (ret != SUCCESS) { @@ -277,7 +347,8 @@ // Author/Date: jcar 20/9/96 // History: //*******************************************************************/ -int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers, char *headers_lc, char **error_message) +int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data, + char *headers, char *headers_lc, char **error_message) { int res, i; char *p; @@ -316,7 +387,7 @@ return (res); } - sprintf(Buffer, "MAIL FROM:<%s>\r\n", RPath); + snprintf(Buffer, MAIL_BUFFER_SIZE, "MAIL FROM:<%s>\r\n", RPath); if ((res = Post(Buffer)) != SUCCESS) return (res); if ((res = Ack(&server_response)) != SUCCESS) { @@ -324,17 +395,19 @@ return W32_SM_SENDMAIL_FROM_MALFORMED; } - tempMailTo = estrdup(mailTo); /* Send mail to all rcpt's */ token = strtok(tempMailTo, ","); while(token != NULL) { - sprintf(Buffer, "RCPT TO:<%s>\r\n", token); - if ((res = Post(Buffer)) != SUCCESS) + snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token); + if ((res = Post(Buffer)) != SUCCESS) { + efree(tempMailTo); return (res); + } if ((res = Ack(&server_response)) != SUCCESS) { SMTP_ERROR_RESPONSE(server_response); + efree(tempMailTo); return (res); } token = strtok(NULL, ","); @@ -371,6 +444,27 @@ efree(tempMailTo); } + if (mailCc && *mailCc) { + tempMailTo = estrdup(mailCc); + /* Send mail to all rcpt's */ + token = strtok(tempMailTo, ","); + while(token != NULL) + { + snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token); + if ((res = Post(Buffer)) != SUCCESS) { + efree(tempMailTo); + return (res); + } + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); + efree(tempMailTo); + return (res); + } + token = strtok(NULL, ","); + } + efree(tempMailTo); + } + /* Send mail to all Bcc rcpt's This is basically a rip of the Cc code above. Just don't forget to remove the Bcc: from the header afterwards. */ @@ -432,6 +526,27 @@ } } + if (mailBcc && *mailBcc) { + tempMailTo = estrdup(mailBcc); + /* Send mail to all rcpt's */ + token = strtok(tempMailTo, ","); + while(token != NULL) + { + snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token); + if ((res = Post(Buffer)) != SUCCESS) { + efree(tempMailTo); + return (res); + } + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); + efree(tempMailTo); + return (res); + } + token = strtok(NULL, ","); + } + efree(tempMailTo); + } + if ((res = Post("DATA\r\n")) != SUCCESS) { efree(stripped_header); return (res); @@ -493,7 +608,13 @@ return (SUCCESS); } - +int addToHeader(char **header_buffer, const char *specifier, char *string) { + if (NULL == (*header_buffer = erealloc(*header_buffer, strlen(*header_buffer) + strlen(specifier) + strlen(string) + 1))) { + return 0; + } + sprintf(*header_buffer + strlen(*header_buffer), specifier, string); + return 1; +} /********************************************************************* // Name: PostHeader @@ -517,7 +638,7 @@ struct tm *tm = localtime(&tNow); int zoneh = abs(_timezone); int zonem, res; - char *p; + char *header_buffer; char *headers_lc = NULL; size_t i; @@ -530,12 +651,15 @@ } } - p = Buffer; + if (NULL == (header_buffer = ecalloc(1, MAIL_BUFFER_SIZE))) { + efree(headers_lc); + return OUT_OF_MEMORY; + } zoneh /= (60 * 60); zonem = (abs(_timezone) / 60) - (zoneh * 60); if(!xheaders || !strstr(headers_lc, "date:")){ - p += sprintf(p, "Date: %s, %02d %s %04d %02d:%02d:%02d %s%02d%02d\r\n", + sprintf(header_buffer, "Date: %s, %02d %s %04d %02d:%02d:%02d %s%02d%02d\r\n", days[tm->tm_wday], tm->tm_mday, months[tm->tm_mon], @@ -548,33 +672,53 @@ zonem); } - if(!headers_lc || !strstr(headers_lc, "from:")){ - p += sprintf(p, "From: %s\r\n", RPath); + if (!headers_lc || !strstr(headers_lc, "from:")) { + if (!addToHeader(&header_buffer, "From: %s\r\n", RPath)) { + goto PostHeader_outofmem; + } + } + if (!addToHeader(&header_buffer, "Subject: %s\r\n", Subject)) { + goto PostHeader_outofmem; + } + + /* Only add the To: field from the $to parameter if isn't in the custom headers */ + if ((headers_lc && (!strstr(headers_lc, "\r\nto:") && (strncmp(headers_lc, "to:", 3) != 0))) || !headers_lc) { + if (!addToHeader(&header_buffer, "To: %s\r\n", mailTo)) { + goto PostHeader_outofmem; + } } - p += sprintf(p, "Subject: %s\r\n", Subject); - p += sprintf(p, "To: %s\r\n", mailTo); + if (mailCc && *mailCc) { - p += sprintf(p, "Cc: %s\r\n", mailCc); + if (!addToHeader(&header_buffer, "Cc: %s\r\n", mailCc)) { + goto PostHeader_outofmem; + } } if(xheaders){ - p += sprintf(p, "%s\r\n", xheaders); + if (!addToHeader(&header_buffer, "%s\r\n", xheaders)) { + goto PostHeader_outofmem; + } } - if ((res = Post(Buffer)) != SUCCESS) { - if (headers_lc) { - efree(headers_lc); - } + if (headers_lc) { + efree(headers_lc); + } + if ((res = Post(header_buffer)) != SUCCESS) { + efree(header_buffer); return (res); } + efree(header_buffer); if ((res = Post("\r\n")) != SUCCESS) { - if (headers_lc) { - efree(headers_lc); - } return (res); } return (SUCCESS); + +PostHeader_outofmem: + if (headers_lc) { + efree(headers_lc); + } + return OUT_OF_MEMORY; } @@ -609,7 +753,7 @@ } */ - portnum = (short) INI_INT("sendmail_port"); + portnum = (short) INI_INT("smtp_port"); if (!portnum) { portnum = 25; } @@ -693,7 +837,7 @@ And not contain a space followed by a '-' */ if (buf[0] > '3') { - /* If we've a valid pointer, return the SMTP server response so the error messages give away more information */ + /* If we've a valid pointer, return the SMTP server response so the error message contains more information */ if (server_response) { int dec = 0; /* See if we have something like \r, \n, \r\n or \n\r at the end of the message and chop it off */ 1.2.2.2 +6 -3 php4/win32/sendmail.h Index: sendmail.h =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/sendmail.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- sendmail.h 19 May 2002 11:16:08 -0000 1.2.2.1 +++ sendmail.h 9 Jul 2002 09:14:45 -0000 1.2.2.2 @@ -28,13 +28,16 @@ #define BAD_MSG_FILE 18 #define W32_SM_SENDMAIL_FROM_NOT_SET 19 #define W32_SM_SENDMAIL_FROM_MALFORMED 20 -#define MAX_ERROR_INDEX 21 /* Always last error message + 1 */ +#define W32_SM_PCRE_ERROR 21 +#define MAX_ERROR_INDEX 22 /* Always last error message + 1 */ int TSendMail(char *smtpaddr, int *returnerror, char **error_message, - char *RPath, char *Subject, char *mailTo, char *data); + char *RPath, char *Subject, char *mailTo, char *data, + char *mailCc, char *mailBcc, char *mailRPath); void TSMClose(void); -int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers, char *headers_lc, char **error_message); +int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data, + char *headers, char *headers_lc, char **error_message); char *GetSMErrorText(int index); int MailConnect(); 1.2.2.1 +3 -3 php4/win32/time.c Index: time.c =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/time.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- time.c 29 Apr 2002 02:33:50 -0000 1.2 +++ time.c 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -11,7 +11,7 @@ * *****************************************************************************/ -/* $Id: time.c,v 1.5 2001/02/04 15:52:32 jmoore Exp $ */ +/* $Id: time.c,v 1.6 2002/06/23 23:22:33 edink Exp $ */ /** * @@ -44,7 +44,7 @@ -int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info) +PHPAPI int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info) { static struct timeval starttime = {0, 0}; @@ -186,7 +186,7 @@ return 0; } -int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) +PHPAPI int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) { int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec; int repeat = TIME_ONESHOT; 1.2.2.1 +3 -2 php4/win32/time.h Index: time.h =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/time.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- time.h 29 Apr 2002 02:33:50 -0000 1.2 +++ time.h 9 Jul 2002 09:14:45 -0000 1.2.2.1 @@ -15,6 +15,7 @@ /* Include stuff ************************************************************ */ #include <winsock.h> #include <time.h> +#include <php.h> /* Struct stuff ************************************************************* */ struct timezone { @@ -34,10 +35,10 @@ #define ITIMER_PROF 2 /*generates sigprof */ /* Prototype stuff ********************************************************** */ -extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info); +PHPAPI extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info); /* setitimer operates at 100 millisecond resolution */ -extern int setitimer(int which, const struct itimerval *value, +PHPAPI extern int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue); #endif