Commit 36711112 authored by Ondrej Sury's avatar Ondrej Sury

Imported Upstream version 5.5.0~beta4

parent 5a7c0b1f
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
25 Apr 2013, PHP 5.5.0 Beta 4
- Core:
. Fixed bug #64677 (execution operator `` stealing surrounding arguments).
(Laruence)
- Zip:
. Fixed bug #64342 (ZipArchive::addFile() has to check for file existence).
(Anatol)
- Streams:
. Fixed Windows x64 version of stream_socket_pair() and improved error handling
(Anatol Belski)
11 Apr 2013, PHP 5.5.0 Beta 3
- Core:
......@@ -27,6 +41,20 @@ PHP NEWS
- Fileinfo:
. Upgraded libmagic to 5.14. (Anatol)
- OPcache
. Added opcache_invalidate() function. (Dmitry)
. Added ability to disable opcode cahing for current request by setting
opcache.enable=0. (Dmitry)
. Allowed comments in blacklist files started from ';'. (Remi)
. Allowed wilcards in opcache.blacklist_filename. (Remi)
. Fixed opcache reload condition. Now OPcache is not reloaded if it's full,
but wasted memory is less than opcache.max_wasted_percentage. (Dmitry)
. Fixed incorrect file path validation. (Dmitry).
. Optimizer: Fixed Control Flow Graph construction. (Dmitry)
. Optimizer: numeric string constants used as array indeces have to be
converted to long at compile time. (Dmitry)
. Optimizer: Fixed deltion of used literal. (Laruence, Dmitry)
28 Mar 2013, PHP 5.5.0 Beta 2
- Core:
......
......@@ -35,29 +35,29 @@ Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 8
Notice: Undefined property: a in %sbug52041.php on line 8
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 8
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined property: a in %sbug52041.php on line 9
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 9
Warning: Creating default object from empty value in %sbug52041.php on line 9
Notice: Undefined property: b in %sbug52041.php on line 9
Notice: Undefined property: stdClass::$b in %sbug52041.php on line 9
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 10
Notice: Undefined property: a in %sbug52041.php on line 10
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 10
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined property: a in %sbug52041.php on line 11
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 11
Warning: Creating default object from empty value in %sbug52041.php on line 11
Notice: Undefined property: b in %sbug52041.php on line 11
Notice: Undefined property: stdClass::$b in %sbug52041.php on line 11
Notice: Undefined variable: x in %sbug52041.php on line 3
......
......@@ -23,5 +23,5 @@ echo "DONE";
?>
--EXPECTF--
Notice: Undefined property: x in %s on line 14
Notice: Undefined property: Z::$x in %s on line 14
DONE
......@@ -10,7 +10,7 @@ add_points(NULL, 2);
--EXPECTF--
Warning: Creating default object from empty value in %sbug62005.php on line %d
Notice: Undefined property: energy in %sbug62005.php on line 3
Notice: Undefined property: stdClass::$energy in %sbug62005.php on line 3
stdClass Object
(
[energy] => 2
......
--TEST--
Bug #64677 (execution operator `` stealing surrounding arguments)
--FILE--
<?PHP
class cat {
public function show_output($prepend, $output = '') {
}
}
$cat = new cat();
$cat->show_output('Files: ', trim(`cd .`)); // this gives invalid args to shell_exec
$cat->show_output('Files: ', `cd .`); // this causes a segmentation fault
$cat->show_output(`cd .`); // this causes a segmentation fault
function show_outputa($prepend, $output) {
echo "Okey";
}
show_outputa('Files: ', `cd .`); // this works as expected
?>
--EXPECT--
Okey
......@@ -5702,6 +5702,7 @@ void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC) /* {{{ */
GET_CACHE_SLOT(opline->op1.constant);
opline->extended_value = 1;
SET_UNUSED(opline->op2);
opline->op2.num = CG(context).nested_calls;
GET_NODE(result, opline->result);
if (CG(context).nested_calls + 1 > CG(active_op_array)->nested_calls) {
......
......@@ -22,8 +22,8 @@
#define ZEND_GENERATORS_H
BEGIN_EXTERN_C()
extern ZEND_API zend_class_entry *zend_ce_generator;
END_EXTERN_C()
typedef struct _zend_generator_iterator {
zend_object_iterator intern;
......@@ -66,6 +66,8 @@ ZEND_API zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC);
ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC);
ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC);
END_EXTERN_C()
#endif
/*
......
......@@ -755,7 +755,7 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member, int type
new_zval = &EG(uninitialized_zval);
if(UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member));
zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name, Z_STRVAL_P(member));
}
Z_ADDREF_P(new_zval);
if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
......
......@@ -3168,7 +3168,9 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
ZEND_VM_NEXT_OPCODE();
}
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION && !ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.opline_num)) {
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME &&
EX(function_state).function->type == ZEND_INTERNAL_FUNCTION &&
!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.opline_num)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
}
......@@ -4939,7 +4941,7 @@ ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST)
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
CACHE_PTR(opline->op2.literal->cache_slot, ce);
CACHE_PTR(opline->op2.literal->cache_slot, iface);
}
if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) {
......
......@@ -1479,7 +1479,7 @@ static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
CACHE_PTR(opline->op2.literal->cache_slot, ce);
CACHE_PTR(opline->op2.literal->cache_slot, iface);
}
if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) {
......@@ -13089,7 +13089,9 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZEND_VM_NEXT_OPCODE();
}
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION && !ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.opline_num)) {
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME &&
EX(function_state).function->type == ZEND_INTERNAL_FUNCTION &&
!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.opline_num)) {
return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
......@@ -30710,7 +30712,9 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZEND_VM_NEXT_OPCODE();
}
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION && !ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.opline_num)) {
if (opline->extended_value == ZEND_DO_FCALL_BY_NAME &&
EX(function_state).function->type == ZEND_INTERNAL_FUNCTION &&
!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, opline->op2.opline_num)) {
return zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
This diff is collapsed.
......@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=5
PHP_RELEASE_VERSION=0
PHP_EXTRA_VERSION="beta3"
PHP_EXTRA_VERSION="beta4"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
......@@ -784,7 +784,7 @@ if test "$PHP_GCOV" = "yes"; then
AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi
ltp_version_list="1.5 1.6 1.7 1.9"
ltp_version_list="1.5 1.6 1.7 1.9 1.10"
AC_CHECK_PROG(LTP, lcov, lcov)
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
......
......@@ -5,10 +5,6 @@ dnl
PHP_ARG_WITH(curl, for cURL support,
[ --with-curl[=DIR] Include cURL support])
dnl Temporary option while we develop this aspect of the extension
PHP_ARG_WITH(curlwrappers, if we should use cURL for url streams,
[ --with-curlwrappers EXPERIMENTAL: Use cURL for url streams], no, no)
if test "$PHP_CURL" != "no"; then
if test -r $PHP_CURL/include/curl/easy.h; then
CURL_DIR=$PHP_CURL
......@@ -145,10 +141,6 @@ int main(int argc, char *argv[])
$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
])
if test "$PHP_CURLWRAPPERS" != "no" ; then
AC_DEFINE(PHP_CURL_URL_WRAPPERS,1,[ ])
fi
PHP_NEW_EXTENSION(curl, interface.c multi.c share.c streams.c curl_file.c, $ext_shared)
PHP_NEW_EXTENSION(curl, interface.c multi.c share.c curl_file.c, $ext_shared)
PHP_SUBST(CURL_SHARED_LIBADD)
fi
......@@ -20,7 +20,6 @@ if (PHP_CURL != "no") {
AC_DEFINE('HAVE_CURL_MULTI_STRERROR', 1, 'Have curl_multi_strerror in cURL');
ADD_FLAG("CFLAGS_CURL", "/D CURL_STATICLIB");
// TODO: check for curl_version_info
// AC_DEFINE('PHP_CURL_URL_WRAPPERS', 0, 'Use curl for URL wrappers [experimental]');
} else {
WARNING("curl not enabled; libraries and headers not found");
}
......
......@@ -1221,25 +1221,6 @@ PHP_MINIT_FUNCTION(curl)
return FAILURE;
}
#ifdef PHP_CURL_URL_WRAPPERS
REGISTER_LONG_CONSTANT("CURL_WRAPPERS_ENABLED", 1, CONST_CS | CONST_PERSISTENT);
{
curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
char **p = (char **)info->protocols;
while (*p != NULL) {
/* Do not enable cURL "file" protocol and make sure cURL is always used when --with-curlwrappers is enabled */
if (strncasecmp(*p, "file", sizeof("file")-1) != 0) {
php_unregister_url_stream_wrapper(*p TSRMLS_CC);
php_register_url_stream_wrapper(*p, &php_curl_wrapper TSRMLS_CC);
}
(void) *p++;
}
}
#else
REGISTER_LONG_CONSTANT("CURL_WRAPPERS_ENABLED", 0, CONST_CS | CONST_PERSISTENT);
#endif
curlfile_register_class(TSRMLS_C);
return SUCCESS;
......@@ -1250,20 +1231,6 @@ PHP_MINIT_FUNCTION(curl)
*/
PHP_MSHUTDOWN_FUNCTION(curl)
{
#ifdef PHP_CURL_URL_WRAPPERS
{
curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
char **p = (char **)info->protocols;
while (*p != NULL) {
/* Do not enable cURL "file" protocol and make sure cURL is always used when --with-curlwrappers is enabled */
if (strncasecmp(*p, "file", sizeof("file")-1) != 0) {
php_unregister_url_stream_wrapper(*p TSRMLS_CC);
}
(void) *p++;
}
}
#endif
curl_global_cleanup();
#ifdef PHP_CURL_NEED_OPENSSL_TSL
if (php_curl_openssl_tsl) {
......
......@@ -200,38 +200,6 @@ void _php_curl_cleanup_handle(php_curl *);
void _php_curl_multi_cleanup_list(void *data);
int _php_curl_verify_handlers(php_curl *ch, int reporterror TSRMLS_DC);
/* streams support */
extern php_stream_ops php_curl_stream_ops;
#define PHP_STREAM_IS_CURL &php_curl_stream_ops
php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename, char *mode,
int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
extern php_stream_wrapper php_curl_wrapper;
struct php_curl_buffer {
off_t readpos, writepos;
php_stream *buf;
};
typedef struct {
CURL *curl;
CURLM *multi;
char *url;
struct php_curl_buffer readbuffer; /* holds downloaded data */
struct php_curl_buffer writebuffer; /* holds data to upload */
fd_set readfds, writefds, excfds;
int maxfd;
char errstr[CURL_ERROR_SIZE + 1];
CURLMcode mcode;
int pending;
zval *headers;
struct curl_slist *headers_slist; /* holds custom headers sent out in the request */
} php_curl_stream;
void curlfile_register_class(TSRMLS_D);
PHP_CURL_API extern zend_class_entry *curl_CURLFile_class;
......
This diff is collapsed.
--TEST--
Check libcurl config on windows
--SKIPIF--
<?php
if (!extension_loaded("curl")) {
die('skip - curl extension not available in this build');
}
if(substr(PHP_OS, 0, 3) != 'WIN' )
die("skip for windows only");
?>
--FILE--
<?php
ob_start();
phpinfo();
$s = ob_get_contents();
ob_end_clean();
preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);
echo $m[1], "\n";
?>
DONE
--EXPECTF--
cURL support => enabled
cURL Information => %s
Age => %d
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => No
SPNEGO => Yes
SSL => Yes
SSPI => Yes
TLS-SRP => No
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host => %s-pc-win32
SSL Version => OpenSSL/%s
ZLib Version => %s
libSSH Version => libssh2/%s
DONE
This diff is collapsed.
......@@ -13,7 +13,7 @@ require_once('skipif.inc');
require_once('dom_test.inc');
chdir(__DIR__);
$XMLStringGood = file_get_contents('note.xml');
$XMLStringGood = file_get_contents(dirname(__FILE__).'/note.xml');
$dom = new DOMDocument;
$dom->resolveExternals = TRUE;
......
--TEST--
Test DOMNode::insertBefore() check the error code DOM_NOT_FOUND is raised
--DESCRIPTION--
DOMNode::insertBefore(newNode, [refNode])
DOM_NOT_FOUND is raised if refnode is not a child
This test checks the error message is raised when the refnode is a sibling
--CREDITS--
Antonio Diaz Ruiz <dejalatele@gmail.com>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$dom = new DOMDocument();
$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
assert('$doc === true');
$parent_node = $dom->getElementsByTagName("book")->item(0);
assert('!is_null($parent_node)');
$new_node = $dom->createElement('newnode');
assert('$new_node !== false');
// getting a sibling as reference node to insert
$ref_node = $dom->getElementsByTagName("book")->item(1);
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Not Found Error
--TEST--
Test DOMNode::insertBefore() check the error code DOM_NOT_FOUND is raised
--DESCRIPTION--
DOMNode::insertBefore(newNode, [refNode])
DOM_NOT_FOUND is raised if refnode is not a child
This test checks the error message is raised when refnode is the parent node
--CREDITS--
Antonio Diaz Ruiz <dejalatele@gmail.com>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$dom = new DOMDocument();
$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
assert('$doc === true');
$parent_node = $dom->getElementsByTagName("book")->item(0);
assert('!is_null($parent_node)');
$new_node = $dom->createElement('newnode');
assert('$new_node !== false');
// getting the parent node as reference node to insert
$ref_node = $dom->getElementsByTagName("book")->item(0)->parentNode;
assert('!is_null($ref_node)');
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Not Found Error
--TEST--
Test DOMNode::insertBefore() check the error code DOM_NOT_FOUND is raised
--DESCRIPTION--
DOMNode::insertBefore(newNode, [refNode])
DOM_NOT_FOUND is raised if refnode is not a child
This test checks the error message is raised when the refnode is a brand new node
--CREDITS--
Antonio Diaz Ruiz <dejalatele@gmail.com>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$dom = new DOMDocument();
$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
assert('$doc === true');
$parent_node = $dom->getElementsByTagName("book")->item(0);
assert('!is_null($parent_node)');
$new_node = $dom->createElement('newnode');
assert('$new_node !== false');
// could be a brand new node
$ref_node = $dom->createElement('newnode2');
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Not Found Error
--TEST--
Test DOMNode::insertBefore() check the error code DOM_NOT_FOUND is raised
--DESCRIPTION--
DOMNode::insertBefore(newNode, [refNode])
DOM_NOT_FOUND is raised if refnode is not a child
This test checks the error message is raised when the refnode is a descendant but not a child
--CREDITS--
Antonio Diaz Ruiz <dejalatele@gmail.com>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$dom = new DOMDocument();
$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
assert('$doc === true');
$parent_node = $dom->getElementsByTagName("book")->item(0);
assert('!is_null($parent_node)');
$new_node = $dom->createElement('newnode');
assert('$new_node !== false');
// creating a new node (descendant) and getting it as the refnode
$ref_node = $dom->createElement('newnode3');
$parent_node->childNodes->item(0)->appendChild($ref_node);
$dom->saveXML();
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Not Found Error
--TEST--
Test DOMNode::insertBefore() check the error code DOM_NOT_FOUND is raised
--DESCRIPTION--
DOMNode::insertBefore(newNode, [refNode])
DOM_NOT_FOUND is raised if refnode is not a child
This test checks the error message is raised when the refnode is the parent
--CREDITS--
Antonio Diaz Ruiz <dejalatele@gmail.com>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$dom = new DOMDocument();
$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
assert('$doc === true');
$parent_node = $dom->getElementsByTagName("book")->item(0);
assert('!is_null($parent_node)');
$ref_node = $parent_node;
$new_node = $dom->createElement('newnode');
assert('$new_node !== false');
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Not Found Error
......@@ -265,6 +265,7 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[
PHP_CHECK_LIBRARY(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageGif, [AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageWBMP, [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageCreateFromWebp, [AC_DEFINE(HAVE_GD_WEBP, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageCreateFromGd2, [AC_DEFINE(HAVE_GD_GD2, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
......@@ -283,6 +284,8 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[
PHP_CHECK_LIBRARY(gd, gdFreeFontCache, [AC_DEFINE(HAVE_GD_FREEFONTCACHE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdFontCacheMutexSetup, [AC_DEFINE(HAVE_GD_FONTMUTEX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx, [AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImageConvolution, [AC_DEFINE(HAVE_GD_IMAGE_CONVOLUTION, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
PHP_CHECK_LIBRARY(gd, gdImagePixelate, [AC_DEFINE(HAVE_GD_IMAGE_PIXELATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
])
dnl
......
......@@ -1360,9 +1360,13 @@ PHP_RSHUTDOWN_FUNCTION(gd)
/* }}} */
#if HAVE_GD_BUNDLED
#define PHP_GD_VERSION_STRING "bundled (2.0.34 compatible)"
#define PHP_GD_VERSION_STRING "bundled (2.1.0 compatible)"
#else
#define PHP_GD_VERSION_STRING "2.0"
# ifdef GD_VERSION_STRING
# define PHP_GD_VERSION_STRING GD_VERSION_STRING
# else
# define PHP_GD_VERSION_STRING "2.0"
# endif
#endif
/* {{{ PHP_MINFO_FUNCTION
......@@ -2404,7 +2408,7 @@ static int _php_image_type (char data[8])
gdIOCtx *io_ctx;
io_ctx = gdNewDynamicCtxEx(8, data, 0);
if (io_ctx) {
if (getmbi((int(*)(void *)) gdGetC, io_ctx) == 0 && skipheader((int(*)(void *)) gdGetC, io_ctx) == 0 ) {
if (getmbi((int(*)(void *)) io_ctx->getC, io_ctx) == 0 && skipheader((int(*)(void *)) io_ctx->getC, io_ctx) == 0 ) {
#if HAVE_LIBGD204
io_ctx->gd_free(io_ctx);
#else
......@@ -2951,7 +2955,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
#if HAVE_GD_BUNDLED
PHP_FUNCTION(imagexbm)
{
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XBM, "GIF", gdImageXbmCtx);
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XBM, "XBM", gdImageXbmCtx);
}
#endif
/* }}} */
......@@ -2971,7 +2975,7 @@ PHP_FUNCTION(imagegif)
Output PNG image to browser or file */
PHP_FUNCTION(imagepng)
{
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "GIF", gdImagePngCtxEx);
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePngCtxEx);
}
/* }}} */
#endif /* HAVE_GD_PNG */
......@@ -2982,7 +2986,7 @@ PHP_FUNCTION(imagepng)
Output PNG image to browser or file */
PHP_FUNCTION(imagewebp)
{
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WEBP, "GIF", gdImageWebpCtx);
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WEBP, "WEBP", gdImageWebpCtx);
}
/* }}} */
#endif /* HAVE_GD_WEBP */
......@@ -2993,7 +2997,7 @@ PHP_FUNCTION(imagewebp)
Output JPEG image to browser or file */
PHP_FUNCTION(imagejpeg)
{
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "GIF", gdImageJpegCtx);
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageJpegCtx);
}
/* }}} */
#endif /* HAVE_GD_JPG */
......@@ -3003,7 +3007,7 @@ PHP_FUNCTION(imagejpeg)
Output WBMP image to browser or file */
PHP_FUNCTION(imagewbmp)
{
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "GIF", gdImageWBMPCtx);
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageWBMPCtx);
}
/* }}} */
#endif /* HAVE_GD_WBMP */
......@@ -5336,7 +5340,7 @@ PHP_FUNCTION(imagecropauto)
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown flip mode");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown crop mode");
RETURN_FALSE;
}
if (im_crop == NULL) {
......
......@@ -33,3 +33,50 @@ const char * gdPngGetVersionString()
}
#endif
/* Not exported by libgd, copied from gdhelpers.h */
int overflow2(int a, int b)
{
if(a <= 0 || b <= 0) {
return 1;
}
if(a > INT_MAX / b) {
return 1;
}
return 0;
}
/* Not exported by libgd, copied from wbmp.c */
int
getmbi (int (*getin) (void *in), void *in)
{
int i, mbi = 0;
do
{
i = getin (in);
if (i < 0)
return (-1);
mbi = (mbi << 7) | (i & 0x7f);
}
while (i & 0x80);
return (mbi);
}
/* Not exported by libgd, copied from wbmp.c */
int