#843 [php] Ref count...

closed-fixed
php (58)
5
2007-09-01
2007-07-25
Etienne
No

Consider the following example:

t01.i:
%module t01
%{
# include <iostream>
# include "t01.hh"
# define TRACE(arg) std::cout << __FILE__ << "(" << __LINE__ << ") : "
<< arg << std::endl
%}

%feature("ref") Pouet "TRACE(\"up ref\");"
%feature("unref") Pouet "TRACE(\"down ref\");"

%include "t01.hh"

t01.hh:
#ifndef T01_HH__
#define T01_HH__

struct Pouet
{
int a;
};

#endif

t.php:
<?php
include("t01.php");
$p = new Pouet();
?>

I compile with :
$ swig -php4 -c++ -Wall t01.i
$ g++ t01_wrap.cpp -shared -I. -I/usr/include/php4 -I/usr/include/php4/main -I/usr/include/php4/TSRM -I/usr/include/php4/Zend -g -o t01.so

And when I run it :
PHP Warning: mime_magic: type regex BEGIN[[:space:]]*[{]
application/x-awk invalid in Unknown on line 0
t01_wrap.cpp(1094) : down ref

My problem is why there is only unref but not ref and unref. I do its test in perl5 and there is ref and unref.

And I think I find the bug in swig source (version 1.3.31) (see my patch).

And after its patch we can see :
PHP Warning: mime_magic: type regex BEGIN[[:space:]]*[{] application/x-awk invalid in Unknown on line 0
t01_wrap.cpp(1076) : up ref
t01_wrap.cpp(1095) : down ref
(like perl)

Etienne

Discussion

  • Etienne

    Etienne - 2007-07-25
     
  • Olly Betts

    Olly Betts - 2007-08-25
    • summary: Ref count... --> [php] Ref count...
     
  • Olly Betts

    Olly Betts - 2007-08-25

    Logged In: YES
    user_id=14972
    Originator: NO

    Can you regenerate your patch with context? Without any context, I can't see where to apply the patch to SVN HEAD.

    Use "diff -u" (if your diff supports -u), otherwise "diff -c".

     
  • Etienne

    Etienne - 2007-08-27

    Logged In: YES
    user_id=1852990
    Originator: YES

    Looks as though this has been fixed in the svn version...

     
  • Olly Betts

    Olly Betts - 2007-09-01

    Logged In: YES
    user_id=14972
    Originator: NO

    Thanks for checking. I think probably this change fixed it:

    01/12/2007: wsfulton
    [Php] Add support for newfree typemaps (sometimes used by %newobject)

    Closing this bug as fixed.

     
  • Olly Betts

    Olly Betts - 2007-09-01
    • status: open --> 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