bug76281.phpt 598 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #76281: Opcache causes incorrect "undefined variable" errors
  3. --EXTENSIONS--
  4. opcache
  5. --FILE--
  6. <?php
  7. function test($r, $action) {
  8. $user_sub_resource = in_array($action, array('get_securityquestions', 'get_status', 'get_groupstats'));
  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. if ($user_sub_resource) {
  17. return 'foo';
  18. }
  19. return 'bar';
  20. }
  21. var_dump(test(['user_id' => 1, 'id' => 2], 'foo'));
  22. ?>
  23. --EXPECT--
  24. string(3) "bar"