client_flags ^= CLIENT_LOCAL_FILES;
}
- hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd));
+ hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s_%d", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
}
/* We cannot use mysql_port anymore in windows, need to use
PDO_CONSTRUCT_CHECK;
- if (pdo_dbh_attribute_set(dbh, attr, value TSRMLS_CC)) {
+ if (pdo_dbh_attribute_set(dbh, attr, value TSRMLS_CC) != FAILURE) {
RETURN_TRUE;
}
RETURN_FALSE;
}
if (params && bindno != zend_hash_num_elements(params) && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
+ /* extra bit of validation for instances when same params are bound more then once */
+ if (query_type != PDO_PLACEHOLDER_POSITIONAL && bindno > zend_hash_num_elements(params)) {
+ int ok = 1;
+ for (plc = placeholders; plc; plc = plc->next) {
+ if (zend_hash_find(params, plc->pos, plc->len, (void**) ¶m) == FAILURE) {
+ ok = 0;
+ break;
+ }
+ }
+ if (ok) {
+ goto safe;
+ }
+ }
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens" TSRMLS_CC);
ret = -1;
goto clean_up;
}
-
+safe:
/* what are we going to do ? */
-
if (stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
/* query generation */
}
if (params && bindno != zend_hash_num_elements(params) && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
+ /* extra bit of validation for instances when same params are bound more then once */
+ if (query_type != PDO_PLACEHOLDER_POSITIONAL && bindno > zend_hash_num_elements(params)) {
+ int ok = 1;
+ for (plc = placeholders; plc; plc = plc->next) {
+ if (zend_hash_find(params, plc->pos, plc->len, (void**) ¶m) == FAILURE) {
+ ok = 0;
+ break;
+ }
+ }
+ if (ok) {
+ goto safe;
+ }
+ }
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens" TSRMLS_CC);
ret = -1;
goto clean_up;
}
-
+safe:
/* what are we going to do ? */
-
if (stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
/* query generation */
#endif
if (!S->result) {
+ strcpy(stmt->error_code, "HY000");
return 0;
}
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
efree(http_body);
efree(loc);
if (new_url->scheme == NULL && new_url->path != NULL) {
- new_url->scheme = estrdup(phpurl->scheme);
- new_url->host = estrdup(phpurl->host);
+ new_url->scheme = NULL;
+ new_url->host = phpurl->host ? estrdup(phpurl->host) : NULL;
new_url->port = phpurl->port;
if (new_url->path && new_url->path[0] != '/') {
- char *t = phpurl->path?phpurl->path:"/";
+ char *t = phpurl->path;
char *p = strrchr(t, '/');
- char *s = emalloc((p - t) + strlen(new_url->path) + 2);
-
- strncpy(s, t, (p - t) + 1);
- s[(p - t) + 1] = 0;
- strcat(s, new_url->path);
- efree(new_url->path);
- new_url->path = s;
+ if (p) {
+ char *s = emalloc((p - t) + strlen(new_url->path) + 2);
+ strncpy(s, t, (p - t) + 1);
+ s[(p - t) + 1] = 0;
+ strcat(s, new_url->path);
+ efree(new_url->path);
+ new_url->path = s;
+ }
}
}
phpurl = new_url;
}
else if(!strcmp(type, ATTR_BASE64)) {
struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
+ base64_decode_xmlrpc(&buf, el->text.str, el->text.len);
XMLRPC_SetValueBase64(xCurrent, buf.data, buf.offset);
buffer_delete(&buf);
}
{
struct buffer_st buf;
pAttrType = ATTR_BASE64;
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
+ base64_encode_xmlrpc(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
simplestring_addn(&elem_val->text, buf.data, buf.offset );
buffer_delete(&buf);
}
}
else if (!strcmp(type, TOKEN_BASE64)) {
struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
+ base64_decode_xmlrpc(&buf, el->text.str, el->text.len);
XMLRPC_SetValueBase64(xCurrent, buf.data, buf.offset);
buffer_delete(&buf);
}
{
struct buffer_st buf;
pAttrType = TOKEN_BASE64;
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
+ base64_encode_xmlrpc(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
simplestring_addn(&elem_val->text, buf.data, buf.offset );
buffer_delete(&buf);
}
}
else if (!strcmp(el->name, ELEM_BASE64)) {
struct buffer_st buf;
- base64_decode(&buf, el->text.str, el->text.len);
+ base64_decode_xmlrpc(&buf, el->text.str, el->text.len);
XMLRPC_SetValueBase64(current_val, buf.data, buf.offset);
buffer_delete(&buf);
}
{
struct buffer_st buf;
elem_val->name = strdup(ELEM_BASE64);
- base64_encode(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
+ base64_encode_xmlrpc(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node));
simplestring_addn(&elem_val->text, buf.data, buf.offset );
buffer_delete(&buf);
}