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
7 answers

Use '.class.php' extension for PHP classes?

Is it common practice to append use '.class.php' extension for PHP classes? On PHP.net here: http://php.net/manual/en/function.spl-autoload-register.php there are some examples like this: // Or, using an anonymous function as of PHP…
ale
  • 11,636
  • 27
  • 92
  • 149
3
votes
1 answer

PHP/MySQLi returning incorrect float values using prepared statements

OK. I may be being thick here (it has been known) but have I found an undocumented "feature" of prepared statements in MySQLi in PHP 5.3.x or have I missed something pretty fundamental. Short version - Prepared statements in PHP via MySQLi and…
DaveyBoy
  • 2,928
  • 2
  • 17
  • 27
3
votes
1 answer

Shorter way to access name of class in static method?

Is there a better/shorter way to write the whoAmI method in the following code? It seems a bit unnecessary to create a new object just to get the static class' name.
too much php
  • 88,666
  • 34
  • 128
  • 138
3
votes
2 answers

Late static binding in php 5.3

Please go through below given code it is from php manual foo(); static::foo(); } } class B extends A { /*…
Poonam Bhatt
  • 10,154
  • 16
  • 53
  • 72
3
votes
1 answer

set checkbox checked state based on array values

Let's say I have a bunch of checkbox inputs initially on a page like this: Car
Bike
user765368
  • 19,590
  • 27
  • 96
  • 167
3
votes
2 answers

Issue handling dates in doctrine php

I am having a issue with a date format issue. I am using mysql, doctrine2, and php 5.3. The issue is when I query the database getRepository('Entity\\Srm').findBy($id) I end up with a negative date value of: -0001-11-30 00:00:00. The value that is…
robasc
  • 307
  • 1
  • 5
  • 15
3
votes
2 answers

Callback function running inside object context?

I'm trying to configure an object at runtime passing a callback function like so: class myObject{ protected $property; protected $anotherProperty; public function configure($callback){ if(is_callable($callback)){ $callback(); } …
marcio
  • 10,002
  • 11
  • 54
  • 83
3
votes
2 answers

Strange behavior of isset

isset() in php 5.3 seems to be behaving unexpectedly. I have a class called DB details that encapsulates a bunch of string properties with getters and setters. $dbdetails->getDatabasename() evaluates to a string ("mydb") This throws a 500…
SR Bhaskar
  • 898
  • 7
  • 17
3
votes
1 answer

Error when try to use twig in slim, Fatal error: TwigView::getEnvironment()

i have a problem when i want to try implementation slim with Twig View. the error : Fatal error: TwigView::getEnvironment() [function.require]: Failed opening required '/Autoloader.php' (include_path='.:/opt/local/etc/php5') in…
viyancs
  • 2,289
  • 4
  • 39
  • 71
3
votes
3 answers

How to use __get() to return null in multilevel object property accessing?

How can I use __get() to return null in multilevel object property accessing the case like this below? For instance, this is my classes, class property { public function __get($name) { return (isset($this->$name)) ? $this->$name :…
Run
  • 54,938
  • 169
  • 450
  • 748
3
votes
2 answers

Is there an overall advantage to using a global secret key in addition to random item-level salts with bcrypt password hashing?

I use bcrypt for password hashing in php 5.3+ I understand that bcrypt uses a random salt that gets built into the resulting hash per item. This makes cracking each hash difficult, and prevents cracking What I don't know is whether there still…
Kzqai
  • 22,588
  • 25
  • 105
  • 137
3
votes
1 answer

Action parameters & Doctrine entities in Symfony 2

We're running a project built on top of Zend Framework 1.x, and are considering moving to Symfony 2. We have a domain model mapped with Doctrine 2. Our (custom built) base controller class extends Zend_Controller_Action to provide a very convenient…
BenMorel
  • 34,448
  • 50
  • 182
  • 322
3
votes
3 answers

Why does this regex capture produce 2 matches?

I do not know why there are 2 matches found aside from the input using this regex, when I expected only 1 match. preg_match(/_(\d(-\d){0,3})\./,$str,$matches); on this file string format name_A-B-C-D.ext. I would expect to get a single match like…
Kim
  • 2,747
  • 7
  • 41
  • 50
2
votes
2 answers

Getting Upload Image mime type is application/octet-stream

While uploading file I am getting mime-type as application/octet-stream. I have come to know that Zend_Frameworks tries to determine the mimetype in two ways: First it tries to use the PECL FILEINFO-Extension (which is not installed on every…
Rajan Rawal
  • 6,171
  • 6
  • 40
  • 62
2
votes
1 answer

json_decode return null when a value is empty

I came across this problem when trying to decode json into an array, for instance, it works fine like this, $year = 2012; $month = 3; $json = '{"year":'.$year.', "month":'.$month.'}'; $config = json_decode($json,true); var_dump($config); //…
Run
  • 54,938
  • 169
  • 450
  • 748