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

BUG #73998: Numeric properties are not accessible from get_object_vars #2354

Closed
wants to merge 1 commit into
base: PHP-7.0
from

Conversation

4 participants
@mhagstrand
Contributor

mhagstrand commented Jan 31, 2017

No description provided.

@mhagstrand

This comment has been minimized.

Show comment
Hide comment
@mhagstrand

mhagstrand Jan 31, 2017

Contributor

get_object_vars hashes the numeric string when exporting it the symbols table

(gdb) print ((Bucket)$hash->arData[0]).h
$2 = 9223372043238033807

In the symbols table numeric strings are not hashed, There numeric value is used as the hash value:

(gdb) print ((Bucket)$hash2->arData[0]).h
$9 = 1234
Contributor

mhagstrand commented Jan 31, 2017

get_object_vars hashes the numeric string when exporting it the symbols table

(gdb) print ((Bucket)$hash->arData[0]).h
$2 = 9223372043238033807

In the symbols table numeric strings are not hashed, There numeric value is used as the hash value:

(gdb) print ((Bucket)$hash2->arData[0]).h
$9 = 1234
@mhagstrand

This comment has been minimized.

Show comment
Hide comment
@mhagstrand

mhagstrand Jan 31, 2017

Contributor

It is causing a segfault in ext/spl/tests/array_017.phpt I need to look into

Contributor

mhagstrand commented Jan 31, 2017

It is causing a segfault in ext/spl/tests/array_017.phpt I need to look into

@mhagstrand

This comment has been minimized.

Show comment
Hide comment
@mhagstrand

mhagstrand Jan 31, 2017

Contributor

Fixed the issue with ext/spl/tests/array_017.phpt

Contributor

mhagstrand commented Jan 31, 2017

Fixed the issue with ext/spl/tests/array_017.phpt

@krakjoe krakjoe added the Bugfix label Jan 31, 2017

@mhagstrand

This comment has been minimized.

Show comment
Hide comment
@mhagstrand

mhagstrand Jan 31, 2017

Contributor

Thanks, I have added a check to make sure the key is not null.

Contributor

mhagstrand commented Jan 31, 2017

Thanks, I have added a check to make sure the key is not null.

@@ -0,0 +1,19 @@
--TEST--
Bug #35239 (array_key_exists fails on arrays created by get_object_vars)

This comment has been minimized.

@nikic

nikic Feb 2, 2017

Member

Wrong bug ID here?

@nikic

nikic Feb 2, 2017

Member

Wrong bug ID here?

This comment has been minimized.

@mhagstrand

mhagstrand Feb 2, 2017

Contributor

Yeah, I copied another test as a basic template! 😄 Thanks for catching that.

@mhagstrand

mhagstrand Feb 2, 2017

Contributor

Yeah, I copied another test as a basic template! 😄 Thanks for catching that.

@nikic

This comment has been minimized.

Show comment
Hide comment
@nikic

nikic Feb 2, 2017

Member

Merged via dd9cf23, thanks!

Member

nikic commented Feb 2, 2017

Merged via dd9cf23, thanks!

@nikic nikic closed this Feb 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment