SourceForge.net | 23 Jul 14:41
Favicon

[ swig-Bugs-2025719 ] Inconsistent behavior of null/NULL

Bugs item #2025719, was opened at 2008-07-23 14:44
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2025719&group_id=1645

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: php
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Martin Mares (mares)
Assigned to: kruland (kruland)
Summary: Inconsistent behavior of null/NULL

Initial Comment:
When a C function returning a `char *' returns a NULL pointer, it is translated to the null value in PHP.
However, in the opposite direction the null value gets translated to an empty string.

This is both inconvenient and inconsistent with the handling of NULL in the generated wrappers for other
languages (e.g., in Python).

I suggest modifying the default input typemap as follows:

%typemap(in) char * {
        if ((*$input)->type == IS_NULL) {
                $1 = NULL;
(Continue reading)

SourceForge.net | 27 Jul 14:41
Favicon

[ swig-Bugs-2025719 ] [php] Inconsistent behavior of null/NULL

Bugs item #2025719, was opened at 2008-07-23 13:44
Message generated for change (Settings changed) made by olly
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2025719&group_id=1645

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: php
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Martin Mares (mares)
>Assigned to: Olly Betts (olly)
>Summary: [php] Inconsistent behavior of null/NULL

Initial Comment:
When a C function returning a `char *' returns a NULL pointer, it is translated to the null value in PHP.
However, in the opposite direction the null value gets translated to an empty string.

This is both inconvenient and inconsistent with the handling of NULL in the generated wrappers for other
languages (e.g., in Python).

I suggest modifying the default input typemap as follows:

%typemap(in) char * {
        if ((*$input)->type == IS_NULL) {
                $1 = NULL;
(Continue reading)


Gmane