numfmt_format() expects parameter 1 to be NumberFormatter, null given - php

I recently upgraded my WAMP server and I can't seem to get the Intl extension to work. I've made sure that
the extension path in both ini files are correct
the extension is loaded in both inis
I can see the extension with php --re intl
I can see an example function with php --rf numfmt_create
I have icu dlls files in my php folder (icu 46, php 5.3.8, wamp 2.2)
I have appended C:\wamp\bin\php\php5.3.8 to the PATH in System variables
The code is correct - working code before wamp upgrade and php manual example codes fail
I'm trying to use the Number Formatter but it gives me some strange errors. Take this example code from the php manual for example:
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
echo numfmt_format($fmt, 1234567.891234567890000)."\n";
$fmt = numfmt_create( 'it', NumberFormatter::SPELLOUT );
echo numfmt_format($fmt, 1142)."\n";
?>
It gives me this:
A PHP Error was encountered
Severity: Warning
Message: numfmt_format() expects parameter 1 to be NumberFormatter,
null given
Filename: controllers/test.php
Line Number: 867
Backtrace:
File: C:\wamp\www\application\controllers\test.php Line: 867
Function: numfmt_format
File: C:\wamp\www\index.php Line: 260 Function: require_once
A PHP Error was encountered
Severity: Warning
Message: numfmt_format() expects parameter 1 to be NumberFormatter,
null given
Filename: controllers/test.php
Line Number: 869
Backtrace:
File: C:\wamp\www\application\controllers\test.php Line: 869
Function: numfmt_format
File: C:\wamp\www\index.php Line: 260 Function: require_once
I notice that numfmt_create() seems to be returning NULL regardless of what I do.

can you run the icuinfo.exe tool from ICU to see if ICU is loading its data properly?

Apparently the 64 version of WAMP did not have correct icu dlls - using the 32 version worked.

Related

PHP 7.2 throws an error on WordPress class-wp-hook.php file

Site on WP Engine. They're forcing an upgrade to PHP 7.2.
PHP 7.2 - error with /class-wp-hook.php
PHP 7.2
WordPress 5.0
WPEngine
Warning : Parameter 1 to wp_default_scripts() expected to be a
reference, value given in
/nas/content/live/*/wp-includes/class-wp-hook.php on line 286
Warning : Parameter 1 to wp_default_packages() expected to be a
reference, value given in
/nas/content/live/*/wp-includes/class-wp-hook.php on line 286
Warning : Parameter 1 to wp_default_styles() expected to be a
reference, value given in
/nas/content/live/*/wp-includes/class-wp-hook.php on line 286
Already tried:
0 active plugin
Default WordPress theme.
I will like to solve the problem, not just hide the warning

Getting error when trying to install POS on Localhost : Fatal error: Can't use method return value in write context

I am trying to install opensourcepos from https://github.com/jekkos/opensourcepos
But I am getting this error:
Fatal error: Can't use method return value in write context in D:\Xampp\htdocs\opensourcepos\application\helpers\locale_helper.php on line 67
A PHP Error was encountered
Severity: Compile Error
Message: Can't use method return value in write context
Filename: helpers/locale_helper.php
Line Number: 67
Backtrace:
I followed instructions, this is a brand new install, I'm at a loss...
I'm on WIndows 7, using Localhost with Xampp
The line 67 is question is this one:
if (empty($config->item('thousands_separator')))
When I comment it out, the site loads, but it doesn't work
check readme txt
You are getting following error Message: Can't use method return value in write context saying that you are probably using PHP7 which is not completely supported yet. Check your hosting configuration to verify whether you have a supported PHP version installed

CentOS OpenSSL php_openssl.dll not found

I get this error every now and then on my websites. After some Googling, I noticed that Linux doesn't support .dll files - but how do I get rid of this message?
Full error message:
A PHP Error was encountered
Severity: Core Warning
Message: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20121212/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20121212/php_openssl.dll: cannot open shared object file: No such file or directory
Filename: Unknown
Line Number: 0
Backtrace:
Seems like php_openssl.dll was being included from my php.ini, I commented this line out and it works!

Connecting to Oracle in Codeigniter (undefined constant OCI_COMMIT_ON_SUCCESS)

im kind of a n00b to Oracle db's, but when i set my dbdriver in codeigniter to oci8, i get the following error, which is weird, providing the extension is enabled in the php.ini file.
I get the following error.
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed 'OCI_COMMIT_ON_SUCCESS'
Filename: database/DB.php
Line Number: 82
You should install/enable the oci8 extension.
http://www.php.net/manual/en/book.oci8.php

After migrating a website with MYSQL DB the website (PHP) displays an error. what does the error mean?

I am still pretty new to everything. So if you need any more information, let me know.
What I did so far :
I copied a website from one ubuntu 10.10 server to another 12.04 ubuntu server.
I also backupped and restored the MYSQL Database.
I configurated apache2 (which is right now just locally) to display my page.
I have 3 Pages on 3 ports, the other pages work, so I probably configurated apache2 correctly.
At first i just saw a blank page, when I tried to contact my website, so I switched on the error screens.
This is what appears , I replaced the websitename to xxxx :
Deprecated: Function set_magic_quotes_runtime() is deprecated in /data/xxxx/www/index.php on line 11
Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/DB.php
on line 311 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/DB.php
on line 385 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/DB.php
on line 923 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/HTML/AJAX/Server.php
on line 161 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/HTML/AJAX.php
on line 612 Deprecated: Assigning the return value of new by reference is deprecated in /data/xxxx/www/pear/HTML/AJAX/Serializer/JSON.php
on line 46 Warning: include_once(../pear/Net/Socket.php): failed to open stream: No such file or directory in /data/xxxx/www/pear/Net/SMTP.php
on line 25 Warning: include_once(): Failed opening '../pear/Net/Socket.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')
in /data/xxxx/www/pear/Net/SMTP.php on line 25 Warning: include_once(PEAR.php): failed to open stream: No such file or directory in
/data/xxxx/www/pear/Mail/mime.php on line 65 Warning: include_once(): Failed opening 'PEAR.php' for inclusion
(include_path='.:/usr/share/php:/usr/share/pear') in /data/xxxx/www/pear/Mail/mime.php on line 65 Warning:
include_once(../pear/Mail/mimePart.php): failed to open stream: No such file or directory in /data/xxxx/www/pear/Mail/mime.php
on line 75 Warning: include_once(): Failed opening '../pear/Mail/mimePart.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')
in /data/xxxx/www/pear/Mail/mime.php on line 75 Deprecated: Assigning the return value of new by reference is deprecated in
/data/xxxx/www/pear/Spreadsheet/Excel/Writer/Workbook.php on line 180 Deprecated: Assigning the return value of new by reference
is deprecated in /data/xxxx/www/pear/Spreadsheet/Excel/Writer/Workbook.php on line 189 Deprecated: Call-time pass-by-reference
has been deprecated in /data/xxxx/www/modules/statistics/frontend.class.php on line 16 Deprecated: Call-time pass-by-reference
has been deprecated in /data/xxxx/www/modules/users/frontend.class.php on line 19 Deprecated: Assigning the return value of new
by reference is deprecated in /data/xxxx/www/pear/DB/common.php on line 958 Deprecated: Assigning the return value of new by
reference is deprecated in /data/xxxx/www/pear/DB/common.php on line 1150 Notice: DB Error: connect failed in
/data/xxxx/www/classes/registry.class.php on line 70
the only thing I understand here is : Simple Mail Transfer Protocol (SMTP)
it seems that some data was not copied correctly.
How to check the excat size of the folder and subfolders? so I can compare at least :)
Thanks in advance.
ANY HELP will be upvoted very fast.
set_magic_quotes_runtime()
Just get rid of this function call.
Assigning the return value of new by reference is deprecated in
Just get rid of & sign in the statement.
Warning: include_once(PEAR.php):
You have to install PEAR
It appears you have changed PHP versions. Very likely that your Ubuntu 10.10 box was running PHP 5.2.x or PHP 5.3.x and now your Ubuntu 12.04 box is running PHP 5.4.x or PHP 5.5.x (low chance).
You have two real solutions:
Update your code (recommended)
Go in line-by-line and update your code and correct the errors, you should be able to research those errors individually and use http://php.net/ as a resource.
Downgrade your php/mysql version
You can check your old PHP version on the Ubuntu 10.10 box by running the following command in terminal: php -v; then do the same command on your 12.04 box to see what you have upgraded to.
There is plenty of documentation out there for changing PHP versions on Linux, so I empower you to do that research.
You will also want to copy your php.ini configuration over to the new install also--it's very likely you have some ancient configurations by the looks of your magic_quotes errors.

Categories