I've just tried to upgrade a site from 6.16 to the latest 7.x-dev and I'm just getting a white screen when visiting update.php.
I've followed the instructions in upgrade.txt, I'm logged in as the admin user, the site is in maintenance mode, I've disabled all contrib modules etc., and I've checked that this server meets all the requirements for 7.x. (I'm already running several installations of various versions of 7.x-dev just fine, but I've not tried upgrade before).

The browser redirects to http://localhost/drupal-6.16/update.php?op=info, but that's it... there's nothing in the apache error logs, and it doesn't appear that any changes have been made to the database.

I'm running XAMPP under windows, PHP 5.3.0 with 256Mb memory.

I'm sorry that this is a pretty poor error report - please let me know how I can gather more information that would help debugging this. PHP on this server is not compiled with debugging support so I can't easily step through the functions in install.php to find out where it's failing...

Comments

David_Rothstein’s picture

Component: install system » update system
Issue tags: +D7 upgrade path

Do you have PHP error logging turned on for this server, or the ability to turn it on? For example, you can put something like this near the top of the update.php script I think:

    ini_set('log_errors', 1);
    ini_set('error_log', '/path/to/some/file/that/the/webserver/can/write/to');

(You mentioned that there's nothing in the Apache error logs, but just wanted to make sure it's definitely configured to write errors somewhere, since a whitescreen is so often due to a PHP fatal error.)

Anyway, I'm guessing this could be an issue that only shows up in PHP 5.3, so will be useful to track down...

Thanks!

tanoshimi’s picture

Title: WSOD when trying to run update.php from D6 -> D7 » Undefined function _system_rebuild_theme_data when trying to run update.php from D6 -> D7

Thanks for the reply David. Turning on PHP logs reveals, as you correctly guessed, that there is a fatal PHP error occurring.
The offending line is an attempt to call _system_rebuild_theme_data(), as below:

[Fri Apr 09 06:57:59 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Apr 09 06:57:59 2010] [notice] Digest: done
[Fri Apr 09 06:58:00 2010] [notice] Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations
[Fri Apr 09 06:58:00 2010] [notice] Server built: Jul 22 2009 11:35:54
[Fri Apr 09 06:58:00 2010] [notice] Parent: Created child process 4612
[Fri Apr 09 06:58:02 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Apr 09 06:58:02 2010] [notice] Digest: done
[Fri Apr 09 06:58:05 2010] [notice] Child 4612: Child process is running
[Fri Apr 09 06:58:05 2010] [notice] Child 4612: Acquired the start mutex.
[Fri Apr 09 06:58:05 2010] [notice] Child 4612: Starting 150 worker threads.
[Fri Apr 09 06:58:05 2010] [notice] Child 4612: Starting thread to listen on port 443.
[Fri Apr 09 06:58:05 2010] [notice] Child 4612: Starting thread to listen on port 443.
[Fri Apr 09 06:58:05 2010] [notice] Child 4612: Starting thread to listen on port 80.
[Fri Apr 09 06:58:05 2010] [notice] Child 4612: Starting thread to listen on port 80.
[Fri Apr 09 06:58:09 2010] [error] [client 127.0.0.1] PHP Fatal error:  Call to undefined function _system_rebuild_theme_data() in C:\\xampp1.7.2\\xampp\\htdocs\\drupal-6.16\\includes\\theme.inc on line 585
[Fri Apr 09 06:58:17 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Fri Apr 09 06:58:17 2010] [notice] Child 4612: Exit event signaled. Child process is ending.
[Fri Apr 09 06:58:18 2010] [notice] Child 4612: Released the start mutex
[Fri Apr 09 06:58:19 2010] [notice] Child 4612: All worker threads have exited.
[Fri Apr 09 06:58:19 2010] [notice] Child 4612: Child process is exiting
[Fri Apr 09 06:58:19 2010] [notice] Parent: Child process exited successfully.

I thought I'd start by checking the obvious things... _system_rebuild_theme_data() is defined in my /modules/system/system.module, so it's not that I failed to copy the D7 files across correctly!
Trying to manually step back through update.php, I'm guessing that the call to drupal_load('module', 'system'); in line 358 of update.php should have made _system_rebuild_theme_data available, so for some reason that load hasn't happened at the point that list_themes() is being called... I'm way out of my depth here - this is like wading through treacle for me!

