Fix a fatal error in some PHP versions.
Merge pull request #2184 from jakzal/bugfix/orm-indexer-fatal-error

Fix a fatal error in some PHP versions.