diff --git a/Zend/tests/bug43201.phpt b/Zend/tests/bug43201.phpt index 89e1b667276..53bb5ba98d8 100644 --- a/Zend/tests/bug43201.phpt +++ b/Zend/tests/bug43201.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #43201 (Crash on using unitialized vals and __get/__set) +Bug #43201 (Crash on using uninitialized vals and __get/__set) --FILE-- refcount__gc++; @@ -169,10 +166,10 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC) if (!newRoot) { return; } - GC_ZVAL_SET_PURPLE(zv); GC_G(unused) = newRoot->prev; } + GC_ZVAL_SET_PURPLE(zv); newRoot->next = GC_G(roots).next; newRoot->prev = &GC_G(roots); GC_G(roots).next->prev = newRoot; @@ -203,7 +200,6 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC) obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zv)].bucket.obj; if (GC_GET_COLOR(obj->buffered) != GC_PURPLE) { - GC_SET_PURPLE(obj->buffered); if (!GC_ADDRESS(obj->buffered)) { gc_root_buffer *newRoot = GC_G(unused); @@ -214,7 +210,6 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC) GC_G(first_unused)++; } else { if (!GC_G(gc_enabled)) { - GC_ZVAL_SET_BLACK(zv); return; } zv->refcount__gc++; @@ -225,10 +220,10 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC) return; } obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zv)].bucket.obj; - GC_SET_PURPLE(obj->buffered); GC_G(unused) = newRoot->prev; } + GC_SET_PURPLE(obj->buffered); newRoot->next = GC_G(roots).next; newRoot->prev = &GC_G(roots); GC_G(roots).next->prev = newRoot; diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 572d16cb585..53c8c76f4f1 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1420,6 +1420,7 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string) if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION"); } else if (retval_ptr) { + _php_curl_verify_handlers(ch, 1 TSRMLS_CC); if (Z_TYPE_P(retval_ptr) != IS_LONG) { convert_to_long_ex(&retval_ptr); } @@ -2855,6 +2856,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC) curl_easy_setopt(ch->cp, CURLOPT_SHARE, sh->share); } } + break; #if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */ case CURLOPT_FNMATCH_FUNCTION: diff --git a/ext/curl/tests/bug69316.phpt b/ext/curl/tests/bug69316.phpt index 2a88eb2bc94..47c98fb6572 100644 --- a/ext/curl/tests/bug69316.phpt +++ b/ext/curl/tests/bug69316.phpt @@ -1,10 +1,7 @@ --TEST-- Bug #69316: Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEADER --SKIPIF-- - + --FILE-- --FILE-- diff --git a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt index 8259d2f505b..06b936aeed2 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt @@ -199,7 +199,6 @@ mysqli_close($link); if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { printf("[008] %s [%d] %s\n", $column_def, mysqli_errno($link), mysqli_error($link)); - continue; } $column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)'); @@ -220,7 +219,6 @@ mysqli_close($link); while ($field = mysqli_fetch_field($res)) { if (!isset($expected_flags[$field->name])) { printf("[010] Found unexpected field '%s'\n", $field->name); - continue; } list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags[$field->name], $flags); if ($unexpected_flags) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index d75d3012606..0606eba2a4d 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -960,9 +960,9 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC) charextraalloc = 0; colfieldid = SQL_COLUMN_DISPLAY_SIZE; - rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME, + rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_DESC_BASE_COLUMN_NAME, result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); - rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, + rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, NULL, 0, NULL, &result->values[i].coltype); /* Don't bind LONG / BINARY columns, so that fetch behaviour can @@ -997,7 +997,7 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC) charextraalloc = 1; #endif default: - rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), colfieldid, + rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid, NULL, 0, NULL, &displaysize); /* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */ if (result->values[i].coltype == SQL_TIMESTAMP) { @@ -1091,7 +1091,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) RETURN_FALSE; } - SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len); + PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len); RETURN_LONG(len); } @@ -2135,7 +2135,7 @@ PHP_FUNCTION(odbc_result) fieldsize = result->longreadlen; } } else { - SQLColAttributes(result->stmt, (SQLUSMALLINT)(field_ind + 1), + PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), (SQLUSMALLINT)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH : SQL_COLUMN_DISPLAY_SIZE), NULL, 0, NULL, &fieldsize); @@ -2871,7 +2871,7 @@ PHP_FUNCTION(odbc_field_type) RETURN_FALSE; } - SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL); + PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL); RETURN_STRING(tmp,1) } /* }}} */ diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h index 15bb737a8be..5f0c205977d 100644 --- a/ext/odbc/php_odbc_includes.h +++ b/ext/odbc/php_odbc_includes.h @@ -281,8 +281,16 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS); #if defined(ODBCVER) && (ODBCVER >= 0x0300) #define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WLONGVARCHAR) + +#define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttribute + +#define PHP_ODBC_DESC_BASE_COLUMN_NAME SQL_DESC_BASE_COLUMN_NAME #else #define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR) + +#define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttributes + +#define PHP_ODBC_DESC_BASE_COLUMN_NAME SQL_COLUMN_NAME #endif #define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY) diff --git a/ext/odbc/tests/bug60616.phpt b/ext/odbc/tests/bug60616.phpt index 937049a9b8b..b816f9cd847 100644 --- a/ext/odbc/tests/bug60616.phpt +++ b/ext/odbc/tests/bug60616.phpt @@ -2,6 +2,11 @@ odbc_exec(): Getting accurate unicode data from query --SKIPIF-- + --FILE-- +--FILE-- + +==DONE== +--EXPECT-- +100 +a +a +==DONE== +--CLEAN-- + diff --git a/ext/odbc/tests/odbc_exec_001.phpt b/ext/odbc/tests/odbc_exec_001.phpt index c525a962b1b..038e978cf9f 100644 --- a/ext/odbc/tests/odbc_exec_001.phpt +++ b/ext/odbc/tests/odbc_exec_001.phpt @@ -2,6 +2,11 @@ odbc_exec(): Basic test --SKIPIF-- + --FILE-- +--FILE-- + +--EXPECT-- +bool(true) +bool(false) diff --git a/ext/opcache/tests/is_script_cached.phpt b/ext/opcache/tests/is_script_cached.phpt index 0560e98d887..bac561103f5 100644 --- a/ext/opcache/tests/is_script_cached.phpt +++ b/ext/opcache/tests/is_script_cached.phpt @@ -4,6 +4,7 @@ Test that script cached info is correct opcache.enable=1 opcache.enable_cli=1 opcache.file_update_protection=0 +opcache.validate_timestamps=1 --SKIPIF-- --FILE-- diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index e29ff00304b..3a6da3c8b66 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -320,14 +320,16 @@ static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC) persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len + 1); if (persistent_script) { return !persistent_script->corrupted && - validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS; + (!ZCG(accel_directives).validate_timestamps || + validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS); } } if ((key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC)) != NULL) { persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length + 1); return persistent_script && !persistent_script->corrupted && - validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS; + (!ZCG(accel_directives).validate_timestamps || + validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS); } return 0; diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index bbe26e81720..8880b8817ff 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -346,10 +346,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRML retval = ZCG(mem);; ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size)); memcpy(retval, source, size); + zend_shared_alloc_register_xlat_entry(source, retval); if (free_source) { interned_efree((char*)source); } - zend_shared_alloc_register_xlat_entry(source, retval); return retval; } diff --git a/ext/pcre/pcrelib/pcre_exec.c b/ext/pcre/pcrelib/pcre_exec.c index a3f0c1923f2..e4da5227a28 100644 --- a/ext/pcre/pcrelib/pcre_exec.c +++ b/ext/pcre/pcrelib/pcre_exec.c @@ -688,7 +688,7 @@ the alternative names that are used. */ #define foc number #define save_mark data -/* These statements are here to stop the compiler complaining about unitialized +/* These statements are here to stop the compiler complaining about uninitialized variables. */ #ifdef SUPPORT_UCP diff --git a/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt b/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt index 5990ab812e3..d59c9303284 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt @@ -85,10 +85,12 @@ MySQLPDOTest::skip(); } catch (PDOException $e) { - printf("[001] %s, [%s] %s\n", + printf("[001] %s, [%s] %s [%s] %s\n", $e->getMessage(), - (is_object($db)) ? $db->errorCode() : 'n/a', - (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); + (is_object($db1)) ? $db1->errorCode() : 'n/a', + (is_object($db1)) ? implode(' ', $db1->errorInfo()) : 'n/a', + (is_object($db2)) ? $db2->errorCode() : 'n/a', + (is_object($db2)) ? implode(' ', $db2->errorInfo()) : 'n/a'); } print "done!"; diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index 7a650e22890..1042008a307 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -113,7 +113,7 @@ static void xmlwriter_free_resource_ptr(xmlwriter_object *intern TSRMLS_DC) ze_xmlwriter_object *obj = (ze_xmlwriter_object*) zend_object_store_get_object(object TSRMLS_CC); \ intern = obj->xmlwriter_ptr; \ if (!intern) { \ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid or unitialized XMLWriter object"); \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid or uninitialized XMLWriter object"); \ RETURN_FALSE; \ } \ } diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 333050f9362..c268059b542 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -417,7 +417,7 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, ze_zip_object *obj = (ze_zip_object*) zend_object_store_get_object(object TSRMLS_CC); \ intern = obj->za; \ if (!intern) { \ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid or unitialized Zip object"); \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid or uninitialized Zip object"); \ RETURN_FALSE; \ } \ }