Symfony2 Payum Abstract Methods - php

I'm using payumbundle on my website but in my prod server (in dev server everything works fine) i get this error:
FatalErrorException: Compile Error: Can't inherit abstract function Payum\Request\StatusRequestInterface::getModel() (previously declared abstract in Payum\Request\ModelRequestInterface) in /path/to/folder/vendor/payum/payum/src/Payum/Request/BinaryMaskStatusRequest.php line 5
Here is the code at vendor/payum/payum/src/Payum/Request/BinaryMaskStatusRequest.php at line 5
class BinaryMaskStatusRequest extends BaseModelInteractiveRequest implements StatusRequestInterface {
in my development server i have PHP 5.3.10 while in prod server i have PHP 5.3.3.

Actually i commented Payum\Request\StatusRequestInterface::getModel() function, but i'm pretty sure that this isn't the right way to fix it
Nice catch! I will remove these methods (getModel and setModel) on StatusRequestInterface interface. They come from previous version and should not be there any longer. The bad thing is I can remove them only since version 0.6 as it introduce BC break.

Related

Travis cannot find 'PHPUnit_Framework_TestCase' – sometimes

I've just started using Travis CI to test my PHP code. Sometimes, builds fail with the message
PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /home/travis/build/ms609/citation-bot/tests/phpunit/expandFnsTest.php on line 13
On other occasions, without my having changed any relevant code, the builds succeed.
This makes me suspect that the issue is at Travis's end rather than my own.
This makes me wonder: is there anything that I can do to reduce the likelihood of my encountering this error? And on builds when the error arises, is it possible to have Travis re-attempt the build without making a new commit?
I had inherited a testcase written using an older version of phpunit. For backwards compatibility, following advice elsewhere, I had added the code
if (!class_exists('\PHPUnit\Framework\TestCase') &&
class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', 'PHPUnit\Framework\TestCase');
}
What I needed to do next was replace
class myTest extends PHPUnit_Framework_TestCase {
with
class myTest extends PHPUnit\Framework\TestCase {
With regards to the second part of the question, signing in to Travis CI reveals a "restart build" option on the build page.

CakePHP 1.3 Shell can't find AppModel class

I'm migrating a CakePHP 1.3 app from an old server to a new one, the website works fine but the Shells fail with the following error:
PHP Fatal error: Class 'AppModel' not found
And the error points to the declaration of a model that extends from the AppModel class. It also somewhat strangely prints the contents of the AppModel class to stdout. Full stack trace below.
PHP Fatal error: Class 'AppModel' not found in /home/andyburchill/src/site/app/models/account.php on line 3
PHP Stack trace:
PHP 1. {main}() /home/andyburchill/src/site/cake/console/cake.php:0
PHP 2. ShellDispatcher->ShellDispatcher() /home/andyburchill/src/site/cake/console/cake.php:665
PHP 3. ShellDispatcher->dispatch() /home/andyburchill/src/site/cake/console/cake.php:139
PHP 4. Shell->initialize() /home/andyburchill/src/site/cake/console/cake.php:337
PHP 5. Shell->_loadModels() /home/andyburchill/src/site/cake/console/libs/shell.php:180
PHP 6. ClassRegistry->init() /home/andyburchill/src/site/cake/console/libs/shell.php:257
PHP 7. App->import() /home/andyburchill/src/site/cake/libs/class_registry.php:143
PHP 8. App->__find() /home/andyburchill/src/site/cake/libs/configure.php:962
PHP 9. App->__load() /home/andyburchill/src/site/cake/libs/configure.php:1043
PHP 10. require() /home/andyburchill/src/site/cake/libs/configure.php:1067
I'm running the shell from the root directory with the following command:
./cake/console/cake queue
The most notable difference between the servers is the PHP version, the shells are working on PHP 5.4.9 and are not working on PHP 5.5.9.
I have been googling this for a couple of days, usually people seem to get this error after upgrading to CakePHP 2.x and the fixes don't work for CakePHP 1.3.
I'm beginning to think the only solution is going to be upgrading to 2.x, but this is not a trivial task.
Is there something I can do in the mean time to get this working?, can anyone suggest troubleshooting tips?.
Ok I feel a bit silly now.
I had tried Raphael's suggestion of requiring the class file previously but I decided to try again and noticed that the AppModel class file started with a short open tag instead of <?php.
After changing it the shells now work.

Symfony2 Can't inherit abstract function Validator\ValidatorInterface::validate() (previously declared abstract in \Validator\ValidatorInterface)

If I use the symfony console command generate:doctrine:crud with --write parameter I get an auto-generated controller working only in the indexAction route, but not in the others (newAction, deleteAction, updateAction). I think the problem is in the form creation.
The resulting error is the following one:
Compile Error: Can't inherit abstract function
Symfony\Component\Validator\ValidatorInterface::validate() (previously
declared abstract in
Symfony\Component\Validator\Validator\ValidatorInterface)
Server Error - FatalErrorException500 Internal in vendor/symfony/symfony/src/Symfony/Component/Validator/Validator/RecursiveValidator.php at line 31
I don't know, how to solve this problem.
This error is the error message you get when running the new validator component in PHP 5.3.8 or older. You need to use at least PHP 5.3.9 to use recent versions of Symfony
The only way to solve this problem is to change ValidatorInterface or to run almost PHP 5.6

PHPUnit does not work with IntelliJ Idea 13.1.3

I get the following exception while using Idea 13.1.3 with PHPUnit 4.5.0. In some other threads I have seen it was a bug but I this seems to be a problem with latest version also.
Testing started at 17:06 ...
Fatal error: Class IDE_PHPUnit_Framework_TestListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest) in /private/var/folders/yc/cc0z8db95hx4l_d0fvtrx2yxsjjh3x/T/ide-phpunit.php on line 504
Call Stack:
0.0014 854704 1. {main}() /private/var/folders/yc/cc0z8db95hx4l_d0fvtrx2yxsjjh3x/T/ide-phpunit.php:0
Variables in local scope (#1):
$PHPUnitVersionId = *uninitialized*
Process finished with exit code 255
Found from IntelliJ forum that IntelliJ 13 is only compatible with PHPUnit 3.x.
However instead of downgrading, I managed to patch the framework itself for now in this way.
go to /plugins/php/lib
make a backup of php.jar
Use whatever tool you have to open the file, usually zip or other compress tools or under ubuntu the file roller.
Go to scripts/phpunit.php
Modify it, searching for the "IDE_PHPUnit_Framework_TestListener" class and adding there the following line:
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception
$e, $time) {}
save the file and update the php.jar

zend framework 2 fatal error after add module

I install ZF2 on my localhost and then I test the public page and it is work.
I tried to download a module MwopGuestbook and then zend show me an error:
Fatal error: Interface 'Zend\Module\Consumer\AutoloaderProvider' not
found in D:\xampp\htdocs\zend\module\MwopGuestbook\Module.php on line 8
How can we solve this problem?
Looks like outdated code there, I'm guessing that's an early incarnation of the Zend\ModuleManager\Feature\* implementations
If it is, you can try changing the first 7 lines in MwopGuestbook/Module.php to the following...
<?php
namespace MwopGuestbook;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
class Module implements AutoloaderProviderInterface
{
It should solve the complaints about not finding the interface, no guarantees there aren't other parts of that code using outdated calls though :-/

Categories