Solution Innovators Posted April 22 Posted April 22 I'm trying to upgrade a site from ProcessWire 3.0.229 to 3.0.246 so that I can upgrade the PHP version the site is running on from 7.4 to 8.3. PDO Statements such as the one below used to return the value of type as a string, now they return the value as an integer. This is a breaking change as we have many literal comparisons in the site. Is this a setting that can be changed? E.g. $query = $this->database->prepare("SELECT fundraiser, `type`, `order` FROM deliveries WHERE `driver` = :driver AND `type` != 2 AND `removed` != 1 AND `fundraiser` IS NOT NULL ORDER BY time ASC"); $query->bindValue(':driver', $params['driverId']); $query->execute(); $result = $query->fetchAll(\PDO::FETCH_ASSOC); $ids = []; foreach ($result as $item) { if ($item["type"] === "0") { $ids[] = $item["business"]; } elseif ($item["order"]) { $ids[] = $item["order"]; } } Also this selector return ID as a int and not a string. $selector = "template=Group, sort=title"; $groups = $this->pages->findRaw($selector, ['id','title']); foreach($groups as $group) { $groupsArray[] = [ 'id' => $group['id'], 'title' => $group['title'] ?? '', ]; } 1
Solution Innovators Posted April 22 Author Posted April 22 Answer: set this in site/config.php as PHP 7.4 doesn't support it and PHP 8.3 respects it and the default is false which will lead to different responses than what is expected. $config->dbOptions = [ \PDO::ATTR_STRINGIFY_FETCHES => true ]; 3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now