Yasuo Ohgaki
yohga****@users*****
2002年 8月 3日 (土) 07:05:27 JST
yohgaki 02/08/03 07:05:26 Modified: . .cvsignore ChangeLog EXTENSIONS INSTALL NEWS README.CVS-RULES README.SUBMITTING_PATCH configure.in php.ini-dist php.ini-recommended run-tests.php ext/calendar calendar.c easter.c php_calendar.h ext/com conversion.c ext/crack crack.dsp ext/ctype ctype.c ext/ctype/tests 002.phpt ext/domxml config.m4 php_domxml.c php_domxml.h ext/exif exif.c ext/gd/libgd gd.c ext/imap php_imap.c php_imap.h ext/interbase interbase.c ext/java config.m4 ext/mime_magic TODO ext/mssql php_mssql.c php_mssql.h ext/openssl openssl.c ext/pcre php_pcre.c php_pcre.h ext/pgsql pgsql.c php_pgsql.h ext/session session.c ext/snmp snmp.c ext/sockets config.m4 sockets.c ext/standard array.c basic_functions.c dir.c file.c filestat.c head.c info.c mail.c php_array.h string.c url_scanner_ex.c ext/standard/tests/aggregation aggregate.phpt aggregate_methods.phpt aggregate_methods_by_list.phpt aggregate_methods_by_regexp.phpt aggregate_properties.phpt aggregate_properties_by_list.phpt aggregate_properties_by_regexp.phpt aggregation_info.phpt deaggregate.phpt ext/standard/tests/file 003.inc 003.phpt ext/swf swf.c ext/sysvsem php_sysvsem.h sysvsem.c ext/wddx php_wddx.h wddx.c ext/zip php_zip.h main SAPI.h config.w32.h.in fopen_wrappers.c main.c output.c php_ini.c php_ini.h php_main.h php_open_temporary_file.c rfc1867.c pear Makefile.frag pear/Archive Tar.php pear/Console Getopt.php pear/PEAR Command.php Common.php Config.php Dependency.php Installer.php Remote.php pear/PEAR/Command Auth.php Common.php Config.php Install.php Package.php pear/scripts pear.in php-config.in phpize.in pear/tests pear_config.phpt pear_registry.phpt sapi/aolserver aolserver.c sapi/apache config.m4 mod_php4.c sapi/apache2filter apache_config.c config.m4 php_functions.c sapi/cgi cgi_main.c sapi/cli TODO php_cli.c sapi/fastcgi config.m4 sapi/thttpd thttpd.c tests dirname.phpt tests/basic 002.phpt 003.phpt 004.phpt 005.phpt 011.phpt tests/lang 029.phpt 031.phpt win32 .cvsignore crypt_win32.c imap_sendmail.c php4dllts.dsp php4ts.dsw sendmail.c sendmail.h Added: ext/zip zip.dsp pear package-Archive_Tar.xml package-Console_Getopt.xml package-PEAR.xml tests php.ini tests.dsp tests.mak win32 md5crypt.c md5crypt.h Log: Merge from cvs.php.net Revision Changes Path 1.3 +1 -0 php4/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 29 Apr 2002 02:26:18 -0000 1.2 +++ .cvsignore 2 Aug 2002 22:05:22 -0000 1.3 @@ -57,3 +57,4 @@ .FBCIndex .FBCLockFolder debug.log +confdefs.h 1.6 +868 -0 php4/ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/php-i18n/php4/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ChangeLog 9 May 2002 05:39:43 -0000 1.5 +++ ChangeLog 2 Aug 2002 22:05:22 -0000 1.6 @@ -1,3 +1,871 @@ +2002-05-18 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.c: + - delete attributes as well in php_free_xml_node + - more consistent naming in phpinfo() + + * ext/domxml/php_domxml.c: added "domxml API version" in phpinfo() output. + + * ext/domxml/php_domxml.c: + MFH for memleak fixes in domxml_dump_mem and domxml_html_dump_mem + + * ext/domxml/php_domxml.c: mem leak fix for domxml_dump_node + + * ext/domxml/php_domxml.c: fixes memleak in html_dump_mem + + * ext/domxml/php_domxml.c: + rename the object name for comment nodes to domcoment + +2002-05-18 Markus Fischer <mfisc****@guru*****> + + * ext/standard/dir.c: + - Fix portability issues with empty results on Linux and FreeBSD, add safe_mode + check and simplify code. + +2002-05-18 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.c: MFH for memleak patch + + * ext/domxml/php_domxml.c: WS fixes + + * ext/domxml/php_domxml.c: + This should fix a big bad memory leak in freeing the nodes at script end. + +2002-05-17 Sascha Schumann <sasch****@schum*****> + + * sapi/thttpd/thttpd.c: Improve readability of the header send function + +2002-05-17 Markus Fischer <mfisc****@guru*****> + + * NEWS: - Stuff all Win32 mail() changes together. + +2002-05-17 Jon Parise <jon****@csh*****> + + * NEWS: Credit where credit is due. + +2002-05-17 Markus Fischer <mfisc****@guru*****> + + * win32/sendmail.c + win32/sendmail.h: + - Win32 mail() is no longer case-sensitive when it comes to match for any headers + (e.g. from:, cc:, etc). + +2002-05-17 Preston L. Bannister <prest****@cox*****> + + * win32/php4ts.dsw: + Re-add "tests" project - this is the only change to file. For some reason MSVC chose to put "" around all the project file names. (Why? Ask Microsoft :). Perhaps different patch levels on MSVC6?). These files are not hand-edited. + +2002-05-17 Wez Furlong <wez.p****@thebr*****> + + * ext/openssl/openssl.c: proto tweak + + * ext/sysvsem/sysvsem.c + ext/sysvsem/php_sysvsem.h: + Add an optional flag to sem_get that specifies if the semaphore should be + automatically released on request shutdown. (#16986) + Fix a segfault in sem_remove (#17274) + +2002-05-17 Joseph Tate <jtate****@mi-co*****> + + * win32/php4ts.dsw: + Reverted the last commit which moved all the projects around. + + +2002-05-17 Cliff Woolley <jwool****@apach*****> + + * sapi/apache2filter/config.m4 + sapi/apache/config.m4: + Allow the version checks for --with-apxs= and --with-apxs2= to work + with development version of Apache, whose version strings end in "-dev", + eg "Apache/2.0.37-dev". + + PR: 17233 + Submitted by: Dale Ghent <daleg****@eleme*****> + + * ext/standard/head.c: + Only the last cookie was getting set. (You can have + more than one Set-Cookie: header, as indicated by + http://wp.netscape.com/newsref/std/cookie_spec.html.) + + PR: 16626 + Submitted by: regin****@hitel***** + + * sapi/apache2filter/php_functions.c: + apache 2.0's apache_lookup_uri() was returning an array rather than an + object, which contradicted both the documentation and the behavior of the + same function under apache 1.3. + + PR: 14999 + + * sapi/apache2filter/apache_config.c: + * restore the php_flag and php_admin_flag Apache directives which for + some mysterious reason never made their way from sapi/apache to + sapi/apache2filter when it was first written PR: 16629 + * change the allowed locations of php_admin_value (and php_admin_flag to + match) to ACCESS_CONF instead of OR_NONE to match sapi/apache. No + idea why it was ever OR_NONE. PR: 16489 + +2002-05-17 Preston L. Bannister <prest****@cox*****> + + * tests/php.ini: Default INI file used with run-tests.php + +2002-05-16 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.h + ext/domxml/php_domxml.c: + - replaced domxml_doc_document_element implementation do use libxml2 method + - renamed domxml_add_root to domxml_doc_add_root (and added alias for BC) + - aliased $doc->get_root to domxml_document_element + - added domxml_doc_set_root to change the root node (Lukas Schroeder) + +2002-05-16 Preston L. Bannister <prest****@cox*****> + + * tests/lang/031.phpt: More detailed/explanatory output. + + * tests/lang/029.phpt: Make failed case tell you what was different. + + * tests/basic/011.phpt: + Make test valid for either "register globals" setting. + + * ext/ctype/tests/002.phpt: + Restrict ctype tests to POSIX portable characters (0..127) and add numeric character tests. + + * ext/standard/tests/aggregation/aggregate.phpt + ext/standard/tests/aggregation/aggregate_methods.phpt + ext/standard/tests/aggregation/aggregate_methods_by_list.phpt + ext/standard/tests/aggregation/aggregate_methods_by_regexp.phpt + ext/standard/tests/aggregation/aggregate_properties.phpt + ext/standard/tests/aggregation/aggregate_properties_by_list.phpt + ext/standard/tests/aggregation/aggregate_properties_by_regexp.phpt + ext/standard/tests/aggregation/aggregation_info.phpt + ext/standard/tests/aggregation/deaggregate.phpt: + Remove leading "./" from include filenames as in PHP this defeats include_path. + + * win32/php4ts.dsw: + Add "tests" project to invoke run-tests.php (unit tests). + + * run-tests.php: + Updated to run cleanly on Win32, and perform a more controlled test. + + * tests/tests.mak: Add TEST_PHP_DETAILED usage for verbose test runs. + + * tests/basic/002.phpt + tests/basic/003.phpt + tests/basic/004.phpt + tests/basic/005.phpt: Fix typo in SKIP clause. + + * ext/standard/string.c: + Adjust dirname() on Win32 to match CWD per drive semantics. + + * tests/dirname.phpt: dirname() checks that work for both Unix and Win32. + +2002-05-16 Jani Taskinen <snipe****@iki*****> + + * ext/standard/filestat.c: MFH + +2002-05-16 Rasmus Lerdorf <rasmu****@lerdo*****> + + * ext/standard/string.c: MFH just in case + + * ext/standard/string.c: Grr.. I keep leaving my debug in... + + * ext/standard/string.c: Fix for #17271 + +2002-05-16 Preston L. Bannister <prest****@cox*****> + + * ext/mbstring/mbstring.c: Range check arguments to mb_strcut(). + Test ext/mbstring/013.phpt causes a hard failure w/o this. + + * ext/mbstring/mbregex.h: Proper declaration to suppress compiler warning. + +2002-05-16 Jani Taskinen <snipe****@iki*****> + + * ext/standard/filestat.c + ext/standard/tests/file/003.inc + ext/standard/tests/file/003.phpt: + - Made all is_*() functions to return only boolean values. + - Killed the "file not found" error for is_link(). (finally..) + +2002-05-15 Preston L. Bannister <prest****@cox*****> + + * tests/tests.dsp + tests/tests.mak: Win32 project and makefile used to invoke run-tests.php + +2002-05-15 Frank M. Kromann <frank****@front*****> + + * ext/mssql/php_mssql.c: + Fixing the mssql_query to handle multiple results correct if the first result does not return any data. + +2002-05-15 Harald Radi <h.rad****@nme*****> + + * ext/com/conversion.c: MFH + + + * ext/com/conversion.c: this should finally fix bug #14353 + +2002-05-15 Frank M. Kromann <frank****@front*****> + + * win32/sendmail.c + win32/sendmail.h: Fixing line breaks + + * win32/imap_sendmail.c: + Fixing build of IMAP extension, after changes in sendmail + +2002-05-15 Markus Fischer <mfisc****@guru*****> + + * win32/imap_sendmail.c: - Accommodate API changes to Ack(). + +2002-05-15 Christian Stocker <chreg****@phant*****> + + * ext/domxml/config.m4: + libxml2 >= 2.4.14 is needed (since quite some time ...) + +2002-05-15 Jani Taskinen <snipe****@iki*****> + + * NEWS: Cleanup + +2002-05-15 Rui Hirokawa <rui_hirok****@ybb*****> + + * NEWS: Added Chinese, Korean support in mbstring. + + * ext/mbstring/mbfilter.c + ext/mbstring/mbfilter_cn.c + ext/mbstring/mbfilter_kr.c + ext/mbstring/mbfilter_kr.h + ext/mbstring/mbstring.c: added ISO-2022-KR support in mbstring. + +2002-05-15 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Common.php: make downloadHttp() detect HTTP errors + +2002-05-15 Jani Taskinen <snipe****@iki*****> + + * INSTALL: MFB + + * INSTALL: Nuke 4.1 for good this time. + + * INSTALL: MFH + + * INSTALL: Nuke .1 + + * EXTENSIONS: Added ctype to this list too. + +2002-05-15 Markus Fischer <mfisc****@guru*****> + + * win32/sendmail.c: - Add support for Bcc in w32/sendmail code. + +2002-05-15 Derick Rethans <d.ret****@jdime*****> + + * ext/ctype/ctype.c: - It's bundled, thus not experimental anymore + +2002-05-14 Frank M. Kromann <frank****@front*****> + + * ext/mssql/php_mssql.h + ext/mssql/php_mssql.c: Fixing hanfling of data type REAL. + Remove extra bytes allocated by emalloc calls + +2002-05-14 Rui Hirokawa <rui_hirok****@ybb*****> + + * ext/mbstring/mbfilter_tw.c: fixed a initialization bug in euc-tw. + +2002-05-14 Sascha Schumann <sasch****@schum*****> + + * configure.in: + some versions of autoconf pad CONFIG_FILES with a single space. + + accomodate that + + Thanks to Cliff Woolley + +2002-05-14 Markus Fischer <mfisc****@guru*****> + + * ext/standard/mail.c: + - Adjust for improved error messages from win32/sendmail.c + + * win32/sendmail.c + win32/sendmail.h: + - Improve code so errors returned from the server are reported back to the user. + +2002-05-14 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Config.php: + Try to create the dir where the conf file resides before trying + to write to it + + * pear/scripts/pear.in: Add "\n" after the error in usage() + +2002-05-14 Markus Fischer <mfisc****@guru*****> + + * win32/sendmail.c: + - Do not include the Cc: for the first Cc'd recipient (spotted by Richard). + + * win32/sendmail.c + win32/sendmail.h: - Convert unix to dos line endings. + + * win32/sendmail.c: + - Try to find From: field in header, fallback to sendmail_from php.ini setting + (Original patch by Michael Sisolak <msiso****@yahoo*****>, enhanced a bit). + - Win32 mail() supports parsing 'From:' field from header (msiso****@yahoo*****, Markus). + + * win32/sendmail.c + win32/sendmail.h: - MFH fix for Cc: crash + + * win32/sendmail.h + win32/sendmail.c: + - Fix win32 sendmail bug with Cc: in custom header not terminated with \r\n + - Fix some obvious errors returned by the module, little cleanup. + +2002-05-14 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Config.php: * convert to new command setup + + * pear/PEAR/Command/Auth.php: * typo + +2002-05-14 Jan Lehnardt <jan****@dasmo*****> + + * README.CVS-RULES: - MFH + + * README.CVS-RULES: - fix typo, thanks to georg for spotting it. + +2002-05-14 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Remote.php: * fall back to XML_RPC if xmlrpc-epi is not loaded + + * pear/PEAR/Command/Auth.php: + * add command definitions, split run() into one method for each command + + * pear/PEAR/Command/Install.php: * no need for getHelp() here anymore + + * pear/PEAR/Command/Common.php: * moved get{Help,Commands,Options} here + + * pear/scripts/pear.in: + * moved the {config xxx} help message substitution to + PEAR_Command_Common::getHelp + +2002-05-14 Jason Greene <jason****@inetg*****> + + * sapi/fastcgi/config.m4: Fix fastcgi build, may need more work + +2002-05-13 Marko Karppinen <karpp****@pobox*****> + + * sapi/apache2filter/config.m4: + Patch by Justin Erenkrantz <jeren****@apach*****> for enabling + --with-apxs2 build on Darwin. Omitting the change to start linking + with libtool for now, though. + +2002-05-13 Rasmus Lerdorf <rasmu****@lerdo*****> + + * ext/gd/libgd/gd.c: fix copyresampled bug in bundled gd lib + +2002-05-13 Jim Jagielski <jim****@jaguN*****> + + * sapi/apache2filter/apache_config.c: + More verbose but more generic error message when we spot multiple + PHPINIDir directives + +2002-05-13 Rasmus Lerdorf <rasmu****@lerdo*****> + + * ext/standard/filestat.c: MFH + + * ext/standard/filestat.c: Make sure newtime is never NULL + +2002-05-13 Jan Lehnardt <jan****@dasmo*****> + + * README.CVS-RULES: - MFH + + * README.CVS-RULES: - added reference to http://cvsbook.red-bean.com/ + +2002-05-13 Zeev Suraski <zeev****@zend*****> + + * ext/standard/info.c: - Fix a buglet in printing of GPCSE arrays + - Remove indirect access + +2002-05-13 Andrei Zmievski <andre****@php*****> + + * ext/standard/array.c + ext/standard/php_array.h + ext/session/session.c + ext/wddx/php_wddx.h + ext/wddx/wddx.c + pear/Console/Getopt.php + ext/pcre/php_pcre.c + ext/pcre/php_pcre.h: Changing email address. + +2002-05-13 Derick Rethans <d.ret****@jdime*****> + + * configure.in + main/php_version.h: - Bumb version number + +2002-05-13 Sander Roobol <phy****@wanad*****> + + * .cvsignore: Added confdefs.h which seems to be generated by configure + +2002-05-13 Zeev Suraski <zeev****@zend*****> + + * main/main.c + ext/standard/info.c: - Centralize html_puts() again + - Revolutionize phpinfo()'s speed + +2002-05-13 Jon Parise <jon****@csh*****> + + * ext/imap/php_imap.c: + Instead of calling mail_fetchheader_full() to retrieve the complete header + information just to extract the message envelope, call mail_fetchenvelope(), + which returns just what we need. + + This is simpler, faster, and saves the IMAP server some work. + + Submitted by: Adam Kauffman <adam.****@minds*****> + +2002-05-12 Stig Bakken <ssb****@fast*****> + + * pear/scripts/pear.in: * fix option parsing + +2002-05-12 Zeev Suraski <zeev****@zend*****> + + * main/output.c: + Remove redundant code (thanks to Jani for pointing that out) + +2002-05-12 Derick Rethans <d.ret****@jdime*****> + + * configure.in + main/php_version.h: - Fix version + +2002-05-12 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Common.php + pear/PEAR/Command/Install.php + pear/scripts/pear.in + pear/PEAR/Command.php + pear/PEAR/Installer.php: * refactored the command/options code: + - now each command class should define a "commands" property with + documentation, option specs etc. + - both long and short options are now supported + - after recent changes to Console_Getopt, you may now have options + to commands even though the same option is also valid for the pear + command itself + - less CLI-centric, better suited to Gtk and Web frontends + +2002-05-12 Jani Taskinen <snipe****@iki*****> + + * NEWS: sync with branch + + * NEWS: short is good + + * NEWS: Made several entries comprehensible. + +2002-05-12 Edin Kadribasic <edink****@prove*****> + + * NEWS: Merged safe_mode fixes into one entry. + +2002-05-12 Jon Parise <jon****@csh*****> + + * ext/imap/php_imap.c + ext/imap/php_imap.h: + Submitted by: Rob Siemborski <rjs3****@andre*****> + +2002-05-12 Edin Kadribasic <edink****@prove*****> + + * win32/install.txt: Fixed typo. + + * NEWS: MFH + +2002-05-12 Sascha Schumann <sasch****@schum*****> + + * ext/sockets/config.m4: + As far as I can tell, the AC_CHECK_MEMBER could not succeed, + because it does not include <sys/socket.h> which is necessary + for the definition of struct msghdr. This include file is not + part of ac_includes_default. + + Regardless, AC_CHECK_MEMBER is a autoconf-2.5x macro and thus we + expand it here for 2.13 compatibility. + +2002-05-12 Tomas V.V.Cox <cox****@idecn*****> + + * pear/scripts/pear.in: + The command name is now the first arg not the second + + * pear/PEAR/Command/Install.php: Add "r" in cmd help + + * pear/scripts/pear.in: + The first entry in argv is the command name, so Getopt will stop + parsing more args + +2002-05-12 Rasmus Lerdorf <rasmu****@lerdo*****> + + * ext/standard/file.c: MFH + + * ext/standard/file.c: + Change safe-mode rule for rmdir() to match unlink() - allow is target + is opened by caller or in a directory owned by caller + +2002-05-12 Sascha Schumann <sasch****@schum*****> + + * main/main.c: Simplify even more + + * main/main.c: Simplify white space handling in php_html_puts. + + If we encounter a ' ', we will look for the next non-' ' and set p + accordingly. + +2002-05-12 Sebastian Bergmann <sb****@sebas*****> + + * ext/calendar/easter.c: Nuke unused local variables. + +2002-05-12 Marko Karppinen <karpp****@pobox*****> + + * ext/calendar/calendar.c + ext/calendar/easter.c + ext/calendar/php_calendar.h: + Add an option to calculate easter dates based on the Gregorian calendar + during the years 1582-1752. Earlier this was only possible from + 1753 onwards. Use the optional parameter CAL_EASTER_ROMAN with + easter_days() to enable this. This is a fix for bug #12766. + +2002-05-12 Sascha Schumann <sasch****@schum*****> + + * ext/mbstring/config.m4: Fix this again. + + If you are unsure whether enable or with shall be used, please + inquire on the mailing list. + + WITH is solely for the purpose of pointing to paths and other external + entities. + + Note that the comment has always mentioned "--disable-mbstring" which + clearly refers to enable and not with. + +2002-05-12 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Dependency.php: * fix up package dependency check + +2002-05-12 Sascha Schumann <sasch****@schum*****> + + * ext/standard/info.c: Use string_len information + + * ext/standard/info.c + main/main.c + main/php_ini.c + main/php_main.h: reenable php_html_puts + +2002-05-12 Tomas V.V.Cox <cox****@idecn*****> + + * pear/PEAR/Dependency.php: Make <dep type="pkg" rel="has"> avaible + +2002-05-12 Stig Bakken <ssb****@fast*****> + + * pear/package-Console_Getopt.xml: * fix description + +2002-05-12 Rui Hirokawa <rui_hirok****@ybb*****> + + * ext/mbstring/mbfilter.c + ext/mbstring/mbfilter.h + ext/mbstring/mbfilter_cn.c + ext/mbstring/mbfilter_cn.h + ext/mbstring/mbfilter_kr.c: + added chinese HZ encoding support. fixed ascii area character conversion was not work in euc-cn and euc-kr. + +2002-05-12 Daniela Mariaschi <maria****@liber*****> + + * ext/interbase/interbase.c: fix bug #17040 + User can't close a connection if there are blobs opened. + He must close them before to not lose data.... + +2002-05-12 Sascha Schumann <sasch****@schum*****> + + * ext/session/session.c: - Fix the way code was outcommented + - Remove unused STR_CAT macro + - Remove limits/tests based on unused macro + - Implement cache_limiter(private) using private_no_expire + +2002-05-12 Daniela Mariaschi <maria****@liber*****> + + * ext/interbase/interbase.c: fix bug #17040 ibase_close again..... + User can't close a connection if there are blobs opened. + He must close them before to not loose data.... + +2002-05-12 Tomas V.V.Cox <cox****@idecn*****> + + * pear/package-Console_Getopt.xml: + Vincent is not involved in this class :-) + +2002-05-12 Jason Greene <jason****@inetg*****> + + * ext/sockets/config.m4 + ext/sockets/sockets.c: Fix build on IRIX for both mips and gcc + +2002-05-12 Stig Bakken <ssb****@fast*****> + + * pear/Console/tests/001-getopt.phpt + pear/Console/Getopt.php: + * Try again: fixed Console_Getopt::getopt so it does not steal options + after the first non-option argument. Added test. + + * pear/tests/pear_config.phpt: * updated config key names + + * pear/tests/pear_registry.phpt: + * exclude _lastmodified registry attrib from tests + +2002-05-12 Rui Hirokawa <rui_hirok****@ybb*****> + + * ext/mbstring/config.m4: fixed to support --with-mbsting=LANG. + +2002-05-10 Edin Kadribasic <edink****@prove*****> + + * configure.in: + Fixed "make install" when compiled with --disable-cli option. + +2002-05-10 Markus Fischer <mfisc****@guru*****> + + * sapi/cgi/cgi_main.c + sapi/cli/php_cli.c: + - Prefix the first version line with 'PHP' so it's easier to use shell tools to + parse the version number (both CLI and CGI). + + * sapi/cli/php_cli.c + sapi/cgi/cgi_main.c: - This affects both CGI and CLI sapi: + Remove Zend version output from -m switch and move it over to the output of + the -v switch (-v is supposed to list version numbers, not -m). + +2002-05-10 Christian Stocker <chreg****@phant*****> + + * ext/domxml/php_domxml.c: + - added fifth optional parameter to domxml_xslt_process. If set, + it will output profiling information to the file stated (chregu) + - introduced version numbering for this extension + +2002-05-10 Martin Jansen <mail****@marti*****> + + * pear/Makefile.frag: + * package-pear.xml has been renamed to package-PEAR.xml. + +2002-05-10 Edin Kadribasic <edink****@prove*****> + + * NEWS + main/config.w32.h.in + win32/crypt_win32.c + win32/md5crypt.c + win32/md5crypt.h + win32/php4dllts.dsp: Added MD5 support for crypt() on Windows. + + * win32/.cvsignore: Ignoring *.aps files. + + * ext/pgsql/php_pgsql.h: Fix win32 build. + +2002-05-09 Preston L. Bannister <prest****@cox*****> + + * sapi/cgi/cgi_main.c: Backed out preceding change. + +2002-05-09 Jani Taskinen <snipe****@iki*****> + + * main/php_ini.c: ws fix + +2002-05-09 Preston L. Bannister <prest****@cox*****> + + * main/php_open_temporary_file.c: + Compute directory for temporary files once and use same directory for all subsequent calls. + +2002-05-09 Daniela Mariaschi <maria****@liber*****> + + * ext/interbase/interbase.c: corrected parameter + + * ext/interbase/interbase.c: fix test 5 to pass + +2002-05-09 Preston L. Bannister <prest****@cox*****> + + * main/php_ini.c: + Detect when running under IIS and default force_redirect to zero. This This means an explicit php.ini setting is no longer required. + + (NO extraneous whitespace changes this time (sigh)). + +2002-05-09 Stig Bakken <ssb****@fast*****> + + * pear/package-PEAR.xml + pear/package-db.xml + pear/package-pear.xml: * remove package-db.xml + * rename package-pear.xml to package-PEAR.xml (generic format is + package-PKGNAME.xml) + +2002-05-09 Preston L. Bannister <prest****@cox*****> + + * sapi/cgi/cgi_main.c: + Detect when running under IIS and default force_redirect to zero. This This means an explicit php.ini setting is no longer required. + + (No extraneous whitespace changes this time :). + +2002-05-09 Frank M. Kromann <frank****@front*****> + + * ext/mssql/php_mssql.h + ext/mssql/php_mssql.c: + Allow the MSSQL extension to use NT authentication + +2002-05-09 James Cox <james****@blog*****> + + * README.SUBMITTING_PATCH: this is dangerous.... + +2002-05-09 Frank M. Kromann <frank****@front*****> + + * php.ini-dist + php.ini-recommended: + Adding ini setting that allows the MSSQL extension to use NT authentication + +2002-05-09 Preston L. Bannister <prest****@cox*****> + + * main/php_ini.c: + Add check for php.ini in same directory as php.exe (or equivalent executable that loaded php4ts.dll). Check is done before looking in the Windows directory. This allows distinct php.ini files when different applications using PHP are installed on the same system. Should be backwards compatible. + + Note that checking for in CWD php.ini may be a security risk(?), and can now be made compile-time configurable by removing a single #define. + + (This time with tabs for leading indent). + +2002-05-09 Jani Taskinen <snipe****@iki*****> + + * main/php_open_temporary_file.c + sapi/cgi/cgi_main.c + ext/session/session.c + main/php_ini.c: Revert the last patches. + +2002-05-09 Sander Roobol <phy****@wanad*****> + + * ext/session/session.c: Revert Preston's patch + +2002-05-09 Jani Taskinen <snipe****@iki*****> + + * main/main.c: ws fix + +2002-05-09 Preston L. Bannister <prest****@cox*****> + + * main/php_ini.c: + Add check for php.ini in same directory as php.exe (or equivalent executable that loaded php4ts.dll). Check is done before looks in the Windows directory. + This allows distinct php.ini files when different applications using PHP are installed on the same system. Should be backwards compatible. + + Note that checking for php.ini in CWD may be a security risk(?), and can now be made compile-time configurable by removing a single #define. + + * ext/session/session.c: + Change default directory for session data from /tmp (non-portable) to none. + Default directory for session data (if not specified) is same (platform-specific) directory used for temporary files. + This is backwards compatible and removes the need for explicitly specifying the session.save_path on Win32. + + * main/php_open_temporary_file.c: + Compute directory for temporary files once and use same directory for all subsequent calls. + + * sapi/cgi/cgi_main.c: + Detect when running under IIS and not require explicit setting of force_redirect. + This means an explicit php.ini setting is no longer required. + +2002-05-09 Edin Kadribasic <edink****@prove*****> + + * ext/crack/crack.dsp: + No need to link libxm2 in order to build php_crack.lib + +2002-05-09 Vincent Blavet <vince****@blave*****> + + * pear/Archive/Tar.php: + * Better handling of Windows paths (\php\any_thing or c:\php\any_thing) + * Remember that inside the archive path are all the time in unix format /php/any_thing + * When necessary, '\' are replaced by '/' and 'c:' are removed + * Synchro with cvs:pear/Archive_Tar/Tar.php version 1.20 + +2002-05-09 Stig Bakken <ssb****@fast*****> + + * pear/packages/DB-1.2.tar + pear/packages/XML_Parser-1.0.tar + pear/packages/XML_RPC-1.0.2.tar: * add some packages to bundle with PHP + + * pear/PEAR/Command/Package.php: * add "pear run-tests" command + + * pear/Makefile.frag: + * use PEAR installer to install stuff (won't overwrite if newer versions + of packages already are installed) + + * pear/XML/Parser.php + pear/XML/Render.php + pear/XML/tests/001.phpt + pear/XML/tests/002.phpt + pear/XML/tests/003.phpt + pear/XML/tests/004.phpt + pear/XML/tests/005.phpt + pear/XML/tests/parser1.r + pear/XML/tests/parser1.t + pear/XML/tests/parser2.i + pear/XML/tests/parser2.r + pear/XML/tests/parser2.t + pear/XML/tests/parser3.r + pear/XML/tests/parser3.t + pear/XML/tests/parsererror.r + pear/XML/tests/parsererror.t + pear/XML/tests/test.xml: * moving XML_Parser to /pear + + * pear/DB/msql.php + pear/DB/mssql.php + pear/DB/mysql.php + pear/DB/oci8.php + pear/DB/odbc.php + pear/DB/pgsql.php + pear/DB/storage.php + pear/DB/sybase.php + pear/DB.php + pear/DB/IDEAS + pear/DB/MAINTAINERS + pear/DB/STATUS + pear/DB/TESTERS + pear/DB/common.php + pear/DB/dbase.php + pear/DB/fbsql.php + pear/DB/ibase.php + pear/DB/ifx.php: * permanently moving DB to /pear + +2002-05-09 Derick Rethans <d.ret****@jdime*****> + + * pear/scripts/phpize.in: - Fix phpize + + * pear/scripts/phpize.in: - Dump API NOs + +2002-05-09 Jani Taskinen <snipe****@iki*****> + + * configure.in + pear/scripts/php-config.in: Fix 'php-config --version' + +2002-05-09 Derick Rethans <d.ret****@jdime*****> + + * ext/standard/info.c: - Add PHP_API_VERSION too + + * ext/standard/info.c: - Show both API nos + +2002-05-09 Sander Roobol <phy****@wanad*****> + + * win32/install.txt: + Added notes that php.exe and not php-cli.exe should be used. + + * sapi/cli/php_cli.c + sapi/cgi/cgi_main.c: Added the current SAPI to the output of php -v + +2002-05-09 Stig Bakken <ssb****@fast*****> + + * pear/PEAR/Command/Install.php: * show "update ok" after updates + + * run-tests.php: + * try the installed cli binary if everything else fails (I'm starting + to agree that looking too hard for a php binary is wrong) + + * pear/Makefile.frag: + * install the old-fashioned way for just a bit longer + + * pear/scripts/pear.in + pear/Makefile.frag + pear/PEAR/Command.php + pear/PEAR/Command/Auth.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/Gtk.php + pear/package-pear.xml: * add -G option to "pear" for php-gtk frontend + * added Gtk stub (only creates window right now) + * added command descriptions + 2002-05-08 Jason Greene <jason****@inetg*****> * ext/sockets/sockets.c: Merge overflow fix 1.4 +5 -0 php4/EXTENSIONS Index: EXTENSIONS =================================================================== RCS file: /cvsroot/php-i18n/php4/EXTENSIONS,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- EXTENSIONS 9 May 2002 05:39:43 -0000 1.3 +++ EXTENSIONS 2 Aug 2002 22:05:22 -0000 1.4 @@ -221,6 +221,11 @@ STATUS: Experimental SINCE: 4.0.5 ------------------------------------------------------------------------------- +EXTENSION: ctype +PRIMARY MAINTAINER: Hartmut Holzgraefe <hartm****@six*****> +MAINTENANCE: Maintained +STATUS: Working +------------------------------------------------------------------------------- EXTENSION: curl PRIMARY MAINTAINER: Sterling Hughes <sterl****@php*****> MAINTENANCE: Maintained 1.3 +11 -11 php4/INSTALL Index: INSTALL =================================================================== RCS file: /cvsroot/php-i18n/php4/INSTALL,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- INSTALL 29 Apr 2002 02:26:18 -0000 1.2 +++ INSTALL 2 Aug 2002 22:05:22 -0000 1.3 @@ -1,5 +1,5 @@ -Installation Instructions for PHP 4.1 -------------------------------------- +Installation Instructions for PHP 4 +----------------------------------- STOP! @@ -62,8 +62,8 @@ Chances are you will see a lot more modules than these two. That's ok, as long as mod_so.c shows up you can proceed with the following steps: -$ gunzip -c php-4.1.x.tar.gz | tar xf - -$ cd php-4.1.x +$ gunzip -c php-4.x.y.tar.gz | tar xf - +$ cd php-4.x.y $ ./configure --with-mysql --with-apxs $ make $ make install @@ -93,8 +93,8 @@ $ ./configure $ cd .. -$ gunzip -c php-4.1.x.tar.gz | tar xf - -$ cd php-4.1.x +$ gunzip -c php-4.x.y.tar.gz | tar xf - +$ cd php-4.x.y $ ./configure --with-mysql --with-apache=../apache_1.3.x $ make $ make install @@ -106,7 +106,7 @@ $ make (you should now have an httpd binary which you can copy to your Apache bin dir if is is your first install then you need to "make install" as well) -$ cd ../php-4.1.x +$ cd ../php-4.x.y $ cp php.ini-dist /usr/local/lib/php.ini You can edit /usr/local/lib/php.ini file to set PHP options. Edit your httpd.conf or srm.conf file and add: @@ -125,12 +125,12 @@ 1. Unpack your distribution file. - You will have downloaded a file named something like php-4.1.x.tar.gz. - Unzip this file with a command like: gunzip php-4.1.x.tar.gz + You will have downloaded a file named something like php-4.x.y.tar.gz. + Unzip this file with a command like: gunzip php-4.x.y.tar.gz - Next you have to untar it with: tar -xvf php-4.1.x.tar + Next you have to untar it with: tar -xvf php-4.x.y.tar - This will create a php-4.1.x directory. cd into this new directory. + This will create a php-4.x.y directory. cd into this new directory. 2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build a static module 1.6 +22 -6 php4/NEWS Index: NEWS =================================================================== RCS file: /cvsroot/php-i18n/php4/NEWS,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- NEWS 9 May 2002 05:39:43 -0000 1.5 +++ NEWS 2 Aug 2002 22:05:22 -0000 1.6 @@ -1,30 +1,43 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2002, Version 4.3.0 +- Added domxml_doc_set_root() to change the root node. (Lukas Schroeder) +- Fix crash bug in stripslashes() when working in sybase mode (Rasmus) +- Added experimental support for Simplified Chinese, Traditional Chinese and + Korean encoding in mbstring. (Rui) +- Misc. Win32 mail() enhancements: support 'From:' header (msiso****@yahoo*****), + Bcc headers and be case-insensitive, enhanced error reporting. (Markus) +- Improved IMAP extension performance. (adam.****@minds*****, + rjs3****@andre*****, Jon) +- Added optional 5th parameter to domxml_xslt_process(). When set, profiling + information is saved to the specified file. (chregu) +- Added MD5 support for crypt() on Windows. (Edin) - Fixed resource bug in LDAP extension. (Stig Venaas) -- Fixed output buffer crash when buffer is over written in callback. (Yasuo) +- Fixed crash in output buffering when buffer is overwritten in a callback. + (Yasuo) - Added output_add_rewrite_var() and output_remove_rewrite_var() to inject - and remove variables from the URL-Rewriter. (thies) + and remove variables from the URL-Rewriter. (Thies) - The Windows build can now be configured more comfortably, for example when dealing with built-in extensions. (Sebastian) - Added optional 3rd parameter to mysql_select_db() which makes it return 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 enabled by default. (Yasuo) +- Made 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 'path to php.ini'. (Yasuo) -- Added version info to the dll and exe files created under Windows. (jtate) -- Added "log_errors_max_len" php.ini option which controls maximum length for - error messages. (Marcus) +- Added version information to the .dll and .exe files created under Windows. + (jtate) - Added __FUNCTION__ and __CLASS__ constants. (Jani, Zend Engine) - Added pg_metadate(), pg_convert(), pg_insert(), pg_select(), pg_update() and pg_delete(). (Yasuo) - Added optional 2nd parameter for pg_result_status() to specify return type. (Yasuo) +- Added "log_errors_max_len" php.ini option which controls maximum length for + error messages. (Marcus) - Added "ignore_repeated_errors" and "ignore_repeated_source" php.ini options which can be used to disable logging of repeated error messages. (Marcus) - Made pg_last_notice() work correctly. (Yasuo) @@ -65,6 +78,9 @@ process is now more portable and less resource-consuming. (Sascha) 13 May 2002, Version 4.2.1 +- Added safe-mode checks to show_source(), parse_ini_file() and rmdir(). Also + fixed security problems with safe_mode_include_dir directive. (Rasmus) +- Changed HTTP upload code to accept 0 byte file uploads. (Zeev) - Major update of domxml. New functions, better DOM compliance and bug fixes: * Changed the old $node->append_child() to $node->append_sibling() since the new append_child() behaves correctly (= W3C standard). 1.3 +2 -1 php4/README.CVS-RULES Index: README.CVS-RULES =================================================================== RCS file: /cvsroot/php-i18n/php4/README.CVS-RULES,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- README.CVS-RULES 29 Apr 2002 02:26:19 -0000 1.2 +++ README.CVS-RULES 2 Aug 2002 22:05:22 -0000 1.3 @@ -1,6 +1,7 @@ This is the first file you should be reading after you get your CVS account. We'll assume you're basically familiar with CVS, but feel free to post -your questions on the mailing list. +your questions on the mailing list. Please have a look at +http://cvsbook.red-bean.com/ for more detailed information on CVS. PHP is developed through the efforts of a large number of people. Collaboration is a Good Thing(tm), and CVS lets us do this. Thus, following 1.3 +3 -5 php4/README.SUBMITTING_PATCH Index: README.SUBMITTING_PATCH =================================================================== RCS file: /cvsroot/php-i18n/php4/README.SUBMITTING_PATCH,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- README.SUBMITTING_PATCH 29 Apr 2002 02:26:19 -0000 1.2 +++ README.SUBMITTING_PATCH 2 Aug 2002 22:05:22 -0000 1.3 @@ -52,13 +52,11 @@ cvs -z3 update -d -P checkout -P -diff -u -b -w -B +diff -u + ------ -diff -u -b -w -B means: - -b Ignore changes in amount of white space. - -B Ignore changes that just insert or delete blank lines. +diff -u means: -u Use the unified output format. - -w Ignore white space when comparing lines. With this CVS setting, you don't have to worry about adding/deleting newlines and spaces. 1.5 +5 -5 php4/configure.in Index: configure.in =================================================================== RCS file: /cvsroot/php-i18n/php4/configure.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- configure.in 9 May 2002 05:39:43 -0000 1.4 +++ configure.in 2 Aug 2002 22:05:22 -0000 1.5 @@ -1,4 +1,4 @@ -dnl ## $Id: configure.in,v 1.346 2002/05/08 13:47:39 hirokawa Exp $ -*- sh -*- +dnl ## $Id: configure.in,v 1.349 2002/05/14 20:53:33 sas Exp $ -*- sh -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -41,7 +41,6 @@ MINOR_VERSION=3 RELEASE_VERSION=0 EXTRA_VERSION="-dev" -#VERSION="4.3.0-dev" VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION" dnl Define where extension directories are located in the configure context @@ -968,6 +967,7 @@ if test "$disable_cli" != "1"; then PHP_CLI_TARGET=sapi/cli/php + PHP_INSTALL_CLI_TARGET="install-cli" PHP_ADD_SOURCES(sapi/cli, php_cli.c getopt.c,, cli) fi @@ -1031,7 +1031,7 @@ PHP_SUBST(OVERALL_TARGET) PHP_SUBST(PHP_RPATHS) PHP_SUBST(PHP_SAPI) -PHP_SUBST(PHP_VERSION) +PHP_SUBST_OLD(PHP_VERSION) PHP_SUBST(PROG_SENDMAIL) PHP_SUBST(SHELL) PHP_SUBST(SHARED_LIBTOOL) @@ -1080,7 +1080,7 @@ CXXFLAGS="$CXXFLAGS $standard_libtool_flag" all_targets='$(OVERALL_TARGET) $(PHP_MODULES) $(PHP_CLI_TARGET)' -install_targets="install-sapi install-modules install-cli $install_pear" +install_targets="install-sapi install-modules $PHP_INSTALL_CLI_TARGET $install_pear" PHP_SUBST(all_targets) PHP_SUBST(install_targets) @@ -1141,7 +1141,7 @@ AC_OUTPUT($ALL_OUTPUT_FILES, [], [ -if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then +if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then REDO_ALL=yes fi 1.4 +3 -0 php4/php.ini-dist Index: php.ini-dist =================================================================== RCS file: /cvsroot/php-i18n/php4/php.ini-dist,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- php.ini-dist 30 Apr 2002 08:15:06 -0000 1.3 +++ php.ini-dist 2 Aug 2002 22:05:22 -0000 1.4 @@ -806,6 +806,9 @@ ; Limits the number of records in each batch. 0 = all records in one batch. ;mssql.batchsize = 0 +; Use NT authentication when connecting to the server +mssql.secure_connection = Off + [Assertion] ; Assert(expr); active by default. ;assert.active = On 1.4 +3 -0 php4/php.ini-recommended Index: php.ini-recommended =================================================================== RCS file: /cvsroot/php-i18n/php4/php.ini-recommended,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- php.ini-recommended 30 Apr 2002 08:15:06 -0000 1.3 +++ php.ini-recommended 2 Aug 2002 22:05:22 -0000 1.4 @@ -813,6 +813,9 @@ ; Limits the number of records in each batch. 0 = all records in one batch. ;mssql.batchsize = 0 +; Use NT authentication when connecting to the server +mssql.secure_connection = Off + [Assertion] ; Assert(expr); active by default. ;assert.active = On 1.4 +408 -551 php4/run-tests.php Index: run-tests.php =================================================================== RCS file: /cvsroot/php-i18n/php4/run-tests.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- run-tests.php 9 May 2002 05:39:43 -0000 1.3 +++ run-tests.php 2 Aug 2002 22:05:22 -0000 1.4 @@ -13,620 +13,477 @@ | 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*****> | + | (based on version by: Stig Bakken <ssb****@fast*****>) | | (based on the PHP 3 test framework by Rasmus Lerdorf) | +----------------------------------------------------------------------+ */ /* - * TODO: - * - look for test-specific php.ini files - * - implement module skipping for PEAR - * - do not test PEAR components if base class and/or component class cannot be instanciated - */ - -if (ini_get('safe_mode')) { - echo <<<SAFE_MODE_WARNING + History + ------- -+-----------------------------------------------------------+ -| ! WARNING ! | -| You are running the test-suite with "safe_mode" ENABLED ! | -| | -| Chances are high that no test will work at all, | -| depending on how you configured "safe_mode" ! | -+-----------------------------------------------------------+ + 2002-05-07 Preston L. Bannister <prest****@cox*****> + Rewrote and updated to run on Win32. -SAFE_MODE_WARNING; -} + 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. -set_time_limit(0); + Die if any internal errors encountered in test script. -ob_implicit_flush(); + Regularized output for simpler post-processing of output. -define('TEST_PASSED', 0); -define('TEST_FAILED', -1); -define('TEST_SKIPPED', -2); -define('TEST_INTERNAL_ERROR', -3); + Optionally output error lines indicating the failing test source and log + for direct jump with MSVC or Emacs. -define('EXT_DIR_NAME','/php4/ext/'); -define('EXT_DIR_NAME_LEN',strlen(EXT_DIR_NAME)); + Run basic (non-extension) tests first. Treat PEAR as extension. -initialize(); -/* -$opts = parse_options(&$argc, &$argv); -if ($opts['help']) { - usage(); - exit; -} + Tested on Windows 2000 with the Cygnus Win32 toolkit installed. */ -if(!isset($_SERVER['argc'])) { - echo "\nWARNING: register_argc_argv seems to be set 'off' in php.ini\n\n"; -} - - @ do_testing($_SERVER['argc'], $_SERVER['argv']); - -exit; - -/*****************************************************************************/ - -function usage() -{ - dowriteln("Usage: run-tests.php [-d] [-h] [dir|file...]"); -} - /* - * Please use dowrite() and dowriteln() for all screen output. - * This makes it easier to convert to HTML output later. + * TODO: + * - do not test PEAR components if base class and/or component class cannot be instanciated */ -function dowrite($str) -{ - global $term_bold, $term_norm; - $str = str_replace("%b", $term_bold, $str); - $str = str_replace("%B", $term_norm, $str); - print $str; -} - -function dowriteln($str) -{ - dowrite("$str\n"); -} - -function create_compiled_in_modules_list() { - global $compiled_in_modules; - $compiled_in_modules = @get_loaded_extensions(); -} - -function extract_module_name_from_path($path) { - if ($pos1=strpos($path,EXT_DIR_NAME)) { - $pos3=strpos($path,'/',$pos1+EXT_DIR_NAME_LEN); - return substr($path,$pos2=$pos1+EXT_DIR_NAME_LEN,$pos3-$pos2); - } -} +set_time_limit(0); +ob_implicit_flush(); +if (ini_get('safe_mode')) { + echo <<<SAFE_MODE_WARNING -function create_found_tests_4_modules_list() { - global $modules_2_test,$testdirs; ++-----------------------------------------------------------+ +| ! WARNING ! | +| You are running the test-suite with "safe_mode" ENABLED ! | +| | +| Chances are high that no test will work at all, | +| depending on how you configured "safe_mode" ! | ++-----------------------------------------------------------+ - foreach ($testdirs AS $path) { - if ($mod_name=extract_module_name_from_path($path)) - $modules_2_test[$mod_name]=TRUE; - } -} -function create_modules_2_test_list() { - global $compiled_in_modules,$modules_2_test,$modules_available; - foreach ($compiled_in_modules AS $value) - if (isset($modules_2_test[$value])) $modules_available[]=$value; +SAFE_MODE_WARNING; } +// Don't ever guess at the PHP executable location. +// Require the explicit specification. +// Otherwise we could end up testing the wrong file! +$php = $_ENV['TEST_PHP_EXECUTABLE']; -function in_path($program, $windows_p) -{ - global $HTTP_ENV_VARS; - if ($windows_p) { - $delim = ";"; - $ext = ".exe"; - } else { - $delim = ":"; - $ext = ""; - } - $slash = DIRECTORY_SEPARATOR; - $path_components = explode($delim, $HTTP_ENV_VARS['PATH']); - if ($windows_p) { - $cwd = getcwd() . DIRECTORY_SEPARATOR; - array_unshift($path_components, "{$cwd}Release_TS_Inline", "{$cwd}Release_TS"); - } - foreach ($path_components as $path) { - $test = "{$path}{$slash}php{$ext}"; - if (@is_executable($test)) { - return $test; - } - } - return false; -} +isset($php) + or die("FAIL environment variable TEST_PHP_EXECUTABLE must be set to specify PHP executable!\n"); + @ is_executable($php) + or die("FAIL invalid PHP executable specified by TEST_PHP_EXECUTABLE = " . $php . "\n"); -function initialize() -{ - global $term, $windows_p, $php, $skip, $testdirs, $tmpfile, - $skipped, $failed, $passed, $total, $term_bold, $term_norm, - $tests_in_dir; - - // XXX Should support HTML output as well. - $php = ""; - if((substr(PHP_OS, 0, 3) == "WIN")) { - $ext = ".exe"; - $windows_p = true; - $term = getenv("COMSPEC"); - } else { - $ext = ""; - $term = getenv("TERM"); - if (ereg('^(xterm|vt220)', $term)) { - $term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109); - $term_norm = sprintf("%c%c%c", 27, 91, 109); - } elseif (ereg('^vt100', $term)) { - $term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109); - $term_norm = sprintf("%c%c%c", 27, 91, 109); - } else { - $term_bold = $term_norm = ""; - } - } - -/* We need to check CGI SAPI first since some tests must be skipped when - CLI SAPI is used. CLI SAPI is built always while CGI SAPI is not. - - yohga****@php***** */ - - if (isset($_ENV["TOP_BUILDDIR"]) && @is_executable($_ENV["TOP_BUILDDIR"]."/php{$ext}")) { - $php = $_ENV["TOP_BUILDDIR"]."/php{$ext}"; - } elseif (@is_executable("./php{$ext}")) { - $php = getcwd() . "/php{$ext}"; - } elseif (isset($_ENV["TOP_BUILDDIR"]) && @is_executable($_ENV["TOP_BUILDDIR"]."/sapi/cli/php{$ext}")) { - $php = $_ENV["TOP_BUILDDIR"]."/sapi/cli/php{$ext}"; - } elseif (@is_executable("./sapi/cli/php{$ext}")) { - $php = getcwd() . "/sapi/cli/php{$ext}"; - } -// Test result can be bogus, if we use php binary in path. - yohga****@php***** -// if (empty($php)) { -// $php = in_path("php", $windows_p); -// } - if (empty($php)) { - dowriteln("Unable to find PHP executable (php{$ext})."); - exit; - } - if ($windows_p) { - // modify path to help Windows find DLL files - $path = dirname($php) . ";" . getenv("PATH"); - putenv("PATH={$path}"); - } - - create_compiled_in_modules_list(); - - $skip = array( - "CVS" => 1 - ); - $testdirs = array(); - $tmpfile = array(); - $tests_in_dir = array(); +// Check whether a detailed log is wanted. - register_shutdown_function("delete_tmpfiles"); +define('DETAILED',0 + $_ENV['TEST_PHP_DETAILED']); - $skipped = $failed = $passed = $total = 0; -} +// Write INI file to be used in tests. -function &parse_options(&$argc, &$argv) -{ - $options = array(); - while ($argc > 0 && ($opt = substr($argv[0], 0, 2)) == "--") { - $opt = array_shift($argv); - $argc--; - if ($arg == "--") { - return $options; - } - if (ereg('^--([^=]+)=(.*)$', $opt, $matches)) { - $opt = $matches[1]; - $arg = $matches[2]; - } else { - $arg = true; - } - $options[$opt] = $arg; - } - return $options; -} +$include_path = getcwd(); -function do_testing($argc, &$argv) -{ - global $term, $windows_p, $php, $skip, $testdirs, $tmpfile, $opts, - $skipped, $failed, $passed, $total, $term_bold, $term_norm, $skipped_extensions; +$test_ini = realpath(dirname($php) . "/php.ini"); +save_text($test_ini,"[PHP]\ninclude_path = \"$include_path\"\n"); - if ($argc > 1) { - if (is_dir($argv[1])) { - $dir = $argv[1]; - } else { - for ($i = 1; $i < $argc; $i++) { - switch (run_test($argv[$i])) { - case TEST_SKIPPED: - case TEST_INTERNAL_ERROR: - $skipped++; - break; - case TEST_FAILED: - $failed++; - break; - case TEST_PASSED: - $passed++; - break; - } - $total++; - } - } - } else { - // $dir = $_ENV["TOP_SRCDIR"]; // XXX ??? where should this variable be set? - $dir=str_replace('\\','/',trim(($windows_p ? getenv("TEST_DIR"):`pwd`))); - } - if (isset($dir) && $dir) { - find_testdirs($dir); +// Write test context information. - create_found_tests_4_modules_list(); - create_modules_2_test_list(); +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 +===================================================================== - for ($i = 0; $i < sizeof($testdirs); $i++) { - run_tests_in_dir($testdirs[$i]); - } - } +"; - $counting = $total - $skipped; +// Make sure we are using the proper php.ini. - if ($counting <= 0) { - dowriteln("No tests were run."); - return; - } - - $total_d = (double)$total; - $counting_d = (double)$counting; - $passed_p = 100 * ($passed / $counting_d); - $failed_p = 100 * ($failed / $counting_d); - $skipped_p = 100 * ($skipped / $total_d); - $passed_pstr = sprintf($passed_p < 10.0 ? "%1.1f" : "%3.0f", $passed_p); - $failed_pstr = sprintf($failed_p < 10.0 ? "%1.1f" : "%3.0f", $failed_p); - $skipped_pstr = sprintf($skipped_p < 10.0 ? "%1.1f" : "%3.0f", $skipped_p); - - dowriteln("TEST RESULT SUMMARY"); - dowriteln("============================="); - dowriteln(sprintf("Number of tests: %4d", $total)); - dowriteln(sprintf("Tests skipped: %4d (%s%%)", $skipped, $skipped_pstr)); - dowriteln(sprintf("Tests failed: %4d (%s%%)", $failed, $failed_pstr)); - dowriteln(sprintf("Tests passed: %4d (%s%%)", $passed, $passed_pstr)); - dowriteln("============================="); - dowriteln("Skipped ".sizeof($skipped_extensions)." extensions."); - $php_bin_info_cmd = "$php -q -f ".$_ENV["TOP_BUILDDIR"]."/tests/bin-info.inc"; - system($php_bin_info_cmd); -} +$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"); -function find_testdirs($dir = '.', $first_pass = true) -{ - global $testdirs, $skip; +// Determine the tests to be run. - if ($first_pass && is_dir($dir)) { - $testdirs[] = $dir; - } - $dp = @opendir($dir); - if (!$dp) { - print "Warning: could not open directory $dir\n"; - return false; - } - while ($ent = readdir($dp)) { - $path = "$dir/$ent"; +$test_to_run = array(); +$test_files = array(); +$test_results = array(); - if ((isset($skip[$ent]) && $skip[$ent]) - || substr($ent, 0, 1) == "." - || !is_dir($path) +if (isset($_SERVER['argc'])) { - ) { - continue; - } + // If parameters given assume they represent selected tests to run. - if (strstr("/$path/", "/tests/")) { - $testdirs[] = $path; - } - find_testdirs($path, false); + $argc = $_SERVER['argc']; + $argv = $_SERVER['argv']; + for ($i = 1; $i < $argc; $i++) { + $testfile = realpath($argv[$i]); + $test_to_run[$testfile] = 1; } - closedir($dp); - + } -function run_tests_in_dir($dir = '.') -{ - global $skip, $skipped, $failed, $passed, $total, $opts, $tests_in_dir,$modules_available,$skipped_extensions; - $dp = opendir($dir); - if (!$dp) { - print "Warning: could not run tests in $dir\n"; - return false; - } - $testfiles = array(); - while ($ent = readdir($dp)) { - if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." || substr($ent, -5) != ".phpt") { - continue; - } - $testfiles[] = "$dir/$ent"; - if(isset($tests_in_dir[$dir])) $tests_in_dir[$dir]++; else $tests_in_dir[$dir]=1; - } - closedir($dp); - if (isset($tests_in_dir[$dir]) && ($tests_in_dir[$dir] == 0)) { - return true; - } - $oskipped = $skipped; - if (sizeof($testfiles) == 0) { - return; - } - - if ($mod_name=extract_module_name_from_path($dir)) { - if ($ext_found=in_array($mod_name,$modules_available)) - dowriteln("Testing extension: $mod_name"); - else $skipped_extensions[$mod_name]=TRUE; - } - - if (!isset($ext_found) or $ext_found!==FALSE) { - dowriteln("%bRunning tests in $dir%B"); - dowriteln("=================".str_repeat("=", strlen($dir))); - sort($testfiles); - for ($i = 0; $i < sizeof($testfiles); $i++) { - switch (run_test($testfiles[$i])) { - case TEST_SKIPPED: - case TEST_INTERNAL_ERROR: - $skipped++; - break; - case TEST_FAILED: - $failed++; - break; - case TEST_PASSED: - $passed++; - break; - } - $total++; - } - if ($oskipped + (isset($tests_in_dir[$dir])?$tests_in_dir[$dir]:0) == $skipped) { - $skippednow = $skipped - $oskipped; - dowriteln("[all $skippednow test(s) skipped]"); - } - dowriteln(""); - } +// Compile a list of all test files (*.phpt). - return true; -} - -function skip_headers($fp) { - // "cli" version of PHP does not output headers - if (php_sapi_name() == "cli") { - return; - } - while (!feof($fp)) { - if (trim(fgets($fp, 1024)) == "") { - break; + $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); } } -function delete_tmpfiles() -{ - global $tmpfile; - reset($tmpfile); - while (list($k, $v) = each($tmpfile)) { - if (file_exists($v)) { - //print "unlink($v): "; var_dump(unlink($v)); - unlink($v); - } +// 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; } -/** - * Compares two files, ignoring blank lines. - * - * @param $file1 string name of first file to compare - * @param $file2 string name of second file to compare - * - * @return bool whether the files were "equal" - */ -function compare_results($file1, $file2) -{ - $data1 = $data2 = ""; - if (!($fp1 = @fopen($file1, "r")) || !($fp2 = @fopen($file2, "r"))) { - return false; - } +// We need to know the compiled in modules so we know what to test. - while (!(feof($fp1) || feof($fp2))) { - if (!feof($fp1) && trim($line1 = fgets($fp1, 10240)) != "") { - //print "adding line1 $line1\n"; +$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; +} + +echo ' +===================================================================== +'; + +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"; + } + + $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); +} + +// Summarize results + +if (0 == count($test_results)) { + echo "No tests were run.\n"; + return; +} + +$n_total = count($test_results); +$sum_results = array(); +foreach ($test_results as $v) { + $sum_results[$v]++; +} +$percent_results = array(); +while (list($v,$n) = each($sum_results)) { + $percent_results[$v] = (100.0 * $n) / $n_total; +} + +echo " +===================================================================== +TIME " . date('Y-m-d H:i:s') . " - end of test run + +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']) . " +===================================================================== +Skipped " . count($modules_skipped) . " extensions +"; + +// +// Write the given text to a temporary file, and return the filename. +// + +function save_text($filename,$text) +{ + $fp = @fopen($filename,'w') + or die("Cannot open file '" . $filename . "'!\n"); + fwrite($fp,$text); + fclose($fp); + if (1 < DETAILED) echo " +FILE $filename {{{ +$text +}}} +"; +} + +// +// Write an error in a format recognizable to Emacs or MSVC. +// + +function error_report($testname,$logname,$tested) +{ + $testname = realpath($testname); + $logname = realpath($logname); + switch (strtoupper(getenv('TEST_PHP_ERROR_STYLE'))) { + case 'MSVC': + echo $testname . "(1) : $tested\n"; + echo $logname . "(1) : $tested\n"; + break; + case 'EMACS': + echo $testname . ":1: $tested\n"; + echo $logname . ":1: $tested\n"; + break; + } +} + +// +// Run an individual test case. +// + +function run_test($php,$file) +{ + if (DETAILED) echo " +================= +TEST $file +"; + + // Load the sections of the test file. + + $section_text = array( + 'TEST' => '(unnamed test)', + 'SKIPIF' => '', + 'GET' => '', + ); - $data1 .= trim($line1); - } - if (!feof($fp2) && trim($line2 = fgets($fp2, 10240)) != "") { - //print "adding line2 $line2\n"; + $fp = @fopen($file, "r") + or die("Cannot open test file: $file\n"); - $data2 .= trim($line2); + $section = ''; + while (!feof($fp)) { + $line = fgets($fp); + + // Match the beginning of a section. + if (ereg('^--([A-Z]+)--',$line,$r)) { + $section = $r[1]; + $section_text[$section] = ''; + continue; } - } - fclose($fp1); - fclose($fp2); - if ((trim($data1) != trim($data2)) - || ($data1=='' && $data2=='')) { - //print "data1=";var_dump($data1); - //print "data2=";var_dump($data2); - return false; - } - return true; -} - -function run_test($file) -{ - global $php, $tmpfile, $term_bold, $term_norm, $term, $windows_p; + + // Add to the section text. + $section_text[$section] .= $line; + } + 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); + + // Reset environment from any previous test. + + putenv("REDIRECT_STATUS="); + putenv("QUERY_STRING="); + putenv("PATH_TRANSLATED="); + putenv("SCRIPT_FILENAME="); + putenv("REQUEST_METHOD="); + putenv("CONTENT_TYPE="); + 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'; + } + } + + // We've satisfied the preconditions - run the test! + + save_text($tmp_file,$section_text['FILE']); + $query_string = trim($section_text['GET']); - $variables = array("TEST", "POST", "GET", "FILE", "EXPECT", "SKIPIF", - "OUTPUT"); - $fp = @fopen($file, "r"); - if (!$fp) { - return TEST_INTERNAL_ERROR; - } - $tmpdir = dirname($file); - $tmpfix = "phpt."; - $tmpfile["FILE"] = tempnam($tmpdir, $tmpfix); - $tmpfile["SKIPIF"] = tempnam($tmpdir, $tmpfix); - $tmpfile["POST"] = tempnam($tmpdir, $tmpfix); - - $tmpfile["EXPECT"] = tempnam($tmpdir, $tmpfix); - $tmpfile["OUTPUT"] = tempnam($tmpdir, $tmpfix); - - - while ($line = fgets($fp, 4096)) { - if (ereg('^--([A-Z]+)--', $line, $matches)) { - $var = $matches[1]; - if (isset($tmpfile[$var]) && $tmpfile[$var]) { - $fps[$var] = @fopen($tmpfile[$var], "w"); - } else { - $$var = ''; - } - } else { - if (isset($var) && $var) { - if ($var == "POST") { - $line = trim($line); - } - if (isset($fps[$var]) && $fps[$var]) { - fwrite($fps[$var], $line); - } else { - $$var .= $line; - } - } - } - } - if(isset($fps) && is_array($fps)) { - reset($fps); - while (list($k, $v) = each($fps)) { - if (is_resource($v)) { - fclose($v); - } - } - } - putenv("PHP_TEST=1"); putenv("REDIRECT_STATUS=1"); - putenv("CONTENT_LENGTH="); - putenv("QUERY_STRING=".(isset($GET)?$GET:"")); - $include_path = ini_get("include_path"); - if (isset($fps["SKIPIF"])) { - $tmpfile["SKIPIF_OUTPUT"] = tempnam($tmpdir, $tmpfix); + putenv("QUERY_STRING=$query_string"); + putenv("PATH_TRANSLATED=$tmp_file"); + putenv("SCRIPT_FILENAME=$tmp_file"); + + if (isset($section_text['POST'])) { + + $post = trim($section_text['POST']); + save_text($tmp_post,$post); + $content_length = strlen($post); + + putenv("REQUEST_METHOD=POST"); + putenv("CONTENT_TYPE=application/x-www-form-urlencoded"); + putenv("CONTENT_LENGTH=$content_length"); + + $cmd = "$php 2>&1 < $tmp_post"; + + } else { + putenv("REQUEST_METHOD=GET"); putenv("CONTENT_TYPE="); - putenv("PATH_TRANSLATED=$tmpfile[SKIPIF]"); - putenv("SCRIPT_FILENAME=$tmpfile[SKIPIF]"); - $skipifcmd = "$php -q -f $tmpfile[SKIPIF] > $tmpfile[SKIPIF_OUTPUT]"; - system($skipifcmd, $ret); - $sp = @fopen($tmpfile["SKIPIF_OUTPUT"], "r"); - if ($sp) { - skip_headers($sp); - $skip = trim(fgets($sp, 1024)); - fclose($sp); - if ($skip == "skip") { - delete_tmpfiles(); - return TEST_SKIPPED; - } - } - } - putenv("PATH_TRANSLATED=$tmpfile[FILE]"); - putenv("SCRIPT_FILENAME=$tmpfile[FILE]"); - if (isset($fps["POST"])) { - putenv("REQUEST_METHOD=POST"); - putenv("CONTENT_TYPE=application/x-www-form-urlencoded"); - putenv("CONTENT_LENGTH=".filesize($tmpfile["POST"])); - } else { - putenv("REQUEST_METHOD=GET"); - putenv("CONTENT_TYPE="); - putenv("CONTENT_LENGTH="); - } - if (isset($fps["POST"])) { - if(!$windows_p) { - $cmd = "2>&1 $php -q $tmpfile[FILE] < $tmpfile[POST]"; - } - else { - $cmd = "$term /c " . realpath($php) ." -q $tmpfile[FILE] < $tmpfile[POST]"; - } - } else { - if(!$windows_p) { - $cmd = "2>&1 $php -q $tmpfile[FILE]"; - } - else { - $cmd = "$term /c " . realpath($php) ." -q $tmpfile[FILE]";; - } - } - $ofp = @fopen($tmpfile["OUTPUT"], "w"); - if (!$ofp) { - dowriteln("Error: could not write to output file"); - delete_tmpfiles(); - return TEST_INTERNAL_ERROR; - } - $cp = popen($cmd, "r"); - if (!$cp) { - dowriteln("Error: could not execute: $cmd"); - delete_tmpfiles(); - return TEST_INTERNAL_ERROR; - } - skip_headers($cp); - while ($data = fread($cp, 2048)) { - fwrite($ofp, $data); - } - fclose($ofp); - pclose($cp); - $desc = isset($TEST)?trim($TEST):""; - $outfile = ereg_replace('\.phpt$', '.out', $file); - $expectfile = ereg_replace('\.phpt$', '.exp', $file); - $phpfile = ereg_replace('\.phpt$', '.php', $file); - if (compare_results($tmpfile["OUTPUT"], $tmpfile["EXPECT"])) { - $status = TEST_PASSED; - $text = "passed"; - $pre = $post = ""; - if (file_exists($outfile)) { - unlink($outfile); - } - if (file_exists($expectfile)) { - unlink($expectfile); - } - if (file_exists($phpfile)) { - unlink($phpfile); - } - } else { - //system("env"); - $status = TEST_FAILED; - $text = "failed"; - $pre = $term_bold; - $post = $term_norm; - $desc .= " (".basename($file).")"; - if (file_exists($outfile)) { - unlink($outfile); - } - copy($tmpfile["OUTPUT"], $outfile); - copy($tmpfile["EXPECT"], $expectfile); - copy($tmpfile["FILE"], $phpfile); - } - dowriteln(sprintf("%s%-68s ... %s%s", $pre, substr($desc, 0, 68), - $text, $post)); -// if ($status == TEST_FAILED) { -// for ($i = 0; $i < sizeof($variables); $i++) { -// $var = $variables[$i]; -// print "$var:\n"; -// if ($tmpfile[$var]) { -// if (file_exists($tmpfile[$var])) { -// system("cat ".$tmpfile[$var]); -// } -// } else { -// print $$var; -// } -// } -// print "--\n\n"; -// } - delete_tmpfiles(); - return $status; + putenv("CONTENT_LENGTH="); + + $cmd = "$php 2>&1"; + + } + + if (DETAILED) echo " +CONTENT_LENGTH = " . getenv("CONTENT_LENGTH") . " +CONTENT_TYPE = " . getenv("CONTENT_TYPE") . " +PATH_TRANSLATED = " . getenv("PATH_TRANSLATED") . " +QUERY_STRING = " . getenv("QUERY_STRING") . " +REDIRECT_STATUS = " . getenv("REDIRECT_STATUS") . " +REQUEST_METHOD = " . getenv("REQUEST_METHOD") . " +SCRIPT_FILENAME = " . getenv("SCRIPT_FILENAME") . " +COMMAND $cmd +"; + + $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"; + return 'PASSED'; + } + + // Test failed so we need to report details. + + echo "FAIL $tested (" . basename($file) . ").\n"; + + $logname = ereg_replace('\.phpt$','.log',$file); + $log = fopen($logname,'w') + or die("Cannot create test log - $logname\n"); + + fwrite($log," +---- EXPECTED OUTPUT +$wanted +---- ACTUAL OUTPUT +$output +---- FAILED +"); + fclose($log); + + error_report($file,$logname,$tested); + + return 'FAILED'; } +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ ?> 1.3 +6 -2 php4/ext/calendar/calendar.c Index: calendar.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/calendar/calendar.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- calendar.c 29 Apr 2002 02:30:39 -0000 1.2 +++ calendar.c 2 Aug 2002 22:05:22 -0000 1.3 @@ -18,7 +18,7 @@ | Wez Furlong <wez****@thebr*****> | +----------------------------------------------------------------------+ */ -/* $Id: calendar.c,v 1.24 2001/12/11 15:28:54 sebastian Exp $ */ +/* $Id: calendar.c,v 1.25 2002/05/12 15:06:04 markonen Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -127,7 +127,11 @@ REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS|CONST_PERSISTENT); - + /* constants for easter calculation */ + REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT); return SUCCESS; } 1.3 +10 -20 php4/ext/calendar/easter.c Index: easter.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/calendar/easter.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- easter.c 29 Apr 2002 02:30:39 -0000 1.2 +++ easter.c 2 Aug 2002 22:05:22 -0000 1.3 @@ -29,36 +29,26 @@ /* based on code by Simon Kershaw, <webma****@ely*****> */ - pval *year_arg; - struct tm *ta, te; - time_t the_time; + struct tm te; long year, golden, solar, lunar, pfm, dom, tmp, easter; + long method = CAL_EASTER_DEFAULT; - switch(ZEND_NUM_ARGS()) { - case 0: - the_time = time(NULL); - ta = localtime(&the_time); - year = ta->tm_year + 1900; - break; - case 1: - if (getParameters(ht, 1, &year_arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(year_arg); - year = Z_LVAL_P(year_arg); - break; - default: - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + "l|l", &year, &method) == FAILURE) { + return; } if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */ - php3_error(E_WARNING, "easter_date() is only valid for years between 1970 and 2037 inclusive"); + php_error(E_WARNING, "easter_date() is only valid for years between 1970 and 2037 inclusive"); RETURN_FALSE; } golden = (year % 19) + 1; /* the Golden number */ - if ( year <= 1752 ) { /* JULIAN CALENDAR */ + if ((year <= 1582 && method != CAL_EASTER_ALWAYS_GREGORIAN) || + (year >= 1583 && year <= 1752 && method != CAL_EASTER_ROMAN && method != CAL_EASTER_ALWAYS_GREGORIAN) || + method == CAL_EASTER_ALWAYS_JULIAN) { /* JULIAN CALENDAR */ + dom = (year + (year/4) + 5) % 7; /* the "Dominical number" - finding a Sunday */ if (dom < 0) { dom += 7; 1.3 +15 -0 php4/ext/calendar/php_calendar.h Index: php_calendar.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/calendar/php_calendar.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_calendar.h 29 Apr 2002 02:30:39 -0000 1.2 +++ php_calendar.h 2 Aug 2002 22:05:22 -0000 1.3 @@ -32,4 +32,19 @@ #define phpext_calendar_ptr calendar_module_ptr +/* + * Specifying the easter calculation method + * + * DEFAULT is Anglican, ie. use Julian calendar before 1753 + * and Gregorian after that. With ROMAN, the cutoff year is 1582. + * ALWAYS_GREGORIAN and ALWAYS_JULIAN force the calendar + * regardless of date. + * + */ + +#define CAL_EASTER_DEFAULT 0 +#define CAL_EASTER_ROMAN 1 +#define CAL_EASTER_ALWAYS_GREGORIAN 2 +#define CAL_EASTER_ALWAYS_JULIAN 3 + #endif 1.3 +2 -2 php4/ext/com/conversion.c Index: conversion.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/com/conversion.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- conversion.c 29 Apr 2002 02:30:40 -0000 1.2 +++ conversion.c 2 Aug 2002 22:05:22 -0000 1.3 @@ -770,7 +770,7 @@ if (strlen == -1) { /* request needed buffersize */ - strlen = MultiByteToWideChar(codepage, (codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED) | MB_ERR_INVALID_CHARS, C_str, -1, NULL, 0); + strlen = MultiByteToWideChar(codepage, (codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS), C_str, -1, NULL, 0); } else { /* \0 terminator */ strlen++; @@ -780,7 +780,7 @@ unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR) * strlen); /* convert string */ - error = !MultiByteToWideChar(codepage, (codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED) | MB_ERR_INVALID_CHARS, C_str, strlen, unicode_str, strlen); + error = !MultiByteToWideChar(codepage, (codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS), C_str, strlen, unicode_str, strlen); } else { /* return a zero-length string */ unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR)); 1.3 +2 -2 php4/ext/crack/crack.dsp Index: crack.dsp =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/crack/crack.dsp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- crack.dsp 29 Apr 2002 02:30:40 -0000 1.2 +++ crack.dsp 2 Aug 2002 22:05:22 -0000 1.3 @@ -54,7 +54,7 @@ # 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 php4ts.lib /nologo /dll /machine:I386 -# ADD LINK32 cracklib_Win32.lib libxml2.lib wsock32.lib php4ts.lib resolv.lib 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 /out:"..\..\Release_TS/php_crack.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" +# ADD LINK32 cracklib_Win32.lib wsock32.lib php4ts.lib resolv.lib 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 /out:"..\..\Release_TS/php_crack.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "crack - Win32 Debug_TS" @@ -82,7 +82,7 @@ # 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 php4ts.lib /nologo /dll /machine:I386 -# ADD LINK32 cracklib_Win32.lib libxml2.lib php4ts_debug.lib resolv.lib 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 /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_crack.dll" /libpath:"..\..\Debug_TS" +# ADD LINK32 cracklib_Win32.lib php4ts_debug.lib resolv.lib 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 /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_crack.dll" /libpath:"..\..\Debug_TS" !ENDIF 1.3 +1 -1 php4/ext/ctype/ctype.c Index: ctype.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ctype/ctype.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ctype.c 29 Apr 2002 02:30:40 -0000 1.2 +++ ctype.c 2 Aug 2002 22:05:22 -0000 1.3 @@ -84,7 +84,7 @@ PHP_MINFO_FUNCTION(ctype) { php_info_print_table_start(); - php_info_print_table_row(2, "ctype functions", "enabled (experimental)"); + php_info_print_table_row(2, "ctype functions", "enabled"); php_info_print_table_end(); } /* }}} */ 1.3 +28 -21 php4/ext/ctype/tests/002.phpt Index: 002.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/ctype/tests/002.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 002.phpt 29 Apr 2002 02:30:41 -0000 1.2 +++ 002.phpt 2 Aug 2002 22:05:23 -0000 1.3 @@ -6,17 +6,22 @@ --GET-- --FILE-- <?php - setlocale(LC_ALL,"C"); - function ctype_test_002($function) { - $n=0; $m=0; - for($a=0;$a<256;$a++) { - $c = chr($a); - if($function("$c$c$c")) $n++; - if($function("1-$c$c$c-x")) $m++; - } - echo "$function $n $m\n"; - } +setlocale(LC_ALL,"C"); +print "LOCALE is '" . setlocale(LC_ALL,0) . "'\n"; + +function ctype_test_002($function) { + $n1 = $n2 = $n3 = 0; + // test portable POSIX characters 0..127 + for ($a=0;$a<128;$a++) { + $c = chr($a); + if($function($a)) $n1++; + if($function("$c$c$c")) $n2++; + if($function("1-$c$c$c-x")) $n3++; + } + print "$function $n1 $n2 $n3\n"; +} + ctype_test_002("ctype_lower"); ctype_test_002("ctype_upper"); ctype_test_002("ctype_alpha"); @@ -28,16 +33,18 @@ ctype_test_002("ctype_punct"); ctype_test_002("ctype_space"); ctype_test_002("ctype_xdigit"); + ?> --EXPECT-- -ctype_lower 26 0 -ctype_upper 26 0 -ctype_alpha 52 0 -ctype_digit 10 0 -ctype_alnum 62 0 -ctype_cntrl 33 0 -ctype_graph 94 94 -ctype_print 95 95 -ctype_punct 32 0 -ctype_space 6 0 -ctype_xdigit 22 0 +LOCALE is 'C' +ctype_lower 26 26 0 +ctype_upper 26 26 0 +ctype_alpha 52 52 0 +ctype_digit 10 10 0 +ctype_alnum 62 62 0 +ctype_cntrl 33 33 0 +ctype_graph 94 94 94 +ctype_print 95 95 95 +ctype_punct 32 32 0 +ctype_space 6 6 0 +ctype_xdigit 22 22 0 1.3 +6 -6 php4/ext/domxml/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/domxml/config.m4,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config.m4 29 Apr 2002 02:30:43 -0000 1.2 +++ config.m4 2 Aug 2002 22:05:23 -0000 1.3 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.37 2002/03/12 16:16:16 sas Exp $ +dnl $Id: config.m4,v 1.38 2002/05/15 12:41:55 chregu Exp $ dnl AC_DEFUN(PHP_DOM_CHECK_VERSION,[ @@ -8,19 +8,19 @@ AC_MSG_CHECKING(for libxml version) AC_EGREP_CPP(yes,[ #include <libxml/xmlversion.h> - #if LIBXML_VERSION >= 20402 + #if LIBXML_VERSION >= 20414 yes #endif ],[ - AC_MSG_RESULT(>= 2.4.2) + AC_MSG_RESULT(>= 2.4.14) ],[ - AC_MSG_ERROR(libxml version 2.4.2 or greater required.) + AC_MSG_ERROR(libxml version 2.4.14 or greater required.) ]) CPPFLAGS=$old_CPPFLAGS ]) PHP_ARG_WITH(dom, for DOM support, -[ --with-dom[=DIR] Include DOM support (requires libxml >= 2.4.2). +[ --with-dom[=DIR] Include DOM support (requires libxml >= 2.4.14). DIR is the libxml install directory.]) if test "$PHP_DOM" != "no"; then @@ -40,7 +40,7 @@ if test -z "$DOMXML_DIR"; then AC_MSG_RESULT(not found) - AC_MSG_ERROR(Please reinstall the libxml >= 2.4.2 distribution) + AC_MSG_ERROR(Please reinstall the libxml >= 2.4.14 distribution) fi PHP_DOM_CHECK_VERSION 1.5 +91 -50 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- php_domxml.c 9 May 2002 05:39:43 -0000 1.4 +++ php_domxml.c 2 Aug 2002 22:05:23 -0000 1.5 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.149 2002/05/03 13:53:45 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.159 2002/05/19 00:02:05 sniper Exp $ */ /* TODO * - Support Notation Nodes @@ -34,6 +34,11 @@ #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))) { \ @@ -198,10 +203,12 @@ 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_add_root, 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) PHP_FE(domxml_dump_mem, NULL) PHP_FE(domxml_dump_mem_file, NULL) PHP_FE(domxml_dump_node, NULL) @@ -219,7 +226,7 @@ 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) @@ -243,6 +250,8 @@ PHP_FE(domxml_xslt_process, NULL) #endif + PHP_FALIAS(domxml_add_root, domxml_doc_add_root, NULL) + PHP_FALIAS(domxml_doc_get_root, domxml_doc_document_element, NULL) PHP_FALIAS(domxml_root, domxml_doc_document_element, NULL) PHP_FALIAS(domxml_attributes, domxml_node_attributes, NULL) PHP_FALIAS(domxml_get_attribute, domxml_elem_get_attribute, NULL) @@ -276,15 +285,17 @@ /* Everything below this comment is none DOM compliant */ /* children is deprecated because it is inherited from DomNode */ /* PHP_FALIAS(children, domxml_node_children, NULL) */ + PHP_FALIAS(add_root, domxml_doc_add_root, NULL) + PHP_FALIAS(set_root, domxml_doc_set_root, NULL) + PHP_FALIAS(get_root, domxml_doc_document_element, NULL) PHP_FALIAS(root, domxml_doc_document_element, NULL) - PHP_FALIAS(add_root, domxml_add_root, NULL) PHP_FALIAS(imported_node, domxml_doc_imported_node, NULL) PHP_FALIAS(dtd, domxml_intdtd, NULL) PHP_FALIAS(ids, domxml_doc_ids, NULL) PHP_FALIAS(dumpmem, domxml_dump_mem, NULL) PHP_FALIAS(dump_mem, domxml_dump_mem, NULL) PHP_FALIAS(dump_mem_file, domxml_dump_mem_file, NULL) - PHP_FALIAS(dump_file, domxml_dump_mem_file, NULL) + PHP_FALIAS(dump_file, domxml_dump_mem_file, NULL) #if defined(LIBXML_HTML_ENABLED) PHP_FALIAS(html_dump_mem, domxml_html_dump_mem, NULL) #endif @@ -455,7 +466,7 @@ PHP_RINIT(domxml), NULL, PHP_MINFO(domxml), - NO_VERSION_YET, + DOMXML_API_VERSION, /* Extension versionnumber */ STANDARD_MODULE_PROPERTIES }; @@ -493,15 +504,21 @@ static inline void node_wrapper_dtor(xmlNodePtr node) { zval *wrapper; - + int refcount = 0; /* FIXME: type check probably unnecessary here? */ if (!node || Z_TYPE_P(node) == XML_DTD_NODE) return; wrapper = dom_object_get_data(node); - if (wrapper) + if (wrapper != NULL) { + refcount = wrapper->refcount; zval_ptr_dtor(&wrapper); + /*only set it to null, if refcount was 1 before, otherwise it has still needed references */ + if (refcount == 1) { + dom_object_set_data(node, NULL); + } + } } @@ -561,7 +578,6 @@ if (doc) { node_list_wrapper_dtor(doc->children); - node_wrapper_dtor((xmlNodePtr) doc); xmlFreeDoc(doc); } @@ -572,11 +588,17 @@ { xmlNodePtr node = (xmlNodePtr) rsrc->ptr; - if (node) { - zval *wrapper = dom_object_get_data(node); - if (wrapper) - zval_ptr_dtor(&wrapper); + /* 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); + xmlFreeNode(node); + } else { + node_wrapper_dtor(node); } + } @@ -1246,7 +1268,7 @@ Therefore nodes, attributes etc. may not be freed seperately. */ le_domxmlnodep = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domnode", module_number); - le_domxmlcommentp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domnode", module_number); + le_domxmlcommentp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domcomment", module_number); le_domxmlattrp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domattribute", module_number); le_domxmltextp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domtext", module_number); le_domxmlelementp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domelement", module_number); @@ -1411,6 +1433,7 @@ /* 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); #if defined(LIBXML_HTML_ENABLED) php_info_print_table_row(2, "HTML Support", "enabled"); @@ -1950,7 +1973,7 @@ /* }}} */ /* {{{ proto void domxml_node_unlink_node([object node]) - Deletes the node */ + Deletes the node from tree, but not from memory*/ PHP_FUNCTION(domxml_node_unlink_node) { zval *id; @@ -1968,6 +1991,7 @@ } /* }}} */ + /* {{{ proto object domxml_node_replace_node(object domnode) Replaces one node with another node */ PHP_FUNCTION(domxml_node_replace_node) @@ -2034,7 +2058,7 @@ * Uwe: must have been a temporary problem. It works for me with both * xmlAddChildList and xmlAddChild */ -// child = xmlAddSibling(nodep, new_child); + child = xmlAddChild(nodep, new_child); if (NULL == child) { @@ -2072,7 +2096,7 @@ RETURN_FALSE; } - // FIXME reverted xmlAddChildList; crashes + /* FIXME reverted xmlAddChildList; crashes */ child = xmlAddSibling(nodep, new_child); if (NULL == child) { @@ -2887,38 +2911,23 @@ } /* }}} */ -/* {{{ proto array domxml_doc_document_element(void) +/* {{{ proto object domxml_doc_document_element(int domnode) Returns root node of document */ PHP_FUNCTION(domxml_doc_document_element) { - zval *id; + zval *id, *rv; xmlDoc *docp; - xmlNode *node; + xmlNode *root; int ret; - id = getThis(); - - if (!id) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &id) == FAILURE) { - return; - } - } - - DOMXML_GET_OBJ(docp, id, le_domxmldocp); + DOMXML_PARAM_NONE(docp, id, le_domxmldocp); - node = docp->children; - if (!node) { + root = xmlDocGetRootElement(docp); + if (!root) { RETURN_FALSE; } - while (node) { - if (Z_TYPE_P(node) == XML_ELEMENT_NODE) { - zval *rv; - DOMXML_RET_OBJ(rv, node, &ret); - return; - } - node = node->next; - } + DOMXML_RET_OBJ(rv, root, &ret); } /* }}} */ @@ -3183,7 +3192,8 @@ if (!size) { RETURN_FALSE; } - RETURN_STRINGL(mem, size, 1); + RETVAL_STRINGL(mem, size, 1); + xmlFree(mem); } /* }}} */ @@ -3252,7 +3262,6 @@ RETURN_FALSE; } RETVAL_STRING(mem, 1); - xmlBufferFree(buf); } @@ -3407,7 +3416,7 @@ xmlFree(mem); RETURN_FALSE; } - RETURN_STRINGL(mem, size, 1); + RETVAL_STRINGL(mem, size, 1); xmlFree(mem); } /* }}} */ @@ -3514,9 +3523,9 @@ } /* }}} */ -/* {{{ proto object domxml_add_root(string name) +/* {{{ proto object domxml_doc_add_root(string name) Adds root node to document */ -PHP_FUNCTION(domxml_add_root) +PHP_FUNCTION(domxml_doc_add_root) { zval *id, *rv; xmlDoc *docp; @@ -3537,6 +3546,27 @@ } /* }}} */ +/* {{{ proto bool domxml_set_root(int domnode) + Sets root node of document */ +PHP_FUNCTION(domxml_doc_set_root) +{ + zval *id, *rv, *node; + xmlDoc *docp; + xmlNode *root; + + DOMXML_PARAM_TWO(docp, id, le_domxmldocp, "o", &node, &rv); + DOMXML_GET_OBJ(root, node, le_domxmlnodep); + + if (!root) { + RETURN_FALSE; + } + + xmlDocSetRootElement(docp, root); + + RETURN_TRUE; +} +/* }}} */ + /* {{{ proto object domxml_new_xmldoc(string version) Creates new xmldoc */ PHP_FUNCTION(domxml_new_xmldoc) @@ -4069,6 +4099,8 @@ } /* }}} */ + + #if HAVE_DOMXSLT static zval *php_xsltstylesheet_new(xsltStylesheetPtr obj, int *found TSRMLS_DC) { @@ -4257,7 +4289,7 @@ return params; } -/* {{{ proto object domxml_xslt_process(object xslstylesheet, object xmldoc [, array xslt_parameters [, bool xpath_parameters]]) +/* {{{ proto object domxml_xslt_process(object xslstylesheet, object xmldoc [, array xslt_parameters [, bool xpath_parameters [, string profileFilename]]]) Perform an XSLT transformation */ PHP_FUNCTION(domxml_xslt_process) { @@ -4273,6 +4305,8 @@ xmlDocPtr docp; char **params = NULL; int ret; + char *filename; + int filename_len = 0; DOMXML_GET_THIS(idxsl); @@ -4283,7 +4317,7 @@ RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|ab", &idxml, &idparams, &xpath_params) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|abs", &idxml, &idparams, &xpath_params, &filename, &filename_len) == FAILURE) { RETURN_FALSE; } @@ -4293,7 +4327,14 @@ params = php_domxslt_make_params(idparams, xpath_params TSRMLS_CC); } - docp = xsltApplyStylesheet(xsltstp, xmldocp, (const char**)params); + if (filename_len) { + FILE *f; + f = fopen (filename,"w"); + docp = xsltProfileStylesheet(xsltstp, xmldocp, (const char**)params, f); + fclose(f); + } else { + docp = xsltApplyStylesheet(xsltstp, xmldocp, (const char**)params); + } if (params) { efree(params); 1.5 +4 -3 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- php_domxml.h 9 May 2002 05:39:43 -0000 1.4 +++ php_domxml.h 2 Aug 2002 22:05:23 -0000 1.5 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.h,v 1.52 2002/05/03 13:53:46 chregu Exp $ */ +/* $Id: php_domxml.h,v 1.53 2002/05/16 21:59:26 chregu Exp $ */ #ifndef PHP_DOMXML_H #define PHP_DOMXML_H @@ -68,7 +68,6 @@ /* Class Document methods */ PHP_FUNCTION(domxml_doc_doctype); PHP_FUNCTION(domxml_doc_implementation); -PHP_FUNCTION(domxml_doc_document_element); PHP_FUNCTION(domxml_doc_create_element); PHP_FUNCTION(domxml_doc_create_text_node); PHP_FUNCTION(domxml_doc_create_comment); @@ -77,7 +76,9 @@ PHP_FUNCTION(domxml_doc_create_cdata_section); PHP_FUNCTION(domxml_doc_create_entity_reference); PHP_FUNCTION(domxml_doc_imported_node); -PHP_FUNCTION(domxml_add_root); +PHP_FUNCTION(domxml_doc_add_root); +PHP_FUNCTION(domxml_doc_document_element); +PHP_FUNCTION(domxml_doc_set_root); PHP_FUNCTION(domxml_intdtd); PHP_FUNCTION(domxml_doc_ids); PHP_FUNCTION(domxml_dump_mem); 1.3 +7 -3 php4/ext/exif/exif.c Index: exif.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/exif/exif.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- exif.c 29 Apr 2002 02:30:44 -0000 1.2 +++ exif.c 2 Aug 2002 22:05:23 -0000 1.3 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: exif.c,v 1.91 2002/04/14 20:47:21 helly Exp $ */ +/* $Id: exif.c,v 1.92 2002/05/19 00:02:07 sniper Exp $ */ /* ToDos * @@ -107,7 +107,7 @@ }; /* }}} */ -#define EXIF_VERSION "1.3 $Id: exif.c,v 1.91 2002/04/14 20:47:21 helly Exp $" +#define EXIF_VERSION "1.3 $Id: exif.c,v 1.92 2002/05/19 00:02:07 sniper Exp $" /* {{{ PHP_MINFO_FUNCTION */ @@ -2253,9 +2253,11 @@ /* If its bigger than 4 bytes, the dir entry contains an offset. */ value_ptr = offset_base+offset_val; if (offset_val+byte_count > IFDlength || value_ptr < dir_entry) { + /* // It is important to check for IMAGE_FILETYPE_TIFF // JPEG does not use absolute pointers instead its pointers are relative to the start // of the TIFF header in APP1 section. + */ if (offset_val<0 || offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM)) { if (value_ptr < dir_entry) { /* we can read this if offset_val > 0 */ @@ -2269,7 +2271,7 @@ return TRUE; } if (byte_count>sizeof(cbuf)) { - // mark as outside range and get buffer + /* mark as outside range and get buffer */ value_ptr = emalloc(byte_count); if (!value_ptr) { EXIF_ERRLOG_EALLOC @@ -2277,11 +2279,13 @@ } outside = value_ptr; } else { + /* // in most cases we only access a small range so // it is faster to use a static buffer there // BUT it offers also the possibility to have // pointers read without the need to free them // explicitley before returning. + */ value_ptr = cbuf; } 1.3 +2 -2 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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- gd.c 29 Apr 2002 02:30:45 -0000 1.2 +++ gd.c 2 Aug 2002 22:05:23 -0000 1.3 @@ -2056,8 +2056,8 @@ pcontribution = xportion * yportion; p = gdImageGetTrueColorPixel ( src, - (int) sx, - (int) sy); + (int) sx + srcX, + (int) sy + srcY); red += gdTrueColorGetRed (p) * pcontribution; green += gdTrueColorGetGreen (p) * pcontribution; blue += gdTrueColorGetBlue (p) * pcontribution; 1.3 +48 -42 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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_imap.c 29 Apr 2002 02:30:47 -0000 1.2 +++ php_imap.c 2 Aug 2002 22:05:23 -0000 1.3 @@ -25,7 +25,7 @@ | PHP 4.0 updates: Zeev Suraski <zeev****@zend*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.113 2002/04/24 15:29:52 sniper Exp $ */ +/* $Id: php_imap.c,v 1.115 2002/05/13 00:29:22 jon Exp $ */ #define IMAP41 @@ -286,15 +286,21 @@ * Accepts: pointer to FOBJECTLIST pointer * Author: CJH */ -void mail_free_foblist(FOBJECTLIST **foblist) +void mail_free_foblist(FOBJECTLIST **foblist, FOBJECTLIST **tail) { - if (*foblist) { /* only free if exists */ - if ((*foblist)->text.data) { - fs_give ((void **) &(*foblist)->text.data); - } - mail_free_foblist (&(*foblist)->next); - fs_give ((void **) foblist); /* return string to free storage */ - } + FOBJECTLIST *cur, *next; + + for(cur=*foblist, next=cur->next; cur; cur=next) { + next = cur->next; + + if(cur->text.data) + fs_give((void **)&(cur->text.data)); + + fs_give((void **)&cur); + } + + *tail = NIL; + *foblist = NIL; } /* }}} */ @@ -387,14 +393,21 @@ { imap_globals->imap_user = NIL; imap_globals->imap_password = NIL; - imap_globals->imap_folders = NIL; - imap_globals->imap_sfolders = NIL; + imap_globals->imap_alertstack = NIL; imap_globals->imap_errorstack = NIL; + + imap_globals->imap_folders = NIL; + imap_globals->imap_folders_tail = NIL; + imap_globals->imap_sfolders = NIL; + imap_globals->imap_sfolders_tail = NIL; imap_globals->imap_messages = NIL; imap_globals->imap_messages_tail = NIL; imap_globals->imap_folder_objects = NIL; + imap_globals->imap_folder_objects_tail = NIL; imap_globals->imap_sfolder_objects = NIL; + imap_globals->imap_sfolder_objects_tail = NIL; + imap_globals->folderlist_style = FLIST_ARRAY; } /* }}} */ @@ -636,6 +649,7 @@ acur = acur->next; } mail_free_stringlist(&IMAPG(imap_alertstack)); + IMAPG(imap_alertstack) = NIL; } return SUCCESS; } @@ -1377,7 +1391,7 @@ /* set flag for normal, old mailbox list */ IMAPG(folderlist_style) = FLIST_ARRAY; - IMAPG(imap_folders) = NIL; + IMAPG(imap_folders) = IMAPG(imap_folders_tail) = NIL; mail_list(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat)); if (IMAPG(imap_folders) == NIL) { RETURN_FALSE; @@ -1390,6 +1404,7 @@ cur=cur->next; } mail_free_stringlist (&IMAPG(imap_folders)); + IMAPG(imap_folders) = IMAPG(imap_folders_tail) = NIL; } /* }}} */ @@ -1416,7 +1431,7 @@ /* set flag for new, improved array of objects mailbox list */ IMAPG(folderlist_style) = FLIST_OBJECT; - IMAPG(imap_folder_objects) = NIL; + IMAPG(imap_folder_objects) = IMAPG(imap_folder_objects_tail) = NIL; mail_list(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat)); if (IMAPG(imap_folder_objects) == NIL) { RETURN_FALSE; @@ -1440,7 +1455,7 @@ add_next_index_object(return_value, mboxob); cur=cur->next; } - mail_free_foblist(&IMAPG(imap_folder_objects)); + mail_free_foblist(&IMAPG(imap_folder_objects), &IMAPG(imap_folder_objects_tail)); efree(delim); IMAPG(folderlist_style) = FLIST_ARRAY; /* reset to default */ } @@ -1477,6 +1492,7 @@ cur=cur->next; } mail_free_stringlist (&IMAPG(imap_folders)); + IMAPG(imap_folders) = IMAPG(imap_folders_tail) = NIL; } /* }}} */ @@ -1567,10 +1583,9 @@ { zval **streamind, **msgno, **fromlength, **subjectlength, **defaulthost; pils *imap_le_struct; - unsigned long length; MESSAGECACHE *cache; ENVELOPE *en; - char *mystring, dummy[2000], fulladdress[MAILTMPLEN]; + char dummy[2000], fulladdress[MAILTMPLEN]; int myargc = ZEND_NUM_ARGS(); if (myargc < 2 || myargc > 5 || zend_get_parameters_ex(myargc, &streamind, &msgno, &fromlength, &subjectlength, &defaulthost) == FAILURE) { @@ -1605,13 +1620,8 @@ RETURN_FALSE; } - mystring = mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, &length, NIL); - if (myargc == 5) { - rfc822_parse_msg(&en, NULL, mystring, length, NULL, Z_STRVAL_PP(defaulthost), NIL); - } else { - rfc822_parse_msg(&en, NULL, mystring, length, NULL, "UNKNOWN", NIL); - } - + en = mail_fetchenvelope(imap_le_struct->imap_stream, Z_LVAL_PP(msgno)); + /* call a function to parse all the text, so that we can use the same function to parse text from other sources */ _php_make_header_object(return_value, en TSRMLS_CC); @@ -1646,7 +1656,6 @@ mail_fetchsubject(fulladdress, imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_LVAL_PP(subjectlength)); add_property_string(return_value, "fetchsubject", fulladdress, 1); } - mail_free_envelope(&en); } /* }}} */ @@ -1715,6 +1724,7 @@ cur=cur->next; } mail_free_stringlist (&IMAPG(imap_sfolders)); + IMAPG(imap_sfolders) = IMAPG(imap_sfolders_tail) = NIL; } /* }}} */ @@ -1742,7 +1752,7 @@ /* set flag for new, improved array of objects list */ IMAPG(folderlist_style) = FLIST_OBJECT; - IMAPG(imap_sfolder_objects) = NIL; + IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL; mail_lsub(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat)); if (IMAPG(imap_sfolder_objects) == NIL) { RETURN_FALSE; @@ -1765,7 +1775,7 @@ add_next_index_object(return_value, mboxob); cur=cur->next; } - mail_free_foblist (&IMAPG(imap_sfolder_objects)); + mail_free_foblist (&IMAPG(imap_sfolder_objects), &IMAPG(imap_sfolder_objects_tail)); efree(delim); IMAPG(folderlist_style) = FLIST_ARRAY; /* reset to default */ } @@ -3972,17 +3982,16 @@ IMAPG(imap_folder_objects)->delimiter = delimiter; IMAPG(imap_folder_objects)->attributes = attributes; IMAPG(imap_folder_objects)->next = NIL; + IMAPG(imap_folder_objects_tail) = IMAPG(imap_folder_objects); } else { - ocur=IMAPG(imap_folder_objects); - while (ocur->next != NIL) { - ocur=ocur->next; - } + ocur=IMAPG(imap_folder_objects_tail); ocur->next=mail_newfolderobjectlist(); ocur=ocur->next; ocur->LSIZE = strlen(ocur->LTEXT = cpystr(mailbox)); ocur->delimiter = delimiter; ocur->attributes = attributes; ocur->next = NIL; + IMAPG(imap_folder_objects_tail) = ocur; } } else { @@ -3992,15 +4001,14 @@ IMAPG(imap_folders)=mail_newstringlist(); IMAPG(imap_folders)->LSIZE=strlen(IMAPG(imap_folders)->LTEXT=cpystr(mailbox)); IMAPG(imap_folders)->next=NIL; + IMAPG(imap_folders_tail) = IMAPG(imap_folders); } else { - cur=IMAPG(imap_folders); - while (cur->next != NIL) { - cur=cur->next; - } + cur=IMAPG(imap_folders_tail); cur->next=mail_newstringlist (); cur=cur->next; cur->LSIZE = strlen (cur->LTEXT = cpystr (mailbox)); cur->next = NIL; + IMAPG(imap_folders_tail) = cur; } } } @@ -4021,17 +4029,16 @@ IMAPG(imap_sfolder_objects)->delimiter = delimiter; IMAPG(imap_sfolder_objects)->attributes = attributes; IMAPG(imap_sfolder_objects)->next = NIL; + IMAPG(imap_sfolder_objects_tail) = IMAPG(imap_sfolder_objects); } else { - ocur=IMAPG(imap_sfolder_objects); - while (ocur->next != NIL) { - ocur=ocur->next; - } + ocur=IMAPG(imap_sfolder_objects_tail); ocur->next=mail_newfolderobjectlist(); ocur=ocur->next; ocur->LSIZE=strlen(ocur->LTEXT = cpystr(mailbox)); ocur->delimiter = delimiter; ocur->attributes = attributes; ocur->next = NIL; + IMAPG(imap_sfolder_objects_tail) = ocur; } } else { /* build the old simple array for imap_listsubscribed() */ @@ -4039,15 +4046,14 @@ IMAPG(imap_sfolders)=mail_newstringlist(); IMAPG(imap_sfolders)->LSIZE=strlen(IMAPG(imap_sfolders)->LTEXT=cpystr(mailbox)); IMAPG(imap_sfolders)->next=NIL; + IMAPG(imap_sfolders_tail) = IMAPG(imap_sfolders); } else { - cur=IMAPG(imap_sfolders); - while (cur->next != NIL) { - cur=cur->next; - } + cur=IMAPG(imap_sfolders_tail); cur->next=mail_newstringlist (); cur=cur->next; cur->LSIZE = strlen (cur->LTEXT = cpystr (mailbox)); cur->next = NIL; + IMAPG(imap_sfolders_tail) = cur; } } } 1.3 +10 -3 php4/ext/imap/php_imap.h Index: php_imap.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/imap/php_imap.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_imap.h 29 Apr 2002 02:30:47 -0000 1.2 +++ php_imap.h 2 Aug 2002 22:05:23 -0000 1.3 @@ -26,7 +26,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_imap.h,v 1.18 2002/03/11 23:11:04 derick Exp $ */ +/* $Id: php_imap.h,v 1.19 2002/05/12 20:53:25 jon Exp $ */ #ifndef PHP_IMAP_H #define PHP_IMAP_H @@ -185,14 +185,21 @@ ZEND_BEGIN_MODULE_GLOBALS(imap) char *imap_user; char *imap_password; - STRINGLIST *imap_folders; - STRINGLIST *imap_sfolders; + STRINGLIST *imap_alertstack; ERRORLIST *imap_errorstack; + + STRINGLIST *imap_folders; + STRINGLIST *imap_folders_tail; + STRINGLIST *imap_sfolders; + STRINGLIST *imap_sfolders_tail; MESSAGELIST *imap_messages; MESSAGELIST *imap_messages_tail; FOBJECTLIST *imap_folder_objects; + FOBJECTLIST *imap_folder_objects_tail; FOBJECTLIST *imap_sfolder_objects; + FOBJECTLIST *imap_sfolder_objects_tail; + folderlist_style_t folderlist_style; long status_flags; unsigned long status_messages; 1.3 +18 -14 php4/ext/interbase/interbase.c Index: interbase.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/interbase/interbase.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- interbase.c 29 Apr 2002 02:30:48 -0000 1.2 +++ interbase.c 2 Aug 2002 22:05:23 -0000 1.3 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interbase.c,v 1.82 2002/04/04 02:15:47 daniela Exp $ */ +/* $Id: interbase.c,v 1.85 2002/05/12 12:18:56 daniela Exp $ */ /* TODO: Arrays, roles? @@ -169,7 +169,7 @@ *trans_id = (Z_LVAL_PP(link_id)); ZEND_FETCH_RESOURCE(ib_trans, ibase_tr_link *, link_id, -1, "InterBase transaction", le_trans); *trans_n = ib_trans->trans_num; - ZEND_FETCH_RESOURCE2(resource, ibase_db_link *, link_id, ib_trans->link_rsrc, "InterBase link", le_link, le_plink); + ZEND_FETCH_RESOURCE2(resource, ibase_db_link *, NULL, ib_trans->link_rsrc, "InterBase link", le_link, le_plink); } else { IBDEBUG("Type is le_[p]link"); /* Database link resource, use default transaction (=0). */ @@ -435,7 +435,7 @@ } isc_transaction_info(IB_STATUS, &ib_query->trans,sizeof(tr_items), tr_items, sizeof(tmp), tmp ); /* we have the trans still open and a statement to drop? */ - if ( !(IB_STATUS[0] && IB_STATUS[0]) && ib_query->stmt) { + if ( !(IB_STATUS[0] && IB_STATUS[1]) && ib_query->stmt) { IBDEBUG("Dropping statement handle (free_query)..."); if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop)){ _php_ibase_error(); @@ -466,7 +466,7 @@ if (ib_blob->bl_handle != NULL) { /* blob open*/ if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) { - _php_ibase_error(); + php_error(E_ERROR, "You can lose data. Close any blob after reading of writing it. Use ibase_blob_close() before calling ibase_close()"); } } efree(ib_blob); @@ -478,19 +478,23 @@ { ibase_tr_link *ib_trans = (ibase_tr_link *)rsrc->ptr; ibase_db_link *ib_link; + int type; + void *ptr; - ib_link = (ibase_db_link *) zend_fetch_resource(NULL TSRMLS_CC, ib_trans->link_rsrc, "InterBase link", NULL, 2, le_link, le_plink); + ptr = zend_list_find(ib_trans->link_rsrc, &type); /* check if the link is still there */ + if (ptr && (type==le_link || type==le_plink)) { + ib_link = (ibase_db_link *) zend_fetch_resource(NULL TSRMLS_CC, ib_trans->link_rsrc, "InterBase link", NULL, 2, le_link, le_plink); - if (ib_link) { - if (ib_link->trans[ib_trans->trans_num] != NULL) { - IBDEBUG("Rolling back unhandled transaction..."); - if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[ib_trans->trans_num])) { - _php_ibase_error(); + if (ib_link) { + if (ib_link->trans[ib_trans->trans_num] != NULL) { + IBDEBUG("Rolling back unhandled transaction..."); + if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[ib_trans->trans_num])) { + _php_ibase_error(); + } + ib_link->trans[ib_trans->trans_num] = NULL; } - ib_link->trans[ib_trans->trans_num] = NULL; } - } - + } efree(ib_trans); } /* }}} */ @@ -604,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.82 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.85 $"); #ifdef COMPILE_DL_INTERBASE php_info_print_table_row(2, "Dynamic Module", "yes"); #endif 1.3 +7 -1 php4/ext/java/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/java/config.m4,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config.m4 29 Apr 2002 02:30:49 -0000 1.2 +++ config.m4 2 Aug 2002 22:05:23 -0000 1.3 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.31 2002/04/21 02:50:37 sniper Exp $ +dnl $Id: config.m4,v 1.32 2002/05/11 03:11:45 mfischer Exp $ dnl PHP_ARG_WITH(java, for JAVA support, @@ -20,6 +20,12 @@ JAVA_JAR="$JAVA_JAR cf" else JAVA_JAR= + fi + PHP_JAVAC=`which javac` + if test -z "$PHP_JAVAC"; then + AC_MSG_ERROR([Unable to locate the javac binary in your system path +Either adjust your Java installation or provide the Java installation path, +e.g. --with-java=/java expecting /java/bin/ to contain the binaries]) fi PHP_JAVA=`cd \`dirname \\\`which javac\\\`\`/..;pwd` else 1.3 +2 -1 php4/ext/mime_magic/TODO Index: TODO =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/mime_magic/TODO,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TODO 29 Apr 2002 02:30:51 -0000 1.2 +++ TODO 2 Aug 2002 22:05:23 -0000 1.3 @@ -1,3 +1,4 @@ - general cleanup - support for content-encoding / compressed files -- use streams \ No newline at end of file +- use streams +- fix ZTS build 1.3 +36 -22 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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_mssql.c 29 Apr 2002 02:30:52 -0000 1.2 +++ php_mssql.c 2 Aug 2002 22:05:23 -0000 1.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mssql.c,v 1.80 2002/03/19 23:00:17 fmk Exp $ */ +/* $Id: php_mssql.c,v 1.83 2002/05/15 18:07:17 fmk Exp $ */ #ifdef COMPILE_DL_MSSQL #define HAVE_MSSQL 1 @@ -136,6 +136,7 @@ STD_PHP_INI_ENTRY_EX("mssql.textlimit", "-1", PHP_INI_ALL, OnUpdateInt, textlimit, zend_mssql_globals, mssql_globals, display_text_size) 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) PHP_INI_END() /* error handler */ @@ -304,6 +305,7 @@ REGISTER_LONG_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT); /* END MSSQL data types for mssql_sp_bind */ return SUCCESS; @@ -372,7 +374,7 @@ case 0: /* defaults */ host=user=passwd=NULL; hashed_details_length=5+3; - hashed_details = (char *) emalloc(hashed_details_length+1); + hashed_details = (char *) emalloc(hashed_details_length); strcpy(hashed_details,"mssql___"); break; case 1: { @@ -385,7 +387,7 @@ host = Z_STRVAL_PP(yyhost); user=passwd=NULL; hashed_details_length = Z_STRLEN_PP(yyhost)+5+3; - hashed_details = (char *) emalloc(hashed_details_length+1); + hashed_details = (char *) emalloc(hashed_details_length); sprintf(hashed_details,"mssql_%s__",Z_STRVAL_PP(yyhost)); } break; @@ -401,7 +403,7 @@ user = Z_STRVAL_PP(yyuser); passwd=NULL; hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+5+3; - hashed_details = (char *) emalloc(hashed_details_length+1); + hashed_details = (char *) emalloc(hashed_details_length); sprintf(hashed_details,"mssql_%s_%s_",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser)); } break; @@ -418,7 +420,7 @@ user = Z_STRVAL_PP(yyuser); passwd = Z_STRVAL_PP(yypasswd); hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+5+3; - hashed_details = (char *) emalloc(hashed_details_length+1); + hashed_details = (char *) emalloc(hashed_details_length); sprintf(hashed_details,"mssql_%s_%s_%s",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd)); /* SAFE */ } break; @@ -441,11 +443,16 @@ dbprocerrhandle(mssql.login, (DBERRHANDLE_PROC) php_mssql_error_handler); dbprocmsghandle(mssql.login, (DBMSGHANDLE_PROC) php_mssql_message_handler); - if (user) { - DBSETLUSER(mssql.login,user); + if (MS_SQL_G(secure_connection) == 1){ + DBSETLSECURE(mssql.login); } - if (passwd) { - DBSETLPWD(mssql.login,passwd); + else { + if (user) { + DBSETLUSER(mssql.login,user); + } + if (passwd) { + DBSETLPWD(mssql.login,passwd); + } } DBSETLAPP(mssql.login,MS_SQL_G(appname)); mssql.valid = 1; @@ -772,11 +779,14 @@ Z_TYPE_P(result) = IS_STRING; break; } - case SQLFLT8: { - Z_DVAL_P(result) = (double) floatcol(offset); + case SQLFLT4: + Z_DVAL_P(result) = (double) floatcol4(offset); + Z_TYPE_P(result) = IS_DOUBLE; + break; + case SQLFLT8: + Z_DVAL_P(result) = (double) floatcol8(offset); Z_TYPE_P(result) = IS_DOUBLE; break; - } case SQLVARBINARY: case SQLBINARY: case SQLIMAGE: { @@ -784,7 +794,7 @@ unsigned char *res_buf; int res_length = dbdatlen(mssql_ptr->link, offset); - res_buf = (unsigned char *) emalloc(res_length + 1); + res_buf = (unsigned char *) emalloc(res_length); bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset)); memcpy(res_buf,bin,res_length); res_buf[res_length] = '\0'; @@ -805,13 +815,13 @@ if (column_type == SQLDATETIM4) res_length += 14; if (column_type == SQLDATETIME) res_length += 10; - res_buf = (unsigned char *) emalloc(res_length + 1); + res_buf = (unsigned char *) emalloc(res_length); res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1); } else { dbdatecrack(mssql_ptr->link, &dateinfo, (DBDATETIME *) dbdata(mssql_ptr->link,offset)); res_length = 19; - res_buf = (unsigned char *) emalloc(res_length + 1); + res_buf = (unsigned char *) emalloc(res_length); sprintf(res_buf, "%d-%02d-%02d %02d:%02d:%02d" , dateinfo.year, dateinfo.month, dateinfo.day, dateinfo.hour, dateinfo.minute, dateinfo.second); } @@ -840,7 +850,7 @@ unsigned char *res_buf; int res_length = dbdatlen(mssql_ptr->link, offset); - res_buf = (unsigned char *) emalloc(res_length + 1); + res_buf = (unsigned char *) emalloc(res_length); bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset)); memcpy(res_buf, bin, res_length); res_buf[res_length] = '\0'; @@ -858,14 +868,14 @@ if (column_type == SQLDATETIM4) res_length += 14; if (column_type == SQLDATETIME) res_length += 10; - res_buf = (unsigned char *) emalloc(res_length + 1); - res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1); + res_buf = (unsigned char *) emalloc(res_length); + res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR, res_buf, -1); } else { dbdatecrack(mssql_ptr->link, &dateinfo, (DBDATETIME *) dbdata(mssql_ptr->link,offset)); res_length = 19; - res_buf = (unsigned char *) emalloc(res_length + 1); + res_buf = (unsigned char *) emalloc(res_length); sprintf(res_buf, "%d-%02d-%02d %02d:%02d:%02d" , dateinfo.year, dateinfo.month, dateinfo.day, dateinfo.hour, dateinfo.minute, dateinfo.second); } @@ -1043,7 +1053,7 @@ RETURN_FALSE; } - if ((num_fields = dbnumcols(mssql_ptr->link)) <= 0) { + if ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && !dbdataready(mssql_ptr->link)) { RETURN_TRUE; } @@ -1057,8 +1067,10 @@ result->mssql_ptr = mssql_ptr; result->cur_field=result->cur_row=result->num_rows=0; - result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields); - result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC); + if (num_fields > 0) { + result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields); + result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC); + } ZEND_REGISTER_RESOURCE(return_value, result, le_result); } @@ -1875,6 +1887,7 @@ switch (type) { case SQLFLT8: + case SQLFLTN: convert_to_double_ex(var); value=(LPBYTE)(&Z_DVAL_PP(var)); break; @@ -2018,6 +2031,7 @@ break; case SQLFLT8: + case SQLFLTN: convert_to_double_ex(&bind->zval); Z_DVAL_P(bind->zval)=*((double *)(dbretdata(mssql_ptr->link,i))); break; 1.3 +4 -2 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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_mssql.h 29 Apr 2002 02:30:52 -0000 1.2 +++ php_mssql.h 2 Aug 2002 22:05:23 -0000 1.3 @@ -17,7 +17,7 @@ */ -/* $Id: php_mssql.h,v 1.20 2002/02/28 08:26:25 sebastian Exp $ */ +/* $Id: php_mssql.h,v 1.22 2002/05/14 23:57:43 fmk Exp $ */ #ifndef PHP_MSSQL_H #define PHP_MSSQL_H @@ -41,7 +41,8 @@ #define tinyintcol(i) ((int) *(DBTINYINT *) dbdata(mssql_ptr->link,i)) #define anyintcol(j) (coltype(j)==SQLINT4?intcol(j):(coltype(j)==SQLINT2?smallintcol(j):tinyintcol(j))) #define charcol(i) ((DBCHAR *) dbdata(mssql_ptr->link,i)) -#define floatcol(i) ((float) *(DBFLT8 *) dbdata(mssql_ptr->link,i)) +#define floatcol4(i) ((float) *(DBFLT4 *) dbdata(mssql_ptr->link,i)) +#define floatcol8(i) ((float) *(DBFLT8 *) dbdata(mssql_ptr->link,i)) #ifdef ZTS #include "TSRM.h" @@ -119,6 +120,7 @@ long textsize, textlimit, batchsize; long datetimeconvert; HashTable *resource_list, *resource_plist; + long secure_connection; ZEND_END_MODULE_GLOBALS(mssql) #define MSSQL_ROWS_BLOCK 128 1.4 +2 -2 php4/ext/openssl/openssl.c Index: openssl.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/openssl/openssl.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- openssl.c 3 May 2002 00:14:52 -0000 1.3 +++ openssl.c 2 Aug 2002 22:05:23 -0000 1.4 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.47 2002/05/01 08:22:16 wez Exp $ */ +/* $Id: openssl.c,v 1.48 2002/05/17 12:42:39 wez Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2362,7 +2362,7 @@ } /* }}} */ -/* {{{ proto bool openssl_private_decrypt(string data, string crypted, mixed key [, int padding]) +/* {{{ proto bool openssl_private_decrypt(string data, string decrypted, mixed key [, int padding]) Decrypts data with private key */ PHP_FUNCTION(openssl_private_decrypt) { 1.3 +2 -2 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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_pcre.c 29 Apr 2002 02:30:56 -0000 1.2 +++ php_pcre.c 2 Aug 2002 22:05:23 -0000 1.3 @@ -12,11 +12,11 @@ | obtain it through the world-wide-web, please send a note to | | licen****@php***** so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Andrei Zmievski <andre****@ispi*****> | + | Author: Andrei Zmievski <andre****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.121 2002/04/19 17:23:22 andrei Exp $ */ +/* $Id: php_pcre.c,v 1.122 2002/05/13 17:28:36 andrei Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" 1.3 +2 -2 php4/ext/pcre/php_pcre.h Index: php_pcre.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pcre/php_pcre.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_pcre.h 29 Apr 2002 02:30:56 -0000 1.2 +++ php_pcre.h 2 Aug 2002 22:05:23 -0000 1.3 @@ -12,11 +12,11 @@ | obtain it through the world-wide-web, please send a note to | | licen****@php***** so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Andrei Zmievski <andre****@ispi*****> | + | Author: Andrei Zmievski <andre****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.h,v 1.32 2002/02/28 08:26:35 sebastian Exp $ */ +/* $Id: php_pcre.h,v 1.33 2002/05/13 17:28:36 andrei Exp $ */ #ifndef PHP_PCRE_H #define PHP_PCRE_H 1.3 +3 -1 php4/ext/pgsql/pgsql.c Index: pgsql.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pgsql/pgsql.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- pgsql.c 29 Apr 2002 02:30:58 -0000 1.2 +++ pgsql.c 2 Aug 2002 22:05:23 -0000 1.3 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.198 2002/04/25 07:09:45 yohgaki Exp $ */ +/* $Id: pgsql.c,v 1.199 2002/05/11 03:01:08 yohgaki Exp $ */ #include <stdlib.h> @@ -28,6 +28,8 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + +#define SMART_STR_PREALLOC 512 #include "php.h" #include "php_ini.h" 1.3 +7 -1 php4/ext/pgsql/php_pgsql.h Index: php_pgsql.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/pgsql/php_pgsql.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_pgsql.h 29 Apr 2002 02:30:58 -0000 1.2 +++ php_pgsql.h 2 Aug 2002 22:05:23 -0000 1.3 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pgsql.h,v 1.45 2002/04/25 01:42:23 yohgaki Exp $ */ +/* $Id: php_pgsql.h,v 1.46 2002/05/10 02:39:37 edink Exp $ */ #ifndef PHP_PGSQL_H #define PHP_PGSQL_H @@ -36,6 +36,12 @@ #ifdef PHP_WIN32 #define INV_WRITE 0x00020000 #define INV_READ 0x00040000 +#undef PHPAPI +#ifdef PGSQL_EXPORTS +#define PHPAPI __declspec(dllexport) +#else +#define PHPAPI __declspec(dllimport) +#endif #else #include <libpq/libpq-fs.h> #endif 1.5 +38 -45 php4/ext/session/session.c Index: session.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/session/session.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- session.c 9 May 2002 05:39:43 -0000 1.4 +++ session.c 2 Aug 2002 22:05:23 -0000 1.5 @@ -13,11 +13,11 @@ | licen****@php***** so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Sascha Schumann <sasch****@schum*****> | - | Andrei Zmievski <andre****@ispi*****> | + | Andrei Zmievski <andre****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.303 2002/05/05 16:39:49 thies Exp $ */ +/* $Id: session.c,v 1.308 2002/05/13 17:28:37 andrei Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -83,12 +83,17 @@ static PHP_INI_MH(OnUpdateSaveHandler) { PS(mod) = _php_find_ps_module(new_value TSRMLS_CC); -/* Following lines are commented out to prevent bogus error message at - start up. i.e. Save handler modules are not initilzied before Session - module. */ -/* if(!PS(mod)) { */ -/* php_error(E_ERROR,"Cannot find save handler %s",new_value); */ -/* } */ +/* + * Following lines are commented out to prevent bogus error message at + * start up. i.e. Save handler modules are not initilzied before Session + * module. + */ + +#if 0 + if(!PS(mod)) { + php_error(E_ERROR,"Cannot find save handler %s",new_value); + } +#endif return SUCCESS; } @@ -96,12 +101,17 @@ static PHP_INI_MH(OnUpdateSerializer) { PS(serializer) = _php_find_ps_serializer(new_value TSRMLS_CC); -/* Following lines are commented out to prevent bogus error message at - start up. i.e. Serializer modules are not initilzied before Session - module. */ -/* if(!PS(serializer)) { */ -/* php_error(E_ERROR,"Cannot find serialization handler %s",new_value); */ -/* } */ +/* + * Following lines are commented out to prevent bogus error message at + * start up. i.e. Serializer modules are not initilzied before Session + * module. + */ + +#if 0 + if(!PS(serializer)) { + php_error(E_ERROR,"Cannot find serialization handler %s",new_value); + } +#endif return SUCCESS; } @@ -216,21 +226,12 @@ void (*func)(TSRMLS_D); } php_session_cache_limiter_t; -#define CACHE_LIMITER_FUNC(name) static void _php_cache_limiter_##name(TSRMLS_D) -#define CACHE_LIMITER(name) { #name, _php_cache_limiter_##name }, +#define CACHE_LIMITER(name) _php_cache_limiter_##name +#define CACHE_LIMITER_FUNC(name) static void CACHE_LIMITER(name)(TSRMLS_D) +#define CACHE_LIMITER_ENTRY(name) { #name, CACHE_LIMITER(name) }, #define ADD_COOKIE(a) sapi_add_header(a, strlen(a), 1); -#define STR_CAT(P,S,I) {\ - zval *__p = (P);\ - size_t __l = (I);\ - ulong __i = Z_STRLEN_P(__p);\ - Z_STRLEN_P(__p) += __l;\ - Z_STRVAL_P(__p) = (char *)erealloc(Z_STRVAL_P(__p), Z_STRLEN_P(__p) + 1);\ - memcpy(Z_STRVAL_P(__p) + __i, (S), __l); \ - Z_STRVAL_P(__p)[Z_STRLEN_P(__p)] = '\0'; \ -} - #define MAX_STR 512 void php_set_session_var(char *name, size_t namelen, zval *state_val, php_unserialize_data_t *var_hash TSRMLS_DC) @@ -358,13 +359,11 @@ PHP_VAR_SERIALIZE_INIT(var_hash); PS_ENCODE_LOOP( - if (key_length + 1 > MAX_STR) continue; smart_str_appendl(&buf, key, (unsigned char) key_length); smart_str_appendc(&buf, PS_DELIMITER); php_var_serialize(&buf, struc, &var_hash TSRMLS_CC); } else { - if (key_length + 2 > MAX_STR) continue; smart_str_appendc(&buf, PS_UNDEF_MARKER); smart_str_appendl(&buf, key, key_length); smart_str_appendc(&buf, PS_DELIMITER); @@ -605,8 +604,7 @@ php_gmtime_r(when, &tm); - /* we know all components, thus it is safe to use sprintf */ - n = sprintf(buf, "%s, %d %s %d %02d:%02d:%02d GMT", + n = sprintf(buf, "%s, %d %s %d %02d:%02d:%02d GMT", /* SAFE */ week_days[tm.tm_wday], tm.tm_mday, month_names[tm.tm_mon], tm.tm_year + 1900, tm.tm_hour, tm.tm_min, @@ -647,31 +645,26 @@ strcpy_gmt(buf + sizeof(EXPIRES) - 1, &now); ADD_COOKIE(buf); - sprintf(buf, "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60); + sprintf(buf, "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60); /* SAFE */ ADD_COOKIE(buf); last_modified(TSRMLS_C); } -CACHE_LIMITER_FUNC(private) +CACHE_LIMITER_FUNC(private_no_expire) { char buf[MAX_STR + 1]; - ADD_COOKIE("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); - sprintf(buf, "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60); + sprintf(buf, "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */ ADD_COOKIE(buf); last_modified(TSRMLS_C); } -CACHE_LIMITER_FUNC(private_no_expire) +CACHE_LIMITER_FUNC(private) { - char buf[MAX_STR + 1]; - - sprintf(buf, "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60); - ADD_COOKIE(buf); - - last_modified(TSRMLS_C); + ADD_COOKIE("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); + CACHE_LIMITER(private_no_expire)(TSRMLS_C); } CACHE_LIMITER_FUNC(nocache) @@ -684,10 +677,10 @@ } static php_session_cache_limiter_t php_session_cache_limiters[] = { - CACHE_LIMITER(public) - CACHE_LIMITER(private) - CACHE_LIMITER(private_no_expire) - CACHE_LIMITER(nocache) + CACHE_LIMITER_ENTRY(public) + CACHE_LIMITER_ENTRY(private) + CACHE_LIMITER_ENTRY(private_no_expire) + CACHE_LIMITER_ENTRY(nocache) {0} }; 1.3 +12 -12 php4/ext/snmp/snmp.c Index: snmp.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/snmp/snmp.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- snmp.c 29 Apr 2002 02:31:00 -0000 1.2 +++ snmp.c 2 Aug 2002 22:05:23 -0000 1.3 @@ -17,7 +17,7 @@ | Steven Lawrance <slawr****@techn*****> | +----------------------------------------------------------------------+ */ -/* $Id: snmp.c,v 1.56 2002/03/01 03:31:01 yohgaki Exp $ */ +/* $Id: snmp.c,v 1.58 2002/05/11 17:41:16 sterling Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -148,7 +148,8 @@ * st=11 snmpset() - query an agent and set a single value * */ -void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) { +static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) +{ zval **a1, **a2, **a3, **a4, **a5, **a6, **a7; struct snmp_session session, *ss; struct snmp_pdu *pdu=NULL, *response; @@ -215,15 +216,16 @@ if (st >= 2) { /* walk */ rootlen = MAX_NAME_LEN; - if ( strlen(objid) ) { /* on a walk, an empty string means top of tree - no error */ - if ( read_objid(objid, root, &rootlen) ) { + if (strlen(objid)) { /* on a walk, an empty string means top of tree - no error */ + if (read_objid(objid, root, &rootlen)) { gotroot = 1; } else { php_error(E_WARNING,"Invalid object identifier: %s\n", objid); } } - if (gotroot == 0) { - memmove((char *)root, (char *)objid_mib, sizeof(objid_mib)); + + if (!gotroot) { + memmove((char *) root, (char *) objid_mib, sizeof(objid_mib)); rootlen = sizeof(objid_mib) / sizeof(oid); gotroot = 1; } @@ -281,12 +283,12 @@ } } - while(keepwalking) { - keepwalking=0; + while (keepwalking) { + keepwalking = 0; if (st == 1) { pdu = snmp_pdu_create(SNMP_MSG_GET); name_length = MAX_NAME_LEN; - if ( !read_objid(objid, name, &name_length) ) { + if (!read_objid(objid, name, &name_length)) { php_error(E_WARNING,"Invalid object identifier: %s\n", objid); snmp_close(ss); RETURN_FALSE; @@ -317,9 +319,7 @@ if (st != 11) { sprint_value((struct sbuf *)buf,vars->name, vars->name_length, vars); } -#if 0 - Debug("snmp response is: %s\n",buf); -#endif + if (st == 1) { RETVAL_STRING(buf,1); } else if (st == 2) { 1.3 +11 -5 php4/ext/sockets/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/sockets/config.m4,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config.m4 29 Apr 2002 02:31:00 -0000 1.2 +++ config.m4 2 Aug 2002 22:05:24 -0000 1.3 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.8 2002/03/12 16:35:45 sas Exp $ +dnl $Id: config.m4,v 1.10 2002/05/12 17:28:12 sas Exp $ dnl PHP_ARG_ENABLE(sockets, whether to enable sockets support, @@ -7,9 +7,15 @@ if test "$PHP_SOCKETS" != "no"; then - AC_CHECK_FUNCS(hstrerror) - AC_CHECK_HEADERS(netdb.h netinet/tcp.h sys/un.h errno.h) - AC_DEFINE(HAVE_SOCKETS, 1, [ ]) + AC_CHECK_FUNCS([hstrerror]) + AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h errno.h]) + AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> + ], [static struct msghdr tp; int n = (int) tp.msg_flags; return n], + [AC_DEFINE(MISSING_MSGHDR_MSGFLAGS, 1, [ ])] + ) + AC_DEFINE([HAVE_SOCKETS], 1, [ ]) - PHP_NEW_EXTENSION(sockets, sockets.c, $ext_shared) + PHP_NEW_EXTENSION([sockets], [sockets.c], [$ext_shared]) fi 1.6 +17 -7 php4/ext/sockets/sockets.c Index: sockets.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/sockets/sockets.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- sockets.c 9 May 2002 05:39:43 -0000 1.5 +++ sockets.c 2 Aug 2002 22:05:24 -0000 1.6 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.113 2002/05/08 15:30:04 jason Exp $ */ +/* $Id: sockets.c,v 1.114 2002/05/12 07:22:47 jason Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1513,9 +1513,11 @@ hdr.msg_control = ctl_buf ? ctl_buf : NULL; hdr.msg_controllen = ctl_buf ? Z_LVAL_P(arg4) : 0; +#ifndef MISSING_MSGHDR_MSGFLAGS hdr.msg_flags = 0; - - if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) != 0) { +#endif + + if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) < 0) { PHP_SOCKET_ERROR(php_sock, "unable to receive message", errno); RETURN_FALSE; } else { @@ -1528,7 +1530,9 @@ zval_dtor(arg7); ZVAL_LONG(arg4, hdr.msg_controllen); +#ifndef MISSING_MSGHDR_MSGFLAGS ZVAL_LONG(arg5, hdr.msg_flags); +#endif ZVAL_LONG(arg7, ntohs(sin->sin_port)); if (array_init(arg3) == FAILURE) { @@ -1536,9 +1540,11 @@ RETURN_FALSE; } - add_assoc_long(arg3, "cmsg_level", mhdr->cmsg_level); - add_assoc_long(arg3, "cmsg_type", mhdr->cmsg_type); - add_assoc_string(arg3, "cmsg_data", CMSG_DATA(mhdr), 1); + if (mhdr != NULL) { + add_assoc_long(arg3, "cmsg_level", mhdr->cmsg_level); + add_assoc_long(arg3, "cmsg_type", mhdr->cmsg_type); + add_assoc_string(arg3, "cmsg_data", CMSG_DATA(mhdr), 1); + } { char *tmp = inet_ntoa(sin->sin_addr); @@ -1566,8 +1572,10 @@ hdr.msg_control = NULL; hdr.msg_controllen = 0; } - +#ifndef MISSING_MSGHDR_MSGFLAGS hdr.msg_flags = 0; +#endif + if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) != 0) { PHP_SOCKET_ERROR(php_sock, "unable to receive message", errno); @@ -1583,7 +1591,9 @@ zval_dtor(arg6); ZVAL_LONG(arg4, hdr.msg_controllen); +#ifndef MISSING_MSGHDR_MSGFLAGS ZVAL_LONG(arg5, hdr.msg_flags); +#endif if (array_init(arg3) == FAILURE) { php_error(E_WARNING, "%s() cannot initialize return value", get_active_function_name(TSRMLS_C)); 1.3 +2 -2 php4/ext/standard/array.c Index: array.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/array.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- array.c 29 Apr 2002 02:31:01 -0000 1.2 +++ array.c 2 Aug 2002 22:05:24 -0000 1.3 @@ -15,13 +15,13 @@ | Authors: Andi Gutmans <andi****@zend*****> | | Zeev Suraski <zeev****@zend*****> | | Rasmus Lerdorf <rasmu****@php*****> | - | Andrei Zmievski <andre****@ispi*****> | + | Andrei Zmievski <andre****@php*****> | | Stig Venaas <venaa****@php*****> | | Jason Greene <jason****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.161 2002/04/24 15:23:43 andrei Exp $ */ +/* $Id: array.c,v 1.162 2002/05/13 17:28:38 andrei Exp $ */ #include "php.h" #include "php_ini.h" 1.5 +18 -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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- basic_functions.c 9 May 2002 05:39:43 -0000 1.4 +++ basic_functions.c 2 Aug 2002 22:05:24 -0000 1.5 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.476 2002/05/04 18:33:13 sas Exp $ */ +/* $Id: basic_functions.c,v 1.478 2002/05/11 19:19:49 rasmus Exp $ */ #include "php.h" #include "php_streams.h" @@ -1866,6 +1866,14 @@ } convert_to_string(filename); + if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_P(filename), NULL, CHECKUID_ALLOW_ONLY_FILE))) { + RETURN_FALSE; + } + + if (php_check_open_basedir(Z_STRVAL_P(filename) TSRMLS_CC)) { + RETURN_FALSE; + } + if (i) { php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); } @@ -2463,6 +2471,15 @@ } convert_to_string_ex(filename); + + if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_ONLY_FILE))) { + RETURN_FALSE; + } + + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { + RETURN_FALSE; + } + fh.handle.fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "r"); if (!fh.handle.fp) { php_error(E_WARNING, "Cannot open '%s' for reading", Z_STRVAL_PP(filename)); 1.3 +23 -15 php4/ext/standard/dir.c Index: dir.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/dir.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- dir.c 29 Apr 2002 02:31:01 -0000 1.2 +++ dir.c 2 Aug 2002 22:05:24 -0000 1.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c,v 1.89 2002/04/16 22:14:21 wez Exp $ */ +/* $Id: dir.c,v 1.90 2002/05/18 13:31:31 mfischer Exp $ */ /* {{{ includes/startup/misc */ @@ -327,30 +327,38 @@ PHP_FUNCTION(glob) { char *pattern = NULL; - int argc = ZEND_NUM_ARGS(); int pattern_len; - long flags; + long flags = 0; glob_t globbuf; - zval *new_val; - int n; - char path[MAXPATHLEN]; - char *ret=NULL; + int n, ret; + + if (PG(safe_mode)) { + php_error(E_WARNING, "%s() SAFE MODE Restriction in effect, function is disabled", + get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } - if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &pattern, &pattern_len, &flags) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &pattern, &pattern_len, &flags) == FAILURE) return; globbuf.gl_offs = 0; - if(glob(pattern, 0, NULL, &globbuf)) { + if (0 != (ret = glob(pattern, flags, NULL, &globbuf))) { +#ifdef GLOB_NOMATCH + if (GLOB_NOMATCH == ret) { + /* Linux handles no matches as an error condition, but FreeBSD + * doesn't. This ensure that if no match is found, an empty array + * is always returned so it can be used with worrying in e.g. + * foreach() */ + array_init(return_value); + return; + } +#endif RETURN_FALSE; } array_init(return_value); - for(n=0;n<globbuf.gl_pathc;n++) { - MAKE_STD_ZVAL(new_val); - ZVAL_STRING(new_val, globbuf.gl_pathv[n], 1); - zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val, - sizeof(zval *), NULL); - ret = VCWD_GETCWD(path, MAXPATHLEN); + for (n = 0; n < globbuf.gl_pathc; n++) { + add_next_index_string(return_value, globbuf.gl_pathv[n], 1); } globfree(&globbuf); } 1.5 +2 -2 php4/ext/standard/file.c Index: file.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/file.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- file.c 9 May 2002 05:39:43 -0000 1.4 +++ file.c 2 Aug 2002 22:05:24 -0000 1.5 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.228 2002/05/06 17:31:22 jimw Exp $ */ +/* $Id: file.c,v 1.229 2002/05/12 15:59:42 rasmus Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1533,7 +1533,7 @@ convert_to_string_ex(arg1); - if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(arg1), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(arg1), NULL, CHECKUID_CHECK_FILE_AND_DIR))) { RETURN_FALSE; } 1.3 +24 -22 php4/ext/standard/filestat.c Index: filestat.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/filestat.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- filestat.c 29 Apr 2002 02:31:01 -0000 1.2 +++ filestat.c 2 Aug 2002 22:05:24 -0000 1.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filestat.c,v 1.90 2002/04/26 23:46:51 yohgaki Exp $ */ +/* $Id: filestat.c,v 1.92 2002/05/16 01:07:21 sniper Exp $ */ #include "php.h" #include "safe_mode.h" @@ -478,17 +478,17 @@ struct utimbuf *newtime = NULL; int ac = ZEND_NUM_ARGS(); + newtime = &newtimebuf; + if (ac == 1 && zend_get_parameters_ex(1, &filename) != FAILURE) { #ifndef HAVE_UTIME_NULL newtime->modtime = newtime->actime = time(NULL); #endif } else if (ac == 2 && zend_get_parameters_ex(2, &filename, &filetime) != FAILURE) { - newtime = &newtimebuf; convert_to_long_ex(filetime); newtime->actime = time(NULL); newtime->modtime = newtime->actime = Z_LVAL_PP(filetime); } else if (ac == 3 && zend_get_parameters_ex(3, &filename, &filetime, &fileatime) != FAILURE) { - newtime = &newtimebuf; convert_to_long_ex(fileatime); convert_to_long_ex(filetime); newtime->actime = Z_LVAL_PP(fileatime); @@ -539,7 +539,7 @@ } /* }}} */ -#define IS_LINK_OPERATION() (type == 8 /* filetype */ || type == 14 /* is_link */ || type == 16 /* lstat */) +#define IS_LINK_OPERATION(__t) ((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT) #define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK) /* {{{ php_stat @@ -569,22 +569,24 @@ BG(lsb).st_mode = 0; /* mark lstat buf invalid */ #endif if (VCWD_STAT(BG(CurrentStatFile), &BG(sb)) == -1) { - if (!IS_LINK_OPERATION() && (!IS_EXISTS_CHECK(type) || errno != ENOENT)) { /* fileexists() test must print no error */ + if (!IS_LINK_OPERATION(type) && (!IS_EXISTS_CHECK(type) || errno != ENOENT)) { /* fileexists() test must print no error */ php_error(E_WARNING, "stat failed for %s (errno=%d - %s)", BG(CurrentStatFile), errno, strerror(errno)); } efree(BG(CurrentStatFile)); BG(CurrentStatFile) = NULL; - if (!IS_LINK_OPERATION()) { /* Don't require success for link operation */ + if (!IS_LINK_OPERATION(type)) { /* Don't require success for link operation */ RETURN_FALSE; } } } #if HAVE_SYMLINK - if (IS_LINK_OPERATION() && !BG(lsb).st_mode) { + if (IS_LINK_OPERATION(type) && !BG(lsb).st_mode) { /* do lstat if the buffer is empty */ if (VCWD_LSTAT(filename, &BG(lsb)) == -1) { - php_error(E_WARNING, "lstat failed for %s (errno=%d - %s)", filename, errno, strerror(errno)); + if (!IS_EXISTS_CHECK(type) || errno != ENOENT) { /* fileexists() test must print no error */ + php_error(E_WARNING, "lstat failed for %s (errno=%d - %s)", BG(CurrentStatFile), errno, strerror(errno)); + } RETURN_FALSE; } } @@ -658,26 +660,26 @@ RETURN_STRING("unknown", 1); case FS_IS_W: if (getuid()==0) { - RETURN_LONG(1); /* root */ + RETURN_TRUE; /* root */ } - RETURN_LONG((BG(sb).st_mode & wmask) != 0); + RETURN_BOOL((BG(sb).st_mode & wmask) != 0); case FS_IS_R: if (getuid()==0) { - RETURN_LONG(1); /* root */ + RETURN_TRUE; /* root */ } - RETURN_LONG((BG(sb).st_mode&rmask)!=0); + RETURN_BOOL((BG(sb).st_mode&rmask)!=0); case FS_IS_X: if (getuid()==0) { xmask = S_IXROOT; /* root */ } - RETURN_LONG((BG(sb).st_mode&xmask)!=0 && !S_ISDIR(BG(sb).st_mode)); + RETURN_BOOL((BG(sb).st_mode&xmask)!=0 && !S_ISDIR(BG(sb).st_mode)); case FS_IS_FILE: - RETURN_LONG(S_ISREG(BG(sb).st_mode)); + RETURN_BOOL(S_ISREG(BG(sb).st_mode)); case FS_IS_DIR: - RETURN_LONG(S_ISDIR(BG(sb).st_mode)); + RETURN_BOOL(S_ISDIR(BG(sb).st_mode)); case FS_IS_LINK: #if HAVE_SYMLINK - RETURN_LONG(S_ISLNK(BG(lsb).st_mode)); + RETURN_BOOL(S_ISLNK(BG(lsb).st_mode)); #else RETURN_FALSE; #endif @@ -812,32 +814,32 @@ FileFunction(PHP_FN(filetype), FS_TYPE) /* }}} */ -/* {{{ proto int is_writable(string filename) +/* {{{ proto bool is_writable(string filename) Returns true if file can be written */ FileFunction(PHP_FN(is_writable), FS_IS_W) /* }}} */ -/* {{{ proto int is_readable(string filename) +/* {{{ proto bool is_readable(string filename) Returns true if file can be read */ FileFunction(PHP_FN(is_readable), FS_IS_R) /* }}} */ -/* {{{ proto int is_executable(string filename) +/* {{{ proto bool is_executable(string filename) Returns true if file is executable */ FileFunction(PHP_FN(is_executable), FS_IS_X) /* }}} */ -/* {{{ proto int is_file(string filename) +/* {{{ proto bool is_file(string filename) Returns true if file is a regular file */ FileFunction(PHP_FN(is_file), FS_IS_FILE) /* }}} */ -/* {{{ proto int is_dir(string filename) +/* {{{ proto bool is_dir(string filename) Returns true if file is directory */ FileFunction(PHP_FN(is_dir), FS_IS_DIR) /* }}} */ -/* {{{ proto int is_link(string filename) +/* {{{ proto bool is_link(string filename) Returns true if file is symbolic link */ FileFunction(PHP_FN(is_link), FS_IS_LINK) /* }}} */ 1.3 +2 -2 php4/ext/standard/head.c Index: head.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/head.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- head.c 29 Apr 2002 02:31:01 -0000 1.2 +++ head.c 2 Aug 2002 22:05:24 -0000 1.3 @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <rasmu****@lerdo*****> | +----------------------------------------------------------------------+ */ -/* $Id: head.c,v 1.55 2002/02/28 08:26:45 sebastian Exp $ */ +/* $Id: head.c,v 1.56 2002/05/17 07:10:19 jwoolley Exp $ */ #include <stdio.h> #include "php.h" @@ -121,7 +121,7 @@ strcat(cookie, "; secure"); } - return sapi_add_header(cookie, strlen(cookie), 0); + return sapi_add_header_ex(cookie, strlen(cookie), 0, 0 TSRMLS_CC); } 1.5 +20 -10 php4/ext/standard/info.c Index: info.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/info.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- info.c 9 May 2002 05:39:43 -0000 1.4 +++ info.c 2 Aug 2002 22:05:24 -0000 1.5 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.173 2002/05/02 17:36:00 fmk Exp $ */ +/* $Id: info.c,v 1.180 2002/05/13 17:43:04 zeev Exp $ */ #include "php.h" #include "php_ini.h" @@ -67,6 +67,7 @@ { zval **data, **tmp, tmp2; char *string_key; + uint string_len; ulong num_key; if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE @@ -77,9 +78,9 @@ PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>"); PUTS(name); PUTS("[\""); - switch (zend_hash_get_current_key(Z_ARRVAL_PP(data), &string_key, &num_key, 0)) { + switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) { case HASH_KEY_IS_STRING: - php_html_puts(string_key, strlen(string_key) TSRMLS_CC); + zend_html_puts(string_key, string_len-1); break; case HASH_KEY_IS_LONG: php_printf("%ld", num_key); @@ -94,10 +95,10 @@ tmp2 = **tmp; zval_copy_ctor(&tmp2); convert_to_string(&tmp2); - php_html_puts(Z_STRVAL(tmp2), Z_STRLEN(tmp2) TSRMLS_CC); + zend_html_puts(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); zval_dtor(&tmp2); } else { - php_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp) TSRMLS_CC); + zend_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } PUTS(" </td></tr>\n"); zend_hash_move_forward(Z_ARRVAL_PP(data)); @@ -207,12 +208,16 @@ int expose_php = INI_INT("expose_php"); time_t the_time; struct tm *ta, tmbuf; - char api_no[9]; + 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 (api_no, 9, "%d", ZEND_EXTENSION_API_NO); + 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"); @@ -256,7 +261,9 @@ 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, "Zend API No.", api_no); + 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); #if ZEND_DEBUG php_info_print_table_row(2, "Debug Build", "yes" ); @@ -284,7 +291,7 @@ PUTS("?="ZEND_LOGO_GUID"\" border=\"0\" align=\"right\" alt=\"Zend logo\"></a>\n"); } php_printf("This program makes use of the Zend Scripting Language Engine:<br />"); - php_html_puts(zend_version, strlen(zend_version) TSRMLS_CC); + zend_html_puts(zend_version, strlen(zend_version)); php_info_print_box_end(); efree(php_uname); } @@ -476,7 +483,7 @@ if (!row_element || !*row_element) { php_printf(" "); } else { - php_html_puts(row_element, strlen(row_element) TSRMLS_CC); + zend_html_puts(row_element, strlen(row_element)); } php_printf("%s</td>", (i==0?"</b>":"")); @@ -525,7 +532,10 @@ flag = PHP_INFO_ALL; } + /* Andale! Andale! Yee-Hah! */ + php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC); php_print_info(flag TSRMLS_CC); + php_end_ob_buffer(1, 0 TSRMLS_CC); RETURN_TRUE; } 1.3 +11 -5 php4/ext/standard/mail.c Index: mail.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/mail.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mail.c 29 Apr 2002 02:31:02 -0000 1.2 +++ mail.c 2 Aug 2002 22:05:24 -0000 1.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mail.c,v 1.51 2002/03/16 15:50:20 mfischer Exp $ */ +/* $Id: mail.c,v 1.52 2002/05/14 20:43:48 mfischer Exp $ */ #include <stdlib.h> #include <ctype.h> @@ -111,7 +111,8 @@ 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; int ret; @@ -121,9 +122,14 @@ if (!sendmail_path) { #ifdef PHP_WIN32 /* handle old style win smtp sending */ - if (TSendMail(INI_STR("SMTP"), &tsm_err, headers, subject, to, message) != SUCCESS){ - php_error(E_WARNING, "%s() %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err)); - return 0; + 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); + } else { + php_error(E_WARNING, "%s() %s", get_active_function_name(TSRMLS_C), GetSMErrorText(tsm_err)); + } + return 0; } return 1; #else 1.3 +2 -2 php4/ext/standard/php_array.h Index: php_array.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/php_array.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_array.h 29 Apr 2002 02:31:02 -0000 1.2 +++ php_array.h 2 Aug 2002 22:05:24 -0000 1.3 @@ -15,11 +15,11 @@ | Authors: Andi Gutmans <andi****@zend*****> | | Zeev Suraski <zeev****@zend*****> | | Rasmus Lerdorf <rasmu****@php*****> | - | Andrei Zmievski <andre****@ispi*****> | + | Andrei Zmievski <andre****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_array.h,v 1.34 2001/12/11 15:30:34 sebastian Exp $ */ +/* $Id: php_array.h,v 1.35 2002/05/13 17:28:38 andrei Exp $ */ #ifndef PHP_ARRAY_H #define PHP_ARRAY_H 1.4 +21 -6 php4/ext/standard/string.c Index: string.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/string.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- string.c 9 May 2002 05:39:43 -0000 1.3 +++ string.c 2 Aug 2002 22:05:24 -0000 1.4 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.271 2002/05/04 17:38:45 sas Exp $ */ +/* $Id: string.c,v 1.274 2002/05/16 16:04:45 pbannister Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -420,6 +420,7 @@ } } #endif +/* }}} */ #ifdef HAVE_STRCOLL /* {{{ proto int strcoll(string str1, string str2) @@ -1094,14 +1095,28 @@ /* }}} */ /* {{{ php_dirname - * - * This function doesn't work with absolute paths in Win32 such as C:\foo - * (and it didn't before either). This needs to be fixed - */ + Returns directory name component of path */ PHPAPI void php_dirname(char *path, int len) { register char *end = path + len - 1; +#ifdef PHP_WIN32 + /* Note that on Win32 CWD is per drive (heritage from CP/M). + * This means dirname("c:foo") maps to "c:." or "c:" - which means CWD on C: drive. + */ + if ((2 <= len) && isalpha(path[0]) && (':' == path[1])) { + /* Skip over the drive spec (if any) so as not to change */ + path += 2; + if (2 == len) { + /* Return "c:" on Win32 for dirname("c:"). + * It would be more consistent to return "c:." + * but that would require making the string *longer*. + */ + return; + } + } +#endif + if (len <= 0) { /* Illegal use of this function */ return; @@ -2130,7 +2145,7 @@ t = str; if (PG(magic_quotes_sybase)) { - while (l >= 0) { + while (l > 0) { if(*t=='\'') { if((l>0) && (t[1]=='\'')) { t++; 1.5 +2 -2 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- url_scanner_ex.c 9 May 2002 05:39:43 -0000 1.4 +++ url_scanner_ex.c 2 Aug 2002 22:05:24 -0000 1.5 @@ -1,5 +1,5 @@ -/* Generated by re2c 0.5 on Sun May 5 18:40:01 2002 */ -#line 1 "/home/thies/devel/php4/ext/standard/url_scanner_ex.re" +/* Generated by re2c 0.5 on Wed May 8 08:08:09 2002 */ +#line 1 "/home/rasmus/php4/ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ | PHP Version 4 | 1.3 +2 -3 php4/ext/standard/tests/aggregation/aggregate.phpt Index: aggregate.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/aggregate.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregate.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ aggregate.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -1,10 +1,9 @@ --TEST-- aggregating everything ---POST-- ---GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; + +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate($obj, 'helper'); 1.3 +1 -1 php4/ext/standard/tests/aggregation/aggregate_methods.phpt Index: aggregate_methods.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/aggregate_methods.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregate_methods.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ aggregate_methods.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -4,7 +4,7 @@ --GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate_methods($obj, 'mixin'); 1.3 +1 -1 php4/ext/standard/tests/aggregation/aggregate_methods_by_list.phpt Index: aggregate_methods_by_list.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/aggregate_methods_by_list.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregate_methods_by_list.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ aggregate_methods_by_list.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -4,7 +4,7 @@ --GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate_methods_by_list($obj, 'helper', array('just_another_method')); 1.3 +1 -1 php4/ext/standard/tests/aggregation/aggregate_methods_by_regexp.phpt Index: aggregate_methods_by_regexp.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/aggregate_methods_by_regexp.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregate_methods_by_regexp.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ aggregate_methods_by_regexp.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -4,7 +4,7 @@ --GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate_methods_by_regexp($obj, 'helper', '/^do/'); 1.3 +1 -1 php4/ext/standard/tests/aggregation/aggregate_properties.phpt Index: aggregate_properties.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/aggregate_properties.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregate_properties.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ aggregate_properties.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -4,7 +4,7 @@ --GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate_properties($obj, 'mixin'); 1.3 +1 -1 php4/ext/standard/tests/aggregation/aggregate_properties_by_list.phpt Index: aggregate_properties_by_list.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/aggregate_properties_by_list.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregate_properties_by_list.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ aggregate_properties_by_list.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -4,7 +4,7 @@ --GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate_properties_by_list($obj, 'helper', array('my_prop', 'our_prop')); 1.3 +1 -1 php4/ext/standard/tests/aggregation/aggregate_properties_by_regexp.phpt Index: aggregate_properties_by_regexp.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/aggregate_properties_by_regexp.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregate_properties_by_regexp.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ aggregate_properties_by_regexp.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -4,7 +4,7 @@ --GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate_properties_by_regexp($obj, 'helper', '/^my/'); 1.3 +1 -1 php4/ext/standard/tests/aggregation/aggregation_info.phpt Index: aggregation_info.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/aggregation_info.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aggregation_info.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ aggregation_info.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -4,7 +4,7 @@ --GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate($obj, 'mixin'); 1.3 +1 -1 php4/ext/standard/tests/aggregation/deaggregate.phpt Index: deaggregate.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/aggregation/deaggregate.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- deaggregate.phpt 29 Apr 2002 02:31:03 -0000 1.2 +++ deaggregate.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -4,7 +4,7 @@ --GET-- --FILE-- <?php -include "./ext/standard/tests/aggregation/aggregate.lib"; +include "ext/standard/tests/aggregation/aggregate.lib"; $obj = new simple(); aggregate($obj, 'helper'); 1.3 +19 -11 php4/ext/standard/tests/file/003.inc Index: 003.inc =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/file/003.inc,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 003.inc 9 May 2002 05:39:43 -0000 1.2 +++ 003.inc 2 Aug 2002 22:05:24 -0000 1.3 @@ -1,19 +1,27 @@ <?php -$filename=""; - -$bb = is_file($filename); -var_dump($bb); +$funcs = array( + 'is_writable', + 'is_readable', + 'is_executable', + 'is_file', + 'file_exists', +); -$aa = file_exists($filename); -var_dump($aa); +$filename=""; -$filename="php.ini-dist"; +foreach ($funcs as $test) { + $bb = $test($filename); + var_dump($bb); + clearstatcache(); +} -$bb = is_file($filename); -var_dump($bb); +$filename="run-tests.php"; -$aa = file_exists($filename); -var_dump($aa); +foreach ($funcs as $test) { + $bb = $test($filename); + var_dump($bb); + clearstatcache(); +} ?> 1.3 +7 -1 php4/ext/standard/tests/file/003.phpt Index: 003.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/standard/tests/file/003.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 003.phpt 9 May 2002 05:39:43 -0000 1.2 +++ 003.phpt 2 Aug 2002 22:05:24 -0000 1.3 @@ -1,5 +1,5 @@ --TEST-- -is_file/file_exist +is_*() and file_exists() return values are boolean. --POST-- --GET-- --FILE-- @@ -7,5 +7,11 @@ --EXPECT-- bool(false) bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) bool(true) bool(true) 1.3 +13 -1 php4/ext/swf/swf.c Index: swf.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/swf/swf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- swf.c 29 Apr 2002 02:31:04 -0000 1.2 +++ swf.c 2 Aug 2002 22:05:24 -0000 1.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: swf.c,v 1.44 2001/12/11 15:30:38 sebastian Exp $ */ +/* $Id: swf.c,v 1.45 2002/05/11 15:58:55 sterling Exp $ */ #ifdef HAVE_CONFIG_H @@ -138,10 +138,20 @@ } /* }}} */ +/* {{{ _swf_init_globals + */ +static void _swf_init_globals(zend_swf_globals *sg) +{ + memset(sg, 0, sizeof(zend_swf_globals)); +} +/* }}} */ + /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(swf) { + ZEND_INIT_MODULE_GLOBALS(swf, _swf_init_globals, NULL); + REGISTER_LONG_CONSTANT("MOD_COLOR", MOD_COLOR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MOD_MATRIX", MOD_MATRIX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("TYPE_PUSHBUTTON", TYPE_PUSHBUTTON, CONST_CS | CONST_PERSISTENT); @@ -162,6 +172,7 @@ REGISTER_LONG_CONSTANT("ButtonExit", ButtonExit, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MenuEnter", MenuEnter, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MenuExit", MenuExit, CONST_CS | CONST_PERSISTENT); + return SUCCESS; } /* }}} */ @@ -262,6 +273,7 @@ fclose(f); VCWD_UNLINK((const char *)SWFG(tmpfile_name)); + efree(SWFG(tmpfile_name)); } } /* }}} */ 1.3 +2 -1 php4/ext/sysvsem/php_sysvsem.h Index: php_sysvsem.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/sysvsem/php_sysvsem.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_sysvsem.h 29 Apr 2002 02:31:04 -0000 1.2 +++ php_sysvsem.h 2 Aug 2002 22:05:24 -0000 1.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_sysvsem.h,v 1.11 2002/02/28 08:26:51 sebastian Exp $ */ +/* $Id: php_sysvsem.h,v 1.12 2002/05/17 12:33:48 wez Exp $ */ #ifndef PHP_SYSVSEM_H #define PHP_SYSVSEM_H @@ -41,6 +41,7 @@ int key; /* For error reporting. */ int semid; /* Returned by semget(). */ int count; /* Acquire count for auto-release. */ + int auto_release; /* flag that says to auto-release. */ } sysvsem_sem; extern sysvsem_module php_sysvsem_module; 1.3 +40 -64 php4/ext/sysvsem/sysvsem.c Index: sysvsem.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/sysvsem/sysvsem.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- sysvsem.c 29 Apr 2002 02:31:04 -0000 1.2 +++ sysvsem.c 2 Aug 2002 22:05:24 -0000 1.3 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sysvsem.c,v 1.39 2002/03/28 07:36:02 derick Exp $ */ +/* $Id: sysvsem.c,v 1.40 2002/05/17 12:33:49 wez Exp $ */ /* Latest update build anc tested on Linux 2.2.14 * @@ -107,13 +107,13 @@ { sysvsem_sem *sem_ptr = (sysvsem_sem *)rsrc->ptr; struct sembuf sop[2]; - + int opcount = 1; /* * if count == -1, semaphore has been removed * Need better way to handle this */ - if(sem_ptr->count == -1) { + if(sem_ptr->count == -1 || !sem_ptr->auto_release) { return; } /* Decrement the usage count. */ @@ -130,8 +130,10 @@ sop[1].sem_num = SYSVSEM_SEM; sop[1].sem_op = sem_ptr->count; sop[1].sem_flg = SEM_UNDO; + + opcount++; } - if (semop(sem_ptr->semid, sop, sem_ptr->count ? 2 : 1) == -1) { + if (semop(sem_ptr->semid, sop, opcount) == -1) { php_error(E_WARNING, "semop() failed in release_sysvsem_sem for key 0x%x: %s", sem_ptr->key, strerror(errno)); } @@ -154,12 +156,11 @@ #undef SETVAL_WANTS_PTR #endif -/* {{{ proto int sem_get(int key [, int max_acquire [, int perm]]) +/* {{{ proto int sem_get(int key [, int max_acquire [, int perm [, int auto_release]]) Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */ PHP_FUNCTION(sem_get) { - pval **arg_key, **arg_max_acquire, **arg_perm; - int key, max_acquire, perm; + int key, max_acquire, perm, auto_release = 1; int semid; struct sembuf sop[3]; int count; @@ -171,37 +172,8 @@ max_acquire = 1; perm = 0666; - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1, &arg_key)==FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(arg_key); - key = (int)Z_LVAL_PP(arg_key); - break; - case 2: - if (zend_get_parameters_ex(2, &arg_key, &arg_max_acquire)==FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(arg_key); - key = (int)Z_LVAL_PP(arg_key); - convert_to_long_ex(arg_max_acquire); - max_acquire = (int)Z_LVAL_PP(arg_max_acquire); - break; - case 3: - if (zend_get_parameters_ex(3, &arg_key, &arg_max_acquire, &arg_perm)==FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(arg_key); - convert_to_long_ex(arg_max_acquire); - convert_to_long_ex(arg_perm); - key = (int)Z_LVAL_PP(arg_key); - max_acquire = (int)Z_LVAL_PP(arg_max_acquire); - perm = (int)Z_LVAL_PP(arg_perm); - break; - default: - WRONG_PARAM_COUNT; - break; + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|lll", &key, &max_acquire, &perm, &auto_release)) { + RETURN_FALSE; } /* Get/create the semaphore. Note that we rely on the semaphores @@ -298,6 +270,7 @@ sem_ptr->key = key; sem_ptr->semid = semid; sem_ptr->count = 0; + sem_ptr->auto_release = auto_release; Z_LVAL_P(return_value) = zend_list_insert(sem_ptr, php_sysvsem_module.le_sem); Z_TYPE_P(return_value) = IS_LONG; @@ -382,50 +355,53 @@ PHP_FUNCTION(sem_remove) { - pval **arg_id; - int id,type; + pval **arg_id; + int id,type; sysvsem_sem *sem_ptr; #if HAVE_SEMUN union semun un; + struct semid_ds buf; #endif - if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(arg_id); - - id = Z_LVAL_PP(arg_id); - - sem_ptr = (sysvsem_sem *) zend_list_find(id, &type); - - if (type!=php_sysvsem_module.le_sem) { - php_error(E_WARNING, "%d is not a SysV semaphore index", id); - RETURN_FALSE; - } + + if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long_ex(arg_id); + + id = Z_LVAL_PP(arg_id); + + sem_ptr = (sysvsem_sem *) zend_list_find(id, &type); + + if (type!=php_sysvsem_module.le_sem) { + php_error(E_WARNING, "%d is not a SysV semaphore index", id); + RETURN_FALSE; + } #if HAVE_SEMUN - if(semctl(sem_ptr->semid,NULL,IPC_STAT,un)<0) { + un.buf = &buf; + if(semctl(sem_ptr->semid, 0, IPC_STAT, &un) < 0) { #else - if(semctl(sem_ptr->semid,NULL,IPC_STAT,NULL)<0) { + if(semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) { #endif - php_error(E_WARNING, "%d is not a existing SysV Semaphore Id", id); - RETURN_FALSE; - } + php_error(E_WARNING, "%d is not a existing SysV Semaphore Id", id); + RETURN_FALSE; + } #if HAVE_SEMUN - if(semctl(sem_ptr->semid,NULL,IPC_RMID,un)<0) { + if(semctl(sem_ptr->semid, 0, IPC_RMID, &un) < 0) { #else - if(semctl(sem_ptr->semid,NULL,IPC_RMID,NULL)<0) { + if(semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) { #endif - php_error(E_WARNING, "sem_remove() failed for id %d: %s", id, strerror(errno)); - RETURN_FALSE; - } + php_error(E_WARNING, "sem_remove() failed for id %d: %s", id, strerror(errno)); + RETURN_FALSE; + } /* let release_sysvsem_sem know we have removed * the semaphore to avoid issues with releasing. */ sem_ptr->count = -1; - RETURN_TRUE; + RETURN_TRUE; } /* }}} */ 1.3 +2 -2 php4/ext/wddx/php_wddx.h Index: php_wddx.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/wddx/php_wddx.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_wddx.h 29 Apr 2002 02:31:05 -0000 1.2 +++ php_wddx.h 2 Aug 2002 22:05:24 -0000 1.3 @@ -12,11 +12,11 @@ | obtain it through the world-wide-web, please send a note to | | licen****@php***** so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Andrei Zmievski <andre****@ispi*****> | + | Author: Andrei Zmievski <andre****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: php_wddx.h,v 1.10 2002/02/28 08:26:56 sebastian Exp $ */ +/* $Id: php_wddx.h,v 1.11 2002/05/13 17:28:37 andrei Exp $ */ #ifndef PHP_WDDX_H #define PHP_WDDX_H 1.3 +2 -2 php4/ext/wddx/wddx.c Index: wddx.c =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/wddx/wddx.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- wddx.c 29 Apr 2002 02:31:05 -0000 1.2 +++ wddx.c 2 Aug 2002 22:05:24 -0000 1.3 @@ -12,11 +12,11 @@ | obtain it through the world-wide-web, please send a note to | | licen****@php***** so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Andrei Zmievski <andre****@ispi*****> | + | Author: Andrei Zmievski <andre****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: wddx.c,v 1.91 2002/02/28 08:26:57 sebastian Exp $ */ +/* $Id: wddx.c,v 1.92 2002/05/13 17:28:37 andrei Exp $ */ #include "php.h" #include "php_wddx.h" 1.3 +5 -1 php4/ext/zip/php_zip.h Index: php_zip.h =================================================================== RCS file: /cvsroot/php-i18n/php4/ext/zip/php_zip.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_zip.h 29 Apr 2002 02:31:08 -0000 1.2 +++ php_zip.h 2 Aug 2002 22:05:24 -0000 1.3 @@ -26,10 +26,14 @@ extern zend_module_entry zip_module_entry; #define phpext_zip_ptr &zip_module_entry +#define PHP_ZZIPLIB_API #ifdef PHP_WIN32 +#undef PHP_ZZIPLIB_API +#ifdef ZIP_EXPORTS #define PHP_ZZIPLIB_API __declspec(dllexport) #else -#define PHP_ZZIPLIB_API +#define PHP_ZZIPLIB_API __declspec(dllimport) +#endif #endif PHP_MINIT_FUNCTION(zip); 1.2 +108 -0 php4/ext/zip/zip.dsp 1.3 +2 -1 php4/main/SAPI.h Index: SAPI.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/SAPI.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SAPI.h 29 Apr 2002 02:33:37 -0000 1.2 +++ SAPI.h 2 Aug 2002 22:05:24 -0000 1.3 @@ -186,6 +186,7 @@ void (*unblock_interruptions)(void); void (*default_post_reader)(TSRMLS_D); + char *executable_location; }; @@ -216,7 +217,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data); SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader); -#define STANDARD_SAPI_MODULE_PROPERTIES NULL +#define STANDARD_SAPI_MODULE_PROPERTIES NULL, NULL #endif /* SAPI_H */ 1.3 +2 -2 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config.w32.h.in 9 May 2002 05:39:43 -0000 1.2 +++ config.w32.h.in 2 Aug 2002 22:05:24 -0000 1.3 @@ -2,7 +2,7 @@ Build Configuration for Win32. This has only been tested with MS VisualC++ 6 (and later). - $Id: config.w32.h.in,v 1.1.2.1 2002/05/09 04:17:00 yohgaki Exp $ + $Id: config.w32.h.in,v 1.2 2002/05/10 04:58:05 edink Exp $ */ /* Default PHP / PEAR directories */ @@ -24,7 +24,7 @@ #define HAVE_CRYPT 1 #define PHP_STD_DES_CRYPT 1 #define PHP_EXT_DES_CRYPT 0 -#define PHP_MD5_CRYPT 0 +#define PHP_MD5_CRYPT 1 #define PHP_BLOWFISH_CRYPT 0 /* Enable / Disable CALENDAR extension (default: enabled) */ 1.3 +2 -2 php4/main/fopen_wrappers.c Index: fopen_wrappers.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/fopen_wrappers.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- fopen_wrappers.c 29 Apr 2002 02:33:37 -0000 1.2 +++ fopen_wrappers.c 2 Aug 2002 22:05:25 -0000 1.3 @@ -16,7 +16,7 @@ | Jim Winstead <jimw****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: fopen_wrappers.c,v 1.143 2002/03/15 21:03:07 wez Exp $ */ +/* $Id: fopen_wrappers.c,v 1.144 2002/05/11 19:58:40 rasmus Exp $ */ /* {{{ includes */ @@ -219,7 +219,7 @@ } /* Nothing to check... */ - return 0; + return -1; } /* }}} */ 1.6 +8 -47 php4/main/main.c Index: main.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/main.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- main.c 9 May 2002 05:39:43 -0000 1.5 +++ main.c 2 Aug 2002 22:05:25 -0000 1.6 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.448 2002/05/08 12:33:41 hirokawa Exp $ */ +/* $Id: main.c,v 1.456 2002/05/13 08:46:24 zeev Exp $ */ /* {{{ includes */ @@ -378,46 +378,9 @@ /* }}} */ /* {{{ php_html_puts */ -#include "ext/standard/php_smart_str.h" - PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC) { - const char *estr; - smart_str s = {0}; - - for (estr = str + size; str < estr; str++) { - switch (*str) { - case '\n': - smart_str_appendl(&s, "<br />", sizeof("<br />")-1); - break; - case '<': - smart_str_appendl(&s, "<", sizeof("<")-1); - break; - case '>': - smart_str_appendl(&s, ">", sizeof(">")-1); - break; - case '&': - smart_str_appendl(&s, "&", sizeof("&")-1); - break; - -/* Commented out since this is not necessary */ -/* - case ' ': - smart_str_appendl(&s, " ", sizeof(" ")-1); - break; -*/ - case '\t': - smart_str_appendl(&s, " ", sizeof(" ")-1); - break; - default: - smart_str_appendc(&s, *str); - } - } - - if (s.c) { - PHPWRITE(s.c, s.len); - smart_str_free(&s); - } + zend_html_puts(str, size); } /* }}} */ @@ -505,8 +468,7 @@ if (prepend_string) { PUTS(prepend_string); } - php_printf(error_format, error_type_str, buffer, - error_filename, error_lineno); + php_printf(error_format, error_type_str, buffer, error_filename, error_lineno); if (PG(xmlrpc_errors)) { free_alloca(error_format); } @@ -694,9 +656,8 @@ */ static void sigchld_handler(int apar) { - while (waitpid(-1, NULL, WNOHANG) > 0) - ; - signal(SIGCHLD, sigchld_handler); + while (waitpid(-1, NULL, WNOHANG) > 0); + signal(SIGCHLD, sigchld_handler); } /* }}} */ #endif @@ -897,7 +858,7 @@ } } #else - php_os=PHP_OS; + php_os=PHP_OS; #endif #ifdef ZTS @@ -961,7 +922,7 @@ /* this will read in php.ini, set up the configuration parameters, load zend extensions and register php function extensions to be loaded later */ - if (php_init_config(sf->php_ini_path_override) == FAILURE) { + if (php_init_config() == FAILURE) { return FAILURE; } @@ -1022,7 +983,7 @@ theese are loaded after initialization of internal extensions as extensions *might* rely on things from ext/standard which is always an internal extension and to be initialized - ahead of all other internals + ahead of all other internals */ php_ini_delayed_modules_startup(TSRMLS_C); 1.5 +1 -7 php4/main/output.c Index: output.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/output.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- output.c 9 May 2002 05:39:43 -0000 1.4 +++ output.c 2 Aug 2002 22:05:25 -0000 1.5 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.102 2002/05/08 11:44:14 yohgaki Exp $ */ +/* $Id: output.c,v 1.103 2002/05/12 22:17:58 zeev Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -457,17 +457,11 @@ */ static int php_ub_body_write_no_header(const char *str, uint str_length TSRMLS_DC) { - char *newstr = NULL; - size_t new_length=0; int result; if (OG(disable_output)) { return 0; } - if (newstr) { - str = newstr; - str_length = new_length; - } result = OG(php_header_write)(str, str_length TSRMLS_CC); 1.3 +66 -30 php4/main/php_ini.c Index: php_ini.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_ini.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_ini.c 29 Apr 2002 02:33:38 -0000 1.2 +++ php_ini.c 2 Aug 2002 22:05:25 -0000 1.3 @@ -16,7 +16,10 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ini.c,v 1.85 2002/04/19 05:48:22 yohgaki Exp $ */ +/* $Id: php_ini.c,v 1.94 2002/05/12 14:48:20 sas Exp $ */ + +/* Check CWD for php.ini */ +#define INI_CHECK_CWD #include "php.h" #ifndef PHP_WIN32 @@ -199,9 +202,10 @@ /* {{{ php_init_config */ -int php_init_config(char *php_ini_path_override) +int php_init_config() { char *env_location, *php_ini_search_path; + char *binary_location; int safe_mode_state; char *open_basedir; int free_ini_search_path=0; @@ -222,42 +226,73 @@ if (!env_location) { env_location=""; } - if (php_ini_path_override) { - php_ini_search_path = php_ini_path_override; + if (sapi_module.php_ini_path_override) { + php_ini_search_path = sapi_module.php_ini_path_override; free_ini_search_path = 0; } else { char *default_location; - int free_default_location; + char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 }; + + php_ini_search_path = (char *) emalloc(MAXPATHLEN*3+strlen(env_location)+3+1); + free_ini_search_path = 1; + php_ini_search_path[0] = 0; + /* + * Prepare search path + */ + + /* Add cwd */ +#ifdef INI_CHECK_CWD + if (strcmp(sapi_module.name, "cli")!=0) { + strcat(php_ini_search_path, "."); + strcat(php_ini_search_path, paths_separator); + } +#endif + + /* Add binary directory */ #ifdef PHP_WIN32 - default_location = (char *) emalloc(512); - - if (!GetWindowsDirectory(default_location, 255)) { - default_location[0]=0; + binary_location = (char *) emalloc(MAXPATHLEN); + if (GetModuleFileName(0, binary_location, MAXPATHLEN)==0) { + efree(binary_location); + binary_location = NULL; } - free_default_location=1; #else - default_location = PHP_CONFIG_FILE_PATH; - free_default_location=0; -#endif - php_ini_search_path = (char *) emalloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1); - free_ini_search_path = 1; - if (strcmp(sapi_module.name, "cli")==0) { - if(env_location && env_location[0]) { - sprintf(php_ini_search_path, "%s%c%s", env_location, ZEND_PATHS_SEPARATOR, default_location); - } else { - sprintf(php_ini_search_path, "%s", default_location); - } + if (sapi_module.executable_location) { + binary_location = estrdup(sapi_module.executable_location); } else { - if(env_location && env_location[0]) { - sprintf(php_ini_search_path, ".%c%s%c%s", ZEND_PATHS_SEPARATOR, env_location, ZEND_PATHS_SEPARATOR, default_location); - } else { - sprintf(php_ini_search_path, ".%c%s", ZEND_PATHS_SEPARATOR, default_location); + binary_location = NULL; + } +#endif + if (binary_location) { + char *separator_location = strrchr(binary_location, DEFAULT_SLASH); + + if (separator_location) { + *(separator_location+1) = 0; } + strcat(php_ini_search_path, binary_location); + strcat(php_ini_search_path, paths_separator); + efree(binary_location); } - if (free_default_location) { - efree(default_location); + + /* Add environment location */ + if (env_location[0]) { + strcat(php_ini_search_path, env_location); + strcat(php_ini_search_path, paths_separator); } + + /* Add default location */ +#ifdef PHP_WIN32 + default_location = (char *) emalloc(MAXPATHLEN+1); + + if (!GetWindowsDirectory(default_location, MAXPATHLEN)) { + default_location[0]=0; + } + strcat(php_ini_search_path, default_location); + efree(default_location); +#else + default_location = PHP_CONFIG_FILE_PATH; + strcat(php_ini_search_path, default_location); +#endif } PG(safe_mode) = 0; @@ -265,11 +300,12 @@ fh.handle.fp = NULL; /* Check if php_ini_path_override is a file */ - if (php_ini_path_override && php_ini_path_override[0]) { + if (sapi_module.php_ini_path_override && sapi_module.php_ini_path_override[0]) { struct stat statbuf; - if (!VCWD_STAT(php_ini_path_override, &statbuf)) { + + if (!VCWD_STAT(sapi_module.php_ini_path_override, &statbuf)) { if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { - fh.handle.fp = VCWD_FOPEN(php_ini_path_override, "r"); + fh.handle.fp = VCWD_FOPEN(sapi_module.php_ini_path_override, "r"); } } } 1.3 +1 -1 php4/main/php_ini.h Index: php_ini.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_ini.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_ini.h 29 Apr 2002 02:33:38 -0000 1.2 +++ php_ini.h 2 Aug 2002 22:05:25 -0000 1.3 @@ -21,7 +21,7 @@ #include "zend_ini.h" -int php_init_config(char *php_ini_path_override); +int php_init_config(); int php_shutdown_config(void); void php_ini_delayed_modules_startup(TSRMLS_D); zval *cfg_get_entry(char *name, uint name_length); 1.3 +1 -1 php4/main/php_main.h Index: php_main.h =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_main.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_main.h 29 Apr 2002 02:33:38 -0000 1.2 +++ php_main.h 2 Aug 2002 22:05:25 -0000 1.3 @@ -18,7 +18,7 @@ */ -/* $Id: php_main.h,v 1.19 2002/03/04 18:46:55 sas Exp $ */ +/* $Id: php_main.h,v 1.21 2002/05/12 14:48:20 sas Exp $ */ #ifndef PHP_MAIN_H 1.3 +58 -29 php4/main/php_open_temporary_file.c Index: php_open_temporary_file.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/php_open_temporary_file.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_open_temporary_file.c 29 Apr 2002 02:33:38 -0000 1.2 +++ php_open_temporary_file.c 2 Aug 2002 22:05:25 -0000 1.3 @@ -87,7 +87,7 @@ * SUCH DAMAGE. */ -static FILE *php_do_open_temporary_file(char *path, const char *pfx, char **opened_path_p TSRMLS_DC) +static FILE *php_do_open_temporary_file(const char *path, const char *pfx, char **opened_path_p TSRMLS_DC) { char *trailing_slash; FILE *fp; @@ -141,6 +141,54 @@ } /* }}} */ +/* + * Determine where to place temporary files. + */ +const char* get_temporary_directory() +{ + /* Cache the chosen temporary directory. */ + static char* temporary_directory; + + /* Did we determine the temporary directory already? */ + if (temporary_directory) { + return temporary_directory; + } + +#ifdef PHP_WIN32 + /* We can't count on the environment variables TEMP or TMP, + * and so must make the Win32 API call to get the default + * directory for temporary files. Note this call checks + * the environment values TMP and TEMP (in order) first. + */ + { + char sTemp[MAX_PATH]; + DWORD n = GetTempPath(sizeof(sTemp),sTemp); + assert(0 < n); /* should *never* fail! */ + temporary_directory = strdup(sTemp); + return temporary_directory; + } +#else + /* On Unix use the (usual) TMPDIR environment variable. */ + { + char* s = getenv("TMPDIR"); + if (s) { + temporary_directory = strdup(s); + return temporary_directory; + } + } +#ifdef P_tmpdir + /* Use the standard default temporary directory. */ + if (P_tmpdir) { + temporary_directory = P_tmpdir; + return temporary_directory; + } +#endif + /* Shouldn't ever(!) end up here ... last ditch default. */ + temporary_directory = "/tmp"; + return temporary_directory; +#endif +} + /* {{{ php_open_temporary_file * * Unlike tempnam(), the supplied dir argument takes precedence @@ -150,47 +198,28 @@ */ PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC) { - static char path_tmp[] = "/tmp"; - FILE *fp; - - + FILE* fp = 0; + if (!pfx) { pfx = "tmp."; } - if (opened_path_p) { *opened_path_p = NULL; } - if ((fp=php_do_open_temporary_file((char *) dir, pfx, opened_path_p TSRMLS_CC))) { - return fp; - } - - if ((fp=php_do_open_temporary_file(getenv("TMPDIR"), pfx, opened_path_p TSRMLS_CC))) { - return fp; - } -#if PHP_WIN32 - { - char *TempPath; - - TempPath = (char *) emalloc(MAXPATHLEN); - if (GetTempPath(MAXPATHLEN, TempPath)) { - fp = php_do_open_temporary_file(TempPath, pfx, opened_path_p TSRMLS_CC); - } - efree(TempPath); - return fp; - } -#else - if ((fp=php_do_open_temporary_file(P_tmpdir, pfx, opened_path_p TSRMLS_CC))) { + /* Try the directory given as parameter. */ + fp = php_do_open_temporary_file(dir, pfx, opened_path_p TSRMLS_CC); + if (fp) { return fp; } - if ((fp=php_do_open_temporary_file(path_tmp, pfx, opened_path_p TSRMLS_CC))) { + /* Use default temporary directory. */ + fp = php_do_open_temporary_file(get_temporary_directory(), pfx, opened_path_p TSRMLS_CC); + if (fp) { return fp; } -#endif - return NULL; + return 0; } /* }}} */ 1.3 +6 -4 php4/main/rfc1867.c Index: rfc1867.c =================================================================== RCS file: /cvsroot/php-i18n/php4/main/rfc1867.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- rfc1867.c 29 Apr 2002 02:33:38 -0000 1.2 +++ rfc1867.c 2 Aug 2002 22:05:25 -0000 1.3 @@ -16,7 +16,7 @@ | Jani Taskinen <snipe****@php*****> | +----------------------------------------------------------------------+ */ -/* $Id: rfc1867.c,v 1.98 2002/04/23 00:14:08 sniper Exp $ */ +/* $Id: rfc1867.c,v 1.99 2002/05/11 11:58:16 zeev Exp $ */ /* * This product includes software developed by the Apache Group @@ -33,6 +33,8 @@ #include "rfc1867.h" +#undef DEBUG_FILE_UPLOAD + #define SAFE_RETURN { \ if (lbuf) efree(lbuf); \ if (abuf) efree(abuf); \ @@ -752,19 +754,19 @@ } fclose(fp); +#ifdef DEBUG_FILE_UPLOAD if(strlen(filename) > 0 && total_bytes == 0) { sapi_module.sapi_error(E_WARNING, "Uploaded file size 0 - file [%s=%s] not saved", param, filename); cancel_upload = UPLOAD_ERROR_E; } - - if (cancel_upload || total_bytes == 0) { +#endif + if (cancel_upload) { if (temp_filename) { unlink(temp_filename); efree(temp_filename); } temp_filename=""; - } else { zend_hash_add(SG(rfc1867_uploaded_files), temp_filename, strlen(temp_filename) + 1, &temp_filename, sizeof(char *), NULL); } 1.4 +63 -53 php4/pear/Makefile.frag Index: Makefile.frag =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Makefile.frag,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile.frag 9 May 2002 05:39:43 -0000 1.3 +++ Makefile.frag 2 Aug 2002 22:05:25 -0000 1.4 @@ -8,13 +8,13 @@ peardir=$(PEAR_INSTALLDIR) -PEAR_SUBDIRS = \ - Archive \ - Console \ - PEAR \ - PEAR/Command \ - PEAR/Frontend \ - XML +#PEAR_SUBDIRS = \ +# Archive \ +# Console \ +# PEAR \ +# PEAR/Command \ +# PEAR/Frontend \ +# XML # These are moving to /pear (in cvs): # Crypt \ @@ -28,30 +28,30 @@ # 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 +#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 \ @@ -95,31 +95,41 @@ # Net/Socket.php \ # Schedule/At.php \ -#PEARCMD=$(top_builddir)/sapi/cli/php $(builddir)/scripts/pear -# -#install-pear-installer: $(top_builddir)/sapi/cli/php -# version=`grep '<version>' $(srcdir)/package-pear.xml|head -1|cut -d\> -f2|cut -d\< -f1`; \ -# if $(PEARCMD) shell-test PEAR; then -# if ! $(PEARCMD) shell-test PEAR $$version; then \ -# $(PEARCMD) upgrade package-pear.xml; \ -# fi; \ -# else; \ -# $(PEARCMD) install package-pear.xml; \ -# fi +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 + +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: @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \ - for i in $(PEAR_SUBDIRS); do \ - $(mkinstalldirs) $(INSTALL_ROOT)$(peardir)/$$i; \ - done; \ - for i in $(PEAR_FILES); do \ - echo "Installing $$i"; \ - dir=`echo $$i|sed 's%[^/][^/]*$$%%'`; \ - $(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_ROOT)$(peardir)/$$dir; \ - done; \ - rm -f $(INSTALL_ROOT)$(peardir)/PEAR/Command/Login.php; \ - rm -f $(INSTALL_ROOT)$(peardir)/PEAR/CommandResponse.php; \ - rm -f $(INSTALL_ROOT)$(peardir)/PEAR/Uploader.php; \ + $(MAKE) install-pear-installer; \ + $(MAKE) install-pear-packages; \ else \ cat $(srcdir)/install-pear.txt; \ exit 5; \ 1.2 +53 -0 php4/pear/package-Archive_Tar.xml 1.2 +34 -0 php4/pear/package-Console_Getopt.xml 1.2 +103 -0 php4/pear/package-PEAR.xml 1.3 +49 -27 php4/pear/Archive/Tar.php Index: Tar.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Archive/Tar.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Tar.php 29 Apr 2002 02:33:39 -0000 1.2 +++ Tar.php 2 Aug 2002 22:05:25 -0000 1.3 @@ -16,7 +16,7 @@ // | Author: Vincent Blavet <vince****@blave*****> | // +----------------------------------------------------------------------+ // -// $Id: Tar.php,v 1.7 2002/04/13 05:33:35 mfischer Exp $ +// $Id: Tar.php,v 1.8 2002/05/09 13:00:12 vblavet Exp $ require_once 'PEAR.php'; @@ -24,7 +24,7 @@ * Creates a (compressed) Tar archive * * @author Vincent Blavet <vince****@blave*****> -* @version $Revision: 1.7 $ +* @version $Revision: 1.8 $ * @package Archive */ class Archive_Tar extends PEAR @@ -540,6 +540,10 @@ $v_result=true; $v_header = array(); + // ----- Remove potential windows directory separator + $p_add_dir = $this->_translateWinPath($p_add_dir); + $p_remove_dir = $this->_translateWinPath($p_remove_dir, false); + if (!$this->_file) { $this->_error('Invalid file descriptor'); return false; @@ -576,7 +580,7 @@ $p_hitem = readdir($p_hdir); // '..' directory while ($p_hitem = readdir($p_hdir)) { if ($v_filename != ".") - $p_temp_list[0] = $v_filename.DIRECTORY_SEPARATOR.$p_hitem; + $p_temp_list[0] = $v_filename.'/'.$p_hitem; else $p_temp_list[0] = $p_hitem; @@ -607,24 +611,28 @@ } // ----- Calculate the stored filename + $p_filename = $this->_translateWinPath($p_filename, false);; $v_stored_filename = $p_filename; if (strcmp($p_filename, $p_remove_dir) == 0) { return true; } if ($p_remove_dir != '') { - if (substr($p_remove_dir, -1) != DIRECTORY_SEPARATOR) - $p_remove_dir .= DIRECTORY_SEPARATOR; + if (substr($p_remove_dir, -1) != '/') + $p_remove_dir .= '/'; if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); } + $v_stored_filename = $this->_translateWinPath($v_stored_filename); if ($p_add_dir != '') { - if (substr($p_add_dir, -1) == DIRECTORY_SEPARATOR) + if (substr($p_add_dir, -1) == '/') $v_stored_filename = $p_add_dir.$v_stored_filename; else - $v_stored_filename = $p_add_dir.DIRECTORY_SEPARATOR.$v_stored_filename; + $v_stored_filename = $p_add_dir.'/'.$v_stored_filename; } + $v_stored_filename = $this->_pathReduction($v_stored_filename); + if (strlen($v_stored_filename) > 99) { $this->_warning("Stored file name is too long (max. 99) : '$v_stored_filename'"); fclose($v_file); @@ -811,18 +819,15 @@ $v_extract_all = true; $v_listing = false; - // ----- Look for removing the WINDOW '\' - if (OS_WINDOWS && strpos($p_path, '\\')) { - str_replace('\\', DIRECTORY_SEPARATOR, $p_path); - } - - if ($p_path == '' || (substr($p_path, 0, 1) != DIRECTORY_SEPARATOR && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) { + $p_path = $this->_translateWinPath($p_path, false); + if ($p_path == '' || (substr($p_path, 0, 1) != '/' && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) { $p_path = "./".$p_path; } + $p_remove_path = $this->_translateWinPath($p_remove_path); // ----- Look for path to remove format (should end by /) - if (($p_remove_path != '') && (substr($p_remove_path, -1) != DIRECTORY_SEPARATOR)) - $p_remove_path .= DIRECTORY_SEPARATOR; + if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/')) + $p_remove_path .= '/'; $p_remove_path_size = strlen($p_remove_path); switch ($p_mode) { @@ -867,7 +872,7 @@ for ($i=0; $i<sizeof($p_file_list); $i++) { // ----- Look if it is a directory - if (substr($p_file_list[$i], -1) == DIRECTORY_SEPARATOR) { + if (substr($p_file_list[$i], -1) == '/') { // ----- Look if the directory is in the filename path if ((strlen($v_header['filename']) > strlen($p_file_list[$i])) && (substr($v_header['filename'], 0, strlen($p_file_list[$i])) == $p_file_list[$i])) { $v_extract_file = TRUE; @@ -891,14 +896,14 @@ if (($p_remove_path != '') && (substr($v_header['filename'], 0, $p_remove_path_size) == $p_remove_path)) $v_header['filename'] = substr($v_header['filename'], $p_remove_path_size); - if (($p_path != "./") && ($p_path != DIRECTORY_SEPARATOR)) { - while (substr($p_path, -1) == DIRECTORY_SEPARATOR) + if (($p_path != './') && ($p_path != '/')) { + while (substr($p_path, -1) == '/') $p_path = substr($p_path, 0, strlen($p_path)-1); - if (substr($v_header['filename'], 0, 1) == DIRECTORY_SEPARATOR) + if (substr($v_header['filename'], 0, 1) == '/') $v_header['filename'] = $p_path.$v_header['filename']; else - $v_header['filename'] = $p_path.DIRECTORY_SEPARATOR.$v_header['filename']; + $v_header['filename'] = $p_path.'/'.$v_header['filename']; } if (file_exists($v_header['filename'])) { if ((@is_dir($v_header['filename'])) && ($v_header['typeflag'] == '')) { @@ -992,8 +997,8 @@ // ----- Log extracted files if (($v_file_dir = dirname($v_header['filename'])) == $v_header['filename']) $v_file_dir = ''; - if ((substr($v_header['filename'], 0, 1) == DIRECTORY_SEPARATOR) && ($v_file_dir == '')) - $v_file_dir = DIRECTORY_SEPARATOR; + if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == '')) + $v_file_dir = '/'; $p_list_detail[$v_nb++] = $v_header; } @@ -1097,7 +1102,7 @@ // ----- Look for not empty path if ($p_dir != '') { // ----- Explode path by directory names - $v_list = explode(DIRECTORY_SEPARATOR, $p_dir); + $v_list = explode('/', $p_dir); // ----- Study directories from last to first for ($i=sizeof($v_list)-1; $i>=0; $i--) { @@ -1112,16 +1117,33 @@ } else if (($v_list[$i] == '') && ($i!=(sizeof($v_list)-1)) && ($i!=0)) { // ----- Ignore only the double '//' in path, - // but not the first and last DIRECTORY_SEPARATOR + // but not the first and last / } else { - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?DIRECTORY_SEPARATOR.$v_result:''); + $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'.$v_result:''); } } } - $v_result = strtr($v_result, '\\', DIRECTORY_SEPARATOR); + $v_result = strtr($v_result, '\\', '/'); return $v_result; } // }}} + // {{{ _translateWinPath() + function _translateWinPath($p_path, $p_remove_disk_letter=true) + { + if (OS_WINDOWS) { + // ----- Look for potential disk letter + if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { + $p_path = substr($p_path, $v_position+1); + } + // ----- Change potential windows directory separator + if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { + $p_path = strtr($p_path, '\\', '/'); + } + } + return $p_path; + } + // }}} + } -?> +?> \ No newline at end of file 1.3 +13 -25 php4/pear/Console/Getopt.php Index: Getopt.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/Console/Getopt.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Getopt.php 29 Apr 2002 02:33:39 -0000 1.2 +++ Getopt.php 2 Aug 2002 22:05:25 -0000 1.3 @@ -13,17 +13,17 @@ // | obtain it through the world-wide-web, please send a note to | // | licen****@php***** so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ -// | Author: Andrei Zmievski <andre****@ispi*****> | +// | Author: Andrei Zmievski <andre****@php*****> | // +----------------------------------------------------------------------+ // -// $Id: Getopt.php,v 1.11 2002/02/28 08:27:06 sebastian Exp $ +// $Id: Getopt.php,v 1.14 2002/05/13 17:28:37 andrei Exp $ require_once 'PEAR.php'; /** * Command-line options parsing class. * - * @author Andrei Zmievski <andre****@ispi*****> + * @author Andrei Zmievski <andre****@php*****> * */ class Console_Getopt { @@ -89,9 +89,8 @@ } if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) { - $non_opts[] = $arg; - //$non_opts = array_merge($non_opts, array_slice($args, $i)); - //break; + $non_opts = array_merge($non_opts, array_slice($args, $i)); + break; } elseif (strlen($arg) > 1 && $arg{1} == '-') { $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args); if (PEAR::isError($error)) @@ -119,7 +118,7 @@ /* Try to find the short option in the specifier string. */ if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':') { - return new Getopt_Error("unrecognized option -- $opt\n"); + return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt"); } if (strlen($spec) > 1 && $spec{1} == ':') { @@ -139,7 +138,7 @@ } else if (list(, $opt_arg) = each($args)) /* Else use the next argument. */; else - return new Getopt_Error("option requires an argument -- $opt\n"); + return PEAR::raiseError("Console_Getopt: option requires an argument -- $opt"); } } @@ -171,7 +170,7 @@ if ($opt_rest != '' && $opt{0} != '=' && $i + 1 < count($long_options) && $opt == substr($long_options[$i+1], 0, $opt_len)) { - return new Getopt_Error("option --$opt is ambiguous\n"); + return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous"); } if (substr($long_opt, -1) == '=') { @@ -179,18 +178,18 @@ /* Long option requires an argument. Take the next argument if one wasn't specified. */; if (!$opt_arg && !(list(, $opt_arg) = each($args))) { - return new Getopt_Error("option --$opt requires an argument\n"); + return PEAR::raiseError("Console_Getopt: option --$opt requires an argument"); } } } else if ($opt_arg) { - return new Getopt_Error("option --$opt doesn't allow an argument\n"); + return PEAR::raiseError("Console_Getopt: option --$opt doesn't allow an argument"); } $opts[] = array('--' . $opt, $opt_arg); return; } - return new Getopt_Error("unrecognized option --$opt\n"); + return PEAR::raiseError("Console_Getopt: unrecognized option --$opt"); } /** @@ -204,9 +203,9 @@ { global $argv; if (!is_array($argv)) { - if (!is_array($_SERVER['argv'])) { + if (!@is_array($_SERVER['argv'])) { if (!is_array($HTTP_SERVER_VARS['argv'])) { - return new Getopt_Error("Could not read cmd args (register_argc_argv=Off?)\n"); + return PEAR::raiseError("Console_Getopt: Could not read cmd args (register_argc_argv=Off?)"); } return $HTTP_SERVER_VARS['argv']; } @@ -215,17 +214,6 @@ return $argv; } -} - - -class Getopt_Error extends PEAR_Error { - var $classname = 'Getopt'; - var $error_message_prepend = 'Error in Getopt'; - - function Getopt_Error($message, $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) - { - $this->PEAR_Error($message, $code, $mode, $level); - } } ?> 1.4 +62 -47 php4/pear/PEAR/Command.php Index: Command.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Command.php 9 May 2002 05:39:43 -0000 1.3 +++ Command.php 2 Aug 2002 22:05:25 -0000 1.4 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Command.php,v 1.11 2002/05/09 02:31:36 ssb Exp $ +// $Id: Command.php,v 1.12 2002/05/12 21:09:03 ssb Exp $ require_once "PEAR.php"; @@ -28,6 +28,12 @@ $GLOBALS['_PEAR_Command_commandlist'] = array(); /** + * Array of command objects + * @var array class => object + */ +$GLOBALS['_PEAR_Command_objects'] = array(); + +/** * Which user interface class is being used. * @var string class name */ @@ -40,12 +46,6 @@ $GLOBALS['_PEAR_Command_uiobject'] = null; /** -* The options accepted by the commands -* @var string the options -*/ -$GLOBALS['_PEAR_Command_commandopts'] = ''; - -/** * PEAR command class, a simple factory class for administrative * commands. * @@ -81,8 +81,8 @@ * - DON'T OUTPUT ANYTHING! Return text for output instead. * * - 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. + * web and command-line interfaces, so for now, keep everything to + * plain text. There may be a common (XML) markup format later. * * - DON'T USE EXIT OR DIE! Always use pear errors. From static * classes do PEAR::raiseError(), from other classes do @@ -93,8 +93,8 @@ /** * Get the right object for executing a command. * - * @param object Instance of PEAR_Config object - * @param string The name of the command + * @param string $command The name of the command + * @param object $config Instance of PEAR_Config object * * @return object the command object or a PEAR error * @@ -105,12 +105,13 @@ if (empty($GLOBALS['_PEAR_Command_commandlist'])) { PEAR_Command::registerCommands(); } - if (isset($GLOBALS['_PEAR_Command_commandlist'][$command])) { - $class = $GLOBALS['_PEAR_Command_commandlist'][$command]; - $obj = &new $class(PEAR_Command::getFrontendObject(), $config); - return $obj; + $class = @$GLOBALS['_PEAR_Command_commandlist'][$command]; + if (empty($class)) { + return PEAR::raiseError("unknown command `$command'"); } - return PEAR::raiseError("unknown command `$command'"); + $ui = PEAR_Command::getFrontendObject(); + $obj = &new $class($ui, $config); + return $obj; } /** @@ -120,34 +121,44 @@ */ function &getFrontendObject() { - global $_PEAR_Command_uiclass, $_PEAR_Command_uiobject; - if (empty($_PEAR_Command_uiobject)) { - $_PEAR_Command_uiobject = &new $_PEAR_Command_uiclass; + if (empty($GLOBALS['_PEAR_Command_uiobject'])) { + $GLOBALS['_PEAR_Command_uiobject'] = &new $GLOBALS['_PEAR_Command_uiclass']; } - return $_PEAR_Command_uiobject; + return $GLOBALS['_PEAR_Command_uiobject']; } /** * Load current frontend class. * - * @param string Name of the frontend + * @param string $uiclass Name of class implementing the frontend * - * @return boolean TRUE if the frontend exists, otherwise FALSE. + * @return object the frontend object, or a PEAR error */ - function setFrontendClass($uiclass) + function &setFrontendClass($uiclass) { - $GLOBALS['_PEAR_Command_uiclass'] = $uiclass; - $file = str_replace("_", "/", $uiclass) . '.php'; - include_once $file; - return class_exists(strtolower($uiclass)); + $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')) { + $GLOBALS['_PEAR_Command_uiobject'] = &$obj; + $GLOBALS['_PEAR_Command_uiclass'] = $uiclass; + return $obj; + } else { + return PEAR::raiseError("not a frontend class: $uiclass"); + } + } + return PEAR::raiseError("no such class: $uiclass"); } /** * Set current frontend. * - * @param string Name of the frontend type + * @param string $uitype Name of the frontend type (for example "CLI") * - * @return boolean TRUE if the frontend exists, otherwise FALSE. + * @return object the frontend object, or a PEAR error */ function setFrontendType($uitype) { @@ -179,32 +190,28 @@ } $dp = @opendir($dir); if (empty($dp)) { - return PEAR::raiseError("PEAR_Command::registerCommands: ". - "opendir($dir) failed"); + return PEAR::raiseError("registerCommands: opendir($dir) failed"); } if (!$merge) { $GLOBALS['_PEAR_Command_commandlist'] = array(); } - $cmdopts = array(); while ($entry = readdir($dp)) { - if ($entry{0} == '.' || substr($entry, -4) != '.php' || - $entry == 'Common.php') - { + if ($entry{0} == '.' || substr($entry, -4) != '.php' || $entry == 'Common.php') { continue; } $class = "PEAR_Command_".substr($entry, 0, -4); $file = "$dir/$entry"; include_once $file; // List of commands - $implements = call_user_func(array($class, "getCommands")); + if (empty($GLOBALS['_PEAR_Command_objects'][$class])) { + $GLOBALS['_PEAR_Command_objects'][$class] = &new $class($ui, $config); + } + $implements = $GLOBALS['_PEAR_Command_objects'][$class]->getCommands(); foreach ($implements as $command => $desc) { $GLOBALS['_PEAR_Command_commandlist'][$command] = $class; $GLOBALS['_PEAR_Command_commanddesc'][$command] = $desc; } - // List of options accepted - $cmdopts = array_merge($cmdopts, call_user_func(array($class, "getOptions"))); } - $GLOBALS['_PEAR_Command_commandopts'] = implode('', $cmdopts); return true; } @@ -225,19 +232,27 @@ } /** - * Get the list of currently supported options, and what - * classes implement them. + * Compiles arguments for getopt. * - * @return array array option => implementing class + * @param string $command command to get optstring for + * @param string $short_args (reference) short getopt format + * @param array $long_args (reference) long getopt format + * + * @return void * * @access public */ - function getOptions() + function getGetoptArgs($command, &$short_args, &$long_args) { if (empty($GLOBALS['_PEAR_Command_commandlist'])) { PEAR_Command::registerCommands(); } - return $GLOBALS['_PEAR_Command_commandopts']; + $class = @$GLOBALS['_PEAR_Command_commandlist'][$command]; + if (empty($class)) { + return null; + } + $obj = &$GLOBALS['_PEAR_Command_objects'][$class]; + return $obj->getGetoptArgs($command, $short_args, $long_args); } /** @@ -257,8 +272,7 @@ /** * Get help for command. * - * @param string Name of the command for which help should be - * called. + * @param string $command Name of the command to return help for * * @access public */ @@ -266,7 +280,8 @@ { $cmds = PEAR_Command::getCommands(); if (isset($cmds[$command])) { - return call_user_func(array($cmds[$command], 'getHelp'), $command); + $class = $cmds[$command]; + return $GLOBALS['_PEAR_Command_objects'][$class]->getHelp($command); } return false; } 1.4 +5 -1 php4/pear/PEAR/Common.php Index: Common.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Common.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Common.php 30 Apr 2002 08:15:07 -0000 1.3 +++ Common.php 2 Aug 2002 22:05:25 -0000 1.4 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox****@idecn*****> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.57 2002/04/29 06:23:05 ssb Exp $ +// $Id: Common.php,v 1.58 2002/05/15 11:23:01 cox Exp $ require_once 'PEAR.php'; require_once 'Archive/Tar.php'; @@ -1395,6 +1395,10 @@ while (trim($line = fgets($fp, 1024))) { if (preg_match('/^([^:]+):\s+(.*)\s*$/', $line, $matches)) { $headers[strtolower($matches[1])] = trim($matches[2]); + } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) { + if ($matches[1] != 200) { + return PEAR::raiseError("File http://$host:$port$path not valid (received: $line)"); + } } } if (isset($headers['content-disposition']) && 1.4 +5 -2 php4/pear/PEAR/Config.php Index: Config.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Config.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Config.php 9 May 2002 05:39:43 -0000 1.3 +++ Config.php 2 Aug 2002 22:05:25 -0000 1.4 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.18 2002/05/02 23:56:44 ssb Exp $ +// $Id: Config.php,v 1.19 2002/05/14 17:59:41 cox Exp $ require_once 'PEAR.php'; @@ -341,7 +341,10 @@ } $data = $this->configuration[$layer]; $this->_encodeOutput($data); - if (@file_exists($file) && !@is_writeable($file)) { + if (!@System::mkDir("-p " . dirname($file))) { + return $this->raiseError("could not create directory: " . dirname($file)); + } + if (@is_file($file) && !@is_writeable($file)) { return $this->raiseError("no write access to $file!"); } $fp = @fopen($file, "w"); 1.3 +25 -14 php4/pear/PEAR/Dependency.php Index: Dependency.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Dependency.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Dependency.php 29 Apr 2002 02:33:42 -0000 1.2 +++ Dependency.php 2 Aug 2002 22:05:25 -0000 1.3 @@ -17,7 +17,7 @@ // | Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Dependency.php,v 1.6 2002/04/09 14:12:12 cox Exp $ +// $Id: Dependency.php,v 1.8 2002/05/12 14:53:54 ssb Exp $ /** * Methods for dependencies check. Based on Stig's dependencies RFC @@ -75,7 +75,7 @@ return $this->checkSAPI($name); break; default: - return "'{$opts['type']}' dependencie type not supported"; + return "'{$opts['type']}' dependency type not supported"; } } @@ -90,19 +90,30 @@ */ function checkPackage($name, $req = null, $relation = 'has') { - if (!$this->registry->packageExists($name)) { - return "'$name' PEAR package is not installed"; + switch ($relation) { + case 'has': + if (!$this->registry->packageExists($name)) { + return "requires package `$name'"; + } + return false; + case 'not': + if (!$this->registry->packageExists($name)) { + return "conflicts with package `$name'"; + } + return false; + case 'lt': + case 'le': + case 'eq': + case 'ne': + case 'ge': + case 'gt': + $version = $this->registry->packageInfo($name, 'version'); + if (!version_compare($version, $req, $relation)) { + return "requires package `$name' " . + $this->signOperator($relation) . " $req"; + } } - if (substr($relation, 0, 2) == 'v.') { - $pkg_ver = $this->registry->packageInfo($name, 'version'); - $operator = substr($relation, 2); - if (!version_compare($pkg_ver, $req, $operator)) { - return "'$name' PEAR package version " . - $this->signOperator($operator) . " $req is required"; - } - return false; - } - return "Relation '$relation' with requirement '$req' is not supported"; + return "Relation '$relation' with requirement '$req' is not supported (name=$name)"; } /** 1.5 +23 -7 php4/pear/PEAR/Installer.php Index: Installer.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Installer.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Installer.php 9 May 2002 05:39:43 -0000 1.4 +++ Installer.php 2 Aug 2002 22:05:25 -0000 1.5 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox****@idecn*****> | // +----------------------------------------------------------------------+ // -// $Id: Installer.php,v 1.54 2002/05/03 00:01:54 ssb Exp $ +// $Id: Installer.php,v 1.56 2002/05/19 06:19:26 ssb Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Registry.php'; @@ -139,6 +139,19 @@ function _installFile($file, $atts, $tmp_path) { + static $os; + if (isset($atts['platform'])) { + if (empty($os)) { + include_once "OS/Guess.php"; + $os = new OS_Guess(); + } + // 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; + } + } + switch ($atts['role']) { case 'test': case 'data': case 'ext': // don't install test files for now @@ -271,13 +284,13 @@ * * @param $pkgfile path to the package file * - * @return bool true if successful, false if not + * @return array package info if successful, null if not */ function install($pkgfile, $options = array()) { // recognized options: - // - register_only : update registry but don't install files + // - register-only : update registry but don't install files // - upgrade : upgrade existing install // - soft : fail silently // @@ -379,7 +392,7 @@ if (empty($options['soft'])) { $this->log(0, $error); } - return $this->raiseError('Dependencies failed'); + return $this->raiseError("$pkgname: dependencies failed"); } } @@ -399,7 +412,7 @@ 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'])) { + if (empty($options['register-only'])) { // when upgrading, remove old release's files first: if (PEAR::isError($err = $this->_deletePackageFiles($pkgname))) { return $this->raiseError($err); @@ -411,7 +424,7 @@ // info from the package it self we want to access from _installFile $this->pkginfo = $pkginfo; - if (empty($options['register_only'])) { + if (empty($options['register-only'])) { if (!is_dir($this->config->get('php_dir'))) { return $this->raiseError("no script destination directory\n", null, PEAR_ERROR_DIE); @@ -446,7 +459,10 @@ } else { $ret = $this->registry->updatePackage($pkgname, $this->pkginfo, false); } - return $ret; + if (!$ret) { + return null; + } + return $pkginfo; } // }}} 1.4 +91 -4 php4/pear/PEAR/Remote.php Index: Remote.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Remote.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Remote.php 30 Apr 2002 08:15:07 -0000 1.3 +++ Remote.php 2 Aug 2002 22:05:25 -0000 1.4 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.18 2002/04/28 07:34:46 ssb Exp $ +// $Id: Remote.php,v 1.19 2002/05/14 01:51:06 ssb Exp $ require_once 'PEAR.php'; require_once 'PEAR/Config.php'; @@ -51,10 +51,29 @@ $args = func_get_args(); return call_user_func_array(array(&$this, 'call_epi'), $args); } - if (!include_once("XML/RPC.php")) { - return $this->raiseError("XML_RPC package not installed"); + if (!@include_once("XML/RPC.php")) { + return $this->raiseError("For this remote PEAR operation you need to install the XML_RPC package"); } - return $this->raiseError("XML_RPC fallback not yet implemented"); + $args = func_get_args(); + array_shift($args); + $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)); + $c = new XML_RPC_Client('/xmlrpc.php', $server_host, 80); + if ($username && $password) { + $c->setCredentials($username, $password); + } + $c->setDebug(1); + $r = $c->send($f); + if (!$r) { + return $this->raiseError("XML_RPC send failed"); + } + $v = $r->value(); + if ($e = $r->faultCode()) { + return $this->raiseError($r->faultString(), $e); + } + return XML_RPC_decode($v); } // }}} @@ -166,6 +185,74 @@ } // }}} + + // {{{ _encode + + // a slightly extended version of XML_RPC_encode + function _encode($php_val) + { + 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; + + switch($type) { + case "array": + reset($php_val); + $firstkey = key($php_val); + end($php_val); + $lastkey = key($php_val); + if ($firstkey === 0 && is_int($lastkey) && + ($lastkey + 1) == count($php_val)) { + $is_continous = true; + reset($php_val); + for ($expect = 0; $expect < count($php_val); $expect++) { + if (key($php_val) !== $expect) { + $is_continous = false; + break; + } + } + if ($is_continous) { + reset($php_val); + $arr = array(); + while (list($k, $v) = each($php_val)) { + $arr[$k] = $this->_encode($v); + } + $xmlrpcval->addArray($arr); + break; + } + } + // fall though if not numerical and continous + case "object": + $arr = array(); + while (list($k, $v) = each($php_val)) { + $arr[$k] = $this->_encode($v); + } + $xmlrpcval->addStruct($arr); + break; + case "integer": + $xmlrpcval->addScalar($php_val, $XML_RPC_Int); + break; + case "double": + $xmlrpcval->addScalar($php_val, $XML_RPC_Double); + break; + case "string": + case "NULL": + $xmlrpcval->addScalar($php_val, $XML_RPC_String); + break; + case "boolean": + $xmlrpcval->addScalar($php_val, $XML_RPC_Boolean); + break; + case "unknown type": + default: + return null; + } + return $xmlrpcval; + } + + // }}} + } ?> 1.4 +66 -68 php4/pear/PEAR/Command/Auth.php Index: Auth.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Auth.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Auth.php 9 May 2002 05:39:43 -0000 1.3 +++ Auth.php 2 Aug 2002 22:05:25 -0000 1.4 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Auth.php,v 1.5 2002/05/09 02:31:36 ssb Exp $ +// $Id: Auth.php,v 1.7 2002/05/14 12:34:49 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Remote.php"; @@ -28,7 +28,30 @@ */ class PEAR_Command_Auth extends PEAR_Command_Common { - // {{{ constructor + var $commands = array( + 'login' => array( + 'summary' => 'Connects and authenticates to remote server', + '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. +', + ), + 'logout' => array( + 'summary' => 'Logs out from the remote server', + '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. +', + ) + + ); /** * PEAR_Command_Auth constructor. @@ -40,94 +63,69 @@ parent::PEAR_Command_Common($ui, $config); } - // }}} - - // {{{ getCommands() - /** - * Return a list of all the commands defined by this class. - * @return array list of commands + * Execute the 'login' command. + * + * @param string $command command name + * + * @param array $options option_name => value + * + * @param array $params list of additional parameters + * + * @return bool TRUE on success, FALSE for unknown commands, or + * a PEAR error on failure + * * @access public */ - function getCommands() + function doLogin($command, $options, $params) { - return array('login' => 'Log In', - 'logout' => 'Log Out'); - } - - // }}} + $server = $this->config->get('master_server'); + $remote = new PEAR_Remote($this->config); + $username = $this->config->get('username'); + if (empty($username)) { + $username = @$_ENV['USER']; + } + $this->ui->displayLine("Logging in to $server."); + $username = trim($this->ui->userDialog('Username', 'text', $username)); - function getHelp($command) - { - switch ($command) { - case 'login': - return array(null, 'Connects to the remote server'); - case 'logout': - return array(null, 'Disconnects from the remote server'); + $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->config->store(); + } else { + $this->ui->displayLine("Login failed!"); } + } - // {{{ run() /** - * Execute the command. + * Execute the 'logout' command. * - * @param string command name + * @param string $command command name * - * @param array option_name => value + * @param array $options option_name => value * - * @param array list of additional parameters + * @param array $params 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) + function doLogout($command, $options, $params) { - $failmsg = ''; $server = $this->config->get('master_server'); - switch ($command) { - case 'login': { - $remote = new PEAR_Remote($this->config); - $username = $this->config->get('username'); - if (empty($username)) { - $username = @$_ENV['USER']; - } - $this->ui->displayLine("Logging in to $server."); - $username = trim($this->ui->userDialog('Username', 'text', $username)); - - $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->config->store(); - } else { - $this->ui->displayLine("Login failed!"); - } - break; - } - case 'logout': { - $this->ui->displayLine("Logging out from $server."); - $this->config->remove('username'); - $this->config->remove('password'); - $this->config->store(); - break; - } - default: { - return false; - } - } - if ($failmsg) { - return $this->raiseError($failmsg); - } - return true; + $this->ui->displayLine("Logging out from $server."); + $this->config->remove('username'); + $this->config->remove('password'); + $this->config->store(); } - // }}} } ?> 1.3 +80 -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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Common.php 29 Apr 2002 02:33:42 -0000 1.2 +++ Common.php 2 Aug 2002 22:05:25 -0000 1.3 @@ -13,15 +13,17 @@ // | 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*****> | +// | Author: Stig S〓ther Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.9 2002/04/09 08:18:49 ssb Exp $ +// $Id: Common.php,v 1.11 2002/05/14 01:48:20 ssb Exp $ require_once "PEAR.php"; class PEAR_Command_Common extends PEAR { + // {{{ properties + /** * PEAR_Config object used to pass user system and configuration * on when executing commands @@ -36,6 +38,9 @@ */ var $ui; + // }}} + // {{{ constructor + /** * PEAR_Command_Common constructor. * @@ -48,15 +53,85 @@ $this->ui = &$ui; } - function getOptions() + // }}} + + // {{{ getCommands() + + /** + * Return a list of all the commands defined by this class. + * @return array list of commands + * @access public + */ + function getCommands() + { + $ret = array(); + foreach (array_keys($this->commands) as $command) { + $ret[$command] = $this->commands[$command]['summary']; + } + return $ret; + } + + // }}} + // {{{ getOptions() + + function getOptions($command) { - return array(); + return @$this->commands[$command]['options']; } + // }}} + // {{{ getGetoptArgs() + + function getGetoptArgs($command, &$short_args, &$long_args) + { + $short_args = ""; + $long_args = array(); + if (empty($this->commands[$command])) { + return; + } + reset($this->commands[$command]); + while (list($option, $info) = each($this->commands[$command]['options'])) { + $larg = $sarg = ''; + if (isset($info['arg'])) { + if ($info['arg']{0} == '(') { + $larg = '=='; + $sarg = '::'; + $arg = substr($info['arg'], 1, -1); + } else { + $larg = '='; + $sarg = ':'; + $arg = $info['arg']; + } + } + if (isset($info['shortopt'])) { + $short_args .= $info['shortopt'] . $sarg; + } + $long_args[] = $option . $larg; + } + } + + // }}} + // {{{ getHelp() + function getHelp($command) { - return array(null, 'No help avaible yet'); + $help = preg_replace('/{config\s+([^\}]+)}/e', "\$config->get('\1')", @$this->commands[$command]['doc']); + return $help; } + + // }}} + // {{{ run() + + function run($command, $options, $params) + { + $func = @$this->commands[$command]['function']; + if (empty($func)) { + return $this->raiseError("unknown command `$command'"); + } + return $this->$func($command, $options, $params); + } + + // }}} } ?> 1.4 +38 -52 php4/pear/PEAR/Command/Config.php Index: Config.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Config.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Config.php 9 May 2002 05:39:43 -0000 1.3 +++ Config.php 2 Aug 2002 22:05:25 -0000 1.4 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.9 2002/05/09 02:31:36 ssb Exp $ +// $Id: Config.php,v 1.10 2002/05/14 12:46:17 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -29,10 +29,38 @@ */ class PEAR_Command_Config extends PEAR_Command_Common { - // {{{ properties - // }}} - - // {{{ constructor + var $commands = array( + 'config-show' => array( + 'summary' => 'Show All Settings', + 'options' => array(), + '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', + 'options' => array(), + 'doc' => 'Displays the value of one configuration parameter. The +first argument is the name of the parameter, an optional second argument +may be used to tell which configuration layer to look in. Valid configuration +layers are "user", "system" and "default". If no layer is specified, a value +will be picked from the first layer that defines the parameter, in the order +just specified. +', + ), + 'config-set' => array( + 'summary' => 'Change Setting', + '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. +Some parameters are be subject to validation, and the command will fail with +an error message if the new value does not make sense. An optional third +argument may be used to specify which layer to set the configuration parameter +in. The default layer is "user". +', + ), + ); /** * PEAR_Command_Config constructor. @@ -44,46 +72,6 @@ parent::PEAR_Command_Common($ui, $config); } - // }}} - - // {{{ getCommands() - - /** - * Return a list of all the commands defined by this class. - * @return array list of commands - * @access public - */ - function getCommands() - { - return array('config-show' => 'Show All Settings', - 'config-get' => 'Show One Setting', - 'config-set' => 'Change Setting'); - } - - // }}} - - function getHelp($command) - { - switch ($command) { - case 'config-show': - $ret = array('[<layer>]', 'Displays the configuration'); - break; - case 'config-get': - $ret = array('<parameter> [<layer>]', - 'Displays the value of the given parameter'); - break; - case 'config-set': - $ret = array('<parameter> <value> [<layer>]', - 'Sets the value of a parameter in the config'); - break; - } - $ret[1] .= "\n". - " <layer> Where to store/get the configuration. The installer\n". - " supports 'user' (per user conf) and 'system' (global conf)"; - return $ret; - } - // {{{ run() - function run($command, $options, $params) { $cf = &$this->config; @@ -159,14 +147,12 @@ return true; } - // }}} - /** - * Checks if a layer is defined or not - * - * @param string $layer The layer to search for - * @return mixed False on no error or the error message - */ + * Checks if a layer is defined or not + * + * @param string $layer The layer to search for + * @return mixed False on no error or the error message + */ function _checkLayer($layer = null) { if (!empty($layer)) { 1.5 +130 -71 php4/pear/PEAR/Command/Install.php Index: Install.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Install.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Install.php 9 May 2002 05:39:43 -0000 1.4 +++ Install.php 2 Aug 2002 22:05:25 -0000 1.5 @@ -13,13 +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*****> | +// | Author: Stig S〓ther Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Install.php,v 1.21 2002/05/09 02:31:36 ssb Exp $ +// $Id: Install.php,v 1.25 2002/05/14 01:49:18 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Installer.php"; +require_once "Console/Getopt.php"; /** * PEAR commands for installation or deinstallation/upgrading of @@ -28,6 +29,109 @@ */ class PEAR_Command_Install extends PEAR_Command_Common { + // {{{ command definitions + + var $commands = array( + 'install' => array( + 'summary' => 'Install Package', + 'function' => 'doInstall', + 'options' => array( + 'force' => array( + 'shortopt' => 'f', + 'doc' => 'will overwrite newer installed packages', + ), + 'nodeps' => array( + 'shortopt' => 'n', + 'doc' => 'ignore dependencies, install anyway', + ), + 'register-only' => array( + 'shortopt' => 'r', + 'doc' => 'do not install files, only register the package as installed', + ), + 'soft' => array( + 'shortopt' => 's', + 'doc' => 'soft install, fail silently, or upgrade if already installed', + ), + 'nocompress' => array( + 'shortopt' => 'Z', + 'doc' => 'request uncompressed files when downloading', + ), + ), + 'doc' => '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 + +"http://example.com/Package-1.0.tgz" : installs from +anywhere on the net. + +"package.xml" : installs the package described in +package.xml. Useful for testing, or for wrapping a PEAR package in +another package manager such as RPM. + +"Package" : queries your configured server +({config master_server}) and downloads the newest package with +the preferred quality/state ({config preferred_state}). + +More than one package may be specified at once. It is ok to mix these +four ways of specifying packages. +'), + 'upgrade' => array( + 'summary' => 'Upgrade Package', + 'function' => 'doInstall', + 'options' => array( + 'force' => array( + 'shortopt' => 'f', + 'doc' => 'overwrite newer installed packages', + ), + 'nodeps' => array( + 'shortopt' => 'n', + 'doc' => 'ignore dependencies, upgrade anyway', + ), + 'register-only' => array( + 'shortopt' => 'r', + 'doc' => 'do not install files, only register the package as upgraded', + ), + 'nocompress' => array( + 'shortopt' => 'Z', + 'request uncompressed files when downloading', + ), + ), + '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. +'), + 'uninstall' => array( + 'summary' => 'Un-install Package', + 'function' => 'doUninstall', + 'options' => array( + 'nodeps' => array( + 'shortopt' => 'n', + 'doc' => 'ignore dependencies, uninstall anyway', + ), + 'register-only' => array( + 'shortopt' => 'r', + '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. +'), + + ); + + // }}} // {{{ constructor /** @@ -51,93 +155,48 @@ */ function getCommands() { - return array('install' => 'Install Package', - 'uninstall' => 'Uninstall Package', - 'upgrade' => 'Upgrade Package'); - } - - function getHelp($command) - { - switch ($command) { - case 'install': - $ret = array('<pear package>', - 'Installs a PEAR package created by the "package" command'); - break; - case 'uninstall': - $ret = array('<package>', - 'Uninstalls a previously installed PEAR package'); - break; - case 'upgrade': - $ret = array('<pear package>', - 'Upgrades a PEAR package installed in the system'); - break; + $ret = array(); + foreach (array_keys($this->commands) as $command) { + $ret[$command] = $this->commands[$command]['summary']; } - $ret[0] = "[-n] [-f] [-s] [-Z] {$ret[0]}"; - $ret[1] = "{$ret[1]}\n" . - " -f forces the installation of the package\n". - " when it is already installed\n". - " -n do not take care of package dependencies\n". - " -r only (un)register package, do not (un)install files\n". - " -s soft update: install or upgrade only if needed\n". - " -Z no compression: download plain .tar files"; return $ret; } // }}} - // {{{ getOptions() - - function getOptions() - { - return array('f', 'n', 'r', 's', 'Z'); - } - - // }}} // {{{ run() function run($command, $options, $params) { - $installer = &new PEAR_Installer($this->ui); - + $this->installer = &new PEAR_Installer($ui); +// return parent::run($command, $options, $params); $failmsg = ''; - $opts = array(); - if (isset($options['f'])) { - $opts['force'] = true; - } - if (isset($options['n'])) { - $opts['nodeps'] = true; - } - if (isset($options['r'])) { - $opts['register_only'] = true; - } - if (isset($options['s'])) { - $opts['soft'] = true; - } - if (isset($options['Z'])) { - $opts['nocompress'] = true; - } switch ($command) { case 'upgrade': - $opts['upgrade'] = true; + $options['upgrade'] = true; // fall through - case 'install': { - if ($installer->install(@$params[0], $opts, $this->config)) { - $this->ui->displayLine("install ok"); - } else { - $failmsg = "install failed"; + 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': { - if ($installer->uninstall($params[0], $options)) { - $this->ui->displayLine("uninstall ok"); - } else { - $failmsg = "uninstall failed"; + case 'uninstall': + foreach ($params as $pkg) { + if ($this->installer->uninstall($pkg, $options)) { + $this->ui->displayLine("uninstall ok"); + } else { + $failmsg = "uninstall failed"; + } } break; - } - default: { + default: return false; - } } if ($failmsg) { return $this->raiseError($failmsg); 1.4 +314 -252 php4/pear/PEAR/Command/Package.php Index: Package.php =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Package.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Package.php 9 May 2002 05:39:43 -0000 1.3 +++ Package.php 2 Aug 2002 22:05:25 -0000 1.4 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb****@fast*****> | // +----------------------------------------------------------------------+ // -// $Id: Package.php,v 1.22 2002/05/09 02:31:36 ssb Exp $ +// $Id: Package.php,v 1.24 2002/05/19 06:48:40 ssb Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Packager.php'; @@ -24,7 +24,58 @@ class PEAR_Command_Package extends PEAR_Command_Common { - // {{{ constructor + var $commands = array( + 'package' => array( + 'summary' => 'Build Package', + 'function' => 'doPackage', + 'options' => array( + 'nocompress' => array( + 'shortopt' => 'Z', + 'doc' => 'Do not gzip the package file' + ), + '???' => array( + 'shortopt' => 'n', + 'doc' => 'Return only the created package file name. Useful for +shell script operations. +', + ), + ), + 'doc' => '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', + 'options' => array(), + 'doc' => '', + ), + 'cvstag' => array( + 'summary' => 'Set CVS Release Tag', + 'function' => 'doCvsTag', + 'options' => array(), + 'doc' => '', + ), + 'run-tests' => array( + 'summary' => 'Run Regression Tests', + 'function' => 'doRunTests', + 'options' => array(), + 'doc' => '', + ), + ); /** * PEAR_Command_Package constructor. @@ -36,10 +87,6 @@ parent::PEAR_Command_Common($ui, $config); } - // }}} - - // {{{ _displayValidationResults() - function _displayValidationResults($err, $warn, $strict = false) { foreach ($err as $e) { @@ -57,9 +104,6 @@ return true; } - // }}} - // {{{ getCommands() - /** * Return a list of all the commands defined by this class. * @return array list of commands @@ -71,10 +115,10 @@ 'package-info' => 'Show Package Info', 'package-list' => 'List Files in Package', 'package-validate' => 'Validate Package', - 'cvstag' => 'Set CVS Release Tag'); + 'cvstag' => 'Set CVS Release Tag', + 'run-tests' => 'Run Regression Tests'); } - // }}} // {{{ getOptions() function getOptions() @@ -131,277 +175,295 @@ { $failmsg = ''; switch ($command) { - // {{{ package - - case 'package': { - $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml'; - ob_start(); - $packager =& new PEAR_Packager($this->config->get('php_dir'), - $this->config->get('ext_dir'), - $this->config->get('doc_dir')); - $packager->debug = $this->config->get('verbose'); - $err = $warn = array(); - $packager->validatePackageInfo($pkginfofile, $err, $warn); - if (!$this->_displayValidationResults($err, $warn, true)) { - break; - } - $compress = empty($options['Z']) ? true : false; - $result = $packager->Package($pkginfofile, $compress); - $output = ob_get_contents(); - ob_end_clean(); - if (PEAR::isError($result)) { - $failmsg = $result; - } - // Don't want output, only the package file name just created - if (isset($options['n'])) { - $this->ui->displayLine($result); - return; - } - $lines = explode("\n", $output); - foreach ($lines as $line) { - $this->ui->displayLine($line); - } - if (PEAR::isError($result)) { - $this->ui->displayLine("Package failed: ".$result->getMessage()); - } + case 'package': + case 'package-list': + case 'package-info': + case 'package-validate': break; + // {{{ cvstag + + case 'cvstag': { } // }}} - // {{{ package-list + // {{{ run-tests - case 'package-list': { - // $params[0] -> the PEAR package to list its files - if (sizeof($params) != 1) { - $failmsg = "Command package-list requires a valid PEAR package filename ". - " as the first argument. Try the command \"help package-list\""; - break; - } - $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(); + case 'run-tests': { break; } // }}} - // {{{ package-info + default: { + return false; + } + } + if ($failmsg) { + return $this->raiseError($failmsg); + } + return true; + } + + // }}} + + + function doPackage($command, $options, $params) + { + $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml'; + ob_start(); + $packager =& new PEAR_Packager($this->config->get('php_dir'), + $this->config->get('ext_dir'), + $this->config->get('doc_dir')); + $packager->debug = $this->config->get('verbose'); + $err = $warn = array(); + $packager->validatePackageInfo($pkginfofile, $err, $warn); + if (!$this->_displayValidationResults($err, $warn, true)) { + return; + } + $compress = empty($options['Z']) ? true : false; + $result = $packager->Package($pkginfofile, $compress); + $output = ob_get_contents(); + ob_end_clean(); + if (PEAR::isError($result)) { + return $this->raiseError($result); + } + // Don't want output, only the package file name just created + if (isset($options['n'])) { + $this->ui->displayLine($result); + return; + } + $lines = explode("\n", $output); + foreach ($lines as $line) { + $this->ui->displayLine($line); + } + if (PEAR::isError($result)) { + $this->ui->displayLine("Package failed: ".$result->getMessage()); + } + return true; + } - case 'package-info': { - // $params[0] -> the PEAR package to list its information - if (sizeof($params) != 1) { - $failmsg = "Command package-info requires a valid PEAR package filename ". - " as the first argument. Try the command \"help package-info\""; + + 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; + } - $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; + 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"; } - 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; + $mstr .= $m['name'] . " <"; + if (isset($m['email'])) { + $mstr .= $m['email']; + } else { + $mstr .= $m['handle'] . '@php.net'; } - default: { - $info[$key] = implode(", ", $info[$key]); - break; + $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; } - $info[$key] = trim($info[$key]); - if (in_array($key, $longtext)) { - $info[$key] = preg_replace('/ +/', ' ', $info[$key]); + default: { + $info[$key] = implode(", ", $info[$key]); + break; } } - $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->ui->endTable(); - break; } - - // }}} - // {{{ package-validate - - case 'package-validate': { - if (sizeof($params) < 1) { - $params[0] = "package.xml"; - } - $obj = new PEAR_Common; - $info = null; - if (file_exists($params[0])) { - $fp = fopen($params[0], "r"); - $test = fread($fp, 5); - fclose($fp); - if ($test == "<?xml") { - $info = $obj->infoFromDescriptionFile($params[0]); - } - } - if (empty($info)) { - $info = $obj->infoFromTgzFile($params[0]); - } - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - $obj->validatePackageInfo($info, $err, $warn); - $this->_displayValidationResults($err, $warn); - 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->ui->endTable(); + return true; + } - // }}} - // {{{ cvstag - - case 'cvstag': { - if (sizeof($params) < 1) { - $help = $this->getHelp($command); - return $this->raiseError("$command: missing parameter: $help[0]"); - } - $obj = new PEAR_Common; + function doPackageValidate($command, $options, $params) + { + if (sizeof($params) < 1) { + $params[0] = "package.xml"; + } + $obj = new PEAR_Common; + $info = null; + if (file_exists($params[0])) { + $fp = fopen($params[0], "r"); + $test = fread($fp, 5); + fclose($fp); + if ($test == "<?xml") { $info = $obj->infoFromDescriptionFile($params[0]); - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - $err = $warn = array(); - $obj->validatePackageInfo($info, $err, $warn); - if (!$this->_displayValidationResults($err, $warn, true)) { - break; - } - $version = $info['version']; - $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version); - $cvstag = "RELEASE_$cvsversion"; - $files = array_keys($info['filelist']); - $command = "cvs"; - /* until the getopt bug is fixed, these won't work: - if (isset($options['q'])) { - $command .= ' -q'; - } - if (isset($options['Q'])) { - $command .= ' -Q'; - } - */ - $command .= ' tag'; - if (isset($options['F'])) { - $command .= ' -F'; - } - /* neither will this one: - if (isset($options['d'])) { - $command .= ' -d'; - } - */ - $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]); - foreach ($files as $file) { - $command .= ' ' . escapeshellarg($file); - } - $this->ui->displayLine("+ $command"); - if (empty($options['n'])) { - $fp = popen($command, "r"); - while ($line = fgets($fp, 1024)) { - $this->ui->displayLine(rtrim($line)); - } - pclose($fp); - } - break; - } - - // }}} - default: { - return false; } } - if ($failmsg) { - return $this->raiseError($failmsg); + if (empty($info)) { + $info = $obj->infoFromTgzFile($params[0]); } + if (PEAR::isError($info)) { + return $this->raiseError($info); + } + $obj->validatePackageInfo($info, $err, $warn); + $this->_displayValidationResults($err, $warn); return true; } - // }}} + function doCvsTag($command, $options, $params) + { + if (sizeof($params) < 1) { + $help = $this->getHelp($command); + return $this->raiseError("$command: missing parameter: $help[0]"); + } + $obj = new PEAR_Common; + $info = $obj->infoFromDescriptionFile($params[0]); + if (PEAR::isError($info)) { + return $this->raiseError($info); + } + $err = $warn = array(); + $obj->validatePackageInfo($info, $err, $warn); + if (!$this->_displayValidationResults($err, $warn, true)) { + break; + } + $version = $info['version']; + $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version); + $cvstag = "RELEASE_$cvsversion"; + $files = array_keys($info['filelist']); + $command = "cvs"; + if (isset($options['q'])) { + $command .= ' -q'; + } + if (isset($options['Q'])) { + $command .= ' -Q'; + } + $command .= ' tag'; + if (isset($options['F'])) { + $command .= ' -F'; + } + if (isset($options['d'])) { + $command .= ' -d'; + } + $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]); + foreach ($files as $file) { + $command .= ' ' . escapeshellarg($file); + } + $this->ui->displayLine("+ $command"); + if (empty($options['n'])) { + $fp = popen($command, "r"); + while ($line = fgets($fp, 1024)) { + $this->ui->displayLine(rtrim($line)); + } + pclose($fp); + } + return true; + } + function doRunTests($command, $options, $params) + { + $cwd = getcwd(); + $php = PHP_BINDIR . '/php' . (OS_WINDOWS ? '.exe' : ''); + putenv("TEST_PHP_EXECUTABLE=$php"); + $ip = ini_get("include_path"); + $ps = OS_WINDOWS ? ';' : ':'; + $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'; + } + $plist = implode(" ", $params); + $cmd = "$php -d include_path=$cwd$ps$ip $run_tests $plist"; + system($cmd); + return true; + } } ?> 1.5 +44 -15 php4/pear/scripts/pear.in Index: pear.in =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/scripts/pear.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- pear.in 9 May 2002 05:39:43 -0000 1.4 +++ pear.in 2 Aug 2002 22:05:25 -0000 1.5 @@ -32,12 +32,10 @@ PEAR_Command::setFrontendType('CLI'); $all_commands = PEAR_Command::getCommands(); -$cmd_options = PEAR_Command::getOptions(); -$progname = basename(__FILE__); -// XXX change Getopt to use raiseError() ? $argv = Console_Getopt::readPHPArgv(); -$options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:v" . $cmd_options); +$progname = basename(array_shift($argv)); +$options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:v"); if (PEAR::isError($options)) { usage($options); } @@ -45,9 +43,13 @@ $opts = $options[0]; $fetype = 'CLI'; -foreach ($opts as $opt) { - if ($opt[0] == 'G') { - $fetype = 'Gtk'; +if ($progname == 'gpear' || $progname == 'pear-gtk') { + $fetype = 'Gtk'; +} else { + foreach ($opts as $opt) { + if ($opt[0] == 'G') { + $fetype = 'Gtk'; + } } } PEAR_Command::setFrontendType($fetype); @@ -116,7 +118,7 @@ $config->store('user'); } -$command = (isset($options[1][1])) ? $options[1][1] : null; +$command = (isset($options[1][0])) ? array_shift($options[1]) : null; if (empty($command) && ($store_user_config || $store_system_config)) { exit; @@ -124,22 +126,46 @@ if ($fetype == 'Gtk') { Gtk::main(); -} else { +} else do { if (empty($all_commands[$command]) || $command == 'help') { usage(null, @$options[1][2]); } - + $cmd = PEAR_Command::factory($command, $config); if (PEAR::isError($cmd)) { die($cmd->getMessage()); } - $cmdargs = array_slice($options[1], 2); - $ok = $cmd->run($command, $cmdopts, $cmdargs); + $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))) { + break; + } + list($tmpopt, $params) = $tmp; + $opts = array(); + foreach ($tmpopt as $foo => $tmp2) { + list($opt, $value) = $tmp2; + if ($value === null) { + $value = true; // options without args + } + if (strlen($opt) == 1) { + $cmdoptions = $cmd->getOptions($command); + foreach ($cmdoptions as $o => $d) { + if (@$d['shortopt'] == $opt) { + $opts[$o] = $value; + } + } + } else { + if (substr($opt, 0, 2) == '--') { + $opts[substr($opt, 2)] = $value; + } + } + } + $ok = $cmd->run($command, $opts, $params); if ($ok === false) { PEAR::raiseError("unknown command `$command'"); } -} +} while (false); // {{{ usage() @@ -149,9 +175,9 @@ $stderr = fopen('php://stderr', 'w'); fputs($stderr, "\n"); if (PEAR::isError($error)) { - fputs($stderr, $error->getMessage()); + fputs($stderr, $error->getMessage() . "\n"); } elseif ($error !== null) { - fputs($stderr, $error); + fputs($stderr, "$error\n"); } if ($helpsubject != null) { $put = cmdHelp($helpsubject); @@ -190,6 +216,9 @@ " -u foo unset `foo' in the user configuration\n". " -h, -? display help/usage (this message)\n"; } elseif ($help = PEAR_Command::getHelp($command)) { + if (is_string($help)) { + return "Usage : $help"; + } return "Usage : $progname $command {$help[0]}\n{$help[1]}"; } return "No such command"; 1.3 +1 -1 php4/pear/scripts/php-config.in Index: php-config.in =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/scripts/php-config.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php-config.in 29 Apr 2002 02:33:43 -0000 1.2 +++ php-config.in 2 Aug 2002 22:05:25 -0000 1.3 @@ -1,7 +1,7 @@ #! /bin/sh prefix="@prefix@" -version="@VERSION@" +version="@PHP_VERSION@" includedir="@includedir@/php" includes="-I$includedir -I$includedir/main -I$includedir/Zend" if test '@TSRM_DIR@' != ''; then 1.3 +11 -0 php4/pear/scripts/phpize.in Index: phpize.in =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/scripts/phpize.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- phpize.in 29 Apr 2002 02:33:43 -0000 1.2 +++ phpize.in 2 Aug 2002 22:05:25 -0000 1.3 @@ -2,6 +2,7 @@ prefix='@prefix@' phpdir="$prefix/lib/php/build" +includedir="$prefix/include/php" builddir="`pwd`" FILES_BUILD="mkdep.awk shtool" FILES="acinclude.m4 Makefile.global scan_makefile_in.awk" @@ -27,3 +28,13 @@ autoconf autoheader libtoolize -f -c + +# dumping API NOs: +PHP_API_VERSION=`egrep '#define PHP_API_VERSION' $includedir/main/php.h|sed 's/#define PHP_API_VERSION//'` +ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO//'` +ZEND_EXTENSION_API_NO=`egrep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|sed 's/#define ZEND_EXTENSION_API_NO//'` + +echo "Configuring for:" +echo " PHP Api Version: "$PHP_API_VERSION +echo " Zend Module Api No: "$ZEND_MODULE_API_NO +echo " Zend Extension Api No: "$ZEND_EXTENSION_API_NO 1.3 +1 -1 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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- pear_config.phpt 29 Apr 2002 02:33:43 -0000 1.2 +++ pear_config.phpt 2 Aug 2002 22:05:25 -0000 1.3 @@ -200,7 +200,7 @@ #8 testing: getDocs master_server: name of the main PEAR server #9 testing: getKeys -doc_dir ext_dir master_server password php_dir preferred_state username verbose +bin_dir doc_dir ext_dir http_proxy master_server password php_dir preferred_state umask username verbose #10 testing: definedBy string(7) "default" string(4) "user" 1.3 +1 -0 php4/pear/tests/pear_registry.phpt Index: pear_registry.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/pear/tests/pear_registry.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- pear_registry.phpt 29 Apr 2002 02:33:43 -0000 1.2 +++ pear_registry.phpt 2 Aug 2002 22:05:25 -0000 1.3 @@ -50,6 +50,7 @@ print $pkg["name"] . ":"; unset($pkg["name"]); foreach ($pkg as $k => $v) { + if ($k == '_lastmodified') continue; print " $k=\"$v\""; } print "\n"; 1.3 +4 -2 php4/sapi/aolserver/aolserver.c Index: aolserver.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/aolserver/aolserver.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- aolserver.c 29 Apr 2002 02:33:44 -0000 1.2 +++ aolserver.c 2 Aug 2002 22:05:25 -0000 1.3 @@ -22,7 +22,7 @@ * - CGI/1.1 conformance */ -/* $Id: aolserver.c,v 1.67 2002/02/28 12:10:36 yohgaki Exp $ */ +/* $Id: aolserver.c,v 1.68 2002/05/11 02:58:43 zeev 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.67 2002/02/28 12:10:36 yohgaki Exp $"); + 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, "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()); @@ -388,6 +388,8 @@ php_ns_sapi_register_variables, NULL, /* Log message */ + + NULL, /* php.ini path override */ NULL, /* Block interruptions */ NULL, /* Unblock interruptions */ 1.3 +2 -2 php4/sapi/apache/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache/config.m4,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config.m4 29 Apr 2002 02:33:44 -0000 1.2 +++ config.m4 2 Aug 2002 22:05:25 -0000 1.3 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.55 2002/04/26 21:26:42 sas Exp $ +dnl $Id: config.m4,v 1.56 2002/05/17 08:07:13 jwoolley Exp $ dnl AC_MSG_CHECKING(for Apache 1.x module support via DSO through APXS) @@ -36,7 +36,7 @@ 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'/' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + 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;}'` 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.4 +2 -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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- mod_php4.c 9 May 2002 05:39:43 -0000 1.3 +++ mod_php4.c 2 Aug 2002 22:05:26 -0000 1.4 @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev****@zend*****> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.130 2002/05/08 12:33:44 hirokawa Exp $ */ +/* $Id: mod_php4.c,v 1.131 2002/05/11 03:33:29 zeev Exp $ */ #include "php_apache_http.h" @@ -356,7 +356,7 @@ sapi_apache_register_server_variables, /* register server variables */ php_apache_log_message, /* Log message */ - NULL, /* php.ini path override */ + NULL, /* php.ini path override */ #ifdef PHP_WIN32 NULL, 1.3 +31 -3 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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- apache_config.c 29 Apr 2002 02:33:44 -0000 1.2 +++ apache_config.c 2 Aug 2002 22:05:26 -0000 1.3 @@ -83,10 +83,34 @@ return real_value_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM); } +static const char *real_flag_hnd(cmd_parms *cmd, void *dummy, const char *arg1, const char *arg2, int status) +{ + char bool_val[2]; + + if (!strcasecmp(arg2, "On")) { + bool_val[0] = '1'; + } else { + bool_val[0] = '0'; + } + bool_val[1] = 0; + + return real_value_hnd(cmd, dummy, arg1, bool_val, status); +} + +static const char *php_apache_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value) +{ + return real_flag_hnd(cmd, dummy, name, value, PHP_INI_USER); +} + +static const char *php_apache_admin_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value) +{ + return real_flag_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM); +} + static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const char *arg) { if (apache2_php_ini_path_override) { - return "PHPINIDir is not yet supported in vhost configurations"; + return "Only first PHPINIDir directive honored per configuration tree - subsequent ones ignored"; } apache2_php_ini_path_override = ap_server_root_relative(cmd->pool, arg); return NULL; @@ -139,8 +163,12 @@ { AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS, "PHP Value Modifier"), - AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, OR_NONE, - "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, + "PHP Value Modifier (Admin)"), + AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF, + "PHP Flag Modifier (Admin)"), AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, "Directory containing the php.ini file"), {NULL} 1.4 +14 -3 php4/sapi/apache2filter/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/apache2filter/config.m4,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- config.m4 9 May 2002 05:39:43 -0000 1.3 +++ config.m4 2 Aug 2002 22:05:26 -0000 1.4 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.15 2002/05/05 09:52:39 markonen Exp $ +dnl $Id: config.m4,v 1.17 2002/05/17 08:07:14 jwoolley Exp $ dnl AC_MSG_CHECKING(for Apache 2.0 module support via DSO through APXS) @@ -42,7 +42,7 @@ 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'/' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + 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;}'` 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 @@ -57,7 +57,18 @@ INSTALL_IT="$APXS -i -a -n php4 $SAPI_LIBTOOL" ;; *darwin*) - MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD" + dnl When using bundles on Darwin, we must resolve all symbols. However, + dnl the linker does not recursively look at the bundle loader and + dnl pull in its dependencies. Therefore, we must pull in the APR + dnl and APR-util libraries. + APXS_BINDIR=`$APXS -q BINDIR` + if test -f $APXS_BINDIR/apr-config; then + MH_BUNDLE_FLAGS="`$APXS_BINDIR/apr-config --ldflags --link-ld --libs`" + fi + if test -f $APXS_BINDIR/apu-config; then + MH_BUNDLE_FLAGS="`$APXS_BINDIR/apu-config --ldflags --link-ld --libs` $MH_BUNDLE_FLAGS" + fi + MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS" PHP_SUBST(MH_BUNDLE_FLAGS) PHP_SELECT_SAPI(apache2filter, bundle, sapi_apache2.c apache_config.c php_functions.c) SAPI_SHARED=libs/libphp4.so 1.3 +15 -4 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 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php_functions.c 29 Apr 2002 02:33:44 -0000 1.2 +++ php_functions.c 2 Aug 2002 22:05:26 -0000 1.3 @@ -20,6 +20,7 @@ #include "SAPI.h" #include "apr_strings.h" +#include "apr_time.h" #include "ap_config.h" #include "util_filter.h" #include "httpd.h" @@ -69,9 +70,11 @@ } #define ADD_LONG(name) \ - add_assoc_long(return_value, #name, rr->name) + add_property_long(return_value, #name, rr->name) +#define ADD_TIME(name) \ + add_property_long(return_value, #name, rr->name / APR_USEC_PER_SEC); #define ADD_STRING(name) \ - if (rr->name) add_assoc_string(return_value, #name, (char *) rr->name, 1) + if (rr->name) add_property_string(return_value, #name, (char *) rr->name, 1) PHP_FUNCTION(apache_lookup_uri) { @@ -82,15 +85,17 @@ WRONG_PARAM_COUNT; if (rr->status == HTTP_OK) { - array_init(return_value); + object_init(return_value); ADD_LONG(status); ADD_STRING(the_request); ADD_STRING(status_line); ADD_STRING(method); - ADD_LONG(mtime); + ADD_TIME(mtime); ADD_LONG(clength); +#if !MODULE_MAGIC_AT_LEAST(20020506,0) ADD_STRING(boundary); +#endif ADD_STRING(range); ADD_LONG(chunked); ADD_STRING(content_type); @@ -102,6 +107,12 @@ ADD_STRING(filename); ADD_STRING(path_info); ADD_STRING(args); + ADD_LONG(allowed); + ADD_LONG(sent_bodyct); + ADD_LONG(bytes_sent); + ADD_LONG(request_time); + ADD_LONG(mtime); + ADD_TIME(request_time); ap_destroy_sub_req(rr); return; 1.5 +3 -2 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- cgi_main.c 9 May 2002 05:39:43 -0000 1.4 +++ cgi_main.c 2 Aug 2002 22:05:26 -0000 1.5 @@ -565,6 +565,8 @@ tsrm_ls = ts_resource(0); #endif + cgi_sapi_module.executable_location = argv[0]; + /* startup after we get the above ini override se we get things right */ if (php_module_startup(&cgi_sapi_module)==FAILURE) { #ifdef ZTS @@ -841,7 +843,6 @@ php_output_startup(); php_output_activate(TSRMLS_C); SG(headers_sent) = 1; - php_printf("Running PHP %s\n%s\n", PHP_VERSION , get_zend_version()); php_printf("[PHP Modules]\n"); zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) _print_module_info, NULL TSRMLS_CC); php_printf("\n[Zend Modules]\n"); @@ -875,7 +876,7 @@ SG(headers_sent) = 1; SG(request_info).no_headers = 1; } - php_printf("%s\n", PHP_VERSION); + php_printf("PHP %s (%s), Copyright (c) 1997-2002 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); php_end_ob_buffers(1 TSRMLS_CC); exit(1); break; 1.3 +3 -2 php4/sapi/cli/TODO Index: TODO =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/cli/TODO,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TODO 29 Apr 2002 02:33:45 -0000 1.2 +++ TODO 2 Aug 2002 22:05:26 -0000 1.3 @@ -1,5 +1,6 @@ TODO: - plain text "php -i" and phpinfo() - - \ No newline at end of file +- fix the so called CLI defaults set by zend_alter_ini_entry() in php_ini.c. + They currently cannot be set within the PHP.INI file but can be with the -d + command line switch and during runtime. 1.4 +3 -2 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- php_cli.c 9 May 2002 05:39:43 -0000 1.3 +++ php_cli.c 2 Aug 2002 22:05:26 -0000 1.4 @@ -361,6 +361,8 @@ ap_php_optind = orig_optind; ap_php_optarg = orig_optarg; + cli_sapi_module.executable_location = argv[0]; + /* startup after we get the above ini override se we get things right */ if (php_module_startup(&cli_sapi_module)==FAILURE) { return FAILURE; @@ -472,7 +474,6 @@ php_output_startup(); php_output_activate(TSRMLS_C); SG(headers_sent) = 1; - php_printf("Running PHP %s\n%s\n", PHP_VERSION , get_zend_version()); php_printf("[PHP Modules]\n"); zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) _print_module_info, NULL TSRMLS_CC); php_printf("\n[Zend Modules]\n"); @@ -523,7 +524,7 @@ SG(headers_sent) = 1; SG(request_info).no_headers = 1; } - php_printf("%s\n", PHP_VERSION); + php_printf("PHP %s (%s), Copyright (c) 1997-2002 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); php_end_ob_buffers(1 TSRMLS_CC); exit(1); break; 1.3 +5 -3 php4/sapi/fastcgi/config.m4 Index: config.m4 =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/fastcgi/config.m4,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config.m4 29 Apr 2002 02:33:45 -0000 1.2 +++ config.m4 2 Aug 2002 22:05:26 -0000 1.3 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.5 2002/03/07 14:19:51 sas Exp $ +dnl $Id: config.m4,v 1.6 2002/05/14 00:07:51 jason Exp $ dnl AC_MSG_CHECKING(for FastCGI support) @@ -12,10 +12,12 @@ fi test -f "$FASTCGIPATH/lib/libfcgi.a" || AC_MSG_ERROR(Unable to find libfcgi.a in $FASTCGIPATH/lib) test -f "$FASTCGIPATH/include/fastcgi.h" || AC_MSG_ERROR(Unable to find fastcgi.h in $FASTCGIPATH/include) + PHP_SELECT_SAPI(fastcgi, programm, fastcgi.c) - PHP_LIBS=$FASTCGIPATH/lib/libfcgi.a + PHP_ADD_INCLUDE($FASTCGIPATH/include) - EXT_PROGRAM_LDADD="$EXT_PROGRAM_LDADD $FASTCGIPATH/lib/libfcgi.a" + PHP_ADD_LIBRARY_WITH_PATH(fcgi, "$FASTCGIPATH/lib",) + INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_PROGRAM \$(bindir)/$SAPI_FASTCGI" RESULT=yes PHP_SUBST(FASTCGI_LIBADD) 1.3 +34 -35 php4/sapi/thttpd/thttpd.c Index: thttpd.c =================================================================== RCS file: /cvsroot/php-i18n/php4/sapi/thttpd/thttpd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- thttpd.c 29 Apr 2002 02:33:46 -0000 1.2 +++ thttpd.c 2 Aug 2002 22:05:26 -0000 1.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: thttpd.c,v 1.63 2001/12/13 11:15:56 sas Exp $ */ +/* $Id: thttpd.c,v 1.64 2002/05/17 21:22:30 sas Exp $ */ #include "php.h" #include "SAPI.h" @@ -87,8 +87,25 @@ return sent; } +#define ADD_VEC(str,l) vec[n].iov_base=str;len += (vec[n].iov_len=l); n++ #define COMBINE_HEADERS 30 +static int do_writev(struct iovec *vec, int n, int len TSRMLS_DC) +{ + /* + * XXX: partial writevs are not handled + * This can only cause problems, if the user tries to send + * huge headers, so I consider this a void issue right now. + * The maximum size depends on SO_SNDBUF and is usually + * at least 16KB from my experience. + */ + if (writev(TG(hc)->conn_fd, vec, n) == -1 && errno == EPIPE) + php_handle_aborted_connection(); + TG(hc)->bytes_sent += len; + + return 0; +} + static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { char buf[1024]; @@ -96,57 +113,40 @@ int n = 0; zend_llist_position pos; sapi_header_struct *h; - size_t len; + size_t len = 0; if (!SG(sapi_headers).http_status_line) { - snprintf(buf, 1023, "HTTP/1.0 %d Something\r\n", SG(sapi_headers).http_response_code); - len = strlen(buf); - vec[n].iov_base = buf; - vec[n].iov_len = len; + sprintf(buf, "HTTP/1.0 %d Code\r\n", /* SAFE */ + SG(sapi_headers).http_response_code); + ADD_VEC(buf, strlen(buf)); } else { - vec[n].iov_base = SG(sapi_headers).http_status_line; - len = strlen(vec[n].iov_base); - vec[n].iov_len = len; - vec[++n].iov_base = "\r\n"; - vec[n].iov_len = 2; - len += 2; + ADD_VEC(SG(sapi_headers).http_status_line, + strlen(SG(sapi_headers).http_status_line)); + ADD_VEC("\r\n", 2); } TG(hc)->status = SG(sapi_headers).http_response_code; - TG(hc)->bytes_sent += len; - n++; -#define DEF_CONTENT_TYPE_LINE "Content-Type: text/html\r\n" +#define DEF_CT "Content-Type: text/html\r\n" if (SG(sapi_headers).send_default_content_type) { - vec[n].iov_base = DEF_CONTENT_TYPE_LINE; - vec[n].iov_len = sizeof(DEF_CONTENT_TYPE_LINE) - 1; - n++; + ADD_VEC(DEF_CT, strlen(DEF_CT)); } h = zend_llist_get_first_ex(&sapi_headers->headers, &pos); while (h) { - vec[n].iov_base = h->header; - vec[n++].iov_len = h->header_len; + ADD_VEC(h->header, h->header_len); if (n >= COMBINE_HEADERS - 1) { - /* XXX: partial writevs are not handled */ - if (writev(TG(hc)->conn_fd, vec, n) == -1 && errno == EPIPE) - php_handle_aborted_connection(); + len = do_writev(vec, n, len TSRMLS_CC); n = 0; } - vec[n].iov_base = "\r\n"; - vec[n++].iov_len = 2; + ADD_VEC("\r\n", 2); h = zend_llist_get_next_ex(&sapi_headers->headers, &pos); } + + ADD_VEC("\r\n", 2); + + do_writev(vec, n, len TSRMLS_CC); - vec[n].iov_base = "\r\n"; - vec[n++].iov_len = 2; - - if (n) { - /* XXX: partial writevs are not handled */ - if (writev(TG(hc)->conn_fd, vec, n) == -1 && errno == EPIPE) - php_handle_aborted_connection(); - } - return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -352,7 +352,6 @@ static void thttpd_request_ctor(TSRMLS_D) { - int offset; smart_str s = {0}; SG(request_info).query_string = TG(hc)->query?strdup(TG(hc)->query):NULL; 1.3 +51 -23 php4/tests/dirname.phpt Index: dirname.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/dirname.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- dirname.phpt 29 Apr 2002 02:33:47 -0000 1.2 +++ dirname.phpt 2 Aug 2002 22:05:26 -0000 1.3 @@ -3,28 +3,56 @@ --FILE-- <?php - function check_dirname($path) - { - print "dirname($path) == " . dirname($path) . "\n"; - } - - check_dirname("/foo/"); - check_dirname("/foo"); - check_dirname("/foo/bar"); - check_dirname("d:\\foo\\bar.inc"); - check_dirname("/"); - check_dirname(".../foo"); - check_dirname("./foo"); - check_dirname("foobar///"); - check_dirname("c:\foo"); +// Allow for either Win32 or Unix. +$s = dirname("/foo"); +// $s should be either / (Unix) or \ (Win32) + +function check_dirname($path) { + global $s; + $path1 = str_replace("%",$s,$path); + $path2 = dirname($path1); + $path3 = str_replace($s,"%",$path2); + print "dirname($path) == $path3\n"; +} + +check_dirname("%foo%"); +check_dirname("%foo"); +check_dirname("%foo%bar"); +check_dirname("%"); +check_dirname("...%foo"); +check_dirname(".%foo"); +check_dirname("foobar%%%"); + +function same($a,$b) { + if ($a == $b) { + print "OK\n"; + } else { + print "FAIL $a == $b\n"; + } +} + +if ('/' == $s) { + same(".",dirname("d:\\foo\\bar.inc")); + same(".",dirname("c:\\foo")); + same(".",dirname("c:\\")); + same(".",dirname("c:")); +} else { + same("d:\\foo",dirname("d:\\foo\\bar.inc")); + same("c:\\",dirname("c:\\foo")); + same("c:\\",dirname("c:\\")); + same("c:",dirname("c:")); +} + ?> --EXPECT-- -dirname(/foo/) == / -dirname(/foo) == / -dirname(/foo/bar) == /foo -dirname(d:\foo\bar.inc) == . -dirname(/) == / -dirname(.../foo) == ... -dirname(./foo) == . -dirname(foobar///) == . -dirname(c:\foo) == . +dirname(%foo%) == % +dirname(%foo) == % +dirname(%foo%bar) == %foo +dirname(%) == % +dirname(...%foo) == ... +dirname(.%foo) == . +dirname(foobar%%%) == . +OK +OK +OK +OK 1.2 +3 -0 php4/tests/php.ini 1.2 +61 -0 php4/tests/tests.dsp 1.2 +27 -0 php4/tests/tests.mak 1.3 +1 -1 php4/tests/basic/002.phpt Index: 002.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/basic/002.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 002.phpt 29 Apr 2002 02:33:48 -0000 1.2 +++ 002.phpt 2 Aug 2002 22:05:26 -0000 1.3 @@ -1,7 +1,7 @@ --TEST-- Simple POST Method test --SKIPIF-- -<?php if(php_sapi_name()=='cli'); echo 'skip'; ?> +<?php if (php_sapi_name()=='cli') echo 'skip'; ?> --POST-- a=Hello+World --GET-- 1.3 +3 -3 php4/tests/basic/003.phpt Index: 003.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/basic/003.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 003.phpt 29 Apr 2002 02:33:48 -0000 1.2 +++ 003.phpt 2 Aug 2002 22:05:26 -0000 1.3 @@ -1,7 +1,7 @@ --TEST-- GET and POST Method combined --SKIPIF-- -<?php if(php_sapi_name()=='cli'); echo 'skip'; ?> +<?php if (php_sapi_name()=='cli') echo 'skip'; ?> --POST-- a=Hello+World --GET-- @@ -9,6 +9,6 @@ --FILE-- <?php error_reporting(0); -echo "{$_POST['a']} {$_GET['b']} {$_GET['c']}"?> +echo "post-a=({$_POST['a']}) get-b=({$_GET['b']}) get-c=({$_GET['c']})"?> --EXPECT-- -Hello World Hello Again World Hi Mom +post-a=(Hello World) get-b=(Hello Again World) get-c=(Hi Mom) 1.3 +1 -1 php4/tests/basic/004.phpt Index: 004.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/basic/004.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 004.phpt 29 Apr 2002 02:33:48 -0000 1.2 +++ 004.phpt 2 Aug 2002 22:05:26 -0000 1.3 @@ -1,7 +1,7 @@ --TEST-- Two variables in POST data --SKIPIF-- -<?php if(php_sapi_name()=='cli'); echo 'skip'; ?> +<?php if (php_sapi_name()=='cli') echo 'skip'; ?> --POST-- a=Hello+World&b=Hello+Again+World --GET-- 1.3 +1 -1 php4/tests/basic/005.phpt Index: 005.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/basic/005.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 005.phpt 29 Apr 2002 02:33:48 -0000 1.2 +++ 005.phpt 2 Aug 2002 22:05:26 -0000 1.3 @@ -1,7 +1,7 @@ --TEST-- Three variables in POST data --SKIPIF-- -<?php if(php_sapi_name()=='cli'); echo 'skip'; ?> +<?php if (php_sapi_name()=='cli') echo 'skip'; ?> --POST-- a=Hello+World&b=Hello+Again+World&c=1 --GET-- 1.3 +10 -9 php4/tests/basic/011.phpt Index: 011.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/basic/011.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 011.phpt 29 Apr 2002 02:33:48 -0000 1.2 +++ 011.phpt 2 Aug 2002 22:05:26 -0000 1.3 @@ -7,15 +7,16 @@ ab+cd+ef+123+test --FILE-- <?php - if(ini_get('register_globals') != '') { - for($i=0;$i<$argc;$i++) { - echo "$i: ".$argv[$i]."\n"; - } - } else { - for($i=0;$i<$_SERVER['argc'];$i++) { - echo "$i: ".$_SERVER['argv'][$i]."\n"; - } - } + +if (!ini_get('register_globals')) { + $argc = $_SERVER['argc']; + $argv = $_SERVER['argv']; +} + +for ($i=0; $i<$argc; $i++) { + echo "$i: ".$argv[$i]."\n"; +} + ?> --EXPECT-- 0: ab 1.3 +9 -1 php4/tests/lang/029.phpt Index: 029.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/lang/029.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 029.phpt 29 Apr 2002 02:33:49 -0000 1.2 +++ 029.phpt 2 Aug 2002 22:05:26 -0000 1.3 @@ -21,6 +21,14 @@ var_dump($o); $y=ob_get_contents(); ob_end_clean(); -echo ($x==$y) ? 'success':'failure'; ?> +if ($x == $y) { + print "success"; +} else { + print "failure +x=$x +y=$y +"; +} +?> --EXPECT-- success 1.3 +56 -6 php4/tests/lang/031.phpt Index: 031.phpt =================================================================== RCS file: /cvsroot/php-i18n/php4/tests/lang/031.phpt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- 031.phpt 29 Apr 2002 02:33:49 -0000 1.2 +++ 031.phpt 2 Aug 2002 22:05:26 -0000 1.3 @@ -5,16 +5,66 @@ --FILE-- <?php // reported by php.n****@alien***** -$outsidearray = array("key1","key2"); -$insidearray = array("0","1"); +$arrayOuter = array("key1","key2"); +$arrayInner = array("0","1"); -while(list(,$outerval) = each($outsidearray)){ - $placeholder = $insidearray; - while(list(,$innerval) = each($insidearray)){ - print "inloop $innerval for $outerval\n"; +print "Correct - with inner loop reset.\n"; + +while(list(,$o) = each($arrayOuter)){ + reset($arrayInner); + while(list(,$i) = each($arrayInner)){ + print "inloop $i for $o\n"; + } +} +reset($arrayOuter); +reset($arrayInner); + +print "What happens without inner loop reset.\n"; + +while(list(,$o) = each($arrayOuter)){ + while(list(,$i) = each($arrayInner)){ + print "inloop $i for $o\n"; } } +reset($arrayOuter); +reset($arrayInner); + +print "What happens without inner loop reset but copy.\n"; + +while(list(,$o) = each($arrayOuter)){ + $placeholder = $arrayInner; + while(list(,$i) = each($arrayInner)){ + print "inloop $i for $o\n"; + } +} +reset($arrayOuter); +reset($arrayInner); + +print "What happens with inner loop reset over copy.\n"; + +while(list(,$o) = each($arrayOuter)){ + $placeholder = $arrayInner; + while(list(,$i) = each($placeholder)){ + print "inloop $i for $o\n"; + } +} +reset($arrayOuter); +reset($arrayInner); ?> --EXPECT-- +Correct - with inner loop reset. +inloop 0 for key1 +inloop 1 for key1 +inloop 0 for key2 +inloop 1 for key2 +What happens without inner loop reset. +inloop 0 for key1 +inloop 1 for key1 +What happens without inner loop reset but copy. +inloop 0 for key1 +inloop 1 for key1 +What happens with inner loop reset over copy. inloop 0 for key1 inloop 1 for key1 +inloop 0 for key2 +inloop 1 for key2 1.3 +1 -0 php4/win32/.cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 29 Apr 2002 02:33:49 -0000 1.2 +++ .cvsignore 2 Aug 2002 22:05:26 -0000 1.3 @@ -2,6 +2,7 @@ *.opt *.ncb *.suo +*.aps ext Release Release_inline 1.3 +12 -3 php4/win32/crypt_win32.c Index: crypt_win32.c =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/crypt_win32.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- crypt_win32.c 29 Apr 2002 02:33:49 -0000 1.2 +++ crypt_win32.c 2 Aug 2002 22:05:26 -0000 1.3 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: crypt_win32.c,v 1.3 2002/03/18 22:13:14 sebastian Exp $ */ +/* $Id: crypt_win32.c,v 1.4 2002/05/10 04:58:05 edink Exp $ */ /* This code is distributed under the PHP license with permission from the author Jochen Obalek <joche****@bigfo*****> */ @@ -41,6 +41,7 @@ #include <time.h> #include <string.h> #include <stdlib.h> +#include "md5crypt.h" #define BS 64 #define BS2 32 @@ -271,7 +272,7 @@ } char * -crypt (const char *wort, const char *salt) +des_crypt (const char *wort, const char *salt) { static char retkey[14]; char key[BS + 2]; @@ -343,4 +344,12 @@ return retkey; } - +char * +crypt (const char *pw, const char *salt) +{ + if (strlen(salt)>MD5_MAGIC_LEN && strncmp(salt, MD5_MAGIC, MD5_MAGIC_LEN)==0) { + return md5_crypt(pw, salt); + } else { + return des_crypt(pw, salt); + } +} 1.3 +9 -8 php4/win32/imap_sendmail.c Index: imap_sendmail.c =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/imap_sendmail.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- imap_sendmail.c 29 Apr 2002 02:33:49 -0000 1.2 +++ imap_sendmail.c 2 Aug 2002 22:05:26 -0000 1.3 @@ -15,7 +15,7 @@ | Authors: Frank M. Kromann <frank****@kroma*****> | +----------------------------------------------------------------------+ */ -/* $Id: imap_sendmail.c,v 1.3 2002/02/28 08:27:22 sebastian Exp $ */ +/* $Id: imap_sendmail.c,v 1.5 2002/05/15 17:39:41 fmk Exp $ */ #include "php.h" /*php specific */ #include <stdio.h> @@ -117,6 +117,7 @@ char *p; char *tempMailTo; ADDRESS *addr; + char *server_response = NULL; /* check for NULL parameters */ if (data == NULL) @@ -140,13 +141,13 @@ if ((res = Post(Buffer)) != SUCCESS) return (res); } - if ((res = Ack()) != SUCCESS) + if ((res = Ack(NULL)) != SUCCESS) return (res); sprintf(Buffer, "MAIL FROM:<%s>\r\n", RPath); if ((res = Post(Buffer)) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(NULL)) != SUCCESS) return (res); // Send mail to all rcpt's @@ -160,7 +161,7 @@ sprintf(Buffer, "RCPT TO:<%s@%s>\r\n", addr->mailbox, addr->host); if ((res = Post(Buffer)) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(NULL)) != SUCCESS) return (res); } addr = addr->next; @@ -179,7 +180,7 @@ sprintf(Buffer, "RCPT TO:<%s@%s>\r\n", addr->mailbox, addr->host); if ((res = Post(Buffer)) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(NULL)) != SUCCESS) return (res); } addr = addr->next; @@ -198,7 +199,7 @@ sprintf(Buffer, "RCPT TO:<%s@%s>\r\n", addr->mailbox, addr->host); if ((res = Post(Buffer)) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(NULL)) != SUCCESS) return (res); } addr = addr->next; @@ -208,7 +209,7 @@ if ((res = Post("DATA\r\n")) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(NULL)) != SUCCESS) return (res); @@ -249,7 +250,7 @@ /*send termination dot */ if ((res = Post("\r\n.\r\n")) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(NULL)) != SUCCESS) return (res); return (SUCCESS); 1.5 +5 -1 php4/win32/php4dllts.dsp Index: php4dllts.dsp =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/php4dllts.dsp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- php4dllts.dsp 3 May 2002 00:14:52 -0000 1.4 +++ php4dllts.dsp 2 Aug 2002 22:05:26 -0000 1.5 @@ -1,6 +1,6 @@ # Microsoft Developer Studio Project File - Name="php4dllts" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** NICHT BEARBEITEN ** +# ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 @@ -1917,6 +1917,10 @@ # Begin Source File SOURCE=.\crypt_win32.c +# End Source File +# Begin Source File + +SOURCE=.\md5crypt.c # End Source File # Begin Source File 1.3 +7 -3 php4/win32/php4ts.dsw Index: php4ts.dsw =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/php4ts.dsw,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- php4ts.dsw 29 Apr 2002 02:33:50 -0000 1.2 +++ php4ts.dsw 2 Aug 2002 22:05:26 -0000 1.3 @@ -168,7 +168,7 @@ ############################################################################### -Project: "servlet"="..\sapi\servlet\servlet.dsp" - Package Owner=<4> +Project: "php4ts_cli"=".\php4ts_cli.dsp" - Package Owner=<4> Package=<5> {{{ @@ -176,11 +176,14 @@ Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name php4dllts + End Project Dependency }}} ############################################################################### -Project: "cli"=".\php4ts_cli.dsp" - Package Owner=<4> +Project: "servlet"="..\sapi\servlet\servlet.dsp" - Package Owner=<4> Package=<5> {{{ @@ -191,7 +194,8 @@ }}} ############################################################################### -Project: "testsuite"=".\testsuite.dsp" - Package Owner=<4> + +Project: "tests"="..\tests\tests.dsp" - Package Owner=<4> Package=<5> {{{ 1.3 +261 -57 php4/win32/sendmail.c Index: sendmail.c =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/sendmail.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- sendmail.c 29 Apr 2002 02:33:50 -0000 1.2 +++ sendmail.c 2 Aug 2002 22:05:26 -0000 1.3 @@ -1,4 +1,3 @@ - /* * PHP Sendmail for Windows. * @@ -18,7 +17,7 @@ * */ -/* $Id: sendmail.c,v 1.24 2001/12/20 18:06:13 fmk Exp $ */ +/* $Id: sendmail.c,v 1.32 2002/05/17 16:16:27 mfischer Exp $ */ #include "php.h" /*php specific */ #include <stdio.h> @@ -47,6 +46,18 @@ static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; +/* '*error_message' has to be passed around from php_mail() */ +#define SMTP_ERROR_RESPONSE_SPEC "SMTP server response: %s" +/* Convinient way to handle error messages from the SMTP server. + 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); \ + } \ + efree(response); \ + } + #ifndef THREAD_SAFE char Buffer[MAIL_BUFFER_SIZE]; @@ -62,33 +73,34 @@ char LocalHost[HOST_NAME_LEN]; #endif char seps[] = " ,\t\n"; -char *php_mailer = "PHP 4.0 WIN32"; +char *php_mailer = "PHP 4 WIN32"; char *get_header(char *h, char *headers); /* Error messages */ static char *ErrorMessages[] = { - {"Success"}, - {"Bad arguments from form"}, + {"Success"}, /* 0 */ + {"Bad arguments from form"}, /* 1 */ {"Unable to open temporary mailfile for read"}, {"Failed to Start Sockets"}, {"Failed to Resolve Host"}, - {"Failed to obtain socket handle"}, - {"Failed to Connect"}, + {"Failed to obtain socket handle"}, /* 5 */ + {"Failed to connect to mailserver, verify your \"SMTP\" setting in php.ini"}, {"Failed to Send"}, {"Failed to Receive"}, {"Server Error"}, - {"Failed to resolve the host IP name"}, + {"Failed to resolve the host IP name"}, /* 10 */ {"Out of memory"}, {"Unknown error"}, {"Bad Message Contents"}, {"Bad Message Subject"}, - {"Bad Message destination"}, + {"Bad Message destination"}, /* 15 */ {"Bad Message Return Path"}, {"Bad Mail Host"}, {"Bad Message File"}, - {"PHP Internal error: php.ini sendmail from variable not set!"} + {"\"sendmail_from\" not set in php.ini or custom \"From:\" header missing"}, + {"Mailserver rejected our \"sendmail_from\" setting"} /* 20 */ }; @@ -106,43 +118,102 @@ // // See SendText() for additional args! //********************************************************************/ -int TSendMail(char *host, int *error, +int TSendMail(char *host, int *error, char **error_message, char *headers, char *Subject, char *mailTo, char *data) { int ret; char *RPath = NULL; + char *headers_lc = NULL; /* headers_lc is only created if we've a header at all */ WinsockStarted = FALSE; if (host == NULL) { *error = BAD_MAIL_HOST; - return BAD_MAIL_HOST; + return FAILURE; } else if (strlen(host) >= HOST_NAME_LEN) { *error = BAD_MAIL_HOST; - return BAD_MAIL_HOST; + return FAILURE; } else { strcpy(MailHost, host); } - if (INI_STR("sendmail_from")){ - RPath = estrdup(INI_STR("sendmail_from")); + /* use from address as return path (if specified in headers) */ + if (headers) { + char *pos = NULL; + size_t i; + /* 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))) { + *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 { - return 19; + if (headers_lc) { + efree(headers_lc); + } + *error = W32_SM_SENDMAIL_FROM_NOT_SET; + return FAILURE; + } } /* attempt to connect with mail host */ *error = MailConnect(); if (*error != 0) { - if(RPath)efree(RPath); - return *error; + if (RPath) { + efree(RPath); + } + if (headers_lc) { + 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); + return FAILURE; } else { - ret = SendText(RPath, Subject, mailTo, data, headers); + ret = SendText(RPath, Subject, mailTo, data, headers, headers_lc, error_message); TSMClose(); + if (RPath) { + efree(RPath); + } + if (headers_lc) { + efree(headers_lc); + } if (ret != SUCCESS) { *error = ret; + return FAILURE; } - if(RPath)efree(RPath); - return ret; + return SUCCESS; } } @@ -157,7 +228,7 @@ void TSMClose() { Post("QUIT\r\n"); - Ack(); + Ack(NULL); /* to guarantee that the cleanup is not made twice and compomise the rest of the application if sockets are used elesewhere @@ -178,11 +249,13 @@ //*******************************************************************/ char *GetSMErrorText(int index) { + if (MIN_ERROR_INDEX <= index && index < MAX_ERROR_INDEX) { + return (ErrorMessages[index]); - if ((index > MAX_ERROR_INDEX) || (index < MIN_ERROR_INDEX)) + } else { return (ErrorMessages[UNKNOWN_ERROR]); - else - return (ErrorMessages[index]); + + } } @@ -195,16 +268,22 @@ // the subject is set to "No Subject" // 3) mailTo: Destination address // 4) data: Null terminated string containing the data to be send. +// 5,6) headers of the message. Note that the second +// parameter, headers_lc, is actually a lowercased version of +// headers. The should match exactly (in terms of length), +// only differ in case // Output: Error code or SUCCESS // Description: // Author/Date: jcar 20/9/96 // History: //*******************************************************************/ -int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers) +int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers, char *headers_lc, char **error_message) { int res, i; char *p; char *tempMailTo, *token, *pos1, *pos2; + char *server_response = NULL; + char *stripped_header = NULL; /* check for NULL parameters */ if (data == NULL) @@ -216,8 +295,12 @@ /* simple checks for the mailto address */ /* have ampersand ? */ + /* mfischer, 20020514: I commented this out because it really + seems bogus. Only a username for example may still be a + valid address at the destination system. if (strchr(mailTo, '@') == NULL) return (BAD_MSG_DESTINATION); + */ sprintf(Buffer, "HELO %s\r\n", LocalHost); @@ -228,18 +311,21 @@ if ((res = Post(Buffer)) != SUCCESS) return (res); } - if ((res = Ack()) != SUCCESS) + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); return (res); + } sprintf(Buffer, "MAIL FROM:<%s>\r\n", RPath); if ((res = Post(Buffer)) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) - return (res); + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); + return W32_SM_SENDMAIL_FROM_MALFORMED; + } tempMailTo = estrdup(mailTo); - /* Send mail to all rcpt's */ token = strtok(tempMailTo, ","); while(token != NULL) @@ -247,16 +333,28 @@ sprintf(Buffer, "RCPT TO:<%s>\r\n", token); if ((res = Post(Buffer)) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); return (res); + } token = strtok(NULL, ","); } + efree(tempMailTo); /* Send mail to all Cc rcpt's */ - efree(tempMailTo); - if (headers && (pos1 = strstr(headers, "Cc:"))) { - pos2 = strstr(pos1, "\r\n"); - tempMailTo = estrndup(pos1, pos2-pos1); + if (headers && (pos1 = strstr(headers_lc, "cc:"))) { + /* Real offset is memaddress from the original headers + difference of + * string found in the lowercase headrs + 3 characters to jump over + * the cc: */ + pos1 = headers + (pos1 - headers_lc) + 3; + if (NULL == (pos2 = strstr(pos1, "\r\n"))) { + + tempMailTo = estrndup(pos1, strlen(pos1)); + + } else { + tempMailTo = estrndup(pos1, pos2-pos1); + + } token = strtok(tempMailTo, ","); while(token != NULL) @@ -264,26 +362,99 @@ sprintf(Buffer, "RCPT TO:<%s>\r\n", token); if ((res = Post(Buffer)) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); return (res); + } token = strtok(NULL, ","); } efree(tempMailTo); } - if ((res = Post("DATA\r\n")) != SUCCESS) + /* 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. */ + if (headers) { + if (pos1 = strstr(headers_lc, "bcc:")) { + /* Real offset is memaddress from the original headers + difference of + * string found in the lowercase headrs + 4 characters to jump over + * the bcc: */ + pos1 = headers + (pos1 - headers_lc) + 4; + if (NULL == (pos2 = strstr(pos1, "\r\n"))) { + int foo = strlen(pos1); + tempMailTo = estrndup(pos1, strlen(pos1)); + /* Later, when we remove the Bcc: out of the + header we know it was the last thing. */ + pos2 = pos1; + } else { + tempMailTo = estrndup(pos1, pos2 - pos1); + } + + token = strtok(tempMailTo, ","); + while(token != NULL) + { + sprintf(Buffer, "RCPT TO:<%s>\r\n", token); + if ((res = Post(Buffer)) != SUCCESS) { + return (res); + } + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); + return (res); + } + token = strtok(NULL, ","); + } + efree(tempMailTo); + + /* Now that we've identified that we've a Bcc list, + remove it from the current header. */ + if (NULL == (stripped_header = ecalloc(1, strlen(headers)))) { + return OUT_OF_MEMORY; + } + /* headers = point to string start of header + pos1 = pointer IN headers where the Bcc starts + '4' = Length of the characters 'bcc:' + Because we've added +4 above for parsing the Emails + we've to substract them here. */ + memcpy(stripped_header, headers, pos1 - headers - 4); + if (pos1 != pos2) { + /* if pos1 != pos2 , pos2 points to the rest of the headers. + Since pos1 != pos2 if "\r\n" was found, we know those characters + are there and so we jump over them (else we would generate a new header + which would look like "\r\n\r\n". */ + memcpy(stripped_header + (pos1 - headers - 4), pos2 + 2, strlen(pos2) - 2); + } + } else { + /* Simplify the code that we create a copy of stripped_header no matter if + we actually strip something or not. So we've a single efree() later. */ + if (NULL == (stripped_header = estrndup(headers, strlen(headers)))) { + return OUT_OF_MEMORY; + } + } + } + + if ((res = Post("DATA\r\n")) != SUCCESS) { + efree(stripped_header); return (res); - if ((res = Ack()) != SUCCESS) + } + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); + efree(stripped_header); return (res); + } /* send message header */ - if (Subject == NULL) - res = PostHeader(RPath, "No Subject", mailTo, headers, NULL); - else - res = PostHeader(RPath, Subject, mailTo, headers, NULL); - if (res != SUCCESS) + if (Subject == NULL) { + res = PostHeader(RPath, "No Subject", mailTo, stripped_header, NULL); + } else { + res = PostHeader(RPath, Subject, mailTo, stripped_header, NULL); + } + if (stripped_header) { + efree(stripped_header); + } + if (res != SUCCESS) { return (res); + } /* send message contents in 1024 chunks */ @@ -314,8 +485,10 @@ /*send termination dot */ if ((res = Post("\r\n.\r\n")) != SUCCESS) return (res); - if ((res = Ack()) != SUCCESS) + if ((res = Ack(&server_response)) != SUCCESS) { + SMTP_ERROR_RESPONSE(server_response); return (res); + } return (SUCCESS); } @@ -345,12 +518,23 @@ int zoneh = abs(_timezone); int zonem, res; char *p; + char *headers_lc = NULL; + size_t i; + + if (xheaders) { + if (NULL == (headers_lc = estrdup(xheaders))) { + return OUT_OF_MEMORY; + } + for (i = 0; i < strlen(headers_lc); i++) { + headers_lc[i] = tolower(headers_lc[i]); + } + } p = Buffer; zoneh /= (60 * 60); zonem = (abs(_timezone) / 60) - (zoneh * 60); - if(!xheaders || !strstr(xheaders, "Date:")){ + if(!xheaders || !strstr(headers_lc, "date:")){ p += sprintf(p, "Date: %s, %02d %s %04d %02d:%02d:%02d %s%02d%02d\r\n", days[tm->tm_wday], tm->tm_mday, @@ -364,7 +548,7 @@ zonem); } - if(!xheaders || !strstr(xheaders, "From:")){ + if(!headers_lc || !strstr(headers_lc, "from:")){ p += sprintf(p, "From: %s\r\n", RPath); } p += sprintf(p, "Subject: %s\r\n", Subject); @@ -376,11 +560,19 @@ p += sprintf(p, "%s\r\n", xheaders); } - if ((res = Post(Buffer)) != SUCCESS) + if ((res = Post(Buffer)) != SUCCESS) { + if (headers_lc) { + efree(headers_lc); + } return (res); + } - if ((res = Post("\r\n")) != SUCCESS) + if ((res = Post("\r\n")) != SUCCESS) { + if (headers_lc) { + efree(headers_lc); + } return (res); + } return (SUCCESS); } @@ -431,7 +623,7 @@ return (FAILED_TO_CONNECT); /* receive Server welcome message */ - res = Ack(); + res = Ack(NULL); return (res); } @@ -475,20 +667,16 @@ // Author/Date: jcar 20/9/96 // History: //********************************************************************/ -int Ack() +int Ack(char **server_response) { - static char *buf; + static char buf[MAIL_BUFFER_SIZE]; int rlen; int Index = 0; int Received = 0; - if (!buf) - if ((buf = (char *) malloc(1024 * 4)) == NULL) - return (OUT_OF_MEMORY); - again: - if ((rlen = recv(sc, buf + Index, ((1024 * 4) - 1) - Received, 0)) < 1) + if ((rlen = recv(sc, buf + Index, ((MAIL_BUFFER_SIZE) - 1) - Received, 0)) < 1) return (FAILED_TO_RECEIVE); Received += rlen; @@ -504,8 +692,24 @@ goto again; /* Incomplete data. Line must be terminated by CRLF And not contain a space followed by a '-' */ - if (buf[0] > '3') + if (buf[0] > '3') { + /* If we've a valid pointer, return the SMTP server response so the error messages give away 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 */ + if (Received > 2) { + if (buf[Received-1] == '\n' || buf[Received-1] == '\r') { + dec++; + if (buf[Received-2] == '\r' || buf[Received-2] == '\n') { + dec++; + } + } + + } + *server_response = estrndup(buf, Received - dec); + } return (SMTP_SERVER_ERROR); + } return (SUCCESS); } 1.3 +27 -25 php4/win32/sendmail.h Index: sendmail.h =================================================================== RCS file: /cvsroot/php-i18n/php4/win32/sendmail.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- sendmail.h 29 Apr 2002 02:33:50 -0000 1.2 +++ sendmail.h 2 Aug 2002 22:05:26 -0000 1.3 @@ -4,41 +4,43 @@ #define HOST_NAME_LEN 256 #define MAX_APPNAME_LENGHT 100 -#define MAX_ERROR_INDEX 17 -#define MIN_ERROR_INDEX 0 -#define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */ +#define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */ /* Return values */ -#define SUCCESS 0 -#define FAILED_TO_PARSE_ARGUMENTS 1 -#define FAILED_TO_OPEN_MAILFILE 2 -#define FAILED_TO_START_SOCKETS 3 -#define FAILED_TO_RESOLVE_HOST 4 -#define FAILED_TO_OBTAIN_SOCKET_HANDLE 5 -#define FAILED_TO_CONNECT 6 -#define FAILED_TO_SEND 7 -#define FAILED_TO_RECEIVE 8 -#define SMTP_SERVER_ERROR 9 -#define FAILED_TO_GET_HOSTNAME 10 -#define OUT_OF_MEMORY 11 -#define UNKNOWN_ERROR 12 -#define BAD_MSG_CONTENTS 13 -#define BAD_MSG_SUBJECT 14 -#define BAD_MSG_DESTINATION 15 -#define BAD_MSG_RPATH 16 -#define BAD_MAIL_HOST 17 -#define BAD_MSG_FILE 18 +#define MIN_ERROR_INDEX 0 /* Always 0 like SUCCESS */ +#define SUCCESS 0 +#define FAILED_TO_PARSE_ARGUMENTS 1 +#define FAILED_TO_OPEN_MAILFILE 2 +#define FAILED_TO_START_SOCKETS 3 +#define FAILED_TO_RESOLVE_HOST 4 +#define FAILED_TO_OBTAIN_SOCKET_HANDLE 5 +#define FAILED_TO_CONNECT 6 +#define FAILED_TO_SEND 7 +#define FAILED_TO_RECEIVE 8 +#define SMTP_SERVER_ERROR 9 +#define FAILED_TO_GET_HOSTNAME 10 +#define OUT_OF_MEMORY 11 +#define UNKNOWN_ERROR 12 +#define BAD_MSG_CONTENTS 13 +#define BAD_MSG_SUBJECT 14 +#define BAD_MSG_DESTINATION 15 +#define BAD_MSG_RPATH 16 +#define BAD_MAIL_HOST 17 +#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 */ -int TSendMail(char *smtpaddr, int *returnerror, +int TSendMail(char *smtpaddr, int *returnerror, char **error_message, char *RPath, char *Subject, char *mailTo, char *data); void TSMClose(void); -int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers); +int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers, char *headers_lc, char **error_message); char *GetSMErrorText(int index); int MailConnect(); int PostHeader(char *, char *, char *, char *, char *); int Post(LPCSTR); -int Ack(); +int Ack(char **server_response); unsigned long GetAddr(LPSTR szHost); 1.2 +163 -0 php4/win32/md5crypt.c 1.2 +37 -0 php4/win32/md5crypt.h