text: - status: open --> wont-fix
  - Group: -->
  See feature request 3168551 () for the motivation behind this feature request.
  It would be great if SWIG would allow renaming of a method's global wrapper function, while still preserving the original method name in the PHP class wrapper.
  Consider for example:
  %module example
  %{
  class session {
  public:
  void commit() { };
  };
  %}
  class session {
  public:
  void commit() { };
  };
  As mentioned in feature request 3168551 (), the resulting PHP module will attempt to register a global function called "session_commit", which breaks PHP.
  So, if we add a simple %rename to fix that:
  %rename(_commit_) commit();
  Then in php, we will need to call session__commit_(), which is fair enough.
  However, if we then include the SWIG-generated example.php class wrapper, we are still forced to use the new _commit_ name like:
  <?php
  $session = new session();
  $session->_commit_();
  ?>
  Since, in this example, we've only renamed the session::commit method to avoid a clash in PHP's global function namespace, it would be nice if I could still do this:
  <?php
  $session = new session();
  $session->commit(); // Wrapper calls the renamed session__commit_ global function.
  ?>
  Of course its relatively easy to modify the resulting example.php by hand (or sed) to use a different method name, but it would be nice if SWIG could provide a feature to do it automatically :)
  I don't think it makes sense to add a feature like this. We should just address #79 directly, e.g. by generating names which won't clash with PHP functions (e.g. prefix with swig_).
  These functions are really an implementation detail if you're generating class wrappers around them. And if you aren't generating class wrappers, then you can rename them as you see fit using %rename.
  Log in to post a comment.