FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=19709&edit=1

ID: 19709
Comment by: netvoke
Reported By: pear dot php at nurf dot tk
Summary: SOCK_* values are wrong for Solaris
Status: Open
Type: Bug
Package: Net_DNS2
Operating System: Solaris
Package Version: 1.2.4
PHP Version: 5.3.18
New Comment:

Wouldn't something like this do the trick?

in Net/DNS2/Socket.php:
<code>

if ( ! defined( 'SOCK_STREAM' ) )
{

define( 'SOCK_STREAM' , 1 );

}

if ( ! defined( 'SOCK_DGRAM' ) )
{

define( 'SOCK_DGRAM' , 2 );

}

/**
* ...
*/
abstract class Net_DNS2_Socket
{
...
/*
* type of sockets
*/
const SOCK_STREAM = SOCK_STREAM;
const SOCK_DGRAM = SOCK_DGRAM;
...
}
</code>

Of course you could make it conditional like checking OS and setting the
right vars based on it like:

<code>
define( 'SOCK_STREAM' , ( (*SOLARIS*) ? 2 , 1 ) );
</code>

Then again probably something like this is better if you are thinking
future wise:

<code>
if ( ! defined( 'SOCK_STREAM' ) || ! defined( 'SOCK_DGRAM' ) )
{

$_SOCK_STREAM_ = 1;
$_SOCK_DGRAM_ = 2;

if ( *SOLARIS* )
{

$_SOCK_STREAM_ = 2;
$_SOCK_DGRAM_ = 1;

}

if ( ! defined( 'SOCK_STREAM' ) )
{

define( 'SOCK_STREAM' , $_SOCK_STREAM_ );

}

if ( ! defined( 'SOCK_DGRAM' ) )
{

define( 'SOCK_DGRAM' , $_SOCK_DGRAM_ );

}

unset( $_SOCK_STREAM_ , $_SOCK_DGRAM_ );

}
</code>

And, if you want to be independent of the original constants then change
SOCK_STREAM to _SOCK_STREAM_ in case the system is wrong or w/e.


Previous Comments:
------------------------------------------------------------------------

[2012-11-15 17:03:42] orbill

Description:
------------
Hi there,

I ran into a problem on Solaris 10 when using 1.2.4 where 1.2.3 worked
ok.

My code suddenly returned an error "every name server provided has
failed: Protocol not supported".

After a little investigation I found out that SOCK_STREAM and SOCK_DGRAM
have different values on Solaris than for instance Linux:

Solaris
SOCK_STREAM=2
SOCK_DGRAM=1

Linux
SOCK_STREAM=1
SOCK_DGRAM=2

Since 1.2.4 you use your own fixed values instead of the system supplied
values of the sockets extension which then leads to the problem.

A solution would probably be to use the constants from the sockets
extension if available and your own if the extension is not
available...

Regards
Oliver

------------------------------------------------------------------------

Search Discussions

  • Mike at Nov 16, 2012 at 2:25 am
    Edit report at https://pear.php.net/bugs/bug.php?id=19709&edit=1

    ID: 19709
    Updated by: [email protected]
    Reported By: pearbug at billmann-edv dot net
    Summary: SOCK_* values are wrong for Solaris
    -Status: Open
    +Status: Verified
    Type: Bug
    Package: Net_DNS2
    Operating System: Solaris
    Package Version: 1.2.4
    PHP Version: 5.3.18
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Verified
    Hey Alex,

    Yeah- of course it's different in solars hahah-

    ok- I submitted a fix to SVN- I just checked to see if it a was defined,
    and if not,
    set it to a default.

    I don't think I need to do OS specific checks; if it's not defined,
    we'll default to use
    the streams API instead.

    Can you grab the Net/DNS2/Socket.php from SVN and test to make sure it
    fixes
    your issue?

    http://code.google.com/p/netdns2/source/browse/#svn%2Ftrunk%2FNet%2FDNS2

    Mike


    Previous Comments:
    ------------------------------------------------------------------------

    [2012-11-16 01:02:04] netvoke

    Wouldn't something like this do the trick?

    in Net/DNS2/Socket.php:
    <code>

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , 1 );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , 2 );

    }

    /**
    * ...
    */
    abstract class Net_DNS2_Socket
    {
    ...
    /*
    * type of sockets
    */
    const SOCK_STREAM = SOCK_STREAM;
    const SOCK_DGRAM = SOCK_DGRAM;
    ...
    }
    </code>

    Of course you could make it conditional like checking OS and setting the
    right vars based on it like:

    <code>
    define( 'SOCK_STREAM' , ( (*SOLARIS*) ? 2 , 1 ) );
    </code>

    Then again probably something like this is better if you are thinking
    future wise:

    <code>
    if ( ! defined( 'SOCK_STREAM' ) || ! defined( 'SOCK_DGRAM' ) )
    {

    $_SOCK_STREAM_ = 1;
    $_SOCK_DGRAM_ = 2;

    if ( *SOLARIS* )
    {

    $_SOCK_STREAM_ = 2;
    $_SOCK_DGRAM_ = 1;

    }

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , $_SOCK_STREAM_ );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , $_SOCK_DGRAM_ );

    }

    unset( $_SOCK_STREAM_ , $_SOCK_DGRAM_ );

    }
    </code>

    And, if you want to be independent of the original constants then change
    SOCK_STREAM to _SOCK_STREAM_ in case the system is wrong or w/e.

    ------------------------------------------------------------------------

    [2012-11-15 17:03:42] orbill

    Description:
    ------------
    Hi there,

    I ran into a problem on Solaris 10 when using 1.2.4 where 1.2.3 worked
    ok.

    My code suddenly returned an error "every name server provided has
    failed: Protocol not supported".

    After a little investigation I found out that SOCK_STREAM and SOCK_DGRAM
    have different values on Solaris than for instance Linux:

    Solaris
    SOCK_STREAM=2
    SOCK_DGRAM=1

    Linux
    SOCK_STREAM=1
    SOCK_DGRAM=2

    Since 1.2.4 you use your own fixed values instead of the system supplied
    values of the sockets extension which then leads to the problem.

    A solution would probably be to use the constants from the sockets
    extension if available and your own if the extension is not
    available...

    Regards
    Oliver

    ------------------------------------------------------------------------
  • Pear Php at Nov 16, 2012 at 2:49 am
    Edit report at https://pear.php.net/bugs/bug.php?id=19709&edit=1

    ID: 19709
    Comment by: [email protected]
    Reported By: pearbug at billmann-edv dot net
    Summary: SOCK_* values are wrong for Solaris
    Status: Verified
    Type: Bug
    Package: Net_DNS2
    Operating System: Solaris
    Package Version: 1.2.4
    PHP Version: 5.3.18
    Roadmap Versions:
    New Comment:

    The reason for adding the OS check is that if it's both undefined and
    Solaris then your default values would be wrong.

    Mind you I'm on running nginx/php on my WinXP laptop for development and
    stuff and do have a Ubuntu server on my home network but all things
    being equal I think this could annoy people.


    Previous Comments:
    ------------------------------------------------------------------------

    [2012-11-16 02:25:17] mikepultz

    -Status: Open
    +Status: Verified
    Hey Alex,

    Yeah- of course it's different in solars hahah-

    ok- I submitted a fix to SVN- I just checked to see if it a was defined,
    and if not,
    set it to a default.

    I don't think I need to do OS specific checks; if it's not defined,
    we'll default to use
    the streams API instead.

    Can you grab the Net/DNS2/Socket.php from SVN and test to make sure it
    fixes
    your issue?

    http://code.google.com/p/netdns2/source/browse/#svn%2Ftrunk%2FNet%2FDNS2

    Mike

    ------------------------------------------------------------------------

    [2012-11-16 01:02:04] netvoke

    Wouldn't something like this do the trick?

    in Net/DNS2/Socket.php:
    <code>

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , 1 );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , 2 );

    }

    /**
    * ...
    */
    abstract class Net_DNS2_Socket
    {
    ...
    /*
    * type of sockets
    */
    const SOCK_STREAM = SOCK_STREAM;
    const SOCK_DGRAM = SOCK_DGRAM;
    ...
    }
    </code>

    Of course you could make it conditional like checking OS and setting the
    right vars based on it like:

    <code>
    define( 'SOCK_STREAM' , ( (*SOLARIS*) ? 2 , 1 ) );
    </code>

    Then again probably something like this is better if you are thinking
    future wise:

    <code>
    if ( ! defined( 'SOCK_STREAM' ) || ! defined( 'SOCK_DGRAM' ) )
    {

    $_SOCK_STREAM_ = 1;
    $_SOCK_DGRAM_ = 2;

    if ( *SOLARIS* )
    {

    $_SOCK_STREAM_ = 2;
    $_SOCK_DGRAM_ = 1;

    }

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , $_SOCK_STREAM_ );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , $_SOCK_DGRAM_ );

    }

    unset( $_SOCK_STREAM_ , $_SOCK_DGRAM_ );

    }
    </code>

    And, if you want to be independent of the original constants then change
    SOCK_STREAM to _SOCK_STREAM_ in case the system is wrong or w/e.

    ------------------------------------------------------------------------

    [2012-11-15 17:03:42] orbill

    Description:
    ------------
    Hi there,

    I ran into a problem on Solaris 10 when using 1.2.4 where 1.2.3 worked
    ok.

    My code suddenly returned an error "every name server provided has
    failed: Protocol not supported".

    After a little investigation I found out that SOCK_STREAM and SOCK_DGRAM
    have different values on Solaris than for instance Linux:

    Solaris
    SOCK_STREAM=2
    SOCK_DGRAM=1

    Linux
    SOCK_STREAM=1
    SOCK_DGRAM=2

    Since 1.2.4 you use your own fixed values instead of the system supplied
    values of the sockets extension which then leads to the problem.

    A solution would probably be to use the constants from the sockets
    extension if available and your own if the extension is not
    available...

    Regards
    Oliver

    ------------------------------------------------------------------------
  • Mike at Nov 16, 2012 at 3:09 am
    Edit report at https://pear.php.net/bugs/bug.php?id=19709&edit=1

    ID: 19709
    Updated by: [email protected]
    Reported By: pearbug at billmann-edv dot net
    Summary: SOCK_* values are wrong for Solaris
    Status: Verified
    Type: Bug
    Package: Net_DNS2
    Operating System: Solaris
    Package Version: 1.2.4
    PHP Version: 5.3.18
    Roadmap Versions:
    New Comment:

    Right- I just meant that if those aren't defined in PHP, then that would
    mean that the
    sockets library isn't loaded anyway, so we'd use the Stream library
    instead.

    I use the same const values for the Streams class, but that's just in my
    code- not in
    PHP (the streams stuff uses tcp:// and udp:// URL formats).

    Mike


    Previous Comments:
    ------------------------------------------------------------------------

    [2012-11-16 02:49:49] netvoke

    The reason for adding the OS check is that if it's both undefined and
    Solaris then your default values would be wrong.

    Mind you I'm on running nginx/php on my WinXP laptop for development and
    stuff and do have a Ubuntu server on my home network but all things
    being equal I think this could annoy people.

    ------------------------------------------------------------------------

    [2012-11-16 02:25:17] mikepultz

    -Status: Open
    +Status: Verified
    Hey Alex,

    Yeah- of course it's different in solars hahah-

    ok- I submitted a fix to SVN- I just checked to see if it a was defined,
    and if not,
    set it to a default.

    I don't think I need to do OS specific checks; if it's not defined,
    we'll default to use
    the streams API instead.

    Can you grab the Net/DNS2/Socket.php from SVN and test to make sure it
    fixes
    your issue?

    http://code.google.com/p/netdns2/source/browse/#svn%2Ftrunk%2FNet%2FDNS2

    Mike

    ------------------------------------------------------------------------

    [2012-11-16 01:02:04] netvoke

    Wouldn't something like this do the trick?

    in Net/DNS2/Socket.php:
    <code>

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , 1 );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , 2 );

    }

    /**
    * ...
    */
    abstract class Net_DNS2_Socket
    {
    ...
    /*
    * type of sockets
    */
    const SOCK_STREAM = SOCK_STREAM;
    const SOCK_DGRAM = SOCK_DGRAM;
    ...
    }
    </code>

    Of course you could make it conditional like checking OS and setting the
    right vars based on it like:

    <code>
    define( 'SOCK_STREAM' , ( (*SOLARIS*) ? 2 , 1 ) );
    </code>

    Then again probably something like this is better if you are thinking
    future wise:

    <code>
    if ( ! defined( 'SOCK_STREAM' ) || ! defined( 'SOCK_DGRAM' ) )
    {

    $_SOCK_STREAM_ = 1;
    $_SOCK_DGRAM_ = 2;

    if ( *SOLARIS* )
    {

    $_SOCK_STREAM_ = 2;
    $_SOCK_DGRAM_ = 1;

    }

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , $_SOCK_STREAM_ );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , $_SOCK_DGRAM_ );

    }

    unset( $_SOCK_STREAM_ , $_SOCK_DGRAM_ );

    }
    </code>

    And, if you want to be independent of the original constants then change
    SOCK_STREAM to _SOCK_STREAM_ in case the system is wrong or w/e.

    ------------------------------------------------------------------------

    [2012-11-15 17:03:42] orbill

    Description:
    ------------
    Hi there,

    I ran into a problem on Solaris 10 when using 1.2.4 where 1.2.3 worked
    ok.

    My code suddenly returned an error "every name server provided has
    failed: Protocol not supported".

    After a little investigation I found out that SOCK_STREAM and SOCK_DGRAM
    have different values on Solaris than for instance Linux:

    Solaris
    SOCK_STREAM=2
    SOCK_DGRAM=1

    Linux
    SOCK_STREAM=1
    SOCK_DGRAM=2

    Since 1.2.4 you use your own fixed values instead of the system supplied
    values of the sockets extension which then leads to the problem.

    A solution would probably be to use the constants from the sockets
    extension if available and your own if the extension is not
    available...

    Regards
    Oliver

    ------------------------------------------------------------------------
  • Pear Php at Nov 16, 2012 at 3:43 am
    Edit report at https://pear.php.net/bugs/bug.php?id=19709&edit=1

    ID: 19709
    Comment by: [email protected]
    Reported By: pearbug at billmann-edv dot net
    Summary: SOCK_* values are wrong for Solaris
    Status: Verified
    Type: Bug
    Package: Net_DNS2
    Operating System: Solaris
    Package Version: 1.2.4
    PHP Version: 5.3.18
    Roadmap Versions:
    New Comment:

    I see what you mean... I just looked through your code and understand
    what you mean and found sockets_enabled so all good with me =]


    Previous Comments:
    ------------------------------------------------------------------------

    [2012-11-16 03:09:11] mikepultz

    Right- I just meant that if those aren't defined in PHP, then that would
    mean that the
    sockets library isn't loaded anyway, so we'd use the Stream library
    instead.

    I use the same const values for the Streams class, but that's just in my
    code- not in
    PHP (the streams stuff uses tcp:// and udp:// URL formats).

    Mike

    ------------------------------------------------------------------------

    [2012-11-16 02:49:49] netvoke

    The reason for adding the OS check is that if it's both undefined and
    Solaris then your default values would be wrong.

    Mind you I'm on running nginx/php on my WinXP laptop for development and
    stuff and do have a Ubuntu server on my home network but all things
    being equal I think this could annoy people.

    ------------------------------------------------------------------------

    [2012-11-16 02:25:17] mikepultz

    -Status: Open
    +Status: Verified
    Hey Alex,

    Yeah- of course it's different in solars hahah-

    ok- I submitted a fix to SVN- I just checked to see if it a was defined,
    and if not,
    set it to a default.

    I don't think I need to do OS specific checks; if it's not defined,
    we'll default to use
    the streams API instead.

    Can you grab the Net/DNS2/Socket.php from SVN and test to make sure it
    fixes
    your issue?

    http://code.google.com/p/netdns2/source/browse/#svn%2Ftrunk%2FNet%2FDNS2

    Mike

    ------------------------------------------------------------------------

    [2012-11-16 01:02:04] netvoke

    Wouldn't something like this do the trick?

    in Net/DNS2/Socket.php:
    <code>

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , 1 );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , 2 );

    }

    /**
    * ...
    */
    abstract class Net_DNS2_Socket
    {
    ...
    /*
    * type of sockets
    */
    const SOCK_STREAM = SOCK_STREAM;
    const SOCK_DGRAM = SOCK_DGRAM;
    ...
    }
    </code>

    Of course you could make it conditional like checking OS and setting the
    right vars based on it like:

    <code>
    define( 'SOCK_STREAM' , ( (*SOLARIS*) ? 2 , 1 ) );
    </code>

    Then again probably something like this is better if you are thinking
    future wise:

    <code>
    if ( ! defined( 'SOCK_STREAM' ) || ! defined( 'SOCK_DGRAM' ) )
    {

    $_SOCK_STREAM_ = 1;
    $_SOCK_DGRAM_ = 2;

    if ( *SOLARIS* )
    {

    $_SOCK_STREAM_ = 2;
    $_SOCK_DGRAM_ = 1;

    }

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , $_SOCK_STREAM_ );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , $_SOCK_DGRAM_ );

    }

    unset( $_SOCK_STREAM_ , $_SOCK_DGRAM_ );

    }
    </code>

    And, if you want to be independent of the original constants then change
    SOCK_STREAM to _SOCK_STREAM_ in case the system is wrong or w/e.

    ------------------------------------------------------------------------

    [2012-11-15 17:03:42] orbill

    Description:
    ------------
    Hi there,

    I ran into a problem on Solaris 10 when using 1.2.4 where 1.2.3 worked
    ok.

    My code suddenly returned an error "every name server provided has
    failed: Protocol not supported".

    After a little investigation I found out that SOCK_STREAM and SOCK_DGRAM
    have different values on Solaris than for instance Linux:

    Solaris
    SOCK_STREAM=2
    SOCK_DGRAM=1

    Linux
    SOCK_STREAM=1
    SOCK_DGRAM=2

    Since 1.2.4 you use your own fixed values instead of the system supplied
    values of the sockets extension which then leads to the problem.

    A solution would probably be to use the constants from the sockets
    extension if available and your own if the extension is not
    available...

    Regards
    Oliver

    ------------------------------------------------------------------------
  • Mike at Nov 16, 2012 at 4:09 am
    Edit report at https://pear.php.net/bugs/bug.php?id=19709&edit=1

    ID: 19709
    Updated by: [email protected]
    Reported By: pearbug at billmann-edv dot net
    Summary: SOCK_* values are wrong for Solaris
    Status: Verified
    Type: Bug
    Package: Net_DNS2
    Operating System: Solaris
    Package Version: 1.2.4
    PHP Version: 5.3.18
    Roadmap Versions:
    New Comment:

    cool-

    were you able to test the change I made?


    Previous Comments:
    ------------------------------------------------------------------------

    [2012-11-16 03:43:51] netvoke

    I see what you mean... I just looked through your code and understand
    what you mean and found sockets_enabled so all good with me =]

    ------------------------------------------------------------------------

    [2012-11-16 03:09:11] mikepultz

    Right- I just meant that if those aren't defined in PHP, then that would
    mean that the
    sockets library isn't loaded anyway, so we'd use the Stream library
    instead.

    I use the same const values for the Streams class, but that's just in my
    code- not in
    PHP (the streams stuff uses tcp:// and udp:// URL formats).

    Mike

    ------------------------------------------------------------------------

    [2012-11-16 02:49:49] netvoke

    The reason for adding the OS check is that if it's both undefined and
    Solaris then your default values would be wrong.

    Mind you I'm on running nginx/php on my WinXP laptop for development and
    stuff and do have a Ubuntu server on my home network but all things
    being equal I think this could annoy people.

    ------------------------------------------------------------------------

    [2012-11-16 02:25:17] mikepultz

    -Status: Open
    +Status: Verified
    Hey Alex,

    Yeah- of course it's different in solars hahah-

    ok- I submitted a fix to SVN- I just checked to see if it a was defined,
    and if not,
    set it to a default.

    I don't think I need to do OS specific checks; if it's not defined,
    we'll default to use
    the streams API instead.

    Can you grab the Net/DNS2/Socket.php from SVN and test to make sure it
    fixes
    your issue?

    http://code.google.com/p/netdns2/source/browse/#svn%2Ftrunk%2FNet%2FDNS2

    Mike

    ------------------------------------------------------------------------

    [2012-11-16 01:02:04] netvoke

    Wouldn't something like this do the trick?

    in Net/DNS2/Socket.php:
    <code>

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , 1 );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , 2 );

    }

    /**
    * ...
    */
    abstract class Net_DNS2_Socket
    {
    ...
    /*
    * type of sockets
    */
    const SOCK_STREAM = SOCK_STREAM;
    const SOCK_DGRAM = SOCK_DGRAM;
    ...
    }
    </code>

    Of course you could make it conditional like checking OS and setting the
    right vars based on it like:

    <code>
    define( 'SOCK_STREAM' , ( (*SOLARIS*) ? 2 , 1 ) );
    </code>

    Then again probably something like this is better if you are thinking
    future wise:

    <code>
    if ( ! defined( 'SOCK_STREAM' ) || ! defined( 'SOCK_DGRAM' ) )
    {

    $_SOCK_STREAM_ = 1;
    $_SOCK_DGRAM_ = 2;

    if ( *SOLARIS* )
    {

    $_SOCK_STREAM_ = 2;
    $_SOCK_DGRAM_ = 1;

    }

    if ( ! defined( 'SOCK_STREAM' ) )
    {

    define( 'SOCK_STREAM' , $_SOCK_STREAM_ );

    }

    if ( ! defined( 'SOCK_DGRAM' ) )
    {

    define( 'SOCK_DGRAM' , $_SOCK_DGRAM_ );

    }

    unset( $_SOCK_STREAM_ , $_SOCK_DGRAM_ );

    }
    </code>

    And, if you want to be independent of the original constants then change
    SOCK_STREAM to _SOCK_STREAM_ in case the system is wrong or w/e.

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=19709
  • Pearbug at Nov 16, 2012 at 12:37 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19709&edit=1

    ID: 19709
    Comment by: [email protected]
    Reported By: pearbug at billmann-edv dot net
    Summary: SOCK_* values are wrong for Solaris
    Status: Verified
    Type: Bug
    Package: Net_DNS2
    Operating System: Solaris
    Package Version: 1.2.4
    PHP Version: 5.3.18
    Roadmap Versions:
    New Comment:

    Hi Mike,

    I tested your changes and they work on Solaris :-) Thanks.

    While researching the problem I noticed something else in DNS2.php line
    1065ff:

    $response->answer_from = $ns;
    $response->answer_socket_type = $socket_type;

    ...

    if (is_null($response)) {
    ...
    }

    It is probably better to check first for null and then use the object
    ;-)

    Oliver


    Previous Comments:
    ------------------------------------------------------------------------

    [2012-11-16 04:08:56] mikepultz

    cool-

    were you able to test the change I made?

    ------------------------------------------------------------------------

    [2012-11-16 03:43:51] netvoke

    I see what you mean... I just looked through your code and understand
    what you mean and found sockets_enabled so all good with me =]

    ------------------------------------------------------------------------

    [2012-11-16 03:09:11] mikepultz

    Right- I just meant that if those aren't defined in PHP, then that would
    mean that the
    sockets library isn't loaded anyway, so we'd use the Stream library
    instead.

    I use the same const values for the Streams class, but that's just in my
    code- not in
    PHP (the streams stuff uses tcp:// and udp:// URL formats).

    Mike

    ------------------------------------------------------------------------

    [2012-11-16 02:49:49] netvoke

    The reason for adding the OS check is that if it's both undefined and
    Solaris then your default values would be wrong.

    Mind you I'm on running nginx/php on my WinXP laptop for development and
    stuff and do have a Ubuntu server on my home network but all things
    being equal I think this could annoy people.

    ------------------------------------------------------------------------

    [2012-11-16 02:25:17] mikepultz

    -Status: Open
    +Status: Verified
    Hey Alex,

    Yeah- of course it's different in solars hahah-

    ok- I submitted a fix to SVN- I just checked to see if it a was defined,
    and if not,
    set it to a default.

    I don't think I need to do OS specific checks; if it's not defined,
    we'll default to use
    the streams API instead.

    Can you grab the Net/DNS2/Socket.php from SVN and test to make sure it
    fixes
    your issue?

    http://code.google.com/p/netdns2/source/browse/#svn%2Ftrunk%2FNet%2FDNS2

    Mike

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=19709
  • Mike at Nov 16, 2012 at 7:25 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19709&edit=1

    ID: 19709
    Updated by: [email protected]
    Reported By: pearbug at billmann-edv dot net
    Summary: SOCK_* values are wrong for Solaris
    -Status: Verified
    +Status: Closed
    Type: Bug
    Package: Net_DNS2
    Operating System: Solaris
    Package Version: 1.2.4
    PHP Version: 5.3.18
    -Assigned To:
    +Assigned To: mikepultz
    Roadmap Versions:
    New Comment:

    -Status: Verified
    +Status: Closed
    -Assigned To:
    +Assigned To: mikepultz
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on pear.php.net
    by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.

    Thanks Oliver,

    Mike


    Previous Comments:
    ------------------------------------------------------------------------

    [2012-11-16 12:36:56] orbill

    Hi Mike,

    I tested your changes and they work on Solaris :-) Thanks.

    While researching the problem I noticed something else in DNS2.php line
    1065ff:

    $response->answer_from = $ns;
    $response->answer_socket_type = $socket_type;

    ...

    if (is_null($response)) {
    ...
    }

    It is probably better to check first for null and then use the object
    ;-)

    Oliver

    ------------------------------------------------------------------------

    [2012-11-16 04:08:56] mikepultz

    cool-

    were you able to test the change I made?

    ------------------------------------------------------------------------

    [2012-11-16 03:43:51] netvoke

    I see what you mean... I just looked through your code and understand
    what you mean and found sockets_enabled so all good with me =]

    ------------------------------------------------------------------------

    [2012-11-16 03:09:11] mikepultz

    Right- I just meant that if those aren't defined in PHP, then that would
    mean that the
    sockets library isn't loaded anyway, so we'd use the Stream library
    instead.

    I use the same const values for the Streams class, but that's just in my
    code- not in
    PHP (the streams stuff uses tcp:// and udp:// URL formats).

    Mike

    ------------------------------------------------------------------------

    [2012-11-16 02:49:49] netvoke

    The reason for adding the OS check is that if it's both undefined and
    Solaris then your default values would be wrong.

    Mind you I'm on running nginx/php on my WinXP laptop for development and
    stuff and do have a Ubuntu server on my home network but all things
    being equal I think this could annoy people.

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=19709

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedNov 16, '12 at 1:04a
activeNov 16, '12 at 7:25p
posts8
users3
websitepear.php.net

3 users in discussion

Mike: 4 posts Pearbug: 3 posts Netvoke: 1 post

People

Translate

site design / logo © 2023 Grokbase