• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Unset a function?

Question

rossco_2004    0

Is there a way in PHP to unset/delete a function that's already been made, so that I can reuse the name?

Reason is because in vbulletin3.5 there's the plugin system which i want to use to edit a function but there's no hooks in that function,so what i want to do is just copy/paste the code, make my edits, and put it into a plugin that cmes after the function has been made. Problem with just creating it is that i get the function already exists cannot redeclare message.

Thanks. :)

Share this post


Link to post
Share on other sites

10 answers to this question

Recommended Posts

  • 0
bartheq    0

I don't think it's possible but of course I might be wrong (:

Share this post


Link to post
Share on other sites
  • 0
-Dave-    13

i know u can 'overwrite' functions in JAVA, but im not sure about PHP.

sorry dude!

Share this post


Link to post
Share on other sites
  • 0
pdog    0

you can't do it i don't think. first of all, deleting the function would null all of the variables which would make the program disfunctional.

EDIT: using the parent thingy might work

http://us2.php.net/keyword.parent

Share this post


Link to post
Share on other sites
  • 0
Kussie    1

Or just make your edits directly into the VB function

Share this post


Link to post
Share on other sites
  • 0
rossco_2004    0
Or just make your edits directly into the VB function

586756679[/snapback]

I'm trying to keep the forum file-edit free for ease of upgrading...

This is the only file edit the forum has atm, i'm just trying to make it into a plugin so there will be none to worry about.

Share this post


Link to post
Share on other sites
  • 0
Kussie    1

Well if there no plugin hooks in that function there is other way unfortuntly. Just make a backup of the file and edit it

Share this post


Link to post
Share on other sites
  • 0
nickg78    0

You can use rename_function

<?php
rename_function('original_name', 'new_name' );
?>

and then redeclare the original function.

override_function may work too.

Info:

override_function

rename_function

Share this post


Link to post
Share on other sites
  • 0
rossco_2004    0
You can use rename_function

<?php
rename_function('original_name', 'new_name' );
?>

and then redeclare the original function.

override_function may work too.

Info:

override_function

rename_function

586761508[/snapback]

I tried rename_function. Here is the code I used:

//Rename the old function
rename_function('strip_quotes','strip_quotes_non_nested');

But then I get this messsage on the forums:

Fatal error: Call to undefined function: rename_function() in /home/filesh/filesharingtalk.com/html/vb3/global.php(233) : eval()'d code on line 156

:(

Share this post


Link to post
Share on other sites
  • 0
GatorV    1

override_function and rename_function are part of the Zend PHP Debugger, so they are not part of the standard PHP package ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.