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

2003-07-22 Thread Jason Greene
jason   Tue Jul 22 03:20:56 2003 EDT

  Modified files:  
/php-src/ext/socketssockets.c 
/php-src/ext/standard   streamsfuncs.c 
  Log:
  Fix EINVAL errors for OS's (Solaris + BSD) that do not appreciate microseconds = 1 
second
  Patch submitted from [EMAIL PROTECTED]
  
  
Index: php-src/ext/sockets/sockets.c
diff -u php-src/ext/sockets/sockets.c:1.146 php-src/ext/sockets/sockets.c:1.147
--- php-src/ext/sockets/sockets.c:1.146 Tue Jul  8 01:00:13 2003
+++ php-src/ext/sockets/sockets.c   Tue Jul 22 03:20:55 2003
@@ -19,7 +19,7 @@
+--+
  */
 
-/* $Id: sockets.c,v 1.146 2003/07/08 05:00:13 pollita Exp $ */
+/* $Id: sockets.c,v 1.147 2003/07/22 07:20:55 jason Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -641,8 +641,16 @@
convert_to_long(tmp);
sec = tmp;
}
-   tv.tv_sec = Z_LVAL_P(sec);
-   tv.tv_usec = usec;
+
+   /* Solaris + BSD do not like microsecond values which are = 1 sec */ 
+   if (usec  99) {
+   tv.tv_sec = Z_LVAL_P(sec) + (usec / 100);
+   tv.tv_usec = usec % 100;
+   } else {
+   tv.tv_sec = Z_LVAL_P(sec);
+   tv.tv_usec = usec;
+   }   
+
tv_p = tv;
 
if (sec == tmp) {
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.24 
php-src/ext/standard/streamsfuncs.c:1.25
--- php-src/ext/standard/streamsfuncs.c:1.24Sat Jun 28 07:24:46 2003
+++ php-src/ext/standard/streamsfuncs.c Tue Jul 22 03:20:55 2003
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: streamsfuncs.c,v 1.24 2003/06/28 11:24:46 wez Exp $ */
+/* $Id: streamsfuncs.c,v 1.25 2003/07/22 07:20:55 jason Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -563,8 +563,16 @@
/* If seconds is not set to null, build the timeval, else we wait indefinitely 
*/
if (sec != NULL) {
convert_to_long_ex(sec);
-   tv.tv_sec = Z_LVAL_P(sec);
-   tv.tv_usec = usec;
+
+   /* Solaris + BSD do not like microsecond values which are = 1 sec */
+   if (usec  99) {
+   tv.tv_sec = Z_LVAL_P(sec) + (usec / 100);
+   tv.tv_usec = usec % 100;
+   } else {
+   tv.tv_sec = Z_LVAL_P(sec);
+   tv.tv_usec = usec;
+   }
+
tv_p = tv;
}
 



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



Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Zeev Suraski
At 04:10 22/07/2003, Sascha Schumann wrote:
sas Mon Jul 21 21:10:31 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/sessionsession.c
  Log:
  Proper fix for #24592
  The core issue is that undefined variables are refcounted (refcount != 0)
  while is_ref is still set to 0.  I don't know whether this is a bug in
  the engine, but is it not the first time this irregularity has caused
  problems for the session extension.
There's nothing irregular about it, the session extension should get used 
to it :)

Zeev

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


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

2003-07-22 Thread Jani Taskinen

MFH?

--Jani


On Mon, 21 Jul 2003, Marcus Boerger wrote:

helly  Mon Jul 21 16:53:00 2003 EDT

  Modified files:  
/php-src/ext/pgsql pgsql.c 
  Log:
  Reset vars when reusing a persistent connection as requested from postgres 
 developers
  
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.280 php-src/ext/pgsql/pgsql.c:1.281
--- php-src/ext/pgsql/pgsql.c:1.280Mon Jul 21 16:49:47 2003
+++ php-src/ext/pgsql/pgsql.c  Mon Jul 21 16:53:00 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.280 2003/07/21 20:49:47 helly Exp $ */
+/* $Id: pgsql.c,v 1.281 2003/07/21 20:53:00 helly Exp $ */
 
 #include stdlib.h
 
@@ -623,6 +623,11 @@
   
 zend_hash_del(EG(persistent_list),str.c,str.len+1);
   goto err;
   }
+  }
+  if (atof(PG_VERSION) = 7.2) {
+  PGresult *pg_result;
+  pg_result = PQexec(le-ptr, RESET ALL);
+  PQclear(pg_result);
   }
   pgsql = (PGconn *) le-ptr;
   }






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



Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Sascha Schumann
On Tue, 22 Jul 2003, Zeev Suraski wrote:

 At 04:10 22/07/2003, Sascha Schumann wrote:
 sas Mon Jul 21 21:10:31 2003 EDT
 
Modified files:  (Branch: PHP_4_3)
  /php-src/ext/sessionsession.c
Log:
Proper fix for #24592
 
The core issue is that undefined variables are refcounted (refcount != 0)
while is_ref is still set to 0.  I don't know whether this is a bug in
the engine, but is it not the first time this irregularity has caused
problems for the session extension.

 There's nothing irregular about it, the session extension should get used
 to it :)

If it is not irregular, the engine code should be able to
deal with it correctly.  Right now, it falls over itself
quickly and dies ungracefully.

(gdb) p *val
$1 = (zval *) 0x816db84
(gdb) p **val
$1 = {value = {lval = 0, dval = 0, str = {val = 0x0, len = 0}, ht = 0x0,
obj = {ce = 0x0, properties = 0x0}}, type = 0 '\0', is_ref = 0 '\0',
  refcount = 6}

Note the refcount value.  When passing this zval to
ZEND_SET_SYMBOL_WITH_LENGTH for the second time, the engine
causes a segfault, because it tries to free memory it should
not:

(gdb) p *val
$1 = (zval *) 0x816db84
(gdb) p **val
$2 = {value = {lval = 0, dval = 0, str = {val = 0x0, len = 0}, ht = 0x0,
obj = {ce = 0x0, properties = 0x0}}, type = 0 '\0', is_ref = 1 '\001',
  refcount = 6}
641 ZEND_SET_SYMBOL_WITH_LENGTH(ht, str, str_len, 
*val,
(gdb) n
[Tue Jul 22 11:04:30 2003]  Script:  'f'
---
php-src/ext/session/session.c(642) : Block 0x0816DB60 status:
Beginning:  Overrun (magic=0x, expected=0x7312F8DC)

Program received signal SIGSEGV, Segmentation fault.
0x4010ca3c in memcpy () from /lib/libc.so.6

Testcase (without the IS_NULL check in migrate_global):

?php
$foo = $bar = $a;
@session_start();
$_SESSION['foo'] = $_SESSION['bar'] = $a;

- Sascha

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



Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Zeev Suraski
At 12:22 22/07/2003, Sascha Schumann wrote:
If it is not irregular, the engine code should be able to
deal with it correctly.  Right now, it falls over itself
quickly and dies ungracefully.
Then ZEND_SET_SYMBOL_WITH_LENGTH should be fixed.  I'm not sure who wrote 
it, but it wasn't Andi nor me.  The engine works with it properly, more 
than that, it completely relies on this behavior.

Zeev

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


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

2003-07-22 Thread Thies C. Arntzen
thies   Tue Jul 22 06:38:35 2003 EDT

  Modified files:  
/php-src/ext/oci8   oci8.c 
  Log:
  @ - Added optional Parameter to OCIWriteTemporaryLob which allows to
  @   specify the type of LOB you want to be written (OCI_TEMP_CLOB, OCI_TEMP_BLOB) 
  @   (Patch by Novicky Marek [EMAIL PROTECTED]) (Thies)
  
  
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.211 php-src/ext/oci8/oci8.c:1.212
--- php-src/ext/oci8/oci8.c:1.211   Sun Jun 22 10:33:03 2003
+++ php-src/ext/oci8/oci8.c Tue Jul 22 06:38:34 2003
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: oci8.c,v 1.211 2003/06/22 14:33:03 andrey Exp $ */
+/* $Id: oci8.c,v 1.212 2003/07/22 10:38:34 thies Exp $ */
 
 /* TODO list:
  *
@@ -560,6 +560,12 @@
REGISTER_LONG_CONSTANT(OCI_D_LOB,OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(OCI_D_ROWID,OCI_DTYPE_ROWID, CONST_CS | 
CONST_PERSISTENT);
 
+/* for OCIWriteTemporaryLob */
+#ifdef HAVE_OCI8_TEMP_LOB
+   REGISTER_LONG_CONSTANT(OCI_TEMP_CLOB,OCI_TEMP_CLOB, CONST_CS | 
CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(OCI_TEMP_BLOB,OCI_TEMP_BLOB, CONST_CS | 
CONST_PERSISTENT);
+#endif
+
return SUCCESS;
 }
 
@@ -641,7 +647,7 @@
 
php_info_print_table_start();
php_info_print_table_row(2, OCI8 Support, enabled);
-   php_info_print_table_row(2, Revision, $Revision: 1.211 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.212 $);
 #ifndef PHP_WIN32
php_info_print_table_row(2, Oracle Version, PHP_OCI8_VERSION );
php_info_print_table_row(2, Compile-time ORACLE_HOME, PHP_OCI8_DIR );
@@ -3432,17 +3438,18 @@
 /* }}} */
 
 #ifdef HAVE_OCI8_TEMP_LOB
-/* {{{ proto bool ociwritetemporarylob(string var)
+/* {{{ proto bool ociwritetemporarylob(string var [, int lob_type])
Writes temporary blob */
 
 PHP_FUNCTION(ociwritetemporarylob)
 {
-   zval *id, **var;
+   zval *id, *var;
OCILobLocator *mylob;
oci_connection *connection;
oci_descriptor *descr;
ub4 offset = 1;
ub4 loblen;
+   int lob_type = OCI_TEMP_CLOB;
 
oci_debug (oci_write_temporary_lob);
 
@@ -3462,11 +3469,10 @@
 
connection = descr-conn;
 
-   if (zend_get_parameters_ex(1, var) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (ZEND_NUM_ARGS()  1) WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|l, var, lob_type) 
== FAILURE) {
+   RETURN_FALSE;
}
-   /* is this convert needed - done again below */
-   convert_to_string_ex(var);
 
CALL_OCI_RETURN(connection-error, OCILobCreateTemporary(
connection-pServiceContext, 
@@ -3474,7 +3480,7 @@
mylob, 
OCI_DEFAULT, 
OCI_DEFAULT, 
-   OCI_TEMP_CLOB, 
+   lob_type, 
OCI_ATTR_NOCACHE, 
OCI_DURATION_SESSION));
 
@@ -3496,8 +3502,8 @@
RETURN_FALSE;
}
 
