On Tue, 15 Jan 2013, Jeremy Mikola wrote:

> > @@ -1194,6 +1195,20 @@ void mongo_init_MongoGridFS(TSRMLS_D) {
> >    gridfs = zend_read_property(mongo_ce_GridFSFile, getThis(), "gridfs", strlen("gridfs"), NOISY TSRMLS_CC);
> >    file = zend_read_property(mongo_ce_GridFSFile, getThis(), "file", strlen("file"), NOISY TSRMLS_CC);
> >  
> > +	if (zend_hash_find(HASH_P(file), "length", strlen("length")+1, (void**)&size) == FAILURE) {
> > +		zend_throw_exception(mongo_ce_GridFSException, "couldn't find file size", 0 TSRMLS_CC);
> > +		return;
> > +	}
> > +
> > +	if (Z_TYPE_PP(size) == IS_DOUBLE) {
> > +		len = (int)Z_DVAL_PP(size);
> > +	} else if (Z_TYPE_PP(size) == IS_LONG) {
> > +		len = Z_LVAL_PP(size);
> > +	} else if (Z_TYPE_PP(size) == IS_OBJECT && (Z_OBJCE_PP(size) == mongo_ce_Int32 || Z_OBJCE_PP(size) == mongo_ce_Int64)) {
> > +		zval *sizet = zend_read_property(mongo_ce_Int64, *size, "value", strlen("value"), NOISY TSRMLS_CC);
> 
> Don't C variables need to be declared at the top of the function scope?

Yes, but { .. } is its own scope. So the sizet is defined at the top of 
the scope that started the line above.

cheers,
Derick