[PHP-BUG] Req #62888 [NEW]: Support for more pdo_mysql.default_* configuration directives

2012-08-22 Thread raphael dot droz+floss at gmail dot com
From: raphael dot droz+floss at gmail dot com
Operating system: 
PHP version:  5.4.6
Package:  PDO related
Bug Type: Feature/Change Request
Bug description:Support for more pdo_mysql.default_* configuration directives

Description:

PDO currently supports the following directives:
pdo_mysql.default_socket
pdo_mysql.debug

PDO constructor ignores any of mysql[i].default_* directives.

Because it's both a missing feature and lacks consistency, supporting
default_user, default_password (and why not default_host and default_port)
would be great.

Defaulting to the corresponding mysql.* or mysqli.* directives according to
the select DB driver may also be an option (while adding a bit more
magic).

Stated that, as for mysql[i]_connect, these values are taken into account
only if $user and $password are either NULL or omitted.


Test script:
---
// php_valuepdo_mysql.default_user  test // in httpd configuration
// or ini_set('pdo_mysql.default_user', 'test')
new PDO('mysql:host=localhost;dbname=test'); // $user and $password
parameters omitted
// success



-- 
Edit bug report at https://bugs.php.net/bug.php?id=62888edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62888r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62888r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=62888r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62888r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62888r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62888r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=62888r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=62888r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=62888r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=62888r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=62888r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=62888r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=62888r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62888r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=62888r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=62888r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=62888r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=62888r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=62888r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=62888r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=62888r=mysqlcfg



Bug #51634 [Com]: Can't post multiple fields with the same name

2012-05-14 Thread raphael dot droz+floss at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=51634edit=1

 ID: 51634
 Comment by: raphael dot droz+floss at gmail dot com
 Reported by:bart at tremby dot net
 Summary:Can't post multiple fields with the same name
 Status: Open
 Type:   Bug
 Package:cURL related
 Operating System:   Ubuntu
 PHP Version:5.2.13
 Block user comment: N
 Private report: N

 New Comment:

This patch may solve the issue.

I can't see how may I have restricted the new code-path according to the key so 
I simply tested for values which are array themselves instead of doing any 
string lookup/substitution when keys matches [] or anything like that.

I got some problem with the test-suite (can't export 
PHP_CURL_HTTP_REMOTE_SERVER) anyway I still had 40 skipped, 2 failures and 33 
pass *after* the patch.
If that patch is ok I may add a patch for the test-suite if needed.

NB: please don't bite me, it's my first patch for PHP.


Previous Comments:

[2010-04-22 16:01:30] bart at tremby dot net

That works when posting to PHP because of the way PHP handles the names but 
what it's actually posting is
name name[0], value val1
name name[1], value val2

Any system but PHP as far as I know (I'm posting to a Java-based system and I 
don't have control over it) keeps them as they are -- two separate entities 
called name[0] and name[1]. There's nothing in the HTTP specification which 
says anything about array indices -- as far as I can tell that's purely PHP's 
invention. PHP which decides they're the same thing and knocks off the brackets.

The system I'm posting to expects them to be posted with the same name. (The 
spec says this is fine -- see 
http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.1.2.3). The CLI 
example I gave in the OP does this; the PHP example you just gave does not.


[2010-04-22 15:53:32] fel...@php.net

You can use: array(name[0] = val1, name[1] = val2)


[2010-04-22 15:07:56] bart at tremby dot net

Where I said 'PHP then parses this into an array but only val2 is in it.' I 
meant Array, not val2.


[2010-04-22 15:06:01] bart at tremby dot net

Description:

With CLI curl I can run
curl -F test=value -F test=value --trace-ascii trace http://localhost/test.php
and in the file trace I see that it posted multipart/form-data with two fields 
called test with content value.

I need this same behaviour from PHP. But the only way at present, it seems, to 
add form fields to the curl handle (and have them transmit as 
multipart/form-data) is to use curl_setopt($ch, CURLOPT_POSTFIELDS, $data) 
where $data is an array of name-value pairs.

Obviously I can't have two pairs in this array with the same name.

I've tried array(name = array(val1, val2)) but that posts the string 
Array as the value for field name.

I've tried array(name[] = array(val1, val2)) but that posts the string 
Array as the value for field name[] (PHP then parses this into an array but 
only val2 is in it.)

I've tried array(name[] = val1, name[] = val2) but of course that 
doesn't work since as soon as that array is initialized it's only got one 
element -- the second overwrote the first.

I think allowing array(name = array(val1, val2)) would be the best 
solution. (And brackets should not be added to the end of name unless 
specified.)







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=51634edit=1