I just encountered a strange issue while switching between two development branches of the same Drupal site. On branch A the site worked normally, but on branch B none of the forms contained any fields. After much hair pulling, I narrowed down the difference between the two branches to a drupal_rebuild_theme_registry(); call in my theme's template.php file on (the working) branch A, and realized what was going wrong.
Calling [code]drupal_rebuild_theme_registry();[/code] rebuilds Drupal's internal theme registry, and it's helpful to always do that during development, which is why this call was hardcoded in template.php. My broken branch B on the other hand, was actually the "production" branch, and did not have this call. When I added some form theming functions on branch A, those changes got written to the theme registry. After swapping to branch B, the database still contained the theme registry with the new changes from branch A, but since there was no longer a call to rebuild the theme registry and the new theming functions were nowhere to be found, the site effectively broke. Rebuilding the theme registry while on the branch B codebase solved the issue!