Merge branch 'master' of git.php.net:php-src

* 'master' of git.php.net:php-src:
  - Fixed bug #63214 (Large PDO Firebird Queries)
  Fix bug #63240 on stream_get_line()
  extended the SKIPIF section with ICU 49 (sync with 5.4 branch)
  fixed tests for gd having freetype >= 2.4.10
  sapi/litespeed/lsapi_main.c: Fix bug #63228
  fix test
  constify
  Fixed bug #63258 (seg fault with PDO and dblib using DBSETOPT(H->link, DBQUOTEDIDENT, 1))
This commit is contained in:
ULF WENDEL 2012-09-29 09:56:55 +02:00
commit 4969c7d50a
14 changed files with 184 additions and 9 deletions

View File

@ -1,9 +1,12 @@
--TEST--
Bug #43073 (TrueType bounding box is wrong for angle<>0)
Bug #43073 (TrueType bounding box is wrong for angle<>0) freetype < 2.4.10
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
if(!function_exists('imagettftext')) die('skip imagettftext() not available');
include dirname(__FILE__) . '/func.inc';
if(version_compare(get_freetype_version(), '2.4.10') >= 0) die('skip for freetype < 2.4.10');
?>
--FILE--
<?php

View File

@ -0,0 +1,51 @@
--TEST--
Bug #43073 (TrueType bounding box is wrong for angle<>0) freetype >= 2.4.10
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
if(!function_exists('imagettftext')) die('skip imagettftext() not available');
include dirname(__FILE__) . '/func.inc';
if(version_compare(get_freetype_version(), '2.4.10') == -1) die('skip for freetype >= 2.4.10');
?>
--FILE--
<?php
$cwd = dirname(__FILE__);
$font = "$cwd/Tuffy.ttf";
$delta_t = 360.0 / 16; # Make 16 steps around
$g = imagecreate(800, 800);
$bgnd = imagecolorallocate($g, 255, 255, 255);
$black = imagecolorallocate($g, 0, 0, 0);
$x = 100;
$y = 0;
$cos_t = cos(deg2rad($delta_t));
$sin_t = sin(deg2rad($delta_t));
for ($angle = 0.0; $angle < 360.0; $angle += $delta_t) {
$bbox = imagettftext($g, 24, $angle, 400+$x, 400+$y, $black, $font, 'ABCDEF');
$s = vsprintf("(%d, %d), (%d, %d), (%d, %d), (%d, %d)\n", $bbox);
echo $s;
$temp = $cos_t * $x + $sin_t * $y;
$y = $cos_t * $y - $sin_t * $x;
$x = $temp;
}
imagepng($g, "$cwd/bug43073.png");
?>
--CLEAN--
<?php @unlink(dirname(__FILE__) . '/bug43073.png'); ?>
--EXPECTF--
(500, 400), (610, 400), (610, 376), (500, 376)
(492, 363), (591, 322), (580, 295), (480, 336)
(470, 331), (548, 254), (527, 233), (449, 310)
(439, 309), (483, 202), (461, 193), (416, 299)
(400, 300), (400, 183), (380, 183), (380, 300)
(362, 307), (316, 195), (291, 205), (337, 318)
(330, 329), (246, 244), (224, 265), (308, 350)
(308, 360), (202, 316), (190, 344), (296, 388)
(300, 400), (187, 400), (187, 425), (300, 425)
(306, 437), (195, 483), (206, 510), (318, 464)
(328, 469), (240, 557), (260, 578), (349, 491)
(359, 491), (312, 607), (334, 616), (382, 501)
(400, 500), (400, 618), (419, 618), (419, 500)
(436, 493), (483, 607), (507, 597), (461, 482)
(468, 471), (555, 558), (577, 538), (490, 450)
(490, 440), (600, 485), (611, 457), (502, 412)

View File

@ -1,9 +1,12 @@
--TEST--
Bug #48801 (Problem with imagettfbbox)
Bug #48801 (Problem with imagettfbbox) freetype < 2.4.10
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
include dirname(__FILE__) . '/func.inc';
if(version_compare(get_freetype_version(), '2.4.10') >= 0) die('skip for freetype < 2.4.10');
?>
--FILE--
<?php

View File

@ -0,0 +1,25 @@
--TEST--
Bug #48801 (Problem with imagettfbbox) freetype >= 2.4.10
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
include dirname(__FILE__) . '/func.inc';
if(version_compare(get_freetype_version(), '2.4.10') == -1) die('skip for freetype >= 2.4.10');
?>
--FILE--
<?php
$cwd = dirname(__FILE__);
$font = "$cwd/Tuffy.ttf";
$bbox = imageftbbox(50, 0, $font, "image");
echo '(' . $bbox[0] . ', ' . $bbox[1] . ")\n";
echo '(' . $bbox[2] . ', ' . $bbox[3] . ")\n";
echo '(' . $bbox[4] . ', ' . $bbox[5] . ")\n";
echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
?>
--EXPECTF--
(-1, 15)
(156, 15)
(156, -48)
(-1, -48)

61
ext/gd/tests/func.inc Normal file
View File

