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

[BUG]: PHPUnit Mock / Mockery Mock : SIGSEGV #16080

Closed
kevcomparadise opened this issue Sep 1, 2022 · 5 comments · Fixed by #16085
Closed

[BUG]: PHPUnit Mock / Mockery Mock : SIGSEGV #16080

kevcomparadise opened this issue Sep 1, 2022 · 5 comments · Fixed by #16085
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report external dependency This issue depends on external issue to be resolved.

Comments

@kevcomparadise
Copy link

Describe the bug
PHPUnit throw sigfault error when we try mock Model

Error
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

We tried with Mockery & PHPUnit

To Reproduce

Steps to reproduce the behavior:

Create Empty model like

use Phalcon\Mvc\Model;

class TestModel extends Model
{

}

Create unit test and try to create mock of this model

class AffiliateCampaignForbiddenMiddlewareTest extends TestCase 
{
        public function testA() 
        {
              $mockBuilder = $this->getMockBuilder(TestModel::class);
              $mockBuilder->getMock();
        }
}

Expected behavior
In Phalcon 3.4 its work

Details

  • Phalcon version: 5.0.0RC4
  • PHP Version: 8.1.6
  • Operating System: Debian
  • Installation type: PECL
  • Server: Apache
  • Xdebug : v3.1.2

Thanks

@kevcomparadise kevcomparadise added bug A bug report status: unverified Unverified labels Sep 1, 2022
@Jeckerson Jeckerson self-assigned this Sep 2, 2022
@Jeckerson
Copy link
Member

Jeckerson commented Sep 2, 2022

Tried with PHP7.4 got this error:

Fatal error: Cannot use 'null' as class name as it is reserved in /srv/vendor/phpunit/phpunit/src/Framework/MockObject/MockClass.php(51) : eval()'d code on line 9

Investigating with 8.1...

@Jeckerson Jeckerson added 5.0 The issues we want to solve in the 5.0 release and removed status: unverified Unverified labels Sep 3, 2022
@kevcomparadise
Copy link
Author

kevcomparadise commented Sep 3, 2022

Tried with PHP7.4 got this error:

Fatal error: Cannot use 'null' as class name as it is reserved in /srv/vendor/phpunit/phpunit/src/Framework/MockObject/MockClass.php(51) : eval()'d code on line 9

Investigating with 8.1...

We have never tried in 7.4 because Phalcon 3.4 is only available 7.3

Jeckerson added a commit that referenced this issue Sep 5, 2022
Jeckerson added a commit that referenced this issue Sep 5, 2022
Jeckerson added a commit that referenced this issue Sep 5, 2022
@Jeckerson Jeckerson linked a pull request Sep 5, 2022 that will close this issue
5 tasks
@Jeckerson
Copy link
Member

Jeckerson commented Sep 5, 2022

Property's getter was generating wrong ARG_INFO of method, which was causing segmentation fault.

Wrong:

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_gettransaction, 0, 0, IS_NULL, 1)
ZEND_END_ARG_INFO()

Correct:

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_mvc_model_gettransaction, 0, 0, Phalcon\\Mvc\\Model\\TransactionInterface, 1)
ZEND_END_ARG_INFO()

@Jeckerson
Copy link
Member

Related: zephir-lang/zephir#2386

niden added a commit that referenced this issue Sep 6, 2022
@niden
Copy link
Sponsor Member

niden commented Sep 6, 2022

Fixed in #16085

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report external dependency This issue depends on external issue to be resolved.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants