Doc #79454 [Ver->Csd]: transliterator_get_error_message arginfo is incorrect

From: Date: Tue, 07 Apr 2020 15:00:15 +0000
Subject: Doc #79454 [Ver->Csd]: transliterator_get_error_message arginfo is incorrect
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17468@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79454&edit=1 ID: 79454 Updated by: cmb@php.net Reported by: glen at pld-linux dot org Summary: transliterator_get_error_message arginfo is incorrect -Status: Verified +Status: Closed Type: Documentation Problem Package: intl Operating System: Irrelevant PHP Version: 7.4.4 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: @requinix, I the arginfo looks correct (PHP 7.3): D:\Users\cmb>php --rf transliterator_get_error_code Function [ <internal:intl> function transliterator_get_error_code ] { - Parameters [1] { Parameter #0 [ <required> Transliterator $trans ] } } D:\Users\cmb>php --rf transliterator_get_error_message Function [ <internal:intl> function transliterator_get_error_message ] { - Parameters [1] { Parameter #0 [ <required> Transliterator $trans ] } } Previous Comments: ------------------------------------------------------------------------ [2020-04-07 14:58:57] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=349637 Log: Fix #79454: transliterator_get_error_message arginfo is incorrect ------------------------------------------------------------------------ [2020-04-07 09:12:20] requinix@php.net getErrorMessage() is not documented as a static method. The documentation for the function form, and the source used to generate some of the documentation, is incorrect: it takes an argument of a Transliterator object. This function is specifically for error information related to a particular Transliterator instance, and you are right that you cannot use it to get an error from a failed call to a static method like createFromRules... ...because the error information for that case is stored elsewhere. See the generic intl functions: https://www.php.net/manual/en/ref.intl.php ------------------------------------------------------------------------ [2020-04-07 08:53:53] glen at pld-linux dot org Description: ------------ the https://www.php.net/manual/en/transliterator.geterrormessage.php is described to be called as static method, but it is not declared static and therefore can't be used why Transliterator::createFromRules for example failed. and transliterator_get_error_message() method won't help either, as it wants an transit object as argument, but I have none as it failed to be created. example with class method: ➔ php74 -n -r 'var_dump(Transliterator::createFromRules("Any-Latin")); var_dump(Transliterator::getErrorMessage());' NULL Fatal error: Uncaught Error: Non-static method Transliterator::getErrorMessage() cannot be called statically in Command line code:1 Stack trace: #0 {main} thrown in Command line code on line 1 example with procedural mode: ➔ php74 -n -r 'var_dump(Transliterator::createFromRules("Any-Latin")); var_dump(transliterator_get_error_message());' NULL Warning: transliterator_get_error_message() expects exactly 1 parameter, 0 given in Command line code on line 1 bool(false) Test script: --------------- var_dump(Transliterator::getErrorMessage()); Expected result: ---------------- Transliterator::createFromRules should perhaps throw, as there's no other way to pass error ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79454&edit=1

« previous php.doc.bugs (#17468) next »