I've been working on finding the cause of a problem my site is showing when the cron job builds the search index. I've found the problem, but don't know how to fix it.
Briefly put, when the cron.php script is executed the node_update_index() function is called for each node. This in turn calls node_build_content() to get the text that has to be indexed by the code in the search module. If the node contains PHP code this gets executed, and if that code contains a drupal_goto() call it's followed. That means the cron.php script exits and the search index rebuild stops.
It also appears that if the drupal_goto() appears in the teaser area of the node, this can be stored as the search result. If such a result gets hit by a search term, the act of rendering it as a search result causes the redirect to happen immediately.
It seems to me that when the node is being created for indexing purposes, the embedded redirect shouldn't happen. That seems a rather heavy handed approach, and difficult to implement. I'm happy to try to implement a fix for this problem myself, but I'm going to have to ask for assistance from the experts in what the fix might actually be!