mirror of
https://github.com/php/php-src.git
synced 2025-01-26 21:54:16 +08:00
Merge branch 'PHP-7.4'
* PHP-7.4: Check class linking in VERIFY_RETURN_TYPE optimization Simplify travis setup scripts
This commit is contained in:
commit
711e2a1216
@ -51,6 +51,7 @@ env:
|
||||
- PDO_MYSQL_TEST_USER=travis
|
||||
- PDO_MYSQL_TEST_PASS=
|
||||
- PDO_MYSQL_TEST_HOST=127.0.0.1
|
||||
- PDO_PGSQL_TEST_DSN="pgsql:host=localhost port=5432 dbname=test user=postgres password="
|
||||
- REPORT_EXIT_STATUS=1
|
||||
matrix:
|
||||
- ENABLE_ZTS=0 ENABLE_DEBUG=0
|
||||
@ -65,11 +66,8 @@ before_script:
|
||||
# Compile PHP
|
||||
- travis_wait ./travis/compile.sh
|
||||
# Setup Extensions
|
||||
- . ./travis/ext/mysql/setup.sh
|
||||
- . ./travis/ext/mysqli/setup.sh
|
||||
- . ./travis/ext/pdo_mysql/setup.sh
|
||||
- . ./travis/ext/pgsql/setup.sh
|
||||
- . ./travis/ext/pdo_pgsql/setup.sh
|
||||
- ./travis/setup-mysql.sh
|
||||
- ./travis/setup-pgsql.sh
|
||||
|
||||
# Run PHPs run-tests.php
|
||||
script:
|
||||
|
@ -278,6 +278,17 @@ static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa, zend_op
|
||||
free_alloca(shiftlist, use_heap);
|
||||
}
|
||||
|
||||
static zend_bool safe_instanceof(zend_class_entry *ce1, zend_class_entry *ce2) {
|
||||
if (ce1 == ce2) {
|
||||
return 1;
|
||||
}
|
||||
if (!(ce1->ce_flags & ZEND_ACC_LINKED)) {
|
||||
/* This case could be generalized, similarly to unlinked_instanceof */
|
||||
return 0;
|
||||
}
|
||||
return instanceof_function(ce1, ce2);
|
||||
}
|
||||
|
||||
static inline zend_bool can_elide_return_type_check(
|
||||
zend_op_array *op_array, zend_ssa *ssa, zend_ssa_op *ssa_op) {
|
||||
zend_arg_info *info = &op_array->arg_info[-1];
|
||||
@ -302,7 +313,7 @@ static inline zend_bool can_elide_return_type_check(
|
||||
}
|
||||
|
||||
if (ZEND_TYPE_IS_CLASS(info->type)) {
|
||||
if (!use_info->ce || !def_info->ce || !instanceof_function(use_info->ce, def_info->ce)) {
|
||||
if (!use_info->ce || !def_info->ce || !safe_instanceof(use_info->ce, def_info->ce)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
19
ext/opcache/tests/verify_return_instanceof.phpt
Normal file
19
ext/opcache/tests/verify_return_instanceof.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Instanceof checks in VERIFY_RETURN_TYPE optimization may deal with unlinked classes
|
||||
--FILE--
|
||||
<?php
|
||||
interface foo { }
|
||||
|
||||
interface biz {}
|
||||
|
||||
class qux implements foo {
|
||||
public function bar(): biz {
|
||||
$x = $this;
|
||||
return $x;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
export PHP_CURL_HTTP_REMOTE_SERVER="http://localhost:8080"
|
||||
cd ./ext/curl/tests/responder
|
||||
php -S localhost:8080 &
|
||||
cd -
|
@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
mysql -e "CREATE DATABASE IF NOT EXISTS test"
|
@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
mysql -e "CREATE DATABASE IF NOT EXISTS test"
|
@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
export PDO_PGSQL_TEST_DSN='pgsql:host=localhost port=5432 dbname=test user=postgres password='
|
Loading…
Reference in New Issue
Block a user