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
3
votes
2 answers

autoload and namespaces

I've been working with PHP for a long time, but am now starting to experiment with newer language features such as namespaces. I have a question regarding autoloading that I haven't been able to find an adequate answer to in my web searching. …
GordonM
  • 31,179
  • 15
  • 87
  • 129
3
votes
1 answer

Setting array values in $_SESSION through an accessor method

Can anyone please explain to me why the following code does not set the values on the array as expected? $_SESSION['foo'] stays empty, even after assigning time() and rand(). I've checked, the __get accessor method is actually called when assigning…
ChrisR
  • 14,370
  • 16
  • 70
  • 107
3
votes
4 answers

Multidimensional array to array

I often have a 2-dimensional array: array( array('key' => 'value1'), array('key' => 'value2'), ... ); And need to form a 1-dimensional array: array('value1', 'value2') This can easily be done with foreach, but I wonder if there's some php…
Dziamid
  • 11,225
  • 12
  • 69
  • 104
3
votes
1 answer

Methods of reusing error messages

We are using PHP 5.3 and Zend Framework for a large project, and I've run into a problem of convenience. We reuse the same error messages over and over again in different parts of the application, like "You don't have permission to complete this…
webjawns.com
  • 2,300
  • 2
  • 14
  • 34
3
votes
4 answers

Convert a string into array PHP

Sometime back I was getting alot of data via some API and I saved it into a flat file doing a simple var_dump or print_r. Now I am looking to process the data and each line looks like: " 'middle_initial' => '', 'sid' => '1419843', 'fixed' => 'Y',…
Sparsh Gupta
  • 2,163
  • 5
  • 19
  • 21
3
votes
0 answers

Laravel multiple morph relation in one table

i have problem in laravel. i have created multiple morph in one table. table structure table_name : morphicable id: model_id: eg: '1' model_type: eg 'model/comment' model_one_id: eg: '1' model_one_type: eg 'model/order' in above…
3
votes
4 answers

In PHP, 0 (int, zero) is equal to "first" or "last" (strings)?

I'm confused by something I just ran into in a script I was working on. I had the following: function getPart($part) { $array = array('a', 'b', 'c'); if ($part == 'first') $part = 0; if ($part == 'last') $part = count($array) - 1; …
Nathan Loding
  • 3,185
  • 2
  • 37
  • 43
3
votes
1 answer

Symfony2, access same dispatcher accross multiple bundles

I have a symfony2 bundle that has an event, how can I get multiple other bundles to listen for that event? Ie. how can I pass my dispatcher between bundles?
flyboarder
  • 586
  • 1
  • 5
  • 21
3
votes
5 answers

PHP is handling incorrectly my static call

I'm havinh a problem on PHP 5.3. I need to call a method by using __callStatic, but if I use it in a instancied object, PHP call __call instead. Above a real life example:
David Rodrigues
  • 12,041
  • 16
  • 62
  • 90
3
votes
2 answers

s3 file to local system php

how would I get the file from amazon s3 to local system using php. I am trying to do this but its not working $s3 = new AmazonS3("key 1", " acces pass"); $s3->getObject("Bucket/filename"); //write to local $fp =…
Asim Zaidi
  • 27,016
  • 49
  • 132
  • 221
3
votes
5 answers

Is there a better way to yield CPU to other processes in PHP?

I have some long-running CLI PHP scripts that run regularly via cron. I'd like them to complete as quickly as possible but without seriously impacting other processes (such as web server responsiveness). Currently I am running the script with…
ybull
  • 1,031
  • 10
  • 17
3
votes
1 answer

Change the PHP mysql library from mysqlnd to libmysql (for SSL connections)

I am using the most recent PHP 5.3.6 on a Windows box. I configured a remote MySQL server to accept only SSL connections. Connecting works fine with the MySQL command line client: mysql.exe -u user -h mysql.example.com -P 3307…
andreas
  • 31
  • 2
3
votes
1 answer

What is a good query builder that can parse and rebuild SQL queries on PHP 5.3?

I do not want an ORM. I am comfortable with writing heavily targeted and optimized queries on my own, and I do not want any sort of ORM bloating my code. I am looking for a light-weight, object-oriented query parser and builder that can transform an…
Kenaniah
  • 5,171
  • 24
  • 27
3
votes
1 answer

mysql_insert_id() stopped working after PHP update

I am preparing to update a live web server from PHP 5.2.12 to 5.3.5. In preparation, I have performed the update on a second server which is a mirror of the live one ("dev" server). Both servers are using FreeBSD, and both used ports to install…
Chris Baker
  • 49,926
  • 12
  • 96
  • 115
3
votes
3 answers

Compare Positions of Values in Php Array

$commands = array(); for($p = 0; $p < $commandCount ; $p++){ $commands[$p] = $_POST['select'.$p]; } So I have this Array $commands. In this Array, a List of Commands is stored. I have to check on which Position the Command "mark"…