-   convert_to_string_ex(var);
-   loblen = Z_STRLEN_PP(var);
+   convert_to_string_ex(var);
+   loblen = Z_STRLEN_P(var);

if (loblen  1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot save a lob that is 
less than 1 byte);
@@ -3510,7 +3516,7 @@
mylob, 
(ub4 *) loblen, 
(ub4) offset, 
-   (dvoid *) Z_STRVAL_PP(var), 
+   (dvoid *) Z_STRVAL_P(var), 
(ub4) loblen, 
OCI_ONE_PIECE, 
(dvoid *)0, 



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



Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Sascha Schumann
On Tue, 22 Jul 2003, Zeev Suraski wrote:

 At 12:22 22/07/2003, Sascha Schumann wrote:
  If it is not irregular, the engine code should be able to
  deal with it correctly.  Right now, it falls over itself
  quickly and dies ungracefully.

 Then ZEND_SET_SYMBOL_WITH_LENGTH should be fixed.  I'm not sure who wrote
 it, but it wasn't Andi nor me.  The engine works with it properly, more
 than that, it completely relies on this behavior.

Where is this case (apparent optimization of undefined
variables) documented?

- Sascha

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



Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Sascha Schumann
On Tue, 22 Jul 2003, Zeev Suraski wrote:

 At 12:22 22/07/2003, Sascha Schumann wrote:
  If it is not irregular, the engine code should be able to
  deal with it correctly.  Right now, it falls over itself
  quickly and dies ungracefully.

 Then ZEND_SET_SYMBOL_WITH_LENGTH should be fixed.  I'm not sure who wrote
 it, but it wasn't Andi nor me.  The engine works with it properly, more
 than that, it completely relies on this behavior.

Btw, here is the annotated source code.

1.33 (andi 03-Dec-99): #define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, 
name_length, var, _refcount, _is_ref)
1.18 (zeev 30-Jul-99):  {
1.18 (zeev 30-Jul-99):  zval **orig_var;
1.18 (zeev 30-Jul-99):
1.19 (zeev 30-Jul-99):  if (zend_hash_find(symtable, (name), 
(name_length), (void **) orig_var)==SUCCESS
1.18 (zeev 30-Jul-99):   PZVAL_IS_REF(*orig_var)) {
1.30 (zeev 01-Dec-99):  (var)-refcount = 
(*orig_var)-refcount;
1.28 (andrei   18-Oct-99):  (var)-is_ref = 1;
1.18 (zeev 30-Jul-99):
1.31 (zeev 01-Dec-99):  if (_refcount) {
1.31 (zeev 01-Dec-99):  (var)-refcount += 
_refcount-1;
1.31 (zeev 01-Dec-99):  }
1.18 (zeev 30-Jul-99):  zval_dtor(*orig_var);
1.30 (zeev 01-Dec-99):  **orig_var = *(var);
1.44 (andi 24-Dec-99):  FREE_ZVAL(var);
1.18 (zeev 30-Jul-99):  } else {
1.32 (andi 02-Dec-99):  (var)-is_ref = _is_ref;
1.30 (zeev 01-Dec-99):  if (_refcount) {
1.30 (zeev 01-Dec-99):  (var)-refcount = 
_refcount;
1.30 (zeev 01-Dec-99):  }
1.30 (zeev 01-Dec-99):  zend_hash_update(symtable, 
(name), (name_length), (var), sizeof(zval *), NULL);
1.18 (zeev 30-Jul-99):  }
1.18 (zeev 30-Jul-99):  }


- Sascha

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



Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Zeev Suraski
At 13:46 22/07/2003, Sascha Schumann wrote:
On Tue, 22 Jul 2003, Zeev Suraski wrote:

 At 12:22 22/07/2003, Sascha Schumann wrote:
  If it is not irregular, the engine code should be able to
  deal with it correctly.  Right now, it falls over itself
  quickly and dies ungracefully.

 Then ZEND_SET_SYMBOL_WITH_LENGTH should be fixed.  I'm not sure who wrote
 it, but it wasn't Andi nor me.  The engine works with it properly, more
 than that, it completely relies on this behavior.
Where is this case (apparent optimization of undefined
variables) documented?
In the same place where the internals of your session module are documented.

Zeev

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


Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Zeev Suraski
At 13:49 22/07/2003, Sascha Schumann wrote:
On Tue, 22 Jul 2003, Zeev Suraski wrote:

 At 12:22 22/07/2003, Sascha Schumann wrote:
  If it is not irregular, the engine code should be able to
  deal with it correctly.  Right now, it falls over itself
  quickly and dies ungracefully.

 Then ZEND_SET_SYMBOL_WITH_LENGTH should be fixed.  I'm not sure who wrote
 it, but it wasn't Andi nor me.  The engine works with it properly, more
 than that, it completely relies on this behavior.
Btw, here is the annotated source code.
Ok, I guess I was the one who originally wrote it - it was a very long time 
ago.

Can you give me a concrete example of when you think this macro doesn't 
behave properly?  If it's correct, I'll try to fix it.  Note that the last 
time you had problems with this (and other) macros these were actually bugs 
in the session module.

Zeev

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


Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Sascha Schumann
 Can you give me a concrete example of when you think this macro doesn't
 behave properly?  If it's correct, I'll try to fix it.  Note that the last
 time you had problems with this (and other) macros these were actually bugs
 in the session module.

That was another instance showing the inherent lack of
abstraction in this particular API.  What should be a black
box is a test of familiarity with implementation details.

?php
$foo = $bar = $a;
@session_start();
$_SESSION['foo'] = $_SESSION['bar'] = $a;

All four zvals are initialized using an undefined variable.
During the shutdown phase, this occurs:

zval **val;

ht = Z_ARRVAL_P(PS(http_session_vars));

zend_hash_find(EG(symbol_table), foo, val);
ZEND_SET_SYMBOL_WITH_LENGTH(ht, foo, *val,
(*val)-refcount + 1 , 1);

zend_hash_find(EG(symbol_table), bar, val);

/* crash in FREE_ZVAL */
ZEND_SET_SYMBOL_WITH_LENGTH(ht, bar, *val,
(*val)-refcount + 1 , 1);

The contents of val at each stage can be seen here:

http://news.php.net/article.php?group=php.cvsarticle=22706

- Sascha

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



Re: [PHP-CVS] cvs: php-src(PHP_4_3) /ext/session session.c

2003-07-22 Thread Zeev Suraski
At 14:56 22/07/2003, Sascha Schumann wrote:
 Can you give me a concrete example of when you think this macro doesn't
 behave properly?  If it's correct, I'll try to fix it.  Note that the last
 time you had problems with this (and other) macros these were actually bugs
 in the session module.
That was another instance showing the inherent lack of
abstraction in this particular API.
Well, it was more of a misunderstanding on your part as to what you may and 
may not do with zvals which are managed by the engine.  Apparently, this is 
the very same issue right now.

  What should be a black
box is a test of familiarity with implementation details.
My English parser stuck on that one...

?php
$foo = $bar = $a;
@session_start();
$_SESSION['foo'] = $_SESSION['bar'] = $a;
All four zvals are initialized using an undefined variable.
During the shutdown phase, this occurs:
zval **val;

ht = Z_ARRVAL_P(PS(http_session_vars));

zend_hash_find(EG(symbol_table), foo, val);
ZEND_SET_SYMBOL_WITH_LENGTH(ht, foo, *val,
(*val)-refcount + 1 , 1);
zend_hash_find(EG(symbol_table), bar, val);

/* crash in FREE_ZVAL */
ZEND_SET_SYMBOL_WITH_LENGTH(ht, bar, *val,
(*val)-refcount + 1 , 1);
From a quick glance it appears to be the very same bug I told you about a 
few months ago.  Here's what I said back then:

---
The source of the problem is this:
1.  You fetch a value from the symbol table that has is_ref=0, and 
refcount1.  EG(uninit..) is quite a common example of that, but it's 
definitely not unique - $foo = $bar = baz; will create such a beast too.

2.  You tell zend_set_hash_symbol to make this value a reference.  That in 
itself is a bug - you most probably want to attach only to one symbol, and 
not to other symbols who might be pointing to the same value.

3.  Things really turn for the worse when EG(uninit..) becomes is_ref - 
that may cause all sorts of unexpected problems.

What should be done is SEPARATE_ZVAL() on the symbol, prior to calling 
zend_set_hash_symbol().  As a matter of fact, chances are that we'd want 
SEPARATE_ZVAL() to be inside zend_set_hash_symbol() - I can't imagine a 
situation where we'd be in a position to enable/disable the is_ref bit 
arbitrarily without separating first.
---

ZEND_SET_SYMBOL_WITH_LENGTH() was not designed to handle zvals which are 
already managed by the engine, but to introduce new zvals (you can see that 
it's being used by the various SET_VAR_*() macros, and was actually 
introduced to abstract them).  It overwrites certain properties, such as 
the reference count and is_ref without taking into account the values that 
were in there before.

For the record, there's nothing special about uninitialized_zval as far as 
these macros are concerned, even though doing the wrong thing on 
uninitialized_zval may have a more noticeable effect.   A reference count 
higher than 1 with is_ref being 0 is perfectly normal, and like I told you 
last time around - can happen with things as simple as 
$a=$b=foo;  Changing such a value to is_ref=1 (i.e., calling 
ZEND_SET_SYMBOL on that value, and providing is_ref=1) is almost definitely 
NOT what you want to do.  The reason this macro argument is there to begin 
with is,
again, because it was designed to introduce new values.

The bottom line is that you should simply SEPARATE this zval (probably 
SEPARATE_IF_NOT_REF) before you send it back into the engine.

Zeev

--
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/curl curl.dsp

2003-07-22 Thread Edin Kadribasic
edink   Tue Jul 22 08:34:38 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/curl   curl.dsp 
  Log:
  New curl lib needs additional libs to link (#24725)
  
Index: php-src/ext/curl/curl.dsp
diff -u php-src/ext/curl/curl.dsp:1.4 php-src/ext/curl/curl.dsp:1.4.8.1
--- php-src/ext/curl/curl.dsp:1.4   Thu Oct 18 13:47:35 2001
+++ php-src/ext/curl/curl.dsp   Tue Jul 22 08:34:38 2003
@@ -113,7 +113,7 @@
 LINK32=link.exe
 # ADD BASE LINK32 php4ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 
/nodefaultlib:msvcrtd.lib /out:..\..\Debug_TS/php_curl.dll 
/libpath:..\..\Debug_TS
 # SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib 
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll 
/incremental:yes /debug /machine:I386 /nodefaultlib:MSVCRTD 
/out:..\..\Debug_TS/php_curl.dll /libpath:..\..\Debug_TS 
/libpath:..\..\..\php_build\curl\lib
+# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib 
ws2_32.lib winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib 
odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 
/nodefaultlib:MSVCRTD /out:..\..\Debug_TS/php_curl.dll /libpath:..\..\Debug_TS 
/libpath:..\..\..\php_build\curl\lib
 # SUBTRACT LINK32 /pdb:none /nodefaultlib
 
 !ELSEIF  $(CFG) == curl - Win32 Release_TS_SSL
@@ -142,7 +142,7 @@
 LINK32=link.exe
 # ADD BASE LINK32 php4ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:msvcrt.lib 
/out:..\..\Release_TS/php_curl.dll /libpath:..\..\Release_TS 
/libpath:..\..\Release_TS_Inline
 # SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib 
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 
/nodefaultlib:MSVCRT /out:..\..\Release_TS/php_curl.dll 
/libpath:..\..\Release_TS /libpath:..\..\Release_TS_Inline 
/libpath:..\..\..\php_build\curl\lib
+# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib ws2_32.lib 
winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 
wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:MSVCRT 
/out:..\..\Release_TS/php_curl.dll /libpath:..\..\Release_TS 
/libpath:..\..\Release_TS_Inline /libpath:..\..\..\php_build\curl\lib
 # SUBTRACT LINK32 /pdb:none
 
 !ENDIF 



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



[PHP-CVS] cvs: php-src /ext/curl curl.dsp

2003-07-22 Thread Edin Kadribasic
edink   Tue Jul 22 08:36:59 2003 EDT

  Modified files:  
/php-src/ext/curl   curl.dsp 
  Log:
  MFB
  
Index: php-src/ext/curl/curl.dsp
diff -u php-src/ext/curl/curl.dsp:1.5 php-src/ext/curl/curl.dsp:1.6
--- php-src/ext/curl/curl.dsp:1.5   Wed Nov 13 17:25:33 2002
+++ php-src/ext/curl/curl.dsp   Tue Jul 22 08:36:59 2003
@@ -113,7 +113,7 @@
 LINK32=link.exe
 # ADD BASE LINK32 php4ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 
/nodefaultlib:msvcrtd.lib /out:..\..\Debug_TS/php_curl.dll 
/libpath:..\..\Debug_TS
 # SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib 
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll 
/incremental:yes /debug /machine:I386 /nodefaultlib:MSVCRTD 
/out:..\..\Debug_TS/php_curl.dll /libpath:..\..\Debug_TS 
/libpath:..\..\..\php_build\curl\lib
+# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib 
ws2_32.lib winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib 
odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 
/nodefaultlib:MSVCRTD /out:..\..\Debug_TS/php_curl.dll /libpath:..\..\Debug_TS 
/libpath:..\..\..\php_build\curl\lib
 # SUBTRACT LINK32 /pdb:none /nodefaultlib
 
 !ELSEIF  $(CFG) == curl - Win32 Release_TS_SSL
@@ -142,7 +142,7 @@
 LINK32=link.exe
 # ADD BASE LINK32 php4ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:msvcrt.lib 
/out:..\..\Release_TS/php_curl.dll /libpath:..\..\Release_TS 
/libpath:..\..\Release_TS_Inline
 # SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib 
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 
/nodefaultlib:MSVCRT /out:..\..\Release_TS/php_curl.dll 
/libpath:..\..\Release_TS /libpath:..\..\Release_TS_Inline 
/libpath:..\..\..\php_build\curl\lib
+# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib ws2_32.lib 
winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 
wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:MSVCRT 
/out:..\..\Release_TS/php_curl.dll /libpath:..\..\Release_TS 
/libpath:..\..\Release_TS_Inline /libpath:..\..\..\php_build\curl\lib
 # SUBTRACT LINK32 /pdb:none
 
 !ENDIF 



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



[PHP-CVS] cvs: php-src /ext/dom document.c php_dom.c xml_common.h

2003-07-22 Thread Zeev Suraski
zeevTue Jul 22 09:50:00 2003 EDT

  Modified files:  
/php-src/ext/domdocument.c php_dom.c xml_common.h 
  Log:
  API update
  
  
Index: php-src/ext/dom/document.c
diff -u php-src/ext/dom/document.c:1.15 php-src/ext/dom/document.c:1.16
--- php-src/ext/dom/document.c:1.15 Sat Jul 19 10:59:29 2003
+++ php-src/ext/dom/document.c  Tue Jul 22 09:50:00 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: document.c,v 1.15 2003/07/19 14:59:29 rrichards Exp $ */
+/* $Id: document.c,v 1.16 2003/07/22 13:50:00 zeev Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -97,7 +97,7 @@
ZVAL_STRING(member, property, 1);
 
std_hnd = zend_get_std_object_handlers();
-   format = std_hnd-read_property(id, member TSRMLS_CC);
+   format = std_hnd-read_property(id, member, 0 TSRMLS_CC);
 
if (format-type == IS_BOOL) {
retformat = Z_BVAL_P(format);
Index: php-src/ext/dom/php_dom.c
diff -u php-src/ext/dom/php_dom.c:1.19 php-src/ext/dom/php_dom.c:1.20
--- php-src/ext/dom/php_dom.c:1.19  Sat Jul 19 10:59:29 2003
+++ php-src/ext/dom/php_dom.c   Tue Jul 22 09:50:00 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: php_dom.c,v 1.19 2003/07/19 14:59:29 rrichards Exp $ */
+/* $Id: php_dom.c,v 1.20 2003/07/22 13:50:00 zeev Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -272,7 +272,7 @@
 /* }}} */
 
 /* {{{ dom_read_property */
-zval *dom_read_property(zval *object, zval *member TSRMLS_DC)
+zval *dom_read_property(zval *object, zval *member, zend_bool silent TSRMLS_DC)
 {
dom_object *obj;
zval tmp_member;
@@ -305,7 +305,7 @@
}
} else {
std_hnd = zend_get_std_object_handlers();
-   retval = std_hnd-read_property(object, member TSRMLS_CC);
+   retval = std_hnd-read_property(object, member, silent TSRMLS_CC);
}
 
