-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Allow returning an arbitrary object from the mocked "new" call #11
Comments
Done. Instead of returning, accept the class by reference and set that to the object, like this: <?php
class Other {}
uopz_overload(ZEND_NEW, function(&$class){
switch ($class) { # beware recursion !
case "stdClass":
$class = new Other();
break;
}
});
$object = new stdClass();
var_dump($object);
?>
|
It's great to see such a quick response and code change. Thanks a lot! |
You're welcome :) |
Hello, is there any plan to support this somehow again in PHP 7.x version? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature request:
I'd be happy to hear back if that feature fits the general roadmap of uopz.
Background story:
Wikia currently uses PHP 5.4 and with help of runkit + modified version of php-test-helpers (Wikia/php-test-helpers@9a28725) we were able to have a robust testing environment that satisfies our needs in the area of testing MediaWiki-derived code base.
As we're transitioning to PHP 5.6 we found out that uopz gives us all the functionality of the previous tandem in a single extension except the feature described above. We'd be very happy if we could get the missing piece implemented.
The text was updated successfully, but these errors were encountered: