Compare commits

..
569 changed files with 20651 additions and 27862 deletions

No files matched your search

+4 -14
View File
@@ -31,11 +31,6 @@ EXTENSION: aolserver
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: activescript
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
MAINTENANCE: Odd Fixes
STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: apache
PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
MAINTENANCE: Maintained
@@ -50,10 +45,6 @@ EXTENSION: cgi
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: cli
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: fhttpd
MAINTENANCE: Unknown
STATUS: Unknown
@@ -63,9 +54,8 @@ MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: nsapi
PRIMARY MAINTAINER: Uwe Schindler <thetaphi@php.net>
MAINTENANCE: Maintained
STATUS: Working
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: phttpd
MAINTENANCE: Unknown
@@ -99,7 +89,7 @@ STATUS: Experimental
-------------------------------------------------------------------------------
EXTENSION: dba
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -136,7 +126,7 @@ STATUS: Experimental
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: interbase
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>, Ard Biesheuvel <ard@ard.nu>
PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
MAINTENANCE: Odd Fixes
STATUS: Working
-------------------------------------------------------------------------------
+12 -22
View File
@@ -7,24 +7,20 @@ COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORK
all: $(all_targets)
@echo
@echo "Build complete."
@echo "(It is safe to ignore warnings about tempnam and tmpnam)."
@echo
build-modules: $(PHP_MODULES)
libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
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) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
install: $(all_targets) $(install_targets)
install: $(install_targets)
install-sapi: $(OVERALL_TARGET)
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
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 \
for i in 0.0.0 0.0 0; do \
@@ -50,21 +46,15 @@ install-tester:
install-su: install-pear install-tester
test:
-@if test -x $(SAPI_CLI_PATH) && test ! -z $(SAPI_CLI_PATH); then \
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' $(top_srcdir)/run-tests.php $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi
test: $(SAPI_CLI_PATH)
@TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' $(top_srcdir)/run-tests.php $(TESTS)
clean:
find . -name \*.lo | xargs rm -f
find . -name \*.o | xargs rm -f
find . -name \*.la | xargs rm -f
find . -name \*.a | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp4.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
+39 -324
View File
@@ -1,259 +1,19 @@
PHP 4 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2003, Version 4.3.4
- Made MCVE extension available on win32. (Jani)
- Added apache_get_version() function. (Ilia)
- Fixed disk_total_space() and disk_free_space() under FreeBSD. (Jon Parise)
- Fixed crash bug when non-existing save/serializer handler was used. (Jani)
- Fixed memory leak in gethostbynamel() if an error occurs. (Sara)
- Fixed FastCGI being unable to bind to a specific IP. (Sascha)
- Fixed bug #25671 (str_replace corrupting subarrays). (Sara)
- Fixed Bug #25665 (var_dump() hangs on Nan and INF). (Ilia)
- Fixed bug #25648 (xslt_set_encoding() being not detected correctly). (Jani)
- Fixed bug #25636 (SNMP Session not closed on success). (Ilia,
nesslage[at]mwsc[dot]edu)
- Fixed bug #25635 (Make "make tests" to fail due to invalid include_path). (Ilia)
- Fixed bug #25604 (HAVE_SNMP_PARSE_OID undefined with phpize build). (Jani)
- Fixed bug #25583 (Incorrect handling of paths starting with / on win32
inside glob() function). (Ilia)
- Fixed bug #25570 (Possible crash in apache2handler when zend_bailout called
outside of zend_try {} block). (Ilia)
- Fixed bug #25530 (checkdate() incorrectly handles floats). (Ilia)
- Fixed bug #25525 (ldap_explode_dn() crashes when passed invalid dn).
(Sara, patch by: mikael dot suvi at trigger dot ee)
- Fixed bug #25504 (pcre_match_all() crashes when passed only 2 parameters).
(Jani)
- Fixed bug #25494 (array_merge*() allows non-arrays as argument). (Jay)
- Fixed bug #23488 (zlib.output_compression overrides Vary header). (Stefan)
- Fixed bug #25483 (ext/informix: bogus -469 error from ifx_query()).
(Jani, patch by: denisov at kubsu dot ru)
- Fixed bug #25463 (ext/cpdf: compile failure with bundled GD)
- Fixed bug #25429 (fix copying of stdin using copy() function). (Ilia)
- Fixed bug #25424 (ext/informix: lvarchar not supported in win32). (Jani)
- Fixed bug #25404 (ext/pgsql: open transactions not closed when script ends).
(Marcus)
- Fixed bug #25385 (ob_gzhandler(): typo in sapi_add_header_ex() call). (Jani)
- Fixed bug #25378 (unserialize() crashes with invalid data). (Jani)
- Fixed bug #25372 (sscanf() does not work with %X). (Jani)
- Fixed bug #25348 ("make install" fails with --enable-short-tags). (Jani)
- Fixed bug #25343 (is_dir() gives warning on FreeBSD). (Jani)
- Fixed bug #25333 (Possible body corruption & crash in win32 mail()). (Ilia)
- Fixed bug #25316 (Possible infinite loop inside _php_stream_write()). (Ilia)
- Fixed bug #25314 (FTP_ASCII mode behaving like binary from Win->Unix). (Sara)
- Fixed bug #25308 (php -m crashes when zend extensions are loaded). (Stas)
- Fixed bug #25307 (Crash with WDDX serializer). (Sascha, Jani)
- Fixed bug #25295 (QNX6: php_ini.c:414: 'alphasort' undeclared). (Jani)
- Fixed bug #25294 (ext/ftp: NLST failure leads to crash on exit). (Sara, Rob)
- Fixed bug #25293 (Output correct EOL to error_log). (Ilia)
- Fixed bug #25239 (ftp_fopen_wrapper not RFC compliant). (Sara)
- Fixed bug #25211 (image.c compile failure with AIX). (Marcus)
- Fixed bug #25166 (WDDX serializer handler missing in win32). (Jani)
- Fixed bug #25109 (Possible crash when fetching field names in pgsql). (Ilia)
- Fixed bug #25106 (Added more stringent checks on bzopen() mode). (Ilia)
- Fixed bug #25218 ("deflate" compressed pages had a gzip header). (Stefan)
- Fixed bug #25070 (Don't forget to unlock session files on win32 before
closing them). (Ilia)
- Fixed bug #24402 (Compile failure with gettext 0.12.x). (Jani)
- Fixed bug #23326 (ext/domxml: Attributes via append_child not supported).
(Melvyn)
- Fixed bug #21220 (Wrong Apache version shown in phpinfo() output). (Jani)
- Fixed bug #14049 (realpath() returns invalid results for non-existent paths).
(Ilia)
25 Aug 2003, Version 4.3.3
- Upgraded the bundled Expat library to version 1.95.6. (Jani)
- Upgraded the bundled PCRE library to version 4.3. (Andrei)
- Upgraded the bundled GD library to version GD 2.0.15. (Ilia)
- Improved the engine to use POSIX/socket IO where feasible. (Sascha)
- Improved the IMAP extension (Ilia)
. Added imap_timeout() function. (bug #24161)
. Added optional 'charset' parameter to imap_search() and imap_sort().
(bug #22505)
- Improved the InterBase extension (Daniela)
. Added transaction constants: IBASE_REC_VERSION, IBASE_REC_NO_VERSION,
IBASE_WRITE, IBASE_WAIT and IBASE_CONCURRENCY. (bugs #8797, #23887)
. Made numeric/decimal datatype handling work on any platform.
- Improved the NSAPI SAPI module (Uwe Schindler)
. Added possibility to use PHP to generate HTTP error pages (404 Not Found..)
. Added possibility to use PHP to generate directory listings for directories
without index.html
. php4_init (magnus.conf): new parameter to set alternate path to php.ini.
(php_ini="/path/to/php.ini")
. php4_execute (obj.conf): support for additional php.ini values.
Allows different settings per virtual server.
(See sapi/nsapi/nsapi-readme.txt for more information)
. Added support for virtual().
. Added nsapi_request_headers() and nsapi_response_headers() with aliases
for apache compatibility.
. Added "nsapi.read_timeout" php.ini option.
. Synced $_SERVER variables to be similar to Apache variables.
- Added DBA handler 'inifile' to support ini files. (Marcus)
- Added a "DEBUG" note to 'php -v' output when --enable-debug is used. (Derick)
- Added long options into CLI & CGI (e.g. --version). (Marcus)
- Added a new parameter to preg_match*() that can be used to specify
the starting offset in the subject string to match from. (Andrei)
- Fixed possible integer overflows in:
. base64_encode(). (Moriyoshi)
. bundled GD library. (Ilia)
- Fixed "mysql.connect_timeout" php.ini option to be settable with ini_set().
(Rasmus)
- Fixed FastCGI IIS document root problem. (Shane)
- Fixed corruption of multibyte character including 0x5c as second
byte in multipart/form-data. (Rui)
- Fixed possible crash in imagerotate() when an invalid color index
is used for background color. (Pierre-Alain Joye)
- Fixed a bug that under certain circumstances could invalidate safe_mode.
(Ilia)
- Fixed certificate version and allowed setting of the serial number in
openssl_csr_sign(). (Stefan Roehrich)
- Fixed each() to be binary safe for keys. (Zeev)
- Fixed ext/yaz to not log if "yaz.log_file" php.ini option is not set. (Adam)
- Fixed a bug in bundled libmysql (mysql bug #564). (Georg)
- Fixed ext/exif to honor "magic_quotes_runtime" php.ini option. (Marcus)
- Fixed bug #25093 (ext/pgsql: Various leaks due to non-freed queries). (Ilia)
- Fixed bug #25084 (ext/session: Fixed session.referer_check to be independent
on register_globals). (Ilia)
- Fixed bug #25081 (odbc_fetch_array() may mangle numeric fields). (Ilia)
- Fixed bug #25044 (header("Location:") changing HTTP status). (Marcus)
- Fixed bug #25037 (win32 mail(): Possible infinite loop inside SendText()).
(Ilia)
- Fixed bug #25007 (rand() & mt_rand() seed RNG every call). (Jani)
- Fixed bug #24989 (external libexpat conflicts with bundled libexpat). (Jani)
- Fixed bug #24980 (array_reduce() uses first element as default running
total). (Ilia)
- Fixed bug #24977 (Reverted mysql_select_db() optimization). (Ilia)
- Fixed bug #24958 (Apache2 SAPIs: Incorrect handling of 404s). (Ilia, Justin)
- Fixed bug #24951 (ob_flush() needlessly destroys output handler). (Ilia)
- Fixed bug #24936 (ext/fdf not linked properly as shared extension). (Jani)
- Fixed bug #24909 (Bad random numbers with ZTS builds on Solaris). (Ilia)
- Fixed bug #24897 (inconsistent behavior of shuffle() & array_multisort()).
(Ilia, Jani)
- Fixed bug #24883 ("variables_order" and "gpc_order" being ignored). (Ilia)
- Fixed bug #24873 (incorrect handling of / inside open_basedir). (Ilia)
- Fixed bug #24871 (aggregate(): methods misidentified as constructors). (Ilia)
- Fixed bug #24827 (ob_gzhandler overrides Vary header). (Ilia)
- Fixed bug #24792 (--enable-zend-multibyte causes random segfaults with ZTS).
(Fujimoto)
- Fixed bug #24783 (foreach($ar as $key => $val), $key not binary safe). (Zeev)
- Fixed bug #24760 (non-default SNMP port number not working). (Jani)
- Fixed bug #24752 (Unhandled "uniqueidentifier" field type).
(Ilia, s.sonnenberg[at]coolspot.de)
- Fixed bug #24710 (Crash when $obj->{0} is used). (Zeev)
- Fixed bug #24663 (\n. sequences were not being escaped). (Ilia)
- Fixed bug #24640 (var_export() and var_dump() can not output large floats).
(Marcus)
- Fixed bug #24629 (FreeBSD select() does not like large microseconds values).
(Mirco Bauer).
- Fixed bug #24609 (ext/domxml: segfault when using replace node across
different docs). (Rob Richards)
- Fixed bug #24594 (Rewrite of the imagefill() function). (Pierre-Alain Joye)
- Fixed bug #24592 (NULL related crash in session extension). (Sascha)
- Fixed bug #24573 (debug_backtrace() crashes if $this set to null). (Jani)
- Fixed bug #24560 (parse_url() incorrectly handling certain file:// based
schemas). (Ilia)
- Fixed bug #24557 (make fclose() respect refcount on the resource).
(Wez, Ilia)
- Fixed bug #24537 (apache2 compile misses some include directories). (Jani)
- Fixed bug #24535 (ext/mysql: crash when retrieving data from unbuffered
result after the original connection has been changed). (Ilia)
- Fixed bug #24519 (aggregate_methods_by_list() does not increment refcount).
- Fixed bug #24313 (file_exists() warning on non-existent files when
open_basedir is used). (Ilia)
- Fixed bug #24312 (base64_decode() does not skip 0xF0-0xFF characters).
(gereon.steffens[at]onvista.de, Ilia)
- Fixed bug #24284 (Fixed memory leak inside pg_ping()). (Ilia)
- Fixed bug #24249 (fdf_add_doc_javascript() not available on Windows). (Edin)
- Fixed bug #24224 (ibase_blob_get() overflow). (Ard)
- Fixed bug #24223 (missing variable initialization in bundled gd). (Ilia)
- Fixed bug #24220 (range() didn't handle numeric strings correctly). (Ilia)
- Fixed bug #24210 (not detecting assume_default_colors - typo). (Sara)
- Fixed bug #24198 (Invalid recursion detection in array_merge_recurcive()).
(Ilia)
- Fixed bug #24177 (Apache2 SAPIs: status set incorrectly after flush()).
(Ilia)
- Fixed bug #24155 (gdImageRotate270 incorrectly use x parameter for y axis).
(tom@gksystems.com, Ilia)
- Fixed bug #24150 (crash in imap_fetch_overview() &
imap_rfc822_write_address()). (Ilia)
- Fixed bug #24142 (workaround for a gcc bug affecting round()). (Marcus, Ilia)
- Fixed bug #24063 (serialize() missing 0 after the . on scientific notation).
(Marcus, Ilia)
- Fixed bug #24063 (scientific notation broken in *printf()). (Ilia)
- Fixed bug #24060 (ncurses_del_panel() causes segfault). (Georg)
- Fixed bug #24054 (Integer overflow failure with GCC/x86 for *=). (Sascha)
- Fixed bug #24028 (Reading raw post message by php://input failed). (Jani)
- Fixed bug #24009 (FastCGI handling of file not found). (Shane)
- Fixed bug #24007 (Problem with register_globals & arrays). (Ilia)
- Fixed bug #23951 (constants in static initializers clobbered by inheritance).
(Wez, Zend Engine)
- Fixed bug #23936 (ext/interbase: fail to select and fetch). (Ard)
- Fixed bug #23913 (make rename() work across partitions on *nix). (Ilia)
- Fixed bug #23912 (Invalid CSS in phpinfo() output). (Ilia)
- Fixed bug #23902 (NULL in CGI header output). (Shane)
- Fixed bug #23898 (Proper handling of NULLs in odbc_result, odbc_fetch_into
and odbc_result_all). (Ilia)
- Fixed bug #23897 (Fixed a check for mbfilter_ru.h). (aleks@m2media.ru, Ilia)
- Fixed bug #23894 (sprintf() decimal specifiers problem). (Moriyoshi)
- Fixed bug #23888 (Missing input validation for flags parameter). (Ilia)
- Fixed bug #23808 (broken imagecopymerge()). (Pierre-Alain Joye)
- Fixed bug #23798 (Spaces were not being stripped from Bcc header). (Ilia)
- Fixed bug #23792 (imagerotate() problems with limited platte, the function
will always return true color image from now on). (Pierre-Alain Joye)
- Fixed bug #23779 (mysql_connect(): disable local infile option if php.ini
option "open_basedir" is set). (Georg)
- Fixed bug #23769 (In FreeBSD glob() gives wrong result when pattern not
found). (Hartmut)
- Fixed bug #23733 (Coredump on startup with Oracle 9+). (Edin)
- Fixed bug #23685 (fake values returned when OID value is an empty string).
(Jani)
- Fixed bug #23664 (FastCGI socket listenting). (Shane)
- Fixed bug #23509 (exit code lost when exit() called from
register_shutdown_function()). (Ilia)
- Fixed bug #23463 (ext/dbase: added Dbase2 version check). (Vlad Krupin)
- Fixed bug #23285 (Potential Stack overflow in zendlex). (Wez)
- Fixed bug #23104 (hash position of static arrays not being reset). (Ilia)
- Fixed bug #23038, #23574 (aggregate() related leaks and crashes). (Andrei)
- Fixed bug #22947 (Ack() inside win32/sendmail.c may stall in certain
situations). (Ilia)
- Fixed bug #22690 (ob_start() did not work with create_function() callbacks).
(Marcus)
- Fixed bug #22592 (Cascading assignments to strings with curly braces broken).
(Stas)
- Fixed bug #22245 (References inside $_SESSION not being handled). (Ilia)
- Fixed bug #22154 (Possible crash when memory_limit is reached and output
buffering in addition to session.use_trans_sid is used). (Ilia)
- Fixed bug #22072 (Apache2 sapis do not detect aborted connections). (Ilia)
- Fixed bug #21958 (workaround for unusual realpath() on AIX & Tru64). (Ilia)
- Fixed bug #21957 (serialize() mangles objects with __sleep). (Ilia)
- Fixed bug #21918 (strange behaviour of mixed type in array-keys). (Marcus)
- Fixed bug #21855 (Threading issue on HP-UX). (Roshan Naik, Andi, Moriyoshi)
- Fixed bug #21611 (version_compare() does not support "p" as suffix).
(Stefan Walk)
- Fixed bug #21074 (Apache2: "ErrorDocument xxx /error.php" broken). (Jani)
- Fixed bug #20896 (-s -w modes with php-cli cause php to hang). (Ilia)
- Fixed bug #19613 (putenv("VAR=") does not empty VAR on win32). (Zeev)
- Fixed bug #18744 (ibase_blob_add() has max limit of 64k). (Ard)
- Fixed bug #18291 (escapeshellcmd() can now handle quoted arguments). (Ilia)
- Fixed bug #17414 (pthreads bug workaround). (timo.teras[at]iki.fi)
- Fixed bug #13142 (strtotime not handling "M d H:i:s Y" format). (Ilia)
- Fixed bug #11924 (ibase_query(), ibase_execute() mangled passed parameters).
(Jani)
- Fixed bug #7014 (crash in _php_ibase_error() after request shutdown). (Ard)
29 May 2003, Version 4.3.2
?? Apr 2003, Version 4.3.2
- Replaced the old Apache2 module (sapi/apache2filter) with new and improved
version (sapi/apache2handler). (Ian Holsman, Justin Erenkrantz)
- Syncronized bundled GD library with GD 2.0.12. (Ilia)
- Removed support for GDLIB version 1.x.x (php_gd.dll) on Windows. (Edin)
- Enabled read-only GIF support in the bundled GDLIB (php_gd2.dll) on Windows.
(Sebastian, Edin)
- Improved dba extension (Marcus)
. Added support for internal error handling of Berkeley db libraries.
. Disallowed Berkeley db versions 4.1.0 to 4.1.24 due to locking problems.
. Disallowed linkage of Berkeley db submodules against libraries with
different major versions.
. Disallowed configuring of more than one Berkeley db handler.
. Disallow Berkeley db versions 4.1.0 to 4.1.24 due to locking problems.
. Disallow linkage of Berkeley db submodules against libraries with
different major version.
. Disallow configuring of more than one Berkeley db handler.
. Reenabled dba_popen() with new persistent STDIO streams.
- Added a new Apache 2.0 SAPI module (sapi/apache2handler) based on the old
version (sapi/apache2filter). (Ian Holsman, Justin Erenkrantz)
- Added "disable_classes" php.ini option to allow administrators to disable
certain classes for security reasons. (Harald)
- Added man page for CLI version of PHP. (Marcus)
@@ -269,86 +29,53 @@ PHP 4 NEWS
--enable-memory-limit. (Andrey)
- Added improved JPEG 2000 support for getimagesize(). (Marcus, Adam Wright)
- Added XBM and WBMP support for getimagesize(). (Marcus)
- Added KOI8-R, CP866, and CP1251 support for htmlentities().
(Antony Dovgal, Moriyoshi)
- Added KOI8-R, CP866, and CP1251 support for htmlentities(). (Antony Dovgal, Moriyoshi)
- Added domdocument->free() to free XML-documents from memory. (Rob Richards)
- Fixed a bug in error reporting with the CLI for start-up errors. (Derick)
- Fixed spurious fsync calls during socket communication. (Sascha)
- Fixed a possible vhost issue in thttpd. (Sascha, dgl@dgl.cx)
- Fixed including from HTTP URLs. (Sascha)
- Fixed a lot of memory leaks in domxml. (Rob Richards, Chregu)
- Fixed a bug in GD's truecolor TTF handling. (Derick)
- Fixed several 64-bit problems. (Dave)
- Fixed several errors in hwapi extension. Objects weren't handled properly.
(Uwe)
- Fixed bug #23788 (str|preg_replace() clobber the array elements). (Ilia)
- Fixed bug #23765 (file uploads ignored due to case sensitivity). (Sara)
- Fixed bug #23738 (ifx_copy_blob() crash). (Jani)
- Fixed bug #23661 (mysql_fetch_array() gives no warning when an invalid
argument was passed as result_type). (Derick)
- Fixed bug #23619 (set_error_handler() registered handler not called for
object instances). (Jani, waboring@qualys.com)
- Fixed bug #23606 (Unable to build --with-db4 (db4.1.25)). (Marcus)
- Fixed bug #23567 (pfsockopen() returns dead connections). (Wez)
- Fixed bug #23539 (curl_exec() produces strange results). (daniel@haxx.se)
- Fixed bug #23527 (PostScript Type 1 fonts do not render properly).
(nid@home.se, Ilia)
- Fixed bug #23402 (crash with improper use of mssql_bind()). (Frank)
- Fixed bug #23371 (configure falsely detects c-client using SSL). (Jani)
- Fixed several errors in hwapi extension. Objects weren't handled properly. (Uwe)
- Fixed bug #23340 (fopen on multiple URLs causes memory corruption). (Wez)
- Fixed bug #23298 (serialize cuts off floats & doubles). (Ilia, Marcus)
- Fixed bug #23232 (safe_mode does not honor PHP_AUTH_* in apache2). (Ilia)
- Fixed bug #23232 (safe_mode does not honor PHP_AUTH_* in apache2) (Ilia)
- Fixed bug #23225 (money_format() didn't handle erroneous return of strfmon).
(Ilia, marcot@tabini.ca)
- Fixed bug #23201 (set_file_buffer() crashes with stdio streams). (Ilia)
- Fixed Bug #23188 (CDB databases created with 'c' mode do not work). (Marcus)
- Fixed bug #23187 (memory leaks in sybase_connect/sybase_pconnect). (Ilia)
- Fixed bug #23162 (user_error() crashs if error message > 1024 bytes).
(Jay, Marcus, Moriyoshi)
- Fixed bug #23152 ($http_response_header empty on invalid URLs). (Ilia)
- Fixed bug #23152 ($http_response_header empty on invalid URLs) (Ilia)
- Fixed bug #23102 (integer overflow in exif_iif_add_value()). (Ilia)
- Fixed bug #23099 (ext/interbase: libgds.so: undefined reference to 'crypt').
(Jani)
- Fixed bug #23099 (ext/interbase: "libgds.so: undefined reference to 'crypt'"). (Jani)
- Fixed bug #23093 (highlight_string() crashed with __FUNCTION__). (Jani)
- Fixed bug #23080 (socket_strerror() crashes on win32). (Moriyoshi)
- Fixed bug #23071 (when DST in effect, date("T") crashed PHP).
(Scott MacVicar, Jani)
- Fixed bug #23071 (when DST in effect, date("T") crashed PHP). (Scott MacVicar, Jani)
- Fixed bug #23069 (tempnam creates readonly file [win32]). (Wez)
- Fixed bug #23009 (pg_select with timestamp). (Marcus, Jay)
- Fixed bug #23008 (ldap_start_tls() not available on Windows). (Edin)
- Fixed bug #23004 (When ftp_close() is called, send QUIT to the ftp server).
(Ilia)
- Fixed bug #23004 (When ftp_close() is called, send QUIT to the ftp server). (Ilia)
- Fixed bug #22989 (sendmail not found by configure). (igyu@ionsphere.org)
- Fixed bug #22987 (missing perror() check in configure). (Jani)
- Fixed bug #22965 (Crash in gd lib's ImageFillToBorder()). (Ilia)
- Fixed bug #22939 (crash in imap_header_info()). (Ilia)
- Fixed bug #22844 (Changing bool value via -d or ini_set(), On would be Off).
(Ilia)
- Fixed bug #22786 (Crash when trying to call DomAttribute's
set_namespace method). (Chregu)
- Fixed bug #22844 (Changing bool value via -d or ini_set(), On would be Off). (Ilia)
- Fixed bug #22786 (Crash when trying to call DomAttribute's set_namespace method). (Chregu)
- Fixed bug #22775 (Fatal errors exit with status 0 with CGI/CLI). (Jani)
- Fixed bug #22774 (PHP crashes when exiting (long XML doc)). (Rob Richards)
- Fixed bug #22751 (Compile error in gdcache.c when external libgd is used).
(Jani)
- Fixed bug #22751 (Compile error in gdcache.c when external libgd is used). (Jani)
- Fixed bug #22721 (Poor file() performance on systems without mmap). (Wez)
- Fixed bug #22709 (Crash in interbase when database unavailable).
(Vladimir Michl)
- Fixed bug #22709 (Crash in interbase when database unavailable). (Vladimir Michl)
- Fixed bug #22681 (Crash when reading from invalid file pointer). (Ilia)
- Fixed bug #22672 (User not logged under Apache2). (Ian)
- Fixed bug #22616 (Wrong order of -lssl and -lcrypto with IMAP). (Jani)
- Fixed bug #22613 (imagettfbox() does not add the kerning distance to the
running position). (Ilia)
- Fixed bug #22585 (Do not terminate the script on minor errors). (Ilia)
- Fixed bug #22550 (overflow protection for upload_max_filesize ini option).
(Ilia)
- Fixed bug #22550 (overflow protection for upload_max_filesize ini option). (Ilia)
- Fixed bug #22544 (writing transparency to truecolor png images). (Ilia)
- Fixed bug #22538 (failed stat on stdio/stdin/stderr streams). (Wez, Ilia)
- Fixed bug #22530 (append_child does not unlink node). (Chregu)
- Fixed bug #22520 (mcrypt_generic_deinit() was not available on Windows).
(Edin)
- Fixed bug #22520 (mcrypt_generic_deinit() was not available on Windows). (Edin)
- Fixed bug #22508 (Added protection against circular HTML redirects). (Ilia)
- Fixed bug #22473 (ISAPI Secure Server variables not available).
(Christian Swoboda)
- Fixed bug #22473 (ISAPI Secure Server variables not available). (Christian Swoboda)
- Fixed bug #22402 (opening of ftp for read/write could fail due to invalid
return code handling). (Ilia)
- Fixed bug #22384 (FNM_CASEFOLD is not available). (Hartmut)
@@ -362,13 +89,12 @@ PHP 4 NEWS
- Fixed bug #22312 (crash on failed connection when curl_getinfo() was called).
(Phil Oleson <poleson@verio.net>)
- Fixed bug #22308 (optimized passthru, code is now ~40 times faster). (Ilia)
- Fixed bug #22306 (pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds but
returns false). (Jani)
- Fixed bug #22306 (pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds but returns false).
(Jani)
- Fixed bug #22301 (htmlspecialchars() crashes Apache on Tru64). (Ilia)
- Fixed bug #22299 (gethostbyname() with non-existing domain crashed on MacOSX).
(Jani)
- Fixed bug #22283 (possible crash when opening relative URLs). (Ilia)
- Fixed bug #22238 (stream_select() clobbers fifos under win9x). (Wez)
- Fixed bug #22234 (copy() fails if source file has 0 length). (Moriyoshi)
- Fixed bug #22227 (printf() field limiters broke between 4.2.3 and 4.3.0).
(Moriyoshi)
@@ -377,8 +103,7 @@ PHP 4 NEWS
- Fixed bug #22207 (e notation in *printf would be missing a 0 when there is
no exponent). (Ilia)
- Fixed bug #22220 ("php_admin_value open_basedir none" does not work). (Jani)
- Fixed bug #22191 (frontbase build broken with old version of frontbase).
(Ilia)
- Fixed bug #22191 (frontbase build broken with old version of frontbase). (Ilia)
- Fixed bug #22187 (spprintf function did not handle floats correctly). (Ilia)
- Fixed bug #22149 (incorrect insertion of session id when tabs are used to
separate tag elements). (Ilia)
@@ -392,33 +117,25 @@ PHP 4 NEWS
abnormally large number of special characters). (Ilia)
- Fixed bug #22042 (pg_result_seek() would never seek to the 1st row in the
result due to always seeking to row next to the one requested). (Ilia)
- Fixed bug #22031 (Made curl_write() & curl_write_header() binary safe).
(Ilia)
- Fixed bug #22031 (Made curl_write() & curl_write_header() binary safe). (Ilia)
- Fixed bug #22022 (Crash in imap_mail_compose() if the body is an empty array).
(Ilia)
- Fixed bug #22017 (date() does not support negative timestamps on win32).
(Ilia)
- Fixed bug #22008 (strip_tags() eliminates too much). (Moriyoshi)
- Fixed bug #21007 (html_errors off text-only output in phpinfo). (Marcus)
- Fixed bug #22017 (date() does not support negative timestamps on win32). (Ilia)
- Fixed bug #22004 (Overload extension and _call() breaks classes). (Shane)
- Fixed bug #21998 (array_pop() did not reset the current array position).
(Jani)
- Fixed bug #21998 (array_pop() did not reset the current array position). (Jani)
- Fixed bug #21978, #21036 (win32 mail(), bcc: gets interpreted as cc:). (Sara)
- Fixed bug #21885 (move_uploaded_file() does not ignore open_basedir). (Wez)
- Fixed bug #21820 ("$arr['foo']" generates bogus E_NOTICE, should be E_PARSE).
(Jani)
- Fixed bug #21815 (fpassthru() ignored buffered data but complained anyway).
(Wez)
- Fixed bug #21809 (select would not always timeout during socket shutdown).
- Fixed bug #21820 ("$arr['foo']" generates bogus E_NOTICE, should be E_PARSE). (Jani)
- Fixed bug #21815 (fpassthru() ignored buffered data but complained anyway).
(Wez)
- Fixed bug #21809 (select would not always timeout during socket shutdown). (Wez)
- Fixed bug #21751 (default output buffer could not be deleted). (Marcus)
- Fixed bug #21725 (return behaviour differs between include and require).
(Zeev)
- Fixed bug #21725 (return behaviour differs between include and require). (Zeev)
- Fixed bug #21713 (include remote files leaks descriptors on Solaris). (Wez)
- Fixed bug #21708 (ucwords() trouble again). (Moriyoshi)
- Fixed bug #21689 (fgetcsv() suppresses some characters before a separator).
(Masahiro, Moriyoshi)
- Fixed bug #21912, #21676 (getimagesize() failed for remote files). (Wez)
- Fixed bug #21912, #21676 (GetImageSize() failed for remote files). (Wez)
- Fixed bug #21597 (made glob() understand Windows paths). (Edin)
- Fixed bug #21549 (problem with Ingres II persistent connections). (Jani)
- Fixed bug #21544 (Extended checks for where FreeTDS is installed). (Frank)
@@ -437,8 +154,8 @@ PHP 4 NEWS
- Fixed bug #21453 (improper handling of non-terminated < by strip_tags()).
(Ilia)
- Fixed bug #21445 (gd unable to open fonts). (Ilia)
- Fixed bug #21443 (improper handling of ? surrounded by spaces
in get_browser()). (Ilia)
- Fixed bug #21443 (improper handling of ? surrounded by spaces in
get_browser()). (Ilia)
- Fixed bug #21442 (crash in mail() on Windows when 1st parameter is empty).
(Edin)
- Fixed bug #21410 (fixed handling of NULL or "" files on Win32). (Ilia)
@@ -446,8 +163,8 @@ PHP 4 NEWS
- Fixed bug #21338 (html_entity_decode() crashed when "" is passed). (Ilia)
- Fixed bug #21310 (Solaris has issues with getcwd() needing read permissions
on directories instead of just execute). (Wez, jflemer)
- Fixed bug #21297 (in CLI/CGI on the #! it would leave a \n when the code
encounters \r\n). (Ilia)
- Fixed bug #21297 (in CLI/CGI sapis on the #! it would leave a \n when the
the code encounters \r\n). (Ilia)
- Fixed bug #21268 (session_decode() returned FALSE on success). (Ilia)
- Fixed bug #21267 (opening URLs that result in redirection to a relative
path was failing). (Ilia)
@@ -455,14 +172,13 @@ PHP 4 NEWS
- Fixed bug #21228 (broken check for ob_gzhandler and made ob_start() return
the correct value). (Ilia)
- Fixed bug #21226 (parse_url handling of urls without a path). (Ilia)
- Fixed bug #21224 (apache configure fails when using --enable-versioning).
(Jani)
- Fixed bug #21224 (apache configure fails when using --enable-versioning). (Jani)
- Fixed bug #21169 (Compile Failure and lots of warnings on UnixWare). (Derick)
- Fixed bug #21131 (fopen() with mode 'a+' and rewind() doesn't work). (Wez)
- Fixed bug #20857 (snmpset() failed always, patch by: rs@epost.de). (Jani)
- Fixed bug #20802 (PHP would die silently when memory limit reached). (Ilia)
- Fixed bug #20715 (odbc could not be compiled as shared extension). (Jani)
- Fixed bug #20641 (Numeric/decimal datatype overflow in ext/interbase
- Fixed bug #20641 (Numeric/decimal datatype overflow in the Interbase module
on Win32). (Daniela)
- Fixed bug #20503 (imagesetbrush() not available on Windows). (Edin)
- Fixed bug #20282 (COM memory leak). (Harald)
@@ -474,13 +190,12 @@ PHP 4 NEWS
(Ilia)
- Fixed bug #17448 (Print the message when OCI_SUCCESS_WITH_INFO is returned).
(Maxim)
- Fixed bug #17098 (make Apache2 aware that PHP scripts should not be cached).
- Fixed bug #17098 (make Apache2 aware that PHP scripts should not be cached).
(Ilia)
- Fixed bug #16798 (Compile failure with LOB support for Oracle version < 8.1).
(Maxim)
- Fixed bug #14532 (fixed connection_status() to return 2 for timeouts). (Jani)
- Fixed bug #14245 ('make install' fails on AIX when using --with-apxs). (Jani)
- Fixed bug #13757 (CGI: passing query string on command line broken). (Shane)
- Fixed bug #13561 (--without-pear disabled phpize/php-config install). (Jani)
- Fixed bug #13551 (bcmath functions applying scale incorrectly). (Sara)
+2 -3
View File
@@ -37,7 +37,7 @@ Note though that you might get little response, if your patch is
too hard to review.
If you would like change/add many lines, it is better to ask module
maintainer and/or internals@lists.php.net, or pear-dev@lists.php.net if
maintainer and/or php-dev@lists.php.net, or pear-dev@lists.php.net if
you are patching PEAR. Official module maintainers can be found in
EXTENSIONS file in PHP source.
@@ -79,7 +79,7 @@ Check list for submitting patch
Where to send your patch?
-------------------------
If you are patching C source, send the patch to internals@lists.php.net.
If you are patching C source, send the patch to php-dev@lists.php.net.
If you are patching a module, you should also send the patch to the
maintainer. Official module maintainers are listed in EXTENSION file
in source.
@@ -123,5 +123,4 @@ commit log. If your patch affects end-users, a brief description
and your name might be added to the NEWS file.
Thank you for submitting patch for PHP!
+5 -5
View File
@@ -80,11 +80,11 @@ documentation
ext/bz2
-------
* Add an ini directive to specify the size of decompression buffer.
The default 4k is too small for large files and also requires much time
for decompression. 40k is suitable for such files, however it may be too
much under certain environments. There should be appropriate default
settings for the various SAPI modules (e.g. apache and cli).
* Add ini setting for decompression buffer size. The default 4k is to small
for big files and takes ages to decompress. However, 40k which perform
quite good with big files may be to much under certain environments as
default setting. There should be consideren different default sizes for
different SAPIS (e.g. apache and cli).
ext/curl
--------
+40 -8
View File
@@ -15,7 +15,6 @@ Fixed:
str_repeat (Ilia)
imagecopyresized (Ilia)
mhash_keygen_s2k (Ilia)
bundled gd (Ilia)
mb_ereg, mb_ereg_match, mb_eregi, mb_split (Moriyoshi)
xml_parser_create (Moriyoshi)
ob_start (Sascha)
@@ -23,14 +22,18 @@ Fixed:
flock (Sascha)
register_shutdown_function (Sascha)
mb_strcut('', [number greater than the length of first arg]) (Moriyoshi)
ext/exif, ext/dba (Marcus)
php_base64_encode (Moriyoshi)
ext/exif, ext/dba (7) (Marcus)
Open:
the dbase extension (1)
socket_select (2)
pack (3)
chunk_split (2)
socket_select (3)
php_imagepolygon (4)
imagesetstyle (5)
bundled gd (6)
php_base64_encode (8)
pack (9)
(1) heap corruption, mostly visible in malloc-related calls. Whether you see
this or not might depend on your libc/compiler. Hard to track down,
@@ -50,7 +53,9 @@ dbase_numrecords
dbase_open
X
(2) heap corruption, dies in efree()/execute()
(2) integer overflow in php_chunk_split
(3) heap corruption, dies in efree()/execute()
Methodology
@@ -70,9 +75,36 @@ Methodology
echo dbase_open | php do_crash.txt
(3) multiple integer overflows, ex. pack("d4294967297", 2);
(4) integer overflow inside php_imagepolygon and possible subsequent
integer overflows inside gdlib's gdImageFilledPolygon().
Amendment 1.
(5) integer overflow if the number of elements in the array passed as
second argument * sizeof(int) result in an overflow.
gdImageSetStyle function called by this php wrapper can die for the
same reason.
(6) multiple integer overflows that can occur when trying to allocate a buffer
for a new image. Affected functions:
gdImageCreateFromJpegCtx
readwbmp
gdImageCreateFromXpm
gdImageCreateFromPngCtx
gdImagePngCtx
gdImageCreateFromJpegCtx
gdImageJpegCtx
gdImageCreateFromGd2Ctx
gdImageCreateFromGd2PartCtx
_gdImageGd2
GetDataBlock (gd_gif_in.c)
(7) few possible integer overflows, once safe_emalloc() or something similar
is implemented they can all be addressed.
(8) integer overflow if the specified string is longer then ~1.1 billion bytes.
(9) multiple integer overflows, ex. pack("d4294967297", 2);
Ammendment 1.
CFLAGS='-O0 -g' \
'../src/php4/configure' \
-1
View File
@@ -181,7 +181,6 @@ TSRM_API void tsrm_shutdown(void)
#if defined(GNUPTH)
pth_kill();
#elif defined(PTHREADS)
pthread_setspecific(tls_key, 0);
pthread_key_delete(tls_key);
#elif defined(TSRM_WIN32)
TlsFree(tls_key);
-1
View File
@@ -3,7 +3,6 @@
#define HAVE_UTIME 1
#define HAVE_ALLOCA 1
#define HAVE_REALPATH 1
#include <malloc.h>
#include <stdlib.h>
+1 -1
View File
@@ -22,7 +22,7 @@
#ifndef __GNUC__
# ifndef HAVE_ALLOCA_H
# ifdef _AIX
#pragma alloca
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
+8 -12
View File
@@ -92,7 +92,7 @@ static int php_check_dots(const char *element, int n)
(len >= 2 && !php_check_dots(element, len))
#define IS_DIRECTORY_CURRENT(element, len) \
(len == 1 && element[0] == '.')
(len == 1 && ptr[0] == '.')
#elif defined(NETWARE)
/* NetWare has strtok() (in LibC) and allows both slashes in paths, like Windows --
@@ -111,12 +111,12 @@ static int php_check_dots(const char *element, int n)
#ifndef IS_DIRECTORY_UP
#define IS_DIRECTORY_UP(element, len) \
(len == 2 && element[0] == '.' && element[1] == '.')
(len == 2 && memcmp(element, "..", 2) == 0)
#endif
#ifndef IS_DIRECTORY_CURRENT
#define IS_DIRECTORY_CURRENT(element, len) \
(len == 1 && element[0] == '.')
(len == 1 && ptr[0] == '.')
#endif
/* define this to check semantics */
@@ -486,23 +486,19 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC)
{
cwd_state new_state;
char *retval;
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
retval = virtual_file_ex(&new_state, path, NULL, 1);
if (virtual_file_ex(&new_state, path, NULL, 1)==0) {
if (!retval) {
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
memcpy(real_path, new_state.cwd, len);
real_path[len] = '\0';
retval = real_path;
} else {
retval = NULL;
return real_path;
}
CWD_STATE_FREE(&new_state);
return retval;
return NULL;
}
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path TSRMLS_DC)
+2 -29
View File
@@ -41,10 +41,6 @@
#include <unistd.h>
#endif
#if defined(__osf__) || defined(_AIX)
#include <errno.h>
#endif
#ifdef TSRM_WIN32
#include "readdir.h"
#include <sys/utime.h>
@@ -61,10 +57,10 @@ typedef unsigned short mode_t;
* to account for volume name that is unique to NetWare absolute paths
*/
#define COPY_WHEN_ABSOLUTE(path) 2
#define IS_ABSOLUTE_PATH(path, len) \
(len >= 2 && ((isalpha(path[0]) && path[1] == ':') || (IS_SLASH(path[0]) && IS_SLASH(path[1]))))
#define IS_UNC_PATH(path, len) \
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
#define IS_ABSOLUTE_PATH(path, len) \
(len >= 2 && ((isalpha(path[0]) && path[1] == ':') || IS_UNC_PATH(path, len)))
#elif defined(NETWARE)
#ifdef HAVE_DIRENT_H
@@ -159,25 +155,6 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC);
CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
#endif
/* On AIX & Tru64 when a file does not exist realpath() returns
* NULL, and sets errno to ENOENT. Unlike in other libc implementations
* the destination is not filled and remains undefined. Therefor, we
* must populate it manually using strcpy as done on systems with no
* realpath() function.
*/
#if defined(__osf__) || defined(_AIX)
static char *php_realpath_hack(char *src, char *dest)
{
char *ret;
if ((ret = realpath(src, dest)) == NULL && errno == ENOENT) {
return strcpy(dest, src);
} else {
return ret;
}
}
#endif
#if HAVE_UTIME
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
#endif
@@ -255,11 +232,7 @@ typedef struct _virtual_cwd_globals {
#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
#ifdef HAVE_REALPATH
#if defined(__osf__) || defined(_AIX)
#define VCWD_REALPATH(path, real_path) php_realpath_hack(path, real_path)
#else
#define VCWD_REALPATH(path, real_path) realpath(path, real_path)
#endif
#else
#define VCWD_REALPATH(path, real_path) strcpy(real_path, path)
#endif
-9
View File
@@ -359,13 +359,4 @@ TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf) {
return -1;
}
}
TSRM_API char *realpath(char *orig_path, char *buffer)
{
int ret = GetFullPathName(orig_path, _MAX_PATH, buffer, NULL);
if(!ret || ret > _MAX_PATH) {
return NULL;
}
return buffer;
}
#endif
-1
View File
@@ -101,5 +101,4 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags);
TSRM_API int shmdt(const void *shmaddr);
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
TSRM_API char *realpath(char *orig_path, char *buffer);
#endif
+97 -145
View File
@@ -16,9 +16,6 @@ AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[
sed -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments
])
AC_DEFUN(PHP_PROG_RE2C,[
AC_CHECK_PROG(RE2C, re2c, re2c, [exit 0;])
])
dnl PHP_DEFINE(WHAT[, value])
dnl
@@ -180,13 +177,73 @@ AC_DEFUN([PHP_REMOVE_USR_LIB],[
unset ac_new_flags
for i in [$]$1; do
case [$]i in
-L/usr/lib|-L/usr/lib/[)] ;;
*[)] ac_new_flags="[$]ac_new_flags [$]i" ;;
-L/usr/lib|-L/usr/lib/) ;;
*) ac_new_flags="[$]ac_new_flags [$]i" ;;
esac
done
$1=[$]ac_new_flags
])
AC_DEFUN([PHP_SETUP_OPENSSL],[
if test "$PHP_OPENSSL" = "yes"; then
PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
fi
for i in $PHP_OPENSSL; do
if test -r $i/include/openssl/evp.h; then
OPENSSL_INCDIR=$i/include
fi
if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then
OPENSSL_LIBDIR=$i/lib
fi
done
if test -z "$OPENSSL_INCDIR"; then
AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>])
fi
if test -z "$OPENSSL_LIBDIR"; then
AC_MSG_ERROR([Cannot find OpenSSL's libraries])
fi
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-I$OPENSSL_INCDIR
AC_MSG_CHECKING([for OpenSSL version])
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
yes
#endif
],[
AC_MSG_RESULT([>= 0.9.6])
],[
AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
])
CPPFLAGS=$old_CPPFLAGS
PHP_ADD_INCLUDE($OPENSSL_INCDIR)
PHP_ADD_LIBPATH($OPENSSL_LIBDIR)
PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
PHP_ADD_LIBRARY(crypto)
],[
AC_MSG_ERROR([libcrypto not found!])
],[
-L$OPENSSL_LIBDIR
])
PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
PHP_ADD_LIBRARY(ssl)
],[
AC_MSG_ERROR([libssl not found!])
],[
-L$OPENSSL_LIBDIR
])
OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
AC_SUBST(OPENSSL_INCDIR_OPT)
])
dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD)
dnl
dnl Use this macro, if you need to add libraries and or library search
@@ -196,11 +253,11 @@ dnl
AC_DEFUN([PHP_EVAL_LIBLINE],[
for ac_i in $1; do
case $ac_i in
-l*[)]
-l*)
ac_ii=`echo $ac_i|cut -c 3-`
PHP_ADD_LIBRARY($ac_ii,1,$2)
;;
-L*[)]
-L*)
ac_ii=`echo $ac_i|cut -c 3-`
PHP_ADD_LIBPATH($ac_ii,$2)
;;
@@ -216,7 +273,7 @@ dnl
AC_DEFUN([PHP_EVAL_INCLINE],[
for ac_i in $1; do
case $ac_i in
-I*[)]
-I*)
ac_ii=`echo $ac_i|cut -c 3-`
PHP_ADD_INCLUDE($ac_ii)
;;
@@ -280,10 +337,10 @@ AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
PHP_SUBST(SHLIB_SUFFIX_NAME)
SHLIB_SUFFIX_NAME=so
case $host_alias in
*hpux*[)]
*hpux*)
SHLIB_SUFFIX_NAME=sl
;;
*darwin*[)]
*darwin*)
SHLIB_SUFFIX_NAME=dylib
;;
esac
@@ -454,17 +511,17 @@ AC_DEFUN([PHP_ARG_ANALYZE_EX],[
ext_output="yes, shared"
ext_shared=yes
case [$]$1 in
shared,*[)]
shared,*)
$1=`echo "[$]$1"|sed 's/^shared,//'`
;;
shared[)]
shared)
$1=yes
;;
no[)]
no)
ext_output=no
ext_shared=no
;;
*[)]
*)
ext_output=yes
ext_shared=no
;;
@@ -597,8 +654,8 @@ main() {
])
])
case $ac_cv_time_r_type in
hpux[)] AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
irix[)] AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
hpux) AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
irix) AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
esac
])
@@ -1067,7 +1124,6 @@ AC_DEFUN([PHP_CHECK_CC_OPTION],[
AC_MSG_RESULT([no])
fi
fi
rm -rf conftest*
])
AC_DEFUN([PHP_REGEX],[
@@ -1130,9 +1186,7 @@ main() {
int res = 0;
res = res || (snprintf(buf, 2, "marcus") != 6);
res = res || (buf[1] != '\0');
/* Implementations may consider this as an encoding error */
snprintf(buf, 0, "boerger");
/* However, they MUST ignore the pointer */
res = res || (snprintf(buf, 0, "boerger") != 7);
res = res || (buf[0] != 'm');
res = res || (snprintf(NULL, 0, "boerger") != 7);
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
@@ -1153,7 +1207,7 @@ main() {
fi
])
dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx)
dnl PHP_SHARED_MODULE(module-name, object-var, build-dir)
dnl
dnl Basically sets up the link-stage for building module-name
dnl from object_var in build-dir.
@@ -1165,8 +1219,8 @@ AC_DEFUN([PHP_SHARED_MODULE],[
\$(phplibdir)/$1.la: $3/$1.la
\$(LIBTOOL) --mode=install cp $3/$1.la \$(phplibdir)
$3/$1.la: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES)
\$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
$3/$1.la: \$($2) \$(translit($1,a-z-,A-Z_)_SHARED_DEPENDENCIES)
\$(LIBTOOL) --mode=link \$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z-,A-Z_)_SHARED_LIBADD)
EOF
])
@@ -1182,10 +1236,10 @@ AC_DEFUN([PHP_SELECT_SAPI],[
PHP_SAPI=$1
case "$2" in
static[)] PHP_BUILD_STATIC;;
shared[)] PHP_BUILD_SHARED;;
bundle[)] PHP_BUILD_BUNDLE;;
program[)] PHP_BUILD_PROGRAM($5);;
static) PHP_BUILD_STATIC;;
shared) PHP_BUILD_SHARED;;
bundle) PHP_BUILD_BUNDLE;;
program) PHP_BUILD_PROGRAM($5);;
esac
ifelse($3,,,[PHP_ADD_SOURCES([sapi/$1],[$3],[$4],[sapi])])
@@ -1193,7 +1247,7 @@ AC_DEFUN([PHP_SELECT_SAPI],[
dnl deprecated
AC_DEFUN([PHP_EXTENSION],[
sources=`$AWK -f $abs_srcdir/build/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in`
sources=`awk -f $abs_srcdir/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in`
PHP_NEW_EXTENSION($1, $sources, $2, $3)
@@ -1211,7 +1265,7 @@ AC_DEFUN([PHP_GEN_BUILD_DIRS],[
])
dnl
dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags[, cxx]]]])
dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]])
dnl
dnl Includes an extension in the build.
dnl
@@ -1241,7 +1295,7 @@ dnl ---------------------------------------------- Static module
if test "$3" = "shared" || test "$3" = "yes"; then
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, $6)
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)
fi
fi
@@ -1271,13 +1325,13 @@ AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[
if test -n "$EXT_SHARED"; then
os=`uname -sr 2>/dev/null`
case $os in
"SunOS 5.6"|"SunOS 5.7"[)]
"SunOS 5.6"|"SunOS 5.7")
case $CC in
gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
*[)] CFLAGS="$CFLAGS -fpic";;
*) CFLAGS="$CFLAGS -fpic";;
esac
AC_MSG_RESULT([yes]);;
*[)]
*)
AC_MSG_RESULT([no]);;
esac
else
@@ -1315,8 +1369,8 @@ AC_DEFUN([PHP_SYS_LFS],
ac_shellvars='CPPFLAGS LDFLAGS LIBS'
for ac_shellvar in $ac_shellvars; do
case $ac_shellvar in
CPPFLAGS[)] ac_lfsvar=LFS_CFLAGS ;;
*[)] ac_lfsvar=LFS_$ac_shellvar ;;
CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
*) ac_lfsvar=LFS_$ac_shellvar ;;
esac
eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
(getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
@@ -1325,14 +1379,14 @@ AC_DEFUN([PHP_SYS_LFS],
eval ac_test_$ac_shellvar=\$ac_getconf
done
case "$ac_result$ac_getconfs" in
yes[)] ac_result=no ;;
yes) ac_result=no ;;
esac
case "$ac_result$ac_set" in
yes?*[)] ac_result="yes, but $ac_set is already set, so use its settings"
yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
esac
AC_MSG_RESULT([$ac_result])
case $ac_result in
yes[)]
yes)
for ac_shellvar in $ac_shellvars; do
eval $ac_shellvar=\$ac_test_$ac_shellvar
done ;;
@@ -1402,10 +1456,10 @@ AC_DEFUN([PHP_BROKEN_GETCWD],[
AC_MSG_CHECKING([for broken getcwd])
os=`uname -sr 2>/dev/null`
case $os in
SunOS*[)]
SunOS*)
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
AC_MSG_RESULT([yes]);;
*[)]
*)
AC_MSG_RESULT([no]);;
esac
])
@@ -1546,18 +1600,12 @@ dnl Wrapper for AC_CHECK_LIB
dnl
AC_DEFUN([PHP_CHECK_LIBRARY], [
save_old_LDFLAGS=$LDFLAGS
ac_stuff="$5"
save_ext_shared=$ext_shared
ext_shared=yes
PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS)
LDFLAGS="$5 $LDFLAGS"
AC_CHECK_LIB([$1],[$2],[
LDFLAGS=$save_old_LDFLAGS
ext_shared=$save_ext_shared
$3
],[
LDFLAGS=$save_old_LDFLAGS
ext_shared=$save_ext_shared
unset ac_cv_func_$1
$4
])dnl
@@ -1583,102 +1631,6 @@ AC_DEFUN([PHP_CHECK_FRAMEWORK], [
])
])
dnl
dnl PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]])
dnl
dnl Common setup macro for openssl
dnl
AC_DEFUN([PHP_SETUP_OPENSSL],[
found_openssl=no
unset OPENSSL_INCDIR
unset OPENSSL_LIBDIR
dnl First try to find pkg-config
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
dnl If pkg-config is found try using it
if test "$PHP_OPENSSL" = "yes" && test -x "$PKG_CONFIG"; then
if $PKG_CONFIG --atleast-version=0.9.6 openssl; then
found_openssl=yes
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
else
AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
fi
else
dnl If pkg-config fails for some reason, revert to the old method
if test "$PHP_OPENSSL" = "yes"; then
PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
fi
for i in $PHP_OPENSSL; do
if test -r $i/include/openssl/evp.h; then
OPENSSL_INCDIR=$i/include
fi
if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then
OPENSSL_LIBDIR=$i/lib
fi
done
if test -z "$OPENSSL_INCDIR"; then
AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>])
fi
if test -z "$OPENSSL_LIBDIR"; then
AC_MSG_ERROR([Cannot find OpenSSL's libraries])
fi
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-I$OPENSSL_INCDIR
AC_MSG_CHECKING([for OpenSSL version])
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
yes
#endif
],[
AC_MSG_RESULT([>= 0.9.6])
],[
AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.])
])
CPPFLAGS=$old_CPPFLAGS
PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
found_openssl=yes
OPENSSL_LIBS=-L$OPENSSL_LIBDIR -lcrypto -lssl
OPENSSL_INCS=-I$OPENSSL_INCDIR
], [
AC_MSG_ERROR([libssl not found!])
],[
-L$OPENSSL_LIBDIR -lcrypto
])
], [
AC_MSG_ERROR([libcrypto not found!])
],[
-L$OPENSSL_LIBDIR
])
fi
dnl For apache 1.3.x static build
OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
AC_SUBST(OPENSSL_INCDIR_OPT)
if test "$found_openssl" = "yes"; then
if test -n "$OPENSSL_LIBS" && test -n "$OPENSSL_INCS"; then
PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1)
PHP_EVAL_INCLINE($OPENSSL_INCS)
fi
$2
ifelse([$3],[],,[else $3])
fi
])
dnl
dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
dnl
@@ -1813,12 +1765,12 @@ AC_DEFUN([PHP_CHECK_FUNC],[
AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ])
case $found in
yes[)]
yes)
PHP_DEF_HAVE($1)
ac_cv_func_$1=yes
;;
ifelse($#,1,,[
*[)] PHP_CHECK_FUNC_LIB($@) ;;
*) PHP_CHECK_FUNC_LIB($@) ;;
])
esac
])
+2 -7
View File
@@ -52,13 +52,8 @@ $(TOUCH_FILES):
touch $(TOUCH_FILES)
aclocal.m4: configure.in acinclude.m4
@echo rebuilding $@
@libtoolize=`./build/shtool path glibtoolize libtoolize`; \
$$libtoolize --copy --automake; \
ltpath=`dirname $$libtoolize`; \
ltfile=`cd $$ltpath/../share/aclocal; pwd`/libtool.m4; \
cat acinclude.m4 $$ltfile > $@
aclocal 2>&1 | $(SUPPRESS_WARNINGS)
configure: aclocal.m4 configure.in $(config_m4_files)
@echo rebuilding $@
@autoconf 2>&1 | $(SUPPRESS_WARNINGS)
+36 -16
View File
@@ -12,11 +12,11 @@
# | obtain it through the world-wide-web, please send a note to |
# | license@php.net so we can mail you a copy immediately. |
# +----------------------------------------------------------------------+
# | Authors: Stig Bakken <ssb@php.net> |
# | Authors: Stig Bakken <ssb@fast.no> |
# | Sascha Schumann <sascha@schumann.cx> |
# +----------------------------------------------------------------------+
#
# $Id: buildcheck.sh,v 1.21.2.6 2003-09-28 13:37:59 tal Exp $
# $Id: buildcheck.sh,v 1.21.2.2 2003-04-16 12:05:43 jan Exp $
#
echo "buildconf: checking installation..."
@@ -24,7 +24,7 @@ echo "buildconf: checking installation..."
stamp=$1
# autoconf 2.13 or newer
ac_version=`autoconf --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
if test -z "$ac_version"; then
echo "buildconf: autoconf not found."
echo " You need autoconf version 2.13 or newer installed"
@@ -50,17 +50,39 @@ if test "$1" = "2" && test "$2" -ge "50"; then
stamp=
fi
# libtoolize 1.4.3 or newer
# Prefer glibtoolize over libtoolize for Mac OS X compatibility
libtoolize=`./build/shtool path glibtoolize libtoolize 2> /dev/null`
lt_pversion=`$libtoolize --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//'`
# 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]*$//'`
if test "$am_version" = ""; then
echo "buildconf: automake not found."
echo " You need automake version 1.4 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
IFS=.; set $am_version_clean; IFS=' '
if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
echo "buildconf: automake version $am_version found."
echo " You need automake version 1.4 or newer installed"
echo " to build PHP from CVS."
exit 1
else
echo "buildconf: automake version $am_version (ok)"
fi
# libtool 1.4 or newer
# Prefer glibtool over libtool for Mac OS X compatibility
libtool=`which glibtool 2> /dev/null`
if test ! -r "$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."
echo " You need libtool version 1.4.3 or newer installed"
echo " to build PHP from CVS."
exit 1
fi
IFS=.; set $lt_pversion; IFS=' '
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
IFS=.; set $lt_version; IFS=' '
if test "$3" = ""; then
third=0
@@ -78,14 +100,12 @@ echo " to build PHP from CVS."
exit 1
fi
ltpath=`echo $libtoolize | sed -e 's#/[^/]*/[^/]*$##'`
ltfile="$ltpath/share/aclocal/libtool.m4"
if test -r "$ltfile"; then
:
else
echo "buildconf: $ltfile does not exist."
echo " Please reinstall libtool."
exit 1
am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'`
lt_prefix=`echo $libtool | sed -e 's#/[^/]*/[^/]*$##'`
if test "$am_prefix" != "$lt_prefix"; then
echo "WARNING: automake and libtool are installed in different"
echo " directories. This may cause aclocal to fail."
echo " continuing anyway"
fi
test -n "$stamp" && touch $stamp
+4 -44
View File
@@ -1,60 +1,20 @@
#!/bin/sh
# $Id$
eval `grep '^EXTRA_VERSION=' configure.in`
case "$EXTRA_VERSION" in
*-dev)
dev=1
;;
*)
dev=0
;;
esac
devok=0
while test $# -gt 0; do
if test "$1" = "--copy"; then
automake_flags=--copy
fi
if test "$1" = "--force"; then
devok=1
echo "Forcing buildconf"
fi
if test "$1" = "--ZendEngine2"; then
ZENDDIR=ZendEngine2
echo "Using Zend Engine 2 code"
fi
shift
done
if test "$dev" = "0" -a "$devok" = "0"; then
echo "You should not run buildconf in a release package."
echo "use buildconf --force to override this check."
exit 1
fi
if test -z "$ZENDDIR"; then
if grep "PHP_MAJOR_VERSION 5" main/php_version.h >/dev/null; then
v=5
else
v=4
fi
if test "$v" = "5"; then
if test -r "Zend/OBJECTS2_HOWTO"; then
:
else
mv Zend ZendEngine1 2>/dev/null
mv ZendEngine2 Zend
fi
else
if test -r "Zend/zend_execute_globals.h"; then
:
else
mv Zend ZendEngine2 2>/dev/null
mv ZendEngine1 Zend
fi
fi
ZENDDIR=Zend
echo "using default Zend directory"
fi
+62 -88
View File
@@ -40,8 +40,8 @@ AC_CONFIG_HEADER(main/php_config.h)
MAJOR_VERSION=4
MINOR_VERSION=3
RELEASE_VERSION=4
EXTRA_VERSION="RC1"
RELEASE_VERSION=2
EXTRA_VERSION="-RC2"
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
dnl Define where extension directories are located in the configure context
@@ -127,7 +127,6 @@ dnl AC_PROG_CXXCPP
dnl check for -R, etc. switch
PHP_RUNPATH_SWITCH
PHP_PROG_RE2C
AC_PROG_RANLIB
AC_PROG_LN_S
AC_PROG_AWK
@@ -317,14 +316,17 @@ dnl -------------------------------------------------------------------------
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
dnl In QNX opendir resides in libc but dirent.h is still required
if test "`uname -s 2>/dev/null`" != "QNX"; then
AC_HEADER_DIRENT
else
AC_CHECK_HEADERS(dirent.h)
fi
PHP_MISSING_FCLOSE_DECL
dnl QNX requires unix.h to allow functions in libunix to work properly
AC_CHECK_HEADERS([ \
dirent.h \
ApplicationServices/ApplicationServices.h \
sys/param.h \
sys/types.h \
sys/time.h \
netinet/in.h \
@@ -368,11 +370,7 @@ unix.h \
utime.h \
sys/utsname.h \
sys/ipc.h \
dlfcn.h
],[],[],[
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -521,7 +519,7 @@ vsnprintf \
dnl Check for getaddrinfo, should be a better way, but...
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
[AC_TRY_LINK([#include <netdb.h>],
[AC_TRY_COMPILE([#include <netdb.h>],
[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)])
if test "$ac_cv_func_getaddrinfo" = yes; then
@@ -615,6 +613,27 @@ if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then
PHP_CONFIG_FILE_SCAN_DIR=""
fi
# compatibility
if test -z "$with_pear" && test "$enable_pear" = "no"; then
with_pear=no
fi
PHP_ARG_WITH(pear, [whether to install PEAR, and where],
[ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php)
--without-pear Do not install PEAR], DEFAULT, yes)
if test "$PHP_PEAR" != "no" && test "$disable_cli" != "1"; then
install_pear="install-pear"
PEAR_INSTALLDIR=$PHP_PEAR
fi
if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
case $PHP_LAYOUT in
GNU) PEAR_INSTALLDIR=$datadir/pear;;
*) PEAR_INSTALLDIR=$libdir/php;;
esac
fi
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
PHP_ARG_ENABLE(safe-mode, whether to enable safe mode by default,
@@ -712,19 +731,17 @@ if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
fi
AC_MSG_CHECKING([whether to enable versioning])
AC_ARG_ENABLE(versioning,
[ --enable-versioning Export only required symbols.
See INSTALL for more information], [
if test "x$APXS" != "x"; then
PHP_VERSIONING=$enableval
else
PHP_VERSIONING=no
fi
],[
PHP_VERSIONING=no
])
AC_MSG_RESULT([$PHP_VERSIONING])
dnl
dnl OpenSSL configure
dnl
PHP_ARG_WITH(openssl,for OpenSSL support,
[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6) ])
if test "$PHP_OPENSSL" != "no"; then
ext_openssl_shared=$ext_shared
PHP_SETUP_OPENSSL
fi
divert(5)
@@ -761,9 +778,26 @@ AC_ARG_ENABLE(all,
# reading config stubs
esyscmd(./build/config-stubs ext)
dnl Extensions post-config
dnl Other settings.
dnl -------------------------------------------------------------------------
PHP_HELP_SEPARATOR([Other settings:])
AC_MSG_CHECKING([whether to enable versioning])
AC_ARG_ENABLE(versioning,
[ --enable-versioning Export only required symbols.
See INSTALL for more information], [
if test "x$APXS" != "x"; then
PHP_VERSIONING=$enableval
else
PHP_VERSIONING=no
fi
],[
PHP_VERSIONING=no
])
AC_MSG_RESULT([$PHP_VERSIONING])
if test "$PHP_VERSIONING" = "yes"; then
test -z "$PHP_SYM_FILE" && PHP_SYM_FILE="$abs_srcdir/sapi/$PHP_SAPI/php.sym"
if test -f "$PHP_SYM_FILE"; then
@@ -789,6 +823,8 @@ shared)
;;
esac
PHP_REGEX
EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
dnl this has to be here to prevent the openssl crypt() from
@@ -799,64 +835,6 @@ fi
unset LIBS LDFLAGS
dnl PEAR
dnl -------------------------------------------------------------------------
PHP_HELP_SEPARATOR([PEAR:])
PHP_CONFIGURE_PART(Configuring PEAR)
# compatibility
if test -z "$with_pear" && test "$enable_pear" = "no"; then
with_pear=no
fi
PHP_ARG_WITH(pear, [whether to install PEAR],
[ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php)
--without-pear Do not install PEAR], DEFAULT, yes)
if test "$PHP_PEAR" != "no"; then
dnl
dnl PEAR dependancies
dnl
if test "$PHP_SAPI_CLI" = "no"; then
pear_error_msg="$pear_error_msg
PEAR requires CLI to be enabled. Add --enable-cli to the configure line."
fi
if test "$PHP_PCRE_REGEX" = "no"; then
pear_error_msg="$pear_error_msg
PEAR requires PCRE to be enabled. Add --with-pcre-regex to the configure line."
fi
if test "$PHP_XML" = "no"; then
pear_error_msg="$pear_error_msg
PEAR requires XML to be enabled. Add --enable-xml to the configure line."
fi
dnl
dnl ext/xmlrpc is not really there yet to be a requirement..
dnl
dnl if test "$PHP_XMLRPC" = "no"; then
dnl pear_error_msg="$pear_error_msg
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line."
dnl fi
dnl
if test "$pear_error_msg"; then
AC_MSG_ERROR([$pear_error_msg])
fi
install_pear="install-pear"
PEAR_INSTALLDIR=$PHP_PEAR
if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
case $PHP_LAYOUT in
GNU) PEAR_INSTALLDIR=$datadir/pear;;
*) PEAR_INSTALLDIR=$libdir/php;;
esac
fi
fi
dnl Configuring Zend and TSRM.
dnl -------------------------------------------------------------------------
@@ -890,7 +868,6 @@ if test "$PHP_THREAD_SAFETY" = "yes"; then
TSRM_THREADS_CHECKS
fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
EXTRA_LIBS="$EXTRA_LIBS $LIBS"
unset LIBS LDFLAGS
@@ -990,7 +967,6 @@ if test -z "$php_ldflags_add_usr_lib"; then
fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
PHP_BUILD_DATE=`date '+%Y-%m-%d'`
AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
@@ -1046,7 +1022,6 @@ PHP_SUBST_OLD(DEBUG_CFLAGS)
PHP_SUBST(DEFS)
PHP_SUBST_OLD(EXTENSION_DIR)
PHP_SUBST_OLD(EXTRA_LDFLAGS)
PHP_SUBST_OLD(EXTRA_LDFLAGS_PROGRAM)
PHP_SUBST_OLD(EXTRA_LIBS)
PHP_SUBST_OLD(ZEND_EXTRA_LIBS)
PHP_SUBST_OLD(INCLUDES)
@@ -1069,7 +1044,6 @@ PHP_SUBST(PHP_RPATHS)
PHP_SUBST(PHP_SAPI)
PHP_SUBST_OLD(PHP_VERSION)
PHP_SUBST(PROG_SENDMAIL)
PHP_SUBST(RE2C)
PHP_SUBST(SHELL)
PHP_SUBST(SHARED_LIBTOOL)
PHP_SUBST(TSRM_DIR)
@@ -1301,7 +1275,7 @@ cat <<X
| *** WARNING *** |
| |
| You chose to compile PHP with DB extension. This extension is |
| deprecated and does not support database locking correctly. Please |
| deprecated and does not support databse locking correctly. Please |
| use DBA extension which is a fully operational superset. |
X
fi
+2 -2
View File
@@ -439,7 +439,7 @@ PHP_FUNCTION(bcsqrt)
}
/* }}} */
/* {{{ proto int bccomp(string left_operand, string right_operand [, int scale])
/* {{{ proto string bccomp(string left_operand, string right_operand [, int scale])
Compares two arbitrary precision numbers */
PHP_FUNCTION(bccomp)
{
@@ -481,7 +481,7 @@ PHP_FUNCTION(bccomp)
}
/* }}} */
/* {{{ proto bool bcscale(int scale)
/* {{{ proto string bcscale(int scale)
Sets default scale parameter for all bc math functions */
PHP_FUNCTION(bcscale)
{
-2
View File
@@ -1,2 +0,0 @@
Bzip2
Sterling Hughes
-542
View File
@@ -1,542 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 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: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_bz2.h"
#if HAVE_BZ2
/* PHP Includes */
#include "ext/standard/file.h"
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
/* for fileno() */
#include <stdio.h>
/* Internal error constants */
#define PHP_BZ_ERRNO 0
#define PHP_BZ_ERRSTR 1
#define PHP_BZ_ERRBOTH 2
/* Blocksize of the decompression buffer */
#define PHP_BZ_DECOMPRESS_SIZE 4096
function_entry bz2_functions[] = {
PHP_FE(bzopen, NULL)
PHP_FE(bzread, NULL)
PHP_FALIAS(bzwrite, fwrite, NULL)
PHP_FALIAS(bzflush, fflush, NULL)
PHP_FALIAS(bzclose, fclose, NULL)
PHP_FE(bzerrno, NULL)
PHP_FE(bzerrstr, NULL)
PHP_FE(bzerror, NULL)
PHP_FE(bzcompress, NULL)
PHP_FE(bzdecompress, NULL)
{NULL, NULL, NULL}
};
zend_module_entry bz2_module_entry = {
STANDARD_MODULE_HEADER,
"bz2",
bz2_functions,
PHP_MINIT(bz2),
PHP_MSHUTDOWN(bz2),
NULL,
NULL,
PHP_MINFO(bz2),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_BZ2
ZEND_GET_MODULE(bz2)
#endif
struct php_bz2_stream_data_t {
BZFILE *bz_file;
php_stream *stream;
};
/* {{{ BZip2 stream implementation */
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
size_t ret;
ret = BZ2_bzread(self->bz_file, buf, count);
if (ret == 0) {
stream->eof = 1;
}
return ret;
}
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
return BZ2_bzwrite(self->bz_file, (char*)buf, count);
}
static int php_bz2iop_close(php_stream *stream, int close_handle TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
int ret = EOF;
if (close_handle) {
BZ2_bzclose(self->bz_file);
}
if (self->stream) {
php_stream_free(self->stream, PHP_STREAM_FREE_CLOSE | (close_handle == 0 ? PHP_STREAM_FREE_PRESERVE_HANDLE : 0));
}
efree(self);
return ret;
}
static int php_bz2iop_flush(php_stream *stream TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
return BZ2_bzflush(self->bz_file);
}
/* }}} */
php_stream_ops php_stream_bz2io_ops = {
php_bz2iop_write, php_bz2iop_read,
php_bz2iop_close, php_bz2iop_flush,
"BZip2",
NULL, /* seek */
NULL, /* cast */
NULL, /* stat */
NULL /* set_option */
};
/* {{{ Bzip2 stream openers */
PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz,
char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC)
{
struct php_bz2_stream_data_t *self;
self = emalloc(sizeof(*self));
self->stream = innerstream;
self->bz_file = bz;
return php_stream_alloc_rel(&php_stream_bz2io_ops, self, 0, mode);
}
PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
char *path,
char *mode,
int options,
char **opened_path,
php_stream_context *context STREAMS_DC TSRMLS_DC)
{
php_stream *retstream = NULL, *stream = NULL;
char *path_copy = NULL;
BZFILE *bz_file = NULL;
if (strncasecmp("compress.bzip2://", path, 17) == 0) {
path += 17;
}
if (mode[0] != 'w' && mode[0] != 'r' && mode[1] != '\0') {
return NULL;
}
#ifdef VIRTUAL_DIR
virtual_filepath_ex(path, &path_copy, NULL TSRMLS_CC);
#else
path_copy = path;
#endif
/* try and open it directly first */
bz_file = BZ2_bzopen(path_copy, mode);
if (opened_path && bz_file) {
*opened_path = estrdup(path_copy);
}
path_copy = NULL;
if (bz_file == NULL) {
/* that didn't work, so try and get something from the network/wrapper */
stream = php_stream_open_wrapper(path, mode, options, opened_path);
if (stream) {
int fd;
if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
bz_file = BZ2_bzdopen(fd, mode);
}
}
/* remove the file created by php_stream_open_wrapper(), it is not needed since BZ2 functions
* failed.
*/
if (!bz_file && mode[0] == 'w') {
VCWD_UNLINK(*opened_path);
}
}
if (bz_file) {
retstream = _php_stream_bz2open_from_BZFILE(bz_file, mode, stream STREAMS_REL_CC TSRMLS_CC);
if (retstream) {
return retstream;
}
BZ2_bzclose(bz_file);
}
if (stream) {
php_stream_close(stream);
}
return NULL;
}
/* }}} */
static php_stream_wrapper_ops bzip2_stream_wops = {
_php_stream_bz2open,
NULL, /* close */
NULL, /* fstat */
NULL, /* stat */
NULL, /* opendir */
"BZip2"
};
php_stream_wrapper php_stream_bzip2_wrapper = {
&bzip2_stream_wops,
NULL,
0 /* is_url */
};
static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int);
PHP_MINIT_FUNCTION(bz2)
{
php_register_url_stream_wrapper("compress.bzip2", &php_stream_bzip2_wrapper TSRMLS_CC);
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(bz2)
{
php_unregister_url_stream_wrapper("compress.bzip2" TSRMLS_CC);
return SUCCESS;
}
PHP_MINFO_FUNCTION(bz2)
{
php_info_print_table_start();
php_info_print_table_row(2, "BZip2 Support", "Enabled");
php_info_print_table_row(2, "BZip2 Version", (char *) BZ2_bzlibVersion());
php_info_print_table_end();
}
/* {{{ proto string bzread(int bz[, int length])
Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified */
PHP_FUNCTION(bzread)
{
zval *bz;
long len = 1024;
php_stream *stream;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) {
RETURN_FALSE;
}
php_stream_from_zval(stream, &bz);
if (len < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length may not be negative");
RETURN_FALSE;
}
Z_STRVAL_P(return_value) = emalloc(len + 1);
Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
if (Z_STRLEN_P(return_value) < 0) {
efree(Z_STRVAL_P(return_value));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream");
RETURN_FALSE;
}
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
if (PG(magic_quotes_runtime)) {
Z_STRVAL_P(return_value) = php_addslashes( Z_STRVAL_P(return_value),
Z_STRLEN_P(return_value),
&Z_STRLEN_P(return_value), 1 TSRMLS_CC);
}
Z_TYPE_P(return_value) = IS_STRING;
}
/* }}} */
/* {{{ proto resource bzopen(string|int file|fp, string mode)
Opens a new BZip2 stream */
PHP_FUNCTION(bzopen)
{
zval **file, /* The file to open */
**mode; /* The mode to open the stream with */
BZFILE *bz; /* The compressed file stream */
php_stream *stream = NULL;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &file, &mode) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(mode);
if (Z_STRVAL_PP(mode)[0] != 'r' && Z_STRVAL_PP(mode)[0] != 'w' && Z_STRVAL_PP(mode)[1] != '\0') {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.", Z_STRVAL_PP(mode));
RETURN_FALSE;
}
/* If it's not a resource its a string containing the filename to open */
if (Z_TYPE_PP(file) != IS_RESOURCE) {
convert_to_string_ex(file);
stream = php_stream_bz2open(NULL,
Z_STRVAL_PP(file),
Z_STRVAL_PP(mode),
ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL);
} else {
/* If it is a resource, than its a stream resource */
int fd;
php_stream_from_zval(stream, file);
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void *) &fd, REPORT_ERRORS)) {
RETURN_FALSE;
}
bz = BZ2_bzdopen(fd, Z_STRVAL_PP(mode));
stream = php_stream_bz2open_from_BZFILE(bz, Z_STRVAL_PP(mode), stream);
}
if (stream) {
php_stream_to_zval(stream, return_value);
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int bzerrno(resource bz)
Returns the error number */
PHP_FUNCTION(bzerrno)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRNO);
}
/* }}} */
/* {{{ proto string bzerrstr(resource bz)
Returns the error string */
PHP_FUNCTION(bzerrstr)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRSTR);
}
/* }}} */
/* {{{ proto array bzerror(resource bz)
Returns the error number and error string in an associative array */
PHP_FUNCTION(bzerror)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRBOTH);
}
/* }}} */
/* {{{ proto string bzcompress(string source [, int blocksize100k [, int workfactor]])
Compresses a string into BZip2 encoded data */
PHP_FUNCTION(bzcompress)
{
zval **source, /* Source data to compress */
**zblock_size, /* Optional block size to use */
**zwork_factor; /* Optional work factor to use */
char *dest = NULL; /* Destination to place the compressed data into */
int error, /* Error Container */
block_size = 4, /* Block size for compression algorithm */
work_factor = 0, /* Work factor for compression algorithm */
argc; /* Argument count */
unsigned int source_len, /* Length of the source data */
dest_len; /* Length of the destination buffer */
argc = ZEND_NUM_ARGS();
if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &source, &zblock_size, &zwork_factor) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(source);
/* Assign them to easy to use variables, dest_len is initially the length of the data
+ .01 x length of data + 600 which is the largest size the results of the compression
could possibly be, at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net
for pointing this out). */
source_len = Z_STRLEN_PP(source);
dest_len = Z_STRLEN_PP(source) + (0.01 * Z_STRLEN_PP(source)) + 600;
/* Allocate the destination buffer */
dest = emalloc(dest_len + 1);
/* Handle the optional arguments */
if (argc > 1) {
convert_to_long_ex(zblock_size);
block_size = Z_LVAL_PP(zblock_size);
}
if (argc > 2) {
convert_to_long_ex(zwork_factor);
work_factor = Z_LVAL_PP(zwork_factor);
}
error = BZ2_bzBuffToBuffCompress(dest, &dest_len, Z_STRVAL_PP(source), source_len, block_size, 0, work_factor);
if (error != BZ_OK) {
efree(dest);
RETURN_LONG(error);
} else {
/* Copy the buffer, we have perhaps allocate alot more than we need,
so we erealloc() the buffer to the proper size */
dest = erealloc(dest, dest_len + 1);
dest[dest_len] = 0;
RETURN_STRINGL(dest, dest_len, 0);
}
}
/* }}} */
/* {{{ proto string bzdecompress(string source [, int small])
Decompresses BZip2 compressed data */
PHP_FUNCTION(bzdecompress)
{
zval **source, /* Source data to decompress */
**zsmall; /* (Optional) user specified small */
char *dest; /* Destination buffer, initially allocated */
int error, /* Error container */
iter = 1, /* Iteration count for the compression loop */
size, /* Current size to realloc the dest buffer to */
dest_len = PHP_BZ_DECOMPRESS_SIZE, /* Size of the destination length */
small = 0, /* The actual small */
argc = ZEND_NUM_ARGS(); /* Argument count */
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &source, &zsmall) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(source);
/* optional small argument handling */
if (argc > 1) {
convert_to_long_ex(zsmall);
small = Z_LVAL_PP(zsmall);
}
/* Depending on the size of the source buffer, either allocate
the length of the source buffer or the a default decompression
size */
dest = emalloc(PHP_BZ_DECOMPRESS_SIZE > Z_STRLEN_PP(source) ? PHP_BZ_DECOMPRESS_SIZE : Z_STRLEN_PP(source));
/* (de)Compression Loop */
do {
/* Handle the (re)allocation of the buffer */
size = dest_len * iter;
if (iter > 1) {
dest = erealloc(dest, size);
}
++iter;
/* Perform the decompression */
error = BZ2_bzBuffToBuffDecompress(dest, &size, Z_STRVAL_PP(source), Z_STRLEN_PP(source), small, 0);
} while (error == BZ_OUTBUFF_FULL);
if (error != BZ_OK) {
efree(dest);
RETURN_LONG(error);
} else {
/* we might have allocated a little to much, so erealloc the buffer
down to size, before returning it */
dest = erealloc(dest, size + 1);
dest[size] = 0;
RETURN_STRINGL(dest, size, 0);
}
}
/* }}} */
/* {{{ php_bz2_error()
The central error handling interface, does the work for bzerrno, bzerrstr and bzerror */
static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
{
zval **bzp; /* BZip2 Resource Pointer */
php_stream *stream;
const char *errstr; /* Error string */
int errnum; /* Error number */
struct php_bz2_stream_data_t *self;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &bzp) == FAILURE) {
WRONG_PARAM_COUNT;
}
php_stream_from_zval(stream, bzp);
if (!php_stream_is(stream, PHP_STREAM_IS_BZIP2)) {
RETURN_FALSE;
}
self = (struct php_bz2_stream_data_t *) stream->abstract;
/* Fetch the error information */
errstr = BZ2_bzerror(self->bz_file, &errnum);
/* Determine what to return */
switch (opt) {
case PHP_BZ_ERRNO:
RETURN_LONG(errnum);
break;
case PHP_BZ_ERRSTR:
RETURN_STRING((char*)errstr, 1);
break;
case PHP_BZ_ERRBOTH:
array_init(return_value);
add_assoc_long (return_value, "errno", errnum);
add_assoc_string(return_value, "errstr", (char*)errstr, 1);
break;
}
}
/* }}} */
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: fdm=marker
* vim: noet sw=4 ts=4
*/
-108
View File
@@ -1,108 +0,0 @@
# Microsoft Developer Studio Project File - Name="bz2" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=bz2 - Win32 Debug_TS
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "bz2.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "bz2.mak" CFG="bz2 - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "bz2 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "bz2 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "bz2 - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release_TS"
# PROP Intermediate_Dir "Release_TS"
# 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 "BZ2_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_BZ2" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BZ2=1 /D "PHP_BZ2_EXPORTS" /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"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 libbz2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_bz2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
!ELSEIF "$(CFG)" == "bz2 - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZ2_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_BZ2" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BZ2=1 /D "PHP_BZ2_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 /debug /machine:I386 /pdbtype:sept
# ADD LINK32 php4ts_debug.lib libbz2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_bz2.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
!ENDIF
# Begin Target
# Name "bz2 - Win32 Release_TS"
# Name "bz2 - Win32 Debug_TS"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\bz2.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php_bz2.h
# End Source File
# End Group
# End Target
# End Project
-39
View File
@@ -1,39 +0,0 @@
dnl
dnl $Id$
dnl
PHP_ARG_WITH(bz2, for BZip2 support,
[ --with-bz2[=DIR] Include BZip2 support])
if test "$PHP_BZ2" != "no"; then
if test -r $PHP_BZ2/include/bzlib.h; then
BZIP_DIR=$PHP_BZ2
else
AC_MSG_CHECKING(for BZip2 in default path)
for i in /usr/local /usr; do
if test -r $i/include/bzlib.h; then
BZIP_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
if test -z "$BZIP_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the BZip2 distribution)
fi
PHP_CHECK_LIBRARY(bz2, BZ2_bzerror,
[
PHP_ADD_INCLUDE($BZIP_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(bz2, $BZIP_DIR/lib, BZ2_SHARED_LIBADD)
AC_DEFINE(HAVE_BZ2,1,[ ])
], [
AC_MSG_ERROR(bz2 module requires libbz2 >= 1.0.0)
], [
-L$BZIP_DIR/lib
])
PHP_NEW_EXTENSION(bz2, bz2.c, $ext_shared)
PHP_SUBST(BZ2_SHARED_LIBADD)
fi
-35
View File
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- do not use the "Type" attribute here, that one is only for
generated package.xml files -->
<package>
<name>bz2</name>
<summary>A Bzip2 management extension</summary>
<description>
Bz2 is an extension to create and parse bzip2 compressed data.
</description>
<license>PHP License</license>
<maintainers>
<maintainer>
<user>sterling</user>
<name>Sterling Hughes</name>
<email>sterling@php.net</email>
</maintainer>
</maintainers>
<release>
<version>1.0</version>
<date>2003-05-17</date>
<state>stable</state>
<notes>
Initial Release in PECL
</notes>
</release>
<filelist>
<dir role="src" name="/">
<file role="doc">CREDITS</file>
<file role="src">config.m4</file>
<file role="doc">php_bz2.h</file>
<file role="src">bz2.c</file>
<file role="src">bz2.dsp</file>
</dir>
</filelist>
</package>
-72
View File
@@ -1,72 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 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: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_BZ2_H
#define PHP_BZ2_H
#if HAVE_BZ2
extern zend_module_entry bz2_module_entry;
#define phpext_bz2_ptr &bz2_module_entry
/* Bzip2 includes */
#include <bzlib.h>
PHP_MINIT_FUNCTION(bz2);
PHP_MSHUTDOWN_FUNCTION(bz2);
PHP_MINFO_FUNCTION(bz2);
PHP_FUNCTION(bzopen);
PHP_FUNCTION(bzread);
PHP_FUNCTION(bzerrno);
PHP_FUNCTION(bzerrstr);
PHP_FUNCTION(bzerror);
PHP_FUNCTION(bzcompress);
PHP_FUNCTION(bzdecompress);
#else
#define phpext_bz2_ptr NULL
#endif
#ifdef PHP_WIN32
# ifdef PHP_BZ2_EXPORTS
# define PHP_BZ2_API __declspec(dllexport)
# else
# define PHP_BZ2_API __declspec(dllimport)
# endif
#else
# define PHP_BZ2_API
#endif
PHP_BZ2_API PHPAPI php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
PHP_BZ2_API PHPAPI php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC);
#define php_stream_bz2open_from_BZFILE(bz, mode, innerstream) _php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC TSRMLS_CC)
#define php_stream_bz2open(wrapper, path, mode, options, opened_path) _php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC TSRMLS_CC)
php_stream_ops php_stream_bz2io_ops;
#define PHP_STREAM_IS_BZIP2 &php_stream_bz2io_ops
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
-25
View File
@@ -1,25 +0,0 @@
--TEST--
BZ2 with files
--SKIPIF--
<?php if (!extension_loaded("bz2")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php // $Id$
error_reporting(E_ALL);
$filename = "testfile.bz2";
$str = "This is a test string.\n";
$bz = bzopen($filename, "w");
bzwrite($bz, $str);
bzclose($bz);
$bz = bzopen($filename, "r");
print bzread($bz, 10);
print bzread($bz);
bzclose($bz);
unlink($filename);
--EXPECT--
This is a test string.
-28
View File
@@ -1,28 +0,0 @@
--TEST--
BZ2 with strings
--SKIPIF--
<?php if (!extension_loaded("bz2")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php // $Id$
error_reporting(E_ALL);
# This FAILS
$blaat = <<<HEREDOC
This is some random data
HEREDOC;
# This Works: (so, is heredoc related)
#$blaat= 'This is some random data';
$blaat2 = bzdecompress(bzcompress($blaat));
$tests = <<<TESTS
\$blaat === \$blaat2
TESTS;
include(dirname(__FILE__) . '/../../../tests/quicktester.inc');
--EXPECT--
OK
+4 -4
View File
@@ -161,7 +161,7 @@ PHP_FUNCTION(cal_info)
}
convert_to_long_ex(cal);
if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) {
zend_error(E_WARNING, "%s(): invalid calendar ID %ld", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
RETURN_FALSE;
}
@@ -203,7 +203,7 @@ PHP_FUNCTION(cal_days_in_month)
convert_to_long_ex(year);
if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) {
zend_error(E_WARNING, "%s(): invalid calendar ID %ld", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
RETURN_FALSE;
}
@@ -239,7 +239,7 @@ PHP_FUNCTION(cal_to_jd)
convert_to_long_ex(year);
if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) {
zend_error(E_WARNING, "%s(): invalid calendar ID %ld", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
RETURN_FALSE;
}
@@ -265,7 +265,7 @@ PHP_FUNCTION(cal_from_jd)
convert_to_long_ex(cal);
if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) {
zend_error(E_WARNING, "%s(): invalid calendar ID %ld", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal));
RETURN_FALSE;
}
calendar = &cal_conversion_table[Z_LVAL_PP(cal)];
+26 -26
View File
@@ -55,7 +55,7 @@
#ifdef PHP_WIN32
#define _WIN32_DCOM
#define COBJMACROS
#include <iostream.h>
#include <math.h>
#include <ocidl.h>
@@ -1627,11 +1627,6 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
FREE_VARIANT(var_result);
/* free the string we allocated; invoked object made its own copy */
if (V_VT(new_value) == VT_BSTR) {
VariantClear(new_value);
}
efree(new_value);
efree(propname);
@@ -1664,11 +1659,7 @@ static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property,
FREE_VARIANT(var_result);
}
/* free the string we allocated; invoked object made its own copy */
if (V_VT(new_value) == VT_BSTR) {
VariantClear(new_value);
}
efree(new_value);
efree(new_value); // FREE_VARIANT does a VariantClear() which is not desired here !
efree(propname);
}
@@ -2224,6 +2215,7 @@ static ITypeLib *php_COM_find_typelib(char *search_string, int mode TSRMLS_DC)
PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
{
ITypeComp *TypeComp;
int i;
int interfaces;
@@ -2231,33 +2223,40 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
return FAILURE;
}
interfaces = ITypeLib_GetTypeInfoCount(TypeLib);
interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
TypeLib->lpVtbl->GetTypeComp(TypeLib, &TypeComp);
for (i=0; i<interfaces; i++) {
TYPEKIND pTKind;
ITypeLib_GetTypeInfoType(TypeLib, i, &pTKind);
if (pTKind == TKIND_ENUM) {
TypeLib->lpVtbl->GetTypeInfoType(TypeLib, i, &pTKind);
if (pTKind==TKIND_ENUM) {
ITypeInfo *TypeInfo;
VARDESC *pVarDesc;
UINT NameCount;
int j;
#if 0
BSTR bstr_EnumId;
char *EnumId;
ITypeLib_GetTypeInfo(TypeLib, i, &TypeInfo);
TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, codepage);
printf("Enumeration %d - %s:\n", i, EnumId);
efree(EnumId);
#endif
for (j = 0; ; j++) {
TypeLib->lpVtbl->GetTypeInfo(TypeLib, i, &TypeInfo);
j=0;
while (SUCCEEDED(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc))) {
BSTR bstr_ids;
zend_constant c;
zval exists, results, value;
char *const_name;
if (FAILED(ITypeInfo_GetVarDesc(TypeInfo, j, &pVarDesc))) {
break;
}
ITypeInfo_GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
if (NameCount != 1) {
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
if (NameCount!=1) {
j++;
continue;
}
const_name = php_OLECHAR_to_char(bstr_ids, &c.name_len, codepage TSRMLS_CC);
@@ -2274,7 +2273,7 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
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);
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
j++;
continue;
}
@@ -2288,9 +2287,10 @@ PHPAPI int php_COM_load_typelib(ITypeLib *TypeLib, int mode TSRMLS_DC)
zend_register_constant(&c TSRMLS_CC);
}
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
j++;
}
ITypeInfo_Release(TypeInfo);
TypeInfo->lpVtbl->Release(TypeInfo);
}
}
+1 -1
View File
@@ -58,7 +58,7 @@ ZEND_BEGIN_MODULE_GLOBALS(com)
int nothing;
ZEND_END_MODULE_GLOBALS(com)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(com)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(com);
#ifdef ZTS
#define COMG(v) TSRMG(com_globals_id, zend_com_globals *, v)
+63 -54
View File
@@ -1,82 +1,91 @@
dnl $Id$
AC_DEFUN(CPDF_TEMP_SUBST,[
old_LIBS=$LIBS
$1
LIBS=$old_LIBS
])
AC_DEFUN(CPDF_JPEG_TEST,[
AC_ARG_WITH(jpeg-dir,
[ --with-jpeg-dir[=DIR] CPDF: Set the path to libjpeg install prefix.],[
for i in $withval /usr/local /usr; do
if test -f "$i/lib/libjpeg.$SHLIB_SUFFIX_NAME" -o -f "$i/lib/libjpeg.a"; then
CPDF_JPEG_DIR=$i
break;
CPDF_TEMP_SUBST([
AC_ARG_WITH(jpeg-dir,
[ --with-jpeg-dir[=DIR] CPDF: Set the path to libjpeg install prefix.],[
for i in $withval /usr/local /usr; do
if test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a; then
CPDF_JPEG_DIR=$i
break;
fi
done
if test -z "$CPDF_JPEG_DIR"; then
AC_MSG_CHECKING([for libjpeg (needed by cpdflib 2.x)])
AC_MSG_ERROR([libjpeg.(a|so) not found.])
fi
done
if test -z "$CPDF_JPEG_DIR"; then
AC_MSG_CHECKING([for libjpeg (needed by cpdflib 2.x)])
AC_MSG_ERROR([libjpeg.(a|so) not found.])
LIBS="$LIBS -L$CPDF_JPEG_DIR/lib"
],)
AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_ERROR(Problem with libjpeg.(a|so). Please check config.log for more information.)],)
if test -z $CPDF_JPEG_DIR; then
PHP_ADD_LIBRARY(jpeg)
else
PHP_ADD_LIBRARY_WITH_PATH(jpeg, $CPDF_JPEG_DIR/lib)
fi
PHP_CHECK_LIBRARY(jpeg, jpeg_read_header, [
PHP_ADD_LIBRARY_WITH_PATH(jpeg, $CPDF_JPEG_DIR/lib, CPDF_SHARED_LIBADD)
] ,[
AC_MSG_ERROR([CPDF: Problem with libjpeg.(a|so). Please check config.log for more information.])
], [
-L$CPDF_JPEG_DIR/lib
])
],)
])
])
AC_DEFUN(CPDF_TIFF_TEST,[
AC_ARG_WITH(tiff-dir,
[ --with-tiff-dir[=DIR] CPDF: Set the path to libtiff install prefix.],[
for i in $withval /usr/local /usr; do
if test -f "$i/lib/libtiff.$SHLIB_SUFFIX_NAME" -o -f "$i/lib/libtiff.a"; then
CPDF_TIFF_DIR=$i
break;
CPDF_TEMP_SUBST([
AC_ARG_WITH(tiff-dir,
[ --with-tiff-dir[=DIR] CPDF: Set the path to libtiff install prefix.],[
for i in $withval /usr/local /usr; do
if test -f $i/lib/libtiff.$SHLIB_SUFFIX_NAME -o -f $i/lib/libtiff.a; then
CPDF_TIFF_DIR=$i
break;
fi
done
if test -z "$CPDF_TIFF_DIR"; then
AC_MSG_CHECKING([for libtiff (needed by cpdflib 2.x)])
AC_MSG_ERROR([libtiff.(a|so) not found.])
fi
done
if test -z "$CPDF_TIFF_DIR"; then
AC_MSG_CHECKING([for libtiff (needed by cpdflib 2.x)])
AC_MSG_ERROR([libtiff.(a|so) not found.])
LIBS="$LIBS -L$CPDF_TIFF_DIR/lib"
],)
AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_ERROR(Problem with libtiff.(a|so). Please check config.log for more information.)],)
if test -z $CPDF_TIFF_DIR; then
PHP_ADD_LIBRARY(tiff)
else
PHP_ADD_LIBRARY_WITH_PATH(tiff, $CPDF_TIFF_DIR/lib)
fi
PHP_CHECK_LIBRARY(tiff, TIFFOpen, [
PHP_ADD_LIBRARY_WITH_PATH(tiff, $CPDF_TIFF_DIR/lib, CPDF_SHARED_LIBADD)
] ,[
AC_MSG_ERROR([CPDF: Problem with libtiff.(a|so). Please check config.log for more information.])
], [
-L$CPDF_TIFF_DIR/lib
])
],)
])
])
AC_MSG_CHECKING(for cpdflib support)
AC_ARG_WITH(cpdflib,
[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).],
[
PHP_WITH_SHARED
if test "$withval" != "no"; then
cpdf_withval=$withval
PHP_NEW_EXTENSION(cpdf, cpdf.c, $ext_shared,, \\$(GDLIB_CFLAGS))
PHP_SUBST(CPDF_SHARED_LIBADD)
if test "$withval" = "no"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
PHP_NEW_EXTENSION(cpdf, cpdf.c)
CPDF_JPEG_TEST
CPDF_TIFF_TEST
for i in $cpdf_withval /usr /usr/local; do
if test -f "$i/include/cpdflib.h"; then
for i in $withval /usr /usr/local; do
if test -f $i/include/cpdflib.h; then
CPDFLIB_INCLUDE=$i/include
AC_MSG_CHECKING(for cpdflib.h)
AC_MSG_RESULT([in $i/include])
PHP_CHECK_LIBRARY(cpdf, cpdf_open, [
PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
PHP_ADD_LIBRARY_WITH_PATH(cpdf, $i/lib, CPDF_SHARED_LIBADD)
AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])
], [
AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])
], [
-L$i/lib $CPDF_SHARED_LIBADD
CPDF_TEMP_SUBST([
LIBS="$LIBS -L$i/lib"
AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
[AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])])
])
if test "$i" != "/usr" -a "$i" != "/usr/local"; then
PHP_ADD_LIBRARY_WITH_PATH(cpdf, $i/lib)
PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
else
PHP_ADD_LIBRARY(cpdf)
fi
break
fi
done
if test -z "$CPDFLIB_INCLUDE"; then
AC_MSG_CHECKING(for cpdflib.h)
AC_MSG_ERROR([not found])
+63 -80
View File
@@ -222,7 +222,7 @@ PHP_MSHUTDOWN_FUNCTION(cpdf)
return SUCCESS;
}
/* {{{ proto bool cpdf_global_set_document_limits(int maxPages, int maxFonts, int maxImages, int maxAnnots, int maxObjects)
/* {{{ proto void cpdf_global_set_document_limits(int maxPages, int maxFonts, int maxImages, int maxAnnots, int maxObjects)
Sets document settings for all documents */
PHP_FUNCTION(cpdf_global_set_document_limits)
{
@@ -356,7 +356,7 @@ PHP_FUNCTION(cpdf_set_keywords)
}
/* }}} */
/* {{{ proto bool cpdf_set_viewer_preferences(int pdfdoc, array preferences)
/* {{{ proto void cpdf_set_viewer_preferences(int pdfdoc, array preferences)
How to show the document in the viewer */
PHP_FUNCTION(cpdf_set_viewer_preferences)
{
@@ -475,10 +475,6 @@ PHP_FUNCTION(cpdf_open)
if(strcmp(Z_STRVAL_P(arg2), "-") == 0)
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
if (php_check_open_basedir(Z_STRVAL_P(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(arg2), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
cpdf_setOutputFilename(cpdf, Z_STRVAL_P(arg2));
}
cpdf_init(cpdf);
@@ -514,7 +510,7 @@ PHP_FUNCTION(cpdf_close)
/* }}} */
#define BUFFERLEN 40
/* {{{ proto bool cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [, float unit])
/* {{{ proto void cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [, float unit])
Starts page */
PHP_FUNCTION(cpdf_page_init)
{
@@ -559,7 +555,7 @@ PHP_FUNCTION(cpdf_page_init)
/* }}} */
#undef BUFFERLEN
/* {{{ proto bool cpdf_finalize_page(int pdfdoc, int pagenr)
/* {{{ proto void cpdf_finalize_page(int pdfdoc, int pagenr)
Ends the page to save memory */
PHP_FUNCTION(cpdf_finalize_page)
{
@@ -587,7 +583,7 @@ PHP_FUNCTION(cpdf_finalize_page)
}
/* }}} */
/* {{{ proto bool cpdf_set_current_page(int pdfdoc, int pagenr)
/* {{{ proto void cpdf_set_current_page(int pdfdoc, int pagenr)
Sets page for output */
PHP_FUNCTION(cpdf_set_current_page)
{
@@ -615,7 +611,7 @@ PHP_FUNCTION(cpdf_set_current_page)
}
/* }}} */
/* {{{ proto bool cpdf_begin_text(int pdfdoc)
/* {{{ proto void cpdf_begin_text(int pdfdoc)
Starts text section */
PHP_FUNCTION(cpdf_begin_text)
{
@@ -641,7 +637,7 @@ PHP_FUNCTION(cpdf_begin_text)
}
/* }}} */
/* {{{ proto bool cpdf_end_text(int pdfdoc)
/* {{{ proto void cpdf_end_text(int pdfdoc)
Ends text section */
PHP_FUNCTION(cpdf_end_text)
{
@@ -667,7 +663,7 @@ PHP_FUNCTION(cpdf_end_text)
}
/* }}} */
/* {{{ proto bool cpdf_show(int pdfdoc, string text)
/* {{{ proto void cpdf_show(int pdfdoc, string text)
Output text at current position */
PHP_FUNCTION(cpdf_show)
{
@@ -694,7 +690,7 @@ PHP_FUNCTION(cpdf_show)
}
/* }}} */
/* {{{ proto bool cpdf_show_xy(int pdfdoc, string text, float x-koor, float y-koor [, int mode])
/* {{{ proto void cpdf_show_xy(int pdfdoc, string text, float x-koor, float y-koor [, int mode])
Output text at position */
PHP_FUNCTION(cpdf_show_xy)
{
@@ -732,7 +728,7 @@ PHP_FUNCTION(cpdf_show_xy)
}
/* }}} */
/* {{{ proto bool cpdf_continue_text(int pdfdoc, string text)
/* {{{ proto void cpdf_continue_text(int pdfdoc, string text)
Outputs text in next line */
PHP_FUNCTION(cpdf_continue_text)
{
@@ -759,7 +755,7 @@ PHP_FUNCTION(cpdf_continue_text)
}
/* }}} */
/* {{{ proto bool cpdf_text(int pdfdoc, string text [, float x-koor, float y-koor [, int mode [, float orientation [, int alignmode]]]])
/* {{{ proto void cpdf_text(int pdfdoc, string text [, float x-koor, float y-koor [, int mode [, float orientation [, int alignmode]]]])
Outputs text */
PHP_FUNCTION(cpdf_text)
{
@@ -849,7 +845,7 @@ PHP_FUNCTION(cpdf_text)
}
/* }}} */
/* {{{ proto bool cpdf_set_font(int pdfdoc, string font, float size, string encoding)
/* {{{ proto void cpdf_set_font(int pdfdoc, string font, float size, string encoding)
Selects the current font face, size and encoding */
PHP_FUNCTION(cpdf_set_font)
{
@@ -883,7 +879,7 @@ PHP_FUNCTION(cpdf_set_font)
}
/* }}} */
/* {{{ proto bool cpdf_set_font_directories(int pdfdoc, string pfmdir, string pfbdir)
/* {{{ proto void cpdf_set_font_directories(int pdfdoc, string pfmdir, string pfbdir)
Sets directories to search when using external fonts */
PHP_FUNCTION(cpdf_set_font_directories)
{
@@ -911,7 +907,7 @@ PHP_FUNCTION(cpdf_set_font_directories)
}
/* }}} */
/* {{{ proto bool cpdf_set_font_map_file(int pdfdoc, string filename)
/* {{{ proto void cpdf_set_font_map_file(int pdfdoc, string filename)
Sets fontname to filename translation map when using external fonts */
PHP_FUNCTION(cpdf_set_font_map_file)
{
@@ -932,17 +928,13 @@ PHP_FUNCTION(cpdf_set_font_map_file)
RETURN_FALSE;
}
if (php_check_open_basedir(Z_STRVAL_P(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(arg2), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
cpdf_setFontMapFile(pdf, Z_STRVAL_P(arg2));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool cpdf_set_leading(int pdfdoc, float distance)
/* {{{ proto void cpdf_set_leading(int pdfdoc, float distance)
Sets distance between text lines */
PHP_FUNCTION(cpdf_set_leading)
{
@@ -969,7 +961,7 @@ PHP_FUNCTION(cpdf_set_leading)
}
/* }}} */
/* {{{ proto bool cpdf_set_text_rendering(int pdfdoc, int rendermode)
/* {{{ proto void cpdf_set_text_rendering(int pdfdoc, int rendermode)
Determines how text is rendered */
PHP_FUNCTION(cpdf_set_text_rendering)
{
@@ -996,7 +988,7 @@ PHP_FUNCTION(cpdf_set_text_rendering)
}
/* }}} */
/* {{{ proto bool cpdf_set_horiz_scaling(int pdfdoc, float scale)
/* {{{ proto void cpdf_set_horiz_scaling(int pdfdoc, float scale)
Sets horizontal scaling of text */
PHP_FUNCTION(cpdf_set_horiz_scaling)
{
@@ -1023,7 +1015,7 @@ PHP_FUNCTION(cpdf_set_horiz_scaling)
}
/* }}} */
/* {{{ proto bool cpdf_set_text_rise(int pdfdoc, float value)
/* {{{ proto void cpdf_set_text_rise(int pdfdoc, float value)
Sets the text rise */
PHP_FUNCTION(cpdf_set_text_rise)
{
@@ -1050,7 +1042,7 @@ PHP_FUNCTION(cpdf_set_text_rise)
}
/* }}} */
/* {{{ proto bool cpdf_set_text_matrix(int pdfdoc, arry matrix)
/* {{{ proto void cpdf_set_text_matrix(int pdfdoc, arry matrix)
Sets the text matrix */
PHP_FUNCTION(cpdf_set_text_matrix)
{
@@ -1103,7 +1095,7 @@ PHP_FUNCTION(cpdf_set_text_matrix)
}
/* }}} */
/* {{{ proto bool cpdf_set_text_pos(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_set_text_pos(int pdfdoc, float x, float y [, int mode])
Sets the position of text for the next cpdf_show call */
PHP_FUNCTION(cpdf_set_text_pos)
{
@@ -1140,7 +1132,7 @@ PHP_FUNCTION(cpdf_set_text_pos)
}
/* }}} */
/* {{{ proto bool cpdf_rotate_text(int pdfdoc, float angle)
/* {{{ proto void cpdf_rotate_text(int pdfdoc, float angle)
Sets text rotation angle */
PHP_FUNCTION(cpdf_rotate_text)
{
@@ -1167,7 +1159,7 @@ PHP_FUNCTION(cpdf_rotate_text)
}
/* }}} */
/* {{{ proto bool cpdf_set_char_spacing(int pdfdoc, float space)
/* {{{ proto void cpdf_set_char_spacing(int pdfdoc, float space)
Sets character spacing */
PHP_FUNCTION(cpdf_set_char_spacing)
{
@@ -1194,7 +1186,7 @@ PHP_FUNCTION(cpdf_set_char_spacing)
}
/* }}} */
/* {{{ proto bool cpdf_set_word_spacing(int pdfdoc, float space)
/* {{{ proto void cpdf_set_word_spacing(int pdfdoc, float space)
Sets spacing between words */
PHP_FUNCTION(cpdf_set_word_spacing)
{
@@ -1249,7 +1241,7 @@ PHP_FUNCTION(cpdf_stringwidth)
}
/* }}} */
/* {{{ proto bool cpdf_save(int pdfdoc)
/* {{{ proto void cpdf_save(int pdfdoc)
Saves current enviroment */
PHP_FUNCTION(cpdf_save)
{
@@ -1275,7 +1267,7 @@ PHP_FUNCTION(cpdf_save)
}
/* }}} */
/* {{{ proto bool cpdf_restore(int pdfdoc)
/* {{{ proto void cpdf_restore(int pdfdoc)
Restores formerly saved enviroment */
PHP_FUNCTION(cpdf_restore)
{
@@ -1301,7 +1293,7 @@ PHP_FUNCTION(cpdf_restore)
}
/* }}} */
/* {{{ proto bool cpdf_translate(int pdfdoc, float x, float y)
/* {{{ proto void cpdf_translate(int pdfdoc, float x, float y)
Sets origin of coordinate system */
PHP_FUNCTION(cpdf_translate)
{
@@ -1329,7 +1321,7 @@ PHP_FUNCTION(cpdf_translate)
}
/* }}} */
/* {{{ proto bool cpdf_scale(int pdfdoc, float x_scale, float y_scale)
/* {{{ proto void cpdf_scale(int pdfdoc, float x_scale, float y_scale)
Sets scaling */
PHP_FUNCTION(cpdf_scale)
{
@@ -1357,7 +1349,7 @@ PHP_FUNCTION(cpdf_scale)
}
/* }}} */
/* {{{ proto bool cpdf_rotate(int pdfdoc, float angle)
/* {{{ proto void cpdf_rotate(int pdfdoc, float angle)
Sets rotation */
PHP_FUNCTION(cpdf_rotate)
{
@@ -1384,7 +1376,7 @@ PHP_FUNCTION(cpdf_rotate)
}
/* }}} */
/* {{{ proto bool cpdf_setflat(int pdfdoc, float value)
/* {{{ proto void cpdf_setflat(int pdfdoc, float value)
Sets flatness */
PHP_FUNCTION(cpdf_setflat)
{
@@ -1416,7 +1408,7 @@ PHP_FUNCTION(cpdf_setflat)
}
/* }}} */
/* {{{ proto bool cpdf_setlinejoin(int pdfdoc, int value)
/* {{{ proto void cpdf_setlinejoin(int pdfdoc, int value)
Sets linejoin parameter */
PHP_FUNCTION(cpdf_setlinejoin)
{
@@ -1448,7 +1440,7 @@ PHP_FUNCTION(cpdf_setlinejoin)
}
/* }}} */
/* {{{ proto bool cpdf_setlinecap(int pdfdoc, int value)
/* {{{ proto void cpdf_setlinecap(int pdfdoc, int value)
Sets linecap parameter */
PHP_FUNCTION(cpdf_setlinecap)
{
@@ -1480,7 +1472,7 @@ PHP_FUNCTION(cpdf_setlinecap)
}
/* }}} */
/* {{{ proto bool cpdf_setmiterlimit(int pdfdoc, float value)
/* {{{ proto void cpdf_setmiterlimit(int pdfdoc, float value)
Sets miter limit */
PHP_FUNCTION(cpdf_setmiterlimit)
{
@@ -1512,7 +1504,7 @@ PHP_FUNCTION(cpdf_setmiterlimit)
}
/* }}} */
/* {{{ proto bool cpdf_setlinewidth(int pdfdoc, float width)
/* {{{ proto void cpdf_setlinewidth(int pdfdoc, float width)
Sets line width */
PHP_FUNCTION(cpdf_setlinewidth)
{
@@ -1540,7 +1532,7 @@ PHP_FUNCTION(cpdf_setlinewidth)
/* }}} */
#define BUFFERLEN 20
/* {{{ proto bool cpdf_setdash(int pdfdoc, long white, long black)
/* {{{ proto void cpdf_setdash(int pdfdoc, long white, long black)
Sets dash pattern */
PHP_FUNCTION(cpdf_setdash)
{
@@ -1571,7 +1563,7 @@ PHP_FUNCTION(cpdf_setdash)
/* }}} */
#undef BUFFERLEN
/* {{{ proto bool cpdf_moveto(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_moveto(int pdfdoc, float x, float y [, int mode])
Sets current point */
PHP_FUNCTION(cpdf_moveto)
{
@@ -1608,7 +1600,7 @@ PHP_FUNCTION(cpdf_moveto)
}
/* }}} */
/* {{{ proto bool cpdf_rmoveto(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_rmoveto(int pdfdoc, float x, float y [, int mode])
Sets current point */
PHP_FUNCTION(cpdf_rmoveto)
{
@@ -1645,7 +1637,7 @@ PHP_FUNCTION(cpdf_rmoveto)
}
/* }}} */
/* {{{ proto bool cpdf_curveto(int pdfdoc, float x1, float y1, float x2, float y2, float x3, float y3 [, int mode])
/* {{{ proto void cpdf_curveto(int pdfdoc, float x1, float y1, float x2, float y2, float x3, float y3 [, int mode])
Draws a curve */
PHP_FUNCTION(cpdf_curveto)
{
@@ -1696,7 +1688,7 @@ PHP_FUNCTION(cpdf_curveto)
}
/* }}} */
/* {{{ proto bool cpdf_lineto(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_lineto(int pdfdoc, float x, float y [, int mode])
Draws a line */
PHP_FUNCTION(cpdf_lineto)
{
@@ -1733,7 +1725,7 @@ PHP_FUNCTION(cpdf_lineto)
}
/* }}} */
/* {{{ proto bool cpdf_rlineto(int pdfdoc, float x, float y [, int mode])
/* {{{ proto void cpdf_rlineto(int pdfdoc, float x, float y [, int mode])
Draws a line relative to current point */
PHP_FUNCTION(cpdf_rlineto)
{
@@ -1770,7 +1762,7 @@ PHP_FUNCTION(cpdf_rlineto)
}
/* }}} */
/* {{{ proto bool cpdf_circle(int pdfdoc, float x, float y, float radius [, int mode])
/* {{{ proto void cpdf_circle(int pdfdoc, float x, float y, float radius [, int mode])
Draws a circle */
PHP_FUNCTION(cpdf_circle)
{
@@ -1808,7 +1800,7 @@ PHP_FUNCTION(cpdf_circle)
}
/* }}} */
/* {{{ proto bool cpdf_arc(int pdfdoc, float x, float y, float radius, float start, float end [, int mode])
/* {{{ proto void cpdf_arc(int pdfdoc, float x, float y, float radius, float start, float end [, int mode])
Draws an arc */
PHP_FUNCTION(cpdf_arc)
{
@@ -1848,7 +1840,7 @@ PHP_FUNCTION(cpdf_arc)
}
/* }}} */
/* {{{ proto bool cpdf_rect(int pdfdoc, float x, float y, float width, float height [, int mode])
/* {{{ proto void cpdf_rect(int pdfdoc, float x, float y, float width, float height [, int mode])
Draws a rectangle */
PHP_FUNCTION(cpdf_rect)
{
@@ -1893,7 +1885,7 @@ PHP_FUNCTION(cpdf_rect)
}
/* }}} */
/* {{{ proto bool cpdf_newpath(int pdfdoc)
/* {{{ proto void cpdf_newpath(int pdfdoc)
Starts new path */
PHP_FUNCTION(cpdf_newpath)
{
@@ -1919,7 +1911,7 @@ PHP_FUNCTION(cpdf_newpath)
}
/* }}} */
/* {{{ proto bool cpdf_closepath(int pdfdoc)
/* {{{ proto void cpdf_closepath(int pdfdoc)
Close path */
PHP_FUNCTION(cpdf_closepath)
{
@@ -1945,7 +1937,7 @@ PHP_FUNCTION(cpdf_closepath)
}
/* }}} */
/* {{{ proto bool cpdf_closepath_stroke(int pdfdoc)
/* {{{ proto void cpdf_closepath_stroke(int pdfdoc)
Close path and draw line along path */
PHP_FUNCTION(cpdf_closepath_stroke)
{
@@ -1972,7 +1964,7 @@ PHP_FUNCTION(cpdf_closepath_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_stroke(int pdfdoc)
/* {{{ proto void cpdf_stroke(int pdfdoc)
Draws line along path path */
PHP_FUNCTION(cpdf_stroke)
{
@@ -1998,7 +1990,7 @@ PHP_FUNCTION(cpdf_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_fill(int pdfdoc)
/* {{{ proto void cpdf_fill(int pdfdoc)
Fills current path */
PHP_FUNCTION(cpdf_fill)
{
@@ -2024,7 +2016,7 @@ PHP_FUNCTION(cpdf_fill)
}
/* }}} */
/* {{{ proto bool cpdf_fill_stroke(int pdfdoc)
/* {{{ proto void cpdf_fill_stroke(int pdfdoc)
Fills and stroke current path */
PHP_FUNCTION(cpdf_fill_stroke)
{
@@ -2051,7 +2043,7 @@ PHP_FUNCTION(cpdf_fill_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_closepath_fill_stroke(int pdfdoc)
/* {{{ proto void cpdf_closepath_fill_stroke(int pdfdoc)
Close, fill and stroke current path */
PHP_FUNCTION(cpdf_closepath_fill_stroke)
{
@@ -2079,7 +2071,7 @@ PHP_FUNCTION(cpdf_closepath_fill_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_clip(int pdfdoc)
/* {{{ proto void cpdf_clip(int pdfdoc)
Clips to current path */
PHP_FUNCTION(cpdf_clip)
{
@@ -2105,7 +2097,7 @@ PHP_FUNCTION(cpdf_clip)
}
/* }}} */
/* {{{ proto bool cpdf_setgray_fill(int pdfdoc, float value)
/* {{{ proto void cpdf_setgray_fill(int pdfdoc, float value)
Sets filling color to gray value */
PHP_FUNCTION(cpdf_setgray_fill)
{
@@ -2132,7 +2124,7 @@ PHP_FUNCTION(cpdf_setgray_fill)
}
/* }}} */
/* {{{ proto bool cpdf_setgray_stroke(int pdfdoc, float value)
/* {{{ proto void cpdf_setgray_stroke(int pdfdoc, float value)
Sets drawing color to gray value */
PHP_FUNCTION(cpdf_setgray_stroke)
{
@@ -2159,7 +2151,7 @@ PHP_FUNCTION(cpdf_setgray_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_setgray(int pdfdoc, float value)
/* {{{ proto void cpdf_setgray(int pdfdoc, float value)
Sets drawing and filling color to gray value */
PHP_FUNCTION(cpdf_setgray)
{
@@ -2186,7 +2178,7 @@ PHP_FUNCTION(cpdf_setgray)
}
/* }}} */
/* {{{ proto bool cpdf_setrgbcolor_fill(int pdfdoc, float red, float green, float blue)
/* {{{ proto void cpdf_setrgbcolor_fill(int pdfdoc, float red, float green, float blue)
Sets filling color to rgb color value */
PHP_FUNCTION(cpdf_setrgbcolor_fill)
{
@@ -2215,7 +2207,7 @@ PHP_FUNCTION(cpdf_setrgbcolor_fill)
}
/* }}} */
/* {{{ proto bool cpdf_setrgbcolor_stroke(int pdfdoc, float red, float green, float blue)
/* {{{ proto void cpdf_setrgbcolor_stroke(int pdfdoc, float red, float green, float blue)
Sets drawing color to RGB color value */
PHP_FUNCTION(cpdf_setrgbcolor_stroke)
{
@@ -2244,7 +2236,7 @@ PHP_FUNCTION(cpdf_setrgbcolor_stroke)
}
/* }}} */
/* {{{ proto bool cpdf_setrgbcolor(int pdfdoc, float red, float green, float blue)
/* {{{ proto void cpdf_setrgbcolor(int pdfdoc, float red, float green, float blue)
Sets drawing and filling color to RGB color value */
PHP_FUNCTION(cpdf_setrgbcolor)
{
@@ -2273,7 +2265,7 @@ PHP_FUNCTION(cpdf_setrgbcolor)
}
/* }}} */
/* {{{ proto bool cpdf_set_page_animation(int pdfdoc, int transition, float duration, float direction, int orientation, int inout)
/* {{{ proto void cpdf_set_page_animation(int pdfdoc, int transition, float duration, float direction, int orientation, int inout)
Sets transition between pages */
PHP_FUNCTION(cpdf_set_page_animation)
{
@@ -2305,7 +2297,7 @@ PHP_FUNCTION(cpdf_set_page_animation)
}
/* }}} */
/* {{{ proto bool cpdf_finalize(int pdfdoc)
/* {{{ proto array cpdf_finalize(int pdfdoc)
Creates PDF doc in memory */
PHP_FUNCTION(cpdf_finalize)
{
@@ -2331,7 +2323,7 @@ PHP_FUNCTION(cpdf_finalize)
}
/* }}} */
/* {{{ proto bool cpdf_output_buffer(int pdfdoc)
/* {{{ proto array cpdf_output_buffer(int pdfdoc)
Returns the internal memory stream as string */
PHP_FUNCTION(cpdf_output_buffer)
{
@@ -2360,7 +2352,7 @@ PHP_FUNCTION(cpdf_output_buffer)
}
/* }}} */
/* {{{ proto bool cpdf_save_to_file(int pdfdoc, string filename)
/* {{{ proto array cpdf_save_to_file(int pdfdoc, string filename)
Saves the internal memory stream to a file */
PHP_FUNCTION(cpdf_save_to_file)
{
@@ -2386,17 +2378,13 @@ PHP_FUNCTION(cpdf_save_to_file)
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
if (php_check_open_basedir(Z_STRVAL_P(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(arg2), "wb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
cpdf_savePDFmemoryStreamToFile(pdf, Z_STRVAL_P(arg2));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool cpdf_import_jpeg(int pdfdoc, string filename, float x, float y, float angle, float width, float height, float x_scale, float y_scale, int gsave [, int mode])
/* {{{ proto void cpdf_import_jpeg(int pdfdoc, string filename, float x, float y, float angle, float width, float height, float x_scale, float y_scale, int gsave [, int mode])
Includes JPEG image */
PHP_FUNCTION(cpdf_import_jpeg)
{
@@ -2413,11 +2401,6 @@ PHP_FUNCTION(cpdf_import_jpeg)
convert_to_long(argv[0]);
convert_to_string(argv[1]);
if (php_check_open_basedir(Z_STRVAL_P(argv[1]) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(argv[1]), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
convert_to_double(argv[2]);
convert_to_double(argv[3]);
convert_to_double(argv[4]);
@@ -2469,7 +2452,7 @@ PHP_FUNCTION(cpdf_import_jpeg)
/* }}} */
#if HAVE_LIBGD13
/* {{{ proto bool cpdf_place_inline_image(int pdfdoc, int gdimage, float x, float y, float angle, fload width, float height, int gsave [, int mode])
/* {{{ proto void cpdf_place_inline_image(int pdfdoc, int gdimage, float x, float y, float angle, fload width, float height, int gsave [, int mode])
Includes image */
PHP_FUNCTION(cpdf_place_inline_image)
{
@@ -2561,7 +2544,7 @@ PHP_FUNCTION(cpdf_place_inline_image)
/* }}} */
#endif
/* {{{ proto bool cpdf_add_annotation(int pdfdoc, float xll, float yll, float xur, float xur, string title, string text [, int mode])
/* {{{ proto void cpdf_add_annotation(int pdfdoc, float xll, float yll, float xur, float xur, string title, string text [, int mode])
Sets annotation */
PHP_FUNCTION(cpdf_add_annotation)
{
+3 -3
View File
@@ -140,7 +140,7 @@ ZEND_MODULE_INFO_D(crack)
DISPLAY_INI_ENTRIES();
}
/* {{{ proto resource crack_opendict(string dictionary)
/* {{{ proto string crack_opendict(string dictionary)
Opens a new cracklib dictionary */
ZEND_FUNCTION(crack_opendict)
{
@@ -161,7 +161,7 @@ ZEND_FUNCTION(crack_opendict)
}
/* }}} */
/* {{{ proto bool crack_closedict([resource dictionary])
/* {{{ proto string crack_closedict([int link_identifier])
Closes an open cracklib dictionary */
ZEND_FUNCTION(crack_closedict)
{
@@ -194,7 +194,7 @@ ZEND_FUNCTION(crack_closedict)
}
/* }}} */
/* {{{ proto bool crack_check([resource dictionary,] string password)
/* {{{ proto string crack_check([int dictionary,] string password)
Performs an obscure check with the given password */
ZEND_FUNCTION(crack_check)
{
+11 -31
View File
@@ -191,7 +191,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE);
REGISTER_CURL_CONSTANT(CURLOPT_SSLENGINE_DEFAULT);
REGISTER_CURL_CONSTANT(CURLOPT_CRLF);
#if LIBCURL_VERSION_NUM >= 0x070a00
#ifdef CURLOPT_ENCODING
REGISTER_CURL_CONSTANT(CURLOPT_ENCODING);
#endif
@@ -338,7 +338,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
switch (t->method) {
case PHP_CURL_STDOUT:
PHPWRITE(data, length);
PHPWRITE(data, size);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
@@ -458,7 +458,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
if (ch->handlers->write->method == PHP_CURL_RETURN)
smart_str_appendl(&ch->handlers->write->buf, data, (int) length);
else
PHPWRITE(data, length);
PHPWRITE(data, size);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
@@ -574,7 +574,7 @@ static void curl_free_slist(void **slist)
/* }}} */
/* {{{ proto string curl_version(void)
/* {{{ proto array curl_version(void)
Return cURL version information. */
PHP_FUNCTION(curl_version)
{
@@ -632,8 +632,6 @@ PHP_FUNCTION(curl_init)
ch->handlers->read->method = PHP_CURL_DIRECT;
ch->handlers->write_header->method = PHP_CURL_IGNORE;
ch->uses = 0;
curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);
@@ -729,18 +727,22 @@ PHP_FUNCTION(curl_setopt)
case CURLOPT_USERAGENT:
case CURLOPT_FTPPORT:
case CURLOPT_COOKIE:
case CURLOPT_COOKIEFILE:
case CURLOPT_REFERER:
case CURLOPT_INTERFACE:
case CURLOPT_KRB4LEVEL:
case CURLOPT_RANDOM_FILE:
case CURLOPT_EGDSOCKET:
case CURLOPT_CAINFO:
case CURLOPT_CAPATH:
case CURLOPT_COOKIEJAR:
case CURLOPT_SSL_CIPHER_LIST:
case CURLOPT_SSLKEY:
case CURLOPT_SSLCERT:
case CURLOPT_SSLKEYTYPE:
case CURLOPT_SSLKEYPASSWD:
case CURLOPT_SSLKEYPASSWD:
case CURLOPT_SSLENGINE:
#if LIBCURL_VERSION_NUM >= 0x070a00
#ifdef CURLOPT_ENCODING
case CURLOPT_ENCODING:
#endif
case CURLOPT_SSLENGINE_DEFAULT: {
@@ -950,28 +952,6 @@ PHP_FUNCTION(curl_setopt)
error = curl_easy_setopt(ch->cp, option, slist);
break;
}
/* the following options deal with files, therefor safe_mode & open_basedir checks
* are required.
*/
case CURLOPT_COOKIEJAR:
case CURLOPT_SSLCERT:
case CURLOPT_RANDOM_FILE:
case CURLOPT_COOKIEFILE: {
char *copystr = NULL;
convert_to_string_ex(zvalue);
if (php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(zvalue), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
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);
break;
}
}
@@ -1041,7 +1021,7 @@ PHP_FUNCTION(curl_exec)
}
/* }}} */
/* {{{ proto mixed curl_getinfo(resource ch, int opt)
/* {{{ proto string curl_getinfo(resource ch, int opt)
Get information regarding a specific transfer */
PHP_FUNCTION(curl_getinfo)
{
+2 -2
View File
@@ -113,7 +113,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 php4ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib ws2_32.lib winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRTD" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\curl\lib"
# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRTD" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\curl\lib"
# SUBTRACT LINK32 /pdb:none /nodefaultlib
!ELSEIF "$(CFG)" == "curl - Win32 Release_TS_SSL"
@@ -142,7 +142,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 php4ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib ws2_32.lib winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\curl\lib"
# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\curl\lib"
# SUBTRACT LINK32 /pdb:none
!ENDIF
+42 -42
View File
@@ -53,7 +53,7 @@ zend_module_entry cyrus_module_entry = {
cyrus_functions,
PHP_MINIT(cyrus),
NULL,
NULL,
NULL,
NULL,
PHP_MINFO(cyrus),
NO_VERSION_YET,
@@ -71,7 +71,7 @@ static void cyrus_free(zend_rsrc_list_entry *rsrc)
if (conn->client)
imclient_close(conn->client);
if (conn->host)
if (conn->host)
efree(conn->host);
if (conn->port)
@@ -79,16 +79,16 @@ static void cyrus_free(zend_rsrc_list_entry *rsrc)
efree(conn);
}
PHP_MINIT_FUNCTION(cyrus)
{
le_cyrus = zend_register_list_destructors_ex(cyrus_free, NULL,
le_cyrus = zend_register_list_destructors_ex(cyrus_free, NULL,
le_cyrus_name, module_number);
REGISTER_LONG_CONSTANT("CYRUS_CONN_NONSYNCLITERAL",
REGISTER_LONG_CONSTANT("CYRUS_CONN_NONSYNCLITERAL",
IMCLIENT_CONN_NONSYNCLITERAL,
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CYRUS_CONN_INITIALRESPONSE",
REGISTER_LONG_CONSTANT("CYRUS_CONN_INITIALRESPONSE",
IMCLIENT_CONN_INITIALRESPONSE,
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CYRUS_CALLBACK_NUMBERED", CALLBACK_NUMBERED,
@@ -125,7 +125,7 @@ PHP_FUNCTION(cyrus_connect)
int flags = 0;
int error;
int argc = ZEND_NUM_ARGS();
if (argc < 0 || argc > 3 ||
zend_get_parameters_ex(argc, &z_host, &z_port, &z_flags) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -169,7 +169,7 @@ PHP_FUNCTION(cyrus_connect)
case -1:
php_error(E_WARNING, "%s(): Invalid hostname: %s", get_active_function_name(TSRMLS_C), host);
RETURN_FALSE;
case -2:
php_error(E_WARNING, "%s(): Invalid port: %d", get_active_function_name(TSRMLS_C), port);
RETURN_FALSE;
@@ -181,14 +181,14 @@ PHP_FUNCTION(cyrus_connect)
/* }}} */
static void cyrus_capable_callback(struct imclient *client, void *rock,
static void cyrus_capable_callback(struct imclient *client, void *rock,
struct imclient_reply *reply)
{
char *token = NULL;
char *token_buf;
char *mechanism = rock;
/* We need to split the reply up by the whitespace */
token = php_strtok_r(reply->text, " ", &token_buf);
while (token != NULL) {
@@ -202,7 +202,7 @@ static void cyrus_capable_callback(struct imclient *client, void *rock,
}
/* {{{ proto void cyrus_authenticate( resource connection [, string mechlist [, string service [, string user [, int minssf [, int maxssf]]]]])
/* {{{ proto bool cyrus_authenticate( resource connection [, string mechlist [, string service [, string user [, int minssf [, int maxssf]]]]])
Authenticate agaings a Cyrus IMAP server */
PHP_FUNCTION(cyrus_authenticate)
{
@@ -235,26 +235,26 @@ PHP_FUNCTION(cyrus_authenticate)
else {
char tmp_mechlist[100];
int pos = 0;
/* NULL out the buffer, ensures it has a safe ending and allows us to
* test properly for the end of the buffer
*/
memset(tmp_mechlist, 0, sizeof tmp_mechlist);
/* We'll be calling the "CAPABILITY" command, which will give us a list
* of the types of authorization the server is capable of
* of the types of authorization the server is capable of
*/
imclient_addcallback(conn->client, "CAPABILITY", 0,
imclient_addcallback(conn->client, "CAPABILITY", 0,
cyrus_capable_callback, (void *) tmp_mechlist, 0);
imclient_send(conn->client, NULL, NULL, "CAPABILITY");
/* Grab the end of string position into pos */
while (tmp_mechlist[pos++] != 0)
while (tmp_mechlist[pos++] != 0)
;
/* Tack on PLAIN to whatever the auth string is */
memcpy(tmp_mechlist + pos, " PLAIN", 6);
/* Copy it onto the main buffer */
mechlist = estrndup(tmp_mechlist, pos + 6);
}
@@ -277,22 +277,22 @@ PHP_FUNCTION(cyrus_authenticate)
/* XXX: UGLY, but works, determines the username to use */
user = (char *) sapi_getenv("USER", 4);
if (! user) {
user = (char *) getenv("USER");
user = (char *) getenv("USER");
if (! user) {
user = (char *) sapi_getenv("LOGNAME", 7);
if (! user) {
user = (char *) sapi_getenv("LOGNAME", 7);
if (! user) {
user = (char *) getenv("LOGNAME");
if (! user) {
struct passwd *pwd = getpwuid(getuid());
if (! pwd) {
php_error(E_WARNING, "%s(): Couldn't determine user id", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
user = estrdup(pwd->pw_name);
}
user = (char *) getenv("LOGNAME");
if (! user) {
struct passwd *pwd = getpwuid(getuid());
if (! pwd) {
php_error(E_WARNING, "%s(): Couldn't determine user id", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
user = estrdup(pwd->pw_name);
}
}
}
}
}
@@ -314,7 +314,7 @@ PHP_FUNCTION(cyrus_authenticate)
maxssf = 1000;
}
imclient_authenticate(conn->client, mechlist, service,
imclient_authenticate(conn->client, mechlist, service,
user, minssf, maxssf);
efree(mechlist);
@@ -324,8 +324,8 @@ PHP_FUNCTION(cyrus_authenticate)
/* }}} */
static void cyrus_generic_callback(struct imclient *client,
void *rock,
static void cyrus_generic_callback(struct imclient *client,
void *rock,
struct imclient_reply *reply)
{
php_cyrus_callback *callback = rock;
@@ -356,7 +356,7 @@ static void cyrus_generic_callback(struct imclient *client,
argv[2] = &text;
argv[3] = &msgno;
if (call_user_function_ex(EG(function_table), NULL, callback->function,
if (call_user_function_ex(EG(function_table), NULL, callback->function,
&retval, 4, argv, 0, NULL TSRMLS_CC) == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the %s handler",
get_active_function_name(TSRMLS_C), callback->trigger);
@@ -374,8 +374,8 @@ static void cyrus_generic_callback(struct imclient *client,
}
}
/* {{{ proto bool cyrus_bind( resource connection, array callbacks)
/* {{{ proto bool cyrus_bind( resource connection, array callbacks)
Bind callbacks to a Cyrus IMAP connection */
PHP_FUNCTION(cyrus_bind)
{
@@ -397,7 +397,7 @@ PHP_FUNCTION(cyrus_bind)
hash = HASH_OF(*z_callback);
if (! hash) {
php_error(E_WARNING,
php_error(E_WARNING,
"%s(): Second argument must be an array or object", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
@@ -407,9 +407,9 @@ PHP_FUNCTION(cyrus_bind)
zend_hash_move_forward(hash)) {
SEPARATE_ZVAL(tmp);
zend_hash_get_current_key(hash, &string_key, &num_key, 0);
if (! string_key)
if (! string_key)
continue;
if (! strcasecmp(string_key, "trigger")) {
convert_to_string_ex(tmp);
callback.trigger = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
@@ -436,7 +436,7 @@ PHP_FUNCTION(cyrus_bind)
callback.le = conn->id;
imclient_addcallback(conn->client, callback.trigger, callback.flags,
imclient_addcallback(conn->client, callback.trigger, callback.flags,
cyrus_generic_callback, (void **) &callback, 0);
RETURN_TRUE;
@@ -458,14 +458,14 @@ PHP_FUNCTION(cyrus_unbind)
ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
convert_to_string_ex(trigger_name);
imclient_addcallback(conn->client, Z_STRVAL_PP(trigger_name), 0,
imclient_addcallback(conn->client, Z_STRVAL_PP(trigger_name), 0,
NULL, NULL, 0);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool cyrus_query( resource connection, string query)
/* {{{ proto bool cyrus_query( resource connection, string query)
Send a query to a Cyrus IMAP server */
PHP_FUNCTION(cyrus_query)
{
@@ -480,7 +480,7 @@ PHP_FUNCTION(cyrus_query)
ZEND_FETCH_RESOURCE(conn, php_cyrus *, z_conn, -1, le_cyrus_name, le_cyrus);
convert_to_string_ex(query);
imclient_send(conn->client, NULL, NULL, Z_STRVAL_PP(query));
imclient_send(conn->client, NULL, NULL, Z_STRVAL_PP(query));
RETURN_TRUE;
}
+1 -1
View File
@@ -26,7 +26,7 @@ AC_DEFUN(AC_PREFERRED_DB_LIB,[
PHP_ARG_WITH(db, for xDBM support,
[ --with-db Include old xDBM support (deprecated, use --enable-dba instead)])
[ --with-db Include old xDBM support (deprecated use --with-dba)])
if test "$PHP_DB" != "no"; then
+7 -7
View File
@@ -513,7 +513,7 @@ PHP_FUNCTION(dbminsert)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -539,7 +539,7 @@ PHP_FUNCTION(dbmreplace)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -607,7 +607,7 @@ PHP_FUNCTION(dbmfetch)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -683,7 +683,7 @@ PHP_FUNCTION(dbmexists)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -732,7 +732,7 @@ PHP_FUNCTION(dbmdelete)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -779,7 +779,7 @@ PHP_FUNCTION(dbmfirstkey)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
@@ -841,7 +841,7 @@ PHP_FUNCTION(dbmnextkey)
info = php_find_dbm(id TSRMLS_CC);
if (!info) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %ld", Z_LVAL_P(id));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid database identifier %d", Z_LVAL_P(id));
RETURN_FALSE;
}
+54 -76
View File
@@ -26,10 +26,10 @@ dnl Standard check
AC_DEFUN(PHP_DBA_STD_CHECK,[
THIS_RESULT="yes"
if test -z "$THIS_INCLUDE"; then
AC_MSG_ERROR([DBA: Could not find necessary header file(s).])
AC_MSG_ERROR(cannot find necessary header file(s))
fi
if test -z "$THIS_LIBS"; then
AC_MSG_ERROR([DBA: Could not find necessary library.])
AC_MSG_ERROR(cannot find necessary library)
fi
])
@@ -79,11 +79,13 @@ AC_ARG_WITH(gdbm,
if test -n "$THIS_INCLUDE"; then
unset ac_cv_lib_gdbm_gdbm_open
PHP_CHECK_LIBRARY(gdbm, gdbm_open, [
AC_DEFINE_UNQUOTED(GDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_GDBM, 1, [ ])
THIS_LIBS=gdbm
], [], [-L$THIS_PREFIX/lib])
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB(gdbm, gdbm_open, [
AC_DEFINE_UNQUOTED(GDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_GDBM, 1, [ ])
THIS_LIBS=gdbm
])
])
fi
PHP_DBA_STD_ASSIGN
@@ -111,14 +113,14 @@ AC_ARG_WITH(ndbm,
if test -n "$THIS_INCLUDE"; then
for LIB in ndbm db1 c; do
PHP_CHECK_LIBRARY($LIB, dbm_open, [
AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_NDBM, 1, [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/lib])
if test -n "$THIS_LIBS"; then
break
fi
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, dbm_open, [
AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_NDBM,1, [ ])
THIS_LIBS=$LIB
break
])
])
done
fi
@@ -134,15 +136,10 @@ dnl parameters(version, library list, function)
AC_DEFUN(PHP_DBA_DB_CHECK,[
for LIB in $2; do
if test -f $THIS_PREFIX/lib/lib$LIB.a -o -f $THIS_PREFIX/lib/lib$LIB.$SHLIB_SUFFIX_NAME; then
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib -l$LIB,[
AC_TRY_LINK([
#include "$THIS_INCLUDE"
],[
$3;
],[
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, $3, [
AC_EGREP_CPP(yes,[
#include "$THIS_INCLUDE"
#if DB_VERSION_MAJOR == $1
yes
#endif
],[
@@ -153,10 +150,6 @@ AC_DEFUN(PHP_DBA_DB_CHECK,[
])
fi
done
if test -z "$THIS_LIBS"; then
AC_MSG_CHECKING(for db$1 major version)
AC_MSG_ERROR(Header contains different version)
fi
if test "$1" = "4"; then
AC_MSG_CHECKING(for db4 minor version and patch level)
AC_EGREP_CPP(yes,[
@@ -221,7 +214,7 @@ AC_ARG_WITH(db4,
break
fi
done
PHP_DBA_DB_CHECK(4, db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
PHP_DBA_DB_CHECK(4, db-4.1 db-4.0 db-4 db4 db, db_create)
fi
])
AC_DBA_STD_RESULT(db4,Berkeley DB4)
@@ -256,9 +249,9 @@ AC_ARG_WITH(db3,
break
fi
done
PHP_DBA_DB_CHECK(3, db-3.3 db-3.2 db-3.1 db-3.0 db-3 db3 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
PHP_DBA_DB_CHECK(3, db-3.3 db-3.2 db-3.1 db-3.0 db-3 db3 db, db_create)
fi
])
])
AC_DBA_STD_RESULT(db3,Berkeley DB3)
AC_ARG_WITH(db2,
@@ -291,7 +284,7 @@ AC_ARG_WITH(db2,
break
fi
done
PHP_DBA_DB_CHECK(2, db-2 db2 db, [(void)db_appinit("", NULL, (DB_ENV*)0, 0)])
PHP_DBA_DB_CHECK(2, db-2 db2 db, db_appinit)
fi
])
AC_DBA_STD_RESULT(db2,Berkeley DB2)
@@ -314,22 +307,24 @@ AC_ARG_WITH(dbm,
if test -n "$THIS_INCLUDE"; then
for LIB in dbm c gdbm; do
PHP_CHECK_LIBRARY($LIB, dbminit, [
AC_MSG_CHECKING(for DBM using GDBM)
AC_DEFINE_UNQUOTED(DBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
if test "$LIB" = "gdbm"; then
AC_DEFINE_UNQUOTED(DBM_VERSION, "GDBM", [ ])
AC_MSG_RESULT(yes)
else
AC_DEFINE_UNQUOTED(DBM_VERSION, "DBM", [ ])
AC_MSG_RESULT(no)
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, dbminit, [
AC_MSG_CHECKING(for DBM using GDBM)
AC_DEFINE_UNQUOTED(DBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
if test "$LIB" = "gdbm"; then
AC_DEFINE_UNQUOTED(DBM_VERSION, "GDBM", [ ])
AC_MSG_RESULT(yes)
else
AC_DEFINE_UNQUOTED(DBM_VERSION, "DBM", [ ])
AC_MSG_RESULT(no)
fi
AC_DEFINE(DBA_DBM,1,[ ])
THIS_LIBS=$LIB
])
if test -n "$THIS_LIBS"; then
break
fi
AC_DEFINE(DBA_DBM, 1, [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/lib])
if test -n "$THIS_LIBS"; then
break
fi
])
done
fi
@@ -341,6 +336,7 @@ AC_ARG_WITH(dbm,
AC_DBA_STD_RESULT(dbm)
AC_DEFUN(PHP_DBA_BUILTIN_CDB,[
PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
AC_DEFINE(DBA_CDB_BUILTIN, 1, [ ])
AC_DEFINE(DBA_CDB_MAKE, 1, [ ])
AC_DEFINE(DBA_CDB, 1, [ ])
@@ -350,7 +346,7 @@ AC_DEFUN(PHP_DBA_BUILTIN_CDB,[
AC_ARG_WITH(cdb,
[ --with-cdb[=DIR] DBA: Include CDB support],[
if test "$withval" = "yes" -o "$HAVE_DBA" = "1"; then
if test "$withval" = "yes"; then
PHP_DBA_BUILTIN_CDB
elif test "$withval" != "no"; then
PHP_DBA_STD_BEGIN
@@ -364,14 +360,14 @@ AC_ARG_WITH(cdb,
if test -n "$THIS_INCLUDE"; then
for LIB in cdb c; do
PHP_CHECK_LIBRARY($LIB, cdb_read, [
AC_DEFINE_UNQUOTED(CDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_CDB, 1, [ ])
THIS_LIBS=$LIB
], [], [-L$THIS_PREFIX/lib])
if test -n "$THIS_LIBS"; then
break
fi
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB($LIB, cdb_read, [
AC_DEFINE_UNQUOTED(CDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
AC_DEFINE(DBA_CDB,1,[ ])
THIS_LIBS=$LIB
break
])
])
done
fi
@@ -380,31 +376,14 @@ AC_ARG_WITH(cdb,
PHP_DBA_STD_ATTACH
fi
],[
if test "$PHP_DBA" != "no" -o "$HAVE_DBA" = "1"; then
if test "$PHP_DBA" != "no"; then
PHP_DBA_BUILTIN_CDB
fi
])
AC_DBA_STD_RESULT(cdb)
AC_DEFUN(PHP_DBA_BUILTIN_INI,[
AC_DEFINE(DBA_INIFILE, 1, [ ])
ini_sources="libinifile/inifile.c"
THIS_RESULT="builtin"
])
AC_ARG_WITH(inifile,
[ --with-inifile DBA: Include INI support],[
if test "$withval" != "no"; then
PHP_DBA_BUILTIN_INI
fi
],[
if test "$PHP_DBA" != "no" -o "$HAVE_DBA" = "1"; then
PHP_DBA_BUILTIN_INI
fi
])
AC_DBA_STD_RESULT(inifile,INI File)
AC_DEFUN(PHP_DBA_BUILTIN_FLATFILE,[
PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
AC_DEFINE(DBA_FLATFILE, 1, [ ])
flat_sources="libflatfile/flatfile.c"
THIS_RESULT="builtin"
@@ -419,7 +398,7 @@ AC_ARG_WITH(flatfile,
PHP_DBA_BUILTIN_FLATFILE
fi
],[
if test "$PHP_DBA" != "no" -o "$HAVE_DBA" = "1"; then
if test "$PHP_DBA" != "no"; then
PHP_DBA_BUILTIN_FLATFILE
fi
])
@@ -429,8 +408,7 @@ AC_MSG_CHECKING(whether to enable DBA interface)
if test "$HAVE_DBA" = "1"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DBA, 1, [ ])
PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db3.c dba_db4.c dba_flatfile.c dba_inifile.c $cdb_sources $flat_sources $ini_sources, $ext_shared)
PHP_ADD_BUILD_DIR($ext_builddir/libinifile)
PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db3.c dba_db4.c dba_flatfile.c $cdb_sources $flat_sources, $ext_shared)
PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
PHP_SUBST(DBA_SHARED_LIBADD)
+38 -240
View File
@@ -28,7 +28,6 @@
#if HAVE_DBA
#include "ext/standard/flock_compat.h"
#include "php_ini.h"
#include <stdio.h>
#include <fcntl.h>
#ifdef HAVE_SYS_FILE_H
@@ -47,13 +46,14 @@
#include "php_db3.h"
#include "php_db4.h"
#include "php_flatfile.h"
#include "php_inifile.h"
/* {{{ dba_functions[]
*/
function_entry dba_functions[] = {
PHP_FE(dba_open, NULL)
PHP_FE(dba_popen, NULL)
/* Disabled until 4.3.1, when persistent STDIO streams are implemented. */
/* PHP_FE(dba_popen, NULL) */
PHP_FE(dba_close, NULL)
PHP_FE(dba_delete, NULL)
PHP_FE(dba_exists, NULL)
@@ -105,56 +105,15 @@ ZEND_GET_MODULE(dba)
WRONG_PARAM_COUNT; \
}
/* {{{ php_dba_myke_key */
static size_t php_dba_make_key(zval **key, char **key_str, char **key_free TSRMLS_DC)
{
if (Z_TYPE_PP(key) == IS_ARRAY) {
zval **group, **name;
HashPosition pos;
size_t len;
if (zend_hash_num_elements(Z_ARRVAL_PP(key)) != 2) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Key does not have exactly two elements: (key, name)");
return -1;
}
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(key), &pos);
zend_hash_get_current_data_ex(Z_ARRVAL_PP(key), (void **) &group, &pos);
zend_hash_move_forward_ex(Z_ARRVAL_PP(key), &pos);
zend_hash_get_current_data_ex(Z_ARRVAL_PP(key), (void **) &name, &pos);
convert_to_string_ex(group);
convert_to_string_ex(name);
if (Z_STRLEN_PP(group) == 0) {
*key_str = Z_STRVAL_PP(name);
*key_free = NULL;
return Z_STRLEN_PP(name);
}
len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_PP(group), Z_STRVAL_PP(name));
*key_free = *key_str;
return len;
} else {
convert_to_string_ex(key);
*key_str = Z_STRVAL_PP(key);
*key_free = NULL;
return Z_STRLEN_PP(key);
}
}
/* }}} */
#define DBA_GET2 \
zval **key; \
char *key_str, *key_free; \
size_t key_len; \
if(ac != 2 || zend_get_parameters_ex(ac, &key, &id) != SUCCESS) { \
WRONG_PARAM_COUNT; \
} \
if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
RETURN_FALSE; \
}
convert_to_string_ex(key)
#define DBA_GET2_3 \
zval **key; \
char *key_str, *key_free; \
size_t key_len; \
zval **tmp; \
int skip = 0; \
switch(ac) { \
@@ -173,21 +132,7 @@ static size_t php_dba_make_key(zval **key, char **key_str, char **key_free TSRML
default: \
WRONG_PARAM_COUNT; \
} \
if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
RETURN_FALSE; \
}
#define DBA_GET3 \
zval **key, **val; \
char *key_str, *key_free; \
size_t key_len; \
if(ac != 3 || zend_get_parameters_ex(ac, &key, &val, &id) != SUCCESS) { \
WRONG_PARAM_COUNT; \
} \
convert_to_string_ex(val); \
if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\
RETURN_FALSE; \
}
convert_to_string_ex(key)
#define DBA_ID_GET \
ZEND_FETCH_RESOURCE2(info, dba_info *, id, -1, "DBA identifier", le_db, le_pdb);
@@ -195,10 +140,7 @@ static size_t php_dba_make_key(zval **key, char **key_str, char **key_free TSRML
#define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET
#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET
#define DBA_ID_GET2_3 DBA_ID_PARS; DBA_GET2_3; DBA_ID_GET
#define DBA_ID_GET3 DBA_ID_PARS; DBA_GET3; DBA_ID_GET
#define DBA_ID_DONE \
if (key_free) efree(key_free)
/* a DBA handler must have specific routines */
#define DBA_NAMED_HND(alias, name, flags) \
@@ -246,68 +188,14 @@ static dba_handler handler[] = {
#if DBA_DB4
DBA_HND(db4, DBA_LOCK_ALL) /* No lock in lib */
#endif
#if DBA_INIFILE
DBA_HND(inifile, DBA_STREAM_OPEN|DBA_LOCK_ALL) /* No lock in lib */
#endif
#if DBA_FLATFILE
DBA_HND(flatfile, DBA_STREAM_OPEN|DBA_LOCK_ALL) /* No lock in lib */
#endif
{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
#if DBA_FLATFILE
#define DBA_DEFAULT "flatfile"
#elif DBA_DB4
#define DBA_DEFAULT "db4"
#elif DBA_DB3
#define DBA_DEFAULT "db3"
#elif DBA_DB2
#define DBA_DEFAULT "db2"
#elif DBA_GDBM
#define DBA_DEFAULT "gdbm"
#elif DBA_NBBM
#define DBA_DEFAULT "ndbm"
#elif DBA_DBM
#define DBA_DEFAULT "dbm"
#else
#define DBA_DEFAULT ""
#endif
/* cdb/cdb_make and ini are no option here */
ZEND_BEGIN_MODULE_GLOBALS(dba)
char *default_handler;
dba_handler *default_hptr;
ZEND_END_MODULE_GLOBALS(dba)
ZEND_DECLARE_MODULE_GLOBALS(dba)
#ifdef ZTS
#define DBA_G(v) TSRMG(dba_globals_id, zend_dba_globals *, v)
#else
#define DBA_G(v) (dba_globals.v)
#endif
static int le_db;
static int le_pdb;
/* {{{ dba_fetch_resource
PHPAPI void dba_fetch_resource(dba_info **pinfo, zval **id TSRMLS_DC)
{
dba_info *info;
DBA_ID_FETCH
*pinfo = info;
}
*/
/* }}} */
/* {{{ dba_get_handler
PHPAPI dba_handler *dba_get_handler(const char* handler_name)
{
dba_handler *hptr;
for (hptr = handler; hptr->name && strcasecmp(hptr->name, handler_name); hptr++);
return hptr;
}
*/
/* }}} */
/* {{{ dba_close
@@ -321,11 +209,7 @@ static void dba_close(dba_info *info TSRMLS_DC)
pefree(info->path, info->flags&DBA_PERSISTENT);
}
if (info->fp && info->fp!=info->lock.fp) {
if(info->flags&DBA_PERSISTENT) {
php_stream_pclose(info->fp);
} else {
php_stream_close(info->fp);
}
php_stream_close(info->fp);
}
if (info->lock.fd) {
php_flock(info->lock.fd, LOCK_UN);
@@ -333,11 +217,7 @@ static void dba_close(dba_info *info TSRMLS_DC)
info->lock.fd = 0;
}
if (info->lock.fp) {
if(info->flags&DBA_PERSISTENT) {
php_stream_pclose(info->lock.fp);
} else {
php_stream_close(info->lock.fp);
}
php_stream_close(info->lock.fp);
}
if (info->lock.name) {
pefree(info->lock.name, info->flags&DBA_PERSISTENT);
@@ -373,47 +253,10 @@ static void dba_close_pe_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
/* }}} */
/* {{{ PHP_INI
*/
ZEND_INI_MH(OnUpdateDefaultHandler)
{
dba_handler *hptr;
if (!strlen(new_value)) {
DBA_G(default_hptr) = NULL;
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
for (hptr = handler; hptr->name && strcasecmp(hptr->name, new_value); hptr++);
if (!hptr->name) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such handler: %s", new_value);
return FAILURE;
}
DBA_G(default_hptr) = hptr;
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("dba.default_handler", DBA_DEFAULT, PHP_INI_ALL, OnUpdateDefaultHandler, default_handler, zend_dba_globals, dba_globals)
PHP_INI_END()
/* }}} */
/* {{{ php_dba_init_globals
*/
static void php_dba_init_globals(zend_dba_globals *dba_globals)
{
dba_globals->default_handler = "";
dba_globals->default_hptr = NULL;
}
/* }}} */
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(dba)
{
ZEND_INIT_MODULE_GLOBALS(dba, php_dba_init_globals, NULL);
REGISTER_INI_ENTRIES();
le_db = zend_register_list_destructors_ex(dba_close_rsrc, NULL, "dba", module_number);
le_pdb = zend_register_list_destructors_ex(dba_close_pe_rsrc, dba_close_rsrc, "dba persistent", module_number);
return SUCCESS;
@@ -424,7 +267,6 @@ PHP_MINIT_FUNCTION(dba)
*/
PHP_MSHUTDOWN_FUNCTION(dba)
{
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
@@ -460,9 +302,17 @@ PHP_MINFO_FUNCTION(dba)
*/
static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
DBA_ID_PARS;
zval **val, **key;
char *v;
int len;
DBA_ID_GET3;
if(ac != 3 || zend_get_parameters_ex(ac, &key, &val, &id) != SUCCESS) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(key);
convert_to_string_ex(val);
DBA_ID_GET;
DBA_WRITE_CHECK;
@@ -470,20 +320,15 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
len = Z_STRLEN_PP(val);
v = estrndup(Z_STRVAL_PP(val), len);
php_stripslashes(v, &len TSRMLS_CC);
if(info->hnd->update(info, key_str, key_len, v, len, mode TSRMLS_CC) == SUCCESS) {
if(info->hnd->update(info, VALLEN(key), v, len, mode TSRMLS_CC) == SUCCESS) {
efree(v);
DBA_ID_DONE;
RETURN_TRUE;
}
efree(v);
} else {
if(info->hnd->update(info, key_str, key_len, VALLEN(val), mode TSRMLS_CC) == SUCCESS)
{
DBA_ID_DONE;
if(info->hnd->update(info, VALLEN(key), VALLEN(val), mode TSRMLS_CC) == SUCCESS)
RETURN_TRUE;
}
}
DBA_ID_DONE;
RETURN_FALSE;
}
/* }}} */
@@ -532,7 +377,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char mode[4], *pmode, *lock_file_mode = NULL;
int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0;
if(ac < 2) {
if(ac < 3) {
WRONG_PARAM_COUNT;
}
@@ -553,8 +398,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
list_entry *le;
/* calculate hash */
key = safe_emalloc(keylen, 1, 1);
key[keylen] = '\0';
key = emalloc(keylen);
keylen = 0;
for(i = 0; i < ac; i++) {
@@ -577,16 +421,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
}
if (ac==2) {
hptr = DBA_G(default_hptr);
if (!hptr) {
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "No default handler selected");
FREENOW;
RETURN_FALSE;
}
} else {
for (hptr = handler; hptr->name && strcasecmp(hptr->name, Z_STRVAL_PP(args[2])); hptr++);
}
for (hptr = handler; hptr->name && strcasecmp(hptr->name, Z_STRVAL_PP(args[2])); hptr++);
if (!hptr->name) {
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "No such handler: %s", Z_STRVAL_PP(args[2]));
@@ -648,21 +483,16 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
lock_mode = (lock_flag & DBA_LOCK_WRITER) ? LOCK_EX : 0;
file_mode = "r+b";
break;
case 'c':
modenr = DBA_CREAT;
lock_mode = (lock_flag & DBA_LOCK_CREAT) ? LOCK_EX : 0;
file_mode = "a+b";
if (!lock_mode || !lock_dbf) {
break;
}
/* When we lock the db file it will be created before the handler
* even tries to open it, hence we must change to truncate mode.
*/
case 'n':
modenr = DBA_TRUNC;
lock_mode = (lock_flag & DBA_LOCK_TRUNC) ? LOCK_EX : 0;
file_mode = "w+b";
break;
case 'c':
modenr = DBA_CREAT;
lock_mode = (lock_flag & DBA_LOCK_CREAT) ? LOCK_EX : 0;
file_mode = "a+b";
break;
default:
modenr = 0;
lock_mode = 0;
@@ -674,7 +504,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (*pmode=='t') {
pmode++;
if (!lock_flag) {
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "You cannot combine modifiers - (no lock) and t (test lock)");
php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "You cannot combine modifiers - (no lock) and t (test lock)", hptr->name);
FREENOW;
RETURN_FALSE;
}
@@ -803,7 +633,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* }}} */
#undef FREENOW
/* {{{ proto resource dba_popen(string path, string mode [, string handlername, string ...])
/* {{{ proto int dba_popen(string path, string mode, string handlername [, string ...])
Opens path using the specified handler in mode persistently */
PHP_FUNCTION(dba_popen)
{
@@ -811,7 +641,7 @@ PHP_FUNCTION(dba_popen)
}
/* }}} */
/* {{{ proto resource dba_open(string path, string mode [, string handlername, string ...])
/* {{{ proto int dba_open(string path, string mode, string handlername [, string ...])
Opens path using the specified handler in mode*/
PHP_FUNCTION(dba_open)
{
@@ -835,11 +665,9 @@ PHP_FUNCTION(dba_exists)
{
DBA_ID_GET2;
if(info->hnd->exists(info, key_str, key_len TSRMLS_CC) == SUCCESS) {
DBA_ID_DONE;
if(info->hnd->exists(info, VALLEN(key) TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
}
DBA_ID_DONE;
RETURN_FALSE;
}
/* }}} */
@@ -852,38 +680,15 @@ PHP_FUNCTION(dba_fetch)
int len = 0;
DBA_ID_GET2_3;
if (ac==3) {
if (!strcmp(info->hnd->name, "cdb")) {
if (skip < 0) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s accepts only skip values greater than or equal to zero, using skip=0", info->hnd->name);
skip = 0;
}
} else if (!strcmp(info->hnd->name, "inifile")) {
/* "-1" is compareable to 0 but allows a non restrictive
* access which is fater. For example 'inifile' uses this
* to allow faster access when the key was already found
* using firstkey/nextkey. However explicitly setting the
* value to 0 ensures the first value.
*/
if (skip < -1) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s accepts only skip value -1 and greater, using skip=0", info->hnd->name);
skip = 0;
}
} else {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s does not support optional skip parameter, the value will be ignored", info->hnd->name);
skip = 0;
}
} else {
skip = 0;
if (ac==3 && strcmp(info->hnd->name, "cdb")) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Handler %s does not support optional skip parameter", info->hnd->name);
}
if((val = info->hnd->fetch(info, key_str, key_len, skip, &len TSRMLS_CC)) != NULL) {
if((val = info->hnd->fetch(info, VALLEN(key), skip, &len TSRMLS_CC)) != NULL) {
if (val && PG(magic_quotes_runtime)) {
val = php_addslashes(val, len, &len, 1 TSRMLS_CC);
}
DBA_ID_DONE;
RETURN_STRINGL(val, len, 0);
}
DBA_ID_DONE;
RETURN_FALSE;
}
/* }}} */
@@ -919,27 +724,21 @@ PHP_FUNCTION(dba_nextkey)
/* }}} */
/* {{{ proto bool dba_delete(string key, int handle)
Deletes the entry associated with key
If inifile: remove all other key lines */
Deletes the entry associated with key */
PHP_FUNCTION(dba_delete)
{
DBA_ID_GET2;
DBA_WRITE_CHECK;
if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS)
{
DBA_ID_DONE;
if(info->hnd->delete(info, VALLEN(key) TSRMLS_CC) == SUCCESS)
RETURN_TRUE;
}
DBA_ID_DONE;
RETURN_FALSE;
}
/* }}} */
/* {{{ proto bool dba_insert(string key, string value, int handle)
If not inifile: Insert value as key, return false, if key exists already
If inifile: Add vakue as key (next instance of key) */
Inserts value as key, returns false, if key exists already */
PHP_FUNCTION(dba_insert)
{
php_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
@@ -947,8 +746,7 @@ PHP_FUNCTION(dba_insert)
/* }}} */
/* {{{ proto bool dba_replace(string key, string value, int handle)
Inserts value as key, replaces key, if key exists already
If inifile: remove all other key lines */
Inserts value as key, replaces key, if key exists already */
PHP_FUNCTION(dba_replace)
{
php_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
@@ -983,7 +781,7 @@ PHP_FUNCTION(dba_sync)
/* }}} */
/* {{{ proto array dba_handlers([bool full_info])
List configured database handlers */
List configured databases */
PHP_FUNCTION(dba_handlers)
{
dba_handler *hptr;
@@ -1007,7 +805,7 @@ PHP_FUNCTION(dba_handlers)
/* }}} */
/* {{{ proto array dba_list()
List opened databases */
List configured databases */
PHP_FUNCTION(dba_list)
{
ulong numitems, i;
+1 -1
View File
@@ -55,7 +55,7 @@ DBA_OPEN_FUNC(db2)
type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
!s ? DB_BTREE : DB_UNKNOWN;
s ? DB_BTREE : DB_UNKNOWN;
gmode = info->mode == DBA_READER ? DB_RDONLY :
(info->mode == DBA_CREAT && s) ? DB_CREATE :
+1 -1
View File
@@ -64,7 +64,7 @@ DBA_OPEN_FUNC(db3)
type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
!s? DB_BTREE : DB_UNKNOWN;
s? DB_BTREE : DB_UNKNOWN;
gmode = info->mode == DBA_READER ? DB_RDONLY :
(info->mode == DBA_CREAT && s) ? DB_CREATE :
+1 -1
View File
@@ -64,7 +64,7 @@ DBA_OPEN_FUNC(db4)
type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
!s? DB_BTREE : DB_UNKNOWN;
s? DB_BTREE : DB_UNKNOWN;
gmode = info->mode == DBA_READER ? DB_RDONLY :
(info->mode == DBA_CREAT && s) ? DB_CREATE :
-194
View File
@@ -1,194 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 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"
#if DBA_INIFILE
#include "php_inifile.h"
#include "libinifile/inifile.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define INIFILE_DATA \
inifile *dba = info->dbf
#define INIFILE_GKEY \
key_type ini_key; \
if (!key) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No key specified"); \
return 0; \
} \
ini_key = inifile_key_split((char*)key) /* keylen not needed here */
#define INIFILE_DONE \
inifile_key_free(&ini_key)
DBA_OPEN_FUNC(inifile)
{
info->dbf = inifile_alloc(info->fp, info->mode == DBA_READER, info->flags&DBA_PERSISTENT TSRMLS_CC);
return info->dbf ? SUCCESS : FAILURE;
}
DBA_CLOSE_FUNC(inifile)
{
INIFILE_DATA;
inifile_free(dba, info->flags&DBA_PERSISTENT);
}
DBA_FETCH_FUNC(inifile)
{
val_type ini_val;
INIFILE_DATA;
INIFILE_GKEY;
ini_val = inifile_fetch(dba, &ini_key, skip TSRMLS_CC);
*newlen = ini_val.value ? strlen(ini_val.value) : 0;
INIFILE_DONE;
return ini_val.value;
}
DBA_UPDATE_FUNC(inifile)
{
val_type ini_val;
int res;
INIFILE_DATA;
INIFILE_GKEY;
ini_val.value = val;
if (mode == 1) {
res = inifile_append(dba, &ini_key, &ini_val TSRMLS_CC);
} else {
res = inifile_replace(dba, &ini_key, &ini_val TSRMLS_CC);
}
INIFILE_DONE;
switch(res) {
case -1:
php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Operation not possible");
return FAILURE;
default:
case 0:
return SUCCESS;
case 1:
php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Key already exists");
return SUCCESS;
}
}
DBA_EXISTS_FUNC(inifile)
{
val_type ini_val;
INIFILE_DATA;
INIFILE_GKEY;
ini_val = inifile_fetch(dba, &ini_key, 0 TSRMLS_CC);
INIFILE_DONE;
if (ini_val.value) {
inifile_val_free(&ini_val);
return SUCCESS;
}
return FAILURE;
}
DBA_DELETE_FUNC(inifile)
{
int res;
INIFILE_DATA;
INIFILE_GKEY;
res = inifile_delete(dba, &ini_key TSRMLS_CC);
INIFILE_DONE;
return (res == -1 ? FAILURE : SUCCESS);
}
DBA_FIRSTKEY_FUNC(inifile)
{
INIFILE_DATA;
if (inifile_firstkey(dba TSRMLS_CC)) {
char *result = inifile_key_string(&dba->curr.key);
*newlen = strlen(result);
return result;
} else {
return NULL;
}
}
DBA_NEXTKEY_FUNC(inifile)
{
INIFILE_DATA;
if (!dba->curr.key.group && !dba->curr.key.name) {
return NULL;
}
if (inifile_nextkey(dba TSRMLS_CC)) {
char *result = inifile_key_string(&dba->curr.key);
*newlen = strlen(result);
return result;
} else {
return NULL;
}
}
DBA_OPTIMIZE_FUNC(inifile)
{
/* dummy */
return SUCCESS;
}
DBA_SYNC_FUNC(inifile)
{
/* dummy */
return SUCCESS;
}
DBA_INFO_FUNC(inifile)
{
return estrdup(inifile_version());
}
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-595
View File
@@ -1,595 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 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 "safe_mode.h"
#include "php_network.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "inifile.h"
/* ret = -1 means that database was opened for read-only
* ret = 0 success
* ret = 1 key already exists - nothing done
*/
/* {{{ inifile_version */
char *inifile_version()
{
return "1.0, $Revision$";
}
/* }}} */
/* {{{ inifile_free_key */
void inifile_key_free(key_type *key)
{
if (key->group) {
efree(key->group);
}
if (key->name) {
efree(key->name);
}
memset(key, 0, sizeof(key_type));
}
/* }}} */
/* {{{ inifile_free_val */
void inifile_val_free(val_type *val)
{
if (val->value) {
efree(val->value);
}
memset(val, 0, sizeof(val_type));
}
/* }}} */
/* {{{ inifile_free_val */
void inifile_line_free(line_type *ln)
{
inifile_key_free(&ln->key);
inifile_val_free(&ln->val);
ln->pos = 0;
}
/* }}} */
/* {{{ inifile_alloc */
inifile * inifile_alloc(php_stream *fp, int readonly, int persistent TSRMLS_DC)
{
inifile *dba;
int fd = 0;
if (!readonly) {
if (SUCCESS != php_stream_cast(fp, PHP_STREAM_AS_FD, (void*)&fd, 1)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not cast stream");
return NULL;
}
}
dba = pemalloc(sizeof(inifile), persistent);
memset(dba, 0, sizeof(inifile));
dba->fp = fp;
dba->fd = fd;
dba->readonly = readonly;
return dba;
}
/* }}} */
/* {{{ inifile_free */
void inifile_free(inifile *dba, int persistent)
{
if (dba) {
inifile_line_free(&dba->curr);
inifile_line_free(&dba->next);
pefree(dba, persistent);
}
}
/* }}} */
/* {{{ inifile_key_split */
key_type inifile_key_split(const char *group_name)
{
key_type key;
char *name;
if (group_name[0] == '[' && (name = strchr(group_name, ']')) != NULL) {
key.group = estrndup(group_name+1, name - (group_name + 1));
key.name = estrdup(name+1);
} else {
key.group = estrdup("");
key.name = estrdup(group_name);
}
return key;
}
/* }}} */
/* {{{ inifile_key_string */
char * inifile_key_string(const key_type *key)
{
if (key->group && *key->group) {
char *result;
spprintf(&result, 0, "[%s]%s", key->group, key->name ? key->name : "");
return result;
} else if (key->name) {
return estrdup(key->name);
} else {
return NULL;
}
}
/* }}} */
/* {{{ etrim */
static char *etrim(const char *str)
{
char *val;
size_t l;
if (!str) {
return NULL;
}
val = (char*)str;
while (*val && strchr(" \t\r\n", *val)) {
val++;
}
l = strlen(val);
while (l && (strchr(" \t\r\n", val[l-1]))) {
l--;
}
return estrndup(val, l);
}
/* }}} */
/* {{{ inifile_findkey
*/
static int inifile_read(inifile *dba, line_type *ln TSRMLS_DC) {
char *fline;
char *pos;
inifile_val_free(&ln->val);
while ((fline = php_stream_gets(dba->fp, NULL, 0)) != NULL) {
if (fline) {
if (fline[0] == '[') {
/* A value name cannot start with '['
* So either we find a ']' or we found an error
*/
pos = strchr(fline+1, ']');
if (pos) {
*pos = '\0';
inifile_key_free(&ln->key);
ln->key.group = etrim(fline+1);
ln->key.name = estrdup("");
ln->pos = php_stream_tell(dba->fp);
efree(fline);
return 1;
} else {
efree(fline);
continue;
}
} else {
pos = strchr(fline, '=');
if (pos) {
*pos = '\0';
/* keep group or make empty if not existent */
if (!ln->key.group) {
ln->key.group = estrdup("");
}
if (ln->key.name) {
efree(ln->key.name);
}
ln->key.name = etrim(fline);
ln->val.value = etrim(pos+1);
ln->pos = php_stream_tell(dba->fp);
efree(fline);
return 1;
} else {
/* simply ignore lines without '='
* those should be comments
*/
efree(fline);
continue;
}
}
}
}
inifile_line_free(ln);
return 0;
}
/* }}} */
/* {{{ inifile_key_cmp */
/* 0 = EQUAL
* 1 = GROUP-EQUAL,NAME-DIFFERENT
* 2 = DIFFERENT
*/
static int inifile_key_cmp(const key_type *k1, const key_type *k2 TSRMLS_DC)
{
assert(k1->group && k1->name && k2->group && k2->name);
if (!strcasecmp(k1->group, k2->group)) {
if (!strcasecmp(k1->name, k2->name)) {
return 0;
} else {
return 1;
}
} else {
return 2;
}
}
/* }}} */
/* {{{ inifile_fetch
*/
val_type inifile_fetch(inifile *dba, const key_type *key, int skip TSRMLS_DC) {
line_type ln = {{NULL,NULL},{NULL}};
val_type val;
int res, grp_eq = 0;
if (skip == -1 && dba->next.key.group && dba->next.key.name && !inifile_key_cmp(&dba->next.key, key TSRMLS_CC)) {
/* we got position already from last fetch */
php_stream_seek(dba->fp, dba->next.pos, SEEK_SET);
} else {
/* specific instance or not same key -> restart search */
/* the slow way: restart and seacrch */
php_stream_rewind(dba->fp);
inifile_line_free(&dba->next);
}
if (skip == -1) {
skip = 0;
}
while(inifile_read(dba, &ln TSRMLS_CC)) {
if (!(res=inifile_key_cmp(&ln.key, key TSRMLS_CC))) {
if (!skip) {
val.value = estrdup(ln.val.value ? ln.val.value : "");
/* allow faster access by updating key read into next */
inifile_line_free(&dba->next);
dba->next = ln;
dba->next.pos = php_stream_tell(dba->fp);
return val;
}
skip--;
} else if (res == 1) {
grp_eq = 1;
} else if (grp_eq) {
/* we are leaving group now: that means we cannot find the key */
break;
}
}
inifile_line_free(&ln);
dba->next.pos = php_stream_tell(dba->fp);
return ln.val;
}
/* }}} */
/* {{{ inifile_firstkey
*/
int inifile_firstkey(inifile *dba TSRMLS_DC) {
inifile_line_free(&dba->curr);
dba->curr.pos = 0;
return inifile_nextkey(dba TSRMLS_CC);
}
/* }}} */
/* {{{ inifile_nextkey
*/
int inifile_nextkey(inifile *dba TSRMLS_DC) {
line_type ln = {{NULL,NULL},{NULL}};
/*inifile_line_free(&dba->next); ??? */
php_stream_seek(dba->fp, dba->curr.pos, SEEK_SET);
ln.key.group = estrdup(dba->curr.key.group ? dba->curr.key.group : "");
inifile_read(dba, &ln TSRMLS_CC);
inifile_line_free(&dba->curr);
dba->curr = ln;
return ln.key.group || ln.key.name;
}
/* }}} */
/* {{{ inifile_truncate
*/
static int inifile_truncate(inifile *dba, size_t size TSRMLS_DC)
{
int res;
php_stream_flush(dba->fp);
if ((res=ftruncate(dba->fd, size)) != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error in ftruncate: %d", res);
return FAILURE;
}
php_stream_seek(dba->fp, size, SEEK_SET);
return SUCCESS;
}
/* }}} */
/* {{{ inifile_find_group
* if found pos_grp_start points to "[group_name]"
*/
static int inifile_find_group(inifile *dba, const key_type *key, size_t *pos_grp_start TSRMLS_DC)
{
int ret = FAILURE;
php_stream_flush(dba->fp);
php_stream_seek(dba->fp, 0, SEEK_SET);
inifile_line_free(&dba->curr);
inifile_line_free(&dba->next);
if (key->group && strlen(key->group)) {
int res;
line_type ln = {{NULL,NULL},{NULL}};
res = 1;
while(inifile_read(dba, &ln TSRMLS_CC)) {
if ((res=inifile_key_cmp(&ln.key, key TSRMLS_CC)) < 2) {
ret = SUCCESS;
break;
}
*pos_grp_start = php_stream_tell(dba->fp);
}
inifile_line_free(&ln);
} else {
*pos_grp_start = 0;
ret = SUCCESS;
}
if (ret == FAILURE) {
*pos_grp_start = php_stream_tell(dba->fp);
}
return ret;
}
/* }}} */
/* {{{ inifile_next_group
* only valid after a call to inifile_find_group
* if any next group is found pos_grp_start points to "[group_name]" or whitespace before that
*/
static int inifile_next_group(inifile *dba, const key_type *key, size_t *pos_grp_start TSRMLS_DC)
{
int ret = FAILURE;
line_type ln = {{NULL,NULL},{NULL}};
*pos_grp_start = php_stream_tell(dba->fp);
ln.key.group = estrdup(key->group);
while(inifile_read(dba, &ln TSRMLS_CC)) {
if (inifile_key_cmp(&ln.key, key TSRMLS_CC) == 2) {
ret = SUCCESS;
break;
}
*pos_grp_start = php_stream_tell(dba->fp);
}
inifile_line_free(&ln);
return ret;
}
/* }}} */
/* {{{ inifile_copy_to
*/
static int inifile_copy_to(inifile *dba, size_t pos_start, size_t pos_end, inifile **ini_copy TSRMLS_DC)
{
php_stream *fp;
if (pos_start == pos_end) {
*ini_copy = NULL;
return SUCCESS;
}
if ((fp = php_stream_temp_create(0, 64 * 1024)) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create temporary stream");
*ini_copy = NULL;
return FAILURE;
}
if ((*ini_copy = inifile_alloc(fp, 1, 0 TSRMLS_CC)) == NULL) {
/* writes error */
return FAILURE;
}
php_stream_seek(dba->fp, pos_start, SEEK_SET);
if (!php_stream_copy_to_stream(dba->fp, fp, pos_end - pos_start)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy group [%d - %d] to temporary stream", pos_start, pos_end);
return FAILURE;
}
return SUCCESS;
}
/* }}} */
/* {{{ inifile_filter
* copy from to dba while ignoring key name (group must equal)
*/
static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRMLS_DC)
{
size_t pos_start = 0, pos_next = 0, pos_curr;
int ret = SUCCESS;
line_type ln = {{NULL,NULL},{NULL}};
php_stream_seek(from->fp, 0, SEEK_SET);
php_stream_seek(dba->fp, 0, SEEK_END);
while(inifile_read(from, &ln TSRMLS_CC)) {
switch(inifile_key_cmp(&ln.key, key TSRMLS_CC)) {
case 0:
pos_curr = php_stream_tell(from->fp);
if (pos_start != pos_next) {
php_stream_seek(from->fp, pos_start, SEEK_SET);
if (!php_stream_copy_to_stream(from->fp, dba->fp, pos_next - pos_start)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy [%d - %d] from temporary stream", pos_next, pos_start);
ret = FAILURE;
}
php_stream_seek(from->fp, pos_curr, SEEK_SET);
}
pos_next = pos_start = pos_curr;
break;
case 1:
pos_next = php_stream_tell(from->fp);
break;
case 2:
/* the function is meant to process only entries from same group */
assert(0);
break;
}
}
if (pos_start != pos_next) {
php_stream_seek(from->fp, pos_start, SEEK_SET);
if (!php_stream_copy_to_stream(from->fp, dba->fp, pos_next - pos_start)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy [%d - %d] from temporary stream", pos_next, pos_start);
ret = FAILURE;
}
}
inifile_line_free(&ln);
return SUCCESS;
}
/* }}} */
/* {{{ inifile_delete_replace_append
*/
static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, int append TSRMLS_DC)
{
size_t pos_grp_start, pos_grp_next;
inifile *ini_tmp = NULL;
php_stream *fp_tmp = NULL;
int ret;
/* 1) Search group start
* 2) Search next group
* 3) If not append: Copy group to ini_tmp
* 4) Open temp_stream and copy remainder
* 5) Truncate stream
* 6) If not append AND key.name given: Filtered copy back from ini_tmp
* to stream. Otherwise the user wanted to delete the group.
* 7) Append value if given
* 8) Append temporary stream
*/
assert(!append || (key->name && value)); /* missuse */
/* 1 - 3 */
inifile_find_group(dba, key, &pos_grp_start TSRMLS_CC);
inifile_next_group(dba, key, &pos_grp_next TSRMLS_CC);
if (append) {
ret = SUCCESS;
} else {
ret = inifile_copy_to(dba, pos_grp_start, pos_grp_next, &ini_tmp TSRMLS_CC);
}
/* 4 */
if (ret == SUCCESS) {
fp_tmp = php_stream_temp_create(0, 64 * 1024);
if (!fp_tmp) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create temporary stream");
ret = FAILURE;
} else {
php_stream_seek(dba->fp, 0, SEEK_END);
if (pos_grp_next != php_stream_tell(dba->fp)) {
php_stream_seek(dba->fp, pos_grp_next, SEEK_SET);
if (!php_stream_copy_to_stream(dba->fp, fp_tmp, PHP_STREAM_COPY_ALL)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not copy remainder to temporary stream");
ret = FAILURE;
}
}
}
}
/* 5 */
if (ret == SUCCESS) {
ret = inifile_truncate(dba, append ? pos_grp_next : pos_grp_start TSRMLS_CC); /* writes error on fail */
}
if (ret == SUCCESS) {
if (key->name && strlen(key->name)) {
/* 6 */
if (!append && ini_tmp) {
ret = inifile_filter(dba, ini_tmp, key TSRMLS_CC);
}
/* 7 */
/* important: do not query ret==SUCCESS again: inifile_filter might fail but
* however next operation must be done.
*/
if (value) {
if (pos_grp_start == pos_grp_next && key->group && strlen(key->group)) {
php_stream_printf(dba->fp TSRMLS_CC, "[%s]\n", key->group);
}
php_stream_printf(dba->fp TSRMLS_CC, "%s=%s\n", key->name, value->value ? value->value : "");
}
}
/* 8 */
/* important: do not query ret==SUCCESS again: inifile_filter might fail but
* however next operation must be done.
*/
if (fp_tmp && php_stream_tell(fp_tmp)) {
php_stream_seek(fp_tmp, 0, SEEK_SET);
php_stream_seek(dba->fp, 0, SEEK_END);
if (!php_stream_copy_to_stream(fp_tmp, dba->fp, PHP_STREAM_COPY_ALL)) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not copy from temporary stream - ini file truncated");
ret = FAILURE;
}
}
}
if (ini_tmp) {
php_stream_close(ini_tmp->fp);
inifile_free(ini_tmp, 0);
}
if (fp_tmp) {
php_stream_close(fp_tmp);
}
php_stream_flush(dba->fp);
php_stream_seek(dba->fp, 0, SEEK_SET);
return ret;
}
/* }}} */
/* {{{ inifile_delete
*/
int inifile_delete(inifile *dba, const key_type *key TSRMLS_DC)
{
return inifile_delete_replace_append(dba, key, NULL, 0 TSRMLS_CC);
}
/* }}} */
/* {{{ inifile_relace
*/
int inifile_replace(inifile *dba, const key_type *key, const val_type *value TSRMLS_DC)
{
return inifile_delete_replace_append(dba, key, value, 0 TSRMLS_CC);
}
/* }}} */
/* {{{ inifile_append
*/
int inifile_append(inifile *dba, const key_type *key, const val_type *value TSRMLS_DC)
{
return inifile_delete_replace_append(dba, key, value, 1 TSRMLS_CC);
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-67
View File
@@ -1,67 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 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$ */
#ifndef PHP_LIB_INIFILE_H
#define PHP_LIB_INIFILE_H
typedef struct {
char *group;
char *name;
} key_type;
typedef struct {
char *value;
} val_type;
typedef struct {
key_type key;
val_type val;
size_t pos;
} line_type;
typedef struct {
char *lockfn;
int lockfd;
php_stream *fp;
int fd;
int readonly;
line_type curr;
line_type next;
} inifile;
val_type inifile_fetch(inifile *dba, const key_type *key, int skip TSRMLS_DC);
int inifile_firstkey(inifile *dba TSRMLS_DC);
int inifile_nextkey(inifile *dba TSRMLS_DC);
int inifile_delete(inifile *dba, const key_type *key TSRMLS_DC);
int inifile_replace(inifile *dba, const key_type *key, const val_type *val TSRMLS_DC);
int inifile_append(inifile *dba, const key_type *key, const val_type *val TSRMLS_DC);
char *inifile_version();
key_type inifile_key_split(const char *group_name);
char * inifile_key_string(const key_type *key);
void inifile_key_free(key_type *key);
void inifile_val_free(val_type *val);
void inifile_line_free(line_type *ln);
inifile * inifile_alloc(php_stream *fp, int readonly, int persistent TSRMLS_DC);
void inifile_free(inifile *dba, int persistent);
#endif
-12
View File
@@ -1,12 +0,0 @@
#ifndef PHP_INIFILE_H
#define PHP_INIFILE_H
#if DBA_INIFILE
#include "php_dba.h"
DBA_FUNCS(inifile);
#endif
#endif
+3 -3
View File
@@ -37,9 +37,9 @@ database file created
database file created
array(3) {
[%d]=>
string(%d) "%s/dba/tests/test0.dbm"
string(%d) "%sext/dba/tests/test0.dbm"
[%d]=>
string(%d) "%s/dba/tests/test1.dbm"
string(%d) "%sext/dba/tests/test1.dbm"
[%d]=>
string(%d) "%s/dba/tests/test2.dbm"
string(%d) "%sext/dba/tests/test2.dbm"
}
+2 -2
View File
@@ -2,14 +2,14 @@
DBA CDB handler test
--SKIPIF--
<?php
$handler = 'cdb';
require_once('skipif.inc');
if (!in_array('cdb', dba_handlers())) die('skip CDB handler not available');
die('info CDB does not support replace or delete');
?>
--FILE--
<?php
$handler = 'cdb';
require_once('test.inc');
$handler = 'cdb';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -3
View File
@@ -4,14 +4,13 @@ DBA CDB_MAKE handler test
magic_quotes_runtime=1
--SKIPIF--
<?php
$handler = 'cdb_make';
require_once('skipif.inc');
die('info CDB_MAKE does not support reading');
if (!in_array('cdb_make', dba_handlers())) die('skip CDB_MAKE handler not available');
?>
--FILE--
<?php
$handler = 'cdb_make';
require_once('test.inc');
$handler = 'cdb_make';
echo "database handler: $handler\n";
// print md5 checksum of test.cdb which is generated by cdb_make program
var_dump(md5(implode('',file(dirname(__FILE__).'/test.cdb'))));
+2 -2
View File
@@ -2,8 +2,8 @@
DBA CDB handler test (read only)
--SKIPIF--
<?php
$handler = 'cdb_make';
require_once('skipif.inc');
if (!extension_loaded('dba')) die('skip dba extension not available');
if (!in_array('cdb', dba_handlers())) die('skip CDB handler not available');
?>
--FILE--
<?php
+2 -2
View File
@@ -2,13 +2,13 @@
DBA DB2 handler test
--SKIPIF--
<?php
$handler = 'db2';
require_once('skipif.inc');
if (!in_array('db2', dba_handlers())) die('skip DB2 handler not available');
?>
--FILE--
<?php
$handler = 'db2';
require_once('test.inc');
$handler = 'db2';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -2
View File
@@ -2,13 +2,13 @@
DBA DB3 handler test
--SKIPIF--
<?php
$handler = 'db3';
require_once('skipif.inc');
if (!in_array('db3', dba_handlers())) die('skip DB3 handler not available');
?>
--FILE--
<?php
$handler = 'db3';
require_once('test.inc');
$handler = 'db3';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -2
View File
@@ -2,13 +2,13 @@
DBA DB4 handler test
--SKIPIF--
<?php
$handler = 'db4';
require_once('skipif.inc');
if (!in_array('db4', dba_handlers())) die('skip DB4 handler not available');
?>
--FILE--
<?php
$handler = 'db4';
require_once('test.inc');
$handler = 'db4';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -2
View File
@@ -2,13 +2,13 @@
DBA DBM handler test
--SKIPIF--
<?php
$handler = 'dbm';
require_once('skipif.inc');
if (!in_array('dbm', dba_handlers())) die('skip DBM handler not available');
?>
--FILE--
<?php
$handler = 'dbm';
require_once('test.inc');
$handler = 'dbm';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -2
View File
@@ -2,13 +2,13 @@
DBA FlatFile handler test
--SKIPIF--
<?php
$handler = 'flatfile';
require_once('skipif.inc');
if (!in_array('flatfile', dba_handlers())) die('skip FlatFile handler not available');
?>
--FILE--
<?php
$handler = 'flatfile';
require_once('test.inc');
$handler = 'flatfile';
require_once('dba_handler.inc');
?>
--EXPECT--
+2 -2
View File
@@ -2,13 +2,13 @@
DBA GDBM handler test
--SKIPIF--
<?php
$handler = 'gdbm';
require_once('skipif.inc');
if (!in_array('gdbm', dba_handlers())) die('skip GDBM handler not available');
?>
--FILE--
<?php
$handler = 'gdbm';
require_once('test.inc');
$handler = 'gdbm';
$lock_flag = ''; // lock in library
require_once('dba_handler.inc');
-29
View File
@@ -1,29 +0,0 @@
--TEST--
DBA INIFILE handler test
--SKIPIF--
<?php
$handler = 'inifile';
require_once('skipif.inc');
?>
--FILE--
<?php
$handler = 'inifile';
require_once('test.inc');
require_once('dba_handler.inc');
?>
--EXPECT--
database handler: inifile
3NYNYY
Content String 2
Content 2 replaced
Read during write: not allowed
Content 2 replaced 2nd time
The 6th value
array(3) {
["key number 6"]=>
string(13) "The 6th value"
["key2"]=>
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
}
+2 -2
View File
@@ -2,13 +2,13 @@
DBA NDBM handler test
--SKIPIF--
<?php
$handler = 'ndbm';
require_once('skipif.inc');
if (!in_array('ndbm', dba_handlers())) die('skip NDBM handler not available');
?>
--FILE--
<?php
$handler = 'ndbm';
require_once('test.inc');
$handler = 'ndbm';
require_once('dba_handler.inc');
?>
--EXPECT--
+11 -14
View File
@@ -2,22 +2,19 @@
if (!extension_loaded('dba')) die('skip dba extension not available');
if (!function_exists('dba_handlers')) die ('skip dba_handlers() not available');
if (!sizeof(dba_handlers())) die('skip no handlers installed');
if (!isset($handler)) {
$handlers = dba_handlers();
if (in_array('flatfile', $handlers)) {
$handler = 'flatfile';
} else {
$handlers = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */
if (count($handlers)==0) {
die('skip no handler available that can be used for the test');
}
$handler = array_shift($handlers);
$handler = dba_handlers();
if (in_array('flatfile', $handler)) {
$handler = 'flatfile';
} elseif ($handler[0]=='cdb') { // CDB currently supports only reading
if (count($handler)==1) {
die('skip CDB currently supports only reading');
}
if ($handler[1]=='cdb_make' && count($handler)==2) {
die('skip CDB currently supports only reading and creating');
}
$handler = $handler[1];
} else {
if (!in_array($handler, dba_handlers())) {
$HND = strtoupper($handler);
die("skip $HND handler not available");
}
$handler = $handler[0];
}
$HND = strtoupper($handler);
?>
+12 -2
View File
@@ -1,7 +1,17 @@
<?php
require_once('skipif.inc');
$lock_flag = 'l';
$db_filename = $db_file = dirname(__FILE__).'/test0.dbm';
$handler = dba_handlers();
if (in_array('flatfile', $handler)) {
$handler = 'flatfile';
} elseif ($handler[0]=='cdb') { // CDB currently supports only reading
if (count($handler)==1) {
die('CDB currently supports only reading ');
}
$handler = $handler[1];
} else {
$handler = $handler[0];
}
$lock_flag = 'l';
@unlink($db_filename);
@unlink($db_filename.'.lck');
?>
+1 -1
View File
@@ -674,7 +674,7 @@ PHP_FUNCTION(dbase_create)
/* field type */
if (zend_hash_index_find(Z_ARRVAL_PP (field), 1, (void **)&value) == FAILURE) {
php_error(E_WARNING, "expected field type as second element of list in field %d", i);
php_error(E_WARNING, "expected field type as sececond element of list in field %d", i);
RETURN_FALSE;
}
convert_to_string_ex(value);
-4
View File
@@ -33,10 +33,6 @@ dbhead_t *get_dbf_head(int fd)
/* build in core info */
dbh->db_fd = fd;
if (dbhead.dbh_dbt < 3) {
php_error(E_WARNING, "This file appears to be dbase ver. %d. Only version 3 and above is supported.", dbhead.dbh_dbt);
return NULL;
}
dbh->db_dbt = dbhead.dbh_dbt;
dbh->db_records = get_long(dbhead.dbh_records);
dbh->db_hlen = get_short(dbhead.dbh_hlen);
+1 -1
View File
@@ -17,7 +17,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author : Marc Boeren <marc@guidance.nl> |
| Frank M. Kromann <frank@kromann.info> |
| Frank M. Kromann <frank@frontbase.com> |
+----------------------------------------------------------------------+
*/
+1 -1
View File
@@ -17,7 +17,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author : Marc Boeren <marc@guidance.nl> |
| Frank M. Kromann <frank@kromann.info> |
| Frank M. Kromann <frank@frontbase.com> |
+----------------------------------------------------------------------+
*/
+2 -2
View File
@@ -161,7 +161,7 @@ PHP_FUNCTION(dio_open)
}
if (fd == -1) {
php_error(E_WARNING, "%s(): cannot open file %s with flags %ld and permissions %ld: %s",
php_error(E_WARNING, "%s(): cannot open file %s with flags %d and permissions %d: %s",
get_active_function_name(TSRMLS_C), file_name, flags, mode, strerror(errno));
RETURN_FALSE;
}
@@ -240,7 +240,7 @@ PHP_FUNCTION(dio_truncate)
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
if (ftruncate(f->fd, offset) == -1) {
php_error(E_WARNING, "%s(): couldn't truncate %d to %ld bytes: %s",
php_error(E_WARNING, "%s(): couldn't truncate %d to %d bytes: %s",
get_active_function_name(TSRMLS_C), f->fd, offset, strerror(errno));
RETURN_FALSE;
}
+226 -205
View File
@@ -146,8 +146,6 @@
#define DOMXML_LOAD_SUBSTITUTE_ENTITIES 4
#define DOMXML_LOAD_COMPLETE_ATTRS 8
#define DOMXML_LOAD_DONT_KEEP_BLANKS 16
#define DOMXML_LOAD_FILE 1
static int le_domxmldocp;
static int le_domxmldoctypep;
static int le_domxmldtdp;
@@ -172,6 +170,7 @@ static int le_domxsltstylesheetp;
static void domxml_error(void *ctx, const char *msg, ...);
static void domxml_error_ext(void *ctx, const char *msg, ...);
static void domxml_error_validate(void *ctx, const char *msg, ...);
static xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int size, int recovery, void *data);
#if defined(LIBXML_XPATH_ENABLED)
static int le_xpathctxp;
@@ -721,7 +720,7 @@ static void php_free_xml_doc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
xmlDoc *doc = (xmlDoc *) rsrc->ptr;
if (doc) {
node_list_wrapper_dtor(doc->children, 1 TSRMLS_CC);
node_list_wrapper_dtor(doc->children, 0 TSRMLS_CC);
node_wrapper_dtor((xmlNodePtr) doc);
xmlFreeDoc(doc);
}
@@ -736,9 +735,8 @@ static void php_free_xml_node(zend_rsrc_list_entry *rsrc TSRMLS_DC)
if (node->parent == NULL) {
/* Attribute Nodes ccontain accessible children
attr_list_wrapper_dtor(node->properties); */
xmlSetTreeDoc(node, NULL);
node_list_wrapper_dtor((xmlNodePtr) node->properties, 1 TSRMLS_CC);
node_list_wrapper_dtor(node->children, 1 TSRMLS_CC);
node_list_wrapper_dtor((xmlNodePtr) node->properties, 0 TSRMLS_CC);
node_list_wrapper_dtor(node->children, 0 TSRMLS_CC);
node_wrapper_dtor(node);
xmlFreeNode(node);
} else {
@@ -751,7 +749,7 @@ static void php_free_xml_attr(zend_rsrc_list_entry *rsrc TSRMLS_DC)
xmlNodePtr node = (xmlNodePtr) rsrc->ptr;
if (node->parent == NULL) {
/* Attribute Nodes contain accessible children */
node_list_wrapper_dtor(node->children, 1 TSRMLS_CC);
node_list_wrapper_dtor(node->children, 0 TSRMLS_CC);
node_wrapper_dtor(node);
xmlFreeProp((xmlAttrPtr) node);
} else {
@@ -819,7 +817,7 @@ static void php_free_xslt_stylesheet(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
}
static void *php_xsltstylesheet_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
void *php_xsltstylesheet_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
{
void *obj;
zval **handle;
@@ -859,7 +857,7 @@ static void php_xsltstylesheet_set_object(zval *wrapper, void *obj, int rsrc_typ
MAKE_STD_ZVAL(addr);
Z_TYPE_P(addr) = IS_LONG;
Z_LVAL_P(addr) = (long) obj;
Z_LVAL_P(addr) = (int) obj;
zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
@@ -868,9 +866,8 @@ static void php_xsltstylesheet_set_object(zval *wrapper, void *obj, int rsrc_typ
}
#endif /* HAVE_DOMXSLT */
/* Not used? */
/*
static void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
{
void *obj;
zval **handle;
@@ -899,7 +896,6 @@ static void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2
return obj;
}
*/
static zval *php_xpathobject_new(xmlXPathObjectPtr obj, int *found TSRMLS_DC)
{
@@ -910,7 +906,7 @@ static zval *php_xpathobject_new(xmlXPathObjectPtr obj, int *found TSRMLS_DC)
return (wrapper);
}
static void *php_xpath_get_context(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
void *php_xpath_get_context(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
{
void *obj;
zval **handle;
@@ -975,7 +971,7 @@ static void php_xpath_set_context(zval *wrapper, void *obj, int rsrc_type TSRMLS
MAKE_STD_ZVAL(addr);
Z_TYPE_P(addr) = IS_LONG;
Z_LVAL_P(addr) = (long) obj;
Z_LVAL_P(addr) = (int) obj;
zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
@@ -1030,7 +1026,7 @@ static void php_xmlparser_set_object(zval *wrapper, void *obj, int rsrc_type TSR
MAKE_STD_ZVAL(addr);
Z_TYPE_P(addr) = IS_LONG;
Z_LVAL_P(addr) = (long) obj;
Z_LVAL_P(addr) = (int) obj;
zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
@@ -1104,7 +1100,7 @@ static char **php_xmlparser_make_params(zval *idvars TSRMLS_DC)
/* }}} */
/* end parser stuff */
static void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC)
{
void *obj;
zval **handle;
@@ -1147,7 +1143,7 @@ static void php_dom_set_object(zval *wrapper, void *obj, int rsrc_type TSRMLS_DC
MAKE_STD_ZVAL(addr);
Z_TYPE_P(addr) = IS_LONG;
Z_LVAL_P(addr) = (long) obj;
Z_LVAL_P(addr) = (int) obj;
zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
@@ -1415,7 +1411,7 @@ static void domxml_error_ext(void *ctx, const char *msg, ...)
add_assoc_string(errormessages,"errormessage",buf,1);
input = ctxt->input;
if (ctxt->name) {
add_assoc_string(errormessages,"nodename",(char *) ctxt->name,1);
add_assoc_string(errormessages,"nodename",ctxt->name,1);
}
if (input != NULL) {
add_assoc_long(errormessages,"line",input->line);
@@ -1451,7 +1447,7 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
}
if (ctxt->parser != NULL) {
if (ctxt->parser->name) {
add_assoc_string(errormessages,"nodename",(char *)ctxt->parser->name,1);
add_assoc_string(errormessages,"nodename",ctxt->parser->name,1);
}
if (ctxt->parser->input != NULL) {
@@ -1478,13 +1474,73 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
}
xmlDocPtr php_dom_xmlSAXParse(xmlSAXHandlerPtr sax, const char *buffer, int size, int recovery, void *data) {
xmlDocPtr ret;
xmlParserCtxtPtr ctxt;
domxml_ErrorCtxt errorCtxt;
char *directory = NULL;
xmlInitParser();
/*if size == -1, we assume, it's a filename not a inmemory xml doc*/
if (size == -1) {
ctxt = (xmlParserCtxt *) xmlCreateFileParserCtxt( buffer);
} else {
ctxt = (xmlParserCtxt *) xmlCreateMemoryParserCtxt((xmlChar *) buffer, size);
}
if (ctxt == NULL) {
return(NULL);
}
if (sax != NULL) {
if (ctxt->sax != NULL)
xmlFree(ctxt->sax);
ctxt->sax = sax;
}
if (data!=NULL) {
ctxt->_private=data;
}
/* store directory name */
if (size == -1) {
if ((ctxt->directory == NULL) && (directory == NULL))
directory = xmlParserGetDirectory(buffer);
if ((ctxt->directory == NULL) && (directory != NULL))
ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
}
errorCtxt.valid = &ctxt->vctxt;
errorCtxt.errors = data;
errorCtxt.parser = ctxt;
ctxt->sax->error = domxml_error_ext;
ctxt->sax->warning = domxml_error_ext;
ctxt->vctxt.userData= (void *) &errorCtxt;
ctxt->vctxt.error = (xmlValidityErrorFunc) domxml_error_validate;
ctxt->vctxt.warning = (xmlValidityWarningFunc) domxml_error_validate;
xmlParseDocument(ctxt);
if ((ctxt->wellFormed) || recovery) {
ret = ctxt->myDoc;
} else {
ret = NULL;
xmlFreeDoc(ctxt->myDoc);
ctxt->myDoc = NULL;
}
if (sax != NULL)
ctxt->sax = NULL;
xmlFreeParserCtxt(ctxt);
return(ret);
}
PHP_MSHUTDOWN_FUNCTION(domxml)
{
#if HAVE_DOMXSLT
xsltCleanupGlobals();
#endif
xmlCleanupParser();
/* If you want do find memleaks in this module, compile libxml2 with --with-mem-debug and
uncomment the following line, this will tell you the amount of not freed memory
and the total used memory into apaches error_log */
@@ -1642,7 +1698,7 @@ PHP_MINIT_FUNCTION(domxml)
exsltRegisterAll();
#endif
#endif
xmlInitParser();
return SUCCESS;
}
/* }}} */
@@ -2327,7 +2383,6 @@ PHP_FUNCTION(domxml_node_replace_node)
{
zval *id, *rv = NULL, *node;
xmlNodePtr repnode, nodep, old_repnode;
xmlDocPtr tmpdoc;
int ret;
DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
@@ -2338,18 +2393,8 @@ PHP_FUNCTION(domxml_node_replace_node)
DOMXML_GET_OBJ(repnode, node, le_domxmlnodep);
tmpdoc = repnode->doc;
old_repnode = xmlReplaceNode(nodep, repnode);
/* ReplaceNode will change the doc for only the first node
so check if doc was changed */
if (tmpdoc != repnode->doc) {
/* Set doc back to old doc otherwise libxml wont change all sub nodes */
repnode->doc = tmpdoc;
xmlSetTreeDoc(repnode, old_repnode->doc);
}
DOMXML_RET_OBJ(rv, old_repnode, &ret);
}
/* }}} */
@@ -2366,6 +2411,11 @@ PHP_FUNCTION(domxml_node_append_child)
DOMXML_GET_OBJ(child, node, le_domxmlnodep);
if (child->type == XML_ATTRIBUTE_NODE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append attribute node");
RETURN_FALSE;
}
/* XXX:ls */
if (child == parent) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't append node to itself");
@@ -2405,45 +2455,6 @@ PHP_FUNCTION(domxml_node_append_child)
}
}
/* end libxml2 code */
else if (child->type == XML_ATTRIBUTE_NODE) {
if (parent->properties != NULL) {
/* Check if an attribute with the same name exists */
xmlAttrPtr foundattrp;
if (child->ns == NULL)
foundattrp = xmlHasProp(parent, child->name);
else
foundattrp = xmlHasNsProp(parent, child->name, child->ns->href);
if (foundattrp != (xmlAttrPtr) child) {
if (foundattrp != NULL) {
if (dom_object_get_data((xmlNodePtr) foundattrp) == NULL) {
node_list_unlink(foundattrp->children);
xmlUnlinkNode((xmlNodePtr) foundattrp);
xmlFreeProp(foundattrp);
} else {
xmlUnlinkNode((xmlNodePtr) foundattrp);
}
new_child = (xmlNodePtr) xmlCopyProp(parent, (xmlAttrPtr) child);
if (!new_child) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such attribute '%s'", child->name);
RETURN_FALSE;
} else {
xmlAttr *prop;
prop = parent->properties;
while (prop->next != NULL) {
prop = prop->next;
}
prop->next = (xmlAttrPtr) new_child;
((xmlAttrPtr) new_child)->prev = prop;
}
}
} else {
new_child = (xmlNodePtr) foundattrp;
}
}
/* For all other intents and purposes fall through to the xmlAddChild
* call
*/
}
if (NULL == new_child) {
new_child = xmlAddChild(parent, child);
@@ -3095,8 +3106,7 @@ struct _idsIterator {
xmlNode *element;
};
static void idsHashScanner(void *payload, void *data, xmlChar *name)
{
static void idsHashScanner(void *payload, void *data, xmlChar *name) {
idsIterator *priv = (idsIterator *)data;
if (priv->element == NULL && xmlStrEqual (name, priv->elementId))
@@ -3908,82 +3918,6 @@ PHP_FUNCTION(domxml_doc_ids)
}
/* }}} */
static xmlDocPtr domxml_document_parser(int mode, int loadtype, char *source, void *data TSRMLS_DC) {
xmlDocPtr ret;
xmlParserCtxtPtr ctxt;
domxml_ErrorCtxt errorCtxt;
char *directory = NULL;
int validate = 0, resolve_externals = 0;
int keep_blanks = 1, recovery = 1, substitute_ent;
substitute_ent = xmlSubstituteEntitiesDefaultValue;
if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS)
keep_blanks = 0;
if(mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES)
substitute_ent = 1;
if(mode & DOMXML_LOAD_COMPLETE_ATTRS)
resolve_externals = XML_COMPLETE_ATTRS;
if(mode & DOMXML_LOAD_VALIDATING)
validate = 1;
if(mode & DOMXML_LOAD_RECOVERING)
recovery = 1;
xmlInitParser();
if (loadtype == DOMXML_LOAD_FILE) {
ctxt = xmlCreateFileParserCtxt(source);
} else {
ctxt = xmlCreateDocParserCtxt(source);
}
if (ctxt == NULL) {
return(NULL);
}
if (loadtype == DOMXML_LOAD_FILE) {
if ((ctxt->directory == NULL) && (directory == NULL))
directory = xmlParserGetDirectory(source);
if ((ctxt->directory == NULL) && (directory != NULL))
ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
}
ctxt->validate = validate;
ctxt->loadsubset = resolve_externals;
ctxt->keepBlanks = keep_blanks;
ctxt->replaceEntities = substitute_ent;
if (data != NULL) {
errorCtxt.valid = &ctxt->vctxt;
errorCtxt.errors = data;
errorCtxt.parser = ctxt;
ctxt->sax->error = domxml_error_ext;
ctxt->sax->warning = domxml_error_ext;
ctxt->vctxt.userData= (void *) &errorCtxt;
ctxt->vctxt.error = (xmlValidityErrorFunc) domxml_error_validate;
ctxt->vctxt.warning = (xmlValidityWarningFunc) domxml_error_validate;
}
xmlParseDocument(ctxt);
if (ctxt->wellFormed || recovery)
ret = ctxt->myDoc;
else {
ret = NULL;
xmlFreeDoc(ctxt->myDoc);
ctxt->myDoc = NULL;
}
xmlFreeParserCtxt(ctxt);
return(ret);
}
/* {{{ proto object xmldoc(string xmldoc[, int mode[, array error]])
Creates DOM object of XML document */
PHP_FUNCTION(xmldoc)
@@ -3994,23 +3928,76 @@ PHP_FUNCTION(xmldoc)
char *buffer;
int buffer_len;
long mode = 0;
int prevSubstValue;
int oldvalue = xmlDoValidityCheckingDefaultValue;
int oldvalue_keepblanks;
int prevLoadExtDtdValue = xmlLoadExtDtdDefaultValue;
zval *errors ;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &buffer, &buffer_len, &mode, &errors) == FAILURE) {
return;
}
if (ZEND_NUM_ARGS() == 3) {
/* Either of the following line force validation */
/* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS; */
/* xmlDoValidityCheckingDefaultValue = 1; */
if (ZEND_NUM_ARGS() == 3 ) {
zval_dtor(errors);
array_init(errors);
docp = domxml_document_parser(mode, 0, buffer, errors TSRMLS_CC);
} else {
docp = domxml_document_parser(mode, 0, buffer, NULL TSRMLS_CC);
}
if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS)
oldvalue_keepblanks = xmlKeepBlanksDefault(0);
else
oldvalue_keepblanks = xmlKeepBlanksDefault(1);
if(mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES)
prevSubstValue = xmlSubstituteEntitiesDefault (1);
else
prevSubstValue = xmlSubstituteEntitiesDefault (0);
if(mode & DOMXML_LOAD_COMPLETE_ATTRS)
xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
switch (mode & (DOMXML_LOAD_PARSING | DOMXML_LOAD_VALIDATING | DOMXML_LOAD_RECOVERING)) {
case DOMXML_LOAD_PARSING:
xmlDoValidityCheckingDefaultValue = 0;
if (ZEND_NUM_ARGS() == 3) {
docp = php_dom_xmlSAXParse( NULL, (char *) buffer, buffer_len, 0 , errors);
} else {
docp = xmlParseDoc(buffer);
}
break;
case DOMXML_LOAD_VALIDATING:
xmlDoValidityCheckingDefaultValue = 1;
if (ZEND_NUM_ARGS() == 3) {
docp = php_dom_xmlSAXParse(NULL, (char *) buffer, buffer_len, 0, errors);
} else {
docp = xmlParseDoc(buffer);
}
break;
case DOMXML_LOAD_RECOVERING:
xmlDoValidityCheckingDefaultValue = 0;
if (ZEND_NUM_ARGS() == 3) {
docp = php_dom_xmlSAXParse(NULL, (char *) buffer, buffer_len, 1, errors);
} else {
docp = xmlRecoverDoc(buffer);
}
break;
}
xmlSubstituteEntitiesDefault (prevSubstValue);
xmlDoValidityCheckingDefaultValue = oldvalue;
xmlLoadExtDtdDefaultValue = prevLoadExtDtdValue;
xmlKeepBlanksDefault(oldvalue_keepblanks);
if (!docp)
RETURN_FALSE;
/* dtd = xmlGetIntSubset(docp);
if(dtd) {
xmlParseDTD(dtd->ExternalID, dtd->SystemID);
}
*/
if(DOMXML_IS_TYPE(getThis(), domxmldoc_class_entry)) {
DOMXML_DOMOBJ_NEW(getThis(), (xmlNodePtr) docp, &ret);
} else {
@@ -4028,24 +4015,68 @@ PHP_FUNCTION(xmldocfile)
int ret, file_len;
char *file;
long mode = 0;
int prevSubstValue;
int oldvalue = xmlDoValidityCheckingDefaultValue;
int oldvalue_keepblanks;
zval *errors = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &file, &file_len, &mode, &errors) == FAILURE) {
return;
}
if (ZEND_NUM_ARGS() == 3) {
if (ZEND_NUM_ARGS() == 3 ) {
zval_dtor(errors);
array_init(errors);
docp = domxml_document_parser(mode, 1, file, errors TSRMLS_CC);
} else {
docp = domxml_document_parser(mode, 1, file, NULL TSRMLS_CC);
}
if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS)
oldvalue_keepblanks = xmlKeepBlanksDefault(0);
else
oldvalue_keepblanks = xmlKeepBlanksDefault(1);
if(mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES)
prevSubstValue = xmlSubstituteEntitiesDefault (1);
else
prevSubstValue = xmlSubstituteEntitiesDefault (0);
if(mode & DOMXML_LOAD_COMPLETE_ATTRS)
xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
switch (mode & (DOMXML_LOAD_PARSING | DOMXML_LOAD_VALIDATING | DOMXML_LOAD_RECOVERING)) {
case DOMXML_LOAD_PARSING:
xmlDoValidityCheckingDefaultValue = 0;
if (ZEND_NUM_ARGS() == 3) {
docp = php_dom_xmlSAXParse( NULL, (char *) file, -1 , 0 , errors);
} else {
docp = xmlParseFile(file);
}
break;
case DOMXML_LOAD_VALIDATING:
xmlDoValidityCheckingDefaultValue = 1;
if (ZEND_NUM_ARGS() == 3) {
docp = php_dom_xmlSAXParse(NULL, (char *) file, -1, 0, errors);
} else {
docp = xmlParseFile(file);
}
break;
case DOMXML_LOAD_RECOVERING:
xmlDoValidityCheckingDefaultValue = 0;
if (ZEND_NUM_ARGS() == 3) {
docp = php_dom_xmlSAXParse(NULL, (char*) file, -1, 1, errors);
} else {
docp = xmlRecoverFile(file);
}
break;
}
xmlSubstituteEntitiesDefault (prevSubstValue);
xmlDoValidityCheckingDefaultValue = oldvalue;
xmlKeepBlanksDefault(oldvalue_keepblanks);
if (!docp) {
RETURN_FALSE;
}
if(DOMXML_IS_TYPE(getThis(), domxmldoc_class_entry)) {
DOMXML_DOMOBJ_NEW(getThis(), (xmlNodePtr) docp, &ret);
} else {
@@ -4240,6 +4271,7 @@ PHP_FUNCTION(domxml_doc_validate)
xmlDoc *docp;
domxml_ErrorCtxt errorCtxt;
zval *errors ;
int oldvalue = xmlDoValidityCheckingDefaultValue;
DOMXML_PARAM_ONE(docp, id, le_domxmldocp,"|z",&errors);
errorCtxt.valid = &cvp;
@@ -4253,6 +4285,7 @@ PHP_FUNCTION(domxml_doc_validate)
}
errorCtxt.parser = NULL;
xmlDoValidityCheckingDefaultValue = 1;
cvp.userData = (void *) &errorCtxt;
cvp.error = (xmlValidityErrorFunc) domxml_error_validate;
cvp.warning = (xmlValidityWarningFunc) domxml_error_validate;
@@ -4265,6 +4298,8 @@ PHP_FUNCTION(domxml_doc_validate)
} else {
RETVAL_FALSE;
}
xmlDoValidityCheckingDefaultValue = oldvalue;
}
/* }}} */
@@ -4304,10 +4339,10 @@ PHP_FUNCTION(domxml_doc_free_doc)
RETURN_FALSE;
}
/* No need to do this as php_free_xml_doc will kill the children
node_list_wrapper_dtor(docp->children, 1 TSRMLS_CC);
node_list_wrapper_dtor((xmlNodePtr) docp->properties, 1 TSRMLS_CC);
*/
/* Attribute Nodes ccontain accessible children
attr_list_wrapper_dtor(docp->properties); */
node_wrapper_free(docp TSRMLS_CC);
RETURN_TRUE;
@@ -4376,7 +4411,7 @@ PHP_FUNCTION(domxml_parser_start_element)
char *tagname;
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 TSRMLS_CC);
@@ -4666,7 +4701,9 @@ static int node_namespace(zval **attributes, xmlNode *nodep TSRMLS_DC)
/* }}} */
#endif
/* {{{ int node_attributes(zval **attributes, int node)
/* We don't have a type zval. **attributes is also very unusual. */
/* {{{ proto int node_attributes(zval **attributes, int node)
Returns list of children nodes */
static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC)
{
@@ -4771,8 +4808,7 @@ PHP_FUNCTION(domxml_xmltree)
}
/* Create a new xml document */
docp = domxml_document_parser(0, 0, buf, NULL TSRMLS_CC);
docp = xmlParseDoc(buf);
if (!docp) {
RETURN_FALSE;
}
@@ -5114,26 +5150,28 @@ PHP_FUNCTION(domxml_xslt_stylesheet)
zval *rv;
xmlDocPtr docp;
xsltStylesheetPtr sheetp;
int ret, mode, prevSubstValue, prevExtDtdValue;
int ret;
char *buffer;
int buffer_len;
int prevSubstValue, prevExtDtdValue;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buffer, &buffer_len) == FAILURE) {
RETURN_FALSE;
}
mode = DOMXML_LOAD_SUBSTITUTE_ENTITIES | DOMXML_LOAD_COMPLETE_ATTRS;
docp = domxml_document_parser(mode, 0, buffer, NULL TSRMLS_CC);
prevSubstValue = xmlSubstituteEntitiesDefault (1);
prevExtDtdValue = xmlLoadExtDtdDefaultValue;
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
docp = xmlParseDoc(buffer);
xmlSubstituteEntitiesDefault (prevSubstValue);
xmlLoadExtDtdDefaultValue = prevExtDtdValue;
if (!docp)
RETURN_FALSE;
prevSubstValue = xmlSubstituteEntitiesDefault(1);
prevExtDtdValue = xmlLoadExtDtdDefaultValue;
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
sheetp = xsltParseStylesheetDoc(docp);
xmlSubstituteEntitiesDefault(prevSubstValue);
xmlLoadExtDtdDefaultValue = prevExtDtdValue;
if (!sheetp) {
xmlFreeDoc(docp);
@@ -5182,32 +5220,26 @@ PHP_FUNCTION(domxml_xslt_stylesheet_doc)
PHP_FUNCTION(domxml_xslt_stylesheet_file)
{
zval *rv;
xmlDocPtr docp;
xsltStylesheetPtr sheetp;
int ret, file_len, mode, prevSubstValue, prevExtDtdValue;
int ret, file_len;
char *file;
int prevSubstValue, prevExtDtdValue;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
RETURN_FALSE;
}
mode = DOMXML_LOAD_SUBSTITUTE_ENTITIES | DOMXML_LOAD_COMPLETE_ATTRS;
docp = domxml_document_parser(mode, 1, file, NULL TSRMLS_CC);
if (!docp)
RETURN_FALSE;
prevSubstValue = xmlSubstituteEntitiesDefault(1);
prevSubstValue = xmlSubstituteEntitiesDefault (1);
prevExtDtdValue = xmlLoadExtDtdDefaultValue;
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
sheetp = xsltParseStylesheetDoc(docp);
xmlSubstituteEntitiesDefault(prevSubstValue);
sheetp = xsltParseStylesheetFile(file);
xmlSubstituteEntitiesDefault (prevSubstValue);
xmlLoadExtDtdDefaultValue = prevExtDtdValue;
if (!sheetp) {
xmlFreeDoc(docp);
if (!sheetp)
RETURN_FALSE;
}
rv = php_xsltstylesheet_new(sheetp, &ret TSRMLS_CC);
DOMXML_RET_ZVAL(rv);
@@ -5304,7 +5336,7 @@ PHP_FUNCTION(domxml_xslt_process)
xmlDocPtr xmldocp;
xmlDocPtr docp;
char **params = NULL;
int ret, clone = 0;
int ret;
char *filename;
int filename_len = 0;
@@ -5316,7 +5348,7 @@ PHP_FUNCTION(domxml_xslt_process)
RETURN_FALSE;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|a!b!s!l", &idxml, &idparams, &xpath_params, &filename, &filename_len, &clone) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|abs", &idxml, &idparams, &xpath_params, &filename, &filename_len) == FAILURE) {
RETURN_FALSE;
}
@@ -5326,10 +5358,6 @@ PHP_FUNCTION(domxml_xslt_process)
params = php_domxslt_make_params(idparams, xpath_params TSRMLS_CC);
}
if (clone == 1) {
xmldocp = xmlCopyDoc(xmldocp, 1);
}
if (filename_len) {
FILE *f;
f = fopen (filename,"w");
@@ -5339,10 +5367,6 @@ PHP_FUNCTION(domxml_xslt_process)
docp = xsltApplyStylesheet(xsltstp, xmldocp, (const char**)params);
}
if (clone == 1) {
xmlFreeDoc(xmldocp);
}
if (params) {
efree(params);
}
@@ -5381,16 +5405,13 @@ PHP_FUNCTION(domxml_xslt_result_dump_mem)
DOMXML_GET_OBJ(xmldocp, idxml, le_domxmldocp);
ret = xsltSaveResultToString(&doc_txt_ptr, &doc_txt_len, xmldocp, xsltstp);
if (ret < 0) {
RETURN_FALSE;
}
if (doc_txt_ptr) {
RETVAL_STRINGL(doc_txt_ptr, doc_txt_len, 1);
xmlFree(doc_txt_ptr);
} else {
RETURN_EMPTY_STRING();
}
RETVAL_STRINGL(doc_txt_ptr, doc_txt_len, 1);
xmlFree(doc_txt_ptr);
}
/* }}} */
+1 -2
View File
@@ -24,7 +24,6 @@
#if HAVE_DOMXML
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/SAX.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#include <libxml/xinclude.h>
@@ -246,4 +245,4 @@ typedef struct {
#endif /* HAVE_DOMXML */
#define phpext_domxml_ptr domxml_module_ptr
#endif /* _PHP_DOMXML_H */
#endif /* _PHP_DIR_H */
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Attributes via append_child not supported (bug #23326)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$document = domxml_new_doc('1.0');
$test = $document->create_element('test');
$j = 0;
for($i=0;$i<10;$i++)
{
if( $j < 5 )
$j = $i;
$test->append_child($document->create_attribute("key$j", $i));
}
$document->append_child($test);
echo $document->dump_mem(1);
?>
--EXPECT--
<?xml version="1.0"?>
<test key0="0" key1="1" key2="2" key3="3" key4="4" key5="9"/>
+186 -100
View File
@@ -70,10 +70,6 @@
typedef unsigned char uchar;
#ifndef safe_emalloc
# define safe_emalloc(a,b,c) emalloc((a)*(b)+(c))
#endif
#ifndef TRUE
# define TRUE 1
# define FALSE 0
@@ -134,22 +130,22 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
/* {{{ PHP_INI
*/
ZEND_INI_MH(OnUpdateEncode)
ZEND_API ZEND_INI_MH(OnUpdateEncode)
{
#if EXIF_USE_MBSTRING
if (new_value && strlen(new_value) && !php_mb_check_encoding_list(new_value TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
php_error_docref( NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
return FAILURE;
}
#endif
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
ZEND_INI_MH(OnUpdateDecode)
ZEND_API ZEND_INI_MH(OnUpdateDecode)
{
#if EXIF_USE_MBSTRING
if (!php_mb_check_encoding_list(new_value TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
php_error_docref( NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
return FAILURE;
}
#endif
@@ -238,15 +234,17 @@ static size_t php_strnlen(char* str, size_t maxlen) {
/* {{{ error messages
*/
static const char * EXIF_ERROR_EALLOC = "Cannot allocate memory for all data";
static const char * EXIF_ERROR_FILEEOF = "Unexpected end of file reached";
static const char * EXIF_ERROR_CORRUPT = "File structure corrupted";
static const char * EXIF_ERROR_THUMBEOF = "Thumbnail goes IFD boundary or end of file reached";
static const char * EXIF_ERROR_FSREALLOC = "Illegal reallocating of undefined file section";
#define EXIF_ERRLOG_FILEEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", EXIF_ERROR_FILEEOF);
#define EXIF_ERRLOG_CORRUPT php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", EXIF_ERROR_CORRUPT);
#define EXIF_ERRLOG_THUMBEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", EXIF_ERROR_THUMBEOF);
#define EXIF_ERRLOG_FSREALLOC php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", EXIF_ERROR_FSREALLOC);
#define EXIF_ERRLOG_EALLOC php_error_docref(NULL TSRMLS_CC, E_ERROR, EXIF_ERROR_EALLOC);
#define EXIF_ERRLOG_FILEEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_FILEEOF);
#define EXIF_ERRLOG_CORRUPT php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_CORRUPT);
#define EXIF_ERRLOG_THUMBEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_THUMBEOF);
#define EXIF_ERRLOG_FSREALLOC php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_FSREALLOC);
/* }}} */
/* {{{ format description defines
@@ -995,11 +993,11 @@ static unsigned char* exif_char_dump(unsigned char * addr, int len, int offset)
p += sprintf(buf+p, "\n%08X: ", i+offset);
}
if (i<len) {
c = *addr++;
c = *addr++;
p += sprintf(buf+p, "%02X ", c);
tmp[i%16] = c>=32 ? c : '.';
tmp[(i%16)+1] = '\0';
} else {
} else {
p += sprintf(buf+p, " ");
}
if (i%16==15) {
@@ -1139,12 +1137,12 @@ static double exif_convert_any_format(void *value, int format, int motorola_inte
/* Not sure if this is correct (never seen float used in Exif format) */
case TAG_FMT_SINGLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type single");
php_error_docref( NULL TSRMLS_CC, E_NOTICE, "Found value of type single");
#endif
return (double)*(float *)value;
case TAG_FMT_DOUBLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type double");
php_error_docref( NULL TSRMLS_CC, E_NOTICE, "Found value of type double");
#endif
return *(double *)value;
}
@@ -1188,12 +1186,12 @@ static size_t exif_convert_any_to_int(void *value, int format, int motorola_inte
/* Not sure if this is correct (never seen float used in Exif format) */
case TAG_FMT_SINGLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type single");
php_error_docref( NULL TSRMLS_CC, E_NOTICE, "Found value of type single");
#endif
return (size_t)*(float *)value;
case TAG_FMT_DOUBLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type double");
php_error_docref( NULL TSRMLS_CC, E_NOTICE, "Found value of type double");
#endif
return (size_t)*(double *)value;
}
@@ -1334,6 +1332,10 @@ static char *exif_get_sectionlist(int sectionlist TSRMLS_DC)
len += strlen(exif_get_sectionname(i))+2;
}
sections = safe_emalloc(len, 1, 1);
if (!sections) {
EXIF_ERRLOG_EALLOC
return NULL;
}
sections[0] = '\0';
len = 0;
for(i=0; i<SECTION_COUNT; i++) {
@@ -1466,6 +1468,9 @@ static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t s
int count = ImageInfo->file.count;
tmp = erealloc(ImageInfo->file.list, (count+1)*sizeof(file_section));
if (tmp == NULL) {
return 0;
}
ImageInfo->file.list = tmp;
ImageInfo->file.list[count].type = 0xFFFF;
ImageInfo->file.list[count].data = NULL;
@@ -1474,7 +1479,9 @@ static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t s
if (!size) {
data = NULL;
} else if (data == NULL) {
data = emalloc(size);
if ((data = emalloc(size)) == NULL) {
return -1;
}
}
ImageInfo->file.list[count].type = type;
ImageInfo->file.list[count].data = data;
@@ -1490,14 +1497,14 @@ static int exif_file_sections_realloc(image_info_type *ImageInfo, int section_in
{
void *tmp;
/* This is not a malloc/realloc check. It is a plausibility check for the
* function parameters (requirements engineering).
*/
if (section_index >= ImageInfo->file.count) {
EXIF_ERRLOG_FSREALLOC
return -1;
}
tmp = erealloc(ImageInfo->file.list[section_index].data, size);
if (!(tmp = erealloc(ImageInfo->file.list[section_index].data, size)) && size) {
EXIF_ERRLOG_EALLOC
return -1;
}
ImageInfo->file.list[section_index].data = tmp;
ImageInfo->file.list[section_index].size = size;
return 0;
@@ -1538,6 +1545,10 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
}
list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data));
if (!list) {
EXIF_ERRLOG_EALLOC
return;
}
image_info->info_list[section_index].list = list;
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
@@ -1545,22 +1556,27 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
info_data->format = format;
info_data->length = length;
info_data->name = estrdup(name);
if (!info_data->name) {
EXIF_ERRLOG_EALLOC
return;
}
info_value = &info_data->value;
switch (format) {
case TAG_FMT_STRING:
if (value) {
length = php_strnlen(value, length);
if (PG(magic_quotes_runtime)) {
info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
} else {
info_value->s = estrndup(value, length);
}
info_data->length = length;
info_value->s = estrndup(value, length);
} else {
info_data->length = 0;
info_value->s = estrdup("");
}
if (!info_value->s) {
EXIF_ERRLOG_EALLOC
info_data->length = 0;
break; /* better return with "" instead of possible causing problems */
}
break;
default:
@@ -1577,17 +1593,15 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
break;
case TAG_FMT_UNDEFINED:
if (value) {
/* do not recompute length here */
if (PG(magic_quotes_runtime)) {
info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
} else {
info_value->s = estrndup(value, length);
}
info_data->length = length;
info_value->s = estrndup(value, length);
} else {
info_data->length = 0;
info_value->s = estrdup("");
}
if (!info_value->s) {
EXIF_ERRLOG_EALLOC
return;
}
break;
case TAG_FMT_USHORT:
@@ -1602,7 +1616,11 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
break;
} else
if (length>1) {
info_value->list = safe_emalloc(length, sizeof(image_info_value), 0);
info_data->value.list = safe_emalloc(length, sizeof(image_info_value), 1);
if (!info_data->value.list) {
EXIF_ERRLOG_EALLOC
return;
}
} else {
info_value = &info_data->value;
}
@@ -1639,13 +1657,13 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
case TAG_FMT_SINGLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type single");
php_error_docref( NULL TSRMLS_CC, E_WARNING, "Found value of type single");
#endif
info_value->f = *(float *)value;
case TAG_FMT_DOUBLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type double");
php_error_docref( NULL TSRMLS_CC, E_WARNING, "Found value of type double");
#endif
info_value->d = *(double *)value;
break;
@@ -1675,6 +1693,10 @@ static void exif_iif_add_int(image_info_type *image_info, int section_index, cha
image_info_data *list;
list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data));
if (!list) {
EXIF_ERRLOG_EALLOC
return;
}
image_info->info_list[section_index].list = list;
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
@@ -1682,6 +1704,10 @@ static void exif_iif_add_int(image_info_type *image_info, int section_index, cha
info_data->format = TAG_FMT_SLONG;
info_data->length = 1;
info_data->name = estrdup(name);
if (!info_data->name) {
EXIF_ERRLOG_EALLOC
return;
}
info_data->value.i = value;
image_info->sections_found |= 1<<section_index;
image_info->info_list[section_index].count++;
@@ -1698,16 +1724,24 @@ static void exif_iif_add_str(image_info_type *image_info, int section_index, cha
if (value) {
list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data));
if (!list) {
EXIF_ERRLOG_EALLOC
return;
}
image_info->info_list[section_index].list = list;
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
info_data->tag = TAG_NONE;
info_data->format = TAG_FMT_STRING;
info_data->length = 1;
info_data->name = estrdup(name);
if (PG(magic_quotes_runtime)) {
info_data->value.s = php_addslashes(value, strlen(value), NULL, 0 TSRMLS_CC);
} else {
info_data->value.s = estrdup(value);
if (!info_data->name) {
EXIF_ERRLOG_EALLOC
return;
}
info_data->value.s = estrdup(value);
if (!info_data->value.s) {
EXIF_ERRLOG_EALLOC
return;
}
image_info->sections_found |= 1<<section_index;
image_info->info_list[section_index].count++;
@@ -1743,23 +1777,27 @@ static void exif_iif_add_buffer(image_info_type *image_info, int section_index,
if (value) {
list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data));
if (!list) {
EXIF_ERRLOG_EALLOC
return;
}
image_info->info_list[section_index].list = list;
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
info_data->tag = TAG_NONE;
info_data->format = TAG_FMT_UNDEFINED;
info_data->length = length;
info_data->name = estrdup(name);
if (PG(magic_quotes_runtime)) {
#ifdef EXIF_DEBUG
exif_error_docref(NULL TSRMLS_CC, image_info, E_NOTICE, "Adding %s as buffer%s", name, exif_char_dump(value, length, 0));
#endif
info_data->value.s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
info_data->length = length;
} else {
info_data->value.s = safe_emalloc(length, 1, 1);
memcpy(info_data->value.s, value, length);
info_data->value.s[length] = 0;
if (!info_data->name) {
EXIF_ERRLOG_EALLOC
return;
}
info_data->value.s = safe_emalloc(length, 1, 1);
if (!info_data->value.s) {
EXIF_ERRLOG_EALLOC
return;
}
memcpy(info_data->value.s, value, length);
info_data->value.s[length] = 0;
image_info->sections_found |= 1<<section_index;
image_info->info_list[section_index].count++;
}
@@ -1828,7 +1866,7 @@ static void add_assoc_image_info(pval *value, int sub_array, image_info_type *im
pval *tmpi, *array = NULL;
#ifdef EXIF_DEBUG
/* php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Adding %d infos from section %s", image_info->info_list[section_index].count, exif_get_sectionname(section_index));*/
/* php_error_docref( NULL TSRMLS_CC, E_NOTICE, "Adding %d infos from section %s", image_info->info_list[section_index].count, exif_get_sectionname(section_index));*/
#endif
if (image_info->info_list[section_index].count) {
if (sub_array) {
@@ -1850,7 +1888,7 @@ static void add_assoc_image_info(pval *value, int sub_array, image_info_type *im
name = uname;
}
#ifdef EXIF_DEBUG
/* php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Adding infos: tag(0x%04X,%12s,L=0x%04X): %s", info_tag, exif_get_tagname(info_tag, buffer, -12, exif_get_tag_table(section_index) TSRMLS_CC), info_data->length, info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:"<no data>"):exif_get_tagformat(info_data->format));*/
/* php_error_docref( NULL TSRMLS_CC, E_NOTICE, "Adding infos: tag(0x%04X,%12s,L=0x%04X): %s", info_tag, exif_get_tagname(info_tag, buffer, -12, exif_get_tag_table(section_index) TSRMLS_CC), info_data->length, info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:"<no data>"):exif_get_tagformat(info_data->format));*/
#endif
if (info_data->length==0) {
add_assoc_null(tmpi, name);
@@ -2120,12 +2158,12 @@ static void exif_process_CME (image_info_type *image_info, char *value, size_t l
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined JPEG2000 comment encoding");
php_error_docref( NULL TSRMLS_CC, E_NOTICE, "Undefined JPEG2000 comment encoding");
break;
}
} else {
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL);
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "JPEG2000 comment section to small");
php_error_docref( NULL TSRMLS_CC, E_NOTICE, "JPEG2000 comment section to small");
}
}
#endif
@@ -2252,6 +2290,10 @@ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel
byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length;
value_ptr = emalloc(max(byte_count, 4));
if (!value_ptr) {
EXIF_ERRLOG_EALLOC
return NULL;
}
memset(value_ptr, 0, 4);
if (!info_data->length) {
return value_ptr;
@@ -2358,6 +2400,13 @@ static void exif_thumbnail_build(image_info_type *ImageInfo TSRMLS_DC) {
}
new_move = new_size;
new_data = erealloc(ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size+new_size);
if (!new_data) {
EXIF_ERRLOG_EALLOC
efree(ImageInfo->Thumbnail.data);
ImageInfo->Thumbnail.data = NULL;
ImageInfo->Thumbnail.size = 0;
return;
}
ImageInfo->Thumbnail.data = new_data;
memmove(ImageInfo->Thumbnail.data + new_move, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
ImageInfo->Thumbnail.size += new_size;
@@ -2386,6 +2435,13 @@ static void exif_thumbnail_build(image_info_type *ImageInfo TSRMLS_DC) {
php_ifd_set16u(new_data + 2, info_data->format, ImageInfo->motorola_intel);
php_ifd_set32u(new_data + 4, info_data->length, ImageInfo->motorola_intel);
value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel TSRMLS_CC);
if (!value_ptr) {
EXIF_ERRLOG_EALLOC
efree(ImageInfo->Thumbnail.data);
ImageInfo->Thumbnail.data = NULL;
ImageInfo->Thumbnail.size = 0;
return;
}
if (byte_count <= 4) {
memmove(new_data+8, value_ptr, 4);
} else {
@@ -2433,6 +2489,9 @@ static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, siz
return;
}
ImageInfo->Thumbnail.data = estrndup(offset + ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
if (!ImageInfo->Thumbnail.data) {
EXIF_ERRLOG_EALLOC
}
exif_thumbnail_build(ImageInfo TSRMLS_CC);
}
/* }}} */
@@ -2447,6 +2506,10 @@ static int exif_process_undefined(char **result, char *value, size_t byte_count
*/
if (byte_count) {
(*result) = estrndup(value, byte_count); /* NULL @ byte_count!!! */
if (!*result) {
EXIF_ERRLOG_EALLOC
return 0;
}
return byte_count+1;
}
return 0;
@@ -2487,6 +2550,10 @@ static int exif_process_string(char **result, char *value, size_t byte_count TSR
return exif_process_undefined(result, value, byte_count TSRMLS_CC);
}
(*result) = estrndup("", 1); /* force empty string */
if (!*result) {
EXIF_ERRLOG_EALLOC
return 0;
}
return byte_count+1;
}
/* }}} */
@@ -2498,7 +2565,6 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
int a;
#if EXIF_USE_MBSTRING
char *decode;
size_t len;;
#endif
@@ -2510,23 +2576,11 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
szValuePtr = szValuePtr+8;
ByteCount -= 8;
#if EXIF_USE_MBSTRING
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
* since we have no encoding support for the BOM yet we skip that.
*/
if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
decode = "UCS-2BE";
szValuePtr = szValuePtr+2;
ByteCount -= 2;
} else if (!memcmp(szValuePtr, "\xFF\xFE", 2)) {
decode = "UCS-2LE";
szValuePtr = szValuePtr+2;
ByteCount -= 2;
} else if (ImageInfo->motorola_intel) {
decode = ImageInfo->decode_unicode_be;
if (ImageInfo->motorola_intel) {
*pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode, ImageInfo->decode_unicode_be, &len TSRMLS_CC);
} else {
decode = ImageInfo->decode_unicode_le;
*pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode, ImageInfo->decode_unicode_le, &len TSRMLS_CC);
}
*pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode, decode, &len TSRMLS_CC);
return len;
#else
return exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
@@ -2728,6 +2782,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
if (byte_count>sizeof(cbuf)) {
/* mark as outside range and get buffer */
value_ptr = emalloc(byte_count);
if (!value_ptr) {
EXIF_ERRLOG_EALLOC
return FALSE;
}
outside = value_ptr;
} else {
/*
@@ -2813,7 +2871,12 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
/* When there are any characters after the first NUL */
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
ImageInfo->Copyright = safe_emalloc(strlen(value_ptr)+3, 1, strlen(value_ptr+length+1));
if (!ImageInfo->Copyright) {
EXIF_ERRLOG_EALLOC
} else {
sprintf(ImageInfo->Copyright, "%s, %s", value_ptr, value_ptr+length+1);
}
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
/* but we are not supposed to change this */
/* keep in mind that image_info does not store editor value */
@@ -2833,10 +2896,14 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
case TAG_XP_KEYWORDS:
case TAG_XP_SUBJECT:
tmp_xp = (xp_field_type*)erealloc(ImageInfo->xp_fields.list, sizeof(xp_field_type)*(ImageInfo->xp_fields.count+1));
ImageInfo->sections_found |= FOUND_WINXP;
ImageInfo->xp_fields.list = tmp_xp;
ImageInfo->xp_fields.count++;
exif_process_unicode(ImageInfo, &(ImageInfo->xp_fields.list[ImageInfo->xp_fields.count-1]), tag, value_ptr, byte_count TSRMLS_CC);
if (!tmp_xp) {
EXIF_ERRLOG_EALLOC
} else {
ImageInfo->sections_found |= FOUND_WINXP;
ImageInfo->xp_fields.list = tmp_xp;
ImageInfo->xp_fields.count++;
exif_process_unicode(ImageInfo, &(ImageInfo->xp_fields.list[ImageInfo->xp_fields.count-1]), tag, value_ptr, byte_count TSRMLS_CC);
}
break;
case TAG_FNUMBER:
@@ -3169,7 +3236,10 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
return FALSE;
}
sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL);
if ((sn=exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL))==-1) {
EXIF_ERRLOG_EALLOC
return FALSE;
}
Data = ImageInfo->file.list[sn].data;
/* Store first two pre-read bytes. */
@@ -3192,7 +3262,10 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
/* Determine how much file is left. */
fpos = php_stream_tell(ImageInfo->infile);
size = ImageInfo->FileSize - fpos;
sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, NULL);
if ((sn=exif_file_sections_add(ImageInfo, M_PSEUDO, size, NULL))==-1) {
EXIF_ERRLOG_EALLOC
return FALSE;
}
Data = ImageInfo->file.list[sn].data;
got = php_stream_read(ImageInfo->infile, Data, size);
if (got != size) {
@@ -3357,7 +3430,10 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
tag_table_type tag_table = exif_get_tag_table(section_index);
if (ImageInfo->FileSize >= dir_offset+2) {
sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL);
if ((sn=exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL))==-1) {
EXIF_ERRLOG_EALLOC
return FALSE;
}
#ifdef EXIF_DEBUG
exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2);
#endif
@@ -3511,12 +3587,16 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
#endif
if (!ImageInfo->Thumbnail.data) {
ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
if (fgot < ImageInfo->Thumbnail.size) {
EXIF_ERRLOG_THUMBEOF
if (!ImageInfo->Thumbnail.data) {
EXIF_ERRLOG_EALLOC
} else {
php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
if (fgot < ImageInfo->Thumbnail.size) {
EXIF_ERRLOG_THUMBEOF
}
exif_thumbnail_build(ImageInfo TSRMLS_CC);
}
exif_thumbnail_build(ImageInfo TSRMLS_CC);
}
}
}
@@ -3544,12 +3624,16 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
#endif
if (!ImageInfo->Thumbnail.data && ImageInfo->Thumbnail.offset && ImageInfo->Thumbnail.size && ImageInfo->read_thumbnail) {
ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
if (fgot < ImageInfo->Thumbnail.size) {
EXIF_ERRLOG_THUMBEOF
if (!ImageInfo->Thumbnail.data) {
EXIF_ERRLOG_EALLOC
} else {
php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
if (fgot < ImageInfo->Thumbnail.size) {
EXIF_ERRLOG_THUMBEOF
}
exif_thumbnail_build(ImageInfo TSRMLS_CC);
}
exif_thumbnail_build(ImageInfo TSRMLS_CC);
}
#ifdef EXIF_DEBUG
exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read next IFD (THUMBNAIL) done");
@@ -3692,12 +3776,12 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t
ImageInfo->read_all = read_all;
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
ImageInfo->encode_unicode = safe_estrdup(EXIF_G(encode_unicode));
ImageInfo->decode_unicode_be = safe_estrdup(EXIF_G(decode_unicode_be));
ImageInfo->decode_unicode_le = safe_estrdup(EXIF_G(decode_unicode_le));
ImageInfo->encode_jis = safe_estrdup(EXIF_G(encode_jis));
ImageInfo->decode_jis_be = safe_estrdup(EXIF_G(decode_jis_be));
ImageInfo->decode_jis_le = safe_estrdup(EXIF_G(decode_jis_le));
ImageInfo->encode_unicode = estrdup(EXIF_G(encode_unicode));
ImageInfo->decode_unicode_be = estrdup(EXIF_G(decode_unicode_be));
ImageInfo->decode_unicode_le = estrdup(EXIF_G(decode_unicode_le));
ImageInfo->encode_jis = estrdup(EXIF_G(encode_jis));
ImageInfo->decode_jis_be = estrdup(EXIF_G(decode_jis_be));
ImageInfo->decode_jis_le = estrdup(EXIF_G(decode_jis_le));
if (php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) {
if (VCWD_STAT(FileName, &st) >= 0) {
@@ -3742,6 +3826,10 @@ PHP_FUNCTION(exif_read_data)
if(ac >= 2) {
convert_to_string_ex(p_sections_needed);
sections_str = safe_emalloc(strlen(Z_STRVAL_PP(p_sections_needed)), 1, 3);
if (!sections_str) {
EXIF_ERRLOG_EALLOC
RETURN_FALSE;
}
sprintf(sections_str, ",%s,", Z_STRVAL_PP(p_sections_needed));
/* sections_str DOES start with , and SPACES are NOT allowed in names */
s = sections_str;
@@ -3791,17 +3879,15 @@ PHP_FUNCTION(exif_read_data)
exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "sections found: %s", sections_str[0] ? sections_str : "None");
#endif
ImageInfo.sections_found |= FOUND_COMPUTED|FOUND_FILE;/* do not inform about in debug*/
ImageInfo.sections_found |= FOUND_COMPUTED;/* do not inform about in debug*/
if (ret==FALSE || (sections_needed && !(sections_needed&ImageInfo.sections_found))) {
if (ret==FALSE || (sections_needed && !(sections_needed&ImageInfo.sections_found)) || array_init(return_value) == FAILURE) {
/* array_init must be checked at last! otherwise the array must be freed if a later test fails. */
exif_discard_imageinfo(&ImageInfo);
EFREE_IF(sections_str);
RETURN_FALSE;
}
array_init(return_value);
#ifdef EXIF_DEBUG
exif_error_docref(NULL TSRMLS_CC, &ImageInfo, E_NOTICE, "generate section FILE");
#endif
+2 -2
View File
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /D "LIBZEND_EXPORTS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x406 /d "NDEBUG"
@@ -71,7 +71,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /D "LIBZEND_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x406 /d "NDEBUG"
+9 -13
View File
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Frank M. Kromann <frank@kromann.info> |
| Author: Frank M. Kromann <frank@frontbase.com> |
+----------------------------------------------------------------------+
*/
@@ -358,9 +358,9 @@ static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link)
/* {{{ PHP_INI
*/
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN ("fbsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allowPersistent, zend_fbsql_globals, fbsql_globals)
STD_PHP_INI_BOOLEAN ("fbsql.generate_warnings", "0", PHP_INI_SYSTEM, OnUpdateBool, generateWarnings, zend_fbsql_globals, fbsql_globals)
STD_PHP_INI_BOOLEAN ("fbsql.autocommit", "1", PHP_INI_SYSTEM, OnUpdateBool, autoCommit, zend_fbsql_globals, fbsql_globals)
STD_PHP_INI_BOOLEAN ("fbsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allowPersistent, zend_fbsql_globals, fbsql_globals)
STD_PHP_INI_BOOLEAN ("fbsql.generate_warnings", "0", PHP_INI_SYSTEM, OnUpdateInt, generateWarnings, zend_fbsql_globals, fbsql_globals)
STD_PHP_INI_BOOLEAN ("fbsql.autocommit", "1", PHP_INI_SYSTEM, OnUpdateInt, autoCommit, zend_fbsql_globals, fbsql_globals)
STD_PHP_INI_ENTRY_EX ("fbsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, maxPersistent, zend_fbsql_globals, fbsql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX ("fbsql.max_links", "128", PHP_INI_SYSTEM, OnUpdateInt, maxLinks, zend_fbsql_globals, fbsql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX ("fbsql.max_connections", "128", PHP_INI_SYSTEM, OnUpdateInt, maxConnections, zend_fbsql_globals, fbsql_globals, display_link_numbers)
@@ -2706,7 +2706,7 @@ PHP_FUNCTION(fbsql_num_fields)
Fetch a row of data. Returns an indexed array */
PHP_FUNCTION(fbsql_fetch_row)
{
php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_NUM, 1);
php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_NUM);
}
/* }}} */
@@ -2714,7 +2714,7 @@ PHP_FUNCTION(fbsql_fetch_row)
Detch a row of data. Returns an assoc array */
PHP_FUNCTION(fbsql_fetch_assoc)
{
php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC, 1);
php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC);
}
/* }}} */
@@ -2722,7 +2722,7 @@ PHP_FUNCTION(fbsql_fetch_assoc)
Fetch a row of data. Returns an object */
PHP_FUNCTION(fbsql_fetch_object)
{
php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC, 2);
php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC);
if (Z_TYPE_P(return_value)==IS_ARRAY) {
object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
}
@@ -2733,7 +2733,7 @@ PHP_FUNCTION(fbsql_fetch_object)
Fetches a result row as an array (associative, numeric or both)*/
PHP_FUNCTION(fbsql_fetch_array)
{
php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_BOTH, 2);
php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_BOTH);
}
/* }}} */
@@ -2781,7 +2781,7 @@ static void _parse_list(zval** return_value, FBCPList* list)
}
}
static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type, int expected_args)
static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
{
PHPFBResult* result = NULL;
@@ -2790,10 +2790,6 @@ static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
int i;
void **row;
if (ZEND_NUM_ARGS() > expected_args) {
WRONG_PARAM_COUNT;
}
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
+2 -2
View File
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Frank M. Kromann <frank@kromann.info> |
| Author: Frank M. Kromann <frank@frontbase.com> |
+----------------------------------------------------------------------+
*/
@@ -101,7 +101,7 @@ PHP_FUNCTION(fbsql_warnings);
PHP_FUNCTION(fbsql_get_autostart_info);
/* PHP_FUNCTION(fbsql_set_autostart_info); */
static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type, int expected_args);
static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type);
static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);
ZEND_BEGIN_MODULE_GLOBALS(fbsql)
+6 -6
View File
@@ -8,16 +8,16 @@ PHP_ARG_WITH(fdftk, for FDF support,
if test "$PHP_FDFTK" != "no"; then
case $host_os in
aix*[)]
aix*)
libtype=aix
;;
solaris*[)]
solaris* )
libtype=solaris
;;
linux*[)]
linux*)
libtype=linux
;;
*[)]
*)
AC_MSG_ERROR([The fdf toolkit is not available for $host_os.])
;;
esac
@@ -65,9 +65,9 @@ if test "$PHP_FDFTK" != "no"; then
AC_MSG_ERROR(no usable fdf library found)
fi
PHP_ADD_LIBRARY_WITH_PATH($FDFLIBRARY, $FDFTK_LIB_DIR, FDF_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH($FDFLIBRARY, $FDFTK_LIB_DIR, FDFTK_SHARED_LIBADD)
PHP_NEW_EXTENSION(fdf, fdf.c, $ext_shared)
PHP_SUBST(FDF_SHARED_LIBADD)
PHP_SUBST(FDFTK_SHARED_LIBADD)
AC_DEFINE(HAVE_FDFLIB,1,[ ])
fi
+68 -88
View File
@@ -13,7 +13,7 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
| Hartmut Holzgraefe <hholzgra@php.net> |
| Hartmut Holzgraefe <hartmut@six.de> |
+----------------------------------------------------------------------+
*/
@@ -39,10 +39,6 @@
#include "php_variables.h"
#include "php_fdf.h"
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
#endif
static int le_fdf;
SAPI_POST_HANDLER_FUNC(fdf_post_handler);
@@ -129,17 +125,12 @@ static sapi_post_entry php_fdf_post_entry = {
fdf_post_handler
};
static void php_fdf_init_globals(zend_fdf_globals *fdf_globals)
{
memset(fdf_globals, 0, sizeof(*fdf_globals));
}
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(fdf)
{
ZEND_INIT_MODULE_GLOBALS(fdf, php_fdf_init_globals, NULL);
FDFErc err;
le_fdf = zend_register_list_destructors_ex(phpi_FDFClose, NULL, "fdf", module_number);
/* add handler for Acrobat FDF form post requests */
@@ -181,15 +172,15 @@ PHP_MINIT_FUNCTION(fdf)
#ifdef PHP_WIN32
return SUCCESS;
#else
return (FDFInitialize() == FDFErcOK) ? SUCCESS : FAILURE;
#endif
if((err = FDFInitialize()) == FDFErcOK) return SUCCESS;
return FAILURE;
}
/* }}} */
/* {{{ RINIT */
PHP_RINIT_FUNCTION(fdf)
{
PHP_RINIT_FUNCTION(fdf) {
FDF_G(error) = FDFErcOK;
return SUCCESS;
}
/* }}} */
@@ -210,18 +201,20 @@ PHP_MINFO_FUNCTION(fdf)
*/
PHP_MSHUTDOWN_FUNCTION(fdf)
{
FDFErc err;
/* remove handler for Acrobat FDF form post requests */
sapi_unregister_post_entry(&php_fdf_post_entry);
#ifdef PHP_WIN32
return SUCCESS;
#else
return (FDFFinalize() == FDFErcOK) ? SUCCESS : FAILURE;
#endif
if((err = FDFFinalize()) == FDFErcOK) return SUCCESS;
return FAILURE;
}
/* }}} */
/* {{{ proto resource fdf_open(string filename)
/* {{{ proto int fdf_open(string filename)
Opens a new FDF document */
PHP_FUNCTION(fdf_open)
{
@@ -235,10 +228,6 @@ PHP_FUNCTION(fdf_open)
convert_to_string_ex(file);
if (php_check_open_basedir(Z_STRVAL_PP(file) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(file), "wb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
err = FDFOpen(Z_STRVAL_PP(file), 0, &fdf);
if(err != FDFErcOK || !fdf) {
@@ -250,7 +239,7 @@ PHP_FUNCTION(fdf_open)
}
/* }}} */
/* {{{ proto resource fdf_open_string(string fdf_data)
/* {{{ proto int fdf_open_string(string fdf_data)
Opens a new FDF document from string */
PHP_FUNCTION(fdf_open_string)
{
@@ -287,7 +276,7 @@ PHP_FUNCTION(fdf_open_string)
}
/* }}} */
/* {{{ proto resource fdf_create(void)
/* {{{ proto int fdf_create(void)
Creates a new FDF document */
PHP_FUNCTION(fdf_create)
{
@@ -369,7 +358,10 @@ PHP_FUNCTION(fdf_get_value)
}
#if HAVE_FDFTK_5
} else if((err == FDFErcValueIsArray) && (which == -1)) {
array_init(return_value);
if (array_init(return_value) == FAILURE) {
efree(buffer);
FDF_FAILURE(FDFErcInternalError);
}
which = 0;
do {
err = FDFGetNthValue(fdf, fieldname, which, buffer, size-2, &nr);
@@ -382,12 +374,13 @@ PHP_FUNCTION(fdf_get_value)
}
which++;
} while (err == FDFErcOK);
if(err == FDFErcNoValue) err = FDFErcOK;
efree(buffer);
buffer = NULL;
#endif
}
if ((err != FDFErcOK) && (err != FDFErcNoValue)) {
if(err != FDFErcOK) {
if(buffer) efree(buffer);
FDF_FAILURE(err);
}
@@ -525,11 +518,6 @@ PHP_FUNCTION(fdf_set_ap)
convert_to_string_ex(fieldname);
convert_to_long_ex(face);
convert_to_string_ex(filename);
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(filename), "wb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
convert_to_long_ex(pagenr);
switch(Z_LVAL_PP(face)) {
@@ -581,10 +569,6 @@ PHP_FUNCTION(fdf_get_ap) {
ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
if (php_check_open_basedir(filename TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(filename, "wb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
switch(face) {
case 1:
facenr = FDFNormalAP;
@@ -794,9 +778,6 @@ PHP_FUNCTION(fdf_save)
ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
if(filename) {
if (php_check_open_basedir(filename TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(filename, "wb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
err = FDFSave(fdf, filename);
} else {
FILE *fp;
@@ -911,10 +892,6 @@ PHP_FUNCTION(fdf_add_template)
convert_to_string_ex(template);
convert_to_long_ex(rename);
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(filename), "wb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
filespec.FS = NULL;
filespec.F = Z_STRVAL_PP(filename);
filespec.Mac = NULL;
@@ -924,7 +901,7 @@ PHP_FUNCTION(fdf_add_template)
filespec.ID[1] = NULL;
filespec.bVolatile = false;
err = FDFAddTemplate(fdf, (unsigned short)(Z_LVAL_PP(newpage)), &filespec, Z_STRVAL_PP(template), (unsigned short)(Z_LVAL_PP(rename)));
err = FDFAddTemplate(fdf, Z_LVAL_PP(newpage), &filespec, Z_STRVAL_PP(template), Z_LVAL_PP(rename));
if(err != FDFErcOK) {
FDF_FAILURE(err);
}
@@ -1017,7 +994,7 @@ PHP_FUNCTION(fdf_set_opt)
}
/* }}} */
/* {{{ proto mixed fdf_get_opt(resource fdfdof, string fieldname [, int element])
/* {{{ proto mixed fdf_get_option(resource fdfdof, string fieldname [, int element])
Gets a value from the opt array of a field */
PHP_FUNCTION(fdf_get_opt) {
zval *r_fdf;
@@ -1063,7 +1040,9 @@ PHP_FUNCTION(fdf_get_opt) {
if(err != FDFErcOK) {
FDF_FAILURE(err);
}
array_init(return_value);
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
add_next_index_stringl(return_value, buf1, strlen(buf1), 1);
add_next_index_stringl(return_value, buf2, strlen(buf2), 1);
efree(buf1);
@@ -1125,7 +1104,7 @@ PHP_FUNCTION(fdf_set_javascript_action)
}
/* }}} */
/* {{{ proto bool fdf_set_encoding(resource fdf_document, string encoding)
/* {{{ proto bool fdf_set_encoding(int fdf_document, string encoding)
Sets FDF encoding (either "Shift-JIS" or "Unicode") */
PHP_FUNCTION(fdf_set_encoding)
{
@@ -1220,14 +1199,14 @@ SAPI_POST_HANDLER_FUNC(fdf_post_handler)
}
/* }}} */
/* {{{ proto int fdf_errno(void)
/* {{{ int fdf_errno(void)
Gets error code for last operation */
PHP_FUNCTION(fdf_errno) {
RETURN_LONG((long)FDF_G(error));
}
/* }}} */
/* {{{ proto string fdf_error([int errno])
/* {{{ string fdf_error([int errno])
Gets error description for error code */
PHP_FUNCTION(fdf_error) {
FDFErc err;
@@ -1494,7 +1473,9 @@ PHP_FUNCTION(fdf_get_attachment) {
FDF_FAILURE(err);
}
array_init(return_value);
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
add_assoc_string(return_value, "path", pathbuf, 1);
add_assoc_string(return_value, "type", mimebuf, 1);
stat(pathbuf, &statBuf);
@@ -1504,54 +1485,53 @@ PHP_FUNCTION(fdf_get_attachment) {
#endif
/* {{{ enum_values_callback */
static ASBool enum_values_callback(char *name, char *value, void *userdata)
{
zval *retval_ptr, *z_name, *z_value, **args[3];
long retval = 0;
int numargs = 2;
TSRMLS_FETCH();
static ASBool enum_values_callback(char *name, char *value, void *userdata) {
zval *retval_ptr, *z_name, *z_value, **args[3];
long retval = 0;
int numargs = 2;
TSRMLS_FETCH();
MAKE_STD_ZVAL(z_name);
ZVAL_STRING(z_name, name, 1);
args[0] = &z_name;
MAKE_STD_ZVAL(z_name);
ZVAL_STRING(z_name, name, 1);
args[0] = &z_name;
if (*value) { /* simple value */
MAKE_STD_ZVAL(z_value);
ZVAL_STRING(z_value, value, 1);
args[1] = &z_value;
} else { /* empty value *might* be an array */
/* TODO: do it like fdf_get_value (or re-implement yourself?) */
}
if (userdata) {
args[2] = (zval **) userdata;
numargs++;
}
if(*value) { /* simple value */
MAKE_STD_ZVAL(z_value);
ZVAL_STRING(z_value, value, 1);
args[1] = &z_value;
} else { /* empty value *might* be an array */
/* todo do it like fdf_get_value (or re-implement yourself?) */
}
if(userdata) {
args[2] = (zval **)userdata;
numargs++;
}
if (call_user_function_ex(EG(function_table),
if (call_user_function_ex(EG(function_table),
NULL,
FDF_G(enum_callback),
&retval_ptr,
numargs, args,
0, NULL TSRMLS_CC) == SUCCESS
&& retval_ptr) {
convert_to_long_ex(&retval_ptr);
retval = Z_LVAL_P(retval_ptr);
zval_ptr_dtor(&retval_ptr);
} else {
0, NULL TSRMLS_CC)==SUCCESS
&& retval_ptr) {
convert_to_long_ex(&retval_ptr);
retval = Z_LVAL_P(retval_ptr);
zval_ptr_dtor(&retval_ptr);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "callback failed");
}
}
zval_ptr_dtor(&z_name);
zval_ptr_dtor(&z_value);
zval_ptr_dtor(&z_name);
zval_ptr_dtor(&z_value);
return (ASBool)retval;
}
return retval;
}
/* }}} */
/* {{{ proto bool fdf_enum_values(resource fdfdoc, callback function [, mixed userdata])
Call a user defined function for each document value */
/* {{{ proto bool fdf_enum_values(resource fdfdoc, mixed callback [, mixed userdata])
*/
PHP_FUNCTION(fdf_enum_values) {
zval *r_fdf;
zval *callback;
@@ -1599,8 +1579,8 @@ PHP_FUNCTION(fdf_enum_values) {
}
/* }}} */
/* {{{ proto void fdf_header(void)
Set FDF specific HTTP headers */
/* {{{ proto fdf_header()
Set FDF specific HTTP headers */
PHP_FUNCTION(fdf_header) {
sapi_header_line ctr = {0};
+2 -2
View File
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FDFLIB=1 /D "HAVE_FDFTK_5" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FDFLIB=1 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x406 /d "NDEBUG"
@@ -72,7 +72,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FDFLIB=1 /D "HAVE_FDFTK_5" /FR /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FDFLIB=1 /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x406 /d "NDEBUG"
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Adobe Form Data Format functions
--SKIPIF--
<?php if (!extension_loaded("fdf")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
echo is_resource(fdf_create()) ? "OK" : "FAILURE";
?>
--EXPECT--
OK
-21
View File
@@ -1,21 +0,0 @@
--TEST--
FDF open/save and set/get values
--SKIPIF--
<?php if (!extension_loaded("fdf")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
$f1 = fdf_create();
fdf_set_value($f1, "foo", "bar");
fdf_set_value($f1, "bar", "foo");
$f2 = fdf_open_string(fdf_save_string($f1));
fdf_close($f1);
for ($field = fdf_next_field_name($f2); $field; $field = fdf_next_field_name($f2, $field)) {
echo "$field: ". fdf_get_value($f2, $field) . "\n";
}
fdf_close($f2);
?>
--EXPECT--
foo: bar
bar: foo
-17
View File
@@ -1,17 +0,0 @@
--TEST--
FDF read file
--SKIPIF--
<?php if (!extension_loaded("fdf")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
$fdf = fdf_open("ext/fdf/tests/simple.fdf");
for ($field = fdf_next_field_name($fdf); $field; $field = fdf_next_field_name($fdf, $field)) {
echo "$field: ". fdf_get_value($fdf, $field) . "\n";
}
fdf_close($fdf);
?>
--EXPECT--
foo: bar
bar: foo
-18
View File
@@ -1,18 +0,0 @@
%FDF-1.2
%âãÏÓ
1 0 obj
<<
/FDF << /Fields 2 0 R >>
>>
endobj
2 0 obj
[
<< /T (foo)/V (bar)>> << /T (bar)/V (foo)>>
]
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
+3 -3
View File
@@ -386,7 +386,7 @@ PHP_FUNCTION(filepro_fieldname)
}
php_error(E_WARNING,
"%s(): Unable to locate field number %ld.", get_active_function_name(TSRMLS_C),
"%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C),
Z_LVAL_P(fno));
RETVAL_FALSE;
@@ -426,7 +426,7 @@ PHP_FUNCTION(filepro_fieldtype)
}
}
php_error(E_WARNING,
"%s(): Unable to locate field number %ld.", get_active_function_name(TSRMLS_C),
"%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C),
Z_LVAL_P(fno));
RETVAL_FALSE;
}
@@ -465,7 +465,7 @@ PHP_FUNCTION(filepro_fieldwidth)
}
}
php_error(E_WARNING,
"%s(): Unable to locate field number %ld.", get_active_function_name(TSRMLS_C),
"%s(): Unable to locate field number %d.", get_active_function_name(TSRMLS_C),
Z_LVAL_P(fno));
RETVAL_FALSE;
}
+6 -7
View File
@@ -7,20 +7,19 @@ fribidi_log2vis
--FILE--
<?php
error_reporting (E_ALL ^ E_NOTICE);
/* According to Tal, this is not really even used anywhere.. */
// $a = fribidi_log2vis("THE dog 123 IS THE biggest", FRIBIDI_AUTO, FRIBIDI_CHARSET_CAP_RTL);
$a = fribidi_log2vis("THE dog 123 IS THE biggest", FRIBIDI_AUTO, FRIBIDI_CHARSET_CAP_RTL);
$b = fribidi_log2vis("áìä 198 foo áìä BAR 12", FRIBIDI_RTL, FRIBIDI_CHARSET_8859_8);
$c = fribidi_log2vis("Fri áéãé éààà bla 12% bla", FRIBIDI_AUTO, FRIBIDI_CHARSET_CP1255);
$d = array($b, $c);
$d = array($a, $b, $c);
var_dump($d);
?>
--EXPECT--
array(2) {
array(3) {
[0]=>
string(22) "BAR 12 äìá foo 198 äìá"
string(26) "biggest EHT SI dog 123 EHT"
[1]=>
string(22) "BAR 12 äìá foo 198 äìá"
[2]=>
string(25) "Fri àààé éãéá bla 12% bla"
}
+30 -30
View File
@@ -165,7 +165,7 @@ ftp_close(ftpbuf_t *ftp)
if (ftp->data)
data_close(ftp, ftp->data);
if (ftp->fd != -1) {
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
if (ftp->ssl_active) {
SSL_shutdown(ftp->ssl_handle);
}
@@ -188,11 +188,9 @@ ftp_gc(ftpbuf_t *ftp)
if (ftp->pwd) {
efree(ftp->pwd);
ftp->pwd = NULL;
}
if (ftp->syst) {
efree(ftp->syst);
ftp->syst = NULL;
}
}
/* }}} */
@@ -212,7 +210,6 @@ ftp_quit(ftpbuf_t *ftp)
if (ftp->pwd) {
efree(ftp->pwd);
ftp->pwd = NULL;
}
return 1;
@@ -224,13 +221,13 @@ ftp_quit(ftpbuf_t *ftp)
int
ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
{
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
SSL_CTX *ctx = NULL;
#endif
if (ftp == NULL)
return 0;
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
if (ftp->use_ssl && !ftp->ssl_active) {
if (!ftp_putcmd(ftp, "AUTH", "TLS"))
return 0;
@@ -392,7 +389,9 @@ ftp_pwd(ftpbuf_t *ftp)
return NULL;
if ((end = strrchr(++pwd, '"')) == NULL)
return NULL;
ftp->pwd = estrndup(pwd, end - pwd);
*end = 0;
ftp->pwd = estrdup(pwd);
*end = '"';
return ftp->pwd;
}
@@ -421,10 +420,9 @@ ftp_chdir(ftpbuf_t *ftp, const char *dir)
{
if (ftp == NULL)
return 0;
if (ftp->pwd) {
if (ftp->pwd)
efree(ftp->pwd);
ftp->pwd = NULL;
}
ftp->pwd = NULL;
if (!ftp_putcmd(ftp, "CWD", dir))
return 0;
@@ -443,10 +441,9 @@ ftp_cdup(ftpbuf_t *ftp)
if (ftp == NULL)
return 0;
if (ftp->pwd) {
if (ftp->pwd)
efree(ftp->pwd);
ftp->pwd = NULL;
}
ftp->pwd = NULL;
if (!ftp_putcmd(ftp, "CDUP", NULL))
return 0;
@@ -717,7 +714,8 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
if (type == FTPTYPE_ASCII && lastch == '\r')
php_stream_putc(outstream, '\r');
ftp->data = data = data_close(ftp, data);
data = data_close(ftp, data);
ftp->data = NULL;
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
goto bail;
@@ -725,7 +723,8 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
return 1;
bail:
ftp->data = data_close(ftp, data);
data_close(ftp, data);
ftp->data = NULL;
return 0;
}
/* }}} */
@@ -798,14 +797,14 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
if (size && my_send(ftp, data->fd, data->buf, size) != size)
goto bail;
ftp->data = data = data_close(ftp, data);
data = data_close(ftp, data);
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250))
goto bail;
return 1;
bail:
ftp->data = data_close(ftp, data);
data_close(ftp, data);
return 0;
}
/* }}} */
@@ -1089,7 +1088,7 @@ my_send(ftpbuf_t *ftp, int s, void *buf, size_t len)
return -1;
}
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
sent = SSL_write(ftp->ssl_handle, buf, size);
} else
@@ -1133,7 +1132,7 @@ my_recv(ftpbuf_t *ftp, int s, void *buf, size_t len)
return -1;
}
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
nr_bytes = SSL_read(ftp->ssl_handle, buf, len);
} else
@@ -1354,7 +1353,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp)
php_sockaddr_storage addr;
socklen_t size;
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
SSL_CTX *ctx;
TSRMLS_FETCH();
#endif
@@ -1373,7 +1372,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp)
}
data_accepted:
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
/* now enable ssl if we need to */
if (ftp->use_ssl && ftp->use_ssl_for_data) {
@@ -1420,7 +1419,7 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
if (data == NULL)
return NULL;
if (data->listener != -1) {
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
if (data->ssl_active) {
SSL_shutdown(data->ssl_handle);
data->ssl_active = 0;
@@ -1429,7 +1428,7 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
closesocket(data->listener);
}
if (data->fd != -1) {
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
if (data->ssl_active) {
SSL_shutdown(data->ssl_handle);
data->ssl_active = 0;
@@ -1498,7 +1497,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
}
}
ftp->data = data = data_close(ftp, data);
data = data_close(ftp, data);
if (ferror(tmpfp))
goto bail;
@@ -1537,7 +1536,8 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
return ret;
bail:
ftp->data = data_close(ftp, data);
if (data)
data_close(ftp, data);
fclose(tmpfp);
if (ret)
efree(ret);
@@ -1593,7 +1593,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
return (ftp_nb_continue_read(ftp));
bail:
ftp->data = data_close(ftp, data);
data_close(ftp, data);
return PHP_FTP_FAILED;
}
/* }}} */
@@ -1646,7 +1646,7 @@ ftp_nb_continue_read(ftpbuf_t *ftp)
if (type == FTPTYPE_ASCII && lastch == '\r')
php_stream_putc(ftp->stream, '\r');
ftp->data = data = data_close(ftp, data);
data = data_close(ftp, data);
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
goto bail;
@@ -1656,7 +1656,7 @@ ftp_nb_continue_read(ftpbuf_t *ftp)
return PHP_FTP_FINISHED;
bail:
ftp->nb = 0;
ftp->data = data_close(ftp, data);
data_close(ftp, data);
return PHP_FTP_FAILED;
}
/* }}} */
@@ -1708,7 +1708,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
return (ftp_nb_continue_write(ftp));
bail:
ftp->data = data_close(ftp, data);
data_close(ftp, data);
return PHP_FTP_FAILED;
}
@@ -1763,7 +1763,7 @@ ftp_nb_continue_write(ftpbuf_t *ftp)
ftp->nb = 0;
return PHP_FTP_FINISHED;
bail:
ftp->data = data_close(ftp, ftp->data);
data_close(ftp, ftp->data);
ftp->nb = 0;
return PHP_FTP_FAILED;
}
+2 -2
View File
@@ -49,7 +49,7 @@ typedef struct databuf
int fd; /* data connection */
ftptype_t type; /* transfer type */
char buf[FTP_BUFSIZE]; /* data buffer */
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
SSL *ssl_handle; /* ssl handle */
int ssl_active; /* flag if ssl is active or not */
#endif
@@ -78,7 +78,7 @@ typedef struct ftpbuf
int lastch; /* last char of previous call */
int direction; /* recv = 0 / send = 1 */
int closestream;/* close or not close stream */
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
int use_ssl; /* enable(1) or disable(0) ssl */
int use_ssl_for_data; /* en/disable ssl for the dataconnection */
int old_ssl; /* old mode = forced data encryption */
+15 -55
View File
@@ -48,7 +48,7 @@ static int le_ftpbuf;
function_entry php_ftp_functions[] = {
PHP_FE(ftp_connect, NULL)
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
PHP_FE(ftp_ssl_connect, NULL)
#endif
PHP_FE(ftp_login, NULL)
@@ -139,7 +139,7 @@ PHP_MINFO_FUNCTION(ftp)
}
/* {{{ proto resource ftp_connect(string host [, int port [, int timeout]])
/* {{{ proto resource ftp_connect(string host [, int port [, int timeout)]])
Opens a FTP stream */
PHP_FUNCTION(ftp_connect)
{
@@ -166,7 +166,7 @@ PHP_FUNCTION(ftp_connect)
/* autoseek for resuming */
ftp->autoseek = FTP_DEFAULT_AUTOSEEK;
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
/* disable ssl */
ftp->use_ssl = 0;
#endif
@@ -175,8 +175,8 @@ PHP_FUNCTION(ftp_connect)
}
/* }}} */
#ifdef HAVE_OPENSSL_EXT
/* {{{ proto resource ftp_ssl_connect(string host [, int port [, int timeout]])
#if HAVE_OPENSSL_EXT
/* {{{ proto resource ftp_ssl_connect(string host [, int port [, int timeout)]])
Opens a FTP-SSL stream */
PHP_FUNCTION(ftp_ssl_connect)
{
@@ -598,20 +598,10 @@ PHP_FUNCTION(ftp_get)
resumepos = 0;
}
if (php_check_open_basedir(local TSRMLS_CC)) {
RETURN_FALSE;
}
if (ftp->autoseek && resumepos) {
if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", NULL);
outstream = php_stream_fopen(local, "rb+", NULL);
if (outstream == NULL) {
if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "wt" : "wb", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "wt" : "wb", NULL);
outstream = php_stream_fopen(local, "wb", NULL);
}
if (outstream != NULL) {
/* if autoresume is wanted seek to end */
@@ -623,10 +613,7 @@ PHP_FUNCTION(ftp_get)
}
}
} else {
if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "wt" : "wb", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "wt" : "wb", NULL);
outstream = php_stream_fopen(local, "wb", NULL);
}
if (outstream == NULL) {
@@ -669,20 +656,10 @@ PHP_FUNCTION(ftp_nb_get)
resumepos = 0;
}
if (php_check_open_basedir(local TSRMLS_CC)) {
RETURN_FALSE;
}
if (ftp->autoseek && resumepos) {
if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", NULL);
outstream = php_stream_fopen(local, "rb+", NULL);
if (outstream == NULL) {
if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "wt" : "wb", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "wt" : "wb", NULL);
outstream = php_stream_fopen(local, "wb", NULL);
}
if (outstream != NULL) {
/* if autoresume is wanted seek to end */
@@ -694,10 +671,7 @@ PHP_FUNCTION(ftp_nb_get)
}
}
} else {
if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "wt" : "wb", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "wt" : "wb", NULL);
outstream = php_stream_fopen(local, "wb", NULL);
}
if (outstream == NULL) {
@@ -878,14 +852,7 @@ PHP_FUNCTION(ftp_put)
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode);
if (php_check_open_basedir(local TSRMLS_CC)) {
RETURN_FALSE;
}
if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "rt" : "rb", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
instream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "rt" : "rb", NULL);
instream = php_stream_fopen(local, "rb", NULL);
if (instream == NULL) {
RETURN_FALSE;
@@ -940,14 +907,7 @@ PHP_FUNCTION(ftp_nb_put)
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
XTYPE(xtype, mode);
if (php_check_open_basedir(local TSRMLS_CC)) {
RETURN_FALSE;
}
if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "rt" : "rb", CHECKUID_CHECK_MODE_PARAM))) {
RETURN_FALSE;
}
instream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "rt" : "rb", NULL);
instream = php_stream_fopen(local, "rb", NULL);
if (instream == NULL) {
RETURN_FALSE;
@@ -1161,7 +1121,7 @@ PHP_FUNCTION(ftp_set_option)
RETURN_TRUE;
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%ld'", option);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%d'", option);
RETURN_FALSE;
break;
}
@@ -1190,7 +1150,7 @@ PHP_FUNCTION(ftp_get_option)
RETURN_BOOL(ftp->autoseek);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%ld'", option);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%d'", option);
RETURN_FALSE;
break;
}
+1 -1
View File
@@ -35,7 +35,7 @@ PHP_MINIT_FUNCTION(ftp);
PHP_MINFO_FUNCTION(ftp);
PHP_FUNCTION(ftp_connect);
#ifdef HAVE_OPENSSL_EXT
#if HAVE_OPENSSL_EXT
PHP_FUNCTION(ftp_ssl_connect);
#endif
PHP_FUNCTION(ftp_login);
+2 -3
View File
@@ -41,7 +41,7 @@ PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in GD,
[ --enable-gd-native-ttf GD: Enable TrueType string function.], no, no)
PHP_ARG_ENABLE(gd-jis-conv, whether to enable JIS-mapped Japanese font support in GD,
[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support.], no, no)
[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font suppert.], no, no)
dnl
dnl Checks for the configure options
@@ -301,8 +301,7 @@ dnl These are always available with bundled library
AC_DEFINE(HAVE_GD_PNG, 1, [ ])
AC_DEFINE(HAVE_GD_XBM, 1, [ ])
AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ])
AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])
AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ])
AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])
dnl Make sure the libgd/ is first in the include path
GDLIB_CFLAGS="-DHAVE_LIBPNG"
+22 -27
View File
@@ -386,7 +386,7 @@ PHP_RSHUTDOWN_FUNCTION(gd)
/* }}} */
#if HAVE_GD_BUNDLED
#define PHP_GD_VERSION_STRING "bundled (2.0.15 compatible)"
#define PHP_GD_VERSION_STRING "bundled (2.0.12 compatible)"
#elif HAVE_LIBGD20
#define PHP_GD_VERSION_STRING "2.0 or higher"
#elif HAVE_GDIMAGECOLORRESOLVE
@@ -3012,9 +3012,8 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
do {
zval ** item;
char * key;
ulong num_key;
if (zend_hash_get_current_key_ex(HASH_OF(*EXT), &key, NULL, &num_key, 0, &pos) != HASH_KEY_IS_STRING)
if (zend_hash_get_current_key_ex(HASH_OF(*EXT), &key, NULL, NULL, 0, &pos) == FAILURE)
continue;
if (zend_hash_get_current_data_ex(HASH_OF(*EXT), (void**)&item, &pos) == FAILURE)
@@ -3166,7 +3165,7 @@ PHP_FUNCTION(imagepscopyfont)
of_ind = zend_list_find(Z_LVAL_PP(fnt), &type);
if (type != le_ps_font) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a Type 1 font index", Z_LVAL_PP(fnt));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt));
RETURN_FALSE;
}
@@ -3397,33 +3396,29 @@ PHP_FUNCTION(imagepstext)
transform = T1_RotateMatrix(NULL, angle);
}
if (width) {
extend = T1_GetExtend(*f_ind);
str_path = T1_GetCharOutline(*f_ind, str[0], size, transform);
extend = T1_GetExtend(*f_ind);
str_path = T1_GetCharOutline(*f_ind, str[0], size, transform);
if (!str_path) {
if (T1_errno) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "libt1 returned error %d", T1_errno);
}
RETURN_FALSE;
if (!str_path) {
if (T1_errno) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "libt1 returned error %d", T1_errno);
}
for (i = 1; i < str_len; i++) {
amount_kern = (int) T1_GetKerning(*f_ind, str[i-1], str[i]);
amount_kern += str[i-1] == ' ' ? space : 0;
add_width = (int) (amount_kern+width)/extend;
char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, size, transform);
str_path = T1_ConcatOutlines(str_path, char_path);
char_path = T1_GetCharOutline(*f_ind, str[i], size, transform);
str_path = T1_ConcatOutlines(str_path, char_path);
}
str_img = T1_AAFillOutline(str_path, 0);
} else {
str_img = T1_AASetString(*f_ind, str, str_len, space, T1_KERNING, size, transform);
RETURN_FALSE;
}
for (i = 1; i < str_len; i++) {
amount_kern = (int) T1_GetKerning(*f_ind, str[i-1], str[i]);
amount_kern += str[i-1] == ' ' ? space : 0;
add_width = (int) (amount_kern+width)/extend;
char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, size, transform);
str_path = T1_ConcatOutlines(str_path, char_path);
char_path = T1_GetCharOutline(*f_ind, str[i], size, transform);
str_path = T1_ConcatOutlines(str_path, char_path);
}
str_img = T1_AAFillOutline(str_path, 0);
if (T1_errno) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "libt1 returned error %d", T1_errno);
RETURN_FALSE;
+6 -45
View File
@@ -43,8 +43,8 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -56,7 +56,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 php4ts.lib libjpeg.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 php4ts.lib freetype2.lib libjpeg.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\zlib\Release"
# ADD LINK32 php4ts.lib freetype2.lib libjpeg.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
@@ -73,8 +73,8 @@ LINK32=link.exe
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -86,7 +86,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 php4ts_debug.lib libjpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd2.dll" /libpath:"..\..\Debug_TS"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 php4ts_debug.lib libpng.lib zlib.lib libjpeg.lib freetype2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Debug_TS/php_gd2.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\zlib\Debug"
# ADD LINK32 php4ts_debug.lib libpng.lib zlib.lib libjpeg.lib freetype2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd2.dll" /libpath:"..\..\Debug_TS"
# SUBTRACT LINK32 /pdb:none
!ENDIF
@@ -144,7 +144,6 @@ SOURCE=.\libgd\gd.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -160,7 +159,6 @@ SOURCE=.\libgd\gd2copypal.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -176,7 +174,6 @@ SOURCE=.\libgd\gd_arc_f_buggy.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -192,7 +189,6 @@ SOURCE=.\libgd\gd_gd.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -208,7 +204,6 @@ SOURCE=.\libgd\gd_gd2.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -216,18 +211,6 @@ SOURCE=.\libgd\gd_gd2.c
# Begin Source File
SOURCE=.\libgd\gd_gif_in.c
!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
# PROP Intermediate_Dir "Release_TS_bundled"
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
# End Source File
# Begin Source File
@@ -240,7 +223,6 @@ SOURCE=.\libgd\gd_io.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -256,7 +238,6 @@ SOURCE=.\libgd\gd_io_dp.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -272,7 +253,6 @@ SOURCE=.\libgd\gd_io_file.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -288,7 +268,6 @@ SOURCE=.\libgd\gd_io_ss.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -304,7 +283,6 @@ SOURCE=.\libgd\gd_jpeg.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -320,7 +298,6 @@ SOURCE=.\libgd\gd_png.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -336,7 +313,6 @@ SOURCE=.\libgd\gd_ss.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -352,7 +328,6 @@ SOURCE=.\libgd\gd_topal.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -368,7 +343,6 @@ SOURCE=.\libgd\gd_wbmp.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -384,7 +358,6 @@ SOURCE=.\libgd\gdcache.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -400,7 +373,6 @@ SOURCE=.\libgd\gdfontg.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -416,7 +388,6 @@ SOURCE=.\libgd\gdfontl.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -432,7 +403,6 @@ SOURCE=.\libgd\gdfontmb.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -448,7 +418,6 @@ SOURCE=.\libgd\gdfonts.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -464,7 +433,6 @@ SOURCE=.\libgd\gdfontt.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -480,7 +448,6 @@ SOURCE=.\libgd\gdft.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -496,7 +463,6 @@ SOURCE=.\libgd\gdhelpers.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -512,7 +478,6 @@ SOURCE=.\libgd\gdkanji.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -528,7 +493,6 @@ SOURCE=.\libgd\gdtables.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -544,7 +508,6 @@ SOURCE=.\libgd\gdxpm.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -560,7 +523,6 @@ SOURCE=.\libgd\wbmp.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
@@ -576,7 +538,6 @@ SOURCE=.\libgd\xbm.c
!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
# PROP Intermediate_Dir "Debug_TS_bundled"
# ADD CPP /FR
!ENDIF
+1 -4
View File
@@ -744,12 +744,9 @@ gdttfchar(gdImage *im, int fg, font_t *font,
if (tweencolorkey.pixel > 0) {
x3 = x2 + col;
if (x3 >= im->sx || x3 < 0) continue;
#if HAVE_LIBGD20
if (im->trueColor) {
pixel = &im->tpixels[y3][x3];
} else
#endif
{
} else {
#if HAVE_LIBGD13
pixel = &im->pixels[y3][x3];
#else
+181 -335
View File
@@ -9,8 +9,8 @@
#ifdef _MSC_VER
# if _MSC_VER >= 1300
/* in MSVC.NET these are available but only for __cplusplus and not _MSC_EXTENSIONS */
# if !defined(_MSC_EXTENSIONS) && defined(__cplusplus)
/* in MSVC.NET the these are available but only for __cplusplus and not _MSC_EXTENSIONS */
# ifdef _MSC_EXTENSIONS
# define HAVE_FABSF 1
extern float fabsf(float x);
# define HAVE_FLOORF 1
@@ -868,36 +868,6 @@ static void gdImageTileApply (gdImagePtr im, int x, int y)
}
}
static int gdImageTileGet (gdImagePtr im, int x, int y)
{
int srcx, srcy;
int tileColor,p;
if (!im->tile) {
return -1;
}
srcx = x % gdImageSX(im->tile);
srcy = y % gdImageSY(im->tile);
p = gdImageGetPixel(im->tile, srcx, srcy);
if (im->trueColor) {
if (im->tile->trueColor) {
tileColor = p;
} else {
tileColor = gdTrueColorAlpha( gdImageRed(im->tile,p), gdImageGreen(im->tile,p), gdImageBlue (im->tile,p), gdImageAlpha (im->tile,p));
}
} else {
if (im->tile->trueColor) {
tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueColorGetBlue (p), gdTrueColorGetAlpha (p));
} else {
tileColor = p;
tileColor = gdImageColorResolveAlpha(im, gdImageRed (im->tile,p), gdImageGreen (im->tile,p), gdImageBlue (im->tile,p), gdImageAlpha (im->tile,p));
}
}
return tileColor;
}
static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py)
{
float p_dist, p_alpha;
@@ -917,15 +887,6 @@ static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py)
int Bx_Cx = im->AAL_x2 - px;
int By_Cy = im->AAL_y2 - py;
/* 2.0.13: bounds check! AA_opacity is just as capable of
* overflowing as the main pixel array. Arne Jorgensen.
* 2.0.14: typo fixed. 2.0.15: moved down below declarations
* to satisfy non-C++ compilers.
*/
if (!gdImageBoundsSafe(im, px, py)) {
return;
}
/* Get the squares of the lengths of the segemnts AC and BC. */
LAC_2 = (Ax_Cx * Ax_Cx) + (Ay_Cy * Ay_Cy);
LBC_2 = (Bx_Cx * Bx_Cx) + (By_Cy * By_Cy);
@@ -1829,173 +1790,107 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
}
}
/*
* set the pixel at (x,y) and its 4-connected neighbors
* with the same pixel value to the new pixel value nc (new color).
* A 4-connected neighbor: pixel above, below, left, or right of a pixel.
* ideas from comp.graphics discussions.
* For tiled fill, the use of a flag buffer is mandatory. As the tile image can
* contain the same color as the color to fill. To do not bloat normal filling
* code I added a 2nd private function.
*/
/* horizontal segment of scan line y */
struct seg {int y, xl, xr, dy;};
/* max depth of stack */
#define FILL_MAX 1200000
#define FILL_PUSH(Y, XL, XR, DY) \
if (sp<stack+FILL_MAX*10 && Y+(DY)>=0 && Y+(DY)<wy2) \
{sp->y = Y; sp->xl = XL; sp->xr = XR; sp->dy = DY; sp++;}
#define FILL_POP(Y, XL, XR, DY) \
{sp--; Y = sp->y+(DY = sp->dy); XL = sp->xl; XR = sp->xr;}
void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc);
void gdImageFill(gdImagePtr im, int x, int y, int nc)
void gdImageFill (gdImagePtr im, int x, int y, int color)
{
int l, x1, x2, dy;
int oc; /* old pixel value */
int wx2,wy2;
/* stack of filled segments */
//struct seg stack[FILL_MAX],*sp = stack;;
struct seg *stack;
struct seg *sp;
if (nc==gdTiled){
_gdImageFillTiled(im,x,y,nc);
int lastBorder;
int old;
int leftLimit, rightLimit;
int i;
if (x >= im->sx) {
x = im->sx - 1;
}
if (y >= im->sy) {
y = im->sy - 1;
}
old = gdImageGetPixel(im, x, y);
if (color == gdTiled) {
/* Tile fill -- got to watch out! */
int p, tileColor;
int srcx, srcy;
if (!im->tile) {
return;
}
/* Refuse to flood-fill with a transparent pattern I can't do it without allocating another image */
if (gdImageGetTransparent(im->tile) != (-1)) {
return;
}
srcx = x % gdImageSX(im->tile);
srcy = y % gdImageSY(im->tile);
p = gdImageGetPixel(im->tile, srcx, srcy);
if (im->trueColor) {
tileColor = p;
} else {
if (im->tile->trueColor) {
tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueColorGetBlue (p), gdTrueColorGetAlpha (p));
} else {
tileColor = im->tileColorMap[p];
}
}
if (old == tileColor) {
/* Nothing to be done */
return;
}
} else {
if (old == color) {
/* Nothing to be done */
return;
}
}
/* Seek left */
leftLimit = (-1);
for (i = x; i >= 0; i--) {
if (gdImageGetPixel(im, i, y) != old) {
break;
}
gdImageSetPixel(im, i, y, color);
leftLimit = i;
}
if (leftLimit == (-1)) {
return;
}
wx2=im->sx;wy2=im->sy;
oc = gdImageGetPixel(im, x, y);
if (oc==nc || x<0 || x>wx2 || y<0 || y>wy2) return;
stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1);
sp = stack;
/* required! */
FILL_PUSH(y,x,x,1);
/* seed segment (popped 1st) */
FILL_PUSH(y+1, x, x, -1);
while (sp>stack) {
FILL_POP(y, x1, x2, dy);
for (x=x1; x>=0 && gdImageGetPixel(im,x, y)==oc; x--) {
gdImageSetPixel(im,x, y, nc);
/* Seek right */
rightLimit = x;
for (i = (x + 1); i < im->sx; i++) {
if (gdImageGetPixel(im, i, y) != old) {
break;
}
gdImageSetPixel(im, i, y, color);
rightLimit = i;
}
/* Look at lines above and below and start paints */
/* Above */
if (y > 0) {
lastBorder = 1;
for (i = leftLimit; i <= rightLimit; i++) {
int c;
c = gdImageGetPixel(im, i, y - 1);
if (lastBorder && c == old) {
gdImageFill (im, i, y - 1, color);
lastBorder = 0;
} else if (c != old) {
lastBorder = 1;
}
}
}
/* Below */
if (y < (im->sy - 1)) {
lastBorder = 1;
for (i = leftLimit; i <= rightLimit; i++) {
int c;
c = gdImageGetPixel(im, i, y + 1);
if (lastBorder && c == old) {
gdImageFill(im, i, y + 1, color);
lastBorder = 0;
} else if (c != old) {
lastBorder = 1;
}
}
if (x>=x1) {
goto skip;
}
l = x+1;
/* leak on left? */
if (l<x1) {
FILL_PUSH(y, l, x1-1, -dy);
}
x = x1+1;
do {
for (; x<=wx2 && gdImageGetPixel(im,x, y)==oc; x++) {
gdImageSetPixel(im, x, y, nc);
}
FILL_PUSH(y, l, x-1, dy);
/* leak on right? */
if (x>x2+1) {
FILL_PUSH(y, x2+1, x-1, -dy);
}
skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++);
l = x;
} while (x<=x2);
}
efree(stack);
}
void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
{
int i,l, x1, x2, dy;
int oc; /* old pixel value */
int tiled;
int wx2,wy2;
/* stack of filled segments */
struct seg *stack;
struct seg *sp;
int **pts;
if(!im->tile){
return;
}
wx2=im->sx;wy2=im->sy;
tiled = nc==gdTiled;
nc = gdImageTileGet(im,x,y);
pts = (int **) ecalloc(sizeof(int *) * im->sy, sizeof(int));
for (i=0; i<im->sy;i++) {
pts[i] = (int *) ecalloc(im->sx, sizeof(int));
}
stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1);
sp = stack;
oc = gdImageGetPixel(im, x, y);
/* required! */
FILL_PUSH(y,x,x,1);
/* seed segment (popped 1st) */
FILL_PUSH(y+1, x, x, -1);
while (sp>stack) {
FILL_POP(y, x1, x2, dy);
for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) {
if (pts[y][x]){
/* we should never be here */
break;
}
nc = gdImageTileGet(im,x,y);
pts[y][x]=1;
gdImageSetPixel(im,x, y, nc);
}
if (x>=x1) {
goto skip;
}
l = x+1;
/* leak on left? */
if (l<x1) {
FILL_PUSH(y, l, x1-1, -dy);
}
x = x1+1;
do {
for (; x<=wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc) ; x++) {
if (pts[y][x]){
/* we should never be here */
break;
}
nc = gdImageTileGet(im,x,y);
pts[y][x]=1;
gdImageSetPixel(im, x, y, nc);
}
FILL_PUSH(y, l, x-1, dy);
/* leak on right? */
if (x>x2+1) {
FILL_PUSH(y, x2+1, x-1, -dy);
}
skip: for (x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++);
l = x;
} while (x<=x2);
}
for (i=0; i<im->sy;i++) {
efree(pts[i]);
}
efree(pts);
efree(stack);
}
void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
{
int x1h = x1, x1v = x1, y1h = y1, y1v = y1, x2h = x2, x2v = x2, y2h = y2, y2v = y2;
@@ -2165,15 +2060,19 @@ void gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int s
tox++;
continue;
}
/* If it's the same image, mapping is trivial */
if (dst == src) {
/*
* If it's the same image, mapping is NOT trivial since we
* merge with greyscale target, but if pct is 100, the grey
* value is not used, so it becomes trivial. pjw 2.0.12.
*/
if (dst == src && pct == 100) {
nc = c;
} else {
dc = gdImageGetPixel(dst, tox, toy);
ncR = (int)(gdImageRed (src, c) * (pct / 100.0) + gdImageRed (dst, dc) * ((100 - pct) / 100.0));
ncG = (int)(gdImageGreen (src, c) * (pct / 100.0) + gdImageGreen (dst, dc) * ((100 - pct) / 100.0));
ncB = (int)(gdImageBlue (src, c) * (pct / 100.0) + gdImageBlue (dst, dc) * ((100 - pct) / 100.0));
ncR = (int)(gdImageRed (src, c) * (pct / 100.0f) + ((100 - pct) / 100.0f));
ncG = (int)(gdImageGreen (src, c) * (pct / 100.0f) + ((100 - pct) / 100.0f));
ncB = (int)(gdImageBlue (src, c) * (pct / 100.0f) + ((100 - pct) / 100.0f));
/* Find a reasonable color */
nc = gdImageColorResolve (dst, ncR, ncG, ncB);
@@ -2206,12 +2105,8 @@ void gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
tox++;
continue;
}
/*
* If it's the same image, mapping is NOT trivial since we
* merge with greyscale target, but if pct is 100, the grey
* value is not used, so it becomes trivial. pjw 2.0.12.
*/
if (dst == src && pct == 100) {
/* If it's the same image, mapping is trivial */
if (dst == src) {
nc = c;
} else {
dc = gdImageGetPixel(dst, tox, toy);
@@ -2464,22 +2359,14 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double dWeight, int clrBack)
{
typedef int (*FuncPtr)(gdImagePtr, int, int);
int i, r, g, b, a, clrBackR, clrBackG, clrBackB, clrBackA;
int i, r, g, b, a;
FuncPtr f;
int pxlOldLeft, pxlLeft=0, pxlSrc;
/* Keep clrBack as color index if required */
if (src->trueColor) {
pxlOldLeft = clrBack;
f = gdImageGetTrueColorPixel;
} else {
pxlOldLeft = clrBack;
clrBackR = gdImageRed(src, clrBack);
clrBackG = gdImageGreen(src, clrBack);
clrBackB = gdImageBlue(src, clrBack);
clrBackA = gdImageAlpha(src, clrBack);
clrBack = gdTrueColorAlpha(clrBackR, clrBackG, clrBackB, clrBackA);
f = gdImageGetPixel;
}
@@ -2491,6 +2378,8 @@ void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double
gdImageSetPixel (dst, i, uRow, clrBack);
}
pxlOldLeft = clrBack;
for (i = 0; i < src->sx; i++) {
pxlSrc = f (src,i,uRow);
@@ -2500,30 +2389,30 @@ void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double
a = (int)(gdImageAlpha(src,pxlSrc) * dWeight);
pxlLeft = gdImageColorAllocateAlpha(src, r, g, b, a);
if (pxlLeft == -1) {
pxlLeft = gdImageColorClosestAlpha(src, r, g, b, a);
}
r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - gdImageRed(src,pxlOldLeft));
g = gdImageGreen(src,pxlSrc) - (gdImageGreen(src,pxlLeft) - gdImageGreen(src,pxlOldLeft));
b = gdImageBlue(src,pxlSrc) - (gdImageBlue(src,pxlLeft) - gdImageBlue(src,pxlOldLeft));
a = gdImageAlpha(src,pxlSrc) - (gdImageAlpha(src,pxlLeft) - gdImageAlpha(src,pxlOldLeft));
if (r>255) {
r = 255;
}
if (r>255) {
r = 255;
}
if (g>255) {
g = 255;
}
if (b>255) {
b = 255;
}
}
if(b>255) {
b = 255;
}
if (a>127) {
a = 127;
b = 127;
}
pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a);
@@ -2540,7 +2429,7 @@ void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double
}
i += iOffset;
if (i < dst->sx) {
gdImageSetPixel (dst, i, uRow, pxlLeft);
}
@@ -2567,50 +2456,46 @@ void gdImageSkewY (gdImagePtr dst, gdImagePtr src, int uCol, int iOffset, double
f = gdImageGetPixel;
}
for (i = 0; i<=iOffset; i++) {
for (i = 0; i<iOffset; i++) {
gdImageSetPixel (dst, uCol, i, clrBack);
}
r = (int)((double)gdImageRed(src,clrBack) * dWeight);
g = (int)((double)gdImageGreen(src,clrBack) * dWeight);
b = (int)((double)gdImageBlue(src,clrBack) * dWeight);
a = (int)((double)gdImageAlpha(src,clrBack) * dWeight);
pxlOldLeft = gdImageColorAllocateAlpha(dst, r, g, b, a);
pxlOldLeft = clrBack;
for (i = 0; i < src->sy; i++) {
pxlSrc = f (src, uCol, i);
iYPos = i + iOffset;
r = (int)((double)gdImageRed(src,pxlSrc) * dWeight);
g = (int)((double)gdImageGreen(src,pxlSrc) * dWeight);
b = (int)((double)gdImageBlue(src,pxlSrc) * dWeight);
a = (int)((double)gdImageAlpha(src,pxlSrc) * dWeight);
r = (int)(gdImageRed(src,pxlSrc) * dWeight);
g = (int)(gdImageGreen(src,pxlSrc) * dWeight);
b = (int)(gdImageBlue(src,pxlSrc) * dWeight);
a = (int)(gdImageAlpha(src,pxlSrc) * dWeight);
pxlLeft = gdImageColorAllocateAlpha(src, r, g, b, a);
if (pxlLeft == -1) {
pxlLeft = gdImageColorClosestAlpha(src, r, g, b, a);
}
r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - gdImageRed(src,pxlOldLeft));
r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - gdImageRed(src,pxlOldLeft));
g = gdImageGreen(src,pxlSrc) - (gdImageGreen(src,pxlLeft) - gdImageGreen(src,pxlOldLeft));
b = gdImageBlue(src,pxlSrc) - (gdImageBlue(src,pxlLeft) - gdImageBlue(src,pxlOldLeft));
a = gdImageAlpha(src,pxlSrc) - (gdImageAlpha(src,pxlLeft) - gdImageAlpha(src,pxlOldLeft));
if (r>255) {
r = 255;
}
}
if (g>255) {
g = 255;
}
if (b>255) {
b = 255;
}
}
if(b>255) {
b = 255;
}
if (a>127) {
a = 127;
b = 127;
}
pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a);
@@ -2622,7 +2507,7 @@ void gdImageSkewY (gdImagePtr dst, gdImagePtr src, int uCol, int iOffset, double
if ((iYPos >= 0) && (iYPos < dst->sy)) {
gdImageSetPixel (dst, uCol, iYPos, pxlSrc);
}
pxlOldLeft = pxlLeft;
}
@@ -2641,36 +2526,30 @@ void gdImageSkewY (gdImagePtr dst, gdImagePtr src, int uCol, int iOffset, double
gdImagePtr gdImageRotate90 (gdImagePtr src)
{
int uY, uX;
int c, r,g,b,a;
int c;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
if (src->trueColor) {
dst = gdImageCreateTrueColor(src->sy, src->sx);
f = gdImageGetTrueColorPixel;
} else {
dst = gdImageCreate (src->sy, src->sx);
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor(src->sy, src->sx);
if (dst != NULL) {
gdImagePaletteCopy (dst, src);
for (uY = 0; uY<src->sy; uY++) {
for (uX = 0; uX<src->sx; uX++) {
c = f (src, uX, uY);
if (!src->trueColor) {
r = gdImageRed(src,c);
g = gdImageGreen(src,c);
b = gdImageBlue(src,c);
a = gdImageAlpha(src,c);
c = gdTrueColorAlpha(r, g, b, a);
}
gdImageSetPixel(dst, uY, (dst->sy - uX - 1), c);
}
}
}
return dst;
}
@@ -2678,31 +2557,25 @@ gdImagePtr gdImageRotate90 (gdImagePtr src)
gdImagePtr gdImageRotate180 (gdImagePtr src)
{
int uY, uX;
int c,r,g,b,a;
int c;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
if (src->trueColor) {
dst = gdImageCreateTrueColor ( src->sx,src->sy);
f = gdImageGetTrueColorPixel;
} else {
dst = gdImageCreate (src->sx, src->sy);
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor(src->sx, src->sy);
if (dst != NULL) {
gdImagePaletteCopy (dst, src);
for (uY = 0; uY<src->sy; uY++) {
for (uX = 0; uX<src->sx; uX++) {
c = f (src, uX, uY);
if (!src->trueColor) {
r = gdImageRed(src,c);
g = gdImageGreen(src,c);
b = gdImageBlue(src,c);
a = gdImageAlpha(src,c);
c = gdTrueColorAlpha(r, g, b, a);
}
gdImageSetPixel(dst, (dst->sx - uX - 1), (dst->sy - uY - 1), c);
}
}
@@ -2715,36 +2588,30 @@ gdImagePtr gdImageRotate180 (gdImagePtr src)
gdImagePtr gdImageRotate270 ( gdImagePtr src )
{
int uY, uX;
int c,r,g,b,a;
int c;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
if (src->trueColor) {
dst = gdImageCreateTrueColor (src->sy, src->sx);
f = gdImageGetTrueColorPixel;
} else {
dst = gdImageCreate (src->sy, src->sx);
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor(src->sy, src->sx);
if (dst != NULL) {
gdImagePaletteCopy (dst, src);
for (uY = 0; uY<src->sy; uY++) {
for (uY = 0; uY<src->sx; uY++) {
for (uX = 0; uX<src->sx; uX++) {
c = f (src, uX, uY);
if (!src->trueColor) {
r = gdImageRed(src,c);
g = gdImageGreen(src,c);
b = gdImageBlue(src,c);
a = gdImageAlpha(src,c);
c = gdTrueColorAlpha(r, g, b, a);
}
gdImageSetPixel(dst, (dst->sx - uY - 1), uX, c);
}
}
}
return dst;
}
@@ -2756,7 +2623,6 @@ gdImagePtr gdImageRotate45 (gdImagePtr src, double dAngle, int clrBack)
double dRadAngle, dSinE, dTan, dShear;
double dOffset; /* Variable skew offset */
int u, iShear, newx, newy;
int clrBackR, clrBackG, clrBackB, clrBackA;
/* See GEMS I for the algorithm details */
dRadAngle = dAngle * ROTATE_DEG2RAD; /* Angle in radians */
@@ -2768,26 +2634,25 @@ gdImagePtr gdImageRotate45 (gdImagePtr src, double dAngle, int clrBack)
/* 1st shear */
if (src->trueColor) {
dst1 = gdImageCreateTrueColor (newx, newy);
f = gdImageGetTrueColorPixel;
} else {
dst1 = gdImageCreate (newx, newy);
f = gdImageGetPixel;
}
dst1 = gdImageCreateTrueColor(newx, newy);
/******* Perform 1st shear (horizontal) ******/
if (dst1 == NULL) {
return NULL;
}
dst1->alphaBlendingFlag = gdEffectReplace;
if (dAngle == 0.0) {
/* Returns copy of src */
gdImageCopy (dst1, src,0,0,0,0,src->sx,src->sy);
return dst1;
}
gdImagePaletteCopy (dst1, src);
dRadAngle = dAngle * ROTATE_DEG2RAD; /* Angle in radians */
dSinE = sin (dRadAngle);
dTan = tan (dRadAngle / 2.0);
@@ -2800,46 +2665,37 @@ gdImagePtr gdImageRotate45 (gdImagePtr src, double dAngle, int clrBack)
}
iShear = (int)floor(dShear);
gdImageSkewX(dst1, src, u, iShear, (dShear - iShear), clrBack);
}
/*
The 1st shear may use the original clrBack as color index
Convert it once here
*/
if(!src->trueColor) {
clrBackR = gdImageRed(src, clrBack);
clrBackG = gdImageGreen(src, clrBack);
clrBackB = gdImageBlue(src, clrBack);
clrBackA = gdImageAlpha(src, clrBack);
clrBack = gdTrueColorAlpha(clrBackR, clrBackG, clrBackB, clrBackA);
}
/* 2nd shear */
newx = dst1->sx;
if (dSinE > 0.0) {
dOffset = (src->sx-1) * dSinE;
dOffset = (src->sx ) * dSinE;
} else {
dOffset = -dSinE * (src->sx - newx);
}
newy = (int) ((double) src->sx * fabs( dSinE ) + (double) src->sy * cos (dRadAngle))+1;
newy = (int) ((double) src->sx * fabs( dSinE ) + (double) src->sy * cos (dRadAngle));
if (src->trueColor) {
dst2 = gdImageCreateTrueColor (newx, newy);
f = gdImageGetTrueColorPixel;
} else {
dst2 = gdImageCreate (newx, newy);
f = gdImageGetPixel;
}
dst2 = gdImageCreateTrueColor(newx, newy);
if (dst2 == NULL) {
gdImageDestroy(dst1);
return NULL;
}
dst2->alphaBlendingFlag = gdEffectReplace;
for (u = 0; u < dst2->sx; u++, dOffset -= dSinE) {
iShear = (int)floor (dOffset);
gdImageSkewY(dst2, dst1, u, iShear, (dOffset - (double)iShear), clrBack);
gdImageSkewY(dst2, dst1, u, iShear, (dOffset - iShear), clrBack);
}
/* 3rd shear */
@@ -2847,13 +2703,15 @@ gdImagePtr gdImageRotate45 (gdImagePtr src, double dAngle, int clrBack)
newx = (int) ((double)src->sy * fabs (dSinE) + (double)src->sx * cos (dRadAngle)) + 1;
newy = dst2->sy;
if (src->trueColor) {
dst3 = gdImageCreateTrueColor (newx, newy);
f = gdImageGetTrueColorPixel;
} else {
dst3 = gdImageCreate (newx, newy);
f = gdImageGetPixel;
}
dst3 = gdImageCreateTrueColor(newx, newy);
if (dst3 == NULL) {
gdImageDestroy(dst2);
return NULL;
@@ -2870,7 +2728,7 @@ gdImagePtr gdImageRotate45 (gdImagePtr src, double dAngle, int clrBack)
}
gdImageDestroy(dst2);
return dst3;
}
@@ -2878,12 +2736,8 @@ gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack)
{
gdImagePtr pMidImg;
gdImagePtr rotatedImg;
int r,g,b,a;
if (src == NULL) {
return NULL;
}
if (!gdImageTrueColor(src) && clrBack>=gdImageColorsTotal(src)) {
if (src == NULL) {
return NULL;
}
@@ -2894,7 +2748,7 @@ gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack)
while (dAngle < 0) {
dAngle += 360.0;
}
if (dAngle == 90.00) {
return gdImageRotate90(src);
}
@@ -2917,22 +2771,14 @@ gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack)
} else {
return gdImageRotate45 (src, dAngle, clrBack);
}
if (pMidImg == NULL) {
return NULL;
}
if(!src->trueColor) {
r = gdImageRed(src, clrBack);
g = gdImageGreen(src, clrBack);
b = gdImageBlue(src, clrBack);
a = gdImageAlpha(src, clrBack);
clrBack = gdTrueColorAlpha(r,g,b,a);
}
rotatedImg = gdImageRotate45 (pMidImg, dAngle, clrBack);
gdImageDestroy(pMidImg);
return rotatedImg;
}
/* End Rotate function */
+3 -18
View File
@@ -140,9 +140,6 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
nc = (*ncx) * (*ncy);
GD2_DBG(php_gd_error("Reading %d chunk index entries\n", nc));
sidx = sizeof(t_chunk_info) * nc;
if (sidx <= 0) {
goto fail1;
}
cidx = gdCalloc(sidx, 1);
for (i = 0; i < nc; i++) {
if (gdGetInt(&cidx[i].offset, in) != 1) {
@@ -276,9 +273,6 @@ gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
/* Allocate buffers */
chunkMax = cs * bytesPerPixel * cs;
if (chunkMax <= 0) {
return 0;
}
chunkBuf = gdCalloc(chunkMax, 1);
compBuf = gdCalloc(compMax, 1);
@@ -454,10 +448,6 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w,
} else {
chunkMax = cs * cs;
}
if (chunkMax <= 0) {
goto fail2;
}
chunkBuf = gdCalloc(chunkMax, 1);
compBuf = gdCalloc(compMax, 1);
}
@@ -670,11 +660,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
compMax = (int)(cs * bytesPerPixel * cs * 1.02f) + 12;
/* Allocate the buffers. */
chunkData = safe_emalloc(cs * bytesPerPixel, cs, 0);
memset(chunkData, 0, cs * bytesPerPixel * cs);
if (compMax <= 0) {
goto fail;
}
chunkData = gdCalloc(cs * bytesPerPixel * cs, 1);
compData = gdCalloc(compMax, 1);
/* Save the file position of chunk index, and allocate enough space for
@@ -685,8 +671,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
GD2_DBG(php_gd_error("Index size is %d\n", idxSize));
gdSeek(out, idxPos + idxSize);
chunkIdx = safe_emalloc(idxSize, sizeof(t_chunk_info), 0);
memset(chunkIdx, 0, idxSize * sizeof(t_chunk_info));
chunkIdx = gdCalloc(idxSize * sizeof(t_chunk_info), 1);
}
_gdPutColors (im, out);
@@ -770,7 +755,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
}
gdSeek(out, posSave);
}
fail:
GD2_DBG(php_gd_error("Freeing memory\n"));
if (chunkData) {
gdFree(chunkData);
+1 -1
View File
@@ -299,7 +299,7 @@ GetDataBlock(gdIOCtx *fd, unsigned char *buf)
rv = GetDataBlock_(fd,buf);
if (VERBOSE) {
if (rv > 0) {
tmp = safe_emalloc(3 * rv, sizeof(char), 1);
tmp = emalloc((3*sizeof(char)*rv) + 1);
for (i=0;i<rv;i++) {
sprintf(&tmp[3*sizeof(char)*i], " %02x", buf[i]);
}
+2 -4
View File
@@ -144,8 +144,7 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
jpeg_gdIOCtx_dest (&cinfo, outfile);
row = (JSAMPROW) safe_emalloc(cinfo.image_width * cinfo.input_components, sizeof(JSAMPLE), 0);
memset(row, 0, cinfo.image_width * cinfo.input_components * sizeof(JSAMPLE));
row = (JSAMPROW) gdCalloc (1, cinfo.image_width * cinfo.input_components * sizeof (JSAMPLE));
rowptr[0] = row;
jpeg_start_compress (&cinfo, TRUE);
@@ -311,8 +310,7 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
goto error;
#endif /* BITS_IN_JSAMPLE == 12 */
row = safe_emalloc(cinfo.output_width * 3, sizeof(JSAMPLE), 0);
memset(row, 0, cinfo.output_width * 3 * sizeof(JSAMPLE));
row = gdCalloc (cinfo.output_width * 3, sizeof (JSAMPLE));
rowptr[0] = row;
for (i = 0; i < cinfo.output_height; i++) {
+1 -1
View File
@@ -413,7 +413,7 @@ void * gdImagePngPtrEx (gdImagePtr im, int *size, int level)
void gdImagePngCtx (gdImagePtr im, gdIOCtx * outfile)
{
gdImagePngCtxEx(im, outfile, -1);
return gdImagePngCtxEx(im, outfile, -1);
}
/* This routine is based in part on code from Dale Lutz (Safe Software Inc.)
+5 -14
View File
@@ -744,7 +744,7 @@ extern int any2eucjp (char *, char *, unsigned int);
/* Persistent font cache until explicitly cleared */
/* Fonts can be used across multiple images */
static gdCache_head_t *fontCache = NULL;
static gdCache_head_t *fontCache;
static FT_Library library;
void
@@ -753,7 +753,6 @@ gdFreeFontCache()
if (fontCache)
{
gdCacheDelete(fontCache);
fontCache=NULL;
FT_Done_FreeType(library);
}
}
@@ -790,8 +789,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
char *tmpstr = NULL;
int render = (im && (im->trueColor || (fg <= 255 && fg >= -255)));
FT_BitmapGlyph bm;
/* 2.0.13: Bob Ostermann: don't force autohint, that's just for testing freetype and doesn't look as good */
int render_mode = FT_LOAD_DEFAULT;
int render_mode = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT;
int m, mfound;
/* Now tuneable thanks to Wez Furlong */
double linespace = LINESPACE;
@@ -889,16 +887,11 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
}
#ifndef JISX0208
if (font->have_char_map_sjis) {
if (!font->have_char_map_sjis) {
next = string;
} else
#endif
tmpstr = (char *) gdMalloc(BUFSIZ);
any2eucjp(tmpstr, string, BUFSIZ);
next = tmpstr;
#ifndef JISX0208
} else {
next = string;
}
#endif
while (*next) {
ch = *next;
@@ -915,8 +908,6 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
}
/* newlines */
if (ch == '\n') {
/* 2.0.13: reset penf.x. Christopher J. Grayce */
penf.x = 0;
penf.y -= (long)(face->size->metrics.height * linespace);
penf.y = (penf.y - 32) & -64; /* round to next pixel row */
x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64;
+1 -1
View File
@@ -37,7 +37,7 @@ gdImageCreateFromXpm (char *filename)
return 0;
number = image.ncolors;
colors = (int *) safe_emalloc(number, sizeof(int), 0);
colors = (int *) gdMalloc (sizeof (int) * number);
for (i = 0; i < number; i++)
{
switch (strlen (image.colorTable[i].c_color))
+17 -20
View File
@@ -7,18 +7,18 @@ gdimagefill() function (Bug #19366 (fixed in bundled libgd))
?>
--FILE--
<?php
echo "Alive: create image\n";
echo "Alive\n";
$width = 50;
$height = 100;
$ImHandle = imagecreate($width,$height);
echo "Alive: Define colors\n";
echo "Alive\n";
//Define colors
$MyBlue = imagecolorAllocate($ImHandle, 0, 0, 255);
$MyRed = imagecolorAllocate($ImHandle, 255, 0, 0);
$MyWhite = imagecolorAllocate($ImHandle, 255, 255, 255);
$MyBlack = imagecolorAllocate($ImHandle, 0, 0, 0);
echo "Alive: Draw\n";
echo "Alive\n";
//Draw
ImageFill($ImHandle,0,0,$MyBlack);
ImageLine($ImHandle,20,20,180,20,$MyWhite);
ImageLine($ImHandle,20,20,20,70,$MyBlue);
@@ -31,23 +31,20 @@ ImageLine($ImHandle,100,45,180,45,$MyRed);
ImageFill($ImHandle,21,45,$MyBlue);
ImageFill($ImHandle,100,69,$MyRed);
ImageFill($ImHandle,100,21,$MyWhite);
echo "Alive: ImageString\n";
ImageString($ImHandle,4,40,75,"Czech Republic",$MyWhite);
echo "Alive: Send to browser\n";
//Header("Content-type: image/PNG");
echo "Alive\n";
// Send to browser
Header("Content-type: image/PNG");
//ImagePNG($ImHandle);
echo "Alive: Free resources\n";
echo "Alive\n";
//Free resources
imagedestroy($ImHandle);
echo "Alive: Done\n";
echo "Alive\n";
?>
--EXPECT--
Alive: create image
Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
Alive
Alive
Alive
Alive
Alive
Alive
-26
View File
@@ -1,26 +0,0 @@
--TEST--
Bug #24155 (gdImageRotate270 rotation problem).
--SKIPIF--
<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
if (!GD_BUNDLED) {
die('skip external GD libraries may fail');
}
?>
--FILE--
<?php
$dest = dirname(realpath(__FILE__)) . 'bug24155.png';
@unlink($dest);
$im = imagecreatetruecolor(30, 50);
imagefill($im, 0, 0, (16777215 - 255));
$im = imagerotate($im, 270, 255);
imagepng($im, $dest);
echo md5_file($dest) . "\n";
@unlink($dest);
?>
--EXPECT--
cc867fd65c30883463ce58d0341f0997
-85
View File
@@ -1,85 +0,0 @@
--TEST--
Bug #24594 (Filling an area using tiles).
--SKIPIF--
<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
if (!GD_BUNDLED) {
die('skip external GD libraries may fail');
}
?>
--FILE--
<?php
$tile = imagecreate(36,36);
$base = imagecreate(150,150);
$white = imagecolorallocate($tile,255,255,255);
$black = imagecolorallocate($tile,0,0,0);
$white = imagecolorallocate($base,255,255,255);
$black = imagecolorallocate($base,0,0,0);
/* create the dots pattern */
for ($x=0;$x<36;$x+=2) {
for ($y=0;$y<36;$y+=2) {
imagesetpixel($tile,$x,$y,$black);
}
}
imagesettile($base,$tile);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
imagefill($base,11,12,IMG_COLOR_TILED);
$res = imagecolorat($base,0,10)==$black?'1':'0';
$res .= imagecolorat($base,0,20)==$black?'1':'0';
$res .= imagecolorat($base,0,30)==$black?'1':'0';
$res .= imagecolorat($base,0,40)==$black?'1':'0';
$res .= imagecolorat($base,0,50)==$black?'1':'0';
$res .= imagecolorat($base,0,60)==$black?'1':'0';
$res .= imagecolorat($base,11,12)==$white?'1':'0';
$res .= imagecolorat($base,12,13)==$white?'1':'0';
$res .= imagecolorat($base,13,14)==$white?'1':'0';
$res .= imagecolorat($base,14,15)==$white?'1':'0';
$res .= imagecolorat($base,15,16)==$white?'1':'0';
$res .= imagecolorat($base,16,17)==$white?'1':'0';
$res .= imagecolorat($base,10,12)==$black?'1':'0';
$res .= imagecolorat($base,11,13)==$black?'1':'0';
$res .= imagecolorat($base,12,14)==$black?'1':'0';
$res .= imagecolorat($base,13,15)==$black?'1':'0';
$res .= imagecolorat($base,14,16)==$black?'1':'0';
$res .= imagecolorat($base,15,17)==$black?'1':'0';
echo "$res\n";
imagefilledrectangle($base,0,0,149,149,$white);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
imagefill($base,0,0,IMG_COLOR_TILED);
$res = imagecolorat($base,0,10)==$black?'1':'0';
$res .= imagecolorat($base,0,20)==$black?'1':'0';
$res .= imagecolorat($base,0,30)==$black?'1':'0';
$res .= imagecolorat($base,0,40)==$black?'1':'0';
$res .= imagecolorat($base,0,50)==$black?'1':'0';
$res .= imagecolorat($base,0,60)==$black?'1':'0';
$res .= imagecolorat($base,11,12)==$white?'1':'0';
$res .= imagecolorat($base,12,13)==$white?'1':'0';
$res .= imagecolorat($base,13,14)==$white?'1':'0';
$res .= imagecolorat($base,14,15)==$white?'1':'0';
$res .= imagecolorat($base,15,16)==$white?'1':'0';
$res .= imagecolorat($base,16,17)==$white?'1':'0';
$res .= imagecolorat($base,0,16)==$black?'1':'0';
$res .= imagecolorat($base,2,42)==$black?'1':'0';
$res .= imagecolorat($base,4,44)==$black?'1':'0';
$res .= imagecolorat($base,146,146)==$black?'1':'0';
$res .= imagecolorat($base,148,146)==$black?'1':'0';
$res .= imagecolorat($base,0,0)==$black?'1':'0';
echo "$res\n";
?>
--EXPECT--
000000111111101010
111111111111111111
Loaded 100 of 569 files, more files were not shown because too many files have changed in this diff. Show more