[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/dom/document.c trunk/ext/dom/document.c trunk/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt

2011-01-18 Thread Gustavo André dos Santos Lopes
cataphract   Wed, 19 Jan 2011 00:22:06 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307571

Log:
- Hopefully finally fixed the mess in rev 307562 and rev 307563.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/dom/document.c
U   php/php-src/trunk/ext/dom/document.c
A   php/php-src/trunk/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt

Modified: php/php-src/branches/PHP_5_3/ext/dom/document.c
===
--- php/php-src/branches/PHP_5_3/ext/dom/document.c 2011-01-18 23:31:53 UTC 
(rev 307570)
+++ php/php-src/branches/PHP_5_3/ext/dom/document.c 2011-01-19 00:22:06 UTC 
(rev 307571)
@@ -1821,7 +1821,7 @@
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
}
-   htmlNodeDumpFormatOutput(buf, docp, node, 0, format);
+   xmlNodeDump(buf, docp, node, 0, format);
if (options & LIBXML_SAVE_NOEMPTYTAG) {
xmlSaveNoEmptyTags = saveempty;
}
@@ -2318,12 +2318,17 @@
RETURN_FALSE;
}

-   xmlNodeDump(buf, docp, node, 0, format);
-   mem = (xmlChar*) xmlBufferContent(buf);
-   if (!mem) {
+   size = htmlNodeDump(buf, docp, node);
+   if (size >= 0) {
+   mem = (xmlChar*) xmlBufferContent(buf);
+   if (!mem) {
+   RETVAL_FALSE;
+   } else {
+   RETVAL_STRINGL((const char*) mem, size, 1);
+   }
+   } else {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error 
dumping HTML node");
RETVAL_FALSE;
-   } else {
-   RETVAL_STRING(mem, 1);
}
xmlBufferFree(buf);
} else {
@@ -2335,7 +2340,7 @@
if (!size) {
RETVAL_FALSE;
} else {
-   RETVAL_STRINGL(mem, size, 1);
+   RETVAL_STRINGL((const char*) mem, size, 1);
}
if (mem)
xmlFree(mem);

Modified: php/php-src/trunk/ext/dom/document.c
===
--- php/php-src/trunk/ext/dom/document.c2011-01-18 23:31:53 UTC (rev 
307570)
+++ php/php-src/trunk/ext/dom/document.c2011-01-19 00:22:06 UTC (rev 
307571)
@@ -2318,12 +2318,17 @@
RETURN_FALSE;
}

-   htmlNodeDumpFormatOutput(buf, docp, node, 0, format);
-   mem = (xmlChar*) xmlBufferContent(buf);
-   if (!mem) {
+   size = htmlNodeDump(buf, docp, node);
+   if (size >= 0) {
+   mem = (xmlChar*) xmlBufferContent(buf);
+   if (!mem) {
+   RETVAL_FALSE;
+   } else {
+   RETVAL_STRINGL((const char*) mem, size, 1);
+   }
+   } else {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error 
dumping HTML node");
RETVAL_FALSE;
-   } else {
-   RETVAL_STRING(mem, 1);
}
xmlBufferFree(buf);
} else {
@@ -2335,7 +2340,7 @@
if (!size) {
RETVAL_FALSE;
} else {
-   RETVAL_STRINGL(mem, size, 1);
+   RETVAL_STRINGL((const char*) mem, size, 1);
}
if (mem)
xmlFree(mem);

Added: php/php-src/trunk/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt
===
--- php/php-src/trunk/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt  
(rev 0)
+++ php/php-src/trunk/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt  
2011-01-19 00:22:06 UTC (rev 307571)
@@ -0,0 +1,26 @@
+--TEST--
+DOMDocument::saveHTML() vs DOMDocumet::saveXML()
+--SKIPIF--
+
+--FILE--
+
+
+
+
+Hi.there
+
+
+EOD;
+$d->loadHTML($str);
+$e = $d->getElementsByTagName("p");
+$e = $e->item(0);
+echo $d->saveXml($e),"\n";
+echo $d->saveHtml($e),"\n";
+--EXPECTF--
+Hi.there
+Hi.there

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS

2011-01-18 Thread Pierre Joye
pajoye   Tue, 18 Jan 2011 23:31:53 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307570

Log:
- clarity

Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2011-01-18 22:46:59 UTC (rev 307569)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-01-18 23:31:53 UTC (rev 307570)
@@ -14,7 +14,7 @@
 (Stas)

 - Core:
-  . Fixed bug #53577 (Regression (5.3.3-5.3.4) in open_basedir with a
+  . Fixed bug #53577 (Regression introduced in 5.3.4 in open_basedir with a
 trailing forward slash). (lekensteyn at gmail dot com, Pierre)
   . Fixed bug #53682 (Fix compile on the VAX). (Rasmus, jklos)
   . Fixed bug #48484 (array_product() always returns 0 for an empty array).

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS

2011-01-18 Thread Pierre Joye
pajoye   Tue, 18 Jan 2011 22:22:28 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307564

Log:
- #53577 and cleanup

Bug: http://bugs.php.net/53577 (Duplicate) Regression (5.3.3-5.3.4) in 
open_basedir with a trailing forward slash
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2011-01-18 22:20:09 UTC (rev 307563)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-01-18 22:22:28 UTC (rev 307564)
@@ -14,12 +14,15 @@
 (Stas)

 - Core:
+  . Fixed bug #53577 (Regression (5.3.3-5.3.4) in open_basedir with a
+trailing forward slash). (lekensteyn at gmail dot com, Pierre)
+  . Fixed bug #53682 (Fix compile on the VAX). (Rasmus, jklos)
   . Fixed bug #48484 (array_product() always returns 0 for an empty array).
 (Ilia)
   . Fixed bug #48607 (fwrite() doesn't check reply from ftp server before
 exiting). (Ilia)
-  . Fixed bug #53682 (Fix compile on the VAX). (Rasmus, jklos)

+
 - Calendar extension:
   . Fixed bug #53574 (Integer overflow in SdnToJulian, sometimes leading to
 segfault). (Gustavo)

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/main/fopen_wrappers.c trunk/main/fopen_wrappers.c

2011-01-18 Thread Pierre Joye
pajoye   Tue, 18 Jan 2011 22:20:09 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307563

Log:
- fix regression introduced in 5.3.4 in open_basedir on windows/novell with 
trailing fwd slash

Changed paths:
U   php/php-src/branches/PHP_5_3/main/fopen_wrappers.c
U   php/php-src/trunk/main/fopen_wrappers.c

Modified: php/php-src/branches/PHP_5_3/main/fopen_wrappers.c
===
--- php/php-src/branches/PHP_5_3/main/fopen_wrappers.c  2011-01-18 19:56:09 UTC 
(rev 307562)
+++ php/php-src/branches/PHP_5_3/main/fopen_wrappers.c  2011-01-18 22:20:09 UTC 
(rev 307563)
@@ -229,7 +229,11 @@
if (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != 
NULL) {
/* Handler for basedirs that end with a / */
resolved_basedir_len = strlen(resolved_basedir);
+#if defined(PHP_WIN32) || defined(NETWARE)
+   if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR || 
basedir[strlen(basedir) - 1] == '/') {
+#else
if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR) {
+#endif
if (resolved_basedir[resolved_basedir_len - 1] != 
PHP_DIR_SEPARATOR) {
resolved_basedir[resolved_basedir_len] = 
PHP_DIR_SEPARATOR;
resolved_basedir[++resolved_basedir_len] = '\0';

Modified: php/php-src/trunk/main/fopen_wrappers.c
===
--- php/php-src/trunk/main/fopen_wrappers.c 2011-01-18 19:56:09 UTC (rev 
307562)
+++ php/php-src/trunk/main/fopen_wrappers.c 2011-01-18 22:20:09 UTC (rev 
307563)
@@ -228,7 +228,11 @@
if (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != 
NULL) {
/* Handler for basedirs that end with a / */
resolved_basedir_len = strlen(resolved_basedir);
+#if defined(PHP_WIN32) || defined(NETWARE)
+   if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR || 
basedir[strlen(basedir) - 1] == '/') {
+#else
if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR) {
+#endif
if (resolved_basedir[resolved_basedir_len - 1] != 
PHP_DIR_SEPARATOR) {
resolved_basedir[resolved_basedir_len] = 
PHP_DIR_SEPARATOR;
resolved_basedir[++resolved_basedir_len] = '\0';

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/dom/document.c trunk/ext/dom/document.c

2011-01-18 Thread Gustavo André dos Santos Lopes
cataphract   Tue, 18 Jan 2011 19:56:09 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307562

Log:
- Fixed wrong function call in original commit to FR #39771.

Bug: http://bugs.php.net/39771 (Closed) DOMDocument->saveHTML does not accept 
an optional DOMNode like saveXML
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/dom/document.c
U   php/php-src/trunk/ext/dom/document.c

Modified: php/php-src/branches/PHP_5_3/ext/dom/document.c
===
--- php/php-src/branches/PHP_5_3/ext/dom/document.c 2011-01-18 19:45:38 UTC 
(rev 307561)
+++ php/php-src/branches/PHP_5_3/ext/dom/document.c 2011-01-18 19:56:09 UTC 
(rev 307562)
@@ -1821,7 +1821,7 @@
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
}
-   xmlNodeDump(buf, docp, node, 0, format);
+   htmlNodeDumpFormatOutput(buf, docp, node, 0, format);
if (options & LIBXML_SAVE_NOEMPTYTAG) {
xmlSaveNoEmptyTags = saveempty;
}

Modified: php/php-src/trunk/ext/dom/document.c
===
--- php/php-src/trunk/ext/dom/document.c2011-01-18 19:45:38 UTC (rev 
307561)
+++ php/php-src/trunk/ext/dom/document.c2011-01-18 19:56:09 UTC (rev 
307562)
@@ -2318,7 +2318,7 @@
RETURN_FALSE;
}

-   xmlNodeDump(buf, docp, node, 0, format);
+   htmlNodeDumpFormatOutput(buf, docp, node, 0, format);
mem = (xmlChar*) xmlBufferContent(buf);
if (!mem) {
RETVAL_FALSE;

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/dom/document.c branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_error1.phpt branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHT

2011-01-18 Thread Gustavo André dos Santos Lopes
cataphract   Tue, 18 Jan 2011 19:45:38 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307561

Log:
- Implemented FR #39771 (Made DOMDocument::saveHTML accept an optional
  DOMNode like DOMDocument::saveXML).

Bug: http://bugs.php.net/39771 (Open) DOMDocument->saveHTML does not accept an 
optional DOMNode like saveXML
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/dom/document.c
D   
php/php-src/branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_error1.phpt
A   
php/php-src/branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt
U   php/php-src/trunk/ext/dom/document.c
D   php/php-src/trunk/ext/dom/tests/DOMDocument_saveHTML_error1.phpt
A   php/php-src/trunk/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2011-01-18 17:58:58 UTC (rev 307560)
+++ php/php-src/branches/PHP_5_3/NEWS	2011-01-18 19:45:38 UTC (rev 307561)
@@ -23,6 +23,10 @@
 - Calendar extension:
   . Fixed bug #53574 (Integer overflow in SdnToJulian, sometimes leading to
 segfault). (Gustavo)
+
+- DOM extension:
+  . Implemented FR #39771 (Made DOMDocument::saveHTML accept an optional DOMNode
+	like DOMDocument::saveXML). (Gustavo)

 - DateTime extension:
   . Fixed a bug in DateTime->modify() where absolute date/time statements had

Modified: php/php-src/branches/PHP_5_3/ext/dom/document.c
===
--- php/php-src/branches/PHP_5_3/ext/dom/document.c	2011-01-18 17:58:58 UTC (rev 307560)
+++ php/php-src/branches/PHP_5_3/ext/dom/document.c	2011-01-18 19:45:38 UTC (rev 307561)
@@ -2284,33 +2284,63 @@
 */
 PHP_FUNCTION(dom_document_save_html)
 {
-	zval *id;
+	zval *id, *nodep = NULL;
 	xmlDoc *docp;
-	dom_object *intern;
-	xmlChar *mem;
+	xmlNode *node;
+	xmlBufferPtr buf;
+	dom_object *intern, *nodeobj;
+	xmlChar *mem = NULL;
 	int size, format;
 	dom_doc_propsptr doc_props;

-	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) {
+	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
+		"O|O!", &id, dom_document_class_entry, &nodep, dom_node_class_entry)
+		== FAILURE) {
 		return;
 	}

 	DOM_GET_OBJ(docp, id, xmlDocPtr, intern);

-#if LIBXML_VERSION >= 20623
 	doc_props = dom_get_doc_props(intern->document);
 	format = doc_props->formatoutput;
-	htmlDocDumpMemoryFormat(docp, &mem, &size, format);
+
+	if (nodep != NULL) {
+		/* Dump contents of Node */
+		DOM_GET_OBJ(node, nodep, xmlNodePtr, nodeobj);
+		if (node->doc != docp) {
+			php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
+			RETURN_FALSE;
+		}
+
+		buf = xmlBufferCreate();
+		if (!buf) {
+			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch buffer");
+			RETURN_FALSE;
+		}
+
+		xmlNodeDump(buf, docp, node, 0, format);
+		mem = (xmlChar*) xmlBufferContent(buf);
+		if (!mem) {
+			RETVAL_FALSE;
+		} else {
+			RETVAL_STRING(mem, 1);
+		}
+		xmlBufferFree(buf);
+	} else {
+#if LIBXML_VERSION >= 20623
+		htmlDocDumpMemoryFormat(docp, &mem, &size, format);
 #else
-	htmlDocDumpMemory(docp, &mem, &size);
+		htmlDocDumpMemory(docp, &mem, &size);
 #endif
-	if (!size) {
+		if (!size) {
+			RETVAL_FALSE;
+		} else {
+			RETVAL_STRINGL(mem, size, 1);
+		}
 		if (mem)
 			xmlFree(mem);
-		RETURN_FALSE;
 	}
-	RETVAL_STRINGL(mem, size, 1);
-	xmlFree(mem);
+
 }
 /* }}} end dom_document_save_html */


Deleted: php/php-src/branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_error1.phpt
===
--- php/php-src/branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_error1.phpt	2011-01-18 17:58:58 UTC (rev 307560)
+++ php/php-src/branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_error1.phpt	2011-01-18 19:45:38 UTC (rev 307561)
@@ -1,24 +0,0 @@
---TEST--
-DOMDocument::saveHTML() should fail if a parameter is given
---CREDITS--
-Knut Urdalen 
-#PHPTestFest2009 Norway 2009-06-09 \o/
---SKIPIF--
-
---FILE--
-createElement('html');
-$root = $doc->appendChild($root);
-$head = $doc->createElement('head');
-$head = $root->appendChild($head);
-$title = $doc->createElement('title');
-$title = $head->appendChild($title);
-$text = $doc->createTextNode('This is the title');
-$text = $title->appendChild($text);
-echo $doc->saveHTML(true);
-?>
---EXPECTF--
-Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in %s on line %d

Added: php/php-src/branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt
===
--- php/php-src/branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/main/rfc1867.c trunk/main/rfc1867.c

2011-01-18 Thread Ilia Alshanetsky
iliaaTue, 18 Jan 2011 13:17:23 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307559

Log:
Fixed variable re-declaration

Changed paths:
U   php/php-src/branches/PHP_5_3/main/rfc1867.c
U   php/php-src/trunk/main/rfc1867.c

Modified: php/php-src/branches/PHP_5_3/main/rfc1867.c
===
--- php/php-src/branches/PHP_5_3/main/rfc1867.c 2011-01-18 10:29:26 UTC (rev 
307558)
+++ php/php-src/branches/PHP_5_3/main/rfc1867.c 2011-01-18 13:17:23 UTC (rev 
307559)
@@ -989,7 +989,7 @@

/* New Rule: never repair potential malicious user 
input */
if (!skip_upload) {
-   char *tmp = param;
+   tmp = param;
long c = 0;

while (*tmp) {

Modified: php/php-src/trunk/main/rfc1867.c
===
--- php/php-src/trunk/main/rfc1867.c2011-01-18 10:29:26 UTC (rev 307558)
+++ php/php-src/trunk/main/rfc1867.c2011-01-18 13:17:23 UTC (rev 307559)
@@ -945,7 +945,7 @@

/* New Rule: never repair potential malicious user 
input */
if (!skip_upload) {
-   char *tmp = param;
+   tmp = param;
long c = 0;

while (*tmp) {

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-18 Thread Pierre Joye
fixed

On Tue, Jan 18, 2011 at 11:20 AM, Andrey Hristov  wrote:
> On 01/17/2011 03:01 PM, Pierre Joye wrote:
>> pajoye                                   Mon, 17 Jan 2011 14:01:01 +
>>
>> Revision: http://svn.php.net/viewvc?view=revision&revision=307537
>>
>> Log:
>> - fix NULL derefencing
>>
>> Changed paths:
>>     U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
>>     U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
>>
>> Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
>> ===
>> --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c     2011-01-17 
>> 13:44:54 UTC (rev 307536)
>> +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c     2011-01-17 
>> 14:01:01 UTC (rev 307537)
>> @@ -735,7 +735,7 @@
>>
>>       DBG_ENTER("mysqlnd_fetch_stmt_row_buffered");
>>       *fetched_anything = FALSE;
>> -     DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
>> +     DBG_INF_FMT("stmt=%lu", stmt != NULL ? stmt->stmt_id : 0L);
>>
>>       /* If we haven't read everything */
>>       if (set->data_cursor &&
>> @@ -2223,9 +2223,9 @@
>>  static enum_func_status
>>  MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool 
>> implicit TSRMLS_DC)
>>  {
>> -     MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
>> +     MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
>>       enum_func_status ret = FAIL;
>> -     zend_bool persistent = s->persistent;
>> +     zend_bool persistent = (s == NULL) ? s->persistent : 0;
>
> This breaks mysqlnd. Why? Because you turn around the meaning. s? means
> s!=NULL and you change it to s==NULL but leave the rest of the ternary
> intact. Did you run the tests, because 117 more failing test, out of
> 432. This is hard to oversee if you run the test suite!
>
> Best,
> Andrey
>



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-18 Thread Pierre Joye
pajoye   Tue, 18 Jan 2011 10:29:26 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307558

Log:
- fix the fix (wrong test)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-18 
07:28:30 UTC (rev 307557)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-18 
10:29:26 UTC (rev 307558)
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s != NULL) ? s->data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = (s == NULL) ? s->persistent : 0;
+   zend_bool persistent = (s != NULL) ? s->persistent : 0;

DBG_ENTER("mysqlnd_stmt::dtor");
if (stmt) {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-18 07:28:30 UTC (rev 
307557)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-18 10:29:26 UTC (rev 
307558)
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s != NULL) ? s->data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = (s == NULL) ? s->persistent : 0;
+   zend_bool persistent = (s != NULL) ? s->persistent : 0;

DBG_ENTER("mysqlnd_stmt::dtor");
if (stmt) {

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-18 Thread Andrey Hristov
On 01/17/2011 03:01 PM, Pierre Joye wrote:
> pajoye   Mon, 17 Jan 2011 14:01:01 +
> 
> Revision: http://svn.php.net/viewvc?view=revision&revision=307537
> 
> Log:
> - fix NULL derefencing
> 
> Changed paths:
> U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
> U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
> 
> Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
> ===
> --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2011-01-17 
> 13:44:54 UTC (rev 307536)
> +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2011-01-17 
> 14:01:01 UTC (rev 307537)
> @@ -735,7 +735,7 @@
> 
>   DBG_ENTER("mysqlnd_fetch_stmt_row_buffered");
>   *fetched_anything = FALSE;
> - DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
> + DBG_INF_FMT("stmt=%lu", stmt != NULL ? stmt->stmt_id : 0L);
> 
>   /* If we haven't read everything */
>   if (set->data_cursor &&
> @@ -2223,9 +2223,9 @@
>  static enum_func_status
>  MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool 
> implicit TSRMLS_DC)
>  {
> - MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
> + MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
>   enum_func_status ret = FAIL;
> - zend_bool persistent = s->persistent;
> + zend_bool persistent = (s == NULL) ? s->persistent : 0;

This breaks mysqlnd. Why? Because you turn around the meaning. s? means
s!=NULL and you change it to s==NULL but leave the rest of the ternary
intact. Did you run the tests, because 117 more failing test, out of
432. This is hard to oversee if you run the test suite!

Best,
Andrey

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