Git Product home page Git Product logo

e_pdostatement's People

Contributors

colshrapnel avatar noahheck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

e_pdostatement's Issues

Request aborted...

Hi,

I've an issue with the last release. When I try to execute it, my page crash (aborted on firebug).
It seems to be on the regex : $testParam = "/({$marker}(?!\w))(?=(?:[^\"']|["'][^\"']["'])$)/";

When i replaced it by the old one ($testParam = "/" . $marker . "(?!\w)/";), it's ok

Apache/2.4.18 (Win32) PHP/5.6.19

Incompatible return type of `EPDOStatement\EPDOStatement::bindParam`

Hi,

I'm facing the following issue when using EPDOStatement:

During inheritance of PDOStatement: Uncaught Whoops\Exception\ErrorException: Return type of EPDOStatement\EPDOStatement::bindParam($param, &$value, $datatype = PDO::PARAM_STR, $length = 0, $driverOptions = false) should either be compatible with PDOStatement::bindParam(string|int $param, mixed &$var, int $type = PDO::PARAM_STR, int $maxLength = 0, mixed $driverOptions = null): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/myuser/Documents/Projects/myapp/vendor/noahheck/e_pdostatement/src/EPDOStatement.php:80
Stack trace:
#0 /Users/myuser/Documents/Projects/myapp/vendor/noahheck/e_pdostatement/src/EPDOStatement.php(25): Whoops\Run->handleError(8192, 'Return type of ...', '/Users/myuser/...', 80)
#1 /Users/myuser/Documents/Projects/myapp/vendor/composer/ClassLoader.php(571): include('/Users/myuser/...')
#2 /Users/myuser/Documents/Projects/myapp/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/Users/myuser/...')
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass('EPDOStatement\\E...')
#4 /Users/myuser/Documents/Projects/myapp/src/php/Database/DBConnection.php(21): PDO->setAttribute(13, Array)
[...]

I'm using Whoops for catching exceptions while in "debug" mode on my site.

I'm using PHP 8.1.11 and the version 2.3.1 of the package via composer.

Here is the content of the DBConnection class:

namespace App\Database;

use App\Utils\Config;
use PDO;

class DBConnection {

    /**
     * @var PDO
     */
    private static $pdo;

  public static function getPDO(): PDO {
    if (!isset(self::$pdo)) {
      $dsn = "mysql:host=" . $_ENV['DB_HOST'] . ";dbname=" . $_ENV['DB_NAME'];
      $user = $_ENV['DB_USER'];
      $passwd = $_ENV['DB_PASSWORD'];
      self::$pdo = new PDO($dsn, $user, $passwd);
      if (Config::isDebugEnabled()) {
        self::$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array("EPDOStatement\EPDOStatement", [self::$pdo]));
      }
    }
    return self::$pdo;
  }
}

What could be the issue?
Thank you in advance for your support.

Debugging

I notice there is $this->debug( in the functions. Can you please update the readme/wiki on how to use this functionality.

Reuse parameter and InterpolateQuery

Hi,

If I run this query : "INSERT INTO myTable (id,Mycolumn) VALUES (:myId, :myColumn) ON DUPLICATE UPDATE Mycolumn = :myColumn)"

and params are : array(myColumn => "Toto", myId => 125)

If I want to see the query by using interpolateQuery , I've only the first parameter which is replaced :
"
INSERT INTO myTable (id,Mycolumn) VALUES (125, "Toto) ON DUPLICATE UPDATE Mycolumn ="")
"

But the query is well executed...

Is there a way to show the full query if a parameter is used more than one time ?

same extension for mysqli

Hello,
have you an idea how to implement this Statement Addon for the MySQLi in PHP? I use MySQLi and need this functionality to echo the full sql querystring.

Please help. Thanks

Dave

Replacement content with backreference syntax getting stripped from fullQuery

i.e. password_hash function may produce something like this:

$2y$10$Xs/oqD0cVCb7hM1suoAD/Oqf4tlm5suTb8IsczDTnttiWUtHsb5ay

but the full query value ends up like this:

y$Xs/oqD0cVCb7hM1suoAD/Oqf4tlm5suTb8IsczDTnttiWUtHsb5ay
$2y$10$Xs/oqD0cVCb7hM1suoAD/Oqf4tlm5suTb8IsczDTnttiWUtHsb5ay
  y   $Xs/oqD0cVCb7hM1suoAD/Oqf4tlm5suTb8IsczDTnttiWUtHsb5ay

More problematic would be the presence of a $0 backreference in the replacement value (potentially re-adding the placeholder to the content string)

Wrong preg_replace results

Query (with param test_id = 3):

SELECT * FROM test_items WHERE test_id = :test_id

Result in fullQuery:

SELECT * FROM test_items WHERE '3' = :test_id

fix for that (just colon added):

$testParam  = "/:" . $key . "(?!\w)/";

Result after fix:

SELECT * FROM test_items WHERE test_id= '3' 

Seems to work fine for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.