Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile icons show logged in user for all users (Trac #1989) #1989

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 30 comments
Closed

Profile icons show logged in user for all users (Trac #1989) #1989

elgg-gitbot opened this issue Feb 16, 2013 · 30 comments
Labels
Milestone

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/1989 on 40207075-12-29 by trac user hayaza, assigned to unknown.

Elgg version: 1.7

Using fresh install of elgg 1.7.

Created 2 users, admin and hayaza, uploaded profile icons.

After login with both accounts. Login using user:admin, open hayaza's profile, profile icon shows admin's photo. Logged-out, login using user:hayaza, admin's icon shows hayaza's photo.

@elgg-gitbot
Copy link
Author

Attachment added by trac user hayaza on 40207079-12-04: elggdiagnostic.txt

@elgg-gitbot
Copy link
Author

trac user hayaza wrote on 40207086-04-05

I am using shared hosting, standard Linux Apache MySQL & PHP. Everything looks okay.

But I am using local windows hosts file to translate webserver IP to domain name. Its because I dont want to open the website to public. So only me can open the domain.

Can it be the problem ?

@elgg-gitbot
Copy link
Author

brettp wrote on 40207111-05-01

I can't duplicate this bug on my local copy of 1.7.

Hayaza - When you are experiencing an incorrect icon, could you force a hard-refresh (shift + reload) of the page to see if the issue resolves? If it doesn't resolve, could you run http://yourhost.com/upgrade.php?

@elgg-gitbot
Copy link
Author

trac user hayaza wrote on 40207150-07-12

Brett

I have force hard refresh.

Can you try it on my live elgg install ? You can see the bug there, I'll give you the detail below.

etc hosts file : 219.83.122.172 jammaah.net

user: hayaza password: telo123
user: admin password : telo123

@elgg-gitbot
Copy link
Author

trac user hayaza wrote on 40207156-05-10

from the dashboard you can see that the two members (hayaza & admin) have the same profile icon. It should be different. I have uploaded two different icon for 2 members.

THe same error shows if I tried to open http://jammaah.net/mod/profile/icondirect.php?lastcache=1268749363&username=hayaza&size=large it still shows admin's icon.

@elgg-gitbot
Copy link
Author

cash wrote on 40207165-05-22

There have been at least 3 reports of this on the community site. I think this is caused by running PHP as a CGI process.

While Elgg does not officially support CGI, there are a fair number of hosting providers who only provide PHP as a CGI process. I'm inclined to take a look at this. It will probably take less time to fix this than deal with all the people reporting this issue in the community site.

@elgg-gitbot
Copy link
Author

Milestone changed to Elgg 1.7.1 by cash on 40207165-05-22

@elgg-gitbot
Copy link
Author

brettp wrote on 40207179-08-25

That was my first thought, but I tested this running PHP as CGI under nginx. Haven't tried running CGI under Apache, though.

It looks to be a problem with icondirect.php calling icon.php when the size is tiny. If you call icon.php with the username and size it works fine. Also, if you call icondirect.php with any size other than tiny it works.

I think it might be related to the page_owner_entity() call at the top of icon.php. If that's returning the currently logged in user it would cause this problem...

@elgg-gitbot
Copy link
Author

trac user hayaza wrote on 40207184-07-12

Brett

Not only when the size is tiny, also other size. I tried yesterday, giving me the problem with large, medium icon.

@elgg-gitbot
Copy link
Author

trac user hayaza wrote on 40207188-01-29

If that's returning the currently logged in user it would cause this problem...

Yup, I think currently logged in user would cause this problem, because if I switched to another user, that user icon will replace other members icon.

@elgg-gitbot
Copy link
Author

brettp wrote on 40207195-03-29

hayaza - You're correct about the size. The behavior is erratic...possibly due to caching on my side.

@elgg-gitbot
Copy link
Author

Attachment added by trac user alysami on 40208998-09-15: elggdiagnostic.rar

@elgg-gitbot
Copy link
Author

trac user alysami wrote on 40209007-09-05

i attached the report if it could help, please notice that i did upgrade from 1.5 to 1.7 on a godaddy shared hosting, i have another problem that i cant edit wedgets on any profile .. i dont know if it is a related problem or a standalone.

@elgg-gitbot
Copy link
Author

cash wrote on 40209450-05-03

alysami - could you upload the file without the rar compression? You could either rename the original diagnostic file as something like bonah_diagnostic.txt or use a more common compression program. Thanks.

brett - I setup FastCGI with Apache2 and could not reproduce. hayaza is using CGI with Apache1. I'm still working under the assumption this is a server related issue because I cannot reproduce.

@elgg-gitbot
Copy link
Author

Title changed from Profile icon changed to Profile icons show logged in user for all users by cash on 40209450-05-03

@elgg-gitbot
Copy link
Author

Attachment added by trac user alysami on 40209675-09-03: bonah_diagnostic.zip

@elgg-gitbot
Copy link
Author

trac user alysami wrote on 40209690-04-13

i create an admin account for you if you want to checkout the admin area.
[http://www.bonah.org/social/]
username:cash
pass:cashcash

please change the pass once you logged in

@elgg-gitbot
Copy link
Author

brettp wrote on 40209695-08-09

Cash Good catch with Apache 1. Both of these servers are running with PHP in CGI mode on Apache 1 servers, so I'd agree it seems to be a problem with Apache 1 servers and CGI mode.

@elgg-gitbot
Copy link
Author

cash wrote on 40209735-09-11

Some more information from alysami's site:

I get my own icon if I hit:

  • mod/profile/icondirect.php?username=samy

I get the correct icon if I hit:

  • mod/profile/icon.php?username=samy

The username in icondirect.php is retrieved using $username = $_GET['username'];. I bet that this is returning nothing and then later when set_input is used, it clears out username so that icon.php has nothing to pick up. I don't think there is any reason to call set_input for either size or username in icondirect. In fact, we should just wrap the entire thing in a if(FALSE) and include icon.php until the caching is fixed. No reason to even open the db connection with the current state of the code.

@elgg-gitbot
Copy link
Author

Attachment added by trac user alysami on 40209909-02-27: start.php

@elgg-gitbot
Copy link
Author

trac user alysami wrote on 40209914-06-14

I changed this

if ($filehandler->exists()) {
                    //$url = $CONFIG->url . "pg/icon/$username/$size/$icontime.jpg";
                    return $CONFIG->wwwroot . 'mod/profile/__icondirect.php__?lastcache='.$icontime.'&username='.$entity->username.'&size='.$size;

to this

if ($filehandler->exists()) {
                    //$url = $CONFIG->url . "pg/icon/$username/$size/$icontime.jpg";
                    return $CONFIG->wwwroot . 'mod/profile/__icon.php__?lastcache='.$icontime.'&username='.$entity->username.'&size='.$size;

of course it didn't solve the problem but it make the icons show correct on my production site :)) , thanx cash for the hint

@elgg-gitbot
Copy link
Author

trac user twola wrote on 40215823-07-18

I have the same issue.

You can look at my site at: http://phpfixes.com (which is ironic as I need a fix myself)

Any how here is the info:

http://phpfixes.com/phpinfo.php

@elgg-gitbot
Copy link
Author

cash wrote on 40215842-12-09

Try commenting out the 2 set_input() calls at the bottom of mod/profile/icondirect.php and let us know if that fixes the problem.

@elgg-gitbot
Copy link
Author

trac user twola wrote on 40215850-10-06

That did it. Will that limit some other functionality?

Thanks

@elgg-gitbot
Copy link
Author

cash wrote on 40215873-03-25

No, you'll have the same functionality as everyone else with Elgg 1.7. The underlying data directory structured changed in Elgg 1.7 and that has turned off profile icon caching until the caching code can be rewritten.

Could you do one more thing for me since I cannot reproduce this on my servers?

On line 49 - just after the mysql_connect call add this line: error_log('mysql connect succeeded');

On line 103 at the end of the if statement for the mysql_connect, add an else clause - something like

} else {
    error_log('mysql connect failed');
}

and then let me know which is printed to your server's error log when the problem occurs.

@elgg-gitbot
Copy link
Author

trac user hayaza wrote on 40217106-08-04

Cash So is it because of PHP runs in CGI ? Or else ? I've moved my site to different hosting that runs php as apache module and the icon problem doesnt happen.

If I move back to previous hosting with PHP runs as CGI and then commenting set_input() calls will it fix the issue ?

Thanks

@elgg-gitbot
Copy link
Author

trac user alysami wrote on 40217920-06-25

hayaza
try to replace the start.php file in /mod/profile/ root with the one i attached, it worked for me.

@elgg-gitbot
Copy link
Author

diraol wrote on 40224993-08-18

I had the same problem (fresh install) and the Hack proposed by alysami wordked for me.
I've also tried the cash suggestion and it worked also:
"Try commenting out the 2 set_input() calls at the bottom of mod/profile/icondirect.php and let us know if that fixes the problem. "

@elgg-gitbot
Copy link
Author

trac user tobiasweise wrote on 40246093-09-02

Replying to diraol:

I had the same problem (fresh install) and the Hack proposed by alysami wordked for me.
I've also tried the cash suggestion and it worked also:
"Try commenting out the 2 set_input() calls at the bottom of mod/profile/icondirect.php and let us know if that fixes the problem. "

I had the same issue at our site. Commenting out the two set_input() worked just fine. Big thanks to the community

@elgg-gitbot
Copy link
Author

cash wrote on 40250552-08-28

(In [svn:5567]) Fixes #1989 and refs #2035 - profile icondirect should work for those using CGI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant