Mantis - Quercus
Viewing Issue Advanced Details
3152 minor always 12-11-08 21:29 12-13-08 00:05
koreth  
nam  
normal  
closed 4.0.0  
fixed  
none    
none 4.0.0  
0003152: Postincrement in method call fails to compile
This doesn't seem to happen in a trivial test case, but this method in one of our classes:

  protected function cb_IDENTIFIER($token) {
    $i = 0;
    while ($prev = $this->prev($i++)) {
      if (!isset($this->JUNK[$prev->type])) {
        break;
      }
    }
    if ($prev && ($prev->type == 'PERIOD')) {
      $token->type = 'PROPERTY';
    } else if (isset($this->KEYWORDS[$token->value])) {
      $token->type = 'KEYWORD';
    }
    return $token;
  }

fails to compile with the latest Resin Pro code.

[21:19:07.184] {resin-19} com.caucho.java.JavaCompileException: ...__php.java:1828: unexpected type
[21:19:07.184] {resin-19} required: variable
[21:19:07.184] {resin-19} found : value
[21:19:07.184] {resin-19} while (_v[si_prev_2].set(q_this.callMethod(env, 48366030, _qc_prev, 4, LongValue.create((_v[si_i_3].toLong()++))).copyReturn()).toBoolean()) {

Notes
(0003609)
koreth   
12-12-08 10:10   
Here's a trimmed-down test case for this. I think I quoted the wrong method up above; sorry about that.

This test case of course doesn't make sense in terms of functionality but it's the minimum set of lines I could come up with to demonstrate the compilation failure. Oddly, if you take away the "if" clause, the "while" starts compiling okay.

<?php
function blah() {
  $i = 0;
  while ($i++);
  if ($prev1) {
    $prev1->property_value = preg_replace('#x#', 'y', $foo);
  }
}
(0003616)
nam   
12-13-08 00:05   
php/3ab8