Skip to content
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

Fix missing symbols from math.cpp #97

Merged
merged 7 commits into from
Apr 12, 2024
Merged

Fix missing symbols from math.cpp #97

merged 7 commits into from
Apr 12, 2024

Conversation

ecsv
Copy link

@ecsv ecsv commented Apr 12, 2024

If someone would use string for the Bigint constructer then glibc would fail to find _Z23php_driver_parse_bigintPciPl (php_driver_parse_bigint(char*, int, long*)) because math.cpp was never compiled and linked to the shared object.

That also included other users of:

  • php_driver_parse_float
  • php_driver_parse_bigint
  • php_driver_parse_varint
  • php_driver_format_integer
  • php_driver_format_decimal
  • import_twos_complement

for example:

  • Cassandra\Bigint
  • Cassandra\Decimal
  • Cassandra\Float
  • Cassandra\Time
  • Cassandra\Varint

Reproducer:

cat > test.php << "EOF"
<?php

$foo = new \Cassandra\Bigint('0');
EOF
php test.php

Error output:

php: symbol lookup error: /usr/lib/php/20220829/cassandra.so: undefined symbol: _Z23php_driver_parse_bigintPciPl

Fixes: 8846c0b ("Fixing warning and removing LL_FORMAT")
Signed-off-by: Sven Eckelmann <[email protected]>
In C, it is valid to cast a void * to any other pointer. But for C++, this
is not valid any more and caused a build failure.

Fixes: d46ae16 ("Moving every file to C++")
Signed-off-by: Sven Eckelmann <[email protected]>
If someone would use string for the Bigint constructer then glibc would
fail to find _Z23php_driver_parse_bigintPciPl
(php_driver_parse_bigint(char*, int, long*)) because math.cpp was never
compiled and linked to the shared object.

That also included other users of:

* php_driver_parse_float
* php_driver_parse_bigint
* php_driver_parse_varint
* php_driver_format_integer
* php_driver_format_decimal
* import_twos_complement

for example:

* Cassandra\Bigint
* Cassandra\Decimal
* Cassandra\Float
* Cassandra\Time
* Cassandra\Varint

Fixes: 4684ee7 ("Remove php build system in favour of CMake")
Signed-off-by: Sven Eckelmann <[email protected]>
Fixes: 9d0a33f ("PHP-145 - Add API doc generator system")
Signed-off-by: Sven Eckelmann <[email protected]>
@DanielHe4rt
Copy link
Collaborator

Hey @ecsv, thanks for the contribution! Probably @CodeLieutenant will be validating the changes soon.

You're using this driver with Cassandra or ScyllaDB? Just curious about the use-case as well for choosing PHP for it.

@ecsv
Copy link
Author

ecsv commented Apr 12, 2024

You're using this driver with Cassandra or ScyllaDB?

I am using ScyllaDB. But I've also used it at some point against Datastax Astra with cql-proxy. Unfortunately(?) we had so many problems with their infrastructure that it was better for us to completely switch to ScyllaDB.

Just curious about the use-case as well for choosing PHP for it.

It is just for an older software stack which was initially written in PHP.

So thanks for still maintaining a php-driver :)

@CodeLieutenant
Copy link
Member

Thanks for the pull request, nice catch.

I've reverted the things you deleted from math.h and math.cpp as I'll be adding support for double not just float to the Float class

@CodeLieutenant CodeLieutenant merged commit a3b4d5d into he4rt:v1.3.x Apr 12, 2024
0 of 6 checks passed
@ecsv ecsv deleted the fix-bigint-string-constructor branch April 12, 2024 18:39
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