Fixed 404 error

Status
Not open for further replies.
Version
3.12.2
Website URL
https://omgpx.com
PHP version
5.6.38
Database driver
MySQL
Database version
5.6.34
Web browser
Any

Che

Network license
License owner
Joined
Mar 15, 2018
Messages
45
Likes
2
Points
58
Location
Europe
#1
I'm not pretty sure that it's bug of the script coz my admins changed 404 settings of the server yesterday, but it looks like bug ...
Rodolfo, just let you know that I have no chv_ prefix in my database (as I can see script try to access database with prefix), actually I don't use any prefix.

🎯Description of the issue

404 error

▶🚶‍Reproduction steps
  1. Open any 404 page, for example site.com/404

😢Unexpected result

Error text on the screen

📃Error log message

Fatal error [42S02]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'omgpx.chv_redirects' doesn't exist
Triggered in /lib/G/classes/class.db.php at line 180

Stack trace:
#0 /lib/G/classes/class.db.php(180): PDOStatement->execute()
#1 /lib/G/classes/class.db.php(205): G\DB->exec()
#2 /app/lib/classes/class.redirect.php(30): G\DB->fetchSingle()
#3 /app/lib/classes/class.redirect.php(35): CHV\Redirect::get('/404')
#4 /app/lib/classes/class.redirect.php(57): CHV\Redirect::getUrl('/404')
#5 /app/loader.php(810): CHV\Redirect::handle('/404')
#6 /lib/G/classes/class.handler.php(137): CHV\{closure}(G\Handler)
#7 /app/loader.php(818): G\Handler->__construct(Array)
#8 /index.php(20): include_once('/app/loader.php')
 

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
240
Likes
32
Points
78
#2
i guess that error is because you are missing the table and i think it uses chv_ automaticly. Since when i installed chevereto it assigned chv_ automaticly.
 

Che

Network license
License owner
Joined
Mar 15, 2018
Messages
45
Likes
2
Points
58
Location
Europe
#3
I did check it in first. Table is "redirects" without any prefix and it is empty coz it is a new install of the script.
Also I checked two of my old sites (without prefix too) and the same error. Early it shown "page doesn't exist" or something like this.
 

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
240
Likes
32
Points
78
#4
Okay then try this, open settings.php from app folder look for following line "$settings['db_table_prefix'] = 'chv_';" if it says chv_ remove that and save file so it is
$settings['db_table_prefix'] = ''; like this. Empty between the ' ' part. Hopefully that should fix the error.
 

Che

Network license
License owner
Joined
Mar 15, 2018
Messages
45
Likes
2
Points
58
Location
Europe
#5
Thanks, but I have no prefix and never use it in my live, I always clean the prefix field during install of any scripts ;)
$settings['db_table_prefix'] = ''; in the file, no prefix in the database etc. And it is because I think that is the bug.
 

mmybaka

Network license
License owner
Joined
Oct 27, 2015
Messages
38
Likes
8
Points
58
#6
I also have this error in change the language.

Fatal error [42S02]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'img.chv_redirects' doesn't exist
Triggered in /lib/G/classes/class.db.php at line 180
 

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
240
Likes
32
Points
78
#7
Thanks, but I have no prefix and never use it in my live, I always clean the prefix field during install of any scripts ;)
$settings['db_table_prefix'] = ''; in the file, no prefix in the database etc. And it is because I think that is the bug.
ok then it probably is a bug, rason why i asked you to check is to make sure that script did not accidentaly ignore that setting when you run installer. But it seems it did not, so then a code is faulty some where that still asks for chv_ perifix.
 

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
240
Likes
32
Points
78
#8
I also have this error in change the language.

Fatal error [42S02]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'img.chv_redirects' doesn't exist
Triggered in /lib/G/classes/class.db.php at line 180
for you please do same check, if you also removed chv_ underinstallation then it needs a fix.
 

Che

Network license
License owner
Joined
Mar 15, 2018
Messages
45
Likes
2
Points
58
Location
Europe
#9
So, we need some magic from Rodolfo ;)
 

tomsit

Moderator & Chevereto freak
Staff member
Joined
Nov 25, 2016
Messages
423
Likes
226
Points
125
Location
Norway
Website
freeimage.host
#10

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
240
Likes
32
Points
78
#11

Rodolfo

Chevereto Guru-Guru
Staff member
Joined
Oct 7, 2008
Messages
16,160
Likes
4,189
Points
237
Location
Chevereto HQ
Website
rodolfoberrios.com
#12
My fault, I used chv_ in the redirect class for the DB prefix.

Change this:
app\lib\classes\class.redirect.php:
$db->query('SELECT * FROM chv_redirects WHERE redirect_from=:from;');
To this:
app\lib\classes\class.redirect.php:
$db->query('SELECT * FROM ' . DB::getTable('redirects') . ' WHERE redirect_from=:from;');
 
Status
Not open for further replies.