JS errors on upgrade to G2.3 ( Plugins page blank )

floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-12-03 04:41
Quote:
Has the architecture of G2.3 and its JavaScript changed completely since version G2.2.6?

yes, it has. JavaScript files are no longer served one by one, delaying page loads dramatically, they're now combined and served as a single large JavaScript file.

If you are having issues with getting JS errors when access the plugins section. Verify by testing if your combined combined Javascript works properly:
View the source of your page, you will see something similar to:
<script type="text/javascript" src="http://XXXXXXXX/main.php?g2_view=core.CombinedJavascript&amp;g2_key=7d3657687c5594c0d77454dd61444271"></script>
copy the url and paste to your browser, change the '&amp;' to '&'. If you get some JavaScript file you are fine.
If you get gibberish then it's something outside of our control, basically, it's a server-misconfiguration.
There are other things in g2 that might not work correctly on such a server.

Try one of these steps after asking your host to attempt to remedy the server issue:

  • changing config in php.ini :
    enable: zlib.output_compression
  • If you don't have access to change the php.ini file on your server:
    you can override the default setting for the zlib.output_compression by adding the following in the .htaccess file in your root Gallery directory:
    php_flag zlib.output_compression off
  • Edit modules/core/classes/GalleryTemplateAdapter.class line 520
    change
    if ($phpVm->function_exists('gzencode')) {
    to
    if (false && $phpVm->function_exists('gzencode')) {
  • Edit gallery2/config.php line ~28:
    @ini_set('display_errors', 0);
    to:

    @ini_set('display_errors', 0);
    @ini_set('zlib.output_compression', 0);

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
aba1051

Joined: 2008-12-07
Posts: 3
Posted: Sun, 2008-12-07 22:36

I had same problem - when I try to move photos to another album, I had no chance to choose destination because it is managed by JS. And same situation was with plugins management in administration menu. It seems that JS file is send compressed by the server.

I tried to turn off zlib.output_compression in php.ini and now it works.

Maybe there is some relationship with check during upgrade of Gallery - this check thinks that zlib compression is off although it is turned on by phpinfo().

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2009-01-02 23:02

@floridave:
I haven't monitored this issue in the forums. is it usually related to zlib.output_compression?
if so, it's probably worth detecting if it's enabled and not ensure that g2 doesn't add gzip compression on top of that.
(the problem being, to my understanding, that you can't turn zlib.output_compression off at runtime in your script. once the script's execution started, you can only deal with it being enabled.)

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2009-01-03 22:24

@valiant:
I believe it is. Would be nice to have some uses get back to us if they are using one of the above methods to fix the issue. I think that some get the host to fix the issue and never get back to us. Perhaps a modification to turn it off in the code would help, but you are the better one to answer that.
too bad that there is so many different hosts with different configs to keep track.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
trins321
trins321's picture

Joined: 2009-01-13
Posts: 7
Posted: Tue, 2009-01-13 18:09

Hi Floridave.
I have the same trubles getting the plugin action urls to work..
The problem is that i dont know how to set up my php.ini to work with the 2.3 version. I had zero problems when I was runnig 2.2.4 version of gallery embed in joomla 1.5 .. I did the above test but not sure of results..

Quote:
If you get some JavaScript file you are fine.
If you get gibberish then it's something outside of our control, basically, it's a server-misconfiguration.

What does gibberish mean? I just got a blank page..

Help hot to fix plugins page would really be appriciated.

Gallery URL = http://www.xxx.com/marketplace/main.php
Gallery version = 2.3 core 1.3.0
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.4 apache2handler
Webserver = Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.4
Database = mysql 5.0.45-community-nt, lock.system=database
Toolkits = Exif, Thumbnail, Gd, LinkItemToolkit, Dcraw, NetPBM, ImageMagick, Ffmpeg, SquareThumb
Acceleration = none/900, none/1800
Operating system = Windows NT DATA 5.2 build 3790
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; sl; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 (.NET CLR 3.5.30729)
Rows in GalleryAccessMap table = 167
Rows in GalleryAccessSubscriberMap table = 146
Rows in GalleryUser table = 1077
Rows in GalleryItem table = 71
Rows in GalleryAlbumItem table = 30
Rows in GalleryCacheMap table = 0

My php.ini

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2009-01-13 19:47

Real url would help.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
trins321
trins321's picture

Joined: 2009-01-13
Posts: 7
Posted: Wed, 2009-01-14 23:14

Hi. Well i just wanted to say that this solution described above didnt worked for me.. Are there any other ideas that might help to fix this plugins issue? Anyone?

 
trins321
trins321's picture

Joined: 2009-01-13
Posts: 7
Posted: Thu, 2009-01-15 01:44

Just wanted to let you know that my problem wasnt related to php.ini setings, but I was missing the files in gallery2/lib/yui folder. Download atachment from this post or gallery 2 developer package and upload files to above folder.. and here you go..problem fixed

Have to say I just love this gallery project! Keep up the good work guys!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2009-01-15 03:37

Then this FAQ would help others that are missing files:
FAQ: How can I make sure that my installation files are all intact?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
davidarnoult

Joined: 2008-03-18
Posts: 39
Posted: Tue, 2009-01-20 10:28

Hi

I have exactly same problem on all g2 pages.

Thanks for the info but solutions described above did not work for me, I have all yui files and changing php.ini do not change anything (. I have my own server so I can tune anything.
I tried also to deactivate all modules one by one without any result.

Here is my error, even on main page:
YAHOO.util.CustomEvent is not a constructor
http://www.arnoult.com/gallery2/main.php?g2_view=core.CombinedJavascript&g2_key=83edbcf35785c9f34ed44b772b4c4095
Line 13

URL : http://www.arnoult.com/gallery2/main.php

This is driving me mad...

Any clue?

Thanks

URL de Gallery = http://www.arnoult.com/gallery2/main.php
Gallery version = 2.3 noyau 1.3.0
API = Noyau 7.54, Module 3.9, Thème 2.6, Intégré 1.5
PHP version = 5.2.0-8+etch13 apache2handler
Serveur Web = Apache/2.2.3 (Debian) DAV/2 PHP/5.2.0-8+etch13
Base de données = mysql 5.0.32-Debian_7etch8-log, lock.system=flock
Boîtes à outils = NetPBM, Exif, ImageMagick, Ffmpeg, Gd, jpegtran, Thumbnail, SquareThumb
Accélération = none/21600, none/21600
Système d'exploitation = Linux petitbeurre 2.6.18-6-686 #1 SMP Fri Dec 12 16:48:28 UTC 2008 i686
Thème par défaut = matrix
gettext = activé

 
davidarnoult

Joined: 2008-03-18
Posts: 39
Posted: Tue, 2009-01-20 16:14

When deactivating exif module in components admin, problem just disappears! Seems that something has to do with it...
If anyone can find out why, I will be grateful...Because I need this module.

Thanks

 
moron

Joined: 2006-11-10
Posts: 5
Posted: Mon, 2009-02-02 08:40

I finally fixed it by breaking that function you mentioned in the OP. i just changed "gzencode" to a nonexistant function "gzncode" and it works.

none of these solutions fixed the problem

Disabled zlib compression
replaced the code with the one in the OP
stopped and started apache 100 times

its still outputted gibberish. I dont know why this is happening i guess the file is getting gzip'd twice even with zlib and output buffering disabled. /shrug

 
carefreetrip

Joined: 2008-03-24
Posts: 36
Posted: Thu, 2009-02-19 05:04

I have the errors as described above. I change my php.ini to zlib.output_compression = On and I changed the GalleryTemplateAdapter.class file as described above and it didn't work. I have all of the files in the "yui" folder and I have enabled and disabled all of my plugins with no luck.

Any ideas? I would appreciate any help you could provide.

I still get the following errors -

Error: YAHOO.util.CustomEvent is not a constructor
Source File: http://www.carefreetrip.com/gallery/?g2_view=core.CombinedJavascript&g2_key=a2b95a80ecc18ae93880a9f7238a6c31
Line: 47

Gallery URL = http://www.carefreetrip.com/gallery/
Gallery version = 2.3 core 1.3.0
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.8 apache2handler
Webserver = Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8b mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.8
Database = mysqlt 5.0.67-community, lock.system=flock
Toolkits = ArchiveUpload, Exif, ImageMagick, LinkItemToolkit, SquareThumb, Thumbnail, Gd
Acceleration = full/21600, full/21600
Operating system = Linux vps1103.henriemedia.com 2.6.18-028stab059.6 #1 SMP Fri Nov 14 14:01:22 MSK 2008 i686
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
Rows in GalleryAccessMap table = 99
Rows in GalleryAccessSubscriberMap table = 1440
Rows in GalleryUser table = 2
Rows in GalleryItem table = 1431
Rows in GalleryAlbumItem table = 84
Rows in GalleryCacheMap table = 848

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2009-02-19 21:31
Quote:
I still get the following errors -

Error: YAHOO.util.CustomEvent is not a constructor
Source File: http://www.carefreetrip.com/gallery/?g2_view=core.CombinedJavascript&g2_key=a2b95a80ecc18ae93880a9f7238a6c31
Line: 47

Gallery URL = http://www.carefreetrip.com/gallery/

I surfed your gallery for a few clicks and did not see any JS errors. Perhaps it was a cache issue.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
carefreetrip

Joined: 2008-03-24
Posts: 36
Posted: Thu, 2009-02-19 21:46

I cleared all my browser cache, I cleared all of the Gallery cache and I rebooted. I open my Gallery with IE and Firefox and both show errors - see the attachments.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2009-02-19 21:59

I don't think this is related to server side JS compression. Please start a new thread.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
carefreetrip

Joined: 2008-03-24
Posts: 36
Posted: Fri, 2009-02-20 16:12

It appears to be an issue with the Matrix theme version 1.1.6. I uninstalled the theme and then reinstalled the Matrix theme version 1.1.4 and the error goes away. Thanks again!

 
davidarnoult

Joined: 2008-03-18
Posts: 39
Posted: Fri, 2009-02-20 16:33

Hi,

Just for info I solved my problem too by reinstalling EXIF module from 2.3, I forgot that I did a little hack for ISO code strings when upgrading.

Then I added my hack on the new file, and it worked!
David

 
aart

Joined: 2009-03-25
Posts: 1
Posted: Wed, 2009-03-25 16:57

There was a comment earlier about wanting feedback from users as to what helped...

I found the link to check the CombinedJavascript file, and it was garbled. My hosting service has zlib.output_compression enabled by default. It might be helpful to include the literal statement for the php.ini file in the original post, for those who need it:
zlib.output_compression = On

Since I know my hosting service also has PHP running on IIS (Windows) servers, using the .htaccess solution wouldn't work, so I made the suggested edit to the modules/core/classes/GalleryTemplateAdapter.class file. After refreshing the Gallery2 cache, it worked.

So, unless my case is strange (which I don't think it is), there may need to be a change made to the Gallery2 code to test for this issue. This was not an issue for me prior to version 2.3.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2009-03-26 00:03
Quote:
there may need to be a change made to the Gallery2 code to test for this issue.

Yes I agree, but development has stopped on G2.3 to work on G3. Only critical security issues will be addressed.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
southa

Joined: 2009-06-08
Posts: 1
Posted: Mon, 2009-06-08 11:42

I managed to cause similar symptoms by turning off file caching in modules/core/classes/GalleryDataCache.class, by editing the file like this:

Line 53: $cache['fileCacheEnabled'] = 0;

The telltale here is that the CombinedJavascript output is empty - zero bytes. Easily solved by not doing this. However it might get turned off temporarily by other means:

upgrade/index.php: GalleryDataCache::setFileCachingEnabled(false);
install/steps/DatabaseSetupStep.class: GalleryDataCache::setFileCachingEnabled(false);
install/steps/InstallCoreModuleStep.class: GalleryDataCache::setFileCachingEnabled(false);
install/steps/InstallOtherModulesStep.class: GalleryDataCache::setFileCachingEnabled(false);
lib/tools/phpunit/GalleryTestCase.class: GalleryDataCache::setFileCachingEnabled(false);
lib/tools/phpunit/GalleryTestCase.class: GalleryDataCache::setFileCachingEnabled(true);

 
jrevillini

Joined: 2008-06-18
Posts: 20
Posted: Tue, 2009-07-14 20:17

Thanks for posting the solutions, floridave. The hack to the GalleryAdapterTemplate.class is the only thing that worked for me. Let me also remind users that it's important to clear both the remote file cache and the browser cache each time you try one of these methods. I.E. go to http://server/pathtog2/lib/support/index.php?cache, clean the cache, then do whatever you need to do to clear your browsers cache. In the case that you're changing php.ini settings, you must also restart the web server (not reboot, just restart the web service/process so it reloads the php config).

I have to say, this is REALLY LAME! i'd consider this a critical bug as the upgrade causes your whole plugins area to break, and probably a bunch of other things too ... the plugins page is the most noticeable because the buttons are actually missing when javascript bombs.

I wish I had enough expertise to commit a patch.

 
luke76

Joined: 2009-12-28
Posts: 1
Posted: Mon, 2009-12-28 15:01

I had a similar problem.. I'm using gallery 2.3.1 and my plugin page (among others) didn't work as expected: the html code had all the management links on the right column, but all were disabled (display:none). I looked around and found that they should be enabled by the JS code, so I went looking there and I found (as you suggested) some gibberish content instead of the expected JS text code.

In other words I was receiving a compressed stream for my "all-in-one" JS file, but my browser didn't decompress it on the fly and so it had nothing good to execute and all the links were remaining hidden. And yes, my host has zlib.output_compression enabled but I cannot disable for the whole site (other parts are needing it) nor I was able to disable it through htaccess.

I tried this approach: I forced my browser (Firefox) not to accept compressed pages (about:config, then changed "network.http.accept-encoding" to "" instead of "gzip,deflate"). In such a way, after cleaning the cache, all started working.

Then I managed to change CombinedJavascript.inc (around row 61), in this way (my change is in bold):

Quote:
if (false && strpos(GalleryUtilities::getServerVar('HTTP_ACCEPT_ENCODING'), 'gzip') !== false) {
$cacheData =& GalleryDataCache::getFromDisk(
...

So I avoid compressing only the "combined" JS, but I don't disable the caching engine in order to keep the whole thing responsive :)

I've spent several hours figuring it out, hope this helps someone out there :D

PS: I can't wait for Gallery3 to be ready ;)

 
Peufeu

Joined: 2007-10-15
Posts: 17
Posted: Sun, 2010-01-10 18:27

This should be in the known issues, I just lost several hours on this.

PS : 250 kB of CSS + HTML for a gallery page, lol !

 
MalastiC

Joined: 2007-03-21
Posts: 34
Posted: Tue, 2010-01-12 12:53

I have the same problem. Any solution?

My Webs: http://www.topiberian.com & https://www.solutein.com

 
sammiefields2512

Joined: 2010-03-23
Posts: 1
Posted: Tue, 2010-03-23 20:22

I had same problem - when I try to move photos to another album, I had no chance to choose destination because it is managed by JS. And same situation was with plugins management in administration menu. It seems that JS file is send compressed by the server.

I tried to turn off zlib.output_compression in php.ini and now it works.

Maybe there is some relationship with check during upgrade of Gallery - this check thinks that zlib compression is off although it is turned on by phpinfo().

spam link removed

 
fansi

Joined: 2010-10-11
Posts: 1
Posted: Mon, 2010-10-11 08:37

i had the same problem,now is ok.