Re: cvs: php4 /ext/posix posix.c

From: Date: Tue, 21 May 2002 16:00:59 +0000
Subject: Re: cvs: php4 /ext/posix posix.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12031@lists.php.net to get a copy of this message
I think this is a problem. The argument could be reference counted and you are forcing a conversion for all variables pointing at the zval *. The problem is that if zend_parse_parameters() doesn't give you a zval ** you can't do convert_to_long_ex(). Unless I'm missing something this looks like a limitation in zend_parse_parameters(). Andi At 23:26 20/05/2002 +0000, Markus Fischer wrote:
mfischer                Mon May 20 19:26:13 2002 EDT
Modified files:
    /php4/ext/posix     posix.c
Log: - Fix posix_isatty() and posix_ttyname() (Closes #17323) Index: php4/ext/posix/posix.c diff -u php4/ext/posix/posix.c:1.46 php4/ext/posix/posix.c:1.47 --- php4/ext/posix/posix.c:1.46 Sat May 4 12:54:13 2002
+++ php4/ext/posix/posix.c      Mon May 20 19:26:13 2002
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: posix.c,v 1.46 2002/05/04 16:54:13 sas Exp $ */ +/* $Id: posix.c,v 1.47 2002/05/20 23:26:13 mfischer Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -130,7 +130,7 @@ static PHP_MINFO_FUNCTION(posix) {
        php_info_print_table_start();
-       php_info_print_table_row(2, "Revision", "$Revision: 1.46 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.47 $");
        php_info_print_table_end();
} /* }}} */ @@ -584,13 +584,15 @@
    Determine terminal device name (POSIX.1, 4.7.2) */
PHP_FUNCTION(posix_ttyname) {
-       long fd;
+       zval *z_fd;
        char *p;
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fd) == FAILURE)
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE)
                return;
-       if (NULL == (p = ttyname(fd))) {
+       convert_to_long(z_fd);
+
+       if (NULL == (p = ttyname(Z_LVAL_P(z_fd)))) {
                POSIX_G(last_error) = errno;
                RETURN_FALSE;
        }
@@ -603,13 +605,15 @@
    Determine if filedesc is a tty (POSIX.1, 4.7.1) */
PHP_FUNCTION(posix_isatty) {
-       long fd;
+       zval *z_fd;
        int   result;
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fd) == FAILURE)
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE)
                return;
-       result = isatty(fd);
+       convert_to_long(z_fd);
+
+       result = isatty(Z_LVAL_P(z_fd));
        if (!result)
                RETURN_FALSE;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.cvs (#12031) next »