xref: /PHP-7.1/ext/opcache/tests/bug76281.phpt (revision 6738d19f)
1--TEST--
2Bug #76281: Opcache causes incorrect "undefined variable" errors
3--FILE--
4<?php
5
6function test($r, $action) {
7    $user_sub_resource = in_array($action, array('get_securityquestions', 'get_status', 'get_groupstats'));
8
9    $user_id = null;
10    if ($user_sub_resource && isset($r['user_id'])) {
11        $user_id = $r['user_id'];
12    }
13    else if (isset($r['id']))  {
14        $user_id = $r['id'];
15    }
16
17    if ($user_sub_resource) {
18        return 'foo';
19    }
20
21    return 'bar';
22}
23
24var_dump(test(['user_id' => 1, 'id' => 2], 'foo'));
25
26?>
27--EXPECT--
28string(3) "bar"
29