Compare commits

..
1539 Commits
Author SHA1 Message Date
SVN Migration 1408a2e29c This commit was manufactured by cvs2svn to create tag 'before-sapi-split'. 1999-09-26 20:17:29 +00:00
Sascha Schumann 96b6bdff27 Now thread safe version builds out of the box. libzend/TSRM
contain extra config scripts which pass the necessary libs back
    to our Makefile.
1999-09-26 20:17:28 +00:00
Sascha Schumann 0ac169b474 Build communication channel and add checks for C++ library 1999-09-26 20:12:05 +00:00
Sascha Schumann a5dbe81a76 Do not let PACKAGE/VERSION escape from tsrm_config.h. 1999-09-26 19:47:35 +00:00
Sascha Schumann feccd9f104 Undefine previously PACKAVE/VERSION macros. We should find a way
to suppress these from automake
1999-09-26 19:46:35 +00:00
Sascha Schumann 806abdb87c Use new tsrm_config script to determine libraries. 1999-09-26 19:26:54 +00:00
Sascha Schumann 17df2892bd Use helper script to determine compile time configuration for TSRM 1999-09-26 19:09:24 +00:00
Stig Bakken 1d9f6b8a57 Have to keep using AM_PROG_LIBTOOL to keep all automake versions happy. 1999-09-26 16:27:25 +00:00
Sascha Schumann 09ad17f67e Avoid specifying standard paths. This might result in compiler problems
(see #1937, #2367)
1999-09-26 15:38:58 +00:00
Sascha Schumann 182ac10749 Expand relative paths properly, otherwise build process will fail. 1999-09-26 15:00:12 +00:00
Sascha Schumann 8b462c1acf Do nothing, if PHP_RPATHS is empty. 1999-09-26 09:12:55 +00:00
Sascha Schumann df42e494d7 Disable rpaths optionally. 1999-09-26 09:05:56 +00:00
Andi Gutmans 4fff0386ac - Changed Ts{}.var to Ts{}.var.ptr_ptr. 1999-09-26 05:45:18 +00:00
Sascha Schumann 57668a27cf * Use per-thread structure for request data
* Update ChangeLog
1999-09-25 21:08:36 +00:00
Sascha Schumann 7922481919 Do not try to free NULLs. 1999-09-25 21:06:11 +00:00
Sascha Schumann b5524a0981 * use faster Ns_ConnWrite()
* access cookies correctly
    * set HTTP_* variables for script
1999-09-25 18:51:38 +00:00
Sascha Schumann 104209a328 * cleanup
* make cookies work
1999-09-25 16:51:18 +00:00
Thies C. Arntzen 091e91c051 fixed callback code -> now $parser is passed as a resource! 1999-09-25 16:42:31 +00:00
Sascha Schumann f8b9b0db69 * use consistent php_ns prefix
* improve configuration code
    * shutdown SAPI/TSRM correctly
1999-09-25 16:06:55 +00:00
Sascha Schumann dd7b4680da Add entry for AOLserver. 1999-09-25 15:41:51 +00:00
Sascha Schumann e6006d03ca * remove debugging message
* use SAPI's http response code
    * improve POST read (still blocks in Ns_ConnRead, even if there is enough
      data to read)
    * improve config data handling
1999-09-25 15:37:02 +00:00
Sascha Schumann 00b2df7b8f New Zend API 1999-09-25 12:09:50 +00:00
Sascha Schumann 9d1c26481a Use new Zend API 1999-09-25 11:55:42 +00:00
Andreas Karajannis 3ce44b1046 *** empty log message *** 1999-09-25 11:36:34 +00:00
Andreas Karajannis 7588b1bd81 odbc now uses the new Zend function api 1999-09-25 11:30:28 +00:00
Stefan Roehrich 2c9ee99743 Use new Zend API. 1999-09-25 11:23:02 +00:00
Sascha Schumann eb754de807 - support POST and HEAD requests
-   clean up module_main()
    -   allow arbitrary mappings
1999-09-25 01:06:33 +00:00
Sascha Schumann 4e8c8fd992 Initial AOLserver support. Note that the current way of creating
the shared library works only with GNU utilities. Some features
    have to be added yet (i.e. POST and cookie support).
1999-09-25 00:32:25 +00:00
Andrey Hristov bfa7b6b145 - Updated array functions to use high-performance API
- Updated preg_split() to allow returning only non-empty pieces
1999-09-24 22:44:41 +00:00
Sascha Schumann a412eb08cb PTHREADS is a custom symbol 1999-09-24 20:52:46 +00:00
Sascha Schumann 5453d0be3c Additionally check libc_r (*BSD) for pthread functions 1999-09-24 20:14:44 +00:00
Andrey Hristov 0c02153bb9 *** empty log message *** 1999-09-24 20:12:28 +00:00
Andrey Hristov ba01cefc0c Update to new high-performance function API. 1999-09-24 20:11:06 +00:00
Sascha Schumann 7a1fff1441 Use new Zend API. 1999-09-24 19:35:25 +00:00
Sascha Schumann d8895c02f7 Add _ex API implementation for booleans. 1999-09-24 19:22:25 +00:00
Sascha Schumann e303647058 Use new Zend API and some minor cleanup. 1999-09-24 19:15:17 +00:00
Andrey Hristov 5a35438c21 *** empty log message *** 1999-09-24 18:58:36 +00:00
Andrey Hristov 54fed6c652 Extended var_dump to handle IS_RESOURCE somewhat. 1999-09-24 18:57:02 +00:00
Andrey Hristov be0eeccdbc Update WDDX for new high-performance function API. 1999-09-24 18:43:34 +00:00
Thies C. Arntzen 8ad2f4a2e8 we want to know who to "blame";-) 1999-09-24 18:07:26 +00:00
Thies C. Arntzen c626d9e47b updated XML (only partly tested) 1999-09-24 18:02:58 +00:00
Stig Bakken 79e729d6b2 more high-tech shared building 1999-09-24 15:35:35 +00:00
Stig Bakken a4bc9478f8 kill another warning 1999-09-24 15:34:54 +00:00
Stig Bakken 63b101f36d kill warning 1999-09-24 15:34:30 +00:00
Stig Bakken 701bd7cfad set "phplibdir" in configure so it doesn't have to be set in Makefile.am 1999-09-24 15:34:06 +00:00
Thies C. Arntzen 032b459205 use getParameterEx 1999-09-24 15:10:13 +00:00
Stig Bakken 33a946d317 #if !HAVE_FOO -> #ifndef HAVE_FOO 1999-09-24 14:41:27 +00:00
Stig Bakken bd3132bcda AM_PROG_LIBTOOL is obsolete in libtool 1.3.3, which we now require.
Using AC_PROG_LIBTOOL instead.
1999-09-24 14:36:43 +00:00
Stig Bakken 56654596a3 Detect automake/libtool that are installed with different prefixes. 1999-09-24 14:29:28 +00:00
Thies C. Arntzen 10ec822b59 fixed warning 1999-09-24 14:18:33 +00:00
Zeev Suraski 360675cee3 Compile fixes for WDDX, XML and Zlib (untested) 1999-09-24 14:14:47 +00:00
Zeev Suraski 83a5bfdd04 This should make the Sybase CT module compile again (untested) 1999-09-24 14:11:53 +00:00
Zeev Suraski e99e7c04ba This should make the mSQL module compile again (untested) 1999-09-24 14:09:37 +00:00
Zeev Suraski 86133ef45e Ok guys, the prototype for zend_fetch_resource*() has changed - it now
accepts a zval ** instead of a zval *, to be suitable for use with the
getParametersEx() API.
You don't have to switch to the getParametersEx() API, but you will have to
go over your code and add &'s where it's applicable (of course, if you have
the mental strength to go over your code and convert it to use the Ex API,
it's best).

The MySQL module now uses the getParametersEx() API completely.
1999-09-24 14:07:15 +00:00
Zeev Suraski 85844ace95 Exify the standardized resource stuff 1999-09-24 14:03:45 +00:00
Sascha Schumann c8ac4bb069 Link with libtsrm.a, if thread-safety is chosen. 1999-09-23 20:27:17 +00:00
Sascha Schumann f0ee629b04 Exit, if subsequent configure scripts fail. 1999-09-23 20:17:07 +00:00
Sascha Schumann 8bf4fe02db Try to find ANSI/STDC compatible mode of host compiler 1999-09-23 19:34:42 +00:00
Andrew Skalski 1e573a9acd fixed php3 code problem 1999-09-23 17:54:26 +00:00
Andi Gutmans 63c15d292a - Fix bug #2364.
I haven't checked all of the conversion macros yet but there's a change
  there are more such bugs there.
1999-09-23 16:13:31 +00:00
Sascha Schumann 4efa22c84e Fix vpath build w/ thread-safe enabled on Unix. 1999-09-23 16:07:16 +00:00
Andrey Hristov 9f07657b48 Small clarification. 1999-09-23 15:37:01 +00:00
Sascha Schumann de8120f5d0 This version is finally the standard one. The last one was created
using the 'nested ifs mode' which seems to be the source of the problem.
1999-09-23 14:53:39 +00:00
Nick Gorham 7d759e6781 Added support for Easysoft ODBC-ODBC Bridge
Fixed bug in odbc_setoption
1999-09-23 14:46:35 +00:00
Andrew Skalski 1e13eb646e fixed typo in mcal_list_alarms() 1999-09-23 14:34:00 +00:00
Sascha Schumann ba8b703ba1 re2c's bit vectors appear to be not binary clean. Revert to
standard mode for the moment.
1999-09-23 14:09:42 +00:00
Thies C. Arntzen edb2032c4e tiny optimisation 1999-09-23 11:20:56 +00:00
Thies C. Arntzen 820adaddf1 Ora_Fetch_Into now resets the returned array in all cases 1999-09-23 10:23:12 +00:00
Thies C. Arntzen ed731497fe fixed NULL column
cleanups
1999-09-23 09:15:38 +00:00
Nick Gorham fd3f26c100 Added odbc metadata update log 1999-09-22 21:15:35 +00:00
Nick Gorham 21d8c984da Added support for metadata functions, odbc_tables, odbc_columns,
odbc_columnprivileges, odbc_foreignkeys, odbc_gettypeinfo,
    odbc_primarykeys, odbc_procedurecolumns, odbc_procedures,
    odbc_procedurecolumns, odbc_procedures, odbc_specialcolumns,
    odbc_statistics, odbc_tableprivileges
1999-09-22 21:14:03 +00:00
Andrew Skalski 1220513252 mcal fix 1999-09-22 20:23:34 +00:00
Andrew Skalski 4a35689b48 added null-checking in make_event_object 1999-09-22 20:21:40 +00:00
Andrew Skalski 4b0707cf32 Added optional port argument to ftp_connect() 1999-09-22 16:07:41 +00:00
Thies C. Arntzen 33de7a2ea4 i always forget something;-) 1999-09-22 15:26:16 +00:00
Thies C. Arntzen 24c5143122 fixed Ora_PLogon (rewrote ora_do_logon using php_mysql.c)
oracle_hack.c should no longer be needed!
1999-09-22 15:16:19 +00:00
Thies C. Arntzen 49c891f2cf preliminary fix for each until andi & zeev clean up! 1999-09-22 09:57:42 +00:00
Thies C. Arntzen 8c6da509f2 resourcified Oracle 1999-09-22 09:52:19 +00:00
Thies C. Arntzen 5f3515652a if you pass NULL as the resource_type_name to zend_fetch_resource*&friends the functions will not print any warnings if the resource is not found! 1999-09-22 09:46:44 +00:00
Stefan Roehrich 8b4000f4cb Added new allowable_tags for gzgetss() in ChangeLog, too. 1999-09-22 08:11:17 +00:00
Stefan Roehrich 0b1226219c Fixed gzgetss() with new _php3_strip_tags, corrected prototype. 1999-09-22 07:43:36 +00:00
Uwe Steinmann cc31ea96a5 - fixed misleading explaination of fdftk option 1999-09-22 05:27:55 +00:00
Andi Gutmans 7e5ef04b13 - Get rid of warning on win32, non-threadsafe mode. 1999-09-22 05:26:22 +00:00
Andrew Skalski 709286c0d2 removed NULL reference 1999-09-21 23:37:26 +00:00
Andrew Skalski 773a26bb22 added missing "addr.sin_family = AF_INET" to socket routines 1999-09-21 23:34:45 +00:00
Andrey Hristov 9ea5e71a75 *** empty log message *** 1999-09-21 21:39:20 +00:00
Andrey Hristov 33eb7d83ca WDDX can now serialize and deserialize objects. It uses a variable named
'php_classname' to store the class name as part of the structure. This way
WDDX modules in other languages don't get broken by extensions to DTD
we would have had to make otherwise.
1999-09-21 21:38:51 +00:00
Rasmus Lerdorf 1e57766b11 Slightly redundant to check for crypt() here again, but the TRY_RUN stuff
needs it defined in the same m4 file or it won't work, and it will just
get pulled out of the cache anyway, so it isn't a big deal.
1999-09-21 20:10:53 +00:00
Andi Gutmans 228a537bbe - Fix problem where function parameter fetches were created too late. 1999-09-21 20:00:01 +00:00
Rasmus Lerdorf cd0957112b fgetss/gzgetss fixes 1999-09-21 17:50:51 +00:00
Andrey Hristov 53fb0ea075 A couple of fixes. 1999-09-21 17:06:30 +00:00
Sascha Schumann 8771472210 AC_CRYPT_CAP depends on symbol checks performed later. 1999-09-21 15:00:22 +00:00
Sascha Schumann 5d70fbf6c1 * Do not check explicitly for symbols in the C library (fixes #2339)
* sort function checks
1999-09-21 14:51:24 +00:00
Thies C. Arntzen 8638a61df9 added krsort() function 1999-09-21 14:36:41 +00:00
Sascha Schumann 3f684e77a7 Continue, if re2c is not available.
Using the ".new" suffix, we prevent the shell from zeroing the file.
1999-09-21 12:24:41 +00:00
Sascha Schumann 240d17f12f Fix typo.
catched by: ssb
1999-09-21 08:41:31 +00:00
Sascha Schumann d47b44e3c2 Use install-sh (autoconf) script to install php. This automatically
creates the bindir path, so that the effect described in #2304 disappears.
1999-09-21 08:37:27 +00:00
Sascha Schumann cf00d75980 On at least Win32, gettimeofday() returns values in tv_usec which exceed
1,000,000.

    For portability reasons we set the integer part of our result to 0.
    This is equivalent to using tv_usec % 1000000.
1999-09-21 08:22:33 +00:00
Zeev Suraski 8b1195ffcc *** empty log message *** 1999-09-21 07:32:50 +00:00
Zeev Suraski a30f028a12 Add get_func_args() 1999-09-21 07:31:24 +00:00
Zeev Suraski 9f1d0dec47 *** empty log message *** 1999-09-21 00:46:22 +00:00
Rasmus Lerdorf 1324095627 woops 1999-09-21 00:21:01 +00:00
Rasmus Lerdorf 08389808ee Fix zlib compile problem 1999-09-21 00:15:21 +00:00
Andi Gutmans 6735ebb271 - Move some more language specific functions over to Zend.
get_class() and friends.
1999-09-20 21:29:41 +00:00
Andi Gutmans 68217ef564 - Move some more Zend internal functions from PHP 1999-09-20 21:28:37 +00:00
Sascha Schumann 7e686b1b95 Timestamp commit. I do consider removing the rule from Makefile.am 1999-09-20 21:17:26 +00:00
Egon Schmid 565c322797 Here was also something missing. 1999-09-20 20:05:26 +00:00
Andi Gutmans 5e3bbea0ff - Next part of locking fix.
$var = expr; and $var += expr; first create code for expr and later on
  for the fetch_w of $var.
1999-09-20 18:17:32 +00:00
Andrew Skalski 678c204e32 added FTP module 1999-09-20 18:12:55 +00:00
Andi Gutmans 7831d30265 - Newline for Sun's compiler 1999-09-20 17:01:38 +00:00
Andi Gutmans 06a18f169b - Add some internal functions to Zend 1999-09-20 16:56:09 +00:00
Andi Gutmans 96a19593b2 - Internal functions which are basic language functions should be in Zend
and not in PHP. I.e. strlen(), each(), error_reporting(), count(),
  get_class_name().
1999-09-20 16:56:02 +00:00
Rasmus Lerdorf c0dcedcafc Added optional allowable_tags arguments to strip_tags() and fgetss() to
allow you to specify a string of tags that are not to be stripped

Could have used flex for this, and Andrew sent me a flex file to do this,
but I could do the same thing with only minor additions to the existing
state machine and the resulting code is much smaller and tighter.
1999-09-20 15:50:56 +00:00
Andi Gutmans babad2694e - First step in fixing locking problem. Array fetches are now always done last.
Later on we will want to delay the write fetches even longer until after their
  resulting expression is parsed. The way it is now, will make it very easy
  to delay as long as we need.
1999-09-20 15:44:30 +00:00
Andrew Skalski 4247839610 php3 compatibility added 1999-09-20 15:40:22 +00:00
Andi Gutmans 82c8a9e745 - Indirect references had all of the fetches by mistakenly backpatched.
Actually all of the fetches are supposed to be read, except for the last
  one.
1999-09-20 14:45:36 +00:00
Andrey Hristov eb66458ed9 *** empty log message *** 1999-09-20 14:14:46 +00:00
Andrey Hristov f84ba1b039 - Upgraded var_dump() to take multiple arguments
- php3api_ is changed to php_
1999-09-20 14:14:26 +00:00
Andrew Skalski 85ca1dfb08 Replaced ftplib because of incompatible license. 1999-09-20 14:10:25 +00:00
Stig Bakken fffbcf5297 logic fix 1999-09-20 13:11:34 +00:00
Zeev Suraski 7a4a5944f9 Added zend_num_args() and zend_get_arg() 1999-09-20 13:00:35 +00:00
Thies C. Arntzen 6c0c410acf resource API & ZTS stuff 1999-09-20 12:51:20 +00:00
Zeev Suraski 13d840bc3f Add a file in which we can put Zend builtin functions 1999-09-20 12:24:39 +00:00
Zeev Suraski 8c75ad3dd3 *** empty log message *** 1999-09-20 11:56:45 +00:00
Zeev Suraski ee382ca76a Fixed a memory leak in the Apache per-directory directives handler 1999-09-20 11:54:06 +00:00
Thies C. Arntzen 4bb329eafb added array_count_values function. 1999-09-20 10:09:57 +00:00
Thies C. Arntzen 22d6f64f54 new API for var_dump 1999-09-20 09:34:39 +00:00
Zeev Suraski 4dcb388c0c *** empty log message *** 1999-09-19 11:07:49 +00:00
Andi Gutmans 3bfef7eef1 - Fix bug #2278 1999-09-18 23:21:33 +00:00
Andi Gutmans 1ac04fe9f4 - Try to fix the leak Rasmus reported. It's pretty sucky code so I'm really
not sure this fix is OK.I can't remember all of what we did there.
1999-09-18 22:07:12 +00:00
Andi Gutmans a5783da8a9 - Make Win32 compile again 1999-09-18 19:13:38 +00:00
Stefan Roehrich de13056307 Fixed prototype. 1999-09-18 19:03:35 +00:00
Zeev Suraski 6ddd686141 Safer behavior 1999-09-18 13:07:45 +00:00
Sascha Schumann 39dbe1d41b Aline escape signs in macro definitions. 1999-09-18 12:16:16 +00:00
Sascha Schumann a4838358f3 Pipe header names through sort and put only one on each line. This
makes them better accessible.

    Add stdlib.h to check headers.
1999-09-18 12:14:49 +00:00
Sascha Schumann dbc6964fbb There is no reason to define malloc() to xmalloc() in this context. 1999-09-18 12:13:48 +00:00
Andrey Hristov 8dbbeaf55a Make CVS quiet. 1999-09-17 22:25:00 +00:00
Thies C. Arntzen aa5102490a make SUNs c89 happy 1999-09-17 13:57:24 +00:00
Thies C. Arntzen ab185b11b5 SUN c89 doesn't like } direct after a label;-( 1999-09-17 12:32:18 +00:00
Thies C. Arntzen 20ee106672 no // in the sources please 1999-09-17 12:16:21 +00:00
Thies C. Arntzen 83bbb90d10 added newline at end of file 1999-09-17 12:14:31 +00:00
Gergely Madarász 32c7eaa9e3 note the shared modules in the changelog 1999-09-17 12:12:56 +00:00
Sascha Schumann 6780b649c6 Convert to Ex API. Does anyone have a better name for it? 1999-09-17 09:56:30 +00:00
Sascha Schumann 7d519f2f84 Use Ex API here as well. 1999-09-17 09:40:51 +00:00
Sascha Schumann c051b3868b Convert module to use Ex API. 1999-09-17 09:26:03 +00:00
Thies C. Arntzen 128b733eca fix #2316 - fetching empty LOBs via OCI8 1999-09-17 08:25:03 +00:00
Sascha Schumann 5a5646dce1 don't call empty function names 1999-09-17 05:45:52 +00:00
Sascha Schumann 55272d3df8 add user-level callbacks 1999-09-17 05:40:59 +00:00
Zeev Suraski 567b3cef6b - Fix bug #2318 1999-09-17 02:06:12 +00:00
Zeev Suraski d01370cdc2 *** empty log message *** 1999-09-17 02:06:08 +00:00
Sascha Schumann 09af5f967f supply path to xml include dir for APXS and APACI 1999-09-17 01:47:15 +00:00
Sascha Schumann 5a468e740c This format is also used by the XML module
allows us to compile with Apache's expat-lite dir
1999-09-17 01:38:10 +00:00
Sascha Schumann 61f288ced3 0' flag ignored with precision specifier and X' format 1999-09-17 01:16:54 +00:00
Sascha Schumann 79fd46c3a1 If available, use Apache's embedded expat 1999-09-17 00:57:28 +00:00
Sascha Schumann 51ad9501d1 fix Unix build 1999-09-17 00:12:58 +00:00
Zeev Suraski 98d95dd88e - Added support for unknown POST content types (Zeev)
- Introduce the convert_to_*_ex() API in strlen()
1999-09-16 23:18:15 +00:00
Zeev Suraski 52e769d883 Introduce convert_to_*_ex() 1999-09-16 23:15:34 +00:00
Zeev Suraski ec50085da3 *** empty log message *** 1999-09-16 22:42:21 +00:00
Zeev Suraski 71a4740847 *** empty log message *** 1999-09-16 22:31:33 +00:00
Zeev Suraski 13e67642fa Generalize SAPI a bit 1999-09-16 22:15:43 +00:00
Andrey Hristov f52ffb8943 Fixed memory leak. 1999-09-16 20:59:44 +00:00
Andrew Skalski 359a3af2a1 Added documentation hooks to ftp.c 1999-09-16 19:39:44 +00:00
Andrew Skalski 13a74e6979 added ftp_pwd() ftp_cdup() ftp_mkdir() and ftp_rmdir() 1999-09-16 19:03:27 +00:00
Andrew Skalski 93313c576c added ftp_systype() and ftp_listraw() functions 1999-09-16 18:38:11 +00:00
Andrew Skalski f0688ad7e2 Added rudimentary FTP support. 1999-09-16 15:57:51 +00:00
Sascha Schumann e20af627c2 improve short help messages 1999-09-16 15:35:49 +00:00
Sascha Schumann cf0ea12384 this was twice here 1999-09-16 14:07:56 +00:00
Sascha Schumann 119b85b736 this helps compiling on non-ANSI C compliant platforms 1999-09-16 14:06:35 +00:00
Rasmus Lerdorf 39df209ddd libtool check fix 1999-09-16 13:52:19 +00:00
Sascha Schumann 823a48558c . 1999-09-16 13:41:38 +00:00
Sascha Schumann 0320532962 Make some things accessible from outside for session module 1999-09-16 13:25:54 +00:00
Sascha Schumann 8ea07b1fd2 . 1999-09-16 13:00:06 +00:00
Sascha Schumann fa0f9ed367 wddx decode works as well 1999-09-16 12:55:31 +00:00
Sascha Schumann a597f24b5e wddx serialization works now 1999-09-16 12:00:58 +00:00
Sascha Schumann 92896a9945 Since Thies fixed var.c, objects work now, too. 1999-09-16 09:14:06 +00:00
Sascha Schumann efea424869 use AM_PROG_CC_STDC which covers AIX, Ultrix, OSF/1, HP-UX, and SVR4 1999-09-16 08:42:25 +00:00
Sascha Schumann e23d66fb5c silence libtool 1999-09-16 08:26:46 +00:00
Thies C. Arntzen 6ecd417b34 php4 now deserialized php3 objects correctly!
php3 will ignore objects serialized by php4 (that's the price we have to pay!)
small fix in deserializing objects with static initializers (thanx boris)
1999-09-16 08:05:17 +00:00
Thies C. Arntzen de73bd0123 when unserializing classes:
if the class is not known the standard class (no methods) will be used.
if the class is known - the created object will functional again!
1999-09-15 15:03:06 +00:00
Andrey Hristov b287aa2cf4 Fixed printf format. 1999-09-15 13:37:11 +00:00
Andrey Hristov 22ce3af972 HASH_OF is now in php.h. 1999-09-15 13:28:33 +00:00
Thies C. Arntzen e7ad3bbec2 use new API in var.c 1999-09-15 11:42:28 +00:00
Thies C. Arntzen 21a0c57cb1 i love id-strings 1999-09-15 11:09:32 +00:00
Thies C. Arntzen 3491633aa0 made serialize/unserialize work with classes! (also made the code "shorter")
CHANGES:
- the serialized string now also contains the class name (was not available in PHP3)!
- when unserializing php will create a fully working object of that class again
  therby the class has to be defined when unserializing - else you get a warning!
1999-09-15 11:08:25 +00:00
Stig Bakken 093e9f5e97 add LIBOBJS, used by AC_REPLACE_FUNCS 1999-09-15 11:08:00 +00:00
Thies C. Arntzen 328d08bd63 HASH_OF is usable enough (i hate duplicating macros all over the place) 1999-09-15 09:51:20 +00:00
Stig Bakken 1740e6ee4e Clean up the strlcat/strlcpy checks. 1999-09-15 09:35:20 +00:00
Andi Gutmans 36101a55ad - Leave this for now. 1999-09-15 05:44:59 +00:00
Andi Gutmans 100148168a - Thread-unsafe win32 compiles again
- Some strlcpy changes including one bug fix.
1999-09-15 05:42:36 +00:00
Andi Gutmans 0a7fc83253 - gettimeofday wasn't registered. 1999-09-15 05:08:45 +00:00
Andi Gutmans 0b601a7bea - Another small one. I'll leave the rest for now... 1999-09-14 20:15:32 +00:00
Andi Gutmans 37d7b91d48 - First go at using strlcat(). 1999-09-14 20:12:46 +00:00
Andi Gutmans 6a836bee6f - Support strlcpy/strlcat in windows. 1999-09-14 20:02:47 +00:00
Andrey Hristov 870a6679ff - Updated bundled PCRE library to version 2.08
- Made it possible to specify external location of the PCRE library
- Reworked PCRE extension to use updated PCRE library API

Hopefully now everything behaves just like Perl..
1999-09-14 19:24:37 +00:00
Andi Gutmans 61a3c147c3 Add strlcpy/strlcat to the build process 1999-09-14 19:12:57 +00:00
Uwe Steinmann 4b6328e052 - fixed memory leaks in pdf_open_memory_image() and pdf_add_bookmark() 1999-09-14 14:47:14 +00:00
Thies C. Arntzen cdd360043e forgot 1999-09-14 14:18:57 +00:00
Thies C. Arntzen da599af7cb is_array & friens speedups 1999-09-14 14:18:18 +00:00
Rasmus Lerdorf 0fd0323956 Fix a warning 1999-09-14 14:09:57 +00:00
Thies C. Arntzen 41da939988 count() now uses the new getParamertersEx API. 1999-09-14 13:34:27 +00:00
Thies C. Arntzen ac1a484c84 i'm sure this was left-over debugging code! 1999-09-14 13:32:54 +00:00
Thies C. Arntzen 598aaba8ca you can now position when doing lob-writes. 1999-09-14 12:41:00 +00:00
Andi Gutmans 331221eec6 - X-* is probably more standard. 1999-09-13 20:03:56 +00:00
Stig Bakken 809198b916 Added PHP_WITH_SHARED for checking "shared,*" prefix when configuring
extensions.
1999-09-13 17:17:51 +00:00
Thies C. Arntzen 95303a4bb2 added Metaphone support 1999-09-13 15:48:32 +00:00
Thies C. Arntzen c2042b1561 got rid of the define-callback stuff there's a bug in oracle-oci8! 1999-09-13 15:19:29 +00:00
Andrey Hristov 93c35c3352 Per Stig's suggestion. 1999-09-13 14:15:22 +00:00
Thies C. Arntzen c21663b3e7 ported $lob->savefile($filename) method from PHP3 1999-09-13 11:49:07 +00:00
Stig S. Bakken af1e5ad881 Make sure HAVE_LIBDL gets defined.
Disable more C++ tests when not configured for thread safety.
1999-09-13 11:29:44 +00:00
Thies C. Arntzen f858b6891c cleanups 1999-09-13 11:13:53 +00:00
Thies C. Arntzen d5bafdaa20 ported oci8 to use new class API
var_dump no longer tries to traverse avr->value.ht for objects but uses var->value.obj.properties instead
1999-09-13 10:52:54 +00:00
Zeev Suraski b88ef58a9f Modified phpinfo() to show the contents of arrays in HTTP_*_VARS[] 1999-09-13 01:11:41 +00:00
Zeev Suraski 3f0696dada Fix a buglet, and avoid crashing in phpinfo() (fixes an elusive legacy bug too) 1999-09-13 00:35:03 +00:00
Zeev Suraski b2c0acb9ec - Rewrote the GET/POST/Cookie data reader to support multi-dimensional
arrays! (Zeev)

This still needs a lot of more testing, but it seems to work more or less.
1999-09-12 23:51:12 +00:00
Zeev Suraski ce5a09ea40 Add PHP-Version header in IIS 1999-09-12 21:07:53 +00:00
Zeev Suraski 9e3315799c That's important enough to be cached 1999-09-12 20:36:48 +00:00
Zeev Suraski 5f1793e21c Make this class instanciatable 1999-09-12 19:27:50 +00:00
Sascha Schumann c656292b96 check for c++ only, if thread safety is enabled 1999-09-12 14:14:34 +00:00
Sascha Schumann 96559e91fe use static buffer for URLs instead of allocating/freeing memory
for each one
1999-09-12 13:03:10 +00:00
Sascha Schumann ac524d4b94 calculate length of cookie string correctly 1999-09-12 12:27:11 +00:00
Sascha Schumann 2e844a0799 add missing result msg 1999-09-12 12:20:59 +00:00
Sascha Schumann 691881a505 move session URL stuff to the last place before SAPI takes over 1999-09-12 11:36:45 +00:00
Sascha Schumann f2ff18e71e These shouldn't be here 1999-09-12 10:25:26 +00:00
Andi Gutmans d5968b8f21 - Oops 1999-09-12 09:57:51 +00:00
Andi Gutmans da973fe6bf - Make it compile on Win32 1999-09-12 09:55:53 +00:00
Zeev Suraski a1784083e9 Time to do that - rename the output layer prefix 1999-09-12 03:25:02 +00:00
Zeev Suraski 5a6b8653b9 *** empty log message *** 1999-09-12 03:08:29 +00:00
Sascha Schumann 036cc83ed6 expand version number 1999-09-12 00:45:38 +00:00
Sascha Schumann 3a9f68eb11 update 1999-09-12 00:44:08 +00:00
Andrey Hristov b203fb3481 Reverting to previous state. 1999-09-12 00:32:22 +00:00
Sascha Schumann 276c815f04 update macro 1999-09-12 00:31:23 +00:00
Andrey Hristov 0ac98aa95a Use global symbol table instead.. 1999-09-12 00:07:10 +00:00
Andrey Hristov 0c3ada7dd4 Use TRANS_SID macro for selective compilation.. 1999-09-12 00:05:45 +00:00
Andrey Hristov d8fc73b5c4 - Fixed mem leak when undefined variable was passed in for serialization
- Made it properly serialize object properties
1999-09-12 00:04:29 +00:00
Sascha Schumann 9531846163 add rule for url_scanner.c 1999-09-12 00:00:44 +00:00
Sascha Schumann b0f01a4778 - add standard disclaimer
- regenerate scanner with re2c -s
1999-09-11 23:53:40 +00:00
Sascha Schumann f040ce584d add transparent session id propagation
this uses a custom scanner which detects relative URIs and changes
  them appropiately.
  must be explicitly enabled with --enable-trans-sid
  (normal case is not affected, since session_adapt_uris defaults to
   void statement. Compiler should eliminate dead code in output.c then.)
1999-09-11 23:47:16 +00:00
Andrey Hristov 9706aa1daa - Added session_unset() function
- Fixed double session globals shutdown crash
- Added warning when session_destroy() is called without session_start()
1999-09-11 22:31:04 +00:00
Andrey Hristov 99caa5d43b Use OnUpdateBool for Boolean entries. 1999-09-11 20:36:47 +00:00
Sascha Schumann 2f39b484f5 avoid mmap overhead for small files 1999-09-11 18:38:34 +00:00
Sascha Schumann dda0b783df optimize fpassthru/readfile to use mmap instead of fread
which especially increases speed on large files.
1999-09-11 18:15:39 +00:00
Sascha Schumann 533ef3988b - support for external entropy sources
- extern_referer_chk => extern_referer_check
- kill a warning in mod_files.c
1999-09-11 17:20:31 +00:00
Zeev Suraski 7afbcb4fef Rename allow_builtin_links to expose_php 1999-09-11 16:32:08 +00:00
Zeev Suraski 27afe4e49b More cleanup 1999-09-11 16:16:16 +00:00
Zeev Suraski 7f42813ad8 Except for this small bug fix - it works 1999-09-11 15:36:00 +00:00
Zeev Suraski 15fee4d3a6 - Seriously optimize and clean php_parse_gpc_data()
- Added gpc_globals directive to turn global definitions of GPC variables on/off
(untested)
1999-09-11 15:04:45 +00:00
Zeev Suraski 1b6ccfe86c Cleanups & optimizations 1999-09-11 14:09:29 +00:00
Zeev Suraski fb910c64cd Cleanups 1999-09-11 13:44:23 +00:00
Sascha Schumann 177341f899 Move Linux check => more general --version-script check 1999-09-10 23:36:04 +00:00
Sascha Schumann b5c6dfdd0c add info about php3/php4 apache modules 1999-09-10 23:22:16 +00:00
Sascha Schumann 494defe52b tweak the INSTALL document a little bit 1999-09-10 22:55:32 +00:00
Sascha Schumann 9ae2115123 pass flag correctly to linker 1999-09-10 22:05:58 +00:00
Sascha Schumann 7cb18f7109 - better use of scoping
- support Solaris 2.x
1999-09-10 21:51:17 +00:00
Andrey Hristov b87e105411 Workaround for m4 weirdness. 1999-09-10 18:53:55 +00:00
Mark Musone b147536a10 lets not go down that road..were onyl going to use the internal event structure. No passing objects 1999-09-10 18:25:19 +00:00
Mark Musone 75b03f5f72 wrong preprocessor command 1999-09-10 18:21:41 +00:00
Mark Musone c8f88a0c0b ported the php3 stuff to php4. This module should work intechangably between the two versions also 1999-09-10 18:15:29 +00:00
Zeev Suraski d7357c0649 *** empty log message *** 1999-09-10 16:27:13 +00:00
Zeev Suraski ca1b3ffbc8 Shut up a warning 1999-09-10 16:16:24 +00:00
Uwe Steinmann 055472d3b4 - wrong use of php_print corrected 1999-09-10 05:23:02 +00:00
Zeev Suraski 2f9260fe4c Lost functionality in earlier fix... That should really work. 1999-09-10 02:59:37 +00:00
Zeev Suraski 7dc2579bfe That should do the trick (untested) 1999-09-10 02:55:28 +00:00
Mark Musone f2b3c3c2f6 my bad, sorry 1999-09-10 02:47:49 +00:00
Mark Musone 63243be5ac fixed memory leak 1999-09-10 02:37:46 +00:00
Andi Gutmans 22f066e708 - Add foreach() freeing code.
- Fix switch() freeing code to only free current function's switch expressions.
- I have a feeling break expr; in a switch where expr > 1 leaks because it
  won't free all of the expressions. Fix is probably not trivial.
1999-09-09 14:15:17 +00:00
Andi Gutmans 7567b96c22 - Add mcal to TS project. It seems that mcal needs to be patched a bit in
order to work TSRM. Right now it has globals.
1999-09-09 13:00:07 +00:00
Andi Gutmans f0a988a26a - Fix leak when decrementing strings which actually are longs. 1999-09-09 12:59:09 +00:00
Uwe Steinmann ca4005f623 forgot to change prototype 1999-09-09 06:41:15 +00:00
Uwe Steinmann 6bcb8eb1be pdf_setfont got optional parameter to embed fonts 1999-09-09 06:19:01 +00:00
Andi Gutmans 67daaa7aac - Fix for floating point array offsets. Same behaviour as in PHP 3.0. We
casted to (long).
1999-09-08 20:38:08 +00:00
Andrey Hristov 42e39d474b Remove extraneous debug dlerror() call which results in the subsequent
dlerror() returning NULL.
1999-09-08 19:36:18 +00:00
Andi Gutmans afecff3aa4 - Add -b option to flex++ 1999-09-08 17:16:22 +00:00
Gergely Madarász d4b10839b3 remove -Wl,--version-script from RPATHS, put it into a separate
variable
1999-09-08 14:31:57 +00:00
Danny Heijl 558d287af9 Be consistent. 1999-09-08 14:09:05 +00:00
Uwe Steinmann 66a636a6ae - add posibility to specify how objrec to objarr conversion
is performed (not ready yet)
1999-09-08 12:29:13 +00:00
Sascha Schumann b43cf1a583 add versioning support 1999-09-08 12:26:31 +00:00
Jakub Skopal bb4bc40cf9 Correct compiler warning. 1999-09-08 11:53:16 +00:00
Andi Gutmans e4e39b8263 - Update non-threadsafe project file 1999-09-07 20:42:20 +00:00
Andi Gutmans 48ab0fb57d - Fix warnings and win32 compile 1999-09-07 20:29:31 +00:00
Andrey Hristov 6101d108e0 Here you go, Egon. 1999-09-07 19:41:28 +00:00
Stefan Roehrich 06362129fa Fixed behavior with empty doc_root.
gzgetss() now uses _php3_strip_tags.
1999-09-07 19:05:37 +00:00
Stig Bakken 5c40e7c41e Add thread-safety notice here. The solution is using gethostbyname_r,
but it seems that it takes different parameters on Solaris and
Linux. ;-P We should probably make a wrapper function, and make a
configure test that checks if there is a reentrant version available,
and if not protect gethostbyname and similar calls with a mutex until
the results have been copied.  Ugly.
1999-09-07 18:46:25 +00:00
Andrey Hristov 7aacff63c9 Added second parameter to array_keys() which allows returning keys
only for a specific value in an array.
1999-09-07 18:29:59 +00:00
Andrey Hristov cff218cf54 Kill compiler warning. 1999-09-07 18:26:36 +00:00
Andrey Hristov d6c9c23ff5 Shut up, CVS. 1999-09-07 16:09:48 +00:00
Andrey Hristov 209fe717b1 Kill warnings. 1999-09-07 16:09:18 +00:00
Uwe Steinmann 51b01ca9b7 - uniqid() used the additional parameter even if it was not provided
this caused an segm fault. fixed it.
1999-09-07 10:34:17 +00:00
Stig S. Bakken 928863f85b define tests first, use after. 1999-09-07 09:02:41 +00:00
Zeev Suraski 959ad0e9ea A couple of BoundsChecker fixes 1999-09-06 22:40:27 +00:00
Andi Gutmans 4bc3097e6f - Fix win32 compile 1999-09-06 20:43:35 +00:00
Andi Gutmans f1afd5796c - Should fix Win32 compile 1999-09-06 20:43:25 +00:00
Andi Gutmans a0bad70bd1 - Make zend compile again in Win32. 1999-09-06 20:33:40 +00:00
Egon Schmid f0f7b9de53 File should here be string. 1999-09-06 20:13:23 +00:00
Danny Heijl c7cdb687da Forgot to update ChangeLog 1999-09-06 19:24:47 +00:00
Stefan Roehrich e4b7bf4ae8 Removed remaining PHP_31 defines.
First try with ZTS support, can someone with a working ZTS enabled setup test this, please?
1999-09-06 19:09:47 +00:00
Gergely Madarász 8ee14c990b Enabled shared build of gd module 1999-09-06 16:50:11 +00:00
Stig S. Bakken 2829eaeee8 ignore zend-scanner.cc 1999-09-06 16:15:52 +00:00
Stig S. Bakken 623406cf2b hand-patched some MSVC files 1999-09-06 16:15:27 +00:00
Stig S. Bakken 009025e00d * header file cleanup
* fixed --enable-thread-safety build for UNIX

I don't have a Win32 environment available, could someone please try
compiling on Win32 to see if I got all the header file stuff right there?
1999-09-06 16:14:08 +00:00
Stig S. Bakken 4d5491e285 Workaround to prevent TSRM from defining PACKAGE and VERSION.
No longer using autoheader.
1999-09-06 15:32:19 +00:00
Danny Heijl dad0716e37 - "Resourcified" the Informix driver. 1999-09-06 13:55:43 +00:00
Stig Bakken af2dca818c untabified 1999-09-06 13:35:37 +00:00
Jakub Skopal a38995a832 Workaround for crypt() getting too few characters for salt. 1999-09-06 13:24:36 +00:00
Stefan Roehrich 93252bd556 Fixed prototype. 1999-09-06 08:59:48 +00:00
Zeev Suraski f3e63d9e71 Fix the 4.0 tree (forgot to commit) 1999-09-06 05:21:45 +00:00
Jakub Skopal cb25b1222e Corrected the argument-list for getopt. -c expects argument. 1999-09-06 01:33:13 +00:00
Jakub Skopal 5cc16d86b0 Added addcslashes(), stripcslashes().
Reverted addslashes() to the very original behaviour.
1999-09-05 20:55:13 +00:00
Sascha Schumann 8aa0c92bc6 fix warning 1999-09-05 19:59:28 +00:00
Andi Gutmans 7ebbe20fb0 - Should fix short_tags and co. problem. 1999-09-05 19:49:54 +00:00
Andi Gutmans 2807ba18e1 - Oops 1999-09-05 19:37:24 +00:00
Andi Gutmans 52cb8bb275 - Make Win32 compile once again. 1999-09-05 19:36:04 +00:00
Andi Gutmans 14d9a59f1c - Make dir functions compile in Win32
- Fix too early memory manager initialization (For you Thies)
1999-09-05 19:04:40 +00:00
Andi Gutmans 99947a251e - Shift around header files. 1999-09-05 19:03:35 +00:00
Stefan Roehrich 5bcc067687 Find debian umich-ldap libraries/include files. 1999-09-05 16:28:16 +00:00
Andreas Karajannis dd509608a1 Changes for updated odbc module 1999-09-05 13:06:24 +00:00
Andreas Karajannis 361a09e5fa Renaming odbc files 1999-09-05 13:03:22 +00:00
Andreas Karajannis 8a7d806054 New resource handling for odbc module 1999-09-05 13:01:42 +00:00
Sascha Schumann 5a2189f3d3 work around gcc bug, otherwise compiler would die with
toplev.c:2261: Internal compiler error in function float_signal

in basic_functions.c
1999-09-05 11:38:01 +00:00
Andi Gutmans 04b0bc4c70 - php_error(E_ERROR,...) won't ever return so change the connection_status
before it is called.
1999-09-05 05:15:42 +00:00
Jakub Skopal 8c2f752c3d C++ comment fix... sorry. 1999-09-05 00:58:59 +00:00
Jakub Skopal 06545c3364 Appended second argument of addslashes(),
Changed php_addslashes() to add \000 instead of just \0
1999-09-05 00:55:48 +00:00
Rasmus Lerdorf bcb0020705 Forgot one 1999-09-04 22:18:43 +00:00
Rasmus Lerdorf f42659a8f1 Kill a warning 1999-09-04 22:15:51 +00:00
Zeev Suraski ce4e09daff This was actually intentional... put it back in and improve 1999-09-04 22:13:41 +00:00
Rasmus Lerdorf 54ec3a8e2f Cleanups
What the heck was that dangling (c) for in the PUTC macros?  Were they
supposed to serve some sort of purpose, because I sure don't see one for
them.
1999-09-04 22:06:12 +00:00
Zeev Suraski 7d33215124 Fix a stupid bug (from stefan@roehri.ch) 1999-09-04 21:58:51 +00:00
Stefan Roehrich fcd55e03cb First try with new resource handling in zlib module. 1999-09-04 21:51:54 +00:00
Rasmus Lerdorf 045aaef644 Oops, set_time_limit() would never have worked becase HAVE_SETITIMER
never got defined anywhere.
1999-09-04 21:33:18 +00:00
Rasmus Lerdorf 56b75920b4 Oops 1999-09-04 21:16:41 +00:00
Rasmus Lerdorf d3439023d3 Catch a timeout and add user-level interface for connection handling 1999-09-04 21:10:39 +00:00
Rasmus Lerdorf 82d975d671 Might as well bail as soon as we know we should since this is now
possible.  We still need to set our connection status bit field so a
shutdown function can figure out if a script was terminated due to an
abort, timeout or finished normally.
1999-09-04 20:37:24 +00:00
Rasmus Lerdorf 0bede914ab First part of the connection_status work. No user-callable functions
yet.  That is coming next.  Have also only done Apache and CGI so far.
Will have to crack open my ISAPI book to do that one.

Also changed the SAPI output functions to return an int.  We'll check
the connection status inside each one, but we might need the return
code at some other level and I don't see a good reason for just tossing
these return codes.
1999-09-04 20:12:47 +00:00
Andrey Hristov 8e9cd1e4ae Oops, don't need those commented out blocks. 1999-09-04 19:09:37 +00:00
Andrey Hristov 3af5f84c9d Kill compiler warnings. 1999-09-04 19:08:19 +00:00
Andrey Hristov ef943e75a5 Conform to new resource handling guidelines. 1999-09-04 19:07:57 +00:00
Zeev Suraski c12d4bc7d4 *** empty log message *** 1999-09-04 13:18:59 +00:00
Zeev Suraski 6d4ab7372d Add resource support to the Sybase CT module 1999-09-04 13:03:09 +00:00
Sascha Schumann 62fc17983a First try at WDDX serializer
(not active currently)
1999-09-04 11:25:43 +00:00
Zeev Suraski 81301ad2a9 A few fixes 1999-09-04 11:05:34 +00:00
Sascha Schumann 7e70c1ad91 cleanup 1999-09-04 08:33:31 +00:00
Sascha Schumann c49cdc9a64 remove superflicious enumaration 1999-09-04 08:21:36 +00:00
Sascha Schumann 7796f4d995 bail out, if ps_mm_instance wasn't initialized correctly
(should take place in global startup)
1999-09-04 08:21:09 +00:00
Sascha Schumann 7e50dda96b implement single directory garbage collector 1999-09-04 08:20:43 +00:00
Zeev Suraski 43523e9854 Update the mSQL module with the latest tech 1999-09-04 00:37:31 +00:00
Zeev Suraski 63b272998c Damn, forgot to commit that 1999-09-03 23:54:41 +00:00
Zeev Suraski 0d66693cc3 *** empty log message *** 1999-09-03 23:40:44 +00:00
Andrey Hristov 5e4a85f2e3 Static is good... 1999-09-03 21:12:10 +00:00
Zeev Suraski 3160cab22b Final MySQL tweaks 1999-09-03 19:54:12 +00:00
Danny Heijl a9fd483aff - backed out IS_RESOURCE stuff in favour of old php3-style IS_LONG
for now. This makes the Informix driver work again.
1999-09-03 19:50:14 +00:00
Zeev Suraski 90f67c6245 More cleanups 1999-09-03 19:37:46 +00:00
Zeev Suraski d7d966f7c6 Use the new API for resources in MySQL 1999-09-03 19:13:37 +00:00
Zeev Suraski 3feb4b3bdd Add new API for resources 1999-09-03 19:12:07 +00:00
Stefan Roehrich c1a4861eb1 Added detection of Oracle 8.1 (aka 8i) from PHP3. 1999-09-03 19:04:35 +00:00
Andrey Hristov f72897c29d Practice what you preach, I guess. 1999-09-03 19:01:19 +00:00
Sascha Schumann 3e591dabbd Add global startup/shutdown functions in Win32 version as well 1999-09-03 18:33:30 +00:00
Sascha Schumann 8e8d923fea Add prototypes for new functions in internal_functions.c.in 1999-09-03 18:32:34 +00:00
Sascha Schumann 5b293ecd4d - add global startup/shutdown handlers
- improve genif.sh to also consider all header files for inclusion
  (checks for phpext_)
- use vsnprintf in main.c to avoid buffer overflows
- improve sessions's mm module to cope better with OOM situations
  within the shared memory segment
- fix typo wrt session.auto_start
1999-09-03 17:46:39 +00:00
Sascha Schumann 690575e51f Add global startup/shutdown functions 1999-09-03 17:43:10 +00:00
Sascha Schumann 331823337c Makefile.in and other generated do not belong under CVS control 1999-09-03 17:41:58 +00:00
Gergely Madarász bc53807a17 Enabled shared build of mysql module 1999-09-03 17:13:53 +00:00
Gergely Madarász 9a17e7b6f5 Small cleanup 1999-09-03 16:37:00 +00:00
Gergely Madarász d447d17602 Enabled shared build of snmp module 1999-09-03 16:04:28 +00:00
Zeev Suraski 18d11eea40 Revert the IS_RESOURCE patch. It had some unintended behavior. 1999-09-03 15:22:04 +00:00
Gergely Madarász 94bc5f6c55 Enabled shared build of pgsql module 1999-09-03 14:58:51 +00:00
Andrey Hristov f8d9ef14b5 Fixed resource handling to conform to PHP4 guidelines. 1999-09-03 14:17:10 +00:00
Uwe Steinmann 303558e6cf - complete rewrite of object to array conversion 1999-09-03 10:21:55 +00:00
Zeev Suraski ee56524324 Version update 1999-09-03 08:26:13 +00:00
Zeev Suraski 276c876171 - Fixed several problems with output buffering and HEAD requests (Zeev)
- Fixed HTTP Status code issue with ISAPI module (Zeev)
1999-09-03 02:39:36 +00:00
Zeev Suraski 69fa5199bc Let $GLOBALS actually work... 1999-09-03 01:34:52 +00:00
Zeev Suraski 2521b5550a *** empty log message *** 1999-09-03 00:18:52 +00:00
Zeev Suraski 7b083fe5d1 Release resources when converting to other types (fix Thies's reported problem) 1999-09-03 00:11:47 +00:00
Zeev Suraski a3f77686ef Use \0NameFilenameLineno as key instead of numeric index for runtime defined functions 1999-09-02 21:06:05 +00:00
Stig Bakken 1bce4ebfd8 clean up library naming 1999-09-02 18:22:07 +00:00
Thies C. Arntzen 9e959a0b8a newest GetImageSize renamed header-file 1999-09-02 11:58:23 +00:00
Andi Gutmans 5b52d07ea6 - Small fix but it's important for people to know when B3 is released. 1999-09-02 04:26:48 +00:00
Mark Musone ed74428ca1 Added mcal module 1999-09-01 20:30:27 +00:00
Andi Gutmans b6789ae332 - Add sessions module to standard win32 build. 1999-09-01 19:28:07 +00:00
Andrey Hristov 7894c0cc1a Fix lcg.h location. 1999-09-01 14:20:15 +00:00
Uwe Steinmann 26415d0465 - Group-attribute may now appear multiple times in objrec record. 1999-09-01 06:15:46 +00:00
Stig Bakken 4092f4b8c0 ext/lcg -> ext/standard in various places 1999-08-31 18:05:22 +00:00
Stig Bakken b5375a323d oops 1999-08-31 15:57:30 +00:00
Thies C. Arntzen fb981b9650 we need DEFS when compiling this dir 1999-08-31 15:42:12 +00:00
Stig Bakken 788b25ccf8 fix for bug #2165 1999-08-31 15:39:13 +00:00
Stig Bakken b55d490ef0 fix for bug #2191 1999-08-31 15:27:31 +00:00
Stig Bakken 0e5f26c6bb compat fix, bug #2201 1999-08-31 15:20:21 +00:00
Thies C. Arntzen e8e88afd11 "fix" for #2202 1999-08-31 13:10:55 +00:00
Andreas Karajannis 125da02aa7 Add support for unixODBC 1999-08-30 10:48:23 +00:00
Stig Bakken 5600f889b2 moved lcg stuff to ext/standard 1999-08-29 20:12:12 +00:00
Sascha Schumann 869eeb62f4 PATH_TRANSLATED was not used at all, even if one comment implied
it should be used. After adding this, the CGI version works for me
w/ Apache + suexec
1999-08-29 18:25:37 +00:00
Egon Schmid 621fe70048 This one was nonesense. 1999-08-29 15:07:54 +00:00
Egon Schmid db44261039 Missing return type. 1999-08-29 15:00:18 +00:00
Egon Schmid 2c0b8b5ac8 Oops, file should be string here. 1999-08-29 09:59:12 +00:00
Rasmus Lerdorf 7c08c88a87 This check actually doesn't make a whole lot of sense. We need
something here, but if a mod_auth_* module declines, the type is
still set.  So, we need a check to see if there have been a
non-declined auth hook previously for this request.  I will ponder
a good approach to this.
1999-08-28 23:30:37 +00:00
Zeev Suraski a27ed294df Add -d switch 1999-08-28 23:06:07 +00:00
Zeev Suraski 3a52ee44f5 *** empty log message *** 1999-08-28 21:51:12 +00:00
Zeev Suraski 81e0131bc9 *** empty log message *** 1999-08-28 21:43:24 +00:00
Philippe Verdy ce6db81dce semicolon syntax error 1999-08-28 17:01:32 +00:00
Philippe Verdy 1dcee0c840 Bug in gmmktime():
it produced wrong results in New Foundland,
Central Australia, India, Iran, and Java, with
half-hour timezones.
1999-08-28 16:19:14 +00:00
Sascha Schumann 053712c95d when "track_vars" is disabled and a script which contains <?php_track_vars?> is
accessed for the first time, track vars were not created properly.
1999-08-28 14:00:44 +00:00
Sascha Schumann 52cd153723 merge in fix from php3 1999-08-28 13:53:46 +00:00
Zeev Suraski 4628f3021b New relay code 1999-08-28 11:17:28 +00:00
Sascha Schumann 563cb21539 If we stick to this style, parsing becomes easier (for humans and computers). 1999-08-28 10:31:54 +00:00
Zeev Suraski cda27ae9ac Beef up debug macros 1999-08-28 10:18:54 +00:00
Zeev Suraski 023cb6474b Fix a crash bug in case of aborted execution 1999-08-27 21:21:04 +00:00
Sascha Schumann 49824ee8cb - fix potential buffer problem in send_cookie
- fix gc probability algorithm
- don't access mod_data directly
- initial version of mm support for session data storage

  This works pretty good, but we need to create the initial mm pool
  from the parent process/thread. Still looking for a clean way to do that.
1999-08-27 21:03:22 +00:00
Zeev Suraski aa8b27ba1d Better debug macros 1999-08-27 19:17:19 +00:00
Andreas Karajannis 9eea00c086 Typo fix 1999-08-27 08:46:23 +00:00
Zeev Suraski f681b37c7b *** empty log message *** 1999-08-27 04:51:49 +00:00
Zeev Suraski afb0c684dc Tiny fixes 1999-08-27 04:39:19 +00:00
Zeev Suraski 1dadb97552 Log date&time on script logs 1999-08-27 04:31:53 +00:00
Mark Musone 6821da54f8 lets not make global functions unless we need to..actually this should be taken out someday 1999-08-27 04:22:39 +00:00
Mark Musone a92788ddd9 cleand up storing new events 1999-08-27 04:21:47 +00:00
Rasmus Lerdorf 8ccce347a3 Missing return types in prototypes 1999-08-26 14:13:14 +00:00
Andrey Hristov e0166ebc06 shut up CVS 1999-08-26 13:27:26 +00:00
Andrey Hristov aa147184ba *** empty log message *** 1999-08-26 13:26:57 +00:00
Andrey Hristov 1a218328da Fix for #2161 1999-08-26 13:25:53 +00:00
Andi Gutmans 02822cbc33 - Damn. It wasn't a correct fix. This should do it.
When the zval ** are equal we don't want to assign_ref, in any other case
  I can think of we do want to assign_ref.
1999-08-26 07:33:53 +00:00
Andi Gutmans 2c88f2950c - Fix leak when global is used in the global scope. 1999-08-26 07:26:15 +00:00
Andi Gutmans f297719cdb - Make Win32 compile again. 1999-08-26 06:49:42 +00:00
Andi Gutmans 1bfb1f7958 - Fix when redefining classes at run-time. 1999-08-26 06:47:45 +00:00
Sascha Schumann 8b44285b90 make it compile with gcc again 1999-08-25 21:54:00 +00:00
Andi Gutmans 746ce67b66 - Add hash_apply_with_arguments() 1999-08-25 19:02:13 +00:00
Sascha Schumann 3b408ce516 . 1999-08-25 16:58:01 +00:00
Sascha Schumann 33ed504ef4 AIX wants the value, not the pointer to the value.
Fixes #2149
1999-08-25 16:53:57 +00:00
Andi Gutmans 7a9ad9d0c8 Make fopen() work with URL's in Win32 1999-08-25 16:24:14 +00:00
Andi Gutmans c5d640d8af - More elegant fix for Win32 include_path 1999-08-25 13:46:52 +00:00
Andi Gutmans f065529b6d - Fix for include_path for Win32 (Zend library) 1999-08-25 12:22:45 +00:00
Andi Gutmans c7f7b1c3d6 - Temporary fix to allow Win32 MT safe version to use zend_fopen(). 1999-08-25 12:20:50 +00:00
Zeev Suraski 7e250d06f5 Add output_buffering directive 1999-08-24 23:12:50 +00:00
Mark Musone d8a322e7be argh..Finally 1999-08-24 20:56:02 +00:00
Sascha Schumann 9aea8d5bdc suppress error exit status on non Rhapsody systems 1999-08-23 23:02:09 +00:00
Sascha Schumann d9bf422f12 don't print out error message 1999-08-23 22:43:18 +00:00
Sascha Schumann a05e8e7a75 malloc.h is deprecated, use stdlib.h instead 1999-08-23 19:43:01 +00:00
Andi Gutmans 48a8b14a47 - Fixed a specific memory leak linked to locking. 1999-08-23 19:02:28 +00:00
Mark Musone 196b2350f4 changed to use the new, soon to be public libicap 0.99 1999-08-23 17:19:06 +00:00
Sascha Schumann 0e43d751ea return true to match documentation 1999-08-23 15:37:11 +00:00
Sascha Schumann d82728c4d0 This changes makes it work on egcs 1.1.2/Alpha 1999-08-22 19:43:04 +00:00
Andi Gutmans d13f6d754f - Add lcg to windows project. 1999-08-22 19:19:42 +00:00
Sascha Schumann 306c8a7fc8 . 1999-08-22 18:48:57 +00:00
Sascha Schumann 85151a61ce remove all references to RAW_RPATHs
Apache builds now correctly when shared core is used
1999-08-22 18:47:27 +00:00
Sascha Schumann 433880bc6e remove checks 1999-08-22 18:34:40 +00:00
Sascha Schumann 1dd31c38a6 - cleanup code
- add script which creates the directory tree for better scaling
  of mod_files

I have to decide yet whether we implement the garbage collection in the
module or if we simply let the user do

find path -ctime +1 | xargs rm
1999-08-22 14:14:46 +00:00
Sascha Schumann 02d6ec2a6b Use O_EXCL where possible. 1999-08-22 13:43:23 +00:00
Sascha Schumann 070dfe0833 - add session.extern_referer_chk
- use combined lcg in session id creation
1999-08-21 20:48:40 +00:00
Sascha Schumann f9b8901791 . 1999-08-21 17:34:55 +00:00
Sascha Schumann c9bb8db0ad get rid of that usleep() and add some entropy using the combined lcg 1999-08-21 17:22:08 +00:00
Zeev Suraski 6313238c63 Fix for Thies's UMR 1999-08-20 17:02:11 +00:00
Andrey Hristov e5aa4c844f *** empty log message *** 1999-08-20 13:04:05 +00:00
Andrey Hristov 01ed90ccef Fix bug #2025 1999-08-20 13:03:22 +00:00
Egon Schmid 17f132f9ee Here was also something missing 1999-08-19 20:31:57 +00:00
Mark Musone 67e81da36b *smack*...must..initialize...return...value.. 1999-08-19 19:02:22 +00:00
Uwe Steinmann c3fe95d971 On the way to make configure more robust 1999-08-19 17:07:27 +00:00
Andi Gutmans aeec4e198a - Fixed memory leaks. tsrm resource id deallocation still needs to be implemented. 1999-08-19 16:52:53 +00:00
Andi Gutmans e5fbf4414a - Make sure expr_list and echo_list are either empty or comma seperated
expressions
1999-08-19 15:15:34 +00:00
Uwe Steinmann 4747a40964 - fixed several memory leaks
- fixed broken hw_cp and hw_mv functions
1999-08-19 15:03:15 +00:00
Andrey Hristov 2bcf787a29 *** empty log message *** 1999-08-19 13:19:47 +00:00
Uwe Steinmann 7d52d5b786 missing return type 1999-08-19 06:43:44 +00:00
Rasmus Lerdorf 314f107498 TTF support tested and working now 1999-08-19 06:32:07 +00:00
Rasmus Lerdorf 7f97086631 This should fix TTF support - untested 1999-08-19 05:23:02 +00:00
Andi Gutmans fd28fec38b - Fixed typo in oci8 error message 1999-08-19 04:13:56 +00:00
Andrey Hristov c10c675f5b Fixed bug #2105 1999-08-18 17:23:01 +00:00
Chuck Hagenbuch 869c196fa0 cjh: fixing the imap_add_body crash in php4. 1999-08-18 17:19:20 +00:00
Thies C. Arntzen c1218de0d2 ZTS 1999-08-18 16:48:59 +00:00
Andrey Hristov 3f48a5524d Ported fixed for bug #2103 from PHP3. 1999-08-18 16:43:57 +00:00
Thies C. Arntzen f63da06238 ZTS fix 1999-08-18 15:40:54 +00:00
Thies C. Arntzen bed72caf06 some ZTS stuff 1999-08-18 15:39:46 +00:00
Thies C. Arntzen 9e9050a428 on unix ZTS gets defined in zend_config.h 1999-08-18 15:26:39 +00:00
Thies C. Arntzen e3aeb15678 ocifetchinto fix 1999-08-18 12:51:51 +00:00
Zeev Suraski 50bfff5502 Fix #2012 1999-08-17 22:31:45 +00:00
Zeev Suraski cd2006f8b7 Fix #2090 1999-08-17 22:06:55 +00:00
Zeev Suraski 39f6b22dae *** empty log message *** 1999-08-17 22:01:10 +00:00
Zeev Suraski 65e6d82771 Fix #2096 1999-08-17 22:00:02 +00:00
Zeev Suraski 96fd258d07 Fix #2070 1999-08-17 21:36:30 +00:00
Andi Gutmans acd6114fa7 - Add some ZENDAPI's 1999-08-17 19:25:22 +00:00
Sascha Schumann 71e3f6fde3 merge in change:
Date:   Monday June 28, 1999 @ 4:40
Author: bjh

Update of /repository/php3/functions
In directory php:/tmp/cvs-serv5697

Modified Files:
    crypt.c
Log Message:
Stop core dump using crypt() with standard DES. When PHP3_MAX_SALT_LEN = 2
adding the null terminator to the salt exceeds allocated space causing
stack corruption.
1999-08-17 18:21:04 +00:00
Sascha Schumann 52d6ab608f update 1999-08-17 18:08:37 +00:00
Sascha Schumann 1f4d09c09f HAVE_FREETYPE_H isn't defined anywhere. HAVE_LIBTTF should be sufficient 1999-08-17 18:06:39 +00:00
Sascha Schumann 4ceffd7131 fix persistency of mhash_* constants 1999-08-17 17:31:27 +00:00
Mark Musone 01b178292e dont have these library functiosn yet 1999-08-17 16:55:01 +00:00
Mark Musone b9d17aaab4 argh..heh..par for the course.. 1999-08-17 16:51:04 +00:00
Mark Musone f08430ec65 argh..bad day.. 1999-08-17 16:50:27 +00:00
Mark Musone 1d9a7c2623 please work... 1999-08-17 16:44:17 +00:00
Mark Musone 4136916e2f hrmmm 1999-08-17 15:17:01 +00:00
Mark Musone 8339e8c81d last few compile fixes 1999-08-17 15:07:22 +00:00
Mark Musone 4d738adb38 maybe it'll compile now..more php3->php4 conversions 1999-08-17 15:03:51 +00:00
Mark Musone 90e2bc1580 more changes 1999-08-17 14:41:23 +00:00
Thies C. Arntzen 3d05a0d9cc ZTS stuff 1999-08-17 14:40:28 +00:00
Mark Musone 0e1db64f8d thanks Andrey! 1999-08-17 14:31:39 +00:00
Sascha Schumann ba78cb9c53 fix flushing cached information to disk 1999-08-17 14:18:27 +00:00
Thies C. Arntzen f93ce67426 cleanups & ZTS stuff (ZTS untested!) 1999-08-17 13:54:25 +00:00
Thies C. Arntzen e30a2740cf imported diskfreespace from 3.0 1999-08-17 12:32:23 +00:00
Uwe Steinmann a5a5902fbc fixed potential segm faults 1999-08-17 09:59:19 +00:00
Andrey Hristov a0bf6b0923 Removed internal pointer reset from array_walk. 1999-08-16 14:19:49 +00:00
Philippe Verdy 236d54114c make pcre test program compile again with Zeev's
additions in the pcre_exec() function parameters
1999-08-15 23:52:37 +00:00
Andi Gutmans a08dc937c7 - Oopsie 1999-08-15 19:38:10 +00:00
Andi Gutmans b5f5e9a6d1 - Optimize the execute stack a bit. 1999-08-15 19:29:39 +00:00
Thies C. Arntzen 94ce166244 added a few PLS_FETCH() 1999-08-15 18:52:10 +00:00
Zeev Suraski 4e33a1d677 Close bug #1742 1999-08-14 16:52:28 +00:00
Andrey Hristov 796c4a021a *** empty log message *** 1999-08-14 16:45:51 +00:00
Andrey Hristov c85209985a Forgot to have internal pointer reset. 1999-08-14 16:43:38 +00:00
Danny Heijl f12728f13e more of the new ini stuff 1999-08-14 15:30:48 +00:00
Zeev Suraski 96d4220a5d Fix several class issues 1999-08-14 12:54:17 +00:00
Zeev Suraski ef5b7e212d Generate better warnings for class/function redefinitions 1999-08-14 11:50:36 +00:00
Zeev Suraski 2560bfd5f9 Rename TestClass to OverloadedTestClass 1999-08-14 11:08:26 +00:00
Zeev Suraski 55a6c270dd Fix thread unsafe version 1999-08-14 10:04:04 +00:00
Andi Gutmans 7145d1a21a - Make the non-threadsafe version compile again 1999-08-14 09:55:43 +00:00
Zeev Suraski 25829488c4 Add new-thread handlers 1999-08-14 09:35:52 +00:00
Zeev Suraski 58e24ac18a - Add PHP Modules workspace
- Get the MySQL module to compile&work under thread-safe Win32
- Fix various thread safety issues with dynamic modules
1999-08-13 21:03:27 +00:00
Andrey Hristov 5ae3f32b24 Fixed bug #2023. 1999-08-13 20:28:27 +00:00
Sascha Schumann e8f465f3d4 rerun checks if buildconf is newer than the time stamp file 1999-08-13 11:57:40 +00:00
Zeev Suraski 5fbe27828b Separate Sybase-CT from Sybase, and fix build process for Sybase-CT 1999-08-13 00:14:17 +00:00
Uwe Steinmann d13824b0bc fixed unresolved symbol pdf_open_memory_image when pdflib 2.01 is used 1999-08-12 17:45:01 +00:00
Philippe Verdy 2d3ef1b8ae no return warning removed. fixed TSRM constructor prototype 1999-08-12 11:05:43 +00:00
Philippe Verdy 646db4f072 signed/unsigned warning removed 1999-08-12 10:53:29 +00:00
Philippe Verdy 443b99805e Bison generated files 1999-08-12 10:49:04 +00:00
Uwe Steinmann d4346da6cb config for pdf module should now be similar to php3 1999-08-12 06:23:28 +00:00
Mark Musone e6241dc703 whoops, forgot to actually return the alarms :^) 1999-08-11 19:56:18 +00:00
Uwe Steinmann 205309f1c1 slight changes to config of pdf module 1999-08-10 17:07:00 +00:00
Andi Gutmans 28f9dc6e56 - Got rid of the C++ comments. 1999-08-10 15:43:32 +00:00
Stig Bakken 50f0a1b5d8 Makefile.in should not be added to CVS 1999-08-10 15:23:00 +00:00
Thies C. Arntzen 269785f95e starting to clean up 1999-08-10 14:33:59 +00:00
Thies C. Arntzen 63931ff4e8 you can now override the CFLAGS while doing make - eg:
make CFLAGS="-g"
1999-08-10 09:16:19 +00:00
Mark Musone 0076374125 more ports 1999-08-09 22:02:42 +00:00
Mark Musone f0552d929f ports to php4 1999-08-09 21:39:29 +00:00
Mark Musone c356371437 more moudle stuff 1999-08-09 21:34:52 +00:00
Mark Musone fdc253e99d added icap files from php3 sources 1999-08-09 21:22:11 +00:00
Egon Schmid 8588b58a5e More typos. 1999-08-09 20:52:58 +00:00
Egon Schmid 17bd995568 I missed that also. 1999-08-09 20:18:00 +00:00
Egon Schmid d8ad991022 Another typo. 1999-08-09 20:06:15 +00:00
Zeev Suraski 4bfcb29c46 that too 1999-08-09 18:33:22 +00:00
Andi Gutmans c791d60ad9 Go beta 2 (final) 1999-08-09 18:29:40 +00:00
Andi Gutmans 3516ee485a Fix HTTP/ header handling 1999-08-09 17:40:28 +00:00
Andi Gutmans 11781bdaa8 - Thies's crash fix. 1999-08-09 16:39:13 +00:00
Andreas Karajannis da536e8a32 Fixed odbc_fetch_into, added prototype return values.
Pconnects are not working
1999-08-09 16:35:47 +00:00
Thies C. Arntzen 5d2206d3af fixed sysv_shm* 1999-08-09 15:03:09 +00:00
Uwe Steinmann 3d8bd038d2 add changelog entries which I forget a couple of days ago 1999-08-09 08:39:28 +00:00
Philippe Verdy 26b123b7f9 solve infinite recursion error when including <signal.h> 1999-08-08 17:42:12 +00:00
Andreas Karajannis daa7982110 First shot at odbc for PHP4
Problems with LONGs to be investigated
1999-08-08 16:26:26 +00:00
Thies C. Arntzen 78f8d04e63 fix for #1995 (this module needs some more work.) 1999-08-08 11:37:50 +00:00
Zeev Suraski 720d32f581 Fix a few leaks 1999-08-07 23:04:01 +00:00
Danny Heijl 7ceaa82d30 More zend-izing. 1999-08-07 20:32:54 +00:00
Zeev Suraski 1e6c159422 Built-in phpinfo() links are now turned off by default. They can be
turned on using the allow_builtin_links INI directive
1999-08-07 18:21:35 +00:00
Zeev Suraski 9b09f412bf - Changed phpinfo() to list modules that have no info function 1999-08-07 17:52:11 +00:00
Andrey Hristov a7d6450ea1 *** empty log message *** 1999-08-07 16:44:32 +00:00
Andrey Hristov fd87bb3321 Modified array_walk() function so that the userland callback is passed
a key and possible user data in addition to the value.  It's still backward
compatible with one argument version.
1999-08-07 16:43:25 +00:00
Zeev Suraski 1701a9e22f Fix for bug #1980 1999-08-07 16:32:50 +00:00
Zeev Suraski 9f2e9c5140 Fix for bug #1754 1999-08-07 16:02:48 +00:00
Philippe Verdy 6c40fa15b6 unreferenced variable warning 1999-08-07 15:58:51 +00:00
Stefan Roehrich 4f3f4699ea Corrected spelling. 1999-08-07 15:50:26 +00:00
Zeev Suraski 125300b563 Fix&improve conversion scripts 1999-08-07 15:31:57 +00:00
Zeev Suraski 0487650536 Fix a bug in call_user_func_ex() 1999-08-06 21:43:49 +00:00
Zeev Suraski 6393ab1486 Now that's an annoying bug. 1999-08-06 16:54:32 +00:00
Zeev Suraski 53aea140df bump up the version number 1999-08-06 15:55:34 +00:00
Zeev Suraski edabed5604 count/sizeof had their arguments setup wrong (messup between Beta 1 and 2) 1999-08-06 15:34:51 +00:00
Zeev Suraski 37d7d08482 - Improved register_shutdown_function() - you may now supply arguments that
will be passed to the shutdown function
- Improved call_user_func() and call_user_method() - they now support passing
  arguments by reference
- Fixed usort() and uksort()
1999-08-06 15:25:11 +00:00
Zeev Suraski f95edc016b Introduce call_user_func_ex() 1999-08-06 15:24:10 +00:00
Zeev Suraski 65ee58da41 *** empty log message *** 1999-08-06 13:41:27 +00:00
Zeev Suraski 4f2dd59e24 *** empty log message *** 1999-08-06 11:12:08 +00:00
Uwe Steinmann 7ef3076a56 Made Hypwerwave module threat safe 1999-08-06 10:42:00 +00:00
Thies C. Arntzen 4b8a100ec9 fix for #1947 1999-08-06 08:56:15 +00:00
Uwe Steinmann 104de20298 Fdf module should now be up to date 1999-08-06 06:52:06 +00:00
Uwe Steinmann 96ab2781ab Order of freeing memory cause segm fault since efree seems to wipe
out the memory.
1999-08-06 06:39:55 +00:00
Uwe Steinmann 6b5f0dde77 renamed file 1999-08-05 19:28:07 +00:00
Uwe Steinmann f81c6b18f4 zend_hash_update() seems to be a bit different form php3_hash_update 1999-08-05 17:39:35 +00:00
Uwe Steinmann d172a6b581 Huge patch to update the hyperwave and pdflib module.
Only pdflib >2.0 is supported.
None is tested yet. Hyperwave seems to be broken now.
1999-08-05 16:25:10 +00:00
Andrey Hristov 48c3643753 Fixed. 1999-08-05 13:41:17 +00:00
Thies C. Arntzen 2c73cc3b29 hope i haven't missed anything - but we're no longer in the 3.x tree 1999-08-05 07:42:46 +00:00
Zeev Suraski b56086ae33 *** empty log message *** 1999-08-04 22:34:39 +00:00
Zeev Suraski 1a6f498b8c Fix makedist to work with the libtool enabled distribution 1999-08-04 22:33:18 +00:00
Zeev Suraski 7c7fe83615 * Fix bug #1963
* Support large ISAPI server variables
1999-08-04 22:21:29 +00:00
Steven Lawrance 9a1edceb46 Added a note about the SNMP changes 1999-08-04 21:47:56 +00:00
Steven Lawrance f09d8b68ab Fixed a little boo-boo I made during the PHP3->PHP4 conversion. 1999-08-04 21:12:57 +00:00
Steven Lawrance 2aa4138668 Updated the files so that they have all the functionality of
PHP 3.0.12.  These include snmpwalkoid, snmp_get_quick_print, snmp_set_quick_print, and snmpset.
1999-08-04 20:56:33 +00:00
Mike Gerdts 1570c5b30e Fix bug #1949: -rdynamic not handled properly with Sun's C compiler 1999-08-03 20:56:13 +00:00
Rasmus Lerdorf f2fe56ff69 [s]printf fix for bug #1952
(note, [s]printf doesn't work in PHP4 yet)
1999-08-03 20:08:33 +00:00
Andi Gutmans bbe27ffae9 - Initialize extended value's and put the fetch_type in it's own variable
name.
1999-08-03 18:54:49 +00:00
Mike Gerdts ecc1aa80e7 Last character of file not a newline, causing problems with Sun's C compiler 1999-08-03 16:49:33 +00:00
Mike Gerdts a36fa329a2 file did not end with a newline, causing problems for Sun's C compiler 1999-08-03 15:27:19 +00:00
Zeev Suraski 1207465e59 This should sort the buildconf bug... 1999-08-02 21:43:37 +00:00
Stefan Roehrich 5d10addd01 Fix for Redhat libc 2.1 and dynamic loading in zlib module.
Adapted zlib module to new PHP_Mxxx macros.
1999-08-02 21:12:16 +00:00
Zeev Suraski dcf9114329 AIX needs this include... 1999-08-02 19:59:04 +00:00
Zeev Suraski 30569aac45 Go Beta 2 1999-08-02 19:20:54 +00:00
Zeev Suraski 3cb1eb0471 Removed '3' from key functions in PHP (maintained compatibility through
php3_compat.h)
1999-08-02 19:17:14 +00:00
Andi Gutmans 07e0885519 Make set_compiled_filename() return a pointer to the allocated file name 1999-08-02 18:40:10 +00:00
Andrey Hristov 42c586b97c Fix function declarations. 1999-08-02 17:28:32 +00:00
Andrey Hristov 33d27f5bfe More symbol work. 1999-08-02 16:06:13 +00:00
Andrey Hristov 05585132ca More symbol work. 1999-08-02 15:02:52 +00:00
Andrey Hristov 98037c425d Updated proto 1999-08-02 14:31:41 +00:00
Egon Schmid b55a6c9185 Another forgotten prototype. Andrey, why is preg_grep in PHP3 missing? 1999-08-01 18:18:40 +00:00
Andi Gutmans 91ec4763fd Support resource type in gettype() 1999-08-01 17:56:09 +00:00
Zeev Suraski e2f17b298c Fix bug #1872 1999-08-01 00:33:03 +00:00
Zeev Suraski 7297f5196e Final IMAP fixes 1999-08-01 00:25:58 +00:00
Zeev Suraski 2dda8d7f97 More IMAP fixes 1999-07-31 20:21:07 +00:00
Zeev Suraski 2639ab7d03 Fix another compile warning 1999-07-31 19:53:02 +00:00
Zeev Suraski 41cf3b96db That should fix bug #1903 1999-07-31 19:23:22 +00:00
Zeev Suraski 698459ea93 Fix problem with include/require of URLs (bug #1832) 1999-07-31 19:06:36 +00:00
Zeev Suraski afeb7704c9 Fix problem with include/require of URLs 1999-07-31 18:57:41 +00:00
Zeev Suraski 01c2701a0f These aren't necessary 1999-07-31 18:48:47 +00:00
Zeev Suraski eb3d12c6dd Fix bug #1914 1999-07-31 16:20:06 +00:00
Zeev Suraski 338405d343 Declaration fix 1999-07-31 10:38:33 +00:00
Zeev Suraski ba290e05a8 Ok, that should be a good start. Can somebody verify that this actually compiles,
and perhaps check if it runs?
1999-07-30 23:36:20 +00:00
Zeev Suraski 6aefb8bae3 Early steps towards making the IMAP module PHP 4.0 compatible
(and readable - indent people, INDENT)
1999-07-30 23:14:01 +00:00
Zeev Suraski 3ee8c8f0da This should fix the implode() problem 1999-07-30 22:17:51 +00:00
Zeev Suraski 620d013499 Support symbols in any symbol table, not just the active one 1999-07-30 14:17:08 +00:00
Andrey Hristov e1a84e442e Fix for bug #1907. 1999-07-30 13:17:29 +00:00
Andi Gutmans 447eb3b031 - Damn that's more like it. 1999-07-30 12:27:04 +00:00
Andi Gutmans 2c32cc81dd - Cut&paste crap 1999-07-30 12:23:12 +00:00
Andi Gutmans e9e7bc6db3 - Add ptr_stack_n_{push,pop} in order to speed up function calls a bit.
There seems to be no reason for stack->top in the ptr_stack except for
  when realloc()'in the stack. I think I'll remove it.
1999-07-30 11:55:53 +00:00
Zeev Suraski 48ffdd79f7 * Setting variables in the global scope wasn't handling is_ref's properly 1999-07-30 02:49:12 +00:00
Andi Gutmans 739132e58d - Fixed a leak when doing inheritance. The parent class name wasn't being freed.
- Fixed a stack leak. Functions that had late argument binding were set up as
  INIT_FCALL_BY_NAME but were using DO_FCALL and not the corresponding
  DO_FCALL_BY_NAME.
1999-07-29 12:24:58 +00:00
Andi Gutmans e3246872e3 -Tiny fix 1999-07-29 04:03:03 +00:00
Andi Gutmans 7d0715d53d - Added function documentation prototypes. Thanks to Egon Schmid for
straightening me out :)
1999-07-29 03:48:29 +00:00
Andi Gutmans 741ca16711 - Fixed various inheritance problems & Andrey's leak 1999-07-28 17:59:55 +00:00
Andi Gutmans a7af382874 - Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name") 1999-07-28 17:58:38 +00:00
Andrey Hristov 5aa3eff94f Fix link functions problem. 1999-07-28 13:59:35 +00:00
Danny Heijl d69ec49dc6 Make it compile again 1999-07-28 11:26:58 +00:00
Philippe Verdy e1b5df4b55 Commited changes in php3 function/soundex 1.32 1999-07-28 07:04:26 +00:00
Zeev Suraski fc478e5935 License update 1999-07-27 21:01:41 +00:00
Zeev Suraski 879bfc7a34 Inherit parent's constructor 1999-07-27 20:34:31 +00:00
Zeev Suraski d49b53b5e1 *** empty log message *** 1999-07-27 20:33:42 +00:00
Zeev Suraski c4bc4871ee Fix runtime inheritence (child functions/members should have higher precedence) 1999-07-27 20:14:58 +00:00
Andrey Hristov 07d691174b Symbol work. 1999-07-27 19:44:46 +00:00
Andi Gutmans bb8046c4a9 - Update Changelog 1999-07-27 18:38:01 +00:00
Andi Gutmans 348b2f0730 - Add missing lock 1999-07-27 18:35:22 +00:00
Andi Gutmans 71ffa09f41 - strttotime is compiled in on win32 again. 1999-07-27 17:30:45 +00:00
Andi Gutmans 88322d2ea0 - Fix up the new operator a bit more. 1999-07-27 17:30:16 +00:00
Andrey Hristov a99ccfc6ef Oops. 1999-07-27 17:17:05 +00:00
Andrey Hristov c6840056a9 More symbol work. 1999-07-27 17:09:35 +00:00
Andrey Hristov 15d87d2452 check for nKeyLength not arKey 1999-07-27 16:26:30 +00:00
Andrey Hristov 6b79bbe842 *** empty log message *** 1999-07-27 16:19:10 +00:00
Andrey Hristov cd0dd562f0 Fix for bug #1887. 1999-07-27 16:17:58 +00:00
Andrey Hristov ad671669ce Fix for bug #1891 1999-07-27 13:40:54 +00:00
Stig Bakken 55b31d5103 forgot to mention the password 1999-07-27 13:10:15 +00:00
Stig Bakken 9bee15a080 spoonfeed 1999-07-27 13:09:23 +00:00
Danny Heijl 3bea592273 >... If you can, please update your module to use these macros.
I could, so I did.
1999-07-27 11:29:36 +00:00
Zeev Suraski 9d0d2e5a69 Set reference count and is_ref values for new objects 1999-07-27 00:14:34 +00:00
Zeev Suraski 09628fd51e - Fixed a memory leak when using assignment-op operators with lvalue of type
string (or array/object)
1999-07-26 21:56:45 +00:00
Zeev Suraski 4215a17639 Fix bug #1867 1999-07-26 21:55:51 +00:00
Zeev Suraski 075146773f *** empty log message *** 1999-07-26 21:31:40 +00:00
Zeev Suraski 41308d4b43 Fix a bug in inheritence from classes defined in include files, that are
inherited from require()'d files
1999-07-26 21:18:35 +00:00
Zeev Suraski 980c803cd7 Fix bug #1851 1999-07-26 21:17:05 +00:00
Andrey Hristov 1b2c932cc2 More symbol work.
I've defined a few macros to help with module/request init/startup function definitions.
Basically:

PHP_MINIT_FUNCTION(module)
PHP_MSHUTDOWN_FUNCTION(module)
PHP_RINIT_FUNCTION(module)
PHP_RSHUTDOWN_FUNCTION(module)
PHP_MINFO_FUNCTION(module)

These will expand to proper function prototypes.

Now to specify these in the module entry, use:

PHP_MINIT(module)
PHP_MSHUTDOWN(module)
PHP_RINIT(module)
PHP_RSHUTDOWN(module)
PHP_MINFO(module)

I've updated all modules in ext/standard and everything from ext/apache to ext/db.
If you can, please update your module to use these macros.
1999-07-26 20:09:08 +00:00
Andi Gutmans 7af5579e3f - Oops I erased this by mistake 1999-07-26 19:35:57 +00:00
Andi Gutmans 7d77a63342 - Should be a complete fix now. This break away code should maybe be made
somewhat generic
1999-07-26 19:32:13 +00:00
Andi Gutmans fe0fbdc5b6 - Temporary fix for "this". Have to fix it tomorrow. 1999-07-26 19:24:54 +00:00
Andi Gutmans 221c80d26d - Fix compile error. Weird that Visual didn't catch this one. 1999-07-26 18:56:54 +00:00
Andi Gutmans 8f51f72dc6 - Fix the new operator incompatibility.
- I commented PHP_FUNCTION(strtotime) in datetime.c because it stopped
  win32 from compiling. This needs to be fixed!!!
- Check out libzend to compile the tree now.
1999-07-26 16:57:06 +00:00
Stig Bakken bc781c94ed "gd", not "-lgd" 1999-07-25 15:06:49 +00:00
Stig Bakken c901d4c528 use AC_ADD_ macros 1999-07-25 14:46:33 +00:00
Stig Bakken ac7768adbf final php3.ini -> php.ini renaming? 1999-07-25 12:57:50 +00:00
Andrey Hristov 736f4831a5 A bunch of grunt work updating function entries and declarations. 1999-07-24 22:16:54 +00:00
Sascha Schumann f6f0f285cc overlooked them 1999-07-24 21:40:37 +00:00
Andrey Hristov 97c496fc9d Remove buildconf.stamp on make distclean 1999-07-24 21:19:54 +00:00
Zeev Suraski fff675c448 Congrats Andrey 1999-07-24 20:36:31 +00:00
Stig Bakken 46783929a3 more Solaris fun 1999-07-24 19:10:17 +00:00
Stig Bakken 7c2f1384d4 added workaround for Solaris PIC weirdness.
added RPM spec file for a future "official" RPM, work-in-progress
1999-07-24 19:02:38 +00:00
Stig Bakken b81789eb1e temporary icon for RPMs until Colin gets back and can make us a spiffy new one 1999-07-24 19:00:06 +00:00
Zeev Suraski 68e32f6ac3 * Make Win32 build work again
* Make error_reporting value prior to the standard initialization be
  set so that errors show up
1999-07-24 16:52:00 +00:00
Stig Bakken 24eb90c524 Solaris 7 fix 1999-07-24 14:54:24 +00:00
Zeev Suraski ae64b9096e *** empty log message *** 1999-07-24 14:40:08 +00:00
Zeev Suraski 0cdb7d6a29 Fix that memory leak... nested function issue remains 1999-07-24 14:38:05 +00:00
Zeev Suraski 2b2bda778e * Fix a warning
* Update ChangeLog
1999-07-24 14:36:48 +00:00
Danny Heijl 4199c6d6a0 Get rid of most compiler warnings. 1999-07-24 14:28:29 +00:00
Zeev Suraski 9c754da0fc Fix RETURN & SWITCH memory leak issue 1999-07-24 11:43:21 +00:00
Zeev Suraski 1b6fae101a Thoroughly fix the SWITCH problem. No RETURN handling yet. 1999-07-24 11:24:19 +00:00
Rasmus Lerdorf b0c60bd249 Changelog 1999-07-24 02:44:53 +00:00
Rasmus Lerdorf d9f6ea2fc3 Fix broken build 1999-07-24 02:43:22 +00:00
Rasmus Lerdorf 8de073782c Bring rand.c up to date 1999-07-24 02:30:37 +00:00
Sascha Schumann cd8d7c7c8a fix for missing include path in CFLAGS 1999-07-24 00:56:56 +00:00
Sascha Schumann cb2ab20a11 Bourne Shell does not have -nt. 1999-07-24 00:46:47 +00:00
Andrey Hristov 974f278257 Added function entry for similar_text(). 1999-07-23 22:47:24 +00:00
Andrey Hristov 244cc30c14 Added function entry for strip_tags. 1999-07-23 22:35:14 +00:00
Andrey Hristov a30af3e355 Ignore generated file. 1999-07-23 21:24:53 +00:00
Andrey Hristov ecc51ad6de *** empty log message *** 1999-07-23 21:24:30 +00:00
Andrey Hristov 1d3b055eba Ignore parsedate.c 1999-07-23 21:22:20 +00:00
Andrey Hristov a100c51f51 Fixed a bug in WDDX that occured when a number was passed in instead
of a variable name.
1999-07-23 21:21:33 +00:00
Stig Bakken e4252b8092 generated and not required by windows 1999-07-23 20:47:59 +00:00
Stig Bakken 830be36b56 required for the Windows build, re-adding 1999-07-23 20:47:17 +00:00
Andrey Hristov 58cb2362c6 *** empty log message *** 1999-07-23 19:52:18 +00:00
Andrey Hristov 9dd45ec800 Ported strtotime() function. 1999-07-23 19:51:27 +00:00
Sascha Schumann 270be258d3 Improve speed on subsequent runs of buildconf 1999-07-23 19:37:59 +00:00
Andrey Hristov 63a48afcd5 Fix for compatibility. 1999-07-23 19:22:28 +00:00
Zeev Suraski 028cf1a368 Fix bug #1812 1999-07-23 18:41:58 +00:00
Zeev Suraski 76bef75836 Fix bug #1807 (requires libzend update) 1999-07-23 16:03:18 +00:00
Zeev Suraski 84aa8cce64 * Add an API macro users can use to ensure an array member can be modifed
before they modify it.
* Fix a bug and remove redundant code in convert_to_long() (booleans and
  resources weren't changing their types
1999-07-23 16:02:51 +00:00
Sascha Schumann 33f30aee64 gdttf update 1999-07-23 15:56:47 +00:00
Stig Bakken 2c2e4c463f run libtoolize during buildconf since we depend on libtool anyway 1999-07-23 15:53:50 +00:00
Stig Bakken 8bf949b5d6 generated file 1999-07-23 15:32:07 +00:00
Stig Bakken beceb905cd in case ltconfig isn't checked out executable 1999-07-23 15:29:57 +00:00
Stig Bakken 083b2df569 good boy 1999-07-23 15:22:36 +00:00
Stig Bakken 6d0fa9bdae updated the docstring for --with-xml 1999-07-23 15:20:48 +00:00
Zeev Suraski 00238ad1ba Added check for freetype.h 1999-07-23 15:18:37 +00:00
Stig Bakken b291b0902d small fix to libtool check 1999-07-23 15:13:22 +00:00
Stig Bakken 6c856de82d require libtool to be installed as well 1999-07-23 15:08:54 +00:00
Andi Gutmans 6cdea551cc - Make Win32 compile again. 1999-07-23 14:14:42 +00:00
Andrey Hristov 64ed8f7141 Changeloggin' 1999-07-23 13:47:57 +00:00
Danny Heijl 78d420e9fe ChangeLog 1999-07-23 12:26:26 +00:00
Danny Heijl f110b97975 New ini-stuff incorporated. Porting to PHP4 and ZTS hopefully complete. 1999-07-23 09:34:14 +00:00
Sascha Schumann c927593c6d ChangeLog 1999-07-23 00:04:24 +00:00
Zeev Suraski d3e8858413 Please add in any changes/bug fixes you've made - we need to keep a details ChangeLog... 1999-07-22 23:54:54 +00:00
Zeev Suraski 5bae591f88 New constants 1999-07-22 22:17:49 +00:00
Zeev Suraski de1acfe33a Time to remove the PHP 3.0 ChangeLog 1999-07-22 21:49:53 +00:00
Sascha Schumann 3ccb07f34b add the HPUX ANSI detection from php3 1999-07-22 21:11:09 +00:00
Stig Bakken 84656f113e add checks for autoconf, automake and whether libzend/TSRM is around 1999-07-22 20:21:07 +00:00
Stig S. Bakken f5bfd16b0b identify ourselves 1999-07-22 20:20:11 +00:00
Sascha Schumann c640f3d8c8 Implement additional heuristic for session id search. Now looks into
REQUEST_URI as well.
1999-07-22 17:55:13 +00:00
Stig Bakken 7ae27b5bcd temporary hack-fix 1999-07-22 15:55:13 +00:00
Andrey Hristov 64dae03eea -Ported all remaining date() options
-Made array_walk() work somewhat, but it's not
 possible to change array values from inside the
 walk function yet
1999-07-22 15:15:41 +00:00
Andrey Hristov a5a07063d2 *** empty log message *** 1999-07-22 14:22:32 +00:00
Danny Heijl 925d48dae6 Blobs now working too. 1999-07-22 09:58:02 +00:00
Danny Heijl dc7cffcd43 Blobs don't work, hash problems. 1999-07-22 07:31:27 +00:00
Stig Bakken d9f52fe0a7 First cut at standard way of making dynamically loadable extensions on UNIX.
Examples on how to test:

 ./configure --with-xml              static
 ./configure --with-xml=/opt         static
 ./configure --with-xml=shared       shared
 ./configure --with-xml=shared,/opt  shared

The difference between these two is that when the extension is shared, it
is not merged into libphpext.a.  The shared extension is currently always
built.  I can't find a way to do just one or the other with automake/libtool,
if someone has a clever idea, please come forward. :-)

"make install" installs the .so (as well as a lot of other cruft) in
$prefix/lib/php.
1999-07-21 21:56:25 +00:00
Zeev Suraski 57323801f8 Fixed the Apache cookie problem (untested) 1999-07-21 20:31:07 +00:00
Andrey Hristov e6fadabf43 Fix for bug #1806 1999-07-21 19:55:24 +00:00
Andrey Hristov 56402ec375 *** empty log message *** 1999-07-21 19:47:40 +00:00
Danny Heijl f857a77e2f Informix extension now works but php_ini stuff still needs rewriting. 1999-07-21 18:23:13 +00:00
Sascha Schumann 9a910ed353 sync with 1.133 1999-07-21 16:12:13 +00:00
Sascha Schumann 7ac7537776 since we all seem to use different tabwidths, reformat this with :set tw=4 1999-07-21 15:47:41 +00:00
Sascha Schumann 0de0ad6348 update 1999-07-21 15:42:18 +00:00
Sascha Schumann f78caff762 merge in change from php3 1999-07-21 15:39:28 +00:00
Sascha Schumann b33d0fd7e7 initial import of DBA 1999-07-21 15:12:32 +00:00
Sascha Schumann 3843821d11 the ; is superflicious 1999-07-21 15:12:22 +00:00
Andrey Hristov adbf932744 *** empty log message *** 1999-07-21 15:10:04 +00:00
Stig Bakken f9b0f60098 that's better 1999-07-21 14:49:17 +00:00
Stig Bakken 57f0f15b9f Debian fixes 1999-07-21 14:43:12 +00:00
Stig Bakken 968d6d9f8d change version number to 4.0b2-dev 1999-07-21 14:42:22 +00:00
Stig Bakken 2ab934bfc2 fix to reiterate that one should _always_ use braces around if/else/for/while 1999-07-21 14:27:05 +00:00
Andrey Hristov 8c63ef0605 It really does work. 1999-07-21 14:19:49 +00:00
Stig S. Bakken 4c285ecdf5 ignore more files 1999-07-21 13:31:52 +00:00
Danny Heijl 575d8541db Started php4/ZTS port of Informix driver. 1999-07-21 12:48:35 +00:00
Sascha Schumann 58bb4adae1 use the same version as in php3 1999-07-21 09:31:48 +00:00
Sascha Schumann 63f7648fdc use reverse lookup array, submitted by bfranklin@dct.com, #1755 1999-07-21 09:02:05 +00:00
Sascha Schumann a7e3a952e7 fix for #1748 1999-07-21 08:55:20 +00:00
Sascha Schumann dbe9e99213 disable broken sprintf test 1999-07-21 08:37:59 +00:00
Sascha Schumann 76cf93994c defaults to empty string 1999-07-21 08:26:51 +00:00
Andrey Hristov 6b82192bf7 Added locale support. 1999-07-20 20:57:04 +00:00
Mike Gerdts 72f675be50 exec() can now properly handle lines longer than (EXEC_INPUT_BUF-2) bytes.
Lines being returned via the array that that contain only "\n" now are
trimmed down to "" to be consistent with exec's whitespace trimming
behavior for all other lines.
1999-07-20 20:19:58 +00:00
Andrey Hristov 3ff606a934 Added 'n' option to date(). 1999-07-20 19:11:32 +00:00
Andi Gutmans acb9cae36d - Include alloca.h when need and available. 1999-07-20 18:26:56 +00:00
Andrey Hristov 2d1b6f0801 Added headers_sent() function 1999-07-20 18:03:27 +00:00
Andrey Hristov f8fdee1c66 Fix for bug #1750. 1999-07-20 16:59:30 +00:00
Sascha Schumann 07e30106b9 get rid of --with-shared-apache
it's currently broken and redundant (use APXS instead)
1999-07-20 16:54:05 +00:00
Andi Gutmans bf8c6dbd99 - Get rid of C++ comments 1999-07-20 13:01:30 +00:00
James Gingerich e0e331967f Remove a bunch of old junk. 1999-07-20 01:15:34 +00:00
Egon Schmid ea28db8625 The last forgotten prototypes I know. 1999-07-19 20:37:17 +00:00
Andrey Hristov 40de81a5d9 Updated status 1999-07-19 20:27:49 +00:00
Andrey Hristov a04521b4f2 Don't forget .cvsignore 1999-07-19 20:24:21 +00:00
Andrey Hristov ced8e51328 Ported WDDX module. 1999-07-19 20:24:03 +00:00
Egon Schmid b64eaf737b It's in PHP 3 and 4. 1999-07-19 20:09:05 +00:00
Zeev Suraski 8d1de13aef 0.91 update 1999-07-19 20:02:12 +00:00
Andi Gutmans e78fc33c35 * Fix Zend version
* Fix a method call bug
1999-07-19 19:58:44 +00:00
Egon Schmid 5fdd45695b Test, will document this soon. 1999-07-19 19:10:13 +00:00
Andrey Hristov 2bc33cbba1 Updating cvsignore 1999-07-19 18:59:05 +00:00
Andrey Hristov 851ee7b598 Moving dlist stuff into core. 1999-07-19 18:58:44 +00:00
Zeev Suraski c1853b5628 *** empty log message *** 1999-07-19 18:37:42 +00:00
Zeev Suraski e19abb96dd *** empty log message *** 1999-07-19 17:58:51 +00:00
Andi Gutmans 8a9d0fa9eb License update 1999-07-19 17:52:38 +00:00
Andi Gutmans 353a2d38d8 Make error codes PHP 3.0 compatible 1999-07-19 16:17:40 +00:00
Andi Gutmans a064237fc0 Fix Win32 compilation 1999-07-19 16:08:43 +00:00
Andrey Hristov d1b1e3513f Kill compiler warnings. 1999-07-19 15:07:17 +00:00
Danny Heijl 951f65f6ed license change 1999-07-19 14:24:09 +00:00
Sascha Schumann afb16a5818 update 1999-07-19 14:07:10 +00:00
Andrey Hristov 18579a5f64 More credits. 1999-07-19 13:35:13 +00:00
Andi Gutmans e3daad2d67 - Should fix the memory leak when returning from the main scope. 1999-07-18 17:33:51 +00:00
Sascha Schumann 99a2aa0f80 allow access to std{in,out,err} by using the php domain 1999-07-18 15:53:50 +00:00
Sascha Schumann 3b7d588f40 more to do 1999-07-18 01:20:38 +00:00
Sascha Schumann e5cfc70f7d add session config to php.ini and adapt the naming scheme for it 1999-07-18 01:00:42 +00:00
Andrey Hristov 715dc6b23a Update credits a bit.
"Overall Work" line should probably be extended.
1999-07-17 20:38:14 +00:00
Andrey Hristov 3335c8ea0d -Kill compile warnings in apache.c
-Make preg_grep() work with copies of array entries
1999-07-17 20:03:10 +00:00
Andrey Hristov 4518351648 Proto change 1999-07-17 19:23:32 +00:00
Zeev Suraski 5a3e983fa4 *** empty log message *** 1999-07-17 19:22:27 +00:00
Zeev Suraski 614b4b781e I was sure I committed these already. Weird 1999-07-17 19:17:42 +00:00
Zeev Suraski fbe571a43a One more necessary .dsp update 1999-07-17 17:35:44 +00:00
Zeev Suraski cbcf7c66bc *** empty log message *** 1999-07-17 17:33:42 +00:00
Zeev Suraski bc29ceef1b * Turn on debug by default
* Remove CREDITS file, point to web page instead
1999-07-17 16:43:11 +00:00
Zeev Suraski 101e1f4c0f Debug on by default 1999-07-17 13:24:53 +00:00
Zeev Suraski dd14884877 Update DSPs 1999-07-17 13:05:43 +00:00
Sascha Schumann fc268e1c7e void some warnings 1999-07-17 12:56:38 +00:00
Sascha Schumann 3736b9b7ce use optional copy 1999-07-17 12:28:17 +00:00
Sascha Schumann 8a7784d462 make copy optional 1999-07-17 12:27:54 +00:00
Zeev Suraski 7af3ce63a6 Oki doki 1999-07-17 11:59:37 +00:00
Zeev Suraski 9bb36e9cfe Some work on makedist 1999-07-17 11:22:17 +00:00
Zeev Suraski a6dc6b88d2 Handle BCMath
Add a license pointer
1999-07-17 10:59:22 +00:00
Zeev Suraski 3b142d5a3d We'll have to live without these files somehow. 1999-07-17 10:34:01 +00:00
Zeev Suraski 51aa31b671 Dummies 1999-07-17 10:15:42 +00:00
Zeev Suraski 35b3b03fe4 We need to disable bcmath by default 1999-07-17 10:14:04 +00:00
Zeev Suraski af58c35f5c Remove MEMORY_LIMIT from PHP, it's a Zend issue... 1999-07-17 00:05:09 +00:00
Zeev Suraski 8a15917de1 Get the Sybase modules uptodate 1999-07-16 22:00:53 +00:00
Zeev Suraski a316ff791c *** empty log message *** 1999-07-16 21:53:17 +00:00
Andrey Hristov 459ed2b1ad A little change in how array_splice/array_slice handle length parameter.
Makes it compatible with Perl.
1999-07-16 20:47:20 +00:00
Andrey Hristov 7201cdac96 Updated the functionality of array_splice. 1999-07-16 20:08:06 +00:00
Sascha Schumann 538e1cd230 the regex check relies on a previously set APXS variable,
so it needs to be after the apxs check
1999-07-16 19:28:33 +00:00
Sascha Schumann bd07cce770 merge fix 1999-07-16 19:07:13 +00:00
Sascha Schumann 36cf6cf22a unnecessary, breaks the build 1999-07-16 18:23:38 +00:00
Sascha Schumann 68b0f0b418 This is so ugly, I hate myself for committing it 1999-07-16 18:05:24 +00:00
Zeev Suraski 1671424a5f Get the LDAP module uptodate 1999-07-16 18:01:55 +00:00
Sascha Schumann 064a4ea88a avoid nameclash 1999-07-16 18:00:06 +00:00
Sascha Schumann e20424e45f fix detection 1999-07-16 17:44:11 +00:00
Zeev Suraski a6a09f7e98 *** empty log message *** 1999-07-16 17:27:42 +00:00
Zeev Suraski 916f2f2927 *** empty log message *** 1999-07-16 17:26:16 +00:00
Zeev Suraski 58a6d48014 Get postgresql module uptodate 1999-07-16 17:19:11 +00:00
Zeev Suraski dc09865f4a Oops #2 1999-07-16 17:16:31 +00:00
Zeev Suraski f17bbb9014 Oops 1999-07-16 17:10:02 +00:00
Zeev Suraski 4e6c2b468c * Get the mSQL module up to date 1999-07-16 17:06:48 +00:00
Zeev Suraski 2c91f1d91b Minor fix 1999-07-16 16:50:49 +00:00
Zeev Suraski d66fad5fcd Ignore T_PHP_TRACK_VARS in the parser (handled in the scanner) 1999-07-16 16:42:49 +00:00
Zeev Suraski e7e2af5d78 Fix TS version 1999-07-16 16:09:01 +00:00
Zeev Suraski b5b1117760 License update 1999-07-16 14:58:16 +00:00
Zeev Suraski c5724cbd14 License update 1999-07-16 13:13:16 +00:00
Sascha Schumann 42736999bc define sid to "", if we are in cookie mode 1999-07-15 21:14:46 +00:00
Andi Gutmans 91d7ba7610 Change true/false back to 1/"" 1999-07-15 20:38:00 +00:00
Andi Gutmans da648c0fb1 Fix a lock issue 1999-07-15 19:59:18 +00:00
Sascha Schumann 2a39219142 we don't need php_sid 1999-07-15 19:51:13 +00:00
Sascha Schumann 30c131c8ae that should be included 1st 1999-07-15 19:43:26 +00:00
Sascha Schumann 4ea29a808d define SID appropiately 1999-07-15 19:37:35 +00:00
Andi Gutmans f5ffc630aa *** empty log message *** 1999-07-15 19:34:26 +00:00
Sascha Schumann 68de8a2842 that should be included 1st 1999-07-15 19:31:39 +00:00
Andi Gutmans 527a7429bc *** empty log message *** 1999-07-15 19:31:29 +00:00
Andi Gutmans eaebc48e5e More 3->4 changes 1999-07-15 19:28:49 +00:00
Andi Gutmans 1db7f1a910 * PHP 3.0 -> 4.0 changes
* Add php_admin Apache directives
1999-07-15 19:26:25 +00:00
Andi Gutmans 2a43afd2ce Sooner than you think, Sascha :) 1999-07-15 18:33:41 +00:00
Andi Gutmans 5fc8562b5d *** empty log message *** 1999-07-15 17:49:55 +00:00
Andrey Hristov 582f6d032e Added .cvsignore 1999-07-15 14:55:01 +00:00
Rasmus Lerdorf 895cab2838 A useless check 1999-07-15 12:42:46 +00:00
Sascha Schumann 138dd94c8d disable zend_handle_sigsegv 1999-07-15 12:17:34 +00:00
Zeev Suraski b7fe07d8dc php3.ini -> php.ini 1999-07-14 23:34:30 +00:00
Zeev Suraski e883283590 * Update logos
* Move from PreAlpha 1 to Beta 1.
1999-07-14 23:33:00 +00:00
Rasmus Lerdorf 75f62dc415 How did this ever work without this #define ? 1999-07-14 21:49:35 +00:00
Andi Gutmans 762158aa65 Fix thread unsafe constants startup 1999-07-14 19:49:19 +00:00
Rasmus Lerdorf 2beb929311 Remove some useless stuff 1999-07-14 19:21:43 +00:00
Rasmus Lerdorf 0fa438a22a Fix imap build problem 1999-07-14 19:16:59 +00:00
Rasmus Lerdorf 549dfc78e2 Small grammar fix 1999-07-14 17:09:09 +00:00
Andi Gutmans db2594ff13 *** empty log message *** 1999-07-14 16:06:11 +00:00
Andi Gutmans 3e6bce59b3 - Add a bitwise flag to phpinfo()
- Import a draft of the new PHP license
1999-07-14 16:02:10 +00:00
Andi Gutmans fec59d3b4d - License update
- Fix multithreaded constants startup
1999-07-14 16:00:47 +00:00
Rasmus Lerdorf d22cbad17d Fix logic here - the error message was bogus when it couldn't find the
imap lib
1999-07-14 15:22:02 +00:00
Rasmus Lerdorf ce6faf02f6 Woops, this was in the wrong place 1999-07-14 15:15:42 +00:00
Zeev Suraski 05e4d7bb33 change php4_value and php4_flag to php_value and php_flag 1999-07-14 10:26:43 +00:00
Andi Gutmans 078c3ce198 - Fix for boolean convert to number 1999-07-14 09:10:14 +00:00
Thies C. Arntzen f03ad4c7d6 *** empty log message *** 1999-07-13 13:22:15 +00:00
Sascha Schumann 8f29babc8e add some which are always substituted 1999-07-12 20:21:14 +00:00
Rasmus Lerdorf fa7605f289 Tested imap, and had a look at ldap. ldap should be working, but my
ldap server is currently in a box.
1999-07-12 20:20:56 +00:00
Rasmus Lerdorf 2b2b3147de Finish porting aspell - tested and works ok now 1999-07-12 19:18:07 +00:00
Andi Gutmans 4dc22e32b6 - Fixed a purify warning 1999-07-12 18:07:01 +00:00
Sascha Schumann fa764cb027 update 1999-07-12 17:21:49 +00:00
Andrey Hristov be66f224b0 *** empty log message *** 1999-07-12 17:16:14 +00:00
Andrey Hristov c37ceccb54 *** empty log message *** 1999-07-12 17:07:34 +00:00
Andi Gutmans fdce4ae1da *** empty log message *** 1999-07-12 17:04:55 +00:00
Sascha Schumann 81b5402a16 test commit (new format inspired by FreeBSD cvs-all) 1999-07-12 14:19:27 +00:00
Thies C. Arntzen f40a16bac9 destructors should return 1, shouldn't they? 1999-07-12 13:56:29 +00:00
Thies C. Arntzen 9b85ba490e par with 3.0 1999-07-12 13:26:56 +00:00
Thies C. Arntzen d4fb7d9e37 fixed mem-problem 1999-07-12 11:49:32 +00:00
Thies C. Arntzen 5a288ffdc8 small php4 fixes 1999-07-12 10:36:19 +00:00
Sascha Schumann a80609c773 typo 1999-07-11 10:52:14 +00:00
Sascha Schumann f0febf044f merge in some autoconf stuff 1999-07-11 10:51:41 +00:00
Zeev Suraski 3b037ebbe9 Oh, that dumb bug. 1999-07-10 22:50:44 +00:00
Andi Gutmans 44947bf563 Ok, so we do have to lock in there 1999-07-10 18:46:20 +00:00
Andi Gutmans fb7a4b6486 Fix assignments of reference variables 1999-07-10 16:56:56 +00:00
Zeev Suraski dc933fc50b Woops, fix. 1999-07-10 12:44:56 +00:00
Zeev Suraski 909590ba7b Put the garbage in the garbage bin 1999-07-10 11:47:16 +00:00
Zeev Suraski cccd2445ee Get rid of AiCount completely 1999-07-10 11:45:23 +00:00
Zeev Suraski 82563bde60 Final tweaks 1999-07-10 10:55:55 +00:00
Zeev Suraski 03d33b2f88 More locking work 1999-07-10 09:29:02 +00:00
Zeev Suraski 6fcf8aa12c *** empty log message *** 1999-07-09 21:00:24 +00:00
Zeev Suraski 0fadd053fa More stuff 1999-07-09 20:57:29 +00:00
Zeev Suraski c43c235427 Don't touch refcount and EA directly 1999-07-09 20:45:55 +00:00
Zeev Suraski 2a6da7814c Step 4:
Move to a 7-bit counter (not fully implemented yet)
1999-07-09 20:43:59 +00:00
Zeev Suraski 6ec1acbe32 Phase 3:
Use a single bit to mark IS_REF variables
1999-07-09 18:19:48 +00:00
Zeev Suraski 5f62c347c7 Step 2:
Rename is_ref to EA
1999-07-09 17:44:41 +00:00
Zeev Suraski 3a9cb0220c Step 1 in nuking the garbage collector:
- Change the hash destructor to return int
1999-07-09 17:36:12 +00:00
Zeev Suraski 81d901b14d Step 1 in nuking the garbage collector:
- Change the hash destructor to return int
- Don't kill the bucket on hash_destroy if the destructor returns 0
1999-07-09 17:24:47 +00:00
Rasmus Lerdorf db1e0bc820 Add Aspell module 1999-07-09 14:56:33 +00:00
Zeev Suraski cdce334c56 *** empty log message *** 1999-07-09 11:19:38 +00:00
Zeev Suraski cc26d0e609 Send a SIGSEGV instead of exiting, to trigger a core dump 1999-07-09 11:10:19 +00:00
Zeev Suraski 6abe9c34d9 * Support recoverable failure from erealloc()
* Fix the shutdown code on an unrecoverable erealloc() failure
1999-07-09 11:03:56 +00:00
Zeev Suraski 81f5522210 Fix the mess in SIGSEGV handling, hopefully 1999-07-09 07:35:13 +00:00
Andrey Hristov 743935ca8e More cleanup. 1999-07-08 21:56:19 +00:00
Andrey Hristov cef4df1fee Reduce clutter a bit. 1999-07-08 21:42:29 +00:00
Zeev Suraski cb2a2ea9d3 *** empty log message *** 1999-07-08 19:18:42 +00:00
Zeev Suraski 1a33277e3d Avoid sending NULL argument to printf 1999-07-08 17:15:43 +00:00
Zeev Suraski d894cf44d8 Support definition of classes that are derived from classes that are defined in runtime 1999-07-08 16:55:27 +00:00
Thies C. Arntzen ff9407b56b on par with latest php3 1999-07-08 14:12:07 +00:00
Andrey Hristov e88d121be1 Fix a memory leak by not allowing session_start() to be called more than once. 1999-07-07 21:50:33 +00:00
Sascha Schumann fdc1b9262d enable it, until we find a better way 1999-07-06 21:02:07 +00:00
Sascha Schumann da155aae1c add sendmail 1999-07-06 20:29:16 +00:00
Zeev Suraski 5baaa716dc Support PCRE under Win32 1999-07-06 19:49:48 +00:00
Zeev Suraski 8ee9fd5768 avoid two copies of pcre.c in the repository 1999-07-06 19:24:13 +00:00
Sascha Schumann 52308cd368 make Solaris gcc happy 1999-07-05 17:05:38 +00:00
Andrey Hristov 7aa981f5b7 Correct option caching 1999-07-05 15:25:51 +00:00
Sascha Schumann f6164dbf3a use void * instead of long for 64-bit test 1999-07-05 10:51:11 +00:00
Thies C. Arntzen 0e3f5a69f7 ups 1999-07-05 09:33:47 +00:00
Thies C. Arntzen 8788f30c12 fixed mem-leak 1999-07-05 08:49:13 +00:00
Thies C. Arntzen ad0076ee53 ported IPTC fro php3 1999-07-05 07:42:07 +00:00
Thies C. Arntzen e9cb3539ad added RESOURCE-returning 1999-07-05 07:03:44 +00:00
Thies C. Arntzen cab8290b8e up to php3 version
returns resources now!
1999-07-05 06:29:04 +00:00
Thies C. Arntzen eb5c6da5a4 added RETVAL_RESOURCE and RETURN_RESOURCE 1999-07-05 06:26:29 +00:00
Zeev Suraski d189972737 Make convert_to_string() regard false as "" instead of "0" 1999-07-04 23:50:58 +00:00
Thies C. Arntzen 745c5efc37 updated to latest php3 1999-07-04 13:30:13 +00:00
Zeev Suraski dbb24c2e0e *** empty log message *** 1999-07-03 23:43:02 +00:00
Zeev Suraski 6132bc3111 Support x-httpd-php-source 1999-07-03 23:15:10 +00:00
Sascha Schumann 377d7d599d *** empty log message *** 1999-07-03 22:05:56 +00:00
Sascha Schumann 6dd7254b39 remove cvsignore files as well 1999-07-03 19:46:32 +00:00
Sascha Schumann c2b8a4667b don't wipe files for distributions 1999-07-03 19:37:55 +00:00
Sascha Schumann 012e1abb4f 'make dist' builds an easy distributable tarball 1999-07-03 19:35:08 +00:00
Sascha Schumann c56116029d add missing include 1999-07-03 19:08:03 +00:00
Sascha Schumann d6169276dd checking for ints won't work, since they are 32 bit on both platforms 1999-07-03 18:46:10 +00:00
Sascha Schumann 9fbbc53008 ignore this 1999-07-03 18:31:58 +00:00
Sascha Schumann daca96353e would be logical to enable display source mode 1999-07-03 18:13:43 +00:00
Zeev Suraski baa75917c8 Support isset()/empty() for string offsets 1999-07-03 18:03:02 +00:00
Sascha Schumann a010baa18d ar t is a little bit noisy on Rhapsody 1999-07-03 17:44:20 +00:00
Zeev Suraski 063051d6ac Fix a crash 1999-07-03 16:05:58 +00:00
Sascha Schumann 22ba66b7f6 almost no config.m4 substitutes these anymore. 1999-07-03 15:42:28 +00:00
Sascha Schumann 6f3b0f799b work around the Apache problem that it pollutes the namespace 1999-07-03 03:34:47 +00:00
Sascha Schumann 7bbd454143 add usual rhapsody hack 1999-07-03 02:45:46 +00:00
Sascha Schumann e0fff74d41 missing DL_HANDLE broke build 1999-07-03 02:44:11 +00:00
Sascha Schumann e08182156e there must be a better way 1999-07-03 02:36:56 +00:00
Sascha Schumann 8b51ad8157 typo 1999-07-03 02:34:09 +00:00
Sascha Schumann 081da5006e let's start OS X hacking 1999-07-03 01:28:31 +00:00
Sascha Schumann 2f92fc0326 .. 1999-07-02 23:56:02 +00:00
Sascha Schumann 73b9beff19 ... 1999-07-02 23:55:45 +00:00
Sascha Schumann eef062572a . 1999-07-02 23:51:01 +00:00
Sascha Schumann aa485e9161 test commit 1999-07-02 23:32:55 +00:00
Sascha Schumann 72aa9e2e2b test commit 1999-07-02 23:31:25 +00:00
Sascha Schumann 2a44f45cbe workaround for 64-bit platforms 1999-07-02 21:12:03 +00:00
Thies C. Arntzen 45386d8af4 added some refcount stuff 1999-07-02 15:45:52 +00:00
Thies C. Arntzen d00b516f84 losses memory like hell, but seems to work!
3 things (this is a bad hack as of now!):
- xml.c uses _php3_strtoupper
  is #include "../standard/php3_string.h" the right way to get the prototype?

- i've copied php3i_long_pval/php3i_string_pval from the php3 tree into
  xml.c (this is defnetly WRONG, but where do i find those?)

- as php3tls_pval_destructor is not available in zend, i've
  #define php3tls_pval_destructor(a) pval_destructor(a) which is maybe not what we want!
1999-07-02 15:31:02 +00:00
Sascha Schumann c42305c54e fix from php3 1999-07-02 14:37:36 +00:00
Zeev Suraski 9ece796086 define zend_bool 1999-07-02 14:10:57 +00:00
Sascha Schumann 900850497d suppress No such file or directory 1999-07-02 13:59:51 +00:00
Sascha Schumann 03e16899bc someone please try whether the autoconf stuff works
for sybase and sybase-ct - I've neither one.
1999-07-01 15:48:57 +00:00
Sascha Schumann 2d185cc7e2 maybe fix, following Joey's description 1999-07-01 15:42:29 +00:00
Sascha Schumann 973f679df0 --with-zlib should work now 1999-07-01 15:39:58 +00:00
Thies C. Arntzen fe4efa91c3 changed boolean behaviour:
var_dump(
1999-07-01 09:26:05 +00:00
Sascha Schumann 2e690ac4b5 some additional consts 1999-07-01 05:47:06 +00:00
Sascha Schumann 2397e5d419 vpath thingie 1999-07-01 05:45:58 +00:00
Sascha Schumann 1f02914005 implement a simple API in the case someone wants to define his/her own serialization stuff 1999-07-01 05:45:48 +00:00
Zeev Suraski 49d98c5a3f Make require accept any parameter 1999-06-30 17:17:39 +00:00
Zeev Suraski 258d427647 No need for a PSLS_FETCH() if PSLS_D/PSLS_DC are supplied as function arguments 1999-06-29 22:08:07 +00:00
Andrey Hristov 3e5f7a806f *** empty log message *** 1999-06-29 15:40:11 +00:00
Andrey Hristov 88ed2002da Added session expiration. 1999-06-29 15:39:59 +00:00
Thies C. Arntzen d5fc465a67 synced with 3.0.11
ora_bind works!
1999-06-29 15:16:38 +00:00
Zeev Suraski 6a2b28ba51 No need for that either... 1999-06-28 21:42:29 +00:00
Rasmus Lerdorf 335078b4fd Don't break the tree 1999-06-28 18:59:44 +00:00
Andrey Hristov a6aacfd2b6 Added session_is_registered(varname) function. 1999-06-28 15:46:56 +00:00
Andrey Hristov 17f725d21a Ported MYSQL_NUM, MYSQL_ASSOC, and MYSQL_BOTH additions from php3. 1999-06-28 15:08:28 +00:00
Andrey Hristov 26a7fe78f2 oops 1999-06-28 13:46:58 +00:00
Andrey Hristov db400222ff *** empty log message *** 1999-06-28 13:39:52 +00:00
Sascha Schumann 650986c8d1 work around that solaris bug 1999-06-28 13:37:59 +00:00
Sascha Schumann bd031b0422 ugly and working 1999-06-28 03:01:48 +00:00
Sascha Schumann 30e80d1a8c BSD derived tests want -h for symlink test 1999-06-28 02:57:08 +00:00
Sascha Schumann 8ba3889572 port 1999-06-27 21:46:34 +00:00
Sascha Schumann e205a6749d more porting 1999-06-27 21:45:06 +00:00
Sascha Schumann d819da4897 port Rasmus' APXS changes for AIX 1999-06-27 21:36:00 +00:00
Sascha Schumann fa7cba7d5d port over from php3 1999-06-27 21:23:17 +00:00
Sascha Schumann adde17749b lex optimizations 1999-06-27 21:18:43 +00:00
Sascha Schumann 3b36670df1 add dbase_replace_record 1999-06-27 21:15:12 +00:00
Sascha Schumann aa4e00b33c port over autoconf fixes from php3 1999-06-27 21:14:00 +00:00
Zeev Suraski d1169e735e Win32/general patches 1999-06-26 23:21:18 +00:00
Zeev Suraski d4f24f19ad * Get rid of another request_info element (filename)
* CGI through Apache should work now
1999-06-26 19:14:26 +00:00
Zeev Suraski 320541430b *** empty log message *** 1999-06-26 18:01:21 +00:00
Zeev Suraski 36416f1109 Protect against NULL arguments in filename 1999-06-26 12:27:49 +00:00
Zeev Suraski 98b6ddda90 * Make the memory leak reporting code much better with repeats
* Remove useless variables
1999-06-26 11:48:22 +00:00
Sascha Schumann 6ec7163796 add dmalloc 1999-06-26 00:34:36 +00:00
Sascha Schumann f3ef2ff1d0 - APXS link thingie
- functions/ game obsolete. Should make compiling faster on slow machines (hi Kristian :-)
1999-06-25 23:40:26 +00:00
Andrey Hristov d41af4b7eb *** empty log message *** 1999-06-23 15:04:21 +00:00
Thies C. Arntzen 18962f1993 gettype now reports "boolean" correct 1999-06-22 21:37:43 +00:00
Zeev Suraski c471c77c58 Fix Thies's bug report 1999-06-22 20:24:51 +00:00
Andrey Hristov df86725019 Making function accessible. 1999-06-22 19:37:26 +00:00
Andrey Hristov 226f75e0f3 Making the function accessible. 1999-06-22 19:36:52 +00:00
Zeev Suraski acddd0f13c Fix compile-time definition of track_vars default 1999-06-22 19:07:01 +00:00
Zeev Suraski 3eac45ea80 * Fix concatenation of arrays (it was PHP 3.0 style, copying zval's instead
of zval *, and it wasn't using reference counting)
* Fix a memory leak in static array()'s with textual indices
1999-06-22 19:05:40 +00:00
Andrey Hristov 31c8ec4c80 Made preg_split() consistent with split().
Added a new /e modifier for preg_replace
Kill a warning in pcrelib.
1999-06-22 14:56:32 +00:00
Thies C. Arntzen 5fa6882567 urlencode and decode return an empty-string if the input-string is empty (matches php3 behaviour "more" closly)
Please read my previous mail and comment!
1999-06-22 13:35:28 +00:00
Stig Bakken 8139b776e9 cosmetics 1999-06-22 11:04:35 +00:00
Danny Heijl bc50e68a1b Bad html in ifx_htmltbl_result(). 1999-06-22 07:14:55 +00:00
Stig Bakken 7f8e11d6d3 fix some potential buffer overflows 1999-06-22 01:59:30 +00:00
Andrey Hristov 2b8c85bd0b Backing out changes. 1999-06-21 23:07:46 +00:00
Thies C. Arntzen 8052667684 fixed implode "again" - 1999-06-21 15:57:20 +00:00
Sascha Schumann af56b0f936 whoops, kill debugging message 1999-06-20 18:54:08 +00:00
Sascha Schumann 43a466a076 Introduce AC_ADD_* macros
The use of AC_EXPAND_PATH makes it possible to continue
to use relative paths when configuring PHP.
(e.g. --with-apache=../apache-1.3.x works again)
1999-06-20 18:52:46 +00:00
Sascha Schumann 2b97cb1f88 avoid error message 1999-06-20 17:15:29 +00:00
Sascha Schumann c3151f742b use standard autoconf variables 1999-06-20 17:04:30 +00:00
Zeev Suraski 943a911485 *** empty log message *** 1999-06-19 22:56:34 +00:00
Zeev Suraski d035af4af1 *** empty log message *** 1999-06-19 20:42:15 +00:00
Zeev Suraski 138d601ab1 Add a standard get_ini_entry() to interface between Zend and the outside world 1999-06-19 20:22:56 +00:00
Zeev Suraski bb190f8565 Implement new get_ini_entry() for Zend 1999-06-19 19:23:24 +00:00
Zeev Suraski 8def18813f *** empty log message *** 1999-06-19 14:07:48 +00:00
Zeev Suraski 57882d58e1 Use php.ini instead of php3.ini 1999-06-19 13:18:48 +00:00
Zeev Suraski 63a845f2f6 *** empty log message *** 1999-06-19 13:13:28 +00:00
Zeev Suraski f88464ee6d Win32/ZTS compiles again 1999-06-19 13:04:55 +00:00
Andrey Hristov cd74a455dd for struct sockaddr 1999-06-18 15:54:14 +00:00
Stig Bakken 62fc2f5f7f update php3 sync info 1999-06-18 14:45:48 +00:00
Stig Bakken d92c591514 optimize php3_fopen_url_wrapper() a bit (fewer recv() and send() calls) 1999-06-18 14:22:59 +00:00
Stig Bakken 467523bac5 Apply Sascha's fsock fixes to php4. 1999-06-18 13:42:21 +00:00
Stig Bakken 2ca5404046 make CGI version work again 1999-06-18 13:02:34 +00:00
Sascha Schumann 5d62d88ece typo 1999-06-17 15:45:26 +00:00
Andrey Hristov 14463b1ba8 Need to check if it exists first. 1999-06-17 15:17:17 +00:00
Zeev Suraski a22d6b980e Win32 patches (does not compile still) 1999-06-17 03:45:20 +00:00
Stig Bakken 27f1799b68 MIME headers may be 512 characters long. 1999-06-16 18:43:59 +00:00
Stig Bakken 117a2fba07 * fixed some #if/#ifdef issues
* hand-patched in php3 changes from 3.0.6 to HEAD in these files:
   fopen-wrappers.[ch] ext/standard/file.[ch] ext/standard/fsock.[ch]
   ext/standard/php3_string.h ext/standard/string.c
* added some new file/socket macros for more readable code:
   FP_FGETS(buf,len,sock,fp,issock)
   FP_FREAD(buf,len,sock,fp,issock)
   FP_FEOF(sock,fp,issock)
   FP_FGETC(sock,fp,issock)
1999-06-16 17:06:53 +00:00
Stig S. Bakken 5d4579a1f4 added INIT_FUNC_ARGS_PASSTHRU and SHUTDOWN_FUNC_ARGS_PASSTHRU 1999-06-16 11:03:57 +00:00
Stig S. Bakken 80f1ce5eed * added zend_binary_strcasecmp() 1999-06-15 22:32:51 +00:00
Stig Bakken 8eec7a022f reversing another patch that slipped 1999-06-15 21:56:11 +00:00
Stig Bakken 8c4411b5da * reverse fsock/string import patches 1999-06-15 21:51:00 +00:00
Zeev Suraski f86fb810a0 Change four spaces back to tabs (Why the hell did you change the tabs to four spaces?!) 1999-06-15 19:05:01 +00:00
Stig Bakken 336392ea6c * now using php4.ini instead of php3.ini
* re-imported fopen-wrappers, fsock and string code from php3
  NB!  I have not tested all of the imported functions yet.
1999-06-15 17:06:22 +00:00
Stig Bakken 7719f86292 fix some .cvsignore files 1999-06-15 17:00:39 +00:00
Rasmus Lerdorf bdbdaa4369 gmmktime() fix 1999-06-15 12:31:29 +00:00
Andrey Hristov 215a88ade1 Need to test for directory. 1999-06-14 15:05:55 +00:00
Stig Bakken a916379c21 make symlinks if they are not present already 1999-06-14 13:59:18 +00:00
Zeev Suraski 96bfbc7904 First attempt at moving the old RFC1867 support to the right place 1999-06-12 17:50:39 +00:00
Zeev Suraski c50cd2df99 We can't quite go with expr there (shift/reduce conflict), go with scalar. 1999-06-12 07:43:36 +00:00
Zeev Suraski 4bf413e358 require() improvement as per Andi's suggestion 1999-06-12 06:59:54 +00:00
Sascha Schumann be14ccadf1 it's obj.properties, not ht 1999-06-11 19:29:10 +00:00
Andrey Hristov 8c43c5f708 Fix up var.c a bit. 1999-06-11 15:54:06 +00:00
Zeev Suraski 0d560de1b7 Make the concatenation operator use make_printable as well 1999-06-11 15:37:43 +00:00
Zeev Suraski 9f106c61ec Don't take failing on an include file so badly 1999-06-11 14:51:44 +00:00
Zeev Suraski d6595d628c Support <?= 1999-06-11 13:56:04 +00:00
Zeev Suraski d47d83511a E_ERROR -> E_COMPILE_ERROR in the compiler 1999-06-11 13:40:18 +00:00
Zeev Suraski 54d210427a Two fixes:
* The error generated by a failed class inheritence wasn't  properly
  displaying the file in which he error occured.
* Inheritence didn't work if the parent class had uppercase letters in it.
1999-06-11 13:37:29 +00:00
Rasmus Lerdorf f8bac0f8ad Same Fix here 1999-06-11 12:48:22 +00:00
Stig Bakken 6b16188db0 append DEBUG_CFLAGS to CFLAGS 1999-06-11 12:22:53 +00:00
Zeev Suraski 4b062fdfec Print out include_path in include/require failures 1999-06-11 11:59:35 +00:00
Zeev Suraski 963a004481 * Use to_string() instead of __print()
* Support boolean casts ((bool) and (boolean))
1999-06-11 11:17:43 +00:00
Zeev Suraski 99fd17df63 Change __print into to_string() 1999-06-11 11:02:38 +00:00
Zeev Suraski da9faa2c3a * Make the output handling of variables much, much cooler.
Uses zend_make_printable_zval() instead of convert_to_string() now:

$foo = true;
print "\$foo is $foo";
will now print
$foo is true
(instead of "$foo is 1", earlier).

Also, with objects, it automatically tries to call __print() and use it as a printing
function.

For example:

class foo {
  function __print() { return "Foo Object"; }
};

$foo = new foo;
print $foo;

will print "Foo Object".
1999-06-11 10:44:26 +00:00
Zeev Suraski 1798a0183a * Fix a buglet in the session module
* Make some renames in the session module - avoid having a function called 'delete'
  so that we don't piss any C++ compilers.  Also rename the {startup,shutdown}_globals
  to {startup,shutdown}_session_globals, so that they're a bit less general names,
  and made them static.
* Remove uselss variables
1999-06-11 09:23:00 +00:00
Zeev Suraski c1f75b6fda Now THAT's an annoying bug. 1999-06-10 23:03:35 +00:00
Sascha Schumann 83de88e90c make serialize work
unserialize does not work yet
1999-06-10 15:34:20 +00:00
Andrey Hristov 2bb01b6f81 Fixing serialize a bit. 1999-06-10 15:13:26 +00:00
Andrey Hristov 3b1843bc9f Added preg_grep() function. 1999-06-10 14:41:38 +00:00
Frank M. Kromann f6ad4b09c1 Sync. with php3. Only add Date: and From: if not supplied by user 1999-06-10 09:10:07 +00:00
Andrey Hristov f7072fbf87 Make array_shift/array_pop work better. 1999-06-09 22:03:15 +00:00
Zeev Suraski 2fb5e56123 Fix 1999-06-09 21:40:52 +00:00
Zeev Suraski 95c9e3014a * Fix cases where you assign an array element to the parent array (the array was
being erased before the assignment, so the element was being smashed).
1999-06-09 21:39:12 +00:00
Andrey Hristov b331ead5bf A fix for a fix. 1999-06-09 21:21:27 +00:00
Andrey Hristov 3d45dd58b8 Fixed a bug in preg_split.
Fixed a bug in array_shift/array_pop.
1999-06-09 21:13:05 +00:00
Zeev Suraski b484f40c31 * Fix foreach() that receives a non array argument
* Clean up some C++ comments
1999-06-09 21:02:59 +00:00
Thies C. Arntzen a3464b7c11 oci8 to 3.0.9
implode works!
1999-06-09 19:47:06 +00:00
Andi Gutmans 7ed4923441 - Fix the static array() initializing 1999-06-09 19:26:54 +00:00
Andrey Hristov 835b0d8823 *** empty log message *** 1999-06-09 15:39:56 +00:00
Andrey Hristov 2a64925a67 Fixed a bug in preg_replace. 1999-06-09 15:02:57 +00:00
Thies C. Arntzen e5da9fc10a up to 3.0.9 1999-06-09 10:40:08 +00:00
Danny Heijl f3d179ff99 resync informix driver with php 3.09 version 1999-06-09 07:44:52 +00:00
Zeev Suraski 230846f6dd Replace error messages 1999-06-08 19:37:40 +00:00
Andi Gutmans 04b2c1d422 * Fix a by-name call/method call bug
* Clean and optimize the whole function call process
1999-06-08 18:33:31 +00:00
Zeev Suraski fd4650b540 Add zend_hash_get_current_key_type() 1999-06-07 22:49:33 +00:00
Sascha Schumann 4b023c157a better scaling for large servers using many session ids 1999-06-07 19:51:54 +00:00
Andrey Hristov bc1e4a5a10 Don't set is_ref in _phpi_splice()
More checking in array_merge()
Added keys() and values() array functions.
1999-06-07 18:52:20 +00:00
Sascha Schumann d8a9548cb2 - some cleanups
- add gc logic
- add session_destroy()
1999-06-07 16:43:24 +00:00
Zeev Suraski b886985d63 Fix an ereg_replace() crash bug 1999-06-07 15:01:25 +00:00
Zeev Suraski 34b3dc9b47 - Fix PSLS issues
- Add a standard info function for the session module (use them!)
- Replace PATH_MAX with MAXPATHLEN (that's our platform indepedent constant)
1999-06-06 19:53:59 +00:00
Sascha Schumann 82806ea254 one C too much 1999-06-06 19:26:31 +00:00
Sascha Schumann e9b28fe29c avoid unnecessary PSLS_FETCH() in internal functions 1999-06-06 19:25:39 +00:00
Andi Gutmans f5dbfbae84 -Init tsrm on minit 1999-06-06 18:56:11 +00:00
Andi Gutmans ed97964fbe - Use PS() everywhere. 1999-06-06 18:39:48 +00:00
Andi Gutmans c329da5d25 - Make sessions compile on win32 but it still doesn't link. 1999-06-06 18:36:42 +00:00
Andi Gutmans c5fd7244dd - Add some *_FETCH()'s. Still some work to be done so that it'll compile on win32. 1999-06-06 18:22:17 +00:00
Andi Gutmans 5b0ae2dff3 Work around a compiler bug - mark variables that are sent to functions that aren't yet
defined as FETCH_W (because they might end up being sent by reference)
1999-06-06 17:35:42 +00:00
Sascha Schumann 605756de7f - s/encoded/encode/
- new TODO entry
1999-06-06 15:18:51 +00:00
Andi Gutmans d5dc2cd22c - Remove the is_ref =1 from the push() function. 1999-06-06 15:00:49 +00:00
Sascha Schumann a821a185e4 add some protos 1999-06-06 14:19:55 +00:00
Sascha Schumann 2f79ba1abf add some thoughts 1999-06-06 14:02:13 +00:00
Sascha Schumann 19a2a02f8e - auto startup when calling register
- auto startup using a configuration option
1999-06-05 22:24:59 +00:00
Sascha Schumann f830cf7d15 moving start code into its own function 1999-06-05 22:15:49 +00:00
Andrey Hristov f8f8defb42 Added array_merge() function. 1999-06-05 21:19:25 +00:00
Sascha Schumann 2db1d61718 SAPI does not want line endings 1999-06-05 20:51:29 +00:00
Andrey Hristov 421414df03 Added push(), pop(), shift(), unshift(), splice(), and slice() array functions.
The first 5 work like their Perl counterparts. slice() returns a chunk of the array
specified by offset and length arguments.

Backport to PHP3 and docs will be coming soon.
1999-06-05 20:43:36 +00:00
Zeev Suraski ed06a70f7f * Centralized shutdown
* Change shutdown order again
1999-06-05 20:00:00 +00:00
Sascha Schumann a1b42e3f5e first import of session module 1999-06-05 19:52:58 +00:00
Zeev Suraski 89f139d3b0 Call the request_shutdown on modules before destroying symbol tables, so that
the session module can be implemented
1999-06-05 19:10:40 +00:00
Zeev Suraski bbce669cea Move shutdown order into Zend 1999-06-05 19:00:56 +00:00
Zeev Suraski 8b2fe60467 - Fixed Karl's bug report. It's not really a thorough fix, we really need to rethink the INIT_FCALL/DO_FCALL issue.
- Fixed numerous AiCount problems
1999-06-05 18:47:36 +00:00
Zeev Suraski e49aafcf57 I got the order wrong earlier :I 1999-06-05 17:47:16 +00:00
Zeev Suraski e586468a4e Not sure that's the right fix, but at least it fixes the symptom 1999-06-05 13:56:18 +00:00
Sascha Schumann 92f986787b add some .cvsignores 1999-06-05 10:48:05 +00:00
Andrey Hristov dbfeaabb16 Added preg_quote() function. 1999-06-04 13:56:23 +00:00
Andrey Hristov c7a606c4a3 *** empty log message *** 1999-06-04 13:37:44 +00:00
Zeev Suraski 1b4b5c4a88 New $GLOBALS init 1999-06-04 13:09:24 +00:00
Zeev Suraski 1ecca4b8e8 Fix UNIX MySQL build 1999-06-04 12:51:41 +00:00
Zeev Suraski cf757f7c89 Fix that GLOBALS leak. We were explicitly adding GLOBALS to the main symbol table,
but there's no reason to do it (INIT_GLOBALS takes care of it if necessary.)
1999-06-04 12:22:19 +00:00
Zeev Suraski b6315d1c9b Remove old workspaces 1999-06-04 12:13:18 +00:00
Zeev Suraski 9108abc287 Minor updates (mostly __declspec() stuff) 1999-06-04 11:44:02 +00:00
Zeev Suraski 3cad348509 * Add a new workspace for dynamic PHP extensions.
* Add a few functions to PHP's API.
* Get the MySQL extension up-to-date and thread safe.
* Add a project for building the MySQL extension under Win32.
1999-06-04 10:45:54 +00:00
Thies C. Arntzen a3a60dd4e7 added is_ref=0 and refcount=1 to SET_VAR_* macros 1999-06-04 09:04:05 +00:00
Zeev Suraski 66a48f2131 T_BAD_CHARACTER is actually a string. 1999-06-03 23:59:33 +00:00
Andi Gutmans 1225d0307b - We weren't counting newlines in heredocs. The only place which is still questionable
is when there's a \ followed by a newline but it seems we have a parse error in this
case anyways.
- Fixed the alloca() macros so that the alloca() #define in win32 mode won't clash
with the real win32 alloca().
1999-06-03 21:06:03 +00:00
Andrey Hristov 0f99eeb29f function dir doesn't exist anymore 1999-06-01 21:01:02 +00:00
Andrey Hristov aea7498779 *** empty log message *** 1999-06-01 20:31:39 +00:00
Andi Gutmans c4b7426ec1 - Make execute() use less stack in thread-safe win32 due to Microsoft's shitty 256kb stack. 1999-06-01 18:47:53 +00:00
Sascha Schumann d57ffd3646 avoid touching libraries which have not changed 1999-06-01 17:53:15 +00:00
Andi Gutmans 250d803c31 - Fix for exec to use API 1999-06-01 16:41:56 +00:00
Zeev Suraski 4ea6d477ec thread-safety fix 1999-05-31 19:58:20 +00:00
Zeev Suraski 63f2cc9fe9 *** empty log message *** 1999-05-31 18:39:29 +00:00
Andi Gutmans 52ec64359c Fixes 1999-05-31 18:33:12 +00:00
Andi Gutmans f153896de5 *** empty log message *** 1999-05-31 17:41:41 +00:00
Zeev Suraski 5f12a05aa3 *** empty log message *** 1999-05-31 17:40:15 +00:00
Andrey Hristov aba3ea97cd preg_match_all() now returns the number of global matches. 1999-05-30 14:48:39 +00:00
Sascha Schumann 88029643d0 * fix some casts
* introduce unary_op_type - cleaner than casting data voids to function ptrs
1999-05-30 13:28:56 +00:00
Sascha Schumann 31da7331fe kill some warnings 1999-05-30 12:00:06 +00:00
Sascha Schumann 577340bb9f zend_hash_merge was changed 1999-05-30 11:57:28 +00:00
Zeev Suraski cf4a2c3bfc That got fucked up when we went back to using uninitialized_zval 1999-05-29 23:37:26 +00:00
Sascha Schumann b5dd397459 another VPATH related change 1999-05-29 23:20:55 +00:00
Zeev Suraski f78d4f1a56 Fix a bug 1999-05-29 22:26:28 +00:00
Andrey Hristov a88b37788e Updated preg_split(). 1999-05-29 20:45:00 +00:00
Andrey Hristov 70dc46892a Fix preg_match_all to do proper matching with \b. 1999-05-29 20:04:05 +00:00
Andrey Hristov 9c970e1910 Fixed PCRE so that global matching with patterns with \b works. 1999-05-29 19:38:50 +00:00
Zeev Suraski e058cccfc1 * Changed the way INI entries work in Apache to allow .conf entries to work right too.
* vpath fixes for standard Apache build
1999-05-29 19:06:22 +00:00
Zeev Suraski bcc1337d8c Support overwrite mode in zend_hash_merge() 1999-05-29 18:59:58 +00:00
Zeev Suraski 274f3aa727 Fix 1999-05-29 18:28:46 +00:00
Sascha Schumann 33507acca5 - clean is not called from automake. use CLEANFILES instead
- allow VPATH compilation
1999-05-29 18:13:14 +00:00
Sascha Schumann 03d2a11e27 more VPATH work 1999-05-29 18:11:49 +00:00
Sascha Schumann 6ebb2c80e0 kill warning 1999-05-29 16:20:55 +00:00
Sascha Schumann 941bdd57a3 - fix APXS VPATH build
- libzend/TSRM build in their own directories
- ext/Makefile was generated twice

****NOTE******

If you use any kind of VPATH, you need to do a "make distclean" in your
libzend/TSRM directory, before running configure again.
1999-05-29 16:15:21 +00:00
Zeev Suraski e9c646e7dd avoid crashing with php4 directives in .conf files (they still don't work) 1999-05-29 16:03:49 +00:00
Zeev Suraski 873763473f fixes 1999-05-29 15:10:06 +00:00
Sascha Schumann 52463124be getopt.h conflicted with system include file 1999-05-29 13:53:59 +00:00
Sascha Schumann b219d491b9 . 1999-05-29 12:15:04 +00:00
Zeev Suraski b7ee45e13c Correct fix 1999-05-29 12:00:32 +00:00
Zeev Suraski 7068d4a201 *** empty log message *** 1999-05-29 11:02:37 +00:00
Zeev Suraski 24a21ca2e1 Fix a leak 1999-05-29 11:01:50 +00:00
Zeev Suraski c1dc4efc3b no need for those 1999-05-28 22:42:17 +00:00
Zeev Suraski 0eb1498fa8 * Get Apache module to compile again with the regex stuff.
* Get Apache to propertly work with POST, and some SAPI fixes
1999-05-28 22:41:48 +00:00
Sascha Schumann dfce358a5b that seems to fix it 1999-05-28 21:41:17 +00:00
Sascha Schumann 7401ef12fb Either I'm playing the EG(symbol_table) game wrong or var.c leaks memory
when unserializing arrays/objects. Still testing
1999-05-28 21:27:19 +00:00
Andrey Hristov 3fe94e5b37 -Modified PCRE library slightly to do what needs to be done
-Updated preg_replace() code to handle stuff properly
-Removed ability to specify external PCRE library source to link against
(since our bundled version is patched now)
1999-05-28 20:54:52 +00:00
Sascha Schumann 62a9f2137c I think that is the preferred way as of now 1999-05-28 18:51:51 +00:00
Zeev Suraski cd789db6f2 *** empty log message *** 1999-05-28 13:28:50 +00:00
Zeev Suraski 741b816136 * Support getThis() for internal functions.
* Fix 'new object or die' and AiCount issue thoroughly (earlier fix didn't
  work with the optimizer).
* Add new macros for standardized definition of classes.
* Only report AiCount problems if shutdown was not silent.
1999-05-28 12:06:59 +00:00
Zeev Suraski 7a167cd0c1 * Use new Zend macros for standardized definition of classes.
* Reverse bogus shutdown order.
* Use the new object/class support of Zend to make the dir functions work again.
1999-05-28 11:09:39 +00:00
Rasmus Lerdorf f1f4e6f478 Some innocent cleanups 1999-05-28 03:54:15 +00:00
Andrey Hristov a5138d2724 We don't need those there. 1999-05-27 14:02:29 +00:00
Andrey Hristov e10e4dbe10 Really fix the configuration now so that it's possible to compile both
against the bundled PCRE library and the one external to the source tree.
Crossing my fingers while Zeev compiles this. :)
1999-05-27 13:59:39 +00:00
Stig Bakken 96434e4899 self-contained extensions please :-) 1999-05-27 08:53:21 +00:00
Zeev Suraski 83cdc9476d Generate Visual Studio compatible error messages when compiling under Win32 1999-05-27 03:14:57 +00:00
Zeev Suraski 3b5972ed4a Fix the AiCount issue with objects 1999-05-27 03:11:08 +00:00
Zeev Suraski 1f985ede74 Moved all #define's for SET_ and RETURN_ to zend_API.h 1999-05-27 01:44:17 +00:00
Sascha Schumann 5d0a7599a9 - fix CGI build (at least) 1999-05-27 01:34:18 +00:00
Sascha Schumann 16ec4608ac add rfc1867.c 1999-05-27 01:20:52 +00:00
Zeev Suraski 36947fc45a Fix pcre build 1999-05-27 01:19:00 +00:00
Zeev Suraski 064a16c7b2 Moved all SET_ and RETURN_ macros to Zend
Fixed all RETVAL_ macros
1999-05-27 00:45:31 +00:00
Andrey Hristov 66f850e5b7 -Added PCRE library source
-Updated configuration process
1999-05-26 21:47:57 +00:00
Andrey Hristov d73c638526 Added preg_split. Same syntax as regular split(). 1999-05-26 18:59:04 +00:00
Andrey Hristov ff29e85724 Fixing a couple of long standing bugs. 1999-05-26 18:45:53 +00:00
Andrey Hristov 0062ae6218 A few changes here.
First of all, as per extensive discussion on the list, the functions are now
prefixed with "preg" instead of "pcre".

Secondly, global matching is now possible using preg_match_all.  Please, give
suggestions on a better name if this one doesn't sit well with you.  Possible
names are preg_global_match and preg_gmatch.

preg_match_all takes 4 arguments: a regex pattern, a subject string,
the array for capturing subpatterns, and a parameter that tells how the results
in the subpatterns array are arranged.

Basically, preg_match_all will go through the subject string and try to capture
all the matches that it finds, not just the first one like preg_match.

4th parameter can be PREG_PATTERN_ORDER (default) or PREG_SET_ORDER.

Example:
preg_match_all("|</?([^>]+)>|", "<div align=left>a test</div>", $out, PREG_PATTERN_ORDER);

This returns results so that $out[0] is an array of full pattern matches, $out[1] is an array
of first captured subpattern matches, and so on.

$out[0] -> ("<div align=left>", "</div>")
$out[1] -> ("div align=left", "div")

Example:
preg_match_all("|</?([^>]+)>|", "<div align=left>a test</div>", $out, PREG_SET_ORDER);

This returns results so that $out[0] is an array of first full pattern match and subpatterns,
$out[1] is an array of second full pattern match and subpatterns.

$out[0] -> ("<div align=left>", "div align=left")
$out[1] -> ("</div>", "div")

If anyone has a better name for these PREG_ constants and also which one should be the default,
I'd like to hear it.
1999-05-26 15:22:02 +00:00
Zeev Suraski 033858e13d Avoid crashing if an error occurs before we open the first file. 1999-05-25 22:55:13 +00:00
Zeev Suraski cf58b7ef16 Add container for file-upload. It's not quite implemented yet. 1999-05-25 22:28:24 +00:00
Andrey Hristov 6155d91e7a Just a little sanity check. 1999-05-25 21:47:58 +00:00
Zeev Suraski 4f545f9c6b Allow unregistering content types as well. 1999-05-25 21:19:46 +00:00
Zeev Suraski 72f6e823f9 * Add generic POST content-type support. Only application/x-www-form-urlencoded
supported at this time, but the framework allows for any other types, including
  runtime addition of types.
1999-05-25 21:14:54 +00:00
Zeev Suraski 7b98592282 include regex in Win32 build 1999-05-24 18:02:42 +00:00
Zeev Suraski e115fdc6d6 The last fix was wrong 1999-05-24 16:48:01 +00:00
Zeev Suraski cbcd462d46 Another operators fix 1999-05-24 16:43:47 +00:00
Zeev Suraski 97107dc440 boolean comparison didn't work with smaller-than and greater-than, something that
fucked up berber's site a bit.  fixed.
1999-05-23 22:07:04 +00:00
Zeev Suraski 0eb500cef5 Thou shalt use the API, and thou shalt be safe 1999-05-23 20:32:19 +00:00
Andrey Hristov 57b22c8b64 Some comments. 1999-05-22 19:46:27 +00:00
Sascha Schumann 3165710b77 - add -lregex
- change module name to php4
1999-05-22 19:41:28 +00:00
Andrey Hristov 912f17d278 Added ability to pass array parameters to pcre_replace. 1999-05-22 19:14:57 +00:00
Zeev Suraski ee7032f069 Sigh, another leak bites the dust. FREE_OP missing in case of a SEND_VAR. 1999-05-22 18:02:30 +00:00
Zeev Suraski 84bb91d762 I'm on a roll. Fix a nasty yet stupid AiCount bug 1999-05-22 17:30:09 +00:00
Zeev Suraski 05f6cf54f0 Warn about AiCount not zeroing out 1999-05-22 16:48:23 +00:00
Sascha Schumann 7b58930456 add a $(srcdir) 1999-05-22 16:13:10 +00:00
Sascha Schumann 13c3c4012e fix compile issues in LDAP/XML exts 1999-05-22 16:12:09 +00:00
Zeev Suraski 1250c43a39 * Add struct name to all typedef's so that they can be debugged with MSVC
* Fix an AiCount bug - list(...) = $var was using $var multiple times, and thus
causing AiCount to be decreased multiple times even though it was increased only
once for $var.  Mark all FETCH_DIM's so that they won't decrease AiCount, and only
decrease AiCount on the last FETCH_DIM.
* Fix a stupid bug - forgot to pass CLS_C to some compiler function.  For some reason
MSVC doesn't report these :I
1999-05-22 16:10:51 +00:00
Sascha Schumann 1652802641 fix APXS compile 1999-05-22 15:48:29 +00:00
Zeev Suraski d62a739cca More fixes. Should hopefully work well now. 1999-05-22 12:19:57 +00:00
Zeev Suraski 9df57a2263 php_ini fixes 1999-05-22 11:34:21 +00:00
Zeev Suraski 080105f79f Give more information and save log lines in memory leak reports 1999-05-22 11:20:56 +00:00
Zeev Suraski 9b4d71205b * Minor fixes
* Better handling for multiple repeated memory leaks (libzend updated)
1999-05-22 10:56:36 +00:00
Zeev Suraski a08e3925b1 Time to rename the child 1999-05-22 09:24:21 +00:00
Zeev Suraski 87ba08d1d0 Avoid leaking fd's in case of failures 1999-05-22 02:13:01 +00:00
Zeev Suraski 58a0ae7b35 Small fix 1999-05-22 01:15:25 +00:00
Zeev Suraski ac94c83867 more fixes 1999-05-22 01:07:50 +00:00
Zeev Suraski 9e862c11ec Fix a memory leak 1999-05-21 23:51:19 +00:00
Zeev Suraski d56ae4f670 That wasn't supposed to slip in 1999-05-21 23:48:24 +00:00
Zeev Suraski be8b9778e0 This should be centralized... 1999-05-21 23:25:46 +00:00
Zeev Suraski 9dc0842e58 * Properly handle failed file opens in C++
* Properly handle failed require()'s within libzend
1999-05-21 20:20:32 +00:00
Sascha Schumann 00cb03bd49 add support for mhash 0.5.0
see http://sasweb.de/mhash/
1999-05-21 20:09:23 +00:00
Andrey Hristov e3a70c1f04 -Added regex cache
-Made module thread-safe
1999-05-21 19:27:44 +00:00
Zeev Suraski c57c0e9cd5 * Fix error handling startup on the thread-safe CGI version
* A failed require() is a compile-time error, consider it as one
1999-05-21 19:22:17 +00:00
Zeev Suraski f33c22c055 * Fix the comments issue. yymore() worked like a charm.
* Change all flex states to be prefixed with ST_
1999-05-21 17:31:49 +00:00
Andrey Hristov be9dc58cfe Get rid of debug printf's. 1999-05-21 13:29:05 +00:00
Andrey Hristov 17bbbf2963 Initial check-in of PCRE (Perl Compatible Regular Expressions) extension.
PCRE library can be found at ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/

config.m4 will be updated to be more robust later on.

perl_match() takes a regular expression, the source string, and the array
for subpattern matches.

perl_replace() takes a regular expression, the search string, and the replacement
string.

Regular expression is specified using delimiters and options.  Example:

perl_match("/<[a-z]*>/i", $text, $tags);

More stuff is coming soon.
1999-05-21 13:17:23 +00:00
Sascha Schumann b57dc27595 - run ext sources through conv_proto
- add necessary phpext_*_ptr
1999-05-21 10:06:25 +00:00
Sascha Schumann 4fe8fe715e merge in some PHP3 stuff 1999-05-21 08:37:48 +00:00
Sascha Schumann 6f06b11679 incorporate YP/NIS support 1999-05-21 08:29:51 +00:00
Sascha Schumann fb407676a2 - fix compile issues for various packages (dbase, sysv*, zlib)
- some cleanup in mhash/mcrypt
1999-05-21 08:20:13 +00:00
Sascha Schumann 0fe7fe30b5 - add phpext_pgsql_ptr
- semaphore update for glibc-2.1 systems
1999-05-21 08:04:38 +00:00
Sascha Schumann 672e38da93 Add default path for binary mysql distributions 1999-05-21 07:52:12 +00:00
Sascha Schumann 286fef1ce4 remove debug messages 1999-05-21 07:04:48 +00:00
Zeev Suraski 9cb2cf1393 Optimize allocations into uninitialized_zval assignments 1999-05-20 20:00:59 +00:00
Zeev Suraski 59a539f6ad Use OutputDebugString() or fprintf(stderr,) for memory leaks 1999-05-20 19:06:28 +00:00
Sascha Schumann 27fc61c4dc Apply the fix for feof() 1999-05-20 13:56:19 +00:00
Andi Gutmans 3facf7cb7c - Updates we did today 1999-05-20 13:04:59 +00:00
Andi Gutmans 7eef22472c - Small fixes 1999-05-20 12:06:45 +00:00
Andi Gutmans d79292d52b - Fix a small problem with class decelerations. 1999-05-20 09:08:29 +00:00
Andi Gutmans 0bc950bcd5 -Open curly braces fix? 1999-05-20 09:02:03 +00:00
Sascha Schumann db6ce2f2a9 add mhash support 1999-05-16 12:01:25 +00:00
Sascha Schumann 4e08c66771 kill another 64-bit issue.
this affected at least md5 which produced wrong values on 64-bit platforms
1999-05-16 11:55:34 +00:00
Sascha Schumann a37a5e5c4a char * => unsigned char * 1999-05-16 11:32:51 +00:00
Sascha Schumann 39691bed9e conv_proto *.[ch] 1999-05-16 11:19:26 +00:00
Sascha Schumann 5a4c63db53 this script automatically converts the ugly void php3_... prototypes
to PHP_FUNCTION(...) prototypes. Also kills some unnecessary extern
declarations in front of function prototypes.
1999-05-16 11:14:52 +00:00
Sascha Schumann ed8a7dff62 add fast bin2hex string function 1999-05-16 11:12:23 +00:00
Sascha Schumann d886b84ef4 kill some compiler warnings 1999-05-16 11:10:41 +00:00
Zeev Suraski b0bfa458b5 * Fix all hash checks that checked Bucket.arKey for NULL, when it was changed
to char[1], these checks should have been changed to Bucket.nKeyLength==0
* Support runtime declaration of functions.  I ended up changing the grammar
  to catch top level functions vs. nested functions.  The reason is simple -
  if we don't have functions properly declared at compile-time, function calls
  cannot be resolved at compile time, and have to be resolved at runtime, which
  ends up being much much slower (without the optimizer, that is).
  It's no biggy though, the grammar change isn't that bad.
1999-05-15 15:47:24 +00:00
Zeev Suraski d2c16bf5bd *** empty log message *** 1999-05-15 14:56:23 +00:00
Zeev Suraski b9fb0b8e4d If a require() dies, we must bail out (since it corrupts an existing op_array 1999-05-14 20:16:22 +00:00
Zeev Suraski 53f98a66cf Fix a bug 1999-05-14 19:04:37 +00:00
Stig S. Bakken 695b4f4d5e don't install Zend on the system 1999-05-14 18:42:06 +00:00
Zeev Suraski 1fb61df8a5 * Include all of the standard modules in internal_functions.c.in. Stig - is that
the way you intended it to be?  How does the basic_functions module get in there?
* Fix to get MySQL objects working, even though I'll probably make a dedicated
  MySQL object in the future.
1999-05-14 18:25:16 +00:00
Zeev Suraski 67296f0704 Add \012 and \xff missing support to constant quoted string 1999-05-14 11:29:34 +00:00
Zeev Suraski df0906f7c0 Release fix 1999-05-13 16:48:49 +00:00
Zeev Suraski 5eaed486e1 * HTTP-auth bugfix
* Patch the regex thread safe code to compile in thread safe mode
1999-05-13 15:54:49 +00:00
Zeev Suraski 0b873a7899 *** empty log message *** 1999-05-12 23:05:17 +00:00
Zeev Suraski 52ac2e67c1 Enable Apache HTTP Auth 1999-05-12 22:49:23 +00:00
Zeev Suraski 49b01a4b3d Support HTTP Auth under ISAPI. Now, these short pieces of code took *A LOT* of
research :(
1999-05-12 21:35:16 +00:00
Stig S. Bakken cefca57c9c install libzend.a and header files on "make install" 1999-05-12 20:12:15 +00:00
Stig S. Bakken 97ea66a045 add --enable-thread-safety option 1999-05-12 20:11:42 +00:00
Zeev Suraski 853d6c6206 Added prepend to llist 1999-05-12 18:06:14 +00:00
Andrey Hristov 89a56a139b It's been there long enough. 1999-05-12 17:29:51 +00:00
Thies C. Arntzen 6c2c3a9587 compiles 1999-05-12 16:12:22 +00:00
Thies C. Arntzen d470b4cfe0 added _php3_hash_next_index_pointer_insert 1999-05-12 16:11:35 +00:00
Sascha Schumann a4d20864a6 - regex cache (needs some work)
- str_replace changes from php3
1999-05-12 15:40:15 +00:00
Thies C. Arntzen 3031862b24 up-to-date with 3.0.8 1999-05-12 14:28:01 +00:00
Thies C. Arntzen dc8d4f89c7 move oci8 from oracle to it's own ext-directory - configure stuff needs more work - but it configures and compiles 1999-05-12 14:21:38 +00:00
Thies C. Arntzen f04567b09e builds and configures again 1999-05-12 13:44:09 +00:00
Rasmus Lerdorf fbeeb8f29c substr() fix 1999-05-12 12:53:45 +00:00
Rasmus Lerdorf 43d93b6533 substr() fix for PHP4 as well 1999-05-12 12:43:03 +00:00
Zeev Suraski 6bc6dacf5c Fixes:
* Avoid closing stdin (I could have sworn I've committed that already)
* unclean_shutdown patches
1999-05-11 21:39:48 +00:00
Zeev Suraski e22cce0dda Easier Win32 debug code 1999-05-11 21:38:39 +00:00
Zeev Suraski 0997fcdc2b Fix 1999-05-11 21:27:44 +00:00
Zeev Suraski ceeb9b38ba * Finally commit that -q patch
* Refine SAPI built in header support
* Use DllMain() in ISAPI to clean after threads and initialize tsrm/sapi as soon as possible.
1999-05-11 20:38:16 +00:00
Andrey Hristov 702829709c Added compact() function. 1999-05-11 19:31:37 +00:00
Zeev Suraski 9fd708a313 Handle the Location: header centrally for all SAPI modules. 1999-05-11 18:36:35 +00:00
Zeev Suraski 473d1d7cf1 * Fix a bug that occured in case of parse errors. We need to restore the lexical state
even if the compilation failed.
1999-05-11 17:50:37 +00:00
Zeev Suraski ba88c0c47c * Move unclean_shutdown from PHP to Zend.
* The Master/Local headers in the phpinfo() table were reversed.
* Fix a gpc bug
1999-05-11 16:52:58 +00:00
Zeev Suraski 24dff20afa Support POST in Apache 1999-05-11 12:52:17 +00:00
Zeev Suraski dc5ed5a3fb beatify Apache's info func 1999-05-11 00:43:46 +00:00
Zeev Suraski 3e98dc5edc Memory leak fix 1999-05-11 00:09:22 +00:00
Zeev Suraski 0b77132507 * Get Apache to work. POST doesn't work yet.
* There are now -I directives for the absolute path of php4, php4/libzend and the builddir for
  the Apache module, so we can #include any php/Zend header.
* Rename config.h to php_config.h
1999-05-11 00:01:47 +00:00
Andrey Hristov 957616cd2d Minor updates. 1999-05-10 21:14:43 +00:00
Andrey Hristov d7ed9c1455 Added in_array() function. 1999-05-10 21:10:48 +00:00
Zeev Suraski 74a9ed7b3f Weed out all BoundsChecker-found bugs (including a serious file descriptor leak
in the C++ scanner)
1999-05-10 20:46:42 +00:00
Andrey Hristov ea0f19850e A couple of fixes. 1999-05-10 20:41:42 +00:00
Zeev Suraski 928e322038 Weed out all BoundsChecker-found bugs 1999-05-10 19:48:23 +00:00
Zeev Suraski 8f48b83df4 Only read POST info if the request method is POST. 1999-05-09 20:58:26 +00:00
Andi Gutmans 4079f914bd * Make read_post() read input by chunks instead of returning a single string.
This will allow us to efficiently support file upload through SAPI in the future.
* Fixes
1999-05-09 18:40:59 +00:00
Zeev Suraski 14a8e9b6c3 Change argument name 1999-05-09 14:56:38 +00:00
Zeev Suraski 60fcac8f2a A few other minor fixes 1999-05-09 13:57:09 +00:00
Zeev Suraski 5ba4b3311d Several minor fixes 1999-05-09 13:55:15 +00:00
Zeev Suraski bfbe86187e Almost forgot to commit those 1999-05-09 12:24:21 +00:00
Zeev Suraski bc415d5a88 * Finalizing the PHP version of SAPI. Support POST and cookies among other things.
* Fully implement ISAPI support - POST and cookies among other things.
* Almost completely rewrote phpinfo().  Allow modules to easily display their
  information in phpinfo() without modifying phpinfo() itself (prototype for
  the module info function was changed, thus the large amount of updated module
  files).
* Initial extended SAPI support for Apache, completely untested.
* CGI now uses SAPI fully as well.
1999-05-09 08:48:05 +00:00
Sascha Schumann 91cf2e59c4 get rid of the binary character, execute sed only once 1999-05-08 22:00:02 +00:00
Sascha Schumann 17a36c37d1 this is faster than parsing the file line by line 1999-05-08 21:44:12 +00:00
Andrey Hristov a0b94fccbb -Added extract() function
-Added function_exists() function
1999-05-08 21:18:06 +00:00
Andrey Hristov cd901e8586 -fixed configure.in.in to use genif.sh instead of genif.pl
-fixed genif.sh
-updated php3_mysql.h to have phpext_mysql_ptr
1999-05-08 18:16:30 +00:00
Zeev Suraski ae6f852cb6 Oh yeah, wrong license 1999-05-06 22:31:46 +00:00
Zeev Suraski ade1117ebd * Get output buffering to work again
* Warn about adding header information after headers are sent
* Several fixes
1999-05-06 21:58:49 +00:00
Sascha Schumann 324593224d calloc et al need stdlib.h according to ANSI-C 1999-05-06 21:13:26 +00:00
Sascha Schumann 2c42111694 add compat #define 1999-05-06 20:54:56 +00:00
Sascha Schumann a793fea1f7 Do we really want to depend on Perl? Shell scripts are handy and run on
virtually every Unix box whereas Perl does not. I don't think Perl should
be required when actually configuring PHP4. Open to comments...
1999-05-06 20:52:19 +00:00
Zeev Suraski c5d8c389a5 Ok, I tested it now. It works very nicely! 1999-05-06 19:13:13 +00:00
Zeev Suraski 465c94ce18 * Optimize _php3_parse_gpc_data() and clean it up, plus fix a couple of Zend related memory leaks in it 1999-05-06 18:09:50 +00:00
Zeev Suraski 842b5ee941 vpath fix
Apache compatability fix
1999-05-05 21:47:04 +00:00
Zeev Suraski 6f1c611868 Fixes 1999-05-05 21:29:26 +00:00
Zeev Suraski 54fa0e5d16 fix 1999-05-05 21:11:27 +00:00
Zeev Suraski aee864e9d8 Get CGI to work with the new headers code.
Now Apache is the only interface that doesn't use it.
1999-05-05 21:05:44 +00:00
Zeev Suraski 2740382c2c ISAPI WORKS! 1999-05-05 19:53:15 +00:00
Andi Gutmans c8b2bf0a1d llist improvements 1999-05-05 19:24:46 +00:00
Andi Gutmans 537cc54acd Added initial headers support in SAPI
*untested*
It definitely broke the thread-safe CGI, it may have broken other stuff as well.
1999-05-05 18:25:20 +00:00
Zeev Suraski 9e67cded5e Get Win32 to compile again 1999-05-04 20:27:30 +00:00
Zeev Suraski 95af652d2b An initial default builtin modules file for Win32 1999-05-04 03:43:49 +00:00
Zeev Suraski 18742324b3 ZTS fixes
Stig - --enable-thread-safety belongs in libzend, since libzend doesn't #include config.h, whereas
PHP does #include zend_config.h
1999-05-04 03:42:19 +00:00
Zeev Suraski 1401cd52fc vpath patches (cool job Stig!) 1999-05-03 19:59:55 +00:00
Stig Bakken 9a66ffbaee * added --enable-thread-safety switch
* now generating internal_functions.c
1999-05-03 11:11:23 +00:00
Zeev Suraski 9a4031ad64 Get apache uptodate 1999-05-02 20:04:18 +00:00
Zeev Suraski a5ab6b9638 Move path_info to the SAPI structure 1999-05-02 19:54:02 +00:00
Zeev Suraski 7071131f81 Get rid of request_info.path_translated 1999-05-02 19:31:56 +00:00
Zeev Suraski bc004fb062 Apache compile fix 1999-05-02 19:16:21 +00:00
Andi Gutmans fcaf734f94 - Don't support interactive mode when thread safe. 1999-05-02 19:07:46 +00:00
Zeev Suraski e6257bc388 UNIX CGI build fix 1999-05-02 19:01:45 +00:00
Andi Gutmans 5dbe924660 - Make ISAPI hook in as an extension too.
- Some work on moving stuff to SAPI.
1999-05-02 18:07:41 +00:00
Sascha Schumann 7e0ee50ed4 func name changes, remove arbitrary limit 1999-05-01 14:41:46 +00:00
Sascha Schumann 8baa86ed51 mcrypt 2.1.18 support, better autoconf checking 1999-05-01 11:14:22 +00:00
Zeev Suraski 064f75fd1b Several operator fixes. Should fix the MySQL problem. 1999-05-01 01:04:13 +00:00
Andi Gutmans 5dd7f27f0b - Free refcount when destroying the last class reference. 1999-04-30 23:32:03 +00:00
Andi Gutmans 202135bfac - Missed one place 1999-04-30 21:44:27 +00:00
Andi Gutmans 0e1f8ed58e - First try at fixing $a->foo[] syntax. 1999-04-30 20:27:36 +00:00
Thies C. Arntzen 75bc4593ff forward port of current oracle.c + fixes to make it actually work;-)!!! 1999-04-30 18:59:15 +00:00
Thies C. Arntzen 23917484ad oracle links again (at least on linux!!!) 1999-04-30 18:02:09 +00:00
Andi Gutmans 91371c4340 - Move back to yyless(). I haven't tested it yet because it's taking too long
to compile and I have to disconnect
1999-04-30 17:35:38 +00:00
Zeev Suraski 9dd66bc2ae Fix Boris's problem (in my never ending struggle to show I never mean what I say
when I say something's not gonna happen :)
1999-04-30 17:29:18 +00:00
Zeev Suraski bc3686c14a * Fix a problem with constant quoted strings, that was causing Thies's problem
* Remove a development-time printf
1999-04-30 10:46:48 +00:00
Andi Gutmans 95e2e023fb - No reason to handle newlines here. 1999-04-29 20:58:29 +00:00
Zeev Suraski d90ea1a136 Make the C++ scanner support interactive input 1999-04-28 23:18:57 +00:00
Zeev Suraski e22a1a08a5 Get the MySQL module to use the new INI mechanism feature 1999-04-28 21:37:54 +00:00
Zeev Suraski d843632629 Remove redundant code 1999-04-28 21:29:31 +00:00
Zeev Suraski a877f6d380 Additional generalization of the INI mechanism. Avoid needing specialized
message handlers in 99% of the cases.
1999-04-28 21:14:47 +00:00
Zeev Suraski 66476011dd A step towards generalizing the INI mechanism even more 1999-04-28 20:26:33 +00:00
Zeev Suraski 1aaf98e54b get rid of some stupid warnings 1999-04-28 20:18:25 +00:00
Andi Gutmans cef5243b64 - export patch 1999-04-28 18:35:42 +00:00
Andi Gutmans a74b342612 - Small startup fix. 1999-04-28 17:38:24 +00:00
Andi Gutmans 8423f8f1d3 dsp update 1999-04-28 16:13:09 +00:00
Rasmus Lerdorf 92905543f1 Add fgetcsv() here as well 1999-04-27 13:06:58 +00:00
Zeev Suraski 2493f68018 * Fix debugger+interactive mode bug
* Recognize whether an extension is with debug information or not
1999-04-27 11:00:59 +00:00
Zeev Suraski 1245356128 * Get rid of the memory leak messages in case of fatal errors or exit()
* .dsp fixes
* Minor fixes
1999-04-27 10:00:54 +00:00
Zeev Suraski 9b56453566 * Small startup fix
* Fix min() and max()
1999-04-26 20:20:12 +00:00
Zeev Suraski 7375ca5588 Temporary fix for CGI compilation under UNIX 1999-04-26 19:48:10 +00:00
Zeev Suraski 48de4ce0dd Somehow the rules for the configuration parser/scanners disappeared 1999-04-26 19:02:59 +00:00
Andrey Hristov b9d3a80709 Fixing a few thing to make AC_CHECK_CC_OPTION work. 1999-04-26 18:06:04 +00:00
Zeev Suraski 3cd0af11ee * Get the Apache module to compile again
* Get rid of php3_rqst, use SG(server_context) instead (there's still Apache-specific code,
  but it nuked a global)
1999-04-26 17:26:37 +00:00
Zeev Suraski 0f195a79cd fix 1999-04-26 15:16:06 +00:00
Zeev Suraski c55a67657f Match the CVS name 1999-04-26 14:11:20 +00:00
Zeev Suraski 7c4a08381e Various thread safety fixes and DLL updates 1999-04-26 14:10:42 +00:00
Zeev Suraski 7942eaf381 * Plenty of thread safety and Win32 work.
* Changed PHP4 to compile as a DLL, both ISAPI and the the CGI run with the same DLL.
* Switched to using the DLL runtime library under Win32.  PHP will NOT work if
  compiled against the static library!
* Removed yesterday's php4libts project (with php4dllts, it's obsolete).

This *does* affect thread-unsafe Windows as well - the thread unsafe CGI is also
dependant on the thread-unsafe DLL.
1999-04-26 14:00:49 +00:00
Andi Gutmans 050cb7cfe3 -Add .dsp file 1999-04-26 03:04:29 +00:00
Andi Gutmans df6134bc42 -More commits 1999-04-26 03:03:39 +00:00
Andi Gutmans 9c51acdc17 -More 1999-04-26 03:03:36 +00:00
Rasmus Lerdorf 5c09d8e616 Make GD config fail if it doesn't find the gd files 1999-04-25 23:29:52 +00:00
Sascha Schumann 1e54412bdc PHP3 compat stuff 1999-04-25 22:22:13 +00:00
Rasmus Lerdorf 8ffbed7d7e Ok, apxs build works nicely now 1999-04-25 22:16:44 +00:00
Sascha Schumann c62ffa7e01 oops, the 0th byte should be set, too 1999-04-25 21:50:24 +00:00
Sascha Schumann 77baa4ebb4 final change (?), add get_algorithms_name 1999-04-25 21:49:01 +00:00
Sascha Schumann 12a76342ed make code more compact 1999-04-25 21:32:52 +00:00
Sascha Schumann 5ed41f31af remove some redundant code 1999-04-25 21:24:07 +00:00
Sascha Schumann 5883d6c221 that was a silly one 1999-04-25 21:13:21 +00:00
Sascha Schumann 22d720e00c add OFB mode, the final one 1999-04-25 21:11:29 +00:00
Sascha Schumann a1a41504c7 add mcrypt_create_iv() 1999-04-25 21:09:07 +00:00
Zeev Suraski 23a1d3fb91 Win32 isn't a good os to commit uppercase files with... 1999-04-25 21:04:17 +00:00
Sascha Schumann 6b890309ef cleanup, add new stream mode, allow IV for CBC mode 1999-04-25 20:44:52 +00:00
Sascha Schumann 7d1ee82d79 add get_(key|block)_size 1999-04-25 20:32:15 +00:00
Andi Gutmans 10710c046d Ah, these too 1999-04-25 19:36:57 +00:00
Andi Gutmans 4ebb4060f9 * Fix a couple of thread safety issues
* Add initial ISAPI support.  Very very experimental.
* In the thread safe version, generate php4 as a library so that we can link it with both
php.exe and the ISAPI dll.  We should probably consider doing that under all circumstances,
under UNIX as well.

The thread-unsafe version *should* be unharmed.
1999-04-25 19:35:44 +00:00
Sascha Schumann 1db171deb8 add CBC 1999-04-25 17:04:56 +00:00
Sascha Schumann 11fc109ca6 add mcrypt module 1999-04-25 16:50:40 +00:00
Rasmus Lerdorf c4442ed7c5 Ok, this beast compiles via --with-apxs
Not sure if it actually works yet though.  I have a feeling there are
some -fpic flags missing in the libzend build.  Will test later on
today.
1999-04-25 14:10:23 +00:00
Sascha Schumann ac9c0d03e0 -f tests for plain files only. We need a way to find out whether we could do any damage to existing files. If we cannot write to them, we probably cannot do harmful things hopefully. 1999-04-25 14:08:41 +00:00
Thies C. Arntzen 9cace18e10 serialize & unserialize working (with mem-leak) 1999-04-25 12:41:18 +00:00
Rasmus Lerdorf 0704064cdf Argh! That typo took me over an hour to find. Grr.. 1999-04-25 04:03:36 +00:00
Andrey Hristov ef7a4db341 test -e fails in sh. Used test -f instead. 1999-04-25 00:55:01 +00:00
Sascha Schumann 6955cacb21 unreliable check whether cc option can be used really 1999-04-24 23:36:25 +00:00
Zeev Suraski 5974d84bc6 Fixes 1999-04-24 23:22:09 +00:00
Sascha Schumann a156a47187 security check and disclaimer for generated files 1999-04-24 22:16:06 +00:00
Rasmus Lerdorf 2d78e4779e Oops, would be a good idea to edit the .in file instead of acconfig.h 1999-04-24 21:55:44 +00:00
Rasmus Lerdorf ecc1dce8f5 libbind check 1999-04-24 21:52:53 +00:00
Sascha Schumann d558f56ba0 add function checks 1999-04-24 21:39:33 +00:00
Andrey Hristov 4aeb630539 Change cmp'risons to be cross-shell compatible. 1999-04-24 21:21:35 +00:00
Sascha Schumann 3b195581db bugfix port 1999-04-24 20:48:12 +00:00
Sascha Schumann bec518a62d port from PHP3 1999-04-24 20:43:58 +00:00
Sascha Schumann 8036c5fbf1 include some header files explicitly 1999-04-24 20:26:31 +00:00
Zeev Suraski c09e7de63a Use relative paths 1999-04-24 19:10:02 +00:00
Thies C. Arntzen d0d3316128 forward-port of php3-CVS version
my 1st zend-array stuff (ocifetchinto) is WORKING!!
1999-04-24 18:54:02 +00:00
Thies C. Arntzen 992e6a429d made var_dump zend-aware....
<?
$ar = array("hallo" => "tubu");

var_dump($ar);
?>
works again!!!

zeev, andi -> please review what i've done!!!

(no i can start "debugging" other stuff, as i often use var_dump)
1999-04-24 18:39:41 +00:00
Zeev Suraski 208e81696f Another small fix 1999-04-24 17:16:39 +00:00
Zeev Suraski 1ab3e00bc0 Add my API letters to the CVS 1999-04-24 16:57:46 +00:00
Zeev Suraski f6971f17a9 dsp update 1999-04-24 16:52:40 +00:00
Zeev Suraski 125275b084 Small fixes 1999-04-24 16:51:15 +00:00
Zeev Suraski 6ecc81c097 We'd have to find a different way of allowing timeouts in Win32 1999-04-24 16:17:04 +00:00
Zeev Suraski e06a1ed265 Thread safety fixes 1999-04-24 16:16:11 +00:00
Stig S. Bakken 3b516557f2 set up automake 1999-04-24 16:14:18 +00:00
Zeev Suraski 8dd4a63366 Remove redundant includes 1999-04-24 09:26:09 +00:00
Zeev Suraski cd07879f2d g++ compile fix 1999-04-24 09:08:03 +00:00
Zeev Suraski 1e9ce9528d *** empty log message *** 1999-04-24 09:01:30 +00:00
Zeev Suraski 5a5806e02a Cleanups, remove old ts code 1999-04-24 00:12:55 +00:00
Zeev Suraski 0818d96c97 A lot of cleanups... Removed old thread-safe code and other redundant code and files 1999-04-24 00:12:00 +00:00
Zeev Suraski 05d24c6022 Remove redundant code 1999-04-23 22:45:01 +00:00
Zeev Suraski 09946676d2 Thread-safe header_is_being_sent 1999-04-23 20:20:30 +00:00
Zeev Suraski 6f7c0edee3 Remove tls.[ch] 1999-04-23 20:06:01 +00:00
Zeev Suraski f53afa6edd cleanups 1999-04-23 19:50:29 +00:00
Zeev Suraski b2c5ef42d3 Arithmetics bug fix 1999-04-23 13:25:33 +00:00
Zeev Suraski bce60f0fe6 * MySQL fix (thanks Stig)
* Remove reundant includes from bcmath
1999-04-23 12:38:45 +00:00
Stig Bakken 94cde33459 use only EXTRA_LIBS 1999-04-23 12:11:37 +00:00
Zeev Suraski 43c9b540d7 Minor MySQL thread safety issues 1999-04-23 11:12:41 +00:00
Zeev Suraski 5be8dd9712 License 1999-04-23 11:00:02 +00:00
Zeev Suraski f9cdc88471 Testing unified diffs 1999-04-23 10:26:49 +00:00
Zeev Suraski a458b4f6bd Support eval() and highlight_string() in the C++ scanner 1999-04-23 10:21:00 +00:00
Andi Gutmans 01575b9d9d - Use yyless() instead of unput() where possible. I'll erase the commented
out code in a day or so.
1999-04-23 06:14:06 +00:00
Rasmus Lerdorf 7440bc50da Ok, finally.. These now work nicely on a RH-5.2 box:
--with-mysql --with-ldap --with-imap --with-zlib --with-snmp
1999-04-23 04:54:31 +00:00
Rasmus Lerdorf 806dfc2a76 Make zlib compile 1999-04-23 04:12:13 +00:00
Zeev Suraski 8a2f6371fe *** empty log message *** 1999-04-23 03:36:17 +00:00
Zeev Suraski 1aa2c5c0b4 Ok, call me crazy, because I probably am.
Thread safe version now uses a C++ scanner object.  Works fully.
1999-04-23 03:32:33 +00:00
Rasmus Lerdorf cad2318a54 Module work 1999-04-23 03:28:47 +00:00
Zeev Suraski 551fe7780b Make token names uniform, they all begin with T_ now. 1999-04-22 23:08:42 +00:00
Zeev Suraski 327fc20243 vpath fix 1999-04-22 22:28:17 +00:00
Rasmus Lerdorf af3f73f7a3 This is generated 1999-04-22 04:42:58 +00:00
Rasmus Lerdorf 77cdb5f483 Bring imap build rules up to date. We still have a problem here though.
In this new build structure we are adding libraries to $LIBS as we add
modules instead of doing an AC_SUBST into the Makefile.  One reason for
doing the subst in php3 was to get around the libraries that could not
be included in $LIBS because doing so would mess up the various configure
tests.  For example, you can't do a -limap as part of the various simple
configure compile programs because -limap requires a bunch of callback
symbols to be present.
1999-04-22 04:21:08 +00:00
Andi Gutmans 916692f4ad - Update the regular VC project file. 1999-04-22 03:58:37 +00:00
Stig Bakken e109756121 db was not linked in 1999-04-22 03:03:35 +00:00
Stig Bakken 09d047f8b1 db was not linked in 1999-04-22 03:01:32 +00:00
Stig Bakken 2c0ad3ee25 last bunch of extensions moving to ext/
fhttpd module taken out of functions, functions is ready to go.
The only extensions I have tested are gd+freetype and odbc(solid).
Please try compiling in your favourite extensions and let me know how it
works.
1999-04-22 02:48:28 +00:00
Stig Bakken 2a78f92804 moved imap and ldap 1999-04-22 00:45:14 +00:00
Stig Bakken ff37732997 moved fdf, hyperwave, informix and some smaller files 1999-04-22 00:25:57 +00:00
Stig Bakken f582bec9db moved db 1999-04-21 23:37:47 +00:00
Stig Bakken f9f82960d9 moved bcmath 1999-04-21 23:28:00 +00:00
Stig Bakken a297b95c9d moved apache, com and hyperwave into ext/ 1999-04-21 23:11:20 +00:00
Stig Bakken f67a9bdc52 moved dav, msql and oracle to ext/ 1999-04-21 22:49:16 +00:00
Stig Bakken 96660d9a8c moved filepro to ext 1999-04-21 22:11:15 +00:00
Stig Bakken 71c71a4732 moved filepro to ext 1999-04-21 22:05:45 +00:00
Stig Bakken 7d013383e9 mysql should work again now, can someone with mysql installed test it? 1999-04-21 21:34:57 +00:00
Stig Bakken 5d75ccdcff gd compile fix 1999-04-21 21:27:18 +00:00
Stig Bakken 3789ac7ea0 moving mysql to ext/ 1999-04-21 21:26:10 +00:00
Stig Bakken f9d169c812 create .cvsignore only once :-) 1999-04-21 21:13:40 +00:00
Stig Bakken 3a3e18728c create .cvsignore as well 1999-04-21 20:39:22 +00:00
Stig S. Bakken d9144155f5 state which aclocal.m4 and configure files are created 1999-04-21 20:33:33 +00:00
Stig Bakken 72c2d04d72 state which aclocal.m4 and configure files are created 1999-04-21 20:32:56 +00:00
Stig Bakken 8335a61d74 merge the object files in a temporary directory 1999-04-21 20:30:47 +00:00
Stig S. Bakken 1ee30e61fc zend-parser.o and zend-scanner.o were included twice in libzend.a 1999-04-21 20:30:37 +00:00
Zeev Suraski 942f409292 * Change the thread safe project to create a C++ scanner.
* Add in a slightly modified skeleton file (only a couple of #if's for #include's
that we dont have in Windows)

It does NOT compile or work yet :)
1999-04-21 20:13:02 +00:00
Zeev Suraski 1573412776 Thread safe project update 1999-04-21 19:40:16 +00:00
Stig Bakken 23280d0a75 added PHP_API_VERSION, simply set it to 19990421 for now 1999-04-21 19:39:21 +00:00
Zeev Suraski 937270f319 Fix 1999-04-21 19:10:54 +00:00
Zeev Suraski 7d34d425be Minor fixes 1999-04-21 19:10:18 +00:00
Zeev Suraski 751709a469 * Rename php_compat.[ch] to flock_compat.[ch] and move it to ext/standard
* Fix Win32 compilation
1999-04-21 19:01:38 +00:00
Sascha Schumann 065636be85 forgot that one 1999-04-21 18:10:39 +00:00
Sascha Schumann 08c6298af9 cleanup, flock() support 1999-04-21 18:10:18 +00:00
Sascha Schumann f06cb4deb6 crypt constants 1999-04-21 17:57:40 +00:00
Sascha Schumann 2873f446f2 cleanup 1999-04-21 17:48:11 +00:00
Zeev Suraski 7aad231327 Thread safety patch. It works now with just-in-time resource initialization! 1999-04-21 17:28:54 +00:00
Zeev Suraski a9f9ae7920 Thread safety patch. It works now with 'just in time' resource initialization! 1999-04-21 17:26:37 +00:00
Sascha Schumann 48e350a94d incorporate gettext support 1999-04-21 17:26:16 +00:00
Sascha Schumann dcc16af80c port some fixes, add compat routines 1999-04-21 17:11:01 +00:00
Sascha Schumann a6e4ef3e31 str_replace fix 1999-04-21 16:31:27 +00:00
Stig Bakken 9b3c1ca2c3 make config.h.stub as well 1999-04-21 16:23:47 +00:00
Stig Bakken 43ed903949 remove old libtool and automake stuff that was borrowed using 3.0 1999-04-21 15:52:42 +00:00
Zeev Suraski 52fcaa443b Thread-safe project 1999-04-21 15:35:57 +00:00
Zeev Suraski 763ed6a4fb Update thread-safe projects 1999-04-21 15:34:31 +00:00
Sascha Schumann 4908dbdf36 config.h.in is a generated file and should be ignored by CVS 1999-04-21 15:16:30 +00:00
Stig Bakken f8fe0ad29c move automake back to before autoconf 1999-04-21 14:07:07 +00:00
Stig S. Bakken a9d3d0832a move automake back to before autoconf 1999-04-21 14:06:58 +00:00
Stig Bakken 02f9dc6460 autoheader must be called after autoconf, automake after autoheader 1999-04-21 13:47:05 +00:00
Stig S. Bakken 9003b9a261 autoheader must be called after autoconf, automake after autoheader 1999-04-21 13:45:46 +00:00
Stig S. Bakken bb74a94fa5 think before one commits 1999-04-21 13:26:27 +00:00
Stig S. Bakken f68609b50f doh. cvs appears to ignore .in files by default 1999-04-21 13:24:39 +00:00
Sascha Schumann 8489ea5414 generates basic skeleton for new extension 1999-04-21 10:24:41 +00:00
Zeev Suraski c5af324ec3 More thread safety work 1999-04-21 04:02:11 +00:00
Zeev Suraski 7a87fcbbda Thread safety patch. We're still not quite there but it compiles again, and
more logic has been implemented.
1999-04-21 03:49:09 +00:00
Zeev Suraski 37fe04b887 Thread Safe Resource Manager 1999-04-20 23:58:02 +00:00
Stig Bakken b84ce5a06a added ext/*/config.h.stub files
removed config.h.in (generated)
1999-04-20 01:23:32 +00:00
Stig S. Bakken 9e4c7bd56c Makefile.in and aclocal.m4 are generated
added buildconf script
1999-04-20 01:12:53 +00:00
Stig Bakken 54468d2e75 odbc compiles and runs on UNIX again (tested with Solid 2.3) 1999-04-20 01:03:12 +00:00
Zeev Suraski b7c30c1bdf Return a success value from the startup function, so we can unload immediately
if it fails.
1999-04-19 21:39:18 +00:00
Stig Bakken 84e9ea1726 convert libzend to automake 1999-04-19 20:11:50 +00:00
Stig S. Bakken b227e385cc convert to automake 1999-04-19 20:10:26 +00:00
Andi Gutmans 5033ee7d69 Rearrange the .dsp for the new ODBC layout 1999-04-19 18:57:29 +00:00
Andi Gutmans 9deab4118d Add a couple of ZEND_API's 1999-04-19 18:57:14 +00:00
Stig Bakken a2d8219e2c ignore acconfig.h 1999-04-19 17:36:25 +00:00
Stig Bakken edf17b2a8f include the right header files 1999-04-19 17:24:25 +00:00
Stig Bakken 7d9c4da459 generate acconfig.h from acconfig.h.in and ext/*/config.h.stub 1999-04-19 17:19:37 +00:00
Andi Gutmans dd03a7a2f3 Support =unset as arguments 1999-04-19 16:28:05 +00:00
Stig Bakken 7dee737fb4 moved odbc into ext/ 1999-04-19 15:04:11 +00:00
Stig Bakken aac5a43123 keep old files if they are not modified 1999-04-19 13:58:54 +00:00
Stig Bakken 269877fdf3 moved dbase into ext/ 1999-04-19 13:58:31 +00:00
Stig Bakken 6094128afe moved dbase into ext/ along with the bundled library
dbase programs are no longer included
1999-04-19 13:56:50 +00:00
Stig S. Bakken b515f34dd1 removed -lnsl and -lsocket checks from zend 1999-04-19 13:51:13 +00:00
Stig Bakken 3912318923 run automake and run autoconf in libzend 1999-04-19 08:07:20 +00:00
Zeev Suraski 1390eadc14 Ah, so that file is generated too 1999-04-18 20:59:54 +00:00
Zeev Suraski 1ae9891e7e AiCount needs to be decreased here 1999-04-18 19:55:42 +00:00
Zeev Suraski cc5e008b72 * Added buildconf, runs all the scripts necessary to build configure (Stig - if there's any way
to detect whether we need to run 'automake --add-missing', please add it...)
* Make vpath work again
* Minor UNIX bugfixes
1999-04-18 18:06:54 +00:00
Zeev Suraski 5e8c322859 Make Win32 happy with the recent changes. 1999-04-18 15:58:27 +00:00
Zeev Suraski f432c05c3f Forgot to add these - Win32 registry support 1999-04-18 15:54:18 +00:00
Zeev Suraski 342c6e0b23 Whatnot:
* updated alloc_persist to use critical sections
* changed extension shutdown to two-phase
* updated dependencies
* PR support (don't remember if there was any really)
1999-04-18 15:11:52 +00:00
Zeev Suraski 2e8fb4e329 Win32 registry support 1999-04-18 15:09:46 +00:00
Andi Gutmans 593e603e4b - Make gettype() behave like it used to where it returned "object" for
objects.
1999-04-17 07:02:58 +00:00
Stig Bakken 1e2474b18c Apache module compiles again 1999-04-17 02:01:20 +00:00
Stig Bakken f4f53c850a this file is now generated 1999-04-17 01:54:27 +00:00
Stig Bakken 4f7b0a0ccd make sure the images on the phpinfo() page point to PHP-enabled pages 1999-04-17 01:52:58 +00:00
Stig Bakken af88aa5474 ignore configure.in 1999-04-17 00:43:47 +00:00
Stig Bakken 74fb12efd5 this file is now generated 1999-04-17 00:43:21 +00:00
Stig Bakken 257de2bade First commit of re-structuring phase one. We have started using automake in
sub-directories and started to move extension code into ext/<name>.  For now,
I have moved the "standard" extension (which is quite a mix of everything
right now) and the GD extension into their own subdirs in ext/.
The configure script now also runs configure in the libzend directory
automatically and makes sure php4 and libzend use the same config.cache file.
To avoid running configure in libzend, use the --no-recursion option.
"make" in php4 also builds libzend now.
The Apache module doesn't compile right now, but a fix for that is
coming up.
1999-04-17 00:37:12 +00:00
Stig Bakken 2127ede122 updated GD from php3 repository, using it as a test extension for the new
directory structure
1999-04-16 12:15:38 +00:00
Andi Gutmans 8cf2d74b76 - Make the memory leak message print PHP4. 1999-04-16 08:12:51 +00:00
Andi Gutmans b32b2831d8 - one more place which seems to have needed fixing. I don't have time to look
more into it. I hope we don't have anymore places which need fixing.
1999-04-15 17:43:16 +00:00
Andi Gutmans 3d631c4ca0 - Should fix the pass by reference problem. This happened because we moved
start from arg 1 now and not arg 0. There might be more places which need fixing
 like in the executor but the bug seems OK now.
1999-04-15 17:41:21 +00:00
Zeev Suraski fa76f0c903 Compile fix 1999-04-14 21:03:25 +00:00
Andi Gutmans 39f9487ee1 -Tiny patches 1999-04-14 19:53:33 +00:00
Zeev Suraski 76ceb9ad44 Better detection 1999-04-13 22:09:59 +00:00
Zeev Suraski 7c2155c1ad Move Ai stuff before get_zval_*(), like Andi suggested. Fixes Sascha's huge
memory leak
1999-04-13 20:50:31 +00:00
Andi Gutmans e1e2226b92 - Fix various memory leaks. 1999-04-13 19:28:03 +00:00
Andi Gutmans d86ed8207c Refcount bugfix 1999-04-13 17:49:14 +00:00
Andi Gutmans 3fcc6511f6 * Optimize argument_stack top lookup
* Fix a nasty bug in zend_ptr_stack_clean()
1999-04-13 17:03:10 +00:00
Zeev Suraski 533f135987 Remove unnecessary stack 1999-04-12 21:50:49 +00:00
Zeev Suraski ad9b13eb9e off by one 1999-04-12 21:06:29 +00:00
Zeev Suraski 1dff49ec83 Minor optimization 1999-04-12 20:49:02 +00:00
Zeev Suraski 3ca6d6113a Make functions that don't take arguments somewhat happier:) 1999-04-12 19:44:47 +00:00
Zeev Suraski 714f450a00 This should take care of "this" for user-defined functions. It wasn't yet working
for built-in functions anyway, this one is coming soon.
1999-04-12 19:40:48 +00:00
Zeev Suraski 0666083907 NULL's should remain NULLs (at least in strings) 1999-04-12 19:40:33 +00:00
Zeev Suraski 15be5f0b4a Destroy the resource list after destroying the symbol table, otherwise the
auto-destructor for resources are run when the resource list is no longer valid
1999-04-12 18:40:18 +00:00
Zeev Suraski 39a7f4c306 This patch is a go. Not fully optimized yet, but working properly.
Prepatch tagged as BEFORE_STACK_PATCH.
1999-04-12 18:29:09 +00:00
Zeev Suraski b06c5731fc Minor fixes:
missing zval_copy_ctor()
	messed up AiCount fix
1999-04-12 17:59:36 +00:00
Stig Bakken 4213b5d6b6 tolerate uninitialized ini settings in php_ini_{long,double,string}() 1999-04-12 16:35:25 +00:00
Sascha Schumann 483caf3669 This should help in keeping PHP4 up to date 1999-04-12 04:05:50 +00:00
Zeev Suraski 4869bd3bfc Test patch... 1999-04-10 21:39:23 +00:00
Zeev Suraski 3b53a8ad0f test patch 1999-04-10 21:34:53 +00:00
Zeev Suraski 1c23f75627 Oops 1999-04-10 21:30:49 +00:00
Zeev Suraski 4b98f345d1 php3_ini? What's that? 1999-04-10 17:39:08 +00:00
Zeev Suraski bb6dff9c67 Buh-bye php3_ini 1999-04-10 16:25:23 +00:00
Zeev Suraski 4472d05025 Allow runtime setting of the memory limit 1999-04-10 16:24:28 +00:00
Zeev Suraski 2e9886de3c Get rid of php3_ini in Zend 1999-04-10 14:44:35 +00:00
Zeev Suraski e3d2234b80 A lot of php3_ini -> php_ini work 1999-04-10 13:32:47 +00:00
Zeev Suraski 79f9f0ce88 Move safe_mode to the new php_ini mechanism 1999-04-10 12:17:20 +00:00
Zeev Suraski 7685b44c4b Move asp_tags and short_open_tag to the new php_ini mechanism 1999-04-10 11:22:18 +00:00
Zeev Suraski 7656c77c38 We need to initialize the utility values after we initialize the INI file, which in
turn, is after we initialize Zend.  Set the utility values separately from Zend's
initialization
1999-04-10 11:21:55 +00:00
Zeev Suraski 4fd1d5b81b * php_ini fixes
* convert the MySQL module to use the new php_ini mechanism
1999-04-10 00:19:33 +00:00
Zeev Suraski d40e88a016 Apache php_ini support 1999-04-09 21:15:07 +00:00
Zeev Suraski e95ebe0453 testing 123 1999-04-09 21:10:11 +00:00
Zeev Suraski f92db069c3 test, ignore 1999-04-09 21:08:34 +00:00
Zeev Suraski 651e232f04 Testing 123 1999-04-09 21:04:12 +00:00
Andi Gutmans 906dc43ed7 - Changed here-docs to <<< followed by whitespace. 1999-04-09 20:47:29 +00:00
Zeev Suraski f8ef66d1a4 *** empty log message *** 1999-04-09 20:12:46 +00:00
Zeev Suraski b6f5873260 Get the apache module to compile 1999-04-09 19:51:47 +00:00
Zeev Suraski 011813cce8 *** empty log message *** 1999-04-09 19:16:46 +00:00
Stig S. Bakken 763061bbea ignore file 1999-04-09 19:11:00 +00:00
Zeev Suraski 3e58450513 * A lot of work on php_ini stuff
* A lot of work on getting rid from php3_ini
1999-04-09 19:09:29 +00:00
Andi Gutmans 5cb576d81a - I guess print $GLOBALS and print "$GLOBALS" should yield the same result
so I returned the one in encaps_var.
- Made INITAL_OP_ARRAY_SIZE smaller (64? can't remeber). I don't think the
  erealloc()'s during compile time are such a biggy, we might make it even
  smaller. We can have a configure time option as to it's size.
1999-04-09 15:18:29 +00:00
Andi Gutmans 2d7b9b038d - Support $GLOBALS in cvar's. Now list(..) = each($GLOBALS) will work.
- Remove support of $GLOBALS in enacapsed strings. print "$GLOBALS" isn't
  supposed to work in any case.
1999-04-09 15:01:13 +00:00
Zeev Suraski 43c0e94ac9 Honor a semicolon on the same line as an ending token of a heredoc 1999-04-09 11:19:03 +00:00
Zeev Suraski 0a6e9ddd7f Prevent class redeclarations 1999-04-09 10:59:58 +00:00
Zeev Suraski 3edb99e8ac Type library support in COM module 1999-04-08 23:14:56 +00:00
Zeev Suraski 6a97e1662d * Add arguments to shutdown function
* Bring php_ini uptodate
1999-04-08 21:32:57 +00:00
Zeev Suraski 9d8e0db38f * Add arguments to shutdown functions
* Remove traces of php_ini stuff
1999-04-08 21:14:50 +00:00
Zeev Suraski f2d5ca7482 "Our favourite mistake" 1999-04-08 20:27:08 +00:00
Zeev Suraski 17bdb70823 $GLOBALS support 1999-04-08 20:21:36 +00:00
Zeev Suraski 9d1a9331b3 Fix for php -v 1999-04-08 14:55:42 +00:00
Stig Bakken a12d0a1c1c patched in fsock.c from php3 1999-04-08 08:57:09 +00:00
Kristian Köhntopp 22335a4ec7 Spurious $ removed in Makefile.in 1999-04-08 08:23:37 +00:00
Andi Gutmans 893160fcbe foreach() syntax has changed 1999-04-08 04:11:23 +00:00
Zeev Suraski 135da4b4fc Fix static assignment 1999-04-08 00:18:29 +00:00
Stig Bakken d0738c2bc3 get rid of extra and doc dirs, more cvs ignore stuff 1999-04-08 00:04:44 +00:00
Stig Bakken 9bc17ac6b2 fix configure warnings 1999-04-07 23:59:51 +00:00
Zeev Suraski d1d96d04c6 Remove an unused variable 1999-04-07 23:09:09 +00:00
Zeev Suraski 18402e05b9 Update deps 1999-04-07 21:20:42 +00:00
Zeev Suraski 882bbf6f45 Win32 patches 1999-04-07 21:19:35 +00:00
Zeev Suraski 694d94983b That's better. 1999-04-07 21:14:10 +00:00
Zeev Suraski aceaabceff PHP 4.0 1999-04-07 21:05:13 +00:00
Zeev Suraski d94f3e22ae We didn't save the .dsp back then... 1999-04-07 21:00:45 +00:00
Zeev Suraski d9c4871592 Cleanups: ZendCore->libzend 1999-04-07 20:30:03 +00:00
Rasmus Lerdorf a6043d3e1e *** empty log message *** 1999-04-07 18:18:16 +00:00
Andi Gutmans 573b46022c Zend Library 1999-04-07 18:10:10 +00:00
SVN Migration f70a4db647 Standard project directories initialized by cvs2svn. 1999-04-07 18:10:10 +00:00
626 changed files with 158219 additions and 564 deletions

No files matched your search

+149
View File
@@ -0,0 +1,149 @@
PHP Coding Standards
====================
This file lists several standards that any programmer, adding or changing
code in PHP, should follow. Since this file was added at a very late
stage of the development of PHP v3.0, the code base does not (yet) fully
follow it, but it's going in that general direction.
This is an initial version - it'll most probably grow as time passes.
Code Implementation
-------------------
[1] Functions that are given pointers to resources should not free them
For instance, function int mail(char *to, char *from) should NOT free
to and/or from.
Exceptions:
- The function's designated behavior is freeing that resource. E.g. efree()
- The function is given a boolean argument, that controls whether or not
the function may free its arguments (if true - the function must free its
arguments, if false - it must not)
- Low-level parser routines, that are tightly integrated with the token
cache and the bison code for minimum memory copying overhead.
[2] Functions that are tightly integrated with other functions within the
same module, and rely on each other non-trivial behavior, should be
documented as such and declared 'static'. They should be avoided if
possible.
[3] Use definitions and macros whenever possible, so that constants have
meaningful names and can be easily manipulated. The only exceptions
to this rule are 0 and 1, when used as false and true (respectively).
Any other use of a numeric constant to specify different behavior
or actions should be done through a #define.
[4] When writing functions that deal with strings, be sure to remember
that PHP holds the length property of each string, and that it
shouldn't be calculated with strlen(). Write your functions in a such
a way so that they'll take advantage of the length property, both
for efficiency and in order for them to be binary-safe.
Functions that change strings and obtain their new lengths while
doing so, should return that new length, so it doesn't have to be
recalculated with strlen() (e.g. _php3_addslashes())
[5] Use php3_error() to report any errors/warnings during code execution.
Use descriptive error messages, and try to avoid using identical
error strings for different stages of an error. For example,
if in order to obtain a URL you have to parse the URL, connect,
and retreive the text, assuming something can go wrong at each
of these stages, don't report an error "Unable to get URL"
on all of them, but instead, write something like "Unable
to parse URL", "Unable to connect to URL server" and "Unable
to fetch URL text", respectively.
[6] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
check its man page again, and only then, consider using it, and even then,
try avoiding it.
Naming Conventions
------------------
[1] Function names for user functions implementation should be prefixed with
"php3_", and followed by a word or an underscore-delimited list of words,
in lowercase letters, that describes the function.
[2] Function names used by user functions implementations should be prefixed
with "_php3_", and followed by a word or an underscore-delimited list of
words, in lowercase letters, that describes the function. If applicable,
they should be declared 'static'.
[3] Variable names must be meaningful. One letter variable names must be
avoided, except for places where the variable has no real meaning or
a trivial meaning (e.g. for (i=0; i<100; i++) ...).
[4] Variable names should be in lowercase; Use underscores to seperate
between words.
Syntax and indentation
----------------------
[1] Never use C++ style comments (i.e. // comment). Always use C-style
comments instead. PHP is written in C, and is aimed at compiling
under any ANSI-C compliant compiler. Even though many compilers
accept C++-style comments in C code, you have to ensure that your
code would compile with other compilers as well.
The only exception to this rule is code that is Win32-specific,
because the Win32 port is MS-Visual C++ specific, and this compiler
is known to accept C++-style comments in C code.
[2] Use K&R-style. Of course, we can't and don't want to
force anybody to use a style she's not used to, but
at the very least, when you write code that goes into the core
of PHP or one of its standard modules, please maintain the K&R
style. This applies to just about everything, starting with
indentation and comment styles and up to function decleration
syntax.
[3] Be generous with whitespace and braces. Always prefer
if (foo) {
bar;
}
to
if(foo)bar;
Keep one empty line between the variable decleration section and
the statements in a block, as well as between logical statement
groups in a block. Maintain at least one empty line between
two functions, preferably two.
Documentation and Folding Hooks
-------------------------------
In order to make sure that the online documentation stays in line with
the code, each user-level function should have its user-level function
prototype before it along with a brief one-line description of what the
function does. It would look like this:
/* {{{ proto int abs(int number)
Return the absolute value of the number */
void php3_abs(INTERNAL_FUNCTION_PARAMETERS) {
...
}
/* }}} */
The {{{ symbols are the default folding symbols for the folding mode in
Emacs. vim will soon have support for folding as well. Folding is very
useful when dealing with large files because you can scroll through the
file quickly and just unfold the function you wish to work on. The }}}
at the end of each function marks the end of the fold, and should be on
a separate line.
The "proto" keyword there is just a helper for the doc/genfuncsummary script
which generates a full function summary. Having this keyword in front of the
function prototypes allows us to put folds elsewhere in the code without
messing up the function summary.
Optional arguments are written like this:
/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
And yes, please keep everything on a single line, even if that line is massive.
+3
View File
@@ -0,0 +1,3 @@
For the list of people who've put work into PHP 4.0, please see
http://www.php.net/version4/credits.php
+217
View File
@@ -0,0 +1,217 @@
PHP 4.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? 1999, Version 4.0 Beta 3
- Added '--disable-rpath' option (Sascha)
- Added AOLserver SAPI module (Sascha)
- Fixed XML Callbacks. (Thies)
- Updated ODBC to use the new high-performance Zend function API (kara)
- Updated zlib to use the new high-performance Zend function API. (Stefan)
- Updated preg_split() to allow returning only non-empty pieces (Andrei)
- Updated PCRE to use the new high-performance Zend function API (Andrei)
- Updated session, dba, mhash, mcrypt, sysvshm, sysvsem, gettext modules to use
the new high-performance Zend function API (Sascha)
- Extended var_dump to handle resource type somewhat (Andrei)
- Updated WDDX to use the new high-performance Zend function API (Andrei)
- Updated XML to use the new high-performance Zend function API. (Thies)
- Updated Oracle to use the new high-performance Zend function API. (Thies)
- Improved the performance of the MySQL module significantly by using the new
high-performance Zend function API. (Zeev)
- Add support for the Easysoft ODBC-ODCB Bridge (martin@easysoft.com)
- Fix bug in odbc_setoption, getParameter call incorrect (martin@easysoft.com)
- Ora_Fetch_Into now resets the returned array in all cases (Thies)
- Fixed NULL-Column problem in Oracle-Driver (Thies)
- Added extra metadata functions to ODBC, SQLTables etc (nick@easysoft.com)
- Fixed SEGV in mcal make_event_object() and
typo in mcal_list_alarms() (Andrew Skalski)
- Fixed Ora_PLogon (Thies)
- Resourcified Oracle (Thies)
- Implemented object serialization/deserialization in WDDX (Andrei)
- Added krsort() function (Thies)
- Added func_num_args(), func_get_arg() and func_get_args() for standard
access to variable number of arguments functions (Zeev)
- Added FTP support (Andrew Skalski)
- Added optional allowable_tags arguments to strip_tags(), gzgetss() and
fgetss() to allow you to specify a string of tags that are not to be
stripped (Rasmus)
- Upgraded var_dump() to take multiple arguments (Andrei)
- Resourcified XML (Thies)
- Fixed a memory leak in the Apache per-directory directives handler (Zeev)
- Added array_count_values() function. (Thies)
- snmp, pgsql, mysql and gd modules can be built as dynamically loaded
modules (Greg)
- OCI8 fix for fetching empty LOBs (Thies)
- Added user-level callbacks for session module (Sascha)
- Added support for unknown POST content types (Zeev)
- Added "wddx" serialization handler for session module (Sascha)
(automatically enabled, if you compile with --with-wddx)
- Fixed unserializing objects (Thies)
- PHP 4.0 now serializes Objects as 'O' (not understood by PHP 3.0), but
unserializes PHP 3.0 serialized objects as expected. (Thies)
- Made serialize/unserialize work on classes. If the class is known at
unserialize() time, you'll get back a fully working object! (Thies)
- Reworked preg_* functions according to the new PCRE API, which also made
them behave much more like Perl ones (Andrei)
- Made it possible to specify external location of PCRE library (Andrei)
- Updated bundled PCRE library to version 2.08 (Andrei)
- count()/is_array/is_object... speedups. (Thies)
- OCI8 supports appending and positioning when saving LOBs (Thies)
- Added metaphone support (Thies)
- OCI8 doesn't use define callbacks any longer. (Thies)
- OCI8 Driver now supports LOBs like PHP 3.0. (Thies)
- var_dump now dumps the properties of an object (Thies)
- Rewrote the GET/POST/Cookie data reader to support multi-dimensional
arrays! (Zeev)
- Renamed allow_builtin_links to expose_php (defaults to On). This directive
tells PHP whether it may expose its existence to the outside world, e.g.
by adding itself to the Web server header (Zeev)
- Added support for transparent session id propagation (Sascha)
- Made WDDX serialize object properties properly (Andrei)
- Fixed WDDX mem leak when undefined variable is passed in
for serialization (Andrei)
- Added session_unset() function (Andrei)
- Fixed double session globals shutdown crash (Andrei)
- Fixed crash related to ignore_user_abort ini entry (Andrei)
- Added support for external entropy sources for session id creation
(on Unices /dev/random and /dev/urandom) (Sascha)
- Added gpc_globals variable directive to php.ini. By default it is On, but
if it is set to Off, GET, POST and Cookie variables will not be inserted
to the global scope. Mostly makes sense when coupled with track_vars (Zeev)
- Added versioning support for shared library (Sascha)
This allows concurrent use of PHP 3.0 and PHP 4.0 as Apache modules. See
the end of the INSTALL file for more information.
- Added second parameter to array_keys which specifies search value
for which the key should be returned (Andrei)
- Resourcified Informix driver (Danny)
- New resource handling for odbc, renamed to php_odbc.[ch]
- Make set_time_limit() work on Unix (Rasmus)
- Added connection handling support (Rasmus)
- Improved the Sybase-CT module to make use of resources (Zeev)
- Improved the mSQL module to make use of resources (Zeev)
- Changed mysql_query() and mysql_db_query() to return false in case of saving
the result set data fails (Zeev)
- Improved the resource mechanism - resources were not getting freed as soon
as they could (Zeev)
- Added shared memory module for session data storage (Sascha)
- Fixed session.auto_start (Sascha)
- Fixed several problems with output buffering and HEAD requests (Zeev)
- Fixed HTTP Status code issue with ISAPI module (Zeev)
- Fixed a problem that prevented $GLOBALS from working properly (Zeev, Zend
library)
- Ported newest GetImageSize (Thies)
- Added session compile support in Win32 (Andi)
- Added -d switch to the CGI binary that allows overriding php.ini values
from the command line (Zeev)
- Fixed a crash that would occur if wddx_deserialize did not receive
a valid packet (Andrei)
- Fixed a bugglet when redefining a class at run-time (Andi, Zend library)
- Fixed sem_get() on AIX (Sascha)
- Fixed fopen() to work with URL's in Win32 (Andi & Zeev)
- Fixed include_path for Win32 (Andi, Zend library)
- Fixed bug in ISAPI header sending function (Charles)
- Fixed memory leak when using undefined values (Andi & Zeev, Zend library)
- Added output_buffering directive to php.ini, to enable output buffering
for all PHP scripts - default is off (Zeev).
- Fixed some more class inheritance issues (Zeev, Zend library)
- Fixed Apache build wrt to shared modules on FreeBSD/Linux (Sascha)
- Added session.extern_referer_chk which checks whether session ids were
referred to by an external site and eliminates them (Sascha)
- Improved session id generation (Sascha)
- Improved speed of uniqid() by using the combined LCG and removing
the extra usleep() (Sascha)
- Introduced general combined linear congruential generator (Sascha)
- Made ldap_close back into an alias for ldap_unbind (Andrei)
- OciFetchInto now resets the returned array in all cases (Thies)
- Fixed mysql_errno() to work with recent versions of MySQL (Zeev)
- Fixed a problem with define() and boolean values (Zeev)
- Fixed inclusion of gd/freetype functions (Sascha)
- Fixed persistency of MHASH_* constants (Sascha)
- Oracle is now ZTS-Safe (Thies)
- Fixed flushing of cached information to disk in DBA's DB2 module (Sascha)
- OCI8 is now ZTS-Safe (Thies)
- Fixed is_writeable/is_writable problem; they are both defined now (Andrei)
- Imported PHP 3.0 diskfreespace() function (Thies)
- Fixed thread-safety issues in the MySQL module (Zeev)
- Fixed thread-safe support for dynamic modules (Zeev)
- Fixed Sybase CT build process (Zeev)
August 9 1999, Version 4.0 Beta 2
- Fixed a problem when sending HTTP/1.x header lines using header() (Zeev)
- Win32 builds now include the ODBC module built-in (Zeev)
- Fixed SYSV-SHM interface (Thies).
- Updated hyperwave module, made it thread safe
- Updated pdflib module, version 0.6 of pdflib no longer supported
- Updated fdf module
- Built-in phpinfo() links are now turned off by default. They can be turned
on using the allow_builtin_links INI directive (Zeev)
- Changed phpinfo() to list modules that have no info function (Zeev)
- Modified array_walk() function so that the userland callback is passed
a key and possible user data in addition to the value (Andrei)
- Fixed ldap_search(), ldap_read() and ldap_list() (Zeev)
- Fixed Apache information in phpinfo() (sam@breakfree.com)
- Improved register_shutdown_function() - you may now supply arguments that
will be passed to the shutdown function (Zeev)
- Improved call_user_func() and call_user_method() - they now support passing
arguments by reference (Zeev)
- Fixed usort() and uksort() (Zeev)
- Fixed md5() in the Apache module (Thies)
- Introduced build process for dynamic modules (Stig)
- Improved ISAPI module to supprt large server variables (Zeev)
- Imported PHP 3.0 fixes for problem with PHP as a dynamic module and Redhat
libc2.1 in zlib module (Stefan)
- Fixed sybase_fetch_object() (Zeev)
- Made the IMAP module work with PHP 4.0 (Zeev)
- Fixed a problem with include()/require() of URLs (Sascha, Zeev)
- Fixed a bug in implode() that caused it to corrupt its arguments (Zeev)
- Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name")
(Andi & Zeev)
- Fixed various inheritance problems (Andi & Zeev, Zend library)
- Children now inherit their parent's constructor, if they do not supply a
constructor of their own.
- Fixed runtime inheritance of classes (parent methods/properties were
overriding their children) (Zeev, Zend library)
- Fixed backwards incompatibility with the "new" operator (Andi, Zend library)
- Fixed bugs in uksort() and ksort() sort ordering (Andrei)
- Fixed a memory leak when using assignment-op operators with lvalue of type
string (Zeev, Zend library)
- Fixed a problem in inheritance from classes that are defined in include()d
files (Zeev, Zend library)
- Fixed a problem with the PHP error handler that could result in a crash
on certain operating systems (Zeev)
- Apache php_flag values only recognized 'On' (case sensitive) - changed
to case insensitive (Zeev)
- Fixed a memory leak with switch statement containing return statements
(Andi & Zeev, Zend library)
- Fixed a crash problem in switch statements that had a string offset
as a conditional (Andi & Zeev, Zend library)
- Imported PHP 3.0 fixes for rand() and mt_rand() (Rasmus)
- Added function entries for strip_tags() and similar_text() (Andrei)
- Fixed a bug in WDDX that would cause a crash if a number was passed in
instead of a variable name (Andrei)
- Ported strtotime() function from PHP 3.0 (Andrei)
- Merged in gdttf stuff from PHP 3.0 (Sascha)
- buildconf now checks your installation (Stig)
- XML module now built dynamically with --with-xml=shared (Stig)
- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev)
- Fixed array_walk() to work in PHP 4.0 (Andrei)
- Ported all remaining date() format options from PHP 3.0 (Andrei)
- $php_errormsg now works (Andrei)
- Added locale support for Perl Compatible Regexp functions (Andrei)
- Informix module ported (Danny)
- Removed --with-shared-apache (Sascha)
- Added patch for reverse lookup table in base64_decode (Sascha)
Submitted by bfranklin@dct.com
- Merged in PHP 3.0 version of str_replace (Sascha)
- Added DBA module (Sascha)
- Added session id detection within REQUEST_URI (Sascha)
- Merged in HP-UX/ANSI compatibility switch from PHP 3.0 (Sascha)
- Fixed rpath handling for utilitites built during Apache build (Sascha)
- Added missing E_ error level constants (Zeev, Zend library)
- Fixed a bug in sending multiple HTTP Cookies under Apache (Zeev)
- Fixed implicit connect on the MySQL, mSQL, PostgreSQL and Sybase
modules (Zeev)
- Gave PHP 4.0's SNMP extension all the functionality of PHP 3.0.12 (SteveL)
July 19 1999, Version 4.0 Beta 1
- First public beta of PHP 4.0
+860
View File
@@ -0,0 +1,860 @@
PHP 3.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
December 24 1998, Version 3.0.6
- Fix GetImageSize() to work with non-standard jpg images
- Add Mersenne Twister functions (mt_rand, mt_srand, etc)
- Add str_replace() function
- Add chunk_split() function
- Fixed a bug in the memory limit code, in cases where $php_errormsg was
also used.
- Add iptcparse() function
- Adobe FDF supported
- getallheaders() NULL string fix <michale@utko.fee.vutbr.cz>
- Add all configuration directives to phpinfo() page
- Functions pack() and unpack() rewritten to be binary and buffer overrun
safe and behave like the Perl functions for all implemented format codes.
- Ensured that msql_error() will not return error messages generated by
previously-run scripts.
- Add base_convert() function
- Make sprintf() and printf() output binary safe
- Made gzgetc binary safe
- Add convert_cyr_string() and quoted_printable_decode() functions
- Fix ldap_free_result() core dump bug
- Add support for current OpenLDAP-2.0-devel library
- Add php3_asp_tags directive so it can be set from Apache config files
- Added UTF-8 support in the XML extension
- Make rand(min,max) safer on older platforms where the low-order bits have
short cycles.
- Added new pdf (Portable Document Format) module
- Added an XML parsing extension using James Clark's "expat" library
- Optimized parts of the token cache code.
- Terminate on out-of-memory errors. Until now, PHP could crash in out of
memory situations (clean-up, no real effect).
- Unterminated comments in include files were being reported with the wrong line
number. Fixed.
- Added ImageCopy() and ImageColorDeallocate(). ImageCopy() is about
20% faster than ImageCopyResized(). ImageColorDeallocate() marks
palette entries free for reuse (by <mka@satama.com>).
- In the CGI version, it was impossible to access resources (e.g. SQL links,
images) from user-defined shutdown functions. Fixed.
- Added optional third parameter to strpos() to specify the offset to
start searching from.
- Fixed a crash bug in unset() when unsetting illegal variables (rare).
- Made ImageInterlace and ImageTransparentColor parameters optional, and made
them return the current/new settings.
- Optimized GetImageSize() <thies@digicol.de>.
- Made odbc_autocommit() without args return status
- Added connect workaround for OpenLink ODBC
- Added minimal InterBase support. Tested only on 4.0 & Linux.
- Fixed some memory leaks and bogus error messages in the URL handler of
the various file open functions. Should only affect error handling
in bad URLs.
October 5 1998 Version 3.0.5
- mysql_field_flags now reports all MySQL flags and the result is suitable
for automatic parsing. Compatibility warning: The result format has
changed. If you have scripts parsing the result of this function, you
may need to adapt them.
- Made nl2br() binary safe (not that it's of much use).
- Fixed a bug in the API function getThis(). It affected mostly the dir
functions, if nested within objects.
- Fixed a problem in require() in conjunction with switch(), and in some other
cases. Also fixed an identical problem with the call_user_function() API
function.
- Removed -lpthread when compiling with MySQL support. It caused various
serious problems when compiled into Apache.
- Add serialize() and unserialize() functions from jkl@njet.net
- Fix in_addr_t check for systems with in_addr_t in netinet/in.h
- Add atan2() function
September 22 1998 Version 3.0.4
- Added uksort() - array key sort using a user defined comparison function.
- Added 'j' support to date() - generates the day of the month, without
possible leading zeros.
- Added support for multiple crypt() encryptions if the system supports it
- Added optional support for ASP-style <% %> and <%= tags
- Fixed data loss problems with very large numeric array indices on 64-bit
platforms (e.g. DEC UNIX).
- 2 cursor_type parameters for ifx_query() and ifx_prepare changed
to 1 (bitmask). Added a few constants for use in Informix module.
- Added php3.ini option ifx.charasvarchar. If set, trailing blanks
are stripped from fixed-length char columns. (Makes life easier
for people using Informix SE.)
- Static SNMP module which compiles with ucd-snmp 3.5.2
- fixed imap_header & header_info from crashing when a header line
is > 1024 characters.
- Added patch for rfc822_parse_adr to return an array of objects instead
of a single object.
- Informix Online 7.x & SE 7.x support now fairly complete and stable
- Add dbase_get_record_with_names() function
- Added a special case for open_basedir. When open_basedir is set to "."
the directory in which the script is stored will be used as basedir.
- Include alloca.c in the distribution for platforms without alloca().
- Improved stripping of URL passwords from error messages - the length of the
username/password isn't obvious now, and all protocols are handled properly
(most importantly, http).
- Copying objects that had member functions with static variables produced
undetermined results. Fixed.
- Added function lstat() and cleaned up the status functions,
added tests for file status functions (this may break on some plattforms)
- Fixed is_link() - it was returning always false.
- Fixed apache_note() - it was corrupting memory.
- New Function. void get_meta_tags(string filename); Parses filename until
closing head tag and turns all meta tags into variables prefixed with 'meta_'.
The below meta tag would produce $meta_test="some string here"
<meta name="test" content="some string here">
- Generalized some internal functions in order to better support calling
user-level functions from C code. Fixes a few sporadic problems related
to constructors inside eval() and more.
- Fixed an endless loop in explode(), strstr() and strpos() in case of an
invalid empty delimiter.
- rand() now accepts two optional arguments, which denote the requested range
of the generated number. E.g., rand(3,7) would generate a random number
between 3 and 7.
- Added M_PI constant.
- Added deg2rad() and rad2deg() for converting radians<->degrees.
- ImageArc() misbehaved when given negative angles, fixed.
- Fixed a bug in ereg() that may have caused buglets under some circumstances.
- Added imap_status
- Shutdown functions, registered via register_shutdown_function(), could never
generate output in the Apache module version. Fixed.
- Brought IMAP docs into sync with acutal imap code
- imap_fetchstructure now takes in optional flags
- Fix potential core dumps in imap_append and imap_fetchtext_full
- Fix problem in SetCookie() function related to long cookies
- Add uasort() function to go along with usort (like sort() and asort())
- Add port number to Host header as per section 14.23 of the HTTP 1.1 RFC
- Fix imap_reopen to only take 2 arguments with an optional 3rd flags arg
- Add optional 2nd argument to imap_close
- Add CL_EXPUNGE flag to imap_open() flags
- Fix 4th arg on imap_append(). It was getting converted to a long by mistake.
- Fix shutdown warning in the LDAP module
- *COMPATIBILITY WARNING* imap_fetchstructure() "parametres" object and property
name changed to "parameters" to match the documentation and to be consistent
with the rest of the API.
- Delete uploaded temporary files automatically at the end of a request
- Add upload_max_filesize and correponsing php3_upload_max_filesize directive
to control the maximum size of an uploaded file. Setting this to 0 would
completely eliminate file uploads.
- Force $PHP_SELF to PATH_INFO value when running in CGI FORCE_CGI_REDIRECT mode
- Add apache_lookup_uri() function which does an internal sub-request lookup
and returns an object containing the request_rec fields for the URI. (Yes,
you have to be a bit of a gearhead to figure this one out)
- Fix a few signed char problems causing functions like ucfirst() not to work
correctly with non-English charsets
- md5() function not binary safe - fixed
August 15 1998 Version 3.0.3
- Changed the name of fopen_basedir to open_basedir, to be a little more
accurate about what it does.
- Added Hyperwave module
- Added config-option (php3_)enable_dl <on/off>. This enables/disables the
dl() function. In safe-mode dl() is always disabled.
- Auto-prepended files were crashing under some circumstances - fixed.
- Win32 mail fixes provided by walton@nordicdms.com
- Comparing between arrays and/or objects now generates a warning (it always
returns false, as it used to; no comparison is made)
- Fixed a bug in the syntax highlighting code, that made ending-double-quotes
appear twice under certain circumstances.
- Fix bug in filetype() function related to symlinks
- Started integrating Informix SE support to PHP configure/makefile setup.
- gdttf roundoff fixes from ellson@lucent.com
- Added initial Informix SE support files from Danny Heijl - This code still
needs to be integrated into the PHP configure/makefile setup and the code
itself needs more work.
- return in the global scope now terminates the execution of the current file.
- Added the ability to register shutdown function(s), via
register_shutdown_function($function_name).
- Clean up const warnings
- Add write support to ftp fopen wrappers
- Add strspn() and strcspn() functions
- On systems without strerror use Apache version if compiling as Apache module
- The PHP start tag was being ignored under some circumstances - fixed.
- The db, dbase and filepro functions are now Safe-Mode aware.
- Added config-option (php3_)fopen_basedir <path>. This limits the directory-
tree scripts can open files in to <path>.
- Fixed pg_loreadall that didn't always return all the contents in a PostgreSQL
large object. Also, doesn't pass through anything if method is HEAD.
- configure fix to create target Apache module dir
- Fix core dump in imageTTFtext() function
- Added static IMAP support
- Syntax highlighting was generating additional whitespace - fixed.
- Added ucwords. Works like ucfirst, but works on all words within a string.
- Added array_walk() - apply user function to every element of an array
- Added usort() - array sort that accepts a user defined comparison function!
- Added the ability to call user-level functions and object methods on demand
from the C source using a completely generalized, slick API function.
Miracles do happen every once in a while.
- Added constructors. Don't even squeek about destructors! :) (we mean that)
- Make pg_lowrite() binary safe
- Fixed mod_charset option in ./setup
- Fixed rewinddir() and dir()::rewind() under Win32 (they didn't work before).
- Add Win32 COM support! By-name referencing is supported using the IDispatch
interface (automation). Available functions - COM_Load(), COM_Invoke(),
COM_PropGet() and COM_PropSet().
July 20 1998 Version 3.0.2a
- Fix a quirk in the configuration file parser, the endless fountain of joy
and fun.
- Fix a bug in the API function add_method() that made dir() crash.
July 18 1998 Version 3.0.2
- Compile cleanups for *BSD
- Add support for the OpenLink ODBC Drivers
- Add PHP_SELF, PHP_AUTH_* and HTTP_*_VARS PHP variables to phpinfo() output
- Add workaround for broken makes
- Add Apache 1.3.1 support (some Apache header files were moved around)
- Added apache_note() function.
- Fix order of system libraries and detect libresolv correctly
- Fixed a bug in the Sybase-DB module. Several numeric field types were
getting truncated when having large values.
- Added testpages for unified odbc
- Fix php -s seg fault when filename was missing
- Made getdate() without args default to current time
- Added ImageColorResolve() and some fixes to the freetype support.
- Added strcasecmp()
- Added error_prepend_string and error_append_string .ini and .conf directives
to make it possible to configure the look of error messages displayed by PHP
to some extent
- Added E_ERROR, E_WARNING, E_NOTICE, E_PARSE and E_ALL constants, that can be
used in conjunction with error_reporting()
(e.g. error_reporting(E_ERROR|E_WARNING|E_NOTICE);
- Fixed a crash problem with classes that contained function(s) with default
values.
- Fixed a problem in the browscap module. Browscap files weren't being read
properly.
- Fix -L path in libphp4.module to make ApacheSSL compile without errors
- Fix StripSlashes so it correctly decodes a \0 to a NUL
July 04 1998 Version 3.0.1
- echo/print of empty strings don't trigger sending the header anymore.
- Implemented shift left and shift right operators (<< and >>)
- Compile fix for cc on HP-UX.
- Look for beta-version Solid libraries as well.
- Make GD module show more info in phpinfo().
- Compile fix for NextStep 3.0.
- Fix for Oracle extension on OSF/1.
- Fix gd 1.3 bug in ImageColorAt().
- pg_loread() hopefully handles binary data now.
- Turned off some warnings in dns.c
- Added ImageTTFBBox() and made ImageTTFText() return bounding box.
- Added constants for Ora_Bind()'s modes.
- Renamed all hash_*() routines to _php3_hash_*() to avoid clashes with other
libraries.
- Changed uodbc default LONG behaviour: longreadlen 4096 bytes, binmode 1.
The module now actually uses the php.ini settings.
- New PostgreSQL functions: pg_fetch_row(), pg_fetch_array()
and pg_fetch_object()
- Fix a segmentation fault when calling invalid functions in certain
circumstances
- Fix bug that caused link-related functions to not pay attention to
run-time safe mode setting (it was using whatever was set at compile time).
- Fix bug in exec() function when used in safe mode
June 6 1998 Version 3.0
- Add checkdnsrr function (check availability DNS records)
- Add getmxrr function (get MX hostnames and weights)
- Fixed bug in nl2br() function
- Fix for an RC5 related problem in the Sybase module, when dealing
with very long data types.
- Speed up string concatenation by roughly a factor of 2
- Add escape-handling to date function
- Make base64 functions binary safe
- Add strrpos function to complement strpos function added in RC5
- Add ltrim function (strips only at the start of string)
- Add rtrim as an alias to chop() for completeness sake
- Add trim function (similar to chop, except it strips at the start as well)
- Added 2 optional args to fsockopen function - errno and errstr
- Fixed bug in split() function related to leading matches
- Fixed problem in error_log() function (thanks to Jan Legenhausen)
- empty("0") was returning true - fixed
- Removed the old sybsql module. Use the new sybase_*() functions instead.
- Several fixes to the configuration file parser
- LDAP fixes - fixed return values on several functions
May 23 1998 Version 3.0RC5
- The BC math library functions now compile in by default.
- Fixed a bug in virtual() and other types of SSI's (e.g. <!--#exec). Under
certain circumstances, this used to result in random problems.
- Fixed a bug in virtual(). It was misbehaving if it was called before any
other output.
- Added mysql.default_port, mysql.default_host, mysql.default_user and
mysql.default_password ini-file directives.
- Improved handling of the MySQL default port. It now honors /etc/services
and $MYSQL_TCP_PORT.
- Fixed a crash in opening of broken ftp:// URLs, and improved error reporting
in opening of URLs.
- Fixed several non-critical scanner issues with syntax highlighting mode and
the <script language=php> tag.
- Fixed fseek on windows. (windows only): fseek will not return proper results
on files opened as text mode. PHP uses binary mode as the default for file
operations, but this can be overiden by fopen. Do not open files in text
mode and use fseek on them!
- Add strpos() function
- Added zlib module, requires zlib >= 1.0.9
- Improved the module API implementation. Dynamic modules may now register
persistent resources (not that it makes much sense, but at least PHP
won't crash). The API itself remains unchanged.
- bcmod() wasn't always behaving like modulus should behave (it was behaving
exactly like GNU bc's % operator). Fixed.
- Changed the Sybase-DB module to always return strings, instead of auto-typing
result sets. This was done for consistency with the other database modules,
and in order to avoid overflows due to the platform-dependant limitations
of the numeric data types of PHP. You can turn compatability mode on using
the sybase.compatability_mode directive in the php3.ini file.
- Fixed problems with the TINYINT field in the Sybase-CT module.
- Applied some small speed optimizations to the Sybase-DB module querying code.
- Added 'numeric' and 'type' properties to the object returned by
sybase_fetch_field().
- The 'new' operator doesn't accept all expressions anymore. Instead, it
accepts a class name, or a variable reference (scalar, array element, etc).
- Add ora_numcols() function
- Add ora_do() and ora_fetch_into() functions to Oracle driver
- Add persistent connection support to Oracle driver
- Make Oracle driver clean up open connections and open cursors automatically
- Added fread() and fwrite() that properly handle binary data.
- Add Ora_ColumnSize() to Oracle code
- The string "0" means FALSE again. This was done in order to maintain type
conversion consistency.
- Added solid_fetch_prev() for fetching the previous result row from Solid.
- Huge integers are now automatically converted to floating point numbers
(that have a wider range).
- Floating point numbers are now displayed using scientific notation when
they're extremely big or extremely small. The 'precision' php3.ini directive
no longer designates the number of decimal digits, but rather, the maximum
number of significant digits required.
- Added support for scientific notation for floating point numbers (e.g. 1E7)
throughout the entire language.
- Fixed a potential/probable memory corruption problem with HEAD request
handling.
- Using un-encapsulated strings now generates a NOTICE-level warning
(e.g. $a = foo; instead of $a = "foo";)
- Added defined("name") function to check if a certain constant is defined
or not.
- Support new Apache mechanism for setting SERVER_SUBVERSION
- Added PHP_OS and PHP_VERSION constants
- Added the ability to define constants in runtime! Constants are script-wide,
(there's no scope, once the constant is defined, it's valid everywhere).
Syntax is define("name", $value [, $case_insensitive]). 'name' can be any name
that is a valid variable name, *without* the $ prefix. 'value' can be
any *scalar* value. If the optional 'case_insensitive' parameter is 1,
then the constant is created case-insensitive (the default is case
sensitive). Note: define() is currently *NOT* supported in preprocessed
scripts.
- Added general support for constants. The Syslog constants (e.g.
LOG_ERR, LOG_CRIT, etc.) should be accessed as constants from now on (that
is, without a $ prefix). You can still set define_syslog_variables to On
in the php3.ini file if you want to define the various $ variables. The
default for this directive in the php3.ini-dist file has been changed to
Off.
- The configuration file path variable now expands . and .. into their
respective directories. You can obtain the path of the php3.ini file
that was used by printing get_cfg_var("cfg_file_path").
- Fixed a crash-recovery parser crash ($a=7; $a[3]+=5;)
- Add gmmktime() function
- Fixed a crash with implode() and empty arrays.
- Fixed a bug that, under fairly rare circumstances, caused PHP not to
recognize if(), require() and other statements as statements, and
to complain about them as being unsupported functions.
- Beautified php3.ini-dist and added more comments to it. Also changed
the behavior of the configuration file parser to be brighter about
the various constants (TRUE/FALSE/ON/OFF etc).
- Fixed a bug in openlog() - the specified device name was being mangled.
- Memory leaks were sometimes reported erroneously - fixed.
- Improved the convertor to handle some quirks of the PHP/FI 2 parser with
comments.
- Fixed number_format() to properly handle negative numbers, and optimized it
a bit.
- Fixed static variables inside class member functions. Note that using such
static variables inside member functions usually defeats the purpose of
objects, so it is not recommended.
- Fixed a bug in fpassthru() (the file was being closed twice).
- Added strftime().
- Add set_socket_blocking() function to control blocking on socket fd's
- The sendmail_path in php3.ini was being ignored - fixed.
- Fixed a bug with file upload, with files that contained the MIME boundary
inside them.
- Fixed a bug with form variables of type array, with spaces in their
index (e.g. name="foo[bar bar]").
- gd-1.3 autodetect and support
- Year 2000 compliance is now togglable from the php3.ini file. Setting PHP
to be y2k compliant effects the way it creates cookies, and means it'll
NOT work with many browsers out there that are not y2k compliant! For
that reason, the default for this option is off.
- safe mode / fix from monti@vesatec.com
- Integrated the FreeType support in the GD extension.
- Added --with-gd=DIR and --without-gd options to configure
April 18 1998 Version 3.0 Release Candidate 4
- Auto-prepended and auto-appended files were reporting the wrong filename
in errors and in __FILE__ - fixed.
- Fix GPC problem related to mixed scalar and array vars with the same name
- Made putenv() Apache-safe. Environment variables may no longer leak in
between requests.
- The trailing semicolon is no longer required in class declarations.
- Fixed a memory leak in the (array) and (object) operators under certain
conditions.
- <script> tags weren't working unless short tags were enabled - Fixed.
- Fixed a bug in certain array indices that weren't treated as numbers
even though they looked like numbers (e.g. "10", "20").
- Changes to support renamed API functions in Apache-1.3
- Fixed the -p and -e command line switches
- Fix a segfault when calling command line version without parameters
- Fix for feof() when used on a socket
- Fix off-by-one error in fgets() when used on a socket
- Fix bug in ImageSetPixel() (Thanks to ecain@Phosphor.net)
March 31 1998 Version 3.0 Release Candidate 3
- Tiny bugfix for magic_quotes_sybase
- Fix Apache build problems introduced in RC2
- $a["0"]==$a[0] fix
- Apache-1.3 build changes to support 100% automatic builds and shared library
module builds. See INSTALL file.
March 30 1998 Version 3.0 Release Candidate 2
- Changed the socket implementation under UNIX to not use FILE pointers, in
order to work around the buggy Solaris libc (and possibly buggy libc's
in other platforms).
- Fixed a bug in min() and max() with certain arrays.
- *WARNING* Move Apache 1.3 php3 file install to src/modules/php4 instead of
src/modules/extra. Make sure you change your AddModule line correctly
in your Apache Configuration file. This change is to take advantage of
new Apache-1.3 configuration mechanism which makes it easier to build an
Apache server with PHP automatically enabled. It will also help building
a shared library module version of PHP soon.
- Fixed a crash bug with auto-appended files.
- Made --enable-discard-path work on all Unix servers #!/path/php CGI scripts
should now work everywhere. I have tested on Apache, WN and Netscape 2.0
- Made $a["123"] and $a[123] be identical. $a["0123"] is still different,
though.
- Added 'precision' ini directive, to set the number of decimal digits
displayed for floating point numbers (default - 6).
- Made integer/integer divisions evaluate to floating point numbers when
applicable (e.g., 5/2==2.5(float), but 4/2==2(int))
- Get rid of reliance on tied streams and move all socket reads and writes
to recv/send calls
- Cleaned up head.c a bit and fixed CGI SetCookie order problem
- Changed default variable parsing order to Get-Cookie-Post (GPC)
- Fixed setup so it has all configure options and defaults.
- Added optional decimal point and thousands seperator to number_format()
e.g., number_format(1500,2,',','.') == 1.500,00
- Fixed cgi bug in windows that prevented files from being parsed on many
systems and servers.
March 23 1998 Version 3.0 Release Candidate
- Added support for the Raima database (ALPHA)
- Fixed a bug in persistent PostgreSQL links and the connection-string method.
- Added EXTENSION_STATUS file, that specifies the stability and status of
every module in the distribution.
- Added optional parameters to user functions with default values, variables
that are forced to be passed by reference and variables that can be
optionally passed by reference. The ini file directive
'ignore_missing_userfunc_args' is no longer supported.
- Added fhttpd support (by Alex Belits)
- Improved performance by approximately 20-30%.
- Added mysql_error(), mysql_errno() (if available) and msql_error().
Errors coming back from the database backend no longer issue warnings.
Instead, use these functions to retreive the error.
- Patched count(), each(), prev(), next(), reset() and end() to work around
the implementation side effects of unset(). As far as the users are
concerned, this should be transparent now (even though it's slower now,
until it's thoroughly fixed in 3.1).
- Added number_format(). number_format(2499,2)=='2,499.00'.
- error_reporting() now sets the error reporting level to the supplied
argument, without any interpretations.
- Fixed a lookahead parser bug that occured under rare circumstances.
- Change the comparison operators to compare numeric strings as numbers. If
you want to compare them as strings, you can use the new C-like strcmp()
- Fixed Ora_GetColumn() bug when fetching strings
- Added Ora_ColumnName() and Ora_ColumnType()
- Preliminary LONG and LONG RAW support in Oracle extension
- Add \123 and \xAB style octal and hex escapes to "" and `` strings
- Add "-c" command line flag for specifying path to php3.ini file
- Improved list() so that elements can be skipped, for example:
list($name,,,$realname) = explode(":",fgets($passwd_file));
- Fixed a tiny bug in the hash initialization which caused excessive use of
memory. Report and fix by short@k332.feld.cvut.cz
- Fixed strtolower() and strtoupper() to work with 8-bit chars
- Fixed to compile and run on SunOS 4.1
- Fixed a crash in soundex() of an empty string
- Fixed parse_str() - it wasn't always defining the right variables,
and didn't work with arrays.
- Made [m,My]SQL create/drop database functions return success status
- Fixed some memory leak/crash problems in the Adabas module
- Added each() in order to allow for easy and correct array traversing.
- Make Apache module version respect LOCALE setting
- Add support for Apache 1.3b6+ ap_config.h file
- Fixed a nasty corruption bug in eval() and show_source() that resulted in
script termination (e.g. eval("exit();").
- Fixed a syntax highlighting problem with keywords used as variable
names.
- Fixed a possible crash and/or file descriptor leak
- Fixed line number being off by one in #! shell style execution
- Made it possible to disable auto_prepend/append with "none" filename
- Allow safe CGI calling through #!php style scripts
March 2 1998 Version 3.0b6
- Made [s]printf handle %ld
- Changed CGI version to only open regular files as input script
- Added ignore_missing_userfunc_args directive to suppress warnings messages
about missing arguments to user-defined functions
- Added Postgres function - pg_cmdtuples(), by Vladimir Litovka
- Disabled command line options if used as CGI
- Changed CGI version to use PATH_TRANSLATED as the script file name
- Link with solid shared library instead of static one
- Fixed a crash with functions that aren't being called correctly
- Fixed file descriptor leak in auto-prepend/append
- Imap module is usable. See README in dl/imap.
February 24 1998 Version 3.0b5
- Made the URL aware file functions be enabled by default
- Fixed an unlikely crash bug in the parser, with uninitialized array elements
which are refered to as objects.
- Fixed several fields that were being incorrectly read in Sybase CT.
- Fix Apache-1.3 related SIGHUP problem which was preventing php3.ini from
getting re-read on a SIGHUP
- *** WARNING *** Downwards incompatible change: The plus operator (+) is not
longer overloaded as concatenation for strings. Instead, it converts its
arguments to numbers and performs numeric addition.
- Add Stig and Tin's bdf2gdfont script to extra/gd directory
- Added join() as an alias to implode()
- Made implode() accept arguments in the order used by explode() as well
- Made $php_errormsg local in function calls
- Fixed Apache configuration directive bugs
- Added a number of .ini directives to Apache .conf directive list
- Fixed a 'memory leak' with strtok()
- echo/print now handle binary data correctly.
- NEW now accepts any expression for the class name argument.
- Add ImageDashedLine() GD function
- Add arg_separator .ini directive so the '&' GET method separator can be
changed to ';' for example. Corresponding php3_arg_separator Apache .conf
directive works as well.
- Walked around an implementation side effect of switch(). <? switch(expr) { ?>
now works.
- Added memory caching, resulting in a significant performance boost
- Added support for for(): .. endfor; loops
- Added a new predicate - empty($var). Returns true if $var is not set,
or is FALSE. Returns false otherwise.
- Added is_integer() (same as is_long()) and is_real() (same as is_double()).
- Added sizeof() as an alias to the count() function
- Added --enable-force-cgi-redirect, to prevent the CGI from working if
someone directly accesses PHP not through Apache's CGI redirect
(off by default).
- Fixed marking of deleted dBase records. Noticed by Simon Gornall
<simon@oyster.co.uk>.
- Fixed fixed "%%" bug in [s]printf
- Fixed a UMR (initialized memory read) in the Oracle code
- Potential fix for mysql-related SIGPIPE problem which caused httpd to spin
- Made PHP responsive to the Apache link status (stop executing if the link
dies).
- Fixed a crash bug with StrongHold and secure pages
- Fixed StrongHold installation
- Optimized the function call sequence a bit.
- Fixed Sybase/CT date/datetime/money fields work to correctly.
- Fixed Apache module startup problems - php3_module_startup should only be
called once.
- Fixed ord() with characters >127
- Fixed bug in file_exists() function
- Fixed stripslashes() to remove the escaping quote (instead of backslash)
in case magic_quotes_sybase is true.
- Also make echo and print automatically remove trailing decimal zeros.
- Added htmlentities(), currently handling only ISO-8859-1 entities
- "0" is no longer considered false, the only string which is false is the
empty string "".
- Added 'true' and 'false' keywords
- Added 'xor' (logical exclusive or)
- Automatic conversion from double to string removes decimal trailing zeros.
- Added arsort() and rsort() to sort in descending order.
- Turned on "XLATOPT_NOCNV" by default for uODBC/Solid.
- Added support for a port number in the mysql_(p)connect() functions
- Fixed a file descriptor leak in the configuration parser.
- Fixed a few buglets with syntax highlighting with certain language keywords
- Added functions to control minimum severity level of Sybase messages to
display.
- Added highlight_string() - behaves like highlight_file(), only instead
of highlighting a file, it syntax highlights the contents of its
argument.
- Renamed show_source() to highlight_file(). show_source() is still
supported for downwards compatability.
- Fixed a bug in class inheritence - member functions with upper case
letters in their names couldn't be redefined.
- Made chown(), chgrp() and chmod() return TRUE/FALSE instead of 0/-1.
February 02 1998 Version 3.0b4
- Fixed a segfault bug in one of the unified ODBC error messages.
- Set default file modes to binary on Win32 (solved a lot of bs)
- Fixed file copy on Win32
- MIME file uploads fixed on Win32
- Added contributed icons by Colin Viebrock (undex extra/icons)
- Fixed the debugger enough to call it "beta code".
- Fixed some leaks in the Oracle module, tidied up the code a bit.
- Added __FILE__ and __LINE__ which evaluate to the currently parsed file
and currently parsed line respectively.
- Added ImageColorAt(), ImageColorSet(), ImageColorsForIndex(), and
ImageColorsTotal() to allow manipulating the palette of GIF images.
- Rename '--enable-url-includes' option to '--enable-url-fopen-wrapper' to
better describe what it does, and pay attention to the setting.
- Added optional parameter to the file(), readfile() and fopen() functions
to look for files located in the include path.
- Fixed bug that allowed the file() and readfile() to open files in the
include path inadvertantly.
- Fixed a (documented) bug in printf()/sprintf() with hard limited strings
and alignment (e.g. %-.20s).
- Optimized several quoted string routines.
- Added error_log ini directive to select where errors get logged when
log_errors is turned on or the error_log() function is used.
- Added the ability to direct errors to log files instead of or in addition
to the script output. Use the new display_errors and log_errors
php3.ini directives.
- Made environment variables uneraseable by POST/GET/Cookie variables.
- Fixed a bug in the elseif() construct. The expression was being evaluated
even if a previous if/elseif already evaluated to true and got executed.
- Fixed a bug in the exit code parameter of system()
- Tighten up all exec() related functions in safe mode
- Added error_log() function to log messages to the server error log, or
stderr for the CGI version.
- Added support for a general memory limit of scripts.
- Fixed a segfault bug that occured under certain circumstances with shell
escapes ($foo = `...`)
- Made keywords be valid property names of objects.
- Fixed a segfault bug when creating new objects of an unknown class.
- Fixed a problem with the maximum execution time limit, that may have
prevented this feature from working on certain platforms.
- PHP would now warn you with E_NOTICE about unknown escape characters,
e.g. "\f". It would still be considered as a backslash followed by f,
but the proper way of writing this is "\\f" or '\f'.
- Added support for ${...} inside encapsulated strings. Supported: ${foo},
${foo[bar]}, ${foo[0]}, ${$foo[$bar]}, ${$foo->bar} and ${$foo}
- Fixed a bug in automatic persistent link reconnect of the Sybase/DB module.
Thanks to Steve Willer for finding that 'stealth' bug!
- Fixed a crash bug in the GET/POST/Cookie parser in case of regular
and array variables with the same name.
- Added round() function.
- Can't use encapsed strings as variable names anymore, ie. $"blah blah".
- Fixed bug in gethostby*() functions that resulted in a core dump.
(Noticed by torben@coastnet.com.)
- Fixed bug in dbase_get_record that prevented number and date fields
from being properly decoded. (Thanks again to colins@infofind.com.)
- Make dbase_get_record include a 'deleted' field that indicates whether
that record had been marked for deletion.
- Fixed bug in dbase library that stomped on the deleted flag of the first
record in the file if it was set. (Thanks to colins@infofind.com.)
- Fixed putenv() to not report a memory leak and possibly prevent a bug
from that memory being freed.
- Added setlocale()
- Added pg_fieldisnull() (by Stephan Duehr)
- Changed pg_exec() to always return a result identifier on succees
- Solid linking fixes (tries to find the right library)
- Fixed a but with date() and the 'w' element.
- Tried to eliminate unimportant memory leak notifications.
- Made min() and max() backwards compatible and able to handle doubles.
- Add fgetc() function
- Fixed bug in getmyuid(), getmyinode() and getlastmod(). Thanks to
khim@sch57.msk.ru for pointing this out.
- Fixed http:// URL includes with no path specified send request for /.
- Added GetAllHeaders() (Apache-only)
- Added workaround that made the Image text functions 8-bit clean
- Made snmp internally compilable for Win32 (not the unix one though),
only adds 2k to binary size, so no reason not to have it there.
- Fixed ldap loading on Win32
- Fixed MySQL Info function on Win32 platform
- Fixed compilation of syntax highlighting mode
January 17 1998 Version 3.0b3
- Added mysql support under windows ;) happy happy joy joy
- Fixed dbase.dll for Win32 to actualy load now.
- Enhanced the convertor to recognize ?> as a php-close-block as well.
- Fixed potential SetCookie() core dumps
- Changed print to be an expression instead of a statement. That means you can
now do stuff like foobar() or print("Unable to foobar!"). echo has NOT been
changed.
- Removed the flex optimization flags to reduce the size of the scanner
- Added memory leak logging into apache log files (apache module only)
- Fixed a nasty bug in one of the internal stacks. This may have caused
random crashes in several occassions.
- Fixed bug in ImageGif() making it hang sometimes
- Added ImageLoadFont(), ImageFontWidth() and ImageFontHeight()
- error_reporting() now returns the old error reporting level
- Fixed url includes/opens not working under Win32
- Fixed errorneous handling of multipart/form-data input
- Added rawurlencode(), rawurldecode() and changed urlencode() and urldecode()
a bit too.
- Fixed a bug in [s]printf, sign was forgotten for doubles.
- Fixed a segfault bug in pg_fieldprtlen(), and made it accept field names
in addition to field offsets.
- Made the setup script a little more user-friendly.
- Added is_long(), is_double(), is_string(), is_array() and is_object()
- Fixed a bug in freeing of mSQL results.
- Improved pg_exec() to properly return true or false with queries that don't
return rows (i.e. insert, update, create, etc)
- Added get_cfg_var() to enable checking cfg file directives from within
a script.
- Fixed a bug with urlencode() and characters 0x80-0xff
- Changed the behaviour of ereg_replace to more intuitive. The
backslashes other than valid existing back references in the second
argument are no more evaluated as escape sequences.
- Fixed a bug in the configuration file loader and safe mode.
- Fixed a bug with configuration variables taken from the environment.
- Added <script language=php> </script> as PHP open/close tags, to allow
the use of editors such as Microsoft Frontpage.
- Fixed a bug in the default php3.ini directory - it wasn't defaulting to
/usr/local/lib properly.
- Added support for \r\n line endings
- Fixed a bug that may have prevented POST method variables from working
with certain scripts when using the CGI version.
- Convertor: Added support for single-quoted strings
- Fixed segfault bug in the Adabas module, with queries that don't return
rows (update, insert, etc).
December 22 1997 Version 3.0b2
- Changed variable type conversions that do not specify base to always use
base 10. "010" is no more 8, it is 10. Use intval ($x, 0) to get C-style
octal and hex numbers recognized.
- Fixed a possible segfault bug in several functions, when using the concat
operator and possibly other operators/functions.
- # is no longer accepted as a comment in php3.ini. Use ; instead.
- Added browscap support
- Configuration file directives are now case-sensitive
- Fixed msql_tablename() and msql_dbname()
- Added a PHP/FI 2.0 -> PHP 3.0 convertor
- Added support for shell/perl-style single quotes
- Added support for execution of external programs using backquotes ($a=`ls -l`)
- fixed mail() on windows, also fixed memory leaks in mail on windows
- added sendmail_from to handle return route on windows
- Changed the way the config file is searched. The file name is now
php3.ini (hardcoded), and it'll be looked for in: local directory, $PHPRC
and builtin path designated by ./configure under UNIX or Windows directory
under Windows.
- Fixed ereg_replace replacing empty matches and a one off buffer overflow
- Fixed File upload on windows platform
- Fixed a bug that caused 'HTTP/1.1 100 Continue' messages with
Internet Explorer 4.0 and certain scripts that receive POST variables
- Get/POST/Cookie data variables are from now *ALWAYS* strings. If you want
to use them in integer/real context, you must explicitly change their types.
This was done in order to avoid possible loss of data when doing these
conversions automatically.
- Variables named as keywords are now allowed (e.g. $function, $class, etc)
- Fixed a problem with msql() and mysql() with NULL fields
- Fixed a segfault bug with class declarations
- Fixed bugs with FOR loops and include() from within eval()
- Changed include() to be executed conditionally. PHP-3.0 efficient
unconditional include is now require()
December 08 1997 Version 3.0b1
- Switched to public beta test phase
- Generalized unset() and isset() to work on any type of variables, including
specific array indices or object properties (e.g., unset($a[4]) now works).
- Added support for object references inside encapsulated strings
(for example, 'echo "Username: $user->name"' now works)
- Added arbitary precision math support (basic operations with
unlimited range numbers, and support for unlimited decimal digits)
- Apache module can now handle preprocessed scripts (by using:
AddType application/x-httpd-php3-preprocessed .php3p
in the Apache configuration)
- Made settype() pass its first parameter by value. Improved it to be able
to convert to arrays and objects (originally by Steve Willer)
- Implemented CPU time limit on scripts when setitimer() is available
- Computed field names in the Sybase/CT and Sybase/DB modules are now named
computed, computed1, computed2, ...
- Added Sybase/CT client/server message handlers and updated the Sybase/DB ones
- Made the regexp function automatically take arguments by reference
when necessary
- Added builtin support for auto append and prepend in the parser level
- Improved the Sybase/CT sybase_query(). Should be more stable now, and
hopefully work with a wider range of queries. It's difficult to work
without docs, though, so it may still not be 100% right...
- Changed error messages to show error type, file and line with bold
- Added support for autoprepend and autoprepend
- Added some more warning flags if gcc is used
December 03 1997 Version 3.0a4
- Improved the internal functions API - no need to explicitly pass
parameters by reference to internal functions that specifically
require them, e.g. sort(), ksort(), reset(), count(), etc.
This is *STILL* downwards compatible with the previous alphas,
in the sense that you can explicitly pass the arguments by reference
if you want to.
- use srandom/random instead of srand/rand if available
- Added [m,My]sql_listfields() for downwards compatability
- -p now replaces .php3 extension with .php3p (otherwise it adds .php3p)
- Added C++ style comments (// comment)
- Fixed # commenting to terminate at a close PHP tag
- Added \0 back reference for full string match to *reg*_replace and
added backslash escaping to replace string
- Fixed a few bugs in the Sybase DB-library module.
- Added Sybase CT-library support. It should be considered experimental.
Syntax is identical to the one of the DB-library. Allows people to
connect to MS-SQL servers from Linux without having to pay for a
library!
- Beautified phpinfo()
- Add ImageColorClosest() and ImageColorExact() GD functions
- Make all .ini directives work as Apache .conf directives as well
- Added PHP2-like File() function with PHP3 URL support
- Upgraded the Sybase interface. It's practically MySQL compatible now!
Among other things, added sybase_fetch_array() and sybase_fetch_object().
- Fixed problem in multi dimensional array handling and self modifying
operators (+=, -=, etc).
- Safe Mode file open implementation
- SVR3 portability problem fix
November 23 1997 Version 3.0a3
- Made the global statement behave like PHP 2 with undefined variables
- Added msql_fetch_object() and msql_fetch_array()
- Switched between the 1st and 2nd parameters to explode(), so that it acts
like split()
- Fixed passthru(), exec() and system() functions
- Implemented second optional parameter to intval() to specify conversion base
(The default is to assume you want to do a base 10 conversion.)
- Implemented SQL safe mode for MySQL
- Read UploadTmpDir from php3.ini instead of apache conf files
- Added mysql_fetch_object() and mysql_fetch_array()
- Changed function->old_function. function is now an alias to cfunction.
- Split the magic_quotes directive to get/post/data and other
- Added generic copy() function
- Added a $GLOBALS[] array, which contains all global variables
- Fix broken getimagesize() function
- Made mysql_fetch_field() and msql_fetch_field() optionally accept a 2nd argument
- Fixed mysql_data_seek() and msql_data_seek()
- Changed list assignment to list(...) and array init to array(...)
- Made <?php_track_vars?> work
- cgi when not in debug mode uses regular malloc(), free() functions now
- Added preliminary support for perl-style list assignments
- Fixed a bug in mysql_result() and msql_result() when specifying table
- renamed internal error-handling function and levels
- Added basename and dirname functions similar to sh counterparts
- Added base64_encode() and base64_decode()
- Support Basic authorization for http url includes
- Added parse_url() function to extract url components
- Made it possible to use anonymous ftp on URL includes
- Fixed url includes to handle different URLs better
- Fixed mysql_field*() functions
- Made mysql_connect() smarter, after a mysql_close() (applies to msql and pgsql too)
November 6 1997 Version 3.0a2
- Fixed a segfault bug caused by non-persistent connect in [m,My,Postgres]SQL modules
- Fix command line argument handling
- Made empty array list assignments work ($a=({});)
- Made '$' escaping optional when a variable name parsing isn't possible
- Added support for mysql_[p]connect(host) and mysql_[p]connect(host,user)
- New layout in phpinfo()
- Update Oracle extension to use php3_list functions
- Add includepath support
- Add #!php shell script escape support
- Change name of CGI/command line version from php3.cgi to php
- Add SNMP extension
- show_source() support
- Parsing of command-line args for CGI version
- Support for backreferences in ereg_replace
- Support for hexadecimal numbers directly at the scanner level
- Support octal numbers directly at the scanner level
- Fixed problem with huge html files (with little or no php code)
- Fix eval() empty string argument core dump
- renamed 'install' to 'setup' to be more accurate and avoid name conflict
- Fixed Oracle compilation
- Fixed mSQL 1.0 compilation
- Fixed a problem in the mSQL, MySQL and PostgresSQL drivers and NULL fields.
- Fixed the GLOBAL statement to be able to declare an array.
October 29 1997 Version 3.0a1
- Start with excellent new parser from Andi and Zeev
+75
View File
@@ -0,0 +1,75 @@
This is the ChangeLog from PHP3 as of Apr 12 1999.
Entries should be removed from this file, if you transfer changes
over to PHP4.
============================================================================
?? 1999, Version 3.0.8
- added Oracle-OCI8 persistent connections
- fixed OCIDefineByName crash.
- fixed some NULL-column related problems in OCI8-module.
- Some Informix driver improvements.
- PUT method support (mlemos@acm.org)
- Fix parameter count problem in odbc_setoption()
- Really fix implode() this time. The fix in 3.0.7 was bogus
- Make fgetss() slightly smarter
- Add strip_tags() which uses the fgetss state-machine but acts on a string
March 1 1999, Version 3.0.7
- Added pdf_put_image and pdf_execute_image
- Initial work on an ImageMagick module - doesn't do anything yet
- Make configure script detect Netscape's LDAP SDK automagically
- Fixed Oracle-OCI8 module for windows.
- Add OCIRowCount function. (Number of affected rows for update-statements)
- Add OCIDefineByName function.
- Change the behaviour of open_basedir. It's now possible to supply more
than one directory. open_basedir paths from parent directories are now
automatically inherited.
- fix rand() and mt_rand() to make the ranges work correctly
- htmlspecialchars() and htmlentities() are now binary safe.
- Add extract() function.
- Oracle-OCI8 driver now supports BLOBS/CLOBS and IN/OUT binding of local php
variables.
- Clean up apxs build
- Add INSTALL.REDHAT file to walk RedHat users through the install
- Add function_exists() function.
- Add another version of WDDX module
(we need to pick a single implementation here)
- Fixed includes for iODBC to support both the old and the new LGPL version
- Fix implode() bug - When imploding an array that contained unset() elements
it wasn't correctly skipping past these
- Add connection_status() function. This returns the raw bitfield which
indicates whether the script terminated due to a user abort, a timeout
or normally. Note that if ignore_user_abort is enabled, then both the
timeout state and the user abort state can be active
- Add connection_timeout() function. This one can be called in a shutdown
function to tell you if you got there because of a timeout
- Add ignore_user_abort() function and .ini/.conf directive of same name
- Fix connection abort detection code - It should now work reliably with
Apache. Also added a user-level connection_aborted() function designed to
let people check whether the user aborted the connection in a user-level
shutdown function.
- Add pfsockopen() function
- Improvements in FreeType support: Macintosh fonts work, and non-antialiased
output is considerably cleaner <mka@satama.com>
- Fixed checkdate() function, range of valid years is now 0 to 32767
- hw_insertdocument() returns object id now
- Add pdf_open() warning in configure and documentation
- Add diskfreespace() function
- Added aspell support
- Iptcparse would sometimes find a wrong tag.
- Force var_dump() to output headers
- Add optional 3th parameter to ora_fetchinto.
- Serialize and var_dump no longer show array elements that
have been unset.
- Add IptcEmbed() function (can replace an APP13-Marker in a JPEG file)
- Add OCI8 module for Windows
- Fix bug in pdf_close() function
- Add WDDX support (see http://www.wddx.org for more info)
- Add similar_text() function
- Introduce simple regex compilation cache
+538
View File
@@ -0,0 +1,538 @@
Functions:
Functions marked with 'u' do not work, or may not work correctly under windows.
basic_functions
include
_include
isset
intval
doubleval
strval
short_tags
sleep
u usleep
ksort
asort
sort
count
chr
ord
flush
end
prev
next
reset
current
key
gettype
settype
min
max
addslashes
chop
pos
fsockopen
getimagesize
htmlspecialchars
md5
parse_url
parse_str
phpinfo
phpversion
strlen
strtok
strtoupper
strtolower
strchr
basename
dirname
stripslashes
strstr
strrchr
substr
quotemeta
urlencode
urldecode
ucfirst
strtr
sprintf
printf
exec
system
escapeshellcmd
passthru
soundex
rand
srand
getrandmax
gethostbyaddr
gethostbyname
explode
implode
error_reporting
clearstatcache
get_current_user
getmyuid
getmypid
u getmyinode
getlastmod
base64_decode
base64_encode
abs
ceil
floor
sin
cos
tan
asin
acos
atan
pi
pow
exp
log
log10
sqrt
bindec
hexdec
octdec
decbin
decoct
dechex
getenv
putenv
time
mktime
date
gmdate
getdate
checkdate
microtime
uniqid
u linkinfo
u readlink
u symlink
u link
u unlink
bcmath_functions
bcadd
bcsub
bcmul
bcdiv
bcmod
bcpow
bcsqrt
bcscale
bccomp
dir_functions
opendir
closedir
chdir
rewinddir
readdir
dir
dl_functions
dl(string module_name); dynamicly load a module
dns_functions
gethostbyaddr
gethostbyname
file_functions
pclose
popen
readfile
rewind
rmdir
umask
fclose
feof
fgets
fgetss
fopen
fpassthru
fseek
ftell
fputs
mkdir
rename
copy
tempnam
file
filestat_functions
fileatime
filectime
u filegroup
u fileinode
filemtime
u fileowner
fileperms
filesize
filetype
stat
u chown
u chgrp
u chmod
touch
file_exists
is_executable
is_dir
is_readable
is_writeable
u is_link
header_functions
setcookie
header
mail_functions
mail
reg_functions
ereg
ereg_replace
eregi
eregi_replace
split
sql_regcase
syslog_functions (writes to event log on win NT)
openlog
syslog
closelog
The following are optional modules and may or may not be compiled into php, or may be compiled as a loadable module.
odbc_functions (obsolete, use uodbc below)
sqlconnect
sqldisconnect
sqlfetch
sqlexecdirect
sqlgetdata
sqlfree
sqlrowcount
uodbc_functions
(int) odbc_autocommit($connection_id, $OnOff)
(void) odbc_close($connection_id)
(void) odbc_close_all(void)
(int) odbc_commit($connection_id)
(int) odbc_connect($dsn, $user, $password)
(int) odbc_pconnect($dsn, $user, $password)
(string) odbc_cursor($result_id)
(int) odbc_do($connection_id, $query_string)
(int) odbc_exec($connection_id, $query_string)
(int) odbc_prepare($connection_id, $query_string)
(int) odbc_execute($result_id, $array)
(int) odbc_fetch_row($result_id, $row_number)
(int) odbc_fetch_into($result_id, $row_number, $array_ptr)
(int) odbc_field_len($result_id, $field_number)
(string) odbc_field_name($result_id, $field_number)
(string) odbc_field_type($result_id, $field)
(int) odbc_free_result($result_id)
(int) odbc_num_fields($result_id)
(int) odbc_num_rows($result_id)
(string) odbc_result($result_id, $field)
(int) odbc_result_all($result_id, $format)
(int) odbc_rollback($connection_id)
msql_functions
msql_connect
msql_pconnect
msql_close
msql_select_db
msql_create_db
msql_drop_db
msql_query
msql
msql_list_dbs
msql_list_tables
msql_list_fields
msql_result
msql_num_rows
msql_num_fields
msql_fetch_row
msql_fetch_array
msql_fetch_object
msql_data_seek
msql_fetch_field
msql_field_seek
msql_free_result
msql_fieldname
msql_fieldtable
msql_fieldlen
msql_fieldtype
msql_fieldflags
msql_regcase
/* for downwards compatability */
msql_selectdb
msql_createdb
msql_dropdb
msql_freeresult
msql_numfields
msql_numrows
msql_listdbs
msql_listtables
msql_listfields
msql_dbname
msql_tablename
ldap_functions
ldap_connect
ldap_bind
ldap_unbind
ldap_read
ldap_list
ldap_search
ldap_free_result
ldap_count_entries
ldap_first_entry
ldap_next_entry
ldap_get_entries
ldap_free_entry
ldap_first_attribute
ldap_next_attribute
ldap_get_attributes
ldap_get_values
ldap_get_dn
ldap_dn2ufn
ldap_add
ldap_delete
ldap_modify
gd_functions
imagearc
imagechar
imagecharup
imagecolorallocate
imagecolorclosest
imagecolorexact
imagecolortransparent
imagecopyresized
imagecreate
imagecreatefromgif
imagedestroy
imagefill
imagefilledpolygon
imagefilledrectangle
imagefilltoborder
imagegif
imageinterlace
imageline
imagepolygon
imagerectangle
imagesetpixel
imagestring
imagestringup
imagesx
imagesy
filepro_functions
filepro
filepro_rowcount
filepro_fieldname
filepro_fieldtype
filepro_fieldwidth
filepro_fieldcount
filepro_retrieve
dbm_functions
dblist
dbmopen
dbmclose
dbminsert
dbmfetch
dbmreplace
dbmexists
dbmdelete
dbmfirstkey
dbmnextkey
dbase_functions
dbase_open
dbase_create
dbase_close
dbase_numrecords
dbase_numfields
dbase_add_record
dbase_get_record
dbase_delete_record
dbase_pack
calendar_functions
jdtogregorian
gregoriantojd
jdtojulian
juliantojd
jdtojewish
jewishtojd
jdtofrench
frenchtojd
jddayofweek
jdmonthname
adabas_functions
(int) ada_afetch($result_id, $rownumber, $result array)
(int) ada_autocommit($connection_id, $OnOff)
(void) ada_close($connection_id)
ada_closeall
(int) ada_commit($connection_id)
(int) ada_connect($dsn, $user, $password)
(int) ada_exec($connection_id, $query_string)
(int) ada_fetchrow($result_id, $row?number)
ada_fieldlen
(string) ada_fieldname($result_id, $field_number)
(string) ada_fieldtype($result_id, $field)
(int) ada_freeresult($result_id)
(int) ada_numfields($result_id)
(int) ada_numrows($result_id)
(string) ada_result($result_id, $field)
(int) ada_resultall($result_id, $format)
(int) ada_rollback($connection_id)
***(int) ada_fieldnum($result_id, $field_name) (this function is not in adabase.c
crypt_functions
crypt
mysql_functions
mysql_connect
mysql_pconnect
mysql_close
mysql_select_db
mysql_create_db
mysql_drop_db
mysql_query
mysql
mysql_list_dbs
mysql_list_tables
mysql_list_fields
mysql_affected_rows
mysql_insert_id
mysql_result
mysql_num_rows
mysql_num_fields
mysql_fetch_row
mysql_fetch_array
mysql_fetch_object
mysql_data_seek
mysql_fetch_lengths
mysql_fetch_field
mysql_field_seek
mysql_free_result
mysql_fieldname
mysql_fieldtable
mysql_fieldlen
mysql_fieldtype
mysql_fieldflags
/* for downwards compatability */
mysql_selectdb
mysql_createdb
mysql_dropdb
mysql_freeresult
mysql_numfields
mysql_numrows
mysql_listdbs
mysql_listtables
mysql_listfields
mysql_dbname
mysql_tablename
oracle_functions
ora_close
ora_commit
ora_commitoff
ora_commiton
ora_error
ora_errorcode
ora_exec
ora_fetch
ora_getcolumn
ora_logoff
ora_logon
ora_open
ora_parse
ora_rollback
pgsql_functions
pg_connect
pg_pconnect
pg_close
pg_dbname
pg_errormessage
pg_options
pg_port
pg_tty
pg_host
pg_exec
pg_numrows
pg_numfields
pg_fieldname
pg_fieldsize
pg_fieldtype
pg_fieldnum
pg_result
pg_fieldprtlen
pg_getlastoid
pg_freeresult
pg_locreate
pg_lounlink
pg_loopen
pg_loclose
pg_loread
pg_lowrite
pg_loreadall
sybase_functions
sybase_connect
sybase_pconnect
sybase_close
sybase_select_db
sybase_query
sybase_free_result
sybase_get_last_message
sybase_num_rows
sybase_num_fields
sybase_fetch_row
sybase_fetch_array
sybase_fetch_object
sybase_data_seek
sybase_fetch_field
sybase_field_seek
sybase_result
sybase_old_functions
sybsql_seek
sybsql_exit
sybsql_dbuse
sybsql_query
sybsql_isrow
sybsql_result
sybsql_connect
sybsql_nextrow
sybsql_numrows
sybsql_getfield
sybsql_numfields
sybsql_fieldname
sybsql_result_all
sybsql_checkconnect
+186
View File
@@ -0,0 +1,186 @@
Installation Instructions for PHP 4.0
-------------------------------------
For the impatient here is a quick set of steps that will build PHP as
an Apache module for Apache 1.3.x with MySQL support. A more verbose
explanation follows.
QUICK INSTALL
$ gunzip -c apache_1.3.x.tar.gz | tar xf -
$ cd apache_1.3.x
$ ./configure
$ cd ..
$ gunzip -c php-4.0.x.tar.gz | tar xf -
$ cd php-4.0.x
$ ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
$ make
$ make install
$ cd ../apache_1.3.x
$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
(The above line is correct! Yes, we know libphp4.a does not exist at this
stage. It isn't supposed to. It will be created.)
make
(you should now have an httpd binary which you can copy to your Apache bin dir)
cd ../php-4.0.x
cp php.ini-dist /usr/local/lib/php.ini
You can edit /usr/local/lib/php.ini file to set PHP options.
Edit your httpd.conf or srm.conf file and add:
AddType application/x-httpd-php .php
VERBOSE INSTALL
Installing PHP can be done in four simple steps:
1. Unpack your distribution file.
You will have downloaded a file named something like php4xn.tar.gz.
Unzip this file with a command like: gunzip php4xn.tar.gz
Next you have to untar it with: tar -xvf php4xn.tar
This will create a php-4.0.x directory. cd into this new directory.
2. Configure PHP.
You now have to choose the options you would like. There are quite
a few of them. To see a list, type: ./configure --help
You can also use the supplied 'setup' script, which will ask you
a series of questions and automatically run the configure script
for you.
The only options that you are likely to want to use are the ones in
the last section entitled, "--enable and --with options recognized:"
A popular choice is to build the Apache module version. You need
to know where the source code directory for your Apache server is
located. Then use an option like: --with-apache=/usr/local/src/apache
if that is your Apache source code directory. If you only specify
--with-apache, then it will default to look for your Apache source
in /usr/local/etc/httpd.
NOTE: The directory you specify should be the top-level of the
unpacked Apache (or Stronghold) distribution. The configure program
will automatically look for httpd.h in different directories under that
location depending on which version of Apache, including Stronghold,
you are running.
For MySQL support, since newer versions of MySQL installs its various
components under /usr/local, this is the default. If you have
changed the location you can specify it with: --with-mysql=/opt/local
for example. Otherwise just use: --with-mysql
*NOTE* If you are using Apache 1.3b6 or later, you should run the
Apache Configure script at least once before compiling PHP. It
doesn't matter how you have Apache configured at this point.
3. Compile and install the files. Simply type: make install
For the Apache module version this will copy the appropriate files
to the src/modules/php4 directory in your Apache distribution if
you are using Apache 1.3.x. If you are still running Apache 1.2.x
these files will be copied directly to the main src directory.
For Apache 1.3b6 and later, you can use the new APACI configuration
mechanism. To automatically build Apache with PHP support, use:
cd apache_1.3.x
./configure --prefix=/<path>/apache \
--activate-module=src/modules/php4/libphp4.a
make
make install
If you do not wish to use this new configuration tool, the old
install procedure (src/Configure) will work fine.
If you are using the old Apache ./Configure script, you will have to
edit the Apache src/Configuration file manually. If you do not have
this file, copy Configuration.tmpl to Configuration.
For Apache 1.3.x add:
AddModule modules/php4/libphp4.a
For Apache 1.3.x don't do anything else. Just add this line and then
run "./Configure" followed by "make".
For Apache 1.2.x add:
Module php4_module mod_php4.o
For Apache 1.2.x you will also have to look in the libphp4.module file,
which was copied to the src directory. The EXTRA_LIBS line in the Apache
Configuration file needs to be set to use the same libs as specified on
the LIBS line in libphp4.module. You also need to make sure to add
"-L." to the beginning of the EXTRA_LIBS line.
So, as an example, your EXTRA_LIBS line might look like:
EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient
NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
is in the libphp4.module file.
Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file
and set the WANTHSREGEX directive accordingly in your Configuration file.
This last step applies to versions of Apache prior to 1.3b3.
This is a bit of a hassle, but should serve as incentive to move to
Apache 1.3.x where this step has been eliminated.
Once you are satisfied with your Configuration settings, type: ./Configure
If you get errors, chances are that you forgot a library or made a typo
somewhere. Re-edit Configuration and try again. If it goes well,
type: make
4. Setting up the server.
You should now have a new httpd binary. Shut down your existing server,
if you have one, and copy this new binary overtop of it. Perhaps make
a backup of your previous one first. Then edit your conf/srm.conf file
and add the line:
AddType application/x-httpd-php .php
There is also an interesting feature which can be quite instructive and
helpful while debugging. That is the option of having colour syntax
highlighting. To enable this, add the following line:
AddType application/x-httpd-php-source .phps
Any file ending in .phps will now be displayed with full colour syntax
highlighting instead of being executed.
When you are finished making changes to your srm.conf file, you can
start up your server.
USING PHP3 AND PHP4 AS CONCURRENT APACHE MODULES
Recent operating systems provide the ability to perform versioning and
scoping. This features make it possible to let PHP3 and PHP4 run as
concurrent modules in one Apache server.
This feature is known to work on the following platforms:
- Linux with recent binutils (binutils 2.9.1.0.25 tested)
- Solaris 2.5 or better
- FreeBSD (3.2, 4.0 tested)
To enable it, configure PHP3 and PHP4 to use APXS (--with-apxs) and the
necessary link extensions (--enable-versioning). Otherwise, all standard
installations instructions apply. For example:
$ ./configure \
--with-apxs=/apache/bin/apxs \
--enable-versioning \
--with-mysql \
--enable-track-vars
If this also works on your platform or if you know a way to do it, please
report it to our bug database at http://bugs.php.net
+70
View File
@@ -0,0 +1,70 @@
--------------------------------------------------------------------
The PHP License, version 2.01
Copyright (c) 1999 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior 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.
4. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the
terms of that version. You may also choose to use such covered
code under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
5. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP, freely available from
http://www.php.net/".
6. Permission to freely distribute and use Zend as an integrated
part of PHP is granted, under the conditions of version 0.91
of the Zend License.
The license is bundled with the Zend engine, and is available
at http://www.zend.com/license/0_91.txt, or by contacting
license@zend.com.
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------
This software consists of voluntary contributions made by many
individuals on behalf of the PHP Group.
The PHP Group can be contacted via Email at php-group@php.net.
For more information on the PHP Group and the PHP project,
please see <http://www.php.net>.
+20
View File
@@ -0,0 +1,20 @@
Module Status
------ ------
MySQL Working
COM Working
WDDX Working
PCRE Working
DBA Working
mcrypt Working
mhash Working
dbase Working
aspell Working
imap Working
ldap Working
oci8 Working (but no blob-support yet)
oracle Working
iptc Working
informix Working
zlib Working
sysvshm Working
odbc Working (except for persistent connections)
+240
View File
@@ -0,0 +1,240 @@
# +----------------------------------------------------------------------+
# | PHP HTML Embedded Scripting Language Version 4.0 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
# +----------------------------------------------------------------------+
# | This program is free software; you can redistribute it and/or modify |
# | it under the terms of one of the following licenses: |
# | |
# | A) the GNU General Public License as published by the Free Software |
# | Foundation; either version 2 of the License, or (at your option) |
# | any later version. |
# | |
# | B) the PHP License as published by the PHP Development Team and |
# | included in the distribution in the file: LICENSE |
# | |
# | This program is distributed in the hope that it will be useful, |
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# | GNU General Public License for more details. |
# | |
# | You should have received a copy of both licenses referred to here. |
# | If you did not, or have any questions about PHP licensing, please |
# | contact core@php.net. |
# +----------------------------------------------------------------------+
#
# $Id$
#
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
VPATH = @srcdir@
bindir = @bindir@
top_builddir = .
ZEND_DIR = $(srcdir)/libzend
TSRM_DIR = @TSRM_DIR@
SUBDIRS=libzend ext $(TSRM_DIR)
PACKAGE = @PACKAGE@
VERSION = @VERSION@
LN_S = @LN_S@
CC = @CC@
AR = ar rc
BINNAME = @BINNAME@
INSTALL_IT = @INSTALL_IT@
EXTRA_LIBS = @EXTRA_LIBS@
EXT_LIBS = @EXT_LIBS@
INCLUDES = @INCLUDES@
INCLUDE = -I$(srcdir) -I. -I$(ZEND_DIR) -I$(srcdir)/TSRM $(INCLUDES)
PROF_CFLAGS =
CFLAGS_SHLIB = @CFLAGS_SHLIB@
LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
LDFLAGS_SHLIB_EXPORT = @LDFLAGS_SHLIB_EXPORT@
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@
CFLAGS = @CFLAGS@ @DEBUG_CFLAGS@ $(PROF_CFLAGS)
COMPILE = $(CC) $(CFLAGS) $(CFLAGS_SHLIB) $(CPPFLAGS) $(INCLUDE) $(DEFS) @STRONGHOLD@
LDFLAGS = @VERSION_SCRIPT@ @RPATHS@ @LDFLAGS@ $(LDFLAGS_SHLIB) $(LDFLAGS_SHLIB_EXPORT) -L$(ZEND_DIR)
REGCFLAGS = $(CFLAGS)
RANLIB = @RANLIB@
YACC = @YACC@
MAINT = @MAINT@
APXS = @APXS@
APXS_LDFLAGS = $(EXTRA_LIBS) $(LIBS)
APXS_EXP = @APXS_EXP@
WARNING_LEVEL = @WARNING_LEVEL@
LEX_CFLAGS = -w$(WARNING_LEVEL) @LEX_CFLAGS@
EXT_SHARED = @EXT_SHARED@
LIBOBJS=@LIBOBJS@
SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \
configuration-parser.c configuration-scanner.c request_info.c \
safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c output.c \
php_ini.c SAPI.c cgi_main.c rfc1867.c dlist.c php_content_types.c \
aolserver.c
OBJS = $(SOURCE:.c=.o) $(LIBOBJS)
PHPLIBS = -Llibzend -lzend -Lext -lphpext
LIBS = $(PHPLIBS) $(EXTRA_LIBS) @LIBS@
all: $(BINNAME)
all-recursive clean-recursive distclean-recursive \
maintainer-clean-depend-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
for subdir in $(SUBDIRS); do \
target=`echo $@ | sed s/-recursive//`; \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $$target) || fail=yes; \
done && test -z "$$fail"
# CGI binary or fhttpd module
php: all-recursive $(OBJS) @REGEX_LIB@ @FHTTPD_LIB@
$(CC) $(CFLAGS) -o $(BINNAME) $(LDFLAGS) $(OBJS) $(LIBS)
# Apache modules
libphp4.a libmodphp4.a: all-recursive $(OBJS) @REGEX_LIB@
$(AR) $@.tmp $(OBJS)
$(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
@rm -f $@.tmp
$(RANLIB) $(BINNAME)
# Apache modules
libmodphp4-so.a: all-recursive $(OBJS) @REGEX_LIB@
$(AR) $@.tmp $(OBJS)
$(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
@rm -f $@.tmp
$(RANLIB) libmodphp4-so.a
# Apache 1.3 shared module
libphp4.so: $(srcdir)/mod_php4.c libmodphp4-so.a @REGEX_LIB@
-@test -f ./mod_php4.c || test -L ./mod_php4.c || $(LN_S) $(srcdir)/mod_php4.c ./mod_php4.c
-@test -f ./mod_php4.c || test -h ./mod_php4.c || $(LN_S) $(srcdir)/mod_php4.c ./mod_php4.c
$(APXS) $(INCLUDE) -c -o libphp4.so @VERSION_SCRIPT@ @RPATHS@ ./mod_php4.c libmodphp4-so.a $(APXS_LDFLAGS) $(APXS_EXP)
php4_aol.so: libmodphp4-so.a
g++ $(LDFLAGS) -shared aolserver.o -o $@ libmodphp4-so.a $(LIBS)
regex/libregex.a:
(cd regex; $(MAKE) lib)
configuration-parser.h configuration-parser.c: $(srcdir)/configuration-parser.y
bison -p cfg -v -d $(srcdir)/configuration-parser.y -o configuration-parser.c
configuration-scanner.o: configuration-scanner.c
$(COMPILE) $(LEX_CFLAGS) -c configuration-scanner.c
configuration-scanner.c: $(srcdir)/configuration-scanner.l
flex -Pcfg -oconfiguration-scanner.c -i $(srcdir)/configuration-scanner.l
clean: clean-recursive
-rm -f libphp4.a libmodphp4.a libphp4.so php *.o
-rm -f test/php.desc test/php.in test/php.out test/php.test
-rm -f test/a.tmp test/b.tmp test/test.dbm*
distclean: clean distclean-recursive
-rm -f *-parser.[ch] *-scanner.c *.output
-rm -f config.status config.cache config.log
-rm -f Makefile Makefile.depend php_config.h build-defs.h
-rm -f libphp4.module stamp-h buildconf.stamp
-rm -f regex/*.o regex/*.a regex/*.ih
-rm -f doc/checkdoc doc/funcparse doc/version.ent
-rm -f do-conf test/test.log
-rm -f doc/Makefile regex/Makefile
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
dist: distdir
-chmod -R a+r $(distdir)
tar chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir:
-rm -rf $(distdir)
files=`echo *` ;\
mkdir $(distdir) ;\
for file in $$files ; do \
d=$(srcdir); \
if test -d $$d/$$file ; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
(cd $(distdir) ; $(MAKE) distclean)
cd $(distdir)/libzend ;\
flex -Pzend -ozend-scanner.c -i zend-scanner.l ;\
bison -p zend -v -d zend-parser.y -o zend-parser.c
cd $(distdir) ;\
flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.l ;\
bison -p cfg -v -d configuration-parser.y -o configuration-parser.c
find $(distdir) -name CVS -o -name .cvsignore | xargs rm -rf
maintainer-clean-depend: maintainer-clean-depend-recursive
bench: $(BINNAME)
./$(BINNAME) -c. tests/bench.phtml
# can't use a single rule for this because 'test' is a directory
test: regression
regression check: $(BINNAME)
cd test && ./testall
config.status: configure
./config.status --recheck
build-defs.h php_config.h: stamp-h
stamp-h: php_config.h.in config.status
CONFIG_FILES='build-defs.h stamp-h' ./config.status
Makefile: Makefile.in config.status
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
#
# You must use '--enable-maintainer-mode' with configure to enable
# these rules, which requires autoconf be installed.
#
configure: @MAINT@ configure.in aclocal.m4
cd $(srcdir) && autoconf
php_config.h.in: @MAINT@ stamp-h.in
stamp-h.in: configure.in aclocal.m4 acconfig.h
cd ${srcdir} && autoheader && touch ${srcdir}/stamp-h.in
install: install-recursive $(BINNAME)
$(INSTALL_IT)
install-recursive:
if test "$(EXT_SHARED)" != ""; then \
for dir in X $(EXT_SHARED); do \
test -d ext/$$dir && (cd ext/$$dir; $(MAKE) install); \
done; \
fi
indent: clean
indent -v -kr -cli4 -ts4 \
-T pval -T HashTable -T Bucket -T Token -T TokenCache -T TokenCacheManager \
-T switch_expr -T internal_function -T control_structure_data \
-T MemoryHashTable -T MemoryBucket \
-T pvalue_value -T Stack *.c *.h
rm -f *~
.c.o:
$(COMPILE) -c $<
parser-scanner: configuration-parser.c configuration-scanner.c
depend: parser-scanner
$(CC) $(CFLAGS) -MM $(SOURCE) | perl -pe 's|regex/regex.h||;' > Makefile.depend
$(CC) $(CFLAGS) -MM $(FUNCTIONS_SOURCE) | perl -pe 's|^(.+\.o)|functions/$$1|; s|regex/regex.h||;' >> Makefile.depend
# Local Variables:
# tab-width: 4
# End:
+17
View File
@@ -0,0 +1,17 @@
How to install PHP with the BCMath arbitrary precision math library?
--------------------------------------------------------------------
Due to license restrictions, the BC math library can no longer be distributed
along with PHP. The BC math library is distributed under the restrictive
GNU Public License, and PHP is no longer distributed under that license, but
under a less restrictive license, the PHP License.
If you want to enable BC math support (recommended), all you have to do is
simply download http://www.php.net/extra/number4.tar.gz, and untar it on the
top level php4 directory.
A typical way of doing this would be (assuming that you have lynx):
cd ~/php4
lynx -dump -source http://www.php.net/extra/number4.tar.gz | gzip -d | tar xvf -
The PHP Group
+57
View File
@@ -0,0 +1,57 @@
QNX4 Installation Notes
-----------------------
NOTE: General installation instructions are in the INSTALL file
1. To compile and test PHP3 you have to grab, compile and install:
- GNU dbm library or another db library;
- GNU bison (1.25 or later; 1.25 tested);
- GNU flex (any version supporting -o and -P options; 2.5.4 tested);
- GNU diffutils (any version supporting -w option; 2.7 tested);
2. To use CVS version you may need also:
- GNU CVS (1.9 tested);
- GNU autoconf (2.12 tested);
- GNU m4 (1.3 or later preferable; 1.4 tested);
3. To run configure define -lunix in command line:
LDFLAGS=-lunix ./configure
4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in
command line and run configure with --with-custom-odbc:
CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50
If you have SQL Anywhere version 5.5.00, then you have to add
CFLAGS=-DSQLANY_BUG
to workaround its SQLFreeEnv() bug. Other versions has not been tested,
so try without this flag first.
5. To build the Apache module, you may have to hardcode an include path for
alloc.h in your Apache base directory:
- APACHE_DIRECTORY/src/httpd.h:
change #include "alloc.h"
to #include "APACHE_DIRECTORY/src/alloc.h"
Unless you want to use system regex library, you have to hardcode also
a path to regex.h:
- APACHE_DIRECTORY/src/conf.h:
change #include <regex.h>
to #include "APACHE_DIRECTORY/src/regex/regex.h"
I don't know so far why this required for QNX, may be it is Watcom
compiler problem.
If you building Apache module with SQL Anywhere support, you'll get
symbol conflict with BOOL. It is defined in Apache (httpd.h) and in
SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to
fix it yourself someway.
6. With above precautions, it should compile as is and pass regression
tests completely:
make
make check
make install
Don't bother me unless you really sure you made that all but it
still doesn't work.
June 28, 1998
Igor Kovalenko -- owl@infomarket.ru
+120
View File
@@ -0,0 +1,120 @@
/* This is the default configuration file to read -*- C -*- */
/* these are defined by automake */
#undef PACKAGE
#undef VERSION
#undef HAVE_AOLSERVER
#undef HAVE_STRUCT_FLOCK
#undef HAVE_TM_GMTOFF
#define CONFIGURATION_FILE_PATH "php.ini"
#define USE_CONFIG_FILE 1
#undef HAVE_DMALLOC
/* Some global constants defined by conigure */
#undef PHP_BUILD_DATE
#undef PHP_OS
#undef PHP_UNAME
/* define uint by configure if it is missed (QNX and BSD derived) */
#undef uint
/* define ulong by configure if it is missed (most probably is) */
#undef ulong
/* type check for in_addr_t */
#undef in_addr_t
/* Define if you have dirent.h but opendir() resides in libc rather than in libdir */
/* This will cause HAVE_DIRENT_H defined twice sometimes, but it should be problem */
#undef HAVE_DIRENT_H
/* Define if you have the resolv library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define if you have the pam library (-lpam). */
#define HAVE_LIBPAM 0
/* Define if you have the bind library (-lbind). */
#define HAVE_LIBBIND 0
/* Define if you have Netscape LDAP instead of umich ldap or openldap*/
#define HAVE_NSLDAP 0
/* Define if you want safe mode enabled by default. */
#define PHP_SAFE_MODE 0
/* Set to the path to the dir containing safe mode executables */
#define PHP_SAFE_MODE_EXEC_DIR /usr/local/php/bin
/* Define if you want POST/GET/Cookie track variables by default */
#define PHP_TRACK_VARS 0
/* Undefine if you want stricter XML/SGML compliance by default */
/* (this disables "<?expression?>" by default) */
#define DEFAULT_SHORT_OPEN_TAG 1
/* Undefine if you do not want PHP by default to escape "'" */
/* in GET/POST/Cookie data */
#define MAGIC_QUOTES 1
/* Define both of these if you want the bundled REGEX library */
#define REGEX 0
#define HSREGEX 0
/* Define if you have and want to use libnsl */
#undef HAVE_LIBNSL
/* Define if you have and want to use libsocket */
#undef HAVE_LIBSOCKET
/* Define if you have the sendmail program available */
#define HAVE_SENDMAIL 0
/* Define if you are compiling PHP as an Apache module */
#define APACHE 0
/* Define if you are compiling PHP as an Apache module with mod_charset patch applied (aka Russian Apache)*/
#define USE_TRANSFER_TABLES 0
/* Define if you are compiling PHP as an fhttpd module */
#define FHTTPD 0
/* Define if your Apache creates an ap_config.h header file (only 1.3b6 and later) */
#define HAVE_AP_CONFIG_H 0
/* Define if your Apache has src/include/compat.h */
#define HAVE_OLD_COMPAT_H 0
/* Define if your Apache has src/include/ap_compat.h */
#define HAVE_AP_COMPAT_H 0
#ifndef DEBUG /* should be set to ZEND_DEBUG */
#define DEBUG 0
#endif
/* Define if you want to enable PHP RPC (experimental) */
#define PHP_RPC 0
/* Define if you want to prevent the CGI from working unless REDIRECT_STATUS is defined in the environment */
#define FORCE_CGI_REDIRECT 0
/* Define if you want to prevent the CGI from using path_info and path_translated */
#define DISCARD_PATH 0
/* Define if you want include() and other functions to be able to open
* http and ftp URLs as files.
*/
#define PHP3_URL_FOPEN 0
/* Define if you have broken header files like SunOS 4 */
#define MISSING_FCLOSE_DECL 0
/* Define if you have broken sprintf function like SunOS 4 */
#define BROKEN_SPRINTF 0
/* Define to compile PHP/Zend thread safe */
#undef ZTS
+236
View File
@@ -0,0 +1,236 @@
dnl $Id$
dnl
dnl This file contains local autoconf functions.
dnl
dnl AC_PHP_ONCE(namespace, variable, code)
dnl
dnl execute code, if variable is not set in namespace
dnl
AC_DEFUN(AC_PHP_ONCE,[
unique=`echo $ac_n "$2$ac_c" | tr -c -d a-zA-Z0-9`
cmd="echo $ac_n \"\$$1$unique$ac_c\""
if test -n "$unique" && test "`eval $cmd`" = "" ; then
eval "$1$unique=set"
$3
fi
])
dnl
dnl AC_EXPAND_PATH(path, variable)
dnl
dnl expands path to an absolute path and assigns it to variable
dnl
AC_DEFUN(AC_EXPAND_PATH,[
if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
$2="$1"
else
$2="`pwd`/$1"
fi
])
dnl
dnl AC_ADD_LIBPATH(path)
dnl
dnl add a library to linkpath/runpath
dnl
AC_DEFUN(AC_ADD_LIBPATH,[
if test "$1" != "/usr/lib"; then
AC_EXPAND_PATH($1, ai_p)
AC_PHP_ONCE(LIBPATH, $ai_p, [
EXTRA_LIBS="$EXTRA_LIBS -L$ai_p"
PHP_RPATHS="$PHP_RPATHS $ai_p"
])
fi
])
dnl
dnl AC_BUILD_RPATH()
dnl
dnl builds RPATH from PHP_RPATHS
dnl
AC_DEFUN(AC_BUILD_RPATH,[
if test "$enable_rpath" = "yes" && test -n "$PHP_RPATHS"; then
if test -n "$AXPS"; then
for i in $PHP_RPATHS; do
RPATHS="$RPATHS ${apxs_runpath_switch}$i'"
done
else
for i in $PHP_RPATHS; do
RPATHS="$RPATHS ${ld_runpath_switch}$i"
done
fi
fi
])
dnl
dnl AC_ADD_INCLUDE(path)
dnl
dnl add a include path
dnl
AC_DEFUN(AC_ADD_INCLUDE,[
if test "$1" != "/usr/include"; then
AC_EXPAND_PATH($1, ai_p)
AC_PHP_ONCE(INCLUDEPATH, $ai_p, [
INCLUDES="$INCLUDES -I$ai_p"
])
fi
])
dnl
dnl AC_ADD_LIBRARY(library)
dnl
dnl add a library to the link line
dnl
AC_DEFUN(AC_ADD_LIBRARY,[
AC_PHP_ONCE(LIBRARY, $1, [
EXTRA_LIBS="$EXTRA_LIBS -l$1"
])
])
dnl
dnl AC_ADD_LIBRARY_WITH_PATH(library, path)
dnl
dnl add a library to the link line and path to linkpath/runpath
dnl
AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH,[
AC_ADD_LIBPATH($2)
AC_ADD_LIBRARY($1)
])
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
])
dnl
dnl Check for cc option
dnl
AC_DEFUN(AC_CHECK_CC_OPTION,[
echo "main(){return 0;}" > conftest.$ac_ext
opt="$1"
var=`echo $ac_n "$opt$ac_c"|tr -c a-zA-Z0-9 _`
AC_MSG_CHECKING([if compiler supports -$1 really])
ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1"
if eval $ac_php_compile 2>&1 | egrep "$opt" > /dev/null 2>&1 ; then
eval php_cc_$var=no
AC_MSG_RESULT(no)
else
if eval ./conftest 2>/dev/null ; then
eval php_cc_$var=yes
AC_MSG_RESULT(yes)
else
eval php_cc_$var=no
AC_MSG_RESULT(no)
fi
fi
])
dnl
dnl See if we have broken header files like SunOS has.
dnl
AC_DEFUN(AC_MISSING_FCLOSE_DECL,[
AC_MSG_CHECKING([for fclose declaration])
AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
AC_DEFINE(MISSING_FCLOSE_DECL,0)
AC_MSG_RESULT(ok)
],[
AC_DEFINE(MISSING_FCLOSE_DECL,1)
AC_MSG_RESULT(missing)
])
])
dnl
dnl Check for broken sprintf()
dnl
AC_DEFUN(AC_BROKEN_SPRINTF,[
AC_MSG_CHECKING([for broken sprintf])
AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[
AC_DEFINE(BROKEN_SPRINTF,0)
AC_MSG_RESULT(ok)
],[
AC_DEFINE(BROKEN_SPRINTF,1)
AC_MSG_RESULT(broken)
],[
AC_DEFINE(BROKEN_SPRINTF,0)
AC_MSG_RESULT(cannot check, guessing ok)
])
])
dnl
dnl Stuff to do when setting up a new extension.
dnl XXX have to change the hardcoding of ".a" when we want to be able
dnl to make dynamic libraries as well.
dnl
AC_DEFUN(PHP_EXTENSION,[
if test -d "$cwd/$srcdir/ext/$1" ; then
EXT_SUBDIRS="$EXT_SUBDIRS $1"
if test "$2" != "shared" -a "$2" != "yes"; then
_extlib="libphpext_$1.a"
EXT_LIBS="$EXT_LIBS $1/$_extlib"
EXTINFO_DEPS="$EXTINFO_DEPS ../ext/$1/extinfo.c.stub"
EXT_STATIC="$EXT_STATIC $1"
else
EXT_SHARED="$EXT_SHARED $1"
fi
dnl EXT_INCLUDE_CODE="\#include \"ext/$1/php3_$1.h\"\\n$EXT_INCLUDE_CODE"
dnl EXT_MODULE_PTRS="phpext_$1_ptr, $EXT_MODULE_PTRS"
dnl "
fi
])
AC_SUBST(EXT_SUBDIRS)
AC_SUBST(EXT_STATIC)
AC_SUBST(EXT_SHARED)
AC_SUBST(EXT_LIBS)
AC_SUBST(EXTINFO_DEPS)
dnl AC_SUBST(EXT_INCLUDE_CODE)
dnl AC_SUBST(EXT_MODULES_PTRS)
dnl
dnl Solaris requires main code to be position independent in order
dnl to let shared objects find symbols. Weird. Ugly.
dnl
dnl Must be run after all --with-NN options that let the user
dnl choose dynamic extensions, and after the gcc test.
dnl
AC_DEFUN(PHP_SOLARIS_PIC_WEIRDNESS,[
AC_MSG_CHECKING(whether -fPIC is required)
if test "$EXT_SHARED" != ""; then
os=`uname -sr 2>/dev/null`
case "$os" in
"SunOS 5.6"|"SunOS 5.7")
case "$CC" in
gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
*) CFLAGS="$CFLAGS -fpic";;
esac
AC_MSG_RESULT(yes);;
*)
AC_MSG_RESULT(no);;
esac
else
AC_MSG_RESULT(no)
fi
])
dnl
dnl Checks whether $withval is "shared" or starts with "shared,XXX"
dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff
dnl from $withval.
dnl
AC_DEFUN(PHP_WITH_SHARED,[
case $withval in
shared)
shared=yes
withval=yes
;;
shared,*)
shared=yes
withval=`echo $withval | sed -e 's/^shared,//'`
;;
*)
shared=no
;;
esac
])
+343
View File
@@ -0,0 +1,343 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 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_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sascha Schumann <sascha@schumann.cx> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
/* conflict between PHP and aolserver */
#define Debug php_Debug
#include "php.h"
#undef Debug
#ifdef HAVE_AOLSERVER
#include "php_ini.h"
#include "php_globals.h"
#include "SAPI.h"
#include "main.h"
#include "ns.h"
#include "php_version.h"
int Ns_ModuleVersion = 1;
#define NSLS_D ns_globals_struct *ns_context
#define NSLS_DC , NSLS_D
#define NSLS_C ns_context
#define NSLS_CC , NSLS_C
#define NSG(v) (ns_context->v)
#define NSLS_FETCH() ns_globals_struct *ns_context = ts_resource(ns_globals_id)
static int ns_globals_id;
typedef struct {
sapi_module_struct *sapi_module;
char *ns_server;
char *ns_module;
} php_ns_context;
typedef struct {
Ns_Conn *conn;
Ns_DString content_type;
} ns_globals_struct;
static void php_ns_config(php_ns_context *ctx);
static int
php_ns_sapi_ub_write(const char *str, uint str_length)
{
int sent_bytes;
NSLS_FETCH();
sent_bytes = Ns_ConnWrite(NSG(conn), (void *) str, str_length);
return sent_bytes;
}
static int
php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
{
char *header_name, *header_content;
char *p;
NSLS_FETCH();
header_name = sapi_header->header;
header_content = p = strchr(header_name, ':');
if(!p) return 0;
*p = '\0';
do {
header_content++;
} while(*header_content == ' ');
if(!strcasecmp(header_name, "Content-type")) {
Ns_ConnSetTypeHeader(NSG(conn), header_content);
} else {
Ns_ConnSetHeaders(NSG(conn), header_name, header_content);
}
*p = ':';
efree(sapi_header->header);
return 0;
}
static int
php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
{
NSLS_FETCH();
if(SG(sapi_headers).send_default_content_type) {
Ns_ConnSetRequiredHeaders(NSG(conn), "text/html", 0);
}
Ns_ConnFlushHeaders(NSG(conn), SG(sapi_headers).http_response_code);
return SAPI_HEADER_SENT_SUCCESSFULLY;
}
static int
php_ns_sapi_read_post(char *buf, uint count_bytes SLS_DC)
{
uint total_read = 0;
NSLS_FETCH();
total_read = Ns_ConnRead(NSG(conn), buf, count_bytes);
if(total_read == NS_ERROR) {
total_read = -1;
}
return total_read;
}
static char *
php_ns_sapi_read_cookies(SLS_D)
{
int i;
char *http_cookie = NULL;
NSLS_FETCH();
i = Ns_SetFind(NSG(conn->headers), "cookie");
if(i != -1) {
http_cookie = Ns_SetValue(NSG(conn->headers), i);
}
return http_cookie;
}
static sapi_module_struct sapi_module = {
"PHP Language",
php_module_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
php_ns_sapi_ub_write, /* unbuffered write */
php_error, /* error handler */
php_ns_sapi_header_handler, /* header handler */
php_ns_sapi_send_headers, /* send headers handler */
NULL, /* send header handler */
php_ns_sapi_read_post, /* read POST data */
php_ns_sapi_read_cookies, /* read Cookies */
STANDARD_SAPI_MODULE_PROPERTIES
};
static void
php_ns_hash_environment(NSLS_D CLS_DC ELS_DC PLS_DC SLS_DC)
{
int i;
for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
char *key = Ns_SetKey(NSG(conn->headers), i);
char *value = Ns_SetValue(NSG(conn->headers), i);
char *p;
zval *pval;
char buf[512];
int buf_len;
buf_len = snprintf(buf, 511, "HTTP_%s", key);
for(p = buf; *p; p++) {
*p = toupper(*p);
if(*p < 'A' || *p > 'Z') {
*p = '_';
}
}
MAKE_STD_ZVAL(pval);
pval->type = IS_STRING;
pval->value.str.len = strlen(value);
pval->value.str.val = estrndup(value, pval->value.str.len);
zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL);
}
}
static int
php_ns_module_main(NSLS_D SLS_DC)
{
zend_file_handle file_handle;
CLS_FETCH();
ELS_FETCH();
PLS_FETCH();
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.filename = SG(request_info).path_translated;
php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
php_ns_hash_environment(NSLS_C CLS_CC ELS_CC PLS_CC SLS_CC);
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
php_request_shutdown(NULL);
return NS_OK;
}
static void
php_ns_request_ctor(NSLS_D SLS_DC)
{
char *server;
Ns_DString ds;
char *root;
server = Ns_ConnServer(NSG(conn));
SG(request_info).query_string = NSG(conn->request->query);
Ns_DStringInit(&ds);
Ns_UrlToFile(&ds, server, NSG(conn->request->url));
SG(request_info).path_translated = strdup(Ns_DStringValue(&ds));
Ns_DStringFree(&ds);
root = Ns_PageRoot(server);
SG(request_info).request_uri = SG(request_info).path_translated + strlen(root);
SG(request_info).request_method = NSG(conn)->request->method;
SG(request_info).content_length = Ns_ConnContentLength(NSG(conn));
Ns_DStringInit(&NSG(content_type));
Ns_ConnCopyToDString(NSG(conn), SG(request_info).content_length, &NSG(content_type));
SG(request_info).content_type = Ns_DStringValue(&NSG(content_type));
SG(request_info).auth_user = NULL;
SG(request_info).auth_password = NULL;
}
static void
php_ns_request_dtor(NSLS_D SLS_DC)
{
free(SG(request_info).path_translated);
Ns_DStringFree(&NSG(content_type));
}
static int
php_ns_request_handler(void *context, Ns_Conn *conn)
{
int status = NS_OK;
SLS_FETCH();
NSLS_FETCH();
NSG(conn) = conn;
php_ns_request_ctor(NSLS_C SLS_CC);
status = php_ns_module_main(NSLS_C SLS_CC);
php_ns_request_dtor(NSLS_C SLS_CC);
return status;
}
static void
php_ns_config(php_ns_context *ctx)
{
int i;
char *path;
Ns_Set *set;
path = Ns_ConfigPath(ctx->ns_server, ctx->ns_module, NULL);
set = Ns_ConfigGetSection(path);
for(i = 0; set && i < Ns_SetSize(set); i++) {
char *key = Ns_SetKey(set, i);
char *value = Ns_SetValue(set, i);
if(!strcasecmp(key, "map")) {
Ns_Log(Notice, "Registering PHP for \"%s\"", value);
Ns_RegisterRequest(ctx->ns_server, "GET", value, php_ns_request_handler, NULL, ctx, 0);
Ns_RegisterRequest(ctx->ns_server, "POST", value, php_ns_request_handler, NULL, ctx, 0);
Ns_RegisterRequest(ctx->ns_server, "HEAD", value, php_ns_request_handler, NULL, ctx, 0);
} else if(!strcasecmp(key, "php_value")) {
char *val;
val = strchr(value, ' ');
if(val) {
char *new_key;
new_key = estrndup(value, val - value);
do {
val++;
} while(*val == ' ');
Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val);
php_alter_ini_entry(new_key, strlen(new_key) + 1, val,
strlen(val) + 1, PHP_INI_SYSTEM);
efree(new_key);
}
}
}
}
static void
php_ns_server_shutdown(void *context)
{
php_ns_context *ctx = (php_ns_context *) context;
ctx->sapi_module->shutdown(ctx->sapi_module);
sapi_shutdown();
tsrm_shutdown();
free(ctx->ns_module);
free(ctx->ns_server);
free(ctx);
}
int Ns_ModuleInit(char *server, char *module)
{
php_ns_context *ctx;
tsrm_startup(1, 1, 0);
sapi_startup(&sapi_module);
sapi_module.startup(&sapi_module);
ns_globals_id = ts_allocate_id(sizeof(ns_globals_struct), NULL, NULL);
ctx = malloc(sizeof *ctx);
ctx->sapi_module = &sapi_module;
ctx->ns_server = strdup(server);
ctx->ns_module = strdup(module);
php_ns_config(ctx);
Ns_RegisterServerShutdown(server, php_ns_server_shutdown, ctx);
return NS_OK;
}
#endif
+4
View File
@@ -0,0 +1,4 @@
This is a place-holder which indicates to Configure that it shouldn't
provide the default targets when building the Makefile in this directory.
Instead it'll just prepend all the important variable definitions, and
copy the Makefile.tmpl onto the end.
+77
View File
@@ -0,0 +1,77 @@
##
## Apache 1.3 Makefile template for PHP 4.0 Module
## [src/modules/php4/Makefile.tmpl]
##
# the parametrized target
LIB=libphp4.$(LIBEXT)
# objects for building the static library
OBJS=mod_php4.o
OBJS_LIB=libmodphp4.a
# objects for building the shared object library
SHLIB_OBJS=mod_php4.so-o
SHLIB_OBJS_LIB=libmodphp4-so.a
# the general targets
all: lib
lib: $(LIB)
# build the static library by merging the object files
libphp4.a: $(OBJS) $(OBJS_LIB)
cp $(OBJS_LIB) $@
ar r $@ $(OBJS)
$(RANLIB) $@
# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
libphp4.: $(OBJS) $(OBJS_LIB)
cp $(OBJS_LIB) $@
ar r $@ $(OBJS)
$(RANLIB) $@
cp libphp4. libphp4.a
# build the shared object library by linking the object files
libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
rm -f $@
$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS)
# 1. extension .o for shared objects cannot be used here because
# first these files aren't still shared objects and second we
# have to use a different name to trigger the different
# implicit Make rule
# 2. extension -so.o (as used elsewhere) cannot be used because
# the suffix feature of Make really wants just .x, so we use
# extension .so-o
.SUFFIXES: .o .so-o
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
.c.so-o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(SPACER) $< && mv $*.o $*.so-o
# cleanup
clean:
-rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
# We really don't expect end users to use this rule. It works only with
# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
# using it.
depend:
cp Makefile.tmpl Makefile.tmpl.bak \
&& sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
&& gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
&& sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
> Makefile.tmpl \
&& rm Makefile.new
#Dependencies
$(OBJS): Makefile
# DO NOT REMOVE
mod_php4.o: mod_php4.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
$(INCDIR)/alloc.h $(INCDIR)/buff.h \
$(INCDIR)/http_config.h \
$(INCDIR)/http_core.h $(INCDIR)/http_main.h \
$(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
$(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php4.h
+276
View File
@@ -0,0 +1,276 @@
Following is a merge of two letters I sent to php4beta@lists.php.net,
describing the changes in API between PHP 3.0 and PHP 4.0 (Zend).
This file is by no means thorough documentation of the PHP API,
and is intended for developers who are familiar with the PHP 3.0 API,
and want to port their code to PHP 4.0, or take advantage of its new
features. For highlights about the PHP 3.0 API, consult apidoc.txt.
Zeev
--------------------------------------------------------------------------
I'm going to try to list the important changes in API and programming
techniques that are involved in developing modules for PHP4/Zend, as
opposed to PHP3. Listing the whole PHP4 API is way beyond my scope here,
it's mostly a 'diff' from the apidoc.txt, which you're all pretty familiar
with.
An important note that I neglected to mention yesterday - the php4 tree is
based on the php 3.0.5 tree, plus all 3.0.6 patches hand-patched into it.
Notably, it does NOT include any 3.0.7 patches. All of those have to be
reapplied, with extreme care - modules should be safe to patch (mostly),
but anything that touches the core or main.c will almost definitely require
changes in order to work properly.
[1] Symbol Tables
One of the major changes in Zend involves changing the way symbols tables
work. Zend enforces reference counting on all values and resources. This
required changes in the semantics of the hash tables that implement symbol
tables. Instead of storing pval in the hashes, we now store pval *. All
of the API functions in Zend were changed in a way that this change is
completely transparent. However, if you've used 'low level' hash functions
to access or update elements in symbol tables, your code will require
changes. Following are two simple examples, one demonstrates the
difference between PHP3 and Zend when reading a symbol's value, and the
other demonstrates the difference when writing a value.
php3_read()
{
pval *foo;
_php3_hash_find(ht, "foo", sizeof("foo"), &foo);
/* foo->type is the type and foo->value is the value */
}
php4_read()
{
pval **foo;
_php3_hash_find(ht, "foo", sizeof("foo"), &foo);
/* (*foo)->type is the type and (*foo)->value is the value */
}
---
php3_write()
{
pval newval;
newval.type = ...;
newval.value = ...;
_php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval), NULL);
}
php4_write()
{
pval *newval = (pval *) emalloc(sizeof(pval));
newval->refcount=1;
newval->is_ref=0;
newval->type = ...;
newval->value = ...;
_php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval *), NULL);
}
[2] Resources
One of the 'cute' things about the reference counting support is that it
completely eliminates the problem of resource leaking. A simple loop that
included '$result = mysql_query(...)' in PHP leaked unless the user
remembered to run mysql_free($result) at the end of the loop body, and
nobody really did. In order to take advantage of the automatic resource
deallocation upon destruction, there's virtually one small change you need
to conduct. Change the result type of a resource that you want to destroy
itself as soon as its no longer referenced (just about any resource I can
think of) as IS_RESOURCE, instead of as IS_LONG. The rest is magic.
A special treatment is required for SQL modules that follow MySQL's
approach for having the link handle as an optional argument. Modules that
follow the MySQL module model, store the last opened link in a global
variable, that they use in case the user neglects to explicitly specify a
link handle. Due to the way referenec counting works, this global
reference is just like any other reference, and must increase that SQL link
resource's reference count (otherwise, it will be closed prematurely).
Simply, when you set the default link to a certain link, increase that
link's reference count by calling zend_list_addref().
As always, the MySQL module is the one used to demonstrate 'new
technology'. You can look around it and look for IS_RESOURCE, as well as
zend_list_addref(), to see a clear example of how the new API should be used.
[3] Thread safety issues
I'm not going to say that Zend was designed with thread safety in mind, but
from some point, we've decided upon several guidelines that would make the
move to thread safety much, much easier. Generally, we've followed the PHP
3.1 approach of moving global variables to a structure, and encapsulating
all global variable references within macros. There are three main
differences:
1. We grouped related globals in a single structure, instead of grouping
all globals in one structure.
2. We've used much, much shorter macro names to increase the readability
of the source code.
3. Regardless of whether we're compiling in thread safe mode or not, all
global variables are *always* stored in a structure. For example, you
would never have a global variable 'foo', instead, it'll be a property of a
global structure, for example, compiler_globals.foo. That makes
development much, much easier, since your code will simply not compile
unless you remember to put the necessary macro around foo.
To write code that'll be thread safe in the future (when we release our
thread safe memory manager and work on integrating it), you can take a look
at zend_globals.h. Essentially, two sets of macros are defined, one for
thread safe mode, and one for thread unsafe mode. All global references
are encapsulated within ???G(varname), where ??? is the appropriate prefix
for your structure (for example, so far we have CG(), EG() and AG(), which
stand for the compiler, executor and memory allocator, respectively).
When compiling with thread safety enabled, each function that makes use of
a ???G() macro, must obtain the pointer to its copy of the structure. It
can do so in one of two forms:
1. It can receive it as an argument.
2. It can fetch it.
Obviously, the first method is preferable since it's much quicker.
However, it's not always possible to send the structure all the way to a
particular function, or it may simply bloat the code too much in some
cases. Functions that receive the globals as an argument, should look like
this:
rettype functioname(???LS_D) <-- a function with no arguments
rettype functioname(type arg1, ..., type argn ???LS_DC) <-- a funciton with
arguments
Calls to such functions should look like this:
functionname(???LS_C) <-- a function with no arguments
functionname(arg1, ..., argn ???LS_CC) <-- a function with arguments
LS stands for 'Local Storage', _C stands for Call and _CC stands for Call
Comma, _D stands for Declaration and _DC stands for Declaration Comma.
Note that there's NO comma between the last argument and ???LS_DC or ???LS_CC.
In general, every module that makes use of globals should use this approach
if it plans to be thread safe.
[4] Generalized INI support
The code comes to solve several issues:
a. The ugly long block of code in main.c that reads values from the
cfg_hash into php3_ini.
b. Get rid of php3_ini. The performance penalty of copying it around all
the time in the Apache module probably wasn't too high, but
psychologically, it annoyed me :)
c. Get rid of the ugly code in mod_php4.c, that also reads values from
Apache directives and puts them into the php3_ini structure.
d. Generalize all the code so that you only have to add an entry in one
single place and get it automatically supported in php3.ini, Apache, Win32
registry, runtime function ini_get() and ini_alter() and any future method
we might have.
e. Allow users to easily override *ANY* php3.ini value, except for ones
they're not supposed to, of course.
I'm happy to say that I think I pretty much reached all goals. php_ini.c
implements a mechanism that lets you add your INI entry in a single place,
with a default value in case there's no php3.ini value. What you get by
using this mechanism:
1. Automatic initialization from php3.ini if available, or from the
default value if not.
2. Automatic support in ini_alter(). That means a user can change the
value for this INI entry at runtime, without you having to add in a single
line of code, and definitely no additional function (for example, in PHP3,
we had to add in special dedicated functions, like
set_magic_quotes_runtime() or the likes - no need for that anymore).
3. Automatic support in Apache .conf files.
4. No need for a global php3_ini-like variable that'll store all that
info. You can directly access each INI entry by name, in runtime. 'Sure,
that's not revolutionary, it's just slow' is probably what some of you
think - which is true, but, you can also register a callback function that
is called each time your INI entry is changed, if you wish to store it in a
cached location for intensive use.
5. Ability to access the current active value for a given INI entry, and
the 'master' value.
Of course, (2) and (3) are only applicable in some cases. Some entries
shouldn't be overriden by users in runtime or through Apache .conf files -
you can, of course, mark them as such.
So, enough hype, how does it work.
Essentially:
static PHP_INI_MH(OnChangeBar); /* declare a message handler for a change
in "bar" */
PHP_INI_BEGIN()
PHP_INI_ENTRY("foo", "1", PHP_INI_ALL, NULL, NULL)
PHP_INI_ENTRY("bar", "bah", PHP_INI_SYSTEM, OnChangeBar, NULL)
PHP_INI_END()
static PHP_INI_MH(OnChangeBar)
{
a_global_var_for_bar = new_value;
return SUCCESS;
}
int whatever_minit(INIT_FUNC_ARGS)
{
...
REGISTER_INI_ENTRIES();
...
}
int whatever_mshutdown(SHUTDOWN_FUNC_ARGS)
{
...
UNREGISTER_INI_ENTRIES();
...
}
and that's it. Here's what it does. As you can probably guess, this code
registers two INI entries - "foo" and "bar". They're given defaults "1"
and "bah" respectively - note that all defaults are always given as
strings. That doesn't reduce your ability to use integer values, simply
specify them as strings. "foo" is marked so that it can be changed by
anyone at any time (PHP_INI_ALL), whereas "foo" is marked so it can be
changed only at startup in the php3.ini only, presumably, by the system
administrator (PHP_INI_SYSTEM).
When "foo" changes, no function is called. Access to it is done using the
macros INI_INT("foo"), INI_FLT("foo") or INI_STR("foo"), which return a
long, double or char * respectively (strings that are returned aren't
duplicated - if they're manipulated, you must duplicate them first). You
can also access the original value (the 'master' value, in case one of them
was overriden by a user) using another pair of macros:
INI_ORIG_INT("foo"), INI_ORIG_FLT("foo") and INI_ORIG_STR("foo").
When "bar" changes, a special message handler is called, OnBarChange().
Always declare those message handlers using PHP_INI_MH(), as they might
change in the future. Message handlers are called as soon as an ini entry
initializes or changes, and allow you to cache a certain INI value in a
quick C structure. In this example, whenever "bar" changes, the new value
is stored in a_global_var_for_bar, which is a global char * pointer,
quickly accessible from other functions. Things get a bit more complicated
when you want to implement a thread-safe module, but it's doable as well.
Message handlers may return SUCCESS to acknowledge the new value, or
FAILURE to reject it. That enables you to reject invalid values for some
INI entries if you want. Finally, you can have a pointer passed to your
message handler - that's the fifth argument to PHP_INI_ENTRY(). It is
passed as mh_arg to the message handler.
Remember that for certain values, there's really no reason to mess with a
callback function. A perfect example for this are the syntax highlight
colors, which no longer have a dedicated global C slot that stores them,
but instead, are fetched from the php_ini hash on demand.
"As always", for a perfect working example of this mechanism, consult
functions/mysql.c. This module uses the new INI entry mechanism, and was
also converted to be thread safe in general, and in its php_ini support in
particular. Converting your modules to look like this for thread safety
isn't a bad idea (not necessarily now, but in the long run).
+492
View File
@@ -0,0 +1,492 @@
PHP Version 3.0 API Documentation
Table of Contents
-----------------
1. Function Prototype
2. Function Arguments
3. Variable number of function arguments
4. Using the function arguments
5. Memory management in functions
6. Setting variables in the symbol table
7. Returning values from functions
8. Returning 'complex' values from functions (arrays or objects)
9. Using the resource list
10. Using the persistent resource table
11. Adding runtime configuration directives
-----------------
1. Function Prototype
All functions look like this:
PHP_FUNCTION(foo) {
}
Even if your function doesn't take any arguments, this is how it is
called.
-----------------
2. Function Arguments
Arguments are always of type pval. This type contains a union which
has the actual type of the argument. So, if your function takes two
arguments, you would do something like the following at the top of your
function:
pval *arg1, *arg2;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&arg1,&arg2)==FAILURE) {
WRONG_PARAM_COUNT;
}
NOTE: Arguments can be passed either by value or by reference. In both
cases you will need to pass &(pval *) to getParameters. If you want to
check if the n'th parameter was sent to you by reference or not, you can
use the function, ParameterPassedByReference(ht,n). It will return either
1 or 0.
When you change any of the passed parameters, whether they are sent by
reference or by value, you can either start over with the parameter by
calling pval_destructor on it, or if it's an ARRAY you want to add to,
you can use functions similar to the ones in internal_functions.h which
manipulate return_value as an ARRAY.
Also if you change a parameter to IS_STRING make sure you first assign
the new estrdup'ed string and the string length, and only later change the
type to IS_STRING. If you change the string of a parameter which already
IS_STRING or IS_ARRAY you should run pval_destructor on it first.
-----------------
3. Variable number of function arguments
A function can take a variable number of arguments. If your function can
take either 2 or 3 arguments, use the following:
pval *arg1, *arg2, *arg3;
int arg_count = ARG_COUNT(ht);
if (arg_count<2 || arg_count>3 ||
getParameters(ht,arg_count,&arg1,&arg2,&arg3)==FAILURE) {
WRONG_PARAM_COUNT;
}
------------------
4. Using the function arguments
The type of each argument is stored in the pval type field:
This type can be any of the following:
IS_STRING String
IS_DOUBLE Double-precision floating point
IS_LONG Long
IS_ARRAY Array
IS_EMPTY ??
IS_USER_FUNCTION ??
IS_INTERNAL_FUNCTION ?? (if some of these cannot be passed to a
function - delete)
IS_CLASS ??
IS_OBJECT ??
If you get an argument of one type and would like to use it as another,
or if you just want to force the argument to be of a certain type, you
can use one of the following conversion functions:
convert_to_long(arg1);
convert_to_double(arg1);
convert_to_string(arg1);
convert_to_boolean_long(arg1); If the string is "" or "0" it
becomes 0, 1 otherwise
convert_string_to_number(arg1); Converts string to either LONG or
DOUBLE depending on string
These function all do in-place conversion. They do not return anything.
The actual argument is stored in a union.
For type IS_STRING, use arg1->value.str.val
IS_LONG arg1->value.lval
IS_DOUBLE arg1->value.dval
-------------------
5. Memory management in functions
Any memory needed by a function should be allocated with either emalloc()
or estrdup(). These are memory handling abstraction functions that look
and smell like the normal malloc() and strdup() functions. Memory should
be freed with efree().
There are two kinds of memory in this program. Memory which is returned
to the parser in a variable and memory which you need for temporary
storage in your internal function. When you assign a string to a
variable which is returned to the parser you need to make sure you first
allocate the memory with either emalloc or estrdup. This memory
should NEVER be freed by you, unless you later, in the same function
overwrite your original assignment (this kind of programming practice is
not good though).
For any temporary/permanent memory you need in your functions/library you
should use the three emalloc(), estrdup(), and efree() functions. They
behave EXACTLY like their counterpart functions. Anything you emalloc()
or estrdup() you have to efree() at some point or another, unless it's
supposed to stick around until the end of the program, otherwise there
will be a memory leak. The meaning of "the functions behave exactly like
their counterparts" is if you efree() something which was not
emalloc()'ed nor estrdup()'ed you might get a segmentation fault. So
please take care and free all of your wasted memory. One of the biggest
improvements in PHP 3.0 will hopefully be the memory management.
If you compile with "-DDEBUG", PHP3 will print out a list of all
memory that was allocated using emalloc() and estrdup() but never
freed with efree() when it is done running the specified script.
-------------------
6. Setting variables in the symbol table
A number of macros are available which make it easier to set a variable
in the symbol table:
SET_VAR_STRING(name,value) **
SET_VAR_DOUBLE(name,value)
SET_VAR_LONG(name,value)
** Be careful here. The value part must be malloc'ed manually because
the memory management code will try to free this pointer later. Do
not pass statically allocated memory into a SET_VAR_STRING
Symbol tables in PHP 3.0 are implemented as hash tables. At any given time,
&symbol_table is a pointer to the 'main' symbol table, and active_symbol_table
points to the currently active symbol table (these may be identical like in
startup, or different, if you're inside a function).
The following examples use 'active_symbol_table'. You should replace it with
&symbol_table if you specifically want to work with the 'main' symbol table.
Also, the same funcions may be applied to arrays, as explained below.
* To check whether a variable named $foo already exists in a symbol table:
if (hash_exists(active_symbol_table,"foo",sizeof("foo"))) { exists... }
else { doesn't exist }
* If you also need to get the type of the variable, you can use:
hash_find(active_symbol_table,"foo",sizeof("foo"),&pvalue);
check(pvalue.type);
Arrays in PHP 3.0 are implemented using the same hashtables as symbol tables.
This means the two above functions can also be used to check variables
inside arrays.
If you want to define a new array in a symbol table, you should do this:
1. Possibly check it exists and abort, using hash_exists()
or hash_find().
2. Code:
pval arr;
if (array_init(&arr) == FAILURE) { failed... };
hash_update(active_symbol_table,"foo",sizeof("foo"),&arr,sizeof(pval),NULL);
This code declares a new array, named $foo, in the active symbol table.
This array is empty.
Here's how to add new entries to it:
pval entry;
entry.type = IS_LONG;
entry.value.lval = 5;
hash_update(arr.value.ht,"bar",sizeof("bar"),&entry,sizeof(pval),NULL); /* defines $foo["bar"] = 5 */
hash_index_update(arr.value.ht,7,&entry,sizeof(pval),NULL); /* defines $foo[7] = 5 */
hash_next_index_insert(arr.value.ht,&entry,sizeof(pval),NULL); /* defines the next free place in $foo[],
* $foo[8], to be 5 (works like php2)
*/
If you'd like to modify a value that you inserted to a hash, you must first retreive it from the hash. To
prevent that overhead, you can supply a pval ** to the hash add function, and it'll be updated with the
pval * address of the inserted element inside the hash. If that value is NULL (like in all of the
above examples) - that parameter is ignored.
hash_next_index_insert() works more or less using the same logic
"$foo[] = bar;" works in PHP 2.0.
If you are building an array to return from a function, you can initialize
the array just like above by doing:
if (array_init(return_value) == FAILURE) { failed...; }
and then adding values with the helper functions:
add_next_index_long(return_value,long_value);
add_next_index_double(return_value,double_value);
add_next_index_string(return_value,estrdup(string_value));
Of course, if the adding isn't done right after the array
initialization, you'd probably have to look for the array first:
pval *arr;
if (hash_find(active_symbol_table,"foo",sizeof("foo"),(void **)&arr)==FAILURE) { can't find... }
else { use arr->value.ht... }
Note that hash_find receives a pointer to a pval pointer, and
not a pval pointer.
Just about any hash function returns SUCCESS or FAILURE (except for
hash_exists() that returns a boolean truth value).
-------------------
7. Returning 'simple' values from functions (integers, floats or strings)
A number of macros are available to make it easier to return things from
functions:
These set the return value and return from the function:
RETURN_FALSE
RETURN_TRUE
RETURN_LONG(l)
RETURN_STRING(s,dup) If dup is true, duplicates the string
RETURN_STRINGL(s,l,dup) Return string (s) specifying length (l).
RETURN_DOUBLE(d)
These only set the return value:
RETVAL_FALSE
RETVAL_TRUE
RETVAL_LONG(l)
RETVAL_STRING(s,dup) If dup is true, duplicates the string
RETVAL_STRINGL(s,l,dup) Return string (s) specifying length (l).
RETVAL_DOUBLE(d)
The string macros above will all estrdup() the passed 's' argument,
so you can safely free the argument after calling the macro, or
alternatively use statically allocated memory.
If your function returns boolean success/error responses, always use
RETURN_TRUE and RETURN_FALSE respectively.
-------------------
8. Returning 'complex' values from functions (arrays or objects)
Your function can also return a complex data type such as an object
or an array.
Returning an object:
1. Call object_init(return_value).
2. Fill it up with values:
add_property_long(return_value,property_name,l) Add a property named 'property_name', of type long, equals to 'l'
add_property_double(return_value,property_name,d) Same, only a double
add_property_string(return_value,property_name,str) Same, only a string
add_property_stringl(return_value,property_name,str,l) Add a property named 'property_name', of type string, string is 'str' with length 'l'
3. Possibly, register functions for this object. In order to
obtain values from the object, the function would have to fetch
"this" from the active_symbol_table. Its type should be IS_OBJECT,
and it's basically a regular hash table (i.e., you can use regular
hash functions on .value.ht). The actual registration of the
function can be done using:
add_method(return_value,function_name,function_ptr)
Returning an array:
1. Call array_init(return_value).
2. Fill it up with values:
add_assoc_long(return_value,key,l) add associative entry with key 'key' and long value 'l'
add_assoc_double(return_value,key,d)
add_assoc_string(return_value,key,str)
add_assoc_stringl(return_value,key,str,length) specify the string length
add_index_long(return_value,index,l) add entry in index 'index' with long value 'l'
add_index_double(return_value,index,d)
add_index_string(return_value,index,str)
add_index_stringl(return_value,index,str,length) specify the string length
add_next_index_long(return_value,l) add an array entry in the next free offset with long value 'l'
add_next_index_double(return_value,d)
add_next_index_string(return_value,str)
add_next_index_stringl(return_value,str,length) specify the string length
-------------------
9. Using the resource list
PHP 3.0 has a standard way of dealing with various types of resources,
that replaces all of the local linked lists in PHP 2.0.
Available functions:
php3_list_insert(ptr, type) returns the 'id' of the newly inserted resource
php3_list_delete(id) delete the resource with the specified id
php3_list_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
Typically, these functions are used for SQL drivers but they can be
used for anything else, and are used, for instance, for maintaining
file descriptors.
Typical list code would look like this:
Adding a new resource:
RESOURCE *resource;
...allocate memory for resource and acquire resource...
/* add a new resource to the list */
return_value->value.lval = php3_list_insert((void *) resource, LE_RESOURCE_TYPE);
return_value->type = IS_LONG;
Using an existing resource:
pval *resource_id;
RESOURCE *resource;
int type;
convert_to_long(resource_id);
resource = php3_list_find(resource_id->value.lval, &type);
if (type != LE_RESOURCE_TYPE) {
php3_error(E_WARNING,"resource index %d has the wrong type",resource_id->value.lval);
RETURN_FALSE;
}
...use resource...
Deleting an existing resource:
pval *resource_id;
RESOURCE *resource;
int type;
convert_to_long(resource_id);
php3_list_delete(resource_id->value.lval);
The resource types should be registered in php3_list.h, in enum
list_entry_type. In addition, one should add shutdown code for any
new resource type defined, in list.c's list_entry_destructor() (even if
you don't have anything to do on shutdown, you must add an empty case).
-------------------
10. Using the persistent resource table
PHP 3.0 has a standard way of storing persistent resources (i.e.,
resources that are kept in between hits). The first module to use
this feature was the MySQL module, and mSQL followed it, so one can
get the general impression of how a persistent resource should be
used by reading mysql.c. The functions you should look at are:
php3_mysql_do_connect()
php3_mysql_connect()
php3_mysql_pconnect()
The general idea of persistence modules is this:
1. Code all of your module to work with the regular resource list
mentioned in section (9).
2. Code extra connect functions that check if the resource already
exists in the persistent resource list. If it does, register it
as in the regular resource list as a pointer to the persistent
resource list (because of 1., the rest of the code
should work immediately). If it doesn't, then create it, add it
to the persistent resource list AND add a pointer to it from the
regular resource list, so all of the code would work since it's
in the regular resource list, but on the next connect, the
resource would be found in the persistent resource list and be
used without having to recreate it.
You should register these resources with a different type (e.g.
LE_MYSQL_LINK for non-persistent link and LE_MYSQL_PLINK for
a persistent link).
If you read mysql.c, you'll notice that except for the more complex
connect function, nothing in the rest of the module has to be changed.
The very same interface exists for the regular resource list and the
persistent resource list, only 'list' is replaced with 'plist':
php3_plist_insert(ptr, type) returns the 'id' of the newly inserted resource
php3_plist_delete(id) delete the resource with the specified id
php3_plist_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
However, it's more than likely that these functions would prove
to be useless for you when trying to implement a persistent module.
Typically, one would want to use the fact that the persistent resource
list is really a hash table. For instance, in the MySQL/mSQL modules,
when there's a pconnect() call (persistent connect), the function
builds a string out of the host/user/passwd that were passed to the
function, and hashes the SQL link with this string as a key. The next
time someone calls a pconnect() with the same host/user/passwd, the
same key would be generated, and the function would find the SQL link
in the persistent list.
Until further documented, you should look at mysql.c or msql.c to
see how one should use the plist's hash table abilities.
One important thing to note: resources going into the persistent
resource list must *NOT* be allocated with PHP's memory manager, i.e.,
they should NOT be created with emalloc(), estrdup(), etc. Rather,
one should use the regular malloc(), strdup(), etc. The reason for
this is simple - at the end of the request (end of the hit), every
memory chunk that was allocated using PHP's memory manager is deleted.
Since the persistent list isn't supposed to be erased at the end
of a request, one mustn't use PHP's memory manager for allocating
resources that go to it.
Shutting down persistent resources:
When you register resource that's going to be in the persistent list,
you should add destructors to it both in the non-persistent list
and in the persistent list.
The destructor in the non-persistent list destructor shouldn't do anything.
The one in the persistent list destructor should properly free any
resources obtained by that type (e.g. memory, SQL links, etc). Just like
with the non-persistent resources, you *MUST* add destructors for every
resource, even it requires no destructotion and the destructor would
be empty.
Remember, since emalloc() and friends aren't to be used in conjunction
with the persistent list, you mustn't use efree() here either.
-------------------
11. Adding runtime configuration directives
Many of the features of PHP3 can be configured at runtime. These
configuration directives can appear in either the designated php3.ini
file, or in the case of the Apache module version in the Apache .conf
files. The advantage of having them in the Apache .conf files is that
they can be configured on a per-directory basis. This means that one
directory may have a certain safemodeexecdir for example, while another
directory may have another. This configuration granularity is especially
handy when a server supports multiple virtual hosts.
The steps required to add a new directive:
1. Add directive to php3_ini_structure struct in mod_php4.h.
2. In main.c, edit the php3_module_startup function and add the
appropriate cfg_get_string() or cfg_get_long() call.
3. Add the directive, restrictions and a comment to the php3_commands
structure in mod_php4.c. Note the restrictions part. RSRC_CONF are
directives that can only be present in the actual Apache .conf files.
Any OR_OPTIONS directives can be present anywhere, include normal
.htaccess files.
4. In either php3take1handler() or php3flaghandler() add the appropriate
entry for your directive.
5. In the configuration section of the _php3_info() function in
functions/info.c you need to add your new directive.
6. And last, you of course have to use your new directive somewhere.
It will be addressable as php3_ini.directive
+90
View File
@@ -0,0 +1,90 @@
/* -*- C -*-
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Stig Sæther Bakken <ssb@guardian.no> |
+----------------------------------------------------------------------+
*/
#define PHP_ADA_INCLUDE ""
#define PHP_ADA_LFLAGS ""
#define PHP_ADA_LIBS ""
#define PHP_APACHE_INCLUDE ""
#define PHP_APACHE_TARGET ""
#define PHP_FHTTPD_INCLUDE ""
#define PHP_FHTTPD_LIB ""
#define PHP_FHTTPD_TARGET ""
#define PHP_BINNAME "@BINNAME@"
#define PHP_CFLAGS "@CFLAGS@"
#define PHP_DBASE_LIB ""
#define PHP_DEBUG "@DEBUG_CFLAGS@"
#define PHP_GDBM_INCLUDE ""
#define PHP_HSREGEX ""
#define PHP_IBASE_INCLUDE ""
#define PHP_IBASE_LFLAGS ""
#define PHP_IBASE_LIBS ""
#define PHP_IFX_INCLUDE ""
#define PHP_IFX_LFLAGS ""
#define PHP_IFX_LIBS ""
#define PHP_INSTALL_IT "@INSTALL_IT@"
#define PHP_IODBC_INCLUDE ""
#define PHP_IODBC_LFLAGS ""
#define PHP_IODBC_LIBS ""
#define PHP_MSQL_INCLUDE ""
#define PHP_MSQL_LFLAGS ""
#define PHP_MSQL_LIBS ""
#define PHP_MYSQL_INCLUDE ""
#define PHP_MYSQL_LFLAGS ""
#define PHP_MYSQL_LIBS ""
#define PHP_ODBC_TYPE "@ODBC_TYPE@"
#define PHP_ODBC_INCLUDE "@ODBC_INCLUDE@"
#define PHP_ODBC_LFLAGS "@ODBC_LFLAGS@"
#define PHP_ODBC_LIBS "@ODBC_LIBS@"
#define PHP_ORACLE_HOME ""
#define PHP_ORACLE_INCLUDE ""
#define PHP_ORACLE_LFLAGS ""
#define PHP_ORACLE_LIBS ""
#define PHP_ORACLE_SHLIBS ""
#define PHP_ORACLE_STLIBS ""
#define PHP_ORACLE_VERSION ""
#define PHP_PGSQL_INCLUDE ""
#define PHP_PGSQL_LFLAGS ""
#define PHP_PGSQL_LIBS ""
#define PHP_PROG_SENDMAIL "@PROG_SENDMAIL@"
#define PHP_REGEX_LIB ""
#define PHP_SOLID_INCLUDE ""
#define PHP_SOLID_LIBS ""
#define PHP_EMPRESS_INCLUDE ""
#define PHP_EMPRESS_LIBS ""
#define PHP_SYBASE_INCLUDE ""
#define PHP_SYBASE_LFLAGS ""
#define PHP_SYBASE_LIBS ""
#define PHP_DBM_TYPE ""
#define PHP_DBM_LIB ""
#define PHP_LDAP_LFLAGS ""
#define PHP_LDAP_INCLUDE ""
#define PHP_LDAP_LIBS ""
#define PHP_VELOCIS_INCLUDE ""
#define PHP_VELOCIS_LIBS ""
Executable
+151
View File
@@ -0,0 +1,151 @@
#!/bin/sh
supplied_flag=$1
# do some version checking for the tools we use
if test "$1" = "--force"; then
shift
# this is a posix correct "test -nt"
elif test "`ls -t buildconf buildconf.stamp 2>/dev/null |head -1`" != "buildconf"; then
:
else
echo "buildconf: checking installation..."
# 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 "$ac_version" = ""; then
echo "buildconf: autoconf not found."
echo " You need autoconf version 2.13 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
IFS=.; set $ac_version; IFS=' '
if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then
echo "buildconf: autoconf version $ac_version found."
echo " You need autoconf version 2.13 or newer installed"
echo " to build PHP from CVS."
exit 1
else
echo "buildconf: autoconf version $ac_version (ok)"
fi
# automake 1.4 or newer
am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
if test "$am_version" = ""; then
echo "buildconf: automake not found."
echo " You need automake version 1.4 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
IFS=.; set $am_version; IFS=' '
if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
echo "buildconf: automake version $am_version found."
echo " You need automake version 1.4 or newer installed"
echo " to build PHP from CVS."
exit 1
else
echo "buildconf: automake version $am_version (ok)"
fi
# libtool 1.3.3 or newer
lt_pversion=`libtool --version 2>/dev/null|sed -e 's/^[^0-9]*//' -e 's/[- ].*//'`
if test "$lt_pversion" = ""; then
echo "buildconf: libtool not found."
echo " You need libtool version 1.3 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
IFS=.; set $lt_version; IFS=' '
if test "$1" -gt "1" || test "$2" -gt "3" || test "$2" = "3" -a "$3" -ge "3"
then
echo "buildconf: libtool version $lt_pversion (ok)"
else
echo "buildconf: libtool version $lt_pversion found."
echo " You need libtool version 1.3.3 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
touch buildconf.stamp
fi
am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'`
lt_prefix=`which libtool | sed -e 's#/[^/]*/[^/]*$##'`
if test "$am_prefix" != "$lt_prefix"; then
echo "buildconf: WARNING: automake and libtool are installed in different"
echo " directories. This may cause aclocal to fail."
echo "buildconf: continuing anyway"
fi
if test "$supplied_flag" = "--copy"; then
automake_flags=--copy
fi
if test ! -d libzend; then
if test -d ../libzend; then
echo "buildconf: linking ../libzend to ./libzend"
ln -s ../libzend .
else
echo "buildconf: can not find libzend"
echo " libzend should be installed in . or .., how to fetch:"
echo ""
echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository login"
echo " (password \"zend\")"
echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository co libzend"
echo ""
exit 1
fi
fi
if test ! -d TSRM; then
if test -d ../TSRM; then
echo "buildconf: linking ../TSRM to ./TSRM"
ln -s ../TSRM .
else
echo "buildconf: can not find TSRM"
echo " TSRM should be installed in . or .., how to fetch:"
echo ""
echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository login"
echo " (password \"zend\")"
echo " cvs -d :pserver:cvsread@cvs.zend.com:/repository co TSRM"
echo ""
exit 1
fi
fi
./scripts/preconfig
libtoolize --automake $automake_flags --force
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
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
echo "buildconf: keeping aclocal.m4"
mv aclocal.m4.old aclocal.m4
else
echo "buildconf: created or modified aclocal.m4"
fi
autoheader
automake --add-missing --include-deps $automake_flags
mv configure configure.old 2>/dev/null
autoconf
if cmp configure.old configure > /dev/null 2>&1; then
echo "buildconf: keeping configure"
mv configure.old configure
else
echo "buildconf: created or modified configure"
fi
(cd libzend; ./buildconf libzend/)
(cd TSRM; ./buildconf TSRM/)
+244
View File
@@ -0,0 +1,244 @@
# Microsoft Developer Studio Generated NMAKE File, Based on calendar.dsp
!IF "$(CFG)" == ""
CFG=calendar - Win32 Debug
!MESSAGE No configuration specified. Defaulting to calendar - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "calendar - Win32 Release" && "$(CFG)" != "calendar - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "calendar.mak" CFG="calendar - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "calendar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "calendar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "calendar - Win32 Release"
OUTDIR=.\module_release
INTDIR=.\module_release
# Begin Custom Macros
OutDir=.\module_release
# End Custom Macros
ALL : "$(OUTDIR)\php3_calendar.dll"
CLEAN :
-@erase "$(INTDIR)\calendar.obj"
-@erase "$(INTDIR)\dow.obj"
-@erase "$(INTDIR)\french.obj"
-@erase "$(INTDIR)\gregor.obj"
-@erase "$(INTDIR)\jewish.obj"
-@erase "$(INTDIR)\julian.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_calendar.dll"
-@erase "$(OUTDIR)\php3_calendar.exp"
-@erase "$(OUTDIR)\php3_calendar.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:1 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_calendar.pdb" /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\calendar.obj" \
"$(INTDIR)\dow.obj" \
"$(INTDIR)\french.obj" \
"$(INTDIR)\gregor.obj" \
"$(INTDIR)\jewish.obj" \
"$(INTDIR)\julian.obj"
"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "calendar - Win32 Debug"
OUTDIR=.\module_debug
INTDIR=.\module_debug
# Begin Custom Macros
OutDir=.\module_debug
# End Custom Macros
ALL : "$(OUTDIR)\php3_calendar.dll"
CLEAN :
-@erase "$(INTDIR)\calendar.obj"
-@erase "$(INTDIR)\dow.obj"
-@erase "$(INTDIR)\french.obj"
-@erase "$(INTDIR)\gregor.obj"
-@erase "$(INTDIR)\jewish.obj"
-@erase "$(INTDIR)\julian.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_calendar.dll"
-@erase "$(OUTDIR)\php3_calendar.exp"
-@erase "$(OUTDIR)\php3_calendar.ilk"
-@erase "$(OUTDIR)\php3_calendar.lib"
-@erase "$(OUTDIR)\php3_calendar.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /D "DEBUG" /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:1 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_calendar.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /pdbtype:sept /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\calendar.obj" \
"$(INTDIR)\dow.obj" \
"$(INTDIR)\french.obj" \
"$(INTDIR)\gregor.obj" \
"$(INTDIR)\jewish.obj" \
"$(INTDIR)\julian.obj"
"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("calendar.dep")
!INCLUDE "calendar.dep"
!ELSE
!MESSAGE Warning: cannot find "calendar.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "calendar - Win32 Release" || "$(CFG)" == "calendar - Win32 Debug"
SOURCE=.\dl\calendar\calendar.c
"$(INTDIR)\calendar.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dl\calendar\dow.c
"$(INTDIR)\dow.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dl\calendar\french.c
"$(INTDIR)\french.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dl\calendar\gregor.c
"$(INTDIR)\gregor.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dl\calendar\jewish.c
"$(INTDIR)\jewish.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dl\calendar\julian.c
"$(INTDIR)\julian.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
+501
View File
@@ -0,0 +1,501 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 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_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
| Stig Bakken <ssb@fast.no> |
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
#include "php.h"
#include "php_globals.h"
#include "SAPI.h"
#if CGI_BINARY
#include <stdio.h>
#include "php.h"
#ifdef MSVC5
#include "win32/time.h"
#include "win32/signal.h"
#include <process.h>
#else
#include "build-defs.h"
#endif
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#if HAVE_SETLOCALE
#include <locale.h>
#endif
#include "zend.h"
#include "php_ini.h"
#include "php_globals.h"
#include "main.h"
#include "fopen-wrappers.h"
#include "ext/standard/php3_standard.h"
#include "snprintf.h"
#if WIN32|WINNT
#include <io.h>
#include <fcntl.h>
#include "win32/syslog.h"
#include "win32/php_registry.h"
#else
#include <syslog.h>
#endif
#include "zend_compile.h"
#include "zend_execute.h"
#include "zend_highlight.h"
#include "zend_indent.h"
#if USE_SAPI
#include "serverapi/sapi.h"
void *gLock;
#ifndef THREAD_SAFE
struct sapi_request_info *sapi_rqst;
#endif
#endif
#if MSVC5 || !defined(HAVE_GETOPT)
#include "php_getopt.h"
#endif
PHPAPI extern char *php3_ini_path;
#define PHP_MODE_STANDARD 1
#define PHP_MODE_HIGHLIGHT 2
#define PHP_MODE_INDENT 3
PHPAPI extern char *optarg;
PHPAPI extern int optind;
static int zend_cgibin_ub_write(const char *str, uint str_length)
{
return fwrite(str, 1, str_length, stdout);
}
static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context)
{
if (sapi_header) {
PHPWRITE_H(sapi_header->header, sapi_header->header_len);
}
PHPWRITE_H("\r\n", 2);
}
static int sapi_cgi_read_post(char *buffer, uint count_bytes SLS_DC)
{
uint read_bytes=0, tmp_read_bytes;
count_bytes = MIN(count_bytes, SG(request_info).content_length-SG(read_post_bytes));
while (read_bytes < count_bytes) {
tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
if (tmp_read_bytes<=0) {
break;
}
read_bytes += tmp_read_bytes;
}
return read_bytes;
}
static char *sapi_cgi_read_cookies(SLS_D)
{
return getenv("HTTP_COOKIE");
}
static sapi_module_struct sapi_module = {
"PHP Language", /* name */
php_module_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
zend_cgibin_ub_write, /* unbuffered write */
php_error, /* error handler */
NULL, /* header handler */
NULL, /* send headers handler */
sapi_cgi_send_header, /* send header handler */
sapi_cgi_read_post, /* read POST data */
sapi_cgi_read_cookies, /* read Cookies */
STANDARD_SAPI_MODULE_PROPERTIES
};
static void php_cgi_usage(char *argv0)
{
char *prog;
prog = strrchr(argv0, '/');
if (prog) {
prog++;
} else {
prog = "php";
}
php_printf("Usage: %s [-q] [-h]"
" [-s]"
" [-v] [-i] [-f <file>] | "
"{<file> [args...]}\n"
" -q Quiet-mode. Suppress HTTP Header output.\n"
" -s Display colour syntax highlighted source.\n"
" -f<file> Parse <file>. Implies `-q'\n"
" -v Version number\n"
" -c<path> Look for php.ini file in this directory\n"
#if SUPPORT_INTERACTIVE
" -a Run interactively\n"
#endif
" -d foo[=bar] Define INI entry foo with value 'bar'\n"
" -e Generate extended information for debugger/profiler\n"
" -i PHP information\n"
" -h This help\n", prog);
}
static void init_request_info(SLS_D)
{
char *content_length = getenv("CONTENT_LENGTH");
SG(request_info).request_method = getenv("REQUEST_METHOD");
SG(request_info).query_string = getenv("QUERY_STRING");
SG(request_info).request_uri = getenv("PATH_INFO");
SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */
SG(request_info).content_type = getenv("CONTENT_TYPE");
SG(request_info).content_length = (content_length?atoi(content_length):0);
/* CGI does not support HTTP authentication */
SG(request_info).auth_user = NULL;
SG(request_info).auth_password = NULL;
}
void define_command_line_ini_entry(char *arg)
{
char *name, *value;
name = arg;
value = strchr(arg, '=');
if (value) {
*value = 0;
value++;
} else {
value = "1";
}
php_alter_ini_entry(name, strlen(name), value, strlen(value), PHP_INI_SYSTEM);
}
int main(int argc, char *argv[])
{
int cgi = 0, c, i, len;
zend_file_handle file_handle;
char *s;
/* temporary locals */
int cgi_started=0;
int behavior=PHP_MODE_STANDARD;
int no_headers=0;
#if SUPPORT_INTERACTIVE
int interactive=0;
#endif
/* end of temporary locals */
#ifdef ZTS
zend_compiler_globals *compiler_globals;
zend_executor_globals *executor_globals;
php_core_globals *core_globals;
sapi_globals_struct *sapi_globals;
#endif
#ifndef ZTS
if (setjmp(EG(bailout))!=0) {
return -1;
}
#endif
#ifdef ZTS
tsrm_startup(1,1,0);
#endif
sapi_startup(&sapi_module);
#if WIN32|WINNT
_fmode = _O_BINARY; /*sets default for file streams to binary */
setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
#endif
/* Make sure we detect we are a cgi - a bit redundancy here,
but the default case is that we have to check only the first one. */
if (getenv("SERVER_SOFTWARE")
|| getenv("SERVER_NAME")
|| getenv("GATEWAY_INTERFACE")
|| getenv("REQUEST_METHOD")) {
cgi = 1;
if (argc > 1)
request_info.php_argv0 = strdup(argv[1]);
else request_info.php_argv0 = NULL;
#if FORCE_CGI_REDIRECT
if (!getenv("REDIRECT_STATUS")) {
PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
\n\
<P>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
set. This variable is set, for example, by Apache's Action directive redirect.\n\
<P>You may disable this restriction by recompiling the PHP binary with the\n\
--disable-force-cgi-redirect switch. If you do this and you have your PHP CGI\n\
binary accessible somewhere in your web tree, people will be able to circumvent\n\
.htaccess security by loading files through the PHP parser. A good way around\n\
this is to define doc_root in your php.ini file to something other than your\n\
top-level DOCUMENT_ROOT. This way you can separate the part of your web space\n\n\
which uses PHP from the normal part using .htaccess security. If you do not have\n\
any .htaccess restrictions anywhere on your site you can leave doc_root undefined.\n\
\n");
/* remove that detailed explanation some time */
return FAILURE;
}
#endif /* FORCE_CGI_REDIRECT */
}
if (php_module_startup(&sapi_module)==FAILURE) {
return FAILURE;
}
#ifdef ZTS
compiler_globals = ts_resource(compiler_globals_id);
executor_globals = ts_resource(executor_globals_id);
core_globals = ts_resource(core_globals_id);
sapi_globals = ts_resource(sapi_globals_id);
if (setjmp(EG(bailout))!=0) {
return -1;
}
#endif
SG(request_info).path_translated = NULL;
init_request_info(SLS_C);
SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
CG(extended_info) = 0;
if (!cgi) { /* never execute the arguments if you are a CGI */
request_info.php_argv0 = NULL;
while ((c = getopt(argc, argv, "c:d:qvisnaeh?vf:")) != -1) {
switch (c) {
case 'f':
if (!cgi_started){
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
}
if (no_headers) {
SG(headers_sent) = 1;
}
cgi_started=1;
SG(request_info).path_translated = estrdup(optarg);
/* break missing intentionally */
case 'q':
no_headers = 1;
break;
case 'v':
if (!cgi_started) {
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
}
if (no_headers) {
SG(headers_sent) = 1;
}
php_printf("%s\n", PHP_VERSION);
exit(1);
break;
case 'i':
if (!cgi_started) {
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
}
if (no_headers) {
SG(headers_sent) = 1;
}
cgi_started=1;
php_print_info(0xFFFFFFFF);
exit(1);
break;
case 's':
behavior=PHP_MODE_HIGHLIGHT;
break;
case 'n':
behavior=PHP_MODE_INDENT;
break;
case 'c':
php3_ini_path = strdup(optarg); /* intentional leak */
break;
case 'a':
#if SUPPORT_INTERACTIVE
printf("Interactive mode enabled\n\n");
interactive=1;
#else
printf("Interactive mode not supported!\n\n");
#endif
break;
case 'e':
CG(extended_info) = 1;
break;
case 'h':
case '?':
php_output_startup();
SG(headers_sent) = 1;
php_cgi_usage(argv[0]);
exit(1);
break;
case 'd':
define_command_line_ini_entry(optarg);
break;
default:
break;
}
}
} /* not cgi */
#if SUPPORT_INTERACTIVE
EG(interactive) = interactive;
#endif
if (!cgi_started) {
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
php_module_shutdown();
return FAILURE;
}
}
if (no_headers) {
SG(headers_sent) = 1;
}
file_handle.filename = "-";
file_handle.type = ZEND_HANDLE_FP;
file_handle.handle.fp = stdin;
if (!cgi) {
if (!SG(request_info).query_string) {
for (i = optind, len = 0; i < argc; i++)
len += strlen(argv[i]) + 1;
s = malloc(len + 1); /* leak - but only for command line version, so ok */
*s = '\0'; /* we are pretending it came from the environment */
for (i = optind, len = 0; i < argc; i++) {
strcat(s, argv[i]);
if (i < (argc - 1))
strcat(s, "+");
}
SG(request_info).query_string = s;
}
if (!SG(request_info).path_translated && argc > optind)
SG(request_info).path_translated = argv[optind];
}
/* If for some reason the CGI interface is not setting the
PATH_TRANSLATED correctly, SG(request_info).path_translated is NULL.
We still call php3_fopen_for_parser, because if you set doc_root
or user_dir configuration directives, PATH_INFO is used to construct
the filename as a side effect of php3_fopen_for_parser.
*/
if(cgi) {
SG(request_info).path_translated = getenv("PATH_TRANSLATED");
}
if (cgi || SG(request_info).path_translated) {
file_handle.handle.fp = php3_fopen_for_parser();
file_handle.filename = SG(request_info).path_translated;
}
if (cgi && !file_handle.handle.fp) {
PUTS("No input file specified.\n");
#if 0 /* this is here for debuging under windows */
if (argc) {
i = 0;
php_printf("\nargc %d\n",argc);
while (i <= argc) {
php_printf("%s\n",argv[i]);
i++;
}
}
#endif
php_request_shutdown((void *) 0);
php_module_shutdown();
return FAILURE;
} else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
/* #!php support */
c = fgetc(file_handle.handle.fp);
if (c == '#') {
while (c != 10 && c != 13) {
c = fgetc(file_handle.handle.fp); /* skip to end of line */
}
CG(zend_lineno)++;
} else {
rewind(file_handle.handle.fp);
}
}
switch (behavior) {
case PHP_MODE_STANDARD:
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
break;
case PHP_MODE_HIGHLIGHT: {
zend_syntax_highlighter_ini syntax_highlighter_ini;
if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
php_get_highlight_struct(&syntax_highlighter_ini);
zend_highlight(&syntax_highlighter_ini);
fclose(file_handle.handle.fp);
}
return 0;
}
break;
case PHP_MODE_INDENT:
open_file_for_scanning(&file_handle CLS_CC);
zend_indent();
fclose(file_handle.handle.fp);
return 0;
break;
}
php3_header(); /* Make sure headers have been sent */
php_request_shutdown((void *) 0);
php_module_shutdown();
#ifdef ZTS
tsrm_shutdown();
#endif
return SUCCESS;
}
#endif
+1100
View File
File diff suppressed because it is too large. Load diff
+204
View File
@@ -0,0 +1,204 @@
# Microsoft Developer Studio Generated NMAKE File, Based on crypt.dsp
!IF "$(CFG)" == ""
CFG=crypt - Win32 Debug
!MESSAGE No configuration specified. Defaulting to crypt - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "crypt - Win32 Release" && "$(CFG)" != "crypt - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "crypt.mak" CFG="crypt - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "crypt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "crypt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "crypt - Win32 Release"
OUTDIR=.\module_Release
INTDIR=.\module_Release
# Begin Custom Macros
OutDir=.\module_Release
# End Custom Macros
ALL : "$(OUTDIR)\php3_crypt.dll"
CLEAN :
-@erase "$(INTDIR)\crypt.obj"
-@erase "$(INTDIR)\sflcryp.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_crypt.dll"
-@erase "$(OUTDIR)\php3_crypt.exp"
-@erase "$(OUTDIR)\php3_crypt.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D HAVE_SFLCRYPT=1 /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_crypt.pdb" /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\crypt.obj" \
"$(INTDIR)\sflcryp.obj"
"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "crypt - Win32 Debug"
OUTDIR=.\module_debug
INTDIR=.\module_debug
# Begin Custom Macros
OutDir=.\module_debug
# End Custom Macros
ALL : "$(OUTDIR)\php3_crypt.dll"
CLEAN :
-@erase "$(INTDIR)\crypt.obj"
-@erase "$(INTDIR)\sflcryp.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_crypt.dll"
-@erase "$(OUTDIR)\php3_crypt.exp"
-@erase "$(OUTDIR)\php3_crypt.ilk"
-@erase "$(OUTDIR)\php3_crypt.lib"
-@erase "$(OUTDIR)\php3_crypt.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../" /D HAVE_SFLCRYPT=1 /D "DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_crypt.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /pdbtype:sept /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\crypt.obj" \
"$(INTDIR)\sflcryp.obj"
"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("crypt.dep")
!INCLUDE "crypt.dep"
!ELSE
!MESSAGE Warning: cannot find "crypt.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "crypt - Win32 Release" || "$(CFG)" == "crypt - Win32 Debug"
SOURCE=.\dl\crypt\crypt.c
"$(INTDIR)\crypt.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dl\crypt\sflcryp.c
"$(INTDIR)\sflcryp.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
+234
View File
@@ -0,0 +1,234 @@
# Microsoft Developer Studio Generated NMAKE File, Based on dbase.dsp
!IF "$(CFG)" == ""
CFG=dbase - Win32 Debug
!MESSAGE No configuration specified. Defaulting to dbase - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "dbase - Win32 Release" && "$(CFG)" != "dbase - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "dbase.mak" CFG="dbase - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dbase - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "dbase - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "dbase - Win32 Release"
OUTDIR=.\module_release
INTDIR=.\module_release
# Begin Custom Macros
OutDir=.\module_release
# End Custom Macros
ALL : "$(OUTDIR)\php3_dbase.dll"
CLEAN :
-@erase "$(INTDIR)\dbase.obj"
-@erase "$(INTDIR)\dbf_head.obj"
-@erase "$(INTDIR)\dbf_misc.obj"
-@erase "$(INTDIR)\dbf_ndx.obj"
-@erase "$(INTDIR)\dbf_rec.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_dbase.dll"
-@erase "$(OUTDIR)\php3_dbase.exp"
-@erase "$(OUTDIR)\php3_dbase.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "NDEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbase.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\dbase.obj" \
"$(INTDIR)\dbf_head.obj" \
"$(INTDIR)\dbf_misc.obj" \
"$(INTDIR)\dbf_ndx.obj" \
"$(INTDIR)\dbf_rec.obj"
"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "dbase - Win32 Debug"
OUTDIR=.\module_debug
INTDIR=.\module_debug
# Begin Custom Macros
OutDir=.\module_debug
# End Custom Macros
ALL : "$(OUTDIR)\php3_dbase.dll"
CLEAN :
-@erase "$(INTDIR)\dbase.obj"
-@erase "$(INTDIR)\dbf_head.obj"
-@erase "$(INTDIR)\dbf_misc.obj"
-@erase "$(INTDIR)\dbf_ndx.obj"
-@erase "$(INTDIR)\dbf_rec.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_dbase.dll"
-@erase "$(OUTDIR)\php3_dbase.exp"
-@erase "$(OUTDIR)\php3_dbase.ilk"
-@erase "$(OUTDIR)\php3_dbase.lib"
-@erase "$(OUTDIR)\php3_dbase.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "DEBUG" /D "_DEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbase.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /pdbtype:sept /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\dbase.obj" \
"$(INTDIR)\dbf_head.obj" \
"$(INTDIR)\dbf_misc.obj" \
"$(INTDIR)\dbf_ndx.obj" \
"$(INTDIR)\dbf_rec.obj"
"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("dbase.dep")
!INCLUDE "dbase.dep"
!ELSE
!MESSAGE Warning: cannot find "dbase.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "dbase - Win32 Release" || "$(CFG)" == "dbase - Win32 Debug"
SOURCE=.\functions\dbase.c
"$(INTDIR)\dbase.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dbase\dbf_head.c
"$(INTDIR)\dbf_head.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dbase\dbf_misc.c
"$(INTDIR)\dbf_misc.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dbase\dbf_ndx.c
"$(INTDIR)\dbf_ndx.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dbase\dbf_rec.c
"$(INTDIR)\dbf_rec.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
+201
View File
@@ -0,0 +1,201 @@
# Microsoft Developer Studio Generated NMAKE File, Based on dbm.dsp
!IF "$(CFG)" == ""
CFG=dbm - Win32 Debug
!MESSAGE No configuration specified. Defaulting to dbm - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "dbm - Win32 Release" && "$(CFG)" != "dbm - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "dbm.mak" CFG="dbm - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dbm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "dbm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "dbm - Win32 Release"
OUTDIR=.\module_release
INTDIR=.\module_release
# Begin Custom Macros
OutDir=.\module_release
# End Custom Macros
ALL : "$(OUTDIR)\php3_dbm.dll"
CLEAN :
-@erase "$(INTDIR)\db.obj"
-@erase "$(INTDIR)\flock.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\php3_dbm.dll"
-@erase "$(OUTDIR)\php3_dbm.exp"
-@erase "$(OUTDIR)\php3_dbm.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:2 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbm.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
LINK32_OBJS= \
"$(INTDIR)\db.obj" \
"$(INTDIR)\flock.obj"
"$(OUTDIR)\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "dbm - Win32 Debug"
OUTDIR=.\module_debug
INTDIR=.\module_debug
ALL : "c:\php3\php3_dbm.dll"
CLEAN :
-@erase "$(INTDIR)\db.obj"
-@erase "$(INTDIR)\flock.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\php3_dbm.exp"
-@erase "$(OUTDIR)\php3_dbm.lib"
-@erase "$(OUTDIR)\php3_dbm.pdb"
-@erase "c:\php3\php3_dbm.dll"
-@erase "c:\php3\php3_dbm.ilk"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "DEBUG" /D "_DEBUG" /D COMPILE_DL=1 /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=php.lib libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:2 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbm.pdb" /debug /machine:I386 /out:"c:\php3/php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
LINK32_OBJS= \
"$(INTDIR)\db.obj" \
"$(INTDIR)\flock.obj"
"c:\php3\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("dbm.dep")
!INCLUDE "dbm.dep"
!ELSE
!MESSAGE Warning: cannot find "dbm.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "dbm - Win32 Release" || "$(CFG)" == "dbm - Win32 Debug"
SOURCE=.\functions\db.c
"$(INTDIR)\db.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\win32\flock.c
"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF
+421
View File
@@ -0,0 +1,421 @@
/****************************************************************************
*
* Copyright (C) 1991 Kendall Bennett.
* All rights reserved.
*
* Filename: $RCSfile$
* Version: $Revision$
*
* Language: ANSI C
* Environment: any
*
* Description: Module to implement doubly linked lists. Includes a routine
* to peform a mergesort on the doubly linked list.
*
* $Id$
*
* Revision History:
* -----------------
*
* $Log$
* Revision 1.1 1999/07/19 18:58:44 andrey
* Moving dlist stuff into core.
*
* Revision 1.2 1999/05/11 00:01:42 zeev
* * Get Apache to work. POST doesn't work yet.
* * There are now -I directives for the absolute path of php4, php4/libzend and the builddir for
* the Apache module, so we can #include any php/Zend header.
* * Rename config.h to php_config.h
*
* Revision 1.1 1999/04/21 23:11:20 ssb
* moved apache, com and hyperwave into ext/
*
* Revision 1.1.1.1 1999/04/07 21:03:31 zeev
* PHP 4.0
*
* Revision 1.1.1.1 1999/03/17 04:29:11 andi
* PHP4
*
* Revision 1.1.1.1 1998/12/21 07:56:22 andi
* Trying to start the zend CVS tree
*
* Revision 1.1 1998/08/12 09:29:16 steinm
* First version of Hyperwave module.
*
* Revision 1.5 91/12/31 19:39:49 kjb
* Modified include file directories.
*
* Revision 1.4 91/10/28 03:16:39 kjb
* Ported to the Iris.
*
* Revision 1.3 91/09/27 03:09:18 kjb
* Cosmetic change.
*
* Revision 1.2 91/09/03 18:27:42 ROOT_DOS
* Ported to UNIX.
*
* Revision 1.1 91/09/01 18:35:23 ROOT_DOS
* Initial revision
*
****************************************************************************/
#ifndef MSVC5
#include "php_config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "dlist.h"
#define PUBLIC
#define PRIVATE static
PUBLIC void *dlst_newnode(int size)
/****************************************************************************
*
* Function: dlst_newnode
* Parameters: size - Amount of memory to allocate for node
* Returns: Pointer to the allocated node's user space.
*
* Description: Allocates the memory required for a node, adding a small
* header at the start of the node. We return a reference to
* the user space of the node, as if it had been allocated via
* malloc().
*
****************************************************************************/
{
PHP_DLST_BUCKET *node;
if ( !(node = (PHP_DLST_BUCKET*)malloc(size + sizeof(PHP_DLST_BUCKET))) ) {
fprintf(stderr,"Not enough memory to allocate list node.\n");
/* raise(SIGABRT);*/
return NULL;
}
return PHP_DLST_USERSPACE(node); /* Return pointer to user space */
}
PUBLIC void dlst_freenode(void *node)
/****************************************************************************
*
* Function: dlst_freenode
* Parameters: node - Node to free.
*
* Description: Frees a node previously allocated with lst_newnode().
*
****************************************************************************/
{
free(PHP_DLST_HEADER(node));
}
PUBLIC DLIST *dlst_init(void)
/****************************************************************************
*
* Function: dlst_init
* Returns: Pointer to a newly created list.
*
* Description: Initialises a list and returns a pointer to it.
*
****************************************************************************/
{
DLIST *l;
if ((l = (DLIST*)malloc(sizeof(DLIST))) != NULL) {
l->count = 0;
l->head = &(l->hz[0]);
l->z = &(l->hz[1]);
l->head->next = l->z->next = l->z;
l->z->prev = l->head->prev = l->head;
}
else {
fprintf(stderr,"Insufficient memory to allocate list\n");
/*raise(SIGABRT);*/
return NULL;
}
return l;
}
PUBLIC void dlst_kill(DLIST *l,void (*freeNode)(void *node))
/****************************************************************************
*
* Function: dlst_kill
* Parameters: l - List to kill
* freeNode - Pointer to user routine to free a node
*
* Description: Kills the list l, by deleting all of the elements contained
* within the list one by one and then deleting the list
* itself. Note that we call the user supplied routine
* (*freeNode)() to free each list node. This allows the user
* program to perform any extra processing needed to kill each
* node (if each node contains pointers to other items on the
* heap for example). If no extra processing is required, just
* pass the address of dlst_freenode(), ie:
*
* dlst_kill(myList,dlst_freenode);
*
****************************************************************************/
{
PHP_DLST_BUCKET *n,*p;
n = l->head->next;
while (n != l->z) { /* Free all nodes in list */
p = n;
n = n->next;
(*freeNode)(PHP_DLST_USERSPACE(p));
}
free(l); /* Free the list itself */
}
PUBLIC void dlst_insertafter(DLIST *l,void *node,void *after)
/****************************************************************************
*
* Function: lst_insertafter
* Parameters: l - List to insert node into
* node - Pointer to user space of node to insert
* after - Pointer to user space of node to insert node after
*
* Description: Inserts a new node into the list after the node 'after'. To
* insert a new node at the beginning of the list, user the
* macro PHP_DLST_HEAD in place of 'after'. ie:
*
* dlst_insertafter(mylist,node,PHP_DLST_HEAD(mylist));
*
****************************************************************************/
{
PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node),*a = PHP_DLST_HEADER(after);
n->next = a->next;
a->next = n;
n->prev = a;
n->next->prev = n;
l->count++;
}
PUBLIC void *dlst_deletenext(DLIST *l,void *node)
/****************************************************************************
*
* Function: lst_deletenext
* Parameters: l - List to delete node from.
* node - Node to delete the next node from
* Returns: Pointer to the deleted node's userspace.
*
* Description: Removes the node AFTER 'node' from the list l.
*
****************************************************************************/
{
PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node);
node = PHP_DLST_USERSPACE(n->next);
n->next->next->prev = n;
n->next = n->next->next;
l->count--;
return node;
}
PUBLIC void *dlst_first(DLIST *l)
/****************************************************************************
*
* Function: dlst_first
* Parameters: l - List to obtain first node from
* Returns: Pointer to first node in list, NULL if list is empty.
*
* Description: Returns a pointer to the user space of the first node in
* the list. If the list is empty, we return NULL.
*
****************************************************************************/
{
PHP_DLST_BUCKET *n;
n = l->head->next;
return (n == l->z ? NULL : PHP_DLST_USERSPACE(n));
}
PUBLIC void *dlst_last(DLIST *l)
/****************************************************************************
*
* Function: dlst_last
* Parameters: l - List to obtain last node from
* Returns: Pointer to last node in list, NULL if list is empty.
*
* Description: Returns a pointer to the user space of the last node in
* the list. If the list is empty, we return NULL.
*
****************************************************************************/
{
PHP_DLST_BUCKET *n;
n = l->z->prev;
return (n == l->head ? NULL : PHP_DLST_USERSPACE(n));
}
PUBLIC void *dlst_next(void *prev)
/****************************************************************************
*
* Function: dlst_next
* Parameters: prev - Previous node in list to obtain next node from
* Returns: Pointer to the next node in the list, NULL at end of list.
*
* Description: Returns a pointer to the user space of the next node in the
* list given a pointer to the user space of the previous node.
* If we have reached the end of the list, we return NULL. The
* end of the list is detected when the next pointer of a node
* points back to itself, as does the dummy last node's next
* pointer. This enables us to detect the end of the list
* without needed access to the list data structure itself.
*
* NOTE: We do no checking to ensure that 'prev' is NOT a
* NULL pointer.
*
****************************************************************************/
{
PHP_DLST_BUCKET *n = PHP_DLST_HEADER(prev);
n = n->next;
return (n == n->next ? NULL : PHP_DLST_USERSPACE(n));
}
PUBLIC void *dlst_prev(void *next)
/****************************************************************************
*
* Function: dlst_prev
* Parameters: next - Next node in list to obtain previous node from
* Returns: Pointer to the previous node in the list, NULL at start list.
*
* Description: Returns a pointer to the user space of the prev node in the
* list given a pointer to the user space of the next node.
* If we have reached the start of the list, we return NULL. The
* start of the list is detected when the prev pointer of a node
* points back to itself, as does the dummy head node's prev
* pointer. This enables us to detect the start of the list
* without needed access to the list data structure itself.
*
* NOTE: We do no checking to ensure that 'next' is NOT a
* NULL pointer.
*
****************************************************************************/
{
PHP_DLST_BUCKET *n = PHP_DLST_HEADER(next);
n = n->prev;
return (n == n->prev ? NULL : PHP_DLST_USERSPACE(n));
}
/* Static globals required by merge() */
static PHP_DLST_BUCKET *z;
static int (*cmp)(void*,void*);
PRIVATE PHP_DLST_BUCKET *merge(PHP_DLST_BUCKET *a,PHP_DLST_BUCKET *b,PHP_DLST_BUCKET **end)
/****************************************************************************
*
* Function: merge
* Parameters: a,b - Sublist's to merge
* Returns: Pointer to the merged sublists.
*
* Description: Merges two sorted lists of nodes together into a single
* sorted list.
*
****************************************************************************/
{
PHP_DLST_BUCKET *c;
/* Go through the lists, merging them together in sorted order */
c = z;
while (a != z && b != z) {
if ((*cmp)(PHP_DLST_USERSPACE(a),PHP_DLST_USERSPACE(b)) <= 0) {
c->next = a; c = a; a = a->next;
}
else {
c->next = b; c = b; b = b->next;
}
};
/* If one of the lists is not exhausted, then re-attach it to the end
* of the newly merged list
*/
if (a != z) c->next = a;
if (b != z) c->next = b;
/* Set *end to point to the end of the newly merged list */
while (c->next != z) c = c->next;
*end = c;
/* Determine the start of the merged lists, and reset z to point to
* itself
*/
c = z->next; z->next = z;
return c;
}
PUBLIC void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*))
/****************************************************************************
*
* Function: dlst_mergesort
* Parameters: l - List to merge sort
* cmp_func - Function to compare two user spaces
*
* Description: Mergesort's all the nodes in the list. 'cmp' must point to
* a comparison function that can compare the user spaces of
* two different nodes. 'cmp' should work the same as
* strcmp(), in terms of the values it returns. Rather than
* waste processing time keeping the previous pointers up to
* date while performing the mergesort, we simply run through
* the list at the end of the sort to fix the previous pointers.
*
****************************************************************************/
{
int i,N;
PHP_DLST_BUCKET *a,*b; /* Pointers to sublists to merge */
PHP_DLST_BUCKET *c; /* Pointer to end of sorted sublists */
PHP_DLST_BUCKET *head; /* Pointer to dummy head node for list */
PHP_DLST_BUCKET *todo; /* Pointer to sublists yet to be sorted */
PHP_DLST_BUCKET *t; /* Temporary */
/* Set up globals required by merge() and pointer to head */
z = l->z; cmp = cmp_func; head = l->head;
for (N = 1,a = z; a != head->next; N = N + N) {
todo = head->next; c = head;
while (todo != z) {
/* Build first sublist to be merged, and splice from main list
*/
a = t = todo;
for (i = 1; i < N; i++) t = t->next;
b = t->next; t->next = z; t = b;
/* Build second sublist to be merged and splice from main list
*/
for (i = 1; i < N; i++) t = t->next;
todo = t->next; t->next = z;
/* Merge the two sublists created, and set 'c' to point to the
* end of the newly merged sublists.
*/
c->next = merge(a,b,&t); c = t;
}
}
/* Fix the previous pointers for the list */
a = b = l->head;
b = b->next;
while (1) {
b->prev = a;
if (b == z)
break;
a = a->next;
b = b->next;
}
}
+137
View File
@@ -0,0 +1,137 @@
/****************************************************************************
*
* Copyright (C) 1991 Kendall Bennett.
* All rights reserved.
*
* Filename: $RCSfile$
* Version: $Revision$
*
* Language: ANSI C
* Environment: any
*
* Description: Header file for doubly linked list routines.
*
* $Id$
*
* Revision History:
* -----------------
*
* $Log$
* Revision 1.1 1999/04/21 23:11:20 ssb
* moved apache, com and hyperwave into ext/
*
* Revision 1.1.1.1 1999/04/07 21:03:20 zeev
* PHP 4.0
*
* Revision 1.1.1.1 1999/03/17 04:29:11 andi
* PHP4
*
* Revision 1.1.1.1 1998/12/21 07:56:22 andi
* Trying to start the zend CVS tree
*
* Revision 1.2 1998/08/14 15:51:12 shane
* Some work on getting hyperwave to work on windows. hg_comm needs a lot of work.
*
* Mainly, signals, fnctl, bzero, bcopy, etc are not portable functions. Most of this
* will have to be rewriten for windows.
*
* Revision 1.1 1998/08/12 09:29:16 steinm
* First version of Hyperwave module.
*
* Revision 1.5 91/12/31 19:40:54 kjb
*
* Modified include files directories.
*
* Revision 1.4 91/09/27 03:10:41 kjb
* Added compatibility with C++.
*
* Revision 1.3 91/09/26 10:07:16 kjb
* Took out extern references
*
* Revision 1.2 91/09/01 19:37:20 ROOT_DOS
* Changed DLST_TAIL macro so that it returns a pointer to the REAL last
* node of the list, not the dummy last node (l->z).
*
* Revision 1.1 91/09/01 18:38:23 ROOT_DOS
* Initial revision
*
****************************************************************************/
#ifndef __DLIST_H
#define __DLIST_H
#ifndef __DEBUG_H
/*#include "debug.h"*/
#endif
/*---------------------- Macros and type definitions ----------------------*/
typedef struct PHP_DLST_BUCKET {
struct PHP_DLST_BUCKET *next;
struct PHP_DLST_BUCKET *prev;
} PHP_DLST_BUCKET;
/* necessary for AIX 4.2.x */
#ifdef hz
#undef hz
#endif
typedef struct {
int count; /* Number of elements currently in list */
PHP_DLST_BUCKET *head; /* Pointer to head element of list */
PHP_DLST_BUCKET *z; /* Pointer to last node of list */
PHP_DLST_BUCKET hz[2]; /* Space for head and z nodes */
} DLIST;
/* Return a pointer to the user space given the address of the header of
* a node.
*/
#define PHP_DLST_USERSPACE(h) ((void*)((PHP_DLST_BUCKET*)(h) + 1))
/* Return a pointer to the header of a node, given the address of the
* user space.
*/
#define PHP_DLST_HEADER(n) ((PHP_DLST_BUCKET*)(n) - 1)
/* Return a pointer to the user space of the list's head node. This user
* space does not actually exist, but it is useful to be able to address
* it to enable insertion at the start of the list.
*/
#define PHP_DLST_HEAD(l) PHP_DLST_USERSPACE((l)->head)
/* Return a pointer to the user space of the last node in list. */
#define PHP_DLST_TAIL(l) PHP_DLST_USERSPACE((l)->z->prev)
/* Determine if a list is empty
*/
#define PHP_DLST_EMPTY(l) ((l)->count == 0)
/*-------------------------- Function Prototypes --------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
void *dlst_newnode(int size);
void dlst_freenode(void *node);
DLIST *dlst_init(void);
void dlst_kill(DLIST *l,void (*freeNode)(void *node));
void dlst_insertafter(DLIST *l,void *node,void *after);
void *dlst_deletenext(DLIST *l,void *node);
void *dlst_first(DLIST *l);
void *dlst_last(DLIST *l);
void *dlst_next(void *prev);
void *dlst_prev(void *next);
void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*));
#ifdef __cplusplus
}
#endif
#endif
+10
View File
@@ -0,0 +1,10 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = @EXT_SUBDIRS@
EXT_STATIC = @EXT_STATIC@
noinst_LIBRARIES=libphpext.a
libphpext.a: @EXT_LIBS@
top_srcdir=$(top_srcdir) $(top_builddir)/scripts/mkextlib $@ $(EXT_STATIC)
@test "`uname -s`" = "Rhapsody" && $(RANLIB) $@ || exit 0
+6
View File
@@ -0,0 +1,6 @@
# $Id$
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_apache.a
libphpext_apache_a_SOURCES=apache.c
+449
View File
@@ -0,0 +1,449 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 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_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
| Stig Sæther Bakken <ssb@guardian.no> |
| David Sklar <sklar@student.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#include "ext/standard/head.h"
#include "php_globals.h"
#include "php_ini.h"
#include "SAPI.h"
#include "mod_php4.h"
#include "ext/standard/info.h"
#include <stdlib.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#include <ctype.h>
#if APACHE
#include "http_request.h"
#include "build-defs.h"
#define SECTION(name) PUTS("<hr><h2>" name "</h2>\n")
extern module *top_module;
PHP_FUNCTION(virtual);
PHP_FUNCTION(getallheaders);
PHP_FUNCTION(apachelog);
PHP_FUNCTION(apache_note);
PHP_FUNCTION(apache_lookup_uri);
PHP_MINFO_FUNCTION(apache);
function_entry apache_functions[] = {
PHP_FE(virtual, NULL)
PHP_FE(getallheaders, NULL)
PHP_FE(apache_note, NULL)
PHP_FE(apache_lookup_uri, NULL)
{NULL, NULL, NULL}
};
static PHP_INI_MH(OnChangeApacheInt)
{
long *p;
char *base = (char *) &php_apache_info;
p = (long *) (base+(size_t) mh_arg1);
if (new_value) {
*p = atoi(new_value);
return SUCCESS;
} else {
return FAILURE;
}
}
static PHP_INI_MH(OnChangeApacheString)
{
char **p;
char *base = (char *) &php_apache_info;
p = (char **) (base+(size_t) mh_arg1);
if (new_value) {
*p = new_value;
return SUCCESS;
} else {
return FAILURE;
}
}
PHP_INI_BEGIN()
PHP_INI_ENTRY1("xbithack", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, xbithack))
PHP_INI_ENTRY1("engine", "1", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, engine))
PHP_INI_ENTRY1("last_modified", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, last_modified))
PHP_INI_ENTRY1("dav_script", NULL, PHP_INI_ALL, OnChangeApacheString, (void *) XtOffsetOf(php_apache_info_struct, dav_script))
PHP_INI_END()
static PHP_MINIT_FUNCTION(apache)
{
REGISTER_INI_ENTRIES();
return SUCCESS;
}
static PHP_MSHUTDOWN_FUNCTION(apache)
{
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
php3_module_entry apache_module_entry = {
"Apache", apache_functions, PHP_MINIT(apache), PHP_MSHUTDOWN(apache), NULL, NULL, PHP_MINFO(apache), STANDARD_MODULE_PROPERTIES
};
/* {{{ proto string apache_note(string note_name [, string note_value])
Get and set Apache request notes */
PHP_FUNCTION(apache_note)
{
pval *arg_name,*arg_val;
char *note_val;
int arg_count = ARG_COUNT(ht);
SLS_FETCH();
if (arg_count<1 || arg_count>2 ||
getParameters(ht,arg_count,&arg_name,&arg_val) == FAILURE ) {
WRONG_PARAM_COUNT;
}
convert_to_string(arg_name);
note_val = (char *) table_get(((request_rec *) SG(server_context))->notes,arg_name->value.str.val);
if (arg_count == 2) {
convert_to_string(arg_val);
table_set(((request_rec *) SG(server_context))->notes,arg_name->value.str.val,arg_val->value.str.val);
}
if (note_val) {
RETURN_STRING(note_val,1);
} else {
RETURN_FALSE;
}
}
/* }}} */
PHP_MINFO_FUNCTION(apache)
{
module *modp = NULL;
char output_buf[128];
#if !defined(WIN32) && !defined(WINNT)
char name[64];
char *p;
#endif
server_rec *serv;
extern char server_root[MAX_STRING_LEN];
extern uid_t user_id;
extern char *user_name;
extern gid_t group_id;
extern int max_requests_per_child;
SLS_FETCH();
serv = ((request_rec *) SG(server_context))->server;
PUTS("<table border=5 width=\"600\">\n");
php_info_print_table_header(2, "Entry", "Value");
#if WIN32|WINNT
PUTS("Apache for Windows 95/NT<br>");
#else
php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE);
php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET);
#endif
php_info_print_table_row(2, "Apache Version", SERVER_VERSION);
#ifdef APACHE_RELEASE
sprintf(output_buf, "%d", APACHE_RELEASE);
php_info_print_table_row(2, "Apache Release", output_buf);
#endif
sprintf(output_buf, "%d", MODULE_MAGIC_NUMBER);
php_info_print_table_row(2, "Apache API Version", output_buf);
sprintf(output_buf, "%s:%u", serv->server_hostname,serv->port);
php_info_print_table_row(2, "Hostname/Port", output_buf);
#if !defined(WIN32) && !defined(WINNT)
sprintf(output_buf, "%s(%d)/%d", user_name,(int)user_id,(int)group_id);
php_info_print_table_row(2, "User/Group", output_buf);
sprintf(output_buf, "per child: %d<br>keep alive: %s<br>max per connection: %d",max_requests_per_child,serv->keep_alive ? "on":"off", serv->keep_alive_max);
php_info_print_table_row(2, "Max Requests", output_buf);
#endif
sprintf(output_buf, "connection: %d<br>keep-alive: %d",serv->timeout,serv->keep_alive_timeout);
php_info_print_table_row(2, "Timeouts", output_buf);
#if !defined(WIN32) && !defined(WINNT)
php_info_print_table_row(2, "Server Root", server_root);
PUTS("<tr><td valign=\"top\" bgcolor=\"" PHP_ENTRY_NAME_COLOR "\">Loaded modules</td><td bgcolor=\"" PHP_CONTENTS_COLOR "\">");
for(modp = top_module; modp; modp = modp->next) {
strlcpy(name, modp->name, sizeof(name));
if ((p = strrchr(name, '.'))) {
*p='\0'; /* Cut off ugly .c extensions on module names */
}
PUTS(name);
if (modp->next) {
PUTS(", ");
}
}
#endif
PUTS("</td></tr>\n");
PUTS("</table>\n");
{
register int i;
array_header *arr;
table_entry *elts;
request_rec *r;
SLS_FETCH();
r = ((request_rec *) SG(server_context));
arr = table_elts(r->subprocess_env);
elts = (table_entry *)arr->elts;
SECTION("Apache Environment");
PUTS("<table border=5 width=\"600\">\n");
php_info_print_table_header(2, "Variable", "Value");
for (i=0; i < arr->nelts; i++) {
php_info_print_table_row(2, elts[i].key, elts[i].val);
}
PUTS("</table>\n");
}
{
array_header *env_arr;
table_entry *env;
int i;
request_rec *r;
SLS_FETCH();
r = ((request_rec *) SG(server_context));
SECTION("HTTP Headers Information");
PUTS("<table border=5 width=\"600\">\n");
PUTS(" <tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Headers</th></tr>\n");
php_info_print_table_row(2, "HTTP Request", r->the_request);
env_arr = table_elts(r->headers_in);
env = (table_entry *)env_arr->elts;
for (i = 0; i < env_arr->nelts; ++i) {
if (env[i].key) {
php_info_print_table_row(2, env[i].key, env[i].val);
}
}
PUTS(" <tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Response Headers</th></tr>\n");
env_arr = table_elts(r->headers_out);
env = (table_entry *)env_arr->elts;
for(i = 0; i < env_arr->nelts; ++i) {
if (env[i].key) {
php_info_print_table_row(2, env[i].key, env[i].val);
}
}
PUTS("</table>\n\n");
}
}
/* This function is equivalent to <!--#include virtual...-->
* in mod_include. It does an Apache sub-request. It is useful
* for including CGI scripts or .shtml files, or anything else
* that you'd parse through Apache (for .phtml files, you'd probably
* want to use <?Include>. This only works when PHP is compiled
* as an Apache module, since it uses the Apache API for doing
* sub requests.
*/
/* {{{ proto int virtual(string filename)
Perform an Apache sub-request */
PHP_FUNCTION(virtual)
{
pval *filename;
request_rec *rr = NULL;
SLS_FETCH();
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(filename);
if (!(rr = sub_req_lookup_uri (filename->value.str.val, ((request_rec *) SG(server_context))))) {
php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", filename->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
}
if (rr->status != 200) {
php_error(E_WARNING, "Unable to include '%s' - error finding URI", filename->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
}
/* Cannot include another PHP file because of global conflicts */
if (rr->content_type &&
!strcmp(rr->content_type, PHP3_MIME_TYPE)) {
php_error(E_WARNING, "Cannot include a PHP file "
"(use <code>&lt;?include \"%s\"&gt;</code> instead)", filename->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
}
if (run_sub_req(rr)) {
php_error(E_WARNING, "Unable to include '%s' - request execution failed", filename->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
} else {
if (rr) destroy_sub_req (rr);
RETURN_TRUE;
}
}
/* }}} */
/* {{{ proto array getallheaders(void)
Fetch all HTTP request headers */
PHP_FUNCTION(getallheaders)
{
array_header *env_arr;
table_entry *tenv;
int i;
SLS_FETCH();
PLS_FETCH();
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
env_arr = table_elts(((request_rec *) SG(server_context))->headers_in);
tenv = (table_entry *)env_arr->elts;
for (i = 0; i < env_arr->nelts; ++i) {
if (!tenv[i].key ||
(PG(safe_mode) &&
!strncasecmp(tenv[i].key, "authorization", 13))) {
continue;
}
if (add_assoc_string(return_value, tenv[i].key,(tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) {
RETURN_FALSE;
}
}
}
/* }}} */
/* {{{ proto class apache_lookup_uri(string URI)
Perform a partial request of the given URI to obtain information about it */
PHP_FUNCTION(apache_lookup_uri)
{
pval *filename;
request_rec *rr=NULL;
SLS_FETCH();
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(filename);
if(!(rr = sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) {
php_error(E_WARNING, "URI lookup failed", filename->value.str.val);
RETURN_FALSE;
}
object_init(return_value);
add_property_long(return_value,"status",rr->status);
if (rr->the_request) {
add_property_string(return_value,"the_request",rr->the_request,1);
}
if (rr->status_line) {
add_property_string(return_value,"status_line",(char *)rr->status_line,1);
}
if (rr->method) {
add_property_string(return_value,"method",(char *)rr->method,1);
}
if (rr->content_type) {
add_property_string(return_value,"content_type",(char *)rr->content_type,1);
}
if (rr->handler) {
add_property_string(return_value,"handler",(char *)rr->handler,1);
}
if (rr->uri) {
add_property_string(return_value,"uri",rr->uri,1);
}
if (rr->filename) {
add_property_string(return_value,"filename",rr->filename,1);
}
if (rr->path_info) {
add_property_string(return_value,"path_info",rr->path_info,1);
}
if (rr->args) {
add_property_string(return_value,"args",rr->args,1);
}
if (rr->boundary) {
add_property_string(return_value,"boundary",rr->boundary,1);
}
add_property_long(return_value,"no_cache",rr->no_cache);
add_property_long(return_value,"no_local_copy",rr->no_local_copy);
add_property_long(return_value,"allowed",rr->allowed);
add_property_long(return_value,"sent_bodyct",rr->sent_bodyct);
add_property_long(return_value,"bytes_sent",rr->bytes_sent);
add_property_long(return_value,"byterange",rr->byterange);
add_property_long(return_value,"clength",rr->clength);
#if MODULE_MAGIC_NUMBER >= 19980324
if (rr->unparsed_uri) {
add_property_string(return_value,"unparsed_uri",rr->unparsed_uri,1);
}
if(rr->mtime) {
add_property_long(return_value,"mtime",rr->mtime);
}
#endif
if(rr->request_time) {
add_property_long(return_value,"request_time",rr->request_time);
}
destroy_sub_req(rr);
}
/* }}} */
#if 0
This function is most likely a bad idea. Just playing with it for now.
PHP_FUNCTION(apache_exec_uri)
{
pval *filename;
request_rec *rr=NULL;
SLS_FETCH();
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(filename);
if(!(rr = ap_sub_req_lookup_uri(filename->value.str.val, ((request_rec *) SG(server_context))))) {
php_error(E_WARNING, "URI lookup failed", filename->value.str.val);
RETURN_FALSE;
}
RETVAL_LONG(ap_run_sub_req(rr));
ap_destroy_sub_req(rr);
}
#endif
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+5
View File
@@ -0,0 +1,5 @@
dnl $Id$
if test -n "$APACHE_INCLUDE"; then
PHP_EXTENSION(apache)
fi
+6
View File
@@ -0,0 +1,6 @@
# $Id$
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_aspell.a
libphpext_aspell_a_SOURCES=aspell.c
+204
View File
@@ -0,0 +1,204 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 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_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#if defined(COMPILE_DL)
#include "phpdl.h"
#endif
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#if HAVE_ASPELL
#include "php3_aspell.h"
#if APACHE
# ifndef DEBUG
# undef palloc
# endif
#endif
#include <aspell-c.h>
function_entry aspell_functions[] = {
PHP_FE(aspell_new, NULL)
PHP_FE(aspell_check, NULL)
PHP_FE(aspell_check_raw, NULL)
PHP_FE(aspell_suggest, NULL)
{NULL, NULL, NULL}
};
static int le_aspell;
php3_module_entry aspell_module_entry = {
"Aspell", aspell_functions, PHP_MINIT(aspell), NULL, NULL, NULL, PHP_MINFO(aspell), STANDARD_MODULE_PROPERTIES
};
#if COMPILE_DL
DLEXPORT php3_module_entry *get_module(void) { return &aspell_module_entry; }
#endif
PHP_MINIT_FUNCTION(aspell)
{
le_aspell = register_list_destructors(php3_aspell_close,NULL);
return SUCCESS;
}
void php3_aspell_close(aspell *sc)
{
aspell_free(sc);
}
/* {{{ proto int aspell_new(string master[, string personal])
Load a dictionary */
PHP_FUNCTION(aspell_new)
{
pval *master, *personal;
int argc;
aspell *sc;
int ind;
argc = ARG_COUNT(ht);
if (argc < 1 || argc > 2 || getParameters(ht, argc, &master,&personal) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(master);
if(argc==2)
{
convert_to_string(personal) ;
sc=aspell_new(master->value.str.val,personal->value.str.val);
}
else
sc=aspell_new(master->value.str.val,"");
ind = php3_list_insert(sc, le_aspell);
RETURN_LONG(ind);
}
/* }}} */
/* {{{ proto array aspell_suggest(aspell int,string word)
Return array of Suggestions */
PHP_FUNCTION(aspell_suggest)
{
pval *scin, *word;
int argc;
aspell *sc;
int ind,type;
aspellSuggestions *sug;
size_t i;
argc = ARG_COUNT(ht);
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scin);
convert_to_string(word);
sc= (aspell *) php3_list_find(scin->value.lval, &type);
if(!sc)
{
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
RETURN_FALSE;
}
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
sug = aspell_suggest(sc, word->value.str.val);
for (i = 0; i != sug->size; ++i) {
add_next_index_string(return_value,(char *)sug->data[i],1);
}
aspell_free_suggestions(sug);
}
/* }}} */
/* {{{ proto int aspell_check(aspell int,string word)
Return if word is valid */
PHP_FUNCTION(aspell_check)
{
int type;
pval *scin,*word;
aspell *sc;
int argc;
argc = ARG_COUNT(ht);
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scin);
convert_to_string(word);
sc= (aspell *) php3_list_find(scin->value.lval, &type);
if(!sc)
{
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
RETURN_FALSE;
}
if (aspell_check(sc, word->value.str.val))
{
RETURN_TRUE;
}
else
{
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int aspell_check_raw(aspell int,string word)
Return if word is valid, ignoring case or trying to trim it in any way*/
PHP_FUNCTION(aspell_check_raw)
{
pval *scin,*word;
int type;
int argc;
aspell *sc;
argc = ARG_COUNT(ht);
if (argc != 2 || getParameters(ht, argc, &scin,&word) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scin);
convert_to_string(word);
sc= (aspell *) php3_list_find(scin->value.lval, &type);
if(!sc)
{
php_error(E_WARNING, "%d is not a ASPELL result index", scin->value.lval);
RETURN_FALSE;
}
if (aspell_check_raw(sc, word->value.str.val))
{
RETURN_TRUE;
}
else
{
RETURN_FALSE;
}
}
/* }}} */
PHP_MINFO_FUNCTION(aspell)
{
php_printf("ASpell support enabled");
}
#endif
+4
View File
@@ -0,0 +1,4 @@
/* Define if you want the ASPELL interface */
#ifndef HAVE_ASPELL
#define HAVE_ASPELL 0
#endif
+28
View File
@@ -0,0 +1,28 @@
dnl $Id$
AC_MSG_CHECKING(for ASPELL support)
AC_ARG_WITH(aspell,
[ --with-aspell[=DIR] Include ASPELL support.],
[
if test "$withval" != "no"; then
if test "$withval" = "yes"; then
ASPELL_DIR=/usr/local
else
ASPELL_DIR=$withval
fi
AC_ADD_INCLUDE($ASPELL_DIR/include)
AC_ADD_LIBRARY_WITH_PATH(aspell, $ASPELL_DIR/lib)
if test ! -f "$ASPELL_DIR/include/aspell-c.h"; then
AC_MSG_ERROR(Could not find aspell-c.h in $ASPELL_DIR/include - please copy it manually from the aspell sources to $ASPELL_DIR/include)
fi
AC_DEFINE(HAVE_ASPELL)
AC_MSG_RESULT(yes)
PHP_EXTENSION(aspell)
else
AC_MSG_ERROR(no)
fi
],[
AC_MSG_RESULT(no)
])
+54
View File
@@ -0,0 +1,54 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _ASPELL_H
#define _ASPELL_H
#if HAVE_ASPELL
extern php3_module_entry aspell_module_entry;
#define aspell_module_ptr &aspell_module_entry
extern PHP_MINIT_FUNCTION(aspell);
extern PHP_MINFO_FUNCTION(aspell);
extern void php3_aspell_close();
PHP_FUNCTION(aspell_new);
PHP_FUNCTION(aspell_check);
PHP_FUNCTION(aspell_check_raw);
PHP_FUNCTION(aspell_suggest);
#else
#define aspell_module_ptr NULL
#endif
#define phpext_aspell_ptr aspell_module_ptr
#endif /* _ASPELL_H */
+5
View File
@@ -0,0 +1,5 @@
# $Id$
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_bcmath.a
libphpext_bcmath_a_SOURCES=bcmath.c number.c
+434
View File
@@ -0,0 +1,434 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 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_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
+----------------------------------------------------------------------+
*/
#include "php.h"
#if WITH_BCMATH
#include "number.h"
#include "php3_bcmath.h"
function_entry bcmath_functions[] = {
PHP_FE(bcadd, NULL)
PHP_FE(bcsub, NULL)
PHP_FE(bcmul, NULL)
PHP_FE(bcdiv, NULL)
PHP_FE(bcmod, NULL)
PHP_FE(bcpow, NULL)
PHP_FE(bcsqrt, NULL)
PHP_FE(bcscale, NULL)
PHP_FE(bccomp, NULL)
{NULL, NULL, NULL}
};
php3_module_entry bcmath_module_entry = {
"bcmath", bcmath_functions, NULL, NULL, PHP_RINIT(bcmath), PHP_RSHUTDOWN(bcmath), NULL, STANDARD_MODULE_PROPERTIES
};
#if COMPILE_DL
php3_module_entry *get_module() { return &bcmath_module_entry; };
#endif
#ifndef THREAD_SAFE
static long bc_precision;
#endif
PHP_RINIT_FUNCTION(bcmath)
{
init_numbers();
if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) {
bc_precision=0;
}
return SUCCESS;
}
PHP_RSHUTDOWN_FUNCTION(bcmath)
{
destruct_numbers();
return SUCCESS;
}
/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
Returns the sum of two arbitrary precision numbers */
PHP_FUNCTION(bcadd)
{
pval *left, *right,*scale_param;
bc_num first, second, result;
int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &left, &right) == FAILURE) {
WRONG_PARAM_COUNT;
}
break;
case 3:
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scale_param);
scale = (int) scale_param->value.lval;
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_string(left);
convert_to_string(right);
init_num(&first);
init_num(&second);
init_num(&result);
str2num(&first,left->value.str.val,scale);
str2num(&second,right->value.str.val,scale);
bc_add (first,second,&result, scale);
return_value->value.str.val = num2str(result);
return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING;
free_num(&first);
free_num(&second);
free_num(&result);
return;
}
/* }}} */
/* {{{ proto string bcsub(string left_operand, string right_operand [, int scale])
Returns the difference between two arbitrary precision numbers (subtration) */
PHP_FUNCTION(bcsub)
{
pval *left, *right,*scale_param;
bc_num first, second, result;
int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &left, &right) == FAILURE) {
WRONG_PARAM_COUNT;
}
break;
case 3:
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scale_param);
scale = (int) scale_param->value.lval;
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_string(left);
convert_to_string(right);
init_num(&first);
init_num(&second);
init_num(&result);
str2num(&first,left->value.str.val,scale);
str2num(&second,right->value.str.val,scale);
bc_sub (first,second,&result, scale);
return_value->value.str.val = num2str(result);
return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING;
free_num(&first);
free_num(&second);
free_num(&result);
return;
}
/* }}} */
/* {{{ proto string bcmul(string left_operand, string right_operand [, int scale])
Returns the multiplication of two arbitrary precision numbers */
PHP_FUNCTION(bcmul)
{
pval *left, *right,*scale_param;
bc_num first, second, result;
int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &left, &right) == FAILURE) {
WRONG_PARAM_COUNT;
}
break;
case 3:
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scale_param);
scale = (int) scale_param->value.lval;
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_string(left);
convert_to_string(right);
init_num(&first);
init_num(&second);
init_num(&result);
str2num(&first,left->value.str.val,scale);
str2num(&second,right->value.str.val,scale);
bc_multiply (first,second,&result, scale);
return_value->value.str.val = num2str(result);
return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING;
free_num(&first);
free_num(&second);
free_num(&result);
return;
}
/* }}} */
/* {{{ proto string bcdiv(string left_operand, string right_operand [, int scale])
Returns the quotient of two arbitrary precision numbers (division) */
PHP_FUNCTION(bcdiv)
{
pval *left, *right,*scale_param;
bc_num first, second, result;
int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &left, &right) == FAILURE) {
WRONG_PARAM_COUNT;
}
break;
case 3:
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scale_param);
scale = (int) scale_param->value.lval;
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_string(left);
convert_to_string(right);
init_num(&first);
init_num(&second);
init_num(&result);
str2num(&first,left->value.str.val,scale);
str2num(&second,right->value.str.val,scale);
switch (bc_divide (first,second,&result, scale)) {
case 0: /* OK */
return_value->value.str.val = num2str(result);
return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING;
break;
case -1: /* division by zero */
php_error(E_WARNING,"Division by zero");
break;
}
free_num(&first);
free_num(&second);
free_num(&result);
return;
}
/* }}} */
/* {{{ proto string bcmod(string left_operand, string right_operand)
Returns the modulus of the two arbitrary precision operands */
PHP_FUNCTION(bcmod)
{
pval *left, *right;
bc_num first, second, result;
switch (ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &left, &right) == FAILURE) {
WRONG_PARAM_COUNT;
}
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_string(left);
convert_to_string(right);
init_num(&first);
init_num(&second);
init_num(&result);
str2num(&first,left->value.str.val,0);
str2num(&second,right->value.str.val,0);
switch (bc_modulo(first,second,&result, 0)) {
case 0:
return_value->value.str.val = num2str(result);
return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING;
break;
case -1:
php_error(E_WARNING,"Division by zero");
break;
}
free_num(&first);
free_num(&second);
free_num(&result);
return;
}
/* }}} */
/* {{{ proto string bcpow(string x, string y [, int scale])
Returns the value of an arbitrary precision number raised to the power of another */
PHP_FUNCTION(bcpow)
{
pval *left, *right,*scale_param;
bc_num first, second, result;
int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &left, &right) == FAILURE) {
WRONG_PARAM_COUNT;
}
break;
case 3:
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scale_param);
scale = (int) scale_param->value.lval;
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_string(left);
convert_to_string(right);
init_num(&first);
init_num(&second);
init_num(&result);
str2num(&first,left->value.str.val,scale);
str2num(&second,right->value.str.val,scale);
bc_raise (first,second,&result, scale);
return_value->value.str.val = num2str(result);
return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING;
free_num(&first);
free_num(&second);
free_num(&result);
return;
}
/* }}} */
/* {{{ proto string bcsqrt(string operand [, int scale])
Returns the square root of an arbitray precision number */
PHP_FUNCTION(bcsqrt)
{
pval *left,*scale_param;
bc_num result;
int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 1:
if (getParameters(ht, 1, &left) == FAILURE) {
WRONG_PARAM_COUNT;
}
break;
case 2:
if (getParameters(ht, 2, &left, &scale_param) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scale_param);
scale = (int) scale_param->value.lval;
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_string(left);
init_num(&result);
str2num(&result,left->value.str.val,scale);
if (bc_sqrt (&result, scale) != 0) {
return_value->value.str.val = num2str(result);
return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING;
} else {
php_error(E_WARNING,"Square root of negative number");
}
free_num(&result);
return;
}
/* }}} */
/* {{{ proto string bccomp(string left_operand, string right_operand [, int scale])
Compares two arbitrary precision numbers */
PHP_FUNCTION(bccomp)
{
pval *left, *right, *scale_param;
bc_num first, second;
int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &left, &right) == FAILURE) {
WRONG_PARAM_COUNT;
}
break;
case 3:
if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(scale_param);
scale = (int) scale_param->value.lval;
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_string(left);
convert_to_string(right);
init_num(&first);
init_num(&second);
str2num(&first,left->value.str.val,scale);
str2num(&second,right->value.str.val,scale);
return_value->value.lval = bc_compare(first,second);
return_value->type = IS_LONG;
free_num(&first);
free_num(&second);
return;
}
/* }}} */
/* {{{ proto string bcscale(int scale)
Sets default scale parameter for all bc math functions */
PHP_FUNCTION(bcscale)
{
pval *new_scale;
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &new_scale)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(new_scale);
bc_precision = new_scale->value.lval;
RETURN_TRUE;
}
/* }}} */
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+2
View File
@@ -0,0 +1,2 @@
/* Define if you want to enable bc style precision math support */
#define WITH_BCMATH 0
+20
View File
@@ -0,0 +1,20 @@
dnl $Id$
AC_MSG_CHECKING(whether to enable bc style precision math functions)
AC_ARG_ENABLE(bcmath,
[ --enable-bcmath Compile with bc style precision math functions.
Read README-BCMATH for instructions on how to
get this module installed. ],
[
if test "$enableval" = "yes"; then
AC_DEFINE(WITH_BCMATH, 1)
AC_MSG_RESULT(yes)
PHP_EXTENSION(bcmath)
else
AC_DEFINE(WITH_BCMATH, 0)
AC_MSG_RESULT(no)
fi
],[
AC_DEFINE(WITH_BCMATH, 0)
AC_MSG_RESULT(no)
])
+64
View File
@@ -0,0 +1,64 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _PHP3_BCMATH_H
#define _PHP3_BCMATH_H
#if COMPILE_DL
#undef WITH_BCMATH
#define WITH_BCMATH 1
#endif
#if WITH_BCMATH
extern php3_module_entry bcmath_module_entry;
#define phpext_bcmath_ptr &bcmath_module_entry
extern PHP_RINIT_FUNCTION(bcmath);
extern PHP_RSHUTDOWN_FUNCTION(bcmath);
PHP_FUNCTION(bcadd);
PHP_FUNCTION(bcsub);
PHP_FUNCTION(bcmul);
PHP_FUNCTION(bcdiv);
PHP_FUNCTION(bcmod);
PHP_FUNCTION(bcpow);
PHP_FUNCTION(bcsqrt);
PHP_FUNCTION(bccomp);
PHP_FUNCTION(bcscale);
#else
#define phpext_bcmath_ptr NULL
#endif
#endif /* _PHP3_BCMATH_H */
+6
View File
@@ -0,0 +1,6 @@
# $Source$
# $Id$
define_option enable-bcmath 'Enable bc style precision math functions' yesno \
yes \
' Enables bc style arbitrary precision math functions.'
+24
View File
@@ -0,0 +1,24 @@
#ifndef _PHP3_COM_H
#define _PHP3_COM_H
#if WIN32|WINNT
extern PHP_MINIT_FUNCTION(COM);
extern PHP_MSHUTDOWN_FUNCTION(COM);
PHP_FUNCTION(COM_load);
PHP_FUNCTION(COM_invoke);
PHP_FUNCTION(com_propget);
PHP_FUNCTION(com_propput);
extern php3_module_entry COM_module_entry;
#define COM_module_ptr &COM_module_entry
#else
#define COM_module_ptr NULL
#endif /* Win32|WINNT */
#define phpext_COM_ptr COM_module_ptr
#endif /* _PHP3_COM_H */
+6
View File
@@ -0,0 +1,6 @@
# $Id$
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_dav.a
libphpext_dav_a_SOURCES=dav.c
+2
View File
@@ -0,0 +1,2 @@
/* Define to compile with mod_dav support */
#define HAVE_MOD_DAV 0
+29
View File
@@ -0,0 +1,29 @@
dnl $Id$
dnl config.m4 for extension dav
dnl don't forget to call PHP_EXTENSION(dav)
AC_MSG_CHECKING(whether to enable DAV support through mod_dav)
AC_ARG_WITH(mod-dav,
[ --with-mod-dav=DIR Include DAV support through Apache's mod_dav,
DIR is mod_dav's installation directory (Apache
module version only!)],
[
if test "$withval" = "yes"; then
AC_MSG_ERROR(Must give parameter to --with-mod-dav!)
else
if test "$withval" != "no"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MOD_DAV, 1)
CFLAGS="$CFLAGS -DHAVE_MOD_DAV -I$withval"
INCLUDES="$INCLUDES -I$withval"
PHP_EXTENSION(dav)
else
AC_MSG_RESULT(no)
AC_DEFINE(HAVE_MOD_DAV, 0)
fi
fi
],[
AC_MSG_RESULT(no)
AC_DEFINE(HAVE_MOD_DAV, 0)
])
+289
View File
@@ -0,0 +1,289 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 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_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Stig Sæther Bakken <ssb@guardian.no> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#define IS_EXT_MODULE
#if COMPILE_DL
# if PHP_31
# include "../phpdl.h"
# else
# include "dl/phpdl.h"
# endif
#endif
#include "php.h"
#include "php3_dav.h"
#if defined(THREAD_SAFE) && !PHP_31
# undef THREAD_SAFE
#endif
#if HAVE_MOD_DAV
# include "mod_dav.h"
# include "phpdav.h"
# include "variables.h"
/* {{{ thread safety stuff */
# ifdef THREAD_SAFE
# define DAV_GLOBAL(a) phpdav_globals->a
# define DAV_TLS_VARS phpdav_global_struct *phpdav_globals = TlsGetValue(PHPDAVTls);
void *phpdav_mutex;
DWORD PHPDAVTls;
static int numthreads=0;
typedef struct phpdav_global_struct {
phpdav_module php3_dav_module;
} phpdav_global_struct;
# else /* !defined(THREAD_SAFE) */
# define DAV_GLOBAL(a) a
# define DAV_TLS_VARS
phpdav_module php3_dav_module;
# endif /* defined(THREAD_SAFE) */
# define DAV_HANDLER(a) DAV_GLOBAL(php3_dav_module).a##_handler
# define DAV_SET_HANDLER(a,b) \
dav_set_handler(&DAV_GLOBAL(php3_dav_module).a##_handler,(b))
/* }}} */
/* {{{ dynamically loadable module stuff */
# if COMPILE_DL
DLEXPORT php3_module_entry *get_module() { return &phpdav_module_entry; };
# endif /* COMPILE_DL */
/* }}} */
/* {{{ function prototypes */
int php3_minit_phpdav(INIT_FUNC_ARGS);
int php3_rinit_phpdav(INIT_FUNC_ARGS);
int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS);
int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS);
void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS);
/* }}} */
/* {{{ extension definition structures */
function_entry phpdav_functions[] = {
PHP_FE(dav_set_mkcol_handlers, NULL)
{NULL, NULL, NULL}
};
php3_module_entry phpdav_module_entry = {
"DAV", /* extension name */
phpdav_functions, /* extension function list */
php3_minit_phpdav, /* extension-wide startup function */
php3_mshutdown_phpdav, /* extension-wide shutdown function */
php3_rinit_phpdav, /* per-request startup function */
php3_rshutdown_phpdav, /* per-request shutdown function */
php3_info_phpdav, /* information function */
STANDARD_MODULE_PROPERTIES
};
/* }}} */
/* {{{ startup, shutdown and info functions */
/* {{{ php3_minit_phpdav */
int php3_minit_phpdav(INIT_FUNC_ARGS)
{
#if defined(THREAD_SAFE)
phpdav_global_struct *phpdav_globals;
PHP3_MUTEX_ALLOC(phpdav_mutex);
PHP3_MUTEX_LOCK(phpdav_mutex);
numthreads++;
if (numthreads==1){
if (!PHP3_TLS_PROC_STARTUP(PHPDAVTls)){
PHP3_MUTEX_UNLOCK(phpdav_mutex);
PHP3_MUTEX_FREE(phpdav_mutex);
return FAILURE;
}
}
PHP3_MUTEX_UNLOCK(phdpav_mutex);
if(!PHP3_TLS_THREAD_INIT(PHPDAVTls,phpdav_globals,phpdav_global_struct)){
PHP3_MUTEX_FREE(phpdav_mutex);
return FAILURE;
}
#endif
return SUCCESS;
}
/* }}} */
/* {{{ php3_rinit_phpdav */
int php3_rinit_phpdav(INIT_FUNC_ARGS)
{
return SUCCESS;
}
/* }}} */
/* {{{ php3_mshutdown_phpdav() */
int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS)
{
DAV_TLS_VARS;
#ifdef THREAD_SAFE
PHP3_TLS_THREAD_FREE(phpdav_globals);
PHP3_MUTEX_LOCK(phpdav_mutex);
numthreads--;
if (numthreads < 1) {
PHP3_TLS_PROC_SHUTDOWN(PHPDAVTls);
PHP3_MUTEX_UNLOCK(phpdav_mutex);
PHP3_MUTEX_FREE(phpdav_mutex);
return SUCCESS;
}
PHP3_MUTEX_UNLOCK(phpdav_mutex);
#endif
return SUCCESS;
}
/* }}} */
/* {{{ php3_rshutdown_phpdav() */
int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS)
{
if (DAV_HANDLER(mkcol_test)) {
efree(DAV_HANDLER(mkcol_test));
}
if (DAV_HANDLER(mkcol_create)) {
efree(DAV_HANDLER(mkcol_create));
}
return SUCCESS;
}
/* }}} */
/* {{{ php3_info_phpdav() */
void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS)
{
}
/* }}} */
/* }}} */
/* {{{ extension-internal functions */
/* {{{ dav_set_handler() */
static void
dav_set_handler(char **nameBufp, pval *data)
{
if (data->value.str.len > 0) {
if (*nameBufp != NULL) {
efree(*nameBufp);
}
*nameBufp = php3i_pval_strdup(data);
} else {
if (*nameBufp != NULL) {
efree(*nameBufp);
}
*nameBufp = NULL;
}
}
/* }}} */
/* {{{ dav_call_handler() */
static int
dav_call_handler(char *funcName, int argc, pval **argv)
{
if (funcName) {
pval *retval, *func;
int i, ret;
HashTable *function_table;
func = php3i_string_pval(funcName);
retval = emalloc(sizeof(pval));
function_table = php3i_get_function_table();
if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) {
php3tls_pval_destructor(retval);
efree(retval);
return HTTP_INTERNAL_SERVER_ERROR;
}
php3tls_pval_destructor(func);
efree(func);
for (i = 0; i < argc; i++) {
php3tls_pval_destructor(argv[i]);
efree(argv[i]);
}
convert_to_long(retval);
ret = retval->value.lval;
efree(retval);
return ret;
}
return DECLINED;
}
/* }}} */
int phpdav_mkcol_test_handler(request_rec *r)
{
pval *arg;
if (DAV_HANDLER(mkcol_test) == NULL) {
return DECLINED;
}
arg = php3i_string_pval(r->filename);
return dav_call_handler(DAV_HANDLER(mkcol_test), 1, &arg);
}
int phpdav_mkcol_create_handler(request_rec *r)
{
pval *arg;
if (DAV_HANDLER(mkcol_create) == NULL) {
return DECLINED;
}
arg = php3i_string_pval(r->filename);
return dav_call_handler(DAV_HANDLER(mkcol_create), 1, &arg);
}
/* }}} */
/************************* EXTENSION FUNCTIONS *************************/
/* {{{ proto void dav_set_mkcol_handlers(string test, string create)
Sets the function to test whether a DAV collection exists for MKCOL */
PHP_FUNCTION(dav_set_mkcol_handlers)
{
pval *test, *create;
DAV_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &test, &create) == FAILURE) {
WRONG_PARAM_COUNT;
}
DAV_SET_HANDLER(mkcol_test, test);
DAV_SET_HANDLER(mkcol_create, create);
RETVAL_TRUE;
}
/* }}} */
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+66
View File
@@ -0,0 +1,66 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Stig Sæther Bakken <ssb@guardian.no> |
+----------------------------------------------------------------------+
*/
/* $Id */
#ifndef _PHP_DAV_H
# define _PHP_DAV_H
# if HAVE_MOD_DAV
typedef struct {
int foo;
char *mkcol_test_handler;
char *mkcol_create_handler;
} phpdav_module;
extern php3_module_entry phpdav_module_entry;
# define phpdav_module_ptr &phpdav_module_entry
int phpdav_mkcol_test_handler(request_rec *);
PHP_FUNCTION(dav_set_mkcol_handlers);
# else /* !HAVE_MOD_DAV */
# define phpdav_module_ptr NULL
# endif /* HAVE_MOD_DAV */
#define phpext_dav_ptr phpdav_module_ptr
#endif /* _PHP_DAV_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+2
View File
@@ -0,0 +1,2 @@
# $Id$
# This extension is still very much under construction.
+6
View File
@@ -0,0 +1,6 @@
# $Id$
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_db.a
libphpext_db_a_SOURCES=db.c
+5
View File
@@ -0,0 +1,5 @@
/* Define if you have an ndbm compatible library (-ldbm). */
#define NDBM 0
/* Define if you have the gdbm library (-lgdbm). */
#define GDBM 0
+53
View File
@@ -0,0 +1,53 @@
dnl $Id$
dnl config.m4 for extension db
dnl don't forget to call PHP_EXTENSION(db)
divert(1)
# Checks for libraries.
# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order
AC_DEFUN(AC_PREFERRED_DB_LIB,[
AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM) DBM_TYPE=gdbm; DBM_LIB=-lgdbm],
[AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldb],
[AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=],
[AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldbm],
[DBM_TYPE=""])])])])
AC_MSG_CHECKING([preferred dbm library])
if test "a$DBM_TYPE" = a; then
AC_MSG_RESULT(none found)
AC_MSG_WARN(No dbm library found - using built-in flatfile support)
else
AC_MSG_RESULT($DBM_TYPE chosen)
fi
AC_SUBST(DBM_LIB)
AC_SUBST(DBM_TYPE)
])
AC_PREFERRED_DB_LIB
divert(3)
if test "$DBM_LIB" = "-lgdbm"; then
AC_CHECK_HEADER(gdbm.h, [ GDBM_INCLUDE="" ], [
AC_MSG_RESULT("Try /usr/local/include/gdbm.h");
AC_CHECK_HEADER(/usr/local/include/gdbm.h, [ GDBM_INCLUDE="-I/usr/local/include" ],[
AC_MSG_RESULT("Try /opt/local/include/gdbm.h");
AC_CHECK_HEADER(/opt/local/include/gdbm.h, [ GDBM_INCLUDE="-I/opt/local/include" ],[
dnl if in /usr/pkg/include, do not add anything. See above.
AC_MSG_RESULT("Try /usr/pkg/include/gdbm.h");
AC_CHECK_HEADER(/usr/pkg/include/gdbm.h, [ GDBM_INCLUDE="" ],[
AC_MSG_RESULT("Giving up - You need to install gdbm.h somewhere");
exit
])
])
])
])
fi
if test -n "$DBM_LIB"; then
INCLUDES="$INCLUDES $GDBM_INCLUDE"
EXTRA_LIBS="$EXTRA_LIBS $DBM_LIB"
fi
PHP_EXTENSION(db)
+1163
View File
File diff suppressed because it is too large. Load diff
+95
View File
@@ -0,0 +1,95 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _PHP3_DB_H
#define _PHP3_DB_H
#ifndef DLEXPORT
#define DLEXPORT
#endif
extern php3_module_entry dbm_module_entry;
#define phpext_db_ptr &dbm_module_entry
typedef struct dbm_info {
char *filename;
char *lockfn;
int lockfd;
void *dbf;
} dbm_info;
/*
we're not going to bother with flatfile on win32
because the dbm module will be external, and we
do not want flatfile compiled staticly
*/
#if defined(MSVC5) && !defined(COMPILE_DL)
#undef phpext_db_ptr
#define phpext_db_ptr NULL
#endif
dbm_info *_php3_finddbm(pval *id,HashTable *list);
int _php3_dbmclose(dbm_info *info);
dbm_info *_php3_dbmopen(char *filename, char *mode);
int _php3_dbminsert(dbm_info *info, char *key, char *value);
char *_php3_dbmfetch(dbm_info *info, char *key);
int _php3_dbmreplace(dbm_info *info, char *key, char *value);
int _php3_dbmexists(dbm_info *info, char *key);
int _php3_dbmdelete(dbm_info *info, char *key);
char *_php3_dbmfirstkey(dbm_info *info);
char *_php3_dbmnextkey(dbm_info *info, char *key);
/* db file functions */
PHP_MINIT_FUNCTION(db);
PHP_RINIT_FUNCTION(db);
PHP_MINFO_FUNCTION(db);
PHP_FUNCTION(dblist);
PHP_FUNCTION(dbmopen);
PHP_FUNCTION(dbmclose);
PHP_FUNCTION(dbminsert);
PHP_FUNCTION(dbmfetch);
PHP_FUNCTION(dbmreplace);
PHP_FUNCTION(dbmexists);
PHP_FUNCTION(dbmdelete);
PHP_FUNCTION(dbmfirstkey);
PHP_FUNCTION(dbmnextkey);
#undef phpext_db_ptr
#define phpext_db_ptr NULL
#endif /* _PHP3_DB_H */
+7
View File
@@ -0,0 +1,7 @@
# $Id$
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_dba.a
libphpext_dba_a_SOURCES=dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c \
dba_ndbm.c
+17
View File
@@ -0,0 +1,17 @@
/* define if you want to use the dba extension */
#define NDBM_DB1_NDBM_H 0
#define NDBM_NDBM_H 0
#define DB2_DB2_DB_H 0
#define DB2_DB_DB2_H 0
#define DB2_DB_H 0
#define DB2_DB2_H 0
#define HAVE_DBA 0
#define DBA_GDBM 0
#define DBA_NDBM 0
#define DBA_DBOPEN 0
#define DBA_DB2 0
#define DBA_DBM 0
#define DBA_CDB 0
+210
View File
@@ -0,0 +1,210 @@
dnl $Id$
dnl config.m4 for extension dba
dnl don't forget to call PHP_EXTENSION(dba)
AC_DEFUN(AC_TEMP_LDFLAGS,[
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$1 $LDFLAGS"
$2
LDFLAGS="$old_LDFLAGS"
])
dnl Assign INCLUDE/LFLAGS from PREFIX
AC_DEFUN(AC_DBA_STD_ASSIGN,[
if test "$THIS_PREFIX" != "" -a "$THIS_PREFIX" != "/usr"; then
THIS_INCLUDE="$THIS_PREFIX/include"
THIS_LFLAGS="$THIS_PREFIX/lib"
fi
])
dnl Standard check
AC_DEFUN(AC_DBA_STD_CHECK,[
THIS_RESULT="yes"
if test "$THIS_PREFIX" != "/usr"; then
if test "$THIS_INCLUDE" = "" ; then
AC_MSG_ERROR(cannot find necessary header file(s))
elif test "$THIS_LIBS" = "" ; then
AC_MSG_ERROR(cannot find necessary library)
fi
fi
])
dnl Attach THIS_x to DBA_x
AC_DEFUN(AC_DBA_STD_ATTACH,[
AC_ADD_INCLUDE($THIS_INCLUDE)
AC_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS)
THIS_INCLUDE=""
THIS_LIBS=""
THIS_LFLAGS=""
THIS_PREFIX=""
])
dnl Print the result message
AC_DEFUN(AC_DBA_STD_RESULT,[
if test "$THIS_RESULT" = "yes"; then
HAVE_DBA=1
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
THIS_RESULT=""
])
AC_ARG_WITH(gdbm,
[ --with-gdbm[=DIR] Include GDBM support],[
if test "$withval" != "no"; then
for i in /usr/local /usr $withval; do
if test -f "$i/include/gdbm.h"; then
THIS_PREFIX="$i"
fi
done
unset ac_cv_lib_gdbm_gdbm_open
AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB(gdbm, gdbm_open, [AC_DEFINE(DBA_GDBM, 1) THIS_LIBS="gdbm"])
])
AC_DBA_STD_ASSIGN
AC_DBA_STD_CHECK
AC_DBA_STD_ATTACH
fi
])
AC_MSG_CHECKING(for GDBM support)
AC_DBA_STD_RESULT
AC_ARG_WITH(ndbm,
[ --with-ndbm[=DIR] Include NDBM support],[
if test "$withval" != "no"; then
for i in /usr/local /usr $withval; do
if test -f "$i/include/db1/ndbm.h" ; then
THIS_PREFIX="$i"
NDBM_EXTRA="NDBM_DB1_NDBM_H"
elif test -f "$i/include/ndbm.h" ; then
THIS_PREFIX="$i"
NDBM_EXTRA="NDBM_NDBM_H"
fi
done
if test "$NDBM_EXTRA" != ""; then
eval "AC_DEFINE($NDBM_EXTRA, 1)"
fi
for LIB in db1 ndbm c; do
AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, dbm_open, [AC_DEFINE(DBA_NDBM,1) THIS_LIBS="$LIB"])
])
done
AC_DBA_STD_ASSIGN
AC_DBA_STD_CHECK
AC_DBA_STD_ATTACH
fi
])
AC_MSG_CHECKING(for NDBM support)
AC_DBA_STD_RESULT
AC_ARG_WITH(db2,
[ --with-db2[=DIR] Include DB2 support],[
if test "$withval" != "no"; then
for i in /usr/local /usr /usr/BerkeleyDB $withval; do
if test -f "$i/db2/db.h"; then
THIS_PREFIX="$i"
DB2_EXTRA="db2"
elif test -f "$i/include/db2/db.h"; then
THIS_PREFIX="$i"
DB2_EXTRA="DB2_DB2_DB_H"
elif test -f "$i/include/db/db2.h"; then
THIS_PREFIX="$i"
DB2_EXTRA="DB2_DB_DB2_H"
elif test -f "$i/include/db2.h"; then
THIS_PREFIX="$i"
DB2_EXTRA="DB2_DB2_H"
elif test -f "$i/include/db.h" ; then
THIS_PREFIX="$i"
DB2_EXTRA="DB2_DB_H"
fi
done
if test "$DB2_EXTRA" = "db2" ; then
DBA_INCLUDE="$DBA_INCLUDE -I$THIS_PREFIX/db2"
DB2_EXTRA="DB2_DB_H"
fi
if test "$DB2_EXTRA" != ""; then
eval "AC_DEFINE($DB2_EXTRA, 1)"
fi
for LIB in db db2 c; do
AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, db_appinit, [AC_DEFINE(DBA_DB2,1) THIS_LIBS="$LIB"])
])
done
AC_DBA_STD_ASSIGN
AC_DBA_STD_CHECK
AC_DBA_STD_ATTACH
fi
])
AC_MSG_CHECKING(for DB2 support)
AC_DBA_STD_RESULT
AC_ARG_WITH(dbm,
[ --with-dbm[=DIR] Include DBM support],[
if test "$withval" != "no"; then
for i in /usr/local /usr $withval; do
if test -f "$i/include/dbm.h" ; then
THIS_PREFIX="$i"
fi
done
for LIB in db1 dbm c; do
AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, dbminit, [AC_DEFINE(DBA_DBM,1) THIS_LIBS="$LIB"])
])
done
AC_DBA_STD_ASSIGN
AC_DBA_STD_CHECK
AC_DBA_STD_ATTACH
fi
])
AC_MSG_CHECKING(for DBM support)
AC_DBA_STD_RESULT
AC_ARG_WITH(cdb,
[ --with-cdb[=DIR] Include CDB support],[
if test "$withval" != "no"; then
for i in /usr/local /usr $withval; do
if test -f "$i/include/cdb.h" ; then
THIS_PREFIX="$i"
fi
done
for LIB in cdb c; do
AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, cdb_bread, [AC_DEFINE(DBA_CDB,1) THIS_LIBS="$LIB"])
])
done
AC_DBA_STD_ASSIGN
AC_DBA_STD_CHECK
AC_DBA_STD_ATTACH
fi
])
AC_MSG_CHECKING(for CDB support)
AC_DBA_STD_RESULT
AC_MSG_CHECKING(whether to enable DBA interface)
if test "$HAVE_DBA" = "1"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBA, 1)
PHP_EXTENSION(dba)
else
AC_MSG_RESULT(no)
AC_DEFINE(HAVE_DBA, 0)
fi
+479
View File
@@ -0,0 +1,479 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann <sas@schell.de> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#if HAVE_DBA
#include "php3_dba.h"
#include "php3_gdbm.h"
#include "php3_ndbm.h"
#include "php3_dbm.h"
#include "php3_cdb.h"
#include "php3_db2.h"
function_entry dba_functions[] = {
PHP_FE(dba_open, NULL)
PHP_FE(dba_popen, NULL)
PHP_FE(dba_close, NULL)
PHP_FE(dba_delete, NULL)
PHP_FE(dba_exists, NULL)
PHP_FE(dba_fetch, NULL)
PHP_FE(dba_insert, NULL)
PHP_FE(dba_replace, NULL)
PHP_FE(dba_firstkey, NULL)
PHP_FE(dba_nextkey, NULL)
PHP_FE(dba_optimize, NULL)
PHP_FE(dba_sync, NULL)
{NULL,NULL,NULL}
};
static PHP_MINIT_FUNCTION(dba);
static PHP_MSHUTDOWN_FUNCTION(dba);
static PHP_MINFO_FUNCTION(dba);
php3_module_entry dba_module_entry = {
"DataBase API", dba_functions,
PHP_MINIT(dba),
PHP_MSHUTDOWN(dba),
NULL, NULL,
PHP_MINFO(dba),
STANDARD_MODULE_PROPERTIES
};
typedef struct dba_handler {
char *name;
int (*open)(dba_info *);
void (*close)(dba_info *);
char* (*fetch)(dba_info *, char *, int, int *);
int (*update)(dba_info *, char *, int, char *, int, int);
int (*exists)(dba_info *, char *, int);
int (*delete)(dba_info *, char *, int);
char* (*firstkey)(dba_info *, int *);
char* (*nextkey)(dba_info *, int *);
int (*optimize)(dba_info *);
int (*sync)(dba_info *);
} dba_handler;
/* {{{ macromania */
#define DBA_ID_PARS \
pval **id; \
dba_info *info = NULL; \
int type, ac = ARG_COUNT(ht)
/* these are used to get the standard arguments */
#define DBA_GET1 \
if(ac != 1 || getParametersEx(ac, &id) != SUCCESS) { \
WRONG_PARAM_COUNT; \
}
#define DBA_GET2 \
pval **key; \
if(ac != 2 || getParametersEx(ac, &key, &id) != SUCCESS) { \
WRONG_PARAM_COUNT; \
} \
convert_to_string_ex(key)
#define DBA_IF_NOT_CORRECT_TYPE(link_id) \
info = php3_list_find(link_id, &type); \
if(!info || (type != GLOBAL(le_db) && type != GLOBAL(le_pdb)))
#define DBA_ID_GET \
convert_to_long_ex(id); \
DBA_IF_NOT_CORRECT_TYPE((*id)->value.lval) { \
php_error(E_WARNING, "Unable to find DBA identifier %d", \
(*id)->value.lval); \
RETURN_FALSE; \
}
#define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET
#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET
/* a DBA handler must have specific routines */
#define DBA_HND(x) \
{\
#x, dba_open_##x, dba_close_##x, dba_fetch_##x, dba_update_##x, \
dba_exists_##x, dba_delete_##x, dba_firstkey_##x, dba_nextkey_##x, \
dba_optimize_##x, dba_sync_##x \
},
/* check whether the user has write access */
#define DBA_WRITE_CHECK \
if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
php_error(E_WARNING, "you cannot perform a modification to a database without proper access"); \
RETURN_FALSE; \
}
#define GLOBAL(a) a
/* }}} */
/* {{{ globals */
static dba_handler handler[] = {
#if DBA_GDBM
DBA_HND(gdbm)
#endif
#if DBA_DBM
DBA_HND(dbm)
#endif
#if DBA_NDBM
DBA_HND(ndbm)
#endif
#if DBA_CDB
DBA_HND(cdb)
#endif
#if DBA_DB2
DBA_HND(db2)
#endif
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
static int le_db;
static int le_pdb;
static HashTable ht_keys;
/* }}} */
/* {{{ helper routines */
/* {{{ dba_close */
static void dba_close(dba_info *info)
{
if(info->hnd) info->hnd->close(info);
if(info->path) free(info->path);
free(info);
}
/* }}} */
/* {{{ php3_minit_dba */
static PHP_MINIT_FUNCTION(dba)
{
zend_hash_init(&ht_keys, 0, NULL, NULL, 1);
GLOBAL(le_db) = register_list_destructors(dba_close, NULL);
GLOBAL(le_pdb) = register_list_destructors(NULL, dba_close);
return SUCCESS;
}
/* }}} */
/* {{{ php3_mshutdown_dba */
static PHP_MSHUTDOWN_FUNCTION(dba)
{
zend_hash_destroy(&ht_keys);
return SUCCESS;
}
/* }}} */
/* {{{ php3_info_dba */
static PHP_MINFO_FUNCTION(dba)
{
dba_handler *hptr;
PUTS("V1 ($Id$)");
for(hptr = handler; hptr->name; hptr++) {
PUTS(" ");
PUTS(hptr->name);
}
}
/* }}} */
/* {{{ _php3_dba_update */
static void _php3_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
DBA_ID_PARS;
pval **val, **key;
if(ac != 3 || getParametersEx(ac, &key, &val, &id) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(key);
convert_to_string_ex(val);
DBA_ID_GET;
DBA_WRITE_CHECK;
if(info->hnd->update(info, VALLEN(key), VALLEN(val), mode) == SUCCESS)
RETURN_TRUE;
RETURN_FALSE;
}
/* }}} */
/* {{{ _php3_dba_open */
#define FREENOW if(args) efree(args); if(key) efree(key)
static void _php3_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
pval ***args = (pval ***) NULL;
int ac = ARG_COUNT(ht);
dba_mode_t modenr;
dba_info *info;
dba_handler *hptr;
char *key = NULL;
int keylen = 0;
int listid;
int i;
if(ac < 3) {
WRONG_PARAM_COUNT;
}
/* we pass additional args to the respective handler */
args = emalloc(ac * sizeof(pval *));
if(getParametersArrayEx(ac, args) != SUCCESS) {
FREENOW;
WRONG_PARAM_COUNT;
}
/* we only take string arguments */
for(i = 0; i < ac; i++) {
convert_to_string_ex(args[i]);
keylen += (*args[i])->value.str.len;
}
if(persistent) {
/* calculate hash */
key = emalloc(keylen);
keylen = 0;
for(i = 0; i < ac; i++) {
memcpy(key+keylen,(*args[i])->value.str.val,(*args[i])->value.str.len);
keylen += (*args[i])->value.str.len;
}
if(zend_hash_find(&ht_keys, key, keylen, (void **) &info) == SUCCESS) {
FREENOW;
RETURN_LONG(php3_list_insert(info, GLOBAL(le_pdb)));
}
}
for(hptr = handler; hptr->name &&
strcasecmp(hptr->name, (*args[2])->value.str.val); hptr++);
if(!hptr->name) {
php_error(E_WARNING, "no such handler: %s", (*args[2])->value.str.val);
FREENOW;
RETURN_FALSE;
}
switch((*args[1])->value.str.val[0]) {
case 'c':
modenr = DBA_CREAT;
break;
case 'w':
modenr = DBA_WRITER;
break;
case 'r':
modenr = DBA_READER;
break;
case 'n':
modenr = DBA_TRUNC;
break;
default:
php_error(E_WARNING,"illegal DBA mode: %s",(*args[1])->value.str.val);
FREENOW;
RETURN_FALSE;
}
info = malloc(sizeof(*info));
memset(info, 0, sizeof(info));
info->path = strdup((*args[0])->value.str.val);
info->mode = modenr;
info->argc = ac - 3;
info->argv = args + 3;
info->hnd = NULL;
if(hptr->open(info) != SUCCESS) {
dba_close(info);
php_error(E_WARNING, "driver initialization failed");
FREENOW;
RETURN_FALSE;
}
info->hnd = hptr;
info->argc = 0;
info->argv = NULL;
listid = php3_list_insert(info, persistent?GLOBAL(le_pdb):GLOBAL(le_db));
if(persistent) {
zend_hash_update(&ht_keys, key, keylen, info, sizeof(*info), NULL);
}
FREENOW;
RETURN_LONG(listid);
}
#undef FREENOW
/* }}} */
/* }}} */
/* {{{ proto int dba_popen(string path, string mode, string handlername[, ...])
opens path using the specified handler in mode persistently */
PHP_FUNCTION(dba_popen)
{
_php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* {{{ proto int dba_open(string path, string mode, string handlername[, ...])
opens path using the specified handler in mode*/
PHP_FUNCTION(dba_open)
{
_php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto void dba_close(int handle)
closes database */
PHP_FUNCTION(dba_close)
{
DBA_ID_GET1;
php3_list_delete((*id)->value.lval);
}
/* }}} */
/* {{{ proto bool dba_exists(string key, int handle)
checks, if the specified key exists */
PHP_FUNCTION(dba_exists)
{
DBA_ID_GET2;
if(info->hnd->exists(info, VALLEN(key)) == SUCCESS) {
RETURN_TRUE;
}
RETURN_FALSE;
}
/* }}} */
/* {{{ proto string dba_fetch(string key, int handle)
fetches the data associated with key */
PHP_FUNCTION(dba_fetch)
{
char *val;
int len = 0;
DBA_ID_GET2;
if((val = info->hnd->fetch(info, VALLEN(key), &len)) != NULL) {
RETURN_STRINGL(val, len, 0);
}
RETURN_FALSE;
}
/* }}} */
/* {{{ proto string dba_firstkey(int handle)
resets the internal key pointer and returns the first key */
PHP_FUNCTION(dba_firstkey)
{
char *fkey;
int len;
DBA_ID_GET1;
fkey = info->hnd->firstkey(info, &len);
if(fkey)
RETURN_STRINGL(fkey, len, 0);
RETURN_FALSE;
}
/* }}} */
/* {{{ proto string dba_nextkey(int handle)
returns the next key */
PHP_FUNCTION(dba_nextkey)
{
char *nkey;
int len;
DBA_ID_GET1;
nkey = info->hnd->nextkey(info, &len);
if(nkey)
RETURN_STRINGL(nkey, len, 0);
RETURN_FALSE;
}
/* }}} */
/* {{{ proto bool dba_delete(string key, int handle)
deletes the entry associated with key */
PHP_FUNCTION(dba_delete)
{
DBA_ID_GET2;
DBA_WRITE_CHECK;
if(info->hnd->delete(info, VALLEN(key)) == SUCCESS)
RETURN_TRUE;
RETURN_FALSE;
}
/* }}} */
/* {{{ proto bool dba_insert(string key, string value, int handle)
inserts value as key, returns false, if key exists already */
PHP_FUNCTION(dba_insert)
{
_php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* {{{ proto bool dba_replace(string key, string value, int handle)
inserts value as key, replaces key, if key exists already */
PHP_FUNCTION(dba_replace)
{
_php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto bool dba_optimize(int handle)
optimizes (e.g. clean up, vacuum) database */
PHP_FUNCTION(dba_optimize)
{
DBA_ID_GET1;
DBA_WRITE_CHECK;
if(info->hnd->optimize(info) == SUCCESS) {
RETURN_TRUE;
}
RETURN_FALSE;
}
/* }}} */
/* {{{ proto bool dba_sync(int handle)
synchronizes database */
PHP_FUNCTION(dba_sync)
{
DBA_ID_GET1;
if(info->hnd->sync(info) == SUCCESS) {
RETURN_TRUE;
}
RETURN_FALSE;
}
/* }}} */
#endif
+220
View File
@@ -0,0 +1,220 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann <sas@schell.de> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#if DBA_CDB
#include "php3_cdb.h"
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <cdb.h>
#include <cdbmake.h>
#define CDB_INFO \
dba_cdb *cdb = (dba_cdb *) info->dbf
typedef struct {
int fd;
uint32 eod; /* size of constant database */
uint32 pos; /* current position for traversing */
} dba_cdb;
DBA_OPEN_FUNC(cdb)
{
int gmode = 0;
dba_cdb *cdb;
dba_info *pinfo = (dba_info *) info;
switch(info->mode) {
case DBA_READER:
gmode = O_RDONLY; break;
/* currently not supported: */
#if 0
case DBA_WRITER:
gmode = O_RDWR; break;
#endif
default:
return FAILURE;
}
cdb = malloc(sizeof *cdb);
memset(cdb, 0, sizeof *cdb);
cdb->fd = open(info->path, gmode);
if(cdb->fd < 0) {
free(cdb);
return FAILURE;
}
pinfo->dbf = cdb;
return SUCCESS;
}
DBA_CLOSE_FUNC(cdb)
{
CDB_INFO;
close(cdb->fd);
free(cdb);
}
DBA_FETCH_FUNC(cdb)
{
CDB_INFO;
int len;
char *new = NULL;
if(cdb_seek(cdb->fd, key, keylen, &len) == 1) {
new = emalloc(len);
read(cdb->fd, new, len);
if(newlen) *newlen = len;
}
return new;
}
DBA_UPDATE_FUNC(cdb)
{
/* if anyone figures out cdbmake.c, let me know */
return FAILURE;
}
DBA_EXISTS_FUNC(cdb)
{
CDB_INFO;
int len;
if(cdb_seek(cdb->fd, key, keylen, &len) == 1)
return SUCCESS;
return FAILURE;
}
DBA_DELETE_FUNC(cdb)
{
return FAILURE;
}
#define CREAD(n) if(read(cdb->fd, buf, n) < n) return NULL
#define CSEEK(n) \
if(n >= cdb->eod) return NULL; \
if(lseek(cdb->fd, (off_t)n, SEEK_SET) != (off_t) n) return NULL
DBA_FIRSTKEY_FUNC(cdb)
{
CDB_INFO;
uint32 len;
char buf[8];
char *key;
cdb->eod = -1;
CSEEK(0);
CREAD(4);
cdb->eod = cdb_unpack(buf);
CSEEK(2048);
CREAD(8);
len = cdb_unpack(buf);
key = emalloc(len + 1);
if(read(cdb->fd, key, len) < len) {
efree(key);
key = NULL;
} else
key[len] = '\0';
/* header + klenlen + dlenlen + klen + dlen */
cdb->pos = 2048 + 4 + 4 + len + cdb_unpack(buf + 4);
return key;
}
DBA_NEXTKEY_FUNC(cdb)
{
CDB_INFO;
uint32 len;
char buf[8];
char *nkey;
CSEEK(cdb->pos);
CREAD(8);
len = cdb_unpack(buf);
nkey = emalloc(len + 1);
if(read(cdb->fd, nkey, len) < len) {
efree(nkey);
return NULL;
}
nkey[len] = '\0';
if(newlen) *newlen = len;
cdb->pos += 8 + len + cdb_unpack(buf + 4);
return nkey;
#if 0
/* this code cdb_seeks and is thus slower than directly seeking
in the file */
CDB_INFO;
char *nkey = NULL;
uint32 len;
char buf[8];
if(cdb_seek(cdb->fd, key, keylen, &len) == 1) {
if(lseek(cdb->fd, (off_t) len, SEEK_CUR) >= (off_t) cdb->eod)
return NULL;
CREAD(8);
len = cdb_unpack(buf);
nkey = emalloc(len + 1);
if(read(cdb->fd, nkey, len) < len) {
efree(nkey);
nkey = NULL;
} else
nkey[len] = '\0';
}
return nkey;
#endif
}
DBA_OPTIMIZE_FUNC(cdb)
{
return SUCCESS;
}
DBA_SYNC_FUNC(cdb)
{
/* this is read-only */
return SUCCESS;
}
#endif
+207
View File
@@ -0,0 +1,207 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann <sas@schell.de> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#if DBA_DB2
#include "php3_db2.h"
#include <sys/stat.h>
#include <string.h>
#if DB2_DB2_DB_H
#include <db2/db.h>
#elif DB2_DB_DB2_H
#include <db/db2.h>
#elif DB2_DB2_H
#include <db2.h>
#elif DB2_DB_H
#include <db.h>
#endif
#define DB2_DATA dba_db2_data *dba = info->dbf
#define DB2_GKEY \
DBT gkey; \
memset(&gkey, 0, sizeof(gkey)); \
gkey.data = (char *) key; gkey.size = keylen
typedef struct {
DB *dbp;
DBC *cursor;
} dba_db2_data;
DBA_OPEN_FUNC(db2)
{
DB *dbp;
DBTYPE type;
int gmode = 0;
int filemode = 0644;
struct stat check_stat;
type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
stat(info->path, &check_stat) ? DB_BTREE : DB_UNKNOWN;
gmode = info->mode == DBA_READER ? DB_RDONLY :
info->mode == DBA_CREAT ? DB_CREATE :
info->mode == DBA_WRITER ? 0 :
info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
if(gmode == -1)
return FAILURE;
if(info->argc > 0) {
convert_to_long_ex(info->argv[0]);
filemode = (*info->argv[0])->value.lval;
}
if(!db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) {
info->dbf = malloc(sizeof(dba_db2_data));
memset(info->dbf, 0, sizeof(dba_db2_data));
((dba_db2_data *) info->dbf)->dbp = dbp;
return SUCCESS;
}
return FAILURE;
}
DBA_CLOSE_FUNC(db2)
{
DB2_DATA;
if(dba->cursor) dba->cursor->c_close(dba->cursor);
dba->dbp->close(dba->dbp, 0);
free(dba);
}
DBA_FETCH_FUNC(db2)
{
DBT gval;
char *new = NULL;
DB2_DATA;
DB2_GKEY;
memset(&gval, 0, sizeof(gval));
if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
if(newlen) *newlen = gval.size;
new = estrndup(gval.data, gval.size);
}
return new;
}
DBA_UPDATE_FUNC(db2)
{
DBT gval;
DB2_DATA;
DB2_GKEY;
memset(&gval, 0, sizeof(gval));
gval.data = (char *) val;
gval.size = vallen;
if(!dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
mode == 1 ? DB_NOOVERWRITE : 0)) {
return SUCCESS;
}
return FAILURE;
}
DBA_EXISTS_FUNC(db2)
{
DBT gval;
DB2_DATA;
DB2_GKEY;
memset(&gval, 0, sizeof(gval));
if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
return SUCCESS;
}
return FAILURE;
}
DBA_DELETE_FUNC(db2)
{
DB2_DATA;
DB2_GKEY;
return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS;
}
DBA_FIRSTKEY_FUNC(db2)
{
DB2_DATA;
if(dba->cursor) {
dba->cursor->c_close(dba->cursor);
}
dba->cursor = NULL;
#if (DB_VERSION_MAJOR > 2) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR > 6) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 6 && DB_VERSION_PATCH >= 4)
if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0)) {
#else
if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor)) {
#endif
return NULL;
}
/* we should introduce something like PARAM_PASSTHRU... */
return dba_nextkey_db2(info, newlen);
}
DBA_NEXTKEY_FUNC(db2)
{
DB2_DATA;
DBT gkey, gval;
char *nkey = NULL;
memset(&gkey, 0, sizeof(gkey));
memset(&gval, 0, sizeof(gval));
if(!dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT)) {
if(gkey.data) {
nkey = estrndup(gkey.data, gkey.size);
if(newlen) *newlen = gkey.size;
}
}
return nkey;
}
DBA_OPTIMIZE_FUNC(db2)
{
return SUCCESS;
}
DBA_SYNC_FUNC(db2)
{
DB2_DATA;
return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
}
#endif
+190
View File
@@ -0,0 +1,190 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann <sas@schell.de> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#if DBA_DBM
#include "php3_dbm.h"
#include <dbm.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define DBM_DATA dba_dbm_data *dba = info->dbf
#define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
#define TRUNC_IT(extension, mode) \
snprintf(buf, PATH_MAX, "%s" extension, info->path); \
buf[PATH_MAX] = '\0'; \
if((fd = open(buf, O_CREAT | mode | O_WRONLY, filemode)) == -1) \
return FAILURE; \
close(fd);
typedef struct {
datum nextkey;
} dba_dbm_data;
DBA_OPEN_FUNC(dbm)
{
int fd;
int filemode = 0644;
if(info->argc > 0) {
convert_to_long_ex(info->argv[0]);
filemode = (*info->argv[0])->value.lval;
}
if(info->mode == DBA_TRUNC) {
char buf[PATH_MAX + 1];
/* dbm/ndbm original */
TRUNC_IT(".pag", O_TRUNC);
TRUNC_IT(".dir", O_TRUNC);
}
if(info->mode == DBA_CREAT) {
char buf[PATH_MAX + 1];
TRUNC_IT(".pag", 0);
TRUNC_IT(".dir", 0);
}
if(dbminit((char *) info->path) == -1) {
return FAILURE;
}
info->dbf = calloc(sizeof(dba_dbm_data), 1);
return SUCCESS;
}
DBA_CLOSE_FUNC(dbm)
{
free(info->dbf);
dbmclose();
}
DBA_FETCH_FUNC(dbm)
{
datum gval;
char *new = NULL;
DBM_GKEY;
gval = fetch(gkey);
if(gval.dptr) {
if(newlen) *newlen = gval.dsize;
new = estrndup(gval.dptr, gval.dsize);
}
return new;
}
DBA_UPDATE_FUNC(dbm)
{
datum gval;
DBM_GKEY;
gval.dptr = (char *) val;
gval.dsize = vallen;
return (store(gkey, gval) == -1 ? FAILURE : SUCCESS);
}
DBA_EXISTS_FUNC(dbm)
{
datum gval;
DBM_GKEY;
gval = fetch(gkey);
if(gval.dptr) {
return SUCCESS;
}
return FAILURE;
}
DBA_DELETE_FUNC(dbm)
{
DBM_GKEY;
return(delete(gkey) == -1 ? FAILURE : SUCCESS);
}
DBA_FIRSTKEY_FUNC(dbm)
{
DBM_DATA;
datum gkey;
char *key = NULL;
gkey = firstkey();
if(gkey.dptr) {
if(newlen) *newlen = gkey.dsize;
key = estrndup(gkey.dptr, gkey.dsize);
dba->nextkey = gkey;
} else
dba->nextkey.dptr = NULL;
return key;
}
DBA_NEXTKEY_FUNC(dbm)
{
DBM_DATA;
datum gkey;
char *nkey = NULL;
if(!dba->nextkey.dptr) return NULL;
gkey = nextkey(dba->nextkey);
if(gkey.dptr) {
if(newlen) *newlen = gkey.dsize;
nkey = estrndup(gkey.dptr, gkey.dsize);
dba->nextkey = gkey;
} else
dba->nextkey.dptr = NULL;
return nkey;
}
DBA_OPTIMIZE_FUNC(dbm)
{
/* dummy */
return SUCCESS;
}
DBA_SYNC_FUNC(dbm)
{
return SUCCESS;
}
#endif
+189
View File
@@ -0,0 +1,189 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann <sas@schell.de> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#if DBA_GDBM
#include "php3_gdbm.h"
#include <gdbm.h>
#define GDBM_DATA dba_gdbm_data *dba = info->dbf
#define GDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
typedef struct {
GDBM_FILE dbf;
datum nextkey;
} dba_gdbm_data;
DBA_OPEN_FUNC(gdbm)
{
GDBM_FILE dbf;
int gmode = 0;
int filemode = 0644;
gmode = info->mode == DBA_READER ? GDBM_READER :
info->mode == DBA_WRITER ? GDBM_WRITER :
info->mode == DBA_CREAT ? GDBM_WRCREAT :
info->mode == DBA_TRUNC ? GDBM_NEWDB : -1;
if(gmode == -1)
return FAILURE;
if(info->argc > 0) {
convert_to_long_ex(info->argv[0]);
filemode = (*info->argv[0])->value.lval;
}
dbf = gdbm_open(info->path, 0, gmode, filemode, NULL);
if(dbf) {
info->dbf = malloc(sizeof(dba_gdbm_data));
memset(info->dbf, 0, sizeof(dba_gdbm_data));
((dba_gdbm_data *) info->dbf)->dbf = dbf;
return SUCCESS;
}
return FAILURE;
}
DBA_CLOSE_FUNC(gdbm)
{
GDBM_DATA;
if(dba->nextkey.dptr) free(dba->nextkey.dptr);
gdbm_close(dba->dbf);
free(dba);
}
DBA_FETCH_FUNC(gdbm)
{
GDBM_DATA;
datum gval;
char *new = NULL;
GDBM_GKEY;
gval = gdbm_fetch(dba->dbf, gkey);
if(gval.dptr) {
if(newlen) *newlen = gval.dsize;
new = estrndup(gval.dptr, gval.dsize);
free(gval.dptr);
}
return new;
}
DBA_UPDATE_FUNC(gdbm)
{
datum gval;
GDBM_DATA;
GDBM_GKEY;
gval.dptr = (char *) val;
gval.dsize = vallen;
if(gdbm_store(dba->dbf, gkey, gval,
mode == 1 ? GDBM_INSERT : GDBM_REPLACE) == 0)
return SUCCESS;
printf("XXX %s\n", gdbm_strerror(gdbm_errno));
return FAILURE;
}
DBA_EXISTS_FUNC(gdbm)
{
GDBM_DATA;
GDBM_GKEY;
return gdbm_exists(dba->dbf, gkey) ? SUCCESS : FAILURE;
}
DBA_DELETE_FUNC(gdbm)
{
GDBM_DATA;
GDBM_GKEY;
return gdbm_delete(dba->dbf, gkey) == -1 ? FAILURE : SUCCESS;
}
DBA_FIRSTKEY_FUNC(gdbm)
{
GDBM_DATA;
datum gkey;
char *key = NULL;
if(dba->nextkey.dptr) {
free(dba->nextkey.dptr);
}
gkey = gdbm_firstkey(dba->dbf);
if(gkey.dptr) {
key = estrndup(gkey.dptr, gkey.dsize);
if(newlen) *newlen = gkey.dsize;
dba->nextkey = gkey;
} else {
dba->nextkey.dptr = NULL;
}
return key;
}
DBA_NEXTKEY_FUNC(gdbm)
{
GDBM_DATA;
char *nkey = NULL;
datum gkey;
if(!dba->nextkey.dptr) return NULL;
gkey = gdbm_nextkey(dba->dbf, dba->nextkey);
free(dba->nextkey.dptr);
if(gkey.dptr) {
nkey = estrndup(gkey.dptr, gkey.dsize);
if(newlen) *newlen = gkey.dsize;
dba->nextkey = gkey;
} else {
dba->nextkey.dptr = NULL;
}
return nkey;
}
DBA_OPTIMIZE_FUNC(gdbm)
{
GDBM_DATA;
gdbm_reorganize(dba->dbf);
return SUCCESS;
}
DBA_SYNC_FUNC(gdbm)
{
GDBM_DATA;
gdbm_sync(dba->dbf);
return SUCCESS;
}
#endif
+169
View File
@@ -0,0 +1,169 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann <sas@schell.de> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#if DBA_NDBM
#include "php3_ndbm.h"
#include <fcntl.h>
#if NDBM_DB1_NDBM_H
#include <db1/ndbm.h>
#elif NDBM_NDBM_H
#include <ndbm.h>
#endif
#define NDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
DBA_OPEN_FUNC(ndbm)
{
DBM *dbf;
int gmode = 0;
int filemode = 0644;
dba_info *pinfo = (dba_info *) info;
switch(info->mode) {
case DBA_READER:
gmode = O_RDONLY;
break;
case DBA_WRITER:
gmode = O_RDWR;
break;
case DBA_CREAT:
gmode = O_RDWR | O_CREAT;
break;
case DBA_TRUNC:
gmode = O_RDWR | O_CREAT | O_TRUNC;
break;
default:
return FAILURE;
}
if(info->argc > 0) {
convert_to_long_ex(info->argv[0]);
filemode = (*info->argv[0])->value.lval;
}
dbf = dbm_open(info->path, gmode, filemode);
if(dbf) {
pinfo->dbf = dbf;
return SUCCESS;
}
return FAILURE;
}
DBA_CLOSE_FUNC(ndbm)
{
dbm_close(info->dbf);
}
DBA_FETCH_FUNC(ndbm)
{
datum gval;
char *new = NULL;
NDBM_GKEY;
gval = dbm_fetch(info->dbf, gkey);
if(gval.dptr) {
if(newlen) *newlen = gval.dsize;
new = estrndup(gval.dptr, gval.dsize);
}
return new;
}
DBA_UPDATE_FUNC(ndbm)
{
datum gval;
NDBM_GKEY;
gval.dptr = (char *) val;
gval.dsize = vallen;
if(!dbm_store(info->dbf, gkey, gval, mode == 1 ? DBM_INSERT : DBM_REPLACE))
return SUCCESS;
return FAILURE;
}
DBA_EXISTS_FUNC(ndbm)
{
datum gval;
NDBM_GKEY;
gval = dbm_fetch(info->dbf, gkey);
if(gval.dptr) {
return SUCCESS;
}
return FAILURE;
}
DBA_DELETE_FUNC(ndbm)
{
NDBM_GKEY;
return(dbm_delete(info->dbf, gkey) == -1 ? FAILURE : SUCCESS);
}
DBA_FIRSTKEY_FUNC(ndbm)
{
datum gkey;
char *key = NULL;
gkey = dbm_firstkey(info->dbf);
if(gkey.dptr) {
if(newlen) *newlen = gkey.dsize;
key = estrndup(gkey.dptr, gkey.dsize);
}
return key;
}
DBA_NEXTKEY_FUNC(ndbm)
{
datum gkey;
char *nkey = NULL;
gkey = dbm_nextkey(info->dbf);
if(gkey.dptr) {
if(newlen) *newlen = gkey.dsize;
nkey = estrndup(gkey.dptr, gkey.dsize);
}
return nkey;
}
DBA_OPTIMIZE_FUNC(ndbm)
{
return SUCCESS;
}
DBA_SYNC_FUNC(ndbm)
{
return SUCCESS;
}
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef _PHP3_CDB_H
#define _PHP3_CDB_H
#if DBA_CDB
#include "php3_dba.h"
DBA_FUNCS(cdb);
#endif
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef _PHP3_DB2_H
#define _PHP3_DB2_H
#if DBA_DB2
#include "php3_dba.h"
DBA_FUNCS(db2);
#endif
#endif
+115
View File
@@ -0,0 +1,115 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann <sas@schell.de> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _DBA_H
#define _DBA_H
#if HAVE_DBA
typedef enum {
DBA_READER = 1,
DBA_WRITER,
DBA_TRUNC,
DBA_CREAT
} dba_mode_t;
typedef struct dba_info {
/* public */
void *dbf; /* ptr to private data or whatever */
char *path;
dba_mode_t mode;
/* arg[cv] are only available when the dba_open handler is called! */
int argc;
pval ***argv;
/* private */
struct dba_handler *hnd;
} dba_info;
extern php3_module_entry dba_module_entry;
#define dba_module_ptr &dba_module_entry
/* common prototypes which must be supplied by modules */
#define DBA_OPEN_FUNC(x) \
int dba_open_##x(dba_info *info)
#define DBA_CLOSE_FUNC(x) \
void dba_close_##x(dba_info *info)
#define DBA_FETCH_FUNC(x) \
char *dba_fetch_##x(dba_info *info, char *key, int keylen, int *newlen)
#define DBA_UPDATE_FUNC(x) \
int dba_update_##x(dba_info *info, char *key, int keylen, char *val, int vallen, int mode)
#define DBA_EXISTS_FUNC(x) \
int dba_exists_##x(dba_info *info, char *key, int keylen)
#define DBA_DELETE_FUNC(x) \
int dba_delete_##x(dba_info *info, char *key, int keylen)
#define DBA_FIRSTKEY_FUNC(x) \
char *dba_firstkey_##x(dba_info *info, int *newlen)
#define DBA_NEXTKEY_FUNC(x) \
char *dba_nextkey_##x(dba_info *info, int *newlen)
#define DBA_OPTIMIZE_FUNC(x) \
int dba_optimize_##x(dba_info *info)
#define DBA_SYNC_FUNC(x) \
int dba_sync_##x(dba_info *info)
#define DBA_FUNCS(x) \
DBA_OPEN_FUNC(x); \
DBA_CLOSE_FUNC(x); \
DBA_FETCH_FUNC(x); \
DBA_UPDATE_FUNC(x); \
DBA_DELETE_FUNC(x); \
DBA_EXISTS_FUNC(x); \
DBA_FIRSTKEY_FUNC(x); \
DBA_NEXTKEY_FUNC(x); \
DBA_OPTIMIZE_FUNC(x); \
DBA_SYNC_FUNC(x)
#define VALLEN(p) (*p)->value.str.val, (*p)->value.str.len
PHP_FUNCTION(dba_open);
PHP_FUNCTION(dba_popen);
PHP_FUNCTION(dba_close);
PHP_FUNCTION(dba_firstkey);
PHP_FUNCTION(dba_nextkey);
PHP_FUNCTION(dba_replace);
PHP_FUNCTION(dba_insert);
PHP_FUNCTION(dba_delete);
PHP_FUNCTION(dba_exists);
PHP_FUNCTION(dba_fetch);
PHP_FUNCTION(dba_optimize);
PHP_FUNCTION(dba_sync);
#else
#define dba_module_ptr NULL
#endif
#define phpext_dba_ptr dba_module_ptr
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef _PHP3_DBM_H
#define _PHP3_DBM_H
#if DBA_DBM
#include "php3_dba.h"
DBA_FUNCS(dbm);
#endif
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef _PHP3_GDBM_H
#define _PHP3_GDBM_H
#if DBA_GDBM
#include "php3_dba.h"
DBA_FUNCS(gdbm);
#endif
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef _PHP3_NDBM_H
#define _PHP3_NDBM_H
#if DBA_NDBM
#include "php3_dba.h"
DBA_FUNCS(ndbm);
#endif
#endif
+6
View File
@@ -0,0 +1,6 @@
# $Source$
# $Id$
define_option with-dba 'dba support?' yesnodir no \
' Whether to build the dba extension.'
+5
View File
@@ -0,0 +1,5 @@
## Process this file with automake to produce Makefile.in -*- makefile -*-
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_dbase.a
libphpext_dbase_a_SOURCES=dbf_head.c dbf_rec.c dbf_misc.c dbf_ndx.c dbase.c
+3
View File
@@ -0,0 +1,3 @@
/* Define if you want to use the supplied dbase library */
#define DBASE 0
+21
View File
@@ -0,0 +1,21 @@
dnl $Id$
AC_MSG_CHECKING(whether to include the bundled dbase library)
AC_ARG_WITH(dbase,
[ --with-dbase Include the bundled dbase library],
[
if test "$withval" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(DBASE,1)
PHP_EXTENSION(dbase)
else
AC_MSG_RESULT(no)
AC_DEFINE(DBASE,0)
DBASE_LIB=
fi
],[
AC_MSG_RESULT(no)
AC_DEFINE(DBASE,0)
DBASE_LIB=
])
AC_SUBST(DBASE_LIB)
+752
View File
@@ -0,0 +1,752 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 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_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
#if defined(COMPILE_DL)
#include "dl/phpdl.h"
#endif
#include <stdlib.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "php.h"
#include "safe_mode.h"
#include "fopen-wrappers.h"
#include "php_globals.h"
#if DBASE
#include "php_dbase.h"
#include "dbf.h"
#if defined(THREAD_SAFE)
DWORD DbaseTls;
static int numthreads=0;
void *dbase_mutex;
typedef struct dbase_global_struct{
int le_dbhead;
}dbase_global_struct;
#define DBase_GLOBAL(a) dbase_globals->a
#define DBase_TLS_VARS \
dbase_global_struct *dbase_globals; \
dbase_globals=TlsGetValue(DbaseTls);
#else
static int le_dbhead;
#define DBase_GLOBAL(a) a
#define DBase_TLS_VARS
#endif
#include <fcntl.h>
#include <errno.h>
static void _close_dbase(dbhead_t *dbhead)
{
close(dbhead->db_fd);
free_dbf_head(dbhead);
}
PHP_MINIT_FUNCTION(dbase)
{
#if defined(THREAD_SAFE)
dbase_global_struct *dbase_globals;
#if !defined(COMPILE_DL)
CREATE_MUTEX(dbase_mutex,"DBase_TLS");
SET_MUTEX(dbase_mutex);
numthreads++;
if (numthreads==1){
if ((DbaseTls=TlsAlloc())==0xFFFFFFFF){
FREE_MUTEX(dbase_mutex);
return 0;
}}
FREE_MUTEX(dbase_mutex);
#endif
dbase_globals = (dbase_global_struct *) LocalAlloc(LPTR, sizeof(dbase_global_struct));
TlsSetValue(DbaseTls, (void *) dbase_globals);
#endif
DBase_GLOBAL(le_dbhead) = register_list_destructors(_close_dbase,NULL);
return SUCCESS;
}
static PHP_MSHUTDOWN_FUNCTION(dbase)
{
#if defined(THREAD_SAFE)
dbase_global_struct *dbase_globals;
dbase_globals = TlsGetValue(DbaseTls);
if (dbase_globals != 0)
LocalFree((HLOCAL) dbase_globals);
#if !defined(COMPILE_DL)
SET_MUTEX(dbase_mutex);
numthreads--;
if (!numthreads){
if (!TlsFree(DbaseTls)){
FREE_MUTEX(dbase_mutex);
return 0;
}}
FREE_MUTEX(dbase_mutex);
#endif
#endif
return SUCCESS;
}
/* {{{ proto int dbase_open(string name, int mode)
Opens a dBase-format database file */
PHP_FUNCTION(dbase_open) {
pval *dbf_name, *options;
dbhead_t *dbh;
int handle;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbf_name,&options)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(dbf_name);
convert_to_long(options);
if (PG(safe_mode) && (!_php3_checkuid(dbf_name->value.str.val, 2))) {
RETURN_FALSE;
}
if (_php3_check_open_basedir(dbf_name->value.str.val)) {
RETURN_FALSE;
}
dbh = dbf_open(dbf_name->value.str.val, options->value.lval);
if (dbh == NULL) {
php_error(E_WARNING, "unable to open database %s", dbf_name->value.str.val);
RETURN_FALSE;
}
handle = php3_list_insert(dbh, DBase_GLOBAL(le_dbhead));
RETURN_LONG(handle);
}
/* }}} */
/* {{{ proto bool dbase_close(int identifier)
Closes an open dBase-format database file */
PHP_FUNCTION(dbase_close) {
pval *dbh_id;
dbhead_t *dbh;
int dbh_type;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
php3_list_delete(dbh_id->value.lval);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int dbase_numrecords(int identifier)
Returns the number of records in the database */
PHP_FUNCTION(dbase_numrecords) {
pval *dbh_id;
dbhead_t *dbh;
int dbh_type;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
RETURN_LONG(dbh->db_records);
}
/* }}} */
/* {{{ proto int dbase_numfields(int identifier)
Returns the number of fields (columns) in the database */
PHP_FUNCTION(dbase_numfields) {
pval *dbh_id;
dbhead_t *dbh;
int dbh_type;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
RETURN_LONG(dbh->db_nfields);
}
/* }}} */
/* {{{ proto bool dbase_pack(int identifier)
Packs the database (deletes records marked for deletion) */
PHP_FUNCTION(dbase_pack) {
pval *dbh_id;
dbhead_t *dbh;
int dbh_type;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
pack_dbf(dbh);
put_dbf_info(dbh);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool dbase_add_record(int identifier, array data)
Adds a record to the database */
PHP_FUNCTION(dbase_add_record) {
pval *dbh_id, *fields, *field;
dbhead_t *dbh;
int dbh_type;
int num_fields;
dbfield_t *dbf, *cur_f;
char *cp, *t_cp;
int i;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&fields)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
if (fields->type != IS_ARRAY) {
php_error(E_WARNING, "Expected array as second parameter");
RETURN_FALSE;
}
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
num_fields = zend_hash_num_elements(fields->value.ht);
if (num_fields != dbh->db_nfields) {
php_error(E_WARNING, "Wrong number of fields specified");
RETURN_FALSE;
}
cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
if (!cp) {
php_error(E_WARNING, "unable to allocate memory");
RETURN_FALSE;
}
*t_cp++ = VALID_RECORD;
dbf = dbh->db_fields;
for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
php_error(E_WARNING, "unexpected error");
efree(cp);
RETURN_FALSE;
}
convert_to_string(field);
sprintf(t_cp, cur_f->db_format, field->value.str.val);
t_cp += cur_f->db_flen;
}
dbh->db_records++;
if (put_dbf_record(dbh, dbh->db_records, cp) < 0) {
php_error(E_WARNING, "unable to put record at %ld", dbh->db_records);
efree(cp);
RETURN_FALSE;
}
put_dbf_info(dbh);
efree(cp);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool dbase_replace_record(int identifier, array data, int recnum)
Replaces a record to the database */
void php3_dbase_replace_record(INTERNAL_FUNCTION_PARAMETERS) {
pval *dbh_id, *fields, *field, *recnum;
dbhead_t *dbh;
int dbh_type;
int num_fields;
dbfield_t *dbf, *cur_f;
char *cp, *t_cp;
int i;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht,3,&dbh_id,&fields,&recnum)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
convert_to_long(recnum);
if (fields->type != IS_ARRAY) {
php_error(E_WARNING, "Expected array as second parameter");
RETURN_FALSE;
}
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
num_fields = zend_hash_num_elements(fields->value.ht);
if (num_fields != dbh->db_nfields) {
php_error(E_WARNING, "Wrong number of fields specified");
RETURN_FALSE;
}
cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
if (!cp) {
php_error(E_WARNING, "unable to allocate memory");
RETURN_FALSE;
}
*t_cp++ = VALID_RECORD;
dbf = dbh->db_fields;
for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
php_error(E_WARNING, "unexpected error");
efree(cp);
RETURN_FALSE;
}
convert_to_string(field);
sprintf(t_cp, cur_f->db_format, field->value.str.val);
t_cp += cur_f->db_flen;
}
if (put_dbf_record(dbh, recnum->value.lval, cp) < 0) {
php_error(E_WARNING, "unable to put record at %ld", dbh->db_records);
efree(cp);
RETURN_FALSE;
}
put_dbf_info(dbh);
efree(cp);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool dbase_delete_record(int identifier, int record)
Marks a record to be deleted */
PHP_FUNCTION(dbase_delete_record) {
pval *dbh_id, *record;
dbhead_t *dbh;
int dbh_type;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
convert_to_long(record);
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
if (del_dbf_record(dbh, record->value.lval) < 0) {
if (record->value.lval > dbh->db_records) {
php_error(E_WARNING, "record %d out of bounds", record->value.lval);
} else {
php_error(E_WARNING, "unable to delete record %d", record->value.lval);
}
RETURN_FALSE;
}
put_dbf_info(dbh);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto array dbase_get_record(int identifier, int record)
Returns an array representing a record from the database */
PHP_FUNCTION(dbase_get_record) {
pval *dbh_id, *record;
dbhead_t *dbh;
int dbh_type;
dbfield_t *dbf, *cur_f;
char *data, *fnp, *str_value;
size_t cursize = 0;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
convert_to_long(record);
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) {
php_error(E_WARNING, "Tried to read bad record %d", record->value.lval);
RETURN_FALSE;
}
dbf = dbh->db_fields;
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
fnp = NULL;
for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
/* get the value */
str_value = (char *)emalloc(cur_f->db_flen + 1);
if(cursize <= cur_f->db_flen) {
cursize = cur_f->db_flen + 1;
fnp = erealloc(fnp, cursize);
}
snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp));
/* now convert it to the right php internal type */
switch (cur_f->db_type) {
case 'C':
case 'D':
add_next_index_string(return_value,str_value,1);
break;
case 'N': /* FALLS THROUGH */
case 'L': /* FALLS THROUGH */
if (cur_f->db_fdc == 0) {
add_next_index_long(return_value, strtol(str_value, NULL, 10));
} else {
add_next_index_double(return_value, atof(str_value));
}
break;
case 'M':
/* this is a memo field. don't know how to deal with
this yet */
break;
default:
/* should deal with this in some way */
break;
}
efree(str_value);
}
efree(fnp);
/* mark whether this record was deleted */
if (data[0] == '*') {
add_assoc_long(return_value,"deleted",1);
}
else {
add_assoc_long(return_value,"deleted",0);
}
free(data);
}
/* }}} */
/* From Martin Kuba <makub@aida.inet.cz> */
/* {{{ proto array dbase_get_record_with_names(int identifier, int record)
Returns an associative array representing a record from the database */
PHP_FUNCTION(dbase_get_record_with_names) {
pval *dbh_id, *record;
dbhead_t *dbh;
int dbh_type;
dbfield_t *dbf, *cur_f;
char *data, *fnp, *str_value;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
convert_to_long(record);
dbh = php3_list_find(dbh_id->value.lval, &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
RETURN_FALSE;
}
if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) {
php_error(E_WARNING, "Tried to read bad record %d", record->value.lval);
RETURN_FALSE;
}
dbf = dbh->db_fields;
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
fnp = (char *)emalloc(dbh->db_rlen);
for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
/* get the value */
str_value = (char *)emalloc(cur_f->db_flen + 1);
sprintf(str_value, cur_f->db_format, get_field_val(data, cur_f, fnp));
/* now convert it to the right php internal type */
switch (cur_f->db_type) {
case 'C':
case 'D':
add_assoc_string(return_value,cur_f->db_fname,str_value,1);
break;
case 'N': /* FALLS THROUGH */
case 'L': /* FALLS THROUGH */
if (cur_f->db_fdc == 0) {
add_assoc_long(return_value,cur_f->db_fname,strtol(str_value, NULL, 10));
} else {
add_assoc_double(return_value,cur_f->db_fname,atof(str_value));
}
break;
case 'M':
/* this is a memo field. don't know how to deal with this yet */
break;
default:
/* should deal with this in some way */
break;
}
efree(str_value);
}
efree(fnp);
/* mark whether this record was deleted */
if (data[0] == '*') {
add_assoc_long(return_value,"deleted",1);
} else {
add_assoc_long(return_value,"deleted",0);
}
free(data);
}
/* }}} */
/* {{{ proto bool dbase_create(string filename, array fields)
Creates a new dBase-format database file */
PHP_FUNCTION(dbase_create) {
pval *filename, *fields, *field, *value;
int fd;
dbhead_t *dbh;
int num_fields;
dbfield_t *dbf, *cur_f;
int i, rlen, handle;
DBase_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&filename,&fields)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(filename);
if (fields->type != IS_ARRAY) {
php_error(E_WARNING, "Expected array as second parameter");
RETURN_FALSE;
}
if (PG(safe_mode) && (!_php3_checkuid(filename->value.str.val, 2))) {
RETURN_FALSE;
}
if (_php3_check_open_basedir(filename->value.str.val)) {
RETURN_FALSE;
}
if ((fd = open(filename->value.str.val, O_BINARY|O_RDWR|O_CREAT, 0644)) < 0) {
php_error(E_WARNING, "Unable to create database (%d): %s", errno, strerror(errno));
RETURN_FALSE;
}
num_fields = zend_hash_num_elements(fields->value.ht);
/* have to use regular malloc() because this gets free()d by
code in the dbase library */
dbh = (dbhead_t *)malloc(sizeof(dbhead_t));
dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * num_fields);
if (!dbh || !dbf) {
php_error(E_WARNING, "Unable to allocate memory for header info");
RETURN_FALSE;
}
/* initialize the header structure */
dbh->db_fields = dbf;
dbh->db_fd = fd;
dbh->db_dbt = DBH_TYPE_NORMAL;
strcpy(dbh->db_date, "19930818");
dbh->db_records = 0;
dbh->db_nfields = num_fields;
dbh->db_hlen = sizeof(struct dbf_dhead) + 2 + num_fields * sizeof(struct dbf_dfield);
rlen = 1;
for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
/* look up the first field */
if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
php_error(E_WARNING, "unable to find field %d", i);
free_dbf_head(dbh);
RETURN_FALSE;
}
if (field->type != IS_ARRAY) {
php_error(E_WARNING, "second parameter must be array of arrays");
free_dbf_head(dbh);
RETURN_FALSE;
}
/* field name */
if (zend_hash_index_find(field->value.ht, 0, (void **)&value) == FAILURE) {
php_error(E_WARNING, "expected field name as first element of list in field %d", i);
free_dbf_head(dbh);
RETURN_FALSE;
}
convert_to_string(value);
if (value->value.str.len > 10 || value->value.str.len == 0) {
php_error(E_WARNING, "invalid field name '%s' (must be non-empty and less than or equal to 10 characters)", value->value.str.val);
free_dbf_head(dbh);
RETURN_FALSE;
}
copy_crimp(cur_f->db_fname, value->value.str.val, value->value.str.len);
/* field type */
if (zend_hash_index_find(field->value.ht,1,(void **)&value) == FAILURE) {
php_error(E_WARNING, "expected field type as sececond element of list in field %d", i);
RETURN_FALSE;
}
convert_to_string(value);
cur_f->db_type = toupper(*value->value.str.val);
cur_f->db_fdc = 0;
/* verify the field length */
switch (cur_f->db_type) {
case 'L':
cur_f->db_flen = 1;
break;
case 'M':
cur_f->db_flen = 9;
dbh->db_dbt = DBH_TYPE_MEMO;
/* should create the memo file here, probably */
break;
case 'D':
cur_f->db_flen = 8;
break;
case 'N':
case 'C':
/* field length */
if (zend_hash_index_find(field->value.ht,2,(void **)&value) == FAILURE) {
php_error(E_WARNING, "expected field length as third element of list in field %d", i);
free_dbf_head(dbh);
RETURN_FALSE;
}
convert_to_long(value);
cur_f->db_flen = value->value.lval;
if (cur_f->db_type == 'N') {
if (zend_hash_index_find(field->value.ht,3,(void **)&value) == FAILURE) {
php_error(E_WARNING, "expected field precision as fourth element of list in field %d", i);
free_dbf_head(dbh);
RETURN_FALSE;
}
convert_to_long(value);
cur_f->db_fdc = value->value.lval;
}
break;
default:
php_error(E_WARNING, "unknown field type '%c'", cur_f->db_type);
}
cur_f->db_foffset = rlen;
rlen += cur_f->db_flen;
cur_f->db_format = get_dbf_f_fmt(cur_f);
}
dbh->db_rlen = rlen;
put_dbf_info(dbh);
handle = php3_list_insert(dbh, DBase_GLOBAL(le_dbhead));
RETURN_LONG(handle);
}
/* }}} */
function_entry dbase_functions[] = {
PHP_FE(dbase_open, NULL)
PHP_FE(dbase_create, NULL)
PHP_FE(dbase_close, NULL)
PHP_FE(dbase_numrecords, NULL)
PHP_FE(dbase_numfields, NULL)
PHP_FE(dbase_add_record, NULL)
PHP_FE(dbase_replace_record, NULL)
PHP_FE(dbase_get_record, NULL)
PHP_FE(dbase_get_record_with_names, NULL)
PHP_FE(dbase_delete_record, NULL)
PHP_FE(dbase_pack, NULL)
{NULL, NULL, NULL}
};
php3_module_entry dbase_module_entry = {
"DBase", dbase_functions, PHP_MINIT(dbase), PHP_MSHUTDOWN(dbase), NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
};
#if defined(COMPILE_DL)
DLEXPORT php3_module_entry *get_module(void) { return &dbase_module_entry; }
#if (WIN32|WINNT) && defined(THREAD_SAFE)
/*NOTE: You should have an odbc.def file where you
export DllMain*/
BOOL WINAPI DllMain(HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
return 1;
}
#endif
#endif
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+94
View File
@@ -0,0 +1,94 @@
/*
* Copyright (c) 1991, 1992, 1993 Brad Eacker,
* (Music, Intuition, Software, and Computers)
* All Rights Reserved
*/
/*
* dbf header structure on disk (pc dbase III)
*
* Basic info taken from:
* "File Formats for Popular PC Software"
* Jeff Walden
* (c) 1986 John Wiley & Sons, Inc.
*/
#ifndef _DBF_H_
#define _DBF_H_
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
/* So we can use O_BINARY on non-Win32 systems. */
#if !defined(O_BINARY) && !defined(WIN32)
#define O_BINARY (0)
#endif
struct dbf_dhead {
char dbh_dbt; /* memo (dbt) file present */
char dbh_date[3]; /* last update YY, MM, DD */
char dbh_records[4]; /* number of records LE */
char dbh_hlen[2]; /* header length LE */
char dbh_rlen[2]; /* record length LE */
char dbh_res[20]; /* padding */
};
#define DBH_DATE_YEAR 0 /* byte offset for year in dbh_date */
#define DBH_DATE_MONTH 1
#define DBH_DATE_DAY 2
/*
* field description on disk
*/
#define DBF_NAMELEN 11
struct dbf_dfield {
char dbf_name[DBF_NAMELEN]; /* name of field */
char dbf_type; /* type of field */
char dbf_fda[4]; /* something for dbase III */
char dbf_flen[2]; /* field length [and decimal if N] */
char dbf_res[14]; /* padding */
};
struct db_field {
char db_fname[DBF_NAMELEN+1]; /* 0 terminated */
char db_type; /* type of field */
int db_flen; /* length of field */
int db_fdc; /* number of decimals in field */
char *db_format; /* format for printing %s etc */
int db_foffset; /* offset within record */
};
typedef struct db_field dbfield_t;
struct db_head {
int db_fd;
unsigned char db_dbt; /* dbt present */
char db_date[9]; /* date of last update in db format */
long db_records; /* number of records */
int db_hlen; /* header length */
int db_rlen; /* record length */
int db_nfields; /* number of fields */
dbfield_t *db_fields; /* field info */
char *db_name; /* name of dbf file */
int db_cur_rec; /* current record */
};
typedef struct db_head dbhead_t;
#define DBH_TYPE_NORMAL 0x03
#define DBH_TYPE_MEMO 0x83
#define VALID_RECORD ' '
#define DELETED_RECORD '*'
#include "dbf_head.h"
#include "dbf_misc.h"
#include "dbf_rec.h"
#endif /* _DBF_H_ */
+261
View File
@@ -0,0 +1,261 @@
/*
* Copyright (c) 1991, 1992, 1993 Brad Eacker,
* (Music, Intuition, Software, and Computers)
* All Rights Reserved
*/
#include <stdio.h>
#include <fcntl.h>
#include "dbf.h"
void free_dbf_head(dbhead_t *dbh);
int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
/*
* get the header info from the file
* basic header info & field descriptions
*/
dbhead_t *get_dbf_head(int fd)
{
dbhead_t *dbh;
struct dbf_dhead dbhead;
dbfield_t *dbf, *cur_f;
int ret, nfields, offset;
if ((dbh = (dbhead_t *)malloc(sizeof(dbhead_t))) == NULL)
return NULL;
if (lseek(fd, 0, 0) < 0)
return NULL;
if ((ret = read(fd, &dbhead, sizeof(dbhead))) < 0)
return NULL;
/* build in core info */
dbh->db_fd = fd;
dbh->db_dbt = dbhead.dbh_dbt;
dbh->db_records = get_long(dbhead.dbh_records);
dbh->db_hlen = get_short(dbhead.dbh_hlen);
dbh->db_rlen = get_short(dbhead.dbh_rlen);
db_set_date(dbh->db_date, dbhead.dbh_date[DBH_DATE_YEAR] + 1900,
dbhead.dbh_date[DBH_DATE_MONTH],
dbhead.dbh_date[DBH_DATE_DAY]);
dbh->db_nfields = nfields = (dbh->db_hlen - sizeof(struct dbf_dhead)) /
sizeof(struct dbf_dfield);
/* get all the field info */
dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * nfields);
offset = 1;
for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
if (get_dbf_field(dbh, cur_f) < 0) {
free_dbf_head(dbh);
return NULL;
}
cur_f->db_foffset = offset;
offset += cur_f->db_flen;
}
dbh->db_fields = dbf;
return dbh;
}
/*
* free up the header info built above
*/
void free_dbf_head(dbhead_t *dbh)
{
dbfield_t *dbf, *cur_f;
int nfields;
dbf = dbh->db_fields;
nfields = dbh->db_nfields;
for (cur_f = dbf; cur_f < &dbf[nfields]; cur_f++) {
if (cur_f->db_format) {
free(cur_f->db_format);
}
}
free(dbf);
free(dbh);
}
/*
* put out the header info
*/
int put_dbf_head(dbhead_t *dbh)
{
int fd = dbh->db_fd;
struct dbf_dhead dbhead;
int ret;
memset (&dbhead, 0, sizeof(dbhead));
/* build on disk info */
dbhead.dbh_dbt = dbh->db_dbt;
put_long(dbhead.dbh_records, dbh->db_records);
put_short(dbhead.dbh_hlen, dbh->db_hlen);
put_short(dbhead.dbh_rlen, dbh->db_rlen);
/* put the date spec'd into the on disk header */
dbhead.dbh_date[DBH_DATE_YEAR] =(char)(db_date_year(dbh->db_date) -
1900);
dbhead.dbh_date[DBH_DATE_MONTH]=(char)(db_date_month(dbh->db_date));
dbhead.dbh_date[DBH_DATE_DAY] =(char)(db_date_day(dbh->db_date));
if (lseek(fd, 0, 0) < 0)
return -1;
if ((ret = write(fd, &dbhead, sizeof(dbhead))) < 0)
return -1;
return ret;
}
/*
* get a field off the disk from the current file offset
*/
int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
{
struct dbf_dfield dbfield;
int ret;
if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
return ret;
}
/* build the field name */
copy_crimp(dbf->db_fname, dbfield.dbf_name, DBF_NAMELEN);
dbf->db_type = dbfield.dbf_type;
switch (dbf->db_type) {
case 'N':
dbf->db_flen = dbfield.dbf_flen[0];
dbf->db_fdc = dbfield.dbf_flen[1];
break;
default:
dbf->db_flen = get_short(dbfield.dbf_flen);
}
if ((dbf->db_format = get_dbf_f_fmt(dbf)) == NULL) {
return 1;
}
return 0;
}
/*
* put a field out on the disk at the current file offset
*/
int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
{
struct dbf_dfield dbfield;
char *scp, *dcp;
int ret;
memset (&dbfield, 0, sizeof(dbfield));
/* build the on disk field info */
scp = dbf->db_fname; dcp = dbfield.dbf_name;
strncpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN);
dbfield.dbf_type = dbf->db_type;
switch (dbf->db_type) {
case 'N':
dbfield.dbf_flen[0] = dbf->db_flen;
dbfield.dbf_flen[1] = dbf->db_fdc;
break;
default:
put_short(dbfield.dbf_flen, dbf->db_flen);
}
/* now write it out to disk */
if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
return ret;
}
return 1;
}
/*
* put out all the info at the top of the file...
*/
static char end_stuff[2] = {0x0d, 0};
void put_dbf_info(dbhead_t *dbh)
{
dbfield_t *dbf;
char *cp;
int fcnt;
if ((cp = db_cur_date(NULL))) {
strncpy(dbh->db_date, cp, 8);
free(cp);
}
put_dbf_head(dbh);
dbf = dbh->db_fields;
for (fcnt = dbh->db_nfields; fcnt > 0; fcnt--, dbf++)
put_dbf_field(dbh, dbf);
write(dbh->db_fd, end_stuff, 1);
}
char *get_dbf_f_fmt(dbfield_t *dbf)
{
char format[100];
/* build the field format for printf */
switch (dbf->db_type) {
case 'C':
sprintf(format, "%%-%ds", dbf->db_flen);
break;
case 'N':
case 'L':
case 'D':
sprintf(format, "%%%ds", dbf->db_flen);
break;
case 'M':
strcpy(format, "%s");
break;
}
return (char *)strdup(format);
}
dbhead_t *dbf_open(char *dp, int o_flags)
{
int fd;
char *cp;
dbhead_t *dbh;
cp = dp;
if ((fd = open(cp, o_flags|O_BINARY)) < 0) {
cp = (char *)malloc(256);
strcpy(cp, dp); strcat(cp, ".dbf");
if ((fd = open(cp, o_flags)) < 0) {
perror("open");
return NULL;
}
}
if ((dbh = get_dbf_head(fd)) == 0) {
fprintf(stderr, "Unable to get header\n");
return NULL;
}
dbh->db_name = cp;
dbh->db_cur_rec = 0;
return dbh;
}
void dbf_head_info(dbhead_t *dbh)
{
int nfields;
dbfield_t *dbf, *cur_f;
nfields = dbh->db_nfields;
printf("# fields: %d, record len: %d, total records %ld\n",
nfields, dbh->db_rlen, dbh->db_records);
dbf = dbh->db_fields;
for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
printf("# %s, %c, %d, %d\n", cur_f->db_fname,
cur_f->db_type, cur_f->db_flen, cur_f->db_fdc);
}
}
+9
View File
@@ -0,0 +1,9 @@
extern dbhead_t *get_dbf_head(int fd);
void free_dbf_head(dbhead_t *dbh);
extern int put_dbf_head(dbhead_t *dbh);
extern int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
extern int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
void put_dbf_info(dbhead_t *dbh);
extern char *get_dbf_f_fmt(dbfield_t *dbf);
extern dbhead_t *dbf_open(char *dp, int o_flags);
void dbf_head_info(dbhead_t *dbh);
+168
View File
@@ -0,0 +1,168 @@
/*
* Copyright (c) 1991, 1992, 1993 Brad Eacker,
* (Music, Intuition, Software, and Computers)
* All Rights Reserved
*/
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include "dbf_misc.h"
/*
* routine to change little endian long to host long
*/
long get_long(char *cp)
{
int ret;
unsigned char *source = (unsigned char *)cp;
ret = *source++;
ret += ((*source++)<<8);
ret += ((*source++)<<16);
ret += ((*source++)<<24);
return ret;
}
void put_long(char *cp, long lval)
{
*cp++ = lval & 0xff;
*cp++ = (lval >> 8) & 0xff;
*cp++ = (lval >> 16) & 0xff;
*cp++ = (lval >> 24) & 0xff;
}
/*
* routine to change little endian short to host short
*/
int get_short(char *cp)
{
int ret;
unsigned char *source = (unsigned char *)cp;
ret = *source++;
ret += ((*source++)<<8);
return ret;
}
void put_short(char *cp, int sval)
{
*cp++ = sval & 0xff;
*cp++ = (sval >> 8) & 0xff;
}
double get_double(char *cp)
{
double ret;
unsigned char *dp = (unsigned char *)&ret;
dp[7] = *cp++;
dp[6] = *cp++;
dp[5] = *cp++;
dp[4] = *cp++;
dp[3] = *cp++;
dp[2] = *cp++;
dp[1] = *cp++;
dp[0] = *cp++;
return ret;
}
void put_double(char *cp, double fval)
{
unsigned char *dp = (unsigned char *)&fval;
cp[7] = *dp++;
cp[6] = *dp++;
cp[5] = *dp++;
cp[4] = *dp++;
cp[3] = *dp++;
cp[2] = *dp++;
cp[1] = *dp++;
cp[0] = *dp++;
}
void copy_fill(char *dp, char *sp, int len)
{
while (*sp && len > 0) {
*dp++ = *sp++;
len--;
}
while (len-- > 0)
*dp++ = ' ';
}
void copy_crimp(char *dp, char *sp, int len)
{
while (len-- > 0) {
*dp++ = *sp++;
}
*dp = 0;
for (dp-- ; *dp == ' '; dp--) {
*dp = 0;
}
}
void db_set_date(char *cp, int year, int month, int day)
{
if (month > 12)
month = 0;
if (day > 31)
day = 0;
sprintf(cp, "%d", year);
cp[4] = month / 10 + '0';
cp[5] = month % 10 + '0';
cp[6] = day / 10 + '0';
cp[7] = day % 10 + '0';
cp[8] = 0;
}
int db_date_year(char *cp)
{
int year, i;
for (year = 0, i = 0; i < 4; i++)
year = year * 10 + (cp[i] - '0');
return year;
}
int db_date_month(char *cp)
{
int month, i;
for (month = 0, i = 4; i < 6; i++)
month = month * 10 + (cp[i] - '0');
return month;
}
int db_date_day(char *cp)
{
int day, i;
for (day = 0, i = 6; i < 8; i++)
day = day * 10 + (cp[i] - '0');
return day;
}
#include <time.h>
char *db_cur_date(char *cp)
{
struct tm *ctm;
time_t c_time;
c_time = time((time_t *)NULL);
ctm = localtime(&c_time);
if (cp == NULL)
cp = (char *)malloc(9);
if (ctm == NULL || cp == NULL)
return NULL;
db_set_date(cp, ctm->tm_year + 1900, ctm->tm_mon + 1, ctm->tm_mday);
return cp;
}
+13
View File
@@ -0,0 +1,13 @@
void put_long(char *cp, long lval);
extern long get_long(char *cp);
extern int get_short(char *cp);
void put_short(char *cp, int sval);
void put_double(char *cp, double fval);
extern double get_double(char *cp);
void copy_fill(char *dp, char *sp, int len);
void copy_crimp(char *dp, char *sp, int len);
void db_set_date(char *cp, int year, int month, int day);
extern int db_date_year(char *cp);
extern int db_date_month(char *cp);
extern int db_date_day(char *cp);
extern char *db_cur_date(char *cp);
+183
View File
@@ -0,0 +1,183 @@
/*
* Copyright (c) 1991, 1992, 1993 Brad Eacker,
* (Music, Intuition, Software, and Computers)
* All Rights Reserved
*/
#include <stdio.h>
#include <fcntl.h>
#include "dbf.h"
#include "dbf_ndx.h"
/*
* get the ndx header for this file
*/
ndx_header_t *ndx_get_header(int fd)
{
dndx_header_t *dp;
ndx_header_t *np;
if ((dp = (dndx_header_t *)malloc(NDX_PAGE_SZ)) == NULL)
return NULL;
if ((np = (ndx_header_t *)malloc(sizeof(ndx_header_t))) == NULL) {
free(dp);
return NULL;
}
if ((lseek(fd, 0, 0) < 0) || (read(fd, dp, NDX_PAGE_SZ) < 0)) {
free(dp); free(np);
return NULL;
}
np->ndx_hpage = dp;
np->ndx_fd = fd;
np->ndx_start_pg = get_long(dp->dndx_st_pg);
np->ndx_total_pgs = get_long(dp->dndx_tot_pg);
np->ndx_key_len = get_short(dp->dndx_key_len);
np->ndx_keys_ppg = get_short(dp->dndx_keys_ppg);
np->ndx_key_type = get_short(dp->dndx_key_type);
np->ndx_key_size = get_long(dp->dndx_size_key);
np->ndx_key_name = dp->dndx_key_name;
np->ndx_unique = dp->dndx_unique;
np->ndx_fp = NULL;
return np;
}
static ndx_page_t *ndx_get_page(ndx_header_t *hp, int pageno)
{
ndx_page_t *fp;
dndx_page_t *dp;
ndx_record_t *rp;
#if DEBUG
printf("getting page %d", pageno);
#endif
if ((fp = (ndx_page_t *)malloc(sizeof(ndx_page_t))) == NULL)
return NULL;
if ((dp = (dndx_page_t *)malloc(NDX_PAGE_SZ)) == NULL) {
free(fp);
return NULL;
}
if ((rp = (ndx_record_t *)malloc(sizeof(ndx_record_t) * hp->ndx_keys_ppg)) == NULL) {
free(dp); free(fp);
return NULL;
}
fp->ndxp_page_data = dp;
if ((lseek(hp->ndx_fd, pageno * NDX_PAGE_SZ, 0) < 0) ||
(read(hp->ndx_fd, dp, NDX_PAGE_SZ) < 0)) {
free(fp); free(dp);
return NULL;
}
fp->ndxp_parent = NULL;
fp->ndxp_page_no = pageno;
fp->ndxp_num_keys = get_long(dp->dndxp_num_keys);
memset(rp, 0, sizeof(ndx_record_t) * hp->ndx_keys_ppg);
fp->ndxp_records = rp;
fp->ndxp_header_p = hp;
#if DEBUG
printf(", n_keys %ld\n", fp->ndxp_num_keys);
#endif
return fp;
}
/*
* get the first entry for this ndx
*/
static ndx_page_t *ndx_get_first_pg(ndx_header_t *hp)
{
ndx_page_t *fp;
if (hp->ndx_fp)
return hp->ndx_fp;
if ((fp = ndx_get_page(hp, hp->ndx_start_pg))) {
hp->ndx_fp = fp;
}
return fp;
}
static ndx_record_t *ndx_get_record(ndx_page_t *fp, int rec_no)
{
ndx_record_t *rp;
ndx_header_t *hp = fp->ndxp_header_p;
struct dndx_record *drp;
#if DEBUG
printf("page %ld, rec %d: ", fp->ndxp_page_no, rec_no);
#endif
if (rec_no >= fp->ndxp_num_keys)
return NULL;
rp = &(fp->ndxp_records[rec_no]);
if (!rp->ndxr_page) {
rp->ndxr_page = fp;
drp = (dndx_record_t *)((char *)&fp->ndxp_page_data->dndx_rp
+ rec_no * hp->ndx_key_size);
rp->ndxr_left = get_long(drp->dndx_left_pg);
rp->ndxr_rec = get_long(drp->dndx_dbf_rec);
rp->ndxr_key_data = &drp->dndx_key_data;
rp->ndxr_p_nrec = rec_no;
}
#if DEBUG
printf("left %ld, dbf_rec %ld, data '%s'\n", rp->ndxr_left,
rp->ndxr_rec, rp->ndxr_key_data);
#endif
return rp;
}
static ndx_record_t *ndx_scan_down(ndx_header_t *hp, ndx_page_t *fp, int recno)
{
ndx_page_t *np;
ndx_record_t *rp;
while ((rp = ndx_get_record(fp, recno)) && (rp->ndxr_rec == 0)) {
np = ndx_get_page(hp, rp->ndxr_left);
np->ndxp_parent = fp;
np->ndxp_par_rno = recno;
fp = np;
recno = 0;
}
return rp;
}
static ndx_record_t *ndx_scan_up(ndx_header_t *hp, ndx_page_t *fp, int recno)
{
ndx_record_t *rp;
if (fp == NULL)
rp = NULL;
else if (recno < fp->ndxp_num_keys) {
rp = ndx_scan_down(hp, fp, recno);
} else {
rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
}
return rp;
}
ndx_record_t *ndx_get_first_rec(ndx_header_t *hp)
{
ndx_page_t *fp;
ndx_record_t *rp = NULL;
if ((fp = ndx_get_first_pg(hp))) {
fp->ndxp_last_key = 0;
rp = ndx_scan_down(hp, fp, 0);
}
hp->ndx_cur_rec = rp;
return rp;
}
ndx_record_t *ndx_get_next_rec(ndx_header_t *hp, ndx_record_t *rp)
{
ndx_page_t *fp;
int rec_no;
fp = rp->ndxr_page;
rec_no = rp->ndxr_p_nrec + 1;
if (rec_no < fp->ndxp_num_keys) {
rp = ndx_scan_down(hp, fp, rec_no);
} else {
rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
}
return rp;
}
+98
View File
@@ -0,0 +1,98 @@
/*
* Copyright (c) 1993 Brad Eacker,
* (Music, Intuition, Software, and Computers)
* All Rights Reserved
*/
/*
* dbf .ndx header structure on disk and in memory
*
* Basic info taken from:
* "Clipper Programming Guide, 3rd Edition, Version 5.01"
* by Rick Spence
*/
#ifndef _DBF_NDX_H_
#define _DBF_NDX_H_
#include "dbf.h"
#define NDX_PAGE_SZ 512
/* on disk ndx header */
struct dndx_header {
char dndx_st_pg[4]; /* starting page number */
char dndx_tot_pg[4]; /* total number of pages */
char dndx_filler1[4]; /* space */
char dndx_key_len[2]; /* key length */
char dndx_keys_ppg[2]; /* number of keys per page */
char dndx_key_type[2]; /* key type */
char dndx_size_key[4]; /* size of the key record */
char dndx_filler2; /* space */
char dndx_unique; /* whether or not done with unique */
char dndx_key_name[488]; /* string defining the key */
};
typedef struct dndx_header dndx_header_t;
/* in memory ndx header */
struct ndx_header {
long ndx_start_pg;
long ndx_total_pgs;
unsigned short ndx_key_len;
unsigned short ndx_keys_ppg;
unsigned short ndx_key_type;
char ndx_unique;
long ndx_key_size;
char *ndx_key_name;
int ndx_fd;
struct ndx_page *ndx_fp;
dndx_header_t *ndx_hpage;
struct ndx_record *ndx_cur_rec;
};
typedef struct ndx_header ndx_header_t;
/* these are the possible values in the key type field */
#define NDX_CHAR_TYPE 00
#define NDX_NUM_TYPE 01
/* on disk key record */
struct dndx_record {
char dndx_left_pg[4]; /* number of left page */
char dndx_dbf_rec[4]; /* dbf record number */
char dndx_key_data; /* key data */
};
typedef struct dndx_record dndx_record_t;
struct ndx_record {
long ndxr_left;
long ndxr_rec;
char *ndxr_key_data;
struct ndx_page *ndxr_page; /* page pointer to where we are from*/
int ndxr_p_nrec; /* number of the record within page */
};
typedef struct ndx_record ndx_record_t;
struct dndx_page {
char dndxp_num_keys[4]; /* number of keys on this page */
struct dndx_record dndx_rp;
};
typedef struct dndx_page dndx_page_t;
struct ndx_page {
long ndxp_page_no;
long ndxp_num_keys;
dndx_page_t *ndxp_page_data;
ndx_header_t *ndxp_header_p;
long ndxp_last_key;
struct ndx_page *ndxp_parent; /* parent page */
int ndxp_par_rno; /* record number within parent */
struct ndx_record *ndxp_records;
};
typedef struct ndx_page ndx_page_t;
extern ndx_header_t *ndx_get_header(int);
extern ndx_record_t *ndx_get_first_rec(ndx_header_t *);
extern ndx_record_t *ndx_get_next_rec(ndx_header_t *, ndx_record_t *);
#endif /* _DBF_NDX_H_ */
+182
View File
@@ -0,0 +1,182 @@
/*
* Copyright (c) 1993 Brad Eacker,
* (Music, Intuition, Software, and Computers)
* All Rights Reserved
*/
#include <stdio.h>
#include <fcntl.h>
#include "dbf.h"
int get_piece(dbhead_t *dbh, long offset, char *cp, int len);
int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
/*
* get a record off the database
*/
char *get_dbf_record(dbhead_t *dbh, long rec_num)
{
long offset;
char *cp;
if (rec_num > dbh->db_records) {
return NULL;
}
if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
return NULL;
}
/* go to the correct spot on the file */
offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
if (get_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
free(cp);
cp = NULL;
}
if (cp)
dbh->db_cur_rec = rec_num;
return cp;
}
int
get_piece(dbhead_t *dbh, long offset, char *cp, int len)
{
/* go to the correct spot on the file */
if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
return -1;
}
/* read the record into the allocated space */
return read(dbh->db_fd, cp, len);
}
/*
* put a record to the database
*/
long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp)
{
long offset;
if (rec_num == 0) {
rec_num = dbh->db_records;
}
if (rec_num > dbh->db_records) {
return 0L;
}
/* go to the correct spot on the file */
offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
if (put_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
rec_num = -1;
}
return rec_num;
}
int put_piece(dbhead_t *dbh, long offset, char *cp, int len)
{
/* go to the correct spot on the file */
if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
return -1;
}
/* write the record into the file */
return write(dbh->db_fd, cp, len);
}
int del_dbf_record(dbhead_t *dbh, long rec_num)
{
int ret = 0;
char *cp;
if (rec_num > dbh->db_records)
return -1;
if ((cp = get_dbf_record(dbh, rec_num))) {
*cp = DELETED_RECORD;
ret = put_dbf_record(dbh, rec_num, cp);
free(cp);
}
return ret;
}
void pack_dbf(dbhead_t *dbh)
{
long out_off, in_off;
int rec_cnt, new_cnt;
char *cp;
if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
return;
}
in_off = out_off = dbh->db_hlen;
new_cnt = 0;
rec_cnt = dbh->db_records;
while (rec_cnt > 0) {
if (get_piece(dbh, in_off, cp, dbh->db_rlen) < 0)
break;
if (*cp != DELETED_RECORD) {
/* write the record into the file */
if (put_piece(dbh, out_off, cp, dbh->db_rlen) < 0)
break;
out_off += dbh->db_rlen;
new_cnt++;
}
in_off += dbh->db_rlen;
rec_cnt--;
}
free(cp);
if (rec_cnt == 0)
dbh->db_records = new_cnt;
}
/* routine to get a field from a record */
char *get_field_val(char *rp, dbfield_t *fldp, char *cp)
{
int flen = fldp->db_flen;
if ( !cp )
cp = (char *)malloc(flen + 1);
if ( cp ) {
strncpy(cp, &rp[fldp->db_foffset], flen);
cp[flen] = 0;
}
return cp;
}
void put_field_val(char *rp, dbfield_t *fldp, char *cp)
{
strncpy(&rp[fldp->db_foffset], cp, fldp->db_flen);
}
/*
* output a record
*/
void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp)
{
dbfield_t *cur_f;
int nfields = dbh->db_nfields;
char *fnp = (char *)malloc(dbh->db_rlen);
printf("%c", *cp);
for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
printf(" ");
printf(cur_f->db_format, get_field_val(cp, cur_f, fnp));
}
printf("\n");
free(fnp);
}
/* check for record validity */
int is_valid_rec(char *cp)
{
if (cp && (*cp == VALID_RECORD))
return 1;
else
return 0;
}
/* get the next record */
char *dbf_get_next(dbhead_t *dbh)
{
return get_dbf_record(dbh, dbh->db_cur_rec + 1);
}
+10
View File
@@ -0,0 +1,10 @@
extern char *get_dbf_record(dbhead_t *dbh, long rec_num);
extern long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp);
extern int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
extern int del_dbf_record(dbhead_t *dbh, long rec_num);
void pack_dbf(dbhead_t *dbh);
extern char *get_field_val(char *rp, dbfield_t *fldp, char *cp);
void put_field_val(char *rp, dbfield_t *fldp, char *cp);
void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp);
extern int is_valid_rec(char *cp);
extern char *dbf_get_next(dbhead_t *dbh);
+55
View File
@@ -0,0 +1,55 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _DBASE_H
#define _DBASE_H
#if DBASE
extern php3_module_entry dbase_module_entry;
#define dbase_module_ptr &dbase_module_entry
extern PHP_MINIT_FUNCTION(dbase);
PHP_FUNCTION(dbase_open);
PHP_FUNCTION(dbase_create);
PHP_FUNCTION(dbase_close);
PHP_FUNCTION(dbase_numrecords);
PHP_FUNCTION(dbase_numfields);
PHP_FUNCTION(dbase_add_record);
PHP_FUNCTION(dbase_get_record);
PHP_FUNCTION(dbase_delete_record);
PHP_FUNCTION(dbase_pack);
PHP_FUNCTION(dbase_get_record_with_names);
#else
#define dbase_module_ptr NULL
#endif
#define phpext_dbase_ptr dbase_module_ptr
#endif /* _DBASE_H */
+4
View File
@@ -0,0 +1,4 @@
# $Id$ -*- sh -*-
define_option with-dbase 'dBase support? ' yesno no \
' Whether to use the bundled dbase library.'
+650
View File
@@ -0,0 +1,650 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 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_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
| Jim Winstead <jimw@php.net> |
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include <stdio.h>
#include "php.h"
#include "php3_string.h"
#include "php_regex.h"
#include "reg.h"
unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
function_entry reg_functions[] = {
PHP_FE(ereg, third_argument_force_ref)
PHP_FE(ereg_replace, NULL)
PHP_FE(eregi, third_argument_force_ref)
PHP_FE(eregi_replace, NULL)
PHP_FE(split, NULL)
PHP_FALIAS(join, implode, NULL)
PHP_FE(sql_regcase, NULL)
{NULL, NULL, NULL}
};
static PHP_MINIT_FUNCTION(regex);
static PHP_MSHUTDOWN_FUNCTION(regex);
static PHP_MINFO_FUNCTION(regex);
zend_module_entry regexp_module_entry = {
"Regular Expressions",
reg_functions,
PHP_MINIT(regex), PHP_MSHUTDOWN(regex),
NULL, NULL, PHP_MINFO(regex),
STANDARD_MODULE_PROPERTIES
};
#ifdef ZTS
int reg_globals_id;
#else
static php_reg_globals reg_globals;
#endif
typedef struct {
regex_t preg;
int cflags;
} reg_cache;
static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
{
int r = 0;
int patlen = strlen(pattern);
reg_cache *rc = NULL;
REGLS_FETCH();
if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
rc->cflags != cflags) {
r = regcomp(preg, pattern, cflags);
if(!r) {
reg_cache rcp;
rcp.cflags = cflags;
memcpy(&rcp.preg, preg, sizeof(*preg));
zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
(void *) &rcp, sizeof(rcp), NULL);
}
} else {
memcpy(preg, &rc->preg, sizeof(*preg));
}
return r;
}
static int _free_reg_cache(reg_cache *rc)
{
regfree(&rc->preg);
return 1;
}
#define regfree(a);
#define regcomp(a,b,c) _php_regcomp(a,b,c)
static void php_reg_init_globals(php_reg_globals *reg_globals)
{
zend_hash_init(&reg_globals->ht_rc, 0, NULL, (int (*)(void *)) _free_reg_cache, 1);
}
static PHP_MINIT_FUNCTION(regex)
{
#ifdef ZTS
reg_globals_id = ts_allocate_id(sizeof(php_reg_globals), php_reg_init_globals, NULL);
#else
php_reg_init_globals(&reg_globals);
#endif
return SUCCESS;
}
static PHP_MSHUTDOWN_FUNCTION(regex)
{
REGLS_FETCH();
zend_hash_destroy(&REG(ht_rc));
return SUCCESS;
}
static PHP_MINFO_FUNCTION(regex)
{
#if HSREGEX
PUTS("Bundled regex library enabled\n");
#else
PUTS("System regex library enabled\n");
#endif
}
/* This is the maximum number of (..) constructs we'll generate from a
call to ereg() or eregi() with the optional third argument. */
#define NS 10
/*
* _php3_reg_eprint - convert error number to name
*/
static void _php3_reg_eprint(int err, regex_t *re) {
char *buf = NULL, *message = NULL;
size_t len;
size_t buf_len;
#ifdef REG_ITOA
/* get the length of the message */
buf_len = regerror(REG_ITOA | err, re, NULL, 0);
if (buf_len) {
buf = (char *)emalloc(buf_len * sizeof(char));
if (!buf) return; /* fail silently */
/* finally, get the error message */
regerror(REG_ITOA | err, re, buf, buf_len);
}
#else
buf_len = 0;
#endif
len = regerror(err, re, NULL, 0);
if (len) {
message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
if (!message) {
return; /* fail silently */
}
if (buf_len) {
snprintf(message, buf_len, "%s: ", buf);
buf_len += 1; /* so pointer math below works */
}
/* drop the message into place */
regerror(err, re, message + buf_len, len);
php_error(E_WARNING, "%s", message);
}
STR_FREE(buf);
STR_FREE(message);
}
static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
pval *regex, /* Regular expression */
*findin, /* String to apply expression to */
*array = NULL; /* Optional register array */
regex_t re;
regmatch_t subs[NS];
int err, i, match_len, string_len;
int copts = 0;
off_t start, end;
char *buf = NULL;
char *string = NULL;
if (icase)
copts |= REG_ICASE;
switch(ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &regex, &findin) == FAILURE) {
WRONG_PARAM_COUNT;
}
/* don't bother doing substring matching if we're not going
to make use of the information */
copts |= REG_NOSUB;
break;
case 3:
if (getParameters(ht, 3, &regex, &findin, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (!ParameterPassedByReference(ht, 3)) {
php_error(E_WARNING, "Array to be filled with values must be passed by reference.");
RETURN_FALSE;
}
break;
default:
WRONG_PARAM_COUNT;
}
/* compile the regular expression from the supplied regex */
if (regex->type == IS_STRING) {
err = regcomp(&re, regex->value.str.val, REG_EXTENDED | copts);
} else {
/* we convert numbers to integers and treat them as a string */
if (regex->type == IS_DOUBLE)
convert_to_long(regex); /* get rid of decimal places */
convert_to_string(regex);
/* don't bother doing an extended regex with just a number */
err = regcomp(&re, regex->value.str.val, copts);
}
if (err) {
_php3_reg_eprint(err, &re);
RETURN_FALSE;
}
/* make a copy of the string we're looking in */
convert_to_string(findin);
string = estrndup(findin->value.str.val, findin->value.str.len);
/* actually execute the regular expression */
err = regexec(&re, string, (size_t) NS, subs, 0);
if (err && err != REG_NOMATCH) {
_php3_reg_eprint(err, &re);
regfree(&re);
RETURN_FALSE;
}
match_len = 1;
if (array && err != REG_NOMATCH) {
match_len = (int) (subs[0].rm_eo - subs[0].rm_so);
string_len = strlen(string) + 1;
buf = emalloc(string_len);
if (!buf) {
php_error(E_WARNING, "Unable to allocate memory in _php3_ereg");
RETURN_FALSE;
}
pval_destructor(array); /* start with clean array */
array_init(array);
for (i = 0; i < NS; i++) {
start = subs[i].rm_so;
end = subs[i].rm_eo;
if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
add_index_stringl(array, i, string+start, end-start, 1);
}
}
efree(buf);
}
efree(string);
if (err == REG_NOMATCH) {
RETVAL_FALSE;
} else {
if (match_len == 0)
match_len = 1;
RETVAL_LONG(match_len);
}
regfree(&re);
}
/* {{{ proto int ereg(string pattern, string string [, array registers])
Regular expression match */
PHP_FUNCTION(ereg)
{
_php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto int eregi(string pattern, string string [, array registers])
Case-insensitive regular expression match */
PHP_FUNCTION(eregi)
{
_php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* this is the meat and potatoes of regex replacement! */
char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended)
{
regex_t re;
regmatch_t subs[NS];
char *buf, /* buf is where we build the replaced string */
*nbuf, /* nbuf is used when we grow the buffer */
*walkbuf; /* used to walk buf when replacing backrefs */
const char *walk; /* used to walk replacement string for backrefs */
int buf_len;
int pos, tmp, string_len, new_l;
int err, copts = 0;
string_len = strlen(string);
if (icase)
copts = REG_ICASE;
if (extended)
copts |= REG_EXTENDED;
err = regcomp(&re, pattern, copts);
if (err) {
_php3_reg_eprint(err, &re);
return ((char *) -1);
}
/* start with a buffer that is twice the size of the stringo
we're doing replacements in */
buf_len = 2 * string_len + 1;
buf = emalloc(buf_len * sizeof(char));
if (!buf) {
php_error(E_WARNING, "Unable to allocate memory in _php3_regreplace");
regfree(&re);
return ((char *) -1);
}
err = pos = 0;
buf[0] = '\0';
while (!err) {
err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0));
if (err && err != REG_NOMATCH) {
_php3_reg_eprint(err, &re);
regfree(&re);
return ((char *) -1);
}
if (!err) {
/* backref replacement is done in two passes:
1) find out how long the string will be, and allocate buf
2) copy the part before match, replacement and backrefs to buf
Jaakko Hyvätti <Jaakko.Hyvatti@iki.fi>
*/
new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
walk = replace;
while (*walk)
if ('\\' == *walk
&& '0' <= walk[1] && '9' >= walk[1]
&& subs[walk[1] - '0'].rm_so > -1
&& subs[walk[1] - '0'].rm_eo > -1) {
new_l += subs[walk[1] - '0'].rm_eo
- subs[walk[1] - '0'].rm_so;
walk += 2;
} else {
new_l++;
walk++;
}
if (new_l + 1 > buf_len) {
buf_len = 1 + buf_len + 2 * new_l;
nbuf = emalloc(buf_len);
strcpy(nbuf, buf);
efree(buf);
buf = nbuf;
}
tmp = strlen(buf);
/* copy the part of the string before the match */
strncat(buf, &string[pos], subs[0].rm_so);
/* copy replacement and backrefs */
walkbuf = &buf[tmp + subs[0].rm_so];
walk = replace;
while (*walk)
if ('\\' == *walk
&& '0' <= walk[1] && '9' >= walk[1]
&& subs[walk[1] - '0'].rm_so > -1
&& subs[walk[1] - '0'].rm_eo > -1) {
tmp = subs[walk[1] - '0'].rm_eo
- subs[walk[1] - '0'].rm_so;
memcpy (walkbuf,
&string[pos + subs[walk[1] - '0'].rm_so],
tmp);
walkbuf += tmp;
walk += 2;
} else
*walkbuf++ = *walk++;
*walkbuf = '\0';
/* and get ready to keep looking for replacements */
if (subs[0].rm_so == subs[0].rm_eo) {
if (subs[0].rm_so + pos >= string_len)
break;
new_l = strlen (buf) + 1;
if (new_l + 1 > buf_len) {
buf_len = 1 + buf_len + 2 * new_l;
nbuf = emalloc(buf_len * sizeof(char));
strcpy(nbuf, buf);
efree(buf);
buf = nbuf;
}
pos += subs[0].rm_eo + 1;
buf [new_l-1] = string [pos-1];
buf [new_l] = '\0';
} else {
pos += subs[0].rm_eo;
}
} else { /* REG_NOMATCH */
new_l = strlen(buf) + strlen(&string[pos]);
if (new_l + 1 > buf_len) {
buf_len = new_l + 1; /* now we know exactly how long it is */
nbuf = emalloc(buf_len * sizeof(char));
strcpy(nbuf, buf);
efree(buf);
buf = nbuf;
}
/* stick that last bit of string on our output */
strcat(buf, &string[pos]);
}
}
/* don't want to leak memory .. */
regfree(&re);
/* whew. */
return (buf);
}
static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
pval *arg_pattern,
*arg_replace,
*arg_string;
char *pattern;
char *string;
char *replace;
char *ret;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (arg_pattern->type == IS_STRING) {
if (arg_pattern->value.str.val && arg_pattern->value.str.len)
pattern = estrndup(arg_pattern->value.str.val,arg_pattern->value.str.len);
else
pattern = empty_string;
} else {
convert_to_long(arg_pattern);
pattern = emalloc(2);
pattern[0] = (char) arg_pattern->value.lval;
pattern[1] = '\0';
}
if (arg_replace->type == IS_STRING) {
if (arg_replace->value.str.val && arg_replace->value.str.len)
replace = estrndup(arg_replace->value.str.val, arg_replace->value.str.len);
else
replace = empty_string;
} else {
convert_to_long(arg_replace);
replace = emalloc(2);
replace[0] = (char) arg_replace->value.lval;
replace[1] = '\0';
}
convert_to_string(arg_string);
if (arg_string->value.str.val && arg_string->value.str.len)
string = estrndup(arg_string->value.str.val, arg_string->value.str.len);
else
string = empty_string;
/* do the actual work */
ret = _php3_regreplace(pattern, replace, string, icase, 1);
if (ret == (char *) -1) {
RETVAL_FALSE;
} else {
RETVAL_STRING(ret,1);
STR_FREE(ret);
}
STR_FREE(string);
STR_FREE(replace);
STR_FREE(pattern);
}
/* {{{ proto string ereg_replace(string pattern, string string [, array registers])
Replace regular expression */
PHP_FUNCTION(ereg_replace)
{
_php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto string eregi_replace(string pattern, string string [, array registers])
Case insensitive replace regular expression */
PHP_FUNCTION(eregi_replace)
{
_php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* ("root", "passwd", "uid", "gid", "other:stuff:like:/bin/sh")
= split(":", $passwd_file, 5); */
/* {{{ proto array split(string pattern, string string [, int limit])
split string into array by regular expression */
PHP_FUNCTION(split)
{
pval *spliton, *str, *arg_count = NULL;
regex_t re;
regmatch_t subs[1];
char *strp, *endp;
int err, size, count;
switch (ARG_COUNT(ht)) {
case 2:
if (getParameters(ht, 2, &spliton, &str) == FAILURE)
WRONG_PARAM_COUNT;
count = -1;
break;
case 3:
if (getParameters(ht, 3, &spliton, &str, &arg_count) == FAILURE)
WRONG_PARAM_COUNT;
convert_to_long(arg_count);
count = arg_count->value.lval;
break;
default:
WRONG_PARAM_COUNT;
}
convert_to_string(spliton);
convert_to_string(str);
strp = str->value.str.val;
endp = str->value.str.val + strlen(str->value.str.val);
err = regcomp(&re, spliton->value.str.val, REG_EXTENDED);
if (err) {
php_error(E_WARNING, "unexpected regex error (%d)", err);
RETURN_FALSE;
}
if (array_init(return_value) == FAILURE) {
regfree(&re);
RETURN_FALSE;
}
/* churn through str, generating array entries as we go */
while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) {
if (subs[0].rm_so == 0 && subs[0].rm_eo) {
/* match is at start of string, return empty string */
add_next_index_stringl(return_value, empty_string, 0, 1);
/* skip ahead the length of the regex match */
strp+=subs[0].rm_eo;
} else if (subs[0].rm_so==0 && subs[0].rm_eo==0) {
/* No more matches */
regfree(&re);
php_error(E_WARNING, "bad regular expression for split()");
zend_hash_destroy(return_value->value.ht);
efree(return_value->value.ht);
RETURN_FALSE;
} else {
/* On a real match */
/* make a copy of the substring */
size = subs[0].rm_so;
/* add it to the array */
add_next_index_stringl(return_value, strp, size, 1);
/* point at our new starting point */
strp = strp + subs[0].rm_eo;
}
/* if we're only looking for a certain number of points,
stop looking once we hit it */
if (count != -1) {
count--;
}
}
/* see if we encountered an error */
if (err && err != REG_NOMATCH) {
php_error(E_WARNING, "unexpected regex error (%d)", err);
regfree(&re);
zend_hash_destroy(return_value->value.ht);
efree(return_value->value.ht);
RETURN_FALSE;
}
/* otherwise we just have one last element to add to the array */
size = endp - strp;
add_next_index_stringl(return_value, strp, size, 1);
regfree(&re);
return;
}
/* }}} */
/* {{{ proto string sql_regcase(string string)
Make regular expression for case insensitive match */
PHPAPI PHP_FUNCTION(sql_regcase)
{
pval *string;
char *tmp;
unsigned char c;
register int i, j;
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &string)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(string);
tmp = (char *) emalloc(string->value.str.len*4+1);
for (i=j=0; i<string->value.str.len; i++) {
c = (unsigned char) string->value.str.val[i];
if(isalpha(c)) {
tmp[j++] = '[';
tmp[j++] = toupper(c);
tmp[j++] = tolower(c);
tmp[j++] = ']';
} else {
tmp[j++] = c;
}
}
tmp[j]=0;
tmp = erealloc(tmp, j + 1);
RETVAL_STRINGL(tmp, j, 0);
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+71
View File
@@ -0,0 +1,71 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _REG_H
#define _REG_H
extern php3_module_entry regexp_module_entry;
#define regexp_module_ptr &regexp_module_entry
char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended);
PHP_FUNCTION(ereg);
PHP_FUNCTION(eregi);
PHP_FUNCTION(eregi_replace);
PHP_FUNCTION(ereg_replace);
PHP_FUNCTION(split);
PHPAPI PHP_FUNCTION(sql_regcase);
typedef struct {
HashTable ht_rc;
} php_reg_globals;
#ifdef ZTS
#define REGLS_D php_reg_globals *reg_globals
#define REGLS_DC , REGLS_D
#define REGLS_C reg_globals
#define REGLS_CC , REGLS_C
#define REG(v) (reg_globals->v)
#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id)
#else
#define REGLS_D
#define REGLS_DC
#define REGLS_C
#define REGLS_CC
#define REG(v) (reg_globals.v)
#define REGLS_FETCH()
#endif
#define phpext_regex_ptr regexp_module_ptr
#endif /* _REG_H */
+14
View File
@@ -0,0 +1,14 @@
#ifndef _PHP_REGEX_H
#define _PHP_REGEX_H
#if REGEX
#include "regex/regex.h"
#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
#define _RX_H 1 /* Try defining these for Linux to */
#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
#define _H_REGEX 1 /* This one is for AIX */
#else
#include <regex.h>
#endif
#endif /* _PHP_REGEX_H */
+20
View File
@@ -0,0 +1,20 @@
Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it, subject
to the following restrictions:
1. The author is not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.
4. This notice may not be removed or altered.
+145
View File
@@ -0,0 +1,145 @@
SHELL = /bin/sh
srcdir=@srcdir@
VPATH=@srcdir@
CC=@CC@
RANLIB=@RANLIB@
# You probably want to take -DREDEBUG out of CFLAGS, and put something like
# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
# internal assertion checking and some debugging facilities).
# Put -Dconst= in for a pre-ANSI compiler.
# Do not take -DPOSIX_MISTAKE out.
# REGCFLAGS isn't important to you (it's for my use in some special contexts).
CFLAGS=@CFLAGS@
COMPILE=$(CC) $(CFLAGS) -I$(srcdir) -I. -DPOSIX_MISTAKE
# If you have a pre-ANSI compiler, put -o into MKHFLAGS. If you want
# the Berkeley __P macro, put -b in.
MKHFLAGS=
# Flags for linking but not compiling, if any.
LDFLAGS=@LDFLAGS@
# Extra libraries for linking, if any.
LIBS=
# Internal stuff, should not need changing.
OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
OBJS=$(OBJPRODN) split.o debug.o main.o
H=cclass.h cname.h regex2.h utils.h
REGSRC=regcomp.c regerror.c regexec.c regfree.c
ALLSRC=$(REGSRC) engine.c debug.c main.c split.c
# Stuff that matters only if you're trying to lint the package.
LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c main.c
JUNKLINT=possible pointer alignment|null effect
# arrangements to build forward-reference header files
.SUFFIXES: .ih .h
.c.ih:
sh $(srcdir)/mkh $(MKHFLAGS) -p $< >$@
.c.o:
$(COMPILE) -c $<
all lib: libregex.a
libregex.a: $(OBJPRODN)
rm -f libregex.a
ar cr libregex.a $(OBJPRODN)
$(RANLIB) libregex.a
default: r
purge:
rm -f *.o
# stuff to build regex.h
REGEXH=regex.h
REGEXHSRC=regex2.h $(REGSRC)
$(REGEXH): $(REGEXHSRC) mkh
sh $(srcdir)/./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.h
#cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
#rm -f regex.tmp
# dependencies
$(OBJPRODN) debug.o: utils.h regex.h regex2.h
regcomp.o: cclass.h cname.h regcomp.ih
regexec.o: engine.c engine.ih
regerror.o: regerror.ih
debug.o: debug.ih
main.o: main.ih
# tester
re: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
# regression test
r: re tests
./re <tests
./re -el <tests
./re -er <tests
# 57 variants, and other stuff, for development use -- not useful to you
ra: ./re tests
-./re <tests
-./re -el <tests
-./re -er <tests
rx: ./re tests
./re -x <tests
./re -x -el <tests
./re -x -er <tests
t: ./re tests
-time ./re <tests
-time ./re -cs <tests
-time ./re -el <tests
-time ./re -cs -el <tests
l: $(LINTC)
lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
fullprint:
ti README WHATSNEW notes todo | list
ti *.h | list
list *.c
list regex.3 regex.7
print:
ti README WHATSNEW notes todo | list
ti *.h | list
list reg*.c engine.c
mf.tmp: Makefile
sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@
DTRH=cclass.h cname.h regex2.h utils.h
PRE=COPYRIGHT README WHATSNEW
POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
FILES=$(PRE) Makefile $(POST)
DTR=$(PRE) Makefile=mf.tmp $(POST)
dtr: $(FILES) mf.tmp
makedtr $(DTR) >$@
rm mf.tmp
cio: $(FILES)
cio $(FILES)
rdf: $(FILES)
rcsdiff -c $(FILES) 2>&1 | p
# various forms of cleanup
tidy:
rm -f junk* core core.* *.core dtr *.tmp lint
clean: tidy
rm -f *.o *.s re libregex.a
# don't do this one unless you know what you're doing
spotless: clean
rm -f mkh regex.h
+32
View File
@@ -0,0 +1,32 @@
alpha3.4 release.
Thu Mar 17 23:17:18 EST 1994
henry@zoo.toronto.edu
See WHATSNEW for change listing.
installation notes:
--------
Read the comments at the beginning of Makefile before running.
Utils.h contains some things that just might have to be modified on
some systems, as well as a nested include (ugh) of <assert.h>.
The "fake" directory contains quick-and-dirty fakes for some header
files and routines that old systems may not have. Note also that
-DUSEBCOPY will make utils.h substitute bcopy() for memmove().
After that, "make r" will build regcomp.o, regexec.o, regfree.o,
and regerror.o (the actual routines), bundle them together into a test
program, and run regression tests on them. No output is good output.
"make lib" builds just the .o files for the actual routines (when
you're happy with testing and have adjusted CFLAGS for production),
and puts them together into libregex.a. You can pick up either the
library or *.o ("make lib" makes sure there are no other .o files left
around to confuse things).
Main.c, debug.c, split.c are used for regression testing but are not part
of the RE routines themselves.
Regex.h goes in /usr/include. All other .h files are internal only.
--------
+92
View File
@@ -0,0 +1,92 @@
New in alpha3.4: The complex bug alluded to below has been fixed (in a
slightly kludgey temporary way that may hurt efficiency a bit; this is
another "get it out the door for 4.4" release). The tests at the end of
the tests file have accordingly been uncommented. The primary sign of
the bug was that something like a?b matching ab matched b rather than ab.
(The bug was essentially specific to this exact situation, else it would
have shown up earlier.)
New in alpha3.3: The definition of word boundaries has been altered
slightly, to more closely match the usual programming notion that "_"
is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
and the makefile no longer alludes to it in mysterious ways. The
makefile has generally been cleaned up some. Fixes have been made
(again!) so that the regression test will run without -DREDEBUG, at
the cost of weaker checking. A workaround for a bug in some folks'
<assert.h> has been added. And some more things have been added to
tests, including a couple right at the end which are commented out
because the code currently flunks them (complex bug; fix coming).
Plus the usual minor cleanup.
New in alpha3.2: Assorted bits of cleanup and portability improvement
(the development base is now a BSDI system using GCC instead of an ancient
Sun system, and the newer compiler exposed some glitches). Fix for a
serious bug that affected REs using many [] (including REG_ICASE REs
because of the way they are implemented), *sometimes*, depending on
memory-allocation patterns. The header-file prototypes no longer name
the parameters, avoiding possible name conflicts. The possibility that
some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
now handled gracefully. "uchar" is no longer used as an internal type
name (too many people have the same idea). Still the same old lousy
performance, alas.
New in alpha3.1: Basically nothing, this release is just a bookkeeping
convenience. Stay tuned.
New in alpha3.0: Performance is no better, alas, but some fixes have been
made and some functionality has been added. (This is basically the "get
it out the door in time for 4.4" release.) One bug fix: regfree() didn't
free the main internal structure (how embarrassing). It is now possible
to put NULs in either the RE or the target string, using (resp.) a new
REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
regcomp() makes all characters ordinary, so you can match a literal
string easily (this will become more useful when performance improves!).
There are now primitives to match beginnings and ends of words, although
the syntax is disgusting and so is the implementation. The REG_ATOI
debugging interface has changed a bit. And there has been considerable
internal cleanup of various kinds.
New in alpha2.3: Split change list out of README, and moved flags notes
into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
to change for 4.4BSD. Cleanup work in engine.c, and some new regression
tests to catch tricky cases thereof.
New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
in my own test program and might be useful to others for similar purposes.
The regression test will now compile (and run) without REDEBUG. The
BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
Char/uchar parameters are now written int/unsigned, to avoid possible
portability problems with unpromoted parameters. Some unsigned casts have
been introduced to minimize portability problems with shifting into sign
bits.
New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
thing is that regex.h is now generated, using mkh, rather than being
supplied in the distribution; due to circularities in dependencies,
you have to build regex.h explicitly by "make h". The two known bugs
have been fixed (and the regression test now checks for them), as has a
problem with assertions not being suppressed in the absence of REDEBUG.
No performance work yet.
New in alpha2: Backslash-anything is an ordinary character, not an
error (except, of course, for the handful of backslashed metacharacters
in BREs), which should reduce script breakage. The regression test
checks *where* null strings are supposed to match, and has generally
been tightened up somewhat. Small bug fixes in parameter passing (not
harmful, but technically errors) and some other areas. Debugging
invoked by defining REDEBUG rather than not defining NDEBUG.
New in alpha+3: full prototyping for internal routines, using a little
helper program, mkh, which extracts prototypes given in stylized comments.
More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
pre-screening of input when a literal string is known to be part of the
RE; this does wonders for performance.
New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
word width isn't hardwired into regexec.c any more, the public header
file prototypes the functions if __STDC__ is defined, and some small typos
in the manpages have been fixed.
New in alpha+1: improvements to the manual pages, and an important
extension, the REG_STARTEND option to regexec().
+31
View File
@@ -0,0 +1,31 @@
/* character-class table */
static struct cclass {
char *name;
char *chars;
char *multis;
} cclasses[] = {
{ "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
0123456789", "" },
{ "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"" },
{ "blank", " \t", "" },
{ "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
\25\26\27\30\31\32\33\34\35\36\37\177", "" },
{ "digit", "0123456789", "" },
{ "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
"" },
{ "lower", "abcdefghijklmnopqrstuvwxyz",
"" },
{ "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
"" },
{ "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
"" },
{ "space", "\t\n\v\f\r ", "" },
{ "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"" },
{ "xdigit", "0123456789ABCDEFabcdef",
"" },
{ NULL, 0, "" }
};
+102
View File
@@ -0,0 +1,102 @@
/* character-name table */
static struct cname {
char *name;
char code;
} cnames[] = {
{ "NUL", '\0' },
{ "SOH", '\001' },
{ "STX", '\002' },
{ "ETX", '\003' },
{ "EOT", '\004' },
{ "ENQ", '\005' },
{ "ACK", '\006' },
{ "BEL", '\007' },
{ "alert", '\007' },
{ "BS", '\010' },
{ "backspace", '\b' },
{ "HT", '\011' },
{ "tab", '\t' },
{ "LF", '\012' },
{ "newline", '\n' },
{ "VT", '\013' },
{ "vertical-tab", '\v' },
{ "FF", '\014' },
{ "form-feed", '\f' },
{ "CR", '\015' },
{ "carriage-return", '\r' },
{ "SO", '\016' },
{ "SI", '\017' },
{ "DLE", '\020' },
{ "DC1", '\021' },
{ "DC2", '\022' },
{ "DC3", '\023' },
{ "DC4", '\024' },
{ "NAK", '\025' },
{ "SYN", '\026' },
{ "ETB", '\027' },
{ "CAN", '\030' },
{ "EM", '\031' },
{ "SUB", '\032' },
{ "ESC", '\033' },
{ "IS4", '\034' },
{ "FS", '\034' },
{ "IS3", '\035' },
{ "GS", '\035' },
{ "IS2", '\036' },
{ "RS", '\036' },
{ "IS1", '\037' },
{ "US", '\037' },
{ "space", ' ' },
{ "exclamation-mark", '!' },
{ "quotation-mark", '"' },
{ "number-sign", '#' },
{ "dollar-sign", '$' },
{ "percent-sign", '%' },
{ "ampersand", '&' },
{ "apostrophe", '\'' },
{ "left-parenthesis", '(' },
{ "right-parenthesis", ')' },
{ "asterisk", '*' },
{ "plus-sign", '+' },
{ "comma", ',' },
{ "hyphen", '-' },
{ "hyphen-minus", '-' },
{ "period", '.' },
{ "full-stop", '.' },
{ "slash", '/' },
{ "solidus", '/' },
{ "zero", '0' },
{ "one", '1' },
{ "two", '2' },
{ "three", '3' },
{ "four", '4' },
{ "five", '5' },
{ "six", '6' },
{ "seven", '7' },
{ "eight", '8' },
{ "nine", '9' },
{ "colon", ':' },
{ "semicolon", ';' },
{ "less-than-sign", '<' },
{ "equals-sign", '=' },
{ "greater-than-sign", '>' },
{ "question-mark", '?' },
{ "commercial-at", '@' },
{ "left-square-bracket", '[' },
{ "backslash", '\\' },
{ "reverse-solidus", '\\' },
{ "right-square-bracket", ']' },
{ "circumflex", '^' },
{ "circumflex-accent", '^' },
{ "underscore", '_' },
{ "low-line", '_' },
{ "grave-accent", '`' },
{ "left-brace", '{' },
{ "left-curly-bracket", '{' },
{ "vertical-line", '|' },
{ "right-brace", '}' },
{ "right-curly-bracket", '}' },
{ "tilde", '~' },
{ "DEL", '\177' },
{ NULL, 0 }
};
+242
View File
@@ -0,0 +1,242 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
#include <sys/types.h>
#include <regex.h>
#include "utils.h"
#include "regex2.h"
#include "debug.ih"
/*
- regprint - print a regexp for debugging
== void regprint(regex_t *r, FILE *d);
*/
void
regprint(r, d)
regex_t *r;
FILE *d;
{
register struct re_guts *g = r->re_g;
register int i;
register int c;
register int last;
int nincat[NC];
fprintf(d, "%ld states, %d categories", (long)g->nstates,
g->ncategories);
fprintf(d, ", first %ld last %ld", (long)g->firststate,
(long)g->laststate);
if (g->iflags&USEBOL)
fprintf(d, ", USEBOL");
if (g->iflags&USEEOL)
fprintf(d, ", USEEOL");
if (g->iflags&BAD)
fprintf(d, ", BAD");
if (g->nsub > 0)
fprintf(d, ", nsub=%ld", (long)g->nsub);
if (g->must != NULL)
fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
g->must);
if (g->backrefs)
fprintf(d, ", backrefs");
if (g->nplus > 0)
fprintf(d, ", nplus %ld", (long)g->nplus);
fprintf(d, "\n");
s_print(g, d);
for (i = 0; i < g->ncategories; i++) {
nincat[i] = 0;
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
if (g->categories[c] == i)
nincat[i]++;
}
fprintf(d, "cc0#%d", nincat[0]);
for (i = 1; i < g->ncategories; i++)
if (nincat[i] == 1) {
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
if (g->categories[c] == i)
break;
fprintf(d, ", %d=%s", i, regchar(c));
}
fprintf(d, "\n");
for (i = 1; i < g->ncategories; i++)
if (nincat[i] != 1) {
fprintf(d, "cc%d\t", i);
last = -1;
for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
if (c <= CHAR_MAX && g->categories[c] == i) {
if (last < 0) {
fprintf(d, "%s", regchar(c));
last = c;
}
} else {
if (last >= 0) {
if (last != c-1)
fprintf(d, "-%s",
regchar(c-1));
last = -1;
}
}
fprintf(d, "\n");
}
}
/*
- s_print - print the strip for debugging
== static void s_print(register struct re_guts *g, FILE *d);
*/
static void
s_print(g, d)
register struct re_guts *g;
FILE *d;
{
register sop *s;
register cset *cs;
register int i;
register int done = 0;
register sop opnd;
register int col = 0;
register int last;
register sopno offset = 2;
# define GAP() { if (offset % 5 == 0) { \
if (col > 40) { \
fprintf(d, "\n\t"); \
col = 0; \
} else { \
fprintf(d, " "); \
col++; \
} \
} else \
col++; \
offset++; \
}
if (OP(g->strip[0]) != OEND)
fprintf(d, "missing initial OEND!\n");
for (s = &g->strip[1]; !done; s++) {
opnd = OPND(*s);
switch (OP(*s)) {
case OEND:
fprintf(d, "\n");
done = 1;
break;
case OCHAR:
if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
fprintf(d, "\\%c", (char)opnd);
else
fprintf(d, "%s", regchar((char)opnd));
break;
case OBOL:
fprintf(d, "^");
break;
case OEOL:
fprintf(d, "$");
break;
case OBOW:
fprintf(d, "\\{");
break;
case OEOW:
fprintf(d, "\\}");
break;
case OANY:
fprintf(d, ".");
break;
case OANYOF:
fprintf(d, "[(%ld)", (long)opnd);
cs = &g->sets[opnd];
last = -1;
for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
if (CHIN(cs, i) && i < g->csetsize) {
if (last < 0) {
fprintf(d, "%s", regchar(i));
last = i;
}
} else {
if (last >= 0) {
if (last != i-1)
fprintf(d, "-%s",
regchar(i-1));
last = -1;
}
}
fprintf(d, "]");
break;
case OBACK_:
fprintf(d, "(\\<%ld>", (long)opnd);
break;
case O_BACK:
fprintf(d, "<%ld>\\)", (long)opnd);
break;
case OPLUS_:
fprintf(d, "(+");
if (OP(*(s+opnd)) != O_PLUS)
fprintf(d, "<%ld>", (long)opnd);
break;
case O_PLUS:
if (OP(*(s-opnd)) != OPLUS_)
fprintf(d, "<%ld>", (long)opnd);
fprintf(d, "+)");
break;
case OQUEST_:
fprintf(d, "(?");
if (OP(*(s+opnd)) != O_QUEST)
fprintf(d, "<%ld>", (long)opnd);
break;
case O_QUEST:
if (OP(*(s-opnd)) != OQUEST_)
fprintf(d, "<%ld>", (long)opnd);
fprintf(d, "?)");
break;
case OLPAREN:
fprintf(d, "((<%ld>", (long)opnd);
break;
case ORPAREN:
fprintf(d, "<%ld>))", (long)opnd);
break;
case OCH_:
fprintf(d, "<");
if (OP(*(s+opnd)) != OOR2)
fprintf(d, "<%ld>", (long)opnd);
break;
case OOR1:
if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
fprintf(d, "<%ld>", (long)opnd);
fprintf(d, "|");
break;
case OOR2:
fprintf(d, "|");
if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
fprintf(d, "<%ld>", (long)opnd);
break;
case O_CH:
if (OP(*(s-opnd)) != OOR1)
fprintf(d, "<%ld>", (long)opnd);
fprintf(d, ">");
break;
default:
fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
break;
}
if (!done)
GAP();
}
}
/*
- regchar - make a character printable
== static char *regchar(int ch);
*/
static char * /* -> representation */
regchar(ch)
int ch;
{
static char buf[10];
if (isprint(ch) || ch == ' ')
sprintf(buf, "%c", ch);
else
sprintf(buf, "\\%o", ch);
return(buf);
}
+14
View File
@@ -0,0 +1,14 @@
/* ========= begin header generated by ./mkh ========= */
#ifdef __cplusplus
extern "C" {
#endif
/* === debug.c === */
void regprint(regex_t *r, FILE *d);
static void s_print(register struct re_guts *g, FILE *d);
static char *regchar(int ch);
#ifdef __cplusplus
}
#endif
/* ========= end header generated by ./mkh ========= */
File diff suppressed because it is too large. Load diff
+35
View File
@@ -0,0 +1,35 @@
/* ========= begin header generated by ./mkh ========= */
#ifdef __cplusplus
extern "C" {
#endif
/* === engine.c === */
static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
#define BOL (OUT+1)
#define EOL (BOL+1)
#define BOLEOL (BOL+2)
#define NOTHING (BOL+3)
#define BOW (BOL+4)
#define EOW (BOL+5)
#define CODEMAX (BOL+5) /* highest code used */
#define NONCHAR(c) ((c) > CHAR_MAX)
#define NNONCHAR (CODEMAX-CHAR_MAX)
#ifdef REDEBUG
static void print(struct match *m, char *caption, states st, int ch, FILE *d);
#endif
#ifdef REDEBUG
static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
#endif
#ifdef REDEBUG
static char *pchar(int ch);
#endif
#ifdef __cplusplus
}
#endif
/* ========= end header generated by ./mkh ========= */
Loaded 100 of 626 files, more files were not shown because too many files have changed in this diff. Show more