Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with PHP 7.3 / MySQL 8 #208

Closed
Lumeriol opened this issue Oct 3, 2018 · 1 comment
Closed

Compatibility with PHP 7.3 / MySQL 8 #208

Lumeriol opened this issue Oct 3, 2018 · 1 comment

Comments

@Lumeriol
Copy link

@Lumeriol Lumeriol commented Oct 3, 2018

Version: 3.x-dev

Bug Description

Problem is with joining tables in selection. With PHP <= 7.2.10 is everything okay, 7.3 version throw exception Nette\Database\DriverException #42S22. Both code runs on MySQL 8 with same configuration.
Simple queries to single table (without "dot-joining") is okay.

Steps To Reproduce

This code for example:

return $this->db->table($this->repository)
            ->where([
                'product.is_random_offer = ?' => 1,
                'product.is_active = ?'       => 1,
                'is_primary = ?'              => 1
            ])
            ->order('RAND()')
            ->limit($count)
            ->fetchAll();

Generated query on PHP 7.2

SELECT `product_product_category`.`id`, `product_product_category`.`product_id`,
`product_product_category`.`product_category_id` 
FROM `product_product_category` 
LEFT JOIN `product` ON `product_product_category`.`product_id` = `product`.`id` 
WHERE (`product`.`is_random_offer` = 1) AND (`product`.`is_active` = 1) AND (`is_primary` = 1) 
ORDER BY RAND() 
LIMIT 5

Generated problematic query on PHP 7.3

SELECT * 
FROM `product_product_category` 
WHERE (`product`.`is_random_offer` = ?) AND (`product`.`is_active` = ?) AND (`is_primary` = ?) 
ORDER BY RAND() 
LIMIT 5

Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product.is_random_offer' in 'where clause'.
Problematic files:
File: ...\nette\database\src\Database\DriverException.php:27
$e = new static($src->message, 0, $src);

File: ...\database\src\Database\Drivers\MySqlDriver.php:66
return Nette\Database\DriverException::from($e);

etc. in Tracy call stack.

Expected Behavior

I know, that PHP 7.3 is still under development, but now in RC2 version, and compatibility with Nette 3 is not complete, so when it is up to date, you can fix it to be same/similar behavior as in 7.2.

@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Oct 18, 2018

It is caused by incompatibility between PCRE and PCRE 2 used in PHP 7.3… https://bugs.exim.org/show_bug.cgi?id=2332

@dg dg closed this in 7ee0c6d Oct 18, 2018
dg added a commit that referenced this issue Oct 18, 2018
I have absolutely no idea how I fixed it, but it works 🤪
dg added a commit that referenced this issue Oct 18, 2018
dg added a commit that referenced this issue Oct 18, 2018
dg added a commit that referenced this issue Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.