CIRC_REFERENCE problem and solution

I trying to use little bit more complex formula in Spreadsheet, and I have a problem. I use result calculated in one cell as argument in function in other cell. Result is #CIRC_REFERENCE.

I solved this problem making changes in api.php file about 432 line:

$diff orig/codebase/php/api.php dhtmlSpreadsheet/codebase/php/api.php
432c432
< 		if (isset(SpreadSheet::$processed[$coord]))
---
> 		if (isset(SpreadSheet::$processed[$coord]) and (SpreadSheet::$processed[$coord] > 3))
447c447,452
< 		SpreadSheet::$processed[$coord] = true;
---
> 
> 		if (!isset(SpreadSheet::$processed[$coord]))
> 			SpreadSheet::$processed[$coord] = 1;
> 		else
> 			SpreadSheet::$processed[$coord] = SpreadSheet::$processed[$coord]+1;
> 

Instead of storing boolean flag in array SpreadSheet::$processed I use integer counter. Value 3 (hardcoded) is a maximum level of nesting. Increase this value increased load on the server then real circular reference happens.

Also I found, that if value in cells with validator is formula then validation does not work. I fix this problem inserting in dhtmlxspreadsheet.js call validation, then calculated value received from server. At line 1081:

if (cell.type == 'updated' && self._in_progress(cell.row, cell.col) === 0) {
	self.setValue(cell.row, cell.col, cell.text, cell.calc);
	self.validateCell(cell.row, cell.col);
}

I hope this solution may be useful. Sorry for my English.

Hi!
Really good job!
Thanks!