Ticket #6534 (closed defect (bug): fixed)

Opened 4 years ago

Last modified 2 years ago

Use of ctype_digit in link_template.php can break uploader.

Reported by: Otto42 Owned by: westi
Priority: high Milestone: 2.5.1
Component: General Version: 2.5
Severity: major Keywords: has-patch
Cc:

Description

The function ctype_digit() is used in get_attachment_link() in link-template.php, and I've had at least one user tell me that this broke the upload functionality for him.

He reports running PHP 4.3.10 and getting this error:

[Tue Apr 01 23:32:51 2008] [error] [client x.x.x.x] PHP Fatal
error:  Call to undefined function:  ctype_digit() in /xxx/wp-includes/link-template.php on line 182,
referer: http://xxx/wp-admin/media-upload.php?type=image&tab=library&post_id=1&post_mime_type=&s=&m=200804

He also reports that replacing it with is_numeric appears to work fine.

Similar ticket: #5481

Attachments

link-template.php.diff Download (722 bytes) - added by mtekk 4 years ago.

Change History

mtekk4 years ago

  • Keywords has-patch added

I get the same problem in my testbed running php 5.2.6. I don't know why Gentoo doesn't include the ctype functions by default. Ctype is preferred to str_* and is_* functions in most cases according to the php documentation ( http://docs.php.net/manual/en/intro.ctype.php).

I changed it to is_numeric(), it works for me, and I hope the patch I've attached is the correct type.

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Gentoos  recommended use flags do include ctype.

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [7588]) Replace the last usage of ctype_digit with is_numeric. Fixes #6534 for trunk props mtekk.

  • Status changed from closed to reopened
  • Resolution fixed deleted

re-open for 2.5.1

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [7589]) Replace the last usage of ctype_digit with is_numeric. Fixes #6534 for 2.5.1 props mtekk.

Related: #11620

Note: See TracTickets for help on using tickets.