I have two sites using Codeigniter. Today I have updated sites to Codeigniter 3.1.7 (from 3.1.6). After that at one of this sites email validation had broken, valid_email validation rule doesn't work any more. On second site all fine. I had check out error logs and found error:
ERROR - 2018-02-06 10:13:21 --> Severity: Warning --> idn_to_ascii() expects parameter 3 to be long, string given /public_html/system/libraries/Form_validation.php 1235
Codeigniter's changlog says:
Updated Form Validation Library rule valid_email to use INTL_IDNA_VARIANT_UTS46 for non-ASCII domain names.
It seems to me that INTL_IDNA_VARIANT_UTS46 constant is not defined. Site using PHP Version 5.6.30
How can I fix this issue?
I found discussion of this problem here.
Issue is outdated ICU library (ICU version 4.2.1 was installed)
Go to system/library/email.php and replace valid_email()
public function valid_email($email)
{
if (function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46') && $atpos = strpos($email, '#'))
{
$email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46);
}
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}
just get the latest library for email
Get the latest codeigniter zip file
then go to system->libraries->Email file
copy that email file and paste it into your previous Email.php library file then it will work
I think there's a better way to sort out that issue.
As we all know that email library not supported in php 7.2 and that's why error occured
idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated
Error Screenshot of codeigniter email library
Quick Solution :
--> Go to cPanel
--> Select PHP version
--> change it to 7.1 instead of 7.2
For my case. I am also facing this issue.
Error:
Severity: 8192
Message: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated Filename: libraries/Form_validation.php
Line Number: 1234
I downloaded the Latest CodeIgniter version. Then from the system/libraries folder copied Email.php and Form_validation.php. Then replaced with Existing Email.php and Form_validation.php at the same path.
After replace, It is start working Fine..!!
Thanks #Evgeny for Guide.
The above issue would occur when you have incompatible CI and PHP version combinations. I mean newer PHP version and older CI version, vice-versa. I had PHP 7.3 on my machine and the CI repo/project I downloaded from github had CI version 3.1.5. I had to replace the system folder (of 3.1.5 with that of newer CI versions, 3.1.10 in my case) to resolve this issue
Related
I use the extension "ap_docchecklogin" (https://extensions.typo3.org/extension/ap_docchecklogin/), which works under Typo3 8.7.29. Only under a fresh TYPO3 version 9.5.11 I get the following message:
No class named EXT:ap_docchecklogin/Classes/DocCheckAuthenticationService.php:&Antwerpes\ApDocchecklogin\DocCheckAuthenticationService
This is the code where the error happends:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['initFEuser'][] = 'EXT:ap_docchecklogin/Classes/DocCheckAuthenticationService.php:&Antwerpes\ApDocchecklogin\DocCheckAuthenticationService->bypassLoginForCrawling';
Of course, I cleared the cache and renewed PHP Autoload. I also looked at the extension and the class definitely exists.
Both Typo3 versions run on the same server under the same settings.
Where is the difference between the Typo3 versions? Why it works in version 8? Has anyone ever had similar problems?
According to the changelog here: https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5/Deprecation-86279-VariousHooksAndPSR-15Middlewares.html, Hooks which is used in the extension has deprecated in the TYPO3 9 LTS version.
You can see the issue here: https://forge.typo3.org/issues/87357
you can use a custom PSR-15 middleware instead.
I made small changes in the code and it's no longer showing an error. Don't know this works for you or not (Functionality I am talking about)
But try this way...
$GLOBALS['TYPO3_CONF_VARS']
['SC_OPTIONS']
['tslib/class.tslib_fe.php']
['initFEuser'][] = 'Antwerpes\\ApDocchecklogin\\DocCheckAuthenticationService->bypassLoginForCrawling';
Does this help?
I installed the MongoDB PHP driver on Windows 10 (I'm using WAMP equipped with PHP 5.6.25. following the istructions I found at http://php.net/manual/en/mongodb.installation.windows.php and I installed also the libbson and libmongoc libraries (requested as requirements) as written at http://php.net/manual/en/mongodb.requirements.php.
Then, I added the bin folders of MongoDB, libbson and libmongoc to system path.
However, even if I can see the php_mongodb extension in the extensions list of WAMP, launching phpinfo() the mongo extension doesn't appear with the others.
Furthermore, tryng to connect to my database with
<?php
$mongo=new MongoClient("");
$db=$mongo->galileo;
$collection= $db->items;
print_r("Number of documens: "); ?>
I got the error
Fatal error: Class 'MongoClient' not found in C:\wamp64\www\galileo\index.php >on line 21
At a first look, reading this error, it might seem like that PHP is looking for php_mongodb extension in the uncorrect folder i.e. C:\wamp64\www\galileo\index.php (where the index page of my project is placed) instead of the correct one C:\wamp64\bin\php\php5.6.25\ext where all the extensions are.
But, looking at php log file php_error.log I find also a warning that says:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp64/bin/php/php5.6.25/ext/php_mongodb.dll' - Il sistema operativo non pu� eseguire %1.
in Unknown on line 0.
(for not Italian speaking, the phrase after - means the operating system can't execute %1, even if I can't imagine what %1 stands for).
Even using the new class MongoDB\Driver\Manager I get the error
Fatal error: Class 'MongoDB\Driver\Manager' not found in C:\wamp64\www\galileo\index.php on line 21
and the same warning.
Do you notice some error or forgetfulness in the installation process as I described and, if not, do you know how to fix the problem?
The problem is certainly related to WAMP and I think is related to the multiple php.ini in his folders. In fact, in the apache folder you can find a php.ini file that cannot be modified, otherwise nothing works at all; at the same time any changes made to the php.ini file in the php folder seems have no effect except making appear the mongodb extension in the extensions list.
So, I try using XAMPP, as suggested in this video tutorial and it works. Using Composer I was able to install also the PHP library and not only the driver.
you should not use 'MongoClient class' anymore, this extension that defines this class is deprecated. look at here.
instead, you should use MongoDB\Driver\Manager class. please read http://php.net/manual/en/class.mongodb-driver-manager.php.
and the setup must be like this in php:
$mongo = new MongoDB\Driver\Manager("mongodb://localhost:27017");
And if you still use the old class; you either need to install the old legacy extension (pecl install mongo) and use PHP 5.x, or update your code to use this new driver's classes as the old driver is not available for PHP 7. There is an upgrade guide at here.
the last part is from derickr's answer in this issue on github: https://github.com/mongodb/mongo-php-driver/issues/300
I am trying to make a project work. But I am getting an error like this:
Class 'App' not found in /var/www/html/project/test.php on line 4
line 4 of this file says:
app::$activepage = $_GET['_page'] ? httpget('_page') : $_POST['_page'] ? httppost('_page') : 0);
I am using cakePhp Version: 1.3.15-1.
The weird thing is that when I do apt show cakephp it says State: not installed
However, I have followed all the instructions of https://www.digitalocean.com/community/tutorials/how-to-install-cakephp-on-an-ubuntu-12-04-vps and when I open the index.php file of cakephp, it doesn't indicate any errors.
As I said in my Comment:
Your snippet / folder structure doesn't look like CakePHP.
Part of the problem may be a version mismatch. You say you're using version 1.3.15, but the tutorial on installing it that you link was created over a year later and references version 2.3.9. It looks like the general steps are the same, based on comparing your tutorial to the steps in the 2.X blog tutorial. You might have more luck with an older tutorial on using CakePHP on Ubuntu. Most of the steps look similar, but there are some differences with the .htaccess portion that could be causing the problem. Neither the 1.3 or 2.3 versions look like they require any "installing."
If you're not looking at the older version for any particular reason, of course it's best to use the most recent version of CakePHP, but I assume you have a particular reason for using that version. But if you're stuck, you might try a newer version to see if it gives the same errors.
I have been using the web based bibliography management system aigaion2 for some years, accumulating thousands of references & linked pdf files. However after upgrading from ubuntu 12.04 to 14.04 - with a change in the version of PHP - this fails to give me a log-in screen. There are 2 warning messages;
I am at a loss how to deal with this - does anybody have this working with a recent PHP version or might have any idea how to fix this. From the aigaion website, it seems the package does not have any active maintainers any longer.
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: gettext/gettext.inc
Line Number: 195
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /data1/aigaion2/codeigniter/libraries/Exceptions.php:166)
Filename: helpers/url_helper.php
Line Number: 541
I'm trying to use Aigaion too. I got some errors.
You will find new release here :
On source.forge : Source.Forge
This release replaces old php "commands" to some new ones
eregi to preg_replace
split to explode, etc.
It seems that a 2.5 beta exists :
Release 2.5 beta
I'll check today.
For your problem, I did a small update in the module aigaion2\aigaionengine\libraries\gettext\gettext.inc ligne 193
function _bind_textdomain_codeset($domain, $codeset) {
global $text_domains;
/*
* MVT 150505 : Add !isset due to warning errors
* It is a temporary features. It should be better
* to migrate to a new PHP Release
* Tested with Xamp / Php 5.6.8
* I did this patch in order to use Aigaion with no errors
* I don't have a large knowledge in PHP. Sorry
*/
if (!isset($text_domains[$domain]))
$text_domains[$domain] = new stdClass();
$text_domains[$domain]->codeset = $codeset;
}
I found an answer here :
Empty objects
This should be a little patch...
further development of aigaion is being made at http://github.com/aigaion. This verison is compatible with php7, besides not fully updated.
I have used PHPExcel for my codeigniter app and it is working perfectly in localhost, but when I host this to server, I am getting following error :
Fatal error: Class 'PHPExcel_Shared_String' not found in \xx\xx\xx
third_party\PHPExcel\Autoloader.php on line 36
There was a change introduced to the autoloader in the latest version of PHPExcel that appears to have broken backward compatibility with versions of PHP < 5.3.0
If you edit the Classes/PHPExcel/Autoloader.php file and change line 58, which should read
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true);
to
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
I've already made a change to the develop branch on github to test for the PHP version and execute the appropriate line
While this was not deliberate, please note that we really are trying to get users to upgrade to at least version 5.3.0 of PHP, because we can't address any of the memory/performance issues that users working with large spreadsheets complain about until we can use some of the new features available in more recent versions of PHP. Version 5.2 of PHP is no longer supported, and even version 5.3 is end-of-life and will be unsupported before the end of this year
struggled with this issue for a long time under Linux and PHP 5.4x. In the end, in addition to the fix above, I resorted to changing the code on line 73 of the Autoloader file which sets the $pClassFilePath variable from relative (using PHPEXCEL_ROOT) to absolute following the machines file tree. This might only be a hack, but it saved my sanity after several days of trying. Hope this helps someone. Cheers
I had this issue too and i solved it by changing permissions on "Shared" directory to 655.
I Hope it helps
If your server is on Linux, it can be permission problem... Just add all permissions for PHPExcel Folder in you Vendor (on server side) and all subfolders for it. I have same problem and i have solved it by this way...
What worked for me was changing PHPExcel/Autoloader.php line 81 from
if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {
to
if ((stream_resolve_include_path($pClassFilePath) === FALSE)) {
I prefer this approach because it didn't require me to modify file permissions and it should work in PHP 5.3.2 and later.