php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72967 trader_ht_phasor and trader_ht_sine output parameter never modified
Submitted: 2016-08-29 18:30 UTC Modified: 2018-02-11 23:12 UTC
From: joshua dot saige at gmail dot com Assigned:
Status: Duplicate Package: Trader (PECL)
PHP Version: Irrelevant OS: Irrelevant
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:
Package:
Bug Type:
Summary:
From: joshua dot saige at gmail dot com
New email:
PHP Version: OS:

 

 [2016-08-29 18:30 UTC] joshua dot saige at gmail dot com
Description:
------------
The functions trader_ht_phasor and trader_ht_sine expect two parameters, the documentation lists one.  The second parameter for both is never populated with the expected data from the C TA-Lib functions.

As noted in Doc Bug #72882, the second required parameter is not listed in the documentation, but is required to execute.

In both cases, the data that should be injected into the second parameter is instead included in the return value.  The return value is a two-dimensional array instead of a single-dimensional array and a modified by-reference parameter, which would be expected given the second parameter is required.

This can be verified at http://svn.php.net/viewvc/pecl/trader/trunk/functions/trader_ht_phasor.c?view=markup for trader_ht_phasor and http://svn.php.net/viewvc/pecl/trader/trunk/functions/trader_ht_sine.c?view=markup for trader_ht_sine.

Using PHP 7.0.8 with Trader 0.4.0 on Windows Server 2012, IIS 8.5.

Test script:
---------------
<?php
$a1 = [];
$o1 = [];
for($i = 0; $i < 128; $i++){
    $a1[] = rand(1, 100);
}
$r1 = trader_ht_phasor($a1, $o1);
$r2 = trader_ht_phasor($a1, $a1);
print ($o1 == [] ? 'true' : 'false') . PHP_EOL;
print ($r1 == $r2 ? 'true' : 'false') . PHP_EOL;

//This prints the same when trader_ht_sine replaces trader_ht_phasor.


Expected result:
----------------
If the second parameter was being filled, the first print should be 'false'.
If the second parameter was an input parameter (it is not), the second print should be 'false'.  (Consider the second a sanity check.)

Actual result:
--------------
true
true

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-11 23:12 UTC] ab@php.net
-Status: Open +Status: Duplicate
 [2018-02-11 23:12 UTC] ab@php.net
Same as bug #72882.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 05 02:01:30 2024 UTC