Bug #79311 [NEW]: enchant_dict_suggest() function fails on Big endian architecture

From: Date: Thu, 27 Feb 2020 10:50:17 +0000
Subject: Bug #79311 [NEW]: enchant_dict_suggest() function fails on Big endian architecture
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225744@lists.php.net to get a copy of this message
From: vibhutisawant18 at gmail dot com Operating system: Ubuntu 16.04 PHP version: master-Git-2020-02-27 (Git) Package: Variables related Bug Type: Bug Bug description:enchant_dict_suggest() function fails on Big endian architecture Description: ------------ ext/enchant/tests/dict_suggest.phpt TC fails as enchant_dict_suggest function is not compatible on Big Endian architecture. The failure is observed at memcpy function in ext/enchant/enchant.c. enchant_dict_suggest function fails to return an array of suggestions, instead it returns null object. It can be observed that the n_sugg variable is of type int(4 bytes) whereas the n_sugg_st variable is of type size_t(8 bytes). Hence due to different memory alignment on big endian system, the memcpy fails to copy the memory blocks containing actual data. AS a workaround, I found that by declaring data type of n_sugg as size_t instead of int, the TC passed on both, Little and Big endian system.Kindly let me know if I shall raise a PR with this changes. PFB test result observed on Little and big endian architecture for respective TC(ext/enchant/tests/dict_suggest.phpt). Little endian: test@5dfe04cf73b3:~/php/php-src$ ./sapi/cli/php -f "ext/enchant/tests/dict_suggest.phpt" --TEST-- enchant_dict_suggest() function --CREDITS-- marcosptf - <marcosptf@yahoo.com.br> --SKIPIF-- --FILE-- OK OK OK --EXPECT-- OK OK OK Big endian: test@3e72af658118:~/php/php-src$ ./sapi/cli/php -f "ext/enchant/tests/dict_suggest.phpt" --TEST-- enchant_dict_suggest() function --CREDITS-- marcosptf - <marcosptf@yahoo.com.br> --SKIPIF-- --FILE-- OK OK dict suggest failed --EXPECT-- OK OK OK -- Edit bug report at https://bugs.php.net/bug.php?id=79311&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79311&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79311&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79311&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79311&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79311&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79311&r=support Expected behavior: https://bugs.php.net/fix.php?id=79311&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79311&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79311&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79311&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79311&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79311&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79311&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79311&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79311&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79311&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79311&r=mysqlcfg

« previous php.bugs (#225744) next »