Title: [Plugin: PHP Snippets] Case sensitive variables
Last modified: August 20, 2016

---

# [Plugin: PHP Snippets] Case sensitive variables

 *  [AlexHendersonGeordieSoft](https://wordpress.org/support/users/alexhendersongeordiesoft/)
 * (@alexhendersongeordiesoft)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-case-sensitive-variables/)
 * Hi,
 * When I pass a variable to a snippet shortcode if it has case-sensitivity this
   is lost in the PHP.
 * eg.
    This is OK [my-snippet myvar=myval]
 * This doesn’t work
    [my-snippet myVar=myval]
 * Just thought I’d let you know. Could easily be me doing something wrong 🙂
 * Alex
 * [http://wordpress.org/extend/plugins/php-snippets/](http://wordpress.org/extend/plugins/php-snippets/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-case-sensitive-variables/#post-2581277)
 * Normally this type of thing should be filed as a bug report: [http://code.google.com/p/wordpress-php-snippets/issues/list](http://code.google.com/p/wordpress-php-snippets/issues/list)
 * I looked into this… the culprit is WordPress. Check out wp-includes/shortcodes.
   php:
 *     ```
       function shortcode_parse_atts($text) {
       	$atts = array();
       	$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
       	$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);
       	if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) {
       		foreach ($match as $m) {
       			if (!empty($m[1]))
       				$atts[strtolower($m[1])] = stripcslashes($m[2]);
       			elseif (!empty($m[3]))
       				$atts[strtolower($m[3])] = stripcslashes($m[4]);
       			elseif (!empty($m[5]))
       				$atts[strtolower($m[5])] = stripcslashes($m[6]);
       			elseif (isset($m[7]) and strlen($m[7]))
       				$atts[] = stripcslashes($m[7]);
       			elseif (isset($m[8]))
       				$atts[] = stripcslashes($m[8]);
       		}
       	} else {
       		$atts = ltrim($text);
       	}
       	return $atts;
       }
       ```
   
 * All those instances of `strtolower` is what’s causing this. It’s good to know…
   I had no idea WP was forcing arguments to be lower-case…. that’s kinda dumb. 
   I filed a bug in the WordPress bug-tracker: [http://core.trac.wordpress.org/ticket/20077](http://core.trac.wordpress.org/ticket/20077)
 *  Thread Starter [AlexHendersonGeordieSoft](https://wordpress.org/support/users/alexhendersongeordiesoft/)
 * (@alexhendersongeordiesoft)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-case-sensitive-variables/#post-2581299)
 * Hi Mr Socks,
 * Thanks for looking into this. One to watch out for!
 * Best wishes,
    Alex

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: PHP Snippets] Case sensitive variables’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/php-snippets.svg)
 * [PHP Snippets](https://wordpress.org/plugins/php-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/php-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-snippets/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [AlexHendersonGeordieSoft](https://wordpress.org/support/users/alexhendersongeordiesoft/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-php-snippets-case-sensitive-variables/#post-2581299)
 * Status: not resolved