Req #56618 [Opn->Csd]: Functionality to add code to the beginning/end of an existing function/method
| From: | sebastian@php.net | Date: | Thu, 27 Oct 2011 07:17:03 +0000 |
| Subject: | Req #56618 [Opn->Csd]: Functionality to add code to the beginning/end of an existing function/method | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164605@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=56618&edit=1
ID: 56618
Updated by: sebastian@php.net
Reported by: sebastian@php.net
Summary: Functionality to add code to the beginning/end of an
existing function/method
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: runkit
Operating System: Irrelevant
PHP Version: 5_1 CVS-2005-10-28 (dev)
-Assigned To:
+Assigned To: sebastian
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2005-10-28 12:23:51] sebastian@php.net
Description:
------------
This is a request for a Runkit function that adds PHP code either at the beginning or at the end of
an already defined function or method.
This can currently be achieved by the following
runkit_method_rename('Foo', 'bar', '__bar');
runkit_method_add('Foo', 'bar', '', "echo 'Hello ';
Foo::__bar(); echo '!';");
but a convenience function for this would be nice.
Reproduce code:
---------------
<?php
class Foo {
public function bar() {
print 'World';
}
}
runkit_method_prepend_code('Foo', 'bar', "print 'Hello ';");
runkit_method_append_code('Foo', 'bar', "print '!';");
$foo = new Foo;
$foo->bar();
?>
Expected result:
----------------
Hello World.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=56618&edit=1