Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#85 closed defect (released)

Php constants defined in RINIT and not in MINIT

Reported by: Ludovic Levesque Owned by: Olly Betts
Priority: normal Milestone:
Component: Xapian-bindings Version: 0.9.6
Severity: trivial Keywords:
Cc: Blocked By:
Blocking: Operating System: Linux

Description

When loading a page php logs error like this (several lines): PHP Notice: Constant QueryParser_STEM_ALL already defined in Unknown on line 0

It's because all constant are defined in PHP_RINIT_FUNCTION(xapian) in xapian_wrap.cc. They must be defined in SWIG_php_minit (equivalent of PHP_MINIT_FUNCTION(xapian).

Change History (4)

comment:1 by Olly Betts, 18 years ago

Status: newassigned

It looks like the problem is with the code SWIG generates. It's easy enough to move the generated code from RINIT to MINIT, and I have commit access to the SWIG repository so I can make the change, but I can't seem to find any PHP or Zend documentation which documents where constant initialisation should go.

I think you're probably right, but I'm cautious since SWIG is used by many projects and the code looks like it's been this way for some time.

Are you able to supply a URL for some suitable documentation?

comment:2 by Olly Betts, 18 years ago

OK, I've found this, which documents that CONST_PERSISTENT means the constant "won't be "forgotten" when the current process carrying this constant shuts down.":

http://www.zend.com/apidoc/zend.variables.constant.php

And this which says to create constants in MINIT:

http://www.zend.com/apidoc/zend.variables.resource.php

So I'll apply a suitable patch to SWIG.

comment:3 by Olly Betts, 18 years ago

Resolution: fixed
Status: assignedclosed

Fixed in SWIG CVS.

comment:4 by Olly Betts, 18 years ago

Operating System: Linux
Resolution: fixedreleased
Note: See TracTickets for help on using tickets.