if (member == tmp_member) {
Index: php-src/ext/dom/xml_common.h
diff -u php-src/ext/dom/xml_common.h:1.10 php-src/ext/dom/xml_common.h:1.11
--- php-src/ext/dom/xml_common.h:1.10   Mon Jul  7 15:37:32 2003
+++ php-src/ext/dom/xml_common.hTue Jul 22 09:50:00 2003
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: xml_common.h,v 1.10 2003/07/07 19:37:32 rrichards Exp $ */
+/* $Id: xml_common.h,v 1.11 2003/07/22 13:50:00 zeev Exp $ */
 
 #ifndef PHP_XML_COMMON_H
 #define PHP_XML_COMMON_H
@@ -61,7 +61,7 @@
 #define PHP_DOM_EXPORT(__type) PHPAPI __type
 
 PHP_DOM_EXPORT(zval *) php_dom_create_object(xmlNodePtr obj, int *found, zval *in, 
zval* return_value, dom_object *domobj TSRMLS_DC);
-PHP_DOM_EXPORT(zval *) dom_read_property(zval *object, zval *member TSRMLS_DC);
+PHP_DOM_EXPORT(zval *) dom_read_property(zval *object, zval *member, zend_bool silent 
TSRMLS_DC);
 PHP_DOM_EXPORT(void) dom_write_property(zval *object, zval *member, zval *value 
TSRMLS_DC);
 
 #define DOM_XMLNS_NAMESPACE \



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



[PHP-CVS] cvs: php-src /tests/lang bug24436.phpt

2003-07-22 Thread Zeev Suraski
zeevTue Jul 22 09:54:46 2003 EDT

  Added files: 
/php-src/tests/lang bug24436.phpt 
  Log:
  Add test
  
  

Index: php-src/tests/lang/bug24436.phpt
+++ php-src/tests/lang/bug24436.phpt
--TEST--
Bug #24436 (isset() and empty() produce errors with non-existent variables in objects)
--FILE--
?php
class test {
function __construct() {
if (empty($this-test[0][0])) { print test1;}
if (!isset($this-test[0][0])) { print test2;}
}
}

$test1 = new test();
?
--EXPECT--
test1test2



-- 
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) /main main.c

2003-07-22 Thread Zeev Suraski
zeevTue Jul 22 11:46:48 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/main   main.c 
  Log:
  Fix potential crash (zend_hash_get_current_key_ex() doesn't touch the string 
arguments if
  the key is not a string!)
  
  
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.512.2.42 php-src/main/main.c:1.512.2.43
--- php-src/main/main.c:1.512.2.42  Fri Jun 20 13:00:16 2003
+++ php-src/main/main.c Tue Jul 22 11:46:48 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.512.2.42 2003/06/20 17:00:16 iliaa Exp $ */
+/* $Id: main.c,v 1.512.2.43 2003/07/22 15:46:48 zeev Exp $ */
 
 /* {{{ includes
  */
@@ -1337,9 +1337,9 @@
zend_hash_internal_pointer_reset_ex(src, pos);
while (zend_hash_get_current_data_ex(src, (void **)src_entry, pos) == 
SUCCESS) {
key_type = zend_hash_get_current_key_ex(src, string_key, 
string_key_len, num_key, 0, pos);
-   if (Z_TYPE_PP(src_entry) != IS_ARRAY || 
-   (string_key_len  zend_hash_find(dest, string_key, 
string_key_len, (void **)dest_entry) != SUCCESS) ||
-   (!string_key_len  zend_hash_index_find(dest, 
num_key, (void **)dest_entry) != SUCCESS)
+   if (Z_TYPE_PP(src_entry) != IS_ARRAY
+   || (key_type==HASH_KEY_IS_STRING  
zend_hash_find(dest, string_key, string_key_len, (void **)dest_entry) != SUCCESS)
+   || (key_type==HASH_KEY_IS_LONG  
zend_hash_index_find(dest, num_key, (void **)dest_entry) != SUCCESS)
|| Z_TYPE_PP(dest_entry) != IS_ARRAY) {
(*src_entry)-refcount++;
if (key_type == HASH_KEY_IS_STRING) {



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



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

2003-07-22 Thread Ilia Alshanetsky
iliaa   Tue Jul 22 12:05:33 2003 EDT

  Modified files:  
/php-src/ext/mysql  php_mysql.c 
  Log:
  * Fixed bug #24535 (Crash when retrieving data from unbuffered result after
  the original connection has been changed).
  * Fixed a crash when trying to fetch an unbuffered result after 
  mysql_close() has been called.
  * Added a check to make sure no unbuffered results are inside the buffer 
  when calling functions that internally execute a query. Affected functions 
  are: mysql_select_db(), mysql_list_dbs(), mysql_list_tables(), 
  mysql_list_processes(), mysql_list_fields(), mysql_stat() and mysql_ping().
  * Do not re-select a database if the database to be selected is the same.
  
  
Index: php-src/ext/mysql/php_mysql.c
diff -u php-src/ext/mysql/php_mysql.c:1.195 php-src/ext/mysql/php_mysql.c:1.196
--- php-src/ext/mysql/php_mysql.c:1.195 Wed Jun 18 11:19:16 2003
+++ php-src/ext/mysql/php_mysql.c   Tue Jul 22 12:05:32 2003
@@ -18,7 +18,7 @@
+--+
 */
  
-/* $Id: php_mysql.c,v 1.195 2003/06/18 15:19:16 iliaa Exp $ */
+/* $Id: php_mysql.c,v 1.196 2003/07/22 16:05:32 iliaa Exp $ */
 
 /* TODO:
  *
@@ -222,6 +222,26 @@
 
 #define CHECK_LINK(link) { if (link==-1) { php_error_docref(NULL TSRMLS_CC, 
E_WARNING, A link to the server could not be established); RETURN_FALSE; } }
 
+#define PHPMY_UNBUFFERED_QUERY_CHECK() \
+{  \
+   if (mysql-active_result_id) {  \
+   do {\
+   int type;   \
+   MYSQL_RES *mysql_result;\
+   \
+   mysql_result = (MYSQL_RES *) 
zend_list_find(mysql-active_result_id, type);\
+   if (mysql_result  type==le_result) { 
 \
+   if (!mysql_eof(mysql_result)) {
 \
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Function called without first fetching all rows from a previous unbuffered query); \
+   while (mysql_fetch_row(mysql_result));  \
+   }   \
+   zend_list_delete(mysql-active_result_id);  \
+   mysql-active_result_id = 0;\
+   }   \
+   } while(0); \
+   }   \
+}  \
+
 /* {{{ _free_mysql_result
  * This wrapper is required since mysql_free_result() returns an integer, and
  * thus, cannot be used directly
@@ -239,14 +259,30 @@
  */
 static void php_mysql_set_default_link(int id TSRMLS_DC)
 {
-   if (MySG(default_link)!=-1) {
-   zend_list_delete(MySG(default_link));
-   }
MySG(default_link) = id;
zend_list_addref(id);
 }
 /* }}} */
 
+/* {{{ php_mysql_select_db
+*/
+static int php_mysql_select_db(php_mysql_conn *mysql, char *db TSRMLS_DC)
+{
+   /* a small optimization to avoid selecting the database if it is already 
selected */
+   if (mysql-conn.db  !strcmp(mysql-conn.db, db)) {
+   return 1;
+   } else {
+   PHPMY_UNBUFFERED_QUERY_CHECK();
+
+   if (mysql_select_db(mysql-conn, db) != 0) {
+   return 0;
+   } else {
+   return 1;
+   }
+   }
+}
+/* }}} */
+
 /* {{{ _close_mysql_link
  */
 static void _close_mysql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
@@ -833,11 +869,13 @@
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, MySQL-Link, 
le_link, le_plink);
 
if (id==-1) { /* explicit resource number */
+   PHPMY_UNBUFFERED_QUERY_CHECK();
zend_list_delete(Z_RESVAL_PP(mysql_link));
}
 
if (id!=-1 
|| (mysql_link  Z_RESVAL_PP(mysql_link)==MySG(default_link))) {
+   PHPMY_UNBUFFERED_QUERY_CHECK();
zend_list_delete(MySG(default_link));
MySG(default_link) = -1;
}
@@ -877,10 +915,10 @@

convert_to_string_ex(db);
 
-   if (mysql_select_db(mysql-conn, Z_STRVAL_PP(db))!=0) {
-   RETVAL_FALSE;
+   if (php_mysql_select_db(mysql, Z_STRVAL_PP(db) TSRMLS_CC)) {
+   RETURN_TRUE;
} else {
-   RETVAL_TRUE;
+   RETURN_FALSE;   
}
 }
 /* }}} */
@@ -1057,6 +1095,8 @@
}
ZEND_FETCH_RESOURCE2(mysql, 

[PHP-CVS] cvs: php-src(PHP_4_3) /ext/mysql php_mysql.c

2003-07-22 Thread Ilia Alshanetsky
iliaa   Tue Jul 22 12:06:09 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/mysql  php_mysql.c 
  Log:
  MFH: r1.196: mysql_fixes
  
  
Index: php-src/ext/mysql/php_mysql.c
diff -u php-src/ext/mysql/php_mysql.c:1.174.2.19 
php-src/ext/mysql/php_mysql.c:1.174.2.20
--- php-src/ext/mysql/php_mysql.c:1.174.2.19Wed Jun 18 11:19:28 2003
+++ php-src/ext/mysql/php_mysql.c   Tue Jul 22 12:06:09 2003
@@ -18,7 +18,7 @@
+--+
 */
  
-/* $Id: php_mysql.c,v 1.174.2.19 2003/06/18 15:19:28 iliaa Exp $ */
+/* $Id: php_mysql.c,v 1.174.2.20 2003/07/22 16:06:09 iliaa Exp $ */
 
 /* TODO:
  *
@@ -222,6 +222,26 @@
 
 #define CHECK_LINK(link) { if (link==-1) { php_error_docref(NULL TSRMLS_CC, 
E_WARNING, A link to the server could not be established); RETURN_FALSE; } }
 
+#define PHPMY_UNBUFFERED_QUERY_CHECK() \
+{  \
+   if (mysql-active_result_id) {  \
+   do {\
+   int type;   \
+   MYSQL_RES *mysql_result;\
+   \
+   mysql_result = (MYSQL_RES *) 
zend_list_find(mysql-active_result_id, type);\
+   if (mysql_result  type==le_result) { 
 \
+   if (!mysql_eof(mysql_result)) {
 \
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Function called without first fetching all rows from a previous unbuffered query); \
+   while (mysql_fetch_row(mysql_result));  \
+   }   \
+   zend_list_delete(mysql-active_result_id);  \
+   mysql-active_result_id = 0;\
+   }   \
+   } while(0); \
+   }   \
+}  \
+
 /* {{{ _free_mysql_result
  * This wrapper is required since mysql_free_result() returns an integer, and
  * thus, cannot be used directly
@@ -239,14 +259,30 @@
  */
 static void php_mysql_set_default_link(int id TSRMLS_DC)
 {
-   if (MySG(default_link)!=-1) {
-   zend_list_delete(MySG(default_link));
-   }
MySG(default_link) = id;
zend_list_addref(id);
 }
 /* }}} */
 
+/* {{{ php_mysql_select_db
+*/
+static int php_mysql_select_db(php_mysql_conn *mysql, char *db TSRMLS_DC)
+{
+   /* a small optimization to avoid selecting the database if it is already 
selected */
+   if (mysql-conn.db  !strcmp(mysql-conn.db, db)) {
+   return 1;
+   } else {
+   PHPMY_UNBUFFERED_QUERY_CHECK();
+
+   if (mysql_select_db(mysql-conn, db) != 0) {
+   return 0;
+   } else {
+   return 1;
+   }
+   }
+}
+/* }}} */
+
 /* {{{ _close_mysql_link
  */
 static void _close_mysql_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
@@ -833,11 +869,13 @@
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, MySQL-Link, 
le_link, le_plink);
 
if (id==-1) { /* explicit resource number */
+   PHPMY_UNBUFFERED_QUERY_CHECK();
zend_list_delete(Z_RESVAL_PP(mysql_link));
}
 
if (id!=-1 
|| (mysql_link  Z_RESVAL_PP(mysql_link)==MySG(default_link))) {
+   PHPMY_UNBUFFERED_QUERY_CHECK();
zend_list_delete(MySG(default_link));
MySG(default_link) = -1;
}
@@ -877,10 +915,10 @@

convert_to_string_ex(db);
 
-   if (mysql_select_db(mysql-conn, Z_STRVAL_PP(db))!=0) {
-   RETVAL_FALSE;
+   if (php_mysql_select_db(mysql, Z_STRVAL_PP(db) TSRMLS_CC)) {
+   RETURN_TRUE;
} else {
-   RETVAL_TRUE;
+   RETURN_FALSE;   
}
 }
 /* }}} */
@@ -1057,6 +1095,8 @@
}
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, MySQL-Link, 
le_link, le_plink);
 
+   PHPMY_UNBUFFERED_QUERY_CHECK();
+
RETURN_STRING((char *)mysql_stat(mysql-conn), 1);
 }
 /* }}} */
@@ -1115,10 +1155,11 @@
}
 
php_error_docref(NULL TSRMLS_CC, E_NOTICE, This function is deprecated, 
please use mysql_query() to issue a SQL CREATE DATABASE statement instead.);
-

ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, MySQL-Link, 
le_link, le_plink);
-   
+
+   

[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS

2003-07-22 Thread Ilia Alshanetsky
iliaa   Tue Jul 22 12:07:01 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
  Log:
  BFN
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.294 php-src/NEWS:1.1247.2.295
--- php-src/NEWS:1.1247.2.294   Mon Jul 21 21:39:52 2003
+++ php-src/NEWSTue Jul 22 12:07:01 2003
@@ -18,6 +18,8 @@
 - Fixed bug #24560 (parse_url() incorrectly handling certain file:// based 
   schemas). (Ilia)
 - Fixed bug #24537 (apache2 compile misses some include directories). (Jani)
+- Fixed bug #24535 (Crash when retrieving data from unbuffered result after
+  the original connection has been changed). (Ilia)
 - Fixed bug #24519 (aggregate_methods_by_list() does not increment refcount).
 - Fixed bug #24313 (file_exist() warning on non-existent files when
   open_basedir is used). (Ilia)



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



[PHP-CVS] cvs: php-src /ext/standard array.c /main php_variables.c

