Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6157071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:43:21+00:00 2026-05-23T20:43:21+00:00

i often run into a problem when variables/attributes have the wrong type. The Problem

  • 0

i often run into a problem when variables/attributes have the wrong type. The Problem is that it is hard to trace since my PHP (5.3) just crashes, does not put out an error or even write to the error log (*1). It just crashes.

I think accessing a string like an array shouldn’t be untraceable should it? I mean, PHP is not C right?

Is there a way to change this behavior or some sort of best practice to get around this problem?
Apart from checking every variable everywhere all the time and therefore writing 5 times more code?

[Update]:
Okay, if i simplify the code outside Zend it seems to work. It must be Zend related somehow. Though i do have all the phpSettings set in my application.ini:

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
phpSettings.error_reporting = "E_ALL|E_STRICT"

And the code causing the Error (which works in a sandbox as i just tried) is this:

$prefix = (strpos($obj[3][1], 'videometa') !== false) ? "http://www7.example.org" : "http://www.example.org";

Where $obj is a json string.

[Update 2]:
So i tried echoing the php setting using ini_get right above my code and it says error_reporting is on E_ALL|E_STRICT, display_error is ON etc.

So this:

echo '<br/>ini_get = '.ini_get('display_errors').';';
echo '<br/>ini_get = '.ini_get('error_reporting').';';
echo '<br/>ini_get = '.ini_get('error_log').';';
echo '<br>$obj: ';
$obj = 'peter';
var_dump($obj);

echo '<br/>Now for the critical code:';
$prefix = (strpos($obj[MC_IMAGETYPE_VDT][1], 'videometa') !== false) ? "http://www7.example.org" : "http://www.example.org";

echo '<br/>It never shows this!';

Puts out this:

ini_get = 1;
ini_get = E_ALL|E_STRICT;
ini_get = /Applications/MAMP/logs/php_error.log;
$obj: string(5) "peter"

Now for the critical code:

And then stops.
Any Ideas?

*1. php.ini has display_errors = On and error_reporting = E_ALL and so on. All good.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:43:22+00:00Added an answer on May 23, 2026 at 8:43 pm

    I don’t think the method you are using to set error reporting is correct, you are setting it to a string value when it should be numeric (or a constant such as E_ALL which has a numeric value). Try just:

    phpSettings.error_reporting = E_ALL|E_STRICT
    

    (i.e. no quotes) or:

    phpSettings.error_reporting = 32767
    

    If all else fails you could always temporarily set the error reporting value above the code that you think is causing the problem:

    error_reporting(E_ALL);
    

    also, you have:

    $prefix = (strpos($obj[MC_IMAGETYPE_VDT][1], 'videometa') !== false) ? "http://www7.example.org" : "http://www.example.org";
    

    but $obj is a string which you are trying to access as a nested array. This will give you Fatal error: Cannot use string offset as an array which is probably why your code is failing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I often run into the problem that I have one stream full of data
I'm using TextWrangler to edit PHP code. I often run into the problem that
I'm sure others have run into this problem too... I often watch videos in
I often run into the following problem. I work on some changes to a
One of the problems I often run into, is that I will include '
I often run into code that has to perform lots of checks and ends
Something that I often run into with my users is their desire to aquire
This is a problem I often run into, and my solution has always to
I run into the problem of clashing automatic related names, and often having a
As a web developer you often run into problems that might be solved very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.