{"action":"closed","issue":{"url":"https://api.github.com/repos/krakjoe/uopz/issues/33","repository_url":"https://api.github.com/repos/krakjoe/uopz","labels_url":"https://api.github.com/repos/krakjoe/uopz/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/krakjoe/uopz/issues/33/comments","events_url":"https://api.github.com/repos/krakjoe/uopz/issues/33/events","html_url":"https://github.com/krakjoe/uopz/issues/33","id":144799087,"number":33,"title":"Segmentation fault","user":{"login":"axxapy","id":3088476,"avatar_url":"https://avatars.githubusercontent.com/u/3088476?v=3","gravatar_id":"","url":"https://api.github.com/users/axxapy","html_url":"https://github.com/axxapy","followers_url":"https://api.github.com/users/axxapy/followers","following_url":"https://api.github.com/users/axxapy/following{/other_user}","gists_url":"https://api.github.com/users/axxapy/gists{/gist_id}","starred_url":"https://api.github.com/users/axxapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axxapy/subscriptions","organizations_url":"https://api.github.com/users/axxapy/orgs","repos_url":"https://api.github.com/users/axxapy/repos","events_url":"https://api.github.com/users/axxapy/events{/privacy}","received_events_url":"https://api.github.com/users/axxapy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-31T06:03:51Z","updated_at":"2016-03-31T13:29:31Z","closed_at":"2016-03-31T13:29:31Z","body":"Test case:\r\n```\r\nclass Test {\r\n\tpublic $s = 'def';\r\n\r\n\tpublic function __construct($x) {\r\n\t\t$this->s = $x;\r\n\t}\r\n}\r\n\r\nuopz_function(Test::class, '__construct', function(){$this->s = 'redefined';});\r\nvar_dump((new Test('vvv')));\r\n\r\nuopz_restore(Test::class, '__construct');\r\nvar_dump((new Test('vvv')));\r\n```\r\n```\r\n$ php ~/1.php\r\n/home/axp/1.php:12:\r\nclass Test#1 (1) {\r\n  public $s =>\r\n  string(9) \"redefined\"\r\n}\r\nSegmentation fault (core dumped)\r\n```\r\nphp version:\r\n```\r\n$ php -v\r\nPHP 7.0.5 (cli) (built: Mar 29 2016 18:07:10) ( NTS )\r\nCopyright (c) 1997-2016 The PHP Group\r\nZend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies\r\n    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans\r\n```\r\n[php -i](https://github.com/krakjoe/uopz/files/197047/php.txt)\r\n[strace](https://github.com/krakjoe/uopz/files/197046/strace.txt)\r\n\r\nworkaround is to use uopz_copy instead of restore:\r\n```\r\n$backup = uopz_copy(Test::class, '__construct');\r\nuopz_function(Test::class, '__construct', function(){$this->s = 'redefined';});\r\nvar_dump((new Test('vvv')));\r\n\r\nuopz_function(Test::class, '__construct', $backup);\r\nvar_dump((new Test('vvv')));\r\n```\r\n"}}