Vtiger 6.5 error after installatiion - crm

I've just installed Vtiger 6.5 on windows xampp server, the installation went smoothly but as soon as I started the browser (localhost/vtigercrm) I get this error.
Fatal error: Cannot unset $this in C:\xampp\htdocs\vtigercrm\libraries\adodb\adodb-xmlschema.inc.php on line 160
Does anyone know what I've done wrong? I've downloaded and tried it several times, I've also changed the php.ini file according to the manual but doesn't seem to have an effect.

This issue seems to occur when we try to install vTiger6.5 in PHP 7. For me the vTiger6.5 got successfully installed after commenting the line number 160 and 2214.
Comment the Line number 160 and 2214 in the file vtigercrm\libraries\adodb\adodb-xmlschema.inc.php.
unset( $this ); /* comment this line no: 160 and 2214 */

This error may occurs in PHP 7 version. So proposed solution is below.
Please update that function with this one in file vtigercrm\libraries\adodb\adodb-xmlschema.inc.php on line 160
function Destroy() {
ini_set("magic_quotes_runtime", $this->mgq ); //Add this line
unset( $this );
}

Based on my experience, changing PHP version to 5.6 (or 5.5 or 5.4) will solve your problem. Although Vtiger 6.5 is supposed to be compatible with php 7, in practice it is not.

