• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

Code breaks with the number 14

I have written a small one page php page that generates an image. Here's the problem, everything works fine until I have the integer 14 anywhere in my code. If the number 14 is present, it breaks my images (red X) until something is selected in the html form and then it works when called on. If you call on it with no selections in the html form it breaks again. I have tested this scenario using  three different methods. A while loop, a conditional statement, and a case statement. No matter what, if THE NUMBER 14 is present ANYWHERE in the code it breaks the image until something is selected to use that portion of the code. Makes no sense to me. I don't even think this will be answered but I am stuck and thought I'd give experts a try. If I could give a 1000 points for this one... I would.
1 Solution
please show use the code which fails.
Beverley PortlockCommented:
Can you point us at the website in question or at least post some code? We may be hot on PHP but we're all weak on telepathy......


RusselautoAuthor Commented:
I like that, your weak on telepathy. Seriously I laughed when I read that! OK the site is not live even if it was you would just see the red x. The code is real short and simple. Example:
$im = imagecreatefrompng("image.png");
$n = count($array)
case 7:
do this;
case 14:
do that;
If it any of the case values are met ie: 7 or 14 it works fine. If none... it breaks. But don't focus on the code. Let me re-state the question. Has anyone ever had an integer break something merely by being present in the code?
comment out the 14...  // case 14: or even change the 14.... case 18: and everything works rather the case values exist or not. This is an anomoly. Has anyone ever run into something like this before? Assume it's not a syntax error, it's not a method error, it breaks when 14 is seen PERIOD. I swear this to be true. I can place the 14 anywhere and is breaks. It doesn't have to be in a function. It can be a one liner....     if ($n == 14) {}   IT BREAKS!
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Guess it's an error happen which breaks the image-coding. If that happen right-click on the image->View Image and then On the new opened image View the Source of the Image and look which php-errors/notices are mentioned in the file.
>> Has anyone ever had an integer break something merely by being present in the code?
Yes, if the code is incorrectly handling the presence of such an integer. This could include:
 - Expecting a different value
 - Expecting a different data type
 - Logic error based on the value

>> don't focus on the code.
We *have* to focus on the code. We can say with confidence that this is not a PHP engine error, so there must be something in the code that is causing this problem. Please post your code exactly as it exists in your script. Also include the exact error message that you receive ("it breaks" could mean any number of different things).
RusselautoAuthor Commented:
Your suggestion led me to discover the error that is being produced. It somehow is related to an implode function that's being called on. Now I can focus my efforts on the error instead of the anomoly. Thanks hernst.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now