Skip to content

fix #115 for mysql 8.4.0 #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

fix #115 for mysql 8.4.0 #116

wants to merge 12 commits into from

Conversation

hetao29
Copy link

@hetao29 hetao29 commented May 5, 2024

No description provided.

@hetao29 hetao29 changed the title fix #115 for mysql 8.0.0 fix #115 for mysql 8.4.0 May 5, 2024
@krowinski krowinski self-assigned this May 8, 2024
Copy link
Owner

@krowinski krowinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi tx for contribution

1, Fix tests

  1. MySQLReplication\Tests\Unit\Repository\MySQLRepositoryTest::testShouldGetVersion
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -'foobar123'
    +''

run composer cs:fix to fix code style

@hetao29 hetao29 requested a review from krowinski May 8, 2024 09:52
@cyppe
Copy link

cyppe commented Nov 18, 2024

Any status of this PR or is there some other php 8.4 fixes in the works?

@hetao29
Copy link
Author

hetao29 commented Nov 18, 2024

Any status of this PR or is there some other php 8.4 fixes in the works?

My project used this pr in product env.

@cyppe
Copy link

cyppe commented Apr 19, 2025

@krowinski now with more mysql versions in test suite, maybe this has a chance to be tested and (maybe) merged?

@krowinski
Copy link
Owner

@cyppe resolve conflict pls

@krowinski
Copy link
Owner

tests are failing

There were 2 failures:

  1. MySQLReplication\Tests\Unit\BinaryDataReader\BinaryDataReaderTest::testShouldReadInt64
    Failed asserting that -72057589759737856 is identical to '-72057589759737856'.

/home/runner/work/php-mysql-replication/php-mysql-replication/tests/Unit/BinaryDataReader/BinaryDataReaderTest.php:138

  1. MySQLReplication\Tests\Unit\BinaryDataReader\BinaryDataReaderTest::testShouldPack64bit
    Failed asserting that 9223372036854775807 is identical to '9223372036854775807'.

/home/runner/work/php-mysql-replication/php-mysql-replication/tests/Unit/BinaryDataReader/BinaryDataReaderTest.php:190

FAILURES!
Tests: 131, Assertions: 666, Failures: 2.

@hetao29
Copy link
Author

hetao29 commented Apr 24, 2025

tests are failing

There were 2 failures:

  1. MySQLReplication\Tests\Unit\BinaryDataReader\BinaryDataReaderTest::testShouldReadInt64
    Failed asserting that -72057589759737856 is identical to '-72057589759737856'.

/home/runner/work/php-mysql-replication/php-mysql-replication/tests/Unit/BinaryDataReader/BinaryDataReaderTest.php:138

  1. MySQLReplication\Tests\Unit\BinaryDataReader\BinaryDataReaderTest::testShouldPack64bit
    Failed asserting that 9223372036854775807 is identical to '9223372036854775807'.

/home/runner/work/php-mysql-replication/php-mysql-replication/tests/Unit/BinaryDataReader/BinaryDataReaderTest.php:190

FAILURES! Tests: 131, Assertions: 666, Failures: 2.

Because I change return value of Int64 type like default PDO::ATTR_STRINGIFY_FETCHES=false OR MYSQLI_OPT_INT_AND_FLOAT_NATIVE , Int64 may string or int value.

CREATE TABLE `test` (
  `id` bigint unsigned NOT NULL DEFAULT '0',
  `show` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
insert into test(id) values(9223372036854775807),(9223372036854775808);
try {
// 数据库配置
$host = '127.0.0.1';
$db   = 'test';    // 你的数据库名
$user = 'root';       // 数据库用户名
$pass = '';           // 数据库密码
$port = "3306";
$charset = 'utf8mb4';

// 设置DSN(数据源名称)
$dsn = "mysql:host=$host;dbname=$db;charset=$charset;port=$port";

// 设置PDO选项
$options = [
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION, // 抛出异常错误
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,       // 获取关联数组
    PDO::ATTR_EMULATE_PREPARES   => false,                  // 关闭模拟预处理
];
    // 创建PDO实例
    $pdo = new PDO($dsn, $user, $pass, $options);

    // 编写SQL语句
    $sql = "SELECT * FROM test"; // 假设你有一个users表
    var_dump(PHP_INT_MAX);
    var_dump(PHP_INT_MIN);

    // 执行查询
    $stmt = $pdo->query($sql);

    // 获取结果
    while ($row = $stmt->fetch()) {
        var_dump($row);
    }

} catch (\PDOException $e) {
    // 处理连接错误
    throw new \PDOException($e->getMessage(), (int)$e->getCode());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants