Closed digitalbricks closed 4 years ago
Hi, the master branch is currently incomplete / not working properly. We have tried to implement a new database class to address the database via PDO, but failed, e.g. there are issues we are ciurrently not able to solve.
I cannot answer your main questions, please check if the issues appear also with the release (!) version of WBCE 1.4.0 and/or the development branch. I have marked the development branch as the new default branch since this branch is working well (and does not use PDO).
Your bonus question: In the master branch, there is a new subdirectory in which you find the database related classes.
If you have a solution to the other problems with PDO (unwanted slashes in some modules, installation failure on PHP 7.4/MySQL8) we would be happy about any contributions.
BR -Florian
Hello Florian,
thank you for your reply!
If the release version you have linked is identically with the version available on the WBCE-Website, then the issue is present there (i am currently using this).
I assume this issue only arises if an existing website is moved from one host to another and the new hosts database server is using another default charset. Beside that, i think it will not happen on a clean install because the installer communicates with the mysql server using the servers default charset (because the database class does not set a correct value due to the missing DB_CHARSET
value).
So the main problem is, that the DB_CHARSET
constant isn't available inside the connect()
method of the class while all other database relatet constants such as DB_HOST
etc. ARE availabe – making it impossible to adapt the charset to the individual needs. Thats odd and and I've currently no idea what's causing this. 🤔
Yes, the release version is that one which is linked on wbce.org. Hm, strange. I hope some of the developers can answer your question and solve the issue. I don't think the current behaviour is intended.
Found a simple solution: The "trick" is to define the constant DB_CHARSET
BEFORE the line require_once(dirname(__FILE__).'/framework/initialize.php');
in config.php
– in the best case in the block defining all other database relevant constants.
I am pretty sure the definition also worked at the end of the file in 1.3.x but I may be wrong. Anyway, this solves such charset issues without hacking the core and is a good enough solution for the problem.
I think this constant should be documented in the help section of the WBCE site, because charset problems seems to be an not uncommon issue with WB/WBCE sites.
You may remove the BUG label, because it appears to be an user error.
Thank you very much!
Yes, you're correct, André. It needs to be before the inclusion of the initialize.php. And/but it was never other way around (technically impossible).
I double checked that and: Your are right (of course)! On the other sites I defined the charset also above the initialization. So thank you both very much for helping people help themselves! :-)
Yes, I found it very enlightening how this issue resolved all by itself, by the original author. :-)
Using WBCE 1.4.0 (with PHP 7.2) i am wondering where the constant
DB_CHARSET
is set initially. As the result ofclass.database.php
using a empty string as fallback ifDB_CHARSET
isn't set (see here) special chars are not displayed correctly sometimes when moving a site from one server to another (I assume, depending on the default connection charset of the single MySQL server).I change this linie to ...
... wich fixed the issue in my case but may not work in any case as the connection charset my vary.
Oddly enough: In previous versions of WBCE i was able to define that constant in the
config.php
to match my needs. But now, echo-ingDB_CHARSET
inclass.database.php
(inside theconnect()
-method) throws an undefined-constant-warning. And so the fallback with the empty strings jumps in place (in the unmodified version).So my questions basically are:
DB_CHARSET
definded "by design" in WBCE?DB_CHARSET
undefined inside the class?Bonus question:
framework/class.database.php
gone in the master branch of this repository?Many thanks in advance!