php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57832 name mismatches in statistics.c
Submitted: 2007-09-11 09:35 UTC Modified: 2016-05-28 05:22 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: hans at origin dot edvz dot uni-linz dot ac dot at Assigned: uchiyama (profile)
Status: Closed Package: stats (PECL)
PHP Version: 4.4.5 OS: Linux
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 + 25 = ?
Subscribe to this entry?

 
 [2007-09-11 09:35 UTC] hans at origin dot edvz dot uni-linz dot ac dot at
Description:
------------
in stats-1.0.2/statistics.c we have some conflicts in the
name maps ... the actual C statement declaring the function name and binding to the randlib.c function uses a different name as the 'proto' comment tells

e.g.

/* {{{ proto int stats_rand_gen_int(void)
  Generates random integer between 1 and 2147483562 */
PHP_FUNCTION(stats_rand_ignlgi)
             ^^^^^^^^^^^^^^^^^ mismatch/conflict with
                               proto name 

should read correctly:
/* {{{ proto int stats_rand_gen_int(void)
  Generates random integer between 1 and 2147483562 */
PHP_FUNCTION(stats_rand_int)
             ^^^^^^^^^^^^^^^ corresponds to 'proto' name


The following command pipe generates a list of all name pairs supposed to be a mismatch:

rapax STATS-Extension/stats-1.0.2> egrep 'PHP_FUNCTION\(st|proto' statistics.c | awk -F'[\(\) ]' '/proto/{nn=$5; next;} /)/{if ( nn != $2) print "mismatch: ",nn, $2}'
mismatch:  stats_stat_gennch stats_cdf_normal
mismatch:  stats_stat_noncentral_t stats_cdf_noncentral_t
mismatch:  stats_rand_get_seeds stats_rand_getsd
mismatch:  stats_rand_gen_int stats_rand_ignlgi
mismatch:  stats_rand_gen_noncenral_chisquare stats_rand_gen_noncentral_chisquare
mismatch:  stats_rand_gen_noncentral_f stats_rand_gen_noncenral_f
mismatch:  stats_rand_gen_ibinomial stats_rand_ibinomial
mismatch:  stats_rand_gen_ibinomial_negative stats_rand_ibinomial_negative
mismatch:  stats_den_uniform stats_dens_uniform
mismatch:  stats_dens_negative_binomial stats_dens_pmf_negative_binomial
mismatch:  stats_stat_gennch stats_stat_factorial


---> for each of these names the proper declaration/definition/mapping in 
  php_statistics.h
  statistics.c
needs to be checked / corrected


Reproduce code:
---------------
<?

echo " === testing random generator \n";
//echo " stats_rand_gen_int() ... undefined ... use stats_rand_ignlgi() " . stats_rand_ignlgi() . " \n";
echo " stats_rand_gen_int()  --> " . stats_rand_gen_int() . " \n";

?>


Expected result:
----------------
X-Powered-By: PHP/4.4.5
Content-type: text/html


 === testing random generator
 stats_rand_gen_int()  --> 695163044


Actual result:
--------------
rapax DIST/STATS-Extension> /opt/php4/inst/bin/php MeJ_test_rand_gen_int.php
X-Powered-By: PHP/4.4.5
Content-type: text/html


 === testing random generator
<br />
<b>Fatal error</b>:  Call to undefined function: stats_rand_gen_int() in <b>/opt/php4/DIST/STATS-Extension/MeJ_test_rand_gen_int.php</b> on line <b>6</b><br />


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-11 09:39 UTC] hans at origin dot edvz dot uni-linz dot ac dot at
... sorry there are some typos in my bug report ...

for example:

PHP_FUNCTION(stats_rand_int)
             ^^^^^^^^^^^^^^^ corresponds to 'proto' name
should really read:

PHP_FUNCTION(stats_rand_gen_int)
             ^^^^^^^^^^^^^^^^^^ corresponds to 'proto' name


but the 'idea' should be clear ;-))))
 [2013-12-17 01:37 UTC] wendellp at operamail dot com
This has not been fixed in v1.0.3.
 [2015-05-03 19:47 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2016-05-28 00:29 UTC] uchiyama@php.net
-Status: Verified +Status: Assigned -Assigned To: +Assigned To: uchiyama
 [2016-05-28 05:22 UTC] uchiyama@php.net
-Status: Assigned +Status: Closed
 [2016-05-28 05:22 UTC] uchiyama@php.net
Fixed in version 1.0.4/2.0.2
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 14:01:27 2024 UTC