tony2001                Mon Jan 24 09:25:16 2005 EDT

  Added files:                 (Branch: PHP_5_0)
    /php-src/ext/sysvmsg/tests  002.phpt 

  Modified files:              
    /php-src/ext/sysvmsg        sysvmsg.c 
  Log:
  MFH: fix msg_recieve() and add test
  
  
http://cvs.php.net/diff.php/php-src/ext/sysvmsg/sysvmsg.c?r1=1.16&r2=1.16.2.1&ty=u
Index: php-src/ext/sysvmsg/sysvmsg.c
diff -u php-src/ext/sysvmsg/sysvmsg.c:1.16 
php-src/ext/sysvmsg/sysvmsg.c:1.16.2.1
--- php-src/ext/sysvmsg/sysvmsg.c:1.16  Thu Jan  8 03:17:37 2004
+++ php-src/ext/sysvmsg/sysvmsg.c       Mon Jan 24 09:25:16 2005
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: sysvmsg.c,v 1.16 2004/01/08 08:17:37 andi Exp $ */
+/* $Id: sysvmsg.c,v 1.16.2.1 2005/01/24 14:25:16 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -142,7 +142,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_row(2, "sysvmsg support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.16 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.16.2.1 $");
        php_info_print_table_end();
 }
 /* }}} */
@@ -330,6 +330,7 @@
                /* got it! */
                ZVAL_LONG(out_msgtype, messagebuffer->mtype);
 
+               RETVAL_TRUE;
                if (do_unserialize)     {
                        php_unserialize_data_t var_hash;
                        zval *tmp = NULL;
@@ -347,7 +348,6 @@
                } else {
                        ZVAL_STRINGL(out_message, messagebuffer->mtext, result, 
1);
                }
-               RETVAL_TRUE;
        } else if (zerrcode) {
                ZVAL_LONG(zerrcode, errno);
        }

http://cvs.php.net/co.php/php-src/ext/sysvmsg/tests/002.phpt?r=1.1&p=1
Index: php-src/ext/sysvmsg/tests/002.phpt
+++ php-src/ext/sysvmsg/tests/002.phpt
--TEST--
msg_recieve() should return false when unserialize() failed
--SKIPIF--
<?php if (!extension_loaded("sysvmsg")) die("skip sysvmsg extenions is not 
available")?>
--FILE--
<?php

$queue = msg_get_queue (ftok(__FILE__, 'r'), 0600);
if (!msg_send ($queue, 1, 'Hi', false /* ! no_ser*/, true/*block*/, $msg_err)) {
        die("error\n");
}
var_dump($res = msg_receive ($queue, 1, $msg_type, 16384, $msg, true, 0, 
$msg_error));
        
echo "Done\n";
?>
--EXPECTF--
Warning: msg_receive(): message corrupted in %s002.php on line %d
bool(false)
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to