[PHP-CVS] cvs: php-src /ext/ircg ircg.c

2003-07-04 Thread Sascha Schumann
sas Fri Jul  4 03:18:32 2003 EDT

  Modified files:  
/php-src/ext/ircg   ircg.c 
  Log:
  simplify ctcp code
  
  
Index: php-src/ext/ircg/ircg.c
diff -u php-src/ext/ircg/ircg.c:1.190 php-src/ext/ircg/ircg.c:1.191
--- php-src/ext/ircg/ircg.c:1.190   Thu Jun 26 14:06:20 2003
+++ php-src/ext/ircg/ircg.c Fri Jul  4 03:18:32 2003
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: ircg.c,v 1.190 2003/06/26 18:06:20 sas Exp $ */
+/* $Id: ircg.c,v 1.191 2003/07/04 07:18:32 sas Exp $ */
 
 /* {{{ includes */
 
@@ -533,7 +533,7 @@
real_msg_end = strchr(real_msg, '\001');
if (real_msg_end) {
format_msg_t **fmt_msg_p;
-   smart_str tmp, tmp2;
+   smart_str tmp;
int status = 0;

*real_msg_end = '\0';
@@ -545,17 +545,6 @@
 
smart_str_setl(tmp, real_msg, real_msg_end - real_msg);

-   /*
-* If no `to´ information was provided by the IRCG layer,
-* someone sent us a private CTCP message.
-* Otherwise, to will be the channel name or the nickname
-* of the recipient.
-*/
-   
-   if (!to) {
-   smart_str_setl(tmp2, conn-conn.username, 
conn-conn.username_len);
-   to = tmp2;
-   }
format_msg(*fmt_msg_p, chan, to, from, tmp, result, 
conn-conn.username, conn-conn.username_len, status);
 
if (status == 1)
@@ -574,7 +563,7 @@
smart_str_setl(s_username, ircc-username, ircc-username_len);
 
if (msg-c[0] == '\001') {
-   handle_ctcp(conn, chan, from, chan?chan:NULL, msg, m);
+   handle_ctcp(conn, chan, from, chan?chan:s_username, msg, m);
} else if (chan) {
FORMAT_MSG(conn, FMT_MSG_CHAN, chan, s_username, from, msg, m, 
conn-conn.username, conn-conn.username_len);
} else {
@@ -595,7 +584,7 @@
smart_str_setl(s_username, ircc-username, ircc-username_len);
 
if (msg-c[0] == '\001') {
-   handle_ctcp(conn, chan, from, chan?chan:NULL, msg, m);
+   handle_ctcp(conn, chan, from, chan?chan:s_username, msg, m);
} else if (chan) {
FORMAT_MSG(conn, FMT_MSG_NOTICE_CHAN, chan, s_username, from, msg, 
m, conn-conn.username, conn-conn.username_len);
} else {



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



[PHP-CVS] cvs: php-src /ext/standard dir.c

2003-07-04 Thread Hartmut Holzgraefe
hholzgraFri Jul  4 09:24:47 2003 EDT

  Modified files:  
/php-src/ext/standard   dir.c 
  Log:
  make sure operator precedence is not playing tricks on us
  (it worked before on gcc3.2/Linux and with VC++ 6, but not
   with gcc3.1/MacOSX)
  
  
Index: php-src/ext/standard/dir.c
diff -u php-src/ext/standard/dir.c:1.123 php-src/ext/standard/dir.c:1.124
--- php-src/ext/standard/dir.c:1.123Thu Jul  3 10:54:03 2003
+++ php-src/ext/standard/dir.c  Fri Jul  4 09:24:47 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dir.c,v 1.123 2003/07/03 14:54:03 hholzgra Exp $ */
+/* $Id: dir.c,v 1.124 2003/07/04 13:24:47 hholzgra Exp $ */
 
 /* {{{ includes/startup/misc */
 
@@ -437,7 +437,7 @@
continue;
}
 
-   if (S_IFDIR != s.st_mode  S_IFMT) {
+   if (S_IFDIR != (s.st_mode  S_IFMT)) {
continue;
}
}



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



[PHP-CVS] cvs: php-src /ext/standard/tests/file bug24482.phpt

2003-07-04 Thread Hartmut Holzgraefe
hholzgraFri Jul  4 10:38:07 2003 EDT

  Added files: 
/php-src/ext/standard/tests/filebug24482.phpt 
  Log:
  regression test for #24482 GLOB_ONLYDIR is not working (on BSD)
  
  

Index: php-src/ext/standard/tests/file/bug24482.phpt
+++ php-src/ext/standard/tests/file/bug24482.phpt
--TEST--
Bug #24482: GLOB_ONLYDIR not working
--FILE--
?php
$globdirs = glob(*, GLOB_ONLYDIR);

$dirs = array();
$dh = opendir(.);
while (is_string($file = readdir($dh))) {
if ($file{0} === .) continue;
if (!is_dir($file)) continue;
$dirs[] = $file;
}
closedir($dh);

if (count($dirs) != count($globdirs)) {
echo Directory count mismatch\n;

echo glob found:\n;
sort($globdirs);
var_dump($globdirs);

echo opendir/readdir/isdir found:\n;
sort($dirs);
var_dump($dirs);
} else {
echo OK\n;
}
?
--EXPECT--
OK



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



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/standard dir.c /ext/standard/tests/file bug24482.phpt

2003-07-04 Thread Hartmut Holzgraefe
hholzgraFri Jul  4 10:40:22 2003 EDT

  Added files: (Branch: PHP_4_3)
/php-src/ext/standard/tests/filebug24482.phpt 

  Modified files:  
/php-src/ext/standard   dir.c 
  Log:
  MFH
  
  
Index: php-src/ext/standard/dir.c
diff -u php-src/ext/standard/dir.c:1.109.2.7 php-src/ext/standard/dir.c:1.109.2.8
--- php-src/ext/standard/dir.c:1.109.2.7Wed Jun  4 01:46:18 2003
+++ php-src/ext/standard/dir.c  Fri Jul  4 10:40:22 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dir.c,v 1.109.2.7 2003/06/04 05:46:18 sniper Exp $ */
+/* $Id: dir.c,v 1.109.2.8 2003/07/04 14:40:22 hholzgra Exp $ */
 
 /* {{{ includes/startup/misc */
 
@@ -139,9 +139,6 @@
 #ifdef GLOB_BRACE
REGISTER_LONG_CONSTANT(GLOB_BRACE, GLOB_BRACE, CONST_CS | CONST_PERSISTENT);
 #endif
-#ifdef GLOB_ONLYDIR
-   REGISTER_LONG_CONSTANT(GLOB_ONLYDIR, GLOB_ONLYDIR, CONST_CS | 
CONST_PERSISTENT);
-#endif
 #ifdef GLOB_MARK
REGISTER_LONG_CONSTANT(GLOB_MARK, GLOB_MARK, CONST_CS | CONST_PERSISTENT);
 #endif
@@ -154,6 +151,17 @@
 #ifdef GLOB_NOESCAPE
REGISTER_LONG_CONSTANT(GLOB_NOESCAPE, GLOB_NOESCAPE, CONST_CS | 
CONST_PERSISTENT);
 #endif
+
+#ifndef GLOB_ONLYDIR
+#define GLOB_ONLYDIR (130)
+#define GLOB_EMULATE_ONLYDIR
+#define GLOB_FLAGMASK (~GLOB_ONLYDIR)
+#else
+#define GLOB_FLAGMASK (~0)
+#endif
+
+   REGISTER_LONG_CONSTANT(GLOB_ONLYDIR, GLOB_ONLYDIR, CONST_CS | 
CONST_PERSISTENT);
+
 #endif
 
return SUCCESS;
@@ -384,7 +392,7 @@
 #endif
 
globbuf.gl_offs = 0;
-   if (0 != (ret = glob(pattern, flags, NULL, globbuf))) {
+   if (0 != (ret = glob(pattern, flags  GLOB_FLAGMASK, NULL, globbuf))) {
 #ifdef GLOB_NOMATCH
if (GLOB_NOMATCH == ret) {
/* Linux handles no matches as an error condition, but FreeBSD
@@ -419,6 +427,19 @@
 
array_init(return_value);
for (n = 0; n  globbuf.gl_pathc; n++) {
+#ifdef GLOB_EMULATE_ONLYDIR
+   if (flags  GLOB_ONLYDIR) {
+   struct stat s;
+
+   if (0 != VCWD_STAT(globbuf.gl_pathv[n], s)) {
+   continue;
+   }
+
+   if (S_IFDIR != (s.st_mode  S_IFMT)) {
+   continue;
+   }
+   }
+#endif
add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1);
}
 

Index: php-src/ext/standard/tests/file/bug24482.phpt
+++ php-src/ext/standard/tests/file/bug24482.phpt
--TEST--
Bug #24482: GLOB_ONLYDIR not working
--FILE--
?php
$globdirs = glob(*, GLOB_ONLYDIR);

$dirs = array();
$dh = opendir(.);
while (is_string($file = readdir($dh))) {
if ($file{0} === .) continue;
if (!is_dir($file)) continue;
$dirs[] = $file;
}
closedir($dh);

if (count($dirs) != count($globdirs)) {
echo Directory count mismatch\n;

echo glob found:\n;
sort($globdirs);
var_dump($globdirs);

echo opendir/readdir/isdir found:\n;
sort($dirs);
var_dump($dirs);
} else {
echo OK\n;
}
?
--EXPECT--
OK



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



[PHP-CVS] cvs: php-src /ext/standard/tests/file bug24482.phpt

2003-07-04 Thread Hartmut Holzgraefe
hholzgraFri Jul  4 11:07:11 2003 EDT

  Modified files:  
/php-src/ext/standard/tests/filebug24482.phpt 
  Log:
  skip test if glob() is not available at all
  
  
Index: php-src/ext/standard/tests/file/bug24482.phpt
diff -u php-src/ext/standard/tests/file/bug24482.phpt:1.1 
php-src/ext/standard/tests/file/bug24482.phpt:1.2
--- php-src/ext/standard/tests/file/bug24482.phpt:1.1   Fri Jul  4 10:38:07 2003
+++ php-src/ext/standard/tests/file/bug24482.phpt   Fri Jul  4 11:07:11 2003
@@ -1,5 +1,11 @@
 --TEST--
 Bug #24482: GLOB_ONLYDIR not working
+--SKIPIF--
+?php
+if (!function_exists(glob)) {
+die('skip glob() not available');
+}
+?
 --FILE--
 ?php
 $globdirs = glob(*, GLOB_ONLYDIR);



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



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/standard/tests/file bug24482.phpt

2003-07-04 Thread Hartmut Holzgraefe
hholzgraFri Jul  4 11:07:56 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/standard/tests/filebug24482.phpt 
  Log:
  MFH
  
  
Index: php-src/ext/standard/tests/file/bug24482.phpt
diff -u php-src/ext/standard/tests/file/bug24482.phpt:1.1.2.1 
php-src/ext/standard/tests/file/bug24482.phpt:1.1.2.2
--- php-src/ext/standard/tests/file/bug24482.phpt:1.1.2.1   Fri Jul  4 10:40:22 
2003
+++ php-src/ext/standard/tests/file/bug24482.phpt   Fri Jul  4 11:07:56 2003
@@ -1,5 +1,11 @@
 --TEST--
 Bug #24482: GLOB_ONLYDIR not working
+--SKIPIF--
+?php
+if (!function_exists(glob)) {
+die('skip glob() not available');
+}
+?
 --FILE--
 ?php
 $globdirs = glob(*, GLOB_ONLYDIR);



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



[PHP-CVS] cvs: php-src /main php_compat.h

2003-07-04 Thread Sterling Hughes
sterlingFri Jul  4 14:19:02 2003 EDT

  Modified files:  
/php-src/main   php_compat.h 
  Log:
  avoid external conflicts in apache
  
  
Index: php-src/main/php_compat.h
diff -u php-src/main/php_compat.h:1.14 php-src/main/php_compat.h:1.15
--- php-src/main/php_compat.h:1.14  Tue Jun 10 16:03:41 2003
+++ php-src/main/php_compat.h   Fri Jul  4 14:19:02 2003
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: php_compat.h,v 1.14 2003/06/10 20:03:41 imajes Exp $ */
+/* $Id: php_compat.h,v 1.15 2003/07/04 18:19:02 sterling Exp $ */
 
 #ifndef PHP_COMPAT_H
 #define PHP_COMPAT_H
@@ -47,7 +47,7 @@
 #define hashTableIterInit  php_hashTableIterInit
 #define hashTableIterNext  php_hashTableIterNext
 
-#ifdef HAVE_LIBEXPAT_BUNDLED
+#if defined(HAVE_LIBXML)  defined(HAVE_XML)
 #define XML_DefaultCurrent php_XML_DefaultCurrent
 #define XML_ErrorString php_XML_ErrorString
 #define XML_ExpatVersion php_XML_ExpatVersion



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



[PHP-CVS] cvs: php-src /ext/yaz php_yaz.c

2003-07-04 Thread Adam Dickmeiss
dickmeiss   Fri Jul  4 15:17:08 2003 EDT

  Modified files:  
/php-src/ext/yazphp_yaz.c 
  Log:
  On Windows, handle YAZ versions that don't export yaz_version.
  
  
Index: php-src/ext/yaz/php_yaz.c
diff -u php-src/ext/yaz/php_yaz.c:1.75 php-src/ext/yaz/php_yaz.c:1.76
--- php-src/ext/yaz/php_yaz.c:1.75  Tue Jun 10 16:03:40 2003
+++ php-src/ext/yaz/php_yaz.c   Fri Jul  4 15:17:08 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_yaz.c,v 1.75 2003/06/10 20:03:40 imajes Exp $ */
+/* $Id: php_yaz.c,v 1.76 2003/07/04 19:17:08 dickmeiss Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1545,7 +1545,19 @@
 {
char version_str[20];
 
+#if WIN32
+   HINSTANCE h = LoadLibrary(yaz);
+   unsigned long (__cdecl *p)(char *version_str, char *sys_str) = 0;
+   strcpy(version_str, unknown);
+
+   if (h  (p = (unsigned long(__cdecl*)(char*,char*))
+   GetProcAddress(h, yaz_version)))
+   p(version_str, 0);
+   if (h)
+   FreeLibrary(h);
+#else
yaz_version(version_str, 0);
+#endif
php_info_print_table_start();
php_info_print_table_row(2, YAZ Support, enabled);
php_info_print_table_row(2, YAZ Version, version_str);



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



[PHP-CVS] cvs: php-src /ext/simplexml simplexml.c

2003-07-04 Thread Sterling Hughes
sterlingFri Jul  4 17:58:09 2003 EDT

  Modified files:  
/php-src/ext/simplexml  simplexml.c 
  Log:
  fix memory cverrun when accessing an empty xml element.
  guess how many lines it took me to write a basic WSDL parser + API?  20 using
  curl + simplexml
  
  
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.47 php-src/ext/simplexml/simplexml.c:1.48
--- php-src/ext/simplexml/simplexml.c:1.47  Mon Jun 30 20:49:25 2003
+++ php-src/ext/simplexml/simplexml.c   Fri Jul  4 17:58:09 2003
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: simplexml.c,v 1.47 2003/07/01 00:49:25 helly Exp $ */
+/* $Id: simplexml.c,v 1.48 2003/07/04 21:58:09 sterling Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -177,7 +177,7 @@
if (counter == 1) {
SEPARATE_ZVAL(value);
zval_dtor(return_value);
-   FREE_ZVAL(return_value);
+   FREE_ZVAL(return_value); 
return_value = value;
}
 
@@ -715,7 +715,7 @@
 
 /* {{{ cast_object()
  */
-static inline void
+static void
 cast_object(zval *object, int type, char *contents TSRMLS_DC)
 {
if (contents) {
@@ -727,7 +727,8 @@
 
switch (type) {
case IS_STRING:
-   return;
+   convert_to_string(object);
+   break;
case IS_BOOL:
convert_to_boolean(object);
break;
@@ -762,9 +763,8 @@
}
 
if (sxe-node) {
-   contents = xmlNodeListGetString((xmlDocPtr) sxe-document-ptr, 
sxe-node-children, 1);
-   if (!xmlIsBlankNode(sxe-node-children)  contents) {
-   cast_object(writeobj, type, NULL TSRMLS_CC);
+   if (sxe-node-children) {
+   contents = xmlNodeListGetString((xmlDocPtr) 
sxe-document-ptr, sxe-node-children, 1);
}
} 
 
@@ -1059,7 +1059,7 @@
 {
php_info_print_table_start();
php_info_print_table_header(2, Simplexml support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.47 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.48 $);
php_info_print_table_end();
 
 }



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



[PHP-CVS] cvs: php-src /ext/simplexml simplexml.c

2003-07-04 Thread Sterling Hughes
sterlingFri Jul  4 18:21:23 2003 EDT

  Modified files:  
/php-src/ext/simplexml  simplexml.c 
  Log:
  real fix
  
  
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.48 php-src/ext/simplexml/simplexml.c:1.49
--- php-src/ext/simplexml/simplexml.c:1.48  Fri Jul  4 17:58:09 2003
+++ php-src/ext/simplexml/simplexml.c   Fri Jul  4 18:21:23 2003
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: simplexml.c,v 1.48 2003/07/04 21:58:09 sterling Exp $ */
+/* $Id: simplexml.c,v 1.49 2003/07/04 22:21:23 sterling Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -719,10 +719,7 @@
 cast_object(zval *object, int type, char *contents TSRMLS_DC)
 {
if (contents) {
-   int len = strlen(contents);
-   ZVAL_STRINGL(object, contents, len, 1);
-   } else {
-   ZVAL_NULL(object);
+   ZVAL_STRINGL(object, contents, strlen(contents), 1);
}
 
switch (type) {
@@ -751,7 +748,6 @@
char   *contents = NULL;
 
 sxe = php_sxe_fetch_object(readobj TSRMLS_CC);
-   
if (should_free) {
zval_dtor(writeobj);
}
@@ -1059,7 +1055,7 @@
 {
php_info_print_table_start();
php_info_print_table_header(2, Simplexml support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.48 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.49 $);
php_info_print_table_end();
 
 }



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



[PHP-CVS] cvs: php-src /ext/simplexml simplexml.c

2003-07-04 Thread Sterling Hughes
sterlingFri Jul  4 20:33:13 2003 EDT

  Modified files:  
/php-src/ext/simplexml  simplexml.c 
  Log:
  not a temp var unless its a singular var
  
  
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.49 php-src/ext/simplexml/simplexml.c:1.50
--- php-src/ext/simplexml/simplexml.c:1.49  Fri Jul  4 18:21:23 2003
+++ php-src/ext/simplexml/simplexml.c   Fri Jul  4 20:33:13 2003
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: simplexml.c,v 1.49 2003/07/04 22:21:23 sterling Exp $ */
+/* $Id: simplexml.c,v 1.50 2003/07/05 00:33:13 sterling Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -179,11 +179,10 @@
zval_dtor(return_value);
FREE_ZVAL(return_value); 
return_value = value;
+   } else {
+   PZVAL_UNLOCK(return_value);
}
 
-   /* create temporary variable */
-   PZVAL_UNLOCK(return_value);
-
return return_value;
 }
 /* }}} */
@@ -1055,7 +1054,7 @@
 {
php_info_print_table_start();
php_info_print_table_header(2, Simplexml support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.49 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.50 $);
php_info_print_table_end();
 
 }



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