diff options
author | ULF WENDEL <uw@php.net> | 2012-09-29 09:56:55 +0200 |
---|---|---|
committer | ULF WENDEL <uw@php.net> | 2012-09-29 09:56:55 +0200 |
commit | 4969c7d50a0611a479f5cf93a2595a6c91c86006 (patch) | |
tree | f2da450b0a2e381ea560473188eb145265af6a3f | |
parent | a2098ca9eb0176a18cfdbf3b5b597f461d21ad8a (diff) | |
parent | 5cf6334e847c3a78f28453b55d3c25537b03a8ff (diff) | |
download | php-git-4969c7d50a0611a479f5cf93a2595a6c91c86006.tar.gz |
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))
-rw-r--r-- | ext/gd/tests/bug43073.phpt | 5 | ||||
-rw-r--r-- | ext/gd/tests/bug43073_1.phpt | 51 | ||||
-rw-r--r-- | ext/gd/tests/bug48801.phpt | 5 | ||||
-rw-r--r-- | ext/gd/tests/bug48801_1.phpt | 25 | ||||
-rw-r--r-- | ext/gd/tests/func.inc | 61 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_constants.phpt | 6 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd.c | 2 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_auth.c | 1 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_structs.h | 2 | ||||
-rw-r--r-- | ext/pdo_dblib/dblib_driver.c | 2 | ||||
-rw-r--r-- | ext/pdo_firebird/firebird_driver.c | 2 | ||||
-rw-r--r-- | ext/standard/tests/streams/bug63240.phpt | 17 | ||||
-rw-r--r-- | main/streams/streams.c | 12 | ||||
-rw-r--r-- | sapi/litespeed/lsapi_main.c | 2 |
14 files changed, 184 insertions, 9 deletions
diff --git a/ext/gd/tests/bug43073.phpt b/ext/gd/tests/bug43073.phpt index df4ffe37e8..4f448f2b4a 100644 --- a/ext/gd/tests/bug43073.phpt +++ b/ext/gd/tests/bug43073.phpt @@ -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 diff --git a/ext/gd/tests/bug43073_1.phpt b/ext/gd/tests/bug43073_1.phpt new file mode 100644 index 0000000000..b69067d31b --- /dev/null +++ b/ext/gd/tests/bug43073_1.phpt @@ -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) diff --git a/ext/gd/tests/bug48801.phpt b/ext/gd/tests/bug48801.phpt index a6a9874ab8..fd25541a52 100644 --- a/ext/gd/tests/bug48801.phpt +++ b/ext/gd/tests/bug48801.phpt @@ -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 diff --git a/ext/gd/tests/bug48801_1.phpt b/ext/gd/tests/bug48801_1.phpt new file mode 100644 index 0000000000..11af80cd4b --- /dev/null +++ b/ext/gd/tests/bug48801_1.phpt @@ -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) diff --git a/ext/gd/tests/func.inc b/ext/gd/tests/func.inc new file mode 100644 index 0000000000..f17227eccd --- /dev/null +++ b/ext/gd/tests/func.inc @@ -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;
+}
+
diff --git a/ext/mysqli/tests/mysqli_constants.phpt b/ext/mysqli/tests/mysqli_constants.phpt index 613dddfc85..0f87187216 100644 --- a/ext/mysqli/tests/mysqli_constants.phpt +++ b/ext/mysqli/tests/mysqli_constants.phpt @@ -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, diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index f5fe075c50..ad91212f2a 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -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); diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c index f2c5adcc4d..3cae693de4 100644 --- a/ext/mysqlnd/mysqlnd_auth.c +++ b/ext/mysqlnd/mysqlnd_auth.c @@ -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); diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 7f512b7211..28def72599 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -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); diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index 77832f9520..baf1dcc670 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -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; diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index e39555fb97..9b0f596959 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -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; } diff --git a/ext/standard/tests/streams/bug63240.phpt b/ext/standard/tests/streams/bug63240.phpt new file mode 100644 index 0000000000..7612c43745 --- /dev/null +++ b/ext/standard/tests/streams/bug63240.phpt @@ -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" diff --git a/main/streams/streams.c b/main/streams/streams.c index 81bf59446f..40b18e9f5b 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -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; } diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 5f4d2e6ec7..338b8e9d1e 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -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 |