Skip to content

Commit 27f7ac9

Browse files
committed
php5.4 compatibility
1 parent 55cf156 commit 27f7ac9

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

src/MySQLReplication/BinLog/Connect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private function readFromSocket($data_len)
202202
*/
203203
private function auth()
204204
{
205-
$data = PackAuth::initPack(ConstCapabilityFlags::CAPABILITIES, $this->config->getUser(), $this->config->getPassword(), ServerInfo::getSalt());
205+
$data = PackAuth::initPack(ConstCapabilityFlags::getCapabilities(), $this->config->getUser(), $this->config->getPassword(), ServerInfo::getSalt());
206206

207207
$this->writeToSocket($data);
208208
$this->getPacket();

src/MySQLReplication/Definitions/ConstCapabilityFlags.php

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,30 @@
99
*/
1010
class ConstCapabilityFlags
1111
{
12-
const LONG_PASSWORD = 1;
13-
const FOUND_ROWS = 1 << 1;
14-
const LONG_FLAG = 1 << 2;
15-
const CONNECT_WITH_DB = 1 << 3;
16-
const NO_SCHEMA = 1 << 4;
17-
const COMPRESS = 1 << 5;
18-
const ODBC = 1 << 6;
19-
const LOCAL_FILES = 1 << 7;
20-
const IGNORE_SPACE = 1 << 8;
21-
const PROTOCOL_41 = 1 << 9;
22-
const INTERACTIVE = 1 << 10;
23-
const SSL = 1 << 11;
24-
const IGNORE_SIG_PIPE = 1 << 12;
25-
const TRANSACTIONS = 1 << 13;
26-
const SECURE_CONNECTION = 1 << 15;
27-
const MULTI_STATEMENTS = 1 << 16;
28-
const MULTI_RESULTS = 1 << 17;
29-
const CAPABILITIES = (self::LONG_PASSWORD | self::LONG_FLAG | self::TRANSACTIONS | self::PROTOCOL_41 | self::SECURE_CONNECTION);
12+
public static function getCapabilities()
13+
{
14+
/*
15+
Left only as information
16+
$foundRows = 1 << 1;
17+
$connectWithDb = 1 << 3;
18+
$compress = 1 << 5;
19+
$odbc = 1 << 6;
20+
$localFiles = 1 << 7;
21+
$ignoreSpace = 1 << 8;
22+
$multiStatements = 1 << 16;
23+
$multiResults = 1 << 17;
24+
$interactive = 1 << 10;
25+
$ssl = 1 << 11;
26+
$ignoreSigPipe = 1 << 12;
27+
*/
28+
29+
$noSchema = 1 << 4;
30+
$longPassword = 1;
31+
$longFlag = 1 << 2;
32+
$transactions = 1 << 13;
33+
$secureConnection = 1 << 15;
34+
$protocol41 = 1 << 9;
35+
36+
return ($longPassword | $longFlag | $transactions | $protocol41 | $secureConnection | $noSchema);
37+
}
3038
}

src/MySQLReplication/Pack/RowEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ private static function _read_column_data($cols_bitmap)
394394
$sets = [];
395395
foreach ($column['set_values'] as $k => $item)
396396
{
397-
if ($bit_mask & 2 ** $k)
397+
if ($bit_mask & pow(2, $k))
398398
{
399399
$sets[] = $item;
400400
}

0 commit comments

Comments
 (0)