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

Opening orders view in backend throws SQL error #31

Closed
wahidnory opened this issue May 25, 2020 · 3 comments
Closed

Opening orders view in backend throws SQL error #31

wahidnory opened this issue May 25, 2020 · 3 comments

Comments

@wahidnory
Copy link

wahidnory commented May 25, 2020

Hello,

After updating to version 1.23.2, our magento 2.3.4 installation started throwing an SQL error in the backend on the orders screen.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'O18' in 'where clause', query was: select method, group_concat(distinct(buckaroo_magento2_group_transaction.servicecode) SEPARATOR "-") as giftcard_codes, increment_id from sales_order_payment inner join sales_order on sales_order.entity_id = sales_order_payment.parent_id inner join buckaroo_magento2_group_transaction on buckaroo_magento2_group_transaction.order_id=sales_order.increment_id where sales_order.increment_id in (O18-0053366, ... omitted ) group by sales_order.increment_id

After investigating some more I found out that there was an update to this file.
view/adminhtml/ui_component/sales_order_grid.xml
(removing the file loads the grid correctly).

And this file
Ui/Component/Listing/Column/Method/Filter.php
does something with:

/**
     * Get options
     *
     * @return array
     */
    public function toOptionArray()
    {
        parent::toOptionArray();

        $db = $this->resourceConnection->getConnection();

        $result = $db->query('
            select 
            method, 
            group_concat(distinct(buckaroo_magento2_giftcard.servicecode) SEPARATOR "-") as giftcard_codes,
            group_concat(distinct(buckaroo_magento2_giftcard.label) SEPARATOR "-") as giftcard_titles 
            from sales_order_payment 
            inner join sales_order on sales_order.entity_id = sales_order_payment.parent_id 
            inner join buckaroo_magento2_group_transaction on buckaroo_magento2_group_transaction.order_id=sales_order.increment_id 
            inner join buckaroo_magento2_giftcard on buckaroo_magento2_giftcard.servicecode=buckaroo_magento2_group_transaction.servicecode 
            group by buckaroo_magento2_group_transaction.order_id
        ');
...

Which kinda looks as to where the SQL error is coming from.

Hope this is enough information to help you debug/reproduce the issue.

Thank you in advance.

@vladislav-padalka-hys
Copy link
Contributor

vladislav-padalka-hys commented May 25, 2020

Hi @wahidnory !

We've verified - PHP file you've provided is not related to the issue (at least because there is no WHERE statement)
We are unable to reproduce the issue you reported at our stagings.
But we suppose it's because your installation is non standard and using custom prefixes for order increments and this makes them non numeric.
Thanks for reporting and we'll adjust our code for your case soon.

@vladislav-padalka-hys
Copy link
Contributor

@wahidnory we've found that SQL and made where statement more generic
It has been committed into the master branch (ed96349)
Fix will be included into next release or, in case of urgency, you can use updated file from master branch.
Thank you !

@wahidnory
Copy link
Author

Thank you for your fast fix, this indeed fixes the issue.

CyberSecutor added a commit to CyberSecutor/Magento2 that referenced this issue Dec 3, 2020
When setting a samesite cookie behind an SSL offloading loadbalancer the secure flag does not get set automatically.
This raises an exception causing a 502 denial of service.

```
"0":"Cookie must be secure in order to use the SameSite None directive.","1":"buckaroo-it#1 BuckarooMagento2ModelPluginFixSession->beforeSetPublicCookie() called at [vendor/magento/framework/Interception/Interceptor.php:121]
buckaroo-it#2 MagentoFrameworkStdlibCookiePhpCookieManagerInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
buckaroo-it#3 MagentoFrameworkStdlibCookiePhpCookieManagerInterceptor->___callPlugins() called at [generated/code/Magento/Framework/Stdlib/Cookie/PhpCookieManager/Interceptor.php:23]
buckaroo-it#4 MagentoFrameworkStdlibCookiePhpCookieManagerInterceptor->setPublicCookie() called at [vendor/magento/framework/Session/SessionManager.php:247]
buckaroo-it#5 MagentoFrameworkSessionSessionManager->renewCookie() called at [vendor/magento/framework/Session/SessionManager.php:212]
buckaroo-it#6 MagentoFrameworkSessionSessionManager->start() called at [vendor/magento/framework/Interception/Interceptor.php:58]
buckaroo-it#7 MagentoFrameworkSessionGenericInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
buckaroo-it#8 MagentoFrameworkSessionGenericInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
buckaroo-it#9 MagentoFrameworkSessionGenericInterceptor->___callPlugins() called at [generated/code/Magento/Framework/Session/Generic/Interceptor.php:23]
buckaroo-it#10 MagentoFrameworkSessionGenericInterceptor->start() called at [vendor/magento/framework/Session/SessionManager.php:141]
buckaroo-it#11 MagentoFrameworkSessionSessionManager->__construct() called at [generated/code/Magento/Framework/Session/Generic/Interceptor.php:14]
buckaroo-it#12 MagentoFrameworkSessionGenericInterceptor->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]
buckaroo-it#13 MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:108]
buckaroo-it#14 MagentoFrameworkObjectManagerFactoryCompiled->create() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
buckaroo-it#15 MagentoFrameworkObjectManagerFactoryCompiled->get() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
buckaroo-it#16 MagentoFrameworkObjectManagerFactoryCompiled->create() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
buckaroo-it#17 MagentoFrameworkObjectManagerFactoryCompiled->get() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
buckaroo-it#18 MagentoFrameworkObjectManagerFactoryCompiled->create() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
buckaroo-it#19 MagentoFrameworkObjectManagerFactoryCompiled->get() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
buckaroo-it#20 MagentoFrameworkObjectManagerFactoryCompiled->create() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
buckaroo-it#21 MagentoFrameworkObjectManagerFactoryCompiled->get() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:125]
buckaroo-it#22 MagentoFrameworkObjectManagerFactoryCompiled->parseArray() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:86]
buckaroo-it#23 MagentoFrameworkObjectManagerFactoryCompiled->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]
buckaroo-it#24 MagentoFrameworkObjectManagerObjectManager->get() called at [vendor/magento/framework/App/FrontController.php:86]
buckaroo-it#25 MagentoFrameworkAppFrontController->__construct() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:14]
buckaroo-it#26 MagentoFrameworkAppFrontControllerInterceptor->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]
buckaroo-it#27 MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:108]
buckaroo-it#28 MagentoFrameworkObjectManagerFactoryCompiled->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]
buckaroo-it#29 MagentoFrameworkObjectManagerObjectManager->get() called at [vendor/magento/framework/App/Http.php:115]
buckaroo-it#30 MagentoFrameworkAppHttp->launch() called at [vendor/magento/framework/App/Bootstrap.php:263]
buckaroo-it#31 MagentoFrameworkAppBootstrap->run() called at [pub/index.php:40]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants