diff options
32 files changed, 419 insertions, 96 deletions
diff --git a/.travis.yml b/.travis.yml index 07653040dd..d59dd7012e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,10 @@ env: - PDO_MYSQL_TEST_USER=travis - PDO_MYSQL_TEST_PASS= - PDO_MYSQL_TEST_HOST=127.0.0.1 - matrix: - REPORT_EXIT_STATUS=1 + matrix: + - ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0 + - ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1 before_script: # Compile PHP @@ -4,16 +4,16 @@ PHP X.Y UPGRADE NOTES 1. Backward Incompatible Changes 2. New Features -2. Changes in SAPI modules -3. Deprecated Functionality -4. Changed Functions -5. New Functions -6. New Classes and Interfaces -7. Removed Extensions -8. Other Changes to Extensions -9. New Global Constants -10. Changes to INI File Handling -11. Other Changes +3. Changes in SAPI modules +4. Deprecated Functionality +5. Changed Functions +6. New Functions +7. New Classes and Interfaces +8. Removed Extensions +9. Other Changes to Extensions +10. New Global Constants +11. Changes to INI File Handling +12. Other Changes ======================================== @@ -30,52 +30,52 @@ PHP X.Y UPGRADE NOTES ======================================== -2. Changes in SAPI modules +3. Changes in SAPI modules ======================================== ======================================== -3. Deprecated Functionality +4. Deprecated Functionality ======================================== ======================================== -4. Changed Functions +5. Changed Functions ======================================== ======================================== -5. New Functions +6. New Functions ======================================== ======================================== -6. New Classes and Interfaces +7. New Classes and Interfaces ======================================== ======================================== -7. Removed Extensions +8. Removed Extensions ======================================== ======================================== -8. Other Changes to Extensions +9. Other Changes to Extensions ======================================== ======================================== -9. New Global Constants +10. New Global Constants ======================================== ======================================== -10. Changes to INI File Handling +11. Changes to INI File Handling ======================================== ======================================== -11. Other Changes +12. Other Changes ======================================== - Standard diff --git a/Zend/tests/bug67169.phpt b/Zend/tests/bug67169.phpt new file mode 100644 index 0000000000..8aa6aaf24a --- /dev/null +++ b/Zend/tests/bug67169.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #67169: array_splice all elements, then []= gives wrong index +--FILE-- +<?php + +$array = array('a', 'b'); +array_splice($array, 0, 2); +$array[] = 'c'; +var_dump($array); + +$array = array('a', 'b'); +array_shift($array); +array_shift($array); +$array[] = 'c'; +var_dump($array); + +?> +--EXPECT-- +array(1) { + [0]=> + string(1) "c" +} +array(1) { + [0]=> + string(1) "c" +} diff --git a/Zend/zend.c b/Zend/zend.c index 6706bad59d..97afdb936f 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -948,7 +948,7 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */ zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC); -#ifdef ZEND_DEBUG +#if ZEND_DEBUG if (GC_G(gc_enabled) && !CG(unclean_shutdown)) { gc_collect_cycles(TSRMLS_C); } diff --git a/ext/com_dotnet/com_olechar.c b/ext/com_dotnet/com_olechar.c index a3e81978bd..bf42b4fffb 100644 --- a/ext/com_dotnet/com_olechar.c +++ b/ext/com_dotnet/com_olechar.c @@ -46,7 +46,13 @@ PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint strin if (string_len > 0) { olestring = (OLECHAR*)safe_emalloc(string_len, sizeof(OLECHAR), 0); + /* XXX if that's a real multibyte string, olestring is obviously allocated excessively. + This should be fixed by reallocating the olestring, but as emalloc is used, that doesn't + matter much. */ ok = MultiByteToWideChar(codepage, flags, string, string_len, olestring, string_len); + if (ok > 0 && ok < string_len) { + olestring[ok] = '\0'; + } } else { ok = FALSE; olestring = (OLECHAR*)emalloc(sizeof(OLECHAR)); diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 3ddf016efb..3cc057127a 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -154,7 +154,11 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep case IS_STRING: V_VT(v) = VT_BSTR; olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC); - V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR)); + if (CP_UTF8 == codepage) { + V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR)); + } else { + V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR)); + } efree(olestring); break; diff --git a/ext/com_dotnet/tests/bug66431_0.phpt b/ext/com_dotnet/tests/bug66431_0.phpt new file mode 100644 index 0000000000..daac328538 --- /dev/null +++ b/ext/com_dotnet/tests/bug66431_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Bug #66431 Special Character via COM Interface (CP_UTF8), Scripting.FileSystemObject +--SKIPIF-- +<?php +if (!extension_loaded("com_dotnet")){ echo "skip COM/.Net support not present"; } +?> +--FILE-- +<?php + +$text= "Xin chào cộng đồng PHP"; +$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.txt"); + +$fso = new COM("Scripting.FileSystemObject"); +$fh = $fso->OpenTextFile($fpath, 2, true); +$fh->Write($text); +$fh->Close(); + +$check_text = file_get_contents($fpath); + +$result = ($check_text == $text); + +var_dump($result); + +if (!$result) { + echo "Expected: '$check_text'\n"; + echo "Have: '$text'\n"; +} + +?> +===DONE=== +--CLEAN-- +<?php + +$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.txt"); + +if (file_exists($fpath)) { + unlink($fpath); +} +?> +--EXPECT-- +bool(true) +===DONE=== diff --git a/ext/com_dotnet/tests/bug66431_1.phpt b/ext/com_dotnet/tests/bug66431_1.phpt new file mode 100644 index 0000000000..d97011c2bb --- /dev/null +++ b/ext/com_dotnet/tests/bug66431_1.phpt @@ -0,0 +1,60 @@ +--TEST-- +Bug #66431 Special Character via COM Interface (CP_UTF8), Application.Word +--SKIPIF-- +<?php +if (!extension_loaded("com_dotnet")){ echo "skip COM/.Net support not present"; } + +try { + new COM("word.application", NULL, CP_UTF8); +} catch (Exception $e) { + die('skip ' . $e->getMessage(); +} + +?> +--FILE-- +<?php + +$text= "Xin chào cộng đồng PHP"; +$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.docx"); + +com_load_typelib('Word.Application'); + +$Wrd = new COM("word.application", NULL, CP_UTF8); +$Wrd->Documents->Add(); +$Wrd->Selection->TypeText($text); +$Wrd->ActiveDocument->SaveAs($fpath); +$Wrd->ActiveDocument->Close(false); +$Wrd->Application->Quit(); +unset($Wrd); + +$Wrd = new COM("word.application", NULL, CP_UTF8); +$Wrd->Documents->Open($fpath, NULL, false); +$check_text = $Wrd->ActiveDocument->Range($Wrd->ActiveDocument->Sentences(1)->Start, $Wrd->ActiveDocument->Sentences(1)->End)->Text; +$Wrd->ActiveDocument->Close(false); +$Wrd->Application->Quit(); +unset($Wrd); + +/* trim the returned text as we'll get windows eol from a word doc. */ +$result = (trim($check_text) == $text); + +var_dump($result); + +if (!$result) { + echo "Expected: '$check_text'\n"; + echo "Have: '$text'\n"; +} + +?> +===DONE=== +--CLEAN-- +<?php + +$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.docx"); + +if (file_exists($fpath)) { + unlink($fpath); +} +?> +--EXPECT-- +bool(true) +===DONE=== diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 2d8fb8606d..6ed31553a8 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2345,25 +2345,34 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC) case CURLOPT_WRITEHEADER: { FILE *fp = NULL; int type; - void * what; + void *what = NULL; - what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream(), php_file_le_pstream()); - if (!what) { - return FAILURE; - } + if (Z_TYPE_PP(zvalue) != IS_NULL) { + what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream(), php_file_le_pstream()); + if (!what) { + return FAILURE; + } - if (FAILURE == php_stream_cast((php_stream *) what, PHP_STREAM_AS_STDIO, (void *) &fp, REPORT_ERRORS)) { - return FAILURE; - } + if (FAILURE == php_stream_cast((php_stream *) what, PHP_STREAM_AS_STDIO, (void *) &fp, REPORT_ERRORS)) { + return FAILURE; + } - if (!fp) { - return FAILURE; + if (!fp) { + return FAILURE; + } } error = CURLE_OK; switch (option) { case CURLOPT_FILE: - if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') { + if (!what) { + if (ch->handlers->write->stream) { + Z_DELREF_P(ch->handlers->write->stream); + ch->handlers->write->stream = NULL; + } + ch->handlers->write->fp = NULL; + ch->handlers->write->method = PHP_CURL_STDOUT; + } else if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') { if (ch->handlers->write->stream) { Z_DELREF_P(ch->handlers->write->stream); } @@ -2377,7 +2386,14 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC) } break; case CURLOPT_WRITEHEADER: - if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') { + if (!what) { + if (ch->handlers->write_header->stream) { + Z_DELREF_P(ch->handlers->write_header->stream); + ch->handlers->write_header->stream = NULL; + } + ch->handlers->write_header->fp = NULL; + ch->handlers->write_header->method = PHP_CURL_IGNORE; + } else if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') { if (ch->handlers->write_header->stream) { Z_DELREF_P(ch->handlers->write_header->stream); } @@ -2391,16 +2407,30 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC) } break; case CURLOPT_INFILE: - if (ch->handlers->read->stream) { - Z_DELREF_P(ch->handlers->read->stream); + if (!what) { + if (ch->handlers->read->stream) { + Z_DELREF_P(ch->handlers->read->stream); + ch->handlers->read->stream = NULL; + } + ch->handlers->read->fp = NULL; + ch->handlers->read->fd = 0; + } else { + if (ch->handlers->read->stream) { + Z_DELREF_P(ch->handlers->read->stream); + } + Z_ADDREF_PP(zvalue); + ch->handlers->read->fp = fp; + ch->handlers->read->fd = Z_LVAL_PP(zvalue); + ch->handlers->read->stream = *zvalue; } - Z_ADDREF_PP(zvalue); - ch->handlers->read->fp = fp; - ch->handlers->read->fd = Z_LVAL_PP(zvalue); - ch->handlers->read->stream = *zvalue; break; case CURLOPT_STDERR: - if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') { + if (!what) { + if (ch->handlers->std_err) { + zval_ptr_dtor(&ch->handlers->std_err); + ch->handlers->std_err = NULL; + } + } else if (((php_stream *) what)->mode[0] != 'r' || ((php_stream *) what)->mode[1] == '+') { if (ch->handlers->std_err) { zval_ptr_dtor(&ch->handlers->std_err); } diff --git a/ext/curl/tests/bug54798.phpt b/ext/curl/tests/bug54798.phpt index f633a8ab2a..afd98cb87e 100644 --- a/ext/curl/tests/bug54798.phpt +++ b/ext/curl/tests/bug54798.phpt @@ -53,19 +53,13 @@ foreach($options_to_check as $option) { } ?> +===DONE=== --CLEAN-- <?php @unlink(dirname(__FILE__) . '/bug54798.tmp'); ?> --EXPECTF-- -Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug54798.php on line %d -* About to connect() %a -* Closing connection %d -Ok for CURLOPT_STDERR - -Warning: curl_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %sbug54798.php on line 24 -Ok for CURLOPT_WRITEHEADER - -Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %sbug54798.php on line 24 +%a +%aOk for CURLOPT_STDERR +%aOk for CURLOPT_WRITEHEADER %aOk for CURLOPT_FILE - -Warning: curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %sbug54798.php on line %d -Ok for CURLOPT_INFILE +%aOk for CURLOPT_INFILE +===DONE=== diff --git a/ext/curl/tests/bug64267.phpt b/ext/curl/tests/bug64267.phpt new file mode 100644 index 0000000000..1b115588ff --- /dev/null +++ b/ext/curl/tests/bug64267.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #64267 (CURLOPT_INFILE doesn't allow reset) +--SKIPIF-- +<?php +extension_loaded("curl") or die("skip need ext/curl"); +?> +--FILE-- +<?php + +echo "TEST\n"; + +$c = curl_init("http://google.com"); +$f = fopen(__FILE__,"r"); +var_dump(curl_setopt_array($c, [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_UPLOAD => true, + CURLOPT_INFILE => $f, + CURLOPT_INFILESIZE => filesize(__FILE__) +])); +fclose($f); +var_dump(curl_setopt_array($c, [ + CURLOPT_UPLOAD => false, + CURLOPT_INFILE => null, + CURLOPT_INFILESIZE => 0, +])); +curl_exec($c); +var_dump(curl_getinfo($c, CURLINFO_RESPONSE_CODE)); +?> +===DONE=== +--EXPECTF-- +TEST +bool(true) +bool(true) +int(30%d) +===DONE=== diff --git a/ext/curl/tests/curl_basic_008.phpt b/ext/curl/tests/curl_basic_008.phpt index 29e3343707..4f0a29d7ff 100644 --- a/ext/curl/tests/curl_basic_008.phpt +++ b/ext/curl/tests/curl_basic_008.phpt @@ -25,5 +25,5 @@ curl_close($ch); ?> --EXPECTF-- -%unicode|string%(%d) "%r(Couldn't resolve host|Could not resolve host:)%r %Swww.%s" +%s resolve%s int(6) diff --git a/ext/curl/tests/curl_basic_010.phpt b/ext/curl/tests/curl_basic_010.phpt index 0fc2fe6656..72a591ff16 100644 --- a/ext/curl/tests/curl_basic_010.phpt +++ b/ext/curl/tests/curl_basic_010.phpt @@ -26,5 +26,5 @@ curl_close($ch); ?> --EXPECTF-- -%unicode|string%(%d) "%r(Couldn't resolve proxy|Could not resolve proxy:|Could not resolve host:)%r %s" +%unicode|string%(%d) "%r(Couldn't resolve proxy|Could not resolve proxy:|Could not resolve host:|Could not resolve:)%r %s" int(5) diff --git a/ext/curl/tests/curl_reset.phpt b/ext/curl/tests/curl_reset.phpt index c78a8e0953..3572e69543 100644 --- a/ext/curl/tests/curl_reset.phpt +++ b/ext/curl/tests/curl_reset.phpt @@ -36,5 +36,8 @@ unlink($test_file); unlink($log_file); ?> + +===DONE=== --EXPECT-- testtest +===DONE=== diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 439621f5e5..31cb41adfd 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2680,7 +2680,9 @@ PHP_METHOD(DateTime, __construct) zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { - php_date_initialize(Z_PHPDATE_P(getThis()), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); + if (!php_date_initialize(Z_PHPDATE_P(getThis()), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC)) { +//??? ZVAL_NULL(getThis()); + } } zend_restore_error_handling(&error_handling TSRMLS_CC); } diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt new file mode 100644 index 0000000000..6371757647 --- /dev/null +++ b/ext/date/tests/bug67118.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #67118 php-cgi crashes regularly on IIS 7 +--INI-- +date.timezone=Europe/Berlin +--FILE-- +<?php +class mydt extends datetime +{ + public function __construct($time = 'now', $tz = NULL, $format = NULL) + { + if (!empty($tz) && !is_object($tz)) { + $tz = new DateTimeZone($tz); + } + + @parent::__construct($time, $tz); + } + +}; + +new mydt("Funktionsansvarig rådgivning och juridik", "UTC"); +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Funktionsansvarig rådgivning och juridik) at position 0 (F): The timezone could not be found in the database' in %sbug67118.php:%d +Stack trace: +#0 %sbug67118.php(%d): DateTime->__construct('Funktionsansvar...', Object(DateTimeZone)) +#1 %sbug67118.php(%d): mydt->__construct('Funktionsansvar...', 'UTC') +#2 {main} + thrown in %sbug67118.php on line %d diff --git a/ext/ext_skel b/ext/ext_skel index 061e78d649..e6b01fd4fc 100755 --- a/ext/ext_skel +++ b/ext/ext_skel @@ -320,7 +320,7 @@ To use your new extension, you will have to execute the following steps: 3. $ ./buildconf 4. $ ./configure --[with|enable]-$extname 5. $ make -6. $ ./php -f ext/$extname/$extname.php +6. $ ./sapi/cli/php -f ext/$extname/$extname.php 7. $ vi ext/$extname/$extname.c 8. $ make diff --git a/ext/fileinfo/libmagic.patch b/ext/fileinfo/libmagic.patch index fa708b6c83..662537bf7f 100644 --- a/ext/fileinfo/libmagic.patch +++ b/ext/fileinfo/libmagic.patch @@ -3286,4 +3286,16 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c break; } case FILE_INDIRECT: +diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c +--- libmagic.orig/strcasestr.c Thu Dec 5 17:57:50 2013 ++++ libmagic/strcasestr.c Sun May 4 21:29:20 2014 +@@ -37,6 +37,8 @@ + __RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); + #endif /* LIBC_SCCS and not lint */ + ++#include "php_stdint.h" ++ + #include <assert.h> + #include <ctype.h> + #include <string.h> diff --git a/ext/fileinfo/libmagic/strcasestr.c b/ext/fileinfo/libmagic/strcasestr.c index 546ed3f96c..e1434e69e7 100644 --- a/ext/fileinfo/libmagic/strcasestr.c +++ b/ext/fileinfo/libmagic/strcasestr.c @@ -37,6 +37,8 @@ __RCSID("$NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $"); __RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); #endif /* LIBC_SCCS and not lint */ +#include "php_stdint.h" + #include <assert.h> #include <ctype.h> #include <string.h> diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index d34d78f01a..cd50896cc7 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -575,22 +575,20 @@ static int gmp_serialize(zval *object, unsigned char **buffer, zend_uint *buf_le mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(object); smart_str buf = {0}; zval zv, *zv_ptr = &zv; - php_serialize_data_t *serialize_data = (php_serialize_data_t *) data; - - PHP_VAR_SERIALIZE_INIT(*serialize_data); + php_serialize_data_t serialize_data = (php_serialize_data_t) data; + PHP_VAR_SERIALIZE_INIT(serialize_data); INIT_PZVAL(zv_ptr); - + gmp_strval(zv_ptr, gmpnum, 10); - php_var_serialize(&buf, &zv_ptr, serialize_data TSRMLS_CC); + php_var_serialize(&buf, &zv_ptr, &serialize_data TSRMLS_CC); zval_dtor(zv_ptr); Z_ARRVAL_P(zv_ptr) = zend_std_get_properties(object TSRMLS_CC); Z_TYPE_P(zv_ptr) = IS_ARRAY; - php_var_serialize(&buf, &zv_ptr, serialize_data TSRMLS_CC); - - PHP_VAR_SERIALIZE_DESTROY(*serialize_data); + php_var_serialize(&buf, &zv_ptr, &serialize_data TSRMLS_CC); + PHP_VAR_SERIALIZE_DESTROY(serialize_data); *buffer = (unsigned char *) buf.c; *buf_len = buf.len; @@ -604,17 +602,16 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c const unsigned char *p, *max; zval zv, *zv_ptr = &zv; int retval = FAILURE; - php_unserialize_data_t *unserialize_data = (php_unserialize_data_t *) data; - - PHP_VAR_UNSERIALIZE_INIT(*unserialize_data); + php_unserialize_data_t unserialize_data = (php_unserialize_data_t) data; + PHP_VAR_UNSERIALIZE_INIT(unserialize_data); gmp_create_ex(*object, &gmpnum TSRMLS_CC); p = buf; max = buf + buf_len; INIT_ZVAL(zv); - if (!php_var_unserialize(&zv_ptr, &p, max, unserialize_data TSRMLS_CC) + if (!php_var_unserialize(&zv_ptr, &p, max, &unserialize_data TSRMLS_CC) || Z_TYPE_P(zv_ptr) != IS_STRING || convert_to_gmp(gmpnum, zv_ptr, 10 TSRMLS_CC) == FAILURE ) { @@ -624,7 +621,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c zval_dtor(&zv); INIT_ZVAL(zv); - if (!php_var_unserialize(&zv_ptr, &p, max, unserialize_data TSRMLS_CC) + if (!php_var_unserialize(&zv_ptr, &p, max, &unserialize_data TSRMLS_CC) || Z_TYPE_P(zv_ptr) != IS_ARRAY ) { zend_throw_exception(NULL, "Could not unserialize properties", 0 TSRMLS_CC); @@ -641,7 +638,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c retval = SUCCESS; exit: zval_dtor(&zv); - PHP_VAR_UNSERIALIZE_DESTROY(*unserialize_data); + PHP_VAR_UNSERIALIZE_DESTROY(unserialize_data); return retval; } /* }}} */ diff --git a/ext/interbase/php_ibase_includes.h b/ext/interbase/php_ibase_includes.h index c994a92da5..6671c9162d 100644 --- a/ext/interbase/php_ibase_includes.h +++ b/ext/interbase/php_ibase_includes.h @@ -35,6 +35,7 @@ #define IB_STATUS (IBG(status)) +/* XXX ZEND_DEBUG_ is misleading, it should be something like IBASE_DEBUG. */ #ifdef ZEND_DEBUG_ #define IBDEBUG(a) php_printf("::: %s (%d)\n", a, __LINE__); #endif diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 034c835b96..ff0476767a 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -575,7 +575,11 @@ PHP_FUNCTION(mysqli_query) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty query"); RETURN_FALSE; } +#ifdef MYSQLI_USE_MYSQLND if ((resultmode & ~MYSQLI_ASYNC) != MYSQLI_USE_RESULT && (resultmode & ~(MYSQLI_ASYNC | MYSQLI_STORE_RESULT_COPY_DATA)) != MYSQLI_STORE_RESULT) { +#else + if ((resultmode & ~MYSQLI_ASYNC) != MYSQLI_USE_RESULT && (resultmode & ~MYSQLI_ASYNC) != MYSQLI_STORE_RESULT) { +#endif php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for resultmode"); RETURN_FALSE; } @@ -609,7 +613,11 @@ PHP_FUNCTION(mysqli_query) RETURN_TRUE; } +#ifdef MYSQLI_USE_MYSQLND switch (resultmode & ~(MYSQLI_ASYNC | MYSQLI_STORE_RESULT_COPY_DATA)) { +#else + switch (resultmode & ~MYSQLI_ASYNC) { +#endif case MYSQLI_STORE_RESULT: #ifdef MYSQLI_USE_MYSQLND if (resultmode & MYSQLI_STORE_RESULT_COPY_DATA) { diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index aa6634058a..e45f7981d9 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -567,7 +567,7 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TS #else HMODULE l = GetModuleHandle("fbclient"); - if (!l && !(l = GetModuleHandle("gds32"))) { + if (!l) { break; } info_func = (info_func_t)GetProcAddress(l, "isc_get_client_version"); @@ -575,9 +575,7 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TS if (info_func) { info_func(tmp); ZVAL_STRING(val,tmp,1); - } else { - ZVAL_STRING(val,"Firebird 1.0/Interbase 6",1); - } + } #else ZVAL_NULL(val); #endif diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c index 595a6a3987..d59aa53fa3 100644 --- a/ext/pdo_firebird/pdo_firebird.c +++ b/ext/pdo_firebird/pdo_firebird.c @@ -35,21 +35,15 @@ const zend_function_entry pdo_firebird_functions[] = { /* {{{ */ /* {{{ pdo_firebird_deps */ -#if ZEND_MODULE_API_NO >= 20050922 static const zend_module_dep pdo_firebird_deps[] = { ZEND_MOD_REQUIRED("pdo") ZEND_MOD_END }; -#endif /* }}} */ zend_module_entry pdo_firebird_module_entry = { /* {{{ */ -#if ZEND_MODULE_API_NO >= 20050922 STANDARD_MODULE_HEADER_EX, NULL, pdo_firebird_deps, -#else - STANDARD_MODULE_HEADER, -#endif "PDO_Firebird", pdo_firebird_functions, PHP_MINIT(pdo_firebird), diff --git a/ext/standard/html.c b/ext/standard/html.c index 4b605e145c..7564fb8217 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -901,7 +901,7 @@ static inline size_t write_octet_sequence(unsigned char *buf, enum entity_charse #if 0 return php_mb2_int_to_char(buf, code); #else -#ifdef ZEND_DEBUG +#if ZEND_DEBUG assert(code <= 0xFFU); #endif *buf = code; @@ -912,7 +912,7 @@ static inline size_t write_octet_sequence(unsigned char *buf, enum entity_charse #if 0 /* idem */ return php_mb2_int_to_char(buf, code); #else -#ifdef ZEND_DEBUG +#if ZEND_DEBUG assert(code <= 0xFFU); #endif *buf = code; diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index b32213fa74..68978ee75d 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -39,7 +39,7 @@ int fpm_unix_resolve_socket_premissions(struct fpm_worker_pool_s *wp) /* {{{ */ /* uninitialized */ wp->socket_uid = -1; wp->socket_gid = -1; - wp->socket_mode = 0666; + wp->socket_mode = 0660; if (!c) { return 0; diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index acdff31f17..c5f4abc59c 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -166,10 +166,10 @@ listen = 127.0.0.1:9000 ; permissions must be set in order to allow connections from a web server. Many ; BSD-derived systems allow connections regardless of permissions. ; Default Values: user and group are set as the running user -; mode is set to 0666 +; mode is set to 0660 ;listen.owner = @php_fpm_user@ ;listen.group = @php_fpm_group@ -;listen.mode = 0666 +;listen.mode = 0660 ; List of ipv4 addresses of FastCGI clients which are allowed to connect. ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4 index 3534d90124..a1b2f9faa1 100644 --- a/sapi/phpdbg/config.m4 +++ b/sapi/phpdbg/config.m4 @@ -21,7 +21,7 @@ if test "$PHP_PHPDBG" != "no"; then PHP_PHPDBG_FILES="phpdbg.c phpdbg_parser.c phpdbg_lexer.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c phpdbg_cmd.c phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_btree.c" if test "$PHP_READLINE" != "no"; then - PHPDBG_EXTRA_LIBS="-lreadline" + PHPDBG_EXTRA_LIBS="$PHP_READLINE_LIBS" fi PHP_SUBST(PHP_PHPDBG_CFLAGS) diff --git a/sapi/phpdbg/config.w32 b/sapi/phpdbg/config.w32 index 33a7b46d4f..17e15b6ced 100644 --- a/sapi/phpdbg/config.w32 +++ b/sapi/phpdbg/config.w32 @@ -6,15 +6,14 @@ PHPDBG_DLL='php' + PHP_VERSION + 'phpdbg.dll'; PHPDBG_EXE='phpdbg.exe'; if (PHP_PHPDBG == "yes") { - SAPI('phpdbg', PHPDBG_SOURCES, PHPDBG_EXE); - ADD_FLAG("LIBS_PHPDBG", "ws2_32.lib user32.lib"); - DEFINE("CFLAGS", configure_subst.item("CFLAGS") + " /EHa"); + SAPI('phpdbg', PHPDBG_SOURCES, PHPDBG_EXE); + ADD_FLAG("LIBS_PHPDBG", "ws2_32.lib user32.lib"); ADD_FLAG("CFLAGS_PHPDBG", "/D YY_NO_UNISTD_H"); } if (PHP_PHPDBGS == "yes") { SAPI('phpdbgs', PHPDBG_SOURCES, PHPDBG_DLL, '/D PHP_PHPDBG_EXPORTS /I win32'); ADD_FLAG("LIBS_PHPDBGS", "ws2_32.lib user32.lib"); - DEFINE("CFLAGS", configure_subst.item("CFLAGS") + " /EHa"); - ADD_FLAG("CFLAGS_PHPDBG", "/D YY_NO_UNISTD_H"); + ADD_FLAG("CFLAGS_PHPDBGS", "/D YY_NO_UNISTD_H"); } + diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 064e266082..fc121839e8 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -533,6 +533,69 @@ static inline void php_sapi_phpdbg_flush(void *context) /* {{{ */ fflush(PHPDBG_G(io)[PHPDBG_STDOUT]); } /* }}} */ +/* copied from sapi/cli/php_cli.c cli_register_file_handles */ +static void phpdbg_register_file_handles(TSRMLS_D) /* {{{ */ +{ + zval *zin, *zout, *zerr; + php_stream *s_in, *s_out, *s_err; + php_stream_context *sc_in=NULL, *sc_out=NULL, *sc_err=NULL; + zend_constant ic, oc, ec; + + MAKE_STD_ZVAL(zin); + MAKE_STD_ZVAL(zout); + MAKE_STD_ZVAL(zerr); + + s_in = php_stream_open_wrapper_ex("php://stdin", "rb", 0, NULL, sc_in); + s_out = php_stream_open_wrapper_ex("php://stdout", "wb", 0, NULL, sc_out); + s_err = php_stream_open_wrapper_ex("php://stderr", "wb", 0, NULL, sc_err); + + if (s_in==NULL || s_out==NULL || s_err==NULL) { + FREE_ZVAL(zin); + FREE_ZVAL(zout); + FREE_ZVAL(zerr); + if (s_in) php_stream_close(s_in); + if (s_out) php_stream_close(s_out); + if (s_err) php_stream_close(s_err); + return; + } + +#if PHP_DEBUG + /* do not close stdout and stderr */ + s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE; + s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE; +#endif + + php_stream_to_zval(s_in, zin); + php_stream_to_zval(s_out, zout); + php_stream_to_zval(s_err, zerr); + + ic.value = *zin; + ic.flags = CONST_CS; + ic.name = zend_strndup(ZEND_STRL("STDIN")); + ic.name_len = sizeof("STDIN"); + ic.module_number = 0; + zend_register_constant(&ic TSRMLS_CC); + + oc.value = *zout; + oc.flags = CONST_CS; + oc.name = zend_strndup(ZEND_STRL("STDOUT")); + oc.name_len = sizeof("STDOUT"); + oc.module_number = 0; + zend_register_constant(&oc TSRMLS_CC); + + ec.value = *zerr; + ec.flags = CONST_CS; + ec.name = zend_strndup(ZEND_STRL("STDERR")); + ec.name_len = sizeof("STDERR"); + ec.module_number = 0; + zend_register_constant(&ec TSRMLS_CC); + + FREE_ZVAL(zin); + FREE_ZVAL(zout); + FREE_ZVAL(zerr); +} +/* }}} */ + /* {{{ sapi_module_struct phpdbg_sapi_module */ static sapi_module_struct phpdbg_sapi_module = { @@ -1262,6 +1325,9 @@ phpdbg_main: /* set default prompt */ phpdbg_set_prompt(PROMPT TSRMLS_CC); + /* Make stdin, stdout and stderr accessible from PHP scripts */ + phpdbg_register_file_handles(TSRMLS_C); + if (show_banner) { /* print blurb */ phpdbg_welcome((cleaning > 0) TSRMLS_CC); diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index 9ee580ca0b..2efbb1237c 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -464,9 +464,9 @@ PHPDBG_WATCH(array) /* {{{ */ void phpdbg_watch_HashTable_dtor(zval **zv) { phpdbg_btree_result *result; - zval_ptr_dtor_wrapper(zv); TSRMLS_FETCH(); + zval_ptr_dtor_wrapper(zv); if ((result = phpdbg_btree_find(&PHPDBG_G(watchpoint_tree), (zend_ulong)*zv))) { phpdbg_watchpoint_t *watch = result->ptr; @@ -702,7 +702,7 @@ remove_ht_watch: } case WATCH_ON_HASHTABLE: -#ifdef ZEND_DEBUG +#if ZEND_DEBUG if (watch->addr.ht->inconsistent) { phpdbg_notice("Watchpoint %s was unset, removing watchpoint", watch->str); zend_hash_del(&PHPDBG_G(watchpoints), watch->str, watch->str_len); @@ -772,9 +772,11 @@ void phpdbg_list_watchpoints(TSRMLS_D) { } void phpdbg_watch_efree(void *ptr) { - phpdbg_btree_result *result = phpdbg_btree_find_closest(&PHPDBG_G(watchpoint_tree), (zend_ulong)ptr); + phpdbg_btree_result *result; TSRMLS_FETCH(); + result = phpdbg_btree_find_closest(&PHPDBG_G(watchpoint_tree), (zend_ulong)ptr); + if (result) { phpdbg_watchpoint_t *watch = result->ptr; diff --git a/travis/compile.sh b/travis/compile.sh index 2b53099651..8b54b714ad 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -1,6 +1,18 @@ #!/bin/bash +if [[ "$ENABLE_MAINTAINER_ZTS" == 1 ]]; then + TS="--enable-maintainer-zts"; +else + TS=""; +fi +if [[ "$ENABLE_DEBUG" == 1 ]]; then + DEBUG="--enable-debug"; +else + DEBUG=""; +fi ./buildconf ./configure --quiet \ +$DEBUG \ +$TS \ --with-pdo-mysql=mysqlnd \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ @@ -34,5 +46,6 @@ --enable-sockets \ --with-bz2 \ --with-openssl \ +--with-gmp \ --enable-bcmath make --quiet |
