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

[Bug] Saving Patrol Craft CP page with authorised IP array #21

Closed
roberttolton opened this issue Jan 11, 2017 · 5 comments
Closed

[Bug] Saving Patrol Craft CP page with authorised IP array #21

roberttolton opened this issue Jan 11, 2017 · 5 comments

Comments

@roberttolton
Copy link

Hi, just saw this today pop up today.

Saving the Patrol configuration page in the Craft CP, when there is an array of authorised IP addresses set in general.php causes an error:

trim() expects parameter 1 to be string, array given

/vagrant/craft/plugins/patrol/services/PatrolService.php(253)

241         return $this->dynamicParams;
242     }
243 
244     /**
245      * Parses authorizedIps to ensure they are valid even when created from a string
246      *
247      * @param array|string $ips
248      *
249      * @return array
250      */
251     public function parseAuthorizedIps($ips)
252     {
253         $ips = trim($ips);
254 
255         if (is_string($ips) && ! empty($ips))
256         {
257             $ips = explode(PHP_EOL, $ips);
258         }
259 
260         return $this->filterOutArrayValues(
261             $ips,
262             function ($val)
263             {
264                 return preg_match('/^[0-9\.\*]{5,15}$/i', $val);
265             }
@selvinortiz
Copy link
Owner

@roberttolyon Is this on the latest release of Patrol? I remember coming across an issue like this one but can't remember if it was this particular one or something else.

@selvinortiz
Copy link
Owner

@roberttolton ^

@roberttolton
Copy link
Author

@selvinortiz This is the latest Patrol, just updated to it today.

@selvinortiz
Copy link
Owner

@roberttolton Ok, I'll try to get a fix out later today or tomorrow.

selvinortiz added a commit that referenced this issue Jan 12, 2017
- Adds login  (`/{cpTrigger}/login`) redirect when using `limitCpAccessTo` ( Issue #19 ) 
- Fixes issue #21 where `authorizedIps` was not handled correctly in some cases
@selvinortiz
Copy link
Owner

@roberttolton This should be fixed now via the newly cut release 1.4.2. Let me know if you continue to have issues!

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

No branches or pull requests

2 participants