2003-07-22 Thread Zeev Suraski
zeevTue Jul 22 12:08:50 2003 EDT

  Modified files:  
/php-src/ext/standard   array.c 
/php-src/main   php_variables.c 
  Log:
  - Use the new infrastructure of zend_symtable_*() (fixes bug #24565)
  - Fix bogus use of get_current_key()
  
  
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.234 php-src/ext/standard/array.c:1.235
--- php-src/ext/standard/array.c:1.234  Mon Jun 16 13:35:16 2003
+++ php-src/ext/standard/array.cTue Jul 22 12:08:49 2003
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.234 2003/06/16 17:35:16 iliaa Exp $ */
+/* $Id: array.c,v 1.235 2003/07/22 16:08:49 zeev Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -3643,11 +3643,7 @@
 
switch (Z_TYPE_PP(key)) {
case IS_STRING:
-   if (zend_is_numeric_key(*key, lvalue)) {
-   if (zend_hash_index_exists(HASH_OF(*array), lvalue)) {
-   RETURN_TRUE;
-   }
-   } else if (zend_hash_exists(HASH_OF(*array), Z_STRVAL_PP(key), 
Z_STRLEN_PP(key)+1)) {
+   if (zend_symtable_exists(HASH_OF(*array), Z_STRVAL_PP(key), 
Z_STRLEN_PP(key)+1)) {
RETURN_TRUE;
}
RETURN_FALSE;
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.65 php-src/main/php_variables.c:1.66
--- php-src/main/php_variables.c:1.65   Mon Jul 21 13:42:24 2003
+++ php-src/main/php_variables.cTue Jul 22 12:08:50 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php_variables.c,v 1.65 2003/07/21 17:42:24 zeev Exp $ */
+/* $Id: php_variables.c,v 1.66 2003/07/22 16:08:50 zeev Exp $ */
 
 #include stdio.h
 #include php.h
@@ -152,11 +152,11 @@
} else {
escaped_index = index;
}
-   if (zend_hash_find(symtable1, escaped_index, 
index_len+1, (void **) gpc_element_p)==FAILURE
+   if (zend_symtable_find(symtable1, escaped_index, 
index_len+1, (void **) gpc_element_p)==FAILURE
|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
MAKE_STD_ZVAL(gpc_element);
array_init(gpc_element);
-   zend_hash_update(symtable1, escaped_index, 
index_len+1, gpc_element, sizeof(zval *), (void **) gpc_element_p);
+   zend_symtable_update(symtable1, escaped_index, 
index_len+1, gpc_element, sizeof(zval *), (void **) gpc_element_p);
}
if (index!=escaped_index) {
efree(escaped_index);
@@ -182,7 +182,7 @@
if (!index) {
zend_hash_next_index_insert(symtable1, gpc_element, 
sizeof(zval *), (void **) gpc_element_p);
} else {
-   zend_hash_update(symtable1, index, index_len+1, 
gpc_element, sizeof(zval *), (void **) gpc_element_p);
+   zend_symtable_update(symtable1, index, index_len+1, 
gpc_element, sizeof(zval *), (void **) gpc_element_p);
}
break;
}
@@ -498,20 +498,20 @@
  */
 static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
 {
-   zval**src_entry, **dest_entry;
-   char *string_key;
-   uint  string_key_len;
-   ulong num_key;
-   HashPosition  pos;
-   int   key_type;
+   zval **src_entry, **dest_entry;
+   char *string_key;
+   uint string_key_len;
+   ulong num_key;
+   HashPosition pos;
+   int key_type;
 
zend_hash_internal_pointer_reset_ex(src, pos);
while (zend_hash_get_current_data_ex(src, (void **)src_entry, pos) == 
SUCCESS) {
key_type = zend_hash_get_current_key_ex(src, string_key, 
string_key_len, num_key, 0, pos);
-   if (Z_TYPE_PP(src_entry) != IS_ARRAY || 
-   (string_key_len  zend_hash_find(dest, string_key, 
string_key_len, (void **)dest_entry) != SUCCESS) ||
-   (!string_key_len  zend_hash_index_find(dest, 
num_key, (void **)dest_entry) != SUCCESS)
-   || Z_TYPE_PP(dest_entry) != IS_ARRAY) {
+   if (Z_TYPE_PP(src_entry) != IS_ARRAY
+   || (key_type==HASH_KEY_IS_STRING  zend_hash_find(dest, 
string_key, string_key_len, (void **) dest_entry) != SUCCESS)
+   || 

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

2003-07-22 Thread Marcus Brger
Hello Jani,

Tuesday, July 22, 2003, 10:47:37 AM, you wrote:


JT MFH?

No, it seems the request is very old but we need to discuss it a bit further
on the postgres list...

Best regards,
 Marcusmailto:[EMAIL PROTECTED]


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



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

2003-07-22 Thread Marcus Boerger
helly   Tue Jul 22 17:12:32 2003 EDT

  Modified files:  
/php-src/ext/pgsql  pgsql.c 
  Log:
  Postgres decision on this
  
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.281 php-src/ext/pgsql/pgsql.c:1.282
--- php-src/ext/pgsql/pgsql.c:1.281 Mon Jul 21 16:53:00 2003
+++ php-src/ext/pgsql/pgsql.c   Tue Jul 22 17:12:32 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.281 2003/07/21 20:53:00 helly Exp $ */
+/* $Id: pgsql.c,v 1.282 2003/07/22 21:12:32 helly Exp $ */
 
 #include stdlib.h
 
@@ -626,7 +626,7 @@
}
if (atof(PG_VERSION) = 7.2) {
PGresult *pg_result;
-   pg_result = PQexec(le-ptr, RESET ALL);
+   pg_result = PQexec(le-ptr, BEGIN;COMMIT;RESET ALL;);
PQclear(pg_result);
}
pgsql = (PGconn *) le-ptr;



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



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

2003-07-22 Thread Marcus Boerger
helly   Tue Jul 22 18:05:46 2003 EDT

  Modified files:  
/php-src/ext/pgsql  pgsql.c 
  Log:
  The value might be a null pointer
  
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.282 php-src/ext/pgsql/pgsql.c:1.283
--- php-src/ext/pgsql/pgsql.c:1.282 Tue Jul 22 17:12:32 2003
+++ php-src/ext/pgsql/pgsql.c   Tue Jul 22 18:05:46 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.282 2003/07/22 21:12:32 helly Exp $ */
+/* $Id: pgsql.c,v 1.283 2003/07/22 22:05:46 helly Exp $ */
 
 #include stdlib.h
 
@@ -834,8 +834,13 @@
default:
RETURN_FALSE;
}
-   Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
-   Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value));
+   if (Z_STRVAL_P(return_value)) {
+   Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
+   Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value));
+   } else {
+   Z_STRLEN_P(return_value) = 0;
+   Z_STRVAL_P(return_value) = (char *) estrdup();
+   }
Z_TYPE_P(return_value) = IS_STRING;
 }
 /* }}} */



-- 
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/pgsql pgsql.c

2003-07-22 Thread Marcus Boerger
helly   Tue Jul 22 18:06:05 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/pgsql  pgsql.c 
  Log:
  MFH: The value might be a null pointer
  
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.244.2.19 php-src/ext/pgsql/pgsql.c:1.244.2.20
--- php-src/ext/pgsql/pgsql.c:1.244.2.19Sun Jun 22 12:48:16 2003
+++ php-src/ext/pgsql/pgsql.c   Tue Jul 22 18:06:05 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.244.2.19 2003/06/22 16:48:16 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.244.2.20 2003/07/22 22:06:05 helly Exp $ */
 
 #include stdlib.h
 
@@ -804,9 +804,13 @@
default:
RETURN_FALSE;
}
-   Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
-   Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value));
-   Z_TYPE_P(return_value) = IS_STRING;
+   if (Z_STRVAL_P(return_value)) {
+   Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
+   Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value));
+   } else {
+   Z_STRLEN_P(return_value) = 0;
+   Z_STRVAL_P(return_value) = (char *) estrdup();
+   }
 }
 /* }}} */
 



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



[PHP-CVS] cvs: php-src /ext/pgsql config.m4 pgsql.c php_pgsql.h

2003-07-22 Thread Marcus Boerger
helly   Tue Jul 22 19:05:17 2003 EDT

  Modified files:  
/php-src/ext/pgsql  config.m4 php_pgsql.h pgsql.c 
  Log:
  Added pg_version() which returns an associative array of client/protocol/server
  version.
  @Added pg_version() function. (Marcus)
  
  
