Merge branch 'PHP-5.6' of git.php.net:/php-src into PHP-5.6

This commit is contained in:
Xinchen Hui 2015-11-02 10:47:32 +08:00
commit a23a88b3e7
19 changed files with 368 additions and 121 deletions

View File

@ -57,7 +57,7 @@ php_lcov.info: lcov-test
cp $$x.bbg lcov_data/$$y.bbg ; \ cp $$x.bbg lcov_data/$$y.bbg ; \
fi; \ fi; \
done; \ done; \
for dir in ext/bcmath/libbcmath ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \ for dir in ext/bcmath/libbcmath ext/date/lib ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
if test -d lcov_data/$$dir; then \ if test -d lcov_data/$$dir; then \
rm -rf lcov_data/$$dir ; \ rm -rf lcov_data/$$dir ; \
fi; \ fi; \

View File

@ -715,6 +715,12 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT);
#ifdef CLIENT_SSL_VERIFY_SERVER_CERT
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT", CLIENT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
#if defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT", CLIENT_SSL_DONT_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
#endif
#endif
#if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) #if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT);

View File

@ -41,11 +41,7 @@ $link->close();
if (!is_object($link = mysqli_init())) if (!is_object($link = mysqli_init()))
printf("[001] Cannot create link\n"); printf("[001] Cannot create link\n");
$path_to_pems = !$IS_MYSQLND? "ext/mysqli/tests/" : ""; if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT)) {
if (!$link->ssl_set("{$path_to_pems}client-key.pem", "{$path_to_pems}client-cert.pem", "{$path_to_pems}cacert.pem","",""))
printf("[002] [%d] %s\n", $link->errno, $link->error);
if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
} }
@ -65,9 +61,42 @@ $link->close();
} else { } else {
if (!$row = $res->fetch_assoc()) if (!$row = $res->fetch_assoc())
printf("[006] [%d] %s\n", $link->errno, $link->error); printf("[006] [%d] %s\n", $link->errno, $link->error);
if (!strlen($row["Value"]))
printf("[007] Empty cipher. No encrytion!");
var_dump($row);
} }
var_dump($row); $link->close();
if (!is_object($link = mysqli_init()))
printf("[008] Cannot create link\n");
if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL)) {
printf("[009] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
if (1064 == $link->errno) {
/* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
if ($res = $link->query("SHOW STATUS")) {
while ($row = $res->fetch_assoc())
if ($row['Variable_name'] == 'Ssl_cipher')
break;
} else {
printf("[010] [%d] %s\n", $link->errno, $link->error);
}
} else {
printf("[011] [%d] %s\n", $link->errno, $link->error);
}
} else {
if (!$row = $res->fetch_assoc())
printf("[012] [%d] %s\n", $link->errno, $link->error);
if (!strlen($row["Value"]))
printf("[013] Empty cipher. No encrytion!");
var_dump($row);
}
$link->close();
print "done!"; print "done!";
?> ?>
@ -78,4 +107,10 @@ array(2) {
["Value"]=> ["Value"]=>
string(%d) "%S" string(%d) "%S"
} }
array(2) {
["Variable_name"]=>
string(10) "Ssl_cipher"
["Value"]=>
string(%d) "%S"
}
done! done!

View File

@ -40,7 +40,7 @@ $link->close();
$db1 = new mysqli(); $db1 = new mysqli();
$flags = MYSQLI_CLIENT_SSL; $flags = MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
$link = mysqli_init(); $link = mysqli_init();
mysqli_ssl_set($link, null, null, null, null, "RC4-MD5"); mysqli_ssl_set($link, null, null, null, null, "RC4-MD5");

View File

@ -1,17 +1,79 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 16263805969935345171 (0xe1b4a55c3ddfa613)
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=SE, ST=Stockholm, L=Stockholm, O=Oracle, OU=MySQL, CN=CA
Validity
Not Before: Dec 5 04:48:11 2014 GMT
Not After : Dec 1 04:48:11 2030 GMT
Subject: C=SE, ST=Stockholm, L=Stockholm, O=Oracle, OU=MySQL, CN=CA
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:b4:95:bd:24:92:73:06:22:01:13:28:0e:09:a3:
94:05:96:54:9d:dc:8f:83:39:f3:64:7a:31:70:f6:
d9:c4:14:19:75:87:a6:b1:ea:52:ed:40:54:5a:f6:
9c:13:8e:d8:76:8f:5a:65:a5:20:19:19:bd:51:9d:
ba:35:ce:9a:a9:58:0a:fc:11:6e:1d:cb:a8:f1:92:
79:ee:aa:fc:e3:32:5e:aa:0d:0b:23:34:95:e9:d3:
8e:3f:72:93:90:bc:2c:b0:04:75:4f:a4:4a:a0:32:
db:ac:89:ac:34:9b:d0:07:e3:81:e9:ca:5b:26:f0:
f5:de:fe:d5:5e:a0:54:26:dd:ec:58:07:6e:b9:e5:
97:f6:20:6d:d8:4a:c0:50:cc:81:e6:d2:3f:c7:47:
70:8b:15:89:65:71:2e:47:c3:42:76:b5:ee:16:0e:
26:97:6a:a3:1c:ad:90:53:50:b0:b1:6d:1d:b0:b8:
6d:df:3c:ee:bd:3b:87:e8:db:4d:3a:72:78:dd:db:
40:3d:c9:20:46:b8:4e:33:bb:76:b7:4f:b2:79:da:
03:cc:f9:75:c0:1d:4c:51:0a:b9:9b:25:34:50:11:
97:df:82:46:02:a9:bc:98:51:3e:c3:df:57:ad:b7:
28:be:de:65:ce:2b:f3:2c:22:f5:af:31:28:1c:ef:
10:09
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
94:65:A1:A3:87:CF:BF:C1:74:BB:D8:84:97:B6:6B:EE:B2:90:73:B2
X509v3 Authority Key Identifier:
keyid:94:65:A1:A3:87:CF:BF:C1:74:BB:D8:84:97:B6:6B:EE:B2:90:73:B2
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha256WithRSAEncryption
32:97:4c:af:bf:ca:e0:10:66:b7:cc:8b:0d:05:d1:d2:ca:b8:
0c:c2:78:57:1f:f6:55:9c:74:fc:bd:31:58:05:18:bc:6d:b5:
79:9a:22:8c:1f:da:33:ea:ef:db:e3:cb:46:bc:36:91:8b:d8:
36:8d:06:40:c2:e9:fe:79:1b:4a:c5:70:74:6d:9d:92:2c:90:
be:3c:a7:88:03:e4:b7:ef:f4:b0:00:34:ec:8f:d1:c3:23:2b:
ef:bc:ff:ab:a2:0e:bc:ba:11:a5:8e:44:80:fa:d6:f4:26:66:
84:64:2c:e3:23:62:0c:e2:ba:01:ab:5f:24:d6:9d:7e:9c:7b:
f4:5d:0e:ba:64:35:6e:a5:fa:98:0c:57:f3:72:e8:3e:2e:ce:
b3:f9:e3:fa:ee:aa:79:f9:06:01:19:b2:b3:28:ff:f4:d6:bb:
17:bb:a6:a0:e0:45:23:f3:61:40:31:5c:a3:ee:88:1c:00:31:
54:96:f9:71:37:b5:7f:66:6a:af:04:94:09:39:99:b3:88:86:
9e:bb:d6:36:24:24:f4:37:2c:a6:6c:0b:35:2e:bb:40:af:a7:
64:8a:7f:f2:74:e3:94:0c:32:bd:31:3d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x79F0OumQ1bqX6mAxX83LoPi7Os/nj
+u6qefkGARmysyj/9Na7F7umoOBFI/NhQDFco+6IHAAxVJb5cTe1f2ZqrwSUCTmZ
s4iGnrvWNiQk9DcspmwLNS67QK+nZIp/8nTjlAwyvTE92XloDx5LF8BO34U88ITf
WPHSTS+t/xvXyJv+3A==
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -1,46 +1,82 @@
Certificate: Certificate:
Data: Data:
Version: 1 (0x0) Version: 3 (0x2)
Serial Number: 1048577 (0x100001) Serial Number: 16263805969935345173 (0xe1b4a55c3ddfa615)
Signature Algorithm: md5WithRSAEncryption Signature Algorithm: sha256WithRSAEncryption
Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB Issuer: C=SE, ST=Stockholm, L=Stockholm, O=Oracle, OU=MySQL, CN=CA
Validity Validity
Not Before: Jan 29 11:50:22 2010 GMT Not Before: Dec 5 04:49:23 2014 GMT
Not After : Jan 28 11:50:22 2015 GMT Not After : Dec 1 04:49:23 2029 GMT
Subject: C=SE, ST=Uppsala, O=MySQL AB Subject: C=SE, ST=Stockholm, L=Stockholm, O=Oracle, OU=MySQL, CN=Client
Subject Public Key Info: Subject Public Key Info:
Public Key Algorithm: rsaEncryption Public Key Algorithm: rsaEncryption
Public-Key: (1024 bit) Public-Key: (2048 bit)
Modulus: Modulus:
00:cc:9a:37:49:13:66:dc:cf:e3:0b:13:a1:23:ed: 00:c8:d1:a1:fe:a4:8c:f3:1b:17:71:1b:74:35:11:
78:db:4e:bd:11:f6:8c:0d:76:f9:a3:32:56:9a:f8: e0:0e:6c:40:0a:fb:c0:f7:f0:eb:bb:c9:1d:a1:c7:
a1:21:6a:55:4e:4d:3f:e6:67:9d:26:99:b2:cd:a4: d7:b0:8a:f6:f1:cf:fa:6b:d0:79:64:eb:bb:69:a5:
9a:d2:2b:59:5c:d7:8a:d3:60:68:f8:18:bd:c5:be: 0d:80:06:df:52:14:d2:85:32:cf:bf:ce:2a:47:28:
15:e1:2a:3c:a3:d4:61:cb:f5:11:94:17:81:81:f7: 5b:cd:0b:28:ab:bb:07:33:d5:8b:d3:b4:72:c4:a6:
87:8c:f6:6a:d2:ee:d8:e6:77:f6:62:66:4d:2e:16: b5:cc:37:b9:03:a8:78:56:25:58:1f:17:30:7c:d1:
8d:08:81:4a:c9:c6:4b:31:e5:b9:c7:8a:84:96:48: 0a:bb:ec:3c:a3:03:90:97:99:92:49:ae:b3:57:96:
a7:47:8c:0d:26:90:56:4e:e6:a5:6e:8c:b3:f2:9f: 5c:1a:e9:e8:02:23:ae:c8:c9:05:50:63:e5:77:a1:
fc:3d:78:9b:49:6e:86:83:77 9a:73:06:74:0e:46:50:28:d8:c9:4f:c4:1c:37:b8:
52:18:0b:af:19:2b:d4:e5:66:74:a4:f3:f0:da:09:
30:f7:bc:0c:c9:9b:ce:57:06:04:27:e5:a1:2f:2b:
a0:ba:b7:99:69:9d:46:fc:21:b6:45:81:9d:b2:3d:
2f:76:15:78:b5:33:62:ac:1e:6b:66:dd:27:61:0a:
47:02:20:2b:57:bb:32:20:dd:06:4c:76:a4:9b:72:
42:4c:9c:2c:76:72:12:1f:4b:df:1e:11:1f:a9:06:
54:dc:88:12:b0:49:d5:40:83:ef:7e:48:43:86:7a:
37:a6:c1:d7:9b:fe:08:34:98:e0:54:3c:30:4f:79:
15:29
Exponent: 65537 (0x10001) Exponent: 65537 (0x10001)
Signature Algorithm: md5WithRSAEncryption X509v3 extensions:
5e:1f:a3:53:5f:24:13:1c:f8:28:32:b0:7f:69:69:f3:0e:c0: X509v3 Basic Constraints:
34:87:10:03:7d:da:15:8b:bd:19:b8:1a:56:31:e7:85:49:81: CA:FALSE
c9:7f:45:20:74:3e:89:c0:e0:26:84:51:cc:04:16:ce:69:99: Netscape Comment:
01:e1:26:99:b3:e3:f5:bd:ec:5f:a0:84:e4:38:da:75:78:7b: OpenSSL Generated Certificate
89:9c:d2:cd:60:95:20:ba:8e:e3:7c:e6:df:76:3a:7c:89:77: X509v3 Subject Key Identifier:
02:94:86:11:3a:c4:61:7d:6f:71:83:21:8a:17:fb:17:e2:ee: 26:0C:90:BC:97:12:9E:43:BB:5E:FE:EB:A9:66:B3:C3:EE:B2:18:CB
02:6b:61:c1:b4:52:63:d7:d8:46:b2:c5:9c:6f:38:91:8a:35: X509v3 Authority Key Identifier:
32:0b keyid:94:65:A1:A3:87:CF:BF:C1:74:BB:D8:84:97:B6:6B:EE:B2:90:73:B2
Signature Algorithm: sha256WithRSAEncryption
3e:3c:1f:6c:5b:83:d1:71:15:f5:45:52:fc:7f:67:bc:af:c5:
92:f5:74:78:13:43:3c:fe:b5:61:bf:00:47:43:45:a0:b9:dd:
a1:10:0c:29:69:2a:6f:7d:67:3d:1e:09:b5:15:74:bf:73:11:
e6:e9:09:b6:6b:b5:cc:1e:06:fd:bd:3a:11:d3:44:bd:ca:7a:
a1:f1:09:43:fc:bf:83:89:3a:b1:18:40:f3:cf:6d:12:ef:6e:
0c:b7:a4:99:03:8a:4f:0c:3c:2c:23:78:35:2a:99:ea:de:9c:
1b:e8:8d:19:fb:44:80:13:89:81:c5:05:4b:a7:66:6b:c0:31:
41:f0:6c:60:aa:ec:d3:4c:ff:c1:3b:d5:bb:0d:42:7d:37:5e:
80:e7:9c:7e:60:90:0f:a4:4e:70:20:9c:b1:e4:1b:70:65:b0:
ef:bb:41:16:ed:ad:46:ce:34:d3:02:3d:dd:e2:50:fa:3c:5d:
f0:e2:71:f8:9a:ef:a3:32:25:c5:8e:64:f4:46:e1:f4:c0:69:
d2:34:56:8d:d9:c2:6e:b6:55:3b:6a:4d:b6:d2:84:ab:85:7b:
cb:fd:b4:73:40:ba:5d:49:e2:0d:39:77:17:01:49:bb:72:8b:
3a:c9:b1:e2:cd:13:d2:9c:ce:7d:6c:a8:f0:32:c9:a4:af:56:
6f:8a:e6:88
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB5zCCAVACAxAAATANBgkqhkiG9w0BAQQFADBEMQswCQYDVQQGE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KHCKYd1EcBbfyPWjAZ8+BagEPK8mJfOt
MXkMrSKOq6ShEfzRsdJna7eI0te3zNXXFu/G3IHQZUdC0RtksW5T9tXvASRN3wnX
+aaoIM1q/KUgfH0TF/1pQPHFSUfFrGyLDiCDUu1sJ2ijULr5rZES
-----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----

View File

@ -9,7 +9,7 @@
$driver = new mysqli_driver; $driver = new mysqli_driver;
$host = getenv("MYSQL_TEST_HOST") ? getenv("MYSQL_TEST_HOST") : "127.0.0.1"; $host = getenv("MYSQL_TEST_HOST") ? getenv("MYSQL_TEST_HOST") : "127.0.0.1";
$port = getenv("MYSQL_TEST_PORT") ? getenv("MYSQL_TEST_PORT") : 3308; $port = getenv("MYSQL_TEST_PORT") ? getenv("MYSQL_TEST_PORT") : 3306;
$user = getenv("MYSQL_TEST_USER") ? getenv("MYSQL_TEST_USER") : "root"; $user = getenv("MYSQL_TEST_USER") ? getenv("MYSQL_TEST_USER") : "root";
$passwd = getenv("MYSQL_TEST_PASSWD") ? getenv("MYSQL_TEST_PASSWD") : ""; $passwd = getenv("MYSQL_TEST_PASSWD") ? getenv("MYSQL_TEST_PASSWD") : "";
$db = getenv("MYSQL_TEST_DB") ? getenv("MYSQL_TEST_DB") : "test"; $db = getenv("MYSQL_TEST_DB") ? getenv("MYSQL_TEST_DB") : "test";
@ -87,9 +87,8 @@
function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) { function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
global $connect_flags; global $connect_flags;
$flags = ($enable_env_flags) ? $connect_flags : false; $flags = $enable_env_flags? $connect_flags:0;
if ($flags !== 0) {
if ($flags !== false) {
$link = mysqli_init(); $link = mysqli_init();
if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags))
$link = false; $link = false;
@ -109,7 +108,7 @@
global $connect_flags; global $connect_flags;
if ($enable_env_flags) if ($enable_env_flags)
$flags & $connect_flags; $flags = $flags | $connect_flags;
return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags); return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags);
} }
@ -118,7 +117,7 @@
public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) { public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
global $connect_flags; global $connect_flags;
$flags = ($enable_env_flags) ? $connect_flags : false; $flags = ($enable_env_flags) ? $connect_flags : 0;
if ($flags !== false) { if ($flags !== false) {
parent::init(); parent::init();

View File

@ -136,6 +136,12 @@ require_once('skipifconnectfailure.inc');
$expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true; $expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true;
} }
if ($version >= 50033 || $IS_MYSQLND) {
$expected_constants['MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT'] = true;
}
if ($IS_MYSQLND) {
$expected_constants['MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'] = true;
}
/* First introduced in MySQL 6.0, backported to MySQL 5.5 */ /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
if ($version >= 50606 || $IS_MYSQLND) { if ($version >= 50606 || $IS_MYSQLND) {

View File

@ -472,6 +472,7 @@ mysqlnd_switch_to_ssl_if_needed(
DBG_INF_FMT("CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA= %d", mysql_flags & CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA? 1:0); DBG_INF_FMT("CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA= %d", mysql_flags & CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA? 1:0);
DBG_INF_FMT("CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS= %d", mysql_flags & CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS? 1:0); DBG_INF_FMT("CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS= %d", mysql_flags & CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS? 1:0);
DBG_INF_FMT("CLIENT_SESSION_TRACK= %d", mysql_flags & CLIENT_SESSION_TRACK? 1:0); DBG_INF_FMT("CLIENT_SESSION_TRACK= %d", mysql_flags & CLIENT_SESSION_TRACK? 1:0);
DBG_INF_FMT("CLIENT_SSL_DONT_VERIFY_SERVER_CERT= %d", mysql_flags & CLIENT_SSL_DONT_VERIFY_SERVER_CERT? 1:0);
DBG_INF_FMT("CLIENT_SSL_VERIFY_SERVER_CERT= %d", mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT? 1:0); DBG_INF_FMT("CLIENT_SSL_VERIFY_SERVER_CERT= %d", mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT? 1:0);
DBG_INF_FMT("CLIENT_REMEMBER_OPTIONS= %d", mysql_flags & CLIENT_REMEMBER_OPTIONS? 1:0); DBG_INF_FMT("CLIENT_REMEMBER_OPTIONS= %d", mysql_flags & CLIENT_REMEMBER_OPTIONS? 1:0);
@ -495,7 +496,11 @@ mysqlnd_switch_to_ssl_if_needed(
if (server_has_ssl == FALSE) { if (server_has_ssl == FALSE) {
goto close_conn; goto close_conn;
} else { } else {
zend_bool verify = mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT? TRUE:FALSE; enum mysqlnd_ssl_peer verify = mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT?
MYSQLND_SSL_PEER_VERIFY:
(mysql_flags & CLIENT_SSL_DONT_VERIFY_SERVER_CERT?
MYSQLND_SSL_PEER_DONT_VERIFY:
MYSQLND_SSL_PEER_DEFAULT);
DBG_INF("Switching to SSL"); DBG_INF("Switching to SSL");
if (!PACKET_WRITE(auth_packet, conn)) { if (!PACKET_WRITE(auth_packet, conn)) {
goto close_conn; goto close_conn;

View File

@ -101,6 +101,10 @@
#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) /* Enable authentication response packet to be larger than 255 bytes. */ #define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) /* Enable authentication response packet to be larger than 255 bytes. */
#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) /* Don't close the connection for a connection with expired password. */ #define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) /* Don't close the connection for a connection with expired password. */
#define CLIENT_SESSION_TRACK (1UL << 23) /* Extended OK */ #define CLIENT_SESSION_TRACK (1UL << 23) /* Extended OK */
/*
This is a mysqlnd extension. CLIENT_ODBC is not used anyway. We will reuse it for our case and translate it to not using SSL peer verification
*/
#define CLIENT_SSL_DONT_VERIFY_SERVER_CERT CLIENT_ODBC
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
#define CLIENT_REMEMBER_OPTIONS (1UL << 31) #define CLIENT_REMEMBER_OPTIONS (1UL << 31)

View File

@ -798,8 +798,27 @@ MYSQLND_METHOD(mysqlnd_net, set_client_option)(MYSQLND_NET * const net, enum mys
break; break;
} }
case MYSQL_OPT_SSL_VERIFY_SERVER_CERT: case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
net->data->options.ssl_verify_peer = value? ((*(zend_bool *)value)? TRUE:FALSE): FALSE; {
enum mysqlnd_ssl_peer val = *((enum mysqlnd_ssl_peer *)value);
switch (val) {
case MYSQLND_SSL_PEER_VERIFY:
DBG_INF("MYSQLND_SSL_PEER_VERIFY");
break;
case MYSQLND_SSL_PEER_DONT_VERIFY:
DBG_INF("MYSQLND_SSL_PEER_DONT_VERIFY");
break;
case MYSQLND_SSL_PEER_DEFAULT:
DBG_INF("MYSQLND_SSL_PEER_DEFAULT");
val = MYSQLND_SSL_PEER_DEFAULT;
break;
default:
DBG_INF("default = MYSQLND_SSL_PEER_DEFAULT_ACTION");
val = MYSQLND_SSL_PEER_DEFAULT;
break;
}
net->data->options.ssl_verify_peer = val;
break; break;
}
case MYSQL_OPT_READ_TIMEOUT: case MYSQL_OPT_READ_TIMEOUT:
net->data->options.timeout_read = *(unsigned int*) value; net->data->options.timeout_read = *(unsigned int*) value;
break; break;
@ -886,6 +905,7 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
#ifdef MYSQLND_SSL_SUPPORTED #ifdef MYSQLND_SSL_SUPPORTED
php_stream_context * context = php_stream_context_alloc(TSRMLS_C); php_stream_context * context = php_stream_context_alloc(TSRMLS_C);
php_stream * net_stream = net->data->m.get_stream(net TSRMLS_CC); php_stream * net_stream = net->data->m.get_stream(net TSRMLS_CC);
zend_bool any_flag = FALSE;
DBG_ENTER("mysqlnd_net::enable_ssl"); DBG_ENTER("mysqlnd_net::enable_ssl");
if (!context) { if (!context) {
@ -896,11 +916,7 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
zval key_zval; zval key_zval;
ZVAL_STRING(&key_zval, net->data->options.ssl_key, 0); ZVAL_STRING(&key_zval, net->data->options.ssl_key, 0);
php_stream_context_set_option(context, "ssl", "local_pk", &key_zval); php_stream_context_set_option(context, "ssl", "local_pk", &key_zval);
} any_flag = TRUE;
if (net->data->options.ssl_verify_peer) {
zval verify_peer_zval;
ZVAL_TRUE(&verify_peer_zval);
php_stream_context_set_option(context, "ssl", "verify_peer", &verify_peer_zval);
} }
if (net->data->options.ssl_cert) { if (net->data->options.ssl_cert) {
zval cert_zval; zval cert_zval;
@ -909,27 +925,48 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
if (!net->data->options.ssl_key) { if (!net->data->options.ssl_key) {
php_stream_context_set_option(context, "ssl", "local_pk", &cert_zval); php_stream_context_set_option(context, "ssl", "local_pk", &cert_zval);
} }
any_flag = TRUE;
} }
if (net->data->options.ssl_ca) { if (net->data->options.ssl_ca) {
zval cafile_zval; zval cafile_zval;
ZVAL_STRING(&cafile_zval, net->data->options.ssl_ca, 0); ZVAL_STRING(&cafile_zval, net->data->options.ssl_ca, 0);
php_stream_context_set_option(context, "ssl", "cafile", &cafile_zval); php_stream_context_set_option(context, "ssl", "cafile", &cafile_zval);
any_flag = TRUE;
} }
if (net->data->options.ssl_capath) { if (net->data->options.ssl_capath) {
zval capath_zval; zval capath_zval;
ZVAL_STRING(&capath_zval, net->data->options.ssl_capath, 0); ZVAL_STRING(&capath_zval, net->data->options.ssl_capath, 0);
php_stream_context_set_option(context, "ssl", "cafile", &capath_zval); php_stream_context_set_option(context, "ssl", "capath", &capath_zval);
any_flag = TRUE;
} }
if (net->data->options.ssl_passphrase) { if (net->data->options.ssl_passphrase) {
zval passphrase_zval; zval passphrase_zval;
ZVAL_STRING(&passphrase_zval, net->data->options.ssl_passphrase, 0); ZVAL_STRING(&passphrase_zval, net->data->options.ssl_passphrase, 0);
php_stream_context_set_option(context, "ssl", "passphrase", &passphrase_zval); php_stream_context_set_option(context, "ssl", "passphrase", &passphrase_zval);
any_flag = TRUE;
} }
if (net->data->options.ssl_cipher) { if (net->data->options.ssl_cipher) {
zval cipher_zval; zval cipher_zval;
ZVAL_STRING(&cipher_zval, net->data->options.ssl_cipher, 0); ZVAL_STRING(&cipher_zval, net->data->options.ssl_cipher, 0);
php_stream_context_set_option(context, "ssl", "ciphers", &cipher_zval); php_stream_context_set_option(context, "ssl", "ciphers", &cipher_zval);
any_flag = TRUE;
} }
{
zval verify_peer_zval;
zend_bool verify;
if (net->data->options.ssl_verify_peer == MYSQLND_SSL_PEER_DEFAULT) {
net->data->options.ssl_verify_peer = any_flag? MYSQLND_SSL_PEER_DEFAULT_ACTION:MYSQLND_SSL_PEER_DONT_VERIFY;
}
verify = net->data->options.ssl_verify_peer == MYSQLND_SSL_PEER_VERIFY? TRUE:FALSE;
DBG_INF_FMT("VERIFY=%d", verify);
ZVAL_BOOL(&verify_peer_zval, verify);
php_stream_context_set_option(context, "ssl", "verify_peer", &verify_peer_zval);
php_stream_context_set_option(context, "ssl", "verify_peer_name", &verify_peer_zval);
}
php_stream_context_set(net_stream, context); php_stream_context_set(net_stream, context);
if (php_stream_xport_crypto_setup(net_stream, STREAM_CRYPTO_METHOD_TLS_CLIENT, NULL TSRMLS_CC) < 0 || if (php_stream_xport_crypto_setup(net_stream, STREAM_CRYPTO_METHOD_TLS_CLIENT, NULL TSRMLS_CC) < 0 ||
php_stream_xport_crypto_enable(net_stream, 1 TSRMLS_CC) < 0) php_stream_xport_crypto_enable(net_stream, 1 TSRMLS_CC) < 0)

View File

@ -207,7 +207,13 @@ typedef struct st_mysqlnd_net_options
char *ssl_capath; char *ssl_capath;
char *ssl_cipher; char *ssl_cipher;
char *ssl_passphrase; char *ssl_passphrase;
zend_bool ssl_verify_peer; enum mysqlnd_ssl_peer {
MYSQLND_SSL_PEER_DEFAULT = 0,
MYSQLND_SSL_PEER_VERIFY = 1,
MYSQLND_SSL_PEER_DONT_VERIFY = 2,
#define MYSQLND_SSL_PEER_DEFAULT_ACTION MYSQLND_SSL_PEER_VERIFY
} ssl_verify_peer;
uint64_t flags; uint64_t flags;
char * sha256_server_public_key; char * sha256_server_public_key;
@ -219,6 +225,7 @@ typedef struct st_mysqlnd_net_options
} MYSQLND_NET_OPTIONS; } MYSQLND_NET_OPTIONS;
typedef struct st_mysqlnd_connection MYSQLND; typedef struct st_mysqlnd_connection MYSQLND;
typedef struct st_mysqlnd_connection_data MYSQLND_CONN_DATA; typedef struct st_mysqlnd_connection_data MYSQLND_CONN_DATA;
typedef struct st_mysqlnd_net MYSQLND_NET; typedef struct st_mysqlnd_net MYSQLND_NET;

View File

@ -205,14 +205,19 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
err = GetLastError(); err = GetLastError();
if (ret == ALLOC_FAIL_MAPPING) { if (ret == ALLOC_FAIL_MAPPING) {
/* Mapping failed, wait for mapping object to get freed and retry */ /* Mapping failed, wait for mapping object to get freed and retry */
CloseHandle(memfile); CloseHandle(memfile);
memfile = NULL; memfile = NULL;
if (++map_retries >= MAX_MAP_RETRIES) {
break;
}
zend_shared_alloc_unlock_win32();
Sleep(1000 * (map_retries + 1)); Sleep(1000 * (map_retries + 1));
zend_shared_alloc_lock_win32();
} else { } else {
zend_shared_alloc_unlock_win32(); zend_shared_alloc_unlock_win32();
return ret; return ret;
} }
} while (++map_retries < MAX_MAP_RETRIES); } while (1);
if (map_retries == MAX_MAP_RETRIES) { if (map_retries == MAX_MAP_RETRIES) {
zend_shared_alloc_unlock_win32(); zend_shared_alloc_unlock_win32();

View File

@ -0,0 +1,16 @@
--TEST--
openssl_get_cipher_methods basic test
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br>
--SKIPIF--
<?php
if (!extension_loaded("openssl")) print "skip";
?>
--FILE--
<?php
var_dump(is_array(openssl_get_cipher_methods(true)));
var_dump(is_array(openssl_get_cipher_methods(false)));
?>
--EXPECT--
bool(true)
bool(true)

View File

@ -0,0 +1,16 @@
--TEST--
openssl_get_md_methods basic test
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br>
--SKIPIF--
<?php
if (!extension_loaded("openssl")) print "skip";
?>
--FILE--
<?php
var_dump(is_array(openssl_get_md_methods(true)));
var_dump(is_array(openssl_get_md_methods(false)));
?>
--EXPECT--
bool(true)
bool(true)

View File

@ -2298,7 +2298,7 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret TS
: stream->chunk_size); : stream->chunk_size);
} }
*(int *)ret = sslsock->s.socket; *(php_socket_t *)ret = sslsock->s.socket;
} }
return SUCCESS; return SUCCESS;

View File

@ -1493,11 +1493,6 @@ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals TSRMLS_
*/ */
static PHP_MINIT_FUNCTION(cgi) static PHP_MINIT_FUNCTION(cgi)
{ {
#ifdef ZTS
ts_allocate_id(&php_cgi_globals_id, sizeof(php_cgi_globals_struct), (ts_allocate_ctor) php_cgi_globals_ctor, NULL);
#else
php_cgi_globals_ctor(&php_cgi_globals TSRMLS_CC);
#endif
REGISTER_INI_ENTRIES(); REGISTER_INI_ENTRIES();
return SUCCESS; return SUCCESS;
} }
@ -1801,6 +1796,12 @@ int main(int argc, char *argv[])
tsrm_ls = ts_resource(0); tsrm_ls = ts_resource(0);
#endif #endif
#ifdef ZTS
ts_allocate_id(&php_cgi_globals_id, sizeof(php_cgi_globals_struct), (ts_allocate_ctor) php_cgi_globals_ctor, NULL);
#else
php_cgi_globals_ctor(&php_cgi_globals TSRMLS_CC);
#endif
sapi_startup(&cgi_sapi_module); sapi_startup(&cgi_sapi_module);
fastcgi = fcgi_is_fastcgi(); fastcgi = fcgi_is_fastcgi();
cgi_sapi_module.php_ini_path_override = NULL; cgi_sapi_module.php_ini_path_override = NULL;

View File

@ -70,7 +70,7 @@
/* Copy the first part of user declarations. */ /* Copy the first part of user declarations. */
/* Line 371 of yacc.c */ /* Line 371 of yacc.c */
#line 1 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 1 "sapi/phpdbg/phpdbg_parser.y"
/* /*
@ -129,7 +129,7 @@ extern int phpdbg_debug;
#endif #endif
/* "%code requires" blocks. */ /* "%code requires" blocks. */
/* Line 387 of yacc.c */ /* Line 387 of yacc.c */
#line 31 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 31 "sapi/phpdbg/phpdbg_parser.y"
#include "phpdbg.h" #include "phpdbg.h"
#ifndef YY_TYPEDEF_YY_SCANNER_T #ifndef YY_TYPEDEF_YY_SCANNER_T
@ -1453,25 +1453,25 @@ yyreduce:
{ {
case 3: case 3:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 67 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 67 "sapi/phpdbg/phpdbg_parser.y"
{ phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(1) - (1)])); } { phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(1) - (1)])); }
break; break;
case 5: case 5:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 72 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 72 "sapi/phpdbg/phpdbg_parser.y"
{ phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(1) - (1)])); } { phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(1) - (1)])); }
break; break;
case 6: case 6:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 73 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 73 "sapi/phpdbg/phpdbg_parser.y"
{ phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(2) - (2)])); } { phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(2) - (2)])); }
break; break;
case 7: case 7:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 77 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 77 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = FILE_PARAM; (yyval).type = FILE_PARAM;
(yyval).file.name = (yyvsp[(2) - (3)]).str; (yyval).file.name = (yyvsp[(2) - (3)]).str;
@ -1481,7 +1481,7 @@ yyreduce:
case 8: case 8:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 82 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 82 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = NUMERIC_FILE_PARAM; (yyval).type = NUMERIC_FILE_PARAM;
(yyval).file.name = (yyvsp[(1) - (4)]).str; (yyval).file.name = (yyvsp[(1) - (4)]).str;
@ -1491,7 +1491,7 @@ yyreduce:
case 9: case 9:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 87 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 87 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = FILE_PARAM; (yyval).type = FILE_PARAM;
(yyval).file.name = malloc((yyvsp[(1) - (4)]).len + (yyvsp[(2) - (4)]).len + 1); (yyval).file.name = malloc((yyvsp[(1) - (4)]).len + (yyvsp[(2) - (4)]).len + 1);
@ -1506,7 +1506,7 @@ yyreduce:
case 10: case 10:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 97 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 97 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = NUMERIC_FILE_PARAM; (yyval).type = NUMERIC_FILE_PARAM;
(yyval).file.name = malloc((yyvsp[(1) - (5)]).len + (yyvsp[(2) - (5)]).len + 1); (yyval).file.name = malloc((yyvsp[(1) - (5)]).len + (yyvsp[(2) - (5)]).len + 1);
@ -1521,7 +1521,7 @@ yyreduce:
case 11: case 11:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 107 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 107 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = METHOD_PARAM; (yyval).type = METHOD_PARAM;
(yyval).method.class = (yyvsp[(1) - (3)]).str; (yyval).method.class = (yyvsp[(1) - (3)]).str;
@ -1531,7 +1531,7 @@ yyreduce:
case 12: case 12:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 112 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 112 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = NUMERIC_METHOD_PARAM; (yyval).type = NUMERIC_METHOD_PARAM;
(yyval).method.class = (yyvsp[(1) - (5)]).str; (yyval).method.class = (yyvsp[(1) - (5)]).str;
@ -1542,7 +1542,7 @@ yyreduce:
case 13: case 13:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 118 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 118 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = NUMERIC_FUNCTION_PARAM; (yyval).type = NUMERIC_FUNCTION_PARAM;
(yyval).str = (yyvsp[(1) - (3)]).str; (yyval).str = (yyvsp[(1) - (3)]).str;
@ -1553,7 +1553,7 @@ yyreduce:
case 14: case 14:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 124 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 124 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = COND_PARAM; (yyval).type = COND_PARAM;
(yyval).str = (yyvsp[(2) - (2)]).str; (yyval).str = (yyvsp[(2) - (2)]).str;
@ -1563,49 +1563,49 @@ yyreduce:
case 15: case 15:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 129 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 129 "sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); } { (yyval) = (yyvsp[(1) - (1)]); }
break; break;
case 16: case 16:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 130 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 130 "sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); } { (yyval) = (yyvsp[(1) - (1)]); }
break; break;
case 17: case 17:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 131 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 131 "sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); } { (yyval) = (yyvsp[(1) - (1)]); }
break; break;
case 18: case 18:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 132 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 132 "sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); } { (yyval) = (yyvsp[(1) - (1)]); }
break; break;
case 19: case 19:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 133 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 133 "sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); } { (yyval) = (yyvsp[(1) - (1)]); }
break; break;
case 20: case 20:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 134 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 134 "sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); } { (yyval) = (yyvsp[(1) - (1)]); }
break; break;
case 21: case 21:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 135 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 135 "sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); } { (yyval) = (yyvsp[(1) - (1)]); }
break; break;
case 22: case 22:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 139 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 139 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = EVAL_PARAM; (yyval).type = EVAL_PARAM;
(yyval).str = (yyvsp[(2) - (2)]).str; (yyval).str = (yyvsp[(2) - (2)]).str;
@ -1615,7 +1615,7 @@ yyreduce:
case 23: case 23:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 144 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 144 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = SHELL_PARAM; (yyval).type = SHELL_PARAM;
(yyval).str = (yyvsp[(2) - (2)]).str; (yyval).str = (yyvsp[(2) - (2)]).str;
@ -1625,7 +1625,7 @@ yyreduce:
case 24: case 24:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 149 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 149 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = RUN_PARAM; (yyval).type = RUN_PARAM;
(yyval).len = 0; (yyval).len = 0;
@ -1634,7 +1634,7 @@ yyreduce:
case 25: case 25:
/* Line 1802 of yacc.c */ /* Line 1802 of yacc.c */
#line 153 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 153 "sapi/phpdbg/phpdbg_parser.y"
{ {
(yyval).type = RUN_PARAM; (yyval).type = RUN_PARAM;
(yyval).str = (yyvsp[(2) - (2)]).str; (yyval).str = (yyvsp[(2) - (2)]).str;
@ -1876,7 +1876,7 @@ yyreturn:
/* Line 2050 of yacc.c */ /* Line 2050 of yacc.c */
#line 160 "/Users/Bob/php-src-5.6/sapi/phpdbg/phpdbg_parser.y" #line 160 "sapi/phpdbg/phpdbg_parser.y"
static int yyerror(void ***tsrm_ls, const char *msg) { static int yyerror(void ***tsrm_ls, const char *msg) {