Hello,
I tried to enable 7.xr c2 version of the module using drush, but I recieved this:

igorik@svp-new:~/www/somvprahe.sk-nove/sites/all/modules$ drush en phpfreechat
The following extensions will be enabled: phpfreechat
Do you really want to continue? (y/n): y
PHP Fatal error: Call-time pass-by-reference has been removed in /var/www/somvprahe.sk-nove/sites/all/modules/phpfreechat/phpfreechat.module on line 446

Fatal error: Call-time pass-by-reference has been removed in /var/www/somvprahe.sk-nove/sites/all/modules/phpfreechat/phpfreechat.module on line 446
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call-time pass-by-reference has been removed in
/var/www/somvprahe.sk-nove/sites/all/modules/phpfreechat/phpfreechat.module,
line 446

This is the only module I have this problem with it.
Thanks for help.

Igor

CommentFileSizeAuthor
#14 Screen Shot 2015-04-10 at 07.33.56.png77.26 KBigorik

Comments

tessa bakker’s picture

Hi Igor,

The code of 7.x-1.0-rc2 isn't very secure, see also https://www.drupal.org/node/1617940#comment-9745791 Permutations is working on a new version.

If you have the time, you can try the proposal for a v2 of this module, it has some warnings with Drush and other small things. But it will install and does a lot of configuration out-of-the-box. Please note that you need to save the configuration of phpfreechat the first time (admin/config/content/phpfreechat , this is a small bug) any other issues you can find in the status page of your Drupal site or ask in the issue queue. https://www.drupal.org/node/2455215

permutations’s picture

I see the problem. I'll fix it.

permutations’s picture

I made the security changes, but didn't upload a new version yet because the security risk was minimal and I wanted to group together more changes (per Drupal guidelines). The forms in question are only accessible to Drupal administrators, not the general public.

igorik’s picture

@Permutations - thanks, I will try it again when there will be a new version.
@Tessa: thank you for your comment - I tried your module but I recieved a lot of errors on page, here I created related issue for that:
https://www.drupal.org/node/2464769
thank you
Igor

permutations’s picture

igorik - I tried to install drush tonight, but ran into problems. I only just had this account moved to a server where I have command line access, and I discovered tonight that I don't yet have everything I need to work properly. The system admins need to set up some pieces they omitted. I'm almost certain I know why you encountered that bug, but I don't want to upload something I haven't tested. I will upload the fix soon.

igorik’s picture

@permutations, thank you.
Looking forward to it.

permutations’s picture

igorik - could you tell me exactly what drush command you used to enable phpfreechat? I have only just installed drush, and this is non-trivial to learn. Please tell me the command you used so I can duplicate the error you received.

Also, could you please tell me the benefit of enabling phpfreechat in this manner? Why not do it in the usual way?

igorik’s picture

Hello Permutations.
I just use the command "drush en", which will download and enable the module.
Full command I used was this: drush en phpfreechat

The general reason (for me) why to enable/disable modules using drush is that it is much mor comfortable and faster,
it is not necessary to:
1. download module from Drupal.org to the computer
2. unzip the module
3. copy the module using ftp from computer to the web
4. loading list of module page - it takes often very long time to load,
5. enabling module in module administration on the web + to wait again to load the module page after confirmation

all these steps are replaced by this 1 command, and the time of run of this command is about 5 - 10 seconds.

Have a nice day
Igor

permutations’s picture

"drush en" isn't a native command - not that I see in "drush help". Probably you set it up as an alias for something? Could you please tell me the native drush command?

Thanks.

igorik’s picture

drush pm-enable
Enable one or more extensions (modules or themes).

Aliases
pm-enable has an alias:
drush en

Argument
pm-enable accepts an argument:
extensions : A list of modules or themes. You can use the * wildcard at the end of extension names to enable all matches.

http://www.drushcommands.com/drush-7x/pm/pm-enable

igorik’s picture

Hello Permutations,

I tried your phpfreechat module (7x 1.0 rc2) on clean installation of D7 on my computer, without drush.

I have correctly downloaded your module in sites/all/modules and phpfreechat script in sites/all/modules/phpfreechat/phpfreechat
However, after enabling phpfreechat module (through web interface, no drush) I recieved this error:

Fatal error: Call-time pass-by-reference has been removed in /Users/igorik/Documents/dev desktop sites/test_chat2/sites/all/modules/phpfreechat/phpfreechat.module on line 446

So it is impossible for me to enable this module and to have a chance trying it if then it will be work.

Thank you for your help
Igor

permutations’s picture

Hi igorik,

It's the same line. It's very strange that you get this error and I don't. I can't reproduce this error. Here is the RC2 code installed on a Drupal 7 test site:

http://drup7.permutations.com/

As you can see, it works perfectly.

Could you please tell me what version of PHP you are running on your server?

I see the pass-by-reference on Line 446. I'll try removing it, and (if it's still working correctly for me), I'll upload that and you can tell me if that fixes it for you. I can't reproduce the error myself.

permutations’s picture

Version: 7.x-1.0-rc2 » 7.x-1.0-rc3
Assigned: Unassigned » permutations
Status: Active » Needs review

Igor, I just uploaded RC3, which I hope will fix the problem you are seeing. It's hard for me to be sure because I can't reproduce the error. I suspect I'm running a different version of PHP. What version are you running?

Please let me know if this latest version fixes the error.

igorik’s picture

StatusFileSize
new77.26 KB

Hello Permutations, thanks for quick reply.
On localhost I am using PHP ver. 5.5.23 (Acquia Dev Desktop software)
It is a clear D7 (7.36) installation, ony phpfreechat and admin menu are installed there, no other modules.

I can confirm that now with rc3 version the error is fixed, and the module is now enabled correctly, and I can create content type with chat enabled,
and the node with chat enabled, where the chat is loaded.

However it is not fully functional for me,
after enabling the module, I have on each page this notice:
Warning: Creating default object from empty value in phpfreechat_form_alter() (line 106 of /Users/igorik/Documents/dev desktop sites/test_chat2/sites/all/modules/phpfreechat/phpfreechat.module).

and on the chat node page, chat is loaded but not in working state, there is notice "/missing parameter" - I am adding a screenshot here.

I looked to watchdog and I found this, maybe it will help you:

TYPE php
DATE Friday, April 10, 2015 - 07:39
USER Anonymous (not verified)
LOCATION http://www.test_chat2.dd:8083/sites/all/modules/phpfreechat/handler.php
REFERRER http://test_chat2.dd:8083/node/1
MESSAGE Notice: Trying to get property of non-object in phpfreechat_prepare_params() (line 686 of /Users/igorik/Documents/dev desktop sites/test_chat2/sites/all/modules/phpfreechat/phpfreechat.module).
SEVERITY notice
HOSTNAME 127.0.0.1

TYPE php
DATE Friday, April 10, 2015 - 07:39
USER Anonymous (not verified)
LOCATION http://www.test_chat2.dd:8083/sites/all/modules/phpfreechat/handler.php
REFERRER http://test_chat2.dd:8083/node/1
MESSAGE Notice: Undefined variable: node in main() (line 89 of /Users/igorik/Documents/dev desktop sites/test_chat2/sites/all/modules/phpfreechat/handler.php).
SEVERITY notice
HOSTNAME 127.0.0.1

Thank you.

permutations’s picture

My Web host is running PHP 5.3.29. These errors must be due to changes in PHP. I'll check it out and upload a fix. Thanks for the feedback.

igorik’s picture

Hello Permutations,
I tried it now on PHP 5.3.29 on clean latest D7
(using Acquia Dev Desktop it is really easy to created any clean drupal install on computer)
and I have probably the same problem.

Immediately after I enabled phpfreechat module (including phpfreechat script)
I recieved these warnings:

Strict warning: Only variables should be passed by reference in _phpfreechat_check_files() (line 24 of /Users/igorik/Documents/dev desktop sites/chat_php_5329/sites/all/modules/phpfreechat/phpfreechat.inc).
Strict warning: Only variables should be passed by reference in _phpfreechat_check_files() (line 25 of /Users/igorik/Documents/dev desktop sites/chat_php_5329/sites/all/modules/phpfreechat/phpfreechat.inc).
Strict warning: Only variables should be passed by reference in _phpfreechat_check_files() (line 26 of /Users/igorik/Documents/dev desktop sites/chat_php_5329/sites/all/modules/phpfreechat/phpfreechat.inc).
Strict warning: Creating default object from empty value in phpfreechat_form_alter() (line 106 of /Users/igorik/Documents/dev desktop sites/chat_php_5329/sites/all/modules/phpfreechat/phpfreechat.module).

and after then on any page I have this error:
Error messageStrict warning: Creating default object from empty value in phpfreechat_form_alter() (line 106 of /Users/igorik/Documents/dev desktop sites/chat_php_5329/sites/all/modules/phpfreechat/phpfreechat.module).

so it is probably the same problem as I wrote above. On phpfreechat node there is the chat loaded but not working, there is message "Missing parameter (/join {channelname})"

Here are watchdog details:

TYPE php
DATE Sunday, April 12, 2015 - 09:38
USER Anonymous (not verified)
LOCATION http://www.chat_php_5329.dd:8083/sites/all/modules/phpfreechat/handler.php
REFERRER http://chat_php_5329.dd:8083/node/1
MESSAGE Notice: Undefined variable: node in main() (line 89 of /Users/igorik/Documents/dev desktop sites/chat_php_5329/sites/all/modules/phpfreechat/handler.php).
SEVERITY notice
HOSTNAME 127.0.0.1

TYPE php
DATE Sunday, April 12, 2015 - 09:38
USER Anonymous (not verified)
LOCATION http://www.chat_php_5329.dd:8083/sites/all/modules/phpfreechat/handler.php
REFERRER http://chat_php_5329.dd:8083/node/1
MESSAGE Notice: Trying to get property of non-object in phpfreechat_prepare_params() (line 686 of /Users/igorik/Documents/dev desktop sites/chat_php_5329/sites/all/modules/phpfreechat/phpfreechat.module).
SEVERITY notice
HOSTNAME 127.0.0.1

TYPE php
DATE Sunday, April 12, 2015 - 09:38
USER admin
LOCATION http://chat_php_5329.dd:8083/admin/reports/dblog
REFERRER http://chat_php_5329.dd:8083/node/1
MESSAGE Strict warning: Creating default object from empty value in phpfreechat_form_alter() (line 106 of /Users/igorik/Documents/dev desktop sites/chat_php_5329/sites/all/modules/phpfreechat/phpfreechat.module).
SEVERITY debug
HOSTNAME 127.0.0.1

thank you
Igor

permutations’s picture

Thanks very much for this feedback. With line numbers, it will be easy to fix.

It's really strange that you get these errors and I don't. I wish I could reproduce them. I wonder what the difference is in our setups. I'll make sure I have all errors and warnings turned on.

permutations’s picture

I just googled Acquia Dev Desktop. Thanks for this tip! I hadn't heard of that.

I've been planning to set up a Linux server, but I haven't had time.

jobertus’s picture

are there some news on this(?), I have the same error messages around and can´t configure the chat via configuration options.
gonna try rc2...

permutations’s picture

I don't have command line access to the server where phpFreeChat is installed, so I can't install Drush.

Apparently, Drush is doing some sort of PHP checking and doesn't like line 446. I looked at line 446, but all I see is an open comment (/*). If you can show me the offending line, I can probably figure out why Drush is complaining.

As If’s picture

Note: I'm getting the same error ("Warning: Creating default object from empty value in phpfreechat_form_alter() (line 106"), but I installed the module via the admin, not Drush. In other words, Drush isn't the problem.

tessa bakker’s picture

On line 105 (https://git.drupalcode.org/project/phpfreechat/blob/7.x-1.x/phpfreechat....) should be added:

if (empty($node)) {
 return;
}

Correction: the form_alter needs to be split into two seperate hooks: hook_form_BASE_ID_alter() one for 'node_type_form' and one for 'node_form' or something like that. Than the code should be running a lot better.

Or (ugly solution) add some extra checks for $type and $node.

See also (SANDBOX): https://git.drupalcode.org/sandbox/tessabakker-2469117/blob/7.x-2.x/phpf...