Ticket #6534 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

Use of ctype_digit in link_template.php can break uploader.

Reported by: Otto42 Assigned to: 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 (0.7 kB) - added by mtekk on 04/02/08 01:19:11.

Change History

04/02/08 01:19:11 changed by mtekk

  • attachment link-template.php.diff added.

04/02/08 01:21:07 changed by mtekk

  • keywords set to has-patch.

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.

04/02/08 16:16:16 changed by westi

  • owner changed from anonymous to westi.
  • status changed from new to assigned.

Gentoos recommended use flags do include ctype.

04/02/08 16:18:12 changed by westi

  • 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.

04/02/08 16:18:30 changed by westi

  • status changed from closed to reopened.
  • resolution deleted.

re-open for 2.5.1

04/02/08 16:19:32 changed by westi

  • 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.