Still, I'm very happy to provide any more information if it would help someone with more brains than me figure this out! Thanks.

tanoshimi’s picture

....and, having found the error message, it seems like this (might be) a duplicate of http://drupal.org/node/757214 - at least, from about comment #8 onwards, it is...

aspilicious’s picture

I guess they are going to stop the support of upgrading versions <6.17. See #760014: Stop supporting direct updates from Drupal < 6.17.
So I guess if that one goes through we have to close this!

andypost’s picture

andypost’s picture

Status: Active » Needs review
StatusFileSize
new1.37 KB

This hunk was lost in #688294: Switch from db_is_active() to proper exception catching

EDIT: This code is critical required because theming a maintenance page could probably happen before system.module is loaded!!!

Crell’s picture

Related: #679112: Time for system.module and most of includes to commit seppuku

The fix in #6 is an ugly spaghetti hack. We may not be able to do better in Drupal 7, but we should be aware that it's an ugly piece of spaghetti. :-( system.module needs to be gutted and refactored for Drupal 8, no question.

David_Rothstein’s picture

Not sure about that patch - the current code looks fine in the case where the database is not active, so why move it out of there?

I think it's rather the responsibility of update.php to load system.module earlier in the page request if that's what's needed to make this work.

Or alternatively, remove the weird behavior where list_themes() insists on scanning the filesystem every single time update.php is being visited (rather than reading from a perfectly good database), i.e. here:

    // Extract from the database only when it is available.
    // Also check that the site is not in the middle of an install or update.
    if (!defined('MAINTENANCE_MODE') && db_is_active()) {
      foreach (system_list('theme') as $theme) {
        if (file_exists($theme->filename)) {
          $theme->info = unserialize($theme->info);
          $themes[] = $theme;
        }
      }
    }
    else {
      // Scan the installation when the database should not be read.
      $themes = _system_rebuild_theme_data();
    }

However, having tried to loosen that MAINTENANCE_MODE check previously (and failed), I know it's not so trivial to do :(

David_Rothstein’s picture

Ah, I see, I am a bit out of date - the intention of that other issue is that db_is_active() won't even exist anymore :)

So why not just put a single call to drupal_load() inside list_themes()? We are using system.module's API, so we need to make sure it is loaded. Not that pretty, but simple and effective. It ought to catch the update.php problem, as well as other obscure situations where we might hit this issue as well.

andypost’s picture

@David_Rothstein because this could probably happen when some troubles before system.module is loaded - for example issue from #5

This depends not only on database, core should have ability to theme maintenance page even if the system.module is not loaded

@Crell I see no other ability to handle this. But agreed exactly that theme listing should be moved out from system.module

andypost’s picture

StatusFileSize
new2.06 KB

Patch with improved comment and doc-block should be changed to standard. Need help to improve comment.

There are 3 cases when drupal_maintenance_theme() is called.

This piece of code execute from _drupal_log_error() so it's a right place to init database class and load system.module

andypost’s picture

StatusFileSize
new2.1 KB

Because db_is_active() lives in database.inc it's wrong to call this function to check that DB initialized
As #719850-16: errors in update.php during bootstrap yield a blank page
And upcoming #688294: Switch from db_is_active() to proper exception catching

catch’s picture

#12: 766100-list-themes-d7.patch queued for re-testing.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Patch still applies, agreed it's ugly but I don't think there's a way around that, we'll need to deal with it as part of #679112: Time for system.module and most of includes to commit seppuku. This should ideally go in before #688294: Switch from db_is_active() to proper exception catching, otherwise the patches need to be merged more or less.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok. Committed to HEAD. We'll see what we can do in D8.

Cheek’s picture

Still getting

[Fri Apr 23 20:00:43 2010] [error] [client ::1] PHP Fatal error: Call to undefined function _system_rebuild_theme_data() in C:\\xampp\\htdocs\\includes\\theme.inc on line 591

with latest 7.x-dev when upgrading. Tried different options, but I'm not sure what the problem is..

andypost’s picture

@Cheek could you provide more info?
- Are you running update.php? which step
- do you disable all contrib modules?
- do you override $conf['maintenance_theme'] ?

I cant reproduce this error...

theme.inc on line 591

Means that site in maintenance mode but system.module is not loaded

Cheek’s picture

- update.php after replacing d6 files with d7 files
- all modules are disabled
- overriding $conf['maintenance_theme'] or not doesn't matter
- having the site in maintenance mode or not during upgrade doesn't matter

Cheek’s picture

Status: Fixed » Needs review

Tried several other possibilities. None of them worked except upgrading from a fresh d6 to d7.

My site is high on CCK fields, including nodereferences.

Also did:
- export these tables only from d6 using backup and migrate:

comment
content_* (13 tables)
date_* (3 tables)
files
filter_formats
filters
finder
finder_element
flood history
migrate_content_* (2 tables)
node
node_* (7 tables)
openid_association
page_manager_* (3 tables)
role
search_* (5 tables)
semaphore
sessions
term_* (5 tables)
trackback_* (3 tables)
tw_*  (3 tables)
url_alias
validator_sesults_* (3 tables)
variable
vocabulary
vocabulary_node_types
watchdog

- clean d6 install
- import using backup and migrate
- test content
- replace d6 files with d7
- upgrade.php

Same error.. If you could tell me which are the necessary tables to only export the nodes with all the cck fields, I could try that as well.

andypost’s picture

bad news... I have no more ideas why update does not load system.module if all contrib are disabled
I think it's time to debug update.php

Cheek’s picture

This is where the error takes place:

function update_extra_requirements($requirements = NULL) {

  static $extra_requirements = array();
  if (isset($requirements)) {  <<< error
Cheek’s picture

Sorry, it's actually at the end of that if() (in upgrade.php):

function update_extra_requirements($requirements = NULL) {

  static $extra_requirements = array();
  if (isset($requirements)) {

    $extra_requirements += $requirements;
  }
  return $extra_requirements;  

It errors on "return $extra_requirements;"

update_extra_requirements() is called by update_check_requirements() which is called after drupal_maintenance_theme();

andypost’s picture

I think your update fail in update_prepare_d7_bootstrap() on drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
Because system is not loaded and you could have wrong database definition in settings.php - $db_url or $databases?

Cheek’s picture

Ugh, stupid of me. I'm new, so I thought I could just put a bunch of 'echo "error ...";' in the update.php en track the bug. This caused the update.php to stop before going to update.php?op=info and not putting any errors in my apache logs.

When using a clean update.php it does go to update.php?op=info with the WSOD + _system_rebuild_theme_data() error.

Is there any way I can track the bug in update.php?

I'm using the same $databases I created with a fresh d7 install and the same db.

andypost’s picture

If you have no debugger (xdebug, zend) the only possible solution is write to a file NOT echoing!!!

Cheek’s picture

Ok, so it seems to error on

update_fix_d7_requirements();

from update.inc called by update.php (calling theme.inc)

This is after running through update.php once and calling update.php?op=info

I'll see if I can install a debugger to find out more..

Cheek’s picture

[Sun Apr 25 05:50:10 2010] [error] [client ::1] PHP Fatal error:  Call to undefined function _system_rebuild_theme_data() in C:\\xampp\\htdocs\\includes\\theme.inc on line 591
[Sun Apr 25 05:50:10 2010] [error] [client ::1] PHP Stack trace:
[Sun Apr 25 05:50:10 2010] [error] [client ::1] PHP   1. _drupal_exception_handler() C:\\xampp\\htdocs\\includes\\bootstrap.inc:0
[Sun Apr 25 05:50:10 2010] [error] [client ::1] PHP   2. _drupal_log_error() C:\\xampp\\htdocs\\includes\\bootstrap.inc:1868
[Sun Apr 25 05:50:10 2010] [error] [client ::1] PHP   3. drupal_maintenance_theme() C:\\xampp\\htdocs\\includes\\errors.inc:157
[Sun Apr 25 05:50:10 2010] [error] [client ::1] PHP   4. _drupal_maintenance_theme() C:\\xampp\\htdocs\\includes\\bootstrap.inc:2064
[Sun Apr 25 05:50:10 2010] [error] [client ::1] PHP   5. list_themes() C:\\xampp\\htdocs\\includes\\theme.maintenance.inc:59

It seems to be triggered by

db_add_index('system', 'system_list', array('weight', 'name'));

in function update_fix_d7_requirements() in update.inc, line 329.

That's about as far as my knowledge goes. What I don't get is this involves themes, while I'm upgrading with only the standard d7 themes. Is any theme info stored in the db? Else, I could try to delete the d6 theme info. All I want is to get my d6 node data into d7 anyway.

mfb’s picture

I got this error when trying to load update.php on what is already a D7 site, and in my case it went away if I disabled apc.include_once_override

catch’s picture

Priority: Critical » Normal
Status: Needs review » Postponed (maintainer needs more info)

If this only shows up with include_once_override then it's not critical. Is it possible you tried update.php without there being an apache restart since the patch was committed?

Cheek’s picture

I tried upgrading like 30 times now. With different options, different releases (including alpha4). The only time I got it working is with a clean, empty d6 install. Just tried today's release with an apache restart and got the same errors I stated above.

I guess my drupal 6 db is too complex or whatever. I'll try upgrading again when we're closer to a final release..

catch’s picture

@Cheek - do you have APC and include_once_override enabled?

Cheek’s picture

Don't think so. It doesn't show up in the phpinfo() and setting 'apc.include_once_override = 0' in the php.ini didn't do anything. I'm using xampp.

catch’s picture

Status: Postponed (maintainer needs more info) » Active

So a clean D6 install upgrades, but not your real database with actual data in it? Either way this is no longer 'needs more info'.

Cheek’s picture

Yes, just did another clean d6 upgrade to d7 and it works fine. Same d6 and d7 files that don't work when I try to upgrade d6 with my sites data.

chx’s picture

I have seen this error message. The chain is the following... I think at least (it's 1am) ... you get an error... drupal_log_error calls maintenance theme.. but system is not yet loaded. Kaboom!

andypost’s picture

Status: Active » Needs review
StatusFileSize
new1.38 KB

@chx system could not be 'not loaded yet' because a last commited patch #12.

@Cheek could you try this patch? This moves loading system.modules out of condition

Cheek’s picture

I'm now getting a drupal error when running update.php (tried alpha4 and today's release).

Notice: date_default_timezone_set(): Timezone ID '-25200' is invalid in drupal_session_initialize() (line 214 of C:\xampp\htdocs\includes\session.inc).
DatabaseSchemaObjectExistsException: Table <em class="placeholder">date_formats</em> already exists. in DatabaseSchema->createTable() (line 605 of C:\xampp\htdocs\includes\database\schema.inc).
mikey_p’s picture

Cheek, I've got a patch for the timezone notice in #805052: Notice in update.php in drupal_session_initialize().

We may need to see a scrubbed copy of your DB if no one else can recreate the problem, but I strongly suspect that it may have been the exception not being caught properly, which was causing the theme system to go into a tizzy. I've see the undefined function error with _system_rebuild_theme_data() in relation to other issues but I could never pin point the cause. It may or may not be related to #805222: PDO exception when installing with $update_free_access = TRUE.

Cheek’s picture

Thanks for the timezone fix mikey_p!

I'm now don't to the second line:

DatabaseSchemaObjectExistsException: Table <em class="placeholder">date_formats</em> already exists. in DatabaseSchema->createTable() (line 605 of C:\xampp\htdocs\includes\database\schema.inc).

Seems related to drupal_install_schema() ?

#761740: On enabling 2 or more modules: DatabaseSchemaObjectExistsException
#780296: Error cache_coder already exists in DatabaseSchema on installation
#790310: PHP warning - install fails
#762910: Unnecessary call to drupal_install_schema()

Cheek’s picture

When I try setting $update_free_access to true, I get the same error as #805222: PDO exception when installing with $update_free_access = TRUE

First getting denied and then setting it to true doesn't help, since I get the DatabaseSchemaObjectExistsException error when $update_free_access is set to false.

I'm going to try to uninstall some modules before upgrading d6->d7 now. Maybe it's some old table from an even older module..

Cheek’s picture

Ok, so after a couple of tries I found out uninstalling the Date API in D6 before upgrading did the trick.

So that's:

Thanks so much guys! I'm finally able to upgrade to Drupal 7! :)

catch’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good and it's been tested successfully.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Looks good to me. Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -D7 upgrade path

Automatically closed -- issue fixed for 2 weeks with no activity.