This project is read-only.

TableEntityQuery condition not applied correctly in Microsoft_WindowsAzure_Storage_Table->retrieveEntities if the server returns a continuation token after the first request


When Microsoft_WindowsAzure_Storage_Table->retrieveEntities is called with:
*  the $tableName parameter set to an instance of Microsoft_WindowsAzure_Storage_TableEntityQuery rather than a string, and 
*  the query returning more than 1000 records (and hence using continuation tokens),
then the method returns all records in the table after the first continuation token, ignoring the query condition.
This appears to be because the method changes $tableName from a TableEntityQuery to the table name string in the FROM clause of the query. When the continuation token is received and so retrieveEntities is called recursively, this recursive call has $tableName set to the table name string rather than the TableEntityQuery object. The effect is the WHERE condition is forgotten and the query continues to select all subsequent rows from the table.
I worked around this by simply adding:
$inputTableName = $tableName;
at the start of the method and then, where a continuation key is received, using $inputTableName rather than $tableName in the recursive call to retrieveEntities.