]> granicus.if.org Git - php/commitdiff
if a module provides a function it should also do so if the function
authorHartmut Holzgraefe <hholzgra@php.net>
Fri, 26 May 2000 17:04:02 +0000 (17:04 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Fri, 26 May 2000 17:04:02 +0000 (17:04 +0000)
is not functional due to configure findings
the function should offer a meaningful warning if it is not supported
instead of just beeing undefined
i had already changed this in 'gd', now this is doing it for 'standard'

ext/standard/basic_functions.c
ext/standard/crypt.c
ext/standard/datetime.c
ext/standard/dl.h
ext/standard/dns.c
ext/standard/file.c
ext/standard/microtime.c
ext/standard/php_crypt.h
main/php.h

index 895ebddf7f887f8de76ad3c633f73fb4fb0c0617..7277ac99ce1523e2d637a1cd4237bdfb65a886ba 100644 (file)
@@ -87,10 +87,8 @@ function_entry basic_functions[] = {
        PHP_FE(time,                                                                    NULL)
        PHP_FE(mktime,                                                                  NULL)
        PHP_FE(gmmktime,                                                                NULL)
-#if HAVE_STRFTIME
        PHP_FE(strftime,                                                                NULL)
        PHP_FE(gmstrftime,                                                              NULL)
-#endif
        PHP_FE(strtotime,                                                               NULL)
        PHP_FE(date,                                                                    NULL)
        PHP_FE(gmdate,                                                                  NULL)
@@ -202,10 +200,9 @@ function_entry basic_functions[] = {
        PHP_FE(gethostbyaddr,                                                   NULL)
        PHP_FE(gethostbyname,                                                   NULL)
        PHP_FE(gethostbynamel,                                                  NULL)
-#if !defined(PHP_WIN32)||HAVE_BINDLIB
+
        PHP_FE(checkdnsrr,                                                              NULL)
        PHP_FE(getmxrr,                                                                 second_and_third_args_force_ref)
-#endif
 
        PHP_FE(getmyuid,                                                                NULL)
        PHP_FE(getmypid,                                                                NULL)
@@ -246,15 +243,12 @@ function_entry basic_functions[] = {
        PHP_FE(long2ip,                                                                 NULL)
 
        PHP_FE(getenv,                                                                  NULL)
-#ifdef HAVE_PUTENV
        PHP_FE(putenv,                                                                  NULL)
-#endif
 
        PHP_FE(microtime,                                                               NULL)
        PHP_FE(gettimeofday,                                                    NULL)
-#ifdef HAVE_GETRUSAGE
+
        PHP_FE(getrusage,                                                               NULL)
-#endif
        
        PHP_FE(uniqid,                                                                  NULL)
                
@@ -328,10 +322,8 @@ function_entry basic_functions[] = {
        PHP_FALIAS(join,                        implode,                        NULL)
        PHP_FE(sql_regcase,                                                             NULL)
 
-#ifdef HAVE_LIBDL
        /* functions from dl.c */
        PHP_FE(dl,                                                      NULL)
-#endif
 
        /* functions from file.c */
        PHP_FE(pclose,                          NULL)
@@ -367,9 +359,7 @@ function_entry basic_functions[] = {
           use socket_set_blocking() instead */
        PHP_FE(set_socket_blocking,     NULL)
        PHP_FE(socket_set_blocking,     NULL)
-#if HAVE_SYS_TIME_H
        PHP_FE(socket_set_timeout,      NULL)
-#endif
        PHP_FE(socket_get_status,       NULL)
        PHP_FE(realpath,                        NULL)
 
@@ -384,10 +374,8 @@ function_entry basic_functions[] = {
        /* functions from browscap.c */
        PHP_FE(get_browser,                     NULL)
 
-#if HAVE_CRYPT
        /* functions from crypt.c */
        PHP_FE(crypt,                           NULL)
-#endif
 
        /* functions from dir.c */
        PHP_FE(opendir,                         NULL)
@@ -804,12 +792,12 @@ PHP_FUNCTION(getenv)
 }
 /* }}} */
 
-#ifdef HAVE_PUTENV
 
 /* {{{ proto void putenv(string setting)
    Set the value of an environment variable */
 PHP_FUNCTION(putenv)
 {
+#ifdef HAVE_PUTENV
        pval **str;
        BLS_FETCH();
 
@@ -883,9 +871,11 @@ PHP_FUNCTION(putenv)
                        RETURN_FALSE;
                }
        }
+#else
+    PHP_NOT_IN_THIS_BUILD;
+#endif
 }
 /* }}} */
-#endif
 
 
 /*******************
index ee117e142959e78ff0473721ab316347961d4455..801282bc7650680046bdb0d09f7b7cc962a83457 100644 (file)
@@ -115,11 +115,13 @@ static void php_to64(char *s, long v, int n)      {
                v >>= 6;
        } 
 } 
+#endif /* HAVE_CRYPT */
 
 /* {{{ proto string crypt(string str [, string salt])
    Encrypt a string */
 PHP_FUNCTION(crypt)
 {
+#if HAVE_CRYPT
        char salt[PHP_MAX_SALT_LEN+1];
        pval **arg1, **arg2;
 
@@ -176,9 +178,11 @@ PHP_FUNCTION(crypt)
        return_value->value.str.len = strlen(return_value->value.str.val);
        return_value->type = IS_STRING;
        pval_copy_constructor(return_value);
+#else
+    PHP_NOT_IN_THIS_BUILD;
+#endif /* HAVE_CRYPT */
 }
 /* }}} */
-#endif
 
 
 
index d9b0b4b3d645d2d354719da7ff28835ae59745b2..b00937393c83758199d1388d5595c62abfb693ef 100644 (file)
@@ -677,11 +677,17 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
        efree(buf);
        RETURN_FALSE;
 }
+#endif
+
 /* {{{ proto string strftime(string format [, int timestamp])
    Format a local time/date according to locale settings */
 PHP_FUNCTION(strftime)
 {
+#if HAVE_STRFTIME
        _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+#else
+    PHP_NOT_IN_THIS_BUILD;
+#endif
 }
 /* }}} */
 
@@ -689,11 +695,14 @@ PHP_FUNCTION(strftime)
    Format a GMT/CUT time/date according to locale settings */
 PHP_FUNCTION(gmstrftime)
 {
+#if HAVE_STRFTIME
        _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+#else
+    PHP_NOT_IN_THIS_BUILD;
+#endif
 }
 /* }}} */
 
-#endif
 
 /* {{{ proto int strtotime(string time, int now)
    Convert string representation of date and time to a timestamp */
index 1c9be24f5b80758fc02437ee348b4362c56b9e83..9e537335873bd9edca31fc51cc9d527667fa4d66 100644 (file)
 
 void php_dl(pval *file,int type,pval *return_value);
 
-#ifdef HAVE_LIBDL
 
 /* dynamic loading functions */
 PHP_FUNCTION(dl);
-PHP_MINFO_FUNCTION(dl);
 
+#ifdef HAVE_LIBDL
+PHP_MINFO_FUNCTION(dl);
 #else
 
 #endif
index 8e481af1cd8ee60b27c15b09a2c32719ab02b38a..181d450b5d93706e3280321b144dbe05cd5685b0 100644 (file)
@@ -159,12 +159,12 @@ char *php_gethostbyname(char *name)
        return estrdup(inet_ntoa(in));
 }
 
-#if !defined(PHP_WIN32)||HAVE_BINDLIB
 
 /* {{{ proto int checkdnsrr(string host [, string type])
    Check DNS records corresponding to a given Internet host name or IP address */
 PHP_FUNCTION(checkdnsrr)
 {
+#if !defined(PHP_WIN32)||HAVE_BINDLIB
        pval **arg1,**arg2;
        int type,i;
 #ifndef MAXPACKET
@@ -206,9 +206,14 @@ PHP_FUNCTION(checkdnsrr)
                RETURN_FALSE;
        }
        RETURN_TRUE;
+#else
+    PHP_NOT_IN_THIS_BUILD;
+#endif
 }
 /* }}} */
 
+#if !defined(PHP_WIN32)||HAVE_BINDLIB
+
 #ifndef HFIXEDSZ
 #define HFIXEDSZ        12      /* fixed data in header <arpa/nameser.h> */
 #endif /* HFIXEDSZ */
@@ -220,11 +225,13 @@ PHP_FUNCTION(checkdnsrr)
 #ifndef MAXHOSTNAMELEN
 #define MAXHOSTNAMELEN  256
 #endif /* MAXHOSTNAMELEN */
+#endif
 
 /* {{{ proto int getmxrr(string hostname, array mxhosts [, array weight])
    Get MX records corresponding to a given Internet host name */
 PHP_FUNCTION(getmxrr)
 {
+#if !defined(PHP_WIN32)||HAVE_BINDLIB
        pval *host, *mx_list, *weight_list;
        int need_weight = 0;
        int count,qdc;
@@ -307,10 +314,12 @@ PHP_FUNCTION(getmxrr)
                }
        }
        RETURN_TRUE;
+#else
+    PHP_NOT_IN_THIS_BUILD;
+#endif
 }
 /* }}} */
 
-#endif
 /*
  * Local variables:
  * tab-width: 4
index 6ab56ed81d4c9d9011ece0316b5bfc766ffde524..17e00ed7cdbf16958363b4846195f794671a134f 100644 (file)
@@ -845,9 +845,9 @@ PHP_FUNCTION(set_socket_blocking)
 
 /* {{{ proto bool socket_set_timeout(int socket descriptor, int seconds, int microseconds)
    Set timeout on socket read to seconds + microseonds */
-#if HAVE_SYS_TIME_H
 PHP_FUNCTION(socket_set_timeout)
 {
+#if HAVE_SYS_TIME_H
        zval **socket, **seconds, **microseconds;
        int type;
        void *what;
@@ -876,8 +876,10 @@ PHP_FUNCTION(socket_set_timeout)
 
        php_sockset_timeout(socketd, &t);
        RETURN_TRUE;
-}
+#else
+    PHP_NOT_IN_THIS_BUILD;
 #endif /* HAVE_SYS_TIME_H */
+}
 
 /* }}} */
 
index ef7600d36ac9a17ff5c515965cbe85b819f15067..39a85726ccee3774a12a50469665276a117f402a 100644 (file)
@@ -89,11 +89,11 @@ PHP_FUNCTION(gettimeofday)
 }
 /* }}} */
 
-#ifdef HAVE_GETRUSAGE
 /* {{{ proto array getrusage([int who])
    Returns an array of usage statistics */
 PHP_FUNCTION(getrusage)
 {
+#ifdef HAVE_GETRUSAGE
        struct rusage usg;
        int ac = ARG_COUNT(ht);
        pval **pwho;
@@ -133,8 +133,10 @@ PHP_FUNCTION(getrusage)
        PHP_RUSAGE_PARA(ru_stime.tv_usec);
        PHP_RUSAGE_PARA(ru_stime.tv_sec);
 #undef PHP_RUSAGE_PARA
-}
+#else
+    PHP_NOT_IN_THIS_BUILD;
 #endif /* HAVE_GETRUSAGE */
+}
 
 /* }}} */
 
index c10af21be4977a8746a0bb2b90eb5941c9251f89..036ade2abe38b0938e78333519cff11dd1225bcf 100644 (file)
@@ -21,8 +21,8 @@
 #ifndef PHP_CRYPT_H
 #define PHP_CRYPT_H
 
-#if HAVE_CRYPT
 PHP_FUNCTION(crypt);
+#if HAVE_CRYPT
 extern PHP_MINIT_FUNCTION(crypt);
 #endif
 
index e6f391d4a26ff1f308c210bd2dbe3af8d2cad734..db2e9660915ceeca14763e44a4b0d9dee4ab4bf1 100644 (file)
@@ -366,6 +366,12 @@ PHPAPI int cfg_get_string(char *varname, char **result);
 #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
 #endif
 
+
+#define PHP_NOT_IN_THIS_BUILD { \
+  php_error(E_WARNING, "%s: not supported in this PHP build",get_active_function_name()); \
+  RETURN_FALSE; \
+}
+
 #endif
 
 /*