@ -0,0 +1,61 @@
<?php
function get_gd_version()
{
return GD_VERSION;
}
function get_php_info()
{
ob_start();
phpinfo();
$info = ob_get_contents();
ob_end_clean();
return $info;
}
function get_freetype_version()
{
$version = 0;
if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
$version = $match[1];
}
return $version;
}
function get_libjpeg_version()
{
$version = 0;
if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
$version = $match[1];
}
return $version;
}
function get_libpng_version()
{
$version = 0;
if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
$version = $match[1];
}
return $version;
}
function get_libxpm_version()
{
$version = 0;
if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
$version = $match[1];
}
return $version;
}

View File

@ -125,6 +125,12 @@ require_once('skipifconnectfailure.inc');
$expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true;
}
/* First introduced in MySQL 6.0, backported to MySQL 5.5 */
if ($version >= 50606 || $IS_MYSQLND) {
$expected_constants['MYSQLI_SERVER_PUBLIC_KEY'] = true;
}
if ($version > 50002) {
$expected_constants = array_merge($expected_constants, array(
"MYSQLI_TYPE_NEWDECIMAL" => true,

View File

@ -1924,7 +1924,7 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, free_reference)(MYSQLND_CONN_DATA * co
/* {{{ mysqlnd_conn_data::get_state */
static enum mysqlnd_connection_state
MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, get_state)(MYSQLND_CONN_DATA * const conn TSRMLS_DC)
MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, get_state)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC)
{
DBG_ENTER("mysqlnd_conn_data::get_state");
DBG_RETURN(conn->state);

View File

@ -581,6 +581,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
if (conn->net->data->ssl) {
DBG_INF("simple clear text under SSL");
/* clear text under SSL */
*auth_data_len = passwd_len;
ret = malloc(passwd_len);

View File

@ -463,7 +463,7 @@ typedef enum_func_status (*func_mysqlnd_conn_data__query_read_result_set_header)
typedef MYSQLND_CONN_DATA * (*func_mysqlnd_conn_data__get_reference)(MYSQLND_CONN_DATA * const conn TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_conn_data__free_reference)(MYSQLND_CONN_DATA * const conn TSRMLS_DC);
typedef enum mysqlnd_connection_state (*func_mysqlnd_conn_data__get_state)(MYSQLND_CONN_DATA * const conn TSRMLS_DC);
typedef enum mysqlnd_connection_state (*func_mysqlnd_conn_data__get_state)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
typedef void (*func_mysqlnd_conn_data__set_state)(MYSQLND_CONN_DATA * const conn, enum mysqlnd_connection_state new_state TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_conn_data__simple_command)(MYSQLND_CONN_DATA * conn, enum php_mysqlnd_server_command command, const zend_uchar * const arg, size_t arg_len, enum mysqlnd_packet_type ok_packet, zend_bool silent, zend_bool ignore_upsert_status TSRMLS_DC);

View File

@ -315,7 +315,7 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
DBSETOPT(H->link, DBTEXTSIZE, "2147483647");
/* allow double quoted indentifiers */
DBSETOPT(H->link, DBQUOTEDIDENT, 1);
DBSETOPT(H->link, DBQUOTEDIDENT, NULL);
if (vars[3].optval && FAIL == dbuse(H->link, vars[3].optval)) {
goto cleanup;

View File

@ -401,7 +401,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql
long l, pindex = -1;
/* Firebird allows SQL statements up to 64k, so bail if it doesn't fit */
if (sql_len > SHORT_MAX) {
if (sql_len > 65536) {
strcpy(dbh->error_code, "01004");
return 0;
}

View File

@ -0,0 +1,17 @@
--TEST--
Bug #63240: stream_get_line() return contains delimiter string
--FILE--
<?php
$fd = fopen('php://temp', 'r+');
$delimiter = 'MM';
$str = str_repeat('.', 8191) . $delimiter . "rest";
fwrite($fd, $str);
rewind($fd);
$line = stream_get_line($fd, 9000, $delimiter);
var_dump(strlen($line));
$line = stream_get_line($fd, 9000, $delimiter);
var_dump($line);
?>
--EXPECT--
int(8191)
string(4) "rest"

View File

@ -1055,9 +1055,17 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
if (has_delim) {
/* search for delimiter, but skip buffered_len (the number of bytes
* buffered before this loop iteration), as they have already been
* searched for the delimiter */
* searched for the delimiter.
* The left part of the delimiter may still remain in the buffer,
* so subtract up to <delim_len - 1> from buffered_len, which is
* the ammount of data we skip on this search as an optimization
*/
found_delim = _php_stream_search_delim(
stream, maxlen, buffered_len, delim, delim_len TSRMLS_CC);
stream, maxlen,
buffered_len >= (delim_len - 1)
? buffered_len - (delim_len - 1)
: 0,
delim, delim_len TSRMLS_CC);
if (found_delim) {
break;
}

View File

@ -431,7 +431,7 @@ static void cli_usage( TSRMLS_D )
" args... Arguments passed to script.\n";
php_output_startup();
php_output_activate(TSRMLS_C);
php_printf( usage );
php_printf( "%s", usage );
#ifdef PHP_OUTPUT_NEWAPI
php_output_end_all(TSRMLS_C);
#else