AppController must extend AppController from a plugin

@dakote: I think you put me on the right track, and I found the problem: a circular reference.

The ‘main’ AppController in an application is derived from Cake\Controller\Controller; if we write out the definition using full namespaces it reads like this:

/* src/Controller/AppController.php */
class App\Controller\AppController extends Cake\Controller\Controller
{
}

A freshly generated plugin looks like this:

/* plugins/src/Logos/Controller/AppController.php */
namespace Logos\Controller;

use App\Controller\AppController as BaseController;

class AppController extends BaseController
{
}

So the plugin AppController is derived from your main AppController [*]:

class Logos\Controller\AppController extends App\Controller\AppController [extends Cake\Controller\Controller]

Clearly, we need a different route. I created a Logos/src/Controller/BaseController.php and derived it from Cake\Controller, just as a ‘regular’ AppController.

/* plugins/Logos/src/Controller/BaseController.php */
namespace Logos\Controller;

use Cake\Controller\Controller;

class BaseController extends Controller
{
  protected $user_language = 'nl';

  public function beforeFilter (\Cake\Event\Event $e)
  {
    $this->set ('lang_id', $this->user_language);
  }
}

Then in my main AppController:

/* src/Controller/AppController.php */
class AppController extends \Logos\Controller\BaseController
{
  public function beforeFilter (\Cake\Event\Event $e)
  {
    parent::beforeFilter ($e);
  }
}

…and the lang_id variable is set!

[*] One could doubt the wisdom of having plugins derive their AppController from the main one; there could be all kinds of name conflicts or overloaded functions that affect your plugin, while IMO a plugin should be independent and unaffected by whatever application it is included in.