This error occurs when vtiger 6.5 is installed on the PHP 7 installation. Comment the unset ($ this); in the function Destroy ()
Line 160 function destroy () { // unset ($ this); }
Line 2216 function destroy () { ini_set ("magic_quotes_runtime", $ this-> mgq); #set_magic_quotes_runtime ($ this-> mgq); //unset ($ this); }

Open index.php file in root and add below mentioned code at start of a file
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED & ~E_STRICT);
Open /libraries/adodb/adodb-xmlschema.inc.php file and then
comment line 160
function destroy() {
//ini_set("magic_quotes_runtime", $this->mgq );
//unset( $this );
}
comment line 2214
function Destroy() {
//ini_set("magic_quotes_runtime", $this->mgq );
#set_magic_quotes_runtime( $this->mgq );
//unset( $this );
}
and then give 755 permission to /test folder
sudo chmod -R 755 test/

Related

PhpStorm with PHPUnit 8.4 gives exception Uncaught PHPUnit\Runner\Exception class ... could not be found

I tried to use PHPUnit v8. However I was not succeeded with PhpStorm. When I run simple test (class method) in PhpStorm I got the following message:
PHP Fatal error: Uncaught PHPUnit\Runner\Exception: Class 'Mrself\\TreeType\\Tests\\Functional\\BuildingTest' could not be found in '/vagrant/symfony-tree-type/tests/Functional/BuildingTest.php'. in /vagrant/symfony-tree-type/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php:65
Yes, I have that class and yes I have psr configured properly:
"autoload": {
"psr-4": {
"Mrself\\TreeType\\": "./src/"
}
},
"autoload-dev": {
"psr-4": {
"Mrself\\TreeType\\Tests\\": "./tests/"
}
}
The proof the I have everything correctly setup is that when I run vendor/bin/phpunit it gives me correct result.
When I run method in PhpStorm I got the following call:
/usr/bin/php /vagrant/symfony-tree-type/vendor/phpunit/phpunit/phpunit --configuration /vagrant/symfony-tree-type/phpunit.xml --filter "/(::testFormCanBeBuild)( .*)?$/" Mrself\\TreeType\\Tests\\Functional\\BuildingTest /vagrant/symfony-tree-type/tests/Functional/BuildingTest.php --teamcity
However if I prepend class namespace with \\ everything works correctly as well. I can not get a clue what's going on. PHPUnit version 7 works as well.
Same thing happened to me. All of the sudden I started getting the following error:
PHP Fatal error: Uncaught PHPUnit\Runner\Exception: Class 'Tests\\Feature\\ExampleTest' could not be found
And after I have read #frank-vue's comment I noticed the same thing and he did: If I run tests on the entire folder it runs normally, but if I run test on a specific class/method I get that error.
I tried earlier version of PHPStorm, downgraded PHP plugin etc... and nothing worked.
In my case, when I checked the stacktrace looks like:
#0 /var/www/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php(145): PHPUnit\Runner\StandardTestSuiteLoader->load('Tests\\\\Unit\\\\Ex...', '/var/www/tests/...')
#1 /var/www/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php(105): PHPUnit\Runner\BaseTestRunner->loadSuiteClass('Tests\\\\Unit\\\\Ex...', '/var/www/tests/...')
#2 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(177): PHPUnit\Runner\BaseTestRunner->getTest('Tests\\\\Unit\\\\Ex...', '/var/www/tests/...', Array)
#3 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(159): PHPUnit\TextUI\Command->run(Array, true)
#4 /var/www/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#5 {main}
thrown in /var/www/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php on line 69
Notice Tests\\\\Unit\\\\Ex... instead of Tests\\Unit\\Ex....
So in the end I broke the rule and I've modified vendor file, which should be avoided at any cost, but as a temporary solution it solves my problem.
So I added 1 line to the vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php on line 98 (PHPUnit version 8.4.1), which replaces unnecessary '\'s.
if (empty($suiteClassFile) && \is_dir($suiteClassName) && !\is_file($suiteClassName . '.php')) {
/** #var string[] $files */
$files = (new FileIteratorFacade)->getFilesAsArray(
$suiteClassName,
$suffixes
);
$suite = new TestSuite($suiteClassName);
$suite->addTestFiles($files);
return $suite;
}
$suiteClassName = str_replace('\\\\', '\\', $suiteClassName); // THIS IS THE LINE I ADDED
try {
$testClass = $this->loadSuiteClass(
$suiteClassName,
$suiteClassFile
);
} catch (Exception $e) {
$this->runFailed($e->getMessage());
return null;
}

How to fix "Warning: A non-numeric value encountered in" WP

On my WordPress page I use the plugin occupancy plan "https://wordpress.org/plugins/occupancyplan/" after the update to PHP 7.3 wordpress gives the following error message:
Warning: A non-numeric value encountered in
/homepages/XX/XXXXXXXXXX/htdocs/XXXXXXXXXX/wp-content/plugins/occupancyplan/occupancy_plan_classes.php
on line 4 - 38 and on line 620, 641, 657
How can I solve the problem?
it's probably a bit late but try adding this validation to every line with that error!
//fix issue with tax when it's not selected it
IF(empty ($ variable name)){
/* null */
}else{
$return = whatever was previously at the line
At the end you must to return something
}
return floatval( $return );
Good Luck!

wordpress: Uncaught Error: Call to undefined function mb_internal_encoding()

I have just installed equifax-credit-check plugin in my wordpress site.Now this error displayed
Fatal error: Uncaught Error: Call to undefined function mb_internal_encoding() in /home/uplogictecz/public_html/demo/reportlink/wp-content/plugins/equifax-credit-check/vendor/danielstjules/stringy/src/Stringy.php:58 Stack trace: #0 /home/uplogictecz/public_html/demo/reportlink/wp-content/plugins/equifax-credit-check/vendor/danielstjules/stringy/src/Create.php(17): Stringy\Stringy->__construct('/reportlink/das...', NULL) #1 /home/uplogictecz/public_html/demo/reportlink/wp-content/plugins/equifax-credit-check/class/App.php(179): Stringy\create('/reportlink/das...') #2 /home/uplogictecz/public_html/demo/reportlink/wp-content/plugins/equifax-credit-check/class/PluginCore.php(300): Baerr\App\App::is_dashboard() #3 /home/uplogictecz/public_html/demo/reportlink/wp-includes/class-wp-hook.php(298): Baerr\App\PluginCore->dashboard_access_control('') #4 /home/uplogictecz/public_html/demo/reportlink/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(false, Array) #5 /home/uplogictecz/public_html/demo/reportlink/wp-includes/pl in /home/uplogictecz/public_html/demo/reportlink/wp-content/plugins/equifax-credit-check/vendor/danielstjules/stringy/src/Stringy.php on line 58
In my /home/uplogictecz/public_html/demo/reportlink/wp-content/plugins/equifax-credit-check/vendor/danielstjules/stringy/src/Stringy.php on line 58
Line function is
public function __construct($str = '', $encoding = null)
{
if (is_array($str)) {
throw new InvalidArgumentException(
'Passed value cannot be an array'
);
} elseif (is_object($str) && !method_exists($str, '__toString')) {
throw new InvalidArgumentException(
'Passed object must have a __toString method'
);
}
$this->str = (string) $str;
$this->encoding = $encoding ?: \mb_internal_encoding();
}
This line is $this->encoding = $encoding ?: \mb_internal_encoding(); no 58.
How to fix this issue ?.Kindly check it.
Your PHP environment is missing MBSTRING extension. It is normal, as mbstring is not built-in default extension in some PHP installations. You can install it if you have an access to your server:
For PHP 5.* and Debian
sudo apt-get install php-mbstring
For PHP 5.* and Fedora
yum install php-mbstring
For PHP 7.0, use
sudo apt-get install php7.0-mbstring
And of course, if you don't have server access, you need to ask your hosting provider to enable this extension for your website server.

ZendFramework 2 - PHPUnit - command line works, NetBeans states "No tests executed"

I seem to have a slight problem with executing PHPUnit tests for own modules in the Zend Framework 2.
OS: Mac OS 10.8.3
Zend Framework 2.1.4
PHPUnit Version 3.7.19 (installed via pear)
PHP Version 5.3.15 (xdebug enabled, version 2.1.3)
I followed the instructions of the Zend guideline, to create the module "Album" (http://framework.zend.com/manual/2.1/en/user-guide/modules.html)
Instead of putting the unit tests into the module folders, I want to have them all in one centralized folder. This is the base structure of my application:
-config
-data
-module
-public
-tests
--Modules
---Album
----AlbumTest.php
--Bootstrap.php
--phpunit.xml
-vendor
...(license, readme, composers and init_autoloader.php)
-> The test for the Module Album resides in a folder "Modules/Album" in "tests". The folder "tests" contains also the Bootstrap.php and phpunit.xml.
Here is the content of the files:
Bootstrap.php
<?php
/*
* Set error reporting to the level to which Zend Framework code must comply.
*/
error_reporting( E_ALL | E_STRICT );
/*
* The first run required me to fix some constants
*/
defined('TESTS_ZEND_FORM_RECAPTCHA_PUBLIC_KEY') || define('TESTS_ZEND_FORM_RECAPTCHA_PUBLIC_KEY', 'public key');
defined('TESTS_ZEND_FORM_RECAPTCHA_PRIVATE_KEY') || define('TESTS_ZEND_FORM_RECAPTCHA_PRIVATE_KEY', 'private key');
defined('TESTS_ZEND_LDAP_PRINCIPAL_NAME') || define('TESTS_ZEND_LDAP_PRINCIPAL_NAME', 'someUser#example.com');
defined('TESTS_ZEND_LDAP_ALT_USERNAME') || define('TESTS_ZEND_LDAP_ALT_USERNAME', 'anotherUser');
chdir(dirname(__DIR__));
/*
* autoload the application
*/
include __DIR__ . '/../init_autoloader.php';
Zend\Mvc\Application::init(include 'config/test.config.php');
phpunit.xml
<phpunit bootstrap="./Bootstrap.php" colors="true">
<testsuites>
<testsuite name="Zend Module Tests">
<directory>./Modules</directory>
</testsuite>
</testsuites>
</phpunit>
AlbumTest.php
<?php
namespace AlbumTest\Model;
use Album\Model\Album;
use PHPUnit_Framework_TestCase;
/**
* #category Module
* #package Album
* #subpackage UnitTests
* #group Module_Album
*/
class AlbumTest extends PHPUnit_Framework_TestCase {
public function testAlbumInitialState() {
$album = new Album();
$this->assertNull($album->artist, '"artist" should initially be null');
$this->assertNull($album->id, '"id" should initially be null');
$this->assertNull($album->title, '"title" should initially be null');
}
public function testExchangeArraySetsPropertiesCorrectly() {
$album = new Album();
$data = array('artist' => 'some artist',
'id' => 123,
'title' => 'some title');
$album->exchangeArray($data);
$this->assertSame($data['artist'], $album->artist, '"artist" was not set correctly');
$this->assertSame($data['id'], $album->id, '"id" was not set correctly');
$this->assertSame($data['title'], $album->title, '"title" was not set correctly');
}
public function testExchangeArraySetsPropertiesToNullIfKeysAreNotPresent() {
$album = new Album();
$album->exchangeArray(array('artist' => 'some artist',
'id' => 123,
'title' => 'some title'));
$album->exchangeArray(array());
$this->assertNull($album->artist, '"artist" should have defaulted to null');
$this->assertNull($album->id, '"id" should have defaulted to null');
$this->assertNull($album->title, '"title" should have defaulted to null');
}
public function testGetArrayCopyReturnsAnArrayWithPropertyValues() {
$album = new Album();
$data = array('artist' => 'some artist',
'id' => 123,
'title' => 'some title');
$album->exchangeArray($data);
$copyArray = $album->getArrayCopy();
$this->assertSame($data['artist'], $copyArray['artist'], '"artist" was not set correctly');
$this->assertSame($data['id'], $copyArray['id'], '"id" was not set correctly');
$this->assertSame($data['title'], $copyArray['title'], '"title" was not set correctly');
}
public function testInputFiltersAreSetCorrectly() {
$album = new Album();
$inputFilter = $album->getInputFilter();
$this->assertSame(3, $inputFilter->count());
$this->assertTrue($inputFilter->has('artist'));
$this->assertTrue($inputFilter->has('id'));
$this->assertTrue($inputFilter->has('title'));
}
}
NetBeans knows, where to find the phpunit binaries:
(I wanted to post images here, don't have the reputation though :), I will try to explain it)
The paths to are configured in the options - php - unit testing
/usr/local/pear/bin/phpunit and
/usr/local/pear/bin/phpunit-skelgen
In the properties of the project I set the "Use XML Configuration" and pasted the path to the phpunit.xml. I also checked "Ask for Test Groups Before Running Tests" - I gave the test above the group "Module_Album" - like this I make sure, that PHPUnit finds the right test.
I right click on Project and choose "Test", it shows me the group "Module_Album", I check it and click "Ok". It runs something, tells me it located the right phpunit.xml ("Configuration read from FULL_PATH/tests/phpunit.xml"). After running, it tells me, that it didn't execute any tests.
This is the full output in NetBeans:
PHPUnit 3.7.19 by Sebastian Bergmann.
Configuration read from FULL_PATH/tests/phpunit.xml
Time: 9 seconds, Memory: 348.25Mb
[2KNo tests executed!
[2K
Generating code coverage report in Clover XML format ... done
Anyway, I can do the same successfully via shell (terminal). It doesn't matter, if I directly mount the tests directory and run phpunit, use the full path to the phpunit binary (to make sure, that I don't use different version), specifying the full path of the phpunit.xml, and so on. Here are some samples:
phpunit
phpunit -c FULL_PATH/tests/phpunit.xml
/usr/local/pear/bin/phpunit -c FULL_PATH/tests/phpunit.xml
All of these commands give me, what I expect:
PHPUnit 3.7.19 by Sebastian Bergmann.
Configuration read from FULL_PATH/tests/phpunit.xml
.....
Time: 0 seconds, Memory: 12.75Mb
OK (5 tests, 16 assertions)
I don't get, why this works in shell but not via NetBeans
NetBeans uses 350MB, while in shell it uses only 12.75MB
In case I remove the option "Ask for Test Groups Before Running Tests", it seems to try running all ZendTests. Don't know how this is possible, from the phpunit.xml it should not find them.
Any help is appreciated, thanks!
I finally figured out, what is going on. I ran previously the ZendTests with the phpunit.xml, which is inside vendor/zendframework/zendframework/tests
For some reason NetBeans saves the testfile-directory, which it finds in the first test run and doesn't release them, if the a different phpunit.xml is chosen. I had to change the path of my "new" tests directory via "Right click on project" - "Properties" - "Sources" - "Test Folder".
Now NetBeans runs the test and gives exactly the same output like CLI.

Install WordPress using bash shell without visiting /wp-admin/install.php?

I wrote this little BASH script that creates a folder,unzips Wordpress and creates a database for a site.
The final step is actually installing Wordpress, which usually involves pointing your browser to install.php and filling out a form in the GUI.
I want to do this from the BASH shell, but can't figure out how to invoke wp_install() and pass it the parameters it needs:
-admin_email
-admin_password
-weblog_title
-user_name
(line 85 in install.php)
Here's a similar question, but in python
#!/bin/bash
#ask for the site name
echo "Site Name:"
read name
# make site directory under splogs
mkdir /var/www/splogs/$name
dirname="/var/www/splogs/$name"
#import wordpress from dropbox
cp -r ~/Dropbox/Web/Resources/Wordpress/Core $dirname
cd $dirname
#unwrap the double wrap
mv Core/* ./
rm -r Core
mv wp-config-sample.php wp-config.php
sed -i 's/database_name_here/'$name'/g' ./wp-config.php
sed -i 's/username_here/root/g' ./wp-config.php
sed -i 's/password_here/mypassword/g' ./wp-config.php
cp -r ~/Dropbox/Web/Resources/Wordpress/Themes/responsive $dirname/wp-content/t$
cd $dirname
CMD="create database $name"
mysql -uroot -pmypass -e "$CMD"
How do I alter the script to automatically run the installer without the need to open a browser?
Check out wp-cli, based on Drush for Drupal.
wp core install --url=url --title=site-title [--admin_name=username] --admin_email=email --admin_password=password
All commands:
wp core [download|config|install|install_network|version|update|update_db]
wp db [create|drop|optimize|repair|connect|cli|query|export|import]
wp eval-file
wp eval
wp export [validate_arguments]
wp generate [posts|users]
wp home
wp option [add|update|delete|get]
wp plugin [activate|deactivate|toggle|path|update|uninstall|delete|status|install]
wp post-meta [get|delete|add|update]
wp post [create|update|delete]
wp theme [activate|path|delete|status|install|update]
wp transient [get|set|delete|type]
wp user-meta [get|delete|add|update]
wp user [list|delete|create|update]
I was having the same problem as you are. I tried Victor's method and it didn't quite work.
I made a few edits and it works now!
You have to add php tags inside of the script to make the code work, otherwise it just echoes to the terminal.
My script directly calls the wp_install function of upgrade.php, bypassing install.php completely (no edits to other files required).
I made my script named script.sh, made it executable, dropped it in the wp-admin directory, and ran it from the terminal.
#!/usr/bin/php
<?php
function get_args()
{
$args = array();
for ($i=1; $i<count($_SERVER['argv']); $i++)
{
$arg = $_SERVER['argv'][$i];
if ($arg{0} == '-' && $arg{1} != '-')
{
for ($j=1; $j < strlen($arg); $j++)
{
$key = $arg{$j};
$value = $_SERVER['argv'][$i+1]{0} != '-' ? preg_replace(array('/^["\']/', '/["\']$/'), '', $_SERVER['argv'][++$i]) : true;
$args[$key] = $value;
}
}
else
$args[] = $arg;
}
return $args;
}
// read commandline arguments
$opt = get_args();
define( 'WP_INSTALLING', true );
/** Load WordPress Bootstrap */
require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
/** Load WordPress Administration Upgrade API */
require_once( dirname( __FILE__ ) . '/includes/upgrade.php' );
/** Load wpdb */
require_once(dirname(dirname(__FILE__)) . '/wp-includes/wp-db.php');
$result = wp_install($opt[0], $opt[1], $opt[2], false, '', $opt[3]);
?>
I called the file like this: # ./script.sh SiteName UserName email#address.com Password
Maybe you need to modify the Wordpress original installer a bit.
First, create a wrapper php CLI script, let's say its name is wrapper.sh:
#!/usr/bin/php -qC
function get_args()
{
$args = array();
for ($i=1; $i<count($_SERVER['argv']); $i++)
{
$arg = $_SERVER['argv'][$i];
if ($arg{0} == '-' && $arg{1} != '-')
{
for ($j=1; $j < strlen($arg); $j++)
{
$key = $arg{$j};
$value = $_SERVER['argv'][$i+1]{0} != '-' ? preg_replace(array('/^["\']/', '/["\']$/'), '', $_SERVER['argv'][++$i]) : true;
$args[$key] = $value;
}
}
else
$args[] = $arg;
}
return $args;
}
// read commandline arguments
$opt = get_args();
require "install.php";
This will allow you to invoke the script from the command line, and pass arguments to it directly into the $opt numeric array.
You can then pass the needed vars in a strict order you define, for instance:
./wrapper.sh <admin_email> <admin_password> <weblog_title> <user_name>
In the install.php you need to change the definition of the before mentioned vars, as it follows:
global $opt;
$admin_email = $opt[0];
$admin_password = $opt[1];
$weblog_title = $opt[2];
$user_name = $opt[3];
Then let the install script do its job.
This is an untested method, and also very open to any modifications you need. It's mainly a guideline for using a wrapper php/cli script to define the needed variable w/out having to send them via a HTTP REQUEST / query string. Maybe it's rather a weird way to get things done, so please, feel free to give any constructive/destructive feedback :-)
It's incredible how little discussion there is on this topic. I think it's awesome that WP-CLI was released and now acquired by Automattic, which should help to keep the project going long-term.
But relying on another dependency is not ideal, esp. when dealing with automated deployment...
This is what we came up with for SlickStack...
First, we save a MySQL "test" query and grep for e.g. wp_options as variables:
QUERY_PRODUCTION_WP_OPTIONS_EXIST=$(mysql --execute "SHOW TABLES FROM ${DB_NAME} WHERE Tables_in_${DB_NAME} LIKE '${DB_PREFIX}options';")
GREP_WP_OPTIONS_STRING_PRODUCTION=$(echo "${QUERY_PRODUCTION_WP_OPTIONS_EXIST}" | grep --no-messages "${DB_PREFIX}"options)
...doing it this way helps to avoid false positives like when queries/grep might spit out warnings etc.
And the if statement that will populate the WordPress database conditionally:
## populate database if wp_options not exists ##
if [[ -z "${GREP_WP_OPTIONS_STRING_PRODUCTION}" ]]; then
/usr/bin/php -qCr "include '/var/www/html/wp-admin/install.php'; wp_install('SlickStack', '\"${SFTP_USER}\"', '\"${SFTP_USER}\"#\"${SITE_DOMAIN_EXCLUDING_WWW}\"', 1, '', \"${SFTP_PASSWORD}\");"
fi
The -q keeps it quiet to avoid parsing conflicts and the -r tells it to execute the following code. I'm pretty sure we don't really need the -C flag here, but I added it anyways just in case.
Note: I had to play around with the if statement a few times, because the wp_install array is sensitive and I found that wrapping the password variable in single quotes resulted in a broken MD5 hash code, so if any issues try adding/removing quotation marks...

Resources