How I fixed non working counters on Vanilla 3.3
I had with a freshly installed vanilla 3.3 version the problem, that the counters for new discussions and comments would not work, especially in nested context there was always zero for the counts that lay on deeper levels. Everything else seemed to work fine.
Since vanilla is new to me, I first suspected that I had set up something wrong, trying around with different cascades of nested discussions, moving discussions, trying different themes. Deleting test postings, deleting test users.
I also had deleted the entire cache folder when I had problems of getting the German localisation active. I was running php 7.3
I decided to start over with a clean new install. That also brought no success for my counter problem.
Then I suspected that the problem might have been caused by using a so called easy-install-app installation, provided by my web hoster 1blu.
This preconfigures some things, especially the connection to the mysql data base.
I started over all by myself now. Creating the data base and the connection by myself, installing vanilla 3.3 by running the setup.
Again the counters for subcategories didn't work in the out of the box installation.
This time I monitored the raw data in the mysql category table and saw that the counters stayed zero there. The problem was not wrong display from the data base, but not-icreasing the counts in the very beginning when creating new discussions.
This brought me on the track of older discussions about not working counters in the section of vanilla 2.8 and earlier.
The problem seemed to be that in some parts of the code that updates the category counts, a specific data type was expected but the mysql driver gave back something else. Expecting data type numeric and getting integer, or vice versa.
There were hints where to fix that in the core files by adding a type casting in the category module, but the code had changed a lot on the way to vanilla 3.3 and I already saw type castings in many lines.
I decided against modifying the code. Instead I tried to find the root cause.
Obviously the PDO sql driver, that interfaces PHP with the mysql data base, was the real cause for getting the wrong data type back.
Running php.info showed a couple of available and the active PDO driver.
The recommended mysqlnd (the native driver) was not active and not on the list of the available drivers.
Since I have a hosted account where I don't have full access to all server setup, I contacted my web hoster how to get the mysql native driver.
They told me to use the servers native long time supported PHP 7.2 that would provide the mysqlnd.
Modifying php.conf to
Running info.php showed that now the PDO driver mysqlnd was active.
From that moment on all counters worked like they should.
My problem is solved now, I just wanted to share this for people who might encounter the same problem. Don't waste too much time, try PDO driver mysqlnd.
I suspect that this kind of data type sql driver problem could cause more trouble in other plugins.