Index: php-src/ext/pgsql/config.m4
diff -u php-src/ext/pgsql/config.m4:1.34 php-src/ext/pgsql/config.m4:1.35
--- php-src/ext/pgsql/config.m4:1.34Wed Jun 26 09:07:40 2002
+++ php-src/ext/pgsql/config.m4 Tue Jul 22 19:05:17 2003
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.34 2002/06/26 13:07:40 derick Exp $
+dnl $Id: config.m4,v 1.35 2003/07/22 23:05:17 helly Exp $
 dnl
 
 AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[
@@ -57,6 +57,8 @@
   AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq under 
windows]))
   AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL]))
   AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 
7.0.x or later]))
+  AC_CHECK_LIB(pq, PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 
7.4 or later]))
+  AC_CHECK_LIB(pq, PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 
7.4 or later]))
   AC_CHECK_LIB(pq, 
pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is 
compiled with --enable-multibye]))
   LIBS=$old_LIBS
   LDFLAGS=$old_LDFLAGS
Index: php-src/ext/pgsql/php_pgsql.h
diff -u php-src/ext/pgsql/php_pgsql.h:1.62 php-src/ext/pgsql/php_pgsql.h:1.63
--- php-src/ext/pgsql/php_pgsql.h:1.62  Tue Jun 10 16:03:35 2003
+++ php-src/ext/pgsql/php_pgsql.h   Tue Jul 22 19:05:17 2003
@@ -17,7 +17,7 @@
+--+
  */
  
-/* $Id: php_pgsql.h,v 1.62 2003/06/10 20:03:35 imajes Exp $ */
+/* $Id: php_pgsql.h,v 1.63 2003/07/22 23:05:17 helly Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
@@ -71,6 +71,7 @@
 PHP_FUNCTION(pg_port);
 PHP_FUNCTION(pg_tty);
 PHP_FUNCTION(pg_options);
+PHP_FUNCTION(pg_version);
 PHP_FUNCTION(pg_ping);
 /* query functions */
 PHP_FUNCTION(pg_query);
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.283 php-src/ext/pgsql/pgsql.c:1.284
--- php-src/ext/pgsql/pgsql.c:1.283 Tue Jul 22 18:05:46 2003
+++ php-src/ext/pgsql/pgsql.c   Tue Jul 22 19:05:17 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.283 2003/07/22 22:05:46 helly Exp $ */
+/* $Id: pgsql.c,v 1.284 2003/07/22 23:05:17 helly Exp $ */
 
 #include stdlib.h
 
@@ -88,6 +88,7 @@
PHP_FE(pg_port, NULL)
PHP_FE(pg_tty,  NULL)
PHP_FE(pg_options,  NULL)
+   PHP_FE(pg_version,  NULL)
PHP_FE(pg_ping, NULL)
/* query functions */
PHP_FE(pg_query,NULL)
@@ -782,6 +783,7 @@
 #define PHP_PG_PORT 4
 #define PHP_PG_TTY 5
 #define PHP_PG_HOST 6
+#define PHP_PG_VERSION 7
 
 /* {{{ php_pgsql_get_link_info
  */
@@ -831,6 +833,18 @@
case PHP_PG_HOST:
Z_STRVAL_P(return_value) = PQhost(pgsql);
break;
+   case PHP_PG_VERSION:
+   array_init(return_value);
+   add_assoc_string(return_value, client, PG_VERSION, 1);
+#if HAVE_PQPROTOCOLVERSION
+   add_assoc_long(return_value, protocol, 
PQprotocolVersion(pgsql));
+#if HAVE_PQPARAMETERSTATUS
+   if (PQprotocolVersion(pgsql) = 3) {
+   add_assoc_string(return_value, server, 
PQparameterStatus(pgsql, server_version), 1);
+   }
+#endif
+#endif
+   return;
default:
RETURN_FALSE;
}
@@ -890,6 +904,14 @@
 PHP_FUNCTION(pg_host)
 {
php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_HOST);
+}
+/* }}} */
+
+/* {{{ proto array pg_version([resource connection])
+   Returns an array with client, protocol and server version (when available) */
+PHP_FUNCTION(pg_version)
+{
+   php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_VERSION);
 }
 /* }}} */
 



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



[PHP-CVS] cvs: php-src /ext/gd/tests bug24594.phpt

2003-07-22 Thread Pierre-Alain Joye
pajoye  Tue Jul 22 20:17:30 2003 EDT

  Modified files:  
/php-src/ext/gd/tests   bug24594.phpt 
  Log:
  - Remove imagepng, not used in test
  
  
Index: php-src/ext/gd/tests/bug24594.phpt
diff -u php-src/ext/gd/tests/bug24594.phpt:1.1 php-src/ext/gd/tests/bug24594.phpt:1.2
--- php-src/ext/gd/tests/bug24594.phpt:1.1  Tue Jul 22 20:11:33 2003
+++ php-src/ext/gd/tests/bug24594.phpt  Tue Jul 22 20:17:29 2003
@@ -51,7 +51,7 @@
$res .= imagecolorat($base,14,16)==$black?'1':'0';
$res .= imagecolorat($base,15,17)==$black?'1':'0';
echo $res\n;
-   imagepng($base,filled1.png);
+
imagefilledrectangle($base,0,0,149,149,$white);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
@@ -79,7 +79,6 @@
$res .= imagecolorat($base,0,0)==$black?'1':'0';
 
echo $res\n;
-   imagepng($base,filled.png);
 ?
 --EXPECT--
 0011101010



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



[PHP-CVS] cvs: php-src /ext/gd/tests bug24594.phpt

2003-07-22 Thread Pierre-Alain Joye
pajoye  Tue Jul 22 20:11:33 2003 EDT

  Added files: 
/php-src/ext/gd/tests   bug24594.phpt 
  Log:
  - imagefill tests
  
  

Index: php-src/ext/gd/tests/bug24594.phpt
+++ php-src/ext/gd/tests/bug24594.phpt
--TEST--
Bug #24594 (Filling an area using tiles).
--SKIPIF--
?php
if (!extension_loaded('gd')) {
die(skip gd extension not available\n);
}
if (!GD_BUNDLED) {
die('skip external GD libraries may fail');
}
?
--FILE--
?php
$tile = imagecreate(36,36);
$base = imagecreate(150,150);
$white = imagecolorallocate($tile,255,255,255);
$black = imagecolorallocate($tile,0,0,0);
$white = imagecolorallocate($base,255,255,255);
$black = imagecolorallocate($base,0,0,0);

/* create the dots pattern */
for ($x=0;$x36;$x+=2) {
for ($y=0;$y36;$y+=2) {
imagesetpixel($tile,$x,$y,$black);
}
}

imagesettile($base,$tile);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
imagefill($base,11,12,IMG_COLOR_TILED);

$res = imagecolorat($base,0,10)==$black?'1':'0';
$res .= imagecolorat($base,0,20)==$black?'1':'0';
$res .= imagecolorat($base,0,30)==$black?'1':'0';
$res .= imagecolorat($base,0,40)==$black?'1':'0';
$res .= imagecolorat($base,0,50)==$black?'1':'0';
$res .= imagecolorat($base,0,60)==$black?'1':'0';

$res .= imagecolorat($base,11,12)==$white?'1':'0';
$res .= imagecolorat($base,12,13)==$white?'1':'0';
$res .= imagecolorat($base,13,14)==$white?'1':'0';
$res .= imagecolorat($base,14,15)==$white?'1':'0';
$res .= imagecolorat($base,15,16)==$white?'1':'0';
$res .= imagecolorat($base,16,17)==$white?'1':'0';

$res .= imagecolorat($base,10,12)==$black?'1':'0';
$res .= imagecolorat($base,11,13)==$black?'1':'0';
$res .= imagecolorat($base,12,14)==$black?'1':'0';
$res .= imagecolorat($base,13,15)==$black?'1':'0';
$res .= imagecolorat($base,14,16)==$black?'1':'0';
$res .= imagecolorat($base,15,17)==$black?'1':'0';
echo $res\n;
imagepng($base,filled1.png);
imagefilledrectangle($base,0,0,149,149,$white);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
imagefill($base,0,0,IMG_COLOR_TILED);

$res = imagecolorat($base,0,10)==$black?'1':'0';
$res .= imagecolorat($base,0,20)==$black?'1':'0';
$res .= imagecolorat($base,0,30)==$black?'1':'0';
$res .= imagecolorat($base,0,40)==$black?'1':'0';
$res .= imagecolorat($base,0,50)==$black?'1':'0';
$res .= imagecolorat($base,0,60)==$black?'1':'0';

