perrybutler / WP-OAuth

A WordPress plugin that allows users to login or register by authenticating with an existing Google, Facebook, LinkedIn, Github, Reddit or Windows Live account via OAuth 2.0. Easily drops into new or existing sites, integrates with existing users.
GNU General Public License v2.0
97 stars 76 forks source link

fixed some undefined indexes and other errors setting up Google #18

Open haroldkyle opened 9 years ago

haroldkyle commented 9 years ago

These problems could exist in other login files, but I was just looking at Google. Don't want to start the session if it's already started. Other undefined indexes fixed.

perrybutler commented 9 years ago

Looks good, will finish reviewing and merge this weekend. I don't think there was a major concern with calling session_start() blindly or twice (other than an E_NOTICE error), but your fix appears to be a more standard pattern which couldn't hurt to implement. I'll also need to check if session_start() is actually being called twice and throwing an error somewhere, since I'm curious about that now.

Some refs:

http://stackoverflow.com/questions/2580322/is-there-any-harm-in-running-session-start-multiple-times-as-the-page-request

http://php.net/manual/en/function.session-status.php

haroldkyle commented 9 years ago

Yup, just trying to quiet my logs. Thanks!

Good point on checking whether this is called elsewhere in this plugin. I grepped my wp-content directory and didn't find many other possibilities, so it may well be this plugin trying to start the session multiple times.

jazbek commented 9 years ago

Would be great if you could merge this in and release it, lots of php notices are being thrown by this plugin when WP_DEBUG is on. This pull request fixes a big one that is on the main login form (wp-login.php).