#1115 Virtual Function on PHP

php (58)

Ok, this time I write an example, so it's easier to explain my problem.

Here you can find the source code:

./build_me should build the example, just add
extension=/path/to/compiled/Test.so to php.ini

In that example there are two similar (simple) classes:

SimpleClassFail : public SimpleVirtual // inherit from a virtual pure class
SimpleClassWork : public SimpleNonVirtual // inherit from non-virtual class

Both classes have a function getInner() that returns an instance of a

SimpleClassWork returns it correctly
SimpleClassFail return a wrong instance of SimpleClassFail (insted of

You can test it running bug.php from console.
main.cpp shows that code works fine in c++

Side question:
trying this example in console using php5 bug.php it print:
php5: symbol lookup error: /home/andrea/src/swig-bug/Test.so:
undefined symbol: zend_error_noreturn
using php as apache mod, it gives a blank output. Is there a way to
intercept similar execeptions/failures from php/swig?

Thanks in advance,


  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2010-12-01
  • Olly Betts

    Olly Betts - 2011-02-18

    What OS, architecture, GCC version and PHP version are you using?

  • Olly Betts

    Olly Betts - 2011-05-24
    • status: open --> open-fixed
  • Olly Betts

    Olly Betts - 2011-05-24

    Fixed in SVN trunk r12711, should be in 2.0.5 release.

  • Olly Betts

    Olly Betts - 2011-07-14

    Oops, forgot to actually close this before.

  • Olly Betts

    Olly Betts - 2011-07-14
    • status: open-fixed --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks