php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57978 compilation breaks with strict compilers
Submitted: 2007-12-26 16:48 UTC Modified: 2017-01-10 07:42 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: gk at gknw dot de Assigned:
Status: Suspended Package: pdo_user (PECL)
PHP Version: Irrelevant OS: NetWare
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gk at gknw dot de
New email:
PHP Version: OS:

 

 [2007-12-26 16:48 UTC] gk at gknw dot de
Description:
------------
On NetWare I have a very strict compiler which errors out with type mismatches.


Reproduce code:
---------------
Here's a patch which makes it compile:

--- pdo_user_driver.c.orig	Tue Oct 30 20:09:58 2007
+++ pdo_user_driver.c	Wed Dec 26 22:33:10 2007
@@ -73,7 +73,7 @@
 	ZVAL_STRINGL(&fname, PHP_PDO_USER_DRV_PREPARER, sizeof(PHP_PDO_USER_DRV_PREPARER) - 1, 0);
 
 	MAKE_STD_ZVAL(args[0]);
-	ZVAL_STRINGL(args[0], sql, sql_len, 1);
+	ZVAL_STRINGL(args[0], (char*)sql, sql_len, 1);
 	args[1] = driver_options ? driver_options : EG(uninitialized_zval_ptr);
 
 	ALLOC_INIT_ZVAL(retval);
@@ -440,7 +440,7 @@
 
 		/* $dsn */
 		MAKE_STD_ZVAL(args[0]);
-		ZVAL_STRINGL(args[0], dbh->data_source, dbh->data_source_len, 1);
+		ZVAL_STRINGL(args[0], (char*)dbh->data_source, dbh->data_source_len, 1);
 
 		/* $user */
 		MAKE_STD_ZVAL(args[1]);
############################################################################ 
--- pdo_user_object.c.orig	Tue Oct 30 20:09:58 2007
+++ pdo_user_object.c	Wed Dec 26 22:37:28 2007
@@ -94,7 +94,7 @@
 			if (val) {
 				php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot override data source");
 			}
-			RETVAL_STRINGL(data->dbh->data_source, data->dbh->data_source_len, 1);
+			RETVAL_STRINGL((char*)data->dbh->data_source, data->dbh->data_source_len, 1);
 
 			break;
 		}
@@ -281,7 +281,7 @@
 	 * Gonna have to step through the slow way... */
 	while (labels->label) {
 		if (labels->id == tokenid) {
-			RETURN_STRING(labels->label, 1);
+			RETURN_STRING((char*)labels->label, 1);
 		}
 		labels++;
 	}
@@ -292,7 +292,7 @@
 /* }}} */
 
 static void *pdo_user_malloc_wrapper(size_t x) { return emalloc(x); }
-static void pdo_user_free_wrapper(size_t x) { efree(x); }
+static void pdo_user_free_wrapper(void* x) { efree(x); }
 
 /* {{{ proto array PDO_User::parseSQL(string sql)
 Compile a SQL statement into a query structure */


Expected result:
----------------
compilation succeeds.

Actual result:
--------------
compilation breaks.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-24 16:35 UTC] ramsey@php.net
-Assigned To: ramsey +Assigned To: pollita
 [2013-03-24 16:35 UTC] ramsey@php.net
Sara, want to take a look at this? I didn't even realize it had been assigned to 
me until just now.
 [2017-01-10 07:42 UTC] kalle@php.net
-Status: Assigned +Status: Suspended -Assigned To: pollita +Assigned To:
 [2017-01-10 07:42 UTC] kalle@php.net
Suspending this report as the extension have not had a release for almost 10 years
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC