News Feed
Jobs Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lars Tesmer's Blog:
Learning Ruby Gotchas and Pitfalls for PHP Programmers
September 14, 2011 @ 09:48:42

Lars Tesmer is currently in the process of learning Ruby. He' been working through the tutorials and some sample scripts and has come across some pitfalls along the way. In his latest post he shares four of them that've stood out in his development so far.

I'm currently learning Ruby. In this post I'll list some pitfalls for programmers coming from PHP that would probably cause some confusion if you aren't aware of them. This list is by no means complete, while I learn Ruby I'll very probably encounter more gotchas, which I will blog about, too.

For each of his four examples, he gives the code PHP developers are used to seeing and the Ruby code that may or may not do what you'd expect:

  • Arrays are continuous
  • Zero is not falsy
  • The keywords private and protected
  • There's no static keyword
0 comments voice your opinion now!
learn ruby pitfall gotcha programming language common


CodeFury.net:
CodeIgniter/PHP + IIS + MySQL + MSSQL It Works!
January 13, 2011 @ 11:09:50

Kenny Katzgrau has a recent post on the Code Fury blog talking about the combination of CodeIgniter, IIS, MySQL and MSSQL and how it all works in his installation (after a few small gotchas).

There are a lot of people out there who call themselves "LAMP" developers - short for Linux, Apache, MySQL, PHP. That's the standard configuration for production PHP applications. Recently, I ended up having to build a CodeIgniter application on Windows, IIS, Mysql+MS-SQL, and PHP. Sound like there are bound to be issues? You bet, and it especially hurts because now I'm a real-live WIMP developer. And what made it even more interesting was that due to constraints, I had to develop the application in Ubuntu and deploy to Windows for production.

He includes the list of the "gotchas" that he came across when doing the installation - six of them:

  • PHP and MSSQL on Ubuntu
  • PHP and MSSQL on Windows
  • mssql vs. sqlsrv
  • File Permissions and Logging
  • No .htaccess Fo' You!
  • 2 Databases, 1 Application
0 comments voice your opinion now!
codeigniter iis mysql mssql gotcha install


Matthew Turland's Blog:
Gotcha on Scraping .NET Applications with PHP and cURL
July 01, 2010 @ 08:51:36

New on his blog today Matthew Turland has posted about a "gotcha" he came across when working with cURL to pull down information (scrape content) from a remote .NET application.

I recently wrote a PHP script to scrape data from a .NET application. In the process of developing this script, I noticed something interesting that I thought I'd share. In this case, I was using the cURL extension, but the tip isn't necessarily specific to that. One thing my script did was submit a POST request to simulate a form submission. [...] The issue I ran into had to do with a behavior of the CURLOPT_POSTFIELDS setting that's easy to overlook.

The problem was something cURL does automatically - change the header for the content type because you're sending an array. Thankfully, with the help of a call to http_build_query to encode it correctly, the request will use the right headers.

0 comments voice your opinion now!
net application scrape content gotcha curl


Christian Wenz's Blog:
Serendipity Upgrade to v 1.5.x Gotcha
December 24, 2009 @ 06:44:55

Christian Wenz points out a "gotcha" for those upgrading Serendipity to the latest 1.5.x version - an issue with a SQL script not being run.

I just updated Serendipity to version 1.5.1 on one of our servers; yet afterwards I could not log in anymore. Also, Serendipity reported that version 1.5.1 was present, although I did not run the update script from the admin console yet. At first I thought I did something wrong, but a s9y forum posting described a similar issue.

The issue came from a SQL update script that hadn't been run when the upgrade process thought it had. He includes the two SQL statements you'll need to run to fix the problem.

0 comments voice your opinion now!
serendipity upgrade gotcha


Developer Tutorials Blog:
Migrating legacy PHP 4 applications to PHP 5
July 10, 2008 @ 07:56:41

In a new post to the Developer Tutorials blog Akash Mehta takes a look at migrating PHP4 applications up to the more recent versions of PHP5.

PHP 5 supports most of the legacy syntax features of PHP 4. Most code written for PHP 4 should function fine under PHP 5, and a comprehensive test suite could check this. However, many of the backwards-incompatible changes in PHP 5 were in regard to language quirks, and quite a few hacks rely on these in order to function.

He points out some of these hacks including changes to the object model and updates to the way variables are handled (breaking many "bad use" cases). He also points out the changes made in the latest Windows binaries as well as some of the new reserved keywords that could conflict with pre-existing code in your application.

0 comments voice your opinion now!
migrate application php4 php5 legacy upgrade gotcha


Eirik Hoem's Blog:
Array problems with SOAP and PHP - Updated
March 13, 2008 @ 10:22:19

Eirik Hoem has posted an update on a previous problem he was having when working with SOAP in PHP and its handling of arrays.

The scenario was that when an array with only one object was returned over SOAP the array was discarded and pointed straight to the single object.

Come to find out, this behavior wasn't a bug, it was a feature - the fix is to add another parameter to the initialization of the SoapClient to add the SOAP_SINGLE_ELEMENT_ARRAYS feature.

0 comments voice your opinion now!
soap gotcha array problem soapsingleelementarrays feature bug


PHPEverywhere:
Octopussy numbers in PHP
February 01, 2008 @ 09:21:00

John Lim has posted about an interesting bug he's come across when working with the output of two strings that should look the same:

Someone reported a bug in ADOdb, the open source db library i maintain. I went crazy for half an hour until i realised the problem.

According to him, "if you expect the above code to produce the same values, you are sadly mistaken". His example gives an interesting result for the first echo statement - not echoing the 9 in the first character like it seems would make sense. Check out his post for the code and try it out for yourself.

0 comments voice your opinion now!
number echo adodb database gotcha


David Coallier's Blog:
PHP Namespaces (Part 1 Basic usage & gotchas)
August 20, 2007 @ 15:12:00

David Coallier has posted his look at the namespace support that will be included with PHP6, specifically some examples of their basic usage and things to look out for when using them in your applications.

Well, PHP has namespaces now! Time to start educating people on that long awaited feature and for the people that already do know namespaces from C++, you also need to read this, it's simple, but will give you the basic syntax.

He starts with things like "what is a namespace?" or "what are they used for?" before getting into the syntax. The next step up is explaining how they work - he uses an example project, ProjectOne, with its namespace definition and an example script (invoke.php) that uses this class (including the new "import" keyword and the double-colon namespace separator).

0 comments voice your opinion now!
namespace basic usage gotcha definition example namespace basic usage gotcha definition example


DotVoid.com:
PHP streams and http 1.1 gotcha
March 23, 2006 @ 06:52:50

If you work with streams in PHP, Dotvoid has a tip that just might come in handy some day in the future. The tip deals with the difference between HTTP 1.1 and 1.0.

I have a class that I wrote some time ago that is called URLImporter. It's simple, does what it is supposed to do and thus makes my life easier. Essentially it helps me fetch URL resources - mostly dynamically generated data from password protected extranets that require me to use HTTP POST.

Up until recently this class have only been used behind an http proxy. The other day I moved it to another machine - that is not behind a proxy and suddenly it stopped working.

He realized the problem after a bit of research - HTTP 1.1 automatically performs a "keep alive" on the connection, not timing out after the transaction's done like 1.0 does. His solution? Passing another HTTP header to the stream connection: "Connection: close".

0 comments voice your opinion now!
streams gotcha 1.1 1.0 difference keep-alive close streams gotcha 1.1 1.0 difference keep-alive close



Community Events











Don't see your event here?
Let us know!


composer symfony2 project install facebook podcast application package release framework security component threedevsandamaybe performance language database unittest introduction hack hhvm

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework