Gossamer Forum
Home : Products : Others : Gossamer Community :

Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866

Quote Reply
Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866
Hi,

We have upgraded to the last gcomm version (v 1.1.1), but when user fill the signup form and hit Submit, Community returns this error:

Code:
The system encountered a fatal error:

Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866

What this mean?

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Either you have an application that isn't updated to the latest version, or you need to remove the compiled files from the templates.

Adrian
Quote Reply
Re: [brewt] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Adrian would you please explain which files are to be removed - using linksSQL 2.2.1
Quote Reply
Re: [brewt] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Hi, Adrian:

I have the same error, but only when the application of DBMANSQL is added -
The system encountered a fatal error:
Can't use string ("1") as a HASH ref while "strict refs" in use at /../../lib/GT/Template.pm line 866.

This occurs only when a user is trying to log out or signup, but the system does accomplish the action of adding the user.

Maybe interference with Template.pm in DBMANSQL?

I deleted all compiled files both in Gcomm and DBMANSQL

Any ideas? - really appreciative

Thanks,
Bill
Quote Reply
Re: [billgrv] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
In cases like this (where you're using software that contains an older version of GT::Template), the usual solution is to make sure you get the newest GT::Template (GT/Template.pm, and the GT/Template directory from the latest released application) and overwrite the GT::Template for all your other GT apps (backup first of course). Then clear out the .compiled directories.

Adrian

Last edited by:

brewt: Apr 23, 2008, 3:17 PM
Quote Reply
Re: [brewt] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Hi,

I'm having the same problem -

GLinks 3.2.0
GForum 1.2.4

GComm 1.1.1.

Are these the most up-to-date?

I only get it when I try and do an import from GForum (gets up to the point of selecting the fields to add, then when you click on the submit button - it gives this error);

Quote:
The system encountered a fatal error:

Can't use string ("1") as a HASH ref while "strict refs" in use at /home/user/public_html/community/private/custom/lib/GT/Template.pm line 866.



TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [eupos] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Hi,

I got these message before when I worked on some plugins if in any hooks or routines that return a page or somethings not a tempate file name. This is also shown in Gforum and Gmail. I did not see that in glinks so far, probably, I am on an older version.

So, can you try just return something like this in the sub

return ('',{no_print => 1});# if you have print out the page

Or return ("template name",{hash }); ## if you did not print out any thing in the sub

Hope that helps!

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [Andy] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
You have old compiled files somewhere and probably an old version of GT::Template that's getting loaded. Try patching your community's GT/Template.pm:
Code:
diff -u -r2.167 Template.pm
--- Template.pm 25 Sep 2007 21:33:39 -0000 2.167
+++ Template.pm 14 May 2008 02:45:11 -0000
@@ -877,9 +877,14 @@
# - merge (default on) - if variable is a hash ref, whether to merge values
# and return undef (true) or not merge and return 1
# (false). The latter is used in if tags.
-#
+#
my ($self, $str, $opt) = @_;
- $opt ||= { escape => 0, strict => 0, merge => 1 };
+
+# Backwards compatibility with old compiled files generated by
+# GT::Template::Parser <= r2.151
+ $opt = { escape => $_[2], strict => $_[3] } if not ref $opt and defined $opt;
+
+ $opt ||= { escape => 0, strict => 0 };
$opt->{merge} = 1 if not exists $opt->{merge};

my ($ret, $good) = ('', 1);

Adrian
Quote Reply
Re: [brewt] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Hi,

Thanks - worked a charm! Maybe get it fixed up in the current version of GComm? (thats the only Template.pm file I had to update)

Thanks again - I'll let you know if I get any more problems <G>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [brewt] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Hi,

I lied :(

It kinda worked - but now sometimes I get this error:
Quote:
The system encountered a fatal error:

GT::Template (17774): Unknown method '_get_value' called at /home/user/public_html/community/private/custom/templates/default/compiled/admin_apps_users_modify.html.compiled line 484.

Any suggestions?

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Yep, erase all compiled templates!

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Good point, thanks! Done that, and all looks ok again Smile

Thanks!

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Well it looks like one of your apps has a really old version of GT::Template installed. You need to find which one it is and do the things I mentioned above.

Adrian
Quote Reply
Re: [brewt] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Hi, Adrian:

Just got everything up and running thanks to your advice. U da man!!

Bill
Quote Reply
Re: [billgrv] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Hi there,

I'm just upgraded Linksql to V3.2.0 and Community to V1.1.1 and now getting the same error (when deleting a user).

1) I've deleted all compiled files from both Linksql and Community
2) I created a patch file with the contents as given by Adrian but when I apply it to the Template.pm for Community I get this error;
Code:
patching file Template.pm
patch: **** malformed patch at line 9: my ($self, $str, $opt) = @_;

I've never used the patch command before but found the directory that Template.pm was in, and then ran: patch < patch_file, where patch_file had Adrian's code from above.

Could anybody help? My existing Template.pm from Community has this as in the header ; # $Id: Template.pm,v 2.161 2006/07/06 04:46:11 jagerman Exp $ - maybe that will help somebody?


