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:
Nikita Popov 2019-10-25 11:25:49 +02:00
commit 711e2a1216
9 changed files with 34 additions and 17 deletions

View File

@ -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:

View File

@ -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;
}
}

View 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===

View File

@ -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 -

View File

@ -1,2 +0,0 @@
#!/bin/bash
mysql -e "CREATE DATABASE IF NOT EXISTS test"

View File

@ -1,2 +0,0 @@
#!/bin/bash
mysql -e "CREATE DATABASE IF NOT EXISTS test"

View File

@ -1,2 +0,0 @@
#!/bin/bash
export PDO_PGSQL_TEST_DSN='pgsql:host=localhost port=5432 dbname=test user=postgres password='