$res .= imagecolorat($base,11,12)==$white?'1':'0';
$res .= imagecolorat($base,12,13)==$white?'1':'0';
$res .= imagecolorat($base,13,14)==$white?'1':'0';
$res .= imagecolorat($base,14,15)==$white?'1':'0';
$res .= imagecolorat($base,15,16)==$white?'1':'0';
$res .= imagecolorat($base,16,17)==$white?'1':'0';

$res .= imagecolorat($base,0,16)==$black?'1':'0';
$res .= imagecolorat($base,2,42)==$black?'1':'0';
$res .= imagecolorat($base,4,44)==$black?'1':'0';
$res .= imagecolorat($base,146,146)==$black?'1':'0';
$res .= imagecolorat($base,148,146)==$black?'1':'0';
$res .= imagecolorat($base,0,0)==$black?'1':'0';

echo $res\n;
imagepng($base,filled.png);
?
--EXPECT--
0011101010
11 



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



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

2003-07-22 Thread Pierre-Alain Joye
pajoye  Tue Jul 22 20:23:21 2003 EDT

  Modified files:  
/php-src/ext/gd/libgd   gd.c 
  Log:
  - Fix leak when no fill is done (ilia)
  
  
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.61 php-src/ext/gd/libgd/gd.c:1.62
--- php-src/ext/gd/libgd/gd.c:1.61  Tue Jul 22 20:08:57 2003
+++ php-src/ext/gd/libgd/gd.c   Tue Jul 22 20:23:21 2003
@@ -1869,12 +1869,13 @@
return;
}
 
-   stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im-sy*im-sx)/4)+1);
-   sp = stack;
-
wx2=im-sx;wy2=im-sy;
oc = gdImageGetPixel(im, x, y);
if (oc==nc || x0 || xwx2 || y0 || ywy2) return;
+
+   stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im-sy*im-sx)/4)+1);
+   sp = stack;
+
/* required! */
FILL_PUSH(y,x,x,1);
/* seed segment (popped 1st) */



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



[PHP-CVS] cvs: php-src /ext/pgsql/tests skipif.inc

2003-07-22 Thread Marcus Boerger
helly   Tue Jul 22 19:01:24 2003 EDT

  Modified files:  
/php-src/ext/pgsql/testsskipif.inc 
  Log:
  Add reson
  
Index: php-src/ext/pgsql/tests/skipif.inc
diff -u php-src/ext/pgsql/tests/skipif.inc:1.2 php-src/ext/pgsql/tests/skipif.inc:1.3
--- php-src/ext/pgsql/tests/skipif.inc:1.2  Sun Dec 16 21:09:07 2001
+++ php-src/ext/pgsql/tests/skipif.inc  Tue Jul 22 19:01:24 2003
@@ -17,6 +17,6 @@
 }
 $conn = @pg_connect($conn_str);
 if (!is_resource($conn)) {
-die(skip\n);
+die(skip could not connect\n);
 }
 ?



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



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

2003-07-22 Thread Pierre-Alain Joye
pajoye  Tue Jul 22 20:08:57 2003 EDT

  Modified files:  
/php-src/ext/gd/libgd   gd.c 
  Log:
  - Fix #bug24594
Rewrite the imagefill function (non recursive, uses of connected points
algorithm)
  
  
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.60 php-src/ext/gd/libgd/gd.c:1.61
--- php-src/ext/gd/libgd/gd.c:1.60  Wed Jul  9 20:09:23 2003
+++ php-src/ext/gd/libgd/gd.c   Tue Jul 22 20:08:57 2003
@@ -868,6 +868,36 @@
}
 }
 
+
+static int gdImageTileGet (gdImagePtr im, int x, int y)
+{
+   int srcx, srcy;
+   int tileColor,p;
+   if (!im-tile) {
+   return -1;
+   }
+   srcx = x % gdImageSX(im-tile);
+   srcy = y % gdImageSY(im-tile);
+   p = gdImageGetPixel(im-tile, srcx, srcy);
+
+   if (im-trueColor) {
+   if (im-tile-trueColor) {
+   tileColor = p;
+   } else {
+   tileColor = gdTrueColorAlpha( gdImageRed(im-tile,p), 
gdImageGreen(im-tile,p), gdImageBlue (im-tile,p), gdImageAlpha (im-tile,p));
+   }
+   } else {
+   if (im-tile-trueColor) {
+   tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed 
(p), gdTrueColorGetGreen (p), gdTrueColorGetBlue (p), gdTrueColorGetAlpha (p));
+   } else {
+   tileColor = p;
+   tileColor = gdImageColorResolveAlpha(im, gdImageRed 
(im-tile,p), gdImageGreen (im-tile,p), gdImageBlue (im-tile,p), gdImageAlpha 
(im-tile,p));
+   }
+   }
+   return tileColor;
+}
+
+
 static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py)
 {
float p_dist, p_alpha;
@@ -1799,106 +1829,171 @@
}
 }
 
-void gdImageFill (gdImagePtr im, int x, int y, int color)
-{
-   int lastBorder;
-   int old;
-   int leftLimit, rightLimit;
-   int i;
-  
-   if (x = im-sx) {
-   x = im-sx - 1;
-   }
-  
-   if (y = im-sy) {
-   y = im-sy - 1;
+
+/*
+ * set the pixel at (x,y) and its 4-connected neighbors
+ * with the same pixel value to the new pixel value nc (new color).
+ * A 4-connected neighbor:  pixel above, below, left, or right of a pixel.
+ * ideas from comp.graphics discussions.
+ * For tiled fill, the use of a flag buffer is mandatory. As the tile image can
+ * contain the same color as the color to fill. To do not bloat normal filling
+ * code I added a 2nd private function.
+ */
+
+/* horizontal segment of scan line y */
+struct seg {int y, xl, xr, dy;};
+
+/* max depth of stack */
+#define FILL_MAX 120
+#define FILL_PUSH(Y, XL, XR, DY) \
+if (spstack+FILL_MAX*10  Y+(DY)=0  Y+(DY)wy2) \
+{sp-y = Y; sp-xl = XL; sp-xr = XR; sp-dy = DY; sp++;}
+
+#define FILL_POP(Y, XL, XR, DY) \
+{sp--; Y = sp-y+(DY = sp-dy); XL = sp-xl; XR = sp-xr;}
+
+void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc);
+
+void gdImageFill(gdImagePtr im, int x, int y, int nc)
+{
+   int l, x1, x2, dy;
+   int oc;   /* old pixel value */
+   int wx2,wy2;
+   /* stack of filled segments */
+   //struct seg stack[FILL_MAX],*sp = stack;;
+   struct seg *stack;
+   struct seg *sp;
+
+   if (nc==gdTiled){
+   _gdImageFillTiled(im,x,y,nc);
+   return;
}
-  
-   old = gdImageGetPixel(im, x, y);
-   if (color == gdTiled) {
-   /* Tile fill -- got to watch out! */
-   int p, tileColor;
-   int srcx, srcy;
-   if (!im-tile) {
-   return;
-   }
-   /* Refuse to flood-fill with a transparent pattern I can't do it 
without allocating another image */
-   if (gdImageGetTransparent(im-tile) != (-1)) {
-   return;
-   }
-   srcx = x % gdImageSX(im-tile);
-   srcy = y % gdImageSY(im-tile);
-   p = gdImageGetPixel(im-tile, srcx, srcy);
-   if (im-trueColor) {
-   tileColor = p;
-   } else {
-   if (im-tile-trueColor) {
-   tileColor = gdImageColorResolveAlpha(im, 
gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueColorGetBlue (p), 
gdTrueColorGetAlpha (p));
-   } else {
-   tileColor = im-tileColorMap[p];
-   }
-   }
-   if (old == tileColor) {
-   /* Nothing to be done */
-   return;
+
+   stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im-sy*im-sx)/4)+1);
+   sp = stack;
+
+   wx2=im-sx;wy2=im-sy;
+   oc = gdImageGetPixel(im, x, y);
+   if (oc==nc || x0 || xwx2 || y0 || ywy2) return;
+   /* required! */
+   FILL_PUSH(y,x,x,1);
+   /* seed segment (popped 1st) */
+   FILL_PUSH(y+1, x, x, -1);
+   while (spstack) {
+