Questions tagged [php-5.3]

PHP 5.3 (now past End of Life) is the successor to PHP 5.2. It was released on June 30, 2009. Use this tag for version-specific issues relating to specifically to PHP 5.3.

The last version of PHP 5.3 was 5.3.29, which was released on 14-Aug-2014. This version has reached its end of life and will no longer receive any updates.

PHP 5.3 caused many headaches for legacy software as a number of mechanisms PHP had relied on were deprecated (most notably register_globals and safe_mode). Many string search related functions were deprecated too, such as split() and ereg(). Much code written before PHP 5 (and some during) makes use of both these, and therefore a lot of older code base needed updating.

See https://php.net/manual/en/migration53.deprecated.php for a full list.

Information

  • If you want to talk about PHP or if you have a question, you can come to Chat Room 11: PHP.
  • For global question on PHP, please use the generic tag:
1291 questions
17
votes
1 answer

Why do strings behave like an array in PHP 5.3?

I have this code: $tierHosts['host'] = isset($host['name']) ? $host['name'] : $host; It's working fine in PHP 5.5, but in PHP 5.3 the condition returns true while $host contains a string like pjba01. It returns the first letter of…
Ritesh
  • 4,720
  • 6
  • 27
  • 41
17
votes
6 answers

How do I test for an exact Exception message, rather than a substring, with PHPUnit?

According to the PHPUnit Documentation on @expectedExceptionMessage, the string must only be a substring of the actual Exception thrown. In one of my validation methods, an array item is pushed for each error that occurs, and the final Exception…
Bryson
  • 1,186
  • 2
  • 13
  • 26
15
votes
8 answers

Strange MySQL error "Empty row packet body" when using mysql_fetch_object (PHP 5.3.3)

I get a really strange, pointless and totally random error when I fetch rows from a resource (query) using PHP. My development machine is a Windows XP SP3 with Apache 2.2 while MySQL runs on a virtual machine, using ubuntu 10.04, with 768mb of ram,…
Daniele Salvatore Albano
  • 1,263
  • 2
  • 13
  • 29
15
votes
2 answers

Write to file with register_shutdown_function

Is it possible to do the following? register_shutdown_function('my_shutdown'); function my_shutdown () { file_put_contents('test.txt', 'hello', FILE_APPEND); error_log('hello', 3, 'test.txt'); } Doesn't seem to work. BTW i'm on PHP 5.3.5.
IMB
  • 15,163
  • 19
  • 82
  • 140
14
votes
4 answers

How to configure Codeigniter to report all errors?

I had a line - $autoload['libraries'] = array('database');, in CI's autoload.php. Because of this I was getting a blank page. When I removed the 'database', option then I started getting the output. Now my question is not how to configure the…
AppleGrew
  • 9,302
  • 24
  • 80
  • 124
14
votes
4 answers

Installing PHP 5.3.29 from Sources on Ubuntu 14 with Apache 2 Module

I successfully installed PHP 5.3.29 on Ubuntu 14 with Apache 2 separately. I installed PHP with the following method: sudo -i wget http://in1.php.net/distributions/php-5.3.29.tar.bz2 tar -xvf php-5.3.29.tar.bz2 cd php-5.3.29 ./configure make make…
dondonhk
  • 631
  • 3
  • 6
  • 19
13
votes
1 answer

anonymous function performance in PHP

I'm starting to use functional programming paradigms in php and was wondering what the performance impacts are. Some googling just seems to say that there are some. To be specific, I would like to know: Is there actually a performance impact or…
Alex M
  • 3,506
  • 2
  • 20
  • 23
12
votes
1 answer

php array_map callback parameter scope

In the following code the callback function passed to wrap_map can't see the argument in the outer function, why? (see code comment for detail) public static function wrap_implode($ar, $wrap, $delim){ echo "wrap is $wrap"; //wrap is ok $res =…
user678070
  • 1,415
  • 3
  • 18
  • 28
12
votes
2 answers

Can I migrate from PHP 5.3.10 to PHP 5.6.0?

I'm basically a PHP developer. I'm currently using Ubuntu Linux 12.04 LTS on my local machine. I'm using the following PHP version for developing my PHP project: php -v //command run at terminal to know the `PHP` version installed PHP…
PHPLover
  • 1
  • 51
  • 158
  • 311
11
votes
1 answer

Symfony2 explanation of CompilerPass?

Can someone explain what a compilerpass is?
flyboarder
  • 586
  • 1
  • 5
  • 21
11
votes
6 answers

How to detect if a user uploaded a file larger than post_max_size?

How should I go about handling http uploads that exceeds the post_max_size in a sane manner? In my configuration post_max_size is a few MB larger than upload_max_filesize The problems I'm having are: If a user uploads a file exceeding post_max_size…
Captain Giraffe
  • 14,407
  • 6
  • 39
  • 67
11
votes
4 answers

Make DateTime::createFromFormat() return child class instead of parent

I'm extending DateTime do add some useful methods and constants. When using new to create a new object everything is fine but when using the static method createFromFormat it always returns the original DateTime object and of course none of the…
noisebleed
  • 1,299
  • 2
  • 12
  • 26
10
votes
3 answers

PHP good log library?

Is there any good log library for message, warning and errors flogging for PHP?AFAIK error_log is only used for logging errors but i need to store also debug messages. And should work with CLI. Thanks
gremo
  • 47,186
  • 75
  • 257
  • 421
10
votes
3 answers

What is wrong with PHP5.3?

I came across lots of hosting companies are unwilling to upgrade to PHP5.3. Most of them gave me the reason is that there are lots of bugs in PHP5.3, so they prefer to keep it at version 5.2. What is wrong with v5.3 then? is that true what they said…
Run
  • 54,938
  • 169
  • 450
  • 748
10
votes
1 answer

PHP 5.3: Late static binding doesn't work for properties when defined in parent class while missing in child class

Take a look at this example, and notice the outputs indicated.
OCDev
  • 2,280
  • 3
  • 26
  • 37
1
2
3
86 87