View Single Post
  #1  
Old 03-10-2012, 11:12 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
New NPCServer Bug: return in switch statements

This started happening after Era was restarted earlier today.

PHP Code:
function onCreated() {
  
temp.key "abc";
  
  switch (
temp.key) {
    case 
"foo":
      echo(
"key=foo");
      return; 
// this line is problematic
    
break;
    
    case 
"abc":
      echo(
"key=abc");
    break;
  }

If you run the following code, nothing will echo. If you comment out the return statement, then it will echo "key=abc" as expected.

It appears that a return statement in a switch causes everything below it to be ignored, even if that case shouldn't have been executed. This is new functionality which is breaking a few things on Era. It did not happen before the server restart today.

This bug also appears to exist clientside on both v5 and v6.
__________________
Reply With Quote