php,zend-framework,phpunitRelated issues-Collection of common programming errors
Kermit
php windows-server-2008-r2 iis7 sql-server-2008-r2
I am having difficulties getting the SQL Server extension to work with PHP on Windows Server. The installation went fine and I’m able to load phpinfo through the browser. However, when I enable php_sqlsrv_54_ts.dll, it throws a 500 – Internal server error. There are no errors logged to the PHP log.Here are the steps I’ve performed:Followed the PHP manual install guide and configuring IIS to process PHP requests Downloaded & installed Microsoft Drivers 3.0 for PHP for SQL Server Downloaded &a
ElvisLikeBear
php sql sql-server sql-server-2008
I’m using PDO’s to connect to a Microsoft Server running in azure and I keep receiving the error:This is the function that I’ve written (insertUser):private function generateSalt() {return dechex(mt_rand(0, 4453456454)) . dechex(mt_rand(0, 543545435)); }private function hashPassword($originalPassword, $salt) {for($round = 0; $round < 65536; $round++){$password = hash(‘sha256’, $password . $salt);}return $password; }private function insertUser() {$salt = $this->generateSalt();$password = $
Jacket
php internationalization gettext
I know there are lots of posts for internationalization, but this is something I didn’t found while searching.I have a PHP Web application, which is pretty big right now. It’s developed actively for 4 years and wasn’t built with internationalization in mind. Text is everywhere – in plain HTML, in PHP variables, in echo’s, in the DB…Now I’m familiar with the concept of gettext and this is what i plan to use for the internationalization project of the application. However the app is not written
darkheir
php jpeg jfif
When I’m trying to save an image using the native php function imagecreatefromjpeg sometimes I have the following error:gd-jpeg, libjpeg: recoverable error: Warning: unknown JFIF revision number 2.01What I understand (I could be wrong) is that the JFIF version is higher than the one supported by the native php function.How could I process the image or at least fail gracefully? (Today the page is showing a HTTP 500 error)
mitai
php codeigniter form-validation native
I want to use a central CI setup for multiple sites. The way I handle this is I created a package called MPACK and added it to autoload in the config file of each site.Folder Structure:/main/system (CI 2 System folder)/MPACK/site1/applicationsite2/applicationInside this MPACK I have share libraries, models, helpers, etc.However, I would like to have an extended MY_Form_Validation that would be common to ALL sites. Adding the class file to /MPACK/libraries fails. Adding it to /site1/application w
xles
php yii
I’m playing around with the Yii framework, and decided to do some file foo with the finfo class in php, like so:$finfo = new finfo(FILEINFO_MIME);This should work without issue (and it works just fine outside of Yii), I don’t see why it shouldn’t. However, this isn’t the case, Yii attempts to autoload the finfo class causing the obvious error:include(finfo.php): failed to open stream: No such file or directoryIs there a way to beat Yii into submission?Edit: I still haven’t figured out why it cr
David Rodrigues
php mysql
Is there any function in MySQL that is similar to function substr_count() of PHP? Actually I need to know how many items are in a set (eg. 1,2,3 is 3 items).In a search, I found nothing that was native to this. So I made a workaround with the methods LENGTH() and REPLACE().SELECT LENGTH(“1,2,3,4”) – LENGTH(REPLACE(“1,2,3,4”, “,”, “”)) + 1;But it fail set is empty. But I can solve that with a simple IF().So, I’m searching for some more native, like, for instance:SELECT SUBSTR_COUNT(“,”, “1,2,3,4”
palacsint
php beginner security file static
I am new to Code Review and PHP.Last night I made the below image uploading class. It was the first time I made a file uploader to be used on a real site, so I thought I would share it here and on Github to get some reviews, hoping if I can perfect it with your help, I will use the class on all my future projects. <?php /*** A small, secure & fast image uploader class written in all-static* class to give an extra boost in performance.* @author Simon _eQ <https://github.com/simon-eQ
Orangepill
php template
This is the second submission for Code Review for this project but since the API changed considerably I felt it should not be taped onto the original post. To see the original post and comment see Potential Problems with this templating technique .First off the goals motivation for this technique is to reduce the number of iterative includes of a template there by bypassing a lot of the i/o bottle neck that can occur, especially in I/O bound environments. Overwhelmingly the biggest eyesore in th
Kriem
php javascript jquery jwplayer
I sometimes get this error in my jwplayer: TypeError: non-native scope objectThis means that one video out of multiple videos I have has failed to load. This makes it unreliable. My question is that is there a way to make it more reliable and permanently fix this error?Below is code:<?php$key = $_GET[‘key’]; $i = $_GET[‘i’]; $v = $_GET[‘v’];?> <div id=”myElement-<?php echo $key.’-‘.$i; ?>”>Loading the player…<script type=”text/javascript”> jwplayer(“myElement-<?php e
John Cogan
sql zend-framework doctrine2
Can’t seem to figure out what is wrong here as my Entity seems to have the right annotations etc. Converting the SQL to run directly in Navicat it works.Specific error is[Semantical Error] line 0, col 120 near ‘city_id = 2)’: Error: Class Simpleweb\Entity\Product has no field or association named city_id Product entity section related to the city_id (City is a OneToMany related Entity)/*** @ManyToOne(targetEntity=”City”, inversedBy=”products”)* @JoinColumn(name=”city_id”, referencedColumnName=”i
Sam
zend-framework zend-validate zend-filter
i was just reading a great presentation about Quality Assurance for PHP Projects by Michelangelo van Dam aka DragonBe. In his presentation he uses Zend-Framework as an example, which i am familiar with on a basic level.Since i want to improve myself, im starting with unit testing, though i feel the problem is on ZFs side. The Problem:With given code-artifacts whenever i assign a boolean value of false the Zend_Filter or Zend_Validator changes this into null. I can’t figure out why this is the ca
Michael Moussa
php zend-framework phpunit zend-session
I am getting numerous errors exactly like this one:Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in /usr/local/zend/share/pear/PHPUnit/Util/Printer.php/173When running my application’s test suite. This is with PHPUnit 3.5.10 and PHP 5.3.5.There is no mysterious, unexpected whitespace output that is causing this. I’ve determined that the “output being sent to the browser” is the actual output from the PHPUnit tests being executed.
Pascut
magento email zend-framework smtp magento-1.6
I have a magento website. I want to send mails using SMTP. I’ve found the below script hereI created this file: app/code/local/Mage/Core/Model/Email/Template.php in order to overwrite the original core file.The problem is that I receive this error: Parse error: syntax error, unexpected T_VARIABLE in /home/xxx/public_html/app/code/local/Mage/Core/Model/Email/Template.php on line 103public function getMail() {if (is_null($this->_mail)) { $my_smtp_host = Mage::getStoreConfig(‘system/smt
j0k
php zend-framework
I am currently trying to update a previous web site using Zend Framework.As I dont want to work in a local network, I subscrided to a pro offer of OVH server.So I put my old website in the www folder, I uploaded the Zend Framework directory (ZendFramework-1.11.11), and then created a foder dev in the root directory as well.As I got this error when I try to create a new project with putty : Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in
user2042985
php zend-framework curl apache2 passenger
Hello I have a strange problem,I’m using Zend Http Client with Curl Adapter to call an external API.I’m able to do nearly everything – POST and PUT are completely OKDELETE is also OK but when sending data with DELETE I always get an error in the apache error log on the server with API server:pid=25665 thr=140007665268704 file=ext/apache2/Hooks.cpp:884 time=2014-01-13 22:30:06.320 ]: Unexpected error in mod_passenger: An error occurred while receiving HTTP upload data: The timeout specified
j0k
php zend-framework
Should I write flash messages in my model, or my controller?If I do it in the controller, the model will need to pass it the status messages, so if seems more natural to do it in the model.
hakre
php zend-framework
When trying to install the Newscoop 4 Script ob my website…I get this Error:Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /home/content/24/8222924/html/newscoop4/application.php on line 65Parse error: syntax error, unexpected T_FUNCTION in /home/content/24/8222924/html/newscoop4/application.php on line 68and the file it shows error in is this, i think it has something to do with the back slashes because php cant render it completely but my php version is 5.3 hopefully:<?
Florent
php zend-framework web-hosting
After hosting my website, I had some configuration issues.Warning: require_once (Zend/application.php) [function.require-once]: failed to open stream: No such file or directory in //www/***.com/public/index.php on line 22I placed the Zend Framewotk library in www/librarywww/application/ www/library/ <— Zend Framework www/public/but after the addition of library another problem occurs:HTTP Error 500 (Internal Server Error): An unexpected condition has occurred while the server was attemp
seengee
php zend-framework zend-translate
In my view the call $this->translate(‘test’) is not working.In the bootstrap I have the following code to initiate the translations:protected function _initTranslate() {$apc = $this->getOption(‘enable_apc_cache’);if ($apc) {$cache = Zend_Registry::get(‘cache’);Zend_Translate::setCache($cache);}// Set the correct locale$locale = new Zend_Locale(‘nl’);Zend_Registry::set(‘Zend_Locale’, $locale);// Form error translations$translator = new Zend_Translate(‘array’,APPLICATION_PATH.’/../resources/
Jonas Wielicki
David Harkness
php phpunit codesniffer
I have created my own codesniffer rules standards.They are working fine. Now I want to test codesniffer rules using PHP UnitTest. PhpCodesniffer has already have their framework for PHPUnit test case. So using that I have extended their AbstractSniffUnitTest and unit test class at location Standards/TestRules/Tests/Function/FunctionUnitTest.php and script on which is to be tested kept in Standards/TestRules/Tests/Function/FunctionUnitTest.inc.But when I am going to run the script by command php
Michael Moussa
php zend-framework phpunit zend-session
I am getting numerous errors exactly like this one:Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in /usr/local/zend/share/pear/PHPUnit/Util/Printer.php/173When running my application’s test suite. This is with PHPUnit 3.5.10 and PHP 5.3.5.There is no mysterious, unexpected whitespace output that is causing this. I’ve determined that the “output being sent to the browser” is the actual output from the PHPUnit tests being executed.
Stephen Melrose
php unit-testing phpunit
I’m trying to get into Unit testing for the obvious positives it introduces, and I’m trying to write a Unit test for a class I wrote the other day. (I know this is the opposite to TDD, please bear with me)My class, Image, is used in conjunction with some others for image manipulation. Image essentially wraps a GD image resource and stores data along with it. For example, an instance of Image will always contain it’s current state, i.e. its new width/height if resized, the original image data, et
Jess Telford
php unit-testing phpunit
When running a PHPUnit test, I would like to be able to dump output so I can debug one or two things.I have tried the following (similar to the PHPUnit Manual example);class theTest extends PHPUnit_Framework_TestCase {/*** @outputBuffering disabled*/public function testOutput() {print_r(“Hello World”);print “Ping”;echo “Pong”;$out = “Foo”;var_dump($out);} }With the following result:PHPUnit @package_version@ by Sebastian Bergmann..Time: 0 seconds, Memory: 3.00MbOK (1 test, 0 assertions)Notice
Korcholis
php unit-testing selenium phpunit yii
I’ve been working for 2 months and a half in a project and it is practically finished. However I keep seeing some errors I fixed in the past that come back to annoy me. I then fix them again and another one bugs me.I know, I know, I did a mistake not using phpunit and selenium at first, but is it viable or realistic to start using it at this moment (even if the project ends in 1 week and I still have some parts to finish)?Thanks in advance
Stephanie
install phpunit
I am trying to set up phpunit on my server. This is what I did so far…SSH into Apache server via PuTTY Ran command… cd /path/to Ran command… wget http://pear.phpunit.de/get/phpunit.phar Ran command… chmod +x phpunit.phar Ran command… /path/to/phpunit.pharThe error I received is…PHP Parse error: syntax error, unexpected T_FUNCTION, expecting ‘)’ in /path/to/phpunit.phar on line 6The first 8 lines of the phpunit.phar file are…#!/usr/bin/env php <?php define(‘__PHPUNIT_PHAR__’, r
edorian
php phpunit zend-studio
I have a created a simple doctrine2/zend skeleton project and am trying to get unit testing working with zend studio. The tests work perfectly through the PHPunit CLI but I just can’t get them to work in zend studio.It comes up with an error saying : ‘No Tests was executed’ and the following output in the debug window :X-Powered-By: PHP/5.2.14 ZendServer/5.0 Set-Cookie: ZendDebuggerCookie=127.0.0.1%3A10137%3A0||084|77742D65|1016; path=/ Content-type: text/html<br /> <b>Warning</b&
user1232579
php cakephp testing command-line phpunit
I’m using CakePHP 2.x and installed PHPUnit to do my testing. Everything was working well until I uploaded my app to my hosting. If I test it through the web (/test.php), it works fine. But if I use cake test app XXXXXX, it gives me this error:Configure::bootstrap() – CORE/Cake/Core/Configure.php, line 92 require – CORE/Cake/bootstrap.php, line 175 ShellDispatcher::_bootstrap() – CORE/Cake/Console/ShellDispatcher.php, line 136 ShellDispatcher::_initEnvironment() – CORE/Cake/Console/ShellDispatc
David
php symfony2 tdd phpunit
I am trying to write a unit test (phpunit) to cover a controller action. I am receiving problems regarding invalid scope for the getRequest() call.note: I am a newbie to Symfony2 and TDD (phpunit)I guess this is because there is no request as such?My questions are:Can I mock a request object? Am I approaching this in the right way? Should I be placing the bulk of the code into a service and then unit testing the service and only FUNCTIONAL test the controllers?I think knowing the principle going
Web site is in building