[php-i18n-commits] cvs commit: php4/win32 php4dllts.dsp readdir.c readdir.h

Back to archive index

Yasuo Ohgaki yohga****@users*****
2002年 8月 3日 (土) 09:44:22 JST


yohgaki     02/08/03 09:44:21

  Modified:    .        Tag: ORIG .cvsignore ChangeLog INSTALL LICENSE
                        Makefile.global NEWS README.CVS-RULES
                        README.PARAMETER_PARSING_API acinclude.m4 buildconf
                        config.guess config.sub configure.in php.ini-dist
                        php.ini-recommended
               build    Tag: ORIG build.mk build2.mk buildcheck.sh
               ext      Tag: ORIG ext_skel
               ext/curl Tag: ORIG curl.c
               ext/dbx  Tag: ORIG dbx.c
               ext/dio  Tag: ORIG dio.c
               ext/domxml Tag: ORIG TODO php_domxml.c php_domxml.h
               ext/exif Tag: ORIG exif.c
               ext/ftp  Tag: ORIG CREDITS ftp.c ftp.h php_ftp.c php_ftp.h
               ext/gd   Tag: ORIG config.m4 gd.c
               ext/gd/libgd Tag: ORIG gdft.c
               ext/hyperwave Tag: ORIG hw.c
               ext/iconv Tag: ORIG config.m4 iconv.c
               ext/iconv/tests Tag: ORIG eucjp2iso2022jp.phpt
                        eucjp2utf8.inc eucjp2utf8.phpt
               ext/imap Tag: ORIG config.m4 php_imap.c php_imap.h
               ext/informix Tag: ORIG .cvsignore ifx.ec
               ext/interbase Tag: ORIG interbase.c
               ext/ircg Tag: ORIG README.txt ircg.c
               ext/java Tag: ORIG Makefile.frag
               ext/ldap Tag: ORIG ldap.c
               ext/mbstring Tag: ORIG config.m4 mbfilter.c mbfilter.h
                        mbregex.c mbstring.c mbstring.dsp mbstring.h
               ext/ming Tag: ORIG ming.c
               ext/mnogosearch Tag: ORIG php_mnogo.c
               ext/mysql Tag: ORIG config.m4 php_mysql.c php_mysql.h
               ext/odbc Tag: ORIG php_odbc.c php_odbc_includes.h
               ext/openssl Tag: ORIG openssl.c
               ext/pcre Tag: ORIG config.m4 php_pcre.c
               ext/pgsql Tag: ORIG pgsql.c php_pgsql.h
               ext/rpc  Tag: ORIG handler.h layer.h php_rpc.h rpc.c rpc.h
                        rpc_proxy.c rpc_proxy.h
               ext/rpc/com Tag: ORIG com.c com.h com_wrapper.c
                        com_wrapper.h conversion.c conversion.h dispatch.c
                        variant.c variant.h
               ext/snmp Tag: ORIG snmp.c
               ext/sockets Tag: ORIG sockets.c
               ext/standard Tag: ORIG aggregation.c array.c assert.c
                        basic_functions.c browscap.c config.m4 credits.c
                        cyr_convert.c datetime.c dir.c dl.c dns.c exec.c
                        file.c file.h filestat.c formatted_print.c fsock.c
                        ftok.c ftp_fopen_wrapper.c head.c html.c
                        http_fopen_wrapper.c image.c incomplete_class.c
                        iptc.c levenshtein.c md5.c parsedate.y
                        php_incomplete_class.h php_standard.h php_string.h
                        string.c type.c versioning.c
               ext/wddx Tag: ORIG wddx.c
               ext/xmlrpc Tag: ORIG config.m4 php_xmlrpc.h xmlrpc-epi-php.c
               ext/xmlrpc/libxmlrpc Tag: ORIG encodings.c queue.c
                        simplestring.c simplestring.h system_methods.c
                        xml_element.c xml_to_soap.c xml_to_xmlrpc.c
                        xmlrpc.c xmlrpc.h xmlrpc_introspection.c
                        xmlrpc_private.h
               ext/xslt Tag: ORIG sablot.c
               ext/yaz  Tag: ORIG config.m4 php_yaz.c php_yaz.h
               ext/zlib Tag: ORIG php_zlib.h zlib.c
               main     Tag: ORIG SAPI.c SAPI.h config.w32.h.in main.c
                        network.c php_content_types.c php_ini.c php_main.h
                        php_network.h php_variables.c rfc1867.c rfc1867.h
                        safe_mode.c
               pear     Tag: ORIG Makefile.frag PEAR.php System.php
                        install-pear.php package-PEAR.xml package.dtd
               pear/Archive Tag: ORIG Tar.php
               pear/Console Tag: ORIG Getopt.php
               pear/File Tag: ORIG Passwd.php
               pear/PEAR Tag: ORIG Builder.php Common.php Config.php
                        Dependency.php Installer.php Packager.php
                        Registry.php Remote.php
               pear/PEAR/Command Tag: ORIG Install.php Package.php
               pear/PEAR/Frontend Tag: ORIG CLI.php
               pear/scripts Tag: ORIG pear.bat pear.in
               pear/tests Tag: ORIG pear_registry.phpt
               sapi/apache Tag: ORIG config.m4
               sapi/apache2filter Tag: ORIG config.m4
               sapi/cgi Tag: ORIG cgi_main.c config.m4
               sapi/cli Tag: ORIG config.m4 php_cli.c
               sapi/pi3web Tag: ORIG pi3web_sapi.c
               sapi/thttpd Tag: ORIG README thttpd.c thttpd_patch
               sapi/tux Tag: ORIG php_tux.c
               sapi/webjames Tag: ORIG webjames.c
               tests/func Tag: ORIG 006.phpt
               win32    Tag: ORIG php4dllts.dsp readdir.c readdir.h
  Log:
  Recent cvs.php.net changes
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +2 -0      php4/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/.cvsignore,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- .cvsignore	19 May 2002 11:16:02 -0000	1.2.2.1
  +++ .cvsignore	3 Aug 2002 00:44:11 -0000	1.2.2.2
  @@ -3,9 +3,11 @@
   Makefile
   acconfig.h
   aclocal.m4
  +autom4te.cache
   bsd_converted
   buildmk.stamp
   buildconf.stamp
  +config.h.in
   config.cache
   config.log
   config.status
  
  
  
  1.2.2.6   +1741 -0   php4/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ChangeLog,v
  retrieving revision 1.2.2.5
  retrieving revision 1.2.2.6
  diff -u -r1.2.2.5 -r1.2.2.6
  --- ChangeLog	9 Jul 2002 09:14:29 -0000	1.2.2.5
  +++ ChangeLog	3 Aug 2002 00:44:11 -0000	1.2.2.6
  @@ -1,3 +1,1744 @@
  +2002-08-02  jflemer  <jflem****@pb1*****>
  +
  +    * ext/standard/exec.c: Fix typo in #if. Bug #17538.
  +
  +2002-08-02  helly  <helly****@pb1*****>
  +
  +    * ext/mbstring/mbfilter.c
  +      ext/mbstring/mbfilter.h
  +      ext/mbstring/mbregex.c
  +      ext/mbstring/mbstring.c
  +      ext/mbstring/mbstring.h
  +      main/rfc1867.c: -use const to clarify code
  +    -fix tsrmls build (therefore rfc1867.c)
  +
  +2002-08-02  hholzgra  <hholz****@pb1*****>
  +
  +    * ext/standard/basic_functions.c
  +      ext/standard/config.m4
  +      ext/standard/php_string.h
  +      ext/standard/string.c: added money_format() function
  +    this is similar to C-libs strfmon(), using the same format string
  +    semantics but a different function prototype, so i decided to
  +    give it a more speaking name similar to number_format()
  +
  +2002-08-02  gluke  <gluke****@pb1*****>
  +
  +    * ext/mnogosearch/php_mnogo.c:
  +    - UDM_PARAM_WORD_MATCH icorrect behavior has been fixed in
  +      mnogosearch extension
  +
  +2002-08-02  hirokawa  <hirok****@pb1*****>
  +
  +    * ext/standard/string.c
  +      main/SAPI.c
  +      main/SAPI.h
  +      main/main.c
  +      main/php_content_types.c
  +      main/php_main.h
  +      main/php_variables.c
  +      main/rfc1867.c
  +      ext/mbstring/mbstring.c
  +      ext/mbstring/mbstring.h:
  +    made sapi_register_treat_data() to support multibyte input encoding translation without MBSTR_ENC_TRANS and changed php_treat_data to php_default_treat_data.
  +
  +2002-08-01  sr  <sr****@pb1*****>
  +
  +    * main/SAPI.c: Fixed wrong usage of strncmp.
  +
  +2002-08-01  rodif_bl  <rodif_bl****@pb1*****>
  +
  +    * ext/standard/array.c: array_pop wasnt setting next index
  +
  +2002-08-01  sniper  <snipe****@pb1*****>
  +
  +    * ext/standard/array.c: That was not correct..
  +
  +    * ext/standard/array.c: Reset index when doing array_pop()
  +
  +    * ext/standard/tests/array/006.phpt: Add test for the index resetting.
  +
  +2002-08-01  Rasmus Lerdorf  <rasmu****@pb1*****>
  +
  +    * ext/standard/exec.c: Ugh
  +
  +2002-08-01  kalowsky  <kalow****@pb1*****>
  +
  +    * ext/imap/php_imap.c:
  +    Adding in some BC for users to imap_get_quota() function
  +
  +2002-08-01  sniper  <snipe****@pb1*****>
  +
  +    * ext/standard/tests/array/005.phpt
  +      ext/standard/tests/array/006.phpt:
  +    Added tests for array_shift/array_pop.
  +
  +    * ext/standard/array.c: Nuke compile warning.
  +
  +    * ext/standard/array.c: - Removed the DOS line endings
  +    - Changed the '//' comment (this is C, not C++) to /* */
  +
  +    * tests/func/006.phpt:
  +    Fix the levels. (php.ini-dist has output_buffering OFF)
  +
  +    * tests/lang/034.phpt: Use the constant instead of string for locale type.
  +
  +2002-08-01  Sascha Schumann  <sas****@pb1*****>
  +
  +    * ext/pgsql/config.m4: MFH *.a check
  +
  +2002-08-01  helly  <helly****@pb1*****>
  +
  +    * main/SAPI.c:
  +    - free mimetype and statusline early if no longer needed or in deactivation
  +
  +2002-08-01  Rasmus Lerdorf  <rasmu****@pb1*****>
  +
  +    * main/SAPI.c: Need room for the \0 here to avoid an overflow
  +
  +2002-08-01  Zeev Suraski  <zeev****@pb1*****>
  +
  +    * ext/mbstring/mbstring.c: MFH per Rui's request
  +
  +2002-08-01  rodif_bl  <rodif_bl****@pb1*****>
  +
  +    * ext/standard/array.c:
  +    made array_shift re-index like it did before previous fix
  +
  +2002-08-01  yohgaki  <yohga****@pb1*****>
  +
  +    * main/php_variables.c: MFH
  +    Cannot take NULL w/o mbstring.
  +
  +2002-07-31  jason  <jason****@pb1*****>
  +
  +    * NEWS: perhaps this tiem i will get it right
  +
  +    * NEWS: Fix unwrapped entry
  +
  +    * NEWS: Fix my broken entry
  +
  +2002-07-31  Sterling Hughes  <sterl****@pb1*****>
  +
  +    * ext/curl/curl.c: add support for the curl dns cache
  +
  +2002-07-31  helly  <helly****@pb1*****>
  +
  +    * ext/exif/exif.c: -fix warnings in windows build
  +
  +    * main/SAPI.c: -problem with CLI/mbstring/output buffering
  +
  +2002-07-31  Zeev Suraski  <zeev****@pb1*****>
  +
  +    * main/php_variables.c: Fix for non-mbstring builds.  Bad Yasuo! :)
  +
  +    * ext/mbstring/mbstring.c: Fix crash
  +
  +2002-07-31  kalowsky  <kalow****@pb1*****>
  +
  +    * ext/odbc/php_odbc_includes.h: WS
  +
  +    * ext/odbc/php_odbc.c:
  +    Just adding in an error check that seems to work here well.
  +
  +2002-07-31  sniper  <snipe****@pb1*****>
  +
  +    * ext/standard/array.c:
  +    Reverted the patch..it breaks the original behaviour of at least array_shift.
  +
  +2002-07-31  kalowsky  <kalow****@pb1*****>
  +
  +    * ext/imap/php_imap.c
  +      ext/imap/php_imap.h:
  +    removing the useless +1's on sizeof() and adding the mail_parameter for the
  +    getquot inside the imap_get_quotaroot function.  thank Jani.
  +
  +2002-07-30  kalowsky  <kalow****@pb1*****>
  +
  +    * ext/imap/php_imap.c:
  +    fixes a typo in the word "limit", adds the null character to the strlen,
  +    and seems to make imap_get_quotaroot return the correct values despite
  +    cclients claim of "getquotaroot list improper".
  +
  +2002-07-30  rodif_bl  <rodif_bl****@pb1*****>
  +
  +    * ext/standard/array.c: fixed bugs 16063 and 16068
  +    increased preformance of array_pop and array_shift
  +
  +2002-07-30  sesser  <sesse****@pb1*****>
  +
  +    * ext/ftp/php_ftp.c:
  +    ftp_close returns now TRUE on success and FALSE on failure.
  +
  +2002-07-30  kalowsky  <kalow****@pb1*****>
  +
  +    * ext/standard/filestat.c:
  +    Commiting Steph****@php*****'s patch to re-enable touch on Win32 machines
  +
  +2002-07-30  Rasmus Lerdorf  <rasmu****@pb1*****>
  +
  +    * ext/ext_skel: Add --skel=dir option to ext_skel (patch from David Viner)
  +
  +    * ext/standard/parsedate.y
  +      NEWS: Fix strtotime() "next" keyword handling.
  +
  +    * NEWS: WTF?  What sort of bogus commit was that?  Fine, here you go.
  +
  +2002-07-30  sniper  <snipe****@pb1*****>
  +
  +    * NEWS: .
  +
  +2002-07-30  Rasmus Lerdorf  <rasmu****@pb1*****>
  +
  +    * NEWS: .
  +
  +    * ext/standard/string.c: Fix for #18638  (str_rot13 bug)
  +
  +2002-07-30  dickmeiss  <dickm****@pb1*****>
  +
  +    * ext/yaz/php_yaz.c: Fixed proxy setting for ZOOM
  +
  +2002-07-30  sniper  <snipe****@pb1*****>
  +
  +    * NEWS: hot, damn hot.
  +
  +2002-07-29  Sterling Hughes  <sterl****@pb1*****>
  +
  +    * ext/xslt/sablot.c: add sablotron version, patch by Christian Stocker...
  +
  +2002-07-29  dickmeiss  <dickm****@pb1*****>
  +
  +    * ext/yaz/php_yaz.c: Make PHP part of Z39.50 implementation name
  +
  +    * ext/yaz/php_yaz.c: Use type ext rather than raw for ZOOM record fetch
  +
  +2002-07-29  kalowsky  <kalow****@pb1*****>
  +
  +    * NEWS: updating the NEWS file
  +
  +2002-07-29  chregu  <chreg****@pb1*****>
  +
  +    * ext/domxml/php_domxml.c:
  +    - nodename is not always set, check if it really is.
  +    - make force_ref for aliases as well
  +
  +2002-07-29  edink  <edink****@pb1*****>
  +
  +    * win32/php4dllts.dsp:
  +    Fixed windows build by adding sha1.c and sha1.h to the project file.
  +
  +    * ext/standard/dir.c: Fixed bug #14657 (patch by Steph Fox)
  +
  +    * win32/readdir.c
  +      win32/readdir.h: Fixed bug #11214 (patch by Steph Fox)
  +
  +    * main/php_ini.c:
  +    First try to open php-SAPI.ini and if it fails fall back to regular
  +    php.ini file. For example cli version of PHP will first try to open
  +    php-cli.ini in the usual ini file search path and only if it fails
  +    will it try to open php.ini using the same path.
  +
  +2002-07-29  Sascha Schumann  <sas****@pb1*****>
  +
  +    * NEWS: style police
  +
  +2002-07-29  sniper  <snipe****@pb1*****>
  +
  +    * sapi/apache/config.m4
  +      sapi/apache2filter/config.m4
  +      acinclude.m4: MFH: Fix for Apache version check.
  +
  +2002-07-28  sniper  <snipe****@pb1*****>
  +
  +    * ext/mbstring/mbstring.c: MFH
  +
  +2002-07-28  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/xmlrpc/config.m4: FHM
  +
  +    * ext/xmlrpc/config.m4:
  +    Allow xmlrpc-epi header files stored under include/xmlrpc-epi
  +
  +2002-07-28  derick  <deric****@pb1*****>
  +
  +    * ext/standard/md5.c
  +      ext/standard/sha1.c: - Copy and paste error -> unify error messages
  +
  +2002-07-28  sesser  <sesse****@pb1*****>
  +
  +    * ext/standard/basic_functions.c
  +      ext/standard/config.m4
  +      ext/standard/php_standard.h
  +      ext/standard/sha1.c
  +      ext/standard/sha1.h: Added sha1, sha1_file functions.
  +
  +    * ext/standard/filestat.c: MFH 2
  +
  +    * ext/standard/filestat.c: MFH
  +
  +2002-07-28  helly  <helly****@pb1*****>
  +
  +    * php.ini-dist
  +      php.ini-recommended: -add & document ini settings for exif
  +
  +    * ext/exif/exif.c: -decode several MarkerNotes
  +    -correct offset information in debug mode
  +
  +2002-07-28  tal  <tal****@pb1*****>
  +
  +    * pear/scripts/pear.in: * Fixed E_NOTICE on pear -V
  +
  +2002-07-28  sesser  <sesse****@pb1*****>
  +
  +    * NEWS: (re)added /ext/ftp news
  +
  +2002-07-28  sr  <sr****@pb1*****>
  +
  +    * main/SAPI.c
  +      ext/zlib/php_zlib.h
  +      ext/zlib/zlib.c:
  +    Commit patch as discussed on LinuxTag and posted to php-dev in June.
  +    Disables zlib.output_compression for scripts with image/ content-type
  +    header (fixes bug #16109) and makes it possible to switch
  +    zlib.output_compression during script execution before the headers are
  +    sent.
  +
  +2002-07-28  sniper  <snipe****@pb1*****>
  +
  +    * NEWS: - Removed the 2 last entries.
  +
  +    * README.CVS-RULES: No exceptions.
  +
  +2002-07-28  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/pgsql/pgsql.c: Unify error messages
  +
  +2002-07-28  helly  <helly****@pb1*****>
  +
  +    * ext/gd/gd.c: forgot to move imeageellipse out of #ifdef HAVE_LIBGD20
  +
  +2002-07-28  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/mbstring/mbstring.c: MFH
  +
  +    * ext/mbstring/mbstring.c:
  +    Fixed query string handling. Now some.php?a&b=1;c works.
  +
  +    * main/php_variables.c: MFH
  +
  +2002-07-28  tal  <tal****@pb1*****>
  +
  +    * pear/scripts/pear.in:
  +    pear -V now shows pear version, php version and ZE version.
  +
  +2002-07-28  Stig Bakken  <ssb****@pb1*****>
  +
  +    * pear/package-PEAR.xml: * feature/fixed bug
  +
  +    * pear/PEAR/Command/Install.php: * added "upgrade-all" command
  +
  +    * pear/PEAR/Installer.php:
  +    * don't abort install if errors are found in the package, display
  +      a warning instead
  +
  +2002-07-28  yohgaki  <yohga****@pb1*****>
  +
  +    * main/php_variables.c:
  +    Fixed some.php?a&b&c does not initilize $_GET['a'], $_GET['b'], $_GET['c']
  +    when mbstr-enc-trans is disabled.
  +
  +2002-07-27  phanto  <phant****@pb1*****>
  +
  +    * win32/php4dllts.dsp: add dispatch.c
  +
  +2002-07-27  hirokawa  <hirok****@pb1*****>
  +
  +    * ext/mbstring/mbstring.c
  +      main/SAPI.c
  +      main/SAPI.h:
  +    fixed: output encoding translation by mb_output_handler() in ext/mbstring was not usable when Content-Type is set by header().
  +
  +2002-07-27  sesser  <sesse****@pb1*****>
  +
  +    * ext/ftp/ftp.c: Do not leak data connection.
  +
  +2002-07-26  sniper  <snipe****@pb1*****>
  +
  +    * ext/curl/curl.c:
  +    - Fix bug: #18509, e.g. setting CURLOPT_BINARYTRANSFER succeeds always.
  +    - Also set the binary mode ONLY if the passed value is true..
  +
  +2002-07-26  fmk  <fmk****@pb1*****>
  +
  +    * ext/ftp/ftp.c: Fizing ZTS build
  +
  +2002-07-26  sesser  <sesse****@pb1*****>
  +
  +    * ext/ftp/ftp.c
  +      ext/ftp/ftp.h
  +      ext/ftp/php_ftp.c
  +      ext/ftp/php_ftp.h:
  +    [EXPERIMENTAL] Added functions for asynchronous FTP transfers
  +
  +2002-07-26  helly  <helly****@pb1*****>
  +
  +    * ext/exif/exif.c: Missing Photoshop tags
  +
  +2002-07-26  kalowsky  <kalow****@pb1*****>
  +
  +    * ext/imap/php_imap.c: forgot to make the same change to imap_get_quota...
  +
  +    * ext/imap/php_imap.c: Minor memory fix suggested by Zeev
  +
  +2002-07-26  georg  <georg****@pb1*****>
  +
  +    * ext/standard/datetime.c: Bugfix: #18532
  +    Fixed week number calculation in accordance with ISO 8601
  +
  +2002-07-26  sesser  <sesse****@pb1*****>
  +
  +    * ext/ftp/php_ftp.c: fixed cut & paste typo
  +
  +2002-07-26  kalowsky  <kalow****@pb1*****>
  +
  +    * ext/imap/php_imap.c
  +      ext/imap/php_imap.h: Adding initial support for PHP imap_get_quotaroot
  +
  +    * ext/imap/php_imap.c
  +      ext/imap/php_imap.h:
  +    (PHP imap_get_quota) updated to properly reflect the RFC 2087 as per
  +     bug #14673
  +       per RFC 2087, closes bug #14673 (kalowsky, Sander Steffann)
  +
  +2002-07-26  Sascha Schumann  <sas****@pb1*****>
  +
  +    * sapi/thttpd/thttpd_patch: Fix segfault due to unchecked null pointer
  +
  +2002-07-26  Tomas V.V.Cox  <cox****@pb1*****>
  +
  +    * pear/Archive/Tar.php:
  +    In theory this will fix a problem in Window trying to delete a not closed
  +    file
  +
  +
  +2002-07-26  helly  <helly****@pb1*****>
  +
  +    * ext/gd/gd.c:
  +    reapply patch for imageellipse beeing wrappet to imagearc if missing
  +
  +2002-07-26  sesser  <sesse****@pb1*****>
  +
  +    * ext/ftp/CREDITS
  +      ext/ftp/ftp.c
  +      ext/ftp/ftp.h
  +      ext/ftp/php_ftp.c
  +      ext/ftp/php_ftp.h:    Added (Auto)Resuming functionality to ftp_(f)get/(f)put via optional 5th parameter.
  +
  +2002-07-26  Tomas V.V.Cox  <cox****@pb1*****>
  +
  +    * pear/scripts/pear.bat:
  +    use -d output_buffer=0 to workarround the PHP flush() problem
  +
  +    * pear/PEAR/Installer.php: download package if force is set
  +
  +    * pear/package-PEAR.xml: revert my change from PHP_BINDIR to bin_dir
  +
  +    * pear/package-PEAR.xml:
  +    Use install-as attrib for pear.bat too, so it gets installed in @bin_dir@
  +
  +    * pear/scripts/pear.bat: Use script arg separator '--'
  +    Clean up unused stuff
  +
  +    * pear/PEAR/Config.php: Use DIRECTORY_SEPARATOR instead of hardcoded '/'
  +
  +    * pear/System.php: Workarround to the empty $_ENV
  +
  +    * pear/Console/Getopt.php: use $GLOBALS['HTTP_SERVER_VARS'] instead
  +
  +    * pear/Console/Getopt.php: Silence NOTICE
  +
  +2002-07-26  sesser  <sesse****@pb1*****>
  +
  +    * ext/standard/filestat.c:
  +    all functions based on php_stat are now safe mode aware...
  +
  +2002-07-26  sniper  <snipe****@pb1*****>
  +
  +    * NEWS: When Britney learns to sing, I will quit this..
  +
  +2002-07-25  sniper  <snipe****@pb1*****>
  +
  +    * acinclude.m4
  +      sapi/apache/config.m4:
  +    - Fixed bug: #18560, the macro was not defined always.
  +
  +    * configure.in: MFH: fix bug #18570
  +
  +    * main/main.c:
  +    Allow setting post_max_size and upload_max_filesize in .htaccess files too
  +
  +    * ext/imap/config.m4: Fixed bug: #18561.
  +
  +2002-07-25  derick  <deric****@pb1*****>
  +
  +    * ext/standard/basic_functions.c:
  +    - Added parameter to print_r which returns the variable representation
  +      instead of echoing it.
  +    - Added parameter to print_r which returns the variable representation
  +      instead of echoing it. 
  +
  +2002-07-25  sesser  <sesse****@pb1*****>
  +
  +    * main/main.c: MFH
  +
  +    * main/main.c: do not dtor empty elements
  +
  +2002-07-25  derick  <deric****@pb1*****>
  +
  +    * ext/tokenizer/tokenizer.c: - MFH for fix for bug #16939
  +
  +2002-07-25  helly  <helly****@pb1*****>
  +
  +    * ext/exif/exif.c:
  +    -handling of thumbnails in sub IFDs (the Photoshopway for TIFF)
  +    -Some Photoshop specific tags
  +
  +2002-07-24  sesser  <sesse****@pb1*****>
  +
  +    * main/php_variables.c: MFH
  +
  +    * main/php_variables.c: break out if there is no data to work on.
  +
  +2002-07-24  derick  <deric****@pb1*****>
  +
  +    * ext/standard/head.c: - MFH for fix for bug #16626
  +
  +    * main/SAPI.c: - MFH for fix for bug #18268
  +
  +2002-07-24  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/standard/incomplete_class.c
  +      ext/standard/php_incomplete_class.h
  +      ext/standard/type.c:
  +    is_object() returns FALSE if object is a "incomplete object".
  +    Raise E_NOTICE, instead of E_ERROR, for setting/getting properties
  +    to/from a "incomplete object".
  +
  +2002-07-24  steinm  <stein****@pb1*****>
  +
  +    * ext/hyperwave/hw.c: - removed unused variable
  +
  +2002-07-24  helly  <helly****@pb1*****>
  +
  +    * ext/exif/exif.c: -naming convention
  +    -better notices
  +    -(D)WORD are unsigned datatypes
  +    -started to split tygs into different arrays that would allow to handle vendor specific tags after detection of their markers
  +
  +2002-07-23  Jim Winstead  <jimw****@pb1*****>
  +
  +    * ext/standard/credits.c:
  +    restore shane to list of members of php group (got lost somewhere along the way)
  +
  +2002-07-23  holger  <holge****@pb1*****>
  +
  +    * sapi/pi3web/pi3web_sapi.c:
  +    Removed some outdated lines from init_request_info().
  +
  +2002-07-23  Sascha Schumann  <sas****@pb1*****>
  +
  +    * configure.in
  +      main/php_version.h: Working on 4.2.3 now
  +
  +    * .cvsignore: Add autom4te.cache
  +
  +    * ext/dbx/dbx.c: MFH remove \r
  +
  +    * ext/dbx/dbx.c: Remove \r
  +
  +2002-07-23  edink  <edink****@pb1*****>
  +
  +    * ext/pcre/config.m4: MFB (patch by Troels Arvin <troel****@arvin*****>).
  +    Added pcre include path to global list of includes in order to allow
  +    use of external pcre libs.
  +
  +    * ext/pcre/config.m4:
  +    Allow pcre.h to be in $PREFIX/include/pcre since this is the case
  +    with some Linux distributions (patch by Troels Arvin <troel****@arvin*****>).
  +
  +2002-07-23  sniper  <snipe****@pb1*****>
  +
  +    * configure.in: Fix bug: #18308. (uname -a sometimes has extra linefeeds)
  +
  +    * configure.in:
  +    This should fix those solaris+gcc bugs when --enable-libgcc is not used
  +
  +    * ext/gd/config.m4:
  +    Fix bug: #18479. Better error message what was not found.
  +
  +    * NEWS: <insert funny comment here>
  +
  +2002-07-22  jan  <jan****@pb1*****>
  +
  +    * ext/standard/datetime.c:
  +     - merge forgotten WS fix which makes non gcc compilers groan. (#17621)
  +
  +2002-07-22  jmoore  <jmoor****@pb1*****>
  +
  +    * NEWS: Added news item about bug 13866 in response to bug 14752
  +
  +2002-07-22  jason  <jason****@pb1*****>
  +
  +    * ext/ftp/ftp.c
  +      ext/standard/fsock.c
  +      ext/standard/ftp_fopen_wrapper.c
  +      ext/standard/http_fopen_wrapper.c
  +      main/network.c
  +      main/php_network.h:
  +    Switch streams socket abstraction to use a timeval structure instead of an
  +    integer to allow subsecond timeouts.
  +
  +    This supports the previous behavior of fsockopen()
  +    Fixes bug #16261
  +
  +2002-07-22  helly  <helly****@pb1*****>
  +
  +    * ext/exif/exif.c: added some more tags from WinXP
  +    changed conersion for TAG_FMT_SBYTE & BYTE
  +
  +2002-07-22  Tomas V.V.Cox  <cox****@pb1*****>
  +
  +    * pear/install-pear.php:
  +    By the moment trust that the dependencies are good
  +
  +2002-07-22  helly  <helly****@pb1*****>
  +
  +    * ext/exif/exif.c: added EXIF Version 2.2 Tags
  +
  +2002-07-22  Tomas V.V.Cox  <cox****@pb1*****>
  +
  +    * pear/packages/Net_Socket-1.0.1.tar:
  +    Bundle Net_socket, needed for Net_SMTP
  +
  +2002-07-22  sniper  <snipe****@pb1*****>
  +
  +    * ext/informix/ifx.ec: Fix typo..
  +
  +2002-07-22  georg  <georg****@pb1*****>
  +
  +    * NEWS: new mysql-functions for PHP 4.3.0
  +
  +2002-07-22  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/pgsql/pgsql.c: Copy empty_string, fixed crash.
  +
  +2002-07-21  helly  <helly****@pb1*****>
  +
  +    * ext/exif/exif.c: unify error messages & notices
  +
  +2002-07-21  georg  <georg****@pb1*****>
  +
  +    * ext/mysql/php_mysql.c: Automatic rollback for non committed transactions
  +
  +    * ext/mysql/php_mysql.c:
  +    removed changes for mysql_select_db (optional parameter)
  +
  +    Why:
  +    1) Its not the common way to add additionally functionality for functions or
  +    features which are already implemented in SQL. Therefore also a lot of
  +    mysql functions are marked as deprecated (and will be removed in near future)
  +
  +    2) The implemented workaround works only when mysql_select_db was called
  +    before (fetching the databasename from mysql->conn.db). It returns invalid
  +    or inconsistent results e.g.:
  +
  +    - when "USE databasename" via mysql_query was used
  +    - when database was dropped or grant privileges had changed.
  +
  +    In conjunction with persistent connection, there are also some inconsistencies,
  +    cause mysql_select_db returns the databasename from an old connection.
  +
  +    To determine the database name just use the SQL command "SELECT DATABASE()"
  +
  +    * ext/mysql/php_mysql.c: fixed bug in mysql_real_escape_string:
  +    allocated 1 more byte for '\0' terminating character
  +
  +2002-07-21  Stig Bakken  <ssb****@pb1*****>
  +
  +    * LICENSE: * yeah yeah
  +
  +    * LICENSE:
  +    * split #3 into two paragraphs again, like the Apache license we once
  +      borrowed it from
  +
  +2002-07-21  markonen  <marko****@pb1*****>
  +
  +    * acinclude.m4
  +      sapi/cgi/config.m4
  +      sapi/cli/config.m4:
  +    Made PHP_ADD_LIBPATH use the $ld_runpath_switch and changed the Darwin
  +    link lines in sapi/cli and sapi/cgi to use $NATIVE_RPATHS.
  +    This is a tentative fix for #18450.
  +
  +2002-07-21  Sascha Schumann  <sas****@pb1*****>
  +
  +    * build/build.mk
  +      build/buildcheck.sh
  +      buildconf:
  +    Move autoconf-2.13 check into buildcheck.sh where we already have
  +    version parsing code and (more importantly) proper error checking
  +    for missing autoconf.
  +
  +    * build/build2.mk: One should not ignore
  +
  +    AC_PROG_CPP was called before AC_PROG_CC
  +
  +    because this error caused the Solaris issue
  +
  +2002-07-21  derick  <deric****@pb1*****>
  +
  +    * configure.in: - Merges sascha's fix
  +
  +2002-07-21  Sascha Schumann  <sas****@pb1*****>
  +
  +    * configure.in: Fix warning
  +
  +    Noticed by: Derick
  +
  +2002-07-21  Stig Bakken  <ssb****@pb1*****>
  +
  +    * pear/packages/Mail-1.0.tar
  +      pear/packages/Net_SMTP-1.0.tar: * bundle these releases
  +
  +    * pear/Mail.php
  +      pear/package-Mail.xml: * moved to /pear cvs
  +
  +2002-07-21  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/pgsql/pgsql.c
  +      ext/pgsql/php_pgsql.h:
  +    Added pg_fetch_all() that fetch all rows in result.
  +    Useful and faster when there is enough memory.
  +
  +2002-07-21  Stig Bakken  <ssb****@pb1*****>
  +
  +    * pear/HTTP.php: * already moved to /pear
  +
  +    * pear/PEAR/Dependency.php: * support "zend" dependency type
  +
  +    * pear/package-Net_SMTP.xml: * moved to /pear cvs
  +
  +    * pear/package.dtd: * added missing license element
  +    * added "zend" dependency type
  +
  +    * pear/PEAR.php: * always enable track_errors
  +    * added throwError method (simpler version of raiseError)
  +
  +    * LICENSE: * license out of "alpha"
  +
  +2002-07-20  derick  <deric****@pb1*****>
  +
  +    * NEWS: - Typos
  +
  +    * configure.in: - Merge Sascha's builds tools fix
  +
  +    * main/rfc1867.c:
  +    - Merge Stefans patch that fixes the remote vulnarability
  +
  +    * NEWS
  +      configure.in
  +      main/php_version.h: - Update NEWS and version numbers
  +
  +2002-07-20  James Cox  <imaje****@pb1*****>
  +
  +    * buildconf: proper patch to cvsclean for bad autoconf.
  +
  +2002-07-20  Sascha Schumann  <sas****@pb1*****>
  +
  +    * configure.in:
  +    MFH fix for wrongly detected CPP on platforms such as Solaris where
  +    a package might be installed which actually does not contain a real
  +    compiler.
  +
  +2002-07-20  sniper  <snipe****@pb1*****>
  +
  +    * NEWS: I love rock'n'roll...laalalaa (britney sucks)
  +
  +2002-07-20  Sascha Schumann  <sas****@pb1*****>
  +
  +    * buildconf: reverse bad patch
  +
  +    james, when you send me email about your patch which does not work,
  +    why don't you wait for a reply first before committing the non-working
  +    stuff?
  +
  +2002-07-20  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/pgsql/pgsql.c: Fixed php_pgsql_convert's bool type handling.
  +
  +    * ext/pgsql/pgsql.c: Hmm. My PostgreSQL returns "bool" for boolean now.
  +
  +    * ext/pgsql/pgsql.c:
  +    Fixed convetion when null string is passed to php_pgsql_convert()
  +
  +    * ext/pgsql/pgsql.c: Fixed crash.
  +
  +2002-07-20  James Cox  <imaje****@pb1*****>
  +
  +    * buildconf:
  +    more work for buildconf. forces a cvsclean if using a bad am. more ZE/zE2 tests.
  +
  +2002-07-20  Sascha Schumann  <sas****@pb1*****>
  +
  +    * acinclude.m4
  +      configure.in: Improve/fix handling of --disable-rpath
  +
  +    Might or might not fix #18374
  +
  +2002-07-19  jason  <jason****@pb1*****>
  +
  +    * main/network.c
  +      main/php_network.h: Fix feof() on win32
  +    Bug #18436
  +
  +2002-07-19  sniper  <snipe****@pb1*****>
  +
  +    * main/network.c: ws fix
  +
  +2002-07-19  phanto  <phant****@pb1*****>
  +
  +    * ext/rpc/com/com_wrapper.c
  +      ext/rpc/skeleton/skeleton.c
  +      ext/rpc/skeleton/skeleton.h
  +      ext/rpc/com/com.c
  +      ext/rpc/handler.h
  +      ext/rpc/rpc.c: - added a skeleton for new layers
  +    - a bit cleanup
  +
  +2002-07-19  yohgaki  <yohga****@pb1*****>
  +
  +    * php.ini-recommended
  +      php.ini-dist: MFH
  +
  +    * php.ini-dist
  +      php.ini-recommended:
  +    This option should be left enabled by default by mistake.
  +    --enable-trans-sid option is removed and this option should
  +    be disabled by default in php.ini.
  +
  +    1) It's insecure by nature
  +    2) It may not work well always
  +    3) It wasn't enabled by default used be
  +    4) It risks security and user should enable it after realizing
  +       it's security risks.
  +
  +2002-07-19  derick  <deric****@pb1*****>
  +
  +    * ext/ircg/ircg.c
  +      ext/interbase/interbase.c
  +      ext/informix/ifx.ec
  +      ext/iconv/iconv.c: Unify error messages
  +
  +2002-07-18  phanto  <phant****@pb1*****>
  +
  +    * ext/rpc/com/conversion.h
  +      ext/rpc/com/dispatch.c
  +      ext/rpc/com/php_com.h
  +      ext/rpc/com/php_variant.h
  +      ext/rpc/com/variant.c
  +      ext/rpc/com/variant.h
  +      ext/rpc/com/com.c
  +      ext/rpc/com/com.h
  +      ext/rpc/com/com_wrapper.c
  +      ext/rpc/com/com_wrapper.h
  +      ext/rpc/com/conversion.c
  +      ext/rpc/handler.h
  +      ext/rpc/hash.h
  +      ext/rpc/layer.h
  +      ext/rpc/php_rpc.h
  +      ext/rpc/rpc.c
  +      ext/rpc/rpc.h
  +      ext/rpc/rpc_proxy.c
  +      ext/rpc/rpc_proxy.h:
  +    ext/rpc/com should work now, but there's still lots of work left.
  +
  +2002-07-18  yohgaki  <yohga****@pb1*****>
  +
  +    * php.ini-dist
  +      php.ini-recommended: Move down open_basedir description.
  +
  +2002-07-17  sniper  <snipe****@pb1*****>
  +
  +    * configure.in:
  +    We have a macro for checking -R, etc. switches. (exactly same code)
  +
  +2002-07-17  Andrei Zmievski  <andre****@pb1*****>
  +
  +    * ext/wddx/wddx.c: Fix DL entry point.
  +
  +2002-07-17  sniper  <snipe****@pb1*****>
  +
  +    * ext/gd/config.m4: Remove evil quotes
  +
  +2002-07-17  chregu  <chreg****@pb1*****>
  +
  +    * ext/domxml/TODO: even more items on the TODO list
  +
  +    * ext/domxml/php_domxml.c:
  +    nodename is not always set, check if it really is.
  +
  +2002-07-17  hholzgra  <hholz****@pb1*****>
  +
  +    * tests/lang/034.phpt
  +      tests/lang/035.phpt:
  +    Zend Engine behaviour is affected by setlocale() due to use of
  +    locale aware functions like strtod(), atof(), tolower(), toupper() :(
  +
  +2002-07-17  derick  <deric****@pb1*****>
  +
  +    * main/main.c:
  +    - set_time_limit() now returns whether it succeeded in changing the time
  +      limit.
  +
  +2002-07-17  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/pgsql/pgsql.c: Fixed build.
  +
  +2002-07-17  sniper  <snipe****@pb1*****>
  +
  +    * ext/mbstring/config.m4: unbreak the shared build..again
  +
  +2002-07-17  yohgaki  <yohga****@pb1*****>
  +
  +    * main/safe_mode.c: Accoding to safe_mode.h, php_checkuid() has six modes.
  +
  +    * ext/pgsql/pgsql.c:
  +    Added safe_mode & open_basedir checks for pg_lo_export()
  +
  +    * ext/pgsql/pgsql.c: Added open_basedir check.
  +
  +    * php.ini-dist
  +      php.ini-recommended:
  +    Fixed open_basedir note - thanks to Sander. I also notice I have to modify pg_lo_import(), etc. It does not check open_basedir at all. It checks UID/GID, though. We are better to note how we should treat files in coding standard.
  +
  +    * ext/mbstring/config.m4:
  +    Changed configure option order to make it clear option dependecy to users.
  +
  +    * ext/mbstring/config.m4: Disable input encoding tranlation by default.
  +
  +    * php.ini-recommended
  +      php.ini-dist: Added note for open_basedir
  +
  +2002-07-16  sniper  <snipe****@pb1*****>
  +
  +    * NEWS: This is the real world..
  +
  +    * ext/mysql/php_mysql.c: fix protos
  +
  +2002-07-16  Sascha Schumann  <sas****@pb1*****>
  +
  +    * sapi/thttpd/README
  +      ext/ircg/README.txt: refine
  +
  +2002-07-16  georg  <georg****@pb1*****>
  +
  +    * NEWS: added mysql changes:
  +    - php.ini option mysql.connect_timeout
  +    - optional parameter client_flags (mysql_connect, mysql_pconnect)
  +    - automatic rollback for non commited transactions
  +
  +2002-07-16  jason  <jason****@pb1*****>
  +
  +    * ext/standard/basic_functions.c:    Prevent reenterant calls to a user tick function by flagging the function
  +    entry during call.
  +
  +    This prevents code like the following from infinitely recursing until a
  +    crash occurs:
  +    <?php
  +
  +    register_tick_function(a);
  +
  +    declare(ticks=1) {
  +    	function a() {
  +    		print "blah\n";
  +    	}
  +    	;
  +    	;
  +    	;
  +    	;
  +    }
  +    ?>
  +
  +2002-07-16  georg  <georg****@pb1*****>
  +
  +    * ext/mysql/php_mysql.c
  +      ext/mysql/php_mysql.h:
  +    Added support for php.ini parameter "mysql.connect_timeout"
  +
  +    * php.ini-dist
  +      php.ini-recommended: Added php.ini option "mysql_connection.timeout"
  +
  +2002-07-15  edink  <edink****@pb1*****>
  +
  +    * ext/mbstring/mbstring.c: MFH
  +
  +    * ext/mbstring/mbstring.c:
  +    Fix bug #16985 (wrong count of GET/POST variables).
  +
  +2002-07-15  sesser  <sesse****@pb1*****>
  +
  +    * main/rfc1867.c: use Zend API to access llist count
  +
  +2002-07-15  hyanantha  <hyana****@pb1*****>
  +
  +    * ext/mysql/php_mysql.c:
  +    mysql_create_db and mysql_drop_db disabled for NetWare
  +
  +2002-07-15  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/pgsql/pgsql.c: Clean up code a little (Remove a use of magic number)
  +    Change/add appropriate comments.
  +
  +    * NEWS: Fixed news
  +
  +    * NEWS: header sounds like http header. header -> header file
  +
  +2002-07-14  Andrei Zmievski  <andre****@pb1*****>
  +
  +    * ext/pcre/php_pcre.c: Fix Bug #18341.
  +
  +2002-07-14  Sascha Schumann  <sas****@pb1*****>
  +
  +    * NEWS: it is not really cold though
  +
  +    * NEWS: the sun was shining a few days ago
  +
  +    * sapi/thttpd/thttpd_patch
  +      sapi/thttpd/thttpd.c: integrate the public keep-alive patch
  +
  +    the patch did not handle pipeling at all, so that some code had to be added
  +    from Premium thttpd
  +
  +    persistent connections are supported, if a script sets the Content-Length
  +    header
  +
  +2002-07-14  Rasmus Lerdorf  <rasmu****@pb1*****>
  +
  +    * ext/ming/ming.c: Fix a couple of protos
  +
  +2002-07-14  Sascha Schumann  <sas****@pb1*****>
  +
  +    * sapi/thttpd/thttpd.c
  +      sapi/thttpd/thttpd_patch:
  +    thttpd blocks in rare circumstances where it cannot write out a small HTTP
  +    response (happened at customer sites).  The response is now written out
  +    using the standard state machine.
  +
  +    the buffer which is handed to thttpd by php is now simply dealt with as if
  +    it were a thttpd generated response (avoids code duplication).
  +
  +    * sapi/thttpd/thttpd.c
  +      sapi/thttpd/thttpd_patch:
  +    make the sapi module hand off a buffer to thttpd for final data delivery,
  +    instead of blocking the whole process
  +
  +2002-07-14  edink  <edink****@pb1*****>
  +
  +    * main/rfc1867.c:
  +    MFH (fixes linking errors when --enable-mbstring is used)
  +
  +2002-07-14  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/iconv/tests/eucjp2utf8.inc
  +      ext/iconv/tests/eucjp2utf8.phpt: Move comment.
  +    Remove a skip condition does not required.
  +
  +2002-07-14  sniper  <snipe****@pb1*****>
  +
  +    * main/rfc1867.c:
  +    IF --disable-mbstr-enc-trans is used OR mbstring is compiled as shared
  +    extension, these functions are not available.
  +
  +    * ext/mbstring/tests/002.inc
  +      ext/mbstring/tests/003.inc
  +      ext/mbstring/tests/004.inc
  +      ext/mbstring/tests/005.inc
  +      ext/mbstring/tests/006.inc
  +      ext/mbstring/tests/008.inc
  +      ext/mbstring/tests/009.inc
  +      ext/mbstring/tests/010.inc
  +      ext/mbstring/tests/011.inc
  +      ext/mbstring/tests/012.inc
  +      ext/mbstring/tests/013.inc
  +      ext/mbstring/tests/014.inc
  +      ext/mbstring/tests/015.inc
  +      ext/mbstring/tests/016.inc
  +      ext/mbstring/tests/017.inc
  +      ext/mbstring/tests/018.inc
  +      ext/mbstring/tests/019.inc
  +      ext/mbstring/tests/common.inc
  +      ext/mbstring/tests/common.php: .php files are in .cvsignore here
  +
  +    * ext/mbstring/config.m4: These options are all enabled by default. (why?)
  +
  +2002-07-14  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/iconv/tests/eucjp2utf8.inc
  +      ext/iconv/tests/eucjp2utf8.phpt
  +      ext/iconv/tests/translit.phpt:
  +    Fix tests. Moriyoshi Koizumi <readj****@deneb*****>
  +
  +2002-07-13  sander  <sande****@pb1*****>
  +
  +    * ext/standard/fsock.c: Fixed win32 build
  +
  +2002-07-13  sniper  <snipe****@pb1*****>
  +
  +    * ext/iconv/iconv.c: Kill compiler warning
  +
  +    * ext/iconv/tests/eucjp2utf8.phpt
  +      ext/iconv/tests/translit.phpt: Fix SKIPs for these tests.
  +
  +    * ext/standard/fsock.c: nuke unused variable warning
  +
  +    * ext/domxml/php_domxml.c: Fixed some unused variable warnings
  +
  +    * ext/yaz/php_yaz.c: Nuke unused variable
  +
  +    * ext/snmp/snmp.c: Kill compile warning
  +
  +    * ext/gd/config.m4: Really fix it this time..
  +
  +    * ext/standard/file.c: Fixed bug: #16638.
  +
  +    * sapi/cli/php_cli.c:
  +    Needed this to be able to test safe-mode stuff on cmd-line
  +
  +    * ext/standard/php_string.h
  +      ext/standard/string.c:
  +    - Made the trim functions use same base function. (less code :)
  +    - Renamed php_trim2 -> php_trim (not used anyplace else, yet)
  +    - Made php_trim abit more usable for external use. (not necessary to use
  +      zvals with it anymore)
  +
  +    * ext/gd/config.m4:
  +    Fixed the undefined reference to 'gdttf' errors when using bundled GD lib.
  +
  +
  +2002-07-13  yohgaki  <yohga****@pb1*****>
  +
  +    * ext/iconv/tests/eucjp2iso2022jp.phpt
  +      ext/iconv/tests/eucjp2utf8.phpt:
  +    Fixed tests. Patch by Yoshimori Koizumi <readj****@deneb*****>
  +
  +2002-07-13  sniper  <snipe****@pb1*****>
  +
  +    * main/safe_mode.c:
  +    Fix bug: #18285, php_checkuid() mangled the passed path.
  +
  +    * main/SAPI.c:
  +    - Fixed bug: #18268. If pcre is build as shared extension, we can't use
  +      php_pcre_replace() here.
  +    - Cleaned up a bit.
  +
  +2002-07-12  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/mysql/php_mysql.c: Partially reverted the netware related commit.
  +
  +    * ext/mysql/php_mysql.c: Beauify a bit..
  +
  +    * ext/mysql/php_mysql.c:
  +    Some ws fixes. And removed the problems causing typedef for ushort.
  +
  +    * ext/standard/image.c:
  +    - Fixed compile (bug #18297) on such systems which define uchar.
  +
  +    * ext/imap/config.m4:
  +    Bail out the given path does not have the libraries in it.
  +
  +    * ext/openssl/openssl.c: MFH
  +
  +    * ext/openssl/openssl.c:
  +    Fixed bug: #18295. e_os.h is not supposed to be included..
  +
  +2002-07-12  Anantha Kesari H Y  <hyana****@novel*****>
  +
  +    * netware/buildext.bat: File needed to build extensions for NetWare
  +
  +    * ext/mysql/mysql.mak
  +      ext/mysql/php_mysql.c: Added NetWare changes
  +
  +2002-07-12  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/imap/config.m4:
  +    Make configure stop if something is wrong with libraries/linking.
  +
  +    * ext/yaz/php_yaz.c
  +      ext/yaz/php_yaz.h: Fix ZTS build
  +
  +2002-07-12  Sebastian Bergmann  <sb****@sebas*****>
  +
  +    * ext/mbstring/mbstring.c: Remove unused variables.
  +
  +2002-07-12  Jani Taskinen  <snipe****@iki*****>
  +
  +    * .cvsignore: missing entry for config.h.in
  +
  +    * build/build.mk:
  +    .libs/ directories are created when building shared extensions.
  +
  +    * NEWS: minor typo fixbug.
  +
  +    * main/main.c
  +      main/rfc1867.c
  +      main/rfc1867.h: - Added predefined constants for the upload errors.
  +    - Removed the debugging error (not useful for end-users)
  +
  +2002-07-11  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/ftp/php_ftp.c: ws fix
  +
  +2002-07-11  Derick Rethans  <d.ret****@jdime*****>
  +
  +    * main/main.c: - Fix for bug #18283
  +
  +2002-07-11  Rui Hirokawa  <rui_hirok****@ybb*****>
  +
  +    * ext/pgsql/pgsql.c
  +      ext/mbstring/mbstring.c
  +      php.ini-recommended
  +      php.ini-dist: added mbstring.language option in ext/mbstring.
  +
  +2002-07-11  Tomas V.V.Cox  <cox****@idecn*****>
  +
  +    * pear/package-Net_SMTP.xml: typo
  +
  +    * pear/package-Net_SMTP.xml: Prepare package.xml for Net_SMTP
  +
  +2002-07-11  Sascha Schumann  <sasch****@schum*****>
  +
  +    * sapi/apache2filter/config.m4:
  +    Break up the INSTALL_IT line into comprehensible pieces
  +    and fix a bug related to [..] quotes.
  +
  +    * sapi/apache/config.m4:
  +    the variable interpolation was already subject to IFS treatment,
  +    which resulted in the execution of the foremost directory.
  +
  +    we capture the output before setting IFS now
  +
  +2002-07-11  Adam Dickmeiss  <adam****@index*****>
  +
  +    * ext/yaz/php_yaz.c
  +      ext/yaz/php_yaz.h:
  +    yaz.max_links, yaz_log_file setting. User-defined Other Info
  +
  +    * ext/yaz/config.m4: Include YAZ support libs (if any)
  +
  +2002-07-11  Sascha Schumann  <sasch****@schum*****>
  +
  +    * sapi/apache/config.m4
  +      sapi/apache2filter/config.m4:
  +    Use a simple IFS; set step to interprete the httpd -v output
  +
  +2002-07-11  Uwe Steinmann  <uwe****@stein*****>
  +
  +    * ext/hwapi/php_hwapi.h: - added missing file
  +
  +2002-07-11  James Cox  <james****@blog*****>
  +
  +    * ext/gd/libgd/gdft.c:
  +    adding patch from http://www.coupin.net/gd-freetype/ which makes images anti aliased (and therefore more readable).
  +
  +
  +2002-07-11  Yasuo Ohgaki  <yohga****@ohgak*****>
  +
  +    * ext/iconv/tests/translit.inc
  +      ext/iconv/tests/translit.phpt:
  +    Added traslit test files. Moriyoshi Koizumi <readj****@deneb*****>
  +
  +    * ext/iconv/config.m4
  +      ext/iconv/iconv.c:
  +    Fix #16069. Patch by Moriyoshi Koizumi <readj****@deneb*****>
  +
  +2002-07-11  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/ftp/ftp.c: Fix bug: #14052
  +
  +    * ext/standard/http_fopen_wrapper.c: MFH: Fix for #16337
  +
  +    * ext/standard/http_fopen_wrapper.c:
  +    Fixed bug: #16637, username/password needs to be urlencoded.
  +
  +    * ext/curl/curl.c: Fixed bug: #18250
  +
  +    * NEWS: news-entry-robot(tm)
  +
  +2002-07-10  Harald Radi  <haral****@nme*****>
  +
  +    * ext/rpc/com/com.c
  +      win32/php4dllts.dsp:
  +    merging parts of the old com extension to the new rpc extension
  +
  +2002-07-10  Jason Greene  <jason****@inetg*****>
  +
  +    * ext/standard/basic_functions.c
  +      ext/standard/file.c:
  +    Fixed socket_set_timeout on win32 (Jason, Edin, Jani)
  +
  +    * ext/standard/basic_functions.c
  +      ext/standard/file.c:
  +    Fix socket_set_timeout on win32 ( was not being included )
  +
  +2002-07-10  Georg Richter  <georg****@phpev*****>
  +
  +    * ext/mysql/php_mysql.c: 1) New constants:
  +    MYSQL_CLIENT_SSL for ssl connections
  +    MYSQL_CLIENT_COMPRESS for compressed protocol
  +    MYSQL_CLIENT_IGNORE_SPACES for spaces after function names
  +    MYSQL_CLIENT_INTERACTIVE for closing connections after timeout_interactive seconds
  +
  +    2) Optional parameter client_flags for mysql_connect and mysql_pconnect
  +    For parameter desctiption see 1.
  +    This also should fix bug #13589
  +
  +    3) New internal function _rollback_mysql_transactions, which is called via
  +    PHP_RSHUTDOWN_FUNCTION
  +    This fixes bug #12513
  +
  +2002-07-10  Stig Bakken  <ssb****@fast*****>
  +
  +    * pear/packages/DB-1.2.tar
  +      pear/packages/XML_Parser-1.0.tar
  +      pear/packages/XML_RPC-1.0.3.tar: * signed these packages
  +
  +2002-07-09  Derick Rethans  <d.ret****@jdime*****>
  +
  +    * ext/ftp/php_ftp.c: - Initialize var properly
  +
  +2002-07-09  Stig Venaas  <venaa****@unine*****>
  +
  +    * ext/ldap/ldap.c: Hopefully fixes build with IBM's LDAP library
  +
  +2002-07-09  Harald Radi  <haral****@nme*****>
  +
  +    * ext/rpc/com/com.h: add file again that andrei deleted by
  +    accident (i don't want to blame anyone here)
  +
  +    * win32/php4dllts.dsp
  +      main/config.w32.h.in
  +      main/internal_functions_win32.c: MFH
  +
  +2002-07-09  Stig Bakken  <ssb****@fast*****>
  +
  +    * pear/packages/HTTP-1.2.tar: * add HTTP package (signed)
  +
  +    * pear/Console/Getopt.php: * tolerate $args being empty
  +
  +    * pear/PEAR/Remote.php: * tiniest optimization
  +
  +    * pear/PEAR/Registry.php: * typo
  +
  +2002-07-08  Sterling Hughes  <sterl****@bumbl*****>
  +
  +    * ext/xslt/sablot.c: eek
  +
  +    * ext/xslt/sablot.c: commit petr's sax handler patch
  +
  +2002-07-08  Andi Gutmans  <andi****@zend*****>
  +
  +    * ext/standard/file.h: - Add TSRMLS_DC to prototype.
  +
  +    * ext/standard/cyr_convert.c
  +      ext/standard/file.c
  +      ext/standard/type.c: - Fix TSRMLS_* stuff
  +
  +2002-07-08  Martin Jansen  <mail****@marti*****>
  +
  +    * pear/File/Passwd.php:
  +    * Use CRYPT_SALT_LENGTH instead of hardcoded value.
  +
  +    Patch by: "James E. Flemer" <jflem****@acm*****>
  +
  +2002-07-08  Jani Taskinen  <snipe****@iki*****>
  +
  +    * NEWS: news update
  +
  +    * ext/mysql/config.m4:
  +    Fix shared build and made the logic of finding the socket location better.
  +
  +2002-07-08  Derick Rethans  <d.ret****@jdime*****>
  +
  +    * ext/standard/assert.c
  +      ext/standard/basic_functions.c
  +      ext/standard/browscap.c
  +      ext/standard/cyr_convert.c
  +      ext/standard/datetime.c
  +      ext/standard/dir.c
  +      ext/standard/dl.c
  +      ext/standard/dns.c
  +      ext/standard/exec.c
  +      ext/standard/file.c
  +      ext/standard/filestat.c
  +      ext/standard/formatted_print.c
  +      ext/standard/ftok.c
  +      ext/standard/head.c
  +      ext/standard/html.c
  +      ext/standard/image.c
  +      ext/standard/iptc.c
  +      ext/standard/levenshtein.c
  +      ext/standard/aggregation.c
  +      ext/standard/type.c: Unify error messages
  +
  +    * ext/standard/type.c:
  +    - Add warning to is_*() functions if more than one argument was passed
  +
  +    * ext/standard/array.c: Silence warning
  +
  +    * ext/standard/array.c: Unify error messages
  +
  +    * ext/standard/array.c: - Fix for bug #14580: Made key() binary safe
  +
  +2002-07-08  Jani Taskinen  <snipe****@iki*****>
  +
  +    * main/main.c:
  +    These two can not be set in script. (so that they would have any effect)
  +
  +2002-07-07  Sterling Hughes  <sterl****@bumbl*****>
  +
  +    * ext/standard/filestat.c: fix win32 build
  +
  +2002-07-07  Stig Bakken  <ssb****@fast*****>
  +
  +    * pear/PEAR/Command/Package.php: * added "pear sign" command
  +
  +    * pear/PEAR/Installer.php: * use System::mktemp
  +    * check if an install is about to overwrite existing files belonging
  +      to other packages, bail out if not in "force" mode
  +
  +    * pear/scripts/pear.in:
  +    * don't set include path if running 'pear.in' without substitutions
  +      made by the installer
  +    * sort command names in help output
  +
  +    * pear/PEAR/Registry.php
  +      pear/tests/pear_registry.phpt:
  +    * made rebuildFileMap method public, added caching and checkFileMap method
  +
  +2002-07-07  Shane Caraveo  <shane****@carav*****>
  +
  +    * pear/PEAR/Builder.php:
  +    Let 'pear build' work on windows for building pecl extensions.
  +
  +    A few notes:
  +    Currently only supports release builds, and of course, requires msdev!
  +    pecl packages must have package.xml and xxx.dsp files for this to work
  +    the package name in package.xml must match the name of the dsp file, so
  +    package iisfunc must have dsp iisfunc.dsp
  +
  +2002-07-07  Stig Bakken  <ssb****@fast*****>
  +
  +    * pear/PEAR/Packager.php:
  +    * use System::mktemp rather than PEAR_Common::mkTempDir
  +
  +    * pear/PEAR/Frontend/CLI.php: * silence warning
  +
  +2002-07-07  Christian Stocker  <chreg****@phant*****>
  +
  +    * ext/domxml/php_domxml.c
  +      ext/domxml/php_domxml.h:
  +     - Added domxml_node_namespace_uri() (Rui Lopes).
  +
  +2002-07-07  Jan Lehnardt  <jan****@dasmo*****>
  +
  +    * INSTALL:  - fix #16290
  +
  +2002-07-07  Jani Taskinen  <snipe****@iki*****>
  +
  +    * sapi/apache2filter/config.m4
  +      sapi/apache/config.m4: - Fix the version check again.
  +
  +    * NEWS: cleanup
  +
  +2002-07-07  Sebastian Bergmann  <sb****@sebas*****>
  +
  +    * ext/standard/versioning.c: Fix warning.
  +
  +2002-07-07  Jason Greene  <jason****@inetg*****>
  +
  +    * ext/sockets/sockets.c:
  +    Remove sleep workaround, and fix the actual win32 memory leak which
  +    was occurring in the error reporting system. The reason why sleepex appeared
  +    to be working was because it suppressed EWOULDBLOCK errors in the example
  +    (which was non-blocking)
  +
  +2002-07-07  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/dio/dio.c: ws fix
  +
  +    * ext/dio/dio.c: Fix the fix properly.
  +
  +    * acinclude.m4: MFH
  +
  +    * acinclude.m4: PHP_EVAL_LIBLINE must not reverse the order of libraries.
  +
  +2002-07-06  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/informix/.cvsignore: Added missing .libs entry
  +
  +2002-07-06  Christian Dickmann  <chris****@gmx*****>
  +
  +    * pear/PEAR/Config.php
  +      pear/PEAR/Remote.php: add local XMLRPC cache
  +
  +2002-07-06  Derick Rethans  <d.ret****@jdime*****>
  +
  +    * ext/xmlrpc/xmlrpc-epi-php.c: - Consistent error messages
  +
  +2002-07-05  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/dio/dio.c: Fix bug: #16707
  +
  +2002-07-05  Sascha Schumann  <sasch****@schum*****>
  +
  +    * acinclude.m4: nuke another instance of newline suppression
  +
  +2002-07-05  Jani Taskinen  <snipe****@iki*****>
  +
  +    * main/rfc1867.c: MFH
  +
  +    * main/rfc1867.c: Fix typo
  +
  +    * ext/xmlrpc/xmlrpc-epi-php.c: Fix typo.
  +
  +2002-07-05  Rui Hirokawa  <rui_hirok****@ybb*****>
  +
  +    * ext/mbstring/mbstring.c
  +      ext/mbstring/mbstring.h
  +      main/rfc1867.c:
  +    fixed shift_jis character corruption including 0x5c as second byte following a slash on uploaded filename.
  +
  +2002-07-05  Sascha Schumann  <sasch****@schum*****>
  +
  +    * acinclude.m4: some seds want to see a newline, so we give them a newline
  +
  +    PR: #17072 and others
  +
  +    * configure.in:
  +    Fix the Solaris issue where CPP was set wrongly to "cc -E", because
  +    the AIX macro invoked the CPP check before the CC check, so that
  +    autoconf did not know which $CC to use.
  +
  +    You can now close all those bug reports about unix.h and misdetected
  +    headers.
  +
  +    * configure.in: Remove remainings of bsd_makefile
  +
  +2002-07-05  Dan Libby  <dan****@libby*****>
  +
  +    * ext/xmlrpc/libxmlrpc/queue.c
  +      ext/xmlrpc/libxmlrpc/simplestring.c
  +      ext/xmlrpc/libxmlrpc/simplestring.h
  +      ext/xmlrpc/libxmlrpc/system_methods.c
  +      ext/xmlrpc/libxmlrpc/xml_element.c
  +      ext/xmlrpc/libxmlrpc/xml_to_soap.c
  +      ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
  +      ext/xmlrpc/libxmlrpc/xmlrpc.c
  +      ext/xmlrpc/libxmlrpc/xmlrpc.h
  +      ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c
  +      ext/xmlrpc/libxmlrpc/xmlrpc_private.h
  +      ext/xmlrpc/php_xmlrpc.h
  +      ext/xmlrpc/xmlrpc-epi-php.c:
  +    merged in updates from SF project.  bring php repository up to date with xmlrpc-epi version 0.51
  +
  +2002-07-05  Stig Bakken  <ssb****@fast*****>
  +
  +    * pear/PEAR.php: * define PEAR_ZE2 when running with Zend Engine 2
  +
  +    * ext/standard/versioning.c: * fix segfault in case of odd version numbers
  +
  +    * ext/standard/versioning.c:
  +    (PHP version_compare) added "alpha" and "beta", make tests pass
  +
  +2002-07-04  Sascha Schumann  <sasch****@schum*****>
  +
  +    * acinclude.m4
  +      configure.in:
  +    1. PHP_CHECK_FUNC(func, lib1, lib2, ..., libn) searches for
  +       func and __func using LIBS, and if unsuccessful, searches
  +       each specified lib.  Defines HAVE_FUNC, if found.  If func/__func is
  +       found in library foo, HAVE_LIBFOO is defined.
  +
  +       (Jani, me)
  +
  +    2. Autoconf 2.5x is more pedantic regarding locating header files.
  +       We include the proper header files now in the check. (me)
  +
  +    3. The nsl/bind/socket/etc checks have been rewritten using PHP_CHECK_FUNC.
  +       This ensures that no extra library is used, if the symbol is
  +       available in libc which avoids issues on BSD/OS, OpenBSD and others.
  +       (Jani)
  +
  +2002-07-04  Martin Jansen  <mail****@marti*****>
  +
  +    * pear/PEAR/Common.php: * Remove http:// from the proxy server string.
  +
  +    Patch by: "michiel bakker" <michiel_bakke****@hotma*****>
  +
  +2002-07-04  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/ftp/ftp.c
  +      ext/ftp/ftp.h
  +      ext/ftp/php_ftp.c:
  +    - Added optional 3rd parameter 'recursive' to ftp_rawlist() which will
  +      do 'LIST -R' instead of 'LIST'. 
  +
  +2002-07-04  Marko Karppinen  <karpp****@pobox*****>
  +
  +    * Makefile.global
  +      sapi/cgi/config.m4:
  +    Moved the cgi link line to sapi/cgi/config.m4 and stopped
  +    using libtool on Darwin on it
  +
  +2002-07-04  Sascha Schumann  <sasch****@schum*****>
  +
  +    * config.sub
  +      config.guess: Upgrade to the version shipped with automake-1.6.2
  +
  +    * sapi/cgi/cgi_main.c:
  +    Generate content-type header, if the user did not specify one of its own.
  +
  +    Noticed by: Edin Kadribasic <edink****@prove*****>
  +
  +2002-07-03  Rui Hirokawa  <rui_hirok****@ybb*****>
  +
  +    * main/rfc1867.c: fixed ZTS build.
  +
  +    * ext/mbstring/mbstring.c
  +      ext/mbstring/mbstring.h: fixed ZTS build and added language check.
  +
  +2002-07-03  Jani Taskinen  <snipe****@iki*****>
  +
  +    * Makefile.global
  +      ext/java/Makefile.frag
  +      pear/Makefile.frag:
  +    - Let's be tad more verbose what's happening during 'make install'
  +
  +2002-07-03  Sebastian Bergmann  <sb****@sebas*****>
  +
  +    * main/rfc1867.c: Fix ZTS build.
  +
  +2002-07-03  Frank M. Kromann  <frank****@kroma*****>
  +
  +    * ext/mbstring/mbstring.c: Removed unneeded check for MBSTR_ENC_TRANS
  +
  +    * main/config.w32.h.in:
  +    Added MBSTR_ENC_TRANS to allow compilation and linking under win32
  +
  +2002-07-03  Sascha Schumann  <sasch****@schum*****>
  +
  +    * README.PARAMETER_PARSING_API:
  +    Please note that you need to use 'int' as a length type when
  +    fetching strings.
  +
  +2002-07-03  Frank M. Kromann  <frank****@kroma*****>
  +
  +    * ext/mbstring/mbstring.dsp: Adding _RU files to project
  +
  +    * ext/mbstring/mbstring.c
  +      ext/mbstring/mbstring.h: Fixing ZTS build
  +
  +    * ext/standard/php_string.h: Adding missing prototype
  +
  +2002-07-03  Derick Rethans  <d.ret****@jdime*****>
  +
  +    * README.PARAMETER_PARSING_API: - Fix README
  +
  +2002-07-03  Rui Hirokawa  <rui_hirok****@ybb*****>
  +
  +    * ext/mbstring/mbstring.c
  +      ext/mbstring/mbstring.h
  +      main/rfc1867.c:
  +    fixed shift_jis character corruption including 0x5c as second byte on uploaded filename.
  +
  +2002-07-03  Sterling Hughes  <sterl****@bumbl*****>
  +
  +    * ext/curl/curl.c: formatting fixes
  +
  +    * ext/curl/curl.c: fix bug #17963
  +
  +2002-07-03  Sascha Schumann  <sasch****@schum*****>
  +
  +    * sapi/cgi/cgi_main.c: Add CRLF after complete HTTP reply header
  +
  +    * sapi/cgi/cgi_main.c:
  +    Use "Status: %d" instead of "HTTP/1.0 %d X" in the CGI SAPI module
  +    as per the CGI RFC.
  +
  +    The status notation is incompatible with Apache's non-parsed-header mode
  +    "nph-*", but that has never worked before anyway.  One could make the
  +    format string configurable.
  +
  +    Noticed by: Sebastian Bergmann
  +
  +2002-07-03  Edin Kadribasic  <edink****@prove*****>
  +
  +    * ext/xmlrpc/libxmlrpc/encodings.c: MFH (win32 build fix)
  +
  +    * ext/xmlrpc/libxmlrpc/encodings.c: Fixed win32 build.
  +
  +2002-07-03  Sascha Schumann  <sasch****@schum*****>
  +
  +    * main/SAPI.c: fix typo
  +
  +    * main/SAPI.c
  +      main/SAPI.h
  +      sapi/pi3web/pi3web_sapi.c
  +      sapi/tux/php_tux.c
  +      sapi/webjames/webjames.c
  +      ext/standard/head.c:
  +    Add sapi_header_op interface which supersedes the sapi_add_header and _ex
  +    calls.
  +
  +    Revert the change to the sapi_add_header_ex interface.
  +
  +    Fix various bugs:
  +
  +    1.  header("HTTP/1.0 306 foo");
  +        header("Location: absolute-uri");
  +
  +        did not work in combination with several SAPI modules, because
  +        http_status_line was never properly reset.  And thus, all SAPI
  +        modules which looked at http_status_line ignored the changed
  +        http_response_code.
  +
  +    2.  The CGI SAPI did not send out the HTTP status line at all, if
  +        http_status_line had not been set explicitly by calling
  +        header("HTTP/1.0 200 foo");
  +
  +2002-07-03  Christian Stocker  <chreg****@phant*****>
  +
  +    * pear/PEAR/WebInstaller.php:
  +    - Not maintained (and maybe not working) anymore
  +    - There's a new project PEAR_Frontend_Web which does a much better job
  +
  +2002-07-03  Derick Rethans  <d.ret****@jdime*****>
  +
  +    * ext/standard/basic_functions.c
  +      ext/standard/filestat.c
  +      ext/standard/php_filestat.h: - Fix windows build
  +
  +2002-07-03  Uwe Steinmann  <uwe****@stein*****>
  +
  +    * ext/hyperwave/hw.c: - fixed bug in hwnew_new_document_from_file
  +
  +2002-07-03  Jani Taskinen  <snipe****@iki*****>
  +
  +    * ext/standard/filestat.c:
  +    Fix the nasty crash. And Sterling..test next time before you commit?
  +
  +    * ext/session/session.c: ws fix
  +
   2002-07-02  Frank M. Kromann  <frank****@kroma*****>
   
       * ext/standard/mail.c:
  
  
  
  1.2.2.2   +6 -0      php4/INSTALL
  
  Index: INSTALL
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/INSTALL,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- INSTALL	19 May 2002 11:16:02 -0000	1.2.2.1
  +++ INSTALL	3 Aug 2002 00:44:11 -0000	1.2.2.2
  @@ -72,6 +72,9 @@
   look for it on your system and if you find it, provide the full path to it
   as: --with-apxs=/path/to/apxs
   
  +Make sure you specify the version of apxs that is actually installed on
  +your system and NOT the one that is in the apache source tarball.
  +
   Next you must copy php.ini-dist to the appropriate place (normally
   /usr/local/lib/php.ini) and edit it as necessary to set PHP options.
   
  @@ -160,6 +163,9 @@
      look for it on your system and if you find it, provide the full path to it
      as: --with-apxs=/path/to/apxs
   
  +   Make sure you specify the version of apxs that is actually installed on
  +   your system and NOT the one that is in the apache source tarball.
  +   
      You might also want other flags on this configure line.  --with-mysql
      is just an example.  
   
  
  
  
  1.2.2.2   +21 -17    php4/LICENSE
  
  Index: LICENSE
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/LICENSE,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- LICENSE	9 Jul 2002 09:14:29 -0000	1.2.2.1
  +++ LICENSE	3 Aug 2002 00:44:11 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   -------------------------------------------------------------------- 
  -                  The PHP License, version 3.0a1
  +                  The PHP License, version 3.0
   Copyright (c) 1999 - 2002 The PHP Group. All rights reserved.
   -------------------------------------------------------------------- 
   
  @@ -8,34 +8,38 @@
   are met:
   
     1. Redistributions of source code must retain the above copyright
  -     notice, this list of conditions and the following disclaimer. 
  +     notice, this list of conditions and the following disclaimer.
    
  -  2. Redistributions in binary form must reproduce the above 
  -     copyright notice, this list of conditions and the following 
  -     disclaimer in the documentation and/or other materials provided
  -     with the distribution.
  +  2. Redistributions in binary form must reproduce the above copyright
  +     notice, this list of conditions and the following disclaimer in
  +     the documentation and/or other materials provided with the
  +     distribution.
    
  -  3. The name "PHP" must not be used to endorse or promote products 
  -     derived from this software without prior permission from the 
  -     PHP Group.  This does not apply to add-on libraries or tools
  -     that work in conjunction with PHP.  In such a case the PHP
  -     name may be used to indicate that the product supports PHP.
  +  3. The name "PHP" must not be used to endorse or promote products
  +     derived from this software without prior written permission. For
  +     written permission, please contact group****@php*****.
  +  
  +  4. Products derived from this software may not be called "PHP", nor
  +     may "PHP" appear in their name, without prior written permission
  +     from group****@php*****.  You may indicate that your software works in
  +     conjunction with PHP by saying "Foo for PHP" instead of calling
  +     it "PHP Foo" or "phpfoo"
    
  -  4. The PHP Group may publish revised and/or new versions of the
  +  5. The PHP Group may publish revised and/or new versions of the
        license from time to time. Each version will be given a
        distinguishing version number.
        Once covered code has been published under a particular version
  -     of the license, you may always continue to use it under the
  -     terms of that version. You may also choose to use such covered
  -     code under the terms of any subsequent version of the license
  +     of the license, you may always continue to use it under the terms
  +     of that version. You may also choose to use such covered code
  +     under the terms of any subsequent version of the license
        published by the PHP Group. No one other than the PHP Group has
        the right to modify the terms applicable to covered code created
        under this License.
   
  -  5. Redistributions of any form whatsoever must retain the following
  +  6. Redistributions of any form whatsoever must retain the following
        acknowledgment:
        "This product includes PHP, freely available from
  -     http://www.php.net/".
  +     <http://www.php.net/>".
   
   THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND 
   ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  
  
  
  1.2.2.3   +8 -6      php4/Makefile.global
  
  Index: Makefile.global
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/Makefile.global,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- Makefile.global	9 Jul 2002 09:14:29 -0000	1.2.2.2
  +++ Makefile.global	3 Aug 2002 00:44:11 -0000	1.2.2.3
  @@ -17,8 +17,8 @@
   	$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
   
   php: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
  -	$(LIBTOOL) --mode=link $(CC) -export-dynamic $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
  -
  +	$(BUILD_CGI)
  +	
   sapi/cli/php: $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS)
   	$(BUILD_CLI)
   
  @@ -26,9 +26,11 @@
   
   
   install-cli: sapi/cli/php
  -	$(INSTALL_CLI)
  +	@echo "Installing PHP CLI binary:        $(INSTALL_ROOT)$(bindir)/"
  +	@$(INSTALL_CLI)
   
   install-sapi: libphp4.la
  +	@echo "Installing PHP SAPI module"
   	-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
   	-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
   	- @ if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
  @@ -39,17 +41,17 @@
   			fi; \
   		done; \
   	fi
  -	$(INSTALL_IT)
  +	@$(INSTALL_IT)
   
   install-modules: build-modules
   	@test -d modules && \
   	$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
  -	echo "installing shared modules into $(EXTENSION_DIR)" && \
  +	echo "Installing shared extensions:     $(INSTALL_ROOT)$(EXTENSION_DIR)/" && \
   	rm -f modules/*.la && \
   	cp modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
   
   install-tester:
  -	@echo "Installing regression tester"
  +	@echo "Installing regression tester:     $(INSTALL_ROOT)$(PEAR_INSTALLDIR)/"
   	@$(mkinstalldirs) $(PEAR_INSTALLDIR)
   	@$(INSTALL) -m 755 $(top_srcdir)/run-tests.php $(INSTALL_ROOT)$(PEAR_INSTALLDIR)
   
  
  
  
  1.2.2.6   +59 -13    php4/NEWS
  
  Index: NEWS
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/NEWS,v
  retrieving revision 1.2.2.5
  retrieving revision 1.2.2.6
  diff -u -r1.2.2.5 -r1.2.2.6
  --- NEWS	9 Jul 2002 09:14:29 -0000	1.2.2.5
  +++ NEWS	3 Aug 2002 00:44:11 -0000	1.2.2.6
  @@ -1,19 +1,66 @@
   PHP 4                                                                      NEWS
   |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  -?? ??? 2002, Version 4.3.0
  -- Disabled the fifth parameter to the mail function in safemode. (Derick)
  -- GetImageSize now allways set fields unknown to 0 and new Imagetype
  -  iff. (Marcus)
  -- Add runtime Apache2 thread check to ensure we don't run a non-threaded
  +? ? ??? 2002, Version 4.3.0
  +- Added the ability for declare() compiler modifications to occur globally
  +  by using an empty statement. (Jason, Zend Engine)
  +  i.e.  
  +        //Globally enables the ticks modifier for the whole program
  +        declare (ticks=1);
  +
  +        //Enables the ticks modifier for just the lexical block containing
  +        //"statement".
  +        declare (ticks=1) {
  +           statement;
  +        }
  +- Bring strtotime() "next" keyword handling in line with documentation and
  +  its glibc cousin.  (Rasmus)
  +- Fixed str_rot13() to not mangle source string. (Rasmus)
  +- Fixed imap_get_quota() to work with multiple returned resources as per
  +  the RFC 2087 and bug #14673. (kalowsky, Sander Steffann)
  +- Added MarkerNote decoding to exif_read_data() for several Cameras. (Marcus)
  +- Disabled zlib.output_compression for "image/" content-type
  +  headers which can be changed during script execution. (Stefan)
  +- Added new asynchronous FTP functions. (Stefan)
  +- Added optional 5th parameter to FTP functions to support resuming. (Stefan)
  +- Added optional 2nd parameter to print_r() to make it return the variable
  +  representation instead of echoing it. (Derick)
  +- Added mysql_ping(), mysql_real_escape_string(), mysql_character_set_name(), 
  +  mysql_thread_id(), mysql_stat() and mysql_list_processes(). (Zak, Georg)
  +- Added pg_fetch_all() which fetches all rows in a result. (Yasuo)
  +- Changed "session.use_trans_sid" to be disabled by default in php.ini. (Yasuo)
  +- Added safe_mode & open_basedir checks for pg_lo_export(). (Yasuo)
  +- Added open_basedir check for pg_lo_import(). (Yasuo)
  +- Fixed infinite recursion crash bug in ticks. (Jason)
  +- Added php.ini option "mysql.connect_timeout" to set the timeout limit for 
  +  mysql_connect() and mysql_pconnect(). (Georg)
  +- Added optional parameter "flags" to mysql_connect() and mysql_pconnect() 
  +  which can be used to set usage of idle timeout and different protocols,
  +  SSL and compressed. (Georg)
  +- Added automatic rollback to ext/mysql for non committed transactions. (Georg)
  +- Fixed cases where preg_split() incorrectly terminated final element if it 
  +  contained null bytes. (Andrei)
  +- Added persistent connections/pipelining to thttpd. (Sascha)
  +- Fixed two potential blocking issues in thttpd. (Sascha)
  +- Fixed broken header file detection on Solaris. (Sascha)
  +- Improved nss/socket-related symbol/library detection. (Jani, Sascha)
  +- Made iconv() work well with both libiconv and libgconv. (Moriyoshi, Yasuo)
  +- Fixed socket_set_timeout() on win32. (Jason, Edin, Jani)
  +- Added domxml_node_namespace_uri(). (Rui Lopes)
  +- Fixed win32 memory leak in /ext/sockets that would occur on any error 
  +  condition. Also fixed host resolution error messages on win32. (Jason)
  +- Added optional 3rd parameter 'recursive' to ftp_rawlist() which will
  +  do 'LIST -R' instead of 'LIST'. (Jani)
  +- Disabled the fifth parameter in mail() when safe-mode is turned on. (Derick)
  +- Changed getimagesize() to always set unknown fields to 0 and added support
  +  iff imagetype. (Marcus)
  +- Added runtime Apache2 thread check to ensure we don't run a non-threaded
     PHP inside a threaded Apache2 MPM.  (Rasmus)
  -- Turn off ZTS if Apache2 is using the prefork MPM. (Rasmus)
   - Made getimagesize() and exif_read_data() to return also the mime-type and 
     exif_thumbnail() to return also the image-type. (Marcus)
   - Added image_type_to_mime_type() which converts image-types to mime-types.
     (Marcus)
  -- Made GD functions only exist if they are available. This means that for
  -  example your GD build has no JPG support, none of the JPG functions would
  -  actually exist, so you can safely test that with function_exists(). (Derick)
  +- Made GD functions to only exist if they are available in libgd. Now the 
  +  availability can be tested with function_exists(). (Derick)
   - Added an optional parameter to the header() function which overrides the HTTP
     response code. (Derick)
   - Changed the order of which modules are unloaded to the reverse order of
  @@ -79,8 +126,6 @@
     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)
   - Changed the mbstring extension to be enabled by default. (Yasuo)
  @@ -418,6 +463,7 @@
     GMT +0100 and GMT -0100. (Derick)
   
   10 Dec 2001, Version 4.1.0
  +- Fixed return values for strtok (Bug #13866) (jmoore)
   - Worked around a bug in the MySQL client library that could cause PHP to hang
     when using unbuffered queries. (Zeev)
   - Fixed a bug which caused set_time_limit() to affect all subsequent requests
  @@ -482,9 +528,9 @@
     there's no need to import them using the 'global' statement.  (Andi & Zeev)
   - Added vprintf() and vsprintf() functions that allow passing all arguments
     after format as an array. (Andrei)
  -- Added support for GD2 image type for ImageCreateFromString() (Jani)
  +- Added support for GD2 image type for ImageCreateFromString(). (Jani)
   - Added ImageCreateFromGD(), ImageCreateFromGD2(), ImageCreateFromGD2part(),
  -  ImageGD() and ImageGD2() functions (Jani)
  +  ImageGD() and ImageGD2() functions. (Jani)
   - addcslashes now warns when charlist is invalid. The returned string
     remained the same (Jeroen)
   - Added optional extra argument to gmp_init(). The extra argument
  
  
  
  1.2.2.2   +1 -1      php4/README.CVS-RULES
  
  Index: README.CVS-RULES
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/README.CVS-RULES,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- README.CVS-RULES	19 May 2002 11:16:02 -0000	1.2.2.1
  +++ README.CVS-RULES	3 Aug 2002 00:44:11 -0000	1.2.2.2
  @@ -84,7 +84,7 @@
   For string.c:
   (php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
   # Man, that thing was leaking all over the place!
  - @ - Memory leak in trim() function has finally been fixed. (Bob)
  + @ - Fixed memory leak in trim(). (Bob)
   
   The lines above marked with @ will go into NEWS file automagically, and the
   # lines will be omitted from the ChangeLog. Alternatively, you might want
  
  
  
  1.2.2.1   +10 -1     php4/README.PARAMETER_PARSING_API
  
  Index: README.PARAMETER_PARSING_API
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/README.PARAMETER_PARSING_API,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- README.PARAMETER_PARSING_API	29 Apr 2002 02:26:19 -0000	1.2
  +++ README.PARAMETER_PARSING_API	3 Aug 2002 00:44:11 -0000	1.2.2.1
  @@ -105,11 +105,20 @@
   /* Get either a set of 3 longs or a string. */
   long l1, l2, l3;
   char *s;
  +/* 
  + * The function expects a pointer to a integer in this case, not a long
  + * or any other type.  If you specify a type which is larger
  + * than a 'int', the upper bits might not be initialized
  + * properly, leading to random crashes on platforms like
  + * Tru64 or Linux/Alpha.
  + */
  +int length;
  +
   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
   							 "lll", &l1, &l2, &l3) == SUCCESS) {
   	/* manipulate longs */
   } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
  -									"s", &s) == SUCCESS) {
  +									"s", &s, &length) == SUCCESS) {
   	/* manipulate string */
   } else {
   	/* output error */
  
  
  
  1.2.2.3   +101 -17   php4/acinclude.m4
  
  Index: acinclude.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/acinclude.m4,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- acinclude.m4	9 Jul 2002 09:14:29 -0000	1.2.2.2
  +++ acinclude.m4	3 Aug 2002 00:44:11 -0000	1.2.2.3
  @@ -1,4 +1,4 @@
  -dnl $Id: acinclude.m4,v 1.193 2002/07/01 01:01:06 imajes Exp $
  +dnl $Id: acinclude.m4,v 1.200 2002/07/25 18:37:16 sniper Exp $
   dnl
   dnl This file contains local autoconf functions.
   
  @@ -103,7 +103,7 @@
   dnl ac_srcdir/ac_bdir include trailing slash
     case $1 in
     ""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;;
  -  /*[)] ac_srcdir=`echo $ac_n "$1$ac_c"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;;
  +  /*[)] ac_srcdir=`echo "$1"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;;
     *[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$1/"; ac_inc="-I$ac_bdir -I$ac_srcdir" ;;
     esac
     
  @@ -255,7 +255,7 @@
       case $ac_i in
       -l*)
         ac_ii=`echo $ac_i|cut -c 3-`
  -      PHP_ADD_LIBRARY($ac_ii,,$2)
  +      PHP_ADD_LIBRARY($ac_ii,1,$2)
       ;;
       -L*)
         ac_ii=`echo $ac_i|cut -c 3-`
  @@ -875,7 +875,7 @@
         PHP_ADD_LIBPATH_GLOBAL([$ai_p])
       ],[
         if test "$ext_shared" = "yes"; then
  -        $2="-R$ai_p -L$ai_p [$]$2"
  +        $2="$ld_runpath_switch$ai_p -L$ai_p [$]$2"
         else
           PHP_ADD_LIBPATH_GLOBAL([$ai_p])
         fi
  @@ -884,19 +884,26 @@
   ])
   
   dnl
  -dnl PHP_BUILD_RPATH()
  +dnl PHP_UTILIZE_RPATHS()
   dnl
  -dnl builds RPATH from PHP_RPATHS
  +dnl builds RPATHS/LDFLAGS from PHP_RPATHS
   dnl
  -AC_DEFUN(PHP_BUILD_RPATH,[
  -  if test "$PHP_RPATH" = "yes" && test -n "$PHP_RPATHS"; then
  -    OLD_RPATHS=$PHP_RPATHS
  +AC_DEFUN(PHP_UTILIZE_RPATHS,[
  +  OLD_RPATHS=$PHP_RPATHS
  +  unset PHP_RPATHS
  +
  +  for i in $OLD_RPATHS; do
  +dnl Can be passed to native cc/libtool
  +    PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
  +dnl Libtool-specific
  +    PHP_RPATHS="$PHP_RPATHS -R $i"
  +dnl cc-specific
  +    NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
  +  done
  +
  +  if test "$PHP_RPATH" = "no"; then
       unset PHP_RPATHS
  -    for i in $OLD_RPATHS; do
  -      PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
  -      PHP_RPATHS="$PHP_RPATHS -R $i"
  -      NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
  -    done
  +    unset NATIVE_RPATHS
     fi
   ])
   
  @@ -927,8 +934,8 @@
   dnl internal, don't use
   AC_DEFUN(PHP_ADD_LIBRARY_SKELETON,[
     case $1 in
  -  c|c_r|pthread*) ;;
  -  *) ifelse($3,,[
  +  c|c_r|pthread*[)] ;;
  +  *[)] ifelse($3,,[
       PHP_X_ADD_LIBRARY($1,$2,$5)
     ],[
       if test "$ext_shared" = "yes"; then
  @@ -1167,7 +1174,7 @@
     ext_builddir=[]PHP_EXT_BUILDDIR($1)
     ext_srcdir=[]PHP_EXT_SRCDIR($1)
   
  -  ifelse($5,,ac_extra=,[ac_extra=`echo $ac_n "$5$ac_c"|sed s#@ext_srcdir@#$ext_srcdir#g`])
  +  ifelse($5,,ac_extra=,[ac_extra=`echo "$5"|sed s#@ext_srcdir@#$ext_srcdir#g`])
   
     if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
   dnl ---------------------------------------------- Static module
  @@ -1470,4 +1477,81 @@
       $2
   ifelse([$3],[],,[else $3])
     fi
  +])
  +
  +AC_DEFUN(PHP_DEF_HAVE,[AC_DEFINE([HAVE_]translit($1,a-z_-,A-Z__), 1, [ ])])
  +
  +dnl
  +dnl PHP_CHECK_FUNC_LIB(func, libs)
  +dnl This macro checks whether 'func' or '__func' exists
  +dnl in the specified library.
  +dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
  +dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNC
  +dnl
  +
  +dnl autoconf undefines the builtin "shift" :-(
  +dnl If possible, we use the builtin shift anyway, otherwise we use
  +dnl the ubercool definition I have tested so far with FreeBSD/GNU m4
  +ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[
  +define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])])
  +])
  +
  +AC_DEFUN(PHP_CHECK_FUNC_LIB,[
  +  ifelse($2,,:,[
  +  unset ac_cv_lib_$2[]_$1
  +  unset ac_cv_lib_$2[]___$1
  +  unset found
  +  AC_CHECK_LIB($2, $1, [found=yes], [
  +    AC_CHECK_LIB($2, __$1, [found=yes], [found=no])
  +  ])
  +
  +  if test "$found" = "yes"; then
  +    PHP_ADD_LIBRARY($2)
  +    PHP_DEF_HAVE($1)
  +    PHP_DEF_HAVE(lib$2)
  +    ac_cv_func_$1=yes
  +  else
  +    PHP_CHECK_FUNC_LIB($1,phpshift(phpshift($@)))
  +  fi
  +  ])
  +])
  +
  +dnl
  +dnl PHP_CHECK_FUNC(func, ...)
  +dnl This macro checks whether 'func' or '__func' exists
  +dnl in the default libraries and as a fall back in the specified library.
  +dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
  +dnl
  +AC_DEFUN(PHP_CHECK_FUNC,[
  +  unset ac_cv_func_$1
  +  unset ac_cv_func___$1
  +  unset found
  +  
  +  AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ])
  +
  +  case $found in
  +  yes) 
  +    PHP_DEF_HAVE($1)
  +    ac_cv_func_$1=yes
  +  ;;
  +  ifelse($#,1,,[
  +    *) PHP_CHECK_FUNC_LIB($@) ;;
  +  ])
  +  esac
  +])
  +
  +dnl
  +dnl PHP_AP_EXTRACT_VERSION(/path/httpd)
  +dnl This macro is used to get a comparable
  +dnl version for apache1/2.
  +dnl
  +AC_DEFUN(PHP_AP_EXTRACT_VERSION,[
  +  ac_output=`$1 -v 2>&1`
  +  ac_IFS=$IFS
  +IFS="- /.
  +"
  +  set $ac_output
  +  IFS=$ac_IFS
  +
  +  APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`
   ])
  
  
  
  1.2.2.2   +1 -14     php4/buildconf
  
  Index: buildconf
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/buildconf,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- buildconf	9 Jul 2002 09:14:29 -0000	1.2.2.1
  +++ buildconf	3 Aug 2002 00:44:11 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   #!/bin/sh
  -# $Id: buildconf,v 1.53 2002/06/24 03:05:00 sas Exp $
  +# $Id: buildconf,v 1.57 2002/07/21 13:09:06 sas Exp $
   
   while test $# -gt 0; do
       if test "$1" = "--copy"; then
  @@ -19,19 +19,6 @@
       echo "using default Zend directory"
   fi
    
  -## build.mk does not check aclocal exit status yet
  -##
  -#mv aclocal.m4 aclocal.m4.old 2>/dev/null
  -#aclocal
  -#if test "$?" != "0" -a "$am_prefix" != "$lt_prefix"; then
  -#    echo "buildconf: ERROR: aclocal failed, probably because automake and"
  -#    echo "           libtool are installed with different prefixes;"
  -#    echo "           automake is installed in $am_prefix, but libtool in $lt_prefix."
  -#    echo "           Please re-install automake and/or libtool with a common prefix"
  -#    echo "           and try again."
  -#    exit 1
  -#fi
  -
   rm -f generated_lists
   
   ${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags" ZENDDIR="$ZENDDIR"
  
  
  
  1.2.2.2   +136 -128  php4/config.guess
  
  Index: config.guess
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/config.guess,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- config.guess	9 Jul 2002 09:14:29 -0000	1.2.2.1
  +++ config.guess	3 Aug 2002 00:44:11 -0000	1.2.2.2
  @@ -1,9 +1,9 @@
   #! /bin/sh
   # Attempt to guess a canonical system name.
  -#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
  -#   Free Software Foundation, Inc.
  +#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
  +#   2000, 2001, 2002 Free Software Foundation, Inc.
   
  -timestamp='2001-09-04'
  +timestamp='2002-05-29'
   
   # This file is free software; you can redistribute it and/or modify it
   # under the terms of the GNU General Public License as published by
  @@ -24,8 +24,9 @@
   # configuration script generated by Autoconf, you may include it under
   # the same distribution terms that you use for the rest of that program.
   
  -# Written by Per Bothner <bothn****@cygnu*****>.
  -# Please send patches to <confi****@gnu*****>.
  +# Originally written by Per Bothner <per****@bothn*****>.
  +# Please send patches to <confi****@gnu*****>.  Submit a context
  +# diff and a properly formatted ChangeLog entry.
   #
   # This script attempts to guess a canonical system name similar to
   # config.sub.  If it succeeds, it prints the system name on stdout, and
  @@ -97,7 +98,7 @@
   
   set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
    ,,)    echo "int dummy(){}" > $dummy.c ;
  -	for c in cc gcc c89 ; do
  +	for c in cc gcc c89 c99 ; do
   	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
   	  if test $? = 0 ; then
   	     CC_FOR_BUILD="$c"; break ;
  @@ -127,29 +128,30 @@
   
   case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
       *:NetBSD:*:*)
  -	# Netbsd (nbsd) targets should (where applicable) match one or
  +	# NetBSD (nbsd) targets should (where applicable) match one or
   	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
   	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
   	# switched to ELF, *-*-netbsd* would select the old
   	# object file format.  This provides both forward
   	# compatibility and a consistent mechanism for selecting the
   	# object file format.
  -	# Determine the machine/vendor (is the vendor relevant).
  -	case "${UNAME_MACHINE}" in
  -	    amiga) machine=m68k-unknown ;;
  -	    arm32) machine=arm-unknown ;;
  -	    atari*) machine=m68k-atari ;;
  -	    sun3*) machine=m68k-sun ;;
  -	    mac68k) machine=m68k-apple ;;
  -	    macppc) machine=powerpc-apple ;;
  -	    hp3[0-9][05]) machine=m68k-hp ;;
  -	    ibmrt|romp-ibm) machine=romp-ibm ;;
  -	    *) machine=${UNAME_MACHINE}-unknown ;;
  +	#
  +	# Note: NetBSD doesn't particularly care about the vendor
  +	# portion of the name.  We always set it to "unknown".
  +	sysctl="sysctl -n hw.machine_arch"
  +	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
  +	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
  +	case "${UNAME_MACHINE_ARCH}" in
  +	    armeb) machine=armeb-unknown ;;
  +	    arm*) machine=arm-unknown ;;
  +	    sh3el) machine=shl-unknown ;;
  +	    sh3eb) machine=sh-unknown ;;
  +	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
   	esac
   	# The Operating System including object format, if it has switched
   	# to ELF recently, or will in the future.
  -	case "${UNAME_MACHINE}" in
  -	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
  +	case "${UNAME_MACHINE_ARCH}" in
  +	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
   		eval $set_cc_for_build
   		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
   			| grep __ELF__ >/dev/null
  @@ -172,6 +174,45 @@
   	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
   	echo "${machine}-${os}${release}"
   	exit 0 ;;
  +    amiga:OpenBSD:*:*)
  +	echo m68k-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    arc:OpenBSD:*:*)
  +	echo mipsel-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    hp300:OpenBSD:*:*)
  +	echo m68k-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    mac68k:OpenBSD:*:*)
  +	echo m68k-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    macppc:OpenBSD:*:*)
  +	echo powerpc-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    mvme68k:OpenBSD:*:*)
  +	echo m68k-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    mvme88k:OpenBSD:*:*)
  +	echo m88k-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    mvmeppc:OpenBSD:*:*)
  +	echo powerpc-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    pmax:OpenBSD:*:*)
  +	echo mipsel-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    sgi:OpenBSD:*:*)
  +	echo mipseb-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    sun3:OpenBSD:*:*)
  +	echo m68k-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    wgrisc:OpenBSD:*:*)
  +	echo mipsel-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
  +    *:OpenBSD:*:*)
  +	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
  +	exit 0 ;;
       alpha:OSF1:*:*)
   	if test $UNAME_RELEASE = "V4.0"; then
   		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
  @@ -247,29 +288,11 @@
       Amiga*:UNIX_System_V:4.0:*)
   	echo m68k-unknown-sysv4
   	exit 0;;
  -    amiga:OpenBSD:*:*)
  -	echo m68k-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
       *:[Aa]miga[Oo][Ss]:*:*)
   	echo ${UNAME_MACHINE}-unknown-amigaos
   	exit 0 ;;
  -    arc64:OpenBSD:*:*)
  -	echo mips64el-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    arc:OpenBSD:*:*)
  -	echo mipsel-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    hkmips:OpenBSD:*:*)
  -	echo mips-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    pmax:OpenBSD:*:*)
  -	echo mipsel-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    sgi:OpenBSD:*:*)
  -	echo mips-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    wgrisc:OpenBSD:*:*)
  -	echo mipsel-unknown-openbsd${UNAME_RELEASE}
  +    *:[Mm]orph[Oo][Ss]:*:*)
  +	echo ${UNAME_MACHINE}-unknown-morphos
   	exit 0 ;;
       *:OS/390:*:*)
   	echo i370-ibm-openedition
  @@ -319,7 +342,7 @@
   	echo m68k-sun-sunos${UNAME_RELEASE}
   	exit 0 ;;
       sun*:*:4.2BSD:*)
  -	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
  +	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
   	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
   	case "`/bin/arch`" in
   	    sun3)
  @@ -333,12 +356,6 @@
       aushp:SunOS:*:*)
   	echo sparc-auspex-sunos${UNAME_RELEASE}
   	exit 0 ;;
  -    sparc*:NetBSD:*)
  -	echo `uname -p`-unknown-netbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    atari*:OpenBSD:*:*)
  -	echo m68k-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
       # The situation for MiNT is a little confusing.  The machine name
       # can be virtually everything (everything which is not
       # "atarist" or "atariste" at least should have a processor
  @@ -365,18 +382,6 @@
       *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
           echo m68k-unknown-mint${UNAME_RELEASE}
           exit 0 ;;
  -    sun3*:OpenBSD:*:*)
  -	echo m68k-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    mac68k:OpenBSD:*:*)
  -	echo m68k-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    mvme68k:OpenBSD:*:*)
  -	echo m68k-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
  -    mvme88k:OpenBSD:*:*)
  -	echo m88k-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
       powerpc:machten:*:*)
   	echo powerpc-apple-machten${UNAME_RELEASE}
   	exit 0 ;;
  @@ -424,6 +429,9 @@
       Motorola:PowerMAX_OS:*:*)
   	echo powerpc-motorola-powermax
   	exit 0 ;;
  +    Night_Hawk:*:*:PowerMAX_OS)
  +	echo powerpc-harris-powermax
  +	exit 0 ;;
       Night_Hawk:Power_UNIX:*:*)
   	echo powerpc-harris-powerunix
   	exit 0 ;;
  @@ -506,7 +514,7 @@
   	fi
   	exit 0 ;;
       *:AIX:*:[45])
  -	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
  +	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
   	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
   		IBM_ARCH=rs6000
   	else
  @@ -546,10 +554,8 @@
   	    9000/31? )            HP_ARCH=m68000 ;;
   	    9000/[34]?? )         HP_ARCH=m68k ;;
   	    9000/[678][0-9][0-9])
  -              case "${HPUX_REV}" in
  -                11.[0-9][0-9])
  -                  if [ -x /usr/bin/getconf ]; then
  -                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
  +		if [ -x /usr/bin/getconf ]; then
  +		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
                       sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
                       case "${sc_cpu_version}" in
                         523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
  @@ -558,13 +564,13 @@
                           case "${sc_kernel_bits}" in
                             32) HP_ARCH="hppa2.0n" ;;
                             64) HP_ARCH="hppa2.0w" ;;
  +			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
                           esac ;;
                       esac
  -                  fi ;;
  -              esac
  -              if [ "${HP_ARCH}" = "" ]; then
  -	      eval $set_cc_for_build
  -              sed 's/^              //' << EOF >$dummy.c
  +		fi
  +		if [ "${HP_ARCH}" = "" ]; then
  +		    eval $set_cc_for_build
  +		    sed 's/^              //' << EOF >$dummy.c
   
                 #define _HPUX_SOURCE
                 #include <stdlib.h>
  @@ -597,10 +603,10 @@
                     exit (0);
                 }
   EOF
  -	    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
  -	    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
  -	    rm -f $dummy.c $dummy
  -	fi ;;
  +		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
  +		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
  +		    rm -f $dummy.c $dummy
  +		fi ;;
   	esac
   	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
   	exit 0 ;;
  @@ -664,9 +670,6 @@
       parisc*:Lites*:*:*)
   	echo hppa1.1-hp-lites
   	exit 0 ;;
  -    hppa*:OpenBSD:*:*)
  -	echo hppa-unknown-openbsd
  -	exit 0 ;;
       C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
   	echo c1-convex-bsd
           exit 0 ;;
  @@ -685,9 +688,6 @@
       C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
   	echo c4-convex-bsd
           exit 0 ;;
  -    CRAY*X-MP:*:*:*)
  -	echo xmp-cray-unicos
  -        exit 0 ;;
       CRAY*Y-MP:*:*:*)
   	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
   	exit 0 ;;
  @@ -709,18 +709,12 @@
       CRAY*SV1:*:*:*)
   	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
   	exit 0 ;;
  -    CRAY-2:*:*:*)
  -	echo cray2-cray-unicos
  -        exit 0 ;;
       F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
   	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
           FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
           FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
           echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
           exit 0 ;;
  -    hp300:OpenBSD:*:*)
  -	echo m68k-unknown-openbsd${UNAME_RELEASE}
  -	exit 0 ;;
       i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
   	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
   	exit 0 ;;
  @@ -733,9 +727,6 @@
       *:FreeBSD:*:*)
   	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
   	exit 0 ;;
  -    *:OpenBSD:*:*)
  -	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  -	exit 0 ;;
       i*:CYGWIN*:*)
   	echo ${UNAME_MACHINE}-pc-cygwin
   	exit 0 ;;
  @@ -745,6 +736,9 @@
       i*:PW*:*)
   	echo ${UNAME_MACHINE}-pc-pw32
   	exit 0 ;;
  +    x86:Interix*:3*)
  +	echo i386-pc-interix3
  +	exit 0 ;;
       i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
   	# How do we know it's Interix rather than the generic POSIX subsystem?
   	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
  @@ -770,16 +764,30 @@
   	echo ${UNAME_MACHINE}-unknown-linux-gnu
   	exit 0 ;;
       ia64:Linux:*:*)
  -	echo ${UNAME_MACHINE}-unknown-linux
  +	echo ${UNAME_MACHINE}-unknown-linux-gnu
   	exit 0 ;;
       m68*:Linux:*:*)
   	echo ${UNAME_MACHINE}-unknown-linux-gnu
   	exit 0 ;;
       mips:Linux:*:*)
  -	case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
  -	  big)    echo mips-unknown-linux-gnu && exit 0 ;;
  -	  little) echo mipsel-unknown-linux-gnu && exit 0 ;;
  -	esac
  +	eval $set_cc_for_build
  +	sed 's/^	//' << EOF >$dummy.c
  +	#undef CPU
  +	#undef mips
  +	#undef mipsel
  +	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
  +	CPU=mipsel
  +	#else
  +	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
  +	CPU=mips
  +	#else
  +	CPU=
  +	#endif
  +	#endif
  +EOF
  +	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
  +	rm -f $dummy.c
  +	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
   	;;
       ppc:Linux:*:*)
   	echo powerpc-unknown-linux-gnu
  @@ -828,7 +836,8 @@
   	# The BFD linker knows what the default object file format is, so
   	# first see if it will tell us. cd to the root directory to prevent
   	# problems with other programs or directories called `ld' in the path.
  -	ld_supported_targets=`cd /; ld --help 2>&1 \
  +	# Set LC_ALL=C to ensure ld outputs messages in English.
  +	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
   			 | sed -ne '/supported targets:/!d
   				    s/[ 	][ 	]*/ /g
   				    s/.*supported targets: *//
  @@ -852,32 +861,29 @@
   	esac
   	# Determine whether the default compiler is a.out or elf
   	eval $set_cc_for_build
  -	cat >$dummy.c <<EOF
  -#include <features.h>
  -#ifdef __cplusplus
  -#include <stdio.h>  /* for printf() prototype */
  -	int main (int argc, char *argv[]) {
  -#else
  -	int main (argc, argv) int argc; char *argv[]; {
  -#endif
  -#ifdef __ELF__
  -# ifdef __GLIBC__
  -#  if __GLIBC__ >= 2
  -    printf ("%s-pc-linux-gnu\n", argv[1]);
  -#  else
  -    printf ("%s-pc-linux-gnulibc1\n", argv[1]);
  -#  endif
  -# else
  -   printf ("%s-pc-linux-gnulibc1\n", argv[1]);
  -# endif
  -#else
  -  printf ("%s-pc-linux-gnuaout\n", argv[1]);
  -#endif
  -  return 0;
  -}
  +	sed 's/^	//' << EOF >$dummy.c
  +	#include <features.h>
  +	#ifdef __ELF__
  +	# ifdef __GLIBC__
  +	#  if __GLIBC__ >= 2
  +	LIBC=gnu
  +	#  else
  +	LIBC=gnulibc1
  +	#  endif
  +	# else
  +	LIBC=gnulibc1
  +	# endif
  +	#else
  +	#ifdef __INTEL_COMPILER
  +	LIBC=gnu
  +	#else
  +	LIBC=gnuaout
  +	#endif
  +	#endif
   EOF
  -	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
  -	rm -f $dummy.c $dummy
  +	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
  +	rm -f $dummy.c
  +	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
   	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
   	;;
       i*86:DYNIX/ptx:4*:*)
  @@ -915,13 +921,13 @@
   		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
   		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
   	elif /bin/uname -X 2>/dev/null >/dev/null ; then
  -		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
  -		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
  -		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
  +		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
  +		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
  +		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
   			&& UNAME_MACHINE=i586
  -		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
  +		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
   			&& UNAME_MACHINE=i686
  -		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
  +		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
   			&& UNAME_MACHINE=i686
   		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
   	else
  @@ -956,7 +962,7 @@
   	exit 0 ;;
       M68*:*:R3V[567]*:*)
   	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
  -    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
  +    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
   	OS_REL=''
   	test -r /etc/.relid \
   	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
  @@ -1057,15 +1063,17 @@
   	echo `uname -p`-apple-darwin${UNAME_RELEASE}
   	exit 0 ;;
       *:procnto*:*:* | *:QNX:[0123456789]*:*)
  -	if test "${UNAME_MACHINE}" = "x86pc"; then
  +	UNAME_PROCESSOR=`uname -p`
  +	if test "$UNAME_PROCESSOR" = "x86"; then
  +		UNAME_PROCESSOR=i386
   		UNAME_MACHINE=pc
   	fi
  -	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
  +	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
   	exit 0 ;;
       *:QNX:*:4*)
   	echo i386-pc-qnx
   	exit 0 ;;
  -    NSR-[KW]:NONSTOP_KERNEL:*:*)
  +    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
   	echo nsr-tandem-nsk${UNAME_RELEASE}
   	exit 0 ;;
       *:NonStop-UX:*:*)
  
  
  
  1.2.2.2   +95 -63    php4/config.sub
  
  Index: config.sub
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/config.sub,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- config.sub	9 Jul 2002 09:14:29 -0000	1.2.2.1
  +++ config.sub	3 Aug 2002 00:44:11 -0000	1.2.2.2
  @@ -1,9 +1,9 @@
   #! /bin/sh
   # Configuration validation subroutine script.
  -#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
  -#   Free Software Foundation, Inc.
  +#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
  +#   2000, 2001, 2002 Free Software Foundation, Inc.
   
  -timestamp='2001-09-07'
  +timestamp='2002-05-28'
   
   # This file is (in principle) common to ALL GNU software.
   # The presence of a machine in this file suggests that SOME GNU software
  @@ -29,7 +29,8 @@
   # configuration script generated by Autoconf, you may include it under
   # the same distribution terms that you use for the rest of that program.
   
  -# Please send patches to <confi****@gnu*****>.
  +# Please send patches to <confi****@gnu*****>.  Submit a context
  +# diff and a properly formatted ChangeLog entry.
   #
   # Configuration subroutine to validate and canonicalize a configuration type.
   # Supply the specified configuration type as an argument.
  @@ -117,7 +118,7 @@
   # Here we must recognize all the valid KERNEL-OS combinations.
   maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
   case $maybe_os in
  -  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
  +  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
       os=-$maybe_os
       basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
       ;;
  @@ -226,32 +227,32 @@
   	1750a | 580 \
   	| a29k \
   	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
  +	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
   	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
   	| c4x | clipper \
  -	| d10v | d30v | dsp16xx \
  +	| d10v | d30v | dlx | dsp16xx \
   	| fr30 \
   	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
   	| i370 | i860 | i960 | ia64 \
   	| m32r | m68000 | m68k | m88k | mcore \
  -	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
  +	| mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
   	| mips64vr4100 | mips64vr4100el | mips64vr4300 \
   	| mips64vr4300el | mips64vr5000 | mips64vr5000el \
   	| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
  -	| mipsisa32 \
  +	| mipsisa32 | mipsisa64 \
   	| mn10200 | mn10300 \
   	| ns16k | ns32k \
  -	| openrisc \
  +	| openrisc | or32 \
   	| pdp10 | pdp11 | pj | pjl \
   	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
   	| pyramid \
  -	| s390 | s390x \
  -	| sh | sh[34] | sh[34]eb | shbe | shle \
  -	| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
  -	| stormy16 | strongarm \
  +	| sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
  +	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
  +	| strongarm \
   	| tahoe | thumb | tic80 | tron \
  -	| v850 \
  +	| v850 | v850e \
   	| we32k \
  -	| x86 | xscale \
  +	| x86 | xscale | xstormy16 | xtensa \
   	| z8k)
   		basic_machine=$basic_machine-unknown
   		;;
  @@ -278,19 +279,21 @@
   	580-* \
   	| a29k-* \
   	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
  -	| alphapca5[67]-* | arc-* \
  -	| arm-*  | armbe-* | armle-* | armv*-* \
  +	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
  +	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
  +	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
  +	| avr-* \
   	| bs2000-* \
   	| c[123]* | c30-* | [cjt]90-* | c54x-* \
  -	| clipper-* | cray2-* | cydra-* \
  -	| d10v-* | d30v-* \
  +	| clipper-* | cydra-* \
  +	| d10v-* | d30v-* | dlx-* \
   	| elxsi-* \
   	| f30[01]-* | f700-* | fr30-* | fx80-* \
   	| h8300-* | h8500-* \
   	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
   	| i*86-* | i860-* | i960-* | ia64-* \
   	| m32r-* \
  -	| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
  +	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
   	| m88110-* | m88k-* | mcore-* \
   	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
   	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
  @@ -302,14 +305,14 @@
   	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
   	| pyramid-* \
   	| romp-* | rs6000-* \
  -	| s390-* | s390x-* \
  -	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
  -	| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
  -	| sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
  -	| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
  -	| v850-* | vax-* \
  +	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
  +	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
  +	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
  +	| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
  +	| v850-* | v850e-* | vax-* \
   	| we32k-* \
  -	| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
  +	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
  +	| xtensa-* \
   	| ymp-* \
   	| z8k-*)
   		;;
  @@ -374,6 +377,10 @@
   		basic_machine=ns32k-sequent
   		os=-dynix
   		;;
  +	c90)
  +		basic_machine=c90-cray
  +		os=-unicos
  +		;;
   	convex-c1)
   		basic_machine=c1-convex
   		os=-bsd
  @@ -394,16 +401,8 @@
   		basic_machine=c38-convex
   		os=-bsd
   		;;
  -	cray | ymp)
  -		basic_machine=ymp-cray
  -		os=-unicos
  -		;;
  -	cray2)
  -		basic_machine=cray2-cray
  -		os=-unicos
  -		;;
  -	[cjt]90)
  -		basic_machine=${basic_machine}-cray
  +	cray | j90)
  +		basic_machine=j90-cray
   		os=-unicos
   		;;
   	crds | unos)
  @@ -418,6 +417,14 @@
   	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
   		basic_machine=mips-dec
   		;;
  +	decsystem10* | dec10*)
  +		basic_machine=pdp10-dec
  +		os=-tops10
  +		;;
  +	decsystem20* | dec20*)
  +		basic_machine=pdp10-dec
  +		os=-tops20
  +		;;
   	delta | 3300 | motorola-3300 | motorola-delta \
   	      | 3300-motorola | delta-motorola)
   		basic_machine=m68k-motorola
  @@ -598,14 +605,6 @@
   		basic_machine=m68k-atari
   		os=-mint
   		;;
  -	mipsel*-linux*)
  -		basic_machine=mipsel-unknown
  -		os=-linux-gnu
  -		;;
  -	mips*-linux*)
  -		basic_machine=mips-unknown
  -		os=-linux-gnu
  -		;;
   	mips3*-*)
   		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
   		;;
  @@ -620,6 +619,10 @@
   		basic_machine=m68k-rom68k
   		os=-coff
   		;;
  +	morphos)
  +		basic_machine=powerpc-unknown
  +		os=-morphos
  +		;;
   	msdos)
   		basic_machine=i386-pc
   		os=-msdos
  @@ -699,6 +702,10 @@
   		basic_machine=hppa1.1-oki
   		os=-proelf
   		;;
  +	or32 | or32-*)
  +		basic_machine=or32-unknown
  +		os=-coff
  +		;;
   	OSE68000 | ose68000)
   		basic_machine=m68000-ericsson
   		os=-ose
  @@ -724,7 +731,7 @@
           pc532 | pc532-*)
   		basic_machine=ns32k-pc532
   		;;
  -	pentium | p5 | k5 | k6 | nexgen)
  +	pentium | p5 | k5 | k6 | nexgen | viac3)
   		basic_machine=i586-pc
   		;;
   	pentiumpro | p6 | 6x86 | athlon)
  @@ -733,7 +740,7 @@
   	pentiumii | pentium2)
   		basic_machine=i686-pc
   		;;
  -	pentium-* | p5-* | k5-* | k6-* | nexgen-*)
  +	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
   		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
   		;;
   	pentiumpro-* | p6-* | 6x86-* | athlon-*)
  @@ -784,6 +791,12 @@
   	rtpc | rtpc-*)
   		basic_machine=romp-ibm
   		;;
  +	s390 | s390-*)
  +		basic_machine=s390-ibm
  +		;;
  +	s390x | s390x-*)
  +		basic_machine=s390x-ibm
  +		;;
   	sa29200)
   		basic_machine=a29k-amd
   		os=-udi
  @@ -795,7 +808,7 @@
   		basic_machine=sh-hitachi
   		os=-hms
   		;;
  -	sparclite-wrs)
  +	sparclite-wrs | simso-wrs)
   		basic_machine=sparclite-wrs
   		os=-vxworks
   		;;
  @@ -853,7 +866,7 @@
   	sun386 | sun386i | roadrunner)
   		basic_machine=i386-sun
   		;;
  -	sv1)
  +        sv1)
   		basic_machine=sv1-cray
   		os=-unicos
   		;;
  @@ -861,8 +874,16 @@
   		basic_machine=i386-sequent
   		os=-dynix
   		;;
  +	t3d)
  +		basic_machine=alpha-cray
  +		os=-unicos
  +		;;
   	t3e)
  -		basic_machine=t3e-cray
  +		basic_machine=alphaev5-cray
  +		os=-unicos
  +		;;
  +	t90)
  +		basic_machine=t90-cray
   		os=-unicos
   		;;
   	tic54x | c54x*)
  @@ -875,6 +896,10 @@
   	tx39el)
   		basic_machine=mipstx39el-unknown
   		;;
  +	toad1)
  +		basic_machine=pdp10-xkl
  +		os=-tops20
  +		;;
   	tower | tower-32)
   		basic_machine=m68k-ncr
   		;;
  @@ -925,13 +950,13 @@
   		basic_machine=i386-pc
   		os=-windows32-msvcrt
   		;;
  -	xmp)
  -		basic_machine=xmp-cray
  -		os=-unicos
  -		;;
           xps | xps100)
   		basic_machine=xps100-honeywell
   		;;
  +	ymp)
  +		basic_machine=ymp-cray
  +		os=-unicos
  +		;;
   	z8k-*-coff)
   		basic_machine=z8k-unknown
   		os=-sim
  @@ -952,13 +977,6 @@
   	op60c)
   		basic_machine=hppa1.1-oki
   		;;
  -	mips)
  -		if [ x$os = x-linux-gnu ]; then
  -			basic_machine=mips-unknown
  -		else
  -			basic_machine=mips-mips
  -		fi
  -		;;
   	romp)
   		basic_machine=romp-ibm
   		;;
  @@ -981,6 +999,9 @@
   	sh3 | sh4 | sh3eb | sh4eb)
   		basic_machine=sh-unknown
   		;;
  +	sh64)
  +		basic_machine=sh64-unknown
  +		;;
   	sparc | sparcv9 | sparcv9b)
   		basic_machine=sparc-sun
   		;;
  @@ -1068,7 +1089,8 @@
   	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
   	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
   	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
  -	      | -os2* | -vos*)
  +	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
  +	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
   	# Remember, each alternative MUST END IN *, to match a version number.
   		;;
   	-qnx*)
  @@ -1120,12 +1142,18 @@
   	-acis*)
   		os=-aos
   		;;
  +	-atheos*)
  +		os=-atheos
  +		;;
   	-386bsd)
   		os=-bsd
   		;;
   	-ctix* | -uts*)
   		os=-sysv
   		;;
  +	-nova*)
  +		os=-rtmk-nova
  +		;;
   	-ns2 )
   	        os=-nextstep2
   		;;
  @@ -1200,6 +1228,7 @@
   	arm*-semi)
   		os=-aout
   		;;
  +	# This must come before the *-dec entry.
   	pdp10-*)
   		os=-tops20
   		;;
  @@ -1230,6 +1259,9 @@
   	mips*-*)
   		os=-elf
   		;;
  +	or32-*)
  +		os=-coff
  +		;;
   	*-tti)	# must be before sparc entry or we get the wrong os.
   		os=-sysv3
   		;;
  @@ -1377,7 +1409,7 @@
   			-ptx*)
   				vendor=sequent
   				;;
  -			-vxsim* | -vxworks*)
  +			-vxsim* | -vxworks* | -windiss*)
   				vendor=wrs
   				;;
   			-aux*)
  
  
  
  1.2.2.5   +70 -136   php4/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/configure.in,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- configure.in	9 Jul 2002 09:14:29 -0000	1.2.2.4
  +++ configure.in	3 Aug 2002 00:44:11 -0000	1.2.2.5
  @@ -1,4 +1,4 @@
  -dnl ## $Id: configure.in,v 1.357 2002/07/02 09:31:33 sas Exp $ -*- sh -*-
  +dnl ## $Id: configure.in,v 1.364 2002/07/23 01:58:52 sniper Exp $ -*- sh -*-
   dnl ## Process this file with autoconf to produce a configure script.
   
   divert(1)
  @@ -82,40 +82,6 @@
   fi
   
   
  -
  -dnl Platform-specific compile settings.
  -dnl -------------------------------------------------------------------------
  -
  -dnl if host_alias is empty, ac_cv_host_alias may still have the info
  -if test -z "$host_alias"; then
  -    host_alias=$ac_cv_host_alias
  -fi
  -
  -BSD_MAKEFILE=no
  -
  -case $host_alias in
  -*solaris*)
  -    CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
  -    if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
  -      enable_libgcc=yes
  -    fi
  -    ;;
  -*dgux*)
  -    CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
  -*darwin*|*rhapsody*)
  -    CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
  -    php_multiple_shlib_versions_ok=yes;;
  -*bsdi*)
  -    BSD_MAKEFILE=yes;;
  -*beos*)
  -    beos_threads=1
  -    LIBS="$LIBS -lbe -lroot";;
  -*mips*)
  -    CPPFLAGS="$CPPFLAGS -D_XPG_IV";;
  -esac
  -
  -
  -
   dnl Settings we want to make before the checks.
   dnl -------------------------------------------------------------------------
   
  @@ -130,9 +96,6 @@
   dnl We want this one before the checks, so the checks can modify CFLAGS.
   test -z "$CFLAGS" && auto_cflags=1
   
  -dnl AC_AIX needs to be before any macros that run the C compiler. 
  -AC_AIX
  -
   abs_srcdir=`(cd $srcdir; pwd)`
   abs_builddir=`pwd`
   
  @@ -155,35 +118,15 @@
   dnl Change to AC_PROG_CC_STDC when we start requiring a post-2.13 autoconf
   dnl AC_PROG_CC_STDC
   AC_PROG_CPP
  +
  +AC_AIX
  +
   dnl AC_PROG_CXX
   dnl AC_PROG_CXXCPP
  +
   dnl check for -R, etc. switch
  -AC_MSG_CHECKING([whether compiler supports -R])
  -AC_CACHE_VAL(php_cv_cc_dashr,[
  -  SAVE_LIBS=$LIBS
  -  LIBS="-R /usr/lib $LIBS"
  -  AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
  -  LIBS=$SAVE_LIBS
  -])
  -AC_MSG_RESULT([$php_cv_cc_dashr])
  -if test $php_cv_cc_dashr = "yes"; then
  -  ld_runpath_switch=-R
  -else
  -  AC_MSG_CHECKING([whether compiler supports -Wl,-rpath,])
  -  AC_CACHE_VAL(php_cv_cc_rpath, [
  -    SAVE_LIBS=$LIBS
  -    LIBS="-Wl,-rpath,/usr/lib $LIBS"
  -    AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
  -    LIBS=$SAVE_LIBS
  -  ])
  -  AC_MSG_RESULT([$php_cv_cc_rpath])
  -  if test $php_cv_cc_rpath = "yes"; then
  -    ld_runpath_switch=-Wl,-rpath,
  -  else
  -    dnl something innocuous
  -    ld_runpath_switch=-L
  -  fi
  -fi
  +PHP_RUNPATH_SWITCH
  +
   AC_PROG_RANLIB
   AC_PROG_LN_S
   AC_PROG_AWK
  @@ -212,6 +155,33 @@
   fi
   
   
  +dnl Platform-specific compile settings.
  +dnl -------------------------------------------------------------------------
  +
  +dnl if host_alias is empty, ac_cv_host_alias may still have the info
  +if test -z "$host_alias"; then
  +    host_alias=$ac_cv_host_alias
  +fi
  +
  +case $host_alias in
  +*solaris*)
  +    CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
  +    if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
  +      enable_libgcc=yes
  +    fi
  +    ;;
  +*dgux*)
  +    CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
  +*darwin*|*rhapsody*)
  +    CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
  +    php_multiple_shlib_versions_ok=yes;;
  +*beos*)
  +    beos_threads=1
  +    LIBS="$LIBS -lbe -lroot";;
  +*mips*)
  +    CPPFLAGS="$CPPFLAGS -D_XPG_IV";;
  +esac
  +
   
   dnl Include Zend and TSRM configurations.
   dnl -------------------------------------------------------------------------
  @@ -298,76 +268,29 @@
   dnl First, library checks.
   dnl -------------------------------------------------------------------------
   
  -AC_CHECK_LIB(socket, socket, [
  - PHP_ADD_LIBRARY(socket)
  - AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
  -  AC_CHECK_LIB(socket, htonl, [
  -   PHP_ADD_LIBRARY(socket)
  -   ])])
  -
   dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try
   dnl to avoid -lnsl checks, if we already have the functions which
   dnl are usually in libnsl
   dnl Also, uClibc will bark at linking with glibc's libnsl.
  -unset ac_cv_func_gethostname
  -unset ac_cv_func_yp_get_default_domain
  -case $host_alias in
  -  *unixware* | *sco*)
  -    AC_CHECK_FUNC(gethostname, [
  -      php_no_nsl_checks=yes
  -    ])
  -    ;;
  -esac
  -
  -AC_CHECK_FUNC(yp_get_default_domain, [
  -  php_no_nsl_checks=yes
  -])
  -unset ac_cv_func_gethostname
  -unset ac_cv_func_yp_get_default_domain
  -
  -if test "$php_no_nsl_checks" != "yes"; then
   
  -AC_CHECK_LIB(nsl, gethostname, [
  - PHP_ADD_LIBRARY(nsl)
  - AC_DEFINE(HAVE_LIBNSL,1,[ ]) ],[
  - AC_CHECK_LIB(nsl, gethostbyaddr, [
  -  PHP_ADD_LIBRARY(nsl)
  -  AC_DEFINE(HAVE_LIBNSL,1,[ ]) ], [])
  -])
  +PHP_CHECK_FUNC(socket, socket)
  +PHP_CHECK_FUNC(htonl, socket)
  +PHP_CHECK_FUNC(gethostname, nsl)
  +PHP_CHECK_FUNC(gethostbyaddr, nsl)
  +PHP_CHECK_FUNC(yp_get_default_domain, nsl)
   
  -fi
  -
  -AC_CHECK_LIB(dl, dlopen,[PHP_ADD_LIBRARY(dl)])
  -
  -dnl The sin may be in a library which need not be specifed
  -dnl as well as res_search resides in libsocket
  +AC_CHECK_LIB(dl, dlopen, [PHP_ADD_LIBRARY(dl)])
   AC_CHECK_LIB(m, sin)
   
  -dnl Only include libbind if inet_aton is not found in 
  -dnl libresolv.
  -AC_CHECK_LIB(resolv, inet_aton, [], [
  -  AC_CHECK_LIB(bind, inet_aton, [], [
  -    AC_CHECK_LIB(bind, __inet_aton)
  -  ])
  -])
  -
  -dnl The res_search may be in libsocket as well, and if it is
  -dnl make sure to check for dn_skipname in libresolv, or if res_search
  -dnl is in neither of these libs, still check for dn_skipname in libresolv
  -AC_CHECK_LIB(socket, res_search, [
  - AC_CHECK_LIB(resolv, dn_skipname)
  - AC_CHECK_LIB(resolv, __dn_skipname)
  - LIBS="$LIBS -lsocket"
  - AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
  - AC_CHECK_LIB(resolv, res_search, [
  -  LIBS="$LIBS -lresolv"
  -  AC_DEFINE(HAVE_LIBRESOLV,1,[ ]) 
  - ], [
  -  AC_CHECK_LIB(resolv, dn_skipname)
  -  AC_CHECK_LIB(resolv, __dn_skipname)
  - ]) 
  -])
  -
  +dnl Check for resolver routines.
  +dnl Need to check for both res_search and __res_search
  +dnl in -lc, -lbind, -lresolv and -lsocket
  +PHP_CHECK_FUNC(res_search, resolv, bind, socket)
  +
  +dnl Check for inet_aton and dn_skipname
  +dnl in -lc, -lbind and -lresolv
  +PHP_CHECK_FUNC(inet_aton, resolv, bind)
  +PHP_CHECK_FUNC(dn_skipname, resolv, bind)
   
   
   dnl Then headers.
  @@ -384,8 +307,11 @@
   fi
   PHP_MISSING_FCLOSE_DECL
   dnl QNX requires unix.h to allow functions in libunix to work properly
  -AC_CHECK_HEADERS(
  +AC_CHECK_HEADERS([ \
   ApplicationServices/ApplicationServices.h \
  +sys/types.h \
  +sys/time.h \
  +netinet/in.h \
   alloca.h \
   arpa/inet.h \
   arpa/nameser.h \
  @@ -398,7 +324,6 @@
   limits.h \
   locale.h \
   mach-o/dyld.h \
  -netinet/in.h \
   pwd.h \
   resolv.h \
   signal.h \
  @@ -418,15 +343,26 @@
   sys/statvfs.h \
   sys/vfs.h \
   sys/sysexits.h \
  -sys/time.h \
  -sys/types.h \
   sys/varargs.h \
   sys/wait.h \
   unistd.h \
   unix.h \
   utime.h \
   sys/utsname.h \
  -)
  +],[],[],[
  +#ifdef HAVE_SYS_TYPES_H
  +#include <sys/types.h>
  +#endif
  +#ifdef HAVE_SYS_TIME_H
  +#include <sys/time.h>
  +#endif
  +#ifdef HAVE_NETINET_IN_H
  +#include <netinet/in.h>
  +#endif
  +#ifdef HAVE_ARPA_NAMESER_H
  +#include <arpa/nameser.h>
  +#endif
  +])
   
   
   
  @@ -494,7 +430,6 @@
   gai_strerror \
   gcvt \
   getlogin \
  -gethostbyaddr \
   getprotobyname \
   getprotobynumber \
   getservbyname \
  @@ -502,7 +437,6 @@
   getrusage \
   gettimeofday \
   gmtime_r \
  -inet_aton \
   isascii \
   link \
   localtime_r \
  @@ -955,7 +889,7 @@
   AC_SUBST(EXPANDED_LOCALSTATEDIR)
   AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
   
  -PHP_BUILD_RPATH
  +PHP_UTILIZE_RPATHS
   
   PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
   PHP_REMOVE_USR_LIB(LDFLAGS)
  @@ -964,9 +898,9 @@
   
   PHP_BUILD_DATE=`date '+%Y-%m-%d'`
   AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
  -PHP_UNAME=`uname -a`
  +PHP_UNAME=`uname -a | xargs`
   AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
  -PHP_OS=`uname`
  +PHP_OS=`uname | xargs`
   AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
   
   if test "$disable_cli" != "1"; then
  
  
  
  1.2.2.4   +30 -9     php4/php.ini-dist
  
  Index: php.ini-dist
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/php.ini-dist,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- php.ini-dist	9 Jul 2002 09:14:29 -0000	1.2.2.3
  +++ php.ini-dist	3 Aug 2002 00:44:11 -0000	1.2.2.4
  @@ -148,12 +148,6 @@
   ; will be allowed to be executed via the exec family of functions.
   safe_mode_exec_dir =
   
  -; open_basedir, if set, limits all file operations to the defined directory
  -; and below.  This directive makes most sense if used in a per-directory
  -; or per-virtualhost web server configuration file.
  -;
  -;open_basedir =
  -
   ; Setting certain environment variables may be a potential security breach.
   ; This directive contains a comma-delimited list of prefixes.  In Safe Mode,
   ; the user may only alter environment variables whose names begin with the
  @@ -169,8 +163,14 @@
   ; protected even if safe_mode_allowed_env_vars is set to allow to change them.
   safe_mode_protected_env_vars = LD_LIBRARY_PATH
   
  +; open_basedir, if set, limits all file operations to the defined directory
  +; and below.  This directive makes most sense if used in a per-directory
  +; or per-virtualhost web server configuration file. This directive is
  +; *NOT* affected by whether Safe Mode is turned On or Off.
  +;open_basedir =
  +
   ; This directive allows you to disable certain functions for security reasons.
  -; It receives a comma-delimited list of function names.  This directive is
  +; It receives a comma-delimited list of function names. This directive is
   ; *NOT* affected by whether Safe Mode is turned On or Off.
   disable_functions =
   
  @@ -603,6 +603,9 @@
   ; file will be able to reveal the password as well.
   mysql.default_password =
   
  +; Maximum time (in secondes) for connect timeout. -1 means no limimt
  +mysql.connect_timeout = -1
  +
   [mSQL]
   ; Allow or prevent persistent links.
   msql.allow_persistent = On
  @@ -781,8 +784,10 @@
   ; Document expires after n minutes.
   session.cache_expire = 180
   
  -; use transient sid support if enabled by compiling with --enable-trans-sid.
  -session.use_trans_sid = 1
  +; trans sid support is disabled by default.
  +; Use of trans sid may risk your users security. It may not be
  +; feasible to use this option for some sites. Use this option with caution.
  +session.use_trans_sid = 0
   
   url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
   
  @@ -898,6 +903,9 @@
   ;printer.default_printer = ""
   
   [mbstring]
  +; language for internal character representation.
  +;mbstring.language = Japanese
  +
   ; internal/script encoding.
   ; Some encoding cannot work as internal encoding.
   ; (e.g. SJIS, BIG5, ISO-2022-*)
  @@ -942,6 +950,19 @@
   ; Modify the setting below to match the directory location of the cracklib
   ; dictionary files.  Include the base filename, but not the file extension.
   ; crack.default_dictionary = "c:\php\lib\cracklib_dict"
  +
  +[exif]
  +; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. 
  +; With mbstring support this will automatically be converted into the encoding
  +; given by corresponding encode setting. When empty mbstring.internal_encoding 
  +; is used. For the decode settings you can distinguish between motorola and 
  +; intel byte order. A decode setting cannot be empty.
  +;exif.encode_unicode = ISO-8859-15
  +;exif.decode_unicode_motorola = UCS-2BE
  +;exif.decode_unicode_intel    = UCS-2LE
  +;exif.encode_jis = 
  +;exif.decode_jis_motorola = JIS
  +;exif.decode_jis_intel    = JIS
   
   ; Local Variables:
   ; tab-width: 4
  
  
  
  1.2.2.4   +30 -9     php4/php.ini-recommended
  
  Index: php.ini-recommended
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/php.ini-recommended,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- php.ini-recommended	9 Jul 2002 09:14:29 -0000	1.2.2.3
  +++ php.ini-recommended	3 Aug 2002 00:44:11 -0000	1.2.2.4
  @@ -153,12 +153,6 @@
   ; will be allowed to be executed via the exec family of functions.
   safe_mode_exec_dir =
   
  -; open_basedir, if set, limits all file operations to the defined directory
  -; and below.  This directive makes most sense if used in a per-directory
  -; or per-virtualhost web server configuration file.
  -;
  -;open_basedir =
  -
   ; Setting certain environment variables may be a potential security breach.
   ; This directive contains a comma-delimited list of prefixes.  In Safe Mode,
   ; the user may only alter environment variables whose names begin with the
  @@ -174,8 +168,14 @@
   ; protected even if safe_mode_allowed_env_vars is set to allow to change them.
   safe_mode_protected_env_vars = LD_LIBRARY_PATH
   
  +; open_basedir, if set, limits all file operations to the defined directory
  +; and below.  This directive makes most sense if used in a per-directory
  +; or per-virtualhost web server configuration file. This directive is
  +; *NOT* affected by whether Safe Mode is turned On or Off.
  +;open_basedir =
  +
   ; This directive allows you to disable certain functions for security reasons.
  -; It receives a comma-delimited list of function names.  This directive is
  +; It receives a comma-delimited list of function names. This directive is
   ; *NOT* affected by whether Safe Mode is turned On or Off.
   disable_functions =
   
  @@ -608,6 +608,9 @@
   ; file will be able to reveal the password as well.
   mysql.default_password =
   
  +; Maximum time (in secondes) for connect timeout. -1 means no limimt
  +mysql.connect_timeout = -1
  +
   [mSQL]
   ; Allow or prevent persistent links.
   msql.allow_persistent = On
  @@ -788,8 +791,10 @@
   ; Document expires after n minutes.
   session.cache_expire = 180
   
  -; use transient sid support if enabled by compiling with --enable-trans-sid.
  -session.use_trans_sid = 1
  +; trans sid support is disabled by default.
  +; Use of trans sid may risk your users security. It may not be
  +; feasible to use this option for some sites. Use this option with caution.
  +session.use_trans_sid = 0
   
   url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
   
  @@ -905,6 +910,9 @@
   ;printer.default_printer = ""
   
   [mbstring]
  +; language for internal character representation.
  +;mbstring.language = Japanese
  +
   ; internal/script encoding.
   ; Some encoding cannot work as internal encoding.
   ; (e.g. SJIS, BIG5, ISO-2022-*)
  @@ -949,6 +957,19 @@
   ; Modify the setting below to match the directory location of the cracklib
   ; dictionary files.  Include the base filename, but not the file extension.
   ; crack.default_dictionary = "c:\php\lib\cracklib_dict"
  +
  +[exif]
  +; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. 
  +; With mbstring support this will automatically be converted into the encoding
  +; given by corresponding encode setting. When empty mbstring.internal_encoding 
  +; is used. For the decode settings you can distinguish between motorola and 
  +; intel byte order. A decode setting cannot be empty.
  +;exif.encode_unicode = ISO-8859-15
  +;exif.decode_unicode_motorola = UCS-2BE
  +;exif.decode_unicode_intel    = UCS-2LE
  +;exif.encode_jis = 
  +;exif.decode_jis_motorola = JIS
  +;exif.decode_jis_intel    = JIS
   
   ; Local Variables:
   ; tab-width: 4
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +3 -3      php4/build/build.mk
  
  Index: build.mk
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/build/build.mk,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- build.mk	9 Jul 2002 09:14:30 -0000	1.2.2.1
  +++ build.mk	3 Aug 2002 00:44:12 -0000	1.2.2.2
  @@ -14,7 +14,7 @@
   #  | Author: Sascha Schumann <sasch****@schum*****>                         |
   #  +----------------------------------------------------------------------+
   #
  -# $Id: build.mk,v 1.15 2002/06/23 15:47:40 imajes Exp $ 
  +# $Id: build.mk,v 1.17 2002/07/21 13:09:07 sas Exp $ 
   #
   #
   # Makefile to generate build tools
  @@ -40,7 +40,7 @@
   		$(ZENDDIR)/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@
   
   $(STAMP): build/buildcheck.sh
  -	@build/buildcheck.sh && touch $(STAMP)
  +	@build/buildcheck.sh $(STAMP)
   
   snapshot:
   	distname='$(DISTNAME)'; \
  @@ -67,7 +67,7 @@
   
   cvsclean:
   	@for i in `find . -name .cvsignore`; do \
  -		(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a || true); \
  +		(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a .libs || true); \
   	done
   
   .PHONY: $(ALWAYS) snapshot cvsclean
  
  
  
  1.2.2.1   +2 -2      php4/build/build2.mk
  
  Index: build2.mk
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/build/build2.mk,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- build2.mk	29 Apr 2002 02:26:19 -0000	1.2
  +++ build2.mk	3 Aug 2002 00:44:12 -0000	1.2.2.1
  @@ -14,7 +14,7 @@
   #  | Author: Sascha Schumann <sasch****@schum*****>                         |
   #  +----------------------------------------------------------------------+
   #
  -# $Id: build2.mk,v 1.26 2002/03/07 14:17:48 sas Exp $ 
  +# $Id: build2.mk,v 1.27 2002/07/21 12:54:06 sas Exp $ 
   #
   
   include generated_lists
  @@ -39,7 +39,7 @@
   	@echo rebuilding $@
   	cat $(acconfig_h_SOURCES) > $@
   
  -SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times|AC_PROG_CPP was called before AC_PROG_CC)'||true)
  +SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times)'||true)
   
   $(config_h_in): configure acconfig.h
   # explicitly remove target since autoheader does not seem to work 
  
  
  
  1.2.2.2   +14 -1     php4/build/buildcheck.sh
  
  Index: buildcheck.sh
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/build/buildcheck.sh,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- buildcheck.sh	9 Jul 2002 09:14:30 -0000	1.2.2.1
  +++ buildcheck.sh	3 Aug 2002 00:44:12 -0000	1.2.2.2
  @@ -16,11 +16,13 @@
   #  |          Sascha Schumann <sasch****@schum*****>                        |
   #  +----------------------------------------------------------------------+
   #
  -# $Id: buildcheck.sh,v 1.18 2002/06/26 18:42:50 sniper Exp $ 
  +# $Id: buildcheck.sh,v 1.19 2002/07/21 13:09:07 sas Exp $ 
   #
   
   echo "buildconf: checking installation..."
   
  +stamp=$1
  +
   # autoconf 2.13 or newer
   ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
   if test -z "$ac_version"; then
  @@ -40,6 +42,15 @@
   fi
   
   
  +if test "$1" = "2" && test "$2" -ge "50"; then
  +  echo "buildconf: Your version of autoconf likely contains buggy cache code."
  +  echo "           Running cvsclean for you."
  +  echo "           To avoid this, install autoconf-2.13 and automake-1.5."
  +  ./cvsclean
  +  stamp=
  +fi
  +
  +
   # automake 1.4 or newer
   am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
   am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'`
  @@ -90,5 +101,7 @@
       echo "         directories.  This may cause aclocal to fail."
       echo "         continuing anyway"
   fi
  +
  +test -n "$stamp" && touch $stamp
   
   exit 0
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +21 -11    php4/ext/ext_skel
  
  Index: ext_skel
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ext_skel,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ext_skel	29 Apr 2002 02:30:38 -0000	1.2
  +++ ext_skel	3 Aug 2002 00:44:12 -0000	1.2.2.1
  @@ -7,12 +7,13 @@
   
   usage() {
   echo "$0 --extname=module [--proto=file] [--stubs=file] [--xml[=file]]"
  -echo "           [--full-xml] [--no-help]"
  +echo "           [--skel=dir] [--full-xml] [--no-help]"
   echo ""
   echo "  --extname=module   module is the name of your extension"
   echo "  --proto=file       file contains prototypes of functions to create"
   echo "  --stubs=file       generate only function stubs in file"
   echo "  --xml              generate xml documentation to be added to phpdoc-cvs"
  +echo "  --skel=dir         path to the skeleton directory"
   echo "  --full-xml         generate xml documentation for a self-contained extension"
   echo "                     (not yet implemented)"
   echo "  --no-help          don't try to be nice and create comments in the code"
  @@ -33,7 +34,7 @@
     case $1 in
       --extname=?*)
   	extname=$optarg
  -	EXTNAME=`echo $extname | tr [a-z] [A-Z]`
  +	EXTNAME=`echo $extname | tr "[:lower:]" "[:upper:]"`
   	;;
       --proto=?*)
   	proto=$optarg
  @@ -54,6 +55,9 @@
       --no-help)
   	no_help="yes"
   	;;
  +    --skel=?*)
  +	skel_dir=$optarg
  +	;;
       *)
   	usage
   	;;
  @@ -65,8 +69,14 @@
     givup "Directory $extname already exists."
   fi
   
  -test -f ext_skel || givup "ext_skel must be in the current directory"
  -test -d skeleton || givup "subdirectory skeleton does not exist or is not directory"
  +if test -z "$skel_dir"; then
  +  skel_dir="skeleton"
  +fi
  +
  +## convert skel_dir to full path
  +skel_dir=`cd $skel_dir && pwd`
  +
  +test -d $skel_dir || givup "directory $skel_dir does not exist or is not directory"
   
   if echo '\c' | grep -s c >/dev/null 2>&1
   then
  @@ -84,7 +94,7 @@
   fi
   
   if test -n "$proto"; then
  -  cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f ./skeleton/create_stubs
  +  cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f $skel_dir/create_stubs
   fi
   
   if test -z "$stubs"; then
  @@ -187,7 +197,7 @@
       echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
   fi
   
  -sed -f sedscript <../skeleton/skeleton.c > $extname.c
  +sed -f sedscript < $skel_dir/skeleton.c > $extname.c
   
   
   $ECHO_N " php_$extname.h$ECHO_C"
  @@ -205,26 +215,26 @@
       echo 's/^\/\*.*\*\/$//' >> sedscript
       echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
   fi
  -sed -f sedscript <../skeleton/php_skeleton.h > php_$extname.h
  +sed -f sedscript <$skel_dir/php_skeleton.h > php_$extname.h
   
   $ECHO_N " CREDITS$ECHO_C"
   echo "s/extname/$extname/g" > sedscript
  -sed -f sedscript <../skeleton/CREDITS > CREDITS
  +sed -f sedscript <$skel_dir/CREDITS > CREDITS
   
   $ECHO_N " EXPERIMENTAL$ECHO_C"
   echo "s/extname/$extname/g" > sedscript
  -sed -f sedscript <../skeleton/EXPERIMENTAL > EXPERIMENTAL
  +sed -f sedscript <$skel_dir/EXPERIMENTAL > EXPERIMENTAL
   
   $ECHO_N " tests/001.phpt$ECHO_C"
   mkdir tests || givup "Cannot create tests directory"
   chmod 755 tests
  -sed -f sedscript <../skeleton/tests/001.phpt > tests/001.phpt
  +sed -f sedscript <$skel_dir/tests/001.phpt > tests/001.phpt
   
   if test -z "$stubs" && test -z "$no_help"; then
     $ECHO_N " $extname.php$ECHO_C"
     sed \
       -e "s/extname/$extname/g" \
  -    <../skeleton/skeleton.php \
  +    <$skel_dir/skeleton.php \
       > $extname.php
   fi
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +282 -257  php4/ext/curl/curl.c
  
  Index: curl.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/curl/curl.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- curl.c	9 Jul 2002 09:14:31 -0000	1.2.2.1
  +++ curl.c	3 Aug 2002 00:44:12 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: curl.c,v 1.112 2002/06/26 07:19:33 derick Exp $ */
  +/* $Id: curl.c,v 1.117 2002/07/31 22:10:58 sterling Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -106,6 +106,8 @@
   	le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, "curl", module_number);
   	
   	/* Constants for curl_setopt() */
  +	REGISTER_CURL_CONSTANT(CURLOPT_DNS_USE_GLOBAL_CACHE);
  +	REGISTER_CURL_CONSTANT(CURLOPT_DNS_CACHE_TIMEOUT);
   	REGISTER_CURL_CONSTANT(CURLOPT_PORT);
   	REGISTER_CURL_CONSTANT(CURLOPT_FILE);
   	REGISTER_CURL_CONSTANT(CURLOPT_INFILE);
  @@ -318,7 +320,8 @@
   		                           t->func,
   		                           retval, 2, argv TSRMLS_CC);
   		if (error == FAILURE) {
  -			php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_WRITEFUNCTION", get_active_function_name(TSRMLS_C));
  +			php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_WRITEFUNCTION", 
  +					  get_active_function_name(TSRMLS_C));
   			length = -1;
   		}
   		else {
  @@ -372,7 +375,8 @@
   		                           t->func,
   		                           retval, 3, argv TSRMLS_CC);
   		if (error == FAILURE) {
  -			php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION", get_active_function_name(TSRMLS_C));
  +			php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION", 
  +					  get_active_function_name(TSRMLS_C));
   			length = -1;
   		}
   		else {
  @@ -402,49 +406,50 @@
   	TSRMLS_FETCH();
   	
   	switch (t->method) {
  -	case PHP_CURL_STDOUT:
  -		/* Handle special case write when we're returning the entire transfer
  -		 */
  -		if (ch->handlers->write->method == PHP_CURL_RETURN)
  -			smart_str_appendl(&ch->handlers->write->buf, data, (int) length);
  -		else
  -			PUTS(data);
  -		break;
  -	case PHP_CURL_FILE:
  -		return fwrite(data, size, nmemb, t->fp);
  -	case PHP_CURL_USER: {
  -		zval *argv[2];
  -		zval *retval;
  -		int   error;
  -		TSRMLS_FETCH();
  -
  -		MAKE_STD_ZVAL(argv[0]);
  -		MAKE_STD_ZVAL(argv[1]);
  -		MAKE_STD_ZVAL(retval);
  -
  -		ZVAL_RESOURCE(argv[0], ch->id);
  -		zend_list_addref(ch->id);
  -		ZVAL_STRINGL(argv[1], data, length, 1);
  -
  -		error = call_user_function(EG(function_table),
  -		                           NULL,
  -		                           t->func,
  -		                           retval, 2, argv TSRMLS_CC);
  -		if (error == FAILURE) {
  -			php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_HEADERFUNCTION", get_active_function_name(TSRMLS_C));
  -			length = -1;
  -		}
  -		else {
  -			length = Z_LVAL_P(retval);
  +		case PHP_CURL_STDOUT:
  +			/* Handle special case write when we're returning the entire transfer
  +			 */
  +			if (ch->handlers->write->method == PHP_CURL_RETURN)
  +				smart_str_appendl(&ch->handlers->write->buf, data, (int) length);
  +			else
  +				PUTS(data);
  +			break;
  +		case PHP_CURL_FILE:
  +			return fwrite(data, size, nmemb, t->fp);
  +		case PHP_CURL_USER: {
  +			zval *argv[2];
  +			zval *retval;
  +			int   error;
  +			TSRMLS_FETCH();
  +
  +			MAKE_STD_ZVAL(argv[0]);
  +			MAKE_STD_ZVAL(argv[1]);
  +			MAKE_STD_ZVAL(retval);
  +
  +			ZVAL_RESOURCE(argv[0], ch->id);
  +			zend_list_addref(ch->id);
  +			ZVAL_STRINGL(argv[1], data, length, 1);
  +
  +			error = call_user_function(EG(function_table),
  +									   NULL,
  +									   t->func,
  +									   retval, 2, argv TSRMLS_CC);
  +			if (error == FAILURE) {
  +				php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_HEADERFUNCTION", 
  +						  get_active_function_name(TSRMLS_C));
  +				length = -1;
  +			}
  +			else {
  +				length = Z_LVAL_P(retval);
  +			}
  +			zval_ptr_dtor(&argv[0]);
  +			zval_ptr_dtor(&argv[1]);
  +			zval_ptr_dtor(&retval);
  +			break;
   		}
  -		zval_ptr_dtor(&argv[0]);
  -		zval_ptr_dtor(&argv[1]);
  -		zval_ptr_dtor(&retval);
  -		break;
  +		case PHP_CURL_IGNORE:
  +			return length;
   	}
  -	case PHP_CURL_IGNORE:
  -		return length;
  -    	}
   	return length;
   }
   /* }}} */
  @@ -480,7 +485,8 @@
   	}
   	else {
   		if (Z_STRLEN_P(retval) > buflen) {
  -			php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle", get_active_function_name(TSRMLS_C));
  +			php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle", 
  +					  get_active_function_name(TSRMLS_C));
   			ret = -1;
   		}
   		else {
  @@ -588,6 +594,9 @@
   	curl_easy_setopt(ch->cp, CURLOPT_INFILE,            (void *) ch);
   	curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION,    curl_write_header);
   	curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER,       (void *) ch);
  +	curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
  +	curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
  +
   	if (argc > 0) {
   		char *urlcopy;
   		convert_to_string_ex(url);
  @@ -607,12 +616,12 @@
   PHP_FUNCTION(curl_setopt)
   {
   	zval       **zid, 
  -	           **zoption, 
  -	           **zvalue;
  +		**zoption, 
  +		**zvalue;
   	php_curl    *ch;
  -	CURLcode     error;
  +	CURLcode     error=CURLE_OK;
   	int          option;
  -	
  +
   	if (ZEND_NUM_ARGS() != 3 ||
   	    zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
   		WRONG_PARAM_COUNT;
  @@ -622,239 +631,255 @@
   
   	option = Z_LVAL_PP(zoption);
   	switch (option) {
  -	case CURLOPT_INFILESIZE:
  -	case CURLOPT_VERBOSE:
  -	case CURLOPT_HEADER:
  -	case CURLOPT_NOPROGRESS:
  -	case CURLOPT_NOBODY:
  -	case CURLOPT_FAILONERROR:
  -	case CURLOPT_UPLOAD:
  -	case CURLOPT_POST:
  -	case CURLOPT_FTPLISTONLY:
  -	case CURLOPT_FTPAPPEND:
  -	case CURLOPT_NETRC:
  -	case CURLOPT_FOLLOWLOCATION:
  -	case CURLOPT_PUT:
  -	case CURLOPT_MUTE:
  -	case CURLOPT_TIMEOUT:
  -	case CURLOPT_LOW_SPEED_LIMIT:
  -	case CURLOPT_SSLVERSION:
  -	case CURLOPT_LOW_SPEED_TIME:
  -	case CURLOPT_RESUME_FROM:
  -	case CURLOPT_TIMEVALUE:
  -	case CURLOPT_TIMECONDITION:
  -	case CURLOPT_TRANSFERTEXT:
  -	case CURLOPT_HTTPPROXYTUNNEL:
  -	case CURLOPT_FILETIME:
  -	case CURLOPT_MAXREDIRS:
  -	case CURLOPT_MAXCONNECTS:
  -	case CURLOPT_CLOSEPOLICY:
  -	case CURLOPT_FRESH_CONNECT:
  -	case CURLOPT_FORBID_REUSE:
  -	case CURLOPT_CONNECTTIMEOUT:
  -	case CURLOPT_SSL_VERIFYHOST:
  -	case CURLOPT_SSL_VERIFYPEER:
  -		convert_to_long_ex(zvalue);
  -		error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
  -		break;
  -	case CURLOPT_URL:
  -	case CURLOPT_PROXY:
  -	case CURLOPT_USERPWD:
  -	case CURLOPT_PROXYUSERPWD:
  -	case CURLOPT_RANGE:
  -	case CURLOPT_CUSTOMREQUEST:
  -	case CURLOPT_USERAGENT:
  -	case CURLOPT_FTPPORT:
  -	case CURLOPT_COOKIE:
  -	case CURLOPT_SSLCERT:
  -	case CURLOPT_SSLCERTPASSWD:
  -	case CURLOPT_COOKIEFILE:
  -	case CURLOPT_REFERER:
  -	case CURLOPT_INTERFACE:
  -	case CURLOPT_KRB4LEVEL: 
  -	case CURLOPT_RANDOM_FILE:
  -	case CURLOPT_EGDSOCKET:
  -	case CURLOPT_CAINFO: 
  -	case CURLOPT_COOKIEJAR:
  -	case CURLOPT_SSL_CIPHER_LIST: {
  -		char *copystr = NULL;
  +		case CURLOPT_INFILESIZE:
  +		case CURLOPT_VERBOSE:
  +		case CURLOPT_HEADER:
  +		case CURLOPT_NOPROGRESS:
  +		case CURLOPT_NOBODY:
  +		case CURLOPT_FAILONERROR:
  +		case CURLOPT_UPLOAD:
  +		case CURLOPT_POST:
  +		case CURLOPT_FTPLISTONLY:
  +		case CURLOPT_FTPAPPEND:
  +		case CURLOPT_NETRC:
  +		case CURLOPT_FOLLOWLOCATION:
  +		case CURLOPT_PUT:
  +		case CURLOPT_MUTE:
  +		case CURLOPT_TIMEOUT:
  +		case CURLOPT_LOW_SPEED_LIMIT:
  +		case CURLOPT_SSLVERSION:
  +		case CURLOPT_LOW_SPEED_TIME:
  +		case CURLOPT_RESUME_FROM:
  +		case CURLOPT_TIMEVALUE:
  +		case CURLOPT_TIMECONDITION:
  +		case CURLOPT_TRANSFERTEXT:
  +		case CURLOPT_HTTPPROXYTUNNEL:
  +		case CURLOPT_FILETIME:
  +		case CURLOPT_MAXREDIRS:
  +		case CURLOPT_MAXCONNECTS:
  +		case CURLOPT_CLOSEPOLICY:
  +		case CURLOPT_FRESH_CONNECT:
  +		case CURLOPT_FORBID_REUSE:
  +		case CURLOPT_CONNECTTIMEOUT:
  +		case CURLOPT_SSL_VERIFYHOST:
  +		case CURLOPT_SSL_VERIFYPEER:
  +		case CURLOPT_DNS_USE_GLOBAL_CACHE:
  +			convert_to_long_ex(zvalue);
  +			error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
  +			break;
  +		case CURLOPT_URL:
  +		case CURLOPT_PROXY:
  +		case CURLOPT_USERPWD:
  +		case CURLOPT_PROXYUSERPWD:
  +		case CURLOPT_RANGE:
  +		case CURLOPT_CUSTOMREQUEST:
  +		case CURLOPT_USERAGENT:
  +		case CURLOPT_FTPPORT:
  +		case CURLOPT_COOKIE:
  +		case CURLOPT_SSLCERT:
  +		case CURLOPT_SSLCERTPASSWD:
  +		case CURLOPT_COOKIEFILE:
  +		case CURLOPT_REFERER:
  +		case CURLOPT_INTERFACE:
  +		case CURLOPT_KRB4LEVEL: 
  +		case CURLOPT_RANDOM_FILE:
  +		case CURLOPT_EGDSOCKET:
  +		case CURLOPT_CAINFO: 
  +		case CURLOPT_COOKIEJAR:
  +		case CURLOPT_SSL_CIPHER_LIST: {
  +			char *copystr = NULL;
   	
  -		convert_to_string_ex(zvalue);
  -		copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
  +			convert_to_string_ex(zvalue);
  +			copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
   
  -		error = curl_easy_setopt(ch->cp, option, copystr);
  -		zend_llist_add_element(&ch->to_free.str, &copystr);
  +			error = curl_easy_setopt(ch->cp, option, copystr);
  +			zend_llist_add_element(&ch->to_free.str, &copystr);
   
  -		break;
  -	}
  -	case CURLOPT_FILE:
  -	case CURLOPT_INFILE: 
  -	case CURLOPT_WRITEHEADER:
  -	case CURLOPT_STDERR: {
  -		FILE *fp = NULL;
  -		int type;
  -		void * what;
  -		
  -		what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream());
  -		ZEND_VERIFY_RESOURCE(what);
  -
  -		if (FAILURE == php_stream_cast((php_stream*)what, PHP_STREAM_AS_STDIO, (void*)&fp, REPORT_ERRORS))
  -			RETURN_FALSE;
  -		if (!fp) {
  -			RETURN_FALSE;
  +			break;
   		}
  -
  -		error = CURLE_OK;
  -		switch (option) {
   		case CURLOPT_FILE:
  -			ch->handlers->write->fp = fp;
  -			ch->handlers->write->method = PHP_CURL_FILE;
  -			break;
  +		case CURLOPT_INFILE: 
   		case CURLOPT_WRITEHEADER:
  -			ch->handlers->write_header->fp = fp;
  -			ch->handlers->write_header->method = PHP_CURL_FILE;
  -			break;
  -		case CURLOPT_INFILE:
  -			zend_list_addref(Z_LVAL_PP(zvalue));
  -			ch->handlers->read->fp = fp;
  -			ch->handlers->read->fd = Z_LVAL_PP(zvalue);
  -			break;
  -		default:
  -			error = curl_easy_setopt(ch->cp, option, fp);
  +		case CURLOPT_STDERR: {
  +			FILE *fp = NULL;
  +			int type;
  +			void * what;
  +		
  +			what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream());
  +			ZEND_VERIFY_RESOURCE(what);
  +
  +			if (FAILURE == php_stream_cast((php_stream *) what, 
  +										   PHP_STREAM_AS_STDIO, 
  +										   (void *) &fp, 
  +										   REPORT_ERRORS)) {
  +				RETURN_FALSE;
  +			}
  +
  +			if (!fp) {
  +				RETURN_FALSE;
  +			}
  +
  +			error = CURLE_OK;
  +			switch (option) {
  +				case CURLOPT_FILE:
  +					ch->handlers->write->fp = fp;
  +					ch->handlers->write->method = PHP_CURL_FILE;
  +					break;
  +				case CURLOPT_WRITEHEADER:
  +					ch->handlers->write_header->fp = fp;
  +					ch->handlers->write_header->method = PHP_CURL_FILE;
  +					break;
  +				case CURLOPT_INFILE:
  +					zend_list_addref(Z_LVAL_PP(zvalue));
  +					ch->handlers->read->fp = fp;
  +					ch->handlers->read->fd = Z_LVAL_PP(zvalue);
  +					break;
  +				default:
  +					error = curl_easy_setopt(ch->cp, option, fp);
  +					break;
  +			}
  +
   			break;
   		}
  +		case CURLOPT_RETURNTRANSFER:
  +			convert_to_long_ex(zvalue);
   
  -		break;
  -	}
  -	case CURLOPT_RETURNTRANSFER:
  -		convert_to_long_ex(zvalue);
  +			if (Z_LVAL_PP(zvalue)) {
  +				ch->handlers->write->method = PHP_CURL_RETURN;
  +			}
  +			break;
  +		case CURLOPT_BINARYTRANSFER:
  +			convert_to_long_ex(zvalue);	
   
  -		if (Z_LVAL_PP(zvalue)) {
  -			ch->handlers->write->method = PHP_CURL_RETURN;
  -		}
  -		break;
  -	case CURLOPT_BINARYTRANSFER:
  -		convert_to_long_ex(zvalue);	
  -		ch->handlers->write->type = PHP_CURL_BINARY;
  -		break;
  -	case CURLOPT_WRITEFUNCTION:
  -		zval_add_ref(zvalue);
  -		ch->handlers->write->func   = *zvalue;
  -		ch->handlers->write->method = PHP_CURL_USER;
  -		break;
  -	case CURLOPT_READFUNCTION:
  -		zval_add_ref(zvalue);
  -		ch->handlers->read->func   = *zvalue;
  -		ch->handlers->read->method = PHP_CURL_USER;
  -		break;
  -	case CURLOPT_HEADERFUNCTION:
  -		zval_add_ref(zvalue);
  -		ch->handlers->write_header->func   = *zvalue;
  -		ch->handlers->write_header->method = PHP_CURL_USER;
  -		break;
  -	case CURLOPT_PASSWDFUNCTION:
  -		zval_add_ref(zvalue);
  -		ch->handlers->passwd = *zvalue;
  -		error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, curl_passwd);
  -		error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA,     (void *) ch);
  -		break;
  -	case CURLOPT_POSTFIELDS:
  -		if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
  -			zval            **current;
  -			HashTable        *postfields;
  -			struct HttpPost  *first = NULL;
  -			struct HttpPost  *last  = NULL;
  -			char             *postval;
  -			char             *string_key = NULL;
  -			ulong             num_key;
  -			uint              string_key_len;
  -
  -			postfields = HASH_OF(*zvalue);
  -			if (! postfields) {
  -				php_error(E_WARNING, "%s(): Couldn't get HashTable in CURLOPT_POSTFIELDS", get_active_function_name(TSRMLS_C));
  -				RETURN_FALSE;
  +			if (Z_LVAL_PP(zvalue)) {
  +				ch->handlers->write->type = PHP_CURL_BINARY;
   			}
  +			break;
  +		case CURLOPT_WRITEFUNCTION:
  +			zval_add_ref(zvalue);
  +			ch->handlers->write->func   = *zvalue;
  +			ch->handlers->write->method = PHP_CURL_USER;
  +			break;
  +		case CURLOPT_READFUNCTION:
  +			zval_add_ref(zvalue);
  +			ch->handlers->read->func   = *zvalue;
  +			ch->handlers->read->method = PHP_CURL_USER;
  +			break;
  +		case CURLOPT_HEADERFUNCTION:
  +			zval_add_ref(zvalue);
  +			ch->handlers->write_header->func   = *zvalue;
  +			ch->handlers->write_header->method = PHP_CURL_USER;
  +			break;
  +		case CURLOPT_PASSWDFUNCTION:
  +			zval_add_ref(zvalue);
  +			ch->handlers->passwd = *zvalue;
  +			error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, curl_passwd);
  +			error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA,     (void *) ch);
  +			break;
  +		case CURLOPT_POSTFIELDS:
  +			if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
  +				zval            **current;
  +				HashTable        *postfields;
  +				struct HttpPost  *first = NULL;
  +				struct HttpPost  *last  = NULL;
  +				char             *postval;
  +				char             *string_key = NULL;
  +				ulong             num_key;
  +				uint              string_key_len;
  +
  +				postfields = HASH_OF(*zvalue);
  +				if (! postfields) {
  +					php_error(E_WARNING, 
  +							  "%s(): Couldn't get HashTable in CURLOPT_POSTFIELDS", 
  +							  get_active_function_name(TSRMLS_C));
  +					RETURN_FALSE;
  +				}
   
  -			for (zend_hash_internal_pointer_reset(postfields);
  -			     zend_hash_get_current_data(postfields, (void **) &current) == SUCCESS;
  -			     zend_hash_move_forward(postfields)) {
  +				for (zend_hash_internal_pointer_reset(postfields);
  +					 zend_hash_get_current_data(postfields, (void **) &current) == SUCCESS;
  +					 zend_hash_move_forward(postfields)) {
   
  -				SEPARATE_ZVAL(current);
  -				convert_to_string_ex(current);
  +					SEPARATE_ZVAL(current);
  +					convert_to_string_ex(current);
   
  -				zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL);
  +					zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL);
   				
  -				postval = Z_STRVAL_PP(current);
  -				if (*postval == '@') {
  -					error = curl_formadd(&first, &last, CURLFORM_COPYNAME, string_key, 
  -					                     CURLFORM_FILE, ++postval, CURLFORM_END);
  +					postval = Z_STRVAL_PP(current);
  +					if (*postval == '@') {
  +						error = curl_formadd(&first, &last, 
  +											 CURLFORM_COPYNAME, string_key,
  +											 CURLFORM_NAMELENGTH, string_key_len - 1,
  +											 CURLFORM_FILE, ++postval, 
  +											 CURLFORM_END);
  +					}
  +					else {
  +						error = curl_formadd(&first, &last, 
  +											 CURLFORM_COPYNAME, string_key,
  +											 CURLFORM_NAMELENGTH, string_key_len - 1,
  +											 CURLFORM_PTRCONTENTS, postval, 
  +											 CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
  +											 CURLFORM_END);
  +					}
   				}
  -				else {
  -					error = curl_formadd(&first, &last, CURLFORM_COPYNAME, string_key, 
  -										 CURLFORM_PTRCONTENTS, postval, 
  -										 CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
  -										 CURLFORM_END);
  +
  +				SAVE_CURL_ERROR(ch, error);
  +				if (error != CURLE_OK) {
  +					RETURN_FALSE;
   				}
  +
  +				zend_llist_add_element(&ch->to_free.post, &first);
  +				error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
   			}
  +			else {
  +				char *post = NULL;
   
  -			SAVE_CURL_ERROR(ch, error);
  -			if (error != CURLE_OK) {
  -				RETURN_FALSE;
  +				convert_to_string_ex(zvalue);
  +				post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
  +				zend_llist_add_element(&ch->to_free.str, &post);
  +
  +				error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
  +				error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
   			}
   
  -			zend_llist_add_element(&ch->to_free.post, &first);
  -			error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
  -		}
  -		else {
  -			char *post = NULL;
  +			break;
  +		case CURLOPT_HTTPHEADER: 
  +		case CURLOPT_QUOTE:
  +		case CURLOPT_POSTQUOTE: {
  +			zval              **current;
  +			HashTable          *ph;
  +			struct curl_slist  *slist = NULL;
  +
  +			ph = HASH_OF(*zvalue);
  +			if (!ph) {
  +				php_error(E_WARNING, 
  +						  "%s(): You must pass either an object or an array with the CURLOPT_HTTPHEADER, "
  +						  "CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments", get_active_function_name(TSRMLS_C));
  +				RETURN_FALSE;
  +			}
   
  -			convert_to_string_ex(zvalue);
  -			post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
  -			zend_llist_add_element(&ch->to_free.str, &post);
  +			for (zend_hash_internal_pointer_reset(ph);
  +				 zend_hash_get_current_data(ph, (void **) &current) == SUCCESS;
  +				 zend_hash_move_forward(ph)) {
  +				char *indiv = NULL;
   
  -			error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
  -			error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
  -		}
  +				SEPARATE_ZVAL(current);
  +				convert_to_string_ex(current);
   
  -		break;
  -	case CURLOPT_HTTPHEADER: 
  -	case CURLOPT_QUOTE:
  -	case CURLOPT_POSTQUOTE: {
  -		zval              **current;
  -		HashTable          *ph;
  -		struct curl_slist  *slist = NULL;
  -
  -		ph = HASH_OF(*zvalue);
  -		if (! ph) {
  -			php_error(E_WARNING, 
  -			          "%s(): You must pass either an object or an array with the CURLOPT_HTTPHEADER,"
  -					  "CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments", get_active_function_name(TSRMLS_C));
  -			RETURN_FALSE;
  -		}
  -
  -		for (zend_hash_internal_pointer_reset(ph);
  -		     zend_hash_get_current_data(ph, (void **) &current) == SUCCESS;
  -		     zend_hash_move_forward(ph)) {
  -			char *indiv = NULL;
  -
  -			SEPARATE_ZVAL(current);
  -			convert_to_string_ex(current);
  -
  -			indiv = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current) + 1);
  -			slist = curl_slist_append(slist, indiv);
  -			if (! slist) {
  -				efree(indiv);
  -				php_error(E_WARNING, "%s(): Couldn't build curl_slist", get_active_function_name(TSRMLS_C));
  -				RETURN_FALSE;
  +				indiv = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current) + 1);
  +				slist = curl_slist_append(slist, indiv);
  +				if (! slist) {
  +					efree(indiv);
  +					php_error(E_WARNING, "%s(): Couldn't build curl_slist", get_active_function_name(TSRMLS_C));
  +					RETURN_FALSE;
  +				}
  +				zend_llist_add_element(&ch->to_free.str, &indiv);
   			}
  -			zend_llist_add_element(&ch->to_free.str, &indiv);
  -		}
  -		zend_llist_add_element(&ch->to_free.slist, &slist);
  +			zend_llist_add_element(&ch->to_free.slist, &slist);
   
  -		error = curl_easy_setopt(ch->cp, option, slist);
  +			error = curl_easy_setopt(ch->cp, option, slist);
   
  -		break;
  -	}
  +			break;
  +		}
   	}
   
   	SAVE_CURL_ERROR(ch, error);
  @@ -974,10 +999,10 @@
   		case CURLINFO_FILETIME: 
   		case CURLINFO_SSL_VERIFYRESULT: {
   			long code;
  -					
  +
   			curl_easy_getinfo(ch->cp, option, &code);
   			RETURN_LONG(code);
  -				
  +   
   			break;
   		}
   		case CURLINFO_TOTAL_TIME: 
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +2 -2      php4/ext/dbx/dbx.c
  
  Index: dbx.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/dbx/dbx.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- dbx.c	29 Apr 2002 02:30:42 -0000	1.2
  +++ dbx.c	3 Aug 2002 00:44:12 -0000	1.2.2.1
  @@ -20,7 +20,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: dbx.c,v 1.37 2002/04/18 14:04:10 sander Exp $ */
  +/* $Id: dbx.c,v 1.38 2002/07/23 13:45:49 sas Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -663,7 +663,7 @@
   
   /*
    * switch_dbx functions
  - */
  + */
   int switch_dbx_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module)
   {
   	/* returns connection handle as resource on success or 0 as long on failure */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +12 -12    php4/ext/dio/dio.c
  
  Index: dio.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/dio/dio.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- dio.c	9 Jul 2002 09:14:31 -0000	1.2.2.1
  +++ dio.c	3 Aug 2002 00:44:12 -0000	1.2.2.2
  @@ -34,14 +34,14 @@
   static int le_fd;
   
   function_entry dio_functions[] = {
  -    PHP_FE(dio_open,      NULL)
  -    PHP_FE(dio_truncate,  NULL)
  -    PHP_FE(dio_stat,      NULL)
  +	PHP_FE(dio_open,      NULL)
  +	PHP_FE(dio_truncate,  NULL)
  +	PHP_FE(dio_stat,      NULL)
   	PHP_FE(dio_seek,      NULL)
   	PHP_FE(dio_fcntl,     NULL)
   	PHP_FE(dio_read,      NULL)
  -    PHP_FE(dio_write,     NULL)
  -    PHP_FE(dio_close,     NULL)
  +	PHP_FE(dio_write,     NULL)
  +	PHP_FE(dio_close,     NULL)
   	{NULL, NULL, NULL}
   };
   
  @@ -55,7 +55,7 @@
   	NULL,	
   	NULL,
   	PHP_MINFO(dio),
  -    "0.1",
  +	"0.1",
   	STANDARD_MODULE_PROPERTIES
   };
   
  @@ -78,7 +78,7 @@
   
   PHP_MINIT_FUNCTION(dio)
   {
  -    le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number);
  +	le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number);
   
   	RDIOC(O_RDONLY);
   	RDIOC(O_WRONLY);
  @@ -328,28 +328,28 @@
   		}
   		if (Z_TYPE_P(arg) == IS_ARRAY) {
   			fh = HASH_OF(arg);
  -			if (zend_hash_find(fh, "start", 5, (void **) &element) == FAILURE) {
  +			if (zend_hash_find(fh, "start", sizeof("start"), (void **) &element) == FAILURE) {
   				lk.l_start = 0;
   			}
   			else {
   				lk.l_start = Z_LVAL_PP(element);
   			}
   
  -			if (zend_hash_find(fh, "length", 6, (void **) &element) == FAILURE) {
  +			if (zend_hash_find(fh, "length", sizeof("length"), (void **) &element) == FAILURE) {
   				lk.l_len = 0;
   			}
   			else {
   				lk.l_len = Z_LVAL_PP(element);
   			}
   
  -			if (zend_hash_find(fh, "whence", 6, (void **) &element) == FAILURE) {
  +			if (zend_hash_find(fh, "whence", sizeof("whence"), (void **) &element) == FAILURE) {
   				lk.l_whence = 0;
   			}
   			else {
  -				lk.l_whence = SEEK_SET;
  +				lk.l_whence = Z_LVAL_PP(element);
   			}
   
  -			if (zend_hash_find(fh, "type", 6, (void **) &element) == FAILURE) {
  +			if (zend_hash_find(fh, "type", sizeof("type"), (void **) &element) == FAILURE) {
   				lk.l_type = 0;
   			}
   			else {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +2 -2      php4/ext/domxml/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/domxml/TODO,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- TODO	9 Jul 2002 09:14:32 -0000	1.2.2.1
  +++ TODO	3 Aug 2002 00:44:12 -0000	1.2.2.2
  @@ -15,5 +15,5 @@
   	- input (building of dom-tree with sax-events) is almost finished
   	- started with generating of sax-events from file/string (chregu)
   	- generating sax-events from dom-tree is a more tricky one (see mailinglist of libxml2)
  -
  -
  +12) error reporting for xslt methods
  +13) add possibility to use relative xpath queries
  
  
  
  1.2.2.5   +42 -8     php4/ext/domxml/php_domxml.c
  
  Index: php_domxml.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/domxml/php_domxml.c,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- php_domxml.c	9 Jul 2002 09:14:32 -0000	1.2.2.4
  +++ php_domxml.c	3 Aug 2002 00:44:12 -0000	1.2.2.5
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: php_domxml.c,v 1.178 2002/07/01 14:48:35 chregu Exp $ */
  +/* $Id: php_domxml.c,v 1.182 2002/07/29 14:04:44 chregu Exp $ */
   
   /* TODO
    * - Support Notation Nodes
  @@ -203,9 +203,9 @@
   static zend_function_entry domxml_functions[] = {
   	PHP_FE(domxml_version,												NULL)
   	PHP_FE(xmldoc,														third_args_force_ref)
  -	PHP_FALIAS(domxml_open_mem,				xmldoc,	NULL)
  +	PHP_FALIAS(domxml_open_mem,				xmldoc,	third_args_force_ref)
   	PHP_FE(xmldocfile,														third_args_force_ref)
  -	PHP_FALIAS(domxml_open_file,				xmldocfile,	NULL)
  +	PHP_FALIAS(domxml_open_file,				xmldocfile,	third_args_force_ref)
   #if defined(LIBXML_HTML_ENABLED)
   	PHP_FE(html_doc,													NULL)
   	PHP_FE(html_doc_file,												NULL)
  @@ -386,7 +386,8 @@
   	PHP_FALIAS(new_child,				domxml_node_new_child,			NULL)
   	PHP_FALIAS(attributes,				domxml_node_attributes,			NULL)
   	PHP_FALIAS(has_attributes,			domxml_node_has_attributes,		NULL)
  -	PHP_FALIAS(prefix,					domxml_node_prefix,				NULL)
  +	PHP_FALIAS(prefix,				domxml_node_prefix,				NULL)
  +	PHP_FALIAS(namespace_uri,			domxml_node_namespace_uri,				NULL)
   	PHP_FALIAS(clone_node,				domxml_clone_node,				NULL)
   /* Non DOM functions start here */
   	PHP_FALIAS(add_child,				domxml_node_append_child,		NULL)
  @@ -1381,7 +1382,9 @@
   		} 
   		add_assoc_string(errormessages,"errormessage",buf,1);				
   		input = ctxt->input;
  -		add_assoc_string(errormessages,"nodename",ctxt->name,1); 
  +		if (ctxt->name) {
  +			add_assoc_string(errormessages,"nodename",ctxt->name,1); 
  +		}
   		if (input != NULL) {
   			add_assoc_long(errormessages,"line",input->line);
   			add_assoc_long(errormessages,"col",input->col);
  @@ -1415,7 +1418,9 @@
   			// do error handling here
   		} 
   		if (ctxt->parser != NULL) {
  -			add_assoc_string(errormessages,"nodename",ctxt->parser->name,1); 
  +			if (ctxt->parser->name) {
  +				add_assoc_string(errormessages,"nodename",ctxt->parser->name,1); 
  +			}
   
   			if (ctxt->parser->input != NULL) {
   			add_assoc_long(errormessages,"line",ctxt->parser->input->line);
  @@ -1679,8 +1684,6 @@
    */
   PHP_MINFO_FUNCTION(domxml)
   {
  -	char buffer[128];
  -	int major, minor, subminor;
   	/* don't know why that line was commented out in the previous version, so i left it (cmv) */
   	php_info_print_table_start();
   	php_info_print_table_row(2, "DOM/XML", "enabled");
  @@ -1697,6 +1700,10 @@
   	php_info_print_table_row(2, "XPointer Support", "enabled");
   #endif
   #if HAVE_DOMXSLT
  +	{
  +	char buffer[128];
  +	int major, minor, subminor;
  +
   	php_info_print_table_row(2, "DOM/XSLT", "enabled");
   /*	php_info_print_table_row(2, "libxslt Version", LIBXSLT_DOTTED_VERSION); */
   	major = xsltLibxsltVersion/10000;
  @@ -1709,6 +1716,7 @@
   	subminor = (xsltLibxmlVersion - major * 10000 - minor * 100);
   	snprintf(buffer, 128, "%d.%d.%d", major, minor, subminor);
   	php_info_print_table_row(2, "libxslt compiled against libxml Version", buffer);
  +	}
   #if HAVE_DOMEXSLT
   	php_info_print_table_row(2, "DOM/EXSLT", "enabled");
   	php_info_print_table_row(2, "libexslt Version", LIBEXSLT_DOTTED_VERSION);
  @@ -2183,6 +2191,32 @@
   	}
   }
   /* }}} */
  +
  +/* {{{ proto string domxml_node_namespace_uri(void)
  +   Returns namespace uri of node */
  +PHP_FUNCTION(domxml_node_namespace_uri)
  +{
  +	zval *id;
  +	xmlNode *nodep;
  +	xmlNsPtr ns;
  +
  +	DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
  +
  +	DOMXML_NO_ARGS();
  +
  +	ns = nodep->ns;
  +	if (!ns) {
  +		RETURN_EMPTY_STRING();
  +	}
  +
  +	if (ns->href) {
  +		RETURN_STRING((char *) (ns->href), 1);
  +	} else {
  +		RETURN_EMPTY_STRING();
  +	}
  +}
  +/* }}} */
  +
   
   /* {{{ proto object domxml_node_parent(void)
      Returns parent of node */
  
  
  
  1.2.2.5   +2 -1      php4/ext/domxml/php_domxml.h
  
  Index: php_domxml.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/domxml/php_domxml.h,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- php_domxml.h	9 Jul 2002 09:14:32 -0000	1.2.2.4
  +++ php_domxml.h	3 Aug 2002 00:44:12 -0000	1.2.2.5
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: php_domxml.h,v 1.63 2002/07/01 14:48:38 chregu Exp $ */
  +/* $Id: php_domxml.h,v 1.64 2002/07/07 17:19:29 chregu Exp $ */
   
   #ifndef PHP_DOMXML_H
   #define PHP_DOMXML_H
  @@ -138,6 +138,7 @@
   PHP_FUNCTION(domxml_node_has_child_nodes);
   PHP_FUNCTION(domxml_node_parent);
   PHP_FUNCTION(domxml_node_prefix);
  +PHP_FUNCTION(domxml_node_namespace_uri);
   PHP_FUNCTION(domxml_node);
   PHP_FUNCTION(domxml_clone_node);
   PHP_FUNCTION(domxml_node_unlink_node);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +689 -153  php4/ext/exif/exif.c
  
  Index: exif.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/exif/exif.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- exif.c	9 Jul 2002 09:14:32 -0000	1.2.2.2
  +++ exif.c	3 Aug 2002 00:44:12 -0000	1.2.2.3
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: exif.c,v 1.99 2002/07/02 22:38:37 helly Exp $ */
  +/* $Id: exif.c,v 1.107 2002/07/31 21:34:37 helly Exp $ */
   
   /*  ToDos
    *
  @@ -109,7 +109,7 @@
   };
   /* }}} */
   
  -#define EXIF_VERSION "1.4 $Id: exif.c,v 1.99 2002/07/02 22:38:37 helly Exp $"
  +#define EXIF_VERSION "1.4 $Id: exif.c,v 1.107 2002/07/31 21:34:37 helly Exp $"
   
   /* {{{ PHP_MINFO_FUNCTION
    */
  @@ -118,7 +118,7 @@
   	php_info_print_table_start();
   	php_info_print_table_row(2, "EXIF Support", "enabled");
   	php_info_print_table_row(2, "EXIF Version", EXIF_VERSION);
  -	php_info_print_table_row(2, "Supported EXIF Version", "02100");
  +	php_info_print_table_row(2, "Supported EXIF Version", "02200");
   	php_info_print_table_row(2, "Supported filetypes", "JPEG,TIFF");
   	php_info_print_table_end();
   }
  @@ -263,8 +263,8 @@
   /* {{{ format description defines
      Describes format descriptor
   */
  -static int php_tiff_bytes_per_format[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
  -#define NUM_FORMATS 12
  +static int php_tiff_bytes_per_format[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
  +#define NUM_FORMATS 13
   
   #define TAG_FMT_BYTE       1
   #define TAG_FMT_STRING     2
  @@ -278,6 +278,7 @@
   #define TAG_FMT_SRATIONAL 10
   #define TAG_FMT_SINGLE    11
   #define TAG_FMT_DOUBLE    12
  +#define TAG_FMT_IFD       13
   
   #ifdef EXIF_DEBUG
   static char *exif_get_tagformat(int format)
  @@ -295,12 +296,44 @@
   		case TAG_FMT_SRATIONAL: return "SRATIONAL";
   		case TAG_FMT_SINGLE:    return "SINGLE";
   		case TAG_FMT_DOUBLE:    return "DOUBLE";
  +		case TAG_FMT_IFD:       return "IFD";
   	}
   	return "*Illegal";
   }
   #endif
   
   /* Describes tag values */
  +#define TAG_GPS_VERSION_ID              0x0000
  +#define TAG_GPS_LATITUDE_REF            0x0001
  +#define TAG_GPS_LATITUDE                0x0002
  +#define TAG_GPS_LONGITUDE_REF           0x0003
  +#define TAG_GPS_LONGITUDE               0x0004
  +#define TAG_GPS_ALTITUDE_REF            0x0005
  +#define TAG_GPS_ALTITUDE                0x0006
  +#define TAG_GPS_TIME_STAMP              0x0007
  +#define TAG_GPS_SATELLITES              0x0008
  +#define TAG_GPS_STATUS                  0x0009
  +#define TAG_GPS_MEASURE_MODE            0x000A
  +#define TAG_GPS_DOP                     0x000B
  +#define TAG_GPS_SPEED_REF               0x000C
  +#define TAG_GPS_SPEED                   0x000D
  +#define TAG_GPS_TRACK_REF               0x000E
  +#define TAG_GPS_TRACK                   0x000F
  +#define TAG_GPS_IMG_DIRECTION_REF       0x0010
  +#define TAG_GPS_IMG_DIRECTION           0x0011
  +#define TAG_GPS_MAP_DATUM               0x0012
  +#define TAG_GPS_DEST_LATITUDE_REF       0x0013
  +#define TAG_GPS_DEST_LATITUDE           0x0014
  +#define TAG_GPS_DEST_LONGITUDE_REF      0x0015
  +#define TAG_GPS_DEST_LONGITUDE          0x0016
  +#define TAG_GPS_DEST_BEARING_REF        0x0017
  +#define TAG_GPS_DEST_BEARING            0x0018
  +#define TAG_GPS_DEST_DISTANCE_REF       0x0019
  +#define TAG_GPS_DEST_DISTANCE           0x001A
  +#define TAG_GPS_PROCESSING_METHOD       0x001B
  +#define TAG_GPS_AREA_INFORMATION        0x001C
  +#define TAG_GPS_DATE_STAMP              0x001D
  +#define TAG_GPS_DIFFERENTIAL            0x001E
   #define TAG_TIFF_COMMENT                0x00FE /* SHOUDLNT HAPPEN */
   #define TAG_NEW_SUBFILE                 0x00FE /* New version of subfile tag */
   #define TAG_SUBFILE_TYPE                0x00FF /* Old version of subfile tag */
  @@ -312,7 +345,6 @@
   #define TAG_TRESHHOLDING                0x0107
   #define TAG_CELL_WIDTH                  0x0108
   #define TAG_CELL_HEIGHT                 0x0109
  -#define TAG_STRIP_OFFSETS               0x0111
   #define TAG_FILL_ORDER                  0x010A
   #define TAG_DOCUMENT_NAME               0x010D
   #define TAG_IMAGE_DESCRIPTION           0x010E
  @@ -342,7 +374,7 @@
   #define TAG_DATETIME                    0x0132
   #define TAG_ARTIST                      0x013B
   #define TAG_HOST_COMPUTER               0x013C
  -#define TAG_PREDICATOR                  0x013D
  +#define TAG_PREDICTOR                   0x013D
   #define TAG_WHITE_POINT                 0x013E
   #define TAG_PRIMARY_CHROMATICITIES      0x013F
   #define TAG_COLOR_MAP                   0x0140
  @@ -351,9 +383,10 @@
   #define TAG_TILE_LENGTH                 0x0143
   #define TAG_TILE_OFFSETS                0x0144
   #define TAG_TILE_BYTE_COUNTS            0x0145
  +#define TAG_SUB_IFD                     0x014A
   #define TAG_INK_SETMPUTER               0x014C
  -#define TAG_NUMBER_OF_INKS              0x014E
   #define TAG_INK_NAMES                   0x014D
  +#define TAG_NUMBER_OF_INKS              0x014E
   #define TAG_DOT_RANGE                   0x0150
   #define TAG_TARGET_PRINTER              0x0151
   #define TAG_EXTRA_SAMPLE                0x0152
  @@ -361,6 +394,7 @@
   #define TAG_S_MIN_SAMPLE_VALUE          0x0154
   #define TAG_S_MAX_SAMPLE_VALUE          0x0155
   #define TAG_TRANSFER_RANGE              0x0156
  +#define TAG_JPEG_TABLES                 0x015B
   #define TAG_JPEG_PROC                   0x0200
   #define TAG_JPEG_INTERCHANGE_FORMAT     0x0201
   #define TAG_JPEG_INTERCHANGE_FORMAT_LEN 0x0202
  @@ -374,35 +408,87 @@
   #define TAG_YCC_SUB_SAMPLING            0x0212
   #define TAG_YCC_POSITIONING             0x0213
   #define TAG_REFERENCE_BLACK_WHITE       0x0214
  +/* 0x0301 - 0x0302 */
  +/* 0x0320 */
  +/* 0x0343 */
  +/* 0x5001 - 0x501B */
  +/* 0x5021 - 0x503B */
  +/* 0x5090 - 0x5091 */
  +/* 0x5100 - 0x5101 */
  +/* 0x5110 - 0x5113 */
  +/* 0x80E3 - 0x80E6 */
  +/* 0x828d - 0x828F */
   #define TAG_COPYRIGHT                   0x8298
   #define TAG_EXPOSURETIME                0x829A
   #define TAG_FNUMBER                     0x829D
   #define TAG_EXIF_IFD_POINTER            0x8769
  +#define TAG_ICC_PROFILE                 0x8773
  +#define TAG_EXPOSURE_PROGRAM            0x8822
  +#define TAG_SPECTRAL_SENSITY            0x8824
   #define TAG_GPS_IFD_POINTER             0x8825
   #define TAG_ISOSPEED                    0x8827
  +#define TAG_OPTOELECTRIC_CONVERSION_F   0x8828
  +/* 0x8829 - 0x882b */
   #define TAG_EXIFVERSION                 0x9000
  +#define TAG_DATE_TIME_ORIGINAL          0x9003
  +#define TAG_DATE_TIME_DIGITIZED         0x9004
  +#define TAG_COMPONENT_CONFIG            0x9101
  +#define TAG_COMPRESSED_BITS_PER_PIXEL   0x9102
   #define TAG_SHUTTERSPEED                0x9201
   #define TAG_APERTURE                    0x9202
  -#define TAG_DATETIME_ORIGINAL           0x9003
  -#define TAG_MAXAPERTURE                 0x9205
  +#define TAG_BRIGHTNESS_VALUE            0x9203
  +#define TAG_EXPOSURE_BIAS_VALUE         0x9204
  +#define TAG_MAX_APERTURE                0x9205
   #define TAG_SUBJECT_DISTANCE            0x9206
  +#define TAG_METRIC_MODULE               0x9207
   #define TAG_LIGHT_SOURCE                0x9208
   #define TAG_FLASH                       0x9209
  -#define TAG_FOCALLENGTH                 0x920A
  +#define TAG_FOCAL_LENGTH                0x920A
  +/* 0x920B - 0x920D */
  +/* 0x9211 - 0x9216 */
  +#define TAG_SUBJECT_AREA                0x9214
   #define TAG_MARKER_NOTE                 0x927C
   #define TAG_USERCOMMENT                 0x9286
  -#define TAG_XP_TITLE                    0x9c9b
  -#define TAG_XP_COMMENTS                 0x9c9c
  -#define TAG_XP_AUTHOR                   0x9c9d
  -#define TAG_XP_KEYWORDS                 0x9c9e
  -#define TAG_XP_SUBJECT                  0x9c9f
  +#define TAG_SUB_SEC_TIME                0x9290
  +#define TAG_SUB_SEC_TIME_ORIGINAL       0x9291
  +#define TAG_SUB_SEC_TIME_DIGITIZED      0x9292
  +/* 0x923F */
  +/* 0x935C */
  +#define TAG_XP_TITLE                    0x9C9B
  +#define TAG_XP_COMMENTS                 0x9C9C
  +#define TAG_XP_AUTHOR                   0x9C9D
  +#define TAG_XP_KEYWORDS                 0x9C9E
  +#define TAG_XP_SUBJECT                  0x9C9F
   #define TAG_FLASH_PIX_VERSION           0xA000
   #define TAG_COLOR_SPACE                 0xA001
  -#define TAG_COMP_IMAGEWIDTH             0xA002 /* compressed images only */
  -#define TAG_COMP_IMAGEHEIGHT            0xA003
  +#define TAG_COMP_IMAGE_WIDTH            0xA002 /* compressed images only */
  +#define TAG_COMP_IMAGE_HEIGHT           0xA003
  +#define TAG_RELATED_SOUND_FILE          0xA004
   #define TAG_INTEROP_IFD_POINTER         0xA005 /* IFD pointer */
  -#define TAG_FOCALPLANEXRES              0xA20E
  -#define TAG_FOCALPLANEUNITS             0xA210
  +#define TAG_FLASH_ENERGY                0xA20B
  +#define TAG_SPATIAL_FREQUENCY_RESPONSE  0xA20C
  +#define TAG_FOCALPLANE_X_RES            0xA20E
  +#define TAG_FOCALPLANE_Y_RES            0xA20F
  +#define TAG_FOCALPLANE_RESOLUTION_UNIT  0xA210
  +#define TAG_SUBJECT_LOCATION            0xA214
  +#define TAG_EXPOSURE_INDEX              0xA215
  +#define TAG_SENSING_METHOD              0xA217
  +#define TAG_FILE_SOURCE                 0xA300
  +#define TAG_SCENE_TYPE                  0xA301
  +#define TAG_CFA_PATTERN                 0xA302
  +#define TAG_CUSTOM_RENDERED             0xA401
  +#define TAG_EXPOSURE_MODE               0xA402
  +#define TAG_WHITE_BALANCE               0xA403
  +#define TAG_DIGITAL_ZOOM_RATIO          0xA404
  +#define TAG_FOCAL_LENGTH_IN_35_MM_FILM  0xA405
  +#define TAG_SCENE_CAPTURE_TYPE          0xA406
  +#define TAG_GAIN_CONTROL                0xA407
  +#define TAG_CONTRAST                    0xA408
  +#define TAG_SATURATION                  0xA409
  +#define TAG_SHARPNESS                   0xA40A
  +#define TAG_DEVICE_SETTING_DESCRIPTION  0xA40B
  +#define TAG_SUBJECT_DISTANCE_RANGE      0xA40C
  +#define TAG_IMAGE_UNIQUE_ID             0xA420
   
   /* Olympus specific tags */
   #define TAG_OLYMPUS_SPECIALMODE         0x0200
  @@ -417,6 +503,7 @@
   /* Internal */
   #define TAG_NONE               			-1 /* note that -1 <> 0xFFFF */
   #define TAG_COMPUTED_VALUE     			-2
  +#define TAG_END_OF_LIST                 0xFFFD
   
   /* Values for TAG_PHOTOMETRIC_INTERPRETATION */
   #define PMI_BLACK_IS_ZERO       0
  @@ -432,12 +519,22 @@
   
   /* {{{ TabTable[]
    */
  -
  -static const struct {
  +typedef const struct {
   	unsigned short Tag;
   	char *Desc;
  -} TagTable[] = {
  -  { 0x00FE, "NewSubFile"},
  +} tag_info_type;
  +
  +typedef tag_info_type  tag_info_array[];
  +typedef tag_info_type  *tag_table_type;
  +
  +#define TAG_TABLE_END \
  +  {TAG_NONE,           "No tag value"},\
  +  {TAG_COMPUTED_VALUE, "Computed value"},\
  +  {TAG_END_OF_LIST,    ""}  /* Important for exif_get_tagname() IF value != "" functionresult is != false */
  +
  +static tag_info_array tag_table_IFD = {
  +  { 0x000B, "ACDComment"},
  +  { 0x00FE, "NewSubFile"}, /* better name it 'ImageType' ? */
     { 0x00FF, "SubFile"},
     { 0x0100, "ImageWidth"},
     { 0x0101, "ImageLength"},
  @@ -484,6 +581,7 @@
     { 0x0143, "TileLength"},
     { 0x0144, "TileOffsets"},
     { 0x0145, "TileByteCounts"},
  +  { 0x014A, "SubIFD"},
     { 0x014C, "InkSet"},
     { 0x014D, "InkNames"},
     { 0x014E, "NumberOfInks"},
  @@ -494,6 +592,12 @@
     { 0x0154, "SMinSampleValue"},
     { 0x0155, "SMaxSampleValue"},
     { 0x0156, "TransferRange"},
  +  { 0x0157, "ClipPath"},
  +  { 0x0158, "XClipPathUnits"},
  +  { 0x0159, "YClipPathUnits"},
  +  { 0x015A, "Indexed"},
  +  { 0x015B, "JPEGTables"},
  +  { 0x015F, "OPIProxy"},
     { 0x0200, "JPEGProc"},
     { 0x0201, "JPEGInterchangeFormat"},
     { 0x0202, "JPEGInterchangeFormatLength"},
  @@ -507,7 +611,80 @@
     { 0x0212, "YCbCrSubSampling"},
     { 0x0213, "YCbCrPositioning"},
     { 0x0214, "ReferenceBlackWhite"},
  +  { 0x02BC, "ExtensibleMetadataPlatform"}, /* XAP: Extensible Authoring Publishing, obsoleted by XMP: Extensible Metadata Platform */
  +  { 0x0301, "Gamma"}, 
  +  { 0x0302, "ICCProfileDescriptor"}, 
  +  { 0x0303, "SRGBRenderingIntent"}, 
  +  { 0x0320, "ImageTitle"}, 
  +  { 0x5001, "ResolutionXUnit"}, 
  +  { 0x5002, "ResolutionYUnit"}, 
  +  { 0x5003, "ResolutionXLengthUnit"}, 
  +  { 0x5004, "ResolutionYLengthUnit"}, 
  +  { 0x5005, "PrintFlags"}, 
  +  { 0x5006, "PrintFlagsVersion"}, 
  +  { 0x5007, "PrintFlagsCrop"}, 
  +  { 0x5008, "PrintFlagsBleedWidth"}, 
  +  { 0x5009, "PrintFlagsBleedWidthScale"}, 
  +  { 0x500A, "HalftoneLPI"}, 
  +  { 0x500B, "HalftoneLPIUnit"}, 
  +  { 0x500C, "HalftoneDegree"}, 
  +  { 0x500D, "HalftoneShape"}, 
  +  { 0x500E, "HalftoneMisc"}, 
  +  { 0x500F, "HalftoneScreen"}, 
  +  { 0x5010, "JPEGQuality"}, 
  +  { 0x5011, "GridSize"}, 
  +  { 0x5012, "ThumbnailFormat"}, 
  +  { 0x5013, "ThumbnailWidth"}, 
  +  { 0x5014, "ThumbnailHeight"}, 
  +  { 0x5015, "ThumbnailColorDepth"}, 
  +  { 0x5016, "ThumbnailPlanes"}, 
  +  { 0x5017, "ThumbnailRawBytes"}, 
  +  { 0x5018, "ThumbnailSize"}, 
  +  { 0x5019, "ThumbnailCompressedSize"}, 
  +  { 0x501A, "ColorTransferFunction"}, 
  +  { 0x501B, "ThumbnailData"}, 
  +  { 0x5020, "ThumbnailImageWidth"}, 
  +  { 0x5021, "ThumbnailImageHeight"}, 
  +  { 0x5022, "ThumbnailBitsPerSample"}, 
  +  { 0x5023, "ThumbnailCompression"}, 
  +  { 0x5024, "ThumbnailPhotometricInterp"}, 
  +  { 0x5025, "ThumbnailImageDescription"}, 
  +  { 0x5026, "ThumbnailEquipMake"}, 
  +  { 0x5027, "ThumbnailEquipModel"}, 
  +  { 0x5028, "ThumbnailStripOffsets"}, 
  +  { 0x5029, "ThumbnailOrientation"}, 
  +  { 0x502A, "ThumbnailSamplesPerPixel"}, 
  +  { 0x502B, "ThumbnailRowsPerStrip"}, 
  +  { 0x502C, "ThumbnailStripBytesCount"}, 
  +  { 0x502D, "ThumbnailResolutionX"}, 
  +  { 0x502E, "ThumbnailResolutionY"}, 
  +  { 0x502F, "ThumbnailPlanarConfig"}, 
  +  { 0x5030, "ThumbnailResolutionUnit"}, 
  +  { 0x5031, "ThumbnailTransferFunction"}, 
  +  { 0x5032, "ThumbnailSoftwareUsed"}, 
  +  { 0x5033, "ThumbnailDateTime"}, 
  +  { 0x5034, "ThumbnailArtist"}, 
  +  { 0x5035, "ThumbnailWhitePoint"}, 
  +  { 0x5036, "ThumbnailPrimaryChromaticities"}, 
  +  { 0x5037, "ThumbnailYCbCrCoefficients"}, 
  +  { 0x5038, "ThumbnailYCbCrSubsampling"}, 
  +  { 0x5039, "ThumbnailYCbCrPositioning"}, 
  +  { 0x503A, "ThumbnailRefBlackWhite"}, 
  +  { 0x503B, "ThumbnailCopyRight"}, 
  +  { 0x5090, "LuminanceTable"}, 
  +  { 0x5091, "ChrominanceTable"}, 
  +  { 0x5100, "FrameDelay"}, 
  +  { 0x5101, "LoopCount"}, 
  +  { 0x5110, "PixelUnit"}, 
  +  { 0x5111, "PixelPerUnitX"}, 
  +  { 0x5112, "PixelPerUnitY"}, 
  +  { 0x5113, "PaletteHistogram"}, 
     { 0x1000, "RelatedImageFileFormat"},
  +  { 0x800D, "ImageID"},
  +  { 0x80E3, "Matteing"},   /* obsoleted by ExtraSamples */
  +  { 0x80E4, "DataType"},   /* obsoleted by SampleFormat */
  +  { 0x80E5, "ImageDepth"},
  +  { 0x80E6, "TileDepth"},
     { 0x828D, "CFARepeatPatternDim"},
     { 0x828E, "CFAPattern"},
     { 0x828F, "BatteryLevel"},
  @@ -515,10 +692,14 @@
     { 0x829A, "ExposureTime"},
     { 0x829D, "FNumber"},
     { 0x83BB, "IPTC/NAA"},
  +  { 0x84E3, "IT8RasterPadding"},
  +  { 0x84E5, "IT8ColorTable"},
  +  { 0x8649, "ImageResourceInformation"}, /* PhotoShop */
     { 0x8769, "Exif_IFD_Pointer"},
  -  { 0x8773, "InterColorProfile"},
  +  { 0x8773, "ICC_Profile"},
     { 0x8822, "ExposureProgram"},
  -  { 0x8824, "SpectralSensitivity"},
  +  { 0x8824, "SpectralSensity"},
  +  { 0x8828, "OECF"},
     { 0x8825, "GPS_IFD_Pointer"},
     { 0x8827, "ISOSpeedRatings"},
     { 0x8828, "OECF"},
  @@ -539,17 +720,24 @@
     { 0x920A, "FocalLength"},
     { 0x920B, "FlashEnergy"},                 /* 0xA20B  in JPEG   */
     { 0x920C, "SpatialFrequencyResponse"},    /* 0xA20C    -  -    */
  +  { 0x920D, "Noise"},
     { 0x920E, "FocalPlaneXResolution"},       /* 0xA20E    -  -    */
     { 0x920F, "FocalPlaneYResolution"},       /* 0xA20F    -  -    */
     { 0x9210, "FocalPlaneResolutionUnit"},    /* 0xA210    -  -    */
  +  { 0x9211, "ImageNumber"},
  +  { 0x9212, "SecurityClassification"},
  +  { 0x9213, "ImageHistory"},
     { 0x9214, "SubjectLocation"},             /* 0xA214    -  -    */
     { 0x9215, "ExposureIndex"},               /* 0xA215    -  -    */
  +  { 0x9216, "TIFF/EPStandardID"},
     { 0x9217, "SensingMethod"},               /* 0xA217    -  -    */
  +  { 0x923F, "StoNits"},
     { 0x927C, "MakerNote"},
     { 0x9286, "UserComment"},
     { 0x9290, "SubSecTime"},
     { 0x9291, "SubSecTimeOriginal"},
     { 0x9292, "SubSecTimeDigitized"},
  +  { 0x935C, "ImageSourceData"},             /* "Adobe Photoshop Document Data Block": 8BIM... */
     { 0x9c9b, "Title" },                      /* Win XP specific, Unicode  */
     { 0x9c9c, "Comments" },                   /* Win XP specific, Unicode  */
     { 0x9c9d, "Author" },                     /* Win XP specific, Unicode  */
  @@ -559,38 +747,221 @@
     { 0xA001, "ColorSpace"},
     { 0xA002, "ExifImageWidth"},
     { 0xA003, "ExifImageLength"},
  +  { 0xA004, "RelatedSoundFile"},
     { 0xA005, "InteroperabilityOffset"},
     { 0xA20B, "FlashEnergy"},                 /* 0x920B in TIFF/EP */
     { 0xA20C, "SpatialFrequencyResponse"},    /* 0x920C    -  -    */
  +  { 0xA20D, "Noise"},
     { 0xA20E, "FocalPlaneXResolution"},    	/* 0x920E    -  -    */
     { 0xA20F, "FocalPlaneYResolution"},       /* 0x920F    -  -    */
     { 0xA210, "FocalPlaneResolutionUnit"},    /* 0x9210    -  -    */
  +  { 0xA211, "ImageNumber"},
  +  { 0xA212, "SecurityClassification"},
  +  { 0xA213, "ImageHistory"},
     { 0xA214, "SubjectLocation"},             /* 0x9214    -  -    */
     { 0xA215, "ExposureIndex"},               /* 0x9215    -  -    */
  +  { 0xA216, "TIFF/EPStandardID"},
     { 0xA217, "SensingMethod"},               /* 0x9217    -  -    */
     { 0xA300, "FileSource"},
     { 0xA301, "SceneType"},
  -  {TAG_NONE,           "no tag value"},
  -  {TAG_COMPUTED_VALUE, "computed value"},
  -  {      0, ""}  /* Important for exif_get_tagname() IF value != "" functionresult is != false */
  +  { 0xA302, "CFAPattern"},
  +  { 0xA401, "CustomRendered"},
  +  { 0xA402, "ExposureMode"},
  +  { 0xA403, "WhiteBalance"},
  +  { 0xA404, "DigitalZoomRatio"},
  +  { 0xA405, "FocalLengthIn35mmFilm"},
  +  { 0xA406, "SceneCaptureType"},
  +  { 0xA407, "GainControl"},
  +  { 0xA408, "Contrast"},
  +  { 0xA409, "Saturation"},
  +  { 0xA40A, "Sharpness"},
  +  { 0xA40B, "DeviceSettingDescription"},
  +  { 0xA40C, "SubjectDistanceRange"},
  +  { 0xA420, "ImageUniqueID"},
  +  TAG_TABLE_END
   } ;
   
  +static tag_info_array tag_table_GPS = {
  +  { 0x0000, "GPSVersion"},
  +  { 0x0001, "GPSLatitudeRef"},
  +  { 0x0002, "GPSLatitude"},
  +  { 0x0003, "GPSLongitude"},
  +  { 0x0004, "GPSLongitudeRef"},
  +  { 0x0005, "GPSAltitudeRef"},
  +  { 0x0006, "GPSAltitude"},
  +  { 0x0007, "GPSTimeStamp"},
  +  { 0x0008, "GPSSatellites"},
  +  { 0x0009, "GPSStatus"},
  +  { 0x000A, "GPSMeasureMode"},
  +  { 0x000B, "GPSDOP"},
  +  { 0x000C, "GPSSpeedRef"},
  +  { 0x000D, "GPSSpeed"},
  +  { 0x000E, "GPSTrackRef"},
  +  { 0x000F, "GPSTrack"},
  +  { 0x0010, "GPSImgDirectionRef"},
  +  { 0x0011, "GPSImgDirection"},
  +  { 0x0012, "GPSMapDatum"},
  +  { 0x0013, "GPSDestLatitudeRef"},
  +  { 0x0014, "GPSDestLatitude"},
  +  { 0x0015, "GPSDestLongitudeRef"},
  +  { 0x0016, "GPSDestLongitude"},
  +  { 0x0017, "GPSDestBearingRef"},
  +  { 0x0018, "GPSDestBearing"},
  +  { 0x0019, "GPSDestDistanceRef"},
  +  { 0x001A, "GPSDestDistance"},
  +  { 0x001B, "GPSProcessingMode"},
  +  { 0x001C, "GPSAreaInformation"},
  +  { 0x001D, "GPSDateStamp"},
  +  { 0x001E, "GPSDifferential"},
  +  TAG_TABLE_END
  +};
  +
  +static tag_info_array tag_table_IOP = {
  +  { 0x0001, "InterOperabilityIndex"}, /* should be 'R98' or 'THM' */
  +  { 0x0002, "InterOperabilityVersion"},
  +  { 0x1000, "RelatedFileFormat"},
  +  { 0x1001, "RelatedImageWidth"},
  +  { 0x1002, "RelatedImageHeight"},
  +  TAG_TABLE_END
  +};
  +
  +static tag_info_array tag_table_VND_CANON = {
  +  { 0x0001, "ModeArray"}, /* guess */
  +  { 0x0004, "ImageInfo"}, /* guess */
  +  { 0x0006, "ImageType"},
  +  { 0x0007, "FirmwareVersion"},
  +  { 0x0008, "ImageNumber"},
  +  { 0x0009, "OwnerName"},
  +  { 0x000C, "Camera"},
  +  { 0x000F, "CustomFunctions"},
  +  TAG_TABLE_END
  +};
  +
  +static tag_info_array tag_table_VND_CASIO = {
  +  { 0x0001, "RecordingMode"},
  +  { 0x0002, "Quality"},
  +  { 0x0003, "FocusingMode"},
  +  { 0x0004, "FlashMode"},
  +  { 0x0005, "FlashIntensity"},
  +  { 0x0006, "ObjectDistance"},
  +  { 0x0007, "WhiteBalance"},
  +  { 0x000A, "DigitalZoom"},
  +  { 0x000B, "Sharpness"},
  +  { 0x000C, "Contrast"},
  +  { 0x000D, "Saturation"},
  +  { 0x0014, "CCDSensitivity"},
  +  TAG_TABLE_END
  +};
  +
  +static tag_info_array tag_table_VND_FUJI = {
  +  { 0x0000, "Version"},
  +  { 0x1000, "Quality"},
  +  { 0x1001, "Sharpness"},
  +  { 0x1002, "WhiteBalance"},
  +  { 0x1003, "Color"},
  +  { 0x1004, "Tone"},
  +  { 0x1010, "FlashMode"},
  +  { 0x1011, "FlashStrength"},
  +  { 0x1020, "Macro"},
  +  { 0x1021, "FocusMode"},
  +  { 0x1030, "SlowSync"},
  +  { 0x1031, "PictureMode"},
  +  { 0x1100, "ContTake"},
  +  { 0x1300, "BlurWarning"},
  +  { 0x1301, "FocusWarning"},
  +  { 0x1302, "AEWarning "},
  +  TAG_TABLE_END
  +};
  +
  +static tag_info_array tag_table_VND_NIKON = {
  +  { 0x0003, "Quality"},
  +  { 0x0004, "ColorMode"},
  +  { 0x0005, "ImageAdjustment"},
  +  { 0x0006, "CCDSensitivity"},
  +  { 0x0007, "WhiteBalance"},
  +  { 0x0008, "Focus"},
  +  { 0x000a, "DigitalZoom"},
  +  { 0x000b, "Converter"},
  +  TAG_TABLE_END
  +};
  +  
  +static tag_info_array tag_table_VND_NIKON_990 = {
  +  { 0x0001, "Version"},
  +  { 0x0002, "ISOSetting"},
  +  { 0x0003, "ColorMode"},
  +  { 0x0004, "Quality"},
  +  { 0x0005, "WhiteBalance"},
  +  { 0x0006, "ImageSharpening"},
  +  { 0x0007, "FocusMode"},
  +  { 0x0008, "FlashSetting"},
  +  { 0x000F, "ISOSelection"},
  +  { 0x0080, "ImageAdjustment"},
  +  { 0x0082, "AuxiliaryLens"},
  +  { 0x0085, "ManualFocusDistance"},
  +  { 0x0086, "DigitalZoom"},
  +  { 0x0088, "AFFocusPosition"},
  +  { 0x0010, "DataDump"},
  +  TAG_TABLE_END
  +};
  +  
  +static tag_info_array tag_table_VND_OLYMPUS = {
  +  { 0x0200, "SpecialMode"},
  +  { 0x0201, "JPEGQuality"},
  +  { 0x0202, "Macro"},
  +  { 0x0204, "DigitalZoom"},
  +  { 0x0207, "SoftwareRelease"},
  +  { 0x0208, "PictureInfo"},
  +  { 0x0209, "CameraId"},
  +  { 0x0F00, "DataDump"},
  +  TAG_TABLE_END
  +};
  +
  +typedef enum mn_byte_order_t {
  +	MN_ORDER_INTEL    = 0,
  +	MN_ORDER_MOTOROLA = 1,
  +	MN_ORDER_NORMAL
  +} mn_byte_order_t;
  +
  +typedef enum mn_offset_mode_t {
  +	MN_OFFSET_NORMAL,
  +	MN_OFFSET_MARKER
  +} mn_offset_mode_t;
  +
  +typedef struct {
  +	tag_table_type   tag_table;
  +	char *           make;
  +	char *           model;
  +	char *           id_string;
  +	int              id_string_len;
  +	int              offset;
  +	mn_byte_order_t  byte_order;
  +	mn_offset_mode_t offset_mode;
  +} marker_note_type;
  +
  +static const marker_note_type marker_note_array[] = {
  +  { tag_table_VND_CANON,     "Canon",                   NULL,  NULL,                       0,  0,  MN_ORDER_NORMAL,   MN_OFFSET_NORMAL},
  +  { tag_table_VND_CASIO,     "CASIO",                   NULL,  NULL,                       0,  0,  MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL},
  +  { tag_table_VND_FUJI,      "FUJIFILM",                NULL,  "FUJIFILM\x0C\x00\x00\x00", 12, 12, MN_ORDER_INTEL,    MN_OFFSET_MARKER},
  +  { tag_table_VND_NIKON,     "NIKON",                   NULL,  "Nikon\x00\x01\x00",        8,  8,  MN_ORDER_NORMAL,   MN_OFFSET_NORMAL},
  +  { tag_table_VND_NIKON_990, "NIKON",                   NULL,  NULL,                       0,  0,  MN_ORDER_NORMAL,   MN_OFFSET_NORMAL},
  +  { tag_table_VND_OLYMPUS,   "OLYMPUS OPTICAL CO.,LTD", NULL,  "OLYMP\x00\x01\x00",        8,  8,  MN_ORDER_NORMAL,   MN_OFFSET_NORMAL},
  +};
   /* }}} */
   
   /* {{{ exif_get_tagname
   	Get headername for tag_num or NULL if not defined */
  -static char * exif_get_tagname(int tag_num, char *ret, int len)
  +static char * exif_get_tagname(int tag_num, char *ret, int len, tag_table_type tag_table TSRMLS_DC)
   {
   	int i, t;
   	char tmp[32];
   
   	for (i=0;;i++) {
  -		if ((t=TagTable[i].Tag) == tag_num || !t) {
  +		if ((t=tag_table[i].Tag) == tag_num || t==TAG_END_OF_LIST) {
  +			if (t==TAG_END_OF_LIST) {
  +				break;
  +			}
   			if (ret && len)  {
  -				if (!t) {
  -					break;
  -				}
  -				strncpy(ret, TagTable[i].Desc, abs(len));
  +				strncpy(ret, tag_table[i].Desc, abs(len));
   				if (len<0) {
   					len = -len;
   					ret[len-1]='\0';
  @@ -599,11 +970,11 @@
   				ret[len-1]='\0';
   				return ret;
   			}
  -			return TagTable[i].Desc;
  +			return tag_table[i].Desc;
   		}
   	}
   	if (ret && len) {
  -		sprintf(tmp, "UndefinedTag:0x%04X", tag_num);
  +		snprintf(tmp, sizeof(tmp), "UndefinedTag:0x%04X", tag_num);
   		strncpy(ret, tmp, abs(len));
   		if (len<0) {
   			len = -len;
  @@ -826,10 +1197,10 @@
   /* {{{ struct image_info_value, image_info_list
   */
   #ifndef WORD
  -#define WORD short
  +#define WORD unsigned short
   #endif
   #ifndef DWORD
  -#define DWORD int
  +#define DWORD unsigned int
   #endif
   
   typedef struct {
  @@ -884,7 +1255,8 @@
   #define SECTION_INTEROP     10
   #define SECTION_APP12       11
   #define SECTION_WINXP       12
  -#define SECTION_COUNT       13
  +#define SECTION_MARKERNOTE  13
  +#define SECTION_COUNT       14
   
   #define FOUND_FILE          (1<<SECTION_FILE)
   #define FOUND_COMPUTED      (1<<SECTION_COMPUTED)
  @@ -899,6 +1271,7 @@
   #define FOUND_INTEROP       (1<<SECTION_INTEROP)
   #define FOUND_APP12         (1<<SECTION_APP12)
   #define FOUND_WINXP         (1<<SECTION_WINXP)
  +#define FOUND_MARKERNOTE    (1<<SECTION_MARKERNOTE)
   
   static char *exif_get_sectionname(int section)
   {
  @@ -916,9 +1289,30 @@
   		case SECTION_INTEROP:   return "INTEROP";
   		case SECTION_APP12:     return "APP12";
   		case SECTION_WINXP:     return "WINXP";
  +		case SECTION_MARKERNOTE:return "MARKERNOTE";
   	}
   	return "";
   }
  +
  +static const tag_table_type exif_get_tag_table(int section)
  +{
  +	switch(section) {
  +		case SECTION_FILE:      return &tag_table_IFD[0];
  +		case SECTION_COMPUTED:  return &tag_table_IFD[0];
  +		case SECTION_ANY_TAG:   return &tag_table_IFD[0];
  +		case SECTION_IFD0:      return &tag_table_IFD[0];
  +		case SECTION_THUMBNAIL: return &tag_table_IFD[0];
  +		case SECTION_COMMENT:   return &tag_table_IFD[0];
  +		case SECTION_APP0:      return &tag_table_IFD[0];
  +		case SECTION_EXIF:      return &tag_table_IFD[0];
  +		case SECTION_FPIX:      return &tag_table_IFD[0];
  +		case SECTION_GPS:       return &tag_table_GPS[0];
  +		case SECTION_INTEROP:   return &tag_table_IOP[0];
  +		case SECTION_APP12:     return &tag_table_IFD[0];
  +		case SECTION_WINXP:     return &tag_table_IFD[0];
  +	}
  +	return &tag_table_IFD[0];
  +}
   /* }}} */
   
   /* {{{ exif_get_sectionlist
  @@ -987,7 +1381,6 @@
   	xp_field_type   *list;
   } xp_field_list;
   
  -/* EXIF standard defines Copyright as "<Photographer> [ '\0' <Editor> ] ['\0']" */
   /* This structure is used to store a section of a Jpeg file. */
   typedef struct {
   	php_stream      *infile;
  @@ -998,6 +1391,9 @@
   	int             Height, Width;
   	int             IsColor;
   
  +	char            *make;
  +	char            *model;
  +
   	float           ApertureFNumber;
   	float           ExposureTime;
   	double          FocalplaneUnits;
  @@ -1018,7 +1414,7 @@
   	char            *encode_jis;
   	char            *decode_jis_be;
   	char            *decode_jis_le;
  -	char            *Copyright;
  +	char            *Copyright;/* EXIF standard defines Copyright as "<Photographer> [ '\0' <Editor> ] ['\0']" */
   	char            *CopyrightPhotographer;
   	char            *CopyrightEditor;
   
  @@ -1122,7 +1518,7 @@
   */
   static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, int motorola_intel TSRMLS_DC)
   {
  -	int index;
  +	size_t index;
   	image_info_value *info_value;
   	image_info_data  *info_data;
   	image_info_data  *list;
  @@ -1172,17 +1568,8 @@
   		case TAG_FMT_SBYTE:
   		case TAG_FMT_BYTE:
   		/* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */
  -			if (length<1)
  -				break;
  -			if (format==TAG_FMT_BYTE && length==1) {
  -				info_value->u = *(uchar*)value;
  -				break;
  -			}
  -			if (format==TAG_FMT_SBYTE && length==1) {
  -				info_value->i = *(char*)value;
  -				info_data->length = 0;
  +			if (!length)
   				break;
  -			}
   		case TAG_FMT_UNDEFINED:
   			if (value) {
   				info_value->s = estrndup(value, length);
  @@ -1408,7 +1795,7 @@
   				case TAG_FMT_SBYTE:
   				case TAG_FMT_BYTE:
   					/* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */
  -					if (image_info->info_list[section_index].list[i].length<=1)
  +					if (image_info->info_list[section_index].list[i].length<1)
   						break;
   				default:
   				case TAG_FMT_UNDEFINED:
  @@ -1442,14 +1829,20 @@
   
   /* {{{ add_assoc_image_info
    * Add image_info to associative array value. */
  -static void add_assoc_image_info(pval *value, int sub_array, image_info_type *image_info, int section_index)
  +static void add_assoc_image_info(pval *value, int sub_array, image_info_type *image_info, int section_index TSRMLS_DC)
   {
   	char    buffer[64], *val, *name, uname[64];
   	int     i, ap, l, b, idx=0, done, unknown=0;
  +#ifdef EXIF_DEBUG
  +	int     info_tag;
  +#endif
   	image_info_value *info_value;
   	image_info_data  *info_data;
   	pval 			 *tmpi, *array = NULL;
   
  +#ifdef EXIF_DEBUG
  +/*		php_error(E_NOTICE, "%s(): Adding %d infos from section %s", get_active_function_name(TSRMLS_C), image_info->info_list[section_index].count, exif_get_sectionname(section_index));*/
  +#endif
   	if (image_info->info_list[section_index].count) {
   		if (sub_array) {
   			MAKE_STD_ZVAL(tmpi);
  @@ -1461,11 +1854,17 @@
   		for(i=0; i<image_info->info_list[section_index].count; i++) {
   			done       = 0;
   			info_data  = &image_info->info_list[section_index].list[i];
  +#ifdef EXIF_DEBUG
  +			info_tag   = info_data->tag; /* conversion */
  +#endif
   			info_value = &info_data->value;
   			if (!(name = info_data->name)) {
  -				sprintf(uname, "%d", unknown++);
  +				snprintf(uname, sizeof(uname), "%d", unknown++);
   				name = uname;
   			}
  +#ifdef EXIF_DEBUG
  +/*		php_error(E_NOTICE, "%s(): Adding infos: tag(0x%04X,%12s,L=0x%04X): %s", get_active_function_name(TSRMLS_C), info_tag, exif_get_tagname(info_tag, buffer, -12, exif_get_tag_table(section_index) TSRMLS_CC), info_data->length, info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:"<no data>"):exif_get_tagformat(info_data->format));*/
  +#endif
   			if (info_data->length==0) {
   				add_assoc_null(tmpi, name);
   			} else {
  @@ -1476,6 +1875,8 @@
   						 * So not return but use type UNDEFINED
   						 * return;
   						 */
  +					case TAG_FMT_BYTE:
  +					case TAG_FMT_SBYTE:
   					case TAG_FMT_UNDEFINED:
   						if (!info_value->s) {
   							add_assoc_stringl(tmpi, name, "", 0, 1);
  @@ -1497,8 +1898,8 @@
   
   					case TAG_FMT_URATIONAL:
   					case TAG_FMT_SRATIONAL:
  -					case TAG_FMT_BYTE:
  -					case TAG_FMT_SBYTE:
  +					/*case TAG_FMT_BYTE:
  +					case TAG_FMT_SBYTE:*/
   					case TAG_FMT_USHORT:
   					case TAG_FMT_SSHORT:
   					case TAG_FMT_SINGLE:
  @@ -1534,7 +1935,7 @@
   									break;
   
   								case TAG_FMT_URATIONAL:
  -									sprintf(buffer, "%i/%i", info_value->ur.num, info_value->ur.den);
  +									snprintf(buffer, sizeof(buffer), "%i/%i", info_value->ur.num, info_value->ur.den);
   									if (l==1) {
   										add_assoc_string(tmpi, name, buffer, 1);
   									} else {
  @@ -1560,7 +1961,7 @@
   									break;
   
   								case TAG_FMT_SRATIONAL:
  -									sprintf(buffer, "%i/%i", info_value->sr.num, info_value->sr.den);
  +									snprintf(buffer, sizeof(buffer), "%i/%i", info_value->sr.num, info_value->sr.den);
   									if (l==1) {
   										add_assoc_string(tmpi, name, buffer, 1);
   									} else {
  @@ -1640,7 +2041,7 @@
   #define M_DRI   0xDD
   #define M_DHP   0xDE
   #define M_EXP   0xDF
  -#define M_APP0  0xE0
  +#define M_APP0  0xE0    /* JPEG: 'JFIFF' AND (additional 'JFXX')    */
   #define M_EXIF  0xE1    /* Exif Attribute Information               */
   #define M_APP2  0xE2    /* Flash Pix Extension Data?                */
   #define M_APP3  0xE3
  @@ -1654,7 +2055,7 @@
   #define M_APP11 0xEB
   #define M_APP12 0xEC
   #define M_APP13 0xED    /* IPTC International Press Telecommunications Council */
  -#define M_APP14 0xEE
  +#define M_APP14 0xEE    /* Software, Copyright?                     */
   #define M_APP15 0xEF
   #define M_JPG0  0xF0
   #define M_JPG1  0xF1
  @@ -1772,7 +2173,9 @@
   }
   /* }}} */
   
  -static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *DirStart, char *OffsetBase, unsigned IFDlength, int sub_section_index TSRMLS_DC);
  +/* forward declarations */
  +static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index TSRMLS_DC);
  +static int exif_process_IFD_TAG(    image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC);
   
   /* {{{ exif_get_markername
   	Get name of marker */
  @@ -1842,7 +2245,7 @@
   
   	convert_to_long_ex(p_num);
   	tag = Z_LVAL_PP(p_num);
  -	szTemp = exif_get_tagname(tag, NULL, 0);
  +	szTemp = exif_get_tagname(tag, NULL, 0, tag_table_IFD TSRMLS_CC);
   	if (tag<0 || !szTemp || !szTemp[0]) {
   		RETURN_BOOL(FALSE);
   	} else {
  @@ -1856,7 +2259,7 @@
   static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel TSRMLS_DC) {
   	size_t  byte_count;
   	char    *value_ptr, *data_ptr;
  -	int     i;
  +	size_t  i;
   
   	image_info_value  *info_value;
   
  @@ -1995,7 +2398,7 @@
   				info_data  = &info_list->list[i];
   				byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length;
   #ifdef EXIF_DEBUG
  -				php_error(E_NOTICE, "%s(): thumbnail: process tag(x%04X=%s): %s%s (%d bytes)", get_active_function_name(TSRMLS_C), info_data->tag, exif_get_tagname(info_data->tag, tagname, -12), (info_data->length>1)&&info_data->format!=TAG_FMT_UNDEFINED&&info_data->format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(info_data->format), byte_count);
  +				php_error(E_NOTICE, "%s(): thumbnail: process tag(x%04X=%s): %s%s (%d bytes)", get_active_function_name(TSRMLS_C), info_data->tag, exif_get_tagname(info_data->tag, tagname, -12, tag_table_IFD TSRMLS_CC), (info_data->length>1)&&info_data->format!=TAG_FMT_UNDEFINED&&info_data->format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(info_data->format), byte_count);
   #endif
   				if (info_data->tag==TAG_STRIP_OFFSETS || info_data->tag==TAG_JPEG_INTERCHANGE_FORMAT) {
   					php_ifd_set16u(new_data + 0, info_data->tag,    ImageInfo->motorola_intel);
  @@ -2219,9 +2622,84 @@
   }
   /* }}} */
   
  +/* {{{ exif_process_IFD_in_MARKERNOTE
  + * Process nested IFDs directories in Marker Note. */
  +static int exif_process_IFD_in_MARKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement TSRMLS_DC)
  +{
  +	int de, i=0, section_index = SECTION_MARKERNOTE;
  +	int NumDirEntries, old_motorola_intel;
  +	const marker_note_type *marker_note;
  +	char *dir_start;
  +
  +	for (i=0; i<=sizeof(marker_note_array)/sizeof(marker_note_type); i++) {
  +		if (i==sizeof(marker_note_array)/sizeof(marker_note_type))
  +			return FALSE;
  +		marker_note = marker_note_array+i;
  +		
  +		/*php_error(E_NOTICE, "%s(): check (%s,%s)", get_active_function_name(TSRMLS_C), marker_note->make?marker_note->make:"", marker_note->model?marker_note->model:"");*/
  +		if (marker_note->make && (!ImageInfo->make || strcmp(marker_note->make, ImageInfo->make)))
  +			continue;
  +		if (marker_note->model && (!ImageInfo->model || strcmp(marker_note->model, ImageInfo->model)))
  +			continue;
  +		if (marker_note->id_string && strncmp(marker_note->id_string, value_ptr, marker_note->id_string_len))
  +			continue;
  +		break;
  +	}
  +
  +	dir_start = value_ptr + marker_note->offset;
  +
  +#ifdef EXIF_DEBUG
  +	php_error(E_NOTICE, "%s(): process %s @x%04X + 0x%04X=%d: %s", get_active_function_name(TSRMLS_C), exif_get_sectionname(section_index), (int)dir_start-(int)offset_base+marker_note->offset+displacement, value_len, value_len, exif_char_dump(value_ptr, value_len, 1));
  +#endif
  +
  +	ImageInfo->sections_found |= FOUND_MARKERNOTE;
  +
  +	old_motorola_intel = ImageInfo->motorola_intel;
  +	switch (marker_note->byte_order) {
  +		case MN_ORDER_INTEL:
  +			ImageInfo->motorola_intel = 0;
  +			break;
  +		case MN_ORDER_MOTOROLA:
  +			ImageInfo->motorola_intel = 1;
  +			break;
  +		default:
  +		case MN_ORDER_NORMAL:
  +			break;
  +	}
  +	switch (marker_note->offset_mode) {
  +		case MN_OFFSET_MARKER:
  +			offset_base = value_ptr;
  +			break;
  +		default:
  +		case MN_OFFSET_NORMAL:
  +			break;
  +	}
  +
  +	NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
  +
  +	if ((2+NumDirEntries*12) > value_len) {
  +		php_error(E_WARNING, "%s(): Illegal directory size: 2 + x%04X*12 = x%04X > x%04X", get_active_function_name(TSRMLS_C), NumDirEntries, 2+NumDirEntries*12, value_len);
  +		return FALSE;
  +	}
  +
  +	for (de=0;de<NumDirEntries;de++) {
  +		if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
  +								  offset_base, IFDlength, displacement, section_index, 0, marker_note->tag_table TSRMLS_CC)) {
  +			return FALSE;
  +		}
  +	}
  +	ImageInfo->motorola_intel = old_motorola_intel;
  +/*	NextDirOffset (must be NULL) = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);*/
  +#ifdef EXIF_DEBUG
  +	php_error(E_NOTICE, "%s(): subsection %s done", get_active_function_name(TSRMLS_C), exif_get_sectionname(SECTION_MARKERNOTE));
  +#endif
  +	return TRUE;
  +}
  +/* }}} */
  +
   /* {{{ exif_process_IFD_TAG
    * Process one of the nested IFDs directories. */
  -static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, int section_index, int ReadNextIFD TSRMLS_DC)
  +static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC)
   {
   	size_t length;
   	int tag, format, components;
  @@ -2233,10 +2711,11 @@
   	format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
   	components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);
   
  -	if (!format || format >= NUM_FORMATS) {
  +	if (!format || format > NUM_FORMATS) {
   		/* (-1) catches illegal zero case as unsigned underflows to positive large. */
  -		php_error(E_WARNING, "%s(): Illegal format code in IFD: 0x%04X", get_active_function_name(TSRMLS_C), format);
  -		return TRUE;
  +		php_error(E_WARNING, "%s(): process tag(x%04X=%s): Illegal format code 0x%04X, suppose BYTE", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), format);
  +		format = TAG_FMT_BYTE;
  +		/*return TRUE;*/
   	}
   
   	byte_count = components * php_tiff_bytes_per_format[format];
  @@ -2255,11 +2734,11 @@
   				if (value_ptr < dir_entry) {
   					/* we can read this if offset_val > 0 */
   					/* some files have their values in other parts of the file */
  -					php_error(E_WARNING, "%s(): process tag(x%04X=%s): Illegal pointer offset(x%04X < x%04X)", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12), offset_val, dir_entry);
  +					php_error(E_WARNING, "%s(): process tag(x%04X=%s): Illegal pointer offset(x%04X < x%04X)", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, dir_entry);
   				} else {
   					/* this is for sure not allowed */
   					/* exception are IFD pointers */
  -					php_error(E_WARNING, "%s(): process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12), offset_val, byte_count, offset_val+byte_count, IFDlength);
  +					php_error(E_WARNING, "%s(): process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, byte_count, offset_val+byte_count, IFDlength);
   				}
   				return TRUE;
   			}
  @@ -2306,17 +2785,17 @@
   
   	ImageInfo->sections_found |= FOUND_ANY_TAG;
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "%s(): process tag(x%04X=%s, @ x%04X + x%04X(=%d)): %s%s", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12), offset_val, byte_count, byte_count, (components>1)&&format!=TAG_FMT_UNDEFINED&&format!=TAG_FMT_STRING?"ARRAY OF ":"", format==TAG_FMT_STRING?(value_ptr?value_ptr:"<no data>"):exif_get_tagformat(format));
  +	php_error(E_NOTICE, "%s(): process tag(x%04X=%s, @ x%04X + x%04X(=%d)): %s%s", get_active_function_name(TSRMLS_C), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val+displacement, byte_count, byte_count, (components>1)&&format!=TAG_FMT_UNDEFINED&&format!=TAG_FMT_STRING?"ARRAY OF ":"", format==TAG_FMT_STRING?(value_ptr?value_ptr:"<no data>"):exif_get_tagformat(format));
   #endif
   	if (section_index==SECTION_THUMBNAIL) {
   		switch(tag) {
   			case TAG_IMAGEWIDTH:
  -			case TAG_COMP_IMAGEWIDTH:
  +			case TAG_COMP_IMAGE_WIDTH:
   				ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
   				break;
   
   			case TAG_IMAGEHEIGHT:
  -			case TAG_COMP_IMAGEHEIGHT:
  +			case TAG_COMP_IMAGE_HEIGHT:
   				ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
   				break;
   
  @@ -2345,6 +2824,7 @@
   
   		}
   	} else {
  +		if (section_index==SECTION_IFD0 || section_index==SECTION_EXIF)
   		switch(tag) {
   			case TAG_COPYRIGHT:
   				/* check for "<photographer> NUL <editor> NUL" */
  @@ -2395,7 +2875,7 @@
   				break;
   
   			case TAG_APERTURE:
  -			case TAG_MAXAPERTURE:
  +			case TAG_MAX_APERTURE:
   				/* More relevant info always comes earlier, so only use this field if we don't
   				   have appropriate aperture information yet. */
   				if (ImageInfo->ApertureFNumber == 0) {
  @@ -2418,11 +2898,11 @@
   				ImageInfo->ExposureTime = -1;
   				break;
   
  -			case TAG_COMP_IMAGEWIDTH:
  +			case TAG_COMP_IMAGE_WIDTH:
   				ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
   				break;
   
  -			case TAG_FOCALPLANEXRES:
  +			case TAG_FOCALPLANE_X_RES:
   				ImageInfo->FocalplaneXRes = exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
   				break;
   
  @@ -2432,7 +2912,7 @@
   				ImageInfo->Distance = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
   				break;
   
  -			case TAG_FOCALPLANEUNITS:
  +			case TAG_FOCALPLANE_RESOLUTION_UNIT:
   				switch((int)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)) {
   					case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */
   					case 2:
  @@ -2448,11 +2928,31 @@
   				}
   				break;
   
  +			case TAG_SUB_IFD:
  +				if (format==TAG_FMT_IFD) {
  +					/* If this is called we are either in a TIFFs thumbnail or a JPEG where we cannot handle it */
  +					/* TIFF thumbnail: our data structure cannot store a thumbnail of a thumbnail */
  +					/* JPEG do we have the data area and what to do with it */
  +					php_error(E_NOTICE, "%s(): skip SUB IFD", get_active_function_name(TSRMLS_C));
  +				}
  +				break;
  +
  +			case TAG_MAKE:
  +				ImageInfo->make = estrdup(value_ptr);
  +				break;
  +			case TAG_MODEL:
  +				ImageInfo->model = estrdup(value_ptr);
  +				break;
  +
  +			case TAG_MARKER_NOTE:
  +				exif_process_IFD_in_MARKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement TSRMLS_CC);
  +				break;
  +
   			case TAG_EXIF_IFD_POINTER:
   			case TAG_GPS_IFD_POINTER:
   			case TAG_INTEROP_IFD_POINTER:
   				if (ReadNextIFD) {
  -					char *SubdirStart;
  +					char *Subdir_start;
   					int sub_section_index = 0;
   					switch(tag) {
   						case TAG_EXIF_IFD_POINTER:
  @@ -2477,19 +2977,19 @@
   							sub_section_index = SECTION_INTEROP;
   							break;
   					}
  -					SubdirStart = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel);
  -					if (SubdirStart < offset_base || SubdirStart > offset_base+IFDlength) {
  +					Subdir_start = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel);
  +					if (Subdir_start < offset_base || Subdir_start > offset_base+IFDlength) {
   						php_error(E_WARNING, "%s(): Illegal IFD Pointer", get_active_function_name(TSRMLS_C));
   						return FALSE;
   					}
  -					exif_process_IFD_in_JPEG(ImageInfo, SubdirStart, offset_base, IFDlength, sub_section_index TSRMLS_CC);
  +					exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index TSRMLS_CC);
   #ifdef EXIF_DEBUG
   					php_error(E_NOTICE, "%s(): subsection %s done", get_active_function_name(TSRMLS_C), exif_get_sectionname(sub_section_index));
   #endif
   				}
   		}
   	}
  -	exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname)), tag, format, components, value_ptr TSRMLS_CC);
  +	exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table TSRMLS_CC), tag, format, components, value_ptr TSRMLS_CC);
   	EFREE_IF(outside);
   	return TRUE;
   }
  @@ -2497,28 +2997,28 @@
   
   /* {{{ exif_process_IFD_in_JPEG
    * Process one of the nested IFDs directories. */
  -static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *DirStart, char *OffsetBase, unsigned IFDlength, int section_index TSRMLS_DC)
  +static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, unsigned IFDlength, size_t displacement, int section_index TSRMLS_DC)
   {
   	int de;
   	int NumDirEntries;
   	int NextDirOffset;
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "%s(): (x%04X(=%d))", get_active_function_name(TSRMLS_C), IFDlength, IFDlength);
  +	php_error(E_NOTICE, "%s(): process %s (x%04X(=%d))", get_active_function_name(TSRMLS_C), exif_get_sectionname(section_index), IFDlength, IFDlength);
   #endif
   
   	ImageInfo->sections_found |= FOUND_IFD0;
   
  -	NumDirEntries = php_ifd_get16u(DirStart, ImageInfo->motorola_intel);
  +	NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
   
  -	if ((DirStart+2+NumDirEntries*12) > (OffsetBase+IFDlength)) {
  -		php_error(E_WARNING, "%s(): Illegal directory size: x%04X + 2 + x%04X*12 = x%04X > x%04X", get_active_function_name(TSRMLS_C), (int)DirStart+2-(int)OffsetBase, NumDirEntries, (int)DirStart+2+NumDirEntries*12-(int)OffsetBase, IFDlength);
  +	if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) {
  +		php_error(E_WARNING, "%s(): Illegal directory size: x%04X + 2 + x%04X*12 = x%04X > x%04X", get_active_function_name(TSRMLS_C), (int)dir_start+2-(int)offset_base, NumDirEntries, (int)dir_start+2+NumDirEntries*12-(int)offset_base, IFDlength);
   		return FALSE;
   	}
   
   	for (de=0;de<NumDirEntries;de++) {
  -		if (!exif_process_IFD_TAG(ImageInfo, DirStart + 2 + 12 * de,
  -								  OffsetBase, IFDlength, section_index, 1 TSRMLS_CC)) {
  +		if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
  +								  offset_base, IFDlength, displacement, section_index, 1, exif_get_tag_table(section_index) TSRMLS_CC)) {
   			return FALSE;
   		}
   	}
  @@ -2526,10 +3026,10 @@
   	 * Hack to make it process IDF1 I hope
   	 * There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
   	 */
  -	NextDirOffset = php_ifd_get32u(DirStart+2+12*de, ImageInfo->motorola_intel);
  +	NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
   	if (NextDirOffset) {
   		/* the next line seems false but here IFDlength means length of all IFDs */
  -		if (OffsetBase + NextDirOffset < OffsetBase || OffsetBase + NextDirOffset > OffsetBase+IFDlength) {
  +		if (offset_base + NextDirOffset < offset_base || offset_base + NextDirOffset > offset_base+IFDlength) {
   			php_error(E_WARNING, "%s(): Illegal directory offset", get_active_function_name(TSRMLS_C));
   			return FALSE;
   		}
  @@ -2537,7 +3037,7 @@
   #ifdef EXIF_DEBUG
   		php_error(E_NOTICE, "%s(): expect next IFD to be thumbnail", get_active_function_name(TSRMLS_C));
   #endif
  -		if (exif_process_IFD_in_JPEG(ImageInfo, OffsetBase + NextDirOffset, OffsetBase, IFDlength, SECTION_THUMBNAIL TSRMLS_CC)) {
  +		if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL TSRMLS_CC)) {
   #ifdef EXIF_DEBUG
   			php_error(E_NOTICE, "%s(): thumbnail size: 0x%04X", get_active_function_name(TSRMLS_C), ImageInfo->Thumbnail.size);
   #endif
  @@ -2546,7 +3046,7 @@
   			&&  ImageInfo->Thumbnail.offset
   			&&  ImageInfo->read_thumbnail
   			) {
  -				exif_thumbnail_extract(ImageInfo, OffsetBase, IFDlength TSRMLS_CC);
  +				exif_thumbnail_extract(ImageInfo, offset_base, IFDlength TSRMLS_CC);
   			}
   			return TRUE;
   		} else {
  @@ -2560,7 +3060,7 @@
   /* {{{ exif_process_TIFF_in_JPEG
      Process a TIFF header in a JPEG file
   */
  -static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, unsigned int length TSRMLS_DC)
  +static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC)
   {
   	/* set the thumbnail stuff to nothing so we can test to see if they get set up */
   	if (memcmp(CharBuf, "II", 2) == 0) {
  @@ -2582,10 +3082,10 @@
   
   	ImageInfo->sections_found |= FOUND_IFD0;
   	/* First directory starts at offset 8. Offsets starts at 0. */
  -	exif_process_IFD_in_JPEG(ImageInfo, CharBuf+8, CharBuf, length/*-14*/, SECTION_IFD0 TSRMLS_CC);
  +	exif_process_IFD_in_JPEG(ImageInfo, CharBuf+8, CharBuf, length/*-14*/, displacement, SECTION_IFD0 TSRMLS_CC);
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "%s(): done");
  +	php_error(E_NOTICE, "%s(): process TIFF in JPEG done", get_active_function_name(TSRMLS_C));
   #endif
   
   	/* Compute the CCD width, in milimeters. */
  @@ -2599,7 +3099,7 @@
      Process an JPEG APP1 block marker
      Describes all the drivel that most digital cameras include...
   */
  -static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, unsigned int length TSRMLS_DC)
  +static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC)
   {
   	/* Check the APP1 for Exif Identifier Code */
   	static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
  @@ -2607,9 +3107,9 @@
   		php_error(E_WARNING, "%s(): Incorrect APP1 Exif Identifier Code", get_active_function_name(TSRMLS_C));
   		return;
   	}
  -	exif_process_TIFF_in_JPEG(ImageInfo, CharBuf + 8, length - 8 TSRMLS_CC);
  +	exif_process_TIFF_in_JPEG(ImageInfo, CharBuf + 8, length - 8, displacement+8 TSRMLS_CC);
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "%s(): done", get_active_function_name(TSRMLS_C));
  +	php_error(E_NOTICE, "%s(): process APP1/EXIF done", get_active_function_name(TSRMLS_C));
   #endif
   }
   /* }}} */
  @@ -2677,9 +3177,8 @@
   		if (last_marker==M_COM && comment_correction)
   			return M_EOI; /* ah illegal: char after COM section not 0xFF */
   
  -#ifdef EXIF_DEBUG
   		fpos = php_stream_tell(ImageInfo->infile);
  -#endif
  +
   		if (marker == 0xff) {
   			/* 0xff is legal padding, but if we get that many, something's wrong. */
   			php_error(E_WARNING, "%s(): Too many padding bytes!", get_active_function_name(TSRMLS_C));
  @@ -2749,7 +3248,7 @@
   					/*ImageInfo->sections_found |= FOUND_EXIF;*/
   					/* Seen files from some 'U-lead' software with Vivitar scanner
   					   that uses marker 31 later in the file (no clue what for!) */
  -					exif_process_APP1(ImageInfo, (char *)Data, itemlen TSRMLS_CC);
  +					exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos TSRMLS_CC);
   				}
   				break;
   
  @@ -2885,8 +3384,10 @@
   {
   	int i, sn, num_entries, sub_section_index = 0;
   	unsigned char *dir_entry;
  +	char tagname[64];
   	size_t ifd_size, dir_size, entry_offset, next_offset, entry_length, entry_value=0, fgot;
   	int entry_tag , entry_type;
  +	tag_table_type tag_table = exif_get_tag_table(section_index);
   
   	if (ImageInfo->FileSize >= dir_offset+2) {
   		if ((sn=exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL))==-1) {
  @@ -2908,7 +3409,7 @@
   				return FALSE;
   			}
   			php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data+2, dir_size-2);
  -			/*php_error(E_NOTICE, "Dump: %s", exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 1));*/
  +			/*php_error(E_NOTICE, "%s(): Dump: %s", get_active_function_name(TSRMLS_C), exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 1));*/
   			next_offset = php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, ImageInfo->motorola_intel);
   #ifdef EXIF_DEBUG
   			php_error(E_NOTICE, "%s(): Read from TIFF done, next offset x%04X", get_active_function_name(TSRMLS_C), next_offset);
  @@ -2920,8 +3421,13 @@
   				entry_tag    = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel);
   				entry_type   = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
   				if (entry_type > NUM_FORMATS) {
  -					php_error(E_WARNING, "%s(): Error in TIFF: Illegal format, suppose bytes", get_active_function_name(TSRMLS_C));
  +					php_error(E_NOTICE, "%s(): Read from TIFF: tag(0x%04X,%12s): Illegal format code 0x%04X, switching to BYTE", get_active_function_name(TSRMLS_C), entry_tag, exif_get_tagname(entry_tag, tagname, -12, tag_table TSRMLS_CC), entry_type);
  +					/* Since this is repeated in exif_process_IFD_TAG make it a notice here */
  +					/* and make it a warning in the exif_process_IFD_TAG which is called    */
  +					/* elsewhere. */
   					entry_type = TAG_FMT_BYTE;
  +					/*The next line would break the image on writeback: */
  +					/* php_ifd_set16u(dir_entry+2, entry_type, ImageInfo->motorola_intel);*/
   				}
   				entry_length = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel) * php_tiff_bytes_per_format[entry_type];
   				if (entry_length <= 4) {
  @@ -2941,11 +3447,11 @@
   					}
   					switch(entry_tag) {
   						case TAG_IMAGEWIDTH:
  -						case TAG_COMP_IMAGEWIDTH:
  +						case TAG_COMP_IMAGE_WIDTH:
   							ImageInfo->Width  = entry_value;
   							break;
   						case TAG_IMAGEHEIGHT:
  -						case TAG_COMP_IMAGEHEIGHT:
  +						case TAG_COMP_IMAGE_HEIGHT:
   							ImageInfo->Height = entry_value;
   							break;
   						case TAG_PHOTOMETRIC_INTERPRETATION:
  @@ -2973,7 +3479,7 @@
   					  && entry_offset == dir_offset + ifd_size) {
   						ifd_size = entry_offset + entry_length - dir_offset;
   #ifdef EXIF_DEBUG
  -						php_error(E_NOTICE, "%s(): Correcting: 0x%08X + 0x%08X - 0x%08X", get_active_function_name(TSRMLS_C), entry_offset, entry_length, dir_offset);
  +						php_error(E_NOTICE, "%s(): Resize struct: x%04X + x%04X - x%04X = x%04X", get_active_function_name(TSRMLS_C), entry_offset, entry_length, dir_offset, ifd_size);
   #endif
   					}
   				}
  @@ -3004,7 +3510,8 @@
   					/*entry_length = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);*/
   					if (entry_tag == TAG_EXIF_IFD_POINTER ||
   						entry_tag == TAG_INTEROP_IFD_POINTER ||
  -						entry_tag == TAG_GPS_IFD_POINTER
  +						entry_tag == TAG_GPS_IFD_POINTER ||
  +						entry_tag == TAG_SUB_IFD
   					) {
   						switch(entry_tag) {
   							case TAG_EXIF_IFD_POINTER:
  @@ -3019,32 +3526,59 @@
   								ImageInfo->sections_found |= FOUND_INTEROP;
   								sub_section_index = SECTION_INTEROP;
   								break;
  +							case TAG_SUB_IFD:
  +								ImageInfo->sections_found |= FOUND_THUMBNAIL;
  +								sub_section_index = SECTION_THUMBNAIL;
  +								break;
   						}
   						entry_offset = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
   #ifdef EXIF_DEBUG
  -						php_error(E_NOTICE, "Next IFD %s at x%04X", exif_get_sectionname(sub_section_index), entry_offset);
  +						php_error(E_NOTICE, "%s(): Next IFD: %s @x%04X", get_active_function_name(TSRMLS_C), exif_get_sectionname(sub_section_index), entry_offset);
   #endif
   						exif_process_IFD_in_TIFF(ImageInfo, entry_offset, sub_section_index TSRMLS_CC);
  +						if (section_index!=SECTION_THUMBNAIL && entry_tag==TAG_SUB_IFD) {
  +							if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN
  +							&&  ImageInfo->Thumbnail.size
  +							&&  ImageInfo->Thumbnail.offset
  +							&&  ImageInfo->read_thumbnail
  +							) {
  +#ifdef EXIF_DEBUG
  +								php_error(E_NOTICE, "%s(): Read THUMBNAIL @0x%04X + 0x%04X", get_active_function_name(TSRMLS_C), ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
  +#endif
  +								ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
  +								if (!ImageInfo->Thumbnail.data) {
  +									EXIF_ERRLOG_EALLOC
  +								} else {
  +									php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
  +									fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
  +									if (fgot < ImageInfo->Thumbnail.size) {
  +										EXIF_ERRLOG_THUMBEOF
  +									}
  +									exif_thumbnail_build(ImageInfo TSRMLS_CC);
  +								}
  +							}
  +						}
   #ifdef EXIF_DEBUG
  -						php_error(E_NOTICE, "Next IFD %s done", exif_get_sectionname(sub_section_index));
  +						php_error(E_NOTICE, "%s(): Next IFD: %s done", get_active_function_name(TSRMLS_C), exif_get_sectionname(sub_section_index));
   #endif
   					} else {
   						if (!exif_process_IFD_TAG(ImageInfo, dir_entry,
   												  ImageInfo->file.list[sn].data-dir_offset,
  -												  ifd_size, section_index, 0 TSRMLS_CC)) {
  +												  ifd_size, 0, section_index, 0, tag_table TSRMLS_CC)) {
   							return FALSE;
   						}
   					}
   				}
  +				/* If we had a thumbnail in a SUB_IFD we have ANOTHER image in NEXT IFD */
   				if (next_offset && section_index != SECTION_THUMBNAIL) {
   					/* this should be a thumbnail IFD */
   					/* the thumbnail itself is stored at Tag=StripOffsets */
   #ifdef EXIF_DEBUG
  -					php_error(E_NOTICE, "Read next IFD (THUMBNAIL) at x%04X", next_offset);
  +					php_error(E_NOTICE, "%s(): Read next IFD (THUMBNAIL) at x%04X", get_active_function_name(TSRMLS_C), next_offset);
   #endif
   					exif_process_IFD_in_TIFF(ImageInfo, next_offset, SECTION_THUMBNAIL TSRMLS_CC);
   #ifdef EXIF_DEBUG
  -					php_error(E_NOTICE, "Read THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
  +					php_error(E_NOTICE, "%s(): Read THUMBNAIL @0x%04X + 0x%04X", get_active_function_name(TSRMLS_C), ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
   #endif
   					if (ImageInfo->Thumbnail.offset && ImageInfo->Thumbnail.size && ImageInfo->read_thumbnail) {
   						ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
  @@ -3060,20 +3594,20 @@
   						}
   					}
   #ifdef EXIF_DEBUG
  -					php_error(E_NOTICE, "Read next IFD (THUMBNAIL) done");
  +					php_error(E_NOTICE, "%s(): Read next IFD (THUMBNAIL) done", get_active_function_name(TSRMLS_C));
   #endif
   				}
   				return TRUE;
   			} else {
  -				php_error(E_WARNING, "2 Error in TIFF: filesize(x%04X) less than size of IFD(x%04X)", ImageInfo->FileSize, dir_offset+ImageInfo->file.list[sn].size);
  +				php_error(E_WARNING, "%s(): Error in TIFF: filesize(x%04X) less than size of IFD(x%04X)", get_active_function_name(TSRMLS_C), ImageInfo->FileSize, dir_offset+ImageInfo->file.list[sn].size);
   				return FALSE;
   			}
   		} else {
  -			php_error(E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD dir(x%04X)", ImageInfo->FileSize, dir_offset+dir_size);
  +			php_error(E_WARNING, "%s(): Error in TIFF: filesize(x%04X) less than size of IFD dir(x%04X)", get_active_function_name(TSRMLS_C), ImageInfo->FileSize, dir_offset+dir_size);
   			return FALSE;
   		}
   	} else {
  -		php_error(E_WARNING, "Error in TIFF: filesize(x%04X) less than start of IFD dir(x%04X)", ImageInfo->FileSize, dir_offset+2);
  +		php_error(E_WARNING, "%s(): Error in TIFF: filesize(x%04X) less than start of IFD dir(x%04X)", get_active_function_name(TSRMLS_C), ImageInfo->FileSize, dir_offset+2);
   		return FALSE;
   	}
   }
  @@ -3096,7 +3630,7 @@
   			if (exif_scan_JPEG_header(ImageInfo TSRMLS_CC)) {
   				ret = TRUE;
   			} else {
  -				php_error(E_WARNING, "Invalid JPEG file: '%s'", ImageInfo->FileName);
  +				php_error(E_WARNING, "%s(): Invalid JPEG file: '%s'", get_active_function_name(TSRMLS_C), ImageInfo->FileName);
   			}
   		} else if (ImageInfo->FileSize >= 8) {
   			php_stream_read(ImageInfo->infile, file_header+2, 6);
  @@ -3104,7 +3638,7 @@
   				ImageInfo->FileType = IMAGE_FILETYPE_TIFF_II;
   				ImageInfo->motorola_intel = 0;
   #ifdef EXIF_DEBUG
  -				php_error(E_NOTICE, "File(%s) has TIFF/II format", ImageInfo->FileName);
  +				php_error(E_NOTICE, "%s(): File(%s) has TIFF/II format", get_active_function_name(TSRMLS_C), ImageInfo->FileName);
   #endif
   				ImageInfo->sections_found |= FOUND_IFD0;
   				if (exif_process_IFD_in_TIFF(ImageInfo, 
  @@ -3112,7 +3646,7 @@
   											 SECTION_IFD0 TSRMLS_CC)) {
   					ret = TRUE;
   				} else {
  -					php_error(E_WARNING, "Invalid TIFF file: '%s'", ImageInfo->FileName);
  +					php_error(E_WARNING, "%s(): Invalid TIFF file: '%s'", get_active_function_name(TSRMLS_C), ImageInfo->FileName);
   				}
   			}
   			else
  @@ -3120,7 +3654,7 @@
   				ImageInfo->FileType = IMAGE_FILETYPE_TIFF_MM;
   				ImageInfo->motorola_intel = 1;
   #ifdef EXIF_DEBUG
  -				php_error(E_NOTICE, "File(%s) has TIFF/MM format", ImageInfo->FileName);
  +				php_error(E_NOTICE, "%s(): File(%s) has TIFF/MM format", get_active_function_name(TSRMLS_C), ImageInfo->FileName);
   #endif
   				ImageInfo->sections_found |= FOUND_IFD0;
   				if (exif_process_IFD_in_TIFF(ImageInfo,
  @@ -3128,15 +3662,15 @@
   											 SECTION_IFD0 TSRMLS_CC)) {
   					ret = TRUE;
   				} else {
  -					php_error(E_WARNING, "Invalid TIFF file: '%s'", ImageInfo->FileName);
  +					php_error(E_WARNING, "%s(): Invalid TIFF file: '%s'", get_active_function_name(TSRMLS_C), ImageInfo->FileName);
   				}
   			} else {
  -				php_error(E_WARNING, "File(%s) not supported", ImageInfo->FileName);
  +				php_error(E_WARNING, "%s(): File(%s) not supported", get_active_function_name(TSRMLS_C), ImageInfo->FileName);
   				return FALSE;
   			}
   		}
   	} else {
  -		php_error(E_WARNING, "File(%s) to small (%d)", ImageInfo->FileName, ImageInfo->FileSize);
  +		php_error(E_WARNING, "%s(): File(%s) to small (%d)", get_active_function_name(TSRMLS_C), ImageInfo->FileName, ImageInfo->FileSize);
   	}
   	return ret;
   }
  @@ -3162,6 +3696,8 @@
   	EFREE_IF(ImageInfo->encode_jis);
   	EFREE_IF(ImageInfo->decode_jis_be);
   	EFREE_IF(ImageInfo->decode_jis_le);
  +	EFREE_IF(ImageInfo->make);
  +	EFREE_IF(ImageInfo->model);
   	for (i=0; i<ImageInfo->xp_fields.count; i++) {
   		EFREE_IF(ImageInfo->xp_fields.list[i].value);
   	}
  @@ -3189,7 +3725,7 @@
   
   	ImageInfo->infile = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL);
   	if (!ImageInfo->infile) {
  -		php_error(E_WARNING, "Unable to open '%s'", FileName);
  +		php_error(E_WARNING, "%s(): Unable to open '%s'", get_active_function_name(TSRMLS_C), FileName);
   		return FALSE;
   	}
   
  @@ -3210,7 +3746,7 @@
   			/* Store file date/time. */
   			ImageInfo->FileDateTime = st.st_mtime;
   			ImageInfo->FileSize = st.st_size;
  -			/*php_error(E_NOTICE, "open stream is file: %d", ImageInfo->FileSize);*/
  +			/*php_error(E_NOTICE, "%s(): Open stream is file: %d", get_active_function_name(TSRMLS_C), ImageInfo->FileSize);*/
   		}
   	} else {
   		if (!ImageInfo->FileSize) {
  @@ -3273,7 +3809,7 @@
   		if (!sections_str) {
   			RETURN_FALSE;
   		}
  -		php_error(E_NOTICE, "Sections needed: %s", sections_str[0] ? sections_str : "None");
  +		php_error(E_NOTICE, "%s(): Sections needed: %s", get_active_function_name(TSRMLS_C), sections_str[0] ? sections_str : "None");
   		EFREE_IF(sections_str);
   #endif
   	}
  @@ -3298,7 +3834,7 @@
   
   #ifdef EXIF_DEBUG
   	if (sections_str) 
  -		php_error(E_NOTICE, "sections found: %s", sections_str[0] ? sections_str : "None");
  +		php_error(E_NOTICE, "%s(): sections found: %s", get_active_function_name(TSRMLS_C), sections_str[0] ? sections_str : "None");
   #endif
   
   	ImageInfo.sections_found |= FOUND_COMPUTED;/* do not inform about in debug*/
  @@ -3311,7 +3847,7 @@
   	}
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "generate section FILE");
  +	php_error(E_NOTICE, "%s(): Generate section FILE", get_active_function_name(TSRMLS_C));
   #endif
   
   	/* now we can add our information */
  @@ -3323,7 +3859,7 @@
   	exif_iif_add_str(&ImageInfo, SECTION_FILE, "SectionsFound", sections_str ? sections_str : "NONE" TSRMLS_CC);
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "generate section COMPUTED");
  +	php_error(E_NOTICE, "%s(): Generate section COMPUTED", get_active_function_name(TSRMLS_C));
   #endif
   
   	if (ImageInfo.Width>0 &&  ImageInfo.Height>0) {
  @@ -3373,7 +3909,7 @@
   	exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Editor",       ImageInfo.CopyrightEditor TSRMLS_CC);
   
   	for (i=0; i<ImageInfo.xp_fields.count; i++) {
  -		exif_iif_add_str(&ImageInfo, SECTION_WINXP, exif_get_tagname(ImageInfo.xp_fields.list[i].tag, NULL, 0), ImageInfo.xp_fields.list[i].value TSRMLS_CC);
  +		exif_iif_add_str(&ImageInfo, SECTION_WINXP, exif_get_tagname(ImageInfo.xp_fields.list[i].tag, NULL, 0, exif_get_tag_table(SECTION_WINXP) TSRMLS_CC), ImageInfo.xp_fields.list[i].value TSRMLS_CC);
   	}
   	if (ImageInfo.Thumbnail.size) {
   		if (read_thumbnail) {
  @@ -3394,30 +3930,31 @@
      	EFREE_IF(sections_str);
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "adding image infos");
  +	php_error(E_NOTICE, "%s(): Adding image infos", get_active_function_name(TSRMLS_C));
   #endif
   
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FILE);
  -	add_assoc_image_info(return_value, 1,          &ImageInfo, SECTION_COMPUTED);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_ANY_TAG);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_IFD0);
  -	add_assoc_image_info(return_value, 1,          &ImageInfo, SECTION_THUMBNAIL);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_COMMENT);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_EXIF);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_GPS);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_INTEROP);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FPIX);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_APP12);
  -	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_WINXP);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FILE       TSRMLS_CC);
  +	add_assoc_image_info(return_value, 1,          &ImageInfo, SECTION_COMPUTED   TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_ANY_TAG    TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_IFD0       TSRMLS_CC);
  +	add_assoc_image_info(return_value, 1,          &ImageInfo, SECTION_THUMBNAIL  TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_COMMENT    TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_EXIF       TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_GPS        TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_INTEROP    TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FPIX       TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_APP12      TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_WINXP      TSRMLS_CC);
  +	add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_MARKERNOTE TSRMLS_CC);
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "Discarding info");
  +	php_error(E_NOTICE, "%s(): Discarding info", get_active_function_name(TSRMLS_C));
   #endif
   
   	exif_discard_imageinfo(&ImageInfo);
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "read_exif_data done");
  +	php_error(E_NOTICE, "%s(): exif_read_data done", get_active_function_name(TSRMLS_C));
   #endif
   }
   /* }}} */
  @@ -3452,7 +3989,7 @@
   	}
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "Thumbnail data %d %d %d, %d x %d", ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.filetype, ImageInfo.Thumbnail.width, ImageInfo.Thumbnail.height);
  +	php_error(E_NOTICE, "%s(): Thumbnail data %d %d %d, %d x %d", get_active_function_name(TSRMLS_C), ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.filetype, ImageInfo.Thumbnail.width, ImageInfo.Thumbnail.height);
   #endif
   	if (!ImageInfo.Thumbnail.data || !ImageInfo.Thumbnail.size) {
   		exif_discard_imageinfo(&ImageInfo);
  @@ -3460,7 +3997,7 @@
   	}
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "Returning thumbnail(%d)", ImageInfo.Thumbnail.size);
  +	php_error(E_NOTICE, "%s(): Returning thumbnail(%d)", get_active_function_name(TSRMLS_C), ImageInfo.Thumbnail.size);
   #endif
   
   	ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, 1);
  @@ -3476,13 +4013,13 @@
   	}
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "Discarding info");
  +	php_error(E_NOTICE, "%s(): Discarding info", get_active_function_name(TSRMLS_C));
   #endif
   
   	exif_discard_imageinfo(&ImageInfo);
   
   #ifdef EXIF_DEBUG
  -	php_error(E_NOTICE, "exif_thumbnail done");
  +	php_error(E_NOTICE, "%s(): exif_thumbnail done", get_active_function_name(TSRMLS_C));
   #endif
   }
   /* }}} */
  @@ -3529,4 +4066,3 @@
    * vim600: sw=4 ts=4 tw=78 fdm=marker
    * vim<600: sw=4 ts=4 tw=78
    */
  -
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +1 -0      php4/ext/ftp/CREDITS
  
  Index: CREDITS
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ftp/CREDITS,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- CREDITS	29 Apr 2002 02:30:45 -0000	1.2
  +++ CREDITS	3 Aug 2002 00:44:12 -0000	1.2.2.1
  @@ -1,2 +1,3 @@
   FTP
   Andrew Skalski
  +Stefan Esser
  \ No newline at end of file
  
  
  
  1.2.2.1   +336 -13   php4/ext/ftp/ftp.c
  
  Index: ftp.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ftp/ftp.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ftp.c	29 Apr 2002 02:30:45 -0000	1.2
  +++ ftp.c	3 Aug 2002 00:44:12 -0000	1.2.2.1
  @@ -12,11 +12,12 @@
      | obtain it through the world-wide-web, please send a note to          |
      | licen****@php***** so we can mail you a copy immediately.               |
      +----------------------------------------------------------------------+
  -   | Author: Andrew Skalski <askal****@chek*****>                           |
  +   | Authors: Andrew Skalski <askal****@chek*****>                          |
  +   |          Stefan Esser <sesse****@php*****> (resume functions)            |
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: ftp.c,v 1.49 2002/03/18 22:26:32 vlad Exp $ */
  +/* $Id: ftp.c,v 1.56 2002/07/27 09:18:51 sesser Exp $ */
   
   #include "php.h"
   
  @@ -105,6 +106,7 @@
   {
   	ftpbuf_t		*ftp;
   	int			size;
  +	struct timeval tv;
   
   
   	/* alloc the ftp structure */
  @@ -114,13 +116,17 @@
   		return NULL;
   	}
   
  -	ftp->fd = php_hostconnect(host, (unsigned short) (port ? port : 21), SOCK_STREAM, (int) timeout_sec);
  +	tv.tv_sec = timeout_sec;
  +	tv.tv_usec = 0;
  +
  +	ftp->fd = php_hostconnect(host, (unsigned short) (port ? port : 21), SOCK_STREAM, &tv);
   	if (ftp->fd == -1) {
   		goto bail;
   	}
   
   	/* Default Settings */
   	ftp->timeout_sec = timeout_sec;
  +	ftp->async = 0;
   
   	size = sizeof(ftp->localaddr);
   	memset(&ftp->localaddr, 0, size);
  @@ -152,6 +158,8 @@
   		return NULL;
   	if (ftp->fd != -1)
   		closesocket(ftp->fd);
  +	if (ftp->data) 
  +		data_close(ftp->data);
   	ftp_gc(ftp);
   	free(ftp);
   	return NULL;
  @@ -227,6 +235,8 @@
   
   	ftp_gc(ftp);
   
  +	ftp->async = 0;
  +
   	if (!ftp_putcmd(ftp, "REIN", NULL))
   		return 0;
   	if (!ftp_getresp(ftp) || ftp->resp != 220)
  @@ -412,9 +422,9 @@
   /* {{{ ftp_list
    */
   char**
  -ftp_list(ftpbuf_t *ftp, const char *path)
  +ftp_list(ftpbuf_t *ftp, const char *path, int recursive)
   {
  -	return ftp_genlist(ftp, "LIST", path);
  +	return ftp_genlist(ftp, ((recursive) ? "LIST -R" : "LIST"), path);
   }
   /* }}} */
   
  @@ -428,7 +438,7 @@
   	if (ftp == NULL)
   		return 0;
   
  -	if (type == Z_TYPE_P(ftp))
  +	if (type == ftp->type)
   		return 1;
   
   	if (type == FTPTYPE_ASCII)
  @@ -443,7 +453,7 @@
   	if (!ftp_getresp(ftp) || ftp->resp != 200)
   		return 0;
   
  -	Z_TYPE_P(ftp) = type;
  +	ftp->type = type;
   
   	return 1;
   }
  @@ -541,12 +551,13 @@
   /* {{{ ftp_get
    */
   int
  -ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type)
  +ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos)
   {
   	databuf_t		*data = NULL;
   	char			*ptr;
   	int			lastch;
   	int			rcvd;
  +	char			arg[11];
   	TSRMLS_FETCH();
   
   	if (ftp == NULL)
  @@ -560,6 +571,16 @@
   		goto bail;
   	}
   
  +	if (resumepos>0) {
  +		sprintf(arg, "%u", resumepos);
  +		if (!ftp_putcmd(ftp, "REST", arg)) {
  +			goto bail;
  +		}
  +		if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
  +			goto bail;
  +		}
  +	}
  +
   	if (!ftp_putcmd(ftp, "RETR", path)) {
   		goto bail;
   	}
  @@ -614,12 +635,13 @@
   /* {{{ ftp_put
    */
   int
  -ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type)
  +ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos)
   {
   	databuf_t		*data = NULL;
   	int			size;
   	char			*ptr;
   	int			ch;
  +	char			arg[11];
   	TSRMLS_FETCH();
   
   	if (ftp == NULL)
  @@ -631,6 +653,16 @@
   	if ((data = ftp_getdata(ftp)) == NULL)
   		goto bail;
   
  +	if (startpos>0) {
  +		sprintf(arg, "%u", startpos);
  +		if (!ftp_putcmd(ftp, "REST", arg)) {
  +			goto bail;
  +		}
  +		if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
  +			goto bail;
  +		}
  +	}
  +
   	if (!ftp_putcmd(ftp, "STOR", path))
   		goto bail;
   	if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125))
  @@ -898,9 +930,9 @@
   		}
   
   		/* Break out when the end-tag is found */
  -		if (isdigit(ftp->inbuf[0]) && 
  -			isdigit(ftp->inbuf[1]) && 
  -			isdigit(ftp->inbuf[2]) && 
  +		if (isdigit(ftp->inbuf[0]) &&
  +			isdigit(ftp->inbuf[1]) &&
  +			isdigit(ftp->inbuf[2]) &&
   			ftp->inbuf[3] == ' ') {
   			break;
   		}
  @@ -920,6 +952,9 @@
   
   	memmove(ftp->inbuf, ftp->inbuf + 4, FTP_BUFSIZE - 4);
   
  +	if (ftp->extra)
  +		ftp->extra -= 4;
  +
   	return 1;
   }
   /* }}} */
  @@ -988,6 +1023,59 @@
   }
   /* }}} */
   
  +/* {{{ data_available
  + */
  +int
  +data_available(ftpbuf_t *ftp, int s)
  +{
  +	fd_set		read_set;
  +	struct timeval	tv;
  +	int		n;
  +
  +	tv.tv_sec = 0;
  +	tv.tv_usec = 1;
  +
  +	FD_ZERO(&read_set);
  +	FD_SET(s, &read_set);
  +	n = select(s + 1, &read_set, NULL, NULL, &tv);
  +	if (n < 1) {
  +#ifndef PHP_WIN32
  +		if (n == 0)
  +			errno = ETIMEDOUT;
  +#endif
  +		return 0;
  +	}
  +
  +	return 1;
  +}
  +/* }}} */
  +/* {{{ data_writeable
  + */
  +int
  +data_writeable(ftpbuf_t *ftp, int s)
  +{
  +	fd_set		write_set;
  +	struct timeval	tv;
  +	int		n;
  +
  +	tv.tv_sec = 0;
  +	tv.tv_usec = 1;
  +
  +	FD_ZERO(&write_set);
  +	FD_SET(s, &write_set);
  +	n = select(s + 1, NULL, &write_set, NULL, &tv);
  +	if (n < 1) {
  +#ifndef PHP_WIN32
  +		if (n == 0)
  +			errno = ETIMEDOUT;
  +#endif
  +		return 0;
  +	}
  +
  +	return 1;
  +}
  +/* }}} */
  +
   /* {{{ my_accept
    */
   int
  @@ -1042,7 +1130,7 @@
   	}
   	data->listener = -1;
   	data->fd = -1;
  -	Z_TYPE_P(data) = Z_TYPE_P(ftp);
  +	data->type = ftp->type;
   
   	sa = (struct sockaddr *) &ftp->localaddr;
   	/* bind/listen */
  @@ -1278,6 +1366,241 @@
   	return NULL;
   }
   /* }}} */
  +
  +/* {{{ ftp_async_get
  + */
  +int
  +ftp_async_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos)
  +{
  +	databuf_t		*data = NULL;
  +	char			*ptr;
  +	int			lastch;
  +	int			rcvd;
  +	char			arg[11];
  +	TSRMLS_FETCH();
  +
  +	if (ftp == NULL)
  +		goto bail;
  +
  +	if (!ftp_type(ftp, type)) {
  +		goto bail;
  +	}
  +
  +	if ((data = ftp_getdata(ftp)) == NULL) {
  +		goto bail;
  +	}
  +
  +	if (resumepos>0) {
  +		sprintf(arg, "%u", resumepos);
  +		if (!ftp_putcmd(ftp, "REST", arg)) {
  +			goto bail;
  +		}
  +		if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
  +			goto bail;
  +		}
  +	}
  +
  +	if (!ftp_putcmd(ftp, "RETR", path)) {
  +		goto bail;
  +	}
  +	if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
  +		goto bail;
  +	}
  +
  +	if ((data = data_accept(data, ftp)) == NULL) {
  +		goto bail;
  +	}
  +
  +	ftp->data = data;
  +	ftp->stream = outstream;
  +	ftp->lastch = 0;
  +	ftp->async = 1;
  +
  +	return (ftp_async_continue_read(ftp));
  +
  +bail:
  +	data_close(data);
  +	return PHP_FTP_FAILED;
  +}
  +/* }}} */
  +
  +/* {{{ ftp_aget
  + */
  +int
  +ftp_async_continue_read(ftpbuf_t *ftp)
  +{
  +	databuf_t	*data = NULL;
  +	char		*ptr;
  +	int			lastch;
  +	int			rcvd;
  +	ftptype_t	type;
  +	TSRMLS_FETCH();
  +
  +	data = ftp->data;
  +
  +	/* check if there is already more data */
  +	if (!data_available(ftp, data->fd)) {
  +		return PHP_FTP_MOREDATA;
  +	}
  +
  +	type = ftp->type;
  +
  +	lastch = ftp->lastch;
  +	if (rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE)) {
  +		if (rcvd == -1) {
  +			goto bail;
  +		}
  +
  +		if (type == FTPTYPE_ASCII) {
  +			for (ptr = data->buf; rcvd; rcvd--, ptr++) {
  +				if (lastch == '\r' && *ptr != '\n')
  +					php_stream_putc(ftp->stream, '\r');
  +				if (*ptr != '\r')
  +					php_stream_putc(ftp->stream, *ptr);
  +				lastch = *ptr;
  +			}
  +		}
  +		else {
  +			php_stream_write(ftp->stream, data->buf, rcvd);
  +		}
  +
  +		ftp->lastch = lastch;
  +		return PHP_FTP_MOREDATA;
  +	}
  +
  +	if (type == FTPTYPE_ASCII && lastch == '\r')
  +		php_stream_putc(ftp->stream, '\r');
  +
  +	data = data_close(data);
  +
  +	if (php_stream_error(ftp->stream)) {
  +		goto bail;
  +	}
  +
  +	if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
  +		goto bail;
  +	}
  +
  +	ftp->async = 0;
  +	return PHP_FTP_FINISHED;
  +bail:
  +	ftp->async = 0;
  +	data_close(data);
  +	return PHP_FTP_FAILED;
  +}
  +/* }}} */
  +
  +/* {{{ ftp_async_put
  + */
  +int
  +ftp_async_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos)
  +{
  +	databuf_t		*data = NULL;
  +	int			size;
  +	char			*ptr;
  +	int			ch;
  +	char			arg[11];
  +	TSRMLS_FETCH();
  +
  +	if (ftp == NULL)
  +		return 0;
  +
  +	if (!ftp_type(ftp, type))
  +		goto bail;
  +
  +	if ((data = ftp_getdata(ftp)) == NULL)
  +		goto bail;
  +
  +	if (startpos>0) {
  +		sprintf(arg, "%u", startpos);
  +		if (!ftp_putcmd(ftp, "REST", arg)) {
  +			goto bail;
  +		}
  +		if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
  +			goto bail;
  +		}
  +	}
  +
  +	if (!ftp_putcmd(ftp, "STOR", path))
  +		goto bail;
  +	if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125))
  +		goto bail;
  +
  +	if ((data = data_accept(data, ftp)) == NULL)
  +		goto bail;
  +
  +	ftp->data = data;
  +	ftp->stream = instream;
  +	ftp->lastch = 0;
  +	ftp->async = 1;
  +
  +	return (ftp_async_continue_write(ftp));
  +
  +bail:
  +	data_close(data);
  +	return PHP_FTP_FAILED;
  +
  +}
  +/* }}} */
  +
  +
  +/* {{{ ftp_async_continue_write
  + */
  +int
  +ftp_async_continue_write(ftpbuf_t *ftp)
  +{
  +	int			size;
  +	char			*ptr;
  +	int 			ch;
  +	TSRMLS_FETCH();
  +
  +
  +	/* check if we can write more data */
  +	if (!data_writeable(ftp, ftp->data->fd)) {
  +		return PHP_FTP_MOREDATA;
  +	}
  +
  +	size = 0;
  +	ptr = ftp->data->buf;
  +	while ((ch = php_stream_getc(ftp->stream))!=EOF && !php_stream_eof(ftp->stream)) {
  +
  +		if (ch == '\n' && ftp->type == FTPTYPE_ASCII) {
  +			*ptr++ = '\r';
  +			size++;
  +		}
  +
  +		*ptr++ = ch;
  +		size++;
  +
  +		/* flush if necessary */
  +		if (FTP_BUFSIZE - size < 2) {
  +			if (my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size)
  +				goto bail;
  +			return PHP_FTP_MOREDATA;
  +		}
  +
  +	}
  +
  +	if (size && my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size)
  +		goto bail;
  +
  +	if (php_stream_error(ftp->stream))
  +		goto bail;
  +
  +	ftp->data = data_close(ftp->data);
  +
  +	if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250))
  +		goto bail;
  +
  +	ftp->async = 0;
  +	return PHP_FTP_FINISHED;
  +bail:
  +	data_close(ftp->data);
  +	ftp->async = 0;
  +	return PHP_FTP_FAILED;
  +}
  +/* }}} */
  +
   
   #endif /* HAVE_FTP */
   
  
  
  
  1.2.2.1   +45 -11    php4/ext/ftp/ftp.h
  
  Index: ftp.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ftp/ftp.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ftp.h	29 Apr 2002 02:30:45 -0000	1.2
  +++ ftp.h	3 Aug 2002 00:44:12 -0000	1.2.2.1
  @@ -13,10 +13,11 @@
      | licen****@php***** so we can mail you a copy immediately.               |
      +----------------------------------------------------------------------+
      | Authors: Andrew Skalski <askal****@chek*****>                          |
  +   |          Stefan Esser <sesse****@php*****> (resume functions)            |
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: ftp.h,v 1.23 2002/03/16 01:20:57 wez Exp $ */
  +/* $Id: ftp.h,v 1.26 2002/07/26 22:00:25 sesser Exp $ */
   
   #ifndef	FTP_H
   #define	FTP_H
  @@ -29,6 +30,10 @@
   #endif
   
   #define	FTP_DEFAULT_TIMEOUT	90
  +#define FTP_DEFAULT_AUTOSEEK 1
  +#define PHP_FTP_FAILED			0
  +#define PHP_FTP_FINISHED		1
  +#define PHP_FTP_MOREDATA		2
   
   /* XXX this should be configurable at runtime XXX */
   #define	FTP_BUFSIZE	4096
  @@ -38,6 +43,14 @@
   	FTPTYPE_IMAGE
   } ftptype_t;
   
  +typedef struct databuf
  +{
  +	int		listener;		/* listener socket */
  +	int		fd;			/* data connection */
  +	ftptype_t	type;			/* transfer type */
  +	char		buf[FTP_BUFSIZE];	/* data buffer */
  +} databuf_t;
  +
   typedef struct ftpbuf
   {
   	int		fd;			/* control connection */
  @@ -53,15 +66,16 @@
   	int		pasv;			/* 0=off; 1=pasv; 2=ready */
   	php_sockaddr_storage	pasvaddr;	/* passive mode address */
   	long	timeout_sec;	/* User configureable timeout (seconds) */
  +	int			autoseek;	/* User configureable autoseek flag */
  +
  +	int				async;	/* asyncronous transfer in progress */
  +	databuf_t		*data;	/* Data connection for asyncrounous transfers */
  +	php_stream		*stream; /* output stream for asyncrounous transfers */
  +	int				lastch;		/* last char of previous call */
  +	int				direction;	/* recv = 0 / send = 1 */
  +	int				closestream;/* close or not close stream */
   } ftpbuf_t;
   
  -typedef struct databuf
  -{
  -	int		listener;		/* listener socket */
  -	int		fd;			/* data connection */
  -	ftptype_t	type;			/* transfer type */
  -	char		buf[FTP_BUFSIZE];	/* data buffer */
  -} databuf_t;
   
   
   /* open a FTP connection, returns ftpbuf (NULL on error)
  @@ -120,7 +134,7 @@
    * array must be freed (but don't
    * free the array elements)
    */
  -char**		ftp_list(ftpbuf_t *ftp, const char *path);
  +char**		ftp_list(ftpbuf_t *ftp, const char *path, int recursive);
   
   /* switches passive mode on or off
    * returns true on success, false on error
  @@ -131,12 +145,12 @@
    * returns true on success, false on error
    */
   int		ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path,
  -			ftptype_t type);
  +			ftptype_t type, int resumepos);
   
   /* stores the data from a file, socket, or process as a file on the remote server
    * returns true on success, false on error
    */
  -int		ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type);
  +int		ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos);
   
   /* returns the size of the given file, or -1 on error */
   int		ftp_size(ftpbuf_t *ftp, const char *path);
  @@ -152,5 +166,25 @@
   
   /* sends a SITE command to the server */
   int		ftp_site(ftpbuf_t *ftp, const char *cmd);
  +
  +/* retrieves part of a file and saves its contents to outfp
  + * returns true on success, false on error
  + */
  +int		ftp_async_get(ftpbuf_t *ftp, php_stream *outstream, const char *path,
  +			ftptype_t type, int resumepos);
  +
  +/* stores the data from a file, socket, or process as a file on the remote server
  + * returns true on success, false on error
  + */
  +int		ftp_async_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos);
  +
  +/* continues a previous async_(f)get command
  + */
  +int		ftp_async_continue_read(ftpbuf_t *ftp);
  +
  +/* continues a previous async_(f)put command
  + */
  +int		ftp_async_continue_write(ftpbuf_t *ftp);
  +
   
   #endif
  
  
  
  1.2.2.2   +385 -45   php4/ext/ftp/php_ftp.c
  
  Index: php_ftp.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ftp/php_ftp.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_ftp.c	9 Jul 2002 09:14:32 -0000	1.2.2.1
  +++ php_ftp.c	3 Aug 2002 00:44:12 -0000	1.2.2.2
  @@ -13,10 +13,11 @@
      | licen****@php***** so we can mail you a copy immediately.               |
      +----------------------------------------------------------------------+
      | Authors: Andrew Skalski <askal****@chek*****>                          |
  +   |          Stefan Esser <sesse****@php*****> (resume functions)            |
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: php_ftp.c,v 1.59 2002/06/27 06:49:02 derick Exp $ */
  +/* $Id: php_ftp.c,v 1.66 2002/07/30 20:37:59 sesser Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -60,6 +61,11 @@
   	PHP_FE(ftp_close,			NULL)
   	PHP_FE(ftp_set_option,		NULL)
   	PHP_FE(ftp_get_option,		NULL)
  +	PHP_FE(ftp_async_fget,		NULL)
  +	PHP_FE(ftp_async_get,		NULL)
  +	PHP_FE(ftp_async_continue,	NULL)
  +	PHP_FE(ftp_async_put,		NULL)
  +	PHP_FE(ftp_async_fput,		NULL)
   	PHP_FALIAS(ftp_quit, ftp_close, NULL)
   	{NULL, NULL, NULL}
   };
  @@ -91,11 +97,16 @@
   PHP_MINIT_FUNCTION(ftp)
   {
   	le_ftpbuf = zend_register_list_destructors_ex(ftp_destructor_ftpbuf, NULL, le_ftpbuf_name, module_number);
  -	REGISTER_LONG_CONSTANT("FTP_ASCII",	 FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
  +	REGISTER_LONG_CONSTANT("FTP_ASCII",  FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
   	REGISTER_LONG_CONSTANT("FTP_TEXT",   FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
   	REGISTER_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
   	REGISTER_LONG_CONSTANT("FTP_IMAGE",  FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
  +	REGISTER_LONG_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS);
   	REGISTER_LONG_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS);
  +	REGISTER_LONG_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS);
  +	REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS);
  +	REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS);
  +	REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS);
   	return SUCCESS;
   }
   
  @@ -140,6 +151,9 @@
   		RETURN_FALSE;
   	}
   
  +	/* autoseek for resuming */
  +	ftp->autoseek = FTP_DEFAULT_AUTOSEEK;
  +
   	ZEND_REGISTER_RESOURCE(return_value, ftp, le_ftpbuf);
   }
   /* }}} */
  @@ -252,7 +266,7 @@
   	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
   		return;
   	}
  -	
  +
   	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
   
   	/* execute serverside command */
  @@ -342,7 +356,7 @@
   }
   /* }}} */
   
  -/* {{{ proto array ftp_rawlist(resource stream, string directory)
  +/* {{{ proto array ftp_rawlist(resource stream, string directory [, bool recursive])
      Returns a detailed listing of a directory as an array of output lines */
   PHP_FUNCTION(ftp_rawlist)
   {
  @@ -350,15 +364,16 @@
   	ftpbuf_t	*ftp;
   	char		**llist, **ptr, *dir;
   	int			dir_len;
  +	zend_bool	recursive = 0;
   
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &z_ftp, &dir, &dir_len, &recursive) == FAILURE) {
   		return;
   	}
   
   	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
   
   	/* get raw directory listing */
  -	if (NULL == (llist = ftp_list(ftp, dir))) {
  +	if (NULL == (llist = ftp_list(ftp, dir, recursive))) {
   		RETURN_FALSE;
   	}
   
  @@ -393,7 +408,7 @@
   }
   /* }}} */
   
  -/* {{{ proto bool ftp_fget(resource stream, resource fp, string remote_file, int mode)
  +/* {{{ proto bool ftp_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])
      Retrieves a file from the FTP server and writes it to an open file */
   PHP_FUNCTION(ftp_fget)
   {
  @@ -402,9 +417,9 @@
   	ftptype_t	xtype;
   	php_stream	*stream;
   	char		*file;
  -	int			file_len, mode;
  +	int			file_len, mode, resumepos=0;
   
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl", &z_ftp, &z_file, &file, &file_len, &mode) == FAILURE) {
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
   		return;
   	}
   
  @@ -412,7 +427,22 @@
   	ZEND_FETCH_RESOURCE(stream, php_stream*, &z_file, -1, "File-Handle", php_file_le_stream());
   	XTYPE(xtype, mode);
   
  -	if (!ftp_get(ftp, stream, file, xtype) || php_stream_error(stream)) {
  +	/* ignore autoresume if autoseek is switched off */
  +	if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
  +		resumepos = 0;
  +	}
  +
  +	if (ftp->autoseek && resumepos) {
  +		/* if autoresume is wanted seek to end */
  +		if (resumepos == PHP_FTP_AUTORESUME) {
  +			php_stream_seek(stream, 0, SEEK_END);
  +			resumepos = php_stream_tell(stream);
  +		} else {
  +			php_stream_seek(stream, resumepos, SEEK_SET);
  +		}
  +	}
  +
  +	if (!ftp_get(ftp, stream, file, xtype, resumepos) || php_stream_error(stream)) {
   		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
   		RETURN_FALSE;
   	}
  @@ -426,6 +456,53 @@
   }
   /* }}} */
   
  +/* {{{ proto bool ftp_async_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])
  +   Retrieves a file from the FTP server asynchronly and writes it to an open file */
  +PHP_FUNCTION(ftp_async_fget)
  +{
  +	zval		*z_ftp, *z_file;
  +	ftpbuf_t	*ftp;
  +	ftptype_t	xtype;
  +	php_stream	*stream;
  +	char		*file;
  +	int			file_len, mode, resumepos=0, ret;
  +
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
  +		return;
  +	}
  +
  +	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
  +	ZEND_FETCH_RESOURCE(stream, php_stream*, &z_file, -1, "File-Handle", php_file_le_stream());
  +	XTYPE(xtype, mode);
  +
  +	/* ignore autoresume if autoseek is switched off */
  +	if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
  +		resumepos = 0;
  +	}
  +
  +	if (ftp->autoseek && resumepos) {
  +		/* if autoresume is wanted seek to end */
  +		if (resumepos == PHP_FTP_AUTORESUME) {
  +			php_stream_seek(stream, 0, SEEK_END);
  +			resumepos = php_stream_tell(stream);
  +		} else {
  +			php_stream_seek(stream, resumepos, SEEK_SET);
  +		}
  +	}
  +
  +	/* configuration */
  +	ftp->direction = 0;   /* recv */
  +	ftp->closestream = 0; /* do not close */
  +
  +	if ((ret = ftp_async_get(ftp, stream, file, xtype, resumepos)) == PHP_FTP_FAILED || php_stream_error(stream)) {
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
  +		RETURN_LONG(ret);
  +	}
  +
  +	RETURN_LONG(ret);
  +}
  +/* }}} */
  +
   /* {{{ proto bool ftp_pasv(resource stream, bool pasv)
      Turns passive mode on or off */
   PHP_FUNCTION(ftp_pasv)
  @@ -448,71 +525,175 @@
   }
   /* }}} */
   
  -/* {{{ proto bool ftp_get(resource stream, string local_file, string remote_file, int mode)
  +/* {{{ proto bool ftp_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])
      Retrieves a file from the FTP server and writes it to a local file */
   PHP_FUNCTION(ftp_get)
   {
   	zval		*z_ftp;
   	ftpbuf_t	*ftp;
   	ftptype_t	xtype;
  -	php_stream * tmpstream, *outstream;
  +	php_stream	*outstream;
   	char		*local, *remote;
  -	int			local_len, remote_len, mode;
  +	int			local_len, remote_len, mode, resumepos=0;
   
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl", &z_ftp, &local, &local_len, &remote, &remote_len, &mode) == FAILURE) {
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
   		return;
   	}
  -	
  +
   	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
   	XTYPE(xtype, mode);
   
  -	/* get to temporary file, so if there is an error, no existing
  -	 * file gets clobbered
  -	 */
  -	tmpstream = php_stream_fopen_tmpfile();
  -	if (tmpstream == NULL) {
  +	/* ignore autoresume if autoseek is switched off */
  +	if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
  +		resumepos = 0;
  +	}
  +
  +	if (ftp->autoseek && resumepos) {
  +		outstream = php_stream_fopen(local, "rb+", NULL);
  +		if (outstream == NULL) {
  +			outstream = php_stream_fopen(local, "wb", NULL);
  +		}
  +		if (outstream != NULL) {
  +			/* if autoresume is wanted seek to end */
  +			if (resumepos == PHP_FTP_AUTORESUME) {
  +				php_stream_seek(outstream, 0, SEEK_END);
  +				resumepos = php_stream_tell(outstream);
  +			} else {
  +				php_stream_seek(outstream, resumepos, SEEK_SET);
  +			}
  +		}
  +	} else {
  +		outstream = php_stream_fopen(local, "wb", NULL);
  +	}
  +
  +	if (outstream == NULL)	{
  +		php_error(E_WARNING, "%s(): Error opening %s", get_active_function_name(TSRMLS_C), local);
   		RETURN_FALSE;
   	}
   
  -	if (!ftp_get(ftp, tmpstream, remote, xtype) || php_stream_error(tmpstream)) {
  -		php_stream_close(tmpstream);
  +	if (!ftp_get(ftp, outstream, remote, xtype, resumepos) || php_stream_error(outstream)) {
  +		php_stream_close(outstream);
   		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
   		RETURN_FALSE;
   	}
   
  -	outstream = php_stream_fopen(local, "wb", NULL);
  +	php_stream_close(outstream);
  +}
  +/* }}} */
  +
  +/* {{{ proto inf ftp_async_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])
  +   Retrieves a file from the FTP server asynchronly and writes it to a local file */
  +PHP_FUNCTION(ftp_async_get)
  +{
  +	zval		*z_ftp;
  +	ftpbuf_t	*ftp;
  +	ftptype_t	xtype;
  +	php_stream	*outstream;
  +	char		*local, *remote;
  +	int			local_len, remote_len, mode, resumepos=0, ret;
  +
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
  +		return;
  +	}
  +
  +	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
  +	XTYPE(xtype, mode);
  +
  +	/* ignore autoresume if autoseek is switched off */
  +	if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
  +		resumepos = 0;
  +	}
  +
  +	if (ftp->autoseek && resumepos) {
  +		outstream = php_stream_fopen(local, "rb+", NULL);
  +		if (outstream == NULL) {
  +			outstream = php_stream_fopen(local, "wb", NULL);
  +		}
  +		if (outstream != NULL) {
  +			/* if autoresume is wanted seek to end */
  +			if (resumepos == PHP_FTP_AUTORESUME) {
  +				php_stream_seek(outstream, 0, SEEK_END);
  +				resumepos = php_stream_tell(outstream);
  +			} else {
  +				php_stream_seek(outstream, resumepos, SEEK_SET);
  +			}
  +		}
  +	} else {
  +		outstream = php_stream_fopen(local, "wb", NULL);
  +	}
   
   	if (outstream == NULL)	{
  -		php_stream_close(tmpstream);
   		php_error(E_WARNING, "%s(): Error opening %s", get_active_function_name(TSRMLS_C), local);
   		RETURN_FALSE;
   	}
   
  -	php_stream_rewind(tmpstream);
  -	if (php_stream_copy_to_stream(tmpstream, outstream, PHP_STREAM_COPY_ALL) == 0)	{	
  -		php_error(E_WARNING, "%s(): Error writing %s", get_active_function_name(TSRMLS_C), local);
  -		RETVAL_FALSE;
  +	/* configuration */
  +	ftp->direction = 0;   /* recv */
  +	ftp->closestream = 1; /* do close */
  +
  +	if ((ret = ftp_async_get(ftp, outstream, remote, xtype, resumepos)) == PHP_FTP_FAILED || php_stream_error(outstream)) {
  +		php_stream_close(outstream);
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
  +		RETURN_LONG(PHP_FTP_FAILED);
   	}
  -	else
  -		RETVAL_TRUE;
   
  -	php_stream_close(tmpstream);
  -	php_stream_close(outstream);
  +	if (ret == PHP_FTP_FINISHED) {
  +		php_stream_close(outstream);
  +	}
  +
  +	RETURN_LONG(ret);
  +}
  +/* }}} */
  +
  +/* {{{ proto int ftp_async_continue(resource stream)
  +   Continues retrieving/sending a file asyncronously */
  +PHP_FUNCTION(ftp_async_continue)
  +{
  +	zval		*z_ftp;
  +	ftpbuf_t	*ftp;
  +	int			ret;
  +
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
  +		return;
  +	}
  +
  +	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
  +
  +	if (!ftp->async) {
  +		php_error(E_WARNING, "%s(): no asyncronous transfer to continue.", get_active_function_name(TSRMLS_C));
  +		RETURN_LONG(PHP_FTP_FAILED);
  +	}
  +
  +	if (ftp->direction) {
  +		ret=ftp_async_continue_write(ftp);
  +	} else {
  +		ret=ftp_async_continue_read(ftp);
  +	}
  +
  +	if (ret != PHP_FTP_MOREDATA && ftp->closestream) {
  +		php_stream_close(ftp->stream);
  +	}
  +
  +	if (ret == PHP_FTP_FAILED || php_stream_error(ftp->stream)) {
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
  +	}
  +
  +	RETURN_LONG(ret);
   }
   /* }}} */
   
  -/* {{{ proto bool ftp_fput(resource stream, string remote_file, resource fp, int mode)
  +/* {{{ proto bool ftp_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])
      Stores a file from an open file to the FTP server */
   PHP_FUNCTION(ftp_fput)
   {
   	zval		*z_ftp, *z_file;
   	ftpbuf_t	*ftp;
   	ftptype_t	xtype;
  -	int			mode, remote_len;
  +	int			mode, remote_len, startpos=0;
   	php_stream	*stream;
   	char		*remote;
   
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl", &z_ftp, &remote, &remote_len, &z_file, &mode) == FAILURE) {
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
   		return;
   	}
   
  @@ -520,7 +701,25 @@
      	ZEND_FETCH_RESOURCE(stream, php_stream*, &z_file, -1, "File-Handle", php_file_le_stream());
   	XTYPE(xtype, mode);
   
  -	if (!ftp_put(ftp, remote, stream, xtype)) {
  +	/* ignore autoresume if autoseek is switched off */
  +	if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
  +		startpos = 0;
  +	}
  +
  +	if (ftp->autoseek && startpos) {
  +		/* if autoresume is wanted ask for remote size */
  +		if (startpos == PHP_FTP_AUTORESUME) {
  +			startpos = ftp_size(ftp, remote);
  +			if (startpos < 0) {
  +				startpos = 0;
  +			}
  +		}
  +		if (startpos) {
  +			php_stream_seek(stream, startpos, SEEK_SET);
  +		}
  +	}
  +
  +	if (!ftp_put(ftp, remote, stream, xtype, startpos)) {
   		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
   		RETURN_FALSE;
   	}
  @@ -529,7 +728,58 @@
   }
   /* }}} */
   
  -/* {{{ proto bool ftp_put(resource stream, string remote_file, string local_file, int mode)
  +/* {{{ proto bool ftp_async_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])
  +   Stores a file from an open file to the FTP server asyncronly */
  +PHP_FUNCTION(ftp_async_fput)
  +{
  +	zval		*z_ftp, *z_file;
  +	ftpbuf_t	*ftp;
  +	ftptype_t	xtype;
  +	int			mode, remote_len, startpos=0, ret;
  +	php_stream	*stream;
  +	char		*remote;
  +
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
  +		return;
  +	}
  +
  +	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
  +   	ZEND_FETCH_RESOURCE(stream, php_stream*, &z_file, -1, "File-Handle", php_file_le_stream());
  +	XTYPE(xtype, mode);
  +
  +	/* ignore autoresume if autoseek is switched off */
  +	if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
  +		startpos = 0;
  +	}
  +
  +	if (ftp->autoseek && startpos) {
  +		/* if autoresume is wanted ask for remote size */
  +		if (startpos == PHP_FTP_AUTORESUME) {
  +			startpos = ftp_size(ftp, remote);
  +			if (startpos < 0) {
  +				startpos = 0;
  +			}
  +		}
  +		if (startpos) {
  +			php_stream_seek(stream, startpos, SEEK_SET);
  +		}
  +	}
  +
  +	/* configuration */
  +	ftp->direction = 1;   /* send */
  +	ftp->closestream = 0; /* do not close */
  +
  +	if (((ret = ftp_async_put(ftp, remote, stream, xtype, startpos)) == PHP_FTP_FAILED) || php_stream_error(stream)) {
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
  +		RETURN_LONG(ret);
  +	}
  +
  +	RETURN_LONG(ret);
  +}
  +/* }}} */
  +
  +
  +/* {{{ proto bool ftp_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
      Stores a file on the FTP server */
   PHP_FUNCTION(ftp_put)
   {
  @@ -537,13 +787,13 @@
   	ftpbuf_t	*ftp;
   	ftptype_t	xtype;
   	char		*remote, *local;
  -	int			remote_len, local_len, mode;
  +	int			remote_len, local_len, mode, startpos=0, ret;
   	php_stream * instream;
   
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl", &z_ftp, &remote, &remote_len, &local, &local_len, &mode) == FAILURE) {
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
   		return;
   	}
  -	
  +
   	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
   	XTYPE(xtype, mode);
   
  @@ -553,7 +803,25 @@
   		RETURN_FALSE;
   	}
   
  -	if (!ftp_put(ftp, remote, instream, xtype) || php_stream_error(instream)) {
  +	/* ignore autoresume if autoseek is switched off */
  +	if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
  +		startpos = 0;
  +	}
  +
  +	if (ftp->autoseek && startpos) {
  +		/* if autoresume is wanted ask for remote size */
  +		if (startpos == PHP_FTP_AUTORESUME) {
  +			startpos = ftp_size(ftp, remote);
  +			if (startpos < 0) {
  +				startpos = 0;
  +			}
  +		}
  +		if (startpos) {
  +			php_stream_seek(instream, startpos, SEEK_SET);
  +		}
  +	}
  +
  +	if (!ftp_put(ftp, remote, instream, xtype, startpos) || php_stream_error(instream)) {
   		php_stream_close(instream);
   		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
   		RETURN_FALSE;
  @@ -564,6 +832,67 @@
   }
   /* }}} */
   
  +
  +/* {{{ proto bool ftp_async_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
  +   Stores a file on the FTP server */
  +PHP_FUNCTION(ftp_async_put)
  +{
  +	zval		*z_ftp;
  +	ftpbuf_t	*ftp;
  +	ftptype_t	xtype;
  +	char		*remote, *local;
  +	int			remote_len, local_len, mode, startpos=0, ret;
  +	php_stream * instream;
  +
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
  +		return;
  +	}
  +
  +	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
  +	XTYPE(xtype, mode);
  +
  +	instream = php_stream_fopen(local, "rb", NULL);
  +
  +	if (instream == NULL)	{
  +		RETURN_FALSE;
  +	}
  +
  +	/* ignore autoresume if autoseek is switched off */
  +	if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
  +		startpos = 0;
  +	}
  +
  +	if (ftp->autoseek && startpos) {
  +		/* if autoresume is wanted ask for remote size */
  +		if (startpos == PHP_FTP_AUTORESUME) {
  +			startpos = ftp_size(ftp, remote);
  +			if (startpos < 0) {
  +				startpos = 0;
  +			}
  +		}
  +		if (startpos) {
  +			php_stream_seek(instream, startpos, SEEK_SET);
  +		}
  +	}
  +
  +	/* configuration */
  +	ftp->direction = 1;   /* send */
  +	ftp->closestream = 1; /* do close */
  +
  +	ret = ftp_async_put(ftp, remote, instream, xtype, startpos);
  +
  +	if (ret != PHP_FTP_MOREDATA) {
  +		php_stream_close(instream);
  +	}
  +
  +	if (ret == PHP_FTP_FAILED || php_stream_error(instream)) {
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
  +	}
  +
  +	RETURN_LONG(ret);
  +}
  +/* }}} */
  +
   /* {{{ proto int ftp_size(resource stream, string filename)
      Returns the size of the file, or -1 on error */
   PHP_FUNCTION(ftp_size)
  @@ -692,10 +1021,10 @@
   
   	ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
   
  -	zend_list_delete(Z_LVAL_P(z_ftp));
  +	RETURN_BOOL(zend_list_delete(Z_LVAL_P(z_ftp)) == SUCCESS);
   }
   /* }}} */
  -	
  +
   /* {{{ proto bool ftp_set_option(resource stream, int option, mixed value)
      Sets an FTP option */
   PHP_FUNCTION(ftp_set_option)
  @@ -703,7 +1032,7 @@
   	zval	*z_ftp, *z_value;
   	long	option;
   	ftpbuf_t	*ftp;
  -	
  +
   	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_ftp, &option, &z_value) == FAILURE) {
   		return;
   	}
  @@ -725,6 +1054,15 @@
   			ftp->timeout_sec = Z_LVAL_P(z_value);
   			RETURN_TRUE;
   			break;
  +		case PHP_FTP_OPT_AUTOSEEK:
  +			if (Z_TYPE_P(z_value) != IS_BOOL) {
  +				php_error(E_WARNING, "%s(): Option AUTOSEEK expects value of type boolean, %s given",
  +						  get_active_function_name(TSRMLS_C), zend_zval_type_name(z_value));
  +				RETURN_FALSE;
  +			}
  +			ftp->autoseek = Z_LVAL_P(z_value);
  +			RETURN_TRUE;
  +			break;
   		default:
   			php_error(E_WARNING, "%s(): Unknown option '%d'", get_active_function_name(TSRMLS_C), option);
   			RETURN_FALSE;
  @@ -740,7 +1078,7 @@
   	zval	*z_ftp;
   	long	option;
   	ftpbuf_t	*ftp;
  -	
  +
   	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_ftp, &option) == FAILURE) {
   		return;
   	}
  @@ -751,6 +1089,8 @@
   		case PHP_FTP_OPT_TIMEOUT_SEC:
   			RETURN_LONG(ftp->timeout_sec);
   			break;
  +		case PHP_FTP_OPT_AUTOSEEK:
  +			RETURN_BOOL(ftp->autoseek);
   		default:
   			php_error(E_WARNING, "%s(): Unknown option '%d'", get_active_function_name(TSRMLS_C), option);
   			RETURN_FALSE;
  
  
  
  1.2.2.1   +10 -2     php4/ext/ftp/php_ftp.h
  
  Index: php_ftp.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ftp/php_ftp.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_ftp.h	29 Apr 2002 02:30:45 -0000	1.2
  +++ php_ftp.h	3 Aug 2002 00:44:12 -0000	1.2.2.1
  @@ -12,11 +12,12 @@
      | obtain it through the world-wide-web, please send a note to          |
      | licen****@php***** so we can mail you a copy immediately.               |
      +----------------------------------------------------------------------+
  -   | Author: Andrew Skalski <askal****@chek*****>                           |
  +   | Authors: Andrew Skalski <askal****@chek*****>                          |
  +   |          Stefan Esser <sesse****@php*****> (resume functions)            |
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: php_ftp.h,v 1.17 2002/02/28 08:26:10 sebastian Exp $ */
  +/* $Id: php_ftp.h,v 1.19 2002/07/26 22:00:25 sesser Exp $ */
   
   #ifndef	_INCLUDED_FTP_H
   #define	_INCLUDED_FTP_H
  @@ -27,6 +28,8 @@
   #define php_ftp_module_ptr &php_ftp_module_entry
   
   #define PHP_FTP_OPT_TIMEOUT_SEC	0
  +#define PHP_FTP_OPT_AUTOSEEK	1
  +#define PHP_FTP_AUTORESUME		-1
   
   PHP_MINIT_FUNCTION(ftp);
   PHP_MINFO_FUNCTION(ftp);
  @@ -55,6 +58,11 @@
   PHP_FUNCTION(ftp_close);
   PHP_FUNCTION(ftp_set_option);
   PHP_FUNCTION(ftp_get_option);
  +PHP_FUNCTION(ftp_async_get);
  +PHP_FUNCTION(ftp_async_fget);
  +PHP_FUNCTION(ftp_async_put);
  +PHP_FUNCTION(ftp_async_fput);
  +PHP_FUNCTION(ftp_async_continue);
   
   #define phpext_ftp_ptr php_ftp_module_ptr
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +17 -11    php4/ext/gd/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/gd/config.m4,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- config.m4	9 Jul 2002 09:14:32 -0000	1.2.2.1
  +++ config.m4	3 Aug 2002 00:44:13 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.101 2002/06/28 12:23:18 sniper Exp $
  +dnl $Id: config.m4,v 1.105 2002/07/23 01:11:16 sniper Exp $
   dnl
   
   dnl
  @@ -187,7 +187,7 @@
       [
         AC_DEFINE(HAVE_LIBT1,1,[ ])
         PHP_ADD_INCLUDE($GD_T1_DIR/include)
  -      PHP_ADD_LIBRARY_WITH_PATH(t1, "$GD_T1_DIR/lib", GD_SHARED_LIBADD)
  +      PHP_ADD_LIBRARY_WITH_PATH(t1, $GD_T1_DIR/lib, GD_SHARED_LIBADD)
       ],[
         AC_MSG_ERROR([Problem with libt1.(a|so). Please check config.log for more information.]) 
       ],[
  @@ -237,7 +237,7 @@
   		libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \
   		libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c"
   
  -  PHP_NEW_EXTENSION(gd, gd.c $sources, $ext_shared,, \\$(GDLIB_CFLAGS))
  +  PHP_NEW_EXTENSION(gd, gd.c gdttf.c $sources, $ext_shared,, \\$(GDLIB_CFLAGS))
     PHP_ADD_BUILD_DIR($ext_builddir/libgd)
   
   dnl PNG is required by GD library
  @@ -289,6 +289,10 @@
       GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE"
     fi
   
  +  if test -n "$TTF_DIR"; then
  +    GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBTTF"
  +  fi
  +
     PHP_SUBST(GDLIB_CFLAGS)
   
   else
  @@ -323,14 +327,6 @@
       done
     done
   
  -  if test -n "$GD_INCLUDE" -a -n "$GD_LIB" ; then
  -    PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
  -    AC_DEFINE(HAVE_LIBGD,1,[ ])
  -    PHP_GD_CHECK_VERSION
  -  else
  -    AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $GD_SEARCH_PATHS])
  -  fi 
  -
   dnl NetBSD package structure
     if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
       GD_INCLUDE=/usr/pkg/include/gd
  @@ -340,6 +336,16 @@
     if test -f /usr/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
       GD_INCLUDE=/usr/include/gd
     fi
  +
  +  if test -n "$GD_INCLUDE" -a -n "$GD_LIB" ; then
  +    PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
  +    AC_DEFINE(HAVE_LIBGD,1,[ ])
  +    PHP_GD_CHECK_VERSION
  +  elif test -z "$GD_INCLUDE"; then
  +    AC_MSG_ERROR([Unable to find gd.h anywhere under $GD_SEARCH_PATHS])
  +  else
  +    AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $GD_SEARCH_PATHS])
  +  fi 
   
     PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
     PHP_ADD_INCLUDE($GD_INCLUDE)
  
  
  
  1.2.2.2   +31 -31    php4/ext/gd/gd.c
  
  Index: gd.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/gd/gd.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- gd.c	9 Jul 2002 09:14:32 -0000	1.2.2.1
  +++ gd.c	3 Aug 2002 00:44:13 -0000	1.2.2.2
  @@ -18,7 +18,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: gd.c,v 1.200 2002/06/29 15:54:02 derick Exp $ */
  +/* $Id: gd.c,v 1.202 2002/07/28 10:00:37 helly Exp $ */
   
   /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
      Cold Spring Harbor Labs. */
  @@ -118,6 +118,7 @@
    */
   function_entry gd_functions[] = {
   	PHP_FE(imagearc,								NULL)
  +	PHP_FE(imageellipse,							NULL)
   	PHP_FE(imagechar,								NULL)
   	PHP_FE(imagecharup,								NULL)
   	PHP_FE(imagecolorallocate,						NULL)
  @@ -148,7 +149,6 @@
   	PHP_FE(imagecreatetruecolor,					NULL)
   	PHP_FE(imagetruecolortopalette,					NULL)
   	PHP_FE(imagesetthickness,						NULL)
  -	PHP_FE(imageellipse,							NULL)
   	PHP_FE(imagefilledarc,							NULL)
   	PHP_FE(imagefilledellipse,						NULL)
   	PHP_FE(imagealphablending,						NULL)
  @@ -659,35 +659,6 @@
   }
   /* }}} */
   
  -/* {{{ proto void imageellipse(resource im, int cx, int cy, int w, int h, int color)
  -   Draw an ellipse */
  -PHP_FUNCTION(imageellipse)
  -{
  -	zval **IM, **cx, **cy, **w, **h, **color;
  -	gdImagePtr im;
  -
  -	if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
  -		ZEND_WRONG_PARAM_COUNT();
  -	}
  -	
  -	ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
  -
  -	convert_to_long_ex(cx);
  -	convert_to_long_ex(cy);
  -	convert_to_long_ex(w);
  -	convert_to_long_ex(h);
  -	convert_to_long_ex(color);
  -
  -#ifdef HAVE_GD_IMAGEELLIPSE  /* this function is missing from GD 2.0.1 */
  -	gdImageEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), Z_LVAL_PP(color));
  -#else
  -	gdImageArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), 0, 360, Z_LVAL_PP(color));
  -#endif
  -
  -	RETURN_TRUE;
  -}
  -/* }}} */
  -
   /* {{{ proto void imagefilledellipse(resource im, int cx, int cy, int w, int h, int color)
      Draw an ellipse */
   PHP_FUNCTION(imagefilledellipse)
  @@ -1975,6 +1946,35 @@
   	RETURN_TRUE;
   }
   /* }}} */	
  +
  +/* {{{ proto void imageellipse(resource im, int cx, int cy, int w, int h, int color)
  +   Draw an ellipse */
  +PHP_FUNCTION(imageellipse)
  +{
  +	zval **IM, **cx, **cy, **w, **h, **color;
  +	gdImagePtr im;
  +
  +	if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
  +		ZEND_WRONG_PARAM_COUNT();
  +	}
  +	
  +	ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
  +
  +	convert_to_long_ex(cx);
  +	convert_to_long_ex(cy);
  +	convert_to_long_ex(w);
  +	convert_to_long_ex(h);
  +	convert_to_long_ex(color);
  +
  +#ifdef HAVE_GD_IMAGEELLIPSE  /* this function is missing from GD 2.0.1 */
  +	gdImageEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), Z_LVAL_PP(color));
  +#else
  +	gdImageArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), 0, 360, Z_LVAL_PP(color));
  +#endif
  +
  +	RETURN_TRUE;
  +}
  +/* }}} */
   
   /* {{{ proto int imagefilltoborder(int im, int x, int y, int border, int col)
      Flood fill to specific color */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +4 -4      php4/ext/gd/libgd/gdft.c
  
  Index: gdft.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/gd/libgd/gdft.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- gdft.c	29 Apr 2002 02:30:46 -0000	1.2
  +++ gdft.c	3 Aug 2002 00:44:13 -0000	1.2.2.1
  @@ -509,12 +509,12 @@
   	     is incorporate our knowledge of the percentage of this
   	     pixel that is really "lit" by pushing the alpha value
   	     up toward transparency in edge regions. */
  -	  a->tweencolor = gdTrueColorAlpha (
  +	  a->tweencolor = gdAlphaBlend(bg, gdTrueColorAlpha (
   					     gdTrueColorGetRed (fg),
   					     gdTrueColorGetGreen (fg),
   					     gdTrueColorGetBlue (fg),
  -					gdAlphaMax - ((gdAlphaMax - gdTrueColorGetAlpha (fg)) * pixel / NUMCOLORS)
  -			);
  +					     gdAlphaMax - ((gdAlphaMax - gdTrueColorGetAlpha (fg)) * pixel / NUMCOLORS))
  +				       );
   	}
         else
   	{
  @@ -604,7 +604,7 @@
   		}
   				else	{
   		  pixel = &im->pixels[y][x];
  -	      if (tc_key.pixel == NUMCOLORS)
  +	      if (tc_key.pixel == NUMCOLORS && gdTrueColorGetAlpha(fg) ==0)
   		      *pixel = fg;
   					else	{
   		      tc_key.bgcolor = *pixel;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +1 -2      php4/ext/hyperwave/hw.c
  
  Index: hw.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/hyperwave/hw.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- hw.c	9 Jul 2002 09:14:33 -0000	1.2.2.1
  +++ hw.c	3 Aug 2002 00:44:13 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: hw.c,v 1.108 2002/07/03 06:10:28 steinm Exp $ */
  +/* $Id: hw.c,v 1.109 2002/07/24 05:59:00 steinm Exp $ */
   
   #include <stdlib.h>
   #include <errno.h>
  @@ -4311,7 +4311,6 @@
   	pval **arg1, **arg2, **arg3, **arg4;
   	hw_document *hwdoc;
   	int type, docid, error, argc, count;
  -	char *anchorstr;
   	char **anchorrecs;
   	char **dest;
   	char **urlprefix;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +36 -1     php4/ext/iconv/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/iconv/config.m4,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- config.m4	29 Apr 2002 02:30:47 -0000	1.2
  +++ config.m4	3 Aug 2002 00:44:13 -0000	1.2.2.1
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.11 2002/03/17 21:09:21 sniper Exp $
  +dnl $Id: config.m4,v 1.12 2002/07/11 03:37:28 yohgaki Exp $
   dnl
   
   PHP_ARG_WITH(iconv, for iconv support,
  @@ -8,6 +8,41 @@
   if test "$PHP_ICONV" != "no"; then
   
     PHP_SETUP_ICONV(ICONV_SHARED_LIBADD, [
  +	AC_MSG_CHECKING([if iconv supports errno])
  +	AC_TRY_RUN([
  +#define LIBICONV_PLUG
  +#include <iconv.h>
  +#include <errno.h>
  +#if defined(_LIBICONV_H)
  +#define icv_open(a, b) libiconv_open(a, b)
  +#define icv_close(a) libiconv_close(a)
  +#define icv(a, b, c, d, e) libiconv(a, b, c, d, e)
  +#else
  +#define icv_open(a, b) iconv_open(a, b)
  +#define icv_close(a) iconv_close(a)
  +#define icv(a, b, c, d, e) iconv(a, b, c, d, e)
  +#endif
  +
  +int main() {
  +	iconv_t cd;
  +	cd = icv_open( "*blahblah*", "*blahblah*" );
  +	if( cd == (iconv_t)(-1) ) {
  +		if( errno == EINVAL ) {
  +			return 0;
  +		} else {
  +			return 1;
  +		}
  +	}
  +	icv_close( cd );
  +	return 2;
  +}
  +],[
  +	AC_MSG_RESULT(yes)
  +	PHP_DEFINE(ICONV_SUPPORTS_ERRNO)
  +],[
  +	AC_MSG_RESULT(no)
  +])
  +
       PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared)
       PHP_SUBST(ICONV_SHARED_LIBADD)
     ], [
  
  
  
  1.2.2.3   +41 -33    php4/ext/iconv/iconv.c
  
  Index: iconv.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/iconv/iconv.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- iconv.c	9 Jul 2002 09:14:33 -0000	1.2.2.2
  +++ iconv.c	3 Aug 2002 00:44:13 -0000	1.2.2.3
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: iconv.c,v 1.39 2002/06/28 07:12:32 derick Exp $ */
  +/* $Id: iconv.c,v 1.42 2002/07/19 07:18:16 derick Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -28,6 +28,7 @@
   #ifdef PHP_ATOM_INC
   #include "php_have_iconv.h"
   #include "php_have_libiconv.h"
  +#include "php_iconv_supports_errno.h"
   #endif
   
   #if HAVE_ICONV
  @@ -49,6 +50,7 @@
   
   
   #if HAVE_LIBICONV
  +#define LIBICONV_PLUG
   #define icv_open(a, b) libiconv_open(a, b)
   #define icv_close(a) libiconv_close(a)
   #define icv(a, b, c, d, e) libiconv(a, b, c, d, e)
  @@ -145,8 +147,7 @@
   							char **out, size_t *out_len,
   							const char *in_charset, const char *out_charset, int *err TSRMLS_DC)
   {
  -#if HAVE_LIBICONV
  -	/* No errno for libiconv(?) */
  +#if !defined(ICONV_SUPPORTS_ERRNO)
   	unsigned int in_size, out_size, out_left;
   	char *out_buffer, *out_p;
   	iconv_t cd;
  @@ -163,9 +164,9 @@
   	  a single char can be more than 4 bytes.
   	  I added 15 extra bytes for safety. <yohga****@php*****>
   	*/
  -	out_size = in_len * sizeof(ucs4_t) + 16;
  -	out_buffer = (char *) emalloc(out_size);
  -	
  +	out_size = in_len * sizeof(ucs4_t) + 15;
  +	out_buffer = (char *) emalloc(out_size + 1);
  +
   	*out = out_buffer;
   	out_p = out_buffer;
   	out_left = out_size;
  @@ -174,7 +175,7 @@
   	
   	if (cd == (iconv_t)(-1)) {
   		*err = PHP_ICONV_UNKNOWN;
  -		php_error(E_WARNING, "%s(): unknown error, unable to convert from `%s' to `%s'",
  +		php_error(E_WARNING, "%s(): Unknown error, unable to convert from `%s' to `%s'",
   				  get_active_function_name(TSRMLS_C), in_charset, out_charset);
   		efree(out_buffer);
   		return FAILURE;
  @@ -197,71 +198,78 @@
   
   #else
   	/*
  -	  libc iconv should support errno. Handle it better way.
  +	  iconv supports errno. Handle it better way.
   	*/
   	iconv_t cd;
   	size_t in_left, out_size, out_left;
   	char *out_p, *out_buf, *tmp_buf;
  -	size_t i, bsz, result;
  +	size_t bsz, result;
   
   	*err = 0;
  -	cd = iconv_open(out_charset, in_charset);
  +	cd = icv_open(out_charset, in_charset);
  +
   	if (cd == (iconv_t)(-1)) {
   		if (errno == EINVAL) {
   			*err = PHP_ICONV_WRONG_CHARSET;
  -			php_error(E_NOTICE, "%s() wrong charset, cannot convert from `%s' to `%s'",
  +			php_error(E_NOTICE, "%s(): Wrong charset, cannot convert from `%s' to `%s'",
   					  get_active_function_name(TSRMLS_C), in_charset, out_charset);
  -		}
  -		else {
  +		} else {
   			*err = PHP_ICONV_CONVERTER;
  -			php_error(E_NOTICE, "%s() cannot open converter",
  +			php_error(E_NOTICE, "%s(): Cannot open converter",
   					  get_active_function_name(TSRMLS_C));
   		}
   		return FAILURE;
   	}
  -	
   	in_left= in_len;
   	out_left = in_len + 32; /* Avoid realloc() most cases */ 
  +	out_size = 0;
   	bsz = out_left;
   	out_buf = (char *) emalloc(bsz+1); 
   	out_p = out_buf;
  -	result = iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left);
  -	out_size = bsz - out_left;
  -	for (i = 2;in_left > 0 && errno == E2BIG; i++) {
  -		/* converted string is longer than out buffer */
  -		tmp_buf = (char*)erealloc(out_buf, bsz*i+1);
  -		if (tmp_buf == NULL) {
  -			break;
  +
  +	while(in_left > 0) {
  +		result = icv(cd, (const char **)&in_p, &in_left, (char **) &out_p, &out_left);
  +		out_size = bsz - out_left;
  +		if( result == (size_t)(-1) ) {
  +			if( errno == E2BIG && in_left > 0 ) {
  +				/* converted string is longer than out buffer */
  +				bsz += in_len;
  +
  +				tmp_buf = (char*) erealloc(out_buf, bsz+1);
  +
  +				if (tmp_buf != NULL) {
  +					out_p = out_buf = tmp_buf;
  +					out_p += out_size;
  +					out_left = bsz - out_size;
  +					continue;	
  +				}
  +			}
   		}
  -		out_buf = tmp_buf;
  -		out_p = tmp_buf;
  -		out_p += out_size;
  -		out_left = bsz;
  -		result = iconv(cd, (char **)&in_p, &in_left, &out_p, &out_left);
  -		out_size += bsz - out_left;
  +		break;
   	}
  -	iconv_close(cd);
  +	icv_close(cd);
  +
   	if (result == (size_t)(-1)) {
   		switch (errno) {
   			case EINVAL:
  -				php_error(E_NOTICE, "%s() detected incomplete character in input string",
  +				php_error(E_NOTICE, "%s(): Detected incomplete character in input string",
   						  get_active_function_name(TSRMLS_C));
   				*err = PHP_ICONV_ILLEGAL_CHAR;
   				break;
   			case EILSEQ:
  -				php_error(E_NOTICE, "%s() detected illegal character in input string",
  +				php_error(E_NOTICE, "%s(): Detected illegal character in input string",
   						  get_active_function_name(TSRMLS_C));
   				*err = PHP_ICONV_ILLEGAL_SEQ;
   				break;
   			case E2BIG:
   				/* should not happen */
  -				php_error(E_WARNING, "%s() run out buffer",
  +				php_error(E_WARNING, "%s(): Run out buffer",
   						  get_active_function_name(TSRMLS_C));
   				*err = PHP_ICONV_TOO_BIG;
   				break;
   			default:
   				/* other error */
  -				php_error(E_NOTICE, "%s() unknown error (%d)",
  +				php_error(E_NOTICE, "%s(): Unknown error (%d)",
   						  get_active_function_name(TSRMLS_C), errno);
   				*err = PHP_ICONV_UNKNOWN;
   				efree(out_buf);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +2 -1      php4/ext/iconv/tests/eucjp2iso2022jp.phpt
  
  Index: eucjp2iso2022jp.phpt
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/iconv/tests/eucjp2iso2022jp.phpt,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- eucjp2iso2022jp.phpt	29 Apr 2002 02:30:47 -0000	1.2
  +++ eucjp2iso2022jp.phpt	3 Aug 2002 00:44:13 -0000	1.2.2.1
  @@ -7,4 +7,5 @@
   --FILE--
   <?php include('eucjp2iso2022jp.inc'); ?>
   --EXPECT--
  -ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ
 8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0CgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  +ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ
 8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0Cg==
  +
  
  
  
  1.2.2.1   +1 -1      php4/ext/iconv/tests/eucjp2utf8.inc
  
  Index: eucjp2utf8.inc
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/iconv/tests/eucjp2utf8.inc,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- eucjp2utf8.inc	29 Apr 2002 02:30:47 -0000	1.2
  +++ eucjp2utf8.inc	3 Aug 2002 00:44:13 -0000	1.2.2.1
  @@ -40,7 +40,7 @@
   〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓English Text
   ";
   
  -$str = iconv("EUC-JP", "UTF8", $str);
  +$str = iconv("EUC-JP", "UTF-8", $str); /* libiconv(1.8) doesn't know "UTF8" but "UTF-8". */ 
   $str = base64_encode($str);
   echo $str."\n";
   
  
  
  
  1.2.2.1   +3 -2      php4/ext/iconv/tests/eucjp2utf8.phpt
  
  Index: eucjp2utf8.phpt
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/iconv/tests/eucjp2utf8.phpt,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- eucjp2utf8.phpt	29 Apr 2002 02:30:47 -0000	1.2
  +++ eucjp2utf8.phpt	3 Aug 2002 00:44:13 -0000	1.2.2.1
  @@ -1,10 +1,11 @@
   --TEST--
   EUC-JP to UTF8
   --SKIPIF--
  -<?php include('skipif.inc'); ?>
  +<?php include('skipif.inc');?>
   --POST--
   --GET--
   --FILE--
   <?php include('eucjp2utf8.inc'); ?>
   --EXPECT--
  -CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQ
 K5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  +CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQ
 K5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0Cg==
  +
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +70 -35    php4/ext/imap/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/imap/config.m4,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- config.m4	9 Jul 2002 09:14:33 -0000	1.2.2.1
  +++ config.m4	3 Aug 2002 00:44:13 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.44 2002/06/01 20:14:57 sr Exp $
  +dnl $Id: config.m4,v 1.47 2002/07/25 11:33:21 sniper Exp $
   dnl
   
   AC_DEFUN(IMAP_INC_CHK,[if test -r "$i$1/c-client.h"; then
  @@ -21,6 +21,40 @@
     done
   ])
   
  +dnl PHP_IMAP_TEST_BUILD(action-if-ok, action-if-not-ok [, extra-libs])
  +AC_DEFUN(PHP_IMAP_TEST_BUILD, [
  +  old_LIBS=$LIBS
  +  LIBS="$3 $LIBS"
  +  AC_TRY_RUN([
  +    void mm_log(void){}
  +    void mm_dlog(void){}
  +    void mm_flags(void){}
  +    void mm_fatal(void){}
  +    void mm_critical(void){}
  +    void mm_nocritical(void){}
  +    void mm_notify(void){}
  +    void mm_login(void){}
  +    void mm_diskerror(void){}
  +    void mm_status(void){}
  +    void mm_lsub(void){}
  +    void mm_list(void){}
  +    void mm_exists(void){}
  +    void mm_searched(void){}
  +    void mm_expunged(void){}
  +    char mail_open();
  +    int main() {
  +      mail_open(0,"",0);
  +      return 0;
  +    }
  +  ], [
  +    LIBS=$old_LIBS
  +    $1
  +  ],[
  +    LIBS=$old_LIBS
  +    $2
  +  ])
  +])
  +
   AC_DEFUN(PHP_IMAP_KRB_CHK, [
     AC_ARG_WITH(kerberos,
     [  --with-kerberos[=DIR]     IMAP: Include Kerberos support. DIR is the Kerberos install dir.],[
  @@ -34,6 +68,12 @@
     fi
   
     if test "$PHP_KERBEROS" != "no"; then
  +    if test ! -f $PHP_KERBEROS/lib/libkrb5.a && test ! -f $PHP_KERBEROS/lib/libkrb5.$SHLIB_SUFFIX_NAME; then
  +      AC_MSG_ERROR([Kerberos libraries not found in $PHP_KERBEROS/lib. 
  +      
  +      Check the path given to --with-kerberos (if no path is given, defaults to /usr/kerberos )
  +      ])
  +    fi
       AC_DEFINE(HAVE_IMAP_KRB,1,[ ])
       PHP_ADD_LIBPATH($PHP_KERBEROS/lib, IMAP_SHARED_LIBADD)
       PHP_ADD_LIBRARY(gssapi_krb5, 1, IMAP_SHARED_LIBADD)
  @@ -42,9 +82,10 @@
       PHP_ADD_LIBRARY(com_err,  1, IMAP_SHARED_LIBADD)
     else
       AC_EGREP_HEADER(auth_gss, $IMAP_INC_DIR/linkage.h, [
  -      AC_MSG_ERROR(This c-client library is build with Kerberos support. 
  +      AC_MSG_ERROR([This c-client library is build with Kerberos support. 
   
  -      Add --with-kerberos<=DIR> to your configure line. Check config.log for details.)
  +      Add --with-kerberos<=DIR> to your configure line. Check config.log for details.
  +      ])
       ])
     fi
   
  @@ -62,45 +103,29 @@
       PHP_IMAP_SSL=/usr
     fi
   
  +  AC_MSG_CHECKING([whether SSL libraries are needed for c-client])
  +
     if test "$PHP_IMAP_SSL" != "no"; then
  +    AC_MSG_RESULT([$PHP_IMAP_SSL/lib])
       AC_DEFINE(HAVE_IMAP_SSL,1,[ ])
  -    PHP_ADD_LIBPATH($PHP_IMAP_SSL/lib, IMAP_SHARED_LIBADD)
       PHP_ADD_LIBRARY_DEFER(ssl,, IMAP_SHARED_LIBADD)
       PHP_ADD_LIBRARY_DEFER(crypto,, IMAP_SHARED_LIBADD)
  +    PHP_ADD_LIBPATH($PHP_IMAP_SSL/lib, IMAP_SHARED_LIBADD)
     else
  -    old_LIBS=$LIBS
  -    LIBS="$LIBS -L$IMAP_LIBDIR -l$IMAP_LIB"
  +    TST_LIBS="-L$IMAP_LIBDIR -l$IMAP_LIB"
       if test $PHP_KERBEROS != "no"; then
  -      LIBS="$LIBS -L$PHP_KERBEROS/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
  +      TST_LIBS="$TST_LIBS -L$PHP_KERBEROS/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
       fi
   
  -    AC_TRY_RUN([
  -      void mm_log(void){}
  -      void mm_dlog(void){}
  -      void mm_flags(void){}
  -      void mm_fatal(void){}
  -      void mm_critical(void){}
  -      void mm_nocritical(void){}
  -      void mm_notify(void){}
  -      void mm_login(void){}
  -      void mm_diskerror(void){}
  -      void mm_status(void){}
  -      void mm_lsub(void){}
  -      void mm_list(void){}
  -      void mm_exists(void){}
  -      void mm_searched(void){}
  -      void mm_expunged(void){}
  -      char mail_open();
  -      int main() {
  -        mail_open(0,"",0);
  -        return 0;
  -      }
  -    ],,[
  -      AC_MSG_ERROR(This c-client library is build with SSL support. 
  -      
  -      Add --with-imap-ssl<=DIR> to your configure line. Check config.log for details.)
  -    ])
  -    LIBS=$old_LIBS
  +    PHP_IMAP_TEST_BUILD([
  +      AC_MSG_RESULT(no)
  +    ], [
  +      AC_MSG_RESULT(yes)
  +      AC_MSG_ERROR([This c-client library is build with SSL support. 
  +     
  +      Add --with-imap-ssl<=DIR> to your configure line. Check config.log for details.
  +      ])
  +    ], $TST_LIBS)
     fi
   ])
   
  @@ -162,8 +187,18 @@
       fi
   
       PHP_ADD_INCLUDE($IMAP_INC_DIR)
  -    PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
       PHP_ADD_LIBRARY_DEFER($IMAP_LIB,, IMAP_SHARED_LIBADD)
  +    PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
       PHP_IMAP_KRB_CHK
       PHP_IMAP_SSL_CHK
  +
  +    dnl Test the build in the end
  +    TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD"
  +    AC_MSG_CHECKING(whether IMAP works)
  +    PHP_IMAP_TEST_BUILD([
  +      AC_MSG_RESULT(yes)
  +    ], [
  +      AC_MSG_RESULT(no)
  +      AC_MSG_ERROR([build test failed. Please check the config.log for details.])
  +    ], $TST_LIBS)
   fi
  
  
  
  1.2.2.3   +86 -12    php4/ext/imap/php_imap.c
  
  Index: php_imap.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/imap/php_imap.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- php_imap.c	9 Jul 2002 09:14:33 -0000	1.2.2.2
  +++ php_imap.c	3 Aug 2002 00:44:13 -0000	1.2.2.3
  @@ -22,10 +22,11 @@
      |          Andrew Skalski      <askal****@cheki*****>                  |
      |          Hartmut Holzgraefe  <hartm****@six*****>                        |
      |          Jani Taskinen       <snipe****@iki*****>                         |
  +   |          Daniel R. Kalowsky  <kalow****@php*****>                      |
      | PHP 4.0 updates:  Zeev Suraski <zeev****@zend*****>                       |
      +----------------------------------------------------------------------+
    */
  -/* $Id: php_imap.c,v 1.125 2002/07/02 23:45:32 fmk Exp $ */
  +/* $Id: php_imap.c,v 1.132 2002/08/01 14:47:48 kalowsky Exp $ */
   
   #define IMAP41
   
  @@ -134,6 +135,7 @@
   
   #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
   	PHP_FE(imap_get_quota,							NULL)
  +	PHP_FE(imap_get_quotaroot,						NULL)
   	PHP_FE(imap_set_quota,							NULL)
    	PHP_FE(imap_setacl,								NULL)
   #endif
  @@ -377,18 +379,51 @@
    */
   void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
   {
  +	zval *t_map;
   	TSRMLS_FETCH();
  +/* put parsing code here */
  +	for(; qlist; qlist = qlist->next) {
  +		MAKE_STD_ZVAL(t_map);
  +		if (array_init(t_map) == FAILURE) {
  +			php_error(E_WARNING, "Unable to allocate t_map memory");
  +			FREE_ZVAL(t_map);
  +			FREE_ZVAL(IMAPG(quota_return));
  +			return;
  +		}
  +		if (strncmp(qlist->name, "STORAGE", 7) == 0)
  +		{
  +			/* this is to add backwards compatibility */
  +			add_assoc_long_ex(IMAPG(quota_return), "usage", sizeof("usage"), qlist->usage);
  +			add_assoc_long_ex(IMAPG(quota_return), "limit", sizeof("limit"), qlist->limit);
  +		}
   
  -	/* this should only be run through once */
  -	for (; qlist; qlist = qlist->next)
  -	{
  -		IMAPG(quota_usage) = qlist->usage;
  -		IMAPG(quota_limit) = qlist->limit;
  +		add_assoc_long_ex(t_map, "usage", sizeof("usage"), qlist->usage);
  +		add_assoc_long_ex(t_map, "limit", sizeof("limit"), qlist->limit);
  +		add_assoc_zval_ex(IMAPG(quota_return), qlist->name, strlen(qlist->name)+1, t_map);
   	}
   }
   /* }}} */
  +
  +/* {{{ mail_getquotaroot
  + *
  + * Mail GET_QUOTAROOT callback
  + * Called via the mail_parameter function in c-client:src/c-client/mail.c
  + * Author DRK
  + */
  +void mail_getquotaroot(MAILSTREAM *stream, char *mbx, STRINGLIST *qroot)
  +{
  +	TSRMLS_FETCH();
  +
  +	add_next_index_stringl(IMAPG(quota_return), mbx, strlen(mbx), 1);
  +	for(; qroot; qroot = qroot->next) {
  +		add_next_index_stringl(IMAPG(quota_return), qroot->text.data, qroot->text.size, 1);
  +	}
  +
  +}
  +/* }}} */
   #endif
   
  +
   /* {{{ php_imap_init_globals
    */
   static void php_imap_init_globals(zend_imap_globals *imap_globals)
  @@ -411,6 +446,9 @@
   	imap_globals->imap_sfolder_objects_tail = NIL;
   
   	imap_globals->folderlist_style = FLIST_ARRAY;
  +#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
  +	imap_globals->quota_return = NULL;
  +#endif
   }
   /* }}} */
   
  @@ -1045,6 +1083,13 @@
   
   	convert_to_string_ex(qroot);
   
  +	MAKE_STD_ZVAL(IMAPG(quota_return));
  +	if (array_init(IMAPG(quota_return)) == FAILURE) {
  +		php_error(E_WARNING, "%s(): Unable to allocate array memory", get_active_function_name(TSRMLS_C));
  +		FREE_ZVAL(IMAPG(quota_return));
  +		RETURN_FALSE;
  +	}
  +
   	/* set the callback for the GET_QUOTA function */
   	mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
   	if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) {
  @@ -1052,13 +1097,43 @@
   		RETURN_FALSE;
   	}
   
  -	if (array_init(return_value) == FAILURE) {
  +	*return_value = *IMAPG(quota_return);
  +	FREE_ZVAL(IMAPG(quota_return));
  +}
  +/* }}} */
  +
  +/* {{{ proto array imap_get_quotaroot(int stream_id, string mbox)
  +	Returns the quota set to the mailbox account mbox */
  +PHP_FUNCTION(imap_get_quotaroot)
  +{
  +	zval **streamind, **mbox;
  +	pils *imap_le_struct;
  +
  +	if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mbox) == FAILURE) {
  +		ZEND_WRONG_PARAM_COUNT();
  +	}
  +
  +	ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
  +
  +	convert_to_string_ex(mbox);
  +
  +	MAKE_STD_ZVAL(IMAPG(quota_return));
  +	if (array_init(IMAPG(quota_return)) == FAILURE) {
   		php_error(E_WARNING, "%s(): Unable to allocate array memory", get_active_function_name(TSRMLS_C));
  +		FREE_ZVAL(IMAPG(quota_return));
   		RETURN_FALSE;
   	}
  -		
  -	add_assoc_long(return_value, "usage", IMAPG(quota_usage));
  -	add_assoc_long(return_value, "limit", IMAPG(quota_limit));
  +
  +	/* set the callback for the GET_QUOTAROOT function */
  +	mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
  +	mail_parameters(NIL, SET_QUOTAROOT, (void *) mail_getquotaroot);
  +	if(!imap_getquotaroot(imap_le_struct->imap_stream, Z_STRVAL_PP(mbox))) {
  +		php_error(E_WARNING, "%s(): c-client imap_getquotaroot failed", get_active_function_name(TSRMLS_C));
  +		RETURN_FALSE;
  +	}
  +
  +	*return_value = *IMAPG(quota_return);
  +	FREE_ZVAL(IMAPG(quota_return));
   }
   /* }}} */
   
  @@ -1087,9 +1162,8 @@
   }
   /* }}} */
   
  -
   /* {{{ proto int imap_setacl(int stream_id, string mailbox, string id, string rights)
  -	Sets the ACL for a giving mailbox */
  +	Sets the ACL for a given mailbox */
   PHP_FUNCTION(imap_setacl)
   {
   	zval **streamind, **mailbox, **id, **rights;
  
  
  
  1.2.2.2   +4 -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.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_imap.h	19 May 2002 11:16:03 -0000	1.2.2.1
  +++ php_imap.h	3 Aug 2002 00:44:13 -0000	1.2.2.2
  @@ -22,11 +22,12 @@
      |          Andrew Skalski      <askal****@cheki*****>                  |
      |          Hartmut Holzgraefe  <hartm****@six*****>                        |
      |          Jani Taskinen       <snipe****@iki*****>                         |
  +   |          Daniel R. Kalowsky  <kalow****@php*****>                      |
      | PHP 4.0 updates:  Zeev Suraski <zeev****@zend*****>                       |
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: php_imap.h,v 1.19 2002/05/12 20:53:25 jon Exp $ */
  +/* $Id: php_imap.h,v 1.22 2002/07/31 01:03:31 kalowsky Exp $ */
   
   #ifndef PHP_IMAP_H
   #define PHP_IMAP_H
  @@ -177,6 +178,7 @@
   
   #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
   PHP_FUNCTION(imap_get_quota);
  +PHP_FUNCTION(imap_get_quotaroot);
   PHP_FUNCTION(imap_set_quota);
   PHP_FUNCTION(imap_setacl);
   #endif
  @@ -208,8 +210,7 @@
   	unsigned long status_uidnext;
   	unsigned long status_uidvalidity;
   #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
  -	unsigned long quota_usage;
  -	unsigned long quota_limit;
  +	zval *quota_return;
   #endif
   ZEND_END_MODULE_GLOBALS(imap)
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +1 -0      php4/ext/informix/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/informix/.cvsignore,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- .cvsignore	29 Apr 2002 02:30:47 -0000	1.2
  +++ .cvsignore	3 Aug 2002 00:44:13 -0000	1.2.2.1
  @@ -2,6 +2,7 @@
   *.lo
   *.la
   .deps
  +.libs
   *.plg
   *.opt
   *.ncb
  
  
  
  1.2.2.2   +114 -114  php4/ext/informix/ifx.ec
  
  Index: ifx.ec
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/informix/ifx.ec,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- ifx.ec	9 Jul 2002 09:14:34 -0000	1.2.2.1
  +++ ifx.ec	3 Aug 2002 00:44:13 -0000	1.2.2.2
  @@ -20,7 +20,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: ifx.ec,v 1.66 2002/06/14 00:01:43 sniper Exp $ */
  +/* $Id: ifx.ec,v 1.68 2002/07/22 08:58:16 sniper Exp $ */
   
   /* -------------------------------------------------------------------
    * if you want a function reference : "grep '^\*\*' ifx.ec" will give
  @@ -62,7 +62,7 @@
   /* local function prototypes */
   static void php_ifx_set_default_link(int id TSRMLS_DC);
   static long php_intifx_getType(long id, HashTable *list TSRMLS_DC);
  -static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list);
  +static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC);
   static long php_intifx_free_blob(long id, HashTable *list TSRMLS_DC);
   static long php_intifx2_free_blob(long id, HashTable *list TSRMLS_DC);
   static long php_intifx_get_blob(long bid, HashTable *list, char** content TSRMLS_DC);
  @@ -71,7 +71,7 @@
   static char* php_intifx_create_tmpfile(long bid TSRMLS_DC);
   static long php_intifx_copy_blob(long bid, HashTable *list TSRMLS_DC);
   static char* php_intifx_null(TSRMLS_D);
  -static long php_intifx_create_char(char* param, long len, HashTable *list);
  +static long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC);
   static long php_intifx_free_char(long id, HashTable *list TSRMLS_DC);
   static long php_intifx_update_char(long bid, char* param, long len, HashTable *list TSRMLS_DC);
   static long php_intifx_get_char(long bid, HashTable *list, char** content TSRMLS_DC);
  @@ -112,7 +112,7 @@
           {                                   \
               if (ifx_check() < 0) {          \
                   IFXG(sv_sqlcode) = SQLCODE; \
  -                php_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); \
  +                php_error(E_WARNING, "%s(): Set connection %s fails (%s)", get_active_function_name(TSRMLS_C), ifx, ifx_error(ifx)); \
                   RETURN_FALSE;               \
               }                               \
           }    
  @@ -418,7 +418,7 @@
   
   	if (PG(sql_safe_mode)) {
   		if (ZEND_NUM_ARGS()>0) {
  -			php_error(E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
  +			php_error(E_NOTICE, "%s(): SQL safe mode in effect - ignoring host/user/password information", get_active_function_name(TSRMLS_C));
   		}
   		host = passwd = NULL;
   		user = php_get_current_user();
  @@ -490,12 +490,12 @@
   			list_entry new_le;
   
   			if (IFXG(max_links)!=-1 && IFXG(num_links) >= IFXG(max_links)) {
  -				php_error(E_WARNING, "Informix: Too many open links (%d)", IFXG(num_links));
  +				php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), IFXG(num_links));
   				efree(hashed_details);
   				RETURN_FALSE;
   			}
   			if (IFXG(max_persistent)!=-1 && IFXG(num_persistent) >= IFXG(max_persistent)) {
  -				php_error(E_WARNING, "Informix: Too many open persistent links (%d)", IFXG(num_persistent));
  +				php_error(E_WARNING, "%s(): Too many open persistent links (%d)", get_active_function_name(TSRMLS_C), IFXG(num_persistent));
   				efree(hashed_details);
   				RETURN_FALSE;
   			}
  @@ -509,7 +509,7 @@
   	
   			if (ifx_check() == IFX_ERROR) {
   				IFXG(sv_sqlcode) = SQLCODE;
  -				php_error(E_WARNING,ifx_error(ifx));
  +				php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   				free(ifx);
   				efree(hashed_details);
   				RETURN_FALSE;
  @@ -539,7 +539,7 @@
   				
   				if (ifx_check() == IFX_ERROR) {
   					IFXG(sv_sqlcode) = SQLCODE;
  -					php_error(E_WARNING, "Informix: Link to server lost, unable to reconnect (%s)", ifx_error(ifx));
  +					php_error(E_WARNING, "%s(): Link to server lost, unable to reconnect (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   					zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
   					efree(hashed_details);
   					RETURN_FALSE;
  @@ -577,7 +577,7 @@
   
   					if (ifx_check() == IFX_ERROR) {
   						IFXG(sv_sqlcode) = SQLCODE;
  -						php_error(E_WARNING,"Informix: Unable to connect (%s)", ifx_error(ifx));
  +						php_error(E_WARNING, "%s(): Unable to connect (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   						zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
   						efree(hashed_details);
   						RETURN_FALSE;
  @@ -594,7 +594,7 @@
   			}
   		}
   		if (IFXG(max_links) != -1 && IFXG(num_links) >= IFXG(max_links)) {
  -			php_error(E_WARNING, "Informix: Too many open links (%d)", IFXG(num_links));
  +			php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), IFXG(num_links));
   			efree(hashed_details);
   			RETURN_FALSE;
   		}
  @@ -607,7 +607,7 @@
   
   		if (ifx_check() == IFX_ERROR) {
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING,"ifx_connect: %s", ifx_error(ifx));
  +			php_error(E_WARNING,"%s(): %s", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   			efree(hashed_details);
   			efree(ifx);
   			RETURN_FALSE;
  @@ -781,7 +781,7 @@
   	EXEC SQL PREPARE :statemid FROM :statement;
   	if (ifx_check() < 0) {
   		IFXG(sv_sqlcode) = SQLCODE;
  -		php_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx));
  +		php_error(E_WARNING, "%s(): Prepare fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   		RETURN_FALSE;
   	}
   
  @@ -791,7 +791,7 @@
   	EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 384;
   	if (ifx_check() < 0) {
   		IFXG(sv_sqlcode) = SQLCODE;
  -		php_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
  +		php_error(E_WARNING, "%s(): Allocate desciptor <%s> fails (%s)", get_active_function_name(TSRMLS_C), descrpid, ifx_error(ifx));
   		EXEC SQL free :statemid;
   		RETURN_FALSE;
   	}
  @@ -799,7 +799,7 @@
   	EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
   	if (ifx_check() < 0) {
   		IFXG(sv_sqlcode) = SQLCODE;
  -		php_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx));
  +		php_error(E_WARNING, "%s(): Describe fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   		EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   		EXEC SQL free :statemid;
   		RETURN_FALSE;
  @@ -809,7 +809,7 @@
   
   	Ifx_Result = (IFX_RES *) emalloc(sizeof(IFX_RES));
   	if (Ifx_Result == NULL) { 
  -		php_error(E_WARNING,"Out of memory allocating IFX_RES");
  +		php_error(E_WARNING, "%s(): Out of memory allocating IFX_RES", get_active_function_name(TSRMLS_C));
   		EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   		EXEC SQL free :statemid;
   		RETURN_FALSE;
  @@ -857,7 +857,7 @@
   				EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   				EXEC SQL free :statemid;
   				efree(Ifx_Result);
  -				php_error(E_WARNING,"Can't get blob array param");
  +				php_error(E_WARNING, "%s(): Can't get blob array param", get_active_function_name(TSRMLS_C));
   				RETURN_FALSE;
   			}
   			if (Z_TYPE_PP(pblobidarr) != IS_ARRAY) {
  @@ -865,7 +865,7 @@
   				EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   				EXEC SQL free :statemid;
   				efree(Ifx_Result);
  -				php_error(E_WARNING,"blob-parameter is not an array");
  +				php_error(E_WARNING, "%s(): Blob-parameter is not an array", get_active_function_name(TSRMLS_C));
   				RETURN_FALSE;
   			}
   
  @@ -887,7 +887,7 @@
   							EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   							EXEC SQL free :statemid;
   							efree(Ifx_Result);
  -							php_error(E_WARNING,"%d is not a Informix blob-result index", (int)((*tmp)->value.lval));
  +							php_error(E_WARNING,"%s(): %d is not an Informix blob-result index", get_active_function_name(TSRMLS_C), (int)((*tmp)->value.lval));
   							RETURN_FALSE;
   						}
   						if(locator->loc_loctype==LOCFNAME) {
  @@ -925,7 +925,7 @@
   			EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   			EXEC SQL free :statemid;
   			efree(Ifx_Result);
  -			php_error(E_WARNING,"Execute immediate fails : %s (%s)", statement, ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Execute immediate fails : %s (%s)", get_active_function_name(TSRMLS_C), statement, ifx_error(ifx));
   			RETURN_FALSE;
   		}
   		Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
  @@ -962,7 +962,7 @@
   			EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   			EXEC SQL free :statemid;
   			efree(Ifx_Result);
  -			php_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Can not get descriptor %s (%s)", get_active_function_name(TSRMLS_C), descrpid, ifx_error(ifx));
   			RETURN_FALSE;
   		}
   
  @@ -995,7 +995,7 @@
   			EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   			EXEC SQL free :statemid;
   			efree(Ifx_Result);
  -			php_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Declare cursor fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   			RETURN_FALSE;
   		}
   
  @@ -1006,7 +1006,7 @@
   			EXEC SQL free :statemid;
   			EXEC SQL free :cursorid;
   			efree(Ifx_Result);
  -			php_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Open cursor fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   			RETURN_FALSE;
   		}
   		strcpy(Ifx_Result->cursorid, cursorid);
  @@ -1024,17 +1024,17 @@
   			) {
   				int bid = 0;
   				if(fieldtype==SQLTEXT) {
  -					bid=php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list));
  +					bid=php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list) TSRMLS_CC);
   					locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
   					EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
   				}
   				if(fieldtype==SQLBYTES) {
   					if(IFXG(blobinfile)==0) {
  -						bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list));
  +						bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list) TSRMLS_CC);
   						locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
   					} else {
   						blobfilename=php_intifx_create_tmpfile(i TSRMLS_CC);
  -						bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE, blobfilename,strlen(blobfilename),&EG(regular_list));
  +						bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE, blobfilename,strlen(blobfilename),&EG(regular_list) TSRMLS_CC);
   						locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
   						locator->loc_oflags=LOC_WONLY;
   					}
  @@ -1131,7 +1131,7 @@
   	EXEC SQL PREPARE :statemid FROM :statement;
   	if (ifx_check() < 0) {
   		IFXG(sv_sqlcode) = SQLCODE;
  -		php_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx));
  +		php_error(E_WARNING, "%s(): Prepare fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   		RETURN_FALSE;
   	}
   
  @@ -1141,7 +1141,7 @@
   	EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 384;
   	if (ifx_check() < 0) {
   		IFXG(sv_sqlcode) = SQLCODE;
  -		php_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
  +		php_error(E_WARNING, "%s(): Allocate desciptor <%s> fails (%s)", get_active_function_name(TSRMLS_C), descrpid, ifx_error(ifx));
   		EXEC SQL free :statemid;
   		RETURN_FALSE;
   	}
  @@ -1149,7 +1149,7 @@
   	EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
   	if (ifx_check() < 0) {
   		IFXG(sv_sqlcode) = SQLCODE;
  -		php_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx));
  +		php_error(E_WARNING, "%s(): Describe fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   		EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   		EXEC SQL free :statemid;
   		RETURN_FALSE;
  @@ -1160,7 +1160,7 @@
   	Ifx_Result = (IFX_RES *) emalloc(sizeof(IFX_RES));
   	if (Ifx_Result == NULL) { 
   		IFXG(sv_sqlcode) = SQLCODE;
  -		php_error(E_WARNING,"Out of memory allocating IFX_RES");
  +		php_error(E_WARNING, "%s(): Out of memory allocating IFX_RES", get_active_function_name(TSRMLS_C));
   		EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   		EXEC SQL free :statemid;
   		RETURN_FALSE;
  @@ -1209,7 +1209,7 @@
   				EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   				EXEC SQL free :statemid;
   				efree(Ifx_Result);
  -				php_error(E_WARNING,"Can't get blob array param");
  +				php_error(E_WARNING,"%s(): Can't get blob array param", get_active_function_name(TSRMLS_C));
   				RETURN_FALSE;
   			}
   
  @@ -1218,7 +1218,7 @@
   				EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   				EXEC SQL free :statemid;
   				efree(Ifx_Result);
  -				php_error(E_WARNING,"blob-parameter not an array");
  +				php_error(E_WARNING, "%s(): Blob-parameter not an array", get_active_function_name(TSRMLS_C));
   				RETURN_FALSE;
   			} 
   
  @@ -1240,7 +1240,7 @@
   							EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   							EXEC SQL free :statemid;
   							efree(Ifx_Result);
  -							php_error(E_WARNING,"%d is not a Informix blob-result index", (int)((*tmp)->value.lval));
  +							php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), (int)((*tmp)->value.lval));
   							RETURN_FALSE;
   						}
   						if(locator->loc_loctype==LOCFNAME) {
  @@ -1306,7 +1306,7 @@
   			EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
   			EXEC SQL free :statemid;
   			efree(Ifx_Result);
  -			php_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Can not get descriptor %s (%s)", get_active_function_name(TSRMLS_C), descrpid, ifx_error(ifx));
   			RETURN_FALSE;
   		}
   		Ifx_Result->numcols = fieldcount;
  @@ -1379,7 +1379,7 @@
   	PHP_IFX_CHECK_CONNECTION(ifx);
   	
   	if (Ifx_Result->iscursory < 0) {
  -		php_error(E_WARNING, "Resultindex %d is not a prepared query", Z_LVAL_PP(result));
  +		php_error(E_WARNING, "%s(): Resultindex %d is not a prepared query", get_active_function_name(TSRMLS_C), Z_LVAL_PP(result));
   		RETURN_FALSE;
   	}
   
  @@ -1391,7 +1391,7 @@
   		}
   		if (ifx_check() < 0) {
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING,"Execute immediate fails : %s ", ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Execute immediate fails: %s", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   			RETURN_FALSE;
   		}
   		Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
  @@ -1413,14 +1413,14 @@
   
   		if (ifx_check() < 0) {
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Declare cursor fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   			RETURN_FALSE;
   		}
   
   		EXEC SQL OPEN :cursorid;
   		if (ifx_check() < 0) {
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Open cursor fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
   			RETURN_FALSE;
   		}
   
  @@ -1436,17 +1436,17 @@
   
   				int bid = 0;
   				if(fieldtype==SQLTEXT) {
  -					bid=php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list));
  +					bid=php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list) TSRMLS_CC);
   					locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
   					EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
   				}
   				if(fieldtype==SQLBYTES) {
   					if(IFXG(blobinfile)==0) {
  -						bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list));
  +						bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list) TSRMLS_CC);
   						locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
   					} else {
   						blobfilename=php_intifx_create_tmpfile(i TSRMLS_CC);
  -						bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE,blobfilename,strlen(blobfilename),&EG(regular_list));
  +						bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE,blobfilename,strlen(blobfilename),&EG(regular_list) TSRMLS_CC);
   						locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
   						locator->loc_oflags=LOC_WONLY;
   					}
  @@ -1682,7 +1682,7 @@
   	IFXG(sv_sqlcode) = 0;
   
   	if (strcmp(Ifx_Result->cursorid,"") == 0) {
  -		php_error(E_WARNING,"Not a select cursor !");
  +		php_error(E_WARNING, "%s(): Not a select cursor!", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	
  @@ -1716,7 +1716,7 @@
   			} else if (!strcasecmp(fetch_pos,"CURRENT")) {
   				EXEC SQL FETCH CURRENT  :cursorid USING SQL DESCRIPTOR :descrpid;
   			} else {
  -				php_error(E_WARNING, "invalid positioning arg on fetch");
  +				php_error(E_WARNING, "%s(): Invalid positioning arg on fetch", get_active_function_name(TSRMLS_C));
   			}
   		}
   	}  
  @@ -1725,7 +1725,7 @@
   		switch (ifx_check()) {
   			case IFX_ERROR:
   				IFXG(sv_sqlcode) = SQLCODE;
  -				php_error(E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_error(ifx), cursorid);
  +				php_error(E_WARNING, "%s(): Can not fetch row on cursor %s (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx), cursorid);
   				RETURN_FALSE;
   				break;
   			case IFX_NODATA:
  @@ -1752,7 +1752,7 @@
   
   		if (ifx_check() < 0) {
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
   			RETURN_FALSE;
   		}
   
  @@ -1850,7 +1850,7 @@
   				fieldleng=ifx_var_getlen(&lvar_tmp);
    				if (fieldleng > 2) fieldleng -= 2; /* fix by Alex Shepherd */
   				if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
  -					php_error(E_WARNING, "Out of memory");
  +					php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C));
   					RETURN_FALSE;
   				}
   				memcpy(char_data,ifx_var_getdata(&lvar_tmp),fieldleng);
  @@ -1864,7 +1864,7 @@
   			case SQLCHAR     :
   			case SQLNCHAR    :
   				if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
  -					php_error(E_WARNING, "Out of memory");
  +					php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C));
   					RETURN_FALSE;
   				}
   				EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA;
  @@ -1919,7 +1919,7 @@
   				}
   		
   				if (locator_b->loc_status < 0) {  /* blob too large */   
  -					php_error(E_WARNING,"no memory (%d bytes) for blob", locator_b->loc_bufsize);
  +					php_error(E_WARNING, "%s(): No memory (%d bytes) for blob", get_active_function_name(TSRMLS_C), locator_b->loc_bufsize);
   					RETURN_FALSE;
   				}
   		
  @@ -2048,7 +2048,7 @@
   	ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
   
   	if (strcmp(Ifx_Result->cursorid,"") == 0) {
  -		php_error(E_WARNING,"Not a select cursor !");
  +		php_error(E_WARNING, "%s(): Not a select cursor!", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -2066,7 +2066,7 @@
   	switch (ifx_check()) {
   		case IFX_ERROR:
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
  +			php_error(E_WARNING, "%s(): Can not fetch next row on cursor %s (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx), cursorid);
   			RETURN_FALSE;
   			break;
   		case IFX_NODATA:
  @@ -2096,7 +2096,7 @@
   		EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME;
   		if (ifx_check() < 0) {
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
   			RETURN_FALSE;
   		}
   
  @@ -2123,7 +2123,7 @@
   
   			if (ifx_check() < 0) {
   				IFXG(sv_sqlcode) = SQLCODE;
  -				php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
  +				php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
   				RETURN_FALSE;
   			}
   		
  @@ -2202,7 +2202,7 @@
   					if (fieldleng > 2) fieldleng -= 2; /* fix by Alex Shepherd */
   
   					if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
  -						php_error(E_WARNING, "Out of memory");
  +						php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C));
   						RETURN_FALSE;
   					}
   					memcpy(char_data,ifx_var_getdata(&lvar_tmp),fieldleng);
  @@ -2216,7 +2216,7 @@
   				case SQLNCHAR   :
   				case SQLNVCHAR  :
   					if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
  -						php_error(E_WARNING, "Out of memory");
  +						php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C));
   						RETURN_FALSE;
   					}
   					EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA;
  @@ -2252,7 +2252,7 @@
   						}
   					}
   					if (locator_b->loc_status < 0) {  /* blob too large */   
  -						php_error(E_WARNING,"no memory (%d bytes) for blob", locator_b->loc_bufsize);
  +						php_error(E_WARNING, "%s(): Not enough memory (%d bytes) for blob", get_active_function_name(TSRMLS_C), locator_b->loc_bufsize);
   						RETURN_FALSE;
   					}
   
  @@ -2265,7 +2265,7 @@
   						/* need an extra byte for string terminator */
   						copy_content = malloc(lg + 1);
   						if (copy_content == NULL) {
  -							php_error(E_WARNING,"no memory for TEXT column");
  +							php_error(E_WARNING, "%s(): Not enough memory for TEXT column", get_active_function_name(TSRMLS_C));
   							RETURN_FALSE;
   						}
   						memcpy(copy_content, content, lg);
  @@ -2292,7 +2292,7 @@
   		switch (ifx_check()) {
   			case IFX_ERROR:
   				IFXG(sv_sqlcode) = SQLCODE;
  -				php_error(E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
  +				php_error(E_WARNING, "%s(): Can not fetch next row on cursor %s (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx), cursorid);
   				RETURN_FALSE;
   				break;
   			case IFX_NODATA:
  @@ -2348,7 +2348,7 @@
   	ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
   
   	if (strcmp(Ifx_Result->cursorid,"") == 0) {
  -		php_error(E_WARNING,"Not a select cursor !");
  +		php_error(E_WARNING, "%s(): Not a select cursor!", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -2369,7 +2369,7 @@
   		EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, :fieldtype = TYPE;
   		if (ifx_check() < 0) {
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
   			RETURN_FALSE;
   		}
   
  @@ -2506,7 +2506,7 @@
   	ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
   
   	if (strcmp(Ifx_Result->cursorid,"") == 0) {
  -		php_error(E_WARNING,"Not a select cursor !");
  +		php_error(E_WARNING, "%s(): Not a select cursor!", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -2534,7 +2534,7 @@
   
   		if (ifx_check() < 0) {
   			IFXG(sv_sqlcode) = SQLCODE;
  -			php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
  +			php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
   			RETURN_FALSE;
   		}
   		
  @@ -2797,7 +2797,7 @@
   
   	Ifx_res = (IFX_IDRES *) zend_list_find(id,&type);
   	if (type!=le_idresult) {
  -		php_error(E_WARNING,"%d is not a Informix id-result index", id);
  +		php_error(E_WARNING, "%s(): %d is not a Informix id-result index", get_active_function_name(TSRMLS_C), id);
   		return -1;
   	}
   	return Ifx_res->type;
  @@ -2841,7 +2841,7 @@
   		mode=BLMODE_INFILE;
   	}
   
  -	id=php_intifx_create_blob(type,mode,Z_STRVAL_P(pparam),Z_STRLEN_P(pparam),&EG(regular_list)); 
  +	id=php_intifx_create_blob(type,mode,Z_STRVAL_P(pparam),Z_STRLEN_P(pparam),&EG(regular_list) TSRMLS_CC); 
   
   	if(id < 0) {
   		RETURN_FALSE;
  @@ -2852,7 +2852,7 @@
   
   /* ----------------------------------------------------------------------
    * internal function
  - * long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list)
  + * long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC)
    *
    * creates an blob-object
    *  type: 1=TEXT, 0=BYTE
  @@ -2864,13 +2864,13 @@
    * return -1 on error otherwise the new Blob-Object-id
    * ----------------------------------------------------------------------
   */
  -static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list) 
  +static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC) 
   {
   	IFX_IDRES *Ifx_blob;
   
   	Ifx_blob=emalloc(sizeof(IFX_IDRES));
   	if(Ifx_blob==NULL) {
  -		php_error(E_WARNING,"can't create blob-resource");
  +		php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
   		return -1;
   	}
   	
  @@ -2887,7 +2887,7 @@
   		if(len>=0) {
   			char *content=emalloc(len);
   			if(content==NULL) {
  -				php_error(E_WARNING,"can't create blob-resource");
  +				php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
   				return -1;
   			}
   			memcpy(content,param,len);
  @@ -2908,7 +2908,7 @@
   	} else { /* mode = BLMODE_INFILE */
   		char *filename=emalloc(len+1);
   		if(filename==NULL)  {
  -			php_error(E_WARNING,"can't create blob-resource");
  +			php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
   			return -1;
   		}
   		memcpy(filename,param,len);
  @@ -2970,13 +2970,13 @@
   
   	Ifx_blob_orig = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult || !(Ifx_blob_orig->type==TYPE_BLBYTE || Ifx_blob_orig->type==TYPE_BLTEXT)) {
  -		php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
  +		php_error(E_WARNING,"%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
   	Ifx_blob=emalloc(sizeof(IFX_IDRES));
   	if(Ifx_blob==NULL) {
  -		php_error(E_WARNING,"can't create blob-resource");
  +		php_error(E_WARNING,"%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
   		return -1;
   	}
   	
  @@ -2992,7 +2992,7 @@
   		char *content;
   		if(locator_orig->loc_size>=0 && locator_orig->loc_buffer!=NULL) {
   			if((content=emalloc(locator_orig->loc_size))==NULL) {
  -				php_error(E_WARNING,"can't create blob-resource");
  +				php_error(E_WARNING,"%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
   				return -1;
   			}
   			memcpy(content,locator_orig->loc_buffer,  locator_orig->loc_size);
  @@ -3011,7 +3011,7 @@
   		char *filename;
   		
   		if((filename=emalloc(strlen(locator_orig->loc_fname)+1))==NULL)  {
  -			php_error(E_WARNING,"can't create blob-resource");
  +			php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
   			return -1;
   		}
   
  @@ -3072,7 +3072,7 @@
   
   	Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
  -		php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
  @@ -3110,7 +3110,7 @@
   
   	Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
  -		php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
  @@ -3183,7 +3183,7 @@
   
   	Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
  -		php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
  @@ -3212,7 +3212,7 @@
   
   	Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
  -		php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
   		return NULL;
   	}
   	return &(Ifx_blob->BLOB.blob_data);
  @@ -3268,7 +3268,7 @@
   
   	Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
  -		php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
  +		php_error(E_WARNING,"%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
  @@ -3280,7 +3280,7 @@
   		}
   		if(len >= 0) {
   			if((content=emalloc(len))==NULL) {
  -				php_error(E_WARNING,"can't create blob-resource");
  +				php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
   				return -1;
   			}
   			memcpy(content,param, len);
  @@ -3301,7 +3301,7 @@
   			efree(Ifx_blob->BLOB.blob_data.loc_fname);
   		}
   		if((filename=emalloc(len+1))==NULL)  {
  -			php_error(E_WARNING,"can't create blob-resource");
  +			php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
   			return -1;
   		}
   		memcpy(filename,param, len);
  @@ -3315,7 +3315,7 @@
   /*-------------------------------------------------
    * internal function
    *
  - * php_intifx_create_tmpfile(long bid)
  + * php_intifx_create_tmpfile(long bid TSRMLS_DC)
    * creates a temporary file to store a blob in 
    *-------------------------------------------------
   */
  @@ -3485,7 +3485,7 @@
   	}
   	convert_to_string(pparam);
   
  -	id=php_intifx_create_char(Z_STRVAL_P(pparam),Z_STRLEN_P(pparam),&EG(regular_list)); 
  +	id=php_intifx_create_char(Z_STRVAL_P(pparam),Z_STRLEN_P(pparam),&EG(regular_list) TSRMLS_CC); 
   	
   	if(id < 0) {
   		RETURN_FALSE;
  @@ -3496,7 +3496,7 @@
   
   /* ----------------------------------------------------------------------
    * internal function
  - * long php_intifx_create_char(char* param, long len, HashTable *list)
  + * long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC)
    *
    * creates an char-object
    *  param: content
  @@ -3505,13 +3505,13 @@
    * return -1 on error otherwise the new char-Object-id
    * ----------------------------------------------------------------------
   */
  -static long php_intifx_create_char(char* param, long len, HashTable *list) 
  +static long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC) 
   {
   	IFX_IDRES *Ifx_char;
   
   	Ifx_char=emalloc(sizeof(IFX_IDRES));
   	if(Ifx_char==NULL) {
  -		php_error(E_WARNING,"can't create char-resource");
  +		php_error(E_WARNING, "%s(): Can't create char-resource", get_active_function_name(TSRMLS_C));
   		return -1;
   	}
   
  @@ -3524,7 +3524,7 @@
   		Ifx_char->CHAR.char_data=emalloc(len+1);
   		if(Ifx_char->CHAR.char_data==NULL) {
   			efree(Ifx_char);
  -			php_error(E_WARNING,"can't create char-resource");
  +			php_error(E_WARNING, "%s(): Can't create char-resource", get_active_function_name(TSRMLS_C));
   			return -1;
   		}
   		memcpy(Ifx_char->CHAR.char_data,param,len);
  @@ -3583,7 +3583,7 @@
   
   	Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult && !(Ifx_char->type==TYPE_CHAR)) {
  -		php_error(E_WARNING,"%d is not a Informix char-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix char-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
  @@ -3636,7 +3636,7 @@
   
   	Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult && !(Ifx_char->type==TYPE_CHAR)) {
  -		php_error(E_WARNING,"%d is not a Informix char-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix char-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
  @@ -3696,7 +3696,7 @@
   
   	Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult && !(Ifx_char->type==TYPE_CHAR)) {
  -		php_error(E_WARNING,"%d is not a Informix char-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix char-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
  @@ -3712,7 +3712,7 @@
   	} else {
   		Ifx_char->CHAR.char_data=emalloc(len+1);
   		if(Ifx_char->CHAR.char_data==NULL) {
  -			php_error(E_WARNING,"can't create char-resource");
  +			php_error(E_WARNING, "%s(): Can't create char-resource", get_active_function_name(TSRMLS_C));
   			return -1;
   		}
   		memcpy(Ifx_char->CHAR.char_data,param,len);
  @@ -3772,7 +3772,7 @@
   
   /* ----------------------------------------------------------------------
    * internal function
  - * long php_intifx_create_slob(long create_mode, HashTable *list)
  + * long php_intifx_create_slob(long create_mode, HashTable *list TSRMLS_DC)
    *
    * creates an slob-object and opens it
    *  mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
  @@ -3780,27 +3780,27 @@
    * return -1 on error otherwise the new Blob-Object-id
    * ----------------------------------------------------------------------
   */
  -static long php_intifxus_create_slob(long create_mode, HashTable *list)
  +static long php_intifxus_create_slob(long create_mode, HashTable *list TSRMLS_DC)
   {
   	IFX_IDRES *Ifx_slob;
   	int errcode;
   	
   	Ifx_slob=emalloc(sizeof(IFX_IDRES));
   	if(Ifx_slob==NULL) {
  -		php_error(E_WARNING,"can't create slob-resource");
  +		php_error(E_WARNING, "%s(): Can't create slob-resource", get_active_function_name(TSRMLS_C));
   		return -1;
   	}
   
   	errcode=ifx_lo_def_create_spec(&(Ifx_slob->SLOB.createspec));
   	if(errcode<0) {
  -		php_error(E_WARNING,"can't create slob-resource: %d", errcode);
  +		php_error(E_WARNING, "%s(): Can't create slob-resource: %d", get_active_function_name(TSRMLS_C), errcode);
   		return -1;
   	}
   
   	Ifx_slob->type=TYPE_SLOB;
   	Ifx_slob->SLOB.lofd=ifx_lo_create(Ifx_slob->SLOB.createspec,create_mode,&(Ifx_slob->SLOB.slob_data),&errcode);
   	if(errcode<0 || Ifx_slob->SLOB.lofd<0) {
  -		php_error(E_WARNING,"can't create slob-resource: %d", errcode);
  +		php_error(E_WARNING, "%s(): Can't create slob-resource: %d", get_active_function_name(TSRMLS_C), errcode);
   		return -1;
   	}
   	return zend_list_insert(Ifx_slob,le_idresult);
  @@ -3851,7 +3851,7 @@
   	
   	Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
  -		php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   	
  @@ -3912,17 +3912,17 @@
   
   	Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
  -		php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   	
   	if(Ifx_slob->SLOB.lofd<0) {
  -		php_error(E_WARNING,"slob-resource already closed");
  +		php_error(E_WARNING, "%s(): Slob-resource already closed", get_active_function_name(TSRMLS_C));
   		return -1;
   	}
   
   	if(ifx_lo_close(Ifx_slob->SLOB.lofd)<0) {
  -		php_error(E_WARNING,"can't close slob-resource");
  +		php_error(E_WARNING, "%s(): Can't close slob-resource", get_active_function_name(TSRMLS_C));
   		return -1;
   	}
   	Ifx_slob->SLOB.lofd=-1;
  @@ -3990,18 +3990,18 @@
   
   	Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
  -		php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
   		return -1;
   	}
   
   	if(Ifx_slob->SLOB.lofd>0) {
  -		php_error(E_WARNING,"slob-resource already open");
  +		php_error(E_WARNING, "%s(): Slob-resource already open", get_active_function_name(TSRMLS_C));
   		return -1;
   	}
   
   	Ifx_slob->SLOB.lofd=ifx_lo_open(&(Ifx_slob->SLOB.slob_data),create_mode,&errcode);
   	if(errcode < 0 || Ifx_slob->SLOB.lofd < 0) {
  -		php_error(E_WARNING,"can't open slob-resource: %d", errcode);
  +		php_error(E_WARNING, "%s(): Can't open slob-resource: %d", get_active_function_name(TSRMLS_C), errcode);
   		return -1;
   	}
   	return 0;
  @@ -4022,7 +4022,7 @@
   
   	Ifx_slob=emalloc(sizeof(IFX_IDRES));
   	if(Ifx_slob==NULL) {
  -		php_error(E_WARNING,"can't create slob-resource");
  +		php_error(E_WARNING, "%s(): Can't create slob-resource", get_active_function_name(TSRMLS_C));
   		return -1;
   	}
   	
  @@ -4048,7 +4048,7 @@
   
   	Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult  || Ifx_slob->type!=TYPE_SLOB) {
  -		php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
   		return NULL;
   	}
   	return &(Ifx_slob->SLOB.slob_data);
  @@ -4082,17 +4082,17 @@
   
   	Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
  -		php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
  +		php_error(E_WARNING,"%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
   		RETURN_FALSE;
   	}
   
   	if(ifx_lo_tell(Ifx_slob->SLOB.lofd,&akt_seek_pos)<0) {
  -		php_error(E_WARNING,"can't perform tell-operation");
  +		php_error(E_WARNING,"%s(): Can't perform tell-operation", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
   	if(ifx_int8tolong(&akt_seek_pos,&lakt_seek_pos)<0) {
  -		php_error(E_WARNING,"seek-position to large for long");
  +		php_error(E_WARNING, "%s(): Seek-position to large for long", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	RETURN_LONG(lakt_seek_pos);
  @@ -4130,7 +4130,7 @@
   	bid=Z_LVAL_P(pbid);
   	Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
  -		php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
   		RETURN_FALSE;
   	}
   
  @@ -4144,12 +4144,12 @@
   
   	ifx_int8cvlong(Z_LVAL_P(poffset),&offset);
   	if(ifx_lo_seek(Ifx_slob->SLOB.lofd,&offset,mode,&akt_seek_pos)<0) {
  -		php_error(E_WARNING,"can't perform seek-operation");
  +		php_error(E_WARNING, "%s(): Can't perform seek-operation", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
   	if(ifx_int8tolong(&akt_seek_pos,&lakt_seek_pos)<0) {
  -		php_error(E_WARNING,"seek-position to large for long");
  +		php_error(E_WARNING, "%s(): Seek-position to large for long", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	RETURN_LONG(lakt_seek_pos);
  @@ -4185,7 +4185,7 @@
   	bid=Z_LVAL_P(pbid);
   	Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
  -		php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
   		RETURN_FALSE;
   	}
   
  @@ -4193,7 +4193,7 @@
   	buffer=emalloc(nbytes);
   	if(ifx_lo_read(Ifx_slob->SLOB.lofd,buffer,nbytes,&errcode)<0) {
   		efree(buffer);
  -		php_error(E_WARNING,"error reading slob: %d", errcode);
  +		php_error(E_WARNING, "%s(): Error reading slob: %d", get_active_function_name(TSRMLS_C), errcode);
   		RETURN_FALSE;
   	}
   	RETURN_STRINGL(buffer,nbytes,0); 
  @@ -4229,7 +4229,7 @@
   	bid=Z_LVAL_P(pbid);
   	Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
   	if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
  -		php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
  +		php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
   		RETURN_FALSE;
   	}
   
  @@ -4237,12 +4237,12 @@
   	nbytes=Z_STRLEN_P(pcontent);
   
   	if(nbytes<=0) {
  -		php_error(E_WARNING,"string has no content");
  +		php_error(E_WARNING, "%s(): String has no content", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
   	if((nbytes=ifx_lo_write(Ifx_slob->SLOB.lofd,buffer,nbytes,&errcode))<0) {
  -		php_error(E_WARNING,"error writing slob: %d", errcode);
  +		php_error(E_WARNING, "%s(): Error writing slob: %d", get_active_function_name(TSRMLS_C), errcode);
   		RETURN_FALSE;
   	}
    
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +70 -74    php4/ext/interbase/interbase.c
  
  Index: interbase.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/interbase/interbase.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- interbase.c	9 Jul 2002 09:14:34 -0000	1.2.2.2
  +++ interbase.c	3 Aug 2002 00:44:14 -0000	1.2.2.3
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: interbase.c,v 1.87 2002/06/26 07:54:50 sas Exp $ */
  +/* $Id: interbase.c,v 1.88 2002/07/19 09:21:29 derick Exp $ */
   
   
   /* TODO: Arrays, roles?
  @@ -213,7 +213,7 @@
   	} else if (Z_TYPE_P(blob_arg) != IS_STRING\
   			 || Z_STRLEN_P(blob_arg) != sizeof(ibase_blob_handle)\
   			 || ((ibase_blob_handle *)(Z_STRVAL_P(blob_arg)))->bl_handle != 0){\
  -		_php_ibase_module_error("invalid blob id");\
  +		_php_ibase_module_error("Invalid blob id");\
   		RETURN_FALSE;\
   	} else {\
   		ib_blob = (ibase_blob_handle *)Z_STRVAL_P(blob_arg);\
  @@ -262,13 +262,12 @@
   }
   /* }}} */
   
  -/* {{{ _php_ibase_error() 
  +/* {{{ _php_ibase_error(TSRMLS_D) 
       print interbase error and save it for ibase_errmsg() */
  -static void _php_ibase_error(void)
  +static void _php_ibase_error(TSRMLS_D)
   {
   	char *s;
   	ISC_STATUS *statusp;
  -	TSRMLS_FETCH();
   
   	s = IBG(errmsg);
   	statusp = IB_STATUS;
  @@ -276,7 +275,7 @@
   		strcat(IBG(errmsg), " ");
   		s = IBG(errmsg) + strlen(IBG(errmsg));
   	}
  -	php_error(E_WARNING, "InterBase: %s", IBG(errmsg));
  +	php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), IBG(errmsg));
   }
   /* }}} */
   
  @@ -292,7 +291,7 @@
   	vsnprintf(IBG(errmsg), MAX_ERRMSG, msg, ap);
   	va_end(ap);
   	
  -	php_error(E_WARNING, "InterBase module: %s", IBG(errmsg));
  +	php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), IBG(errmsg));
   }
   /* }}} */
   
  @@ -330,7 +329,7 @@
   	if (link->trans[0] != NULL) { /* commit default */
   		IBDEBUG("Committing default transaction...");
   		if (isc_commit_transaction(IB_STATUS, &link->trans[0])) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   		}
   		link->trans[0] = NULL;
   	}
  @@ -338,7 +337,7 @@
   		if (link->trans[i] != NULL) {
   			IBDEBUG("Rolling back other transactions...");
   			if (isc_rollback_transaction(IB_STATUS, &link->trans[i])) {
  -				_php_ibase_error();
  +				_php_ibase_error(TSRMLS_C);
   			}
   			link->trans[i] = NULL;
   		}
  @@ -396,7 +395,7 @@
   		if ( !(IB_STATUS[0] && IB_STATUS[1])  && ib_result->drop_stmt && ib_result->stmt ) {
   			IBDEBUG("Dropping statement handle (free_result)...");
   			if (isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_drop)) {
  -				_php_ibase_error();
  +				_php_ibase_error(TSRMLS_C);
   			}
   		} else {
   			/* Shouldn't be here unless query was select and had parameter
  @@ -438,7 +437,7 @@
   		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();
  +				_php_ibase_error(TSRMLS_C);
   			}
   		}
   		if (ib_query->in_array) {
  @@ -489,7 +488,7 @@
   			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();
  +					_php_ibase_error(TSRMLS_C);
   				}
   				ib_link->trans[ib_trans->trans_num] = NULL;
   			}
  @@ -608,7 +607,7 @@
   
   	php_info_print_table_start();
   	php_info_print_table_row(2, "Interbase Support", "enabled");    
  -	php_info_print_table_row(2, "Revision", "$Revision: 1.87 $");
  +	php_info_print_table_row(2, "Revision", "$Revision: 1.88 $");
   #ifdef COMPILE_DL_INTERBASE
   	php_info_print_table_row(2, "Dynamic Module", "yes");
   #endif
  @@ -692,7 +691,7 @@
   	dpb_length = dpb - dpb_buffer;
   
   	if (isc_attach_database(IB_STATUS, (short) strlen(server), server, db, (short) dpb_length, dpb_buffer)) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		return FAILURE;
   	}
   	return SUCCESS;
  @@ -975,7 +974,7 @@
   				
   				if (isc_array_lookup_bounds(IB_STATUS, &link, &trans,
   											var->relname, var->sqlname, ar_desc)) {
  -					_php_ibase_error();
  +					_php_ibase_error(TSRMLS_C);
   					efree(IB_ARRAY);
   					IB_ARRAY = NULL;
   					return FAILURE;
  @@ -1014,7 +1013,7 @@
   						IB_ARRAY[ar_cnt].el_size = ar_desc->array_desc_length+sizeof(short);
   						break;
   					default:
  -						_php_ibase_module_error("unexpected array type %d in relation '%s' column '%s')",
  +						_php_ibase_module_error("Unexpected array type %d in relation '%s' column '%s'",
   												ar_desc->array_desc_dtype, var->relname, var->sqlname);
   						efree(IB_ARRAY);
   						IB_ARRAY = NULL;
  @@ -1059,7 +1058,7 @@
   	IB_QUERY->dialect = dialect;
   	
   	if (isc_dsql_allocate_statement(IB_STATUS, &link, &IB_QUERY->stmt)) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		goto _php_ibase_alloc_query_error;
   	}
   
  @@ -1068,7 +1067,7 @@
   	IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
   
   	if (isc_dsql_prepare(IB_STATUS, &IB_QUERY->trans, &IB_QUERY->stmt, 0, query, dialect, IB_QUERY->out_sqlda)) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		goto _php_ibase_alloc_query_error;
   	}
   	
  @@ -1078,7 +1077,7 @@
   		IB_QUERY->out_sqlda->sqln = IB_QUERY->out_sqlda->sqld;
   		IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
   		if (isc_dsql_describe(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->out_sqlda)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			goto _php_ibase_alloc_query_error;
   		}
   	}
  @@ -1088,7 +1087,7 @@
   	IB_QUERY->in_sqlda->sqln = 0;
   	IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
   	if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->in_sqlda)) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		goto _php_ibase_alloc_query_error;
   	}
   	
  @@ -1098,7 +1097,7 @@
   		IB_QUERY->in_sqlda->sqln = IB_QUERY->in_sqlda->sqld;
   		IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
   		if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->in_sqlda)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			goto _php_ibase_alloc_query_error;
   		}
   	}
  @@ -1178,7 +1177,7 @@
   			case SQL_SHORT:
   				convert_to_long(b_var);
   				if (Z_LVAL_P(b_var) > SHRT_MAX || Z_LVAL_P(b_var) < SHRT_MIN) {
  -					_php_ibase_module_error("field %*s overflow", var->aliasname_length, var->aliasname);
  +					_php_ibase_module_error("Field %*s overflow", var->aliasname_length, var->aliasname);
   					return FAILURE;
   				}
   				buf[i].val.sval = (short)Z_LVAL_P(b_var);
  @@ -1244,7 +1243,7 @@
   					n = sscanf(Z_STRVAL_P(b_var), "%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d",
   						   &t.tm_mon, &t.tm_mday, &t.tm_year,  &t.tm_hour, &t.tm_min, &t.tm_sec);
   					if(n != 3 && n != 6){
  -						_php_ibase_module_error("invalid date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave '%s'", n, Z_STRVAL_P(b_var));
  +						_php_ibase_module_error("Invalid date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave '%s'", n, Z_STRVAL_P(b_var));
   						return FAILURE;
   					}
   					t.tm_year -= 1900;
  @@ -1311,22 +1310,22 @@
   						ib_blob->bl_handle = NULL;
   						if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
   							efree(ib_blob);
  -							_php_ibase_error();
  +							_php_ibase_error(TSRMLS_C);
   							return FAILURE;
   						}
   						convert_to_string(b_var);
   						if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_P(b_var), Z_STRVAL_P(b_var))) {
  -							_php_ibase_error();
  +							_php_ibase_error(TSRMLS_C);
   							return FAILURE;
   						}
   						if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)) {
  -							_php_ibase_error();
  +							_php_ibase_error(TSRMLS_C);
   							return FAILURE;
   						}
   						ib_blob_id = ib_blob;
   						var->sqldata = (void ISC_FAR *)&ib_blob_id->bl_qd;
   /*
  -						_php_ibase_module_error("invalid blob id string");
  +						_php_ibase_module_error("Invalid blob id string");
   						return FAILURE;
   */
   					} else {
  @@ -1337,7 +1336,7 @@
   				}
   			break;
   			case SQL_ARRAY:
  -				_php_ibase_module_error("binding arrays not supported yet");
  +				_php_ibase_module_error("Binding arrays not supported yet");
   				return FAILURE;
   			break;
   		} /*switch*/
  @@ -1439,21 +1438,21 @@
   	if (ib_query->in_sqlda) { /* has placeholders */
   		IBDEBUG("Query wants XSQLDA for input");
   		if (ib_query->in_sqlda->sqld != argc) {
  -			_php_ibase_module_error("placeholders (%d) and variables (%d) mismatch", ib_query->in_sqlda->sqld, argc);
  +			_php_ibase_module_error("Placeholders (%d) and variables (%d) mismatch", ib_query->in_sqlda->sqld, argc);
   			goto _php_ibase_exec_error;  /* yes mommy, goto! */
   		}
   		in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
   		memcpy(in_sqlda, ib_query->in_sqlda, XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
   		bind_buf = emalloc(sizeof(BIND_BUF) * ib_query->in_sqlda->sqld);
   		if (_php_ibase_bind(in_sqlda, args, bind_buf, ib_query) == FAILURE) {
  -			IBDEBUG("Could not bind input XSQLDA... (_php_ibase_exec)");
  +			IBDEBUG("Could not bind input XSQLDA");
   			goto _php_ibase_exec_error;
   		}
   	}
   
   	if (isc_dsql_execute(IB_STATUS, &ib_query->trans, &ib_query->stmt, ib_query->dialect, in_sqlda)) {
  -		IBDEBUG("Could not execute query... (_php_ibase_exec)");
  -		_php_ibase_error();
  +		IBDEBUG("Could not execute query");
  +		_php_ibase_error(TSRMLS_C);
   		goto _php_ibase_exec_error;
   	}
   
  @@ -1555,12 +1554,12 @@
   		&& ib_link->trans[trans_n]; trans_n++)
   		;
   	if (trans_n == IBASE_TRANS_ON_LINK) {
  -		_php_ibase_module_error("too many transactions on link");
  +		_php_ibase_module_error("Too many transactions on link");
   		RETURN_FALSE;
   	}
   	
   	if (isc_start_transaction(IB_STATUS, &ib_link->trans[trans_n], 1, &ib_link->link, tpb_len, tpbp)) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		RETURN_FALSE;
   	}
   
  @@ -1579,7 +1578,7 @@
   	
   	if (trans_n == 0 && ib_link->trans[0] == NULL) { 
   		if (isc_start_transaction(IB_STATUS, &ib_link->trans[0], 1, &ib_link->link, 0, NULL)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			return FAILURE;
   		}
   	}
  @@ -1621,12 +1620,12 @@
   
   	if (commit) {
   		if (isc_commit_transaction(IB_STATUS, &ib_link->trans[trans_n])) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   	} else {
   		if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[trans_n])) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   	}
  @@ -1694,7 +1693,7 @@
   		query = Z_STRVAL_PP(args[i]);
   		i++; /* next arg */
   	} else {
  -		_php_ibase_module_error("query argument missed");
  +		_php_ibase_module_error("Query argument missed");
   		efree(args);
   		RETURN_FALSE;
   	}
  @@ -1895,7 +1894,7 @@
   	
   
   	if (dim > 16) { /* InterBase limit */
  -		_php_ibase_module_error("php module internal error in %s %d", __FILE__, __LINE__);
  +		_php_ibase_module_error("Too many dimensions");
   		return FAILURE;
   	}
   
  @@ -1968,7 +1967,7 @@
   	ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
   
   	if (ib_result->out_sqlda == NULL) {
  -		_php_ibase_module_error("trying to fetch results from a non-select query");
  +		_php_ibase_module_error("Trying to fetch results from a non-select query");
   		RETURN_FALSE;
   	}
   	
  @@ -1977,7 +1976,7 @@
   	}
   	
   	if (IB_STATUS[0] && IB_STATUS[1]) { /* error in fetch */
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		RETURN_FALSE;
   	}
   	
  @@ -2018,13 +2017,13 @@
   						char bl_items[1], *bl_data, bl_info[20], *p;
   						
   						if (isc_open_blob(IB_STATUS, &ib_result->link, &ib_result->trans, &bl_handle, (ISC_QUAD ISC_FAR *) var->sqldata)) {
  -							_php_ibase_error();
  +							_php_ibase_error(TSRMLS_C);
   							RETURN_FALSE;
   						}
   						
   						bl_items[0] = isc_info_blob_total_length;
   						if (isc_blob_info(IB_STATUS, &bl_handle, sizeof(bl_items), bl_items, sizeof(bl_info), bl_info)) {
  -							_php_ibase_error();
  +							_php_ibase_error(TSRMLS_C);
   							RETURN_FALSE;
   						}
   						
  @@ -2048,20 +2047,20 @@
   							cur_len += seg_len;
   							if (cur_len > max_len) { /* never!*/
   								efree(bl_data);
  -								_php_ibase_module_error("php module internal error in %s %d", __FILE__, __LINE__);
  +								_php_ibase_module_error("PHP module internal error");
   								RETURN_FALSE;
   							}
   						}
   						
   						if (IB_STATUS[0] && IB_STATUS[1] && (IB_STATUS[1] != isc_segstr_eof)) {
   							efree(bl_data);
  -							_php_ibase_error();
  +							_php_ibase_error(TSRMLS_C);
   							RETURN_FALSE;
   						}
   						bl_data[cur_len] = '\0';
   						if (isc_close_blob(IB_STATUS, &bl_handle)) {
   							efree(bl_data);
  -							_php_ibase_error();
  +							_php_ibase_error(TSRMLS_C);
   							RETURN_FALSE;
   						}
   						Z_TYPE_P(tmp) = IS_STRING;
  @@ -2096,7 +2095,7 @@
   					
   					if (isc_array_get_slice(IB_STATUS, &ib_result->link, &ib_result->trans,
   											&ar_qd, &ib_array->ar_desc, ar_data, &ib_array->ar_size)) {
  -						_php_ibase_error();
  +						_php_ibase_error(TSRMLS_C);
   						RETURN_FALSE;
   					}
   					
  @@ -2278,7 +2277,7 @@
   		IBDEBUG("Implicitly closing a cursor");
   		if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_close)){
   			efree(args);
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   		}
   	}
   
  @@ -2318,11 +2317,11 @@
   }
   /* }}} */
   
  +#if HAVE_STRFTIME
   /* {{{ proto int ibase_timefmt(string format)
      Sets the format of timestamp, date and time columns returned from queries */
   PHP_FUNCTION(ibase_timefmt)
   {
  -#if HAVE_STRFTIME
   	pval ***args;
   	char *fmt = NULL;
   	int type = PHP_IBASE_TIMESTAMP;
  @@ -2369,12 +2368,9 @@
       
   	efree(args);
   	RETURN_TRUE;
  -#else
  -	_php_ibase_module_error("ibase_timefmt not supported on this platform");
  -	RETURN_FALSE;
  -#endif
   }
   /* }}} */
  +#endif
   
   /* {{{ proto int ibase_num_fields(int result)
      Get the number of fields in result */
  @@ -2392,7 +2388,7 @@
   	ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result, -1, "InterBase result", le_result);
   
   	if (ib_result->out_sqlda == NULL) {
  -		_php_ibase_module_error("trying to get num fields from a non-select query");
  +		_php_ibase_module_error("Trying to get the number of fields from a non-select query");
   		RETURN_FALSE;
   	}
   
  @@ -2420,7 +2416,7 @@
   	ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
   
   	if (ib_result->out_sqlda == NULL) {
  -		_php_ibase_module_error("trying to get field info from a non-select query");
  +		_php_ibase_module_error("Trying to get field info from a non-select query");
   		RETURN_FALSE;
   	}
   
  @@ -2500,7 +2496,7 @@
   	bl_info->bl_stream = 0;
   
   	if (isc_blob_info(IB_STATUS, &bl_handle, sizeof(bl_items), bl_items, sizeof(bl_inf), bl_inf)) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		return FAILURE;
   	}
   
  @@ -2527,7 +2523,7 @@
   				break;
   			case isc_info_truncated:
   			case isc_info_error:  /* hmm. don't think so...*/
  -				_php_ibase_module_error("php module internal error in %s %d", __FILE__, __LINE__);
  +				_php_ibase_module_error("PHP module internal error");
   				return FAILURE;
   		} /*switch*/
   		p += item_len;
  @@ -2575,7 +2571,7 @@
   	
   	if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
   		efree(ib_blob);
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		RETURN_FALSE;
   	}
   	
  @@ -2611,7 +2607,7 @@
   	ib_blob->bl_handle = NULL;
   	if (isc_open_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
   		efree(ib_blob);
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		RETURN_FALSE;
   	}
   	
  @@ -2637,7 +2633,7 @@
   	convert_to_string(string_arg);
   
   	if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_P(string_arg), Z_STRVAL_P(string_arg))) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		RETURN_FALSE;
   	}
   	RETURN_TRUE;
  @@ -2674,7 +2670,7 @@
   			cur_len += seg_len;
   			if (cur_len > max_len) { /* never!*/
   				efree(bl_data);
  -				_php_ibase_module_error("php module internal error in %s %d", __FILE__, __LINE__);
  +				_php_ibase_module_error("PHP module internal error");
   				RETURN_FALSE;
   			}
   		}
  @@ -2682,7 +2678,7 @@
   		bl_data[cur_len] = '\0';
   		if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof && IB_STATUS[1] != isc_segment)) {
   			efree(bl_data);
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   		RETURN_STRINGL(bl_data, cur_len, 0);
  @@ -2713,7 +2709,7 @@
   	if (bl_end == BLOB_CLOSE) { /* return id here */
   		if (ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low) { /*not null ?*/
   			if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)) {
  -				_php_ibase_error();
  +				_php_ibase_error(TSRMLS_C);
   				RETURN_FALSE;
   			}
   		}
  @@ -2722,7 +2718,7 @@
   		zend_list_delete(Z_LVAL_P(blob_arg));
   	} else { /* discard created blob */
   		if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   		ib_blob->bl_handle = NULL;
  @@ -2771,7 +2767,7 @@
   	if (ib_blob_id->bl_qd.gds_quad_high || ib_blob_id->bl_qd.gds_quad_low) { /*not null ?*/
   		if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
   						  &ib_blob_id->bl_handle, &ib_blob_id->bl_qd)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   
  @@ -2779,7 +2775,7 @@
   			RETURN_FALSE;
   		}
   		if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   		ib_blob_id->bl_handle = NULL;
  @@ -2842,7 +2838,7 @@
   		
   		if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
   						  &ib_blob_id->bl_handle, &ib_blob_id->bl_qd)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   
  @@ -2852,12 +2848,12 @@
   		}
   	
   		if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   
   		if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   		ib_blob_id->bl_handle = NULL;
  @@ -2923,7 +2919,7 @@
   	ib_blob.bl_qd.gds_quad_low = 0;
   	
   	if (isc_create_blob(IB_STATUS, &ib_blob.link, &ib_blob.trans_handle, &ib_blob.bl_handle, &ib_blob.bl_qd)) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		RETURN_FALSE;
   	}
   
  @@ -2931,7 +2927,7 @@
   
   	while(b = php_stream_read(stream, bl_data, sizeof(bl_data)) > 0)	{
   		if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)) {
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			RETURN_FALSE;
   		}
   		size += b;
  @@ -2939,7 +2935,7 @@
   	}
   	
   	if (isc_close_blob(IB_STATUS, &ib_blob.bl_handle)) {
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		RETURN_FALSE;
   	}
   
  @@ -3043,7 +3039,7 @@
   	if (isc_service_attach(IB_STATUS, 0, service_name,
   		&service_handle, spb_length, spb_buffer)) {
   
  -		_php_ibase_error();
  +		_php_ibase_error(TSRMLS_C);
   		RETURN_FALSE;
   	}
   	else {
  @@ -3089,7 +3085,7 @@
   		if (isc_service_start(IB_STATUS, &service_handle,
   			NULL, (unsigned short) (p - request), request)) {
   
  -			_php_ibase_error();
  +			_php_ibase_error(TSRMLS_C);
   			isc_service_detach(IB_STATUS, &service_handle);
   			RETURN_FALSE;
   		}
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +10 -7     php4/ext/ircg/README.txt
  
  Index: README.txt
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ircg/README.txt,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- README.txt	29 Apr 2002 02:30:48 -0000	1.2
  +++ README.txt	3 Aug 2002 00:44:14 -0000	1.2.2.1
  @@ -2,7 +2,7 @@
   
   *** IMPORTANT WARNING ***
   
  -IRCG WILL NOT WORK WITH APACHE OR ANY OTHER WEB-SERVERS
  +IRCG WILL NOT WORK WITH APACHE OR ANY OTHER WEB SERVERS
   OTHER THAN THOSE DESCRIBED BELOW.
   
   PLEASE DO NOT SEND ENQUIRIES TO THE AUTHOR BY ANY MEANS
  @@ -15,7 +15,7 @@
   
   
   
  -($Id: README.txt,v 1.14 2002/04/05 06:13:07 sas Exp $)
  +($Id: README.txt,v 1.15 2002/07/16 16:24:12 sas Exp $)
   
   STATUS
   
  @@ -32,7 +32,7 @@
   
       http://schumann.cx/ircg/install_ircg.sh
   
  -2.  Edit some variables at the top of that script:
  +2.  You can edit some variables at the top of that script, if necessary:
   
       prefix
           The directory where all software is installed in.  Note that
  @@ -51,13 +51,16 @@
           On Solaris 2.x, this is the output of "uname -r" minus 3
           (e.g. 5.8 becomes 2.8).
   
  -    thttpd, IRCG, st    (usually don't need to be changed)
  -        Version numbers of the respective software package which
  -        are known to work.  Please _don't_ change.
  -
       make
           The name of GNU make on your system (some packages depend
           on it).
  +
  +    thttpd, IRCG, st    (usually don't need to be changed)
  +        Version numbers of the respective software package which
  +        are known to work.  Please _don't_ change.
  +        If you change "thttpd", ensure that PHP indeed supports
  +        that version.  Currently, only thttpd 2.21b and no later/earlier
  +        version are supported.
   
   3.  Run
   
  
  
  
  1.2.2.2   +3 -3      php4/ext/ircg/ircg.c
  
  Index: ircg.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ircg/ircg.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- ircg.c	9 Jul 2002 09:14:34 -0000	1.2.2.1
  +++ ircg.c	3 Aug 2002 00:44:14 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: ircg.c,v 1.132 2002/06/29 18:46:49 sas Exp $ */
  +/* $Id: ircg.c,v 1.133 2002/07/19 09:27:22 derick Exp $ */
   
   /* {{{ includes */
   
  @@ -1294,7 +1294,7 @@
   	if (!conn) RETURN_FALSE;
   
   	if (conn->fd != -1) {
  -		php_error(E_WARNING, "ircg_set_file was used AFTER ircg_set_current. You must set the output filename before opening the persistent HTTP connection which is kept alive.");
  +		php_error(E_WARNING, "%s(): Called after a call to ircg_set_current(). You must set the output filename before opening the persistent HTTP connection which is kept alive.", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -1727,7 +1727,7 @@
   	convert_to_string_ex(p1);	
   
   	if (Z_TYPE_PP(p2) != IS_ARRAY) {
  -		php_error(E_WARNING, "The second parameter should be an array");
  +		php_error(E_WARNING, "%s(): The second parameter should be an array", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +3 -3      php4/ext/java/Makefile.frag
  
  Index: Makefile.frag
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/java/Makefile.frag,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Makefile.frag	29 Apr 2002 02:30:49 -0000	1.2
  +++ Makefile.frag	3 Aug 2002 00:44:14 -0000	1.2.2.1
  @@ -2,12 +2,12 @@
   $(srcdir)/java.c : $(srcdir)/php_java.jar
   
   $(srcdir)/php_java.jar : $(srcdir)/reflect.java
  -	$(mkinstalldirs) $(srcdir)/net/php
  +	@$(mkinstalldirs) $(srcdir)/net/php
   	@cp $(srcdir)/reflect.java $(srcdir)/net/php
   	@echo library=php_java > $(srcdir)/net/php/reflect.properties
  -	$(JAVA_C) $(srcdir)/net/php/reflect.java
  +	@$(JAVA_C) $(srcdir)/net/php/reflect.java
   	@test ! -f reflect.class || mv reflect.class $(srcdir)/net/php # bug in KJC javac
  -	$(JAVA_JAR) $(srcdir)/php_java.jar $(srcdir)/net/php/*.class $(srcdir)/net/php/*.properties
  +	@$(JAVA_JAR) $(srcdir)/php_java.jar $(srcdir)/net/php/*.class $(srcdir)/net/php/*.properties
   	@rm $(srcdir)/net/php/reflect.*
   	@rmdir $(srcdir)/net/php
   	@rmdir $(srcdir)/net
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +8 -2      php4/ext/ldap/ldap.c
  
  Index: ldap.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ldap/ldap.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- ldap.c	9 Jul 2002 09:14:34 -0000	1.2.2.2
  +++ ldap.c	3 Aug 2002 00:44:14 -0000	1.2.2.3
  @@ -22,7 +22,7 @@
      +----------------------------------------------------------------------+
    */
    
  -/* $Id: ldap.c,v 1.124 2002/06/30 11:14:27 derick Exp $ */
  +/* $Id: ldap.c,v 1.125 2002/07/09 20:54:49 venaas Exp $ */
   #define IS_EXT_MODULE
   
   #ifdef HAVE_CONFIG_H
  @@ -226,7 +226,9 @@
   	REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS);
   	REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS);
   	REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS);
  +#ifdef LDAP_OPT_RESTART
   	REGISTER_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS);
  +#endif
   	REGISTER_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS);
   	REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS);
   #ifdef LDAP_OPT_MATCHED_DN
  @@ -276,7 +278,7 @@
   
   	php_info_print_table_start();
   	php_info_print_table_row(2, "LDAP Support", "enabled" );
  -	php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.124 2002/06/30 11:14:27 derick Exp $" );
  +	php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.125 2002/07/09 20:54:49 venaas Exp $" );
   
   	if (LDAPG(max_links) == -1) {
   		snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
  @@ -1641,7 +1643,9 @@
   	case LDAP_OPT_PROTOCOL_VERSION:
   	case LDAP_OPT_ERROR_NUMBER:
   	case LDAP_OPT_REFERRALS:
  +#ifdef LDAP_OPT_RESTART
   	case LDAP_OPT_RESTART:
  +#endif
   		{
   			int val;
   			if (ldap_get_option(ld->link, opt, &val)) {
  @@ -1736,7 +1740,9 @@
   		} break;
   		/* options with boolean value */
   	case LDAP_OPT_REFERRALS:
  +#ifdef LDAP_OPT_RESTART
   	case LDAP_OPT_RESTART:
  +#endif
   		{
   			void *val;
   			convert_to_boolean_ex(newval);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.5   +13 -11    php4/ext/mbstring/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/config.m4,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- config.m4	9 Jul 2002 09:14:34 -0000	1.2.2.4
  +++ config.m4	3 Aug 2002 00:44:14 -0000	1.2.2.5
  @@ -1,15 +1,9 @@
   dnl
  -dnl $Id: config.m4,v 1.16 2002/06/06 12:44:28 sniper Exp $
  +dnl $Id: config.m4,v 1.21 2002/07/17 06:01:37 sniper Exp $
   dnl
   
  -PHP_ARG_ENABLE(mbstr_enc_trans, whether to enable encoding translation,
  -[  --enable-mbstr-enc-trans Enable encoding translation], yes)
  -
  -PHP_ARG_ENABLE(mbregex, whether to enable multibyte regex support,
  -[  --enable-mbregex         Enable multibyte regex support], yes)
  -
   PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support,
  -[  --disable-mbstring       Disable multibyte string support], yes)
  +[  --disable-mbstring      Disable multibyte string support], yes)
   
   if test "$PHP_MBSTRING" != "no"; then  
     AC_DEFINE(HAVE_MBSTRING,1,[whether to have multibyte string support])
  @@ -41,10 +35,18 @@
     PHP_MBSTR_ENC_TRANS=no
   fi
   
  -if test "$PHP_MBSTR_ENC_TRANS" != "no" ; then
  -  AC_DEFINE(MBSTR_ENC_TRANS, 1, [whether to have encoding translation])
  -fi
  +
  +PHP_ARG_ENABLE(mbregex, whether to enable multibyte regex support,
  +[  --disable-mbregex         Disable multibyte regex support], yes)
   
   if test "$MBREGEX" != "no" ; then
     AC_DEFINE(HAVE_MBREGEX, 1, [whether to have multibyte regex support])
   fi
  +
  +PHP_ARG_ENABLE(mbstr_enc_trans, whether to enable encoding translation,
  +[  --enable-mbstr-enc-trans  Enable input encoding translation], no)
  +
  +if test "$PHP_MBSTR_ENC_TRANS" != "no" ; then
  +  AC_DEFINE(MBSTR_ENC_TRANS, 1, [whether to have encoding translation])
  +fi
  +
  
  
  
  1.2.2.5   +249 -239  php4/ext/mbstring/Attic/mbfilter.c
  
  Index: mbfilter.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/Attic/mbfilter.c,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- mbfilter.c	9 Jul 2002 09:14:34 -0000	1.2.2.4
  +++ mbfilter.c	3 Aug 2002 00:44:14 -0000	1.2.2.5
  @@ -79,7 +79,7 @@
    *
    */
   
  -/* $Id: mbfilter.c,v 1.34 2002/06/22 08:01:57 dets Exp $ */
  +/* $Id: mbfilter.c,v 1.35 2002/08/02 10:22:31 helly Exp $ */
   
   
   #ifdef HAVE_CONFIG_H
  @@ -128,7 +128,7 @@
   /* language structure */
   static const char *mbfl_language_uni_aliases[] = {"universal", "none", NULL};
   
  -static mbfl_language mbfl_language_uni = {
  +static const mbfl_language mbfl_language_uni = {
   	mbfl_no_language_uni,
   	"uni",
   	"uni",
  @@ -138,7 +138,7 @@
   	mbfl_no_encoding_base64
   };
   
  -static mbfl_language mbfl_language_japanese = {
  +static const mbfl_language mbfl_language_japanese = {
   	mbfl_no_language_japanese,
   	"Japanese",
   	"ja",
  @@ -148,7 +148,7 @@
   	mbfl_no_encoding_7bit
   };
   
  -static mbfl_language mbfl_language_korean = {
  +static const mbfl_language mbfl_language_korean = {
   	mbfl_no_language_korean,
   	"Korean",
   	"ko",
  @@ -158,7 +158,7 @@
   	mbfl_no_encoding_7bit
   };
   
  -static mbfl_language mbfl_language_english = {
  +static const mbfl_language mbfl_language_english = {
   	mbfl_no_language_english,
   	"English",
   	"en",
  @@ -168,6 +168,18 @@
   	mbfl_no_encoding_8bit
   };
   
  +static const char *mbfl_language_german_aliases[] = {"Deutsch", NULL};
  +
  +static const mbfl_language mbfl_language_german = {
  +	mbfl_no_language_english,
  +	"German",
  +	"de",
  +	(const char *(*)[])&mbfl_language_german_aliases,
  +	mbfl_no_encoding_8859_15,
  +	mbfl_no_encoding_qprint,
  +	mbfl_no_encoding_8bit
  +};
  +
   static mbfl_language mbfl_language_simplified_chinese = {
   	mbfl_no_language_simplified_chinese,
   	"Simplified Chinese",
  @@ -198,13 +210,14 @@
   	mbfl_no_encoding_8bit
   };
   
  -static mbfl_language *mbfl_language_ptr_table[] = {
  +static const mbfl_language *mbfl_language_ptr_table[] = {
   	&mbfl_language_uni,
   	&mbfl_language_japanese,
   	&mbfl_language_korean,
   	&mbfl_language_simplified_chinese,
   	&mbfl_language_traditional_chinese,
   	&mbfl_language_english,
  +	&mbfl_language_german,
   	&mbfl_language_russian,
   	NULL
   };
  @@ -387,7 +400,7 @@
   /* encoding structure */
   static const char *mbfl_encoding_pass_aliases[] = {"none", NULL};
   
  -static mbfl_encoding mbfl_encoding_pass = {
  +static const mbfl_encoding mbfl_encoding_pass = {
   	mbfl_no_encoding_pass,
   	"pass",
   	NULL,
  @@ -398,7 +411,7 @@
   
   static const char *mbfl_encoding_auto_aliases[] = {"unknown", NULL};
   
  -static mbfl_encoding mbfl_encoding_auto = {
  +static const mbfl_encoding mbfl_encoding_auto = {
   	mbfl_no_encoding_auto,
   	"auto",
   	NULL,
  @@ -407,7 +420,7 @@
   	0
   };
   
  -static mbfl_encoding mbfl_encoding_wchar = {
  +static const mbfl_encoding mbfl_encoding_wchar = {
   	mbfl_no_encoding_wchar,
   	"wchar",
   	NULL,
  @@ -416,7 +429,7 @@
   	MBFL_ENCTYPE_WCS4BE
   };
   
  -static mbfl_encoding mbfl_encoding_byte2be = {
  +static const mbfl_encoding mbfl_encoding_byte2be = {
   	mbfl_no_encoding_byte2be,
   	"byte2be",
   	NULL,
  @@ -425,7 +438,7 @@
   	MBFL_ENCTYPE_SBCS
   };
   
  -static mbfl_encoding mbfl_encoding_byte2le = {
  +static const mbfl_encoding mbfl_encoding_byte2le = {
   	mbfl_no_encoding_byte2le,
   	"byte2le",
   	NULL,
  @@ -434,7 +447,7 @@
   	MBFL_ENCTYPE_SBCS
   };
   
  -static mbfl_encoding mbfl_encoding_byte4be = {
  +static const mbfl_encoding mbfl_encoding_byte4be = {
   	mbfl_no_encoding_byte4be,
   	"byte4be",
   	NULL,
  @@ -443,7 +456,7 @@
   	MBFL_ENCTYPE_SBCS
   };
   
  -static mbfl_encoding mbfl_encoding_byte4le = {
  +static const mbfl_encoding mbfl_encoding_byte4le = {
   	mbfl_no_encoding_byte4le,
   	"byte4le",
   	NULL,
  @@ -452,7 +465,7 @@
   	MBFL_ENCTYPE_SBCS
   };
   
  -static mbfl_encoding mbfl_encoding_base64 = {
  +static const mbfl_encoding mbfl_encoding_base64 = {
   	mbfl_no_encoding_base64,
   	"BASE64",
   	"BASE64",
  @@ -461,7 +474,7 @@
   	MBFL_ENCTYPE_SBCS
   };
   
  -static mbfl_encoding mbfl_encoding_uuencode = {
  +static const mbfl_encoding mbfl_encoding_uuencode = {
   	mbfl_no_encoding_uuencode,
   	"UUENCODE",
   	"x-uuencode",
  @@ -472,7 +485,7 @@
   
   static const char *mbfl_encoding_qprint_aliases[] = {"qprint", NULL};
   
  -static mbfl_encoding mbfl_encoding_qprint = {
  +static const mbfl_encoding mbfl_encoding_qprint = {
   	mbfl_no_encoding_qprint,
   	"Quoted-Printable",
   	"Quoted-Printable",
  @@ -481,7 +494,7 @@
   	MBFL_ENCTYPE_SBCS
   };
   
  -static mbfl_encoding mbfl_encoding_7bit = {
  +static const mbfl_encoding mbfl_encoding_7bit = {
   	mbfl_no_encoding_7bit,
   	"7bit",
   	"7bit",
  @@ -490,7 +503,7 @@
   	MBFL_ENCTYPE_SBCS
   };
   
  -static mbfl_encoding mbfl_encoding_8bit = {
  +static const mbfl_encoding mbfl_encoding_8bit = {
   	mbfl_no_encoding_8bit,
   	"8bit",
   	"8bit",
  @@ -501,7 +514,7 @@
   
   static const char *mbfl_encoding_ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL};
   
  -static mbfl_encoding mbfl_encoding_ucs2 = {
  +static const mbfl_encoding mbfl_encoding_ucs2 = {
   	mbfl_no_encoding_ucs2,
   	"UCS-2",
   	"UCS-2",
  @@ -510,7 +523,7 @@
   	MBFL_ENCTYPE_WCS2BE
   };
   
  -static mbfl_encoding mbfl_encoding_ucs2be = {
  +static const mbfl_encoding mbfl_encoding_ucs2be = {
   	mbfl_no_encoding_ucs2be,
   	"UCS-2BE",
   	"UCS-2BE",
  @@ -519,7 +532,7 @@
   	MBFL_ENCTYPE_WCS2BE
   };
   
  -static mbfl_encoding mbfl_encoding_ucs2le = {
  +static const mbfl_encoding mbfl_encoding_ucs2le = {
   	mbfl_no_encoding_ucs2le,
   	"UCS-2LE",
   	"UCS-2LE",
  @@ -530,7 +543,7 @@
   
   static const char *mbfl_encoding_ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL};
   
  -static mbfl_encoding mbfl_encoding_ucs4 = {
  +static const mbfl_encoding mbfl_encoding_ucs4 = {
   	mbfl_no_encoding_ucs4,
   	"UCS-4",
   	"UCS-4",
  @@ -539,7 +552,7 @@
   	MBFL_ENCTYPE_WCS4BE
   };
   
  -static mbfl_encoding mbfl_encoding_ucs4be = {
  +static const mbfl_encoding mbfl_encoding_ucs4be = {
   	mbfl_no_encoding_ucs4be,
   	"UCS-4BE",
   	"UCS-4BE",
  @@ -548,7 +561,7 @@
   	MBFL_ENCTYPE_WCS4BE
   };
   
  -static mbfl_encoding mbfl_encoding_ucs4le = {
  +static const mbfl_encoding mbfl_encoding_ucs4le = {
   	mbfl_no_encoding_ucs4le,
   	"UCS-4LE",
   	"UCS-4LE",
  @@ -559,7 +572,7 @@
   
   static const char *mbfl_encoding_utf32_aliases[] = {"utf32", NULL};
   
  -static mbfl_encoding mbfl_encoding_utf32 = {
  +static const mbfl_encoding mbfl_encoding_utf32 = {
   	mbfl_no_encoding_utf32,
   	"UTF-32",
   	"UTF-32",
  @@ -568,7 +581,7 @@
   	MBFL_ENCTYPE_WCS4BE
   };
   
  -static mbfl_encoding mbfl_encoding_utf32be = {
  +static const mbfl_encoding mbfl_encoding_utf32be = {
   	mbfl_no_encoding_utf32be,
   	"UTF-32BE",
   	"UTF-32BE",
  @@ -577,7 +590,7 @@
   	MBFL_ENCTYPE_WCS4BE
   };
   
  -static mbfl_encoding mbfl_encoding_utf32le = {
  +static const mbfl_encoding mbfl_encoding_utf32le = {
   	mbfl_no_encoding_utf32le,
   	"UTF-32LE",
   	"UTF-32LE",
  @@ -588,7 +601,7 @@
   
   static const char *mbfl_encoding_utf16_aliases[] = {"utf16", NULL};
   
  -static mbfl_encoding mbfl_encoding_utf16 = {
  +static const mbfl_encoding mbfl_encoding_utf16 = {
   	mbfl_no_encoding_utf16,
   	"UTF-16",
   	"UTF-16",
  @@ -597,7 +610,7 @@
   	MBFL_ENCTYPE_MWC2BE
   };
   
  -static mbfl_encoding mbfl_encoding_utf16be = {
  +static const mbfl_encoding mbfl_encoding_utf16be = {
   	mbfl_no_encoding_utf16be,
   	"UTF-16BE",
   	"UTF-16BE",
  @@ -606,7 +619,7 @@
   	MBFL_ENCTYPE_MWC2BE
   };
   
  -static mbfl_encoding mbfl_encoding_utf16le = {
  +static const mbfl_encoding mbfl_encoding_utf16le = {
   	mbfl_no_encoding_utf16le,
   	"UTF-16LE",
   	"UTF-16LE",
  @@ -617,7 +630,7 @@
   
   static const char *mbfl_encoding_utf8_aliases[] = {"utf8", NULL};
   
  -static mbfl_encoding mbfl_encoding_utf8 = {
  +static const mbfl_encoding mbfl_encoding_utf8 = {
   	mbfl_no_encoding_utf8,
   	"UTF-8",
   	"UTF-8",
  @@ -628,7 +641,7 @@
   
   static const char *mbfl_encoding_utf7_aliases[] = {"utf7", NULL};
   
  -static mbfl_encoding mbfl_encoding_utf7 = {
  +static const mbfl_encoding mbfl_encoding_utf7 = {
   	mbfl_no_encoding_utf7,
   	"UTF-7",
   	"UTF-7",
  @@ -637,7 +650,7 @@
   	MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
   };
   
  -static mbfl_encoding mbfl_encoding_utf7imap = {
  +static const mbfl_encoding mbfl_encoding_utf7imap = {
   	mbfl_no_encoding_utf7imap,
   	"UTF7-IMAP",
   	NULL,
  @@ -646,7 +659,7 @@
   	MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
   };
   
  -static mbfl_encoding mbfl_encoding_ascii = {
  +static const mbfl_encoding mbfl_encoding_ascii = {
   	mbfl_no_encoding_ascii,
   	"ASCII",
   	"US-ASCII",
  @@ -658,7 +671,7 @@
   #if defined(HAVE_MBSTR_JA)
   static const char *mbfl_encoding_euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL};
   
  -static mbfl_encoding mbfl_encoding_euc_jp = {
  +static const mbfl_encoding mbfl_encoding_euc_jp = {
   	mbfl_no_encoding_euc_jp,
   	"EUC-JP",
   	"EUC-JP",
  @@ -669,7 +682,7 @@
   
   static const char *mbfl_encoding_sjis_aliases[] = {"x-sjis", "SHIFT-JIS", NULL};
   
  -static mbfl_encoding mbfl_encoding_sjis = {
  +static const mbfl_encoding mbfl_encoding_sjis = {
   	mbfl_no_encoding_sjis,
   	"SJIS",
   	"Shift_JIS",
  @@ -680,7 +693,7 @@
   
   static const char *mbfl_encoding_eucjp_win_aliases[] = {"eucJP-open", NULL};
   
  -static mbfl_encoding mbfl_encoding_eucjp_win = {
  +static const mbfl_encoding mbfl_encoding_eucjp_win = {
   	mbfl_no_encoding_eucjp_win,
   	"eucJP-win",
   	"EUC-JP",
  @@ -691,7 +704,7 @@
   
   static const char *mbfl_encoding_sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", "CP932", NULL};
   
  -static mbfl_encoding mbfl_encoding_sjis_win = {
  +static const mbfl_encoding mbfl_encoding_sjis_win = {
   	mbfl_no_encoding_sjis_win,
   	"SJIS-win",
   	"Shift_JIS",
  @@ -700,7 +713,7 @@
   	MBFL_ENCTYPE_MBCS
   };
   
  -static mbfl_encoding mbfl_encoding_jis = {
  +static const mbfl_encoding mbfl_encoding_jis = {
   	mbfl_no_encoding_jis,
   	"JIS",
   	"ISO-2022-JP",
  @@ -709,7 +722,7 @@
   	MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
   };
   
  -static mbfl_encoding mbfl_encoding_2022jp = {
  +static const mbfl_encoding mbfl_encoding_2022jp = {
   	mbfl_no_encoding_2022jp,
   	"ISO-2022-JP",
   	"ISO-2022-JP",
  @@ -782,7 +795,7 @@
   #if defined(HAVE_MBSTR_KR)
   static const char *mbfl_encoding_euc_kr_aliases[] = {"EUC_KR", "eucKR", "x-euc-kr", NULL};
   
  -static mbfl_encoding mbfl_encoding_euc_kr = {
  +static const mbfl_encoding mbfl_encoding_euc_kr = {
   	mbfl_no_encoding_euc_kr,
   	"EUC-KR",
   	"EUC-KR",
  @@ -793,7 +806,7 @@
   
   static const char *mbfl_encoding_uhc_aliases[] = {"CP949", NULL};
   
  -static mbfl_encoding mbfl_encoding_uhc = {
  +static const mbfl_encoding mbfl_encoding_uhc = {
   	mbfl_no_encoding_uhc,
   	"UHC",
   	"UHC",
  @@ -802,7 +815,7 @@
   	MBFL_ENCTYPE_MBCS
   };
   
  -static mbfl_encoding mbfl_encoding_2022kr = {
  +static const mbfl_encoding mbfl_encoding_2022kr = {
   	mbfl_no_encoding_2022kr,
   	"ISO-2022-KR",
   	"ISO-2022-KR",
  @@ -815,7 +828,7 @@
   
   static const char *mbfl_encoding_cp1252_aliases[] = {"cp1252", NULL};
   
  -static mbfl_encoding mbfl_encoding_cp1252 = {
  +static const mbfl_encoding mbfl_encoding_cp1252 = {
   	mbfl_no_encoding_cp1252,
   	"Windows-1252",
   	"Windows-1252",
  @@ -826,7 +839,7 @@
   
   static const char *mbfl_encoding_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_1 = {
  +static const mbfl_encoding mbfl_encoding_8859_1 = {
   	mbfl_no_encoding_8859_1,
   	"ISO-8859-1",
   	"ISO-8859-1",
  @@ -837,7 +850,7 @@
   
   static const char *mbfl_encoding_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_2 = {
  +static const mbfl_encoding mbfl_encoding_8859_2 = {
   	mbfl_no_encoding_8859_2,
   	"ISO-8859-2",
   	"ISO-8859-2",
  @@ -848,7 +861,7 @@
   
   static const char *mbfl_encoding_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_3 = {
  +static const mbfl_encoding mbfl_encoding_8859_3 = {
   	mbfl_no_encoding_8859_3,
   	"ISO-8859-3",
   	"ISO-8859-3",
  @@ -859,7 +872,7 @@
   
   static const char *mbfl_encoding_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_4 = {
  +static const mbfl_encoding mbfl_encoding_8859_4 = {
   	mbfl_no_encoding_8859_4,
   	"ISO-8859-4",
   	"ISO-8859-4",
  @@ -870,7 +883,7 @@
   
   static const char *mbfl_encoding_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_5 = {
  +static const mbfl_encoding mbfl_encoding_8859_5 = {
   	mbfl_no_encoding_8859_5,
   	"ISO-8859-5",
   	"ISO-8859-5",
  @@ -881,7 +894,7 @@
   
   static const char *mbfl_encoding_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_6 = {
  +static const mbfl_encoding mbfl_encoding_8859_6 = {
   	mbfl_no_encoding_8859_6,
   	"ISO-8859-6",
   	"ISO-8859-6",
  @@ -892,7 +905,7 @@
   
   static const char *mbfl_encoding_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_7 = {
  +static const mbfl_encoding mbfl_encoding_8859_7 = {
   	mbfl_no_encoding_8859_7,
   	"ISO-8859-7",
   	"ISO-8859-7",
  @@ -903,7 +916,7 @@
   
   static const char *mbfl_encoding_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_8 = {
  +static const mbfl_encoding mbfl_encoding_8859_8 = {
   	mbfl_no_encoding_8859_8,
   	"ISO-8859-8",
   	"ISO-8859-8",
  @@ -914,7 +927,7 @@
   
   static const char *mbfl_encoding_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_9 = {
  +static const mbfl_encoding mbfl_encoding_8859_9 = {
   	mbfl_no_encoding_8859_9,
   	"ISO-8859-9",
   	"ISO-8859-9",
  @@ -925,7 +938,7 @@
   
   static const char *mbfl_encoding_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_10 = {
  +static const mbfl_encoding mbfl_encoding_8859_10 = {
   	mbfl_no_encoding_8859_10,
   	"ISO-8859-10",
   	"ISO-8859-10",
  @@ -936,7 +949,7 @@
   
   static const char *mbfl_encoding_8859_13_aliases[] = {"ISO_8859-13", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_13 = {
  +static const mbfl_encoding mbfl_encoding_8859_13 = {
   	mbfl_no_encoding_8859_13,
   	"ISO-8859-13",
   	"ISO-8859-13",
  @@ -947,7 +960,7 @@
   
   static const char *mbfl_encoding_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_14 = {
  +static const mbfl_encoding mbfl_encoding_8859_14 = {
   	mbfl_no_encoding_8859_14,
   	"ISO-8859-14",
   	"ISO-8859-14",
  @@ -958,7 +971,7 @@
   
   static const char *mbfl_encoding_8859_15_aliases[] = {"ISO_8859-15", NULL};
   
  -static mbfl_encoding mbfl_encoding_8859_15 = {
  +static const mbfl_encoding mbfl_encoding_8859_15 = {
   	mbfl_no_encoding_8859_15,
   	"ISO-8859-15",
   	"ISO-8859-15",
  @@ -970,7 +983,7 @@
   #if defined(HAVE_MBSTR_RU)
   static const char *mbfl_encoding_cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL};
   
  -static mbfl_encoding mbfl_encoding_cp1251 = {
  +static const mbfl_encoding mbfl_encoding_cp1251 = {
   	mbfl_no_encoding_cp1251,
   	"Windows-1251",
   	"Windows-1251",
  @@ -981,7 +994,7 @@
   
   static const char *mbfl_encoding_cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL};
   
  -static mbfl_encoding mbfl_encoding_cp866 = {
  +static const mbfl_encoding mbfl_encoding_cp866 = {
   	mbfl_no_encoding_cp866,
   	"CP866",
   	"CP866",
  @@ -992,7 +1005,7 @@
   
   static const char *mbfl_encoding_koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL};
   
  -static mbfl_encoding mbfl_encoding_koi8r = {
  +static const mbfl_encoding mbfl_encoding_koi8r = {
   	mbfl_no_encoding_koi8r,
   	"KOI8-R",
   	"KOI8-R",
  @@ -1002,7 +1015,7 @@
   };
   #endif
   
  -static mbfl_encoding *mbfl_encoding_ptr_list[] = {
  +static const mbfl_encoding *mbfl_encoding_ptr_list[] = {
   	&mbfl_encoding_pass,
   	&mbfl_encoding_auto,
   	&mbfl_encoding_wchar,
  @@ -1075,6 +1088,11 @@
   	NULL
   };
   
  +/* hex character table "0123456789ABCDEF" */
  +static char mbfl_hexchar_table[] = {
  +	0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46
  +};
  +
   /* forward */
   static void mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter TSRMLS_DC);
   static int mbfl_filt_conv_common_flush(mbfl_convert_filter *filter TSRMLS_DC);
  @@ -1193,7 +1211,7 @@
   static int mbfl_filt_ident_true(int c, mbfl_identify_filter *filter TSRMLS_DC);
   
   /* convert filter function table */
  -static struct mbfl_convert_vtbl vtbl_pass = {
  +static const struct mbfl_convert_vtbl vtbl_pass = {
   	mbfl_no_encoding_pass,
   	mbfl_no_encoding_pass,
   	mbfl_filt_conv_common_ctor,
  @@ -1201,7 +1219,7 @@
   	mbfl_filt_conv_pass,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_byte2be_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_byte2be_wchar = {
   	mbfl_no_encoding_byte2be,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1209,7 +1227,7 @@
   	mbfl_filt_conv_byte2be_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_byte2be = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_byte2be = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_byte2be,
   	mbfl_filt_conv_common_ctor,
  @@ -1217,7 +1235,7 @@
   	mbfl_filt_conv_wchar_byte2be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_byte2le_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_byte2le_wchar = {
   	mbfl_no_encoding_byte2le,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1225,7 +1243,7 @@
   	mbfl_filt_conv_byte2le_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_byte2le = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_byte2le = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_byte2le,
   	mbfl_filt_conv_common_ctor,
  @@ -1233,7 +1251,7 @@
   	mbfl_filt_conv_wchar_byte2le,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_byte4be_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_byte4be_wchar = {
   	mbfl_no_encoding_byte4be,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1241,7 +1259,7 @@
   	mbfl_filt_conv_byte4be_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_byte4be = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_byte4be = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_byte4be,
   	mbfl_filt_conv_common_ctor,
  @@ -1249,7 +1267,7 @@
   	mbfl_filt_conv_wchar_byte4be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_byte4le_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_byte4le_wchar = {
   	mbfl_no_encoding_byte4le,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1257,7 +1275,7 @@
   	mbfl_filt_conv_byte4le_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_byte4le = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_byte4le = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_byte4le,
   	mbfl_filt_conv_common_ctor,
  @@ -1265,7 +1283,7 @@
   	mbfl_filt_conv_wchar_byte4le,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8bit_b64 = {
  +static const struct mbfl_convert_vtbl vtbl_8bit_b64 = {
   	mbfl_no_encoding_8bit,
   	mbfl_no_encoding_base64,
   	mbfl_filt_conv_common_ctor,
  @@ -1273,7 +1291,7 @@
   	mbfl_filt_conv_base64enc,
   	mbfl_filt_conv_base64enc_flush };
   
  -static struct mbfl_convert_vtbl vtbl_b64_8bit = {
  +static const struct mbfl_convert_vtbl vtbl_b64_8bit = {
   	mbfl_no_encoding_base64,
   	mbfl_no_encoding_8bit,
   	mbfl_filt_conv_common_ctor,
  @@ -1281,17 +1299,15 @@
   	mbfl_filt_conv_base64dec,
   	mbfl_filt_conv_base64dec_flush };
   
  -static struct mbfl_convert_vtbl vtbl_uuencode_8bit = {
  +static const struct mbfl_convert_vtbl vtbl_uuencode_8bit = {
   	mbfl_no_encoding_uuencode,
   	mbfl_no_encoding_8bit,
   	mbfl_filt_conv_common_ctor,
   	mbfl_filt_conv_common_dtor,
   	mbfl_filt_conv_uudec,
  -	mbfl_filt_conv_common_flush
  -};
  -
  +	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8bit_qprint = {
  +static const struct mbfl_convert_vtbl vtbl_8bit_qprint = {
   	mbfl_no_encoding_8bit,
   	mbfl_no_encoding_qprint,
   	mbfl_filt_conv_common_ctor,
  @@ -1299,7 +1315,7 @@
   	mbfl_filt_conv_qprintenc,
   	mbfl_filt_conv_qprintenc_flush };
   
  -static struct mbfl_convert_vtbl vtbl_qprint_8bit = {
  +static const struct mbfl_convert_vtbl vtbl_qprint_8bit = {
   	mbfl_no_encoding_qprint,
   	mbfl_no_encoding_8bit,
   	mbfl_filt_conv_common_ctor,
  @@ -1307,7 +1323,7 @@
   	mbfl_filt_conv_qprintdec,
   	mbfl_filt_conv_qprintdec_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8bit_7bit = {
  +static const struct mbfl_convert_vtbl vtbl_8bit_7bit = {
   	mbfl_no_encoding_8bit,
   	mbfl_no_encoding_7bit,
   	mbfl_filt_conv_common_ctor,
  @@ -1315,7 +1331,7 @@
   	mbfl_filt_conv_any_7bit,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_7bit_8bit = {
  +static const struct mbfl_convert_vtbl vtbl_7bit_8bit = {
   	mbfl_no_encoding_7bit,
   	mbfl_no_encoding_8bit,
   	mbfl_filt_conv_common_ctor,
  @@ -1323,7 +1339,7 @@
   	mbfl_filt_conv_pass,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_ucs4_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_ucs4_wchar = {
   	mbfl_no_encoding_ucs4,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1331,7 +1347,7 @@
   	mbfl_filt_conv_ucs4_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_ucs4 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_ucs4 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_ucs4,
   	mbfl_filt_conv_common_ctor,
  @@ -1339,7 +1355,7 @@
   	mbfl_filt_conv_wchar_ucs4be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_ucs4be_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_ucs4be_wchar = {
   	mbfl_no_encoding_ucs4be,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1347,7 +1363,7 @@
   	mbfl_filt_conv_byte4be_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_ucs4be = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_ucs4be = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_ucs4be,
   	mbfl_filt_conv_common_ctor,
  @@ -1355,7 +1371,7 @@
   	mbfl_filt_conv_wchar_ucs4be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_ucs4le_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_ucs4le_wchar = {
   	mbfl_no_encoding_ucs4le,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1363,7 +1379,7 @@
   	mbfl_filt_conv_byte4le_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_ucs4le = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_ucs4le = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_ucs4le,
   	mbfl_filt_conv_common_ctor,
  @@ -1371,7 +1387,7 @@
   	mbfl_filt_conv_wchar_ucs4le,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_ucs2_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_ucs2_wchar = {
   	mbfl_no_encoding_ucs2,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1379,7 +1395,7 @@
   	mbfl_filt_conv_ucs2_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_ucs2 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_ucs2 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_ucs2,
   	mbfl_filt_conv_common_ctor,
  @@ -1387,7 +1403,7 @@
   	mbfl_filt_conv_wchar_ucs2be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_ucs2be_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_ucs2be_wchar = {
   	mbfl_no_encoding_ucs2be,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1395,7 +1411,7 @@
   	mbfl_filt_conv_byte2be_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_ucs2be = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_ucs2be = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_ucs2be,
   	mbfl_filt_conv_common_ctor,
  @@ -1403,7 +1419,7 @@
   	mbfl_filt_conv_wchar_ucs2be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_ucs2le_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_ucs2le_wchar = {
   	mbfl_no_encoding_ucs2le,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1411,7 +1427,7 @@
   	mbfl_filt_conv_byte2le_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_ucs2le = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_ucs2le = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_ucs2le,
   	mbfl_filt_conv_common_ctor,
  @@ -1419,7 +1435,7 @@
   	mbfl_filt_conv_wchar_ucs2le,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf32_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf32_wchar = {
   	mbfl_no_encoding_utf32,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1427,7 +1443,7 @@
   	mbfl_filt_conv_ucs4_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf32 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf32 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf32,
   	mbfl_filt_conv_common_ctor,
  @@ -1435,7 +1451,7 @@
   	mbfl_filt_conv_wchar_ucs4be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf32be_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf32be_wchar = {
   	mbfl_no_encoding_utf32be,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1443,7 +1459,7 @@
   	mbfl_filt_conv_byte4be_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf32be = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf32be = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf32be,
   	mbfl_filt_conv_common_ctor,
  @@ -1451,7 +1467,7 @@
   	mbfl_filt_conv_wchar_ucs4be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf32le_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf32le_wchar = {
   	mbfl_no_encoding_utf32le,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1459,7 +1475,7 @@
   	mbfl_filt_conv_byte4le_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf32le = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf32le = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf32le,
   	mbfl_filt_conv_common_ctor,
  @@ -1467,7 +1483,7 @@
   	mbfl_filt_conv_wchar_ucs4le,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf16_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf16_wchar = {
   	mbfl_no_encoding_utf16,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1475,7 +1491,7 @@
   	mbfl_filt_conv_utf16_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf16 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf16 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf16,
   	mbfl_filt_conv_common_ctor,
  @@ -1483,7 +1499,7 @@
   	mbfl_filt_conv_wchar_utf16be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf16be_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf16be_wchar = {
   	mbfl_no_encoding_utf16be,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1491,7 +1507,7 @@
   	mbfl_filt_conv_utf16be_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf16be = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf16be = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf16be,
   	mbfl_filt_conv_common_ctor,
  @@ -1499,7 +1515,7 @@
   	mbfl_filt_conv_wchar_utf16be,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf16le_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf16le_wchar = {
   	mbfl_no_encoding_utf16le,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1507,7 +1523,7 @@
   	mbfl_filt_conv_utf16le_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf16le = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf16le = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf16le,
   	mbfl_filt_conv_common_ctor,
  @@ -1515,7 +1531,7 @@
   	mbfl_filt_conv_wchar_utf16le,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf8_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf8_wchar = {
   	mbfl_no_encoding_utf8,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1523,7 +1539,7 @@
   	mbfl_filt_conv_utf8_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf8,
   	mbfl_filt_conv_common_ctor,
  @@ -1531,7 +1547,7 @@
   	mbfl_filt_conv_wchar_utf8,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf7_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf7_wchar = {
   	mbfl_no_encoding_utf7,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1539,7 +1555,7 @@
   	mbfl_filt_conv_utf7_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf7 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf7 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf7,
   	mbfl_filt_conv_common_ctor,
  @@ -1547,7 +1563,7 @@
   	mbfl_filt_conv_wchar_utf7,
   	mbfl_filt_conv_wchar_utf7_flush };
   
  -static struct mbfl_convert_vtbl vtbl_utf7imap_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_utf7imap_wchar = {
   	mbfl_no_encoding_utf7imap,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1555,7 +1571,7 @@
   	mbfl_filt_conv_utf7imap_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_utf7imap = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_utf7imap = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_utf7imap,
   	mbfl_filt_conv_common_ctor,
  @@ -1563,7 +1579,7 @@
   	mbfl_filt_conv_wchar_utf7imap,
   	mbfl_filt_conv_wchar_utf7imap_flush };
   
  -static struct mbfl_convert_vtbl vtbl_ascii_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_ascii_wchar = {
   	mbfl_no_encoding_ascii,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1571,7 +1587,7 @@
   	mbfl_filt_conv_pass,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_ascii = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_ascii = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_ascii,
   	mbfl_filt_conv_common_ctor,
  @@ -1580,7 +1596,7 @@
   	mbfl_filt_conv_common_flush };
   
   #if defined(HAVE_MBSTR_JA)
  -static struct mbfl_convert_vtbl vtbl_eucjp_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_eucjp_wchar = {
   	mbfl_no_encoding_euc_jp,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1588,7 +1604,7 @@
   	mbfl_filt_conv_eucjp_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_eucjp = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_eucjp = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_euc_jp,
   	mbfl_filt_conv_common_ctor,
  @@ -1596,7 +1612,7 @@
   	mbfl_filt_conv_wchar_eucjp,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_sjis_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_sjis_wchar = {
   	mbfl_no_encoding_sjis,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1604,7 +1620,7 @@
   	mbfl_filt_conv_sjis_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_sjis = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_sjis = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_sjis,
   	mbfl_filt_conv_common_ctor,
  @@ -1612,7 +1628,7 @@
   	mbfl_filt_conv_wchar_sjis,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_jis_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_jis_wchar = {
   	mbfl_no_encoding_jis,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1620,7 +1636,7 @@
   	mbfl_filt_conv_jis_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_jis = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_jis = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_jis,
   	mbfl_filt_conv_common_ctor,
  @@ -1628,7 +1644,7 @@
   	mbfl_filt_conv_wchar_jis,
   	mbfl_filt_conv_any_jis_flush };
   
  -static struct mbfl_convert_vtbl vtbl_2022jp_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_2022jp_wchar = {
   	mbfl_no_encoding_2022jp,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1636,7 +1652,7 @@
   	mbfl_filt_conv_jis_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_2022jp = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_2022jp = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_2022jp,
   	mbfl_filt_conv_common_ctor,
  @@ -1644,7 +1660,7 @@
   	mbfl_filt_conv_wchar_2022jp,
   	mbfl_filt_conv_any_jis_flush };
   
  -static struct mbfl_convert_vtbl vtbl_eucjpwin_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_eucjpwin_wchar = {
   	mbfl_no_encoding_eucjp_win,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1652,7 +1668,7 @@
   	mbfl_filt_conv_eucjpwin_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_eucjpwin = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_eucjpwin = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_eucjp_win,
   	mbfl_filt_conv_common_ctor,
  @@ -1660,7 +1676,7 @@
   	mbfl_filt_conv_wchar_eucjpwin,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_sjiswin_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_sjiswin_wchar = {
   	mbfl_no_encoding_sjis_win,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1668,7 +1684,7 @@
   	mbfl_filt_conv_sjiswin_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_sjiswin = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_sjiswin = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_sjis_win,
   	mbfl_filt_conv_common_ctor,
  @@ -1678,7 +1694,7 @@
   #endif /* HAVE_MBSTR_JA */
   
   #if defined(HAVE_MBSTR_CN)
  -static struct mbfl_convert_vtbl vtbl_euccn_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_euccn_wchar = {
   	mbfl_no_encoding_euc_cn,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1686,7 +1702,7 @@
   	mbfl_filt_conv_euccn_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_euccn = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_euccn = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_euc_cn,
   	mbfl_filt_conv_common_ctor,
  @@ -1694,7 +1710,7 @@
   	mbfl_filt_conv_wchar_euccn,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_cp936_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_cp936_wchar = {
   	mbfl_no_encoding_cp936,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1702,7 +1718,7 @@
   	mbfl_filt_conv_cp936_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_cp936 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_cp936 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_cp936,
   	mbfl_filt_conv_common_ctor,
  @@ -1710,7 +1726,7 @@
   	mbfl_filt_conv_wchar_cp936,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_hz_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_hz_wchar = {
   	mbfl_no_encoding_hz,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1718,7 +1734,7 @@
   	mbfl_filt_conv_hz_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_hz = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_hz = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_hz,
   	mbfl_filt_conv_common_ctor,
  @@ -1729,7 +1745,7 @@
   #endif /* HAVE_MBSTR_CN */
   
   #if defined(HAVE_MBSTR_TW)
  -static struct mbfl_convert_vtbl vtbl_euctw_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_euctw_wchar = {
   	mbfl_no_encoding_euc_tw,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1745,7 +1761,7 @@
   	mbfl_filt_conv_wchar_euctw,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_big5_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_big5_wchar = {
   	mbfl_no_encoding_big5,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1753,7 +1769,7 @@
   	mbfl_filt_conv_big5_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_big5 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_big5 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_big5,
   	mbfl_filt_conv_common_ctor,
  @@ -1763,7 +1779,7 @@
   #endif /* HAVE_MBSTR_TW */
   
   #if defined(HAVE_MBSTR_KR)
  -static struct mbfl_convert_vtbl vtbl_euckr_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_euckr_wchar = {
   	mbfl_no_encoding_euc_kr,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1771,7 +1787,7 @@
   	mbfl_filt_conv_euckr_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_euckr = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_euckr = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_euc_kr,
   	mbfl_filt_conv_common_ctor,
  @@ -1779,7 +1795,7 @@
   	mbfl_filt_conv_wchar_euckr,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_uhc_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_uhc_wchar = {
   	mbfl_no_encoding_uhc,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1787,7 +1803,7 @@
   	mbfl_filt_conv_uhc_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_uhc = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_uhc = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_uhc,
   	mbfl_filt_conv_common_ctor,
  @@ -1795,7 +1811,7 @@
   	mbfl_filt_conv_wchar_uhc,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_2022kr = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_2022kr = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_2022kr,
   	mbfl_filt_conv_common_ctor,
  @@ -1803,18 +1819,17 @@
   	mbfl_filt_conv_wchar_2022kr,
   	mbfl_filt_conv_any_2022kr_flush };
   
  -static struct mbfl_convert_vtbl vtbl_2022kr_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_2022kr_wchar = {
   	mbfl_no_encoding_2022kr,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
   	mbfl_filt_conv_common_dtor,
   	mbfl_filt_conv_2022kr_wchar,
   	mbfl_filt_conv_common_flush };
  -
   #endif /* HAVE_MBSTR_KR */
   
   #if defined(HAVE_MBSTR_RU)
  -static struct mbfl_convert_vtbl vtbl_wchar_cp1251 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_cp1251 = {
   	mbfl_no_encoding_cp1251,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1822,7 +1837,7 @@
   	mbfl_filt_conv_wchar_cp1251,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_cp1251_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_cp1251_wchar = {
   	mbfl_no_encoding_cp1251,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1830,7 +1845,7 @@
   	mbfl_filt_conv_cp1251_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_cp866 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_cp866 = {
   	mbfl_no_encoding_cp866,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1838,7 +1853,7 @@
   	mbfl_filt_conv_wchar_cp866,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_cp866_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_cp866_wchar = {
   	mbfl_no_encoding_cp866,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1846,7 +1861,7 @@
   	mbfl_filt_conv_cp866_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_koi8r = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_koi8r = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_koi8r,
   	mbfl_filt_conv_common_ctor,
  @@ -1855,7 +1870,7 @@
   	mbfl_filt_conv_common_flush };
   
   
  -static struct mbfl_convert_vtbl vtbl_koi8r_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_koi8r_wchar = {
   	mbfl_no_encoding_koi8r,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1864,7 +1879,7 @@
   	mbfl_filt_conv_common_flush };
   #endif /* HAVE_MBSTR_RU */
   
  -static struct mbfl_convert_vtbl vtbl_cp1252_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_cp1252_wchar = {
   	mbfl_no_encoding_cp1252,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1872,7 +1887,7 @@
   	mbfl_filt_conv_cp1252_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_cp1252 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_cp1252 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_cp1252,
   	mbfl_filt_conv_common_ctor,
  @@ -1881,7 +1896,7 @@
   	mbfl_filt_conv_common_flush };
   
   
  -static struct mbfl_convert_vtbl vtbl_8859_1_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_1_wchar = {
   	mbfl_no_encoding_8859_1,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1889,7 +1904,7 @@
   	mbfl_filt_conv_pass,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_1 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_1 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_1,
   	mbfl_filt_conv_common_ctor,
  @@ -1897,7 +1912,7 @@
   	mbfl_filt_conv_wchar_8859_1,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_2_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_2_wchar = {
   	mbfl_no_encoding_8859_2,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1905,7 +1920,7 @@
   	mbfl_filt_conv_8859_2_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_2 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_2 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_2,
   	mbfl_filt_conv_common_ctor,
  @@ -1913,7 +1928,7 @@
   	mbfl_filt_conv_wchar_8859_2,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_3_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_3_wchar = {
   	mbfl_no_encoding_8859_3,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1921,7 +1936,7 @@
   	mbfl_filt_conv_8859_3_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_3 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_3 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_3,
   	mbfl_filt_conv_common_ctor,
  @@ -1929,7 +1944,7 @@
   	mbfl_filt_conv_wchar_8859_3,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_4_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_4_wchar = {
   	mbfl_no_encoding_8859_4,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1937,7 +1952,7 @@
   	mbfl_filt_conv_8859_4_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_4 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_4 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_4,
   	mbfl_filt_conv_common_ctor,
  @@ -1945,7 +1960,7 @@
   	mbfl_filt_conv_wchar_8859_4,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_5_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_5_wchar = {
   	mbfl_no_encoding_8859_5,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1953,7 +1968,7 @@
   	mbfl_filt_conv_8859_5_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_5 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_5 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_5,
   	mbfl_filt_conv_common_ctor,
  @@ -1961,7 +1976,7 @@
   	mbfl_filt_conv_wchar_8859_5,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_6_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_6_wchar = {
   	mbfl_no_encoding_8859_6,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1969,7 +1984,7 @@
   	mbfl_filt_conv_8859_6_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_6 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_6 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_6,
   	mbfl_filt_conv_common_ctor,
  @@ -1977,7 +1992,7 @@
   	mbfl_filt_conv_wchar_8859_6,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_7_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_7_wchar = {
   	mbfl_no_encoding_8859_7,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -1985,7 +2000,7 @@
   	mbfl_filt_conv_8859_7_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_7 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_7 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_7,
   	mbfl_filt_conv_common_ctor,
  @@ -1993,7 +2008,7 @@
   	mbfl_filt_conv_wchar_8859_7,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_8_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_8_wchar = {
   	mbfl_no_encoding_8859_8,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -2001,7 +2016,7 @@
   	mbfl_filt_conv_8859_8_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_8 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_8 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_8,
   	mbfl_filt_conv_common_ctor,
  @@ -2009,7 +2024,7 @@
   	mbfl_filt_conv_wchar_8859_8,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_9_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_9_wchar = {
   	mbfl_no_encoding_8859_9,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -2017,7 +2032,7 @@
   	mbfl_filt_conv_8859_9_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_9 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_9 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_9,
   	mbfl_filt_conv_common_ctor,
  @@ -2025,7 +2040,7 @@
   	mbfl_filt_conv_wchar_8859_9,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_10_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_10_wchar = {
   	mbfl_no_encoding_8859_10,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -2033,7 +2048,7 @@
   	mbfl_filt_conv_8859_10_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_10 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_10 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_10,
   	mbfl_filt_conv_common_ctor,
  @@ -2041,7 +2056,7 @@
   	mbfl_filt_conv_wchar_8859_10,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_13_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_13_wchar = {
   	mbfl_no_encoding_8859_13,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -2049,7 +2064,7 @@
   	mbfl_filt_conv_8859_13_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_13 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_13 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_13,
   	mbfl_filt_conv_common_ctor,
  @@ -2057,7 +2072,7 @@
   	mbfl_filt_conv_wchar_8859_13,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_8859_14_wchar = {
  +static const struct mbfl_convert_vtbl vtbl_8859_14_wchar = {
   	mbfl_no_encoding_8859_14,
   	mbfl_no_encoding_wchar,
   	mbfl_filt_conv_common_ctor,
  @@ -2065,7 +2080,7 @@
   	mbfl_filt_conv_8859_14_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_14 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_14 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_14,
   	mbfl_filt_conv_common_ctor,
  @@ -2081,7 +2096,7 @@
   	mbfl_filt_conv_8859_15_wchar,
   	mbfl_filt_conv_common_flush };
   
  -static struct mbfl_convert_vtbl vtbl_wchar_8859_15 = {
  +static const struct mbfl_convert_vtbl vtbl_wchar_8859_15 = {
   	mbfl_no_encoding_wchar,
   	mbfl_no_encoding_8859_15,
   	mbfl_filt_conv_common_ctor,
  @@ -2090,7 +2105,7 @@
   	mbfl_filt_conv_common_flush };
   
   
  -static struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = {
  +static const struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = {
   	&vtbl_utf8_wchar,
   	&vtbl_wchar_utf8,
   #if defined(HAVE_MBSTR_JA)
  @@ -2216,56 +2231,56 @@
   
   
   /* identify filter function table */
  -static struct mbfl_identify_vtbl vtbl_identify_ascii = {
  +static const struct mbfl_identify_vtbl vtbl_identify_ascii = {
   	mbfl_no_encoding_ascii,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_ascii };
   
  -static struct mbfl_identify_vtbl vtbl_identify_utf8 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_utf8 = {
   	mbfl_no_encoding_utf8,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_utf8 };
   
  -static struct mbfl_identify_vtbl vtbl_identify_utf7 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_utf7 = {
   	mbfl_no_encoding_utf7,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_utf7 };
   
   #if defined(HAVE_MBSTR_JA)
  -static struct mbfl_identify_vtbl vtbl_identify_eucjp = {
  +static const struct mbfl_identify_vtbl vtbl_identify_eucjp = {
   	mbfl_no_encoding_euc_jp,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_eucjp };
   
  -static struct mbfl_identify_vtbl vtbl_identify_eucjpwin = {
  +static const struct mbfl_identify_vtbl vtbl_identify_eucjpwin = {
   	mbfl_no_encoding_eucjp_win,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_eucjp };
   
  -static struct mbfl_identify_vtbl vtbl_identify_sjis = {
  +static const struct mbfl_identify_vtbl vtbl_identify_sjis = {
   	mbfl_no_encoding_sjis,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_sjis };
   
  -static struct mbfl_identify_vtbl vtbl_identify_sjiswin = {
  +static const struct mbfl_identify_vtbl vtbl_identify_sjiswin = {
   	mbfl_no_encoding_sjis_win,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_sjiswin };
   
  -static struct mbfl_identify_vtbl vtbl_identify_jis = {
  +static const struct mbfl_identify_vtbl vtbl_identify_jis = {
   	mbfl_no_encoding_jis,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_jis };
   
  -static struct mbfl_identify_vtbl vtbl_identify_2022jp = {
  +static const struct mbfl_identify_vtbl vtbl_identify_2022jp = {
   	mbfl_no_encoding_2022jp,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
  @@ -2348,97 +2363,97 @@
   	mbfl_filt_ident_koi8r };
   #endif /* HAVE_MBSTR_RU */
   
  -static struct mbfl_identify_vtbl vtbl_identify_cp1252 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_cp1252 = {
   	mbfl_no_encoding_cp1252,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_cp1252 };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_1 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_1 = {
   	mbfl_no_encoding_8859_1,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_2 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_2 = {
   	mbfl_no_encoding_8859_2,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_3 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_3 = {
   	mbfl_no_encoding_8859_3,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_4 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_4 = {
   	mbfl_no_encoding_8859_4,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_5 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_5 = {
   	mbfl_no_encoding_8859_5,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_6 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_6 = {
   	mbfl_no_encoding_8859_6,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_7 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_7 = {
   	mbfl_no_encoding_8859_7,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_8 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_8 = {
   	mbfl_no_encoding_8859_8,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_9 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_9 = {
   	mbfl_no_encoding_8859_9,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_10 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_10 = {
   	mbfl_no_encoding_8859_10,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_13 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_13 = {
   	mbfl_no_encoding_8859_13,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_14 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_14 = {
   	mbfl_no_encoding_8859_14,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_8859_15 = {
  +static const struct mbfl_identify_vtbl vtbl_identify_8859_15 = {
   	mbfl_no_encoding_8859_15,
   	mbfl_filt_ident_common_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_true };
   
  -static struct mbfl_identify_vtbl vtbl_identify_false = {
  +static const struct mbfl_identify_vtbl vtbl_identify_false = {
   	mbfl_no_encoding_pass,
   	mbfl_filt_ident_false_ctor,
   	mbfl_filt_ident_common_dtor,
   	mbfl_filt_ident_false };
   
  -static struct mbfl_identify_vtbl *mbfl_identify_filter_list[] = {
  +static const struct mbfl_identify_vtbl *mbfl_identify_filter_list[] = {
   	&vtbl_identify_utf8,
   	&vtbl_identify_utf7,
   	&vtbl_identify_ascii,
  @@ -2489,10 +2504,10 @@
   
   
   /* language resolver */
  -mbfl_language *
  +const mbfl_language *
   mbfl_name2language(const char *name)
   {
  -	mbfl_language *language;
  +	const mbfl_language *language;
   	int i, j;
   
   	if (name == NULL) {
  @@ -2530,10 +2545,10 @@
   	return NULL;
   }
   
  -mbfl_language *
  +const mbfl_language *
   mbfl_no2language(enum mbfl_no_language no_language)
   {
  -	mbfl_language *language;
  +	const mbfl_language *language;
   	int i;
   
   	i = 0;
  @@ -2549,7 +2564,7 @@
   enum mbfl_no_language
   mbfl_name2no_language(const char *name)
   {
  -	mbfl_language *language;
  +	const mbfl_language *language;
   
   	language = mbfl_name2language(name);
   	if (language == NULL) {
  @@ -2562,7 +2577,7 @@
   const char *
   mbfl_no_language2name(enum mbfl_no_language no_language)
   {
  -	mbfl_language *language;
  +	const mbfl_language *language;
   
   	language = mbfl_no2language(no_language);
   	if (language == NULL) {
  @@ -2575,10 +2590,10 @@
   
   
   /* encoding resolver */
  -mbfl_encoding *
  +const mbfl_encoding *
   mbfl_name2encoding(const char *name)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   	int i, j;
   
   	if (name == NULL) {
  @@ -2619,10 +2634,10 @@
   	return NULL;
   }
   
  -mbfl_encoding *
  +const mbfl_encoding *
   mbfl_no2encoding(enum mbfl_no_encoding no_encoding)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   	int i;
   
   	i = 0;
  @@ -2638,7 +2653,7 @@
   enum mbfl_no_encoding
   mbfl_name2no_encoding(const char *name)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   
   	encoding = mbfl_name2encoding(name);
   	if (encoding == NULL) {
  @@ -2651,7 +2666,7 @@
   const char *
   mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   
   	encoding = mbfl_no2encoding(no_encoding);
   	if (encoding == NULL) {
  @@ -2664,7 +2679,7 @@
   const char *
   mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   
   	encoding = mbfl_no2encoding(no_encoding);
   	if (encoding != NULL && encoding->mime_name != NULL && encoding->mime_name[0] != '\0') {
  @@ -2677,7 +2692,7 @@
   int
   mbfl_is_support_encoding(const char *name)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   
   	encoding = mbfl_name2encoding(name);
   	if (encoding == NULL) {
  @@ -6421,7 +6436,7 @@
   
   /* setup filter function table */
   static void
  -mbfl_convert_filter_set_vtbl(mbfl_convert_filter *filter, struct mbfl_convert_vtbl *vtbl)
  +mbfl_convert_filter_set_vtbl(mbfl_convert_filter *filter, const struct mbfl_convert_vtbl *vtbl)
   {
   	if (filter && vtbl) {
   		filter->filter_ctor = vtbl->filter_ctor;
  @@ -6432,10 +6447,10 @@
   }
   
   
  -static struct mbfl_convert_vtbl *
  +static const struct mbfl_convert_vtbl *
   mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to)
   {
  -	struct mbfl_convert_vtbl *vtbl;
  +	const struct mbfl_convert_vtbl *vtbl;
   	int i;
   
   	if (to == mbfl_no_encoding_base64 ||
  @@ -6462,7 +6477,7 @@
   static void
   mbfl_convert_filter_select_vtbl(mbfl_convert_filter *filter)
   {
  -	struct mbfl_convert_vtbl *vtbl;
  +	const struct mbfl_convert_vtbl *vtbl;
   
   	vtbl = mbfl_convert_filter_get_vtbl(filter->from->no_encoding, filter->to->no_encoding);
   	if (vtbl == NULL) {
  @@ -6645,11 +6660,6 @@
   }
   #endif
   
  -/* hex character table "0123456789ABCDEF" */
  -static char mbfl_hexchar_table[] = {
  -	0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46
  -};
  -
   /* illegal character output function for conv-filter */
   int
   mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter TSRMLS_DC)
  @@ -6727,7 +6737,7 @@
    */
   
   static void
  -mbfl_identify_filter_set_vtbl(mbfl_identify_filter *filter, struct mbfl_identify_vtbl *vtbl)
  +mbfl_identify_filter_set_vtbl(mbfl_identify_filter *filter, const struct mbfl_identify_vtbl *vtbl)
   {
   	if (filter && vtbl) {
   		filter->filter_ctor = vtbl->filter_ctor;
  @@ -6736,10 +6746,10 @@
   	}
   }
   
  -static struct mbfl_identify_vtbl *
  +static const struct mbfl_identify_vtbl * 
   mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding)
   {
  -	struct mbfl_identify_vtbl *vtbl;
  +	const struct mbfl_identify_vtbl * vtbl;
   	int i;
   
   	i = 0;
  @@ -6755,7 +6765,7 @@
   static void
   mbfl_identify_filter_select_vtbl(mbfl_identify_filter *filter)
   {
  -	struct mbfl_identify_vtbl *vtbl;
  +	const struct mbfl_identify_vtbl *vtbl;
   
   	vtbl = mbfl_identify_filter_get_vtbl(filter->encoding->no_encoding);
   	if (vtbl == NULL) {
  @@ -7149,7 +7159,7 @@
   {
   	int n;
   	unsigned char *p;
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   	mbfl_memory_device device;
   	mbfl_convert_filter *filter1;
   	mbfl_convert_filter *filter2;
  @@ -7206,14 +7216,14 @@
   /*
    * identify encoding
    */
  -mbfl_encoding *
  +const mbfl_encoding *
   mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC)
   {
   	int i, n, num, bad;
   	unsigned char *p;
  -	struct mbfl_identify_vtbl *vtbl;
  +	const struct mbfl_identify_vtbl *vtbl;
   	mbfl_identify_filter *flist, *filter;
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   
   	/* initialize */
   	flist = (mbfl_identify_filter *)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter));
  @@ -7292,7 +7302,7 @@
   const char*
   mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   
   	encoding = mbfl_identify_encoding(string, elist, eliztsz TSRMLS_CC);
   	if (encoding != NULL &&
  @@ -7304,10 +7314,10 @@
   	}
   }
   
  -enum mbfl_no_encoding
  +const enum mbfl_no_encoding
   mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   
   	encoding = mbfl_identify_encoding(string, elist, eliztsz TSRMLS_CC);
   	if (encoding != NULL &&
  @@ -7336,7 +7346,7 @@
   	int len, n, m, k;
   	unsigned char *p;
   	const unsigned char *mbtab;
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   
   	encoding = mbfl_no2encoding(string->no_encoding);
   	if (encoding == NULL || string == NULL) {
  @@ -7615,7 +7625,7 @@
       int from,
       int length TSRMLS_DC)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   	int n, m, k, len, start, end;
   	unsigned char *p, *w;
   	const unsigned char *mbtab;
  @@ -7774,7 +7784,7 @@
       int from,
       int length TSRMLS_DC)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   	int n, m, k, len, start, end;
   	unsigned char *p, *w;
   	const unsigned char *mbtab;
  @@ -8441,7 +8451,7 @@
   {
   	int n;
   	unsigned char *p;
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   	mbfl_memory_device device;
   	struct collector_hantozen_data pc;
   	mbfl_convert_filter *decoder;
  @@ -8650,7 +8660,7 @@
   {
   	int n;
   	const char *s;
  -	mbfl_encoding *outencoding;
  +	const mbfl_encoding *outencoding;
   	struct mime_header_encoder_data *pe;
   
   	/* get output encoding and check MIME charset name */
  @@ -8822,7 +8832,7 @@
   static int
   mime_header_decoder_collector(int c, void* data TSRMLS_DC)
   {
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   	struct mime_header_decoder_data *pd = (struct mime_header_decoder_data*)data;
   
   	switch (pd->status) {
  
  
  
  1.2.2.5   +13 -13    php4/ext/mbstring/Attic/mbfilter.h
  
  Index: mbfilter.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/Attic/mbfilter.h,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- mbfilter.h	9 Jul 2002 09:14:34 -0000	1.2.2.4
  +++ mbfilter.h	3 Aug 2002 00:44:14 -0000	1.2.2.5
  @@ -86,7 +86,7 @@
    *
    */
   
  -/* $Id: mbfilter.h,v 1.11 2002/05/21 07:00:33 dets Exp $ */
  +/* $Id: mbfilter.h,v 1.12 2002/08/02 10:22:31 helly Exp $ */
   
   
   #ifndef MBFL_MBFILTER_H
  @@ -221,7 +221,7 @@
   #define MBFL_ENCTYPE_WCS4LE		0x00000200
   #define MBFL_ENCTYPE_MWC4BE		0x00000400
   #define MBFL_ENCTYPE_MWC4LE		0x00000800
  -#define MBFL_ENCTYPE_SHFTCODE	0x00001000
  +#define MBFL_ENCTYPE_SHFTCODE	0x00001000 
   
   /* wchar plane, special charactor */
   #define MBFL_WCSPLANE_MASK			0xffff
  @@ -277,8 +277,8 @@
   /*
    * language resolver
    */
  -mbfl_language * mbfl_name2language(const char *name);
  -mbfl_language * mbfl_no2language(enum mbfl_no_language no_language);
  +const mbfl_language * mbfl_name2language(const char *name);
  +const mbfl_language * mbfl_no2language(enum mbfl_no_language no_language);
   enum mbfl_no_language mbfl_name2no_language(const char *name);
   const char * mbfl_no_language2name(enum mbfl_no_language no_language);
   
  @@ -286,8 +286,8 @@
   /*
    * encoding resolver
    */
  -mbfl_encoding * mbfl_name2encoding(const char *name);
  -mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding);
  +const mbfl_encoding * mbfl_name2encoding(const char *name);
  +const mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding);
   enum mbfl_no_encoding mbfl_name2no_encoding(const char *name);
   const char * mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding);
   const char * mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding);
  @@ -348,8 +348,8 @@
   	void *data;
   	int status;
   	int cache;
  -	mbfl_encoding *from;
  -	mbfl_encoding *to;
  +	const mbfl_encoding *from;
  +	const mbfl_encoding *to;
   	int illegal_mode;
   	int illegal_substchar;
   };
  @@ -390,7 +390,7 @@
   	int status;
   	int flag;
   	int score;
  -	mbfl_encoding *encoding;
  +	const mbfl_encoding *encoding;
   };
   
   struct mbfl_identify_vtbl {
  @@ -413,8 +413,8 @@
   	mbfl_convert_filter *filter1;
   	mbfl_convert_filter *filter2;
   	mbfl_memory_device device;
  -	mbfl_encoding *from;
  -	mbfl_encoding *to;
  +	const mbfl_encoding *from;
  +	const mbfl_encoding *to;
   };
   
   mbfl_buffer_converter * mbfl_buffer_converter_new(enum mbfl_no_encoding from, enum mbfl_no_encoding to, int buf_initsz TSRMLS_DC);
  @@ -456,13 +456,13 @@
   /*
    * identify encoding
    */
  -mbfl_encoding *
  +const mbfl_encoding *
   mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
   
   const char *
   mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
   
  -enum mbfl_no_encoding
  +const enum mbfl_no_encoding
   mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
   
   /*
  
  
  
  1.2.2.2   +18 -4     php4/ext/mbstring/mbregex.c
  
  Index: mbregex.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbregex.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- mbregex.c	2 May 2002 22:01:52 -0000	1.2.2.1
  +++ mbregex.c	3 Aug 2002 00:44:14 -0000	1.2.2.2
  @@ -297,17 +297,19 @@
       return retval;
   }
   
  -
  +#define rt re_syntax_table
   static void
   init_syntax_once()
   {
  -   register int c;
  -   static int done = 0;
  +	register int c;
  +	static int done = 0;
  +	char *s = emalloc(10240), *sp;
  +	int ch;
   
      if (done)
        return;
   
  -   memset(re_syntax_table, 0, sizeof re_syntax_table);
  +   memset(re_syntax_table, 0, sizeof(re_syntax_table));
   
      for (c=0; c<=0x7f; c++)
        if (isalnum(c)) 
  @@ -318,6 +320,18 @@
        if (isalnum(c)) 
          re_syntax_table[c] = Sword2;
      done = 1;
  +   
  +   
  +	sp = s;
  +	sprintf(sp, "static const char re_syntax_table[256] = {\n");
  +	for(ch =0; ch < 256;) {
  +		sp = s+strlen(s);
  +		sprintf(sp, "\t% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,\n", rt[ch+0], rt[ch+1], rt[ch+2], rt[ch+3], rt[ch+4], rt[ch+5], rt[ch+6], rt[ch+7], rt[ch+8], rt[ch+9], rt[ch+10], rt[ch+11], rt[ch+12], rt[ch+13], rt[ch+14], rt[ch+15]);
  +		ch += 16;
  +	}
  +	sprintf(sp, "};");
  +	php_error(E_NOTICE,"reverse_table:\n%s", s);
  +	efree(s);
   }
   
   void
  
  
  
  1.2.2.5   +186 -72   php4/ext/mbstring/mbstring.c
  
  Index: mbstring.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbstring.c,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- mbstring.c	9 Jul 2002 09:14:34 -0000	1.2.2.4
  +++ mbstring.c	3 Aug 2002 00:44:14 -0000	1.2.2.5
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: mbstring.c,v 1.74 2002/06/19 21:55:42 helly Exp $ */
  +/* $Id: mbstring.c,v 1.86 2002/08/02 10:22:31 helly Exp $ */
   
   /*
    * PHP4 Multibyte String module "mbstring" (currently only for Japanese)
  @@ -132,22 +132,19 @@
   
   static const int php_mbstr_default_identify_list_size = sizeof(php_mbstr_default_identify_list)/sizeof(enum mbfl_no_encoding);
   
  -static unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
  -static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
  +static const unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
  +static const unsigned char second_args_force_ref[]    = { 2, BYREF_NONE, BYREF_FORCE };
   #if HAVE_MBREGEX
  -static unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
  +static const unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
   #endif
  -#if defined(MBSTR_ENC_TRANS)
  -SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler);
   
  -static sapi_post_entry mbstr_post_entries[] = {
  -	{ DEFAULT_POST_CONTENT_TYPE,	sizeof(DEFAULT_POST_CONTENT_TYPE)-1,	sapi_read_standard_form_data,	php_mbstr_post_handler },
  -	{ MULTIPART_CONTENT_TYPE,	sizeof(MULTIPART_CONTENT_TYPE)-1,	NULL,	rfc1867_post_handler },
  +static const sapi_post_entry mbstr_post_entries[] = {
  +	{ DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_mbstr_post_handler },
  +	{ MULTIPART_CONTENT_TYPE,    sizeof(MULTIPART_CONTENT_TYPE)-1,    NULL,                         rfc1867_post_handler },
   	{ NULL, 0, NULL, NULL }
   };
  -#endif
   
  -static struct mb_overload_def mb_ovld[] = {
  +static const struct mb_overload_def mb_ovld[] = {
   	{MB_OVERLOAD_MAIL, "mail", "mb_send_mail", "mb_orig_mail"},
   	{MB_OVERLOAD_STRING, "strlen", "mb_strlen", "mb_orig_strlen"},
   	{MB_OVERLOAD_STRING, "strpos", "mb_strpos", "mb_orig_strrpos"},
  @@ -169,7 +166,7 @@
   	int regex_encoding;
   };
   
  -struct def_mbctype_tbl mbctype_tbl[] = {
  +const struct def_mbctype_tbl mbctype_tbl[] = {
   	{mbfl_no_encoding_ascii,MBCTYPE_ASCII},
   	{mbfl_no_encoding_euc_jp,MBCTYPE_EUC},
   	{mbfl_no_encoding_sjis,MBCTYPE_SJIS},
  @@ -185,7 +182,7 @@
   	PHP_FE(mb_http_output,			NULL)
   	PHP_FE(mb_detect_order,			NULL)
   	PHP_FE(mb_substitute_character,	NULL)
  -	PHP_FE(mb_parse_str,			second_args_force_ref)
  +	PHP_FE(mb_parse_str,			(unsigned char *)second_args_force_ref)
   	PHP_FE(mb_output_handler,			NULL)
   	PHP_FE(mb_preferred_mime_name,	NULL)
   	PHP_FE(mb_strlen,					NULL)
  @@ -200,7 +197,7 @@
   	PHP_FE(mb_convert_kana,			NULL)
   	PHP_FE(mb_encode_mimeheader,		NULL)
   	PHP_FE(mb_decode_mimeheader,		NULL)
  -	PHP_FE(mb_convert_variables,		third_and_rest_force_ref)
  +	PHP_FE(mb_convert_variables,		(unsigned char *)third_and_rest_force_ref)
   	PHP_FE(mb_encode_numericentity,		NULL)
   	PHP_FE(mb_decode_numericentity,		NULL)
   	PHP_FE(mb_send_mail,					NULL)
  @@ -220,8 +217,8 @@
   	PHP_FALIAS(i18n_ja_jp_hantozen,		mb_convert_kana,		NULL)
   #if HAVE_MBREGEX
   	PHP_FE(mb_regex_encoding,	NULL)
  -	PHP_FE(mb_ereg,			third_argument_force_ref)
  -	PHP_FE(mb_eregi,			third_argument_force_ref)
  +	PHP_FE(mb_ereg,			(unsigned char *)third_argument_force_ref)
  +	PHP_FE(mb_eregi,			(unsigned char *)third_argument_force_ref)
   	PHP_FE(mb_ereg_replace,			NULL)
   	PHP_FE(mb_eregi_replace,			NULL)
   	PHP_FE(mb_split,					NULL)
  @@ -462,7 +459,60 @@
   
   #endif
   
  +
   /* php.ini directive handler */
  +static PHP_INI_MH(OnUpdate_mbstring_language)
  +{
  +	enum mbfl_no_language no_language;
  +
  +	no_language = mbfl_name2no_language(new_value);
  +	if (no_language != mbfl_no_language_invalid) {
  +		switch (no_language) {
  +		case mbfl_no_language_japanese:
  +			MBSTRG(language) = mbfl_no_language_japanese;
  +			MBSTRG(current_language) = mbfl_no_language_japanese;
  +			MBSTRG(internal_encoding) = mbfl_no_encoding_euc_jp;
  +			MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_jp;
  +			break;
  +		case mbfl_no_language_korean:
  +			MBSTRG(language) = mbfl_no_language_korean;
  +			MBSTRG(current_language) = mbfl_no_language_korean;
  +			MBSTRG(internal_encoding) = mbfl_no_encoding_euc_kr;
  +			MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_kr;
  +			break;
  +		case mbfl_no_language_simplified_chinese:
  +			MBSTRG(language) = mbfl_no_language_simplified_chinese;
  +			MBSTRG(current_language) = mbfl_no_language_simplified_chinese;
  +			MBSTRG(internal_encoding) = mbfl_no_encoding_euc_cn;
  +			MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_cn;
  +			break;
  +		case mbfl_no_language_traditional_chinese:
  +			MBSTRG(language) = mbfl_no_language_traditional_chinese;
  +			MBSTRG(current_language) = mbfl_no_language_traditional_chinese;
  +			MBSTRG(internal_encoding) = mbfl_no_encoding_euc_tw;
  +			MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_tw;
  +			break;
  +		case mbfl_no_language_russian:
  +			MBSTRG(language) = mbfl_no_language_russian;
  +			MBSTRG(current_language) = mbfl_no_language_russian;
  +			MBSTRG(internal_encoding) = mbfl_no_encoding_koi8r;
  +			MBSTRG(current_internal_encoding) = mbfl_no_encoding_koi8r;
  +			break;
  +		case mbfl_no_language_english:
  +		default:
  +			MBSTRG(language) = mbfl_no_language_english;
  +			MBSTRG(current_language) = mbfl_no_language_english;
  +			MBSTRG(internal_encoding) = mbfl_no_encoding_8859_1;
  +			MBSTRG(current_internal_encoding) = mbfl_no_encoding_8859_1;
  +			break;
  +		}
  +
  +	} else {
  +		return FAILURE;
  +	}
  +	return SUCCESS;
  +}
  +
   static PHP_INI_MH(OnUpdate_mbstring_detect_order)
   {
   	int *list, size;
  @@ -497,6 +547,7 @@
   	return SUCCESS;
   }
   
  +
   static PHP_INI_MH(OnUpdate_mbstring_http_output)
   {
   	enum mbfl_no_encoding no_encoding;
  @@ -518,7 +569,7 @@
   {
   	enum mbfl_no_encoding no_encoding;
   #if HAVE_MBREGEX
  -	struct def_mbctype_tbl *p = NULL;
  +	const struct def_mbctype_tbl *p = NULL;
   #endif
   
   	no_encoding = mbfl_name2no_encoding(new_value);
  @@ -582,6 +633,7 @@
   
   /* php.ini directive registration */
   PHP_INI_BEGIN()
  +	 PHP_INI_ENTRY("mbstring.language", NULL, PHP_INI_ALL, OnUpdate_mbstring_language)
   	 PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order)
   	 PHP_INI_ENTRY("mbstring.http_input", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_input)
   	 PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output)
  @@ -591,6 +643,9 @@
   #endif /* ZEND_MULTIBYTE */
   	 PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
   	 STD_PHP_INI_ENTRY("mbstring.func_overload", "0", PHP_INI_SYSTEM, OnUpdateInt, func_overload, zend_mbstring_globals, mbstring_globals)
  +#if !defined(COMPILE_DL_MBSTRING)
  +	 STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0", PHP_INI_SYSTEM, OnUpdateBool, encoding_translation, zend_mbstring_globals, mbstring_globals)
  +#endif /* !defined(COMPILE_DL_MBSTRING) */
   PHP_INI_END()
   
   
  @@ -598,20 +653,25 @@
   static void
   php_mbstring_init_globals(zend_mbstring_globals *pglobals TSRMLS_DC)
   {
  +	MBSTRG(language) = mbfl_no_language_english;
  +	MBSTRG(current_language) = mbfl_no_language_english;
  +	MBSTRG(internal_encoding) = mbfl_no_encoding_8859_1;
  +	MBSTRG(current_internal_encoding) = mbfl_no_encoding_8859_1;
  +
   #if defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
  -	MBSTRG(language) = mbfl_no_language_chinese;
  -	MBSTRG(current_language) = mbfl_no_language_chinese;
  +	MBSTRG(language) = mbfl_no_language_simplified_chinese;
  +	MBSTRG(current_language) = mbfl_no_language_simplified_chinese;
   	MBSTRG(internal_encoding) = mbfl_no_encoding_euc_cn;
   	MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_cn;
   #endif
   #if defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_JA)
  -	MBSTRG(language) = mbfl_no_language_chinese;
  -	MBSTRG(current_language) = mbfl_no_language_chinese;
  +	MBSTRG(language) = mbfl_no_language_traditional_chinese;
  +	MBSTRG(current_language) = mbfl_no_language_traditional_chinese;
   	MBSTRG(internal_encoding) = mbfl_no_encoding_euc_tw;
   	MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_tw;
   #endif
   #if defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_JA)
  -	MBSTRG(language) = mbfl_no_language_chinese;
  +	MBSTRG(language) = mbfl_no_language_korean;
   	MBSTRG(current_language) = mbfl_no_language_korean;
   	MBSTRG(internal_encoding) = mbfl_no_encoding_euc_kr;
   	MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_kr;
  @@ -644,6 +704,7 @@
   	MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
   	MBSTRG(current_filter_illegal_substchar) = 0x3f;	/* '?' */
   	MBSTRG(func_overload) = 0;
  +	MBSTRG(encoding_translation) = 0;
   	pglobals->outconv = NULL;
   #if HAVE_MBREGEX
   	MBSTRG(default_mbctype) = MBCTYPE_EUC;
  @@ -667,10 +728,12 @@
   
   	REGISTER_INI_ENTRIES();
   
  -#if defined(MBSTR_ENC_TRANS)
  -	sapi_unregister_post_entry(mbstr_post_entries);
  -	sapi_register_post_entries(mbstr_post_entries);
  -#endif
  +
  +	if(MBSTRG(encoding_translation)) {
  +		sapi_unregister_post_entry(mbstr_post_entries);
  +		sapi_register_post_entries(mbstr_post_entries);
  +		sapi_register_treat_data(mbstr_treat_data);
  +	}
   
   	REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT);
   	REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT);
  @@ -696,6 +759,10 @@
   		free(MBSTRG(detect_order_list));
   	}
   
  +	if(MBSTRG(encoding_translation)) {
  +		sapi_register_treat_data(php_default_treat_data);
  +	}
  +
   #if HAVE_MBREGEX
   	zend_hash_destroy(&MBSTRG(ht_rc));
   #endif
  @@ -708,7 +775,7 @@
   {
   	int n, *list=NULL, *entry;
   	zend_function *func, *orig;
  -	struct mb_overload_def *p;
  +	const struct mb_overload_def *p;
   
   	MBSTRG(current_language) = MBSTRG(language);
   	MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding);
  @@ -746,12 +813,12 @@
   				
   				if (zend_hash_find(EG(function_table), p->orig_func, 
   								   strlen(p->orig_func)+1, (void **)&orig) != SUCCESS) {
  -					php_error(E_ERROR, "mbstring couldn't find function %s.", p->orig_func);
  +					php_error(E_ERROR, "%s() mbstring couldn't find function %s.", get_active_function_name(TSRMLS_C), p->orig_func);
   				}
   				zend_hash_add(EG(function_table), p->save_func, strlen(p->save_func)+1, orig, sizeof(zend_function), NULL);
   				if (zend_hash_update(EG(function_table), p->orig_func, strlen(p->orig_func)+1,
   									 func, sizeof(zend_function), NULL) == FAILURE){
  -					php_error(E_ERROR, "mbstring couldn't replace function %s.", p->orig_func);
  +					php_error(E_ERROR, "%s() mbstring couldn't replace function %s.", get_active_function_name(TSRMLS_C), p->orig_func);
   				}
   			}
   			p++;
  @@ -764,7 +831,7 @@
   
   PHP_RSHUTDOWN_FUNCTION(mbstring)
   {
  -	struct mb_overload_def *p;
  +	const struct mb_overload_def *p;
   	zend_function *orig;
   
   	if (MBSTRG(current_detect_order_list) != NULL) {
  @@ -839,9 +906,9 @@
   #if defined(HAVE_MBSTR_KR)
   	php_info_print_table_row(2, "korean support", "enabled");	
   #endif
  -#if defined(MBSTR_ENC_TRANS)
  -	php_info_print_table_row(2, "http input encoding translation", "enabled");	
  -#endif
  +	if(MBSTRG(encoding_translation)) {
  +		php_info_print_table_row(2, "http input encoding translation", "enabled");	
  +	}
   #if defined(HAVE_MBREGEX)
   	php_info_print_table_row(2, "multibyte (japanese) regex support", "enabled");	
   #endif
  @@ -1167,11 +1234,10 @@
   }
   /* }}} */
   
  -#if defined(MBSTR_ENC_TRANS)
   static void
   php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
   {
  -	char *var, *val;
  +	char *var, *val, *s1, *s2;
   	char *strtok_buf = NULL, **val_list;
   	zval *array_ptr = (zval *) arg;
   	int n, num, val_len, *len_list, *elist, elistsz;
  @@ -1183,19 +1249,23 @@
   	mbfl_string_init_set(&string, MBSTRG(current_language), MBSTRG(current_internal_encoding));
   	mbfl_string_init_set(&resvar, MBSTRG(current_language), MBSTRG(current_internal_encoding));
   	mbfl_string_init_set(&resval, MBSTRG(current_language), MBSTRG(current_internal_encoding));
  -	
  -	/* count the variables contained in the query */
  -	num = 0;
  -	var = res;
  -	n = strlen(res);
  -	while(n > 0) {
  -		if (*var == '=') {
  -			num++;
  -		}
  -		var++;
  -		n--;
  +
  +	if (!res || *res == '\0') {
  +		return;
   	}
  -	num *= 2;
  +	
  +	/* count the variables(separators) contained in the "res".
  +	 * separator may contain multiple separator chars.
  +	 * separaror chars are set in php.ini (arg_separator.input)
  +	 */
  +	num = 1;
  +	for (s1=res; *s1 != '\0'; s1++)
  +		for (s2=separator; *s2 != '\0'; s2++)
  +			if (*s1 == *s2)
  +				num++;
  +				
  +	num *= 2; /* need space for variable name and value */
  +	
   	val_list = (char **)ecalloc(num, sizeof(char *));
   	len_list = (int *)ecalloc(num, sizeof(int));
   
  @@ -1203,28 +1273,24 @@
   	n = 0;
   	strtok_buf = NULL;
   	var = php_strtok_r(res, separator, &strtok_buf);
  -	
  -	while (var && n < num) {
  +	while (var)  {
   		val = strchr(var, '=');
  +		val_list[n] = var;
  +		len_list[n] = php_url_decode(var, strlen(var));
  +		n++;
   		if (val) { /* have a value */
   			*val++ = '\0';
  -			val_list[n] = var;
  -			len_list[n] = php_url_decode(var, strlen(var));
  -			n++;
   			val_list[n] = val;
   			len_list[n] = php_url_decode(val, strlen(val));
   		} else {
  -			val_list[n] = var;
  -			len_list[n] = php_url_decode(var, strlen(var));
  -			n++;
  -			val_list[n] = NULL;
  +			val_list[n] = "";
   			len_list[n] = 0;
   		}
   		n++;
   		var = php_strtok_r(NULL, separator, &strtok_buf);
  -	}
  -	num = n;
  -
  +	} 
  +	num = n; /* make sure to process initilized vars only */
  +	
   	/* initialize converter */
   	to_encoding = MBSTRG(current_internal_encoding);
   	elist = MBSTRG(http_input_list);
  @@ -1310,7 +1376,6 @@
   
   }
   
  -#if defined(MBSTR_ENC_TRANS)
   SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
   {
   	MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
  @@ -1321,10 +1386,39 @@
   		MBSTRG(http_input_identify_post) = MBSTRG(http_input_identify);
   	}
   }
  -#endif
  +
  +
  +#define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0)
  +#define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0)
  +
  +char *mbstr_strrchr(const char *s, char c TSRMLS_DC){
  +	unsigned char *p = (unsigned char *)s, *last = NULL;
  +	while(*p++) {
  +		if (*p == c) {
  +			last = p;
  +		}
  +		if (*p == '\0'){
  +			break;
  +		}
  +		if (MBSTRG(current_language) == mbfl_no_language_japanese 
  +			&& IS_SJIS1(*p) && IS_SJIS2(*(p+1))) {
  +			p++;
  +		}
  +	}
  +	return last;
  +}
  +
  +int mbstr_is_mb_leadbyte(const char *s TSRMLS_DC){
  +	unsigned char *p = (unsigned char *)s;
  +	if (MBSTRG(current_language) == mbfl_no_language_japanese 
  +		&& IS_SJIS1(*p) && IS_SJIS2(*(p+1))){
  +		return 1;
  +	}
  +	return 0;
  +}
   
   /* http input processing */
  -void mbstr_treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
  +SAPI_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
   {
   	char *res = NULL, *separator=NULL;
   	const char *c_var;
  @@ -1438,7 +1532,6 @@
   		efree(res);
   	}
   }
  -#endif
   
   /* {{{ proto bool mb_parse_str(string encoded_string [, array result])
      Parses GET/POST/COOKIE data and sets global variables */
  @@ -1637,10 +1730,12 @@
   	size_t arg_string_len;
   	long arg_status;
   	mbfl_string string, result;
  -	const char *mimetype, *charset;
  +	const char *charset;
   	char *p;
   	enum mbfl_no_encoding encoding;
   	int last_feed, len;
  +	unsigned char send_text_mimetype = 0;
  +	char *s, *mimetype = NULL;
   
   	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &arg_string, &arg_string_len, &arg_status) == FAILURE) {
   		WRONG_PARAM_COUNT;
  @@ -1658,9 +1753,22 @@
   		if (encoding == mbfl_no_encoding_pass) {
   			RETURN_STRINGL(arg_string, arg_string_len, 1);
   		}
  - 		/* if content-type is not yet set, set it and activate the converter */
  - 		if (SG(sapi_headers).send_default_content_type ) {
  +
  +		/* analyze mime type */
  +		if (SG(sapi_headers).mimetype && 
  +			strncmp(SG(sapi_headers).mimetype, "text/", 5) == 0) {
  +			if ((s = strchr(SG(sapi_headers).mimetype,';')) == NULL){
  +				mimetype = estrdup(SG(sapi_headers).mimetype);
  +			} else {
  +				mimetype = estrndup(SG(sapi_headers).mimetype,s-SG(sapi_headers).mimetype);
  +			}
  +			send_text_mimetype = 1;
  +		} else if (SG(sapi_headers).send_default_content_type) {
   			mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
  +		}
  +
  + 		/* if content-type is not yet set, set it and activate the converter */
  + 		if (SG(sapi_headers).send_default_content_type || send_text_mimetype) {
   			charset = mbfl_no2preferred_mime_name(encoding);
   			if (charset) {
   				len = (sizeof ("Content-Type:")-1) + strlen(mimetype) + (sizeof (";charset=")-1) + strlen(charset) + 1;
  @@ -1674,6 +1782,9 @@
   			}
    			/* activate the converter */
    			MBSTRG(outconv) = mbfl_buffer_converter_new(MBSTRG(current_internal_encoding), encoding, 0 TSRMLS_CC);
  +			if (send_text_mimetype){
  +				efree(mimetype);
  +			}
    		}
     	}
   
  @@ -3229,6 +3340,9 @@
   }
   /* }}} */
   
  +PHPAPI int mbstr_encoding_translation(TSRMLS_D) {
  +	return MBSTRG(encoding_translation);
  +}
   
   #ifdef ZEND_MULTIBYTE
   PHPAPI int php_mbstring_set_zend_encoding(TSRMLS_D)
  @@ -3274,13 +3388,13 @@
   	encoding_converter = NULL;
   	multibyte_oddlen = php_mbstring_oddlen;
   
  -#if defined(MBSTR_ENC_TRANS)
  -	/* notify internal encoding to Zend Engine */
  -	name = (char*)mbfl_no_encoding2name(MBSTRG(current_internal_encoding));
  -	zend_multibyte_set_internal_encoding(name, strlen(name) TSRMLS_CC);
  +	if(MBSTRG(encoding_translation)) {
  +		/* notify internal encoding to Zend Engine */
  +		name = (char*)mbfl_no_encoding2name(MBSTRG(current_internal_encoding));
  +		zend_multibyte_set_internal_encoding(name, strlen(name) TSRMLS_CC);
   
  -	encoding_converter = php_mbstring_encoding_converter;
  -#endif /* defined(MBSTR_ENC_TRANS) */
  +		encoding_converter = php_mbstring_encoding_converter;
  +	}
   
   	zend_multibyte_set_functions(encoding_detector, encoding_converter,
   			multibyte_oddlen TSRMLS_CC);
  
  
  
  1.2.2.3   +9 -1      php4/ext/mbstring/mbstring.dsp
  
  Index: mbstring.dsp
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbstring.dsp,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- mbstring.dsp	9 May 2002 04:17:00 -0000	1.2.2.2
  +++ mbstring.dsp	3 Aug 2002 00:44:14 -0000	1.2.2.3
  @@ -43,7 +43,7 @@
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
   # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /c
  -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D ZTS=1 /D "COMPILE_DL_MBSTRING" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MBSTRING=1 /D "MBSTR_ENC_TRANS" /YX /FD /c
  +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D ZTS=1 /D "COMPILE_DL_MBSTRING" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MBSTRING=1 /D "MBSTR_ENC_TRANS" /FR /YX /FD /c
   # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
   # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
   # ADD BASE RSC /l 0x407 /d "NDEBUG"
  @@ -108,6 +108,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=.\mbfilter_ru.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\mbfilter_tw.c
   # End Source File
   # Begin Source File
  @@ -145,6 +149,10 @@
   # Begin Source File
   
   SOURCE=.\mbfilter_kr.h
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=.\mbfilter_ru.h
   # End Source File
   # Begin Source File
   
  
  
  
  1.2.2.2   +10 -1     php4/ext/mbstring/mbstring.h
  
  Index: mbstring.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbstring.h,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- mbstring.h	9 May 2002 04:17:00 -0000	1.2.2.1
  +++ mbstring.h	3 Aug 2002 00:44:14 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: mbstring.h,v 1.21 2002/05/08 12:30:47 hirokawa Exp $ */
  +/* $Id: mbstring.h,v 1.26 2002/08/02 10:22:31 helly Exp $ */
   
   /*
    * PHP4 Multibyte String module "mbstring" (currently only for Japanese)
  @@ -56,6 +56,7 @@
   #if HAVE_MBSTRING
   
   #include "mbfilter.h"
  +#include "SAPI.h"
   
   #define PHP_MBSTRING_API 20020405
   
  @@ -124,6 +125,10 @@
   int php_mbregex_name2mbctype(const char *pname);
   #endif
   
  +char *mbstr_strrchr(const char *s, char c TSRMLS_DC);
  +int mbstr_is_mb_leadbyte(const char *s TSRMLS_DC);
  +int mbstr_encoding_translation(TSRMLS_D);
  +
   ZEND_BEGIN_MODULE_GLOBALS(mbstring)
   	int language;
   	int current_language;
  @@ -151,6 +156,7 @@
   	int current_filter_illegal_mode;
   	int current_filter_illegal_substchar;
   	long func_overload;
  +	int encoding_translation;
   	mbfl_buffer_converter *outconv;
   #if HAVE_MBREGEX
   	int default_mbctype;
  @@ -190,6 +196,9 @@
   		TSRMLS_DC);
   int php_mbstring_oddlen(char *string, int length, const char *encoding TSRMLS_DC);
   #endif /* ZEND_MULTIBYTE */
  +
  +SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler);
  +SAPI_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data);
   
   #else	/* HAVE_MBSTRING */
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +6 -6      php4/ext/ming/ming.c
  
  Index: ming.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/ming/ming.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ming.c	29 Apr 2002 02:30:51 -0000	1.2
  +++ ming.c	3 Aug 2002 00:44:15 -0000	1.2.2.1
  @@ -1249,8 +1249,8 @@
   }
   /* }}} */
   
  -/* {{{ proto SWFShape swfmorph_getShape1(void)
  -   Return's this SWFMorph's start shape */
  +/* {{{ proto object swfmorph_getShape1(void)
  +   Return's this SWFMorph's start shape object */
   PHP_FUNCTION(swfmorph_getShape1)
   {
   	SWFMorph morph = getMorph(getThis() TSRMLS_CC);
  @@ -1263,8 +1263,8 @@
   }
   /* }}} */
   
  -/* {{{ proto SWFShape swfmorph_getShape2(void)
  -   Return's this SWFMorph's start shape */
  +/* {{{ proto object swfmorph_getShape2(void)
  +   Return's this SWFMorph's start shape object */
   PHP_FUNCTION(swfmorph_getShape2)
   {
   	SWFMorph morph = getMorph(getThis() TSRMLS_CC);
  @@ -2133,8 +2133,8 @@
   }
   /* }}} */
   
  -/* {{{ proto SWFDisplayItem swfsprite_add(SWFCharacter)
  -   Adds the character to the sprite, returns a displayitem */
  +/* {{{ proto object swfsprite_add(SWFCharacter)
  +   Adds the character to the sprite, returns a displayitem object */
   PHP_FUNCTION(swfsprite_add)
   {
   	zval **zchar;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +1 -3      php4/ext/mnogosearch/php_mnogo.c
  
  Index: php_mnogo.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mnogosearch/php_mnogo.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_mnogo.c	9 Jul 2002 09:14:35 -0000	1.2.2.1
  +++ php_mnogo.c	3 Aug 2002 00:44:15 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   /* $Source: /repository/php4/ext/mnogosearch/php_mnogo.c,v $ */
  -/* $Id: php_mnogo.c,v 1.59 2002/06/26 08:57:17 derick Exp $ */
  +/* $Id: php_mnogo.c,v 1.60 2002/08/02 07:22:18 gluke Exp $ */
   
   /*
      +----------------------------------------------------------------------+
  @@ -356,13 +356,11 @@
   	REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_DB",	UDM_ISPELL_TYPE_DB,CONST_CS | CONST_PERSISTENT);
   	REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_SERVER",UDM_ISPELL_TYPE_SERVER,CONST_CS | CONST_PERSISTENT);
   
  -#if UDM_VERSION_ID < 30200	
   	/* word match mode params */
   	REGISTER_LONG_CONSTANT("UDM_MATCH_WORD",	UDM_MATCH_WORD,CONST_CS | CONST_PERSISTENT);
   	REGISTER_LONG_CONSTANT("UDM_MATCH_BEGIN",	UDM_MATCH_BEGIN,CONST_CS | CONST_PERSISTENT);
   	REGISTER_LONG_CONSTANT("UDM_MATCH_SUBSTR",	UDM_MATCH_SUBSTR,CONST_CS | CONST_PERSISTENT);
   	REGISTER_LONG_CONSTANT("UDM_MATCH_END",		UDM_MATCH_END,CONST_CS | CONST_PERSISTENT);
  -#endif
   	
   	return SUCCESS;
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +18 -13    php4/ext/mysql/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mysql/config.m4,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- config.m4	9 Jul 2002 09:14:36 -0000	1.2.2.1
  +++ config.m4	3 Aug 2002 00:44:15 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.51 2002/06/11 00:18:34 sniper Exp $
  +dnl $Id: config.m4,v 1.52 2002/07/08 15:31:01 sniper Exp $
   dnl
   
   sinclude(ext/mysql/libmysql/acinclude.m4)
  @@ -33,31 +33,36 @@
         break 2
       fi
     done
  -  
  -  AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
  -  AC_MSG_RESULT([$MYSQL_SOCK])
  -])
   
  +  if test -n "$MYSQL_SOCK"; then
  +    AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
  +    AC_MSG_RESULT([$MYSQL_SOCK])
  +  else
  +    AC_MSG_RESULT([no])
  +  fi
  +])
   
  -PHP_ARG_WITH(mysql, for MySQL support,
  -[  --with-mysql[=DIR]      Include MySQL support. DIR is the MySQL base directory.
  -                          If unspecified, the bundled MySQL library will be used.], yes)
   
   PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
   [  --with-mysql-sock[=DIR] Location of the MySQL unix socket pointer.
                             If unspecified, the default locations are searched.])
   
  +PHP_ARG_WITH(mysql, for MySQL support,
  +[  --with-mysql[=DIR]      Include MySQL support. DIR is the MySQL base directory.
  +                          If unspecified, the bundled MySQL library will be used.], yes)
   
   if test "$PHP_MYSQL" != "no"; then
     AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
   
     AC_MSG_CHECKING(for MySQL UNIX socket location)
  -  if test "$PHP_MYSQL_SOCK" != "no"; then
  -      MYSQL_SOCK=$PHP_MYSQL_SOCK
  -      AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
  -      AC_MSG_RESULT([$MYSQL_SOCK])
  -  else 
  +  if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
  +    MYSQL_SOCK=$PHP_MYSQL_SOCK
  +    AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
  +    AC_MSG_RESULT([$MYSQL_SOCK])
  +  elif test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL_SOCK" = "yes"; then
       PHP_MYSQL_SOCKET_SEARCH
  +  else
  +    AC_MSG_RESULT([no])
     fi
   fi
   
  
  
  
  1.2.2.4   +113 -67   php4/ext/mysql/php_mysql.c
  
  Index: php_mysql.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mysql/php_mysql.c,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- php_mysql.c	9 Jul 2002 09:14:36 -0000	1.2.2.3
  +++ php_mysql.c	3 Aug 2002 00:44:15 -0000	1.2.2.4
  @@ -16,8 +16,7 @@
      +----------------------------------------------------------------------+
   */
    
  -/* $Id: php_mysql.c,v 1.137 2002/06/26 08:07:59 derick Exp $ */
  -
  +/* $Id: php_mysql.c,v 1.147 2002/07/21 21:36:10 georg Exp $ */
   
   /* TODO:
    *
  @@ -25,45 +24,41 @@
    */
   
   #ifdef HAVE_CONFIG_H
  -#include "config.h"
  +# include "config.h"
   #endif
   
   #include "php.h"
   #include "php_globals.h"
  -#include "php_mysql.h"
   #include "ext/standard/info.h"
   #include "ext/standard/php_string.h"
   
   #if HAVE_MYSQL
   
   #ifdef PHP_WIN32
  -#include <winsock.h>
  -#define signal(a, b) NULL
  +# include <winsock.h>
  +# define signal(a, b) NULL
  +#elif defined(NETWARE)
  +# include <sys/socket.h>
  +# define signal(a, b) NULL
   #else
  -#include "build-defs.h"
  -#if HAVE_SIGNAL_H
  -#include <signal.h>
  -#endif
  -
  -#if HAVE_SYS_TYPES_H
  -#include <sys/types.h>
  -#endif
  -#include <netdb.h>
  -#include <netinet/in.h>
  +# include "build-defs.h"
  +# if HAVE_SIGNAL_H
  +#  include <signal.h>
  +# endif
  +# if HAVE_SYS_TYPES_H
  +#  include <sys/types.h>
  +# endif
  +# include <netdb.h>
  +# include <netinet/in.h>
   #endif
   
  -#ifndef HAVE_USHORT
  -#undef ushort
  -typedef unsigned short ushort;
  -#endif
  +#include <mysql.h>
  +#include "php_ini.h"
  +#include "php_mysql.h"
   
   /* True globals, no need for thread safety */
   static int le_result, le_link, le_plink;
   
  -#include "php_ini.h"
  -
  -# include <mysql.h>
  -
   #ifdef HAVE_MYSQL_REAL_CONNECT
   # ifdef HAVE_ERRMSG_H
   #  include <errmsg.h>
  @@ -73,13 +68,13 @@
   #define SAFE_STRING(s) ((s)?(s):"")
   
   #if MYSQL_VERSION_ID > 32199
  -#define mysql_row_length_type unsigned long
  -#define HAVE_MYSQL_ERRNO
  +# define mysql_row_length_type unsigned long
  +# define HAVE_MYSQL_ERRNO
   #else
  -#define mysql_row_length_type unsigned int
  -#	ifdef mysql_errno
  -#	define HAVE_MYSQL_ERRNO
  -#	endif
  +# define mysql_row_length_type unsigned int
  +# ifdef mysql_errno
  +#  define HAVE_MYSQL_ERRNO
  +# endif
   #endif
   
   #if MYSQL_VERSION_ID >= 32032
  @@ -114,7 +109,6 @@
   	int active_result_id;
   } php_mysql_conn;
   
  -
   /* {{{ mysql_functions[]
    */
   function_entry mysql_functions[] = {
  @@ -122,17 +116,19 @@
   	PHP_FE(mysql_pconnect,								NULL)
   	PHP_FE(mysql_close,									NULL)
   	PHP_FE(mysql_select_db,								NULL)
  +#ifndef NETWARE		/* The below two functions not supported on NetWare */
   #if MYSQL_VERSION_ID < 40000
   	PHP_FE(mysql_create_db,								NULL)
   	PHP_FE(mysql_drop_db,								NULL)
   #endif
  +#endif	/* NETWARE */
   	PHP_FE(mysql_query,									NULL)
   	PHP_FE(mysql_unbuffered_query,						NULL)
   	PHP_FE(mysql_db_query,								NULL)
   	PHP_FE(mysql_list_dbs,								NULL)
   	PHP_FE(mysql_list_tables,							NULL)
   	PHP_FE(mysql_list_fields,							NULL)
  -	PHP_FE(mysql_list_processes,					NULL)
  +	PHP_FE(mysql_list_processes,						NULL)
   	PHP_FE(mysql_error,									NULL)
   #ifdef HAVE_MYSQL_ERRNO
   	PHP_FE(mysql_errno,									NULL)
  @@ -179,10 +175,12 @@
   	PHP_FALIAS(mysql_fieldtype,		mysql_field_type,	NULL)
   	PHP_FALIAS(mysql_fieldflags,	mysql_field_flags,	NULL)
   	PHP_FALIAS(mysql_selectdb,		mysql_select_db,	NULL)
  +#ifndef NETWARE		/* The below two functions not supported on NetWare */
   #if MYSQL_VERSION_ID < 40000
   	PHP_FALIAS(mysql_createdb,		mysql_create_db,	NULL)
   	PHP_FALIAS(mysql_dropdb,		mysql_drop_db,		NULL)
   #endif
  +#endif	/* NETWARE */
   	PHP_FALIAS(mysql_freeresult,	mysql_free_result,	NULL)
   	PHP_FALIAS(mysql_numfields,		mysql_num_fields,	NULL)
   	PHP_FALIAS(mysql_numrows,		mysql_num_rows,		NULL)
  @@ -223,6 +221,27 @@
   
   #define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "%s(): A link to the server could not be established", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } }
   
  +/* {{{ _rollback_mysql_transactions
  + */
  +static int _rollback_mysql_transactions(zend_rsrc_list_entry *rsrc TSRMLS_DC)
  +{
  +	php_mysql_conn *link;
  +	char	query[128];
  +
  +	/* check if its a persistent link */
  +	if (Z_TYPE_P(rsrc) != le_plink) 
  +		return 0;
  +
  +	link = (php_mysql_conn *) rsrc->ptr;
  +
  +	/* rollback possible transactions */
  +	strcpy (query, "ROLLBACK");
  +	mysql_real_query(&link->conn, query, strlen(query));
  +
  +	return 0;	
  +}
  +/* }}} */
  +
   /* {{{ _free_mysql_result
    * This wrapper is required since mysql_free_result() returns an integer, and
    * thus, cannot be used directly
  @@ -284,7 +303,7 @@
   static PHP_INI_MH(OnMySQLPort)
   {
   	if (new_value==NULL) { /* default port */
  -#ifndef PHP_WIN32
  +#if !defined(PHP_WIN32) && !defined(NETWARE)
   		struct servent *serv_ptr;
   		char *env;
   		
  @@ -315,6 +334,7 @@
   	STD_PHP_INI_ENTRY("mysql.default_password",		NULL,	PHP_INI_ALL,		OnUpdateString,		default_password,	zend_mysql_globals,		mysql_globals)
   	PHP_INI_ENTRY("mysql.default_port",				NULL,	PHP_INI_ALL,		OnMySQLPort)
   	STD_PHP_INI_ENTRY("mysql.default_socket",		NULL,	PHP_INI_ALL,		OnUpdateStringUnempty,	default_socket,	zend_mysql_globals,		mysql_globals)
  +	STD_PHP_INI_ENTRY_EX("mysql.connect_timeout",	"0",	PHP_INI_SYSTEM,		OnUpdateInt,		connect_timeout, 	zend_mysql_globals,		mysql_globals, display_link_numbers)
   PHP_INI_END()
   /* }}} */
   
  @@ -329,6 +349,7 @@
   	mysql_globals->default_password = NULL;
   	mysql_globals->connect_errno = 0;
   	mysql_globals->connect_error = NULL;
  +	mysql_globals->connect_timeout = 0;
   }
   /* }}} */
   
  @@ -349,6 +370,11 @@
   	REGISTER_LONG_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT);
   	REGISTER_LONG_CONSTANT("MYSQL_USE_RESULT", MYSQL_USE_RESULT, CONST_CS | CONST_PERSISTENT);
   	REGISTER_LONG_CONSTANT("MYSQL_STORE_RESULT", MYSQL_STORE_RESULT, CONST_CS | CONST_PERSISTENT);
  +	REGISTER_LONG_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT);
  +	REGISTER_LONG_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT);
  +	REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
  +	REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); 
  +
   
   #ifdef ZTS
   # if MYSQL_VERSION_ID >= 40000
  @@ -392,6 +418,8 @@
    */
   PHP_RSHUTDOWN_FUNCTION(mysql)
   {
  +	zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_mysql_transactions TSRMLS_CC);
  +
   	if (MySG(connect_error)!=NULL) {
   		efree(MySG(connect_error));
   	}
  @@ -412,7 +440,7 @@
   	sprintf(buf, "%ld", MySG(num_links));
   	php_info_print_table_row(2, "Active Links", buf);
   	php_info_print_table_row(2, "Client API version", mysql_get_client_info());
  -#ifndef PHP_WIN32
  +#if !defined (PHP_WIN32) && !defined (NETWARE)
   	php_info_print_table_row(2, "MYSQL_MODULE_TYPE", PHP_MYSQL_TYPE);
   	php_info_print_table_row(2, "MYSQL_SOCKET", MYSQL_UNIX_ADDR);
   	php_info_print_table_row(2, "MYSQL_INCLUDE", PHP_MYSQL_INCLUDE);
  @@ -441,11 +469,14 @@
   	char *user=NULL, *passwd=NULL, *host_and_port=NULL, *socket=NULL, *tmp=NULL, *host=NULL;
   	char *hashed_details=NULL;
   	int hashed_details_length, port = MYSQL_PORT;
  +	int client_flags = 0;
   	php_mysql_conn *mysql=NULL;
   	void (*handler) (int);
  -	zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL, **z_new_link=NULL;
  +	zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL, **z_new_link=NULL, **z_client_flags=NULL;
   	zend_bool free_host=0, new_link=0;
  +	long connect_timeout;
   
  +	connect_timeout = MySG(connect_timeout);
   	socket = MySG(default_socket);
   
   	if (PG(sql_safe_mode)) {
  @@ -457,6 +488,7 @@
   		hashed_details_length = strlen(user)+5+3;
   		hashed_details = (char *) emalloc(hashed_details_length+1);
   		sprintf(hashed_details, "mysql__%s_", user);
  +		client_flags = CLIENT_INTERACTIVE;
   	} else {
   		host_and_port = MySG(default_host);
   		user = MySG(default_user);
  @@ -490,7 +522,30 @@
   				}
   				break;
   			case 4: {
  -					if (zend_get_parameters_ex(4, &z_host, &z_user, &z_passwd, &z_new_link) == FAILURE) {
  +					if (!persistent) {
  +						if (zend_get_parameters_ex(4, &z_host, &z_user, &z_passwd, &z_new_link) == FAILURE) {
  +							MYSQL_DO_CONNECT_RETURN_FALSE();
  +						}
  +						convert_to_string_ex(z_user);
  +						convert_to_string_ex(z_passwd);
  +						user = Z_STRVAL_PP(z_user);
  +						passwd = Z_STRVAL_PP(z_passwd);
  +						new_link = Z_BVAL_PP(z_new_link);
  +					}
  +					else {
  +						if (zend_get_parameters_ex(4, &z_host, &z_user, &z_passwd, &z_client_flags) == FAILURE) {
  +							MYSQL_DO_CONNECT_RETURN_FALSE();
  +						}
  +						convert_to_string_ex(z_user);
  +						convert_to_string_ex(z_passwd);
  +						user = Z_STRVAL_PP(z_user);
  +						passwd = Z_STRVAL_PP(z_passwd);
  +						client_flags = Z_LVAL_PP(z_client_flags);
  +					}
  +				}
  +				break;
  +			case 5: {
  +					if (zend_get_parameters_ex(5, &z_host, &z_user, &z_passwd, &z_new_link, &z_client_flags) == FAILURE) {
   						MYSQL_DO_CONNECT_RETURN_FALSE();
   					}
   					convert_to_string_ex(z_user);
  @@ -498,6 +553,7 @@
   					user = Z_STRVAL_PP(z_user);
   					passwd = Z_STRVAL_PP(z_passwd);
   					new_link = Z_BVAL_PP(z_new_link);
  +					client_flags = Z_LVAL_PP(z_client_flags);
   				}
   				break;
   			default:
  @@ -573,7 +629,11 @@
   			mysql->active_result_id = 0;
   #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
   			mysql_init(&mysql->conn);
  -			if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, 0)==NULL) {
  +
  +			if (connect_timeout != -1)
  +				mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
  +
  +			if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) {
   #else
   			if (mysql_connect(&mysql->conn, host, user, passwd)==NULL) {
   #endif
  @@ -613,7 +673,7 @@
   #endif
   				signal(SIGPIPE, handler);
   #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
  -				if (mysql_real_connect(le->ptr, host, user, passwd, NULL, port, socket, 0)==NULL) {
  +				if (mysql_real_connect(le->ptr, host, user, passwd, NULL, port, socket, client_flags)==NULL) {
   #else
   				if (mysql_connect(le->ptr, host, user, passwd)==NULL) {
   #endif
  @@ -666,7 +726,11 @@
   		mysql->active_result_id = 0;
   #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
   		mysql_init(&mysql->conn);
  -		if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, 0)==NULL) {
  +
  +		if (connect_timeout != -1)
  +				mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
  +
  +		if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) {
   #else
   		if (mysql_connect(&mysql->conn, host, user, passwd)==NULL) {
   #endif
  @@ -714,7 +778,7 @@
   }
   /* }}} */
   
  -/* {{{ proto resource mysql_connect([string hostname[:port][:/path/to/socket]] [, string username] [, string password] [, bool new])
  +/* {{{ proto resource mysql_connect([string hostname[:port][:/path/to/socket] [, string username [, string password [, bool new [, int flags]]]]])
      Opens a connection to a MySQL Server */
   PHP_FUNCTION(mysql_connect)
   {
  @@ -722,7 +786,7 @@
   }
   /* }}} */
   
  -/* {{{ proto resource mysql_pconnect([string hostname[:port][:/path/to/socket]] [, string username] [, string password])
  +/* {{{ proto resource mysql_pconnect([string hostname[:port][:/path/to/socket] [, string username [, string password [, int flags]]]])
      Opens a persistent connection to a MySQL Server */
   PHP_FUNCTION(mysql_pconnect)
   {
  @@ -769,14 +833,13 @@
   }
   /* }}} */
   
  -/* {{{ proto bool mysql_select_db(string database_name [, int link_identifier [, bool return_prev_dbname]])
  +/* {{{ proto bool mysql_select_db(string database_name [, int link_identifier])
      Selects a MySQL database */
   PHP_FUNCTION(mysql_select_db)
   {
  -	zval **db, **mysql_link, **ret_prevdb;
  -	int id, ret_dbname=0;
  +	zval **db, **mysql_link;
  +	int id;
   	php_mysql_conn *mysql;
  -	char *prev_db=NULL;
   	
   	switch(ZEND_NUM_ARGS()) {
   		case 1:
  @@ -792,14 +855,6 @@
   			}
   			id = -1;
   			break;
  -		case 3:
  -			if (zend_get_parameters_ex(3, &db, &mysql_link, &ret_prevdb)==FAILURE) {
  -				RETURN_FALSE;
  -			}
  -			id = -1;
  -			convert_to_long_ex(ret_prevdb);
  -			ret_dbname = Z_LVAL_PP(ret_prevdb);
  -			break;
   		default:
   			WRONG_PARAM_COUNT;
   			break;
  @@ -809,22 +864,11 @@
   	
   	convert_to_string_ex(db);
   
  -	/* Get the previous database name */
  -	if (ret_dbname && mysql->conn.db) {
  -		prev_db=estrdup(mysql->conn.db);
  -	}
  -	
   	if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) {
   		RETVAL_FALSE;
  -	} else if (prev_db) {
  -		RETVAL_STRING(prev_db, 1);
   	} else {
   		RETVAL_TRUE;
   	}
  -
  -	if (prev_db) {
  -		efree(prev_db);
  -	}
   }
   /* }}} */
   
  @@ -1026,10 +1070,9 @@
   	RETURN_STRING((char *)mysql_character_set_name(&mysql->conn), 1);
   }
   /* }}} */
  -
  -
   #endif
   
  +#ifndef NETWARE		/* The below two functions not supported on NetWare */
   #if MYSQL_VERSION_ID < 40000
   /* {{{ proto bool mysql_create_db(string database_name [, int link_identifier])
      Create a MySQL database */
  @@ -1061,6 +1104,7 @@
   	ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
   	
   	convert_to_string_ex(db);
  +
   	if (mysql_create_db(&mysql->conn, Z_STRVAL_PP(db))==0) {
   		RETURN_TRUE;
   	} else {
  @@ -1100,6 +1144,7 @@
   	ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
   	
   	convert_to_string_ex(db);
  +
   	if (mysql_drop_db(&mysql->conn, Z_STRVAL_PP(db))==0) {
   		RETURN_TRUE;
   	} else {
  @@ -1108,6 +1153,7 @@
   }
   /* }}} */
   #endif
  +#endif	/* NETWARE */
   
   /* {{{ php_mysql_do_query_general
    */
  @@ -1559,7 +1605,7 @@
   
   	new_str = emalloc(str_len * 2 + 1);
   	new_str_len = mysql_real_escape_string(&mysql->conn, new_str, str, str_len);
  -	new_str = erealloc(new_str, new_str_len);
  +	new_str = erealloc(new_str, new_str_len + 1);
   
   	RETURN_STRINGL(new_str, new_str_len, 0);
   }
  
  
  
  1.2.2.1   +2 -1      php4/ext/mysql/php_mysql.h
  
  Index: php_mysql.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mysql/php_mysql.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_mysql.h	29 Apr 2002 02:30:52 -0000	1.2
  +++ php_mysql.h	3 Aug 2002 00:44:15 -0000	1.2.2.1
  @@ -17,7 +17,7 @@
   */
   
   
  -/* $Id: php_mysql.h,v 1.30 2002/03/29 12:47:02 jan Exp $ */
  +/* $Id: php_mysql.h,v 1.31 2002/07/16 13:53:54 georg Exp $ */
   
   #ifndef PHP_MYSQL_H
   #define PHP_MYSQL_H
  @@ -102,6 +102,7 @@
   	char *default_socket;
   	char *connect_error;
   	long connect_errno;
  +	long connect_timeout;
   ZEND_END_MODULE_GLOBALS(mysql)
   
   #ifdef ZTS
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +6 -1      php4/ext/odbc/php_odbc.c
  
  Index: php_odbc.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/odbc/php_odbc.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- php_odbc.c	9 Jul 2002 09:14:37 -0000	1.2.2.2
  +++ php_odbc.c	3 Aug 2002 00:44:15 -0000	1.2.2.3
  @@ -20,7 +20,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: php_odbc.c,v 1.127 2002/06/14 00:07:13 sniper Exp $ */
  +/* $Id: php_odbc.c,v 1.128 2002/07/31 13:50:51 kalowsky Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -1631,6 +1631,11 @@
   	
   	/* get field index if the field parameter was a string */
   	if (field != NULL) {
  +		if (result->values == NULL) {
  +			php_error(E_WARNING, "Result set contains no data");
  +			RETURN_FALSE;
  +		}
  +
   		for(i = 0; i < result->numcols; i++) {
   			if (!strcasecmp(result->values[i].name, field)) {
   				field_ind = i;
  
  
  
  1.1.2.2   +6 -6      php4/ext/odbc/Attic/php_odbc_includes.h
  
  Index: php_odbc_includes.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/odbc/Attic/php_odbc_includes.h,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- php_odbc_includes.h	10 Jul 2002 01:53:51 -0000	1.1.2.1
  +++ php_odbc_includes.h	3 Aug 2002 00:44:15 -0000	1.1.2.2
  @@ -12,13 +12,13 @@
      | obtain it through the world-wide-web, please send a note to          |
      | licen****@php***** so we can mail you a copy immediately.               |
      +----------------------------------------------------------------------+
  -   | Authors: Stig S〓ther Bakken <ssb****@fast*****>                            |
  +   | Authors: Stig S〓ther Bakken <ssb****@fast*****>                              |
      |          Andreas Karajannis <Andre****@gmd*****>              |
  -   |	        Kevin N. Shallow <kshal****@tampa*****> Birdstep Support |
  +   |	      Kevin N. Shallow <kshal****@tampa*****> Birdstep Support|
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: php_odbc_includes.h,v 1.1 2002/06/14 00:07:16 sniper Exp $ */
  +/* $Id: php_odbc_includes.h,v 1.2 2002/07/31 13:51:20 kalowsky Exp $ */
   
   #ifndef PHP_ODBC_INCLUDES_H
   #define PHP_ODBC_INCLUDES_H
  @@ -221,7 +221,7 @@
   } odbc_result_value;
   
   typedef struct odbc_result {
  -    ODBC_SQL_STMT_T stmt;
  +	ODBC_SQL_STMT_T stmt;
   	int id;
   	odbc_result_value *values;
   	SWORD numcols;
  @@ -229,8 +229,8 @@
   # if HAVE_SQL_EXTENDED_FETCH
   	int fetch_abs;
   # endif
  -    long longreadlen;
  -    int binmode;
  +	long longreadlen;
  +	int binmode;
   	int fetched;
   	odbc_connection *conn_ptr;
   } odbc_result;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.4   +5 -4      php4/ext/openssl/openssl.c
  
  Index: openssl.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/openssl/openssl.c,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- openssl.c	9 Jul 2002 09:14:37 -0000	1.2.2.3
  +++ openssl.c	3 Aug 2002 00:44:15 -0000	1.2.2.4
  @@ -18,7 +18,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: openssl.c,v 1.49 2002/06/13 19:41:21 sniper Exp $ */
  +/* $Id: openssl.c,v 1.50 2002/07/12 21:46:34 sniper Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -39,7 +39,6 @@
   #include <openssl/pem.h>
   #include <openssl/err.h>
   #include <openssl/conf.h>
  -#include <openssl/e_os.h>
   #include <openssl/rand.h>
   
   #define DEFAULT_KEY_LENGTH	512
  @@ -576,10 +575,12 @@
   	config_filename = getenv("OPENSSL_CONF");
   	if (config_filename == NULL)
   		config_filename = getenv("SSLEAY_CONF");
  -	if (config_filename == NULL)	{
  +
  +	/* default to 'openssl.cnf' if no environment variable is set */
  +	if (config_filename == NULL) {
   		snprintf(default_ssl_conf_filename, sizeof(default_ssl_conf_filename), "%s/%s",
   				X509_get_default_cert_area(),
  -				OPENSSL_CONF);
  +				"openssl.cnf");
   	}
   	else
   		strncpy(default_ssl_conf_filename, config_filename, sizeof(default_ssl_conf_filename));
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +5 -3      php4/ext/pcre/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/pcre/config.m4,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- config.m4	29 Apr 2002 02:30:56 -0000	1.2
  +++ config.m4	3 Aug 2002 00:44:15 -0000	1.2.2.1
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.27 2002/03/07 14:19:31 sas Exp $
  +dnl $Id: config.m4,v 1.28 2002/07/23 13:07:29 edink Exp $
   dnl
   
   dnl By default we'll compile and link against the bundled PCRE library
  @@ -19,7 +19,8 @@
     else
       test -f $PHP_PCRE_REGEX/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX
       test -f $PHP_PCRE_REGEX/include/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include
  -    
  +    test -f $PHP_PCRE_REGEX/include/pcre/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include/pcre
  +
       if test -z "$PCRE_INCDIR"; then
         AC_MSG_RESULT(Could not find pcre.h in $PHP_PCRE_REGEX)
       fi
  @@ -47,7 +48,8 @@
       PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
       
       AC_DEFINE(HAVE_PCRE, 1, [ ])
  -    PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -I$PCRE_INCDIR)
  +    PHP_ADD_INCLUDE($PCRE_INCDIR)
  +    PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8)
     fi
   fi
   PHP_SUBST(PCRE_SHARED_LIBADD)
  
  
  
  1.2.2.3   +4 -3      php4/ext/pcre/php_pcre.c
  
  Index: php_pcre.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/pcre/php_pcre.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- php_pcre.c	9 Jul 2002 09:14:38 -0000	1.2.2.2
  +++ php_pcre.c	3 Aug 2002 00:44:15 -0000	1.2.2.3
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: php_pcre.c,v 1.126 2002/06/13 01:04:40 sniper Exp $ */
  +/* $Id: php_pcre.c,v 1.127 2002/07/14 22:36:47 andrei Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -1245,8 +1245,9 @@
   			add_offset_pair(return_value, &Z_STRVAL_PP(subject)[start_offset], Z_STRLEN_PP(subject) - start_offset, start_offset);
   		} else {
   			/* Add the last piece to the return value */
  -			add_next_index_string(return_value,
  -									&Z_STRVAL_PP(subject)[start_offset], 1);
  +			add_next_index_stringl(return_value,
  +								   &Z_STRVAL_PP(subject)[start_offset],
  +								   Z_STRLEN_PP(subject) - start_offset, 1);
   		}
   	}
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +171 -138  php4/ext/pgsql/pgsql.c
  
  Index: pgsql.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/pgsql/pgsql.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- pgsql.c	9 Jul 2002 09:14:38 -0000	1.2.2.2
  +++ pgsql.c	3 Aug 2002 00:44:15 -0000	1.2.2.3
  @@ -19,7 +19,7 @@
      +----------------------------------------------------------------------+
    */
    
  -/* $Id: pgsql.c,v 1.201 2002/05/20 01:40:22 yohgaki Exp $ */
  +/* $Id: pgsql.c,v 1.213 2002/07/28 11:17:57 yohgaki Exp $ */
   
   #include <stdlib.h>
   
  @@ -71,7 +71,7 @@
   #define PQ_SETNONBLOCKING(pg_link, flag) 0
   #endif
   
  -#define CHECK_DEFAULT_LINK(x) if (x == -1) { php_error(E_WARNING, "%s() no PostgreSQL link opened yet", get_active_function_name(TSRMLS_C)); }
  +#define CHECK_DEFAULT_LINK(x) if (x == -1) { php_error(E_WARNING, "%s(): No PostgreSQL link opened yet", get_active_function_name(TSRMLS_C)); }
   
   /* {{{ pgsql_functions[]
    */
  @@ -97,6 +97,7 @@
   	PHP_FE(pg_fetch_row,	NULL)
   	PHP_FE(pg_fetch_array,	NULL)
   	PHP_FE(pg_fetch_object,	NULL)
  +	PHP_FE(pg_fetch_all,	NULL)
   	PHP_FE(pg_affected_rows,NULL)
   	PHP_FE(pg_get_result,	NULL)
   	PHP_FE(pg_result_status,NULL)
  @@ -300,7 +301,7 @@
   	link = (PGconn *) rsrc->ptr;
   
   	if (PQ_SETNONBLOCKING(link, 0)) {
  -		php_error(E_NOTICE,"PostgreSQL cannot set connection to blocking mode");
  +		php_error(E_NOTICE,"PostgreSQL: Cannot set connection to blocking mode");
   		return -1;
   	}
   	
  @@ -526,12 +527,12 @@
   			list_entry new_le;
   			
   			if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) {
  -				php_error(E_WARNING,"%s() cannot create new link. Too many open links (%d)",
  +				php_error(E_WARNING,"%s(): Cannot create new link. Too many open links (%d)",
   						  get_active_function_name(TSRMLS_C), PGG(num_links));
   				goto err;
   			}
   			if (PGG(max_persistent)!=-1 && PGG(num_persistent)>=PGG(max_persistent)) {
  -				php_error(E_WARNING,"%s() cannot create new link. Too many open persistent links (%d)",
  +				php_error(E_WARNING,"%s(): Cannot create new link. Too many open persistent links (%d)",
   						  get_active_function_name(TSRMLS_C), PGG(num_persistent));
   				goto err;
   			}
  @@ -543,7 +544,7 @@
   				pgsql=PQsetdb(host,port,options,tty,dbname);
   			}
   			if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
  -				php_error(E_WARNING,"%s() unable to connect to PostgreSQL server: %s",
  +				php_error(E_WARNING,"%s(): Unable to connect to PostgreSQL server: %s",
   						  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   				if (pgsql) {
   					PQfinish(pgsql);
  @@ -583,7 +584,7 @@
   					PQreset(le->ptr);
   				}
   				if (le->ptr==NULL || PQstatus(le->ptr)==CONNECTION_BAD) {
  -					php_error(E_WARNING,"%s() PostgreSQL link lost, unable to reconnect",
  +					php_error(E_WARNING,"%s(): PostgreSQL link lost, unable to reconnect",
   							  get_active_function_name(TSRMLS_C));
   					zend_hash_del(&EG(persistent_list),str.c,str.len+1);
   					goto err;
  @@ -620,7 +621,7 @@
   			}
   		}
   		if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) {
  -			php_error(E_WARNING,"%s() cannot create new link. Too many open links (%d)",
  +			php_error(E_WARNING,"%s(): Cannot create new link. Too many open links (%d)",
   					  get_active_function_name(TSRMLS_C), PGG(num_links));
   			goto err;
   		}
  @@ -630,7 +631,7 @@
   			pgsql = PQsetdb(host,port,options,tty,dbname);
   		}
   		if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
  -			php_error(E_WARNING,"%s() unable to connect to PostgreSQL server: %s",
  +			php_error(E_WARNING,"%s(): Unable to connect to PostgreSQL server: %s",
   					  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   			goto err;
   		}
  @@ -875,7 +876,7 @@
   
   	convert_to_string_ex(query);
   	if (PQ_SETNONBLOCKING(pgsql, 0)) {
  -		php_error(E_NOTICE,"%s() cannot set connection to blocking mode",
  +		php_error(E_NOTICE,"%s(): Cannot set connection to blocking mode",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -884,7 +885,7 @@
   		leftover = 1;
   	}
   	if (leftover) {
  -		php_error(E_NOTICE,"%s() found results on this connection. Use pg_get_result() to get results",
  +		php_error(E_NOTICE,"%s(): Found results on this connection. Use pg_get_result() to get results",
   				  get_active_function_name(TSRMLS_C));
   	}
   	pgsql_result = PQexec(pgsql, Z_STRVAL_PP(query));
  @@ -900,7 +901,7 @@
   		case PGRES_BAD_RESPONSE:
   		case PGRES_NONFATAL_ERROR:
   		case PGRES_FATAL_ERROR:
  -			php_error(E_WARNING, "%s() query failed:  %s",
  +			php_error(E_WARNING, "%s(): Query failed:  %s",
   					  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   			RETURN_FALSE;
   			break;
  @@ -951,7 +952,7 @@
   #if HAVE_PQCMDTUPLES
   			Z_LVAL_P(return_value) = atoi(PQcmdTuples(pgsql_result));
   #else
  -			php_error(E_WARNING,"This compilation does not support %s()",
  +			php_error(E_WARNING,"%(): Not supportted under this build",
   					  get_active_function_name(TSRMLS_C));
   			Z_LVAL_P(return_value) = 0;
   #endif
  @@ -1089,7 +1090,7 @@
   	convert_to_long_ex(field);
   	
   	if (Z_LVAL_PP(field) < 0 || Z_LVAL_PP(field) >= PQnfields(pgsql_result)) {
  -		php_error(E_WARNING,"%s() bad field offset specified",
  +		php_error(E_WARNING,"%s(): Bad field offset specified",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -1190,7 +1191,7 @@
   		convert_to_long_ex(row);
   		pgsql_row = Z_LVAL_PP(row);
   		if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
  -			php_error(E_WARNING,"%s() unable to jump to row %d on PostgreSQL result index %d",
  +			php_error(E_WARNING,"%s(): Unable to jump to row %d on PostgreSQL result index %d",
   					  get_active_function_name(TSRMLS_C), Z_LVAL_PP(row), Z_LVAL_PP(result));
   			RETURN_FALSE;
   		}
  @@ -1205,7 +1206,7 @@
   			break;
   	}
   	if (field_offset<0 || field_offset>=PQnfields(pgsql_result)) {
  -		php_error(E_WARNING,"%s() bad column offset specified",
  +		php_error(E_WARNING,"%s(): Bad column offset specified",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -1232,23 +1233,17 @@
   	uint element_len;
   
   	switch (ZEND_NUM_ARGS()) {
  -		case 1:
  +		case 1: /* pg_fetch_*(result) */ 
   			if (zend_get_parameters_ex(1, &result) == FAILURE) {
   				RETURN_FALSE;
   			}
  -			if (!result_type) {
  -				result_type = PGSQL_BOTH;
  -			}
   			break;
  -		case 2:
  +		case 2: /* pg_fetch_*(result, row) */
   			if (zend_get_parameters_ex(2, &result, &row) == FAILURE) {
   				RETURN_FALSE;
   			}
  -			if (!result_type) {
  -				result_type = PGSQL_BOTH;
  -			}
   			break;
  -		case 3:
  +		case 3: /* pg_fetch_*(result, row, result_type) */
   			if (zend_get_parameters_ex(3, &result, &row, &arg3) == FAILURE) {
   				RETURN_FALSE;
   			}
  @@ -1260,6 +1255,12 @@
   			break;
   	}
   	
  +	if (!(result_type & PGSQL_BOTH)) {
  +		php_error(E_WARNING, "%s(): Invalid result type",
  +				  get_active_function_name(TSRMLS_C));
  +		RETURN_FALSE;
  +	}
  +	
   	ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
   
   	pgsql_result = pg_result->result;
  @@ -1276,12 +1277,12 @@
   			pgsql_row = Z_LVAL_PP(row);
   			pg_result->row = pgsql_row;
   			if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
  -				php_error(E_WARNING, "%s() unable to jump to row %d on PostgreSQL result index %d",
  +				php_error(E_WARNING, "%s(): Unable to jump to row %d on PostgreSQL result index %d",
   						  get_active_function_name(TSRMLS_C), Z_LVAL_PP(row), Z_LVAL_PP(result));
   				RETURN_FALSE;
   			}
   		} else {
  -			/* If 2nd param is NULL, ignore it and use the normal way of accessing the next row */
  +			/* If 2nd param is NULL, use internal row counter to access next row */
   			pg_result->row++;
   			pgsql_row = pg_result->row;
   			if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
  @@ -1329,7 +1330,7 @@
   }
   /* }}} */
   
  -/* {{{ proto array pg_fetch_row(resource result [, int row])
  +/* {{{ proto array pg_fetch_row(resource result [, int row [, int result_type]])
      Get a row as an enumerated array */ 
   PHP_FUNCTION(pg_fetch_row)
   {
  @@ -1341,7 +1342,7 @@
      Fetch a row as an array */
   PHP_FUNCTION(pg_fetch_array)
   {
  -	php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
  +	php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_BOTH);
   }
   /* }}} */
   
  @@ -1356,6 +1357,30 @@
   }
   /* }}} */
   
  +/* {{{ proto array pg_fetch_all(resource result)
  +   Fetch all rows into array */
  +PHP_FUNCTION(pg_fetch_all)
  +{
  +	zval *result;
  +	PGresult *pgsql_result;
  +	pgsql_result_handle *pg_result;
  +
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
  +							  &result) == FAILURE) {
  +		return;
  +	}
  +
  +	ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, "PostgreSQL result", le_result);
  +
  +	pgsql_result = pg_result->result;
  +	array_init(return_value);
  +	if (php_pgsql_result2array(pgsql_result, return_value TSRMLS_CC) == FAILURE) {
  +		zval_dtor(return_value);
  +		RETURN_FALSE;
  +	}
  +}
  +/* }}} */
  +
   #define PHP_PG_DATA_LENGTH 1
   #define PHP_PG_DATA_ISNULL 2
   
  @@ -1387,7 +1412,7 @@
   		convert_to_long_ex(row);
   		pgsql_row = Z_LVAL_PP(row);
   		if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
  -			php_error(E_WARNING,"%s() unable to jump to row %d on PostgreSQL result index %d",
  +			php_error(E_WARNING,"%s(): Unable to jump to row %d on PostgreSQL result index %d",
   					  get_active_function_name(TSRMLS_C), Z_LVAL_PP(row), Z_LVAL_PP(result));
   			RETURN_FALSE;
   		}
  @@ -1404,7 +1429,7 @@
   			break;
   	}
   	if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
  -		php_error(E_WARNING, "%s() bad column offset specified",
  +		php_error(E_WARNING, "%s(): Bad column offset specified",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -1457,7 +1482,7 @@
   }
   /* }}} */
   
  -/* {{{ proto int pg_last_oid(resource result)
  +/* {{{ proto string pg_last_oid(resource result)
      Returns the last object identifier */
   PHP_FUNCTION(pg_last_oid)
   {
  @@ -1575,7 +1600,7 @@
   }
   /* }}} */
   
  -/* {{{ proto int pg_lo_create(resource connection)
  +/* {{{ proto int pg_lo_create([resource connection])
      Create a large object */
   PHP_FUNCTION(pg_lo_create)
   {
  @@ -1610,7 +1635,7 @@
   	*/
   
   	if ((pgsql_oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == InvalidOid) {
  -		php_error(E_WARNING, "%s() unable to create PostgreSQL large object",
  +		php_error(E_WARNING, "%s(): Unable to create PostgreSQL large object",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -1618,7 +1643,7 @@
   }
   /* }}} */
   
  -/* {{{ proto bool pg_lo_unlink([resource connection,] int large_object_oid)
  +/* {{{ proto bool pg_lo_unlink([resource connection,] string large_object_oid)
      Delete a large object */
   PHP_FUNCTION(pg_lo_unlink)
   {
  @@ -1637,7 +1662,7 @@
   		oid = (Oid)strtoul(oid_string, &end_ptr, 10);
   		if ((oid_string+oid_strlen) != end_ptr) {
   			/* wrong integer format */
  -			php_error(E_NOTICE, "%s() wrong OID value passed",
  +			php_error(E_NOTICE, "%s(): Wrong OID value passed",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1645,7 +1670,7 @@
   	else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
   								 "rl", &pgsql_link, &oid_long) == SUCCESS) {
   		if (oid_long <= InvalidOid) {
  -			php_error(E_NOTICE, "%s() invalid OID is specified",
  +			php_error(E_NOTICE, "%s(): Invalid OID is specified",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1656,7 +1681,7 @@
   		oid = (Oid)strtoul(oid_string, &end_ptr, 10);
   		if ((oid_string+oid_strlen) != end_ptr) {
   			/* wrong integer format */
  -			php_error(E_NOTICE, "%s() wrong OID value passed",
  +			php_error(E_NOTICE, "%s(): Wrong OID value passed",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1666,7 +1691,7 @@
   	else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
   								 "l", &oid_long) == SUCCESS) {
   		if (oid_long <= InvalidOid) {
  -			php_error(E_NOTICE, "%s() invalid OID is specified",
  +			php_error(E_NOTICE, "%s(): Invalid OID is specified",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1675,7 +1700,7 @@
   		CHECK_DEFAULT_LINK(id);
   	}
   	else {
  -		php_error(E_WARNING, "%s() exptects 1 or 2 arguments",
  +		php_error(E_WARNING, "%s(): Requires 1 or 2 arguments",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -1683,7 +1708,7 @@
   	ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (lo_unlink(pgsql, oid) == -1) {
  -		php_error(E_WARNING, "%s() unable to delete PostgreSQL large object %u",
  +		php_error(E_WARNING, "%s(): Unable to delete PostgreSQL large object %u",
   				  get_active_function_name(TSRMLS_C), oid);
   		RETURN_FALSE;
   	}
  @@ -1712,7 +1737,7 @@
   		oid = (Oid)strtoul(oid_string, &end_ptr, 10);
   		if ((oid_string+oid_strlen) != end_ptr) {
   			/* wrong integer format */
  -			php_error(E_NOTICE, "%s() wrong OID value passed",
  +			php_error(E_NOTICE, "%s(): Wrong OID value passed",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1720,7 +1745,7 @@
   	else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
   								 "rls", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) {
   		if (oid_long <= InvalidOid) {
  -			php_error(E_NOTICE, "%s() invalid OID is specified",
  +			php_error(E_NOTICE, "%s(): Invalid OID is specified",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1731,7 +1756,7 @@
   		oid = (Oid)strtoul(oid_string, &end_ptr, 10);
   		if ((oid_string+oid_strlen) != end_ptr) {
   			/* wrong integer format */
  -			php_error(E_NOTICE, "%s() wrong OID value passed",
  +			php_error(E_NOTICE, "%s(): Wrong OID value passed",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1741,7 +1766,7 @@
   	else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
   								 "ls", &oid_long, &mode_string, &mode_strlen) == SUCCESS) {
   		if (oid_long <= InvalidOid) {
  -			php_error(E_NOTICE, "%s() invalid OID is specified",
  +			php_error(E_NOTICE, "%s(): Invalid OID is specified",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1750,7 +1775,7 @@
   		CHECK_DEFAULT_LINK(id);
   	}
   	else {
  -		php_error(E_WARNING, "%s() exptects 1 or 2 arguments",
  +		php_error(E_WARNING, "%s(): Requires 1 or 2 arguments",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -1782,19 +1807,19 @@
   		if (create) {
   			if ((oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == 0) {
   				efree(pgsql_lofp);
  -				php_error(E_WARNING, "%s() unable to create PostgreSQL large object",
  +				php_error(E_WARNING, "%s(): Unable to create PostgreSQL large object",
   						  get_active_function_name(TSRMLS_C));
   				RETURN_FALSE;
   			} else {
   				if ((pgsql_lofd = lo_open(pgsql, oid, pgsql_mode)) == -1) {
   					if (lo_unlink(pgsql, oid) == -1) {
   						efree(pgsql_lofp);
  -						php_error(E_WARNING, "%s() Something's really messed up!!! Your database is badly corrupted in a way NOT related to PHP",
  +						php_error(E_WARNING, "%s(): Something's really messed up!!! Your database is badly corrupted in a way NOT related to PHP",
   								  get_active_function_name(TSRMLS_C));
   						RETURN_FALSE;
   					}
   					efree(pgsql_lofp);
  -					php_error(E_WARNING, "%s() unable to open PostgreSQL large object",
  +					php_error(E_WARNING, "%s(): Unable to open PostgreSQL large object",
   							  get_active_function_name(TSRMLS_C));
   					RETURN_FALSE;
   				} else {
  @@ -1806,7 +1831,7 @@
   			}
   		} else {
   			efree(pgsql_lofp);
  -			php_error(E_WARNING,"%s() unable to open PostgreSQL large object",
  +			php_error(E_WARNING,"%s(): Unable to open PostgreSQL large object",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -1839,7 +1864,7 @@
   	ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_lofp, -1, "PostgreSQL large object", le_lofp);
   	
   	if (lo_close((PGconn *)pgsql->conn, pgsql->lofd) < 0) {
  -		php_error(E_WARNING, "%s() unable to close PostgreSQL large object descriptor %d",
  +		php_error(E_WARNING, "%s(): Unable to close PostgreSQL large object descriptor %d",
   				  get_active_function_name(TSRMLS_C), pgsql->lofd);
   		RETVAL_FALSE;
   	} else {
  @@ -1905,12 +1930,12 @@
   	if (argc > 2) {
   		convert_to_long_ex(z_len);
   		if (Z_LVAL_PP(z_len) > Z_STRLEN_PP(str)) {
  -			php_error(E_WARNING, "%s() cannot write more than buffer size %d. Tried to wtite %d",
  +			php_error(E_WARNING, "%s(): Cannot write more than buffer size %d. Tried to wtite %d",
   					  get_active_function_name(TSRMLS_C), Z_LVAL_PP(str), Z_LVAL_PP(z_len));
   			RETURN_FALSE;
   		}
   		if (Z_LVAL_PP(z_len) < 0) {
  -			php_error(E_WARNING, "%s() buffer size must be larger than 0. %d specified for buffer size.",
  +			php_error(E_WARNING, "%s(): Buffer size must be larger than 0. %d specified for buffer size",
   					  get_active_function_name(TSRMLS_C), Z_LVAL_PP(str), Z_LVAL_PP(z_len));
   			RETURN_FALSE;
   		}
  @@ -1984,7 +2009,7 @@
   	}
   	else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
   									  "sr", &file_in, &name_len, &pgsql_link ) == SUCCESS) {
  -		php_error(E_NOTICE, "Old API for %s() is used.", get_active_function_name(TSRMLS_C));
  +		php_error(E_NOTICE, "%s(): Old API is used.", get_active_function_name(TSRMLS_C));
   	}
   	else {
   		WRONG_PARAM_COUNT;
  @@ -1993,6 +2018,10 @@
   	if (PG(safe_mode) &&(!php_checkuid(file_in, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
   		RETURN_FALSE;
   	}
  +	
  +	if (php_check_open_basedir(file_in TSRMLS_CC)) {
  +		RETURN_FALSE;
  +	}
   
   	ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
  @@ -2022,7 +2051,7 @@
   	if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
   								 "rls", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) {
   		if (oid_long <= InvalidOid) {
  -			php_error(E_NOTICE, "%s() invalid OID is specified",
  +			php_error(E_NOTICE, "%s(): Invalid OID is specified",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -2033,7 +2062,7 @@
   		oid = (Oid)strtoul(oid_string, &end_ptr, 10);
   		if ((oid_string+oid_strlen) != end_ptr) {
   			/* wrong integer format */
  -			php_error(E_NOTICE, "%s() wrong OID value passed",
  +			php_error(E_NOTICE, "%s(): Wrong OID value passed",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -2041,7 +2070,7 @@
   	else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
   									  "ls",  &oid_long, &file_out, &name_len) == SUCCESS) {
   		if (oid_long <= InvalidOid) {
  -			php_error(E_NOTICE, "%s() invalid OID is specified",
  +			php_error(E_NOTICE, "%s(): Invalid OID is specified",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -2054,7 +2083,7 @@
   		oid = (Oid)strtoul(oid_string, &end_ptr, 10);
   		if ((oid_string+oid_strlen) != end_ptr) {
   			/* wrong integer format */
  -			php_error(E_NOTICE, "%s() wrong OID value passed",
  +			php_error(E_NOTICE, "%s(): Wrong OID value passed",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
  @@ -2066,27 +2095,35 @@
   		oid = (Oid)strtoul(oid_string, &end_ptr, 10);
   		if ((oid_string+oid_strlen) != end_ptr) {
   			/* wrong integer format */
  -			php_error(E_NOTICE, "%s() wrong OID value passed",
  +			php_error(E_NOTICE, "%s(): Wrong OID value passed",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
   	}
   	else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
   									  "lsr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) {
  -		php_error(E_NOTICE, "Old API for %s() is used.", get_active_function_name(TSRMLS_C));
  +		php_error(E_NOTICE, " %s(): Old API is used", get_active_function_name(TSRMLS_C));
   		if (oid_long <= InvalidOid) {
  -			php_error(E_NOTICE, "%s() invalid OID is specified",
  +			php_error(E_NOTICE, "%s(): Invalid OID is specified",
   					  get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
   		oid = (Oid)oid_long;
   	}
   	else {
  -		php_error(E_WARNING, "%s() expects 2 or 3 arguments",
  +		php_error(E_WARNING, "%s(): Requires 2 or 3 arguments",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	
  +	if (PG(safe_mode) &&(!php_checkuid(file_out, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
  +		RETURN_FALSE;
  +	}
  +	
  +	if (php_check_open_basedir(file_out TSRMLS_CC)) {
  +		RETURN_FALSE;
  +	}
  +
   	ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (lo_export(pgsql, oid, file_out)) {
  @@ -2109,7 +2146,7 @@
   		return;
   	}
   	if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) {
  -		php_error(E_WARNING, "Invalid whence parameter for %s()",
  +		php_error(E_WARNING, " %s(): Invalid whence parameter",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
  @@ -2252,7 +2289,7 @@
   	result = PQendcopy(pgsql);
   
   	if (result!=0) {
  -		php_error(E_WARNING, "%s() PostgreSQL query failed: %s",
  +		php_error(E_WARNING, "%s(): Query failed: %s",
   				  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   		RETURN_FALSE;
   	}
  @@ -2294,7 +2331,7 @@
   	result = PQputline(pgsql, Z_STRVAL_PP(query));
   
   	if (result==EOF) {
  -		php_error(E_WARNING, "%s() PostgreSQL query failed: %s",
  +		php_error(E_WARNING, "%s(): Query failed: %s",
   				  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   		RETURN_FALSE;
   	}
  @@ -2363,7 +2400,7 @@
   				while (!copydone)
   				{
   					if ((ret = PQgetline(pgsql, copybuf, COPYBUFSIZ))) {
  -						php_error(E_WARNING, "%s() query failed: %s",
  +						php_error(E_WARNING, "%s(): Query failed: %s",
   								  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   						RETURN_FALSE;
   					}
  @@ -2398,7 +2435,7 @@
   					}
   				}
   				if (PQendcopy(pgsql)) {
  -					php_error(E_WARNING, "%s() query failed: %s",
  +					php_error(E_WARNING, "%s(): Query failed: %s",
   							  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   					RETURN_FALSE;
   				}
  @@ -2412,7 +2449,7 @@
   			break;
   		default:
   			PQclear(pgsql_result);
  -			php_error(E_WARNING, "%s() query failed: %s",
  +			php_error(E_WARNING, "%s(): Query failed: %s",
   					  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   			RETURN_FALSE;
   			break;
  @@ -2480,7 +2517,7 @@
   					if(*(query+Z_STRLEN_PP(tmp)-1) != '\n') strcat(query, "\n");
   					if (PQputline(pgsql, query)) {
   						efree(query);
  -						php_error(E_WARNING, "%s() query failed: %s",
  +						php_error(E_WARNING, "%s(): Query failed: %s",
   								  get_active_function_name, PQerrorMessage(pgsql));
   						RETURN_FALSE;
   					}
  @@ -2488,12 +2525,12 @@
   					zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), &pos);
   				}
   				if (PQputline(pgsql, "\\.\n")) {
  -					php_error(E_WARNING, "%s() query failed: %s",
  +					php_error(E_WARNING, "%s(): Query failed: %s",
   							  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   					RETURN_FALSE;
   				}
   				if (PQendcopy(pgsql)) {
  -					php_error(E_WARNING, "%s() query failed: %s",
  +					php_error(E_WARNING, "%s(): Query failed: %s",
   							  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   					RETURN_FALSE;
   				}
  @@ -2508,7 +2545,7 @@
   			break;
   		default:
   			PQclear(pgsql_result);
  -			php_error(E_WARNING, "%s() query failed: %s",
  +			php_error(E_WARNING, "%s(): Query failed: %s",
   					  get_active_function_name(TSRMLS_C), PQerrorMessage(pgsql));
   			RETURN_FALSE;
   			break;
  @@ -2632,7 +2669,7 @@
   	int leftover = 0;
   	
   	if (PQsetnonblocking(pgsql, 1)) {
  -		php_error(E_NOTICE,"%s() cannot set connection to nonblocking mode",
  +		php_error(E_NOTICE,"%s(): Cannot set connection to nonblocking mode",
   				  get_active_function_name(TSRMLS_C));
   		return -1;
   	}
  @@ -2662,7 +2699,7 @@
   	ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (PQ_SETNONBLOCKING(pgsql, 1)) {
  -		php_error(E_NOTICE,"%s() cannot set connection to nonblocking mode",
  +		php_error(E_NOTICE,"%s(): Cannot set connection to nonblocking mode",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -2680,12 +2717,12 @@
   			}
   			break;
   		default:
  -			php_error(E_ERROR,"%s() PostgreSQL module error. Report this error",
  +			php_error(E_ERROR,"%s(): PostgreSQL module error. Report this error",
   					  get_active_function_name(TSRMLS_C));
   			break;
   	}
   	if (PQ_SETNONBLOCKING(pgsql, 0)) {
  -		php_error(E_NOTICE,"%s() cannot set connection to blocking mode",
  +		php_error(E_NOTICE,"%s(): Cannot set connection to blocking mode",
   				  get_active_function_name(TSRMLS_C));
   	}
   	convert_to_boolean_ex(&return_value);
  @@ -2728,7 +2765,7 @@
   	ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (PQ_SETNONBLOCKING(pgsql, 1)) {
  -		php_error(E_NOTICE,"%s() cannot set connection to nonblocking mode",
  +		php_error(E_NOTICE,"%s(): Cannot set connection to nonblocking mode",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -2737,14 +2774,14 @@
   		leftover = 1;
   	}
   	if (leftover) {
  -		php_error(E_NOTICE,"%s() - There are results on this connection. Call pg_get_result() until it returns FALSE",
  +		php_error(E_NOTICE,"%s(): There are results on this connection. Call pg_get_result() until it returns FALSE",
   				  get_active_function_name(TSRMLS_C));
   	}
   	if (!PQsendQuery(pgsql, query)) {
   		RETURN_FALSE;
   	}
   	if (PQ_SETNONBLOCKING(pgsql, 0)) {
  -		php_error(E_NOTICE,"%s() cannot set connection to blocking mode",
  +		php_error(E_NOTICE,"%s(): Cannot set connection to blocking mode",
   				  get_active_function_name(TSRMLS_C));
   	}
   	RETURN_TRUE;
  @@ -2808,7 +2845,7 @@
   		RETURN_STRING(PQcmdStatus(pgsql_result), 1);
   	}
   	else {
  -		php_error(E_WARNING, "%s() expects optional 2nd parameter to be PGSQL_STATUS_LONG or PGSQL_STATUS_STRING",
  +		php_error(E_WARNING, "%s(): Expects optional 2nd parameter to be PGSQL_STATUS_LONG or PGSQL_STATUS_STRING",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -2843,7 +2880,7 @@
   	
   	pg_result = PQexec(pg_link, querystr.c);
   	if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) {
  -		php_error(E_NOTICE, "%s() failed to query metadata for '%s' table %s",
  +		php_error(E_NOTICE, "%s(): Dailed to query metadata for '%s' table %s",
   				  get_active_function_name(TSRMLS_C), table_name, querystr.c);
   		smart_str_free(&querystr);
   		PQclear(pg_result);
  @@ -2913,7 +2950,7 @@
   	   user defined types. (Yasuo) */
   	
   	/* boolean */
  -	if (!strcmp(type_name, "boolean"))
  +	if (!strcmp(type_name, "bool")|| !strcmp(type_name, "boolean"))
   		return PG_BOOL;
   	/* object id */
   	if (!strcmp(type_name, "oid"))
  @@ -3009,14 +3046,14 @@
   	
   	regerr = regcomp(&re, regex, regopt);
   	if (regerr) {
  -		php_error(E_WARNING, "%s() cannot compile regex",
  +		php_error(E_WARNING, "%s(): Cannot compile regex",
   				  get_active_function_name(TSRMLS_C));
   		regfree(&re);
   		return FAILURE;
   	}
   	subs = (regmatch_t *)ecalloc(sizeof(regmatch_t), re.re_nsub+1);
   	if (!subs) {
  -		php_error(E_WARNING, "%s() cannot allocate memory",
  +		php_error(E_WARNING, "%s(): Cannot allocate memory",
   				  get_active_function_name(TSRMLS_C));
   		regfree(&re);
   		return FAILURE;
  @@ -3030,7 +3067,7 @@
   		ret = FAILURE;
   	}
   	else if (regerr) {
  -		php_error(E_WARNING, "%s() cannot exec regex",
  +		php_error(E_WARNING, "%s(): Cannot exec regex",
   				  get_active_function_name(TSRMLS_C));
   		ret = FAILURE;
   	}
  @@ -3067,7 +3104,7 @@
   /* }}} */
   
   #define PGSQL_CONV_CHECK_IGNORE() \
  -				if (!err && !strcmp(Z_STRVAL_P(new_val), "NULL")) { \
  +				if (!err && Z_TYPE_P(new_val) == IS_STRING && !strcmp(Z_STRVAL_P(new_val), "NULL")) { \
   					/* if value is NULL and has default, remove entry to use default value*/ \
   					if (!(opt & PGSQL_CONV_IGNORE_DEFAULT) && Z_BVAL_PP(has_default)) { \
   						zval_dtor(new_val); \
  @@ -3076,7 +3113,7 @@
   					} \
   					/* raise error if it's not null */ \
   					else if (Z_BVAL_PP(not_null)) { \
  -						php_error(E_NOTICE, "%s() detected NULL for 'NOT NULL' field '%s'", \
  +						php_error(E_NOTICE, "%s(): Detected NULL for 'NOT NULL' field '%s'", \
   								  get_active_function_name(TSRMLS_C), field ); \
   						err = 1; \
   					} \
  @@ -3118,44 +3155,44 @@
   		 zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos)) {
   		skip_field = 0;
   		if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &field, &field_len, &num_idx, 0, &pos)) == HASH_KEY_NON_EXISTANT) {
  -			php_error(E_WARNING, "%s() failed to get array key type",
  +			php_error(E_WARNING, "%s(): Failed to get array key type",
   					  get_active_function_name(TSRMLS_C));
   			err = 1;
   		}
   		if (!err && key_type == HASH_KEY_IS_LONG) {
  -			php_error(E_WARNING, "%s() accepts only string key for values",
  +			php_error(E_WARNING, "%s(): Accepts only string key for values",
   					  get_active_function_name(TSRMLS_C));
   			err = 1;
   		}
   		if (!err && key_type == HASH_KEY_NON_EXISTANT) {
  -			php_error(E_WARNING, "%s() accepts only string key for values",
  +			php_error(E_WARNING, "%s(): Accepts only string key for values",
   					  get_active_function_name(TSRMLS_C));
   			err = 1;
   		}
   		if (!err && zend_hash_find(Z_ARRVAL_P(meta), field, field_len, (void **)&def) == FAILURE) {
  -			php_error(E_NOTICE, "%s() Invalid field name (%s) in values", 
  +			php_error(E_NOTICE, "%s(): Invalid field name (%s) in values", 
   						  get_active_function_name(TSRMLS_C), field);
   			err = 1;
   		}
   		if (!err && zend_hash_find(Z_ARRVAL_PP(def), "type", sizeof("type"), (void **)&type) == FAILURE) {
  -			php_error(E_NOTICE, "%s() detected broken meta data. Missing 'type'",
  +			php_error(E_NOTICE, "%s(): Detected broken meta data. Missing 'type'",
   					  get_active_function_name(TSRMLS_C));
   			err = 1;
   		}
   		if (!err && zend_hash_find(Z_ARRVAL_PP(def), "not null", sizeof("not null"), (void **)&not_null) == FAILURE) {
  -			php_error(E_NOTICE, "%s() detected broken meta data. Missing 'not null'",
  +			php_error(E_NOTICE, "%s(): Detected broken meta data. Missing 'not null'",
   					  get_active_function_name(TSRMLS_C));
   			err = 1;
   		}
   		if (!err && zend_hash_find(Z_ARRVAL_PP(def), "has default", sizeof("has default"), (void **)&has_default) == FAILURE) {
  -			php_error(E_NOTICE, "%s() detected broken meta data. Missing 'has default'",
  +			php_error(E_NOTICE, "%s(): Detected broken meta data. Missing 'has default'",
   					  get_active_function_name(TSRMLS_C));
   			err = 1;
   		}
   		if (!err && (Z_TYPE_PP(val) == IS_ARRAY ||
   			 Z_TYPE_PP(val) == IS_OBJECT ||
   			 Z_TYPE_PP(val) == IS_CONSTANT_ARRAY)) {
  -			php_error(E_NOTICE, "%s() expects scaler values as field values",
  +			php_error(E_NOTICE, "%s(): Expects scaler values as field values",
   					  get_active_function_name(TSRMLS_C));
   			err = 1;
   		}
  @@ -3178,19 +3215,17 @@
   								!strcmp(Z_STRVAL_PP(val), "true") || !strcmp(Z_STRVAL_PP(val), "True") ||
   								!strcmp(Z_STRVAL_PP(val), "yes") || !strcmp(Z_STRVAL_PP(val), "Yes") ||
   								!strcmp(Z_STRVAL_PP(val), "1")) {
  -								Z_STRVAL_P(new_val) = estrdup("'t'");
  -								Z_STRLEN_P(new_val) = 1;
  +								ZVAL_STRING(new_val, "'t'", 1);
   							}
   							else if (!strcmp(Z_STRVAL_PP(val), "f") || !strcmp(Z_STRVAL_PP(val), "F") ||
   									 !strcmp(Z_STRVAL_PP(val), "n") || !strcmp(Z_STRVAL_PP(val), "N") ||
   									 !strcmp(Z_STRVAL_PP(val), "false") ||  !strcmp(Z_STRVAL_PP(val), "False") ||
   									 !strcmp(Z_STRVAL_PP(val), "no") ||  !strcmp(Z_STRVAL_PP(val), "No") ||
   									 !strcmp(Z_STRVAL_PP(val), "0")) {
  -								Z_STRVAL_P(new_val) = estrdup("'f'");
  -								Z_STRLEN_P(new_val) = 1;
  +								ZVAL_STRING(new_val, "'f'", 1);
   							}
   							else {
  -								php_error(E_NOTICE, "%s() detected invalid value (%s) for pgsql %s field (%s)",
  +								php_error(E_NOTICE, "%s(): Detected invalid value (%s) for pgsql %s field (%s)",
   										  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(val), Z_STRVAL_PP(type), field);
   								err = 1;
   							}
  @@ -3200,12 +3235,11 @@
   					case IS_LONG:
   					case IS_BOOL:
   						if (Z_LVAL_PP(val)) {
  -							Z_STRVAL_P(new_val) = estrdup("'t'");
  +							ZVAL_STRING(new_val, "'t'", 1);
   						}
   						else {
  -							Z_STRVAL_P(new_val) = estrdup("'f'");
  +							ZVAL_STRING(new_val, "'f'", 1);
   						}
  -						Z_STRLEN_P(new_val) = 1;
   						break;
   
   					case IS_NULL:
  @@ -3217,7 +3251,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string, null, long or boolelan value for pgsql '%s' (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string, null, long or boolelan value for pgsql '%s' (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3260,7 +3294,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string, null, long or double value for pgsql '%s' (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string, null, long or double value for pgsql '%s' (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3302,7 +3336,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string, null, long or double value for pgsql '%s' (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string, null, long or double value for pgsql '%s' (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3313,7 +3347,7 @@
   				switch (Z_TYPE_PP(val)) {
   					case IS_STRING:
   						if (Z_STRLEN_PP(val) == 0) {
  -							ZVAL_STRING(new_val, empty_string, 0);
  +							ZVAL_STRING(new_val, empty_string, 1);
   						}
   						else {
   							Z_TYPE_P(new_val) = IS_STRING;
  @@ -3327,9 +3361,8 @@
   #else					
   							Z_STRVAL_P(new_val) = php_addslashes(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &Z_STRLEN_P(new_val), 0 TSRMLS_CC);
   #endif
  -							php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
  -								
   						}
  +						php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
   						break;
   						
   					case IS_LONG:
  @@ -3351,7 +3384,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string, null, long or double value for pgsql '%s' (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string, null, long or double value for pgsql '%s' (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3394,7 +3427,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string, null, long or double value for '%s' (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string, null, long or double value for '%s' (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3427,7 +3460,7 @@
   				}				
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string or null for '%s' (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string or null for '%s' (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3460,7 +3493,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string or null for pgsql %s field (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string or null for pgsql %s field (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3492,7 +3525,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string or null for pgsql %s field (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string or null for pgsql %s field (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3524,7 +3557,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string or null for pgsql %s field (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string or null for pgsql %s field (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3557,7 +3590,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string or null for pgsql %s field (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string or null for pgsql %s field (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3601,7 +3634,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string, null, long or double value for pgsql '%s' (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string, null, long or double value for pgsql '%s' (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3633,7 +3666,7 @@
   				}
   				PGSQL_CONV_CHECK_IGNORE();
   				if (err) {
  -					php_error(E_NOTICE, "%s() expects string or null for pgsql %s field (%s)",
  +					php_error(E_NOTICE, "%s(): Expects string or null for pgsql %s field (%s)",
   							  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				}
   				break;
  @@ -3649,14 +3682,14 @@
   			case PG_PATH:
   			case PG_POLYGON:
   			case PG_CIRCLE:
  -				php_error(E_NOTICE, "%s() does not support  pgsql '%s' type (%s)",
  +				php_error(E_NOTICE, "%s(): does not support  pgsql '%s' type (%s)",
   						  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				err = 1;
   				break;
   				
   			case PG_UNKNOWN:
   			default:
  -				php_error(E_NOTICE, "%s() unknown or system data type '%s' for '%s'",
  +				php_error(E_NOTICE, "%s(): unknown or system data type '%s' for '%s'",
   						  get_active_function_name(TSRMLS_C), Z_STRVAL_PP(type), field);
   				err = 1;
   				break;
  @@ -3702,12 +3735,12 @@
   		return;
   	}
   	if (option & ~PGSQL_CONV_OPTS) {
  -		php_error(E_WARNING, "%s() invalid option is spedified",
  +		php_error(E_WARNING, "%s(): Invalid option is spedified",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	if (!table_name_len) {
  -		php_error(E_NOTICE, "%s() table name is invalid",
  +		php_error(E_NOTICE, "%s(): Table name is invalid",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -3715,7 +3748,7 @@
   	ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
  -		php_error(E_NOTICE, "%s detected unhandled result(s) in connection",
  +		php_error(E_NOTICE, "%s(): Detected unhandled result(s) in connection",
   				  get_active_function_name(TSRMLS_C));
   	}
   	array_init(return_value);
  @@ -3740,7 +3773,7 @@
   		if (PQresultStatus(pg_result) == expect) {
   			return 0;
   		} else {
  -			php_error(E_NOTICE, "%s() failed to execute '%s'",
  +			php_error(E_NOTICE, "%s(): Failed to execute '%s'",
   				  get_active_function_name(TSRMLS_C), querystr->c);
   			PQclear(pg_result);
   		}
  @@ -3787,7 +3820,7 @@
   	while ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &fld,
   					&fld_len, &num_idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
   		if (key_type == HASH_KEY_IS_LONG) {
  -			php_error(E_NOTICE,"%s() expects associative array for values to be inserted",
  +			php_error(E_NOTICE,"%s(): Expects associative array for values to be inserted",
   					  get_active_function_name(TSRMLS_C));
   			goto cleanup;
   		}
  @@ -3816,8 +3849,8 @@
   				break;
   			default:
   				/* should not happen */
  -				php_error(E_WARNING, "%s(): Report this error to php-d****@lists*****",
  -						  get_active_function_name(TSRMLS_C));
  +				php_error(E_WARNING, "%s(): Report this error to php-d****@lists*****. Type = %d",
  +						  get_active_function_name(TSRMLS_C), Z_TYPE_PP(val));
   				goto cleanup;
   				break;
   		}
  @@ -3867,7 +3900,7 @@
   		return;
   	}
   	if (option & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING)) {
  -		php_error(E_WARNING, "%s() invalid option is spedified",
  +		php_error(E_WARNING, "%s(): Invalid option is spedified",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -3875,7 +3908,7 @@
   	ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
  -		php_error(E_NOTICE, "%s detected unhandled result(s) in connection",
  +		php_error(E_NOTICE, "%s(): Detected unhandled result(s) in connection",
   				  get_active_function_name(TSRMLS_C));
   	}
   	if (php_pgsql_insert(pg_link, table, values, option, &sql TSRMLS_CC) == FAILURE) {
  @@ -3903,7 +3936,7 @@
   		 zend_hash_move_forward_ex(ht, &pos)) {
   		 key_type = zend_hash_get_current_key_ex(ht, &fld, &fld_len, &num_idx, 0, &pos);		
   		if (key_type == HASH_KEY_IS_LONG) {
  -			php_error(E_NOTICE,"%s() expects associative array for values to be inserted",
  +			php_error(E_NOTICE,"%s(): Expects associative array for values to be inserted",
   					  get_active_function_name(TSRMLS_C));
   			return -1;
   		}
  @@ -3922,7 +3955,7 @@
   				break;
   			default:
   				/* should not happen */
  -				php_error(E_NOTICE, "%s() expect scaler values other than null. Need to convert?",
  +				php_error(E_NOTICE, "%s(): Expects scaler values other than null. Need to convert?",
   						  get_active_function_name(TSRMLS_C));
   				return -1;
   		}
  @@ -4020,7 +4053,7 @@
   		return;
   	}
   	if (option & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING)) {
  -		php_error(E_WARNING, "%s() invalid option is spedified",
  +		php_error(E_WARNING, "%s(): Invalid option is spedified",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -4028,7 +4061,7 @@
   	ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
  -		php_error(E_NOTICE, "%s detected unhandled result(s) in connection",
  +		php_error(E_NOTICE, "%s(): Detected unhandled result(s) in connection",
   				  get_active_function_name(TSRMLS_C));
   	}
   	if (php_pgsql_update(pg_link, table, values, ids, option, &sql TSRMLS_CC) == FAILURE) {
  @@ -4110,7 +4143,7 @@
   		return;
   	}
   	if (option & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING)) {
  -		php_error(E_WARNING, "%s() invalid option is spedified",
  +		php_error(E_WARNING, "%s(): Invalid option is spedified",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -4118,7 +4151,7 @@
   	ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
  -		php_error(E_NOTICE, "%s detected unhandled result(s) in connection",
  +		php_error(E_NOTICE, "%s(): Detected unhandled result(s) in connection",
   				  get_active_function_name(TSRMLS_C));
   	}
   	if (php_pgsql_delete(pg_link, table, ids, option, &sql TSRMLS_CC) == FAILURE) {
  @@ -4215,7 +4248,7 @@
   	if (PQresultStatus(pg_result) == PGRES_TUPLES_OK) {
   		ret = php_pgsql_result2array(pg_result, ret_array TSRMLS_CC);
   	} else {
  -		php_error(E_NOTICE, "%s() failed to execute '%s'",
  +		php_error(E_NOTICE, "%s(): Failed to execute '%s'",
   				  get_active_function_name(TSRMLS_C), querystr.c);
   		PQclear(pg_result);
   	}
  @@ -4250,7 +4283,7 @@
   		return;
   	}
   	if (option & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING)) {
  -		php_error(E_WARNING, "%s() invalid option is spedified",
  +		php_error(E_WARNING, "%s(): Invalid option is spedified",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  @@ -4258,7 +4291,7 @@
   	ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
   
   	if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
  -		php_error(E_NOTICE, "%s detected unhandled result(s) in connection",
  +		php_error(E_NOTICE, "%s(): Detected unhandled result(s) in connection",
   				  get_active_function_name(TSRMLS_C));
   	}
   	array_init(return_value);
  
  
  
  1.2.2.2   +3 -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.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_pgsql.h	19 May 2002 11:16:05 -0000	1.2.2.1
  +++ php_pgsql.h	3 Aug 2002 00:44:15 -0000	1.2.2.2
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
    */
    
  -/* $Id: php_pgsql.h,v 1.46 2002/05/10 02:39:37 edink Exp $ */
  +/* $Id: php_pgsql.h,v 1.47 2002/07/21 07:25:10 yohgaki Exp $ */
   
   #ifndef PHP_PGSQL_H
   #define PHP_PGSQL_H
  @@ -80,6 +80,7 @@
   PHP_FUNCTION(pg_fetch_object);
   PHP_FUNCTION(pg_fetch_result);
   PHP_FUNCTION(pg_fetch_row);
  +PHP_FUNCTION(pg_fetch_all);
   PHP_FUNCTION(pg_affected_rows);
   PHP_FUNCTION(pg_get_result);
   PHP_FUNCTION(pg_result_status);
  @@ -153,6 +154,7 @@
   PHPAPI int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, ulong opt , char **sql TSRMLS_DC);
   PHPAPI int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, ulong opt, char **sql TSRMLS_DC);
   PHPAPI int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, ulong opt, char **sql  TSRMLS_DC);
  +PHPAPI int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC);
   
   /* internal functions */
   static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +39 -16    php4/ext/rpc/handler.h
  
  Index: handler.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/handler.h,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- handler.h	9 Jul 2002 09:14:38 -0000	1.2.2.1
  +++ handler.h	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -1,23 +1,44 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
   #ifndef HANDLER_H
   #define HANDLER_H
   
   #include "php.h"
   #include "php_ini.h"
   
  -#define RPC_HANDLER(layer)				{#layer, layer##_handler_init, &layer##_object_handlers,	\
  -										&layer##_class_entry, layer##_function_entry,				\
  -										layer##_method_entry, layer##_ini_entry}
  -
  -#define RPC_DECLARE_HANDLER(layer)		void layer##_handler_init();					\
  -										rpc_object_handlers layer##_object_handlers;	\
  -										zend_class_entry layer##_class_entry;			\
  -										function_entry layer##_function_entry[];		\
  -										function_entry layer##_method_entry[];			\
  +#define RPC_HANDLER(layer)				{#layer, layer##_handler_init, layer##_handler_shutdown,	\
  +										&layer##_object_handlers, &layer##_class_entry,				\
  +										layer##_function_entry, layer##_method_entry,				\
  +										layer##_ini_entry}
  +
  +#define RPC_DECLARE_HANDLER(layer)		void layer##_handler_init(int module_number TSRMLS_DC);		\
  +										void layer##_handler_shutdown(TSRMLS_D);					\
  +										rpc_object_handlers layer##_object_handlers;				\
  +										zend_class_entry *layer##_class_entry;						\
  +										function_entry layer##_function_entry[];					\
  +										function_entry layer##_method_entry[];						\
   										zend_ini_entry layer##_ini_entry[];
   
  -#define RPC_INIT_FUNCTION(layer)		void layer##_handler_init()
  +#define RPC_INIT_FUNCTION(layer)		void layer##_handler_init(int module_number TSRMLS_DC)
  +#define RPC_SHUTDOWN_FUNCTION(layer)	void layer##_handler_shutdown(TSRMLS_D)
   
  -#define RPC_REGISTER_HANDLERS_START(layer)		zend_class_entry layer##_class_entry;				\
  +#define RPC_REGISTER_HANDLERS_START(layer)		zend_class_entry *layer##_class_entry;				\
   												rpc_object_handlers layer##_object_handlers = {
   
   #define RPC_REGISTER_HANDLERS_END()				};
  @@ -65,11 +86,12 @@
   typedef struct _rpc_object_handlers {
   	const zend_bool poolable;
   	const zend_uint hash_type;
  -	int (*rpc_hash)(rpc_string name, rpc_string *hash, int num_args, char *arg_types, int type);
  -	int (*rpc_name)(rpc_string hash, rpc_string *name, int type);
  +	int (*rpc_hash)(rpc_string name, rpc_string *hash, void *data, int num_args, char *arg_types, int type);
  +	int (*rpc_name)(rpc_string hash, rpc_string *name, void *data, int type);
   	int (*rpc_ctor)(rpc_string class_name, void **data, int num_args, zval **args[]);
  -	int (*rpc_dtor)(void **data);
  -	int (*rpc_call)(rpc_string method_name, void **data, zval **return_value, int num_args, zval **args[]);
  +	int (*rpc_dtor)(void *data);
  +	int (*rpc_describe)(rpc_string method_name, void *data, char **arg_types, unsigned char **ref_types);
  +	int (*rpc_call)(rpc_string method_name, void **data, zval *return_value, int num_args, zval **args[]);
   	int (*rpc_get)(rpc_string property_name, zval *return_value, void **data);
   	int (*rpc_set)(rpc_string property_name, zval *value, void **data);
   	int (*rpc_compare)(void **data1, void **data2);
  @@ -82,8 +104,9 @@
   typedef struct _rpc_handler_entry {
   	char					*name;
   	void (*rpc_handler_init)();
  +	void (*rpc_handler_shutdown)();
   	rpc_object_handlers		*handlers;
  -	zend_class_entry		*ce;
  +	zend_class_entry		**ce;
   	function_entry			*functions;
   	function_entry			*methods;
   	zend_ini_entry			*ini;
  
  
  
  1.2.2.1   +19 -2     php4/ext/rpc/layer.h
  
  Index: layer.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/layer.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- layer.h	29 Apr 2002 02:30:59 -0000	1.2
  +++ layer.h	3 Aug 2002 00:44:16 -0000	1.2.2.1
  @@ -1,9 +1,26 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
   #ifndef LAYER_H
   #define LAYER_H
   
   #include "handler.h"
  -
  -RPC_DECLARE_HANDLER(com);
  +#include "com/com.h"
   
   rpc_handler_entry handler_entries[] = {
   	RPC_HANDLER(com)
  
  
  
  1.2.2.2   +21 -6     php4/ext/rpc/php_rpc.h
  
  Index: php_rpc.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/php_rpc.h,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_rpc.h	9 Jul 2002 09:14:38 -0000	1.2.2.1
  +++ php_rpc.h	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -1,3 +1,21 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
   #ifndef PHP_RPC_H
   #define PHP_RPC_H
   
  @@ -6,12 +24,6 @@
   extern zend_module_entry rpc_module_entry;
   #define phpext_rpc_ptr &rpc_module_entry
   
  -#ifdef PHP_WIN32
  -#define PHP_RPC_API __declspec(dllexport)
  -#else
  -#define PHP_RPC_API
  -#endif
  -
   #ifdef ZTS
   #include "TSRM.h"
   #endif
  @@ -28,6 +40,9 @@
   ZEND_FUNCTION(rpc_get);
   ZEND_FUNCTION(rpc_singleton);
   ZEND_FUNCTION(rpc_poolable);
  +
  +ZEND_API void rpc_error(int type, const char *format, ...);
  +ZEND_API zend_object_value rpc_objects_new(zend_class_entry * TSRMLS_DC);
   
   #define phpext_rpc_ptr &rpc_module_entry
   
  
  
  
  1.2.2.2   +121 -147  php4/ext/rpc/rpc.c
  
  Index: rpc.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/rpc.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- rpc.c	9 Jul 2002 09:14:38 -0000	1.2.2.1
  +++ rpc.c	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -1,3 +1,21 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
   #ifdef HAVE_CONFIG_H
   #include "config.h"
   #endif
  @@ -9,15 +27,13 @@
   #include "php_rpc.h"
   #include "rpc.h"
   #include "layer.h"
  +#include "hash.h"
   
   static void rpc_instance_dtor(void *);
   static void rpc_class_dtor(void *);
   static void rpc_string_dtor(void *);
   
  -static zend_object_value rpc_objects_new(zend_class_entry * TSRMLS_DC);
  -static void rpc_objects_delete(void *object, zend_object_handle handle TSRMLS_DC);
  -
  -static int zend_ts_hash_remove_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData);
  +static void rpc_objects_delete(void *, zend_object_handle TSRMLS_DC);
   
   /* object handler */
   static zval* rpc_read(zval *, zval *, int  TSRMLS_DC);
  @@ -30,7 +46,7 @@
   static HashTable* rpc_get_properties(zval * TSRMLS_DC);
   static union _zend_function* rpc_get_method(zval *, char *, int TSRMLS_DC);
   static union _zend_function* rpc_get_constructor(zval * TSRMLS_DC);
  -static zend_class_entry* rpc_get_class_entry(zval *object TSRMLS_DC);
  +static zend_class_entry* rpc_get_class_entry(zval * TSRMLS_DC);
   static int rpc_compare(zval *, zval * TSRMLS_DC);
   /**/
   
  @@ -88,6 +104,7 @@
   
   zend_class_entry rpc_class_entry;
   
  +static zend_function *rpc_ctor;
   static HashTable *handlers;
   static TsHashTable *pool;
   static TsHashTable *classes;
  @@ -104,6 +121,7 @@
    */
   ZEND_MINIT_FUNCTION(rpc)
   {
  +	zend_internal_function *zif;
   	zend_class_entry *rpc_entry;
   
   	/* rpc base class entry */
  @@ -121,24 +139,39 @@
   	zend_llist_init(classes_list, sizeof(rpc_class_hash **), rpc_class_dtor, TRUE);
   
   	FOREACH_HANDLER {
  -		HANDLER.rpc_handler_init();
  +		zend_class_entry ce;
  +
  +		HANDLER.rpc_handler_init(module_number TSRMLS_CC);
   		
   		/* create a class entry for every rpc handler */
  -		INIT_CLASS_ENTRY((*(HANDLER.ce)),
  -							HANDLER.name,
  -							HANDLER.methods);
  +		INIT_CLASS_ENTRY(ce,
  +						 HANDLER.name,
  +						 HANDLER.methods);
   
  -		HANDLER.ce->create_object = rpc_objects_new;
  +		ce.create_object = rpc_objects_new;
   
   		/* load all available rpc handler into a hash */
   		zend_hash_add(handlers, HANDLER.name, strlen(HANDLER.name) + 1, &(HANDLER.handlers), sizeof(rpc_object_handlers *), NULL);
   
   		/* register classes and functions */
  -		zend_register_internal_class_ex(HANDLER.ce, rpc_entry, NULL TSRMLS_CC);
  +		*HANDLER.ce = zend_register_internal_class_ex(&ce, rpc_entry, NULL TSRMLS_CC);
   		zend_register_functions(HANDLER.functions, NULL, MODULE_PERSISTENT TSRMLS_CC);
   		zend_register_ini_entries(HANDLER.ini, module_number TSRMLS_CC);
   	}
   
  +
  +	zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
  +
  +	zif->type = ZEND_INTERNAL_FUNCTION;
  +	zif->function_name = rpc_entry->name;
  +	zif->scope = rpc_entry;
  +	zif->arg_types = NULL;
  +	zif->handler = ZEND_FN(rpc_load);
  +
  +	/* add new constructor to the method table */
  +	zend_hash_add(&(rpc_entry->function_table), rpc_entry->name, rpc_entry->name_length + 1, zif, sizeof(zend_function), &rpc_ctor);
  +	efree(zif);
  +
   	REGISTER_INI_ENTRIES();
   
   	return SUCCESS;
  @@ -149,6 +182,10 @@
    */
   ZEND_MSHUTDOWN_FUNCTION(rpc)
   {
  +	FOREACH_HANDLER {
  +		HANDLER.rpc_handler_shutdown(TSRMLS_C);
  +	}
  +
   	/* destroy instances first */
   	zend_ts_hash_destroy(pool);
   
  @@ -214,35 +251,6 @@
   	pefree(*intern, TRUE);
   }
   
  -static zend_object_value rpc_objects_new(zend_class_entry *class_type TSRMLS_DC)
  -{
  -	zend_object_value *zov;
  -	rpc_internal *intern;
  -	
  -	/* set up the object value struct */
  -	zov = (zend_object_value*) pemalloc(sizeof(zend_object_value), TRUE);
  -	zov->handlers = &rpc_handlers;
  -
  -	/* set up the internal representation of our rpc instance */
  -	intern = (rpc_internal *) pemalloc(sizeof(rpc_internal), TRUE);
  -
  -	intern->ce = class_type;
  -	intern->data = NULL;
  -	intern->function_table.hash = intern->ce->function_table;
  -	intern->function_table.reader = 0;
  -	intern->function_table.mx_reader = tsrm_mutex_alloc();
  -	intern->function_table.mx_writer = tsrm_mutex_alloc();
  -	intern->mx_handler = tsrm_mutex_alloc();
  -
  -	if (zend_hash_find(handlers, class_type->name, class_type->name_length + 1, (void **) &(intern->handlers)) != SUCCESS) {
  -		/* TODO: exception */
  -	}
  -
  -	zov->handle = zend_objects_store_put(intern, rpc_objects_delete, NULL TSRMLS_CC);
  -
  -	return *zov;
  -}
  -
   static zend_object_value rpc_create_proxy(TSRMLS_D)
   {
   	zend_object_value *zov;
  @@ -283,7 +291,9 @@
   			zend_ts_hash_index_update(pool, RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
   		}
   	} else {
  -		RPC_HT(intern)->rpc_dtor(intern->data);
  +		if (intern->data != NULL) {
  +			RPC_HT(intern)->rpc_dtor(intern->data);
  +		}
   		pefree(intern, TRUE);
   	}
   }
  @@ -351,7 +361,6 @@
   static int rpc_has_property(zval *object, zval *member, int check_empty TSRMLS_DC)
   {
   //	GET_INTERNAL(intern);
  -	
   	/* FIXME */
   	return FAILURE;
   }
  @@ -365,7 +374,6 @@
   static HashTable* rpc_get_properties(zval *object TSRMLS_DC)
   {
   //	GET_INTERNAL(intern);
  -
   	/* FIXME */
   	return NULL;
   }
  @@ -373,16 +381,28 @@
   static union _zend_function* rpc_get_method(zval *object, char *method, int method_len TSRMLS_DC)
   {
   	zend_function *function;
  +	unsigned char *ref_types = NULL;
   	GET_INTERNAL(intern);
   
   	if (zend_ts_hash_find(&(intern->function_table), method, method_len + 1, &function) != SUCCESS) {
   		zend_internal_function *zif;
   
  +		/* get reftypes */
  +		if (RPC_HT(intern)->rpc_describe) {
  +			char *arg_types;
  +			rpc_string method_name;
  +
  +			method_name.str = method;
  +			method_name.len = method_len;
  +
  +			RPC_HT(intern)->rpc_describe(method_name, intern->data, &arg_types, &ref_types);
  +		}
  +
   		zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
  -		zif->arg_types = NULL;
  +		zif->arg_types = ref_types;
   		zif->function_name = method;
   		zif->handler = ZEND_FN(rpc_call);
  -		zif->scope = NULL;
  +		zif->scope = intern->ce;
   		zif->type = ZEND_INTERNAL_FUNCTION;
   
   		/* add new method to the method table */
  @@ -395,25 +415,6 @@
   
   static union _zend_function* rpc_get_constructor(zval *object TSRMLS_DC)
   {
  -	zend_function *rpc_ctor;
  -	GET_INTERNAL(intern);
  -
  -	if (zend_ts_hash_find(&(intern->function_table), intern->ce->name, intern->ce->name_length + 1, &rpc_ctor) != SUCCESS) {
  -		zend_internal_function *zif;
  -
  -		zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
  -
  -		zif->type = ZEND_INTERNAL_FUNCTION;
  -		zif->function_name = intern->ce->name;
  -		zif->scope = intern->ce;
  -		zif->arg_types = NULL;
  -		zif->handler = ZEND_FN(rpc_load);
  -
  -		/* add new constructor to the method table */
  -		zend_ts_hash_add(&(intern->function_table), intern->ce->name, intern->ce->name_length + 1, zif, sizeof(zend_function), &rpc_ctor);
  -		efree(zif);
  -	}
  -
   	return rpc_ctor;
   }
   
  @@ -484,7 +485,9 @@
   		if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 1 TSRMLS_CC, "s", &class_val.str, &class_val.len) != SUCCESS) {
   			/* none of the two possibilities */
   			/* TODO: exception */
  -			php_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
  +			rpc_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
  +			ZVAL_NULL(object);
  +			return;
   		} else {
   			/* hash classname if hashing function exists */
   			if (RPC_HT(intern)->rpc_hash) {
  @@ -492,7 +495,7 @@
   				GET_SIGNATURE(intern, class_val.str, class_val.len, hash_val, num_args, arg_types);
   
   				/* check if already hashed */	
  -				if (zend_ts_hash_find(classes, hash_val.str, hash_val.len + 1, (void **) &class_hash_find) != SUCCESS) {
  + 				if (zend_ts_hash_find(classes, hash_val.str, hash_val.len + 1, (void **) &class_hash_find) != SUCCESS) {
   					class_hash = pemalloc(sizeof(rpc_class_hash), TRUE);
   
   					/* set up the cache */
  @@ -504,12 +507,14 @@
   					class_hash->data = NULL;
   
   					/* do hashing */
  -					if (RPC_HT(intern)->rpc_hash(class_val, (rpc_string *)(class_hash), num_args, arg_types, CLASS) != SUCCESS) {
  +					if (RPC_HT(intern)->rpc_hash(class_val, (rpc_string *)(class_hash), NULL, num_args, arg_types, CLASS) != SUCCESS) {
   						/* TODO: exception */
  +						ZVAL_NULL(object);
  +						return;
   					}
   
   					/* overload class entry */
  -					RPC_HT(intern)->rpc_name(class_val, &class_val, CLASS);
  +					RPC_HT(intern)->rpc_name(class_val, &class_val, NULL, CLASS);
   					INIT_CLASS_ENTRY(overloaded_class_entry, NULL, NULL);
   					overloaded_class_entry.name = class_val.str;
   					overloaded_class_entry.name_length = class_val.len;
  @@ -561,7 +566,7 @@
   			zend_ts_hash_init(&(class_hash->properties), 0, NULL, rpc_string_dtor, TRUE);
   
   			/* overload class entry */
  -			RPC_HT(intern)->rpc_name(class_val, &class_val, CLASS);
  +			RPC_HT(intern)->rpc_name(class_val, &class_val, NULL, CLASS);
   			INIT_CLASS_ENTRY(overloaded_class_entry, class_val.str, NULL);
   			class_hash->ce = zend_register_internal_class_ex(&overloaded_class_entry, intern->ce, NULL TSRMLS_CC);
   			intern->ce = class_hash->ce;
  @@ -606,6 +611,7 @@
   
   	if (retval != SUCCESS) {
   		/* TODO: exception */
  +		RETURN_NULL();
   	}
   }
   
  @@ -628,7 +634,7 @@
   			if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Os", &object, *ce, &hash, &hash_len) != SUCCESS) {
   				/* none of the two possibilities */
   				/* TODO: exception */
  -				php_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
  +				rpc_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
   			}
   		}
   
  @@ -660,8 +666,9 @@
   
   				/* check if already hashed */	
   				if (zend_ts_hash_find(&(intern->hash->methods), hash_val.str, hash_val.len + 1, (void **) &method_hash_find) != SUCCESS) {
  -					if (RPC_HT(intern)->rpc_hash(*method_hash, method_hash, num_args, arg_types, METHOD) != SUCCESS) {
  +					if (RPC_HT(intern)->rpc_hash(*method_hash, method_hash, intern->data, num_args, arg_types, METHOD) != SUCCESS) {
   						/* TODO: exception */
  +						RETURN_NULL();
   					}
   
   					/* register with non-hashed key */
  @@ -680,7 +687,7 @@
   		 * and srm it is better to do concurrency checks
   		 */
   		tsrm_mutex_lock(intern->mx_handler);
  -		retval = RPC_HT(intern)->rpc_call(*method_hash, &(intern->data), &return_value, num_args, args);
  +		retval = RPC_HT(intern)->rpc_call(*method_hash, &(intern->data), return_value, num_args, args);
   		tsrm_mutex_unlock(intern->mx_handler);
   	}
   
  @@ -704,7 +711,7 @@
   		if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 3 TSRMLS_CC, "Osz", &object, *ce, &property, &property_len, &value) != SUCCESS) {
   			/* none of the two possibilities */
   			/* TODO: exception */
  -			php_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
  +			rpc_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
   		}
   	}
   
  @@ -729,7 +736,7 @@
   		if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 2 TSRMLS_CC, "Os", &object, *ce, &property, &property_len) != SUCCESS) {
   			/* none of the two possibilities */
   			/* TODO: exception */
  -			php_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
  +			rpc_error(E_WARNING, "wrong arguments for %s()", get_active_function_name(TSRMLS_C));
   		}
   	}
   
  @@ -778,6 +785,44 @@
   	}
   }
   
  +ZEND_API void rpc_error(int type, const char *format, ...)
  +{
  +	va_list args;
  +
  +	va_start(args, format);
  +	zend_error(type, format, args);
  +	va_end(args);
  +}
  +
  +ZEND_API zend_object_value rpc_objects_new(zend_class_entry *class_type TSRMLS_DC)
  +{
  +	zend_object_value *zov;
  +	rpc_internal *intern;
  +	
  +	/* set up the object value struct */
  +	zov = (zend_object_value*) pemalloc(sizeof(zend_object_value), TRUE);
  +	zov->handlers = &rpc_handlers;
  +
  +	/* set up the internal representation of our rpc instance */
  +	intern = (rpc_internal *) pemalloc(sizeof(rpc_internal), TRUE);
  +
  +	intern->ce = class_type;
  +	intern->data = NULL;
  +	intern->function_table.hash = intern->ce->function_table;
  +	intern->function_table.reader = 0;
  +	intern->function_table.mx_reader = tsrm_mutex_alloc();
  +	intern->function_table.mx_writer = tsrm_mutex_alloc();
  +	intern->mx_handler = tsrm_mutex_alloc();
  +
  +	if (zend_hash_find(handlers, class_type->name, class_type->name_length + 1, (void **) &(intern->handlers)) != SUCCESS) {
  +		/* TODO: exception */
  +	}
  +
  +	zov->handle = zend_objects_store_put(intern, rpc_objects_delete, NULL TSRMLS_CC);
  +
  +	return *zov;
  +}
  +
   /*******************/
   
   static void rpc_internal_get(rpc_internal *intern, char *property, zend_uint property_len, zval *return_value)
  @@ -799,8 +844,9 @@
   		} else if(property) {
   			/* check if already hashed */	
   			if (zend_ts_hash_find(&(intern->hash->properties), property, property_len + 1, (void **) &property_hash_find) != SUCCESS) {
  -				if (RPC_HT(intern)->rpc_hash(*property_hash, property_hash, 0, NULL, PROPERTY) != SUCCESS) {
  +				if (RPC_HT(intern)->rpc_hash(*property_hash, property_hash, intern->data, 0, NULL, PROPERTY) != SUCCESS) {
   					/* TODO: exception */
  +					RETURN_NULL();
   				}
   
   				/* register with non-hashed key */
  @@ -838,78 +884,6 @@
   		/* TODO: exception here */
   	}
   }
  -
  -/***********************************/
  -
  -static int zend_ts_hash_remove_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData)
  -{
  -	uint nIndex;
  -	uint h = nKeyLength;
  -	uint result;
  -	void **ppData;
  -	Bucket *p;
  -
  -	tsrm_mutex_lock(ht->mx_writer);
  -
  -	if (arKey) {
  -		result = zend_hash_find(TS_HASH(ht), arKey, nKeyLength, (void **) &ppData);
  -	} else {
  -		result = zend_hash_index_find(TS_HASH(ht), h, (void **) &ppData);
  -	}
  -
  -	if (result == SUCCESS) {
  -		*pData = *ppData;
  -
  -		if (arKey) {
  -			h = zend_inline_hash_func(arKey, nKeyLength);
  -		}
  -
  -		nIndex = h & TS_HASH(ht)->nTableMask;
  -
  -		p = TS_HASH(ht)->arBuckets[nIndex];
  -		while (p != NULL) {
  -			if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */
  -				((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) {
  -				HANDLE_BLOCK_INTERRUPTIONS();
  -				if (p == TS_HASH(ht)->arBuckets[nIndex]) {
  -					TS_HASH(ht)->arBuckets[nIndex] = p->pNext;
  -				} else {
  -					p->pLast->pNext = p->pNext;
  -				}
  -				if (p->pNext) {
  -					p->pNext->pLast = p->pLast;
  -				}
  -				if (p->pListLast != NULL) {
  -					p->pListLast->pListNext = p->pListNext;
  -				} else { 
  -					/* Deleting the head of the list */
  -					TS_HASH(ht)->pListHead = p->pListNext;
  -				}
  -				if (p->pListNext != NULL) {
  -					p->pListNext->pListLast = p->pListLast;
  -				} else {
  -					TS_HASH(ht)->pListTail = p->pListLast;
  -				}
  -				if (TS_HASH(ht)->pInternalPointer == p) {
  -					TS_HASH(ht)->pInternalPointer = p->pListNext;
  -				}
  -				if (!p->pDataPtr) {
  -					pefree(p->pData, TS_HASH(ht)->persistent);
  -				}
  -				pefree(p, TS_HASH(ht)->persistent);
  -				HANDLE_UNBLOCK_INTERRUPTIONS();
  -				TS_HASH(ht)->nNumOfElements--;
  -				return SUCCESS;
  -			}
  -			p = p->pNext;
  -		}
  -	}
  -	tsrm_mutex_unlock(ht->mx_writer);
  -
  -	return FAILURE;
  -}
  -
  -
   
   
   /*
  
  
  
  1.2.2.2   +18 -0     php4/ext/rpc/rpc.h
  
  Index: rpc.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/rpc.h,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- rpc.h	9 Jul 2002 09:14:38 -0000	1.2.2.1
  +++ rpc.h	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -1,3 +1,21 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
   #ifndef RPC_H
   #define RPC_H
   
  
  
  
  1.2.2.2   +18 -0     php4/ext/rpc/rpc_proxy.c
  
  Index: rpc_proxy.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/rpc_proxy.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- rpc_proxy.c	9 Jul 2002 09:14:38 -0000	1.2.2.1
  +++ rpc_proxy.c	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -1,3 +1,21 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
   #include "php.h"
   
   #include "rpc_proxy.h"
  
  
  
  1.2.2.1   +18 -0     php4/ext/rpc/rpc_proxy.h
  
  Index: rpc_proxy.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/rpc_proxy.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- rpc_proxy.h	29 Apr 2002 02:30:59 -0000	1.2
  +++ rpc_proxy.h	3 Aug 2002 00:44:16 -0000	1.2.2.1
  @@ -1,3 +1,21 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
   #ifndef RPC_PROXY_H
   #define RPC_PROXY_H
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +996 -19   php4/ext/rpc/com/com.c
  
  Index: com.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/com.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- com.c	9 Jul 2002 09:14:38 -0000	1.2.2.1
  +++ com.c	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -1,11 +1,41 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
  +#define _WIN32_DCOM
  +
  +#include "../rpc.h"
  +#include "../handler.h"
  +
   #include "com.h"
  +#include "com_wrapper.h"
  +#include "conversion.h"
  +#include "variant.h"
  +
  +#include <oleauto.h>
  +
   
   /* protos */
  -static int com_hash(rpc_string, rpc_string *, int, char *, int);
  -static int com_name(rpc_string, rpc_string *, int);
  +static int com_hash(rpc_string, rpc_string *, void *, int, char *, int);
  +static int com_name(rpc_string, rpc_string *, void *, int);
   static int com_ctor(rpc_string, void **, int , zval ***);
  -static int com_dtor(void **);
  -static int com_call(rpc_string, void **, zval **, int, zval ***);
  +static int com_dtor(void *);
  +static int com_describe(rpc_string, void *, char **, unsigned char **);
  +static int com_call(rpc_string, void **, zval *, int, zval ***);
   static int com_get(rpc_string, zval *, void **);
   static int com_set(rpc_string, zval *, void **);
   static int com_compare(void **, void **);
  @@ -13,6 +43,11 @@
   static int com_unset_property(rpc_string, void **);
   static int com_get_properties(HashTable **, void **);
   
  +static PHP_INI_MH(com_typelib_file_change);
  +
  +/* globals */
  +static IBindCtx *pBindCtx;
  +static unsigned char arg1and2_force_ref[] = { 2, BYREF_FORCE, BYREF_FORCE };
   
   /* register rpc callback function */
   RPC_REGISTER_HANDLERS_START(com)
  @@ -22,6 +57,7 @@
   com_name,
   com_ctor,
   com_dtor,
  +com_describe,
   com_call,
   com_get,
   com_set,
  @@ -37,68 +73,567 @@
   PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
   PHP_INI_ENTRY_EX("com.autoregister_verbose", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
   PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
  +PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, com_typelib_file_change)
   RPC_INI_END()
   
   /* register userspace functions */
   RPC_FUNCTION_ENTRY_START(com)
  -	ZEND_FALIAS(com_invoke, rpc_call, NULL)
  -	ZEND_FE(com_addref, NULL)
  -	ZEND_FE(com_release, NULL)
  +	ZEND_FALIAS(com_invoke,	rpc_call,		NULL)
  +	ZEND_FE(com_addref,			NULL)
  +	ZEND_FE(com_release,		NULL)
  +	ZEND_FE(com_next,			NULL)
  +	ZEND_FE(com_all,			NULL)
  +	ZEND_FE(com_reset,			NULL)
  +	ZEND_FE(com_skip,			NULL)
  +	ZEND_FE(com_event_sink,		arg1and2_force_ref)
  +	ZEND_FE(com_message_pump,	NULL)
  +	ZEND_FE(com_print_typeinfo,	NULL)
   RPC_FUNCTION_ENTRY_END()
   
   /* register class methods */
   RPC_METHOD_ENTRY_START(com)
  -	ZEND_FALIAS(addref, com_addref, NULL)
  -	ZEND_FALIAS(release, com_release, NULL)
  +	ZEND_FALIAS(addref,		com_addref,		NULL)
  +	ZEND_FALIAS(release,	com_release,	NULL)
  +	ZEND_FALIAS(next,		com_next,		NULL)
  +	ZEND_FALIAS(all,		com_all,		NULL)
  +	ZEND_FALIAS(reset,		com_reset,		NULL)
  +	ZEND_FALIAS(skip,		com_skip,		NULL)
   RPC_METHOD_ENTRY_END()
   
  +
   /* init function that is called before the class is registered
    * so you can do any tricky stuff in here
    */
   RPC_INIT_FUNCTION(com)
   {
  +	CreateBindCtx(0, &pBindCtx);
  +	php_variant_init(module_number TSRMLS_CC);
  +}
  +
  +RPC_SHUTDOWN_FUNCTION(com)
  +{
  +	php_variant_shutdown(TSRMLS_C);
  +	pBindCtx->lpVtbl->Release(pBindCtx);
   }
   
   /* rpc handler functions */
   
  -static int com_hash(rpc_string name, rpc_string *hash, int num_args, char *arg_types, int type)
  +static int com_hash(rpc_string name, rpc_string *hash, void *data, int num_args, char *arg_types, int type)
   {
  -	hash->str = strdup(name.str);
  -	hash->len = name.len;
  +	OLECHAR *olestr = php_char_to_OLECHAR(name.str, name.len, CP_ACP, FALSE);
   
  -	return SUCCESS;
  +	switch (type) {
  +		case CLASS:
  +		{
  +			CLSID *clsid = malloc(sizeof(CLSID));
  +
  +			if (FAILED(CLSIDFromString(olestr, clsid))) {
  +				/* Perhaps this is a Moniker? */
  +				free(clsid);
  +
  +				hash->str = strdup(name.str);
  +				hash->len = name.len;
  +			} else {
  +				hash->str = (char *) clsid;
  +				/* str is actually not a string but a CLSID struct, thus set len to 0.
  +				 * nevertheless clsid is freed by the rpc_string_dtor
  +				 */
  +				hash->len = 0;
  +			}
  +
  +			efree(olestr);
  +
  +			return SUCCESS;
  +		}
  +
  +		case METHOD:
  +		case PROPERTY:
  +		{
  +			DISPID *dispid = malloc(sizeof(DISPID));
  +			
  +			if(SUCCEEDED(php_COM_get_ids_of_names((comval *) data, olestr, dispid))) {
  +				hash->str = (char *) dispid;
  +				/* str is actually not a string but a DISPID struct, thus set len to 0.
  +				 * nevertheless dispid is freed by the rpc_string_dtor
  +				 */
  +				hash->len = 0;
  +
  +				efree(olestr);
  +
  +				return SUCCESS;
  +			} else {
  +				free(dispid);
  +				efree(olestr);
  +
  +				return FAILURE;
  +			}
  +		}
  +	}
  +
  +	efree(olestr);
  +
  +	return FAILURE;
   }
   
  -static int com_name(rpc_string hash, rpc_string *name, int type)
  +static int com_name(rpc_string hash, rpc_string *name, void *data, int type)
   {
  -	name->str = strdup(hash.str);
  -	name->len = hash.len;
  +	if (hash.len != 0) {
  +		/* not a GUID, perhaps a Moniker */
  +		name->str = strdup(hash.str);
  +		name->len = hash.len;
  +
  +		return SUCCESS;
  +	} else {
  +		switch (type) {
  +			case CLASS:
  +			{
  +				OLECHAR *olestr;
  +
  +				StringFromCLSID((CLSID *) hash.str, &olestr);
  +				name->str = php_OLECHAR_to_char(olestr, &(name->len), CP_ACP, TRUE);
  +				CoTaskMemFree(olestr);
  +
  +				return SUCCESS;
  +			}
  +
  +			case METHOD:
  +			case PROPERTY:
  +				/* not used yet */
  +				break;
  +		}
  +	}
   
  -	return SUCCESS;
  +	return FAILURE;
   }
   
   static int com_ctor(rpc_string class_name, void **data, int num_args, zval **args[])
   {
  +	zval **server_name = NULL;
  +	zval **code_page = NULL;
  +	zval **typelib = NULL;
  +	zval **user_name=NULL;
  +	zval **password=NULL;
  +	zval **domain=NULL;
  +	int mode = 0;
  +	comval *obj;
  +	HRESULT hr;
  +	CLSCTX flags = CLSCTX_SERVER;
  +
  +	switch (num_args) {
  +		case 3:
  +			typelib = args[2];
  +			convert_to_string_ex(typelib);
  +			/* break missing intentionally */
  +		case 2:
  +			code_page = args[1];
  +			convert_to_long_ex(code_page);
  +			/* break missing intentionally */
  +		case 1:
  +			server_name = args[0];
  +			/* break missing intentionally */
  +			break;
  +
  +		case 0:
  +			/* nothing to do */
  +			break;
  +
  +		default:
  +			/* exception */
  +			return FAILURE;
  +	}
  +
  +	if (server_name != NULL) {
  +		/* What is server name? A String or an array? */
  +		if (Z_TYPE_PP(server_name) == IS_NULL) {
  +			server_name = NULL;
  +		} else if (Z_TYPE_PP(server_name) == IS_ARRAY) {
  +			zval **tmp;
  +			/* Aha - we have a number of possible arguments.
  +			 * They are in the hash By name: Server, Domain, Username, Password
  +			 * Flags.
  +			 * This has been crafted to maintian maximum backward compatability.
  +			 * If the server name is specified as a string, then the function
  +			 * should behave as before by defaulting username and password and
  +			 * using the (I believe) incorrect CLSCTX_SERVER instantiation
  +			 * paramter. However if server is specified in this array then we
  +			 * use either CLSCTX_REMOTE_SERVER or whatever flags are specified
  +			 * in the array
  +			 */
  +			HashTable *ht = Z_ARRVAL_PP(server_name);
  +			if (FAILURE == zend_hash_find(ht, "Server", 7, (void **) &tmp)) {
  +				server_name = NULL;
  +			} else {
  +				server_name = tmp;
  +				convert_to_string_ex(server_name);
  +				/* CLSCTX_SERVER includes INPROC and LOCAL SERVER. This means
  +				 * that any local server will be instantiated BEFORE even
  +				 * looking on a remote server. Thus if we have a server name,
  +				 * probably we want to access a remote machine or we would not
  +				 * have bothered specifying it. So it would be wrong to to
  +				 * connect locally. Futher, unless the name passed is a GUID,
  +				 * there has to be something to map the Prog.Id to GUID and
  +				 * unless that has been modified to remove the information
  +				 * about local instantiation CLSCTX_SERVER would force a local
  +				 * instantiation This setting can be overridden below if the
  +				 * user specifies a flags element */
  +				flags = CLSCTX_REMOTE_SERVER;
  +			}
  +			if (FAILURE == zend_hash_find(ht, "username", 9, (void **) &tmp)) {
  +				user_name = NULL;
  +			} else {
  +				user_name = tmp;
  +				convert_to_string_ex(user_name);
  +			}
  +			if (FAILURE == zend_hash_find(ht, "domain", 7, (void **) &tmp)) {
  +				domain = NULL;
  +			} else {
  +				domain = tmp;
  +				convert_to_string_ex(domain);
  +			}
  +			if (FAILURE == zend_hash_find(ht, "password", 9, (void **) &tmp)) {
  +				password=NULL;
  +			} else {
  +				password = tmp;
  +				convert_to_string_ex(password);
  +			}
  +			if (SUCCESS == zend_hash_find(ht, "flags", 6, (void **) &tmp)) {
  +				convert_to_long_ex(tmp);
  +				flags = (CLSCTX) Z_LVAL_PP(tmp);
  +			}
  +		}
  +
  +		if (server_name != NULL) {
  +			if (!INI_INT("com.allow_dcom")) {
  +				rpc_error(E_WARNING, "DCOM is disabled");
  +				return FAILURE;
  +			} else {
  +				flags = CLSCTX_REMOTE_SERVER;
  +				convert_to_string_ex(server_name);
  +			}
  +		}
  +	}
  +
  +	ALLOC_COM(obj);
  +	*data = obj;
  +
  +	if (code_page != NULL) {
  +		C_CODEPAGE(obj) = Z_LVAL_PP(code_page);
  +	}
  +
  +	if (class_name.len) {
  +		/* Perhaps this is a Moniker? */
  +		IMoniker *pMoniker;
  +		ULONG ulEaten;
  +
  +		if (server_name) {
  +			hr = MK_E_SYNTAX;
  +		} else {
  +			OLECHAR *olestr = php_char_to_OLECHAR(class_name.str, class_name.len, C_CODEPAGE(obj), FALSE);
  +
  +			if (SUCCEEDED(hr = MkParseDisplayNameEx(pBindCtx, olestr, &ulEaten, &pMoniker))) {
  +				hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
  +				pMoniker->lpVtbl->Release(pMoniker);
  +			}
  +
  +			efree(olestr);
  +		}
  +
  +		if (FAILED(hr)) {
  +			char *error_message;
  +
  +			php_COM_destruct(obj);
  +			error_message = php_COM_error_message(hr);  
  +			rpc_error(E_WARNING,"Invalid ProgID, GUID string, or Moniker: %s", error_message);
  +			LocalFree(error_message);
  +			
  +			return FAILURE;
  +		}
  +	} else {
  +		/* obtain IDispatch */
  +		if (!server_name) {
  +			hr = CoCreateInstance((CLSID *) class_name.str, NULL, flags, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
  +		} else {
  +			COSERVERINFO server_info;
  +			MULTI_QI pResults;
  +			COAUTHIDENTITY authid;
  +			COAUTHINFO authinfo = {RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, &authid, EOAC_NONE};
  +
  +			server_info.dwReserved1=0;
  +			server_info.dwReserved2=0;
  +			server_info.pwszName = php_char_to_OLECHAR(Z_STRVAL_PP(server_name), Z_STRLEN_PP(server_name), C_CODEPAGE(obj), FALSE);
  +			if (user_name) {
  +				/* Parse Username into domain\username */
  +				authid.User = (WCHAR *) Z_STRVAL_PP(user_name);
  +				authid.UserLength = Z_STRLEN_PP(user_name);
  +				if (password) {
  +					authid.Password = (USHORT *) Z_STRVAL_PP(password);
  +					authid.PasswordLength = Z_STRLEN_PP(password);
  +				} else {
  +					authid.Password = (USHORT *) "";
  +					authid.PasswordLength = 0;
  +				}
  +				if (domain) {
  +					authid.Domain = (USHORT *) Z_STRVAL_PP(domain);
  +					authid.DomainLength = Z_STRLEN_PP(domain);
  +				} else {
  +					authid.Domain = (USHORT *) "";
  +					authid.DomainLength = 0;
  +				}
  +				authid.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
  +
  +				server_info.pAuthInfo=&authinfo;
  +			} else {
  +				server_info.pAuthInfo=NULL;
  +			}
  +
  +			pResults.pIID = &IID_IDispatch;
  +			pResults.pItf = NULL;
  +			pResults.hr = S_OK;
  +			hr=CoCreateInstanceEx((CLSID *) class_name.str, NULL, flags, &server_info, 1, &pResults);
  +			if (SUCCEEDED(hr)) {
  +				hr = pResults.hr;
  +				C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
  +			}
  +			efree(server_info.pwszName);
  +		}
  +
  +		if (FAILED(hr)) {
  +			char *error_message, *clsid;
  +
  +			php_COM_destruct(obj);
  +			error_message = php_COM_error_message(hr);
  +			clsid = php_COM_string_from_CLSID((CLSID *)class_name.str);
  +			rpc_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s", clsid, error_message);
  +			LocalFree(error_message);
  +			efree(clsid);
  +
  +			return FAILURE;
  +		}
  +	}
  +
  +	php_COM_set(obj, &C_DISPATCH(obj), TRUE);
  +
  +	if (INI_INT("com.autoregister_casesensitive")) {
  +		mode |= CONST_CS;
  +	}
  +
  +	if (C_HASTLIB(obj)) {
  +		if (INI_INT("com.autoregister_typelib")) {
  +			ITypeLib *pTL;
  +			unsigned int idx;
  +
  +			/* @todo check if typlib isn't already loaded */
  +			if (C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &pTL, &idx) == S_OK) {
  +				php_COM_load_typelib(pTL, mode);
  +				pTL->lpVtbl->Release(pTL);
  +			}
  +		}
  +	} else {
  +		if (typelib != NULL) {
  +			ITypeLib *pTL;
  +
  +			if ((pTL = php_COM_find_typelib(Z_STRVAL_PP(typelib), mode)) != NULL) {
  +				C_HASTLIB(obj) = SUCCEEDED(pTL->lpVtbl->GetTypeInfo(pTL, 0, &C_TYPEINFO(obj)));
  +				/* idx 0 should deliver the ITypeInfo for the IDispatch Interface */
  +				if (INI_INT("com.autoregister_typelib")) {
  +					php_COM_load_typelib(pTL, mode);
  +				}
  +				pTL->lpVtbl->Release(pTL);
  +			}
  +		}
  +	}
  +
  +	return SUCCESS;
  +}
  +
  +static int com_dtor(void *data)
  +{
  +	php_COM_destruct((comval *) data);
  +
   	return SUCCESS;
   }
   
  -static int com_dtor(void **data)
  +static int com_describe(rpc_string method_name, void *data, char **arg_types, unsigned char **ref_types)
   {
   	return SUCCESS;
   }
   
  -static int com_call(rpc_string method_name, void **data, zval **return_value, int num_args, zval **args[])
  +static int com_call(rpc_string method_name, void **data, zval *return_value, int num_args, zval **args[])
   {
  +	DISPID dispid;
  +	DISPPARAMS dispparams;
  +	HRESULT hr;
  +	OLECHAR *funcname;
  +	VARIANT *variant_args, *result;
  +	int current_arg, current_variant;
  +	char *ErrString;
  +	TSRMLS_FETCH();
  +
  +	funcname = php_char_to_OLECHAR(method_name.str, method_name.len, CP_ACP, FALSE);
  +
  +	if (FAILED(hr = php_COM_get_ids_of_names((comval *) *data, funcname, &dispid))) {
  +		char *error_message;
  +	
  +		error_message = php_COM_error_message(hr);
  +		php_error(E_WARNING,"Unable to lookup %s: %s", method_name.str, error_message);
  +		LocalFree(error_message);
  +		efree(funcname);
  +
  +		return FAILURE;
  +	}
  +
  +	variant_args = (VARIANT *) emalloc(sizeof(VARIANT) * num_args);
  +
  +	for (current_arg = 0; current_arg < num_args; current_arg++) {
  +		current_variant = num_args - current_arg - 1;
  +		php_zval_to_variant(*args[current_arg], &variant_args[current_variant], C_CODEPAGE((comval *) *data));
  +	}
  +
  +	dispparams.rgvarg = variant_args;
  +	dispparams.rgdispidNamedArgs = NULL;
  +	dispparams.cArgs = num_args;
  +	dispparams.cNamedArgs = 0;
  +
  +	result = (VARIANT *) emalloc(sizeof(VARIANT));
  +	VariantInit(result);
  +
  +	hr = php_COM_invoke((comval *) *data, dispid, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, result, &ErrString);
  +
  +	for (current_arg=0;current_arg<num_args;current_arg++) {
  +		/* don't release IDispatch pointers as they are used afterwards */
  +		if (V_VT(&variant_args[current_arg]) != VT_DISPATCH) {
  +			/* @todo review this: what happens to an array of IDispatchs or a VARIANT->IDispatch */
  +			VariantClear(&variant_args[current_arg]);
  +		}
  +	}
  +
  +	efree(result);
  +	efree(funcname);
  +
  +	if (FAILED(hr)) {
  +		char *error_message;
  +
  +		efree(result);
  +		error_message = php_COM_error_message(hr);
  +		if (ErrString) {
  +			php_error(E_WARNING,"Invoke() failed: %s %s", error_message, ErrString);
  +			efree(ErrString);
  +		} else {
  +			php_error(E_WARNING,"Invoke() failed: %s", error_message);
  +		}
  +		LocalFree(error_message);
  +		return FAILURE;
  +	}
  +
  +	RETVAL_VARIANT(result, C_CODEPAGE((comval *) *data));
   	return SUCCESS;
   }
   
   static int com_get(rpc_string property_name, zval *return_value, void **data)
   {
  +	char *ErrString;
  +	VARIANT *result;
  +	OLECHAR *propname;
  +	DISPID dispid;
  +	DISPPARAMS dispparams;
  +	HRESULT hr;
  +	TSRMLS_FETCH();
  +
  +	/* obtain property handler */
  +	propname = php_char_to_OLECHAR(property_name.str, property_name.len, CP_ACP, FALSE);
  +
  +	if (FAILED(hr = php_COM_get_ids_of_names((comval *) *data, propname, &dispid))) {
  +		char *error_message;
  +
  +		efree(propname);
  +		error_message = php_COM_error_message(hr);
  +		rpc_error(E_WARNING,"Unable to lookup %s: %s", property_name.str, error_message);
  +		LocalFree(error_message);
  +
  +		return FAILURE;
  +	}
  +
  +	efree(propname);
  +
  +	result = (VARIANT *) emalloc(sizeof(VARIANT));
  +	VariantInit(result);
  +
  +	dispparams.cArgs = 0;
  +	dispparams.cNamedArgs = 0;
  +
  +	if (FAILED(hr = php_COM_invoke((comval *) data, dispid, DISPATCH_PROPERTYGET, &dispparams, result, &ErrString))) {
  +		char *error_message;
  +
  +		efree(result);
  +		error_message = php_COM_error_message(hr);
  +		if (ErrString != NULL) {
  +			rpc_error(E_WARNING,"PropGet() failed: %s %s", error_message, ErrString);
  +			efree(ErrString);
  +		} else {
  +			rpc_error(E_WARNING,"PropGet() failed: %s", error_message);
  +		}
  +		LocalFree(error_message);
  +
  +		return FAILURE;
  +	}
  +
  +	RETVAL_VARIANT(result, C_CODEPAGE((comval *) *data));
  +
   	return SUCCESS;
   }
   
   static int com_set(rpc_string property_name, zval *value, void **data)
   {
  +	HRESULT hr;
  +	OLECHAR *propname;
  +	DISPID dispid, mydispid = DISPID_PROPERTYPUT;
  +	DISPPARAMS dispparams;
  +	VARIANT *var;
  +	char *error_message, *ErrString;
  +
  +
  +	/* obtain property handler */
  +	propname = php_char_to_OLECHAR(property_name.str, property_name.len, CP_ACP, FALSE);
  +
  +	if (FAILED(hr = php_COM_get_ids_of_names((comval *) *data, propname, &dispid))) {
  +		error_message = php_COM_error_message(hr);
  +		php_error(E_WARNING,"Unable to lookup %s: %s", property_name.str, error_message);
  +		LocalFree(error_message);
  +		efree(propname);
  +
  +		return FAILURE;
  +	}
  +
  +	efree(propname);
  +
  +	var = (VARIANT *) emalloc(sizeof(VARIANT));
  +	VariantInit(var);
  +
  +	php_zval_to_variant(value, var, C_CODEPAGE((comval *) *data));
  +	dispparams.rgvarg = var;
  +	dispparams.rgdispidNamedArgs = &mydispid;
  +	dispparams.cArgs = 1;
  +	dispparams.cNamedArgs = 1;
  +
  +	if (FAILED(hr = php_COM_invoke((comval *) *data, dispid, DISPATCH_PROPERTYPUT, &dispparams, NULL, &ErrString))) {
  +		error_message = php_COM_error_message(hr);
  +		if (ErrString) {
  +			php_error(E_WARNING,"PropPut() failed: %s %s", error_message, ErrString);
  +			efree(ErrString);
  +		} else {
  +			php_error(E_WARNING,"PropPut() failed: %s", error_message);
  +		}
  +		LocalFree(error_message);
  +		VariantClear(var);
  +		efree(var);
  +
  +		return FAILURE;
  +	}
  +
  +
  +	VariantClear(var);
  +	efree(var);
  +
   	return SUCCESS;
   }
   
  @@ -122,11 +657,453 @@
   	return SUCCESS;
   }
   
  +
   /* custom functions */
  +
  +/* {{{ proto mixed com_addref(int module)
  +   Increases the reference counter on a COM object */
   ZEND_FUNCTION(com_addref)
   {
  +	zval *object = getThis();
  +	rpc_internal *intern;
  +
  +	if (object == NULL) {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &object, com_class_entry);
  +	} else {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "");
  +	}
  +
  +	if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +		/* TODO: exception */
  +	}
  +
  +	RETURN_LONG(php_COM_addref((comval *) intern->data));
   }
  +/* }}} */
   
  +/* {{{ proto mixed com_release(int module)
  +   Releases a COM object */
   ZEND_FUNCTION(com_release)
   {
  +	zval *object = getThis();
  +	rpc_internal *intern;
  +
  +	if (object == NULL) {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &object, com_class_entry);
  +	} else {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "");
  +	}
  +
  +	if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +		/* TODO: exception */
  +	}
  +
  +	RETURN_LONG(php_COM_release((comval *) intern->data));
  +}
  +/* }}} */
  +
  +PHP_FUNCTION(com_next)
  +{
  +	zval *object = getThis();
  +	rpc_internal *intern;
  +	comval *obj;
  +	unsigned long count = 1;
  +
  +	if (object == NULL) {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &object, com_class_entry, &count);
  +	} else {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count);
  +	}
  +
  +	if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +		/* TODO: exception */
  +	}
  +
  +	obj = (comval *) intern->data;
  +
  +	if (C_HASENUM(obj)) {
  +		SAFEARRAY *pSA;
  +		SAFEARRAYBOUND rgsabound[1];
  +		VARIANT *result;
  +		HRESULT hr;
  +
  +		/* Grab one argument off the stack, allocate enough
  +		 * VARIANTs
  +		 * Get the IEnumVariant interface and call ->Next();
  +		 */
  +
  +		rgsabound[0].lLbound = 0;
  +		rgsabound[0].cElements = count;
  +
  +		result = (VARIANT *) emalloc(sizeof(VARIANT));
  +		VariantInit(result);
  +
  +		if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
  +			efree(result);
  +			/* @todo exception */
  +			
  +			RETURN_NULL();
  +		} else {
  +			V_ARRAY(result) = pSA;
  +			V_VT(result) = VT_VARIANT|VT_ARRAY;
  +		}
  +
  +		if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Next(C_ENUMVARIANT(obj), count, pSA->pvData, &count))) {
  +			char *error_message;
  +				
  +			efree(result);
  +			error_message = php_COM_error_message(hr);
  +			rpc_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
  +			efree(error_message);
  +
  +			RETURN_NULL();
  +		}
  +
  +		if (count != rgsabound[0].cElements) {
  +			rgsabound[0].cElements = count;
  +			if (FAILED(SafeArrayRedim(pSA, rgsabound))) {
  +				char *error_message;
  +				
  +				efree(result);
  +				error_message = php_COM_error_message(hr);
  +				php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
  +				efree(error_message);
  +
  +				RETURN_NULL();
  +			}
  +		}
  +
  +		/* return a single element if next() was called without count */
  +		if ((ZEND_NUM_ARGS() == 0) && (count == 1)) {
  +			long index[] = {0};
  +
  +			SafeArrayGetElement(pSA, index, result);
  +			SafeArrayDestroy(pSA);
  +		}
  +
  +		RETURN_VARIANT(result, C_CODEPAGE(obj));
  +	}
  +
  +	/* @todo exception */
  +	RETURN_NULL();
  +}
  +
  +PHP_FUNCTION(com_all)
  +{
  +#if 0
  +		} else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "all")) {
  +#define FETCH_BLOCKSIZE 10 /* fetch blocks of 10 elements */
  +
  +		count = FETCH_BLOCKSIZE;
  +
  +		rgsabound[0].lLbound = 0;
  +		rgsabound[0].cElements = count;
  +
  +		if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
  +			VariantInit(var_result);
  +			return FAILURE;
  +		} else {
  +			V_ARRAY(var_result) = pSA;
  +			V_VT(var_result) = VT_VARIANT|VT_ARRAY;
  +		}
  +
  +		/* blah*/
  +#endif
  +}
  +
  +PHP_FUNCTION(com_reset)
  +{
  +	zval *object = getThis();
  +	rpc_internal *intern;
  +	comval *obj;
  +
  +	if (object == NULL) {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &object, com_class_entry);
  +	} else {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "");
  +	}
  +
  +	if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +		/* TODO: exception */
  +	}
  +
  +	obj = (comval *) intern->data;
  +
  +	if (C_HASENUM(obj)) {
  +		HRESULT hr;
  +
  +		if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj)))) {
  +			char *error_message = php_COM_error_message(hr);
  +			php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
  +			efree(error_message);
  +
  +			RETURN_FALSE;
  +		}
  +		
  +		RETURN_TRUE;
  +	}
  +
  +	/* @todo exception */
  +	RETURN_FALSE;
  +}
  +
  +PHP_FUNCTION(com_skip)
  +{
  +	zval *object = getThis();
  +	rpc_internal *intern;
  +	comval *obj;
  +	unsigned long count = 1;
  +
  +	if (object == NULL) {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &object, com_class_entry, &count);
  +	} else {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count);
  +	}
  +
  +	if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +		/* TODO: exception */
  +	}
  +
  +	obj = (comval *) intern->data;
  +
  +	if (C_HASENUM(obj)) {
  +		HRESULT hr;
  +
  +		if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Skip(C_ENUMVARIANT(obj), count))) {
  +			char *error_message = php_COM_error_message(hr);
  +			php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
  +			efree(error_message);
  +			RETURN_FALSE;
  +		}
  +		
  +		RETURN_TRUE;
  +	}
  +
  +	/* @todo exception */
  +	RETURN_FALSE;
  +}
  +
  +/* {{{ proto bool com_isenum(object com_module)
  +   Grabs an IEnumVariant */
  +ZEND_FUNCTION(com_isenum)
  +{
  +	zval *object = getThis();
  +	rpc_internal *intern;
  +
  +	if (object == NULL) {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &object, com_class_entry);
  +	} else {
  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "");
  +	}
  +
  +	if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +		/* TODO: exception */
  +	}
  +
  +	RETURN_BOOL(C_HASENUM((comval *) intern->data));
  +}
  +/* }}} */
  +
  +/* {{{ proto bool com_load_typelib(string typelib_name [, int case_insensitive]) 
  +   Loads a Typelib */
  +PHP_FUNCTION(com_load_typelib)
  +{
  +	char *typelib;
  +	int len, cis = FALSE;
  +	int mode = CONST_CS;
  +	ITypeLib *pTL;
  +
  +	zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &typelib, &len, &cis);
  +
  +	if (cis) {
  +		mode &= ~CONST_CS;
  +	}
  +
  +	pTL = php_COM_find_typelib(typelib, mode);
  +	if (php_COM_load_typelib(pTL, mode) == SUCCESS) {
  +		pTL->lpVtbl->Release(pTL);
  +		RETURN_TRUE;
  +	} else {
  +		RETURN_FALSE;
  +	}
  +}
  +/* }}} */
  +
  +/* {{{ proto bool com_print_typeinfo(mixed comobject | string typelib, string dispinterface, bool wantsink)
  +   Print out a PHP class definition for a dispatchable interface */
  +PHP_FUNCTION(com_print_typeinfo)
  +{
  +	zval *object;
  +	char *ifacename = NULL;
  +	char *typelibname = NULL;
  +	int typeliblen, ifacelen;
  +	zend_bool wantsink = 0;
  +	comval *obj = NULL;
  +	rpc_internal *intern;
  +	ITypeInfo *typeinfo;
  +	
  +	if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s/s!b",
  +											&typelibname, &typeliblen, &ifacename, &ifacelen, &wantsink)) {
  +		if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O/s!b",
  +											 &object, com_class_entry, &ifacename, &ifacelen, &wantsink)) {
  +			RETURN_FALSE;
  +		} else {
  +			if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +				/* TODO: exception */
  +			}
  +
  +			obj = (comval *) intern->data;
  +		}
  +	}
  +
  +	typeinfo = php_COM_locate_typeinfo(typelibname, obj, ifacename, wantsink);
  +	if (typeinfo) {
  +		php_COM_process_typeinfo(typeinfo, NULL, 1, NULL);
  +		typeinfo->lpVtbl->Release(typeinfo);
  +
  +		RETURN_TRUE;
  +	} else {
  +		rpc_error(E_WARNING, "Unable to find typeinfo using the parameters supplied");
  +	}
  +
  +	RETURN_FALSE;
  +}
  +/* }}} */
  +
  +/* {{{ proto bool com_event_sink(mixed comobject, object sinkobject [, mixed sinkinterface])
  +   Connect events from a COM object to a PHP object */
  +PHP_FUNCTION(com_event_sink)
  +{
  +	zval *object, *sinkobject, *sink=NULL;
  +	char *dispname = NULL, *typelibname = NULL;
  +	zend_bool gotguid = 0;
  +	comval *obj;
  +	rpc_internal *intern;
  +	ITypeInfo *typeinfo = NULL;
  +
  +	RETVAL_FALSE;
  +	
  +	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oz|z/", &object, com_class_entry, &sinkobject, &sink)) {
  +		RETURN_FALSE;
  +	}
  +
  +	if (sink && Z_TYPE_P(sink) == IS_ARRAY) {
  +		/* 0 => typelibname, 1 => dispname */
  +		zval **tmp;
  +
  +		if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS)
  +			typelibname = Z_STRVAL_PP(tmp);
  +		if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS)
  +			dispname = Z_STRVAL_PP(tmp);
  +	} else if (sink != NULL) {
  +		convert_to_string_ex(&sink);
  +		dispname = Z_STRVAL_P(sink);
  +	}
  +	
  +	if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +		/* TODO: exception */
  +	}
  +
  +	obj = (comval *) intern->data;
  +
  +	typeinfo = php_COM_locate_typeinfo(typelibname, obj, dispname, 1);
  +
  +	if (typeinfo) {
  +		HashTable *id_to_name;
  +		
  +		ALLOC_HASHTABLE(id_to_name);
  +		
  +		if (php_COM_process_typeinfo(typeinfo, id_to_name, 0, &obj->sinkid)) {
  +
  +			/* Create the COM wrapper for this sink */
  +			obj->sinkdispatch = php_COM_export_as_sink(sinkobject, &obj->sinkid, id_to_name);
  +
  +			/* Now hook it up to the source */
  +			php_COM_enable_events(obj, TRUE);
  +
  +			RETVAL_TRUE;
  +
  +		} else {
  +			FREE_HASHTABLE(id_to_name);
  +		}
  +	}
  +	
  +	if (typeinfo)
  +		typeinfo->lpVtbl->Release(typeinfo);
  +	
  +}
  +/* }}} */
  +
  +
  +
  +/* ini callbacks */
  +
  +static PHP_INI_MH(com_typelib_file_change)
  +{
  +	FILE *typelib_file;
  +	char *typelib_name_buffer;
  +	char *strtok_buf = NULL;
  +	int interactive;
  +	interactive = CG(interactive);
  +
  +	if (!new_value || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) {
  +		return FAILURE;
  +	}
  +
  +	if (interactive) {
  +		printf("Loading type libraries...");
  +		fflush(stdout);
  +	}
  +
  +	typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
  +
  +	while (fgets(typelib_name_buffer, 1024, typelib_file)) {
  +		ITypeLib *pTL;
  +		char *typelib_name;
  +		char *modifier, *ptr;
  +		int mode = CONST_CS | CONST_PERSISTENT;	/* CONST_PERSISTENT is ok here */
  +
  +		if (typelib_name_buffer[0]==';') {
  +			continue;
  +		}
  +		typelib_name = php_strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
  +		if (typelib_name == NULL) {
  +			continue;
  +		}
  +		typelib_name = php_strtok_r(typelib_name, "#", &strtok_buf);
  +		modifier = php_strtok_r(NULL, "#", &strtok_buf);
  +		if (modifier != NULL) {
  +			if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
  +				mode &= ~CONST_CS;
  +			}
  +		}
  +
  +		/* Remove leading/training white spaces on search_string */
  +		while (isspace(*typelib_name)) {/* Ends on '\0' in worst case */
  +			typelib_name ++;
  +		}
  +		ptr = typelib_name + strlen(typelib_name) - 1;
  +		while ((ptr != typelib_name) && isspace(*ptr)) {
  +			*ptr = '\0';
  +			ptr--;
  +		}
  +
  +		if (interactive) {
  +			printf("\rLoading %-60s\r", typelib_name);
  +		}
  +
  +		if ((pTL = php_COM_find_typelib(typelib_name, mode)) != NULL) {
  +			php_COM_load_typelib(pTL, mode);
  +			pTL->lpVtbl->Release(pTL);
  +		}
  +	}
  +
  +	efree(typelib_name_buffer);
  +	fclose(typelib_file);
  +
  +	if (interactive) {
  +		printf("\r%70s\r", "");
  +	}
  +
  +	return SUCCESS;
   }
  
  
  
  1.2.2.1   +29 -0     php4/ext/rpc/com/com.h
  
  Index: com.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/com.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- com.h	29 Apr 2002 02:30:59 -0000	1.2
  +++ com.h	3 Aug 2002 00:44:16 -0000	1.2.2.1
  @@ -1,9 +1,38 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
   #ifndef COM_H
   #define COM_H
   
   #include "../handler.h"
   #include "../php_rpc.h"
   
  +RPC_DECLARE_HANDLER(com);
  +
   ZEND_FUNCTION(com_addref);
  +ZEND_FUNCTION(com_release);
  +ZEND_FUNCTION(com_isenum);
  +ZEND_FUNCTION(com_next);
  +ZEND_FUNCTION(com_all);
  +ZEND_FUNCTION(com_reset);
  +ZEND_FUNCTION(com_skip);
  +ZEND_FUNCTION(com_event_sink);
  +ZEND_FUNCTION(com_message_pump);
  +ZEND_FUNCTION(com_print_typeinfo);
   
   #endif
  
  
  
  1.1.2.2   +400 -1815 php4/ext/rpc/com/Attic/com_wrapper.c
  
  Index: com_wrapper.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/Attic/com_wrapper.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- com_wrapper.c	10 Jul 2002 01:53:51 -0000	1.1.2.1
  +++ com_wrapper.c	3 Aug 2002 00:44:16 -0000	1.1.2.2
  @@ -18,7 +18,7 @@
      |         Wez Furlong <wez****@thebr*****>                           |
      +----------------------------------------------------------------------+
    */
  -/* $Id: com_wrapper.c,v 1.80 2002/05/30 23:17:47 phanto Exp $ */
  +/* $Id: com_wrapper.c,v 1.82 2002/07/19 16:18:59 phanto Exp $ */
   /*
    * This module implements support for COM components that support the IDispatch
    * interface.  Both local (COM) and remote (DCOM) components can be accessed.
  @@ -63,55 +63,20 @@
   #include "php.h"
   #include "php_ini.h"
   
  -#include "php_COM.h"
  -#include "php_VARIANT.h"
  -
  -static ITypeLib *php_COM_find_typelib(char *search_string, int mode TSRMLS_DC);
  -static int do_COM_offget(VARIANT *result, comval *array, pval *property, int cleanup TSRMLS_DC);
  -static int do_COM_propget(VARIANT *var_result, comval *obj, pval *arg_property, int cleanup TSRMLS_DC);
  -static void php_register_COM_class(TSRMLS_D);
  -static void php_COM_init(int module_number TSRMLS_DC);
  -static char *php_string_from_clsid(const CLSID *clsid TSRMLS_DC);
  -static int com_enable_events(comval *obj, int enable);
  -
  -static int le_comval;
  -static int codepage;
  +#include "../rpc.h"
  +#include "../php_rpc.h"
  +#include "../handler.h"
  +
  +#include "com.h"
  +#include "com_wrapper.h"
  +#include "conversion.h"
  +#include "variant.h"
   
   #ifdef _DEBUG
   int resourcecounter = 1;
   #endif
   
  -static unsigned char arg1and2_force_ref[] =
  -                       { 2, BYREF_FORCE, BYREF_FORCE };
  -
  -function_entry COM_functions[] = {
  -	PHP_FE(com_load,                                NULL)
  -	PHP_FE(com_invoke,                              NULL)
  -	PHP_FE(com_addref,                              NULL)
  -	PHP_FE(com_release,                             NULL)
  -	PHP_FE(com_propget,                             NULL)
  -	PHP_FE(com_propput,                             NULL)
  -	PHP_FE(com_load_typelib,                        NULL)
  -	PHP_FE(com_isenum,                              NULL)
  -	PHP_FE(com_event_sink,							arg1and2_force_ref)
  -	PHP_FE(com_message_pump,                        NULL)
  -	PHP_FE(com_print_typeinfo,                      NULL)
  -
  -	PHP_FALIAS(com_get,         com_propget,        NULL)
  -	PHP_FALIAS(com_propset,     com_propput,        NULL)
  -	PHP_FALIAS(com_set,         com_propput,        NULL)
  -
  -	{ NULL, NULL, NULL }
  -};
  -
  -
  -static PHP_MINFO_FUNCTION(COM)
  -{
  -	DISPLAY_INI_ENTRIES();
  -}
  -
  -
  -PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR*  pDispParams, VARIANT FAR*  pVarResult, char **ErrString TSRMLS_DC)
  +ZEND_API HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR*  pDispParams, VARIANT FAR*  pVarResult, char **ErrString)
   {
   	HRESULT hr;
   	int failed = FALSE;
  @@ -120,146 +85,119 @@
   
   	*ErrString = NULL;
   	/* @todo use DispInvoke here ? */
  -	if (C_ISREFD(obj)) {
  -		if (C_HASTLIB(obj)) {
  -			hr = C_TYPEINFO_VT(obj)->Invoke(C_TYPEINFO(obj), C_DISPATCH(obj), dispIdMember, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
  -			if (FAILED(hr)) {
  -				hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
  -				if (SUCCEEDED(hr)) {
  -					/*
  -					 * ITypLib doesn't work
  -					 * Release ITypeLib and fall back to IDispatch
  -					 */
  +	if (C_HASTLIB(obj)) {
  +		hr = C_TYPEINFO_VT(obj)->Invoke(C_TYPEINFO(obj), C_DISPATCH(obj), dispIdMember, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
  +		if (FAILED(hr)) {
  +			hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
  +			if (SUCCEEDED(hr)) {
  +				/*
  +				 * ITypLib doesn't work
  +				 * Release ITypeLib and fall back to IDispatch
  +				 */
   
  -					C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
  -					C_HASTLIB(obj) = FALSE;
  -				}
  +				C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
  +				C_HASTLIB(obj) = FALSE;
   			}
  -		} else {
  -			hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
   		}
  +	} else {
  +		hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, &ExceptInfo, &ArgErr);
  +	}
   
  -		if (FAILED(hr)) {
  -			switch (hr) {
  -				case DISP_E_EXCEPTION: {
  -						
  -						char *src=estrdup("Unavailable");
  -						int srclen=strlen(src);
  -						char *desc=estrdup("Unavailable");
  -						int desclen=strlen(desc);
  -
  -						if (ExceptInfo.bstrSource)
  -						{
  -							efree(src);
  -							src = php_OLECHAR_to_char(ExceptInfo.bstrSource, &srclen, codepage TSRMLS_CC);
  -							SysFreeString(ExceptInfo.bstrSource);
  -						}
  -						if (ExceptInfo.bstrDescription)
  -						{
  -							efree(desc);
  -							desc = php_OLECHAR_to_char(ExceptInfo.bstrDescription, &desclen, codepage TSRMLS_CC);
  -							SysFreeString(ExceptInfo.bstrDescription);
  -						}
  -						
  -						*ErrString = pemalloc(srclen+desclen+50, 1);
  -						sprintf(*ErrString, "<b>Source</b>: %s <b>Description</b>: %s", src, desc);
  +	if (FAILED(hr)) {
  +		switch (hr) {
  +			case DISP_E_EXCEPTION: {
  +					
  +					char *src=estrdup("Unavailable");
  +					int srclen=strlen(src);
  +					char *desc=estrdup("Unavailable");
  +					int desclen=strlen(desc);
  +
  +					if (ExceptInfo.bstrSource)
  +					{
   						efree(src);
  +						src = php_OLECHAR_to_char(ExceptInfo.bstrSource, &srclen, C_CODEPAGE(obj), FALSE);
  +						SysFreeString(ExceptInfo.bstrSource);
  +					}
  +					if (ExceptInfo.bstrDescription)
  +					{
   						efree(desc);
  -						
  -						if (ExceptInfo.bstrHelpFile)
  -						{
  -							SysFreeString(ExceptInfo.bstrHelpFile);
  -						}
  +						desc = php_OLECHAR_to_char(ExceptInfo.bstrDescription, &desclen, C_CODEPAGE(obj), FALSE);
  +						SysFreeString(ExceptInfo.bstrDescription);
   					}
  -					break;
  -				case DISP_E_PARAMNOTFOUND:
  -				case DISP_E_TYPEMISMATCH:
  -					*ErrString = pemalloc(25, 1);
  -					sprintf(*ErrString, "<b>Argument</b>: %d", pDispParams->cArgs-ArgErr+1);
  -					break;
  -			}
  -		}
  -
  -		if (pVarResult && (V_VT(pVarResult) == VT_EMPTY)) {
  -			V_VT(pVarResult) = VT_I4;
  -			V_I4(pVarResult) = hr;
  +					
  +					*ErrString = emalloc(srclen+desclen+50);
  +					zend_sprintf(*ErrString, "<b>Source</b>: %s <b>Description</b>: %s", src, desc);
  +					efree(src);
  +					efree(desc);
  +					
  +					if (ExceptInfo.bstrHelpFile)
  +					{
  +						SysFreeString(ExceptInfo.bstrHelpFile);
  +					}
  +				}
  +				break;
  +			case DISP_E_PARAMNOTFOUND:
  +			case DISP_E_TYPEMISMATCH:
  +				*ErrString = emalloc(25);
  +				sprintf(*ErrString, "<b>Argument</b>: %d", pDispParams->cArgs-ArgErr+1);
  +				break;
   		}
  +	}
   
  -		return hr;
  -	} else {
  -		return DISP_E_UNKNOWNINTERFACE;
  +	if (pVarResult && (V_VT(pVarResult) == VT_EMPTY)) {
  +		V_VT(pVarResult) = VT_I4;
  +		V_I4(pVarResult) = hr;
   	}
  +
  +	return hr;
   }
   
   
  -PHPAPI HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId TSRMLS_DC)
  +ZEND_API HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* rgszNames, DISPID FAR* rgDispId)
   {
   	HRESULT hr;
   
  -	if (C_ISREFD(obj)) {
  -		if (C_HASTLIB(obj)) {
  -			hr = C_TYPEINFO_VT(obj)->GetIDsOfNames(C_TYPEINFO(obj), rgszNames, 1, rgDispId);
  -
  -			if (FAILED(hr)) {
  -				hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
  -
  -				if (SUCCEEDED(hr)) {
  -					/*
  -					 * ITypLib doesn't work
  -					 * Release ITypeLib and fall back to IDispatch
  -					 */
  +	if (C_HASTLIB(obj)) {
  +		hr = C_TYPEINFO_VT(obj)->GetIDsOfNames(C_TYPEINFO(obj), &rgszNames, 1, rgDispId);
   
  -					C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
  -					C_HASTLIB(obj) = FALSE;
  -				}
  +		if (FAILED(hr)) {
  +			hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, &rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
  +
  +			if (SUCCEEDED(hr)) {
  +				/*
  +				 * ITypLib doesn't work
  +				 * Release ITypeLib and fall back to IDispatch
  +				 */
  +
  +				C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
  +				C_HASTLIB(obj) = FALSE;
   			}
  -		} else {
  -			hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
   		}
  -
  -		return hr;
   	} else {
  -		return DISP_E_UNKNOWNINTERFACE;
  +		hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, &rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
   	}
  +
  +	return hr;
   }
   
   
  -PHPAPI HRESULT php_COM_release(comval *obj TSRMLS_DC)
  +ZEND_API HRESULT php_COM_release(comval *obj)
   {
  -	HRESULT hr;
  -
  -	if (obj->refcount > 1) {
  -		C_RELEASE(obj);
  -	} else if (obj->refcount == 1) {
  -		if (C_HASTLIB(obj)) {
  -			C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
  -		}
  -		if (C_HASENUM(obj)) {
  -			hr = C_ENUMVARIANT_VT(obj)->Release(C_ENUMVARIANT(obj));
  -		}
  -		hr = C_DISPATCH_VT(obj)->Release(C_DISPATCH(obj));
  -		C_RELEASE(obj);
  -	}
  -
  -	return obj->refcount;
  +	return C_DISPATCH_VT(obj)->Release(C_DISPATCH(obj));
   }
   
   
  -PHPAPI HRESULT php_COM_addref(comval *obj TSRMLS_DC)
  +ZEND_API HRESULT php_COM_addref(comval *obj)
   {
  -	if (C_ISREFD(obj)) {
  -		C_ADDREF(obj);
  -	}
  -
  -	return obj->refcount;
  +	return C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
   }
   
   
  -PHPAPI HRESULT php_COM_set(comval *obj, IDispatch FAR* FAR* ppDisp, int cleanup TSRMLS_DC)
  +ZEND_API HRESULT php_COM_set(comval *obj, IDispatch FAR* FAR* ppDisp, int cleanup)
   {
   	HRESULT hr = 1;
   	DISPPARAMS dispparams;
  -	VARIANT *var_result;
  +	VARIANT *result;
   	IDispatch FAR* pDisp;
   
   	pDisp = *ppDisp;
  @@ -267,7 +205,6 @@
   		*ppDisp = NULL;
   	}
   
  -	C_REFCOUNT(obj) = 1;
   	C_DISPATCH(obj) = pDisp;
   	C_HASTLIB(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &C_TYPEINFO(obj)));
   	
  @@ -276,22 +213,23 @@
   	dispparams.cArgs = 0;
   	dispparams.cNamedArgs = 0;
   
  -	ALLOC_VARIANT(var_result);
  +	result = (VARIANT *) emalloc(sizeof(VARIANT));
  +	VariantInit(result);
   
   	if (C_HASENUM(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), DISPID_NEWENUM, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
  -															  DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, var_result, NULL, NULL))) {
  -		if (V_VT(var_result) == VT_UNKNOWN) {
  -			V_UNKNOWN(var_result)->lpVtbl->AddRef(V_UNKNOWN(var_result));
  -			C_HASENUM(obj) = SUCCEEDED(V_UNKNOWN(var_result)->lpVtbl->QueryInterface(V_UNKNOWN(var_result), &IID_IEnumVARIANT,
  +															  DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, result, NULL, NULL))) {
  +		if (V_VT(result) == VT_UNKNOWN) {
  +			V_UNKNOWN(result)->lpVtbl->AddRef(V_UNKNOWN(result));
  +			C_HASENUM(obj) = SUCCEEDED(V_UNKNOWN(result)->lpVtbl->QueryInterface(V_UNKNOWN(result), &IID_IEnumVARIANT,
   																					 (void**)&C_ENUMVARIANT(obj)));
  -		} else if (V_VT(var_result) == VT_DISPATCH) {
  -			V_DISPATCH(var_result)->lpVtbl->AddRef(V_DISPATCH(var_result));
  -			C_HASENUM(obj) = SUCCEEDED(V_DISPATCH(var_result)->lpVtbl->QueryInterface(V_DISPATCH(var_result), &IID_IEnumVARIANT,
  +		} else if (V_VT(result) == VT_DISPATCH) {
  +			V_DISPATCH(result)->lpVtbl->AddRef(V_DISPATCH(result));
  +			C_HASENUM(obj) = SUCCEEDED(V_DISPATCH(result)->lpVtbl->QueryInterface(V_DISPATCH(result), &IID_IEnumVARIANT,
   																					  (void**)&C_ENUMVARIANT(obj)));
   		}
   	}
   
  -	FREE_VARIANT(var_result);
  +	efree(result);
   
   	if (!cleanup) {
   		hr = C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
  @@ -305,38 +243,9 @@
   }
   
   
  -PHPAPI HRESULT php_COM_clone(comval *obj, comval *clone, int cleanup TSRMLS_DC)
  -{
  -	HRESULT hr;
  -
  -	C_HASTLIB(obj) = C_HASTLIB(clone);
  -	C_HASENUM(obj) = C_HASENUM(obj);
  -	C_DISPATCH(obj) = C_DISPATCH(clone);
  -	C_TYPEINFO(obj) = C_TYPEINFO(clone);
  -
  -	if (cleanup || !C_ISREFD(obj)) {
  -		obj->refcount = clone->refcount;
  -		clone->refcount = 0;
  -	} else {
  -		if (C_HASTLIB(obj)) {
  -			C_TYPEINFO_VT(obj)->AddRef(C_TYPEINFO(obj));
  -		}
  -		if (C_HASENUM(obj)) {
  -			C_ENUMVARIANT_VT(obj)->AddRef(C_ENUMVARIANT(obj));
  -		}
  -		hr = C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
  -		obj->refcount = 1;
  -	}
  -
  -#ifdef _DEBUG
  -	obj->resourceindex = resourcecounter++;
  -#endif
  -
  -	return hr;
  -}
   
   
  -PHPAPI char *php_COM_error_message(HRESULT hr TSRMLS_DC)
  +ZEND_API char *php_COM_error_message(HRESULT hr)
   {
   	void *pMsgBuf;
   
  @@ -352,790 +261,168 @@
   }
   
   
  -static char *php_string_from_clsid(const CLSID *clsid TSRMLS_DC)
  +ZEND_API char *php_COM_string_from_CLSID(const CLSID *clsid)
   {
   	LPOLESTR ole_clsid;
   	char *clsid_str;
   
   	StringFromCLSID(clsid, &ole_clsid);
  -	clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, codepage TSRMLS_CC);
  -	LocalFree(ole_clsid);
  +	clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, CP_ACP, FALSE);
  +	CoTaskMemFree(ole_clsid);
   
   	return clsid_str;
   }
   
   
  -PHPAPI HRESULT php_COM_destruct(comval *obj TSRMLS_DC)
  +ZEND_API HRESULT php_COM_destruct(comval *obj)
   {
   	HRESULT hr = S_OK;
   
  -	com_enable_events(obj, FALSE);
  +	php_COM_enable_events(obj, FALSE);
   	if (obj->sinkdispatch)
   		obj->sinkdispatch->lpVtbl->Release(obj->sinkdispatch);
   	
  -	if (C_ISREFD(obj)) {
  -		C_REFCOUNT(obj) = 1;
  -		hr = php_COM_release(obj TSRMLS_CC);
  +	if (C_HASTLIB(obj)) {
  +		C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
  +	}
  +	if (C_HASENUM(obj)) {
  +		C_ENUMVARIANT_VT(obj)->Release(C_ENUMVARIANT(obj));
   	}
  +
  +	hr = C_DISPATCH_VT(obj)->Release(C_DISPATCH(obj));
   	efree(obj);
   
   	return hr;
   }
   
   
  -static void php_comval_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
  -{
  -	php_COM_destruct(rsrc->ptr TSRMLS_CC);
  -}
  -
  -
  -static PHP_INI_MH(OnTypelibFileChange)
  -{
  -	FILE *typelib_file;
  -	char *typelib_name_buffer;
  -	char *strtok_buf = NULL;
  -	int interactive;
  -	interactive = CG(interactive);
  -
  -	if (!new_value || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) {
  -		return FAILURE;
  -	}
   
  -	if (interactive) {
  -		printf("Loading type libraries...");
  -		fflush(stdout);
  -	}
   
  -	typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
   
  -	while (fgets(typelib_name_buffer, 1024, typelib_file)) {
  -		ITypeLib *pTL;
  -		char *typelib_name;
  -		char *modifier, *ptr;
  -		int mode = CONST_CS | CONST_PERSISTENT;	/* CONST_PERSISTENT is ok here */
   
  -		if (typelib_name_buffer[0]==';') {
  -			continue;
  -		}
  -		typelib_name = php_strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
  -		if (typelib_name == NULL) {
  -			continue;
  -		}
  -		typelib_name = php_strtok_r(typelib_name, "#", &strtok_buf);
  -		modifier = php_strtok_r(NULL, "#", &strtok_buf);
  -		if (modifier != NULL) {
  -			if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
  -				mode &= ~CONST_CS;
  -			}
  -		}
   
  -		/* Remove leading/training white spaces on search_string */
  -		while (isspace(*typelib_name)) {/* Ends on '\0' in worst case */
  -			typelib_name ++;
  -		}
  -		ptr = typelib_name + strlen(typelib_name) - 1;
  -		while ((ptr != typelib_name) && isspace(*ptr)) {
  -			*ptr = '\0';
  -			ptr--;
  -		}
   
  -		if (interactive) {
  -			printf("\rLoading %-60s\r", typelib_name);
  -		}
  +/* {{{ proto bool com_message_pump([int timeoutms])
  +   Process COM messages, sleeping for up to timeoutms milliseconds */
  +PHP_FUNCTION(com_message_pump)
  +{
  +	long timeoutms = 0;
  +	MSG msg;
  +	DWORD result;
  +	
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timeoutms) == FAILURE)
  +		RETURN_FALSE;
  +	
  +	result = MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutms, QS_ALLINPUT);
   
  -		if ((pTL = php_COM_find_typelib(typelib_name, mode TSRMLS_CC)) != NULL) {
  -			php_COM_load_typelib(pTL, mode TSRMLS_CC);
  -			pTL->lpVtbl->Release(pTL);
  +	if (result == WAIT_OBJECT_0) {
  +		while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
  +			TranslateMessage(&msg);
  +			DispatchMessage(&msg);
   		}
  +		/* we processed messages */
  +		RETVAL_TRUE;
  +	} else {
  +		/* we did not process messages (timed out) */
  +		RETVAL_FALSE;
   	}
  -
  -	efree(typelib_name_buffer);
  -	fclose(typelib_file);
  -
  -	if (interactive) {
  -		printf("\r%70s\r", "");
  -	}
  -
  -	return SUCCESS;
   }
  +/* }}} */
   
  -
  -PHP_INI_BEGIN()
  -PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
  -PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
  -PHP_INI_ENTRY_EX("com.autoregister_verbose", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
  -PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
  -PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange)
  -PHP_INI_END()
  -
  -
  -/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage [, string typelib]]])
  -   Loads a COM module */
  -PHP_FUNCTION(com_load)
  +ZEND_API HRESULT php_COM_enable_events(comval *obj, int enable)
   {
  -	pval *module_name, *code_page, *typelib = NULL, *server_name = NULL, *user_name=NULL, *password=NULL, *domain=NULL;
  -	CLSID clsid;
  -	HRESULT hr;
  -	OLECHAR *ProgID;
  -	comval *obj;
  -	char *error_message;
  -	char *clsid_str;
  -	int mode = 0;
  -	ITypeLib *pTL;
  -	CLSCTX flags = CLSCTX_SERVER;
  -
  -	codepage = CP_ACP;
  -
  -	switch (ZEND_NUM_ARGS()) {
  -		case 1:
  -			zend_get_parameters(ht, 1, &module_name);
  -			break;
  -
  -		case 2:
  -			zend_get_parameters(ht, 2, &module_name, &server_name);
  -			break;
  -
  -		case 3:
  -			zend_get_parameters(ht, 3, &module_name, &server_name, &code_page);
  -
  -			convert_to_long_ex(&code_page);
  -			codepage = Z_LVAL_P(code_page);
  -			break;
  -
  -		case 4:
  -			zend_get_parameters(ht, 4, &module_name, &server_name, &code_page, &typelib);
  -
  -			convert_to_string_ex(&typelib);
  -			convert_to_long_ex(&code_page);
  -			codepage = Z_LVAL_P(code_page);
  -
  -			break;
  -
  -		default:
  -			ZEND_WRONG_PARAM_COUNT();
  -	}
  -
  -	if (server_name != NULL) {
  -		/* What is server name? A String or an array? */
  -
  -		if (Z_TYPE_P(server_name) == IS_NULL) {
  -			server_name = NULL;
  -		} else if (Z_TYPE_P(server_name) == IS_ARRAY) {
  -			pval **tmp;
  -			/* DAB: 22 Sept 2001
  -			 * Aha - we have a number of possible arguments.
  -			 * They are in the hash By name: Server, Domain, Username, Password
  -			 * Flags.
  -			 * This has been crafted to maintian maximum backward compatability.
  -			 * If the server name is specified as a string, then the function
  -			 * should behave as before by defaulting username and password and
  -			 * using the (I believe) incorrect CLSCTX_SERVER instantiation
  -			 * paramter. However if server is specified in this array then we
  -			 * use either CLSCTX_REMOTE_SERVER or whatever flags are specified
  -			 * in the array */
  -			HashTable *ht = Z_ARRVAL(*server_name);
  -			if (FAILURE == zend_hash_find(ht, "Server", 7, (void **) &tmp)) {
  -				server_name = NULL;
  -			} else {
  -				server_name = *tmp;
  -				convert_to_string_ex(&server_name);
  -				/* CLSCTX_SERVER includes INPROC and LOCAL SERVER. This means
  -				 * that any local server will be instantiated BEFORE even
  -				 * looking on a remote server. Thus if we have a server name,
  -				 * probably we want to access a remote machine or we would not
  -				 * have bothered specifying it. So it would be wrong to to
  -				 * connect locally. Futher, unless the name passed is a GUID,
  -				 * there has to be something to map the Prog.Id to GUID and
  -				 * unless that has been modified to remove the information
  -				 * about local instantiation CLSCTX_SERVER would force a local
  -				 * instantiation This setting can be overridden below if the
  -				 * user specifies a flags element */
  -				flags = CLSCTX_REMOTE_SERVER;
  -			}
  -			if (FAILURE == zend_hash_find(ht, "Username", 9, (void **) &tmp)) {
  -				user_name = NULL;
  -			} else {
  -				user_name = *tmp;
  -				convert_to_string_ex(&user_name);
  -			}
  -			if (FAILURE == zend_hash_find(ht, "Domain", 7, (void **) &tmp)) {
  -				domain = NULL;
  -			} else {
  -				domain = *tmp;
  -				convert_to_string_ex(&domain);
  -			}
  -			if (FAILURE == zend_hash_find(ht, "Password", 9, (void **) &tmp)) {
  -				password=NULL;
  -			} else {
  -				password = *tmp;
  -				convert_to_string_ex(&password);
  -			}
  -			if (SUCCESS == zend_hash_find(ht, "Flags", 6, (void **) &tmp)) {
  -				convert_to_long_ex(tmp);
  -				flags = (CLSCTX) Z_LVAL_PP(tmp);
  -			}
  -		} else {
  -			if (!INI_INT("com.allow_dcom")) {
  -				php_error(E_WARNING, "DCOM is disabled");
  -				RETURN_NULL();
  -			} else {
  -				flags = CLSCTX_REMOTE_SERVER;
  -				convert_to_string_ex(&server_name);
  -			}
  -		}
  -	}
  -
  -	ALLOC_COM(obj);
  -	convert_to_string_ex(&module_name);
  -	ProgID = php_char_to_OLECHAR(Z_STRVAL_P(module_name), Z_STRLEN_P(module_name), codepage TSRMLS_CC);
  -
  -	/* obtain CLSID */
  -	if (FAILED(CLSIDFromString(ProgID, &clsid))) {
  -		/* Perhaps this is a Moniker? */
  -		IBindCtx *pBindCtx;
  -		IMoniker *pMoniker;
  -		ULONG ulEaten;
  -
  -		/* @todo if (server_name) */
  -
  -		if (!server_name) {
  -			/* @todo shouldn't the bind context be fetched on module startup and kept as a global shared instance ?
  -			 * all calls to BindToObject would deliver the same instance then (as desired)
  -			 * IBindCtx::RegisterObjectBound() should be called then after  mkparsedisplayname()
  -			 *
  -			 * @todo use mkparsedisplaynameex() ?
  -			 */ 
  -			if (SUCCEEDED(hr = CreateBindCtx(0, &pBindCtx))) {
  -				if (SUCCEEDED(hr = MkParseDisplayName(pBindCtx, ProgID, &ulEaten, &pMoniker))) {
  -					hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
  -					pMoniker->lpVtbl->Release(pMoniker);
  -				}
  -				pBindCtx->lpVtbl->Release(pBindCtx);
  -			}
  -		} else {
  -			hr = MK_E_SYNTAX;
  -		}
  -
  -		efree(ProgID);
  -
  -		if (FAILED(hr)) {
  -			php_COM_destruct(obj TSRMLS_CC);
  -			error_message = php_COM_error_message(hr TSRMLS_CC);  
  -			php_error(E_WARNING,"Invalid ProgID, GUID string, or Moniker: %s", error_message);
  -			LocalFree(error_message);
  -			RETURN_NULL();
  -		}
  -	} else {
  -		efree(ProgID);
  -		/* obtain IDispatch */
  -		if (!server_name) {
  -			hr = CoCreateInstance(&clsid, NULL, flags, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
  -		} else {
  -			COSERVERINFO server_info;
  -			MULTI_QI pResults;
  -			COAUTHIDENTITY authid;
  -			COAUTHINFO authinfo = {RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, &authid, EOAC_NONE};
  -
  -			server_info.dwReserved1=0;
  -			server_info.dwReserved2=0;
  -			server_info.pwszName = php_char_to_OLECHAR(Z_STRVAL_P(server_name), Z_STRLEN_P(server_name), codepage TSRMLS_CC);
  -			if (user_name) {
  -				/* Z_STRVAL_P(user_name); */
  -				/* Parse Username into domain\username */
  -				authid.User = (WCHAR *) Z_STRVAL_P(user_name);
  -				authid.UserLength = Z_STRLEN_P(user_name);
  -				if (password) {
  -					authid.Password = (USHORT *) Z_STRVAL_P(password);
  -					authid.PasswordLength = Z_STRLEN_P(password);
  -				} else {
  -					authid.Password = (USHORT *) "";
  -					authid.PasswordLength = 0;
  -				}
  -				if (domain) {
  -					authid.Domain = (USHORT *) Z_STRVAL_P(domain);
  -					authid.DomainLength = Z_STRLEN_P(domain);
  +	if (obj->sinkdispatch) {
  +		IConnectionPointContainer *cont;
  +		IConnectionPoint *point;
  +		
  +		if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IConnectionPointContainer, (void**)&cont))) {
  +			if (SUCCEEDED(cont->lpVtbl->FindConnectionPoint(cont, &obj->sinkid, &point))) {
  +				if (enable) {
  +					point->lpVtbl->Advise(point, (IUnknown*)obj->sinkdispatch, &obj->sinkcookie);
   				} else {
  -					authid.Domain = (USHORT *) "";
  -					authid.DomainLength = 0;
  +					point->lpVtbl->Unadvise(point, obj->sinkcookie);
   				}
  -				authid.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
  -
  -				server_info.pAuthInfo=&authinfo;
  -			} else {
  -				server_info.pAuthInfo=NULL;
  -			}
  -
  -			pResults.pIID = &IID_IDispatch;
  -			pResults.pItf = NULL;
  -			pResults.hr = S_OK;
  -			hr=CoCreateInstanceEx(&clsid, NULL, flags, &server_info, 1, &pResults);
  -			if (SUCCEEDED(hr)) {
  -				hr = pResults.hr;
  -				C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
  +				point->lpVtbl->Release(point);
   			}
  -			efree(server_info.pwszName);
  -		}
  -
  -		if (FAILED(hr)) {
  -			error_message = php_COM_error_message(hr TSRMLS_CC);
  -			clsid_str = php_string_from_clsid(&clsid TSRMLS_CC);
  -			php_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s",clsid_str,error_message);
  -			LocalFree(error_message);
  -			efree(clsid_str);
  -			php_COM_destruct(obj TSRMLS_CC);
  -			RETURN_NULL();
  +			cont->lpVtbl->Release(cont);
   		}
   	}
   
  -	php_COM_set(obj, &C_DISPATCH(obj), TRUE TSRMLS_CC);
  -
  -	if (INI_INT("com.autoregister_casesensitive")) {
  -		mode |= CONST_CS;
  -	}
  -
  -	if (C_HASTLIB(obj)) {
  -		if (INI_INT("com.autoregister_typelib")) {
  -			unsigned int idx;
  +	return S_OK;
  +}
   
  -			/* @todo check if typlib isn't already loaded */
  -			if (C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &pTL, &idx) == S_OK) {
  -				php_COM_load_typelib(pTL, mode TSRMLS_CC);
  -				pTL->lpVtbl->Release(pTL);
  -			}
  -		}
  -	} else {
  -		if (typelib != NULL) {
  -			ITypeLib *pTL;
  +static const struct {
  +	VARTYPE vt;
  +	const char *name;
  +} vt_names[] = {
  +	{ VT_NULL,		"VT_NULL" },
  +	{ VT_EMPTY,		"VT_EMPTY" },
  +	{ VT_UI1,		"VT_UI1" },
  +	{ VT_I2,		"VT_I2" },
  +	{ VT_I4,		"VT_I4" },
  +	{ VT_R4,		"VT_R4" },
  +	{ VT_R8,		"VT_R8" },
  +	{ VT_BOOL,		"VT_BOOL" },
  +	{ VT_ERROR,		"VT_ERROR" },
  +	{ VT_CY,		"VT_CY" },
  +	{ VT_DATE,		"VT_DATE" },
  +	{ VT_BSTR,		"VT_BSTR" },
  +	{ VT_DECIMAL,	"VT_DECIMAL" },
  +	{ VT_UNKNOWN,	"VT_UNKNOWN" },
  +	{ VT_DISPATCH,	"VT_DISPATCH" },
  +	{ VT_VARIANT,	"VT_VARIANT" },
  +	{ VT_I1,		"VT_I1" },
  +	{ VT_UI2,		"VT_UI2" },
  +	{ VT_UI4,		"VT_UI4" },
  +	{ VT_INT,		"VT_INT" },
  +	{ VT_UINT,		"VT_UINT" },
  +	{ VT_ARRAY,		"VT_ARRAY" },
  +	{ VT_BYREF,		"VT_BYREF" },
  +	{ VT_VOID,		"VT_VOID" },
  +	{ VT_PTR,		"VT_PTR" },
  +	{ VT_HRESULT,	"VT_HRESULT" },
  +	{ 0, NULL }
  +};
   
  -			if ((pTL = php_COM_find_typelib(Z_STRVAL_P(typelib), mode TSRMLS_CC)) != NULL) {
  -				C_HASTLIB(obj) = SUCCEEDED(pTL->lpVtbl->GetTypeInfo(pTL, 0, &C_TYPEINFO(obj)));
  -				/* idx 0 should deliver the ITypeInfo for the IDispatch Interface */
  -				if (INI_INT("com.autoregister_typelib")) {
  -					php_COM_load_typelib(pTL, mode TSRMLS_CC);
  -				}
  -				pTL->lpVtbl->Release(pTL);
  -			}
  -		}
  +static inline const char *vt_to_string(VARTYPE vt)
  +{
  +	int i;
  +	for (i = 0; vt_names[i].name != NULL; i++) {
  +		if (vt_names[i].vt == vt)
  +			return vt_names[i].name;
   	}
  -
  -	RETURN_RESOURCE(zend_list_insert(obj, IS_COM));
  +	return "?";
   }
  -/* }}} */
  -
   
  -int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **arguments, int arg_count TSRMLS_DC)
  +ZEND_API int php_COM_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid)
   {
  -	DISPID dispid;
  -	DISPPARAMS dispparams;
  -	HRESULT hr;
  -	OLECHAR *funcname;
  -	SAFEARRAY *pSA;
  -	SAFEARRAYBOUND rgsabound[1];
  -	VARIANT *variant_args;
  -	char *error_message;
  -	int current_arg, current_variant;
  -	unsigned long count;
  -
  -	if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "next")) {
  -		/* Grab one argument off the stack, allocate enough
  -		 * VARIANTs
  -		 * Get the IEnumVariant interface and call ->Next();
  -		 */
  -
  -		switch (arg_count) {
  -			case 0:
  -				count = 1;
  -				break;
  +	TYPEATTR *attr;
  +	FUNCDESC *func;
  +	int i;
  +	OLECHAR *olename;
  +	char *ansiname = NULL;
  +	unsigned int ansinamelen;
  +	int ret = 0;
   
  -			case 1:
  -				convert_to_long_ex(&arguments[0]);
  -				count = Z_LVAL_P(arguments[0]);
  -				break;
  +	if (FAILED(typeinfo->lpVtbl->GetTypeAttr(typeinfo, &attr)))
  +		return 0;
   
  -			default:
  -				php_error(E_WARNING,"Wrong argument count to IEnumVariant::Next()");
  +	/* verify that it is suitable */
  +	if (id_to_name == NULL || attr->typekind == TKIND_DISPATCH) {
   
  -				return FAILURE;
  -		}
  +		if (guid)
  +			memcpy(guid, &attr->guid, sizeof(GUID));
  +		
  +		if (printdef) {
  +			char *guidstring;
   
  -		rgsabound[0].lLbound = 0;
  -		rgsabound[0].cElements = count;
  +			typeinfo->lpVtbl->GetDocumentation(typeinfo, MEMBERID_NIL, &olename, NULL, NULL, NULL);
  +			ansiname = php_OLECHAR_to_char(olename, &ansinamelen, CP_ACP, FALSE);
  +			SysFreeString(olename);
   
  -		if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
  -			VariantInit(var_result);
  -			return FAILURE;
  -		} else {
  -			V_ARRAY(var_result) = pSA;
  -			V_VT(var_result) = VT_VARIANT|VT_ARRAY;
  -		}
  -
  -		if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Next(C_ENUMVARIANT(obj), count, pSA->pvData, &count))) {
  -			char *error_message = php_COM_error_message(hr TSRMLS_CC);
  -			php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
  -			efree(error_message);
  -			VariantClear(var_result);
  -			return FAILURE;
  -		}
  -
  -		if (count != rgsabound[0].cElements) {
  -			rgsabound[0].cElements = count;
  -			if (FAILED(SafeArrayRedim(pSA, rgsabound))) {
  -				char *error_message = php_COM_error_message(hr TSRMLS_CC);
  -				php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
  -				efree(error_message);
  -				VariantClear(var_result);
  -				return FAILURE;
  -			}
  -		}
  -
  -		/* return a single element if next() was called without count */
  -		if ((arg_count == 0) && (count == 1)) {
  -			long index[] = {0};
  -
  -			SafeArrayGetElement(pSA, index, var_result);
  -			SafeArrayDestroy(pSA);
  -		}
  -
  -		return SUCCESS;
  -	} else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "all")) {
  -#define FETCH_BLOCKSIZE 10 /* fetch blocks of 10 elements */
  -
  -		count = FETCH_BLOCKSIZE;
  -
  -		rgsabound[0].lLbound = 0;
  -		rgsabound[0].cElements = count;
  -
  -		if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
  -			VariantInit(var_result);
  -			return FAILURE;
  -		} else {
  -			V_ARRAY(var_result) = pSA;
  -			V_VT(var_result) = VT_VARIANT|VT_ARRAY;
  -		}
  -
  -		/* blah*/
  -
  -
  -	} else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset")) {
  -		if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj)))) {
  -			char *error_message = php_COM_error_message(hr TSRMLS_CC);
  -			php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
  -			efree(error_message);
  -			return FAILURE;
  -		}
  -		return SUCCESS;
  -	} else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "skip")) {
  -		unsigned long count;
  -
  -		switch (arg_count) {
  -			case 0:
  -				count = 1;
  -				break;
  -
  -			case 1:
  -				convert_to_long_ex(&arguments[0]);
  -				count = Z_LVAL_P(arguments[0]);
  -				break;
  -
  -			default:
  -				php_error(E_WARNING,"Wrong argument count to IEnumVariant::Skip()");
  -				return FAILURE;
  -		}
  -		if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Skip(C_ENUMVARIANT(obj), count))) {
  -			char *error_message = php_COM_error_message(hr TSRMLS_CC);
  -			php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
  -			efree(error_message);
  -			return FAILURE;
  -		}
  -		return SUCCESS;
  -
  -	} else {
  -		char *ErrString;
  -
  -		funcname = php_char_to_OLECHAR(Z_STRVAL_P(function_name), Z_STRLEN_P(function_name), codepage TSRMLS_CC);
  -
  -		hr = php_COM_get_ids_of_names(obj, &funcname, &dispid TSRMLS_CC);
  -
  -		if (FAILED(hr)) {
  -			error_message = php_COM_error_message(hr TSRMLS_CC);
  -			php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(function_name), error_message);
  -			LocalFree(error_message);
  -			efree(funcname);
  -			return FAILURE;
  -		}
  -
  -		variant_args = (VARIANT *) emalloc(sizeof(VARIANT) * arg_count);
  -
  -		for (current_arg=0; current_arg<arg_count; current_arg++) {
  -			current_variant = arg_count - current_arg - 1;
  -			php_pval_to_variant(arguments[current_arg], &variant_args[current_variant], codepage TSRMLS_CC);
  -		}
  -
  -		dispparams.rgvarg = variant_args;
  -		dispparams.rgdispidNamedArgs = NULL;
  -		dispparams.cArgs = arg_count;
  -		dispparams.cNamedArgs = 0;
  -
  -		hr = php_COM_invoke(obj, dispid, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, var_result, &ErrString TSRMLS_CC);
  -
  -		efree(funcname);
  -		for (current_arg=0;current_arg<arg_count;current_arg++) {
  -			/* don't release IDispatch pointers as they are used afterwards */
  -			if (V_VT(&variant_args[current_arg]) != VT_DISPATCH) {
  -				/* @todo review this: what happens to an array of IDispatchs or a VARIANT->IDispatch */
  -				VariantClear(&variant_args[current_arg]);
  -			}
  -		}
  -		efree(variant_args);
  -
  -		if (FAILED(hr)) {
  -			error_message = php_COM_error_message(hr TSRMLS_CC);
  -			if (ErrString) {
  -				php_error(E_WARNING,"Invoke() failed: %s %s", error_message, ErrString);
  -				pefree(ErrString, 1);
  -			} else {
  -				php_error(E_WARNING,"Invoke() failed: %s", error_message);
  -			}
  -			LocalFree(error_message);
  -			return FAILURE;
  -		}
  -	}
  -	return SUCCESS;
  -}
  -
  -
  -/* {{{ proto mixed com_invoke(int module, string handler_name [, mixed arg [, mixed ...]])
  -   Invokes a COM module */
  -PHP_FUNCTION(com_invoke)
  -{
  -	pval **arguments;
  -	pval *object, *function_name;
  -	comval *obj;
  -	int type;
  -	int arg_count = ZEND_NUM_ARGS();
  -	VARIANT *var_result;
  -
  -	if (arg_count<2) {
  -		ZEND_WRONG_PARAM_COUNT();
  -	}
  -	arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
  -	if (zend_get_parameters_array(ht, arg_count, arguments) == FAILURE) {
  -		RETURN_NULL();
  -	}
  -
  -	object = arguments[0];
  -	function_name = arguments[1];
  -
  -	/* obtain IDispatch interface */
  -	convert_to_long(object);
  -	obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
  -	if (!obj || (type != IS_COM)) {
  -		php_error(E_WARNING,"%d is not a COM object handler", Z_STRVAL_P(function_name));
  -		RETURN_NULL();
  -	}
  -
  -	/* obtain property/method handler */
  -	convert_to_string_ex(&function_name);
  -
  -	ALLOC_VARIANT(var_result);
  -
  -	if (do_COM_invoke(obj, function_name, var_result, arguments+2, arg_count-2 TSRMLS_CC)==FAILURE) {
  -		FREE_VARIANT(var_result);
  -		efree(arguments);
  -
  -		RETURN_NULL();
  -	}
  -
  -	RETVAL_VARIANT(var_result);
  -
  -	efree(arguments);
  -}
  -/* }}} */
  -
  -
  -/* {{{ proto mixed com_release(int module)
  -   Releases a COM object */
  -PHP_FUNCTION(com_release)
  -{
  -	pval *object;
  -	comval *obj;
  -	int type;
  -	int arg_count = ZEND_NUM_ARGS();
  -
  -	if (arg_count != 1) {
  -		ZEND_WRONG_PARAM_COUNT();
  -	}
  -
  -	if (zend_get_parameters(ht, 1, &object)==FAILURE) {
  -		RETURN_FALSE;
  -	}
  -
  -	/* obtain IDispatch interface */
  -	convert_to_long_ex(&object);
  -	obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
  -	if (!obj || (type != IS_COM)) {
  -		php_error(E_WARNING,"%d is not a COM object handler");
  -		RETURN_FALSE;
  -	}
  -
  -	RETURN_LONG(php_COM_release(obj TSRMLS_CC))
  -}
  -/* }}} */
  -
  -
  -/* {{{ proto mixed com_addref(int module)
  -   Increases the reference counter on a COM object */
  -PHP_FUNCTION(com_addref)
  -{
  -	pval *object;
  -	comval *obj;
  -	int type;
  -	int arg_count = ZEND_NUM_ARGS();
  -
  -	if (arg_count != 1) {
  -		ZEND_WRONG_PARAM_COUNT();
  -	}
  -
  -	if (zend_get_parameters(ht, 1, &object)==FAILURE) {
  -		RETURN_FALSE;
  -	}
  -
  -	/* obtain IDispatch interface */
  -	convert_to_long_ex(&object);
  -	obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
  -	if (!obj || (type != IS_COM))
  -	{
  -		php_error(E_WARNING,"%d is not a COM object handler");
  -		RETURN_FALSE;
  -	}
  -
  -	RETURN_LONG(php_COM_addref(obj TSRMLS_CC));
  -}
  -/* }}} */
  -
  -/* {{{ proto bool com_message_pump([int timeoutms])
  -   Process COM messages, sleeping for up to timeoutms milliseconds */
  -PHP_FUNCTION(com_message_pump)
  -{
  -	long timeoutms = 0;
  -	MSG msg;
  -	DWORD result;
  -	
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timeoutms) == FAILURE)
  -		RETURN_FALSE;
  -	
  -	result = MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutms, QS_ALLINPUT);
  -
  -	if (result == WAIT_OBJECT_0) {
  -		while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
  -			TranslateMessage(&msg);
  -			DispatchMessage(&msg);
  -		}
  -		/* we processed messages */
  -		RETVAL_TRUE;
  -	} else {
  -		/* we did not process messages (timed out) */
  -		RETVAL_FALSE;
  -	}
  -}
  -/* }}} */
  -
  -
  -static int com_enable_events(comval *obj, int enable)
  -{
  -	if (obj->sinkdispatch) {
  -		IConnectionPointContainer *cont;
  -		IConnectionPoint *point;
  -		
  -		if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IConnectionPointContainer, (void**)&cont))) {
  -			
  -			if (SUCCEEDED(cont->lpVtbl->FindConnectionPoint(cont, &obj->sinkid, &point))) {
  -
  -				if (enable) {
  -					point->lpVtbl->Advise(point, (IUnknown*)obj->sinkdispatch, &obj->sinkcookie);
  -				} else {
  -					point->lpVtbl->Unadvise(point, obj->sinkcookie);
  -				}
  -				point->lpVtbl->Release(point);
  -			}
  -			cont->lpVtbl->Release(cont);
  -		}
  -	}
  -	return 0;
  -}
  -
  -static const struct {
  -	VARTYPE vt;
  -	const char *name;
  -} vt_names[] = {
  -	{ VT_NULL,		"VT_NULL" },
  -	{ VT_EMPTY,		"VT_EMPTY" },
  -	{ VT_UI1,		"VT_UI1" },
  -	{ VT_I2,		"VT_I2" },
  -	{ VT_I4,		"VT_I4" },
  -	{ VT_R4,		"VT_R4" },
  -	{ VT_R8,		"VT_R8" },
  -	{ VT_BOOL,		"VT_BOOL" },
  -	{ VT_ERROR,		"VT_ERROR" },
  -	{ VT_CY,		"VT_CY" },
  -	{ VT_DATE,		"VT_DATE" },
  -	{ VT_BSTR,		"VT_BSTR" },
  -	{ VT_DECIMAL,	"VT_DECIMAL" },
  -	{ VT_UNKNOWN,	"VT_UNKNOWN" },
  -	{ VT_DISPATCH,	"VT_DISPATCH" },
  -	{ VT_VARIANT,	"VT_VARIANT" },
  -	{ VT_I1,		"VT_I1" },
  -	{ VT_UI2,		"VT_UI2" },
  -	{ VT_UI4,		"VT_UI4" },
  -	{ VT_INT,		"VT_INT" },
  -	{ VT_UINT,		"VT_UINT" },
  -	{ VT_ARRAY,		"VT_ARRAY" },
  -	{ VT_BYREF,		"VT_BYREF" },
  -	{ VT_VOID,		"VT_VOID" },
  -	{ VT_PTR,		"VT_PTR" },
  -	{ VT_HRESULT,	"VT_HRESULT" },
  -	{ 0, NULL }
  -};
  -
  -static inline const char *vt_to_string(VARTYPE vt)
  -{
  -	int i;
  -	for (i = 0; vt_names[i].name != NULL; i++) {
  -		if (vt_names[i].vt == vt)
  -			return vt_names[i].name;
  -	}
  -	return "?";
  -}
  -
  -static int process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid TSRMLS_DC)
  -{
  -	TYPEATTR *attr;
  -	FUNCDESC *func;
  -	int i;
  -	OLECHAR *olename;
  -	char *ansiname = NULL;
  -	unsigned int ansinamelen;
  -	int ret = 0;
  -
  -	if (FAILED(typeinfo->lpVtbl->GetTypeAttr(typeinfo, &attr)))
  -		return 0;
  -
  -	/* verify that it is suitable */
  -	if (id_to_name == NULL || attr->typekind == TKIND_DISPATCH) {
  -
  -		if (guid)
  -			memcpy(guid, &attr->guid, sizeof(GUID));
  -		
  -		if (printdef) {
  -			char *guidstring;
  -
  -			typeinfo->lpVtbl->GetDocumentation(typeinfo, MEMBERID_NIL, &olename, NULL, NULL, NULL);
  -			ansiname = php_OLECHAR_to_char(olename, &ansinamelen, codepage TSRMLS_CC);
  -			SysFreeString(olename);
  -
  -			guidstring = php_string_from_clsid(&attr->guid TSRMLS_CC);
  -			php_printf("class %s { /* GUID=%s */\n", ansiname, guidstring);
  -			efree(guidstring);
  +			guidstring = php_COM_string_from_CLSID(&attr->guid);
  +			php_printf("class %s { /* GUID=%s */\n", ansiname, guidstring);
  +			efree(guidstring);
   
   			efree(ansiname);
   		}
  @@ -1149,846 +436,223 @@
   			DISPID lastid = 0;	/* for props */
   			int isprop;
   
  -			if (FAILED(typeinfo->lpVtbl->GetFuncDesc(typeinfo, i, &func)))
  -				break;
  -
  -			isprop = (func->invkind & DISPATCH_PROPERTYGET || func->invkind & DISPATCH_PROPERTYPUT);
  -
  -			if (!isprop || lastid != func->memid) {
  -
  -				lastid = func->memid;
  -				
  -				typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, &olename, NULL, NULL, NULL);
  -				ansiname = php_OLECHAR_to_char(olename, &ansinamelen, codepage TSRMLS_CC);
  -				SysFreeString(olename);
  -
  -				if (printdef) {
  -					int j;
  -					char *funcdesc;
  -					unsigned int funcdesclen, cnames = 0;
  -					BSTR *names;
  -
  -					names = (BSTR*)emalloc((func->cParams + 1) * sizeof(BSTR));
  -
  -					typeinfo->lpVtbl->GetNames(typeinfo, func->memid, names, func->cParams + 1, &cnames);
  -					/* first element is the function name */
  -					SysFreeString(names[0]);
  -
  -					php_printf("\t/* DISPID=%d */\n", func->memid);
  -
  -					if (func->elemdescFunc.tdesc.vt != VT_VOID) {
  -						php_printf("\t/* %s [%d] */\n",
  -								vt_to_string(func->elemdescFunc.tdesc.vt),
  -								func->elemdescFunc.tdesc.vt
  -								);
  -					}
  -
  -					if (isprop) {
  -
  -						typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, NULL, &olename, NULL, NULL);
  -						if (olename) {
  -							funcdesc = php_OLECHAR_to_char(olename, &funcdesclen, codepage TSRMLS_CC);
  -							SysFreeString(olename);
  -							php_printf("\t/* %s */\n", funcdesc);
  -							efree(funcdesc);
  -						}
  -
  -						php_printf("\tvar $%s;\n\n", ansiname);
  -
  -					} else {
  -						/* a function */
  -
  -						php_printf("\tfunction %s(\n", ansiname);
  -
  -						for (j = 0; j < func->cParams; j++) {
  -							ELEMDESC *elem = &func->lprgelemdescParam[j];
  -
  -							php_printf("\t\t/* %s [%d] ", vt_to_string(elem->tdesc.vt), elem->tdesc.vt);
  -
  -							if (elem->paramdesc.wParamFlags & PARAMFLAG_FIN)
  -								php_printf("[in]");
  -							if (elem->paramdesc.wParamFlags & PARAMFLAG_FOUT)
  -								php_printf("[out]");
  -
  -							if (elem->tdesc.vt == VT_PTR) {
  -								/* what does it point to ? */
  -								php_printf(" --> %s [%d] ",
  -										vt_to_string(elem->tdesc.lptdesc->vt),
  -										elem->tdesc.lptdesc->vt
  -										);
  -							}
  -
  -							/* when we handle prop put and get, this will look nicer */
  -							if (j+1 < (int)cnames) {
  -								funcdesc = php_OLECHAR_to_char(names[j+1], &funcdesclen, codepage TSRMLS_CC);
  -								SysFreeString(names[j+1]);
  -							} else {
  -								funcdesc = "???";
  -							}
  -
  -							php_printf(" */ %s%s%c\n",
  -									elem->tdesc.vt == VT_PTR ? "&$" : "$",
  -									funcdesc,
  -									j == func->cParams - 1 ? ' ' : ','
  -									);
  -
  -							if (j+1 < (int)cnames)
  -								efree(funcdesc);
  -						}
  -
  -						php_printf("\t\t)\n\t{\n");
  -
  -						typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, NULL, &olename, NULL, NULL);
  -						if (olename) {
  -							funcdesc = php_OLECHAR_to_char(olename, &funcdesclen, codepage TSRMLS_CC);
  -							SysFreeString(olename);
  -							php_printf("\t\t/* %s */\n", funcdesc);
  -							efree(funcdesc);
  -						}
  -
  -						php_printf("\t}\n");
  -					}
  -
  -					efree(names);
  -				}
  -
  -				if (id_to_name) {
  -					zend_str_tolower(ansiname, ansinamelen);
  -					MAKE_STD_ZVAL(tmp);
  -					ZVAL_STRINGL(tmp, ansiname, ansinamelen, 0);
  -					zend_hash_index_update(id_to_name, func->memid, (void*)&tmp, sizeof(zval *), NULL);
  -				}
  -			}
  -			typeinfo->lpVtbl->ReleaseFuncDesc(typeinfo, func);
  -
  -		}
  -
  -		if (printdef)
  -			php_printf("}\n");
  -
  -		ret = 1;
  -	} else {
  -		zend_error(E_WARNING, "Thats not a dispatchable interface!! type kind = %08x\n", attr->typekind);
  -	}
  -
  -	typeinfo->lpVtbl->ReleaseTypeAttr(typeinfo, attr);
  -
  -	return ret;
  -}
  -
  -static ITypeInfo *locate_typeinfo(char *typelibname, comval *obj, char *dispname, int sink TSRMLS_DC)
  -{
  -	ITypeInfo *typeinfo = NULL;
  -	ITypeLib *typelib = NULL;
  -	int gotguid = 0;
  -	GUID iid;
  -
  -	if (obj) {
  -		if (dispname == NULL && sink) {
  -			IProvideClassInfo2 *pci2;
  -			IProvideClassInfo *pci;
  -
  -			if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo2, (void**)&pci2))) {
  -				gotguid = SUCCEEDED(pci2->lpVtbl->GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
  -				pci2->lpVtbl->Release(pci2);
  -			}
  -			if (!gotguid && SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo, (void**)&pci))) {
  -				/* examine the available interfaces */
  -				/* TODO: write some code here */
  -				pci->lpVtbl->Release(pci);
  -			}
  -		} else if (dispname && C_HASTLIB(obj)) {
  -			unsigned int idx;
  -			/* get the library from the object; the rest will be dealt with later */
  -			C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &typelib, &idx);	
  -		} else if (typelibname == NULL) {
  -			C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &typeinfo);
  -		}
  -	} else if (typelibname) {
  -		/* Fetch the typelibrary and use that to look things up */
  -		typelib = php_COM_find_typelib(typelibname, CONST_CS TSRMLS_CC);
  -	} 
  -
  -	if (!gotguid && dispname && typelib) {
  -		unsigned short cfound;
  -		MEMBERID memid;
  -		OLECHAR *olename = php_char_to_OLECHAR(dispname, strlen(dispname), CP_ACP TSRMLS_CC);
  -		
  -		cfound = 1;
  -		if (FAILED(typelib->lpVtbl->FindName(typelib, olename, 0, &typeinfo, &memid, &cfound)) || cfound == 0) {
  -			CLSID coclass;
  -			ITypeInfo *coinfo;
  -			
  -			/* assume that it might be a progid instead */
  -			if (SUCCEEDED(CLSIDFromProgID(olename, &coclass)) &&
  -					SUCCEEDED(typelib->lpVtbl->GetTypeInfoOfGuid(typelib, &coclass, &coinfo))) {
  -
  -				/* enumerate implemented interfaces and pick the one as indicated by sink */
  -				TYPEATTR *attr;
  -				int i;
  -
  -				coinfo->lpVtbl->GetTypeAttr(coinfo, &attr);
  -
  -				for (i = 0; i < attr->cImplTypes; i++) {
  -					HREFTYPE rt;
  -					int tf;
  -
  -					if (FAILED(coinfo->lpVtbl->GetImplTypeFlags(coinfo, i, &tf)))
  -						continue;
  -
  -					if ((sink && tf == (IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT)) ||
  -						(!sink && (tf & IMPLTYPEFLAG_FSOURCE) == 0)) {
  -
  -						/* flags match what we are looking for */
  -
  -						if (SUCCEEDED(coinfo->lpVtbl->GetRefTypeOfImplType(coinfo, i, &rt)))
  -							if (SUCCEEDED(coinfo->lpVtbl->GetRefTypeInfo(coinfo, rt, &typeinfo)))
  -								break;
  -						
  -					}
  -				}
  -				
  -				coinfo->lpVtbl->ReleaseTypeAttr(coinfo, attr);
  -				coinfo->lpVtbl->Release(coinfo);
  -			}
  -		}
  -
  -		
  -		efree(olename);
  -	} else if (gotguid) {
  -		typelib->lpVtbl->GetTypeInfoOfGuid(typelib, &iid, &typeinfo);
  -	}
  -
  -	if (typelib)
  -		typelib->lpVtbl->Release(typelib);
  -
  -	return typeinfo;
  -}
  -
  -/* {{{ proto bool com_print_typeinfo(mixed comobject | string typelib, string dispinterface, bool wantsink)
  -   Print out a PHP class definition for a dispatchable interface */
  -PHP_FUNCTION(com_print_typeinfo)
  -{
  -	zval *arg1;
  -	char *ifacename = NULL;
  -	char *typelibname = NULL;
  -	int ifacelen;
  -	zend_bool wantsink = 0;
  -	comval *obj = NULL;
  -	ITypeInfo *typeinfo;
  -	
  -	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/s!b", &arg1, &ifacename,
  -				&ifacelen, &wantsink)) {
  -		RETURN_FALSE;
  -	}
  -
  -	if (Z_TYPE_P(arg1) == IS_OBJECT && (Z_OBJCE_P(arg1) == &COM_class_entry || !strcmp(Z_OBJCE_P(arg1)->name, "COM"))) {
  -		zval **tmp;
  -		zend_hash_index_find(Z_OBJPROP_P(arg1), 0, (void**)&tmp);
  -		ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM);
  -	} else if (Z_TYPE_P(arg1) == IS_RESOURCE) {
  -		ZEND_FETCH_RESOURCE(obj, comval*, &arg1, -1, "comval", IS_COM);
  -	} else {
  -		convert_to_string(arg1);
  -		typelibname = Z_STRVAL_P(arg1);
  -	}
  -
  -	typeinfo = locate_typeinfo(typelibname, obj, ifacename, wantsink TSRMLS_CC);
  -	if (typeinfo) {
  -		process_typeinfo(typeinfo, NULL, 1, NULL TSRMLS_CC);
  -		typeinfo->lpVtbl->Release(typeinfo);
  -		RETURN_TRUE;
  -	} else {
  -		zend_error(E_WARNING, "Unable to find typeinfo using the parameters supplied");
  -	}
  -	RETURN_FALSE;
  -}
  -/* }}} */
  -
  -/* {{{ proto bool com_event_sink(mixed comobject, object sinkobject [, mixed sinkinterface])
  -   Connect events from a COM object to a PHP object */
  -PHP_FUNCTION(com_event_sink)
  -{
  -	zval *object, *sinkobject, *sink=NULL;
  -	char *dispname = NULL, *typelibname = NULL;
  -	zend_bool gotguid = 0;
  -	comval *obj;
  -	ITypeInfo *typeinfo = NULL;
  -
  -	RETVAL_FALSE;
  -	
  -	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|z/", &object, &sinkobject, &sink)) {
  -		RETURN_FALSE;
  -	}
  -
  -	if (Z_TYPE_P(object) == IS_OBJECT && (Z_OBJCE_P(object) == &COM_class_entry || !strcmp(Z_OBJCE_P(object)->name, "COM"))) {
  -		zval **tmp;
  -		zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**)&tmp);
  -		ZEND_FETCH_RESOURCE(obj, comval*, tmp, -1, "comval", IS_COM);
  -	} else {
  -		ZEND_FETCH_RESOURCE(obj, comval*, &object, -1, "comval", IS_COM);
  -	}
  -
  -	if (sink && Z_TYPE_P(sink) == IS_ARRAY) {
  -		/* 0 => typelibname, 1 => dispname */
  -		zval **tmp;
  -
  -		if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS)
  -			typelibname = Z_STRVAL_PP(tmp);
  -		if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS)
  -			dispname = Z_STRVAL_PP(tmp);
  -	} else if (sink != NULL) {
  -		convert_to_string(sink);
  -		dispname = Z_STRVAL_P(sink);
  -	}
  -	
  -	typeinfo = locate_typeinfo(typelibname, obj, dispname, 1 TSRMLS_CC);
  -
  -	if (typeinfo) {
  -		HashTable *id_to_name;
  -		
  -		ALLOC_HASHTABLE(id_to_name);
  -		
  -		if (process_typeinfo(typeinfo, id_to_name, 0, &obj->sinkid TSRMLS_CC)) {
  -
  -			/* Create the COM wrapper for this sink */
  -			obj->sinkdispatch = php_COM_export_as_sink(sinkobject, &obj->sinkid, id_to_name TSRMLS_CC);
  -
  -			/* Now hook it up to the source */
  -			com_enable_events(obj, TRUE);
  -			RETVAL_TRUE;
  -
  -		} else {
  -			FREE_HASHTABLE(id_to_name);
  -		}
  -	}
  -	
  -	if (typeinfo)
  -		typeinfo->lpVtbl->Release(typeinfo);
  -	
  -}
  -/* }}} */
  -
  -static int do_COM_offget(VARIANT *result, comval *array, pval *property, int cleanup TSRMLS_DC)
  -{
  -	pval function_name;
  -	int retval;
  -
  -	ZVAL_STRINGL(&function_name, "Item", 4, 0);
  -	retval = do_COM_invoke(array, &function_name, result, &property, 1 TSRMLS_CC);
  -	if (cleanup) {
  -		php_COM_destruct(array TSRMLS_CC);
  -	}
  -
  -	return retval;
  -}
  -
  -
  -static int do_COM_propget(VARIANT *var_result, comval *obj, pval *arg_property, int cleanup TSRMLS_DC)
  -{
  -	DISPID dispid;
  -	HRESULT hr;
  -	OLECHAR *propname;
  -	char *error_message;
  -	DISPPARAMS dispparams;
  -	char *ErrString;
  -
  -	/* obtain property handler */
  -	propname = php_char_to_OLECHAR(Z_STRVAL_P(arg_property), Z_STRLEN_P(arg_property), codepage TSRMLS_CC);
  -
  -	hr = php_COM_get_ids_of_names(obj, &propname, &dispid TSRMLS_CC);
  -
  -	if (FAILED(hr)) {
  -		error_message = php_COM_error_message(hr TSRMLS_CC);
  -		php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(arg_property), error_message);
  -		LocalFree(error_message);
  -		efree(propname);
  -		if (cleanup) {
  -			php_COM_destruct(obj TSRMLS_CC);
  -		}
  -		return FAILURE;
  -	}
  -
  -	dispparams.cArgs = 0;
  -	dispparams.cNamedArgs = 0;
  -
  -	hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result, &ErrString TSRMLS_CC);
  -
  -	if (FAILED(hr)) {
  -		error_message = php_COM_error_message(hr TSRMLS_CC);
  -		if (ErrString) {
  -			php_error(E_WARNING,"PropGet() failed: %s %s", error_message, ErrString);
  -			pefree(ErrString, 1);
  -		} else {
  -			php_error(E_WARNING,"PropGet() failed: %s", error_message);
  -		}
  -		LocalFree(error_message);
  -		efree(propname);
  -		if (cleanup) {
  -			php_COM_destruct(obj TSRMLS_CC);
  -		}
  -		return FAILURE;
  -	}
  -
  -	efree(propname);
  -	if (cleanup) {
  -		php_COM_destruct(obj TSRMLS_CC);
  -	}
  -	return SUCCESS;
  -}
  -
  -
  -static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property, pval *value TSRMLS_DC)
  -{
  -	DISPID dispid;
  -	HRESULT hr;
  -	OLECHAR *propname;
  -	char *error_message;
  -	VARIANT *var_result, *new_value;
  -	DISPPARAMS dispparams;
  -	DISPID mydispid = DISPID_PROPERTYPUT;
  -	char *ErrString;
  -
  -	ALLOC_VARIANT(var_result);
  -	ALLOC_VARIANT(new_value);
  -
  -	/* obtain property handler */
  -	propname = php_char_to_OLECHAR(Z_STRVAL_P(arg_property), Z_STRLEN_P(arg_property), codepage TSRMLS_CC);
  -
  -	hr = php_COM_get_ids_of_names(obj, &propname, &dispid TSRMLS_CC);
  -
  -	if (FAILED(hr)) {
  -		error_message = php_COM_error_message(hr TSRMLS_CC);
  -		php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(arg_property), error_message);
  -		LocalFree(error_message);
  -		efree(propname);
  -
  -		FREE_VARIANT(var_result);
  -		FREE_VARIANT(new_value);
  -
  -		RETURN_NULL();
  -	}
  -
  -	php_pval_to_variant(value, new_value, codepage TSRMLS_CC);
  -	dispparams.rgvarg = new_value;
  -	dispparams.rgdispidNamedArgs = &mydispid;
  -	dispparams.cArgs = 1;
  -	dispparams.cNamedArgs = 1;
  -
  -	hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYPUT, &dispparams, NULL, &ErrString TSRMLS_CC);
  -
  -	if (FAILED(hr)) {
  -		error_message = php_COM_error_message(hr TSRMLS_CC);
  -		if (ErrString) {
  -			php_error(E_WARNING,"PropPut() failed: %s %s", error_message, ErrString);
  -			pefree(ErrString, 1);
  -		} else {
  -			php_error(E_WARNING,"PropPut() failed: %s", error_message);
  -		}
  -		LocalFree(error_message);
  -
  -		FREE_VARIANT(var_result);
  -
  -		efree(new_value);
  -		efree(propname);
  -
  -		RETURN_NULL();
  -	}
  -
  -	if (return_value) {
  -		dispparams.cArgs = 0;
  -		dispparams.cNamedArgs = 0;
  -
  -		hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result, &ErrString TSRMLS_CC);
  -
  -		if (SUCCEEDED(hr)) {
  -			php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
  -		} else {
  -			*return_value = *value;
  -			zval_copy_ctor(return_value);
  -		}
  -
  -		if (ErrString) {
  -			pefree(ErrString, 1);
  -		}
  -	}
  -
  -	FREE_VARIANT(var_result);
  -
  -	efree(new_value); // FREE_VARIANT does a VariantClear() which is not desired here !
  -	efree(propname);
  -}
  -
  -
  -/* {{{ proto mixed com_propget(int module, string property_name)
  -   Gets properties from a COM module */
  -PHP_FUNCTION(com_propget)
  -{
  -	pval *arg_comval, *arg_property;
  -	int type;
  -	comval *obj;
  -	VARIANT *var_result;
  -
  -	if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters(ht, 2, &arg_comval, &arg_property) == FAILURE)) {
  -		ZEND_WRONG_PARAM_COUNT();
  -	}
  -
  -	/* obtain IDispatch interface */
  -	convert_to_long(arg_comval);
  -	obj = (comval *)zend_list_find(Z_LVAL_P(arg_comval), &type);
  -	if (!obj || (type != IS_COM)) {
  -		php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_comval));
  -		RETURN_NULL();
  -	}
  -	convert_to_string_ex(&arg_property);
  -
  -	ALLOC_VARIANT(var_result);
  -
  -	if (do_COM_propget(var_result, obj, arg_property, FALSE TSRMLS_CC) == FAILURE) {
  -		FREE_VARIANT(var_result);
  -		RETURN_NULL();
  -	}
  -
  -	RETVAL_VARIANT(var_result);
  -}
  -/* }}} */
  -
  -
  -/* {{{ proto bool com_propput(int module, string property_name, mixed value)
  -   Puts the properties for a module */
  -PHP_FUNCTION(com_propput)
  -{
  -	pval *arg_comval, *arg_property, *arg_value;
  -	int type;
  -	comval *obj;
  -
  -	if (ZEND_NUM_ARGS()!=3 || zend_get_parameters(ht, 3, &arg_comval, &arg_property, &arg_value)==FAILURE) {
  -		ZEND_WRONG_PARAM_COUNT();
  -	}
  -
  -	/* obtain comval interface */
  -	convert_to_long(arg_comval);
  -	/* obtain comval interface */
  -	obj = (comval *)zend_list_find(Z_LVAL_P(arg_comval), &type);
  -	if (!obj || (type != IS_COM)) {
  -		php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_comval));
  -		RETURN_NULL();
  -	}
  -	convert_to_string_ex(&arg_property);
  -
  -	do_COM_propput(return_value, obj, arg_property, arg_value TSRMLS_CC);
  -}
  -/* }}} */
  -
  -
  -/* {{{ proto bool com_load_typelib(string typelib_name [, int case_insensitive]) 
  -   Loads a Typelib */
  -PHP_FUNCTION(com_load_typelib)
  -{
  -	pval *arg_typelib, *arg_cis;
  -	ITypeLib *pTL;
  -	int mode = CONST_CS;
  -
  -	switch (ZEND_NUM_ARGS()) {
  -		case 1:
  -			zend_get_parameters(ht, 1, &arg_typelib);
  -			break;
  -
  -		case 2:
  -			zend_get_parameters(ht, 2, &arg_typelib, &arg_cis);
  -			convert_to_boolean_ex(&arg_cis);
  -			if (Z_LVAL_P(arg_cis)) {
  -				mode &= ~CONST_CS;
  -			}
  -			break;
  -
  -		default:
  -			ZEND_WRONG_PARAM_COUNT();
  -	}
  -
  -	convert_to_string_ex(&arg_typelib);
  -	pTL = php_COM_find_typelib(Z_STRVAL_P(arg_typelib), mode TSRMLS_CC);
  -	if (php_COM_load_typelib(pTL, mode TSRMLS_CC) == SUCCESS) {
  -		pTL->lpVtbl->Release(pTL);
  -		RETURN_TRUE;
  -	} else {
  -		RETURN_FALSE;
  -	}
  -}
  -/* }}} */
  -
  -
  -PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_reference)
  -{
  -	zend_overloaded_element *overloaded_property;
  -	zend_llist_element *element;
  -	pval return_value;
  -	pval **comval_handle;
  -	pval *object = property_reference->object;
  -	int type;
  -	comval *obj, *obj_prop;
  -	VARIANT *var_result;
  -	TSRMLS_FETCH();
  -
  -	INIT_ZVAL(return_value);    
  -	ZVAL_NULL(&return_value);
  +			if (FAILED(typeinfo->lpVtbl->GetFuncDesc(typeinfo, i, &func)))
  +				break;
   
  -	/* fetch the IDispatch interface */
  -	zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &comval_handle);
  -	obj = (comval *) zend_list_find(Z_LVAL_P(*comval_handle), &type);
  -	if (!obj || (type != IS_COM)) {
  -		return return_value;
  -	}
  +			isprop = (func->invkind & DISPATCH_PROPERTYGET || func->invkind & DISPATCH_PROPERTYPUT);
   
  -	ALLOC_COM(obj_prop);
  -	ALLOC_VARIANT(var_result);
  +			if (!isprop || lastid != func->memid) {
   
  -	for (element=property_reference->elements_list->head; element; element=element->next) {
  -		overloaded_property = (zend_overloaded_element *) element->data;
  -		switch (Z_TYPE_P(overloaded_property)) {
  -			case OE_IS_ARRAY:
  -				if (do_COM_offget(var_result, obj, &overloaded_property->element, FALSE TSRMLS_CC) == FAILURE) {
  -					FREE_VARIANT(var_result);
  -					FREE_COM(obj_prop);
  +				lastid = func->memid;
  +				
  +				typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, &olename, NULL, NULL, NULL);
  +				ansiname = php_OLECHAR_to_char(olename, &ansinamelen, CP_ACP, FALSE);
  +				SysFreeString(olename);
   
  -					return return_value;
  -				}
  -				break;
  +				if (printdef) {
  +					int j;
  +					char *funcdesc;
  +					unsigned int funcdesclen, cnames = 0;
  +					BSTR *names;
   
  -			case OE_IS_OBJECT:
  -				if (do_COM_propget(var_result, obj, &overloaded_property->element, FALSE TSRMLS_CC) == FAILURE) {
  -					FREE_VARIANT(var_result);
  -					FREE_COM(obj_prop);
  +					names = (BSTR*)emalloc((func->cParams + 1) * sizeof(BSTR));
   
  -					return return_value;
  -				}
  -				break;
  +					typeinfo->lpVtbl->GetNames(typeinfo, func->memid, names, func->cParams + 1, &cnames);
  +					/* first element is the function name */
  +					SysFreeString(names[0]);
   
  -			case OE_IS_METHOD: {
  -					FREE_VARIANT(var_result);
  -					if (obj != obj_prop) {
  -						FREE_COM(obj_prop);
  +					php_printf("\t/* DISPID=%d */\n", func->memid);
   
  -						return_value = *object;
  -						ZVAL_ADDREF(&return_value);
  -					} else {
  -						RETVAL_COM(obj);
  +					if (func->elemdescFunc.tdesc.vt != VT_VOID) {
  +						php_printf("\t/* %s [%d] */\n",
  +								vt_to_string(func->elemdescFunc.tdesc.vt),
  +								func->elemdescFunc.tdesc.vt
  +								);
   					}
  -					return return_value;
  -				}
  -				break;
  -		}
   
  -		if (V_VT(var_result) == VT_DISPATCH) {
  -			if (V_DISPATCH(var_result) == NULL) {
  -				FREE_VARIANT(var_result);
  -				FREE_COM(obj_prop);
  -
  -				return return_value;
  -			}
  +					if (isprop) {
   
  -			obj = obj_prop;
  -			php_COM_set(obj, &V_DISPATCH(var_result), TRUE TSRMLS_CC);
  -			VariantInit(var_result);	// to protect C_DISPATCH(obj) from being freed when var_result is destructed
  -		} else {
  -			php_variant_to_pval(var_result, &return_value, codepage TSRMLS_CC);
  +						typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, NULL, &olename, NULL, NULL);
  +						if (olename) {
  +							funcdesc = php_OLECHAR_to_char(olename, &funcdesclen, CP_ACP, FALSE);
  +							SysFreeString(olename);
  +							php_printf("\t/* %s */\n", funcdesc);
  +							efree(funcdesc);
  +						}
   
  -			FREE_COM(obj_prop);
  -			obj_prop = NULL;
  -		}
  +						php_printf("\tvar $%s;\n\n", ansiname);
   
  -		pval_destructor(&overloaded_property->element);
  -	}
  +					} else {
  +						/* a function */
   
  -	if (obj_prop != NULL) {
  -		RETVAL_COM(obj);
  -	}
  +						php_printf("\tfunction %s(\n", ansiname);
   
  +						for (j = 0; j < func->cParams; j++) {
  +							ELEMDESC *elem = &func->lprgelemdescParam[j];
   
  -	FREE_VARIANT(var_result);              
  +							php_printf("\t\t/* %s [%d] ", vt_to_string(elem->tdesc.vt), elem->tdesc.vt);
   
  -	return return_value;
  -}
  +							if (elem->paramdesc.wParamFlags & PARAMFLAG_FIN)
  +								php_printf("[in]");
  +							if (elem->paramdesc.wParamFlags & PARAMFLAG_FOUT)
  +								php_printf("[out]");
   
  +							if (elem->tdesc.vt == VT_PTR) {
  +								/* what does it point to ? */
  +								php_printf(" --> %s [%d] ",
  +										vt_to_string(elem->tdesc.lptdesc->vt),
  +										elem->tdesc.lptdesc->vt
  +										);
  +							}
   
  -PHPAPI int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value)
  -{
  -	zend_overloaded_element *overloaded_property;
  -	zend_llist_element *element;
  -	pval **comval_handle;
  -	pval *object = property_reference->object;
  -	comval *obj, *obj_prop;
  -	int type;
  -	VARIANT *var_result;
  -	TSRMLS_FETCH();
  +							/* when we handle prop put and get, this will look nicer */
  +							if (j+1 < (int)cnames) {
  +								funcdesc = php_OLECHAR_to_char(names[j+1], &funcdesclen, CP_ACP, FALSE);
  +								SysFreeString(names[j+1]);
  +							} else {
  +								funcdesc = "???";
  +							}
   
  -	/* fetch the IDispatch interface */
  -	zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &comval_handle);
  -	obj = (comval *)zend_list_find(Z_LVAL_P(*comval_handle), &type);
  -	if (!obj || (type != IS_COM)) {
  -		return FAILURE;
  -	}
  +							php_printf(" */ %s%s%c\n",
  +									elem->tdesc.vt == VT_PTR ? "&$" : "$",
  +									funcdesc,
  +									j == func->cParams - 1 ? ' ' : ','
  +									);
   
  -	ALLOC_COM(obj_prop);
  -	ALLOC_VARIANT(var_result);
  +							if (j+1 < (int)cnames)
  +								efree(funcdesc);
  +						}
   
  -	for (element=property_reference->elements_list->head; element != property_reference->elements_list->tail; element=element->next) {
  -		overloaded_property = (zend_overloaded_element *) element->data;
  -		switch (Z_TYPE_P(overloaded_property)) {
  -			case OE_IS_ARRAY:
  -				if (do_COM_offget(var_result, obj, &overloaded_property->element, FALSE TSRMLS_CC) == FAILURE) {
  -					FREE_VARIANT(var_result);
  -					FREE_COM(obj_prop);
  +						php_printf("\t\t)\n\t{\n");
   
  -					return FAILURE;
  -				}
  -				break;
  +						typeinfo->lpVtbl->GetDocumentation(typeinfo, func->memid, NULL, &olename, NULL, NULL);
  +						if (olename) {
  +							funcdesc = php_OLECHAR_to_char(olename, &funcdesclen, CP_ACP, FALSE);
  +							SysFreeString(olename);
  +							php_printf("\t\t/* %s */\n", funcdesc);
  +							efree(funcdesc);
  +						}
   
  -			case OE_IS_OBJECT:
  -				if (do_COM_propget(var_result, obj, &overloaded_property->element, FALSE TSRMLS_CC) == FAILURE) {
  -					FREE_VARIANT(var_result);
  -					FREE_COM(obj_prop);
  +						php_printf("\t}\n");
  +					}
   
  -					return FAILURE;
  +					efree(names);
   				}
  -				break;
  -
  -			case OE_IS_METHOD:
  -				/* this shouldn't happen */
  -				return FAILURE;
  -				break;
  -		}
  -
  -		if (V_VT(var_result) == VT_DISPATCH) {
  -			if (V_DISPATCH(var_result) == NULL) {
  -				FREE_VARIANT(var_result);
  -				FREE_COM(obj_prop);
   
  -				return FAILURE;
  +				if (id_to_name) {
  +					zend_str_tolower(ansiname, ansinamelen);
  +					MAKE_STD_ZVAL(tmp);
  +					ZVAL_STRINGL(tmp, ansiname, ansinamelen, 0);
  +					zend_hash_index_update(id_to_name, func->memid, (void*)&tmp, sizeof(zval *), NULL);
  +				}
   			}
  +			typeinfo->lpVtbl->ReleaseFuncDesc(typeinfo, func);
   
  -			obj = obj_prop;
  -			php_COM_set(obj, &V_DISPATCH(var_result), TRUE TSRMLS_CC);
  -		} else {
  -			FREE_COM(obj_prop);
  -			FREE_VARIANT(var_result);
  -
  -			return FAILURE;
   		}
   
  -		VariantInit(var_result);	// to protect C_DISPATCH(obj) from being freed when var_result is destructed
  -		pval_destructor(&overloaded_property->element);
  -	}
  -	FREE_VARIANT(var_result);
  +		if (printdef)
  +			php_printf("}\n");
   
  -	overloaded_property = (zend_overloaded_element *) element->data;
  -	do_COM_propput(NULL, obj, &overloaded_property->element, value TSRMLS_CC);
  -	FREE_COM(obj_prop);
  +		ret = 1;
  +	} else {
  +		zend_error(E_WARNING, "Thats not a dispatchable interface!! type kind = %08x\n", attr->typekind);
  +	}
   
  -	pval_destructor(&overloaded_property->element);
  +	typeinfo->lpVtbl->ReleaseTypeAttr(typeinfo, attr);
   
  -	return SUCCESS;
  +	return ret;
   }
   
  -/* create an overloaded COM object from a dispatch pointer */
  -PHPAPI zval *php_COM_object_from_dispatch(IDispatch *disp, zval *val TSRMLS_DC)
  +ZEND_API ITypeInfo *php_COM_locate_typeinfo(char *typelibname, comval *obj, char *dispname, int sink)
   {
  -	comval *obj;
  -	zval *zobj;
  -	
  -	ALLOC_COM(obj);
  -	MAKE_STD_ZVAL(zobj);
  -	php_COM_set(obj, &disp, FALSE TSRMLS_CC);
  -	ZVAL_COM_EX(zobj, obj, val);
  -	
  -	return zobj;
  -}
  -
  +	ITypeInfo *typeinfo = NULL;
  +	ITypeLib *typelib = NULL;
  +	int gotguid = 0;
  +	GUID iid;
   
  -PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
  -{
  -	pval property, **handle;
  -	pval *object = property_reference->object;
  -	zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
  -	comval *obj;
  -	int type;
  +	if (obj) {
  +		if (dispname == NULL && sink) {
  +			IProvideClassInfo2 *pci2;
  +			IProvideClassInfo *pci;
   
  -	if (zend_llist_count(property_reference->elements_list)==1
  -		&& !strcmp(Z_STRVAL(function_name->element), "com")) {
  -		/* constructor */
  -		pval *object_handle;
  -
  -		PHP_FN(com_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
  -		if (zend_is_true(return_value)) {
  -			ALLOC_ZVAL(object_handle);
  -			*object_handle = *return_value;
  -			pval_copy_constructor(object_handle);
  -			INIT_PZVAL(object_handle);
  -			zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
  -			pval_destructor(&function_name->element);
  -		} else {
  -			ZVAL_NULL(object);
  +			if (SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo2, (void**)&pci2))) {
  +				gotguid = SUCCEEDED(pci2->lpVtbl->GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
  +				pci2->lpVtbl->Release(pci2);
  +			}
  +			if (!gotguid && SUCCEEDED(C_DISPATCH_VT(obj)->QueryInterface(C_DISPATCH(obj), &IID_IProvideClassInfo, (void**)&pci))) {
  +				/* examine the available interfaces */
  +				/* TODO: write some code here */
  +				pci->lpVtbl->Release(pci);
  +			}
  +		} else if (dispname && C_HASTLIB(obj)) {
  +			unsigned int idx;
  +			/* get the library from the object; the rest will be dealt with later */
  +			C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &typelib, &idx);	
  +		} else if (typelibname == NULL) {
  +			C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &typeinfo);
   		}
  +	} else if (typelibname) {
  +		/* Fetch the typelibrary and use that to look things up */
  +		typelib = php_COM_find_typelib(typelibname, CONST_CS);
  +	} 
   
  -		return;
  -	}
  -
  -	RETVAL_NULL();
  -	property = php_COM_get_property_handler(property_reference);
  -
  -	if (Z_TYPE(property) != IS_OBJECT) {
  -		pval_destructor(&property);
  -		pval_destructor(&function_name->element);
  -
  -		/* error message - function call on a non-object */
  -		return;
  -	}
  +	if (!gotguid && dispname && typelib) {
  +		unsigned short cfound;
  +		MEMBERID memid;
  +		OLECHAR *olename = php_char_to_OLECHAR(dispname, strlen(dispname), CP_ACP, FALSE);
  +		
  +		cfound = 1;
  +		if (FAILED(typelib->lpVtbl->FindName(typelib, olename, 0, &typeinfo, &memid, &cfound)) || cfound == 0) {
  +			CLSID coclass;
  +			ITypeInfo *coinfo;
  +			
  +			/* assume that it might be a progid instead */
  +			if (SUCCEEDED(CLSIDFromProgID(olename, &coclass)) &&
  +					SUCCEEDED(typelib->lpVtbl->GetTypeInfoOfGuid(typelib, &coclass, &coinfo))) {
   
  -	zend_hash_index_find(Z_OBJPROP(property), 0, (void **) &handle);
  -	obj = (comval *)zend_list_find(Z_LVAL_PP(handle), &type);
  +				/* enumerate implemented interfaces and pick the one as indicated by sink */
  +				TYPEATTR *attr;
  +				int i;
   
  -	if (!obj || (type != IS_COM)) {
  -		pval_destructor(&property);
  -		pval_destructor(&function_name->element);
  +				coinfo->lpVtbl->GetTypeAttr(coinfo, &attr);
   
  -		return;
  -	}
  +				for (i = 0; i < attr->cImplTypes; i++) {
  +					HREFTYPE rt;
  +					int tf;
   
  -	if (zend_llist_count(property_reference->elements_list)==1
  -		&& !strcmp(Z_STRVAL_P(&function_name->element), "release")) {
  -		RETVAL_LONG(php_COM_release(obj TSRMLS_CC));
  -	} else if (zend_llist_count(property_reference->elements_list)==1
  -			   && !strcmp(Z_STRVAL_P(&function_name->element), "addref")) {
  -		RETVAL_LONG(php_COM_addref(obj TSRMLS_CC));
  -	} else {
  -		pval **arguments;
  -		VARIANT *var_result;
  -		int arg_count = ZEND_NUM_ARGS();
  +					if (FAILED(coinfo->lpVtbl->GetImplTypeFlags(coinfo, i, &tf)))
  +						continue;
   
  -		ALLOC_VARIANT(var_result);
  +					if ((sink && tf == (IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT)) ||
  +						(!sink && (tf & IMPLTYPEFLAG_FSOURCE) == 0)) {
   
  -		arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
  -		zend_get_parameters_array(ht, arg_count, arguments);
  +						/* flags match what we are looking for */
   
  -		if (do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count TSRMLS_CC) == SUCCESS) {
  -			php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
  +						if (SUCCEEDED(coinfo->lpVtbl->GetRefTypeOfImplType(coinfo, i, &rt)))
  +							if (SUCCEEDED(coinfo->lpVtbl->GetRefTypeInfo(coinfo, rt, &typeinfo)))
  +								break;
  +						
  +					}
  +				}
  +				
  +				coinfo->lpVtbl->ReleaseTypeAttr(coinfo, attr);
  +				coinfo->lpVtbl->Release(coinfo);
  +			}
   		}
   
  -		FREE_VARIANT(var_result);
  -		efree(arguments);
  +		
  +		efree(olename);
  +	} else if (gotguid) {
  +		typelib->lpVtbl->GetTypeInfoOfGuid(typelib, &iid, &typeinfo);
   	}
   
  -	if (zend_llist_count(property_reference->elements_list) > 1) {
  -		/* destruct temporary object */
  -		zend_list_delete(Z_LVAL_PP(handle));
  -		pval_destructor(&property);
  -	}
  -	
  -	pval_destructor(&function_name->element);
  -}
  +	if (typelib)
  +		typelib->lpVtbl->Release(typelib);
   
  +	return typeinfo;
  +}
   
  -static ITypeLib *php_COM_find_typelib(char *search_string, int mode TSRMLS_DC)
  +static ITypeLib *php_COM_find_typelib(char *search_string, int mode)
   {
   	ITypeLib *TypeLib = NULL;
   	char *strtok_buf, *major, *minor;
  @@ -2013,7 +677,7 @@
   	major = php_strtok_r(NULL, ",", &strtok_buf);
   	minor = php_strtok_r(NULL, ",", &strtok_buf);
   
  -	p = php_char_to_OLECHAR(search_string, strlen(search_string), codepage TSRMLS_CC);
  +	p = php_char_to_OLECHAR(search_string, strlen(search_string), CP_ACP, FALSE);
   	/* Is the string a GUID ? */
   
   	if (!FAILED(CLSIDFromString(p, &clsid))) {
  @@ -2132,7 +796,7 @@
   							str = emalloc(strlen(keyname)+strlen(version)+20); /* 18 == safety, 2 == extra comma and \0 */
   							sprintf(str, "%s,%d,%d", keyname, major, minor);
   							efree(keyname);
  -							TypeLib = php_COM_find_typelib(str, mode TSRMLS_CC);
  +							TypeLib = php_COM_find_typelib(str, mode);
   							efree(str);
   							/* This is probbaly much harder to read and follow */
   							/* But it is MUCH more effiecient than trying to */
  @@ -2156,11 +820,12 @@
   }
   
   
  -PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
  +ZEND_API int php_COM_load_typelib(ITypeLib *TypeLib, int mode)
   {
   	ITypeComp *TypeComp;
   	int i;
   	int interfaces;
  +	TSRMLS_FETCH();
   
   	if (NULL == TypeLib) {
   		return FAILURE;
  @@ -2178,15 +843,13 @@
   			VARDESC *pVarDesc;
   			UINT NameCount;
   			int j;
  -#if 0
   			BSTR bstr_EnumId;
   			char *EnumId;
   
   			TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
  -			EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, codepage);
  +			EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, CP_ACP, FALSE);
   			printf("Enumeration %d - %s:\n", i, EnumId);
   			efree(EnumId);
  -#endif
   
   			TypeLib->lpVtbl->GetTypeInfo(TypeLib, i, &TypeInfo);
   
  @@ -2194,7 +857,7 @@
   			while (SUCCEEDED(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc))) {
   				BSTR bstr_ids;
   				zend_constant c;
  -				zval exists, results;
  +				zval exists, results, value;
   				char *const_name;
   
   				TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
  @@ -2202,7 +865,7 @@
   					j++;
   					continue;
   				}
  -				const_name = php_OLECHAR_to_char(bstr_ids, &c.name_len, codepage TSRMLS_CC);
  +				const_name = php_OLECHAR_to_char(bstr_ids, &c.name_len, CP_ACP, FALSE);
   				c.name = zend_strndup(const_name, c.name_len);
   				efree(const_name);
   				c.name_len++; /* length should include the NULL */
  @@ -2220,14 +883,16 @@
   					continue;
   				}
   
  -				php_variant_to_pval(pVarDesc->lpvarValue, &c.value, codepage TSRMLS_CC);
  -				if (mode & CONST_PERSISTENT) {
  -					zval_persist(&c.value TSRMLS_CC);
  -					mode |= CONST_EFREE_PERSISTENT;
  -				}
  -				c.flags = mode;
  +				php_variant_to_zval(pVarDesc->lpvarValue, &value, CP_ACP);
  +				 /* we only import enumerations (=int) */
  +				if (Z_TYPE(value) == IS_LONG) {
  +					c.flags = mode;
  +					c.value.type = IS_LONG;
  +					c.value.value.lval = Z_LVAL(value);
  +					c.module_number = 0; /* the module number is not available here */
   
  -				zend_register_constant(&c TSRMLS_CC);
  +					zend_register_constant(&c TSRMLS_CC);
  +				}
   
   				j++;
   			}
  @@ -2238,100 +903,20 @@
   	return SUCCESS;
   }
   
  -/* {{{ proto bool com_isenum(object com_module)
  -   Grabs an IEnumVariant */
  -PHP_FUNCTION(com_isenum)
  -{
  -	pval *object;
  -	pval **comval_handle;
  -	comval *obj;
  -	int type;
  -
  -	if (ZEND_NUM_ARGS() != 1) {
  -		ZEND_WRONG_PARAM_COUNT();
  -	}
  -
  -	zend_get_parameters(ht, 1, &object);
  -
  -	/* obtain IDispatch interface */
  -	zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &comval_handle);
  -	obj = (comval *) zend_list_find(Z_LVAL_PP(comval_handle), &type);
  -	if (!obj || (type != IS_COM)) {
  -		php_error(E_WARNING,"%s is not a COM object handler", "");
  -		RETURN_FALSE;
  -	}
  -
  -	RETURN_BOOL(C_HASENUM(obj));
  -}
  -/* }}} */
  -
  -
  -static void php_register_COM_class(TSRMLS_D)
  -{
  -	INIT_OVERLOADED_CLASS_ENTRY(COM_class_entry, "COM", NULL,
  -								php_COM_call_function_handler,
  -								php_COM_get_property_handler,
  -								php_COM_set_property_handler);
  -
  -	zend_register_internal_class(&COM_class_entry TSRMLS_CC);
  -}
  -
  -
  -static void php_COM_init(int module_number TSRMLS_DC)
  -{
  -	le_comval = zend_register_list_destructors_ex(php_comval_destructor, NULL, "COM", module_number);
  -	php_register_COM_class(TSRMLS_C);
  -}
  -
  -PHPAPI ZEND_DECLARE_MODULE_GLOBALS(com)
  -
  -static void php_com_init_globals(zend_com_globals *com_globals)
  -{
  -}
  -
  -PHP_MINIT_FUNCTION(COM)
  -{
  -	ZEND_INIT_MODULE_GLOBALS(com, php_com_init_globals, NULL);
  -	php_COM_init(module_number TSRMLS_CC);
  -	php_VARIANT_init(module_number TSRMLS_CC);
  -	php_COM_dispatch_init(module_number TSRMLS_CC);
  -
  -	REGISTER_LONG_CONSTANT("CLSCTX_INPROC_SERVER",  CLSCTX_INPROC_SERVER, CONST_CS | CONST_PERSISTENT);
  -	REGISTER_LONG_CONSTANT("CLSCTX_INPROC_HANDLER", CLSCTX_INPROC_HANDLER, CONST_CS | CONST_PERSISTENT);
  -	REGISTER_LONG_CONSTANT("CLSCTX_LOCAL_SERVER",   CLSCTX_LOCAL_SERVER, CONST_CS | CONST_PERSISTENT);
  -	REGISTER_LONG_CONSTANT("CLSCTX_REMOTE_SERVER",  CLSCTX_REMOTE_SERVER, CONST_CS | CONST_PERSISTENT);
  -	REGISTER_LONG_CONSTANT("CLSCTX_SERVER",         CLSCTX_SERVER, CONST_CS | CONST_PERSISTENT);
  -	REGISTER_LONG_CONSTANT("CLSCTX_ALL",            CLSCTX_ALL, CONST_CS | CONST_PERSISTENT);
  -
  -	REGISTER_INI_ENTRIES();
  -
  -	return SUCCESS;
  -}
  -
  -PHP_MSHUTDOWN_FUNCTION(COM)
  -{
  -	UNREGISTER_INI_ENTRIES();
  -	return SUCCESS;
  -}
  -
  -/* exports for external object creation */
  -
  -zend_module_entry COM_module_entry = {
  -    STANDARD_MODULE_HEADER,
  -	"com",
  -    COM_functions,
  -    PHP_MINIT(COM),
  -    PHP_MSHUTDOWN(COM),
  -    NULL,
  -    NULL,
  -	PHP_MINFO(COM),
  -    NO_VERSION_YET,
  -    STANDARD_MODULE_PROPERTIES
  -};
   
  -PHPAPI int php_COM_get_le_comval()
  +/* create an overloaded COM object from a dispatch pointer */
  +PHPAPI zval *php_COM_object_from_dispatch(IDispatch *disp)
   {
  -	return le_comval;
  +	comval *obj;
  +	zval *zobj;
  +	TSRMLS_FETCH();
  +	
  +	ALLOC_COM(obj);
  +	MAKE_STD_ZVAL(zobj);
  +	php_COM_set(obj, &disp, FALSE);
  +	ZVAL_COM(zobj, obj);
  +	
  +	return zobj;
   }
   
   #endif
  
  
  
  1.1.2.2   +64 -36    php4/ext/rpc/com/Attic/com_wrapper.h
  
  Index: com_wrapper.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/Attic/com_wrapper.h,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- com_wrapper.h	10 Jul 2002 01:53:51 -0000	1.1.2.1
  +++ com_wrapper.h	3 Aug 2002 00:44:16 -0000	1.1.2.2
  @@ -1,70 +1,98 @@
  -#ifndef COM_H
  -#define COM_H
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Zeev Suraski <zeev****@zend*****>                                 |
  +   |         Harald Radi  <h.rad****@nme*****>                                 |
  +   |         Alan Brown   <abrow****@pobox*****>                              |
  +   |         Wez Furlong <wez****@thebr*****>                           |
  +   +----------------------------------------------------------------------+
  + */
  +
  +#ifndef COM_WRAPPER_H
  +#define COM_WRAPPER_H
   
   #if PHP_WIN32
   
   BEGIN_EXTERN_C()
   
  -#include <oleauto.h>
  -
   typedef struct comval_ {
  -#ifdef _DEBUG
  -	int resourceindex;
  -#endif	
   	BOOL typelib;
   	BOOL enumeration;
   	int refcount;
  +	int codepage;
   	struct {
   		IDispatch *dispatch;
   		ITypeInfo *typeinfo;
   		IEnumVARIANT *enumvariant;
   	} i;
  +
  +#if 1
   	IDispatch *sinkdispatch;
   	GUID sinkid;
   	DWORD sinkcookie;
  +#endif
  +
  +#ifdef _DEBUG
  +	int resourceindex;
  +#endif	
  +
   } comval;
   
  -END_EXTERN_C()
  +ZEND_API HRESULT	php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR*  pDispParams, VARIANT FAR* pVarResult, char **ErrString);
  +ZEND_API HRESULT	php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* rgszNames, DISPID FAR* rgDispId);
  +ZEND_API HRESULT	php_COM_release(comval *obj);
  +ZEND_API HRESULT	php_COM_addref(comval *obj);
  +ZEND_API HRESULT	php_COM_destruct(comval *obj);
  +ZEND_API HRESULT	php_COM_set(comval *obj, IDispatch FAR* FAR* pDisp, int cleanup);
  +ZEND_API HRESULT	php_COM_enable_events(comval *obj, int enable);
  +
  +ZEND_API char*		php_COM_string_from_CLSID(const CLSID *clsid);
  +ZEND_API char*		php_COM_error_message(HRESULT hr);
  +ZEND_API int		php_COM_load_typelib(ITypeLib *TypeLib, int mode);
  +ZEND_API int		php_COM_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid);
  +ZEND_API ITypeInfo*	php_COM_locate_typeinfo(char *typelibname, comval *obj, char *dispname, int sink);
  +ZEND_API ITypeLib*	php_COM_find_typelib(char *search_string, int mode);
  +
  +ZEND_API IDispatch*	php_COM_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name);
  +ZEND_API IDispatch*	php_COM_export_object(zval *val);
  +ZEND_API zval*		php_COM_object_from_dispatch(IDispatch *disp);
   
  -#define ZVAL_COM(z,o) {																\
  -			zval *handle = NULL;													\
  -			ZVAL_COM_EX(z,o,handle)													\
  -		}
  +END_EXTERN_C()
   
  -#define ZVAL_COM_EX(z,o,handle) {													\
  -			HashTable *properties;													\
  -																					\
  -			ALLOC_HASHTABLE(properties);											\
  -			zend_hash_init(properties, 0, NULL, ZVAL_PTR_DTOR, 0);					\
  -																					\
  -			if (handle == NULL) {													\
  -				MAKE_STD_ZVAL(handle);												\
  -			}																		\
  -			ZVAL_RESOURCE(handle, zend_list_insert((o), IS_COM));						\
  -																					\
  -			zval_copy_ctor(handle);													\
  -			zend_hash_index_update(properties, 0, &handle, sizeof(zval *), NULL);	\
  -			object_and_properties_init(z, &COM_class_entry, properties);			\
  +#define ZVAL_COM(z,o) {															\
  +			rpc_internal *intern;												\
  +			Z_TYPE_P(z) = IS_OBJECT;											\
  +			(z)->value.obj = rpc_objects_new(com_class_entry TSRMLS_CC);		\
  +			if (GET_INTERNAL_EX(intern, (z)) != SUCCESS) {						\
  +				/* TODO: exception */											\
  +			}																	\
  +			intern->data = (o);													\
   		}
   
   #define RETVAL_COM(o)	ZVAL_COM(&return_value, o);
  -#define RETURN_COM(o)	RETVAL_COM(o)												\
  +#define RETURN_COM(o)	RETVAL_COM(o)											\
   						return;
   
  -#define ALLOC_COM(z)	(z) = (comval *) ecalloc(1, sizeof(comval));					\
  -						C_REFCOUNT(z) = 0;
  +#define ALLOC_COM(z)	(z) = (comval *) ecalloc(1, sizeof(comval));			\
  +						C_CODEPAGE(z) = CP_ACP;
   
  -#define FREE_COM(z)		php_COM_destruct(z TSRMLS_CC);
  +#define FREE_COM(z)		php_COM_destruct(z);
   
  -#define IS_COM			php_COM_get_le_comval()
  +#define C_CODEPAGE(x)	((x)->codepage)
   
   #define C_HASTLIB(x)	((x)->typelib)
   #define C_HASENUM(x)	((x)->enumeration)
  -#define C_REFCOUNT(x)	((x)->refcount)
  -#define C_ISREFD(x)		C_REFCOUNT(x)
  -
  -#define C_ADDREF(x)		(++((x)->refcount))
  -#define C_RELEASE(x)	(--((x)->refcount))
   
   #define C_DISPATCH(x)		((x)->i.dispatch)
   #define C_TYPEINFO(x)		((x)->i.typeinfo)
  
  
  
  1.1.2.2   +173 -190  php4/ext/rpc/com/Attic/conversion.c
  
  Index: conversion.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/Attic/conversion.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- conversion.c	10 Jul 2002 01:53:51 -0000	1.1.2.1
  +++ conversion.c	3 Aug 2002 00:44:16 -0000	1.1.2.2
  @@ -32,19 +32,25 @@
   #ifdef PHP_WIN32
   
   #include "php.h"
  -#include "php_COM.h"
  -#include "php_VARIANT.h"
  +
  +#include "../rpc.h"
  +#include "../handler.h"
  +
  +#include "com.h"
  +#include "com_wrapper.h"
  +#include "conversion.h"
  +#include "variant.h"
   
   /* prototypes */
   
  -static void comval_to_variant(pval *pval_arg, VARIANT *var_arg TSRMLS_DC);
  +static int comval_to_variant(zval *zval_arg, VARIANT *var_arg);
   
   /* implementations */
  -PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage TSRMLS_DC)
  +PHPAPI void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage)
   {
   	int type = VT_EMPTY;	/* default variant type */
   
  -	switch (Z_TYPE_P(pval_arg)) {
  +	switch (Z_TYPE_P(zval_arg)) {
   		case IS_NULL:
   			type = VT_NULL;
   			break;
  @@ -54,7 +60,7 @@
   			break;
   
   		case IS_OBJECT:
  -			if (!strcmp(Z_OBJCE_P(pval_arg)->name, "VARIANT")) {
  +			if (!strcmp(Z_OBJCE_P(zval_arg)->name, "VARIANT")) {
   				type = VT_VARIANT|VT_BYREF;
   			} else {
   				type = VT_DISPATCH;
  @@ -84,19 +90,13 @@
   			break;
   	}
   
  -	php_pval_to_variant_ex2(pval_arg, var_arg, type, codepage TSRMLS_CC);
  +	php_zval_to_variant_ex(zval_arg, var_arg, type, codepage);
   }
   
   
  -PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage TSRMLS_DC)
  +PHPAPI void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, int codepage)
   {
  -	php_pval_to_variant_ex2(pval_arg, var_arg, Z_LVAL_P(pval_type), codepage TSRMLS_CC);
  -}
  -
  -
  -PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC)
  -{
  -	OLECHAR *unicode_str;
  +	OLECHAR *unicode_str = NULL;
   
   	VariantInit(var_arg);
   	V_VT(var_arg) = type;
  @@ -104,7 +104,7 @@
   	if (V_VT(var_arg) & VT_ARRAY) {
   		/* For now we'll just handle single dimension arrays, we'll use the data type of the first element for the
   		   output data type */
  -		HashTable *ht = Z_ARRVAL(*pval_arg);
  +		HashTable *ht = Z_ARRVAL(*zval_arg);
   		int numberOfElements = zend_hash_num_elements(ht);
   		SAFEARRAY *safeArray;
   		SAFEARRAYBOUND bounds[1];
  @@ -115,7 +115,7 @@
   
   		if (V_VT(var_arg) == (VT_ARRAY|VT_BYREF)) {		/* == is intended, because VT_*|VT_BYREF|VT_ARRAY means something diffrent */
   			type &= ~VT_BYREF;
  -			ALLOC_VARIANT(V_VARIANTREF(var_arg));
  +			V_VARIANTREF(var_arg) = (VARIANT *) emalloc(sizeof(VARIANT));
   			var_arg = V_VARIANTREF(var_arg);		/* put the array in that VARIANT */
   		}
   
  @@ -125,7 +125,7 @@
   		
   		if (NULL == safeArray) {
   			php_error( E_WARNING,"Unable to convert php array to VARIANT array - %s", numberOfElements ? "" : "(Empty input array)");
  -			ZVAL_FALSE(pval_arg);
  +			ZVAL_FALSE(zval_arg);
   		} else {
   			V_ARRAY(var_arg) = safeArray;
   			V_VT(var_arg) = VT_ARRAY|VT_VARIANT;                /* Now have a valid safe array allocated */
  @@ -138,9 +138,9 @@
   						/* Add another value to the safe array */
   						if (SUCCEEDED(SafeArrayPtrOfIndex( safeArray, &i, &v))) {		/* Pointer to output element entry retrieved successfully */
   							if (type) {	/* explicit type */
  -							   php_pval_to_variant_ex2(*entry, v, type, codepage TSRMLS_CC);		/* Do the required conversion */
  +							   php_zval_to_variant_ex(*entry, v, type, codepage);		/* Do the required conversion */
   							} else {
  -								php_pval_to_variant(*entry, v, codepage TSRMLS_CC);                    /* Do the required conversion */
  +								php_zval_to_variant(*entry, v, codepage);                    /* Do the required conversion */
   							}
   						} else {
   							php_error( E_WARNING,"phpArrayToSafeArray() - Unable to retrieve pointer to output element number (%d)", i);
  @@ -158,37 +158,37 @@
   
   			case VT_NULL:
   			case VT_VOID:
  -				ZVAL_NULL(pval_arg);
  +				ZVAL_NULL(zval_arg);
   				break; 
   			
   			case VT_UI1:
  -				convert_to_long_ex(&pval_arg);
  -				V_UI1(var_arg) = (unsigned char) Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_UI1(var_arg) = (unsigned char) Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_I2:
  -				convert_to_long_ex(&pval_arg);
  -				V_I2(var_arg) = (short) Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_I2(var_arg) = (short) Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_I4:
  -				convert_to_long_ex(&pval_arg);
  -				V_I4(var_arg) = Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_I4(var_arg) = Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_R4:
  -				convert_to_double_ex(&pval_arg);
  -				V_R4(var_arg) = (float) Z_DVAL_P(pval_arg);
  +				convert_to_double_ex(&zval_arg);
  +				V_R4(var_arg) = (float) Z_DVAL_P(zval_arg);
   				break;
   
   			case VT_R8:
  -				convert_to_double_ex(&pval_arg);
  -				V_R8(var_arg) = Z_DVAL_P(pval_arg);
  +				convert_to_double_ex(&zval_arg);
  +				V_R8(var_arg) = Z_DVAL_P(zval_arg);
   				break;
   
   			case VT_BOOL:
  -				convert_to_boolean_ex(&pval_arg);
  -				if (Z_LVAL_P(pval_arg)) {
  +				convert_to_boolean_ex(&zval_arg);
  +				if (Z_LVAL_P(zval_arg)) {
   					V_BOOL(var_arg) = VT_TRUE;
   				} else {
   					V_BOOL(var_arg) = VT_FALSE;
  @@ -196,23 +196,23 @@
   				break;
   
   			case VT_ERROR:
  -				convert_to_long_ex(&pval_arg);
  -				V_ERROR(var_arg) = Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_ERROR(var_arg) = Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_CY:
  -				convert_to_double_ex(&pval_arg);
  -				VarCyFromR8(Z_DVAL_P(pval_arg), &V_CY(var_arg));
  +				convert_to_double_ex(&zval_arg);
  +				VarCyFromR8(Z_DVAL_P(zval_arg), &V_CY(var_arg));
   				break;
   
   			case VT_DATE: {
   					SYSTEMTIME wintime;
   					struct tm *phptime;
   
  -					switch (Z_TYPE_P(pval_arg)) {
  +					switch (Z_TYPE_P(zval_arg)) {
   						case IS_DOUBLE:
   							/* already a VariantTime value */
  -							V_DATE(var_arg) = Z_DVAL_P(pval_arg);
  +							V_DATE(var_arg) = Z_DVAL_P(zval_arg);
   							break;
   
   						/** @todo
  @@ -222,8 +222,8 @@
   
   						default:
   							/* a PHP time value ? */
  -							convert_to_long_ex(&pval_arg);
  -							phptime = gmtime(&(Z_LVAL_P(pval_arg)));
  +							convert_to_long_ex(&zval_arg);
  +							phptime = gmtime(&(Z_LVAL_P(zval_arg)));
   							memset(&wintime, 0, sizeof(wintime));
   
   							wintime.wYear = phptime->tm_year + 1900;
  @@ -240,39 +240,36 @@
   				break;
   
   			case VT_BSTR:
  -				convert_to_string_ex(&pval_arg);
  -				unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
  -				V_BSTR(var_arg) = SysAllocStringByteLen((char *) unicode_str, Z_STRLEN_P(pval_arg) * sizeof(OLECHAR));
  -				efree(unicode_str);
  +				convert_to_string_ex(&zval_arg);
  +				unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(zval_arg), Z_STRLEN_P(zval_arg), codepage, FALSE);
  +				V_BSTR(var_arg) = SysAllocStringByteLen((char *) unicode_str, Z_STRLEN_P(zval_arg) * sizeof(OLECHAR));
   				break;
   
   			case VT_DECIMAL:
  -				convert_to_string_ex(&pval_arg);
  -				unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
  +				convert_to_string_ex(&zval_arg);
  +				unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(zval_arg), Z_STRLEN_P(zval_arg), codepage, FALSE);
   				VarDecFromStr(unicode_str, LOCALE_SYSTEM_DEFAULT, 0, &V_DECIMAL(var_arg));
   				break;
   
   			case VT_DECIMAL|VT_BYREF:
  -				convert_to_string_ex(&pval_arg);
  -				unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
  +				convert_to_string_ex(&zval_arg);
  +				unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(zval_arg), Z_STRLEN_P(zval_arg), codepage, FALSE);
   				VarDecFromStr(unicode_str, LOCALE_SYSTEM_DEFAULT, 0, V_DECIMALREF(var_arg));
   				break;
   
   			case VT_UNKNOWN:
  -				comval_to_variant(pval_arg, var_arg TSRMLS_CC);
  -				if (V_VT(var_arg) != VT_DISPATCH) {
  -					VariantInit(var_arg);
  -				} else {
  +				if (comval_to_variant(zval_arg, var_arg) == SUCCESS) {
   					V_VT(var_arg) = VT_UNKNOWN;
   					V_UNKNOWN(var_arg) = (IUnknown *) V_DISPATCH(var_arg);
   				}
   				break;
   
   			case VT_DISPATCH:
  -				if (!strcmp(Z_OBJCE_P(pval_arg)->name, "COM")) {
  -					comval_to_variant(pval_arg, var_arg TSRMLS_CC);
  +				if (Z_OBJCE_P(zval_arg) == com_class_entry) {
  +					comval_to_variant(zval_arg, var_arg);
   				} else {
  -					V_DISPATCH(var_arg) = php_COM_export_object(pval_arg TSRMLS_CC);
  +					V_DISPATCH(var_arg) = php_COM_export_object(zval_arg);
  +
   					if (V_DISPATCH(var_arg)) {
   						V_VT(var_arg) = VT_DISPATCH;
   					}
  @@ -283,35 +280,35 @@
   				break;
   
   			case VT_UI1|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_UI1REF(var_arg) = (unsigned char FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_UI1REF(var_arg) = (unsigned char FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_I2|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_I2REF(var_arg) = (short FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_I2REF(var_arg) = (short FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_I4|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_I4REF(var_arg) = (long FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_I4REF(var_arg) = (long FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_R4|VT_BYREF:
  -				convert_to_double(pval_arg);
  -				V_R4REF(var_arg) = (float FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_double(zval_arg);
  +				V_R4REF(var_arg) = (float FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_R8|VT_BYREF:
  -				convert_to_double(pval_arg);
  -				V_R8REF(var_arg) = (double FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_double(zval_arg);
  +				V_R8REF(var_arg) = (double FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_BOOL|VT_BYREF:
  -				convert_to_boolean(pval_arg);
  +				convert_to_boolean(zval_arg);
   				/* emalloc or malloc ? */
   				V_BOOLREF(var_arg) = (short FAR*) pemalloc(sizeof(short), 1);
  -				if (Z_LVAL_P(pval_arg)) {
  +				if (Z_LVAL_P(zval_arg)) {
   					*V_BOOLREF(var_arg) = VT_TRUE;
   				} else {
   					*V_BOOLREF(var_arg) = VT_TRUE;
  @@ -319,20 +316,20 @@
   				break;
   
   			case VT_ERROR|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_ERRORREF(var_arg) = (long FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_ERRORREF(var_arg) = (long FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_CY|VT_BYREF:
  -				convert_to_double_ex(&pval_arg);
  -				VarCyFromR8(Z_DVAL_P(pval_arg), var_arg->pcyVal);
  +				convert_to_double_ex(&zval_arg);
  +				VarCyFromR8(Z_DVAL_P(zval_arg), var_arg->pcyVal);
   				break;
   
   			case VT_DATE|VT_BYREF: {
   					SYSTEMTIME wintime;
   					struct tm *phptime;
   
  -					phptime = gmtime(&(Z_LVAL_P(pval_arg)));
  +					phptime = gmtime(&(Z_LVAL_P(zval_arg)));
   					memset(&wintime, 0, sizeof(wintime));
   
   					wintime.wYear   = phptime->tm_year + 1900;
  @@ -347,28 +344,21 @@
   				break;
   
   			case VT_BSTR|VT_BYREF:
  -				convert_to_string(pval_arg);
  +				convert_to_string(zval_arg);
   				V_BSTRREF(var_arg) = (BSTR FAR*) emalloc(sizeof(BSTR FAR*));
  -				unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
  +				unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(zval_arg), Z_STRLEN_P(zval_arg), codepage, FALSE);
   				*V_BSTRREF(var_arg) = SysAllocString(unicode_str);
  -				efree(unicode_str);
   				break;
   
   			case VT_UNKNOWN|VT_BYREF:
  -				comval_to_variant(pval_arg, var_arg TSRMLS_CC);
  -				if (V_VT(var_arg) != VT_DISPATCH) {
  -					VariantInit(var_arg);
  -				} else {
  +				if (comval_to_variant(zval_arg, var_arg) == SUCCESS) {
   					V_VT(var_arg) = VT_UNKNOWN|VT_BYREF;
   					V_UNKNOWNREF(var_arg) = (IUnknown **) &V_DISPATCH(var_arg);
   				}
   				break;
   
   			case VT_DISPATCH|VT_BYREF:
  -				comval_to_variant(pval_arg, var_arg TSRMLS_CC);
  -				if (V_VT(var_arg) != VT_DISPATCH) {
  -					VariantInit(var_arg);
  -				} else {
  +				if (comval_to_variant(zval_arg, var_arg) == SUCCESS) {
   					V_VT(var_arg) = VT_DISPATCH|VT_BYREF;
   					V_DISPATCHREF(var_arg) = &V_DISPATCH(var_arg);
   				}
  @@ -378,93 +368,85 @@
   				php_error(E_WARNING,"VT_VARIANT is invalid. Use VT_VARIANT|VT_BYREF instead.");
   				/* break missing intentionally */
   			case VT_VARIANT|VT_BYREF: {
  -					int tp;
  -					pval **var_handle;
  -
  -					/* fetch the VARIANT structure */
  -					zend_hash_index_find(Z_OBJPROP_P(pval_arg), 0, (void **) &var_handle);
  +					variantval *var;
  +					TSRMLS_FETCH();
   
  -					V_VT(var_arg) = VT_VARIANT|VT_BYREF;
  -					V_VARIANTREF(var_arg) = (VARIANT FAR*) zend_list_find(Z_LVAL_P(*var_handle), &tp);
  -
  -					if (!V_VARIANTREF(var_arg) && (tp != IS_VARIANT)) {
  -						VariantInit(var_arg);
  +					if ((var = zend_object_store_get_object(zval_arg TSRMLS_CC)) == NULL) {
  +						/* TODO exception */
   					}
  -				}
  -			/*
  -				should be, but isn't :)
   
  -				if (V_VT(var_arg) != (VT_VARIANT|VT_BYREF)) {
  -					VariantInit(var_arg);
  +					V_VARIANTREF(var_arg) = var->var;
   				}
  -			*/
   				break;
   
   			case VT_I1:
  -				convert_to_long_ex(&pval_arg);
  -				V_I1(var_arg) = (char)Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_I1(var_arg) = (char)Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_UI2:
  -				convert_to_long_ex(&pval_arg);
  -				V_UI2(var_arg) = (unsigned short)Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_UI2(var_arg) = (unsigned short)Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_UI4:
  -				convert_to_long_ex(&pval_arg);
  -				V_UI4(var_arg) = (unsigned long)Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_UI4(var_arg) = (unsigned long)Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_INT:
  -				convert_to_long_ex(&pval_arg);
  -				V_INT(var_arg) = (int)Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_INT(var_arg) = (int)Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_UINT:
  -				convert_to_long_ex(&pval_arg);
  -				V_UINT(var_arg) = (unsigned int)Z_LVAL_P(pval_arg);
  +				convert_to_long_ex(&zval_arg);
  +				V_UINT(var_arg) = (unsigned int)Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_I1|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_I1REF(var_arg) = (char FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_I1REF(var_arg) = (char FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_UI2|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_UI2REF(var_arg) = (unsigned short FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_UI2REF(var_arg) = (unsigned short FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_UI4|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_UI4REF(var_arg) = (unsigned long FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_UI4REF(var_arg) = (unsigned long FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_INT|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_INTREF(var_arg) = (int FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_INTREF(var_arg) = (int FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			case VT_UINT|VT_BYREF:
  -				convert_to_long(pval_arg);
  -				V_UINTREF(var_arg) = (unsigned int FAR*) &Z_LVAL_P(pval_arg);
  +				convert_to_long(zval_arg);
  +				V_UINTREF(var_arg) = (unsigned int FAR*) &Z_LVAL_P(zval_arg);
   				break;
   
   			default:
   				php_error(E_WARNING,"Unsupported variant type: %d (0x%X)", V_VT(var_arg), V_VT(var_arg));
   		}
  +
  +		if (unicode_str != NULL) {
  +			efree(unicode_str);
  +		}
   	}
   }
   
  -
  -PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TSRMLS_DC)
  +PHPAPI int php_variant_to_zval(VARIANT *var_arg, zval *zval_arg, int codepage)
   {
   	/* Changed the function to return a value for recursive error testing */
   	/* Existing calls will be unaffected by the change - so it */
   	/* seemed like the smallest impact on unfamiliar code */
   	int ret = SUCCESS; 
   
  -	INIT_PZVAL(pval_arg);
  +	INIT_PZVAL(zval_arg);
   
   	/* Add SafeArray support */
   	if (V_ISARRAY(var_arg)) {
  @@ -475,14 +457,14 @@
   		register int ii;
   		UINT Dims;
   		VARIANT vv;
  -		pval *element;
  +		zval *element;
   		HRESULT hr;
   
   		/* TODO: Add support for multi-dimensional SafeArrays */
   		/* For now just validate that the SafeArray has one dimension */
   		if (1 != (Dims = SafeArrayGetDim(array))) {
   			php_error(E_WARNING,"Unsupported: multi-dimensional (%d) SafeArrays", Dims);
  -			ZVAL_NULL(pval_arg);
  +			ZVAL_NULL(zval_arg);
   			return FAILURE;
   		}
           SafeArrayLock(array);
  @@ -501,7 +483,7 @@
   
   		/* Since COM returned an array we set up the php */
   		/* return value to be an array */
  -		array_init(pval_arg);
  +		array_init(zval_arg);
   
   		/* Walk the safe array */
   		for (ii=lbound;ii<=ubound;ii++) {
  @@ -527,7 +509,7 @@
   			/* If SafeArrayGetElement proclaims to allocate */
   			/* memory for a BSTR, so the recursive call frees */
   			/* the string correctly */
  -			if (FAILURE == php_variant_to_pval(&vv, element, codepage TSRMLS_CC)) {
  +			if (FAILURE == php_variant_to_zval(&vv, element, codepage)) {
   				/* Error occurred setting up array element */
   				/* Error was displayed by the recursive call */
   				FREE_ZVAL(element);
  @@ -541,52 +523,52 @@
   				/* break; */
   			} else {
   				/* Just insert the element into our return array */
  -				add_index_zval(pval_arg, ii, element);
  +				add_index_zval(zval_arg, ii, element);
   			}
   		}
   		SafeArrayUnlock(array);
   	} else switch (var_arg->vt & ~VT_BYREF) {
   		case VT_EMPTY:
  -			ZVAL_NULL(pval_arg);
  +			ZVAL_NULL(zval_arg);
   			break;
   
   		case VT_UI1:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_LONG(pval_arg, (long)*V_UI1REF(var_arg));
  +				ZVAL_LONG(zval_arg, (long)*V_UI1REF(var_arg));
   			} else {
  -				ZVAL_LONG(pval_arg, (long)V_UI1(var_arg));
  +				ZVAL_LONG(zval_arg, (long)V_UI1(var_arg));
   			}
   			break;
   
   		case VT_I2:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_LONG(pval_arg, (long )*V_I2REF(var_arg));
  +				ZVAL_LONG(zval_arg, (long )*V_I2REF(var_arg));
   			} else {
  -				ZVAL_LONG(pval_arg, (long)V_I2(var_arg));
  +				ZVAL_LONG(zval_arg, (long)V_I2(var_arg));
   			}
   			break;
   
   		case VT_I4:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_LONG(pval_arg, *V_I4REF(var_arg));
  +				ZVAL_LONG(zval_arg, *V_I4REF(var_arg));
   			} else {
  -				ZVAL_LONG(pval_arg, V_I4(var_arg));
  +				ZVAL_LONG(zval_arg, V_I4(var_arg));
   			}
   			break;
   
   		case VT_R4:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_DOUBLE(pval_arg, (double)*V_R4REF(var_arg));
  +				ZVAL_DOUBLE(zval_arg, (double)*V_R4REF(var_arg));
   			} else {
  -				ZVAL_DOUBLE(pval_arg, (double)V_R4(var_arg));
  +				ZVAL_DOUBLE(zval_arg, (double)V_R4(var_arg));
   			}
   			break;
   
   		case VT_R8:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_DOUBLE(pval_arg, *V_R8REF(var_arg));
  +				ZVAL_DOUBLE(zval_arg, *V_R8REF(var_arg));
   			} else {
  -				ZVAL_DOUBLE(pval_arg, V_R8(var_arg));
  +				ZVAL_DOUBLE(zval_arg, V_R8(var_arg));
   			}
   			break;
   
  @@ -595,12 +577,12 @@
   				OLECHAR *unicode_str;
   				switch (VarBstrFromDec(&V_DECIMAL(var_arg), LOCALE_SYSTEM_DEFAULT, 0, &unicode_str)) {
   					case S_OK:
  -						Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
  -						Z_TYPE_P(pval_arg) = IS_STRING;
  +						Z_STRVAL_P(zval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(zval_arg), codepage, FALSE);
  +						Z_TYPE_P(zval_arg) = IS_STRING;
   						break;
   
   					default:
  -						ZVAL_NULL(pval_arg);
  +						ZVAL_NULL(zval_arg);
   						ret = FAILURE;
   						php_error(E_WARNING, "Error converting DECIMAL value to PHP string");
   						break;
  @@ -611,53 +593,53 @@
   		/* Currency */
   		case VT_CY:
   			if (V_ISBYREF(var_arg)) {
  -				VarR8FromCy(*V_CYREF(var_arg), &Z_DVAL_P(pval_arg));
  +				VarR8FromCy(*V_CYREF(var_arg), &Z_DVAL_P(zval_arg));
   			} else {
  -				VarR8FromCy(V_CY(var_arg), &Z_DVAL_P(pval_arg));
  +				VarR8FromCy(V_CY(var_arg), &Z_DVAL_P(zval_arg));
   			}
  -			Z_TYPE_P(pval_arg) = IS_DOUBLE;
  +			Z_TYPE_P(zval_arg) = IS_DOUBLE;
   			break;
   
   		case VT_BOOL:
   			if (V_ISBYREF(var_arg)) {
   				if (*V_BOOLREF(var_arg)) {
  -					ZVAL_BOOL(pval_arg, Z_TRUE);
  +					ZVAL_BOOL(zval_arg, Z_TRUE);
   				} else {
  -					ZVAL_BOOL(pval_arg, Z_FALSE);
  +					ZVAL_BOOL(zval_arg, Z_FALSE);
   				}
   			} else {
   				if (V_BOOL(var_arg)) {
  -					ZVAL_BOOL(pval_arg, Z_TRUE);
  +					ZVAL_BOOL(zval_arg, Z_TRUE);
   				} else {
  -					ZVAL_BOOL(pval_arg, Z_FALSE);
  +					ZVAL_BOOL(zval_arg, Z_FALSE);
   				}
   			}
   			break;
   
   		case VT_NULL:
   		case VT_VOID:
  -			ZVAL_NULL(pval_arg);
  +			ZVAL_NULL(zval_arg);
   			break;
   
   		case VT_VARIANT:
  -			php_variant_to_pval(V_VARIANTREF(var_arg), pval_arg, codepage TSRMLS_CC);
  +			php_variant_to_zval(V_VARIANTREF(var_arg), zval_arg, codepage);
   			break;
   
   		case VT_BSTR:
  -			Z_TYPE_P(pval_arg) = IS_STRING;
  +			Z_TYPE_P(zval_arg) = IS_STRING;
   
   			if (V_ISBYREF(var_arg)) {
   				if (*V_BSTR(var_arg)) {
  -					Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
  +					Z_STRVAL_P(zval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(zval_arg), codepage, FALSE);
   				} else {
  -					ZVAL_NULL(pval_arg);
  +					ZVAL_NULL(zval_arg);
   				}
   				efree(V_BSTRREF(var_arg));
   			} else {
   				if (V_BSTR(var_arg)) {
  -					Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
  +					Z_STRVAL_P(zval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(zval_arg), codepage, FALSE);
   				} else {
  -					ZVAL_NULL(pval_arg);
  +					ZVAL_NULL(zval_arg);
   				}
   			}
   
  @@ -686,7 +668,7 @@
   					phptime.tm_isdst = -1;
   
   					tzset();
  -					ZVAL_LONG(pval_arg, mktime(&phptime));
  +					ZVAL_LONG(zval_arg, mktime(&phptime));
   				} else {
   					ret = FAILURE;
   				}
  @@ -704,7 +686,7 @@
   				if (FAILED(hr)) {
   					char *error_message;
   
  -					error_message = php_COM_error_message(hr TSRMLS_CC);
  +					error_message = php_COM_error_message(hr);
   					php_error(E_WARNING,"Unable to obtain IDispatch interface:  %s", error_message);
   					LocalFree(error_message);
   
  @@ -714,63 +696,64 @@
   			/* break missing intentionaly */
   		case VT_DISPATCH: {
   				comval *obj;
  +				TSRMLS_FETCH();
   
   				if (V_DISPATCH(var_arg) == NULL) {
   					ret = FAILURE;
  -					ZVAL_NULL(pval_arg);
  +					ZVAL_NULL(zval_arg);
   				} else {
   					ALLOC_COM(obj);
  -					php_COM_set(obj, &V_DISPATCH(var_arg), FALSE TSRMLS_CC);
  +					php_COM_set(obj, &V_DISPATCH(var_arg), FALSE);
   					
  -					ZVAL_COM(pval_arg, obj);
  -					VariantInit(var_arg);	// to protect C_DISPATCH(obj) from being freed when var_result is destructed
  +					ZVAL_COM(zval_arg, obj);
  +					VariantInit(var_arg);	/* to protect C_DISPATCH(obj) from being freed when var_result is destructed */
   				}
   			}
   			break;
   
   		case VT_I1:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_LONG(pval_arg, (long)*V_I1REF(var_arg));
  +				ZVAL_LONG(zval_arg, (long)*V_I1REF(var_arg));
   			} else {
  -				ZVAL_LONG(pval_arg, (long)V_I1(var_arg));
  +				ZVAL_LONG(zval_arg, (long)V_I1(var_arg));
   			}
   			break;
   
   		case VT_UI2:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_LONG(pval_arg, (long)*V_UI2REF(var_arg));
  +				ZVAL_LONG(zval_arg, (long)*V_UI2REF(var_arg));
   			} else {
  -				ZVAL_LONG(pval_arg, (long)V_UI2(var_arg));
  +				ZVAL_LONG(zval_arg, (long)V_UI2(var_arg));
   			}
   			break;
   
   		case VT_UI4:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_LONG(pval_arg, (long)*V_UI4REF(var_arg));
  +				ZVAL_LONG(zval_arg, (long)*V_UI4REF(var_arg));
   			} else {
  -				ZVAL_LONG(pval_arg, (long)V_UI4(var_arg));
  +				ZVAL_LONG(zval_arg, (long)V_UI4(var_arg));
   			}
   			break;
   
   		case VT_INT:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_LONG(pval_arg, (long)*V_INTREF(var_arg));
  +				ZVAL_LONG(zval_arg, (long)*V_INTREF(var_arg));
   			} else {
  -				ZVAL_LONG(pval_arg, (long)V_INT(var_arg));
  +				ZVAL_LONG(zval_arg, (long)V_INT(var_arg));
   			}
   			break;
   
   		case VT_UINT:
   			if (V_ISBYREF(var_arg)) {
  -				ZVAL_LONG(pval_arg, (long)*V_UINTREF(var_arg));
  +				ZVAL_LONG(zval_arg, (long)*V_UINTREF(var_arg));
   			} else {
  -				ZVAL_LONG(pval_arg, (long)V_UINT(var_arg));
  +				ZVAL_LONG(zval_arg, (long)V_UINT(var_arg));
   			}
   			break;
   
   		default:
   			php_error(E_WARNING,"Unsupported variant type: %d (0x%X)", V_VT(var_arg), V_VT(var_arg));
  -			ZVAL_NULL(pval_arg);
  +			ZVAL_NULL(zval_arg);
   			ret = FAILURE;
   			break;
   	}
  @@ -778,7 +761,7 @@
   }
   
   
  -PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage TSRMLS_DC)
  +PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage, int persist)
   {
   	BOOL error = FALSE;
   	OLECHAR *unicode_str;
  @@ -792,13 +775,13 @@
   	}
   
   	if (strlen >= 0) {
  -		unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR) * strlen);
  +		unicode_str = (OLECHAR *) pemalloc(sizeof(OLECHAR) * strlen, persist);
   
   		/* convert string */
   		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));
  +		unicode_str = (OLECHAR *) pemalloc(sizeof(OLECHAR), persist);
   		*unicode_str = 0;
   
   		error = TRUE;
  @@ -821,7 +804,7 @@
   }
   
   
  -PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage TSRMLS_DC)
  +PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage, int persist)
   {
   	char *C_str;
   	uint length = 0;
  @@ -830,12 +813,12 @@
   	uint reqSize = WideCharToMultiByte(codepage, codepage == CP_UTF8 ? 0 : WC_COMPOSITECHECK, unicode_str, -1, NULL, 0, NULL, NULL);
   
   	if (reqSize) {
  -		C_str = (char *) emalloc(sizeof(char) * reqSize);
  +		C_str = (char *) pemalloc(sizeof(char) * reqSize, persist);
   
   		/* convert string */
   		length = WideCharToMultiByte(codepage, codepage == CP_UTF8 ? 0 : WC_COMPOSITECHECK, unicode_str, -1, C_str, reqSize, NULL, NULL) - 1;
   	} else {
  -		C_str = (char *) emalloc(sizeof(char));
  +		C_str = (char *) pemalloc(sizeof(char), persist);
   		*C_str = 0;
   
   		php_error(E_WARNING,"Error in php_OLECHAR_to_char()");
  @@ -848,21 +831,21 @@
   	return C_str;
   }
   
  -
  -static void comval_to_variant(pval *pval_arg, VARIANT *var_arg TSRMLS_DC)
  +static int comval_to_variant(zval *object, VARIANT *var_arg)
   {
  -	pval **comval_handle;
  -	comval *obj;
  -	int type;
  -
  -	/* fetch the comval structure */
  -	zend_hash_index_find(Z_OBJPROP_P(pval_arg), 0, (void **) &comval_handle);
  -	obj = (comval *)zend_list_find(Z_LVAL_P(*comval_handle), &type);
  -	if (!obj || (type != IS_COM) || !C_ISREFD(obj)) {
  +	rpc_internal *intern;
  +	TSRMLS_FETCH();
  +
  +	if (GET_INTERNAL_EX(intern, object) != SUCCESS) {
  +		/* TODO exception */
   		VariantInit(var_arg);
  +
  +		return FAILURE;
   	} else {
   		V_VT(var_arg) = VT_DISPATCH;
  -		V_DISPATCH(var_arg) = C_DISPATCH(obj);
  +		V_DISPATCH(var_arg) = C_DISPATCH((comval *) intern->data);
  +
  +		return SUCCESS;
   	}
   }
   
  
  
  
  1.1.2.2   +25 -6     php4/ext/rpc/com/Attic/conversion.h
  
  Index: conversion.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/Attic/conversion.h,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- conversion.h	10 Jul 2002 01:53:51 -0000	1.1.2.1
  +++ conversion.h	3 Aug 2002 00:44:16 -0000	1.1.2.2
  @@ -1,3 +1,22 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   |         Alan Brown <abrow****@pobox*****>                                |
  +   +----------------------------------------------------------------------+
  + */
  +
   #ifndef CONVERSION_H
   #define CONVERSION_H
   
  @@ -11,12 +30,12 @@
   
   BEGIN_EXTERN_C()
   
  -PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage TSRMLS_DC);
  -PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage TSRMLS_DC);
  -PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC);
  -PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TSRMLS_DC);
  -PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage TSRMLS_DC);
  -PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage TSRMLS_DC);
  +ZEND_API void php_zval_to_variant(zval *zval_arg, VARIANT *var_arg, int codepage);
  +ZEND_API void php_zval_to_variant_ex(zval *zval_arg, VARIANT *var_arg, int type, int codepage);
  +ZEND_API int php_variant_to_zval(VARIANT *var_arg, zval *zval_arg, int codepage);
  +
  +ZEND_API OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage, int persist);
  +ZEND_API char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage, int persist);
   
   END_EXTERN_C()
   
  
  
  
  1.1.2.2   +28 -25    php4/ext/rpc/com/Attic/dispatch.c
  
  Index: dispatch.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/Attic/dispatch.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- dispatch.c	10 Jul 2002 01:53:51 -0000	1.1.2.1
  +++ dispatch.c	3 Aug 2002 00:44:16 -0000	1.1.2.2
  @@ -16,16 +16,18 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: dispatch.c,v 1.3 2002/05/30 23:07:21 phanto Exp $ */
  +/* $Id: dispatch.c,v 1.4 2002/07/18 18:31:36 phanto Exp $ */
   
   /* 
    * This module is used to export PHP objects to COM and DOTNET by exposing
    * them as objects implementing IDispatch.
    * */
   
  +#include "../rpc.h"
  +
   #include "php.h"
  -#include "php_COM.h"
  -#include "php_VARIANT.h"
  +#include "com.h"
  +#include "com_wrapper.h"
   #include "conversion.h"
   #include "variant.h"
   
  @@ -177,7 +179,7 @@
   		unsigned int namelen;
   		zval **tmp;
   		
  -		name = php_OLECHAR_to_char(rgszNames[i], &namelen, CP_ACP TSRMLS_CC);
  +		name = php_OLECHAR_to_char(rgszNames[i], &namelen, CP_ACP, FALSE);
   		
   		/* Lookup the name in the hash */
   		if (zend_hash_find(disp->name_to_dispid, name, namelen+1, (void**)&tmp) == FAILURE) {
  @@ -223,7 +225,7 @@
   	TSRMLS_FETCH();
   	FETCH_DISP("GetDispID");
   
  -	name = php_OLECHAR_to_char(bstrName, &namelen, CP_ACP TSRMLS_CC);
  +	name = php_OLECHAR_to_char(bstrName, &namelen, CP_ACP, FALSE);
   
   	/* Lookup the name in the hash */
   	if (zend_hash_find(disp->name_to_dispid, name, namelen+1, (void**)&tmp) == SUCCESS) {
  @@ -275,13 +277,13 @@
   			
   			if (V_VT(arg) == VT_DISPATCH) {
   				trace("arg %d is dispatchable\n", i);
  -				if (NULL == php_COM_object_from_dispatch(V_DISPATCH(arg), zarg TSRMLS_CC)) {
  +				if ((zarg = php_COM_object_from_dispatch(V_DISPATCH(arg))) == NULL) {
   					trace("failed to convert arg %d to zval\n", i);
   					ZVAL_NULL(zarg);
   				}
   			} else {
  -				// arg can't be an idispatch, so we don't care for the implicit AddRef() call here
  -				if (FAILURE == php_variant_to_pval(arg, zarg, codepage TSRMLS_CC)) {
  +				/* arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
  +				if (FAILURE == php_variant_to_zval(arg, zarg, codepage)) {
   					trace("failed to convert arg %d to zval\n", i);
   					ZVAL_NULL(zarg);
   				}
  @@ -322,9 +324,9 @@
   					/* export the object using a dispatch like ourselves */
   					VariantInit(pvarRes);
   					V_VT(pvarRes) = VT_DISPATCH;
  -					V_DISPATCH(pvarRes) = php_COM_export_object(retval TSRMLS_CC);
  +					V_DISPATCH(pvarRes) = php_COM_export_object(retval);
   				} else {
  -					php_pval_to_variant(retval, pvarRes, codepage TSRMLS_CC);
  +					php_zval_to_variant(retval, pvarRes, codepage);
   				}
   			}
   			zval_ptr_dtor(&retval);
  @@ -379,7 +381,7 @@
   	FETCH_DISP("GetMemberName");
   
   	if (SUCCESS == zend_hash_index_find(disp->dispid_to_name, id, (void**)&name)) {
  -		OLECHAR *olestr = php_char_to_OLECHAR(Z_STRVAL_P(name), Z_STRLEN_P(name), CP_ACP TSRMLS_CC);
  +		OLECHAR *olestr = php_char_to_OLECHAR(Z_STRVAL_P(name), Z_STRLEN_P(name), CP_ACP, FALSE);
   		*pbstrName = SysAllocString(olestr);
   		efree(olestr);
   		return S_OK;
  @@ -511,7 +513,7 @@
   	}
   }
   
  -static php_dispatchex *disp_constructor(zval *object TSRMLS_DC)
  +static php_dispatchex *disp_constructor(zval *object)
   {
   	php_dispatchex *disp = (php_dispatchex*)CoTaskMemAlloc(sizeof(php_dispatchex));
   
  @@ -559,9 +561,9 @@
   	CoTaskMemFree(disp);
   }
   
  -PHPAPI IDispatch *php_COM_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name TSRMLS_DC)
  +PHPAPI IDispatch *php_COM_export_as_sink(zval *val, GUID *sinkid, HashTable *id_to_name)
   {
  -	php_dispatchex *disp = disp_constructor(val TSRMLS_CC);
  +	php_dispatchex *disp = disp_constructor(val);
   	HashPosition pos;
   	char *name = NULL;
   	zval *tmp, **ntmp;
  @@ -596,31 +598,32 @@
   	return (IDispatch*)disp;
   }
   
  -PHPAPI IDispatch *php_COM_export_object(zval *val TSRMLS_DC)
  +PHPAPI IDispatch *php_COM_export_object(zval *val)
   {
   	php_dispatchex *disp = NULL;
  +	TSRMLS_FETCH();
   
   	if (Z_TYPE_P(val) != IS_OBJECT)
   		return NULL;
   
  -	if (Z_OBJCE_P(val) == &COM_class_entry || !strcmp(Z_OBJCE_P(val)->name, "COM")) {
  +	if (Z_OBJCE_P(val) == com_class_entry) {
   		/* pass back it's IDispatch directly */
  -		zval **tmp;
   		comval *obj;
  -		int type;
  -		
  -		zend_hash_index_find(Z_OBJPROP_P(val), 0, (void**)&tmp);
  -		obj = (comval *)zend_list_find(Z_LVAL_PP(tmp), &type);
  -		if (type != IS_COM)
  -			return NULL;
  +		rpc_internal *intern;
  +
  +		if (GET_INTERNAL_EX(intern, val) != SUCCESS) {
  +			/* TODO: exception */
  +		}
  +
  +		obj = (comval *) intern->data;
   
   		C_DISPATCH(obj)->lpVtbl->AddRef(C_DISPATCH(obj));
   		return C_DISPATCH(obj);
   	}
   
  -	disp = disp_constructor(val TSRMLS_CC);
  +	disp = disp_constructor(val);
   	generate_dispids(disp TSRMLS_CC);
  -
  + 
   	return (IDispatch*)disp;
   }
   
  
  
  
  1.1.2.2   +204 -224  php4/ext/rpc/com/Attic/variant.c
  
  Index: variant.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/Attic/variant.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- variant.c	10 Jul 2002 01:53:51 -0000	1.1.2.1
  +++ variant.c	3 Aug 2002 00:44:16 -0000	1.1.2.2
  @@ -13,6 +13,7 @@
      | licen****@php***** so we can mail you a copy immediately.               |
      +----------------------------------------------------------------------+
      | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   |         Alan Brown   <abrow****@pobox*****>                              |
      +----------------------------------------------------------------------+
    */
   
  @@ -29,25 +30,52 @@
   #include "php.h"
   #include "php_ini.h"
   #include "ext/standard/info.h"
  -#include "php_VARIANT.h"
  +#include "conversion.h"
  +#include "variant.h"
   
   #include <unknwn.h> 
   
  -static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value TSRMLS_DC);
  -static int php_VARIANT_set_property_handler(zend_property_reference *property_reference, pval *value);
  -static pval php_VARIANT_get_property_handler(zend_property_reference *property_reference);
  -static void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
  -static void php_VARIANT_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
  -static void php_register_VARIANT_class(TSRMLS_D);
  -
  -static int le_variant;
  -static int codepage;
  -static zend_class_entry VARIANT_class_entry;
  +static zend_object_value variant_objects_new(zend_class_entry * TSRMLS_DC);
  +static void variant_objects_delete(void *, zend_object_handle TSRMLS_DC);
   
  +/* object handler */
  +static zval* variant_read(zval *, zval *, int  TSRMLS_DC);
  +static void variant_write(zval *, zval *, zval * TSRMLS_DC);
  +static union _zend_function* variant_get_constructor(zval * TSRMLS_DC);
  +static zend_class_entry* variant_get_class_entry(zval * TSRMLS_DC);
  +/**/
  +
  +static HashTable types;
  +static zend_class_entry *variant_class_entry;
  +static zend_function *variant_ctor;
  +static zend_object_handlers variant_handlers = {
  +	ZEND_OBJECTS_STORE_HANDLERS,
  +
  +	variant_read,
  +	variant_write,
  +	NULL,
  +	NULL,
  +	NULL,
  +	NULL,
  +	NULL,
  +	NULL,
  +	NULL,
  +	NULL,
  +	NULL,
  +	NULL,
  +	NULL,
  +	variant_get_constructor,
  +	variant_get_class_entry,
  +	NULL,
  +	NULL
  +};
   
  -void php_VARIANT_init(int module_number TSRMLS_DC)
  +/**/
  +void php_variant_init(int module_number TSRMLS_DC)
   {
  -	le_variant = zend_register_list_destructors_ex(php_VARIANT_destructor, NULL, "VARIANT", module_number);
  +	zend_internal_function *zif;
  +	zend_class_entry ce;
  +	int type;
   
   	/* variant datatypes */
   	REGISTER_LONG_CONSTANT("VT_NULL", VT_NULL, CONST_CS | CONST_PERSISTENT);
  @@ -84,259 +112,211 @@
   #ifdef CP_SYMBOL
   	REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, CONST_CS | CONST_PERSISTENT);
   #else
  -#	error	"CP_SYMBOL undefined"
  +#error "CP_SYMBOL undefined"
   #endif
   #ifdef CP_THREAD_ACP
   	REGISTER_LONG_CONSTANT("CP_THREAD_ACP", CP_THREAD_ACP, CONST_CS | CONST_PERSISTENT);
   #else
  -#	error	"CP_THREAD_ACP undefined"
  +#error "CP_THREAD_ACP undefined"
   #endif
   
  -	php_register_VARIANT_class(TSRMLS_C);
  +	INIT_CLASS_ENTRY(ce, "variant", NULL);
  +	ce.create_object = variant_objects_new;
  +	variant_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
  +
  +	zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
  +
  +	zif->type = ZEND_INTERNAL_FUNCTION;
  +	zif->function_name = variant_class_entry->name;
  +	zif->scope = variant_class_entry;
  +	zif->arg_types = NULL;
  +	zif->handler = ZEND_FN(variant_load);
  +
  +	/* add new constructor to the method table */
  +	zend_hash_add(&(variant_class_entry->function_table), variant_class_entry->name,
  +					variant_class_entry->name_length + 1, zif, sizeof(zend_function), &variant_ctor);
  +	efree(zif);
  +
  +	zend_hash_init(&types, 0, NULL, NULL, TRUE);
  +
  +	type = VT_UI1;
  +	zend_hash_add(&types, "bVal",		5,  (void *) &type, sizeof(int), NULL);
  +	type = VT_UI2;
  +	zend_hash_add(&types, "uiVal",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_UI4;
  +	zend_hash_add(&types, "ulVal",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_UINT;
  +	zend_hash_add(&types, "uintVal",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_I1;
  +	zend_hash_add(&types, "cVal",		5,  (void *) &type, sizeof(int), NULL);
  +	type = VT_I2;
  +	zend_hash_add(&types, "iVal",		5,  (void *) &type, sizeof(int), NULL);
  +	type = VT_I4;
  +	zend_hash_add(&types, "lVal",		5,  (void *) &type, sizeof(int), NULL);
  +	type = VT_INT;
  +	zend_hash_add(&types, "intVal",		7,  (void *) &type, sizeof(int), NULL);
  +	type = VT_R4;
  +	zend_hash_add(&types, "fltVal",		7,  (void *) &type, sizeof(int), NULL);
  +	type = VT_R8;
  +	zend_hash_add(&types, "dblVal",		7,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BOOL;
  +	zend_hash_add(&types, "boolVal",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_ERROR;
  +	zend_hash_add(&types, "scode",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_CY;
  +	zend_hash_add(&types, "cyVal",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_DATE;
  +	zend_hash_add(&types, "date",		5,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BSTR;
  +	zend_hash_add(&types, "bstrVal",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_UNKNOWN;
  +	zend_hash_add(&types, "punkVal",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_DISPATCH;
  +	zend_hash_add(&types, "pdispVal",	9,  (void *) &type, sizeof(int), NULL);
  +	type = VT_ARRAY;
  +	zend_hash_add(&types, "parray",		7,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF;
  +	zend_hash_add(&types, "byref",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_UI1;
  +	zend_hash_add(&types, "pbVal",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_UI2;
  +	zend_hash_add(&types, "puiVal",		7,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_UI4;
  +	zend_hash_add(&types, "pulVal",		7,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_UINT;
  +	zend_hash_add(&types, "puintVal",	9,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_I1;
  +	zend_hash_add(&types, "pcVal",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_I2;
  +	zend_hash_add(&types, "piVal",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_I4;
  +	zend_hash_add(&types, "plVal",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_INT;
  +	zend_hash_add(&types, "pintVal",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_R4;
  +	zend_hash_add(&types, "pfltVal",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_R8;
  +	zend_hash_add(&types, "pdblVal",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_BOOL;
  +	zend_hash_add(&types, "pboolVal",	9,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_ERROR;
  +	zend_hash_add(&types, "pscode",		7,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_CY;
  +	zend_hash_add(&types, "pcyVal",		7,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_DATE;
  +	zend_hash_add(&types, "pdate",		6,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_BSTR;
  +	zend_hash_add(&types, "pbstrVal",	9,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_DECIMAL;
  +	zend_hash_add(&types, "pdecVal",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_UNKNOWN;
  +	zend_hash_add(&types, "ppunkVal",	9,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_DISPATCH;
  +	zend_hash_add(&types, "ppdispVal",	10, (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_ARRAY;
  +	zend_hash_add(&types, "pparray",	8,  (void *) &type, sizeof(int), NULL);
  +	type = VT_BYREF|VT_VARIANT;
  +	zend_hash_add(&types, "pvarVal",	8,  (void *) &type, sizeof(int), NULL);
   }
   
  -
  -PHPAPI int php_VARIANT_get_le_variant()
  +void php_variant_shutdown(TSRMLS_D)
   {
  -	return le_variant;
  +	zend_hash_destroy(&types);
   }
   
  -
  -static void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
  +static zend_object_value variant_objects_new(zend_class_entry *ce TSRMLS_DC)
   {
  -	pval *object = property_reference->object;
  -	zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
  -	VARIANT *pVar;
  -
  -	if ((zend_llist_count(property_reference->elements_list)==1) && !strcmp(Z_STRVAL(function_name->element), "variant")) {
  -		/* constructor */
  -		pval *object_handle, *data, *type, *code_page;
  -
  -		ALLOC_VARIANT(pVar);
  -		VariantInit(pVar);
  -
  -		switch (ZEND_NUM_ARGS()) {
  -			case 0:
  -				/* nothing to do */
  -				break;
  -			case 1:
  -				zend_get_parameters(ht, 1, &data);
  -				php_pval_to_variant(data, pVar, codepage TSRMLS_CC);
  -				codepage = CP_ACP;
  -				break;
  -			case 2:
  -				zend_get_parameters(ht, 2, &data, &type);
  -				php_pval_to_variant_ex(data, pVar, type, codepage TSRMLS_CC);
  -				codepage = CP_ACP;
  -				break;
  -			case 3:
  -				zend_get_parameters(ht, 3, &data, &type, &code_page);
  -				php_pval_to_variant_ex(data, pVar, type, codepage TSRMLS_CC);
  -				convert_to_long(code_page);
  -				codepage = Z_LVAL_P(code_page);
  -				break;
  -			default:
  -				ZEND_WRONG_PARAM_COUNT();
  -				break;
  -		}
  +	zend_object_value *zov;
  +	variantval *var;
   
  -		RETVAL_LONG(zend_list_insert(pVar, IS_VARIANT));
  +	ALLOC_VARIANT(var);
  +	
  +	/* set up the object value struct */
  +	zov = (zend_object_value*) emalloc(sizeof(zend_object_value));
  +	zov->handlers = &variant_handlers;
  +	zov->handle = zend_objects_store_put(var, variant_objects_delete, NULL TSRMLS_CC);
   
  -		if (!zend_is_true(return_value)) {
  -			ZVAL_FALSE(object);
  -			return;
  -		}
  -
  -		ALLOC_ZVAL(object_handle);
  -		*object_handle = *return_value;
  -		pval_copy_constructor(object_handle);
  -		INIT_PZVAL(object_handle);
  -		zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
  -		zval_dtor(&function_name->element);
  -	}
  +	return *zov;
   }
   
  +static void variant_objects_delete(void *object, zend_object_handle handle TSRMLS_DC)
  +{
  +	FREE_VARIANT((variantval *)object);
  +}
   
  -static pval php_VARIANT_get_property_handler(zend_property_reference *property_reference)
  +static zval* variant_read(zval *object, zval *member, int type TSRMLS_DC)
   {
  -	zend_overloaded_element *overloaded_property;
  -	int type;
  -	pval result, **var_handle, *object = property_reference->object;
  -	VARIANT *var_arg;
  -	TSRMLS_FETCH();
  +	variantval *var;
  +	zval *result;
   
  +	ALLOC_ZVAL(result);
   
  -	/* fetch the VARIANT structure */
  -	zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &var_handle);
  -	var_arg = zend_list_find(Z_LVAL_PP(var_handle), &type);
  +	if ((var = zend_object_store_get_object(object TSRMLS_CC)) == NULL) {
  +		/* exception */
  +	}
   
  -	if (!var_arg || (type != IS_VARIANT)) {
  -		ZVAL_FALSE(&result);
  +	if (!strcmp(Z_STRVAL_P(member), "value")) {
  +		/* var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here */
  +		php_variant_to_zval(var->var, result, var->codepage);
  +	} else if (!strcmp(Z_STRVAL_P(member), "type")) {
  +		ZVAL_LONG(result, V_VT(var->var));
   	} else {
  -		overloaded_property = (zend_overloaded_element *) property_reference->elements_list->head->data;
  -		switch (Z_TYPE_P(overloaded_property)) {
  -			case OE_IS_ARRAY:
  -				ZVAL_FALSE(&result);
  -				break;
  -
  -			case OE_IS_OBJECT:
  -				if (!strcmp(Z_STRVAL(overloaded_property->element), "value")) {
  -					// var_arg can't be an idispatch, so we don't care for the implicit AddRef() call here
  -					php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC);
  -				} else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) {
  -					ZVAL_LONG(&result, V_VT(var_arg))
  -				} else {
  -					ZVAL_FALSE(&result);
  -					php_error(E_WARNING, "Unknown member.");
  -				}
  -				break;
  -			case OE_IS_METHOD:
  -				ZVAL_FALSE(&result);
  -				php_error(E_WARNING, "Unknown method.");
  -				break;
  -
  -				zval_dtor(&overloaded_property->element);
  -		}
  +		ZVAL_FALSE(result);
  +		php_error(E_WARNING, "Unknown member.");
   	}
   
   	return result;
   }
   
  -
  -static int php_VARIANT_set_property_handler(zend_property_reference *property_reference, pval *value)
  +static void variant_write(zval *object, zval *member, zval *value TSRMLS_DC)
   {
  -	zend_overloaded_element *overloaded_property;
  -	int type;
  -	pval **var_handle, *object = property_reference->object;
  -	VARIANT *var_arg;
  -	TSRMLS_FETCH();
  -
  +	int *type;
  +	variantval *var;
   
  -	/* fetch the VARIANT structure */
  -	zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &var_handle);
  -	var_arg = zend_list_find(Z_LVAL_PP(var_handle), &type);
  -
  -	if (!var_arg || (type != IS_VARIANT)) {
  -		return FAILURE;
  +	if ((var = zend_object_store_get_object(object TSRMLS_CC)) == NULL) {
  +		/* exception */
   	}
   
  -	overloaded_property = (zend_overloaded_element *) property_reference->elements_list->head->data;
  -	do_VARIANT_propset(var_arg, &overloaded_property->element, value TSRMLS_CC);
  -	zval_dtor(&overloaded_property->element);
  -	return SUCCESS;
  -}
  -
  -
  -static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value TSRMLS_DC)
  -{
  -	int type;
  -
  -	if (!strcmp(Z_STRVAL_P(arg_property), "value")) {
  -		php_pval_to_variant(value, var_arg, codepage TSRMLS_CC);
  -
  -		return SUCCESS;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "bVal")) {
  -		type = VT_UI1;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "iVal")) { 
  -		type = VT_I2;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "lVal")) {
  -		type = VT_I4;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "fltVal")) {
  -		type = VT_R4;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "dblVal")) {
  -		type = VT_R8;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "boolVal")) {
  -		type = VT_BOOL;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "scode")) {
  -		type = VT_ERROR;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "cyVal")) {
  -		type = VT_CY;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "date")) {
  -		type = VT_DATE;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "bstrVal")) {
  -		type = VT_BSTR;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pdecVal")) {
  -		type = VT_DECIMAL|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "punkVal")) {
  -		type = VT_UNKNOWN;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pdispVal")) {
  -		type = VT_DISPATCH;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "parray")) {
  -		type = VT_ARRAY;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pbVal")) {
  -		type = VT_UI1|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "piVal")) {
  -		type = VT_I2|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "plVal")) {
  -		type = VT_I4|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pfltVal")) {
  -		type = VT_R4|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pdblVal")) {
  -		type = VT_R8|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pboolVal")) {
  -		type = VT_BOOL|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pscode")) {
  -		type = VT_ERROR|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pcyVal")) {
  -		type = VT_CY|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pdate")) {
  -		type = VT_DATE|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pbstrVal")) {
  -		type = VT_BSTR|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "ppunkVal")) {
  -		type = VT_UNKNOWN|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "ppdispVal")) {
  -		type = VT_DISPATCH|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pparray")) {
  -		type = VT_ARRAY|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pvarVal")) {
  -		type = VT_VARIANT|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "byref")) {
  -		type = VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "cVal")) {
  -		type = VT_I1;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "uiVal")) {
  -		type = VT_UI2;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "ulVal")) {
  -		type = VT_UI4;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "intVal")) {
  -		type = VT_INT;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "uintVal")) {
  -		type = VT_UINT|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pcVal")) {
  -		type = VT_I1|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "puiVal")) {
  -		type = VT_UI2|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pulVal")) {
  -		type = VT_UI4|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "pintVal")) {
  -		type = VT_INT|VT_BYREF;
  -	} else if (!strcmp(Z_STRVAL_P(arg_property), "puintVal")) {
  -		type = VT_UINT|VT_BYREF;
  +	if (!strcmp(Z_STRVAL_P(member), "value")) {
  +		php_zval_to_variant(value, var->var, var->codepage);
  +	} else if (zend_hash_find(&types, Z_STRVAL_P(member), Z_STRLEN_P(member) + 1, (void **) &type) == SUCCESS) {
  +		php_zval_to_variant_ex(value, var->var, *type, var->codepage);
   	} else {
   		php_error(E_WARNING, "Unknown member.");
  -		return FAILURE;
   	}
  -
  -	php_pval_to_variant_ex2(value, var_arg, type, codepage TSRMLS_CC);
  -
  -	return SUCCESS;
   }
   
  +static union _zend_function* variant_get_constructor(zval *object TSRMLS_DC)
  +{
  +	return variant_ctor;
  +}
   
  -static void php_VARIANT_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
  +static zend_class_entry* variant_get_class_entry(zval *object TSRMLS_DC)
   {
  -	FREE_VARIANT(rsrc->ptr);
  +	return variant_class_entry;
   }
   
  -static void php_register_VARIANT_class(TSRMLS_D)
  +/**/
  +/* constructor */
  +ZEND_FUNCTION(variant_load)
   {
  -	INIT_OVERLOADED_CLASS_ENTRY(VARIANT_class_entry, "VARIANT", NULL,
  -								php_VARIANT_call_function_handler,
  -								php_VARIANT_get_property_handler,
  -								php_VARIANT_set_property_handler);
  +	zval *value = NULL, *object = getThis();
  +	variantval *var;
  +	long type = 0;
  +
  +	if (!object || ((var = zend_object_store_get_object(object TSRMLS_CC)) == NULL)) {
  +		/*TODO exception */
  +	}
  +
  +	zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zll", &value, &type, &(var->codepage));
   
  -	zend_register_internal_class(&VARIANT_class_entry TSRMLS_CC);
  +	if (value) {
  +		if (type) {
  +			php_zval_to_variant_ex(value, var->var, type, var->codepage);
  +		} else {
  +			php_zval_to_variant(value, var->var, var->codepage);
  +		}
  +	}
   }
   
   #endif /* PHP_WIN32 */
  
  
  
  1.1.2.2   +57 -21    php4/ext/rpc/com/Attic/variant.h
  
  Index: variant.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/rpc/com/Attic/variant.h,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- variant.h	10 Jul 2002 01:53:51 -0000	1.1.2.1
  +++ variant.h	3 Aug 2002 00:44:16 -0000	1.1.2.2
  @@ -1,31 +1,67 @@
  +/*
  +   +----------------------------------------------------------------------+
  +   | PHP Version 4                                                        |
  +   +----------------------------------------------------------------------+
  +   | Copyright (c) 1997-2002 The PHP Group                                |
  +   +----------------------------------------------------------------------+
  +   | This source file is subject to version 2.02 of the PHP license,      |
  +   | that is bundled with this package in the file LICENSE, and is        |
  +   | available at through the world-wide-web at                           |
  +   | http://www.php.net/license/2_02.txt.                                 |
  +   | If you did not receive a copy of the PHP license and are unable to   |
  +   | obtain it through the world-wide-web, please send a note to          |
  +   | licen****@php***** so we can mail you a copy immediately.               |
  +   +----------------------------------------------------------------------+
  +   | Author: Harald Radi <h.rad****@nme*****>                                  |
  +   +----------------------------------------------------------------------+
  + */
  +
  +
   #ifndef VARIANT_H
   #define VARIANT_H
   
   #if PHP_WIN32
   
  -#define ALLOC_VARIANT(v)	(v) = (VARIANT *) emalloc(sizeof(VARIANT));					\
  -							VariantInit(v);
  -
  -#define FREE_VARIANT(v)		VariantClear(v);											\
  -							efree(v);
  -
  -
  -#define IS_VARIANT			php_VARIANT_get_le_variant()
  +#define ALLOC_VARIANT(v)	(v) = (variantval *) emalloc(sizeof(variantval));	\
  +							(v)->var = (VARIANT *) emalloc(sizeof(VARIANT));	\
  +							(v)->codepage = CP_ACP;								\
  +							VariantInit((v)->var);
  +
  +#define FREE_VARIANT(v)		VariantClear((v)->var);								\
  +							efree((v)->var);									\
  +							efree((v));
  +
  +#define ZVAL_VARIANT(z, v, cp)													\
  +	if (V_VT(v) == VT_DISPATCH) {												\
  +		rpc_internal *intern;													\
  +		comval *obj;															\
  +		ALLOC_COM(obj);															\
  +		Z_TYPE_P(z) = IS_OBJECT;												\
  +		(z)->value.obj = rpc_objects_new(com_class_entry TSRMLS_CC);			\
  +		if (GET_INTERNAL_EX(intern, (z)) != SUCCESS) {							\
  +			/* TODO: exception */												\
  +		}																		\
  +		php_COM_set(obj, &V_DISPATCH(v), TRUE);									\
  +		intern->data = obj;														\
  +	} else {																	\
  +		php_variant_to_zval((v), (z), cp);										\
  +		VariantClear(v);														\
  +		efree(v);																\
  +	}
  +
  +#define RETVAL_VARIANT(v, cp)	ZVAL_VARIANT(return_value, v, cp)
  +#define RETURN_VARIANT(v, cp)	RETVAL_VARIANT(v, cp)							\
  +								return;
  +
  +typedef struct variantval_ {
  +	VARIANT* var;
  +	long codepage;
  +} variantval;
   
  -#define ZVAL_VARIANT(z, v)		if (V_VT(v) == VT_DISPATCH) {							\
  -									comval *obj;										\
  -									ALLOC_COM(obj);										\
  -									php_COM_set(obj, &V_DISPATCH(v), TRUE TSRMLS_CC);	\
  -									ZVAL_RESOURCE((z), zend_list_insert(obj, IS_COM));		\
  -								} else {												\
  -									php_variant_to_pval((v), (z), codepage TSRMLS_CC);	\
  -									FREE_VARIANT(v);									\
  -								}
  -
  -#define RETVAL_VARIANT(v)	ZVAL_VARIANT(return_value, (v));
  -#define RETURN_VARIANT(v)	RETVAL_VARIANT(v)											\
  -							return;
  +void php_variant_init(int module_number TSRMLS_DC);
  +void php_variant_shutdown(TSRMLS_D);
   
  +ZEND_FUNCTION(variant_load);
   
   #endif  /* PHP_WIN32 */
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +1 -3      php4/ext/snmp/snmp.c
  
  Index: snmp.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/snmp/snmp.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- snmp.c	19 May 2002 11:16:05 -0000	1.2.2.1
  +++ snmp.c	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -17,7 +17,7 @@
   |          Steven Lawrance <slawr****@techn*****>                |
   +----------------------------------------------------------------------+
   */
  -/* $Id: snmp.c,v 1.58 2002/05/11 17:41:16 sterling Exp $ */
  +/* $Id: snmp.c,v 1.59 2002/07/13 05:42:01 sniper Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -73,8 +73,6 @@
   #define SNMP_MSG_GET GET_REQ_MSG
   #define SNMP_MSG_GETNEXT GETNEXT_REQ_MSG
   #endif
  -
  -void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st);
   
   /* constant - can be shared among threads */
   static oid objid_mib[] = {1, 3, 6, 1, 2, 1};
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.6   +22 -8     php4/ext/sockets/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/sockets/sockets.c,v
  retrieving revision 1.2.2.5
  retrieving revision 1.2.2.6
  diff -u -r1.2.2.5 -r1.2.2.6
  --- sockets.c	9 Jul 2002 09:14:39 -0000	1.2.2.5
  +++ sockets.c	3 Aug 2002 00:44:16 -0000	1.2.2.6
  @@ -19,7 +19,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: sockets.c,v 1.116 2002/06/25 06:24:45 mfischer Exp $ */
  +/* $Id: sockets.c,v 1.117 2002/07/07 07:01:17 jason Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -111,6 +111,9 @@
   static unsigned char third_through_seventh_args_force_ref[] =
   {7, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE};
   
  +/* Global buffer for php_strerror() */
  +static char php_strerror_buf[10000];
  +
   /* {{{ sockets_functions[]
    */
   function_entry sockets_functions[] = {
  @@ -343,16 +346,25 @@
   		buf = hstrerror(error);
   #else
   		{
  -			static char buf[100];
  -			sprintf(buf, "Host lookup error %d", error);
  +			sprintf(php_strerror_buf, "Host lookup error %d", error);
  +			buf = php_strerror_buf;
   		}
   #endif
   	} else {
   		buf = strerror(error);
   	}
  -#else
  -	FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |	FORMAT_MESSAGE_IGNORE_INSERTS,
  -				  NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),	(LPTSTR)&buf, 0, NULL);
  +#else 
  +	{
  +		LPTSTR tmp = NULL;
  +
  +		FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |	FORMAT_MESSAGE_IGNORE_INSERTS,
  +				  NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &tmp, 0, NULL);
  +
  +		strlcpy(php_strerror_buf, (char *) tmp, 10000);
  +		LocalFree(tmp);
  +		
  +		buf = php_strerror_buf;
  +	}
   #endif
   	
   	return (buf ? (char *) buf : "");
  @@ -368,7 +380,11 @@
   	} else {
   		if (! (host_entry = gethostbyname(string))) {
   			/* Note: < -10000 indicates a host lookup error */
  +#ifdef PHP_WIN32
  +			PHP_SOCKET_ERROR(php_sock, "Host lookup failed", WSAGetLastError());
  +#else
   			PHP_SOCKET_ERROR(php_sock, "Host lookup failed", (-10000 - h_errno));
  +#endif
   			return 0;
   		}
   		if (host_entry->h_addrtype != AF_INET) {
  @@ -754,8 +770,6 @@
   	retval = (*read_function)(php_sock->bsd_socket, tmpbuf, length);
   #else
   	retval = recv(php_sock->bsd_socket, tmpbuf, length, 0);
  -	/* i don't know why, but it _does_ fix a memleak */
  -	SleepEx(1, TRUE);
   #endif
   
   	if (retval == -1) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +3 -3      php4/ext/standard/aggregation.c
  
  Index: aggregation.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/aggregation.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- aggregation.c	2 May 2002 22:01:53 -0000	1.2.2.1
  +++ aggregation.c	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: aggregation.c,v 1.9 2002/04/30 14:45:50 stas Exp $ */
  +/* $Id: aggregation.c,v 1.10 2002/07/08 12:52:21 derick Exp $ */
   
   #include "php.h"
   #include "basic_functions.h"
  @@ -339,7 +339,7 @@
   	zend_str_tolower(class_name_lc, class_name_len);
   	if (zend_hash_find(EG(class_table), class_name_lc,
   					   class_name_len+1, (void **)&ce) == FAILURE) {
  -		php_error(E_WARNING, "%s() expects parameter 2 to be a valid class name, '%s' given\n", get_active_function_name(TSRMLS_C), class_name);
  +		php_error(E_WARNING, "%s(): Expects the second parameter to be a valid class name, '%s' given", get_active_function_name(TSRMLS_C), class_name);
   		efree(class_name_lc);
   		return;
   	}
  @@ -614,7 +614,7 @@
   
   		if (zend_hash_find(EG(class_table), Z_OBJCE_P(obj)->name,
   						   Z_OBJCE_P(obj)->name_length+1, (void **)&orig_ce) == FAILURE) {
  -			php_error(E_WARNING, "internal deaggregation error");
  +			php_error(E_WARNING, "%s(): Internal deaggregation error", get_active_function_name (TSRMLS_C));
   			return;
   		}
   
  
  
  
  1.2.2.3   +84 -70    php4/ext/standard/array.c
  
  Index: array.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/array.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- array.c	9 Jul 2002 09:14:39 -0000	1.2.2.2
  +++ array.c	3 Aug 2002 00:44:16 -0000	1.2.2.3
  @@ -21,7 +21,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: array.c,v 1.169 2002/06/29 15:39:41 derick Exp $ */
  +/* $Id: array.c,v 1.180 2002/08/01 17:34:31 rodif_bl Exp $ */
   
   #include "php.h"
   #include "php_ini.h"
  @@ -387,7 +387,7 @@
   
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Wrong datatype in %s() call",
  +		php_error(E_WARNING, "%s(): The argument should be an array",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
  @@ -553,7 +553,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Wrong datatype in usort() call");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		BG(user_compare_func_name) = old_compare_func;
   		RETURN_FALSE;
   	}
  @@ -581,7 +581,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Wrong datatype in uasort() call");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		BG(user_compare_func_name) = old_compare_func;
   		RETURN_FALSE;
   	}
  @@ -656,7 +656,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Wrong datatype in uksort() call");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		BG(user_compare_func_name) = old_compare_func;
   		RETURN_FALSE;
   	}
  @@ -681,7 +681,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Variable passed to end() is not an array or object");
  +		php_error(E_WARNING, "%s(): Passed variable is not an array or object", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	zend_hash_internal_pointer_end(target_hash);
  @@ -709,7 +709,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Variable passed to prev() is not an array or object");
  +		php_error(E_WARNING, "%s(): Passed variable is not an array or object", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	zend_hash_move_backwards(target_hash);
  @@ -737,7 +737,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Variable passed to next() is not an array or object");
  +		php_error(E_WARNING, "%s(): Passed variable is not an array or object", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	zend_hash_move_forward(target_hash);
  @@ -765,7 +765,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Variable passed to reset() is not an array or object");
  +		php_error(E_WARNING, "%s(): Passed variable is not an array or object", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	zend_hash_internal_pointer_reset(target_hash);
  @@ -793,7 +793,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Variable passed to current() is not an array or object");
  +		php_error(E_WARNING, "%s(): Passed variable is not an array or object", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
  @@ -810,6 +810,7 @@
   {
   	pval **array;
   	char *string_key;
  +	uint string_length;
   	ulong num_key;
   	HashTable *target_hash;
   
  @@ -818,12 +819,12 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Variable passed to key() is not an array or object");
  +		php_error(E_WARNING, "%s(): Passed variable is not an array or object", get_active_function_name (TSRMLS_C));
   		RETURN_FALSE;
   	}
  -	switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 1)) {
  +	switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, NULL)) {
   		case HASH_KEY_IS_STRING:
  -			RETVAL_STRING(string_key, 0);
  +			RETVAL_STRINGL(string_key, string_length - 1, 1);
   			break;
   		case HASH_KEY_IS_LONG:
   			RETVAL_LONG(num_key);
  @@ -842,7 +843,7 @@
   	pval **result;
   
   	if (argc<=0) {
  -		php_error(E_WARNING, "min: must be passed at least 1 value");
  +		php_error(E_WARNING, "%s(): Atleast one value should be passed", get_active_function_name(TSRMLS_C));
   		RETURN_NULL();
   	}
   	set_compare_func(SORT_REGULAR TSRMLS_CC);
  @@ -856,7 +857,7 @@
   			*return_value = **result;
   			zval_copy_ctor(return_value);
   		} else {
  -			php_error(E_WARNING, "min: array must contain at least 1 element");
  +			php_error(E_WARNING, "%s(): Array must contain atleast one element", get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
   	} else {
  @@ -894,7 +895,7 @@
   	pval **result;
   
   	if (argc<=0) {
  -		php_error(E_WARNING, "max: must be passed at least 1 value");
  +		php_error(E_WARNING, "%s(): Atleast one value should be passed", get_active_function_name(TSRMLS_C));
   		RETURN_NULL();
   	}
   	set_compare_func(SORT_REGULAR TSRMLS_CC);
  @@ -908,7 +909,7 @@
   			*return_value = **result;
   			zval_copy_ctor(return_value);
   		} else {
  -			php_error(E_WARNING, "max: array must contain at least 1 element");
  +			php_error(E_WARNING, "%s(): Array must contain atleast one element", get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   		}
   	} else {
  @@ -975,7 +976,8 @@
   		
   			zval_ptr_dtor(&retval_ptr);
   		} else
  -			php_error(E_WARNING, "Unable to call %s() - function does not exist",
  +			php_error(E_WARNING, "%s(): Unable to call %s() - function does not exist",
  +					  get_active_function_name(TSRMLS_C),
   					  (*BG(array_walk_func_name))->value.str.val);
   
   		zend_hash_move_forward_ex(target_hash, &pos);
  @@ -1004,14 +1006,14 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Wrong datatype in %s() call",
  +		php_error(E_WARNING, "%s(): The argument should be an array",
   				  get_active_function_name(TSRMLS_C));
   		BG(array_walk_func_name) = old_walk_func_name;
   		RETURN_FALSE;
   	}
   	if (Z_TYPE_PP(BG(array_walk_func_name)) != IS_ARRAY && 
   		Z_TYPE_PP(BG(array_walk_func_name)) != IS_STRING) {
  -		php_error(E_WARNING, "Wrong syntax for function name in %s() call",
  +		php_error(E_WARNING, "%s(): Wrong syntax for function name",
   				  get_active_function_name(TSRMLS_C));
   		BG(array_walk_func_name) = old_walk_func_name;
   		RETURN_FALSE;
  @@ -1046,12 +1048,12 @@
   	}
   	
   	if (Z_TYPE_PP(value) == IS_OBJECT) {
  -		php_error(E_WARNING, "Wrong datatype for first argument in call to %s", get_active_function_name(TSRMLS_C));
  +		php_error(E_WARNING, "%s(): Wrong datatype for first argument", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	
   	if (Z_TYPE_PP(array) != IS_ARRAY) {
  -		php_error(E_WARNING, "Wrong datatype for second argument in call to %s", get_active_function_name(TSRMLS_C));
  +		php_error(E_WARNING, "%s(): Wrong datatype for second argument", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -1158,7 +1160,7 @@
   			convert_to_long_ex(z_extract_type);
   			extract_type = Z_LVAL_PP(z_extract_type);
   			if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS) {
  -				php_error(E_WARNING, "%s() expects a prefix to be specified",
  +				php_error(E_WARNING, "%s(): Prefix expected to be specified",
   						  get_active_function_name(TSRMLS_C));
   				return;
   			}
  @@ -1179,13 +1181,13 @@
   	}
   	
   	if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
  -		php_error(E_WARNING, "Unknown extract type in call to %s()",
  +		php_error(E_WARNING, "%s(): Unknown extract type",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
   	
   	if (Z_TYPE_PP(var_array) != IS_ARRAY) {
  -		php_error(E_WARNING, "%s() expects first argument to be an array",
  +		php_error(E_WARNING, "%s(): First argument should be an array",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
  @@ -1361,7 +1363,7 @@
   			zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(start_key), val, sizeof(val), NULL);
   			break;
   		default:
  -			php_error(E_WARNING, "Wrong datatype for start key in array_init()");
  +			php_error(E_WARNING, "%s(): Wrong data type for start key", get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   			break;
   	}	
  @@ -1369,7 +1371,7 @@
   	convert_to_long_ex(num);
   	i = Z_LVAL_PP(num) - 1;	
   	if(i<0) {
  -		php_error(E_WARNING, "Number of elements must be positive in array_init()");
  +		php_error(E_WARNING, "%s(): Number of elements must be positive", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	newval = *val;
  @@ -1634,7 +1636,7 @@
   	/* Get first argument and check that it's an array */	
   	stack = *args[0];
   	if (Z_TYPE_P(stack) != IS_ARRAY) {
  -		php_error(E_WARNING, "First argument to array_push() needs to be an array");
  +		php_error(E_WARNING, "%s(): First argument should be an array", get_active_function_name(TSRMLS_C));
   		efree(args);
   		RETURN_FALSE;
   	}
  @@ -1660,7 +1662,9 @@
   {
   	zval	   **stack,			/* Input stack */
   			   **val;			/* Value to be popped */
  -	HashTable	*new_hash;		/* New stack */
  +	char *key = NULL;
  +	int key_len = 0;
  +	ulong index;
   	
   	/* Get the arguments and do error-checking */
   	if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &stack) == FAILURE) {
  @@ -1668,7 +1672,7 @@
   	}
   	
   	if (Z_TYPE_PP(stack) != IS_ARRAY) {
  -		php_error(E_WARNING, "The argument needs to be an array");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		return;
   	}
   
  @@ -1687,14 +1691,25 @@
   	INIT_PZVAL(return_value);
   	
   	/* Delete the first or last value */
  -	new_hash = php_splice(Z_ARRVAL_PP(stack), (off_the_end) ? -1 : 0, 1, NULL, 0, NULL);
  -	zend_hash_destroy(Z_ARRVAL_PP(stack));
  -	efree(Z_ARRVAL_PP(stack));
  -	Z_ARRVAL_PP(stack) = new_hash;
  +	zend_hash_get_current_key_ex(Z_ARRVAL_PP(stack), &key, &key_len, &index, 0, NULL);
  +	zend_hash_del_key_or_index(Z_ARRVAL_PP(stack), key, key_len, index, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX);
  +	
  +	/* If we did a shift... re-index like it did before */
  +	if (!off_the_end) {
  +		int k = 0;
  +		Bucket *p = Z_ARRVAL_PP(stack)->pListHead;
  +		while (p != NULL) {
  +			if (p->nKeyLength == 0)
  +				p->h = k++;
  +			p = p->pListNext;
  +		}
  +		Z_ARRVAL_PP(stack)->nNextFreeElement = k+1;
  +	} else if(!key_len) {
  +		Z_ARRVAL_PP(stack)->nNextFreeElement = Z_ARRVAL_PP(stack)->nNextFreeElement - 1;
  +	}
   }
   /* }}} */
   
  -
   /* {{{ proto mixed array_pop(array stack)
      Pops an element off the end of the array */
   PHP_FUNCTION(array_pop)
  @@ -1739,7 +1754,7 @@
   	/* Get first argument and check that it's an array */
   	stack = *args[0];
   	if (Z_TYPE_P(stack) != IS_ARRAY) {
  -		php_error(E_WARNING, "First argument to array_unshift() needs to be an array");
  +		php_error(E_WARNING, "%s(): The first argument should be an array", get_active_function_name(TSRMLS_C));
   		efree(args);
   		RETURN_FALSE;
   	}
  @@ -1789,7 +1804,7 @@
   	/* Get first argument and check that it's an array */
   	array = *args[0];
   	if (Z_TYPE_P(array) != IS_ARRAY) {
  -		php_error(E_WARNING, "First argument to array_splice() should be an array");
  +		php_error(E_WARNING, "%s(): The first argument should be an array", get_active_function_name(TSRMLS_C));
   		efree(args);
   		return;
   	}
  @@ -1864,7 +1879,7 @@
   	}
   	
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "First argument to array_slice() should be an array");
  +		php_error(E_WARNING, "%s(): The first argument should be an array", get_active_function_name(TSRMLS_C));
   		return;
   	}
   	
  @@ -2044,7 +2059,7 @@
   	}
   	
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "First argument to array_keys() should be an array");
  +		php_error(E_WARNING, "%s(): The first argument should be an array", get_active_function_name(TSRMLS_C));
   		return;
   	}
   	
  @@ -2101,7 +2116,7 @@
   	}
   	
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "Argument to array_values() should be an array");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		return;
   	}
   	
  @@ -2138,7 +2153,7 @@
   	}
   	
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "Argument to array_count_values() should be an array");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		return;
   	}
   	
  @@ -2175,7 +2190,7 @@
   				Z_LVAL_PP(tmp)++;
   			}
   		} else {
  -			php_error(E_WARNING, "Can only count STRING and INTEGER values!");
  +			php_error(E_WARNING, "%s(): Can only count STRING and INTEGER values!", get_active_function_name(TSRMLS_C));
   		}
   
   		zend_hash_move_forward_ex(myht, &pos);
  @@ -2204,7 +2219,7 @@
   	}
   	
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "Argument to array_reverse() should be an array");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		return;
   	}
   
  @@ -2264,7 +2279,7 @@
   	
   	/* Make sure arguments are of the proper type */
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "Argument to %s() should be an array",
  +		php_error(E_WARNING, "%s(): The argument should be an array",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
  @@ -2323,7 +2338,7 @@
   
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Wrong datatype in array_flip() call");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	
  @@ -2350,7 +2365,7 @@
   			zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
   		} else {
   			zval_ptr_dtor(&data); /* will free also zval structure */
  -			php_error(E_WARNING, "Can only flip STRING and INTEGER values!");
  +			php_error(E_WARNING, "%s(): Can only flip STRING and INTEGER values!", get_active_function_name(TSRMLS_C));
   		}
   	
   		zend_hash_move_forward_ex(target_hash, &pos);
  @@ -2382,7 +2397,7 @@
   	}
   
   	if (Z_TYPE_PP(array) != IS_ARRAY) {
  -		php_error(E_WARNING, "Wrong datatype in array_change_key_case() call");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -2431,7 +2446,7 @@
   	}
   	target_hash = HASH_OF(*array);
   	if (!target_hash) {
  -		php_error(E_WARNING, "Wrong datatype in array_unique() call");
  +		php_error(E_WARNING, "%s(): The argument should be an array", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -2502,7 +2517,7 @@
   	set_compare_func(SORT_STRING TSRMLS_CC);
   	for (i=0; i<argc; i++) {
   		if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
  -			php_error(E_WARNING, "Argument #%d to array_intersect() is not an array", i+1);
  +			php_error(E_WARNING, "%s(): Argument #%d is not an array", get_active_function_name(TSRMLS_C), i+1);
   			argc = i; /* only free up to i-1 */
   			goto out;
   		}
  @@ -2607,7 +2622,7 @@
   	set_compare_func(SORT_STRING TSRMLS_CC);
   	for (i=0; i<argc; i++) {
   		if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
  -			php_error(E_WARNING, "Argument #%d to array_diff() is not an array", i+1);
  +			php_error(E_WARNING, "%s(): Argument #%d is not an array", get_active_function_name(TSRMLS_C), i+1);
   			argc = i; /* only free up to i-1 */
   			goto out;
   		}
  @@ -2777,7 +2792,7 @@
   						sort_order = Z_LVAL_PP(args[i]) == SORT_DESC ? -1 : 1;
   						parse_state[MULTISORT_ORDER] = 0;
   					} else {
  -						php_error(E_WARNING, "Argument %i to %s() is expected to be an array or sorting flag that has not already been specified", i+1, get_active_function_name(TSRMLS_C));
  +						php_error(E_WARNING, "%s(): Argument #%d is expected to be an array or sorting flag that has not already been specified", get_active_function_name(TSRMLS_C), i+1);
   						MULTISORT_ABORT;
   					}
   					break;
  @@ -2791,20 +2806,19 @@
   						sort_type = Z_LVAL_PP(args[i]);
   						parse_state[MULTISORT_TYPE] = 0;
   					} else {
  -						php_error(E_WARNING, "Argument %i to %s() is expected to be an array or sorting flag that has not already been specified", i+1, get_active_function_name(TSRMLS_C));
  +						php_error(E_WARNING, "%s(): Argument #%d is expected to be an array or sorting flag that has not already been specified", get_active_function_name(TSRMLS_C), i + 1);
   						MULTISORT_ABORT;
   					}
   					break;
   
   				default:
  -					php_error(E_WARNING, "Argument %i to %s() is an unknown sort flag", i+1,
  -							  get_active_function_name(TSRMLS_C));
  +					php_error(E_WARNING, "%s(): Argument #%d is an unknown sort flag", get_active_function_name(TSRMLS_C), i + 1);
   					MULTISORT_ABORT;
   					break;
   
   			}
   		} else {
  -			php_error(E_WARNING, "Argument %i to %s() is expected to be an array or a sort flag", i+1, get_active_function_name(TSRMLS_C));
  +			php_error(E_WARNING, "%s(): Argument #%d is expected to be an array or a sort flag", get_active_function_name(TSRMLS_C), i + 1);
   			MULTISORT_ABORT;
   		}
   	}
  @@ -2816,7 +2830,7 @@
   	array_size = zend_hash_num_elements(Z_ARRVAL_PP(arrays[0]));
   	for (i = 0; i < num_arrays; i++) {
   		if (zend_hash_num_elements(Z_ARRVAL_PP(arrays[i])) != array_size) {
  -			php_error(E_WARNING, "Array sizes are inconsistent");
  +			php_error(E_WARNING, "%s(): Array sizes are inconsistent", get_active_function_name(TSRMLS_C));
   			MULTISORT_ABORT;
   		}
   	}
  @@ -2985,7 +2999,7 @@
   	}
   
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "The argument to %s() should be an array",
  +		php_error(E_WARNING, "%s(): The argument should be an array",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
  @@ -3036,13 +3050,13 @@
   	}
   
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "%s() expects argument 1 to be an array",
  +		php_error(E_WARNING, "%s(): The first argument should be an array",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
   
   	if (!zend_is_callable(*callback, 0, &callback_name)) {
  -		php_error(E_WARNING, "%s() expects argument 2, '%s', to be a valid callback",
  +		php_error(E_WARNING, "%s(): The second argument, '%s', should be a valid callback",
   				  get_active_function_name(TSRMLS_C), callback_name);
   		efree(callback_name);
   		return;
  @@ -3071,7 +3085,7 @@
   				zval_ptr_dtor(&result);
   				result = retval;
   			} else {
  -				php_error(E_WARNING, "%s() had an error invoking the reduction callback", get_active_function_name(TSRMLS_C));
  +				php_error(E_WARNING, "%s(): An error occurred while invoking the reduction callback", get_active_function_name(TSRMLS_C));
   				return;
   			}
   		} else {
  @@ -3109,14 +3123,14 @@
   	}
   
   	if (Z_TYPE_PP(input) != IS_ARRAY) {
  -		php_error(E_WARNING, "%s() expects argument 1 to be an array",
  +		php_error(E_WARNING, "%s(): The first argument shouldbe an array",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
   
   	if (ZEND_NUM_ARGS() > 1) {
   		if (!zend_is_callable(*callback, 0, &callback_name)) {
  -			php_error(E_WARNING, "%s() expects argument 2, '%s', to be a valid callback",
  +			php_error(E_WARNING, "%s(): The second argument, '%s', should be a valid callback",
   					  get_active_function_name(TSRMLS_C), callback_name);
   			efree(callback_name);
   			return;
  @@ -3141,7 +3155,7 @@
   				} else
   					zval_ptr_dtor(&retval);
   			} else {
  -				php_error(E_WARNING, "%s() had an error invoking the filter callback", get_active_function_name(TSRMLS_C));
  +				php_error(E_WARNING, "%s(): An error occurred while invoking the filter callback", get_active_function_name(TSRMLS_C));
   				return;
   			}
   		} else if (!zend_is_true(*operand))
  @@ -3190,7 +3204,7 @@
   	callback = *args[0];
   	if (Z_TYPE_P(callback) != IS_NULL) {
   		if (!zend_is_callable(callback, 0, &callback_name)) {
  -			php_error(E_WARNING, "%s() expects argument 1, '%s', to be either NULL or a valid callback", get_active_function_name(TSRMLS_C), callback_name);
  +			php_error(E_WARNING, "%s(): The first argument, '%s', should be either NULL or a valid callback", get_active_function_name(TSRMLS_C), callback_name);
   			efree(callback_name);
   			efree(args);
   			return;
  @@ -3205,7 +3219,7 @@
   	/* Check that arrays are indeed arrays and calculate maximum size. */
   	for (i = 0; i < ZEND_NUM_ARGS()-1; i++) {
   		if (Z_TYPE_PP(args[i+1]) != IS_ARRAY) {
  -			php_error(E_WARNING, "%s() expects argument %d to be an array",
  +			php_error(E_WARNING, "%s(): Argument #%d should be an array",
   					  get_active_function_name(TSRMLS_C), i + 2);
   			efree(array_len);
   			efree(args);
  @@ -3237,7 +3251,7 @@
   		uint str_key_len;
   		ulong num_key;
   		char *str_key;
  -		int key_type;
  +		int key_type = 0;
   
   		/*
   		 * If no callback, the result will be an array, consisting of current
  @@ -3277,7 +3291,7 @@
   
   		if (Z_TYPE_P(callback) != IS_NULL) {
   			if (!call_user_function_ex(EG(function_table), NULL, callback, &result, ZEND_NUM_ARGS()-1, params, 0, NULL TSRMLS_CC) == SUCCESS && result) {
  -				php_error(E_WARNING, "%s() had an error invoking the map callback", get_active_function_name(TSRMLS_C));
  +				php_error(E_WARNING, "%s(): An error occurred while invoking the map callback", get_active_function_name(TSRMLS_C));
   				efree(array_len);
   				efree(args);
   				efree(array_pos);
  @@ -3318,7 +3332,7 @@
   	}
   
   	if (Z_TYPE_PP(array) != IS_ARRAY && Z_TYPE_PP(array) != IS_OBJECT) {
  -		php_error(E_WARNING, "Wrong datatype for second argument in call to %s", get_active_function_name(TSRMLS_C));
  +		php_error(E_WARNING, "%s(): The second argument should be either an array or an object", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -3336,7 +3350,7 @@
   			RETURN_FALSE;
   
   		default:
  -			php_error(E_WARNING, "Wrong datatype for first argument in call to %s", get_active_function_name(TSRMLS_C));
  +			php_error(E_WARNING, "%s(): The first argument should be either a string or an integer", get_active_function_name(TSRMLS_C));
   			RETURN_FALSE;
   	}
   
  @@ -3365,7 +3379,7 @@
   
   	/* Do bounds checking for size parameter. */
   	if (size < 1) {
  -		php_error(E_WARNING, "%s() expects the size parameter to be > 0",
  +		php_error(E_WARNING, "%s(): Size parameter expected to be greater than 0",
   				  get_active_function_name(TSRMLS_C));
   		return;
   	}
  
  
  
  1.2.2.1   +4 -4      php4/ext/standard/assert.c
  
  Index: assert.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/assert.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- assert.c	29 Apr 2002 02:31:01 -0000	1.2
  +++ assert.c	3 Aug 2002 00:44:16 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: assert.c,v 1.47 2002/02/28 08:26:44 sebastian Exp $ */
  +/* $Id: assert.c,v 1.48 2002/07/08 12:52:22 derick Exp $ */
   
   /* {{{ includes/startup/misc */
   
  @@ -206,9 +206,9 @@
   
   	if (ASSERTG(warning)) {
   		if (myeval) {
  -			php_error(E_WARNING, "Assertion \"%s\" failed", myeval);
  +			php_error(E_WARNING, "%s(): Assertion \"%s\" failed", get_active_function_name (TSRMLS_C), myeval);
   		} else {
  -			php_error(E_WARNING, "Assertion failed");
  +			php_error(E_WARNING, "%s(): Assertion failed", get_active_function_name (TSRMLS_C));
   		}
   	}
   
  @@ -282,7 +282,7 @@
   		break;
   
   	default:
  -		php_error(E_WARNING, "Unknown value %d.", Z_LVAL_PP(what));
  +		php_error(E_WARNING, "%s(): Unknown value %d", get_active_function_name (TSRMLS_C), Z_LVAL_PP(what));
   		break;
   	}
   
  
  
  
  1.2.2.5   +80 -57    php4/ext/standard/basic_functions.c
  
  Index: basic_functions.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/basic_functions.c,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- basic_functions.c	9 Jul 2002 09:14:39 -0000	1.2.2.4
  +++ basic_functions.c	3 Aug 2002 00:44:16 -0000	1.2.2.5
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: basic_functions.c,v 1.483 2002/07/03 06:45:01 derick Exp $ */
  +/* $Id: basic_functions.c,v 1.489 2002/08/02 10:08:53 hholzgra Exp $ */
   
   #include "php.h"
   #include "php_streams.h"
  @@ -95,6 +95,7 @@
   typedef struct _user_tick_function_entry {
   	zval **arguments;
   	int arg_count;
  +	int calling;
   } user_tick_function_entry;
   
   /* some prototypes for local functions */
  @@ -274,6 +275,8 @@
   	PHP_FE(htmlentities,													NULL)
   	PHP_FE(html_entity_decode,												NULL)
   	PHP_FE(get_html_translation_table,										NULL)
  +	PHP_FE(sha1,															NULL)
  +	PHP_FE(sha1_file,														NULL)
   	PHP_NAMED_FE(md5,php_if_md5,											NULL)
   	PHP_NAMED_FE(md5_file,php_if_md5_file,									NULL)
   	PHP_NAMED_FE(crc32,php_if_crc32,										NULL)
  @@ -318,6 +321,10 @@
   	PHP_FE(strcoll,															NULL)
   #endif
   
  +#ifdef HAVE_STRFMON
  +	PHP_FE(money_format,                                                    NULL)
  +#endif
  +
   	PHP_FE(substr,															NULL)
   	PHP_FE(substr_replace,													NULL)
   	PHP_FE(quotemeta,														NULL)
  @@ -614,7 +621,7 @@
   	PHP_FE(file_get_wrapper_data,											NULL)
   	PHP_FE(file_register_wrapper,											NULL)
   
  -#if HAVE_SYS_TIME_H
  +#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
   	PHP_FE(socket_set_timeout,												NULL)
   #endif
   
  @@ -1150,7 +1157,7 @@
   	convert_to_string_ex(const_name);
   
   	if (!zend_get_constant(Z_STRVAL_PP(const_name), Z_STRLEN_PP(const_name), return_value TSRMLS_CC)) {
  -		php_error(E_WARNING, "Couldn't find constant %s", Z_STRVAL_PP(const_name));
  +		php_error(E_WARNING, "%s(): Couldn't find constant %s", get_active_function_name (TSRMLS_C), Z_STRVAL_PP(const_name));
   		RETURN_NULL();
   	}
   }
  @@ -1244,7 +1251,7 @@
   		if (PG(safe_mode)) {
   			/* Check the protected list */
   			if (zend_hash_exists(&BG(sm_protected_env_vars), pe.key, pe.key_len)) {
  -				php_error(E_WARNING, "Safe Mode:  Cannot override protected environment variable '%s'", pe.key);
  +				php_error(E_WARNING, "%s(): Safe Mode warning: Cannot override protected environment variable '%s'", get_active_function_name (TSRMLS_C), pe.key);
   				efree(pe.putenv_string);
   				efree(pe.key);
   				RETURN_FALSE;
  @@ -1265,7 +1272,7 @@
   				}
   				efree(allowed_env_vars);
   				if (!allowed) {
  -					php_error(E_WARNING, "Safe Mode:  Cannot set environment variable '%s' - it's not in the allowed list", pe.key);
  +					php_error(E_WARNING, "%s(): Safe Mode warning: Cannot set environment variable '%s' - it's not in the allowed list", get_active_function_name (TSRMLS_C), pe.key);
   					efree(pe.putenv_string);
   					efree(pe.key);
   					RETURN_FALSE;
  @@ -1430,14 +1437,14 @@
   	switch (ZEND_NUM_ARGS()) {
   		case 1:
   			if (zend_get_parameters_ex(1, &string) == FAILURE) {
  -				php_error(E_WARNING, "Invalid argument 1 in error_log");
  +				php_error(E_WARNING, "%s(): Argument 1 invalid", get_active_function_name (TSRMLS_C));
   				RETURN_FALSE;
   			}
   			break;
   
   		case 2:
   			if (zend_get_parameters_ex(2, &string, &erropt) == FAILURE) {
  -				php_error(E_WARNING, "Invalid arguments in error_log");
  +				php_error(E_WARNING, "%s(): Invalid arguments", get_active_function_name (TSRMLS_C));
   				RETURN_FALSE;
   			}
   			convert_to_long_ex(erropt);
  @@ -1445,9 +1452,8 @@
   			break;
   	
   		case 3:
  -			if (zend_get_parameters_ex(3, &string, &erropt, &option) ==
  -				FAILURE) {
  -				php_error(E_WARNING, "Invalid arguments in error_log");
  +			if (zend_get_parameters_ex(3, &string, &erropt, &option) == FAILURE) {
  +				php_error(E_WARNING, "%s(): Invalid arguments", get_active_function_name (TSRMLS_C));
   				RETURN_FALSE;
   			}
   			convert_to_long_ex(erropt);
  @@ -1457,9 +1463,8 @@
   			break;
   		
   		case 4:
  -			if (zend_get_parameters_ex
  -				(4, &string, &erropt, &option, &emailhead) == FAILURE) {
  -				php_error(E_WARNING, "Invalid arguments in error_log");
  +			if (zend_get_parameters_ex (4, &string, &erropt, &option, &emailhead) == FAILURE) {
  +				php_error(E_WARNING, "%s(): Invalid arguments in", get_active_function_name (TSRMLS_C));
   				RETURN_FALSE;
   			}
   			break;
  @@ -1508,14 +1513,14 @@
   					return FAILURE;
   				}
   #else
  -				php_error(E_WARNING, "Mail option not available!");
  +				php_error(E_WARNING, "%s(): Mail option not available!", get_active_function_name (TSRMLS_C));
   				return FAILURE;
   #endif
   			}
   			break;
   
   		case 2:		/*send to an address */
  -			php_error(E_WARNING, "TCP/IP option not available!");
  +			php_error(E_WARNING, "%s(): TCP/IP option not available!", get_active_function_name (TSRMLS_C));
   			return FAILURE;
   			break;
   
  @@ -1560,7 +1565,7 @@
   	}
   
   	if (!zend_is_callable(*params[0], 0, &name)) {
  -		php_error(E_WARNING, "%s() expects first argument, '%s', to be a valid callback", get_active_function_name(TSRMLS_C), name);
  +		php_error(E_WARNING, "%s(): First argumented is expected to be a valid callback, '%s' was given", get_active_function_name(TSRMLS_C), name);
   		efree(name);
   		efree(params);
   		RETURN_NULL();
  @@ -1569,7 +1574,7 @@
   	if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, argc-1, params+1, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
   		COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
   	} else {
  -		php_error(E_WARNING, "Unable to call %s()", name);
  +		php_error(E_WARNING, "%s(): Unable to call %s()", get_active_function_name (TSRMLS_C), name);
   	}
   
   	efree(name);
  @@ -1601,7 +1606,7 @@
   	}
   
   	if (!zend_is_callable(*func, 0, &name)) {
  -		php_error(E_WARNING, "%s() expects first argument, '%s', to be a valid callback", get_active_function_name(TSRMLS_C), name);
  +		php_error(E_WARNING, "%s(): First argumented is expected to be a valid callback, '%s' was given", get_active_function_name(TSRMLS_C), name);
   		efree(name);
   		RETURN_NULL();
   	}
  @@ -1621,7 +1626,7 @@
   	if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count, func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
   		COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
   	} else {
  -		php_error(E_WARNING, "Unable to call %s()", name);
  +		php_error(E_WARNING, "%s(): Unable to call %s()", get_active_function_name(TSRMLS_C), name);
   	}
   
   	efree(name);
  @@ -1629,7 +1634,7 @@
   }
   /* }}} */
   
  -#define _CUM_DEPREC "The %s() function is deprecated, use the call_user_func variety with the array(&$obj, \"method\") syntax instead"
  +#define _CUM_DEPREC "%s(): This function is deprecated, use the call_user_func variety with the array(&$obj, \"method\") syntax instead"
   
   /* {{{ proto mixed call_user_method(string method_name, mixed object [, mixed parameter] [, mixed ...])
      Call a user method on a specific object or class */
  @@ -1639,7 +1644,7 @@
   	zval *retval_ptr;
   	int arg_count = ZEND_NUM_ARGS();
   
  -	php_error(E_NOTICE, _CUM_DEPREC, "call_user_method");
  +	php_error(E_NOTICE, _CUM_DEPREC, get_active_function_name(TSRMLS_C));
   
   	if (arg_count < 2) {
   		WRONG_PARAM_COUNT;
  @@ -1651,7 +1656,7 @@
   		RETURN_FALSE;
   	}
   	if (Z_TYPE_PP(params[1]) != IS_OBJECT && Z_TYPE_PP(params[1]) != IS_STRING) {
  -		php_error(E_WARNING, "2nd argument is not an object or class name\n");
  +		php_error(E_WARNING, "%s(): Second argument is not an object or class name", get_active_function_name(TSRMLS_C));
   		efree(params);
   		RETURN_FALSE;
   	}
  @@ -1662,7 +1667,7 @@
   	if (call_user_function_ex(EG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
   		COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
   	} else {
  -		php_error(E_WARNING, "Unable to call %s()", Z_STRVAL_PP(params[0]));
  +		php_error(E_WARNING, "%s(): Unable to call %s()", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(params[0]));
   	}
   	efree(params);
   }
  @@ -1676,14 +1681,14 @@
   	HashTable *params_ar;
   	int num_elems, element = 0;
   
  -	php_error(E_NOTICE, _CUM_DEPREC, "call_user_method_array");
  +	php_error(E_NOTICE, _CUM_DEPREC, get_active_function_name(TSRMLS_C));
   
   	if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &method_name, &obj, &params) == FAILURE) {
   		WRONG_PARAM_COUNT;
   	}
   
   	if (Z_TYPE_PP(obj) != IS_OBJECT && Z_TYPE_PP(obj) != IS_STRING) {
  -		php_error(E_WARNING, "2nd argument is not an object or class name\n");
  +		php_error(E_WARNING, "%s(): Second argument is not an object or class name", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -1706,7 +1711,7 @@
   	if (call_user_function_ex(EG(function_table), obj, *method_name, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
   		COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
   	} else {
  -		php_error(E_WARNING, "Unable to call %s()", Z_STRVAL_PP(method_name));
  +		php_error(E_WARNING, "%s(): Unable to call %s()", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(method_name));
   	}
   
   	efree(method_args);
  @@ -1747,7 +1752,7 @@
   		zval_dtor(&retval);
   
   	} else {
  -		php_error(E_WARNING, "Unable to call %s() - function does not exist", Z_STRVAL_P(shutdown_function_entry->arguments[0]));
  +		php_error(E_WARNING, "%s(): Unable to call %s() - function does not exist", get_active_function_name(TSRMLS_C), Z_STRVAL_P(shutdown_function_entry->arguments[0]));
   	}
   	return 0;
   }
  @@ -1756,29 +1761,36 @@
   {
   	zval retval;
   	zval *function = tick_fe->arguments[0];
  +	
  +	/* Prevent reentrant calls to the same user ticks function */
  +	if (! tick_fe->calling) {
  +		tick_fe->calling = 1;
  +
  +		if (call_user_function(	EG(function_table), NULL, 
  +								function, 
  +								&retval,
  +								tick_fe->arg_count - 1,
  +								tick_fe->arguments+1
  +								TSRMLS_CC) == SUCCESS) {
  +			zval_dtor(&retval);
   
  -	if (call_user_function(	EG(function_table), NULL, 
  -							function, 
  -							&retval,
  -							tick_fe->arg_count - 1,
  -							tick_fe->arguments+1
  -							TSRMLS_CC) == SUCCESS) {
  -		zval_dtor(&retval);
  -
  -	} else {
  -		zval **obj, **method;
  -
  -		if (Z_TYPE_P(function) == IS_STRING) {
  -			php_error(E_WARNING, "Unable to call %s() - function does not exist", Z_STRVAL_P(function));
  -		} else if (	Z_TYPE_P(function) == IS_ARRAY 
  -					&& zend_hash_index_find(Z_ARRVAL_P(function), 0, (void **) &obj) == SUCCESS
  -					&& zend_hash_index_find(Z_ARRVAL_P(function), 1, (void **) &method) == SUCCESS
  -					&& Z_TYPE_PP(obj) == IS_OBJECT
  -					&& Z_TYPE_PP(method) == IS_STRING ) {
  -			php_error(E_WARNING, "Unable to call %s::%s() - function does not exist", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method));
   		} else {
  -			php_error(E_WARNING, "Unable to call tick function");
  +			zval **obj, **method;
  +
  +			if (Z_TYPE_P(function) == IS_STRING) {
  +				php_error(E_WARNING, "%s(): Unable to call %s() - function does not exist", get_active_function_name(TSRMLS_C), Z_STRVAL_P(function));
  +			} else if (	Z_TYPE_P(function) == IS_ARRAY 
  +						&& zend_hash_index_find(Z_ARRVAL_P(function), 0, (void **) &obj) == SUCCESS
  +						&& zend_hash_index_find(Z_ARRVAL_P(function), 1, (void **) &method) == SUCCESS
  +						&& Z_TYPE_PP(obj) == IS_OBJECT
  +						&& Z_TYPE_PP(method) == IS_STRING ) {
  +				php_error(E_WARNING, "%s(): Unable to call %s::%s() - function does not exist", get_active_function_name(TSRMLS_C), Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method));
  +			} else {
  +				php_error(E_WARNING, "%s(): Unable to call tick function", get_active_function_name(TSRMLS_C));
  +			}
   		}
  +	
  +		tick_fe->calling = 0;
   	}
   }
   
  @@ -2013,7 +2025,7 @@
   
   	if(extname) {
   		if (zend_hash_find(&module_registry, extname, extname_len+1, (void **) &module) == FAILURE) {
  -			php_error(E_WARNING, "Unable to find extension '%s'", extname);
  +			php_error(E_WARNING, "%s(): Unable to find extension '%s'", get_active_function_name(TSRMLS_C), extname);
   			RETURN_FALSE;
   		}
   		extnumber = module->module_number;
  @@ -2071,19 +2083,29 @@
   }
   /* }}} */
   
  -/* {{{ proto bool print_r(mixed var)
  -   Prints out information about the specified variable */
  +/* {{{ proto bool print_r(mixed var [, bool return])
  +   Prints out or returns information about the specified variable */
   PHP_FUNCTION(print_r)
   {
  -	pval **expr;
  +	zval *var;
  +	zend_bool i = 0;
   
  -	if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &expr) == FAILURE) {
  -		WRONG_PARAM_COUNT;
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var, &i) == FAILURE) {
  +		return;
  +	}
  +	
  +	if (i) {
  +		php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
   	}
   
  -	zend_print_pval_r(*expr, 0);
  +	zend_print_pval_r(var, 0);
   
  -	RETURN_TRUE;
  +	if (i) {
  +		php_ob_get_buffer (return_value TSRMLS_CC);
  +		php_end_ob_buffer (0, 0 TSRMLS_CC);
  +	} else {
  +		RETURN_TRUE;
  +	}
   }
   /* }}} */
   
  @@ -2244,6 +2266,7 @@
   	user_tick_function_entry tick_fe;
   	int i;
   
  +	tick_fe.calling = 0;
   	tick_fe.arg_count = ZEND_NUM_ARGS();
   	if (tick_fe.arg_count < 1) {
   		WRONG_PARAM_COUNT;
  @@ -2364,7 +2387,7 @@
   	if (successful) {
   		zend_hash_del(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1);
   	} else {
  -		php_error(E_WARNING, "Unable to move '%s' to '%s'", Z_STRVAL_PP(path), Z_STRVAL_PP(new_path));
  +		php_error(E_WARNING, "%s(): Unable to move '%s' to '%s'", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(path), Z_STRVAL_PP(new_path));
   	}
   	RETURN_BOOL(successful);
   }
  @@ -2489,7 +2512,7 @@
   
   	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));
  +		php_error(E_WARNING, "%s(): Cannot open '%s' for reading", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename));
   		return;
   	}
   	Z_TYPE(fh) = ZEND_HANDLE_FP;
  
  
  
  1.2.2.2   +2 -2      php4/ext/standard/browscap.c
  
  Index: browscap.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/browscap.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- browscap.c	2 May 2002 22:01:53 -0000	1.2.2.1
  +++ browscap.c	3 Aug 2002 00:44:16 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: browscap.c,v 1.57 2002/04/30 11:30:07 stas Exp $ */
  +/* $Id: browscap.c,v 1.58 2002/07/08 12:52:22 derick Exp $ */
   
   #include "php.h"
   #include "php_regex.h"
  @@ -149,7 +149,7 @@
   
   		fh.handle.fp = VCWD_FOPEN(browscap, "r");
   		if (!fh.handle.fp) {
  -			php_error(E_CORE_WARNING, "Cannot open '%s' for reading", browscap);
  +			php_error(E_CORE_WARNING, "%s(): Cannot open '%s' for reading", get_active_function_name(TSRMLS_C), browscap);
   			return FAILURE;
   		}
   		fh.filename = browscap;
  
  
  
  1.2.2.1   +4 -2      php4/ext/standard/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/config.m4,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- config.m4	29 Apr 2002 02:31:01 -0000	1.2
  +++ config.m4	3 Aug 2002 00:44:16 -0000	1.2.2.1
  @@ -1,4 +1,4 @@
  -dnl $Id: config.m4,v 1.37 2002/04/08 18:43:35 sniper Exp $ -*- sh -*-
  +dnl $Id: config.m4,v 1.39 2002/08/02 10:08:53 hholzgra Exp $ -*- sh -*-
   
   divert(3)dnl
   
  @@ -227,6 +227,8 @@
   	
   AC_CHECK_FUNCS(fnmatch glob)
   
  +AC_CHECK_FUNCS(strfmon)
  +
   if test "$PHP_SAPI" = "cgi"; then
     AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function])
   fi
  @@ -239,6 +241,6 @@
   	syslog.c type.c uniqid.c url.c url_scanner.c var.c versioning.c assert.c \
   	strnatcmp.c levenshtein.c incomplete_class.c url_scanner_ex.c \
   	ftp_fopen_wrapper.c http_fopen_wrapper.c php_fopen_wrapper.c credits.c \
  -	var_unserializer.c ftok.c aggregation.c)
  +	var_unserializer.c ftok.c aggregation.c sha1.c )
   
   PHP_ADD_MAKEFILE_FRAGMENT
  
  
  
  1.2.2.1   +2 -2      php4/ext/standard/credits.c
  
  Index: credits.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/credits.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- credits.c	29 Apr 2002 02:31:01 -0000	1.2
  +++ credits.c	3 Aug 2002 00:44:16 -0000	1.2.2.1
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: credits.c,v 1.17 2002/02/28 08:26:44 sebastian Exp $ */
  +/* $Id: credits.c,v 1.18 2002/07/23 23:46:54 jimw Exp $ */
   
   #include "php.h"
   #include "info.h"
  @@ -43,7 +43,7 @@
   
   		php_info_print_table_start();
   		php_info_print_table_header(1, "PHP Group");
  -		php_info_print_table_row(1, "Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski");
  +		php_info_print_table_row(1, "Thies C. Arntzen, Stig Bakken, Shane Caraveo, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski");
   		php_info_print_table_end();
   	}
   
  
  
  
  1.2.2.1   +5 -5      php4/ext/standard/cyr_convert.c
  
  Index: cyr_convert.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/cyr_convert.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- cyr_convert.c	29 Apr 2002 02:31:01 -0000	1.2
  +++ cyr_convert.c	3 Aug 2002 00:44:16 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: cyr_convert.c,v 1.19 2002/02/28 08:26:44 sebastian Exp $ */
  +/* $Id: cyr_convert.c,v 1.21 2002/07/08 18:29:54 andi Exp $ */
   
   #include <stdlib.h>
   
  @@ -201,7 +201,7 @@
   *    d - x-cp866
   *    m - x-mac-cyrillic
   *****************************************************************************/
  -static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to)
  +static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to TSRMLS_DC)
   {
   	const unsigned char *from_table, *to_table;
   	unsigned char tmp;
  @@ -228,7 +228,7 @@
   		case 'K':
   			break;
   		default:
  -			php_error(E_WARNING, "Unknown source charset: %c", from);
  +			php_error(E_WARNING, "%s(): Unknown source charset: %c", get_active_function_name(TSRMLS_C), from);
   			break;
   	}
   
  @@ -250,7 +250,7 @@
   		case 'K':
   			break;
   		default:
  -			php_error(E_WARNING, "Unknown destination charset: %c", to);
  +			php_error(E_WARNING, "%s(): Unknown destination charset: %c", get_active_function_name(TSRMLS_C), to);
   			break;
   	}
   
  @@ -284,7 +284,7 @@
   
   	str = (unsigned char*) estrndup(Z_STRVAL_PP(str_arg), Z_STRLEN_PP(str_arg));
   	
  -	php_convert_cyr_string(str, Z_STRLEN_PP(str_arg), Z_STRVAL_PP(fr_cs)[0], Z_STRVAL_PP(to_cs)[0]);
  +	php_convert_cyr_string(str, Z_STRLEN_PP(str_arg), Z_STRVAL_PP(fr_cs)[0], Z_STRVAL_PP(to_cs)[0] TSRMLS_CC);
   	RETVAL_STRING((char *)str, 0)
   }
   /* }}} */
  
  
  
  1.2.2.3   +30 -18    php4/ext/standard/datetime.c
  
  Index: datetime.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/datetime.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- datetime.c	9 Jul 2002 09:14:39 -0000	1.2.2.2
  +++ datetime.c	3 Aug 2002 00:44:17 -0000	1.2.2.3
  @@ -19,7 +19,7 @@
    */
   
   
  -/* $Id: datetime.c,v 1.88 2002/06/14 05:42:08 sebastian Exp $ */
  +/* $Id: datetime.c,v 1.90 2002/07/26 16:50:34 georg Exp $ */
   
   
   #include "php.h"
  @@ -66,6 +66,7 @@
   };
   
   #define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0)
  +#define YEAR_BASE 1900
   
   /* {{{ proto int time(void)
      Return current UNIX timestamp */
  @@ -300,7 +301,7 @@
   	}
   
   	if (!ta) {			/* that really shouldn't happen... */
  -		php_error(E_WARNING, "unexpected error in date()");
  +		php_error(E_WARNING, "%s(): Unexpected error", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	for (i = 0; i < Z_STRLEN_PP(format); i++) {
  @@ -395,7 +396,7 @@
   				strcat(Z_STRVAL_P(return_value), day_full_names[ta->tm_wday]);
   				break;
   			case 'Y':		/* year, numeric, 4 digits */
  -				sprintf(tmp_buff, "%d", ta->tm_year + 1900);  /* SAFE */
  +				sprintf(tmp_buff, "%d", ta->tm_year + YEAR_BASE);  /* SAFE */
   				strcat(Z_STRVAL_P(return_value), tmp_buff);
   				break;
   			case 'M':		/* month, textual, 3 letters */
  @@ -481,7 +482,7 @@
   				}
   				break;
   			case 't':		/* days in current month */
  -				sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+1900))][ta->tm_mon] );
  +				sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+YEAR_BASE))][ta->tm_mon] );
   				strcat(Z_STRVAL_P(return_value), tmp_buff);
   				break;
   			case 'w':		/* day of the week, numeric EXTENSION */
  @@ -505,7 +506,7 @@
   				strcat(Z_STRVAL_P(return_value), tmp_buff);
   				break;
   			case 'L':		/* boolean for leapyear */
  -				sprintf(tmp_buff, "%d", (isleap((ta->tm_year+1900)) ? 1 : 0 ) );
  +				sprintf(tmp_buff, "%d", (isleap((ta->tm_year+YEAR_BASE)) ? 1 : 0 ) );
   				strcat(Z_STRVAL_P(return_value), tmp_buff);
   				break;
   			case 'T':		/* timezone name */
  @@ -535,7 +536,7 @@
   					day_short_names[ta->tm_wday],
   					ta->tm_mday,
   					mon_short_names[ta->tm_mon],
  -					ta->tm_year + 1900,
  +					ta->tm_year + YEAR_BASE,
   					ta->tm_hour,
   					ta->tm_min,
   					ta->tm_sec,
  @@ -548,7 +549,7 @@
   					day_short_names[ta->tm_wday],
   					ta->tm_mday,
   					mon_short_names[ta->tm_mon],
  -					ta->tm_year + 1900,
  +					ta->tm_year + YEAR_BASE,
   					ta->tm_hour,
   					ta->tm_min,
   					ta->tm_sec,
  @@ -560,13 +561,24 @@
   				strcat(Z_STRVAL_P(return_value), tmp_buff);
   				break;
   			case 'W':		/* ISO-8601 week number of year, weeks starting on Monday */
  -				wd = ta->tm_wday==0 ? 7 : ta->tm_wday;
  -				yd = ta->tm_yday + 1;
  -				fd = (7 + (wd - yd) % 7 ) % 7;
  -				wk = ( (yd + fd - 1) / 7 ) + 1;
  -				if (fd>3) {
  -					wk--;
  +				wd = ta->tm_wday==0 ? 6 : ta->tm_wday-1;/* weekday */
  +				yd = ta->tm_yday + 1;					/* days since January 1st */
  +
  +				fd = (7 + wd - yd % 7+ 1) % 7;			/* weekday (1st January) */	
  +
  +				/* week is a last year week (52 or 53) */
  +				if ((yd <= 7 - fd) && fd > 3){			
  +					wk = (fd == 4 || (fd == 5 && isleap((ta->tm_year + YEAR_BASE - 1)))) ? 53 : 52;
  +				}
  +				/* week is a next year week (1) */
  +				else if (isleap((ta->tm_year+YEAR_BASE)) + 365 - yd < 3 - wd){
  +					wk = 1;
   				}
  +				/* normal week */
  +				else {
  +					wk = (yd + 6 - wd + fd) / 7 - (fd > 3);
  +				}
  +
   				sprintf(tmp_buff, "%d", wk);  /* SAFE */
   				strcat(Z_STRVAL_P(return_value), tmp_buff);
   				break;
  @@ -630,12 +642,12 @@
   			break;
   	}
   	if (NULL == (ta = php_localtime_r(&timestamp, &tmbuf))) {
  -		php_error(E_WARNING, "%s(): invalid local time",
  +		php_error(E_WARNING, "%s(): Invalid local time",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	if (array_init(return_value) == FAILURE) {
  -		php_error(E_ERROR, "Cannot prepare return array from localtime");
  +		php_error(E_ERROR, "%s(): Cannot prepare return array from localtime", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -682,11 +694,11 @@
   
   	ta = php_localtime_r(&timestamp, &tmbuf);
   	if (!ta) {
  -		php_error(E_WARNING, "Cannot perform date calculation");
  +		php_error(E_WARNING, "%s(): Cannot perform date calculation", get_active_function_name(TSRMLS_C));
   		return;
   	}
   	if (array_init(return_value) == FAILURE) {
  -		php_error(E_ERROR, "Unable to initialize array");
  +		php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C));
   		return;
   	}
   	add_assoc_long(return_value, "seconds", ta->tm_sec);
  @@ -867,7 +879,7 @@
   
   	convert_to_string_ex(z_time);
   	if (Z_STRLEN_PP(z_time) == 0)
  -		php_error (E_NOTICE, "strtotime() called with empty time parameter");
  +		php_error (E_NOTICE, "%s(): Called with empty time parameter", get_active_function_name(TSRMLS_C));
   	if (argc == 2) {
   		convert_to_long_ex(z_now);
   		now = Z_LVAL_PP(z_now);
  
  
  
  1.2.2.3   +6 -7      php4/ext/standard/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/dir.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- dir.c	9 Jul 2002 09:14:39 -0000	1.2.2.2
  +++ dir.c	3 Aug 2002 00:44:17 -0000	1.2.2.3
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: dir.c,v 1.91 2002/05/19 14:32:23 edink Exp $ */
  +/* $Id: dir.c,v 1.93 2002/07/29 13:13:50 edink Exp $ */
   
   /* {{{ includes/startup/misc */
   
  @@ -75,7 +75,7 @@
   		myself = getThis(); \
   		if (myself) { \
   			if (zend_hash_find(Z_OBJPROP_P(myself), "handle", sizeof("handle"), (void **)&tmp) == FAILURE) { \
  -				php_error(E_WARNING, "unable to find my handle property"); \
  +				php_error(E_WARNING, "%s(): Unable to find my handle property", get_active_function_name(TSRMLS_C)); \
   				RETURN_FALSE; \
   			} \
   			ZEND_FETCH_RESOURCE(dirp, php_stream *, tmp, -1, "Directory", php_file_le_stream()); \
  @@ -158,7 +158,6 @@
   		object_init_ex(return_value, dir_class_entry_ptr);
   		add_property_stringl(return_value, "path", Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), 1);
   		add_property_resource(return_value, "handle", dirp->rsrc_id);
  -		zend_list_addref(dirp->rsrc_id); /* might not be needed */
   		php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */
   	} else {
   		php_stream_to_zval(dirp, return_value);
  @@ -218,14 +217,14 @@
       ret = chroot(str);
   	
   	if (ret != 0) {
  -		php_error(E_WARNING, "chroot: %s (errno %d)", strerror(errno), errno);
  +		php_error(E_WARNING, "%s(): %s (errno %d)", get_active_function_name(TSRMLS_C), strerror(errno), errno);
   		RETURN_FALSE;
   	}
   
   	ret = chdir("/");
   	
   	if (ret != 0) {
  -		php_error(E_WARNING, "chdir: %s (errno %d)", strerror(errno), errno);
  +		php_error(E_WARNING, "%s(): %s (errno %d)", get_active_function_name(TSRMLS_C), strerror(errno), errno);
   		RETURN_FALSE;
   	}
   
  @@ -253,7 +252,7 @@
   	ret = VCWD_CHDIR(str);
   	
   	if (ret != 0) {
  -		php_error(E_WARNING, "ChDir: %s (errno %d)", strerror(errno), errno);
  +		php_error(E_WARNING, "%s(): %s (errno %d)", get_active_function_name(TSRMLS_C), strerror(errno), errno);
   		RETURN_FALSE;
   	}
   
  @@ -337,7 +336,7 @@
   	int n, ret;
   
   	if (PG(safe_mode)) {
  -		php_error(E_WARNING, "%s() SAFE MODE Restriction in effect, function is disabled",
  +		php_error(E_WARNING, "%s(): Safe Mode restriction in effect, function is disabled",
   				  get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
  
  
  
  1.2.2.1   +10 -10    php4/ext/standard/dl.c
  
  Index: dl.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/dl.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- dl.c	29 Apr 2002 02:31:01 -0000	1.2
  +++ dl.c	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -18,7 +18,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: dl.c,v 1.68 2002/04/04 00:24:34 sniper Exp $ */
  +/* $Id: dl.c,v 1.69 2002/07/08 12:52:22 derick Exp $ */
   
   #include "php.h"
   #include "dl.h"
  @@ -59,7 +59,7 @@
   
   #ifdef ZTS
   	if ((strcmp(sapi_module.name, "cgi")!=0) && (strcmp(sapi_module.name, "cli")!=0)) {
  -		php_error(E_ERROR, "dl() is not supported in multithreaded Web servers - use extension statements in your php.ini");
  +		php_error(E_ERROR, "%s(): Not supported in multithreaded Web servers - use extension statements in your php.ini", get_active_function_name(TSRMLS_C));
   	}
   #endif
   
  @@ -71,9 +71,9 @@
   	convert_to_string_ex(file);
   
   	if (!PG(enable_dl)) {
  -		php_error(E_ERROR, "Dynamically loaded extentions aren't enabled.");
  +		php_error(E_ERROR, "%s(): Dynamically loaded extentions aren't enabled", get_active_function_name(TSRMLS_C));
   	} else if (PG(safe_mode)) {
  -		php_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE MODE.");
  +		php_error(E_ERROR, "%s(): Dynamically loaded extensions aren't allowed when running in Safe Mode", get_active_function_name(TSRMLS_C));
   	} else {
   		php_dl(*file, MODULE_TEMPORARY, return_value TSRMLS_CC);
   		EG(full_tables_cleanup) = 1;
  @@ -134,7 +134,7 @@
   	/* load dynamic symbol */
   	handle = DL_LOAD(libpath);
   	if (!handle) {
  -		php_error(error_type, "Unable to load dynamic library '%s' - %s", libpath, GET_DL_ERROR());
  +		php_error(error_type, "%s(): Unable to load dynamic library '%s' - %s", get_active_function_name(TSRMLS_C), libpath, GET_DL_ERROR());
   		efree(libpath);
   		RETURN_FALSE;
   	}
  @@ -155,7 +155,7 @@
   
   	if (!get_module) {
   		DL_UNLOAD(handle);
  -		php_error(error_type, "Invalid library (maybe not a PHP library) '%s' ", Z_STRVAL_P(file));
  +		php_error(error_type, "%s(): Invalid library (maybe not a PHP library) '%s' ", get_active_function_name(TSRMLS_C), Z_STRVAL_P(file));
   		RETURN_FALSE;
   	}
   	module_entry = get_module();
  @@ -213,7 +213,7 @@
   	module_entry->module_number = zend_next_free_module();
   	if (module_entry->module_startup_func) {
   		if (module_entry->module_startup_func(type, module_entry->module_number TSRMLS_CC)==FAILURE) {
  -			php_error(error_type, "%s:  Unable to initialize module", module_entry->name);
  +			php_error(error_type, "%s(): Unable to initialize module '%s'", get_active_function_name(TSRMLS_C), module_entry->name);
   			DL_UNLOAD(handle);
   			RETURN_FALSE;
   		}
  @@ -222,7 +222,7 @@
   
   	if ((type == MODULE_TEMPORARY) && module_entry->request_startup_func) {
   		if (module_entry->request_startup_func(type, module_entry->module_number TSRMLS_CC)) {
  -			php_error(error_type, "%s:  Unable to initialize module", module_entry->name);
  +			php_error(error_type, "%s(): Unable to initialize module '%s'", get_active_function_name(TSRMLS_C), module_entry->name);
   			DL_UNLOAD(handle);
   			RETURN_FALSE;
   		}
  @@ -230,7 +230,7 @@
   	
   	/* update the .request_started property... */
   	if (zend_hash_find(&module_registry, module_entry->name, strlen(module_entry->name)+1, (void **) &tmp)==FAILURE) {
  -		php_error(error_type, "%s:  Loaded module got lost", module_entry->name);
  +		php_error(error_type, "%s(): Loaded module '%s' got lost", get_active_function_name(TSRMLS_C), module_entry->name);
   		RETURN_FALSE;
   	}
   	tmp->handle = handle;
  @@ -248,7 +248,7 @@
   
   void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
   {
  -	php_error(E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", Z_STRVAL_P(file));
  +	php_error(E_WARNING, "%s(): Cannot dynamically load %s - dynamic modules are not supported", get_active_function_name(TSRMLS_C), Z_STRVAL_P(file));
   	RETURN_FALSE;
   }
   
  
  
  
  1.2.2.1   +4 -4      php4/ext/standard/dns.c
  
  Index: dns.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/dns.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- dns.c	29 Apr 2002 02:31:01 -0000	1.2
  +++ dns.c	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: dns.c,v 1.38 2002/02/28 08:26:44 sebastian Exp $ */
  +/* $Id: dns.c,v 1.39 2002/07/08 12:52:22 derick Exp $ */
   
   /* {{{ includes
    */
  @@ -85,9 +85,9 @@
   #if HAVE_IPV6 && !defined(__MacOSX__)
   /* MacOSX at this time has support for IPv6, but not inet_pton()
    * so disabling IPv6 until further notice.  MacOSX 10.1.2 (kalowsky) */
  -		php_error(E_WARNING, "Address is not a valid IPv4 or IPv6 address");
  +		php_error(E_WARNING, "%s(): Address is not a valid IPv4 or IPv6 address", get_active_function_name(TSRMLS_C));
   #else
  -		php_error(E_WARNING, "Address is not in a.b.c.d form");
  +		php_error(E_WARNING, "%s(): Address is not in a.b.c.d form", get_active_function_name(TSRMLS_C));
   #endif
   		RETVAL_FALSE;
   	} else {
  @@ -236,7 +236,7 @@
   		else if ( !strcasecmp("SOA", Z_STRVAL_PP(arg2)) ) type = T_SOA;
   		else if ( !strcasecmp("CNAME", Z_STRVAL_PP(arg2)) ) type = T_CNAME;
   		else {
  -			php_error(E_WARNING, "Type '%s' not supported", Z_STRVAL_PP(arg2));
  +			php_error(E_WARNING, "%s(): Type '%s' not supported", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(arg2));
   			RETURN_FALSE;
   		}
   		break;
  
  
  
  1.2.2.3   +15 -15    php4/ext/standard/exec.c
  
  Index: exec.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/exec.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- exec.c	9 Jul 2002 09:14:39 -0000	1.2.2.2
  +++ exec.c	3 Aug 2002 00:44:17 -0000	1.2.2.3
  @@ -15,7 +15,7 @@
      | Author: Rasmus Lerdorf                                               |
      +----------------------------------------------------------------------+
    */
  -/* $Id: exec.c,v 1.76 2002/05/23 10:17:07 wez Exp $ */
  +/* $Id: exec.c,v 1.79 2002/08/02 14:35:24 jflemer Exp $ */
   
   #include <stdio.h>
   #include "php.h"
  @@ -124,7 +124,7 @@
   
   	buf = (char *) emalloc(EXEC_INPUT_BUF);
   	if (!buf) {
  -		php_error(E_WARNING, "Unable to emalloc %d bytes for exec buffer", EXEC_INPUT_BUF);
  +		php_error(E_WARNING, "%s(): Unable to emalloc %d bytes for exec buffer", get_active_function_name(TSRMLS_C), EXEC_INPUT_BUF);
   		return -1;
   	}
   	buflen = EXEC_INPUT_BUF;
  @@ -137,7 +137,7 @@
   		c = strchr(cmd, ' ');
   		if (c) *c = '\0';
   		if (strstr(cmd, "..")) {
  -			php_error(E_WARNING, "No '..' components allowed in path");
  +			php_error(E_WARNING, "%s(): No '..' components allowed in path", get_active_function_name(TSRMLS_C));
   			efree(buf);
   			return -1;
   		}
  @@ -169,7 +169,7 @@
   		fp = VCWD_POPEN(d, "r");
   #endif
   		if (!fp) {
  -			php_error(E_WARNING, "Unable to fork [%s]", d);
  +			php_error(E_WARNING, "%s(): Unable to fork [%s]", get_active_function_name(TSRMLS_C), d);
   			efree(d);
   			efree(buf);
   #if PHP_SIGCHILD
  @@ -188,7 +188,7 @@
   		fp = VCWD_POPEN(cmd, "r");
   #endif
   		if (!fp) {
  -			php_error(E_WARNING, "Unable to fork [%s]", cmd);
  +			php_error(E_WARNING, "%s(): Unable to fork [%s]", get_active_function_name(TSRMLS_C), cmd);
   			efree(buf);
   #if PHP_SIGCHILD
   			signal (SIGCHLD, sig_handler);
  @@ -219,7 +219,7 @@
   				if ( buflen <= (l+1) ) {
   					buf = erealloc(buf, buflen + EXEC_INPUT_BUF);
   					if ( buf == NULL ) {
  -						php_error(E_WARNING, "Unable to erealloc %d bytes for exec buffer", 
  +						php_error(E_WARNING, "%s(): Unable to erealloc %d bytes for exec buffer", get_active_function_name(TSRMLS_C), 
   								buflen + EXEC_INPUT_BUF);
   #if PHP_SIGCHILD
   						signal (SIGCHLD, sig_handler);
  @@ -514,7 +514,7 @@
   	}
   	
   	if (PG(safe_mode)) {
  -		php_error(E_WARNING, "Cannot execute using backquotes in safe mode");
  +		php_error(E_WARNING, "%s(): Cannot execute using backquotes in Safe Mode", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -524,7 +524,7 @@
   #else
   	if ((in=VCWD_POPEN(Z_STRVAL_PP(cmd), "r"))==NULL) {
   #endif
  -		php_error(E_WARNING, "Unable to execute '%s'", Z_STRVAL_PP(cmd));
  +		php_error(E_WARNING, "%s(): Unable to execute '%s'", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(cmd));
   		RETURN_FALSE;
   	}
   	allocated_space = EXEC_INPUT_BUF;
  @@ -559,7 +559,7 @@
   	GetExitCodeProcess(child, &wstatus);
   	FG(pclose_ret) = wstatus;
   #else
  -# if HAVE_SYS_WAIT
  +# if HAVE_SYS_WAIT_H
   	int wstatus;
   	pid_t child, wait_pid;
   	
  @@ -567,7 +567,7 @@
   
   	do {
   		wait_pid = waitpid(child, &wstatus, 0);
  -	} while (wait_pid == -1 && errno = EINTR);
  +	} while (wait_pid == -1 && errno == EINTR);
   	
   	if (wait_pid == -1)
   		FG(pclose_ret) = -1;
  @@ -742,7 +742,7 @@
   			descriptors[ndesc].mode = DESC_FILE;
   
   		} else if (Z_TYPE_PP(descitem) != IS_ARRAY) {
  -			zend_error(E_WARNING, "%s(): descriptor item must be either an array or a File-Handle",
  +			php_error(E_WARNING, "%s(): Descriptor item must be either an array or a File-Handle",
   					get_active_function_name(TSRMLS_C));
   			goto exit_fail;
   		} else {
  @@ -750,7 +750,7 @@
   			if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 0, (void **)&ztype) == SUCCESS) {
   				convert_to_string_ex(ztype);
   			} else {
  -				php_error (E_WARNING, "%s():  Missing handle qualifier in array",
  +				php_error (E_WARNING, "%s(): Missing handle qualifier in array",
   					get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype));
   				goto exit_fail;
   			}
  @@ -762,7 +762,7 @@
   				if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zmode) == SUCCESS) {
   					convert_to_string_ex(zmode);
   				} else {
  -					php_error (E_WARNING, "%s():  Missing mode parameter for 'pipe'",
  +					php_error (E_WARNING, "%s(): Missing mode parameter for 'pipe'",
   						get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype));
   					goto exit_fail;
   				}
  @@ -806,7 +806,7 @@
   				if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 1, (void **)&zfile) == SUCCESS) {
   					convert_to_string_ex(zfile);
   				} else {
  -					php_error (E_WARNING, "%s():  Missing file name parameter for 'file'",
  +					php_error (E_WARNING, "%s(): Missing file name parameter for 'file'",
   						get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype));
   					goto exit_fail;
   				}
  @@ -814,7 +814,7 @@
   				if (zend_hash_index_find(Z_ARRVAL_PP(descitem), 2, (void **)&zmode) == SUCCESS) {
   					convert_to_string_ex(zmode);
   				} else {
  -					php_error (E_WARNING, "%s():  Missing mode parameter for 'file'",
  +					php_error (E_WARNING, "%s(): Missing mode parameter for 'file'",
   						get_active_function_name(TSRMLS_C), Z_STRVAL_PP(ztype));
   					goto exit_fail;
   				}
  
  
  
  1.2.2.5   +22 -24    php4/ext/standard/file.c
  
  Index: file.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/file.c,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- file.c	9 Jul 2002 09:14:39 -0000	1.2.2.4
  +++ file.c	3 Aug 2002 00:44:17 -0000	1.2.2.5
  @@ -21,7 +21,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: file.c,v 1.235 2002/07/02 06:16:35 derick Exp $ */
  +/* $Id: file.c,v 1.239 2002/07/13 04:45:21 sniper Exp $ */
   
   /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
   
  @@ -218,7 +218,7 @@
   
       act = Z_LVAL_PP(arg2) & 3;
       if (act < 1 || act > 3) {
  -		php_error(E_WARNING, "Illegal operation argument");
  +		php_error(E_WARNING, "%s(): Illegal operation argument", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
       }
   
  @@ -888,13 +888,13 @@
   		efree(tmp);
   
   		if (!fp) {
  -			php_error(E_WARNING, "popen(\"%s\", \"%s\") - %s", buf, p, strerror(errno));
  +			php_error(E_WARNING, "%s(\"%s\", \"%s\") - %s", get_active_function_name(TSRMLS_C), buf, p, strerror(errno));
   			RETURN_FALSE;
   		}
   	} else {
   		fp = VCWD_POPEN(Z_STRVAL_PP(arg1), p);
   		if (!fp) {
  -			php_error(E_WARNING, "popen(\"%s\", \"%s\") - %s", Z_STRVAL_PP(arg1), p, strerror(errno));
  +			php_error(E_WARNING, "%s(\"%s\", \"%s\") - %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(arg1), p, strerror(errno));
   			efree(p);
   			RETURN_FALSE;
   		}
  @@ -957,7 +957,7 @@
   /* }}} */
   
   /* TODO: move to main/network.c */
  -PHPAPI int php_set_sock_blocking(int socketd, int block)
  +PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC)
   {
         int ret = SUCCESS;
         int flags;
  @@ -967,7 +967,7 @@
         /* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */
   	  flags = !block;
   	  if (ioctlsocket(socketd, FIONBIO, &flags)==SOCKET_ERROR){
  -		  php_error(E_WARNING, "%s", WSAGetLastError());
  +		  php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), WSAGetLastError());
   		  ret = FALSE;
         }
   #else
  @@ -1013,7 +1013,7 @@
   			RETURN_FALSE;
   		}
   
  -		if (php_set_sock_blocking(socketd, block) == FAILURE)
  +		if (php_set_sock_blocking(socketd, block TSRMLS_CC) == FAILURE)
   			RETURN_FALSE;
   
   		php_stream_sock_set_blocking((php_stream*)what, block == 0 ? 0 : 1 TSRMLS_CC);
  @@ -1028,16 +1028,16 @@
      Set blocking/non-blocking mode on a socket */
   PHP_FUNCTION(set_socket_blocking)
   {
  -	php_error(E_NOTICE, "set_socket_blocking() is deprecated, use socket_set_blocking() instead");
  +	php_error(E_NOTICE, "%s(): This function is deprecated, use socket_set_blocking() instead", get_active_function_name(TSRMLS_C));
   	PHP_FN(socket_set_blocking)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
   }
   /* }}} */
   
   /* {{{ proto bool socket_set_timeout(int socket_descriptor, int seconds, int microseconds)
      Set timeout on socket read to seconds + microseonds */
  +#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
   PHP_FUNCTION(socket_set_timeout)
   {
  -#if HAVE_SYS_TIME_H
   	zval **socket, **seconds, **microseconds;
   	int type;
   	void *what;
  @@ -1068,9 +1068,8 @@
   	}
   
   	RETURN_FALSE;
  -#endif /* HAVE_SYS_TIME_H */
   }
  -
  +#endif /* HAVE_SYS_TIME_H || defined(PHP_WIN32) */
   /* }}} */
   
   
  @@ -1132,7 +1131,7 @@
   	}
   
   	if (len < 0) {
  -		php_error(E_WARNING, "length parameter to fgets() may not be negative");
  +		php_error(E_WARNING, "%s(): Length parameter may not be negative", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -1231,7 +1230,7 @@
   	convert_to_long_ex(bytes);
   	len = Z_LVAL_PP(bytes);
       if (len < 0) {
  -		php_error(E_WARNING, "length parameter to fgetss() may not be negative");
  +		php_error(E_WARNING, "%s(): Length parameter may not be negative", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
       }
   
  @@ -1497,7 +1496,6 @@
   /* }}} */
   /* {{{ proto bool mkdir(string pathname[, int mode])
      Create a directory */
  -
   PHP_FUNCTION(mkdir)
   {
   	int dir_len, ret;
  @@ -1508,7 +1506,7 @@
   		return;
   	}
   
  -	if (PG(safe_mode) &&(!php_checkuid(dir, NULL, CHECKUID_ALLOW_ONLY_DIR))) {
  +	if (PG(safe_mode) && (!php_checkuid(dir, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
   		RETURN_FALSE;
   	}
   
  @@ -1518,7 +1516,7 @@
   
   	ret = VCWD_MKDIR(dir, (mode_t)mode);
   	if (ret < 0) {
  -		php_error(E_WARNING, "mkdir() failed (%s)", strerror(errno));
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), strerror(errno));
   		RETURN_FALSE;
   	}
   	RETURN_TRUE;
  @@ -1548,7 +1546,7 @@
   
   	ret = VCWD_RMDIR(Z_STRVAL_PP(arg1));
   	if (ret < 0) {
  -		php_error(E_WARNING, "rmdir() failed (%s)", strerror(errno));
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), strerror(errno));
   		RETURN_FALSE;
   	}
   
  @@ -1675,7 +1673,7 @@
   	ret = VCWD_RENAME(old_name, new_name);
   
   	if (ret == -1) {
  -		php_error(E_WARNING, "rename() failed (%s)", strerror(errno));
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), strerror(errno));
   		RETURN_FALSE;
   	}
   
  @@ -1705,7 +1703,7 @@
   
   	ret = VCWD_UNLINK(Z_STRVAL_PP(filename));
   	if (ret == -1) {
  -		php_error(E_WARNING, "unlink() failed (%s)", strerror(errno));
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), strerror(errno));
   		RETURN_FALSE;
   	}
   	/* Clear stat cache */
  @@ -1734,7 +1732,7 @@
   	convert_to_long_ex(size);
   
   	if (php_stream_is((php_stream*)what, PHP_STREAM_IS_SOCKET))	{
  -		php_error(E_WARNING, "can't truncate sockets!");
  +		php_error(E_WARNING, "%s(): Can't truncate sockets!", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   	if (SUCCESS == php_stream_cast((php_stream*)what, PHP_STREAM_AS_FD, (void*)&fd, 1))	{
  @@ -1911,7 +1909,7 @@
   	convert_to_long_ex(arg2);
   	len = Z_LVAL_PP(arg2);
       if (len < 0) {
  -		php_error(E_WARNING, "length parameter to fread() may not be negative");
  +		php_error(E_WARNING, "%s(): Length parameter may not be negative", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
       }
   
  @@ -1958,7 +1956,7 @@
   		convert_to_string_ex(p_delim);
   		/* Make sure that there is at least one character in string */
   		if (Z_STRLEN_PP(p_delim) < 1) {
  -			php_error(E_WARNING, "%s() 3rd parameter must be a character",
  +			php_error(E_WARNING, "%s(): Third parameter must be a character",
   					  get_active_function_name(TSRMLS_C));
   			return;
   		}
  @@ -1973,7 +1971,7 @@
   		convert_to_string_ex(p_delim);
   		/* Make sure that there is at least one character in string */
   		if (Z_STRLEN_PP(p_delim) < 1) {
  -			php_error(E_WARNING, "%s() 3rd parameter must be a character",
  +			php_error(E_WARNING, "%s(): Third parameter must be a character",
   					  get_active_function_name(TSRMLS_C));
   			return;
   		}
  @@ -1998,7 +1996,7 @@
   	convert_to_long_ex(bytes);
   	len = Z_LVAL_PP(bytes);
   	if (len < 0) {
  -		php_error(E_WARNING, "length parameter to fgetcsv() may not be negative");
  +		php_error(E_WARNING, "%s(): Length parameter may not be negative", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  
  
  
  1.2.2.2   +2 -2      php4/ext/standard/file.h
  
  Index: file.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/file.h,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- file.h	30 Apr 2002 08:13:17 -0000	1.2.2.1
  +++ file.h	3 Aug 2002 00:44:17 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: file.h,v 1.60 2002/04/30 00:28:24 wez Exp $ */
  +/* $Id: file.h,v 1.61 2002/07/08 18:44:05 andi Exp $ */
   
   /* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
   
  @@ -79,7 +79,7 @@
   PHP_FUNCTION(stream_context_get_options);
   PHP_MINIT_FUNCTION(user_streams);
   
  -PHPAPI int php_set_sock_blocking(int socketd, int block);
  +PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
   PHPAPI int php_file_le_stream(void);
   PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC);
   
  
  
  
  1.2.2.3   +52 -68    php4/ext/standard/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/filestat.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- filestat.c	9 Jul 2002 09:14:39 -0000	1.2.2.2
  +++ filestat.c	3 Aug 2002 00:44:17 -0000	1.2.2.3
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: filestat.c,v 1.97 2002/07/03 06:45:01 derick Exp $ */
  +/* $Id: filestat.c,v 1.101 2002/07/30 20:24:13 kalowsky Exp $ */
   
   #include "php.h"
   #include "safe_mode.h"
  @@ -110,12 +110,6 @@
   #define FS_LSTAT   16
   #define FS_STAT    17
   
  -/* From: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt__access.2c_._waccess.asp */
  -#ifdef PHP_WIN32
  -#define F_OK  0
  -#define W_OK  2
  -#define R_OK  4
  -#endif
   
   PHP_RINIT_FUNCTION(filestat)
   {
  @@ -204,7 +198,7 @@
   		}
   	}
   	else {
  -		php_error(E_WARNING, "Unable to load kernel32.dll");
  +		php_error(E_WARNING, "%s(): Unable to load kernel32.dll", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -307,7 +301,7 @@
   		}
   	}
   	else {
  -		php_error(E_WARNING, "Unable to load kernel32.dll");
  +		php_error(E_WARNING, "%s(): Unable to load kernel32.dll", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  @@ -354,7 +348,7 @@
   	if (Z_TYPE_PP(group) == IS_STRING) {
   		gr = getgrnam(Z_STRVAL_PP(group));
   		if (!gr) {
  -			php_error(E_WARNING, "unable to find gid for %s",
  +			php_error(E_WARNING, "%s(): Unable to find gid for %s", get_active_function_name(TSRMLS_C),
   					   Z_STRVAL_PP(group));
   			RETURN_FALSE;
   		}
  @@ -375,7 +369,7 @@
   
   	ret = VCWD_CHOWN(Z_STRVAL_PP(filename), -1, gid);
   	if (ret == -1) {
  -		php_error(E_WARNING, "chgrp failed: %s", strerror(errno));
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), strerror(errno));
   		RETURN_FALSE;
   	}
   	RETURN_TRUE;
  @@ -402,7 +396,7 @@
   	if (Z_TYPE_PP(user) == IS_STRING) {
   		pw = getpwnam(Z_STRVAL_PP(user));
   		if (!pw) {
  -			php_error(E_WARNING, "unable to find uid for %s",
  +			php_error(E_WARNING, "%s(): Unable to find uid for %s", get_active_function_name(TSRMLS_C),
   					   Z_STRVAL_PP(user));
   			RETURN_FALSE;
   		}
  @@ -423,7 +417,7 @@
   
   	ret = VCWD_CHOWN(Z_STRVAL_PP(filename), uid, -1);
   	if (ret == -1) {
  -		php_error(E_WARNING, "chown failed: %s", strerror(errno));
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), strerror(errno));
   		RETURN_FALSE;
   	}
   #endif
  @@ -464,7 +458,7 @@
   
   	ret = VCWD_CHMOD(Z_STRVAL_PP(filename), imode);
   	if (ret == -1) {
  -		php_error(E_WARNING, "chmod failed: %s", strerror(errno));
  +		php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), strerror(errno));
   		RETURN_FALSE;
   	}
   	RETURN_TRUE;
  @@ -487,9 +481,7 @@
   	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) {
   		convert_to_long_ex(filetime);
   		newtime->actime = time(NULL);
  @@ -518,7 +510,7 @@
   	if (ret == -1) {
   		file = VCWD_FOPEN(Z_STRVAL_PP(filename), "w");
   		if (file == NULL) {
  -			php_error(E_WARNING, "unable to create file %s because %s", Z_STRVAL_PP(filename), strerror(errno));
  +			php_error(E_WARNING, "%s(): Unable to create file %s because %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename), strerror(errno));
   			RETURN_FALSE;
   		}
   		fclose(file);
  @@ -526,7 +518,7 @@
   
   	ret = VCWD_UTIME(Z_STRVAL_PP(filename), newtime);
   	if (ret == -1) {
  -		php_error(E_WARNING, "utime failed: %s", strerror(errno));
  +		php_error(E_WARNING, "%s(): Utime failed: %s", get_active_function_name(TSRMLS_C), strerror(errno));
   		RETURN_FALSE;
   	}
   	RETURN_TRUE;
  @@ -559,10 +551,27 @@
   	char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
   			      "size", "atime", "mtime", "ctime", "blksize", "blocks"};
   
  +	if (PG(safe_mode) &&(!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
  +		RETURN_FALSE;
  +	}
  +
   	if (php_check_open_basedir(filename TSRMLS_CC)) {
   		RETURN_FALSE;
   	}
   
  +#ifndef PHP_WIN32
  +    switch (type) {
  +        case FS_IS_W:
  +            RETURN_BOOL (!access (filename, W_OK));
  +        case FS_IS_R:
  +            RETURN_BOOL (!access (filename, R_OK));
  +        case FS_IS_X:
  +            RETURN_BOOL (!access (filename, X_OK));
  +        case FS_EXISTS:
  +            RETURN_BOOL (!access (filename, F_OK));
  +    }
  +#endif
  +            
   	stat_sb = &BG(sb);
   
   	if (!BG(CurrentStatFile) || strcmp(filename, BG(CurrentStatFile))) {
  @@ -580,7 +589,7 @@
   #endif
   		if (VCWD_STAT(BG(CurrentStatFile), &BG(sb)) == -1) {
   			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));
  +				php_error(E_WARNING, "%s(): Stat failed for %s (errno=%d - %s)", get_active_function_name(TSRMLS_C), BG(CurrentStatFile), errno, strerror(errno));
   			}
   			efree(BG(CurrentStatFile));
   			BG(CurrentStatFile) = NULL;
  @@ -595,7 +604,7 @@
   		/* do lstat if the buffer is empty */
   		if (VCWD_LSTAT(filename, &BG(lsb)) == -1) {
   			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));
  +				php_error(E_WARNING, "%s(): Lstat failed for %s (errno=%d - %s)", get_active_function_name(TSRMLS_C), BG(CurrentStatFile), errno, strerror(errno));
   			}
   			RETURN_FALSE;
   		}
  @@ -666,8 +675,23 @@
   		case S_IFSOCK: RETURN_STRING("socket", 1);
   #endif
   		}
  -		php_error(E_WARNING, "Unknown file type (%d)", BG(sb).st_mode&S_IFMT);
  +		php_error(E_WARNING, "%s(): Unknown file type (%d)", get_active_function_name(TSRMLS_C), BG(sb).st_mode&S_IFMT);
   		RETURN_STRING("unknown", 1);
  +	case FS_IS_W:
  +		if (getuid()==0) {
  +			RETURN_TRUE; /* root */
  +		}
  +		RETURN_BOOL((BG(sb).st_mode & wmask) != 0);
  +	case FS_IS_R:
  +		if (getuid()==0) {
  +			RETURN_TRUE; /* root */
  +		}
  +		RETURN_BOOL((BG(sb).st_mode&rmask)!=0);
  +	case FS_IS_X:
  +		if (getuid()==0) {
  +			xmask = S_IXROOT; /* root */
  +		}
  +		RETURN_BOOL((BG(sb).st_mode&xmask)!=0 && !S_ISDIR(BG(sb).st_mode));
   	case FS_IS_FILE:
   		RETURN_BOOL(S_ISREG(BG(sb).st_mode));
   	case FS_IS_DIR:
  @@ -678,6 +702,8 @@
   #else
   		RETURN_FALSE;
   #endif
  +	case FS_EXISTS:
  +		RETURN_TRUE; /* the false case was done earlier */
   	case FS_LSTAT:
   #if HAVE_SYMLINK
   		stat_sb = &BG(lsb);
  @@ -746,7 +772,7 @@
   
   		return;
   	}
  -	php_error(E_WARNING, "didn't understand stat call");
  +	php_error(E_WARNING, "%s(): Didn't understand stat call", get_active_function_name(TSRMLS_C));
   	RETURN_FALSE;
   }
   /* }}} */
  @@ -809,50 +835,18 @@
   
   /* {{{ proto bool is_writable(string filename)
      Returns true if file can be written */
  -PHP_FUNCTION(is_writable)
  -{
  -	char *filename;
  -	int filename_len;
  -
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
  -		return;
  -	}
  -
  -	RETURN_BOOL(!access (filename, W_OK));
  -}
  +FileFunction(PHP_FN(is_writable), FS_IS_W)
   /* }}} */
   
   /* {{{ proto bool is_readable(string filename)
      Returns true if file can be read */
  -PHP_FUNCTION(is_readable)
  -{
  -	char *filename;
  -	int filename_len;
  -
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
  -		return;
  -	}
  -
  -	RETURN_BOOL(!access (filename, R_OK));
  -}
  +FileFunction(PHP_FN(is_readable), FS_IS_R)
   /* }}} */
   
  -#ifndef PHP_WIN32
   /* {{{ proto bool is_executable(string filename)
      Returns true if file is executable */
  -PHP_FUNCTION(is_executable) 
  -{
  -	char *filename;
  -	int filename_len;
  -
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
  -		return;
  -	}
  -
  -	RETURN_BOOL(!access (filename, X_OK));
  -}
  +FileFunction(PHP_FN(is_executable), FS_IS_X)
   /* }}} */
  -#endif
   
   /* {{{ proto bool is_file(string filename)
      Returns true if file is a regular file */
  @@ -871,17 +865,7 @@
   
   /* {{{ proto bool file_exists(string filename)
      Returns true if filename exists */
  -PHP_FUNCTION(file_exists)
  -{
  -	char *filename;
  -	int filename_len;
  -
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
  -		return;
  -	}
  -	
  -	RETURN_BOOL(!access (filename, F_OK));
  -}
  +FileFunction(PHP_FN(file_exists), FS_EXISTS)
   /* }}} */
   
   /* {{{ proto array lstat(string filename)
  
  
  
  1.2.2.2   +4 -4      php4/ext/standard/formatted_print.c
  
  Index: formatted_print.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/formatted_print.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- formatted_print.c	9 Jul 2002 09:14:39 -0000	1.2.2.1
  +++ formatted_print.c	3 Aug 2002 00:44:17 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: formatted_print.c,v 1.50 2002/06/17 11:50:25 hholzgra Exp $ */
  +/* $Id: formatted_print.c,v 1.51 2002/07/08 12:52:22 derick Exp $ */
   
   #include <math.h>				/* modf() */
   #include "php.h"
  @@ -475,7 +475,7 @@
   			if (currarg >= argc && format[inpos + 1] != '%') {
   				efree(result);
   				efree(args);
  -				php_error(E_WARNING, "%s(): too few arguments", get_active_function_name(TSRMLS_C));
  +				php_error(E_WARNING, "%s(): Too few arguments", get_active_function_name(TSRMLS_C));
   				return NULL;
   			}
   			/* starting a new format specifier, reset variables */
  @@ -496,7 +496,7 @@
   					if (argnum == 0) {
   						efree(result);
   						efree(args);
  -						php_error(E_WARNING, "%s(): zero is not a valid argument number", get_active_function_name(TSRMLS_C));
  +						php_error(E_WARNING, "%s(): Zero is not a valid argument number", get_active_function_name(TSRMLS_C));
   						return NULL;
   					}
   	
  @@ -507,7 +507,7 @@
   				if (argnum >= argc) {
   					efree(result);
   					efree(args);
  -					php_error(E_WARNING, "%s(): too few arguments", get_active_function_name(TSRMLS_C));
  +					php_error(E_WARNING, "%s(): Too few arguments", get_active_function_name(TSRMLS_C));
   					return NULL;
   				}
   
  
  
  
  1.2.2.2   +6 -3      php4/ext/standard/fsock.c
  
  Index: fsock.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/fsock.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- fsock.c	9 Jul 2002 09:14:39 -0000	1.2.2.1
  +++ fsock.c	3 Aug 2002 00:44:17 -0000	1.2.2.2
  @@ -18,7 +18,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: fsock.c,v 1.96 2002/06/11 03:55:28 jason Exp $ */
  +/* $Id: fsock.c,v 1.99 2002/07/22 18:46:26 jason Exp $ */
   
   /* converted to PHP Streams and moved much code to main/network.c [wez] */
   
  @@ -121,13 +121,15 @@
   	char *host;
   	int host_len;
   	int port = -1;
  -	int err;
   	zval *zerrno = NULL, *zerrstr = NULL;
   	double timeout = 60;
   	unsigned long conv;
   	struct timeval tv;
   	char *hashkey = NULL;
   	php_stream *stream = NULL;
  +#ifdef PHP_WIN32
  +	int err;
  +#endif
   	
   	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lzzd", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE)	{
   		RETURN_FALSE;
  @@ -192,7 +194,8 @@
   		}
   		else
   #endif
  -		stream = php_stream_sock_open_host(host, (unsigned short)port, socktype, (int)timeout, persistent);
  +		stream = php_stream_sock_open_host(host, (unsigned short)port, socktype, &tv, persistent);
  +
   #ifdef PHP_WIN32
   		/* Preserve error */
   		err = WSAGetLastError();
  
  
  
  1.2.2.1   +3 -3      php4/ext/standard/ftok.c
  
  Index: ftok.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/ftok.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ftok.c	29 Apr 2002 02:31:01 -0000	1.2
  +++ ftok.c	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: ftok.c,v 1.4 2002/02/28 08:26:45 sebastian Exp $ */
  +/* $Id: ftok.c,v 1.5 2002/07/08 12:52:22 derick Exp $ */
   
   #include "php.h"
   
  @@ -41,12 +41,12 @@
       convert_to_string_ex(proj);
   
       if (Z_STRLEN_PP(pathname)==0){
  -        php_error(E_WARNING, "Invalid argument 1 in ftok");
  +        php_error(E_WARNING, "%s(): First argument invalid", get_active_function_name(TSRMLS_C));
           RETURN_LONG(-1);
       }
   
       if (Z_STRLEN_PP(proj)!=1){
  -        php_error(E_WARNING, "Invalid argument 2 in ftok");
  +        php_error(E_WARNING, "%s(): Second argument invalid", get_active_function_name(TSRMLS_C));
           RETURN_LONG(-1);
       }
   
  
  
  
  1.2.2.1   +2 -2      php4/ext/standard/ftp_fopen_wrapper.c
  
  Index: ftp_fopen_wrapper.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/ftp_fopen_wrapper.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ftp_fopen_wrapper.c	29 Apr 2002 02:31:01 -0000	1.2
  +++ ftp_fopen_wrapper.c	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -17,7 +17,7 @@
      |          Hartmut Holzgraefe <hholz****@php*****>                       |
      +----------------------------------------------------------------------+
    */
  -/* $Id: ftp_fopen_wrapper.c,v 1.23 2002/04/16 22:14:23 wez Exp $ */
  +/* $Id: ftp_fopen_wrapper.c,v 1.24 2002/07/22 18:46:26 jason Exp $ */
   
   #include "php.h"
   #include "php_globals.h"
  @@ -124,7 +124,7 @@
   	if (resource->port == 0)
   		resource->port = 21;
   	
  -	stream = php_stream_sock_open_host(resource->host, resource->port, SOCK_STREAM, 0, 0);
  +	stream = php_stream_sock_open_host(resource->host, resource->port, SOCK_STREAM, NULL, 0);
   	if (stream == NULL)
   		goto errexit;
   
  
  
  
  1.2.2.3   +14 -12    php4/ext/standard/head.c
  
  Index: head.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/head.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- head.c	9 Jul 2002 09:14:39 -0000	1.2.2.2
  +++ head.c	3 Aug 2002 00:44:17 -0000	1.2.2.3
  @@ -15,7 +15,7 @@
      | Author: Rasmus Lerdorf <rasmu****@lerdo*****>                        |
      +----------------------------------------------------------------------+
    */
  -/* $Id: head.c,v 1.57 2002/06/21 09:31:20 derick Exp $ */
  +/* $Id: head.c,v 1.59 2002/07/08 12:52:22 derick Exp $ */
   
   #include <stdio.h>
   #include "php.h"
  @@ -39,16 +39,14 @@
      Sends a raw HTTP header */
   PHP_FUNCTION(header)
   {
  -	char *header;
  -	int header_len;
  -	zend_bool replace = 1;
  -	int http_code = 0;
  +	zend_bool rep = 1;
  +	sapi_header_line ctr = {0};
   	
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &header,
  -							  &header_len, &replace, &http_code) == FAILURE) {
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line,
  +				&ctr.line_len, &rep, &ctr.response_code) == FAILURE)
   		return;
  -	}
  -	sapi_add_header_ex(header, header_len, 1, replace, http_code TSRMLS_CC);
  +	
  +	sapi_header_op(rep ? SAPI_HEADER_REPLACE:SAPI_HEADER_ADD, &ctr TSRMLS_CC);
   }
   /* }}} */
   
  @@ -70,7 +68,8 @@
   	int len=sizeof("Set-Cookie: ");
   	time_t t;
   	char *dt;
  -
  +	sapi_header_line ctr = {0};
  +	
   	len += name_len;
   	if (value) {
   		int encoded_value_len;
  @@ -122,7 +121,10 @@
   		strcat(cookie, "; secure");
   	}
   
  -	return sapi_add_header_ex(cookie, strlen(cookie), 0, 0, 0 TSRMLS_CC);
  +	ctr.line = cookie;
  +	ctr.line_len = strlen(cookie);
  +
  +	return sapi_header_op(SAPI_HEADER_ADD, &ctr TSRMLS_CC);
   }
   
   
  @@ -156,7 +158,7 @@
   PHP_FUNCTION(headers_sent)
   {
   	if (ZEND_NUM_ARGS() != 0) {
  -		php_error(E_WARNING, "%s() expects no parameters, %d given",
  +		php_error(E_WARNING, "%s(): No parameters expected, %d given",
   				  get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS());
   		return;
   	}
  
  
  
  1.2.2.3   +3 -2      php4/ext/standard/html.c
  
  Index: html.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/html.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- html.c	9 Jul 2002 09:14:39 -0000	1.2.2.2
  +++ html.c	3 Aug 2002 00:44:17 -0000	1.2.2.3
  @@ -18,7 +18,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: html.c,v 1.47 2002/06/03 18:26:27 rasmus Exp $ */
  +/* $Id: html.c,v 1.48 2002/07/08 12:52:22 derick Exp $ */
   
   #include "php.h"
   #include "reg.h"
  @@ -749,7 +749,8 @@
   static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
   {
   	char *str, *hint_charset = NULL;
  -	int str_len, hint_charset_len, len, quote_style = ENT_COMPAT;
  +	int str_len, hint_charset_len = 0;
  +	int len, quote_style = ENT_COMPAT;
   	char *replaced;
   
   	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len,
  
  
  
  1.2.2.3   +6 -2      php4/ext/standard/http_fopen_wrapper.c
  
  Index: http_fopen_wrapper.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/http_fopen_wrapper.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- http_fopen_wrapper.c	9 May 2002 04:17:00 -0000	1.2.2.2
  +++ http_fopen_wrapper.c	3 Aug 2002 00:44:17 -0000	1.2.2.3
  @@ -18,7 +18,7 @@
      |          Wez Furlong <wez****@thebr*****>                          |
      +----------------------------------------------------------------------+
    */
  -/* $Id: http_fopen_wrapper.c,v 1.35 2002/05/04 17:16:28 sas Exp $ */
  +/* $Id: http_fopen_wrapper.c,v 1.37 2002/07/22 18:46:26 jason Exp $ */
   
   #include "php.h"
   #include "php_globals.h"
  @@ -98,7 +98,7 @@
   	else if (resource->port == 0)
   		resource->port = 80;
   
  -	stream = php_stream_sock_open_host(resource->host, resource->port, SOCK_STREAM, 0, 0);
  +	stream = php_stream_sock_open_host(resource->host, resource->port, SOCK_STREAM, NULL, 0);
   	if (stream == NULL)	
   		goto out;
   
  @@ -148,6 +148,10 @@
   
   	/* authz header if it was specified */
   	if (resource->user && resource->pass)	{
  +		/* decode the strings first */
  +		php_url_decode(resource->user, strlen(resource->user));
  +		php_url_decode(resource->pass, strlen(resource->pass));
  +
   		/* scratch is large enough, since it was made large enough for the whole URL */
   		strcpy(scratch, resource->user);
   		strcat(scratch, ":");
  
  
  
  1.2.2.3   +10 -12    php4/ext/standard/image.c
  
  Index: image.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/image.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- image.c	9 Jul 2002 09:14:39 -0000	1.2.2.2
  +++ image.c	3 Aug 2002 00:44:17 -0000	1.2.2.3
  @@ -16,7 +16,7 @@
      |          Marcus Boerger <helly****@php*****>                              |
      +----------------------------------------------------------------------+
    */
  -/* $Id: image.c,v 1.64 2002/07/01 18:52:30 derick Exp $ */
  +/* $Id: image.c,v 1.66 2002/07/12 22:34:43 sniper Exp $ */
   /*
    * Based on Daniel Schmitt's imageinfo.c which carried the following
    * Copyright notice.
  @@ -589,8 +589,6 @@
   #define TAG_FMT_SRATIONAL 10
   #define TAG_FMT_SINGLE    11
   #define TAG_FMT_DOUBLE    12
  -
  -typedef unsigned char uchar;
   /* }}} */
   
   /* {{{ php_ifd_get16u
  @@ -598,9 +596,9 @@
   static int php_ifd_get16u(void *Short, int motorola_intel)
   {
   	if (motorola_intel) {
  -		return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1];
  +		return (((unsigned char *)Short)[0] << 8) | ((unsigned char *)Short)[1];
   	} else {
  -		return (((uchar *)Short)[1] << 8) | ((uchar *)Short)[0];
  +		return (((unsigned char *)Short)[1] << 8) | ((unsigned char *)Short)[0];
   	}
   }
   /* }}} */
  @@ -618,11 +616,11 @@
   static int php_ifd_get32s(void *Long, int motorola_intel)
   {
   	if (motorola_intel) {
  -		return  ((( char *)Long)[0] << 24) | (((uchar *)Long)[1] << 16)
  -		      | (((uchar *)Long)[2] << 8 ) | (((uchar *)Long)[3] << 0 );
  +		return  ((( char *)Long)[0] << 24) | (((unsigned char *)Long)[1] << 16)
  +		      | (((unsigned char *)Long)[2] << 8 ) | (((unsigned char *)Long)[3] << 0 );
   	} else {
  -		return  ((( char *)Long)[3] << 24) | (((uchar *)Long)[2] << 16)
  -		      | (((uchar *)Long)[1] << 8 ) | (((uchar *)Long)[0] << 0 );
  +		return  ((( char *)Long)[3] << 24) | (((unsigned char *)Long)[2] << 16)
  +		      | (((unsigned char *)Long)[1] << 8 ) | (((unsigned char *)Long)[0] << 0 );
   	}
   }
   /* }}} */
  @@ -807,7 +805,7 @@
   
   	if ( !filetype) filetype = tmp;
   	if((php_stream_read(stream, filetype, 3)) <= 0) {
  -		php_error(E_WARNING, "getimagesize: Read error!");
  +		php_error(E_WARNING, "%s(): Read error!", get_active_function_name(TSRMLS_C));
   		return IMAGE_FILETYPE_UNKNOWN;
   	}
   
  @@ -820,7 +818,7 @@
   		if (!memcmp(filetype, php_sig_png, 8)) {
   			return IMAGE_FILETYPE_PNG;
   		} else {
  -			php_error(E_WARNING, "PNG file corrupted by ASCII conversion");
  +			php_error(E_WARNING, "%s(): PNG file corrupted by ASCII conversion", get_active_function_name(TSRMLS_C));
   			return IMAGE_FILETYPE_UNKNOWN;
   		}
   	} else if (!memcmp(filetype, php_sig_swf, 3)) {
  @@ -941,7 +939,7 @@
   
   	if (result) {
   		if (array_init(return_value) == FAILURE) {
  -			php_error(E_ERROR, "Unable to initialize array");
  +			php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C));
   			efree(result);
   			return;
   		}
  
  
  
  1.2.2.1   +6 -8      php4/ext/standard/incomplete_class.c
  
  Index: incomplete_class.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/incomplete_class.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- incomplete_class.c	29 Apr 2002 02:31:01 -0000	1.2
  +++ incomplete_class.c	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -17,7 +17,7 @@
    */
   
   
  -/* $Id: incomplete_class.c,v 1.13 2001/12/11 15:30:32 sebastian Exp $ */
  +/* $Id: incomplete_class.c,v 1.14 2002/07/24 09:55:11 yohgaki Exp $ */
   
   #include "php.h"
   #include "basic_functions.h"
  @@ -30,12 +30,10 @@
   		"you are trying to operate on was loaded _before_ " \
   		"the session was started"
   
  -#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
  -#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
   
   /* {{{ incomplete_class_message
    */
  -static void incomplete_class_message(zend_property_reference *ref)
  +static void incomplete_class_message(zend_property_reference *ref, int error_type)
   {
   	char buf[1024];
   	char *class_name;
  @@ -49,7 +47,7 @@
   	
   	efree(class_name);
   
  -	php_error(E_ERROR, "%s", buf);
  +	php_error(error_type, "%s", buf);
   }
   /* }}} */
   
  @@ -57,7 +55,7 @@
    */
   static void incomplete_class_call_func(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
   {
  -	incomplete_class_message(property_reference);
  +	incomplete_class_message(property_reference, E_ERROR);
   }
   /* }}} */
   
  @@ -65,7 +63,7 @@
    */
   static int incomplete_class_set_property(zend_property_reference *property_reference, zval *value)
   {
  -	incomplete_class_message(property_reference);
  +	incomplete_class_message(property_reference, E_NOTICE);
   	
   	/* does not reach this point */
   	return (0);
  @@ -78,7 +76,7 @@
   {
   	zval foo;
   	
  -	incomplete_class_message(property_reference);
  +	incomplete_class_message(property_reference, E_NOTICE);
   
   	/* does not reach this point */
   	memset(&foo, 0, sizeof(zval)); /* shut warnings up */
  
  
  
  1.2.2.2   +4 -4      php4/ext/standard/iptc.c
  
  Index: iptc.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/iptc.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- iptc.c	9 May 2002 04:17:00 -0000	1.2.2.1
  +++ iptc.c	3 Aug 2002 00:44:17 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: iptc.c,v 1.39 2002/05/04 17:41:51 sas Exp $ */
  +/* $Id: iptc.c,v 1.40 2002/07/08 12:52:22 derick Exp $ */
   
   /*
    * Functions to parse & compse IPTC data.
  @@ -213,7 +213,7 @@
   	}
   
       if ((fp = VCWD_FOPEN(Z_STRVAL_PP(jpeg_file), "rb")) == 0) {
  -        php_error(E_WARNING, "Unable to open %s", Z_STRVAL_PP(jpeg_file));
  +        php_error(E_WARNING, "%s(): Unable to open %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(jpeg_file));
           RETURN_FALSE;
       }
   
  @@ -354,7 +354,7 @@
   
   		if (tagsfound == 0) { /* found the 1st tag - initialize the return array */
   			if (array_init(return_value) == FAILURE) {
  -				php_error(E_ERROR, "Unable to initialize array");
  +				php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C));
   				RETURN_FALSE;
   	  		}
   		}
  @@ -363,7 +363,7 @@
   			ALLOC_ZVAL(values);
   			INIT_PZVAL(values);
   			if (array_init(values) == FAILURE) {
  -				php_error(E_ERROR, "Unable to initialize array");
  +				php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C));
   				RETURN_FALSE;
   			}
   			
  
  
  
  1.2.2.1   +2 -2      php4/ext/standard/levenshtein.c
  
  Index: levenshtein.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/levenshtein.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- levenshtein.c	29 Apr 2002 02:31:02 -0000	1.2
  +++ levenshtein.c	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -15,7 +15,7 @@
      | Author: Hartmut Holzgraefe <hartm****@six*****>                          |
      +----------------------------------------------------------------------+
    */
  -/* $Id: levenshtein.c,v 1.23 2002/04/07 19:46:45 hholzgra Exp $ */
  +/* $Id: levenshtein.c,v 1.24 2002/07/08 12:52:22 derick Exp $ */
   
   #include "php.h"
   #include <stdlib.h>
  @@ -138,7 +138,7 @@
   	}	
   
   	if(distance<0) {
  -		php_error(E_WARNING, "levenshtein(): argument string(s) too long");
  +		php_error(E_WARNING, "%s(): Argument string(s) too long", get_active_function_name(TSRMLS_C));
   	}
   	
   	RETURN_LONG(distance);
  
  
  
  1.2.2.1   +2 -2      php4/ext/standard/md5.c
  
  Index: md5.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/md5.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- md5.c	29 Apr 2002 02:31:02 -0000	1.2
  +++ md5.c	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: md5.c,v 1.26 2002/02/28 08:26:46 sebastian Exp $ */
  +/* $Id: md5.c,v 1.27 2002/07/28 19:29:28 derick Exp $ */
   
   /* 
    * md5.c - Copyright 1997 Lachlan Roche 
  @@ -90,7 +90,7 @@
   	}
   
   	if ((fp = VCWD_FOPEN(Z_STRVAL_PP(arg), "rb")) == NULL) {
  -		php_error(E_WARNING, "md5_file(): Unable to open file");
  +		php_error(E_WARNING, "%s(): Unable to open file", get_active_function_name (TSRMLS_C));
   		RETURN_FALSE;
   	}
   
  
  
  
  1.2.2.1   +1 -1      php4/ext/standard/parsedate.y
  
  Index: parsedate.y
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/parsedate.y,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- parsedate.y	29 Apr 2002 02:31:02 -0000	1.2
  +++ parsedate.y	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -520,7 +520,7 @@
       { "now",		tDAY_UNIT,	0 },
       { "last",		tUNUMBER,	-1 },
       { "this",		tMINUTE_UNIT,	0 },
  -    { "next",		tUNUMBER,	1 },
  +    { "next",		tUNUMBER,	2 },
       { "first",		tUNUMBER,	1 },
   /*  { "second",		tUNUMBER,	2 }, */
       { "third",		tUNUMBER,	3 },
  
  
  
  1.2.2.1   +4 -3      php4/ext/standard/php_incomplete_class.h
  
  Index: php_incomplete_class.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/php_incomplete_class.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_incomplete_class.h	29 Apr 2002 02:31:02 -0000	1.2
  +++ php_incomplete_class.h	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: php_incomplete_class.h,v 1.8 2001/12/11 15:30:35 sebastian Exp $ */
  +/* $Id: php_incomplete_class.h,v 1.9 2002/07/24 09:55:11 yohgaki Exp $ */
   
   #ifndef PHP_INCOMPLETE_CLASS_H
   #define PHP_INCOMPLETE_CLASS_H
  @@ -44,12 +44,13 @@
   	size_t name_len;													\
   	zend_bool free_class_name = 0										\
   
  -
  +#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
  +#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
   
   #ifdef __cplusplus
   extern "C" {
   #endif
  -
  +	
   zend_class_entry *php_create_incomplete_class(TSRMLS_D);
   
   char *php_lookup_class_name(zval *object, size_t *nlen, zend_bool del);
  
  
  
  1.2.2.1   +2 -1      php4/ext/standard/php_standard.h
  
  Index: php_standard.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/php_standard.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_standard.h	29 Apr 2002 02:31:02 -0000	1.2
  +++ php_standard.h	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: php_standard.h,v 1.15 2002/02/28 08:26:48 sebastian Exp $ */
  +/* $Id: php_standard.h,v 1.16 2002/07/28 19:18:08 sesser Exp $ */
   
   #include "basic_functions.h"
   #include "php_math.h"
  @@ -27,6 +27,7 @@
   #include "reg.h"
   #include "php_mail.h"
   #include "md5.h"
  +#include "sha1.h"
   #include "html.h"
   #include "exec.h"
   #include "file.h"
  
  
  
  1.2.2.1   +9 -7      php4/ext/standard/php_string.h
  
  Index: php_string.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/php_string.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_string.h	29 Apr 2002 02:31:02 -0000	1.2
  +++ php_string.h	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: php_string.h,v 1.56 2002/03/20 14:38:11 wez Exp $ */
  +/* $Id: php_string.h,v 1.59 2002/08/02 10:08:53 hholzgra Exp $ */
   
   /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
   
  @@ -85,7 +85,9 @@
   #ifdef HAVE_STRCOLL
   PHP_FUNCTION(strcoll);
   #endif
  -
  +#if HAVE_STRFMON
  +PHP_FUNCTION(money_format);
  +#endif
   
   #if defined(HAVE_LOCALECONV) && defined(ZTS)
   PHP_MINIT_FUNCTION(localeconv);
  @@ -101,6 +103,10 @@
   	strnatcmp_ex(a, strlen(a), b, strlen(b), 1)
   PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case);
   
  +#ifdef HAVE_LOCALECONV
  +struct lconv *localeconv_r(struct lconv *out);
  +#endif
  +
   PHPAPI char *php_strtoupper(char *s, size_t len);
   PHPAPI char *php_strtolower(char *s, size_t len);
   PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
  @@ -113,12 +119,9 @@
   PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len);
   PHPAPI char *php_str_to_str(char *haystack, int length, char *needle,
   		int needle_len, char *str, int str_len, int *_new_length);
  -PHPAPI void php_trim(zval **str, zval *return_value, int mode TSRMLS_DC);
  -PHPAPI void php_trim2(zval **str, zval **what, zval *return_value, int mode TSRMLS_DC);
  +PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC);
   PHPAPI void php_strip_tags(char *rbuf, int len, int *state, char *allow, int allow_len);
  -
   PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, pval *result);
  -
   PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value);
   PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, int limit);
   
  @@ -151,6 +154,5 @@
   #endif
   
   void register_string_constants(INIT_FUNC_ARGS);
  -int php_charmask(unsigned char *input, int len, char *mask TSRMLS_DC);
   
   #endif /* PHP_STRING_H */
  
  
  
  1.2.2.4   +67 -74    php4/ext/standard/string.c
  
  Index: string.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/string.c,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- string.c	9 Jul 2002 09:14:39 -0000	1.2.2.3
  +++ string.c	3 Aug 2002 00:44:17 -0000	1.2.2.4
  @@ -18,7 +18,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: string.c,v 1.276 2002/06/18 11:51:06 sander Exp $ */
  +/* $Id: string.c,v 1.280 2002/08/02 10:08:53 hholzgra Exp $ */
   
   /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
   
  @@ -446,7 +446,7 @@
    * it needs to be incrementing.  
    * Returns: FAILURE/SUCCESS wether the input was correct (i.e. no range errors)
    */
  -int php_charmask(unsigned char *input, int len, char *mask TSRMLS_DC)
  +static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_DC)
   {
   	unsigned char *end;
   	unsigned char c;
  @@ -489,33 +489,20 @@
   }
   /* }}} */
   
  -/* {{{ php_trim
  -       Compatibility function, ports old-API to new one. (DEPRECATED)
  -*/
  -void php_trim(zval **str, zval *return_value, int mode TSRMLS_DC)
  -{
  -	php_trim2(str, NULL, return_value, mode TSRMLS_CC);
  -}
  -/* }}} */
  -
  -/* {{{ php_trim2
  +/* {{{ php_trim()
  + * mode 1 : trim left
  + * mode 2 : trim right
  + * mode 3 : trim left and right
  + * what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0')
    */
  -PHPAPI void php_trim2(zval **str, zval **what, zval *return_value, int mode TSRMLS_DC)
  -/* mode 1 : trim left
  -   mode 2 : trim right
  -   mode 3 : trim left and right
  -
  -   what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0')
  -*/
  +PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC)
   {
   	register int i;
  -	int len = Z_STRLEN_PP(str);
   	int trimmed = 0;
  -	char *c = Z_STRVAL_PP(str);
   	char mask[256];
   
   	if (what) {
  -		php_charmask(Z_STRVAL_PP(what), Z_STRLEN_PP(what), mask TSRMLS_CC);
  +		php_charmask(what, what_len, mask TSRMLS_CC);
   	} else {
   		php_charmask(" \n\r\t\v\0", 6, mask TSRMLS_CC);
   	}
  @@ -540,32 +527,37 @@
   			}
   		}
   	}
  -	RETVAL_STRINGL(c, len, 1);
  -}
  -/* }}} */
   
  -/* {{{ proto string chop(string str [, string character_mask])
  -   An alias for rtrim */
  +	if (return_value) {
  +		RETVAL_STRINGL(c, len, 1);
  +	} else {
  +		return estrndup(c, len);
  +	}
  +	return "";
  +}
   /* }}} */
   
  -/* {{{ proto string rtrim(string str [, string character_mask])
  -   Removes trailing whitespace */
  -PHP_FUNCTION(rtrim)
  +/* {{{ php_do_trim
  + * Base for trim(), rtrim() and ltrim() functions.
  + */
  +static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
   {
   	zval **str;
   	zval **what = NULL;
   	int    argc = ZEND_NUM_ARGS();
   
  -	if (argc < 1 || argc > 2 ||
  -	    zend_get_parameters_ex(argc, &str, &what) == FAILURE) {
  +	if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &str, &what) == FAILURE) {
   		WRONG_PARAM_COUNT;
   	}
  +
   	convert_to_string_ex(str);
  +
   	if (argc > 1) {
   		convert_to_string_ex(what);
  +		php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), Z_STRVAL_PP(what), Z_STRLEN_PP(what), return_value, mode TSRMLS_CC);
  +	} else {
  +		php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), NULL, 0, return_value, mode TSRMLS_CC);
   	}
  -
  -	php_trim2(str, what, return_value, 2 TSRMLS_CC);
   }
   /* }}} */
   
  @@ -573,20 +565,15 @@
      Strips whitespace from the beginning and end of a string */
   PHP_FUNCTION(trim)
   {
  -	zval **str;
  -	zval **what = NULL;
  -	int    argc = ZEND_NUM_ARGS();
  -
  -	if (argc < 1 || argc > 2 ||
  -	    zend_get_parameters_ex(argc, &str, &what) == FAILURE) {
  -		WRONG_PARAM_COUNT;
  -	}
  -	convert_to_string_ex(str);
  -	if (argc > 1) {
  -		convert_to_string_ex(what);
  -	}
  +	php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
  +}
  +/* }}} */
   
  -	php_trim2(str, what, return_value, 3 TSRMLS_CC);
  +/* {{{ proto string rtrim(string str [, string character_mask])
  +   Removes trailing whitespace */
  +PHP_FUNCTION(rtrim)
  +{
  +	php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
   }
   /* }}} */
   
  @@ -594,20 +581,7 @@
      Strips whitespace from the beginning of a string */
   PHP_FUNCTION(ltrim)
   {
  -	zval **str;
  -	zval **what = NULL;
  -	int    argc = ZEND_NUM_ARGS();
  -
  -	if (argc < 1 || argc > 2 ||
  -	    zend_get_parameters_ex(argc, &str, &what) == FAILURE) {
  -		WRONG_PARAM_COUNT;
  -	}
  -	convert_to_string_ex(str);
  -	if (argc > 1) {
  -		convert_to_string_ex(what);
  -	}
  -	
  -	php_trim2(str, what, return_value, 1 TSRMLS_CC);
  +	php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
   }
   /* }}} */
   
  @@ -3249,14 +3223,14 @@
   	old_rg = PG(register_globals);
   	if(argCount == 1) {
   		PG(register_globals) = 1;
  -		php_treat_data(PARSE_STRING, res, NULL TSRMLS_CC);
  +		sapi_module.treat_data(PARSE_STRING, res, NULL TSRMLS_CC);
   	} else 	{
   		PG(register_globals) = 0;
   		/* Clear out the array that was passed in. */
   		zval_dtor(*arrayArg);
   		array_init(*arrayArg);
   		
  -		php_treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC);
  +		sapi_module.treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC);
   	}
   	PG(register_globals) = old_rg;
   }
  @@ -3913,25 +3887,44 @@
      Perform the rot13 transform on a string */
   PHP_FUNCTION(str_rot13)
   {
  -	char *str;
  -	int str_len;
  -    static char xfrom[] = "abcdefghijklmnopqrstuvwxyz"
  -        "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  -    static char xto[] = "nopqrstuvwxyzabcdefghijklm"
  -        "NOPQRSTUVWXYZABCDEFGHIJKLM";
  +	zval **arg;
   
  -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
  -							  &str, &str_len) == FAILURE) {
  -		return;
  +    static char xfrom[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  +    static char xto[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
  +
  +	if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
  +		WRONG_PARAM_COUNT;
   	}
  +	convert_to_string_ex(arg);
  +	*return_value = **arg;
  +	zval_copy_ctor(return_value);
   
  -    php_strtr(str, str_len, xfrom, xto, 52);
  -	RETURN_STRINGL(str, str_len, 1);
  +    php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), xfrom, xto, 52);
   }
   /* }}} */
   
   
  +#if HAVE_STRFMON
  +/* {{{ proto string money_format(string format , float value)
  +   Convert monetary value(s) to string */
  +
  +PHP_FUNCTION(money_format) {
  +	int format_len, str_len = 1024;
  +	char *format, *str = emalloc(str_len);
  +	double value;
   
  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sd",
  +							  &format, &format_len, &value) == FAILURE) {
  +		return;
  +	}
  +
  +	str_len = strfmon(str, str_len, format, value); 	
  +
  +	RETURN_STRINGL(erealloc(str, strlen), str_len, 0);
  +}
  +
  +/* }}} */
  +#endif
   
   /*
    * Local variables:
  
  
  
  1.2.2.1   +12 -3     php4/ext/standard/type.c
  
  Index: type.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/type.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- type.c	29 Apr 2002 02:31:02 -0000	1.2
  +++ type.c	3 Aug 2002 00:44:17 -0000	1.2.2.1
  @@ -16,9 +16,10 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: type.c,v 1.15 2002/02/28 08:26:49 sebastian Exp $ */
  +/* $Id: type.c,v 1.19 2002/07/24 09:55:11 yohgaki Exp $ */
   
   #include "php.h"
  +#include "php_incomplete_class.h"
   
   /* {{{ proto string gettype(mixed var)
      Returns the type of the variable */
  @@ -115,10 +116,10 @@
   	} else if (!strcasecmp(new_type, "null")) {
   		convert_to_null(*var);
   	} else if (!strcasecmp(new_type, "resource")) {
  -		php_error(E_WARNING, "settype: cannot convert to resource type");
  +		php_error(E_WARNING, "%s(): Cannot convert to resource type", get_active_function_name (TSRMLS_C));
   		RETURN_FALSE;
   	} else {
  -		php_error(E_WARNING, "settype: invalid type");
  +		php_error(E_WARNING, "%s(): Invalid type", get_active_function_name (TSRMLS_C));
   		RETURN_FALSE;
   	}
   	RETVAL_TRUE;
  @@ -195,10 +196,18 @@
   	pval **arg;
   
   	if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
  +		php_error(E_WARNING, "%s(): Only one argument expected", get_active_function_name(TSRMLS_C));
   		RETURN_FALSE;
   	}
   
   	if (Z_TYPE_PP(arg) == type) {
  +		if (type == IS_OBJECT) {
  +			zend_class_entry *ce;
  +			ce = Z_OBJCE_PP(arg);
  +			if (!strcmp(ce->name, INCOMPLETE_CLASS)) {
  +				RETURN_FALSE;
  +			}
  +		}
   		RETURN_TRUE;
   	} else {
   		RETURN_FALSE;
  
  
  
  1.2.2.2   +54 -27    php4/ext/standard/versioning.c
  
  Index: versioning.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/standard/versioning.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- versioning.c	9 Jul 2002 09:14:40 -0000	1.2.2.1
  +++ versioning.c	3 Aug 2002 00:44:17 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: versioning.c,v 1.9 2002/05/26 12:01:30 ssb Exp $ */
  +/* $Id: versioning.c,v 1.12 2002/07/07 08:19:36 sebastian Exp $ */
   
   #include <stdio.h>
   #include <sys/types.h>
  @@ -51,16 +51,28 @@
    *  s/([^\d\.])([^\D\.])/$1.$2/g;
    *  s/([^\D\.])([^\d\.])/$1.$2/g;
    */
  -#define isdigdot(x) (isdigit(x)||(x)=='.')
  +#define isdig(x) (isdigit(x)&&(x)!='.')
  +#define isndig(x) (!isdigit(x)&&(x)!='.')
   #define isspecialver(x) ((x)=='-'||(x)=='_'||(x)=='+')
   
           lq = *(q - 1);
  -        if ((isdigdot(*p) != isdigdot(lp) || isspecialver(*p)) &&
  -            (lq != '.' && *p != '.')) {
  -            lq = *q;
  -            *q++ = '.';
  -        }
  -        *q++ = lp = *p++;
  +		if (isspecialver(*p)) {
  +			if (lq != '.') {
  +				lq = *q++ = '.';
  +			}
  +		} else if ((isndig(lp) && isdig(*p)) || (isdig(lp) && isndig(*p))) {
  +			if (lq != '.') {
  +				*q++ = '.';
  +			}
  +			lq = *q++ = *p;
  +		} else if (!isalnum(*p)) {
  +			if (lq != '.') {
  +				lq = *q++ = '.';
  +			}
  +		} else {
  +			lq = *q++ = *p;
  +		}
  +		lp = *p++;
       }
       *q++ = '\0';
       return buf;
  @@ -69,30 +81,37 @@
   /* }}} */
   /* {{{ compare_special_version_forms() */
   
  +typedef struct {
  +	const char *name;
  +	int order;
  +} special_forms_t;
  +
   static int
  -compare_special_version_forms(const char *form1, const char *form2)
  +compare_special_version_forms(char *form1, char *form2)
   {
  -	int i, found1 = -1, found2 = -1;
  -	char **pp;
  -	static char *special_forms[] = {
  -		"dev",
  -		"a",
  -		"b",
  -		"RC",
  -		"#N#",
  -		"pl",
  -		NULL
  +	int found1 = -1, found2 = -1;
  +	special_forms_t special_forms[9] = {
  +		{"dev", 0},
  +		{"alpha", 1},
  +		{"a", 1},
  +		{"beta", 2},
  +		{"b", 2},
  +		{"RC", 3},
  +		{"#", 4},
  +		{"pl", 5},
  +		{NULL, 0},
   	};
  +	special_forms_t *pp;
   
  -	for (pp = special_forms, i = 0; *pp != NULL; pp++, i++) {
  -		if (strncmp(form1, *pp, strlen(*pp)) == 0) {
  -			found1 = i;
  +	for (pp = special_forms; pp && pp->name; pp++) {
  +		if (strncmp(form1, pp->name, strlen(pp->name)) == 0) {
  +			found1 = pp->order;
   			break;
   		}
   	}
  -	for (pp = special_forms, i = 0; *pp != NULL; pp++, i++) {
  -		if (strncmp(form2, *pp, strlen(*pp)) == 0) {
  -			found2 = i;
  +	for (pp = special_forms; pp && pp->name; pp++) {
  +		if (strncmp(form2, pp->name, strlen(pp->name)) == 0) {
  +			found2 = pp->order;
   			break;
   		}
   	}
  @@ -118,8 +137,16 @@
   			return *orig_ver1 ? 1 : -1;
   		}
   	}
  -	ver1 = php_canonicalize_version(orig_ver1);
  -	ver2 = php_canonicalize_version(orig_ver2);
  +	if (orig_ver1[0] == '#') {
  +		ver1 = estrdup(orig_ver1);
  +	} else {
  +		ver1 = php_canonicalize_version(orig_ver1);
  +	}
  +	if (orig_ver2[0] == '#') {
  +		ver2 = estrdup(orig_ver2);
  +	} else {
  +		ver2 = php_canonicalize_version(orig_ver2);
  +	}
   	p1 = n1 = ver1;
   	p2 = n2 = ver2;
   	while (*p1 && *p2 && n1 && n2) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +7 -1      php4/ext/wddx/wddx.c
  
  Index: wddx.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/wddx/wddx.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- wddx.c	19 May 2002 11:16:06 -0000	1.2.2.1
  +++ wddx.c	3 Aug 2002 00:44:18 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: wddx.c,v 1.92 2002/05/13 17:28:37 andrei Exp $ */
  +/* $Id: wddx.c,v 1.93 2002/07/17 19:27:36 andrei Exp $ */
   
   #include "php.h"
   #include "php_wddx.h"
  @@ -107,6 +107,12 @@
   
   PHP_MINIT_FUNCTION(wddx);
   PHP_MINFO_FUNCTION(wddx);
  +
  +/* {{{ dynamically loadable module stuff */
  +#ifdef COMPILE_DL_WDDX
  +ZEND_GET_MODULE(wddx)
  +#endif /* COMPILE_DL_WDDX */
  +/* }}} */
   
   /* {{{ wddx_module_entry
    */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +9 -4      php4/ext/xmlrpc/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/config.m4,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- config.m4	29 Apr 2002 02:31:06 -0000	1.2
  +++ config.m4	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.15 2002/04/06 03:50:27 andrei Exp $
  +dnl $Id: config.m4,v 1.16 2002/07/28 21:03:24 yohgaki Exp $
   dnl
   
   sinclude(ext/xmlrpc/libxmlrpc/acinclude.m4)
  @@ -58,12 +58,17 @@
   elif test "$PHP_XMLRPC" != "no"; then
   
     if test -r $PHP_XMLRPC/include/xmlrpc.h; then
  -    XMLRPC_DIR=$PHP_XMLRPC
  +    XMLRPC_DIR=$PHP_XMLRPC/include
  +  elif test -r $PHP_XMLRPC/include/xmlrpc-epi/xmlrpc.h; then
  +dnl some xmlrpc-epi header files have generic file names like
  +dnl queue.h or base64.h. Distributions have to create dir
  +dnl for xmlrpc-epi because of this.
  +    XMLRPC_DIR=$PHP_XMLRPC/include/xmlrpc-epi
     else
       AC_MSG_CHECKING(for XMLRPC-EPI in default path)
       for i in /usr/local /usr; do
         if test -r $i/include/xmlrpc.h; then
  -        XMLRPC_DIR=$i
  +        XMLRPC_DIR=$i/include
           AC_MSG_RESULT(found in $i)
         fi
       done
  @@ -74,7 +79,7 @@
       AC_MSG_ERROR(Please reinstall the XMLRPC-EPI distribution)
     fi
   
  -  PHP_ADD_INCLUDE($XMLRPC_DIR/include)
  +  PHP_ADD_INCLUDE($XMLRPC_DIR)
     PHP_ADD_LIBRARY_WITH_PATH(xmlrpc, $XMLRPC_DIR/lib, XMLRPC_SHARED_LIBADD)
     
   fi
  
  
  
  1.2.2.1   +1 -0      php4/ext/xmlrpc/php_xmlrpc.h
  
  Index: php_xmlrpc.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/php_xmlrpc.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_xmlrpc.h	29 Apr 2002 02:31:06 -0000	1.2
  +++ php_xmlrpc.h	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -80,6 +80,7 @@
   PHP_FUNCTION(xmlrpc_encode_request);
   PHP_FUNCTION(xmlrpc_get_type);
   PHP_FUNCTION(xmlrpc_set_type);
  +PHP_FUNCTION(xmlrpc_is_fault);
   PHP_FUNCTION(xmlrpc_server_create);
   PHP_FUNCTION(xmlrpc_server_destroy);
   PHP_FUNCTION(xmlrpc_server_register_method);
  
  
  
  1.2.2.2   +68 -17    php4/ext/xmlrpc/xmlrpc-epi-php.c
  
  Index: xmlrpc-epi-php.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/xmlrpc-epi-php.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- xmlrpc-epi-php.c	9 Jul 2002 09:14:41 -0000	1.2.2.1
  +++ xmlrpc-epi-php.c	3 Aug 2002 00:44:18 -0000	1.2.2.2
  @@ -68,7 +68,7 @@
   #endif
   #include "xmlrpc.h"
   
  -#define PHP_EXT_VERSION "0.50"
  +#define PHP_EXT_VERSION "0.51"
   
   /* You should tweak config.m4 so this symbol (or some else suitable)
   	gets defined.  */
  @@ -87,6 +87,7 @@
   	PHP_FE(xmlrpc_encode_request,							NULL)
   	PHP_FE(xmlrpc_get_type,									NULL)
   	PHP_FE(xmlrpc_set_type,									first_args_force_ref)
  +	PHP_FE(xmlrpc_is_fault,									NULL)
   	PHP_FE(xmlrpc_server_create,							NULL)
   	PHP_FE(xmlrpc_server_destroy,							NULL)
   	PHP_FE(xmlrpc_server_register_method,					NULL)
  @@ -176,8 +177,13 @@
   /* value types */
   #define OBJECT_TYPE_ATTR  "xmlrpc_type"
   #define OBJECT_VALUE_ATTR "scalar"
  +#define OBJECT_VALUE_TS_ATTR "timestamp"
   
  -
  +/* faults */
  +#define FAULT_CODE       "faultCode"
  +#define FAULT_CODE_LEN   (sizeof(FAULT_CODE) - 1)
  +#define FAULT_STRING     "faultString"
  +#define FAULT_STRING_LEN (sizeof(FAULT_STRING) - 1)
   
   /***********************
   * forward declarations *
  @@ -753,7 +759,7 @@
         zval* retval = decode_request_worker(xml, encoding, method);
         if(retval) {
            *return_value = *retval;
  -         zval_copy_ctor(return_value);
  +         FREE_ZVAL(retval);
         }
      }
   }
  @@ -779,7 +785,7 @@
         zval* retval = decode_request_worker(arg1, arg2, NULL);
         if(retval) {
            *return_value = *retval;
  -		 FREE_ZVAL(retval);
  +         FREE_ZVAL(retval);
         }
      }
   }
  @@ -1119,14 +1125,6 @@
   							out.xmlrpc_out.version = opts->version;
   						}
   					}
  -
  -					/* automagically determine output serialization type from request type */
  -					if (out.b_auto_version) { 
  -						XMLRPC_REQUEST_OUTPUT_OPTIONS opts = XMLRPC_RequestGetOutputOptions(xRequest);
  -						if (opts) {
  -							out.xmlrpc_out.version = opts->version;
  -						}
  -					}
                    /* set some required request hoojum */
                    XMLRPC_RequestSetOutputOptions(xResponse, &out.xmlrpc_out);
                    XMLRPC_RequestSetRequestType(xResponse, xmlrpc_request_response);
  @@ -1315,7 +1313,7 @@
    * note: this only works on strings, and only for date and base64,
    *       which do not have native php types. black magic lies herein.
    */
  -int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE type)
  +int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype)
   {
      int bSuccess = FAILURE;
   
  @@ -1323,8 +1321,8 @@
       * base64 and datetime.  all other types have corresponding php types
       */
      if (Z_TYPE_P(value) == IS_STRING) {
  -      if (type == xmlrpc_base64 || type == xmlrpc_datetime) {
  -         const char* typestr = xmlrpc_type_as_str(type, xmlrpc_vector_none);
  +      if (newtype == xmlrpc_base64 || newtype == xmlrpc_datetime) {
  +         const char* typestr = xmlrpc_type_as_str(newtype, xmlrpc_vector_none);
            zval* type;
   
            MAKE_STD_ZVAL(type);
  @@ -1333,8 +1331,30 @@
            Z_STRVAL_P(type) = estrdup(typestr);
            Z_STRLEN_P(type) = strlen(typestr);
   
  -         convert_to_object(value);
  -         bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL);
  +         if(newtype == xmlrpc_datetime) {
  +            XMLRPC_VALUE v = XMLRPC_CreateValueDateTime_ISO8601(NULL, value->value.str.val);
  +            if(v) {
  +               time_t timestamp = XMLRPC_GetValueDateTime(v);
  +               if(time) {
  +                  pval* ztimestamp;
  +
  +                  MAKE_STD_ZVAL(ztimestamp);
  +
  +                  ztimestamp->type = IS_LONG;
  +                  ztimestamp->value.lval = timestamp;
  +
  +                  convert_to_object(value);
  +                  if(SUCCESS == zend_hash_update(value->value.obj.properties, OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL)) {
  +                     bSuccess = zend_hash_update(value->value.obj.properties, OBJECT_VALUE_TS_ATTR, sizeof(OBJECT_VALUE_TS_ATTR), (void *) &ztimestamp, sizeof(zval *), NULL);
  +                  }
  +               }
  +               XMLRPC_CleanupValue(v);
  +            }
  +         }
  +         else {
  +            convert_to_object(value);
  +            bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL);
  +         }
         }
      }
      
  @@ -1456,6 +1476,37 @@
      
      RETURN_STRING((char*) xmlrpc_type_as_str(type, vtype), 1);
   }
  +
  +/* {{{ proto string xmlrpc_is_fault(array)
  +   Determines if an array value represents an XMLRPC fault. */
  +PHP_FUNCTION(xmlrpc_is_fault)
  +{
  +   zval* arg, **val;
  +
  +   if (!(ARG_COUNT(ht) == 1) || getParameters(ht, ARG_COUNT(ht), &arg) == FAILURE) {
  +      WRONG_PARAM_COUNT; /* prints/logs a warning and returns */
  +   }
  +
  +	if (Z_TYPE_P(arg) != IS_ARRAY) {
  +		php_error(E_NOTICE, "%s(): Array argument expected", get_active_function_name(TSRMLS_C));
  +	}
  +   else {
  +      /* The "correct" way to do this would be to call the xmlrpc
  +       * library XMLRPC_ValueIsFault() func.  However, doing that
  +       * would require us to create an xmlrpc value from the php
  +       * array, which is rather expensive, especially if it was
  +       * a big array.  Thus, we resort to this not so clever hackery.
  +       */
  +      if( zend_hash_find(Z_ARRVAL_P(arg), FAULT_CODE, FAULT_CODE_LEN + 1, (void**) &val) == SUCCESS &&
  +          zend_hash_find(Z_ARRVAL_P(arg), FAULT_STRING, FAULT_STRING_LEN + 1, (void**) &val) == SUCCESS)
  +      {
  +         RETURN_TRUE;
  +      }
  +   }
  +
  +   RETURN_FALSE;
  +}
  +
   
   
   /*
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +5 -1      php4/ext/xmlrpc/libxmlrpc/encodings.c
  
  Index: encodings.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/encodings.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- encodings.c	9 Jul 2002 09:14:41 -0000	1.2.2.1
  +++ encodings.c	3 Aug 2002 00:44:18 -0000	1.2.2.2
  @@ -34,9 +34,13 @@
   #include "config.h"
   #endif
   
  +#ifndef PHP_WIN32
   #include <php_config.h>
  +#else
  +#include <config.w32.h>
  +#endif
   
  -static const char rcsid[] = "#(@) $Id: encodings.c,v 1.3 2002/06/30 05:10:39 sniper Exp $";
  +static const char rcsid[] = "#(@) $Id: encodings.c,v 1.4 2002/07/03 10:54:41 edink Exp $";
   
   #include <errno.h>
   
  
  
  
  1.2.2.1   +2 -1      php4/ext/xmlrpc/libxmlrpc/queue.c
  
  Index: queue.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/queue.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- queue.c	29 Apr 2002 02:31:07 -0000	1.2
  +++ queue.c	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -1,4 +1,4 @@
  -static const char rcsid[] = "#(@) $Id: queue.c,v 1.3 2001/12/03 22:33:31 shane Exp $";
  +static const char rcsid[] = "#(@) $Id: queue.c,v 1.4 2002/07/05 04:43:53 danda Exp $";
   
   /* 
    * Date last modified: Jan 2001
  @@ -367,6 +367,7 @@
   
         return True_;
      }
  +   return False_;
   }
   
   
  
  
  
  1.2.2.1   +11 -1     php4/ext/xmlrpc/libxmlrpc/simplestring.c
  
  Index: simplestring.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/simplestring.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- simplestring.c	29 Apr 2002 02:31:07 -0000	1.2
  +++ simplestring.c	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -31,7 +31,7 @@
   */
   
   
  -static const char rcsid[] = "#(@) $Id: simplestring.c,v 1.1 2001/09/06 04:13:29 danda Exp $";
  +static const char rcsid[] = "#(@) $Id: simplestring.c,v 1.2 2002/07/05 04:43:53 danda Exp $";
   
   
   #define SIMPLESTRING_INCR 32
  @@ -44,6 +44,16 @@
    * CREATION DATE
    *   06/2000
    * HISTORY
  + *   $Log: simplestring.c,v $
  + *   Revision 1.2  2002/07/05 04:43:53  danda
  + *   merged in updates from SF project.  bring php repository up to date with xmlrpc-epi version 0.51
  + *
  + *   Revision 1.4  2002/02/13 20:58:50  danda
  + *   patch to make source more windows friendly, contributed by Jeff Lawson
  + *
  + *   Revision 1.3  2001/09/29 21:58:05  danda
  + *   adding cvs log to history section
  + *
    *   10/15/2000 -- danda -- adding robodoc documentation
    * PORTABILITY
    *   Coded on RedHat Linux 6.2.  Builds on Solaris x86.  Should build on just
  
  
  
  1.2.2.1   +1 -0      php4/ext/xmlrpc/libxmlrpc/simplestring.h
  
  Index: simplestring.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/simplestring.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- simplestring.h	29 Apr 2002 02:31:07 -0000	1.2
  +++ simplestring.h	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -62,6 +62,7 @@
   void simplestring_init(simplestring* string);
   void simplestring_clear(simplestring* string);
   void simplestring_free(simplestring* string);
  +void simplestring_add(simplestring* string, const char* add);
   void simplestring_addn(simplestring* string, const char* add, int add_len);
   
   #ifdef __cplusplus
  
  
  
  1.2.2.1   +7 -0      php4/ext/xmlrpc/libxmlrpc/system_methods.c
  
  Index: system_methods.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/system_methods.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- system_methods.c	29 Apr 2002 02:31:07 -0000	1.2
  +++ system_methods.c	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -35,6 +35,13 @@
    * AUTHOR
    *   Dan Libby, aka danda  (dan****@libby*****)
    * HISTORY
  + *   $Log: system_methods.c,v $
  + *   Revision 1.2  2002/07/05 04:43:53  danda
  + *   merged in updates from SF project.  bring php repository up to date with xmlrpc-epi version 0.51
  + *
  + *   Revision 1.7  2001/09/29 21:58:05  danda
  + *   adding cvs log to history section
  + *
    *   4/28/2001 -- danda -- adding system.multicall and separating out system methods.
    * TODO
    * NOTES
  
  
  
  1.2.2.1   +25 -4     php4/ext/xmlrpc/libxmlrpc/xml_element.c
  
  Index: xml_element.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/xml_element.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- xml_element.c	29 Apr 2002 02:31:07 -0000	1.2
  +++ xml_element.c	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -31,7 +31,7 @@
   */
   
   
  -static const char rcsid[] = "#(@) $Id: xml_element.c,v 1.2 2001/12/03 22:33:31 shane Exp $";
  +static const char rcsid[] = "#(@) $Id: xml_element.c,v 1.3 2002/07/05 04:43:53 danda Exp $";
   
   
   
  @@ -43,6 +43,25 @@
    * CREATION DATE
    *   06/2000
    * HISTORY
  + *   $Log: xml_element.c,v $
  + *   Revision 1.3  2002/07/05 04:43:53  danda
  + *   merged in updates from SF project.  bring php repository up to date with xmlrpc-epi version 0.51
  + *
  + *   Revision 1.9  2002/07/03 20:54:30  danda
  + *   root element should not have a parent. patch from anon SF user
  + *
  + *   Revision 1.8  2002/05/23 17:46:51  danda
  + *   patch from mukund - fix non utf-8 encoding conversions
  + *
  + *   Revision 1.7  2002/02/13 20:58:50  danda
  + *   patch to make source more windows friendly, contributed by Jeff Lawson
  + *
  + *   Revision 1.6  2002/01/08 01:06:55  danda
  + *   enable <?xml version="1.0"?> format for parsers that are very picky.
  + *
  + *   Revision 1.5  2001/09/29 21:58:05  danda
  + *   adding cvs log to history section
  + *
    *   10/15/2000 -- danda -- adding robodoc documentation
    * TODO
    *   Nicer external API. Get rid of macros.  Make opaque types, etc.
  @@ -86,7 +105,7 @@
   
   #define XML_DECL_START                 "<?xml"
   #define XML_DECL_START_LEN             sizeof(XML_DECL_START) - 1
  -#define XML_DECL_VERSION               "version='1.0'"
  +#define XML_DECL_VERSION               "version=\"1.0\""
   #define XML_DECL_VERSION_LEN           sizeof(XML_DECL_VERSION) - 1
   #define XML_DECL_ENCODING_ATTR         "encoding"
   #define XML_DECL_ENCODING_ATTR_LEN     sizeof(XML_DECL_ENCODING_ATTR) - 1
  @@ -353,7 +372,6 @@
             xml_elem_writefunc(fptr, options->encoding, data, 0);
             xml_elem_writefunc(fptr, ATTR_DELIMITER, data, ATTR_DELIMITER_LEN);
         }
  -      xml_elem_writefunc(fptr, WHITESPACE, data, WHITESPACE_LEN);
         xml_elem_writefunc(fptr, XML_DECL_END, data, XML_DECL_END_LEN);
         if(options->verbosity != xml_elem_no_white_space) {
            xml_elem_writefunc(fptr, NEWLINE, data, NEWLINE_LEN);
  @@ -591,8 +609,10 @@
   
         /* Check if we need to decode utf-8 parser output to another encoding */
         if(mydata->needs_enc_conversion && mydata->input_options->encoding) {
  -         char* add_text = utf8_decode(s, len, &len, mydata->input_options->encoding);
  +         int new_len = 0;
  +         char* add_text = utf8_decode(s, len, &new_len, mydata->input_options->encoding);
            if(add_text) {
  +            len = new_len;
               simplestring_addn(&mydata->current->text, add_text, len);
               free(add_text);
               return;
  @@ -700,6 +720,7 @@
         }
         else {
            xReturn = (xml_element*)Q_Head(&mydata.root->children);
  +         xReturn->parent = NULL;
         }
   
         XML_ParserFree(parser);
  
  
  
  1.2.2.1   +1 -1      php4/ext/xmlrpc/libxmlrpc/xml_to_soap.c
  
  Index: xml_to_soap.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/xml_to_soap.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- xml_to_soap.c	29 Apr 2002 02:31:07 -0000	1.2
  +++ xml_to_soap.c	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -5,7 +5,7 @@
   */
   
   
  -/************************************************************************
  +/*-**********************************************************************
   * TODO:                                                                 *
   *  - [SOAP-ENC:position] read sparse arrays (and write?)                *
   *  - [SOAP-ENC:offset] read partially transmitted arrays  (and write?)  *
  
  
  
  1.2.2.1   +25 -6     php4/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
  
  Index: xml_to_xmlrpc.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- xml_to_xmlrpc.c	29 Apr 2002 02:31:07 -0000	1.2
  +++ xml_to_xmlrpc.c	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -31,7 +31,7 @@
   */
   
   
  -static const char rcsid[] = "#(@) $Id: xml_to_xmlrpc.c,v 1.3 2001/12/03 22:33:31 shane Exp $";
  +static const char rcsid[] = "#(@) $Id: xml_to_xmlrpc.c,v 1.4 2002/07/05 04:43:53 danda Exp $";
   
   #ifdef _WIN32
   #include "xmlrpc_win32.h"
  @@ -71,11 +71,30 @@
         current_val = XMLRPC_CreateValueEmpty();
      }
   
  -   if (el->name) {
  -      if (!strcmp(el->name, ELEM_DATA) /* should be ELEM_ARRAY, but there is an extra level. weird */
  -          || ((!strcmp(el->name, ELEM_PARAMS)) && 
  -              (XMLRPC_RequestGetRequestType(request) == xmlrpc_request_call))    /* this "PARAMS" concept is silly.  dave?! */
  -          || !strcmp(el->name, ELEM_FAULT)) {  /* so is this "FAULT" nonsense. */
  +	if (el->name) {
  +
  +      /* first, deal with the crazy/stupid fault format */
  +      if (!strcmp(el->name, ELEM_FAULT)) {
  +			xml_element* fault_value = (xml_element*)Q_Head(&el->children);
  +			XMLRPC_SetIsVector(current_val, xmlrpc_vector_struct);
  +
  +         if(fault_value) {
  +            xml_element* fault_struct = (xml_element*)Q_Head(&fault_value->children);
  +            if(fault_struct) {
  +               xml_element* iter = (xml_element*)Q_Head(&fault_struct->children);
  +
  +               while (iter) {
  +                  XMLRPC_VALUE xNextVal = XMLRPC_CreateValueEmpty();
  +                  xml_element_to_XMLRPC_REQUEST_worker(request, current_val, xNextVal, iter);
  +                  XMLRPC_AddValueToVector(current_val, xNextVal);
  +                  iter = (xml_element*)Q_Next(&fault_struct->children);
  +               }
  +            }
  +         }
  +      }
  +		else if (!strcmp(el->name, ELEM_DATA)	/* should be ELEM_ARRAY, but there is an extra level. weird */
  +			 || (!strcmp(el->name, ELEM_PARAMS) && 
  +				  (XMLRPC_RequestGetRequestType(request) == xmlrpc_request_call)) ) {		/* this "PARAMS" concept is silly.  dave?! */
            xml_element* iter = (xml_element*)Q_Head(&el->children);
            XMLRPC_SetIsVector(current_val, xmlrpc_vector_array);
   
  
  
  
  1.2.2.1   +171 -10   php4/ext/xmlrpc/libxmlrpc/xmlrpc.c
  
  Index: xmlrpc.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/xmlrpc.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- xmlrpc.c	29 Apr 2002 02:31:07 -0000	1.2
  +++ xmlrpc.c	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -31,7 +31,7 @@
   */
   
   
  -static const char rcsid[] = "#(@) $Id: xmlrpc.c,v 1.3 2001/12/03 22:33:31 shane Exp $";
  +static const char rcsid[] = "#(@) $Id: xmlrpc.c,v 1.4 2002/07/05 04:43:53 danda Exp $";
   
   
   /****h* ABOUT/xmlrpc
  @@ -42,16 +42,34 @@
    * CREATION DATE
    *   9/1999 - 10/2000
    * HISTORY
  + *   $Log: xmlrpc.c,v $
  + *   Revision 1.4  2002/07/05 04:43:53  danda
  + *   merged in updates from SF project.  bring php repository up to date with xmlrpc-epi version 0.51
  + *
  + *   Revision 1.22  2002/03/09 23:15:44  danda
  + *   add fault interrogation funcs
  + *
  + *   Revision 1.21  2002/03/09 22:27:41  danda
  + *   win32 build patches contributed by Jeff Lawson
  + *
  + *   Revision 1.20  2002/02/13 20:58:50  danda
  + *   patch to make source more windows friendly, contributed by Jeff Lawson
  + *
  + *   Revision 1.19  2001/10/12 23:25:54  danda
  + *   default to writing xmlrpc
  + *
  + *   Revision 1.18  2001/09/29 21:58:05  danda
  + *   adding cvs log to history section
  + *
  + *   10/15/2000 -- danda -- adding robodoc documentation
  + *   08/2000 -- danda -- PHP C extension that uses XMLRPC                     
  + *   08/2000 -- danda -- support for two vocabularies: danda-rpc and xml-rpc
    *   09/1999 -- danda -- Initial API, before I even knew of standard XMLRPC vocab. Response only.
  - *   06/2000 -- danda -- played with expat-ensor from www.ensor.org.  Cool, but some flaws.
    *   07/2000 -- danda -- wrote new implementation to be compatible with xmlrpc standard and
    *                       incorporated some ideas from ensor, most notably the separation of
    *                       xml dom from xmlrpc api.
  - *   08/2000 -- danda -- support for two vocabularies: danda-rpc and xml-rpc
  - *   08/2000 -- danda -- PHP C extension that uses XMLRPC                     
  - *   10/15/2000 -- danda -- adding robodoc documentation
  + *   06/2000 -- danda -- played with expat-ensor from www.ensor.org.  Cool, but some flaws.
    * TODO
  - *   Server method introspection. (Enumerate available methods, describe I/O)
    * PORTABILITY
    *   Coded on RedHat Linux 6.2.  Builds on Solaris x86.  Should build on just
    *   about anything with minor mods.
  @@ -116,6 +134,7 @@
   #include "xml_element.h"
   #include "xmlrpc_private.h"
   #include "xmlrpc_introspection_private.h"
  +#include "system_methods_private.h"
   
   
   
  @@ -127,7 +146,6 @@
      struct tm tm;
      int n;
      int i;
  -   time_t t;
   	char buf[18];
   
   	if (strchr (text, '-')) {
  @@ -625,7 +643,8 @@
   		if (request->output.version == xmlrpc_version_simple) {
   			root_elem = DANDARPC_REQUEST_to_xml_element (request);
   		}
  -		else if (request->output.version == xmlrpc_version_1_0) {
  +		else if (request->output.version == xmlrpc_version_1_0 ||
  +					request->output.version == xmlrpc_version_none) {
   			root_elem = XMLRPC_REQUEST_to_xml_element (request);
   		}
   		else if (request->output.version == xmlrpc_version_soap_1_1) {
  @@ -2382,7 +2401,7 @@
   
   /*******/
   
  -inline server_method* find_method(XMLRPC_SERVER server, const char* name) {
  +server_method* find_method(XMLRPC_SERVER server, const char* name) {
      server_method* sm;
   
      q_iter qi = Q_Iter_Head_F(&server->methodlist);
  @@ -2649,7 +2668,7 @@
   
   
   /*-******************
  -* Utility API funcs *
  +* Fault API funcs   *
   ********************/
   
   /****f* UTILITY/XMLRPC_UtilityCreateFault
  @@ -2683,6 +2702,7 @@
    *   simplerpc serialization, meaning that there will be no "<fault>" element in that
    *   serialization. There will simply be a standard struct with 2 child elements.  
    *   imho, the "<fault>" element is unnecessary and/or out of place as part of the standard API.
  + *
    * SOURCE
    */
   XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string) {
  @@ -2747,6 +2767,147 @@
   }
   
   /*******/
  +
  +
  +/****f* FAULT/XMLRPC_ValueIsFault
  + * NAME
  + *   XMLRPC_ValueIsFault
  + * SYNOPSIS
  + *   int XMLRPC_ValueIsFault (XMLRPC_VALUE value)
  + * FUNCTION
  + *   Determines if a value encapsulates a fault "object"
  + * INPUTS
  + *   value  any XMLRPC_VALUE
  + * RESULT
  + *   1 if it is a fault, else 0
  + * SEE ALSO
  + *   XMLRPC_ResponseIsFault ()
  + * SOURCE
  + */
  +int XMLRPC_ValueIsFault (XMLRPC_VALUE value) {
  +   if( XMLRPC_VectorGetValueWithID(value, "faultCode") &&
  +       XMLRPC_VectorGetValueWithID(value, "faultString") ) {
  +      return 1;
  +   }
  +   return 0;
  +}
  +/*******/
  +
  +
  +/****f* FAULT/XMLRPC_ResponseIsFault
  + * NAME
  + *   XMLRPC_ResponseIsFault
  + * SYNOPSIS
  + *   int XMLRPC_ResponseIsFault (XMLRPC_REQUEST response)
  + * FUNCTION
  + *   Determines if a response contains an encapsulated fault "object"
  + * INPUTS
  + *   value  any XMLRPC_REQUEST. typically of type xmlrpc_request_response
  + * RESULT
  + *   1 if it contains a fault, else 0
  + * SEE ALSO
  + *   XMLRPC_ValueIsFault ()
  + * SOURCE
  + */
  +int XMLRPC_ResponseIsFault(XMLRPC_REQUEST response) {
  +   return XMLRPC_ValueIsFault( XMLRPC_RequestGetData(response) );
  +}
  +
  +/*******/
  +
  +/****f* FAULT/XMLRPC_GetValueFaultCode
  + * NAME
  + *   XMLRPC_GetValueFaultCode
  + * SYNOPSIS
  + *   int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value)
  + * FUNCTION
  + *   returns fault code from a struct, if any
  + * INPUTS
  + *   value  XMLRPC_VALUE of type xmlrpc_vector_struct.
  + * RESULT
  + *   fault code, else 0.
  + * BUGS
  + *   impossible to distinguish faultCode == 0 from faultCode not present.
  + * SEE ALSO
  + *   XMLRPC_GetResponseFaultCode ()
  + * SOURCE
  + */
  +int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value) {
  +   return XMLRPC_VectorGetIntWithID(value, "faultCode");
  +}
  +
  +/*******/
  +
  +/****f* FAULT/XMLRPC_GetResponseFaultCode
  + * NAME
  + *   XMLRPC_GetResponseFaultCode
  + * SYNOPSIS
  + *   int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response)
  + * FUNCTION
  + *   returns fault code from a response, if any
  + * INPUTS
  + *   response  XMLRPC_REQUEST. typically of type xmlrpc_request_response.
  + * RESULT
  + *   fault code, else 0.
  + * BUGS
  + *   impossible to distinguish faultCode == 0 from faultCode not present.
  + * SEE ALSO
  + *   XMLRPC_GetValueFaultCode ()
  + * SOURCE
  + */
  +int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response) {
  +   return XMLRPC_GetValueFaultCode( XMLRPC_RequestGetData(response) );
  +}
  +
  +/*******/
  +
  +
  +/****f* FAULT/XMLRPC_GetValueFaultString
  + * NAME
  + *   XMLRPC_GetValueFaultString
  + * SYNOPSIS
  + *   const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value)
  + * FUNCTION
  + *   returns fault string from a struct, if any
  + * INPUTS
  + *   value  XMLRPC_VALUE of type xmlrpc_vector_struct.
  + * RESULT
  + *   fault string, else 0.
  + * SEE ALSO
  + *   XMLRPC_GetResponseFaultString ()
  + * SOURCE
  + */
  +const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value) {
  +   return XMLRPC_VectorGetStringWithID(value, "faultString");
  +}
  +
  +/*******/
  +
  +/****f* FAULT/XMLRPC_GetResponseFaultString
  + * NAME
  + *   XMLRPC_GetResponseFaultString
  + * SYNOPSIS
  + *   const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response)
  + * FUNCTION
  + *   returns fault string from a response, if any
  + * INPUTS
  + *   response  XMLRPC_REQUEST. typically of type xmlrpc_request_response.
  + * RESULT
  + *   fault string, else 0.
  + * SEE ALSO
  + *   XMLRPC_GetValueFaultString ()
  + * SOURCE
  + */
  +const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response) {
  +   return XMLRPC_GetValueFaultString( XMLRPC_RequestGetData(response) );
  +}
  +
  +/*******/
  +
  +
  +/*-******************
  +* Utility API funcs *
  +********************/
   
   
   /****f* UTILITY/XMLRPC_Free
  
  
  
  1.2.2.1   +17 -4     php4/ext/xmlrpc/libxmlrpc/xmlrpc.h
  
  Index: xmlrpc.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/xmlrpc.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- xmlrpc.h	29 Apr 2002 02:31:07 -0000	1.2
  +++ xmlrpc.h	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -43,11 +43,11 @@
   
   /* allow version to be specified via compile line define */
   #ifndef XMLRPC_LIB_VERSION
  - #define XMLRPC_LIB_VERSION "0.50"
  + #define XMLRPC_LIB_VERSION "0.51"
   #endif
   
   /* this number, representing the date, must be increased each time the API changes */
  -#define XMLRPC_API_NO 20010721
  +#define XMLRPC_API_NO 20020623
   
   /* this string should be changed with each packaged release */
   #define XMLRPC_VERSION_STR "xmlrpc-epi v. " XMLRPC_LIB_VERSION
  @@ -191,8 +191,8 @@
    * SOURCE
    */
   typedef enum _xmlrpc_version {
  -   xmlrpc_version_none,          /* not a recognized vocabulary    */ 
  -   xmlrpc_version_1_0,           /* xmlrpc 1.0 standard vocab      */ 
  +   xmlrpc_version_none = 0,      /* not a recognized vocabulary    */ 
  +   xmlrpc_version_1_0 = 1,       /* xmlrpc 1.0 standard vocab      */ 
      xmlrpc_version_simple = 2,    /* alt more readable vocab        */ 
      xmlrpc_version_danda = 2,     /* same as simple. legacy         */
   	xmlrpc_version_soap_1_1 = 3	/* SOAP. version 1.1              */
  @@ -334,6 +334,10 @@
   /* Cleanup values */
   void XMLRPC_CleanupValue(XMLRPC_VALUE value);
   
  +/* Request error */
  +XMLRPC_VALUE XMLRPC_RequestSetError (XMLRPC_REQUEST request, XMLRPC_VALUE error);
  +XMLRPC_VALUE XMLRPC_RequestGetError (XMLRPC_REQUEST request);
  +
   /* Copy values */
   XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value);
   XMLRPC_VALUE XMLRPC_DupValueNew(XMLRPC_VALUE xSource);
  @@ -392,6 +396,15 @@
   XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData);
   
   #include "xmlrpc_introspection.h"
  +
  +/* Fault interrogation funcs */
  +int XMLRPC_ValueIsFault (XMLRPC_VALUE value);
  +int XMLRPC_ResponseIsFault(XMLRPC_REQUEST response);
  +int XMLRPC_GetValueFaultCode (XMLRPC_VALUE value);
  +int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response);
  +const char* XMLRPC_GetValueFaultString (XMLRPC_VALUE value);
  +const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response);
  +
   
   /* Public Utility funcs */
   XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string);
  
  
  
  1.2.2.1   +7 -0      php4/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c
  
  Index: xmlrpc_introspection.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- xmlrpc_introspection.c	29 Apr 2002 02:31:07 -0000	1.2
  +++ xmlrpc_introspection.c	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -35,6 +35,13 @@
    * AUTHOR
    *   Dan Libby, aka danda  (dan****@libby*****)
    * HISTORY
  + *   $Log: xmlrpc_introspection.c,v $
  + *   Revision 1.3  2002/07/05 04:43:53  danda
  + *   merged in updates from SF project.  bring php repository up to date with xmlrpc-epi version 0.51
  + *
  + *   Revision 1.9  2001/09/29 21:58:05  danda
  + *   adding cvs log to history section
  + *
    *   4/10/2001 -- danda -- initial introspection support
    * TODO
    * NOTES
  
  
  
  1.2.2.1   +1 -1      php4/ext/xmlrpc/libxmlrpc/xmlrpc_private.h
  
  Index: xmlrpc_private.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xmlrpc/libxmlrpc/xmlrpc_private.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- xmlrpc_private.h	29 Apr 2002 02:31:07 -0000	1.2
  +++ xmlrpc_private.h	3 Aug 2002 00:44:18 -0000	1.2.2.1
  @@ -160,7 +160,7 @@
   /*----------------------------------------------------------------------------
    * Functions
    */
  -extern server_method* find_method(XMLRPC_SERVER server, const char* name);
  +server_method* find_method(XMLRPC_SERVER server, const char* name);
   const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype);
    
   /*----------------------------------------------------------------------------
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +24 -20    php4/ext/xslt/sablot.c
  
  Index: sablot.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/xslt/sablot.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- sablot.c	9 Jul 2002 09:14:41 -0000	1.2.2.1
  +++ sablot.c	3 Aug 2002 00:44:18 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: sablot.c,v 1.48 2002/06/29 01:55:34 sniper Exp $ */
  +/* $Id: sablot.c,v 1.51 2002/07/29 23:57:23 sterling Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
  @@ -52,15 +52,15 @@
   static int  scheme_close(void *, SablotHandle, int);
   
   /* Sax handler functions */
  -static SAX_RETURN sax_startdoc(void *);
  -static SAX_RETURN sax_startelement(void *, const char *, const char **);
  -static SAX_RETURN sax_endelement(void *, const char *);
  -static SAX_RETURN sax_startnamespace(void *, const char *, const char *);
  -static SAX_RETURN sax_endnamespace(void *, const char *);
  -static SAX_RETURN sax_comment(void *, const char *);
  -static SAX_RETURN sax_pi(void *, const char *, const char *);
  -static SAX_RETURN sax_characters(void *, const char *, int);
  -static SAX_RETURN sax_enddoc(void *);
  +static SAX_RETURN sax_startdoc(void *, SablotHandle);
  +static SAX_RETURN sax_startelement(void *, SablotHandle, const char *, const char **);
  +static SAX_RETURN sax_endelement(void *, SablotHandle, const char *);
  +static SAX_RETURN sax_startnamespace(void *, SablotHandle, const char *, const char *);
  +static SAX_RETURN sax_endnamespace(void *, SablotHandle, const char *);
  +static SAX_RETURN sax_comment(void *, SablotHandle, const char *);
  +static SAX_RETURN sax_pi(void *, SablotHandle, const char *, const char *);
  +static SAX_RETURN sax_characters(void *, SablotHandle, const char *, int);
  +static SAX_RETURN sax_enddoc(void *, SablotHandle);
   
   /* Error handlers */
   static MH_ERROR error_makecode(void *, SablotHandle, int, unsigned short, unsigned short);
  @@ -160,6 +160,10 @@
   {
   	php_info_print_table_start();
   	php_info_print_table_row(2, "XSLT support", "enabled");
  +	php_info_print_table_row(2, "Backend", "Sablotron");
  +#ifdef SAB_VERSION
  +	php_info_print_table_row(2, "Sablotron Version", SAB_VERSION);
  +#endif
   	php_info_print_table_end();
   }
   /* }}} */
  @@ -507,7 +511,7 @@
   	}
   	
   	/* Perform transformation */
  -	error = SablotRunProcessor(XSLT_PROCESSOR(handle), xslt, xml, result, params, args);
  +	error = SablotRunProcessor(XSLT_PROCESSOR(handle), xslt, xml, result, (const char**)params, (const char**)args);
   	if (error) {
   		XSLT_ERRNO(handle) = error;
   
  @@ -936,7 +940,7 @@
   
   /* {{{ sax_startdoc()
      Called when the document starts to be processed */
  -static SAX_RETURN sax_startdoc(void *ctx)
  +static SAX_RETURN sax_startdoc(void *ctx, SablotHandle processor)
   {
   	zval       *argv[1];                    /* Arguments to the sax start doc function */
   	zval       *retval;                     /* Return value from sax start doc function */
  @@ -966,7 +970,7 @@
   
   /* {{{ sax_startelement()
      Called when an element is begun to be processed */
  -static SAX_RETURN sax_startelement(void *ctx, 
  +static SAX_RETURN sax_startelement(void *ctx, SablotHandle processor,
                                      const char  *name, 
                                      const char **attr)
   {
  @@ -1014,7 +1018,7 @@
   
   /* {{{ xslt_sax_endelement()
      Called when an ending XML element is encountered */
  -static SAX_RETURN sax_endelement(void *ctx, const char *name)
  +static SAX_RETURN sax_endelement(void *ctx, SablotHandle processor, const char *name)
   {
   	zval        *argv[2];                   /* Arguments to the sax end element function */
   	zval        *retval;                    /* Return value from the sax end element function */
  @@ -1048,7 +1052,7 @@
   
   /* {{{ sax_startnamespace()
      Called at the beginning of the parsing of a new namespace */
  -static SAX_RETURN sax_startnamespace(void *ctx, 
  +static SAX_RETURN sax_startnamespace(void *ctx, SablotHandle processor, 
                                        const char *prefix, 
                                        const char *uri)
   {
  @@ -1087,7 +1091,7 @@
   
   /* {{{ sax_endnamespace()
      Called when a new namespace is finished being parsed */
  -static SAX_RETURN sax_endnamespace(void *ctx, const char *prefix)
  +static SAX_RETURN sax_endnamespace(void *ctx, SablotHandle processor, const char *prefix)
   {
   	zval        *argv[2];                    /* Arguments to the sax end namespace function */
   	zval        *retval;                     /* Return value from the sax end namespace function */
  @@ -1121,7 +1125,7 @@
   
   /* {{{ sax_comment()
      Called when a comment is found */
  -static SAX_RETURN sax_comment(void *ctx, const char *contents)
  +static SAX_RETURN sax_comment(void *ctx, SablotHandle processor, const char *contents)
   {
   	zval        *argv[2];                    /* Arguments to the sax comment function */
   	zval        *retval;                     /* Return value from the sax comment function */
  @@ -1155,7 +1159,7 @@
   
   /* {{{ sax_pi()
      Called when processing instructions are found */
  -static SAX_RETURN sax_pi(void *ctx, 
  +static SAX_RETURN sax_pi(void *ctx, SablotHandle processor,
                            const char *target, 
                            const char *contents)
   {
  @@ -1194,7 +1198,7 @@
   
   /* {{{ sax_characters()
      Called when characters are come upon */
  -static SAX_RETURN sax_characters(void *ctx,
  +static SAX_RETURN sax_characters(void *ctx, SablotHandle processor,
                                    const char *contents, 
                                    int length)
   {
  @@ -1230,7 +1234,7 @@
   
   /* {{{ sax_enddoc()
      Called when the document is finished being parsed */
  -static SAX_RETURN sax_enddoc(void *ctx)
  +static SAX_RETURN sax_enddoc(void *ctx, SablotHandle processor)
   {
   	zval        *argv[1];                    /* Arguments to the end document function */
   	zval        *retval;                     /* Return value from the end document function */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +6 -1      php4/ext/yaz/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/yaz/config.m4,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- config.m4	9 Jul 2002 09:14:42 -0000	1.2.2.1
  +++ config.m4	3 Aug 2002 00:44:18 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.8 2002/06/02 21:58:34 dickmeiss Exp $
  +dnl $Id: config.m4,v 1.9 2002/07/11 13:02:51 dickmeiss Exp $
   dnl
   
   PHP_ARG_WITH(yaz,for YAZ support,
  @@ -27,6 +27,11 @@
         case $c in
          -L*)
            dir=`echo $c|cut -c 3-|sed 's%/\.libs%%g'`
  +        ;;
  +       -lyaz*)
  +        ;;
  +       *)
  +       PHP_EVAL_LIBLINE($c, YAZ_SHARED_LIBADD)
           ;;
         esac
       done
  
  
  
  1.2.2.2   +58 -29    php4/ext/yaz/php_yaz.c
  
  Index: php_yaz.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/yaz/php_yaz.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_yaz.c	9 Jul 2002 09:14:42 -0000	1.2.2.1
  +++ php_yaz.c	3 Aug 2002 00:44:19 -0000	1.2.2.2
  @@ -16,13 +16,14 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: php_yaz.c,v 1.44 2002/06/02 21:59:54 dickmeiss Exp $ */
  +/* $Id: php_yaz.c,v 1.50 2002/07/30 10:50:45 dickmeiss Exp $ */
   
   #ifdef HAVE_CONFIG_H
   #include "config.h"
   #endif
   
   #include "php.h"
  +#include "php_ini.h"
   
   #if HAVE_YAZ
   
  @@ -164,6 +165,7 @@
   	p->zoom_set = 0;
   	p->zoom_scan = 0;
       p->zoom_package = 0;
  +	ZOOM_connection_option_set(p->zoom_conn, "implementationName", "PHP");
   #else
   	p->host_port = 0;
   	p->num_databaseNames = 0;
  @@ -322,11 +324,9 @@
   	{NULL, NULL, NULL}
   };
   
  -static void get_assoc (INTERNAL_FUNCTION_PARAMETERS, pval **id,
  -					   Yaz_Association *assocp)
  +static void get_assoc (INTERNAL_FUNCTION_PARAMETERS, pval **id, Yaz_Association *assocp)
   {
   	Yaz_Association *as = 0;
  -	YAZSLS_FETCH();
   	
   	*assocp = 0;
   #ifdef ZTS
  @@ -1094,14 +1094,13 @@
   	send_APDU (t, apdu);
   }
   
  -static int do_event (int *id, int timeout)
  +static int do_event (int *id, int timeout TSRMLS_DC)
   {
   	fd_set input, output;
   	int i;
   	int no = 0;
   	int max_fd = 0;
   	struct timeval tv;
  -	YAZSLS_FETCH();
   	
   	tv.tv_sec = timeout;
   	tv.tv_usec = 0;
  @@ -1111,7 +1110,7 @@
   #endif
   	FD_ZERO (&input);
   	FD_ZERO (&output);
  -	for (i = 0; i < MAX_ASSOC; i++)
  +	for (i = 0; i < YAZSG(max_links); i++)
   	{
   		Yaz_Association p = shared_associations[i];
   		int fd;
  @@ -1140,7 +1139,7 @@
   #ifdef ZTS
   	tsrm_mutex_lock (yaz_mutex);
   #endif
  -	for (i = 0; i<MAX_ASSOC; i++)
  +	for (i = 0; i<YAZSG(max_links); i++)
   	{
   		int fd;
   		Yaz_Association p = shared_associations[i];
  @@ -1209,12 +1208,13 @@
   	const char *user_str = 0, *group_str = 0, *pass_str = 0;
   	const char *cookie_str = 0, *proxy_str = 0;
       const char *client_IP = 0;
  +    const char *otherInfo[3];
   	int persistent = 1;
   	int piggyback = 1;
   	pval **zurl, **user = 0;
   	Yaz_Association as;
  -	YAZSLS_FETCH();
   
  +    otherInfo[0] = otherInfo[1] = otherInfo[2] = 0;
   	if (ZEND_NUM_ARGS() == 1)
   	{
   		if (zend_get_parameters_ex (1, &zurl) == FAILURE)
  @@ -1241,7 +1241,9 @@
   			piggyback_val = array_lookup_bool(ht, "piggyback");
   			if (piggyback_val)
   				piggyback = *piggyback_val;
  -            client_IP = array_lookup_string(ht, "clientIP");
  +            otherInfo[0] = array_lookup_string(ht, "otherInfo0");
  +            otherInfo[1] = array_lookup_string(ht, "otherInfo1");
  +            otherInfo[2] = array_lookup_string(ht, "otherInfo2");
   		}
   		else
   		{
  @@ -1264,7 +1266,7 @@
   #ifdef ZTS
   	tsrm_mutex_lock (yaz_mutex);
   #endif
  -	for (i = 0; i<MAX_ASSOC; i++)
  +	for (i = 0; i<YAZSG(max_links); i++)
   	{
   		as = shared_associations[i];
   #if USE_ZOOM
  @@ -1276,6 +1278,10 @@
   			!strcmp_null(option_get(as, "cookie"), cookie_str))
   		{
               option_set (as, "clientIP", client_IP);
  +            option_set (as, "otherInfo0", otherInfo[0]);
  +            option_set (as, "otherInfo1", otherInfo[1]);
  +            option_set (as, "otherInfo2", otherInfo[2]);
  +            option_set (as, "proxy", proxy_str);
   			ZOOM_connection_connect (as->zoom_conn, zurl_str, 0);
   			break;
   		}
  @@ -1290,13 +1296,13 @@
   			break;
   #endif
   	}
  -	if (i == MAX_ASSOC)
  +	if (i == YAZSG(max_links))
   	{
   		/* we didn't have it (or already in use) */
   		int i0 = -1;
   		int min_order = 2000000000;
   		/* find completely free slot or the oldest one */
  -		for (i = 0; i<MAX_ASSOC && shared_associations[i]; i++)
  +		for (i = 0; i<YAZSG(max_links) && shared_associations[i]; i++)
   		{
   			as = shared_associations[i];
   			if (persistent && !as->in_use && as->order < min_order)
  @@ -1305,7 +1311,7 @@
   				i0 = i;
   			}
   		}
  -		if (i == MAX_ASSOC)
  +		if (i == YAZSG(max_links))
   		{
   			i = i0;
   			if (i == -1)
  @@ -1325,6 +1331,12 @@
   		option_set (as, "pass", pass_str);
   		option_set (as, "cookie", cookie_str);
           option_set (as, "clientIP", client_IP);
  +
  +        option_set (as, "otherInfo0", otherInfo[0]);
  +        option_set (as, "otherInfo1", otherInfo[1]);
  +        option_set (as, "otherInfo2", otherInfo[2]);
  +        option_set (as, "proxy", proxy_str);
  +        
   		ZOOM_connection_connect (as->zoom_conn, zurl_str, 0);
   #else
   		as->host_port = xstrdup (zurl_str);
  @@ -1524,7 +1536,6 @@
   	ZOOM_connection conn_ar[MAX_ASSOC];
   #endif
   	int i, id, timeout = 15;
  -	YAZSLS_FETCH();
   
   	if (ZEND_NUM_ARGS() == 1)
   	{
  @@ -1548,7 +1559,7 @@
   #ifdef ZTS
   	tsrm_mutex_lock (yaz_mutex);
   #endif
  -	for (i = 0; i<MAX_ASSOC; i++)
  +	for (i = 0; i<YAZSG(max_links); i++)
   	{
   #if USE_ZOOM
   		Yaz_Association p = shared_associations[i];
  @@ -1578,7 +1589,7 @@
   		while (ZOOM_event (no, conn_ar))
   			;
   #else
  -	while (do_event(&id, timeout))
  +	while (do_event(&id, timeout TSRMLS_CC))
   		;
   #endif
   	RETURN_TRUE;
  @@ -2051,7 +2062,7 @@
   			}
   			else if (!strcmp (type, "array"))
   			{
  -				Z_External *ext = (Z_External *) ZOOM_record_get (r, "raw", 0);
  +				Z_External *ext = (Z_External *) ZOOM_record_get (r, "ext", 0);
   				oident *ent = oid_getentbyoid(ext->direct_reference);
   
   				if (ext->which == Z_External_grs1 && ent->value == VAL_GRS1)
  @@ -2666,7 +2677,6 @@
   #else
   	if (p && p->es_response)
   	{
  -		int i;
   		Z_ExtendedServicesResponse *res = p->es_response;
   
   		if (res->taskPackage && 
  @@ -2964,10 +2974,8 @@
   }
   /* }}} */
   
  -void yaz_close_session(Yaz_Association *as)
  +void yaz_close_session(Yaz_Association *as TSRMLS_DC)
   {
  -	YAZSLS_FETCH();
  -
   	if (*as && (*as)->order == YAZSG(assoc_seq))
   	{
   		if ((*as)->persistent)
  @@ -2980,16 +2988,24 @@
   	}
   }
   
  -static void yaz_close_link (zend_rsrc_list_entry *rsrc
  -#ifdef TSRMLS_DC
  -	TSRMLS_DC
  -#endif
  -)
  +static void yaz_close_link (zend_rsrc_list_entry *rsrc TSRMLS_DC)
   {
   	Yaz_Association *as = (Yaz_Association *) rsrc->ptr;
  -	yaz_close_session (as);
  +	yaz_close_session (as TSRMLS_CC);
   }
   
  +/* {{{ PHP_INI_BEGIN
  + */
  +PHP_INI_BEGIN()
  +    STD_PHP_INI_ENTRY("yaz.max_links", "100", PHP_INI_ALL,
  +                      OnUpdateInt, max_links,
  +                      zend_yaz_globals, yaz_globals)
  +    STD_PHP_INI_ENTRY("yaz.log_file", "", PHP_INI_ALL,
  +                      OnUpdateString, log_file,
  +                      zend_yaz_globals, yaz_globals)
  +    PHP_INI_END()
  +/* }}} */
  +    
   PHP_MINIT_FUNCTION(yaz)
   {
   	int i;
  @@ -2997,8 +3013,16 @@
   #ifdef ZTS
   	yaz_mutex = tsrm_mutex_alloc();
   #endif
  +    yaz_log_init_file ("/dev/null");
   	ZEND_INIT_MODULE_GLOBALS(yaz, php_yaz_init_globals, NULL);
   
  +    REGISTER_INI_ENTRIES();
  +
  +    if (YAZSG(log_file))
  +    {
  +        yaz_log_init_file(YAZSG(log_file));
  +        yaz_log_init_level (LOG_ALL);
  +    }
   	le_link = zend_register_list_destructors_ex (yaz_close_link, 0,
   												"YAZ link", module_number);
   	order_associations = 1;
  @@ -3031,6 +3055,9 @@
   	php_info_print_table_start();
   	php_info_print_table_row(2, "YAZ Support", "enabled");
   	php_info_print_table_row(2, "YAZ Version", YAZ_VERSION);
  +#if USE_ZOOM
  +	php_info_print_table_row(2, "ZOOM", "enabled");
  +#endif
   	php_info_print_table_end();
   }
   
  @@ -3041,7 +3068,8 @@
   
   PHP_RINIT_FUNCTION(yaz)
   {
  -	YAZSLS_FETCH();
  +    char pidstr[20];
  +    sprintf (pidstr, "%ld", (long) getpid());
   #ifdef ZTS
   	tsrm_mutex_lock (yaz_mutex);
   #endif
  @@ -3049,6 +3077,7 @@
   #ifdef ZTS
   	tsrm_mutex_unlock (yaz_mutex);
   #endif
  +    yaz_log_init_prefix(pidstr);
   	return SUCCESS;
   }
   
  
  
  
  1.2.2.1   +6 -14     php4/ext/yaz/php_yaz.h
  
  Index: php_yaz.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/yaz/php_yaz.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_yaz.h	29 Apr 2002 02:31:08 -0000	1.2
  +++ php_yaz.h	3 Aug 2002 00:44:19 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: php_yaz.h,v 1.11 2002/02/28 08:27:01 sebastian Exp $ */
  +/* $Id: php_yaz.h,v 1.13 2002/07/12 11:45:04 sniper Exp $ */
   
   #ifndef PHP_YAZ_H
   #define PHP_YAZ_H
  @@ -55,22 +55,14 @@
   
   ZEND_BEGIN_MODULE_GLOBALS(yaz)
       int assoc_seq;
  +    int max_links;
  +    char *log_file;
   ZEND_END_MODULE_GLOBALS(yaz)
  -
  +    
   #ifdef ZTS
  -# define YAZSLS_D	zend_mysql_globals *yaz_globals
  -# define YAZSLS_DC	, YAZSLS_D
  -# define YAZSLS_C	yaz_globals
  -# define YAZSLS_CC , YAZSLS_C
  -# define YAZSG(v) (yaz_globals->v)
  -# define YAZSLS_FETCH()	zend_yaz_globals *yaz_globals = ts_resource(yaz_globals_id)
  +#define YAZSG(v) TSRMG(yaz_globals_id, zend_yaz_globals *, v)
   #else
  -# define YAZSLS_D
  -# define YAZSLS_DC
  -# define YAZSLS_C
  -# define YAZSLS_CC
  -# define YAZSG(v) (yaz_globals.v)
  -# define YAZSLS_FETCH()
  +#define YAZSG(v) (yaz_globals.v)
   #endif
   
   #else
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +4 -1      php4/ext/zlib/php_zlib.h
  
  Index: php_zlib.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/zlib/php_zlib.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_zlib.h	29 Apr 2002 02:31:08 -0000	1.2
  +++ php_zlib.h	3 Aug 2002 00:44:19 -0000	1.2.2.1
  @@ -17,7 +17,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: php_zlib.h,v 1.30 2002/04/10 22:42:24 wez Exp $ */
  +/* $Id: php_zlib.h,v 1.31 2002/07/28 14:08:07 sr Exp $ */
   
   #ifndef PHP_ZLIB_H
   #define PHP_ZLIB_H
  @@ -65,6 +65,9 @@
   #endif
   
   #define phpext_zlib_ptr zlib_module_ptr
  +
  +#define CODING_GZIP		1
  +#define CODING_DEFLATE	2
   
   #endif /* PHP_ZLIB_H */
   
  
  
  
  1.2.2.4   +32 -21    php4/ext/zlib/zlib.c
  
  Index: zlib.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/zlib/zlib.c,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- zlib.c	9 Jul 2002 09:14:42 -0000	1.2.2.3
  +++ zlib.c	3 Aug 2002 00:44:19 -0000	1.2.2.4
  @@ -18,7 +18,7 @@
      |          Jade Nicoletti <nicol****@nns*****>                           |
      +----------------------------------------------------------------------+
    */
  -/* $Id: zlib.c,v 1.136 2002/06/18 10:09:41 derick Exp $ */
  +/* $Id: zlib.c,v 1.137 2002/07/28 14:08:07 sr Exp $ */
   #define IS_EXT_MODULE
   
   #ifdef HAVE_CONFIG_H
  @@ -74,8 +74,6 @@
   #endif
   
   #define OS_CODE			0x03 /* FIXME */
  -#define CODING_GZIP		1
  -#define CODING_DEFLATE	2
   #define GZIP_HEADER_LENGTH		10
   #define GZIP_FOOTER_LENGTH		8
   
  @@ -144,6 +142,26 @@
   		return FAILURE;
   	}
   
  +	if(new_value == NULL)
  +		return FAILURE;
  +
  +	if(!strncasecmp(new_value, "off", sizeof("off"))) {
  +		new_value = "0";
  +		new_value_length = sizeof("0");
  +	} else if(!strncasecmp(new_value, "on", sizeof("on"))) {
  +		new_value = "4096";
  +		new_value_length = sizeof("4096");
  +	} else if(stage == PHP_INI_STAGE_RUNTIME &&
  +			  strncmp(new_value, "0", sizeof("0")) && strncmp(new_value, "1", sizeof("1"))) {
  +		php_error(E_WARNING, "Cannot change zlib.output_compression buffer size during script execution");
  +		return FAILURE;
  +	}
  +
  +	if (stage == PHP_INI_STAGE_RUNTIME && SG(headers_sent) && !SG(request_info).no_headers) {
  +		php_error(E_WARNING, "Cannot change zlib.output_compression - headers already sent");
  +		return FAILURE;
  +	}
  +
   	OnUpdateInt(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
   
   	return SUCCESS;
  @@ -161,7 +179,7 @@
   
   
   PHP_INI_BEGIN()
  -    STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals)
  +    STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals)
   	STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdate_zlib_output_compression_level, output_compression_level, zend_zlib_globals, zlib_globals)
   PHP_INI_END()
   
  @@ -197,6 +215,7 @@
   PHP_RINIT_FUNCTION(zlib)
   {
   	ZLIBG(ob_gzhandler_status) = 0;
  +	ZLIBG(ob_gzip_coding) = 0;
   	switch (ZLIBG(output_compression)) {
   		case 0:
   			break;
  @@ -947,11 +966,15 @@
   {
   	zend_bool do_start, do_end;
   
  -	do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0);
  -	do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0);
  -	if (php_deflate_string(output, output_len, handled_output, handled_output_len, ZLIBG(ob_gzip_coding), do_start, do_end, ZLIBG(output_compression_level) TSRMLS_CC)!=SUCCESS) {
  -		zend_error(E_ERROR, "Compression failed");
  -	} 
  +	if (!ZLIBG(output_compression)) {
  +		*handled_output = NULL;
  +	} else {
  +		do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0);
  +		do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0);
  +		if (php_deflate_string(output, output_len, handled_output, handled_output_len, ZLIBG(ob_gzip_coding), do_start, do_end, ZLIBG(output_compression_level) TSRMLS_CC)!=SUCCESS) {
  +			zend_error(E_ERROR, "Compression failed");
  +		}
  +	}
   }
   /* }}} */
   
  @@ -968,20 +991,8 @@
   	}
   	convert_to_string_ex(a_encoding);
   	if (php_memnstr(Z_STRVAL_PP(a_encoding), "gzip", 4, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
  -		if (sapi_add_header("Content-Encoding: gzip", sizeof("Content-Encoding: gzip") - 1, 1)==FAILURE) {
  -			return FAILURE;
  -		}
  -		if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) {
  -			return FAILURE;			
  -		}
   		ZLIBG(ob_gzip_coding) = CODING_GZIP;
   	} else if(php_memnstr(Z_STRVAL_PP(a_encoding), "deflate", 7, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
  -		if (sapi_add_header("Content-Encoding: deflate", sizeof("Content-Encoding: deflate") - 1, 1)==FAILURE) {
  -			return FAILURE;
  -		}
  -		if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) {
  -			return FAILURE;			
  -		}
   		ZLIBG(ob_gzip_coding) = CODING_DEFLATE;
   	} else {
   		return FAILURE;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +140 -37   php4/main/SAPI.c
  
  Index: SAPI.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/SAPI.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- SAPI.c	9 Jul 2002 09:14:42 -0000	1.2.2.1
  +++ SAPI.c	3 Aug 2002 00:44:19 -0000	1.2.2.2
  @@ -18,7 +18,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: SAPI.c,v 1.133 2002/06/21 09:31:21 derick Exp $ */
  +/* $Id: SAPI.c,v 1.143 2002/08/02 06:53:48 hirokawa Exp $ */
   
   #include <ctype.h>
   #include <sys/stat.h>
  @@ -27,9 +27,13 @@
   #include "SAPI.h"
   #include "ext/standard/php_string.h"
   #include "ext/standard/pageinfo.h"
  -#if HAVE_PCRE || HAVE_BUNDLED_PCRE
  +#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
   #include "ext/pcre/php_pcre.h"
   #endif
  +#if HAVE_ZLIB
  +#include "ext/zlib/php_zlib.h"
  +ZEND_EXTERN_MODULE_GLOBALS(zlib)
  +#endif
   #ifdef ZTS
   #include "TSRM.h"
   #endif
  @@ -216,7 +220,7 @@
   	charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
   
   	if (strncasecmp(mimetype, "text/", 5) == 0 && *charset) {
  -		int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset);
  +		int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset)+1;
   		content_type = emalloc(len);
   		snprintf(content_type, len, "%s; charset=%s", mimetype, charset);
   	} else {
  @@ -334,6 +338,18 @@
   }
   
   
  +static void sapi_send_headers_free(TSRMLS_D)
  +{
  +	if (SG(sapi_headers).http_status_line) {
  +		efree(SG(sapi_headers).http_status_line);
  +		SG(sapi_headers).http_status_line = NULL;
  +	}
  +	if (SG(sapi_headers).mimetype) {
  +		efree(SG(sapi_headers).mimetype);
  +		SG(sapi_headers).mimetype = NULL;
  +	}
  +}
  +	
   SAPI_API void sapi_deactivate(TSRMLS_D)
   {
   	zend_llist_destroy(&SG(sapi_headers).headers);
  @@ -358,6 +374,7 @@
   	if (SG(rfc1867_uploaded_files)) {
   		destroy_uploaded_files_hash(TSRMLS_C);
   	}
  +	sapi_send_headers_free(TSRMLS_C);
   }
   
   
  @@ -385,41 +402,83 @@
   	return code;
   }
   
  +
  +static void sapi_update_response_code(int ncode TSRMLS_DC)
  +{
  +	if (SG(sapi_headers).http_status_line) {
  +		efree(SG(sapi_headers).http_status_line);
  +		SG(sapi_headers).http_status_line = NULL;
  +	}
  +	SG(sapi_headers).http_response_code = ncode;
  +}
  +
   static int sapi_find_matching_header(void *element1, void *element2)
   {
   	return strncasecmp(((sapi_header_struct*)element1)->header, (char*)element2, strlen((char*)element2)) == 0;
   }
   
  -/* This function expects a *duplicated* string, that was previously emalloc()'d.
  - * Pointers sent to this functions will be automatically freed by the framework.
  - */
  -SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace, int http_response_code TSRMLS_DC)
  +SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC)
  +{
  +	sapi_header_line ctr = {0};
  +	int r;
  +	
  +	ctr.line = header_line;
  +	ctr.line_len = header_line_len;
  +
  +	r = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD,
  +			&ctr TSRMLS_CC);
  +
  +	if (!duplicate)
  +		efree(header_line);
  +
  +	return r;
  +}
  +
  +SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
   {
   	int retval;
   	sapi_header_struct sapi_header;
   	char *colon_offset;
   	long myuid = 0L;
  -
  +	char *header_line;
  +	uint header_line_len;
  +	zend_bool replace;
  +	int http_response_code;
  +	
   	if (SG(headers_sent) && !SG(request_info).no_headers) {
   		char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
   		int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);
   
   		if (output_start_filename) {
  -			sapi_module.sapi_error(E_WARNING, "Cannot add header information - headers already sent by (output started at %s:%d)",
  +			sapi_module.sapi_error(E_WARNING, "Cannot modify header information - headers already sent by (output started at %s:%d)",
   				output_start_filename, output_start_lineno);
   		} else {
  -			sapi_module.sapi_error(E_WARNING, "Cannot add header information - headers already sent");
  -		}
  -		if (!duplicate) {
  -			efree(header_line);
  +			sapi_module.sapi_error(E_WARNING, "Cannot modify header information - headers already sent");
   		}
   		return FAILURE;
   	}
   
  -	if (duplicate) {
  -		header_line = estrndup(header_line, header_line_len);
  +	switch (op) {
  +	case SAPI_HEADER_SET_STATUS:
  +		sapi_update_response_code((int) arg TSRMLS_CC);
  +		return SUCCESS;
  +
  +	case SAPI_HEADER_REPLACE:
  +	case SAPI_HEADER_ADD: {
  +		sapi_header_line *p = arg;
  +		header_line = p->line;
  +		header_line_len = p->line_len;
  +		http_response_code = p->response_code;
  +		replace = (op == SAPI_HEADER_REPLACE);
  +		break;
  +		}
  +	
  +	default:
  +		return FAILURE;
   	}
   
  +	header_line = estrndup(header_line, header_line_len);
  +
   	/* cut of trailing spaces, linefeeds and carriage-returns */
   	while(isspace(header_line[header_line_len-1])) 
   		  header_line[--header_line_len]='\0';
  @@ -433,7 +492,7 @@
   	if (header_line_len>=5 
   		&& !strncasecmp(header_line, "HTTP/", 5)) {
   		/* filter out the response code */
  -		SG(sapi_headers).http_response_code = sapi_extract_response_code(header_line);
  +		sapi_update_response_code(sapi_extract_response_code(header_line) TSRMLS_CC);
   		SG(sapi_headers).http_status_line = header_line;
   		return SUCCESS;
   	} else {
  @@ -446,8 +505,17 @@
   				while (*ptr == ' ' && *ptr != '\0') {
   					ptr++;
   				}
  +#if HAVE_ZLIB
  +				if(!strncmp(ptr, "image/", sizeof("image/")-1)) {
  +					ZLIBG(output_compression) = 0;
  +				}
  +#endif
   				mimetype = estrdup(ptr);
   				newlen = sapi_apply_default_charset(&mimetype, len TSRMLS_CC);
  +				if (!SG(sapi_headers).mimetype){
  +					SG(sapi_headers).mimetype = estrdup(mimetype);
  +				}
  +
   				if (newlen != 0) {
   					newlen += sizeof("Content-type: ");
   					newheader = emalloc(newlen);
  @@ -465,20 +533,21 @@
   				if (SG(sapi_headers).http_response_code < 300 ||
   					SG(sapi_headers).http_response_code > 307) {
   					/* Return a Found Redirect if one is not already specified */
  -					SG(sapi_headers).http_response_code = 302;
  +					sapi_update_response_code(302 TSRMLS_CC);
   				}
   			} else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
   				int newlen;
   				char *result, *newheader;
  -#if HAVE_PCRE || HAVE_BUNDLED_PCRE
  -				zval *repl_temp;
  -				char *ptr = colon_offset+1;
  -				int ptr_len=0, result_len = 0;
  -#endif
   
  -				SG(sapi_headers).http_response_code = 401; /* authentication-required */
  -#if HAVE_PCRE || HAVE_BUNDLED_PCRE
  -				if(PG(safe_mode)) {
  +				sapi_update_response_code(401 TSRMLS_CC); /* authentication-required */
  +
  +				if(PG(safe_mode)) 
  +#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
  +				{
  +					zval *repl_temp;
  +					char *ptr = colon_offset+1;
  +					int ptr_len=0, result_len = 0;
  +
   					myuid = php_getuid();
   
   					ptr_len = strlen(ptr);
  @@ -529,7 +598,7 @@
   					efree(repl_temp);
   				} 
   #else
  -				if(PG(safe_mode)) {
  +				{
   					myuid = php_getuid();
   					result = emalloc(32);
   					newlen = sprintf(result, "WWW-Authenticate: %ld", myuid);	
  @@ -546,9 +615,8 @@
   			}
   		}
   	}
  -
   	if (http_response_code) {
  -		SG(sapi_headers).http_response_code = http_response_code;
  +		sapi_update_response_code(http_response_code TSRMLS_CC);
   	}
   	if (sapi_module.header_handler) {
   		retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) TSRMLS_CC);
  @@ -587,6 +655,31 @@
   		return SUCCESS;
   	}
   
  +#if HAVE_ZLIB
  +	/* Add output compression headers at this late stage in order to make
  +	   it possible to switch it off inside the script. */
  +	if (ZLIBG(output_compression)) {
  +		switch (ZLIBG(ob_gzip_coding)) {
  +			case CODING_GZIP:
  +				if (sapi_add_header("Content-Encoding: gzip", sizeof("Content-Encoding: gzip") - 1, 1)==FAILURE) {
  +					return FAILURE;
  +				}
  +				if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) {
  +					return FAILURE;			
  +				}
  +				break;
  +			case CODING_DEFLATE:
  +				if (sapi_add_header("Content-Encoding: deflate", sizeof("Content-Encoding: deflate") - 1, 1)==FAILURE) {
  +					return FAILURE;
  +				}
  +				if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) {
  +					return FAILURE;			
  +				}
  +				break;
  +		}
  +	}
  +#endif
  +
   	/* Success-oriented.  We set headers_sent to 1 here to avoid an infinite loop
   	 * in case of an error situation.
   	 */
  @@ -602,12 +695,17 @@
   		case SAPI_HEADER_SENT_SUCCESSFULLY:
   			ret = SUCCESS;
   			break;
  -		case SAPI_HEADER_DO_SEND:
  -			if (SG(sapi_headers).http_status_line) {
  +		case SAPI_HEADER_DO_SEND: {
   				sapi_header_struct http_status_line;
  +				char buf[255];
   
  -				http_status_line.header = SG(sapi_headers).http_status_line;
  -				http_status_line.header_len = strlen(SG(sapi_headers).http_status_line);
  +				if (SG(sapi_headers).http_status_line) {
  +					http_status_line.header = SG(sapi_headers).http_status_line;
  +					http_status_line.header_len = strlen(SG(sapi_headers).http_status_line);
  +				} else {
  +					http_status_line.header = buf;
  +					http_status_line.header_len = sprintf(buf, "HTTP/1.0 %d X", SG(sapi_headers).http_response_code);
  +				}
   				sapi_module.send_header(&http_status_line, SG(server_context) TSRMLS_CC);
   			}
   			zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) sapi_module.send_header, SG(server_context) TSRMLS_CC);
  @@ -626,11 +724,9 @@
   			ret = FAILURE;
   			break;
   	}
  -	
  -	if (SG(sapi_headers).http_status_line) {
  -		efree(SG(sapi_headers).http_status_line);
  -	}
  -	
  +
  +	sapi_send_headers_free(TSRMLS_C);
  +
   	return ret;
   }
   
  @@ -663,6 +759,13 @@
   SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D))
   {
   	sapi_module.default_post_reader = default_post_reader;
  +	return SUCCESS;
  +}
  +
  +
  +SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC))
  +{
  +	sapi_module.treat_data = treat_data;
   	return SUCCESS;
   }
   
  
  
  
  1.2.2.3   +37 -3     php4/main/SAPI.h
  
  Index: SAPI.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/SAPI.h,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- SAPI.h	9 Jul 2002 09:14:42 -0000	1.2.2.2
  +++ SAPI.h	3 Aug 2002 00:44:19 -0000	1.2.2.3
  @@ -51,6 +51,7 @@
   	zend_llist headers;
   	int http_response_code;
   	unsigned char send_default_content_type;
  +	char *mimetype;
   	char *http_status_line;
   } sapi_headers_struct;
   
  @@ -133,9 +134,37 @@
   SAPI_API void sapi_deactivate(TSRMLS_D);
   SAPI_API void sapi_initialize_empty_request(TSRMLS_D);
   
  -SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace, int http_response_code TSRMLS_DC);
  -#define sapi_add_header(header_line, header_line_len, duplicate) \
  -	sapi_add_header_ex((header_line), (header_line_len), (duplicate), 1, 0 TSRMLS_CC)
  +/*
  + * This is the preferred and maintained API for 
  + * operating on HTTP headers.
  + */
  +
  +/*
  + * Always specify a sapi_header_line this way:
  + *
  + *     sapi_header_line ctr = {0};
  + */
  + 
  +typedef struct {
  +	char *line; /* If you allocated this, you need to free it yourself */
  +	uint line_len;
  +	long response_code; /* long due to zend_parse_parameters compatibility */
  +} sapi_header_line;
  +
  +typedef enum {					/* Parameter: 			*/
  +	SAPI_HEADER_REPLACE,		/* sapi_header_line* 	*/
  +	SAPI_HEADER_ADD,			/* sapi_header_line* 	*/
  +	SAPI_HEADER_SET_STATUS		/* int 					*/
  +} sapi_header_op_enum;
  +
  +SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC);
  +
  +
  +/* Deprecated functions. Use sapi_header_op instead. */
  +SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC);
  +#define sapi_add_header(a, b, c) sapi_add_header_ex((a),(b),(c),1 TSRMLS_CC)
  +
  +
   SAPI_API int sapi_send_headers(TSRMLS_D);
   SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
   SAPI_API void sapi_handle_post(void *arg TSRMLS_DC);
  @@ -144,6 +173,7 @@
   SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry);
   SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry);
   SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D));
  +SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC));
   
   SAPI_API int sapi_flush(TSRMLS_D);
   SAPI_API struct stat *sapi_get_stat(TSRMLS_D);
  @@ -186,6 +216,7 @@
   	void (*unblock_interruptions)(void);
   
   	void (*default_post_reader)(TSRMLS_D);
  +	void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC);
   	char *executable_location;
   };
   
  @@ -214,8 +245,11 @@
   #define SAPI_POST_READER_FUNC(post_reader) void post_reader(TSRMLS_D)
   #define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg TSRMLS_DC)
   
  +#define SAPI_TREAT_DATA_FUNC(treat_data) void treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
  +
   SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
   SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader);
  +SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data);
   
   #define STANDARD_SAPI_MODULE_PROPERTIES NULL, NULL
   
  
  
  
  1.1.2.4   +2 -1      php4/main/config.w32.h.in
  
  Index: config.w32.h.in
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/config.w32.h.in,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- config.w32.h.in	9 Jul 2002 09:14:42 -0000	1.1.2.3
  +++ config.w32.h.in	3 Aug 2002 00:44:19 -0000	1.1.2.4
  @@ -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.9 2002/06/21 13:11:47 edink Exp $
  +	$Id: config.w32.h.in,v 1.10 2002/07/03 18:44:40 fmk Exp $
   */
   
   /* Default PHP / PEAR directories */
  @@ -48,6 +48,7 @@
   #define HAVE_MBSTR_KR 1
   #define HAVE_MBSTR_RU 1
   #define HAVE_MBSTR_TW 1
  +#define MBSTR_ENC_TRANS 1
   
   /* Enable / Disable MySQL extension (default: enabled) */
   #define HAVE_MYSQL 1
  
  
  
  1.2.2.6   +24 -14    php4/main/main.c
  
  Index: main.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/main.c,v
  retrieving revision 1.2.2.5
  retrieving revision 1.2.2.6
  diff -u -r1.2.2.5 -r1.2.2.6
  --- main.c	9 Jul 2002 09:14:42 -0000	1.2.2.5
  +++ main.c	3 Aug 2002 00:44:19 -0000	1.2.2.6
  @@ -18,7 +18,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: main.c,v 1.463 2002/07/01 09:00:00 sniper Exp $ */
  +/* $Id: main.c,v 1.470 2002/08/02 06:53:48 hirokawa Exp $ */
   
   /* {{{ includes
    */
  @@ -80,6 +80,7 @@
   #endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */
   
   #include "SAPI.h"
  +#include "rfc1867.h"
   /* }}} */
   
   #ifndef ZTS
  @@ -248,8 +249,8 @@
   	STD_PHP_INI_BOOLEAN("magic_quotes_sybase",	"0",		PHP_INI_ALL,		OnUpdateBool,			magic_quotes_sybase,	php_core_globals,	core_globals)
   	STD_PHP_INI_ENTRY("output_buffering",		"0",		PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateInt,	output_buffering,		php_core_globals,	core_globals)
   	STD_PHP_INI_ENTRY("output_handler",			NULL,		PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateString,	output_handler,		php_core_globals,	core_globals)
  -	STD_PHP_INI_BOOLEAN("register_argc_argv",	"1",		PHP_INI_ALL,		OnUpdateBool,			register_argc_argv,		php_core_globals,	core_globals)
  -	STD_PHP_INI_BOOLEAN("register_globals",		"0",		PHP_INI_ALL,		OnUpdateBool,			register_globals,		php_core_globals,	core_globals)
  +	STD_PHP_INI_BOOLEAN("register_argc_argv",	"1",		PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool,	register_argc_argv,		php_core_globals,	core_globals)
  +	STD_PHP_INI_BOOLEAN("register_globals",		"0",		PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool,	register_globals,		php_core_globals,	core_globals)
   #if PHP_SAFE_MODE
   	STD_PHP_INI_BOOLEAN("safe_mode",			"1",		PHP_INI_SYSTEM,		OnUpdateBool,			safe_mode,				php_core_globals,	core_globals)
   #else
  @@ -266,8 +267,8 @@
   	STD_PHP_INI_ENTRY("arg_separator.output",	"&",		PHP_INI_ALL,		OnUpdateStringUnempty,	arg_separator.output,	php_core_globals,	core_globals)
   	STD_PHP_INI_ENTRY("arg_separator.input",	"&",		PHP_INI_SYSTEM|PHP_INI_PERDIR,	OnUpdateStringUnempty,	arg_separator.input,	php_core_globals,	core_globals)
   
  -	STD_PHP_INI_ENTRY("auto_append_file",		NULL,		PHP_INI_ALL,		OnUpdateString,			auto_append_file,		php_core_globals,	core_globals)
  -	STD_PHP_INI_ENTRY("auto_prepend_file",		NULL,		PHP_INI_ALL,		OnUpdateString,			auto_prepend_file,		php_core_globals,	core_globals)
  +	STD_PHP_INI_ENTRY("auto_append_file",		NULL,		PHP_INI_SYSTEM|PHP_INI_PERDIR,		OnUpdateString,			auto_append_file,		php_core_globals,	core_globals)
  +	STD_PHP_INI_ENTRY("auto_prepend_file",		NULL,		PHP_INI_SYSTEM|PHP_INI_PERDIR,		OnUpdateString,			auto_prepend_file,		php_core_globals,	core_globals)
   	STD_PHP_INI_ENTRY("doc_root",				NULL,		PHP_INI_SYSTEM,		OnUpdateStringUnempty,	doc_root,				php_core_globals,	core_globals)
   	STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET,	PHP_INI_ALL,	OnUpdateString,			default_charset,		sapi_globals_struct,sapi_globals)
   	STD_PHP_INI_ENTRY("default_mimetype",SAPI_DEFAULT_MIMETYPE,	PHP_INI_ALL,	OnUpdateString,			default_mimetype,		sapi_globals_struct,sapi_globals)
  @@ -278,10 +279,12 @@
   	PHP_INI_ENTRY("max_execution_time",			"30",		PHP_INI_ALL,			OnUpdateTimeout)
   	STD_PHP_INI_ENTRY("open_basedir",			NULL,		PHP_INI_SYSTEM,		OnUpdateStringUnempty,	open_basedir,			php_core_globals,	core_globals)
   	STD_PHP_INI_ENTRY("safe_mode_exec_dir",		"1",		PHP_INI_SYSTEM,		OnUpdateString,			safe_mode_exec_dir,		php_core_globals,	core_globals)
  -	STD_PHP_INI_ENTRY("upload_max_filesize",	"2M",		PHP_INI_SYSTEM,		OnUpdateInt,			upload_max_filesize,	php_core_globals,	core_globals)
  -	STD_PHP_INI_BOOLEAN("file_uploads",			"1",		PHP_INI_ALL,		OnUpdateBool,			file_uploads,			php_core_globals,	core_globals)
  -	STD_PHP_INI_ENTRY("post_max_size",			"8M",		PHP_INI_SYSTEM,		OnUpdateInt,			post_max_size,			sapi_globals_struct,sapi_globals)
  +
  +	STD_PHP_INI_BOOLEAN("file_uploads",			"1",		PHP_INI_SYSTEM,		OnUpdateBool,			file_uploads,			php_core_globals,	core_globals)
  +	STD_PHP_INI_ENTRY("upload_max_filesize",	"2M",		PHP_INI_SYSTEM|PHP_INI_PERDIR,		OnUpdateInt,			upload_max_filesize,	php_core_globals,	core_globals)
  +	STD_PHP_INI_ENTRY("post_max_size",			"8M",		PHP_INI_SYSTEM|PHP_INI_PERDIR,		OnUpdateInt,			post_max_size,			sapi_globals_struct,sapi_globals)
   	STD_PHP_INI_ENTRY("upload_tmp_dir",			NULL,		PHP_INI_SYSTEM,		OnUpdateStringUnempty,	upload_tmp_dir,			php_core_globals,	core_globals)
  +
   	STD_PHP_INI_ENTRY("user_dir",				NULL,		PHP_INI_SYSTEM,		OnUpdateStringUnempty,	user_dir,				php_core_globals,	core_globals)
   	STD_PHP_INI_ENTRY("variables_order",		NULL,		PHP_INI_ALL,		OnUpdateStringUnempty,	variables_order,		php_core_globals,	core_globals)
   
  @@ -541,7 +544,7 @@
   }
   /* }}} */
   
  -/* {{{ proto void set_time_limit(int seconds)
  +/* {{{ proto bool set_time_limit(int seconds)
      Sets the maximum time a script can run */
   PHP_FUNCTION(set_time_limit)
   {
  @@ -557,7 +560,11 @@
   	}
   
   	convert_to_string_ex(new_timeout);
  -	zend_alter_ini_entry("max_execution_time", sizeof("max_execution_time"), Z_STRVAL_PP(new_timeout), Z_STRLEN_PP(new_timeout), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
  +	if (zend_alter_ini_entry("max_execution_time", sizeof("max_execution_time"), Z_STRVAL_PP(new_timeout), Z_STRLEN_PP(new_timeout), PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == SUCCESS) {
  +		RETURN_TRUE;
  +	} else {
  +		RETURN_FALSE;
  +	}
   }
   /* }}} */
   
  @@ -771,7 +778,9 @@
   		int i;
   
   		for (i=0; i<NUM_TRACK_VARS; i++) {
  -			zval_ptr_dtor(&PG(http_globals)[i]);
  +			if (PG(http_globals)[i]) {
  +				zval_ptr_dtor(&PG(http_globals)[i]);
  +			}
   		}
   	} zend_end_try();
   
  @@ -973,6 +982,7 @@
   	REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, sizeof(PHP_CONFIG_FILE_PATH)-1, CONST_PERSISTENT | CONST_CS);
   	REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS);
   	php_output_register_constants(TSRMLS_C);
  +	php_rfc1867_register_constants(TSRMLS_C);
   
   	if (php_startup_ticks(TSRMLS_C) == FAILURE) {
   		php_printf("Unable to start PHP ticks\n");
  @@ -1142,21 +1152,21 @@
   			case 'p':
   			case 'P':
   				if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) {
  -					php_treat_data(PARSE_POST, NULL, NULL TSRMLS_CC);	/* POST Data */
  +					sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC);	/* POST Data */
   					_gpc_flags[0]=1;
   				}
   				break;
   			case 'c':
   			case 'C':
   				if (!_gpc_flags[1]) {
  -					php_treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC);	/* Cookie Data */
  +					sapi_module.treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC);	/* Cookie Data */
   					_gpc_flags[1]=1;
   				}
   				break;
   			case 'g':
   			case 'G':
   				if (!_gpc_flags[2]) {
  -					php_treat_data(PARSE_GET, NULL, NULL TSRMLS_CC);	/* GET Data */
  +					sapi_module.treat_data(PARSE_GET, NULL, NULL TSRMLS_CC);	/* GET Data */
   					_gpc_flags[2]=1;
   				}
   				break;
  
  
  
  1.2.2.3   +30 -20    php4/main/network.c
  
  Index: network.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/network.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- network.c	9 Jul 2002 09:14:42 -0000	1.2.2.2
  +++ network.c	3 Aug 2002 00:44:19 -0000	1.2.2.3
  @@ -15,7 +15,7 @@
      | Author: Stig Venaas <venaa****@unine*****>                              |
      +----------------------------------------------------------------------+
    */
  -/* $Id: network.c,v 1.51 2002/06/11 03:55:28 jason Exp $ */
  +/* $Id: network.c,v 1.54 2002/07/22 18:46:26 jason Exp $ */
   
   /*#define DEBUG_MAIN_NETWORK 1*/
   #define MAX_CHUNKS_PER_READ 10
  @@ -58,7 +58,7 @@
   #endif
   
   #ifndef HAVE_INET_ATON
  -int		 inet_aton(const char *, struct in_addr *);
  +int inet_aton(const char *, struct in_addr *);
   #endif
   
   #include "php_network.h"
  @@ -366,25 +366,39 @@
    * port, returns the created socket on success, else returns -1.
    * timeout gives timeout in seconds, 0 means blocking mode.
    */
  -int php_hostconnect(const char *host, unsigned short port, int socktype, int timeout)
  +int php_hostconnect(const char *host, unsigned short port, int socktype, struct timeval *timeout)
   {	
  -	int n, repeatto, s, err;
  +	int n, repeatto, s;
   	struct sockaddr **sal, **psal;
  -	struct timeval timeoutval;
  +	struct timeval individual_timeout;
  +	int set_timeout = 0;
  +#ifdef PHP_WIN32
  +	int err;
  +#endif
   	
   	n = php_network_getaddresses(host, &sal);
   
   	if (n == 0)
   		return -1;
   	
  -	/* is this a good idea? 5s? */
  -	repeatto = timeout / n > 5;
  -	if (repeatto) {
  -		timeout /= n;
  -	}
  -	timeoutval.tv_sec = timeout;
  -	timeoutval.tv_usec = 0;
  +	if (timeout != NULL) {
  +		/* is this a good idea? 5s? */
  +		repeatto = timeout->tv_sec / n > 5;
  +		if (repeatto) {
  +			individual_timeout.tv_sec = timeout->tv_sec / n;
  +		} else {
  +			individual_timeout.tv_sec = timeout->tv_sec;
  +		}
   
  +		individual_timeout.tv_usec = timeout->tv_usec;
  +	} else {
  +		individual_timeout.tv_sec = 0;
  +		individual_timeout.tv_usec = 0;
  +	}
  +	
  +	/* Boolean indicating whether to pass a timeout */
  +	set_timeout = individual_timeout.tv_sec + individual_timeout.tv_usec;
  +	
   	psal = sal;
   	while (*sal != NULL) {
   		s = socket((*sal)->sa_family, socktype, 0);
  @@ -399,7 +413,7 @@
   						sa->sin6_family = (*sal)->sa_family;
   						sa->sin6_port = htons(port);
   						if (php_connect_nonb(s, (struct sockaddr *) sa,
  -									sizeof(*sa), timeout ? &timeoutval : NULL) != SOCK_CONN_ERR)
  +									sizeof(*sa), (set_timeout) ? &individual_timeout : NULL) != SOCK_CONN_ERR)
   							goto ok;
   					} 
   					break;
  @@ -412,7 +426,7 @@
   						sa->sin_family = (*sal)->sa_family;
   						sa->sin_port = htons(port);
   						if (php_connect_nonb(s, (struct sockaddr *) sa,
  -									sizeof(*sa), timeout ? &timeoutval : NULL) != SOCK_CONN_ERR)
  +									sizeof(*sa), (set_timeout) ? &individual_timeout : NULL) != SOCK_CONN_ERR)
   							goto ok;
   
   					} 
  @@ -425,10 +439,6 @@
   			close (s);
   		}
   		sal++;
  -		if (repeatto) {
  -			timeoutval.tv_sec = timeout;
  -			timeoutval.tv_usec = 0;
  -		}
   	}
   	php_network_freeaddresses(psal);
   	php_error(E_WARNING, "php_hostconnect: connect failed");
  @@ -517,7 +527,7 @@
   }
   
   PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short port,
  -		int socktype, int timeout, int persistent STREAMS_DC TSRMLS_DC)
  +		int socktype, struct timeval *timeout, int persistent STREAMS_DC TSRMLS_DC)
   {
   	int socket;
   
  @@ -765,7 +775,7 @@
   		memcpy(WRITEPTR(sock), buf, nr_bytes);
   		sock->writepos += nr_bytes;
   		nr_read = nr_bytes;
  -	} else if(nr_bytes == 0 || (nr_bytes < 0 && errno != EWOULDBLOCK)) {
  +	} else if(nr_bytes == 0 || (nr_bytes < 0 && streams_socket_errno != EWOULDBLOCK)) {
   		sock->eof = 1;
   	}
   
  
  
  
  1.2.2.1   +2 -1      php4/main/php_content_types.c
  
  Index: php_content_types.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/php_content_types.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- php_content_types.c	29 Apr 2002 02:33:38 -0000	1.2
  +++ php_content_types.c	3 Aug 2002 00:44:19 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: php_content_types.c,v 1.20 2002/02/28 08:27:03 sebastian Exp $ */
  +/* $Id: php_content_types.c,v 1.21 2002/08/02 06:53:48 hirokawa Exp $ */
   
   #include "php.h"
   #include "SAPI.h"
  @@ -51,6 +51,7 @@
   {
   	sapi_register_post_entries(php_post_entries);
   	sapi_register_default_post_reader(php_default_post_reader);
  +	sapi_register_treat_data(php_default_treat_data);
   	return SUCCESS;
   }
   /* }}} */
  
  
  
  1.2.2.3   +7 -2      php4/main/php_ini.c
  
  Index: php_ini.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/php_ini.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- php_ini.c	9 Jul 2002 09:14:42 -0000	1.2.2.2
  +++ php_ini.c	3 Aug 2002 00:44:19 -0000	1.2.2.3
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: php_ini.c,v 1.95 2002/05/19 14:45:31 sander Exp $ */
  +/* $Id: php_ini.c,v 1.96 2002/07/29 12:17:34 edink Exp $ */
   
   /* Check CWD for php.ini */
   #define INI_CHECK_CWD
  @@ -312,7 +312,12 @@
   	}
   	/* Search php.ini file in search path */
   	if (!fh.handle.fp) {
  -		fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
  +		char *ini_fname=emalloc(10+strlen(sapi_module.name));
  +		sprintf(ini_fname, "php-%s.ini", sapi_module.name);
  +		if (!(fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC))) {
  +			fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
  +		}
  +		efree(ini_fname);
   		fh.filename = php_ini_opened_path;
   	}
   	if (free_ini_search_path) {
  
  
  
  1.2.2.2   +1 -5      php4/main/php_main.h
  
  Index: php_main.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/php_main.h,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_main.h	19 May 2002 11:16:06 -0000	1.2.2.1
  +++ php_main.h	3 Aug 2002 00:44:19 -0000	1.2.2.2
  @@ -18,7 +18,7 @@
    */
   
   
  -/* $Id: php_main.h,v 1.21 2002/05/12 14:48:20 sas Exp $ */
  +/* $Id: php_main.h,v 1.22 2002/08/02 06:53:48 hirokawa Exp $ */
   
   
   #ifndef PHP_MAIN_H
  @@ -52,9 +52,5 @@
   /* environment module */
   extern int php_init_environ(void);
   extern int php_shutdown_environ(void);
  -
  -#if defined(MBSTR_ENC_TRANS)
  -#define php_treat_data mbstr_treat_data
  -#endif
   
   #endif
  
  
  
  1.2.2.2   +9 -3      php4/main/php_network.h
  
  Index: php_network.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/php_network.h,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_network.h	9 Jul 2002 09:14:42 -0000	1.2.2.1
  +++ php_network.h	3 Aug 2002 00:44:19 -0000	1.2.2.2
  @@ -15,7 +15,7 @@
      | Author: Stig Venaas <venaa****@unine*****>                              |
      +----------------------------------------------------------------------+
    */
  -/* $Id: php_network.h,v 1.21 2002/06/11 03:55:28 jason Exp $ */
  +/* $Id: php_network.h,v 1.23 2002/07/22 18:46:26 jason Exp $ */
   
   #ifndef _PHP_NETWORK_H
   #define _PHP_NETWORK_H
  @@ -43,6 +43,12 @@
   #	define ftruncate(a, b) chsize(a, b)
   #endif /* defined(PHP_WIN32) */
   
  +#ifdef PHP_WIN32
  +#define streams_socket_errno WSAGetLastError()
  +#else
  +#define streams_socket_errno errno
  +#endif
  +
   #ifdef HAVE_NETINET_IN_H
   # include <netinet/in.h>
   #endif
  @@ -85,7 +91,7 @@
   #endif
   
   
  -int php_hostconnect(const char *host, unsigned short port, int socktype, int timeout);
  +int php_hostconnect(const char *host, unsigned short port, int socktype, struct timeval *timeout);
   PHPAPI int php_connect_nonb(int sockfd, const struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout);
   
   #ifdef PHP_WIN32
  @@ -122,7 +128,7 @@
   PHPAPI php_stream *_php_stream_sock_open_from_socket(int socket, int persistent STREAMS_DC TSRMLS_DC );
   /* open a connection to a host using php_hostconnect and return a stream */
   PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short port,
  -		int socktype, int timeout, int persistent STREAMS_DC TSRMLS_DC);
  +		int socktype, struct timeval *timeout, int persistent STREAMS_DC TSRMLS_DC);
   PHPAPI php_stream *_php_stream_sock_open_unix(const char *path, int pathlen, int persistent,
   		struct timeval *timeout STREAMS_DC TSRMLS_DC);
   
  
  
  
  1.2.2.2   +8 -3      php4/main/php_variables.c
  
  Index: php_variables.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/php_variables.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_variables.c	9 May 2002 04:17:00 -0000	1.2.2.1
  +++ php_variables.c	3 Aug 2002 00:44:19 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      |          Zeev Suraski <zeev****@zend*****>                                |
      +----------------------------------------------------------------------+
    */
  -/* $Id: php_variables.c,v 1.36 2002/05/04 17:34:41 sas Exp $ */
  +/* $Id: php_variables.c,v 1.40 2002/08/02 06:53:48 hirokawa Exp $ */
   
   #include <stdio.h>
   #include "php.h"
  @@ -196,6 +196,10 @@
   	char *strtok_buf = NULL;
   	zval *array_ptr = (zval *) arg;
   
  +	if (SG(request_info).post_data==NULL) {
  +		return;
  +	}	
  +
   	var = php_strtok_r(SG(request_info).post_data, "&", &strtok_buf);
   
   	while (var) {
  @@ -212,8 +216,7 @@
   	}
   }
   
  -
  -void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
  +SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
   {
   	char *res = NULL, *var, *val, *separator=NULL;
   	const char *c_var;
  @@ -296,6 +299,8 @@
   			php_url_decode(var, strlen(var));
   			val_len = php_url_decode(val, strlen(val));
   			php_register_variable_safe(var, val, val_len, array_ptr TSRMLS_CC);
  +		} else {
  +			php_register_variable_safe(var, "", 0, array_ptr TSRMLS_CC);
   		}
   		var = php_strtok_r(NULL, separator, &strtok_buf);
   	}
  
  
  
  1.2.2.3   +40 -14    php4/main/rfc1867.c
  
  Index: rfc1867.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/rfc1867.c,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- rfc1867.c	9 Jul 2002 09:14:42 -0000	1.2.2.2
  +++ rfc1867.c	3 Aug 2002 00:44:19 -0000	1.2.2.3
  @@ -16,7 +16,7 @@
      |          Jani Taskinen <snipe****@php*****>                              |
      +----------------------------------------------------------------------+
    */
  -/* $Id: rfc1867.c,v 1.103 2002/06/07 08:00:12 sesser Exp $ */
  +/* $Id: rfc1867.c,v 1.112 2002/08/02 10:22:31 helly Exp $ */
   
   /*
    *  This product includes software developed by the Apache Group
  @@ -32,6 +32,9 @@
   #include "php_variables.h"
   #include "rfc1867.h"
   
  +#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
  +#include "ext/mbstring/mbstring.h"
  +#endif
   
   #undef DEBUG_FILE_UPLOAD
   
  @@ -52,11 +55,20 @@
   #define MAX_SIZE_OF_INDEX sizeof("[tmp_name]")
   
   /* Errors */
  -#define UPLOAD_ERROR_A  1  /* Uploaded file exceeded upload_max_filesize */
  -#define UPLOAD_ERROR_B  2  /* Uploaded file exceeded MAX_FILE_SIZE */
  -#define UPLOAD_ERROR_C  3  /* Only partiallly uploaded */
  -#define UPLOAD_ERROR_D  4  /* No file uploaded */
  -#define UPLOAD_ERROR_E  5  /* Uploaded file size 0 bytes */
  +#define UPLOAD_ERROR_OK   0  /* File upload succesful */
  +#define UPLOAD_ERROR_A    1  /* Uploaded file exceeded upload_max_filesize */
  +#define UPLOAD_ERROR_B    2  /* Uploaded file exceeded MAX_FILE_SIZE */
  +#define UPLOAD_ERROR_C    3  /* Partially uploaded */
  +#define UPLOAD_ERROR_D    4  /* No file uploaded */
  +
  +void php_rfc1867_register_constants(TSRMLS_D)
  +{
  +	REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_OK",         UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT);
  +	REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_INI_SIZE",   UPLOAD_ERROR_A,  CONST_CS | CONST_PERSISTENT);
  +	REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_FORM_SIZE",  UPLOAD_ERROR_B,  CONST_CS | CONST_PERSISTENT);
  +	REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_PARTIAL",    UPLOAD_ERROR_C,  CONST_CS | CONST_PERSISTENT);
  +	REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_FILE",    UPLOAD_ERROR_D,  CONST_CS | CONST_PERSISTENT);
  +}
   
   static void add_protected_variable(char *varname TSRMLS_DC)
   {
  @@ -352,7 +364,7 @@
   			entry.value = estrdup(value);
   			entry.key = estrdup(key);
   
  -		} else if (header->count) { /* If no ':' on the line, add to previous line */
  +		} else if (zend_llist_count(header)) { /* If no ':' on the line, add to previous line */
   
   			prev_len = strlen(prev_entry.value);
   			cur_len = strlen(line);
  @@ -436,7 +448,7 @@
   }
   
   
  -static char *substring_conf(char *start, int len, char quote)
  +static char *substring_conf(char *start, int len, char quote TSRMLS_DC)
   {
   	char *result = emalloc(len + 2);
   	char *resp = result;
  @@ -447,6 +459,12 @@
   			*resp++ = start[++i];
   		} else {
   			*resp++ = start[i];
  +#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
  +			if (mbstr_encoding_translation(TSRMLS_C) && 
  +				mbstr_is_mb_leadbyte(start+i TSRMLS_CC)) {
  +				*resp++ = start[++i];
  +			}
  +#endif
   		}
   	}
   
  @@ -455,7 +473,7 @@
   }
   
   
  -static char *php_ap_getword_conf(char **line)
  +static char *php_ap_getword_conf(char **line TSRMLS_DC)
   {
   	char *str = *line, *strend, *res, quote;
   
  @@ -477,7 +495,7 @@
   				++strend;
   			}
   		}
  -		res = substring_conf(str + 1, strend - str - 1, quote);
  +		res = substring_conf(str + 1, strend - str - 1, quote TSRMLS_CC);
   
   		if (*strend == quote) {
   			++strend;
  @@ -489,7 +507,7 @@
   		while (*strend && !isspace(*strend)) {
   			++strend;
   		}
  -		res = substring_conf(str, strend - str, 0);
  +		res = substring_conf(str, strend - str, 0 TSRMLS_CC);
   	}
   
   	while (*strend && isspace(*strend)) {
  @@ -686,12 +704,12 @@
   						if (param) {
   							efree(param);
   						}
  -						param = php_ap_getword_conf(&pair);
  +						param = php_ap_getword_conf(&pair TSRMLS_CC);
   					} else if (!strcmp(key, "filename")) {
   						if (filename) {
   							efree(filename);
   						}
  -						filename = php_ap_getword_conf(&pair);
  +						filename = php_ap_getword_conf(&pair TSRMLS_CC);
   					}
   				}
   				if (key) {
  @@ -780,7 +798,7 @@
   #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;
  +				cancel_upload = 5;
   			}
   #endif		
   
  @@ -823,7 +841,15 @@
   				sprintf(lbuf, "%s_name", param);
   			}
   
  +#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
  +			if (mbstr_encoding_translation(TSRMLS_C)) {
  +				s = mbstr_strrchr(filename, '\\' TSRMLS_CC);
  +			} else {
  +				s = strrchr(filename, '\\');
  +			}
  +#else
   			s = strrchr(filename, '\\');
  +#endif
   			if (s && s > filename) {
   				safe_php_register_variable(lbuf, s+1, NULL, 0 TSRMLS_CC);
   			} else {
  
  
  
  1.2.2.1   +1 -0      php4/main/rfc1867.h
  
  Index: rfc1867.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/rfc1867.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- rfc1867.h	29 Apr 2002 02:33:38 -0000	1.2
  +++ rfc1867.h	3 Aug 2002 00:44:19 -0000	1.2.2.1
  @@ -8,5 +8,6 @@
   SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler);
   
   void destroy_uploaded_files_hash(TSRMLS_D);
  +void php_rfc1867_register_constants(TSRMLS_D);
   
   #endif /* RFC1867_H */
  
  
  
  1.2.2.1   +10 -5     php4/main/safe_mode.c
  
  Index: safe_mode.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/main/safe_mode.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- safe_mode.c	29 Apr 2002 02:33:38 -0000	1.2
  +++ safe_mode.c	3 Aug 2002 00:44:19 -0000	1.2.2.1
  @@ -15,7 +15,7 @@
      | Author: Rasmus Lerdorf <rasmu****@lerdo*****>                        |
      +----------------------------------------------------------------------+
    */
  -/* $Id: safe_mode.c,v 1.44 2002/03/17 21:00:44 sesser Exp $ */
  +/* $Id: safe_mode.c,v 1.46 2002/07/17 05:15:17 yohgaki Exp $ */
   
   #include "php.h"
   
  @@ -35,12 +35,14 @@
   /*
    * php_checkuid
    *
  - * This function has four modes:
  + * This function has six modes:
    * 
    * 0 - return invalid (0) if file does not exist
    * 1 - return valid (1)  if file does not exist
    * 2 - if file does not exist, check directory
    * 3 - only check directory (needed for mkdir)
  + * 4 - check mode and param
  + * 5 - only check file
    */
   
   PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode)
  @@ -49,9 +51,12 @@
   	int ret, nofile=0;
   	long uid=0L, gid=0L, duid=0L, dgid=0L;
   	char path[MAXPATHLEN];
  -	char *s;
  +	char *s, filenamecopy[MAXPATHLEN];
   	TSRMLS_FETCH();
   
  +	strlcpy(filenamecopy, filename, MAXPATHLEN);
  +	filename=(char *)&filenamecopy;
  +
   	if (!filename) {
   		return 0; /* path must be provided */
   	}
  @@ -67,7 +72,7 @@
   	/* 
   	 * If given filepath is a URL, allow - safe mode stuff
   	 * related to URL's is checked in individual functions
  -     */	
  +	 */
   	if (!strncasecmp(filename,"http://", 7) || !strncasecmp(filename,"ftp://", 6)) {
   		return 1;
   	}
  @@ -116,7 +121,7 @@
   			VCWD_REALPATH(filename, path);
   			*s = DEFAULT_SLASH;
   		} else {
  -			VCWD_GETCWD(path, MAXPATHLEN);
  +			VCWD_GETCWD(path, sizeof(path));
    		}
   	} /* end CHECKUID_ALLOW_ONLY_DIR */
   	
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.4   +9 -8      php4/pear/Makefile.frag
  
  Index: Makefile.frag
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/Makefile.frag,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- Makefile.frag	9 Jul 2002 09:14:43 -0000	1.2.2.3
  +++ Makefile.frag	3 Aug 2002 00:44:19 -0000	1.2.2.4
  @@ -53,15 +53,15 @@
   #PEARCMD=$(top_builddir)/sapi/cli/php -d include_path=$(top_srcdir)/pear pear/scripts/pear.in
   
   install-pear-installer: $(top_builddir)/sapi/cli/php
  -	$(top_builddir)/sapi/cli/php $(srcdir)/install-pear.php $(srcdir)/package-*.xml
  +	@$(top_builddir)/sapi/cli/php $(srcdir)/install-pear.php $(srcdir)/package-*.xml
   
   install-pear-packages: $(top_builddir)/sapi/cli/php
  -	$(top_builddir)/sapi/cli/php $(srcdir)/install-pear.php $(srcdir)/packages/*.tar
  +	@$(top_builddir)/sapi/cli/php $(srcdir)/install-pear.php $(srcdir)/packages/*.tar
   
   install-pear:
  +	@echo "Installing PEAR environment:      $(INSTALL_ROOT)$(peardir)/"
   	@if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
  -		$(MAKE) install-pear-installer; \
  -		$(MAKE) install-pear-packages; \
  +		$(MAKE) -s install-pear-installer install-pear-packages; \
   	else \
   		cat $(srcdir)/install-pear.txt; \
   		exit 5; \
  @@ -82,20 +82,21 @@
   # pear phptar
   
   install-build:
  -	@echo "Installing build environment"
  +	@echo "Installing build environment:     $(INSTALL_ROOT)$(phpbuilddir)/"
   	@$(mkinstalldirs) $(INSTALL_ROOT)$(phpbuilddir) $(INSTALL_ROOT)$(bindir) && \
   	(cd $(top_srcdir) && cp $(BUILD_FILES) $(INSTALL_ROOT)$(phpbuilddir))
   
   install-programs:
  +	@echo "Installing helper programs:       $(INSTALL_ROOT)$(bindir)/"
   	@for prog in $(bin_SCRIPTS); do \
  -		echo "Installing program: $$prog"; \
  +		echo "  program: $$prog"; \
   		$(INSTALL) -m 755 $(builddir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
   	done; \
   	#for file in $(INSTALL_ROOT)$(bindir)/pearcmd-*.php; do \
   	#	rm -f $$file; \
   	#done; \
   	for prog in phpextdist; do \
  -		echo "Installing program: $$prog"; \
  +		echo "  program: $$prog"; \
   		$(INSTALL) -m 755 $(srcdir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
   	done
   
  @@ -117,7 +118,7 @@
   		paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
   	done; \
   	$(mkinstalldirs) $$paths && \
  -	echo "Installing header files" && \
  +	echo "Installing header files:          $(INSTALL_ROOT)$(phpincludedir)/" && \
   	for i in $(HEADER_DIRS); do \
   		(cd $(top_srcdir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
   		cd $(top_builddir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
  
  
  
  1.2.2.2   +27 -5     php4/pear/PEAR.php
  
  Index: PEAR.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR.php,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- PEAR.php	9 Jul 2002 09:14:43 -0000	1.2.2.1
  +++ PEAR.php	3 Aug 2002 00:44:19 -0000	1.2.2.2
  @@ -18,7 +18,7 @@
   // |          Tomas V.V.Cox <cox****@idecn*****>                             |
   // +----------------------------------------------------------------------+
   //
  -// $Id: PEAR.php,v 1.45 2002/06/17 14:35:12 cox Exp $
  +// $Id: PEAR.php,v 1.47 2002/07/21 07:04:45 ssb Exp $
   //
   
   define('PEAR_ERROR_RETURN',   1);
  @@ -26,6 +26,8 @@
   define('PEAR_ERROR_TRIGGER',  4);
   define('PEAR_ERROR_DIE',      8);
   define('PEAR_ERROR_CALLBACK', 16);
  +define('PEAR_ZE2', (function_exists('version_compare') &&
  +                    version_compare(zend_version(), "2-dev", "ge")));
   
   if (substr(PHP_OS, 0, 3) == 'WIN') {
       define('OS_WINDOWS', true);
  @@ -43,6 +45,8 @@
   $GLOBALS['_PEAR_shutdown_funcs']         = array();
   $GLOBALS['_PEAR_error_handler_stack']    = array();
   
  +ini_set('track_errors', true);
  +
   /**
    * Base class for other PEAR classes.  Provides rudimentary
    * emulation of destructors.
  @@ -348,7 +352,7 @@
       }
   
       // }}}
  -   // {{{ _checkDelExpect()
  +    // {{{ _checkDelExpect()
   
       /**
        * This method checks unsets an error code if available
  @@ -508,6 +512,27 @@
       }
   
       // }}}
  +    // {{{ throwError()
  +
  +    /**
  +     * Simpler form of raiseError with fewer options.  In most cases
  +     * message, code and userinfo are enough.
  +     *
  +     * @param string $message
  +     *
  +     */
  +    function &throwError($message = null,
  +                         $code = null,
  +                         $userinfo = null)
  +    {
  +        if (isset($this)) {
  +            return $this->raiseError($message, $code, null, null, $userinfo);
  +        } else {
  +            return PEAR::raiseError($message, $code, null, null, $userinfo);
  +        }
  +    }
  +
  +    // }}}
       // {{{ pushErrorHandling()
   
       /**
  @@ -866,9 +891,6 @@
                              get_class($this), $this->message, $this->code,
                              $callback, $this->error_message_prefix,
                              $this->userinfo);
  -        }
  -        if ($this->mode & PEAR_ERROR_CALLBACK) {
  -            $modes[] = 'callback';
           }
           if ($this->mode & PEAR_ERROR_PRINT) {
               $modes[] = 'print';
  
  
  
  1.2.2.2   +30 -18    php4/pear/System.php
  
  Index: System.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/System.php,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- System.php	9 Jul 2002 09:14:43 -0000	1.2.2.1
  +++ System.php	3 Aug 2002 00:44:19 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
   // | Authors: Tomas V.V.Cox <cox****@idecn*****>                             |
   // +----------------------------------------------------------------------+
   //
  -// $Id: System.php,v 1.15 2002/06/02 14:27:15 dickmann Exp $
  +// $Id: System.php,v 1.16 2002/07/26 10:18:28 cox Exp $
   //
   
   require_once 'PEAR.php';
  @@ -43,7 +43,7 @@
   *
   * @package  System
   * @author   Tomas V.V.Cox <cox****@idecn*****>
  -* @version  $Revision: 1.15 $
  +* @version  $Revision: 1.16 $
   * @access   public
   * @see      http://pear.php.net/manual/
   */
  @@ -388,24 +388,36 @@
       * @return string The temporal directory on the system
       */
       function tmpdir()
  -    {
  -        if (OS_WINDOWS){
  -            if (isset($_ENV['TEMP'])) {
  -                return $_ENV['TEMP'];
  -            }
  -            if (isset($_ENV['TMP'])) {
  -                return $_ENV['TMP'];
  -            }
  -            if (isset($_ENV['windir'])) {
  -                return $_ENV['windir'] . '\temp';
  -            }
  -            return $_ENV['SystemRoot'] . '\temp';
  -        }
  -        if (isset($_ENV['TMPDIR'])) {
  -            return $_ENV['TMPDIR'];
  -        }
  +    {
  +        if (OS_WINDOWS) {
  +            if (System::_myenv('TEMP')) {
  +                return System::_myenv('TEMP');
  +            }
  +            if (System::_myenv('TMP')) {
  +                return System::_myenv('TMP');
  +            }
  +            if (System::_myenv('windir')) {
  +                return System::_myenv('windir') . '\temp';
  +            }
  +            return System::_myenv('SystemRoot') . '\temp';
  +        }
  +        if (System::_myenv('TMPDIR')) {
  +            return System::_myenv('TMPDIR');
  +        }
           return '/tmp';
       }
  +
  +    /**
  +    * (cox) I always get $_ENV empty in both Windows and Linux
  +    * with all PHP version <= 4.2.1
  +    */
  +    function _myenv($var)
  +    {
  +        if (!empty($_ENV)) {
  +            return isset($_ENV[$var]) ? $_ENV[$var] : false;
  +        }
  +        return getenv($var);
  +    }
   
       /**
       * The "type" command (show the full path of a command)
  
  
  
  1.1.2.2   +1 -1      php4/pear/Attic/install-pear.php
  
  Index: install-pear.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/Attic/install-pear.php,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- install-pear.php	10 Jul 2002 01:53:53 -0000	1.1.2.1
  +++ install-pear.php	3 Aug 2002 00:44:19 -0000	1.1.2.2
  @@ -80,7 +80,7 @@
               }
           }
       } else {
  -        $err = $installer->install($instfile);
  +        $err = $installer->install($instfile, array('nodeps' => true));
           if (PEAR::isError($err)) {
               $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
               continue;
  
  
  
  1.1.2.3   +4 -3      php4/pear/package-PEAR.xml
  
  Index: package-PEAR.xml
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/package-PEAR.xml,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- package-PEAR.xml	9 Jul 2002 09:14:43 -0000	1.1.2.2
  +++ package-PEAR.xml	3 Aug 2002 00:44:19 -0000	1.1.2.3
  @@ -40,11 +40,12 @@
   * Added PEAR::delExpect() API method. It allows to unset one or more expected error codes
   * System::mkTemp() automatically remove created tmp files/dirs at script shutdown
   * New command "pear search"
  -
  +* New command "pear upgrade-all"
   Fixed Bugs:
   * fix for XML-RPC bug that made some remote commands fail
   * fix problems under Windows with the DIRECTORY_SEPARATOR
   * lot of other minor fixes
  +* --force option did not work on "pear install Package"
   </notes>
       <filelist>
         <file role="data" name="package.dtd"/>
  @@ -81,11 +82,11 @@
         </dir>
         <dir name="scripts">
           <file baseinstalldir="/" role="script" install-as="pear" name="pear.in">
  -          <replace from="@prefix@/bin" to="bin_dir" type="pear-config"/>
  +          <replace from="@prefix@/bin" to="PHP_BINDIR" type="php-const"/>
             <replace from="@pear_version@" to="version" type="package-info"/>
             <replace from="@include_path@" to="php_dir" type="pear-config"/>
           </file>
  -        <file baseinstalldir="/" role="script" platform="windows" name="pear.bat"></file>
  +        <file baseinstalldir="/" role="script" platform="windows" install-as="pear.bat" name="pear.bat"></file>
         </dir>
       </filelist>
       <deps>
  
  
  
  1.2.2.3   +8 -7      php4/pear/package.dtd
  
  Index: package.dtd
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/package.dtd,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- package.dtd	9 Jul 2002 09:14:43 -0000	1.2.2.2
  +++ package.dtd	3 Aug 2002 00:44:19 -0000	1.2.2.3
  @@ -1,10 +1,10 @@
   <!--
  -     $Id: package.dtd,v 1.26 2002/05/27 01:22:59 ssb Exp $
  +     $Id: package.dtd,v 1.27 2002/07/21 07:06:56 ssb Exp $
   
  -     This is the PEAR package description, version 1.0b8.
  +     This is the PEAR package description, version 1.0b9.
        It should be used with the informal public identifier:
   
  -         "-//PHP Group//DTD PEAR Package 1.0b8//EN//XML"
  +         "-//PHP Group//DTD PEAR Package 1.0b9//EN//XML"
   
        Copyright (c) 1997-2002 The PHP Group             
   
  @@ -31,6 +31,8 @@
   
   <!ELEMENT description (#PCDATA)>
   
  +<!ELEMENT license (#PCDATA)>
  +
   <!ELEMENT maintainers (maintainer)+>
   
   <!ELEMENT maintainer (user|role|name|email)+>
  @@ -89,9 +91,9 @@
   
   <!ELEMENT dep (#PCDATA)>
   <!ATTLIST dep
  -	type    (pkg|ext|php|prog|ldlib|rtlib|os|websrv|sapi) #REQUIRED
  -	rel     (has|eq|lt|le|gt|ge)                          'has'
  -	version CDATA                                         #IMPLIED>
  +	type    (pkg|ext|php|prog|ldlib|rtlib|os|websrv|sapi|zend) #REQUIRED
  +	rel     (has|eq|lt|le|gt|ge) 'has'
  +	version CDATA                #IMPLIED>
   
   <!ELEMENT provides (#PCDATA)>
   <!ATTLIST provides
  @@ -103,7 +105,6 @@
           phase   (pre-install  |post-install  |
                    pre-uninstall|post-uninstall|
                    pre-build    |post-build    |
  -                 pre-configure|post-configure|
                    pre-setup    |post-setup    )         #REQUIRED>
   
   <!ELEMENT configureoptions (configureoption*)>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +5 -3      php4/pear/Archive/Tar.php
  
  Index: Tar.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/Archive/Tar.php,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- Tar.php	9 Jul 2002 09:14:43 -0000	1.2.2.2
  +++ Tar.php	3 Aug 2002 00:44:19 -0000	1.2.2.3
  @@ -16,7 +16,7 @@
   // | Author: Vincent Blavet <vince****@blave*****>                          |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Tar.php,v 1.12 2002/05/28 00:35:16 ssb Exp $
  +// $Id: Tar.php,v 1.13 2002/07/26 15:39:16 cox Exp $
   
   require_once 'PEAR.php';
   
  @@ -24,7 +24,7 @@
   * Creates a (compressed) Tar archive
   *
   * @author   Vincent Blavet <vince****@blave*****>
  -* @version  $Revision: 1.12 $
  +* @version  $Revision: 1.13 $
   * @package  Archive
   */
   class Archive_Tar extends PEAR
  @@ -880,8 +880,10 @@
         else
           $v_binary_data = @fread($this->_file, 512);
   
  -      if (!$this->_readHeader($v_binary_data, $v_header))
  +      if (!$this->_readHeader($v_binary_data, $v_header)) {
  +        fclose($this->_file);
           return false;
  +      }
   
         if ($v_header['filename'] == '')
           continue;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +8 -5      php4/pear/Console/Getopt.php
  
  Index: Getopt.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/Console/Getopt.php,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- Getopt.php	9 Jul 2002 09:14:43 -0000	1.2.2.2
  +++ Getopt.php	3 Aug 2002 00:44:19 -0000	1.2.2.3
  @@ -16,7 +16,7 @@
   // | Author: Andrei Zmievski <andre****@php*****>                             |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Getopt.php,v 1.15 2002/05/26 12:13:47 ssb Exp $
  +// $Id: Getopt.php,v 1.18 2002/07/26 10:11:01 cox Exp $
   
   require_once 'PEAR.php';
   
  @@ -69,14 +69,17 @@
           if (PEAR::isError($args)) {
               return $args;
           }
  +        if (empty($args)) {
  +            return array(array(), array());
  +        }
           $opts     = array();
           $non_opts = array();
   
           settype($args, 'array');
   
  -        if ($long_options)
  +        if ($long_options) {
               sort($long_options);
  -
  +        }
           if ($args[0]{0} != '-') {
               array_shift($args);
           }
  @@ -207,10 +210,10 @@
           global $argv;
           if (!is_array($argv)) {
               if (!@is_array($_SERVER['argv'])) {
  -                if (!is_array($HTTP_SERVER_VARS['argv'])) {
  +                if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
                       return PEAR::raiseError("Console_Getopt: Could not read cmd args (register_argc_argv=Off?)");
                   }
  -                return $HTTP_SERVER_VARS['argv'];
  +                return $GLOBALS['HTTP_SERVER_VARS']['argv'];
               }
               return $_SERVER['argv'];
           }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +2 -2      php4/pear/File/Passwd.php
  
  Index: Passwd.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/File/Passwd.php,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Passwd.php	29 Apr 2002 02:33:41 -0000	1.2
  +++ Passwd.php	3 Aug 2002 00:44:20 -0000	1.2.2.1
  @@ -16,7 +16,7 @@
   // | Author: Rasmus Lerdorf <rasmu****@php*****>                              |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Passwd.php,v 1.10 2002/04/17 14:41:37 tuupola Exp $
  +// $Id: Passwd.php,v 1.11 2002/07/08 18:11:18 mj Exp $
   //
   // Manipulate standard UNIX passwd,.htpasswd and CVS pserver passwd files
   
  @@ -179,7 +179,7 @@
       */
       function verifyPassword($user, $pass) {
           if(isset($this->users[$user])) {
  -            if($this->users[$user] == crypt($pass, substr($this->users[$user], 0, 2))) return true;
  +            if($this->users[$user] == crypt($pass, substr($this->users[$user], 0, CRYPT_SALT_LENGTH))) return true;
           }
           return false;
       } // end func verifyPassword()
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +100 -1    php4/pear/PEAR/Attic/Builder.php
  
  Index: Builder.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Attic/Builder.php,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- Builder.php	10 Jul 2002 01:53:53 -0000	1.1.2.1
  +++ Builder.php	3 Aug 2002 00:44:20 -0000	1.1.2.2
  @@ -16,7 +16,7 @@
   // | Authors: Stig S〓ther Bakken <ssb****@fast*****>                            |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Builder.php,v 1.4 2002/06/06 10:37:13 ssb Exp $
  +// $Id: Builder.php,v 1.5 2002/07/07 20:47:57 shane Exp $
   
   require_once 'PEAR/Common.php';
   
  @@ -37,6 +37,9 @@
   
       var $current_callback = null;
   
  +    // used for msdev builds
  +    var $_lastline = null;
  +    var $_firstline = null;
       // }}}
       // {{{ constructor
   
  @@ -54,6 +57,99 @@
       }
   
       // }}}
  +    
  +    // {{{ _build_win32()
  +
  +    /**
  +     * Build an extension from source on windows.
  +     * requires msdev
  +     */
  +    function _build_win32($descfile, $callback = null)
  +    {
  +        if (PEAR::isError($info = $this->infoFromDescriptionFile($descfile))) {
  +            return $info;
  +        }
  +        $dir = dirname($descfile);
  +        $old_cwd = getcwd();
  +
  +        if (!@chdir($dir)) {
  +            return $this->raiseError("could not chdir to $dir");
  +        }
  +        $this->log(2, "building in $dir");
  +
  +        $dsp = $info['package'].'.dsp';
  +        if (!@is_file("$dir/$dsp")) {
  +            return $this->raiseError("The DSP $dsp does not exist.");
  +        }
  +        // XXX TODO: make release build type configurable
  +        $command = 'msdev '.$dsp.' /MAKE "'.$info['package']. ' - Release"';
  +        
  +        $this->current_callback = $callback;
  +        $err = $this->_runCommand($command, array(&$this, 'msdevCallback'));
  +        if (PEAR::isError($err)) {
  +            return $err;
  +        }
  +        
  +        // figure out the build platform and type
  +        $platform = 'Win32';
  +        $buildtype = 'Release';
  +        if (preg_match('/.*?'.$info['package'].'\s-\s(\w+)\s(.*?)-+/i',$this->_firstline,$matches)) {
  +            $platform = $matches[1];
  +            $buildtype = $matches[2];
  +        }
  +
  +        if (preg_match('/(.*)?\s-\s(\d+).*?(\d+)/',$this->_lastline,$matches)) {
  +            if ($matches[2]) {
  +                // there were errors in the build
  +                return $this->raiseError("There were errors during compilation.");
  +            }
  +            $out = $matches[1];
  +        } else {
  +            return $this->raiseError("Did not understand the completion status returned from msdev.exe.");
  +        }
  +        
  +        // msdev doesn't tell us the output directory :/
  +        // open the dsp, find /out and use that directory
  +        $dsptext = join(file($dsp),'');
  +        
  +        // this regex depends on the build platform and type having been
  +        // correctly identified above.
  +        $regex ='/.*?!IF\s+"\$\(CFG\)"\s+==\s+("'.
  +                    $info['package'].'\s-\s'.
  +                    $platform.'\s'.
  +                    $buildtype.'").*?'.
  +                    '\/out:"(.*?)"/is';
  +
  +        if ($dsptext && preg_match($regex,$dsptext,$matches)) {
  +            // what we get back is a relative path to the output file itself.
  +            $outfile = realpath($matches[2]);
  +        } else {
  +            return $this->raiseError("Could not retrieve output information from $dsp.");
  +        }
  +        if (@copy($outfile, "$dir/$out")) {
  +            $outfile = "$dir/$out";
  +        }
  +        
  +        $built_files[] = array(
  +            'file' => "$outfile",
  +            'php_api' => $this->php_api_version,
  +            'zend_mod_api' => $this->zend_module_api_no,
  +            'zend_ext_api' => $this->zend_extension_api_no,
  +            );
  +
  +        return $built_files;
  +    }
  +    // }}}
  +    
  +    // {{{ msdevCallback()
  +    function msdevCallback($what, $data)
  +    {
  +        if (!$this->_firstline)
  +            $this->_firstline = $data;
  +        $this->_lastline = $data;
  +    }
  +    // }}}
  +    
       // {{{ build()
   
       /**
  @@ -81,6 +177,9 @@
        */
       function build($descfile, $callback = null)
       {
  +        if (PEAR_OS == "Windows") {
  +            return $this->_build_win32($descfile,$callback);
  +        }
           if (PEAR_OS != 'Unix') {
               return $this->raiseError("building extensions not supported on this platform");
           }
  
  
  
  1.2.2.4   +2 -1      php4/pear/PEAR/Common.php
  
  Index: Common.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Common.php,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- Common.php	9 Jul 2002 09:14:43 -0000	1.2.2.3
  +++ Common.php	3 Aug 2002 00:44:20 -0000	1.2.2.4
  @@ -17,7 +17,7 @@
   // |          Tomas V.V.Cox <cox****@idecn*****>                             |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Common.php,v 1.75 2002/06/19 23:38:45 cox Exp $
  +// $Id: Common.php,v 1.76 2002/07/04 20:28:56 mj Exp $
   
   require_once 'PEAR.php';
   require_once 'Archive/Tar.php';
  @@ -1432,6 +1432,7 @@
           }
           $proxy_host = $proxy_port = null;
           if ($proxy = $config->get('http_proxy')) {
  +            $proxy = str_replace('http://', '', $proxy);
               list($proxy_host, $proxy_port) = explode(':', $proxy);
               if (empty($proxy_port)) {
                   $proxy_port = 8080;
  
  
  
  1.2.2.4   +20 -1     php4/pear/PEAR/Config.php
  
  Index: Config.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Config.php,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- Config.php	9 Jul 2002 09:14:43 -0000	1.2.2.3
  +++ Config.php	3 Aug 2002 00:44:20 -0000	1.2.2.4
  @@ -16,9 +16,10 @@
   // | Author: Stig Bakken <ssb****@fast*****>                                    |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Config.php,v 1.32 2002/06/21 06:08:54 ssb Exp $
  +// $Id: Config.php,v 1.34 2002/07/26 10:32:01 cox Exp $
   
   require_once 'PEAR.php';
  +require_once 'System.php';
   
   /**
    * Last created PEAR_Config instance.
  @@ -49,6 +50,10 @@
          PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data');
   define('PEAR_CONFIG_DEFAULT_TESTDIR',
          PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests');
  +
  +define('PEAR_CONFIG_DEFAULT_CACHEDIR',
  +         System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' . DIRECTORY_SEPARATOR . 'cache');
  +
   if (@is_dir(PHP_SYSCONFDIR)) {
       define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR);
   } else {
  @@ -172,6 +177,13 @@
               'prompt' => 'PEAR test directory',
               'group' => 'File Locations (Advanced)',
               ),
  +        'cache_dir' => array(
  +            'type' => 'directory',
  +            'default' => PEAR_CONFIG_DEFAULT_CACHEDIR,
  +            'doc' => 'directory which is used for XMLRPC cache',
  +            'prompt' => 'PEAR Installer cache directory',
  +            'group' => 'File Locations (Advanced)',
  +            ),
           // Maintainers
           'username' => array(
               'type' => 'string',
  @@ -213,6 +225,13 @@
               'default' => PEAR_DEFAULT_UMASK,
               'doc' => 'umask used when creating files (Unix-like systems only)',
               'prompt' => 'Unix file mask',
  +            'group' => 'Advanced',
  +            ),
  +        'cache_ttl' => array(
  +            'type' => 'integer',
  +            'default' => 0,
  +            'doc' => 'amount of secs where the local cache is used and not updated',
  +            'prompt' => 'Cache TimeToLive',
               'group' => 'Advanced',
               ),
   /*
  
  
  
  1.2.2.3   +32 -12    php4/pear/PEAR/Dependency.php
  
  Index: Dependency.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Dependency.php,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- Dependency.php	9 Jul 2002 09:14:43 -0000	1.2.2.2
  +++ Dependency.php	3 Aug 2002 00:44:20 -0000	1.2.2.3
  @@ -17,7 +17,7 @@
   // |          Stig Bakken <ssb****@fast*****>                                   |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Dependency.php,v 1.13 2002/06/19 23:38:46 cox Exp $
  +// $Id: Dependency.php,v 1.14 2002/07/21 07:18:49 ssb Exp $
   
   /**
   * Methods for dependencies check. Based on Stig's dependencies RFC
  @@ -48,12 +48,7 @@
       function callCheckMethod($opts)
       {
           $rel = isset($opts['rel']) ? $opts['rel'] : 'has';
  -        if (isset($opts['version'])) {
  -            $req = $opts['version'];
  -            $rel = 'v.' . $rel;
  -        } else {
  -            $req = null;
  -        }
  +        $req = isset($opts['version']) ? $opts['version'] : null;
           $name = isset($opts['name']) ? $opts['name'] : null;
           switch ($opts['type']) {
               case 'pkg':
  @@ -74,6 +69,9 @@
               case 'sapi':
                   return $this->checkSAPI($name);
                   break;
  +            case 'zend':
  +                return $this->checkZend($name);
  +                break;
               default:
                   return "'{$opts['type']}' dependency type not supported";
           }
  @@ -90,7 +88,7 @@
        */
       function checkPackage($name, $req = null, $relation = 'has')
       {
  -        if (substr($relation, 0, 2) == "v.") {
  +        if (substr($relation, 0, 2) == 'v.') {
               $relation = substr($relation, 2);
           }
           switch ($relation) {
  @@ -179,7 +177,7 @@
        *
        * @return mixed bool false if no error or the error string
        */
  -    function checkPHP($req, $relation = 'v.ge')
  +    function checkPHP($req, $relation = 'ge')
       {
           if (substr($relation, 0, 2) == 'v.') {
               $php_ver = phpversion();
  @@ -239,10 +237,32 @@
           return "'$sapi_backend' SAPI backend not supported";
       }
   
  +
       /**
  -    * Converts text comparing operators to them sign equivalents
  -    * ex: 'ge' to '>='
  -    */
  +     * Zend version check method
  +     *
  +     * @param string $req   which version to compare
  +     * @param string $relation  how to compare the version
  +     *
  +     * @return mixed bool false if no error or the error string
  +     */
  +    function checkZend($req, $relation = 'ge')
  +    {
  +        if (substr($relation, 0, 2) == 'v.') {
  +            $zend_ver = zend_version();
  +            $operator = substr($relation, 2);
  +            if (!version_compare("$zend_ver", "$req", $operator)) {
  +                return "Zend version " . $this->signOperator($operator) .
  +                       " $req is required";
  +            }
  +        }
  +        return false;
  +    }
  +
  +    /**
  +     * Converts text comparing operators to them sign equivalents
  +     * ex: 'ge' to '>='
  +     */
       function signOperator($operator)
       {
           switch($operator) {
  
  
  
  1.2.2.5   +38 -7     php4/pear/PEAR/Installer.php
  
  Index: Installer.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Installer.php,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- Installer.php	9 Jul 2002 09:14:43 -0000	1.2.2.4
  +++ Installer.php	3 Aug 2002 00:44:20 -0000	1.2.2.5
  @@ -17,11 +17,12 @@
   // |          Tomas V.V.Cox <cox****@idecn*****>                             |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Installer.php,v 1.70 2002/06/19 23:38:46 cox Exp $
  +// $Id: Installer.php,v 1.73 2002/07/28 08:52:29 ssb Exp $
   
   require_once 'PEAR/Common.php';
   require_once 'PEAR/Registry.php';
   require_once 'PEAR/Dependency.php';
  +require_once 'System.php';
   
   define('PEAR_INSTALLER_OK',       1);
   define('PEAR_INSTALLER_FAILED',   0);
  @@ -302,7 +303,8 @@
   
       function install($pkgfile, $options = array())
       {
  -        // recognized options:
  +        // recognized options:
  +        // - force         : force installation
           // - register-only : update registry but don't install files
           // - upgrade       : upgrade existing install
           // - soft          : fail silently
  @@ -314,7 +316,9 @@
               $need_download = true;
           } elseif (!@is_file($pkgfile)) {
               if ($this->validPackageName($pkgfile)) {
  -                if ($this->registry->packageExists($pkgfile) && empty($options['upgrade'])) {
  +                if ($this->registry->packageExists($pkgfile) &&
  +                    empty($options['upgrade']) && empty($options['force']))
  +                {
                       return $this->raiseError("$pkgfile already installed");
                   }
                   $pkgfile = $this->getPackageDownloadUrl($pkgfile);
  @@ -332,7 +336,7 @@
           if ($need_download) {
               $downloaddir = $this->config->get('download_dir');
               if (empty($downloaddir)) {
  -                if (PEAR::isError($downloaddir = $this->mkTempDir())) {
  +                if (PEAR::isError($downloaddir = System::mktemp('-d'))) {
                       return $downloaddir;
                   }
                   $this->log(2, '+ tmp dir created at ' . $downloaddir);
  @@ -357,7 +361,7 @@
                   chdir($oldcwd);
               }
   
  -            if (PEAR::isError($tmpdir = $this->mkTempDir())) {
  +            if (PEAR::isError($tmpdir = System::mktemp('-d'))) {
                   return $tmpdir;
               }
               $this->log(2, '+ tmp dir created at ' . $tmpdir);
  @@ -398,8 +402,13 @@
           $this->validatePackageInfo($pkginfo, $errors, $warnings);
           // XXX We allow warnings, have we to do it?
           if (count($errors)) {
  -            return $this->raiseError("The following errors where found:\n".
  -                                     implode("\n", $errors));
  +            if (empty($options['force'])) {
  +                return $this->raiseError("The following errors where found (use force option to install anyway):\n".
  +                                         implode("\n", $errors));
  +            } else {
  +                $this->log(0, "warning : the following errors were found:\n".
  +                           implode("\n", $errors));
  +            }
           }
   
           $pkgname = $pkginfo['package'];
  @@ -412,6 +421,28 @@
                       $this->log(0, $error);
                   }
                   return $this->raiseError("$pkgname: dependencies failed");
  +            }
  +        }
  +
  +        if (empty($options['force'])) {
  +            // checks to do when not in "force" mode
  +            $test = $this->registry->checkFileMap($pkginfo);
  +            if (sizeof($test)) {
  +                $tmp = $test;
  +                foreach ($tmp as $file => $pkg) {
  +                    if ($pkg == $pkgname) {
  +                        unset($test[$file]);
  +                    }
  +                }
  +                if (sizeof($test)) {
  +                    $msg = "$pkgname: conflicting files found:\n";
  +                    $longest = max(array_map("strlen", array_keys($test)));
  +                    $fmt = "%${longest}s (%s)\n";
  +                    foreach ($test as $file => $pkg) {
  +                        $msg .= sprintf($fmt, $file, $pkg);
  +                    }
  +                    return $this->raiseError($msg);
  +                }
               }
           }
   
  
  
  
  1.2.2.2   +7 -3      php4/pear/PEAR/Packager.php
  
  Index: Packager.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Packager.php,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- Packager.php	30 Apr 2002 08:13:18 -0000	1.2.2.1
  +++ Packager.php	3 Aug 2002 00:44:20 -0000	1.2.2.2
  @@ -17,9 +17,10 @@
   // |          Tomas V.V.Cox <cox****@idecn*****>                             |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Packager.php,v 1.41 2002/04/29 06:38:07 ssb Exp $
  +// $Id: Packager.php,v 1.42 2002/07/07 20:42:08 ssb Exp $
   
   require_once 'PEAR/Common.php';
  +require_once 'System.php';
   
   /**
    * Administration class used to make a PEAR release tarball.
  @@ -101,12 +102,15 @@
               chdir($oldcwd);
               return $this->raiseError($new_xml);
           }
  -        $tmpdir = $this->mkTempDir(getcwd());
  +        if (!($tmpdir = System::mktemp('-t '.getcwd().' -d'))) {
  +            return $this->raiseError("PEAR_Packager: mktemp failed");
  +        }
           $newpkgfile = $tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
           $np = @fopen($newpkgfile, "w");
           if (!$np) {
               chdir($oldcwd);
  -            return $this->raiseError("PEAR_Packager: unable to rewrite $pkgfile");
  +            system("ls -l ".dirname($newpkgfile));
  +            return $this->raiseError("PEAR_Packager: unable to rewrite $pkgfile as $newpkgfile");
           }
           fwrite($np, $new_xml);
           fclose($np);
  
  
  
  1.2.2.2   +96 -11    php4/pear/PEAR/Registry.php
  
  Index: Registry.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Registry.php,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- Registry.php	9 Jul 2002 09:14:43 -0000	1.2.2.1
  +++ Registry.php	3 Aug 2002 00:44:20 -0000	1.2.2.2
  @@ -18,7 +18,7 @@
   // |                                                                      |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Registry.php,v 1.31 2002/06/19 23:38:47 cox Exp $
  +// $Id: Registry.php,v 1.33 2002/07/09 10:51:41 ssb Exp $
   
   /*
   TODO:
  @@ -29,7 +29,9 @@
   require_once "System.php";
   require_once "PEAR.php";
   
  -define("PEAR_REGISTRY_ERROR_LOCK", -2);
  +define('PEAR_REGISTRY_ERROR_LOCK',   -2);
  +define('PEAR_REGISTRY_ERROR_FORMAT', -3);
  +define('PEAR_REGISTRY_ERROR_FILE',   -4);
   
   /**
    * Administration class used to maintain the installed package database.
  @@ -63,6 +65,20 @@
        */
       var $lock_mode = 0; // XXX UNUSED
   
  +    /** Cache of package information.  Structure:
  +     * array(
  +     *   'package' => array('id' => ... ),
  +     *   ... )
  +     * @var array
  +     */
  +    var $pkginfo_cache = array();
  +
  +    /** Cache of file map.  Structure:
  +     * array( '/path/to/file' => 'package', ... )
  +     * @var array
  +     */
  +    var $filemap_cache = array();
  +
       // }}}
   
       // {{{ constructor
  @@ -78,11 +94,12 @@
       {
           parent::PEAR();
           $ds = DIRECTORY_SEPARATOR;
  +        $this->install_dir = $pear_install_dir;
           $this->statedir = $pear_install_dir.$ds.'.registry';
           $this->filemap  = $pear_install_dir.$ds.'.filemap';
           $this->lockfile = $pear_install_dir.$ds.'.lock';
           if (!file_exists($this->filemap)) {
  -            $this->_rebuildFileMap();
  +            $this->rebuildFileMap();
           }
       }
   
  @@ -164,9 +181,9 @@
       }
   
       // }}}
  -    // {{{ _rebuildFileMap()
  +    // {{{ rebuildFileMap()
   
  -    function _rebuildFileMap()
  +    function rebuildFileMap()
       {
           $packages = $this->listPackages();
           $files = array();
  @@ -194,12 +211,33 @@
           if (!$fp) {
               return false;
           }
  +        $this->filemap_cache = $files;
           fwrite($fp, serialize($files));
           fclose($fp);
           return true;
       }
   
       // }}}
  +    // {{{ readFileMap()
  +
  +    function readFileMap()
  +    {
  +        $fp = @fopen($this->filemap, 'r');
  +        if (!$fp) {
  +            return $this->raiseError('PEAR_Registry: could not open filemap', PEAR_REGISTRY_ERROR_FILE, null, null, $php_errormsg);
  +        }
  +        $fsize = filesize($this->filemap);
  +        $data = fread($fp, $fsize);
  +        fclose($fp);
  +        $tmp = unserialize($data);
  +        if (!$tmp && $fsize > 7) {
  +            return $this->raiseError('PEAR_Registry: invalid filemap data', PEAR_REGISTRY_ERROR_FORMAT, null, null, $data);
  +        }
  +        $this->filemap_cache = $tmp;
  +        return true;
  +    }
  +
  +    // }}}
       // {{{ _lock()
   
       /**
  @@ -216,7 +254,7 @@
        */
       function _lock($mode = LOCK_EX)
       {
  -        if(!strstr(php_uname(), 'Windows 95/98')) {
  +        if (!strstr(php_uname(), 'Windows 95/98')) {
               if ($mode != LOCK_UN && is_resource($this->lock_fp)) {
                   // XXX does not check type of lock (LOCK_SH/LOCK_EX)
                   return true;
  @@ -389,7 +427,7 @@
           }
           $file = $this->_packageFileName($package);
           $ret = @unlink($file);
  -        $this->_rebuildFileMap();
  +        $this->rebuildFileMap();
           $this->_unlock();
           return $ret;
       }
  @@ -406,9 +444,6 @@
           if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
               return $e;
           }
  -        if (!file_exists($this->filemap)) {
  -            $this->_rebuildFileMap();
  -        }
           $fp = $this->_openPackageFile($package, 'w');
           if ($fp === null) {
               $this->_unlock();
  @@ -422,13 +457,61 @@
           }
           $this->_closePackageFile($fp);
           if (isset($info['filelist'])) {
  -            $this->_rebuildFileMap();
  +            $this->rebuildFileMap();
           }
           $this->_unlock();
           return true;
       }
   
       // }}}
  +    // {{{ checkFileMap()
  +
  +    /**
  +     * Test whether a file belongs to a package.
  +     *
  +     * @param string $path file path, absolute or relative to the pear
  +     * install dir
  +     *
  +     * @return string which package the file belongs to, or an empty
  +     * string if the file does not belong to an installed package
  +     *
  +     * @access public
  +     */
  +    function checkFileMap($path)
  +    {
  +        if (is_array($path)) {
  +            static $notempty;
  +            if (empty($notempty)) {
  +                $notempty = create_function('$a','return !empty($a);');
  +            }
  +            $pkgs = array();
  +            foreach ($path as $name => $attrs) {
  +                if (isset($attrs['baseinstalldir'])) {
  +                    $name = $attrs['baseinstalldir'].DIRECTORY_SEPARATOR.$name;
  +                }
  +                $pkgs[$name] = $this->checkFileMap($name);
  +            }
  +            return array_filter($pkgs, $notempty);
  +        }
  +        if (empty($this->filemap_cache) && PEAR::isError($this->readFileMap())) {
  +            return $err;
  +        }
  +        if (isset($this->filemap_cache[$path])) {
  +            return $this->filemap_cache[$path];
  +        }
  +        $l = strlen($this->install_dir);
  +        if (substr($path, 0, $l) == $this->install_dir) {
  +            $path = preg_replace('!^'.DIRECTORY_SEPARATOR.'+!', '', substr($path, $l));
  +        }
  +        if (isset($this->filemap_cache[$path])) {
  +            return $this->filemap_cache[$path];
  +        }
  +        return '';
  +    }
  +
  +    // }}}
  +
  +    // {{{ rebuildDepsFile()
   
       /**
       Experimental dependencies database handling functions (not yet in production)
  @@ -601,6 +684,8 @@
           }
           return $this->_depWriteDepDB($data);
       }
  +
  +    // }}}
   }
   
   ?>
  
  
  
  1.2.2.4   +76 -11    php4/pear/PEAR/Remote.php
  
  Index: Remote.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Remote.php,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- Remote.php	9 Jul 2002 09:14:43 -0000	1.2.2.3
  +++ Remote.php	3 Aug 2002 00:44:20 -0000	1.2.2.4
  @@ -16,7 +16,7 @@
   // | Author: Stig Bakken <ssb****@fast*****>                                    |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Remote.php,v 1.28 2002/06/17 10:58:34 ssb Exp $
  +// $Id: Remote.php,v 1.30 2002/07/09 10:52:04 ssb Exp $
   
   require_once 'PEAR.php';
   require_once 'PEAR/Config.php';
  @@ -34,6 +34,7 @@
       // {{{ properties
   
       var $config = null;
  +    var $cache  = null;
   
       // }}}
   
  @@ -46,19 +47,63 @@
       }
   
       // }}}
  -
  +    
  +    function getCache($args)
  +    {
  +        $id       = md5(serialize($args));
  +        $cachedir = $this->config->get('cache_dir');
  +        if (!file_exists($cachedir)) {
  +            System::mkdir('-p '.$cachedir);
  +        }
  +        $filename = $cachedir.'/xmlrpc_cache_'.$id;
  +        if (!file_exists($filename)) {
  +            return null;
  +        };
  +        $result   = array(
  +            'age'        => time() - filemtime($filename),
  +            'lastChange' => filemtime($filename),
  +            'content'    => unserialize(implode('', file($filename))),
  +            );
  +        return $result;
  +    }
  +    
  +    function saveCache($args, $data)
  +    {
  +        $id       = md5(serialize($args));
  +        $cachedir = $this->config->get('cache_dir');
  +        if (!file_exists($cachedir)) {
  +            System::mkdir('-p '.$cachedir);
  +        }
  +        $filename = $cachedir.'/xmlrpc_cache_'.$id;
  +        
  +        $fp = @fopen($filename, "w");
  +        if ($fp !== null) {
  +            fwrite($fp, serialize($data));
  +            fclose($fp);
  +        };
  +    }
  +    
       // {{{ call(method, [args...])
   
       function call($method)
       {
  +        $_args = $args = func_get_args();
  +        
  +        $this->cache = $this->getCache($args);
  +        $cachettl = $this->config->get('cache_ttl');
  +        // If cache is newer than $cachettl seconds, we use the cache!
  +        if ($this->cache !== null && $this->cache['age'] < $cachettl) {
  +            return $this->cache['content'];
  +        };
  +        
           if (extension_loaded("xmlrpc")) {
  -            $args = func_get_args();
  -            return call_user_func_array(array(&$this, 'call_epi'), $args);
  +            $result = call_user_func_array(array(&$this, 'call_epi'), $args);
  +            $this->saveCache($_args, $result);
  +            return $result;
           }
           if (!@include_once("XML/RPC.php")) {
               return $this->raiseError("For this remote PEAR operation you need to install the XML_RPC package");
           }
  -        $args = func_get_args();
           array_shift($args);
           $server_host = $this->config->get('master_server');
           $username = $this->config->get('username');
  @@ -66,7 +111,12 @@
           $eargs = array();
           foreach($args as $arg) $eargs[] = $this->_encode($arg);
           $f = new XML_RPC_Message($method, $eargs);
  -        $c = new XML_RPC_Client('/xmlrpc.php', $server_host, 80);
  +        if ($this->cache !== null) {
  +            $maxAge = '?maxAge='.$this->cache['lastChange'];
  +        } else {
  +            $maxAge = '';
  +        };
  +        $c = new XML_RPC_Client('/xmlrpc.php'.$maxAge, $server_host, 80);
           if ($username && $password) {
               $c->setCredentials($username, $password);
           }
  @@ -79,10 +129,15 @@
           }
           $v = $r->value();
           if ($e = $r->faultCode()) {
  +            if ($e == $GLOBALS['XML_RPC_err']['http_error'] && strstr($r->faultString(), '304 Not Modified') !== false) {
  +                return $this->cache['content'];
  +            }
               return $this->raiseError($r->faultString(), $e);
           }
   
  -        return XML_RPC_decode($v);
  +        $result = XML_RPC_decode($v);
  +        $this->saveCache($_args, $result);
  +        return $result;
       }
   
       // }}}
  @@ -139,22 +194,31 @@
               $tmp = base64_encode("$username:$password");
               $req_headers .= "Authorization: Basic $tmp\r\n";
           }
  +        if ($this->cache !== null) {
  +            $maxAge = '?maxAge='.$this->cache['lastChange'];
  +        } else {
  +            $maxAge = '';
  +        };
  +        
           if ($this->config->get('verbose') > 3) {
               print "XMLRPC REQUEST HEADERS:\n";
               var_dump($req_headers);
               print "XMLRPC REQUEST BODY:\n";
               var_dump($request);
           }
  -        fwrite($fp, ("POST /xmlrpc.php HTTP/1.0\r\n$req_headers\r\n$request"));
  +        
  +        fwrite($fp, ("POST /xmlrpc.php$maxAge HTTP/1.0\r\n$req_headers\r\n$request"));
           $response = '';
           $line1 = fgets($fp, 2048);
           if (!preg_match('!^HTTP/[0-9\.]+ (\d+) (.*)!', $line1, $matches)) {
               return $this->raiseError("PEAR_Remote: invalid HTTP response from XML-RPC server");
           }
           switch ($matches[1]) {
  -            case "200":
  +            case "200": // OK
                   break;
  -            case "401":
  +            case "304": // Not Modified
  +                return $this->cache['content'];
  +            case "401": // Unauthorized
                   if ($username && $password) {
                       return $this->raiseError("PEAR_Remote: authorization failed", 401);
                   } else {
  @@ -226,7 +290,8 @@
                       ($lastkey + 1) == count($php_val)) {
                       $is_continous = true;
                       reset($php_val);
  -                    for ($expect = 0; $expect < count($php_val); $expect++) {
  +                    $size = count($php_val);
  +                    for ($expect = 0; $expect < $size; $expect++, next($php_val)) {
                           if (key($php_val) !== $expect) {
                               $is_continous = false;
                               break;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.5   +59 -1     php4/pear/PEAR/Command/Install.php
  
  Index: Install.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Install.php,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- Install.php	9 Jul 2002 09:14:44 -0000	1.2.2.4
  +++ Install.php	3 Aug 2002 00:44:20 -0000	1.2.2.5
  @@ -16,7 +16,7 @@
   // | Author: Stig S〓ther Bakken <ssb****@fast*****>                             |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Install.php,v 1.34 2002/06/19 23:38:48 cox Exp $
  +// $Id: Install.php,v 1.35 2002/07/28 08:52:55 ssb Exp $
   
   require_once "PEAR/Command/Common.php";
   require_once "PEAR/Installer.php";
  @@ -118,6 +118,34 @@
   
   More than one package may be specified at once.
   '),
  +        'upgrade-all' => array(
  +            'summary' => 'Upgrade All Packages',
  +            'function' => 'doInstall',
  +            'shortcut' => 'ua',
  +            'options' => array(
  +                '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',
  +                    ),
  +                'nobuild' => array(
  +                    'shortopt' => 'B',
  +                    'doc' => 'don\'t build C extensions',
  +                    ),
  +                'nocompress' => array(
  +                    'shortopt' => 'Z',
  +                    'doc' => 'request uncompressed files when downloading',
  +                    ),
  +                ),
  +            'doc' => '
  +Upgrades all packages that have a newer release available.  Upgrades are
  +done only if there is a release available of the state specified in
  +"preferred_state" (currently {config preferred_state}), or a state considered
  +more stable.
  +'),
           'uninstall' => array(
               'summary' => 'Un-install Package',
               'function' => 'doUninstall',
  @@ -161,6 +189,36 @@
           }
           if ($command == 'upgrade') {
               $options[$command] = true;
  +        }
  +        if ($command == 'upgrade-all') {
  +            include_once "PEAR/Remote.php";
  +            $options['upgrade'] = true;
  +            $remote = new PEAR_Remote($this->config);
  +            $state = $this->config->get('preferred_state');
  +            if (empty($state) || $state == 'any') {
  +                $latest = $remote->call("package.listLatestReleases");
  +            } else {
  +                $latest = $remote->call("package.listLatestReleases", $state);
  +            }
  +            if (PEAR::isError($latest)) {
  +                return $latest;
  +            }
  +            $reg = new PEAR_Registry($this->config->get('php_dir'));
  +            $installed = array_flip($reg->listPackages());
  +            $params = array();
  +            foreach ($latest as $package => $info) {
  +                if (!isset($installed[$package])) {
  +                    // skip packages we don't have installed
  +                    continue;
  +                }
  +                $inst_version = $reg->packageInfo($package, 'version');
  +                if (version_compare("$info[version]", "$inst_version", "le")) {
  +                    // installed version is up-to-date
  +                    continue;
  +                }
  +                $params[] = $package;
  +                $this->ui->outputData("will upgrade $package", $command);
  +            }
           }
           foreach ($params as $pkg) {
               $bn = basename($pkg);
  
  
  
  1.2.2.4   +59 -8     php4/pear/PEAR/Command/Package.php
  
  Index: Package.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Command/Package.php,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- Package.php	9 Jul 2002 09:14:44 -0000	1.2.2.3
  +++ Package.php	3 Aug 2002 00:44:20 -0000	1.2.2.4
  @@ -17,7 +17,7 @@
   // |          Martin Jansen <mj****@php*****>                                  |
   // +----------------------------------------------------------------------+
   //
  -// $Id: Package.php,v 1.39 2002/06/07 08:43:36 cox Exp $
  +// $Id: Package.php,v 1.40 2002/07/07 21:12:40 ssb Exp $
   
   require_once 'PEAR/Common.php';
   require_once 'PEAR/Command/Common.php';
  @@ -91,14 +91,23 @@
   Run regression tests with PHP\'s regression testing script (run-tests.php).',
               ),
           'package-dependencies' => array(
  -                                        'summary' => 'Show package dependencies',
  -                                        'function' => 'doPackageDependencies',
  -                                        'shortcut' => 'pd',
  -                                        'options' => array(),
  -                                        'doc' => '
  +            'summary' => 'Show package dependencies',
  +            'function' => 'doPackageDependencies',
  +            'shortcut' => 'pd',
  +            'options' => array(),
  +            'doc' => '
   List all depencies the package has.'
  -                                        ),
  +            ),
  +        'sign' => array(
  +            'summary' => 'Sign a package distribution file',
  +            'function' => 'doSign',
  +            'shortcut' => 'si',
  +            'options' => array(),
  +            'doc' => '<package-file>
  +Signs a package distribution (.tar or .tgz) file with GnuPG.',
  +            ),
           );
  +
       var $output;
   
       /**
  @@ -278,7 +287,7 @@
   
           $obj = new PEAR_Common();
           if (PEAR::isError($info = $obj->infoFromAny($params[0]))) {
  -            return $info;
  +            return $this->raiseError($info);
           }
   
           if (is_array($info['release_deps'])) {
  @@ -324,5 +333,47 @@
           // Fallback
           $this->ui->outputData("This package does not have any dependencies.", $command);
       }
  +
  +    function doSign($command, $options, $params)
  +    {
  +        // should move most of this code into PEAR_Packager
  +        // so it'll be easy to implement "pear package --sign"
  +        if (sizeof($params) != 1) {
  +            return $this->raiseError("bad parameter(s), try \"help $command\"");
  +        }
  +        if (!file_exists($params[0])) {
  +            return $this->raiseError("file does not exist: $params[0]");
  +        }
  +        $obj = new PEAR_Common;
  +        $info = $obj->infoFromTgzFile($params[0]);
  +        if (PEAR::isError($info)) {
  +            return $this->raiseError($info);
  +        }
  +        include_once "Archive/Tar.php";
  +        include_once "System.php";
  +        $tar = new Archive_Tar($params[0]);
  +        $tmpdir = System::mktemp('-d pearsign');
  +        if (!$tar->extractList('package.xml package.sig', $tmpdir)) {
  +            return $this->raiseError("failed to extract tar file");
  +        }
  +        if (file_exists("$tmpdir/package.sig")) {
  +            return $this->raiseError("package already signed");
  +        }
  +        @unlink("$tmpdir/package.sig");
  +        $input = $this->ui->userDialog($command,
  +                                       array('GnuPG Passphrase'),
  +                                       array('password'));
  +        $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/package.xml 2>/dev/null", "w");
  +        if (!$gpg) {
  +            return $this->raiseError("gpg command failed");
  +        }
  +        fwrite($gpg, "$input[0]\r");
  +        if (pclose($gpg) || !file_exists("$tmpdir/package.sig")) {
  +            return $this->raiseError("gpg sign failed");
  +        }
  +        $tar->addModify("$tmpdir/package.sig", '', $tmpdir);
  +        return true;
  +    }
   }
  +
   ?>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +2 -2      php4/pear/PEAR/Frontend/CLI.php
  
  Index: CLI.php
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/PEAR/Frontend/CLI.php,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- CLI.php	9 Jul 2002 09:14:44 -0000	1.2.2.1
  +++ CLI.php	3 Aug 2002 00:44:20 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
     | Author: Stig S〓ther Bakken <ssb****@fast*****>                             |
     +----------------------------------------------------------------------+
   
  -  $Id: CLI.php,v 1.23 2002/07/02 13:04:01 dickmann Exp $
  +  $Id: CLI.php,v 1.24 2002/07/07 20:41:20 ssb Exp $
   */
   
   require_once "PEAR.php";
  @@ -130,7 +130,7 @@
               $fp = fopen("php://stdin", "r");
               foreach ($prompts as $key => $prompt) {
                   $type = $types[$key];
  -                $default = $defaults[$key];
  +                $default = @$defaults[$key];
                   if ($type == 'password') {
                       system('stty -echo');
                   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +12 -21    php4/pear/scripts/pear.bat
  
  Index: pear.bat
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/scripts/pear.bat,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- pear.bat	9 Jul 2002 09:14:44 -0000	1.2.2.1
  +++ pear.bat	3 Aug 2002 00:44:20 -0000	1.2.2.2
  @@ -1,37 +1,28 @@
   @ECHO OFF
   
   REM ----------------------------------------------------------------------
  -REM PHP version 4.0                                                     
  +REM PHP version 4.0
   REM ----------------------------------------------------------------------
  -REM Copyright (c) 1997-2002 The PHP Group                               
  +REM Copyright (c) 1997-2002 The PHP Group
   REM ----------------------------------------------------------------------
  -REM  This source file is subject to version 2.02 of the PHP license,    
  -REM  that is bundled with this package in the file LICENSE, and is      
  -REM  available at through the world-wide-web at                         
  -REM  http://www.php.net/license/2_02.txt.                               
  -REM  If you did not receive a copy of the PHP license and are unable to 
  -REM  obtain it through the world-wide-web, please send a note to        
  -REM  licen****@php***** so we can mail you a copy immediately.             
  +REM  This source file is subject to version 2.02 of the PHP license,
  +REM  that is bundled with this package in the file LICENSE, and is
  +REM  available at through the world-wide-web at
  +REM  http://www.php.net/license/2_02.txt.
  +REM  If you did not receive a copy of the PHP license and are unable to
  +REM  obtain it through the world-wide-web, please send a note to
  +REM  licen****@php***** so we can mail you a copy immediately.
   REM ----------------------------------------------------------------------
  -REM  Authors:     Alexander Merz (alexm****@php*****)                         
  +REM  Authors:     Alexander Merz (alexm****@php*****)
   REM ----------------------------------------------------------------------
   REM
  -REM  $Id: pear.bat,v 1.8 2002/06/12 16:31:53 cox Exp $
  +REM  $Id: pear.bat,v 1.10 2002/07/26 11:58:10 cox Exp $
   
   REM change this lines to match the paths of your system
   REM -------------------
   
  -REM *** Unused stuff ****
  -REM set PHP_PATH=c:\php
  -REM set PEAR_INSTALL_DIR=c:\php\pear
  -REM set PEAR_EXTENSION_DIR=c:\php\extensions
  -REM set PEAR_DOC_DIR=c:\php\pear\docs
  -REM -------------------
  -REM set DIRECTORY_SEPARATOR=\
  -REM %PHP_PATH%\php.exe -q %PEAR_INSTALL_DIR%\scripts\pear.in %1 %2 %3 %4 %5 %6 %7 %8 %9
  -
   set PHP_BIN=c:\php\php.exe
   set PEAR_PATH=c:\php\pear
   
  -%PHP_BIN% -C -d include_path=%PEAR_PATH% -f %PEAR_PATH%\scripts\pear.in %1 %2 %3 %4 %5 %6 %7 %8 %9
  +%PHP_BIN% -C -d output_buffer=0 -d include_path=%PEAR_PATH% -f %PEAR_PATH%\scripts\pear.in -- %1 %2 %3 %4 %5 %6 %7 %8 %9
   @ECHO ON
  
  
  
  1.2.2.5   +6 -3      php4/pear/scripts/pear.in
  
  Index: pear.in
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/pear/scripts/pear.in,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- pear.in	9 Jul 2002 09:14:44 -0000	1.2.2.4
  +++ pear.in	3 Aug 2002 00:44:20 -0000	1.2.2.5
  @@ -19,12 +19,14 @@
   // |                                                                      |
   // +----------------------------------------------------------------------+
   //
  -// $Id: pear.in,v 1.61 2002/06/25 13:45:29 cox Exp $
  +// $Id: pear.in,v 1.64 2002/07/28 17:06:28 tal Exp $
   
   /**
    * @nodep Gtk
    */
  -ini_set('include_path', '@include_path@');
  +if ('@include_path@' != '@'.'include_path'.'@') {
  +    ini_set('include_path', '@include_path@');
  +}
   ini_set('allow_url_fopen', true);
   set_time_limit(0);
   ob_implicit_flush(true);
  @@ -203,6 +205,7 @@
               "Commands:\n";
           $maxlen = max(array_map("strlen", $all_commands));
           $formatstr = "%-{$maxlen}s  %s\n";
  +        ksort($all_commands);
           foreach ($all_commands as $cmd => $class) {
               $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd));
           }
  @@ -239,7 +242,7 @@
           return $ret;
   
       } elseif ($command == "version") {
  -        return "PEAR $GLOBALS[pear_package_version]";
  +        return "PEAR Version: ".$GLOBALS['pear_package_version']."\nPHP Version: ".phpversion()."\nZend Engine Version: ".zend_version();
   
       } elseif ($help = PEAR_Command::getHelp($command)) {
           if (is_string($help)) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +107 -34   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.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- pear_registry.phpt	19 May 2002 11:16:07 -0000	1.2.2.1
  +++ pear_registry.phpt	3 Aug 2002 00:44:20 -0000	1.2.2.2
  @@ -8,24 +8,72 @@
   PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n");
   cleanall();
   
  +$files1 = array(
  +    "pkg1-1.php" => array(
  +        "role" => "php",
  +        ),
  +    "pkg1-2.php" => array(
  +        "role" => "php",
  +        "baseinstalldir" => "pkg1",
  +        ),
  +    );
  +$files2 = array(
  +    "pkg2-1.php" => array(
  +        "role" => "php",
  +        ),
  +    "pkg2-2.php" => array(
  +        "role" => "php",
  +        "baseinstalldir" => "pkg2",
  +        ),
  +    );
  +$files3 = array(
  +    "pkg3-1.php" => array(
  +        "role" => "php",
  +        ),
  +    "pkg3-2.php" => array(
  +        "role" => "php",
  +        "baseinstalldir" => "pkg3",
  +        ),
  +    );
  +$files3_new = array(
  +    "pkg3-3.php" => array(
  +        "role" => "php",
  +        "baseinstalldir" => "pkg3",
  +        ),
  +    "pkg3-4.php" => array(
  +        "role" => "php",
  +        ),
  +    );
  +
   print "creating registry object\n";
   $reg = new PEAR_Registry;
   $reg->statedir = getcwd();
   dumpall($reg);
  -$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0"));
  +
  +$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0", "filelist" => $files1));
   dumpall($reg);
  -$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0"));
  -$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0"));
  +
  +$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0", "filelist" => $files2));
  +$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0", "filelist" => $files3));
   dumpall($reg);
  +
   $reg->updatePackage("pkg2", array("version" => "2.1"));
   dumpall($reg);
  +
   var_dump($reg->deletePackage("pkg2"));
   dumpall($reg);
  +
   var_dump($reg->deletePackage("pkg2"));
   dumpall($reg);
  +
   $reg->updatePackage("pkg3", array("version" => "3.1b1", "status" => "beta"));
   dumpall($reg);
   
  +print_r($reg->checkFilemap(array_merge($files3, $files2)));
  +
  +$reg->updatePackage("pkg3", array("filelist" => $files3_new));
  +dumpall($reg);
  +
   print "tests done\n";
   
   cleanall();
  @@ -34,28 +82,44 @@
   
   function cleanall()
   {
  -	$dp = opendir(".");
  -	while ($ent = readdir($dp)) {
  -		if (substr($ent, -4) == ".reg") {
  -			unlink($ent);
  -		}
  -	}
  +    $dp = opendir(".");
  +    while ($ent = readdir($dp)) {
  +        if (substr($ent, -4) == ".reg") {
  +            unlink($ent);
  +        }
  +    }
   }
   
   function dumpall(&$reg)
   {
  -	print "dumping registry...\n";
  -	$info = $reg->packageInfo();
  -	foreach ($info as $pkg) {
  -		print $pkg["name"] . ":";
  -		unset($pkg["name"]);
  -		foreach ($pkg as $k => $v) {
  -			if ($k == '_lastmodified') continue;
  -			print " $k=\"$v\"";
  -		}
  -		print "\n";
  -	}
  -	print "dump done\n";
  +    print "dumping registry...\n";
  +    $info = $reg->packageInfo();
  +    foreach ($info as $pkg) {
  +        print $pkg["name"] . ":";
  +        unset($pkg["name"]);
  +        foreach ($pkg as $k => $v) {
  +            if ($k == '_lastmodified') continue;
  +            if (is_array($v) && $k == 'filelist') {
  +                print " $k=array(";
  +                $i = 0;
  +                foreach ($v as $k2 => $v2) {
  +                    if ($i++ > 0) print ",";
  +                    print "{$k2}[";
  +                    $j = 0;
  +                    foreach ($v2 as $k3 => $v3) {
  +                        if ($j++ > 0) print ",";
  +                        print "$k3=$v3";
  +                    }
  +                    print "]";
  +                }
  +                print ")";
  +            } else {
  +                print " $k=\"$v\"";
  +            }
  +        }
  +        print "\n";
  +    }
  +    print "dump done\n";
   }
   
   ?>
  @@ -64,30 +128,39 @@
   dumping registry...
   dump done
   dumping registry...
  -pkg1: version="1.0"
  +pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
   dump done
   dumping registry...
  -pkg1: version="1.0"
  -pkg2: version="2.0"
  -pkg3: version="3.0"
  +pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
  +pkg2: version="2.0" filelist=array(pkg2-1.php[role=php],pkg2-2.php[role=php,baseinstalldir=pkg2])
  +pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3])
   dump done
   dumping registry...
  -pkg1: version="1.0"
  -pkg2: version="2.1"
  -pkg3: version="3.0"
  +pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
  +pkg2: version="2.1" filelist=array(pkg2-1.php[role=php],pkg2-2.php[role=php,baseinstalldir=pkg2])
  +pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3])
   dump done
   bool(true)
   dumping registry...
  -pkg1: version="1.0"
  -pkg3: version="3.0"
  +pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
  +pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3])
   dump done
   bool(false)
   dumping registry...
  -pkg1: version="1.0"
  -pkg3: version="3.0"
  +pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
  +pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3])
  +dump done
  +dumping registry...
  +pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
  +pkg3: version="3.1b1" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) status="beta"
   dump done
  +Array
  +(
  +    [pkg3-1.php] => pkg3
  +    [pkg3/pkg3-2.php] => pkg3
  +)
   dumping registry...
  -pkg1: version="1.0"
  -pkg3: version="3.1b1" status="beta"
  +pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1])
  +pkg3: version="3.1b1" filelist=array(pkg3-3.php[role=php,baseinstalldir=pkg3],pkg3-4.php[role=php]) status="beta"
   dump done
   tests done
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +2 -3      php4/sapi/apache/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/apache/config.m4,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- config.m4	9 Jul 2002 09:14:44 -0000	1.2.2.2
  +++ config.m4	3 Aug 2002 00:44:20 -0000	1.2.2.3
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.58 2002/06/29 00:12:46 rasmus Exp $
  +dnl $Id: config.m4,v 1.62 2002/07/25 18:37:16 sniper Exp $
   dnl
   
   AC_MSG_CHECKING(for Apache 1.x module support via DSO through APXS)
  @@ -36,8 +36,7 @@
     APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
   
     # Test that we're trying to configure with apache 1.x
  -dnl  APACHE_VERSION=`$APXS_HTTPD -v | head -1 | cut -f3 -d' ' | cut -f2 -d'/' | cut -f1 -d'-' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
  -  APACHE_VERSION=`$APXS_HTTPD -v | head -1 | awk 'BEGIN { RS=" "; } /Apache/ { print $0; }' | cut -f2 -d'/' | cut -f1 -d'-' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
  +  PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
     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
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.4   +11 -3     php4/sapi/apache2filter/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/apache2filter/config.m4,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- config.m4	9 Jul 2002 09:14:44 -0000	1.2.2.3
  +++ config.m4	3 Aug 2002 00:44:20 -0000	1.2.2.4
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.21 2002/06/29 00:33:02 sniper Exp $
  +dnl $Id: config.m4,v 1.24 2002/07/11 14:41:03 sas Exp $
   dnl
   
   AC_MSG_CHECKING(for Apache 2.0 module support via DSO through APXS)
  @@ -43,14 +43,22 @@
     done
   
     # Test that we're trying to configure with apache 2.x
  -  APACHE_VERSION=`$APXS_HTTPD -v | head -1 | awk 'BEGIN { RS=" "; } /Apache/ { print $0; }' | cut -f2 -d'/' | cut -f1 -d'-' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
  +  PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
     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 2000040; then
       AC_MSG_ERROR([Please note that Apache version >= 2.0.40 is required.])
     fi
   
  -  INSTALL_IT="\$(mkinstalldirs) \"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" && $APXS -S LIBEXECDIR=\"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" -i `[ -d \`$APXS -q SYSCONFDIR\` ] || echo -a` -n php4"
  +  APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
  +  if test -z `$APXS -q SYSCONFDIR`; then
  +    optarg=-a
  +  else
  +    optarg=
  +  fi
  +
  +  INSTALL_IT='$(mkinstalldirs) '"$APXS_LIBEXECDIR && \
  +$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' -i ${optarg}-n php4"
   
     case $host_alias in
     *aix*)
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.5   +28 -5     php4/sapi/cgi/cgi_main.c
  
  Index: cgi_main.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/cgi/cgi_main.c,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- cgi_main.c	9 Jul 2002 09:14:44 -0000	1.2.2.4
  +++ cgi_main.c	3 Aug 2002 00:44:20 -0000	1.2.2.5
  @@ -201,12 +201,35 @@
   }
   
   
  -static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
  +static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
   {
  -	if (sapi_header) {
  -		PHPWRITE_H(sapi_header->header, sapi_header->header_len);
  +	char buf[1024];
  +	int len;
  +	sapi_header_struct *h;
  +	zend_llist_position pos;
  +	
  +	len = sprintf(buf, "Status: %d\r\n", SG(sapi_headers).http_response_code);
  +	PHPWRITE_H(buf, len);
  +
  +	if (SG(sapi_headers).send_default_content_type) {
  +		char *hd;
  +
  +		hd = sapi_get_default_content_type(TSRMLS_C);
  +		PHPWRITE("Content-type: ", sizeof("Content-type: ")-1);
  +		PHPWRITE(hd, strlen(hd));
  +		PHPWRITE("\r\n", 2);
  +		efree(hd);
  +	}
  +	
  +	h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
  +    while (h) {
  +		PHPWRITE_H(h->header, h->header_len);
  +		PHPWRITE_H("\r\n", 2);
  +		h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
   	}
   	PHPWRITE_H("\r\n", 2);
  +
  +	return SAPI_HEADER_SENT_SUCCESSFULLY;
   }
   
   
  @@ -297,8 +320,8 @@
   	php_error,						/* error handler */
   
   	NULL,							/* header handler */
  -	NULL,							/* send headers handler */
  -	sapi_cgi_send_header,			/* send header handler */
  +	sapi_cgi_send_headers,			/* send headers handler */
  +	NULL,							/* send header handler */
   
   	sapi_cgi_read_post,				/* read POST data */
   	sapi_cgi_read_cookies,			/* read Cookies */
  
  
  
  1.2.2.1   +11 -1     php4/sapi/cgi/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/cgi/config.m4,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- config.m4	29 Apr 2002 02:33:44 -0000	1.2
  +++ config.m4	3 Aug 2002 00:44:20 -0000	1.2.2.1
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.13 2002/03/07 14:19:51 sas Exp $
  +dnl $Id: config.m4,v 1.15 2002/07/21 14:42:01 markonen Exp $
   dnl
   
   AC_DEFUN(PHP_TEST_WRITE_STDOUT,[
  @@ -97,3 +97,13 @@
   dnl## AC_SUBST(FHTTPD_INCLUDE)
   PHP_SUBST(FHTTPD_LIB)
   PHP_SUBST(FHTTPD_TARGET)
  +
  +case $host_alias in
  +  *darwin*)
  +    BUILD_CGI="\$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o php"
  +    ;;
  +  *)
  +    BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o php"
  +    ;;
  +esac
  +PHP_SUBST(BUILD_CGI)
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +2 -2      php4/sapi/cli/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/cli/config.m4,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- config.m4	9 Jul 2002 09:14:45 -0000	1.2.2.1
  +++ config.m4	3 Aug 2002 00:44:20 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   dnl
  -dnl $Id: config.m4,v 1.7 2002/07/01 21:17:39 markonen Exp $
  +dnl $Id: config.m4,v 1.8 2002/07/21 14:42:01 markonen Exp $
   dnl
   
   AC_MSG_CHECKING(for CLI build)
  @@ -16,7 +16,7 @@
   if test "$PHP_SAPI_CLI" != "no"; then
     case $host_alias in
     *darwin*)
  -    BUILD_CLI="\$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o sapi/cli/php"
  +    BUILD_CLI="\$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o sapi/cli/php"
       ;;
     *)
       BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o sapi/cli/php"
  
  
  
  1.2.2.4   +1 -0      php4/sapi/cli/php_cli.c
  
  Index: php_cli.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/cli/php_cli.c,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- php_cli.c	9 Jul 2002 09:14:45 -0000	1.2.2.3
  +++ php_cli.c	3 Aug 2002 00:44:21 -0000	1.2.2.4
  @@ -616,6 +616,7 @@
   		arg_excp = argv+ap_php_optind-1;
   		arg_free = argv[ap_php_optind-1];
   		if (script_file) {
  +			SG(request_info).path_translated = script_file;
   			argv[ap_php_optind-1] = script_file;
   		} else {
   			argv[ap_php_optind-1] = "-"; /* should be stdin */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +10 -9     php4/sapi/pi3web/pi3web_sapi.c
  
  Index: pi3web_sapi.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/pi3web/pi3web_sapi.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- pi3web_sapi.c	9 Jul 2002 09:14:45 -0000	1.2.2.1
  +++ pi3web_sapi.c	3 Aug 2002 00:44:21 -0000	1.2.2.2
  @@ -21,7 +21,7 @@
      +----------------------------------------------------------------------+
    */
   
  -/* $Id: pi3web_sapi.c,v 1.41 2002/06/21 09:31:21 derick Exp $ */
  +/* $Id: pi3web_sapi.c,v 1.43 2002/07/23 17:12:54 holger Exp $ */
   
   #include "pi3web_sapi.h"
   #include "php.h"
  @@ -77,7 +77,7 @@
   	PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n");
   	PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">Pi3Web Server Information</th></tr>\n");
   	php_info_print_table_header(2, "Information Field", "Value");
  -	php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c,v 1.41 2002/06/21 09:31:21 derick Exp $");
  +	php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c,v 1.43 2002/07/23 17:12:54 holger Exp $");
   	php_info_print_table_row(2, "Server Name Stamp", HTTPCore_getServerStamp());
   	snprintf(variable_buf, 511, "%d", HTTPCore_debugEnabled());
   	php_info_print_table_row(2, "Debug Enabled", variable_buf);
  @@ -278,9 +278,6 @@
   
   static void init_request_info(LPCONTROL_BLOCK lpCB TSRMLS_DC)
   {
  -	char *path_end = strrchr(lpCB->lpszFileName, PHP_DIR_SEPARATOR);
  -	if ( path_end ) *path_end = PHP_DIR_SEPARATOR;
  -
   	SG(server_context) = lpCB;
   	SG(request_info).request_method  = lpCB->lpszMethod;
   	SG(request_info).query_string    = lpCB->lpszQueryString;
  @@ -422,9 +419,14 @@
   					};
   				};
   				break;
  -			case PHP_MODE_INDENT:
  -				header_line = (char *)estrdup("Content-Type: text/plain");
  -				sapi_add_header_ex(header_line, strlen(header_line), 1, 1, 0 TSRMLS_CC);
  +			case PHP_MODE_INDENT: {
  +				sapi_header_line ctr = {0};
  +
  +				ctr.line = "Content-Type: text/plain";
  +				ctr.line_len = strlen(ctr.line);
  +				
  +				sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
  +			  }
   				if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS )
   					{
   					zend_indent();
  @@ -433,7 +435,6 @@
   					{
   					iRet = PIAPI_ERROR;
   					};
  -				efree(header_line);
   				break;
   			case PHP_MODE_LINT:
   				iRet = (php_lint_script(&file_handle TSRMLS_CC) == SUCCESS) ?
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +4 -1      php4/sapi/thttpd/README
  
  Index: README
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/thttpd/README,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- README	29 Apr 2002 02:33:46 -0000	1.2
  +++ README	3 Aug 2002 00:44:21 -0000	1.2.2.1
  @@ -1,5 +1,5 @@
   README FOR THTTPD MODULE (by Sascha Schumann)        
  -($Date: 2002/03/11 12:28:16 $)
  +($Date: 2002/07/16 16:24:13 $)
   
   	This is a SAPI module for PHP 4.0 supporting thttpd, the tiny,
   	turbo, throttling HTTP server by Jef Poskanzer.
  @@ -7,6 +7,9 @@
   	The module contains a patch against version 2.21b of thttpd. The patch
   	adds hooks to thttpd to call PHP, if a filename matches *.php. This
   	patch will be applied when you install PHP.
  +
  +	NOTE: This version supports *only* thttpd 2.21b, no prior or later
  +	version.
   
   	This is a functional and stable module (it runs a large application
   	like IMP 2.2.0 without any problems). Its original intention was to
  
  
  
  1.2.2.2   +104 -22   php4/sapi/thttpd/thttpd.c
  
  Index: thttpd.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/thttpd/thttpd.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- thttpd.c	19 May 2002 11:16:08 -0000	1.2.2.1
  +++ thttpd.c	3 Aug 2002 00:44:21 -0000	1.2.2.2
  @@ -16,7 +16,7 @@
      +----------------------------------------------------------------------+
   */
   
  -/* $Id: thttpd.c,v 1.64 2002/05/17 21:22:30 sas Exp $ */
  +/* $Id: thttpd.c,v 1.67 2002/07/14 18:01:07 sas Exp $ */
   
   #include "php.h"
   #include "SAPI.h"
  @@ -39,6 +39,10 @@
   	int read_post_data;	
   	void (*on_close)(int);
   	long async_send;
  +
  +	smart_str sbuf;
  +	int seen_cl;
  +	int seen_cn;
   } php_thttpd_globals;
   
   
  @@ -57,26 +61,24 @@
   static int sapi_thttpd_ub_write(const char *str, uint str_length TSRMLS_DC)
   {
   	int n;
  -	uint sent = 0;	
  +	uint sent = 0;
  +	
  +	if (TG(sbuf).c != 0) {
  +		smart_str_appendl_ex(&TG(sbuf), str, str_length, 1);
  +		return str_length;
  +	}
   	
   	while (str_length > 0) {
   		n = send(TG(hc)->conn_fd, str, str_length, 0);
   
  -		if (n == -1 && errno == EPIPE)
  -			php_handle_aborted_connection();
  -		if (n == -1 && errno == EAGAIN) {
  -			fd_set fdw;
  -
  -			FD_ZERO(&fdw);
  -			FD_SET(TG(hc)->conn_fd, &fdw);
  -			n = select(TG(hc)->conn_fd + 1, NULL, &fdw, NULL, NULL);
  -			if (n <= 0)
  -				php_handle_aborted_connection();
  +		if (n == -1) {
  +			if (errno == EAGAIN) {
  +				smart_str_appendl_ex(&TG(sbuf), str, str_length, 1);
   
  -			continue;
  +				return sent + str_length;
  +			} else
  +				php_handle_aborted_connection();
   		}
  -		if (n <= 0) 
  -			return n;
   
   		TG(hc)->bytes_sent += n;
   		str += n;
  @@ -90,8 +92,10 @@
   #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)
  +static int do_writev(struct iovec *vec, int nvec, int len TSRMLS_DC)
   {
  +	int n;
  +
   	/*
   	 * XXX: partial writevs are not handled
   	 * This can only cause problems, if the user tries to send
  @@ -99,12 +103,54 @@
   	 * 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;
  +	
  +	if (TG(sbuf).c == 0) {
  +		n = writev(TG(hc)->conn_fd, vec, nvec);
  +
  +		if (n == -1) {
  +			if (errno == EAGAIN) {
  +				n = 0;
  +			} else {
  +				php_handle_aborted_connection();
  +			}
  +		}
  +
  +
  +		TG(hc)->bytes_sent += n;
  +	} else
  +		n = 0;
  +
  +	if (n < len) {
  +		int i;
  +
  +		/* merge all unwritten data into sbuf */
  +		for (i = 0; i < nvec; vec++, i++) {
  +			/* has this vector been written completely? */
  +			if (n >= vec->iov_len) {
  +				/* yes, proceed */
  +				n -= vec->iov_len;
  +				continue;
  +			}
  +
  +			if (n > 0) {
  +				/* adjust vector */
  +				vec->iov_base = (char *) vec->iov_base + n;
  +				vec->iov_len -= n;
  +				n = 0;
  +			}
  +
  +			smart_str_appendl_ex(&TG(sbuf), vec->iov_base, vec->iov_len, 1);
  +		}
  +	}
   	
   	return 0;
  -}	
  +}
  +
  +#define CL_TOKEN "Content-length: "
  +#define CN_TOKEN "Connection: "
  +#define KA_DO "Connection: keep-alive\r\n"
  +#define KA_NO "Connection: close\r\n"
  +#define DEF_CT "Content-Type: text/html\r\n"
   
   static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
   {
  @@ -116,7 +162,7 @@
   	size_t len = 0;
   	
   	if (!SG(sapi_headers).http_status_line) {
  -		sprintf(buf, "HTTP/1.0 %d Code\r\n",  /* SAFE */
  +		sprintf(buf, "HTTP/1.1 %d Code\r\n",  /* SAFE */
   				SG(sapi_headers).http_response_code);
   		ADD_VEC(buf, strlen(buf));
   	} else {
  @@ -126,13 +172,22 @@
   	}
   	TG(hc)->status = SG(sapi_headers).http_response_code;
   
  -#define DEF_CT "Content-Type: text/html\r\n"
   	if (SG(sapi_headers).send_default_content_type) {
   		ADD_VEC(DEF_CT, strlen(DEF_CT));
   	}
   
   	h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
   	while (h) {
  +		
  +		switch (h->header[0]) {
  +			case 'c': case 'C':
  +				if (!TG(seen_cl) && strncasecmp(h->header, CL_TOKEN, sizeof(CL_TOKEN)-1) == 0) {
  +					TG(seen_cl) = 1;
  +				} else if (!TG(seen_cn) && strncasecmp(h->header, CN_TOKEN, sizeof(CN_TOKEN)-1) == 0) {
  +					TG(seen_cn) = 1;
  +				}
  +		}
  +
   		ADD_VEC(h->header, h->header_len);
   		if (n >= COMBINE_HEADERS - 1) {
   			len = do_writev(vec, n, len TSRMLS_CC);
  @@ -142,6 +197,12 @@
   		
   		h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
   	}
  +
  +	if (TG(seen_cl) && !TG(seen_cn) && TG(hc)->do_keep_alive) {
  +		ADD_VEC(KA_DO, sizeof(KA_DO)-1);
  +	} else {
  +		ADD_VEC(KA_NO, sizeof(KA_NO)-1);
  +	}
   		
   	ADD_VEC("\r\n", 2);
   			
  @@ -354,6 +415,9 @@
   {
   	smart_str s = {0};
   
  +	TG(seen_cl) = 0;
  +	TG(seen_cn) = 0;
  +	TG(sbuf).c = 0;
   	SG(request_info).query_string = TG(hc)->query?strdup(TG(hc)->query):NULL;
   
   	smart_str_appends_ex(&s, TG(hc)->hs->cwd, 1);
  @@ -376,6 +440,7 @@
   
   static void thttpd_request_dtor(TSRMLS_D)
   {
  +	smart_str_free_ex(&TG(sbuf), 1);
   	if (SG(request_info).query_string)
   		free(SG(request_info).query_string);
   	free(SG(request_info).request_uri);
  @@ -571,6 +636,23 @@
   	thttpd_request_ctor(TSRMLS_C);
   
   	thttpd_module_main(TSRMLS_C);
  +
  +	/* disable kl, if no content-length was seen or Connection: was set */
  +	if (TG(seen_cl) == 0 || TG(seen_cn) == 1) {
  +		TG(hc)->do_keep_alive = TG(hc)->keep_alive = 0;
  +	}
  +	
  +	if (TG(sbuf).c != 0) {
  +		if (TG(hc)->response)
  +			free(TG(hc)->response);
  +		
  +		TG(hc)->response = TG(sbuf).c;
  +		TG(hc)->responselen = TG(sbuf).len;
  +
  +		TG(sbuf).c = 0;
  +		TG(sbuf).len = 0;
  +		TG(sbuf).a = 0;
  +	}
   
   	thttpd_request_dtor(TSRMLS_C);
   
  
  
  
  1.2.2.1   +1061 -64  php4/sapi/thttpd/thttpd_patch
  
  Index: thttpd_patch
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/thttpd/thttpd_patch,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- thttpd_patch	29 Apr 2002 02:33:47 -0000	1.2
  +++ thttpd_patch	3 Aug 2002 00:44:21 -0000	1.2.2.1
  @@ -1,6 +1,6 @@
  -diff -ur thttpd-2.21b-orig/Makefile.in thttpd-2.21b/Makefile.in
  ---- thttpd-2.21b-orig/Makefile.in	Thu Mar 29 20:36:21 2001
  -+++ thttpd-2.21b/Makefile.in	Mon Aug 13 23:50:27 2001
  +diff -Nur thttpd-2.21b/Makefile.in thttpd-2.21b-cool/Makefile.in
  +--- thttpd-2.21b/Makefile.in	Thu Mar 29 20:36:21 2001
  ++++ thttpd-2.21b-cool/Makefile.in	Fri Jul 26 18:12:50 2002
   @@ -46,13 +46,15 @@
    
    # You shouldn't need to edit anything below here.
  @@ -38,10 +38,22 @@
    
    tar:
    	@name=`sed -n -e '/SERVER_SOFTWARE/!d' -e 's,.*thttpd/,thttpd-,' -e 's, .*,,p' version.h` ; \
  -diff -ur thttpd-2.21b-orig/config.h thttpd-2.21b/config.h
  ---- thttpd-2.21b-orig/config.h	Mon Apr  9 23:57:36 2001
  -+++ thttpd-2.21b/config.h	Mon Aug 13 23:51:00 2001
  -@@ -316,7 +316,7 @@
  +diff -Nur thttpd-2.21b/config.h thttpd-2.21b-cool/config.h
  +--- thttpd-2.21b/config.h	Mon Apr  9 23:57:36 2001
  ++++ thttpd-2.21b-cool/config.h	Fri Jul 26 18:12:50 2002
  +@@ -82,6 +82,11 @@
  + */
  + #define IDLE_READ_TIMELIMIT 60
  + 
  ++/* CONFIGURE: How many seconds to allow for reading the subsequent requests
  ++** on a keep-alive connection.  Should be simiar to LINGER_TIME
  ++*/
  ++#define IDLE_KEEPALIVE_TIMELIMIT 2
  ++
  + /* CONFIGURE: How many seconds before an idle connection gets closed.
  + */
  + #define IDLE_SEND_TIMELIMIT 300
  +@@ -316,7 +321,7 @@
    /* CONFIGURE: A list of index filenames to check.  The files are searched
    ** for in this order.
    */
  @@ -50,9 +62,9 @@
    
    /* CONFIGURE: If this is defined then thttpd will automatically generate
    ** index pages for directories that don't have an explicit index file.
  -diff -ur thttpd-2.21b-orig/fdwatch.c thttpd-2.21b/fdwatch.c
  ---- thttpd-2.21b-orig/fdwatch.c	Fri Apr 13 07:36:08 2001
  -+++ thttpd-2.21b/fdwatch.c	Tue Aug 14 00:00:10 2001
  +diff -Nur thttpd-2.21b/fdwatch.c thttpd-2.21b-cool/fdwatch.c
  +--- thttpd-2.21b/fdwatch.c	Fri Apr 13 07:36:08 2001
  ++++ thttpd-2.21b-cool/fdwatch.c	Fri Jul 26 18:12:50 2002
   @@ -460,7 +460,7 @@
    
        ridx = 0;
  @@ -73,9 +85,9 @@
    	default: return 0;
    	}
        }
  -diff -ur thttpd-2.21b-orig/libhttpd.c thttpd-2.21b/libhttpd.c
  ---- thttpd-2.21b-orig/libhttpd.c	Tue Apr 24 00:42:40 2001
  -+++ thttpd-2.21b/libhttpd.c	Tue Aug 14 00:00:07 2001
  +diff -Nur thttpd-2.21b/libhttpd.c thttpd-2.21b-cool/libhttpd.c
  +--- thttpd-2.21b/libhttpd.c	Tue Apr 24 00:42:40 2001
  ++++ thttpd-2.21b-cool/libhttpd.c	Fri Jul 26 18:12:50 2002
   @@ -85,6 +85,8 @@
    #include "match.h"
    #include "tdate_parse.h"
  @@ -119,19 +131,258 @@
        /* Done initializing. */
        if ( hs->binding_hostname == (char*) 0 )
    	syslog( LOG_INFO, "%.80s starting on port %d", SERVER_SOFTWARE, hs->port );
  -@@ -2353,7 +2361,10 @@
  +@@ -582,6 +590,9 @@
  +     /* And send it, if necessary. */
  +     if ( hc->responselen > 0 )
  + 	{
  ++/*
  ++printf("**RESPONSE [%d]** len = %d\n%*.*s\n", hc->conn_fd, hc->responselen, hc->responselen, hc->responselen, hc->response); 
  ++*/
  + 	(void) write( hc->conn_fd, hc->response, hc->responselen );
  + 	hc->responselen = 0;
  + 	}
  +@@ -657,9 +668,9 @@
  + 	(void) my_snprintf(
  + 	    fixed_type, sizeof(fixed_type), type, hc->hs->charset );
  + 	(void) my_snprintf( buf, sizeof(buf),
  +-	    "%.20s %d %s\r\nServer: %s\r\nContent-Type: %s\r\nDate: %s\r\nLast-Modified: %s\r\nAccept-Ranges: bytes\r\nConnection: close\r\n",
  ++	    "%.20s %d %s\r\nServer: %s\r\nContent-Type: %s\r\nDate: %s\r\nLast-Modified: %s\r\nAccept-Ranges: bytes\r\n",
  + 	    hc->protocol, status, title, EXPOSED_SERVER_SOFTWARE, fixed_type,
  +-	    nowbuf, modbuf );
  ++	    nowbuf, modbuf);
  + 	add_response( hc, buf );
  + 	if ( encodings[0] != '\0' )
  + 	    {
  +@@ -681,6 +692,14 @@
  + 		"Content-Length: %d\r\n", length );
  + 	    add_response( hc, buf );
  + 	    }
  ++	else {
  ++		hc->do_keep_alive = 0;
  ++	}
  ++	if (hc->do_keep_alive) {
  ++	    add_response( hc, "Connection: keep-alive\r\n" );
  ++	} else {
  ++	    add_response( hc, "Connection: close\r\n" );
  ++	}
  + 	if ( extraheads[0] != '\0' )
  + 	    add_response( hc, extraheads );
  + 	add_response( hc, "\r\n" );
  +@@ -1603,6 +1622,61 @@
  + 
  + 
  + int
  ++httpd_request_reset(httpd_conn* hc, int preserve_read_buf )
  ++{
  ++	if (!preserve_read_buf) {
  ++	    hc->read_idx = 0;
  ++    	hc->checked_idx = 0;
  ++	}
  ++    hc->checked_state = CHST_FIRSTWORD;
  ++    hc->method = METHOD_UNKNOWN;
  ++    hc->status = 0;
  ++    hc->bytes_to_send = 0;
  ++    hc->bytes_sent = 0;
  ++    hc->encodedurl = "";
  ++    hc->decodedurl[0] = '\0';
  ++    hc->protocol = "UNKNOWN";
  ++    hc->origfilename[0] = '\0';
  ++    hc->expnfilename[0] = '\0';
  ++    hc->encodings[0] = '\0';
  ++    hc->pathinfo[0] = '\0';
  ++    hc->query[0] = '\0';
  ++    hc->referer = "";
  ++    hc->useragent = "";
  ++    hc->accept[0] = '\0';
  ++    hc->accepte[0] = '\0';
  ++    hc->acceptl = "";
  ++    hc->cookie = "";
  ++    hc->contenttype = "";
  ++    hc->reqhost[0] = '\0';
  ++    hc->hdrhost = "";
  ++    hc->hostdir[0] = '\0';
  ++    hc->authorization = "";
  ++    hc->remoteuser[0] = '\0';
  ++    hc->response[0] = '\0';
  ++#ifdef TILDE_MAP_2
  ++    hc->altdir[0] = '\0';
  ++#endif /* TILDE_MAP_2 */
  ++    hc->responselen = 0;
  ++    hc->if_modified_since = (time_t) -1;
  ++    hc->range_if = (time_t) -1;
  ++    hc->contentlength = -1;
  ++    hc->type = "";
  ++    hc->hostname = (char*) 0;
  ++    hc->mime_flag = 1;
  ++    hc->one_one = 0;
  ++    hc->got_range = 0;
  ++    hc->tildemapped = 0;
  ++    hc->init_byte_loc = 0;
  ++    hc->end_byte_loc = -1;
  ++    hc->keep_alive = 0;
  ++    hc->do_keep_alive = 0;
  ++    hc->should_linger = 0;
  ++    hc->file_address = (char*) 0;
  ++    return GC_OK;
  ++}
  ++
  ++int
  + httpd_get_conn( httpd_server* hs, int listen_fd, httpd_conn* hc )
  +     {
  +     httpd_sockaddr sa;
  +@@ -1657,53 +1731,12 @@
  +     hc->hs = hs;
  +     memset( &hc->client_addr, 0, sizeof(hc->client_addr) );
  +     memcpy( &hc->client_addr, &sa, sockaddr_len( &sa ) );
  +-    hc->read_idx = 0;
  +-    hc->checked_idx = 0;
  +-    hc->checked_state = CHST_FIRSTWORD;
  +-    hc->method = METHOD_UNKNOWN;
  +-    hc->status = 0;
  +-    hc->bytes_to_send = 0;
  +-    hc->bytes_sent = 0;
  +-    hc->encodedurl = "";
  +-    hc->decodedurl[0] = '\0';
  +-    hc->protocol = "UNKNOWN";
  +-    hc->origfilename[0] = '\0';
  +-    hc->expnfilename[0] = '\0';
  +-    hc->encodings[0] = '\0';
  +-    hc->pathinfo[0] = '\0';
  +-    hc->query[0] = '\0';
  +-    hc->referer = "";
  +-    hc->useragent = "";
  +-    hc->accept[0] = '\0';
  +-    hc->accepte[0] = '\0';
  +-    hc->acceptl = "";
  +-    hc->cookie = "";
  +-    hc->contenttype = "";
  +-    hc->reqhost[0] = '\0';
  +-    hc->hdrhost = "";
  +-    hc->hostdir[0] = '\0';
  +-    hc->authorization = "";
  +-    hc->remoteuser[0] = '\0';
  +-    hc->response[0] = '\0';
  +-#ifdef TILDE_MAP_2
  +-    hc->altdir[0] = '\0';
  +-#endif /* TILDE_MAP_2 */
  +-    hc->responselen = 0;
  +-    hc->if_modified_since = (time_t) -1;
  +-    hc->range_if = (time_t) -1;
  +-    hc->contentlength = -1;
  +-    hc->type = "";
  +-    hc->hostname = (char*) 0;
  +-    hc->mime_flag = 1;
  +-    hc->one_one = 0;
  +-    hc->got_range = 0;
  +-    hc->tildemapped = 0;
  +-    hc->init_byte_loc = 0;
  +-    hc->end_byte_loc = -1;
  +-    hc->keep_alive = 0;
  +-    hc->should_linger = 0;
  +-    hc->file_address = (char*) 0;
  +-    return GC_OK;
  ++
  ++/*
  ++printf("doing httpd_get_con(%d)\n", hc->conn_fd);
  ++*/
  ++
  ++    return httpd_request_reset(hc, 0);
  +     }
  + 
  + 
  +@@ -1720,6 +1753,9 @@
        {
  -     make_log_entry( hc, nowP );
  +     char c;
  + 
  ++/*
  ++printf("**REQUEST [%d]**\n%*.*s\n", hc->conn_fd, hc->read_idx, hc->read_idx, hc->read_buf);
  ++*/
  +     for ( ; hc->checked_idx < hc->read_idx; ++hc->checked_idx )
  + 	{
  + 	c = hc->read_buf[hc->checked_idx];
  +@@ -1912,8 +1948,11 @@
  + 	    eol = strpbrk( protocol, " \t\n\r" );
  + 	    if ( eol != (char*) 0 )
  + 		*eol = '\0';
  +-	    if ( strcasecmp( protocol, "HTTP/1.0" ) != 0 )
  ++	    if ( strcasecmp( protocol, "HTTP/1.0" ) != 0 ) {
  + 		hc->one_one = 1;
  ++		hc->keep_alive = 1;
  ++		hc->do_keep_alive = 1;
  ++		}
  + 	    }
  + 	}
  +     /* Check for HTTP/1.1 absolute URL. */
  +@@ -2129,6 +2168,7 @@
  + 		cp = &buf[11];
  + 		cp += strspn( cp, " \t" );
  + 		if ( strcasecmp( cp, "keep-alive" ) == 0 )
  ++		    hc->do_keep_alive = 1;
  + 		    hc->keep_alive = 1;
  + 		}
  + #ifdef LOG_UNKNOWN_HEADERS
  +@@ -2168,6 +2208,9 @@
  + 	    }
  + 	}
  + 
  ++/*
  ++printf("one_one = %d   keep_alive = %d\n", hc->one_one, hc->keep_alive);
  ++*/
  +     if ( hc->one_one )
  + 	{
  + 	/* Check that HTTP/1.1 requests specify a host, as required. */
  +@@ -2177,14 +2220,14 @@
  + 	    return -1;
  + 	    }
  + 
  +-	/* If the client wants to do keep-alives, it might also be doing
  +-	** pipelining.  There's no way for us to tell.  Since we don't
  +-	** implement keep-alives yet, if we close such a connection there
  +-	** might be unread pipelined requests waiting.  So, we have to
  +-	** do a lingering close.
  ++	/*
  ++	**  Disable keep alive support for bad browsers, 
  ++	**    list taken from Apache 1.3.19
  + 	*/
  +-	if ( hc->keep_alive )
  +-	    hc->should_linger = 1;
  ++	if ( hc->do_keep_alive && 
  ++	    ( strstr(hc->useragent, "Mozilla/2") != NULL ||
  ++	      strstr(hc->useragent, "MSIE 4.0b2;") != NULL))
  ++		hc->do_keep_alive = 0;
  + 	}
  + 
  +     /* Ok, the request has been parsed.  Now we resolve stuff that
  +@@ -2349,15 +2392,24 @@
  + 
  + 
  + void
  +-httpd_close_conn( httpd_conn* hc, struct timeval* nowP )
  +-    {
  +-    make_log_entry( hc, nowP );
  ++httpd_complete_request( httpd_conn* hc, struct timeval* nowP, int logit )
  ++{
  ++	if (logit)
  ++		make_log_entry( hc, nowP );
    
   -    if ( hc->file_address != (char*) 0 )
  -+    if ( hc->file_address == (char*) 1 )
  ++	if ( hc->file_address == (char*) 1 )
   +    {
   +	thttpd_closed_conn(hc->conn_fd);
   +    } else if ( hc->file_address != (char*) 0 )
    	{
    	mmc_unmap( hc->file_address, &(hc->sb), nowP );
    	hc->file_address = (char*) 0;
  -@@ -3026,11 +3037,9 @@
  + 	}
  ++	}
  ++
  ++void
  ++httpd_close_conn( httpd_conn* hc, struct timeval* nowP )
  ++{
  +     if ( hc->conn_fd >= 0 )
  + 	{
  + 	(void) close( hc->conn_fd );
  +@@ -3026,11 +3078,9 @@
    post_post_garbage_hack( httpd_conn* hc )
        {
        char buf[2];
  @@ -145,22 +396,53 @@
        }
    
    
  -@@ -3560,6 +3569,11 @@
  - 	 ( hc->sb.st_mode & S_IXOTH ) &&
  +@@ -3313,6 +3363,11 @@
  +     int r;
  +     ClientData client_data;
  + 
  ++    /*
  ++    **  We are not going to leave the socket open after a CGI... too hard
  ++    */
  ++    hc->do_keep_alive = 0;
  ++
  +     if ( hc->method == METHOD_GET || hc->method == METHOD_POST )
  + 	{
  + 	httpd_clear_ndelay( hc->conn_fd );
  +@@ -3561,6 +3616,11 @@
    	 match( hc->hs->cgi_pattern, hc->expnfilename ) )
    	return cgi( hc );
  -+
  + 
   +	if ( hc->hs->php_pattern != (char*) 0 &&
   +			match( hc->hs->php_pattern, hc->expnfilename)) {
   +		return thttpd_php_request( hc );
   +	}
  - 
  ++
        /* It's not CGI.  If it's executable or there's pathinfo, someone's
        ** trying to either serve or run a non-CGI file as CGI.   Either case
  -Only in thttpd-2.21b: libhttpd.c~
  -diff -ur thttpd-2.21b-orig/libhttpd.h thttpd-2.21b/libhttpd.h
  ---- thttpd-2.21b-orig/libhttpd.h	Tue Apr 24 00:36:50 2001
  -+++ thttpd-2.21b/libhttpd.h	Mon Aug 13 23:50:27 2001
  +     ** is prohibited.
  +@@ -3611,14 +3671,18 @@
  + 	}
  +     else
  + 	{
  ++		char *extraheads = "";
  + 	hc->file_address = mmc_map( hc->expnfilename, &(hc->sb), nowP );
  + 	if ( hc->file_address == (char*) 0 )
  + 	    {
  + 	    httpd_send_err( hc, 500, err500title, "", err500form, hc->encodedurl );
  + 	    return -1;
  + 	    }
  ++	if (strncmp(hc->decodedurl, "/nocache/", sizeof("/nocache/")-1) == 0) 
  ++		extraheads = "Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\nCache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\nPragma: no-cache\r\n";
  ++
  + 	send_mime(
  +-	    hc, 200, ok200title, hc->encodings, "", hc->type, hc->sb.st_size,
  ++	    hc, 200, ok200title, hc->encodings, extraheads, hc->type, hc->sb.st_size,
  + 	    hc->sb.st_mtime );
  + 	}
  + 
  +diff -Nur thttpd-2.21b/libhttpd.h thttpd-2.21b-cool/libhttpd.h
  +--- thttpd-2.21b/libhttpd.h	Tue Apr 24 00:36:50 2001
  ++++ thttpd-2.21b-cool/libhttpd.h	Fri Jul 26 18:12:50 2002
   @@ -69,6 +69,7 @@
        char* server_hostname;
        int port;
  @@ -169,20 +451,547 @@
        char* charset;
        char* cwd;
        int listen4_fd, listen6_fd;
  -diff -ur thttpd-2.21b-orig/thttpd.c thttpd-2.21b/thttpd.c
  ---- thttpd-2.21b-orig/thttpd.c	Tue Apr 24 00:41:57 2001
  -+++ thttpd-2.21b/thttpd.c	Mon Aug 13 23:50:27 2001
  -@@ -1333,7 +1333,7 @@
  - 	clear_connection( c, tvP );
  +@@ -132,7 +133,7 @@
  +     int got_range;
  +     int tildemapped;	/* this connection got tilde-mapped */
  +     off_t init_byte_loc, end_byte_loc;
  +-    int keep_alive;
  ++    int keep_alive, do_keep_alive;
  +     int should_linger;
  +     struct stat sb;
  +     int conn_fd;
  +@@ -229,6 +230,8 @@
  + ** If you don't have a current timeval handy just pass in 0.
  + */
  + extern void httpd_close_conn( httpd_conn* hc, struct timeval* nowP );
  ++void httpd_complete_request( httpd_conn* hc, struct timeval* nowP, int logit );
  ++int httpd_request_reset(httpd_conn* hc,int );
  + 
  + /* Call this to de-initialize a connection struct and *really* free the
  + ** mallocced strings.
  +diff -Nur thttpd-2.21b/mime_encodings.txt thttpd-2.21b-cool/mime_encodings.txt
  +--- thttpd-2.21b/mime_encodings.txt	Wed May 10 03:22:28 2000
  ++++ thttpd-2.21b-cool/mime_encodings.txt	Fri Jul 26 18:12:50 2002
  +@@ -3,6 +3,6 @@
  + # A list of file extensions followed by the corresponding MIME encoding.
  + # Extensions not found in the table proceed to the mime_types table.
  + 
  +-Z	x-compress
  +-gz	x-gzip
  ++Z	compress
  ++gz	gzip
  + uu	x-uuencode
  +diff -Nur thttpd-2.21b/mime_types.txt thttpd-2.21b-cool/mime_types.txt
  +--- thttpd-2.21b/mime_types.txt	Sat Apr 14 04:53:30 2001
  ++++ thttpd-2.21b-cool/mime_types.txt	Fri Jul 26 18:12:50 2002
  +@@ -1,135 +1,138 @@
  +-# mime_types.txt
  +-#
  +-# A list of file extensions followed by the corresponding MIME type.
  +-# Extensions not found in the table are returned as text/plain.
  +-
  +-html	text/html; charset=%s
  +-htm	text/html; charset=%s
  +-txt	text/plain; charset=%s
  +-rtx	text/richtext
  +-etx	text/x-setext
  +-tsv	text/tab-separated-values
  +-css	text/css
  +-xml	text/xml
  +-dtd	text/xml
  +-
  +-gif	image/gif
  +-jpg	image/jpeg
  +-jpeg	image/jpeg
  +-jpe	image/jpeg
  +-jfif	image/jpeg
  +-tif	image/tiff
  +-tiff	image/tiff
  +-pbm	image/x-portable-bitmap
  +-pgm	image/x-portable-graymap
  +-ppm	image/x-portable-pixmap
  +-pnm	image/x-portable-anymap
  +-xbm	image/x-xbitmap
  +-xpm	image/x-xpixmap
  +-xwd	image/x-xwindowdump
  +-ief	image/ief
  +-png	image/png
  +-
  +-au	audio/basic
  +-snd	audio/basic
  +-aif	audio/x-aiff
  +-aiff	audio/x-aiff
  +-aifc	audio/x-aiff
  +-ra	audio/x-pn-realaudio
  +-ram	audio/x-pn-realaudio
  +-rm	audio/x-pn-realaudio
  +-rpm	audio/x-pn-realaudio-plugin
  +-wav	audio/wav
  +-mid	audio/midi
  +-midi	audio/midi
  +-kar	audio/midi
  +-mpga	audio/mpeg
  +-mp2	audio/mpeg
  +-mp3	audio/mpeg
  +-
  +-mpeg	video/mpeg
  +-mpg	video/mpeg
  +-mpe	video/mpeg
  +-qt	video/quicktime
  +-mov	video/quicktime
  +-avi	video/x-msvideo
  +-movie	video/x-sgi-movie
  +-mv	video/x-sgi-movie
  +-vx	video/x-rad-screenplay
  +-
  +-a	application/octet-stream
  ++ez	application/andrew-inset
  ++hqx	application/mac-binhex40
  ++cpt	application/mac-compactpro
  ++doc	application/msword
  + bin	application/octet-stream
  ++dms	application/octet-stream
  ++lha	application/octet-stream
  ++lzh	application/octet-stream
  + exe	application/octet-stream
  +-dump	application/octet-stream
  +-o	application/octet-stream
  +-class	application/java
  +-js	application/x-javascript
  ++class	application/octet-stream
  ++so	application/octet-stream
  ++dll	application/octet-stream
  ++oda	application/oda
  ++pdf	application/pdf
  + ai	application/postscript
  + eps	application/postscript
  + ps	application/postscript
  +-dir	application/x-director
  ++smi	application/smil
  ++smil	application/smil
  ++mif	application/vnd.mif
  ++xls	application/vnd.ms-excel
  ++ppt	application/vnd.ms-powerpoint
  ++wbxml	application/vnd.wap.wbxml
  ++wmlc	application/vnd.wap.wmlc
  ++wmlsc	application/vnd.wap.wmlscriptc
  ++bcpio	application/x-bcpio
  ++vcd	application/x-cdlink
  ++pgn	application/x-chess-pgn
  ++cpio	application/x-cpio
  ++csh	application/x-csh
  + dcr	application/x-director
  ++dir	application/x-director
  + dxr	application/x-director
  +-fgd	application/x-director
  +-aam	application/x-authorware-map
  +-aas	application/x-authorware-seg
  +-aab	application/x-authorware-bin
  +-fh4	image/x-freehand
  +-fh7	image/x-freehand
  +-fh5	image/x-freehand
  +-fhc	image/x-freehand
  +-fh	image/x-freehand
  +-spl	application/futuresplash
  +-swf	application/x-shockwave-flash
  + dvi	application/x-dvi
  ++spl	application/x-futuresplash
  + gtar	application/x-gtar
  + hdf	application/x-hdf
  +-hqx	application/mac-binhex40
  +-iv	application/x-inventor
  ++js	application/x-javascript
  ++skp	application/x-koan
  ++skd	application/x-koan
  ++skt	application/x-koan
  ++skm	application/x-koan
  + latex	application/x-latex
  +-man	application/x-troff-man
  +-me	application/x-troff-me
  +-mif	application/x-mif
  +-ms	application/x-troff-ms
  +-oda	application/oda
  +-pdf	application/pdf
  +-rtf	application/rtf
  +-bcpio	application/x-bcpio
  +-cpio	application/x-cpio
  +-sv4cpio	application/x-sv4cpio
  +-sv4crc	application/x-sv4crc
  +-sh	application/x-shar
  ++nc	application/x-netcdf
  ++cdf	application/x-netcdf
  ++sh	application/x-sh
  + shar	application/x-shar
  ++swf	application/x-shockwave-flash
  + sit	application/x-stuffit
  ++sv4cpio	application/x-sv4cpio
  ++sv4crc	application/x-sv4crc
  + tar	application/x-tar
  ++tcl	application/x-tcl
  + tex	application/x-tex
  +-texi	application/x-texinfo
  + texinfo	application/x-texinfo
  ++texi	application/x-texinfo
  ++t	application/x-troff
  + tr	application/x-troff
  + roff	application/x-troff
  + man	application/x-troff-man
  + me	application/x-troff-me
  + ms	application/x-troff-ms
  +-zip	application/x-zip-compressed
  +-tsp	application/dsptype
  +-wsrc	application/x-wais-source
  + ustar	application/x-ustar
  +-cdf	application/x-netcdf
  +-nc	application/x-netcdf
  +-doc	application/msword
  +-ppt	application/powerpoint
  +-
  +-crt	application/x-x509-ca-cert
  +-crl	application/x-pkcs7-crl
  +-
  ++src	application/x-wais-source
  ++xhtml	application/xhtml+xml
  ++xht	application/xhtml+xml
  ++zip	application/zip
  ++au	audio/basic
  ++snd	audio/basic
  ++mid	audio/midi
  ++midi	audio/midi
  ++kar	audio/midi
  ++mpga	audio/mpeg
  ++mp2	audio/mpeg
  ++mp3	audio/mpeg
  ++aif	audio/x-aiff
  ++aiff	audio/x-aiff
  ++aifc	audio/x-aiff
  ++m3u	audio/x-mpegurl
  ++ram	audio/x-pn-realaudio
  ++rm	audio/x-pn-realaudio
  ++rpm	audio/x-pn-realaudio-plugin
  ++ra	audio/x-realaudio
  ++wav	audio/x-wav
  ++pdb	chemical/x-pdb
  ++xyz	chemical/x-xyz
  ++bmp	image/bmp
  ++gif	image/gif
  ++ief	image/ief
  ++jpeg	image/jpeg
  ++jpg	image/jpeg
  ++jpe	image/jpeg
  ++png	image/png
  ++tiff	image/tiff
  ++tif	image/tiff
  ++djvu	image/vnd.djvu
  ++djv	image/vnd.djvu
  ++wbmp	image/vnd.wap.wbmp
  ++ras	image/x-cmu-raster
  ++pnm	image/x-portable-anymap
  ++pbm	image/x-portable-bitmap
  ++pgm	image/x-portable-graymap
  ++ppm	image/x-portable-pixmap
  ++rgb	image/x-rgb
  ++xbm	image/x-xbitmap
  ++xpm	image/x-xpixmap
  ++xwd	image/x-xwindowdump
  ++igs	model/iges
  ++iges	model/iges
  ++msh	model/mesh
  ++mesh	model/mesh
  ++silo	model/mesh
  + wrl	model/vrml
  + vrml	model/vrml
  +-mime	message/rfc822
  +-
  +-pac	application/x-ns-proxy-autoconfig
  +-
  ++css	text/css
  ++html	text/html; charset=%s
  ++htm	text/html; charset=%s
  ++asc	text/plain; charset=%s
  ++txt	text/plain; charset=%s
  ++rtx	text/richtext
  ++rtf	text/rtf
  ++sgml	text/sgml
  ++sgm	text/sgml
  ++tsv	text/tab-separated-values
  + wml	text/vnd.wap.wml
  +-wmlc	application/vnd.wap.wmlc
  + wmls	text/vnd.wap.wmlscript
  +-wmlsc	application/vnd.wap.wmlscriptc
  +-wbmp	image/vnd.wap.wbmp
  ++etx	text/x-setext
  ++xml	text/xml
  ++xsl	text/xml
  ++mpeg	video/mpeg
  ++mpg	video/mpeg
  ++mpe	video/mpeg
  ++qt	video/quicktime
  ++mov	video/quicktime
  ++mxu	video/vnd.mpegurl
  ++avi	video/x-msvideo
  ++movie	video/x-sgi-movie
  ++ice	x-conference/x-cooltalk
  +diff -Nur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
  +--- thttpd-2.21b/thttpd.c	Tue Apr 24 00:41:57 2001
  ++++ thttpd-2.21b-cool/thttpd.c	Fri Jul 26 18:14:25 2002
  +@@ -95,6 +95,7 @@
  +     httpd_conn* hc;
  +     int tnums[MAXTHROTTLENUMS];         /* throttle indexes */
  +     int numtnums;
  ++    int keep_alive;
  +     long limit;
  +     time_t started_at;
  +     Timer* idle_read_timer;
  +@@ -111,12 +112,15 @@
  + static int httpd_conn_count;
  + 
  + /* The connection states. */
  +-#define CNST_FREE 0
  +-#define CNST_READING 1
  +-#define CNST_SENDING 2
  +-#define CNST_PAUSING 3
  +-#define CNST_LINGERING 4
  +-
  ++enum {
  ++	CNST_FREE = 0,
  ++	CNST_READING,
  ++	CNST_SENDING,
  ++	CNST_PAUSING,
  ++	CNST_LINGERING,
  ++	CNST_SENDING_RESP,
  ++	CNST_TOTAL_NR
  ++};
  + 
  + static httpd_server* hs = (httpd_server*) 0;
  + int terminate = 0;
  +@@ -140,11 +144,12 @@
  + static int handle_newconnect( struct timeval* tvP, int listen_fd );
  + static void handle_read( connecttab* c, struct timeval* tvP );
  + static void handle_send( connecttab* c, struct timeval* tvP );
  ++static void handle_send_resp( connecttab* c, struct timeval* tvP );
  + static void handle_linger( connecttab* c, struct timeval* tvP );
  + static int check_throttles( connecttab* c );
  + static void clear_throttles( connecttab* c, struct timeval* tvP );
  + static void update_throttles( ClientData client_data, struct timeval* nowP );
  +-static void clear_connection( connecttab* c, struct timeval* tvP );
  ++static void clear_connection( connecttab* c, struct timeval* tvP, int );
  + static void really_clear_connection( connecttab* c, struct timeval* tvP );
  + static void idle_read_connection( ClientData client_data, struct timeval* nowP );
  + static void idle_send_connection( ClientData client_data, struct timeval* nowP );
  +@@ -157,6 +162,12 @@
  + static void logstats( struct timeval* nowP );
  + static void thttpd_logstats( long secs );
  + 
  ++typedef void (*handler_func)(connecttab*, struct timeval *);
  ++
  ++handler_func handler_array[CNST_TOTAL_NR] =
  ++{NULL, handle_read, handle_send, NULL, handle_linger, handle_send_resp};
  ++
  ++#define RUN_HANDLER(type, c) handler_array[type](c, &tv)
  + 
  + static void
  + handle_term( int sig )
  +@@ -566,15 +577,17 @@
  + 	    if ( c == (connecttab*) 0 )
  + 		continue;
  + 	    hc = c->hc;
  +-	    if ( c->conn_state == CNST_READING &&
  +-		 fdwatch_check_fd( hc->conn_fd ) )
  +-		handle_read( c, &tv );
  +-	    else if ( c->conn_state == CNST_SENDING &&
  +-		 fdwatch_check_fd( hc->conn_fd ) )
  +-		handle_send( c, &tv );
  +-	    else if ( c->conn_state == CNST_LINGERING &&
  +-		 fdwatch_check_fd( hc->conn_fd ) )
  +-		handle_linger( c, &tv );
  ++	    switch (c->conn_state) {
  ++			case CNST_READING:
  ++			case CNST_SENDING:
  ++			case CNST_LINGERING:
  ++			case CNST_SENDING_RESP:
  ++				fdwatch_check_fd(hc->conn_fd);
  ++				RUN_HANDLER(c->conn_state, c);
  ++				break;
  ++		}
  ++		
  ++		
  + 	    }
  + 	tmr_run( &tv );
  + 
  +@@ -1196,8 +1209,10 @@
  +     logstats( &tv );
  +     for ( cnum = 0; cnum < maxconnects; ++cnum )
  + 	{
  +-	if ( connects[cnum].conn_state != CNST_FREE )
  ++	if ( connects[cnum].conn_state != CNST_FREE ) {
  ++	    httpd_complete_request( connects[cnum].hc, &tv, 1 );
  + 	    httpd_close_conn( connects[cnum].hc, &tv );
  ++	}
  + 	if ( connects[cnum].hc != (httpd_conn*) 0 )
  + 	    {
  + 	    httpd_destroy_conn( connects[cnum].hc );
  +@@ -1285,6 +1300,7 @@
  + 	c->linger_timer = (Timer*) 0;
  + 	c->bytes_sent = 0;
  + 	c->numtnums = 0;
  ++	c->keep_alive = 0;
  + 
  + 	/* Set the connection file descriptor to no-delay mode. */
  + 	httpd_set_ndelay( c->hc->conn_fd );
  +@@ -1297,12 +1313,40 @@
  + 	}
  +     }
  + 
  ++static void
  ++setup_sending(connecttab *c, int state, struct timeval *tvP)
  ++{
  ++	httpd_conn *hc = c->hc;
  ++    ClientData client_data;
  ++
  ++    c->conn_state = state;
  ++    c->started_at = tvP->tv_sec;
  ++    c->wouldblock_delay = 0;
  ++    client_data.p = c;
  ++    if (c->idle_read_timer != 0) {
  ++		tmr_cancel( c->idle_read_timer );
  ++	    c->idle_read_timer = (Timer*) 0;
  ++	}
  ++    c->idle_send_timer = tmr_create(
  ++	tvP, idle_send_connection, client_data, IDLE_SEND_TIMELIMIT * 1000L,
  ++	0 );
  ++    if ( c->idle_send_timer == (Timer*) 0 )
  ++	{
  ++	syslog( LOG_CRIT, "tmr_create(idle_send_connection) failed" );
  ++	exit( 1 );
  ++	}
  ++
  ++    fdwatch_del_fd( hc->conn_fd );
  ++    fdwatch_add_fd( hc->conn_fd, c, FDW_WRITE );
  ++}
  ++
  ++static void handle_request( connecttab *c, struct timeval *tvP);
  ++
  + 
  + static void
  + handle_read( connecttab* c, struct timeval* tvP )
  +     {
  +     int sz;
  +-    ClientData client_data;
  +     httpd_conn* hc = c->hc;
  + 
  +     /* Is there room in our buffer to read more bytes? */
  +@@ -1311,7 +1355,7 @@
  + 	if ( hc->read_size > 5000 )
  + 	    {
  + 	    httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
  +-	    clear_connection( c, tvP );
  ++	    clear_connection( c, tvP, 0 );
  + 	    return;
  + 	    }
  + 	httpd_realloc_str(
  +@@ -1327,29 +1371,69 @@
  +     ** EWOULDBLOCK; however, this apparently can happen if a packet gets
  +     ** garbled.
  +     */
  +-    if ( sz == 0 || ( sz < 0 && ( errno != EWOULDBLOCK ) ) )
  +-	{
  +-	httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
  +-	clear_connection( c, tvP );
  ++    if ( sz == 0 ) {
  ++    	if (! c->keep_alive) {
  ++		httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
  ++	}
  ++	clear_connection( c, tvP, 0 );
  ++	return;
  ++    } else if ( sz < 0 ) {
  ++    	if (errno != EWOULDBLOCK) {
  ++		httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
  ++		clear_connection( c, tvP, 0 );
  ++	} 
    	return;
  ++    }
  ++    if (sz > 0) hc->read_idx += sz;
  ++
  ++    /* 
  ++    ** if we start getting new data on this socket, "promote" it 
  ++    **  to read timeout
  ++    */
  ++    if ( hc->keep_alive ) {
  ++		ClientData client_data;
  ++
  ++	    if ( c->idle_read_timer != (Timer*) 0 )
  ++		{
  ++		tmr_cancel( c->idle_read_timer );
  ++		c->idle_read_timer = 0;
  ++		}
  ++
  ++	client_data.p = c;
  ++	c->idle_read_timer = tmr_create(
  ++	    tvP, idle_read_connection, client_data, IDLE_READ_TIMELIMIT * 1000L,
  ++	    0 );
  ++	if ( c->idle_read_timer == (Timer*) 0 )
  ++	    {
  ++	    syslog( LOG_CRIT, "tmr_create(idle_read_connection) failed" );
  ++	    exit( 1 );
  ++	    }
  ++    	
  ++    	hc->keep_alive = 0;
  ++    }
  ++	handle_request(c, tvP);
    	}
   -    hc->read_idx += sz;
  -+    if (sz > 0) hc->read_idx += sz;
    
  -     /* Do we have a complete request yet? */
  +-    /* Do we have a complete request yet? */
  ++static void
  ++handle_request( connecttab *c, struct timeval *tvP)
  ++{
  ++    httpd_conn* hc = c->hc;
  ++    
  ++	/* Do we have a complete request yet? */
        switch ( httpd_got_request( hc ) )
  -@@ -1387,6 +1387,12 @@
  - 	clear_connection( c, tvP );
  + 	{
  + 	case GR_NO_REQUEST:
  + 	return;
  + 	case GR_BAD_REQUEST:
  + 	httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );
  +-	clear_connection( c, tvP );
  ++	clear_connection( c, tvP, 0 );
  + 	return;
  + 	}
  + 
  +     /* Yes.  Try parsing and resolving it. */
  +     if ( httpd_parse_request( hc ) < 0 )
  + 	{
  +-	clear_connection( c, tvP );
  ++	clear_connection( c, tvP, 0 );
  + 	return;
  + 	}
  + 
  +@@ -1358,7 +1442,7 @@
  + 	{
  + 	httpd_send_err(
  + 	    hc, 503, httpd_err503title, "", httpd_err503form, hc->encodedurl );
  +-	clear_connection( c, tvP );
  ++	clear_connection( c, tvP, 0 );
  + 	return;
  + 	}
  + 
  +@@ -1366,7 +1450,7 @@
  +     if ( httpd_start_request( hc, tvP ) < 0 )
  + 	{
  + 	/* Something went wrong.  Close down the connection. */
  +-	clear_connection( c, tvP );
  ++	clear_connection( c, tvP, 0 );
  + 	return;
  + 	}
  + 
  +@@ -1384,37 +1468,26 @@
  + 	{
  + 	/* No file address means someone else is handling it. */
  + 	c->bytes_sent = hc->bytes_sent;
  +-	clear_connection( c, tvP );
  ++	clear_connection( c, tvP, 1 );
    	return;
    	}
   +	if (hc->file_address == (char *) 1) {
  @@ -194,7 +1003,56 @@
        if ( c->bytes_sent >= c->bytes_to_send )
    	{
    	/* There's nothing to send. */
  -@@ -1500,7 +1506,7 @@
  +-	clear_connection( c, tvP );
  ++	clear_connection( c, tvP, 1 );
  + 	return;
  + 	}
  + 
  +     /* Cool, we have a valid connection and a file to send to it. */
  +-    c->conn_state = CNST_SENDING;
  +-    c->started_at = tvP->tv_sec;
  +-    c->wouldblock_delay = 0;
  +-    client_data.p = c;
  +-    tmr_cancel( c->idle_read_timer );
  +-    c->idle_read_timer = (Timer*) 0;
  +-    c->idle_send_timer = tmr_create(
  +-	tvP, idle_send_connection, client_data, IDLE_SEND_TIMELIMIT * 1000L,
  +-	0 );
  +-    if ( c->idle_send_timer == (Timer*) 0 )
  +-	{
  +-	syslog( LOG_CRIT, "tmr_create(idle_send_connection) failed" );
  +-	exit( 1 );
  +-	}
  +-
  +-    fdwatch_del_fd( hc->conn_fd );
  +-    fdwatch_add_fd( hc->conn_fd, c, FDW_WRITE );
  ++	setup_sending(c, CNST_SENDING, tvP);
  +     }
  + 
  +-
  + static void
  + handle_send( connecttab* c, struct timeval* tvP )
  +     {
  +@@ -1443,6 +1516,9 @@
  + 	iv[1].iov_base = &(hc->file_address[c->bytes_sent]);
  + 	iv[1].iov_len = MIN( c->bytes_to_send - c->bytes_sent, c->limit );
  + 	sz = writev( hc->conn_fd, iv, 2 );
  ++/*
  ++printf("**RESPONSE2 [%d]** len = %d\n%*.*s\n", hc->conn_fd, hc->responselen, hc->responselen, hc->responselen, hc->response); 
  ++*/
  + 	}
  + 
  +     if ( sz == 0 ||
  +@@ -1486,7 +1562,7 @@
  + 	*/
  + 	if ( errno != EPIPE && errno != EINVAL && errno != ECONNRESET )
  + 	    syslog( LOG_ERR, "write - %m sending %.80s", hc->encodedurl );
  +-	clear_connection( c, tvP );
  ++	clear_connection( c, tvP, 0 );
  + 	return;
  + 	}
  + 
  +@@ -1500,7 +1576,7 @@
    	    {
    	    /* Yes; move the unwritten part to the front of the buffer. */
    	    int newlen = hc->responselen - sz;
  @@ -203,38 +1061,177 @@
    	    hc->responselen = newlen;
    	    sz = 0;
    	    }
  -diff -ur thttpd-2.21b-plain/mime_encodings.txt thttpd-2.21b/mime_encodings.txt
  ---- thttpd-2.21b-plain/mime_encodings.txt	Wed May 10 03:22:28 2000
  -+++ thttpd-2.21b/mime_encodings.txt	Mon Dec 10 15:10:25 2001
  -@@ -3,6 +3,6 @@
  - # A list of file extensions followed by the corresponding MIME encoding.
  - # Extensions not found in the table proceed to the mime_types table.
  - 
  --Z	x-compress
  --gz	x-gzip
  -+Z	compress
  -+gz	gzip
  - uu	x-uuencode
  -diff -ur thttpd-2.21b-plain/libhttpd.c thttpd-2.21b/libhttpd.c
  ---- thttpd-2.21b-plain/libhttpd.c	Tue Apr 24 00:42:40 2001
  -+++ thttpd-2.21b/libhttpd.c	Mon Dec 10 14:32:26 2001
  -@@ -3611,14 +3611,18 @@
  +@@ -1519,7 +1595,7 @@
  +     if ( c->bytes_sent >= c->bytes_to_send )
  + 	{
  + 	/* This conection is finished! */
  +-	clear_connection( c, tvP );
  ++	clear_connection( c, tvP, 1 );
  + 	return;
    	}
  -     else
  + 
  +@@ -1560,6 +1636,9 @@
  +     char buf[1024];
  +     int r;
  + 
  ++/*
  ++printf("*LINGER read\n");
  ++*/
  +     /* In lingering-close mode we just read and ignore bytes.  An error
  +     ** or EOF ends things, otherwise we go until a timeout.
  +     */
  +@@ -1569,6 +1648,37 @@
  +     }
  + 
  + 
  ++static void
  ++handle_send_resp(connecttab *c, struct timeval *tvP)
  ++{
  ++	httpd_conn* hc = c->hc;
  ++	int n = send(hc->conn_fd, hc->response, hc->responselen, 0);
  ++	int dokeep = 1;
  ++	
  ++	if (n < 0) {
  ++		if (errno == EAGAIN)
  ++			return;
  ++
  ++		dokeep = 0;
  ++		goto clear;
  ++	}
  ++
  ++	tmr_reset( tvP, c->idle_send_timer );
  ++
  ++	if (n == hc->responselen) {
  ++clear:
  ++		hc->response = realloc(hc->response, hc->maxresponse + 1);
  ++		hc->responselen = 0;
  ++
  ++		clear_connection(c, tvP, dokeep);
  ++		return;
  ++	}
  ++
  ++	hc->responselen -= n;
  ++
  ++	memmove(hc->response, hc->response + n, hc->responselen);
  ++}
  ++
  + static int
  + check_throttles( connecttab* c )
  +     {
  +@@ -1635,12 +1745,17 @@
  + 
  + 
  + static void
  +-clear_connection( connecttab* c, struct timeval* tvP )
  ++clear_connection( connecttab* c, struct timeval* tvP, int doKeep )
  +     {
  +     ClientData client_data;
  ++    int		linger;
  + 
  +     /* If we haven't actually sent the buffered response yet, do so now. */
  +-    httpd_write_response( c->hc );
  ++    if (c->hc->responselen && c->conn_state != CNST_SENDING_RESP) {
  ++		setup_sending(c, CNST_SENDING_RESP, tvP);
  ++
  ++		return;
  ++	}
  + 
  +     if ( c->idle_read_timer != (Timer*) 0 )
    	{
  -+		char *extraheads = "";
  - 	hc->file_address = mmc_map( hc->expnfilename, &(hc->sb), nowP );
  - 	if ( hc->file_address == (char*) 0 )
  - 	    {
  - 	    httpd_send_err( hc, 500, err500title, "", err500form, hc->encodedurl );
  - 	    return -1;
  +@@ -1669,13 +1784,45 @@
  +     ** circumstances that make a lingering close necessary.  If the flag
  +     ** isn't set we do the real close now.
  +     */
  +-    if ( c->hc->should_linger )
  ++
  ++    if ( c->hc->do_keep_alive && doKeep)
  + 	{
  +-	c->conn_state = CNST_LINGERING;
  ++		httpd_conn *hc = c->hc;
  ++	c->conn_state = CNST_READING;
  ++
  ++	client_data.p = c;
  ++	c->idle_read_timer = tmr_create(
  ++	    tvP, idle_read_connection, client_data, IDLE_KEEPALIVE_TIMELIMIT * 1000L,
  ++	    0 );
  ++	if ( c->idle_read_timer == (Timer*) 0 )
  ++	    {
  ++	    syslog( LOG_CRIT, "tmr_create(idle_read_connection) failed" );
  ++	    exit( 1 );
  ++	    }
  ++
  ++	c->bytes_sent = 0;
  ++	c->numtnums = 0;
  ++	c->keep_alive = 1;
  ++
  ++	httpd_complete_request( c->hc, tvP, 1 );
  ++
  + 	fdwatch_del_fd( c->hc->conn_fd );
  + 	fdwatch_add_fd( c->hc->conn_fd, c, FDW_READ );
  ++
  ++	httpd_request_reset( c->hc, 1 );
  ++
  ++	hc->read_idx -= hc->checked_idx;
  ++	memmove(hc->read_buf, hc->read_buf + hc->checked_idx, hc->read_idx);
  ++	hc->checked_idx = 0;
  ++	
  + 	/* Make sure we are still in no-delay mode. */
  + 	httpd_set_ndelay( c->hc->conn_fd );
  ++	handle_request(c, tvP);
  ++	}
  ++    else if ( c->hc->should_linger )
  ++        {
  ++	c->conn_state = CNST_LINGERING;
  ++
  + 	client_data.p = c;
  + 	c->linger_timer = tmr_create(
  + 	    tvP, linger_clear_connection, client_data, LINGER_TIME * 1000L, 0 );
  +@@ -1684,9 +1831,19 @@
  + 	    syslog( LOG_CRIT, "tmr_create(linger_clear_connection) failed" );
  + 	    exit( 1 );
    	    }
  -+	if (strncmp(hc->decodedurl, "/nocache/", sizeof("/nocache/")-1) == 0) 
  -+		extraheads = "Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\nCache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\nPragma: no-cache\r\n";
   +
  - 	send_mime(
  --	    hc, 200, ok200title, hc->encodings, "", hc->type, hc->sb.st_size,
  -+	    hc, 200, ok200title, hc->encodings, extraheads, hc->type, hc->sb.st_size,
  - 	    hc->sb.st_mtime );
  ++    	httpd_complete_request( c->hc, tvP, 1 );
  ++
  ++	fdwatch_del_fd( c->hc->conn_fd );
  ++	fdwatch_add_fd( c->hc->conn_fd, c, FDW_READ );
  ++	/* Make sure we are still in no-delay mode. */
  ++	httpd_set_ndelay( c->hc->conn_fd );
  + 	}
  +-    else
  ++     else  
  ++        {
  ++    	httpd_complete_request( c->hc, tvP, !c->keep_alive );
  + 	really_clear_connection( c, tvP );
  ++	}
  +     }
  + 
  + 
  +@@ -1716,11 +1873,13 @@
  +     c->idle_read_timer = (Timer*) 0;
  +     if ( c->conn_state != CNST_FREE )
  + 	{
  +-	syslog( LOG_INFO,
  +-	    "%.80s connection timed out reading",
  +-	    httpd_ntoa( &c->hc->client_addr ) );
  +-	httpd_send_err( c->hc, 408, httpd_err408title, "", httpd_err408form, "" );
  +-	clear_connection( c, nowP );
  ++	if (! c->keep_alive) {
  ++		syslog( LOG_INFO,
  ++		    "%.80s connection timed out reading",
  ++		    httpd_ntoa( &c->hc->client_addr ) );
  ++		httpd_send_err( c->hc, 408, httpd_err408title, "", httpd_err408form, "" );
  ++	}
  ++	clear_connection( c, nowP, 0 );
  + 	}
  +     }
  + 
  +@@ -1737,7 +1896,7 @@
  + 	syslog( LOG_INFO,
  + 	    "%.80s connection timed out sending",
  + 	    httpd_ntoa( &c->hc->client_addr ) );
  +-	clear_connection( c, nowP );
  ++	clear_connection( c, nowP, 0 );
    	}
  +     }
    
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +5 -3      php4/sapi/tux/php_tux.c
  
  Index: php_tux.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/tux/php_tux.c,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- php_tux.c	9 Jul 2002 09:14:45 -0000	1.2.2.1
  +++ php_tux.c	3 Aug 2002 00:44:21 -0000	1.2.2.2
  @@ -192,10 +192,12 @@
   {
   	char buf[BUF_SIZE + 1];
   	char *p;
  -
  +	sapi_header_line ctr = {0};
  +	
  +	ctr.line = buf;
  +	ctr.line_len = sprintf(buf, "Server: %s", TUXAPI_version);
  +	sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
   	
  -	sprintf(buf, "Server: %s", TUXAPI_version);
  -	sapi_add_header_ex(buf, strlen(buf), 1, 0, 0 TSRMLS_CC);
   	php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC);
   	php_register_variable("SERVER_SOFTWARE", TUXAPI_version, track_vars_array TSRMLS_CC);
   	php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array TSRMLS_CC);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +1 -17     php4/sapi/webjames/webjames.c
  
  Index: webjames.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/sapi/webjames/webjames.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- webjames.c	29 Apr 2002 02:33:47 -0000	1.2
  +++ webjames.c	3 Aug 2002 00:44:21 -0000	1.2.2.1
  @@ -54,22 +54,6 @@
   	return bytes;
   }
   
  -static int sapi_webjames_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
  -/*send the HTTP response line*/
  -{
  -	char buf[256];
  -
  -	if (WG(conn)->flags.outputheaders) {
  -		if (!SG(sapi_headers).http_status_line) {
  -			int code=SG(sapi_headers).http_response_code;
  -			snprintf(buf, 255, "HTTP/1.0 %d %s\r\n", code, code==200 ? "OK" : code==302 ? "Moved temporarily" : "Something");
  -			webjames_writestring(WG(conn), buf);
  -		}
  -	}
  -	
  -	return SAPI_HEADER_DO_SEND;
  -}
  -
   static void sapi_webjames_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
   /*send an HTTP header*/
   {
  @@ -286,7 +270,7 @@
   	php_error,                              /* error handler */
   
   	NULL,                                   /* header handler */
  -	sapi_webjames_send_headers,             /* send headers handler */
  +	NULL,             						/* send headers handler */
   	sapi_webjames_send_header,              /* send header handler */
   	sapi_webjames_read_post,                /* read POST data */
   	sapi_webjames_read_cookies,             /* read Cookies */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +1 -1      php4/tests/func/006.phpt
  
  Index: 006.phpt
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/tests/func/006.phpt,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- 006.phpt	29 Apr 2002 02:33:48 -0000	1.2
  +++ 006.phpt	3 Aug 2002 00:44:21 -0000	1.2.2.1
  @@ -18,4 +18,4 @@
   echo $a;
   ?>
   --EXPECT--
  -3B2A
  +2B1A
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.5   +8 -0      php4/win32/php4dllts.dsp
  
  Index: php4dllts.dsp
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/win32/php4dllts.dsp,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  --- php4dllts.dsp	9 Jul 2002 09:14:45 -0000	1.2.2.4
  +++ php4dllts.dsp	3 Aug 2002 00:44:21 -0000	1.2.2.5
  @@ -1689,6 +1689,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\ext\standard\sha1.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\ext\standard\soundex.c
   # End Source File
   # Begin Source File
  @@ -1892,6 +1896,10 @@
   # Begin Source File
   
   SOURCE=..\ext\standard\scanf.h
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\ext\standard\sha1.h
   # End Source File
   # Begin Source File
   
  
  
  
  1.2.2.1   +13 -11    php4/win32/readdir.c
  
  Index: readdir.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/win32/readdir.c,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- readdir.c	29 Apr 2002 02:33:50 -0000	1.2
  +++ readdir.c	3 Aug 2002 00:44:21 -0000	1.2.2.1
  @@ -113,29 +113,31 @@
   	return 0;
   }
   
  -void rewinddir(DIR *dir_Info)
  +int rewinddir(DIR *dp)
   {
   	/* Re-set to the beginning */
   	char *filespec;
   	long handle;
   	int index;
   
  -	dir_Info->handle = 0;
  -	dir_Info->offset = 0;
  -	dir_Info->finished = 0;
  +	_findclose(dp->handle);
   
  -	filespec = malloc(strlen(dir_Info->dir) + 2 + 1);
  -	strcpy(filespec, dir_Info->dir);
  +	dp->offset = 0;
  +	dp->finished = 0;
  +
  +	filespec = malloc(strlen(dp->dir) + 2 + 1);
  +	strcpy(filespec, dp->dir);
   	index = strlen(filespec) - 1;
   	if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
   		filespec[index] = '\0';
   	strcat(filespec, "/*");
   
  -	if ((handle = _findfirst(filespec, &(dir_Info->fileinfo))) < 0) {
  -		if (errno == ENOENT) {
  -			dir_Info->finished = 1;
  +	if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) {
  +		if (errno == ENOENT)
  +			dp->finished = 1;
   		}
  -	}
  -	dir_Info->handle = handle;
  +	dp->handle = handle;
   	free(filespec);
  +
  +return 0;
   }
  
  
  
  1.2.2.1   +1 -1      php4/win32/readdir.h
  
  Index: readdir.h
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/win32/readdir.h,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- readdir.h	29 Apr 2002 02:33:50 -0000	1.2
  +++ readdir.h	3 Aug 2002 00:44:21 -0000	1.2.2.1
  @@ -38,7 +38,7 @@
   struct dirent *readdir(DIR *);
   int readdir_r(DIR *, struct dirent *, struct dirent **);
   int closedir(DIR *);
  -void rewinddir(DIR *);
  +int rewinddir(DIR *);
   
   
   #endif /* READDIR_H */
  
  
  



php-i18n-commits メーリングリストの案内
Back to archive index