DByte icon indicating copy to clipboard operation
DByte copied to clipboard

Fatal error: Access to undeclared static property: DB::$c

Open banna360 opened this issue 6 years ago • 2 comments

I am using https://github.com/Xeoncross/DByte this PDO wrapper in my code This site was working fine until last day, Now i can a see an error message in the site which is following.

Fatal error: Access to undeclared static property: DB::$c in 
/home/NAME/public_html/TEST/inc/config.php on line 16

My code with line 16 is

require('DB.php');

$pdo = new PDO(
'mysql:dbname=DBNAME;host=localhost',
'DBUSER',
'MYPASSWORD',
 array(
    PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
 )
 );
 DB::$c = $pdo;
 ?>

What will be the issue in line DB::$c = $pdo; i am with this from the after noon.

banna360 avatar Sep 13 '17 18:09 banna360

@banna360 Try this one:

https://github.com/flik/X

flik avatar Mar 21 '18 03:03 flik

@banna360, sorry for the delay, I didn't see your issue. What version of PHP are you using?

$ php -v
> PHP 7.1.7

The following works for me

<?php
require('DByte/DB.php');
$pdo = new PDO('sqlite::memory:');
\DByte\DB::$c = $pdo;

My only guess is that line 17 needs to be changed to mention public or private:

public static $q,$c,$p,$i = '`';

xeoncross avatar Mar 21 '18 14:03 xeoncross