Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Experiencing two errors when using php 5.3:
warning: Parameter 1 to theme_wysiwyg_profile_overview() expected to be a reference, value given in /Library/WebServer/Documents/drupal6/includes/theme.inc on line 617.
warning: Parameter 1 to theme_wysiwyg_admin_button_table() expected to be a reference, value given in /Library/WebServer/Documents/drupal6/includes/theme.inc on line 617.
Removing the & on line 325 and 460 of wyswiwyg.admin.inc fixes the warning.
Cheers
Comment | File | Size | Author |
---|---|---|---|
#30 | 613480-wysiwyg-php53-2-fix.patch | 475 bytes | florian.cathala |
#29 | 613480-wysiwyg-php53-2.patch | 476 bytes | florian.cathala |
#4 | wysiwyg-php5.3.patch | 917 bytes | TwoD |
Comments
Comment #1
mobo1 CreditAttribution: mobo1 commentedHello,
in line 460 is no " &"
line 460 is looking so:
460 }
thx for help
Comment #2
brainajw CreditAttribution: brainajw commentedI'm having the same issue.
Error:warning: Parameter 1 to theme_wysiwyg_profile_overview() expected to be a reference, value given in C:\wamp\www\mysite\includes\theme.inc on line 617.
Code from 319 -333
/**
* Submit callback for Wysiwyg profile form.
*
* @see wysiwyg_profile_form()
*/
function wysiwyg_profile_form_submit($form, &$form_state) {
$values = $form_state['values'];
if (isset($values['buttons'])) {
// Store only enabled buttons for each plugin.
foreach ($values['buttons'] as $plugin => $buttons) {
$values['buttons'][$plugin] = array_filter($values['buttons'][$plugin]);
}
// Store only enabled plugins.
$values['buttons'] = array_filter($values['buttons']);
}
Code from 452 - 465
$formats = filter_formats();
$profiles = wysiwyg_profile_load_all();
$form['formats']['#tree'] = TRUE;
foreach ($formats as $id => $format) {
$form['formats'][$id]['name'] = array(
'#value' => check_plain($format->name),
);
$form['formats'][$id]['editor'] = array(
'#type' => 'select',
'#default_value' => isset($profiles[$id]) ? $profiles[$id]->editor : '',
'#options' => $options,
'#id' => "edit-editor-$id",
'#disabled' => isset($profiles[$id]) ? (bool) $profiles[$id]->editor : FALSE,
);
Any ideas?
Comment #3
TwoDNot critical. The module still works, the profile overview is just compressed and the button/plugin list just has one large column.
I now have access to a PHP 5.3 server and the simple changes in this patch fixes it. It also compatible with 5.2 but I have no idea about PHP 4 yet.
Comment #4
TwoDComment #5
Dave ReidLooks good.
Comment #6
TwoD@Dave Reid, does that include when using PHP 4?
Comment #7
Dave ReidYes it will work just fine.
Comment #8
sunThanks for reporting, reviewing, and testing! Committed to all branches.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.
Comment #9
maximpodorov CreditAttribution: maximpodorov commentedI think one more change is required:
-function wysiwyg_form_alter(&$form, &$form_state) {
+function wysiwyg_form_alter(&$form, $form_state) {
Comment #10
Cousken CreditAttribution: Cousken commentedHi, i had this issue and applying the patch seems to have solved it. Unless there are some buttons or some such supposed to be visible on the configuration page. I just have a list of the installed modules, never seen WYSIWYG in action before.
Comment #11
sun@maximpodorov: No, $form_state is always passed by reference.
Comment #12
maximpodorov CreditAttribution: maximpodorov commentedAccording to
http://api.drupal.org/api/function/hook_form_alter/6
$form_state is passed by value (for Drupal 6).
Comment #13
DrumLib CreditAttribution: DrumLib commentedHow do you apply this patch? I'm testing XAMPP and Drupal on a USB key installation.
Comment #14
TwoD@DrumLib, the patch has already been committed to CVS, no need to apply it. Just download the -dev snapshot. This will become part of release 2.1.
Comment #15
maximpodorov CreditAttribution: maximpodorov commentedExcuse me for the annoyance, but not using #9 patch leads to
warning: Parameter 2 to wysiwyg_form_alter() expected to be a reference, value given in ...
message.
Comment #16
TwoDCurious, I'm not seeing that warning on the PHP 5.3 site I'm testing on.
Comment #17
maximpodorov CreditAttribution: maximpodorov commentedI saw it when pressed "Add more item" button for cck image field at node edit form with wysiwyg editor.
Comment #18
Berdir@17
In that case, the one that calls the function is doing something wrong. See http://drupal.org/node/360605#comment-2335898 for a way to figure out who is causing this. (You need to paste that code inside wysiwyg_form_alter(), of course.
Comment #19
makatozi CreditAttribution: makatozi commentedThe Patch in #4 worked well. XAMPP 1.7.3 Thanks!
Comment #20
maximpodorov CreditAttribution: maximpodorov commentedActually, is't CCK who initiate addressing to wysiwyg_form_alter in this case. The code in cck/includes/content.node_form.inc (content_add_more_js function):
...
drupal_alter('form', $form_element, array(), 'content_add_more_js');
...
There're some discussions on this topic:
http://drupal.org/node/705512
http://drupal.org/node/649106
If I understood correctly, it's safe to remove ampersand from $form_state parameter. BTW, hook_form_alter implementations in the core Drupal modules follow the API documentation:
book_form_alter(&$form, $form_state, $form_id)
color_form_alter(&$form, $form_state, $form_id)
comment_form_alter(&$form, $form_state, $form_id)
forum_form_alter(&$form, $form_state, $form_id)
locale_form_alter(&$form, $form_state, $form_id)
menu_form_alter(&$form, $form_state, $form_id)
node_form_alter(&$form, $form_state, $form_id)
openid_form_alter(&$form, $form_state, $form_id)
path_form_alter(&$form, $form_state, $form_id)
taxonomy_form_alter(&$form, $form_state, $form_id)
translation_form_alter(&$form, $form_state, $form_id)
update_form_alter(&$form, $form_state, $form_id)
upload_form_alter(&$form, $form_state, $form_id)
Comment #21
sunThanks for figuring that out!
#705512: drupal_alter('form'... called from content_add_more_js needs to pass $form_state as a reference seems to be the cause. And contains a patch that looks like it just needs confirmation + testing + RTBC.
Comment #22
sunTagging.
Comment #23
maximpodorov CreditAttribution: maximpodorov commentedExcuse me again, but is there any reason to declare wysiwyg_form_alter function as getting $form_state by reference, if it's not modified by the function? I think functions in Drupal core modules mentioned in #20 may be thought as reference.
Comment #24
sunAs of now, it is technically not needed by Wysiwyg, so as a quick/dirty fix, you could remove the ampersand. However, $form_state is always passed by reference, so changing it here would be wrong. Instead, we need to push that patch for CCK.
Also note that http://drupal.org/project/issues/search?issue_tags=PHP+5.3 provides you a nice list of all PHP 5.3 issues on drupal.org.
Comment #25
b3liev3 CreditAttribution: b3liev3 commented@sun is right.
please read this http://drupal.org/node/705512
Comment #27
roball CreditAttribution: roball commentedI am still getting
PHP errors, immediately after having logged in. Any ideas which module could cause this?
Comment #28
roball CreditAttribution: roball commentedFound the originating module: One page profile. Once I have disabled it, the error went away. Already found the issue reported there.
Comment #29
florian.cathala CreditAttribution: florian.cathala commentedPatching CCK does not fix the error reported by roball (#27).
Here is the patch as attached file.
Comment #30
florian.cathala CreditAttribution: florian.cathala commentedHere is the fixed patch.
Comment #31
TwoDThat patch is wrong, see #24. Please fix the module which does not pass
$form_state
by reference instead.Patching CCK (no longer needed btw) will not always fix the issue because it might not be the offending module, as roball noted in #28.
See the documentation for drupal_alter() on passing alterable arguments through it.
Comment #32
memcinto CreditAttribution: memcinto commentedHow did you trace it back to the originating module? That's what I'm having trouble with.