Compare commits

..
751 Commits
Author SHA1 Message Date
SVN Migration 2ccef75a19 This commit was manufactured by cvs2svn to create tag 'dev'. 2002-08-06 16:36:06 +00:00
Brad House d5ec9a9886 sync to libmcve-3.0 2002-08-06 16:36:05 +00:00
Tomas V.V.Cox 5d4b690bab Changed Windows 9x detection code (reported by Alex Merz) 2002-08-06 16:35:19 +00:00
Marko Karppinen 5611c2fc78 Support compiling and linking against Darwin / Mac OS X frameworks 2002-08-06 16:01:34 +00:00
Dan Kalowsky e410749014 Keeping function prototype variables the same 2002-08-06 03:48:15 +00:00
Marcus Boerger 7477baf33a datatype inconsistency found by Dan Kalowsky 2002-08-06 03:32:16 +00:00
b5ffa93f5f NEWS update 2002-08-06 00:20:49 +00:00
22c0d36cd5 ChangeLog update 2002-08-06 00:19:36 +00:00
Sascha Schumann cd64450cd7 Touch file 2002-08-06 00:07:05 +00:00
Harald Radi 2007b1216a removed a possible NULL pointer referencing inside an error handler 2002-08-05 23:41:25 +00:00
Harald Radi 01dee775d1 found a memleak 2002-08-05 23:38:35 +00:00
Dan Kalowsky 61fc6e766f Removing the imap_popen command... because as Jani puts it "it never worked
and it never will work" until IMAP servers support this feature.
2002-08-05 21:53:09 +00:00
Stig Venaas dddf235671 Made ldap_connect/bind/unbind() use zend_parse_parameters() 2002-08-05 21:14:14 +00:00
Marcus Boerger 55f735a587 Correct carset if iconv is active
#Same solution would work for mbstring - but that must wait
2002-08-05 19:00:09 +00:00
Marcus Boerger 6d21c9465d Added php_ob_handler_used to check if a specific output handler is used
in c.
2002-08-05 18:54:53 +00:00
Marcus Boerger 6c094c3e07 ws fix 2002-08-05 18:42:41 +00:00
Marcus Boerger abc7041ca2 -keep mimetype until sapi deactivation
-move NULL check for sapi_apply_default_charset to proper position.
2002-08-05 18:32:05 +00:00
Marcus Boerger dd8ec2dc0a -fix one warning
-send Content-Type Header with charset
2002-08-05 18:26:06 +00:00
Alan Knowles c4ef31db26 revert change - this was due to an bug in php HEAD a few days ago 2002-08-05 12:58:38 +00:00
Marcus Boerger 77cf59e59c Add html_entities.c 2002-08-05 12:02:36 +00:00
foobar 47902326b9 consistency 2002-08-05 10:40:26 +00:00
Alan Knowles fd7e7021c7 Fixed array_shift messing up array_slice.. 2002-08-05 10:37:40 +00:00
Marcus Boerger cf045313e5 :-) 2002-08-05 03:24:50 +00:00
Marcus Boerger fd26a5c0a9 -New function ob_list_handlers
@- Added ob_list_handlers() which returns an array of all active output
@  handlers. (marcus)
2002-08-05 03:09:42 +00:00
16357dc2af NEWS update 2002-08-05 00:18:35 +00:00
eda6ed6673 ChangeLog update 2002-08-05 00:17:44 +00:00
Shane Caraveo 7645343c4a need to export var_replace and var_destroy for win32 2002-08-04 23:45:38 +00:00
Marcus Boerger c467129528 move html_entities.c to proper place
#nice to have snaps.php.net
2002-08-04 22:54:24 +00:00
Marcus Boerger fa175d6fa2 -Send charset US-ASCII or ini setting default_charset.
#After some discussion with Ilia Alshanetsky
#But perhaps we should have a look for a mbstring solution...
2002-08-04 22:49:48 +00:00
foobar ed4267cf34 Add PHP_MINFO_* 2002-08-04 21:37:44 +00:00
Marcus Boerger 367ca8e2ae -Correct mime_name for HTML-ENTITIES encoding is of cause US-ASCII
-Full list of ASCII aliases
2002-08-04 20:50:53 +00:00
Sander Roobol ef8eb92206 Nuke notice (thanks to Arnaud Limbourg) 2002-08-04 19:00:53 +00:00
Marcus Boerger 81df625260 -Fix warnings (fixed all?) 2002-08-04 18:59:19 +00:00
Georg Richter 06b5f1f546 ups.. :) 2002-08-04 18:59:16 +00:00
Sergey Kartashoff 7fd1881692 - a small fix to mnogosearch extension (affecting UDM_BROWSER_CHARSET) 2002-08-04 18:58:20 +00:00
Georg Richter 83a09ac1f9 added meta tag (w3c compliance)
Thx to Ilia Alshanetsky (ilia@prohost.org)
2002-08-04 18:57:02 +00:00
Marcus Boerger c4e66f4192 -Add new file to windows build 2002-08-04 18:33:28 +00:00
Marcus Boerger 77abd9d55a -New encoding/decoding HTML-ENTITIES.
#This allows to enforce named and numeric entities in output.
#Example:CMS that reads UTF8 or ISO-8859-1 but exports HTML in ASCII.
#Using mbstring.http_output=HTML-ENTITIES users receive entities which
#can displayed correctly independant of any brwoser side encoding.
@New mbstring encoding/decoding HTML-ENTITIES. (marcus)
2002-08-04 14:20:11 +00:00
Marcus Boerger f2f70b5dda -Allow double quotes for encoding lists (if used in ini for example)
-New parameter 'L' for mb_http_input() to retieve input encoding as
 comma separated string.
@New parameter 'L' for mb_http_input() to retrieve input encoding as
 comma separated string. (marcus)
2002-08-04 14:10:58 +00:00
c5067529ee ChangeLog update 2002-08-04 00:18:09 +00:00
James E. Flemer 9eb1213206 Close pipes to avoid deadlock.
Submitted By: Melvyn Sopacua <msopacua@idg.nl>
2002-08-03 14:54:30 +00:00
Dan Kalowsky d4ec2c30a0 Cleaning up the imap_get_quotaroot return array to remove useless data 2002-08-03 14:48:47 +00:00
Rasmus Lerdorf c8bf165242 Yup, sizeof() includes the space for the \0 2002-08-03 14:09:56 +00:00
Marcus Boerger 02a12b57e9 -additional section INI that allows to set special ini settings on call
by adding '-c foo=bar' strings to php call. Each line must have format
 foo=bar. This of cause only works for cli version.
-made sections SKIPIF,INI,GET,POST optional
2002-08-03 11:44:12 +00:00
Sergey Kartashoff 7279543c30 # mnogosearch example fix 2002-08-03 11:34:53 +00:00
Sergey Kartashoff 7a0fbd668a - UDM_PARAM_STORED mnogosearch parameter has been added to set
stored address.
2002-08-03 11:23:51 +00:00
Andi Gutmans 61a73183cc - Small fix 2002-08-03 09:50:07 +00:00
Andi Gutmans 4b492c4deb - Fix build on Windows. Also please don't use Java style opening function
- bracket indentation.
2002-08-03 09:48:34 +00:00
Zeev Suraski 6025b804c2 MFZE1 2002-08-03 09:44:27 +00:00
Sergey Kartashoff 37e58c21b2 - An Udm_Make_Excerpt function has been added to mnogosearch extension
to support excerpts while using with mnogosearch-3.2.5 or later.
2002-08-03 08:53:27 +00:00
Brad LaFountain c90764d753 one last fix for array_shift 2002-08-03 00:40:46 +00:00
b0fbb9fc45 ChangeLog update 2002-08-03 00:17:40 +00:00
James E. Flemer 3a8d66a021 Fix typo in #if. Bug #17538. 2002-08-02 14:35:24 +00:00
Marcus Boerger de8c36dcaa -use const to clarify code
-fix tsrmls build (therefore rfc1867.c)
2002-08-02 10:22:31 +00:00
Hartmut Holzgraefe e5fa36eee4 added money_format() function
this is similar to C-libs strfmon(), using the same format string
semantics but a different function prototype, so i decided to
give it a more speaking name similar to number_format()
2002-08-02 10:08:53 +00:00
Sergey Kartashoff c9107a668f - UDM_PARAM_WORD_MATCH icorrect behavior has been fixed in
mnogosearch extension
2002-08-02 07:22:19 +00:00
Rui Hirokawa 7527bf0c58 made sapi_register_treat_data() to support multibyte input encoding translation without MBSTR_ENC_TRANS and changed php_treat_data to php_default_treat_data. 2002-08-02 06:53:48 +00:00
82b5dc103f ChangeLog update 2002-08-02 00:23:21 +00:00
Stefan Roehrich f871a5b742 Fixed wrong usage of strncmp. 2002-08-01 21:12:09 +00:00
Brad LaFountain 9b0553c390 array_pop wasnt setting next index 2002-08-01 17:34:31 +00:00
foobar 922b7596a2 That was not correct.. 2002-08-01 16:44:47 +00:00
foobar 6df2b90c05 Reset index when doing array_pop() 2002-08-01 16:39:52 +00:00
foobar 362fc4ee76 Add test for the index resetting. 2002-08-01 16:39:14 +00:00
Stanislav Malyshev 0e7c1f4609 MFZE1 2002-08-01 16:07:19 +00:00
Rasmus Lerdorf b15651c95f Ugh 2002-08-01 15:51:56 +00:00
Dan Kalowsky f08a51f05a Adding in some BC for users to imap_get_quota() function 2002-08-01 14:47:48 +00:00
foobar ababdff402 Added tests for array_shift/array_pop. 2002-08-01 12:33:02 +00:00
foobar 06b3dd122f Nuke compile warning. 2002-08-01 12:07:15 +00:00
foobar 9d62cd7d45 - Removed the DOS line endings
- Changed the '//' comment (this is C, not C++) to /* */
# Brad, use some editor which works..
2002-08-01 12:06:46 +00:00
foobar 7d8c9d2f7f Fix the levels. (php.ini-dist has output_buffering OFF) 2002-08-01 12:02:22 +00:00
foobar 725b3573be Use the constant instead of string for locale type. 2002-08-01 11:49:41 +00:00
Marcus Boerger be0a6f4949 - free mimetype and statusline early if no longer needed or in deactivation
#not setting them to NULL caused the segfault
2002-08-01 09:00:30 +00:00
Rasmus Lerdorf 7b9036cada Need room for the \0 here to avoid an overflow 2002-08-01 07:49:53 +00:00
Brad LaFountain 4f5bd6b7d4 made array_shift re-index like it did before previous fix 2002-08-01 04:38:11 +00:00
1ad75f658b ChangeLog update 2002-08-01 00:17:10 +00:00
Jason Greene 0a376eec25 perhaps this tiem i will get it right 2002-07-31 23:06:53 +00:00
Jason Greene 3b449ce088 Fix unwrapped entry 2002-07-31 22:49:28 +00:00
Jason Greene 4ac782ae57 Fix my broken entry 2002-07-31 22:43:26 +00:00
Sterling Hughes 3754f76507 add support for the curl dns cache 2002-07-31 22:10:58 +00:00
Marcus Boerger dfe1a65faf -fix warnings in windows build 2002-07-31 21:34:37 +00:00
Marcus Boerger 4e05dd7c1b -problem with CLI/mbstring/output buffering 2002-07-31 17:55:15 +00:00
Zeev Suraski a842e12ad2 Fix for non-mbstring builds. Bad Yasuo! :) 2002-07-31 16:25:12 +00:00
Zeev Suraski bc82be4284 Fix crash 2002-07-31 14:41:06 +00:00
Dan Kalowsky 2832d8df94 WS 2002-07-31 13:51:20 +00:00
Dan Kalowsky cc491407de Just adding in an error check that seems to work here well. 2002-07-31 13:50:51 +00:00
foobar 9fe39b9604 Reverted the patch..it breaks the original behaviour of at least array_shift. 2002-07-31 13:49:50 +00:00
Dan Kalowsky 7f30227181 removing the useless +1's on sizeof() and adding the mail_parameter for the
getquot inside the imap_get_quotaroot function.  thank Jani.
2002-07-31 01:03:31 +00:00
38757032d2 NEWS update 2002-07-31 00:19:19 +00:00
e219b8e70c ChangeLog update 2002-07-31 00:18:46 +00:00
Dan Kalowsky 579d1b6a28 fixes a typo in the word "limit", adds the null character to the strlen,
and seems to make imap_get_quotaroot return the correct values despite
cclients claim of "getquotaroot list improper".
2002-07-30 23:16:11 +00:00
Brad LaFountain 70fb744365 fixed bugs 16063 and 16068
increased preformance of array_pop and array_shift
2002-07-30 22:54:12 +00:00
Jason Greene b0cf6c3112 MFZE1 global declare 2002-07-30 22:19:50 +00:00
Jason Greene 838b8ba49f Fix segfault 2002-07-30 22:14:39 +00:00
Stefan Esser a6cf14ac5c ftp_close returns now TRUE on success and FALSE on failure. 2002-07-30 20:37:59 +00:00
Dan Kalowsky 18c0d30c58 Commiting Steph@php.net's patch to re-enable touch on Win32 machines 2002-07-30 20:24:13 +00:00
Rasmus Lerdorf b17544fa33 Add --skel=dir option to ext_skel (patch from David Viner) 2002-07-30 19:02:23 +00:00
Rasmus Lerdorf 059f302596 Fix strtotime() "next" keyword handling. 2002-07-30 18:42:19 +00:00
Rasmus Lerdorf a03057d726 WTF? What sort of bogus commit was that? Fine, here you go. 2002-07-30 17:39:33 +00:00
foobar 3aa77bc32c . 2002-07-30 17:24:13 +00:00
Rasmus Lerdorf 888b7bc2c6 . 2002-07-30 16:05:32 +00:00
Rasmus Lerdorf d56bc7934d Fix for #18638 (str_rot13 bug) 2002-07-30 10:51:33 +00:00
Adam Dickmeiss 5246b7d9d4 Fixed proxy setting for ZOOM 2002-07-30 10:50:48 +00:00
Andrei Zmievski 82c72f2799 @- Adding 'is' operator that can be used to check the type of a variable,
@  or its class. (Andrei)
2002-07-30 04:07:15 +00:00
foobar 84ae5adf29 hot, damn hot. 2002-07-30 00:24:11 +00:00
05e14619b3 ChangeLog update 2002-07-30 00:19:14 +00:00
Sterling Hughes 2f0a47cd55 add sablotron version, patch by Christian Stocker... 2002-07-29 23:57:26 +00:00
Adam Dickmeiss ab9494f9cc Make PHP part of Z39.50 implementation name 2002-07-29 21:51:48 +00:00
Adam Dickmeiss 9decd37336 Use type ext rather than raw for ZOOM record fetch 2002-07-29 19:56:59 +00:00
Dan Kalowsky cc6cf09a51 updating the NEWS file
# why this wasn't done automagically I don't know...
2002-07-29 17:49:46 +00:00
Christian Stocker 825b5a42e2 - nodename is not always set, check if it really is.
- make force_ref for aliases as well
2002-07-29 14:04:44 +00:00
Edin Kadribasic 1463c0b7ee Fixed windows build by adding sha1.c and sha1.h to the project file. 2002-07-29 13:42:01 +00:00
Edin Kadribasic a55c1228ed Fixed bug #14657 (patch by Steph Fox) 2002-07-29 13:13:50 +00:00
Edin Kadribasic 0737394d80 Fixed bug #11214 (patch by Steph Fox) 2002-07-29 13:12:57 +00:00
Edin Kadribasic 8f94a8a744 First try to open php-SAPI.ini and if it fails fall back to regular
php.ini file. For example cli version of PHP will first try to open
php-cli.ini in the usual ini file search path and only if it fails
will it try to open php.ini using the same path.
2002-07-29 12:17:34 +00:00
Sascha Schumann 200058ae81 style police 2002-07-29 08:54:56 +00:00
5307eef5bc NEWS update 2002-07-29 00:19:54 +00:00
110027f64a ChangeLog update 2002-07-29 00:18:58 +00:00
Yasuo Ohgaki 073c21e5c0 Allow xmlrpc-epi header files stored under include/xmlrpc-epi 2002-07-28 21:03:26 +00:00
Derick Rethans 1630e1788f - Copy and paste error -> unify error messages 2002-07-28 19:29:28 +00:00
Stefan Esser bffe4cf222 Added sha1, sha1_file functions. 2002-07-28 19:18:08 +00:00
Marcus Boerger 4f1e5943d8 -add & document ini settings for exif 2002-07-28 17:25:55 +00:00
Marcus Boerger 0383426860 -decode several MarkerNotes
-correct offset information in debug mode
@exif_read_data() can decode MarkerNote of several Cameras. (Marcus)
2002-07-28 17:21:51 +00:00
Tal Peer 90488714ee * Fixed E_NOTICE on pear -V 2002-07-28 17:06:28 +00:00
Stefan Esser 46e76a451d (re)added /ext/ftp news 2002-07-28 14:10:56 +00:00
Stefan Roehrich 6f786ebf3e Commit patch as discussed on LinuxTag and posted to php-dev in June.
Disables zlib.output_compression for scripts with image/ content-type
header (fixes bug #16109) and makes it possible to switch
zlib.output_compression during script execution before the headers are
sent.
@- zlib.output_compression is disabled for "image/" content-type
@  headers and can be changed during script execution. (Stefan)
2002-07-28 14:08:08 +00:00
foobar 24b570dcac - Removed the 2 last entries.
# Dan, sesser, re-add them again yourself.
2002-07-28 13:46:11 +00:00
foobar 9ca47d493d No exceptions. 2002-07-28 13:44:37 +00:00
Harald Radi 476bae4035 update the handlers struct 2002-07-28 13:06:54 +00:00
Yasuo Ohgaki 05aa532310 Unify error messages 2002-07-28 11:17:57 +00:00
Marcus Boerger 0b6074a343 forgot to move imeageellipse out of #ifdef HAVE_LIBGD20 2002-07-28 10:00:37 +00:00
Yasuo Ohgaki 3e7c884b1c Fixed query string handling. Now some.php?a&b=1;c works.
# arg_separator.output can be multile chars
2002-07-28 09:42:15 +00:00
Tal Peer 6bb32a9b1e pear -V now shows pear version, php version and ZE version. 2002-07-28 09:09:03 +00:00
Stig Bakken 6cefddee6f * feature/fixed bug 2002-07-28 08:56:32 +00:00
Stig Bakken cbbc47a199 * added "upgrade-all" command 2002-07-28 08:52:55 +00:00
Stig Bakken 2b4f112d02 * don't abort install if errors are found in the package, display
a warning instead
2002-07-28 08:52:29 +00:00
Yasuo Ohgaki 92e542db27 Fixed some.php?a&b&c does not initilize $_GET['a'], $_GET['b'], $_GET['c']
when mbstr-enc-trans is disabled.
# There is a bug in php_mbstr_encoding_handler() alo, I'll fix it later.
2002-07-28 04:18:40 +00:00
aa338d7b21 ChangeLog update 2002-07-28 00:19:08 +00:00
Andi Gutmans b476ddf183 - Make sure classes are first looked for in the current scope.
- Make sure that during inheritance the global scope is searched if the
- current one doesn't work.
2002-07-27 15:53:14 +00:00
Rui Hirokawa fbbeaec630 fixed: output encoding translation by mb_output_handler() in ext/mbstring was not usable when Content-Type is set by header(). 2002-07-27 13:58:16 +00:00
Stefan Esser 70d7184624 Do not leak data connection. 2002-07-27 09:18:51 +00:00
14d029edf5 NEWS update 2002-07-27 00:19:15 +00:00
6a1b927482 ChangeLog update 2002-07-27 00:18:39 +00:00
foobar d1e3622fcc - Fix bug: #18509, e.g. setting CURLOPT_BINARYTRANSFER succeeds always.
- Also set the binary mode ONLY if the passed value is true..
2002-07-26 22:57:14 +00:00
Frank M. Kromann df0bab2c7b Fizing ZTS build 2002-07-26 22:14:55 +00:00
Stefan Esser 80e9724ccc [EXPERIMENTAL] Added functions for asynchronous FTP transfers 2002-07-26 22:00:25 +00:00
Marcus Boerger 8b853592b1 Missing Photoshop tags 2002-07-26 17:09:02 +00:00
Dan Kalowsky b53b76335f forgot to make the same change to imap_get_quota... 2002-07-26 17:08:05 +00:00
Dan Kalowsky 05f3881995 Minor memory fix suggested by Zeev 2002-07-26 16:59:11 +00:00
Georg Richter 797f7736eb Bugfix: #18532
Fixed week number calculation in accordance with ISO 8601
2002-07-26 16:50:34 +00:00
Stefan Esser 55c1b3d35b fixed cut & paste typo 2002-07-26 16:26:55 +00:00
Dan Kalowsky 9f3f613642 Adding initial support for PHP imap_get_quotaroot
# apparently c-client does not like Cyrus's GETQUOTAROOT return list this
# is still be worked out, but all functionality should be there
# Return array is still not very organized
2002-07-26 16:26:01 +00:00
Dan Kalowsky 0ccc2207bf (PHP imap_get_quota) updated to properly reflect the RFC 2087 as per
bug #14673
@- imap_get_quota now allows multiple resource values to be returned, as
   per RFC 2087, closes bug #14673 (kalowsky, Sander Steffann)
2002-07-26 16:22:43 +00:00
Sascha Schumann 8fd3f14ab1 Fix segfault due to unchecked null pointer 2002-07-26 16:16:12 +00:00
Tomas V.V.Cox bf2a898a5f In theory this will fix a problem in Window trying to delete a not closed
file

#if so, other fixes like that may be needed
2002-07-26 15:39:16 +00:00
Marcus Boerger b0b2226352 reapply patch for imageellipse beeing wrappet to imagearc if missing
# derick: the rest of the patch wasn't removed
2002-07-26 13:24:45 +00:00
Stefan Esser c9676ccad7 @- FTP extension does support (auto)resuming now.
Added (Auto)Resuming functionality to ftp_(f)get/(f)put via optional 5th parameter.
2002-07-26 13:03:08 +00:00
Tomas V.V.Cox 9aca197515 use -d output_buffer=0 to workarround the PHP flush() problem 2002-07-26 11:58:10 +00:00
Tomas V.V.Cox fedba5422c download package if force is set 2002-07-26 11:48:55 +00:00
Tomas V.V.Cox 6b08fd5f9c revert my change from PHP_BINDIR to bin_dir 2002-07-26 11:12:44 +00:00
Tomas V.V.Cox 377b106172 Use install-as attrib for pear.bat too, so it gets installed in @bin_dir@ 2002-07-26 11:02:41 +00:00
Tomas V.V.Cox 7bf6b4ccee Use script arg separator '--'
Clean up unused stuff
2002-07-26 10:48:20 +00:00
Andi Gutmans 41e3f4f0c3 - Fix problem with debug_backtrace() reported by Stig. We weren't reporting
- global function information because it wasn't available. We have to do
- an additional assignment per-function call so that it'll be available.
- Also don't define the global scope as function name _main_ but leave it
- empty so that frameworks like Pear can decide what they want to do.
2002-07-26 10:38:25 +00:00
Tomas V.V.Cox 8d73650be2 Use DIRECTORY_SEPARATOR instead of hardcoded '/' 2002-07-26 10:32:01 +00:00
Tomas V.V.Cox edfb9d44e4 Workarround to the empty $_ENV 2002-07-26 10:18:28 +00:00
Tomas V.V.Cox 6eed1b0243 use $GLOBALS['HTTP_SERVER_VARS'] instead 2002-07-26 10:11:01 +00:00
Tomas V.V.Cox 1690154e62 Silence NOTICE 2002-07-26 10:01:28 +00:00
Stefan Esser 02e6cd022a all functions based on php_stat are now safe mode aware... 2002-07-26 08:04:42 +00:00
foobar a0aa59e738 When Britney learns to sing, I will quit this.. 2002-07-26 01:14:20 +00:00
5780ca663f NEWS update 2002-07-26 00:19:00 +00:00
e7bd50a5e6 ChangeLog update 2002-07-26 00:18:24 +00:00
foobar c4789feffa Fixed 3 major failures in this test:
1. Tests work better when they are actually run..
  2. When file is opened, it should be closed sometime too.
  3. AC_TRY_RUN cleans after itself (rm -f conftest.*), so it's
     good idea to read the values while the file still exists.

#
# James, TEST BEFORE YOU COMMIT!!!!!!!
#
# Andi, I get these results (in Linux/i386):
#
#  ZEND_MM_ALIGNMENT      4
#  ZEND_MM_ALIGNMENT_LOG2 2
#
# Weren't these supposed to be 8 and 3 ?
#
2002-07-25 23:55:06 +00:00
foobar 272913f3d4 - Fixed bug: #18560, the macro was not defined always. 2002-07-25 18:37:16 +00:00
foobar 2dbd41869c Allow setting post_max_size and upload_max_filesize in .htaccess files too 2002-07-25 17:31:34 +00:00
foobar df3ae7ca85 Fixed bug: #18561. 2002-07-25 11:33:21 +00:00
Derick Rethans b7cc9f7447 - Added parameter to print_r which returns the variable representation
instead of echoing it.
@- Added parameter to print_r which returns the variable representation
@  instead of echoing it. (Derick)
2002-07-25 11:22:20 +00:00
Stefan Esser 3e05678842 do not dtor empty elements 2002-07-25 09:33:26 +00:00
Marcus Boerger 4a8dd1255f -handling of thumbnails in sub IFDs (the Photoshopway for TIFF)
-Some Photoshop specific tags
#after the last patches this finally fixes all warnings and errors in bug #18405
2002-07-25 00:52:30 +00:00
e09f789c14 ChangeLog update 2002-07-25 00:18:55 +00:00
Andi Gutmans a38038a4a0 - Fix some compile problems with the new configure checks. 2002-07-24 18:53:19 +00:00
James Cox 5626fc5a39 move testing for the alignment values into configure. 2002-07-24 17:04:11 +00:00
Stefan Esser 5b3ee5f27a break out if there is no data to work on. 2002-07-24 11:25:36 +00:00
Yasuo Ohgaki 7b3fb771e4 is_object() returns FALSE if object is a "incomplete object".
Raise E_NOTICE, instead of E_ERROR, for setting/getting properties
to/from a "incomplete object".
2002-07-24 09:55:11 +00:00
Uwe Steinmann 7df5113ef2 - removed unused variable 2002-07-24 05:59:04 +00:00
James Cox 79ef1c1661 ws fixes. 2002-07-24 00:50:04 +00:00
6b08ac665b ChangeLog update 2002-07-24 00:18:45 +00:00
Marcus Boerger 837fa41da5 -naming convention
-better notices
-(D)WORD are unsigned datatypes
-started to split tygs into different arrays that would allow to handle vendor specific tags after detection of their markers
#BUT simply i do not have any vendor specific image tags...
2002-07-24 00:05:41 +00:00
jim winstead e83a35d215 restore shane to list of members of php group (got lost somewhere along the way) 2002-07-23 23:46:54 +00:00
Andi Gutmans b291dfad3d - Fix WS. 2002-07-23 19:29:02 +00:00
Holger Zimmermann 2771e6d4f6 Removed some outdated lines from init_request_info(). 2002-07-23 17:12:54 +00:00
Sascha Schumann df3589cf88 Add autom4te.cache 2002-07-23 13:50:04 +00:00
Sascha Schumann 3f9ea879ae Remove \r 2002-07-23 13:45:49 +00:00
Edin Kadribasic 35cd16f6bf MFB (patch by Troels Arvin <troels@arvin.dk>).
Added pcre include path to global list of includes in order to allow
use of external pcre libs.
2002-07-23 13:07:29 +00:00
foobar 6a088a2e3c Fix bug: #18308. (uname -a sometimes has extra linefeeds) 2002-07-23 01:58:52 +00:00
foobar 2fcd502522 This should fix those solaris+gcc bugs when --enable-libgcc is not used 2002-07-23 01:58:02 +00:00
foobar 3177f1ca2a Fix bug: #18479. Better error message what was not found. 2002-07-23 01:11:16 +00:00
17e56389ca ChangeLog update 2002-07-23 00:18:02 +00:00
foobar bbbd435124 <insert funny comment here> 2002-07-23 00:08:29 +00:00
James Moore c5bb611c0c Added news item about bug 13866 in response to bug 14752 2002-07-22 19:06:49 +00:00
Jason Greene a64eceef59 Switch streams socket abstraction to use a timeval structure instead of an
integer to allow subsecond timeouts.

This supports the previous behavior of fsockopen()
Fixes bug #16261
2002-07-22 18:46:26 +00:00
Marcus Boerger 469266e4a2 added some more tags from WinXP
changed conersion for TAG_FMT_SBYTE & BYTE
#second change fixes unnecessary conversion timeout
#found by Johan Hultgren <johan@6thgear.se>
2002-07-22 15:07:12 +00:00
Tomas V.V.Cox 995073391e By the moment trust that the dependencies are good
# Will change the installer when finish the dependecy stuff
2002-07-22 12:03:43 +00:00
Marcus Boerger b4c3a0f06e added EXIF Version 2.2 Tags 2002-07-22 11:36:17 +00:00
Tomas V.V.Cox 0ee432cbd5 Bundle Net_socket, needed for Net_SMTP 2002-07-22 11:29:05 +00:00
foobar 2701726cf8 Fix typo.. 2002-07-22 08:58:21 +00:00
Georg Richter d911e50250 new mysql-functions for PHP 4.3.0 2002-07-22 07:50:51 +00:00
Yasuo Ohgaki 882f83cf81 Copy empty_string, fixed crash.
# I thought efree() won't free empty_string...
2002-07-22 06:38:36 +00:00
da3abfc27e NEWS update 2002-07-22 00:20:40 +00:00
435c2611fd ChangeLog update 2002-07-22 00:19:47 +00:00
Marcus Boerger 21da93abe1 unify error messages & notices
# this fixes exif again since it was broken by message unify
2002-07-21 22:38:23 +00:00
Georg Richter cbcdae7002 removed changes for mysql_select_db (optional parameter)
Why:
1) Its not the common way to add additionally functionality for functions or
features which are already implemented in SQL. Therefore also a lot of
mysql functions are marked as deprecated (and will be removed in near future)

2) The implemented workaround works only when mysql_select_db was called
before (fetching the databasename from mysql->conn.db). It returns invalid
or inconsistent results e.g.:

- when "USE databasename" via mysql_query was used
- when database was dropped or grant privileges had changed.

In conjunction with persistent connection, there are also some inconsistencies,
cause mysql_select_db returns the databasename from an old connection.

To determine the database name just use the SQL command "SELECT DATABASE()"
2002-07-21 21:36:10 +00:00
Georg Richter 96276bf8a0 fixed bug in mysql_real_escape_string:
allocated 1 more byte for '\0' terminating character
2002-07-21 20:16:03 +00:00
Andi Gutmans 8dd639ce22 - Fix bug reported by Sebastian where old constructors didn't work in
- nested classes.
2002-07-21 18:50:10 +00:00
Stig Bakken 27ac6946ad * yeah yeah 2002-07-21 16:17:18 +00:00
Stig Bakken 2b7461f585 * split #3 into two paragraphs again, like the Apache license we once
borrowed it from
2002-07-21 16:16:36 +00:00
Marko Karppinen b231fc0d35 Made PHP_ADD_LIBPATH use the $ld_runpath_switch and changed the Darwin
link lines in sapi/cli and sapi/cgi to use $NATIVE_RPATHS.
This is a tentative fix for #18450.
2002-07-21 14:42:01 +00:00
Sascha Schumann 2247d61e17 Move autoconf-2.13 check into buildcheck.sh where we already have
version parsing code and (more importantly) proper error checking
for missing autoconf.
2002-07-21 13:09:07 +00:00
Sascha Schumann 71e7b5cc99 One should not ignore
AC_PROG_CPP was called before AC_PROG_CC

because this error caused the Solaris issue
2002-07-21 12:54:06 +00:00
Stig Bakken f911cd5051 * bundle these releases 2002-07-21 07:40:18 +00:00
Stig Bakken 80b66c1567 * moved to /pear cvs 2002-07-21 07:38:15 +00:00
Yasuo Ohgaki 36e80ddc15 Added pg_fetch_all() that fetch all rows in result.
Useful and faster when there is enough memory.
@Added pg_fetch_all() that fetch all rows in result. (Yasuo)
2002-07-21 07:25:10 +00:00
Stig Bakken 5c770ace4f * already moved to /pear 2002-07-21 07:19:11 +00:00
Stig Bakken 783410e2bd * support "zend" dependency type 2002-07-21 07:18:49 +00:00
Stig Bakken 03b1160173 * moved to /pear cvs 2002-07-21 07:15:31 +00:00
Stig Bakken ca277b7a88 * added missing license element
* added "zend" dependency type
2002-07-21 07:06:56 +00:00
Stig Bakken f246ef4239 * always enable track_errors
* added throwError method (simpler version of raiseError)
2002-07-21 07:04:45 +00:00
Stig Bakken c02cb64be7 * license out of "alpha" 2002-07-21 06:53:17 +00:00
Stig Bakken d0f2e617ce * fixed some errors in package.xml 2002-07-21 06:35:55 +00:00
3ce3d54e43 ChangeLog update 2002-07-21 00:19:29 +00:00
James Cox aa84623d25 proper patch to cvsclean for bad autoconf. 2002-07-20 16:40:14 +00:00
foobar 7a5ac7cc9c I love rock'n'roll...laalalaa (britney sucks) 2002-07-20 15:17:51 +00:00
Sascha Schumann c2cc85d716 reverse bad patch
james, when you send me email about your patch which does not work,
why don't you wait for a reply first before committing the non-working
stuff?
2002-07-20 14:33:09 +00:00
Yasuo Ohgaki 78a2781936 Fixed php_pgsql_convert's bool type handling. 2002-07-20 07:45:01 +00:00
Yasuo Ohgaki 0b7f2da4cf Hmm. My PostgreSQL returns "bool" for boolean now. 2002-07-20 07:24:15 +00:00
Yasuo Ohgaki 06c969e68a Fixed convetion when null string is passed to php_pgsql_convert() 2002-07-20 07:08:17 +00:00
Yasuo Ohgaki c0306424fa Fixed crash. 2002-07-20 06:45:35 +00:00
James Cox dd16444849 more work for buildconf. forces a cvsclean if using a bad am. more ZE/zE2 tests. 2002-07-20 04:02:44 +00:00
Sascha Schumann aef27e37e1 Improve/fix handling of --disable-rpath
Might or might not fix #18374
2002-07-20 01:28:56 +00:00
61e5e9a93d NEWS update 2002-07-20 00:19:08 +00:00
5254ef8b05 ChangeLog update 2002-07-20 00:18:04 +00:00
Jason Greene 217ef0d115 Fix feof() on win32
Bug #18436
2002-07-19 20:34:35 +00:00
foobar 887e1ffe57 ws fix 2002-07-19 16:22:36 +00:00
Harald Radi cbe4f69663 - added a skeleton for new layers
- a bit cleanup
2002-07-19 16:19:00 +00:00
Yasuo Ohgaki fd428a4882 This option should be left enabled by default by mistake.
--enable-trans-sid option is removed and this option should
be disabled by default in php.ini.

1) It's insecure by nature
2) It may not work well always
3) It wasn't enabled by default used be
4) It risks security and user should enable it after realizing
   it's security risks.
2002-07-19 09:45:07 +00:00
Derick Rethans 70a5d29ece Unify error messages 2002-07-19 09:21:29 +00:00
Derick Rethans 2390cdafcf Unify error messages 2002-07-19 08:36:43 +00:00
Derick Rethans 7409f1cfd4 Unify error messages 2002-07-19 07:18:16 +00:00
eb14d0f8e7 ChangeLog update 2002-07-19 00:18:47 +00:00
Harald Radi c83f78dc96 ext/rpc/com should work now, but there's still lots of work left. 2002-07-18 18:31:37 +00:00
Derick Rethans 0650a59aea - MFZE1 - MacOSX fixes by Marko Karppinen 2002-07-18 11:16:34 +00:00
Yasuo Ohgaki 658503f6ee Move down open_basedir description. 2002-07-18 01:36:17 +00:00
ef8aad81e7 NEWS update 2002-07-18 00:20:49 +00:00
fb3f1709e8 ChangeLog update 2002-07-18 00:19:37 +00:00
Dan Helfman 2d695778e8 removing tclink extension so it can be moved to pear/pecl 2002-07-17 22:53:43 +00:00
Dan Helfman ee250fb4d6 new credit card processing module for TrustCommerce
http://trustcommerce.com/tclink.html
2002-07-17 22:07:05 +00:00
foobar 60ad61def7 We have a macro for checking -R, etc. switches. (exactly same code) 2002-07-17 21:56:40 +00:00
Andrei Zmievski 8e71a98cc9 Fix DL entry point. 2002-07-17 19:27:36 +00:00
Andi Gutmans 0355dc5504 - Remove code which wasn't supposed to go into the patch. 2002-07-17 18:39:26 +00:00
Andi Gutmans 9c52e883f0 - Rejuggle some code. 2002-07-17 18:36:29 +00:00
foobar a85f813b6c Remove evil quotes 2002-07-17 17:28:57 +00:00
Christian Stocker 2ba020d012 even more items on the TODO list 2002-07-17 08:59:05 +00:00
Christian Stocker bb069a1ccb nodename is not always set, check if it really is. 2002-07-17 08:57:29 +00:00
Hartmut Holzgraefe 40007c2049 Zend Engine behaviour is affected by setlocale() due to use of
locale aware functions like strtod(), atof(), tolower(), toupper() :(
2002-07-17 08:49:26 +00:00
Derick Rethans 9ae8c39bab - set_time_limit() now returns whether it succeeded in changing the time
limit.
2002-07-17 08:06:43 +00:00
Yasuo Ohgaki ba670fb19d Fixed build. 2002-07-17 07:50:32 +00:00
foobar e20b22fbc3 unbreak the shared build..again 2002-07-17 06:01:37 +00:00
Yasuo Ohgaki f4f8726b9e Accoding to safe_mode.h, php_checkuid() has six modes. 2002-07-17 05:15:17 +00:00
Yasuo Ohgaki a6384b3685 Added safe_mode & open_basedir checks for pg_lo_export()
@Added safe_mode & open_basedir checks for pg_lo_export() (Yasuo)
2002-07-17 05:01:58 +00:00
Yasuo Ohgaki 166ace3fa9 Added open_basedir check.
@ Added open_basedir check for pg_lo_import() (Yasuo)
2002-07-17 04:58:58 +00:00
Yasuo Ohgaki 02bc91f0bc Fixed open_basedir note - thanks to Sander. I also notice I have to modify pg_lo_import(), etc. It does not check open_basedir at all. It checks UID/GID, though. We are better to note how we should treat files in coding standard. 2002-07-17 04:20:37 +00:00
foobar ff012991f8 This was mentioned already above (with an example too :) 2002-07-17 03:46:55 +00:00
d6f74aeca8 NEWS update 2002-07-17 00:20:24 +00:00
8505e6ec1e ChangeLog update 2002-07-17 00:19:37 +00:00
Yasuo Ohgaki 7eecae7527 Changed configure option order to make it clear option dependecy to users. 2002-07-17 00:17:43 +00:00
Yasuo Ohgaki dc794edb1a Disable input encoding tranlation by default. 2002-07-17 00:11:32 +00:00
Yasuo Ohgaki ccc04b7096 Added note for open_basedir 2002-07-17 00:09:09 +00:00
foobar 390622df01 This is the real world.. 2002-07-16 19:47:51 +00:00
foobar dcb0523894 fix protos 2002-07-16 19:26:23 +00:00
Andi Gutmans 852f4f2c29 - Before I forget to list it, this was also added. 2002-07-16 19:16:53 +00:00
Andi Gutmans 3be1dd468e - Syntactic sugar - Add "public" as a synonym for "var".
- Now we have the three P's.
You can do:

<?
	class MyClass {
		public $a;
		private $b;
		protected $c;
	}

?>
2002-07-16 19:11:14 +00:00
Sascha Schumann 1326c95b29 refine 2002-07-16 16:24:15 +00:00
Georg Richter 6f2ad6b68b added mysql changes:
- php.ini option mysql.connect_timeout
- optional parameter client_flags (mysql_connect, mysql_pconnect)
- automatic rollback for non commited transactions
2002-07-16 14:31:55 +00:00
Jason Greene 9b68acb7f7 @Fixed infinite recursion crash bug in ticks (Jason)
Prevent reenterant calls to a user tick function by flagging the function
entry during call.

This prevents code like the following from infinitely recursing until a
crash occurs:
<?php

register_tick_function(a);

declare(ticks=1) {
	function a() {
		print "blah\n";
	}
	;
	;
	;
	;
}
?>
2002-07-16 14:14:22 +00:00
Georg Richter 950a576f73 Added support for php.ini parameter "mysql.connect_timeout" 2002-07-16 13:53:54 +00:00
Georg Richter ab863dee30 Added php.ini option "mysql_connection.timeout" 2002-07-16 13:52:23 +00:00
449327f57c ChangeLog update 2002-07-16 00:18:24 +00:00
Derick Rethans c652c4b512 - MFH of the crap removal 2002-07-15 18:11:04 +00:00
Andi Gutmans bc5ea87e28 - Commit patch to support protected member variables (by Timm Friebe w/
- some fixes by me).
- You can't access protected variables from outside the object. If you want
- to see a protected member from your ancestors you need to declare the
- member as protected in the class you want to use it in. You can't
- redeclare a protected variable as private nor the other way around.
2002-07-15 18:09:56 +00:00
Edin Kadribasic 50ca75a0f6 Fix bug #16985 (wrong count of GET/POST variables). 2002-07-15 17:48:54 +00:00
Stefan Esser 11ac4e035c use Zend API to access llist count 2002-07-15 16:37:15 +00:00
Anantha Kesari H Y 44bbec7acb mysql_create_db and mysql_drop_db disabled for NetWare 2002-07-15 11:14:18 +00:00
Yasuo Ohgaki a1f37648b3 Clean up code a little (Remove a use of magic number)
Change/add appropriate comments.
2002-07-15 10:04:01 +00:00
Andi Gutmans f7d9b9f1ae - Really implement bool increment/decrement as flip-flop. 2002-07-15 04:11:13 +00:00
Yasuo Ohgaki cb1c98762e Fixed news 2002-07-15 00:37:53 +00:00
Yasuo Ohgaki 160b74519f header sounds like http header. header -> header file 2002-07-15 00:35:46 +00:00
d399c486aa NEWS update 2002-07-15 00:22:42 +00:00
2fba341e07 ChangeLog update 2002-07-15 00:21:10 +00:00
Shane Caraveo 59e1b8e1c2 make this work with wsdl also 2002-07-14 22:57:53 +00:00
Andrei Zmievski 3650bab76f Fix Bug #18341.
@- Fixed cases where preg_split() incorrectly terminated final element if
@  it contained null byte. (Andrei)
2002-07-14 22:36:47 +00:00
Shane Caraveo da1a01ee93 a few fixes
fix __isfault
fix decimal encoding
fix a couple crashers in release builds by initializing variables
set http to 1.0 since 1.1 features are not really supported
2002-07-14 22:16:21 +00:00
Shane Caraveo eaf442b97f A start towards porting interop tests to php-soap 2002-07-14 22:14:38 +00:00
Andi Gutmans 7b68f5108a - Nuke delete(). It was a big mistake to introduce it and I finally
- understand why Java didn't do so.
- If you still want to control destruction of your object then either make
- sure you kill all references or create a destruction method which you
- call yourself.
2002-07-14 19:23:18 +00:00
Sascha Schumann cda0987153 it is not really cold though 2002-07-14 18:30:11 +00:00
Andi Gutmans 35e8d8139e - Nuke some unused code 2002-07-14 18:17:07 +00:00
Sascha Schumann b6aeeaea20 the sun was shining a few days ago 2002-07-14 18:15:08 +00:00
Sascha Schumann fa3d840cd1 integrate the public keep-alive patch
the patch did not handle pipeling at all, so that some code had to be added
from Premium thttpd

persistent connections are supported, if a script sets the Content-Length
header
2002-07-14 18:01:08 +00:00
Rasmus Lerdorf 6d992a9f0d Fix a couple of protos 2002-07-14 15:45:33 +00:00
Sascha Schumann b4c28fba7f thttpd blocks in rare circumstances where it cannot write out a small HTTP
response (happened at customer sites).  The response is now written out
using the standard state machine.

the buffer which is handed to thttpd by php is now simply dealt with as if
it were a thttpd generated response (avoids code duplication).
2002-07-14 13:48:46 +00:00
Sascha Schumann 402cc031cd make the sapi module hand off a buffer to thttpd for final data delivery,
instead of blocking the whole process
2002-07-14 13:10:34 +00:00
Derick Rethans 207845410b MFZE1 2002-07-14 11:48:45 +00:00
Derick Rethans dcd67e0b14 - MFZE1 2002-07-14 09:37:42 +00:00
Derick Rethans 643f21e840 - MFZE1 2002-07-14 09:29:42 +00:00
Yasuo Ohgaki 52f1ae5ac5 Move comment.
Remove a skip condition does not required.
2002-07-14 01:12:23 +00:00
foobar 02d3e99bf2 IF --disable-mbstr-enc-trans is used OR mbstring is compiled as shared
extension, these functions are not available.
2002-07-14 00:27:52 +00:00
f9710231fa ChangeLog update 2002-07-14 00:17:41 +00:00
foobar 7259893862 These options are all enabled by default. (why?) 2002-07-14 00:12:13 +00:00
foobar b87ac98701 These options are all enabled by default. (why?) 2002-07-14 00:11:44 +00:00
Yasuo Ohgaki 3639807a81 Fix tests. Moriyoshi Koizumi <readjust@deneb.freemail.ne.jp> 2002-07-14 00:08:22 +00:00
Sander Roobol 99b495b25d Fixed win32 build 2002-07-13 09:26:36 +00:00
foobar 7892e41645 Kill compiler warning 2002-07-13 08:42:38 +00:00
foobar 7e8aa50fe0 Fix SKIPs for these tests. 2002-07-13 08:08:36 +00:00
foobar f059932711 nuke unused variable warning 2002-07-13 07:10:59 +00:00
foobar efd065ff78 Fixed some unused variable warnings 2002-07-13 05:53:06 +00:00
foobar 0ace7f66f3 Nuke unused variable 2002-07-13 05:42:47 +00:00
foobar 3624b97ff1 Kill compile warning 2002-07-13 05:42:01 +00:00
foobar 71b0e91bad Really fix it this time.. 2002-07-13 05:01:55 +00:00
foobar e3797ab76a Fixed bug: #16638. 2002-07-13 04:45:21 +00:00
foobar 6a42e635ca Needed this to be able to test safe-mode stuff on cmd-line 2002-07-13 04:43:12 +00:00
foobar 2f8dc7a47c - Made the trim functions use same base function. (less code :)
- Renamed php_trim2 -> php_trim (not used anyplace else, yet)
- Made php_trim abit more usable for external use. (not necessary to use
  zvals with it anymore)
2002-07-13 04:13:43 +00:00
foobar 1e48f66729 Fixed the undefined reference to 'gdttf' errors when using bundled GD lib.
# I removed that in the first place..don't remember why. :(
2002-07-13 04:06:26 +00:00
Yasuo Ohgaki 4994b58c0b Fixed tests. Patch by Yoshimori Koizumi <readjust@deneb.freemail.ne.jp> 2002-07-13 01:05:13 +00:00
foobar 6f10116237 Fix bug: #18285, php_checkuid() mangled the passed path. 2002-07-13 00:52:18 +00:00
3bda0b40c2 ChangeLog update 2002-07-13 00:16:42 +00:00
foobar c7a68b78a7 - Fixed bug: #18268. If pcre is build as shared extension, we can't use
php_pcre_replace() here.
- Cleaned up a bit.
2002-07-13 00:15:22 +00:00
foobar 5d001a9ab6 Partially reverted the netware related commit. 2002-07-12 23:25:30 +00:00
foobar 20a735db2c Beauify a bit.. 2002-07-12 22:59:35 +00:00
foobar 21245bcbeb Some ws fixes. And removed the problems causing typedef for ushort. 2002-07-12 22:57:19 +00:00
foobar 48634e4026 - Fixed compile (bug #18297) on such systems which define uchar. 2002-07-12 22:34:43 +00:00
foobar 7b0b6d0b8c Bail out the given path does not have the libraries in it. 2002-07-12 22:11:54 +00:00
foobar 36fbe5c933 Fixed bug: #18295. e_os.h is not supposed to be included.. 2002-07-12 21:46:36 +00:00
Anantha Kesari H Y b6cc6a2376 File needed to build extensions for NetWare 2002-07-12 13:02:45 +00:00
Anantha Kesari H Y 2af885d467 Added NetWare changes 2002-07-12 12:55:56 +00:00
foobar 93f9acbffa Make configure stop if something is wrong with libraries/linking. 2002-07-12 12:13:45 +00:00
foobar ceadbe0e99 Fix ZTS build 2002-07-12 11:45:05 +00:00
Sebastian Bergmann bec1633335 Remove unused variables. 2002-07-12 04:57:14 +00:00
foobar 1b6e2cb0db missing entry for config.h.in 2002-07-12 04:41:48 +00:00
foobar 0dbd55581c .libs/ directories are created when building shared extensions. 2002-07-12 04:41:26 +00:00
foobar a96f15628c minor typo fixbug. 2002-07-12 02:37:48 +00:00
foobar ed58d3a235 - Added predefined constants for the upload errors.
- Removed the debugging error (not useful for end-users)
2002-07-12 01:49:58 +00:00
87e0a4baf5 NEWS update 2002-07-12 00:18:23 +00:00
bdf73348e2 ChangeLog update 2002-07-12 00:17:37 +00:00
foobar c334894a2b ws fix 2002-07-11 20:29:53 +00:00
Derick Rethans 6819ee3624 - Fix for bug #18283
#- It doesn't work from within a script anyways
2002-07-11 19:38:08 +00:00
Rui Hirokawa 555ca8eedd added mbstring.language option in ext/mbstring. 2002-07-11 15:45:35 +00:00
Tomas V.V.Cox 20ed142597 typo 2002-07-11 15:39:57 +00:00
Tomas V.V.Cox cefe27a480 Prepare package.xml for Net_SMTP 2002-07-11 15:36:48 +00:00
Sascha Schumann 6d643eb035 Break up the INSTALL_IT line into comprehensible pieces
and fix a bug related to [..] quotes.
2002-07-11 14:41:03 +00:00
Sascha Schumann 808f05c205 the variable interpolation was already subject to IFS treatment,
which resulted in the execution of the foremost directory.

we capture the output before setting IFS now
2002-07-11 13:33:22 +00:00
Adam Dickmeiss 6c19790778 yaz.max_links, yaz_log_file setting. User-defined Other Info 2002-07-11 13:04:03 +00:00
Adam Dickmeiss 377f5cfb13 Include YAZ support libs (if any) 2002-07-11 13:02:52 +00:00
Sascha Schumann ee619493b3 Use a simple IFS; set step to interprete the httpd -v output 2002-07-11 08:44:42 +00:00
Uwe Steinmann ecba0709e6 - added missing file 2002-07-11 06:35:28 +00:00
James Cox a234c521b9 adding patch from http://www.coupin.net/gd-freetype/ which makes images anti aliased (and therefore more readable).
#this does actually work.
2002-07-11 04:36:22 +00:00
Yasuo Ohgaki f3f3f76209 Added traslit test files. Moriyoshi Koizumi <readjust@deneb.freemail.ne.jp> 2002-07-11 03:44:12 +00:00
Yasuo Ohgaki 2e77bb3072 Fix #16069. Patch by Moriyoshi Koizumi <readjust@deneb.freemail.ne.jp>
@ Made iconv() work well with libiconv or libgconv. (Moriyoshi, Yasuo)
2002-07-11 03:37:28 +00:00
foobar 4d69e91806 Fix bug: #14052 2002-07-11 02:48:00 +00:00
foobar c8f5edec93 Fixed bug: #16637, username/password needs to be urlencoded. 2002-07-11 02:35:45 +00:00
foobar 0790c58f96 Fixed bug: #18250 2002-07-11 02:31:38 +00:00
foobar a17d934957 news-entry-robot(tm) 2002-07-11 00:57:28 +00:00
fa1bafe9a9 NEWS update 2002-07-11 00:19:46 +00:00
538880b14f ChangeLog update 2002-07-11 00:18:34 +00:00
Harald Radi 77f1d265be merging parts of the old com extension to the new rpc extension 2002-07-10 20:27:17 +00:00
Jason Greene d907b2d525 @Fixed socket_set_timeout on win32 (Jason, Edin, Jani) 2002-07-10 15:23:47 +00:00
Georg Richter 05007b0cbb 1) New constants:
MYSQL_CLIENT_SSL for ssl connections
MYSQL_CLIENT_COMPRESS for compressed protocol
MYSQL_CLIENT_IGNORE_SPACES for spaces after function names
MYSQL_CLIENT_INTERACTIVE for closing connections after timeout_interactive seconds

2) Optional parameter client_flags for mysql_connect and mysql_pconnect
For parameter desctiption see 1.
This also should fix bug #13589

3) New internal function _rollback_mysql_transactions, which is called via
PHP_RSHUTDOWN_FUNCTION
This fixes bug #12513
2002-07-10 13:16:24 +00:00
Stig Bakken b627e6e413 * signed these packages 2002-07-10 07:18:12 +00:00
82e8216ac7 ChangeLog update 2002-07-10 00:18:30 +00:00
Derick Rethans 2855b21e1c - Initialize var properly 2002-07-09 21:42:07 +00:00
Stig Venaas 910e6275d4 Hopefully fixes build with IBM's LDAP library 2002-07-09 20:54:49 +00:00
Harald Radi d90ca98223 add file again that andrei deleted by
accident (i don't want to blame anyone here)
2002-07-09 20:32:05 +00:00
Stig Bakken 0d6a49f48e * add HTTP package (signed) 2002-07-09 11:24:29 +00:00
Stig Bakken 5aab8b2b8b * tolerate $args being empty 2002-07-09 10:52:25 +00:00
Stig Bakken d90cada542 * tiniest optimization 2002-07-09 10:52:04 +00:00
Stig Bakken 0a6d81b56e * typo 2002-07-09 10:51:41 +00:00
61e87a9f66 ChangeLog update 2002-07-09 00:17:06 +00:00
Sterling Hughes 31d5c44ea5 eek 2002-07-08 21:12:07 +00:00
Sterling Hughes c28f8fca08 commit petr's sax handler patch 2002-07-08 21:04:59 +00:00
Andi Gutmans c28df01280 - Add TSRMLS_DC to prototype. 2002-07-08 18:44:05 +00:00
Andi Gutmans b4146638f0 - Fix TSRMLS_* stuff 2002-07-08 18:29:54 +00:00
foobar 6162414fd6 news update 2002-07-08 18:09:43 +00:00
foobar df9fc2bb51 Fix shared build and made the logic of finding the socket location better. 2002-07-08 15:31:01 +00:00
Derick Rethans 728f2de442 Unify error messages 2002-07-08 12:52:22 +00:00
Derick Rethans bd356fd0b9 Unify error messages 2002-07-08 11:52:57 +00:00
Derick Rethans fca0231206 - Add warning to is_*() functions if more than one argument was passed 2002-07-08 11:50:01 +00:00
Derick Rethans 392a452c80 Silence warning 2002-07-08 07:33:22 +00:00
Derick Rethans cc920570fd Unify error messages 2002-07-08 07:32:59 +00:00
Derick Rethans 7faa669915 - Fix for bug #14580: Made key() binary safe 2002-07-08 07:02:55 +00:00
foobar 2afacbf1cf These two can not be set in script. (so that they would have any effect) 2002-07-08 06:51:41 +00:00
Shane Caraveo a51e6a9400 a little more whitespace fix 2002-07-08 01:32:34 +00:00
Shane Caraveo ec3b1f1feb fix the line ending problems in the files 2002-07-08 01:23:06 +00:00
ab0eafc24b NEWS update 2002-07-08 00:17:28 +00:00
8e7219e123 ChangeLog update 2002-07-08 00:17:06 +00:00
Shane Caraveo f8875adaab import php-soap library from sourceforge 2002-07-07 23:03:43 +00:00
Sterling Hughes a6d815fb7c fix win32 build 2002-07-07 21:51:25 +00:00
Stig Bakken b85f40f079 * added "pear sign" command 2002-07-07 21:12:40 +00:00
Stig Bakken 24909111fc * use System::mktemp
* check if an install is about to overwrite existing files belonging
  to other packages, bail out if not in "force" mode
2002-07-07 21:10:29 +00:00
Stig Bakken 6e0745b57a * don't set include path if running 'pear.in' without substitutions
made by the installer
* sort command names in help output
2002-07-07 21:01:10 +00:00
Stig Bakken 81e5b17f91 * made rebuildFileMap method public, added caching and checkFileMap method 2002-07-07 20:48:54 +00:00
Shane Caraveo 8619108154 Let 'pear build' work on windows for building pecl extensions.
A few notes:
Currently only supports release builds, and of course, requires msdev!
pecl packages must have package.xml and xxx.dsp files for this to work
the package name in package.xml must match the name of the dsp file, so
package iisfunc must have dsp iisfunc.dsp
2002-07-07 20:47:57 +00:00
Stig Bakken 87f97ba5c9 * use System::mktemp rather than PEAR_Common::mkTempDir 2002-07-07 20:42:08 +00:00
Stig Bakken 38a56a51cc * silence warning 2002-07-07 20:41:20 +00:00
Andi Gutmans 1b5ac1386e - Path which should improve previous fix. 2002-07-07 19:59:37 +00:00
Andi Gutmans 4271895222 - First try at solving problem with different objects being allocated the
- same id.
2002-07-07 19:34:34 +00:00
Christian Stocker e5bcd202ce @ - Added domxml_node_namespace_uri() (Rui Lopes). 2002-07-07 17:19:29 +00:00
Jan Lehnardt afb93a20cb - fix #16290 2002-07-07 16:44:23 +00:00
foobar 2ca9ae687d - Fix the version check again. 2002-07-07 15:43:45 +00:00
foobar 9ba62685e1 cleanup 2002-07-07 14:09:48 +00:00
Stanislav Malyshev 0ed4f6d184 name length should be strlen+1 2002-07-07 13:06:58 +00:00
Sebastian Bergmann c9f1c9c19f Allow for 'class Namespace::Bar extends Foo' syntax. Patch by Timm Friebe <thekid@thekid.de>. 2002-07-07 08:22:23 +00:00
Sebastian Bergmann 72e7e4afd9 Fix warning. 2002-07-07 08:19:36 +00:00
Jason Greene 0cd2d8bd38 Remove sleep workaround, and fix the actual win32 memory leak which
was occurring in the error reporting system. The reason why sleepex appeared
to be working was because it suppressed EWOULDBLOCK errors in the example
(which was non-blocking)
@Fix win32 memory leak in /ext/sockets that would occur on any error condition
@Fix host resolution error messages on win32
2002-07-07 07:01:17 +00:00
foobar 5ea1e264ff ws fix 2002-07-07 00:55:51 +00:00
foobar d85eeba77c Fix the fix properly. 2002-07-07 00:54:38 +00:00
foobar b989395478 PHP_EVAL_LIBLINE must not reverse the order of libraries. 2002-07-07 00:47:16 +00:00
08f4a57cad ChangeLog update 2002-07-07 00:17:17 +00:00
foobar 7fe442f32b Added missing .libs entry 2002-07-06 23:57:30 +00:00
Andi Gutmans 677a9e8751 - Fix problem where scope was lost in nested function calls.
- Thanks to Timm Friebe for diving into this one.
2002-07-06 17:44:45 +00:00
Zeev Suraski 0ae66bd659 spelling fix 2002-07-06 16:48:13 +00:00
Christian Dickmann d04c8495d3 add local XMLRPC cache 2002-07-06 14:44:05 +00:00
Derick Rethans 7cdd6a6bb5 - Consistent error messages 2002-07-06 11:18:47 +00:00
e8c76f21ad ChangeLog update 2002-07-06 00:18:36 +00:00
foobar f56450ff14 Fix bug: #16707 2002-07-05 19:34:42 +00:00
Sascha Schumann e3e0dbf7b4 nuke another instance of newline suppression 2002-07-05 19:06:53 +00:00
foobar 6a83870c49 Fix typo 2002-07-05 18:32:08 +00:00
foobar 466208eafb Fix typo. 2002-07-05 18:16:31 +00:00
Rui Hirokawa ead78e9125 fixed shift_jis character corruption including 0x5c as second byte following a slash on uploaded filename. 2002-07-05 15:06:39 +00:00
Sascha Schumann 8366e6531a some seds want to see a newline, so we give them a newline
PR: #17072 and others
2002-07-05 06:42:31 +00:00
Sascha Schumann 30ed0ca993 Fix the Solaris issue where CPP was set wrongly to "cc -E", because
the AIX macro invoked the CPP check before the CC check, so that
autoconf did not know which $CC to use.

You can now close all those bug reports about unix.h and misdetected
headers.
2002-07-05 06:07:53 +00:00
Sascha Schumann af3871e44c Remove remainings of bsd_makefile 2002-07-05 06:02:19 +00:00
Dan Libby 2154e7b55b merged in updates from SF project. bring php repository up to date with xmlrpc-epi version 0.51 2002-07-05 04:43:55 +00:00
Stig Bakken eebae9f9ef * folding fixes 2002-07-05 02:34:54 +00:00
Stig Bakken 6b4707320d * define PEAR_ZE2 when running with Zend Engine 2 2002-07-05 01:52:09 +00:00
Stig Bakken c6ec881953 * fix segfault in case of odd version numbers 2002-07-05 01:00:05 +00:00
Stig Bakken 8b4a25ec13 (PHP version_compare) added "alpha" and "beta", make tests pass 2002-07-05 00:55:02 +00:00
0c4f0372e1 NEWS update 2002-07-05 00:18:30 +00:00
1cc956efee ChangeLog update 2002-07-05 00:17:42 +00:00
Sascha Schumann ad198758ed 1. PHP_CHECK_FUNC(func, lib1, lib2, ..., libn) searches for
func and __func using LIBS, and if unsuccessful, searches
   each specified lib.  Defines HAVE_FUNC, if found.  If func/__func is
   found in library foo, HAVE_LIBFOO is defined.

   (Jani, me)

2. Autoconf 2.5x is more pedantic regarding locating header files.
   We include the proper header files now in the check. (me)

3. The nsl/bind/socket/etc checks have been rewritten using PHP_CHECK_FUNC.
   This ensures that no extra library is used, if the symbol is
   available in libc which avoids issues on BSD/OS, OpenBSD and others.
   (Jani)
2002-07-04 21:07:08 +00:00
Martin Jansen 1b1d5da907 * Remove http:// from the proxy server string.
Patch by: "michiel bakker" <michiel_bakker@hotmail.com>
2002-07-04 20:28:56 +00:00
foobar b0ed560c95 @- Added optional 3rd parameter 'recursive' to ftp_rawlist() which will
@  do 'LIST -R' instead of 'LIST'. (Jani)
# tested too..and it even works. :)
# (removed that Z_TYPE_P() pollution also..)
2002-07-04 13:48:48 +00:00
Marko Karppinen a6eeec28b6 Moved the cgi link line to sapi/cgi/config.m4 and stopped
using libtool on Darwin on it
2002-07-04 08:39:11 +00:00
Sascha Schumann 8548b6390f Upgrade to the version shipped with automake-1.6.2 2002-07-04 08:21:32 +00:00
Sascha Schumann 2c3801b979 Generate content-type header, if the user did not specify one of its own.
Noticed by: Edin Kadribasic <edink@proventum.net>
2002-07-04 08:13:19 +00:00
b47ad58321 ChangeLog update 2002-07-04 00:17:56 +00:00
foobar bb0d7d6e31 - Let's be tad more verbose what's happening during 'make install' 2002-07-03 22:12:13 +00:00
Sebastian Bergmann 0e52055f70 Fix ZTS build. 2002-07-03 21:07:24 +00:00
Frank M. Kromann bda7548a00 Removed unneeded check for MBSTR_ENC_TRANS 2002-07-03 18:45:34 +00:00
Frank M. Kromann 720f4b8365 Added MBSTR_ENC_TRANS to allow compilation and linking under win32 2002-07-03 18:44:40 +00:00
Sascha Schumann ad8b4257a2 Please note that you need to use 'int' as a length type when
fetching strings.
2002-07-03 18:36:50 +00:00
Frank M. Kromann 9a743eef77 Adding _RU files to project 2002-07-03 18:24:14 +00:00
Frank M. Kromann 0818410f7c Fixing ZTS build 2002-07-03 18:23:55 +00:00
Frank M. Kromann fd348068f4 Adding missing prototype 2002-07-03 18:23:24 +00:00
Derick Rethans dfd8ea7147 - Fix README 2002-07-03 14:01:18 +00:00
Rui Hirokawa bb21c40738 fixed shift_jis character corruption including 0x5c as second byte on uploaded filename. 2002-07-03 13:36:19 +00:00
Sterling Hughes f7a5c05bb6 formatting fixes 2002-07-03 12:02:17 +00:00
Sterling Hughes 51e5a578b7 fix bug #17963 2002-07-03 11:50:00 +00:00
Sascha Schumann b3e562f9ef Add CRLF after complete HTTP reply header 2002-07-03 11:46:37 +00:00
Sascha Schumann 99cfb41da0 Use "Status: %d" instead of "HTTP/1.0 %d X" in the CGI SAPI module
as per the CGI RFC.

The status notation is incompatible with Apache's non-parsed-header mode
"nph-*", but that has never worked before anyway.  One could make the
format string configurable.

Noticed by: Sebastian Bergmann
2002-07-03 11:44:48 +00:00
Edin Kadribasic 9dcfbf41fa Fixed win32 build. 2002-07-03 10:54:42 +00:00
Sascha Schumann fee236fb80 fix typo 2002-07-03 10:47:16 +00:00
Sascha Schumann 9c876ea01a Add sapi_header_op interface which supersedes the sapi_add_header and _ex
calls.

Revert the change to the sapi_add_header_ex interface.

Fix various bugs:

1.  header("HTTP/1.0 306 foo");
    header("Location: absolute-uri");

    did not work in combination with several SAPI modules, because
    http_status_line was never properly reset.  And thus, all SAPI
    modules which looked at http_status_line ignored the changed
    http_response_code.

2.  The CGI SAPI did not send out the HTTP status line at all, if
    http_status_line had not been set explicitly by calling
    header("HTTP/1.0 200 foo");
2002-07-03 10:42:31 +00:00
Derick Rethans c73733c59a - Fix windows build
#- I could not test this, please try!
2002-07-03 06:45:01 +00:00
Uwe Steinmann 47b5b8da58 - fixed bug in hwnew_new_document_from_file 2002-07-03 06:10:29 +00:00
foobar 980d7a11a9 Fix the nasty crash. And Sterling..test next time before you commit? 2002-07-03 03:18:55 +00:00
foobar 29aae162e0 ws fix 2002-07-03 02:16:46 +00:00
0f8945edb5 NEWS update 2002-07-03 00:17:56 +00:00
db026cd876 ChangeLog update 2002-07-03 00:17:40 +00:00
Frank M. Kromann 8a7c339974 Add default arguments to new internal mail function. 2002-07-02 23:46:15 +00:00
Frank M. Kromann d305126002 Make sure To addresses are parsed correct with RFC822. 2002-07-02 23:45:32 +00:00
Frank M. Kromann e2c5462d91 Oops. Last commit reverted some of sebastians changes. 2002-07-02 23:44:06 +00:00
Marcus Boerger b634ec9e30 -fix datatypes for some vriables
-fix comment for function exif_process_CME
-force return parameters to be passed by reference
#this should kill warnings on win systems as found by Edin
2002-07-02 22:38:37 +00:00
Frank M. Kromann 57ec06677f Switch from imap_sendmail.* to sendmail.c under Win32 2002-07-02 22:29:13 +00:00
Frank M. Kromann a66cbb8e07 Fixing compilation of FrontBase extension with ZTS 2002-07-02 21:36:11 +00:00
Sterling Hughes d4512030bb use access instead of manually determining file permissions.. 2002-07-02 21:02:34 +00:00
Frank M. Kromann 407a0ec66a Switch from imap_sendmail.* to sendmail.c under Win32 2002-07-02 19:29:15 +00:00
Frank M. Kromann 1565e5d1bc These files are no longer needed as the imap module will use the standard sendmail function under Win32 2002-07-02 19:28:32 +00:00
Derick Rethans f7cab95a7d - Be nice to users and allow them to check if the mail was send 2002-07-02 14:22:22 +00:00
Derick Rethans 0d61ab3814 - Disable 5th parameter to mail in safemode
@- Disabled the fifth parameter to the mail function in safemode. (Derick)
2002-07-02 13:56:47 +00:00
Christian Dickmann a6783f8070 make 'remote-info' use package.info. add deps to 'list-all' 2002-07-02 13:04:01 +00:00
Sascha Schumann 03c034b6d6 Avoid error messages, if the variable is empty.
./config.status: test: !=: unary operator expected
2002-07-02 09:31:33 +00:00
Derick Rethans 7b7608d630 - Fix for bug #15547 (Patch by Justin Garrett <usjgarrett@byu.edu>) 2002-07-02 06:16:35 +00:00
7e921b42a4 ChangeLog update 2002-07-02 00:37:08 +00:00
Marko Karppinen 23de5d1c20 - You don't need libtool to build sapi/cli on Darwin.
- We don't need libtool to build sapi/cli on Darwin.
- You want the sapi/cli build line to be in sapi/cli, not Makefile.global.
- We want the sapi/cli build line to be in sapi/cli, not Makefile.global.
- He can go about his business.
- You can go about your business.
- Move along.
- Move along. Move along.
2002-07-01 21:17:39 +00:00
Derick Rethans d73eed9210 - No C++ comments 2002-07-01 18:52:30 +00:00
Marko Karppinen 7cd7c55148 In Darwin we have this thing called two-level namespace 2002-07-01 18:19:27 +00:00
Andi Gutmans 57b853c831 - Fix bug when acccessing $this not in class scope. 2002-07-01 15:13:39 +00:00
Christian Stocker e1483035b6 outcomment everything related to domxml_elem_set_attribute_node(). This
function is not implemented and shouldn't show up at all for the time
being
2002-07-01 14:48:38 +00:00
foobar 4b321b0430 Fix win32 build. 2002-07-01 09:00:00 +00:00
Andi Gutmans 4a52b98835 - Export zend_object_get_address() 2002-07-01 04:21:40 +00:00
James Cox 799cc612b4 "-" is not acceptable in a #define (i have since discovered). converting all - to _ is the right thing to do.
# should we issue a warning here too?
2002-07-01 01:01:06 +00:00
acac7af404 ChangeLog update 2002-07-01 00:24:52 +00:00
Andi Gutmans 4d1321afbc - Remember to document autoload when I have time. 2002-06-30 19:55:50 +00:00
Sander Roobol d325d07b1a Main script should not be parsed when (include|require)_once()'ed, #17720
# Derick, MFH?
2002-06-30 13:38:16 +00:00
Derick Rethans bf4e59449b - MFZE1 2002-06-30 11:18:43 +00:00
Derick Rethans 7115041c92 - More error messages cleanup 2002-06-30 11:14:27 +00:00
foobar 3c873776b8 Fix bug: #16252 2002-06-30 05:10:40 +00:00
foobar 905f56fd7d This does not work with AIX find.. 2002-06-30 04:26:05 +00:00
cfc2259d13 ChangeLog update 2002-06-30 00:22:49 +00:00
foobar e4e796064c - Upgrade bundled libtool to 1.4.2. Following stuff mentioned at:
http://www.gnu.org/software/libtool/news.html

  * Diagnose and warn about not-quite-working combinations of gcc and ld on Solaris.
  * Improved OpenBSD support.
  * Improved cygwin support.
  * Bugfixes.
2002-06-29 23:24:48 +00:00
Andi Gutmans f24cb9731c - Get ready for alpha2 2002-06-29 19:37:10 +00:00
Sascha Schumann 71a603ea32 Fix some 8bit issues with IRCG nickname encoding and
Change the underlying interface of smart_str to accept unsigned char.
2002-06-29 18:46:49 +00:00
Derick Rethans dc900d4f77 Unify error messages part 1 2002-06-29 17:40:28 +00:00
Andi Gutmans 401c26fb5e - Invalid -> Undefined 2002-06-29 16:01:40 +00:00
Derick Rethans 06ad4767e3 - Fix GD build with GD 1.8.3 2002-06-29 15:54:02 +00:00
Derick Rethans 1bf9b3d736 - Fix for bug #17654 2002-06-29 15:39:41 +00:00
Andi Gutmans 5f2fcdd689 - Add missing semi-colon. 2002-06-29 15:38:40 +00:00
Andi Gutmans ede84fa384 - Improve some error messages. 2002-06-29 15:30:27 +00:00
Andi Gutmans 20d02565df - Revert previous fix. 2002-06-29 11:24:11 +00:00
Thies C. Arntzen 5a0c283700 fix leak 2002-06-29 11:13:03 +00:00
Sergey Kartashoff 46079bc015 Search example (which demonstrates using of mnogosearch API) is updated. 2002-06-29 10:42:54 +00:00
Andi Gutmans 6116145f9f - Change E_ERROR -> E_COMPILE_ERROR where needed. 2002-06-29 08:42:17 +00:00
Andi Gutmans dd8df52223 - Fix for bug #17882. We complain if the same method is declared twice. 2002-06-29 08:38:24 +00:00
Andi Gutmans 6339bd5912 - Fix bug 15037
- Bump version to alpha2-dev
2002-06-29 07:35:41 +00:00
James Cox 8c49132266 fixes extensions with "-"
# thanks Rasmus for pointing out.
2002-06-29 02:34:36 +00:00
foobar 4a4abfa65d Fix some build error on win32 (snapshot build) 2002-06-29 02:12:42 +00:00
James Cox cd5fe093b3 make this build too. 2002-06-29 02:03:36 +00:00
James Cox 2ba3ae05bd removed these files from build. 2002-06-29 02:01:32 +00:00
James Cox 3ec40a8d32 really fix it.
# can anyone recommend an optician?
2002-06-29 01:58:07 +00:00
foobar 158370464a This is not done anymore. (should fix win32 snapshot build too) 2002-06-29 01:55:36 +00:00
James Cox 3ef1fe2b68 fixes bug #17453 2002-06-29 01:41:03 +00:00
foobar adade98519 - Fix the shared problem. (the previous patch really didn't fix anything) 2002-06-29 01:19:35 +00:00
foobar 0ffb2c25cf Missing TSRMLS_* stuff 2002-06-29 00:40:34 +00:00
foobar 999d9aa10f Better fix it here too.. 2002-06-29 00:33:02 +00:00
7e5b2f2165 ChangeLog update 2002-06-29 00:30:30 +00:00
Rasmus Lerdorf 03b76b278e Oops, extra pipe snuck in 2002-06-29 00:12:46 +00:00
Rasmus Lerdorf 02022179c9 Fix for bug #18055 2002-06-28 23:57:15 +00:00
Anil Madhavapeddy ed6b43582e remember the value of ext_shared passed into the --with-pdflib, since it
gets overwritten by future PHP_ARG_WITH checks in the same m4 fragment

from wilfried@openbsd.org
2002-06-28 16:47:36 +00:00
Andi Gutmans 1f6cadcd28 - WS fix 2002-06-28 15:30:03 +00:00
Sebastian Bergmann 836d9c3e9f Mention Apache 2.0.40. 2002-06-28 15:16:28 +00:00
Derick Rethans 0c8d24b53a - More gotchas... 2002-06-28 15:08:20 +00:00
Derick Rethans 787ee41beb - Fix more TSRM gotchas 2002-06-28 14:51:12 +00:00
foobar 21debac333 Require 2.0.40 2002-06-28 14:48:37 +00:00
Derick Rethans 2fda2eb4a8 - YAAC: I hope this is the last one! 2002-06-28 14:45:10 +00:00
Derick Rethans ea7653f667 - Fix TSRM gotcha 2002-06-28 14:35:20 +00:00
foobar 29a2967936 t1lib.h needs to be included here now. 2002-06-28 12:46:07 +00:00
foobar e2eaa0261a Moved all gd.h related stuff to gd.c 2002-06-28 12:35:30 +00:00
foobar 569da8b3bf Remove unnecessary #include's 2002-06-28 12:25:57 +00:00
foobar 78adadafc4 Remove unused files. 2002-06-28 12:23:20 +00:00
Derick Rethans b7ffa6033b Unify error messages 2002-06-28 10:52:11 +00:00
foobar 32e08c7e52 Fix bug: #14735 2002-06-28 09:53:25 +00:00
foobar ab0d5fecd3 Fix bug: #17528, do not crash with empty string. 2002-06-28 09:23:50 +00:00
foobar f4699170fc Fixed bug: #17491 (honor INSTALL_ROOT) 2002-06-28 09:01:56 +00:00
foobar 316a8b0b4f - Fix annoying redefine warning..
# ZAK! Heads up and fix this in Mysql CVS too.
2002-06-28 08:34:34 +00:00
foobar feb450bae7 - Fix bug: #17671 2002-06-28 07:47:19 +00:00
Derick Rethans 4330c0d9f3 - Fix for bug #18039 2002-06-28 07:12:32 +00:00
Derick Rethans b24c24969c Unify error messages 2002-06-28 06:43:17 +00:00
foobar 087f2be56f - Fixed bug: #17977, session build as shared works now with mm handler too.
- Added listing of save handlers into phpinfo() output
2002-06-28 02:27:02 +00:00
40b62da9aa ChangeLog update 2002-06-28 00:22:12 +00:00
foobar 2f492735f4 Fix bug: #18008 2002-06-27 23:56:27 +00:00
foobar 1f2c1d8093 Consistency fix. 2002-06-27 23:05:11 +00:00
foobar c8f3357586 - Fixed bug: #15595 (and possibly others too) 2002-06-27 22:16:53 +00:00
Sander Roobol 609e134871 Update configure line in phpinfo() after re-running configure without
running make clean first, bug #18012.
2002-06-27 10:01:06 +00:00
Derick Rethans 78ed8dcb7d Unify error messages 2002-06-27 06:54:51 +00:00
Derick Rethans 51dfe5eebe Unify error messages 2002-06-27 06:49:02 +00:00
Derick Rethans a954dd6ee9 - Remove \n 2002-06-27 06:24:26 +00:00
foobar e6921a7b23 - Cleaning up the mess..these are NOT zvals. 2002-06-27 01:47:36 +00:00
5bb94cb3a2 ChangeLog update 2002-06-27 00:22:58 +00:00
foobar 7eb0741a68 - Fixed bug: #17999
- The errors should always be stored, but they are not supposed to be
  shown at request shutdown unless E_NOTICES are allowed.
2002-06-26 23:28:31 +00:00
Anil Madhavapeddy 639d607db6 use LIBNAME consistently. Useful on systems like OpenBSD where the curses
library is called 'curses' and not 'ncurses'
2002-06-26 22:22:47 +00:00
Anil Madhavapeddy 34b3fbd153 the ncurses_getch() is in the wrong place and never gets run 2002-06-26 22:20:09 +00:00
foobar 34de1f6578 Better not pollute the EXTRA_LIBS with libpaths. 2002-06-26 21:44:58 +00:00
Marcus Boerger d96924ffc5 -xbuf_resize does not need to have return value 2002-06-26 21:03:28 +00:00
Derick Rethans d812929d2f - Implement Andrei's request for disabling memory leak reporting in debug
builds.
#- Andrei: I can show you the logs :)
2002-06-26 19:43:46 +00:00
Derick Rethans ea303541f8 - And the SAPI too 2002-06-26 18:58:49 +00:00
Derick Rethans 3696bc781a - Update credits 2002-06-26 18:58:25 +00:00
Derick Rethans e1c2e158ff - Update TODO 2002-06-26 18:49:42 +00:00
Derick Rethans 734496b44f - Nuke some TSRMLS_FETCHes 2002-06-26 18:49:08 +00:00
foobar 049042851a silence the warning when glibtool is not found.. 2002-06-26 18:42:50 +00:00
Derick Rethans b5c0408594 - Fix build
#- Please test next time! This file is never installed with a default gd
#  install
2002-06-26 18:32:27 +00:00
Derick Rethans d1c4ea779b - Let make clean follow symlinks (tested on Linux, IRIX, Solaris, FreeBSD
and Tru64)
2002-06-26 18:19:34 +00:00
Andi Gutmans 737de1bd0c - Autoloading support based on patch from Ivan Ristic.
- Again I hope this feature ends up working well because if it doesn't we
- might need to nuke it. This only works for global scoped classes and it
- will never work for sub-classes so don't even ask!!!!!
- Just define an __autoload() function in the global scope and it will be
- called with the class name as the parameter if it doesn't manage to find
- the class.
2002-06-26 15:13:14 +00:00
Andi Gutmans 28247f572a - Centralize global class fetch 2002-06-26 14:24:23 +00:00
Derick Rethans f9b21c4b7d - Fix typo 2002-06-26 13:07:40 +00:00
Andi Gutmans b55a20abf4 - Fix problem with scope's not changing correctly during method calls.
- Reapply a tiny optimization to the allocator so that in non-debug mode
- we clean memory without detecting leaks.
2002-06-26 11:07:35 +00:00
Derick Rethans 1d5ab209eb - Unify error messages
#- This is the last one for today... can't really stand another
#  get_active_function_name(TSRMLS_C)  :)
2002-06-26 09:09:35 +00:00
Derick Rethans ef591e5b81 Unify error messages 2002-06-26 08:57:18 +00:00
Derick Rethans 20213ed1b7 Unify error messages 2002-06-26 08:48:55 +00:00
Sascha Schumann 6039cd5a01 Prefer glibtool over libtool for Mac OS X compatibility
Submitted by: various people, including blakers@mac.com
2002-06-26 08:39:55 +00:00
Derick Rethans 6540bebab4 Unify error messages 2002-06-26 08:39:52 +00:00
Derick Rethans e7d006fa31 Unify error messages 2002-06-26 08:32:25 +00:00
Derick Rethans 7d4a78bad5 Unify error messages 2002-06-26 08:07:59 +00:00
Sascha Schumann ee477dbc56 Fix code which makes wrong assumptions about the return value of snprintf.
The AOLserver module did not use the return value, so simply drop it.
2002-06-26 07:54:50 +00:00
Derick Rethans f57306cdd9 Unify error messages 2002-06-26 07:54:00 +00:00
Andi Gutmans 1f58a8f087 - No idea why this wasn't crashing before. 2002-06-26 07:36:01 +00:00
Derick Rethans 8967b5725b Unify error messages 2002-06-26 07:24:47 +00:00
Derick Rethans 2d1b304781 - Unify error messages 2002-06-26 06:49:25 +00:00
9c03caadec ChangeLog update 2002-06-26 00:22:12 +00:00
Marcus Boerger 67bfbbe881 map imageellipse to imagearc if missing
fix warnings
2002-06-25 22:23:41 +00:00
Marcus Boerger 43ec2dfa59 bits/channels for gif 2002-06-25 21:22:14 +00:00
Tomas V.V.Cox ba7bdbdb65 change the include_path setting to be in the php space instead
of doing in the interpreter line (seems to break FreeBSD)
2002-06-25 13:45:29 +00:00
Christian Stocker d68707a2c9 should compile on windows again 2002-06-25 09:46:15 +00:00
Christian Stocker 15416d6797 include libxml/parserInternals.h 2002-06-25 09:19:20 +00:00
Marcus Boerger 33b5d72f6c imageellipse is removed in 2.01
#maybe someone reintroduces this one in bundled lib?
2002-06-25 09:00:09 +00:00
Derick Rethans ac52d75cd0 - Update NEWS 2002-06-25 06:37:57 +00:00
Markus Fischer c15d83b9ed - Fix proto. 2002-06-25 06:24:45 +00:00
e59d81b9fc NEWS update 2002-06-25 00:27:57 +00:00
26d98b5b0a ChangeLog update 2002-06-25 00:27:38 +00:00
foobar 8bff7ccd8d Minor cleanup. 2002-06-24 22:43:47 +00:00
Marcus Boerger 46a373ba70 modified test3 (old one had a warning) 2002-06-24 22:22:42 +00:00
Marcus Boerger ba6498e4c5 missing return value 2002-06-24 22:00:22 +00:00
Marcus Boerger 9fe5a514f0 cleanup 2002-06-24 20:51:52 +00:00
Andi Gutmans 136b92e33a - MFZE1 (Turn off fast cache until we make sure it performs well.) 2002-06-24 19:41:06 +00:00
Marcus Boerger cccc4e3c5a register IMAGETYPE_<xxx> constants in image.c as they are needed
there.
2002-06-24 19:36:26 +00:00
Derick Rethans 2a6980a720 - Make functions not exist when they are not available. This means you can
now safely do function_exists() on all gd functions.
2002-06-24 19:31:44 +00:00
Marko Karppinen ec88777f59 Revert to php_4_2_1 to get sablotron working again.
# Sterling, please fix the DOM stuff asap so we can enjoy
# the new functionality!
2002-06-24 19:31:31 +00:00
Marcus Boerger 48bdf08edb @GetImageSize now allways set fields unknown to 0 and new Imagetype
@iff. (Marcus)
2002-06-24 19:19:08 +00:00
Andi Gutmans c6b39eb50d - More fixes (warnings, bug fixes etc.) 2002-06-24 18:49:13 +00:00
Christian Stocker b6440188b1 added some points to the todo list 2002-06-24 18:02:48 +00:00
Andi Gutmans 68663bf96b - Revert patch which checks at run-time if you're allowed to assign
- certain values by reference.
- We still need to find a solution for cases when this shouldn't be allowed
- as it might cause leaks.
2002-06-24 17:58:22 +00:00
Andi Gutmans 8fd5e70e2d - Fix crash bug and clean up a bit. 2002-06-24 17:47:46 +00:00
Sebastian Bergmann 1ae6ee5458 IMHO, ZTS should no longer be labeled experimental. 2002-06-24 16:10:33 +00:00
Rasmus Lerdorf 890e01bebe @ Add runtime Apache2 thread check to ensure we don't run a non-threaded
@ PHP inside a threaded Apache2 MPM.  (Rasmus)
2002-06-24 16:04:20 +00:00
Martin Jansen 2fec25ad73 * Rephrase help text. 2002-06-24 16:03:45 +00:00
Rasmus Lerdorf 8a2ab01744 @ Turn off ZTS if Apache2 is using the prefork MPM. (Rasmus) 2002-06-24 14:51:01 +00:00
foobar 08b1d08008 - gethostname() is found in glibc (at least on Linux) and the yp_* funcs
are in libnsl. Fixes bug: #17941
2002-06-24 14:36:09 +00:00
Andi Gutmans 95e0bb6a4b - MFZE1 2002-06-24 13:45:21 +00:00
Andi Gutmans 2172abcb0a - Don't use cache if we're using ZEND_MM 2002-06-24 13:41:26 +00:00
Andi Gutmans 3b8cd875ab - Hardcode alignment to 8. We might need a configure check for this. 2002-06-24 13:21:49 +00:00
Andi Gutmans 15d7936601 - Improve memory manager to allocate small blocks quickly. 2002-06-24 12:39:08 +00:00
foobar 3d799b5db4 Fixed PHP_ADD_LIBRARY_DEFER_WITH_PATH to work with shared builds. 2002-06-24 11:36:21 +00:00
foobar f0998192b4 No need to have multiple AC_CHECK_FUNCS calls 2002-06-24 09:25:51 +00:00
Andi Gutmans 1c20bf27da - Don't keep allocated blocks in a linked list if we're in non-debug mode
- as now the memory manager takes care to nuke all leaking blocks.
2002-06-24 07:22:25 +00:00
Andi Gutmans ba72dbf37a - MFZE1 2002-06-24 07:11:12 +00:00
Sascha Schumann 5278f12e22 iterate through passed arguments 2002-06-24 03:05:00 +00:00
6a64ee774b ChangeLog update 2002-06-24 00:24:35 +00:00
Edin Kadribasic 2183565321 Allow dynamically compiled extensions to use gettimeofday() on win32. 2002-06-23 23:22:33 +00:00
Sterling Hughes 8a04592352 standardize a bit (we know its enabled :) 2002-06-23 22:44:29 +00:00
Marcus Boerger 302bfefac7 explain difference between sprintf, snprintf and spprintf
#before complaining snprintf is often used wrong:
#snprintf does not terminate the buffer but most people expect it
#that could be a security isuue at somewhere
2002-06-23 22:16:35 +00:00
Marcus Boerger 02ac908307 #some sentences about the functions 2002-06-23 22:12:22 +00:00
Marcus Boerger db39a2efa7 -freeing memory for pbuf=NULL
#should have been one commit but to many versions during tests
2002-06-23 22:10:30 +00:00
Marcus Boerger d3222bb5b7 -allow pbuf = NULL in case of NO MEMORY, too 2002-06-23 22:06:52 +00:00
Marcus Boerger fd4d8d5450 -allways terminate buffer
-allow pbuf parameter to be NULL for buffer size calculation
2002-06-23 22:02:35 +00:00
James Cox 372cab27ad some people would prefer to be able to specify. So, we specify --ZendEngine2 for ZE2 builds, Zend for the rest. 2002-06-23 16:31:54 +00:00
James Cox bca90b0796 changing this to mv ZendEngine2 Zend instead of shell logic that isn't portable. 2002-06-23 15:47:40 +00:00
Andi Gutmans 9c148f0d84 - Fix problem with constructor not being inherited and called correctly. 2002-06-23 15:46:58 +00:00
Andi Gutmans fd904b8e69 - Fix small bug 2002-06-23 10:49:21 +00:00
Andi Gutmans 41d85e4ec7 - Almost completely implement realloc(). It now resizes in place when
- possible.
2002-06-23 10:46:27 +00:00
Marcus Boerger 761e234a43 -unlimited php_printf 2002-06-23 00:57:01 +00:00
Marcus Boerger 1f56d4ba08 -imagetype2mimetype renamed to image_type_to_mime_type 2002-06-23 00:43:11 +00:00
Marcus Boerger 16a753d3c2 -new test for WinXP tags 2002-06-23 00:39:34 +00:00
Marcus Boerger b21a4d7fa9 -fix test results 2002-06-23 00:38:25 +00:00
Marcus Boerger 6ff0a9ee4a -make it run again 2002-06-23 00:37:16 +00:00
Marcus Boerger 76aa60d4e4 -compiler warning (missing data type) 2002-06-23 00:34:47 +00:00
Marcus Boerger 966e1d450e -corrected test result 2002-06-23 00:26:34 +00:00
61adf3e530 NEWS update 2002-06-23 00:24:35 +00:00
1154cdccc7 ChangeLog update 2002-06-23 00:24:17 +00:00
Marcus Boerger d782c712ca -exif version
-missing constant (and notice)
-corrected error messages
2002-06-22 23:43:16 +00:00
Marcus Boerger 4c53f954be @exif_read_data returns mime-type now for image and thumbnail And exif_thumbnail now optionally returns imagetype. (Marcus)
#So now you can use imagetype2filetype with exif_thumbnail
2002-06-22 18:38:33 +00:00
Marcus Boerger c8f1529d08 @GetImageSize now returns additional index 'MimeType' and new function
@imagetype2mimetype to convert php imagetypes to mime-types. (Marcus)
#the reason why i export php_imagetype2mimetype is that i use that for
#exif, too. Followup example will explain why.
2002-06-22 18:14:39 +00:00
Marcus Boerger d4b1909afe ws fix 2002-06-22 17:09:28 +00:00
Andi Gutmans 7f226a6b19 - Fix crash when zend_mm_shutdown is called more than once. 2002-06-22 16:09:15 +00:00
Stig Venaas 58ce28e588 Better not include ldap_parse_result() and ldap_start_tls() at all in
the symbol table when they are not usable. Makes it possible to check
on their usability.
2002-06-22 15:41:39 +00:00
Sander Roobol d279a92242 Made php_admin_value work outside <location> and <directory> blocks. 2002-06-22 15:31:44 +00:00
Andi Gutmans e2f57d0fcc - MFZE1 2002-06-22 14:37:49 +00:00
Andi Gutmans 805a1653f0 - Revert WS changes 2002-06-22 13:59:13 +00:00
Andi Gutmans 85983fe957 - This shouldn't have snuck in. 2002-06-22 13:58:32 +00:00
Andi Gutmans 4216379152 - Stop using persist_alloc(). 2002-06-22 13:53:44 +00:00
Andi Gutmans b53569c9e8 - Nuke persist_alloc(). 2002-06-22 13:52:07 +00:00
Stig Venaas c83f5a530d Added test for ldap_start_tls_s() 2002-06-22 11:41:36 +00:00
Den V. Tsopa f26fbd2bd5 small fix in preprocessor directive 2002-06-22 08:01:57 +00:00
30f8e36f0e NEWS update 2002-06-22 00:28:07 +00:00
4bbb858eb5 ChangeLog update 2002-06-22 00:24:42 +00:00
Markus Fischer d01f7a8a52 - Fix ZTS build, see #17915. 2002-06-21 22:22:46 +00:00
Stefan Esser 44a5b43b79 Fixing the same possible memory leak. 2002-06-21 14:47:59 +00:00
Edin Kadribasic 2203ef1979 Made pgsql compile on win32 again.
All defines regarding libpq capabilities are kept in ext/pgsql/pgsql.dsp
where HAVE_PQESCAPE is already defined.
2002-06-21 13:11:47 +00:00
Stig Bakken 7914985b1a * typo 2002-06-21 13:11:04 +00:00
Harald Radi 5a6a5bc609 removed CONST_EFREE_PERSISTENT so that andi can commit his patch
# _now_ it should work
2002-06-21 10:43:45 +00:00
Harald Radi 5dbd205bf7 removed CONST_EFREE_PERSISTENT so that andi can commit his patch
# second try
2002-06-21 10:35:33 +00:00
Harald Radi ed1b5c0388 removed CONST_EFREE_PERSISTENT so that andi can commit his patch
# this is one of these nice patches where you only remove something :)
# i still don't get what CONST_EFREE_PERSISTENT should have done
# there but the cvs log says that i can blame zeev :-P
2002-06-21 10:02:26 +00:00
Derick Rethans 6869cb3f5a - Added a new parameter to the header() function which overrides the HTTP
response code.
@- Added a new parameter to the header() function which overrides the HTTP
@  response code. (Derick)
2002-06-21 09:31:21 +00:00
Stig Bakken 0f4ccfaa27 * bending over backwards to find sensible defaults 2002-06-21 06:08:54 +00:00
b4ab0afa8e ChangeLog update 2002-06-21 00:20:31 +00:00
foobar e79b06fc02 Make this extension compile as shared extension too. 2002-06-21 00:15:48 +00:00
Sander Roobol 7c4ad7eda4 ZTS fixes
# if this breaks something, please let me know... i've got really no
# idea what i'm doing but this fixes the ZTS build :)
2002-06-20 20:13:20 +00:00
James Cox 3b58ead0be oops.. 2002-06-20 08:42:08 +00:00
James Cox 265f2d653a make "make snapshot" work again..
# is this actually used?
2002-06-20 08:36:48 +00:00
James Cox 337e158d40 fixing to permit builds with ZE2 2002-06-20 08:21:20 +00:00
Uwe Steinmann 662962f25c - take version of libxslt and libxml from runtime variables to make
sure the reported versions correspond to the actually installed
	versions of libxml and libxslt
2002-06-20 05:48:45 +00:00
c7af8c422a ChangeLog update 2002-06-20 00:27:26 +00:00
Tomas V.V.Cox 77acb22bba - Force params to version_compare() to be strings, otherwise some
comparations will fail (ex. 0.9 will be equal to 0.90)
- Other minor cleanup's
2002-06-19 23:38:59 +00:00
Tomas V.V.Cox fa2ee37313 Do NOT allow install packages with errors in its description file 2002-06-19 22:51:29 +00:00
Marcus Boerger 010e5e60ac correct handling/generating of php_mbstr_default_identify_list 2002-06-19 21:55:42 +00:00
Andi Gutmans 9e3517161e - This was also supposed to be part of the previous ZEND_MM commit :) 2002-06-19 16:53:49 +00:00
Andi Gutmans ad9bed0edd - Oops, this was supposed to be part of the previous #ifdef ZEND_MM change 2002-06-19 16:53:06 +00:00
Andi Gutmans 7e6fdcaa20 - Use #ifdef for ZEND_MM 2002-06-19 16:29:07 +00:00
Andi Gutmans 1432e49894 - Make sure MAX is defined 2002-06-19 16:13:39 +00:00
Christian Stocker 6ff3e9dc3d - Make domxml_xslt_process() working again. 2002-06-19 15:12:14 +00:00
Sander Roobol 3d1612c2fb Made the API versions appear better on phpinfo(); 2002-06-19 13:24:01 +00:00
Andi Gutmans 70de1bd5bb - Fix problem where you couldn't define constants with different cases but
- the same name.
2002-06-19 04:13:12 +00:00
foobar 5060a9b379 Fix bug: #17130 2002-06-19 01:11:20 +00:00
Edin Kadribasic 0af2ae718f No need to check for allow_url_fopen here.
#This closes two bugs which I cannot find right now courtesy our buggy bug
#database.
2002-06-19 00:31:30 +00:00
65a67889ef NEWS update 2002-06-19 00:28:47 +00:00
c7f2fca5f5 ChangeLog update 2002-06-19 00:27:39 +00:00
foobar d2f2ed76d1 Use correct macro for boolean ini values. 2002-06-19 00:18:40 +00:00
Stig Venaas 7853832234 Made array_unique() always keep the first occurrences of duplicates,
making the behavior easier to understand, and maybe more useful.
2002-06-18 19:37:59 +00:00
Andi Gutmans 52c941dc01 - Nuke use of persist_alloc(). This can't be used with a new memory manager 2002-06-18 18:51:33 +00:00
Derick Rethans d4acdd349f - MFZE1 2002-06-18 17:36:33 +00:00
Stefan Esser 028b25362b fix: appending the default charset to text/ content types never worked
fix: removed double free
2002-06-18 15:04:58 +00:00
Jan Lehnardt df226a54d9 - WS-fixes 2002-06-18 13:16:33 +00:00
Stefan Esser 28ad564c29 keep fingers away from already freed memory. 2002-06-18 12:57:09 +00:00
Hartmut Holzgraefe 303852b42e - fixed bug in enclosure handling (was still hardcoded to '"' in one place)
- added possibility to pass empty enclosure if you really don't want one
2002-06-18 12:16:27 +00:00
Sander Roobol ace4a23dfc Fixed stripslashes when magic_quotes_sybase is enabled, and add a test for
add- and stripslashes().
# this time without cvs messing up and aborting, hopefully :)
2002-06-18 11:51:06 +00:00
Sander Roobol 07975157eb Fix stripslashes when magic_quotes_sybase is enabled, and add a test for
add- and stripslashes().
2002-06-18 11:42:21 +00:00
Derick Rethans ba5257a2ec - Fix for bug #16065 2002-06-18 11:09:21 +00:00
Sander Roobol 0c1718c614 Patch by Michael Sisolak <msisolak@yahoo.com> to make header() honor the
replace parameter. Closes #16458.
2002-06-18 10:16:36 +00:00
Derick Rethans 94127f25e3 - oops... read before commit :) 2002-06-18 10:09:41 +00:00
Derick Rethans 81860467d4 - It doesn't work from within a script... so we disallow it 2002-06-18 10:06:54 +00:00
Tomas V.V.Cox 455f7bc746 "Release notes"++ 2002-06-18 08:41:39 +00:00
Markus Fischer 416c02f2a0 - User proper macros as suggested by Marc. 2002-06-18 07:48:41 +00:00
Markus Fischer 7cefd2fe09 - Fix ZTS build. 2002-06-18 01:51:59 +00:00
foobar cff4039c47 Fixed bug: #17137, test pass still 2002-06-18 00:56:11 +00:00
6997917bf8 NEWS update 2002-06-18 00:26:27 +00:00
86edd3731a ChangeLog update 2002-06-18 00:23:53 +00:00
Edin Kadribasic 67689bd557 ZTS fix. 2002-06-18 00:14:52 +00:00
Edin Kadribasic fb6bcda13b Check for +/- infinity in base_convert (bug #14807). 2002-06-18 00:04:33 +00:00
Andi Gutmans dbc195cdef - Improve speed of alignment calculation 2002-06-17 19:31:14 +00:00
Andi Gutmans 1e4a2dc6a9 - Fix a bug and add code which frees actual allocated segments at the end
- of execution (this still doesn't work because some blocks remain
- referenced after the memory manager is killed.
2002-06-17 19:00:37 +00:00
Andi Gutmans 54ef650fe7 - Save space per-allocated block. 2002-06-17 18:24:08 +00:00
Sergey Kartashoff 5e4ee5ac1b # Mnogosearch extension update. Now it should work with
# latest mnogosearch-3.2.5.
2002-06-17 17:39:18 +00:00
Andrei Zmievski fbae692ef6 Fix. 2002-06-17 15:13:39 +00:00
Andrei Zmievski a347ed559b Applied fix for #17764.
@- Fixed a crash in ereg_replace() when backreference number was greater
@  than the number of subpatterns. (oliver@billix.franken.de)
2002-06-17 15:10:22 +00:00
Tomas V.V.Cox d2b435eb08 Dropped case insentive ext search in PEAR::loadExtension() 2002-06-17 14:35:12 +00:00
Tomas V.V.Cox 4211d0e590 Typo in the folding mark 2002-06-17 14:04:01 +00:00
Stig Bakken 271c2526df * php-4.2.1-installer.exe for Windows is installed in c:\php by
default, but it has PHP_SYSCONFDIR set to c:\php4.  workaround.
2002-06-17 13:56:38 +00:00
Tomas V.V.Cox 80361edcb6 Use the new PEAR::loadExtension() in checkExtension() instead
of the "hack"
2002-06-17 13:50:33 +00:00
Tomas V.V.Cox 87ddd96027 Added PEAR::loadExtension($ext) - OS independant PHP extension load
# PEAR developers, please use this function if you need to check or
# load an extension.
2002-06-17 13:39:29 +00:00
Tomas V.V.Cox 9e67012d74 trailing ws 2002-06-17 13:32:42 +00:00
Hartmut Holzgraefe efdde5efe5 making printf/sprintf locale-aware without external dependencies 2002-06-17 11:50:25 +00:00
Hartmut Holzgraefe 00b667b61b fixed return types for ucwords/ucfirst when passed an empty string 2002-06-17 11:37:49 +00:00
Stig Bakken 97fd0acc14 * doh 2002-06-17 10:58:34 +00:00
Alan Knowles c904e22ade Fixing for the coding standard :) 2002-06-17 10:52:21 +00:00
Stig Bakken 2ae8219d44 * add xmlrpc request to debug output (verbosity level 4+) 2002-06-17 10:26:55 +00:00
Alan Knowles 19b63d5f87 Added Dependancy check on XML - previously pear installer failed silently 2002-06-17 04:49:14 +00:00
foobar 4e37016cb6 - Made dbase_get_record() and dbase_get_record_with_names use same backend
function as they both do same thing, just the output is different.

  Fixes also bug #17762 as side effect.
2002-06-17 02:27:34 +00:00
bea4f28474 ChangeLog update 2002-06-17 00:29:46 +00:00
Stefan Esser 984b48b009 Fixed Bug #17790
- link and symlink now check uid and open_base_dir for link and its target
2002-06-16 21:24:15 +00:00
Hartmut Holzgraefe 0170e42763 reverted patch depending on not yet commited work 2002-06-16 21:22:10 +00:00
Andi Gutmans 690c85b406 - Fix bug in class constants
- Start centralizing main class lookups. This will help implement
- __autload()
2002-06-16 18:25:05 +00:00
Derick Rethans 7672dbcdcf - Fix version in phpinfo(); 2002-06-16 18:20:21 +00:00
Andi Gutmans faa4f23a68 - Add zend_mm.c 2002-06-16 17:38:19 +00:00
Andi Gutmans 24e59ba35b - Remove debug code which doesn't work anymore and add headers. 2002-06-16 17:20:15 +00:00
Andi Gutmans 380c082e32 - Commit an initial version of a home made memory manager.
- It's just for seeing if this would be an advantage to PHP in MT
- environments. If this is to become production material there is still
- a long way to go.
2002-06-16 17:17:47 +00:00
Tomas V.V.Cox 19bfe8a3e1 Install the pear command under the bin_dir setting intead of the fixed
PHP_BINDIR
2002-06-16 14:30:14 +00:00
Hartmut Holzgraefe 7686d43737 make sprinf() locale-aware (Bug# 12647) 2002-06-16 13:14:21 +00:00
336 changed files with 17617 additions and 9008 deletions

No files matched your search

+2941
View File
File diff suppressed because it is too large. Load diff
+6
View File
@@ -72,6 +72,9 @@ If you get an error telling you that the apxs script could not be found,
look for it on your system and if you find it, provide the full path to it
as: --with-apxs=/path/to/apxs
Make sure you specify the version of apxs that is actually installed on
your system and NOT the one that is in the apache source tarball.
Next you must copy php.ini-dist to the appropriate place (normally
/usr/local/lib/php.ini) and edit it as necessary to set PHP options.
@@ -160,6 +163,9 @@ Installing PHP can be done in four simple steps:
look for it on your system and if you find it, provide the full path to it
as: --with-apxs=/path/to/apxs
Make sure you specify the version of apxs that is actually installed on
your system and NOT the one that is in the apache source tarball.
You might also want other flags on this configure line. --with-mysql
is just an example.
+21 -17
View File
@@ -1,5 +1,5 @@
--------------------------------------------------------------------
The PHP License, version 3.0a1
The PHP License, version 3.0
Copyright (c) 1999 - 2002 The PHP Group. All rights reserved.
--------------------------------------------------------------------
@@ -8,34 +8,38 @@ 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.
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior permission from the
PHP Group. This does not apply to add-on libraries or tools
that work in conjunction with PHP. In such a case the PHP
name may be used to indicate that the product supports PHP.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact group@php.net.
4. Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net. You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"
4. The PHP Group may publish revised and/or new versions of the
5. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the
terms of that version. You may also choose to use such covered
code under the terms of any subsequent version of the license
of the license, you may always continue to use it under the terms
of that version. You may also choose to use such covered code
under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
5. Redistributions of any form whatsoever must retain the following
6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP, freely available from
http://www.php.net/".
<http://www.php.net/>".
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+11 -9
View File
@@ -14,21 +14,23 @@ libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
libs/libphp4.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
php: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) -export-dynamic $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
$(BUILD_CGI)
sapi/cli/php: $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS)
$(LIBTOOL) --mode=link $(CC) -export-dynamic $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_CLI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
$(BUILD_CLI)
install: $(install_targets)
install-cli: sapi/cli/php
$(INSTALL_CLI)
@echo "Installing PHP CLI binary: $(INSTALL_ROOT)$(bindir)/"
@$(INSTALL_CLI)
install-sapi: libphp4.la
@echo "Installing PHP SAPI module"
-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
-@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
@@ -39,17 +41,17 @@ install-sapi: libphp4.la
fi; \
done; \
fi
$(INSTALL_IT)
@$(INSTALL_IT)
install-modules:
install-modules: build-modules
@test -d modules && \
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) && \
echo "installing shared modules into $(EXTENSION_DIR)" && \
echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/" && \
rm -f modules/*.la && \
cp modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) >/dev/null 2>&1 || true
install-tester:
@echo "Installing regression tester"
@echo "Installing regression tester: $(INSTALL_ROOT)$(PEAR_INSTALLDIR)/"
@$(mkinstalldirs) $(PEAR_INSTALLDIR)
@$(INSTALL) -m 755 $(top_srcdir)/run-tests.php $(INSTALL_ROOT)$(PEAR_INSTALLDIR)
+83 -18
View File
@@ -1,13 +1,80 @@
PHP 4 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2002, Version 4.3.0
? ? ??? 2002, Version 4.3.0
- Added ob_list_handlers() which returns an array of all active output
handlers. (marcus)
- Added mbstring encoding/decoding "HTML-ENTITIES". (Marcus)
- Added parameter 'L' for mb_http_input() to retrieve input encoding as a
comma separated string. (Marcus)
- Added the ability for declare() compiler modifications to occur globally
by using an empty statement. (Jason, Zend Engine)
i.e.
//Globally enables the ticks modifier for the whole program
declare (ticks=1);
//Enables the ticks modifier for just the lexical block containing
//"statement".
declare (ticks=1) {
statement;
}
- Bring strtotime() "next" keyword handling in line with documentation and
its glibc cousin. (Rasmus)
- Fixed str_rot13() to not mangle source string. (Rasmus)
- Fixed imap_get_quota() to work with multiple returned resources as per
the RFC 2087 and bug #14673. (kalowsky, Sander Steffann)
- Added MarkerNote decoding to exif_read_data() for several Cameras. (Marcus)
- Disabled zlib.output_compression for "image/" content-type
headers which can be changed during script execution. (Stefan)
- Added new asynchronous FTP functions. (Stefan)
- Added optional 5th parameter to FTP functions to support resuming. (Stefan)
- Added optional 2nd parameter to print_r() to make it return the variable
representation instead of echoing it. (Derick)
- Added mysql_ping(), mysql_real_escape_string(), mysql_character_set_name(),
mysql_thread_id(), mysql_stat() and mysql_list_processes(). (Zak, Georg)
- Added pg_fetch_all() which fetches all rows in a result. (Yasuo)
- Changed "session.use_trans_sid" to be disabled by default in php.ini. (Yasuo)
- Added safe_mode & open_basedir checks for pg_lo_export(). (Yasuo)
- Added open_basedir check for pg_lo_import(). (Yasuo)
- Fixed infinite recursion crash bug in ticks. (Jason)
- Added php.ini option "mysql.connect_timeout" to set the timeout limit for
mysql_connect() and mysql_pconnect(). (Georg)
- Added optional parameter "flags" to mysql_connect() and mysql_pconnect()
which can be used to set usage of idle timeout and different protocols,
SSL and compressed. (Georg)
- Added automatic rollback to ext/mysql for non committed transactions. (Georg)
- Fixed cases where preg_split() incorrectly terminated final element if it
contained null bytes. (Andrei)
- Added persistent connections/pipelining to thttpd. (Sascha)
- Fixed two potential blocking issues in thttpd. (Sascha)
- Fixed broken header file detection on Solaris. (Sascha)
- Improved nss/socket-related symbol/library detection. (Jani, Sascha)
- Made iconv() work well with both libiconv and libgconv. (Moriyoshi, Yasuo)
- Fixed socket_set_timeout() on win32. (Jason, Edin, Jani)
- Added domxml_node_namespace_uri(). (Rui Lopes)
- Fixed win32 memory leak in /ext/sockets that would occur on any error
condition. Also fixed host resolution error messages on win32. (Jason)
- Added optional 3rd parameter 'recursive' to ftp_rawlist() which will
do 'LIST -R' instead of 'LIST'. (Jani)
- Disabled the fifth parameter in mail() when safe-mode is turned on. (Derick)
- Changed getimagesize() to always set unknown fields to 0 and added support
iff imagetype. (Marcus)
- Added runtime Apache2 thread check to ensure we don't run a non-threaded
PHP inside a threaded Apache2 MPM. (Rasmus)
- Made getimagesize() and exif_read_data() to return also the mime-type and
exif_thumbnail() to return also the image-type. (Marcus)
- Added image_type_to_mime_type() which converts image-types to mime-types.
(Marcus)
- Made GD functions to only exist if they are available in libgd. Now the
availability can be tested with function_exists(). (Derick)
- Added an optional parameter to the header() function which overrides the HTTP
response code. (Derick)
- Changed the order of which modules are unloaded to the reverse order of
which they were loaded. (Derick, Zend Engine)
- Fixed a crash in ereg_replace() when backreference number was greater
than the number of subpatterns. (oliver@billix.franken.de)
- Added preliminary SAX-Input support. It's now possible to build a DomDocument
with SAX-Events (added domxml_parser_start_document(), domxml_parser_end_document(),
domxml_parser_start_element(tagname[,attributes]), domxml_parser_end_element(tagname),
domxml_parser_characters(characters), domxml_parser_cdata_block(cdata),
domxml_parser_comment(comment), domxml_parser_get_document(). (chregu)
- Bundle gd library 2.0.1 with php (ext/gd/libgd) (Rasmus), tweak config.m4 to
work with it (Jani), smallers tweaks for Win32 (Markus, Edin)
with SAX-Events. (chregu)
- Bundled GD library 2.0.1 with php (ext/gd/libgd) (Rasmus, Jani, Markus, Edin)
- Fixed bug with Apache which let PHP_AUTH_* variables to be set when
external basic auth mechanism was used. (Jani)
- Fixed bzopen() crash in thread-safe mode. (Andrei)
@@ -32,14 +99,13 @@ PHP 4 NEWS
- Added pctnl_alarm() function. (Edin)
- Fixed array_rand() on thread-safe platforms such as Windows. (Edin)
- If zlib.output_compression is enabled and a page is compressed
a "Vary: Accept-Encoding" header is added. (Stefan)
a "Vary: Accept-Encoding" header is now added. (Stefan)
- Renamed getallheaders() to apache_request_headers() and kept getallheaders()
as an alias to it. Also added apache_response_headers() which returns the
current response headers from Apache. (Rasmus)
- Added missing AddRef() calls in the COM extension. This should fix weird
behaviour (in particular with ADODB). (Harald)
- Fixed some dummy errors. (dets)
- Fix segfault in version_compare(). (Stig)
- Fixed segfault in version_compare(). (Stig)
- Added compressed Flash MX files support to getimagesize(). (Derick)
- Added ability to capture string offsets in preg_split() results.
(David Brown, Andrei)
@@ -51,7 +117,7 @@ PHP 4 NEWS
Korean encodings into mbstring. (Rui)
- Misc. Win32 mail() enhancements: support 'From:' header (msisolak@yahoo.com),
support Bcc header, case-insensitive headers, enhanced error reporting,
automatic proper line ending conversion, fix crash with Cc, fix buffer
automatic proper line ending conversion, fixed crash with Cc, fixed buffer
overflows with $header. (Markus)
- Improved IMAP extension performance. (adam.kauffman@mindspring.com,
rjs3@andrew.cmu.edu, Jon)
@@ -65,15 +131,13 @@ PHP 4 NEWS
and remove variables from the URL-Rewriter. (Thies)
- The Windows build can now be configured more comfortably, for example
when dealing with built-in extensions. (Sebastian)
- Added optional 3rd parameter to mysql_select_db() which makes it return
the previously selected database name. (Jani)
- Added large OID value (2^31 to 2^32) support for pg_lo_import(),
pg_lo_unlink(), pg_lo_open() and pg_lo_export(). (Yasuo)
- Made the mbstring extension to be enabled by default. (Yasuo)
- Changed the mbstring extension to be enabled by default. (Yasuo)
- Fixed mixing OCIPlogon() and OCINLogon() to not leak Oracle-Sessions. (Thies)
- Added php.ini options for EXIF extension to encode and decode Unicode/JIS
user comments. (Marcus)
- Changed the "-c" CLI/CGI option to allow both 'filename' and
- Changed the "-c" CLI/CGI option to allow both 'filename' and
'path to php.ini'. (Yasuo)
- Added version information to the .dll and .exe files created under Windows.
(jtate)
@@ -116,7 +180,7 @@ PHP 4 NEWS
. Added memory stream support. (Marcus)
- Fixed memory allocation problem on systems that have iconv() support in libc.
(Yasuo)
- Made var_dump() handle recursive structures better. (Yasuo)
- Made var_dump() handle recursive structures better. (Yasuo, Derick)
- Added exif_imagetype() function. (Marcus)
- New improved build system. Among other improvements, replaces the slow
recursive make with one global Makefile and eases the integration of proper
@@ -404,6 +468,7 @@ PHP 4 NEWS
GMT +0100 and GMT -0100. (Derick)
10 Dec 2001, Version 4.1.0
- Fixed return values for strtok (Bug #13866) (jmoore)
- Worked around a bug in the MySQL client library that could cause PHP to hang
when using unbuffered queries. (Zeev)
- Fixed a bug which caused set_time_limit() to affect all subsequent requests
@@ -468,9 +533,9 @@ PHP 4 NEWS
there's no need to import them using the 'global' statement. (Andi & Zeev)
- Added vprintf() and vsprintf() functions that allow passing all arguments
after format as an array. (Andrei)
- Added support for GD2 image type for ImageCreateFromString() (Jani)
- Added support for GD2 image type for ImageCreateFromString(). (Jani)
- Added ImageCreateFromGD(), ImageCreateFromGD2(), ImageCreateFromGD2part(),
ImageGD() and ImageGD2() functions (Jani)
ImageGD() and ImageGD2() functions. (Jani)
- addcslashes now warns when charlist is invalid. The returned string
remained the same (Jeroen)
- Added optional extra argument to gmp_init(). The extra argument
+1 -1
View File
@@ -84,7 +84,7 @@ For datetime.c:
For string.c:
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
# Man, that thing was leaking all over the place!
@- Memory leak in trim() function has finally been fixed. (Bob)
@- Fixed memory leak in trim(). (Bob)
The lines above marked with @ will go into NEWS file automagically, and the
# lines will be omitted from the ChangeLog. Alternatively, you might want
+10 -1
View File
@@ -105,11 +105,20 @@ if (zend_parse_parameters(3 TSRMLS_CC, "zbr!",
/* Get either a set of 3 longs or a string. */
long l1, l2, l3;
char *s;
/*
* The function expects a pointer to a integer in this case, not a long
* or any other type. If you specify a type which is larger
* than a 'int', the upper bits might not be initialized
* properly, leading to random crashes on platforms like
* Tru64 or Linux/Alpha.
*/
int length;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
"lll", &l1, &l2, &l3) == SUCCESS) {
/* manipulate longs */
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
"s", &s) == SUCCESS) {
"s", &s, &length) == SUCCESS) {
/* manipulate string */
} else {
/* output error */
+187 -19
View File
@@ -103,7 +103,7 @@ dnl relative to source- or build-directory?
dnl ac_srcdir/ac_bdir include trailing slash
case $1 in
""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;;
/*[)] ac_srcdir=`echo $ac_n "$1$ac_c"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;;
/*[)] ac_srcdir=`echo "$1"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;;
*[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$1/"; ac_inc="-I$ac_bdir -I$ac_srcdir" ;;
esac
@@ -255,7 +255,7 @@ AC_DEFUN(PHP_EVAL_LIBLINE,[
case $ac_i in
-l*)
ac_ii=`echo $ac_i|cut -c 3-`
PHP_ADD_LIBRARY($ac_ii,,$2)
PHP_ADD_LIBRARY($ac_ii,1,$2)
;;
-L*)
ac_ii=`echo $ac_i|cut -c 3-`
@@ -875,7 +875,7 @@ AC_DEFUN(PHP_ADD_LIBPATH,[
PHP_ADD_LIBPATH_GLOBAL([$ai_p])
],[
if test "$ext_shared" = "yes"; then
$2="-R$ai_p -L$ai_p [$]$2"
$2="$ld_runpath_switch$ai_p -L$ai_p [$]$2"
else
PHP_ADD_LIBPATH_GLOBAL([$ai_p])
fi
@@ -884,19 +884,26 @@ AC_DEFUN(PHP_ADD_LIBPATH,[
])
dnl
dnl PHP_BUILD_RPATH()
dnl PHP_UTILIZE_RPATHS()
dnl
dnl builds RPATH from PHP_RPATHS
dnl builds RPATHS/LDFLAGS from PHP_RPATHS
dnl
AC_DEFUN(PHP_BUILD_RPATH,[
if test "$PHP_RPATH" = "yes" && test -n "$PHP_RPATHS"; then
OLD_RPATHS=$PHP_RPATHS
AC_DEFUN(PHP_UTILIZE_RPATHS,[
OLD_RPATHS=$PHP_RPATHS
unset PHP_RPATHS
for i in $OLD_RPATHS; do
dnl Can be passed to native cc/libtool
PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
dnl Libtool-specific
PHP_RPATHS="$PHP_RPATHS -R $i"
dnl cc-specific
NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
done
if test "$PHP_RPATH" = "no"; then
unset PHP_RPATHS
for i in $OLD_RPATHS; do
PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
PHP_RPATHS="$PHP_RPATHS -R $i"
NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
done
unset NATIVE_RPATHS
fi
])
@@ -927,8 +934,8 @@ dnl
dnl internal, don't use
AC_DEFUN(PHP_ADD_LIBRARY_SKELETON,[
case $1 in
c|c_r|pthread*) ;;
*) ifelse($3,,[
c|c_r|pthread*[)] ;;
*[)] ifelse($3,,[
PHP_X_ADD_LIBRARY($1,$2,$5)
],[
if test "$ext_shared" = "yes"; then
@@ -985,14 +992,78 @@ ifelse($3,,[
])
dnl
dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path)
dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path[, shared-libadd])
dnl
dnl add a library to the link line (deferred)
dnl and path to linkpath/runpath (not deferred)
dnl if shared-libadd is not empty and $ext_shared is yes,
dnl shared-libadd will be assigned the library information
dnl
AC_DEFUN(PHP_ADD_LIBRARY_DEFER_WITH_PATH,[
PHP_ADD_LIBPATH($2)
ifelse($3,,[
if test -n "$2"; then
PHP_ADD_LIBPATH($2)
fi
PHP_ADD_LIBRARY_DEFER($1)
],[
if test "$ext_shared" = "yes"; then
$3="-l$1 [$]$3"
if test -n "$2"; then
PHP_ADD_LIBPATH($2,$3)
fi
else
PHP_ADD_LIBRARY_DEFER_WITH_PATH($1,$2)
fi
])
])
dnl
dnl PHP_ADD_FRAMEWORK(framework [,before])
dnl
dnl add a (Darwin / Mac OS X) framework to the link
dnl line. if before is 1, the framework is added
dnl to the beginning of the line.
AC_DEFUN(PHP_ADD_FRAMEWORK, [
AC_PHP_ONCE(FRAMEWORK, $1, [
if test "$2"; then
PHP_FRAMEWORKS="-framework $1 $PHP_FRAMEWORKS"
else
PHP_FRAMEWORKS="$PHP_FRAMEWORKS -framework $1"
fi
])
])
dnl
dnl PHP_ADD_FRAMEWORKPATH(path [,before])
dnl
dnl add a (Darwin / Mac OS X) framework path to the link
dnl and include lines. default paths include (but are
dnl not limited to) /Local/Library/Frameworks and
dnl /System/Library/Frameworks, so these don't need
dnl to be specifically added. if before is 1, the
dnl framework path is added to the beginning of the
dnl relevant lines.
AC_DEFUN(PHP_ADD_FRAMEWORKPATH, [
PHP_EXPAND_PATH($1, ai_p)
AC_PHP_ONCE(FRAMEWORKPATH, $ai_p, [
if test "$2"; then
PHP_FRAMEWORKS="-F$ai_p $PHP_FRAMEWORKS"
else
PHP_FRAMEWORKS="$PHP_FRAMEWORKS -F$ai_p"
fi
])
])
dnl
dnl PHP_ADD_FRAMEWORK_WITH_PATH(framework, path)
dnl
dnl add a (Darwin / Mac OS X) framework path and the
dnl framework itself to the link and include lines.
AC_DEFUN(PHP_ADD_FRAMEWORK_WITH_PATH, [
PHP_ADD_FRAMEWORKPATH($2)
PHP_ADD_FRAMEWORK($1)
])
dnl
@@ -1152,7 +1223,7 @@ AC_DEFUN(PHP_NEW_EXTENSION,[
ext_builddir=[]PHP_EXT_BUILDDIR($1)
ext_srcdir=[]PHP_EXT_SRCDIR($1)
ifelse($5,,ac_extra=,[ac_extra=`echo $ac_n "$5$ac_c"|sed s#@ext_srcdir@#$ext_srcdir#g`])
ifelse($5,,ac_extra=,[ac_extra=`echo "$5"|sed s#@ext_srcdir@#$ext_srcdir#g`])
if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
dnl ---------------------------------------------- Static module
@@ -1168,7 +1239,7 @@ dnl ---------------------------------------------- Static module
dnl ---------------------------------------------- Shared module
PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir)
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module)
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
fi
fi
@@ -1381,6 +1452,26 @@ AC_DEFUN(PHP_CHECK_LIBRARY, [
])dnl
])
dnl
dnl PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]])
dnl
dnl El cheapo wrapper for AC_CHECK_LIB
dnl
AC_DEFUN(PHP_CHECK_FRAMEWORK, [
save_old_LDFLAGS=$LDFLAGS
LDFLAGS="-framework $1 $LDFLAGS"
dnl supplying "c" to AC_CHECK_LIB is technically cheating, but
dnl rewriting AC_CHECK_LIB is overkill and this only affects
dnl the "checking.." output anyway.
AC_CHECK_LIB(c,[$2],[
LDFLAGS=$save_old_LDFLAGS
$3
],[
LDFLAGS=$save_old_LDFLAGS
$4
])
])
dnl
dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
dnl
@@ -1456,3 +1547,80 @@ AC_DEFUN(PHP_SETUP_ICONV, [
ifelse([$3],[],,[else $3])
fi
])
AC_DEFUN(PHP_DEF_HAVE,[AC_DEFINE([HAVE_]translit($1,a-z_-,A-Z__), 1, [ ])])
dnl
dnl PHP_CHECK_FUNC_LIB(func, libs)
dnl This macro checks whether 'func' or '__func' exists
dnl in the specified library.
dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNC
dnl
dnl autoconf undefines the builtin "shift" :-(
dnl If possible, we use the builtin shift anyway, otherwise we use
dnl the ubercool definition I have tested so far with FreeBSD/GNU m4
ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[
define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])])
])
AC_DEFUN(PHP_CHECK_FUNC_LIB,[
ifelse($2,,:,[
unset ac_cv_lib_$2[]_$1
unset ac_cv_lib_$2[]___$1
unset found
AC_CHECK_LIB($2, $1, [found=yes], [
AC_CHECK_LIB($2, __$1, [found=yes], [found=no])
])
if test "$found" = "yes"; then
PHP_ADD_LIBRARY($2)
PHP_DEF_HAVE($1)
PHP_DEF_HAVE(lib$2)
ac_cv_func_$1=yes
else
PHP_CHECK_FUNC_LIB($1,phpshift(phpshift($@)))
fi
])
])
dnl
dnl PHP_CHECK_FUNC(func, ...)
dnl This macro checks whether 'func' or '__func' exists
dnl in the default libraries and as a fall back in the specified library.
dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS.
dnl
AC_DEFUN(PHP_CHECK_FUNC,[
unset ac_cv_func_$1
unset ac_cv_func___$1
unset found
AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ])
case $found in
yes)
PHP_DEF_HAVE($1)
ac_cv_func_$1=yes
;;
ifelse($#,1,,[
*) PHP_CHECK_FUNC_LIB($@) ;;
])
esac
])
dnl
dnl PHP_AP_EXTRACT_VERSION(/path/httpd)
dnl This macro is used to get a comparable
dnl version for apache1/2.
dnl
AC_DEFUN(PHP_AP_EXTRACT_VERSION,[
ac_output=`$1 -v 2>&1`
ac_IFS=$IFS
IFS="- /.
"
set $ac_output
IFS=$ac_IFS
APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`
])
+10 -8
View File
@@ -20,24 +20,27 @@
# Makefile to generate build tools
#
SUBDIRS = Zend TSRM
ZENDDIR = Zend
SUBDIRS = $(ZENDDIR) TSRM
STAMP = buildmk.stamp
ALWAYS = generated_lists
all: $(STAMP) $(ALWAYS)
@$(MAKE) AMFLAGS=$(AMFLAGS) -s -f build/build2.mk
generated_lists:
@echo makefile_am_files = Zend/Makefile.am \
@echo makefile_am_files = $(ZENDDIR)/Makefile.am \
TSRM/Makefile.am > $@
@echo config_h_files = Zend/acconfig.h TSRM/acconfig.h >> $@
@echo config_m4_files = Zend/Zend.m4 TSRM/tsrm.m4 TSRM/threads.m4 \
Zend/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@
@echo config_h_files = $(ZENDDIR)/acconfig.h TSRM/acconfig.h >> $@
@echo config_m4_files = $(ZENDDIR)/Zend.m4 TSRM/tsrm.m4 TSRM/threads.m4 \
$(ZENDDIR)/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@
$(STAMP): build/buildcheck.sh
@build/buildcheck.sh && touch $(STAMP)
@build/buildcheck.sh $(STAMP)
snapshot:
distname='$(DISTNAME)'; \
@@ -64,8 +67,7 @@ snapshot:
cvsclean:
@for i in `find . -name .cvsignore`; do \
(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a || true); \
(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a .libs || true); \
done
@rm -f $(SUBDIRS) 2>/dev/null || true
.PHONY: $(ALWAYS) snapshot cvsclean
+1 -1
View File
@@ -39,7 +39,7 @@ acconfig.h: $(acconfig_h_SOURCES)
@echo rebuilding $@
cat $(acconfig_h_SOURCES) > $@
SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times|AC_PROG_CPP was called before AC_PROG_CC)'||true)
SUPPRESS_WARNINGS = (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times)'||true)
$(config_h_in): configure acconfig.h
# explicitly remove target since autoheader does not seem to work
+17 -3
View File
@@ -16,11 +16,13 @@
# | Sascha Schumann <sascha@schumann.cx> |
# +----------------------------------------------------------------------+
#
# $Id: buildcheck.sh,v 1.16 2002-03-04 08:28:57 sas Exp $
# $Id: buildcheck.sh,v 1.19 2002-07-21 13:09:07 sas Exp $
#
echo "buildconf: checking installation..."
stamp=$1
# autoconf 2.13 or newer
ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
if test -z "$ac_version"; then
@@ -40,6 +42,15 @@ echo "buildconf: autoconf version $ac_version (ok)"
fi
if test "$1" = "2" && test "$2" -ge "50"; then
echo "buildconf: Your version of autoconf likely contains buggy cache code."
echo " Running cvsclean for you."
echo " To avoid this, install autoconf-2.13 and automake-1.5."
./cvsclean
stamp=
fi
# automake 1.4 or newer
am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'`
@@ -60,8 +71,9 @@ echo "buildconf: automake version $am_version (ok)"
fi
# libtool 1.4 or newer
libtool=`which libtool`
if test ! -f "$libtool"; then libtool=`which glibtool`; fi
# Prefer glibtool over libtool for Mac OS X compatibility
libtool=`which glibtool 2> /dev/null`
if test ! -f "$libtool"; then libtool=`which libtool`; fi
lt_pversion=`$libtool --version 2>/dev/null|sed -n -e 's/^[^0-9]*//' -e 1's/[- ].*//p'`
if test "$lt_pversion" = ""; then
echo "buildconf: libtool not found."
@@ -90,4 +102,6 @@ if test "$am_prefix" != "$lt_prefix"; then
echo " continuing anyway"
fi
test -n "$stamp" && touch $stamp
exit 0
+17 -29
View File
@@ -1,36 +1,24 @@
#!/bin/sh
# $Id$
supplied_flag=$1
while test $# -gt 0; do
if test "$1" = "--copy"; then
automake_flags=--copy
fi
if test "$supplied_flag" = "--copy"; then
automake_flags=--copy
if test "$1" = "--ZendEngine2"; then
ZENDDIR=ZendEngine2
echo "Using Zend Engine 2 code"
fi
shift
done
if test -z "$ZENDDIR"; then
ZENDDIR=Zend
echo "using default Zend directory"
fi
## build.mk does not check aclocal exit status yet
##
#mv aclocal.m4 aclocal.m4.old 2>/dev/null
#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 test "$supplied_flag" = "--local"; then
subdirs='SUBDIRS='
else
subdirs=''
fi
rm -f generated_lists
case "`uname`" in
*BSD/OS*)
./build/bsd_makefile;;
esac
${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags"
${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags" ZENDDIR="$ZENDDIR"
+84 -67
View File
@@ -1,9 +1,9 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2001-11-08'
timestamp='2002-05-29'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ timestamp='2001-11-08'
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner <bothner@cygnus.com>.
# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@@ -98,7 +98,7 @@ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int dummy(){}" > $dummy.c ;
for c in cc gcc c89 ; do
for c in cc gcc c89 c99 ; do
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
if test $? = 0 ; then
CC_FOR_BUILD="$c"; break ;
@@ -135,23 +135,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
# Determine the machine/vendor (is the vendor relevant).
case "${UNAME_MACHINE}" in
amiga) machine=m68k-unknown ;;
arm32) machine=arm-unknown ;;
atari*) machine=m68k-atari ;;
sun3*) machine=m68k-sun ;;
mac68k) machine=m68k-apple ;;
macppc) machine=powerpc-apple ;;
hp3[0-9][05]) machine=m68k-hp ;;
ibmrt|romp-ibm) machine=romp-ibm ;;
sparc*) machine=`uname -p`-unknown ;;
*) machine=${UNAME_MACHINE}-unknown ;;
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE}" in
i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null
@@ -291,6 +291,9 @@ EOF
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
exit 0 ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
@@ -339,7 +342,7 @@ EOF
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
@@ -426,6 +429,9 @@ EOF
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit 0 ;;
Night_Hawk:*:*:PowerMAX_OS)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
@@ -508,7 +514,7 @@ EOF
fi
exit 0 ;;
*:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
@@ -682,9 +688,6 @@ EOF
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
@@ -706,9 +709,6 @@ EOF
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
@@ -736,6 +736,9 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
x86:Interix*:3*)
echo i386-pc-interix3
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -761,16 +764,30 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
mips:Linux:*:*)
case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
big) echo mips-unknown-linux-gnu && exit 0 ;;
little) echo mipsel-unknown-linux-gnu && exit 0 ;;
esac
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips
#undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
rm -f $dummy.c
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
@@ -819,7 +836,8 @@ EOF
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
ld_supported_targets=`cd /; ld --help 2>&1 \
# Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
@@ -843,32 +861,29 @@ EOF
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
cat >$dummy.c <<EOF
#include <features.h>
#ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
printf ("%s-pc-linux-gnu\n", argv[1]);
# else
printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
# else
printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
#else
printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#ifdef __INTEL_COMPILER
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
EOF
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
i*86:DYNIX/ptx:4*:*)
@@ -906,13 +921,13 @@ EOF
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
@@ -947,7 +962,7 @@ EOF
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1048,15 +1063,17 @@ EOF
echo `uname -p`-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
if test "${UNAME_MACHINE}" = "x86pc"; then
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo `uname -p`-${UNAME_MACHINE}-nto-qnx
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit 0 ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-[KW]:NONSTOP_KERNEL:*:*)
NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
Vendored
+82 -56
View File
@@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2001-11-08'
timestamp='2002-05-28'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -118,7 +118,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -227,31 +227,32 @@ case $basic_machine in
1750a | 580 \
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| c4x | clipper \
| d10v | d30v | dsp16xx \
| d10v | d30v | dlx | dsp16xx \
| fr30 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| m32r | m68000 | m68k | m88k | mcore \
| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
| mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
| mips64vr4100 | mips64vr4100el | mips64vr4300 \
| mips64vr4300el | mips64vr5000 | mips64vr5000el \
| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
| mipsisa32 \
| mipsisa32 | mipsisa64 \
| mn10200 | mn10300 \
| ns16k | ns32k \
| openrisc \
| openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[34] | sh[34]eb | shbe | shle \
| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
| sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic80 | tron \
| v850 \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 \
| x86 | xscale | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
@@ -278,20 +279,21 @@ case $basic_machine in
580-* \
| a29k-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alphapca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armv*-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c54x-* \
| clipper-* | cray2-* | cydra-* \
| d10v-* | d30v-* \
| clipper-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| m32r-* \
| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
@@ -303,13 +305,14 @@ case $basic_machine in
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \
| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
| v850-* | vax-* \
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* | xstormy16-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xtensa-* \
| ymp-* \
| z8k-*)
;;
@@ -374,6 +377,10 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@@ -394,16 +401,8 @@ case $basic_machine in
basic_machine=c38-convex
os=-bsd
;;
cray | ymp)
basic_machine=ymp-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
[cjt]90)
basic_machine=${basic_machine}-cray
cray | j90)
basic_machine=j90-cray
os=-unicos
;;
crds | unos)
@@ -418,6 +417,14 @@ case $basic_machine in
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
decsystem10* | dec10*)
basic_machine=pdp10-dec
os=-tops10
;;
decsystem20* | dec20*)
basic_machine=pdp10-dec
os=-tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
@@ -598,14 +605,6 @@ case $basic_machine in
basic_machine=m68k-atari
os=-mint
;;
mipsel*-linux*)
basic_machine=mipsel-unknown
os=-linux-gnu
;;
mips*-linux*)
basic_machine=mips-unknown
os=-linux-gnu
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
@@ -620,6 +619,10 @@ case $basic_machine in
basic_machine=m68k-rom68k
os=-coff
;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
msdos)
basic_machine=i386-pc
os=-msdos
@@ -699,6 +702,10 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
or32 | or32-*)
basic_machine=or32-unknown
os=-coff
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
@@ -859,7 +866,7 @@ case $basic_machine in
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
sv1)
basic_machine=sv1-cray
os=-unicos
;;
@@ -867,8 +874,16 @@ case $basic_machine in
basic_machine=i386-sequent
os=-dynix
;;
t3d)
basic_machine=alpha-cray
os=-unicos
;;
t3e)
basic_machine=t3e-cray
basic_machine=alphaev5-cray
os=-unicos
;;
t90)
basic_machine=t90-cray
os=-unicos
;;
tic54x | c54x*)
@@ -881,6 +896,10 @@ case $basic_machine in
tx39el)
basic_machine=mipstx39el-unknown
;;
toad1)
basic_machine=pdp10-xkl
os=-tops20
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
@@ -931,13 +950,13 @@ case $basic_machine in
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
@@ -958,13 +977,6 @@ case $basic_machine in
op60c)
basic_machine=hppa1.1-oki
;;
mips)
if [ x$os = x-linux-gnu ]; then
basic_machine=mips-unknown
else
basic_machine=mips-mips
fi
;;
romp)
basic_machine=romp-ibm
;;
@@ -987,6 +999,9 @@ case $basic_machine in
sh3 | sh4 | sh3eb | sh4eb)
basic_machine=sh-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
@@ -1074,7 +1089,8 @@ case $os in
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux*)
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1126,12 +1142,18 @@ case $os in
-acis*)
os=-aos
;;
-atheos*)
os=-atheos
;;
-386bsd)
os=-bsd
;;
-ctix* | -uts*)
os=-sysv
;;
-nova*)
os=-rtmk-nova
;;
-ns2 )
os=-nextstep2
;;
@@ -1206,6 +1228,7 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
;;
@@ -1236,6 +1259,9 @@ case $basic_machine in
mips*-*)
os=-elf
;;
or32-*)
os=-coff
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
@@ -1383,7 +1409,7 @@ case $basic_machine in
-ptx*)
vendor=sequent
;;
-vxsim* | -vxworks*)
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
-aux*)
+71 -132
View File
@@ -82,39 +82,6 @@ if test -n "$with_apache" && test -n "$with_apxs"; then
fi
dnl Platform-specific compile settings.
dnl -------------------------------------------------------------------------
dnl if host_alias is empty, ac_cv_host_alias may still have the info
if test -z "$host_alias"; then
host_alias=$ac_cv_host_alias
fi
BSD_MAKEFILE=no
case $host_alias in
*solaris*)
CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
enable_libgcc=yes
fi
;;
*dgux*)
CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
*darwin*|*rhapsody*)
CPPFLAGS="$CPPFLAGS -no-cpp-precomp";;
*bsdi*)
BSD_MAKEFILE=yes;;
*beos*)
beos_threads=1
LIBS="$LIBS -lbe -lroot";;
*mips*)
CPPFLAGS="$CPPFLAGS -D_XPG_IV";;
esac
dnl Settings we want to make before the checks.
dnl -------------------------------------------------------------------------
@@ -129,9 +96,6 @@ T_ME=`$php_shtool echo -n -e %b`
dnl We want this one before the checks, so the checks can modify CFLAGS.
test -z "$CFLAGS" && auto_cflags=1
dnl AC_AIX needs to be before any macros that run the C compiler.
AC_AIX
abs_srcdir=`(cd $srcdir; pwd)`
abs_builddir=`pwd`
@@ -154,35 +118,15 @@ AC_PROG_CC_C_O
dnl Change to AC_PROG_CC_STDC when we start requiring a post-2.13 autoconf
dnl AC_PROG_CC_STDC
AC_PROG_CPP
AC_AIX
dnl AC_PROG_CXX
dnl AC_PROG_CXXCPP
dnl check for -R, etc. switch
AC_MSG_CHECKING([whether compiler supports -R])
AC_CACHE_VAL(php_cv_cc_dashr,[
SAVE_LIBS=$LIBS
LIBS="-R /usr/lib $LIBS"
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
LIBS=$SAVE_LIBS
])
AC_MSG_RESULT([$php_cv_cc_dashr])
if test $php_cv_cc_dashr = "yes"; then
ld_runpath_switch=-R
else
AC_MSG_CHECKING([whether compiler supports -Wl,-rpath,])
AC_CACHE_VAL(php_cv_cc_rpath, [
SAVE_LIBS=$LIBS
LIBS="-Wl,-rpath,/usr/lib $LIBS"
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
LIBS=$SAVE_LIBS
])
AC_MSG_RESULT([$php_cv_cc_rpath])
if test $php_cv_cc_rpath = "yes"; then
ld_runpath_switch=-Wl,-rpath,
else
dnl something innocuous
ld_runpath_switch=-L
fi
fi
PHP_RUNPATH_SWITCH
AC_PROG_RANLIB
AC_PROG_LN_S
AC_PROG_AWK
@@ -211,6 +155,33 @@ if test "$ac_cv_c_const" = "yes" ; then
fi
dnl Platform-specific compile settings.
dnl -------------------------------------------------------------------------
dnl if host_alias is empty, ac_cv_host_alias may still have the info
if test -z "$host_alias"; then
host_alias=$ac_cv_host_alias
fi
case $host_alias in
*solaris*)
CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
enable_libgcc=yes
fi
;;
*dgux*)
CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
*darwin*|*rhapsody*)
CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
php_multiple_shlib_versions_ok=yes;;
*beos*)
beos_threads=1
LIBS="$LIBS -lbe -lroot";;
*mips*)
CPPFLAGS="$CPPFLAGS -D_XPG_IV";;
esac
dnl Include Zend and TSRM configurations.
dnl -------------------------------------------------------------------------
@@ -297,73 +268,29 @@ test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
dnl First, library checks.
dnl -------------------------------------------------------------------------
AC_CHECK_LIB(socket, socket, [
PHP_ADD_LIBRARY(socket)
AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
AC_CHECK_LIB(socket, htonl, [
PHP_ADD_LIBRARY(socket)
])])
dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try
dnl to avoid -lnsl checks, if we already have the functions which
dnl are usually in libnsl
dnl Also, uClibc will bark at linking with glibc's libnsl.
unset ac_cv_func_gethostname
unset ac_cv_func_yp_get_default_domain
AC_CHECK_FUNC(gethostname, [
php_no_nsl_checks=yes
],[
AC_CHECK_FUNC(yp_get_default_domain, [
php_no_nsl_checks=yes
])
])
unset ac_cv_func_gethostname
unset ac_cv_func_yp_get_default_domain
PHP_CHECK_FUNC(socket, socket)
PHP_CHECK_FUNC(htonl, socket)
PHP_CHECK_FUNC(gethostname, nsl)
PHP_CHECK_FUNC(gethostbyaddr, nsl)
PHP_CHECK_FUNC(yp_get_default_domain, nsl)
if test "$php_no_nsl_checks" != "yes"; then
AC_CHECK_LIB(nsl, gethostname, [
PHP_ADD_LIBRARY(nsl)
AC_DEFINE(HAVE_LIBNSL,1,[ ]) ],[
AC_CHECK_LIB(nsl, gethostbyaddr, [
PHP_ADD_LIBRARY(nsl)
AC_DEFINE(HAVE_LIBNSL,1,[ ]) ], [])
])
fi
AC_CHECK_LIB(dl, dlopen,[PHP_ADD_LIBRARY(dl)])
dnl The sin may be in a library which need not be specifed
dnl as well as res_search resides in libsocket
AC_CHECK_LIB(dl, dlopen, [PHP_ADD_LIBRARY(dl)])
AC_CHECK_LIB(m, sin)
dnl Only include libbind if inet_aton is not found in
dnl libresolv.
AC_CHECK_LIB(resolv, inet_aton, [], [
AC_CHECK_LIB(bind, inet_aton, [], [
AC_CHECK_LIB(bind, __inet_aton)
])
])
dnl The res_search may be in libsocket as well, and if it is
dnl make sure to check for dn_skipname in libresolv, or if res_search
dnl is in neither of these libs, still check for dn_skipname in libresolv
AC_CHECK_LIB(socket, res_search, [
AC_CHECK_LIB(resolv, dn_skipname)
AC_CHECK_LIB(resolv, __dn_skipname)
LIBS="$LIBS -lsocket"
AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
AC_CHECK_LIB(resolv, res_search, [
LIBS="$LIBS -lresolv"
AC_DEFINE(HAVE_LIBRESOLV,1,[ ])
], [
AC_CHECK_LIB(resolv, dn_skipname)
AC_CHECK_LIB(resolv, __dn_skipname)
])
])
dnl Check for resolver routines.
dnl Need to check for both res_search and __res_search
dnl in -lc, -lbind, -lresolv and -lsocket
PHP_CHECK_FUNC(res_search, resolv, bind, socket)
dnl Check for inet_aton and dn_skipname
dnl in -lc, -lbind and -lresolv
PHP_CHECK_FUNC(inet_aton, resolv, bind)
PHP_CHECK_FUNC(dn_skipname, resolv, bind)
dnl Then headers.
@@ -380,8 +307,11 @@ else
fi
PHP_MISSING_FCLOSE_DECL
dnl QNX requires unix.h to allow functions in libunix to work properly
AC_CHECK_HEADERS(
AC_CHECK_HEADERS([ \
ApplicationServices/ApplicationServices.h \
sys/types.h \
sys/time.h \
netinet/in.h \
alloca.h \
arpa/inet.h \
arpa/nameser.h \
@@ -394,7 +324,6 @@ langinfo.h \
limits.h \
locale.h \
mach-o/dyld.h \
netinet/in.h \
pwd.h \
resolv.h \
signal.h \
@@ -414,15 +343,26 @@ sys/statfs.h \
sys/statvfs.h \
sys/vfs.h \
sys/sysexits.h \
sys/time.h \
sys/types.h \
sys/varargs.h \
sys/wait.h \
unistd.h \
unix.h \
utime.h \
sys/utsname.h \
)
],[],[],[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
])
@@ -490,7 +430,6 @@ flock \
gai_strerror \
gcvt \
getlogin \
gethostbyaddr \
getprotobyname \
getprotobynumber \
getservbyname \
@@ -498,7 +437,6 @@ getservbyport \
getrusage \
gettimeofday \
gmtime_r \
inet_aton \
isascii \
link \
localtime_r \
@@ -951,7 +889,7 @@ AC_SUBST(EXPANDED_SYSCONFDIR)
AC_SUBST(EXPANDED_LOCALSTATEDIR)
AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
PHP_BUILD_RPATH
PHP_UTILIZE_RPATHS
PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
PHP_REMOVE_USR_LIB(LDFLAGS)
@@ -960,9 +898,9 @@ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
PHP_BUILD_DATE=`date '+%Y-%m-%d'`
AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
PHP_UNAME=`uname -a`
PHP_UNAME=`uname -a | xargs`
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
PHP_OS=`uname`
PHP_OS=`uname | xargs`
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
if test "$disable_cli" != "1"; then
@@ -1038,6 +976,7 @@ PHP_SUBST(SHARED_LIBTOOL)
PHP_SUBST(TSRM_DIR)
PHP_SUBST(TSRM_LIB)
PHP_SUBST(WARNING_LEVEL)
PHP_SUBST(PHP_FRAMEWORKS)
PHP_SUBST_OLD(YACC)
PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
@@ -1108,7 +1047,7 @@ PHP_ADD_SOURCES(Zend, \
zend_ini.c zend_qsort.c zend_multibyte.c)
if test -r "$abs_srcdir/Zend/zend_objects.c"; then
PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c)
PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_mm.c)
fi
dnl Selectively disable optimization due to high RAM usage during
@@ -1239,7 +1178,7 @@ cat <<X
X
fi
if test "$MYSQL_MODULE_TYPE" = "builtin" && test "$PHP_SAPI" != "cgi" && test "$PHP_SAPI" != "cli"; then
if test "$MYSQL_MODULE_TYPE" = "builtin" && test "$PHP_SAPI" != "cgi" && test "$PHP_SAPI" != "cli" && test "$php_multiple_shlib_versions_ok" != "yes"; then
cat <<X
+--------------------------------------------------------------------+
| *** WARNING *** |
+3 -3
View File
@@ -126,7 +126,7 @@ PHP_FUNCTION(aspell_suggest)
sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type);
if(!sc)
{
php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin));
php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin));
RETURN_FALSE;
}
@@ -160,7 +160,7 @@ PHP_FUNCTION(aspell_check)
sc= (aspell *) zend_list_find(Z_LVAL_PP(scin), &type);
if(!sc)
{
php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin));
php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin));
RETURN_FALSE;
}
if (aspell_check(sc, Z_STRVAL_PP(word)))
@@ -192,7 +192,7 @@ PHP_FUNCTION(aspell_check_raw)
sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type);
if(!sc)
{
php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin));
php_error(E_WARNING, "%s(): %d is not an ASPELL result index", get_active_function_name(TSRMLS_C), Z_LVAL_PP(scin));
RETURN_FALSE;
}
if (aspell_check_raw(sc, Z_STRVAL_PP(word)))
+14 -33
View File
@@ -47,10 +47,10 @@ zend_module_entry bcmath_module_entry = {
STANDARD_MODULE_HEADER,
"bcmath",
bcmath_functions,
PHP_MINIT(bcmath),
PHP_MSHUTDOWN(bcmath),
PHP_RINIT(bcmath),
NULL,
NULL,
PHP_RINIT(bcmath),
PHP_RSHUTDOWN(bcmath),
PHP_MINFO(bcmath),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
@@ -65,9 +65,9 @@ static long bc_precision;
#endif
/* Storage used for special numbers. */
bc_num _zero_;
bc_num _one_;
bc_num _two_;
extern bc_num _zero_;
extern bc_num _one_;
extern bc_num _two_;
/* Make a copy of a number! Just increments the reference count! */
@@ -85,34 +85,12 @@ void init_num (bc_num *num)
}
PHP_MINIT_FUNCTION(bcmath)
{
extern bc_num _zero_;
extern bc_num _one_;
extern bc_num _two_;
_zero_ = bc_new_num (1, 0);
_one_ = bc_new_num (1, 0);
_one_->n_value[0] = 1;
_two_ = bc_new_num (1, 0);
_two_->n_value[0] = 2;
persist_alloc(_zero_);
persist_alloc(_one_);
persist_alloc(_two_);
persist_alloc(_zero_->n_ptr);
persist_alloc(_one_->n_ptr);
persist_alloc(_two_->n_ptr);
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(bcmath)
PHP_RSHUTDOWN_FUNCTION(bcmath)
{
bc_free_num(&_zero_);
bc_free_num(&_one_);
bc_free_num(&_two_);
return SUCCESS;
}
@@ -122,6 +100,9 @@ PHP_RINIT_FUNCTION(bcmath)
if (cfg_get_long("bcmath.scale", &bc_precision)==FAILURE) {
bc_precision=0;
}
bc_init_numbers();
return SUCCESS;
}
@@ -301,7 +282,7 @@ PHP_FUNCTION(bcdiv)
Z_TYPE_P(return_value) = IS_STRING;
break;
case -1: /* division by zero */
php_error(E_WARNING, "Division by zero");
php_error(E_WARNING, "%s(): Division by zero", get_active_function_name(TSRMLS_C));
break;
}
bc_free_num(&first);
@@ -342,7 +323,7 @@ PHP_FUNCTION(bcmod)
Z_TYPE_P(return_value) = IS_STRING;
break;
case -1:
php_error(E_WARNING, "Division by zero");
php_error(E_WARNING, "%s(): Division by zero", get_active_function_name(TSRMLS_C));
break;
}
bc_free_num(&first);
@@ -428,7 +409,7 @@ PHP_FUNCTION(bcsqrt)
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
} else {
php_error(E_WARNING, "Square root of negative number");
php_error(E_WARNING, "%s(): Square root of negative number", get_active_function_name(TSRMLS_C));
}
bc_free_num(&result);
return;
+1 -2
View File
@@ -26,9 +26,8 @@
extern zend_module_entry bcmath_module_entry;
#define phpext_bcmath_ptr &bcmath_module_entry
PHP_MINIT_FUNCTION(bcmath);
PHP_MSHUTDOWN_FUNCTION(bcmath);
PHP_RINIT_FUNCTION(bcmath);
PHP_RSHUTDOWN_FUNCTION(bcmath);
PHP_MINFO_FUNCTION(bcmath);
PHP_FUNCTION(bcadd);
+1 -1
View File
@@ -48,7 +48,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
}
if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */
php_error(E_WARNING, "easter_date() is only valid for years between 1970 and 2037 inclusive");
php_error(E_WARNING, "%s(): This function is only valid for years between 1970 and 2037 inclusive", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
+1 -1
View File
@@ -199,7 +199,7 @@ PHP_FUNCTION(ccvs_new) /* cv_new() */
convert_to_string_ex(psess);
if (!Z_STRVAL_PP(psess)) {
php_error(E_WARNING, "Invalid session to ccvs_new()");
php_error(E_WARNING, "%s(): Invalid session", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
+47 -36
View File
@@ -576,7 +576,7 @@ PHP_FUNCTION(com_load)
}
} else {
if (!INI_INT("com.allow_dcom")) {
php_error(E_WARNING, "DCOM is disabled");
php_error(E_WARNING, "%s(): DCOM is disabled", get_active_function_name(TSRMLS_C));
RETURN_NULL();
} else {
flags = CLSCTX_REMOTE_SERVER;
@@ -621,7 +621,7 @@ PHP_FUNCTION(com_load)
if (FAILED(hr)) {
php_COM_destruct(obj TSRMLS_CC);
error_message = php_COM_error_message(hr TSRMLS_CC);
php_error(E_WARNING,"Invalid ProgID, GUID string, or Moniker: %s", error_message);
php_error(E_WARNING, "%s(): Invalid ProgID, GUID string, or Moniker: %s", get_active_function_name(TSRMLS_C), error_message);
LocalFree(error_message);
RETURN_NULL();
}
@@ -679,7 +679,7 @@ PHP_FUNCTION(com_load)
if (FAILED(hr)) {
error_message = php_COM_error_message(hr TSRMLS_CC);
clsid_str = php_string_from_clsid(&clsid TSRMLS_CC);
php_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s",clsid_str,error_message);
php_error(E_WARNING, "%s(): Unable to obtain IDispatch interface for CLSID %s: %s", get_active_function_name(TSRMLS_C), clsid_str, error_message);
LocalFree(error_message);
efree(clsid_str);
php_COM_destruct(obj TSRMLS_CC);
@@ -753,7 +753,7 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
break;
default:
php_error(E_WARNING,"Wrong argument count to IEnumVariant::Next()");
php_error(E_WARNING, "%s(): Wrong argument count to IEnumVariant::Next()", get_active_function_name(TSRMLS_C));
return FAILURE;
}
@@ -771,7 +771,7 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Next(C_ENUMVARIANT(obj), count, pSA->pvData, &count))) {
char *error_message = php_COM_error_message(hr TSRMLS_CC);
php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
php_error(E_WARNING, "%s(): IEnumVariant::Next() failed: %s", get_active_function_name(TSRMLS_C), error_message);
efree(error_message);
VariantClear(var_result);
return FAILURE;
@@ -781,7 +781,7 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
rgsabound[0].cElements = count;
if (FAILED(SafeArrayRedim(pSA, rgsabound))) {
char *error_message = php_COM_error_message(hr TSRMLS_CC);
php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
php_error(E_WARNING, "%s(): IEnumVariant::Next() failed: %s", get_active_function_name(TSRMLS_C), error_message);
efree(error_message);
VariantClear(var_result);
return FAILURE;
@@ -819,7 +819,7 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
} else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset")) {
if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj)))) {
char *error_message = php_COM_error_message(hr TSRMLS_CC);
php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
php_error(E_WARNING,"%s(): IEnumVariant::Next() failed: %s", get_active_function_name(TSRMLS_C), error_message);
efree(error_message);
return FAILURE;
}
@@ -838,12 +838,12 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
break;
default:
php_error(E_WARNING,"Wrong argument count to IEnumVariant::Skip()");
php_error(E_WARNING, "%s(): Wrong argument count to IEnumVariant::Skip()", get_active_function_name(TSRMLS_C));
return FAILURE;
}
if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Skip(C_ENUMVARIANT(obj), count))) {
char *error_message = php_COM_error_message(hr TSRMLS_CC);
php_error(E_WARNING,"IEnumVariant::Next() failed: %s", error_message);
php_error(E_WARNING,"%s(): IEnumVariant::Next() failed: %s", get_active_function_name(TSRMLS_C), error_message);
efree(error_message);
return FAILURE;
}
@@ -858,7 +858,7 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
if (FAILED(hr)) {
error_message = php_COM_error_message(hr TSRMLS_CC);
php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(function_name), error_message);
php_error(E_WARNING, "%s(): Unable to lookup %s: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(function_name), error_message);
LocalFree(error_message);
efree(funcname);
return FAILURE;
@@ -891,10 +891,10 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
if (FAILED(hr)) {
error_message = php_COM_error_message(hr TSRMLS_CC);
if (ErrString) {
php_error(E_WARNING,"Invoke() failed: %s %s", error_message, ErrString);
php_error(E_WARNING, "%s(): Invoke() failed: %s %s", get_active_function_name(TSRMLS_C), error_message, ErrString);
pefree(ErrString, 1);
} else {
php_error(E_WARNING,"Invoke() failed: %s", error_message);
php_error(E_WARNING, "%s(): Invoke() failed: %s", get_active_function_name(TSRMLS_C), error_message);
}
LocalFree(error_message);
return FAILURE;
@@ -930,7 +930,7 @@ PHP_FUNCTION(com_invoke)
convert_to_long(object);
obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
if (!obj || (type != IS_COM)) {
php_error(E_WARNING,"%d is not a COM object handler", Z_STRVAL_P(function_name));
php_error(E_WARNING,"%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C), Z_STRVAL_P(function_name));
RETURN_NULL();
}
@@ -974,7 +974,7 @@ PHP_FUNCTION(com_release)
convert_to_long_ex(&object);
obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
if (!obj || (type != IS_COM)) {
php_error(E_WARNING,"%d is not a COM object handler");
php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1005,7 +1005,7 @@ PHP_FUNCTION(com_addref)
obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
if (!obj || (type != IS_COM))
{
php_error(E_WARNING,"%d is not a COM object handler");
php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1500,7 +1500,7 @@ static int do_COM_propget(VARIANT *var_result, comval *obj, pval *arg_property,
if (FAILED(hr)) {
error_message = php_COM_error_message(hr TSRMLS_CC);
php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(arg_property), error_message);
php_error(E_WARNING, "%s(): Unable to lookup %s: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(arg_property), error_message);
LocalFree(error_message);
efree(propname);
if (cleanup) {
@@ -1517,10 +1517,10 @@ static int do_COM_propget(VARIANT *var_result, comval *obj, pval *arg_property,
if (FAILED(hr)) {
error_message = php_COM_error_message(hr TSRMLS_CC);
if (ErrString) {
php_error(E_WARNING,"PropGet() failed: %s %s", error_message, ErrString);
php_error(E_WARNING, "%s(): PropGet() failed: %s %s", get_active_function_name(TSRMLS_C), error_message, ErrString);
pefree(ErrString, 1);
} else {
php_error(E_WARNING,"PropGet() failed: %s", error_message);
php_error(E_WARNING, "%s(): PropGet() failed: %s", get_active_function_name(TSRMLS_C), error_message);
}
LocalFree(error_message);
efree(propname);
@@ -1559,14 +1559,19 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
if (FAILED(hr)) {
error_message = php_COM_error_message(hr TSRMLS_CC);
php_error(E_WARNING,"Unable to lookup %s: %s", Z_STRVAL_P(arg_property), error_message);
php_error(E_WARNING, "%s(): Unable to lookup %s: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(arg_property), error_message);
LocalFree(error_message);
efree(propname);
FREE_VARIANT(var_result);
FREE_VARIANT(new_value);
RETURN_NULL();
if (return_value) {
RETVAL_NULL();
}
return;
}
php_pval_to_variant(value, new_value, codepage TSRMLS_CC);
@@ -1580,10 +1585,10 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
if (FAILED(hr)) {
error_message = php_COM_error_message(hr TSRMLS_CC);
if (ErrString) {
php_error(E_WARNING,"PropPut() failed: %s %s", error_message, ErrString);
php_error(E_WARNING, "%s(): PropPut() failed: %s %s", get_active_function_name(TSRMLS_C), error_message, ErrString);
pefree(ErrString, 1);
} else {
php_error(E_WARNING,"PropPut() failed: %s", error_message);
php_error(E_WARNING, "%s(): PropPut() failed: %s", get_active_function_name(TSRMLS_C), error_message);
}
LocalFree(error_message);
@@ -1592,7 +1597,11 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
efree(new_value);
efree(propname);
RETURN_NULL();
if (return_value) {
RETVAL_NULL();
}
return;
}
if (return_value) {
@@ -1637,7 +1646,7 @@ PHP_FUNCTION(com_propget)
convert_to_long(arg_comval);
obj = (comval *)zend_list_find(Z_LVAL_P(arg_comval), &type);
if (!obj || (type != IS_COM)) {
php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_comval));
php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C), Z_LVAL_P(arg_comval));
RETURN_NULL();
}
convert_to_string_ex(&arg_property);
@@ -1671,7 +1680,7 @@ PHP_FUNCTION(com_propput)
/* obtain comval interface */
obj = (comval *)zend_list_find(Z_LVAL_P(arg_comval), &type);
if (!obj || (type != IS_COM)) {
php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_comval));
php_error(E_WARNING, "%s(): %d is not a COM object handler", get_active_function_name(TSRMLS_C), Z_LVAL_P(arg_comval));
RETURN_NULL();
}
convert_to_string_ex(&arg_property);
@@ -2194,7 +2203,7 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
while (SUCCEEDED(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc))) {
BSTR bstr_ids;
zend_constant c;
zval exists, results;
zval exists, results, value;
char *const_name;
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
@@ -2209,25 +2218,27 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
SysFreeString(bstr_ids);
/* Before registering the contsnt, let's see if we can find it */
if (zend_get_constant(c.name, c.name_len-1, &exists TSRMLS_CC)) {
if (zend_get_constant(c.name, c.name_len - 1, &exists TSRMLS_CC)) {
/* Oops, it already exists. No problem if it is defined as the same value */
/* Check to see if they are the same */
if (!compare_function(&results, &c.value, &exists TSRMLS_CC) && INI_INT("com.autoregister_verbose")) {
php_error(E_WARNING,"Type library value %s is already defined and has a different value", c.name);
php_error(E_WARNING, "%s(): Type library value %s is already defined and has a different value", get_active_function_name(TSRMLS_C), c.name);
}
free(c.name);
j++;
continue;
}
php_variant_to_pval(pVarDesc->lpvarValue, &c.value, codepage TSRMLS_CC);
if (mode & CONST_PERSISTENT) {
zval_persist(&c.value TSRMLS_CC);
mode |= CONST_EFREE_PERSISTENT;
}
c.flags = mode;
php_variant_to_pval(pVarDesc->lpvarValue, &value, codepage TSRMLS_CC);
/* we only import enumerations (=int) */
if (Z_TYPE(value) == IS_LONG) {
c.flags = mode;
c.value.type = IS_LONG;
c.value.value.lval = Z_LVAL(value);
c.module_number = 0; /* the module number is not available here */
zend_register_constant(&c TSRMLS_CC);
zend_register_constant(&c TSRMLS_CC);
}
j++;
}
@@ -2257,7 +2268,7 @@ PHP_FUNCTION(com_isenum)
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &comval_handle);
obj = (comval *) zend_list_find(Z_LVAL_PP(comval_handle), &type);
if (!obj || (type != IS_COM)) {
php_error(E_WARNING,"%s is not a COM object handler", "");
php_error(E_WARNING,"%s(): %s is not a COM object handler", get_active_function_name(TSRMLS_C), "");
RETURN_FALSE;
}
+3 -2
View File
@@ -149,7 +149,7 @@ static void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend
ALLOC_ZVAL(object_handle);
*object_handle = *return_value;
pval_copy_constructor(object_handle);
zval_copy_ctor(object_handle);
INIT_PZVAL(object_handle);
zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
zval_dtor(&function_name->element);
@@ -195,10 +195,11 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r
php_error(E_WARNING, "Unknown method.");
break;
zval_dtor(&overloaded_property->element);
}
}
zval_dtor(&overloaded_property->element);
return result;
}
+81 -81
View File
@@ -262,7 +262,7 @@ PHP_FUNCTION(cpdf_set_creator)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d (type=%d)", id, type);
php_error(E_WARNING, "%s(): Unable to find identifier %d (type=%d)", get_active_function_name(TSRMLS_C), id, type);
RETURN_FALSE;
}
@@ -289,7 +289,7 @@ PHP_FUNCTION(cpdf_set_title)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d (type=%d)", id, type);
php_error(E_WARNING, "%s(): Unable to find identifier %d (type=%d)", get_active_function_name(TSRMLS_C), id, type);
RETURN_FALSE;
}
@@ -317,7 +317,7 @@ PHP_FUNCTION(cpdf_set_subject)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d (type=%d)", id, type);
php_error(E_WARNING, "%s(): Unable to find identifier %d (type=%d)", get_active_function_name(TSRMLS_C), id, type);
RETURN_FALSE;
}
@@ -344,7 +344,7 @@ PHP_FUNCTION(cpdf_set_keywords)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d (type=%d)", id, type);
php_error(E_WARNING, "%s(): Unable to find identifier %d (type=%d)", get_active_function_name(TSRMLS_C), id, type);
RETURN_FALSE;
}
@@ -377,7 +377,7 @@ PHP_FUNCTION(cpdf_set_viewer_preferences)
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -471,7 +471,7 @@ PHP_FUNCTION(cpdf_open)
convert_to_string(arg2);
#if APACHE
if(strcmp(Z_STRVAL_P(arg2), "-") == 0)
php_error(E_WARNING, "Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead.");
php_error(E_WARNING, "%s(): Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead.", get_active_function_name(TSRMLS_C));
#endif
cpdf_setOutputFilename(cpdf, Z_STRVAL_P(arg2));
}
@@ -498,7 +498,7 @@ PHP_FUNCTION(cpdf_close)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
zend_list_delete(id);
@@ -536,7 +536,7 @@ PHP_FUNCTION(cpdf_page_init)
width = Z_LVAL_P(argv[4]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -571,7 +571,7 @@ PHP_FUNCTION(cpdf_finalize_page)
pagenr=Z_LVAL_P(arg2);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -599,7 +599,7 @@ PHP_FUNCTION(cpdf_set_current_page)
pagenr=Z_LVAL_P(arg2);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -625,7 +625,7 @@ PHP_FUNCTION(cpdf_begin_text)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -651,7 +651,7 @@ PHP_FUNCTION(cpdf_end_text)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -678,7 +678,7 @@ PHP_FUNCTION(cpdf_show)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -709,7 +709,7 @@ PHP_FUNCTION(cpdf_show_xy)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -743,7 +743,7 @@ PHP_FUNCTION(cpdf_continue_text)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -770,7 +770,7 @@ PHP_FUNCTION(cpdf_text)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -862,12 +862,12 @@ PHP_FUNCTION(cpdf_set_font)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
/* if(Z_LVAL_P(arg4) > 6) {
php_error(E_WARNING, "Font encoding set to 5");
php_error(E_WARNING, "%s(): Font encoding set to 5", get_active_function_name(TSRMLS_C));
Z_LVAL_P(arg4) = 5;
}
*/
@@ -895,7 +895,7 @@ PHP_FUNCTION(cpdf_set_font_directories)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -922,7 +922,7 @@ PHP_FUNCTION(cpdf_set_font_map_file)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -949,7 +949,7 @@ PHP_FUNCTION(cpdf_set_leading)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -976,7 +976,7 @@ PHP_FUNCTION(cpdf_set_text_rendering)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1003,7 +1003,7 @@ PHP_FUNCTION(cpdf_set_horiz_scaling)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1030,7 +1030,7 @@ PHP_FUNCTION(cpdf_set_text_rise)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1061,12 +1061,12 @@ PHP_FUNCTION(cpdf_set_text_matrix)
matrix=Z_ARRVAL_P(arg2);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
if(zend_hash_num_elements(matrix) != 6) {
php_error(E_WARNING, "Text matrix must have 6 elements");
php_error(E_WARNING, "%s(): Text matrix must have 6 elements", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1113,7 +1113,7 @@ PHP_FUNCTION(cpdf_set_text_pos)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1147,7 +1147,7 @@ PHP_FUNCTION(cpdf_rotate_text)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1174,7 +1174,7 @@ PHP_FUNCTION(cpdf_set_char_spacing)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1201,7 +1201,7 @@ PHP_FUNCTION(cpdf_set_word_spacing)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1229,7 +1229,7 @@ PHP_FUNCTION(cpdf_stringwidth)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1255,7 +1255,7 @@ PHP_FUNCTION(cpdf_save)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1281,7 +1281,7 @@ PHP_FUNCTION(cpdf_restore)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1309,7 +1309,7 @@ PHP_FUNCTION(cpdf_translate)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1337,7 +1337,7 @@ PHP_FUNCTION(cpdf_scale)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1364,7 +1364,7 @@ PHP_FUNCTION(cpdf_rotate)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1391,12 +1391,12 @@ PHP_FUNCTION(cpdf_setflat)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
if((Z_LVAL_P(arg2) > 100) && (Z_LVAL_P(arg2) < 0)) {
php_error(E_WARNING, "Parameter of pdf_setflat() has to between 0 and 100");
php_error(E_WARNING, "%s(): Parameter has to between 0 and 100", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1423,12 +1423,12 @@ PHP_FUNCTION(cpdf_setlinejoin)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
if((Z_LVAL_P(arg2) > 2) && (Z_LVAL_P(arg2) < 0)) {
php_error(E_WARNING, "Parameter of pdf_setlinejoin() has to between 0 and 2");
php_error(E_WARNING, "%s(): Parameter has to between 0 and 2", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1455,12 +1455,12 @@ PHP_FUNCTION(cpdf_setlinecap)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
if((Z_LVAL_P(arg2) > 2) && (Z_LVAL_P(arg2) < 0)) {
php_error(E_WARNING, "Parameter of pdf_setlinecap() has to be > 0 and =< 2");
php_error(E_WARNING, "%s(): Parameter has to be > 0 and =< 2", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1487,12 +1487,12 @@ PHP_FUNCTION(cpdf_setmiterlimit)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
if(Z_DVAL_P(arg2) < 1) {
php_error(E_WARNING, "Parameter of pdf_setmiterlimit() has to be >= 1");
php_error(E_WARNING, "%s(): Parameter has to be >= 1", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1519,7 +1519,7 @@ PHP_FUNCTION(cpdf_setlinewidth)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1549,7 +1549,7 @@ PHP_FUNCTION(cpdf_setdash)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1581,7 +1581,7 @@ PHP_FUNCTION(cpdf_moveto)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1618,7 +1618,7 @@ PHP_FUNCTION(cpdf_rmoveto)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1659,7 +1659,7 @@ PHP_FUNCTION(cpdf_curveto)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1706,7 +1706,7 @@ PHP_FUNCTION(cpdf_lineto)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1743,7 +1743,7 @@ PHP_FUNCTION(cpdf_rlineto)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1781,7 +1781,7 @@ PHP_FUNCTION(cpdf_circle)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1821,7 +1821,7 @@ PHP_FUNCTION(cpdf_arc)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1860,7 +1860,7 @@ PHP_FUNCTION(cpdf_rect)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1899,7 +1899,7 @@ PHP_FUNCTION(cpdf_newpath)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1925,7 +1925,7 @@ PHP_FUNCTION(cpdf_closepath)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1951,7 +1951,7 @@ PHP_FUNCTION(cpdf_closepath_stroke)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1978,7 +1978,7 @@ PHP_FUNCTION(cpdf_stroke)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2004,7 +2004,7 @@ PHP_FUNCTION(cpdf_fill)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2030,7 +2030,7 @@ PHP_FUNCTION(cpdf_fill_stroke)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2057,7 +2057,7 @@ PHP_FUNCTION(cpdf_closepath_fill_stroke)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2085,7 +2085,7 @@ PHP_FUNCTION(cpdf_clip)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2112,7 +2112,7 @@ PHP_FUNCTION(cpdf_setgray_fill)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2139,7 +2139,7 @@ PHP_FUNCTION(cpdf_setgray_stroke)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2166,7 +2166,7 @@ PHP_FUNCTION(cpdf_setgray)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2195,7 +2195,7 @@ PHP_FUNCTION(cpdf_setrgbcolor_fill)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2224,7 +2224,7 @@ PHP_FUNCTION(cpdf_setrgbcolor_stroke)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2253,7 +2253,7 @@ PHP_FUNCTION(cpdf_setrgbcolor)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2284,7 +2284,7 @@ PHP_FUNCTION(cpdf_set_page_animation)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2311,7 +2311,7 @@ PHP_FUNCTION(cpdf_finalize)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2338,7 +2338,7 @@ PHP_FUNCTION(cpdf_output_buffer)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2367,13 +2367,13 @@ PHP_FUNCTION(cpdf_save_to_file)
id=Z_LVAL_P(arg1);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
#if APACHE
if(strcmp(Z_STRVAL_P(arg2), "-") == 0)
php_error(E_WARNING, "Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Use cpdf_output_buffer() instead.");
php_error(E_WARNING, "%s(): Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Use cpdf_output_buffer() instead.", get_active_function_name(TSRMLS_C));
#endif
cpdf_savePDFmemoryStreamToFile(pdf, Z_STRVAL_P(arg2));
@@ -2414,7 +2414,7 @@ PHP_FUNCTION(cpdf_import_jpeg)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2478,7 +2478,7 @@ PHP_FUNCTION(cpdf_place_inline_image)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2488,11 +2488,11 @@ PHP_FUNCTION(cpdf_place_inline_image)
ZEND_GET_RESOURCE_TYPE_ID(CPDF_GLOBAL(le_gd), "gd");
if(!CPDF_GLOBAL(le_gd))
{
php_error(E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded.");
php_error(E_ERROR, "%s(): Unable to find handle for GD image stream. Please check the GD extension is loaded.", get_active_function_name(TSRMLS_C));
}
if (!im || type != CPDF_GLOBAL(le_gd)) {
php_error(E_WARNING, "cpdf: Unable to find image pointer");
php_error(E_WARNING, "%s(): Unable to find image pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -2567,7 +2567,7 @@ PHP_FUNCTION(cpdf_add_annotation)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2626,7 +2626,7 @@ PHP_FUNCTION(cpdf_set_action_url)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2683,7 +2683,7 @@ PHP_FUNCTION(cpdf_add_outline)
id=Z_LVAL_P(argv[0]);
pdf = zend_list_find(id, &type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING, "Unable to find identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2691,7 +2691,7 @@ PHP_FUNCTION(cpdf_add_outline)
lastoutline = zend_list_find(oid, &type);
if(!lastoutline || type!=CPDF_GLOBAL(le_outline)) {
lastoutline = NULL;
/* php_error(E_WARNING, "Unable to find last outline entry %d", id);
/* php_error(E_WARNING, "%s(): Unable to find last outline entry %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE; */
}
+288 -263
View File
@@ -106,6 +106,8 @@ PHP_MINIT_FUNCTION(curl)
le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, "curl", module_number);
/* Constants for curl_setopt() */
REGISTER_CURL_CONSTANT(CURLOPT_DNS_USE_GLOBAL_CACHE);
REGISTER_CURL_CONSTANT(CURLOPT_DNS_CACHE_TIMEOUT);
REGISTER_CURL_CONSTANT(CURLOPT_PORT);
REGISTER_CURL_CONSTANT(CURLOPT_FILE);
REGISTER_CURL_CONSTANT(CURLOPT_INFILE);
@@ -318,7 +320,8 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
t->func,
retval, 2, argv TSRMLS_CC);
if (error == FAILURE) {
php_error(E_WARNING, "Couldn't call the CURLOPT_WRITEFUNCTION");
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_WRITEFUNCTION",
get_active_function_name(TSRMLS_C));
length = -1;
}
else {
@@ -372,7 +375,8 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
t->func,
retval, 3, argv TSRMLS_CC);
if (error == FAILURE) {
php_error(E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION",
get_active_function_name(TSRMLS_C));
length = -1;
}
else {
@@ -402,49 +406,50 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
TSRMLS_FETCH();
switch (t->method) {
case PHP_CURL_STDOUT:
/* Handle special case write when we're returning the entire transfer
*/
if (ch->handlers->write->method == PHP_CURL_RETURN)
smart_str_appendl(&ch->handlers->write->buf, data, (int) length);
else
PUTS(data);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
case PHP_CURL_USER: {
zval *argv[2];
zval *retval;
int error;
TSRMLS_FETCH();
case PHP_CURL_STDOUT:
/* Handle special case write when we're returning the entire transfer
*/
if (ch->handlers->write->method == PHP_CURL_RETURN)
smart_str_appendl(&ch->handlers->write->buf, data, (int) length);
else
PUTS(data);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
case PHP_CURL_USER: {
zval *argv[2];
zval *retval;
int error;
TSRMLS_FETCH();
MAKE_STD_ZVAL(argv[0]);
MAKE_STD_ZVAL(argv[1]);
MAKE_STD_ZVAL(retval);
MAKE_STD_ZVAL(argv[0]);
MAKE_STD_ZVAL(argv[1]);
MAKE_STD_ZVAL(retval);
ZVAL_RESOURCE(argv[0], ch->id);
zend_list_addref(ch->id);
ZVAL_STRINGL(argv[1], data, length, 1);
ZVAL_RESOURCE(argv[0], ch->id);
zend_list_addref(ch->id);
ZVAL_STRINGL(argv[1], data, length, 1);
error = call_user_function(EG(function_table),
NULL,
t->func,
retval, 2, argv TSRMLS_CC);
if (error == FAILURE) {
php_error(E_WARNING, "Couldn't call the CURLOPT_HEADERFUNCTION");
length = -1;
error = call_user_function(EG(function_table),
NULL,
t->func,
retval, 2, argv TSRMLS_CC);
if (error == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_HEADERFUNCTION",
get_active_function_name(TSRMLS_C));
length = -1;
}
else {
length = Z_LVAL_P(retval);
}
zval_ptr_dtor(&argv[0]);
zval_ptr_dtor(&argv[1]);
zval_ptr_dtor(&retval);
break;
}
else {
length = Z_LVAL_P(retval);
}
zval_ptr_dtor(&argv[0]);
zval_ptr_dtor(&argv[1]);
zval_ptr_dtor(&retval);
break;
case PHP_CURL_IGNORE:
return length;
}
case PHP_CURL_IGNORE:
return length;
}
return length;
}
/* }}} */
@@ -475,12 +480,13 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
func,
retval, 2, argv TSRMLS_CC);
if (error == FAILURE) {
php_error(E_WARNING, "Couldn't call the CURLOPT_PASSWDFUNCTION");
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_PASSWDFUNCTION", get_active_function_name(TSRMLS_C));
ret = -1;
}
else {
if (Z_STRLEN_P(retval) > buflen) {
php_error(E_WARNING, "Returned password is too long for libcurl to handle");
php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle",
get_active_function_name(TSRMLS_C));
ret = -1;
}
else {
@@ -570,7 +576,7 @@ PHP_FUNCTION(curl_init)
ch->cp = curl_easy_init();
if (! ch->cp) {
php_error(E_WARNING, "Cannot initialize a new cURL handle");
php_error(E_WARNING, "%s(): Cannot initialize a new cURL handle", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -588,6 +594,9 @@ PHP_FUNCTION(curl_init)
curl_easy_setopt(ch->cp, CURLOPT_INFILE, (void *) ch);
curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_header);
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
if (argc > 0) {
char *urlcopy;
convert_to_string_ex(url);
@@ -607,12 +616,12 @@ PHP_FUNCTION(curl_init)
PHP_FUNCTION(curl_setopt)
{
zval **zid,
**zoption,
**zvalue;
**zoption,
**zvalue;
php_curl *ch;
CURLcode error;
CURLcode error=CURLE_OK;
int option;
if (ZEND_NUM_ARGS() != 3 ||
zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -622,239 +631,255 @@ PHP_FUNCTION(curl_setopt)
option = Z_LVAL_PP(zoption);
switch (option) {
case CURLOPT_INFILESIZE:
case CURLOPT_VERBOSE:
case CURLOPT_HEADER:
case CURLOPT_NOPROGRESS:
case CURLOPT_NOBODY:
case CURLOPT_FAILONERROR:
case CURLOPT_UPLOAD:
case CURLOPT_POST:
case CURLOPT_FTPLISTONLY:
case CURLOPT_FTPAPPEND:
case CURLOPT_NETRC:
case CURLOPT_FOLLOWLOCATION:
case CURLOPT_PUT:
case CURLOPT_MUTE:
case CURLOPT_TIMEOUT:
case CURLOPT_LOW_SPEED_LIMIT:
case CURLOPT_SSLVERSION:
case CURLOPT_LOW_SPEED_TIME:
case CURLOPT_RESUME_FROM:
case CURLOPT_TIMEVALUE:
case CURLOPT_TIMECONDITION:
case CURLOPT_TRANSFERTEXT:
case CURLOPT_HTTPPROXYTUNNEL:
case CURLOPT_FILETIME:
case CURLOPT_MAXREDIRS:
case CURLOPT_MAXCONNECTS:
case CURLOPT_CLOSEPOLICY:
case CURLOPT_FRESH_CONNECT:
case CURLOPT_FORBID_REUSE:
case CURLOPT_CONNECTTIMEOUT:
case CURLOPT_SSL_VERIFYHOST:
case CURLOPT_SSL_VERIFYPEER:
convert_to_long_ex(zvalue);
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
break;
case CURLOPT_URL:
case CURLOPT_PROXY:
case CURLOPT_USERPWD:
case CURLOPT_PROXYUSERPWD:
case CURLOPT_RANGE:
case CURLOPT_CUSTOMREQUEST:
case CURLOPT_USERAGENT:
case CURLOPT_FTPPORT:
case CURLOPT_COOKIE:
case CURLOPT_SSLCERT:
case CURLOPT_SSLCERTPASSWD:
case CURLOPT_COOKIEFILE:
case CURLOPT_REFERER:
case CURLOPT_INTERFACE:
case CURLOPT_KRB4LEVEL:
case CURLOPT_RANDOM_FILE:
case CURLOPT_EGDSOCKET:
case CURLOPT_CAINFO:
case CURLOPT_COOKIEJAR:
case CURLOPT_SSL_CIPHER_LIST: {
char *copystr = NULL;
case CURLOPT_INFILESIZE:
case CURLOPT_VERBOSE:
case CURLOPT_HEADER:
case CURLOPT_NOPROGRESS:
case CURLOPT_NOBODY:
case CURLOPT_FAILONERROR:
case CURLOPT_UPLOAD:
case CURLOPT_POST:
case CURLOPT_FTPLISTONLY:
case CURLOPT_FTPAPPEND:
case CURLOPT_NETRC:
case CURLOPT_FOLLOWLOCATION:
case CURLOPT_PUT:
case CURLOPT_MUTE:
case CURLOPT_TIMEOUT:
case CURLOPT_LOW_SPEED_LIMIT:
case CURLOPT_SSLVERSION:
case CURLOPT_LOW_SPEED_TIME:
case CURLOPT_RESUME_FROM:
case CURLOPT_TIMEVALUE:
case CURLOPT_TIMECONDITION:
case CURLOPT_TRANSFERTEXT:
case CURLOPT_HTTPPROXYTUNNEL:
case CURLOPT_FILETIME:
case CURLOPT_MAXREDIRS:
case CURLOPT_MAXCONNECTS:
case CURLOPT_CLOSEPOLICY:
case CURLOPT_FRESH_CONNECT:
case CURLOPT_FORBID_REUSE:
case CURLOPT_CONNECTTIMEOUT:
case CURLOPT_SSL_VERIFYHOST:
case CURLOPT_SSL_VERIFYPEER:
case CURLOPT_DNS_USE_GLOBAL_CACHE:
convert_to_long_ex(zvalue);
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
break;
case CURLOPT_URL:
case CURLOPT_PROXY:
case CURLOPT_USERPWD:
case CURLOPT_PROXYUSERPWD:
case CURLOPT_RANGE:
case CURLOPT_CUSTOMREQUEST:
case CURLOPT_USERAGENT:
case CURLOPT_FTPPORT:
case CURLOPT_COOKIE:
case CURLOPT_SSLCERT:
case CURLOPT_SSLCERTPASSWD:
case CURLOPT_COOKIEFILE:
case CURLOPT_REFERER:
case CURLOPT_INTERFACE:
case CURLOPT_KRB4LEVEL:
case CURLOPT_RANDOM_FILE:
case CURLOPT_EGDSOCKET:
case CURLOPT_CAINFO:
case CURLOPT_COOKIEJAR:
case CURLOPT_SSL_CIPHER_LIST: {
char *copystr = NULL;
convert_to_string_ex(zvalue);
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
convert_to_string_ex(zvalue);
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
error = curl_easy_setopt(ch->cp, option, copystr);
zend_llist_add_element(&ch->to_free.str, &copystr);
error = curl_easy_setopt(ch->cp, option, copystr);
zend_llist_add_element(&ch->to_free.str, &copystr);
break;
}
case CURLOPT_FILE:
case CURLOPT_INFILE:
case CURLOPT_WRITEHEADER:
case CURLOPT_STDERR: {
FILE *fp = NULL;
int type;
void * what;
what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream());
ZEND_VERIFY_RESOURCE(what);
if (FAILURE == php_stream_cast((php_stream*)what, PHP_STREAM_AS_STDIO, (void*)&fp, REPORT_ERRORS))
RETURN_FALSE;
if (!fp) {
RETURN_FALSE;
break;
}
error = CURLE_OK;
switch (option) {
case CURLOPT_FILE:
ch->handlers->write->fp = fp;
ch->handlers->write->method = PHP_CURL_FILE;
break;
case CURLOPT_INFILE:
case CURLOPT_WRITEHEADER:
ch->handlers->write_header->fp = fp;
ch->handlers->write_header->method = PHP_CURL_FILE;
break;
case CURLOPT_INFILE:
zend_list_addref(Z_LVAL_PP(zvalue));
ch->handlers->read->fp = fp;
ch->handlers->read->fd = Z_LVAL_PP(zvalue);
break;
default:
error = curl_easy_setopt(ch->cp, option, fp);
break;
}
case CURLOPT_STDERR: {
FILE *fp = NULL;
int type;
void * what;
what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream());
ZEND_VERIFY_RESOURCE(what);
break;
}
case CURLOPT_RETURNTRANSFER:
convert_to_long_ex(zvalue);
if (Z_LVAL_PP(zvalue)) {
ch->handlers->write->method = PHP_CURL_RETURN;
}
break;
case CURLOPT_BINARYTRANSFER:
convert_to_long_ex(zvalue);
ch->handlers->write->type = PHP_CURL_BINARY;
break;
case CURLOPT_WRITEFUNCTION:
zval_add_ref(zvalue);
ch->handlers->write->func = *zvalue;
ch->handlers->write->method = PHP_CURL_USER;
break;
case CURLOPT_READFUNCTION:
zval_add_ref(zvalue);
ch->handlers->read->func = *zvalue;
ch->handlers->read->method = PHP_CURL_USER;
break;
case CURLOPT_HEADERFUNCTION:
zval_add_ref(zvalue);
ch->handlers->write_header->func = *zvalue;
ch->handlers->write_header->method = PHP_CURL_USER;
break;
case CURLOPT_PASSWDFUNCTION:
zval_add_ref(zvalue);
ch->handlers->passwd = *zvalue;
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, curl_passwd);
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA, (void *) ch);
break;
case CURLOPT_POSTFIELDS:
if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
zval **current;
HashTable *postfields;
struct HttpPost *first = NULL;
struct HttpPost *last = NULL;
char *postval;
char *string_key = NULL;
ulong num_key;
uint string_key_len;
postfields = HASH_OF(*zvalue);
if (! postfields) {
php_error(E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
if (FAILURE == php_stream_cast((php_stream *) what,
PHP_STREAM_AS_STDIO,
(void *) &fp,
REPORT_ERRORS)) {
RETURN_FALSE;
}
for (zend_hash_internal_pointer_reset(postfields);
zend_hash_get_current_data(postfields, (void **) &current) == SUCCESS;
zend_hash_move_forward(postfields)) {
if (!fp) {
RETURN_FALSE;
}
error = CURLE_OK;
switch (option) {
case CURLOPT_FILE:
ch->handlers->write->fp = fp;
ch->handlers->write->method = PHP_CURL_FILE;
break;
case CURLOPT_WRITEHEADER:
ch->handlers->write_header->fp = fp;
ch->handlers->write_header->method = PHP_CURL_FILE;
break;
case CURLOPT_INFILE:
zend_list_addref(Z_LVAL_PP(zvalue));
ch->handlers->read->fp = fp;
ch->handlers->read->fd = Z_LVAL_PP(zvalue);
break;
default:
error = curl_easy_setopt(ch->cp, option, fp);
break;
}
break;
}
case CURLOPT_RETURNTRANSFER:
convert_to_long_ex(zvalue);
if (Z_LVAL_PP(zvalue)) {
ch->handlers->write->method = PHP_CURL_RETURN;
}
break;
case CURLOPT_BINARYTRANSFER:
convert_to_long_ex(zvalue);
if (Z_LVAL_PP(zvalue)) {
ch->handlers->write->type = PHP_CURL_BINARY;
}
break;
case CURLOPT_WRITEFUNCTION:
zval_add_ref(zvalue);
ch->handlers->write->func = *zvalue;
ch->handlers->write->method = PHP_CURL_USER;
break;
case CURLOPT_READFUNCTION:
zval_add_ref(zvalue);
ch->handlers->read->func = *zvalue;
ch->handlers->read->method = PHP_CURL_USER;
break;
case CURLOPT_HEADERFUNCTION:
zval_add_ref(zvalue);
ch->handlers->write_header->func = *zvalue;
ch->handlers->write_header->method = PHP_CURL_USER;
break;
case CURLOPT_PASSWDFUNCTION:
zval_add_ref(zvalue);
ch->handlers->passwd = *zvalue;
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, curl_passwd);
error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA, (void *) ch);
break;
case CURLOPT_POSTFIELDS:
if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
zval **current;
HashTable *postfields;
struct HttpPost *first = NULL;
struct HttpPost *last = NULL;
char *postval;
char *string_key = NULL;
ulong num_key;
uint string_key_len;
postfields = HASH_OF(*zvalue);
if (! postfields) {
php_error(E_WARNING,
"%s(): Couldn't get HashTable in CURLOPT_POSTFIELDS",
get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
for (zend_hash_internal_pointer_reset(postfields);
zend_hash_get_current_data(postfields, (void **) &current) == SUCCESS;
zend_hash_move_forward(postfields)) {
SEPARATE_ZVAL(current);
convert_to_string_ex(current);
zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL);
postval = Z_STRVAL_PP(current);
if (*postval == '@') {
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key,
CURLFORM_NAMELENGTH, string_key_len - 1,
CURLFORM_FILE, ++postval,
CURLFORM_END);
}
else {
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key,
CURLFORM_NAMELENGTH, string_key_len - 1,
CURLFORM_PTRCONTENTS, postval,
CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
CURLFORM_END);
}
}
SAVE_CURL_ERROR(ch, error);
if (error != CURLE_OK) {
RETURN_FALSE;
}
zend_llist_add_element(&ch->to_free.post, &first);
error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
}
else {
char *post = NULL;
convert_to_string_ex(zvalue);
post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
zend_llist_add_element(&ch->to_free.str, &post);
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
}
break;
case CURLOPT_HTTPHEADER:
case CURLOPT_QUOTE:
case CURLOPT_POSTQUOTE: {
zval **current;
HashTable *ph;
struct curl_slist *slist = NULL;
ph = HASH_OF(*zvalue);
if (!ph) {
php_error(E_WARNING,
"%s(): You must pass either an object or an array with the CURLOPT_HTTPHEADER, "
"CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
for (zend_hash_internal_pointer_reset(ph);
zend_hash_get_current_data(ph, (void **) &current) == SUCCESS;
zend_hash_move_forward(ph)) {
char *indiv = NULL;
SEPARATE_ZVAL(current);
convert_to_string_ex(current);
zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL);
postval = Z_STRVAL_PP(current);
if (*postval == '@') {
error = curl_formadd(&first, &last, CURLFORM_COPYNAME, string_key,
CURLFORM_FILE, ++postval, CURLFORM_END);
}
else {
error = curl_formadd(&first, &last, CURLFORM_COPYNAME, string_key,
CURLFORM_PTRCONTENTS, postval,
CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
CURLFORM_END);
indiv = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current) + 1);
slist = curl_slist_append(slist, indiv);
if (! slist) {
efree(indiv);
php_error(E_WARNING, "%s(): Couldn't build curl_slist", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
zend_llist_add_element(&ch->to_free.str, &indiv);
}
zend_llist_add_element(&ch->to_free.slist, &slist);
SAVE_CURL_ERROR(ch, error);
if (error != CURLE_OK) {
RETURN_FALSE;
}
error = curl_easy_setopt(ch->cp, option, slist);
zend_llist_add_element(&ch->to_free.post, &first);
error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
break;
}
else {
char *post = NULL;
convert_to_string_ex(zvalue);
post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
zend_llist_add_element(&ch->to_free.str, &post);
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
}
break;
case CURLOPT_HTTPHEADER:
case CURLOPT_QUOTE:
case CURLOPT_POSTQUOTE: {
zval **current;
HashTable *ph;
struct curl_slist *slist = NULL;
ph = HASH_OF(*zvalue);
if (! ph) {
php_error(E_WARNING,
"You must pass either an object or an array with the CURLOPT_HTTPHEADER,"
"CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments");
RETURN_FALSE;
}
for (zend_hash_internal_pointer_reset(ph);
zend_hash_get_current_data(ph, (void **) &current) == SUCCESS;
zend_hash_move_forward(ph)) {
char *indiv = NULL;
SEPARATE_ZVAL(current);
convert_to_string_ex(current);
indiv = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current) + 1);
slist = curl_slist_append(slist, indiv);
if (! slist) {
efree(indiv);
php_error(E_WARNING, "Couldn't build curl_slist from curl_setopt()");
RETURN_FALSE;
}
zend_llist_add_element(&ch->to_free.str, &indiv);
}
zend_llist_add_element(&ch->to_free.slist, &slist);
error = curl_easy_setopt(ch->cp, option, slist);
break;
}
}
SAVE_CURL_ERROR(ch, error);
@@ -974,10 +999,10 @@ PHP_FUNCTION(curl_getinfo)
case CURLINFO_FILETIME:
case CURLINFO_SSL_VERIFYRESULT: {
long code;
curl_easy_getinfo(ch->cp, option, &code);
RETURN_LONG(code);
break;
}
case CURLINFO_TOTAL_TIME:
+2 -2
View File
@@ -105,7 +105,7 @@ PHP_FUNCTION(cybercash_encr)
macbuff);
if (array_init(return_value) == FAILURE) {
php_error(E_WARNING, "Return value from cybercash_encr could not be initialized");
php_error(E_WARNING, "%s(): Return value could not be initialized", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -156,7 +156,7 @@ PHP_FUNCTION(cybercash_decr)
macbuff);
if (array_init(return_value) == FAILURE) {
php_error(E_WARNING, "Could not initialize Return value from cybercash_decr");
php_error(E_WARNING, "%s(): Could not initialize return value", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
+8 -8
View File
@@ -167,11 +167,11 @@ PHP_FUNCTION(cyrus_connect)
break;
case -1:
php_error(E_WARNING, "Invalid hostname: %s", host);
php_error(E_WARNING, "%s(): Invalid hostname: %s", get_active_function_name(TSRMLS_C), host);
RETURN_FALSE;
case -2:
php_error(E_WARNING, "Invalid port: %d", port);
php_error(E_WARNING, "%s(): Invalid port: %d", get_active_function_name(TSRMLS_C), port);
RETURN_FALSE;
}
@@ -285,7 +285,7 @@ PHP_FUNCTION(cyrus_authenticate)
if (! user) {
struct passwd *pwd = getpwuid(getuid());
if (! pwd) {
php_error(E_WARNING, "Couldn't determine user id");
php_error(E_WARNING, "%s(): Couldn't determine user id", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -358,8 +358,8 @@ static void cyrus_generic_callback(struct imclient *client,
if (call_user_function_ex(EG(function_table), NULL, callback->function,
&retval, 4, argv, 0, NULL TSRMLS_CC) == FAILURE) {
php_error(E_WARNING, "Couldn't call the %s handler",
callback->trigger);
php_error(E_WARNING, "%s(): Couldn't call the %s handler",
get_active_function_name(TSRMLS_C), callback->trigger);
}
zval_ptr_dtor(argv[0]);
@@ -398,7 +398,7 @@ PHP_FUNCTION(cyrus_bind)
hash = HASH_OF(*z_callback);
if (! hash) {
php_error(E_WARNING,
"Second argument to cyrus_bind() must be an array or object");
"%s(): Second argument must be an array or object", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -425,12 +425,12 @@ PHP_FUNCTION(cyrus_bind)
}
if (! callback.trigger) {
php_error(E_WARNING, "You must specify a trigger in your callback");
php_error(E_WARNING, "%s(): You must specify a trigger in your callback", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if (! callback.function) {
php_error(E_WARNING, "You must specify a function in your callback");
php_error(E_WARNING, "%s(): You must specify a function in your callback", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
+27 -27
View File
@@ -295,7 +295,7 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
DBM_MODE_TYPE imode;
if (filename == NULL) {
php_error(E_WARNING, "NULL filename passed to php_dbm_open()");
php_error(E_WARNING, "%s(): NULL filename passed", get_active_function_name(TSRMLS_C));
return NULL;
}
@@ -341,7 +341,7 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
lockfd = open(lockfn, O_RDWR|O_CREAT, 0644);
close(lockfd);
} else {
php_error(E_WARNING, "File appears to be locked [%s]\n", lockfn);
php_error(E_WARNING, "%s(): File appears to be locked [%s]", get_active_function_name(TSRMLS_C), lockfn);
return -1;
}
#else /* NFS_HACK */
@@ -352,7 +352,7 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
flock(lockfd, LOCK_EX);
close(lockfd);
} else {
php_error(E_WARNING, "Unable to establish lock: %s", filename);
php_error(E_WARNING, "%s(): Unable to establish lock: %s", get_active_function_name(TSRMLS_C), filename);
}
#endif /* else NFS_HACK */
@@ -369,7 +369,7 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
if (dbf) {
info = (dbm_info *)emalloc(sizeof(dbm_info));
if (!info) {
php_error(E_ERROR, "problem allocating memory!");
php_error(E_ERROR, "%s(): problem allocating memory!", get_active_function_name(TSRMLS_C));
return NULL;
}
@@ -381,7 +381,7 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
return info;
} else {
#if GDBM
php_error(E_WARNING, "dbmopen_gdbm(%s): %d [%s], %d [%s]", filename, gdbm_errno, gdbm_strerror(gdbm_errno), errno, strerror(errno));
php_error(E_WARNING, "%s(%s): %d [%s], %d [%s]", get_active_function_name(TSRMLS_C), filename, gdbm_errno, gdbm_strerror(gdbm_errno), errno, strerror(errno));
if (gdbm_errno)
ret = gdbm_errno;
else if (errno)
@@ -391,13 +391,13 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
#else
#if NDBM
#if PHP_DEBUG
php_error(E_WARNING, "dbmopen_ndbm(%s): errno = %d [%s]\n", filename, errno, strerror(errno));
php_error(E_WARNING, "%s(%s): errno = %d [%s]\n", get_active_function_name(TSRMLS_C), filename, errno, strerror(errno));
#endif
if (errno) ret=errno;
else ret = -1;
#else
#if PHP_DEBUG
php_error(E_WARNING, "dbmopen_flatfile(%s): errno = %d [%s]\n", filename, errno, strerror(errno));
php_error(E_WARNING, "%s(%s): errno = %d [%s]\n", get_active_function_name(TSRMLS_C), filename, errno, strerror(errno));
#endif
if (errno) ret=errno;
else ret = -1;
@@ -487,7 +487,7 @@ PHP_FUNCTION(dbminsert)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -518,7 +518,7 @@ int php_dbm_insert(dbm_info *info, char *key, char *value TSRMLS_DC) {
dbf = info->dbf;
if (!dbf) {
php_error(E_WARNING, "Unable to locate dbm file");
php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C));
return 1;
}
@@ -547,7 +547,7 @@ PHP_FUNCTION(dbmreplace)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -580,7 +580,7 @@ int php_dbm_replace(dbm_info *info, char *key, char *value TSRMLS_DC)
dbf = info->dbf;
if (!dbf) {
php_error(E_WARNING, "Unable to locate dbm file");
php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C));
return 1;
}
@@ -608,7 +608,7 @@ PHP_FUNCTION(dbmfetch)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -639,7 +639,7 @@ char *php_dbm_fetch(dbm_info *info, char *key TSRMLS_DC)
dbf = info->dbf;
if (!dbf) {
php_error(E_WARNING, "Unable to locate dbm file");
php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C));
return(NULL);
}
@@ -684,18 +684,18 @@ PHP_FUNCTION(dbmexists)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id));
RETURN_FALSE;
}
ret = php_dbm_exists(info, Z_STRVAL_P(key));
ret = php_dbm_exists(info, Z_STRVAL_P(key) TSRMLS_CC);
RETURN_LONG(ret);
}
/* }}} */
/* {{{ php_dbm_exists
*/
int php_dbm_exists(dbm_info *info, char *key) {
int php_dbm_exists(dbm_info *info, char *key TSRMLS_DC) {
datum key_datum;
int ret;
DBM_TYPE dbf;
@@ -708,7 +708,7 @@ int php_dbm_exists(dbm_info *info, char *key) {
dbf = info->dbf;
if (!dbf) {
php_error(E_WARNING, "Unable to locate dbm file");
php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C));
return(0);
}
@@ -733,18 +733,18 @@ PHP_FUNCTION(dbmdelete)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id));
RETURN_FALSE;
}
ret = php_dbm_delete(info, Z_STRVAL_P(key));
ret = php_dbm_delete(info, Z_STRVAL_P(key) TSRMLS_CC);
RETURN_LONG(ret);
}
/* }}} */
/* {{{ php_dbm_delete
*/
int php_dbm_delete(dbm_info *info, char *key) {
int php_dbm_delete(dbm_info *info, char *key TSRMLS_DC) {
datum key_datum;
int ret;
DBM_TYPE dbf;
@@ -757,7 +757,7 @@ int php_dbm_delete(dbm_info *info, char *key) {
dbf = info->dbf;
if (!dbf) {
php_error(E_WARNING, "Unable to locate dbm file");
php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C));
return(0);
}
@@ -780,11 +780,11 @@ PHP_FUNCTION(dbmfirstkey)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id));
RETURN_FALSE;
}
ret = php_dbm_first_key(info);
ret = php_dbm_first_key(info TSRMLS_CC);
if (!ret) {
RETURN_FALSE;
} else {
@@ -795,14 +795,14 @@ PHP_FUNCTION(dbmfirstkey)
/* {{{ php_dbm_first_key
*/
char *php_dbm_first_key(dbm_info *info) {
char *php_dbm_first_key(dbm_info *info TSRMLS_DC) {
datum ret_datum;
char *ret;
DBM_TYPE dbf;
dbf = info->dbf;
if (!dbf) {
php_error(E_WARNING, "Unable to locate dbm file");
php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C));
return(NULL);
}
@@ -842,7 +842,7 @@ PHP_FUNCTION(dbmnextkey)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
php_error(E_WARNING, "%s(): not a valid database identifier %d", get_active_function_name(TSRMLS_C), Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -871,7 +871,7 @@ char *php_dbm_nextkey(dbm_info *info, char *key TSRMLS_DC)
dbf = info->dbf;
if (!dbf) {
php_error(E_WARNING, "Unable to locate dbm file");
php_error(E_WARNING, "%s(): Unable to locate dbm file", get_active_function_name(TSRMLS_C));
return(NULL);
}
+3 -3
View File
@@ -57,9 +57,9 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC);
int php_dbm_insert(dbm_info *info, char *key, char *value TSRMLS_DC);
char *php_dbm_fetch(dbm_info *info, char *key TSRMLS_DC);
int php_dbm_replace(dbm_info *info, char *key, char *value TSRMLS_DC);
int php_dbm_exists(dbm_info *info, char *key);
int php_dbm_delete(dbm_info *info, char *key);
char *php_dbm_first_key(dbm_info *info);
int php_dbm_exists(dbm_info *info, char *key TSRMLS_DC);
int php_dbm_delete(dbm_info *info, char *key TSRMLS_DC);
char *php_dbm_first_key(dbm_info *info TSRMLS_DC);
char *php_dbm_nextkey(dbm_info *info, char *key TSRMLS_DC);
/* db file functions */
+8 -7
View File
@@ -117,9 +117,10 @@ typedef struct dba_handler {
#define DBA_ID_GET \
convert_to_long_ex(id); \
DBA_IF_NOT_CORRECT_TYPE(Z_LVAL_PP(id)) { \
php_error(E_WARNING, "Unable to find DBA identifier %d", \
Z_LVAL_PP(id)); \
DBA_IF_NOT_CORRECT_TYPE(Z_LVAL_PP(id)) { \
php_error(E_WARNING, "%s(): Unable to find DBA identifier %d", \
get_active_function_name(TSRMLS_C), \
Z_LVAL_PP(id)); \
RETURN_FALSE; \
}
@@ -138,7 +139,7 @@ typedef struct dba_handler {
/* check whether the user has write access */
#define DBA_WRITE_CHECK \
if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
php_error(E_WARNING, "you cannot perform a modification to a database without proper access"); \
php_error(E_WARNING, "%s(): you cannot perform a modification to a database without proper access", get_active_function_name(TSRMLS_C)); \
RETURN_FALSE; \
}
@@ -317,7 +318,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
strcasecmp(hptr->name, Z_STRVAL_PP(args[2])); hptr++);
if(!hptr->name) {
php_error(E_WARNING, "no such handler: %s", Z_STRVAL_PP(args[2]));
php_error(E_WARNING, "%s(): no such handler: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(args[2]));
FREENOW;
RETURN_FALSE;
}
@@ -336,7 +337,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
modenr = DBA_TRUNC;
break;
default:
php_error(E_WARNING, "illegal DBA mode: %s", Z_STRVAL_PP(args[1]));
php_error(E_WARNING, "%s(): illegal DBA mode: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(args[1]));
FREENOW;
RETURN_FALSE;
}
@@ -351,7 +352,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if(hptr->open(info TSRMLS_CC) != SUCCESS) {
dba_close(info);
php_error(E_WARNING, "driver initialization failed");
php_error(E_WARNING, "%s(): driver initialization failed", get_active_function_name(TSRMLS_C));
FREENOW;
RETURN_FALSE;
}
+60 -117
View File
@@ -421,9 +421,9 @@ PHP_FUNCTION(dbase_delete_record)
}
/* }}} */
/* {{{ proto array dbase_get_record(int identifier, int record)
Returns an array representing a record from the database */
PHP_FUNCTION(dbase_get_record)
/* {{{ php_dbase_get_record
*/
static void php_dbase_get_record(INTERNAL_FUNCTION_PARAMETERS, int assoc)
{
pval *dbh_id, *record;
dbhead_t *dbh;
@@ -458,8 +458,8 @@ PHP_FUNCTION(dbase_get_record)
RETURN_FALSE;
}
fnp = NULL;
for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
fnp = NULL;
for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
/* get the value */
str_value = (char *)emalloc(cur_f->db_flen + 1);
@@ -467,116 +467,17 @@ PHP_FUNCTION(dbase_get_record)
cursize = cur_f->db_flen + 1;
fnp = erealloc(fnp, cursize);
}
snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp));
/* now convert it to the right php internal type */
switch (cur_f->db_type) {
case 'C':
case 'D':
add_next_index_string(return_value, str_value, 1);
break;
case 'I': /* FALLS THROUGH */
case 'N':
if (cur_f->db_fdc == 0) {
/* Large integers in dbase can be larger than long */
errno_save = errno;
overflow_test = strtol(str_value, NULL, 10);
if (errno == ERANGE) {
/* If the integer is too large, keep it as string */
add_next_index_string(return_value, str_value, 1);
} else {
add_next_index_long(return_value, overflow_test);
}
errno = errno_save;
} else {
add_next_index_double(return_value, atof(str_value));
}
break;
case 'L': /* we used to FALL THROUGH, but now we check for T/Y and F/N
and insert 1 or 0, respectively. db_fdc is the number of
decimals, which we don't care about. 3/14/2001 LEW */
if ((*str_value == 'T') || (*str_value == 'Y')) {
add_next_index_long(return_value, strtol("1", NULL, 10));
} else {
if ((*str_value == 'F') || (*str_value == 'N')) {
add_next_index_long(return_value, strtol("0", NULL, 10));
} else {
add_next_index_long(return_value, strtol(" ", NULL, 10));
}
}
break;
case 'M':
/* this is a memo field. don't know how to deal with
this yet */
break;
default:
/* should deal with this in some way */
break;
}
efree(str_value);
}
efree(fnp);
/* mark whether this record was deleted */
if (data[0] == '*') {
add_assoc_long(return_value, "deleted", 1);
}
else {
add_assoc_long(return_value, "deleted", 0);
}
free(data);
}
/* }}} */
/* From Martin Kuba <makub@aida.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;
long overflow_test;
int errno_save;
DBase_TLS_VARS;
if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &dbh_id, &record)==FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
convert_to_long(record);
dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
if ((data = get_dbf_record(dbh, Z_LVAL_P(record))) == NULL) {
php_error(E_WARNING, "Tried to read bad record %d", Z_LVAL_P(record));
RETURN_FALSE;
}
dbf = dbh->db_fields;
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
fnp = (char *)emalloc(dbh->db_rlen);
for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
/* get the value */
str_value = (char *)emalloc(cur_f->db_flen + 1);
sprintf(str_value, cur_f->db_format, get_field_val(data, cur_f, fnp));
snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp));
/* now convert it to the right php internal type */
switch (cur_f->db_type) {
case 'C':
case 'D':
add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
if (!assoc) {
add_next_index_string(return_value, str_value, 1);
} else {
add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
}
break;
case 'I': /* FALLS THROUGH */
case 'N':
@@ -586,25 +487,49 @@ PHP_FUNCTION(dbase_get_record_with_names)
overflow_test = strtol(str_value, NULL, 10);
if (errno == ERANGE) {
/* If the integer is too large, keep it as string */
add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
if (!assoc) {
add_next_index_string(return_value, str_value, 1);
} else {
add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
}
} else {
add_assoc_long(return_value, cur_f->db_fname, overflow_test);
if (!assoc) {
add_next_index_long(return_value, overflow_test);
} else {
add_assoc_long(return_value, cur_f->db_fname, overflow_test);
}
}
errno = errno_save;
} else {
add_assoc_double(return_value, cur_f->db_fname, atof(str_value));
if (!assoc) {
add_next_index_double(return_value, atof(str_value));
} else {
add_assoc_double(return_value, cur_f->db_fname, atof(str_value));
}
}
break;
case 'L': /* we used to FALL THROUGH, but now we check for T/Y and F/N
and insert 1 or 0, respectively. db_fdc is the number of
decimals, which we don't care about. 3/14/2001 LEW */
if ((*str_value == 'T') || (*str_value == 'Y')) {
add_assoc_long(return_value, cur_f->db_fname,strtol("1", NULL, 10));
if (!assoc) {
add_next_index_long(return_value, strtol("1", NULL, 10));
} else {
add_assoc_long(return_value, cur_f->db_fname,strtol("1", NULL, 10));
}
} else {
if ((*str_value == 'F') || (*str_value == 'N')) {
add_assoc_long(return_value, cur_f->db_fname,strtol("0", NULL, 10));
if (!assoc) {
add_next_index_long(return_value, strtol("0", NULL, 10));
} else {
add_assoc_long(return_value, cur_f->db_fname,strtol("0", NULL, 10));
}
} else {
add_assoc_long(return_value, cur_f->db_fname,strtol(" ", NULL, 10));
if (!assoc) {
add_next_index_long(return_value, strtol(" ", NULL, 10));
} else {
add_assoc_long(return_value, cur_f->db_fname,strtol(" ", NULL, 10));
}
}
}
break;
@@ -617,6 +542,7 @@ PHP_FUNCTION(dbase_get_record_with_names)
}
efree(str_value);
}
efree(fnp);
/* mark whether this record was deleted */
@@ -629,6 +555,23 @@ PHP_FUNCTION(dbase_get_record_with_names)
free(data);
}
/* }}} */
/* {{{ proto array dbase_get_record(int identifier, int record)
Returns an array representing a record from the database */
PHP_FUNCTION(dbase_get_record)
{
php_dbase_get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* From Martin Kuba <makub@aida.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)
{
php_dbase_get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* {{{ proto bool dbase_create(string filename, array fields)
Creates a new dBase-format database file */
@@ -783,7 +726,7 @@ PHP_FUNCTION(dbase_create)
}
dbh->db_rlen = rlen;
put_dbf_info(dbh);
put_dbf_info(dbh);
handle = zend_list_insert(dbh, DBase_GLOBAL(le_dbhead));
RETURN_LONG(handle);
+2 -2
View File
@@ -186,7 +186,7 @@ int dbx_sybasect_getcolumnname(zval **rv, zval **result_handle, long column_inde
FREE_ZVAL(zval_column_index);
return 0;
}
if (zend_hash_find(returned_zval->value.obj.properties, "name", 5, (void **) &zv_name)==FAILURE) {
if (zend_hash_find(Z_OBJPROP_P(returned_zval), "name", 5, (void **) &zv_name)==FAILURE) {
zval_ptr_dtor(&returned_zval);
FREE_ZVAL(zval_column_index);
return 0;
@@ -223,7 +223,7 @@ int dbx_sybasect_getcolumntype(zval **rv, zval **result_handle, long column_inde
FREE_ZVAL(zval_column_index);
return 0;
}
if (zend_hash_find(returned_zval->value.obj.properties, "type", 5, (void **) &zv_type)==FAILURE) {
if (zend_hash_find(Z_OBJPROP_P(returned_zval), "type", 5, (void **) &zv_type)==FAILURE) {
zval_ptr_dtor(&returned_zval);
FREE_ZVAL(zval_column_index);
return 0;
+12 -12
View File
@@ -34,14 +34,14 @@
static int le_fd;
function_entry dio_functions[] = {
PHP_FE(dio_open, NULL)
PHP_FE(dio_truncate, NULL)
PHP_FE(dio_stat, NULL)
PHP_FE(dio_open, NULL)
PHP_FE(dio_truncate, NULL)
PHP_FE(dio_stat, NULL)
PHP_FE(dio_seek, NULL)
PHP_FE(dio_fcntl, NULL)
PHP_FE(dio_read, NULL)
PHP_FE(dio_write, NULL)
PHP_FE(dio_close, NULL)
PHP_FE(dio_write, NULL)
PHP_FE(dio_close, NULL)
{NULL, NULL, NULL}
};
@@ -55,7 +55,7 @@ zend_module_entry dio_module_entry = {
NULL,
NULL,
PHP_MINFO(dio),
"0.1",
"0.1",
STANDARD_MODULE_PROPERTIES
};
@@ -78,7 +78,7 @@ static void _dio_close_fd(zend_rsrc_list_entry *rsrc TSRMLS_DC)
PHP_MINIT_FUNCTION(dio)
{
le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number);
le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number);
RDIOC(O_RDONLY);
RDIOC(O_WRONLY);
@@ -328,28 +328,28 @@ PHP_FUNCTION(dio_fcntl)
}
if (Z_TYPE_P(arg) == IS_ARRAY) {
fh = HASH_OF(arg);
if (zend_hash_find(fh, "start", 5, (void **) &element) == FAILURE) {
if (zend_hash_find(fh, "start", sizeof("start"), (void **) &element) == FAILURE) {
lk.l_start = 0;
}
else {
lk.l_start = Z_LVAL_PP(element);
}
if (zend_hash_find(fh, "length", 6, (void **) &element) == FAILURE) {
if (zend_hash_find(fh, "length", sizeof("length"), (void **) &element) == FAILURE) {
lk.l_len = 0;
}
else {
lk.l_len = Z_LVAL_PP(element);
}
if (zend_hash_find(fh, "whence", 6, (void **) &element) == FAILURE) {
if (zend_hash_find(fh, "whence", sizeof("whence"), (void **) &element) == FAILURE) {
lk.l_whence = 0;
}
else {
lk.l_whence = SEEK_SET;
lk.l_whence = Z_LVAL_PP(element);
}
if (zend_hash_find(fh, "type", 6, (void **) &element) == FAILURE) {
if (zend_hash_find(fh, "type", sizeof("type"), (void **) &element) == FAILURE) {
lk.l_type = 0;
}
else {
+8
View File
@@ -9,3 +9,11 @@
it ought to be.
7) Fix the many, many memory leaks.
8) Modify new_child to allow creation of attribute, cdata, dtd, etc nodes.
9) implement schema support (libxml2 has it)
10) implement scheme handlers (like in ext/xslt), should be possible with xmlRegisterInputCallbacks
11) implement real sax support
- input (building of dom-tree with sax-events) is almost finished
- started with generating of sax-events from file/string (chregu)
- generating sax-events from dom-tree is a more tricky one (see mailinglist of libxml2)
12) error reporting for xslt methods
13) add possibility to use relative xpath queries
+107 -53
View File
@@ -68,12 +68,12 @@
DOMXML_GET_OBJ(ret, zval, le);
#define DOMXML_NO_ARGS() if (ZEND_NUM_ARGS() != 0) { \
php_error(E_WARNING, "%s() expects exactly 0 parameters, %d given", \
php_error(E_WARNING, "%s(): expects exactly 0 parameters, %d given", \
get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); \
return; \
}
#define DOMXML_NOT_IMPLEMENTED() php_error(E_WARNING, "%s() not yet implemented", \
#define DOMXML_NOT_IMPLEMENTED() php_error(E_WARNING, "%s(): not yet implemented", \
get_active_function_name(TSRMLS_C)); \
return;
@@ -196,12 +196,16 @@ zend_class_entry *domxsltstylesheet_class_entry;
static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC);
static int node_children(zval **children, xmlNode *nodep TSRMLS_DC);
static unsigned char first_args_force_ref[] = { 1, BYREF_FORCE };
static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
static unsigned char third_args_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
static zend_function_entry domxml_functions[] = {
PHP_FE(domxml_version, NULL)
PHP_FE(xmldoc, third_arg_force_ref)
PHP_FALIAS(domxml_open_mem, xmldoc, NULL)
PHP_FE(xmldocfile, third_arg_force_ref)
PHP_FALIAS(domxml_open_file, xmldocfile, NULL)
PHP_FE(xmldoc, third_args_force_ref)
PHP_FALIAS(domxml_open_mem, xmldoc, third_args_force_ref)
PHP_FE(xmldocfile, third_args_force_ref)
PHP_FALIAS(domxml_open_file, xmldocfile, third_args_force_ref)
#if defined(LIBXML_HTML_ENABLED)
PHP_FE(html_doc, NULL)
PHP_FE(html_doc_file, NULL)
@@ -233,17 +237,17 @@ static zend_function_entry domxml_functions[] = {
PHP_FE(domxml_parser, NULL)
PHP_FE(domxml_parser_add_chunk, NULL)
PHP_FE(domxml_parser_end, NULL)
PHP_FE(domxml_parser_start_element, NULL)
PHP_FE(domxml_parser_end_element, NULL)
PHP_FE(domxml_parser_comment, NULL)
PHP_FE(domxml_parser_characters, NULL)
PHP_FE(domxml_parser_entity_reference, NULL)
PHP_FE(domxml_parser_processing_instruction, NULL)
PHP_FE(domxml_parser_cdata_section, NULL)
PHP_FE(domxml_parser_namespace_decl, NULL)
PHP_FE(domxml_parser_start_document, NULL)
PHP_FE(domxml_parser_end_document, NULL)
PHP_FE(domxml_parser_get_document, NULL)
PHP_FE(domxml_parser_start_element, NULL)
PHP_FE(domxml_parser_end_element, NULL)
PHP_FE(domxml_parser_comment, NULL)
PHP_FE(domxml_parser_characters, NULL)
PHP_FE(domxml_parser_entity_reference, NULL)
PHP_FE(domxml_parser_processing_instruction, NULL)
PHP_FE(domxml_parser_cdata_section, NULL)
PHP_FE(domxml_parser_namespace_decl, NULL)
PHP_FE(domxml_parser_start_document, NULL)
PHP_FE(domxml_parser_end_document, NULL)
PHP_FE(domxml_parser_get_document, NULL)
#if defined(LIBXML_XPATH_ENABLED)
PHP_FE(xpath_new_context, NULL)
@@ -279,7 +283,7 @@ static zend_function_entry domxml_functions[] = {
PHP_FALIAS(set_content, domxml_node_set_content, NULL)
PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL)
PHP_FALIAS(domxml_dumpmem, domxml_dump_mem, NULL)
PHP_FE(domxml_doc_validate, second_arg_force_ref)
PHP_FE(domxml_doc_validate, second_args_force_ref)
{NULL, NULL, NULL}
};
@@ -311,7 +315,7 @@ static function_entry php_domxmldoc_class_functions[] = {
PHP_FALIAS(dumpmem, domxml_dump_mem, NULL)
PHP_FALIAS(dump_mem, domxml_dump_mem, NULL)
PHP_FALIAS(dump_mem_file, domxml_dump_mem_file, NULL)
PHP_FALIAS(dump_file, domxml_dump_mem_file, NULL)
PHP_FALIAS(dump_file, domxml_dump_mem_file, NULL)
#if defined(LIBXML_HTML_ENABLED)
PHP_FALIAS(html_dump_mem, domxml_html_dump_mem, NULL)
#endif
@@ -320,7 +324,7 @@ static function_entry php_domxmldoc_class_functions[] = {
PHP_FALIAS(xpath_new_context, xpath_new_context, NULL)
PHP_FALIAS(xptr_new_context, xptr_new_context, NULL)
#endif
PHP_FALIAS(validate, domxml_doc_validate, first_arg_force_ref)
PHP_FALIAS(validate, domxml_doc_validate, first_args_force_ref)
{NULL, NULL, NULL}
};
@@ -382,7 +386,8 @@ static zend_function_entry php_domxmlnode_class_functions[] = {
PHP_FALIAS(new_child, domxml_node_new_child, NULL)
PHP_FALIAS(attributes, domxml_node_attributes, NULL)
PHP_FALIAS(has_attributes, domxml_node_has_attributes, NULL)
PHP_FALIAS(prefix, domxml_node_prefix, NULL)
PHP_FALIAS(prefix, domxml_node_prefix, NULL)
PHP_FALIAS(namespace_uri, domxml_node_namespace_uri, NULL)
PHP_FALIAS(clone_node, domxml_clone_node, NULL)
/* Non DOM functions start here */
PHP_FALIAS(add_child, domxml_node_append_child, NULL)
@@ -408,7 +413,9 @@ static zend_function_entry php_domxmlelement_class_functions[] = {
PHP_FALIAS(set_attribute, domxml_elem_set_attribute, NULL)
PHP_FALIAS(remove_attribute, domxml_elem_remove_attribute, NULL)
PHP_FALIAS(get_attribute_node, domxml_elem_get_attribute_node, NULL)
/* since this function is not implemented, outcomment it for the time beeing
PHP_FALIAS(set_attribute_node, domxml_elem_set_attribute_node, NULL)
*/
PHP_FALIAS(get_elements_by_tagname, domxml_elem_get_elements_by_tagname, NULL)
PHP_FALIAS(has_attribute, domxml_elem_has_attribute, NULL)
{NULL, NULL, NULL}
@@ -724,7 +731,7 @@ void *php_xsltstylesheet_get_object(zval *wrapper, int rsrc_type1, int rsrc_type
int type;
if (NULL == wrapper) {
php_error(E_WARNING, "xsltstylesheet_get_object() invalid wrapper object passed");
php_error(E_WARNING, "xsltstylesheet_get_object() invalid wrapper object passed", get_active_function_name(TSRMLS_C));
return NULL;
}
@@ -1025,7 +1032,7 @@ static zval *php_xmlparser_new(xmlParserCtxtPtr obj, int *found TSRMLS_DC)
/* {{{ php_xmlparser_make_params()
Translates a PHP array to a xmlparser parameters array */
static char **php_xmlparser_make_params(zval *idvars)
static char **php_xmlparser_make_params(zval *idvars TSRMLS_DC)
{
HashTable *parht;
int parsize;
@@ -1045,7 +1052,7 @@ static char **php_xmlparser_make_params(zval *idvars)
zend_hash_move_forward(parht)) {
if (zend_hash_get_current_key(parht, &string_key, &num_key, 1) != HASH_KEY_IS_STRING) {
php_error(E_WARNING, "Invalid argument or parameter array to %s",
php_error(E_WARNING, "%s(): Invalid argument or parameter array",
get_active_function_name(TSRMLS_C));
return NULL;
}
@@ -1065,6 +1072,7 @@ static char **php_xmlparser_make_params(zval *idvars)
return params;
}
/* }}} */
/* end parser stuff */
void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
@@ -1374,7 +1382,9 @@ static void domxml_error_ext(void *ctx, const char *msg, ...)
}
add_assoc_string(errormessages,"errormessage",buf,1);
input = ctxt->input;
add_assoc_string(errormessages,"nodename",ctxt->name,1);
if (ctxt->name) {
add_assoc_string(errormessages,"nodename",ctxt->name,1);
}
if (input != NULL) {
add_assoc_long(errormessages,"line",input->line);
add_assoc_long(errormessages,"col",input->col);
@@ -1408,7 +1418,9 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
// do error handling here
}
if (ctxt->parser != NULL) {
add_assoc_string(errormessages,"nodename",ctxt->parser->name,1);
if (ctxt->parser->name) {
add_assoc_string(errormessages,"nodename",ctxt->parser->name,1);
}
if (ctxt->parser->input != NULL) {
add_assoc_long(errormessages,"line",ctxt->parser->input->line);
@@ -1499,7 +1511,8 @@ PHP_RINIT_FUNCTION(domxml)
return SUCCESS;
}
/* PHP_MINIT_FUNCTION(domxml)
*/
PHP_MINIT_FUNCTION(domxml)
{
zend_class_entry ce;
@@ -1649,10 +1662,9 @@ PHP_MINIT_FUNCTION(domxml)
#endif
#endif
return SUCCESS;
}
/* }}} */
/* {{{ proto int domxml_test(int id)
Unity function for testing */
@@ -1668,14 +1680,16 @@ PHP_FUNCTION(domxml_test)
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION(domxml)
*/
PHP_MINFO_FUNCTION(domxml)
{
/* don't know why that line was commented out in the previous version, so i left it (cmv) */
php_info_print_table_start();
php_info_print_table_row(2, "DOM/XML", "enabled");
php_info_print_table_row(2, "DOM/XML API Version", DOMXML_API_VERSION);
php_info_print_table_row(2, "libxml Version", LIBXML_DOTTED_VERSION);
/* php_info_print_table_row(2, "libxml Version", LIBXML_DOTTED_VERSION); */
php_info_print_table_row(2, "libxml Version", xmlParserVersion);
#if defined(LIBXML_HTML_ENABLED)
php_info_print_table_row(2, "HTML Support", "enabled");
#endif
@@ -1686,8 +1700,23 @@ PHP_MINFO_FUNCTION(domxml)
php_info_print_table_row(2, "XPointer Support", "enabled");
#endif
#if HAVE_DOMXSLT
{
char buffer[128];
int major, minor, subminor;
php_info_print_table_row(2, "DOM/XSLT", "enabled");
php_info_print_table_row(2, "libxslt Version", LIBXSLT_DOTTED_VERSION);
/* php_info_print_table_row(2, "libxslt Version", LIBXSLT_DOTTED_VERSION); */
major = xsltLibxsltVersion/10000;
minor = (xsltLibxsltVersion - major * 10000) / 100;
subminor = (xsltLibxsltVersion - major * 10000 - minor * 100);
snprintf(buffer, 128, "%d.%d.%d", major, minor, subminor);
php_info_print_table_row(2, "libxslt Version", buffer);
major = xsltLibxmlVersion/10000;
minor = (xsltLibxmlVersion - major * 10000) / 100;
subminor = (xsltLibxmlVersion - major * 10000 - minor * 100);
snprintf(buffer, 128, "%d.%d.%d", major, minor, subminor);
php_info_print_table_row(2, "libxslt compiled against libxml Version", buffer);
}
#if HAVE_DOMEXSLT
php_info_print_table_row(2, "DOM/EXSLT", "enabled");
php_info_print_table_row(2, "libexslt Version", LIBEXSLT_DOTTED_VERSION);
@@ -1696,6 +1725,7 @@ PHP_MINFO_FUNCTION(domxml)
php_info_print_table_end();
}
/* }}} */
/* {{{ Methods of Class DomAttribute */
@@ -2162,6 +2192,32 @@ PHP_FUNCTION(domxml_node_prefix)
}
/* }}} */
/* {{{ proto string domxml_node_namespace_uri(void)
Returns namespace uri of node */
PHP_FUNCTION(domxml_node_namespace_uri)
{
zval *id;
xmlNode *nodep;
xmlNsPtr ns;
DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
DOMXML_NO_ARGS();
ns = nodep->ns;
if (!ns) {
RETURN_EMPTY_STRING();
}
if (ns->href) {
RETURN_STRING((char *) (ns->href), 1);
} else {
RETURN_EMPTY_STRING();
}
}
/* }}} */
/* {{{ proto object domxml_node_parent(void)
Returns parent of node */
PHP_FUNCTION(domxml_node_parent)
@@ -2780,6 +2836,7 @@ PHP_FUNCTION(domxml_elem_get_attribute_node)
/* {{{ proto bool domxml_elem_set_attribute_node(object attr)
Sets value of given attribute */
/* since this function is not implemented, outcomment it for the time beeing
PHP_FUNCTION(domxml_elem_set_attribute_node)
{
zval *id, *arg1, *rv = NULL;
@@ -2795,7 +2852,7 @@ PHP_FUNCTION(domxml_elem_set_attribute_node)
WRONG_PARAM_COUNT;
}
/* FIXME: The following line doesn't work */
FIXME: The following line doesn't work
newattrp = xmlCopyProp(nodep, attrp);
if (!newattrp) {
php_error(E_WARNING, "%s(): no such attribute '%s'", get_active_function_name(TSRMLS_C), attrp->name);
@@ -2804,6 +2861,7 @@ PHP_FUNCTION(domxml_elem_set_attribute_node)
DOMXML_RET_OBJ(rv, (xmlNodePtr) newattrp, &ret);
}
*/
/* }}} */
/* {{{ proto string domxml_elem_has_attribute(string attrname)
@@ -3556,6 +3614,8 @@ PHP_FUNCTION(domxml_dump_node)
}
/* }}} */
/* {{{ idsHashScanner2(void *payload, void *data, xmlChar *name)
*/
static void idsHashScanner2(void *payload, void *data, xmlChar *name)
{
zval *return_value = (zval *) data;
@@ -3569,6 +3629,7 @@ static void idsHashScanner2(void *payload, void *data, xmlChar *name)
child = php_domobject_new(nodep, &ret, NULL TSRMLS_CC);
add_next_index_zval(return_value, child);
}
/* }}} */
/* {{{ proto string domxml_doc_ids(object doc_handle)
Returns array of ids */
@@ -4022,9 +4083,6 @@ PHP_FUNCTION(domxml_parser_start_document)
{
zval *id;
xmlParserCtxtPtr parserp;
char *chunk;
int chunk_len, error;
xmlChar **atts;
DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp);
startDocument(parserp);
@@ -4037,9 +4095,8 @@ PHP_FUNCTION(domxml_parser_start_document)
ends a document */
PHP_FUNCTION(domxml_parser_end_document)
{
zval *id, *rv;
zval *id;
xmlParserCtxtPtr parserp;
int error, ret;
DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp);
endDocument(parserp);
@@ -4054,12 +4111,12 @@ PHP_FUNCTION(domxml_parser_start_element)
zval *id,*params = NULL;
xmlParserCtxtPtr parserp;
char *tagname;
int tagname_len, error;
int tagname_len;
char **atts = NULL;
DOMXML_PARAM_THREE(parserp, id, le_domxmlparserp,"s|a", &tagname, &tagname_len, &params);
if (params != NULL) {
atts = php_xmlparser_make_params(params);
atts = php_xmlparser_make_params(params TSRMLS_CC);
}
if (parserp->myDoc == NULL) {
php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C));
@@ -4078,7 +4135,7 @@ PHP_FUNCTION(domxml_parser_end_element)
zval *id;
xmlParserCtxtPtr parserp;
char *tagname;
int tagname_len, error;
int tagname_len;
DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &tagname, &tagname_len);
@@ -4100,7 +4157,7 @@ PHP_FUNCTION(domxml_parser_comment)
zval *id;
xmlParserCtxtPtr parserp;
char *commentstring;
int commentstring_len, error;
int commentstring_len;
DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &commentstring, &commentstring_len);
@@ -4122,7 +4179,7 @@ PHP_FUNCTION(domxml_parser_cdata_section)
zval *id;
xmlParserCtxtPtr parserp;
char *chunk;
int chunk_len, error;
int chunk_len;
DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &chunk, &chunk_len);
@@ -4144,7 +4201,7 @@ PHP_FUNCTION(domxml_parser_characters)
zval *id;
xmlParserCtxtPtr parserp;
char *charactersstring;
int characters_len, error;
int characters_len;
DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &charactersstring, &characters_len);
@@ -4166,7 +4223,7 @@ PHP_FUNCTION(domxml_parser_entity_reference)
zval *id;
xmlParserCtxtPtr parserp;
char *referencestring;
int reference_len, error;
int reference_len;
DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"s", &referencestring, &reference_len);
@@ -4225,7 +4282,6 @@ PHP_FUNCTION(domxml_parser_namespace_decl)
}
/* }}} */
/* {{{ proto bool domxml_parser_add_chunk(string chunk)
adds xml-chunk to parser */
PHP_FUNCTION(domxml_parser_add_chunk)
@@ -4259,7 +4315,7 @@ PHP_FUNCTION(domxml_parser_end)
DOMXML_PARAM_TWO(parserp, id, le_domxmlparserp,"|s", &chunk, &chunk_len);
error = xmlParseChunk(parserp, chunk, chunk_len, 1);
if (error != 0) {
php_error(E_ERROR,"error: %d",error);
php_error(E_ERROR, "%s(): error: %d", get_active_function_name(TSRMLS_C), error);
RETURN_FALSE;
}
if (parserp->myDoc != NULL) {
@@ -4271,15 +4327,12 @@ PHP_FUNCTION(domxml_parser_end)
}
/* }}} */
/* {{{ proto object domxml_parser_get_document()
Returns DomDocument from parser */
PHP_FUNCTION(domxml_parser_get_document)
{
zval *id,*rv = NULL;
xmlParserCtxtPtr parserp;
char *chunk = NULL;
int chunk_len = 0, error;
int ret;
DOMXML_PARAM_NONE(parserp, id, le_domxmlparserp);
@@ -4292,6 +4345,7 @@ PHP_FUNCTION(domxml_parser_get_document)
}
}
/* }}} */
/* {{{ proto bool domxml_parser_set_keep_blanks(bool mode)
Determines how to handle blanks */
PHP_FUNCTION(domxml_parser_set_keep_blanks)
@@ -4854,7 +4908,7 @@ static char *php_domxslt_string_to_xpathexpr(const char *str TSRMLS_DC)
if (xmlStrchr(string, '"')) {
if (xmlStrchr(string, '\'')) {
php_error(E_WARNING, "Cannot create XPath expression (string contains both quote and double-quotes) in %s",
php_error(E_WARNING, "%s(): Cannot create XPath expression (string contains both quote and double-quotes)",
get_active_function_name(TSRMLS_C));
return NULL;
}
@@ -4892,7 +4946,7 @@ static char **php_domxslt_make_params(zval *idvars, int xpath_params TSRMLS_DC)
zend_hash_move_forward(parht)) {
if (zend_hash_get_current_key(parht, &string_key, &num_key, 1) != HASH_KEY_IS_STRING) {
php_error(E_WARNING, "Invalid argument or parameter array to %s",
php_error(E_WARNING, "%s(): Invalid argument or parameter array",
get_active_function_name(TSRMLS_C));
return NULL;
}
@@ -4929,7 +4983,7 @@ PHP_FUNCTION(domxml_xslt_process)
- test other stuff
- check xsltsp->errors ???
*/
zval *rv, *idxsl, *idxml, *idparams = NULL;
zval *rv = NULL, *idxsl, *idxml, *idparams = NULL;
zend_bool xpath_params = 0;
xsltStylesheetPtr xsltstp;
xmlDocPtr xmldocp;
+4
View File
@@ -23,6 +23,7 @@
#if HAVE_DOMXML
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#if defined(LIBXML_HTML_ENABLED)
@@ -137,6 +138,7 @@ PHP_FUNCTION(domxml_node_has_attributes);
PHP_FUNCTION(domxml_node_has_child_nodes);
PHP_FUNCTION(domxml_node_parent);
PHP_FUNCTION(domxml_node_prefix);
PHP_FUNCTION(domxml_node_namespace_uri);
PHP_FUNCTION(domxml_node);
PHP_FUNCTION(domxml_clone_node);
PHP_FUNCTION(domxml_node_unlink_node);
@@ -162,7 +164,9 @@ PHP_FUNCTION(domxml_elem_get_attribute);
PHP_FUNCTION(domxml_elem_set_attribute);
PHP_FUNCTION(domxml_elem_remove_attribute);
PHP_FUNCTION(domxml_elem_get_attribute_node);
/* since this function is not really implemented, outcomment it for the time beeing
PHP_FUNCTION(domxml_elem_set_attribute_node);
*/
PHP_FUNCTION(domxml_elem_get_elements_by_tagname);
PHP_FUNCTION(domxml_elem_has_attribute);
/* Class CData methods */
+2
View File
@@ -342,6 +342,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
while (*walk)
if ('\\' == *walk
&& '0' <= walk[1] && '9' >= walk[1]
&& walk[1] - '0' <= re.re_nsub
&& subs[walk[1] - '0'].rm_so > -1
&& subs[walk[1] - '0'].rm_eo > -1) {
new_l += subs[walk[1] - '0'].rm_eo
@@ -369,6 +370,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
while (*walk)
if ('\\' == *walk
&& '0' <= walk[1] && '9' >= walk[1]
&& walk[1] - '0' <= re.re_nsub
&& subs[walk[1] - '0'].rm_so > -1
&& subs[walk[1] - '0'].rm_eo > -1
/* this next case shouldn't happen. it does. */
+853 -319
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -25,4 +25,4 @@ foreach($image as $idx=>$section) {
echo $accept;
?>
--EXPECT--
ArrayFitest2.jpgFi1240Fi2SeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1UsExif test image.UsASCIICoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.ArrayCoPhoto (c) M.BoergerUsASCIIArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end
ArrayFitest2.jpgFi1240Fi2Miimage/jpegSeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1UsExif test image.UsASCIICoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.Th2Thimage/jpegArrayCoPhoto (c) M.BoergerUsASCIIArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end
+4 -2
View File
@@ -12,7 +12,9 @@ Check for exif_read_data, Unicode user comment
copy of test1.jpg as a thumbnail.
test3.jpg is the same as test2.jpg but with a UNICODE UserComment: &Auml;&Ouml;&&Uuml;&szlig;&auml;&ouml;&uuml;
*/
ini_alter('exif.encode_unicode', 'ISO-8859-15');
chdir($_ENV['PHP_DIR']);
ini_alter('exif.decode_unicode_motorola', 'UCS-2BE');
ini_alter('exif.encode_unicode', 'ISO-8859-15');
$image = exif_read_data('./ext/exif/tests/test3.jpg','',true,false);
$accept = '';
foreach($image as $idx=>$section) {
@@ -27,4 +29,4 @@ foreach($image as $idx=>$section) {
echo $accept;
?>
--EXPECT--
ArrayFitest3.jpgFi1237Fi2SeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1UsÄÖÜßäöüUsUNICODECoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.ArrayCoPhoto (c) M.BoergerUsUNICODEArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end
ArrayFitest3.jpgFi1240Fi2Miimage/jpegSeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1UsÄÖÜßäöüUsUNICODECoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.Th2Thimage/jpegArrayCoPhoto (c) M.BoergerUsUNICODEArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end
+32
View File
@@ -0,0 +1,32 @@
--TEST--
Check for exif_read_data, Unicode WinXP tags
--SKIPIF--
<?php if (!extension_loaded("exif")) print "skip";?>
--POST--
--GET--
--FILE--
<?php
/*
test4.jpg is a 1*1 image that contains Exif tags written by WindowsXP
*/
chdir($_ENV['PHP_DIR']);
ini_alter('exif.decode_unicode_motorola', 'UCS-2BE');
ini_alter('exif.encode_unicode', 'ISO-8859-15');
$image = exif_read_data('./ext/exif/tests/test4.jpg','',true,false);
$accept = '';
foreach($image as $idx=>$section) {
$accept .= $section;
foreach($section as $name=>$value) {
if ( $idx!='FILE' || $name!='FileDateTime') {
$accept .= substr($name,0,2);
$accept .= $value;
}
}
}
echo $accept;
?>
--EXPECT--
ArrayFitest4.jpgFi713Fi2Miimage/jpegSeANY_TAG, IFD0, WINXPArrayhtwidth="1" height="1"He1Wi1Is1By0ArraySuArrayKeArrayAuArrayCoArrayTiArrayArraySuSubject...KeKeywords...AuRui CarmoCoComments
Line2
Line3
Line4TiTitle...
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

+21 -11
View File
@@ -7,12 +7,13 @@ givup() {
usage() {
echo "$0 --extname=module [--proto=file] [--stubs=file] [--xml[=file]]"
echo " [--full-xml] [--no-help]"
echo " [--skel=dir] [--full-xml] [--no-help]"
echo ""
echo " --extname=module module is the name of your extension"
echo " --proto=file file contains prototypes of functions to create"
echo " --stubs=file generate only function stubs in file"
echo " --xml generate xml documentation to be added to phpdoc-cvs"
echo " --skel=dir path to the skeleton directory"
echo " --full-xml generate xml documentation for a self-contained extension"
echo " (not yet implemented)"
echo " --no-help don't try to be nice and create comments in the code"
@@ -33,7 +34,7 @@ while test $# -gt 0; do
case $1 in
--extname=?*)
extname=$optarg
EXTNAME=`echo $extname | tr [a-z] [A-Z]`
EXTNAME=`echo $extname | tr "[:lower:]" "[:upper:]"`
;;
--proto=?*)
proto=$optarg
@@ -54,6 +55,9 @@ while test $# -gt 0; do
--no-help)
no_help="yes"
;;
--skel=?*)
skel_dir=$optarg
;;
*)
usage
;;
@@ -65,8 +69,14 @@ if test -d "$extname" ; then
givup "Directory $extname already exists."
fi
test -f ext_skel || givup "ext_skel must be in the current directory"
test -d skeleton || givup "subdirectory skeleton does not exist or is not directory"
if test -z "$skel_dir"; then
skel_dir="skeleton"
fi
## convert skel_dir to full path
skel_dir=`cd $skel_dir && pwd`
test -d $skel_dir || givup "directory $skel_dir does not exist or is not directory"
if echo '\c' | grep -s c >/dev/null 2>&1
then
@@ -84,7 +94,7 @@ if test -z "$stubs"; then
fi
if test -n "$proto"; then
cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f ./skeleton/create_stubs
cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f $skel_dir/create_stubs
fi
if test -z "$stubs"; then
@@ -187,7 +197,7 @@ if [ ! -z "$no_help" ]; then
echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
fi
sed -f sedscript <../skeleton/skeleton.c > $extname.c
sed -f sedscript < $skel_dir/skeleton.c > $extname.c
$ECHO_N " php_$extname.h$ECHO_C"
@@ -205,26 +215,26 @@ if [ ! -z "$no_help" ]; then
echo 's/^\/\*.*\*\/$//' >> sedscript
echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
fi
sed -f sedscript <../skeleton/php_skeleton.h > php_$extname.h
sed -f sedscript <$skel_dir/php_skeleton.h > php_$extname.h
$ECHO_N " CREDITS$ECHO_C"
echo "s/extname/$extname/g" > sedscript
sed -f sedscript <../skeleton/CREDITS > CREDITS
sed -f sedscript <$skel_dir/CREDITS > CREDITS
$ECHO_N " EXPERIMENTAL$ECHO_C"
echo "s/extname/$extname/g" > sedscript
sed -f sedscript <../skeleton/EXPERIMENTAL > EXPERIMENTAL
sed -f sedscript <$skel_dir/EXPERIMENTAL > EXPERIMENTAL
$ECHO_N " tests/001.phpt$ECHO_C"
mkdir tests || givup "Cannot create tests directory"
chmod 755 tests
sed -f sedscript <../skeleton/tests/001.phpt > tests/001.phpt
sed -f sedscript <$skel_dir/tests/001.phpt > tests/001.phpt
if test -z "$stubs" && test -z "$no_help"; then
$ECHO_N " $extname.php$ECHO_C"
sed \
-e "s/extname/$extname/g" \
<../skeleton/skeleton.php \
<$skel_dir/skeleton.php \
> $extname.php
fi
+44 -44
View File
@@ -262,7 +262,7 @@ ZEND_GET_MODULE(fbsql)
#define CHECK_LINK(link) { \
if (link==-1) { \
if (FB_SQL_G(generateWarnings)) \
php_error(E_WARNING, "FrontBase: A link to the server could not be established"); \
php_error(E_WARNING, "%s(): A link to the server could not be established", get_active_function_name(TSRMLS_C)); \
RETURN_FALSE; \
} \
}
@@ -526,14 +526,14 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if ((FB_SQL_G(maxLinks) != -1 && FB_SQL_G(linkCount) == FB_SQL_G(maxLinks)))
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "FrontBase link limit %d exceeded ", FB_SQL_G(maxLinks));
php_error(E_WARNING, "%s(): FrontBase link limit %d exceeded ", get_active_function_name(TSRMLS_C), FB_SQL_G(maxLinks));
RETURN_FALSE;
}
if ((FB_SQL_G(maxPersistent) != -1 && FB_SQL_G(persistentCount) == FB_SQL_G(maxPersistent)))
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "FrontBase persistent link limit %d exceeded ", FB_SQL_G(maxPersistent));
php_error(E_WARNING, "%s(): FrontBase persistent link limit %d exceeded ", get_active_function_name(TSRMLS_C), FB_SQL_G(maxPersistent));
RETURN_FALSE;
}
@@ -575,7 +575,7 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if ((FB_SQL_G(maxLinks) != -1 && FB_SQL_G(linkCount) == FB_SQL_G(maxLinks)))
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "FrontBase link limit %d exceeded ", FB_SQL_G(maxLinks));
php_error(E_WARNING, "%s(): FrontBase link limit %d exceeded ", get_active_function_name(TSRMLS_C), FB_SQL_G(maxLinks));
RETURN_FALSE;
}
@@ -722,7 +722,7 @@ static int php_fbsql_select_db(char *databaseName, PHPFBLink *link TSRMLS_DC)
if (c == NULL)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, fbcdcClassErrorMessage());
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), fbcdcClassErrorMessage());
return 0;
}
md = fbcdcCreateSession(c, "PHP", link->userName, link->userPassword, link->userName);
@@ -733,9 +733,9 @@ static int php_fbsql_select_db(char *databaseName, PHPFBLink *link TSRMLS_DC)
if (FB_SQL_G(generateWarnings))
{
if (emg)
php_error(E_WARNING, emg);
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), emg);
else
php_error(E_WARNING, "No message");
php_error(E_WARNING, "%s(): No message", get_active_function_name(TSRMLS_C));
}
link->errorText = strdup(emg);
link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);;
@@ -1050,7 +1050,7 @@ static void php_fbsql_read_lob(INTERNAL_FUNCTION_PARAMETERS, int lob_type)
convert_to_string_ex(lob_handle);
if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') {
if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "The handle is invalid");
if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "%s(): The handle is invalid", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1113,7 +1113,7 @@ static void php_fbsql_lob_size(INTERNAL_FUNCTION_PARAMETERS, int lob_type)
convert_to_string_ex(lob_handle);
if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') {
if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "The handle is invalid");
if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "%s(): The handle is invalid", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1349,8 +1349,8 @@ PHP_FUNCTION(fbsql_select_db)
int port = atoi(name);
if (port == 0 || port > 64535) {
if (FB_SQL_G(generateWarnings)) {
php_error(E_WARNING, "Cannot connect to FBExec for database '%s'", name);
php_error(E_WARNING, fbcehClassErrorMessage());
php_error(E_WARNING, "%s(): Cannot connect to FBExec for database '%s'", get_active_function_name(TSRMLS_C), name);
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), fbcehClassErrorMessage());
}
RETURN_FALSE;
}
@@ -1465,14 +1465,14 @@ PHP_FUNCTION(fbsql_create_db)
else if (status == FBStopping) txt = "stopping";
else if (status == FBNoExec ) txt = "no exec";
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Could not create %s@%s, database is %s", databaseName, phpLink->hostName, txt);
php_error(E_WARNING, "%s(): Could not create %s@%s, database is %s", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, txt);
RETURN_FALSE;
}
if (!fbcehCreateDatabaseNamedWithOptions(phpLink->execHandler, databaseName, ""))
{
char* error = fbechErrorMessage(phpLink->execHandler);
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Could not create %s@%s. %s.", databaseName, phpLink->hostName, error);
php_error(E_WARNING, "%s(): Could not create %s@%s. %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, error);
RETURN_FALSE;
}
for (i=0; i < 20; i++)
@@ -1488,7 +1488,7 @@ PHP_FUNCTION(fbsql_create_db)
if (status != FBRunning)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Database %s@%s created -- status unknown", databaseName, phpLink->hostName);
php_error(E_WARNING, "%s(): Database %s@%s created -- status unknown", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName);
RETURN_FALSE;
}
RETURN_TRUE;
@@ -1539,7 +1539,7 @@ PHP_FUNCTION(fbsql_drop_db)
else if (status == FBStopping ) txt = "stopping";
else if (status == FBNoExec ) txt = "no exec";
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Could not drop %s@%s, database is %s.", databaseName, phpLink->hostName, txt);
php_error(E_WARNING, "%s(): Could not drop %s@%s, database is %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, txt);
RETURN_FALSE;
}
@@ -1547,7 +1547,7 @@ PHP_FUNCTION(fbsql_drop_db)
{
char* error = fbechErrorMessage(phpLink->execHandler);
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Could not drop %s@%s. %s.", databaseName, phpLink->hostName, error);
php_error(E_WARNING, "%s(): Could not drop %s@%s. %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, error);
RETURN_FALSE;
}
for (i=0; i < 20; i++)
@@ -1563,7 +1563,7 @@ PHP_FUNCTION(fbsql_drop_db)
if (status != FBUnknownStatus)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Database %s@%s dropped -- status unknown", databaseName, phpLink->hostName);
php_error(E_WARNING, "%s(): Database %s@%s dropped -- status unknown", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName);
RETURN_FALSE;
}
}
@@ -1612,7 +1612,7 @@ PHP_FUNCTION(fbsql_start_db)
else if (status == FBStopping) txt = "stopping";
else if (status == FBNoExec ) txt = "no exec";
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Could not start %s@%s, as database is %s.", databaseName, phpLink->hostName, txt);
php_error(E_WARNING, "%s(): Could not start %s@%s, as database is %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, txt);
RETURN_FALSE;
}
@@ -1622,7 +1622,7 @@ PHP_FUNCTION(fbsql_start_db)
{
char* error = fbechErrorMessage(phpLink->execHandler);
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Could not start %s@%s. %s.", databaseName, phpLink->hostName, error);
php_error(E_WARNING, "%s(): Could not start %s@%s. %s.", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName, error);
RETURN_FALSE;
}
}
@@ -1640,7 +1640,7 @@ PHP_FUNCTION(fbsql_start_db)
if (status != FBRunning)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Database %s@%s started -- status unknown", databaseName, phpLink->hostName);
php_error(E_WARNING, "%s(): Database %s@%s started -- status unknown", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName);
RETURN_FALSE;
}
RETURN_TRUE;
@@ -1688,7 +1688,7 @@ PHP_FUNCTION(fbsql_stop_db)
if (!fbcdcStopDatabase(phpLink->connection))
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Cannot stop database %s@%s", databaseName, phpLink->hostName);
php_error(E_WARNING, "%s(): Cannot stop database %s@%s", get_active_function_name(TSRMLS_C), databaseName, phpLink->hostName);
RETURN_FALSE;
}
@@ -1765,7 +1765,7 @@ int mdOk(PHPFBLink* link, FBCMetaData* md, char* sql)
{
link->errorNo = 1;
link->errorText = strdup("Connection to database server was lost");
if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, link->errorText);
if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), link->errorText);
result = 0;
}
else if (fbcmdErrorsFound(md))
@@ -1775,9 +1775,9 @@ int mdOk(PHPFBLink* link, FBCMetaData* md, char* sql)
if (FB_SQL_G(generateWarnings))
{
if (emg)
php_error(E_WARNING, "Error in statement: '%s' %s", sql, emg);
php_error(E_WARNING, "%s(): Error in statement: '%s' %s", get_active_function_name(TSRMLS_C), sql, emg);
else
php_error(E_WARNING, "No message");
php_error(E_WARNING, "%s(): No message", get_active_function_name(TSRMLS_C));
}
link->errorText = strdup(emg);
link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);;
@@ -2232,7 +2232,7 @@ int phpSizeOfInt (int i)
}
/* }}} */
void phpfbColumnAsString (PHPFBResult* result, int column, void* data , int* length, char** value)
void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* length, char** value TSRMLS_DC)
{
FBCMetaData* md = result->metaData;
const FBCDatatypeMetaData* dtmd = fbcmdDatatypeMetaDataAtIndex(md, column);
@@ -2432,7 +2432,7 @@ void phpfbColumnAsString (PHPFBResult* result, int column, void* data , int* len
break;
default:
php_error(E_ERROR, "Unimplemented type");
php_error(E_ERROR, "%s(): Unimplemented type", get_active_function_name(TSRMLS_C));
break;
}
}
@@ -2477,13 +2477,13 @@ void phpfbSqlResult(INTERNAL_FUNCTION_PARAMETERS, PHPFBResult* result, int rowIn
else if (!phpfbFetchRow(result, rowIndex))
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "No such row %d in result set %d", rowIndex, rowIndex);
php_error(E_WARNING, "%s(): No such row %d in result set %d", get_active_function_name(TSRMLS_C), rowIndex, rowIndex);
RETURN_FALSE;
}
else if (columnIndex >= result->columnCount)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "No such column %d in result set %d", columnIndex, rowIndex);
php_error(E_WARNING, "%s(): No such column %d in result set %d", get_active_function_name(TSRMLS_C), columnIndex, rowIndex);
RETURN_FALSE;
}
else
@@ -2495,7 +2495,7 @@ void phpfbSqlResult(INTERNAL_FUNCTION_PARAMETERS, PHPFBResult* result, int rowIn
}
else if (row[columnIndex])
{
phpfbColumnAsString(result, columnIndex, row[columnIndex], &Z_STRLEN_P(return_value), &Z_STRVAL_P(return_value));
phpfbColumnAsString(result, columnIndex, row[columnIndex], &Z_STRLEN_P(return_value), &Z_STRVAL_P(return_value) TSRMLS_CC);
Z_TYPE_P(return_value) = IS_STRING;
}
else
@@ -2564,7 +2564,7 @@ PHP_FUNCTION(fbsql_result)
if (columnIndex < 0)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Illegal column index - %d", columnIndex);
php_error(E_WARNING, "%s(): Illegal column index - %d", get_active_function_name(TSRMLS_C), columnIndex);
RETURN_FALSE;
}
}
@@ -2797,7 +2797,7 @@ static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
if (((result_type & FBSQL_NUM) != FBSQL_NUM) && ((result_type & FBSQL_ASSOC) != FBSQL_ASSOC))
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Illegal result type use FBSQL_NUM, FBSQL_ASSOC, or FBSQL_BOTH.");
php_error(E_WARNING, "%s(): Illegal result type use FBSQL_NUM, FBSQL_ASSOC, or FBSQL_BOTH.", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if (array_init(return_value)==FAILURE)
@@ -2910,7 +2910,7 @@ static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
char* value;
unsigned int length;
unsigned int c = 0;
phpfbColumnAsString(result, i, row[i], &length, &value);
phpfbColumnAsString(result, i, row[i], &length, &value TSRMLS_CC);
if (result_type & FBSQL_NUM)
{
add_index_stringl(return_value, i, value, length, c);
@@ -2966,7 +2966,7 @@ PHP_FUNCTION(fbsql_data_seek)
if (rowIndex < 0)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Illegal row_index (%i)", rowIndex);
php_error(E_WARNING, "%s(): Illegal row_index (%i)", get_active_function_name(TSRMLS_C), rowIndex);
RETURN_FALSE;
}
@@ -3004,7 +3004,7 @@ PHP_FUNCTION(fbsql_fetch_lengths)
for (i=0; i < result->columnCount; i++)
{
unsigned length = 0;
if (result->row[i]) phpfbColumnAsString(result, i, result->row[i], &length, NULL);
if (result->row[i]) phpfbColumnAsString(result, i, result->row[i], &length, NULL TSRMLS_CC);
add_index_long(return_value, i, length);
}
}
@@ -3043,7 +3043,7 @@ PHP_FUNCTION(fbsql_fetch_field)
if (column < 0 || column >= result->columnCount)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "%d no such column in result", column);
php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column);
RETURN_FALSE;
}
}
@@ -3100,7 +3100,7 @@ PHP_FUNCTION(fbsql_field_seek)
if (column < 0 || column >= result->columnCount)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "%d no such column in result", column);
php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column);
RETURN_FALSE;
}
}
@@ -3143,7 +3143,7 @@ PHP_FUNCTION(fbsql_field_name)
if (column < 0 || column >= result->columnCount)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "%d no such column in result", column);
php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column);
RETURN_FALSE;
}
}
@@ -3192,7 +3192,7 @@ PHP_FUNCTION(fbsql_field_table)
if (column < 0 || column >= result->columnCount)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "%d no such column in result", column);
php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column);
RETURN_FALSE;
}
}
@@ -3233,7 +3233,7 @@ PHP_FUNCTION(fbsql_field_len)
if (column < 0 || column >= result->columnCount)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "%d no such column in result", column);
php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column);
RETURN_FALSE;
}
}
@@ -3285,7 +3285,7 @@ PHP_FUNCTION(fbsql_field_type)
if (column < 0 || column >= result->columnCount)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "%d no such column in result", column);
php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column);
RETURN_FALSE;
}
}
@@ -3339,7 +3339,7 @@ PHP_FUNCTION(fbsql_field_flags)
if (column < 0 || column >= result->columnCount)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "%d no such column in result", column);
php_error(E_WARNING, "%s(): %d no such column in result", get_active_function_name(TSRMLS_C), column);
RETURN_FALSE;
}
}
@@ -3417,7 +3417,7 @@ PHP_FUNCTION(fbsql_table_name)
if (index < 0)
{
if (FB_SQL_G(generateWarnings))
php_error(E_WARNING, "Illegal index (%i)", index);
php_error(E_WARNING, "%s(): Illegal index (%i)", get_active_function_name(TSRMLS_C), index);
RETURN_FALSE;
}
@@ -3427,7 +3427,7 @@ PHP_FUNCTION(fbsql_table_name)
result->columnIndex = 0;
row = fbcrhRowAtIndex(result->rowHandler, index);
phpfbColumnAsString(result, 0, row[0], &length, &value);
phpfbColumnAsString(result, 0, row[0], &length, &value TSRMLS_CC);
RETURN_STRINGL(value, length, 1);
}
/* }}} */
@@ -3483,7 +3483,7 @@ PHP_FUNCTION(fbsql_get_autostart_info)
ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
if (phpLink->execHandler == NULL) {
if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "No valid Exec handler available for this connection");
if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "%s(): No valid Exec handler available for this connection", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
else {
+17 -17
View File
@@ -196,7 +196,7 @@ PHP_FUNCTION(fdf_open)
err = FDFOpen(Z_STRVAL_PP(file), 0, &fdf);
if(err != FDFErcOK || !fdf) {
php_error(E_WARNING, "Could not open fdf document: %s", Z_STRVAL_PP(file));
php_error(E_WARNING, "%s(): Could not open fdf document: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(file));
RETURN_FALSE;
}
@@ -218,7 +218,7 @@ PHP_FUNCTION(fdf_create)
err = FDFCreate(&fdf);
if(err != FDFErcOK || !fdf) {
php_error(E_WARNING, "Error creating new fdf document!");
php_error(E_WARNING, "%s(): Error creating new fdf document!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -268,7 +268,7 @@ PHP_FUNCTION(fdf_get_value)
}
if(err != FDFErcOK) {
php_error(E_WARNING, "Error getting value of %s", Z_STRVAL_PP(fieldname));
php_error(E_WARNING, "%s(): Error getting value of %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname));
efree(buffer);
RETURN_FALSE;
}
@@ -298,7 +298,7 @@ PHP_FUNCTION(fdf_set_value)
err = FDFSetValue(fdf, Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value), (ASBool) Z_LVAL_PP(isname));
if(err != FDFErcOK) {
php_error(E_WARNING, "Error setting field: %s to value: %s", Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value));
php_error(E_WARNING, "%s(): Error setting field: %s to value: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value));
RETURN_FALSE;
}
RETURN_TRUE;
@@ -337,7 +337,7 @@ PHP_FUNCTION(fdf_next_field_name)
if(err != FDFErcOK) {
efree(buffer);
php_error(E_WARNING,"Error getting next fieldname!");
php_error(E_WARNING, "%s(): Error getting next fieldname!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -386,7 +386,7 @@ PHP_FUNCTION(fdf_set_ap)
possible errors this function can return. Or create global error handler function.
*/
if(err != FDFErcOK) {
php_error(E_WARNING,"Error setting appearence of field: %s", Z_STRVAL_PP(fieldname));
php_error(E_WARNING, "%s(): Error setting appearence of field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname));
RETURN_FALSE;
}
@@ -413,7 +413,7 @@ PHP_FUNCTION(fdf_set_status)
err = FDFSetStatus(fdf, Z_STRVAL_PP(status));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error setting fdf document status key to: %s", Z_STRVAL_PP(status));
php_error(E_WARNING, "%s(): Error setting fdf document status key to: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(status));
RETURN_FALSE;
}
@@ -446,7 +446,7 @@ PHP_FUNCTION(fdf_get_status)
}
if(err != FDFErcOK) {
php_error(E_WARNING,"Error getting fdf document status key!");
php_error(E_WARNING, "%s(): Error getting fdf document status key!", get_active_function_name(TSRMLS_C));
efree(buf);
RETURN_FALSE;
}
@@ -474,7 +474,7 @@ PHP_FUNCTION(fdf_set_file)
err = FDFSetFile(fdf, Z_STRVAL_PP(filename));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error setting filename key to: %s", Z_STRVAL_PP(filename));
php_error(E_WARNING, "%s(): Error setting filename key to: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename));
RETURN_FALSE;
}
@@ -507,7 +507,7 @@ PHP_FUNCTION(fdf_get_file)
}
if(err != FDFErcOK) {
php_error(E_WARNING,"Error getting fdf document filename key!");
php_error(E_WARNING, "%s(): Error getting fdf document filename key!", get_active_function_name(TSRMLS_C));
efree(buf);
RETURN_FALSE;
}
@@ -534,7 +534,7 @@ PHP_FUNCTION(fdf_save)
convert_to_string_ex(filename);
err = FDFSave(fdf, Z_STRVAL_PP(filename));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error saving fdf document into filename: %s", Z_STRVAL_PP(filename));
php_error(E_WARNING, "%s(): Error saving fdf document into filename: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename));
RETURN_FALSE;
}
@@ -574,7 +574,7 @@ PHP_FUNCTION(fdf_add_template)
err = FDFAddTemplate(fdf, Z_LVAL_PP(newpage), &filespec, Z_STRVAL_PP(template), Z_LVAL_PP(rename));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error adding template: %s into fdf document", Z_STRVAL_PP(template));
php_error(E_WARNING, "%s(): Error adding template: %s into fdf document", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(template));
RETURN_FALSE;
}
@@ -602,7 +602,7 @@ PHP_FUNCTION(fdf_set_flags)
err=FDFSetFlags(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(flags), Z_LVAL_PP(newflags));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error setting flags for field: %s", Z_STRVAL_PP(fieldname));
php_error(E_WARNING, "%s(): Error setting flags for field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname));
RETURN_FALSE;
}
@@ -631,7 +631,7 @@ PHP_FUNCTION(fdf_set_opt)
err = FDFSetOpt(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(element), Z_STRVAL_PP(value), Z_STRVAL_PP(name));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error setting FDF option for field: %s", Z_STRVAL_PP(fieldname));
php_error(E_WARNING, "%s(): Error setting FDF option for field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname));
RETURN_FALSE;
}
RETURN_TRUE;
@@ -659,7 +659,7 @@ PHP_FUNCTION(fdf_set_submit_form_action)
err = FDFSetSubmitFormAction(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(trigger), Z_STRVAL_PP(url), Z_LVAL_PP(flags));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error setting FDF submit action for field: %s", Z_STRVAL_PP(fieldname));
php_error(E_WARNING, "%s(): Error setting FDF submit action for field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname));
RETURN_FALSE;
}
RETURN_TRUE;
@@ -686,7 +686,7 @@ PHP_FUNCTION(fdf_set_javascript_action)
err = FDFSetJavaScriptAction(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(trigger), Z_STRVAL_PP(script));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error setting FDF javascript action for field: %s", Z_STRVAL_PP(fieldname));
php_error(E_WARNING, "%s(): Error setting FDF javascript action for field: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(fieldname));
RETURN_FALSE;
}
RETURN_TRUE;
@@ -712,7 +712,7 @@ PHP_FUNCTION(fdf_set_encoding)
err = FDFSetEncoding(fdf, Z_STRVAL_PP(enc));
if(err != FDFErcOK) {
php_error(E_WARNING,"Error setting FDF encoding: %s", Z_STRVAL_PP(enc));
php_error(E_WARNING, "%s(): Error setting FDF encoding: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(enc));
RETURN_FALSE;
}
RETURN_TRUE;
+18 -18
View File
@@ -237,20 +237,20 @@ PHP_FUNCTION(filepro)
}
if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
php_error(E_WARNING, "filePro: cannot open map: [%d] %s",
php_error(E_WARNING, "%s(): Cannot open map: [%d] %s", get_active_function_name(TSRMLS_C),
errno, strerror(errno));
RETURN_FALSE;
}
if (!fgets(readbuf, sizeof(readbuf), fp)) {
fclose(fp);
php_error(E_WARNING, "filePro: cannot read map: [%d] %s",
php_error(E_WARNING, "%s(): Cannot read map: [%d] %s", get_active_function_name(TSRMLS_C),
errno, strerror(errno));
RETURN_FALSE;
}
/* Get the field count, assume the file is readable! */
if (strcmp(php_strtok_r(readbuf, ":", &strtok_buf), "map")) {
php_error(E_WARNING, "filePro: map file corrupt or encrypted");
php_error(E_WARNING, "%s(): Map file corrupt or encrypted", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
FP_GLOBAL(fp_keysize) = atoi(php_strtok_r(NULL, ":", &strtok_buf));
@@ -261,7 +261,7 @@ PHP_FUNCTION(filepro)
for (i = 0; i < FP_GLOBAL(fp_fcount); i++) {
if (!fgets(readbuf, sizeof(readbuf), fp)) {
fclose(fp);
php_error(E_WARNING, "filePro: cannot read map: [%d] %s",
php_error(E_WARNING, "%s(): Cannot read map: [%d] %s", get_active_function_name(TSRMLS_C),
errno, strerror(errno));
RETURN_FALSE;
}
@@ -317,7 +317,7 @@ PHP_FUNCTION(filepro_rowcount)
if (!FP_GLOBAL(fp_database)) {
php_error(E_WARNING,
"filePro: must set database directory first!\n");
"%s(): Must set database directory first!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -335,7 +335,7 @@ PHP_FUNCTION(filepro_rowcount)
}
if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
php_error(E_WARNING, "filePro: cannot open key: [%d] %s",
php_error(E_WARNING, "%s(): Cannot open key: [%d] %s", get_active_function_name(TSRMLS_C),
errno, strerror(errno));
RETURN_FALSE;
}
@@ -375,7 +375,7 @@ PHP_FUNCTION(filepro_fieldname)
if (!FP_GLOBAL(fp_database)) {
php_error(E_WARNING,
"filePro: must set database directory first!\n");
"%s(): Must set database directory first!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -386,7 +386,7 @@ PHP_FUNCTION(filepro_fieldname)
}
php_error(E_WARNING,
"filePro: unable to locate field number %d.\n",
"%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C),
Z_LVAL_P(fno));
RETVAL_FALSE;
@@ -416,7 +416,7 @@ PHP_FUNCTION(filepro_fieldtype)
if (!FP_GLOBAL(fp_database)) {
php_error(E_WARNING,
"filePro: must set database directory first!\n");
"%s(): Must set database directory first!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -426,7 +426,7 @@ PHP_FUNCTION(filepro_fieldtype)
}
}
php_error(E_WARNING,
"filePro: unable to locate field number %d.\n",
"%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C),
Z_LVAL_P(fno));
RETVAL_FALSE;
}
@@ -455,7 +455,7 @@ PHP_FUNCTION(filepro_fieldwidth)
if (!FP_GLOBAL(fp_database)) {
php_error(E_WARNING,
"filePro: must set database directory first!\n");
"%s(): Must set database directory first!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -465,7 +465,7 @@ PHP_FUNCTION(filepro_fieldwidth)
}
}
php_error(E_WARNING,
"filePro: unable to locate field number %d.\n",
"%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C),
Z_LVAL_P(fno));
RETVAL_FALSE;
}
@@ -489,7 +489,7 @@ PHP_FUNCTION(filepro_fieldcount)
if (!FP_GLOBAL(fp_database)) {
php_error(E_WARNING,
"filePro: must set database directory first!\n");
"%s(): Must set database directory first!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -523,7 +523,7 @@ PHP_FUNCTION(filepro_retrieve)
if (!FP_GLOBAL(fp_database)) {
php_error(E_WARNING,
"filePro: must set database directory first!\n");
"%s(): Must set database directory first!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -534,7 +534,7 @@ PHP_FUNCTION(filepro_retrieve)
rnum = Z_LVAL_P(rno);
if (rnum < 0 || fnum < 0 || fnum >= FP_GLOBAL(fp_fcount)) {
php_error(E_WARNING, "filepro: parameters out of range");
php_error(E_WARNING, "%s(): Parameters out of range", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -543,7 +543,7 @@ PHP_FUNCTION(filepro_retrieve)
offset += lp->width;
}
if (!lp) {
php_error(E_WARNING, "filePro: cannot locate field");
php_error(E_WARNING, "%s(): Cannot locate field", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -559,7 +559,7 @@ PHP_FUNCTION(filepro_retrieve)
}
if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
php_error(E_WARNING, "filePro: cannot open key: [%d] %s",
php_error(E_WARNING, "%s(): Cannot open key: [%d] %s", get_active_function_name(TSRMLS_C),
errno, strerror(errno));
fclose(fp);
RETURN_FALSE;
@@ -568,7 +568,7 @@ PHP_FUNCTION(filepro_retrieve)
readbuf = emalloc (lp->width+1);
if (fread(readbuf, lp->width, 1, fp) != 1) {
php_error(E_WARNING, "filePro: cannot read data: [%d] %s",
php_error(E_WARNING, "%s(): Cannot read data: [%d] %s", get_active_function_name(TSRMLS_C),
errno, strerror(errno));
efree(readbuf);
fclose(fp);
+1
View File
@@ -1,2 +1,3 @@
FTP
Andrew Skalski
Stefan Esser
+335 -12
View File
@@ -12,7 +12,8 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Andrew Skalski <askalski@chek.com> |
| Authors: Andrew Skalski <askalski@chek.com> |
| Stefan Esser <sesser@php.net> (resume functions) |
+----------------------------------------------------------------------+
*/
@@ -105,6 +106,7 @@ ftp_open(const char *host, short port, long timeout_sec)
{
ftpbuf_t *ftp;
int size;
struct timeval tv;
/* alloc the ftp structure */
@@ -114,13 +116,17 @@ ftp_open(const char *host, short port, long timeout_sec)
return NULL;
}
ftp->fd = php_hostconnect(host, (unsigned short) (port ? port : 21), SOCK_STREAM, (int) timeout_sec);
tv.tv_sec = timeout_sec;
tv.tv_usec = 0;
ftp->fd = php_hostconnect(host, (unsigned short) (port ? port : 21), SOCK_STREAM, &tv);
if (ftp->fd == -1) {
goto bail;
}
/* Default Settings */
ftp->timeout_sec = timeout_sec;
ftp->async = 0;
size = sizeof(ftp->localaddr);
memset(&ftp->localaddr, 0, size);
@@ -152,6 +158,8 @@ ftp_close(ftpbuf_t *ftp)
return NULL;
if (ftp->fd != -1)
closesocket(ftp->fd);
if (ftp->data)
data_close(ftp->data);
ftp_gc(ftp);
free(ftp);
return NULL;
@@ -227,6 +235,8 @@ ftp_reinit(ftpbuf_t *ftp)
ftp_gc(ftp);
ftp->async = 0;
if (!ftp_putcmd(ftp, "REIN", NULL))
return 0;
if (!ftp_getresp(ftp) || ftp->resp != 220)
@@ -412,9 +422,9 @@ ftp_nlist(ftpbuf_t *ftp, const char *path)
/* {{{ ftp_list
*/
char**
ftp_list(ftpbuf_t *ftp, const char *path)
ftp_list(ftpbuf_t *ftp, const char *path, int recursive)
{
return ftp_genlist(ftp, "LIST", path);
return ftp_genlist(ftp, ((recursive) ? "LIST -R" : "LIST"), path);
}
/* }}} */
@@ -428,7 +438,7 @@ ftp_type(ftpbuf_t *ftp, ftptype_t type)
if (ftp == NULL)
return 0;
if (type == Z_TYPE_P(ftp))
if (type == ftp->type)
return 1;
if (type == FTPTYPE_ASCII)
@@ -443,7 +453,7 @@ ftp_type(ftpbuf_t *ftp, ftptype_t type)
if (!ftp_getresp(ftp) || ftp->resp != 200)
return 0;
Z_TYPE_P(ftp) = type;
ftp->type = type;
return 1;
}
@@ -541,12 +551,13 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
/* {{{ ftp_get
*/
int
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type)
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos)
{
databuf_t *data = NULL;
char *ptr;
int lastch;
int rcvd;
char arg[11];
TSRMLS_FETCH();
if (ftp == NULL)
@@ -560,6 +571,16 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type)
goto bail;
}
if (resumepos>0) {
sprintf(arg, "%u", resumepos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
goto bail;
}
}
if (!ftp_putcmd(ftp, "RETR", path)) {
goto bail;
}
@@ -614,12 +635,13 @@ bail:
/* {{{ ftp_put
*/
int
ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type)
ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos)
{
databuf_t *data = NULL;
int size;
char *ptr;
int ch;
char arg[11];
TSRMLS_FETCH();
if (ftp == NULL)
@@ -631,6 +653,16 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type)
if ((data = ftp_getdata(ftp)) == NULL)
goto bail;
if (startpos>0) {
sprintf(arg, "%u", startpos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
goto bail;
}
}
if (!ftp_putcmd(ftp, "STOR", path))
goto bail;
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125))
@@ -898,9 +930,9 @@ ftp_getresp(ftpbuf_t *ftp)
}
/* Break out when the end-tag is found */
if (isdigit(ftp->inbuf[0]) &&
isdigit(ftp->inbuf[1]) &&
isdigit(ftp->inbuf[2]) &&
if (isdigit(ftp->inbuf[0]) &&
isdigit(ftp->inbuf[1]) &&
isdigit(ftp->inbuf[2]) &&
ftp->inbuf[3] == ' ') {
break;
}
@@ -920,6 +952,9 @@ ftp_getresp(ftpbuf_t *ftp)
memmove(ftp->inbuf, ftp->inbuf + 4, FTP_BUFSIZE - 4);
if (ftp->extra)
ftp->extra -= 4;
return 1;
}
/* }}} */
@@ -988,6 +1023,59 @@ my_recv(ftpbuf_t *ftp, int s, void *buf, size_t len)
}
/* }}} */
/* {{{ data_available
*/
int
data_available(ftpbuf_t *ftp, int s)
{
fd_set read_set;
struct timeval tv;
int n;
tv.tv_sec = 0;
tv.tv_usec = 1;
FD_ZERO(&read_set);
FD_SET(s, &read_set);
n = select(s + 1, &read_set, NULL, NULL, &tv);
if (n < 1) {
#ifndef PHP_WIN32
if (n == 0)
errno = ETIMEDOUT;
#endif
return 0;
}
return 1;
}
/* }}} */
/* {{{ data_writeable
*/
int
data_writeable(ftpbuf_t *ftp, int s)
{
fd_set write_set;
struct timeval tv;
int n;
tv.tv_sec = 0;
tv.tv_usec = 1;
FD_ZERO(&write_set);
FD_SET(s, &write_set);
n = select(s + 1, NULL, &write_set, NULL, &tv);
if (n < 1) {
#ifndef PHP_WIN32
if (n == 0)
errno = ETIMEDOUT;
#endif
return 0;
}
return 1;
}
/* }}} */
/* {{{ my_accept
*/
int
@@ -1042,7 +1130,7 @@ ftp_getdata(ftpbuf_t *ftp)
}
data->listener = -1;
data->fd = -1;
Z_TYPE_P(data) = Z_TYPE_P(ftp);
data->type = ftp->type;
sa = (struct sockaddr *) &ftp->localaddr;
/* bind/listen */
@@ -1279,6 +1367,241 @@ bail:
}
/* }}} */
/* {{{ ftp_async_get
*/
int
ftp_async_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos)
{
databuf_t *data = NULL;
char *ptr;
int lastch;
int rcvd;
char arg[11];
TSRMLS_FETCH();
if (ftp == NULL)
goto bail;
if (!ftp_type(ftp, type)) {
goto bail;
}
if ((data = ftp_getdata(ftp)) == NULL) {
goto bail;
}
if (resumepos>0) {
sprintf(arg, "%u", resumepos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
goto bail;
}
}
if (!ftp_putcmd(ftp, "RETR", path)) {
goto bail;
}
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
goto bail;
}
if ((data = data_accept(data, ftp)) == NULL) {
goto bail;
}
ftp->data = data;
ftp->stream = outstream;
ftp->lastch = 0;
ftp->async = 1;
return (ftp_async_continue_read(ftp));
bail:
data_close(data);
return PHP_FTP_FAILED;
}
/* }}} */
/* {{{ ftp_aget
*/
int
ftp_async_continue_read(ftpbuf_t *ftp)
{
databuf_t *data = NULL;
char *ptr;
int lastch;
int rcvd;
ftptype_t type;
TSRMLS_FETCH();
data = ftp->data;
/* check if there is already more data */
if (!data_available(ftp, data->fd)) {
return PHP_FTP_MOREDATA;
}
type = ftp->type;
lastch = ftp->lastch;
if (rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE)) {
if (rcvd == -1) {
goto bail;
}
if (type == FTPTYPE_ASCII) {
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
if (lastch == '\r' && *ptr != '\n')
php_stream_putc(ftp->stream, '\r');
if (*ptr != '\r')
php_stream_putc(ftp->stream, *ptr);
lastch = *ptr;
}
}
else {
php_stream_write(ftp->stream, data->buf, rcvd);
}
ftp->lastch = lastch;
return PHP_FTP_MOREDATA;
}
if (type == FTPTYPE_ASCII && lastch == '\r')
php_stream_putc(ftp->stream, '\r');
data = data_close(data);
if (php_stream_error(ftp->stream)) {
goto bail;
}
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
goto bail;
}
ftp->async = 0;
return PHP_FTP_FINISHED;
bail:
ftp->async = 0;
data_close(data);
return PHP_FTP_FAILED;
}
/* }}} */
/* {{{ ftp_async_put
*/
int
ftp_async_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos)
{
databuf_t *data = NULL;
int size;
char *ptr;
int ch;
char arg[11];
TSRMLS_FETCH();
if (ftp == NULL)
return 0;
if (!ftp_type(ftp, type))
goto bail;
if ((data = ftp_getdata(ftp)) == NULL)
goto bail;
if (startpos>0) {
sprintf(arg, "%u", startpos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
if (!ftp_getresp(ftp) || (ftp->resp != 350)) {
goto bail;
}
}
if (!ftp_putcmd(ftp, "STOR", path))
goto bail;
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125))
goto bail;
if ((data = data_accept(data, ftp)) == NULL)
goto bail;
ftp->data = data;
ftp->stream = instream;
ftp->lastch = 0;
ftp->async = 1;
return (ftp_async_continue_write(ftp));
bail:
data_close(data);
return PHP_FTP_FAILED;
}
/* }}} */
/* {{{ ftp_async_continue_write
*/
int
ftp_async_continue_write(ftpbuf_t *ftp)
{
int size;
char *ptr;
int ch;
TSRMLS_FETCH();
/* check if we can write more data */
if (!data_writeable(ftp, ftp->data->fd)) {
return PHP_FTP_MOREDATA;
}
size = 0;
ptr = ftp->data->buf;
while ((ch = php_stream_getc(ftp->stream))!=EOF && !php_stream_eof(ftp->stream)) {
if (ch == '\n' && ftp->type == FTPTYPE_ASCII) {
*ptr++ = '\r';
size++;
}
*ptr++ = ch;
size++;
/* flush if necessary */
if (FTP_BUFSIZE - size < 2) {
if (my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size)
goto bail;
return PHP_FTP_MOREDATA;
}
}
if (size && my_send(ftp, ftp->data->fd, ftp->data->buf, size) != size)
goto bail;
if (php_stream_error(ftp->stream))
goto bail;
ftp->data = data_close(ftp->data);
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250))
goto bail;
ftp->async = 0;
return PHP_FTP_FINISHED;
bail:
data_close(ftp->data);
ftp->async = 0;
return PHP_FTP_FAILED;
}
/* }}} */
#endif /* HAVE_FTP */
/*
+44 -10
View File
@@ -13,6 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andrew Skalski <askalski@chek.com> |
| Stefan Esser <sesser@php.net> (resume functions) |
+----------------------------------------------------------------------+
*/
@@ -29,6 +30,10 @@
#endif
#define FTP_DEFAULT_TIMEOUT 90
#define FTP_DEFAULT_AUTOSEEK 1
#define PHP_FTP_FAILED 0
#define PHP_FTP_FINISHED 1
#define PHP_FTP_MOREDATA 2
/* XXX this should be configurable at runtime XXX */
#define FTP_BUFSIZE 4096
@@ -38,6 +43,14 @@ typedef enum ftptype {
FTPTYPE_IMAGE
} ftptype_t;
typedef struct databuf
{
int listener; /* listener socket */
int fd; /* data connection */
ftptype_t type; /* transfer type */
char buf[FTP_BUFSIZE]; /* data buffer */
} databuf_t;
typedef struct ftpbuf
{
int fd; /* control connection */
@@ -53,15 +66,16 @@ typedef struct ftpbuf
int pasv; /* 0=off; 1=pasv; 2=ready */
php_sockaddr_storage pasvaddr; /* passive mode address */
long timeout_sec; /* User configureable timeout (seconds) */
int autoseek; /* User configureable autoseek flag */
int async; /* asyncronous transfer in progress */
databuf_t *data; /* Data connection for asyncrounous transfers */
php_stream *stream; /* output stream for asyncrounous transfers */
int lastch; /* last char of previous call */
int direction; /* recv = 0 / send = 1 */
int closestream;/* close or not close stream */
} ftpbuf_t;
typedef struct databuf
{
int listener; /* listener socket */
int fd; /* data connection */
ftptype_t type; /* transfer type */
char buf[FTP_BUFSIZE]; /* data buffer */
} databuf_t;
/* open a FTP connection, returns ftpbuf (NULL on error)
@@ -120,7 +134,7 @@ char** ftp_nlist(ftpbuf_t *ftp, const char *path);
* array must be freed (but don't
* free the array elements)
*/
char** ftp_list(ftpbuf_t *ftp, const char *path);
char** ftp_list(ftpbuf_t *ftp, const char *path, int recursive);
/* switches passive mode on or off
* returns true on success, false on error
@@ -131,12 +145,12 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv);
* returns true on success, false on error
*/
int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path,
ftptype_t type);
ftptype_t type, int resumepos);
/* stores the data from a file, socket, or process as a file on the remote server
* returns true on success, false on error
*/
int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type);
int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos);
/* returns the size of the given file, or -1 on error */
int ftp_size(ftpbuf_t *ftp, const char *path);
@@ -153,4 +167,24 @@ int ftp_delete(ftpbuf_t *ftp, const char *path);
/* sends a SITE command to the server */
int ftp_site(ftpbuf_t *ftp, const char *cmd);
/* retrieves part of a file and saves its contents to outfp
* returns true on success, false on error
*/
int ftp_async_get(ftpbuf_t *ftp, php_stream *outstream, const char *path,
ftptype_t type, int resumepos);
/* stores the data from a file, socket, or process as a file on the remote server
* returns true on success, false on error
*/
int ftp_async_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos);
/* continues a previous async_(f)get command
*/
int ftp_async_continue_read(ftpbuf_t *ftp);
/* continues a previous async_(f)put command
*/
int ftp_async_continue_write(ftpbuf_t *ftp);
#endif
+395 -55
View File
@@ -13,6 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andrew Skalski <askalski@chek.com> |
| Stefan Esser <sesser@php.net> (resume functions) |
+----------------------------------------------------------------------+
*/
@@ -60,6 +61,11 @@ function_entry php_ftp_functions[] = {
PHP_FE(ftp_close, NULL)
PHP_FE(ftp_set_option, NULL)
PHP_FE(ftp_get_option, NULL)
PHP_FE(ftp_async_fget, NULL)
PHP_FE(ftp_async_get, NULL)
PHP_FE(ftp_async_continue, NULL)
PHP_FE(ftp_async_put, NULL)
PHP_FE(ftp_async_fput, NULL)
PHP_FALIAS(ftp_quit, ftp_close, NULL)
{NULL, NULL, NULL}
};
@@ -91,11 +97,16 @@ static void ftp_destructor_ftpbuf(zend_rsrc_list_entry *rsrc TSRMLS_DC)
PHP_MINIT_FUNCTION(ftp)
{
le_ftpbuf = zend_register_list_destructors_ex(ftp_destructor_ftpbuf, NULL, le_ftpbuf_name, module_number);
REGISTER_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS);
return SUCCESS;
}
@@ -108,7 +119,7 @@ PHP_MINFO_FUNCTION(ftp)
#define XTYPE(xtype, mode) { \
if (mode != FTPTYPE_ASCII && mode != FTPTYPE_IMAGE) { \
php_error(E_WARNING, "%s(): mode must be FTP_ASCII or FTP_BINARY", get_active_function_name(TSRMLS_C)); \
php_error(E_WARNING, "%s(): Mode must be FTP_ASCII or FTP_BINARY", get_active_function_name(TSRMLS_C)); \
RETURN_FALSE; \
} \
xtype = mode; \
@@ -129,7 +140,7 @@ PHP_FUNCTION(ftp_connect)
}
if (timeout_sec <= 0) {
php_error(E_WARNING, "%s(): timeout has to be greater than 0",
php_error(E_WARNING, "%s(): Timeout has to be greater than 0",
get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -140,6 +151,9 @@ PHP_FUNCTION(ftp_connect)
RETURN_FALSE;
}
/* autoseek for resuming */
ftp->autoseek = FTP_DEFAULT_AUTOSEEK;
ZEND_REGISTER_RESOURCE(return_value, ftp, le_ftpbuf);
}
/* }}} */
@@ -252,7 +266,7 @@ PHP_FUNCTION(ftp_exec)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
/* execute serverside command */
@@ -342,7 +356,7 @@ PHP_FUNCTION(ftp_nlist)
}
/* }}} */
/* {{{ proto array ftp_rawlist(resource stream, string directory)
/* {{{ proto array ftp_rawlist(resource stream, string directory [, bool recursive])
Returns a detailed listing of a directory as an array of output lines */
PHP_FUNCTION(ftp_rawlist)
{
@@ -350,15 +364,16 @@ PHP_FUNCTION(ftp_rawlist)
ftpbuf_t *ftp;
char **llist, **ptr, *dir;
int dir_len;
zend_bool recursive = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &z_ftp, &dir, &dir_len, &recursive) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
/* get raw directory listing */
if (NULL == (llist = ftp_list(ftp, dir))) {
if (NULL == (llist = ftp_list(ftp, dir, recursive))) {
RETURN_FALSE;
}
@@ -393,7 +408,7 @@ PHP_FUNCTION(ftp_systype)
}
/* }}} */
/* {{{ proto bool ftp_fget(resource stream, resource fp, string remote_file, int mode)
/* {{{ proto bool ftp_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])
Retrieves a file from the FTP server and writes it to an open file */
PHP_FUNCTION(ftp_fget)
{
@@ -402,9 +417,9 @@ PHP_FUNCTION(ftp_fget)
ftptype_t xtype;
php_stream *stream;
char *file;
int file_len, mode;
int file_len, mode, resumepos=0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl", &z_ftp, &z_file, &file, &file_len, &mode) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
return;
}
@@ -412,13 +427,28 @@ PHP_FUNCTION(ftp_fget)
ZEND_FETCH_RESOURCE(stream, php_stream*, &z_file, -1, "File-Handle", php_file_le_stream());
XTYPE(xtype, mode);
if (!ftp_get(ftp, stream, file, xtype) || php_stream_error(stream)) {
/* ignore autoresume if autoseek is switched off */
if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
resumepos = 0;
}
if (ftp->autoseek && resumepos) {
/* if autoresume is wanted seek to end */
if (resumepos == PHP_FTP_AUTORESUME) {
php_stream_seek(stream, 0, SEEK_END);
resumepos = php_stream_tell(stream);
} else {
php_stream_seek(stream, resumepos, SEEK_SET);
}
}
if (!ftp_get(ftp, stream, file, xtype, resumepos) || php_stream_error(stream)) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
RETURN_FALSE;
}
if (php_stream_error(stream)) {
php_error(E_WARNING, "%s(): error writing %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(z_file));
php_error(E_WARNING, "%s(): Error writing %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(z_file));
RETURN_FALSE;
}
@@ -426,6 +456,53 @@ PHP_FUNCTION(ftp_fget)
}
/* }}} */
/* {{{ proto bool ftp_async_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])
Retrieves a file from the FTP server asynchronly and writes it to an open file */
PHP_FUNCTION(ftp_async_fget)
{
zval *z_ftp, *z_file;
ftpbuf_t *ftp;
ftptype_t xtype;
php_stream *stream;
char *file;
int file_len, mode, resumepos=0, ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
ZEND_FETCH_RESOURCE(stream, php_stream*, &z_file, -1, "File-Handle", php_file_le_stream());
XTYPE(xtype, mode);
/* ignore autoresume if autoseek is switched off */
if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
resumepos = 0;
}
if (ftp->autoseek && resumepos) {
/* if autoresume is wanted seek to end */
if (resumepos == PHP_FTP_AUTORESUME) {
php_stream_seek(stream, 0, SEEK_END);
resumepos = php_stream_tell(stream);
} else {
php_stream_seek(stream, resumepos, SEEK_SET);
}
}
/* configuration */
ftp->direction = 0; /* recv */
ftp->closestream = 0; /* do not close */
if ((ret = ftp_async_get(ftp, stream, file, xtype, resumepos)) == PHP_FTP_FAILED || php_stream_error(stream)) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
RETURN_LONG(ret);
}
RETURN_LONG(ret);
}
/* }}} */
/* {{{ proto bool ftp_pasv(resource stream, bool pasv)
Turns passive mode on or off */
PHP_FUNCTION(ftp_pasv)
@@ -448,71 +525,175 @@ PHP_FUNCTION(ftp_pasv)
}
/* }}} */
/* {{{ proto bool ftp_get(resource stream, string local_file, string remote_file, int mode)
/* {{{ proto bool ftp_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])
Retrieves a file from the FTP server and writes it to a local file */
PHP_FUNCTION(ftp_get)
{
zval *z_ftp;
ftpbuf_t *ftp;
ftptype_t xtype;
php_stream * tmpstream, *outstream;
php_stream *outstream;
char *local, *remote;
int local_len, remote_len, mode;
int local_len, remote_len, mode, resumepos=0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl", &z_ftp, &local, &local_len, &remote, &remote_len, &mode) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode);
/* get to temporary file, so if there is an error, no existing
* file gets clobbered
*/
tmpstream = php_stream_fopen_tmpfile();
if (tmpstream == NULL) {
RETURN_FALSE;
/* ignore autoresume if autoseek is switched off */
if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
resumepos = 0;
}
if (!ftp_get(ftp, tmpstream, remote, xtype) || php_stream_error(tmpstream)) {
php_stream_close(tmpstream);
php_error(E_WARNING, "ftp_get: %s", ftp->inbuf);
RETURN_FALSE;
if (ftp->autoseek && resumepos) {
outstream = php_stream_fopen(local, "rb+", NULL);
if (outstream == NULL) {
outstream = php_stream_fopen(local, "wb", NULL);
}
if (outstream != NULL) {
/* if autoresume is wanted seek to end */
if (resumepos == PHP_FTP_AUTORESUME) {
php_stream_seek(outstream, 0, SEEK_END);
resumepos = php_stream_tell(outstream);
} else {
php_stream_seek(outstream, resumepos, SEEK_SET);
}
}
} else {
outstream = php_stream_fopen(local, "wb", NULL);
}
outstream = php_stream_fopen(local, "wb", NULL);
if (outstream == NULL) {
php_stream_close(tmpstream);
php_error(E_WARNING, "%s(): error opening %s", get_active_function_name(TSRMLS_C), local);
php_error(E_WARNING, "%s(): Error opening %s", get_active_function_name(TSRMLS_C), local);
RETURN_FALSE;
}
php_stream_rewind(tmpstream);
if (php_stream_copy_to_stream(tmpstream, outstream, PHP_STREAM_COPY_ALL) == 0) {
php_error(E_WARNING, "%s(): error writing %s", get_active_function_name(TSRMLS_C), local);
RETVAL_FALSE;
if (!ftp_get(ftp, outstream, remote, xtype, resumepos) || php_stream_error(outstream)) {
php_stream_close(outstream);
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
RETURN_FALSE;
}
else
RETVAL_TRUE;
php_stream_close(tmpstream);
php_stream_close(outstream);
}
/* }}} */
/* {{{ proto bool ftp_fput(resource stream, string remote_file, resource fp, int mode)
/* {{{ proto inf ftp_async_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])
Retrieves a file from the FTP server asynchronly and writes it to a local file */
PHP_FUNCTION(ftp_async_get)
{
zval *z_ftp;
ftpbuf_t *ftp;
ftptype_t xtype;
php_stream *outstream;
char *local, *remote;
int local_len, remote_len, mode, resumepos=0, ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode);
/* ignore autoresume if autoseek is switched off */
if (!ftp->autoseek && resumepos == PHP_FTP_AUTORESUME) {
resumepos = 0;
}
if (ftp->autoseek && resumepos) {
outstream = php_stream_fopen(local, "rb+", NULL);
if (outstream == NULL) {
outstream = php_stream_fopen(local, "wb", NULL);
}
if (outstream != NULL) {
/* if autoresume is wanted seek to end */
if (resumepos == PHP_FTP_AUTORESUME) {
php_stream_seek(outstream, 0, SEEK_END);
resumepos = php_stream_tell(outstream);
} else {
php_stream_seek(outstream, resumepos, SEEK_SET);
}
}
} else {
outstream = php_stream_fopen(local, "wb", NULL);
}
if (outstream == NULL) {
php_error(E_WARNING, "%s(): Error opening %s", get_active_function_name(TSRMLS_C), local);
RETURN_FALSE;
}
/* configuration */
ftp->direction = 0; /* recv */
ftp->closestream = 1; /* do close */
if ((ret = ftp_async_get(ftp, outstream, remote, xtype, resumepos)) == PHP_FTP_FAILED || php_stream_error(outstream)) {
php_stream_close(outstream);
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
RETURN_LONG(PHP_FTP_FAILED);
}
if (ret == PHP_FTP_FINISHED) {
php_stream_close(outstream);
}
RETURN_LONG(ret);
}
/* }}} */
/* {{{ proto int ftp_async_continue(resource stream)
Continues retrieving/sending a file asyncronously */
PHP_FUNCTION(ftp_async_continue)
{
zval *z_ftp;
ftpbuf_t *ftp;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
if (!ftp->async) {
php_error(E_WARNING, "%s(): no asyncronous transfer to continue.", get_active_function_name(TSRMLS_C));
RETURN_LONG(PHP_FTP_FAILED);
}
if (ftp->direction) {
ret=ftp_async_continue_write(ftp);
} else {
ret=ftp_async_continue_read(ftp);
}
if (ret != PHP_FTP_MOREDATA && ftp->closestream) {
php_stream_close(ftp->stream);
}
if (ret == PHP_FTP_FAILED || php_stream_error(ftp->stream)) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
}
RETURN_LONG(ret);
}
/* }}} */
/* {{{ proto bool ftp_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])
Stores a file from an open file to the FTP server */
PHP_FUNCTION(ftp_fput)
{
zval *z_ftp, *z_file;
ftpbuf_t *ftp;
ftptype_t xtype;
int mode, remote_len;
int mode, remote_len, startpos=0;
php_stream *stream;
char *remote;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl", &z_ftp, &remote, &remote_len, &z_file, &mode) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
return;
}
@@ -520,7 +701,25 @@ PHP_FUNCTION(ftp_fput)
ZEND_FETCH_RESOURCE(stream, php_stream*, &z_file, -1, "File-Handle", php_file_le_stream());
XTYPE(xtype, mode);
if (!ftp_put(ftp, remote, stream, xtype)) {
/* ignore autoresume if autoseek is switched off */
if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
startpos = 0;
}
if (ftp->autoseek && startpos) {
/* if autoresume is wanted ask for remote size */
if (startpos == PHP_FTP_AUTORESUME) {
startpos = ftp_size(ftp, remote);
if (startpos < 0) {
startpos = 0;
}
}
if (startpos) {
php_stream_seek(stream, startpos, SEEK_SET);
}
}
if (!ftp_put(ftp, remote, stream, xtype, startpos)) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
RETURN_FALSE;
}
@@ -529,7 +728,58 @@ PHP_FUNCTION(ftp_fput)
}
/* }}} */
/* {{{ proto bool ftp_put(resource stream, string remote_file, string local_file, int mode)
/* {{{ proto bool ftp_async_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])
Stores a file from an open file to the FTP server asyncronly */
PHP_FUNCTION(ftp_async_fput)
{
zval *z_ftp, *z_file;
ftpbuf_t *ftp;
ftptype_t xtype;
int mode, remote_len, startpos=0, ret;
php_stream *stream;
char *remote;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
ZEND_FETCH_RESOURCE(stream, php_stream*, &z_file, -1, "File-Handle", php_file_le_stream());
XTYPE(xtype, mode);
/* ignore autoresume if autoseek is switched off */
if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
startpos = 0;
}
if (ftp->autoseek && startpos) {
/* if autoresume is wanted ask for remote size */
if (startpos == PHP_FTP_AUTORESUME) {
startpos = ftp_size(ftp, remote);
if (startpos < 0) {
startpos = 0;
}
}
if (startpos) {
php_stream_seek(stream, startpos, SEEK_SET);
}
}
/* configuration */
ftp->direction = 1; /* send */
ftp->closestream = 0; /* do not close */
if (((ret = ftp_async_put(ftp, remote, stream, xtype, startpos)) == PHP_FTP_FAILED) || php_stream_error(stream)) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
RETURN_LONG(ret);
}
RETURN_LONG(ret);
}
/* }}} */
/* {{{ proto bool ftp_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
Stores a file on the FTP server */
PHP_FUNCTION(ftp_put)
{
@@ -537,13 +787,13 @@ PHP_FUNCTION(ftp_put)
ftpbuf_t *ftp;
ftptype_t xtype;
char *remote, *local;
int remote_len, local_len, mode;
int remote_len, local_len, mode, startpos=0, ret;
php_stream * instream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl", &z_ftp, &remote, &remote_len, &local, &local_len, &mode) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode);
@@ -553,7 +803,25 @@ PHP_FUNCTION(ftp_put)
RETURN_FALSE;
}
if (!ftp_put(ftp, remote, instream, xtype) || php_stream_error(instream)) {
/* ignore autoresume if autoseek is switched off */
if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
startpos = 0;
}
if (ftp->autoseek && startpos) {
/* if autoresume is wanted ask for remote size */
if (startpos == PHP_FTP_AUTORESUME) {
startpos = ftp_size(ftp, remote);
if (startpos < 0) {
startpos = 0;
}
}
if (startpos) {
php_stream_seek(instream, startpos, SEEK_SET);
}
}
if (!ftp_put(ftp, remote, instream, xtype, startpos) || php_stream_error(instream)) {
php_stream_close(instream);
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
RETURN_FALSE;
@@ -564,6 +832,67 @@ PHP_FUNCTION(ftp_put)
}
/* }}} */
/* {{{ proto bool ftp_async_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
Stores a file on the FTP server */
PHP_FUNCTION(ftp_async_put)
{
zval *z_ftp;
ftpbuf_t *ftp;
ftptype_t xtype;
char *remote, *local;
int remote_len, local_len, mode, startpos=0, ret;
php_stream * instream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode);
instream = php_stream_fopen(local, "rb", NULL);
if (instream == NULL) {
RETURN_FALSE;
}
/* ignore autoresume if autoseek is switched off */
if (!ftp->autoseek && startpos == PHP_FTP_AUTORESUME) {
startpos = 0;
}
if (ftp->autoseek && startpos) {
/* if autoresume is wanted ask for remote size */
if (startpos == PHP_FTP_AUTORESUME) {
startpos = ftp_size(ftp, remote);
if (startpos < 0) {
startpos = 0;
}
}
if (startpos) {
php_stream_seek(instream, startpos, SEEK_SET);
}
}
/* configuration */
ftp->direction = 1; /* send */
ftp->closestream = 1; /* do close */
ret = ftp_async_put(ftp, remote, instream, xtype, startpos);
if (ret != PHP_FTP_MOREDATA) {
php_stream_close(instream);
}
if (ret == PHP_FTP_FAILED || php_stream_error(instream)) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ftp->inbuf);
}
RETURN_LONG(ret);
}
/* }}} */
/* {{{ proto int ftp_size(resource stream, string filename)
Returns the size of the file, or -1 on error */
PHP_FUNCTION(ftp_size)
@@ -692,10 +1021,10 @@ PHP_FUNCTION(ftp_close)
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
zend_list_delete(Z_LVAL_P(z_ftp));
RETURN_BOOL(zend_list_delete(Z_LVAL_P(z_ftp)) == SUCCESS);
}
/* }}} */
/* {{{ proto bool ftp_set_option(resource stream, int option, mixed value)
Sets an FTP option */
PHP_FUNCTION(ftp_set_option)
@@ -703,7 +1032,7 @@ PHP_FUNCTION(ftp_set_option)
zval *z_ftp, *z_value;
long option;
ftpbuf_t *ftp;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_ftp, &option, &z_value) == FAILURE) {
return;
}
@@ -713,20 +1042,29 @@ PHP_FUNCTION(ftp_set_option)
switch (option) {
case PHP_FTP_OPT_TIMEOUT_SEC:
if (Z_TYPE_P(z_value) != IS_LONG) {
php_error(E_WARNING, "%s(): option TIMEOUT_SEC expects value of type long, %s given",
php_error(E_WARNING, "%s(): Option TIMEOUT_SEC expects value of type long, %s given",
get_active_function_name(TSRMLS_C), zend_zval_type_name(z_value));
RETURN_FALSE;
}
if (Z_LVAL_P(z_value) <= 0) {
php_error(E_WARNING, "%s(): timeout has to be greater than 0",
php_error(E_WARNING, "%s(): Timeout has to be greater than 0",
get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
ftp->timeout_sec = Z_LVAL_P(z_value);
RETURN_TRUE;
break;
case PHP_FTP_OPT_AUTOSEEK:
if (Z_TYPE_P(z_value) != IS_BOOL) {
php_error(E_WARNING, "%s(): Option AUTOSEEK expects value of type boolean, %s given",
get_active_function_name(TSRMLS_C), zend_zval_type_name(z_value));
RETURN_FALSE;
}
ftp->autoseek = Z_LVAL_P(z_value);
RETURN_TRUE;
break;
default:
php_error(E_WARNING, "%s(): unknown option '%d'", get_active_function_name(TSRMLS_C), option);
php_error(E_WARNING, "%s(): Unknown option '%d'", get_active_function_name(TSRMLS_C), option);
RETURN_FALSE;
break;
}
@@ -740,7 +1078,7 @@ PHP_FUNCTION(ftp_get_option)
zval *z_ftp;
long option;
ftpbuf_t *ftp;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_ftp, &option) == FAILURE) {
return;
}
@@ -751,8 +1089,10 @@ PHP_FUNCTION(ftp_get_option)
case PHP_FTP_OPT_TIMEOUT_SEC:
RETURN_LONG(ftp->timeout_sec);
break;
case PHP_FTP_OPT_AUTOSEEK:
RETURN_BOOL(ftp->autoseek);
default:
php_error(E_WARNING, "%s(): unknown option '%d'", get_active_function_name(TSRMLS_C), option);
php_error(E_WARNING, "%s(): Unknown option '%d'", get_active_function_name(TSRMLS_C), option);
RETURN_FALSE;
break;
}
+9 -1
View File
@@ -12,7 +12,8 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Andrew Skalski <askalski@chek.com> |
| Authors: Andrew Skalski <askalski@chek.com> |
| Stefan Esser <sesser@php.net> (resume functions) |
+----------------------------------------------------------------------+
*/
@@ -27,6 +28,8 @@ extern zend_module_entry php_ftp_module_entry;
#define php_ftp_module_ptr &php_ftp_module_entry
#define PHP_FTP_OPT_TIMEOUT_SEC 0
#define PHP_FTP_OPT_AUTOSEEK 1
#define PHP_FTP_AUTORESUME -1
PHP_MINIT_FUNCTION(ftp);
PHP_MINFO_FUNCTION(ftp);
@@ -55,6 +58,11 @@ PHP_FUNCTION(ftp_site);
PHP_FUNCTION(ftp_close);
PHP_FUNCTION(ftp_set_option);
PHP_FUNCTION(ftp_get_option);
PHP_FUNCTION(ftp_async_get);
PHP_FUNCTION(ftp_async_fget);
PHP_FUNCTION(ftp_async_put);
PHP_FUNCTION(ftp_async_fput);
PHP_FUNCTION(ftp_async_continue);
#define phpext_ftp_ptr php_ftp_module_ptr
+27 -16
View File
@@ -18,11 +18,11 @@ PHP_ARG_WITH(png-dir, for the location of libpng,
PHP_ARG_WITH(xpm-dir, for the location of libXpm,
[ --with-xpm-dir=DIR GD: Set the path to libXpm install prefix.])
PHP_ARG_WITH(ttf,for FreeType 1.x support,
PHP_ARG_WITH(ttf, for FreeType 1.x support,
[ --with-ttf[=DIR] GD: Include FreeType 1.x support])
PHP_ARG_WITH(freetype-dir, for freetype(2),
[ --with-freetype-dir=DIR GD: Set the path to freetype2 install prefix.])
PHP_ARG_WITH(freetype-dir, for FreeType 2,
[ --with-freetype-dir=DIR GD: Set the path to FreeType 2 install prefix.])
PHP_ARG_WITH(t1lib, for T1lib support,
[ --with-t1lib[=DIR] GD: Include T1lib support.])
@@ -129,6 +129,10 @@ AC_DEFUN(PHP_GD_FREETYPE1,[
TTF_DIR=$i
TTF_INC_DIR=$i/include/freetype
fi
if test -f "$i/include/freetype1/freetype/freetype.h"; then
TTF_DIR=$i
TTF_INC_DIR=$i/include/freetype1/freetype
fi
done
fi
if test -n "$TTF_DIR" ; then
@@ -183,7 +187,7 @@ AC_DEFUN(PHP_GD_T1LIB,[
[
AC_DEFINE(HAVE_LIBT1,1,[ ])
PHP_ADD_INCLUDE($GD_T1_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(t1, "$GD_T1_DIR/lib", GD_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(t1, $GD_T1_DIR/lib, GD_SHARED_LIBADD)
],[
AC_MSG_ERROR([Problem with libt1.(a|so). Please check config.log for more information.])
],[
@@ -210,6 +214,7 @@ AC_DEFUN(PHP_GD_CHECK_VERSION,[
PHP_CHECK_LIBRARY(gd, gdImageCreateFromGd2, [AC_DEFINE(HAVE_GD_GD2, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageEllipse, [AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageStringTTF, [AC_DEFINE(HAVE_GD_STRINGTTF, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_STRINGFT, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
@@ -232,8 +237,7 @@ if test "$PHP_GD" = "php"; then
libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \
libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c"
PHP_NEW_EXTENSION(gd, gd.c gdt1.c $sources, $ext_shared,, \\$(GDLIB_CFLAGS))
PHP_ADD_INCLUDE($ext_srcdir/libgd)
PHP_NEW_EXTENSION(gd, gd.c gdttf.c $sources, $ext_shared,, \\$(GDLIB_CFLAGS))
PHP_ADD_BUILD_DIR($ext_builddir/libgd)
dnl PNG is required by GD library
@@ -263,7 +267,8 @@ dnl These are always available with bundled library
AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ])
GDLIB_CFLAGS="-DHAVE_LIBPNG"
dnl Make sure the libgd/ is first in the include path
GDLIB_CFLAGS="-I$ext_srcdir/libgd -DHAVE_LIBPNG"
dnl Depending which libraries were included to PHP configure,
dnl enable the support in bundled GD library
@@ -284,13 +289,17 @@ dnl enable the support in bundled GD library
GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE"
fi
if test -n "$TTF_DIR"; then
GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBTTF"
fi
PHP_SUBST(GDLIB_CFLAGS)
else
if test "$PHP_GD" != "no"; then
PHP_NEW_EXTENSION(gd, gd.c gdcache.c gdttf.c gdt1.c, $ext_shared)
PHP_NEW_EXTENSION(gd, gd.c gdcache.c gdttf.c, $ext_shared)
PHP_SUBST(GD_SHARED_LIBADD)
dnl Various checks for GD features
@@ -318,14 +327,6 @@ dnl Various checks for GD features
done
done
if test -n "$GD_INCLUDE" -a -n "$GD_LIB" ; then
PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
AC_DEFINE(HAVE_LIBGD,1,[ ])
PHP_GD_CHECK_VERSION
else
AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $GD_SEARCH_PATHS])
fi
dnl NetBSD package structure
if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
GD_INCLUDE=/usr/pkg/include/gd
@@ -336,6 +337,16 @@ dnl SuSE 6.x package structure
GD_INCLUDE=/usr/include/gd
fi
if test -n "$GD_INCLUDE" -a -n "$GD_LIB" ; then
PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
AC_DEFINE(HAVE_LIBGD,1,[ ])
PHP_GD_CHECK_VERSION
elif test -z "$GD_INCLUDE"; then
AC_MSG_ERROR([Unable to find gd.h anywhere under $GD_SEARCH_PATHS])
else
AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $GD_SEARCH_PATHS])
fi
PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
PHP_ADD_INCLUDE($GD_INCLUDE)
+172 -322
View File
File diff suppressed because it is too large. Load diff
-8
View File
@@ -168,10 +168,6 @@ SOURCE=.\gdcache.c
# End Source File
# Begin Source File
SOURCE=.\gdt1.c
# End Source File
# Begin Source File
SOURCE=.\gdttf.c
# End Source File
# End Group
@@ -184,10 +180,6 @@ SOURCE=.\gdcache.h
# End Source File
# Begin Source File
SOURCE=.\gdt1.h
# End Source File
# Begin Source File
SOURCE=.\gdttf.h
# End Source File
# Begin Source File
-8
View File
@@ -102,10 +102,6 @@ SOURCE=.\gd.c
# End Source File
# Begin Source File
SOURCE=.\gdt1.c
# End Source File
# Begin Source File
SOURCE=.\gdttf.c
# End Source File
# End Group
@@ -118,10 +114,6 @@ SOURCE=.\gdcache.h
# End Source File
# Begin Source File
SOURCE=.\gdt1.h
# End Source File
# Begin Source File
SOURCE=.\gdttf.h
# End Source File
# Begin Source File
+3 -3
View File
@@ -52,13 +52,13 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) {
if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) {
php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(TSRMLS_C), fn);
php_error(E_WARNING, "%s(): Invalid filename '%s'", get_active_function_name(TSRMLS_C), fn);
RETURN_FALSE;
}
fp = VCWD_FOPEN(fn, "wb");
if (!fp) {
php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn);
php_error(E_WARNING, "%s(): Unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn);
RETURN_FALSE;
}
@@ -79,7 +79,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
switch(image_type) {
case PHP_GDIMG_CONVERT_WBM:
if(q<0||q>255) {
php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(TSRMLS_C), q);
php_error(E_WARNING, "%s(): Invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(TSRMLS_C), q);
}
case PHP_GDIMG_TYPE_JPG:
(*func_p)(im, ctx, q);
-548
View File
@@ -1,548 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Jouni Ahto <jah@mork.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#if 0 /* Moved currently back to gd.c */
#include "php.h"
#include "php_gd.h"
#if HAVE_LIBT1
void php_free_ps_font(int font_id)
{
T1_DeleteFont(font_id);
}
void php_free_ps_enc(char **enc)
{
T1_DeleteEncoding(enc);
}
/* {{{ proto int imagepsloadfont(string pathname)
Load a new font from specified file */
PHP_FUNCTION(imagepsloadfont)
{
zval **file;
int f_ind, l_ind;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(file);
f_ind = T1_AddFont(Z_STRVAL_PP(file));
if (f_ind < 0) {
switch (f_ind) {
case -1:
php_error(E_WARNING, "Couldn't find the font file");
RETURN_FALSE;
break;
case -2:
case -3:
php_error(E_WARNING, "Memory allocation fault in t1lib");
RETURN_FALSE;
break;
default:
php_error(E_WARNING, "An unknown error occurred in t1lib");
RETURN_FALSE;
break;
}
}
T1_LoadFont(f_ind);
/*
l_ind = zend_list_insert(f_ind, T1_GLOBAL(le_ps_font));
RETURN_LONG(l_ind);
*/
zend_list_addref(f_ind);
RETURN_LONG(f_ind);
}
/* }}} */
/* {{{ The function in t1lib which this function uses seem to be buggy...
proto int imagepscopyfont(int font_index)
Make a copy of a font for purposes like extending or reenconding */
/*
PHP_FUNCTION(imagepscopyfont)
{
pval *fnt;
int l_ind, type;
gd_ps_font *nf_ind, *of_ind;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &fnt) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(fnt);
of_ind = zend_list_find(Z_LVAL_P(fnt), &type);
if (type != GD_GLOBAL(le_ps_font)) {
php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_P(fnt));
RETURN_FALSE;
}
nf_ind = emalloc(sizeof(gd_ps_font));
nf_ind->font_id = T1_CopyFont(of_ind->font_id);
if (nf_ind->font_id < 0) {
l_ind = nf_ind->font_id;
efree(nf_ind);
switch (l_ind) {
case -1:
php_error(E_WARNING, "FontID %d is not loaded in memory", l_ind);
RETURN_FALSE;
break;
case -2:
php_error(E_WARNING, "Tried to copy a logical font");
RETURN_FALSE;
break;
case -3:
php_error(E_WARNING, "Memory allocation fault in t1lib");
RETURN_FALSE;
break;
default:
php_error(E_WARNING, "An unknown error occurred in t1lib");
RETURN_FALSE;
break;
}
}
nf_ind->extend = 1;
l_ind = zend_list_insert(nf_ind, GD_GLOBAL(le_ps_font));
RETURN_LONG(l_ind);
}
*/
/* }}} */
/* {{{ proto bool imagepsfreefont(int font_index)
Free memory used by a font */
PHP_FUNCTION(imagepsfreefont)
{
zval **fnt;
int type;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fnt) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(fnt);
zend_list_find(Z_LVAL_PP(fnt), &type);
if (type != T1_GLOBAL(le_ps_font)) {
php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt));
RETURN_FALSE;
}
zend_list_delete(Z_LVAL_PP(fnt));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool imagepsencodefont(int font_index, string filename)
To change a fonts character encoding vector */
PHP_FUNCTION(imagepsencodefont)
{
zval **fnt, **enc;
char **enc_vector;
int type;
int f_ind;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &enc) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(fnt);
convert_to_string_ex(enc);
f_ind = zend_list_find(Z_LVAL_PP(fnt), &type);
if (type != T1_GLOBAL(le_ps_font)) {
php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt));
RETURN_FALSE;
}
if ((enc_vector = T1_LoadEncoding(Z_STRVAL_PP(enc))) == NULL) {
php_error(E_WARNING, "Couldn't load encoding vector from %s", Z_STRVAL_PP(enc));
RETURN_FALSE;
}
T1_DeleteAllSizes(f_ind);
if (T1_ReencodeFont(f_ind, enc_vector)) {
T1_DeleteEncoding(enc_vector);
php_error(E_WARNING, "Couldn't reencode font");
RETURN_FALSE;
}
zend_list_insert(enc_vector, T1_GLOBAL(le_ps_enc));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool imagepsextendfont(int font_index, float extend)
Extend or or condense (if extend < 1) a font */
PHP_FUNCTION(imagepsextendfont)
{
zval **fnt, **ext;
int type;
int f_ind;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &ext) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(fnt);
convert_to_double_ex(ext);
f_ind = zend_list_find(Z_LVAL_PP(fnt), &type);
if (type != T1_GLOBAL(le_ps_font)) {
php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt));
RETURN_FALSE;
}
if (T1_ExtendFont(f_ind, Z_DVAL_PP(ext)) != 0) RETURN_FALSE;
/*
f_ind->extend = Z_DVAL_P(ext);
*/
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool imagepsslantfont(int font_index, float slant)
Slant a font */
PHP_FUNCTION(imagepsslantfont)
{
zval **fnt, **slt;
int type;
int f_ind;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &slt) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(fnt);
convert_to_double_ex(slt);
f_ind = zend_list_find(Z_LVAL_PP(fnt), &type);
if (type != T1_GLOBAL(le_ps_font)) {
php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt));
RETURN_FALSE;
}
if (T1_SlantFont(f_ind, Z_DVAL_PP(slt)) != 0) RETURN_FALSE;
RETURN_TRUE;
}
/* }}} */
/* {{{ proto array imagepstext(int image, string text, int font, int size, int xcoord, int ycoord [, int space, int tightness, float angle, int antialias])
Rasterize a string over an image */
PHP_FUNCTION(imagepstext)
{
zval **img, **str, **fnt, **sz, **fg, **bg, **sp, **px, **py, **aas, **wd, **ang;
int i, j, x, y;
int space, type;
int f_ind;
int h_lines, v_lines, c_ind;
int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl;
int aa[16], aa_steps;
int width, amount_kern, add_width;
double angle;
unsigned long aa_greys[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
gdImagePtr bg_img;
GLYPH *str_img;
T1_OUTLINE *char_path, *str_path;
T1_TMATRIX *transform = NULL;
switch(ZEND_NUM_ARGS()) {
case 8:
if (zend_get_parameters_ex(8, &img, &str, &fnt, &sz, &fg, &bg, &px, &py) == FAILURE) {
RETURN_FALSE;
}
convert_to_string_ex(str);
convert_to_long_ex(fnt);
convert_to_long_ex(sz);
convert_to_long_ex(fg);
convert_to_long_ex(bg);
convert_to_long_ex(px);
convert_to_long_ex(py);
x = Z_LVAL_PP(px);
y = Z_LVAL_PP(py);
space = 0;
aa_steps = 4;
width = 0;
angle = 0;
break;
case 12:
if (zend_get_parameters_ex(12, &img, &str, &fnt, &sz, &fg, &bg, &px, &py, &sp, &wd, &ang, &aas) == FAILURE) {
RETURN_FALSE;
}
convert_to_string_ex(str);
convert_to_long_ex(fnt);
convert_to_long_ex(sz);
convert_to_long_ex(sp);
convert_to_long_ex(fg);
convert_to_long_ex(bg);
convert_to_long_ex(px);
convert_to_long_ex(py);
x = Z_LVAL_PP(px);
y = Z_LVAL_PP(py);
convert_to_long_ex(sp);
space = Z_LVAL_PP(sp);
convert_to_long_ex(aas);
aa_steps = Z_LVAL_PP(aas);
convert_to_long_ex(wd);
width = Z_LVAL_PP(wd);
convert_to_double_ex(ang);
angle = Z_DVAL_PP(ang);
break;
default:
WRONG_PARAM_COUNT;
}
bg_img = zend_list_find(Z_LVAL_PP(img), &type);
if (!bg_img || type != GD_GLOBAL(le_gd)) {
php_error(E_WARNING, "Unable to find image pointer");
RETURN_FALSE;
}
f_ind = zend_list_find(Z_LVAL_P(fnt), &type);
if (!f_ind || type != GD_GLOBAL(le_ps_font)) {
php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_P(fnt));
RETURN_FALSE;
}
fg_rd = gdImageRed(bg_img, Z_LVAL_P(fg));
fg_gr = gdImageGreen(bg_img, Z_LVAL_P(fg));
fg_bl = gdImageBlue(bg_img, Z_LVAL_P(fg));
bg_rd = gdImageRed(bg_img, Z_LVAL_P(bg));
bg_gr = gdImageGreen(bg_img, Z_LVAL_P(bg));
bg_bl = gdImageBlue(bg_img, Z_LVAL_P(bg));
for (i = 0; i < aa_steps; i++) {
rd = bg_rd+(double)(fg_rd-bg_rd)/aa_steps*(i+1);
gr = bg_gr+(double)(fg_gr-bg_gr)/aa_steps*(i+1);
bl = bg_bl+(double)(fg_bl-bg_bl)/aa_steps*(i+1);
aa[i] = gdImageColorResolve(bg_img, rd, gr, bl);
}
T1_AASetBitsPerPixel(8);
switch (aa_steps) {
case 4:
T1_AASetGrayValues(0, 1, 2, 3, 4);
T1_AASetLevel(T1_AA_LOW);
break;
case 16:
T1_AAHSetGrayValues(aa_greys);
T1_AASetLevel(T1_AA_HIGH);
break;
default:
php_error(E_WARNING, "Invalid value %d as number of steps for antialiasing", aa_steps);
RETURN_FALSE;
}
if (angle) {
transform = T1_RotateMatrix(NULL, angle);
}
if (width) {
#ifdef HAVE_LIBT1_OUTLINE
str_path = T1_GetCharOutline(f_ind->font_id, Z_STRVAL_P(str)[0], Z_LVAL_P(sz), transform);
for (i = 1; i < Z_STRLEN_P(str); i++) {
amount_kern = (int) T1_GetKerning(f_ind->font_id, Z_STRVAL_P(str)[i-1], Z_STRVAL_P(str)[i]);
amount_kern += Z_STRVAL_P(str)[i-1] == ' ' ? space : 0;
add_width = (int) (amount_kern+width)/f_ind->extend;
char_path = T1_GetMoveOutline(f_ind->font_id, add_width, 0, 0, Z_LVAL_P(sz), transform);
str_path = T1_ConcatOutlines(str_path, char_path);
char_path = T1_GetCharOutline(f_ind->font_id, Z_STRVAL_P(str)[i], Z_LVAL_P(sz), transform);
str_path = T1_ConcatOutlines(str_path, char_path);
}
str_img = T1_AAFillOutline(str_path, 0);
#else
php_error(E_WARNING, "Setting space between characters in function ImagePSText is supported only with t1lib version 0.9 or above");
RETURN_FALSE;
#endif
} else {
str_img = T1_AASetString(f_ind->font_id, Z_STRVAL_P(str), Z_STRLEN_P(str),
space, T1_KERNING, Z_LVAL_P(sz), transform);
}
if (T1_errno) RETURN_FALSE;
h_lines = str_img->metrics.ascent - str_img->metrics.descent;
v_lines = str_img->metrics.rightSideBearing - str_img->metrics.leftSideBearing;
for (i = 0; i < v_lines; i++) {
for (j = 0; j < h_lines; j++) {
switch (str_img->bits[j*v_lines+i]) {
case 0:
break;
default:
c_ind = aa[str_img->bits[j*v_lines+i]-1];
gdImageSetPixel(bg_img, x+str_img->metrics.leftSideBearing+i, y-str_img->metrics.ascent+j, c_ind);
}
}
}
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
add_next_index_long(return_value, str_img->metrics.leftSideBearing);
add_next_index_long(return_value, str_img->metrics.descent);
add_next_index_long(return_value, str_img->metrics.rightSideBearing);
add_next_index_long(return_value, str_img->metrics.ascent);
}
/* }}} */
/* {{{ proto array imagepsbbox(string text, int font, int size [, int space, int tightness, int angle])
Return the bounding box needed by a string if rasterized */
PHP_FUNCTION(imagepsbbox)
{
pval *str, *fnt, *sz, *sp, *wd, *ang;
int i, space, add_width, char_width, amount_kern, type;
int cur_x, cur_y, dx, dy;
int x1, y1, x2, y2, x3, y3, x4, y4;
gd_ps_font *f_ind;
int per_char = 0;
double angle, sin_a, cos_a;
BBox char_bbox, str_bbox = {0, 0, 0, 0};
switch(ZEND_NUM_ARGS()) {
case 3:
if (zend_get_parameters(ht, 3, &str, &fnt, &sz) == FAILURE) {
RETURN_FALSE;
}
convert_to_string(str);
convert_to_long(fnt);
convert_to_long(sz);
space = 0;
break;
case 6:
if (zend_get_parameters(ht, 6, &str, &fnt, &sz, &sp, &wd, &ang) == FAILURE) {
RETURN_FALSE;
}
convert_to_string(str);
convert_to_long(fnt);
convert_to_long(sz);
convert_to_long(sp);
space = Z_LVAL_P(sp);
convert_to_long(wd);
add_width = Z_LVAL_P(wd);
convert_to_double(ang);
angle = Z_DVAL_P(ang) * M_PI / 180;
sin_a = sin(angle);
cos_a = cos(angle);
per_char = add_width || angle ? 1 : 0;
break;
default:
WRONG_PARAM_COUNT;
}
f_ind = zend_list_find(Z_LVAL_P(fnt), &type);
if (type != GD_GLOBAL(le_ps_font)) {
php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_P(fnt));
RETURN_FALSE;
}
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define new_x(a, b) (int) ((a) * cos_a - (b) * sin_a)
#define new_y(a, b) (int) ((a) * sin_a + (b) * cos_a)
if (per_char) {
space += T1_GetCharWidth(f_ind->font_id, ' ');
cur_x = cur_y = 0;
for (i = 0; i < Z_STRLEN_P(str); i++) {
if (Z_STRVAL_P(str)[i] == ' ') {
char_bbox.llx = char_bbox.lly = char_bbox.ury = 0;
char_bbox.urx = char_width = space;
} else {
char_bbox = T1_GetCharBBox(f_ind->font_id, Z_STRVAL_P(str)[i]);
char_width = T1_GetCharWidth(f_ind->font_id, Z_STRVAL_P(str)[i]);
}
amount_kern = i ? T1_GetKerning(f_ind->font_id, Z_STRVAL_P(str)[i-1], Z_STRVAL_P(str)[i]) : 0;
/* Transfer character bounding box to right place */
x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x;
y1 = new_y(char_bbox.llx, char_bbox.lly) + cur_y;
x2 = new_x(char_bbox.llx, char_bbox.ury) + cur_x;
y2 = new_y(char_bbox.llx, char_bbox.ury) + cur_y;
x3 = new_x(char_bbox.urx, char_bbox.ury) + cur_x;
y3 = new_y(char_bbox.urx, char_bbox.ury) + cur_y;
x4 = new_x(char_bbox.urx, char_bbox.lly) + cur_x;
y4 = new_y(char_bbox.urx, char_bbox.lly) + cur_y;
/* Find min & max values and compare them with current bounding box */
str_bbox.llx = min(str_bbox.llx, min(x1, min(x2, min(x3, x4))));
str_bbox.lly = min(str_bbox.lly, min(y1, min(y2, min(y3, y4))));
str_bbox.urx = max(str_bbox.urx, max(x1, max(x2, max(x3, x4))));
str_bbox.ury = max(str_bbox.ury, max(y1, max(y2, max(y3, y4))));
/* Move to the next base point */
dx = new_x(char_width + add_width + amount_kern, 0);
dy = new_y(char_width + add_width + amount_kern, 0);
cur_x += dx;
cur_y += dy;
/*
printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", x1, y1, x2, y2, x3, y3, x4, y4, char_bbox.llx, char_bbox.lly, char_bbox.urx, char_bbox.ury, char_width, amount_kern, cur_x, cur_y, dx, dy);
*/
}
} else {
str_bbox = T1_GetStringBBox(f_ind->font_id, Z_STRVAL_P(str), Z_STRLEN_P(str), space, T1_KERNING);
}
if (T1_errno) RETURN_FALSE;
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
/*
printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury);
*/
add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*Z_LVAL_P(sz)/1000));
add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*Z_LVAL_P(sz)/1000));
add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*Z_LVAL_P(sz)/1000));
add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*Z_LVAL_P(sz)/1000));
}
/* }}} */
#endif /* HAVE_LIBT1 */
#endif /* 0 */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+4 -4
View File
@@ -509,12 +509,12 @@ tweenColorFetch (char **error, void *key)
is incorporate our knowledge of the percentage of this
pixel that is really "lit" by pushing the alpha value
up toward transparency in edge regions. */
a->tweencolor = gdTrueColorAlpha (
a->tweencolor = gdAlphaBlend(bg, gdTrueColorAlpha (
gdTrueColorGetRed (fg),
gdTrueColorGetGreen (fg),
gdTrueColorGetBlue (fg),
gdAlphaMax - ((gdAlphaMax - gdTrueColorGetAlpha (fg)) * pixel / NUMCOLORS)
);
gdAlphaMax - ((gdAlphaMax - gdTrueColorGetAlpha (fg)) * pixel / NUMCOLORS))
);
}
else
{
@@ -604,7 +604,7 @@ gdft_draw_bitmap (gdImage * im, int fg, FT_Bitmap bitmap, int pen_x, int pen_y)
}
else {
pixel = &im->pixels[y][x];
if (tc_key.pixel == NUMCOLORS)
if (tc_key.pixel == NUMCOLORS && gdTrueColorGetAlpha(fg) ==0)
*pixel = fg;
else {
tc_key.bgcolor = *pixel;
-14
View File
@@ -30,12 +30,6 @@
#if HAVE_LIBGD
#include <gd.h>
#if HAVE_LIBT1
#include "gdt1.h"
#endif
#define PHP_GDIMG_TYPE_GIF 1
#define PHP_GDIMG_TYPE_PNG 2
#define PHP_GDIMG_TYPE_JPG 3
@@ -65,9 +59,6 @@ PHP_MINFO_FUNCTION(gd);
PHP_MINIT_FUNCTION(gd);
PHP_MSHUTDOWN_FUNCTION(gd);
#ifndef HAVE_GDIMAGECOLORRESOLVE
extern int gdImageColorResolve(gdImagePtr, int, int, int);
#endif
PHP_FUNCTION(imagearc);
PHP_FUNCTION(imagechar);
PHP_FUNCTION(imagecharup);
@@ -166,11 +157,6 @@ PHP_FUNCTION(image2wbmp);
PHP_GD_API int phpi_get_le_gd(void);
/* This is missing from gd.h */
#if HAVE_COLORCLOSESTHWB
int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
#endif
#else
#define phpext_gd_ptr NULL
+2 -2
View File
@@ -17,9 +17,9 @@ if test "$PHP_GMP" != "no"; then
AC_MSG_ERROR(Unable to locate gmp.h)
fi
PHP_ADD_INCLUDE($GMP_DIR/include)
PHP_NEW_EXTENSION(gmp, gmp.c, $ext_shared)
AC_DEFINE(HAVE_GMP, 1, [ ])
PHP_ADD_LIBRARY_WITH_PATH(gmp, $GMP_DIR/lib)
PHP_SUBST(GMP_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(gmp, $GMP_DIR/lib, GMP_SHARED_LIBADD)
fi
+159
View File
@@ -0,0 +1,159 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HWAPI_H
#define PHP_HWAPI_H
#ifdef PHP_WIN32
#define PHP_HWAPI_API __declspec(dllexport)
#else
#define PHP_HWAPI_API
#endif
#if HAVE_HWAPI
#ifndef DLEXPORT
#define DLEXPORT
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
extern zend_module_entry hwapi_module_entry;
#define hwapi_module_ptr &hwapi_module_entry
typedef struct {
long default_link;
long default_port;
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
int le_socketp, le_psocketp, le_document;
} zend_hwapi_globals;
#ifdef ZTS
# define HwApiSLS_D zend_hwapi_globals *hwapi_globals
# define HwApiSLS_DC , HwApiSLS_D
# define HwApiSLS_C hwapi_globals
# define HwApiSLS_CC , HwApiSLS_C
# define HwApiSG(v) (hwapi_globals->v)
# define HwApiSLS_FETCH() zend_hwapi_globals *hwapi_globals = ts_resource(hwapi_globals_id)
#else
# define HwApiSLS_D
# define HwApiSLS_DC
# define HwApiSLS_C
# define HwApiSLS_CC
# define HwApiSG(v) (hwapi_globals.v)
# define HwApiSLS_FETCH()
extern PHP_HWAPI_API zend_hwapi_globals hwapi_globals;
#endif
extern PHP_MINIT_FUNCTION(hwapi);
extern PHP_MSHUTDOWN_FUNCTION(hwapi);
extern PHP_RINIT_FUNCTION(hwapi);
PHP_MINFO_FUNCTION(hwapi);
/* HW_API */
PHP_FUNCTION(hwapi_dummy);
PHP_FUNCTION(hwapi_init);
PHP_FUNCTION(hwapi_hgcsp);
PHP_FUNCTION(hwapi_object);
PHP_FUNCTION(hwapi_children);
PHP_FUNCTION(hwapi_mychildren);
PHP_FUNCTION(hwapi_parents);
PHP_FUNCTION(hwapi_find);
PHP_FUNCTION(hwapi_identify);
PHP_FUNCTION(hwapi_remove);
PHP_FUNCTION(hwapi_content);
PHP_FUNCTION(hwapi_copy);
PHP_FUNCTION(hwapi_link);
PHP_FUNCTION(hwapi_move);
PHP_FUNCTION(hwapi_lock);
PHP_FUNCTION(hwapi_unlock);
PHP_FUNCTION(hwapi_replace);
PHP_FUNCTION(hwapi_insert);
PHP_FUNCTION(hwapi_insertdocument);
PHP_FUNCTION(hwapi_insertcollection);
PHP_FUNCTION(hwapi_srcanchors);
PHP_FUNCTION(hwapi_dstanchors);
PHP_FUNCTION(hwapi_objectbyanchor);
PHP_FUNCTION(hwapi_dstofsrcanchor);
PHP_FUNCTION(hwapi_srcsofdst);
PHP_FUNCTION(hwapi_checkin);
PHP_FUNCTION(hwapi_checkout);
PHP_FUNCTION(hwapi_setcommittedversion);
PHP_FUNCTION(hwapi_revert);
PHP_FUNCTION(hwapi_history);
PHP_FUNCTION(hwapi_removeversion);
PHP_FUNCTION(hwapi_freeversion);
PHP_FUNCTION(hwapi_configurationhistory);
PHP_FUNCTION(hwapi_saveconfiguration);
PHP_FUNCTION(hwapi_restoreconfiguration);
PHP_FUNCTION(hwapi_mergeconfiguration);
PHP_FUNCTION(hwapi_removeconfiguration);
PHP_FUNCTION(hwapi_user);
PHP_FUNCTION(hwapi_userlist);
PHP_FUNCTION(hwapi_hwstat);
PHP_FUNCTION(hwapi_dcstat);
PHP_FUNCTION(hwapi_dbstat);
PHP_FUNCTION(hwapi_ftstat);
PHP_FUNCTION(hwapi_info);
/* HW_Object */
PHP_FUNCTION(hwapi_object_new);
PHP_FUNCTION(hwapi_object_count);
PHP_FUNCTION(hwapi_object_title);
PHP_FUNCTION(hwapi_object_attreditable);
PHP_FUNCTION(hwapi_object_assign);
PHP_FUNCTION(hwapi_object_attribute);
PHP_FUNCTION(hwapi_object_insert);
PHP_FUNCTION(hwapi_object_remove);
PHP_FUNCTION(hwapi_object_value);
/* HW_Attribute */
PHP_FUNCTION(hwapi_attribute_new);
PHP_FUNCTION(hwapi_attribute_key);
PHP_FUNCTION(hwapi_attribute_value);
PHP_FUNCTION(hwapi_attribute_values);
PHP_FUNCTION(hwapi_attribute_langdepvalue);
/* HW_Content */
PHP_FUNCTION(hwapi_content_new);
PHP_FUNCTION(hwapi_content_read);
PHP_FUNCTION(hwapi_content_mimetype);
/* HW_Error */
PHP_FUNCTION(hwapi_error_count);
PHP_FUNCTION(hwapi_error_reason);
/* HW_Reason */
PHP_FUNCTION(hwapi_reason_type);
PHP_FUNCTION(hwapi_reason_description);
#else
#define hwapi_module_ptr NULL
#endif /* HAVE_HWAPI */
#define phpext_hwapi_ptr hwapi_module_ptr
#endif /* PHP_HWAPI_H */
+116 -120
View File
@@ -746,7 +746,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if(host) efree(host);
if(password) efree(password);
if(username) efree(username);
php_error(E_ERROR, "Could not get memory for connection details");
php_error(E_ERROR, "%s(): Could not get memory for connection details", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
sprintf(hashed_details, "hw_%s_%d", host, port);
@@ -759,7 +759,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
list_entry new_le;
if (HwSG(max_links)!=-1 && HwSG(num_links)>=HwSG(max_links)) {
php_error(E_ERROR, "Hyperwave: Too many open links (%d)", HwSG(num_links));
php_error(E_ERROR, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), HwSG(num_links));
if(host) efree(host);
if(username) efree(username);
if(password) efree(password);
@@ -767,7 +767,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
RETURN_FALSE;
}
if (HwSG(max_persistent!=-1) && HwSG(num_persistent)>=HwSG(max_persistent)) {
php_error(E_ERROR, "Hyperwave: Too many open persistent links (%d)", HwSG(num_persistent));
php_error(E_ERROR, "%s(): Too many open persistent links (%d)", get_active_function_name(TSRMLS_C), HwSG(num_persistent));
if(host) efree(host);
if(username) efree(username);
if(password) efree(password);
@@ -776,7 +776,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
if ( (sockfd = open_hg_connection(host, port)) < 0 ) {
php_error(E_ERROR, "Could not open connection to %s, Port: %d (retval=%d, errno=%d)", host, port, sockfd, errno);
php_error(E_ERROR, "%s(): Could not open connection to %s, Port: %d (retval=%d, errno=%d)", get_active_function_name(TSRMLS_C), host, port, sockfd, errno);
if(host) efree(host);
if(username) efree(username);
if(password) efree(password);
@@ -785,7 +785,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
if(NULL == (ptr = malloc(sizeof(hw_connection)))) {
php_error(E_ERROR, "Could not get memory for connection structure");
php_error(E_ERROR, "%s(): Could not get memory for connection structure", get_active_function_name(TSRMLS_C));
if(host) efree(host);
if(username) efree(username);
if(password) efree(password);
@@ -794,7 +794,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
if(0 != (ptr->lasterror = initialize_hg_connection(sockfd, &do_swap, &version, &userdata, &server_string, username, password))) {
php_error(E_ERROR, "Could not initalize hyperwave connection");
php_error(E_ERROR, "%s(): Could not initalize hyperwave connection", get_active_function_name(TSRMLS_C));
if(host) efree(host);
if(username) efree(username);
if(password) efree(password);
@@ -819,7 +819,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
Z_TYPE(new_le) = le_psocketp;
if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
php_error(E_ERROR, "Could not hash table with connection details");
php_error(E_ERROR, "%s(): Could not hash table with connection details", get_active_function_name(TSRMLS_C));
if(host) efree(host);
if(username) efree(username);
if(password) efree(password);
@@ -872,7 +872,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
if ( (sockfd = open_hg_connection(host, port)) < 0 ) {
php_error(E_ERROR, "Could not open connection to %s, Port: %d (retval=%d", host, port, sockfd);
php_error(E_ERROR, "%s(): Could not open connection to %s, Port: %d (retval=%d", get_active_function_name(TSRMLS_C), host, port, sockfd);
if(host) efree(host);
if(username) efree(username);
if(password) efree(password);
@@ -889,7 +889,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
if(0 != (ptr->lasterror = initialize_hg_connection(sockfd, &do_swap, &version, &userdata, &server_string, username, password))) {
php_error(E_ERROR, "Could not initalize hyperwave connection");
php_error(E_ERROR, "%s(): Could not initalize hyperwave connection", get_active_function_name(TSRMLS_C));
if(host) efree(host);
if(username) efree(username);
if(password) efree(password);
@@ -916,7 +916,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
Z_TYPE(new_index_ptr) = le_index_ptr;
if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
php_error(E_ERROR, "Could not update connection details in hash table");
php_error(E_ERROR, "%s(): Could not update connection details in hash table", get_active_function_name(TSRMLS_C));
if(host) efree(host);
efree(hashed_details);
RETURN_FALSE;
@@ -982,7 +982,7 @@ PHP_FUNCTION(hw_close)
id=Z_LVAL_PP(arg1);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
zend_list_delete(id);
@@ -1006,7 +1006,7 @@ PHP_FUNCTION(hw_info)
id=Z_LVAL_PP(arg1);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
if(NULL != (str = get_hw_info(ptr))) {
@@ -1038,7 +1038,7 @@ PHP_FUNCTION(hw_error)
id=Z_LVAL_PP(arg1);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
RETURN_LONG(ptr->lasterror);
@@ -1061,7 +1061,7 @@ PHP_FUNCTION(hw_errormsg)
id=Z_LVAL_PP(arg1);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1352,7 +1352,7 @@ char *php_hw_command(INTERNAL_FUNCTION_PARAMETERS, int comm) {
link=Z_LVAL_PP(arg1);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
return NULL;
}
@@ -1519,7 +1519,7 @@ PHP_FUNCTION(hw_dummy)
msgid=Z_LVAL_PP(arg3);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1570,7 +1570,7 @@ PHP_FUNCTION(hw_getobject)
link=Z_LVAL_PP(argv[0]);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -1646,7 +1646,7 @@ PHP_FUNCTION(hw_insertobject)
parms=Z_STRVAL_P(arg3);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -1678,7 +1678,7 @@ PHP_FUNCTION(hw_getandlock)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1710,7 +1710,7 @@ PHP_FUNCTION(hw_unlock)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1739,7 +1739,7 @@ PHP_FUNCTION(hw_deleteobject)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1772,7 +1772,7 @@ PHP_FUNCTION(hw_changeobject)
newobjarr=Z_ARRVAL_P(arg3);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -1875,7 +1875,7 @@ PHP_FUNCTION(hw_modifyobject)
addobjarr=Z_ARRVAL_PP(argv[3]);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2030,7 +2030,7 @@ PHP_FUNCTION(hw_modifyobject)
if (0 == (ptr->lasterror = send_lock(ptr->socket, id))) {
if (0 == (ptr->lasterror = send_changeobject(ptr->socket, id, modification))) {
if (0 != (ptr->lasterror = send_unlock(ptr->socket, id))) {
php_error(E_WARNING, "Aiii, Changeobject failed and couldn't unlock object (id = 0x%X)", id);
php_error(E_WARNING, "%s(): Aiii, Changeobject failed and couldn't unlock object (id = 0x%X)", get_active_function_name(TSRMLS_C), id);
free(modification);
RETURN_FALSE;
}
@@ -2042,7 +2042,7 @@ PHP_FUNCTION(hw_modifyobject)
RETURN_FALSE;
}
} else {
php_error(E_WARNING, "Could not lock object (id = 0x%X)", id);
php_error(E_WARNING, "%s(): Could not lock object (id = 0x%X)", get_active_function_name(TSRMLS_C), id);
free(modification);
RETURN_FALSE;
}
@@ -2061,7 +2061,7 @@ PHP_FUNCTION(hw_modifyobject)
}
break;
default:
php_error(E_WARNING, "hw_modifyobject: Mode must be 0 or 1 (recursive)");
php_error(E_WARNING, "%s(): Mode must be 0 or 1 (recursive)", get_active_function_name(TSRMLS_C));
}
free(modification);
RETURN_TRUE;
@@ -2106,7 +2106,7 @@ void php_hw_mvcp(INTERNAL_FUNCTION_PARAMETERS, int mvcp) {
}
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -2218,7 +2218,7 @@ PHP_FUNCTION(hw_gettext)
id=Z_LVAL_P(argv[1]);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2260,7 +2260,7 @@ PHP_FUNCTION(hw_edittext)
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find socket identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find socket identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -2268,7 +2268,7 @@ PHP_FUNCTION(hw_edittext)
docptr = zend_list_find(doc, &type);
if(!docptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find document identifier %d", doc);
php_error(E_WARNING, "%s(): Unable to find document identifier %d", get_active_function_name(TSRMLS_C), doc);
RETURN_FALSE;
}
@@ -2303,7 +2303,7 @@ PHP_FUNCTION(hw_getcgi)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2365,7 +2365,7 @@ PHP_FUNCTION(hw_getremote)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2406,7 +2406,7 @@ PHP_FUNCTION(hw_getremotechildren)
objrec=Z_STRVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
@@ -2510,7 +2510,7 @@ PHP_FUNCTION(hw_setlinkroot)
rootid = Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -2556,7 +2556,7 @@ PHP_FUNCTION(hw_pipedocument)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -2565,7 +2565,7 @@ PHP_FUNCTION(hw_pipedocument)
convert_to_array(arg3);
prefixarray =Z_ARRVAL_P(arg3);
if((prefixarray == NULL) || (zend_hash_num_elements(prefixarray) != 5)) {
php_error(E_WARNING, "You must provide 5 urlprefixes (you have provided %d)", zend_hash_num_elements(prefixarray));
php_error(E_WARNING, "%s(): You must provide 5 urlprefixes (you have provided %d)", get_active_function_name(TSRMLS_C), zend_hash_num_elements(prefixarray));
RETURN_FALSE;
}
@@ -2580,7 +2580,7 @@ PHP_FUNCTION(hw_pipedocument)
zend_hash_get_current_data(prefixarray, (void *) &dataptr);
data = *dataptr;
if (Z_TYPE_P(data) != IS_STRING) {
php_error(E_WARNING, "%s must be a String", key);
php_error(E_WARNING, "%s(): %s must be a String", get_active_function_name(TSRMLS_C), key);
RETURN_FALSE;
} else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) {
urlprefix[HW_DEFAULT_LINK] = Z_STRVAL_P(data);
@@ -2593,7 +2593,7 @@ PHP_FUNCTION(hw_pipedocument)
} else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) {
urlprefix[HW_APPLET_LINK] = Z_STRVAL_P(data);
} else {
php_error(E_WARNING, "%s is not a valid urlprefix", key);
php_error(E_WARNING, "%s(): %s is not a valid urlprefix", get_active_function_name(TSRMLS_C), key);
RETURN_FALSE;
}
zend_hash_move_forward(prefixarray);
@@ -2669,7 +2669,7 @@ PHP_FUNCTION(hw_oldpipedocument)
id=Z_LVAL_P(argv[1]);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -2730,7 +2730,7 @@ PHP_FUNCTION(hw_pipecgi)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2796,14 +2796,14 @@ PHP_FUNCTION(hw_insertdocument)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find connection identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find connection identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
doc=Z_LVAL_P(arg3);
docptr = zend_list_find(doc, &type);
if(!docptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find document identifier %d", doc);
php_error(E_WARNING, "%s(): Unable to find document identifier %d", get_active_function_name(TSRMLS_C), doc);
RETURN_FALSE;
}
@@ -2863,14 +2863,8 @@ PHP_FUNCTION(hw_new_document)
PHP_FUNCTION(hw_new_document_from_file)
{
pval **arg1, **arg2;
int len, type;
char *ptr;
int issock=0;
int socketd=0;
FILE *fp;
php_stream *stream;
int ready=0;
int bcount=0;
int use_include_path=0;
hw_document *doc;
@@ -2895,13 +2889,16 @@ PHP_FUNCTION(hw_new_document_from_file)
doc->size = php_stream_copy_to_mem(stream, &doc->data, PHP_STREAM_COPY_ALL, 1);
php_stream_close(stream);
doc->data = realloc(doc->data, bcount+1);
/* I'm not sure if it is necessary to add a '\0'. It depends on whether
* PHP-Strings has to be null terminated. doc->size doesn't count the
* '\0'.
*/
doc->data = realloc(doc->data, doc->size+1);
ptr = doc->data;
ptr[bcount] = '\0';
ptr[doc->size] = '\0';
doc->attributes = strdup(Z_STRVAL_PP(arg1));
doc->bodytag = NULL;
doc->size = bcount;
Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
Z_TYPE_P(return_value) = IS_LONG;
}
@@ -2922,7 +2919,7 @@ PHP_FUNCTION(hw_free_document)
id=Z_LVAL_P(arg1);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
zend_list_delete(id);
@@ -2949,7 +2946,7 @@ PHP_FUNCTION(hw_output_document)
id=Z_LVAL_P(arg1);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -2983,7 +2980,7 @@ PHP_FUNCTION(hw_document_bodytag)
id=Z_LVAL_P(argv[0]);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3028,7 +3025,7 @@ PHP_FUNCTION(hw_document_content)
id=Z_LVAL_P(argv[0]);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3057,7 +3054,7 @@ PHP_FUNCTION(hw_document_setcontent)
id=Z_LVAL_P(argv[0]);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3092,7 +3089,7 @@ PHP_FUNCTION(hw_document_size)
id=Z_LVAL_P(arg1);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3119,7 +3116,7 @@ PHP_FUNCTION(hw_document_attributes)
id=Z_LVAL_P(arg1);
ptr = zend_list_find(id, &type);
if(!ptr || (type!=le_document)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3147,14 +3144,14 @@ PHP_FUNCTION(hw_getparentsobj)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getparentsobj(ptr->socket, id, &childObjRecs, &count))) {
php_error(E_WARNING, "send_command (getparentsobj) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3182,7 +3179,7 @@ PHP_FUNCTION(hw_getparents)
id=Z_LVAL_P(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3192,7 +3189,7 @@ PHP_FUNCTION(hw_getparents)
int i;
if (0 != (ptr->lasterror = send_getparents(ptr->socket, id, &childIDs, &count))) {
php_error(E_WARNING, "send_command (getparents) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3228,7 +3225,7 @@ PHP_FUNCTION(hw_children)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3238,7 +3235,7 @@ PHP_FUNCTION(hw_children)
int i;
if (0 != (ptr->lasterror = send_children(ptr->socket, id, &childIDs, &count))){
php_error(E_WARNING, "send_command (getchildcoll) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3275,14 +3272,14 @@ PHP_FUNCTION(hw_childrenobj)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_childrenobj(ptr->socket, id, &childObjRecs, &count))) {
php_error(E_WARNING, "send_command (getchildcollobj) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3310,7 +3307,7 @@ PHP_FUNCTION(hw_getchildcoll)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3320,7 +3317,7 @@ PHP_FUNCTION(hw_getchildcoll)
int i;
if (0 != (ptr->lasterror = send_getchildcoll(ptr->socket, id, &childIDs, &count))){
php_error(E_WARNING, "send_command (getchildcoll) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3357,14 +3354,14 @@ PHP_FUNCTION(hw_getchildcollobj)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getchildcollobj(ptr->socket, id, &childObjRecs, &count))) {
php_error(E_WARNING, "send_command (getchildcollobj) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3391,7 +3388,7 @@ PHP_FUNCTION(hw_docbyanchor)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3423,7 +3420,7 @@ PHP_FUNCTION(hw_docbyanchorobj)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
@@ -3465,13 +3462,13 @@ PHP_FUNCTION(hw_getobjectbyquery)
if (maxhits < 0) maxhits=0x7FFFFFFF;
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getobjbyquery(ptr->socket, query, maxhits, &childIDs, &count))) {
php_error(E_WARNING, "send_command (getobjectbyquery) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3509,13 +3506,13 @@ PHP_FUNCTION(hw_getobjectbyqueryobj)
if (maxhits < 0) maxhits=0x7FFFFFFF;
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getobjbyqueryobj(ptr->socket, query, maxhits, &childObjRecs, &count))) {
php_error(E_WARNING, "send_command (getobjectbyqueryobj) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3550,13 +3547,13 @@ PHP_FUNCTION(hw_getobjectbyquerycoll)
if (maxhits < 0) maxhits=0x7FFFFFFF;
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getobjbyquerycoll(ptr->socket, id, query, maxhits, &childIDs, &count))) {
php_error(E_WARNING, "send_command (getobjectbyquerycoll) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3596,13 +3593,13 @@ PHP_FUNCTION(hw_getobjectbyquerycollobj)
if (maxhits < 0) maxhits=0x7FFFFFFF;
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getobjbyquerycollobj(ptr->socket, id, query, maxhits, &childObjRecs, &count))) {
php_error(E_WARNING, "send_command (getobjectbyquerycollobj) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3636,13 +3633,13 @@ PHP_FUNCTION(hw_getobjectbyftquery)
if (maxhits < 0) maxhits=0x7FFFFFFF;
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getobjbyftquery(ptr->socket, query, maxhits, &childIDs, &weights, &count))) {
php_error(E_WARNING, "send_command (getobjectbyftquery) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3681,13 +3678,13 @@ PHP_FUNCTION(hw_getobjectbyftqueryobj)
if (maxhits < 0) maxhits=0x7FFFFFFF;
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getobjbyftqueryobj(ptr->socket, query, maxhits, &childObjRecs, &weights, &count))) {
php_error(E_WARNING, "send_command (getobjectbyftqueryobj) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3723,13 +3720,13 @@ PHP_FUNCTION(hw_getobjectbyftquerycoll)
if (maxhits < 0) maxhits=0x7FFFFFFF;
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getobjbyftquerycoll(ptr->socket, id, query, maxhits, &childIDs, &weights, &count))) {
php_error(E_WARNING, "send_command (getobjectbyquerycoll) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3770,13 +3767,13 @@ PHP_FUNCTION(hw_getobjectbyftquerycollobj)
if (maxhits < 0) maxhits=0x7FFFFFFF;
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getobjbyftquerycollobj(ptr->socket, id, query, maxhits, &childObjRecs, &weights, &count))) {
php_error(E_WARNING, "send_command (getobjectbyquerycollobj) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3805,13 +3802,13 @@ PHP_FUNCTION(hw_getchilddoccoll)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getchilddoccoll(ptr->socket, id, &childIDs, &count))) {
php_error(E_WARNING, "send_command (getchilddoccoll) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3845,13 +3842,13 @@ PHP_FUNCTION(hw_getchilddoccollobj)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getchilddoccollobj(ptr->socket, id, &childObjRecs, &count))) {
php_error(E_WARNING, "send_command (getchilddoccollobj) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3881,13 +3878,13 @@ PHP_FUNCTION(hw_getanchors)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getanchors(ptr->socket, id, &anchorIDs, &count))) {
php_error(E_WARNING, "send_command (getanchors) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3921,13 +3918,13 @@ PHP_FUNCTION(hw_getanchorsobj)
id=Z_LVAL_PP(arg2);
ptr = (hw_connection *) zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", id);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), id);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getanchorsobj(ptr->socket, id, &anchorObjRecs, &count))) {
php_error(E_WARNING, "send_command (getanchors) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -3952,7 +3949,7 @@ PHP_FUNCTION(hw_getusername)
link = Z_LVAL_PP(arg1);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -3982,7 +3979,7 @@ PHP_FUNCTION(hw_identify)
passwd=Z_STRVAL_PP(arg3);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -3991,7 +3988,7 @@ PHP_FUNCTION(hw_identify)
char *str;
if (0 != (ptr->lasterror = send_identify(ptr->socket, name, passwd, &userdata))) {
php_error(E_WARNING, "send_identify returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d\n", get_active_function_name(TSRMLS_C), ptr->lasterror);
if(ptr->username) free(ptr->username);
ptr->username = NULL;
RETURN_FALSE;
@@ -4079,19 +4076,19 @@ PHP_FUNCTION(hw_incollections)
retcoll=Z_LVAL_PP(arg4);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
cobjids = zend_hash_num_elements(Z_ARRVAL_PP(arg2));
if(NULL == (objectIDs = make_ints_from_array(Z_ARRVAL_PP(arg2)))) {
php_error(E_WARNING, "Could not create Int Array from Array\n");
php_error(E_WARNING, "%s(): Could not create Int Array from Array", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
ccollids = zend_hash_num_elements(Z_ARRVAL_PP(arg3));
if(NULL == (collIDs = make_ints_from_array(Z_ARRVAL_PP(arg3)))) {
php_error(E_WARNING, "Could not create Int Array from Array\n");
php_error(E_WARNING, "%s(): Could not create Int Array from Array", get_active_function_name(TSRMLS_C));
efree(objectIDs);
RETURN_FALSE;
}
@@ -4140,12 +4137,12 @@ PHP_FUNCTION(hw_inscoll)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
if(NULL == (objrec = make_objrec_from_array(Z_ARRVAL_PP(arg3)))) {
php_error(E_WARNING, "Could not create Object Record from Array\n");
php_error(E_WARNING, "%s(): Could not create Object Record from Array", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -4189,7 +4186,7 @@ PHP_FUNCTION(hw_insdoc)
id = Z_LVAL_PP(argv[1]);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
@@ -4222,13 +4219,13 @@ PHP_FUNCTION(hw_getsrcbydestobj)
id=Z_LVAL_PP(arg2);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_getsrcbydest(ptr->socket, id, &childObjRecs, &count))) {
php_error(E_WARNING, "send_command (getsrcbydest) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -4257,13 +4254,13 @@ PHP_FUNCTION(hw_mapid)
id=Z_LVAL_PP(arg3);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = send_mapid(ptr->socket, servid, id, &virtid))) {
php_error(E_WARNING, "send_command (mapid) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
RETURN_LONG(virtid);
@@ -4293,13 +4290,13 @@ PHP_FUNCTION(hw_getrellink)
destid=Z_LVAL_PP(arg4);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
set_swap(ptr->swap_on);
if (0 != (ptr->lasterror = getrellink(ptr->socket, rootid, sourceid, destid, &anchorstr))) {
php_error(E_WARNING, "command (getrellink) returned %d\n", ptr->lasterror);
php_error(E_WARNING, "%s(): Command returned %d", get_active_function_name(TSRMLS_C), ptr->lasterror);
RETURN_FALSE;
}
@@ -4314,7 +4311,6 @@ PHP_FUNCTION(hw_insertanchors)
pval **arg1, **arg2, **arg3, **arg4;
hw_document *hwdoc;
int type, docid, error, argc, count;
char *anchorstr;
char **anchorrecs;
char **dest;
char **urlprefix;
@@ -4343,7 +4339,7 @@ PHP_FUNCTION(hw_insertanchors)
docid=Z_LVAL_PP(arg1);
hwdoc = zend_list_find(docid, &type);
if(!hwdoc || (type!=le_document)) {
php_error(E_WARNING, "Unable to find file identifier %d", docid);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), docid);
RETURN_FALSE;
}
@@ -4353,7 +4349,7 @@ PHP_FUNCTION(hw_insertanchors)
convert_to_array_ex(arg4);
prefixarray =Z_ARRVAL_PP(arg4);
if((prefixarray == NULL) || (zend_hash_num_elements(prefixarray) != 5)) {
php_error(E_WARNING, "You must provide 5 urlprefixes (you have provided %d)", zend_hash_num_elements(prefixarray));
php_error(E_WARNING, "%s(): You must provide 5 urlprefixes (you have provided %d)", get_active_function_name(TSRMLS_C), zend_hash_num_elements(prefixarray));
RETURN_FALSE;
}
@@ -4368,7 +4364,7 @@ PHP_FUNCTION(hw_insertanchors)
zend_hash_get_current_data(prefixarray, (void *) &dataptr);
data = *dataptr;
if (Z_TYPE_P(data) != IS_STRING) {
php_error(E_WARNING, "%s must be a String", key);
php_error(E_WARNING, "%s(): %s must be a String", get_active_function_name(TSRMLS_C), key);
RETURN_FALSE;
} else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) {
urlprefix[HW_DEFAULT_LINK] = Z_STRVAL_P(data);
@@ -4381,7 +4377,7 @@ PHP_FUNCTION(hw_insertanchors)
} else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) {
urlprefix[HW_APPLET_LINK] = Z_STRVAL_P(data);
} else {
php_error(E_WARNING, "%s is not a valid urlprefix", key);
php_error(E_WARNING, "%s(): %s is not a valid urlprefix", get_active_function_name(TSRMLS_C), key);
RETURN_FALSE;
}
zend_hash_move_forward(prefixarray);
@@ -4391,7 +4387,7 @@ PHP_FUNCTION(hw_insertanchors)
}
if(zend_hash_num_elements(Z_ARRVAL_PP(arg2)) != zend_hash_num_elements(Z_ARRVAL_PP(arg3))) {
php_error(E_WARNING, "Unequal number of elments in arrays");
php_error(E_WARNING, "%s(): Unequal number of elements in arrays", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -4402,7 +4398,7 @@ PHP_FUNCTION(hw_insertanchors)
dest = make_strs_from_array(arrht);
if (0 != (error = send_insertanchors(&(hwdoc->data), &count, anchorrecs, dest, zend_hash_num_elements(arrht), urlprefix, &bodytag))) {
php_error(E_WARNING, "command (insertanchors) returned %d\n", error);
php_error(E_WARNING, "%s(): Command returned %d", get_active_function_name(TSRMLS_C), error);
RETURN_FALSE;
}
/*fprintf(stderr, "in hw_insertanchors: %s\n", hwdoc->attributes); */
@@ -4439,7 +4435,7 @@ PHP_FUNCTION(hw_connection_info)
link=Z_LVAL_PP(arg1);
ptr = zend_list_find(link, &type);
if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
php_error(E_WARNING, "Unable to find file identifier %d", link);
php_error(E_WARNING, "%s(): Unable to find file identifier %d", get_active_function_name(TSRMLS_C), link);
RETURN_FALSE;
}
+14 -14
View File
@@ -187,7 +187,7 @@ void php_icap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
icap_stream = cal_open(NULL, Z_STRVAL_P(calendar), 0);
if (!icap_stream) {
php_error(E_WARNING, "Couldn't open stream %s\n", Z_STRVAL_P(calendar));
php_error(E_WARNING, "%s(): Couldn't open stream %s", get_active_function_name(TSRMLS_C), Z_STRVAL_P(calendar));
RETURN_FALSE;
}
@@ -216,7 +216,7 @@ PHP_FUNCTION(icap_close)
ind = Z_LVAL_P(streamind);
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if(myargcount==2) {
@@ -261,7 +261,7 @@ PHP_FUNCTION(icap_reopen)
ind = Z_LVAL_P(streamind);
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -276,7 +276,7 @@ PHP_FUNCTION(icap_reopen)
cal_login(icap_stream, Z_STRVAL_P(calendar));
*/
if (icap_stream == NULL) {
php_error(E_WARNING, "Couldn't re-open stream\n");
php_error(E_WARNING, "%s(): Couldn't re-open stream", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
RETURN_TRUE;
@@ -304,7 +304,7 @@ PHP_FUNCTION(icap_expunge)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -332,7 +332,7 @@ PHP_FUNCTION(icap_fetch_event)
ind = Z_LVAL_P(streamind);
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if(myargcount==3) {
@@ -410,7 +410,7 @@ PHP_FUNCTION(icap_list_events)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -488,7 +488,7 @@ PHP_FUNCTION(icap_create_calendar)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
/*
@@ -524,7 +524,7 @@ PHP_FUNCTION(icap_rename_calendar)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
/*
@@ -562,7 +562,7 @@ PHP_FUNCTION(icap_list_alarms)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -632,7 +632,7 @@ PHP_FUNCTION(icap_delete_calendar)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -667,7 +667,7 @@ PHP_FUNCTION(icap_delete_event)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if (cal_remove(icap_le_struct->icap_stream, Z_LVAL_P(uid)))
@@ -724,7 +724,7 @@ PHP_FUNCTION(icap_store_event)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -869,7 +869,7 @@ PHP_FUNCTION(icap_snooze)
icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
if (!icap_le_struct ) {
php_error(E_WARNING, "Unable to find stream pointer");
php_error(E_WARNING, "%s(): Unable to find stream pointer", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
+35
View File
@@ -8,6 +8,41 @@ PHP_ARG_WITH(iconv, for iconv support,
if test "$PHP_ICONV" != "no"; then
PHP_SETUP_ICONV(ICONV_SHARED_LIBADD, [
AC_MSG_CHECKING([if iconv supports errno])
AC_TRY_RUN([
#define LIBICONV_PLUG
#include <iconv.h>
#include <errno.h>
#if defined(_LIBICONV_H)
#define icv_open(a, b) libiconv_open(a, b)
#define icv_close(a) libiconv_close(a)
#define icv(a, b, c, d, e) libiconv(a, b, c, d, e)
#else
#define icv_open(a, b) iconv_open(a, b)
#define icv_close(a) iconv_close(a)
#define icv(a, b, c, d, e) iconv(a, b, c, d, e)
#endif
int main() {
iconv_t cd;
cd = icv_open( "*blahblah*", "*blahblah*" );
if( cd == (iconv_t)(-1) ) {
if( errno == EINVAL ) {
return 0;
} else {
return 1;
}
}
icv_close( cd );
return 2;
}
],[
AC_MSG_RESULT(yes)
PHP_DEFINE(ICONV_SUPPORTS_ERRNO)
],[
AC_MSG_RESULT(no)
])
PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared)
PHP_SUBST(ICONV_SHARED_LIBADD)
], [
+58 -35
View File
@@ -28,6 +28,7 @@
#ifdef PHP_ATOM_INC
#include "php_have_iconv.h"
#include "php_have_libiconv.h"
#include "php_iconv_supports_errno.h"
#endif
#if HAVE_ICONV
@@ -49,6 +50,7 @@
#if HAVE_LIBICONV
#define LIBICONV_PLUG
#define icv_open(a, b) libiconv_open(a, b)
#define icv_close(a) libiconv_close(a)
#define icv(a, b, c, d, e) libiconv(a, b, c, d, e)
@@ -145,8 +147,7 @@ static int php_iconv_string(const char *in_p, size_t in_len,
char **out, size_t *out_len,
const char *in_charset, const char *out_charset, int *err TSRMLS_DC)
{
#if HAVE_LIBICONV
/* No errno for libiconv(?) */
#if !defined(ICONV_SUPPORTS_ERRNO)
unsigned int in_size, out_size, out_left;
char *out_buffer, *out_p;
iconv_t cd;
@@ -163,9 +164,9 @@ static int php_iconv_string(const char *in_p, size_t in_len,
a single char can be more than 4 bytes.
I added 15 extra bytes for safety. <yohgaki@php.net>
*/
out_size = in_len * sizeof(ucs4_t) + 16;
out_buffer = (char *) emalloc(out_size);
out_size = in_len * sizeof(ucs4_t) + 15;
out_buffer = (char *) emalloc(out_size + 1);
*out = out_buffer;
out_p = out_buffer;
out_left = out_size;
@@ -174,7 +175,7 @@ static int php_iconv_string(const char *in_p, size_t in_len,
if (cd == (iconv_t)(-1)) {
*err = PHP_ICONV_UNKNOWN;
php_error(E_WARNING, "%s(): unknown error, unable to convert from `%s' to `%s'",
php_error(E_WARNING, "%s(): Unknown error, unable to convert from `%s' to `%s'",
get_active_function_name(TSRMLS_C), in_charset, out_charset);
efree(out_buffer);
return FAILURE;
@@ -197,71 +198,78 @@ static int php_iconv_string(const char *in_p, size_t in_len,
#else
/*
libc iconv should support errno. Handle it better way.
iconv supports errno. Handle it better way.
*/
iconv_t cd;
size_t in_left, out_size, out_left;
char *out_p, *out_buf, *tmp_buf;
size_t i, bsz, result;
size_t bsz, result = 0;
*err = 0;
cd = iconv_open(out_charset, in_charset);
cd = icv_open(out_charset, in_charset);
if (cd == (iconv_t)(-1)) {
if (errno == EINVAL) {
*err = PHP_ICONV_WRONG_CHARSET;
php_error(E_NOTICE, "%s() wrong charset, cannot convert from `%s' to `%s'",
php_error(E_NOTICE, "%s(): Wrong charset, cannot convert from `%s' to `%s'",
get_active_function_name(TSRMLS_C), in_charset, out_charset);
}
else {
} else {
*err = PHP_ICONV_CONVERTER;
php_error(E_NOTICE, "%s() cannot open converter",
php_error(E_NOTICE, "%s(): Cannot open converter",
get_active_function_name(TSRMLS_C));
}
return FAILURE;
}
in_left= in_len;
out_left = in_len + 32; /* Avoid realloc() most cases */
out_size = 0;
bsz = out_left;
out_buf = (char *) emalloc(bsz+1);
out_p = out_buf;
result = iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left);
out_size = bsz - out_left;
for (i = 2;in_left > 0 && errno == E2BIG; i++) {
/* converted string is longer than out buffer */
tmp_buf = (char*)erealloc(out_buf, bsz*i+1);
if (tmp_buf == NULL) {
break;
while(in_left > 0) {
result = icv(cd, (const char **)&in_p, &in_left, (char **) &out_p, &out_left);
out_size = bsz - out_left;
if( result == (size_t)(-1) ) {
if( errno == E2BIG && in_left > 0 ) {
/* converted string is longer than out buffer */
bsz += in_len;
tmp_buf = (char*) erealloc(out_buf, bsz+1);
if (tmp_buf != NULL) {
out_p = out_buf = tmp_buf;
out_p += out_size;
out_left = bsz - out_size;
continue;
}
}
}
out_buf = tmp_buf;
out_p = tmp_buf;
out_p += out_size;
out_left = in_len;
result = iconv(cd, (char **)&in_p, &in_left, &out_p, &out_left);
out_size += bsz - out_left;
break;
}
iconv_close(cd);
icv_close(cd);
if (result == (size_t)(-1)) {
switch (errno) {
case EINVAL:
php_error(E_NOTICE, "%s() detected incomplete character in input string",
php_error(E_NOTICE, "%s(): Detected incomplete character in input string",
get_active_function_name(TSRMLS_C));
*err = PHP_ICONV_ILLEGAL_CHAR;
break;
case EILSEQ:
php_error(E_NOTICE, "%s() detected illegal character in input string",
php_error(E_NOTICE, "%s(): Detected illegal character in input string",
get_active_function_name(TSRMLS_C));
*err = PHP_ICONV_ILLEGAL_SEQ;
break;
case E2BIG:
/* should not happen */
php_error(E_WARNING, "%s() run out buffer",
php_error(E_WARNING, "%s(): Run out buffer",
get_active_function_name(TSRMLS_C));
*err = PHP_ICONV_TOO_BIG;
break;
default:
/* other error */
php_error(E_NOTICE, "%s() unknown error (%d)",
php_error(E_NOTICE, "%s(): Unknown error (%d)",
get_active_function_name(TSRMLS_C), errno);
*err = PHP_ICONV_UNKNOWN;
efree(out_buf);
@@ -303,22 +311,37 @@ PHP_NAMED_FUNCTION(php_if_iconv)
Returns str in output buffer converted to the iconv.output_encoding character set */
PHP_FUNCTION(ob_iconv_handler)
{
char *out_buffer;
char *out_buffer, *content_type, *mimetype = NULL, *s;
zval *zv_string;
unsigned int out_len;
int err, status;;
int err, status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &zv_string, &status) == FAILURE)
return;
convert_to_string_ex(&zv_string);
if (SG(sapi_headers).send_default_content_type &&
if (SG(sapi_headers).mimetype &&
strncmp(SG(sapi_headers).mimetype, "text/", 5) == 0) {
if ((s = strchr(SG(sapi_headers).mimetype,';')) == NULL){
mimetype = estrdup(SG(sapi_headers).mimetype);
} else {
mimetype = estrndup(SG(sapi_headers).mimetype, s-SG(sapi_headers).mimetype);
}
} else if (SG(sapi_headers).send_default_content_type) {
mimetype = estrdup(SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE);
}
if (mimetype &&
php_iconv_string(Z_STRVAL_P(zv_string), Z_STRLEN_P(zv_string),
&out_buffer, &out_len,
ICONVG(internal_encoding),
ICONVG(output_encoding),
&err TSRMLS_CC) == SUCCESS) {
spprintf(&content_type, 0, "Content-Type:%s;charset=%s", mimetype, ICONVG(output_encoding));
if (content_type && sapi_add_header(content_type, strlen(content_type), 0) != FAILURE) {
SG(sapi_headers).send_default_content_type = 0;
}
efree(mimetype);
RETVAL_STRINGL(out_buffer, out_len, 0);
} else {
zval_dtor(return_value);
+2 -1
View File
@@ -7,4 +7,5 @@ EUC-JP to ISO-2022-JP
--FILE--
<?php include('eucjp2iso2022jp.inc'); ?>
--EXPECT--
ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0CgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0ChskQkZ8S1w4bCVGJS0lOSVIJEgbKEJFbmdsaXNoIFRleHQKGyRCRnxLXDhsJUYlLSU5JUgkSBsoQkVuZ2xpc2ggVGV4dAobJEJGfEtcOGwlRiUtJTklSCRIGyhCRW5nbGlzaCBUZXh0Cg==
+1 -1
View File
@@ -40,7 +40,7 @@ $str = "
日本語テキストとEnglish Text
";
$str = iconv("EUC-JP", "UTF8", $str);
$str = iconv("EUC-JP", "UTF-8", $str); /* libiconv(1.8) doesn't know "UTF8" but "UTF-8". */
$str = base64_encode($str);
echo $str."\n";
+3 -2
View File
@@ -1,10 +1,11 @@
--TEST--
EUC-JP to UTF8
--SKIPIF--
<?php include('skipif.inc'); ?>
<?php include('skipif.inc');?>
--POST--
--GET--
--FILE--
<?php include('eucjp2utf8.inc'); ?>
--EXPECT--
CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0CuaXpeacrOiqnuODhuOCreOCueODiOOBqEVuZ2xpc2ggVGV4dArml6XmnKzoqp7jg4bjgq3jgrnjg4jjgahFbmdsaXNoIFRleHQK5pel5pys6Kqe44OG44Kt44K544OI44GoRW5nbGlzaCBUZXh0Cg==
+7
View File
@@ -0,0 +1,7 @@
<?php
/* charset=CP932, KOI8-R */
$str = "\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d\x87\x6d";
print iconv( "CP932", "EUC-JP//TRANSLIT", $str );
$str = "(\x9c\xe4\x9c)";
print iconv( "KOI8-R", "EUC-JP//TRANSLIT", $str );
?>
+10
View File
@@ -0,0 +1,10 @@
--TEST--
ICONV: LIBICONV transliteration (bug #16069)
--SKIPIF--
<?php include('skipif.inc'); if( iconv('CP932', 'EUC-JP//TRANSLIT', "\x87\x6d") == '' ) die("skip(no libiconv)\n"); ?>
--POST--
--GET--
--FILE--
<?php include('translit.inc'); ?>
--EXPECT--
ミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバールミリバール(°Д°)
+69 -34
View File
@@ -21,6 +21,40 @@ AC_DEFUN(IMAP_LIB_CHK,[
done
])
dnl PHP_IMAP_TEST_BUILD(action-if-ok, action-if-not-ok [, extra-libs])
AC_DEFUN(PHP_IMAP_TEST_BUILD, [
old_LIBS=$LIBS
LIBS="$3 $LIBS"
AC_TRY_RUN([
void mm_log(void){}
void mm_dlog(void){}
void mm_flags(void){}
void mm_fatal(void){}
void mm_critical(void){}
void mm_nocritical(void){}
void mm_notify(void){}
void mm_login(void){}
void mm_diskerror(void){}
void mm_status(void){}
void mm_lsub(void){}
void mm_list(void){}
void mm_exists(void){}
void mm_searched(void){}
void mm_expunged(void){}
char mail_open();
int main() {
mail_open(0,"",0);
return 0;
}
], [
LIBS=$old_LIBS
$1
],[
LIBS=$old_LIBS
$2
])
])
AC_DEFUN(PHP_IMAP_KRB_CHK, [
AC_ARG_WITH(kerberos,
[ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install dir.],[
@@ -34,6 +68,12 @@ AC_DEFUN(PHP_IMAP_KRB_CHK, [
fi
if test "$PHP_KERBEROS" != "no"; then
if test ! -f $PHP_KERBEROS/lib/libkrb5.a && test ! -f $PHP_KERBEROS/lib/libkrb5.$SHLIB_SUFFIX_NAME; then
AC_MSG_ERROR([Kerberos libraries not found in $PHP_KERBEROS/lib.
Check the path given to --with-kerberos (if no path is given, defaults to /usr/kerberos )
])
fi
AC_DEFINE(HAVE_IMAP_KRB,1,[ ])
PHP_ADD_LIBPATH($PHP_KERBEROS/lib, IMAP_SHARED_LIBADD)
PHP_ADD_LIBRARY(gssapi_krb5, 1, IMAP_SHARED_LIBADD)
@@ -42,9 +82,10 @@ AC_DEFUN(PHP_IMAP_KRB_CHK, [
PHP_ADD_LIBRARY(com_err, 1, IMAP_SHARED_LIBADD)
else
AC_EGREP_HEADER(auth_gss, $IMAP_INC_DIR/linkage.h, [
AC_MSG_ERROR(This c-client library is build with Kerberos support.
AC_MSG_ERROR([This c-client library is build with Kerberos support.
Add --with-kerberos<=DIR> to your configure line. Check config.log for details.)
Add --with-kerberos<=DIR> to your configure line. Check config.log for details.
])
])
fi
@@ -62,45 +103,29 @@ AC_DEFUN(PHP_IMAP_SSL_CHK, [
PHP_IMAP_SSL=/usr
fi
AC_MSG_CHECKING([whether SSL libraries are needed for c-client])
if test "$PHP_IMAP_SSL" != "no"; then
AC_MSG_RESULT([$PHP_IMAP_SSL/lib])
AC_DEFINE(HAVE_IMAP_SSL,1,[ ])
PHP_ADD_LIBPATH($PHP_IMAP_SSL/lib, IMAP_SHARED_LIBADD)
PHP_ADD_LIBRARY_DEFER(ssl,, IMAP_SHARED_LIBADD)
PHP_ADD_LIBRARY_DEFER(crypto,, IMAP_SHARED_LIBADD)
PHP_ADD_LIBPATH($PHP_IMAP_SSL/lib, IMAP_SHARED_LIBADD)
else
old_LIBS=$LIBS
LIBS="$LIBS -L$IMAP_LIBDIR -l$IMAP_LIB"
TST_LIBS="-L$IMAP_LIBDIR -l$IMAP_LIB"
if test $PHP_KERBEROS != "no"; then
LIBS="$LIBS -L$PHP_KERBEROS/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
TST_LIBS="$TST_LIBS -L$PHP_KERBEROS/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
fi
AC_TRY_RUN([
void mm_log(void){}
void mm_dlog(void){}
void mm_flags(void){}
void mm_fatal(void){}
void mm_critical(void){}
void mm_nocritical(void){}
void mm_notify(void){}
void mm_login(void){}
void mm_diskerror(void){}
void mm_status(void){}
void mm_lsub(void){}
void mm_list(void){}
void mm_exists(void){}
void mm_searched(void){}
void mm_expunged(void){}
char mail_open();
int main() {
mail_open(0,"",0);
return 0;
}
],,[
AC_MSG_ERROR(This c-client library is build with SSL support.
Add --with-imap-ssl<=DIR> to your configure line. Check config.log for details.)
])
LIBS=$old_LIBS
PHP_IMAP_TEST_BUILD([
AC_MSG_RESULT(no)
], [
AC_MSG_RESULT(yes)
AC_MSG_ERROR([This c-client library is build with SSL support.
Add --with-imap-ssl<=DIR> to your configure line. Check config.log for details.
])
], $TST_LIBS)
fi
])
@@ -162,8 +187,18 @@ if test "$PHP_IMAP" != "no"; then
fi
PHP_ADD_INCLUDE($IMAP_INC_DIR)
PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
PHP_ADD_LIBRARY_DEFER($IMAP_LIB,, IMAP_SHARED_LIBADD)
PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
PHP_IMAP_KRB_CHK
PHP_IMAP_SSL_CHK
dnl Test the build in the end
TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD"
AC_MSG_CHECKING(whether IMAP works)
PHP_IMAP_TEST_BUILD([
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
AC_MSG_ERROR([build test failed. Please check the config.log for details.])
], $TST_LIBS)
fi
+3 -10
View File
@@ -123,7 +123,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /D HAVE_IMAP2001=1 /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\imap\c-client" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /D HAVE_IMAP2001=1 /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
@@ -133,7 +133,8 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib cclient.lib Secur32.lib CertIdl.Lib /nologo /dll /machine:I386 /nodefaultlib:"LIBCMT" /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib cclient.lib Secur32.lib CertIdl.Lib /nologo /dll /machine:I386 /nodefaultlib:"LIBCMT" /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\imap"
# SUBTRACT LINK32 /nodefaultlib
!ENDIF
@@ -148,10 +149,6 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\win32\imap_sendmail.c
# End Source File
# Begin Source File
SOURCE=.\php_imap.c
# End Source File
# Begin Source File
@@ -164,10 +161,6 @@ SOURCE=..\..\win32\sendmail.c
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\win32\imap_sendmail.h
# End Source File
# Begin Source File
SOURCE=.\php_imap.h
# End Source File
# Begin Source File
+287 -336
View File
File diff suppressed because it is too large. Load diff
+3 -8
View File
@@ -22,6 +22,7 @@
| Andrew Skalski <askalski@chekinc.com> |
| Hartmut Holzgraefe <hartmut@six.de> |
| Jani Taskinen <sniper@iki.fi> |
| Daniel R. Kalowsky <kalowsky@php.net> |
| PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
@@ -78,12 +79,6 @@ typedef enum {
typedef struct php_imap_le_struct {
MAILSTREAM *imap_stream;
long flags;
#ifdef OP_RELOGIN
/* AJS: busy flag for persistent connections, pointers for chaining */
struct php_imap_le_struct *next;
struct php_imap_le_struct **prev;
char busy;
#endif
} pils;
typedef struct php_imap_mailbox_struct {
@@ -177,6 +172,7 @@ PHP_FUNCTION(imap_thread);
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
PHP_FUNCTION(imap_get_quota);
PHP_FUNCTION(imap_get_quotaroot);
PHP_FUNCTION(imap_set_quota);
PHP_FUNCTION(imap_setacl);
#endif
@@ -208,8 +204,7 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
unsigned long status_uidnext;
unsigned long status_uidvalidity;
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
unsigned long quota_usage;
unsigned long quota_limit;
zval *quota_return;
#endif
ZEND_END_MODULE_GLOBALS(imap)
+113 -113
View File
@@ -62,7 +62,7 @@
/* local function prototypes */
static void php_ifx_set_default_link(int id TSRMLS_DC);
static long php_intifx_getType(long id, HashTable *list TSRMLS_DC);
static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list);
static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC);
static long php_intifx_free_blob(long id, HashTable *list TSRMLS_DC);
static long php_intifx2_free_blob(long id, HashTable *list TSRMLS_DC);
static long php_intifx_get_blob(long bid, HashTable *list, char** content TSRMLS_DC);
@@ -71,7 +71,7 @@ static loc_t *php_intifx_get_blobloc(long bid, HashTable *list TSRMLS_DC);
static char* php_intifx_create_tmpfile(long bid TSRMLS_DC);
static long php_intifx_copy_blob(long bid, HashTable *list TSRMLS_DC);
static char* php_intifx_null(TSRMLS_D);
static long php_intifx_create_char(char* param, long len, HashTable *list);
static long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC);
static long php_intifx_free_char(long id, HashTable *list TSRMLS_DC);
static long php_intifx_update_char(long bid, char* param, long len, HashTable *list TSRMLS_DC);
static long php_intifx_get_char(long bid, HashTable *list, char** content TSRMLS_DC);
@@ -112,7 +112,7 @@ typedef char IFX[128];
{ \
if (ifx_check() < 0) { \
IFXG(sv_sqlcode) = SQLCODE; \
php_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); \
php_error(E_WARNING, "%s(): Set connection %s fails (%s)", get_active_function_name(TSRMLS_C), ifx, ifx_error(ifx)); \
RETURN_FALSE; \
} \
}
@@ -418,7 +418,7 @@ EXEC SQL END DECLARE SECTION;
if (PG(sql_safe_mode)) {
if (ZEND_NUM_ARGS()>0) {
php_error(E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
php_error(E_NOTICE, "%s(): SQL safe mode in effect - ignoring host/user/password information", get_active_function_name(TSRMLS_C));
}
host = passwd = NULL;
user = php_get_current_user();
@@ -490,12 +490,12 @@ EXEC SQL END DECLARE SECTION;
list_entry new_le;
if (IFXG(max_links)!=-1 && IFXG(num_links) >= IFXG(max_links)) {
php_error(E_WARNING, "Informix: Too many open links (%d)", IFXG(num_links));
php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), IFXG(num_links));
efree(hashed_details);
RETURN_FALSE;
}
if (IFXG(max_persistent)!=-1 && IFXG(num_persistent) >= IFXG(max_persistent)) {
php_error(E_WARNING, "Informix: Too many open persistent links (%d)", IFXG(num_persistent));
php_error(E_WARNING, "%s(): Too many open persistent links (%d)", get_active_function_name(TSRMLS_C), IFXG(num_persistent));
efree(hashed_details);
RETURN_FALSE;
}
@@ -509,7 +509,7 @@ EXEC SQL END DECLARE SECTION;
if (ifx_check() == IFX_ERROR) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,ifx_error(ifx));
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ifx_error(ifx));
free(ifx);
efree(hashed_details);
RETURN_FALSE;
@@ -539,7 +539,7 @@ EXEC SQL END DECLARE SECTION;
if (ifx_check() == IFX_ERROR) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING, "Informix: Link to server lost, unable to reconnect (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Link to server lost, unable to reconnect (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
efree(hashed_details);
RETURN_FALSE;
@@ -577,7 +577,7 @@ EXEC SQL END DECLARE SECTION;
if (ifx_check() == IFX_ERROR) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Informix: Unable to connect (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Unable to connect (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
efree(hashed_details);
RETURN_FALSE;
@@ -594,7 +594,7 @@ EXEC SQL END DECLARE SECTION;
}
}
if (IFXG(max_links) != -1 && IFXG(num_links) >= IFXG(max_links)) {
php_error(E_WARNING, "Informix: Too many open links (%d)", IFXG(num_links));
php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), IFXG(num_links));
efree(hashed_details);
RETURN_FALSE;
}
@@ -607,7 +607,7 @@ EXEC SQL END DECLARE SECTION;
if (ifx_check() == IFX_ERROR) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"ifx_connect: %s", ifx_error(ifx));
php_error(E_WARNING,"%s(): %s", get_active_function_name(TSRMLS_C), ifx_error(ifx));
efree(hashed_details);
efree(ifx);
RETURN_FALSE;
@@ -781,7 +781,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL PREPARE :statemid FROM :statement;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Prepare fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
RETURN_FALSE;
}
@@ -791,7 +791,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 384;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
php_error(E_WARNING, "%s(): Allocate desciptor <%s> fails (%s)", get_active_function_name(TSRMLS_C), descrpid, ifx_error(ifx));
EXEC SQL free :statemid;
RETURN_FALSE;
}
@@ -799,7 +799,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Describe fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
RETURN_FALSE;
@@ -809,7 +809,7 @@ EXEC SQL END DECLARE SECTION;
Ifx_Result = (IFX_RES *) emalloc(sizeof(IFX_RES));
if (Ifx_Result == NULL) {
php_error(E_WARNING,"Out of memory allocating IFX_RES");
php_error(E_WARNING, "%s(): Out of memory allocating IFX_RES", get_active_function_name(TSRMLS_C));
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
RETURN_FALSE;
@@ -857,7 +857,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"Can't get blob array param");
php_error(E_WARNING, "%s(): Can't get blob array param", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if (Z_TYPE_PP(pblobidarr) != IS_ARRAY) {
@@ -865,7 +865,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"blob-parameter is not an array");
php_error(E_WARNING, "%s(): Blob-parameter is not an array", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -887,7 +887,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"%d is not a Informix blob-result index", (int)((*tmp)->value.lval));
php_error(E_WARNING,"%s(): %d is not an Informix blob-result index", get_active_function_name(TSRMLS_C), (int)((*tmp)->value.lval));
RETURN_FALSE;
}
if(locator->loc_loctype==LOCFNAME) {
@@ -925,7 +925,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"Execute immediate fails : %s (%s)", statement, ifx_error(ifx));
php_error(E_WARNING, "%s(): Execute immediate fails : %s (%s)", get_active_function_name(TSRMLS_C), statement, ifx_error(ifx));
RETURN_FALSE;
}
Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
@@ -962,7 +962,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
php_error(E_WARNING, "%s(): Can not get descriptor %s (%s)", get_active_function_name(TSRMLS_C), descrpid, ifx_error(ifx));
RETURN_FALSE;
}
@@ -995,7 +995,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Declare cursor fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
RETURN_FALSE;
}
@@ -1006,7 +1006,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL free :statemid;
EXEC SQL free :cursorid;
efree(Ifx_Result);
php_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Open cursor fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
RETURN_FALSE;
}
strcpy(Ifx_Result->cursorid, cursorid);
@@ -1024,17 +1024,17 @@ $endif;
) {
int bid = 0;
if(fieldtype==SQLTEXT) {
bid=php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list));
bid=php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list) TSRMLS_CC);
locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
}
if(fieldtype==SQLBYTES) {
if(IFXG(blobinfile)==0) {
bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list));
bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list) TSRMLS_CC);
locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
} else {
blobfilename=php_intifx_create_tmpfile(i TSRMLS_CC);
bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE, blobfilename,strlen(blobfilename),&EG(regular_list));
bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE, blobfilename,strlen(blobfilename),&EG(regular_list) TSRMLS_CC);
locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
locator->loc_oflags=LOC_WONLY;
}
@@ -1131,7 +1131,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL PREPARE :statemid FROM :statement;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Prepare fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
RETURN_FALSE;
}
@@ -1141,7 +1141,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 384;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx));
php_error(E_WARNING, "%s(): Allocate desciptor <%s> fails (%s)", get_active_function_name(TSRMLS_C), descrpid, ifx_error(ifx));
EXEC SQL free :statemid;
RETURN_FALSE;
}
@@ -1149,7 +1149,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Describe fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
RETURN_FALSE;
@@ -1160,7 +1160,7 @@ EXEC SQL END DECLARE SECTION;
Ifx_Result = (IFX_RES *) emalloc(sizeof(IFX_RES));
if (Ifx_Result == NULL) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Out of memory allocating IFX_RES");
php_error(E_WARNING, "%s(): Out of memory allocating IFX_RES", get_active_function_name(TSRMLS_C));
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
RETURN_FALSE;
@@ -1209,7 +1209,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"Can't get blob array param");
php_error(E_WARNING,"%s(): Can't get blob array param", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1218,7 +1218,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"blob-parameter not an array");
php_error(E_WARNING, "%s(): Blob-parameter not an array", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1240,7 +1240,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"%d is not a Informix blob-result index", (int)((*tmp)->value.lval));
php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), (int)((*tmp)->value.lval));
RETURN_FALSE;
}
if(locator->loc_loctype==LOCFNAME) {
@@ -1306,7 +1306,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
EXEC SQL free :statemid;
efree(Ifx_Result);
php_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx));
php_error(E_WARNING, "%s(): Can not get descriptor %s (%s)", get_active_function_name(TSRMLS_C), descrpid, ifx_error(ifx));
RETURN_FALSE;
}
Ifx_Result->numcols = fieldcount;
@@ -1379,7 +1379,7 @@ EXEC SQL END DECLARE SECTION;
PHP_IFX_CHECK_CONNECTION(ifx);
if (Ifx_Result->iscursory < 0) {
php_error(E_WARNING, "Resultindex %d is not a prepared query", Z_LVAL_PP(result));
php_error(E_WARNING, "%s(): Resultindex %d is not a prepared query", get_active_function_name(TSRMLS_C), Z_LVAL_PP(result));
RETURN_FALSE;
}
@@ -1391,7 +1391,7 @@ EXEC SQL END DECLARE SECTION;
}
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Execute immediate fails : %s ", ifx_error(ifx));
php_error(E_WARNING, "%s(): Execute immediate fails: %s", get_active_function_name(TSRMLS_C), ifx_error(ifx));
RETURN_FALSE;
}
Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
@@ -1413,14 +1413,14 @@ EXEC SQL END DECLARE SECTION;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Declare cursor fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
RETURN_FALSE;
}
EXEC SQL OPEN :cursorid;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx));
php_error(E_WARNING, "%s(): Open cursor fails (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx));
RETURN_FALSE;
}
@@ -1436,17 +1436,17 @@ $endif;
int bid = 0;
if(fieldtype==SQLTEXT) {
bid=php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list));
bid=php_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list) TSRMLS_CC);
locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
}
if(fieldtype==SQLBYTES) {
if(IFXG(blobinfile)==0) {
bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list));
bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list) TSRMLS_CC);
locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
} else {
blobfilename=php_intifx_create_tmpfile(i TSRMLS_CC);
bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE,blobfilename,strlen(blobfilename),&EG(regular_list));
bid=php_intifx_create_blob(TYPE_BLBYTE,BLMODE_INFILE,blobfilename,strlen(blobfilename),&EG(regular_list) TSRMLS_CC);
locator=php_intifx_get_blobloc(bid,&EG(regular_list) TSRMLS_CC);
locator->loc_oflags=LOC_WONLY;
}
@@ -1682,7 +1682,7 @@ EXEC SQL END DECLARE SECTION;
IFXG(sv_sqlcode) = 0;
if (strcmp(Ifx_Result->cursorid,"") == 0) {
php_error(E_WARNING,"Not a select cursor !");
php_error(E_WARNING, "%s(): Not a select cursor!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1716,7 +1716,7 @@ EXEC SQL END DECLARE SECTION;
} else if (!strcasecmp(fetch_pos,"CURRENT")) {
EXEC SQL FETCH CURRENT :cursorid USING SQL DESCRIPTOR :descrpid;
} else {
php_error(E_WARNING, "invalid positioning arg on fetch");
php_error(E_WARNING, "%s(): Invalid positioning arg on fetch", get_active_function_name(TSRMLS_C));
}
}
}
@@ -1725,7 +1725,7 @@ EXEC SQL END DECLARE SECTION;
switch (ifx_check()) {
case IFX_ERROR:
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_error(ifx), cursorid);
php_error(E_WARNING, "%s(): Can not fetch row on cursor %s (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx), cursorid);
RETURN_FALSE;
break;
case IFX_NODATA:
@@ -1752,7 +1752,7 @@ EXEC SQL END DECLARE SECTION;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
RETURN_FALSE;
}
@@ -1850,7 +1850,7 @@ $ifdef HAVE_IFX_IUS;
fieldleng=ifx_var_getlen(&lvar_tmp);
if (fieldleng > 2) fieldleng -= 2; /* fix by Alex Shepherd */
if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
php_error(E_WARNING, "Out of memory");
php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
memcpy(char_data,ifx_var_getdata(&lvar_tmp),fieldleng);
@@ -1864,7 +1864,7 @@ $endif;
case SQLCHAR :
case SQLNCHAR :
if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
php_error(E_WARNING, "Out of memory");
php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA;
@@ -1919,7 +1919,7 @@ $endif;
}
if (locator_b->loc_status < 0) { /* blob too large */
php_error(E_WARNING,"no memory (%d bytes) for blob", locator_b->loc_bufsize);
php_error(E_WARNING, "%s(): No memory (%d bytes) for blob", get_active_function_name(TSRMLS_C), locator_b->loc_bufsize);
RETURN_FALSE;
}
@@ -2048,7 +2048,7 @@ EXEC SQL END DECLARE SECTION;
ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
if (strcmp(Ifx_Result->cursorid,"") == 0) {
php_error(E_WARNING,"Not a select cursor !");
php_error(E_WARNING, "%s(): Not a select cursor!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -2066,7 +2066,7 @@ EXEC SQL END DECLARE SECTION;
switch (ifx_check()) {
case IFX_ERROR:
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
php_error(E_WARNING, "%s(): Can not fetch next row on cursor %s (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx), cursorid);
RETURN_FALSE;
break;
case IFX_NODATA:
@@ -2096,7 +2096,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
RETURN_FALSE;
}
@@ -2123,7 +2123,7 @@ EXEC SQL END DECLARE SECTION;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
RETURN_FALSE;
}
@@ -2202,7 +2202,7 @@ $ifdef HAVE_IFX_IUS;
if (fieldleng > 2) fieldleng -= 2; /* fix by Alex Shepherd */
if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
php_error(E_WARNING, "Out of memory");
php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
memcpy(char_data,ifx_var_getdata(&lvar_tmp),fieldleng);
@@ -2216,7 +2216,7 @@ $endif;
case SQLNCHAR :
case SQLNVCHAR :
if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
php_error(E_WARNING, "Out of memory");
php_error(E_WARNING, "%s(): Out of memory", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA;
@@ -2252,7 +2252,7 @@ $endif;
}
}
if (locator_b->loc_status < 0) { /* blob too large */
php_error(E_WARNING,"no memory (%d bytes) for blob", locator_b->loc_bufsize);
php_error(E_WARNING, "%s(): Not enough memory (%d bytes) for blob", get_active_function_name(TSRMLS_C), locator_b->loc_bufsize);
RETURN_FALSE;
}
@@ -2265,7 +2265,7 @@ $endif;
/* need an extra byte for string terminator */
copy_content = malloc(lg + 1);
if (copy_content == NULL) {
php_error(E_WARNING,"no memory for TEXT column");
php_error(E_WARNING, "%s(): Not enough memory for TEXT column", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
memcpy(copy_content, content, lg);
@@ -2292,7 +2292,7 @@ $endif;
switch (ifx_check()) {
case IFX_ERROR:
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), cursorid);
php_error(E_WARNING, "%s(): Can not fetch next row on cursor %s (%s)", get_active_function_name(TSRMLS_C), ifx_error(ifx), cursorid);
RETURN_FALSE;
break;
case IFX_NODATA:
@@ -2348,7 +2348,7 @@ EXEC SQL END DECLARE SECTION;
ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
if (strcmp(Ifx_Result->cursorid,"") == 0) {
php_error(E_WARNING,"Not a select cursor !");
php_error(E_WARNING, "%s(): Not a select cursor!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -2369,7 +2369,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, :fieldtype = TYPE;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
RETURN_FALSE;
}
@@ -2506,7 +2506,7 @@ EXEC SQL END DECLARE SECTION;
ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result);
if (strcmp(Ifx_Result->cursorid,"") == 0) {
php_error(E_WARNING,"Not a select cursor !");
php_error(E_WARNING, "%s(): Not a select cursor!", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -2534,7 +2534,7 @@ EXEC SQL END DECLARE SECTION;
if (ifx_check() < 0) {
IFXG(sv_sqlcode) = SQLCODE;
php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx));
php_error(E_WARNING, "%s(): Get descriptor (field # %d) fails (%s)", get_active_function_name(TSRMLS_C), i, ifx_error(ifx));
RETURN_FALSE;
}
@@ -2797,7 +2797,7 @@ static long php_intifx_getType(long id, HashTable *list TSRMLS_DC)
Ifx_res = (IFX_IDRES *) zend_list_find(id,&type);
if (type!=le_idresult) {
php_error(E_WARNING,"%d is not a Informix id-result index", id);
php_error(E_WARNING, "%s(): %d is not a Informix id-result index", get_active_function_name(TSRMLS_C), id);
return -1;
}
return Ifx_res->type;
@@ -2841,7 +2841,7 @@ PHP_FUNCTION(ifx_create_blob)
mode=BLMODE_INFILE;
}
id=php_intifx_create_blob(type,mode,Z_STRVAL_P(pparam),Z_STRLEN_P(pparam),&EG(regular_list));
id=php_intifx_create_blob(type,mode,Z_STRVAL_P(pparam),Z_STRLEN_P(pparam),&EG(regular_list) TSRMLS_CC);
if(id < 0) {
RETURN_FALSE;
@@ -2852,7 +2852,7 @@ PHP_FUNCTION(ifx_create_blob)
/* ----------------------------------------------------------------------
* internal function
* long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list)
* long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC)
*
* creates an blob-object
* type: 1=TEXT, 0=BYTE
@@ -2864,13 +2864,13 @@ PHP_FUNCTION(ifx_create_blob)
* return -1 on error otherwise the new Blob-Object-id
* ----------------------------------------------------------------------
*/
static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list)
static long php_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list TSRMLS_DC)
{
IFX_IDRES *Ifx_blob;
Ifx_blob=emalloc(sizeof(IFX_IDRES));
if(Ifx_blob==NULL) {
php_error(E_WARNING,"can't create blob-resource");
php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
@@ -2887,7 +2887,7 @@ static long php_intifx_create_blob(long type, long mode, char* param, long len,
if(len>=0) {
char *content=emalloc(len);
if(content==NULL) {
php_error(E_WARNING,"can't create blob-resource");
php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
memcpy(content,param,len);
@@ -2908,7 +2908,7 @@ static long php_intifx_create_blob(long type, long mode, char* param, long len,
} else { /* mode = BLMODE_INFILE */
char *filename=emalloc(len+1);
if(filename==NULL) {
php_error(E_WARNING,"can't create blob-resource");
php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
memcpy(filename,param,len);
@@ -2970,13 +2970,13 @@ static long php_intifx_copy_blob(long bid, HashTable *list TSRMLS_DC)
Ifx_blob_orig = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || !(Ifx_blob_orig->type==TYPE_BLBYTE || Ifx_blob_orig->type==TYPE_BLTEXT)) {
php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
php_error(E_WARNING,"%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
Ifx_blob=emalloc(sizeof(IFX_IDRES));
if(Ifx_blob==NULL) {
php_error(E_WARNING,"can't create blob-resource");
php_error(E_WARNING,"%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
@@ -2992,7 +2992,7 @@ static long php_intifx_copy_blob(long bid, HashTable *list TSRMLS_DC)
char *content;
if(locator_orig->loc_size>=0 && locator_orig->loc_buffer!=NULL) {
if((content=emalloc(locator_orig->loc_size))==NULL) {
php_error(E_WARNING,"can't create blob-resource");
php_error(E_WARNING,"%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
memcpy(content,locator_orig->loc_buffer, locator_orig->loc_size);
@@ -3011,7 +3011,7 @@ static long php_intifx_copy_blob(long bid, HashTable *list TSRMLS_DC)
char *filename;
if((filename=emalloc(strlen(locator_orig->loc_fname)+1))==NULL) {
php_error(E_WARNING,"can't create blob-resource");
php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
@@ -3072,7 +3072,7 @@ static long php_intifx_free_blob(long bid, HashTable *list TSRMLS_DC)
Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
@@ -3110,7 +3110,7 @@ static long php_intifx2_free_blob(long bid, HashTable *list TSRMLS_DC)
Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
@@ -3183,7 +3183,7 @@ static long php_intifx_get_blob(long bid, HashTable *list, char** content TSRMLS
Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
@@ -3212,7 +3212,7 @@ static loc_t *php_intifx_get_blobloc(long bid, HashTable *list TSRMLS_DC)
Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
return NULL;
}
return &(Ifx_blob->BLOB.blob_data);
@@ -3268,7 +3268,7 @@ static long php_intifx_update_blob(long bid, char* param, long len, HashTable *l
Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
php_error(E_WARNING,"%d is not a Informix blob-result index", bid);
php_error(E_WARNING,"%s(): %d is not a Informix blob-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
@@ -3280,7 +3280,7 @@ static long php_intifx_update_blob(long bid, char* param, long len, HashTable *l
}
if(len >= 0) {
if((content=emalloc(len))==NULL) {
php_error(E_WARNING,"can't create blob-resource");
php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
memcpy(content,param, len);
@@ -3301,7 +3301,7 @@ static long php_intifx_update_blob(long bid, char* param, long len, HashTable *l
efree(Ifx_blob->BLOB.blob_data.loc_fname);
}
if((filename=emalloc(len+1))==NULL) {
php_error(E_WARNING,"can't create blob-resource");
php_error(E_WARNING, "%s(): Can't create blob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
memcpy(filename,param, len);
@@ -3315,7 +3315,7 @@ static long php_intifx_update_blob(long bid, char* param, long len, HashTable *l
/*-------------------------------------------------
* internal function
*
* php_intifx_create_tmpfile(long bid)
* php_intifx_create_tmpfile(long bid TSRMLS_DC)
* creates a temporary file to store a blob in
*-------------------------------------------------
*/
@@ -3485,7 +3485,7 @@ PHP_FUNCTION(ifx_create_char)
}
convert_to_string(pparam);
id=php_intifx_create_char(Z_STRVAL_P(pparam),Z_STRLEN_P(pparam),&EG(regular_list));
id=php_intifx_create_char(Z_STRVAL_P(pparam),Z_STRLEN_P(pparam),&EG(regular_list) TSRMLS_CC);
if(id < 0) {
RETURN_FALSE;
@@ -3496,7 +3496,7 @@ PHP_FUNCTION(ifx_create_char)
/* ----------------------------------------------------------------------
* internal function
* long php_intifx_create_char(char* param, long len, HashTable *list)
* long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC)
*
* creates an char-object
* param: content
@@ -3505,13 +3505,13 @@ PHP_FUNCTION(ifx_create_char)
* return -1 on error otherwise the new char-Object-id
* ----------------------------------------------------------------------
*/
static long php_intifx_create_char(char* param, long len, HashTable *list)
static long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS_DC)
{
IFX_IDRES *Ifx_char;
Ifx_char=emalloc(sizeof(IFX_IDRES));
if(Ifx_char==NULL) {
php_error(E_WARNING,"can't create char-resource");
php_error(E_WARNING, "%s(): Can't create char-resource", get_active_function_name(TSRMLS_C));
return -1;
}
@@ -3524,7 +3524,7 @@ static long php_intifx_create_char(char* param, long len, HashTable *list)
Ifx_char->CHAR.char_data=emalloc(len+1);
if(Ifx_char->CHAR.char_data==NULL) {
efree(Ifx_char);
php_error(E_WARNING,"can't create char-resource");
php_error(E_WARNING, "%s(): Can't create char-resource", get_active_function_name(TSRMLS_C));
return -1;
}
memcpy(Ifx_char->CHAR.char_data,param,len);
@@ -3583,7 +3583,7 @@ static long php_intifx_get_char(long bid, HashTable *list, char** content TSRMLS
Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult && !(Ifx_char->type==TYPE_CHAR)) {
php_error(E_WARNING,"%d is not a Informix char-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix char-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
@@ -3636,7 +3636,7 @@ static long php_intifx_free_char(long bid, HashTable *list TSRMLS_DC)
Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult && !(Ifx_char->type==TYPE_CHAR)) {
php_error(E_WARNING,"%d is not a Informix char-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix char-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
@@ -3696,7 +3696,7 @@ static long php_intifx_update_char(long bid, char* param, long len, HashTable *l
Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult && !(Ifx_char->type==TYPE_CHAR)) {
php_error(E_WARNING,"%d is not a Informix char-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix char-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
@@ -3712,7 +3712,7 @@ static long php_intifx_update_char(long bid, char* param, long len, HashTable *l
} else {
Ifx_char->CHAR.char_data=emalloc(len+1);
if(Ifx_char->CHAR.char_data==NULL) {
php_error(E_WARNING,"can't create char-resource");
php_error(E_WARNING, "%s(): Can't create char-resource", get_active_function_name(TSRMLS_C));
return -1;
}
memcpy(Ifx_char->CHAR.char_data,param,len);
@@ -3772,7 +3772,7 @@ PHP_FUNCTION(ifxus_create_slob)
/* ----------------------------------------------------------------------
* internal function
* long php_intifx_create_slob(long create_mode, HashTable *list)
* long php_intifx_create_slob(long create_mode, HashTable *list TSRMLS_DC)
*
* creates an slob-object and opens it
* mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
@@ -3780,27 +3780,27 @@ PHP_FUNCTION(ifxus_create_slob)
* return -1 on error otherwise the new Blob-Object-id
* ----------------------------------------------------------------------
*/
static long php_intifxus_create_slob(long create_mode, HashTable *list)
static long php_intifxus_create_slob(long create_mode, HashTable *list TSRMLS_DC)
{
IFX_IDRES *Ifx_slob;
int errcode;
Ifx_slob=emalloc(sizeof(IFX_IDRES));
if(Ifx_slob==NULL) {
php_error(E_WARNING,"can't create slob-resource");
php_error(E_WARNING, "%s(): Can't create slob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
errcode=ifx_lo_def_create_spec(&(Ifx_slob->SLOB.createspec));
if(errcode<0) {
php_error(E_WARNING,"can't create slob-resource: %d", errcode);
php_error(E_WARNING, "%s(): Can't create slob-resource: %d", get_active_function_name(TSRMLS_C), errcode);
return -1;
}
Ifx_slob->type=TYPE_SLOB;
Ifx_slob->SLOB.lofd=ifx_lo_create(Ifx_slob->SLOB.createspec,create_mode,&(Ifx_slob->SLOB.slob_data),&errcode);
if(errcode<0 || Ifx_slob->SLOB.lofd<0) {
php_error(E_WARNING,"can't create slob-resource: %d", errcode);
php_error(E_WARNING, "%s(): Can't create slob-resource: %d", get_active_function_name(TSRMLS_C), errcode);
return -1;
}
return zend_list_insert(Ifx_slob,le_idresult);
@@ -3851,7 +3851,7 @@ static long php_intifxus_free_slob(long bid, HashTable *list TSRMLS_DC)
Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
@@ -3912,17 +3912,17 @@ static long php_intifxus_close_slob(long bid, HashTable *list TSRMLS_DC)
Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
if(Ifx_slob->SLOB.lofd<0) {
php_error(E_WARNING,"slob-resource already closed");
php_error(E_WARNING, "%s(): Slob-resource already closed", get_active_function_name(TSRMLS_C));
return -1;
}
if(ifx_lo_close(Ifx_slob->SLOB.lofd)<0) {
php_error(E_WARNING,"can't close slob-resource");
php_error(E_WARNING, "%s(): Can't close slob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
Ifx_slob->SLOB.lofd=-1;
@@ -3990,18 +3990,18 @@ static long php_intifxus_open_slob(long bid, long create_mode, HashTable *list T
Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
return -1;
}
if(Ifx_slob->SLOB.lofd>0) {
php_error(E_WARNING,"slob-resource already open");
php_error(E_WARNING, "%s(): Slob-resource already open", get_active_function_name(TSRMLS_C));
return -1;
}
Ifx_slob->SLOB.lofd=ifx_lo_open(&(Ifx_slob->SLOB.slob_data),create_mode,&errcode);
if(errcode < 0 || Ifx_slob->SLOB.lofd < 0) {
php_error(E_WARNING,"can't open slob-resource: %d", errcode);
php_error(E_WARNING, "%s(): Can't open slob-resource: %d", get_active_function_name(TSRMLS_C), errcode);
return -1;
}
return 0;
@@ -4022,7 +4022,7 @@ static long php_intifxus_new_slob(HashTable *list)
Ifx_slob=emalloc(sizeof(IFX_IDRES));
if(Ifx_slob==NULL) {
php_error(E_WARNING,"can't create slob-resource");
php_error(E_WARNING, "%s(): Can't create slob-resource", get_active_function_name(TSRMLS_C));
return -1;
}
@@ -4048,7 +4048,7 @@ static ifx_lo_t *php_intifxus_get_slobloc(long bid, HashTable *list TSRMLS_DC)
Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
return NULL;
}
return &(Ifx_slob->SLOB.slob_data);
@@ -4082,17 +4082,17 @@ PHP_FUNCTION(ifxus_tell_slob)
Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
php_error(E_WARNING,"%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
RETURN_FALSE;
}
if(ifx_lo_tell(Ifx_slob->SLOB.lofd,&akt_seek_pos)<0) {
php_error(E_WARNING,"can't perform tell-operation");
php_error(E_WARNING,"%s(): Can't perform tell-operation", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if(ifx_int8tolong(&akt_seek_pos,&lakt_seek_pos)<0) {
php_error(E_WARNING,"seek-position to large for long");
php_error(E_WARNING, "%s(): Seek-position to large for long", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
RETURN_LONG(lakt_seek_pos);
@@ -4130,7 +4130,7 @@ PHP_FUNCTION(ifxus_seek_slob)
bid=Z_LVAL_P(pbid);
Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
RETURN_FALSE;
}
@@ -4144,12 +4144,12 @@ PHP_FUNCTION(ifxus_seek_slob)
ifx_int8cvlong(Z_LVAL_P(poffset),&offset);
if(ifx_lo_seek(Ifx_slob->SLOB.lofd,&offset,mode,&akt_seek_pos)<0) {
php_error(E_WARNING,"can't perform seek-operation");
php_error(E_WARNING, "%s(): Can't perform seek-operation", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if(ifx_int8tolong(&akt_seek_pos,&lakt_seek_pos)<0) {
php_error(E_WARNING,"seek-position to large for long");
php_error(E_WARNING, "%s(): Seek-position to large for long", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
RETURN_LONG(lakt_seek_pos);
@@ -4185,7 +4185,7 @@ PHP_FUNCTION(ifxus_read_slob)
bid=Z_LVAL_P(pbid);
Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
RETURN_FALSE;
}
@@ -4193,7 +4193,7 @@ PHP_FUNCTION(ifxus_read_slob)
buffer=emalloc(nbytes);
if(ifx_lo_read(Ifx_slob->SLOB.lofd,buffer,nbytes,&errcode)<0) {
efree(buffer);
php_error(E_WARNING,"error reading slob: %d", errcode);
php_error(E_WARNING, "%s(): Error reading slob: %d", get_active_function_name(TSRMLS_C), errcode);
RETURN_FALSE;
}
RETURN_STRINGL(buffer,nbytes,0);
@@ -4229,7 +4229,7 @@ PHP_FUNCTION(ifxus_write_slob)
bid=Z_LVAL_P(pbid);
Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
if (type!=le_idresult || Ifx_slob->type!=TYPE_SLOB) {
php_error(E_WARNING,"%d is not a Informix slob-result index", bid);
php_error(E_WARNING, "%s(): %d is not a Informix slob-result index", get_active_function_name(TSRMLS_C), bid);
RETURN_FALSE;
}
@@ -4237,12 +4237,12 @@ PHP_FUNCTION(ifxus_write_slob)
nbytes=Z_STRLEN_P(pcontent);
if(nbytes<=0) {
php_error(E_WARNING,"string has no content");
php_error(E_WARNING, "%s(): String has no content", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if((nbytes=ifx_lo_write(Ifx_slob->SLOB.lofd,buffer,nbytes,&errcode))<0) {
php_error(E_WARNING,"error writing slob: %d", errcode);
php_error(E_WARNING, "%s(): Error writing slob: %d", get_active_function_name(TSRMLS_C), errcode);
RETURN_FALSE;
}
+70 -75
View File
@@ -213,7 +213,7 @@ typedef struct {
} else if (Z_TYPE_P(blob_arg) != IS_STRING\
|| Z_STRLEN_P(blob_arg) != sizeof(ibase_blob_handle)\
|| ((ibase_blob_handle *)(Z_STRVAL_P(blob_arg)))->bl_handle != 0){\
_php_ibase_module_error("invalid blob id");\
_php_ibase_module_error("Invalid blob id");\
RETURN_FALSE;\
} else {\
ib_blob = (ibase_blob_handle *)Z_STRVAL_P(blob_arg);\
@@ -262,13 +262,12 @@ PHP_FUNCTION(ibase_errmsg)
}
/* }}} */
/* {{{ _php_ibase_error()
/* {{{ _php_ibase_error(TSRMLS_D)
print interbase error and save it for ibase_errmsg() */
static void _php_ibase_error(void)
static void _php_ibase_error(TSRMLS_D)
{
char *s;
ISC_STATUS *statusp;
TSRMLS_FETCH();
s = IBG(errmsg);
statusp = IB_STATUS;
@@ -276,7 +275,7 @@ static void _php_ibase_error(void)
strcat(IBG(errmsg), " ");
s = IBG(errmsg) + strlen(IBG(errmsg));
}
php_error(E_WARNING, "InterBase: %s", IBG(errmsg));
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), IBG(errmsg));
}
/* }}} */
@@ -285,15 +284,14 @@ static void _php_ibase_error(void)
static void _php_ibase_module_error(char *msg, ...)
{
va_list ap;
int len;
TSRMLS_FETCH();
va_start(ap, msg);
len = vsnprintf(IBG(errmsg), MAX_ERRMSG - 1, msg, ap);
/* vsnprintf NUL terminates the buf and writes at most n-1 chars+NUL */
vsnprintf(IBG(errmsg), MAX_ERRMSG, msg, ap);
va_end(ap);
IBG(errmsg[len]) = '\0';
php_error(E_WARNING, "InterBase module: %s", IBG(errmsg));
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), IBG(errmsg));
}
/* }}} */
@@ -331,7 +329,7 @@ static void _php_ibase_commit_link(ibase_db_link *link)
if (link->trans[0] != NULL) { /* commit default */
IBDEBUG("Committing default transaction...");
if (isc_commit_transaction(IB_STATUS, &link->trans[0])) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
}
link->trans[0] = NULL;
}
@@ -339,7 +337,7 @@ static void _php_ibase_commit_link(ibase_db_link *link)
if (link->trans[i] != NULL) {
IBDEBUG("Rolling back other transactions...");
if (isc_rollback_transaction(IB_STATUS, &link->trans[i])) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
}
link->trans[i] = NULL;
}
@@ -397,7 +395,7 @@ static void _php_ibase_free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
if ( !(IB_STATUS[0] && IB_STATUS[1]) && ib_result->drop_stmt && ib_result->stmt ) {
IBDEBUG("Dropping statement handle (free_result)...");
if (isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_drop)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
}
} else {
/* Shouldn't be here unless query was select and had parameter
@@ -439,7 +437,7 @@ static void _php_ibase_free_query(ibase_query *ib_query)
if ( !(IB_STATUS[0] && IB_STATUS[1]) && ib_query->stmt) {
IBDEBUG("Dropping statement handle (free_query)...");
if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop)){
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
}
}
if (ib_query->in_array) {
@@ -490,7 +488,7 @@ static void _php_ibase_free_trans(zend_rsrc_list_entry *rsrc TSRMLS_DC)
if (ib_link->trans[ib_trans->trans_num] != NULL) {
IBDEBUG("Rolling back unhandled transaction...");
if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[ib_trans->trans_num])) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
}
ib_link->trans[ib_trans->trans_num] = NULL;
}
@@ -693,7 +691,7 @@ static int _php_ibase_attach_db(char *server, char *uname, char *passwd, char *c
dpb_length = dpb - dpb_buffer;
if (isc_attach_database(IB_STATUS, (short) strlen(server), server, db, (short) dpb_length, dpb_buffer)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
return FAILURE;
}
return SUCCESS;
@@ -976,7 +974,7 @@ static int _php_ibase_alloc_array(ibase_array **ib_arrayp, int *array_cntp,
if (isc_array_lookup_bounds(IB_STATUS, &link, &trans,
var->relname, var->sqlname, ar_desc)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
efree(IB_ARRAY);
IB_ARRAY = NULL;
return FAILURE;
@@ -1015,7 +1013,7 @@ static int _php_ibase_alloc_array(ibase_array **ib_arrayp, int *array_cntp,
IB_ARRAY[ar_cnt].el_size = ar_desc->array_desc_length+sizeof(short);
break;
default:
_php_ibase_module_error("unexpected array type %d in relation '%s' column '%s')",
_php_ibase_module_error("Unexpected array type %d in relation '%s' column '%s'",
ar_desc->array_desc_dtype, var->relname, var->sqlname);
efree(IB_ARRAY);
IB_ARRAY = NULL;
@@ -1060,7 +1058,7 @@ static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, i
IB_QUERY->dialect = dialect;
if (isc_dsql_allocate_statement(IB_STATUS, &link, &IB_QUERY->stmt)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
goto _php_ibase_alloc_query_error;
}
@@ -1069,7 +1067,7 @@ static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, i
IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
if (isc_dsql_prepare(IB_STATUS, &IB_QUERY->trans, &IB_QUERY->stmt, 0, query, dialect, IB_QUERY->out_sqlda)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
goto _php_ibase_alloc_query_error;
}
@@ -1079,7 +1077,7 @@ static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, i
IB_QUERY->out_sqlda->sqln = IB_QUERY->out_sqlda->sqld;
IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
if (isc_dsql_describe(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->out_sqlda)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
goto _php_ibase_alloc_query_error;
}
}
@@ -1089,7 +1087,7 @@ static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, i
IB_QUERY->in_sqlda->sqln = 0;
IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->in_sqlda)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
goto _php_ibase_alloc_query_error;
}
@@ -1099,7 +1097,7 @@ static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, i
IB_QUERY->in_sqlda->sqln = IB_QUERY->in_sqlda->sqld;
IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->in_sqlda)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
goto _php_ibase_alloc_query_error;
}
}
@@ -1179,7 +1177,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu
case SQL_SHORT:
convert_to_long(b_var);
if (Z_LVAL_P(b_var) > SHRT_MAX || Z_LVAL_P(b_var) < SHRT_MIN) {
_php_ibase_module_error("field %*s overflow", var->aliasname_length, var->aliasname);
_php_ibase_module_error("Field %*s overflow", var->aliasname_length, var->aliasname);
return FAILURE;
}
buf[i].val.sval = (short)Z_LVAL_P(b_var);
@@ -1245,7 +1243,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu
n = sscanf(Z_STRVAL_P(b_var), "%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d",
&t.tm_mon, &t.tm_mday, &t.tm_year, &t.tm_hour, &t.tm_min, &t.tm_sec);
if(n != 3 && n != 6){
_php_ibase_module_error("invalid date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave '%s'", n, Z_STRVAL_P(b_var));
_php_ibase_module_error("Invalid date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave '%s'", n, Z_STRVAL_P(b_var));
return FAILURE;
}
t.tm_year -= 1900;
@@ -1312,22 +1310,22 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu
ib_blob->bl_handle = NULL;
if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
efree(ib_blob);
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
return FAILURE;
}
convert_to_string(b_var);
if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_P(b_var), Z_STRVAL_P(b_var))) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
return FAILURE;
}
if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
return FAILURE;
}
ib_blob_id = ib_blob;
var->sqldata = (void ISC_FAR *)&ib_blob_id->bl_qd;
/*
_php_ibase_module_error("invalid blob id string");
_php_ibase_module_error("Invalid blob id string");
return FAILURE;
*/
} else {
@@ -1338,7 +1336,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu
}
break;
case SQL_ARRAY:
_php_ibase_module_error("binding arrays not supported yet");
_php_ibase_module_error("Binding arrays not supported yet");
return FAILURE;
break;
} /*switch*/
@@ -1440,21 +1438,21 @@ static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int
if (ib_query->in_sqlda) { /* has placeholders */
IBDEBUG("Query wants XSQLDA for input");
if (ib_query->in_sqlda->sqld != argc) {
_php_ibase_module_error("placeholders (%d) and variables (%d) mismatch", ib_query->in_sqlda->sqld, argc);
_php_ibase_module_error("Placeholders (%d) and variables (%d) mismatch", ib_query->in_sqlda->sqld, argc);
goto _php_ibase_exec_error; /* yes mommy, goto! */
}
in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
memcpy(in_sqlda, ib_query->in_sqlda, XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
bind_buf = emalloc(sizeof(BIND_BUF) * ib_query->in_sqlda->sqld);
if (_php_ibase_bind(in_sqlda, args, bind_buf, ib_query) == FAILURE) {
IBDEBUG("Could not bind input XSQLDA... (_php_ibase_exec)");
IBDEBUG("Could not bind input XSQLDA");
goto _php_ibase_exec_error;
}
}
if (isc_dsql_execute(IB_STATUS, &ib_query->trans, &ib_query->stmt, ib_query->dialect, in_sqlda)) {
IBDEBUG("Could not execute query... (_php_ibase_exec)");
_php_ibase_error();
IBDEBUG("Could not execute query");
_php_ibase_error(TSRMLS_C);
goto _php_ibase_exec_error;
}
@@ -1556,12 +1554,12 @@ PHP_FUNCTION(ibase_trans)
&& ib_link->trans[trans_n]; trans_n++)
;
if (trans_n == IBASE_TRANS_ON_LINK) {
_php_ibase_module_error("too many transactions on link");
_php_ibase_module_error("Too many transactions on link");
RETURN_FALSE;
}
if (isc_start_transaction(IB_STATUS, &ib_link->trans[trans_n], 1, &ib_link->link, tpb_len, tpbp)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -1580,7 +1578,7 @@ static int _php_ibase_def_trans(ibase_db_link * ib_link, int trans_n)
if (trans_n == 0 && ib_link->trans[0] == NULL) {
if (isc_start_transaction(IB_STATUS, &ib_link->trans[0], 1, &ib_link->link, 0, NULL)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
return FAILURE;
}
}
@@ -1622,12 +1620,12 @@ static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit)
if (commit) {
if (isc_commit_transaction(IB_STATUS, &ib_link->trans[trans_n])) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
} else {
if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[trans_n])) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
}
@@ -1695,7 +1693,7 @@ PHP_FUNCTION(ibase_query)
query = Z_STRVAL_PP(args[i]);
i++; /* next arg */
} else {
_php_ibase_module_error("query argument missed");
_php_ibase_module_error("Query argument missed");
efree(args);
RETURN_FALSE;
}
@@ -1896,7 +1894,7 @@ static int _php_ibase_arr_pval(pval *ar_pval, char **datap, ibase_array *ib_arra
if (dim > 16) { /* InterBase limit */
_php_ibase_module_error("php module internal error in %s %d", __FILE__, __LINE__);
_php_ibase_module_error("Too many dimensions");
return FAILURE;
}
@@ -1969,7 +1967,7 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
if (ib_result->out_sqlda == NULL) {
_php_ibase_module_error("trying to fetch results from a non-select query");
_php_ibase_module_error("Trying to fetch results from a non-select query");
RETURN_FALSE;
}
@@ -1978,7 +1976,7 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
}
if (IB_STATUS[0] && IB_STATUS[1]) { /* error in fetch */
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -2019,13 +2017,13 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
char bl_items[1], *bl_data, bl_info[20], *p;
if (isc_open_blob(IB_STATUS, &ib_result->link, &ib_result->trans, &bl_handle, (ISC_QUAD ISC_FAR *) var->sqldata)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
bl_items[0] = isc_info_blob_total_length;
if (isc_blob_info(IB_STATUS, &bl_handle, sizeof(bl_items), bl_items, sizeof(bl_info), bl_info)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -2049,20 +2047,20 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
cur_len += seg_len;
if (cur_len > max_len) { /* never!*/
efree(bl_data);
_php_ibase_module_error("php module internal error in %s %d", __FILE__, __LINE__);
_php_ibase_module_error("PHP module internal error");
RETURN_FALSE;
}
}
if (IB_STATUS[0] && IB_STATUS[1] && (IB_STATUS[1] != isc_segstr_eof)) {
efree(bl_data);
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
bl_data[cur_len] = '\0';
if (isc_close_blob(IB_STATUS, &bl_handle)) {
efree(bl_data);
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
Z_TYPE_P(tmp) = IS_STRING;
@@ -2097,7 +2095,7 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
if (isc_array_get_slice(IB_STATUS, &ib_result->link, &ib_result->trans,
&ar_qd, &ib_array->ar_desc, ar_data, &ib_array->ar_size)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -2279,7 +2277,7 @@ PHP_FUNCTION(ibase_execute)
IBDEBUG("Implicitly closing a cursor");
if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_close)){
efree(args);
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
}
}
@@ -2319,11 +2317,11 @@ PHP_FUNCTION(ibase_free_query)
}
/* }}} */
#if HAVE_STRFTIME
/* {{{ proto int ibase_timefmt(string format)
Sets the format of timestamp, date and time columns returned from queries */
PHP_FUNCTION(ibase_timefmt)
{
#if HAVE_STRFTIME
pval ***args;
char *fmt = NULL;
int type = PHP_IBASE_TIMESTAMP;
@@ -2370,12 +2368,9 @@ PHP_FUNCTION(ibase_timefmt)
efree(args);
RETURN_TRUE;
#else
_php_ibase_module_error("ibase_timefmt not supported on this platform");
RETURN_FALSE;
#endif
}
/* }}} */
#endif
/* {{{ proto int ibase_num_fields(int result)
Get the number of fields in result */
@@ -2393,7 +2388,7 @@ PHP_FUNCTION(ibase_num_fields)
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result, -1, "InterBase result", le_result);
if (ib_result->out_sqlda == NULL) {
_php_ibase_module_error("trying to get num fields from a non-select query");
_php_ibase_module_error("Trying to get the number of fields from a non-select query");
RETURN_FALSE;
}
@@ -2421,7 +2416,7 @@ PHP_FUNCTION(ibase_field_info)
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
if (ib_result->out_sqlda == NULL) {
_php_ibase_module_error("trying to get field info from a non-select query");
_php_ibase_module_error("Trying to get field info from a non-select query");
RETURN_FALSE;
}
@@ -2501,7 +2496,7 @@ static int _php_ibase_blob_info(isc_blob_handle bl_handle, IBASE_BLOBINFO *bl_in
bl_info->bl_stream = 0;
if (isc_blob_info(IB_STATUS, &bl_handle, sizeof(bl_items), bl_items, sizeof(bl_inf), bl_inf)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
return FAILURE;
}
@@ -2528,7 +2523,7 @@ static int _php_ibase_blob_info(isc_blob_handle bl_handle, IBASE_BLOBINFO *bl_in
break;
case isc_info_truncated:
case isc_info_error: /* hmm. don't think so...*/
_php_ibase_module_error("php module internal error in %s %d", __FILE__, __LINE__);
_php_ibase_module_error("PHP module internal error");
return FAILURE;
} /*switch*/
p += item_len;
@@ -2576,7 +2571,7 @@ PHP_FUNCTION(ibase_blob_create)
if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
efree(ib_blob);
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -2612,7 +2607,7 @@ PHP_FUNCTION(ibase_blob_open)
ib_blob->bl_handle = NULL;
if (isc_open_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
efree(ib_blob);
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -2638,7 +2633,7 @@ PHP_FUNCTION(ibase_blob_add)
convert_to_string(string_arg);
if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_P(string_arg), Z_STRVAL_P(string_arg))) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
RETURN_TRUE;
@@ -2675,7 +2670,7 @@ PHP_FUNCTION(ibase_blob_get)
cur_len += seg_len;
if (cur_len > max_len) { /* never!*/
efree(bl_data);
_php_ibase_module_error("php module internal error in %s %d", __FILE__, __LINE__);
_php_ibase_module_error("PHP module internal error");
RETURN_FALSE;
}
}
@@ -2683,7 +2678,7 @@ PHP_FUNCTION(ibase_blob_get)
bl_data[cur_len] = '\0';
if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof && IB_STATUS[1] != isc_segment)) {
efree(bl_data);
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
RETURN_STRINGL(bl_data, cur_len, 0);
@@ -2714,7 +2709,7 @@ static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end)
if (bl_end == BLOB_CLOSE) { /* return id here */
if (ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low) { /*not null ?*/
if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
}
@@ -2723,7 +2718,7 @@ static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end)
zend_list_delete(Z_LVAL_P(blob_arg));
} else { /* discard created blob */
if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
ib_blob->bl_handle = NULL;
@@ -2772,7 +2767,7 @@ PHP_FUNCTION(ibase_blob_info)
if (ib_blob_id->bl_qd.gds_quad_high || ib_blob_id->bl_qd.gds_quad_low) { /*not null ?*/
if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
&ib_blob_id->bl_handle, &ib_blob_id->bl_qd)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -2780,7 +2775,7 @@ PHP_FUNCTION(ibase_blob_info)
RETURN_FALSE;
}
if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
ib_blob_id->bl_handle = NULL;
@@ -2843,7 +2838,7 @@ PHP_FUNCTION(ibase_blob_echo)
if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
&ib_blob_id->bl_handle, &ib_blob_id->bl_qd)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -2853,12 +2848,12 @@ PHP_FUNCTION(ibase_blob_echo)
}
if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
ib_blob_id->bl_handle = NULL;
@@ -2924,7 +2919,7 @@ PHP_FUNCTION(ibase_blob_import)
ib_blob.bl_qd.gds_quad_low = 0;
if (isc_create_blob(IB_STATUS, &ib_blob.link, &ib_blob.trans_handle, &ib_blob.bl_handle, &ib_blob.bl_qd)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -2932,7 +2927,7 @@ PHP_FUNCTION(ibase_blob_import)
while(b = php_stream_read(stream, bl_data, sizeof(bl_data)) > 0) {
if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
size += b;
@@ -2940,7 +2935,7 @@ PHP_FUNCTION(ibase_blob_import)
}
if (isc_close_blob(IB_STATUS, &ib_blob.bl_handle)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
@@ -3044,7 +3039,7 @@ static void _php_ibase_user(INTERNAL_FUNCTION_PARAMETERS, int operation)
if (isc_service_attach(IB_STATUS, 0, service_name,
&service_handle, spb_length, spb_buffer)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
RETURN_FALSE;
}
else {
@@ -3090,7 +3085,7 @@ static void _php_ibase_user(INTERNAL_FUNCTION_PARAMETERS, int operation)
if (isc_service_start(IB_STATUS, &service_handle,
NULL, (unsigned short) (p - request), request)) {
_php_ibase_error();
_php_ibase_error(TSRMLS_C);
isc_service_detach(IB_STATUS, &service_handle);
RETURN_FALSE;
}
+3 -3
View File
@@ -2,12 +2,12 @@
$(srcdir)/java.c : $(srcdir)/php_java.jar
$(srcdir)/php_java.jar : $(srcdir)/reflect.java
$(mkinstalldirs) $(srcdir)/net/php
@$(mkinstalldirs) $(srcdir)/net/php
@cp $(srcdir)/reflect.java $(srcdir)/net/php
@echo library=php_java > $(srcdir)/net/php/reflect.properties
$(JAVA_C) $(srcdir)/net/php/reflect.java
@$(JAVA_C) $(srcdir)/net/php/reflect.java
@test ! -f reflect.class || mv reflect.class $(srcdir)/net/php # bug in KJC javac
$(JAVA_JAR) $(srcdir)/php_java.jar $(srcdir)/net/php/*.class $(srcdir)/net/php/*.properties
@$(JAVA_JAR) $(srcdir)/php_java.jar $(srcdir)/net/php/*.class $(srcdir)/net/php/*.properties
@rm $(srcdir)/net/php/reflect.*
@rmdir $(srcdir)/net/php
@rmdir $(srcdir)/net
+3 -2
View File
@@ -103,6 +103,7 @@ if test "$PHP_LDAP" != "no"; then
fi
CPPFLAGS=$_SAVE_CPPFLAGS
dnl Solaris 2.8 claims to be 2004 API, but doesn't have ldap_parse_reference
AC_CHECK_FUNCS(ldap_parse_reference)
dnl Solaris 2.8 claims to be 2004 API, but doesn't have
dnl ldap_parse_reference() nor ldap_start_tls_s()
AC_CHECK_FUNCS([ldap_parse_reference ldap_start_tls_s])
fi
+88 -144
View File
@@ -119,13 +119,14 @@ function_entry ldap_functions[] = {
PHP_FE(ldap_parse_result, arg3to6of6_force_ref)
PHP_FE(ldap_first_reference, NULL)
PHP_FE(ldap_next_reference, NULL)
#ifdef HAVE_LDAP_PARSE_REFERENCE
PHP_FE(ldap_parse_reference, third_argument_force_ref)
PHP_FE(ldap_rename, NULL)
#endif
#if LDAP_API_VERSION > 2000
PHP_FE(ldap_rename, NULL)
#ifdef HAVE_LDAP_START_TLS_S
PHP_FE(ldap_start_tls, NULL)
#endif
#endif
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
PHP_FE(ldap_set_rebind_proc, NULL)
@@ -225,7 +226,9 @@ PHP_MINIT_FUNCTION(ldap)
REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS);
#ifdef LDAP_OPT_RESTART
REGISTER_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS);
#endif
REGISTER_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS);
#ifdef LDAP_OPT_MATCHED_DN
@@ -333,75 +336,37 @@ PHP_MINFO_FUNCTION(ldap)
PHP_FUNCTION(ldap_connect)
{
char *host = NULL;
int hostlen;
int port = 389; /* Default port */
#ifdef HAVE_ORALDAP
char *wallet, *walletpasswd;
int walletlen, walletpasswdlen;
int authmode;
int ssl=0;
#endif
ldap_linkdata *ld;
LDAP *ldap;
switch(ZEND_NUM_ARGS()) {
case 0:
break;
case 1: {
pval **yyhost;
if (zend_get_parameters_ex(1, &yyhost) == FAILURE) {
RETURN_FALSE;
}
convert_to_string_ex(yyhost);
host = Z_STRVAL_PP(yyhost);
}
break;
case 2: {
pval **yyhost, **yyport;
if (zend_get_parameters_ex(2, &yyhost, &yyport) == FAILURE) {
RETURN_FALSE;
}
convert_to_string_ex(yyhost);
host = Z_STRVAL_PP(yyhost);
convert_to_long_ex(yyport);
port = Z_LVAL_PP(yyport);
}
break;
#ifdef HAVE_ORALDAP
case 5: {
pval **yyhost, **yyport, **yywallet, **yywalletpasswd, **yyauthmode;
if (zend_get_parameters_ex(5, &yyhost, &yyport, &yywallet, &yywalletpasswd, &yyauthmode) == FAILURE) {
RETURN_FALSE;
}
convert_to_string_ex(yyhost);
convert_to_long_ex(yyport);
convert_to_string_ex(yywallet);
convert_to_string_ex(yywalletpasswd);
convert_to_long_ex(yyauthmode);
host = Z_STRVAL_PP(yyhost);
port = Z_LVAL_PP(yyport);
wallet = Z_STRVAL_PP(yywallet);
walletpasswd = Z_STRVAL_PP(yywalletpasswd);
authmode = Z_LVAL_PP(yyauthmode);
ssl = 1;
}
break;
#endif
default:
WRONG_PARAM_COUNT;
break;
if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) {
WRONG_PARAM_COUNT;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() == 5 ) {
ssl = 1;
}
#else
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &host, &hostlen, &port) == FAILURE) {
RETURN_FALSE;
}
#endif
if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) {
php_error(E_WARNING, "LDAP: Too many open links (%d)", LDAPG(num_links));
php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), LDAPG(num_links));
RETURN_FALSE;
}
@@ -416,7 +381,7 @@ PHP_FUNCTION(ldap_connect)
rc = ldap_initialize(&ldap, host);
if (rc != LDAP_SUCCESS) {
php_error(E_WARNING, "Could not create LDAP session handle (%d): %s\n", rc, ldap_err2string(rc));
php_error(E_WARNING, "%s(): Could not create session handle: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc));
RETURN_FALSE;
}
} else {
@@ -432,7 +397,7 @@ PHP_FUNCTION(ldap_connect)
#ifdef HAVE_ORALDAP
if (ssl) {
if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) {
php_error(E_WARNING, "LDAP: SSL init failed");
php_error(E_WARNING, "%s(): SSL init failed", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
}
@@ -469,43 +434,20 @@ static int _get_lderrno(LDAP *ldap)
Bind to LDAP directory */
PHP_FUNCTION(ldap_bind)
{
pval **link, **bind_rdn, **bind_pw;
char *ldap_bind_rdn, *ldap_bind_pw;
zval *link;
char *ldap_bind_dn = NULL, *ldap_bind_pw = NULL;
int ldap_bind_dnlen, ldap_bind_pwlen;
ldap_linkdata *ld;
int rc;
switch(ZEND_NUM_ARGS()) {
case 1: /* Anonymous Bind */
if (zend_get_parameters_ex(1, &link) == FAILURE) {
WRONG_PARAM_COUNT;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ss", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen) == FAILURE) {
RETURN_FALSE;
}
ldap_bind_rdn = NULL;
ldap_bind_pw = NULL;
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
break;
case 3 :
if (zend_get_parameters_ex(3, &link, &bind_rdn, &bind_pw) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(bind_rdn);
convert_to_string_ex(bind_pw);
ldap_bind_rdn = Z_STRVAL_PP(bind_rdn);
ldap_bind_pw = Z_STRVAL_PP(bind_pw);
break;
default:
WRONG_PARAM_COUNT;
break;
}
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
if (ldap_bind_s(ld->link, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
php_error(E_WARNING, "LDAP: Unable to bind to server: %s", ldap_err2string(_get_lderrno(ld->link)));
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): Unable to bind to server: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc));
RETURN_FALSE;
} else {
RETURN_TRUE;
@@ -517,16 +459,16 @@ PHP_FUNCTION(ldap_bind)
Unbind from LDAP directory */
PHP_FUNCTION(ldap_unbind)
{
pval **link;
zval *link;
ldap_linkdata *ld;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) {
WRONG_PARAM_COUNT;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
zend_list_delete(Z_LVAL_PP(link));
zend_list_delete(Z_LVAL_P(link));
RETURN_TRUE;
}
/* }}} */
@@ -606,19 +548,19 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
case 4 :
if (Z_TYPE_PP(attrs) != IS_ARRAY) {
php_error(E_WARNING, "LDAP: Expected Array as last element");
php_error(E_WARNING, "%s(): Expected Array as last element", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs));
if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) {
php_error(E_WARNING, "LDAP: Could not allocate memory");
php_error(E_WARNING, "%s(): Could not allocate memory", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
for(i=0; i<num_attribs; i++) {
if(zend_hash_index_find(Z_ARRVAL_PP(attrs), i, (void **) &attr) == FAILURE) {
php_error(E_WARNING, "LDAP: Array initialization wrong");
php_error(E_WARNING, "%s(): Array initialization wrong", get_active_function_name(TSRMLS_C));
efree(ldap_attrs);
RETURN_FALSE;
}
@@ -652,7 +594,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
nlinks = zend_hash_num_elements(Z_ARRVAL_PP(link));
if (nlinks == 0) {
php_error(E_WARNING, "LDAP: No links in link array");
php_error(E_WARNING, "%s(): No links in link array", get_active_function_name(TSRMLS_C));
if (ldap_attrs != NULL) {
efree(ldap_attrs);
}
@@ -662,7 +604,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
if (Z_TYPE_PP(base_dn) == IS_ARRAY) {
nbases = zend_hash_num_elements(Z_ARRVAL_PP(base_dn));
if (nbases != nlinks) {
php_error(E_WARNING, "LDAP: Base must either be a string, or an array with the same number of elements as the links array");
php_error(E_WARNING, "%s(): Base must either be a string, or an array with the same number of elements as the links array", get_active_function_name(TSRMLS_C));
if (ldap_attrs != NULL) {
efree(ldap_attrs);
}
@@ -678,7 +620,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
if (Z_TYPE_PP(filter) == IS_ARRAY) {
nfilters = zend_hash_num_elements(Z_ARRVAL_PP(filter));
if (nfilters != nlinks) {
php_error(E_WARNING, "LDAP: Filter must either be a string, or an array with the same number of elements as the links array");
php_error(E_WARNING, "%s(): Filter must either be a string, or an array with the same number of elements as the links array", get_active_function_name(TSRMLS_C));
if (ldap_attrs != NULL) {
efree(ldap_attrs);
}
@@ -787,15 +729,15 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
&& errno != LDAP_REFERRAL
#endif
) {
php_error(E_WARNING, "LDAP: Unable to perform the search: %s", ldap_err2string(_get_lderrno(ld->link)));
php_error(E_WARNING, "%s(): Search: %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno));
RETVAL_FALSE;
} else {
if (errno == LDAP_SIZELIMIT_EXCEEDED) {
php_error(E_WARNING, "LDAP: Partial search results returned: Sizelimit exceeded.");
php_error(E_WARNING, "%s(): Partial search results returned: Sizelimit exceeded.", get_active_function_name(TSRMLS_C));
}
#ifdef LDAP_ADMINLIMIT_EXCEEDED
else if (errno == LDAP_ADMINLIMIT_EXCEEDED) {
php_error(E_WARNING, "LDAP: Partial search results returned: Adminlimit exceeded.");
php_error(E_WARNING, "%s(): Partial search results returned: Adminlimit exceeded.", get_active_function_name(TSRMLS_C));
}
#endif
@@ -1148,7 +1090,7 @@ PHP_FUNCTION(ldap_get_values)
attribute = Z_STRVAL_PP(attr);
if ((ldap_value = ldap_get_values(ld->link, resultentry->data, attribute)) == NULL) {
php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link)));
php_error(E_WARNING, "%s(): Cannot get the value(s) of attribute %s", get_active_function_name(TSRMLS_C), ldap_err2string(_get_lderrno(ld->link)));
RETURN_FALSE;
}
@@ -1190,13 +1132,13 @@ PHP_FUNCTION(ldap_get_values_len)
attribute = Z_STRVAL_PP(attr);
if ((ldap_value_len = ldap_get_values_len(ld->link, resultentry->data, attribute)) == NULL) {
php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link)));
php_error(E_WARNING, "%s(): Cannot get the value(s) of attribute %s", get_active_function_name(TSRMLS_C), ldap_err2string(_get_lderrno(ld->link)));
RETURN_FALSE;
}
num_values = ldap_count_values_len(ldap_value_len);
if (array_init(return_value) == FAILURE) {
php_error(E_ERROR, "Cannot initialize return value");
php_error(E_ERROR, "%s(): Cannot initialize return value", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1322,7 +1264,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
}
if (Z_TYPE_PP(entry) != IS_ARRAY) {
php_error(E_WARNING, "LDAP: Expected Array as the last element");
php_error(E_WARNING, "%s(): Expected Array as the last element", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1350,7 +1292,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
if (zend_hash_get_current_key(Z_ARRVAL_PP(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) {
ldap_mods[i]->mod_type = estrdup(attribute);
} else {
php_error(E_ERROR, "LDAP: Unknown Attribute in the data");
php_error(E_ERROR, "%s(): Unknown attribute in the data", get_active_function_name(TSRMLS_C));
/* Free allocated memory */
while (i >= 0) {
efree(ldap_mods[i--]);
@@ -1380,7 +1322,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
} else {
for(j=0; j < num_values; j++) {
if (zend_hash_index_find(Z_ARRVAL_PP(value), j, (void **) &ivalue) == FAILURE) {
php_error(E_WARNING, "LDAP: Value array must have consecutive indices 0, 1, ...");
php_error(E_WARNING, "%s(): Value array must have consecutive indices 0, 1, ...", get_active_function_name(TSRMLS_C));
num_berval[i] = j;
num_attribs = i + 1;
RETVAL_FALSE;
@@ -1399,14 +1341,13 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
/* check flag to see if do_mod was called to perform full add , gerrit thomson */
if (is_full_add == 1) {
if (ldap_add_s(ld->link, ldap_dn, ldap_mods) != LDAP_SUCCESS) {
ldap_perror(ld->link, "LDAP");
php_error(E_WARNING, "LDAP: add operation could not be completed.");
if ((i = ldap_add_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): Add: %s", get_active_function_name(TSRMLS_C), ldap_err2string(i));
RETVAL_FALSE;
} else RETVAL_TRUE;
} else {
if (ldap_modify_s(ld->link, ldap_dn, ldap_mods) != LDAP_SUCCESS) {
php_error(E_WARNING, "LDAP: modify operation could not be completed.");
if ((i = ldap_modify_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): Modify: %s", get_active_function_name(TSRMLS_C), ldap_err2string(i));
RETVAL_FALSE;
} else RETVAL_TRUE;
}
@@ -1469,6 +1410,7 @@ PHP_FUNCTION(ldap_delete)
pval **link, **dn;
ldap_linkdata *ld;
char *ldap_dn;
int rc;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &dn) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1479,8 +1421,8 @@ PHP_FUNCTION(ldap_delete)
convert_to_string_ex(dn);
ldap_dn = Z_STRVAL_PP(dn);
if (ldap_delete_s(ld->link, ldap_dn) != LDAP_SUCCESS) {
ldap_perror(ld->link, "LDAP");
if ((rc = ldap_delete_s(ld->link, ldap_dn)) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): Delete: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc));
RETURN_FALSE;
}
@@ -1575,7 +1517,7 @@ PHP_FUNCTION(ldap_compare)
break;
}
php_error(E_WARNING, "LDAP: Compare operation could not be completed: %s", ldap_err2string(errno));
php_error(E_WARNING, "%s(): Compare: %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno));
RETURN_LONG(-1);
}
@@ -1598,12 +1540,12 @@ PHP_FUNCTION(ldap_sort)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
if (zend_hash_index_find(&EG(regular_list), Z_LVAL_P(result), (void **) &le) == FAILURE || le->type != le_result) {
php_error(E_WARNING, "Supplied resource is not a valid ldap result resource");
php_error(E_WARNING, "%s(): Supplied resource is not a valid ldap result resource", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) {
php_error(E_WARNING, "LDAP sort failed: %s", ldap_err2string(errno));
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno));
RETURN_FALSE;
}
@@ -1639,7 +1581,9 @@ PHP_FUNCTION(ldap_get_option)
case LDAP_OPT_PROTOCOL_VERSION:
case LDAP_OPT_ERROR_NUMBER:
case LDAP_OPT_REFERRALS:
#ifdef LDAP_OPT_RESTART
case LDAP_OPT_RESTART:
#endif
{
int val;
if (ldap_get_option(ld->link, opt, &val)) {
@@ -1734,7 +1678,9 @@ PHP_FUNCTION(ldap_set_option)
} break;
/* options with boolean value */
case LDAP_OPT_REFERRALS:
#ifdef LDAP_OPT_RESTART
case LDAP_OPT_RESTART:
#endif
{
void *val;
convert_to_boolean_ex(newval);
@@ -1754,7 +1700,7 @@ PHP_FUNCTION(ldap_set_option)
char error=0;
if ((Z_TYPE_PP(newval) != IS_ARRAY) || !(ncontrols = zend_hash_num_elements(Z_ARRVAL_PP(newval)))) {
php_error(E_WARNING, "Expected non-empty array value for this option");
php_error(E_WARNING, "%s(): Expected non-empty array value for this option", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
ctrls = emalloc((1 + ncontrols) * sizeof(*ctrls));
@@ -1763,12 +1709,12 @@ PHP_FUNCTION(ldap_set_option)
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(newval));
while (zend_hash_get_current_data(Z_ARRVAL_PP(newval), (void**)&ctrlval) == SUCCESS) {
if (Z_TYPE_PP(ctrlval) != IS_ARRAY) {
php_error(E_WARNING, "The array value must contain only arrays, where each array is a control");
php_error(E_WARNING, "%s(): The array value must contain only arrays, where each array is a control", get_active_function_name(TSRMLS_C));
error = 1;
break;
}
if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "oid", sizeof("oid"), (void **) &val) == FAILURE) {
php_error(E_WARNING, "Control must have an oid key");
php_error(E_WARNING, "%s(): Control must have an oid key", get_active_function_name(TSRMLS_C));
error = 1;
break;
}
@@ -1839,7 +1785,7 @@ PHP_FUNCTION(ldap_parse_result)
NULL /* &serverctrls */,
0 );
if (rc != LDAP_SUCCESS ) {
php_error(E_WARNING, "LDAP: Unable to parse result: %s", ldap_err2string(_get_lderrno(ld->link)));
php_error(E_WARNING, "%s(): Unable to parse result: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc));
RETURN_FALSE;
}
@@ -1851,7 +1797,7 @@ PHP_FUNCTION(ldap_parse_result)
case 6 :
zval_dtor(*referrals);
if (array_init(*referrals) == FAILURE) {
php_error(E_ERROR, "Cannot initialize return value");
php_error(E_ERROR, "%s(): Cannot initialize return value", get_active_function_name(TSRMLS_C));
ldap_value_free(lreferrals);
ldap_memfree(lerrmsg);
ldap_memfree(lmatcheddn);
@@ -1942,11 +1888,11 @@ PHP_FUNCTION(ldap_next_reference)
}
/* }}} */
#ifdef HAVE_LDAP_PARSE_REFERENCE
/* {{{ proto bool ldap_parse_reference(resource link, resource reference_entry, array referrals)
Extract information from reference entry */
PHP_FUNCTION(ldap_parse_reference)
{
#ifdef HAVE_LDAP_PARSE_REFERENCE
pval **link, **result_entry, **referrals;
ldap_linkdata *ld;
ldap_resultentry *resultentry;
@@ -1965,7 +1911,7 @@ PHP_FUNCTION(ldap_parse_reference)
zval_dtor(*referrals);
if (array_init(*referrals) == FAILURE) {
php_error(E_ERROR, "Cannot initialize return value");
php_error(E_ERROR, "%s(): Cannot initialize return value", get_active_function_name(TSRMLS_C));
ldap_value_free(lreferrals);
RETURN_FALSE;
}
@@ -1978,12 +1924,9 @@ PHP_FUNCTION(ldap_parse_reference)
ldap_value_free(lreferrals);
}
RETURN_TRUE;
#else
php_error(E_ERROR, "ldap_parse_reference not available in this LDAP lib");
RETURN_FALSE;
#endif
}
/* }}} */
#endif
/* {{{ proto bool ldap_rename(resource link, string dn, string newrdn, string newparent, boolean deleteoldrdn);
Modify the name of an entry */
@@ -2008,7 +1951,7 @@ PHP_FUNCTION(ldap_rename)
rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_STRVAL_PP(newparent), Z_BVAL_PP(deleteoldrdn), NULL, NULL);
#else
if (Z_STRLEN_PP(newparent) != 0) {
php_error(E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN");
php_error(E_WARNING, "%s(): You are using old LDAP API, newparent must be the empty string, can only modify RDN", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
/* could support old APIs but need check for ldap_modrdn2()/ldap_modrdn() */
@@ -2021,15 +1964,15 @@ PHP_FUNCTION(ldap_rename)
RETURN_FALSE;
}
/* }}} */
#endif
#if LDAP_API_VERSION > 2000
#ifdef HAVE_LDAP_START_TLS_S
/* {{{ proto bool ldap_start_tls(resource link)
Start TLS */
PHP_FUNCTION(ldap_start_tls)
{
pval **link;
ldap_linkdata *ld;
int rc;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2037,9 +1980,8 @@ PHP_FUNCTION(ldap_start_tls)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
if (ldap_start_tls_s(ld->link, NULL, NULL) != LDAP_SUCCESS) {
php_error(E_WARNING,"LDAP: Unable to start TLS: %s",
ldap_err2string(_get_lderrno(ld->link)));
if ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) {
php_error(E_WARNING,"%s(): Unable to start TLS: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc));
RETURN_FALSE;
} else {
RETURN_TRUE;
@@ -2047,6 +1989,7 @@ PHP_FUNCTION(ldap_start_tls)
}
/* }}} */
#endif
#endif /* ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP */
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
@@ -2057,6 +2000,7 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi
zval **cb_args[2];
zval *cb_retval;
zval *cb_link = (zval *) params;
TSRMLS_FETCH();
ld = (ldap_linkdata *) zend_fetch_resource(&cb_link TSRMLS_CC, -1, "ldap link", NULL, 1, le_link);
@@ -2076,7 +2020,7 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi
retval = Z_LVAL_P(cb_retval);
zval_ptr_dtor(&cb_retval);
} else {
php_error(E_WARNING, "LDAP: rebind_proc php callback failed");
php_error(E_WARNING, "%s(): rebind_proc PHP callback failed", get_active_function_name(TSRMLS_C));
retval = LDAP_OTHER;
}
zval_dtor(cb_url);
@@ -2111,7 +2055,7 @@ PHP_FUNCTION(ldap_set_rebind_proc)
/* callable? */
if (!zend_is_callable(callback, 0, &callback_name)) {
php_error(E_WARNING, "%s() expects argument 2, '%s', to be a valid callback", get_active_function_name(TSRMLS_C), callback_name);
php_error(E_WARNING, "%s(): Two arguments expected for '%s' to be a valid callback", get_active_function_name(TSRMLS_C), callback_name);
efree(callback_name);
RETURN_FALSE;
}
@@ -2164,7 +2108,7 @@ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way)
RETVAL_STRINGL(ldap_buf, ldap_len, 1);
free(ldap_buf);
} else {
php_error(E_ERROR, "LDAP: Conversion from iso-8859-1 to t61 failed.");
php_error(E_ERROR, "%s(): Conversion from iso-8859-1 to t61 failed: %s", get_active_function_name(TSRMLS_C), ldap_err2string(result));
RETVAL_FALSE;
}
+13 -11
View File
@@ -2,14 +2,8 @@ dnl
dnl $Id$
dnl
PHP_ARG_ENABLE(mbstr_enc_trans, whether to enable encoding translation,
[ --enable-mbstr-enc-trans Enable encoding translation], yes)
PHP_ARG_ENABLE(mbregex, whether to enable multibyte regex support,
[ --enable-mbregex Enable multibyte regex support], yes)
PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support,
[ --disable-mbstring Disable multibyte string support], yes)
[ --disable-mbstring Disable multibyte string support], yes)
if test "$PHP_MBSTRING" != "no"; then
AC_DEFINE(HAVE_MBSTRING,1,[whether to have multibyte string support])
@@ -36,15 +30,23 @@ if test "$PHP_MBSTRING" != "no"; then
AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support])
AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support])
fi
PHP_NEW_EXTENSION(mbstring, mbfilter_ja.c mbfilter_cn.c mbfilter_tw.c mbfilter_kr.c mbfilter_ru.c mbfilter.c mbstring.c mbregex.c php_mbregex.c, $ext_shared)
PHP_NEW_EXTENSION(mbstring, mbfilter_ja.c mbfilter_cn.c mbfilter_tw.c mbfilter_kr.c mbfilter_ru.c mbfilter.c mbstring.c mbregex.c php_mbregex.c html_entities.c, $ext_shared)
else
PHP_MBSTR_ENC_TRANS=no
fi
PHP_ARG_ENABLE(mbregex, whether to enable multibyte regex support,
[ --disable-mbregex Disable multibyte regex support], yes)
if test "$MBREGEX" != "no" ; then
AC_DEFINE(HAVE_MBREGEX, 1, [whether to have multibyte regex support])
fi
PHP_ARG_ENABLE(mbstr_enc_trans, whether to enable encoding translation,
[ --enable-mbstr-enc-trans Enable input encoding translation], no)
if test "$PHP_MBSTR_ENC_TRANS" != "no" ; then
AC_DEFINE(MBSTR_ENC_TRANS, 1, [whether to have encoding translation])
fi
if test "$MBREGEX" != "no" ; then
AC_DEFINE(HAVE_MBREGEX, 1, [whether to have multibyte regex support])
fi
+291
View File
@@ -0,0 +1,291 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 2001 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_globals.h"
#include <stdlib.h>
#include "mbfilter.h"
const mbfl_html_entity mbfl_html_entity_list[] = { /*
{"quot", 34}, DO NOT CONVERT THESE AUTOMATICALLY
{"amp", 38},
{"lt", 60},
{"gt", 62}, */
{"nbsp", 160},
{"iexcl", 161},
{"cent", 162},
{"pound", 163},
{"curren", 164},
{"yen", 165},
{"brvbar", 166},
{"sect", 167},
{"uml", 168},
{"copy", 169},
{"ordf", 170},
{"laquo", 171},
{"not", 172},
{"shy", 173},
{"reg", 174},
{"macr", 175},
{"deg", 176},
{"plusmn", 177},
{"sup2", 178},
{"sup3", 179},
{"acute", 180},
{"micro", 181},
{"para", 182},
{"middot", 183},
{"cedil", 184},
{"sup1", 185},
{"ordm", 186},
{"raquo", 187},
{"frac14", 188},
{"frac12", 189},
{"frac34", 190},
{"iquest", 191},
{"Agrave", 192},
{"Aacute", 193},
{"Acirc", 194},
{"Atilde", 195},
{"Auml", 196},
{"Aring", 197},
{"AElig", 198},
{"Ccedil", 199},
{"Egrave", 200},
{"Eacute", 201},
{"Ecirc", 202},
{"Euml", 203},
{"Igrave", 204},
{"Iacute", 205},
{"Icirc", 206},
{"Iuml", 207},
{"ETH", 208},
{"Ntilde", 209},
{"Ograve", 210},
{"Oacute", 211},
{"Ocirc", 212},
{"Otilde", 213},
{"Ouml", 214},
{"times", 215},
{"Oslash", 216},
{"Ugrave", 217},
{"Uacute", 218},
{"Ucirc", 219},
{"Uuml", 220},
{"Yacute", 221},
{"THORN", 222},
{"szlig", 223},
{"agrave", 224},
{"aacute", 225},
{"acirc", 226},
{"atilde", 227},
{"auml", 228},
{"aring", 229},
{"aelig", 230},
{"ccedil", 231},
{"egrave", 232},
{"eacute", 233},
{"ecirc", 234},
{"euml", 235},
{"igrave", 236},
{"iacute", 237},
{"icirc", 238},
{"iuml", 239},
{"eth", 240},
{"ntilde", 241},
{"ograve", 242},
{"oacute", 243},
{"ocirc", 244},
{"otilde", 245},
{"ouml", 246},
{"divide", 247},
{"oslash", 248},
{"ugrave", 249},
{"uacute", 250},
{"ucirc", 251},
{"uuml", 252},
{"yacute", 253},
{"thorn", 254},
{"yuml", 255},
{"OElig", 338},
{"oelig", 339},
{"Scaron", 352},
{"scaron", 353},
{"Yuml", 376},
{"fnof", 402},
{"circ", 710},
{"tilde", 732},
{"Alpha", 913},
{"Beta", 914},
{"Gamma", 915},
{"Delta", 916},
{"Epsilon", 917},
{"Zeta", 918},
{"Eta", 919},
{"Theta", 920},
{"Iota", 921},
{"Kappa", 922},
{"Lambda", 923},
{"Mu", 924},
{"Nu", 925},
{"Xi", 926},
{"Omicron", 927},
{"Pi", 928},
{"Rho", 929},
{"Sigma", 931},
{"Tau", 932},
{"Upsilon", 933},
{"Phi", 934},
{"Chi", 935},
{"Psi", 936},
{"Omega", 937},
{"beta", 946},
{"gamma", 947},
{"delta", 948},
{"epsilon", 949},
{"zeta", 950},
{"eta", 951},
{"theta", 952},
{"iota", 953},
{"kappa", 954},
{"lambda", 955},
{"mu", 956},
{"nu", 957},
{"xi", 958},
{"omicron", 959},
{"pi", 960},
{"rho", 961},
{"sigmaf", 962},
{"sigma", 963},
{"tau", 964},
{"upsilon", 965},
{"phi", 966},
{"chi", 967},
{"psi", 968},
{"omega", 969},
{"thetasym", 977},
{"upsih", 978},
{"piv", 982},
{"ensp", 8194},
{"emsp", 8195},
{"thinsp", 8201},
{"zwnj", 8204},
{"zwj", 8205},
{"lrm", 8206},
{"rlm", 8207},
{"ndash", 8211},
{"mdash", 8212},
{"lsquo", 8216},
{"rsquo", 8217},
{"sbquo", 8218},
{"ldquo", 8220},
{"rdquo", 8221},
{"bdquo", 8222},
{"dagger", 8224},
{"Dagger", 8225},
{"bull", 8226},
{"hellip", 8230},
{"permil", 8240},
{"prime", 8242},
{"Prime", 8243},
{"lsaquo", 8249},
{"rsaquo", 8250},
{"oline", 8254},
{"frasl", 8260},
{"euro", 8364},
{"weierp", 8472},
{"image", 8465},
{"real", 8476},
{"trade", 8482},
{"alefsym", 8501},
{"larr", 8592},
{"uarr", 8593},
{"rarr", 8594},
{"darr", 8595},
{"harr", 8596},
{"crarr", 8629},
{"lArr", 8656},
{"uArr", 8657},
{"rArr", 8658},
{"dArr", 8659},
{"hArr", 8660},
{"forall", 8704},
{"part", 8706},
{"exist", 8707},
{"empty", 8709},
{"nabla", 8711},
{"isin", 8712},
{"notin", 8713},
{"ni", 8715},
{"prod", 8719},
{"sum", 8721},
{"minus", 8722},
{"lowast", 8727},
{"radic", 8730},
{"prop", 8733},
{"infin", 8734},
{"ang", 8736},
{"and", 8743},
{"or", 8744},
{"cap", 8745},
{"cup", 8746},
{"int", 8747},
{"there4", 8756},
{"sim", 8764},
{"cong", 8773},
{"asymp", 8776},
{"ne", 8800},
{"equiv", 8801},
{"le", 8804},
{"ge", 8805},
{"sub", 8834},
{"sup", 8835},
{"nsub", 8836},
{"sube", 8838},
{"supe", 8839},
{"oplus", 8853},
{"otimes", 8855},
{"perp", 8869},
{"sdot", 8901},
{"lceil", 8968},
{"rceil", 8969},
{"lfloor", 8970},
{"rfloor", 8971},
{"lang", 9001},
{"rang", 9002},
{"loz", 9674},
{"spades", 9824},
{"clubs", 9827},
{"hearts", 9829},
{"diams", 9830},
{NULL, -1} /* mark end of table */
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
+488 -240
View File
File diff suppressed because it is too large. Load diff
+24 -12
View File
@@ -128,6 +128,7 @@ enum mbfl_no_encoding {
mbfl_no_encoding_byte4le,
mbfl_no_encoding_base64,
mbfl_no_encoding_uuencode,
mbfl_no_encoding_html_ent,
mbfl_no_encoding_qprint,
mbfl_no_encoding_7bit,
mbfl_no_encoding_8bit,
@@ -221,7 +222,8 @@ typedef struct _mbfl_encoding {
#define MBFL_ENCTYPE_WCS4LE 0x00000200
#define MBFL_ENCTYPE_MWC4BE 0x00000400
#define MBFL_ENCTYPE_MWC4LE 0x00000800
#define MBFL_ENCTYPE_SHFTCODE 0x00001000
#define MBFL_ENCTYPE_SHFTCODE 0x00001000
#define MBFL_ENCTYPE_HTML_ENT 0x00002000
/* wchar plane, special charactor */
#define MBFL_WCSPLANE_MASK 0xffff
@@ -277,8 +279,8 @@ void mbfl_string_clear(mbfl_string *string);
/*
* language resolver
*/
mbfl_language * mbfl_name2language(const char *name);
mbfl_language * mbfl_no2language(enum mbfl_no_language no_language);
const mbfl_language * mbfl_name2language(const char *name);
const mbfl_language * mbfl_no2language(enum mbfl_no_language no_language);
enum mbfl_no_language mbfl_name2no_language(const char *name);
const char * mbfl_no_language2name(enum mbfl_no_language no_language);
@@ -286,8 +288,8 @@ const char * mbfl_no_language2name(enum mbfl_no_language no_language);
/*
* encoding resolver
*/
mbfl_encoding * mbfl_name2encoding(const char *name);
mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding);
const mbfl_encoding * mbfl_name2encoding(const char *name);
const mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding);
enum mbfl_no_encoding mbfl_name2no_encoding(const char *name);
const char * mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding);
const char * mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding);
@@ -348,8 +350,8 @@ struct _mbfl_convert_filter {
void *data;
int status;
int cache;
mbfl_encoding *from;
mbfl_encoding *to;
const mbfl_encoding *from;
const mbfl_encoding *to;
int illegal_mode;
int illegal_substchar;
};
@@ -390,7 +392,7 @@ struct _mbfl_identify_filter {
int status;
int flag;
int score;
mbfl_encoding *encoding;
const mbfl_encoding *encoding;
};
struct mbfl_identify_vtbl {
@@ -413,8 +415,8 @@ struct _mbfl_buffer_converter {
mbfl_convert_filter *filter1;
mbfl_convert_filter *filter2;
mbfl_memory_device device;
mbfl_encoding *from;
mbfl_encoding *to;
const mbfl_encoding *from;
const mbfl_encoding *to;
};
mbfl_buffer_converter * mbfl_buffer_converter_new(enum mbfl_no_encoding from, enum mbfl_no_encoding to, int buf_initsz TSRMLS_DC);
@@ -456,13 +458,13 @@ mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, enum mbfl_no_enc
/*
* identify encoding
*/
mbfl_encoding *
const mbfl_encoding *
mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
const char *
mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
enum mbfl_no_encoding
const enum mbfl_no_encoding
mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz TSRMLS_DC);
/*
@@ -574,4 +576,14 @@ mbfl_html_numeric_entity(mbfl_string *string, mbfl_string *result, int *convmap,
mbfl_string *
mbfl_ja_jp_hantozen(mbfl_string *string, mbfl_string *result, int mode TSRMLS_DC);
/*
* HTML Entity table
*/
typedef struct _mbfl_html_entity {
char * name;
int code;
} mbfl_html_entity;
extern const mbfl_html_entity mbfl_html_entity_list[];
#endif /* MBFL_MBFILTER_H */
+21 -7
View File
@@ -297,17 +297,19 @@ int *retlen;
return retval;
}
#define rt re_syntax_table
static void
init_syntax_once()
{
register int c;
static int done = 0;
register int c;
static int done = 0;
char *s = emalloc(10240), *sp;
int ch;
if (done)
return;
memset(re_syntax_table, 0, sizeof re_syntax_table);
memset(re_syntax_table, 0, sizeof(re_syntax_table));
for (c=0; c<=0x7f; c++)
if (isalnum(c))
@@ -318,6 +320,18 @@ init_syntax_once()
if (isalnum(c))
re_syntax_table[c] = Sword2;
done = 1;
sp = s;
sprintf(sp, "static const char re_syntax_table[256] = {\n");
for(ch =0; ch < 256;) {
sp = s+strlen(s);
sprintf(sp, "\t% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,\n", rt[ch+0], rt[ch+1], rt[ch+2], rt[ch+3], rt[ch+4], rt[ch+5], rt[ch+6], rt[ch+7], rt[ch+8], rt[ch+9], rt[ch+10], rt[ch+11], rt[ch+12], rt[ch+13], rt[ch+14], rt[ch+15]);
ch += 16;
}
sprintf(sp, "};");
php_error(E_NOTICE,"reverse_table:\n%s", s);
efree(s);
}
void
@@ -633,7 +647,7 @@ print_mbc(c)
/* Make sure we have at least N more bytes of space in buffer. */
#define GET_BUFFER_SPACE(n) \
do { \
while (b - bufp->buffer + (n) >= bufp->allocated) \
while (b - bufp->buffer + (size_t)(n) >= (size_t)bufp->allocated) \
EXTEND_BUFFER; \
} while (0)
@@ -2387,7 +2401,7 @@ re_compile_pattern(pattern, size, bufp)
GET_UNSIGNED_NUMBER(c1);
if (!ISDIGIT(c)) PATUNFETCH;
if (9 < c1 && c1 >= regnum) {
if (9 < c1 && c1 >= (unsigned int)regnum) {
/* need to get octal */
c = scan_oct(p0, 3, &numlen) & 0xff;
p = p0 + numlen;
@@ -3867,7 +3881,7 @@ re_match(bufp, string_arg, size, pos, regs)
register unsigned char *d2, *dend2;
/* Check if there's corresponding group */
if (regno >= num_regs) goto fail;
if (regno >= (int)num_regs) goto fail;
/* Check if corresponding group is still open */
if (IS_ACTIVE(reg_info[regno])) goto fail;
+236 -83
View File
@@ -95,7 +95,7 @@ static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
};
#endif
#if defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_JA)
#if defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
mbfl_no_encoding_ascii,
mbfl_no_encoding_utf8,
@@ -104,7 +104,7 @@ static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
};
#endif
#if defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_JA)
#if defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
mbfl_no_encoding_ascii,
mbfl_no_encoding_utf8,
@@ -113,7 +113,7 @@ static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
};
#endif
#if defined(HAVE_MBSTR_RU) & !defined(HAVE_MBSTR_JA) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_KR)
#if defined(HAVE_MBSTR_RU) & !defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
mbfl_no_encoding_ascii,
mbfl_no_encoding_utf8,
@@ -123,24 +123,28 @@ static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
};
#endif
static const int php_mbstr_default_identify_list_size = sizeof(php_mbstr_default_identify_list)/sizeof(enum mbfl_no_encoding);
static unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
#if HAVE_MBREGEX
static unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
#endif
#if defined(MBSTR_ENC_TRANS)
SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler);
static sapi_post_entry mbstr_post_entries[] = {
{ DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_mbstr_post_handler },
{ MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
{ NULL, 0, NULL, NULL }
#if !defined(HAVE_MBSTR_RU) & !defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
static const enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
mbfl_no_encoding_ascii,
mbfl_no_encoding_utf8
};
#endif
static struct mb_overload_def mb_ovld[] = {
static const int php_mbstr_default_identify_list_size = sizeof(php_mbstr_default_identify_list)/sizeof(enum mbfl_no_encoding);
static const unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
static const unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
#if HAVE_MBREGEX
static const unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
#endif
static sapi_post_entry mbstr_post_entries[] = {
{ DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_mbstr_post_handler },
{ MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
{ NULL, 0, NULL, NULL }
};
static const struct mb_overload_def mb_ovld[] = {
{MB_OVERLOAD_MAIL, "mail", "mb_send_mail", "mb_orig_mail"},
{MB_OVERLOAD_STRING, "strlen", "mb_strlen", "mb_orig_strlen"},
{MB_OVERLOAD_STRING, "strpos", "mb_strpos", "mb_orig_strrpos"},
@@ -162,7 +166,7 @@ struct def_mbctype_tbl {
int regex_encoding;
};
struct def_mbctype_tbl mbctype_tbl[] = {
const struct def_mbctype_tbl mbctype_tbl[] = {
{mbfl_no_encoding_ascii,MBCTYPE_ASCII},
{mbfl_no_encoding_euc_jp,MBCTYPE_EUC},
{mbfl_no_encoding_sjis,MBCTYPE_SJIS},
@@ -178,7 +182,7 @@ function_entry mbstring_functions[] = {
PHP_FE(mb_http_output, NULL)
PHP_FE(mb_detect_order, NULL)
PHP_FE(mb_substitute_character, NULL)
PHP_FE(mb_parse_str, second_args_force_ref)
PHP_FE(mb_parse_str, (unsigned char *)second_args_force_ref)
PHP_FE(mb_output_handler, NULL)
PHP_FE(mb_preferred_mime_name, NULL)
PHP_FE(mb_strlen, NULL)
@@ -193,7 +197,7 @@ function_entry mbstring_functions[] = {
PHP_FE(mb_convert_kana, NULL)
PHP_FE(mb_encode_mimeheader, NULL)
PHP_FE(mb_decode_mimeheader, NULL)
PHP_FE(mb_convert_variables, third_and_rest_force_ref)
PHP_FE(mb_convert_variables, (unsigned char *)third_and_rest_force_ref)
PHP_FE(mb_encode_numericentity, NULL)
PHP_FE(mb_decode_numericentity, NULL)
PHP_FE(mb_send_mail, NULL)
@@ -213,8 +217,8 @@ function_entry mbstring_functions[] = {
PHP_FALIAS(i18n_ja_jp_hantozen, mb_convert_kana, NULL)
#if HAVE_MBREGEX
PHP_FE(mb_regex_encoding, NULL)
PHP_FE(mb_ereg, third_argument_force_ref)
PHP_FE(mb_eregi, third_argument_force_ref)
PHP_FE(mb_ereg, (unsigned char *)third_argument_force_ref)
PHP_FE(mb_eregi, (unsigned char *)third_argument_force_ref)
PHP_FE(mb_ereg_replace, NULL)
PHP_FE(mb_eregi_replace, NULL)
PHP_FE(mb_split, NULL)
@@ -284,7 +288,12 @@ php_mbstring_parse_encoding_list(const char *value, int value_length, int **retu
return 0;
} else {
/* copy the value string for work */
tmpstr = (char *)estrndup(value, value_length);
if (value[0]=='"' && value[value_length-1]=='"' && value_length>2) {
tmpstr = (char *)estrndup(value+1, value_length-2);
value_length -= 2;
}
else
tmpstr = (char *)estrndup(value, value_length);
if (tmpstr == NULL) {
return 0;
}
@@ -455,7 +464,60 @@ php_mbregex_free_cache(mb_regex_t *pre)
#endif
/* php.ini directive handler */
static PHP_INI_MH(OnUpdate_mbstring_language)
{
enum mbfl_no_language no_language;
no_language = mbfl_name2no_language(new_value);
if (no_language != mbfl_no_language_invalid) {
switch (no_language) {
case mbfl_no_language_japanese:
MBSTRG(language) = mbfl_no_language_japanese;
MBSTRG(current_language) = mbfl_no_language_japanese;
MBSTRG(internal_encoding) = mbfl_no_encoding_euc_jp;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_jp;
break;
case mbfl_no_language_korean:
MBSTRG(language) = mbfl_no_language_korean;
MBSTRG(current_language) = mbfl_no_language_korean;
MBSTRG(internal_encoding) = mbfl_no_encoding_euc_kr;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_kr;
break;
case mbfl_no_language_simplified_chinese:
MBSTRG(language) = mbfl_no_language_simplified_chinese;
MBSTRG(current_language) = mbfl_no_language_simplified_chinese;
MBSTRG(internal_encoding) = mbfl_no_encoding_euc_cn;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_cn;
break;
case mbfl_no_language_traditional_chinese:
MBSTRG(language) = mbfl_no_language_traditional_chinese;
MBSTRG(current_language) = mbfl_no_language_traditional_chinese;
MBSTRG(internal_encoding) = mbfl_no_encoding_euc_tw;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_tw;
break;
case mbfl_no_language_russian:
MBSTRG(language) = mbfl_no_language_russian;
MBSTRG(current_language) = mbfl_no_language_russian;
MBSTRG(internal_encoding) = mbfl_no_encoding_koi8r;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_koi8r;
break;
case mbfl_no_language_english:
default:
MBSTRG(language) = mbfl_no_language_english;
MBSTRG(current_language) = mbfl_no_language_english;
MBSTRG(internal_encoding) = mbfl_no_encoding_8859_1;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_8859_1;
break;
}
} else {
return FAILURE;
}
return SUCCESS;
}
static PHP_INI_MH(OnUpdate_mbstring_detect_order)
{
int *list, size;
@@ -490,6 +552,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
return SUCCESS;
}
static PHP_INI_MH(OnUpdate_mbstring_http_output)
{
enum mbfl_no_encoding no_encoding;
@@ -511,7 +574,7 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
{
enum mbfl_no_encoding no_encoding;
#if HAVE_MBREGEX
struct def_mbctype_tbl *p = NULL;
const struct def_mbctype_tbl *p = NULL;
#endif
no_encoding = mbfl_name2no_encoding(new_value);
@@ -575,6 +638,7 @@ static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
/* php.ini directive registration */
PHP_INI_BEGIN()
PHP_INI_ENTRY("mbstring.language", NULL, PHP_INI_ALL, OnUpdate_mbstring_language)
PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order)
PHP_INI_ENTRY("mbstring.http_input", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_input)
PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output)
@@ -584,6 +648,9 @@ PHP_INI_BEGIN()
#endif /* ZEND_MULTIBYTE */
PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
STD_PHP_INI_ENTRY("mbstring.func_overload", "0", PHP_INI_SYSTEM, OnUpdateInt, func_overload, zend_mbstring_globals, mbstring_globals)
#if !defined(COMPILE_DL_MBSTRING)
STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0", PHP_INI_ALL, OnUpdateBool, encoding_translation, zend_mbstring_globals, mbstring_globals)
#endif /* !defined(COMPILE_DL_MBSTRING) */
PHP_INI_END()
@@ -591,20 +658,25 @@ PHP_INI_END()
static void
php_mbstring_init_globals(zend_mbstring_globals *pglobals TSRMLS_DC)
{
MBSTRG(language) = mbfl_no_language_english;
MBSTRG(current_language) = mbfl_no_language_english;
MBSTRG(internal_encoding) = mbfl_no_encoding_8859_1;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_8859_1;
#if defined(HAVE_MBSTR_CN) & !defined(HAVE_MBSTR_JA)
MBSTRG(language) = mbfl_no_language_chinese;
MBSTRG(current_language) = mbfl_no_language_chinese;
MBSTRG(language) = mbfl_no_language_simplified_chinese;
MBSTRG(current_language) = mbfl_no_language_simplified_chinese;
MBSTRG(internal_encoding) = mbfl_no_encoding_euc_cn;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_cn;
#endif
#if defined(HAVE_MBSTR_TW) & !defined(HAVE_MBSTR_JA)
MBSTRG(language) = mbfl_no_language_chinese;
MBSTRG(current_language) = mbfl_no_language_chinese;
MBSTRG(language) = mbfl_no_language_traditional_chinese;
MBSTRG(current_language) = mbfl_no_language_traditional_chinese;
MBSTRG(internal_encoding) = mbfl_no_encoding_euc_tw;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_tw;
#endif
#if defined(HAVE_MBSTR_KR) & !defined(HAVE_MBSTR_JA)
MBSTRG(language) = mbfl_no_language_chinese;
MBSTRG(language) = mbfl_no_language_korean;
MBSTRG(current_language) = mbfl_no_language_korean;
MBSTRG(internal_encoding) = mbfl_no_encoding_euc_kr;
MBSTRG(current_internal_encoding) = mbfl_no_encoding_euc_kr;
@@ -637,6 +709,7 @@ php_mbstring_init_globals(zend_mbstring_globals *pglobals TSRMLS_DC)
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
MBSTRG(current_filter_illegal_substchar) = 0x3f; /* '?' */
MBSTRG(func_overload) = 0;
MBSTRG(encoding_translation) = 0;
pglobals->outconv = NULL;
#if HAVE_MBREGEX
MBSTRG(default_mbctype) = MBCTYPE_EUC;
@@ -660,10 +733,12 @@ PHP_MINIT_FUNCTION(mbstring)
REGISTER_INI_ENTRIES();
#if defined(MBSTR_ENC_TRANS)
sapi_unregister_post_entry(mbstr_post_entries);
sapi_register_post_entries(mbstr_post_entries);
#endif
if(MBSTRG(encoding_translation)) {
sapi_unregister_post_entry(mbstr_post_entries);
sapi_register_post_entries(mbstr_post_entries);
sapi_register_treat_data(mbstr_treat_data);
}
REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT);
@@ -689,6 +764,10 @@ PHP_MSHUTDOWN_FUNCTION(mbstring)
free(MBSTRG(detect_order_list));
}
if(MBSTRG(encoding_translation)) {
sapi_register_treat_data(php_default_treat_data);
}
#if HAVE_MBREGEX
zend_hash_destroy(&MBSTRG(ht_rc));
#endif
@@ -701,7 +780,7 @@ PHP_RINIT_FUNCTION(mbstring)
{
int n, *list=NULL, *entry;
zend_function *func, *orig;
struct mb_overload_def *p;
const struct mb_overload_def *p;
MBSTRG(current_language) = MBSTRG(language);
MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding);
@@ -739,12 +818,12 @@ PHP_RINIT_FUNCTION(mbstring)
if (zend_hash_find(EG(function_table), p->orig_func,
strlen(p->orig_func)+1, (void **)&orig) != SUCCESS) {
php_error(E_ERROR, "mbstring couldn't find function %s.", p->orig_func);
php_error(E_ERROR, "%s() mbstring couldn't find function %s.", get_active_function_name(TSRMLS_C), p->orig_func);
}
zend_hash_add(EG(function_table), p->save_func, strlen(p->save_func)+1, orig, sizeof(zend_function), NULL);
if (zend_hash_update(EG(function_table), p->orig_func, strlen(p->orig_func)+1,
func, sizeof(zend_function), NULL) == FAILURE){
php_error(E_ERROR, "mbstring couldn't replace function %s.", p->orig_func);
php_error(E_ERROR, "%s() mbstring couldn't replace function %s.", get_active_function_name(TSRMLS_C), p->orig_func);
}
}
p++;
@@ -757,7 +836,7 @@ PHP_RINIT_FUNCTION(mbstring)
PHP_RSHUTDOWN_FUNCTION(mbstring)
{
struct mb_overload_def *p;
const struct mb_overload_def *p;
zend_function *orig;
if (MBSTRG(current_detect_order_list) != NULL) {
@@ -832,9 +911,9 @@ PHP_MINFO_FUNCTION(mbstring)
#if defined(HAVE_MBSTR_KR)
php_info_print_table_row(2, "korean support", "enabled");
#endif
#if defined(MBSTR_ENC_TRANS)
php_info_print_table_row(2, "http input encoding translation", "enabled");
#endif
if(MBSTRG(encoding_translation)) {
php_info_print_table_row(2, "http input encoding translation", "enabled");
}
#if defined(HAVE_MBREGEX)
php_info_print_table_row(2, "multibyte (japanese) regex support", "enabled");
#endif
@@ -921,7 +1000,7 @@ PHP_FUNCTION(mb_http_input)
{
pval **arg1;
int result=0, retname, n, *entry;
char *name;
char *name, *list, *temp;
retname = 1;
if (ZEND_NUM_ARGS() == 0) {
@@ -962,6 +1041,32 @@ PHP_FUNCTION(mb_http_input)
}
retname = 0;
break;
case 'L':
case 'l':
entry = MBSTRG(http_input_list);
n = MBSTRG(http_input_list_size);
list = NULL;
while (n > 0) {
name = (char *)mbfl_no_encoding2name(*entry);
if (name) {
if (list) {
temp = list;
spprintf(&list, 0, "%s,%s", temp, name);
efree(temp);
if (!list)
break;
} else {
list = estrdup(name);
}
}
entry++;
n--;
}
if (!list)
RETURN_FALSE;
RETVAL_STRING(list, 0);
retname = 0;
break;
default:
result = MBSTRG(http_input_identify);
break;
@@ -1160,11 +1265,10 @@ PHP_FUNCTION(mb_preferred_mime_name)
}
/* }}} */
#if defined(MBSTR_ENC_TRANS)
static void
php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
{
char *var, *val;
char *var, *val, *s1, *s2;
char *strtok_buf = NULL, **val_list;
zval *array_ptr = (zval *) arg;
int n, num, val_len, *len_list, *elist, elistsz;
@@ -1176,19 +1280,23 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
mbfl_string_init_set(&string, MBSTRG(current_language), MBSTRG(current_internal_encoding));
mbfl_string_init_set(&resvar, MBSTRG(current_language), MBSTRG(current_internal_encoding));
mbfl_string_init_set(&resval, MBSTRG(current_language), MBSTRG(current_internal_encoding));
/* count the variables contained in the query */
num = 0;
var = res;
n = strlen(res);
while(n > 0) {
if (*var == '=') {
num++;
}
var++;
n--;
if (!res || *res == '\0') {
return;
}
num *= 2;
/* count the variables(separators) contained in the "res".
* separator may contain multiple separator chars.
* separaror chars are set in php.ini (arg_separator.input)
*/
num = 1;
for (s1=res; *s1 != '\0'; s1++)
for (s2=separator; *s2 != '\0'; s2++)
if (*s1 == *s2)
num++;
num *= 2; /* need space for variable name and value */
val_list = (char **)ecalloc(num, sizeof(char *));
len_list = (int *)ecalloc(num, sizeof(int));
@@ -1196,28 +1304,24 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
n = 0;
strtok_buf = NULL;
var = php_strtok_r(res, separator, &strtok_buf);
while (var && n < num) {
while (var) {
val = strchr(var, '=');
val_list[n] = var;
len_list[n] = php_url_decode(var, strlen(var));
n++;
if (val) { /* have a value */
*val++ = '\0';
val_list[n] = var;
len_list[n] = php_url_decode(var, strlen(var));
n++;
val_list[n] = val;
len_list[n] = php_url_decode(val, strlen(val));
} else {
val_list[n] = var;
len_list[n] = php_url_decode(var, strlen(var));
n++;
val_list[n] = NULL;
val_list[n] = "";
len_list[n] = 0;
}
n++;
var = php_strtok_r(NULL, separator, &strtok_buf);
}
num = n;
}
num = n; /* make sure to process initilized vars only */
/* initialize converter */
to_encoding = MBSTRG(current_internal_encoding);
elist = MBSTRG(http_input_list);
@@ -1303,7 +1407,6 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
}
#if defined(MBSTR_ENC_TRANS)
SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
{
MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
@@ -1314,10 +1417,39 @@ SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
MBSTRG(http_input_identify_post) = MBSTRG(http_input_identify);
}
}
#endif
#define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0)
#define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0)
char *mbstr_strrchr(const char *s, char c TSRMLS_DC){
unsigned char *p = (unsigned char *)s, *last = NULL;
while(*p++) {
if (*p == c) {
last = p;
}
if (*p == '\0'){
break;
}
if (MBSTRG(current_language) == mbfl_no_language_japanese
&& IS_SJIS1(*p) && IS_SJIS2(*(p+1))) {
p++;
}
}
return last;
}
int mbstr_is_mb_leadbyte(const char *s TSRMLS_DC){
unsigned char *p = (unsigned char *)s;
if (MBSTRG(current_language) == mbfl_no_language_japanese
&& IS_SJIS1(*p) && IS_SJIS2(*(p+1))){
return 1;
}
return 0;
}
/* http input processing */
void mbstr_treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
SAPI_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
{
char *res = NULL, *separator=NULL;
const char *c_var;
@@ -1431,7 +1563,6 @@ void mbstr_treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
efree(res);
}
}
#endif
/* {{{ proto bool mb_parse_str(string encoded_string [, array result])
Parses GET/POST/COOKIE data and sets global variables */
@@ -1630,10 +1761,12 @@ PHP_FUNCTION(mb_output_handler)
size_t arg_string_len;
long arg_status;
mbfl_string string, result;
const char *mimetype, *charset;
const char *charset;
char *p;
enum mbfl_no_encoding encoding;
int last_feed, len;
unsigned char send_text_mimetype = 0;
char *s, *mimetype = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &arg_string, &arg_string_len, &arg_status) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1651,9 +1784,22 @@ PHP_FUNCTION(mb_output_handler)
if (encoding == mbfl_no_encoding_pass) {
RETURN_STRINGL(arg_string, arg_string_len, 1);
}
/* if content-type is not yet set, set it and activate the converter */
if (SG(sapi_headers).send_default_content_type ) {
/* analyze mime type */
if (SG(sapi_headers).mimetype &&
strncmp(SG(sapi_headers).mimetype, "text/", 5) == 0) {
if ((s = strchr(SG(sapi_headers).mimetype,';')) == NULL){
mimetype = estrdup(SG(sapi_headers).mimetype);
} else {
mimetype = estrndup(SG(sapi_headers).mimetype,s-SG(sapi_headers).mimetype);
}
send_text_mimetype = 1;
} else if (SG(sapi_headers).send_default_content_type) {
mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
}
/* if content-type is not yet set, set it and activate the converter */
if (SG(sapi_headers).send_default_content_type || send_text_mimetype) {
charset = mbfl_no2preferred_mime_name(encoding);
if (charset) {
len = (sizeof ("Content-Type:")-1) + strlen(mimetype) + (sizeof (";charset=")-1) + strlen(charset) + 1;
@@ -1667,6 +1813,9 @@ PHP_FUNCTION(mb_output_handler)
}
/* activate the converter */
MBSTRG(outconv) = mbfl_buffer_converter_new(MBSTRG(current_internal_encoding), encoding, 0 TSRMLS_CC);
if (send_text_mimetype){
efree(mimetype);
}
}
}
@@ -2792,8 +2941,8 @@ PHP_FUNCTION(mb_convert_variables)
}
}
} else if (Z_TYPE_PP(var) == IS_STRING) {
string.val = Z_STRVAL_PP(args[n]);
string.len = Z_STRLEN_PP(args[n]);
string.val = Z_STRVAL_PP(var);
string.len = Z_STRLEN_PP(var);
if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) {
goto detect_end; /* complete detecting */
}
@@ -3222,6 +3371,10 @@ PHP_FUNCTION(mb_get_info)
}
/* }}} */
PHPAPI int mbstr_encoding_translation(TSRMLS_D)
{
return MBSTRG(encoding_translation);
}
#ifdef ZEND_MULTIBYTE
PHPAPI int php_mbstring_set_zend_encoding(TSRMLS_D)
@@ -3267,13 +3420,13 @@ PHPAPI int php_mbstring_set_zend_encoding(TSRMLS_D)
encoding_converter = NULL;
multibyte_oddlen = php_mbstring_oddlen;
#if defined(MBSTR_ENC_TRANS)
/* notify internal encoding to Zend Engine */
name = (char*)mbfl_no_encoding2name(MBSTRG(current_internal_encoding));
zend_multibyte_set_internal_encoding(name, strlen(name) TSRMLS_CC);
if(MBSTRG(encoding_translation)) {
/* notify internal encoding to Zend Engine */
name = (char*)mbfl_no_encoding2name(MBSTRG(current_internal_encoding));
zend_multibyte_set_internal_encoding(name, strlen(name) TSRMLS_CC);
encoding_converter = php_mbstring_encoding_converter;
#endif /* defined(MBSTR_ENC_TRANS) */
encoding_converter = php_mbstring_encoding_converter;
}
zend_multibyte_set_functions(encoding_detector, encoding_converter,
multibyte_oddlen TSRMLS_CC);
+14 -1
View File
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D ZTS=1 /D "COMPILE_DL_MBSTRING" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MBSTRING=1 /D "MBSTR_ENC_TRANS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D ZTS=1 /D "COMPILE_DL_MBSTRING" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MBSTRING=1 /D "MBSTR_ENC_TRANS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
@@ -108,6 +108,10 @@ SOURCE=.\mbfilter_kr.c
# End Source File
# Begin Source File
SOURCE=.\mbfilter_ru.c
# End Source File
# Begin Source File
SOURCE=.\mbfilter_tw.c
# End Source File
# Begin Source File
@@ -122,6 +126,10 @@ SOURCE=.\mbstring.c
SOURCE=.\php_mbregex.c
# End Source File
# Begin Source File
SOURCE=.\html_entities.c
# End Source File
# End Group
# Begin Group "Header Files"
@@ -148,6 +156,10 @@ SOURCE=.\mbfilter_kr.h
# End Source File
# Begin Source File
SOURCE=.\mbfilter_ru.h
# End Source File
# Begin Source File
SOURCE=.\mbfilter_tw.h
# End Source File
# Begin Source File
@@ -175,5 +187,6 @@ SOURCE=.\unicode_table_kr.h
SOURCE=.\unicode_table_tw.h
# End Source File
# End Group
# End Target
# End Project
+9
View File
@@ -56,6 +56,7 @@
#if HAVE_MBSTRING
#include "mbfilter.h"
#include "SAPI.h"
#define PHP_MBSTRING_API 20020405
@@ -124,6 +125,10 @@ PHP_FUNCTION(mb_ereg_search_setpos);
int php_mbregex_name2mbctype(const char *pname);
#endif
char *mbstr_strrchr(const char *s, char c TSRMLS_DC);
int mbstr_is_mb_leadbyte(const char *s TSRMLS_DC);
PHPAPI int mbstr_encoding_translation(TSRMLS_D);
ZEND_BEGIN_MODULE_GLOBALS(mbstring)
int language;
int current_language;
@@ -151,6 +156,7 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring)
int current_filter_illegal_mode;
int current_filter_illegal_substchar;
long func_overload;
int encoding_translation;
mbfl_buffer_converter *outconv;
#if HAVE_MBREGEX
int default_mbctype;
@@ -191,6 +197,9 @@ int php_mbstring_encoding_converter(char **to, int *to_length, char *from,
int php_mbstring_oddlen(char *string, int length, const char *encoding TSRMLS_DC);
#endif /* ZEND_MULTIBYTE */
SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler);
SAPI_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data);
#else /* HAVE_MBSTRING */
#define mbstring_module_ptr NULL
+33
View File
@@ -0,0 +1,33 @@
--TEST--
HTML input/output
--SKIPIF--
<?php
ini_set('include_path','.');
include('skipif.inc');
?>
--INI--
arg_separator.input="x"
error_reporting=0
mbstring.http_input=HTML-ENTITIES
mbstring.internal_encoding=UTF8
mbstring.http_output=HTML-ENTITIES
mbstring.encoding_translation=On
--FILE--
<?php
// enable output encoding through output handler
ob_start("mb_output_handler");
// &#64... are must be decoded on input these are not reencoded on output.
// If you see &#64;&#65;&#66; on output this means input encoding fails.
// If you do not see &auml;... on output this means output encoding fails.
// Using UTF-8 internally allows to encode/decode ALL characters.
// &128... will stay as they are since their character codes are above 127
// and they do not have a named entity representaion.
?>
<?php echo mb_http_input('l').'>'.mb_internal_encoding().'>'.mb_http_output();?>
<?php mb_parse_str("test=&&;&&#64;&#65;&#66;&#128;&#129;&#130;&auml;&ouml;&uuml;&euro;&lang;&rang;");
echo "test='$test'";
?>
--EXPECT--
HTML-ENTITIES>UTF-8>HTML-ENTITIES
test='&&;&@AB&#128;&#129;&#130;&auml;&ouml;&uuml;&euro;&lang;&rang;'
+52 -54
View File
@@ -147,7 +147,7 @@ ZEND_GET_MODULE(mcrypt)
#define MCRYPT_CHECK_TD_CPY \
if(td < 0) { \
php_error(E_WARNING, MCRYPT_FAILED); \
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), MCRYPT_FAILED); \
RETURN_FALSE; \
} \
ndata = ecalloc(nr, bsize); \
@@ -156,7 +156,7 @@ ZEND_GET_MODULE(mcrypt)
#define MCRYPT_CHECK_IV \
convert_to_string_ex(iv); \
if(Z_STRLEN_PP(iv) != bsize) { \
php_error(E_WARNING, MCRYPT_IV_WRONG_SIZE); \
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), MCRYPT_IV_WRONG_SIZE); \
RETURN_FALSE; \
}
@@ -167,7 +167,7 @@ ZEND_GET_MODULE(mcrypt)
mdecrypt_##x(td, ndata, nsize); \
end_mcrypt_##x(td)
#define MCRYPT_IV_WRONG_SIZE "The IV parameter must be as long as the blocksize"
#define MCRYPT_IV_WRONG_SIZE "%s(): The IV parameter must be as long as the blocksize"
#if HAVE_LIBMCRYPT24
#define MCRYPT_ENCRYPT 0
@@ -219,9 +219,9 @@ ZEND_GET_MODULE(mcrypt)
#endif
#if HAVE_LIBMCRYPT22
#define MCRYPT_FAILED "mcrypt initialization failed"
#define MCRYPT_FAILED "%s(): Initialization failed"
#else
#define MCRYPT_OPEN_MODULE_FAILED "mcrypt module initialization failed"
#define MCRYPT_OPEN_MODULE_FAILED "%s(): Module initialization failed"
#endif
#if HAVE_LIBMCRYPT22
@@ -391,7 +391,7 @@ PHP_MINFO_FUNCTION(mcrypt)
php_info_print_table_row(2, "version", "2.2.x");
#endif
#if HAVE_LIBMCRYPT24
php_info_print_table_row(2, "version", "2.4.x");
php_info_print_table_row(2, "version", ">= 2.4.x");
php_info_print_table_row(2, "Supported ciphers", tmp1.c);
php_info_print_table_row(2, "Supported modes", tmp2.c);
smart_str_free (&tmp1);
@@ -414,26 +414,25 @@ typedef enum {
Opens the module of the algorithm and the mode to be used */
PHP_FUNCTION(mcrypt_module_open)
{
zval **cipher, **cipher_directory, **mode, **mode_directory;
char *cipher, *cipher_dir;
char *mode, *mode_dir;
int cipher_len, cipher_dir_len;
int mode_len, mode_dir_len;
MCRYPT td;
int argc;
argc = ZEND_NUM_ARGS();
MCRYPT_CHECK_PARAM_COUNT (4,4)
if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ssss",
&cipher, &cipher_len, &cipher_dir, &cipher_dir_len,
&mode, &mode_len, &mode_dir, &mode_dir_len)) {
return;
}
zend_get_parameters_ex(4, &cipher, &cipher_directory, &mode, &mode_directory);
convert_to_string_ex(cipher);
convert_to_string_ex(cipher_directory);
convert_to_string_ex(mode);
convert_to_string_ex(mode_directory);
td = mcrypt_module_open (Z_STRVAL_PP(cipher),
Z_STRLEN_PP(cipher_directory) > 0 ? Z_STRVAL_PP(cipher_directory) : MCG(algorithms_dir),
Z_STRVAL_PP(mode),
Z_STRLEN_PP(mode_directory) > 0 ? Z_STRVAL_PP(mode_directory) : MCG(modes_dir));
td = mcrypt_module_open (cipher,
cipher_dir_len > 0 ? cipher_dir : MCG(algorithms_dir),
mode,
mode_dir_len > 0 ? mode_dir : MCG(modes_dir));
if (td == MCRYPT_FAILED) {
php_error (E_WARNING, "could not open encryption module");
php_error (E_WARNING, "%s(): Could not open encryption module", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
} else {
ZEND_REGISTER_RESOURCE (return_value, td, le_mcrypt);
@@ -467,7 +466,7 @@ PHP_FUNCTION(mcrypt_generic_init)
iv_size = mcrypt_enc_get_iv_size (td);
if (Z_STRLEN_PP(key) == 0) {
php_error (E_WARNING, "key size is 0");
php_error (E_WARNING, "%s(): Key size is 0", get_active_function_name(TSRMLS_C));
}
key_s = emalloc (Z_STRLEN_PP(key));
@@ -477,9 +476,9 @@ PHP_FUNCTION(mcrypt_generic_init)
memset (iv_s, 0, iv_size + 1);
if (Z_STRLEN_PP(key) > max_key_size) {
sprintf (dummy, "key size too large; supplied length: %d, max: %d",
sprintf (dummy, "Key size too large; supplied length: %d, max: %d",
Z_STRLEN_PP(key), max_key_size);
php_error (E_WARNING, dummy);
php_error (E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), dummy);
key_size = max_key_size;
} else {
key_size = Z_STRLEN_PP(key);
@@ -487,9 +486,9 @@ PHP_FUNCTION(mcrypt_generic_init)
memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
if (Z_STRLEN_PP(iv) != iv_size) {
sprintf (dummy, "iv size incorrect; supplied length: %d, needed: %d",
sprintf (dummy, "Iv size incorrect; supplied length: %d, needed: %d",
Z_STRLEN_PP(iv), iv_size);
php_error (E_WARNING, dummy);
php_error (E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), dummy);
}
memcpy (iv_s, Z_STRVAL_PP(iv), iv_size);
@@ -501,14 +500,14 @@ PHP_FUNCTION(mcrypt_generic_init)
zend_list_delete (Z_LVAL_PP(mcryptind));
switch (result) {
case -3:
php_error (E_WARNING, "mcrypt_generic_init: Key length incorrect");
php_error (E_WARNING, "%s(): Key length incorrect", get_active_function_name(TSRMLS_C));
break;
case -4:
php_error (E_WARNING, "mcrypt_generic_init: Memory allocation error");
php_error (E_WARNING, "%s(): Memory allocation error", get_active_function_name(TSRMLS_C));
break;
case -1:
default:
php_error (E_WARNING, "mcrypt_generic_init: Unknown error");
php_error (E_WARNING, "%s(): Unknown error", get_active_function_name(TSRMLS_C));
break;
}
}
@@ -616,7 +615,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes)
key_sizes = mcrypt_enc_get_supported_key_sizes (td, &count);
if (array_init(return_value) == FAILURE) {
php_error(E_ERROR, "Unable to initialize array");
php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C));
return;
}
if (count != 0) {
@@ -667,12 +666,12 @@ PHP_FUNCTION(mcrypt_generic_end)
MCRYPT_GET_TD_ARG
#if HAVE_MCRYPT_GENERIC_DEINIT
php_error(E_NOTICE, "mcrypt_generic_end is deprecated, please use mcrypt_generic_deinit");
php_error(E_NOTICE, "%s(): This function is deprecated, please use mcrypt_generic_deinit()", get_active_function_name(TSRMLS_C));
if (mcrypt_generic_deinit (td) < 0) {
#else
if (mcrypt_generic_end (td) < 0) {
#endif
php_error (E_WARNING, "could not terminate encryption specifier");
php_error (E_WARNING, "%s(): Could not terminate encryption specifier", get_active_function_name(TSRMLS_C));
RETURN_FALSE
}
RETURN_TRUE
@@ -692,7 +691,7 @@ PHP_FUNCTION(mcrypt_generic_deinit)
MCRYPT_GET_TD_ARG
if (mcrypt_generic_deinit (td) < 0) {
php_error (E_WARNING, "could not terminate encryption specifier");
php_error (E_WARNING, "%s(): Could not terminate encryption specifier", get_active_function_name(TSRMLS_C));
RETURN_FALSE
}
RETURN_TRUE
@@ -837,8 +836,7 @@ PHP_FUNCTION(mcrypt_module_self_test)
if (mcrypt_module_self_test (module, dir) == 0) {
RETURN_TRUE;
}
else {
} else {
RETURN_FALSE;
}
}
@@ -916,7 +914,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_key_size)
This function decrypts the crypttext */
PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
{
int argc, i, count;
int i, count;
int *key_sizes;
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
@@ -924,7 +922,7 @@ PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
key_sizes = mcrypt_module_get_algo_supported_key_sizes (module, dir, &count);
if (array_init(return_value) == FAILURE) {
php_error(E_ERROR, "Unable to initialize array");
php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C));
return;
}
if (count != 0) {
@@ -967,11 +965,11 @@ PHP_FUNCTION(mcrypt_list_algorithms)
modules = mcrypt_list_algorithms (lib_dir_s, &count);
if (array_init(return_value) == FAILURE) {
php_error(E_ERROR, "Unable to initialize array");
php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C));
return;
}
if (count == 0) {
php_error (E_WARNING, "No algorithms found in module dir");
php_error (E_WARNING, "%s(): No algorithms found in module dir", get_active_function_name(TSRMLS_C));
}
for (i = 0; i < count; i++) {
add_index_string(return_value, i, modules[i], 1);
@@ -1011,11 +1009,11 @@ PHP_FUNCTION(mcrypt_list_modes)
modules = mcrypt_list_modes (lib_dir_s, &count);
if (array_init(return_value) == FAILURE) {
php_error(E_ERROR, "Unable to initialize array");
php_error(E_ERROR, "%s(): Unable to initialize array", get_active_function_name(TSRMLS_C));
return;
}
if (count == 0) {
php_error (E_WARNING, "No modes found in module dir");
php_error (E_WARNING, "%s(): No modes found in module dir", get_active_function_name(TSRMLS_C));
}
for (i = 0; i < count; i++) {
add_index_string(return_value, i, modules[i], 1);
@@ -1058,7 +1056,7 @@ PHP_FUNCTION(mcrypt_get_key_size)
}
else
{
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C));
RETVAL_LONG(0);
}
}
@@ -1098,7 +1096,7 @@ PHP_FUNCTION(mcrypt_get_block_size)
}
else
{
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C));
RETVAL_LONG(0);
}
}
@@ -1138,7 +1136,7 @@ PHP_FUNCTION(mcrypt_get_iv_size)
}
else
{
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
}
@@ -1192,7 +1190,7 @@ PHP_FUNCTION(mcrypt_get_cipher_name)
}
else
{
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
}
@@ -1219,13 +1217,13 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
mode,
module_dir_string);
if (td == MCRYPT_FAILED) {
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED, get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
/* Checking for key-length */
max_key_length = mcrypt_enc_get_key_size (td);
if (Z_STRLEN_PP(key) > max_key_length) {
php_error (E_WARNING, "size of key is too large for this algorithm");
php_error (E_WARNING, "%s(): Size of key is too large for this algorithm", get_active_function_name(TSRMLS_C));
}
key_length_sizes = mcrypt_enc_get_supported_key_sizes (td, &count);
if (count == 0 && key_length_sizes == NULL) { /* all lengths 1 - k_l_s = OK */
@@ -1260,7 +1258,7 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
iv_size = mcrypt_enc_get_iv_size (td);
if (argc == 5) {
if (iv_size != Z_STRLEN_PP(iv)) {
php_error (E_WARNING, MCRYPT_IV_WRONG_SIZE);
php_error (E_WARNING, MCRYPT_IV_WRONG_SIZE, get_active_function_name(TSRMLS_C));
}
else {
@@ -1271,7 +1269,7 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
else if (argc == 4)
{
if (iv_size != 0) {
php_error (E_WARNING, "attempt to use an empty IV, which is NOT recommend");
php_error (E_WARNING, "%s(): Attempt to use an empty IV, which is NOT recommend", get_active_function_name(TSRMLS_C));
iv_s = emalloc (iv_size + 1);
memset (iv_s, 0, iv_size + 1);
}
@@ -1293,7 +1291,7 @@ static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mo
}
if (mcrypt_generic_init (td, key_s, use_key_length, iv_s) < 0) {
php_error (E_ERROR, "generic_init failed");
php_error (E_ERROR, "%s(): Mcrypt initialisation failed", get_active_function_name(TSRMLS_C));
}
if (dencrypt == MCRYPT_ENCRYPT)
mcrypt_generic (td, data_s, data_size);
@@ -1439,7 +1437,7 @@ PHP_FUNCTION(mcrypt_create_iv)
}
if (size <= 0) {
php_error(E_WARNING, "can not create an IV with size 0 or smaller");
php_error(E_WARNING, "%s(): Can not create an IV with size 0 or smaller", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1453,7 +1451,7 @@ PHP_FUNCTION(mcrypt_create_iv)
O_RDONLY);
if (fd < 0) {
efree(iv);
php_error(E_WARNING, "cannot open source device");
php_error(E_WARNING, "%s(): Cannot open source device", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
while (read_bytes < size) {
@@ -1465,7 +1463,7 @@ PHP_FUNCTION(mcrypt_create_iv)
n = read_bytes;
close(fd);
if (n < size) {
php_error(E_WARNING, "could not gather sufficient random data");
php_error(E_WARNING, "%s(): Could not gather sufficient random data", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
} else {
+390 -12
View File
@@ -33,7 +33,7 @@
static int le_conn; /* connection resource */
static int le_user; /* store add/edit/get user information */
static int mcve_init; /* For Safe Memory Dealocation */
static int mcve_init; /* For Safe Memory Deallocation */
/* }}} */
/* {{{ extension definition structures */
@@ -48,7 +48,17 @@ function_entry php_mcve_functions[] = {
PHP_FE(mcve_setip, NULL)
PHP_FE(mcve_setssl, NULL)
PHP_FE(mcve_settimeout, NULL)
PHP_FE(mcve_verifyconnection, NULL)
PHP_FE(mcve_verifysslcert, NULL)
PHP_FE(mcve_maxconntimeout, NULL)
PHP_FE(mcve_connectionerror, NULL)
PHP_FE(mcve_deletetrans, NULL)
PHP_FE(mcve_connect, NULL)
PHP_FE(mcve_transnew, NULL)
PHP_FE(mcve_transparam, NULL)
PHP_FE(mcve_transsend, NULL)
PHP_FE(mcve_ping, NULL)
PHP_FE(mcve_responseparam, NULL)
PHP_FE(mcve_returnstatus, NULL)
PHP_FE(mcve_returncode, NULL)
PHP_FE(mcve_transactionssent, NULL)
@@ -144,8 +154,95 @@ PHP_MINIT_FUNCTION(mcve)
le_conn = zend_register_list_destructors_ex(_free_mcve_conn, NULL,
"mcve connection", module_number);
/* Key definitions for Transaction Parameters */
REGISTER_LONG_CONSTANT("MC_TRANTYPE", MC_TRANTYPE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USERNAME", MC_USERNAME, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_PASSWORD", MC_PASSWORD, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ACCOUNT", MC_ACCOUNT, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRACKDATA", MC_TRACKDATA, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_EXPDATE", MC_EXPDATE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_STREET", MC_STREET, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ZIP", MC_ZIP, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_CV", MC_CV, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_COMMENTS", MC_COMMENTS, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_CLERKID", MC_CLERKID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_STATIONID", MC_STATIONID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_APPRCODE", MC_APPRCODE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_AMOUNT", MC_AMOUNT, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_PTRANNUM", MC_PTRANNUM, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TTID", MC_TTID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER", MC_USER, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_PWD", MC_PWD, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ACCT", MC_ACCT, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_BDATE", MC_BDATE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_EDATE", MC_EDATE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_BATCH", MC_BATCH, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_FILE", MC_FILE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN", MC_ADMIN, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_AUDITTYPE", MC_AUDITTYPE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_CUSTOM", MC_CUSTOM, MCVE_CONST);
/* Args for adding a user */
REGISTER_LONG_CONSTANT("MC_USER_PROC", MC_USER_PROC, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_USER", MC_USER_USER, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_PWD", MC_USER_PWD, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_INDCODE", MC_USER_INDCODE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_MERCHID", MC_USER_MERCHID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_BANKID", MC_USER_BANKID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_TERMID", MC_USER_TERMID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_CLIENTNUM", MC_USER_CLIENTNUM, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_STOREID", MC_USER_STOREID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_AGENTID", MC_USER_AGENTID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_CHAINID", MC_USER_CHAINID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_ZIPCODE", MC_USER_ZIPCODE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_TIMEZONE", MC_USER_TIMEZONE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_MERCHCAT", MC_USER_MERCHCAT, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_MERNAME", MC_USER_MERNAME, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_MERCHLOC", MC_USER_MERCHLOC, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_STATECODE", MC_USER_STATECODE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_USER_PHONE", MC_USER_PHONE, MCVE_CONST);
/* Value definitions for Transaction Types */
REGISTER_LONG_CONSTANT("MC_TRAN_SALE", MC_TRAN_SALE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_PREAUTH", MC_TRAN_PREAUTH, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_VOID", MC_TRAN_VOID, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_PREAUTHCOMPLETE", MC_TRAN_PREAUTHCOMPLETE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_FORCE", MC_TRAN_FORCE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_OVERRIDE", MC_TRAN_OVERRIDE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_RETURN", MC_TRAN_RETURN, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_SETTLE", MC_TRAN_SETTLE, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_ADMIN", MC_TRAN_ADMIN, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_PING", MC_TRAN_PING, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_CHKPWD", MC_TRAN_CHKPWD, MCVE_CONST);
/* Engine Admin Transaction Types */
REGISTER_LONG_CONSTANT("MC_TRAN_CHNGPWD", MC_TRAN_CHKPWD, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_LISTSTATS", MC_TRAN_LISTSTATS, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_LISTUSERS", MC_TRAN_LISTUSERS, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_GETUSERINFO", MC_TRAN_GETUSERINFO, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_ADDUSER", MC_TRAN_ADDUSER, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_EDITUSER", MC_TRAN_EDITUSER, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_DELUSER", MC_TRAN_DELUSER, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_ENABLEUSER", MC_TRAN_ENABLEUSER, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_DISABLEUSER", MC_TRAN_DISABLEUSER, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_IMPORT", MC_TRAN_IMPORT, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_TRAN_EXPORT", MC_TRAN_EXPORT, MCVE_CONST);
/* Value definitions for Admin Types */
REGISTER_LONG_CONSTANT("MC_ADMIN_GUT", MC_ADMIN_GUT, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_GL", MC_ADMIN_GL, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_GFT", MC_ADMIN_GFT, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_BT", MC_ADMIN_BT, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_UB", MC_ADMIN_UB, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_QC", MC_ADMIN_QC, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_RS", MC_ADMIN_RS, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_CTH", MC_ADMIN_CTH, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_CFH", MC_ADMIN_CFH, MCVE_CONST);
REGISTER_LONG_CONSTANT("MC_ADMIN_FORCESETTLE", MC_ADMIN_FORCESETTLE, MCVE_CONST);
/* set up the mcve defines */
REGISTER_LONG_CONSTANT("MCVE_UNUSED", MCVE_UNUSED, MCVE_CONST);
REGISTER_LONG_CONSTANT("MCVE_NEW", MCVE_NEW, MCVE_CONST);
REGISTER_LONG_CONSTANT("MCVE_PENDING", MCVE_PENDING, MCVE_CONST);
REGISTER_LONG_CONSTANT("MCVE_DONE", MCVE_DONE, MCVE_CONST);
@@ -202,12 +299,6 @@ PHP_MINFO_FUNCTION(mcve)
{
php_info_print_table_start();
php_info_print_table_row(2, "mcve support", "enabled");
php_info_print_table_row(2, "mcve ssl support",
#ifdef ENABLE_SSL
"enabled");
#else
"disabled");
#endif
php_info_print_table_row(2, "version", PHP_MCVE_VERSION);
php_info_print_table_end();
}
@@ -261,7 +352,7 @@ PHP_FUNCTION(mcve_deleteresponse)
if (ZEND_NUM_ARGS() != 2 ||
zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
@@ -273,6 +364,28 @@ PHP_FUNCTION(mcve_deleteresponse)
}
/* }}} */
/* {{{ proto bool mcve_deletetrans(resource conn, int identifier)
Delete specified transaction from MCVE_CONN structure */
PHP_FUNCTION(mcve_deletetrans)
{
MCVE_CONN *conn;
zval **arg1, **arg2;
if (ZEND_NUM_ARGS() != 2 ||
zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
convert_to_long_ex(arg2);
MCVE_DeleteTrans(conn, Z_LVAL_PP(arg2));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto void mcve_destroyconn(resource conn)
Destroy the connection and MCVE_CONN structure */
PHP_FUNCTION(mcve_destroyconn)
@@ -343,7 +456,6 @@ PHP_FUNCTION(mcve_setip)
Set the connection method to SSL */
PHP_FUNCTION(mcve_setssl)
{
#ifdef ENABLE_SSL
MCVE_CONN *conn;
int retval;
zval **arg1, **arg2, **arg3;
@@ -361,9 +473,6 @@ PHP_FUNCTION(mcve_setssl)
retval = MCVE_SetSSL(conn, Z_STRVAL_PP(arg2), Z_LVAL_PP(arg3));
RETURN_LONG(retval);
#else
RETURN_LONG(MCVE_FAIL);
#endif
}
/* }}} */
@@ -391,6 +500,99 @@ PHP_FUNCTION(mcve_settimeout)
}
/* }}} */
/* {{{ proto int mcve_setblocking(resource conn, int tf)
Set blocking/non-blocking mode for connection
*/
PHP_FUNCTION(mcve_setblocking)
{
MCVE_CONN *conn;
int retval;
zval **arg1, **arg2;
if (ZEND_NUM_ARGS() != 2 ||
zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
convert_to_long_ex(arg2);
retval = MCVE_SetBlocking(conn, Z_LVAL_PP(arg2));
RETURN_LONG(retval);
}
/* }}} */
/* {{{ proto bool mcve_verifyconnection(resource conn, int tf)
Set whether or not to PING upon connect to verify connection
*/
PHP_FUNCTION(mcve_verifyconnection)
{
MCVE_CONN *conn;
zval **arg1, **arg2;
if (ZEND_NUM_ARGS() != 2 ||
zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
convert_to_long_ex(arg2);
MCVE_VerifyConnection(conn, Z_LVAL_PP(arg2));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool mcve_verifysslcert(resource conn, int tf)
Set whether or not to verify the server ssl certificate
*/
PHP_FUNCTION(mcve_verifysslcert)
{
MCVE_CONN *conn;
zval **arg1, **arg2;
if (ZEND_NUM_ARGS() != 2 ||
zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
convert_to_long_ex(arg2);
MCVE_VerifySSLCert(conn, Z_LVAL_PP(arg2));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool mcve_maxconntimeout(resource conn, int secs)
The maximum amount of time the API will attempt a connection to MCVE
*/
PHP_FUNCTION(mcve_maxconntimeout)
{
MCVE_CONN *conn;
zval **arg1, **arg2;
if (ZEND_NUM_ARGS() != 2 ||
zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
convert_to_long_ex(arg2);
MCVE_MaxConnTimeout(conn, Z_LVAL_PP(arg2));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int mcve_connect(resource conn)
Establish the connection to MCVE */
PHP_FUNCTION(mcve_connect)
@@ -411,6 +613,30 @@ PHP_FUNCTION(mcve_connect)
}
/* }}} */
/* {{{ proto string mcve_connectionerror(resource conn)
Get a textual representation of why a connection failed */
PHP_FUNCTION(mcve_connectionerror)
{
MCVE_CONN *conn;
char *retval;
zval **arg;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection",
le_conn);
retval = MCVE_ConnectionError(conn);
if (retval == NULL) {
RETVAL_STRING("",1);
} else {
RETVAL_STRING(retval, 1);
}
}
/* }}} */
/* {{{ proto int mcve_transactionssent(resource conn)
Check to see if outgoing buffer is clear */
PHP_FUNCTION(mcve_transactionssent)
@@ -431,6 +657,158 @@ PHP_FUNCTION(mcve_transactionssent)
}
/* }}} */
/* {{{ proto int mcve_ping(resource conn)
Send a ping request to MCVE */
PHP_FUNCTION(mcve_ping)
{
MCVE_CONN *conn;
int retval;
zval **arg;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection",
le_conn);
retval = MCVE_Ping(conn);
RETURN_LONG(retval);
}
/* }}} */
/* {{{ proto long mcve_transnew(resource conn)
Start a new transaction */
PHP_FUNCTION(mcve_transnew)
{
MCVE_CONN *conn;
int retval;
zval **arg;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection",
le_conn);
retval = MCVE_TransNew(conn);
RETURN_LONG(retval);
}
/* }}} */
/* {{{ proto int mcve_transparam(resource conn, long identifier, int key, ...)
Add a parameter to a transaction */
PHP_FUNCTION(mcve_transparam)
{
MCVE_CONN *conn;
int retval;
int key;
zval **arg1, **arg2, **arg3, **arg4, **arg5;
if (ZEND_NUM_ARGS() == 4) {
if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
WRONG_PARAM_COUNT;
} else if (ZEND_NUM_ARGS() == 5) {
if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE)
WRONG_PARAM_COUNT;
} else {
WRONG_PARAM_COUNT;
}
convert_to_long_ex(arg3);
key = Z_LVAL_PP(arg3);
if (key == MC_CUSTOM && ZEND_NUM_ARGS() != 5)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
convert_to_long_ex(arg2);
switch (key) {
case MC_TRANTYPE:
case MC_PTRANNUM:
case MC_TTID:
case MC_ADMIN:
case MC_AUDITTYPE:
convert_to_long_ex(arg4);
retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_LVAL_PP(arg4));
break;
case MC_AMOUNT:
convert_to_double_ex(arg4);
retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_DVAL_PP(arg4));
break;
case MC_CUSTOM:
convert_to_string_ex(arg4);
convert_to_string_ex(arg5);
retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5));
break;
default:
convert_to_string_ex(arg4);
retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4));
break;
}
RETURN_LONG(retval);
}
/* }}} */
/* {{{ proto int mcve_transsend(resource conn, long identifier)
Finalize and send the transaction */
PHP_FUNCTION(mcve_transsend)
{
MCVE_CONN *conn;
int retval;
zval **arg1, **arg2;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
convert_to_long_ex(arg2);
retval = MCVE_TransSend(conn, Z_LVAL_PP(arg2));
RETURN_LONG(retval);
}
/* }}} */
/* {{{ proto string mcve_responseparam(resource conn, long identifier, string key)
Get a custom response parameter */
PHP_FUNCTION(mcve_responseparam)
{
MCVE_CONN *conn;
char *retval;
zval **arg1, **arg2, **arg3;
if (ZEND_NUM_ARGS() != 3 ||
zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
WRONG_PARAM_COUNT;
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
le_conn);
convert_to_long_ex(arg2);
convert_to_string_ex(arg3);
retval = MCVE_ResponseParam(conn, Z_LVAL_PP(arg2), Z_STRVAL_PP(arg3));
if (retval == NULL) {
RETVAL_STRING("",1);
} else {
RETVAL_STRING(retval, 1);
}
}
/* }}} */
/* {{{ proto int mcve_returnstatus(resource conn, int identifier)
Check to see if the transaction was successful */
PHP_FUNCTION(mcve_returnstatus)
+11 -2
View File
@@ -1,7 +1,6 @@
/*
* basic mcve php module
*
* $Id$
*/
#ifndef _PHP_MCVE_H
@@ -18,7 +17,7 @@ extern zend_module_entry php_mcve_module_entry;
//#endif
#define PHP_MCVE_VERSION "1.0"
#define PHP_MCVE_VERSION "3.0"
#define MCVE_CONST (CONST_CS | CONST_PERSISTENT)
@@ -33,7 +32,17 @@ PHP_FUNCTION(mcve_setdropfile);
PHP_FUNCTION(mcve_setip);
PHP_FUNCTION(mcve_setssl);
PHP_FUNCTION(mcve_settimeout);
PHP_FUNCTION(mcve_verifyconnection);
PHP_FUNCTION(mcve_verifysslcert);
PHP_FUNCTION(mcve_maxconntimeout);
PHP_FUNCTION(mcve_connectionerror);
PHP_FUNCTION(mcve_deletetrans);
PHP_FUNCTION(mcve_connect);
PHP_FUNCTION(mcve_transnew);
PHP_FUNCTION(mcve_transparam);
PHP_FUNCTION(mcve_transsend);
PHP_FUNCTION(mcve_ping);
PHP_FUNCTION(mcve_responseparam);
PHP_FUNCTION(mcve_returnstatus);
PHP_FUNCTION(mcve_returncode);
PHP_FUNCTION(mcve_transactionssent);
+16 -4
View File
@@ -41,24 +41,24 @@ function_entry mhash_functions[] = {
{NULL, NULL, NULL}
};
static PHP_MINIT_FUNCTION(mhash);
zend_module_entry mhash_module_entry = {
STANDARD_MODULE_HEADER,
"mhash",
mhash_functions,
PHP_MINIT(mhash), NULL,
NULL, NULL,
NULL,
NO_VERSION_YET,
PHP_MINFO(mhash),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES,
};
#ifdef COMPILE_DL_MHASH
ZEND_GET_MODULE(mhash)
#endif
#define MHASH_FAILED_MSG "mhash initialization failed"
#define MHASH_KEYGEN_FAILED_MSG "mhash key generation failed"
static PHP_MINIT_FUNCTION(mhash)
{
int i;
@@ -79,6 +79,18 @@ static PHP_MINIT_FUNCTION(mhash)
return SUCCESS;
}
PHP_MINFO_FUNCTION(mhash)
{
char version[32];
sprintf(version,"%d", MHASH_API_VERSION);
php_info_print_table_start();
php_info_print_table_row(2, "MHASH support", "Enabled");
php_info_print_table_row(2, "MHASH API Version", version);
php_info_print_table_end();
}
/* {{{ proto int mhash_count(void)
Gets the number of available hashes */
PHP_FUNCTION(mhash_count)
+2
View File
@@ -12,6 +12,8 @@
extern zend_module_entry mhash_module_entry;
#define mhash_module_ptr &mhash_module_entry
static PHP_MINIT_FUNCTION(mhash);
PHP_MINFO_FUNCTION(mhash);
PHP_FUNCTION(mhash_get_block_size);
PHP_FUNCTION(mhash_get_hash_name);
PHP_FUNCTION(mhash_count);
+1
View File
@@ -1,2 +1,3 @@
- general cleanup
- support for content-encoding / compressed files
- nuke all TSRMLS_FETCH() calls where possible
+6 -6
View File
@@ -182,10 +182,10 @@ static int mcheck(union VALUETYPE *, struct magic *);
static void mprint(union VALUETYPE *, struct magic *);
static int mconvert(union VALUETYPE *, struct magic *);
static int magic_rsl_get(char **, char **);
static int magic_process(char *);
static int magic_process(char * TSRMLS_DC);
static long from_oct(int, char *);
static int fsmagic(char *fn);
static int fsmagic(char *fn TSRMLS_DC);
#if HAVE_ZLIB
@@ -305,7 +305,7 @@ PHP_FUNCTION(mime_content_type)
MIME_MAGIC_G(req_dat) = magic_set_config();
if(MIME_MAGIC_OK != magic_process(filename)) {
if(MIME_MAGIC_OK != magic_process(filename TSRMLS_CC)) {
RETVAL_FALSE;
} else if(MIME_MAGIC_OK != magic_rsl_get(&content_type, &content_encoding)) {
RETVAL_FALSE;
@@ -943,7 +943,7 @@ static char *rsl_strdup(int start_frag, int start_pos, int len)
* (formerly called "process" in file command, prefix added for clarity) Opens
* the file and reads a fixed-size buffer to begin processing the contents.
*/
static int magic_process(char *filename)
static int magic_process(char *filename TSRMLS_DC)
{
php_stream *stream;
unsigned char buf[HOWMANY + 1]; /* one extra for terminating '\0' */
@@ -953,7 +953,7 @@ static int magic_process(char *filename)
/*
* first try judging the file based on its filesystem status
*/
switch ((result = fsmagic(filename))) {
switch ((result = fsmagic(filename TSRMLS_CC))) {
case MIME_MAGIC_DONE:
magic_rsl_putchar('\n');
return MIME_MAGIC_OK;
@@ -1032,7 +1032,7 @@ static void tryit(unsigned char *buf, int nb, int checkzmagic)
* return MIME_MAGIC_OK to indicate it's a regular file still needing handling
* other returns indicate a failure of some sort
*/
static int fsmagic(char *filename)
static int fsmagic(char *filename TSRMLS_DC)
{
php_stream_statbuf stat_ssb;
+6 -6
View File
@@ -1249,8 +1249,8 @@ static SWFMorph getMorph(zval *id TSRMLS_DC)
}
/* }}} */
/* {{{ proto SWFShape swfmorph_getShape1(void)
Return's this SWFMorph's start shape */
/* {{{ proto object swfmorph_getShape1(void)
Return's this SWFMorph's start shape object */
PHP_FUNCTION(swfmorph_getShape1)
{
SWFMorph morph = getMorph(getThis() TSRMLS_CC);
@@ -1263,8 +1263,8 @@ PHP_FUNCTION(swfmorph_getShape1)
}
/* }}} */
/* {{{ proto SWFShape swfmorph_getShape2(void)
Return's this SWFMorph's start shape */
/* {{{ proto object swfmorph_getShape2(void)
Return's this SWFMorph's start shape object */
PHP_FUNCTION(swfmorph_getShape2)
{
SWFMorph morph = getMorph(getThis() TSRMLS_CC);
@@ -2133,8 +2133,8 @@ static SWFMovieClip getSprite(zval *id TSRMLS_DC)
}
/* }}} */
/* {{{ proto SWFDisplayItem swfsprite_add(SWFCharacter)
Adds the character to the sprite, returns a displayitem */
/* {{{ proto object swfsprite_add(SWFCharacter)
Adds the character to the sprite, returns a displayitem object */
PHP_FUNCTION(swfsprite_add)
{
zval **zchar;
+1 -7
View File
@@ -3,15 +3,9 @@ $Id$
mnoGoSearch extension module for PHP4.
For details please refer to http://search.mnogo.ru
For details please refer to http://www.mnogosearch.org/
If used with mysql you should not use bundled mysql library
in the php distribution. You should use native mysql
library. To do this you should compile php with specefying mysql-dir
(for example --with-mysql=/usr, not --with-mysql).
TODO
----
Implement indexing functions of the library.
For example retrieving, parsing, checking of the URL and so on...
+73 -14
View File
@@ -5,9 +5,9 @@
$Id$
*/
/* mnoGoSearch-php-lite v.1.2
/* mnoGoSearch-php-lite v.1.4
* for mnoGoSearch ( formely known as UdmSearch ) free web search engine
* (C) 2001 by Sergey Kartashoff <gluke@mail.ru>,
* (C) 2001-2002 by Sergey Kartashoff <gluke@mail.ru>,
* mnoGoSearch Developers Team <devel@mnogosearch.org>
*/
@@ -28,8 +28,12 @@ $MAX_PS=100;
/* variables section */
$dbaddr='mysql://udm:udm@/udm/';
$dbmode='single';
if (Udm_Api_Version() >= 30204) {
$dbaddr='mysql://mnogo:mnogo@/mnogo/?dbmode=single';
} else {
$dbaddr='mysql://mnogo:mnogo@/mnogo/';
$dbmode='single';
}
$localcharset='koi8-r';
$browsercharset='utf-8';
@@ -37,13 +41,21 @@ $phrase=$cache=$crosswords='no';
$ispelluseprefixes=$trackquery='no';
$spell_host=$vardir=$datadir='';
$ispellmode='text';
$affix_file['en']='/opt/udm/ispell/en.aff';
$affix_file=array();
$spell_file=array();
$stopwordtable_arr=array();
$stopwordfile_arr=array();
$synonym_arr=array();
$searchd_arr=array();
// $affix_file['en']='/opt/udm/ispell/en.aff';
// $affix_file['ru']='/opt/udm/ispell/ru.aff';
$spell_file['en']='/opt/udm/ispell/en.dict';
// $spell_file['en']='/opt/udm/ispell/en.dict';
// $spell_file['ru']='/opt/udm/ispell/ru.dict';
$stopwordtable_arr[]='stopword';
$stopwordtable_arr[]='stopword';
// $stopwordfile_arr[]='stopwords.txt';
$synonym_arr[]='/opt/udm/synonym/english.syn';
// $synonym_arr[]='/opt/udm/synonym/english.syn';
$searchd_arr[]='localhost';
$minwordlength=1;
@@ -53,6 +65,27 @@ $storedocurl="/cgi-bin/storedoc.cgi";
/* initialisation section */
if(isset($HTTP_GET_VARS)){
while(list($var, $val)=each($HTTP_GET_VARS)){
$$var=$val;
}
}
if(isset($HTTP_POST_VARS)){
while(list($var, $val)=each($HTTP_POST_VARS)){
$$var=$val;
}
}
if(isset($HTTP_COOKIE_VARS)){
while(list($var, $val)=each($HTTP_COOKIE_VARS)){
$$var=$val;
}
}
if(isset($HTTP_SERVER_VARS)){
while(list($var, $val)=each($HTTP_SERVER_VARS)){
$$var=$val;
}
}
$self=$PHP_SELF;
if ($ps=="") $ps=20;
@@ -72,7 +105,8 @@ $de=urldecode($de);
if ($db=="") $db='01/01/1970';
if ($de=="") $de='31/12/2020';
$storedaddr="localhost";
// define this to enable stored support
// $storedaddr="localhost";
$storedocurl='/cgi-bin/storedoc.cgi';
if (isset($q)) {
@@ -479,7 +513,11 @@ function make_nav($query_orig){
$have_spell_flag=0;
$udm_agent=Udm_Alloc_Agent($dbaddr,$dbmode);
if (Udm_Api_Version() >= 30204) {
$udm_agent=Udm_Alloc_Agent($dbaddr);
} else {
$udm_agent=Udm_Alloc_Agent($dbaddr,$dbmode);
}
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PAGE_SIZE,$ps);
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PAGE_NUM,$np);
@@ -613,6 +651,11 @@ function make_nav($query_orig){
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_REMOTE_ADDR,$REMOTE_ADDR);
}
if (Udm_Api_Version() >= 30204) {
if ($have_query_flag)Udm_Set_Agent_Param($udm_agent,UDM_PARAM_QUERY,$query_orig);
if ($storedaddr != '') Udm_Set_Agent_Param($udm_agent,UDM_PARAM_STORED,$storedaddr);
}
if ($m=='any') {
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_ANY);
} elseif ($m=='all') {
@@ -924,11 +967,16 @@ if(($errno=Udm_Errno($udm_agent))>0){
print("Displaying documents $first_doc-$last_doc of total <B>$found</B> found.\n");
$stored_link=-1;
if ((Udm_Api_Version() >= 30203) && ($storedaddr != '')) {
if ((Udm_Api_Version() == 30203) && ($storedaddr != '')) {
$stored_link=Udm_Open_Stored($udm_agent,$storedaddr);
}
for($i=0;$i<$rows;$i++){
$excerpt_flag=0;
if (Udm_Api_Version() >= 30204) {
$excerpt_flag=Udm_Make_Excerpt($udm_agent, $res, $i);
}
$ndoc=Udm_Get_Res_Field($res,$i,UDM_FIELD_ORDER);
$rating=Udm_Get_Res_Field($res,$i,UDM_FIELD_RATING);
$url=Udm_Get_Res_Field($res,$i,UDM_FIELD_URL);
@@ -964,7 +1012,7 @@ if(($errno=Udm_Errno($udm_agent))>0){
print ("<A HREF=\"$url\" TARGET=\"_blank\">$url</A>\n");
print ("($contype) $lastmod, $docsize bytes</UL></DL>\n");
if (Udm_Api_Version() >= 30203) {
if (Udm_Api_Version() == 30203) {
if ((($stored_link>0) && (Udm_Check_Stored($udm_agent,$stored_link,Udm_CRC32($udm_agent,$url)))) ||
($stored_link==-1)) {
$storedstr="$storedocurl?rec_id=".Udm_CRC32($udm_agent,$url).
@@ -976,10 +1024,21 @@ if(($errno=Udm_Errno($udm_agent))>0){
"&q=".urlencode($query_orig);
print ("<DD><a href=\"$storedstr\">Cached copy</a>\n");
}
}
} elseif (Udm_Api_Version() >= 30204) {
if ($excerpt_flag) {
$storedstr="$storedocurl?rec_id=".Udm_CRC32($udm_agent,$save_url).
"&DM=".urlencode($lastmod).
"&DS=$docsize".
"&L=$doclang".
"&CS=$doccharset".
"&DU=".urlencode($save_url).
"&q=".urlencode($query_orig);
print_template('stored');
}
}
}
if ((Udm_Api_Version() >= 30203) &&
if ((Udm_Api_Version() == 30203) &&
($stored_link>0)) {
Udm_Close_Stored($udm_agent, $stored_link);
}
+105 -27
View File
@@ -77,6 +77,8 @@
#define UDM_PARAM_SEARCHD 22
#define UDM_PARAM_QSTRING 23
#define UDM_PARAM_REMOTE_ADDR 24
#define UDM_PARAM_QUERY 25
#define UDM_PARAM_STORED 26
/* udm_add_search_limit constants */
#define UDM_LIMIT_URL 1
@@ -148,7 +150,8 @@ function_entry mnogosearch_functions[] = {
PHP_FE(udm_crc32, NULL)
#endif
#if UDM_VERSION_ID >= 30204
PHP_FE(udm_parse_query_string,NULL)
PHP_FE(udm_parse_query_string, NULL)
PHP_FE(udm_make_excerpt, NULL)
#endif
#endif
@@ -291,9 +294,11 @@ DLEXPORT PHP_MINIT_FUNCTION(mnogosearch)
REGISTER_LONG_CONSTANT("UDM_PARAM_SYNONYM", UDM_PARAM_SYNONYM,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCHD", UDM_PARAM_SEARCHD,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_STORED", UDM_PARAM_STORED,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_QSTRING", UDM_PARAM_QSTRING,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_REMOTE_ADDR", UDM_PARAM_REMOTE_ADDR,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_PARAM_QUERY", UDM_PARAM_QUERY,CONST_CS | CONST_PERSISTENT);
/* udm_add_search_limit constants */
REGISTER_LONG_CONSTANT("UDM_LIMIT_CAT", UDM_LIMIT_CAT,CONST_CS | CONST_PERSISTENT);
@@ -354,13 +359,11 @@ DLEXPORT PHP_MINIT_FUNCTION(mnogosearch)
REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_DB", UDM_ISPELL_TYPE_DB,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_SERVER",UDM_ISPELL_TYPE_SERVER,CONST_CS | CONST_PERSISTENT);
#if UDM_VERSION_ID < 30200
/* word match mode params */
REGISTER_LONG_CONSTANT("UDM_MATCH_WORD", UDM_MATCH_WORD,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_MATCH_BEGIN", UDM_MATCH_BEGIN,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_MATCH_SUBSTR", UDM_MATCH_SUBSTR,CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("UDM_MATCH_END", UDM_MATCH_END,CONST_CS | CONST_PERSISTENT);
#endif
return SUCCESS;
}
@@ -419,6 +422,10 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent)
#if UDM_VERSION_ID >= 30204
Env=UdmEnvInit(NULL);
UdmVarListReplaceStr(&Env->Vars,"SyslogFacility","local7");
UdmSetLogLevel(Env,0);
UdmOpenLog("mnoGoSearch-php",Env,0);
if(!memcmp(dbaddr,"searchd:",8)){
UDM_URL Url;
UdmURLParse(&Url,dbaddr);
@@ -428,7 +435,7 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent)
if(UDM_OK!=UdmDBSetAddr(Env->db,dbaddr,UDM_OPEN_MODE_READ)){
sprintf(Env->errstr,"Invalid DBAddr: '%s'",dbaddr);
Env->errcode=1;
php_error(E_WARNING,"Udm_Alloc_Agent: Invalid DBAddr");
php_error(E_WARNING,"%s(): Invalid DBAddr", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
Agent=UdmAgentInit(NULL,Env,0);
@@ -465,6 +472,10 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent)
#if UDM_VERSION_ID >= 30204
Env=UdmEnvInit(NULL);
UdmVarListReplaceStr(&Env->Vars,"SyslogFacility","local7");
UdmSetLogLevel(Env,0);
UdmOpenLog("mnoGoSearch-php",Env,0);
if(!memcmp(dbaddr,"searchd:",8)){
UDM_URL Url;
UdmURLParse(&Url,dbaddr);
@@ -474,7 +485,7 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent)
if(UDM_OK!=UdmDBSetAddr(Env->db,dbaddr,UDM_OPEN_MODE_READ)){
sprintf(Env->errstr,"Invalid DBAddr: '%s'",dbaddr);
Env->errcode=1;
php_error(E_WARNING,"Udm_Alloc_Agent: Invalid DBAddr");
php_error(E_WARNING,"%s(): Invalid DBAddr", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
Agent=UdmAgentInit(NULL,Env,0);
@@ -576,7 +587,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
case UDM_MODE_PHRASE:
#if UDM_VERSION_ID >= 30200
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown search mode");
php_error(E_WARNING,"%s(): Unknown search mode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
#else
Agent->search_mode=UDM_MODE_PHRASE;
@@ -589,7 +600,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else
Agent->search_mode=UDM_MODE_ALL;
#endif
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown search mode");
php_error(E_WARNING,"%s(): Unknown search mode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -635,7 +646,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else
Agent->word_match=UDM_MATCH_WORD;
#endif
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown word match mode");
php_error(E_WARNING,"%s(): Unknown word match mode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -670,7 +681,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else
UdmReplaceStrVar(Agent->Conf->vars,"Cache","no",UDM_VARSRC_GLOBAL);
#endif
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown cache mode");
php_error(E_WARNING,"%s(): Unknown cache mode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -708,7 +719,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else
UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","no",UDM_VARSRC_GLOBAL);
#endif
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown track mode");
php_error(E_WARNING,"%s(): Unknown track mode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -727,7 +738,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
break;
default:
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown phrase mode");
php_error(E_WARNING,"%s(): Unknown phrase mode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -765,7 +776,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else
UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 1, UDM_VARSRC_GLOBAL);
#endif
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown ispell prefixes mode");
php_error(E_WARNING,"%s(): Unknown ispell prefixes mode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -796,7 +807,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
UdmVarListReplaceStr(&Agent->Conf->Vars,"BrowserCharset",val);
{
const char * charset=UdmVarListFindStr(&Agent->Conf->Vars,"BrowserCharset","iso-8859-1");
Agent->Conf->lcs=UdmGetCharSet(charset);
Agent->Conf->bcs=UdmGetCharSet(charset);
}
#else
Agent->Conf->browser_charset=strdup(val);
@@ -822,7 +833,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
case UDM_PARAM_SYNONYM:
if (UdmSynonymListLoad(Agent->Conf,val)) {
php_error(E_WARNING,Agent->Conf->errstr);
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C),Agent->Conf->errstr);
RETURN_FALSE;
#if UDM_VERSION_ID >= 30204
} else UdmSynonymListSort(&(Agent->Conf->Synonyms));
@@ -851,6 +862,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#endif
break;
case UDM_PARAM_REMOTE_ADDR:
#if UDM_VERSION_ID >= 30204
UdmVarListReplaceStr(&Agent->Conf->Vars,"IP",val);
@@ -873,7 +885,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else
if (UdmFileLoadStopList(Agent->Conf,val)) {
#endif
php_error(E_WARNING,Agent->Conf->errstr);
php_error(E_WARNING, "%s(): %s", Agent->Conf->errstr, get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
break;
@@ -940,7 +952,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
break;
default:
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown crosswords mode");
php_error(E_WARNING,"%s(): Unknown crosswords mode", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -959,9 +971,22 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
snprintf(Agent->Conf->vardir,sizeof(Agent->Conf->vardir)-1,"%s%s",val,UDMSLASHSTR);
#endif
break;
#if UDM_VERSION_ID >= 30204
case UDM_PARAM_QUERY:
UdmVarListReplaceStr(&Agent->Conf->Vars,"q",val);
break;
case UDM_PARAM_STORED:
UdmVarListReplaceStr(&Agent->Conf->Vars,"StoredAddr",val);
break;
#endif
#endif
default:
php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown agent session parameter");
php_error(E_WARNING,"%s(): Unknown agent session parameter", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -1055,12 +1080,12 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data)
#endif
if (UdmImportAffixes(Agent->Conf,val1,val2,NULL,0)) {
php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load affix file %s",val2);
php_error(E_WARNING,"%s(): Cannot load affix file %s", get_active_function_name(TSRMLS_C),val2);
RETURN_FALSE;
}
#else
if (UdmImportAffixes(Agent->Conf,val1,charset,val2)) {
php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load affix file %s",val2);
php_error(E_WARNING,"%s(): Cannot load affix file %s", get_active_function_name(TSRMLS_C),val2);
RETURN_FALSE;
}
@@ -1076,12 +1101,12 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data)
#endif
if (UdmImportDictionary(Agent->Conf,val1,val2,1,"")) {
php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load spell file %s",val2);
php_error(E_WARNING,"%s(): Cannot load spell file %s", get_active_function_name(TSRMLS_C),val2);
RETURN_FALSE;
}
#else
if (UdmImportDictionary(Agent->Conf,val1,charset,val2,0,"")) {
php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load spell file %s",val2);
php_error(E_WARNING,"%s(): Cannot load spell file %s", get_active_function_name(TSRMLS_C),val2);
RETURN_FALSE;
}
#endif
@@ -1089,7 +1114,7 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data)
default:
php_error(E_WARNING,"Udm_Load_Ispell_Data: Unknown ispell type parameter");
php_error(E_WARNING,"%s(): Unknown ispell type parameter", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -1213,7 +1238,7 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit)
} else if (val[0] == '<') {
Z_TYPE(stl_info)=-1;
} else {
php_error(E_WARNING,"Udm_Add_Search_Limit: Incorrect date limit format");
php_error(E_WARNING,"%s(): Incorrect date limit format", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -1223,7 +1248,7 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit)
#endif
break;
default:
php_error(E_WARNING,"Udm_Add_Search_Limit: Unknown search limit parameter");
php_error(E_WARNING,"%s(): Unknown search limit parameter", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
@@ -1485,6 +1510,59 @@ DLEXPORT PHP_FUNCTION(udm_parse_query_string)
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int udm_make_excerpt(int agent, int res, int row)
Perform search */
DLEXPORT PHP_FUNCTION(udm_make_excerpt)
{
pval ** yyagent, **yyres, **yyrow_num;
UDM_RESULT * Res;
UDM_AGENT * Agent;
int id=-1, row;
switch(ZEND_NUM_ARGS()){
case 3: {
if (zend_get_parameters_ex(3, &yyagent, &yyres, &yyrow_num)==FAILURE) {
RETURN_FALSE;
}
convert_to_string_ex(yyrow_num);
row=atoi(Z_STRVAL_PP(yyrow_num));
}
break;
default:
WRONG_PARAM_COUNT;
break;
}
ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
if(row<Res->num_rows){
const char *al;
char *Excerpt;
al = UdmVarListFindStr(&(Res->Doc[row].Sections), "URL", "");
UdmVarListReplaceInt(&(Res->Doc[row].Sections), "STORED_ID", UdmCRC32(al, strlen(al)));
Excerpt = UdmExcerptDoc(Agent, Res, &(Res->Doc[row]), 256);
if (Excerpt != NULL) {
char *HlExcerpt = UdmHlConvert(&Res->WWList, Excerpt, Agent->Conf->lcs, Agent->Conf->bcs);
UdmVarListReplaceInt(&(Res->Doc[row].Sections),"ST",1);
UdmVarListReplaceStr(&(Res->Doc[row].Sections),"Body",HlExcerpt);
UDM_FREE(HlExcerpt);
UDM_FREE(Excerpt);
} else {
UdmVarListReplaceInt(&(Res->Doc[row].Sections),"ST",0);
RETURN_FALSE;
}
}else{
php_error(E_WARNING,"%s(): row number too large", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
#endif
/* {{{ proto int udm_find(int agent, string query)
@@ -1672,12 +1750,12 @@ DLEXPORT PHP_FUNCTION(udm_get_res_field)
#endif
default:
php_error(E_WARNING,"Udm_Get_Res_Field: Unknown mnoGoSearch field name");
php_error(E_WARNING,"%s(): Unknown mnoGoSearch field name", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
}else{
php_error(E_WARNING,"Udm_Get_Res_Field: row number too large");
php_error(E_WARNING,"%s(): row number too large", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
}
@@ -1794,7 +1872,7 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
break;
default:
php_error(E_WARNING,"Udm_Get_Res_Param: Unknown mnoGoSearch param name");
php_error(E_WARNING,"%s(): Unknown mnoGoSearch param name", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
break;
}
+1
View File
@@ -67,6 +67,7 @@ DLEXPORT PHP_FUNCTION(udm_crc32);
#endif
#if UDM_VERSION_ID >= 30204
DLEXPORT PHP_FUNCTION(udm_parse_query_string);
DLEXPORT PHP_FUNCTION(udm_make_excerpt);
#endif
#endif
Loaded 100 of 336 files, more files were not shown because too many files have changed in this diff. Show more