Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including
Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
The best answers are voted up and rise to the top
6 years, 10 months ago
I'm trying to re-compile using
php bin/magento setup:di:compile
But when I run this command, I get:
Fatal error: Cannot use 'Void' as class name as it is reserved in /var/www/html/magento/vendor/magento/module-sales/Controller/Adminhtml/Order/Invoice/Void.php on line 9
I am running PHP 7.1.0-alpha.
2,004 1 1 gold badge 17 17 silver badges 42 42 bronze badges
Aug 1, 2016 at 19:25
G. Alex G. Alex
93 1 1 silver badge 4 4 bronze badges
I don't think Magento 2 is yet compatible with php 7.1-alpha, but this is an alarm signal.
I think you should report this on github.
It could be an issue in the near future,
Aug 1, 2016 at 19:37
Marius ♦ Marius
197k 51 51 gold badges 413 413 silver badges 825 825 bronze badges
Here is how to fix it:
vendor/magento/module-sales/etc/webapi.xml line 112:
- <route url="/V1/invoices/:id/void" method="POST">
+ <route url="/V1/invoices/:id/voidInvoice" method="POST">
vendor/magento/module-sales/Block/Adminhtml/Order/Invoice/View.php line 242:
- return $this->getUrl('sales/*/void', ['invoice_id' => $this->getInvoice()->getId()]);
+ return $this->getUrl('sales/*/voidInvoice', ['invoice_id' => $this->getInvoice()->getId()]);
vendor/magento/module-sales/Block/Adminhtml/Order/Creditmemo/View.php line 183:
- return $this->getUrl('sales/*/void', ['creditmemo_id' => $this->getCreditmemo()->getId()]);
+ return $this->getUrl('sales/*/voidCreditmemo', ['creditmemo_id' => $this->getCreditmemo()->getId()]);
vendor/magento/module-sales/Controller/Adminhtml/Order/Invoice/Void.php line 9:
- class Void extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\View
+ class VoidInvoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\View
vendor/magento/module-sales/Controller/Adminhtml/Order/Creditmemo/Void.php line 10:
- class Void extends \Magento\Backend\App\Action
+ class VoidCreditmemo extends \Magento\Backend\App\Action
Jan 25, 2017 at 13:15
Instead of modifying the core magento vendor files to resolve the issue it would make more sense to use the right php version. Depending on what you are using, it should be easy enough to set a BASH configuration for a particular php bin location.
Dec 17, 2018 at 20:47
575 5 5 silver badges 16 16 bronze badges
This is no longer an issue for Magento 2.2 - Magento 2.1 was not PHP7.1 compatible.
Apr 16, 2018 at 12:07
13.7k 18 18 gold badges 79 79 silver badges 161 161 bronze badges
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our
Accept all cookies
Necessary cookies only