• Resolved marinamix76

    (@marinamix76)


    I’m in difficult using this plugin because the “WP_DB_Connect” use the function “eval()” for evaluate the content of “wp-config.php” as a string . My “wp-config.php” contains a conditional switch. In this “switch” there is the definition of the constants. Using function “eval()” returns to me an unespected database connection!
    There is a particular motivation of using “eval()” function?
    Do you have any contraindications to change the “__construct” of WP_DB_Connect in this manner?:

    function __construct($type=1,$filePath=’./wp-config.php’){

    require( $filePath );//new line

    $this->filePath=$filePath;
    $this->getFile();
    //$this->serverBasedCondition();

    /**
    * eval the WP contants into PHP
    */
    /*foreach ($this->paramA as $p) {
    $this->evalParam(‘define(\”.$p.’\”,’\’);’);
    }*/

    $this->createConstant(‘$table_prefix=\”,”‘;”);

    switch ($type) {
    default:
    case 1:
    $this->conMySQL_Connect();
    break;
    case 2:
    $this->conPDO();
    break;
    case 3:
    $this->conMySQLi();
    break;
    }
    }

    Thanks,
    Marina.

    https://www.ads-software.com/plugins/cta/

  • The topic ‘Why eval() wp-config?’ is closed to new replies.