k0a1a / hotglue2

HOTGLUE is a Content Manipulation System which allows to construct websites directly in a web-browser.
http://hotglue.me/demo
GNU General Public License v3.0
275 stars 38 forks source link

Notice: Only variables should be passed by reference #9

Closed dosch closed 7 years ago

dosch commented 7 years ago

Notice: Only variables should be passed by reference in /domains/domain.nl/DEFAULT/common.inc.php on line 499

I get this error running Hotglue on shared hosting at Greenhost. PHP is 7.0 .htaccess is used as is. user credentials set in user-config.inc.php I did chmod -R 0777 content in the directory where all files where uplaoded.

No other modifications made to the install.

in /?edit, when creating a new form or editing an existing one, there is a pop-up:

The glue gun manufacturer says: There was a problem communicating with the server (ready state 4, status 200)

Changes are saved when exiting the tool.

screen shot 2017-05-02 at 12 14 58 screen shot 2017-05-02 at 12 15 10

dereckson commented 7 years ago

This is an actual bug (tolerated in very old PHP versions) needing to be fixed in the code, and not related to your configuration.

dereckson commented 7 years ago

array_shift wants a variable to an array, not an array object returned by a method to work.

To fix this, we need to get rid of all these expressions:

$ ag array_shift
common.inc.php
499:            $s = str_replace('$PAGENAME$', array_shift(expl('.', $name)), $s);
500:            $s = str_replace('$pagename$', array_shift(expl('.', $name)), $s);
505:            $s = str_replace('$REV$', array_shift(array_slice(expl('.', $name), 1, 1)), $s);
506:            $s = str_replace('$rev$', array_shift(array_slice(expl('.', $name), 1, 1)), $s);

module_download.inc.php
155:    if (array_shift(elem_classes($elem)) != 'download') {
210:    $dest_dir = CONTENT_DIR.'/'.array_shift(expl('.', $obj['name'])).'/shared';
211:    $src_file = CONTENT_DIR.'/'.array_shift(expl('.', $args['origin'])).'/shared/'.$obj['download-file'];

module_image.inc.php
393:    $pn = array_shift(expl('.', $obj['name']));
529:    if (array_shift(elem_classes($elem)) != 'image') {
574:    $pn = array_shift(expl('.', $obj['name']));
641:    $dest_dir = CONTENT_DIR.'/'.array_shift(expl('.', $obj['name'])).'/shared';
642:    $src_dir = CONTENT_DIR.'/'.array_shift(expl('.', $args['origin'])).'/shared';

module_iframe.inc.php
163:    if (array_shift(elem_classes($elem)) != 'iframe') {

module_page.inc.php
49:             delete_upload(array('pagename'=>array_shift(expl('.', $args['page'])), 'file'=>$obj['page-background-file'], 'max_cnt'=>1));
74:             delete_upload(array('pagename'=>array_shift(expl('.', $page)), 'file'=>$obj['page-background-file'], 'max_cnt'=>1));
192:    $pn = array_shift(expl('.', $obj['name']));
255:                    delete_upload(array('pagename'=>array_shift(expl('.', $args['page'])), 'file'=>$obj['page-background-file'], 'max_cnt'=>1));

module_text.inc.php
421:    if (array_shift(elem_classes($elem)) != 'text') {

module_webvideo.inc.php
129:    if (array_shift(elem_classes($elem)) != 'webvideo') {

module_video.inc.php
82:             $pn = array_shift(expl('.', $obj['name']));
207:    if (array_shift(elem_classes($elem)) != 'video') {
237:            $pn = array_shift(expl('.', $obj['name']));
255:    $dest_dir = CONTENT_DIR.'/'.array_shift(expl('.', $obj['name'])).'/shared';
256:    $src_file = CONTENT_DIR.'/'.array_shift(expl('.', $args['origin'])).'/shared/'.$obj['video-file'];
dosch commented 7 years ago

so, apart from downgrading to php 5.4 there is not much I can do right now, is there?

dereckson commented 7 years ago

Yes, I can provide a fix. Let me write an unit test and I send a pull request.

k0a1a commented 7 years ago

Many thanks for catching this, admittedly I didn't yet migrate to PHP 7.0

dosch commented 7 years ago

Glad to be of help Danja. Thank you for merging so fast!

xuv commented 5 years ago

Apologies for reopening this discussion. But I run into a similar problem on a shared hosting server.

I get the message The glue gun manufacturer says: There was a problem communicating with the server (ready state 4, status 200)

I don't have access to server logs so I can't find out what PHP errors I might get.

Any clue what might go wrong?

dereckson commented 5 years ago

@xuv You're welcome to report issues.

The message you've got is a generic one, so you really need to get more information. It's most than probably something else.

So, that leads to a truism to reply to your last question: yes, I've a clue of something seriously wrong: the fact you don't have access to server logs.

Generally, to work in a comfortable environment, and be productive, you need to lit a light, instead to stay in the dark and so you really need to get an environment where you can have access to the server logs. Because in the lifecycle of application, a lot of configuration or code issues can occur and you need to know them.

xuv commented 5 years ago

@dereckson Thx for the response. I'm trying to help a fellow artist friend who wants to use a free space he gets with his ISP. Those things are not friendly for devs by default. But that's where he wants to have it running. I'll see what I can do. Thx for the help.

xuv commented 5 years ago

@dereckson As a temporary solution, I activated the DEBUG logging in Hotglue and got this:

2018-11-09 18:00:31 21319   debug   common: auth success (auth_method basic)
2018-11-09 18:00:31 21319   info    modules: running service "glue.save_state"
2018-11-09 18:00:36     21319   debug   lock: could not acquire lock in 5000ms
2018-11-09 18:00:36     21319   warn    json: service glue.save_state returned error "Could not acquire lock to "" in 5000ms"

Would this locking failure be related and how is that necessary?

k0a1a commented 5 years ago

hey, I'll look into this once back from my holiday next week,

thanks!