Weird error when running phpUnit test suite from Zend Studio 8 - php

Zend Studio 8 has phpUnit integration and a dedicated view, which is great, so I would like to use it... but:
When I run my phpunit.xml on the command line, the tests are executed just fine, when I try to run phpunit.xml in Zend Studio as unit test, I get the following fatal error:
Fatal error: Uncaught exception
'PHPUnit_Framework_Error' with message
'Assigning the return value of new by
reference is deprecated' in C:\Program
Files
(x86)\Zend\ZendServer\bin\PEAR\PEAR\Config.php:650
Stack trace:
#0 C:\Program Files
(x86)\Zend\ZendServer\bin\PEAR\PEAR\RunTest.php(22):
ZendPHPUnitErrorHandler->handle(8192,
'Assigning the r...', 'C:\Program
File...', 650, Array)
#1 C:\Program
Files
(x86)\Zend\ZendServer\bin\PEAR\PEAR\RunTest.php(22):
require_once()
#2 C:\Program Files
(x86)\Zend\ZendServer\bin\PEAR\PHPUnit\Extensions\PhptTestCase.php(49):
require_once('C:\Program File...')
#3
C:\Program Files (x86)\Zend\Zend
Studio -
8.0.0\plugins\com.zend.php.phpunit_8.0.0.v20101001-0100\resources\ZendPHPUnit.php(103):
require_once('C:\Program File...')
#4
{main} thrown in C:\Program Files
(x86)\Zend\ZendServer\bin\PEAR\PEAR\Config.php
on line 650
I really don't have a clue what that means... why should some deprecated code in the PEAR config keep my tests from running?
[edit]
Some additional information:
My colleague who has neither PEAR nor phpunit installed, can run unit tests from Zend Studio 8 just fine but he can't run any from the CLI. So it seems that Zend Studio not only integrates with phpUnit but comes bundled with a version of it. I wanted the newest version and that's why I installed PEAR and then via PEAR I installed phpUnit. As a consequence, the phpUnit library of Zend Studio was outdated and I had to replace the file 'ZendPHPUnit.php' in the Zend Studio plugin folder with a version of a Zend Forum user. This lead to correct inclusion of the phpUnit classes and the current problem.
[/edit]

Line 650 in PEAR\Config.php does
$this->_registry['default'] = &new PEAR_Registry(
$this->configuration['default']['php_dir']
);
This will raise an E_DEPRECATED message depending on whether you have enabled error_reporting to include that level. The error handlers of PHPUnit and ZendPHPUnit will convert those to PHPUnit_Framework_Exceptions.
Because PHP will raise E_DEPRECATED already at compile time, the only way to suppress these errors is in php.ini. My assumption is, that your PHPUnit you run from CLI is using a different php.ini than that your Zend Studio and in that php.ini the error level is not low enough to raise E_DEPRECATED.
If you can provide a reproducable example, we might be able to make more sense of it. In any case, try to update your PEAR installation to the latest version.

Related

PHP grpc extension not working on WAMP, despite working on CLI

After about a week of trying to install grpc for Firestore with PHP, I managed to get it working, however only when ran in terminals / cmd. This php.ini / environment is on my desktop in a folder and when executing files with firestore commands it works. No errors.
However, when in WAMP, it crashes the page with:
Fatal error: Uncaught Google\Cloud\Core\Exception\GoogleException: The requested client requires the gRPC extension. Please see https://cloud.google.com/php/grpc for installation instructions. in D:\wamp64\www\karma\vendor\google\cloud-core\src\ClientTrait.php:76 Stack trace: #0 D:\wamp64\www\karma\vendor\google\cloud-firestore\src\FirestoreClient.php(139): Google\Cloud\Firestore\FirestoreClient->requireGrpc() #1 D:\wamp64\www\karma\functions.php(32): Google\Cloud\Firestore\FirestoreClient->__construct(Array) #2 D:\wamp64\www\karma\Firestore.php(8): Firestore->__construct('test') #3 {main} thrown in D:\wamp64\www\karma\vendor\google\cloud-core\src\ClientTrait.php on line 76
Now what is really weird is that I copied the directory from desktop and literally pasted it into the WAMP PHP area and there is no difference. It even says in the config that php_grpc is loaded! I dont think the bottom dlls are needed so I don't think its an issue they're missing but I find it incredibly strange the same directory on the desktop will run php files from the command line but not in WAMP. WAMP is 64 bit and so is the plugin. PHP version of wamp was 7.0.1 but I replaced the whole 7.0.1 folder with the new 7.4.x version as with the plugin of that version.
Why would it say its loaded and yet say it isnt?
I too have have the same issue.I tried all possible ways to fix it.The extension is loaded in waamp but the php shows missing error.
I had to completely reinstall wamp to fix this error, in a new directory, reinstall php and made sure I had the correct grpc version. I have no idea what caused the error, but try every recent grpc version (I think there is four) and ensure that in your config file every addition copies the format.
I had a new php install outside of WAMP which worked, but as wamp has it's own that was bugged for me

Symlink for libxml2 not working after installing and configuring

I am currently have two PHP version in my server ;
PHP version 5.2.11 - the current version of the php in the server
wherein many programs uses it. Have libxml2-2.6.16 as libxml2 version.
Virtually Installed PHP
PHP version 5.4.44 - the virtually installed version of php in the server. Since, I upload my project in the server which uses Symfony
Framework. As symfony requirement, php version must be at least have
a php version of 5.3. And so, we installed this PHP version virtually.
After setting all the necessary configuration, we run it in the browser using its customize port. Unfortunately,the page gives this error.
Fatal error: Uncaught exception 'InvalidArgumentException' with message '[ERROR 3070] CT 'container': The content model is not determinist. (in file:////home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd - line 20, column 0)' in /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:96 Stack trace: #0 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(218): Symfony\Component\Config\Util\XmlUtils::loadFile('/home/sanchez/...', Array) #1 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/home/sanchez/...') #2 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(48): Symfony\Component\DependencyInjection\Loader\XmlFileLo in /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php on line 220
To understand more about the error, I research in the internet and find some related topics that may help. Then,, I found out that it is all about the libxml2, so I installed another libxml2 version in my directory (personal) and just use symlink for it to point to my directory. By the way I install, libxml2-2.8.0 as libxml2 version. I am also using RHEL4.After setting again the neccessary configuration , it still give the same error as above.
How can I solve this? Is it really possible to have two libxml2 version on the server? Do I miss any configuration or something? Is my libxml2 version and php version 5.4.44 is compatible? Or there is any libxml2 that is compatible with my php version? What should I do?
Appreciate any help.Thanks.

Codecept installation gives me an fatal error (bz2 extension)

I am trying to setup Codeception (v1.8) on my local development box (Windows 7 running WAMP).
I have PHP 5.3.13 running and both CURL and bzip2 are enabled modules, when I run the following command to install the 'framework' I get the following error:
php codecept.phar bootstrap
PHP Fatal error: Uncaught exception 'PharException' with message 'bz2 extension is required for bzip2 compressed .phar file "C:\wamp\www\codecept\codecept.phar"' in C:\wamp\codecept\codecept.phar:3
Stack Trace:
#0 C:\wamp\www\codecept\codecept.phar(3): Phar::mapPhar()
#1 {main}
thrown in C:\wamp\www\codecept\codecept.phar on line 3
......
I have 5.3 running so haven't installed the latest version of Codecept (v2) as that doesn't work with my version of PHP but cannot be sure why this is happening?
Any ideas
P.S I will be using this Codecept with Yii eventually if that makes any difference
I had the same problem and uncommenting 'extension=bz2.so' in my php.ini file fixed it.
the problem you have is because the v2 of codeception requires at least php5.4, downgrade to some of the 1.x versions than you will have no problem.
Here is the link for the versions

Zend Server 6 apc not working

I have installed Zend Server 6 on Windows 7. Downloaded non thread safe apc dll (php_apc-3.1.10-5.4-vc9-x86.zip) from here. When I add apc extension in php.ini zend server is not starting. There were no problems with previous version of Zend Server. What can cause it?
UPDATE:
There is an error in log file.
PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class does not exist' in C:\Program Files (x86)\Zend\ZendServer\GUI\vendor\ZF2\library\Zend\Code\Reflection\ClassReflection.php:172

updating php to 5.3 not working

I get this error when using some library called: Mcrypt extension:
Fatal error:
Uncaught exception 'Exception' with message 'I cannot generate a secure
pseudo-random key. Please use PHP >= 5.3 or Mcrypt extension'
in C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php:74
Stack trace:
#0 C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php(107): SecureSession->_randomKey(32)
#1 [internal function]: SecureSession->open('C:\xampp\htdocs...', 'PHPSESSID')
#2 C:\xampp\htdocs\PoliticalForum\User\User\headerSite.php(31): session_start()
#3 C:\xampp\htdocs\PoliticalForum\mainHome.php(14): include_once('C:\xampp\htdocs...')
#4 {main} thrown in C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php on line 74
I found the class in this link:
secure session
I dont understand what version of php do I have!?!? and why hasnt the php updated, I have only updated my xamp to the newest version right now..
Note: there is no mistake in the class as it was made by one of Oreilly books' author and was used and recommended by a few people in here.
You can find your php version on the command line using: php -v
You can find out your php version, loaded extensions, and just about everything about PHP by putting the following in a file and calling it from your web browser:
<?php phpinfo(); ?>
Of course, don't leave that up on your production server.
As for the error, you need to find your php.ini, which will be at C:\xampp\php\php.ini and uncomment or add the line extension=php_mcrpyt.dll
You might want to have a peek in C:\xampp\php\extensions\ and make sure that dll actually exists. If not (and you have verified you do have PHP 5.3) you can go download the "Zip" version of the windows installer which matches your version, unzip it, and then simply copy that file to your extensions.
EDIT:
I had a look at the php manual for mcrypt and found this: "mcrypt is built in for PHP 5.3.x on windows, you don't need to do anything with a dll anymore."; I think it's entirely possible that you upgraded PHP to a different directory than your XAMPP install; check those versions (http://localhost should take you to the xampp panel where you can find phpinfo() in the sidebar)
If you get this message and you have PHP 5.3 or later. You have not in your php.ini file enabled the OpenSSL extension.
What you need to do is to have the following line in your php.ini file:
extension=php_openssl.dll
I asume that you are using windows, other wise change the extension accordingly

Categories