|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71810 Bizarre behavior with floats
Submitted: 2016-03-13 01:23 UTC Modified: -
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:-1 (-100.0%)
From: iggyvolz at gmail dot com Assigned:
Status: Open Package: lua (PECL)
PHP Version: 7.0.4 OS: Mac OS X 10.9.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: iggyvolz at gmail dot com
New email:
PHP Version: OS:


 [2016-03-13 01:23 UTC] iggyvolz at gmail dot com
Apparently Lua->assign() really hates floats.  I've found this come in several varieties.  If you have an array containing anything, then a key with a float value, then an array with a numeric key (I encountered this trying to pass along the $_SERVER variable - this is the smallest case I could get it down to), you will get a segmentation fault (Case C in test).  I then tried to narrow this down to just passing the float - which works fine.  However, passing an array with just the float complains about an unknown type error (Case B in test), and passing a specially crafted array with one key before the float seems to skip the float's key (Case A in test).  Examples below - they probably explain it better than I do.

Test script:
// /usr/local/debug.lua is function run() return input end
register_shutdown_function('LuaC'); // So that we can 'catch' the fatal error from LuaB and run LuaC
$LuaA=new Lua("/usr/local/debug.lua"); // Case A: the variable then float
echo "LuaA:\n";
$LuaB=new Lua("/usr/local/debug.lua"); // Case B: the float alone
echo "LuaB:\n";
function LuaC() // So that we can 'catch' the fatal error from LuaB and run LuaC
  $LuaC=new Lua("/usr/local/debug.lua"); // Case C: the segfault
  echo "LuaC:\n";

Expected result:
array(2) {
  string(1) "b"
array(1) {
array(3) {
  string(1) "b"
  array(1) {
    string(1) "e"

Actual result:
array(1) {
Fatal error: Lua::assign(): unsupported type `unknown' for lua in <file> on line 10
Segmentation fault: 11


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2022-06-02 03:55 UTC] maghsodid at yahoo dot com
The following pull request has been associated:

Patch Name: Fix issue with pt_BR not being updated
On GitHub:
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 12:01:27 2024 UTC