Whenever I try to access theme editor from administer I get this error.

Fatal error: Only variables can be passed by reference in C:\Program Files\Apache Group\Apache2\htdocs\base\modules\theme_editor\theme_editor.module on line 519

Please let me know if there is any remedy for this problem.

Thank you.

~ Ranjeet

Comments

ced_garcia’s picture

Was able to reproduce on my machine.
Drupal 4.6.3
PHP 5.0.5
Apache 2.0.54
MySQL 4.1.8
Also line 519

I'm new to Drupal so I did not try to debug.

sky_diver_’s picture

I had same error for Drupal system.module on line 650.
Workaround:

change

system.module:650         file_check_directory(variable_get('file_directory_path', 'files'), FILE_CREATE_DIRECTORY, 'file_directory_path');

to

system.module:650         $tmp_var_001 = variable_get('file_directory_path', 'files');
system.module:651         file_check_directory($tmp_var_001, FILE_CREATE_DIRECTORY, 'file_directory_path');

I did this every time error like this popped up (2 times by now in system.module).

It's some php bug I guess...

Regerds.

ced_garcia’s picture

Thanks!! That seems to be the problem. Your fix is like danielc's official patch for the system.module bug. I installed it a while ago so I did not remmeber. See http://drupal.org/node/26033

I modified the theme_editor.module with the following: (line 519:)

function _theme_editor_check_dir() {
$tmp_var_ced = variable_get('theme_editor_path', 'theme_editor');
$tmp2_var_ced = file_create_path($tmp_var_ced);
if (!file_check_directory($tmp2_var_ced, FILE_CREATE_DIRECTORY)) {
return t('The theme storage directory does not exist or is not writable.');
}
}

...and everything was fixed. I tested the module and so far everything is working well. There are other instances of the file_create_path call in the module so I'm going to make further tests.

Ced

kodmasin’s picture

It seems that people at PHP do not think that this is PHP bug (see http://bugs.php.net/bug.php?id=33643 ). So drupal should change code in way that rasmus suggests:

function & foo() { static $a; return $a; }
function bar(&$arg) { $arg = 1; }
bar(foo());

this is different than simple but ugly fixes like:

$temp_001 =& foo();
bar(&$temp_001);

bye
boris

kodmasin’s picture

I was wrong. There is no way to escape ugly:

bar($temp_001=foo());

Sorry

kodmasin’s picture

Just for your information. Following code:

$page = array_pop( explode( '/', $HTTP_SERVER_VARS['PHP_SELF'] ));

Throws "Fatal error: Only ..." in PHP5.1.0RC1 but not in PHP5.1.0RC3 so this is porobably PHP bug.

MVRider’s picture

Not sure if it has also been addressed in the node.module.

I also get that error on line 735 of node.module:

    else if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'configure' && arg(3) == 'types' && is_string(arg(4))) {
      $items[] = array('path' => 'admin/node/configure/types/'. arg(4),
        'title' => t("'%name' content type", array('%name' => node_invoke(<b>arg(4)</b>, 'node_name'))),
        'type' => MENU_CALLBACK);

Quick Fix I made:

    else if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'configure' && arg(3) == 'types' && is_string(arg(4))) {
      $items[] = array('path' => 'admin/node/configure/types/'. arg(4),
        $typeName = arg(4);
        'title' => t("'%name' content type", array('%name' => node_invoke(<b>$typeName</b>, 'node_name'))),
        'type' => MENU_CALLBACK);
drupeall’s picture

I submitted a patch for theme_editor.module in http://drupal.org/node/49594

shane birley’s picture

Status: Active » Closed (fixed)