Automattic / Automattic/babble

Always undefined $leavename variable.

Open
#352 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
250
Forks
44
PR merge metrics
No merged PRs in 30d

Description

Why do you have a 100% undeclared variable? It will never be declared in this function.

```
/**
* Hooks the get_sample_permalink filter to provide a correct sample permalink
* in situations where the post_name has been hacked for a particular context.
*
* @filter get_sample_permalink (not yet in existence, see http://core.trac.wordpress.org/attachment/ticket/22338)
*
* @param array $permalink The array, like array( $permalink, $post_name )
* @param string $title A desired title (could be null)
* @param string $name A desired post name (could be null)
* @param int $id The Post ID
* @param object $post A (hacked) Post object
* @return array The array, like array( $permalink, $post_name )
*/
public function get_sample_permalink( $permalink, $title, $name, $id, $post ) {
$permalink[ 0 ] = $this->post_type_link( $permalink[ 0 ], $post, $leavename );
return $permalink;
}
```

Contributor guide

Open the contributing guide

Research direction

Locate the get_sample_permalink method shown in the issue and inspect how post_type_link is defined and called. Verify the intended handling of its third argument, then confirm the change removes the undefined-variable warning without altering the returned permalink; no test file is mentioned.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.