I'm trying to create my first module. I'm basing it off of the Example module.
The URL that is causing me a problem is ..../postnuke/html/index.php?module=SpyTools&type=admin&func=modify&hector=zabcde
The problem?
The value for hector after
list($hector)= pnVarCleanFromInput('hector');
is "z". Just one "z". I'm guessing the answer is simple, but my brain is fried and can't come up with possibilities.
Has anyone experienced this before?
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- internetking created topic »password problem« 25. May
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
- mdee created topic »How to implement returnpage ?« 25. May
- nestormateo responded to »Fillters in Clip« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
pnVarCleanFromInput oddity
-
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Jul 27, 2006
- Posts: 4
And the problem mysteriously disappeared. I have no idea what, if anything, I changed to get it behave.
Now to figure out why one of my modules is returning the dreaded:
"Error! Sorry! Bad arguments passed to API function" message. -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Jul 27, 2006
- Posts: 4
Ok. The problem is back again. I think the disappearance of the problem had to do with re-using the same URL in the browser address bar.
I'm on the admin view page for all of my entries and click on the edit link. The link has the proper value for the element "&name=test", but when I "extract($args)" only one character is extracted.
This is making me wonder if there is a setting, somewhere, that tells it to extract only one character.
I just checked the Example module and it seems to be working ok when the link for edit has a parameter > than 1 character.
Ideas?
*edit*
More information. When the admin function is called to create an item, extract appears to be pulling all of the values properly. They gets stored into the database properly because it is displayed properly on a "view". The link for edit has the whole name, but extract does not extract the whole name from the URL. Just the first letter.
edited by: madmoravian, Jul 26, 2006 - 04:59 PM -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
personofinterest
Just out of curiosity, why are you using 'list' when you're only getting one val? Why not just:
Code
$hector = pnVarCleanFromInput('hector');
Which is the exact problem... List breaks that single variable apart as if it where an array. i.e. a string is an array of characters so list puts the first character into the variable.
This issue is a common one and has been covered in the developers forums a number of times.
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Jul 27, 2006
- Posts: 4
Uh, because I didn't know better. That's what taking existing code and tweaking without thinking will do to you.
Thanks for the help. My brain and my code thank you.
I apologize for posting a topic that had been covered before. I did search before posting, but didn't find anything.
- Moderated by:
- Support
