Compare commits

..

No commits in common. "cb3382f6d2713ff9d4fe4cf4498ee312f2efa63e" and "7e1da9a5cab3bc4489e9c92eabcad3826d228188" have entirely different histories.

3 changed files with 3 additions and 27 deletions

View file

@ -59,10 +59,6 @@ It means that composer will look at `master` branch of repository configured und
## Changelog ## Changelog
### 2024-09-21
- Added wrapper for PDOException to avoid creating dynamic property `queryString`.
### 2024-07-24 ### 2024-07-24
- Csrf vulnerabity fix back ported from Cake PHP 3 - Csrf vulnerabity fix back ported from Cake PHP 3

View file

@ -17,7 +17,6 @@
*/ */
App::uses('DataSource', 'Model/Datasource'); App::uses('DataSource', 'Model/Datasource');
App::uses('PDOExceptionWithQueryString', 'Model/Datasource');
App::uses('CakeText', 'Utility'); App::uses('CakeText', 'Utility');
App::uses('View', 'View'); App::uses('View', 'View');
@ -513,13 +512,12 @@ class DboSource extends DataSource {
} }
return $query; return $query;
} catch (PDOException $e) { } catch (PDOException $e) {
$wrapperException = new PDOExceptionWithQueryString($e);
if (isset($query->queryString)) { if (isset($query->queryString)) {
$wrapperException->queryString = $query->queryString; $e->queryString = $query->queryString;
} else { } else {
$wrapperException->queryString = $sql; $e->queryString = $sql;
} }
throw $wrapperException; throw $e;
} }
} }

View file

@ -1,18 +0,0 @@
<?php
class PDOExceptionWithQueryString extends PDOException {
public string $queryString = "";
/**
* Wrapper for PDOException to avoid creating dynamic property.
*
* @param PDOException $e Source exception.
*/
public function __construct(PDOException $e) {
parent::__construct($e->getMessage(), 0, $e->getPrevious());
$this->errorInfo = $e->errorInfo;
$this->code = $e->code;
}
}