title: Undefined Property and PHP Fatal Error: Allowed memory exhausted when querying mssql from php through unixODBC/FreeTDS
body: <p>After upgrading php from version 5.2.10 to 5.3.3 I am getting a very strange set of errors when using odbc queries that works fine in 5.2.10. </p>
  
  <p>I get a lot of <em>Undefined Property: stdClass::$username</em> finally ending in a <em>Memory Exhaust Allowed</em> error when I run queries like the following:</p>
  
  <pre><code>    $conn = odbc_connect("dsn", "user", "pw") or die(odbc_error_msg()); 
  
      $query = "select usr_n as username from usr";
      $rs = odbc_exec($conn,$query);
  
      while ($rows = odbc_fetch_object($rs)) {
          echo "$rows-&gt;username";
          }
      odbc_free_result($rs);
      odbc_close($conn);
  </code></pre>
  
  <p>the strange part is that if I run this code without the 'username' alias and use the table name as shown in the query underneath, it works fine:</p>
  
  <pre><code>    $conn = odbc_connect("dsn", "user", "pw") or die(odbc_error_msg()); 
  
      $query = "select usr_n from usr";
      $rs = odbc_exec($conn,$query);
  
      while ($rows = odbc_fetch_object($rs)) {
          echo "$rows-&gt;usr_n";
          }
      odbc_free_result($rs);
      odbc_close($conn);
  </code></pre>
  
  <p>also if I use alias with a count(*) statement it works fine, but as soon as I replace a tablename with an alias it all goes wrong. </p>
  
  <p>I tried the query in iSQL with the alias, and it works like it is supposed to, so the unixODBC and FreeTDS is working.</p>
  
  <p>I have searched through all the material I could find both here and google, but havent got any answer to why this is happening.</p>
  
  <p>Appreciate it if anyone here has an idea to what is going on here, as it seems to me to have something to do with aliases and I use aliases a lot.</p>
  
  <p>BTW: Upgrading php is sadly not an option for me.</p>