[OzzModz] Country Registration Ban

[OzzModz] Country Registration Ban 2.2.0 Beta 1

No permission to download
@Ozzy47

Recent intermittent error since upgrade to Xenforo 2.2.5 and PHP 8.0.6:

Code:
ErrorException: [E_WARNING] Cannot modify header information - headers already sent by (output started at /home/{owner}/public_html/src/addons/Snog/CountryBan/CloudFlare/CloudflareMiddleware.php:77) job.php:55

Generated by: Unknown account May 17, 2021 at 1:02 AM

Stack trace

#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] Can...', '/home/{owner}...', 55)
#1 job.php(55): header('Content-Type: a...')
#2 {main}

Request state

array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(75) "https://{domain}.com/threads/welcome-message-and-forum-rules.45024/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
I have not had any problems with this add-on whatsoever. Using XF 2.2.5 and php 7.4.18.

I wonder if it is a php 8.x specific error?
 
It's been 10 days since I posted that error and there's been no recurrence of the errors (on three different forums).

One thing that's changed on all three servers is I re-enabled PHP-FPM (still under PHP8) and increased the number of workers via WHM. That may have been what it was about. Not sure. There have also been a couple of cPanel updates in the interim too.

But in any case, the issue seems to be resolved.
 
Last edited:
More errors recently:

Code:
Server error log

    ErrorException: [E_WARNING] Cannot modify header information - headers already sent by (output started at /home/localsearchforum/public_html/src/addons/Snog/CountryBan/CloudFlare/CloudflareMiddleware.php:77) job.php:55

    Generated by: Unknown account Jun 17, 2021 at 1:01 AM

Stack trace

#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] Can...', '/home/{account}...', 55)
#1 job.php(55): header('Content-Type: a...')
#2 {main}

Request state

array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(89) "https://{domain.com}/threads/optimizing-images-for-gmb-things-have-changed.55957/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
I've tried installing this on a couple of my sites and get the following error each time.

Code:
ErrorException: [E_WARNING] file_put_contents(C:\root\Forums\MyForums\data/countryban/cloudflare_cookie.txt): failed to open stream: No such file or directory in src\vendor\guzzlehttp\guzzle\src\Cookie\FileCookieJar.php at line 59
XF::handlePhpError()
file_put_contents() in src\vendor\guzzlehttp\guzzle\src\Cookie\FileCookieJar.php at line 59
GuzzleHttp\Cookie\FileCookieJar->save() in src\vendor\guzzlehttp\guzzle\src\Cookie\FileCookieJar.php at line 39
GuzzleHttp\Cookie\FileCookieJar->__destruct() in src\addons\Snog\CountryBan\Setup.php at line 79
Snog\CountryBan\Setup->checkRequirements() in src\XF\AddOn\AddOn.php at line 444
XF\AddOn\AddOn->checkRequirements() in src\XF\Admin\Controller\AddOn.php at line 772
XF\Admin\Controller\AddOn->getAddOnWarningsAndErrors() in src\XF\Admin\Controller\AddOn.php at line 366
XF\Admin\Controller\AddOn->actionInstall() in src\XF\Mvc\Dispatcher.php at line 321
XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 244
XF\Mvc\Dispatcher->dispatchFromMatch() in src\XF\Mvc\Dispatcher.php at line 100
XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 50
XF\Mvc\Dispatcher->run() in src\XF\App.php at line 2178
XF\App->run() in src\XF.php at line 390
XF::runApp() in admin.php at line 13

me too

ErrorException: [E_WARNING] file_put_contents(/home/canbbs/public_html/data/countryban/cloudflare_cookie.txt): failed to open stream: No such file or directory in src/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php at line 59
  1. XF::handlePhpError()
  2. file_put_contents() in src/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php at line 59
  3. GuzzleHttp\Cookie\FileCookieJar->save() in src/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php at line 39
  4. GuzzleHttp\Cookie\FileCookieJar->__destruct()
  5. call_user_func_array() in src/XF/Entity/Option.php at line 206
  6. XF\Entity\Option->verifyOptionValue() in src/XF/Mvc/Entity/Entity.php at line 787
  7. XF\Mvc\Entity\Entity->_verifyValueCustom() in src/XF/Mvc/Entity/Entity.php at line 632
  8. XF\Mvc\Entity\Entity->set() in src/XF/Mvc/Entity/Entity.php at line 567
  9. XF\Mvc\Entity\Entity->__set() in src/XF/Repository/Option.php at line 114
  10. XF\Repository\Option->updateOptions() in src/XF/Admin/Controller/Option.php at line 82
  11. XF\Admin\Controller\Option->actionUpdate() in src/XF/Mvc/Dispatcher.php at line 350
  12. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
  13. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
  14. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
  15. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2344
  16. XF\App->run() in src/XF.php at line 512
  17. XF::runApp() in admin.php at line 13
 
Is there a log of blocked registrations to see it working? Something like this? I block the IPs in CSF too.

2021-09-14_18-50-38.jpg
 
Ozzy47 updated [OzzModz] Country Registration Ban with a new update entry:

[OzzModz] Country Registration Ban for XenForo 2.2+ Update 2.2.0

danger GIF
Warning Sign GIF


Changelog:

This is a beta release and contains breaking changes that was tested in a limited environment.
Take a backup before installing on a production site.

  • Minimal XF version changed to 2.2, PHP 7.2
  • General code refactor
  • Now uses composer to load...

Read the rest of this update entry...
 
@Ozzie47: I'm just getting around to reporting this but it's been happening for several months now. Every so often (e.g., after 3 days since the last error, or 5 or 7 days, or a few weeks....), I'm getting this error:

Code:
[E_WARNING] Cannot modify header information - headers already sent by (output started at /home/localsearchforum/public_html/src/addons/Snog/CountryBan/CloudFlare/CloudflareMiddleware.php:77)

The site itself is not using cloudflare.
 
@Ozzy47 @Snog

This is still a problem more than one forum:

Code:
headers already sent by (output started at /home/{domain}/public_html/src/addons/Snog/CountryBan/CloudFlare/CloudflareMiddleware.php:77)

Other OzzySnog addons using Cloudflare that yield the same warning or Errors:

[OzzModz] Country Registration Ban
[OzzModz] OS Browser Display
[Snog] Country Flags by IP Address

Please note:
  • this has been going for several months so it's not congestion
  • it doesn't matter whether or not I'm running something in another tab or window
  • I'm not certain but it doesn't seem to happen every time but rather intermittently at a relatively high rate.
  • I look after several Xenforo forums, most of which have one or more of these 4 addons. Those forums display the error periodically despite having different customization and different addons so it seems unlikely that it is an addon conflicy.
Running
  • PHP 9.0.13
  • Xenforo 2.2.9
  • Mod_security not enabled
 
Last edited:
Upgraded to the latest version last night and now getting what appears to be intermittent errors:
  • Error: Template public:PAGE_CONTAINER error: Class 'GeoIp2\Database\Reader' not found
Has anyone else come across this?
 
Top Bottom