Best wishes,

Piers
Quote Reply
Re: [Piers1] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Hi,

Mmm.. never seen that error - maybe worth emailing either Adrian (adrian @ gossamer - threads.com , minus spaces =)), or support @ gossaer-threads.com - to see if any of them have seen that error before.

Hope that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Piers1] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Try applying the patch manually (since it's small enough to do so):

http://www.gossamer-threads.com/...?post=274190;#274190

Adrian
Quote Reply
Re: [brewt] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
Thank you Adrian and Andy.

I've got it working, and learnt how to read a patch file manually - all good.

Best wishes,

Piers
Quote Reply
Re: [Piers1] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
I spoke too soon!
Now even after patching the template.pm file in Community and Linksql, and deleting all compilied templates, and turning off all linksql plugins (apart from Auth_Community and YahooSubcats);
I get the same error as Andy. This happens when signing up a new user;
Code:
GT::Template (14053): Unknown method '_get_value' called at /home/mysite/community/templates/default/compiled/user_signup_validate.html.compiled line 243.

This is the last few lines from my Apache 2.0 error file;
Code:
[Wed Jul 30 19:29:02 2008] [error] [client my IP address] GT::SQL::Driver::MYSQL::sth (13881): Executing query: SELECT tree_id_fk,tree_anc_id_fk FROM lsql_Category_tree WHERE tree_id_fk = '2380' from Links::Newsletter::subscription_info at /home/mysite/public_html/cgi-bin/admin/Links/Newsletter.pm line 534, referer: http://www.mysite.com/resources/Services-and-Equipment/Sound/Manufacturers/index.html
[Wed Jul 30 19:29:02 2008] [error] [client my IP address] GT::SQL::Driver::MYSQL::sth (13881): Executing query: SELECT CategoryID FROM lsql_NewsletterSubscription WHERE CategoryID IN (0,467,2213,2379) AND UserID IS NULL from Links::Newsletter::subscription_info at /home/mysite/public_html/cgi-bin/admin/Links/Newsletter.pm line 535, referer: http://www.mysite.com/resources/Services-and-Equipment/Sound/Manufacturers/index.html
[Wed Jul 30 19:29:10 2008] [error] [client my IP address] GT::Plugins (13882): Plugin: pre auth_init running => Plugins::Auth_Community::auth_init at /home/mysite/public_html/cgi-bin/admin/GT/Plugins.pm line 118., referer: http://www.mysite.com/resources/Services-and-Equipment/Sound/Manufacturers/Microphones/index.html
[Wed Jul 30 19:29:10 2008] [error] [client my IP address] GT::Plugins (13882): Plugin: pre auth_valid_session running => Plugins::Auth_Community::auth_valid_session at /home/mysite/public_html/cgi-bin/admin/GT/Plugins.pm line 118., referer: http://www.mysite.com/resources/Services-and-Equipment/Sound/Manufacturers/Microphones/index.html
[Wed Jul 30 19:29:10 2008] [error] [client my IP address] GT::Plugins (13882): Plugin pre hook auth_valid_session stopped further plugins. at /home/mysite/public_html/cgi-bin/admin/GT/Plugins.pm line 123., referer: http://www.stagelink.net/resources/Services-and-Equipment/Sound/Manufacturers/Microphones/index.html
[Wed Jul 30 19:29:10 2008] [error] [client my IP address] GT::Plugins (13882): Plugin: pre handle_login running => Plugins::Auth_Community::handle_login at /home/mysite/public_html/cgi-bin/admin/GT/Plugins.pm line 118., referer: http://www.mysite.com/resources/Services-and-Equipment/Sound/Manufacturers/Microphones/index.html
[Wed Jul 30 19:29:10 2008] [error] [client my IP address] GT::Plugins (13882): Plugin pre hook handle_login stopped further plugins. at /home/mysite/public_html/cgi-bin/admin/GT/Plugins.pm line 123., referer: http://www.mysite.com/resources/Services-and-Equipment/Sound/Manufacturers/Microphones/index.html
[Wed Jul 30 19:29:32 2008] [error] [client my IP address] GT::Template (13887): Unknown method '_get_value' called at /home/mysite/community/templates/default/compiled/user_signup_validate.html.compiled line 243., referer: http://www.mysite.com/cgi-bin/community/community.cgi?do=user_signup;url=http%3A%2F%2Fwww.mysite.com%2Fresources%2FServices-and-Equipment%2FSound%2FManufacturers%2FMicrophones%2Findex.html

Adrian / Andy - Any tips?

I have tried!
Quote Reply
Re: [Piers1] Can't use string ("1") as a HASH ref while "strict refs" in use at /.../.../GT/Template.pm line 866 In reply to
OK - found it. I think I must have downloaded an old copy of the Auth_Community plug in and then installed it over the top of the correct one (whilst trying everything to find the problem). I then managed to misconfigure the path to community which didn't help.
So ignore post above, and I'll move onwards and upwards.
Cheers,
Piers