Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
f7e39a9
Bump php-sdk-binary-tools tag (#19948)
shivammathur Sep 24, 2025
b4b0155
opcache: Fix segfault in function JIT due to NAN to bool warning (#19…
Girgias Sep 24, 2025
84ec65c
Update NEWS
Girgias Sep 24, 2025
c98cca6
Merge branch 'PHP-8.5'
Girgias Sep 24, 2025
4870baa
calendar: Use `true` / `false` instead of `1` / `0` when assigning to…
TimWolla Sep 23, 2025
510fffc
com_dotnet: Use `true` / `false` instead of `1` / `0` when assigning …
TimWolla Sep 23, 2025
88d153f
date: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
82d546a
dba: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
f57e308
dom: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
ba3145d
ffi: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
9a36e51
ftp: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
ce566f2
gmp: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
24d9148
hash: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
0409856
iconv: Use `true` / `false` instead of `1` / `0` when assigning to `b…
TimWolla Sep 23, 2025
82322d1
intl: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
2ce4806
json: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
59cfc83
ldap: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
af7340a
mbstring: Use `true` / `false` instead of `1` / `0` when assigning to…
TimWolla Sep 23, 2025
9fa2e96
mysqli: Use `true` / `false` instead of `1` / `0` when assigning to `…
TimWolla Sep 23, 2025
b12eae4
mysqlnd: Use `true` / `false` instead of `1` / `0` when assigning to …
TimWolla Sep 23, 2025
10f78cf
odbc: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
066b63e
opcache: Use `true` / `false` instead of `1` / `0` when assigning to …
TimWolla Sep 23, 2025
2ab0492
openssl: Use `true` / `false` instead of `1` / `0` when assigning to …
TimWolla Sep 23, 2025
a1e1fa3
pcre: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
16dc497
pdo: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
0c985e1
pdo_dblib: Use `true` / `false` instead of `1` / `0` when assigning t…
TimWolla Sep 23, 2025
3da898a
pdo_firebird: Use `true` / `false` instead of `1` / `0` when assignin…
TimWolla Sep 23, 2025
aa08831
pdo_mysql: Use `true` / `false` instead of `1` / `0` when assigning t…
TimWolla Sep 23, 2025
b965ea3
pdo_pgsql: Use `true` / `false` instead of `1` / `0` when assigning t…
TimWolla Sep 23, 2025
11d1060
phar: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
cdb8321
reflection: Use `true` / `false` instead of `1` / `0` when assigning …
TimWolla Sep 23, 2025
c84dbef
session: Use `true` / `false` instead of `1` / `0` when assigning to …
TimWolla Sep 23, 2025
0583c66
simplexml: Use `true` / `false` instead of `1` / `0` when assigning t…
TimWolla Sep 23, 2025
59f2228
soap: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
15baf35
spl: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
56c98cb
sqlite3: Use `true` / `false` instead of `1` / `0` when assigning to …
TimWolla Sep 23, 2025
220d7a8
standard: Use `true` / `false` instead of `1` / `0` when assigning to…
TimWolla Sep 23, 2025
c2edd36
sysvmsg: Use `true` / `false` instead of `1` / `0` when assigning to …
TimWolla Sep 23, 2025
e58d6e0
sysvsem: Use `true` / `false` instead of `1` / `0` when assigning to …
TimWolla Sep 23, 2025
05fcdf2
sysvshm: Use `true` / `false` instead of `1` / `0` when assigning to …
TimWolla Sep 23, 2025
e455fc9
xml: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
87ab46e
xmlwriter: Use `true` / `false` instead of `1` / `0` when assigning t…
TimWolla Sep 23, 2025
eddb0f5
zip: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
4934355
zlib: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
d8db341
Optimizer: Use `true` / `false` instead of `1` / `0` when assigning t…
TimWolla Sep 23, 2025
c32fbca
Zend: Use `true` / `false` instead of `1` / `0` when assigning to `bool`
TimWolla Sep 23, 2025
117060c
date: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
63cb318
exif: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
2727de7
filter: Use `return true` / `return false` for functions returning `b…
TimWolla Sep 23, 2025
aa90372
ftp: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
017ae20
intl: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
b7c4331
mysqlnd: Use `return true` / `return false` for functions returning `…
TimWolla Sep 23, 2025
65bd151
opcache: Use `return true` / `return false` for functions returning `…
TimWolla Sep 23, 2025
dbdc68b
openssl: Use `return true` / `return false` for functions returning `…
TimWolla Sep 23, 2025
09add9a
pcre: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
2ebfdac
pdo: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
6c4c659
phar: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
d17b636
session: Use `return true` / `return false` for functions returning `…
TimWolla Sep 23, 2025
45bbe8c
soap: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
70117e5
sockets: Use `return true` / `return false` for functions returning `…
TimWolla Sep 23, 2025
5dfa859
sodium: Use `return true` / `return false` for functions returning `b…
TimWolla Sep 23, 2025
60f8969
spl: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
c743b71
standard: Use `return true` / `return false` for functions returning …
TimWolla Sep 23, 2025
9d18749
tokenizer: Use `return true` / `return false` for functions returning…
TimWolla Sep 23, 2025
8bbd59f
zlib: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
0b4ba56
Optimizer: Use `return true` / `return false` for functions returning…
TimWolla Sep 23, 2025
ef1b5ae
Zend: Use `return true` / `return false` for functions returning `bool`
TimWolla Sep 23, 2025
fb91931
com_dotnet: Use `true` / `false` instead of `1` / `0` for `bool` para…
TimWolla Sep 23, 2025
34c71f8
date: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
3e36598
dba: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
3e30ded
ffi: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
0768a16
hash: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
753f287
mbstring: Use `true` / `false` instead of `1` / `0` for `bool` parame…
TimWolla Sep 23, 2025
3ef2505
opcache: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
c5b344d
openssl: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
a5afa4a
pdo: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
d793de1
pgsql: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
26f88c6
phar: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
8e66b4e
reflection: Use `true` / `false` instead of `1` / `0` for `bool` para…
TimWolla Sep 23, 2025
9659d7f
session: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
7f1cc0e
spl: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
827c24b
standard: Use `true` / `false` instead of `1` / `0` for `bool` parame…
TimWolla Sep 23, 2025
fb2f7fe
Optimizer: Use `true` / `false` instead of `1` / `0` for `bool` param…
TimWolla Sep 23, 2025
c9b1759
Zend: Use `true` / `false` instead of `1` / `0` for `bool` parameters
TimWolla Sep 23, 2025
c32db7e
openssl: Use `true` / `false` instead of `1` / `0` for `bool` paramet…
TimWolla Sep 23, 2025
ed4537d
standard: Use `true` / `false` instead of `1` / `0` for `bool` parame…
TimWolla Sep 23, 2025
525cc9a
Optimizer: Use `true` / `false` instead of `1` / `0` for `bool` param…
TimWolla Sep 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ jobs:
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
PHP_BUILD_OBJ_DIR: C:\obj
PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.3.0
PHP_BUILD_SDK_BRANCH: php-sdk-2.5.0
PHP_BUILD_CRT: ${{ inputs.vs_crt_version }}
PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }}
THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
PHP_BUILD_OBJ_DIR: C:\obj
PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.3.0
PHP_BUILD_SDK_BRANCH: php-sdk-2.5.0
PHP_BUILD_CRT: vs17
PLATFORM: x64
THREAD_SAFE: "1"
Expand Down
16 changes: 8 additions & 8 deletions Zend/Optimizer/block_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ bool zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int
if (copy) {
Z_TRY_ADDREF_P(result);
}
return 1;
return true;
} else {
return 0;
return false;
}
}

/* Special constants null/true/false can always be substituted. */
c = zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name));
if (c) {
ZVAL_COPY_VALUE(result, &c->value);
return 1;
return true;
}
return 0;
return false;
}

/* Data dependencies macros */
Expand Down Expand Up @@ -949,14 +949,14 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
src = VAR_SOURCE(opline->op1);
if (src && src->opcode == ZEND_QM_ASSIGN) {
zend_op *op = src + 1;
bool optimize = 1;
bool optimize = true;

while (op < opline) {
if ((op->op1_type == opline->op1_type
&& op->op1.var == opline->op1.var)
|| (op->op2_type == opline->op1_type
&& op->op2.var == opline->op1.var)) {
optimize = 0;
optimize = false;
break;
}
op++;
Expand Down Expand Up @@ -1566,14 +1566,14 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
}

if (ctx->debug_level & ZEND_DUMP_BLOCK_PASS_VARS) {
bool printed = 0;
bool printed = false;
uint32_t i;

for (i = op_array->last_var; i< op_array->T; i++) {
if (zend_bitset_in(used_ext, i)) {
if (!printed) {
fprintf(stderr, "NON-LOCAL-VARS: %d", i);
printed = 1;
printed = true;
} else {
fprintf(stderr, ", %d", i);
}
Expand Down
82 changes: 41 additions & 41 deletions Zend/Optimizer/dce.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ typedef struct {
static inline bool is_bad_mod(const zend_ssa *ssa, int use, int def) {
if (def < 0) {
/* This modification is not tracked by SSA, assume the worst */
return 1;
return true;
}
if (ssa->var_info[use].type & MAY_BE_REF) {
/* Modification of reference may have side-effect */
return 1;
return true;
}
return 0;
return false;
}

static inline bool may_have_side_effects(
Expand Down Expand Up @@ -125,18 +125,18 @@ static inline bool may_have_side_effects(
case ZEND_FUNC_GET_ARGS:
case ZEND_ARRAY_KEY_EXISTS:
/* No side effects */
return 0;
return false;
case ZEND_FREE:
return opline->extended_value == ZEND_FREE_VOID_CAST;
case ZEND_ADD_ARRAY_ELEMENT:
/* TODO: We can't free two vars. Keep instruction alive. <?php [0, "$a" => "$b"]; */
if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) && (opline->op2_type & (IS_VAR|IS_TMP_VAR))) {
return 1;
return true;
}
return 0;
return false;
case ZEND_ROPE_END:
/* TODO: Rope dce optimization, see #76446 */
return 1;
return true;
case ZEND_JMP:
case ZEND_JMPZ:
case ZEND_JMPNZ:
Expand All @@ -149,7 +149,7 @@ static inline bool may_have_side_effects(
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
/* For our purposes a jumps and branches are side effects. */
return 1;
return true;
case ZEND_BEGIN_SILENCE:
case ZEND_END_SILENCE:
case ZEND_ECHO:
Expand All @@ -164,7 +164,7 @@ static inline bool may_have_side_effects(
case ZEND_YIELD_FROM:
case ZEND_VERIFY_NEVER_TYPE:
/* Intrinsic side effects */
return 1;
return true;
case ZEND_DO_FCALL:
case ZEND_DO_FCALL_BY_NAME:
case ZEND_DO_ICALL:
Expand All @@ -174,31 +174,31 @@ static inline bool may_have_side_effects(
case ZEND_FRAMELESS_ICALL_2:
case ZEND_FRAMELESS_ICALL_3:
/* For now assume all calls have side effects */
return 1;
return true;
case ZEND_RECV:
case ZEND_RECV_INIT:
/* Even though RECV_INIT can be side-effect free, these cannot be simply dropped
* due to the prologue skipping code. */
return 1;
return true;
case ZEND_ASSIGN_REF:
return 1;
return true;
case ZEND_ASSIGN:
{
if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def)) {
return 1;
return true;
}
if (!reorder_dtor_effects) {
if (opline->op2_type != IS_CONST
&& (OP2_INFO() & MAY_HAVE_DTOR)
&& ssa->vars[ssa_op->op2_use].escape_state != ESCAPE_STATE_NO_ESCAPE) {
/* DCE might shorten lifetime */
return 1;
return true;
}
}
return 0;
return false;
}
case ZEND_UNSET_VAR:
return 1;
return true;
case ZEND_UNSET_CV:
{
uint32_t t1 = OP1_INFO();
Expand All @@ -207,9 +207,9 @@ static inline bool may_have_side_effects(
* an unset may be considered dead even if there is a later assignment to the
* variable. Removing the unset in this case would not be correct if the variable
* is a reference, because unset breaks references. */
return 1;
return true;
}
return 0;
return false;
}
case ZEND_PRE_INC:
case ZEND_POST_INC:
Expand All @@ -223,41 +223,41 @@ static inline bool may_have_side_effects(
case ZEND_ASSIGN_OBJ:
if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def)
|| ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE) {
return 1;
return true;
}
if (!reorder_dtor_effects) {
opline++;
ssa_op++;
if (opline->op1_type != IS_CONST
&& (OP1_INFO() & MAY_HAVE_DTOR)) {
/* DCE might shorten lifetime */
return 1;
return true;
}
}
return 0;
return false;
case ZEND_PRE_INC_OBJ:
case ZEND_PRE_DEC_OBJ:
case ZEND_POST_INC_OBJ:
case ZEND_POST_DEC_OBJ:
if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def)
|| ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE) {
return 1;
return true;
}
return 0;
return false;
case ZEND_BIND_STATIC:
if (op_array->static_variables) {
/* Implicit and Explicit bind static is effectively prologue of closure so
report it has side effects like RECV, RECV_INIT; This allows us to
reflect on the closure and discover used variable at runtime */
if ((opline->extended_value & (ZEND_BIND_IMPLICIT|ZEND_BIND_EXPLICIT))) {
return 1;
return true;
}
/* Modifies static variables which are observable through reflection */
if ((opline->extended_value & ZEND_BIND_REF) && opline->op2_type != IS_UNUSED) {
return 1;
return true;
}
}
return 0;
return false;
case ZEND_CHECK_VAR:
return (OP1_INFO() & MAY_BE_UNDEF) != 0;
case ZEND_FE_RESET_R:
Expand All @@ -267,7 +267,7 @@ static inline bool may_have_side_effects(
return (OP1_INFO() & MAY_BE_ANY) != MAY_BE_ARRAY;
default:
/* For everything we didn't handle, assume a side-effect */
return 1;
return true;
}
}

Expand Down Expand Up @@ -340,7 +340,7 @@ static inline bool is_var_dead(context *ctx, int var_num) {
// Sometimes we can mark the var as EXT_UNUSED
static bool try_remove_var_def(context *ctx, int free_var, int use_chain, zend_op *opline) {
if (use_chain >= 0) {
return 0;
return false;
}
zend_ssa_var *var = &ctx->ssa->vars[free_var];
int def = var->definition;
Expand Down Expand Up @@ -381,13 +381,13 @@ static bool try_remove_var_def(context *ctx, int free_var, int use_chain, zend_o
def_opline->result.var = 0;
def_op->result_def = -1;
var->definition = -1;
return 1;
return true;
default:
break;
}
}
}
return 0;
return false;
}

static zend_always_inline bool may_be_refcounted(uint32_t type) {
Expand All @@ -400,13 +400,13 @@ static inline bool is_free_of_live_var(context *ctx, zend_op *opline, zend_ssa_o
/* It is always safe to remove FREEs of non-refcounted values, even if they are live. */
if ((ctx->ssa->var_info[ssa_op->op1_use].type & (MAY_BE_REF|MAY_BE_ANY|MAY_BE_UNDEF)) != 0
&& !may_be_refcounted(ctx->ssa->var_info[ssa_op->op1_use].type)) {
return 0;
return false;
}
ZEND_FALLTHROUGH;
case ZEND_FE_FREE:
return !is_var_dead(ctx, ssa_op->op1_use);
default:
return 0;
return false;
}
}

Expand All @@ -417,12 +417,12 @@ static bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) {
uint8_t free_var_type;

if (opline->opcode == ZEND_NOP) {
return 0;
return false;
}

/* We mark FREEs as dead, but they're only really dead if the destroyed var is dead */
if (is_free_of_live_var(ctx, opline, ssa_op)) {
return 0;
return false;
}

if ((opline->op1_type & (IS_VAR|IS_TMP_VAR))&& !is_var_dead(ctx, ssa_op->op1_use)) {
Expand All @@ -440,7 +440,7 @@ static bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) {
if (free_var >= 0) {
// TODO: We can't free two vars. Keep instruction alive.
zend_bitset_excl(ctx->instr_dead, opline - ctx->op_array->opcodes);
return 0;
return false;
}
free_var = ssa_op->op2_use;
free_var_type = opline->op2_type;
Expand All @@ -459,9 +459,9 @@ static bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) {
ssa_op->op1_use = free_var;
ssa_op->op1_use_chain = ssa->vars[free_var].use_chain;
ssa->vars[free_var].use_chain = ssa_op - ssa->ops;
return 0;
return false;
}
return 1;
return true;
}

static inline int get_common_phi_source(zend_ssa *ssa, zend_ssa_phi *phi) {
Expand Down Expand Up @@ -507,17 +507,17 @@ static void try_remove_trivial_phi(context *ctx, zend_ssa_phi *phi) {
static inline bool may_break_varargs(const zend_op_array *op_array, const zend_ssa *ssa, const zend_ssa_op *ssa_op) {
if (ssa_op->op1_def >= 0
&& ssa->vars[ssa_op->op1_def].var < op_array->num_args) {
return 1;
return true;
}
if (ssa_op->op2_def >= 0
&& ssa->vars[ssa_op->op2_def].var < op_array->num_args) {
return 1;
return true;
}
if (ssa_op->result_def >= 0
&& ssa->vars[ssa_op->result_def].var < op_array->num_args) {
return 1;
return true;
}
return 0;
return false;
}

static inline bool may_throw_dce_exception(const zend_op *opline) {
Expand Down
Loading