Server IP : 172.67.216.182 / Your IP : 162.158.108.158 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/php/82/src/ext/intl/formatter/ |
Upload File : |
/* +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | https://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | [email protected] so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Stanislav Malyshev <[email protected]> | +----------------------------------------------------------------------+ */ #include <unicode/unum.h> #include "formatter_class.h" #include "php_intl.h" #include "formatter_data.h" #include "formatter_format.h" #include "formatter_arginfo.h" #include <zend_exceptions.h> #include "Zend/zend_interfaces.h" zend_class_entry *NumberFormatter_ce_ptr = NULL; static zend_object_handlers NumberFormatter_handlers; /* * Auxiliary functions needed by objects of 'NumberFormatter' class */ /* {{{ NumberFormatter_objects_free */ void NumberFormatter_object_free( zend_object *object ) { NumberFormatter_object* nfo = php_intl_number_format_fetch_object(object); zend_object_std_dtor( &nfo->zo ); formatter_data_free( &nfo->nf_data ); } /* }}} */ /* {{{ NumberFormatter_object_create */ zend_object *NumberFormatter_object_create(zend_class_entry *ce) { NumberFormatter_object* intern; intern = zend_object_alloc(sizeof(NumberFormatter_object), ce); formatter_data_init( &intern->nf_data ); zend_object_std_init( &intern->zo, ce ); object_properties_init(&intern->zo, ce); intern->zo.handlers = &NumberFormatter_handlers; return &intern->zo; } /* }}} */ /* {{{ NumberFormatter_object_clone */ zend_object *NumberFormatter_object_clone(zend_object *object) { NumberFormatter_object *nfo, *new_nfo; zend_object *new_obj; nfo = php_intl_number_format_fetch_object(object); intl_error_reset(INTL_DATA_ERROR_P(nfo)); new_obj = NumberFormatter_ce_ptr->create_object(object->ce); new_nfo = php_intl_number_format_fetch_object(new_obj); /* clone standard parts */ zend_objects_clone_members(&new_nfo->zo, &nfo->zo); /* clone formatter object. It may fail, the destruction code must handle this case */ if (FORMATTER_OBJECT(nfo) != NULL) { FORMATTER_OBJECT(new_nfo) = unum_clone(FORMATTER_OBJECT(nfo), &INTL_DATA_ERROR_CODE(nfo)); if (U_FAILURE(INTL_DATA_ERROR_CODE(nfo))) { /* set up error in case error handler is interested */ intl_errors_set(INTL_DATA_ERROR_P(nfo), INTL_DATA_ERROR_CODE(nfo), "Failed to clone NumberFormatter object", 0); zend_throw_exception(NULL, "Failed to clone NumberFormatter object", 0); } } else { zend_throw_exception(NULL, "Cannot clone unconstructed NumberFormatter", 0); } return new_obj; } /* }}} */ /* * 'NumberFormatter' class registration structures & functions */ /* {{{ formatter_register_class * Initialize 'NumberFormatter' class */ void formatter_register_class( void ) { /* Create and register 'NumberFormatter' class. */ NumberFormatter_ce_ptr = register_class_NumberFormatter(); NumberFormatter_ce_ptr->create_object = NumberFormatter_object_create; memcpy(&NumberFormatter_handlers, &std_object_handlers, sizeof(NumberFormatter_handlers)); NumberFormatter_handlers.offset = XtOffsetOf(NumberFormatter_object, zo); NumberFormatter_handlers.clone_obj = NumberFormatter_object_clone; NumberFormatter_handlers.free_obj = NumberFormatter_object_free; } /* }}} */