mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-25 01:45:41 +00:00
Compare commits
101
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09ab438f1f | ||
|
|
c096e54196 | ||
|
|
663841fd31 | ||
|
|
02ab9ce41d | ||
|
|
442c6c9c6f | ||
|
|
5df1e69be1 | ||
|
|
f7226bcc2d | ||
|
|
0b9b69be38 | ||
|
|
5888fd4024 | ||
|
|
1b2b9a6a0d | ||
|
|
a207ace664 | ||
|
|
38b637bdfc | ||
|
|
a96582f13b | ||
|
|
8cf790dea1 | ||
|
|
e58b48e89c | ||
|
|
210d34a088 | ||
|
|
ed5a974ab0 | ||
|
|
bb7f2e4210 | ||
|
|
31b2848051 | ||
|
|
5ebe7edcb3 | ||
|
|
ed68bc6095 | ||
|
|
6a9e52543b | ||
|
|
f1c31423d7 | ||
|
|
441dc97d75 | ||
|
|
8378373527 | ||
|
|
d76514d892 | ||
|
|
2bbfddb533 | ||
|
|
85e5585a1c | ||
|
|
e6840ed921 | ||
|
|
cb20f5cafe | ||
|
|
a95a14cebf | ||
|
|
8b9cc5ba81 | ||
|
|
259a07f733 | ||
|
|
a9674113d1 | ||
|
|
168786cfcf | ||
|
|
3f43cfbb6a | ||
|
|
93578a5789 | ||
|
|
89eaec22b5 | ||
|
|
a99c6916f3 | ||
|
|
30c8d9b166 | ||
|
|
5a6d9048e5 | ||
|
|
0e9275fb37 | ||
|
|
b08b041503 | ||
|
|
9c340ef86f | ||
|
|
baf702a009 | ||
|
|
65ab4040fc | ||
|
|
c3d0c735b8 | ||
|
|
1a5342e468 | ||
|
|
eeaaaf7fce | ||
|
|
5dd18df5eb | ||
|
|
6deb70d17d | ||
|
|
5babe27344 | ||
|
|
ac4adcc2f7 | ||
|
|
46e793d8dc | ||
|
|
cc2149097f | ||
|
|
cdb852e21f | ||
|
|
c18cbd0f35 | ||
|
|
40fe027642 | ||
|
|
2184a5a584 | ||
|
|
b2f06ce507 | ||
|
|
80553d8fc7 | ||
|
|
5b4eeb628c | ||
|
|
2af0c3bbdf | ||
|
|
d4e86c36ed | ||
|
|
fe4a118383 | ||
|
|
ada04f382d | ||
|
|
e1505662ad | ||
|
|
3766f870d4 | ||
|
|
e4c30e6b89 | ||
|
|
9543e9c111 | ||
|
|
d0551c2a7c | ||
|
|
66df106383 | ||
|
|
4c6e92bdb8 | ||
|
|
b2732089f2 | ||
|
|
8e8f8ece29 | ||
|
|
7275b5a177 | ||
|
|
5f0305e605 | ||
|
|
2a0e69c111 | ||
|
|
74c2e50253 | ||
|
|
cb915e0498 | ||
|
|
3379ffa7ed | ||
|
|
0053324a83 | ||
|
|
a0c001aa70 | ||
|
|
7b6a710bd0 | ||
|
|
221d4b346b | ||
|
|
1e60e670ba | ||
|
|
fdec1ab00e | ||
|
|
1aac6063a4 | ||
|
|
0808ccd417 | ||
|
|
61c00477b4 | ||
|
|
9ea8c7ddd4 | ||
|
|
d6cc9d4f01 | ||
|
|
c07cd30cd0 | ||
|
|
c9af2f28e2 | ||
|
|
ea54e26972 | ||
|
|
0ac2170517 | ||
|
|
bd6b53c1d8 | ||
|
|
ca90ec2cac | ||
|
|
91abce9917 | ||
|
|
4cc252ca16 | ||
|
|
1ed5d89106 |
No files matched your search
@@ -1,8 +1,70 @@
|
||||
PHP 4 NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
18 Mar 2004, Version 4.3.5RC4
|
||||
- Fixed possible crash using an invalid color index with a palette image in
|
||||
imagecolortransparent (Pierre)
|
||||
- Fixed php-cgi to not ignore command-line switches when run in a web context.
|
||||
This fixes our test cases allowing INI with GET sections to work (Rasmus)
|
||||
- Fixed getopt() so it works without $_SERVER (Rasmus, bfrance)
|
||||
- Fixed crash in php_ini_scanned_files() when no additional INI files were
|
||||
actually parsed. (Jon)
|
||||
- Fixed possible crashes inside socket extension, due to missing check inside
|
||||
allocation functions. (Ilia)
|
||||
- Fixed bug #27633 (Incorrect EOL translation by ftp_get() in ASCII mode).
|
||||
(Ilia)
|
||||
- Fixed bug #27600 (GCC 3.0.4 does not like __attribute__ directive). (Sascha)
|
||||
- Fixed bug #27590 (crash during shutdown when freeing persistent resources
|
||||
in ZTS mode). (Ilia)
|
||||
- Fixed bug #27582 (possible crashes in imagefilltoborder()). (Pierre)
|
||||
- Fixed bug #27580 (pre-initialization errors in ap2 handler are not being
|
||||
written to vhost error log). (Ilia)
|
||||
- Fixed bug #27559 (Corrected open_basedir resolving logic). (Ilia)
|
||||
- Fixed bug #27530 (broken http auth when safe_mode is on and PCRE is
|
||||
disabled). (Ilia)
|
||||
- Fixed bug #27509 (broken getaddrinfo() causes fsockopen() error). (Sara)
|
||||
- Fixed bug #27505 (htmlentities() does not handle BIG5 correctly). (Ilia,
|
||||
ywliu at hotmail dot com)
|
||||
- Fixed bug #27498 (bogus safe_mode error on nonexistent directories for
|
||||
chdir() and opendir() functions). (Ilia)
|
||||
- Fixed bug #27460 (base64_decode() does not handle extra padding).
|
||||
(Ilia, naish at klanen dot net)
|
||||
- Fixed bug #27443 (defined() returns wrong type). (Derick)
|
||||
- Fixed bug #27437 (wrong freetype include inside GD library). (Ilia)
|
||||
- Fixed bug #27424 (headers missing on flush() in apache 2 SAPIs). (Ilia)
|
||||
- Fixed bug #27421 (mbstring.func_overload should be system ini setting).
|
||||
(Ilia)
|
||||
- Fixed bug #27384 (unpack() misbehaves with 1 char string). (GeorgeS)
|
||||
- Fixed bug #27383 (Potential crash inside fopen_wrapper, while parsing
|
||||
response code). (Ilia)
|
||||
- Fixed bug #27341 (HEAD requests fail to return data). (Ilia)
|
||||
- Fixed bug #27337 (missing sapi_shutdown() in sapi/isapi causes memory leak).
|
||||
(Jani, msisolak at yahoo dot com)
|
||||
- Fixed bug #27328 (ftp extension relies on 32-bit longs). (Sara)
|
||||
- Fixed bug #27300 (Improved regex for pg_convert()).
|
||||
(benjcarson at digitaljunkies dot ca, Ilia)
|
||||
- Fixed bug #27295 (memory leak inside sscanf()). (Ilia)
|
||||
- Fixed bug #27293 (two crashes inside image2wbmp()). (Ilia)
|
||||
- Fixed bug #27291 (get_browser matches browscap.ini patterns incorrectly).
|
||||
(Jay)
|
||||
- Fixed bug #27278 (*printf() functions treat arguments as if passed by
|
||||
reference). (Ilia)
|
||||
- Fixed bug #27238 (iptcparse() function misses some fields). (Pierre)
|
||||
- Fixed bug #26753 (zend_fetch_list_dtor_id() doesn't check NULL strings).
|
||||
(Jani, Markus dot Lidel at shadowconnect dot com)
|
||||
- Fixed bug #26005 (Random "cannot change the session ini settings" errors).
|
||||
(Jani, jsnajdr at kerio dot com)
|
||||
- Fixed bug #24582 (extensions can't be loaded dynamically in Solaris/iPlanet).
|
||||
(Jani)
|
||||
- Fixed bug #22127 (Invalid response code when force-cgi-redirect safety
|
||||
mechanism is triggered). (Ilia, scottmacvicar at ntlworld dot com)
|
||||
- Fixed bug #21760 (Use of uninitialized pointer inside php_read()). (Ilia,
|
||||
uce at ftc dot gov)
|
||||
- Fixed bug #21070 (ftp_genlist/ANSI-tmpfile() fail w/ some platform). (Sara)
|
||||
|
||||
16 Feb 2004, Version 4.3.5RC3
|
||||
- Fixed zero bytes memory allocation when no extra ini files are found in the
|
||||
--with-config-file-scan-dir specified directory. (Eric Colinet, Derick)
|
||||
- Fixed bug #27354 (Modulus operator crashes PHP). (Derick)
|
||||
- Fixed bug #27235 (Interbase NUMERIC x.0 field returns empty string on 0).
|
||||
(Ard)
|
||||
- Fixed bug #27196 (Missing content_length initialization in apache 2 sapis).
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ snapshot:
|
||||
md5sum $$distname.tar.bz2; \
|
||||
bzip2 -t $$distname.tar.bz2
|
||||
|
||||
cvsclean:
|
||||
cvsclean-work:
|
||||
@for i in `find . -name .cvsignore`; do \
|
||||
(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore | grep -v config.nice` *.o *.a .libs || true); \
|
||||
done
|
||||
|
||||
+38
-3
@@ -41,7 +41,7 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
MAJOR_VERSION=4
|
||||
MINOR_VERSION=3
|
||||
RELEASE_VERSION=5
|
||||
EXTRA_VERSION="RC3"
|
||||
EXTRA_VERSION="RC4"
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
dnl Define where extension directories are located in the configure context
|
||||
@@ -521,10 +521,45 @@ vsnprintf \
|
||||
)
|
||||
|
||||
dnl Check for getaddrinfo, should be a better way, but...
|
||||
dnl Also check for working getaddrinfo
|
||||
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
|
||||
[AC_TRY_LINK([#include <netdb.h>],
|
||||
[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
|
||||
ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)])
|
||||
[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
|
||||
AC_TRY_RUN([
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
int main(void) {
|
||||
struct addrinfo *ai, *pai, hints;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (getaddrinfo("127.0.0.1", NULL, &hints, &ai) < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ai == NULL) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pai = ai;
|
||||
|
||||
while (pai) {
|
||||
if (pai->ai_family != AF_INET) {
|
||||
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
|
||||
exit(1);
|
||||
}
|
||||
if (pai->ai_addr->sa_family != AF_INET) {
|
||||
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
|
||||
exit(1);
|
||||
}
|
||||
pai = pai->ai_next;
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
exit(0);
|
||||
}
|
||||
],ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no),
|
||||
ac_cv_func_getaddrinfo=no)])
|
||||
if test "$ac_cv_func_getaddrinfo" = yes; then
|
||||
AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
${MAKE:-make} -f build/build.mk cvsclean
|
||||
${MAKE:-make} -f build/build.mk cvsclean-work
|
||||
@@ -476,6 +476,7 @@ PHP_FUNCTION(cpdf_open)
|
||||
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))) {
|
||||
cpdf_close(cpdf);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+24
-16
@@ -368,6 +368,9 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
length = -1;
|
||||
}
|
||||
else {
|
||||
if (Z_TYPE_P(retval) != IS_LONG) {
|
||||
convert_to_long_ex(&retval);
|
||||
}
|
||||
length = Z_LVAL_P(retval);
|
||||
}
|
||||
|
||||
@@ -400,7 +403,6 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
case PHP_CURL_USER: {
|
||||
zval *argv[3];
|
||||
zval *retval;
|
||||
int length;
|
||||
int error;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
@@ -422,11 +424,9 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
if (error == FAILURE) {
|
||||
php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION",
|
||||
get_active_function_name(TSRMLS_C));
|
||||
length = -1;
|
||||
}
|
||||
else {
|
||||
memcpy(data, Z_STRVAL_P(retval), size * nmemb);
|
||||
length = Z_STRLEN_P(retval);
|
||||
} else if (Z_TYPE_P(retval) == IS_STRING) {
|
||||
length = MIN(size * nmemb, Z_STRLEN_P(retval));
|
||||
memcpy(data, Z_STRVAL_P(retval), length);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&argv[0]);
|
||||
@@ -485,6 +485,9 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
length = -1;
|
||||
}
|
||||
else {
|
||||
if (Z_TYPE_P(retval) != IS_LONG) {
|
||||
convert_to_long_ex(&retval);
|
||||
}
|
||||
length = Z_LVAL_P(retval);
|
||||
}
|
||||
zval_ptr_dtor(&argv[0]);
|
||||
@@ -492,8 +495,12 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
zval_ptr_dtor(&retval);
|
||||
break;
|
||||
}
|
||||
|
||||
case PHP_CURL_IGNORE:
|
||||
return length;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
@@ -508,7 +515,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
zval *argv[3];
|
||||
zval *retval = NULL;
|
||||
int error;
|
||||
int ret = 0;
|
||||
int ret = -1;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(argv[0]);
|
||||
@@ -526,17 +533,15 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
retval, 2, argv TSRMLS_CC);
|
||||
if (error == FAILURE) {
|
||||
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_PASSWDFUNCTION", get_active_function_name(TSRMLS_C));
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
} else if (Z_TYPE_P(retval) == IS_STRING) {
|
||||
if (Z_STRLEN_P(retval) > buflen) {
|
||||
php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle",
|
||||
get_active_function_name(TSRMLS_C));
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
strlcpy(buf, Z_STRVAL_P(retval), buflen);
|
||||
} else {
|
||||
strlcpy(buf, Z_STRVAL_P(retval), Z_STRLEN_P(retval));
|
||||
}
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string.", Z_STRVAL_P(func));
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&argv[0]);
|
||||
@@ -802,7 +807,9 @@ PHP_FUNCTION(curl_setopt)
|
||||
|
||||
if (Z_LVAL_PP(zvalue)) {
|
||||
ch->handlers->write->method = PHP_CURL_RETURN;
|
||||
}
|
||||
} else {
|
||||
ch->handlers->write->method = PHP_CURL_STDOUT;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_BINARYTRANSFER:
|
||||
convert_to_long_ex(zvalue);
|
||||
@@ -1020,7 +1027,8 @@ PHP_FUNCTION(curl_exec)
|
||||
|
||||
error = curl_easy_perform(ch->cp);
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
/* CURLE_PARTIAL_FILE is returned by HEAD requests */
|
||||
if (error != CURLE_OK && error != CURLE_PARTIAL_FILE) {
|
||||
if (ch->handlers->write->buf.len > 0) {
|
||||
smart_str_free(&ch->handlers->write->buf);
|
||||
}
|
||||
|
||||
+2
-2
@@ -198,7 +198,7 @@ AC_ARG_WITH(db4,
|
||||
[ --with-db4[=DIR] DBA: Include Berkeley DB4 support],[
|
||||
if test "$withval" != "no"; then
|
||||
PHP_DBA_STD_BEGIN
|
||||
for i in $withval /usr/local/BerkeleyDB.4.1 /usr/local/BerkeleyDB.4.0 /usr/local /usr; do
|
||||
for i in $withval /usr/local/BerkeleyDB.4.2 /usr/local/BerkeleyDB.4.1 /usr/local/BerkeleyDB.4.0 /usr/local /usr; do
|
||||
if test -f "$i/db4/db.h"; then
|
||||
THIS_PREFIX=$i
|
||||
THIS_INCLUDE=$i/db4/db.h
|
||||
@@ -221,7 +221,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.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
|
||||
fi
|
||||
])
|
||||
AC_DBA_STD_RESULT(db4,Berkeley DB4)
|
||||
|
||||
@@ -163,6 +163,10 @@ PHP_FUNCTION(dio_open)
|
||||
return;
|
||||
}
|
||||
|
||||
if (php_check_open_basedir(file_name TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(file_name, "wb+", CHECKUID_CHECK_MODE_PARAM))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ZEND_NUM_ARGS() == 3) {
|
||||
fd = open(file_name, flags, mode);
|
||||
} else {
|
||||
|
||||
@@ -3981,6 +3981,9 @@ static xmlDocPtr domxml_document_parser(int mode, int loadtype, char *source, vo
|
||||
|
||||
ctxt->sax->error = domxml_error_ext;
|
||||
ctxt->sax->warning = domxml_error_ext;
|
||||
#if LIBXML_VERSION >= 20600
|
||||
ctxt->sax->cdataBlock = NULL;
|
||||
#endif
|
||||
ctxt->vctxt.userData= (void *) &errorCtxt;
|
||||
ctxt->vctxt.error = (xmlValidityErrorFunc) domxml_error_validate;
|
||||
ctxt->vctxt.warning = (xmlValidityWarningFunc) domxml_error_validate;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
--TEST--
|
||||
Bug #26384 (domxslt->process causes segfault with xsl:key)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php require_once('skipif.inc');
|
||||
if (!function_exists("domxml_xslt_stylesheet_file")) { die("skip No XSLT support found");};
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = domxml_open_mem(file_get_contents(dirname(__FILE__)."/area_name.xml"));
|
||||
|
||||
+42
-28
@@ -108,7 +108,7 @@ static char** ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRM
|
||||
|
||||
/* IP and port conversion box */
|
||||
union ipbox {
|
||||
unsigned long l[2];
|
||||
struct in_addr ia[2];
|
||||
unsigned short s[4];
|
||||
unsigned char c[8];
|
||||
};
|
||||
@@ -638,9 +638,8 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
|
||||
|
||||
sin = (struct sockaddr_in *) sa;
|
||||
sin->sin_family = AF_INET;
|
||||
sin->sin_addr.s_addr = ipbox.l[0];
|
||||
sin->sin_addr = ipbox.ia[0];
|
||||
sin->sin_port = ipbox.s[2];
|
||||
|
||||
ftp->pasv = 2;
|
||||
|
||||
return 1;
|
||||
@@ -653,7 +652,6 @@ int
|
||||
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
char *ptr;
|
||||
int lastch;
|
||||
size_t rcvd;
|
||||
char arg[11];
|
||||
@@ -704,12 +702,39 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
}
|
||||
|
||||
if (type == FTPTYPE_ASCII) {
|
||||
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
|
||||
if (lastch == '\r' && *ptr != '\n')
|
||||
char *s;
|
||||
char *ptr = data->buf;
|
||||
char *e = ptr + rcvd;
|
||||
/* logic depends on the OS EOL
|
||||
* Win32 -> \r\n
|
||||
* Everything Else \n
|
||||
*/
|
||||
#ifdef PHP_WIN32
|
||||
while ((s = strpbrk(ptr, "\r\n"))) {
|
||||
if (*s == '\n') {
|
||||
php_stream_putc(outstream, '\r');
|
||||
if (*ptr != '\r')
|
||||
php_stream_putc(outstream, *ptr);
|
||||
lastch = *ptr;
|
||||
} else if (*s == '\r' && *(s + 1) == '\n') {
|
||||
s++;
|
||||
}
|
||||
s++;
|
||||
php_stream_write(outstream, ptr, (s - ptr));
|
||||
if (*(s - 1) == '\r') {
|
||||
php_stream_putc(outstream, '\n');
|
||||
}
|
||||
ptr = s;
|
||||
}
|
||||
#else
|
||||
while ((s = memchr(ptr, '\r', (e - ptr)))) {
|
||||
php_stream_write(outstream, ptr, (s - ptr));
|
||||
if (*(s + 1) == '\n') {
|
||||
s++;
|
||||
}
|
||||
php_stream_putc(outstream, '\n');
|
||||
ptr = s + 1;
|
||||
}
|
||||
#endif
|
||||
if (ptr < e) {
|
||||
php_stream_write(outstream, ptr, (e - ptr));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -718,9 +743,6 @@ 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);
|
||||
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
|
||||
@@ -1328,7 +1350,7 @@ ftp_getdata(ftpbuf_t *ftp TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
/* send the PORT */
|
||||
ipbox.l[0] = ((struct sockaddr_in*) sa)->sin_addr.s_addr;
|
||||
ipbox.ia[0] = ((struct sockaddr_in*) sa)->sin_addr;
|
||||
ipbox.s[2] = ((struct sockaddr_in*) &addr)->sin_port;
|
||||
sprintf(arg, "%u,%u,%u,%u,%u,%u",
|
||||
ipbox.c[0], ipbox.c[1], ipbox.c[2], ipbox.c[3],
|
||||
@@ -1454,7 +1476,7 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
|
||||
char**
|
||||
ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
{
|
||||
FILE *tmpfp = NULL;
|
||||
php_stream *tmpstream = NULL;
|
||||
databuf_t *data = NULL;
|
||||
char *ptr;
|
||||
int ch, lastch;
|
||||
@@ -1464,7 +1486,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
char **entry;
|
||||
char *text;
|
||||
|
||||
if ((tmpfp = tmpfile()) == NULL) {
|
||||
if ((tmpstream = php_stream_fopen_tmpfile()) == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create temporary file. Check permissions in temporary files directory.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -1492,7 +1514,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
if (rcvd == -1)
|
||||
goto bail;
|
||||
|
||||
fwrite(data->buf, rcvd, 1, tmpfp);
|
||||
php_stream_write(tmpstream, data->buf, rcvd);
|
||||
|
||||
size += rcvd;
|
||||
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
|
||||
@@ -1506,12 +1528,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
|
||||
ftp->data = data = data_close(ftp, data);
|
||||
|
||||
if (ferror(tmpfp))
|
||||
goto bail;
|
||||
|
||||
|
||||
|
||||
rewind(tmpfp);
|
||||
php_stream_rewind(tmpstream);
|
||||
|
||||
ret = emalloc((lines + 1) * sizeof(char**) + size * sizeof(char*));
|
||||
|
||||
@@ -1519,7 +1536,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
text = (char*) (ret + lines + 1);
|
||||
*entry = text;
|
||||
lastch = 0;
|
||||
while ((ch = getc(tmpfp)) != EOF) {
|
||||
while ((ch = php_stream_getc(tmpstream)) != EOF) {
|
||||
if (ch == '\n' && lastch == '\r') {
|
||||
*(text - 1) = 0;
|
||||
*++entry = text;
|
||||
@@ -1531,10 +1548,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
}
|
||||
*entry = NULL;
|
||||
|
||||
if (ferror(tmpfp))
|
||||
goto bail;
|
||||
|
||||
fclose(tmpfp);
|
||||
php_stream_close(tmpstream);
|
||||
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
|
||||
efree(ret);
|
||||
@@ -1544,7 +1558,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
return ret;
|
||||
bail:
|
||||
ftp->data = data_close(ftp, data);
|
||||
fclose(tmpfp);
|
||||
php_stream_close(tmpstream);
|
||||
if (ret)
|
||||
efree(ret);
|
||||
return NULL;
|
||||
|
||||
+16
-2
@@ -1617,9 +1617,14 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
|
||||
switch(image_type) {
|
||||
case PHP_GDIMG_CONVERT_WBM:
|
||||
if(q<0||q>255) {
|
||||
if (q == -1) {
|
||||
q = 0;
|
||||
} else if (q < 0 || q > 255) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
|
||||
q = 0;
|
||||
}
|
||||
gdImageWBMP(im, q, fp);
|
||||
break;
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
(*func_p)(im, fp, q);
|
||||
break;
|
||||
@@ -1659,9 +1664,14 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
|
||||
switch(image_type) {
|
||||
case PHP_GDIMG_CONVERT_WBM:
|
||||
if(q<0||q>255) {
|
||||
if (q == -1) {
|
||||
q = 0;
|
||||
} else if (q < 0 || q > 255) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
|
||||
q = 0;
|
||||
}
|
||||
gdImageWBMP(im, q, tmp);
|
||||
break;
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
(*func_p)(im, tmp, q);
|
||||
break;
|
||||
@@ -3625,6 +3635,10 @@ static void _php_image_bw_convert( gdImagePtr im_org, gdIOCtx *out, int threshol
|
||||
return;
|
||||
}
|
||||
|
||||
if (im_org->trueColor) {
|
||||
gdImageTrueColorToPalette(im_org, 1, 256);
|
||||
}
|
||||
|
||||
for (y = 0; y < dest_height; y++) {
|
||||
for (x = 0; x < dest_width; x++) {
|
||||
color_org = gdImageGetPixel (im_org, x, y);
|
||||
|
||||
+13
-2
@@ -571,7 +571,7 @@ void gdImageColorTransparent (gdImagePtr im, int color)
|
||||
if (im->transparent != -1) {
|
||||
im->alpha[im->transparent] = gdAlphaOpaque;
|
||||
}
|
||||
if (color > -1 && color<=gdMaxColors) {
|
||||
if (color > -1 && color<im->colorsTotal && color<=gdMaxColors) {
|
||||
im->alpha[color] = gdAlphaTransparent;
|
||||
} else {
|
||||
return;
|
||||
@@ -1762,13 +1762,18 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
int lastBorder;
|
||||
/* Seek left */
|
||||
int leftLimit = -1, rightLimit;
|
||||
int i;
|
||||
int i, restoreAlphaBleding=0;
|
||||
|
||||
if (border < 0) {
|
||||
/* Refuse to fill to a non-solid border */
|
||||
return;
|
||||
}
|
||||
|
||||
if (im->alphaBlendingFlag) {
|
||||
restoreAlphaBleding = 1;
|
||||
im->alphaBlendingFlag = 0;
|
||||
}
|
||||
|
||||
if (x >= im->sx) {
|
||||
x = im->sx - 1;
|
||||
}
|
||||
@@ -1784,6 +1789,9 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
leftLimit = i;
|
||||
}
|
||||
if (leftLimit == -1) {
|
||||
if (restoreAlphaBleding) {
|
||||
im->alphaBlendingFlag = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* Seek right */
|
||||
@@ -1827,6 +1835,9 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (restoreAlphaBleding) {
|
||||
im->alphaBlendingFlag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
|
||||
#include "gdcache.h"
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include "freetype/ftglyph.h"
|
||||
#include FT_GLYPH_H
|
||||
|
||||
/* number of fonts cached before least recently used is replaced */
|
||||
#define FONTCACHESIZE 6
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
gdimagefill() function (Bug #19366 (fixed in bundled libgd))
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
if (!GD_BUNDLED) die('skip external GD libraries always fail');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* $id$ */
|
||||
$dest = dirname(realpath(__FILE__)) . 'bug27582.png';
|
||||
@unlink($dest);
|
||||
$im = ImageCreateTrueColor(10, 10);
|
||||
imagealphablending($im, true);
|
||||
imagesavealpha($im, false);
|
||||
$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
|
||||
$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
|
||||
ImageFillToBorder($im, 5, 5, $bordercolor, $color);
|
||||
imagepng($im, $dest);
|
||||
echo md5_file($dest) . "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
08287f8f5d406946009df5f04ca83dc0
|
||||
@@ -0,0 +1,92 @@
|
||||
--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
|
||||
/* $id */
|
||||
/*
|
||||
* This test segfaults with the current imagefilltoborder
|
||||
* implementation. A rewrite of this function is required
|
||||
* to fix it. The algorithm used in gdImageFill (and the
|
||||
* privat function for tiled fill) may help here. pierre.
|
||||
*/
|
||||
$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);
|
||||
imagefilltoborder($base,0,0,$black,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
|
||||
@@ -1,2 +1,2 @@
|
||||
InterBase
|
||||
Jouni Ahto, Andrew Avdeev
|
||||
Jouni Ahto, Andrew Avdeev, Ard Biesheuvel
|
||||
@@ -945,7 +945,7 @@ PHP_FUNCTION(ibase_connect)
|
||||
Open a persistent connection to an InterBase database */
|
||||
PHP_FUNCTION(ibase_pconnect)
|
||||
{
|
||||
_php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
||||
_php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, IBG(allow_persistent));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -1394,6 +1394,48 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit)
|
||||
stl_info.t1=(time_t)(atol(val+1));
|
||||
UdmAddTimeLimit(Agent->Conf,&stl_info);
|
||||
}
|
||||
#elif UDM_VERSION_ID >= 30210
|
||||
{
|
||||
struct tm *d_tm;
|
||||
time_t d_t;
|
||||
char *d_val2;
|
||||
char d_db[20], d_de[20];
|
||||
d_t = atol (val+1);
|
||||
d_tm = localtime (&d_t);
|
||||
if (val[0] == '>') {
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dt","er");
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dx","1");
|
||||
sprintf (d_db, "%d", d_tm->tm_mday);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dd",d_db);
|
||||
sprintf (d_db, "%d", d_tm->tm_mon);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dm",d_db);
|
||||
sprintf (d_db, "%d", d_tm->tm_year+1900);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dy",d_db);
|
||||
RETURN_TRUE;
|
||||
} else if (val[0] == '<') {
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dt","er");
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dx","-1");
|
||||
sprintf (d_db, "%d", d_tm->tm_mday);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dd",d_db);
|
||||
sprintf (d_db, "%d", d_tm->tm_mon);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dm",d_db);
|
||||
sprintf (d_db, "%d", d_tm->tm_year+1900);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dy",d_db);
|
||||
RETURN_TRUE;
|
||||
} else if ( (val[0]=='#') && (d_val2 = strchr(val,',')) ){
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dt","range");
|
||||
sprintf (d_db, "%d/%d/%d", d_tm->tm_mday, d_tm->tm_mon+1, d_tm->tm_year+1900);
|
||||
d_t = atol (d_val2+1);
|
||||
d_tm = localtime (&d_t);
|
||||
sprintf (d_de, "%d/%d/%d", d_tm->tm_mday, d_tm->tm_mon+1, d_tm->tm_year+1900);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"db",d_db);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"de",d_de);
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Incorrect date limit format");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
@@ -2200,9 +2242,9 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
|
||||
{
|
||||
int len,i;
|
||||
for(len = i = 0; i < Res->WWList.nwords; i++)
|
||||
len += Res->WWList.Word[i].len;
|
||||
len += Res->WWList.Word[i].len + 64;
|
||||
{
|
||||
size_t wsize=(1+len*15)*sizeof(char);
|
||||
size_t wsize=(1+len)*sizeof(char);
|
||||
char *wordinfo = (char*) malloc(wsize);
|
||||
|
||||
*wordinfo = '\0';
|
||||
@@ -2230,9 +2272,9 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
|
||||
{
|
||||
int len,i,j;
|
||||
for(len = i = 0; i < Res->WWList.nwords; i++)
|
||||
len += Res->WWList.Word[i].len;
|
||||
len += Res->WWList.Word[i].len + 64;
|
||||
{
|
||||
size_t wsize=(1+len*15)*sizeof(char);
|
||||
size_t wsize=(1+len)*sizeof(char);
|
||||
char *wordinfo = (char*) malloc(wsize);
|
||||
int corder = (size_t)-1, ccount = 0;
|
||||
|
||||
|
||||
@@ -996,6 +996,7 @@ static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int r
|
||||
|
||||
column_types = (int *) emalloc(sizeof(int) * result->num_fields);
|
||||
for (i=0; i<result->num_fields; i++) {
|
||||
char *source = NULL;
|
||||
char *fname = (char *)dbcolname(mssql_ptr->link,i+1);
|
||||
|
||||
if (*fname) {
|
||||
@@ -1010,8 +1011,11 @@ static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int r
|
||||
j++;
|
||||
}
|
||||
result->fields[i].max_length = dbcollen(mssql_ptr->link,i+1);
|
||||
result->fields[i].column_source = estrdup(dbcolsource(mssql_ptr->link,i+1));
|
||||
if (!result->fields[i].column_source) {
|
||||
source = (char *)dbcolsource(mssql_ptr->link,i+1);
|
||||
if (source) {
|
||||
result->fields[i].column_source = estrdup(source);
|
||||
}
|
||||
else {
|
||||
result->fields[i].column_source = empty_string;
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -1952,7 +1952,7 @@ PHP_FUNCTION(pdf_open_image_file)
|
||||
PHP_FUNCTION(pdf_open_memory_image)
|
||||
{
|
||||
zval **arg1, **arg2;
|
||||
int i, j, color, count;
|
||||
int i, j, color;
|
||||
int pdf_image;
|
||||
gdImagePtr im;
|
||||
unsigned char *buffer, *ptr;
|
||||
@@ -1970,8 +1970,7 @@ PHP_FUNCTION(pdf_open_memory_image)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, "Image", le_gd);
|
||||
|
||||
count = 3 * im->sx * im->sy;
|
||||
buffer = (unsigned char *) emalloc(count);
|
||||
buffer = (unsigned char *) safe_emalloc(3 * im->sx, im->sy, 0);
|
||||
|
||||
ptr = buffer;
|
||||
for(i=0; i<im->sy; i++) {
|
||||
|
||||
+51
-4
@@ -3853,16 +3853,63 @@ PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval
|
||||
ZVAL_STRING(new_val, "NULL", 1);
|
||||
}
|
||||
else {
|
||||
/* FIXME: better regex must be used */
|
||||
if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^[+-]{0,1}[ \\t]+((second|seconds|minute|minute|hour|hour|day|days|week|weeks|month|monthes|year|years|decade|decades|century|centuries|millennium|millenniums){1,1}[ \\t]+)+([ \\t]+ago){0,1}$", 1 TSRMLS_CC) == FAILURE &&
|
||||
php_pgsql_convert_match(Z_STRVAL_PP(val), "^@[ \\t]+[+-]{0,1}[ \\t]+(second|seconds|minute|minute|hour|hour|day|days|week|weeks|month|monthes|year|years|decade|decades|century|centuries|millennium|millenniums){1,1}[ \\t]+)+([ \\t]+ago$", 1 TSRMLS_CC) == FAILURE) {
|
||||
|
||||
/* From the Postgres docs:
|
||||
|
||||
interval values can be written with the following syntax:
|
||||
[@] quantity unit [quantity unit...] [direction]
|
||||
|
||||
Where: quantity is a number (possibly signed); unit is second, minute, hour,
|
||||
day, week, month, year, decade, century, millennium, or abbreviations or
|
||||
plurals of these units [note not *all* abbreviations] ; direction can be
|
||||
ago or empty. The at sign (@) is optional noise.
|
||||
|
||||
...
|
||||
|
||||
Quantities of days, hours, minutes, and seconds can be specified without explicit
|
||||
unit markings. For example, '1 12:59:10' is read the same as '1 day 12 hours 59 min 10
|
||||
sec'.
|
||||
*/
|
||||
if (php_pgsql_convert_match(Z_STRVAL_PP(val),
|
||||
"^(@?[ \\t]+)?("
|
||||
|
||||
/* Textual time units and their abbreviations: */
|
||||
"(([-+]?[ \\t]+)?"
|
||||
"[0-9]+(\\.[0-9]*)?[ \\t]*"
|
||||
"(millenniums|millennia|millennium|mil|mils|"
|
||||
"centuries|century|cent|c|"
|
||||
"decades|decade|dec|decs|"
|
||||
"years|year|y|"
|
||||
"months|month|mon|"
|
||||
"weeks|week|w|"
|
||||
"days|day|d|"
|
||||
"hours|hour|hr|hrs|h|"
|
||||
"minutes|minute|mins|min|m|"
|
||||
"seconds|second|secs|sec|s))+|"
|
||||
|
||||
/* Textual time units plus (dd)* hh[:mm[:ss]] */
|
||||
"((([-+]?[ \\t]+)?"
|
||||
"[0-9]+(\\.[0-9]*)?[ \\t]*"
|
||||
"(millenniums|millennia|millennium|mil|mils|"
|
||||
"centuries|century|cent|c|"
|
||||
"decades|decade|dec|decs|"
|
||||
"years|year|y|"
|
||||
"months|month|mon|"
|
||||
"weeks|week|w|"
|
||||
"days|day|d))+"
|
||||
"([-+]?[ \\t]+"
|
||||
"([0-9]+[ \\t]+)+" /* dd */
|
||||
"(([0-9]{1,2}:){0,2}[0-9]{0,2})" /* hh:[mm:[ss]] */
|
||||
")?))"
|
||||
"([ \\t]+ago)?$",
|
||||
1 TSRMLS_CC) == FAILURE) {
|
||||
err = 1;
|
||||
}
|
||||
else {
|
||||
ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
|
||||
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IS_NULL:
|
||||
|
||||
@@ -224,7 +224,7 @@ PHPAPI void php_session_start(TSRMLS_D);
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
ZEND_EXTERN_MODULE_GLOBALS(ps)
|
||||
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(ps)
|
||||
|
||||
void php_session_auto_start(void *data);
|
||||
void php_session_shutdown(void *data);
|
||||
|
||||
+16
-4
@@ -79,7 +79,7 @@ function_entry session_functions[] = {
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(ps);
|
||||
PHPAPI ZEND_DECLARE_MODULE_GLOBALS(ps);
|
||||
|
||||
static ps_module *_php_find_ps_module(char *name TSRMLS_DC);
|
||||
static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
|
||||
@@ -596,7 +596,7 @@ static void php_session_initialize(TSRMLS_D)
|
||||
|
||||
/* Open session handler first */
|
||||
if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name) TSRMLS_CC) == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize storage module.");
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1369,7 +1369,7 @@ PHP_FUNCTION(session_register)
|
||||
if (argc <= 0)
|
||||
RETURN_FALSE
|
||||
else
|
||||
args = (zval ***)emalloc(argc * sizeof(zval **));
|
||||
args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
|
||||
|
||||
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
|
||||
efree(args);
|
||||
@@ -1612,14 +1612,26 @@ PHP_RSHUTDOWN_FUNCTION(session)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void php_minit_session_globals(php_ps_globals *ps_globals)
|
||||
{
|
||||
ps_globals->save_path = NULL;
|
||||
ps_globals->session_name = NULL;
|
||||
ps_globals->id = NULL;
|
||||
ps_globals->mod = NULL;
|
||||
ps_globals->mod_data = NULL;
|
||||
ps_globals->session_status = php_session_none;
|
||||
ps_globals->http_session_vars = NULL;
|
||||
}
|
||||
|
||||
PHP_MINIT_FUNCTION(session)
|
||||
{
|
||||
#ifdef ZTS
|
||||
php_ps_globals *ps_globals;
|
||||
|
||||
ts_allocate_id(&ps_globals_id, sizeof(php_ps_globals), NULL, NULL);
|
||||
ts_allocate_id(&ps_globals_id, sizeof(php_ps_globals), (ts_allocate_ctor) php_minit_session_globals, NULL);
|
||||
ps_globals = ts_resource(ps_globals_id);
|
||||
#else
|
||||
php_minit_session_globals(&ps_globals);
|
||||
#endif
|
||||
|
||||
zend_register_auto_global("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC);
|
||||
|
||||
+15
-1
@@ -294,6 +294,7 @@ static int php_read(int bsd_socket, void *buf, size_t maxlen, int flags)
|
||||
|
||||
set_errno(0);
|
||||
|
||||
*t = '\0';
|
||||
while (*t != '\n' && *t != '\r' && n < maxlen) {
|
||||
if (m > 0) {
|
||||
t++;
|
||||
@@ -808,7 +809,10 @@ PHP_FUNCTION(socket_read)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &length, &type) == FAILURE)
|
||||
return;
|
||||
|
||||
if(length<0) RETURN_FALSE;
|
||||
/* overflow check */
|
||||
if((length + 1) < 2) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
tmpbuf = emalloc(length + 1);
|
||||
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket *, &arg1, -1, le_socket_name, le_socket);
|
||||
@@ -1372,6 +1376,11 @@ PHP_FUNCTION(socket_recv)
|
||||
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket *, &php_sock_res, -1, le_socket_name, le_socket);
|
||||
|
||||
/* overflow check */
|
||||
if ((len + 1) < 2) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
recv_buf = emalloc(len + 1);
|
||||
memset(recv_buf, 0, len + 1);
|
||||
|
||||
@@ -1446,6 +1455,11 @@ PHP_FUNCTION(socket_recvfrom)
|
||||
|
||||
if(arg3<0) RETURN_FALSE;
|
||||
|
||||
/* overflow check */
|
||||
if ((arg3 + 2) < 3) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
recv_buf = emalloc(arg3 + 2);
|
||||
memset(recv_buf, 0, arg3 + 2);
|
||||
|
||||
|
||||
@@ -188,7 +188,6 @@ PHPAPI unsigned char *php_base64_decode(const unsigned char *str, int length, in
|
||||
/* mop things up if we ended on a boundary */
|
||||
if (ch == base64_pad) {
|
||||
switch(i % 4) {
|
||||
case 0:
|
||||
case 1:
|
||||
efree(result);
|
||||
return NULL;
|
||||
|
||||
@@ -1442,8 +1442,8 @@ PHP_FUNCTION(getopt)
|
||||
* in order to be on the safe side, even though it is also available
|
||||
* from the symbol table.
|
||||
*/
|
||||
if (zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"),
|
||||
(void **) &args) != FAILURE) {
|
||||
if (zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE ||
|
||||
zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void **) &args) != FAILURE) {
|
||||
int pos = 0;
|
||||
zval **arg;
|
||||
|
||||
|
||||
+85
-23
@@ -22,6 +22,7 @@
|
||||
#include "php_regex.h"
|
||||
#include "php_browscap.h"
|
||||
#include "php_ini.h"
|
||||
#include "php_string.h"
|
||||
|
||||
#include "zend_globals.h"
|
||||
|
||||
@@ -47,9 +48,13 @@ static void convert_browscap_pattern(zval *pattern)
|
||||
register int i, j;
|
||||
char *t;
|
||||
|
||||
t = (char *) malloc(Z_STRLEN_P(pattern)*2 + 1);
|
||||
php_strtolower(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern));
|
||||
|
||||
for (i=0, j=0; i<Z_STRLEN_P(pattern); i++, j++) {
|
||||
t = (char *) malloc(Z_STRLEN_P(pattern)*2 + 3);
|
||||
|
||||
t[0] = '^';
|
||||
|
||||
for (i=0, j=1; i<Z_STRLEN_P(pattern); i++, j++) {
|
||||
switch (Z_STRVAL_P(pattern)[i]) {
|
||||
case '?':
|
||||
t[j] = '.';
|
||||
@@ -68,9 +73,7 @@ static void convert_browscap_pattern(zval *pattern)
|
||||
}
|
||||
}
|
||||
|
||||
if (j && (t[j-1] == '.')) {
|
||||
t[j++] = '*';
|
||||
}
|
||||
t[j++] = '$';
|
||||
|
||||
t[j]=0;
|
||||
Z_STRVAL_P(pattern) = t;
|
||||
@@ -181,36 +184,89 @@ PHP_MSHUTDOWN_FUNCTION(browscap)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ browser_reg_compare
|
||||
*/
|
||||
static int browser_reg_compare(zval **browser, int num_args, va_list args, zend_hash_key *key)
|
||||
{
|
||||
zval **browser_name, **current;
|
||||
zval **browser_regex, **previous_match;
|
||||
regex_t r;
|
||||
char *lookup_browser_name = va_arg(args, char *);
|
||||
zval **found_browser_entry = va_arg(args, zval **);
|
||||
|
||||
if (zend_hash_find(Z_ARRVAL_PP(browser), "browser_name_regex", sizeof("browser_name_regex"), (void **) &browser_name) == FAILURE) {
|
||||
/* See if we have an exact match, if so, we're done... */
|
||||
if (*found_browser_entry) {
|
||||
if (zend_hash_find(Z_ARRVAL_PP(found_browser_entry), "browser_name_pattern", sizeof("browser_name_pattern"), (void**) &previous_match) == FAILURE) {
|
||||
return 0;
|
||||
}
|
||||
else if (!strcasecmp(Z_STRVAL_PP(previous_match), lookup_browser_name)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (zend_hash_find(Z_ARRVAL_PP(browser), "browser_name_regex", sizeof("browser_name_regex"), (void **) &browser_regex) == FAILURE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*found_browser_entry) {
|
||||
/* If we've found a possible browser, check it's length. Longer user
|
||||
agent strings are assumed to be more precise, so use them. */
|
||||
if (zend_hash_find(Z_ARRVAL_PP(found_browser_entry), "browser_name_regex", sizeof("browser_name_regex"), (void**) ¤t) == FAILURE) {
|
||||
return 0;
|
||||
}
|
||||
else if (Z_STRLEN_PP(current) > Z_STRLEN_PP(browser_name)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (regcomp(&r, Z_STRVAL_PP(browser_name), REG_NOSUB)!=0) {
|
||||
if (regcomp(&r, Z_STRVAL_PP(browser_regex), REG_NOSUB)!=0) {
|
||||
return 0;
|
||||
}
|
||||
if (regexec(&r, lookup_browser_name, 0, NULL, 0)==0) {
|
||||
*found_browser_entry = *browser;
|
||||
/* If we've found a possible browser, we need to do a comparison of the
|
||||
number of characters changed in the user agent being checked versus
|
||||
the previous match found and the current match. */
|
||||
if (*found_browser_entry) {
|
||||
int i, prev_len = 0, curr_len = 0, ua_len;
|
||||
zval **current_match;
|
||||
|
||||
if (zend_hash_find(Z_ARRVAL_PP(browser), "browser_name_pattern", sizeof("browser_name_pattern"), (void**) ¤t_match) == FAILURE) {
|
||||
regfree(&r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ua_len = strlen(lookup_browser_name);
|
||||
|
||||
for (i = 0; i < Z_STRLEN_PP(previous_match); i++) {
|
||||
switch (Z_STRVAL_PP(previous_match)[i]) {
|
||||
case '?':
|
||||
case '*':
|
||||
/* do nothing, ignore these characters in the count */
|
||||
break;
|
||||
|
||||
default:
|
||||
++prev_len;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < Z_STRLEN_PP(current_match); i++) {
|
||||
switch (Z_STRVAL_PP(current_match)[i]) {
|
||||
case '?':
|
||||
case '*':
|
||||
/* do nothing, ignore these characters in the count */
|
||||
break;
|
||||
|
||||
default:
|
||||
++curr_len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Pick which browser pattern replaces the least amount of
|
||||
characters when compared to the original user agent string... */
|
||||
if (ua_len - prev_len > ua_len - curr_len) {
|
||||
*found_browser_entry = *browser;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*found_browser_entry = *browser;
|
||||
}
|
||||
}
|
||||
regfree(&r);
|
||||
|
||||
if (&r) {
|
||||
regfree(&r);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -235,7 +291,7 @@ PHP_FUNCTION(get_browser)
|
||||
if (ZEND_NUM_ARGS() > 2 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &agent_name, &retarr) == FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
|
||||
if (agent_name == NULL || Z_TYPE_PP(agent_name) == IS_NULL) {
|
||||
if (!PG(http_globals)[TRACK_VARS_SERVER]
|
||||
|| zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &agent_name)==FAILURE) {
|
||||
@@ -245,20 +301,22 @@ PHP_FUNCTION(get_browser)
|
||||
}
|
||||
|
||||
convert_to_string_ex(agent_name);
|
||||
lookup_browser_name = estrndup(Z_STRVAL_PP(agent_name), Z_STRLEN_PP(agent_name));
|
||||
php_strtolower(lookup_browser_name, strlen(lookup_browser_name));
|
||||
|
||||
if (ZEND_NUM_ARGS() == 2) {
|
||||
convert_to_boolean_ex(retarr);
|
||||
return_array = Z_BVAL_PP(retarr);
|
||||
}
|
||||
|
||||
if (zend_hash_find(&browser_hash, Z_STRVAL_PP(agent_name), Z_STRLEN_PP(agent_name)+1, (void **) &agent)==FAILURE) {
|
||||
lookup_browser_name = Z_STRVAL_PP(agent_name);
|
||||
if (zend_hash_find(&browser_hash, lookup_browser_name, strlen(lookup_browser_name)+1, (void **) &agent)==FAILURE) {
|
||||
found_browser_entry = NULL;
|
||||
zend_hash_apply_with_arguments(&browser_hash, (apply_func_args_t) browser_reg_compare, 2, lookup_browser_name, &found_browser_entry);
|
||||
|
||||
if (found_browser_entry) {
|
||||
agent = &found_browser_entry;
|
||||
} else if (zend_hash_find(&browser_hash, DEFAULT_SECTION_NAME, sizeof(DEFAULT_SECTION_NAME), (void **) &agent)==FAILURE) {
|
||||
efree(lookup_browser_name);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -284,6 +342,10 @@ PHP_FUNCTION(get_browser)
|
||||
zend_hash_merge(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (lookup_browser_name) {
|
||||
efree(lookup_browser_name);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
ta->tm_year = Z_LVAL_PP(arguments[5])
|
||||
- ((Z_LVAL_PP(arguments[5]) > 1000) ? 1900 : 0);
|
||||
/* fall-through */
|
||||
case 5: /* day in month (1-baesd) */
|
||||
case 5: /* day in month (1-based) */
|
||||
val = (*arguments[4])->value.lval;
|
||||
if (val < 1) {
|
||||
chgsecs += (1-val) * 60*60*24;
|
||||
@@ -192,8 +192,14 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
|
||||
/* fall-through */
|
||||
case 1: /* hour */
|
||||
val = (*arguments[0])->value.lval;
|
||||
if (val < 1) {
|
||||
chgsecs += (1-val) * 60*60; val = 1;
|
||||
/*
|
||||
We don't use 1 here to work around problems in some mktime implementations
|
||||
when it comes to daylight savings time. Setting it to 2 and working back from
|
||||
there with the chgsecs offset makes us immune to these problems.
|
||||
See http://bugs.php.net/27533 for more info.
|
||||
*/
|
||||
if (val < 2) {
|
||||
chgsecs += (2-val) * 60*60; val = 2;
|
||||
}
|
||||
ta->tm_hour = val;
|
||||
/* fall-through */
|
||||
|
||||
+1
-1
@@ -275,7 +275,7 @@ PHP_FUNCTION(chdir)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (PG(safe_mode) && !php_checkuid(str, NULL, CHECKUID_ALLOW_ONLY_FILE)) {
|
||||
if (PG(safe_mode) && !php_checkuid(str, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ret = VCWD_CHDIR(str);
|
||||
|
||||
@@ -613,6 +613,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC)
|
||||
*tmp = **(args[argnum]);
|
||||
zval_copy_ctor(tmp);
|
||||
} else {
|
||||
SEPARATE_ZVAL(args[argnum]);
|
||||
tmp = *(args[argnum]);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -544,10 +544,10 @@ inline static unsigned short get_next_char(enum entity_charset charset,
|
||||
case cs_big5hkscs:
|
||||
{
|
||||
/* check if this is the first of a 2-byte sequence */
|
||||
if (this_char >= 0xa1 && this_char <= 0xf9) {
|
||||
if (this_char >= 0xa1 && this_char <= 0xfe) {
|
||||
/* peek at the next char */
|
||||
unsigned char next_char = str[pos];
|
||||
if ((next_char >= 0x40 && next_char <= 0x73) ||
|
||||
if ((next_char >= 0x40 && next_char <= 0x7e) ||
|
||||
(next_char >= 0xa1 && next_char <= 0xfe)) {
|
||||
/* yes, this a wide char */
|
||||
this_char <<= 8;
|
||||
|
||||
@@ -339,17 +339,22 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
|
||||
}
|
||||
|
||||
|
||||
if (!php_stream_eof(stream)) {
|
||||
if (!php_stream_eof(stream)) {
|
||||
size_t tmp_line_len;
|
||||
/* get response header */
|
||||
|
||||
if (php_stream_gets(stream, tmp_line, sizeof(tmp_line)-1) != NULL) {
|
||||
if (_php_stream_get_line(stream, tmp_line, sizeof(tmp_line) - 1, &tmp_line_len TSRMLS_CC) != NULL) {
|
||||
zval *http_response;
|
||||
int response_code;
|
||||
|
||||
MAKE_STD_ZVAL(http_response);
|
||||
ZVAL_NULL(http_response);
|
||||
|
||||
response_code = atoi(tmp_line + 9);
|
||||
if (tmp_line_len > 9) {
|
||||
response_code = atoi(tmp_line + 9);
|
||||
} else {
|
||||
response_code = 0;
|
||||
}
|
||||
switch(response_code) {
|
||||
case 200:
|
||||
case 302:
|
||||
@@ -361,11 +366,15 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
|
||||
tmp_line, response_code);
|
||||
break;
|
||||
default:
|
||||
/* safety net in the event tmp_line == NULL */
|
||||
if (!tmp_line_len) {
|
||||
tmp_line[0] = '\0';
|
||||
}
|
||||
php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE,
|
||||
tmp_line, response_code);
|
||||
}
|
||||
|
||||
Z_STRLEN_P(http_response) = strlen(tmp_line);
|
||||
Z_STRLEN_P(http_response) = tmp_line_len;
|
||||
Z_STRVAL_P(http_response) = estrndup(tmp_line, Z_STRLEN_P(http_response));
|
||||
if (Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=='\n') {
|
||||
Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=0;
|
||||
@@ -378,6 +387,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
|
||||
Z_TYPE_P(http_response) = IS_STRING;
|
||||
zend_hash_next_index_insert(Z_ARRVAL_PP(response_header), &http_response, sizeof(zval *), NULL);
|
||||
}
|
||||
} else {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed, unexpected end of socket!");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* read past HTTP headers */
|
||||
|
||||
+1
-1
@@ -974,7 +974,7 @@ PHP_FUNCTION(php_uname)
|
||||
/* {{{ proto string php_ini_scanned_files(void)
|
||||
Return comma-separated string of .ini files parsed from the additional ini dir */
|
||||
PHP_FUNCTION(php_ini_scanned_files) {
|
||||
if(strlen(PHP_CONFIG_FILE_SCAN_DIR)) {
|
||||
if(strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) {
|
||||
RETURN_STRING(php_ini_scanned_files,1);
|
||||
} else RETURN_FALSE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -320,7 +320,7 @@ PHP_FUNCTION(iptcparse)
|
||||
tagsfound = 0; /* number of tags already found */
|
||||
|
||||
while (inx < length) { /* find 1st tag */
|
||||
if ((buffer[inx] == 0x1c) && (buffer[inx+1] == 0x02)){
|
||||
if ((buffer[inx] == 0x1c) && ((buffer[inx+1] == 0x01) || (buffer[inx+1] == 0x02))){
|
||||
break;
|
||||
} else {
|
||||
inx++;
|
||||
|
||||
+1
-1
@@ -642,7 +642,7 @@ PHP_FUNCTION(unpack)
|
||||
/* Space for name + number, safe as namelen is ensured <= 200 */
|
||||
char n[256];
|
||||
|
||||
if (arg != 1) {
|
||||
if (arg != 1 || namelen == 0) {
|
||||
/* Need to add element number to name */
|
||||
sprintf(n, "%.*s%d", namelen, name, i + 1);
|
||||
} else {
|
||||
|
||||
@@ -923,7 +923,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
|
||||
if (!(flags & SCAN_SUPPRESS)) {
|
||||
if (numVars) {
|
||||
current = args[objIndex++];
|
||||
convert_to_string( *current );
|
||||
zval_dtor( *current );
|
||||
ZVAL_STRINGL( *current, string, end-string, 1);
|
||||
} else {
|
||||
add_index_stringl(*return_value, objIndex++, string, end-string, 1);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #27278 (*printf() functions treat arguments as if passed by reference)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function foo ($a)
|
||||
{
|
||||
$a=sprintf("%02d",$a);
|
||||
var_dump($a);
|
||||
}
|
||||
|
||||
$x="02";
|
||||
var_dump($x);
|
||||
foo($x);
|
||||
var_dump($x);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "02"
|
||||
string(2) "02"
|
||||
string(2) "02"
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #27295 (memory leak inside sscanf())
|
||||
--FILE--
|
||||
<?php
|
||||
$strings = array("foo = bar", "bar = foo");
|
||||
foreach( $strings as $string )
|
||||
{
|
||||
sscanf( $string, "%s = %[^[]]", $var, $val );
|
||||
echo "$var = $val\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
foo = bar
|
||||
bar = foo
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #27457 (Problem with strtr() and translation array)
|
||||
--FILE--
|
||||
<?php
|
||||
$test = "Dot in brackets [.]\n";
|
||||
echo $test;
|
||||
$test = strtr($test, array('.' => '0'));
|
||||
echo $test;
|
||||
$test = strtr($test, array('0' => '.'));
|
||||
echo $test;
|
||||
$test = strtr($test, '.', '0');
|
||||
echo $test;
|
||||
$test = strtr($test, '0', '.');
|
||||
echo $test;
|
||||
?>
|
||||
--EXPECT--
|
||||
Dot in brackets [.]
|
||||
Dot in brackets [0]
|
||||
Dot in brackets [.]
|
||||
Dot in brackets [0]
|
||||
Dot in brackets [.]
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #27287 (segfault with deserializing object data)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo {
|
||||
}
|
||||
$foo = new foo();
|
||||
$foo->abc = 'def';
|
||||
|
||||
$string = wddx_serialize_value($foo);
|
||||
$bar = wddx_deserialize($string);
|
||||
|
||||
echo "OK\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -57,11 +57,11 @@ static char* convert(const char* src, int src_len, int *new_len, const char* fro
|
||||
char* outbuf = 0;
|
||||
|
||||
if(src && src_len && from_enc && to_enc) {
|
||||
int outlenleft = src_len;
|
||||
size_t outlenleft = src_len;
|
||||
size_t inlenleft = src_len;
|
||||
int outlen = src_len;
|
||||
int inlenleft = src_len;
|
||||
iconv_t ic = iconv_open(to_enc, from_enc);
|
||||
char* src_ptr = (char*)src;
|
||||
char const *src_ptr = src;
|
||||
char* out_ptr = 0;
|
||||
|
||||
if(ic != (iconv_t)-1) {
|
||||
|
||||
+2
-7
@@ -647,14 +647,9 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
|
||||
#else
|
||||
{
|
||||
myuid = php_getuid();
|
||||
result = emalloc(sizeof("WWW-Authenticate: ")+20);
|
||||
newlen = sprintf(result, "WWW-Authenticate: %ld", myuid);
|
||||
newheader = estrndup(result,newlen);
|
||||
efree(header_line);
|
||||
sapi_header.header = newheader;
|
||||
sapi_header.header_len = newlen;
|
||||
efree(result);
|
||||
}
|
||||
sapi_header.header_len = spprintf(&sapi_header.header, 0, "WWW-Authenticate: Basic realm=\"%ld\"", myuid);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (sapi_header.header==header_line) {
|
||||
|
||||
@@ -132,11 +132,13 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
|
||||
if ((expand_filepath(path, resolved_name TSRMLS_CC) != NULL) && (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != NULL)) {
|
||||
/* Handler for basedirs that end with a / */
|
||||
resolved_basedir_len = strlen(resolved_basedir);
|
||||
if (resolved_basedir[resolved_basedir_len -1] != PHP_DIR_SEPARATOR) {
|
||||
resolved_basedir[resolved_basedir_len] = PHP_DIR_SEPARATOR;
|
||||
resolved_basedir[++resolved_basedir_len] = '\0';
|
||||
if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR) {
|
||||
if (resolved_basedir[resolved_basedir_len - 1] == '/') {
|
||||
resolved_basedir[resolved_basedir_len - 1] = PHP_DIR_SEPARATOR;
|
||||
resolved_basedir[++resolved_basedir_len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (path[strlen(path)-1] == PHP_DIR_SEPARATOR) {
|
||||
resolved_name_len = strlen(resolved_name);
|
||||
if (resolved_name[resolved_name_len - 1] != PHP_DIR_SEPARATOR) {
|
||||
|
||||
+2
-2
@@ -3,5 +3,5 @@
|
||||
#define PHP_MAJOR_VERSION 4
|
||||
#define PHP_MINOR_VERSION 3
|
||||
#define PHP_RELEASE_VERSION 5
|
||||
#define PHP_EXTRA_VERSION "RC3"
|
||||
#define PHP_VERSION "4.3.5RC3"
|
||||
#define PHP_EXTRA_VERSION "RC4"
|
||||
#define PHP_VERSION "4.3.5RC4"
|
||||
+1
-1
@@ -2395,7 +2395,7 @@ static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, char
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (PG(safe_mode) &&(!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
|
||||
if (PG(safe_mode) &&(!php_checkuid(path, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+10
-1
@@ -40,6 +40,15 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
define('PEAR_OS', 'Unix'); // blatant assumption
|
||||
}
|
||||
|
||||
// instant backwards compatibility
|
||||
if (!defined('PATH_SEPARATOR')) {
|
||||
if (OS_WINDOWS) {
|
||||
define('PATH_SEPARATOR', ';');
|
||||
} else {
|
||||
define('PATH_SEPARATOR', ':');
|
||||
}
|
||||
}
|
||||
|
||||
$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN;
|
||||
$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE;
|
||||
$GLOBALS['_PEAR_destructor_object_list'] = array();
|
||||
@@ -184,7 +193,7 @@ class PEAR
|
||||
/**
|
||||
* If you have a class that's mostly/entirely static, and you need static
|
||||
* properties, you can use this method to simulate them. Eg. in your method(s)
|
||||
* do this: $myVar = &PEAR::getStaticProperty('myVar');
|
||||
* do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
|
||||
* You MUST use a reference, or they will not persist!
|
||||
*
|
||||
* @access public
|
||||
|
||||
@@ -162,7 +162,7 @@ class PEAR_Autoloader extends PEAR
|
||||
$classname = strtolower($classname);
|
||||
reset($this->_method_map);
|
||||
while (list($method, $obj) = each($this->_method_map)) {
|
||||
if (get_class($obj) == $classname) {
|
||||
if (is_a($obj, $classname)) {
|
||||
unset($this->_method_map[$method]);
|
||||
$ok = true;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class PEAR_Builder extends PEAR_Common
|
||||
($r == 'yes' || $r == 'autodetect')) {
|
||||
$configure_command .= " --$o[name]";
|
||||
} else {
|
||||
$configure_command .= " --$o[name]=$r";
|
||||
$configure_command .= " --$o[name]=".trim($r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class PEAR_Command
|
||||
function &setFrontendClass($uiclass)
|
||||
{
|
||||
if (is_object($GLOBALS['_PEAR_Command_uiobject']) &&
|
||||
strtolower($uiclass) == get_class($GLOBALS['_PEAR_Command_uiobject'])) {
|
||||
is_a($GLOBALS['_PEAR_Command_uiobject'], $uiclass)) {
|
||||
return $GLOBALS['_PEAR_Command_uiobject'];
|
||||
}
|
||||
if (!class_exists($uiclass)) {
|
||||
|
||||
@@ -435,8 +435,10 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
|
||||
function doRunTests($command, $options, $params)
|
||||
{
|
||||
$cwd = getcwd();
|
||||
$php = PHP_BINDIR . '/php' . (OS_WINDOWS ? '.exe' : '');
|
||||
$php = $this->config->get('php_bin');
|
||||
putenv("TEST_PHP_EXECUTABLE=$php");
|
||||
// all core PEAR tests use this constant to determine whether they should be run or not
|
||||
putenv("PHP_PEAR_RUNTESTS=1");
|
||||
$ip = ini_get("include_path");
|
||||
$ps = OS_WINDOWS ? ';' : ':';
|
||||
$run_tests = $rtsts = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . 'run-tests.php';
|
||||
@@ -447,9 +449,19 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
|
||||
"file from the sources of your PHP distribution to $rtsts");
|
||||
}
|
||||
}
|
||||
$plist = implode(" ", $params);
|
||||
$cmd = "$php -C -d include_path=$cwd$ps$ip -f $run_tests -- $plist";
|
||||
system($cmd);
|
||||
if (OS_WINDOWS) {
|
||||
// note, this requires a slightly modified version of run-tests.php
|
||||
// for some setups
|
||||
// unofficial download location is in the pear-dev archives
|
||||
$argv = $params;
|
||||
array_unshift($argv, $run_tests);
|
||||
$argc = count($argv);
|
||||
include $run_tests;
|
||||
} else {
|
||||
$plist = implode(' ', $params);
|
||||
$cmd = "$php -d include_path=$cwd$ps$ip -f $run_tests -- $plist";
|
||||
system($cmd);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -612,6 +612,20 @@ class PEAR_Downloader extends PEAR_Common
|
||||
$this->ui->_downloadCallback($msg, $params);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ _prependPath($path, $prepend)
|
||||
|
||||
function _prependPath($path, $prepend)
|
||||
{
|
||||
if (strlen($prepend) > 0) {
|
||||
if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
|
||||
$path = $prepend . substr($path, 2);
|
||||
} else {
|
||||
$path = $prepend . $path;
|
||||
}
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
// }}}
|
||||
// {{{ pushError($errmsg, $code)
|
||||
|
||||
|
||||
@@ -539,21 +539,6 @@ class PEAR_Installer extends PEAR_Downloader
|
||||
return parent::mkDirHier($dir);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ _prependPath($path, $prepend)
|
||||
|
||||
function _prependPath($path, $prepend)
|
||||
{
|
||||
if (strlen($prepend) > 0) {
|
||||
if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
|
||||
$path = $prepend . substr($path, 2);
|
||||
} else {
|
||||
$path = $prepend . $path;
|
||||
}
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ download()
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
<release>
|
||||
<version>1.3b6</version>
|
||||
<date>2004-01-26</date>
|
||||
<state>beta</state>
|
||||
<version>1.3</version>
|
||||
<date>2004-02-20</date>
|
||||
<state>stable</state>
|
||||
<notes>
|
||||
PEAR Installer:
|
||||
* Bug #171 --alldeps with a rel="eq" should install the required version, if possible
|
||||
@@ -121,7 +121,7 @@ PEAR Installer:
|
||||
</dir>
|
||||
</filelist>
|
||||
<deps>
|
||||
<dep type="php" rel="ge" version="4.1"/>
|
||||
<dep type="php" rel="ge" version="4.2"/>
|
||||
<dep type="pkg" rel="ge" version="1.1">Archive_Tar</dep>
|
||||
<dep type="pkg" rel="ge" version="1.2">Console_Getopt</dep>
|
||||
<dep type="pkg" rel="ge" version="1.0.4">XML_RPC</dep>
|
||||
|
||||
Binary file not shown.
@@ -16,7 +16,7 @@ REM ----------------------------------------------------------------------
|
||||
REM Authors: Alexander Merz (alexmerz@php.net)
|
||||
REM ----------------------------------------------------------------------
|
||||
REM
|
||||
REM $Id: pear.bat,v 1.18 2004/01/08 17:33:14 sniper Exp $
|
||||
REM Last updated 3/13/2004 ($Id$ is not replaced if the file is binary)
|
||||
|
||||
REM change this lines to match the paths of your system
|
||||
REM -------------------
|
||||
@@ -64,6 +64,6 @@ ECHO The current value is:
|
||||
ECHO %PHP_PEAR_PHP_BIN%
|
||||
GOTO END
|
||||
:RUN
|
||||
"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d register_argc_argv=On -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
:END
|
||||
@ECHO ON
|
||||
@@ -28,7 +28,9 @@ if ('@include_path@' != '@'.'include_path'.'@') {
|
||||
ini_set('include_path', '@include_path@');
|
||||
}
|
||||
ini_set('allow_url_fopen', true);
|
||||
set_time_limit(0);
|
||||
if (!ini_get('safe_mode')) {
|
||||
set_time_limit(0);
|
||||
}
|
||||
ob_implicit_flush(true);
|
||||
ini_set('track_errors', true);
|
||||
ini_set('html_errors', false);
|
||||
|
||||
@@ -238,7 +238,10 @@ php_apache_sapi_flush(void *server_context)
|
||||
if (!server_context)
|
||||
return;
|
||||
|
||||
sapi_send_headers(TSRMLS_C);
|
||||
|
||||
ctx->r->status = SG(sapi_headers).http_response_code;
|
||||
SG(headers_sent) = 1;
|
||||
|
||||
f = ctx->f;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
/* UnixWare and Netware define shutdown to _shutdown, which causes problems later
|
||||
* on when using a structure member named shutdown. Since this source
|
||||
* file does not use the system call shutdown, it is safe to #undef it.
|
||||
* file does not use the system call shutdown, it is safe to #undef it.K
|
||||
*/
|
||||
#undef shutdown
|
||||
|
||||
@@ -261,6 +261,8 @@ php_apache_sapi_flush(void *server_context)
|
||||
r = ctx->r;
|
||||
brigade = ctx->brigade;
|
||||
|
||||
sapi_send_headers(TSRMLS_C);
|
||||
|
||||
r->status = SG(sapi_headers).http_response_code;
|
||||
SG(headers_sent) = 1;
|
||||
|
||||
@@ -286,11 +288,18 @@ static void php_apache_sapi_log_message(char *msg)
|
||||
* with Apache 1.3 -- rbb
|
||||
*/
|
||||
if (ctx == NULL) { /* we haven't initialized our ctx yet, oh well */
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP,
|
||||
0, NULL, "%s", msg);
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, 0, NULL, "%s", msg);
|
||||
} else {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP,
|
||||
0, ctx->r, "%s", msg);
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, 0, ctx->r, "%s", msg);
|
||||
}
|
||||
}
|
||||
|
||||
static void php_apache_sapi_log_message_ex(char *msg, request_rec *r)
|
||||
{
|
||||
if (r) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, 0, r, msg, r->filename);
|
||||
} else {
|
||||
php_apache_sapi_log_message(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,14 +493,14 @@ static int php_handler(request_rec *r)
|
||||
}
|
||||
|
||||
if (r->finfo.filetype == 0) {
|
||||
php_apache_sapi_log_message("script not found or unable to stat");
|
||||
php_apache_sapi_log_message_ex("script '%s' not found or unable to stat", r);
|
||||
zend_try {
|
||||
zend_ini_deactivate(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
return HTTP_NOT_FOUND;
|
||||
}
|
||||
if (r->finfo.filetype == APR_DIR) {
|
||||
php_apache_sapi_log_message("attempt to invoke directory as script");
|
||||
php_apache_sapi_log_message_ex("attempt to invoke directory '%s' as script", r);
|
||||
zend_try {
|
||||
zend_ini_deactivate(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
|
||||
@@ -1106,6 +1106,7 @@ int main(int argc, char *argv[])
|
||||
in case some server does something different than above */
|
||||
&& (!redirect_status_env || !getenv(redirect_status_env))
|
||||
) {
|
||||
SG(sapi_headers).http_response_code = 400;
|
||||
PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\
|
||||
<p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
|
||||
means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
|
||||
|
||||
@@ -854,6 +854,7 @@ __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, L
|
||||
if (isapi_sapi_module.shutdown) {
|
||||
isapi_sapi_module.shutdown(&sapi_module);
|
||||
}
|
||||
sapi_shutdown();
|
||||
tsrm_shutdown();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,10 @@ After that you can configure a directory in the Administration server and assign
|
||||
the style "x-httpd-php". All files in it will get executed as PHP. This is nice to
|
||||
hide PHP usage by renaming files to .html
|
||||
|
||||
Note: The stacksize that PHP uses depends on the configuration of the webserver. If you get
|
||||
crashes with very large PHP scripts, it is recommended to raise it with the Admin Server
|
||||
(in the section "MAGNUS EDITOR").
|
||||
|
||||
|
||||
Authentication configuration
|
||||
----------------------------
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #27354 (Modulus operator crashes PHP)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(-2147483647 % -1);
|
||||
var_dump(-2147483649 % -1);
|
||||
var_dump(-2147483648 % -1);
|
||||
var_dump(-2147483648 % -2);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Bug #27443 (defined() returns wrong type)
|
||||
--FILE--
|
||||
<?php
|
||||
echo gettype(defined('test'));
|
||||
?>
|
||||
--EXPECT--
|
||||
boolean
|
||||
+1
-1
@@ -135,7 +135,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php4ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS"
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib Urlmon.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TSDbg\php4ts.dll" /libpath:"..\TSRM\Release_TSDbg" /libpath:"..\Zend\Release_TSDbg" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TSDbg" /libpath:"Release_TSDbg"
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib zlib.lib Urlmon.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TSDbg\php4ts.dll" /libpath:"..\TSRM\Release_TSDbg" /libpath:"..\Zend\Release_TSDbg" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TSDbg" /libpath:"Release_TSDbg" /libpath:"..\..\zlib\Release"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
|
||||
|
||||
void UpdateIniFromRegistry(char *path TSRMLS_DC);
|
||||
char *GetIniPathFromRegistry();
|
||||
|
||||
#endif /* PHP_REGISTRY_H */
|
||||
+25
-2
@@ -1,13 +1,15 @@
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
|
||||
#define PHP_REGISTRY_KEY "SOFTWARE\\PHP"
|
||||
|
||||
void UpdateIniFromRegistry(char *path TSRMLS_DC)
|
||||
{
|
||||
char *p, *orig_path;
|
||||
HKEY MainKey;
|
||||
char *strtok_buf = NULL;
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\PHP\\Per Directory Values", 0, KEY_READ, &MainKey)!=ERROR_SUCCESS) {
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, PHP_REGISTRY_KEY "\\Per Directory Values", 0, KEY_READ, &MainKey)!=ERROR_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,7 +72,8 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC)
|
||||
RegEnumValue(hKey, i, namebuf, &namebuf_len, NULL, &lType, valuebuf, &valuebuf_len);
|
||||
|
||||
if ((lType == REG_SZ) || (lType == REG_EXPAND_SZ)) {
|
||||
zend_alter_ini_entry(namebuf, namebuf_len + 1, valuebuf, valuebuf_len, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
|
||||
/* valuebuf_len includes terminating 0 */
|
||||
zend_alter_ini_entry(namebuf, namebuf_len + 1, valuebuf, valuebuf_len?valuebuf_len-1:0, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -86,3 +89,23 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC)
|
||||
RegCloseKey(MainKey);
|
||||
efree(orig_path);
|
||||
}
|
||||
|
||||
#define PHPRC_REGISTRY_NAME "IniFilePath"
|
||||
|
||||
char *GetIniPathFromRegistry()
|
||||
{
|
||||
char *reg_location = NULL;
|
||||
HKEY hKey;
|
||||
|
||||
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, PHP_REGISTRY_KEY, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
|
||||
DWORD buflen = MAXPATHLEN;
|
||||
reg_location = emalloc(MAXPATHLEN+1);
|
||||
if(RegQueryValueEx(hKey, PHPRC_REGISTRY_NAME, 0, NULL, reg_location, &buflen) != ERROR_SUCCESS) {
|
||||
efree(reg_location);
|
||||
reg_location = NULL;
|
||||
return reg_location;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
return reg_location;
|
||||
}
|
||||
Reference in new issue
Block a user