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

Process isolation breaks for global objects that implement the Serializable interface #17

Closed
whatthejeff opened this issue Sep 6, 2010 · 2 comments
Labels
type/bug Something is broken

Comments

@whatthejeff
Copy link
Contributor

Specifying the --process-isolation flag will raise errors for global objects that implement the Serializable interface. Consider the following test:

<?php
class AClass implements Serializable {
    public function serialize() { return serialize('abc'); }
    public function unserialize($data) {}
}

$GLOBALS['A'] = new AClass;

class ATest extends PHPUnit_Framework_TestCase
{
    public function testTrue()
    {
        $this->assertTrue(true);
    }
}

Running this test with the --process-isolation flag will raise the following error:

$ phpunit --process-isolation ATest.php 
PHPUnit 3.5.0RC2 by Sebastian Bergmann.

E

Time: 0 seconds, Memory: 5.25Mb

There was 1 error:

1) ATest::testTrue
RuntimeException: PHP Warning:  Class __PHP_Incomplete_Class has no unserializer in - on line 79
PHP Stack trace:
PHP   1. {main}() -:0
PHP   2. unserialize() -:79


FAILURES!
Tests: 1, Assertions: 0, Errors: 1.

This happens because http://github.com/sebastianbergmann/phpunit/blob/master/PHPUnit/Framework/Process/TestCaseMethod.tpl.dist processes globals before it processes included files. For objects that implement the Serializable interface this will not work as the class declaration is needed before the object can be unserialized.

@sebastianbergmann
Copy link
Owner

Closed by 3d2c2a6.

@sebastianbergmann
Copy link
Owner

Fixed.

cebe pushed a commit to cebe/phpunit that referenced this issue Aug 15, 2011
localheinz pushed a commit to localheinz/phpunit that referenced this issue Oct 30, 2020
localheinz pushed a commit to localheinz/phpunit that referenced this issue Oct 30, 2020
localheinz pushed a commit to localheinz/phpunit that referenced this issue Nov 6, 2020
localheinz added a commit to localheinz/phpunit that referenced this issue Nov 6, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
localheinz added a commit to localheinz/phpunit that referenced this issue Nov 6, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
localheinz added a commit to localheinz/phpunit that referenced this issue Nov 6, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
localheinz added a commit to localheinz/phpunit that referenced this issue Nov 7, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
localheinz added a commit to localheinz/phpunit that referenced this issue Nov 13, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Nov 13, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
sebastianbergmann pushed a commit that referenced this issue Nov 28, 2020
Closes #17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 19, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 21, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 23, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 24, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 26, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 26, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 27, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 28, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 28, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 29, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Dec 30, 2020
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Jan 2, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Jan 6, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Jan 11, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Jan 15, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Jan 20, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Jan 26, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
sebastianbergmann pushed a commit that referenced this issue Jan 31, 2021
Closes #17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Feb 1, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Feb 12, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Feb 16, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Feb 24, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
sebastianbergmann pushed a commit that referenced this issue Mar 12, 2021
Closes #17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
localheinz added a commit to localheinz/phpunit that referenced this issue Mar 14, 2021
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
sebastianbergmann pushed a commit that referenced this issue May 21, 2021
Closes #17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
partikus pushed a commit to zf1s/phpunit that referenced this issue Oct 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants