Assertion failure Zend/Optimizer/zend_inference.c:2086
Open
Bug
Category: Optimizer
Status: Verified
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The following code:
<?php
require "connect.inc";
$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$result = ldap_list($link, "$base", "(objectClass=person)");
$entry = ldap_first_entry($link, $result);
var_dump(
$entry = ldap_next_entry($link, $entry),
ldap_get_values($link, $entry, 'sn'),
$entry = ldap_next_entry($link, $entry)
);
$fusion = $base;
function renderRawGraph(array $parents) {
$fusion = array();
foreach ($parents as $p) {
foreach ($graph as $graph) {
$graph[$graph]['line'] = 1;
}
$graph[] = array(
'line' => 1,
);
}
}
Resulted in this output:
Warning: Narrowing occurred during type inference of ZEND_FETCH_DIM_W. Please file a bug report on https://github.com/php/php-src/issues in /tmp/test.php on line 17
php: /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/Optimizer/zend_inference.c:2086: void emit_type_narrowing_warning(const zend_op_array *, zend_ssa *, int): Assertion `0 && "Narrowing during type inference"' failed.
Aborted (core dumped)
To reproduce (only in JIT):
-d "zend_extension=/home/phpfuzz/WorkSpace/flowfusion/php-src/modules/opcace.so" -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.jit=1254"
PHP Version
nightly
Operating System
ubuntu 22.04
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Zend/Optimizer/zend_inference.c:2086 and reproduce the assertion using PHP nightly with opcache JIT enabled and the supplied PHP snippet. Done means the example no longer emits the type-inference warning or aborts in the assertion path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100