diff options
author | Stanislav Malyshev <stas@php.net> | 2016-08-16 23:50:42 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2016-08-16 23:50:42 -0700 |
commit | f8a75d4eee3446fb5c5c493b28b9ee80e34041cc (patch) | |
tree | 248201271bc3cd256f53efb4169d07d2af27ae6a | |
parent | e3829b88694460a2e5af10ad5eee9966fa55e589 (diff) | |
parent | ae3782a0db8b1e7c2a8665949cc3316227c61643 (diff) | |
download | php-git-f8a75d4eee3446fb5c5c493b28b9ee80e34041cc.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.0.10
* PHP-7.0: (34 commits)
Fix URL rewriter partially
Support "git worktree"
Add NEWS
Fix ASSERT logic
Bugfix 72791: fix memory leak in PDO persistent connections
Don't copy mime types in CLI server
Remove obsolete Id tags
Bump version in OCI8 test
Fixed bug #72788 (Invalid memory access when using persistent PDO connection)
Remove typo'd commit
Fix bug 72788: Invalid memory access when database_object_handle is undefined. Also fix memory leak in dbh_free when using persistent PDO connections.
Replace dead branch with ZEND_ASSERT()
Add test for bug #69107: finfo no longer detects PHP files
Fix bug #55451
Fix stream_socket_enable_crypto() test
Remove old $Id$ tags
Sync with 7.1 branch changes from Nikita & Dimitri to keep OCI8 code identical
Fix bug #72524 (Binding null values triggers ORA-24816 error)
Fix the fix (Nikita), thanks!
Check the return value of dbconvert() in mssql_guid_string(), as it may return -1 in case the conversion failed. In that case false is returned.
...
Conflicts:
ext/standard/ftp_fopen_wrapper.c
44 files changed, 1062 insertions, 856 deletions
@@ -2,12 +2,33 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2016 PHP 7.0.11 +- Core: + . Fixed bug #72767 (PHP Segfaults when trying to expand an infinite operator). + (Nikita) + - GD: . Fixed bug #72709 (imagesetstyle() causes OOB read for empty $styles). (cmb) +- OCI8 + . Fixed invalid handle error with Implicit Result Sets. (Chris Jones) + . Fixed bug #72524 (Binding null values triggers ORA-24816 error). (Chris Jones) + +- PDO: + . Fixed bug #72788 (Invalid memory access when using persistent PDO + connection). (Keyur) + . Fixed bug #72791 (Memory leak in PDO persistent connection handling). (Keyur) + - Session: . Fixed bug #72724 (PHP7: session-uploadprogress kills httpd). (Nikita) +- Standard: + . Fixed bug #55451 (substr_compare NULL length interpreted as 0). (Lauri + Kenttä) + +- Streams: + . Fixed bug #72764 (ftps:// opendir wrapper data channel encryption fails + with IIS FTP 7.5, 8.5). (vhuk) + ?? ??? 2016 PHP 7.0.10 @@ -50,6 +71,9 @@ PHP NEWS - DOM: . Fixed bug #66502 (DOM document dangling reference). (Sean Heelan, cmb) +- EXIF: + . Fixed bug #72735 (Samsung picture thumb not read (zero size)). (Kalle, Remi) + - Filter: . Fixed bug #71745 (FILTER_FLAG_NO_RES_RANGE does not cover whole 127.0.0.0/8 range). (bugs dot php dot net at majkl578 dot cz) @@ -93,7 +117,7 @@ PHP NEWS - PDO_pgsql: . Fixed bug #70313 (PDO statement fails to throw exception). (Matteo) . Implemented FR #72633 (Postgres PDO lastInsertId() should work without - specifying a sequence). (Pablo Santiago Sánchez) + specifying a sequence). (Pablo Santiago Sánchez, Matteo) - Reflection: . Fixed bug #72222 (ReflectionClass::export doesn't handle array constants). diff --git a/Zend/tests/bug72767.phpt b/Zend/tests/bug72767.phpt new file mode 100644 index 0000000000..20b559b2a1 --- /dev/null +++ b/Zend/tests/bug72767.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #72767: PHP Segfaults when trying to expand an infinite operator +--FILE-- +<?php + +function test() {} +$iterator = new LimitIterator( + new InfiniteIterator(new ArrayIterator([42])), + 0, 17000 +); +test(...$iterator); + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index af90b442f0..1012b3cc4f 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -145,7 +145,8 @@ static const zend_internal_function zend_pass_function = { ((ZEND_VM_STACK_PAGE_SLOTS(gen) - ZEND_VM_STACK_HEADER_SLOTS) * sizeof(zval)) #define ZEND_VM_STACK_PAGE_ALIGNED_SIZE(gen, size) \ - (((size) + (ZEND_VM_STACK_FREE_PAGE_SIZE(gen) - 1)) & ~(ZEND_VM_STACK_PAGE_SIZE(gen) - 1)) + (((size) + ZEND_VM_STACK_HEADER_SLOTS * sizeof(zval) \ + + (ZEND_VM_STACK_PAGE_SIZE(gen) - 1)) & ~(ZEND_VM_STACK_PAGE_SIZE(gen) - 1)) static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t size, zend_vm_stack prev) { zend_vm_stack page = (zend_vm_stack)emalloc(size); @@ -822,11 +823,8 @@ static zend_always_inline int zend_verify_arg_type(zend_function *zf, uint32_t a } else { ce = zend_verify_arg_class_kind(cur_arg_info); if (UNEXPECTED(!ce)) { - if (Z_TYPE_P(arg) == IS_OBJECT) { - zend_verify_arg_error(zf, arg_num, "be an instance of ", ZSTR_VAL(cur_arg_info->class_name), "instance of ", ZSTR_VAL(Z_OBJCE_P(arg)->name), arg); - } else { - zend_verify_arg_error(zf, arg_num, "be an instance of ", ZSTR_VAL(cur_arg_info->class_name), "", zend_zval_type_name(arg), arg); - } + ZEND_ASSERT(Z_TYPE_P(arg) != IS_OBJECT); + zend_verify_arg_error(zf, arg_num, "be an instance of ", ZSTR_VAL(cur_arg_info->class_name), "", zend_zval_type_name(arg), arg); return 0; } *cache_slot = (void*)ce; diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 2b9d560a51..2594cadf51 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -1703,6 +1703,10 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c break; case TAG_FMT_UNDEFINED: if (value) { + if (tag == TAG_MAKER_NOTE) { + length = MIN(length, strlen(value)); + } + /* do not recompute length here */ info_value->s = estrndup(value, length); info_data->length = length; @@ -2712,8 +2716,14 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu char *dir_start; for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) { - if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) - return FALSE; + if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) { +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "No maker note data found. Detected maker: %s (length = %d)", ImageInfo->make, strlen(ImageInfo->make)); +#endif + /* unknown manufacturer, not an error, use it as a string */ + return TRUE; + } + maker_note = maker_note_array+i; /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/ diff --git a/ext/fileinfo/tests/bug69107.phpt b/ext/fileinfo/tests/bug69107.phpt new file mode 100644 index 0000000000..9a7b26b5d1 --- /dev/null +++ b/ext/fileinfo/tests/bug69107.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #69107 (finfo no longer detects PHP files) +--SKIPIF-- +<?php +if (!extension_loaded('fileinfo')) die('skip fileinfo extension not available'); +?> +--FILE-- +<?php +$finfo = new finfo(FILEINFO_MIME_TYPE); + +var_dump($finfo->buffer("<?php\nclass A{}")); +var_dump($finfo->buffer("<?php class A{}")); +var_dump($finfo->buffer("<?php\tclass A{}")); +var_dump($finfo->buffer("<?php\n\rclass A{}")); +?> +===DONE=== +--EXPECT-- +string(10) "text/x-php" +string(10) "text/x-php" +string(10) "text/x-php" +string(10) "text/x-php" +===DONE=== diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index e2a74029bf..5629c2e312 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -288,6 +288,10 @@ if ($pid) { } + if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) { + die("SSLv23 handshake failed.\n"); + } + if (empty($m[1]) || $m[1] !== 'emptydir') { fputs($fs, "file1\r\nfile1\r\nfile\nb0rk\r\n"); } @@ -403,10 +407,6 @@ if ($pid) { $pasvs = stream_socket_accept($soc,10); - if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) { - die("SSLv23 handshake failed.\n"); - } - }elseif (preg_match('/^EPSV/', $buf, $matches)) { fputs($s, "550 Extended passsive mode not supported.\r\n"); } elseif (preg_match('/^SITE EXEC/', $buf, $matches)) { diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 index 0d08d21c29..14042401d5 100644 --- a/ext/oci8/config.m4 +++ b/ext/oci8/config.m4 @@ -1,7 +1,3 @@ -dnl -dnl $Id$ -dnl - if test -z "$SED"; then PHP_OCI8_SED="sed"; else diff --git a/ext/oci8/config.w32 b/ext/oci8/config.w32 index d83bf3fbdb..74014648ff 100644 --- a/ext/oci8/config.w32 +++ b/ext/oci8/config.w32 @@ -1,4 +1,3 @@ -// $Id$ // vim:ft=javascript if (PHP_OCI8 != "no" && PHP_OCI8_11G != "no") { diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 86f22a208f..488b3b42aa 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -103,12 +103,6 @@ zend_class_entry *oci_coll_class_entry_ptr; #define SQLT_CFILEE 115 #endif -#if ZEND_MODULE_API_NO > 20020429 -#define ONUPDATELONGFUNC OnUpdateLong -#else -#define ONUPDATELONGFUNC OnUpdateInt -#endif - #ifdef ZTS #define PHP_OCI_INIT_MODE (OCI_DEFAULT | OCI_OBJECT | OCI_THREADED | OCI_NO_MUTEX) #else @@ -144,8 +138,6 @@ ZEND_GET_MODULE(oci8) #endif /* COMPILE_DL */ /* }}} */ -#if defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3) - /* {{{ Function arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_define_by_name, 0, 0, 3) ZEND_ARG_INFO(0, statement_resource) @@ -641,118 +633,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_collection_trim_method, 0, 0, 1) ZEND_END_ARG_INFO() /* }}} */ -#else /* defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3) */ -/* {{{ Keep the old arginfo behavior when building with PHP 4 */ - -static unsigned char arginfo_ocifetchinto[] = { 2, BYREF_NONE, BYREF_FORCE }; -static unsigned char arginfo_oci_fetch_all[] = { 2, BYREF_NONE, BYREF_FORCE }; -static unsigned char arginfo_oci_define_by_name[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; -static unsigned char arginfo_oci_bind_by_name[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; -static unsigned char arginfo_oci_bind_array_by_name[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; - -#define arginfo_oci_free_descriptor NULL -#define arginfo_oci_lob_save NULL -#define arginfo_oci_lob_import NULL -#define arginfo_oci_lob_load NULL -#define arginfo_oci_lob_read NULL -#define arginfo_oci_lob_eof NULL -#define arginfo_oci_lob_tell NULL -#define arginfo_oci_lob_rewind NULL -#define arginfo_oci_lob_seek NULL -#define arginfo_oci_lob_size NULL -#define arginfo_oci_lob_write NULL -#define arginfo_oci_lob_append NULL -#define arginfo_oci_lob_truncate NULL -#define arginfo_oci_lob_erase NULL -#define arginfo_oci_lob_flush NULL -#define arginfo_ocisetbufferinglob NULL -#define arginfo_ocigetbufferinglob NULL -#define arginfo_oci_lob_copy NULL -#define arginfo_oci_lob_is_equal NULL -#define arginfo_oci_lob_export NULL -#define arginfo_oci_new_descriptor NULL -#define arginfo_oci_rollback NULL -#define arginfo_oci_commit NULL -#define arginfo_oci_field_name NULL -#define arginfo_oci_field_size NULL -#define arginfo_oci_field_scale NULL -#define arginfo_oci_field_precision NULL -#define arginfo_oci_field_type NULL -#define arginfo_oci_field_type_raw NULL -#define arginfo_oci_field_is_null NULL -#define arginfo_oci_internal_debug NULL -#define arginfo_oci_execute NULL -#define arginfo_oci_cancel NULL -#define arginfo_oci_fetch NULL -#define arginfo_oci_fetch_object NULL -#define arginfo_oci_fetch_row NULL -#define arginfo_oci_fetch_assoc NULL -#define arginfo_oci_fetch_array NULL -#define arginfo_oci_free_statement NULL -#define arginfo_oci_close NULL -#define arginfo_oci_new_connect NULL -#define arginfo_oci_connect NULL -#define arginfo_oci_pconnect NULL -#define arginfo_oci_error NULL -#define arginfo_oci_num_fields NULL -#define arginfo_oci_parse NULL -#define arginfo_oci_get_implicit_resultset NULL -#define arginfo_oci_set_prefetch NULL -#define arginfo_oci_set_client_identifier NULL -#define arginfo_oci_set_edition NULL -#define arginfo_oci_set_module_name NULL -#define arginfo_oci_set_action NULL -#define arginfo_oci_set_client_info NULL -#ifdef WAITIING_ORACLE_BUG_16695981_FIX -#define arginfo_oci_set_db_operation NULL -#endif -#define arginfo_oci_password_change NULL -#define arginfo_oci_new_cursor NULL -#define arginfo_oci_result NULL -#define arginfo_oci_client_version NULL -#define arginfo_oci_server_version NULL -#define arginfo_oci_statement_type NULL -#define arginfo_oci_num_rows NULL -#define arginfo_oci_free_collection NULL -#define arginfo_oci_collection_append NULL -#define arginfo_oci_collection_element_get NULL -#define arginfo_oci_collection_assign NULL -#define arginfo_oci_collection_element_assign NULL -#define arginfo_oci_collection_size NULL -#define arginfo_oci_collection_max NULL -#define arginfo_oci_collection_trim NULL -#define arginfo_oci_new_collection NULL -#define arginfo_oci_lob_size_method NULL -#define arginfo_oci_lob_getbuffering_method NULL -#define arginfo_oci_lob_close_method NULL -#define arginfo_oci_lob_save_method NULL -#define arginfo_oci_lob_import_method NULL -#define arginfo_oci_lob_read_method NULL -#define arginfo_oci_lob_seek_method NULL -#define arginfo_oci_lob_write_method NULL -#define arginfo_oci_lob_append_method NULL -#define arginfo_oci_lob_truncate_method NULL -#define arginfo_oci_lob_erase_method NULL -#define arginfo_oci_lob_flush_method NULL -#define arginfo_oci_lob_setbuffering_method NULL -#define arginfo_oci_lob_export_method NULL -#define arginfo_oci_lob_write_temporary_method NULL -#define arginfo_oci_lob_load_method NULL -#define arginfo_oci_lob_tell_method NULL -#define arginfo_oci_lob_rewind_method NULL -#define arginfo_oci_lob_eof_method NULL -#define arginfo_oci_free_descriptor_method NULL -#define arginfo_oci_collection_append_method NULL -#define arginfo_oci_collection_element_get_method NULL -#define arginfo_oci_collection_assign_method NULL -#define arginfo_oci_collection_size_method NULL -#define arginfo_oci_collection_element_assign_method NULL -#define arginfo_oci_collection_max_method NULL -#define arginfo_oci_collection_trim_method NULL -#define arginfo_oci_collection_free_method NULL -/* }}} */ -#endif /* defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3) */ - /* {{{ extension function prototypes */ PHP_FUNCTION(oci_bind_by_name); @@ -839,12 +719,7 @@ PHP_FUNCTION(oci_collection_trim); /* {{{ extension definition structures */ -static -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 2) || (PHP_MAJOR_VERSION > 5) -/* This "if" allows PECL builds from this file to be portable to older PHP releases */ -const -#endif -zend_function_entry php_oci_functions[] = { +static const zend_function_entry php_oci_functions[] = { PHP_FE(oci_define_by_name, arginfo_oci_define_by_name) PHP_FE(oci_bind_by_name, arginfo_oci_bind_by_name) PHP_FE(oci_bind_array_by_name, arginfo_oci_bind_array_by_name) @@ -970,19 +845,10 @@ zend_function_entry php_oci_functions[] = { PHP_FALIAS(ocicollsize, oci_collection_size, arginfo_oci_collection_size) PHP_FALIAS(ocicollmax, oci_collection_max, arginfo_oci_collection_max) PHP_FALIAS(ocicolltrim, oci_collection_trim, arginfo_oci_collection_trim) -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 7) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) || (PHP_MAJOR_VERSION > 5) PHP_FE_END -#else - {NULL,NULL,NULL} -#endif }; -static -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 2) || (PHP_MAJOR_VERSION > 5) -/* This "if" allows PECL builds from this file to be portable to older PHP releases */ -const -#endif -zend_function_entry php_oci_lob_class_functions[] = { +static const zend_function_entry php_oci_lob_class_functions[] = { PHP_FALIAS(load, oci_lob_load, arginfo_oci_lob_load_method) PHP_FALIAS(tell, oci_lob_tell, arginfo_oci_lob_tell_method) PHP_FALIAS(truncate, oci_lob_truncate, arginfo_oci_lob_truncate_method) @@ -1005,19 +871,10 @@ zend_function_entry php_oci_lob_class_functions[] = { PHP_FALIAS(save, oci_lob_save, arginfo_oci_lob_save_method) PHP_FALIAS(savefile, oci_lob_import, arginfo_oci_lob_import_method) PHP_FALIAS(free, oci_free_descriptor, arginfo_oci_free_descriptor_method) -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 7) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) || (PHP_MAJOR_VERSION > 5) PHP_FE_END -#else - {NULL,NULL,NULL} -#endif }; -static -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 2) || (PHP_MAJOR_VERSION > 5) -/* This "if" allows PECL builds from this file to be portable to older PHP releases */ -const -#endif -zend_function_entry php_oci_coll_class_functions[] = { +static const zend_function_entry php_oci_coll_class_functions[] = { PHP_FALIAS(append, oci_collection_append, arginfo_oci_collection_append_method) PHP_FALIAS(getelem, oci_collection_element_get, arginfo_oci_collection_element_get_method) PHP_FALIAS(assignelem, oci_collection_element_assign, arginfo_oci_collection_element_assign_method) @@ -1026,11 +883,7 @@ zend_function_entry php_oci_coll_class_functions[] = { PHP_FALIAS(max, oci_collection_max, arginfo_oci_collection_max_method) PHP_FALIAS(trim, oci_collection_trim, arginfo_oci_collection_trim_method) PHP_FALIAS(free, oci_free_collection, arginfo_oci_collection_free_method) -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 7) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) || (PHP_MAJOR_VERSION > 5) PHP_FE_END -#else - {NULL,NULL,NULL} -#endif }; zend_module_entry oci8_module_entry = { @@ -1053,12 +906,12 @@ zend_module_entry oci8_module_entry = { /* {{{ PHP_INI */ PHP_INI_BEGIN() - STD_PHP_INI_ENTRY( "oci8.max_persistent", "-1", PHP_INI_SYSTEM, ONUPDATELONGFUNC, max_persistent, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY( "oci8.persistent_timeout", "-1", PHP_INI_SYSTEM, ONUPDATELONGFUNC, persistent_timeout, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY( "oci8.ping_interval", "60", PHP_INI_SYSTEM, ONUPDATELONGFUNC, ping_interval, zend_oci_globals, oci_globals) + STD_PHP_INI_ENTRY( "oci8.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_oci_globals, oci_globals) + STD_PHP_INI_ENTRY( "oci8.persistent_timeout", "-1", PHP_INI_SYSTEM, OnUpdateLong, persistent_timeout, zend_oci_globals, oci_globals) + STD_PHP_INI_ENTRY( "oci8.ping_interval", "60", PHP_INI_SYSTEM, OnUpdateLong, ping_interval, zend_oci_globals, oci_globals) STD_PHP_INI_BOOLEAN("oci8.privileged_connect", "0", PHP_INI_SYSTEM, OnUpdateBool, privileged_connect, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY( "oci8.statement_cache_size", "20", PHP_INI_SYSTEM, ONUPDATELONGFUNC, statement_cache_size, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY( "oci8.default_prefetch", "100", PHP_INI_SYSTEM, ONUPDATELONGFUNC, default_prefetch, zend_oci_globals, oci_globals) + STD_PHP_INI_ENTRY( "oci8.statement_cache_size", "20", PHP_INI_SYSTEM, OnUpdateLong, statement_cache_size, zend_oci_globals, oci_globals) + STD_PHP_INI_ENTRY( "oci8.default_prefetch", "100", PHP_INI_SYSTEM, OnUpdateLong, default_prefetch, zend_oci_globals, oci_globals) STD_PHP_INI_BOOLEAN("oci8.old_oci_close_semantics", "0", PHP_INI_SYSTEM, OnUpdateBool, old_oci_close_semantics,zend_oci_globals, oci_globals) #if (OCI_MAJOR_VERSION >= 11) STD_PHP_INI_ENTRY( "oci8.connection_class", "", PHP_INI_ALL, OnUpdateString, connection_class, zend_oci_globals, oci_globals) @@ -1378,9 +1231,9 @@ PHP_MINFO_FUNCTION(oci) php_info_print_table_start(); php_info_print_table_header(2, "Statistics", ""); - snprintf(buf, sizeof(buf), "%pd", OCI_G(num_persistent)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, OCI_G(num_persistent)); php_info_print_table_row(2, "Active Persistent Connections", buf); - snprintf(buf, sizeof(buf), "%pd", OCI_G(num_links)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, OCI_G(num_links)); php_info_print_table_row(2, "Active Connections", buf); php_info_print_table_end(); } @@ -1809,7 +1662,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char ub2 charsetid_nls_lang = 0; if (session_mode & ~(OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) { - php_error_docref(NULL, E_WARNING, "Invalid session mode specified (%pd)", session_mode); + php_error_docref(NULL, E_WARNING, "Invalid session mode specified (" ZEND_LONG_FMT ")", session_mode); return NULL; } if (session_mode & (OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) { @@ -1839,13 +1692,6 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char php_error_docref(NULL, E_WARNING, "Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA"); return NULL; } -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5) - /* Safe mode has been removed in PHP 5.4 */ - if (PG(safe_mode)) { - php_error_docref(NULL, E_WARNING, "Privileged connect is disabled in Safe Mode"); - return NULL; - } -#endif } } @@ -2084,7 +1930,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) { /* all persistent connactions are in use, fallback to non-persistent connection creation */ - php_error_docref(NULL, E_NOTICE, "Too many open persistent connections (%pd)", OCI_G(num_persistent)); + php_error_docref(NULL, E_NOTICE, "Too many open persistent connections (" ZEND_LONG_FMT ")", OCI_G(num_persistent)); alloc_non_persistent = 1; } } @@ -2713,7 +2559,8 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg #else /* OCI_MAJOR_VERSION */ PHP_OCI_ZVAL_TO_STATEMENT(z_statement, invokedstatement); - if (invokedstatement->impres_flag == PHP_OCI_IMPRES_NO_CHILDREN) { + if (invokedstatement->impres_flag == PHP_OCI_IMPRES_NO_CHILDREN || + invokedstatement->impres_flag == PHP_OCI_IMPRES_IS_CHILD) { /* Already know there are no Implicit Result Sets */ statement = invokedstatement; } else if (invokedstatement->impres_flag == PHP_OCI_IMPRES_HAS_CHILDREN) { diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index 21102dc46f..38dedf3260 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -25,10 +25,6 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ - - - #ifdef HAVE_CONFIG_H #include "config.h" #endif diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index f78f03727d..727ec3e1c7 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -25,8 +25,6 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -240,32 +238,16 @@ PHP_FUNCTION(oci_lob_import) size_t filename_len; if (getThis()) { -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) { -#else - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &filename, &filename_len) == FAILURE) { -#endif return; } } else { -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { -#else - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { -#endif return; } } -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5) - /* The "p" parsing parameter handles this case in PHP 5.4+ */ - if (strlen(filename) != filename_len) { - php_error_docref(NULL, E_WARNING, "Filename cannot contain null bytes"); - RETURN_FALSE; - } -#endif - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; @@ -899,11 +881,7 @@ PHP_FUNCTION(oci_lob_export) ub4 lob_length; if (getThis()) { -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|ll", &filename, &filename_len, &start, &length) == FAILURE) { -#else - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ll", &filename, &filename_len, &start, &length) == FAILURE) { -#endif return; } @@ -917,11 +895,7 @@ PHP_FUNCTION(oci_lob_export) } } else { -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { -#else - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { -#endif return; } @@ -935,14 +909,6 @@ PHP_FUNCTION(oci_lob_export) } } -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5) - /* The "p" parsing parameter handles this case in PHP 5.4+ */ - if (strlen(filename) != filename_len) { - php_error_docref(NULL, E_WARNING, "Filename cannot contain null bytes"); - RETURN_FALSE; - } -#endif - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; @@ -971,22 +937,11 @@ PHP_FUNCTION(oci_lob_export) RETURN_FALSE; } -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5) - /* Safe mode has been removed in PHP 5.4 */ - if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { - RETURN_FALSE; - } -#endif - if (php_check_open_basedir(filename)) { RETURN_FALSE; } -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) stream = php_stream_open_wrapper_ex(filename, "w", REPORT_ERRORS, NULL, NULL); -#else - stream = php_stream_open_wrapper_ex(filename, "w", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL); -#endif block_length = PHP_OCI_LOB_BUFFER_SIZE; if (block_length > length) { @@ -1989,14 +1944,6 @@ PHP_FUNCTION(oci_password_change) size_t user_len, pass_old_len, pass_new_len, dbname_len; php_oci_connection *connection; -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5) - /* Safe mode has been removed in PHP 5.4 */ - if (PG(safe_mode)) { - php_error_docref(NULL, E_WARNING, "is disabled in Safe Mode"); - RETURN_FALSE; - } -#endif - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "rsss", &z_connection, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index d7b949ae13..a0042faec2 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -25,10 +25,6 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ - - - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -63,7 +59,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_lon /* these three are allowed */ break; default: - php_error_docref(NULL, E_WARNING, "Unknown descriptor type %pd", type); + php_error_docref(NULL, E_WARNING, "Unknown descriptor type " ZEND_LONG_FMT, type); return NULL; break; } @@ -630,7 +626,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag) /* only these two are allowed */ break; default: - php_error_docref(NULL, E_WARNING, "Invalid flag value: %pd", flush_flag); + php_error_docref(NULL, E_WARNING, "Invalid flag value: " ZEND_LONG_FMT, flush_flag); return 1; break; } @@ -716,12 +712,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename) ub4 offset = 1; sword errstatus; -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - /* Safe mode has been removed in PHP 5.4 */ if (php_check_open_basedir(filename)) { -#else - if ((PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename)) { -#endif return 1; } @@ -914,7 +905,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, zend_long type, char /* only these two are allowed */ break; default: - php_error_docref(NULL, E_WARNING, "Invalid temporary lob type: %pd", type); + php_error_docref(NULL, E_WARNING, "Invalid temporary lob type: " ZEND_LONG_FMT, type); return 1; break; } diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 55983d3e9f..d4f08150e7 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -25,9 +25,6 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ - - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -1178,7 +1175,8 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l } else if (Z_TYPE_P(var) == IS_STRING) { value_sz = (sb4) Z_STRLEN_P(var); } else { - value_sz = PHP_OCI_PIECE_SIZE; + /* Bug-72524: revert value_sz from PHP_OCI_PIECE_SIZE to 0. This restores PHP 5.6 behavior */ + value_sz = 0; } } else { value_sz = (sb4) maxlength; @@ -1243,6 +1241,11 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l bindp = zend_hash_update_ptr(statement->binds, zvtmp, bindp); zend_string_release(zvtmp); } + /* Make sure the minimum of value_sz is 1 to avoid ORA-3149 + * when both in/out parameters are bound with empty strings + */ + if (value_sz == 0) + value_sz = 1; bindp->descriptor = oci_desc; bindp->statement = oci_stmt; @@ -1507,7 +1510,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME convert_to_long(&tmp); column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0); if (!column) { - php_error_docref(NULL, E_WARNING, "Invalid column index \"%pd\"", Z_LVAL(tmp)); + php_error_docref(NULL, E_WARNING, "Invalid column index \"" ZEND_LONG_FMT "\"", Z_LVAL(tmp)); zval_dtor(&tmp); return NULL; } @@ -1574,7 +1577,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t convert_to_array(var); if (maxlength < -1) { - php_error_docref(NULL, E_WARNING, "Invalid max length value (%pd)", maxlength); + php_error_docref(NULL, E_WARNING, "Invalid max length value (" ZEND_LONG_FMT ")", maxlength); return 1; } @@ -1605,7 +1608,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t bind = php_oci_bind_array_helper_date(var, max_table_length, statement->connection); break; default: - php_error_docref(NULL, E_WARNING, "Unknown or unsupported datatype given: %pd", type); + php_error_docref(NULL, E_WARNING, "Unknown or unsupported datatype given: " ZEND_LONG_FMT, type); return 1; break; } diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index 88462415cb..13c1ea39bb 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -9,7 +9,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> <description> Use the OCI8 extension to access Oracle Database. PHP OCI8 2.1 builds -with PHP 7. Use 'pecl install oci8-2.0.11' to install OCI8 for PHP +with PHP 7. Use 'pecl install oci8-2.0.12' to install OCI8 for PHP 5.2 - PHP 5.6. Use 'pecl install oci8-1.4.10' to install PHP OCI8 1.4 for PHP 4.3.9 - PHP 5.1. The OCI8 extension can be linked with Oracle client libraries from Oracle Database 12.1, 11, or 10.2. These @@ -46,12 +46,12 @@ Interoperability Support" (ID 207303.1) for details. <active>no</active> </lead> - <date>2016-04-15</date> + <date>2016-08-07</date> <time>12:00:00</time> <version> - <release>2.1.1</release> - <api>2.1.1</api> + <release>2.1.2</release> + <api>2.1.2</api> </version> <stability> <release>stable</release> @@ -60,7 +60,8 @@ Interoperability Support" (ID 207303.1) for details. <license uri="http://www.php.net/license">PHP</license> <notes> This version is for PHP 7 only. -Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns) +Fixed invalid handle error with Implicit Result Sets +Fixed bug #72524 (Binding null values triggers ORA-24816 error) </notes> <contents> <dir name="/"> @@ -163,6 +164,7 @@ Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns) <file name="bug68298.phpt" role="test" /> <file name="bug71422.phpt" role="test" /> <file name="bug71600.phpt" role="test" /> + <file name="bug72524.phpt" role="test" /> <file name="clientversion.phpt" role="test" /> <file name="close.phpt" role="test" /> <file name="coll_001.phpt" role="test" /> @@ -469,6 +471,22 @@ Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns) <release> <version> + <release>2.1.1</release> + <api>2.1.1</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.php.net/license">PHP</license> + <notes> +This version is for PHP 7 only. +Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns) + </notes> +</release> + +<release> + <version> <release>2.1.0</release> <api>2.1.0</api> </version> diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index da62aabac6..70200e452d 100644 --- a/ext/oci8/php_oci8.h +++ b/ext/oci8/php_oci8.h @@ -25,8 +25,6 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ - #if HAVE_OCI8 # ifndef PHP_OCI8_H # define PHP_OCI8_H @@ -45,7 +43,7 @@ */ #undef PHP_OCI8_VERSION #endif -#define PHP_OCI8_VERSION "2.1.1" +#define PHP_OCI8_VERSION "2.1.2" extern zend_module_entry oci8_module_entry; #define phpext_oci8_ptr &oci8_module_entry diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index c0bc898cc1..3a63504e05 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -25,8 +25,6 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ - #if HAVE_OCI8 # ifndef PHP_OCI8_INT_H # define PHP_OCI8_INT_H diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index 67aafae3cc..9ff09551af 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -246,8 +246,9 @@ echo "Done\n"; --EXPECTF-- Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default Executing: + Oci_execute error ORA-6502 string(3) "abc" -string(3) "abc" +NULL Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default Executing: string(3) "abc" diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index 5c8b286249..af0ad4e682 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -246,8 +246,9 @@ echo "Done\n"; --EXPECTF-- Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default Executing: + Oci_execute error ORA-6502 string(3) "abc" -string(3) "abc" +NULL Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default Executing: string(3) "abc" diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index 9ca369a172..b8f2284830 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -248,8 +248,9 @@ echo "Done\n"; --EXPECTF-- Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default Executing: + Oci_execute error ORA-6502 string(3) "abc" -string(3) "abc" +NULL Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default Executing: string(3) "abc" diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index 56a666e4a5..646b3317a1 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -248,8 +248,9 @@ echo "Done\n"; --EXPECTF-- Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default Executing: + Oci_execute error ORA-6502 string(3) "abc" -string(3) "abc" +NULL Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default Executing: string(3) "abc" diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt index 44fcc588e8..d2018783bc 100644 --- a/ext/oci8/tests/bug27303_1_11gR1.phpt +++ b/ext/oci8/tests/bug27303_1_11gR1.phpt @@ -61,194 +61,194 @@ string(1) "6" string(1) "7" string(1) "8" string(1) "9" -string(2) "10" -string(2) "11" -string(2) "12" -string(2) "13" -string(2) "14" -string(2) "15" -string(2) "16" -string(2) "17" -string(2) "18" -string(2) "19" -string(2) "20" -string(2) "21" -string(2) "22" -string(2) "23" -string(2) "24" -string(2) "25" -string(2) "26" -string(2) "27" -string(2) "28" -string(2) "29" -string(2) "30" -string(2) "31" -string(2) "32" -string(2) "33" -string(2) "34" -string(2) "35" -string(2) "36" -string(2) "37" -string(2) "38" -string(2) "39" -string(2) "40" -string(2) "41" -string(2) "42" -string(2) "43" -string(2) "44" -string(2) "45" -string(2) "46" -string(2) "47" -string(2) "48" -string(2) "49" -string(2) "50" -string(2) "51" -string(2) "52" -string(2) "53" -string(2) "54" -string(2) "55" -string(2) "56" -string(2) "57" -string(2) "58" -string(2) "59" -string(2) "60" -string(2) "61" -string(2) "62" -string(2) "63" -string(2) "64" -string(2) "65" -string(2) "66" -string(2) "67" -string(2) "68" -string(2) "69" -string(2) "70" -string(2) "71" -string(2) "72" -string(2) "73" -string(2) "74" -string(2) "75" -string(2) "76" -string(2) "77" -string(2) "78" -string(2) "79" -string(2) "80" -string(2) "81" -string(2) "82" -string(2) "83" -string(2) "84" -string(2) "85" -string(2) "86" -string(2) "87" -string(2) "88" -string(2) "89" -string(2) "90" -string(2) "91" -string(2) "92" -string(2) "93" -string(2) "94" -string(2) "95" -string(2) "96" -string(2) "97" -string(2) "98" -string(2) "99" -string(3) "100" -string(3) "101" -string(3) "102" -string(3) "103" -string(3) "104" -string(3) "105" -string(3) "106" -string(3) "107" -string(3) "108" -string(3) "109" -string(3) "110" -string(3) "111" -string(3) "112" -string(3) "113" -string(3) "114" -string(3) "115" -string(3) "116" -string(3) "117" -string(3) "118" -string(3) "119" -string(3) "120" -string(3) "121" -string(3) "122" -string(3) "123" -string(3) "124" -string(3) "125" -string(3) "126" -string(3) "127" -string(3) "128" -string(3) "129" -string(3) "130" -string(3) "131" -string(3) "132" -string(3) "133" -string(3) "134" -string(3) "135" -string(3) "136" -string(3) "137" -string(3) "138" -string(3) "139" -string(3) "140" -string(3) "141" -string(3) "142" -string(3) "143" -string(3) "144" -string(3) "145" -string(3) "146" -string(3) "147" -string(3) "148" -string(3) "149" -string(3) "150" -string(3) "151" -string(3) "152" -string(3) "153" -string(3) "154" -string(3) "155" -string(3) "156" -string(3) "157" -string(3) "158" -string(3) "159" -string(3) "160" -string(3) "161" -string(3) "162" -string(3) "163" -string(3) "164" -string(3) "165" -string(3) "166" -string(3) "167" -string(3) "168" -string(3) "169" -string(3) "170" -string(3) "171" -string(3) "172" -string(3) "173" -string(3) "174" -string(3) "175" -string(3) "176" -string(3) "177" -string(3) "178" -string(3) "179" -string(3) "180" -string(3) "181" -string(3) "182" -string(3) "183" -string(3) "184" -string(3) "185" -string(3) "186" -string(3) "187" -string(3) "188" -string(3) "189" -string(3) "190" -string(3) "191" -string(3) "192" -string(3) "193" -string(3) "194" -string(3) "195" -string(3) "196" -string(3) "197" -string(3) "198" -string(3) "199" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" Done diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt index d9a68b8cc7..a50b3e2613 100644 --- a/ext/oci8/tests/bug27303_2_11gR1.phpt +++ b/ext/oci8/tests/bug27303_2_11gR1.phpt @@ -155,104 +155,104 @@ string(2) "96" string(2) "97" string(2) "98" string(2) "99" -string(3) "100" -string(3) "101" -string(3) "102" -string(3) "103" -string(3) "104" -string(3) "105" -string(3) "106" -string(3) "107" -string(3) "108" -string(3) "109" -string(3) "110" -string(3) "111" -string(3) "112" -string(3) "113" -string(3) "114" -string(3) "115" -string(3) "116" -string(3) "117" -string(3) "118" -string(3) "119" -string(3) "120" -string(3) "121" -string(3) "122" -string(3) "123" -string(3) "124" -string(3) "125" -string(3) "126" -string(3) "127" -string(3) "128" -string(3) "129" -string(3) "130" -string(3) "131" -string(3) "132" -string(3) "133" -string(3) "134" -string(3) "135" -string(3) "136" -string(3) "137" -string(3) "138" -string(3) "139" -string(3) "140" -string(3) "141" -string(3) "142" -string(3) "143" -string(3) "144" -string(3) "145" -string(3) "146" -string(3) "147" -string(3) "148" -string(3) "149" -string(3) "150" -string(3) "151" -string(3) "152" -string(3) "153" -string(3) "154" -string(3) "155" -string(3) "156" -string(3) "157" -string(3) "158" -string(3) "159" -string(3) "160" -string(3) "161" -string(3) "162" -string(3) "163" -string(3) "164" -string(3) "165" -string(3) "166" -string(3) "167" -string(3) "168" -string(3) "169" -string(3) "170" -string(3) "171" -string(3) "172" -string(3) "173" -string(3) "174" -string(3) "175" -string(3) "176" -string(3) "177" -string(3) "178" -string(3) "179" -string(3) "180" -string(3) "181" -string(3) "182" -string(3) "183" -string(3) "184" -string(3) "185" -string(3) "186" -string(3) "187" -string(3) "188" -string(3) "189" -string(3) "190" -string(3) "191" -string(3) "192" -string(3) "193" -string(3) "194" -string(3) "195" -string(3) "196" -string(3) "197" -string(3) "198" -string(3) "199" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" Done diff --git a/ext/oci8/tests/bug27303_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt index d65fbc5f88..550d89fdcc 100644 --- a/ext/oci8/tests/bug27303_4_11gR1.phpt +++ b/ext/oci8/tests/bug27303_4_11gR1.phpt @@ -59,194 +59,194 @@ string(1) "6" string(1) "7" string(1) "8" string(1) "9" -string(2) "10" -string(2) "11" -string(2) "12" -string(2) "13" -string(2) "14" -string(2) "15" -string(2) "16" -string(2) "17" -string(2) "18" -string(2) "19" -string(2) "20" -string(2) "21" -string(2) "22" -string(2) "23" -string(2) "24" -string(2) "25" -string(2) "26" -string(2) "27" -string(2) "28" -string(2) "29" -string(2) "30" -string(2) "31" -string(2) "32" -string(2) "33" -string(2) "34" -string(2) "35" -string(2) "36" -string(2) "37" -string(2) "38" -string(2) "39" -string(2) "40" -string(2) "41" -string(2) "42" -string(2) "43" -string(2) "44" -string(2) "45" -string(2) "46" -string(2) "47" -string(2) "48" -string(2) "49" -string(2) "50" -string(2) "51" -string(2) "52" -string(2) "53" -string(2) "54" -string(2) "55" -string(2) "56" -string(2) "57" -string(2) "58" -string(2) "59" -string(2) "60" -string(2) "61" -string(2) "62" -string(2) "63" -string(2) "64" -string(2) "65" -string(2) "66" -string(2) "67" -string(2) "68" -string(2) "69" -string(2) "70" -string(2) "71" -string(2) "72" -string(2) "73" -string(2) "74" -string(2) "75" -string(2) "76" -string(2) "77" -string(2) "78" -string(2) "79" -string(2) "80" -string(2) "81" -string(2) "82" -string(2) "83" -string(2) "84" -string(2) "85" -string(2) "86" -string(2) "87" -string(2) "88" -string(2) "89" -string(2) "90" -string(2) "91" -string(2) "92" -string(2) "93" -string(2) "94" -string(2) "95" -string(2) "96" -string(2) "97" -string(2) "98" -string(2) "99" -string(3) "100" -string(3) "101" -string(3) "102" -string(3) "103" -string(3) "104" -string(3) "105" -string(3) "106" -string(3) "107" -string(3) "108" -string(3) "109" -string(3) "110" -string(3) "111" -string(3) "112" -string(3) "113" -string(3) "114" -string(3) "115" -string(3) "116" -string(3) "117" -string(3) "118" -string(3) "119" -string(3) "120" -string(3) "121" -string(3) "122" -string(3) "123" -string(3) "124" -string(3) "125" -string(3) "126" -string(3) "127" -string(3) "128" -string(3) "129" -string(3) "130" -string(3) "131" -string(3) "132" -string(3) "133" -string(3) "134" -string(3) "135" -string(3) "136" -string(3) "137" -string(3) "138" -string(3) "139" -string(3) "140" -string(3) "141" -string(3) "142" -string(3) "143" -string(3) "144" -string(3) "145" -string(3) "146" -string(3) "147" -string(3) "148" -string(3) "149" -string(3) "150" -string(3) "151" -string(3) "152" -string(3) "153" -string(3) "154" -string(3) "155" -string(3) "156" -string(3) "157" -string(3) "158" -string(3) "159" -string(3) "160" -string(3) "161" -string(3) "162" -string(3) "163" -string(3) "164" -string(3) "165" -string(3) "166" -string(3) "167" -string(3) "168" -string(3) "169" -string(3) "170" -string(3) "171" -string(3) "172" -string(3) "173" -string(3) "174" -string(3) "175" -string(3) "176" -string(3) "177" -string(3) "178" -string(3) "179" -string(3) "180" -string(3) "181" -string(3) "182" -string(3) "183" -string(3) "184" -string(3) "185" -string(3) "186" -string(3) "187" -string(3) "188" -string(3) "189" -string(3) "190" -string(3) "191" -string(3) "192" -string(3) "193" -string(3) "194" -string(3) "195" -string(3) "196" -string(3) "197" -string(3) "198" -string(3) "199" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" Done diff --git a/ext/oci8/tests/bug72524.phpt b/ext/oci8/tests/bug72524.phpt new file mode 100644 index 0000000000..dde99b000c --- /dev/null +++ b/ext/oci8/tests/bug72524.phpt @@ -0,0 +1,96 @@ +--TEST--
+Bug #72524 (Binding null values triggers ORA-24816 error)
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialize
+
+$stmtarray = array(
+ "CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run test
+
+$sql = "INSERT INTO mytable VALUES (:clob_col, :varchar2_col)";
+
+echo "Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default\n";
+$stmt = oci_parse($c, $sql);
+
+$clob = NULL;
+$varchar2 = NULL;
+oci_bind_by_name($stmt, ':clob_col', $clob);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
+
+var_dump(oci_execute($stmt));
+
+echo "Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default\n";
+
+$clob = '';
+$varchar2 = '';
+oci_bind_by_name($stmt, ':clob_col', $clob);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
+
+var_dump(oci_execute($stmt));
+
+echo "Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default\n";
+$clob = 'abc';
+$varchar2 = 'abc';
+oci_bind_by_name($stmt, ':clob_col', $clob, 0);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0);
+
+var_dump(oci_execute($stmt));
+
+echo "Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default\n";
+$clob = NULL;
+$varchar2 = NULL;
+oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG);
+
+var_dump(oci_execute($stmt));
+
+echo "Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default\n";
+$clob = NULL;
+$varchar2 = NULL;
+oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG);
+
+
+var_dump(oci_execute($stmt));
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP TABLE mytable"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default
+bool(true)
+Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default
+bool(true)
+Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default
+bool(true)
+Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default
+
+Warning: oci_execute(): ORA-24816: %s in %s on line %d
+bool(false)
+Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default
+
+Warning: oci_execute(): ORA-24816: %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/oci8/tests/driver_name.phpt b/ext/oci8/tests/driver_name.phpt index 0ff9bc485f..9814703159 100644 --- a/ext/oci8/tests/driver_name.phpt +++ b/ext/oci8/tests/driver_name.phpt @@ -57,11 +57,11 @@ function get_attr($conn) ?> --EXPECT-- **Test 1.1 - Default values for the attribute ************** -The value of DRIVER_NAME is PHP OCI8 : 2.1.1 +The value of DRIVER_NAME is PHP OCI8 : 2.1.2 ***Test 1.2 - Get the values from different connections ************** Testing with oci_pconnect() -The value of DRIVER_NAME is PHP OCI8 : 2.1.1 +The value of DRIVER_NAME is PHP OCI8 : 2.1.2 Testing with oci_new_connect() -The value of DRIVER_NAME is PHP OCI8 : 2.1.1 +The value of DRIVER_NAME is PHP OCI8 : 2.1.2 Done diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 2fb5334a9d..0f2a2ba788 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -297,7 +297,7 @@ static PHP_METHOD(PDO, dbh_constructor) /* is the connection still alive ? */ if (pdbh->methods->check_liveness && FAILURE == (pdbh->methods->check_liveness)(pdbh)) { /* nope... need to kill it */ - /*??? memory leak */ + pdbh->refcount--; zend_list_close(le); pdbh = NULL; } @@ -310,6 +310,7 @@ static PHP_METHOD(PDO, dbh_constructor) /* need a brand new pdbh */ pdbh = pecalloc(1, sizeof(*pdbh), 1); + pdbh->refcount = 1; pdbh->is_persistent = 1; pdbh->persistent_id = pemalloc(plen + 1, 1); memcpy((char *)pdbh->persistent_id, hashkey, plen+1); @@ -322,6 +323,7 @@ static PHP_METHOD(PDO, dbh_constructor) efree(dbh); /* switch over to the persistent one */ Z_PDO_OBJECT_P(object)->inner = pdbh; + pdbh->refcount++; dbh = pdbh; } @@ -1503,15 +1505,20 @@ static void dbh_free(pdo_dbh_t *dbh, zend_bool free_persistent) { int i; - if (dbh->is_persistent && !free_persistent) { - return; - } - if (dbh->query_stmt) { zval_ptr_dtor(&dbh->query_stmt_zval); dbh->query_stmt = NULL; } + if (dbh->is_persistent) { +#if ZEND_DEBUG + ZEND_ASSERT(!free_persistent || (dbh->refcount == 1)); +#endif + if (!free_persistent && (--dbh->refcount)) { + return; + } + } + if (dbh->methods) { dbh->methods->closer(dbh); } diff --git a/ext/pdo/tests/bug_72788.phpt b/ext/pdo/tests/bug_72788.phpt new file mode 100644 index 0000000000..80609a21ba --- /dev/null +++ b/ext/pdo/tests/bug_72788.phpt @@ -0,0 +1,33 @@ +--TEST-- +PDO Common: Bug #72788 (Invalid memory access when using persistent PDO connection) +--SKIPIF-- +<?php +if (!extension_loaded('pdo')) die('skip'); +$dir = getenv('REDIR_TEST_DIR'); +if (false == $dir) die('skip no driver'); +require_once $dir . 'pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); +require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; + +putenv("PDOTEST_ATTR=" . serialize(array(PDO::ATTR_PERSISTENT => true))); + +function test() { + $db = PDOTest::factory('PDO', false); + $stmt = @$db->query("SELECT 1 FROM TABLE_DOES_NOT_EXIST"); + if ($stmt === false) { + echo "Statement failed as expected\n"; + } +} + +test(); +test(); +echo "Done"; +?> +--EXPECT-- +Statement failed as expected +Statement failed as expected +Done diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt index 31ee88b76b..2b8568fb46 100644 --- a/ext/pdo/tests/pdo_017.phpt +++ b/ext/pdo/tests/pdo_017.phpt @@ -16,7 +16,7 @@ try { } if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../pdo_mysql/tests/mysql_pdo_test.inc'); if (false === MySQLPDOTest::detect_transactional_mysql_engine($db)) { die('skip your mysql configuration does not support working transactions'); } @@ -29,7 +29,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; $db = PDOTest::factory(); if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../pdo_mysql/tests/mysql_pdo_test.inc'); $suf = ' ENGINE=' . MySQLPDOTest::detect_transactional_mysql_engine($db); } else { $suf = ''; diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index b141de79ef..4a2146dd16 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -88,7 +88,8 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */ } #endif - if (IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)]) + if (!Z_ISUNDEF(stmt->database_object_handle) + && IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)]) && (!(GC_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED))) { while (mysql_more_results(S->H->server)) { MYSQL_RES *res; diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 6bc1976161..df99912e4c 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -363,12 +363,13 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t * char *id = NULL; PGresult *res; ExecStatusType status; - const char *q[1]; - q[0] = name; - if (PHP_PDO_PGSQL_LASTVAL_PG_VERSION <= PQserverVersion(H->server) && name == NULL) { + if (name == NULL) { res = PQexec(H->server, "SELECT LASTVAL()"); } else { + const char *q[1]; + q[0] = name; + res = PQexecParams(H->server, "SELECT CURRVAL($1)", 1, NULL, q, NULL, NULL, 0); } status = PQresultStatus(res); diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index a5ee2e993e..f7c46a6706 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -61,7 +61,8 @@ static int pgsql_stmt_dtor(pdo_stmt_t *stmt) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; - zend_bool server_obj_usable = IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)]) + zend_bool server_obj_usable = !Z_ISUNDEF(stmt->database_object_handle) + && IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)]) && !(GC_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED); if (S->result) { diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index 86fc847633..30c2cc2d52 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -29,8 +29,6 @@ #define PHP_PDO_PGSQL_CONNECTION_FAILURE_SQLSTATE "08006" -#define PHP_PDO_PGSQL_LASTVAL_PG_VERSION 80100 - typedef struct { const char *file; int line; diff --git a/ext/pdo_pgsql/tests/bug_last_insert_id.phpt b/ext/pdo_pgsql/tests/bug72633.phpt index 30dd0f039a..06bd25e626 100644 --- a/ext/pdo_pgsql/tests/bug_last_insert_id.phpt +++ b/ext/pdo_pgsql/tests/bug72633.phpt @@ -1,5 +1,5 @@ --TEST-- -currval() vs lastval() - PDO PgSQL Bug #1134 [BUG] New record, PostgreSQL and the Primary key https://github.com/phalcon/cphalcon/issues/1134 +PDO PgSQL Bug #72633 (Postgres PDO lastInsertId() should work without specifying a sequence) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index a28b6c14b1..f562827295 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -82,6 +82,7 @@ typedef struct _php_ftp_dirstream_data { */ static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size) { + buffer[0] = '\0'; /* in case read fails to read anything */ while (php_stream_gets(stream, buffer, buffer_size-1) && !(isdigit((int) buffer[0]) && isdigit((int) buffer[1]) && isdigit((int) buffer[2]) && buffer[3] == ' ')); @@ -728,18 +729,6 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat goto opendir_errexit; } - php_stream_context_set(datastream, context); - if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream, - STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL) < 0 || - php_stream_xport_crypto_enable(datastream, 1) < 0)) { - - php_stream_wrapper_log_error(wrapper, options, "Unable to activate SSL mode"); - php_stream_close(datastream); - datastream = NULL; - goto opendir_errexit; - } - - php_stream_printf(stream, "NLST %s\r\n", (resource->path != NULL ? resource->path : "/")); result = GET_FTP_RESULT(stream); @@ -752,6 +741,17 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat goto opendir_errexit; } + php_stream_context_set(datastream, context); + if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream, + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL) < 0 || + php_stream_xport_crypto_enable(datastream, 1) < 0)) { + + php_stream_wrapper_log_error(wrapper, options, "Unable to activate SSL mode"); + php_stream_close(datastream); + datastream = NULL; + goto opendir_errexit; + } + php_url_free(resource); dirsdata = emalloc(sizeof *dirsdata); diff --git a/ext/standard/string.c b/ext/standard/string.c index 2b87791cda..7c456c41ee 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5700,14 +5700,15 @@ PHP_FUNCTION(substr_compare) { zend_string *s1, *s2; zend_long offset, len=0; + zend_bool len_is_default=1; zend_bool cs=0; size_t cmp_len; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSl|lb", &s1, &s2, &offset, &len, &cs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSl|l!b", &s1, &s2, &offset, &len, &len_is_default, &cs) == FAILURE) { RETURN_FALSE; } - if (ZEND_NUM_ARGS() >= 4 && len <= 0) { + if (!len_is_default && len <= 0) { if (len == 0) { RETURN_LONG(0L); } else { diff --git a/ext/standard/tests/general_functions/url_rewriter.phpt b/ext/standard/tests/general_functions/url_rewriter.phpt new file mode 100644 index 0000000000..ce91b27a00 --- /dev/null +++ b/ext/standard/tests/general_functions/url_rewriter.phpt @@ -0,0 +1,139 @@ +--TEST-- +URL Rewriter tests +--INI-- +url_rewriter.tags="a=href,form=" +session.use_only_cookies=0 +session.use_trans_sid=1 +session.use_strict_mode=0 +--FILE-- +<?php +session_id('id'); + +$_SERVER['HTTP_HOST'] = 'php.net'; +session_start(); +output_add_rewrite_var('a','b'); +?> + +<a></a> +<a href=""></a> +<a href="foo"></a> +<a href="?foo"></a> +<a href="/foo"></a> +<a href="foo=bar"></a> +<a href="foo.php#bar"></a> +<a href="../foo.php#bar"></a> + +<a href="//bad.net/foo"></a> +<a href="//bad.net/?foo"></a> +<a href="//bad.net/foo"></a> +<a href="//bad.net/foo=bar"></a> +<a href="//bad.net/foo.php#bar"></a> +<a href="//bad.net/../foo.php#bar"></a> + +<a href="//php.net/foo"></a> +<a href="//php.net/?foo"></a> +<a href="//php.net//foo"></a> +<a href="//php.net/foo=bar"></a> +<a href="//php.net/foo.php#bar"></a> + +<a href="http://bad.net/foo"></a> +<a href="http://bad.net/?foo"></a> +<a href="http://bad.net/foo"></a> +<a href="http://bad.net/foo=bar"></a> +<a href="http://bad.net/foo.php#bar"></a> +<a href="http://bad.net/../foo.php#bar"></a> + +<a href="http://php.net/foo"></a> +<a href="http://php.net/?foo"></a> +<a href="http://php.net//foo"></a> +<a href="http://php.net/foo=bar"></a> +<a href="http://php.net/foo.php#bar"></a> +<a href="http://php.net/../foo.php#bar"></a> + +<a href="bad://bad.net/foo"></a> +<a href="bad://bad.net/?foo"></a> +<a href="bad://bad.net/foo"></a> +<a href="bad://bad.net/foo=bar"></a> +<a href="bad://bad.net/foo.php#bar"></a> +<a href="bad://bad.net/../foo.php#bar"></a> + +<a href="bad://php.net/foo"></a> +<a href="bad://php.net/?foo"></a> +<a href="bad://php.net//foo"></a> +<a href="bad://php.net/foo=bar"></a> +<a href="bad://php.net/foo.php#bar"></a> +<a href="bad://php.net/../foo.php#bar"></a> + +<form></form> +<form action=""></form> +<form action="foo.php"></form> +<form action="//php.net/foo.php"></form> +<form action="http://php.net/foo.php"></form> + +<form action="bad://php.net/foo.php"></form> +<form action="//bad.net/foo.php"></form> +<form action="http://php.net/foo.php"></form> +<form action="bad://php.net/foo.php"></form> +<form action="//bad.net/foo.php"></form> +--EXPECT-- +<a></a> +<a href="?PHPSESSID=id&a=b"></a> +<a href="foo?PHPSESSID=id&a=b"></a> +<a href="?foo&PHPSESSID=id&a=b"></a> +<a href="/foo?PHPSESSID=id&a=b"></a> +<a href="foo=bar?PHPSESSID=id&a=b"></a> +<a href="foo.php?PHPSESSID=id&a=b#bar"></a> +<a href="../foo.php?PHPSESSID=id&a=b#bar"></a> + +<a href="//bad.net/foo"></a> +<a href="//bad.net/?foo"></a> +<a href="//bad.net/foo"></a> +<a href="//bad.net/foo=bar"></a> +<a href="//bad.net/foo.php#bar"></a> +<a href="//bad.net/../foo.php#bar"></a> + +<a href="//php.net/foo?PHPSESSID=id&a=b"></a> +<a href="//php.net/?foo&PHPSESSID=id&a=b"></a> +<a href="//php.net//foo?PHPSESSID=id&a=b"></a> +<a href="//php.net/foo=bar?PHPSESSID=id&a=b"></a> +<a href="//php.net/foo.php?PHPSESSID=id&a=b#bar"></a> + +<a href="http://bad.net/foo"></a> +<a href="http://bad.net/?foo"></a> +<a href="http://bad.net/foo"></a> +<a href="http://bad.net/foo=bar"></a> +<a href="http://bad.net/foo.php#bar"></a> +<a href="http://bad.net/../foo.php#bar"></a> + +<a href="http://php.net/foo"></a> +<a href="http://php.net/?foo"></a> +<a href="http://php.net//foo"></a> +<a href="http://php.net/foo=bar"></a> +<a href="http://php.net/foo.php#bar"></a> +<a href="http://php.net/../foo.php#bar"></a> + +<a href="bad://bad.net/foo"></a> +<a href="bad://bad.net/?foo"></a> +<a href="bad://bad.net/foo"></a> +<a href="bad://bad.net/foo=bar"></a> +<a href="bad://bad.net/foo.php#bar"></a> +<a href="bad://bad.net/../foo.php#bar"></a> + +<a href="bad://php.net/foo"></a> +<a href="bad://php.net/?foo"></a> +<a href="bad://php.net//foo"></a> +<a href="bad://php.net/foo=bar"></a> +<a href="bad://php.net/foo.php#bar"></a> +<a href="bad://php.net/../foo.php#bar"></a> + +<form><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> +<form action=""><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> +<form action="foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> +<form action="//php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> +<form action="http://php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> + +<form action="bad://php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> +<form action="//bad.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> +<form action="http://php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> +<form action="bad://php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> +<form action="//bad.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form> diff --git a/ext/standard/tests/streams/stream_socket_enable_crypto.phpt b/ext/standard/tests/streams/stream_socket_enable_crypto.phpt index e7ee3e5b3b..6791e7a31e 100644 --- a/ext/standard/tests/streams/stream_socket_enable_crypto.phpt +++ b/ext/standard/tests/streams/stream_socket_enable_crypto.phpt @@ -19,13 +19,13 @@ $sock = stream_socket_server($serverUri, $errno, $errstr); if (is_resource($sock)) { var_dump(stream_socket_enable_crypto($sock, false)); var_dump(stream_socket_enable_crypto($sock, true)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT)); var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv3_CLIENT)); var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv2_CLIENT)); - var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT)); var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER)); var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv2_SERVER)); var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv3_SERVER)); - var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER)); var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_TLS_SERVER)); } else { die("Test stream_socket_enable_crypto has failed; Unable to connect: {$errstr} ({$errno})"); diff --git a/ext/standard/tests/strings/bug55451.phpt b/ext/standard/tests/strings/bug55451.phpt new file mode 100644 index 0000000000..4759965094 --- /dev/null +++ b/ext/standard/tests/strings/bug55451.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #55451 (substr_compare with NULL as default length) +--FILE-- +<?php +var_dump(substr_compare("abcde", "ABCD", 0, NULL, false) != 0); +var_dump(substr_compare("abcde", "ABCD", 0, NULL, true) != 0); +var_dump(substr_compare("abcde", "ABCDE", 0, NULL, false) != 0); +var_dump(substr_compare("abcde", "ABCDE", 0, NULL, true) == 0); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index 2012fe07eb..c78dfca43e 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -39,7 +39,7 @@ Test Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d bool(false) -int(0) +int(4) Warning: substr_compare() expects parameter 4 to be integer, string given in %s on line %d bool(false) diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index 07ebbe09a2..5db9c6d935 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 */ +/* Generated by re2c 0.14.3 */ #line 1 "ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ @@ -115,11 +115,37 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st const char *bash = NULL; const char *sep = "?"; + /* + * Don't modify "//example.com" full path, unless + * HTTP_HOST matches. + */ + if (ZSTR_VAL(url->s)[0] == '/' && ZSTR_VAL(url->s)[1] == '/') { + zval *tmp = NULL, *http_host = NULL; + size_t target_len, host_len; + if ((!(tmp = zend_hash_str_find(&EG(symbol_table), ZEND_STRL("_SERVER")))) + || Z_TYPE_P(tmp) != IS_ARRAY + || !(http_host = zend_hash_str_find(HASH_OF(tmp), ZEND_STRL("HTTP_HOST"))) + || Z_TYPE_P(http_host) != IS_STRING) { + smart_str_append_smart_str(dest, url); + return; + } + /* HTTP_HOST could be "example.com:8888", etc. */ + /* Need to find end of URL in buffer */ + host_len = strcspn(Z_STRVAL_P(http_host), ":"); + target_len = strcspn(ZSTR_VAL(url->s)+2, "/\"'?>\r\n"); + if (host_len + && host_len == target_len + && strncasecmp(Z_STRVAL_P(http_host), ZSTR_VAL(url->s)+2, host_len)) { + smart_str_append_smart_str(dest, url); + return; + } + } + q = (p = ZSTR_VAL(url->s)) + ZSTR_LEN(url->s); scan: -#line 123 "ext/standard/url_scanner_ex.c" +#line 149 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -162,22 +188,22 @@ scan: if (yybm[0+yych] & 128) { goto yy8; } - if (yych <= '9') goto yy6; + if (yych <= '#') goto yy6; if (yych >= ';') goto yy4; ++YYCURSOR; -#line 125 "ext/standard/url_scanner_ex.re" +#line 151 "ext/standard/url_scanner_ex.re" { smart_str_append_smart_str(dest, url); return; } -#line 171 "ext/standard/url_scanner_ex.c" +#line 197 "ext/standard/url_scanner_ex.c" yy4: ++YYCURSOR; -#line 126 "ext/standard/url_scanner_ex.re" +#line 152 "ext/standard/url_scanner_ex.re" { sep = separator; goto scan; } -#line 176 "ext/standard/url_scanner_ex.c" +#line 202 "ext/standard/url_scanner_ex.c" yy6: ++YYCURSOR; -#line 127 "ext/standard/url_scanner_ex.re" +#line 153 "ext/standard/url_scanner_ex.re" { bash = p - 1; goto done; } -#line 181 "ext/standard/url_scanner_ex.c" +#line 207 "ext/standard/url_scanner_ex.c" yy8: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -185,11 +211,11 @@ yy8: if (yybm[0+yych] & 128) { goto yy8; } -#line 128 "ext/standard/url_scanner_ex.re" +#line 154 "ext/standard/url_scanner_ex.re" { goto scan; } -#line 191 "ext/standard/url_scanner_ex.c" +#line 217 "ext/standard/url_scanner_ex.c" } -#line 129 "ext/standard/url_scanner_ex.re" +#line 155 "ext/standard/url_scanner_ex.re" done: @@ -374,7 +400,7 @@ state_plain_begin: state_plain: start = YYCURSOR; -#line 378 "ext/standard/url_scanner_ex.c" +#line 404 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -417,9 +443,9 @@ state_plain: goto yy15; } ++YYCURSOR; -#line 313 "ext/standard/url_scanner_ex.re" +#line 339 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; } -#line 423 "ext/standard/url_scanner_ex.c" +#line 449 "ext/standard/url_scanner_ex.c" yy15: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -427,17 +453,17 @@ yy15: if (yybm[0+yych] & 128) { goto yy15; } -#line 314 "ext/standard/url_scanner_ex.re" +#line 340 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain; } -#line 433 "ext/standard/url_scanner_ex.c" +#line 459 "ext/standard/url_scanner_ex.c" } -#line 315 "ext/standard/url_scanner_ex.re" +#line 341 "ext/standard/url_scanner_ex.re" state_tag: start = YYCURSOR; -#line 441 "ext/standard/url_scanner_ex.c" +#line 467 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -488,14 +514,14 @@ yy20: yych = *YYCURSOR; goto yy25; yy21: -#line 320 "ext/standard/url_scanner_ex.re" +#line 346 "ext/standard/url_scanner_ex.re" { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; } -#line 494 "ext/standard/url_scanner_ex.c" +#line 520 "ext/standard/url_scanner_ex.c" yy22: ++YYCURSOR; -#line 321 "ext/standard/url_scanner_ex.re" +#line 347 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 499 "ext/standard/url_scanner_ex.c" +#line 525 "ext/standard/url_scanner_ex.c" yy24: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -506,7 +532,7 @@ yy25: } goto yy21; } -#line 322 "ext/standard/url_scanner_ex.re" +#line 348 "ext/standard/url_scanner_ex.re" state_next_arg_begin: @@ -515,7 +541,7 @@ state_next_arg_begin: state_next_arg: start = YYCURSOR; -#line 519 "ext/standard/url_scanner_ex.c" +#line 545 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -580,28 +606,28 @@ yy28: ++YYCURSOR; if ((yych = *YYCURSOR) == '>') goto yy39; yy29: -#line 333 "ext/standard/url_scanner_ex.re" +#line 359 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 586 "ext/standard/url_scanner_ex.c" +#line 612 "ext/standard/url_scanner_ex.c" yy30: ++YYCURSOR; yy31: -#line 330 "ext/standard/url_scanner_ex.re" +#line 356 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } -#line 592 "ext/standard/url_scanner_ex.c" +#line 618 "ext/standard/url_scanner_ex.c" yy32: ++YYCURSOR; yych = *YYCURSOR; goto yy38; yy33: -#line 331 "ext/standard/url_scanner_ex.re" +#line 357 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_next_arg; } -#line 600 "ext/standard/url_scanner_ex.c" +#line 626 "ext/standard/url_scanner_ex.c" yy34: ++YYCURSOR; -#line 332 "ext/standard/url_scanner_ex.re" +#line 358 "ext/standard/url_scanner_ex.re" { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } -#line 605 "ext/standard/url_scanner_ex.c" +#line 631 "ext/standard/url_scanner_ex.c" yy36: yych = *++YYCURSOR; goto yy29; @@ -619,13 +645,13 @@ yy39: yych = *YYCURSOR; goto yy31; } -#line 334 "ext/standard/url_scanner_ex.re" +#line 360 "ext/standard/url_scanner_ex.re" state_arg: start = YYCURSOR; -#line 629 "ext/standard/url_scanner_ex.c" +#line 655 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -673,14 +699,14 @@ yy42: yych = *YYCURSOR; goto yy47; yy43: -#line 339 "ext/standard/url_scanner_ex.re" +#line 365 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } -#line 679 "ext/standard/url_scanner_ex.c" +#line 705 "ext/standard/url_scanner_ex.c" yy44: ++YYCURSOR; -#line 340 "ext/standard/url_scanner_ex.re" +#line 366 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } -#line 684 "ext/standard/url_scanner_ex.c" +#line 710 "ext/standard/url_scanner_ex.c" yy46: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -691,13 +717,13 @@ yy47: } goto yy43; } -#line 341 "ext/standard/url_scanner_ex.re" +#line 367 "ext/standard/url_scanner_ex.re" state_before_val: start = YYCURSOR; -#line 701 "ext/standard/url_scanner_ex.c" +#line 727 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -744,17 +770,17 @@ yy50: if (yych == ' ') goto yy57; if (yych == '=') goto yy55; yy51: -#line 347 "ext/standard/url_scanner_ex.re" +#line 373 "ext/standard/url_scanner_ex.re" { --YYCURSOR; goto state_next_arg_begin; } -#line 750 "ext/standard/url_scanner_ex.c" +#line 776 "ext/standard/url_scanner_ex.c" yy52: ++YYCURSOR; yych = *YYCURSOR; goto yy56; yy53: -#line 346 "ext/standard/url_scanner_ex.re" +#line 372 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } -#line 758 "ext/standard/url_scanner_ex.c" +#line 784 "ext/standard/url_scanner_ex.c" yy54: yych = *++YYCURSOR; goto yy51; @@ -776,14 +802,14 @@ yy57: YYCURSOR = YYMARKER; goto yy51; } -#line 348 "ext/standard/url_scanner_ex.re" +#line 374 "ext/standard/url_scanner_ex.re" state_val: start = YYCURSOR; -#line 787 "ext/standard/url_scanner_ex.c" +#line 813 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -844,9 +870,9 @@ state_val: yych = *(YYMARKER = ++YYCURSOR); if (yych != '>') goto yy76; yy63: -#line 357 "ext/standard/url_scanner_ex.re" +#line 383 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_next_arg_begin; } -#line 850 "ext/standard/url_scanner_ex.c" +#line 876 "ext/standard/url_scanner_ex.c" yy64: yych = *(YYMARKER = ++YYCURSOR); if (yych == '>') goto yy63; @@ -856,9 +882,9 @@ yy65: yych = *YYCURSOR; goto yy69; yy66: -#line 356 "ext/standard/url_scanner_ex.re" +#line 382 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } -#line 862 "ext/standard/url_scanner_ex.c" +#line 888 "ext/standard/url_scanner_ex.c" yy67: yych = *++YYCURSOR; goto yy63; @@ -879,15 +905,15 @@ yy71: if (yybm[0+yych] & 64) { goto yy70; } - if (yych <= '=') goto yy73; + if (yych <= '\'') goto yy73; yy72: YYCURSOR = YYMARKER; goto yy63; yy73: ++YYCURSOR; -#line 355 "ext/standard/url_scanner_ex.re" +#line 381 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } -#line 891 "ext/standard/url_scanner_ex.c" +#line 917 "ext/standard/url_scanner_ex.c" yy75: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -896,13 +922,13 @@ yy76: if (yybm[0+yych] & 128) { goto yy75; } - if (yych >= '>') goto yy72; + if (yych >= '#') goto yy72; ++YYCURSOR; -#line 354 "ext/standard/url_scanner_ex.re" +#line 380 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } -#line 904 "ext/standard/url_scanner_ex.c" +#line 930 "ext/standard/url_scanner_ex.c" } -#line 358 "ext/standard/url_scanner_ex.re" +#line 384 "ext/standard/url_scanner_ex.re" stop: diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 9eb0952750..945f547d56 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -118,6 +118,32 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st const char *bash = NULL; const char *sep = "?"; + /* + * Don't modify "//example.com" full path, unless + * HTTP_HOST matches. + */ + if (ZSTR_VAL(url->s)[0] == '/' && ZSTR_VAL(url->s)[1] == '/') { + zval *tmp = NULL, *http_host = NULL; + size_t target_len, host_len; + if ((!(tmp = zend_hash_str_find(&EG(symbol_table), ZEND_STRL("_SERVER")))) + || Z_TYPE_P(tmp) != IS_ARRAY + || !(http_host = zend_hash_str_find(HASH_OF(tmp), ZEND_STRL("HTTP_HOST"))) + || Z_TYPE_P(http_host) != IS_STRING) { + smart_str_append_smart_str(dest, url); + return; + } + /* HTTP_HOST could be "example.com:8888", etc. */ + /* Need to find end of URL in buffer */ + host_len = strcspn(Z_STRVAL_P(http_host), ":"); + target_len = strcspn(ZSTR_VAL(url->s)+2, "/\"'?>\r\n"); + if (host_len + && host_len == target_len + && strncasecmp(Z_STRVAL_P(http_host), ZSTR_VAL(url->s)+2, host_len)) { + smart_str_append_smart_str(dest, url); + return; + } + } + q = (p = ZSTR_VAL(url->s)) + ZSTR_LEN(url->s); scan: diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index b9c1f342ca..de487b66e4 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -2149,12 +2149,8 @@ static int php_cli_server_mime_type_ctor(php_cli_server *server, const php_cli_s zend_hash_init(&server->extension_mime_types, 0, NULL, NULL, 1); for (pair = mime_type_map; pair->ext; pair++) { - size_t ext_len = 0, mime_type_len = 0; - - ext_len = strlen(pair->ext); - mime_type_len = strlen(pair->mime_type); - - zend_hash_str_add_mem(&server->extension_mime_types, pair->ext, ext_len, (void*)pair->mime_type, mime_type_len + 1); + size_t ext_len = strlen(pair->ext); + zend_hash_str_add_ptr(&server->extension_mime_types, pair->ext, ext_len, (void*)pair->mime_type); } return SUCCESS; @@ -1,6 +1,6 @@ #! /bin/sh -if test -d '.git'; then +if test -d '.git' -o -f '.git'; then ${MAKE:-make} -f build/build.mk gitclean-work else echo "Can't figure out your VCS, not cleaning." diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt index 5ab1ec5a69..395003d370 100644 --- a/win32/build/libs_version.txt +++ b/win32/build/libs_version.txt @@ -3,7 +3,7 @@ cclient-2007f freetype-2.6.2 icu-57.1 jpeglib-9b -libcurl-7.49.1 +libcurl-7.50.1 libiconv-1.14 libmcrypt-2.5.8 libmpir-2.7.2 |